うちの子

生後35日目です。
10分で実装したのでちょっと雑な動作をします。
未試験です。

package com.awwa.newborn;

import Human;

public class Newborn extends Human {

public static final int OUTPUT_NO_CRY = 0;
public static final int OUTPUT_CRY = 1;

public static final int STATE_HUNGRY = 0;
public static final int STATE_WET = 1;
public static final int STATE_SLEEPY = 2;

private int state = STATE_HUNGRY;
private int outputState = OUTPUT_CRY;

@Override
private static void life()
{
while( true )
{
try
{
switch(state)
{
case STATE_HUNGRY:
throw new HumanException(OUTPUT_CRY);
break;
case STATE_WET:
throw new HumanException(OUTPUT_CRY);
break;
case STATE_SLEEPY:
throw new HumanException(OUTPUT_CRY);
break;
}
Thread.Sleep(10800000);
}
catch (HumanException ex)
{
outputState = ex.getMessage();
publishState(outputState);
}
finally
{
continue;
}
}
}
}

コメント

このブログの人気の投稿

Execノードを使う

Joinノードを使う(その4)

SendGridのX-SMTPAPIヘッダの使い方(Section Tags、Substitution Tags編)