Project

General

Profile

« Previous | Next » 

Revision d36d8517

Added by Leszek Koltunski about 2 years ago

Refactor RubikObject in preparation for creating RubikObjects from DownloadedObjects.

View differences:

src/main/java/org/distorted/objects/RubikObject.java
40 40
{
41 41
  private final String mName;
42 42
  private final int mNumScramble;
43
  private final int mOrdinal;
44 43
  private final int mJsonID, mMeshID, mExtrasID;
45 44
  private final int mIconID;
46 45
  private final String[][] mPatterns;
......
53 52

  
54 53
  RubikObject(ObjectType type)
55 54
    {
55
    int ordinal= type.ordinal();
56

  
56 57
    mName        = type.name();
57 58
    mNumScramble = type.getNumScramble();
58
    mOrdinal     = type.ordinal();
59 59

  
60 60
    mIconID      = type.getIconID();
61
    mJsonID      = ObjectJson.getObjectJsonID(mOrdinal);
62
    mMeshID      = ObjectMesh.getMeshID(mOrdinal);
63
    mExtrasID    = ObjectJson.getExtrasJsonID(mOrdinal);
61
    mJsonID      = ObjectJson.getObjectJsonID(ordinal);
62
    mMeshID      = ObjectMesh.getMeshID(ordinal);
63
    mExtrasID    = ObjectJson.getExtrasJsonID(ordinal);
64 64

  
65
    int patternOrdinal  = RubikPatternList.getOrdinal(mOrdinal);
65
    int patternOrdinal  = RubikPatternList.getOrdinal(ordinal);
66 66
    mPatterns = RubikPatternList.getPatterns(patternOrdinal);
67 67

  
68 68
    mMeshState = MESH_NICE;
......
76 76

  
77 77
  RubikObject(RubikObjectList.DownloadedObject object)
78 78
    {
79
    mName = object.shortName;
79
    mName          = object.shortName;
80
    mMeshID        = 0;
81
    mPatterns      = null;
82
    mMeshState     = MESH_NICE;
83
    mExtrasOrdinal = -1;
80 84

  
81
    mNumScramble = type.getNumScramble();
82
    mOrdinal     = type.ordinal();
83 85

  
86

  
87
    mNumScramble = type.getNumScramble();
84 88
    mObjectMinor = ?
85 89
    mExtrasMinor = ?
86

  
87 90
    mIconID      = type.getIconID();
88 91
    mJsonID      = ObjectJson.getObjectJsonID(mOrdinal);
89 92
    mExtrasID    = ObjectJson.getExtrasJsonID(mOrdinal);
90

  
91
    mMeshID   = 0;
92
    mPatterns = null;
93

  
94
    mMeshState = MESH_NICE;
95
    mExtrasOrdinal = -1;
96 93
    }
97 94

  
98 95
///////////////////////////////////////////////////////////////////////////////////////////////////
......
145 142
    return mNumScramble;
146 143
    }
147 144

  
148
///////////////////////////////////////////////////////////////////////////////////////////////////
149

  
150
  public int getOrdinal()
151
    {
152
    return mOrdinal;
153
    }
154

  
155 145
///////////////////////////////////////////////////////////////////////////////////////////////////
156 146

  
157 147
  public void setIconTo(ImageButton button)

Also available in: Unified diff