Revision e26eb4e7
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/json/JsonWriter.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2021 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Distorted. // |
|
5 |
// // |
|
6 |
// Distorted is free software: you can redistribute it and/or modify // |
|
7 |
// it under the terms of the GNU General Public License as published by // |
|
8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
9 |
// (at your option) any later version. // |
|
10 |
// // |
|
11 |
// Distorted is distributed in the hope that it will be useful, // |
|
12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
14 |
// GNU General Public License for more details. // |
|
15 |
// // |
|
16 |
// You should have received a copy of the GNU General Public License // |
|
17 |
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. // |
|
18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
19 |
|
|
20 |
package org.distorted.objectlib.json; |
|
21 |
|
|
22 |
import org.distorted.library.type.Static3D; |
|
23 |
import org.distorted.library.type.Static4D; |
|
24 |
import org.distorted.objectlib.helpers.ObjectShape; |
|
25 |
import org.distorted.objectlib.helpers.ObjectSticker; |
|
26 |
import org.distorted.objectlib.helpers.ScrambleState; |
|
27 |
import org.json.JSONArray; |
|
28 |
import org.json.JSONException; |
|
29 |
import org.json.JSONObject; |
|
30 |
|
|
31 |
import org.distorted.objectlib.main.TwistyObject; |
|
32 |
import org.distorted.objectlib.main.ObjectType; |
|
33 |
|
|
34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
35 |
|
|
36 |
public class JsonWriter |
|
37 |
{ |
|
38 |
private static final int VERSION_MAJOR = 1; |
|
39 |
private static final int VERSION_MINOR = 0; |
|
40 |
|
|
41 |
private static JsonWriter mThis; |
|
42 |
|
|
43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
44 |
|
|
45 |
private JsonWriter() |
|
46 |
{ |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
51 |
|
|
52 |
private JSONArray generateCubits(TwistyObject object) throws JSONException |
|
53 |
{ |
|
54 |
JSONArray array = new JSONArray(); |
|
55 |
|
|
56 |
int[] numLayers = object.getNumLayers(); |
|
57 |
float[][] positions = object.getCubitPositions(numLayers); |
|
58 |
int numCubits = positions.length; |
|
59 |
int numFaces = object.getNumCubitFaces(); |
|
60 |
|
|
61 |
for(int i=0; i<numCubits; i++) |
|
62 |
{ |
|
63 |
JSONObject cubit = new JSONObject(); |
|
64 |
Static4D rotQuat = object.getQuat(i,numLayers); |
|
65 |
int variant = object.getCubitVariant(i,numLayers); |
|
66 |
int[] solvedQuats = object.getSolvedQuats(i,numLayers); |
|
67 |
|
|
68 |
JSONArray pos = new JSONArray(); |
|
69 |
int numPos = positions[i].length; |
|
70 |
for(int j=0; j<numPos; j++) pos.put(positions[i][j]); |
|
71 |
cubit.put("centers", pos); |
|
72 |
cubit.put("qx", rotQuat.get0() ); |
|
73 |
cubit.put("qy", rotQuat.get1() ); |
|
74 |
cubit.put("qz", rotQuat.get2() ); |
|
75 |
cubit.put("qw", rotQuat.get3() ); |
|
76 |
cubit.put("variant", variant ); |
|
77 |
|
|
78 |
if( solvedQuats!=null ) |
|
79 |
{ |
|
80 |
JSONArray solved = new JSONArray(); |
|
81 |
for (int solvedQuat : solvedQuats) solved.put(solvedQuat); |
|
82 |
cubit.put("solvedQuats",solved); |
|
83 |
} |
|
84 |
|
|
85 |
JSONArray colors = new JSONArray(); |
|
86 |
|
|
87 |
for(int j=0; j<numFaces; j++) |
|
88 |
{ |
|
89 |
int cubColor = object.getCubitFaceColor(i,j,numLayers); |
|
90 |
colors.put(cubColor); |
|
91 |
} |
|
92 |
cubit.put("colors",colors); |
|
93 |
|
|
94 |
array.put(cubit); |
|
95 |
} |
|
96 |
|
|
97 |
return array; |
|
98 |
} |
|
99 |
|
|
100 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
101 |
|
|
102 |
private JSONArray generateCorners(float[][] corners) throws JSONException |
|
103 |
{ |
|
104 |
JSONArray array = new JSONArray(); |
|
105 |
|
|
106 |
for(float[] c : corners) |
|
107 |
{ |
|
108 |
JSONObject corner = new JSONObject(); |
|
109 |
corner.put("strength", c[0]); |
|
110 |
corner.put("radius" , c[1]); |
|
111 |
array.put(corner); |
|
112 |
} |
|
113 |
|
|
114 |
return array; |
|
115 |
} |
|
116 |
|
|
117 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
118 |
|
|
119 |
private JSONArray generateCenters(float[][] centers) throws JSONException |
|
120 |
{ |
|
121 |
JSONArray array = new JSONArray(); |
|
122 |
|
|
123 |
for(float[] c : centers) |
|
124 |
{ |
|
125 |
JSONObject center = new JSONObject(); |
|
126 |
center.put("x", c[0]); |
|
127 |
center.put("y", c[1]); |
|
128 |
center.put("z", c[2]); |
|
129 |
array.put(center); |
|
130 |
} |
|
131 |
|
|
132 |
return array; |
|
133 |
} |
|
134 |
|
|
135 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
136 |
|
|
137 |
private JSONArray generateBands(float[][] bands) throws JSONException |
|
138 |
{ |
|
139 |
JSONArray array = new JSONArray(); |
|
140 |
|
|
141 |
for (float[] b : bands) |
|
142 |
{ |
|
143 |
JSONObject band = new JSONObject(); |
|
144 |
band.put("height" , b[0]); |
|
145 |
band.put("angle" , b[1]); |
|
146 |
band.put("distanceToCenter", b[2]); |
|
147 |
band.put("distanceToFlat" , b[3]); |
|
148 |
band.put("numOfBands" , b[4]); |
|
149 |
band.put("extraI" , b[5]); |
|
150 |
band.put("extraJ" , b[6]); |
|
151 |
array.put(band); |
|
152 |
} |
|
153 |
|
|
154 |
return array; |
|
155 |
} |
|
156 |
|
|
157 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
158 |
|
|
159 |
private JSONArray generateFaces(TwistyObject object, int[][] vertIndices, int[] bandIndices, int cubit, int[] numLayers) throws JSONException |
|
160 |
{ |
|
161 |
JSONArray array = new JSONArray(); |
|
162 |
int numFaces = vertIndices.length; |
|
163 |
int variant = object.getCubitVariant(cubit,numLayers); |
|
164 |
|
|
165 |
for(int i=0; i<numFaces; i++) |
|
166 |
{ |
|
167 |
JSONObject face = new JSONObject(); |
|
168 |
face.put("bandIndex", bandIndices[i]); |
|
169 |
|
|
170 |
int sticker = object.getVariantFaceColor(variant,i,numLayers); |
|
171 |
face.put("sticker",sticker); |
|
172 |
|
|
173 |
JSONArray vertArr = new JSONArray(); |
|
174 |
int numV = vertIndices[i].length; |
|
175 |
for(int j=0; j<numV; j++) vertArr.put(vertIndices[i][j]); |
|
176 |
face.put("vertexIndices",vertArr); |
|
177 |
|
|
178 |
array.put(face); |
|
179 |
} |
|
180 |
|
|
181 |
return array; |
|
182 |
} |
|
183 |
|
|
184 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
185 |
|
|
186 |
private JSONArray generateVertices(double[][] vertices, int[] cornerIndices, int[] centerIndices) throws JSONException |
|
187 |
{ |
|
188 |
JSONArray array = new JSONArray(); |
|
189 |
int numVertices = vertices.length; |
|
190 |
|
|
191 |
for(int j=0; j<numVertices; j++) |
|
192 |
{ |
|
193 |
JSONObject vert = new JSONObject(); |
|
194 |
vert.put("x", vertices[j][0]); |
|
195 |
vert.put("y", vertices[j][1]); |
|
196 |
vert.put("z", vertices[j][2]); |
|
197 |
vert.put("cornerIndex", cornerIndices[j]); |
|
198 |
vert.put("centerIndex", centerIndices[j]); |
|
199 |
array.put(vert); |
|
200 |
} |
|
201 |
|
|
202 |
return array; |
|
203 |
} |
|
204 |
|
|
205 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
206 |
|
|
207 |
private JSONObject generateConvexity(float[] convexity) throws JSONException |
|
208 |
{ |
|
209 |
JSONObject object = new JSONObject(); |
|
210 |
object.put("x", convexity[0]); |
|
211 |
object.put("y", convexity[1]); |
|
212 |
object.put("z", convexity[2]); |
|
213 |
return object; |
|
214 |
} |
|
215 |
|
|
216 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
217 |
|
|
218 |
private int findCubitWithVariant(TwistyObject object, int variant, int numCubits, int[] numLayers) |
|
219 |
{ |
|
220 |
for(int i=0; i<numCubits; i++) |
|
221 |
{ |
|
222 |
if( object.getCubitVariant(i,numLayers)==variant ) return i; |
|
223 |
} |
|
224 |
|
|
225 |
return -1; |
|
226 |
} |
|
227 |
|
|
228 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
229 |
|
|
230 |
private JSONArray generateShapes(TwistyObject object) throws JSONException |
|
231 |
{ |
|
232 |
JSONArray shapes = new JSONArray(); |
|
233 |
|
|
234 |
int[] numLayers = object.getNumLayers(); |
|
235 |
int numVariants = object.getNumCubitVariants(numLayers); |
|
236 |
float[][] positions = object.getCubitPositions(numLayers); |
|
237 |
int numCubits = positions.length; |
|
238 |
|
|
239 |
for(int i=0; i<numVariants; i++) |
|
240 |
{ |
|
241 |
JSONObject shapeObj = new JSONObject(); |
|
242 |
|
|
243 |
ObjectShape shape = object.getObjectShape(i); |
|
244 |
|
|
245 |
float[] convexity = shape.getConvexityCenter(); |
|
246 |
double[][] vertices= shape.getVertices(); |
|
247 |
int[][] vertIndices= shape.getVertIndices(); |
|
248 |
float[][] bands = shape.getBands(); |
|
249 |
int[] bandIndices = shape.getBandIndices(); |
|
250 |
float[][] corners = shape.getCorners(); |
|
251 |
int[] cornerIndices= shape.getCornerIndices(); |
|
252 |
float[][] centers = shape.getCenters(); |
|
253 |
int[] centerIndices= shape.getCenterIndices(); |
|
254 |
|
|
255 |
int cubit = findCubitWithVariant(object,i,numCubits,numLayers); |
|
256 |
|
|
257 |
if( convexity!=null ) |
|
258 |
{ |
|
259 |
JSONObject convObj = generateConvexity(convexity); |
|
260 |
shapeObj.put("convexity", convObj); |
|
261 |
} |
|
262 |
|
|
263 |
JSONArray verticesArr = generateVertices(vertices,cornerIndices,centerIndices); |
|
264 |
shapeObj.put("vertices", verticesArr); |
|
265 |
JSONArray facesArr = generateFaces(object,vertIndices,bandIndices,cubit,numLayers); |
|
266 |
shapeObj.put("faces", facesArr); |
|
267 |
JSONArray bandsArr = generateBands(bands); |
|
268 |
shapeObj.put("bands", bandsArr); |
|
269 |
JSONArray cornerArr = generateCorners(corners); |
|
270 |
shapeObj.put("cornerPush", cornerArr); |
|
271 |
JSONArray centerArr = generateCenters(centers); |
|
272 |
shapeObj.put("centerPush", centerArr); |
|
273 |
|
|
274 |
shapes.put(shapeObj); |
|
275 |
} |
|
276 |
|
|
277 |
return shapes; |
|
278 |
} |
|
279 |
|
|
280 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
281 |
|
|
282 |
private JSONArray generateStickers(TwistyObject object) throws JSONException |
|
283 |
{ |
|
284 |
JSONArray stickers = new JSONArray(); |
|
285 |
|
|
286 |
int[] numLayers = object.getNumLayers(); |
|
287 |
int numStickers = object.getNumStickerTypes(numLayers); |
|
288 |
|
|
289 |
for(int i=0; i<numStickers; i++) |
|
290 |
{ |
|
291 |
JSONObject stickerObj = new JSONObject(); |
|
292 |
JSONArray vertexArray= new JSONArray(); |
|
293 |
|
|
294 |
ObjectSticker sticker = object.retSticker(i); |
|
295 |
|
|
296 |
float[] coords = sticker.getCoords(); |
|
297 |
float[] curvatures = sticker.getCurvature(); |
|
298 |
float[] radii = sticker.getRadii(); |
|
299 |
float stroke = sticker.getStroke(); |
|
300 |
|
|
301 |
stickerObj.put("stroke", stroke); |
|
302 |
int numVertices = radii.length; |
|
303 |
|
|
304 |
for(int j=0; j<numVertices; j++) |
|
305 |
{ |
|
306 |
JSONObject vertex = new JSONObject(); |
|
307 |
vertex.put("x", coords[2*j ]); |
|
308 |
vertex.put("y", coords[2*j+1]); |
|
309 |
vertex.put("angle", curvatures==null ? 0 : curvatures[j]); |
|
310 |
vertex.put("radius",radii[j]); |
|
311 |
vertexArray.put(vertex); |
|
312 |
} |
|
313 |
stickerObj.put("vertices", vertexArray); |
|
314 |
stickers.put(stickerObj); |
|
315 |
} |
|
316 |
|
|
317 |
return stickers; |
|
318 |
} |
|
319 |
|
|
320 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
321 |
|
|
322 |
private JSONObject generateMesh(TwistyObject object) throws JSONException |
|
323 |
{ |
|
324 |
JSONObject mesh = new JSONObject(); |
|
325 |
|
|
326 |
JSONArray cubits = generateCubits(object); |
|
327 |
JSONArray shapes = generateShapes(object); |
|
328 |
JSONArray stickers = generateStickers(object); |
|
329 |
|
|
330 |
mesh.put("cubits" , cubits); |
|
331 |
mesh.put("shapes" , shapes); |
|
332 |
mesh.put("stickers", stickers); |
|
333 |
|
|
334 |
return mesh; |
|
335 |
} |
|
336 |
|
|
337 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
338 |
|
|
339 |
private JSONObject generateMetadata(TwistyObject object) throws JSONException |
|
340 |
{ |
|
341 |
JSONObject metadata = new JSONObject(); |
|
342 |
|
|
343 |
ObjectType type = object.getObjectType(); |
|
344 |
String inventor = object.getInventor(); |
|
345 |
String shortname = type.name(); |
|
346 |
String lowerShort= shortname.toLowerCase(); |
|
347 |
String longname = object.getObjectName(); |
|
348 |
|
|
349 |
metadata.put("longname" , longname ); |
|
350 |
metadata.put("shortname" , shortname ); |
|
351 |
metadata.put("inventor" , inventor); |
|
352 |
metadata.put("year" , object.getYearOfInvention()); |
|
353 |
metadata.put("complexity" , object.getComplexity()); |
|
354 |
metadata.put("icon_huge" , "h_"+lowerShort+".png"); |
|
355 |
metadata.put("icon_big" , "b_"+lowerShort+".png"); |
|
356 |
metadata.put("icon_medium" , "m_"+lowerShort+".png"); |
|
357 |
metadata.put("icon_small" , "s_"+lowerShort+".png"); |
|
358 |
metadata.put("mesh" , lowerShort+".dmesh"); |
|
359 |
metadata.put("num_scrambles", type.getNumScramble() ); |
|
360 |
metadata.put("size" , object.getSize() ); |
|
361 |
metadata.put("solved_func" , object.getSolvedFunctionIndex() ); |
|
362 |
|
|
363 |
return metadata; |
|
364 |
} |
|
365 |
|
|
366 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
367 |
|
|
368 |
private JSONArray generateQuats(TwistyObject object) throws JSONException |
|
369 |
{ |
|
370 |
JSONArray quatsArray = new JSONArray(); |
|
371 |
Static4D[] quats = object.getQuats(); |
|
372 |
|
|
373 |
for(Static4D quat : quats) |
|
374 |
{ |
|
375 |
JSONObject q = new JSONObject(); |
|
376 |
q.put("x",quat.get0()); |
|
377 |
q.put("y",quat.get1()); |
|
378 |
q.put("z",quat.get2()); |
|
379 |
q.put("w",quat.get3()); |
|
380 |
quatsArray.put(q); |
|
381 |
} |
|
382 |
|
|
383 |
return quatsArray; |
|
384 |
} |
|
385 |
|
|
386 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
387 |
|
|
388 |
private JSONArray generateAxis(TwistyObject object) throws JSONException |
|
389 |
{ |
|
390 |
JSONArray axis = new JSONArray(); |
|
391 |
|
|
392 |
Static3D[] rotAxis = object.getRotationAxis(); |
|
393 |
int numAxis = rotAxis.length; |
|
394 |
int[] basicAngle = object.getBasicAngle(); |
|
395 |
int[] numLayers = object.getNumLayers(); |
|
396 |
float[][] cuts = object.getCuts(numLayers); |
|
397 |
boolean[][] rotatable = object.getLayerRotatable(numLayers); |
|
398 |
|
|
399 |
for( int i=0; i<numAxis; i++ ) |
|
400 |
{ |
|
401 |
JSONObject axObject = new JSONObject(); |
|
402 |
Static3D ax = rotAxis[i]; |
|
403 |
|
|
404 |
axObject.put("x", ax.get0() ); |
|
405 |
axObject.put("y", ax.get1() ); |
|
406 |
axObject.put("z", ax.get2() ); |
|
407 |
axObject.put("basicAngle", basicAngle[i] ); |
|
408 |
|
|
409 |
JSONArray cutsArray = new JSONArray(); |
|
410 |
for(float cut : cuts[i]) cutsArray.put(cut); |
|
411 |
axObject.put("cuts", cutsArray); |
|
412 |
JSONArray rotaArray = new JSONArray(); |
|
413 |
for(boolean rot : rotatable[i]) rotaArray.put(rot); |
|
414 |
axObject.put("rotatable", rotaArray ); |
|
415 |
|
|
416 |
axis.put(axObject); |
|
417 |
} |
|
418 |
|
|
419 |
return axis; |
|
420 |
} |
|
421 |
|
|
422 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
423 |
|
|
424 |
private JSONObject generateScrambling(TwistyObject object) throws JSONException |
|
425 |
{ |
|
426 |
JSONObject scrambling = new JSONObject(); |
|
427 |
|
|
428 |
ScrambleState[] states = object.getScrambleStates(); |
|
429 |
int scrambleType = object.getScrambleType(); |
|
430 |
scrambling.put("scrambleType",scrambleType ); |
|
431 |
|
|
432 |
if( states!=null ) |
|
433 |
{ |
|
434 |
JSONArray scrambleStates = new JSONArray(); |
|
435 |
|
|
436 |
for(ScrambleState state : states) |
|
437 |
{ |
|
438 |
JSONArray axisArray = new JSONArray(); |
|
439 |
int numAxis = state.getNumAxis(); |
|
440 |
|
|
441 |
for(int ax=0; ax<numAxis; ax++) |
|
442 |
{ |
|
443 |
JSONArray axArray = new JSONArray(); |
|
444 |
int[] axData = state.getAx(ax); |
|
445 |
|
|
446 |
if( axData!=null ) |
|
447 |
for(int data : axData) axArray.put(data); |
|
448 |
|
|
449 |
axisArray.put(axArray); |
|
450 |
} |
|
451 |
|
|
452 |
scrambleStates.put(axisArray); |
|
453 |
} |
|
454 |
|
|
455 |
scrambling.put("scrambleStates", scrambleStates); |
|
456 |
} |
|
457 |
|
|
458 |
return scrambling; |
|
459 |
} |
|
460 |
|
|
461 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
462 |
|
|
463 |
private JSONObject generateTouchControl(TwistyObject object) throws JSONException |
|
464 |
{ |
|
465 |
JSONObject touchControl = new JSONObject(); |
|
466 |
|
|
467 |
touchControl.put("movementType" , object.getMovementType() ); |
|
468 |
touchControl.put("movementSplit", object.getMovementSplit() ); |
|
469 |
|
|
470 |
int[][][] enabled = object.getEnabled(); |
|
471 |
|
|
472 |
JSONArray enabledArray = new JSONArray(); |
|
473 |
|
|
474 |
for(int[][] faceEnabled : enabled) |
|
475 |
{ |
|
476 |
JSONArray faceArray = new JSONArray(); |
|
477 |
|
|
478 |
for(int[] sectionEnabled : faceEnabled) |
|
479 |
{ |
|
480 |
JSONArray sectionArray = new JSONArray(); |
|
481 |
for(int ax : sectionEnabled) sectionArray.put(ax); |
|
482 |
faceArray.put(sectionArray); |
|
483 |
} |
|
484 |
enabledArray.put(faceArray); |
|
485 |
} |
|
486 |
|
|
487 |
touchControl.put("enabledAxis", enabledArray); |
|
488 |
|
|
489 |
return touchControl; |
|
490 |
} |
|
491 |
|
|
492 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
493 |
|
|
494 |
public String createJsonString(TwistyObject object) throws JSONException |
|
495 |
{ |
|
496 |
JSONObject json = new JSONObject(); |
|
497 |
|
|
498 |
JSONObject metadata = generateMetadata(object); |
|
499 |
JSONObject mesh = generateMesh(object); |
|
500 |
JSONArray axis = generateAxis(object); |
|
501 |
JSONArray quats = generateQuats(object); |
|
502 |
JSONObject scrambling = generateScrambling(object); |
|
503 |
JSONObject touchControl= generateTouchControl(object); |
|
504 |
|
|
505 |
json.put("major" , VERSION_MAJOR); |
|
506 |
json.put("minor" , VERSION_MINOR); |
|
507 |
json.put("metadata" , metadata); |
|
508 |
json.put("mesh" , mesh); |
|
509 |
json.put("axis" , axis); |
|
510 |
json.put("quats" , quats); |
|
511 |
json.put("scrambling" , scrambling); |
|
512 |
json.put("touchcontrol", touchControl); |
|
513 |
|
|
514 |
String ret = json.toString(); |
|
515 |
android.util.Log.e("D", ret); |
|
516 |
|
|
517 |
return ret; |
|
518 |
} |
|
519 |
|
|
520 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
521 |
|
|
522 |
public static JsonWriter getInstance() |
|
523 |
{ |
|
524 |
if( mThis==null ) mThis = new JsonWriter(); |
|
525 |
return mThis; |
|
526 |
} |
|
527 |
} |
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
1373 | 1373 |
public abstract Static3D[] getRotationAxis(); |
1374 | 1374 |
public abstract int[] getBasicAngle(); |
1375 | 1375 |
public abstract int getNumFaces(); |
1376 |
public abstract int getObjectName(int[] numLayers);
|
|
1377 |
public abstract int getInventor(int[] numLayers);
|
|
1378 |
public abstract int getYearOfInvention(int[] numLayers);
|
|
1379 |
public abstract int getComplexity(int[] numLayers);
|
|
1376 |
public abstract String getObjectName();
|
|
1377 |
public abstract String getInventor();
|
|
1378 |
public abstract int getYearOfInvention(); |
|
1379 |
public abstract int getComplexity(); |
|
1380 | 1380 |
public abstract int getFOV(); |
1381 | 1381 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyBandaged2Bar.java | ||
---|---|---|
119 | 119 |
|
120 | 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
121 | 121 |
|
122 |
public int getObjectName(int[] numLayers)
|
|
122 |
public String getObjectName()
|
|
123 | 123 |
{ |
124 |
return R.string.bandaged_2bar;
|
|
124 |
return "2Bar Cube";
|
|
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
128 | 128 |
|
129 |
public int getInventor(int[] numLayers)
|
|
129 |
public String getInventor()
|
|
130 | 130 |
{ |
131 |
return R.string.bandaged_2bar_inventor;
|
|
131 |
return "unknown";
|
|
132 | 132 |
} |
133 | 133 |
|
134 | 134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
135 | 135 |
|
136 |
public int getYearOfInvention(int[] numLayers)
|
|
136 |
public int getYearOfInvention() |
|
137 | 137 |
{ |
138 | 138 |
return 2000; |
139 | 139 |
} |
140 | 140 |
|
141 | 141 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
142 | 142 |
|
143 |
public int getComplexity(int[] numLayers)
|
|
143 |
public int getComplexity() |
|
144 | 144 |
{ |
145 | 145 |
return 8; |
146 | 146 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyBandaged3Plate.java | ||
---|---|---|
126 | 126 |
|
127 | 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
128 | 128 |
|
129 |
public int getObjectName(int[] numLayers)
|
|
129 |
public String getObjectName()
|
|
130 | 130 |
{ |
131 |
return R.string.bandaged_3plate;
|
|
131 |
return "Bandaged Cube C";
|
|
132 | 132 |
} |
133 | 133 |
|
134 | 134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
135 | 135 |
|
136 |
public int getInventor(int[] numLayers)
|
|
136 |
public String getInventor()
|
|
137 | 137 |
{ |
138 |
return R.string.bandaged_3plate_inventor;
|
|
138 |
return "unknown";
|
|
139 | 139 |
} |
140 | 140 |
|
141 | 141 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
142 | 142 |
|
143 |
public int getYearOfInvention(int[] numLayers)
|
|
143 |
public int getYearOfInvention() |
|
144 | 144 |
{ |
145 | 145 |
return 2000; |
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
149 | 149 |
|
150 |
public int getComplexity(int[] numLayers)
|
|
150 |
public int getComplexity() |
|
151 | 151 |
{ |
152 | 152 |
return 8; |
153 | 153 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyBandagedEvil.java | ||
---|---|---|
250 | 250 |
|
251 | 251 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
252 | 252 |
|
253 |
public int getObjectName(int[] numLayers)
|
|
253 |
public String getObjectName()
|
|
254 | 254 |
{ |
255 |
return R.string.bandaged_evil;
|
|
255 |
return "Bandaged Cube B";
|
|
256 | 256 |
} |
257 | 257 |
|
258 | 258 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
259 | 259 |
|
260 |
public int getInventor(int[] numLayers)
|
|
260 |
public String getInventor()
|
|
261 | 261 |
{ |
262 |
return R.string.bandaged_evil_inventor;
|
|
262 |
return "unknown";
|
|
263 | 263 |
} |
264 | 264 |
|
265 | 265 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
266 | 266 |
|
267 |
public int getYearOfInvention(int[] numLayers)
|
|
267 |
public int getYearOfInvention() |
|
268 | 268 |
{ |
269 | 269 |
return 2000; |
270 | 270 |
} |
271 | 271 |
|
272 | 272 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
273 | 273 |
|
274 |
public int getComplexity(int[] numLayers)
|
|
274 |
public int getComplexity() |
|
275 | 275 |
{ |
276 | 276 |
return 8; |
277 | 277 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyBandagedFused.java | ||
---|---|---|
119 | 119 |
|
120 | 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
121 | 121 |
|
122 |
public int getObjectName(int[] numLayers)
|
|
122 |
public String getObjectName()
|
|
123 | 123 |
{ |
124 |
return R.string.bandaged_fused;
|
|
124 |
return "Fused Cube";
|
|
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
128 | 128 |
|
129 |
public int getInventor(int[] numLayers)
|
|
129 |
public String getInventor()
|
|
130 | 130 |
{ |
131 |
return R.string.bandaged_fused_inventor;
|
|
131 |
return "unknown";
|
|
132 | 132 |
} |
133 | 133 |
|
134 | 134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
135 | 135 |
|
136 |
public int getYearOfInvention(int[] numLayers)
|
|
136 |
public int getYearOfInvention() |
|
137 | 137 |
{ |
138 | 138 |
return 2000; |
139 | 139 |
} |
140 | 140 |
|
141 | 141 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
142 | 142 |
|
143 |
public int getComplexity(int[] numLayers)
|
|
143 |
public int getComplexity() |
|
144 | 144 |
{ |
145 | 145 |
return 8; |
146 | 146 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyCuboid.java | ||
---|---|---|
687 | 687 |
|
688 | 688 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
689 | 689 |
|
690 |
public int getObjectName(int[] numLayers)
|
|
690 |
public String getObjectName()
|
|
691 | 691 |
{ |
692 |
switch(numLayers[0])
|
|
692 |
switch(getNumLayers()[0])
|
|
693 | 693 |
{ |
694 |
case 2: return R.string.cube2;
|
|
695 |
case 3: return R.string.cube3;
|
|
696 |
case 4: return R.string.cube4;
|
|
697 |
case 5: return R.string.cube5;
|
|
694 |
case 2: return "Pocket Cube";
|
|
695 |
case 3: return "Rubik Cube";
|
|
696 |
case 4: return "Rubik's Revenge";
|
|
697 |
case 5: return "Professor's Cube";
|
|
698 | 698 |
} |
699 |
return R.string.cube3;
|
|
699 |
return "Rubik Cube";
|
|
700 | 700 |
} |
701 | 701 |
|
702 | 702 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
703 | 703 |
|
704 |
public int getInventor(int[] numLayers)
|
|
704 |
public String getInventor()
|
|
705 | 705 |
{ |
706 |
switch(numLayers[0])
|
|
706 |
switch(getNumLayers()[0])
|
|
707 | 707 |
{ |
708 |
case 2: return R.string.cube2_inventor;
|
|
709 |
case 3: return R.string.cube3_inventor;
|
|
710 |
case 4: return R.string.cube4_inventor;
|
|
711 |
case 5: return R.string.cube5_inventor;
|
|
708 |
case 2: return "Larry Nichols";
|
|
709 |
case 3: return "Ernő Rubik";
|
|
710 |
case 4: return "Péter Sebestény";
|
|
711 |
case 5: return "Udo Krell";
|
|
712 | 712 |
} |
713 |
return R.string.cube3_inventor;
|
|
713 |
return "Ernő Rubik";
|
|
714 | 714 |
} |
715 | 715 |
|
716 | 716 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
717 | 717 |
|
718 |
public int getYearOfInvention(int[] numLayers)
|
|
718 |
public int getYearOfInvention() |
|
719 | 719 |
{ |
720 |
switch(numLayers[0])
|
|
720 |
switch(getNumLayers()[0])
|
|
721 | 721 |
{ |
722 | 722 |
case 2: return 1970; |
723 | 723 |
case 3: return 1974; |
... | ... | |
729 | 729 |
|
730 | 730 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
731 | 731 |
|
732 |
public int getComplexity(int[] numLayers)
|
|
732 |
public int getComplexity() |
|
733 | 733 |
{ |
734 |
switch(numLayers[0])
|
|
734 |
switch(getNumLayers()[0])
|
|
735 | 735 |
{ |
736 | 736 |
case 2: return 4; |
737 | 737 |
case 3: return 6; |
src/main/java/org/distorted/objectlib/objects/TwistyDiamond.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import android.content.res.Resources; |
26 | 26 |
|
27 |
import org.distorted.library.main.DistortedEffects; |
|
28 |
import org.distorted.library.main.DistortedTexture; |
|
29 |
import org.distorted.library.mesh.MeshSquare; |
|
30 | 27 |
import org.distorted.library.type.Static3D; |
31 | 28 |
import org.distorted.library.type.Static4D; |
32 | 29 |
|
... | ... | |
591 | 588 |
|
592 | 589 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
593 | 590 |
|
594 |
public int getObjectName(int[] numLayers)
|
|
591 |
public String getObjectName()
|
|
595 | 592 |
{ |
596 |
switch(numLayers[0])
|
|
593 |
switch(getNumLayers()[0])
|
|
597 | 594 |
{ |
598 |
case 2: return R.string.diam2;
|
|
599 |
case 3: return R.string.diam3;
|
|
600 |
case 4: return R.string.diam4;
|
|
595 |
case 2: return "Skewb Diamond";
|
|
596 |
case 3: return "Face Turning Octahedron";
|
|
597 |
case 4: return "Master Face Turning Octahedron";
|
|
601 | 598 |
} |
602 | 599 |
|
603 |
return 0;
|
|
600 |
return "Skewb Diamond";
|
|
604 | 601 |
} |
605 | 602 |
|
606 | 603 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
607 | 604 |
|
608 |
public int getInventor(int[] numLayers)
|
|
605 |
public String getInventor()
|
|
609 | 606 |
{ |
610 |
switch(numLayers[0])
|
|
607 |
switch(getNumLayers()[0])
|
|
611 | 608 |
{ |
612 |
case 2: return R.string.diam2_inventor;
|
|
613 |
case 3: return R.string.diam3_inventor;
|
|
614 |
case 4: return R.string.diam4_inventor;
|
|
609 |
case 2: return "Uwe Meffert";
|
|
610 |
case 3: return "David Pitcher";
|
|
611 |
case 4: return "Timur Evbatyrov";
|
|
615 | 612 |
} |
616 | 613 |
|
617 |
return 0;
|
|
614 |
return "Uwe Meffert";
|
|
618 | 615 |
} |
619 | 616 |
|
620 | 617 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
621 | 618 |
|
622 |
public int getYearOfInvention(int[] numLayers)
|
|
619 |
public int getYearOfInvention() |
|
623 | 620 |
{ |
624 |
switch(numLayers[0])
|
|
621 |
switch(getNumLayers()[0])
|
|
625 | 622 |
{ |
626 | 623 |
case 2: return 1984; |
627 | 624 |
case 3: return 2003; |
... | ... | |
632 | 629 |
|
633 | 630 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
634 | 631 |
|
635 |
public int getComplexity(int[] numLayers)
|
|
632 |
public int getComplexity() |
|
636 | 633 |
{ |
637 |
switch(numLayers[0])
|
|
634 |
switch(getNumLayers()[0])
|
|
638 | 635 |
{ |
639 | 636 |
case 2: return 4; |
640 | 637 |
case 3: return 6; |
src/main/java/org/distorted/objectlib/objects/TwistyDino.java | ||
---|---|---|
283 | 283 |
|
284 | 284 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
285 | 285 |
|
286 |
public int getComplexity(int[] numLayers)
|
|
286 |
public int getComplexity() |
|
287 | 287 |
{ |
288 | 288 |
return 2; |
289 | 289 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyDino4.java | ||
---|---|---|
24 | 24 |
import org.distorted.library.type.Static3D; |
25 | 25 |
import org.distorted.library.type.Static4D; |
26 | 26 |
|
27 |
import org.distorted.objectlib.R; |
|
28 | 27 |
import org.distorted.objectlib.main.ObjectType; |
29 | 28 |
import org.distorted.objectlib.helpers.ScrambleState; |
30 | 29 |
|
... | ... | |
102 | 101 |
|
103 | 102 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
104 | 103 |
|
105 |
public int getObjectName(int[] numLayers)
|
|
104 |
public String getObjectName()
|
|
106 | 105 |
{ |
107 |
return R.string.din43;
|
|
106 |
return "Dino Cube (4 color)";
|
|
108 | 107 |
} |
109 | 108 |
|
110 | 109 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
111 | 110 |
|
112 |
public int getInventor(int[] numLayers)
|
|
111 |
public String getInventor()
|
|
113 | 112 |
{ |
114 |
return R.string.din43_inventor;
|
|
113 |
return "Robert Webb";
|
|
115 | 114 |
} |
116 | 115 |
|
117 | 116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
118 | 117 |
|
119 |
public int getYearOfInvention(int[] numLayers)
|
|
118 |
public int getYearOfInvention() |
|
120 | 119 |
{ |
121 | 120 |
return 1985; |
122 | 121 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyDino6.java | ||
---|---|---|
24 | 24 |
import org.distorted.library.type.Static3D; |
25 | 25 |
import org.distorted.library.type.Static4D; |
26 | 26 |
|
27 |
import org.distorted.objectlib.R; |
|
28 | 27 |
import org.distorted.objectlib.main.ObjectType; |
29 | 28 |
import org.distorted.objectlib.helpers.ScrambleState; |
30 | 29 |
|
... | ... | |
99 | 98 |
|
100 | 99 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
101 | 100 |
|
102 |
public int getObjectName(int[] numLayers)
|
|
101 |
public String getObjectName()
|
|
103 | 102 |
{ |
104 |
return R.string.dino3;
|
|
103 |
return "Dino Cube (6 color)";
|
|
105 | 104 |
} |
106 | 105 |
|
107 | 106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
108 | 107 |
|
109 |
public int getInventor(int[] numLayers)
|
|
108 |
public String getInventor()
|
|
110 | 109 |
{ |
111 |
return R.string.dino3_inventor;
|
|
110 |
return "Robert Webb";
|
|
112 | 111 |
} |
113 | 112 |
|
114 | 113 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
115 | 114 |
|
116 |
public int getYearOfInvention(int[] numLayers)
|
|
115 |
public int getYearOfInvention() |
|
117 | 116 |
{ |
118 | 117 |
return 1985; |
119 | 118 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyHelicopter.java | ||
---|---|---|
482 | 482 |
|
483 | 483 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
484 | 484 |
|
485 |
public int getObjectName(int[] numLayers)
|
|
485 |
public String getObjectName()
|
|
486 | 486 |
{ |
487 |
return R.string.heli3;
|
|
487 |
return "Helicopter Cube";
|
|
488 | 488 |
} |
489 | 489 |
|
490 | 490 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
491 | 491 |
|
492 |
public int getInventor(int[] numLayers)
|
|
492 |
public String getInventor()
|
|
493 | 493 |
{ |
494 |
return R.string.heli3_inventor;
|
|
494 |
return "Adam G. Cowan";
|
|
495 | 495 |
} |
496 | 496 |
|
497 | 497 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
498 | 498 |
|
499 |
public int getYearOfInvention(int[] numLayers)
|
|
499 |
public int getYearOfInvention() |
|
500 | 500 |
{ |
501 | 501 |
return 2006; |
502 | 502 |
} |
503 | 503 |
|
504 | 504 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
505 | 505 |
|
506 |
public int getComplexity(int[] numLayers)
|
|
506 |
public int getComplexity() |
|
507 | 507 |
{ |
508 | 508 |
return 8; |
509 | 509 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyIvy.java | ||
---|---|---|
515 | 515 |
|
516 | 516 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
517 | 517 |
|
518 |
public int getObjectName(int[] numLayers)
|
|
518 |
public String getObjectName()
|
|
519 | 519 |
{ |
520 |
return R.string.ivy2;
|
|
520 |
return "Ivy Cube";
|
|
521 | 521 |
} |
522 | 522 |
|
523 | 523 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
524 | 524 |
|
525 |
public int getInventor(int[] numLayers)
|
|
525 |
public String getInventor()
|
|
526 | 526 |
{ |
527 |
return R.string.ivy2_inventor;
|
|
527 |
return "Eitan Cher";
|
|
528 | 528 |
} |
529 | 529 |
|
530 | 530 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
531 | 531 |
|
532 |
public int getYearOfInvention(int[] numLayers)
|
|
532 |
public int getYearOfInvention() |
|
533 | 533 |
{ |
534 | 534 |
return 2009; |
535 | 535 |
} |
536 | 536 |
|
537 | 537 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
538 | 538 |
|
539 |
public int getComplexity(int[] numLayers)
|
|
539 |
public int getComplexity() |
|
540 | 540 |
{ |
541 | 541 |
return 1; |
542 | 542 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyJing.java | ||
---|---|---|
468 | 468 |
|
469 | 469 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
470 | 470 |
|
471 |
public int getObjectName(int[] numLayers)
|
|
471 |
public String getObjectName()
|
|
472 | 472 |
{ |
473 |
return R.string.jing;
|
|
473 |
return "Jing Pyraminx";
|
|
474 | 474 |
} |
475 | 475 |
|
476 | 476 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
477 | 477 |
|
478 |
public int getInventor(int[] numLayers)
|
|
478 |
public String getInventor()
|
|
479 | 479 |
{ |
480 |
return R.string.jing_inventor;
|
|
480 |
return "Tony Fisher";
|
|
481 | 481 |
} |
482 | 482 |
|
483 | 483 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
484 | 484 |
|
485 |
public int getYearOfInvention(int[] numLayers)
|
|
485 |
public int getYearOfInvention() |
|
486 | 486 |
{ |
487 | 487 |
return 1991; |
488 | 488 |
} |
489 | 489 |
|
490 | 490 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
491 | 491 |
|
492 |
public int getComplexity(int[] numLayers)
|
|
492 |
public int getComplexity() |
|
493 | 493 |
{ |
494 | 494 |
return 4; |
495 | 495 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyKilominx.java | ||
---|---|---|
739 | 739 |
|
740 | 740 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
741 | 741 |
|
742 |
public int getObjectName(int[] numLayers)
|
|
742 |
public String getObjectName()
|
|
743 | 743 |
{ |
744 |
int numL = numLayers[0];
|
|
745 |
|
|
746 |
if( numL==3 ) return R.string.minx2;
|
|
747 |
if( numL==5 ) return R.string.minx4;
|
|
748 |
|
|
749 |
return 0;
|
|
744 |
switch(getNumLayers()[0])
|
|
745 |
{ |
|
746 |
case 3: return "Kilominx";
|
|
747 |
case 5: return "Master Kilominx";
|
|
748 |
} |
|
749 |
return "Kilominx";
|
|
750 | 750 |
} |
751 | 751 |
|
752 | 752 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
753 | 753 |
|
754 |
public int getInventor(int[] numLayers)
|
|
754 |
public String getInventor()
|
|
755 | 755 |
{ |
756 |
int numL = numLayers[0];
|
|
757 |
|
|
758 |
if( numL==3 ) return R.string.minx2_inventor;
|
|
759 |
if( numL==5 ) return R.string.minx4_inventor;
|
|
760 |
|
|
761 |
return 0;
|
|
756 |
switch(getNumLayers()[0])
|
|
757 |
{ |
|
758 |
case 3: return "Thomas de Bruin";
|
|
759 |
case 5: return "David Gugl";
|
|
760 |
} |
|
761 |
return "Thomas de Bruin";
|
|
762 | 762 |
} |
763 | 763 |
|
764 | 764 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
765 | 765 |
|
766 |
public int getYearOfInvention(int[] numLayers)
|
|
766 |
public int getYearOfInvention() |
|
767 | 767 |
{ |
768 |
switch(numLayers[0])
|
|
768 |
switch(getNumLayers()[0])
|
|
769 | 769 |
{ |
770 | 770 |
case 3: return 2008; |
771 | 771 |
case 5: return 2010; |
... | ... | |
775 | 775 |
|
776 | 776 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
777 | 777 |
|
778 |
public int getComplexity(int[] numLayers)
|
|
778 |
public int getComplexity() |
|
779 | 779 |
{ |
780 |
int numL = numLayers[0];
|
|
781 |
|
|
782 |
if( numL==3 ) return 5;
|
|
783 |
if( numL==5 ) return 8;
|
|
784 |
|
|
780 |
switch(getNumLayers()[0])
|
|
781 |
{ |
|
782 |
case 3: return 5;
|
|
783 |
case 5: return 8;
|
|
784 |
} |
|
785 | 785 |
return 8; |
786 | 786 |
} |
787 | 787 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyMegaminx.java | ||
---|---|---|
627 | 627 |
case 3: return ObjectType.MEGA_3; |
628 | 628 |
case 5: return ObjectType.MEGA_5; |
629 | 629 |
} |
630 |
|
|
631 | 630 |
return ObjectType.MEGA_3; |
632 | 631 |
} |
633 | 632 |
|
634 | 633 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
635 | 634 |
|
636 |
public int getObjectName(int[] numLayers)
|
|
635 |
public String getObjectName()
|
|
637 | 636 |
{ |
638 |
int numL = numLayers[0];
|
|
639 |
|
|
640 |
if( numL==3 ) return R.string.minx3;
|
|
641 |
if( numL==5 ) return R.string.minx5;
|
|
642 |
|
|
643 |
return 0;
|
|
637 |
switch(getNumLayers()[0])
|
|
638 |
{ |
|
639 |
case 3: return "Megaminx";
|
|
640 |
case 5: return "Gigaminx";
|
|
641 |
} |
|
642 |
return "Megaminx";
|
|
644 | 643 |
} |
645 | 644 |
|
646 | 645 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
647 | 646 |
|
648 |
public int getInventor(int[] numLayers)
|
|
647 |
public String getInventor()
|
|
649 | 648 |
{ |
650 |
int numL = numLayers[0];
|
|
651 |
|
|
652 |
if( numL==3 ) return R.string.minx3_inventor;
|
|
653 |
if( numL==5 ) return R.string.minx5_inventor;
|
|
654 |
|
|
655 |
return 0;
|
|
649 |
switch(getNumLayers()[0])
|
|
650 |
{ |
|
651 |
case 3: return "Ferenc Szlivka";
|
|
652 |
case 5: return "Tyler Fox";
|
|
653 |
} |
|
654 |
return "Ferenc Szlivka";
|
|
656 | 655 |
} |
657 | 656 |
|
658 | 657 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
659 | 658 |
|
660 |
public int getYearOfInvention(int[] numLayers)
|
|
659 |
public int getYearOfInvention() |
|
661 | 660 |
{ |
662 |
switch(numLayers[0])
|
|
661 |
switch(getNumLayers()[0])
|
|
663 | 662 |
{ |
664 | 663 |
case 3: return 1982; |
665 | 664 |
case 5: return 2006; |
666 | 665 |
} |
667 |
return 1982;
|
|
666 |
return 2006;
|
|
668 | 667 |
} |
669 | 668 |
|
670 | 669 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
671 | 670 |
|
672 |
public int getComplexity(int[] numLayers)
|
|
671 |
public int getComplexity() |
|
673 | 672 |
{ |
674 |
int numL = numLayers[0];
|
|
675 |
|
|
676 |
if( numL==3 ) return 7;
|
|
677 |
if( numL==5 ) return 9;
|
|
678 |
|
|
673 |
switch(getNumLayers()[0])
|
|
674 |
{ |
|
675 |
case 3: return 7;
|
|
676 |
case 5: return 9;
|
|
677 |
} |
|
679 | 678 |
return 9; |
680 | 679 |
} |
681 | 680 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyMirror.java | ||
---|---|---|
670 | 670 |
|
671 | 671 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
672 | 672 |
|
673 |
public int getObjectName(int[] numLayers)
|
|
673 |
public String getObjectName()
|
|
674 | 674 |
{ |
675 |
switch(numLayers[0])
|
|
675 |
switch(getNumLayers()[0])
|
|
676 | 676 |
{ |
677 |
case 2: return R.string.mirr2;
|
|
678 |
case 3: return R.string.mirr3;
|
|
677 |
case 2: return "Pocket Mirror";
|
|
678 |
case 3: return "Mirror Cube";
|
|
679 | 679 |
} |
680 |
return R.string.mirr3;
|
|
680 |
return "Pocket Mirror";
|
|
681 | 681 |
} |
682 | 682 |
|
683 | 683 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
684 | 684 |
|
685 |
public int getInventor(int[] numLayers)
|
|
685 |
public String getInventor()
|
|
686 | 686 |
{ |
687 |
switch(numLayers[0])
|
|
687 |
switch(getNumLayers()[0])
|
|
688 | 688 |
{ |
689 |
case 2: return R.string.mirr2_inventor;
|
|
690 |
case 3: return R.string.mirr3_inventor;
|
|
689 |
case 2: return "Thomas de Bruin";
|
|
690 |
case 3: return "Hidetoshi Takeji";
|
|
691 | 691 |
} |
692 |
return R.string.mirr3_inventor;
|
|
692 |
return "Hidetoshi Takeji";
|
|
693 | 693 |
} |
694 | 694 |
|
695 | 695 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
696 | 696 |
|
697 |
public int getYearOfInvention(int[] numLayers)
|
|
697 |
public int getYearOfInvention() |
|
698 | 698 |
{ |
699 |
switch(numLayers[0])
|
|
699 |
switch(getNumLayers()[0])
|
|
700 | 700 |
{ |
701 | 701 |
case 2: return 2007; |
702 | 702 |
case 3: return 2006; |
... | ... | |
706 | 706 |
|
707 | 707 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
708 | 708 |
|
709 |
public int getComplexity(int[] numLayers)
|
|
709 |
public int getComplexity() |
|
710 | 710 |
{ |
711 |
switch(numLayers[0])
|
|
711 |
switch(getNumLayers()[0])
|
|
712 | 712 |
{ |
713 | 713 |
case 2: return 5; |
714 | 714 |
case 3: return 7; |
src/main/java/org/distorted/objectlib/objects/TwistyPyraminx.java | ||
---|---|---|
466 | 466 |
|
467 | 467 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
468 | 468 |
|
469 |
public int getObjectName(int[] numLayers)
|
|
469 |
public String getObjectName()
|
|
470 | 470 |
{ |
471 |
switch(numLayers[0])
|
|
471 |
switch(getNumLayers()[0])
|
|
472 | 472 |
{ |
473 |
case 3: return R.string.pyra3;
|
|
474 |
case 4: return R.string.pyra4;
|
|
475 |
case 5: return R.string.pyra5;
|
|
473 |
case 3: return "Pyraminx";
|
|
474 |
case 4: return "Master Pyraminx";
|
|
475 |
case 5: return "Professor's Pyraminx";
|
|
476 | 476 |
} |
477 |
return R.string.pyra3;
|
|
477 |
return "Pyraminx";
|
|
478 | 478 |
} |
479 | 479 |
|
480 | 480 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
481 | 481 |
|
482 |
public int getInventor(int[] numLayers)
|
|
482 |
public String getInventor()
|
|
483 | 483 |
{ |
484 |
switch(numLayers[0])
|
|
484 |
switch(getNumLayers()[0])
|
|
485 | 485 |
{ |
486 |
case 3: return R.string.pyra3_inventor;
|
|
487 |
case 4: return R.string.pyra4_inventor;
|
|
488 |
case 5: return R.string.pyra5_inventor;
|
|
486 |
case 3: return "Uwe Meffert";
|
|
487 |
case 4: return "Katsuhiko Okamoto";
|
|
488 |
case 5: return "Timur Evbatyrov";
|
|
489 | 489 |
} |
490 |
return R.string.pyra3_inventor;
|
|
490 |
return "Uwe Meffert";
|
|
491 | 491 |
} |
492 | 492 |
|
493 | 493 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
494 | 494 |
|
495 |
public int getYearOfInvention(int[] numLayers)
|
|
495 |
public int getYearOfInvention() |
|
496 | 496 |
{ |
497 |
switch(numLayers[0])
|
|
497 |
switch(getNumLayers()[0])
|
|
498 | 498 |
{ |
499 | 499 |
case 3: return 1970; |
500 | 500 |
case 4: return 2002; |
... | ... | |
505 | 505 |
|
506 | 506 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
507 | 507 |
|
508 |
public int getComplexity(int[] numLayers)
|
|
508 |
public int getComplexity() |
|
509 | 509 |
{ |
510 |
switch(numLayers[0])
|
|
510 |
switch(getNumLayers()[0])
|
|
511 | 511 |
{ |
512 | 512 |
case 3: return 4; |
513 | 513 |
case 4: return 6; |
src/main/java/org/distorted/objectlib/objects/TwistyRedi.java | ||
---|---|---|
477 | 477 |
|
478 | 478 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
479 | 479 |
|
480 |
public int getObjectName(int[] numLayers)
|
|
480 |
public String getObjectName()
|
|
481 | 481 |
{ |
482 |
return R.string.redi2;
|
|
482 |
return "Redi Cube";
|
|
483 | 483 |
} |
484 | 484 |
|
485 | 485 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
486 | 486 |
|
487 |
public int getInventor(int[] numLayers)
|
|
487 |
public String getInventor()
|
|
488 | 488 |
{ |
489 |
return R.string.redi2_inventor;
|
|
489 |
return "Oskar van Deventer";
|
|
490 | 490 |
} |
491 | 491 |
|
492 | 492 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
493 | 493 |
|
494 |
public int getYearOfInvention(int[] numLayers)
|
|
494 |
public int getYearOfInvention() |
|
495 | 495 |
{ |
496 | 496 |
return 2009; |
497 | 497 |
} |
498 | 498 |
|
499 | 499 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
500 | 500 |
|
501 |
public int getComplexity(int[] numLayers)
|
|
501 |
public int getComplexity() |
|
502 | 502 |
{ |
503 | 503 |
return 4; |
504 | 504 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyRex.java | ||
---|---|---|
514 | 514 |
|
515 | 515 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
516 | 516 |
|
517 |
public int getObjectName(int[] numLayers)
|
|
517 |
public String getObjectName()
|
|
518 | 518 |
{ |
519 |
return R.string.rex3;
|
|
519 |
return "Rex Cube";
|
|
520 | 520 |
} |
521 | 521 |
|
522 | 522 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
523 | 523 |
|
524 |
public int getInventor(int[] numLayers)
|
|
524 |
public String getInventor()
|
|
525 | 525 |
{ |
526 |
return R.string.rex3_inventor;
|
|
526 |
return "Andrew Cormier";
|
|
527 | 527 |
} |
528 | 528 |
|
529 | 529 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
530 | 530 |
|
531 |
public int getYearOfInvention(int[] numLayers)
|
|
531 |
public int getYearOfInvention() |
|
532 | 532 |
{ |
533 | 533 |
return 2009; |
534 | 534 |
} |
535 | 535 |
|
536 | 536 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
537 | 537 |
|
538 |
public int getComplexity(int[] numLayers)
|
|
538 |
public int getComplexity() |
|
539 | 539 |
{ |
540 | 540 |
return 3; |
541 | 541 |
} |
src/main/java/org/distorted/objectlib/objects/TwistySkewb.java | ||
---|---|---|
638 | 638 |
|
639 | 639 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
640 | 640 |
|
641 |
public int getObjectName(int[] numLayers)
|
|
641 |
public String getObjectName()
|
|
642 | 642 |
{ |
643 |
switch(numLayers[0])
|
|
643 |
switch(getNumLayers()[0])
|
|
644 | 644 |
{ |
645 |
case 2: return R.string.skew2;
|
|
646 |
case 3: return R.string.skew3;
|
|
645 |
case 2: return "Skewb";
|
|
646 |
case 3: return "Master Skewb";
|
|
647 | 647 |
} |
648 |
return R.string.skew2;
|
|
648 |
return "Skewb";
|
|
649 | 649 |
} |
650 | 650 |
|
651 | 651 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
652 | 652 |
|
653 |
public int getInventor(int[] numLayers)
|
|
653 |
public String getInventor()
|
|
654 | 654 |
{ |
655 |
switch(numLayers[0])
|
|
655 |
switch(getNumLayers()[0])
|
|
656 | 656 |
{ |
657 |
case 2: return R.string.skew2_inventor;
|
|
658 |
case 3: return R.string.skew3_inventor;
|
|
657 |
case 2: return "Tony Durham";
|
|
658 |
case 3: return "Katsuhiko Okamoto";
|
|
659 | 659 |
} |
660 |
return R.string.skew2_inventor;
|
|
660 |
return "Tony Durham";
|
|
661 | 661 |
} |
662 | 662 |
|
663 | 663 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
664 | 664 |
|
665 |
public int getYearOfInvention(int[] numLayers)
|
|
665 |
public int getYearOfInvention() |
|
666 | 666 |
{ |
667 |
switch(numLayers[0])
|
|
667 |
switch(getNumLayers()[0])
|
|
668 | 668 |
{ |
669 | 669 |
case 2: return 1982; |
670 | 670 |
case 3: return 2003; |
... | ... | |
674 | 674 |
|
675 | 675 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
676 | 676 |
|
677 |
public int getComplexity(int[] numLayers)
|
|
677 |
public int getComplexity() |
|
678 | 678 |
{ |
679 |
switch(numLayers[0])
|
|
679 |
switch(getNumLayers()[0])
|
|
680 | 680 |
{ |
681 | 681 |
case 2: return 4; |
682 | 682 |
case 3: return 8; |
src/main/java/org/distorted/objectlib/objects/TwistySquare1.java | ||
---|---|---|
370 | 370 |
|
371 | 371 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Do not pull the inventors and the names of objects from Resources.