Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / MainEntryList.java @ c5fca790

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2022 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.objects;
21

    
22
import java.util.ArrayList;
23

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

    
26
public class MainEntryList
27
{
28
  private final ArrayList<MainEntry> mList;
29
  private static MainEntryList mThis;
30

    
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

    
33
  private MainEntryList()
34
    {
35
    mList = new ArrayList<>();
36

    
37
    int numObjects = RubikObjectList.getNumObjects();
38

    
39
    for(int i=0; i<numObjects; i++)
40
      {
41
      RubikObject object = RubikObjectList.getObject(i);
42

    
43
      if( object!=null )
44
        {
45
        MainEntry entry = new MainEntry(object);
46
        mList.add(entry);
47

    
48
        String name = object.getLowerName();
49

    
50
        if( name!=null && name.equals("ban4_3") )
51
          {
52
          MainEntry creator = new MainEntry(MainEntry.TYPE_CREATOR, org.distorted.main.R.drawable.gl);
53
          mList.add(creator);
54
          }
55
        }
56
      }
57
    }
58

    
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60

    
61
  public static MainEntryList getInstance()
62
    {
63
    if( mThis==null ) mThis = new MainEntryList();
64
    return mThis;
65
    }
66

    
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68

    
69
  public void addEntry(MainEntry entry)
70
    {
71
    mList.add(entry);
72
    }
73

    
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75

    
76
  public int getNumOfEntries()
77
    {
78
    return mList.size();
79
    }
80

    
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82

    
83
  public MainEntry getEntry(int index)
84
    {
85
    return mList.get(index);
86
    }
87
}
(2-2/4)