Project

General

Profile

« Previous | Next » 

Revision c0266cb1

Added by Leszek Koltunski about 1 year ago

Tablebase-based scrambling.

View differences:

src/main/java/org/distorted/objectlib/tablebases/ImplementedTablebasesList.java
11 11

  
12 12
import android.content.res.Resources;
13 13

  
14
import org.distorted.objectlib.main.ObjectType;
14
import org.distorted.objectlib.main.ObjectSignatures;
15 15

  
16 16
import java.lang.reflect.Constructor;
17 17
import java.lang.reflect.InvocationTargetException;
......
20 20

  
21 21
public enum ImplementedTablebasesList
22 22
{
23
  PYRAMINX_DUO  (ObjectType.PDUO_2, TablebasesPyraminxDuo.class),
24
  IVY_CUBE      (ObjectType.IVY_2 , TablebasesIvyCube.class),
25
  CU_232        (ObjectType.CU_232, TablebasesCuboid232.class),
26
  PYRA_3        (ObjectType.PYRA_3, TablebasesPyraminx.class),
27
  DIAMOND       (ObjectType.DIAM_2, TablebasesSkewbDiamond.class),
23
  PYRAMINX_DUO  (ObjectSignatures.PDUO_2, TablebasesPyraminxDuo.class),
24
  IVY_CUBE      (ObjectSignatures.IVY_2 , TablebasesIvyCube.class),
25
  CU_232        (ObjectSignatures.CU_232, TablebasesCuboid232.class),
26
  PYRA_3        (ObjectSignatures.PYRA_3, TablebasesPyraminx.class),
27
  DIAMOND       (ObjectSignatures.DIAM_2, TablebasesSkewbDiamond.class),
28 28
  ;
29 29

  
30 30
  public static final int NUM_OBJECTS = values().length;
31 31

  
32
  private final ObjectType mType;
32
  private final int mSignature;
33 33
  private final Class<? extends TablebasesAbstract> mClass;
34 34

  
35 35
  private static final ImplementedTablebasesList[] objects;
......
47 47

  
48 48
///////////////////////////////////////////////////////////////////////////////////////////////////
49 49

  
50
  public static boolean hasTablebase(ObjectType type)
50
  public static boolean hasTablebase(int signature)
51 51
    {
52 52
    for(int i=0; i<NUM_OBJECTS; i++)
53
      if( objects[i].mType == type ) return true;
53
      if( objects[i].mSignature == signature ) return true;
54 54

  
55 55
    return false;
56 56
    }
57 57

  
58 58
///////////////////////////////////////////////////////////////////////////////////////////////////
59 59

  
60
  ImplementedTablebasesList(ObjectType type, final Class<? extends TablebasesAbstract> clazz)
60
  ImplementedTablebasesList(int sig, final Class<? extends TablebasesAbstract> clazz)
61 61
    {
62
    mType = type;
62
    mSignature = sig;
63 63
    mClass= clazz;
64 64
    }
65 65

  
66 66
///////////////////////////////////////////////////////////////////////////////////////////////////
67 67

  
68
  public ObjectType getType()
68
  public int getSignature()
69 69
    {
70
    return mType;
70
    return mSignature;
71 71
    }
72 72

  
73 73
///////////////////////////////////////////////////////////////////////////////////////////////////
74 74

  
75
  public static TablebasesAbstract createPacked(Resources res, ObjectType type)
75
  public static TablebasesAbstract createPacked(Resources res, int signature)
76 76
    {
77 77
    Class<? extends TablebasesAbstract> clazz=null;
78 78

  
79 79
    for(int i=0; i<NUM_OBJECTS; i++)
80
      if( objects[i].mType == type )
80
      if( objects[i].mSignature == signature )
81 81
        {
82 82
        clazz = objects[i].mClass;
83 83
        break;
......
117 117

  
118 118
///////////////////////////////////////////////////////////////////////////////////////////////////
119 119

  
120
  public static TablebasesAbstract createUnpacked(ObjectType type)
120
  public static TablebasesAbstract createUnpacked(int signatures)
121 121
    {
122 122
    Class<? extends TablebasesAbstract> clazz=null;
123 123

  
124 124
    for(int i=0; i<NUM_OBJECTS; i++)
125
      if( objects[i].mType == type )
125
      if( objects[i].mSignature == signatures )
126 126
        {
127 127
        clazz = objects[i].mClass;
128 128
        break;

Also available in: Unified diff