Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / MainEntryList.java @ 1ba56d95

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2022 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8
///////////////////////////////////////////////////////////////////////////////////////////////////
9

    
10
package org.distorted.objects;
11

    
12
import org.distorted.main.R;
13

    
14
import java.util.ArrayList;
15

    
16
///////////////////////////////////////////////////////////////////////////////////////////////////
17

    
18
public class MainEntryList
19
{
20
  private final ArrayList<MainEntry> mList;
21
  private static MainEntryList mThis;
22

    
23
///////////////////////////////////////////////////////////////////////////////////////////////////
24

    
25
  private MainEntryList()
26
    {
27
    mList = new ArrayList<>();
28

    
29
    int numObjects = RubikObjectList.getNumObjects();
30

    
31
    for(int i=0; i<numObjects; i++)
32
      {
33
      RubikObject object = RubikObjectList.getObject(i);
34

    
35
      if( object!=null )
36
        {
37
        MainEntry entry = new MainEntry(object,i);
38
        mList.add(entry);
39

    
40
        String name = object.getLowerName();
41

    
42
        if( name!=null && name.equals("ban4_3") )
43
          {
44
          MainEntry creator = new MainEntry(MainEntry.TYPE_CREATOR, R.drawable.plus);
45
          mList.add(creator);
46
          }
47
        }
48
      }
49
    }
50

    
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52

    
53
  public static MainEntryList getInstance()
54
    {
55
    if( mThis==null ) mThis = new MainEntryList();
56
    return mThis;
57
    }
58

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

    
61
  public void addEntry(MainEntry entry)
62
    {
63
    mList.add(entry);
64
    }
65

    
66
///////////////////////////////////////////////////////////////////////////////////////////////////
67

    
68
  public int getNumOfEntries()
69
    {
70
    return mList.size();
71
    }
72

    
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74

    
75
  public MainEntry getEntry(int index)
76
    {
77
    return mList.get(index);
78
    }
79
}
(2-2/4)