public class GUnitList extends Object
Constructor and Description |
---|
GUnitList(GUnit[] unitArray)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsByName(String unitName)
Checks if a given unit is contained in the units list, given its name.
|
GUnit |
get(int rank)
Get the unit at requested position.
|
GUnit[] |
getArray()
Get the list of units as an array.
|
GUnit |
getByName(String unitName)
Returns the unit, given its name, if it is contained in the units list.
|
GUnit |
getFirst()
Returns the first unit in the list or null if the list is empty.
|
ArrayList<GMenuItem> |
getMenuItems(String widgetIDprefix)
Generates the list of items to be used in a units pop-up menu.
|
int |
indexOfByName(String unitName)
Finds the index of a unit in the units list, given its name.
|
boolean |
isEmpty()
Check if the unit list is empty.
|
int |
size()
Get the size of the units list.
|
public GUnitList(GUnit[] unitArray)
unitArray
- Array of units.public ArrayList<GMenuItem> getMenuItems(String widgetIDprefix)
widgetIDprefix
- of the widgetId of each element for the menu.public int indexOfByName(String unitName)
unitName
- name of the unit.public boolean containsByName(String unitName)
unitName
- name of the unit.public GUnit getByName(String unitName)
unitName
- name of the unit.public GUnit getFirst()
public boolean isEmpty()
public GUnit get(int rank)
rank
- of the unit.public int size()
public GUnit[] getArray()
Copyright © 2024. All rights reserved.