Project

General

Profile

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

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

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 4f9f99a2 Leszek Koltunski
package org.distorted.object;
21 fdec60a3 Leszek Koltunski
22 4f9f99a2 Leszek Koltunski
import org.distorted.magic.R;
23
24 0333d81e Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
25
26 4f9f99a2 Leszek Koltunski
public enum RubikObject
27 fdec60a3 Leszek Koltunski
  {
28 4f9f99a2 Leszek Koltunski
  CUBE2 ( 2, R.drawable.button2 ),
29
  CUBE3 ( 3, R.drawable.button3 ),
30
  CUBE4 ( 4, R.drawable.button4 ),
31
  CUBE5 ( 5, R.drawable.button5 ),
32 fdec60a3 Leszek Koltunski
  ;
33
34 211b48f2 Leszek Koltunski
  public static final int LENGTH = values().length;
35 4f9f99a2 Leszek Koltunski
  private final int mObjectSize, mIconID;
36
  private static final RubikObject[] objects;
37 fdec60a3 Leszek Koltunski
38
  static
39
    {
40
    int i = 0;
41 4f9f99a2 Leszek Koltunski
    objects = new RubikObject[LENGTH];
42 fdec60a3 Leszek Koltunski
43 4f9f99a2 Leszek Koltunski
    for(RubikObject size: RubikObject.values())
44 fdec60a3 Leszek Koltunski
      {
45 4f9f99a2 Leszek Koltunski
      objects[i] = size;
46 fdec60a3 Leszek Koltunski
      i++;
47
      }
48
    }
49
50
///////////////////////////////////////////////////////////////////////////////////////////////////
51
52 4f9f99a2 Leszek Koltunski
  public static RubikObject getObject(int ordinal)
53 dd73fdab Leszek Koltunski
    {
54 4f9f99a2 Leszek Koltunski
    return objects[ordinal];
55 dd73fdab Leszek Koltunski
    }
56
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58
59 4f9f99a2 Leszek Koltunski
  RubikObject(int size, int iconID)
60 fdec60a3 Leszek Koltunski
    {
61 4f9f99a2 Leszek Koltunski
    mObjectSize = size;
62
    mIconID     = iconID;
63 fdec60a3 Leszek Koltunski
    }
64
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66
67 211b48f2 Leszek Koltunski
  public int getIconID()
68 fdec60a3 Leszek Koltunski
    {
69
    return mIconID;
70
    }
71
72
///////////////////////////////////////////////////////////////////////////////////////////////////
73
74 4f9f99a2 Leszek Koltunski
  public int getObjectSize()
75 fdec60a3 Leszek Koltunski
    {
76 4f9f99a2 Leszek Koltunski
    return mObjectSize;
77 fdec60a3 Leszek Koltunski
    }
78
  }