Class TreasureObj
- java.lang.Object
-
- net.sf.gridarta.model.treasurelist.TreasureObj
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ArchTreasureObj,FolderTreasureObj,NoTreasureObj,TreasureListTreasureObj,YesTreasureObj
public abstract class TreasureObj extends java.lang.Object implements java.io.SerializableSubclass: UserObject (= content object) for nodes in the CFTreasureListTree These can be either treasurelists (containers), arches, or yes/no containers.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intUNSETUnset values.
-
Constructor Summary
Constructors Modifier Constructor Description protectedTreasureObj(@NotNull java.lang.String name, boolean isTreasureList, boolean isRealChild)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidappendToString(@NotNull java.lang.StringBuilder sb)Appends a description of this treasure object to aStringBuilder.abstract voidcopyListType(@NotNull TreasureObj treasureObj)Copes the list type of a treasureone list.voidcorrectChance(double corrector)Updates the chance attribute by a corrector factor.intgetChance()Returns the chance attribute.intgetMagic()Returns the magic attribute.@NotNull java.lang.StringgetName()Returns the name of this treasure object.booleanhasLoop()Returns whether this treasure object contains itself.intinitChance()Initializes the chance attribute.booleanisRealChild()Returns whether this node is no a yes or no node.booleanisTreasureList()Returns whether this treasure object is a "treasure" or "treasureone" object.voidsetChance(int value)Sets the chance attribute.voidsetHasLoop(boolean hasLoop)Sets whether this treasure object contains itself.voidsetMagic(int magic)Sets the magic attribute.voidsetNrof(int nrof)Sets the maximum number of generated items.@NotNull java.lang.StringtoString()abstract voidvisit(@NotNull TreasureObjVisitor visitor)Calls theTreasureObjVisitorcallback function appropriate for this instance.
-
-
-
Field Detail
-
UNSET
public static final int UNSET
Unset values.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TreasureObj
protected TreasureObj(@NotNull @NotNull java.lang.String name, boolean isTreasureList, boolean isRealChild)Creates a new instance.- Parameters:
name- the name of this treasure objectisTreasureList- set for treasure or treasureoneisRealChild- set for all except yes or no nodes
-
-
Method Detail
-
toString
@NotNull public @NotNull java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
appendToString
protected abstract void appendToString(@NotNull @NotNull java.lang.StringBuilder sb)Appends a description of this treasure object to aStringBuilder.- Parameters:
sb- the string builder
-
setChance
public void setChance(int value)
Sets the chance attribute.- Parameters:
value- the chance attribute
-
getChance
public int getChance()
Returns the chance attribute.- Returns:
- the chance attribute
-
initChance
public int initChance()
Initializes the chance attribute.- Returns:
- the chance attribute
-
correctChance
public void correctChance(double corrector)
Updates the chance attribute by a corrector factor.- Parameters:
corrector- the corrector factor
-
setMagic
public void setMagic(int magic)
Sets the magic attribute.- Parameters:
magic- the magic attribute
-
getMagic
public int getMagic()
Returns the magic attribute.- Returns:
- the magic attribute
-
setNrof
public void setNrof(int nrof)
Sets the maximum number of generated items.- Parameters:
nrof- the maximum number
-
hasLoop
public boolean hasLoop()
Returns whether this treasure object contains itself.- Returns:
- whether this treasure object contains itself
-
setHasLoop
public void setHasLoop(boolean hasLoop)
Sets whether this treasure object contains itself.- Parameters:
hasLoop- whether this treasure object contains itself
-
isTreasureList
public boolean isTreasureList()
Returns whether this treasure object is a "treasure" or "treasureone" object.- Returns:
- whether this treasure object is a "treasure" or "treasureone" object
-
isRealChild
public boolean isRealChild()
Returns whether this node is no a yes or no node.- Returns:
- whether this node is neither yes nor no
-
getName
@NotNull public @NotNull java.lang.String getName()
Returns the name of this treasure object.- Returns:
- the name of this treasure object
-
visit
public abstract void visit(@NotNull @NotNull TreasureObjVisitor visitor)Calls theTreasureObjVisitorcallback function appropriate for this instance.- Parameters:
visitor- the visitor to call
-
copyListType
public abstract void copyListType(@NotNull @NotNull TreasureObj treasureObj)Copes the list type of a treasureone list.- Parameters:
treasureObj- the node to copy from
-
-