Project

General

Profile

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

magiccube / src / main / java / org / distorted / object / RubikObject.java @ 0333d81e

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.object;
21

    
22
import org.distorted.magic.R;
23

    
24
///////////////////////////////////////////////////////////////////////////////////////////////////
25

    
26
public enum RubikObject
27
  {
28
  CUBE2 ( 2, R.drawable.button2 ),
29
  CUBE3 ( 3, R.drawable.button3 ),
30
  CUBE4 ( 4, R.drawable.button4 ),
31
  CUBE5 ( 5, R.drawable.button5 ),
32
  ;
33

    
34
  public static final int LENGTH = values().length;
35
  private final int mObjectSize, mIconID;
36
  private static final RubikObject[] objects;
37

    
38
  static
39
    {
40
    int i = 0;
41
    objects = new RubikObject[LENGTH];
42

    
43
    for(RubikObject size: RubikObject.values())
44
      {
45
      objects[i] = size;
46
      i++;
47
      }
48
    }
49

    
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51

    
52
  public static RubikObject getObject(int ordinal)
53
    {
54
    return objects[ordinal];
55
    }
56

    
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58

    
59
  RubikObject(int size, int iconID)
60
    {
61
    mObjectSize = size;
62
    mIconID     = iconID;
63
    }
64

    
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66

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

    
72
///////////////////////////////////////////////////////////////////////////////////////////////////
73

    
74
  public int getObjectSize()
75
    {
76
    return mObjectSize;
77
    }
78
  }
(3-3/3)