AreaGenerationLibrary.LayoutNode
public class DefaultLayoutNode extends java.lang.Object implements AreaGenerationLibrary.LayoutNode
Modifier and Type | Field | Description |
---|---|---|
Room |
associatedRoom |
|
long[] |
coord |
|
java.util.Map<java.lang.Integer,AreaGenerationLibrary.LayoutNode> |
links |
Constructor | Description |
---|---|
DefaultLayoutNode(long[] coord) |
|
DefaultLayoutNode(long x,
long y) |
Modifier and Type | Method | Description |
---|---|---|
long[] |
coord() |
Returns x,y coordinates of this node.
|
void |
crossLink(AreaGenerationLibrary.LayoutNode to) |
Uses this nodes coordinates, as well as the coordinates
of the given connected node, this method will create a
link between them of the appropriate direction
see delLink(LayoutNode)
|
void |
deLink() |
Removes all links from other nodes to this one, and removes
all links from this node to others.
|
void |
delLink(AreaGenerationLibrary.LayoutNode linkNode) |
Removes all directional links between this node and the
given node.
|
void |
flag(AreaGenerationLibrary.LayoutFlags flag) |
Flags this node with one of the visual layout flags,
telling whether it is at an intersection, or on a
corner, or something like that.
|
void |
flagRun(AreaGenerationLibrary.LayoutRuns run) |
Flags this node as being part of a street-like run.
|
java.lang.String |
getColorRepresentation(char roomChar,
int line) |
Returns one line of a 3x3 character representation.
|
AreaGenerationLibrary.LayoutRuns |
getFlagRuns() |
Return whether this node is flagged as being part of a
street-like run.
|
AreaGenerationLibrary.LayoutNode |
getLink(int d) |
Returns a link from this node in the given direction.
|
boolean |
isFlagged(AreaGenerationLibrary.LayoutFlags flag) |
Returns whether this node is flagged with one of the
visual layout flags, telling whether it is an intersectino,
or on a corner, or something like that.
|
boolean |
isStreetLike() |
Returns true if the first two linked nodes to this
node are in the same general direction, this making
this node look like a street node.
|
java.util.Map<java.lang.Integer,AreaGenerationLibrary.LayoutNode> |
links() |
Returns a map of directions to other layoutnodes.
|
void |
reType(AreaGenerationLibrary.LayoutTypes type) |
Sets the layout type flag that this node represents,
denoting whether it is a leaf, a street, or some other
role.
|
Room |
room() |
Returns the room object assigned to this node.
|
void |
setExits(int[] dirs) |
Sets the exit available link directions, without setting
the nodes they are linked to -- what good is this?
Well, it sets the LayoutTags.NODEEXITS string, which
makes some sense I guess.
|
void |
setRoom(Room room) |
Sets the room object assigned to this node.
|
java.util.Map<AreaGenerationLibrary.LayoutTags,java.lang.String> |
tags() |
Returns comma-delimited values of each LayoutTag type,
through a may of layouttag to string mapping.
|
java.lang.String |
toString() |
|
AreaGenerationLibrary.LayoutTypes |
type() |
Returns the layout type flag that this node represents,
denoting whether it is a leaf, a street, or some other
role.
|
public long[] coord
public Room associatedRoom
public java.util.Map<java.lang.Integer,AreaGenerationLibrary.LayoutNode> links
public DefaultLayoutNode(long[] coord)
public DefaultLayoutNode(long x, long y)
public Room room()
AreaGenerationLibrary.LayoutNode
room
in interface AreaGenerationLibrary.LayoutNode
AreaGenerationLibrary.LayoutNode.setRoom(Room)
public void setRoom(Room room)
AreaGenerationLibrary.LayoutNode
setRoom
in interface AreaGenerationLibrary.LayoutNode
room
- the room object assigned to this node.AreaGenerationLibrary.LayoutNode.room()
public long[] coord()
AreaGenerationLibrary.LayoutNode
coord
in interface AreaGenerationLibrary.LayoutNode
public java.util.Map<AreaGenerationLibrary.LayoutTags,java.lang.String> tags()
AreaGenerationLibrary.LayoutNode
tags
in interface AreaGenerationLibrary.LayoutNode
AreaGenerationLibrary.LayoutTags
public java.util.Map<java.lang.Integer,AreaGenerationLibrary.LayoutNode> links()
AreaGenerationLibrary.LayoutNode
links
in interface AreaGenerationLibrary.LayoutNode
AreaGenerationLibrary.LayoutNode.deLink()
,
AreaGenerationLibrary.LayoutNode.getLink(int)
public void crossLink(AreaGenerationLibrary.LayoutNode to)
AreaGenerationLibrary.LayoutNode
crossLink
in interface AreaGenerationLibrary.LayoutNode
to
- the node to connect this one to.AreaGenerationLibrary.LayoutNode.getLink(int)
,
AreaGenerationLibrary.LayoutNode.links()
,
AreaGenerationLibrary.LayoutNode.deLink()
public boolean isFlagged(AreaGenerationLibrary.LayoutFlags flag)
AreaGenerationLibrary.LayoutNode
isFlagged
in interface AreaGenerationLibrary.LayoutNode
flag
- the flag to check forpublic AreaGenerationLibrary.LayoutRuns getFlagRuns()
AreaGenerationLibrary.LayoutNode
getFlagRuns
in interface AreaGenerationLibrary.LayoutNode
AreaGenerationLibrary.LayoutRuns
public void delLink(AreaGenerationLibrary.LayoutNode linkNode)
AreaGenerationLibrary.LayoutNode
delLink
in interface AreaGenerationLibrary.LayoutNode
linkNode
- the node to de-link from.AreaGenerationLibrary.LayoutNode.getLink(int)
,
AreaGenerationLibrary.LayoutNode.links()
,
AreaGenerationLibrary.LayoutNode.deLink()
public AreaGenerationLibrary.LayoutNode getLink(int d)
AreaGenerationLibrary.LayoutNode
getLink
in interface AreaGenerationLibrary.LayoutNode
d
- the direction codeAreaGenerationLibrary.LayoutNode.links()
,
AreaGenerationLibrary.LayoutNode.deLink()
public boolean isStreetLike()
AreaGenerationLibrary.LayoutNode
isStreetLike
in interface AreaGenerationLibrary.LayoutNode
public void deLink()
AreaGenerationLibrary.LayoutNode
deLink
in interface AreaGenerationLibrary.LayoutNode
AreaGenerationLibrary.LayoutNode.links()
,
AreaGenerationLibrary.LayoutNode.getLink(int)
public java.lang.String toString()
toString
in class java.lang.Object
public void flag(AreaGenerationLibrary.LayoutFlags flag)
AreaGenerationLibrary.LayoutNode
flag
in interface AreaGenerationLibrary.LayoutNode
flag
- the flag to set.public void flagRun(AreaGenerationLibrary.LayoutRuns run)
AreaGenerationLibrary.LayoutNode
flagRun
in interface AreaGenerationLibrary.LayoutNode
run
- the direction of the runAreaGenerationLibrary.LayoutRuns
public AreaGenerationLibrary.LayoutTypes type()
AreaGenerationLibrary.LayoutNode
type
in interface AreaGenerationLibrary.LayoutNode
AreaGenerationLibrary.LayoutTypes
public void setExits(int[] dirs)
AreaGenerationLibrary.LayoutNode
setExits
in interface AreaGenerationLibrary.LayoutNode
dirs
- the array of Direction codes to set.public void reType(AreaGenerationLibrary.LayoutTypes type)
AreaGenerationLibrary.LayoutNode
reType
in interface AreaGenerationLibrary.LayoutNode
type
- the type of this nodeAreaGenerationLibrary.LayoutTypes
public java.lang.String getColorRepresentation(char roomChar, int line)
AreaGenerationLibrary.LayoutNode
getColorRepresentation
in interface AreaGenerationLibrary.LayoutNode
roomChar
- the char to use for this roomline
- which line, 0, 1, or 2