Project

General

Profile

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

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

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.main.Movement;
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

    
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74

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

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

    
90
///////////////////////////////////////////////////////////////////////////////////////////////////
91

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

    
96
    mCubitQuats     = new Static4D[numCubits];
97
    mCubitVariant   = new int[numCubits];
98
    mPositions      = new float[numCubits][];
99
    mCubitFaceColor = new int[numCubits][];
100
    mSolvedQuats    = new int[numCubits][];
101

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

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

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

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

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

    
124
      try
125
        {
126
        JSONArray jsonSolved = jsonCubit.getJSONArray("solvedQuats");
127
        int numSolved = jsonSolved.length();
128
        mSolvedQuats[i] = new int[numSolved];
129
        for(int j=0; j<numSolved; j++) mSolvedQuats[i][j] = jsonSolved.getInt(j);
130
        }
131
      catch( JSONException ex )
132
        {
133
        // ignore
134
        }
135
      }
136
    }
137

    
138
///////////////////////////////////////////////////////////////////////////////////////////////////
139

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

    
155
    mNumCubitFaces = -1;
156

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

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

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

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

    
185
      if( mNumCubitFaces<numFaces ) mNumCubitFaces=numFaces;
186

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

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

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

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

    
216
      ////// cornerPush ///////////////////////////////////////////////
217
      JSONArray jsonCornerPush= jsonShape.optJSONArray("cornerPush");
218

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

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

    
232
      ////// centerPush ///////////////////////////////////////////////
233
      JSONArray jsonCenterPush= jsonShape.optJSONArray("centerPush");
234

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

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

    
249
      ////// convexity ///////////////////////////////////////////////
250
      JSONObject jsonConvexity = jsonShape.optJSONObject("convexity");
251

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

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

    
268
///////////////////////////////////////////////////////////////////////////////////////////////////
269

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

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

    
282
      float[] coords     = new float[2*numVertices];
283
      float[] curvatures = new float[numVertices];
284
      float[] radii      = new float[numVertices];
285

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

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

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

    
300
///////////////////////////////////////////////////////////////////////////////////////////////////
301

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

    
312
///////////////////////////////////////////////////////////////////////////////////////////////////
313

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

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

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

    
328
      mBasicAngle[i] = jsonAx.getInt("basicAngle");
329

    
330
      float x = (float)jsonAx.getDouble("x");
331
      float y = (float)jsonAx.getDouble("y");
332
      float z = (float)jsonAx.getDouble("z");
333

    
334
      mAxis[i] = new Static3D(x,y,z);
335

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

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

    
346
      mNumLayers[i] = numRota;
347
      }
348
    }
349

    
350
///////////////////////////////////////////////////////////////////////////////////////////////////
351

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

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

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

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

    
370
///////////////////////////////////////////////////////////////////////////////////////////////////
371

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

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

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

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

    
396
        mStates[i] = new ScrambleState(scramblingData);
397
        }
398
      }
399
    }
400

    
401
///////////////////////////////////////////////////////////////////////////////////////////////////
402

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

    
408
    JSONArray jsonEnabled = object.getJSONArray("enabledAxis");
409
    int numFace = jsonEnabled.length();
410

    
411
    mEnabled = new int[numFace][][];
412

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

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

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

    
448
///////////////////////////////////////////////////////////////////////////////////////////////////
449

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

    
457
///////////////////////////////////////////////////////////////////////////////////////////////////
458

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

    
477
///////////////////////////////////////////////////////////////////////////////////////////////////
478

    
479
  public void parseJsonFile(InputStream jsonStream)
480
    {
481
    BufferedReader br = new BufferedReader(new InputStreamReader(jsonStream, StandardCharsets.UTF_8));
482

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

    
491
      JSONObject object = new JSONObject(contents.toString());
492
      int major = object.getInt("major");
493

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

    
513
///////////////////////////////////////////////////////////////////////////////////////////////////
514

    
515
  public ScrambleState[] getScrambleStates()
516
    {
517
    return mStates;
518
    }
519

    
520
///////////////////////////////////////////////////////////////////////////////////////////////////
521

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

    
527
///////////////////////////////////////////////////////////////////////////////////////////////////
528

    
529
  public Static4D[] getQuats()
530
    {
531
    return mQuats;
532
    }
533

    
534
///////////////////////////////////////////////////////////////////////////////////////////////////
535

    
536
  public int getSolvedFunctionIndex()
537
    {
538
    return mSolvedFuncIndex;
539
    }
540

    
541
///////////////////////////////////////////////////////////////////////////////////////////////////
542

    
543
  public int getNumStickerTypes()
544
    {
545
    return mNumStickerTypes;
546
    }
547

    
548
///////////////////////////////////////////////////////////////////////////////////////////////////
549

    
550
  public float[][] getCuts()
551
    {
552
    return mCuts;
553
    }
554

    
555
///////////////////////////////////////////////////////////////////////////////////////////////////
556

    
557
  public boolean[][] getLayerRotatable()
558
    {
559
    return mLayerRotatable;
560
    }
561

    
562
///////////////////////////////////////////////////////////////////////////////////////////////////
563

    
564
  public int getMovementType()
565
    {
566
    return mMovementType;
567
    }
568

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

    
571
  public int getMovementSplit()
572
    {
573
    return mMovementSplit;
574
    }
575

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

    
578
  public int[][][] getEnabled()
579
    {
580
    return mEnabled;
581
    }
582

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

    
585
  public float[] getDist3D()
586
    {
587
    return mDist3D;
588
    }
589

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

    
592
  public int getNumCubitFaces()
593
    {
594
    return mNumCubitFaces;
595
    }
596

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

    
599
  public float[][] getCubitPositions()
600
    {
601
    return mPositions;
602
    }
603

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

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

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

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

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

    
620
  public int getNumCubitVariants()
621
    {
622
    return mNumCubitVariants;
623
    }
624

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

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

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

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

    
640
///////////////////////////////////////////////////////////////////////////////////////////////////
641

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

    
647
///////////////////////////////////////////////////////////////////////////////////////////////////
648

    
649
  public int getNumScrambles()
650
    {
651
    return mNumScrambles;
652
    }
653

    
654
///////////////////////////////////////////////////////////////////////////////////////////////////
655

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

    
661
///////////////////////////////////////////////////////////////////////////////////////////////////
662

    
663
  public Static3D[] getRotationAxis()
664
    {
665
    return mAxis;
666
    }
667

    
668
///////////////////////////////////////////////////////////////////////////////////////////////////
669

    
670
  public int[] getBasicAngle()
671
    {
672
    return mBasicAngle;
673
    }
674

    
675
///////////////////////////////////////////////////////////////////////////////////////////////////
676

    
677
  public ObjectType intGetObjectType()
678
    {
679
    return mType;
680
    }
681

    
682
///////////////////////////////////////////////////////////////////////////////////////////////////
683

    
684
  public String getObjectName()
685
    {
686
    return mLongName;
687
    }
688

    
689
///////////////////////////////////////////////////////////////////////////////////////////////////
690

    
691
  public String getShortName()
692
    {
693
    return mShortName;
694
    }
695

    
696
///////////////////////////////////////////////////////////////////////////////////////////////////
697

    
698
  public String getInventor()
699
    {
700
    return mInventor;
701
    }
702

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

    
705
  public int getYearOfInvention()
706
    {
707
    return mYearOfInvention;
708
    }
709

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

    
712
  public int getComplexity()
713
    {
714
    return mComplexity;
715
    }
716

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

    
719
  public int getNumFaces()
720
    {
721
    return mNumFaces;
722
    }
723

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

    
726
  public int getNumFaceColors()
727
    {
728
    return mNumFaceColors;
729
    }
730

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

    
733
  public int[] getNumLayers()
734
    {
735
    return mNumLayers;
736
    }
737

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

    
740
  public float getSize()
741
    {
742
    return mSize;
743
    }
744

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

    
747
  public int getScrambleType()
748
    {
749
    return mScrambleType;
750
    }
751

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

    
754
  public int getColor(int face)
755
    {
756
    return mColor[face];
757
    }
758
}
(1-1/2)