litesoft
Diff Revisions
949
vs
950
for /trunk/GWT_Sandbox/MultiModule/anywhere/src/org/litesoft/sandbox/anywhere/die/Die.java
|
@@ -1,54 +1,54 @@ |
1 |
|
- |
package org.litesoft.sandbox.anywhere.die; |
2 |
|
- |
|
3 |
|
- |
public class Die { |
4 |
|
- |
private State mState; |
5 |
|
- |
|
6 |
|
- |
public Die( Identifier pIdentifier ) { |
7 |
|
- |
if ( pIdentifier == null ) { |
8 |
|
- |
pIdentifier = new Identifier( Orientation.R, 1, 2 ); |
9 |
|
- |
} |
10 |
|
- |
mState = new State( pIdentifier.getOrientation() ); |
11 |
|
- |
mState.adjustTo( pIdentifier ); |
12 |
|
- |
} |
13 |
|
- |
|
14 |
|
- |
public Die() { |
15 |
|
- |
this( null ); |
16 |
|
- |
} |
17 |
|
- |
|
18 |
|
- |
public Identifier getCurrentIdentifier() { |
19 |
|
- |
return mState.getIdentifier(); |
20 |
|
- |
} |
21 |
|
- |
|
22 |
|
- |
public int getResult() { |
23 |
|
- |
return mState.getValue(); |
24 |
|
- |
} |
25 |
|
- |
|
26 |
|
- |
public void makeViewResult( View pViewToMakeResult ) { |
27 |
|
- |
switch ( pViewToMakeResult ) { |
28 |
|
- |
default: |
29 |
|
- |
case Result: |
30 |
|
- |
break; |
31 |
|
- |
case North: |
32 |
|
- |
mState.makeNorthResult(); |
33 |
|
- |
break; |
34 |
|
- |
case East: |
35 |
|
- |
mState.makeEastResult(); |
36 |
|
- |
break; |
37 |
|
- |
case West: |
38 |
|
- |
mState.makeWestResult(); |
39 |
|
- |
break; |
40 |
|
- |
case South: |
41 |
|
- |
mState.makeSouthResult(); |
42 |
|
- |
break; |
43 |
|
- |
case Other: |
44 |
|
- |
mState.rollOver(); |
45 |
|
- |
break; |
46 |
|
- |
} |
47 |
|
- |
} |
48 |
|
- |
|
49 |
|
- |
public void makeResult( int pValue ) { |
50 |
|
- |
if ( (1 <= pValue) && (pValue <= 6) ) { |
51 |
|
- |
makeViewResult( mState.getViewForValue( pValue ) ); |
52 |
|
- |
} |
53 |
|
- |
} |
54 |
|
- |
} |
|
1 |
+ |
package org.litesoft.sandbox.anywhere.die; |
|
2 |
+ |
|
|
3 |
+ |
public class Die { |
|
4 |
+ |
private State mState; |
|
5 |
+ |
|
|
6 |
+ |
public Die( Identifier pIdentifier ) { |
|
7 |
+ |
if ( pIdentifier == null ) { |
|
8 |
+ |
pIdentifier = new Identifier( Orientation.R, 1, 2 ); |
|
9 |
+ |
} |
|
10 |
+ |
mState = new State( pIdentifier.getOrientation() ); |
|
11 |
+ |
mState.adjustTo( pIdentifier ); |
|
12 |
+ |
} |
|
13 |
+ |
|
|
14 |
+ |
public Die() { |
|
15 |
+ |
this( null ); |
|
16 |
+ |
} |
|
17 |
+ |
|
|
18 |
+ |
public Identifier getCurrentIdentifier() { |
|
19 |
+ |
return mState.getIdentifier(); |
|
20 |
+ |
} |
|
21 |
+ |
|
|
22 |
+ |
public int getResult() { |
|
23 |
+ |
return mState.getValue(); |
|
24 |
+ |
} |
|
25 |
+ |
|
|
26 |
+ |
public void makeViewResult( View pViewToMakeResult ) { |
|
27 |
+ |
switch ( pViewToMakeResult ) { |
|
28 |
+ |
default: |
|
29 |
+ |
case Result: |
|
30 |
+ |
break; |
|
31 |
+ |
case North: |
|
32 |
+ |
mState.makeNorthResult(); |
|
33 |
+ |
break; |
|
34 |
+ |
case East: |
|
35 |
+ |
mState.makeEastResult(); |
|
36 |
+ |
break; |
|
37 |
+ |
case West: |
|
38 |
+ |
mState.makeWestResult(); |
|
39 |
+ |
break; |
|
40 |
+ |
case South: |
|
41 |
+ |
mState.makeSouthResult(); |
|
42 |
+ |
break; |
|
43 |
+ |
case Other: |
|
44 |
+ |
mState.rollOver(); |
|
45 |
+ |
break; |
|
46 |
+ |
} |
|
47 |
+ |
} |
|
48 |
+ |
|
|
49 |
+ |
public void makeResult( int pValue ) { |
|
50 |
+ |
if ( (1 <= pValue) && (pValue <= 6) ) { |
|
51 |
+ |
makeViewResult( mState.getViewForValue( pValue ) ); |
|
52 |
+ |
} |
|
53 |
+ |
} |
|
54 |
+ |
} |