Project

General

Profile

« Previous | Next » 

Revision 62054004

Added by Leszek Koltunski 11 months ago

Move signatures and ObjectConstants to Metadata.

View differences:

src/main/java/org/distorted/solvers/ImplementedSolversList.java
10 10
package org.distorted.solvers;
11 11

  
12 12
import org.distorted.main.R;
13
import org.distorted.objectlib.signature.ObjectConstants;
13
import org.distorted.objectlib.metadata.MetadataCUBE_2;
14
import org.distorted.objectlib.metadata.MetadataCUBE_3;
15
import org.distorted.objectlib.metadata.MetadataCU_232;
16
import org.distorted.objectlib.metadata.MetadataCU_323;
17
import org.distorted.objectlib.metadata.MetadataDIAM_2;
18
import org.distorted.objectlib.metadata.MetadataDIN4_3;
19
import org.distorted.objectlib.metadata.MetadataDINO_3;
20
import org.distorted.objectlib.metadata.MetadataIVY_2;
21
import org.distorted.objectlib.metadata.MetadataJING_2;
22
import org.distorted.objectlib.metadata.MetadataPDIA_3;
23
import org.distorted.objectlib.metadata.MetadataPDUO_2;
24
import org.distorted.objectlib.metadata.MetadataPYRA_3;
25
import org.distorted.objectlib.metadata.MetadataSKEW_2;
14 26

  
15 27
///////////////////////////////////////////////////////////////////////////////////////////////////
16 28

  
17 29
public enum ImplementedSolversList
18 30
{
19
  CUBE2          (ObjectConstants.CUBE_2, R.string.solver_cube2_title, R.string.solver_cube2_description, true),
20
  CUBE3_KOCIEMBA (ObjectConstants.CUBE_3, R.string.solver_cube3_title, R.string.solver_cube3_description, true),
21
  CU_232         (ObjectConstants.CU_232, R.string.solver_cu232_title, R.string.solver_cu232_description, true),
22
  CU_323         (ObjectConstants.CU_323, R.string.solver_cu323_title, R.string.solver_cu323_description, true),
23
  PYRAMINX       (ObjectConstants.PYRA_3, R.string.solver_pyra3_title, R.string.solver_pyra3_description, true),
24
  SKEWB          (ObjectConstants.SKEW_2, R.string.solver_skew2_title, R.string.solver_skew2_description, true),
25
  PYRAMINX_DUO   (ObjectConstants.PDUO_2, R.string.solver_pduo2_title, R.string.solver_pduo2_description, true),
26
  IVY            (ObjectConstants.IVY_2 , R.string.solver_ivy_title, R.string.solver_ivy_description, true),
27
  DIAMOND        (ObjectConstants.DIAM_2, R.string.solver_diam2_title, R.string.solver_diam2_description, true),
28
  JING2          (ObjectConstants.JING_2, R.string.solver_jing2_title, R.string.solver_jing2_description, true),
29
  DINO6          (ObjectConstants.DINO_3, R.string.solver_dino6_title, R.string.solver_dino6_description, true),
30
  DINO4          (ObjectConstants.DIN4_3, R.string.solver_dino4_title, R.string.solver_dino4_description, true),
31
  PDIA           (ObjectConstants.PDIA_3, R.string.solver_pdia_title, R.string.solver_pdia_description, true),
31
  CUBE2          (MetadataCUBE_2.INDEX, R.string.solver_cube2_title, R.string.solver_cube2_description, true),
32
  CUBE3_KOCIEMBA (MetadataCUBE_3.INDEX, R.string.solver_cube3_title, R.string.solver_cube3_description, true),
33
  CU_232         (MetadataCU_232.INDEX, R.string.solver_cu232_title, R.string.solver_cu232_description, true),
34
  CU_323         (MetadataCU_323.INDEX, R.string.solver_cu323_title, R.string.solver_cu323_description, true),
35
  PYRAMINX       (MetadataPYRA_3.INDEX, R.string.solver_pyra3_title, R.string.solver_pyra3_description, true),
36
  SKEWB          (MetadataSKEW_2.INDEX, R.string.solver_skew2_title, R.string.solver_skew2_description, true),
37
  PYRAMINX_DUO   (MetadataPDUO_2.INDEX, R.string.solver_pduo2_title, R.string.solver_pduo2_description, true),
38
  IVY            (MetadataIVY_2.INDEX , R.string.solver_ivy_title, R.string.solver_ivy_description, true),
39
  DIAMOND        (MetadataDIAM_2.INDEX, R.string.solver_diam2_title, R.string.solver_diam2_description, true),
40
  JING2          (MetadataJING_2.INDEX, R.string.solver_jing2_title, R.string.solver_jing2_description, true),
41
  DINO6          (MetadataDINO_3.INDEX, R.string.solver_dino6_title, R.string.solver_dino6_description, true),
42
  DINO4          (MetadataDIN4_3.INDEX, R.string.solver_dino4_title, R.string.solver_dino4_description, true),
43
  PDIA           (MetadataPDIA_3.INDEX, R.string.solver_pdia_title, R.string.solver_pdia_description, true),
32 44
  ;
33 45

  
34 46
  public static final int NUM_OBJECTS = values().length;
src/main/java/org/distorted/solvers/SolverMain.java
12 12
import android.content.res.Resources;
13 13

  
14 14
import org.distorted.objectlib.helpers.OperatingSystemInterface;
15
import org.distorted.objectlib.signature.ObjectConstants;
16 15
import org.distorted.objectlib.main.TwistyObject;
17 16

  
18 17
import org.distorted.main.R;
18
import org.distorted.objectlib.metadata.MetadataCUBE_2;
19
import org.distorted.objectlib.metadata.MetadataCUBE_3;
20
import org.distorted.objectlib.metadata.MetadataCU_232;
21
import org.distorted.objectlib.metadata.MetadataCU_323;
22
import org.distorted.objectlib.metadata.MetadataDIAM_2;
23
import org.distorted.objectlib.metadata.MetadataDIN4_3;
24
import org.distorted.objectlib.metadata.MetadataDINO_3;
25
import org.distorted.objectlib.metadata.MetadataIVY_2;
26
import org.distorted.objectlib.metadata.MetadataJING_2;
27
import org.distorted.objectlib.metadata.MetadataPDIA_3;
28
import org.distorted.objectlib.metadata.MetadataPDUO_2;
29
import org.distorted.objectlib.metadata.MetadataPYRA_3;
30
import org.distorted.objectlib.metadata.MetadataSKEW_2;
19 31
import org.distorted.solverui.ScreenList;
20 32
import org.distorted.solverui.ScreenSolver;
21 33

  
......
47 59

  
48 60
  public static int cubitIsLocked(int object, int cubit)
49 61
    {
50
    if( object == ObjectConstants.CUBE_3 )
62
    if( object == MetadataCUBE_3.INDEX )
51 63
      {
52 64
      if( cubit==20 ) return 0; // center of the right  face
53 65
      if( cubit==21 ) return 1; // center of the left   face
......
74 86
    {
75 87
    ScreenSolver screen = (ScreenSolver) ScreenList.SVER.getScreenClass();
76 88

  
77
    if( mSignature==ObjectConstants.CUBE_3 )
89
    if( mSignature == MetadataCUBE_3.INDEX )
78 90
      {
79 91
      SolverCube3 solver = new SolverCube3(mOS,mRes,mObject);
80 92
      solver.solve(screen);
81 93
      }
82
    else if( mSignature==ObjectConstants.PDUO_2 )
94
    else if( mSignature == MetadataPDUO_2.INDEX )
83 95
      {
84 96
      SolverTablebase solver = new SolverPyraminxDuo(mOS,mRes,mObject);
85 97
      solver.solve(screen);
86 98
      }
87
    else if( mSignature==ObjectConstants.IVY_2 )
99
    else if( mSignature == MetadataIVY_2.INDEX )
88 100
      {
89 101
      SolverTablebase solver = new SolverIvyCube(mOS,mRes,mObject);
90 102
      solver.solve(screen);
91 103
      }
92
    else if( mSignature==ObjectConstants.CU_232 )
104
    else if( mSignature == MetadataCU_232.INDEX )
93 105
      {
94 106
      SolverTablebase solver = new SolverCuboid232(mOS,mRes,mObject);
95 107
      solver.solve(screen);
96 108
      }
97
    else if( mSignature==ObjectConstants.CU_323 )
109
    else if( mSignature == MetadataCU_323.INDEX )
98 110
      {
99 111
      SolverTablebase solver = new SolverCuboid323(mOS,mRes,mObject);
100 112
      solver.solve(screen);
101 113
      }
102
    else if( mSignature==ObjectConstants.PYRA_3 )
114
    else if( mSignature == MetadataPYRA_3.INDEX )
103 115
      {
104 116
      SolverTablebase solver = new SolverPyraminx(mOS,mRes,mObject);
105 117
      solver.solve(screen);
106 118
      }
107
    else if( mSignature==ObjectConstants.DIAM_2 )
119
    else if( mSignature == MetadataDIAM_2.INDEX )
108 120
      {
109 121
      SolverTablebase solver = new SolverSkewbDiamond(mOS,mRes,mObject);
110 122
      solver.solve(screen);
111 123
      }
112
    else if( mSignature==ObjectConstants.CUBE_2 )
124
    else if( mSignature == MetadataCUBE_2.INDEX )
113 125
      {
114 126
      SolverTablebase solver = new SolverCube2(mOS,mRes,mObject);
115 127
      solver.solve(screen);
116 128
      }
117
    else if( mSignature==ObjectConstants.JING_2 )
129
    else if( mSignature == MetadataJING_2.INDEX )
118 130
      {
119 131
      SolverTablebase solver = new SolverJing(mOS,mRes,mObject);
120 132
      solver.solve(screen);
121 133
      }
122
    else if( mSignature==ObjectConstants.SKEW_2 )
134
    else if( mSignature == MetadataSKEW_2.INDEX )
123 135
      {
124 136
      SolverTablebase solver = new SolverSkewb(mOS,mRes,mObject);
125 137
      solver.solve(screen);
126 138
      }
127
    else if( mSignature==ObjectConstants.DINO_3 )
139
    else if( mSignature == MetadataDINO_3.INDEX )
128 140
      {
129 141
      SolverTablebase solver = new SolverDino6(mOS,mRes,mObject);
130 142
      solver.solve(screen);
131 143
      }
132
    else if( mSignature==ObjectConstants.DIN4_3 )
144
    else if( mSignature == MetadataDIN4_3.INDEX )
133 145
      {
134 146
      SolverTablebase solver = new SolverDino4(mOS,mRes,mObject);
135 147
      solver.solve(screen);
136 148
      }
137
    else if( mSignature==ObjectConstants.PDIA_3 )
149
    else if( mSignature == MetadataPDIA_3.INDEX )
138 150
      {
139 151
      SolverTablebase solver = new SolverPyraminxDiamond(mOS,mRes,mObject);
140 152
      solver.solve(screen);
src/main/java/org/distorted/solverui/ScreenSolver.java
34 34
import org.distorted.main.R;
35 35
import org.distorted.objectlib.main.ObjectControl;
36 36
import org.distorted.objectlib.main.TwistyObject;
37
import org.distorted.objectlib.metadata.MetadataBALL_4;
38
import org.distorted.objectlib.metadata.MetadataCRYS_3;
39
import org.distorted.objectlib.metadata.MetadataDIAM_2;
40
import org.distorted.objectlib.metadata.MetadataDIAM_3;
41
import org.distorted.objectlib.metadata.MetadataDIAM_4;
42
import org.distorted.objectlib.metadata.MetadataDIN4_3;
43
import org.distorted.objectlib.metadata.MetadataICOS_2;
44
import org.distorted.objectlib.metadata.MetadataJING_2;
45
import org.distorted.objectlib.metadata.MetadataKILO_3;
46
import org.distorted.objectlib.metadata.MetadataKILO_5;
47
import org.distorted.objectlib.metadata.MetadataMEGA_3;
48
import org.distorted.objectlib.metadata.MetadataMEGA_5;
49
import org.distorted.objectlib.metadata.MetadataMORP_2;
50
import org.distorted.objectlib.metadata.MetadataMORP_3;
51
import org.distorted.objectlib.metadata.MetadataMORP_4;
52
import org.distorted.objectlib.metadata.MetadataPDIA_3;
53
import org.distorted.objectlib.metadata.MetadataPDUO_2;
54
import org.distorted.objectlib.metadata.MetadataPENT_2;
55
import org.distorted.objectlib.metadata.MetadataPYRA_3;
56
import org.distorted.objectlib.metadata.MetadataPYRA_4;
57
import org.distorted.objectlib.metadata.MetadataPYRA_5;
58
import org.distorted.objectlib.metadata.MetadataSTAR_3;
59
import org.distorted.objectlib.metadata.MetadataTRAJ_3;
60
import org.distorted.objectlib.metadata.MetadataTRAJ_4;
37 61
import org.distorted.objectlib.shape.ShapeDiamond;
38 62
import org.distorted.objectlib.shape.ShapeDodecahedron;
39 63
import org.distorted.objectlib.shape.ShapeHexahedron;
40 64
import org.distorted.objectlib.shape.ShapeIcosahedron;
41 65
import org.distorted.objectlib.shape.ShapeOctahedron;
42 66
import org.distorted.objectlib.shape.ShapeTetrahedron;
43
import org.distorted.objectlib.signature.ObjectConstants;
44 67
import org.distorted.solvers.ImplementedSolversList;
45 68
import org.distorted.solvers.SolverMain;
46 69

  
......
144 167
    {
145 168
    mColorMode = MODE_NORMAL;
146 169

  
147
    if( object== ObjectConstants.PYRA_3 ||
148
        object== ObjectConstants.PYRA_4 ||
149
        object== ObjectConstants.PYRA_5 ||
150
        object== ObjectConstants.PDUO_2 ||
151
        object== ObjectConstants.JING_2 ||
152
        object== ObjectConstants.MORP_2 ||
153
        object== ObjectConstants.MORP_3 ||
154
        object== ObjectConstants.MORP_4  )
170
    if( object==MetadataPYRA_3.INDEX ||
171
        object==MetadataPYRA_4.INDEX ||
172
        object==MetadataPYRA_5.INDEX ||
173
        object==MetadataPDUO_2.INDEX ||
174
        object==MetadataJING_2.INDEX ||
175
        object==MetadataMORP_2.INDEX ||
176
        object==MetadataMORP_3.INDEX ||
177
        object==MetadataMORP_4.INDEX  )
155 178
      {
156 179
      mNumColors  = ShapeTetrahedron.NUM_FACES;
157 180
      mFaceColors = ShapeTetrahedron.FACE_COLORS;
158 181
      }
159
    else if( object== ObjectConstants.DIAM_2 ||
160
             object== ObjectConstants.DIAM_3 ||
161
             object== ObjectConstants.DIAM_4 ||
162
             object== ObjectConstants.TRAJ_3 ||
163
             object== ObjectConstants.TRAJ_4 ||
164
             object== ObjectConstants.PDIA_3  )
182
    else if( object==MetadataDIAM_2.INDEX ||
183
             object==MetadataDIAM_3.INDEX ||
184
             object==MetadataDIAM_4.INDEX ||
185
             object==MetadataTRAJ_3.INDEX ||
186
             object==MetadataTRAJ_4.INDEX ||
187
             object==MetadataPDIA_3.INDEX  )
165 188
      {
166 189
      mNumColors  = ShapeOctahedron.NUM_FACES;
167 190
      mFaceColors = ShapeOctahedron.FACE_COLORS;
168 191
      }
169
    else if( object== ObjectConstants.CRYS_3 ||
170
             object== ObjectConstants.STAR_3 ||
171
             object== ObjectConstants.PENT_2 ||
172
             object== ObjectConstants.KILO_3 ||
173
             object== ObjectConstants.KILO_5 ||
174
             object== ObjectConstants.MEGA_3 ||
175
             object== ObjectConstants.MEGA_5  )
192
    else if( object==MetadataCRYS_3.INDEX ||
193
             object==MetadataSTAR_3.INDEX ||
194
             object==MetadataPENT_2.INDEX ||
195
             object==MetadataKILO_3.INDEX ||
196
             object==MetadataKILO_5.INDEX ||
197
             object==MetadataMEGA_3.INDEX ||
198
             object==MetadataMEGA_5.INDEX  )
176 199
      {
177 200
      mNumColors  = ShapeDodecahedron.NUM_FACES;
178 201
      mFaceColors = ShapeDodecahedron.FACE_COLORS;
179 202
      }
180
    else if( object== ObjectConstants.BALL_4 )
203
    else if( object==MetadataBALL_4.INDEX )
181 204
      {
182 205
      mNumColors  = ShapeDiamond.NUM_FACES;
183 206
      mFaceColors = ShapeDiamond.FACE_COLORS;
184 207
      }
185
    else if( object== ObjectConstants.ICOS_2 )
208
    else if( object==MetadataICOS_2.INDEX )
186 209
      {
187 210
      mNumColors  = ShapeIcosahedron.NUM_FACES;
188 211
      mFaceColors = ShapeIcosahedron.FACE_COLORS;
189 212
      }
190
    else if( object== ObjectConstants.DIN4_3 )
213
    else if( object==MetadataDIN4_3.INDEX )
191 214
      {
192 215
      mNumColors  = 4;
193 216
      mFaceColors = new int[] { COLOR_YELLOW, COLOR_RED, COLOR_BLUE, COLOR_WHITE };

Also available in: Unified diff