Project

General

Profile

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

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

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.touchcontrol.TouchControl;
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 Static4D[] mCubitQuats;
59
  private int mNumCubitVariants;
60
  private int[] mCubitVariant;
61
  private int[][] mVariantFaceColor, mCubitFaceColor;
62
  private ObjectSticker[] mObjectSticker;
63
  private Static3D[] mAxis;
64
  private int[] mBasicAngle;
65
  private String mLongName, mShortName, mInventor;
66
  private int mYearOfInvention, mComplexity;
67
  private int[] mNumLayers;
68
  private float mSize;
69
  private int mScrambleType, mNumScrambles;
70
  private int[] mColor;
71
  private ObjectType mType;
72
  private boolean mResetMaps;
73

    
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75

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

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

    
92
///////////////////////////////////////////////////////////////////////////////////////////////////
93

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

    
98
    mCubitQuats     = new Static4D[numCubits];
99
    mCubitVariant   = new int[numCubits];
100
    mPositions      = new float[numCubits][];
101
    mCubitFaceColor = new int[numCubits][];
102
    mSolvedQuats    = 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
      try
127
        {
128
        JSONArray jsonSolved = jsonCubit.getJSONArray("solvedQuats");
129
        int numSolved = jsonSolved.length();
130
        mSolvedQuats[i] = new int[numSolved];
131
        for(int j=0; j<numSolved; j++) mSolvedQuats[i][j] = jsonSolved.getInt(j);
132
        }
133
      catch( JSONException ex )
134
        {
135
        // ignore
136
        }
137
      }
138
    }
139

    
140
///////////////////////////////////////////////////////////////////////////////////////////////////
141

    
142
  private void parseShapes(JSONArray object) throws JSONException
143
    {
144
    mNumCubitVariants = object.length();
145
    mVariantFaceColor = new int[mNumCubitVariants][];
146
    mShapes = new ObjectShape[mNumCubitVariants];
147
    float[][][] verts     = new float[mNumCubitVariants][][];
148
    float[][][] bands     = new float[mNumCubitVariants][][];
149
    float[][][] corners   = new float[mNumCubitVariants][][];
150
    float[][][] centers   = new float[mNumCubitVariants][][];
151
    float[][] convexity   = new float[mNumCubitVariants][];
152
    int[][] cornerIndices = new int[mNumCubitVariants][];
153
    int[][] centerIndices = new int[mNumCubitVariants][];
154
    int[][] bandIndices   = new int[mNumCubitVariants][];
155
    int[][][] vertIndices = new int[mNumCubitVariants][][];
156

    
157
    mNumCubitFaces = -1;
158

    
159
    for(int i=0; i<mNumCubitVariants; i++)
160
      {
161
      JSONObject jsonShape = object.getJSONObject(i);
162

    
163
      ////// vertices /////////////////////////////////////////////////
164
      JSONArray jsonVertices= jsonShape.getJSONArray("vertices");
165
      int numVertices = jsonVertices.length();
166
      verts[i] = new float[numVertices][3];
167
      cornerIndices[i] = new int[numVertices];
168
      centerIndices[i] = new int[numVertices];
169

    
170
      for(int j=0; j<numVertices; j++)
171
        {
172
        JSONObject vert = jsonVertices.getJSONObject(j);
173
        verts[i][j][0] = (float)vert.getDouble("x");
174
        verts[i][j][1] = (float)vert.getDouble("y");
175
        verts[i][j][2] = (float)vert.getDouble("z");
176
        cornerIndices[i][j] = vert.getInt("cornerIndex");
177
        centerIndices[i][j] = vert.getInt("centerIndex");
178
        }
179

    
180
      ////// faces ////////////////////////////////////////////////////
181
      JSONArray jsonFaces= jsonShape.getJSONArray("faces");
182
      int numFaces = jsonFaces.length();
183
      mVariantFaceColor[i] = new int[numFaces];
184
      bandIndices[i] = new int[numFaces];
185
      vertIndices[i] = new int[numFaces][];
186

    
187
      if( mNumCubitFaces<numFaces ) mNumCubitFaces=numFaces;
188

    
189
      for(int j=0; j<numFaces; j++)
190
        {
191
        JSONObject jsonFace = jsonFaces.getJSONObject(j);
192
        mVariantFaceColor[i][j] = jsonFace.getInt("sticker");
193
        bandIndices[i][j] = jsonFace.getInt("bandIndex");
194
        JSONArray vertices = jsonFace.getJSONArray("vertexIndices");
195
        int numV = vertices.length();
196
        vertIndices[i][j] = new int[numV];
197
        for(int k=0; k<numV; k++) vertIndices[i][j][k] = vertices.getInt(k);
198
        }
199

    
200
      ////// bands ////////////////////////////////////////////////////
201
      JSONArray jsonBands= jsonShape.getJSONArray("bands");
202
      int numBands = jsonBands.length();
203
      bands[i] = new float[numBands][7];
204

    
205
      for(int j=0; j<numBands; j++)
206
        {
207
        JSONObject jsonBand = jsonBands.getJSONObject(j);
208

    
209
        bands[i][j][0] = (float)jsonBand.getDouble("height");
210
        bands[i][j][1] = (float)jsonBand.getDouble("angle");
211
        bands[i][j][2] = (float)jsonBand.getDouble("distanceToCenter");
212
        bands[i][j][3] = (float)jsonBand.getDouble("distanceToFlat");
213
        bands[i][j][4] = (float)jsonBand.getDouble("numOfBands");
214
        bands[i][j][5] = (float)jsonBand.getDouble("extraI");
215
        bands[i][j][6] = (float)jsonBand.getDouble("extraJ");
216
        }
217

    
218
      ////// cornerPush ///////////////////////////////////////////////
219
      JSONArray jsonCornerPush= jsonShape.optJSONArray("cornerPush");
220

    
221
      if( jsonCornerPush!=null )
222
        {
223
        int numCornerP = jsonCornerPush.length();
224
        corners[i] = new float[numCornerP][2];
225

    
226
        for(int j=0; j<numCornerP; j++)
227
          {
228
          JSONObject jsonC = jsonCornerPush.getJSONObject(j);
229
          corners[i][j][0] = (float)jsonC.getDouble("strength");
230
          corners[i][j][1] = (float)jsonC.getDouble("radius");
231
          }
232
        }
233

    
234
      ////// centerPush ///////////////////////////////////////////////
235
      JSONArray jsonCenterPush= jsonShape.optJSONArray("centerPush");
236

    
237
      if( jsonCenterPush!=null )
238
        {
239
        int numCenterP = jsonCenterPush.length();
240
        centers[i] = new float[numCenterP][3];
241

    
242
        for(int j=0; j<numCenterP; j++)
243
          {
244
          JSONObject jsonC = jsonCenterPush.getJSONObject(j);
245
          centers[i][j][0] = (float)jsonC.getDouble("x");
246
          centers[i][j][1] = (float)jsonC.getDouble("y");
247
          centers[i][j][2] = (float)jsonC.getDouble("z");
248
          }
249
        }
250

    
251
      ////// convexity ///////////////////////////////////////////////
252
      JSONObject jsonConvexity = jsonShape.optJSONObject("convexity");
253

    
254
      if( jsonConvexity!=null )
255
        {
256
        convexity[i] = new float[3];
257
        convexity[i][0] = (float)jsonConvexity.getDouble("x");
258
        convexity[i][1] = (float)jsonConvexity.getDouble("y");
259
        convexity[i][2] = (float)jsonConvexity.getDouble("z");
260
        }
261
      }
262

    
263
    for(int i=0; i<mNumCubitVariants; i++)
264
      {
265
      mShapes[i] = new ObjectShape(verts[i],vertIndices[i],bands[i],bandIndices[i],corners[i],
266
                                   cornerIndices[i],centers[i],centerIndices[i],mNumCubitFaces, convexity[i]);
267
      }
268
    }
269

    
270
///////////////////////////////////////////////////////////////////////////////////////////////////
271

    
272
  private void parseStickers(JSONArray object) throws JSONException
273
    {
274
    mNumStickerTypes = object.length();
275
    mObjectSticker = new ObjectSticker[mNumStickerTypes];
276

    
277
    for(int i=0; i<mNumStickerTypes; i++)
278
      {
279
      JSONObject sticker = object.getJSONObject(i);
280
      float stroke = (float)sticker.getDouble("stroke");
281
      JSONArray vertices = sticker.getJSONArray("vertices");
282
      int numVertices = vertices.length();
283

    
284
      float[] coords     = new float[2*numVertices];
285
      float[] curvatures = new float[numVertices];
286
      float[] radii      = new float[numVertices];
287

    
288
      for(int j=0; j<numVertices; j++)
289
        {
290
        JSONObject vertex = vertices.getJSONObject(j);
291

    
292
        coords[2*j  ] = (float)vertex.getDouble("x");
293
        coords[2*j+1] = (float)vertex.getDouble("y");
294
        curvatures[j] = (float)vertex.getDouble("angle");
295
        radii[j]      = (float)vertex.getDouble("radius");
296
        }
297

    
298
      mObjectSticker[i] = new ObjectSticker(coords,curvatures,radii,stroke);
299
      }
300
    }
301

    
302
///////////////////////////////////////////////////////////////////////////////////////////////////
303

    
304
  private void parseMesh(JSONObject object) throws JSONException
305
    {
306
    JSONArray cubits   = object.getJSONArray("cubits");
307
    parseCubits(cubits);
308
    JSONArray shapes   = object.getJSONArray("shapes");
309
    parseShapes(shapes);
310
    JSONArray stickers = object.getJSONArray("stickers");
311
    parseStickers(stickers);
312
    }
313

    
314
///////////////////////////////////////////////////////////////////////////////////////////////////
315

    
316
  private void parseAxis(JSONArray object) throws JSONException
317
    {
318
    int numAxis = object.length();
319

    
320
    mBasicAngle     = new int[numAxis];
321
    mAxis           = new Static3D[numAxis];
322
    mCuts           = new float[numAxis][];
323
    mLayerRotatable = new boolean[numAxis][];
324
    mNumLayers      = new int[numAxis];
325

    
326
    for(int i=0; i<numAxis; i++)
327
      {
328
      JSONObject jsonAx = object.getJSONObject(i);
329

    
330
      mBasicAngle[i] = jsonAx.getInt("basicAngle");
331

    
332
      float x = (float)jsonAx.getDouble("x");
333
      float y = (float)jsonAx.getDouble("y");
334
      float z = (float)jsonAx.getDouble("z");
335

    
336
      mAxis[i] = new Static3D(x,y,z);
337

    
338
      JSONArray jsonCuts = jsonAx.getJSONArray("cuts");
339
      int numCuts = jsonCuts.length();
340
      mCuts[i] = new float[numCuts];
341
      for(int j=0; j<numCuts; j++) mCuts[i][j] = (float)jsonCuts.getDouble(j);
342

    
343
      JSONArray jsonRota = jsonAx.getJSONArray("rotatable");
344
      int numRota = jsonRota.length();
345
      mLayerRotatable[i] = new boolean[numRota];
346
      for(int j=0; j<numRota; j++) mLayerRotatable[i][j] = jsonRota.getBoolean(j);
347

    
348
      mNumLayers[i] = numRota;
349
      }
350
    }
351

    
352
///////////////////////////////////////////////////////////////////////////////////////////////////
353

    
354
  private void parseQuats(JSONArray object) throws JSONException
355
    {
356
    int numQuats = object.length();
357
    mQuats = new Static4D[numQuats];
358

    
359
    for(int i=0; i<numQuats; i++)
360
      {
361
      JSONObject jsonQuat = object.getJSONObject(i);
362

    
363
      float x = (float)jsonQuat.getDouble("x");
364
      float y = (float)jsonQuat.getDouble("y");
365
      float z = (float)jsonQuat.getDouble("z");
366
      float w = (float)jsonQuat.getDouble("w");
367

    
368
      mQuats[i] = new Static4D(x,y,z,w);
369
      }
370
    }
371

    
372
///////////////////////////////////////////////////////////////////////////////////////////////////
373

    
374
  private void parseScrambling(JSONObject object) throws JSONException
375
    {
376
    mScrambleType = object.getInt("scrambleType");
377

    
378
    if( mScrambleType==0 )
379
      {
380
      JSONArray jsonStates = object.getJSONArray("scrambleStates");
381
      int numStates = jsonStates.length();
382
      mStates = new ScrambleState[numStates];
383

    
384
      for(int i=0; i<numStates; i++)
385
        {
386
        JSONArray jsonState = jsonStates.getJSONArray(i);
387
        int numAxis = jsonState.length();
388
        int[][] scramblingData = new int[numAxis][];
389

    
390
        for(int j=0; j<numAxis; j++)
391
          {
392
          JSONArray jsonData = jsonState.getJSONArray(j);
393
          int numData = jsonData.length();
394
          scramblingData[j] = new int[numData];
395
          for(int k=0; k<numData; k++) scramblingData[j][k] = jsonData.getInt(k);
396
          }
397

    
398
        mStates[i] = new ScrambleState(scramblingData);
399
        }
400
      }
401
    }
402

    
403
///////////////////////////////////////////////////////////////////////////////////////////////////
404

    
405
  private void parseTouchcontrol(JSONObject object) throws JSONException
406
    {
407
    mMovementType = object.getInt("movementType");
408
    mMovementSplit= object.getInt("movementSplit");
409

    
410
    JSONArray jsonEnabled = object.getJSONArray("enabledAxis");
411
    int numFace = jsonEnabled.length();
412

    
413
    mEnabled = new int[numFace][][];
414

    
415
    for(int i=0; i<numFace; i++)
416
      {
417
      JSONArray jsonSection = jsonEnabled.getJSONArray(i);
418
      int numSection = jsonSection.length();
419
      mEnabled[i] = new int[numSection][];
420

    
421
      for(int j=0; j<numSection; j++)
422
        {
423
        JSONArray jsonAx = jsonSection.getJSONArray(j);
424
        int numAxis = jsonAx.length();
425
        mEnabled[i][j] = new int[numAxis];
426
        for(int k=0; k<numAxis; k++) mEnabled[i][j][k] = jsonAx.getInt(k);
427
        }
428
      }
429

    
430
    try
431
      {
432
      JSONArray jsonDist = object.getJSONArray("dist3D");
433
      mNumFaces = jsonDist.length();
434
      mDist3D = new float[mNumFaces];
435
      for(int j=0; j<mNumFaces; j++) mDist3D[j] = (float)jsonDist.getDouble(j);
436
      }
437
    catch( JSONException ex )
438
      {
439
      switch(mMovementType)
440
        {
441
        case TouchControl.TC_TETRAHEDRON : mNumFaces = 4; break;
442
        case TouchControl.TC_HEXAHEDRON  : mNumFaces = 6; break;
443
        case TouchControl.TC_OCTAHEDRON  : mNumFaces = 8; break;
444
        case TouchControl.TC_DODECAHEDRON: mNumFaces =12; break;
445
        default                          : android.util.Log.e("D", "Error in parseTouchcontrol");
446
        }
447
      }
448
    }
449

    
450
///////////////////////////////////////////////////////////////////////////////////////////////////
451

    
452
  private void parseColors(JSONArray object) throws JSONException
453
    {
454
    mNumFaceColors = object.length();
455
    mColor = new int[mNumFaceColors];
456
    for(int i=0; i<mNumFaceColors; i++) mColor[i] = object.getInt(i);
457
    }
458

    
459
///////////////////////////////////////////////////////////////////////////////////////////////////
460

    
461
  private void parseVersion1(JSONObject object) throws JSONException
462
    {
463
    JSONObject metadata    = object.getJSONObject("metadata");
464
    parseMetadata(metadata);
465
    JSONObject mesh        = object.getJSONObject("mesh");
466
    parseMesh(mesh);
467
    JSONArray axis         = object.getJSONArray("axis");
468
    parseAxis(axis);
469
    JSONArray quats        = object.getJSONArray("quats");
470
    parseQuats(quats);
471
    JSONObject scrambling  = object.getJSONObject("scrambling");
472
    parseScrambling(scrambling);
473
    JSONObject touchcontrol= object.getJSONObject("touchcontrol");
474
    parseTouchcontrol(touchcontrol);
475
    JSONArray colors       = object.getJSONArray("colors");
476
    parseColors(colors);
477
    }
478

    
479
///////////////////////////////////////////////////////////////////////////////////////////////////
480

    
481
  private void parseVersion1Metadata(JSONObject object) throws JSONException
482
    {
483
    JSONObject metadata = object.getJSONObject("metadata");
484
    parseMetadata(metadata);
485
    }
486

    
487
///////////////////////////////////////////////////////////////////////////////////////////////////
488

    
489
  public void parseJsonFile(InputStream jsonStream)
490
    {
491
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
492

    
493
    try
494
      {
495
      StringBuilder contents = new StringBuilder();
496
      String tmp;
497
      while( (tmp = br.readLine()) != null) contents.append(tmp);
498
      br.close();
499
      jsonStream.close();
500

    
501
      JSONObject object = new JSONObject(contents.toString());
502
      int major = object.getInt("major");
503

    
504
      if( major==1 )
505
        {
506
        parseVersion1(object);
507
        }
508
      else
509
        {
510
        android.util.Log.e("readJsonFile", "Unknown version "+major);
511
        }
512
      }
513
    catch(IOException e)
514
      {
515
      android.util.Log.e("readJsonFile", "Error reading JSON file: "+e.toString());
516
      }
517
    catch( JSONException e )
518
      {
519
      android.util.Log.e("parseJsonFile", "Error parsing JSON file: "+e.toString());
520
      }
521
    }
522

    
523
///////////////////////////////////////////////////////////////////////////////////////////////////
524

    
525
  public void parseJsonFileMetadata(InputStream jsonStream)
526
    {
527
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
528

    
529
    try
530
      {
531
      StringBuilder contents = new StringBuilder();
532
      String tmp;
533
      while( (tmp = br.readLine()) != null) contents.append(tmp);
534
      br.close();
535
      jsonStream.close();
536

    
537
      JSONObject object = new JSONObject(contents.toString());
538
      int major = object.getInt("major");
539

    
540
      if( major==1 )
541
        {
542
        parseVersion1Metadata(object);
543
        }
544
      else
545
        {
546
        android.util.Log.e("readJsonFileQuick", "Unknown version "+major);
547
        }
548
      }
549
    catch(IOException e)
550
      {
551
      android.util.Log.e("readJsonFileQuick", "Error reading JSON file: "+e.toString());
552
      }
553
    catch( JSONException e )
554
      {
555
      android.util.Log.e("parseJsonFileQuick", "Error parsing JSON file: "+e.toString());
556
      }
557
    }
558

    
559
///////////////////////////////////////////////////////////////////////////////////////////////////
560

    
561
  public ScrambleState[] getScrambleStates()
562
    {
563
    return mStates;
564
    }
565

    
566
///////////////////////////////////////////////////////////////////////////////////////////////////
567

    
568
  public int[] getSolvedQuats(int cubit)
569
    {
570
    return mSolvedQuats[cubit];
571
    }
572

    
573
///////////////////////////////////////////////////////////////////////////////////////////////////
574

    
575
  public Static4D[] getQuats()
576
    {
577
    return mQuats;
578
    }
579

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

    
582
  public int getSolvedFunctionIndex()
583
    {
584
    return mSolvedFuncIndex;
585
    }
586

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

    
589
  public int getNumStickerTypes()
590
    {
591
    return mNumStickerTypes;
592
    }
593

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

    
596
  public float[][] getCuts()
597
    {
598
    return mCuts;
599
    }
600

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

    
603
  public boolean[][] getLayerRotatable()
604
    {
605
    return mLayerRotatable;
606
    }
607

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

    
610
  public int getMovementType()
611
    {
612
    return mMovementType;
613
    }
614

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

    
617
  public int getMovementSplit()
618
    {
619
    return mMovementSplit;
620
    }
621

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

    
624
  public int[][][] getEnabled()
625
    {
626
    return mEnabled;
627
    }
628

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

    
631
  public float[] getDist3D()
632
    {
633
    return mDist3D;
634
    }
635

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

    
638
  public int getNumCubitFaces()
639
    {
640
    return mNumCubitFaces;
641
    }
642

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

    
645
  public float[][] getCubitPositions()
646
    {
647
    return mPositions;
648
    }
649

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

    
652
  public ObjectShape getObjectShape(int variant)
653
    {
654
    return mShapes[variant];
655
    }
656

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

    
659
  public Static4D getQuat(int cubit)
660
    {
661
    return mCubitQuats[cubit];
662
    }
663

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

    
666
  public int getNumCubitVariants()
667
    {
668
    return mNumCubitVariants;
669
    }
670

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

    
673
  public int getCubitVariant(int cubit)
674
    {
675
    return mCubitVariant[cubit];
676
    }
677

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

    
680
  public int getVariantFaceColor(int variant, int face)
681
    {
682
    int[] colors = mVariantFaceColor[variant];
683
    return colors.length>face ? colors[face] : -1;
684
    }
685

    
686
///////////////////////////////////////////////////////////////////////////////////////////////////
687

    
688
  public int getCubitFaceColor(int cubit, int face)
689
    {
690
    return mCubitFaceColor[cubit][face];
691
    }
692

    
693
///////////////////////////////////////////////////////////////////////////////////////////////////
694

    
695
  public int getNumScrambles()
696
    {
697
    return mNumScrambles;
698
    }
699

    
700
///////////////////////////////////////////////////////////////////////////////////////////////////
701

    
702
  public ObjectSticker retSticker(int sticker)
703
    {
704
    return mObjectSticker[sticker];
705
    }
706

    
707
///////////////////////////////////////////////////////////////////////////////////////////////////
708

    
709
  public Static3D[] getRotationAxis()
710
    {
711
    return mAxis;
712
    }
713

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

    
716
  public int[] getBasicAngle()
717
    {
718
    return mBasicAngle;
719
    }
720

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

    
723
  public ObjectType intGetObjectType()
724
    {
725
    return mType;
726
    }
727

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

    
730
  public String getObjectName()
731
    {
732
    return mLongName;
733
    }
734

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

    
737
  public String getShortName()
738
    {
739
    return mShortName;
740
    }
741

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

    
744
  public String getInventor()
745
    {
746
    return mInventor;
747
    }
748

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

    
751
  public int getYearOfInvention()
752
    {
753
    return mYearOfInvention;
754
    }
755

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

    
758
  public int getComplexity()
759
    {
760
    return mComplexity;
761
    }
762

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

    
765
  public int getNumFaces()
766
    {
767
    return mNumFaces;
768
    }
769

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

    
772
  public int getNumFaceColors()
773
    {
774
    return mNumFaceColors;
775
    }
776

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

    
779
  public int[] getNumLayers()
780
    {
781
    return mNumLayers;
782
    }
783

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

    
786
  public float getSize()
787
    {
788
    return mSize;
789
    }
790

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

    
793
  public int getScrambleType()
794
    {
795
    return mScrambleType;
796
    }
797

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

    
800
  public int getColor(int face)
801
    {
802
    return mColor[face];
803
    }
804

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

    
807
  public boolean shouldResetTextureMaps()
808
    {
809
    return mResetMaps;
810
    }
811
}
(1-1/2)