1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
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
|
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
|
28
|
|
29
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
30
|
|
31
|
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
|
private final int mIconID;
|
38
|
private final String[][] mPatterns;
|
39
|
|
40
|
private int mMeshState;
|
41
|
|
42
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
43
|
|
44
|
RubikObject(ObjectType type)
|
45
|
{
|
46
|
mIconID = type.getIconID();
|
47
|
mName = type.name();
|
48
|
mNumScramble = type.getNumScramble();
|
49
|
mOrdinal = type.ordinal();
|
50
|
mJsonID = ObjectJson.getJsonID(mOrdinal);
|
51
|
mMeshID = ObjectMesh.getMeshID(mOrdinal);
|
52
|
|
53
|
int patternOrdinal = RubikPatternList.getOrdinal(mOrdinal);
|
54
|
mPatterns = RubikPatternList.getPatterns(patternOrdinal);
|
55
|
|
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
|
}
|
72
|
|
73
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
74
|
// PUBLIC API
|
75
|
|
76
|
public String getName()
|
77
|
{
|
78
|
return mName;
|
79
|
}
|
80
|
|
81
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
82
|
|
83
|
public int getIconID()
|
84
|
{
|
85
|
return mIconID;
|
86
|
}
|
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
|
}
|