Project

General

Profile

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

magiccube / src / main / java / org / distorted / magic / RubikSize.java @ 32f60dec

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 LENGTH = values().length;
33
  private final int mCubeSize, mIconID;
34
  private static final RubikSize[] sizes;
35

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

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

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

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

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

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

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

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

    
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71

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