Class ArchetypeTypeSet
- java.lang.Object
-
- net.sf.gridarta.model.archetypetype.ArchetypeTypeSet
-
- All Implemented Interfaces:
java.lang.Iterable<ArchetypeType>
public class ArchetypeTypeSet extends java.lang.Object implements java.lang.Iterable<ArchetypeType>
ManagesArchetypeTypeinstances, list, and bitmask definitions.
-
-
Constructor Summary
Constructors Constructor Description ArchetypeTypeSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArchetypeType(@NotNull ArchetypeType archetypeType)Adds anArchetypeTypeinstance.booleanaddAttributeOrder(@NotNull java.lang.String attributeName)Adds an attribute name for attribute ordering when saving.voidaddBitmask(@NotNull java.lang.String attribute, @NotNull AttributeBitmask attributeBitmask)Adds a bitmask definition.voidaddList(@NotNull java.lang.String attribute, @NotNull ArchetypeTypeList list)Adds a list definition.@Nullable ArchetypeTypegetArchetypeType(@NotNull java.lang.String typeName)Returns anArchetypeTypeby type name.@NotNull ArchetypeTypegetArchetypeTypeByBaseObject(@NotNull BaseObject<?,?,?,?> baseObject)Returns theArchetypeTypefor the givenBaseObject.@NotNull ArchetypeTypegetArchetypeTypeByName(@NotNull java.lang.String typeName)Finds and returns the type-structure (ArchetypeType) that matches the given 'typeName'.intgetArchetypeTypeCount()Returns the number of ArchetypeTypes in the list.intgetArchetypeTypeIndex(@NotNull ArchetypeType archetypeType)Returns the index of anArchetypeTypeinstance.@NotNull java.util.Comparator<java.lang.String>getAttributeOrderComparator()Returns aComparatorthat sorts attributes keys by the order defined byaddAttributeOrder(String).@Nullable AttributeBitmaskgetBitmask(@NotNull java.lang.String bitmaskName)Returns a bitmask type by name.@NotNull java.lang.StringgetDisplayName(@NotNull BaseObject<?,?,?,?> baseObject)Returns a description of this type.@Nullable ArchetypeTypeListgetList(@NotNull java.lang.String listName)Returns a list type definition.booleanisFallbackArchetypeType(@NotNull ArchetypeType archetypeType)Returns whether a givenArchetypeTypeis the fallback archetype type used for game objects not matching any defined archetype type.@NotNull java.util.Iterator<ArchetypeType>iterator()@NotNull java.lang.StringtoString()
-
-
-
Method Detail
-
addArchetypeType
public void addArchetypeType(@NotNull @NotNull ArchetypeType archetypeType)Adds anArchetypeTypeinstance.- Parameters:
archetypeType- the archetype type instance
-
getArchetypeType
@Nullable public @Nullable ArchetypeType getArchetypeType(@NotNull @NotNull java.lang.String typeName)
Returns anArchetypeTypeby type name.- Parameters:
typeName- the type name to look up- Returns:
- the archetype type instance or
nullif the type name does not exist
-
getArchetypeTypeByName
@NotNull public @NotNull ArchetypeType getArchetypeTypeByName(@NotNull @NotNull java.lang.String typeName)
Finds and returns the type-structure (ArchetypeType) that matches the given 'typeName'. These type-names are "artificial" names, defined in "types.xml". They appear in the type selection box in the attribute-dialog.- Parameters:
typeName- the name of the type to get- Returns:
- the
ArchetypeTypethat matches, or the default ("Misc") type if no match is found
-
getArchetypeTypeByBaseObject
@NotNull public @NotNull ArchetypeType getArchetypeTypeByBaseObject(@NotNull @NotNull BaseObject<?,?,?,?> baseObject)
Returns theArchetypeTypefor the givenBaseObject.- Parameters:
baseObject- the base object to find the archetype type for- Returns:
- the archetype type for the given base object or the default type if no match was found
-
iterator
@NotNull public @NotNull java.util.Iterator<ArchetypeType> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<ArchetypeType>
-
getArchetypeTypeIndex
public int getArchetypeTypeIndex(@NotNull @NotNull ArchetypeType archetypeType)Returns the index of anArchetypeTypeinstance.- Parameters:
archetypeType- the archetype type instance- Returns:
- the index
-
getArchetypeTypeCount
public int getArchetypeTypeCount()
Returns the number of ArchetypeTypes in the list. The default type is not counted.- Returns:
- the number of archetype types in the list
-
isFallbackArchetypeType
public boolean isFallbackArchetypeType(@NotNull @NotNull ArchetypeType archetypeType)Returns whether a givenArchetypeTypeis the fallback archetype type used for game objects not matching any defined archetype type.- Parameters:
archetypeType- the archetype type to check- Returns:
- whether the given archetype type is the fallback archetype type
-
addList
public void addList(@NotNull @NotNull java.lang.String attribute, @NotNull @NotNull ArchetypeTypeList list)Adds a list definition.- Parameters:
attribute- the attribute namelist- the list definition
-
getList
@Nullable public @Nullable ArchetypeTypeList getList(@NotNull @NotNull java.lang.String listName)
Returns a list type definition.- Parameters:
listName- the list name- Returns:
- the list type definition or
nullif the list does not exist
-
addBitmask
public void addBitmask(@NotNull @NotNull java.lang.String attribute, @NotNull @NotNull AttributeBitmask attributeBitmask)Adds a bitmask definition.- Parameters:
attribute- the attribute nameattributeBitmask- the list definition
-
getBitmask
@Nullable public @Nullable AttributeBitmask getBitmask(@NotNull @NotNull java.lang.String bitmaskName)
Returns a bitmask type by name.- Parameters:
bitmaskName- the bitmask name to look up- Returns:
- the bitmask type or
nullif the name does not exist
-
addAttributeOrder
public boolean addAttributeOrder(@NotNull @NotNull java.lang.String attributeName)Adds an attribute name for attribute ordering when saving. The new attribute name is placed after all previously added attribute names and before all other attribute names.- Parameters:
attributeName- the attribute name- Returns:
- whether insertion failed because the attribute name was already known
-
getAttributeOrderComparator
@NotNull public @NotNull java.util.Comparator<java.lang.String> getAttributeOrderComparator()
Returns aComparatorthat sorts attributes keys by the order defined byaddAttributeOrder(String).- Returns:
- the comparator
-
getDisplayName
@NotNull public @NotNull java.lang.String getDisplayName(@NotNull @NotNull BaseObject<?,?,?,?> baseObject)Returns a description of this type.- Parameters:
baseObject- the base object to describe- Returns:
- the description
-
toString
@NotNull public @NotNull java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-