wyvern.lib.commands
Class Atmospheres

java.lang.Object
  extended bywyvern.lib.commands.Atmospheres

public class Atmospheres
extends java.lang.Object

Handles reading an atmosphere list from an XML file.

Version:
1.0, Jul 9, 2001
Author:
Steve Yegge

Field Summary
protected  java.util.HashMap adjacent_
           
protected  java.util.HashSet all_
           
protected  java.util.HashMap solo_
           
protected  java.util.HashMap visible_
           
 
Constructor Summary
Atmospheres()
           
 
Method Summary
 java.lang.String[] getAdjacentMessages(java.lang.String verb)
          Returns the templatized messages for this atmosphere.
 java.lang.String[] getSoloMessages(java.lang.String verb)
          Returns the templatized messages for this atmosphere.
 java.lang.String[] getVerbs()
          Returns a list of all the atmosphere verbs this object has read from xml files, from calls to readFile().
 java.lang.String[] getVisibleMessages(java.lang.String verb)
          Returns the templatized messages for this atmosphere.
 boolean isAdjacentAtmosphere(java.lang.String verb)
          Returns true if the passed verb can be used as a "adjacent" atmosphere (i.e. takes an adjacent target).
 boolean isSoloAtmosphere(java.lang.String verb)
          Returns true if the passed verb can be used as a "solo" atmosphere (i.e. no target).
 boolean isVisibleAtmosphere(java.lang.String verb)
          Returns true if the passed verb can be used as a "visible" atmosphere (i.e. takes a visible target).
static void main(java.lang.String[] args)
          Test harness.
protected  void parseAdjacent(org.w3c.dom.Element node, java.lang.String verb)
          Parses an "adjacent" atmosphere element and puts it in the list.
protected  void parseAdjacentMessage(org.w3c.dom.Element node, java.lang.String[] messages, java.lang.String verb)
          Grabs a message from a adjacent element.
protected  void parseSolo(org.w3c.dom.Element node, java.lang.String verb)
          Parses a "solo" atmosphere element and puts it in the list.
protected  void parseSoloMessage(org.w3c.dom.Element node, java.lang.String[] messages, java.lang.String verb)
          Grabs a message from a solo element.
protected  void parseVisible(org.w3c.dom.Element node, java.lang.String verb)
          Parses a "visible" atmosphere element and puts it in the list.
protected  void readAtmospheres(org.w3c.dom.Element root)
          Parses the master atmospheres document (read from an XML file).
 void readFile(java.lang.String path)
          Reads in a specified atmospheres XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

solo_

protected java.util.HashMap solo_

adjacent_

protected java.util.HashMap adjacent_

visible_

protected java.util.HashMap visible_

all_

protected java.util.HashSet all_
Constructor Detail

Atmospheres

public Atmospheres()
Method Detail

readFile

public void readFile(java.lang.String path)
              throws java.lang.Exception
Reads in a specified atmospheres XML file.

Throws:
java.lang.Exception

readAtmospheres

protected void readAtmospheres(org.w3c.dom.Element root)
Parses the master atmospheres document (read from an XML file).


parseSolo

protected void parseSolo(org.w3c.dom.Element node,
                         java.lang.String verb)
Parses a "solo" atmosphere element and puts it in the list.

Parameters:
node - the xml "solo" node
verb - the atmosphere verb

parseSoloMessage

protected void parseSoloMessage(org.w3c.dom.Element node,
                                java.lang.String[] messages,
                                java.lang.String verb)
Grabs a message from a solo element.

Parameters:
messages - a string array for storing the messages (first is agent, second is other)

parseAdjacent

protected void parseAdjacent(org.w3c.dom.Element node,
                             java.lang.String verb)
Parses an "adjacent" atmosphere element and puts it in the list.

Parameters:
node - the xml "adjacent" node

parseAdjacentMessage

protected void parseAdjacentMessage(org.w3c.dom.Element node,
                                    java.lang.String[] messages,
                                    java.lang.String verb)
Grabs a message from a adjacent element.

Parameters:
messages - a string array for storing the messages (first is agent, second is other)

parseVisible

protected void parseVisible(org.w3c.dom.Element node,
                            java.lang.String verb)
Parses a "visible" atmosphere element and puts it in the list.

Parameters:
node - the xml "visible" node

getSoloMessages

public java.lang.String[] getSoloMessages(java.lang.String verb)
Returns the templatized messages for this atmosphere.

Returns:
an array of 2 strings

getAdjacentMessages

public java.lang.String[] getAdjacentMessages(java.lang.String verb)
Returns the templatized messages for this atmosphere.

Returns:
an array of 3 strings

getVisibleMessages

public java.lang.String[] getVisibleMessages(java.lang.String verb)
Returns the templatized messages for this atmosphere.

Returns:
an array of 3 strings

isSoloAtmosphere

public boolean isSoloAtmosphere(java.lang.String verb)
Returns true if the passed verb can be used as a "solo" atmosphere (i.e. no target).

Returns:
true if it's OK to use solo

isAdjacentAtmosphere

public boolean isAdjacentAtmosphere(java.lang.String verb)
Returns true if the passed verb can be used as a "adjacent" atmosphere (i.e. takes an adjacent target).

Returns:
true if it's OK to use adjacent

isVisibleAtmosphere

public boolean isVisibleAtmosphere(java.lang.String verb)
Returns true if the passed verb can be used as a "visible" atmosphere (i.e. takes a visible target).

Returns:
true if it's OK to use visible

getVerbs

public java.lang.String[] getVerbs()
Returns a list of all the atmosphere verbs this object has read from xml files, from calls to readFile().


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test harness.

Throws:
java.lang.Exception