Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / json / JsonReader.java @ 3c48fab9

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 ObjectType mType;
73
  private boolean mResetMaps;
74

    
75
///////////////////////////////////////////////////////////////////////////////////////////////////
76

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

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

    
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94

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

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

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

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

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

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

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

    
128
///////////////////////////////////////////////////////////////////////////////////////////////////
129

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

    
146
    mNumCubitFaces = -1;
147

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
259
///////////////////////////////////////////////////////////////////////////////////////////////////
260

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

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

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

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

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

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

    
291
///////////////////////////////////////////////////////////////////////////////////////////////////
292

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

    
303
///////////////////////////////////////////////////////////////////////////////////////////////////
304

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

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

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

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

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

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

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

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

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

    
341
///////////////////////////////////////////////////////////////////////////////////////////////////
342

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

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

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

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

    
361
///////////////////////////////////////////////////////////////////////////////////////////////////
362

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

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

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

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

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

    
392
///////////////////////////////////////////////////////////////////////////////////////////////////
393

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

    
399
    JSONArray jsonEnabled = object.getJSONArray("enabledAxis");
400
    int numFace = jsonEnabled.length();
401

    
402
    mEnabled = new int[numFace][][];
403

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

    
410
      for(int j=0; j<numSection; j++)
411
        {
412
        JSONArray jsonAx = jsonSection.getJSONArray(j);
413
        int numAxis = jsonAx.length();
414
        mEnabled[i][j] = new int[numAxis];
415
        for(int k=0; k<numAxis; k++) mEnabled[i][j][k] = jsonAx.getInt(k);
416
        }
417
      }
418

    
419
    try
420
      {
421
      JSONArray jsonDist = object.getJSONArray("dist3D");
422
      int num = jsonDist.length();
423
      mDist3D = new float[num];
424
      for(int j=0; j<num; j++) mDist3D[j] = (float)jsonDist.getDouble(j);
425
      }
426
    catch( JSONException ex )
427
      {
428
      // ignore, the object does not have a 'dist3D' which is possible.
429
      }
430
    }
431

    
432
///////////////////////////////////////////////////////////////////////////////////////////////////
433

    
434
  private void parseColors(JSONArray object) throws JSONException
435
    {
436
    mNumFaceColors = object.length();
437
    mColor = new int[mNumFaceColors];
438
    for(int i=0; i<mNumFaceColors; i++) mColor[i] = object.getInt(i);
439
    }
440

    
441
///////////////////////////////////////////////////////////////////////////////////////////////////
442

    
443
  private void parseSolved(JSONObject solved) throws JSONException
444
    {
445
    mSolvedFuncIndex = solved.getInt("functionIndex");
446

    
447
    try
448
      {
449
      JSONArray groupArray= solved.getJSONArray("groups");
450
      int numGroups = groupArray.length();
451
      mSolvedQuats  = new int[numGroups][];
452

    
453
      for(int i=0; i<numGroups; i++)
454
        {
455
        JSONArray groupElements = groupArray.getJSONArray(i);
456
        int groupSize = groupElements.length();
457
        mSolvedQuats[i] = new int[groupSize];
458
        for(int j=0; j<groupSize; j++) mSolvedQuats[i][j] = groupElements.getInt(j);
459
        }
460
      }
461
    catch( JSONException ex )
462
      {
463
      // ignore, the object does not have to have an array of solved groups.
464
      }
465
    }
466

    
467
///////////////////////////////////////////////////////////////////////////////////////////////////
468

    
469
  private void parseVersion1(JSONObject object) throws JSONException
470
    {
471
    JSONObject metadata    = object.getJSONObject("metadata");
472
    parseMetadata(metadata);
473
    JSONObject mesh        = object.getJSONObject("mesh");
474
    parseMesh(mesh);
475
    JSONArray axis         = object.getJSONArray("axis");
476
    parseAxis(axis);
477
    JSONArray quats        = object.getJSONArray("quats");
478
    parseQuats(quats);
479
    JSONObject scrambling  = object.getJSONObject("scrambling");
480
    parseScrambling(scrambling);
481
    JSONObject touchcontrol= object.getJSONObject("touchcontrol");
482
    parseTouchcontrol(touchcontrol);
483
    JSONArray colors       = object.getJSONArray("colors");
484
    parseColors(colors);
485
    JSONObject solved      = object.getJSONObject("solved");
486
    parseSolved(solved);
487
    }
488

    
489
///////////////////////////////////////////////////////////////////////////////////////////////////
490

    
491
  private void parseVersion1Metadata(JSONObject object) throws JSONException
492
    {
493
    JSONObject metadata = object.getJSONObject("metadata");
494
    parseMetadata(metadata);
495
    }
496

    
497
///////////////////////////////////////////////////////////////////////////////////////////////////
498

    
499
  public void parseJsonFile(InputStream jsonStream)
500
    {
501
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
502

    
503
    try
504
      {
505
      StringBuilder contents = new StringBuilder();
506
      String tmp;
507
      while( (tmp = br.readLine()) != null) contents.append(tmp);
508
      br.close();
509
      jsonStream.close();
510

    
511
      JSONObject object = new JSONObject(contents.toString());
512
      int major = object.getInt("major");
513

    
514
      if( major==1 )
515
        {
516
        parseVersion1(object);
517
        }
518
      else
519
        {
520
        android.util.Log.e("readJsonFile", "Unknown version "+major);
521
        }
522
      }
523
    catch(IOException e)
524
      {
525
      android.util.Log.e("readJsonFile", "Error reading JSON file: "+e.toString());
526
      }
527
    catch( JSONException e )
528
      {
529
      android.util.Log.e("parseJsonFile", "Error parsing JSON file: "+e.toString());
530
      }
531
    }
532

    
533
///////////////////////////////////////////////////////////////////////////////////////////////////
534

    
535
  public void parseJsonFileMetadata(InputStream jsonStream)
536
    {
537
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
538

    
539
    try
540
      {
541
      StringBuilder contents = new StringBuilder();
542
      String tmp;
543
      while( (tmp = br.readLine()) != null) contents.append(tmp);
544
      br.close();
545
      jsonStream.close();
546

    
547
      JSONObject object = new JSONObject(contents.toString());
548
      int major = object.getInt("major");
549

    
550
      if( major==1 )
551
        {
552
        parseVersion1Metadata(object);
553
        }
554
      else
555
        {
556
        android.util.Log.e("readJsonFileQuick", "Unknown version "+major);
557
        }
558
      }
559
    catch(IOException e)
560
      {
561
      android.util.Log.e("readJsonFileQuick", "Error reading JSON file: "+e.toString());
562
      }
563
    catch( JSONException e )
564
      {
565
      android.util.Log.e("parseJsonFileQuick", "Error parsing JSON file: "+e.toString());
566
      }
567
    }
568

    
569
///////////////////////////////////////////////////////////////////////////////////////////////////
570

    
571
  public ScrambleState[] getScrambleStates()
572
    {
573
    return mStates;
574
    }
575

    
576
///////////////////////////////////////////////////////////////////////////////////////////////////
577

    
578
  public int[][] getSolvedQuats()
579
    {
580
    return mSolvedQuats;
581
    }
582

    
583
///////////////////////////////////////////////////////////////////////////////////////////////////
584

    
585
  public Static4D[] getQuats()
586
    {
587
    return mQuats;
588
    }
589

    
590
///////////////////////////////////////////////////////////////////////////////////////////////////
591

    
592
  public int getSolvedFunctionIndex()
593
    {
594
    return mSolvedFuncIndex;
595
    }
596

    
597
///////////////////////////////////////////////////////////////////////////////////////////////////
598

    
599
  public int getNumStickerTypes()
600
    {
601
    return mNumStickerTypes;
602
    }
603

    
604
///////////////////////////////////////////////////////////////////////////////////////////////////
605

    
606
  public float[][] getCuts()
607
    {
608
    return mCuts;
609
    }
610

    
611
///////////////////////////////////////////////////////////////////////////////////////////////////
612

    
613
  public boolean[][] getLayerRotatable()
614
    {
615
    return mLayerRotatable;
616
    }
617

    
618
///////////////////////////////////////////////////////////////////////////////////////////////////
619

    
620
  public int getMovementType()
621
    {
622
    return mMovementType;
623
    }
624

    
625
///////////////////////////////////////////////////////////////////////////////////////////////////
626

    
627
  public int getMovementSplit()
628
    {
629
    return mMovementSplit;
630
    }
631

    
632
///////////////////////////////////////////////////////////////////////////////////////////////////
633

    
634
  public int[][][] getEnabled()
635
    {
636
    return mEnabled;
637
    }
638

    
639
///////////////////////////////////////////////////////////////////////////////////////////////////
640

    
641
  public float[] getDist3D()
642
    {
643
    return mDist3D;
644
    }
645

    
646
///////////////////////////////////////////////////////////////////////////////////////////////////
647

    
648
  public int getNumCubitFaces()
649
    {
650
    return mNumCubitFaces;
651
    }
652

    
653
///////////////////////////////////////////////////////////////////////////////////////////////////
654

    
655
  public float[][] getCubitPositions()
656
    {
657
    return mPositions;
658
    }
659

    
660
///////////////////////////////////////////////////////////////////////////////////////////////////
661

    
662
  public ObjectShape getObjectShape(int variant)
663
    {
664
    return mShapes[variant];
665
    }
666

    
667
///////////////////////////////////////////////////////////////////////////////////////////////////
668

    
669
  public ObjectFaceShape getObjectFaceShape(int variant)
670
    {
671
    return mFaceShapes[variant];
672
    }
673

    
674
///////////////////////////////////////////////////////////////////////////////////////////////////
675

    
676
  public Static4D getCubitQuats(int cubit)
677
    {
678
    return mCubitQuats[cubit];
679
    }
680

    
681
///////////////////////////////////////////////////////////////////////////////////////////////////
682

    
683
  public int getNumCubitVariants()
684
    {
685
    return mNumCubitVariants;
686
    }
687

    
688
///////////////////////////////////////////////////////////////////////////////////////////////////
689

    
690
  public int getCubitVariant(int cubit)
691
    {
692
    return mCubitVariant[cubit];
693
    }
694

    
695
///////////////////////////////////////////////////////////////////////////////////////////////////
696

    
697
  public int getVariantFaceColor(int variant, int face)
698
    {
699
    int[] colors = mVariantFaceColor[variant];
700
    return colors.length>face ? colors[face] : -1;
701
    }
702

    
703
///////////////////////////////////////////////////////////////////////////////////////////////////
704

    
705
  public int getCubitFaceFace(int cubit, int face)
706
    {
707
    return mCubitFaceColor[cubit][face];
708
    }
709

    
710
///////////////////////////////////////////////////////////////////////////////////////////////////
711

    
712
  public int getNumScrambles()
713
    {
714
    return mNumScrambles;
715
    }
716

    
717
///////////////////////////////////////////////////////////////////////////////////////////////////
718

    
719
  public ObjectSticker retSticker(int sticker)
720
    {
721
    return mObjectSticker[sticker];
722
    }
723

    
724
///////////////////////////////////////////////////////////////////////////////////////////////////
725

    
726
  public Static3D[] getRotationAxis()
727
    {
728
    return mAxis;
729
    }
730

    
731
///////////////////////////////////////////////////////////////////////////////////////////////////
732

    
733
  public int[] getBasicAngle()
734
    {
735
    return mBasicAngle;
736
    }
737

    
738
///////////////////////////////////////////////////////////////////////////////////////////////////
739

    
740
  public ObjectType intGetObjectType()
741
    {
742
    return mType;
743
    }
744

    
745
///////////////////////////////////////////////////////////////////////////////////////////////////
746

    
747
  public String getObjectName()
748
    {
749
    return mLongName;
750
    }
751

    
752
///////////////////////////////////////////////////////////////////////////////////////////////////
753

    
754
  public String getShortName()
755
    {
756
    return mShortName;
757
    }
758

    
759
///////////////////////////////////////////////////////////////////////////////////////////////////
760

    
761
  public String getInventor()
762
    {
763
    return mInventor;
764
    }
765

    
766
///////////////////////////////////////////////////////////////////////////////////////////////////
767

    
768
  public int getYearOfInvention()
769
    {
770
    return mYearOfInvention;
771
    }
772

    
773
///////////////////////////////////////////////////////////////////////////////////////////////////
774

    
775
  public int getComplexity()
776
    {
777
    return mComplexity;
778
    }
779

    
780
///////////////////////////////////////////////////////////////////////////////////////////////////
781

    
782
  public int getNumFaces()
783
    {
784
    return mNumFaces;
785
    }
786

    
787
///////////////////////////////////////////////////////////////////////////////////////////////////
788

    
789
  public int getNumFaceColors()
790
    {
791
    return mNumFaceColors;
792
    }
793

    
794
///////////////////////////////////////////////////////////////////////////////////////////////////
795

    
796
  public int[] getNumLayers()
797
    {
798
    return mNumLayers;
799
    }
800

    
801
///////////////////////////////////////////////////////////////////////////////////////////////////
802

    
803
  public float getSize()
804
    {
805
    return mSize;
806
    }
807

    
808
///////////////////////////////////////////////////////////////////////////////////////////////////
809

    
810
  public int getScrambleType()
811
    {
812
    return mScrambleType;
813
    }
814

    
815
///////////////////////////////////////////////////////////////////////////////////////////////////
816

    
817
  public int getColor(int face)
818
    {
819
    return mColor[face];
820
    }
821

    
822
///////////////////////////////////////////////////////////////////////////////////////////////////
823

    
824
  public boolean shouldResetTextureMaps()
825
    {
826
    return mResetMaps;
827
    }
828
}
(1-1/2)