com.planet_ink.coffee_mud.Libraries.interfaces
Interface AreaGenerationLibrary.LayoutNode

All Known Implementing Classes:
DefaultLayoutNode
Enclosing interface:
AreaGenerationLibrary

public static interface AreaGenerationLibrary.LayoutNode

A layout node represents a single room in a layout manager. It contains numerous methods for linking nodes together the way rooms are, and for flagging nodes to give some idea of where the node fits in various layouts.

See Also:
AreaGenerationLibrary.LayoutTags, AreaGenerationLibrary.LayoutTypes, AreaGenerationLibrary.LayoutFlags, AreaGenerationLibrary.LayoutRuns

Method Summary
 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 dirs)
          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.
 AreaGenerationLibrary.LayoutTypes type()
          Returns the layout type flag that this node represents, denoting whether it is a leaf, a street, or some other role.
 

Method Detail

crossLink

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)

Parameters:
to - the node to connect this one to.
See Also:
getLink(int), links(), deLink()

delLink

void delLink(AreaGenerationLibrary.LayoutNode linkNode)
Removes all directional links between this node and the given node. see crossLink(LayoutNode)

Parameters:
linkNode - the node to de-link from.
See Also:
getLink(int), links(), deLink()

getLink

AreaGenerationLibrary.LayoutNode getLink(int d)
Returns a link from this node in the given direction. crossLink must have already been called to establish the link. see crossLink(LayoutNode) see delLink(LayoutNode)

Parameters:
d - the direction code
Returns:
the node in the given direction
See Also:
links(), deLink()

deLink

void deLink()
Removes all links from other nodes to this one, and removes all links from this node to others. crossLink must have been called for there to be any links. see crossLink(LayoutNode) see delLink(LayoutNode)

See Also:
links(), getLink(int)

links

java.util.Map<java.lang.Integer,AreaGenerationLibrary.LayoutNode> links()
Returns a map of directions to other layoutnodes. These being the established links between nodes. crossLink must have been called for there to be any links. see crossLink(LayoutNode) see delLink(LayoutNode)

Returns:
the map of links
See Also:
deLink(), getLink(int)

tags

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.

Returns:
the map of layouttags to strings
See Also:
AreaGenerationLibrary.LayoutTags

coord

long[] coord()
Returns x,y coordinates of this node. These are generated by the layout manager.

Returns:
x,y coordinates of this node

isStreetLike

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.

Returns:
true if this node is part of a street.

flag

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.

Parameters:
flag - the flag to set.

isFlagged

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. see flag(LayoutFlags)

Parameters:
flag - the flag to check for
Returns:
true if this node is flagged, false otherwise

flagRun

void flagRun(AreaGenerationLibrary.LayoutRuns dirs)
Flags this node as being part of a street-like run.

Parameters:
dirs - the direction of the run
See Also:
AreaGenerationLibrary.LayoutRuns

getFlagRuns

AreaGenerationLibrary.LayoutRuns getFlagRuns()
Return whether this node is flagged as being part of a street-like run.

Returns:
the direction of the run, or null
See Also:
AreaGenerationLibrary.LayoutRuns

type

AreaGenerationLibrary.LayoutTypes type()
Returns the layout type flag that this node represents, denoting whether it is a leaf, a street, or some other role.

Returns:
the type of this node
See Also:
AreaGenerationLibrary.LayoutTypes

reType

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.

Parameters:
type - the type of this node
See Also:
AreaGenerationLibrary.LayoutTypes

setExits

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.

Parameters:
dirs - the array of Direction codes to set.

getColorRepresentation

java.lang.String getColorRepresentation(char roomChar,
                                        int line)
Returns one line of a 3x3 character representation. Each call returns 3 characters, with the middle being the roomchar, and the rest depending on the links. Call this three times with 0, 1, and 2, to get all three lines.

Parameters:
roomChar - the char to use for this room
line - which line, 0, 1, or 2
Returns:
the 3 character string for this line.

room

Room room()
Returns the room object assigned to this node.

Returns:
the room object assigned to this node.
See Also:
setRoom(Room)

setRoom

void setRoom(Room room)
Sets the room object assigned to this node.

Parameters:
room - the room object assigned to this node.
See Also:
room()