Project

General

Profile

Download (27.2 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / json / JsonReader.java @ 253e440f

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 java.io.BufferedReader;
23
import java.io.IOException;
24
import java.io.InputStream;
25
import java.io.InputStreamReader;
26
import java.nio.charset.StandardCharsets;
27

    
28
import org.distorted.objectlib.helpers.ObjectFaceShape;
29
import org.json.JSONArray;
30
import org.json.JSONException;
31
import org.json.JSONObject;
32

    
33
import org.distorted.library.type.Static3D;
34
import org.distorted.library.type.Static4D;
35

    
36
import org.distorted.objectlib.helpers.ObjectShape;
37
import org.distorted.objectlib.helpers.ObjectSticker;
38
import org.distorted.objectlib.helpers.ScrambleState;
39
import org.distorted.objectlib.main.ObjectType;
40

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

    
43
public class JsonReader
44
{
45
  private ScrambleState[] mStates;
46
  private int[][] mSolvedQuats;
47
  private Static4D[] mQuats;
48
  private int mSolvedFuncIndex;
49
  private int mNumStickerTypes;
50
  private float[][] mCuts;
51
  private boolean[][] mLayerRotatable;
52
  private int mMovementType, mMovementSplit;
53
  private int[][][] mEnabled;
54
  private float[] mDist3D;
55
  private int mNumCubitFaces, mNumFaces, mNumFaceColors;
56
  private float[][] mPositions;
57
  private ObjectShape[] mShapes;
58
  private ObjectFaceShape[] mFaceShapes;
59
  private Static4D[] mCubitQuats;
60
  private int mNumCubitVariants;
61
  private int[] mCubitVariant;
62
  private int[][] mVariantFaceColor, mCubitFaceColor;
63
  private ObjectSticker[] mObjectSticker;
64
  private Static3D[] mAxis;
65
  private int[] mBasicAngle;
66
  private String mLongName, mShortName, mInventor;
67
  private int mYearOfInvention, mComplexity;
68
  private int[] mNumLayers;
69
  private float mSize;
70
  private int mScrambleType, mNumScrambles;
71
  private int[] mColor;
72
  private int mInternalColor;
73
  private ObjectType mType;
74
  private boolean mResetMaps;
75

    
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77

    
78
  private void parseMetadata(JSONObject object) throws JSONException
79
    {
80
    mLongName        = object.getString("longname");
81
    mShortName       = object.getString("shortname");
82
    mInventor        = object.getString("inventor");
83
    mYearOfInvention = object.getInt("year");
84
    mComplexity      = object.getInt("complexity");
85
    mSize            = (float)object.getDouble("size");
86
    mNumScrambles    = object.getInt("scrambles");
87
    mResetMaps       = object.getBoolean("resetmaps");
88
    mNumFaces        = object.getInt("num_faces");
89

    
90
    int ordinal = ObjectType.getOrdinal(mShortName);
91
    mType = ordinal>=0 ? ObjectType.getObject(ordinal) : null;
92
    }
93

    
94
///////////////////////////////////////////////////////////////////////////////////////////////////
95

    
96
  private void parseCubits(JSONArray object) throws JSONException
97
    {
98
    int numCubits = object.length();
99

    
100
    mCubitQuats     = new Static4D[numCubits];
101
    mCubitVariant   = new int[numCubits];
102
    mPositions      = new float[numCubits][];
103
    mCubitFaceColor = new int[numCubits][];
104

    
105
    for(int i=0; i<numCubits; i++)
106
      {
107
      JSONObject jsonCubit = object.getJSONObject(i);
108

    
109
      float qx = (float)jsonCubit.getDouble("qx");
110
      float qy = (float)jsonCubit.getDouble("qy");
111
      float qz = (float)jsonCubit.getDouble("qz");
112
      float qw = (float)jsonCubit.getDouble("qw");
113

    
114
      mCubitQuats[i] = new Static4D(qx,qy,qz,qw);
115
      mCubitVariant[i] = jsonCubit.getInt("variant");
116

    
117
      JSONArray jsonCenter = jsonCubit.getJSONArray("centers");
118
      int numCenter = jsonCenter.length();
119
      mPositions[i] = new float[numCenter];
120
      for(int j=0; j<numCenter; j++) mPositions[i][j] = (float)jsonCenter.getDouble(j);
121

    
122
      JSONArray jsonColor  = jsonCubit.getJSONArray("colors");
123
      int numColor = jsonColor.length();
124
      mCubitFaceColor[i] = new int[numColor];
125
      for(int j=0; j<numColor; j++) mCubitFaceColor[i][j] = jsonColor.getInt(j);
126
      }
127
    }
128

    
129
///////////////////////////////////////////////////////////////////////////////////////////////////
130

    
131
  private void parseShapes(JSONArray object) throws JSONException
132
    {
133
    mNumCubitVariants = object.length();
134
    mVariantFaceColor = new int[mNumCubitVariants][];
135
    mShapes     = new ObjectShape[mNumCubitVariants];
136
    mFaceShapes = new ObjectFaceShape[mNumCubitVariants];
137
    float[][][] verts     = new float[mNumCubitVariants][][];
138
    float[][][] bands     = new float[mNumCubitVariants][][];
139
    float[][][] corners   = new float[mNumCubitVariants][][];
140
    float[][][] centers   = new float[mNumCubitVariants][][];
141
    float[][] convexity   = new float[mNumCubitVariants][];
142
    int[][] cornerIndices = new int[mNumCubitVariants][];
143
    int[][] centerIndices = new int[mNumCubitVariants][];
144
    int[][] bandIndices   = new int[mNumCubitVariants][];
145
    int[][][] vertIndices = new int[mNumCubitVariants][][];
146

    
147
    mNumCubitFaces = -1;
148

    
149
    for(int i=0; i<mNumCubitVariants; i++)
150
      {
151
      JSONObject jsonShape = object.getJSONObject(i);
152

    
153
      ////// vertices /////////////////////////////////////////////////
154
      JSONArray jsonVertices= jsonShape.getJSONArray("vertices");
155
      int numVertices = jsonVertices.length();
156
      verts[i] = new float[numVertices][3];
157
      cornerIndices[i] = new int[numVertices];
158
      centerIndices[i] = new int[numVertices];
159

    
160
      for(int j=0; j<numVertices; j++)
161
        {
162
        JSONObject vert = jsonVertices.getJSONObject(j);
163
        verts[i][j][0] = (float)vert.getDouble("x");
164
        verts[i][j][1] = (float)vert.getDouble("y");
165
        verts[i][j][2] = (float)vert.getDouble("z");
166
        cornerIndices[i][j] = vert.getInt("cornerIndex");
167
        centerIndices[i][j] = vert.getInt("centerIndex");
168
        }
169

    
170
      ////// faces ////////////////////////////////////////////////////
171
      JSONArray jsonFaces= jsonShape.getJSONArray("faces");
172
      int numFaces = jsonFaces.length();
173
      mVariantFaceColor[i] = new int[numFaces];
174
      bandIndices[i] = new int[numFaces];
175
      vertIndices[i] = new int[numFaces][];
176

    
177
      if( mNumCubitFaces<numFaces ) mNumCubitFaces=numFaces;
178

    
179
      for(int j=0; j<numFaces; j++)
180
        {
181
        JSONObject jsonFace = jsonFaces.getJSONObject(j);
182
        mVariantFaceColor[i][j] = jsonFace.getInt("sticker");
183
        bandIndices[i][j] = jsonFace.getInt("bandIndex");
184
        JSONArray vertices = jsonFace.getJSONArray("vertexIndices");
185
        int numV = vertices.length();
186
        vertIndices[i][j] = new int[numV];
187
        for(int k=0; k<numV; k++) vertIndices[i][j][k] = vertices.getInt(k);
188
        }
189

    
190
      ////// bands ////////////////////////////////////////////////////
191
      JSONArray jsonBands= jsonShape.getJSONArray("bands");
192
      int numBands = jsonBands.length();
193
      bands[i] = new float[numBands][7];
194

    
195
      for(int j=0; j<numBands; j++)
196
        {
197
        JSONObject jsonBand = jsonBands.getJSONObject(j);
198

    
199
        bands[i][j][0] = (float)jsonBand.getDouble("height");
200
        bands[i][j][1] = (float)jsonBand.getDouble("angle");
201
        bands[i][j][2] = (float)jsonBand.getDouble("distanceToCenter");
202
        bands[i][j][3] = (float)jsonBand.getDouble("distanceToFlat");
203
        bands[i][j][4] = (float)jsonBand.getDouble("numOfBands");
204
        bands[i][j][5] = (float)jsonBand.getDouble("extraI");
205
        bands[i][j][6] = (float)jsonBand.getDouble("extraJ");
206
        }
207

    
208
      ////// cornerPush ///////////////////////////////////////////////
209
      JSONArray jsonCornerPush= jsonShape.optJSONArray("cornerPush");
210

    
211
      if( jsonCornerPush!=null )
212
        {
213
        int numCornerP = jsonCornerPush.length();
214
        corners[i] = new float[numCornerP][2];
215

    
216
        for(int j=0; j<numCornerP; j++)
217
          {
218
          JSONObject jsonC = jsonCornerPush.getJSONObject(j);
219
          corners[i][j][0] = (float)jsonC.getDouble("strength");
220
          corners[i][j][1] = (float)jsonC.getDouble("radius");
221
          }
222
        }
223

    
224
      ////// centerPush ///////////////////////////////////////////////
225
      JSONArray jsonCenterPush= jsonShape.optJSONArray("centerPush");
226

    
227
      if( jsonCenterPush!=null )
228
        {
229
        int numCenterP = jsonCenterPush.length();
230
        centers[i] = new float[numCenterP][3];
231

    
232
        for(int j=0; j<numCenterP; j++)
233
          {
234
          JSONObject jsonC = jsonCenterPush.getJSONObject(j);
235
          centers[i][j][0] = (float)jsonC.getDouble("x");
236
          centers[i][j][1] = (float)jsonC.getDouble("y");
237
          centers[i][j][2] = (float)jsonC.getDouble("z");
238
          }
239
        }
240

    
241
      ////// convexity ///////////////////////////////////////////////
242
      JSONObject jsonConvexity = jsonShape.optJSONObject("convexity");
243

    
244
      if( jsonConvexity!=null )
245
        {
246
        convexity[i] = new float[3];
247
        convexity[i][0] = (float)jsonConvexity.getDouble("x");
248
        convexity[i][1] = (float)jsonConvexity.getDouble("y");
249
        convexity[i][2] = (float)jsonConvexity.getDouble("z");
250
        }
251
      }
252

    
253
    for(int i=0; i<mNumCubitVariants; i++)
254
      {
255
      mShapes[i] = new ObjectShape(verts[i],vertIndices[i]);
256
      mFaceShapes[i] = new ObjectFaceShape(bands[i],bandIndices[i],corners[i],cornerIndices[i],centers[i],centerIndices[i],convexity[i] );
257
      }
258
    }
259

    
260
///////////////////////////////////////////////////////////////////////////////////////////////////
261

    
262
  private void parseStickers(JSONArray object) throws JSONException
263
    {
264
    mNumStickerTypes = object.length();
265
    mObjectSticker = new ObjectSticker[mNumStickerTypes];
266

    
267
    for(int i=0; i<mNumStickerTypes; i++)
268
      {
269
      JSONObject sticker = object.getJSONObject(i);
270
      float stroke = (float)sticker.getDouble("stroke");
271
      JSONArray vertices = sticker.getJSONArray("vertices");
272
      int numVertices = vertices.length();
273

    
274
      float[] coords     = new float[2*numVertices];
275
      float[] curvatures = new float[numVertices];
276
      float[] radii      = new float[numVertices];
277

    
278
      for(int j=0; j<numVertices; j++)
279
        {
280
        JSONObject vertex = vertices.getJSONObject(j);
281

    
282
        coords[2*j  ] = (float)vertex.getDouble("x");
283
        coords[2*j+1] = (float)vertex.getDouble("y");
284
        curvatures[j] = (float)vertex.getDouble("angle");
285
        radii[j]      = (float)vertex.getDouble("radius");
286
        }
287

    
288
      mObjectSticker[i] = new ObjectSticker(coords,curvatures,radii,stroke);
289
      }
290
    }
291

    
292
///////////////////////////////////////////////////////////////////////////////////////////////////
293

    
294
  private void parseMesh(JSONObject object) throws JSONException
295
    {
296
    JSONArray cubits   = object.getJSONArray("cubits");
297
    parseCubits(cubits);
298
    JSONArray shapes   = object.getJSONArray("shapes");
299
    parseShapes(shapes);
300
    JSONArray stickers = object.getJSONArray("stickers");
301
    parseStickers(stickers);
302
    }
303

    
304
///////////////////////////////////////////////////////////////////////////////////////////////////
305

    
306
  private void parseAxis(JSONArray object) throws JSONException
307
    {
308
    int numAxis = object.length();
309

    
310
    mBasicAngle     = new int[numAxis];
311
    mAxis           = new Static3D[numAxis];
312
    mCuts           = new float[numAxis][];
313
    mLayerRotatable = new boolean[numAxis][];
314
    mNumLayers      = new int[numAxis];
315

    
316
    for(int i=0; i<numAxis; i++)
317
      {
318
      JSONObject jsonAx = object.getJSONObject(i);
319

    
320
      mBasicAngle[i] = jsonAx.getInt("basicAngle");
321

    
322
      float x = (float)jsonAx.getDouble("x");
323
      float y = (float)jsonAx.getDouble("y");
324
      float z = (float)jsonAx.getDouble("z");
325

    
326
      mAxis[i] = new Static3D(x,y,z);
327

    
328
      JSONArray jsonCuts = jsonAx.getJSONArray("cuts");
329
      int numCuts = jsonCuts.length();
330
      mCuts[i] = new float[numCuts];
331
      for(int j=0; j<numCuts; j++) mCuts[i][j] = (float)jsonCuts.getDouble(j);
332

    
333
      JSONArray jsonRota = jsonAx.getJSONArray("rotatable");
334
      int numRota = jsonRota.length();
335
      mLayerRotatable[i] = new boolean[numRota];
336
      for(int j=0; j<numRota; j++) mLayerRotatable[i][j] = jsonRota.getBoolean(j);
337

    
338
      mNumLayers[i] = numRota;
339
      }
340
    }
341

    
342
///////////////////////////////////////////////////////////////////////////////////////////////////
343

    
344
  private void parseQuats(JSONArray object) throws JSONException
345
    {
346
    int numQuats = object.length();
347
    mQuats = new Static4D[numQuats];
348

    
349
    for(int i=0; i<numQuats; i++)
350
      {
351
      JSONObject jsonQuat = object.getJSONObject(i);
352

    
353
      float x = (float)jsonQuat.getDouble("x");
354
      float y = (float)jsonQuat.getDouble("y");
355
      float z = (float)jsonQuat.getDouble("z");
356
      float w = (float)jsonQuat.getDouble("w");
357

    
358
      mQuats[i] = new Static4D(x,y,z,w);
359
      }
360
    }
361

    
362
///////////////////////////////////////////////////////////////////////////////////////////////////
363

    
364
  private void parseScrambling(JSONObject object) throws JSONException
365
    {
366
    mScrambleType = object.getInt("scrambleType");
367

    
368
    if( mScrambleType==0 )
369
      {
370
      JSONArray jsonStates = object.getJSONArray("scrambleStates");
371
      int numStates = jsonStates.length();
372
      mStates = new ScrambleState[numStates];
373

    
374
      for(int i=0; i<numStates; i++)
375
        {
376
        JSONArray jsonState = jsonStates.getJSONArray(i);
377
        int numAxis = jsonState.length();
378
        int[][] scramblingData = new int[numAxis][];
379

    
380
        for(int j=0; j<numAxis; j++)
381
          {
382
          JSONArray jsonData = jsonState.getJSONArray(j);
383
          int numData = jsonData.length();
384
          scramblingData[j] = new int[numData];
385
          for(int k=0; k<numData; k++) scramblingData[j][k] = jsonData.getInt(k);
386
          }
387

    
388
        mStates[i] = new ScrambleState(scramblingData);
389
        }
390
      }
391
    }
392

    
393
///////////////////////////////////////////////////////////////////////////////////////////////////
394

    
395
  private void parseTouchcontrol(JSONObject object) throws JSONException
396
    {
397
    mMovementType = object.getInt("movementType");
398
    mMovementSplit= object.getInt("movementSplit");
399

    
400
    try
401
      {
402
      JSONArray jsonEnabled = object.getJSONArray("enabledAxis");
403
      int numFace = jsonEnabled.length();
404

    
405
      mEnabled = new int[numFace][][];
406

    
407
      for(int i=0; i<numFace; i++)
408
        {
409
        JSONArray jsonSection = jsonEnabled.getJSONArray(i);
410
        int numSection = jsonSection.length();
411
        mEnabled[i] = new int[numSection][];
412

    
413
        for(int j=0; j<numSection; j++)
414
          {
415
          JSONArray jsonAx = jsonSection.getJSONArray(j);
416
          int numAxis = jsonAx.length();
417
          mEnabled[i][j] = new int[numAxis];
418
          for(int k=0; k<numAxis; k++) mEnabled[i][j][k] = jsonAx.getInt(k);
419
          }
420
        }
421
      }
422
    catch( JSONException ex )
423
      {
424
      // ignore, the object does not have to have 'enabledAxis' defined at all.
425
      }
426

    
427
    try
428
      {
429
      JSONArray jsonDist = object.getJSONArray("dist3D");
430
      int num = jsonDist.length();
431
      mDist3D = new float[num];
432
      for(int j=0; j<num; j++) mDist3D[j] = (float)jsonDist.getDouble(j);
433
      }
434
    catch( JSONException ex )
435
      {
436
      // ignore, the object does not have a 'dist3D' which is possible.
437
      }
438
    }
439

    
440
///////////////////////////////////////////////////////////////////////////////////////////////////
441

    
442
  private void parseColors(JSONArray object) throws JSONException
443
    {
444
    mNumFaceColors = object.length()-1;
445

    
446
    mColor = new int[mNumFaceColors];
447
    for(int i=0; i<mNumFaceColors; i++) mColor[i] = object.getInt(i);
448

    
449
    mInternalColor = object.getInt(mNumFaceColors);
450
    }
451

    
452
///////////////////////////////////////////////////////////////////////////////////////////////////
453

    
454
  private void parseSolved(JSONObject solved) throws JSONException
455
    {
456
    mSolvedFuncIndex = solved.getInt("functionIndex");
457

    
458
    try
459
      {
460
      JSONArray groupArray= solved.getJSONArray("groups");
461
      int numGroups = groupArray.length();
462
      mSolvedQuats  = new int[numGroups][];
463

    
464
      for(int i=0; i<numGroups; i++)
465
        {
466
        JSONArray groupElements = groupArray.getJSONArray(i);
467
        int groupSize = groupElements.length();
468
        mSolvedQuats[i] = new int[groupSize];
469
        for(int j=0; j<groupSize; j++) mSolvedQuats[i][j] = groupElements.getInt(j);
470
        }
471
      }
472
    catch( JSONException ex )
473
      {
474
      // ignore, the object does not have to have an array of solved groups.
475
      }
476
    }
477

    
478
///////////////////////////////////////////////////////////////////////////////////////////////////
479

    
480
  private void parseVersion1(JSONObject object) throws JSONException
481
    {
482
    JSONObject metadata    = object.getJSONObject("metadata");
483
    parseMetadata(metadata);
484
    JSONObject mesh        = object.getJSONObject("mesh");
485
    parseMesh(mesh);
486
    JSONArray axis         = object.getJSONArray("axis");
487
    parseAxis(axis);
488
    JSONArray quats        = object.getJSONArray("quats");
489
    parseQuats(quats);
490
    JSONObject scrambling  = object.getJSONObject("scrambling");
491
    parseScrambling(scrambling);
492
    JSONObject touchcontrol= object.getJSONObject("touchcontrol");
493
    parseTouchcontrol(touchcontrol);
494
    JSONArray colors       = object.getJSONArray("colors");
495
    parseColors(colors);
496
    JSONObject solved      = object.getJSONObject("solved");
497
    parseSolved(solved);
498
    }
499

    
500
///////////////////////////////////////////////////////////////////////////////////////////////////
501

    
502
  private void parseVersion1Metadata(JSONObject object) throws JSONException
503
    {
504
    JSONObject metadata = object.getJSONObject("metadata");
505
    parseMetadata(metadata);
506
    }
507

    
508
///////////////////////////////////////////////////////////////////////////////////////////////////
509

    
510
  public void parseJsonFile(InputStream jsonStream)
511
    {
512
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
513

    
514
    try
515
      {
516
      StringBuilder contents = new StringBuilder();
517
      String tmp;
518
      while( (tmp = br.readLine()) != null) contents.append(tmp);
519
      br.close();
520
      jsonStream.close();
521

    
522
      JSONObject object = new JSONObject(contents.toString());
523
      int major = object.getInt("major");
524

    
525
      if( major==1 )
526
        {
527
        parseVersion1(object);
528
        }
529
      else
530
        {
531
        android.util.Log.e("readJsonFile", "Unknown version "+major);
532
        }
533
      }
534
    catch(IOException e)
535
      {
536
      android.util.Log.e("readJsonFile", "Error reading JSON file: "+e.toString());
537
      }
538
    catch( JSONException e )
539
      {
540
      android.util.Log.e("parseJsonFile", "Error parsing JSON file: "+e.toString());
541
      }
542
    }
543

    
544
///////////////////////////////////////////////////////////////////////////////////////////////////
545

    
546
  public void parseJsonFileMetadata(InputStream jsonStream)
547
    {
548
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
549

    
550
    try
551
      {
552
      StringBuilder contents = new StringBuilder();
553
      String tmp;
554
      while( (tmp = br.readLine()) != null) contents.append(tmp);
555
      br.close();
556
      jsonStream.close();
557

    
558
      JSONObject object = new JSONObject(contents.toString());
559
      int major = object.getInt("major");
560

    
561
      if( major==1 )
562
        {
563
        parseVersion1Metadata(object);
564
        }
565
      else
566
        {
567
        android.util.Log.e("readJsonFileQuick", "Unknown version "+major);
568
        }
569
      }
570
    catch(IOException e)
571
      {
572
      android.util.Log.e("readJsonFileQuick", "Error reading JSON file: "+e.toString());
573
      }
574
    catch( JSONException e )
575
      {
576
      android.util.Log.e("parseJsonFileQuick", "Error parsing JSON file: "+e.toString());
577
      }
578
    }
579

    
580
///////////////////////////////////////////////////////////////////////////////////////////////////
581

    
582
  public ScrambleState[] getScrambleStates()
583
    {
584
    return mStates;
585
    }
586

    
587
///////////////////////////////////////////////////////////////////////////////////////////////////
588

    
589
  public int[][] getSolvedQuats()
590
    {
591
    return mSolvedQuats;
592
    }
593

    
594
///////////////////////////////////////////////////////////////////////////////////////////////////
595

    
596
  public Static4D[] getQuats()
597
    {
598
    return mQuats;
599
    }
600

    
601
///////////////////////////////////////////////////////////////////////////////////////////////////
602

    
603
  public int getSolvedFunctionIndex()
604
    {
605
    return mSolvedFuncIndex;
606
    }
607

    
608
///////////////////////////////////////////////////////////////////////////////////////////////////
609

    
610
  public int getNumStickerTypes()
611
    {
612
    return mNumStickerTypes;
613
    }
614

    
615
///////////////////////////////////////////////////////////////////////////////////////////////////
616

    
617
  public float[][] getCuts()
618
    {
619
    return mCuts;
620
    }
621

    
622
///////////////////////////////////////////////////////////////////////////////////////////////////
623

    
624
  public boolean[][] getLayerRotatable()
625
    {
626
    return mLayerRotatable;
627
    }
628

    
629
///////////////////////////////////////////////////////////////////////////////////////////////////
630

    
631
  public int getMovementType()
632
    {
633
    return mMovementType;
634
    }
635

    
636
///////////////////////////////////////////////////////////////////////////////////////////////////
637

    
638
  public int getMovementSplit()
639
    {
640
    return mMovementSplit;
641
    }
642

    
643
///////////////////////////////////////////////////////////////////////////////////////////////////
644

    
645
  public int[][][] getEnabled()
646
    {
647
    return mEnabled;
648
    }
649

    
650
///////////////////////////////////////////////////////////////////////////////////////////////////
651

    
652
  public float[] getDist3D()
653
    {
654
    return mDist3D;
655
    }
656

    
657
///////////////////////////////////////////////////////////////////////////////////////////////////
658

    
659
  public int getNumCubitFaces()
660
    {
661
    return mNumCubitFaces;
662
    }
663

    
664
///////////////////////////////////////////////////////////////////////////////////////////////////
665

    
666
  public float[][] getCubitPositions()
667
    {
668
    return mPositions;
669
    }
670

    
671
///////////////////////////////////////////////////////////////////////////////////////////////////
672

    
673
  public ObjectShape getObjectShape(int variant)
674
    {
675
    return mShapes[variant];
676
    }
677

    
678
///////////////////////////////////////////////////////////////////////////////////////////////////
679

    
680
  public ObjectFaceShape getObjectFaceShape(int variant)
681
    {
682
    return mFaceShapes[variant];
683
    }
684

    
685
///////////////////////////////////////////////////////////////////////////////////////////////////
686

    
687
  public Static4D getCubitQuats(int cubit)
688
    {
689
    return mCubitQuats[cubit];
690
    }
691

    
692
///////////////////////////////////////////////////////////////////////////////////////////////////
693

    
694
  public int getNumCubitVariants()
695
    {
696
    return mNumCubitVariants;
697
    }
698

    
699
///////////////////////////////////////////////////////////////////////////////////////////////////
700

    
701
  public int getCubitVariant(int cubit)
702
    {
703
    return mCubitVariant[cubit];
704
    }
705

    
706
///////////////////////////////////////////////////////////////////////////////////////////////////
707

    
708
  public int getVariantFaceColor(int variant, int face)
709
    {
710
    int[] colors = mVariantFaceColor[variant];
711
    return colors.length>face ? colors[face] : -1;
712
    }
713

    
714
///////////////////////////////////////////////////////////////////////////////////////////////////
715

    
716
  public int getCubitFaceFace(int cubit, int face)
717
    {
718
    return mCubitFaceColor[cubit][face];
719
    }
720

    
721
///////////////////////////////////////////////////////////////////////////////////////////////////
722

    
723
  public int getNumScrambles()
724
    {
725
    return mNumScrambles;
726
    }
727

    
728
///////////////////////////////////////////////////////////////////////////////////////////////////
729

    
730
  public ObjectSticker retSticker(int sticker)
731
    {
732
    return mObjectSticker[sticker];
733
    }
734

    
735
///////////////////////////////////////////////////////////////////////////////////////////////////
736

    
737
  public Static3D[] getRotationAxis()
738
    {
739
    return mAxis;
740
    }
741

    
742
///////////////////////////////////////////////////////////////////////////////////////////////////
743

    
744
  public int[] getBasicAngle()
745
    {
746
    return mBasicAngle;
747
    }
748

    
749
///////////////////////////////////////////////////////////////////////////////////////////////////
750

    
751
  public ObjectType intGetObjectType()
752
    {
753
    return mType;
754
    }
755

    
756
///////////////////////////////////////////////////////////////////////////////////////////////////
757

    
758
  public String getObjectName()
759
    {
760
    return mLongName;
761
    }
762

    
763
///////////////////////////////////////////////////////////////////////////////////////////////////
764

    
765
  public String getShortName()
766
    {
767
    return mShortName;
768
    }
769

    
770
///////////////////////////////////////////////////////////////////////////////////////////////////
771

    
772
  public String getInventor()
773
    {
774
    return mInventor;
775
    }
776

    
777
///////////////////////////////////////////////////////////////////////////////////////////////////
778

    
779
  public int getYearOfInvention()
780
    {
781
    return mYearOfInvention;
782
    }
783

    
784
///////////////////////////////////////////////////////////////////////////////////////////////////
785

    
786
  public int getComplexity()
787
    {
788
    return mComplexity;
789
    }
790

    
791
///////////////////////////////////////////////////////////////////////////////////////////////////
792

    
793
  public int getNumFaces()
794
    {
795
    return mNumFaces;
796
    }
797

    
798
///////////////////////////////////////////////////////////////////////////////////////////////////
799

    
800
  public int getNumFaceColors()
801
    {
802
    return mNumFaceColors;
803
    }
804

    
805
///////////////////////////////////////////////////////////////////////////////////////////////////
806

    
807
  public int[] getNumLayers()
808
    {
809
    return mNumLayers;
810
    }
811

    
812
///////////////////////////////////////////////////////////////////////////////////////////////////
813

    
814
  public float getSize()
815
    {
816
    return mSize;
817
    }
818

    
819
///////////////////////////////////////////////////////////////////////////////////////////////////
820

    
821
  public int getScrambleType()
822
    {
823
    return mScrambleType;
824
    }
825

    
826
///////////////////////////////////////////////////////////////////////////////////////////////////
827

    
828
  public int getColor(int face)
829
    {
830
    return mColor[face];
831
    }
832

    
833
///////////////////////////////////////////////////////////////////////////////////////////////////
834

    
835
  public int getInternalColor()
836
    {
837
    return mInternalColor;
838
    }
839

    
840
///////////////////////////////////////////////////////////////////////////////////////////////////
841

    
842
  public boolean shouldResetTextureMaps()
843
    {
844
    return mResetMaps;
845
    }
846
}
(1-1/2)