Project

General

Profile

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

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

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 static JsonReader mThis;
46

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

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

    
76
  private JsonReader()
77
    {
78

    
79
    }
80

    
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82

    
83
  public static JsonReader getInstance()
84
    {
85
    if( mThis==null ) mThis = new JsonReader();
86
    return mThis;
87
    }
88

    
89
///////////////////////////////////////////////////////////////////////////////////////////////////
90

    
91
  private void parseMetadata(JSONObject object) throws JSONException
92
    {
93
    mLongName        = object.getString("longname");
94
    mInventor        = object.getString("inventor");
95
    mYearOfInvention = object.getInt("year");
96
    mComplexity      = object.getInt("complexity");
97
    mSize            = (float)object.getDouble("size");
98
    mSolvedFuncIndex = object.getInt("solved_func");
99
    }
100

    
101
///////////////////////////////////////////////////////////////////////////////////////////////////
102

    
103
  private void parseCubits(JSONArray object) throws JSONException
104
    {
105
    int numCubits = object.length();
106

    
107
    mCubitQuats     = new Static4D[numCubits];
108
    mCubitVariant   = new int[numCubits];
109
    mPositions      = new float[numCubits][];
110
    mCubitFaceColor = new int[numCubits][];
111
    mSolvedQuats    = new int[numCubits][];
112

    
113
    for(int i=0; i<numCubits; i++)
114
      {
115
      JSONObject jsonCubit = object.getJSONObject(i);
116

    
117
      float qx = (float)jsonCubit.getDouble("qx");
118
      float qy = (float)jsonCubit.getDouble("qy");
119
      float qz = (float)jsonCubit.getDouble("qz");
120
      float qw = (float)jsonCubit.getDouble("qw");
121

    
122
      mCubitQuats[i] = new Static4D(qx,qy,qz,qw);
123
      mCubitVariant[i] = jsonCubit.getInt("variant");
124

    
125
      JSONArray jsonCenter = jsonCubit.getJSONArray("centers");
126
      int numCenter = jsonCenter.length();
127
      mPositions[i] = new float[numCenter];
128
      for(int j=0; j<numCenter; j++) mPositions[i][j] = (float)jsonCenter.getDouble(j);
129

    
130
      JSONArray jsonColor  = jsonCubit.getJSONArray("colors");
131
      int numColor = jsonColor.length();
132
      mCubitFaceColor[i] = new int[numColor];
133
      for(int j=0; j<numColor; j++) mCubitFaceColor[i][j] = jsonColor.getInt(j);
134

    
135
      try
136
        {
137
        JSONArray jsonSolved = jsonCubit.getJSONArray("solvedQuats");
138
        int numSolved = jsonSolved.length();
139
        mSolvedQuats[i] = new int[numSolved];
140
        for(int j=0; j<numSolved; j++) mSolvedQuats[i][j] = jsonSolved.getInt(j);
141
        }
142
      catch( JSONException ex )
143
        {
144
        // ignore
145
        }
146
      }
147
    }
148

    
149
///////////////////////////////////////////////////////////////////////////////////////////////////
150

    
151
  private void parseShapes(JSONArray object) throws JSONException
152
    {
153
    mNumCubitVariants = object.length();
154
    mVariantFaceColor = new int[mNumCubitVariants][];
155
    mShapes = new ObjectShape[mNumCubitVariants];
156
    double[][][] verts = new double[mNumCubitVariants][][];
157
    int[][] cornerIndices = new int[mNumCubitVariants][];
158
    int[][] centerIndices = new int[mNumCubitVariants][];
159
    int[][] bandIndices = new int[mNumCubitVariants][];
160
    int[][][] vertIndices = new int[mNumCubitVariants][][];
161
    float[][][] bands = new float[mNumCubitVariants][][];
162
    float[][][] corners = new float[mNumCubitVariants][][];
163
    float[][][] centers = new float[mNumCubitVariants][][];
164
    float[][] convexity = new float[mNumCubitVariants][];
165

    
166
    mNumCubitFaces = -1;
167

    
168
    for(int i=0; i<mNumCubitVariants; i++)
169
      {
170
      JSONObject jsonShape = object.getJSONObject(i);
171

    
172
      ////// vertices /////////////////////////////////////////////////
173
      JSONArray jsonVertices= jsonShape.getJSONArray("vertices");
174
      int numVertices = jsonVertices.length();
175
      verts[i] = new double[numVertices][3];
176
      cornerIndices[i] = new int[numVertices];
177
      centerIndices[i] = new int[numVertices];
178

    
179
      for(int j=0; j<numVertices; j++)
180
        {
181
        JSONObject vert = jsonVertices.getJSONObject(j);
182
        verts[i][j][0] = vert.getDouble("x");
183
        verts[i][j][1] = vert.getDouble("y");
184
        verts[i][j][2] = vert.getDouble("z");
185
        cornerIndices[i][j] = vert.getInt("cornerIndex");
186
        centerIndices[i][j] = vert.getInt("centerIndex");
187
        }
188

    
189
      ////// faces ////////////////////////////////////////////////////
190
      JSONArray jsonFaces= jsonShape.getJSONArray("faces");
191
      int numFaces = jsonFaces.length();
192
      mVariantFaceColor[i] = new int[numFaces];
193
      bandIndices[i] = new int[numFaces];
194
      vertIndices[i] = new int[numFaces][];
195

    
196
      if( mNumCubitFaces<numFaces ) mNumCubitFaces=numFaces;
197

    
198
      for(int j=0; j<numFaces; j++)
199
        {
200
        JSONObject jsonFace = jsonFaces.getJSONObject(j);
201
        mVariantFaceColor[i][j] = jsonFace.getInt("sticker");
202
        bandIndices[i][j] = jsonFace.getInt("bandIndex");
203
        JSONArray vertices = jsonFace.getJSONArray("vertexIndices");
204
        int numV = vertices.length();
205
        vertIndices[i][j] = new int[numV];
206
        for(int k=0; k<numV; k++) vertIndices[i][j][k] = vertices.getInt(k);
207
        }
208

    
209
      ////// bands ////////////////////////////////////////////////////
210
      JSONArray jsonBands= jsonShape.getJSONArray("bands");
211
      int numBands = jsonBands.length();
212
      bands[i] = new float[numBands][7];
213

    
214
      for(int j=0; j<numBands; j++)
215
        {
216
        JSONObject jsonBand = jsonBands.getJSONObject(j);
217

    
218
        bands[i][j][0] = (float)jsonBand.getDouble("height");
219
        bands[i][j][1] = (float)jsonBand.getDouble("angle");
220
        bands[i][j][2] = (float)jsonBand.getDouble("distanceToCenter");
221
        bands[i][j][3] = (float)jsonBand.getDouble("distanceToFlat");
222
        bands[i][j][4] = (float)jsonBand.getDouble("numOfBands");
223
        bands[i][j][5] = (float)jsonBand.getDouble("extraI");
224
        bands[i][j][6] = (float)jsonBand.getDouble("extraJ");
225
        }
226

    
227
      ////// cornerPush ///////////////////////////////////////////////
228
      JSONArray jsonCornerPush= jsonShape.optJSONArray("cornerPush");
229

    
230
      if( jsonCornerPush!=null )
231
        {
232
        int numCornerP = jsonCornerPush.length();
233
        corners[i] = new float[numCornerP][2];
234

    
235
        for(int j=0; j<numCornerP; j++)
236
          {
237
          JSONObject jsonC = jsonCornerPush.getJSONObject(j);
238
          corners[i][j][0] = (float)jsonC.getDouble("strength");
239
          corners[i][j][1] = (float)jsonC.getDouble("radius");
240
          }
241
        }
242

    
243
      ////// centerPush ///////////////////////////////////////////////
244
      JSONArray jsonCenterPush= jsonShape.optJSONArray("centerPush");
245

    
246
      if( jsonCenterPush!=null )
247
        {
248
        int numCenterP = jsonCenterPush.length();
249
        centers[i] = new float[numCenterP][3];
250

    
251
        for(int j=0; j<numCenterP; j++)
252
          {
253
          JSONObject jsonC = jsonCenterPush.getJSONObject(j);
254
          centers[i][j][0] = (float)jsonC.getDouble("x");
255
          centers[i][j][1] = (float)jsonC.getDouble("y");
256
          centers[i][j][2] = (float)jsonC.getDouble("z");
257
          }
258
        }
259

    
260
      ////// convexity ///////////////////////////////////////////////
261
      JSONObject jsonConvexity = jsonShape.optJSONObject("convexity");
262

    
263
      if( jsonConvexity!=null )
264
        {
265
        convexity[i] = new float[3];
266
        convexity[i][0] = (float)jsonConvexity.getDouble("x");
267
        convexity[i][1] = (float)jsonConvexity.getDouble("y");
268
        convexity[i][2] = (float)jsonConvexity.getDouble("z");
269
        }
270
      }
271

    
272
    for(int i=0; i<mNumCubitVariants; i++)
273
      {
274
      mShapes[i] = new ObjectShape(verts[i],vertIndices[i],bands[i],bandIndices[i],corners[i],
275
                                   cornerIndices[i],centers[i],centerIndices[i],mNumCubitFaces, convexity[i]);
276
      }
277
    }
278

    
279
///////////////////////////////////////////////////////////////////////////////////////////////////
280

    
281
  private void parseStickers(JSONArray object) throws JSONException
282
    {
283
    mNumStickerTypes = object.length();
284
    mObjectSticker = new ObjectSticker[mNumStickerTypes];
285

    
286
    for(int i=0; i<mNumStickerTypes; i++)
287
      {
288
      JSONObject sticker = object.getJSONObject(i);
289
      float stroke = (float)sticker.getDouble("stroke");
290
      JSONArray vertices = sticker.getJSONArray("vertices");
291
      int numVertices = vertices.length();
292

    
293
      float[] coords     = new float[2*numVertices];
294
      float[] curvatures = new float[numVertices];
295
      float[] radii      = new float[numVertices];
296

    
297
      for(int j=0; j<numVertices; j++)
298
        {
299
        JSONObject vertex = vertices.getJSONObject(j);
300

    
301
        coords[2*j  ] = (float)vertex.getDouble("x");
302
        coords[2*j+1] = (float)vertex.getDouble("y");
303
        curvatures[j] = (float)vertex.getDouble("angle");
304
        radii[j]      = (float)vertex.getDouble("radius");
305
        }
306

    
307
      mObjectSticker[i] = new ObjectSticker(coords,curvatures,radii,stroke);
308
      }
309
    }
310

    
311
///////////////////////////////////////////////////////////////////////////////////////////////////
312

    
313
  private void parseMesh(JSONObject object) throws JSONException
314
    {
315
    JSONArray cubits   = object.getJSONArray("cubits");
316
    parseCubits(cubits);
317
    JSONArray shapes   = object.getJSONArray("shapes");
318
    parseShapes(shapes);
319
    JSONArray stickers = object.getJSONArray("stickers");
320
    parseStickers(stickers);
321
    }
322

    
323
///////////////////////////////////////////////////////////////////////////////////////////////////
324

    
325
  private void parseAxis(JSONArray object) throws JSONException
326
    {
327
    int numAxis = object.length();
328

    
329
    mBasicAngle     = new int[numAxis];
330
    mAxis           = new Static3D[numAxis];
331
    mCuts           = new float[numAxis][];
332
    mLayerRotatable = new boolean[numAxis][];
333
    mNumLayers      = new int[numAxis];
334

    
335
    for(int i=0; i<numAxis; i++)
336
      {
337
      JSONObject jsonAx = object.getJSONObject(i);
338

    
339
      mBasicAngle[i] = jsonAx.getInt("basicAngle");
340

    
341
      float x = (float)jsonAx.getDouble("x");
342
      float y = (float)jsonAx.getDouble("y");
343
      float z = (float)jsonAx.getDouble("z");
344

    
345
      mAxis[i] = new Static3D(x,y,z);
346

    
347
      JSONArray jsonCuts = jsonAx.getJSONArray("cuts");
348
      int numCuts = jsonCuts.length();
349
      mCuts[i] = new float[numCuts];
350
      for(int j=0; j<numCuts; j++) mCuts[i][j] = (float)jsonCuts.getDouble(j);
351

    
352
      JSONArray jsonRota = jsonAx.getJSONArray("rotatable");
353
      int numRota = jsonRota.length();
354
      mLayerRotatable[i] = new boolean[numRota];
355
      for(int j=0; j<numRota; j++) mLayerRotatable[i][j] = jsonRota.getBoolean(j);
356

    
357
      mNumLayers[i] = numRota;
358
      }
359
    }
360

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

    
363
  private void parseQuats(JSONArray object) throws JSONException
364
    {
365
    int numQuats = object.length();
366
    mQuats = new Static4D[numQuats];
367

    
368
    for(int i=0; i<numQuats; i++)
369
      {
370
      JSONObject jsonQuat = object.getJSONObject(i);
371

    
372
      float x = (float)jsonQuat.getDouble("x");
373
      float y = (float)jsonQuat.getDouble("y");
374
      float z = (float)jsonQuat.getDouble("z");
375
      float w = (float)jsonQuat.getDouble("w");
376

    
377
      mQuats[i] = new Static4D(x,y,z,w);
378
      }
379
    }
380

    
381
///////////////////////////////////////////////////////////////////////////////////////////////////
382

    
383
  private void parseScrambling(JSONObject object) throws JSONException
384
    {
385
    mScrambleType = object.getInt("scrambleType");
386

    
387
    if( mScrambleType==0 )
388
      {
389
      JSONArray jsonStates = object.getJSONArray("scrambleStates");
390
      int numStates = jsonStates.length();
391
      mStates = new ScrambleState[numStates];
392

    
393
      for(int i=0; i<numStates; i++)
394
        {
395
        JSONArray jsonState = jsonStates.getJSONArray(i);
396
        int numAxis = jsonState.length();
397
        int[][] scramblingData = new int[numAxis][];
398

    
399
        for(int j=0; j<numAxis; j++)
400
          {
401
          JSONArray jsonData = jsonState.getJSONArray(j);
402
          int numData = jsonData.length();
403
          scramblingData[j] = new int[numData];
404
          for(int k=0; k<numData; k++) scramblingData[j][k] = jsonData.getInt(k);
405
          }
406

    
407
        mStates[i] = new ScrambleState(scramblingData);
408
        }
409
      }
410
    }
411

    
412
///////////////////////////////////////////////////////////////////////////////////////////////////
413

    
414
  private void parseTouchcontrol(JSONObject object) throws JSONException
415
    {
416
    mMovementType = object.getInt("movementType");
417
    mMovementSplit= object.getInt("movementSplit");
418

    
419
    JSONArray jsonEnabled = object.getJSONArray("enabledAxis");
420
    int numFace = jsonEnabled.length();
421

    
422
    mEnabled = new int[numFace][][];
423

    
424
    for(int i=0; i<numFace; i++)
425
      {
426
      JSONArray jsonSection = jsonEnabled.getJSONArray(i);
427
      int numSection = jsonSection.length();
428
      mEnabled[i] = new int[numSection][];
429

    
430
      for(int j=0; j<numSection; j++)
431
        {
432
        JSONArray jsonAx = jsonSection.getJSONArray(j);
433
        int numAxis = jsonAx.length();
434
        mEnabled[i][j] = new int[numAxis];
435
        for(int k=0; k<numAxis; k++) mEnabled[i][j][k] = jsonAx.getInt(k);
436
        }
437
      }
438

    
439
    try
440
      {
441
      JSONArray jsonDist = object.getJSONArray("dist3D");
442
      mNumFaces = jsonDist.length();
443
      mDist3D = new float[mNumFaces];
444
      for(int j=0; j<mNumFaces; j++) mDist3D[j] = (float)jsonDist.getDouble(j);
445
      }
446
    catch( JSONException ex )
447
      {
448
      switch(mMovementType)
449
        {
450
        case Movement.MOVEMENT_TETRAHEDRON : mNumFaces = 4; break;
451
        case Movement.MOVEMENT_HEXAHEDRON  : mNumFaces = 6; break;
452
        case Movement.MOVEMENT_OCTAHEDRON  : mNumFaces = 8; break;
453
        case Movement.MOVEMENT_DODECAHEDRON: mNumFaces =12; break;
454
        default                            : android.util.Log.e("D", "Error in parseTouchcontrol");
455
        }
456
      }
457
    }
458

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

    
461
  private void parseColors(JSONArray object) throws JSONException
462
    {
463
    mNumFaceColors = object.length();
464
    mColor = new int[mNumFaceColors];
465
    for(int i=0; i<mNumFaceColors; i++) mColor[i] = object.getInt(i);
466
    }
467

    
468
///////////////////////////////////////////////////////////////////////////////////////////////////
469

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

    
488
///////////////////////////////////////////////////////////////////////////////////////////////////
489

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

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

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

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

    
524
///////////////////////////////////////////////////////////////////////////////////////////////////
525

    
526
  public ScrambleState[] getScrambleStates()
527
    {
528
    return mStates;
529
    }
530

    
531
///////////////////////////////////////////////////////////////////////////////////////////////////
532

    
533
  public int[] getSolvedQuats(int cubit)
534
    {
535
    return mSolvedQuats[cubit];
536
    }
537

    
538
///////////////////////////////////////////////////////////////////////////////////////////////////
539

    
540
  public Static4D[] getQuats()
541
    {
542
    return mQuats;
543
    }
544

    
545
///////////////////////////////////////////////////////////////////////////////////////////////////
546

    
547
  public int getSolvedFunctionIndex()
548
    {
549
    return mSolvedFuncIndex;
550
    }
551

    
552
///////////////////////////////////////////////////////////////////////////////////////////////////
553

    
554
  public int getNumStickerTypes()
555
    {
556
    return mNumStickerTypes;
557
    }
558

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

    
561
  public float[][] getCuts()
562
    {
563
    return mCuts;
564
    }
565

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

    
568
  public boolean[][] getLayerRotatable()
569
    {
570
    return mLayerRotatable;
571
    }
572

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

    
575
  public int getMovementType()
576
    {
577
    return mMovementType;
578
    }
579

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

    
582
  public int getMovementSplit()
583
    {
584
    return mMovementSplit;
585
    }
586

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

    
589
  public int[][][] getEnabled()
590
    {
591
    return mEnabled;
592
    }
593

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

    
596
  public float[] getDist3D()
597
    {
598
    return mDist3D;
599
    }
600

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

    
603
  public int getNumCubitFaces()
604
    {
605
    return mNumCubitFaces;
606
    }
607

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

    
610
  public float[][] getCubitPositions()
611
    {
612
    return mPositions;
613
    }
614

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

    
617
  public ObjectShape getObjectShape(int variant)
618
    {
619
    return mShapes[variant];
620
    }
621

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

    
624
  public Static4D getQuat(int cubit)
625
    {
626
    return mCubitQuats[cubit];
627
    }
628

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

    
631
  public int getNumCubitVariants()
632
    {
633
    return mNumCubitVariants;
634
    }
635

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

    
638
  public int getCubitVariant(int cubit)
639
    {
640
    return mCubitVariant[cubit];
641
    }
642

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

    
645
  public int getVariantFaceColor(int variant, int face)
646
    {
647
    int[] colors = mVariantFaceColor[variant];
648
    return colors.length>face ? colors[face] : -1;
649
    }
650

    
651
///////////////////////////////////////////////////////////////////////////////////////////////////
652

    
653
  public int getCubitFaceColor(int cubit, int face)
654
    {
655
    return mCubitFaceColor[cubit][face];
656
    }
657

    
658
///////////////////////////////////////////////////////////////////////////////////////////////////
659

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

    
665
///////////////////////////////////////////////////////////////////////////////////////////////////
666

    
667
  public Static3D[] getRotationAxis()
668
    {
669
    return mAxis;
670
    }
671

    
672
///////////////////////////////////////////////////////////////////////////////////////////////////
673

    
674
  public int[] getBasicAngle()
675
    {
676
    return mBasicAngle;
677
    }
678

    
679
///////////////////////////////////////////////////////////////////////////////////////////////////
680

    
681
  public ObjectType intGetObjectType()
682
    {
683
    return null;
684
    }
685

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

    
688
  public String getObjectName()
689
    {
690
    return mLongName;
691
    }
692

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

    
695
  public String getInventor()
696
    {
697
    return mInventor;
698
    }
699

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

    
702
  public int getYearOfInvention()
703
    {
704
    return mYearOfInvention;
705
    }
706

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

    
709
  public int getComplexity()
710
    {
711
    return mComplexity;
712
    }
713

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

    
716
  public int getNumFaces()
717
    {
718
    return mNumFaces;
719
    }
720

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

    
723
  public int getNumFaceColors()
724
    {
725
    return mNumFaceColors;
726
    }
727

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

    
730
  public int[] getNumLayers()
731
    {
732
    return mNumLayers;
733
    }
734

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

    
737
  public float getSize()
738
    {
739
    return mSize;
740
    }
741

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

    
744
  public int getScrambleType()
745
    {
746
    return mScrambleType;
747
    }
748

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

    
751
  public int getColor(int face)
752
    {
753
    return mColor[face];
754
    }
755
}
(1-1/2)