Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/GWT_Sandbox/MultiModule/anywhere/src/org/litesoft/sandbox/anywhere/die/Identifier.java

Diff revisions: vs.
  @@ -1,61 +1,61 @@
1 - package org.litesoft.sandbox.anywhere.die;
2 -
3 - public class Identifier {
4 - private Orientation mOrientation;
5 - private int mFace; // 1-6
6 - private int mNorthSide; // 1-6
7 -
8 - Identifier( Orientation pOrientation, int pFace, int pNorthSide ) {
9 - mOrientation = pOrientation;
10 - mFace = pFace;
11 - mNorthSide = pNorthSide;
12 - if ( (mFace == mNorthSide) || (mNorthSide == getOppositeSide( mFace )) ) {
13 - throw new IllegalArgumentException( "Invalid Identifier: " + this );
14 - }
15 - }
16 -
17 - public Orientation getOrientation() {
18 - return mOrientation;
19 - }
20 -
21 - public int getFace() {
22 - return mFace;
23 - }
24 -
25 - public int getNorthSide() {
26 - return mNorthSide;
27 - }
28 -
29 - @Override
30 - public String toString() {
31 - return "" + mFace + mOrientation + mNorthSide;
32 - }
33 -
34 - public static Identifier fromString( String pToString ) {
35 - if ( pToString != null ) {
36 - if ( (pToString = pToString.trim()).length() != 0 ) {
37 - try {
38 - return new Identifier( Orientation.valueOf( pToString.substring( 1, 2 ) ), //
39 - parseSide( pToString.substring( 0, 1 ) ), //
40 - parseSide( pToString.substring( 2, 3 ) ) );
41 - }
42 - catch ( RuntimeException e ) {
43 - throw new IllegalArgumentException( "Not a Die Identifier '" + pToString + "'.", e );
44 - }
45 - }
46 - }
47 - return null;
48 - }
49 -
50 - static int parseSide( String pSideNumber ) {
51 - int zSideNumber = Integer.parseInt( pSideNumber );
52 - if ( (1 <= zSideNumber) && (zSideNumber <= 6) ) {
53 - return zSideNumber;
54 - }
55 - throw new IllegalArgumentException( "Not a valid Die Side value: " + pSideNumber );
56 - }
57 -
58 - static int getOppositeSide( int pSideNumber ) {
59 - return 7 - pSideNumber;
60 - }
61 - }
1 + package org.litesoft.sandbox.anywhere.die;
2 +
3 + public class Identifier {
4 + private Orientation mOrientation;
5 + private int mFace; // 1-6
6 + private int mNorthSide; // 1-6
7 +
8 + Identifier( Orientation pOrientation, int pFace, int pNorthSide ) {
9 + mOrientation = pOrientation;
10 + mFace = pFace;
11 + mNorthSide = pNorthSide;
12 + if ( (mFace == mNorthSide) || (mNorthSide == getOppositeSide( mFace )) ) {
13 + throw new IllegalArgumentException( "Invalid Identifier: " + this );
14 + }
15 + }
16 +
17 + public Orientation getOrientation() {
18 + return mOrientation;
19 + }
20 +
21 + public int getFace() {
22 + return mFace;
23 + }
24 +
25 + public int getNorthSide() {
26 + return mNorthSide;
27 + }
28 +
29 + @Override
30 + public String toString() {
31 + return "" + mFace + mOrientation + mNorthSide;
32 + }
33 +
34 + public static Identifier fromString( String pToString ) {
35 + if ( pToString != null ) {
36 + if ( (pToString = pToString.trim()).length() != 0 ) {
37 + try {
38 + return new Identifier( Orientation.valueOf( pToString.substring( 1, 2 ) ), //
39 + parseSide( pToString.substring( 0, 1 ) ), //
40 + parseSide( pToString.substring( 2, 3 ) ) );
41 + }
42 + catch ( RuntimeException e ) {
43 + throw new IllegalArgumentException( "Not a Die Identifier '" + pToString + "'.", e );
44 + }
45 + }
46 + }
47 + return null;
48 + }
49 +
50 + static int parseSide( String pSideNumber ) {
51 + int zSideNumber = Integer.parseInt( pSideNumber );
52 + if ( (1 <= zSideNumber) && (zSideNumber <= 6) ) {
53 + return zSideNumber;
54 + }
55 + throw new IllegalArgumentException( "Not a valid Die Side value: " + pSideNumber );
56 + }
57 +
58 + static int getOppositeSide( int pSideNumber ) {
59 + return 7 - pSideNumber;
60 + }
61 + }