Project

General

Profile

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

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

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
  public void parseJsonFile(InputStream jsonStream)
482
    {
483
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
484

    
485
    try
486
      {
487
      StringBuilder contents = new StringBuilder();
488
      String tmp;
489
      while( (tmp = br.readLine()) != null) contents.append(tmp);
490
      br.close();
491
      jsonStream.close();
492

    
493
      JSONObject object = new JSONObject(contents.toString());
494
      int major = object.getInt("major");
495

    
496
      if( major==1 )
497
        {
498
        parseVersion1(object);
499
        }
500
      else
501
        {
502
        android.util.Log.e("readJsonFile", "Unknown version "+major);
503
        }
504
      }
505
    catch(IOException e)
506
      {
507
      android.util.Log.e("readJsonFile", "Error reading JSON file: "+e.toString());
508
      }
509
    catch( JSONException e )
510
      {
511
      android.util.Log.e("parseJsonFile", "Error parsing JSON file: "+e.toString());
512
      }
513
    }
514

    
515
///////////////////////////////////////////////////////////////////////////////////////////////////
516

    
517
  public ScrambleState[] getScrambleStates()
518
    {
519
    return mStates;
520
    }
521

    
522
///////////////////////////////////////////////////////////////////////////////////////////////////
523

    
524
  public int[] getSolvedQuats(int cubit)
525
    {
526
    return mSolvedQuats[cubit];
527
    }
528

    
529
///////////////////////////////////////////////////////////////////////////////////////////////////
530

    
531
  public Static4D[] getQuats()
532
    {
533
    return mQuats;
534
    }
535

    
536
///////////////////////////////////////////////////////////////////////////////////////////////////
537

    
538
  public int getSolvedFunctionIndex()
539
    {
540
    return mSolvedFuncIndex;
541
    }
542

    
543
///////////////////////////////////////////////////////////////////////////////////////////////////
544

    
545
  public int getNumStickerTypes()
546
    {
547
    return mNumStickerTypes;
548
    }
549

    
550
///////////////////////////////////////////////////////////////////////////////////////////////////
551

    
552
  public float[][] getCuts()
553
    {
554
    return mCuts;
555
    }
556

    
557
///////////////////////////////////////////////////////////////////////////////////////////////////
558

    
559
  public boolean[][] getLayerRotatable()
560
    {
561
    return mLayerRotatable;
562
    }
563

    
564
///////////////////////////////////////////////////////////////////////////////////////////////////
565

    
566
  public int getMovementType()
567
    {
568
    return mMovementType;
569
    }
570

    
571
///////////////////////////////////////////////////////////////////////////////////////////////////
572

    
573
  public int getMovementSplit()
574
    {
575
    return mMovementSplit;
576
    }
577

    
578
///////////////////////////////////////////////////////////////////////////////////////////////////
579

    
580
  public int[][][] getEnabled()
581
    {
582
    return mEnabled;
583
    }
584

    
585
///////////////////////////////////////////////////////////////////////////////////////////////////
586

    
587
  public float[] getDist3D()
588
    {
589
    return mDist3D;
590
    }
591

    
592
///////////////////////////////////////////////////////////////////////////////////////////////////
593

    
594
  public int getNumCubitFaces()
595
    {
596
    return mNumCubitFaces;
597
    }
598

    
599
///////////////////////////////////////////////////////////////////////////////////////////////////
600

    
601
  public float[][] getCubitPositions()
602
    {
603
    return mPositions;
604
    }
605

    
606
///////////////////////////////////////////////////////////////////////////////////////////////////
607

    
608
  public ObjectShape getObjectShape(int variant)
609
    {
610
    return mShapes[variant];
611
    }
612

    
613
///////////////////////////////////////////////////////////////////////////////////////////////////
614

    
615
  public Static4D getQuat(int cubit)
616
    {
617
    return mCubitQuats[cubit];
618
    }
619

    
620
///////////////////////////////////////////////////////////////////////////////////////////////////
621

    
622
  public int getNumCubitVariants()
623
    {
624
    return mNumCubitVariants;
625
    }
626

    
627
///////////////////////////////////////////////////////////////////////////////////////////////////
628

    
629
  public int getCubitVariant(int cubit)
630
    {
631
    return mCubitVariant[cubit];
632
    }
633

    
634
///////////////////////////////////////////////////////////////////////////////////////////////////
635

    
636
  public int getVariantFaceColor(int variant, int face)
637
    {
638
    int[] colors = mVariantFaceColor[variant];
639
    return colors.length>face ? colors[face] : -1;
640
    }
641

    
642
///////////////////////////////////////////////////////////////////////////////////////////////////
643

    
644
  public int getCubitFaceColor(int cubit, int face)
645
    {
646
    return mCubitFaceColor[cubit][face];
647
    }
648

    
649
///////////////////////////////////////////////////////////////////////////////////////////////////
650

    
651
  public int getNumScrambles()
652
    {
653
    return mNumScrambles;
654
    }
655

    
656
///////////////////////////////////////////////////////////////////////////////////////////////////
657

    
658
  public ObjectSticker retSticker(int sticker)
659
    {
660
    return mObjectSticker[sticker];
661
    }
662

    
663
///////////////////////////////////////////////////////////////////////////////////////////////////
664

    
665
  public Static3D[] getRotationAxis()
666
    {
667
    return mAxis;
668
    }
669

    
670
///////////////////////////////////////////////////////////////////////////////////////////////////
671

    
672
  public int[] getBasicAngle()
673
    {
674
    return mBasicAngle;
675
    }
676

    
677
///////////////////////////////////////////////////////////////////////////////////////////////////
678

    
679
  public ObjectType intGetObjectType()
680
    {
681
    return mType;
682
    }
683

    
684
///////////////////////////////////////////////////////////////////////////////////////////////////
685

    
686
  public String getObjectName()
687
    {
688
    return mLongName;
689
    }
690

    
691
///////////////////////////////////////////////////////////////////////////////////////////////////
692

    
693
  public String getShortName()
694
    {
695
    return mShortName;
696
    }
697

    
698
///////////////////////////////////////////////////////////////////////////////////////////////////
699

    
700
  public String getInventor()
701
    {
702
    return mInventor;
703
    }
704

    
705
///////////////////////////////////////////////////////////////////////////////////////////////////
706

    
707
  public int getYearOfInvention()
708
    {
709
    return mYearOfInvention;
710
    }
711

    
712
///////////////////////////////////////////////////////////////////////////////////////////////////
713

    
714
  public int getComplexity()
715
    {
716
    return mComplexity;
717
    }
718

    
719
///////////////////////////////////////////////////////////////////////////////////////////////////
720

    
721
  public int getNumFaces()
722
    {
723
    return mNumFaces;
724
    }
725

    
726
///////////////////////////////////////////////////////////////////////////////////////////////////
727

    
728
  public int getNumFaceColors()
729
    {
730
    return mNumFaceColors;
731
    }
732

    
733
///////////////////////////////////////////////////////////////////////////////////////////////////
734

    
735
  public int[] getNumLayers()
736
    {
737
    return mNumLayers;
738
    }
739

    
740
///////////////////////////////////////////////////////////////////////////////////////////////////
741

    
742
  public float getSize()
743
    {
744
    return mSize;
745
    }
746

    
747
///////////////////////////////////////////////////////////////////////////////////////////////////
748

    
749
  public int getScrambleType()
750
    {
751
    return mScrambleType;
752
    }
753

    
754
///////////////////////////////////////////////////////////////////////////////////////////////////
755

    
756
  public int getColor(int face)
757
    {
758
    return mColor[face];
759
    }
760

    
761
///////////////////////////////////////////////////////////////////////////////////////////////////
762

    
763
  public boolean shouldResetTextureMaps()
764
    {
765
    return mResetMaps;
766
    }
767
}
(1-1/2)