Project

General

Profile

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

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

1 fdec60a3 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
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 dd73fdab Leszek Koltunski
public enum RubikSize
25 fdec60a3 Leszek Koltunski
  {
26 f3e12931 Leszek Koltunski
  SIZE2 ( 2, R.drawable.button2 ),
27
  SIZE3 ( 3, R.drawable.button3 ),
28
  SIZE4 ( 4, R.drawable.button4 ),
29
  SIZE5 ( 5, R.drawable.button5 ),
30 fdec60a3 Leszek Koltunski
  ;
31
32
  static final int LENGTH = values().length;
33 f3e12931 Leszek Koltunski
  private final int mCubeSize, mIconID;
34 dd73fdab Leszek Koltunski
  private static final RubikSize[] sizes;
35 fdec60a3 Leszek Koltunski
36
  static
37
    {
38
    int i = 0;
39 dd73fdab Leszek Koltunski
    sizes = new RubikSize[LENGTH];
40 fdec60a3 Leszek Koltunski
41 dd73fdab Leszek Koltunski
    for(RubikSize size: RubikSize.values())
42 fdec60a3 Leszek Koltunski
      {
43 dd73fdab Leszek Koltunski
      sizes[i] = size;
44 fdec60a3 Leszek Koltunski
      i++;
45
      }
46
    }
47
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49
50 dd73fdab Leszek Koltunski
  static RubikSize getSize(int ordinal)
51
    {
52
    return sizes[ordinal];
53
    }
54
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56
57 f3e12931 Leszek Koltunski
  RubikSize(int size, int iconID)
58 fdec60a3 Leszek Koltunski
    {
59 f3e12931 Leszek Koltunski
    mCubeSize = size;
60
    mIconID   = iconID;
61 fdec60a3 Leszek Koltunski
    }
62
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64
65 f3e12931 Leszek Koltunski
  int getIconID()
66 fdec60a3 Leszek Koltunski
    {
67
    return mIconID;
68
    }
69
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71
72 f3e12931 Leszek Koltunski
  int getCubeSize()
73 fdec60a3 Leszek Koltunski
    {
74 f3e12931 Leszek Koltunski
    return mCubeSize;
75 fdec60a3 Leszek Koltunski
    }
76
  }