Class ArchetypeType
- java.lang.Object
-
- net.sf.gridarta.model.archetypetype.ArchetypeType
-
- All Implemented Interfaces:
java.lang.Iterable<ArchetypeAttributeSection>
public class ArchetypeType extends java.lang.Object implements java.lang.Iterable<ArchetypeAttributeSection>
Contains the data of one Gridarta Object-Type. The data is read from a definitions file called 'types.xml'. It is mainly used as info-base for the arch-attribute GUI.
-
-
Constructor Summary
Constructors Constructor Description ArchetypeType(@NotNull java.lang.String typeName, int typeNo, @NotNull java.lang.String display, boolean map, int @Nullable [] inv, boolean allowsAllInv, @Nullable java.lang.String description, @Nullable java.lang.String use, @NotNull ArchetypeAttributesDefinition typeAttributes)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArchetypeAttribute(@NotNull java.lang.String sectionName, @NotNull ArchetypeAttribute archetypeAttribute)Adds anArchetypeAttributeto this archetype type.voidaddAttributeSection(@NotNull ArchetypeAttributeSection newArchetypeAttributeSection)Adds anArchetypeAttributeSection.@NotNull java.lang.StringgetDescription()Returns the description.@NotNull java.lang.StringgetDisplayName(@NotNull Attributes baseObject)Returns a description of this type.int @Nullable []getInv()Returns which archetype types allow this archetype type in their inventories.@NotNull java.lang.StringgetTypeName()Returns the type name (artificial).intgetTypeNo()Returns the type number.@NotNull java.lang.StringgetUse()Returns the usage notes.booleanhasAttribute()Returns whether this archetype type defines at least one archetype attribute.booleanhasAttributeKey(@NotNull java.lang.Comparable<java.lang.String> key)Returns whether an attribute key is defined.booleanhasTypeAttributes()Returns whether any type attributes are defined.booleanisAllowsAllInv()Returns whether this archetype type allows any inventory game objects, regardless whether these types have "inv" specifications.booleanisMap()Returns whether this archetype is allowed on maps.@NotNull java.util.Iterator<ArchetypeAttributeSection>iterator()booleanmatches(@NotNull BaseObject<?,?,?,?> baseObject)Checks whether aBaseObjectmatches all type attributes.@NotNull java.lang.StringtoString()voidtoString(@NotNull java.lang.StringBuilder sb)Appends a string representation of this instance to aStringBuilder.
-
-
-
Constructor Detail
-
ArchetypeType
public ArchetypeType(@NotNull @NotNull java.lang.String typeName, int typeNo, @NotNull @NotNull java.lang.String display, boolean map, int @Nullable [] inv, boolean allowsAllInv, @Nullable @Nullable java.lang.String description, @Nullable @Nullable java.lang.String use, @NotNull @NotNull ArchetypeAttributesDefinition typeAttributes)Creates a new instance.- Parameters:
typeName- the type name (artificial)typeNo- the type numberdisplay- additional description textmap- whether this archetype type is allowed on mapsinv- which archetype types allow this archetype type in their inventories ornullfor no restrictionsallowsAllInv- whether this archetype type allows any inventory game objects, whether these types have "inv" specificationsdescription- the descriptionuse- the usage notestypeAttributes- the list of additional attributes
-
-
Method Detail
-
addAttributeSection
public void addAttributeSection(@NotNull @NotNull ArchetypeAttributeSection newArchetypeAttributeSection)Adds anArchetypeAttributeSection. If the section already exists appends the new attributes to the existing section.- Parameters:
newArchetypeAttributeSection- the section to add
-
iterator
@NotNull public @NotNull java.util.Iterator<ArchetypeAttributeSection> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<ArchetypeAttributeSection>
-
hasAttribute
public boolean hasAttribute()
Returns whether this archetype type defines at least one archetype attribute.- Returns:
- whether at least one archetype attribute exists
-
getTypeNo
public int getTypeNo()
Returns the type number.- Returns:
- the type number
-
getTypeName
@NotNull public @NotNull java.lang.String getTypeName()
Returns the type name (artificial).- Returns:
- the type name
-
isMap
public boolean isMap()
Returns whether this archetype is allowed on maps.- Returns:
- whether this archetype is allowed on maps
-
getInv
public int @Nullable [] getInv()
Returns which archetype types allow this archetype type in their inventories.- Returns:
- the allowed environment types or
nullfor no restrictions
-
isAllowsAllInv
public boolean isAllowsAllInv()
Returns whether this archetype type allows any inventory game objects, regardless whether these types have "inv" specifications.- Returns:
- whether this archetype type allows any inventory game objects
-
getDescription
@NotNull public @NotNull java.lang.String getDescription()
Returns the description.- Returns:
- the description
-
getUse
@NotNull public @NotNull java.lang.String getUse()
Returns the usage notes.- Returns:
- the usage notes
-
matches
public boolean matches(@NotNull @NotNull BaseObject<?,?,?,?> baseObject)Checks whether aBaseObjectmatches all type attributes.- Parameters:
baseObject- the base object to check- Returns:
- whether the base object matches
-
hasTypeAttributes
public boolean hasTypeAttributes()
Returns whether any type attributes are defined.- Returns:
- whether any type attributes are defined
-
hasAttributeKey
public boolean hasAttributeKey(@NotNull @NotNull java.lang.Comparable<java.lang.String> key)Returns whether an attribute key is defined.- Parameters:
key- the attribute key- Returns:
- whether the attribute key is defined
-
toString
@NotNull public @NotNull java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public void toString(@NotNull @NotNull java.lang.StringBuilder sb)Appends a string representation of this instance to aStringBuilder.- Parameters:
sb- the string builder
-
getDisplayName
@NotNull public @NotNull java.lang.String getDisplayName(@NotNull @NotNull Attributes baseObject)Returns a description of this type.- Parameters:
baseObject- the base object to describe- Returns:
- the description
-
addArchetypeAttribute
public void addArchetypeAttribute(@NotNull @NotNull java.lang.String sectionName, @NotNull @NotNull ArchetypeAttribute archetypeAttribute)Adds anArchetypeAttributeto this archetype type.- Parameters:
sectionName- the name of the section to add toarchetypeAttribute- the archetype attribute to add
-
-