Project

General

Profile

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

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

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 dd73fdab Leszek Koltunski
  SIZE2 ( R.id.rubikSize2, R.drawable.button2, R.layout.scores_tab2 ),
27
  SIZE3 ( R.id.rubikSize3, R.drawable.button3, R.layout.scores_tab3 ),
28
  SIZE4 ( R.id.rubikSize4, R.drawable.button4, R.layout.scores_tab4 ),
29
  SIZE5 ( R.id.rubikSize5, R.drawable.button5, R.layout.scores_tab5 ),
30 fdec60a3 Leszek Koltunski
  ;
31
32
  static final int LENGTH = values().length;
33 dd73fdab Leszek Koltunski
  private final int mImageButtonID, mIconID, mLayoutID;
34
  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
  RubikSize(int imageID, int iconID, int layoutID)
58 fdec60a3 Leszek Koltunski
    {
59 dd73fdab Leszek Koltunski
    mImageButtonID= imageID;
60
    mIconID       = iconID;
61
    mLayoutID     = layoutID;
62 fdec60a3 Leszek Koltunski
    }
63
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65
66 dd73fdab Leszek Koltunski
  int getImageButton()
67 fdec60a3 Leszek Koltunski
    {
68 dd73fdab Leszek Koltunski
    return mImageButtonID;
69 fdec60a3 Leszek Koltunski
    }
70
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72
73
  int getIcon()
74
    {
75
    return mIconID;
76
    }
77
78
///////////////////////////////////////////////////////////////////////////////////////////////////
79
80
  int getLayout()
81
    {
82
    return mLayoutID;
83
    }
84
  }