Project

General

Profile

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

magiccube / src / main / java / org / distorted / magic / RubikSize.java @ f3e12931

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 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.magic;
21

    
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

    
24
public enum RubikSize
25
  {
26
  SIZE2 ( 2, R.drawable.button2 ),
27
  SIZE3 ( 3, R.drawable.button3 ),
28
  SIZE4 ( 4, R.drawable.button4 ),
29
  SIZE5 ( 5, R.drawable.button5 ),
30
  ;
31

    
32
  static final int DEFAULT_SIZE  = 3;
33
  static final int LENGTH = values().length;
34
  private final int mCubeSize, mIconID;
35
  private static final RubikSize[] sizes;
36

    
37
  static
38
    {
39
    int i = 0;
40
    sizes = new RubikSize[LENGTH];
41

    
42
    for(RubikSize size: RubikSize.values())
43
      {
44
      sizes[i] = size;
45
      i++;
46
      }
47
    }
48

    
49
///////////////////////////////////////////////////////////////////////////////////////////////////
50

    
51
  static RubikSize getSize(int ordinal)
52
    {
53
    return sizes[ordinal];
54
    }
55

    
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57

    
58
  RubikSize(int size, int iconID)
59
    {
60
    mCubeSize = size;
61
    mIconID   = iconID;
62
    }
63

    
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65

    
66
  int getIconID()
67
    {
68
    return mIconID;
69
    }
70

    
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72

    
73
  int getCubeSize()
74
    {
75
    return mCubeSize;
76
    }
77
  }
(9-9/10)