Project

General

Profile

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

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

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, mShortName, mInventor;
68
  private String mSmallIcon, mMediumIcon, mBigIcon, mHugeIcon, mMeshFile;
69
  private int mYearOfInvention, mComplexity;
70
  private int[] mNumLayers;
71
  private float mSize;
72
  private int mNumScrambles, mScrambleType;
73
  private int[] mColor;
74

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

    
77
  private JsonReader()
78
    {
79

    
80
    }
81

    
82
///////////////////////////////////////////////////////////////////////////////////////////////////
83

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

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

    
92
  private void parseMetadata(JSONObject object) throws JSONException
93
    {
94
    mLongName        = object.getString("longname");
95
    mShortName       = object.getString("shortname");
96
    mInventor        = object.getString("inventor");
97
    mYearOfInvention = object.getInt("year");
98
    mComplexity      = object.getInt("complexity");
99
    mSmallIcon       = object.getString("icon_small");
100
    mMediumIcon      = object.getString("icon_medium");
101
    mBigIcon         = object.getString("icon_big");
102
    mHugeIcon        = object.getString("icon_huge");
103
    mMeshFile        = object.getString("mesh");
104
    mNumScrambles    = object.getInt("num_scrambles");
105
    mSize            = (float)object.getDouble("size");
106
    mSolvedFuncIndex = object.getInt("solved_func");
107
    }
108

    
109
///////////////////////////////////////////////////////////////////////////////////////////////////
110

    
111
  private void parseCubits(JSONArray object) throws JSONException
112
    {
113
    int numCubits = object.length();
114

    
115
    mCubitQuats     = new Static4D[numCubits];
116
    mCubitVariant   = new int[numCubits];
117
    mPositions      = new float[numCubits][];
118
    mCubitFaceColor = new int[numCubits][];
119
    mSolvedQuats    = new int[numCubits][];
120

    
121
    for(int i=0; i<numCubits; i++)
122
      {
123
      JSONObject jsonCubit = object.getJSONObject(i);
124

    
125
      float qx = (float)jsonCubit.getDouble("qx");
126
      float qy = (float)jsonCubit.getDouble("qy");
127
      float qz = (float)jsonCubit.getDouble("qz");
128
      float qw = (float)jsonCubit.getDouble("qw");
129

    
130
      mCubitQuats[i] = new Static4D(qx,qy,qz,qw);
131
      mCubitVariant[i] = jsonCubit.getInt("variant");
132

    
133
      JSONArray jsonCenter = jsonCubit.getJSONArray("centers");
134
      int numCenter = jsonCenter.length();
135
      mPositions[i] = new float[numCenter];
136
      for(int j=0; j<numCenter; j++) mPositions[i][j] = (float)jsonCenter.getDouble(j);
137

    
138
      JSONArray jsonColor  = jsonCubit.getJSONArray("colors");
139
      int numColor = jsonColor.length();
140
      mCubitFaceColor[i] = new int[numColor];
141
      for(int j=0; j<numColor; j++) mCubitFaceColor[i][j] = jsonColor.getInt(j);
142

    
143
      try
144
        {
145
        JSONArray jsonSolved = jsonCubit.getJSONArray("solvedQuats");
146
        int numSolved = jsonSolved.length();
147
        mSolvedQuats[i] = new int[numSolved];
148
        for(int j=0; j<numSolved; j++) mSolvedQuats[i][j] = jsonSolved.getInt(j);
149
        }
150
      catch( JSONException ex )
151
        {
152
        // ignore
153
        }
154
      }
155
    }
156

    
157
///////////////////////////////////////////////////////////////////////////////////////////////////
158

    
159
  private void parseShapes(JSONArray object) throws JSONException
160
    {
161
    mNumCubitVariants = object.length();
162
    mVariantFaceColor = new int[mNumCubitVariants][];
163
    mShapes = new ObjectShape[mNumCubitVariants];
164
    double[][][] verts = new double[mNumCubitVariants][][];
165
    int[][] cornerIndices = new int[mNumCubitVariants][];
166
    int[][] centerIndices = new int[mNumCubitVariants][];
167
    int[][] bandIndices = new int[mNumCubitVariants][];
168
    int[][][] vertIndices = new int[mNumCubitVariants][][];
169
    float[][][] bands = new float[mNumCubitVariants][][];
170
    float[][][] corners = new float[mNumCubitVariants][][];
171
    float[][][] centers = new float[mNumCubitVariants][][];
172
    float[][] convexity = new float[mNumCubitVariants][];
173

    
174
    mNumCubitFaces = -1;
175

    
176
    for(int i=0; i<mNumCubitVariants; i++)
177
      {
178
      JSONObject jsonShape = object.getJSONObject(i);
179

    
180
      ////// vertices /////////////////////////////////////////////////
181
      JSONArray jsonVertices= jsonShape.getJSONArray("vertices");
182
      int numVertices = jsonVertices.length();
183
      verts[i] = new double[numVertices][3];
184
      cornerIndices[i] = new int[numVertices];
185
      centerIndices[i] = new int[numVertices];
186

    
187
      for(int j=0; j<numVertices; j++)
188
        {
189
        JSONObject vert = jsonVertices.getJSONObject(j);
190
        verts[i][j][0] = vert.getDouble("x");
191
        verts[i][j][1] = vert.getDouble("y");
192
        verts[i][j][2] = vert.getDouble("z");
193
        cornerIndices[i][j] = vert.getInt("cornerIndex");
194
        centerIndices[i][j] = vert.getInt("centerIndex");
195
        }
196

    
197
      ////// faces ////////////////////////////////////////////////////
198
      JSONArray jsonFaces= jsonShape.getJSONArray("faces");
199
      int numFaces = jsonFaces.length();
200
      mVariantFaceColor[i] = new int[numFaces];
201
      bandIndices[i] = new int[numFaces];
202
      vertIndices[i] = new int[numFaces][];
203

    
204
      if( mNumCubitFaces<numFaces ) mNumCubitFaces=numFaces;
205

    
206
      for(int j=0; j<numFaces; j++)
207
        {
208
        JSONObject jsonFace = jsonFaces.getJSONObject(j);
209
        mVariantFaceColor[i][j] = jsonFace.getInt("sticker");
210
        bandIndices[i][j] = jsonFace.getInt("bandIndex");
211
        JSONArray vertices = jsonFace.getJSONArray("vertexIndices");
212
        int numV = vertices.length();
213
        vertIndices[i][j] = new int[numV];
214
        for(int k=0; k<numV; k++) vertIndices[i][j][k] = vertices.getInt(k);
215
        }
216

    
217
      ////// bands ////////////////////////////////////////////////////
218
      JSONArray jsonBands= jsonShape.getJSONArray("bands");
219
      int numBands = jsonBands.length();
220
      bands[i] = new float[numBands][7];
221

    
222
      for(int j=0; j<numBands; j++)
223
        {
224
        JSONObject jsonBand = jsonBands.getJSONObject(j);
225

    
226
        bands[i][j][0] = (float)jsonBand.getDouble("height");
227
        bands[i][j][1] = (float)jsonBand.getDouble("angle");
228
        bands[i][j][2] = (float)jsonBand.getDouble("distanceToCenter");
229
        bands[i][j][3] = (float)jsonBand.getDouble("distanceToFlat");
230
        bands[i][j][4] = (float)jsonBand.getDouble("numOfBands");
231
        bands[i][j][5] = (float)jsonBand.getDouble("extraI");
232
        bands[i][j][6] = (float)jsonBand.getDouble("extraJ");
233
        }
234

    
235
      ////// cornerPush ///////////////////////////////////////////////
236
      JSONArray jsonCornerPush= jsonShape.optJSONArray("cornerPush");
237

    
238
      if( jsonCornerPush!=null )
239
        {
240
        int numCornerP = jsonCornerPush.length();
241
        corners[i] = new float[numCornerP][2];
242

    
243
        for(int j=0; j<numCornerP; j++)
244
          {
245
          JSONObject jsonC = jsonCornerPush.getJSONObject(j);
246
          corners[i][j][0] = (float)jsonC.getDouble("strength");
247
          corners[i][j][1] = (float)jsonC.getDouble("radius");
248
          }
249
        }
250

    
251
      ////// centerPush ///////////////////////////////////////////////
252
      JSONArray jsonCenterPush= jsonShape.optJSONArray("centerPush");
253

    
254
      if( jsonCenterPush!=null )
255
        {
256
        int numCenterP = jsonCenterPush.length();
257
        centers[i] = new float[numCenterP][3];
258

    
259
        for(int j=0; j<numCenterP; j++)
260
          {
261
          JSONObject jsonC = jsonCenterPush.getJSONObject(j);
262
          centers[i][j][0] = (float)jsonC.getDouble("x");
263
          centers[i][j][1] = (float)jsonC.getDouble("y");
264
          centers[i][j][2] = (float)jsonC.getDouble("z");
265
          }
266
        }
267

    
268
      ////// convexity ///////////////////////////////////////////////
269
      JSONObject jsonConvexity = jsonShape.optJSONObject("convexity");
270

    
271
      if( jsonConvexity!=null )
272
        {
273
        convexity[i] = new float[3];
274
        convexity[i][0] = (float)jsonConvexity.getDouble("x");
275
        convexity[i][1] = (float)jsonConvexity.getDouble("y");
276
        convexity[i][2] = (float)jsonConvexity.getDouble("z");
277
        }
278
      }
279

    
280
    for(int i=0; i<mNumCubitVariants; i++)
281
      {
282
      mShapes[i] = new ObjectShape(verts[i],vertIndices[i],bands[i],bandIndices[i],corners[i],
283
                                   cornerIndices[i],centers[i],centerIndices[i],mNumCubitFaces, convexity[i]);
284
      }
285
    }
286

    
287
///////////////////////////////////////////////////////////////////////////////////////////////////
288

    
289
  private void parseStickers(JSONArray object) throws JSONException
290
    {
291
    mNumStickerTypes = object.length();
292
    mObjectSticker = new ObjectSticker[mNumStickerTypes];
293

    
294
    for(int i=0; i<mNumStickerTypes; i++)
295
      {
296
      JSONObject sticker = object.getJSONObject(i);
297
      float stroke = (float)sticker.getDouble("stroke");
298
      JSONArray vertices = sticker.getJSONArray("vertices");
299
      int numVertices = vertices.length();
300

    
301
      float[] coords     = new float[2*numVertices];
302
      float[] curvatures = new float[numVertices];
303
      float[] radii      = new float[numVertices];
304

    
305
      for(int j=0; j<numVertices; j++)
306
        {
307
        JSONObject vertex = vertices.getJSONObject(j);
308

    
309
        coords[2*j  ] = (float)vertex.getDouble("x");
310
        coords[2*j+1] = (float)vertex.getDouble("y");
311
        curvatures[j] = (float)vertex.getDouble("angle");
312
        radii[j]      = (float)vertex.getDouble("radius");
313
        }
314

    
315
      mObjectSticker[i] = new ObjectSticker(coords,curvatures,radii,stroke);
316
      }
317
    }
318

    
319
///////////////////////////////////////////////////////////////////////////////////////////////////
320

    
321
  private void parseMesh(JSONObject object) throws JSONException
322
    {
323
    JSONArray cubits   = object.getJSONArray("cubits");
324
    parseCubits(cubits);
325
    JSONArray shapes   = object.getJSONArray("shapes");
326
    parseShapes(shapes);
327
    JSONArray stickers = object.getJSONArray("stickers");
328
    parseStickers(stickers);
329
    }
330

    
331
///////////////////////////////////////////////////////////////////////////////////////////////////
332

    
333
  private void parseAxis(JSONArray object) throws JSONException
334
    {
335
    int numAxis = object.length();
336

    
337
    mBasicAngle     = new int[numAxis];
338
    mAxis           = new Static3D[numAxis];
339
    mCuts           = new float[numAxis][];
340
    mLayerRotatable = new boolean[numAxis][];
341
    mNumLayers      = new int[numAxis];
342

    
343
    for(int i=0; i<numAxis; i++)
344
      {
345
      JSONObject jsonAx = object.getJSONObject(i);
346

    
347
      mBasicAngle[i] = jsonAx.getInt("basicAngle");
348

    
349
      float x = (float)jsonAx.getDouble("x");
350
      float y = (float)jsonAx.getDouble("y");
351
      float z = (float)jsonAx.getDouble("z");
352

    
353
      mAxis[i] = new Static3D(x,y,z);
354

    
355
      JSONArray jsonCuts = jsonAx.getJSONArray("cuts");
356
      int numCuts = jsonCuts.length();
357
      mCuts[i] = new float[numCuts];
358
      for(int j=0; j<numCuts; j++) mCuts[i][j] = (float)jsonCuts.getDouble(j);
359

    
360
      JSONArray jsonRota = jsonAx.getJSONArray("rotatable");
361
      int numRota = jsonRota.length();
362
      mLayerRotatable[i] = new boolean[numRota];
363
      for(int j=0; j<numRota; j++) mLayerRotatable[i][j] = jsonRota.getBoolean(j);
364

    
365
      mNumLayers[i] = numRota;
366
      }
367
    }
368

    
369
///////////////////////////////////////////////////////////////////////////////////////////////////
370

    
371
  private void parseQuats(JSONArray object) throws JSONException
372
    {
373
    int numQuats = object.length();
374
    mQuats = new Static4D[numQuats];
375

    
376
    for(int i=0; i<numQuats; i++)
377
      {
378
      JSONObject jsonQuat = object.getJSONObject(i);
379

    
380
      float x = (float)jsonQuat.getDouble("x");
381
      float y = (float)jsonQuat.getDouble("y");
382
      float z = (float)jsonQuat.getDouble("z");
383
      float w = (float)jsonQuat.getDouble("w");
384

    
385
      mQuats[i] = new Static4D(x,y,z,w);
386
      }
387
    }
388

    
389
///////////////////////////////////////////////////////////////////////////////////////////////////
390

    
391
  private void parseScrambling(JSONObject object) throws JSONException
392
    {
393
    mScrambleType = object.getInt("scrambleType");
394

    
395
    if( mScrambleType==0 )
396
      {
397
      JSONArray jsonStates = object.getJSONArray("scrambleStates");
398
      int numStates = jsonStates.length();
399
      mStates = new ScrambleState[numStates];
400

    
401
      for(int i=0; i<numStates; i++)
402
        {
403
        JSONArray jsonState = jsonStates.getJSONArray(i);
404
        int numAxis = jsonState.length();
405
        int[][] scramblingData = new int[numAxis][];
406

    
407
        for(int j=0; j<numAxis; j++)
408
          {
409
          JSONArray jsonData = jsonState.getJSONArray(j);
410
          int numData = jsonData.length();
411
          scramblingData[j] = new int[numData];
412
          for(int k=0; k<numData; k++) scramblingData[j][k] = jsonData.getInt(k);
413
          }
414

    
415
        mStates[i] = new ScrambleState(scramblingData);
416
        }
417
      }
418
    }
419

    
420
///////////////////////////////////////////////////////////////////////////////////////////////////
421

    
422
  private void parseTouchcontrol(JSONObject object) throws JSONException
423
    {
424
    mMovementType = object.getInt("movementType");
425
    mMovementSplit= object.getInt("movementSplit");
426

    
427
    JSONArray jsonEnabled = object.getJSONArray("enabledAxis");
428
    int numFace = jsonEnabled.length();
429

    
430
    mEnabled = new int[numFace][][];
431

    
432
    for(int i=0; i<numFace; i++)
433
      {
434
      JSONArray jsonSection = jsonEnabled.getJSONArray(i);
435
      int numSection = jsonSection.length();
436
      mEnabled[i] = new int[numSection][];
437

    
438
      for(int j=0; j<numSection; j++)
439
        {
440
        JSONArray jsonAx = jsonSection.getJSONArray(j);
441
        int numAxis = jsonAx.length();
442
        mEnabled[i][j] = new int[numAxis];
443
        for(int k=0; k<numAxis; k++) mEnabled[i][j][k] = jsonAx.getInt(k);
444
        }
445
      }
446

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

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

    
469
  private void parseColors(JSONArray object) throws JSONException
470
    {
471
    mNumFaceColors = object.length();
472
    mColor = new int[mNumFaceColors];
473
    for(int i=0; i<mNumFaceColors; i++) mColor[i] = object.getInt(i);
474
    }
475

    
476
///////////////////////////////////////////////////////////////////////////////////////////////////
477

    
478
  private void parseVersion1(JSONObject object) throws JSONException
479
    {
480
    JSONObject metadata    = object.getJSONObject("metadata");
481
    parseMetadata(metadata);
482
    JSONObject mesh        = object.getJSONObject("mesh");
483
    parseMesh(mesh);
484
    JSONArray axis         = object.getJSONArray("axis");
485
    parseAxis(axis);
486
    JSONArray quats        = object.getJSONArray("quats");
487
    parseQuats(quats);
488
    JSONObject scrambling  = object.getJSONObject("scrambling");
489
    parseScrambling(scrambling);
490
    JSONObject touchcontrol= object.getJSONObject("touchcontrol");
491
    parseTouchcontrol(touchcontrol);
492
    JSONArray colors       = object.getJSONArray("colors");
493
    parseColors(colors);
494
    }
495

    
496
///////////////////////////////////////////////////////////////////////////////////////////////////
497

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

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

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

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

    
532
///////////////////////////////////////////////////////////////////////////////////////////////////
533

    
534
  public ScrambleState[] getScrambleStates()
535
    {
536
    return mStates;
537
    }
538

    
539
///////////////////////////////////////////////////////////////////////////////////////////////////
540

    
541
  public int[] getSolvedQuats(int cubit)
542
    {
543
    return mSolvedQuats[cubit];
544
    }
545

    
546
///////////////////////////////////////////////////////////////////////////////////////////////////
547

    
548
  public Static4D[] getQuats()
549
    {
550
    return mQuats;
551
    }
552

    
553
///////////////////////////////////////////////////////////////////////////////////////////////////
554

    
555
  public int getSolvedFunctionIndex()
556
    {
557
    return mSolvedFuncIndex;
558
    }
559

    
560
///////////////////////////////////////////////////////////////////////////////////////////////////
561

    
562
  public int getNumStickerTypes()
563
    {
564
    return mNumStickerTypes;
565
    }
566

    
567
///////////////////////////////////////////////////////////////////////////////////////////////////
568

    
569
  public float[][] getCuts()
570
    {
571
    return mCuts;
572
    }
573

    
574
///////////////////////////////////////////////////////////////////////////////////////////////////
575

    
576
  public boolean[][] getLayerRotatable()
577
    {
578
    return mLayerRotatable;
579
    }
580

    
581
///////////////////////////////////////////////////////////////////////////////////////////////////
582

    
583
  public int getMovementType()
584
    {
585
    return mMovementType;
586
    }
587

    
588
///////////////////////////////////////////////////////////////////////////////////////////////////
589

    
590
  public int getMovementSplit()
591
    {
592
    return mMovementSplit;
593
    }
594

    
595
///////////////////////////////////////////////////////////////////////////////////////////////////
596

    
597
  public int[][][] getEnabled()
598
    {
599
    return mEnabled;
600
    }
601

    
602
///////////////////////////////////////////////////////////////////////////////////////////////////
603

    
604
  public float[] getDist3D()
605
    {
606
    return mDist3D;
607
    }
608

    
609
///////////////////////////////////////////////////////////////////////////////////////////////////
610

    
611
  public int getNumCubitFaces()
612
    {
613
    return mNumCubitFaces;
614
    }
615

    
616
///////////////////////////////////////////////////////////////////////////////////////////////////
617

    
618
  public float[][] getCubitPositions()
619
    {
620
    return mPositions;
621
    }
622

    
623
///////////////////////////////////////////////////////////////////////////////////////////////////
624

    
625
  public ObjectShape getObjectShape(int variant)
626
    {
627
    return mShapes[variant];
628
    }
629

    
630
///////////////////////////////////////////////////////////////////////////////////////////////////
631

    
632
  public Static4D getQuat(int cubit)
633
    {
634
    return mCubitQuats[cubit];
635
    }
636

    
637
///////////////////////////////////////////////////////////////////////////////////////////////////
638

    
639
  public int getNumCubitVariants()
640
    {
641
    return mNumCubitVariants;
642
    }
643

    
644
///////////////////////////////////////////////////////////////////////////////////////////////////
645

    
646
  public int getCubitVariant(int cubit)
647
    {
648
    return mCubitVariant[cubit];
649
    }
650

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

    
653
  public int getVariantFaceColor(int variant, int face)
654
    {
655
    int[] colors = mVariantFaceColor[variant];
656
    return colors.length>face ? colors[face] : -1;
657
    }
658

    
659
///////////////////////////////////////////////////////////////////////////////////////////////////
660

    
661
  public int getCubitFaceColor(int cubit, int face)
662
    {
663
    return mCubitFaceColor[cubit][face];
664
    }
665

    
666
///////////////////////////////////////////////////////////////////////////////////////////////////
667

    
668
  public ObjectSticker retSticker(int sticker)
669
    {
670
    return mObjectSticker[sticker];
671
    }
672

    
673
///////////////////////////////////////////////////////////////////////////////////////////////////
674

    
675
  public Static3D[] getRotationAxis()
676
    {
677
    return mAxis;
678
    }
679

    
680
///////////////////////////////////////////////////////////////////////////////////////////////////
681

    
682
  public int[] getBasicAngle()
683
    {
684
    return mBasicAngle;
685
    }
686

    
687
///////////////////////////////////////////////////////////////////////////////////////////////////
688

    
689
  public ObjectType intGetObjectType()
690
    {
691
    return ObjectType.TEST;
692
    }
693

    
694
///////////////////////////////////////////////////////////////////////////////////////////////////
695

    
696
  public String getShortName()
697
    {
698
    return mShortName;
699
    }
700

    
701
///////////////////////////////////////////////////////////////////////////////////////////////////
702

    
703
  public String getObjectName()
704
    {
705
    return mLongName;
706
    }
707

    
708
///////////////////////////////////////////////////////////////////////////////////////////////////
709

    
710
  public String getInventor()
711
    {
712
    return mInventor;
713
    }
714

    
715
///////////////////////////////////////////////////////////////////////////////////////////////////
716

    
717
  public int getYearOfInvention()
718
    {
719
    return mYearOfInvention;
720
    }
721

    
722
///////////////////////////////////////////////////////////////////////////////////////////////////
723

    
724
  public int getComplexity()
725
    {
726
    return mComplexity;
727
    }
728

    
729
///////////////////////////////////////////////////////////////////////////////////////////////////
730

    
731
  public int getNumFaces()
732
    {
733
    return mNumFaces;
734
    }
735

    
736
///////////////////////////////////////////////////////////////////////////////////////////////////
737

    
738
  public int getNumFaceColors()
739
    {
740
    return mNumFaceColors;
741
    }
742

    
743
///////////////////////////////////////////////////////////////////////////////////////////////////
744

    
745
  public int[] getNumLayers()
746
    {
747
    return mNumLayers;
748
    }
749

    
750
///////////////////////////////////////////////////////////////////////////////////////////////////
751

    
752
  public float getSize()
753
    {
754
    return mSize;
755
    }
756

    
757
///////////////////////////////////////////////////////////////////////////////////////////////////
758

    
759
  public int getNumScrambles()
760
    {
761
    return mNumScrambles;
762
    }
763

    
764
///////////////////////////////////////////////////////////////////////////////////////////////////
765

    
766
  public int getScrambleType()
767
    {
768
    return mScrambleType;
769
    }
770

    
771
///////////////////////////////////////////////////////////////////////////////////////////////////
772

    
773
  public int getColor(int face)
774
    {
775
    return mColor[face];
776
    }
777
}
(1-1/2)