Project

General

Profile

Download (4.37 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / objects / RubikObject.java @ 6e3fcb91

1 a7d8c3cd Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube 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
// Magic Cube 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 Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20
package org.distorted.objects;
21
22
import org.distorted.dmesh.ObjectMesh;
23
import org.distorted.jsons.ObjectJson;
24
import org.distorted.objectlib.main.ObjectType;
25
import org.distorted.patterns.RubikPatternList;
26
27 09cf2a36 Leszek Koltunski
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
28 f12e4de9 Leszek Koltunski
29 d433b50e Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
30
31 a7d8c3cd Leszek Koltunski
public class RubikObject
32
{
33
  private final String mName;
34
  private final int mNumScramble;
35
  private final int mOrdinal;
36
  private final int mJsonID, mMeshID;
37 6e3fcb91 Leszek Koltunski
  private final int mIconID;
38 a7d8c3cd Leszek Koltunski
  private final String[][] mPatterns;
39
40 f12e4de9 Leszek Koltunski
  private int mMeshState;
41
42 a7d8c3cd Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
43
44 d433b50e Leszek Koltunski
  RubikObject(ObjectType type)
45 a7d8c3cd Leszek Koltunski
    {
46 6e3fcb91 Leszek Koltunski
    mIconID      = type.getIconID();
47 a7d8c3cd Leszek Koltunski
    mName        = type.name();
48
    mNumScramble = type.getNumScramble();
49 d433b50e Leszek Koltunski
    mOrdinal     = type.ordinal();
50
    mJsonID      = ObjectJson.getJsonID(mOrdinal);
51
    mMeshID      = ObjectMesh.getMeshID(mOrdinal);
52 a7d8c3cd Leszek Koltunski
53 d433b50e Leszek Koltunski
    int patternOrdinal  = RubikPatternList.getOrdinal(mOrdinal);
54 a7d8c3cd Leszek Koltunski
    mPatterns = RubikPatternList.getPatterns(patternOrdinal);
55 f12e4de9 Leszek Koltunski
56
    mMeshState = MESH_NICE;
57
    }
58
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60
61
  public void setMeshState(int state)
62
    {
63
    mMeshState = state;
64
    }
65
66
///////////////////////////////////////////////////////////////////////////////////////////////////
67
68
  public int getMeshState()
69
    {
70
    return mMeshState;
71 a7d8c3cd Leszek Koltunski
    }
72
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74
// PUBLIC API
75
76
  public String getName()
77
    {
78
    return mName;
79
    }
80
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82
83 6e3fcb91 Leszek Koltunski
  public int getIconID()
84 a7d8c3cd Leszek Koltunski
    {
85 6e3fcb91 Leszek Koltunski
    return mIconID;
86 a7d8c3cd Leszek Koltunski
    }
87
88
///////////////////////////////////////////////////////////////////////////////////////////////////
89
90
  public int getNumScramble()
91
    {
92
    return mNumScramble;
93
    }
94
95
///////////////////////////////////////////////////////////////////////////////////////////////////
96
97
  public int getOrdinal()
98
    {
99
    return mOrdinal;
100
    }
101
102
///////////////////////////////////////////////////////////////////////////////////////////////////
103
104
  public int getJsonID()
105
    {
106
    return mJsonID;
107
    }
108
109
///////////////////////////////////////////////////////////////////////////////////////////////////
110
111
  public int getMeshID()
112
    {
113
    return mMeshID;
114
    }
115
116
///////////////////////////////////////////////////////////////////////////////////////////////////
117
118
  public String[][] getPatterns()
119
    {
120
    return mPatterns;
121
    }
122
}