Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyBandagedGeneric.java @ a8295031

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.objectlib.objects;
21

    
22
import org.distorted.library.type.Static3D;
23
import org.distorted.library.type.Static4D;
24
import org.distorted.objectlib.helpers.ObjectSignature;
25
import org.distorted.objectlib.main.InitData;
26
import org.distorted.objectlib.scrambling.ScrambleState;
27

    
28
import java.io.InputStream;
29

    
30
///////////////////////////////////////////////////////////////////////////////////////////////////
31

    
32
public class TwistyBandagedGeneric extends TwistyBandagedAbstract
33
{
34
  public static final String OBJECT_NAME = "LOCAL_BANDAGED";
35
  private float[][] mPosition;
36
  private ObjectSignature mSignature;
37

    
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39

    
40
  public TwistyBandagedGeneric(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
41
    {
42
    super(data, meshState, iconMode, quat, move, scale, stream);
43
    }
44

    
45
///////////////////////////////////////////////////////////////////////////////////////////////////
46
// Computing scramble states of many a bandaged cubes takes way too long time and too much space.
47
// Return null here and turn to construction of scramble tables just-in-time.
48

    
49
  @Override
50
  public ScrambleState[] getScrambleStates()
51
    {
52
    return null;
53
    }
54

    
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

    
57
  @Override
58
  public int getScrambleType()
59
    {
60
    return 2;
61
    }
62

    
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64

    
65
  float[][] getPositions()
66
    {
67
    if( mPosition==null ) mPosition = getInitData().getPos();
68
    return mPosition;
69
    }
70

    
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72
// PUBLIC APi
73

    
74
  public String getShortName()
75
    {
76
    if( mSignature==null ) mSignature = getSignature();
77
    int[] numLayers = getNumLayers();
78
    int number = 100*numLayers[0]+10*numLayers[1]+numLayers[2];
79

    
80
    return number+"_"+mSignature.getString();
81
    }
82

    
83
///////////////////////////////////////////////////////////////////////////////////////////////////
84

    
85
  public ObjectSignature getSignature()
86
    {
87
    if( mSignature==null )
88
      {
89
      int[] numLayers = getNumLayers();
90
      mSignature = new ObjectSignature(numLayers[0],numLayers[1],numLayers[2],mPosition);
91
      }
92
    return mSignature;
93
    }
94

    
95
///////////////////////////////////////////////////////////////////////////////////////////////////
96

    
97
  public String getObjectName()
98
    {
99
    return OBJECT_NAME;
100
    }
101

    
102
///////////////////////////////////////////////////////////////////////////////////////////////////
103

    
104
  public String getInventor()
105
    {
106
    return "??";
107
    }
108

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

    
111
  public int getYearOfInvention()
112
    {
113
    return 0;
114
    }
115

    
116
///////////////////////////////////////////////////////////////////////////////////////////////////
117

    
118
  public int getComplexity()
119
    {
120
    return 4;
121
    }
122

    
123
///////////////////////////////////////////////////////////////////////////////////////////////////
124

    
125
  public String[][] getTutorials()
126
    {
127
    return null;
128
    }
129
}
(7-7/40)