Project

General

Profile

« Previous | Next » 

Revision 1d581993

Added by Leszek Koltunski about 2 years ago

Introduce ObjectSignature that can incorporate 192-bit signatures (for 5x5x5 bandaged cubes).
ObjectScrambler does not fully work yet.

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyBandagedGeneric.java
21 21

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

  
26 27
import java.io.InputStream;
......
30 31
public class TwistyBandagedGeneric extends TwistyBandagedAbstract
31 32
{
32 33
  private static float[][] POS;
33
  private static long mSignature;
34
  private static ObjectSignature mSignature;
34 35

  
35 36
///////////////////////////////////////////////////////////////////////////////////////////////////
36 37

  
......
62 63
  public static void setPositions(float[][] positions)
63 64
    {
64 65
    POS = positions;
65
    mSignature = -1;
66
    mSignature = null;
66 67
    }
67 68

  
68 69
///////////////////////////////////////////////////////////////////////////////////////////////////
......
110 111

  
111 112
  public String getShortName()
112 113
    {
113
    if( mSignature<0 ) mSignature = getSignature();
114
    return ""+mSignature;
114
    if( mSignature==null ) mSignature = getSignature();
115
    int[] numLayers = getNumLayers();
116
    int number = 100*numLayers[0]+10*numLayers[1]+numLayers[0];
117

  
118
    return number+"_"+mSignature.getString();
115 119
    }
116 120

  
117 121
///////////////////////////////////////////////////////////////////////////////////////////////////
118 122

  
119
  public long getSignature()
123
  public ObjectSignature getSignature()
120 124
    {
121
    if( mSignature<0 )
125
    if( mSignature==null )
122 126
      {
123
      mSignature = 0;
124
      for(float[] pos : POS ) mSignature = markConnections(mSignature,pos);
127
      int[] numLayers = getNumLayers();
128
      mSignature = new ObjectSignature(numLayers[0],numLayers[1],numLayers[2],POS);
125 129
      }
126

  
127 130
    return mSignature;
128 131
    }
129 132

  

Also available in: Unified diff