story.scheherazade.misc
Class STools

java.lang.Object
  extended by story.scheherazade.misc.STools

public class STools
extends java.lang.Object

Bag of miscellaenous tricks specific to Scheherazade.


Nested Class Summary
static class STools.EmptyHorizontal
          An object that is an invisible placeholder of horizontal space.
static class STools.EmptyVertical
          An object that is an invisible placeholder of vertical space.
 
Constructor Summary
STools()
           
 
Method Summary
static java.lang.String capitalize(java.lang.String in)
           
static java.lang.String compress(java.lang.String in)
           
static java.lang.String decompress(java.lang.String in)
           
static java.util.TreeSet getGroupMembers(SCHArguments args, NounFlavor flavor)
          Get the members of a group.
static java.lang.String getNodeComment(DBCAccessor dbca, NodeAddress node)
          Get a comment of a node.
static org.w3c.dom.Node getOnlyXMLChild(org.w3c.dom.Node node, java.lang.String tag)
           
static StateTime getOnsetTime(AssignedPredicate predicate)
           
static Perspective getPerspective(TransitionTime actionTime, TimelineTime perceptionTimelineTime)
          Get the perspective of an action from some time.
static Perspective getPerspective(TransitionTime actionTime, TransitionTime actionTimeSlice, TimelineTime perceptionTimelineTime, boolean debug)
          Get the perspective of a SLICE of an action from some time.
static PredicateFlavor getPredicateFlavor(ScheherIDWithType type)
           
static AssignedConditionSet getProperties(StoryInterpreter story, TimelineID timeline, GenericScheherID ID)
          Get the Properties of a certain GenericScheherID in the story.
static int getTrailingInt(java.lang.String string)
          Returns the integer at the end of a string.
static ScheherIDWithType getType(java.lang.Object object)
           
static GenericScheherID getValidPredicateType(ValidPredicate predicate)
          Java is a bit strange for not letting me put "public GenericScheherID getType()" in the ValidPredicate interface, because each ValidPredicate returns a different type for getType() -- ValidProp returns PropType, for example.
static java.lang.String getVersion(java.lang.Object object)
          Read in the version number from src/version.txt
static java.lang.String getXMLAttribute(org.w3c.dom.Element element, java.lang.String attname)
           
static java.lang.String getXMLAttribute(org.w3c.dom.Node node, java.lang.String attname)
           
static boolean isPredicateFlavor(ScheherIDWithType type)
           
static boolean isValidInterpLeftType(InterpretativeNodeType nodeType, InterpretativeArcType arcType)
           
static boolean isValidInterpRightType(InterpretativeNodeType nodeType, InterpretativeArcType arcType)
           
static NounName makeNounName(NounFlavor nounFlavor, java.lang.String name)
          Switchboard for making a NounName
static java.lang.String makeStandardPluralForm(java.lang.String singular)
           
static java.lang.String removeTail(java.lang.String string, int numLettersToRemove)
           
static java.lang.String separateCamelCase(java.lang.String in)
           
static java.util.Hashtable<NounName,AssignedActionSet> sortActionsByAgent(StoryInterpreter story, AssignedActionSet actions)
          Returns a hashtable that has an AssignedActionSet for each agent/mover key.
static java.util.Hashtable<NounName,AssignedConditionSet> sortConditionsByAgent(StoryInterpreter story, AssignedConditionSet conditions)
          Returns a hashtable that has an AssignedConditionSet for each agent/mover
static boolean startsWithVowel(java.lang.String in)
          Returns whether a string starts with a vowel.
static void startupChecks(java.lang.Object object)
          Stuff to do whenever Scheherazade starts.
static boolean validVersion()
          Checks to see if we are running java version >= 1.5.
static java.lang.String verbalizeUnknownObject(java.lang.Object ID, StoryInterpreter story, Verbalizer verbalizer, PlannerRepository planners)
          Verbalize a GenericScheherID of unknown type.
static java.lang.String verbalizeVirgilCommand(Virgil virgil, StoryInterpreter story, Verbalizer verbalizer, PlannerRepository planners, StoryPoint point)
           
static java.lang.String verbalizeVirgilCommand(Virgil virgil, StoryInterpreter story, Verbalizer verbalizer, PlannerRepository planners, VirgilCommand command)
          Create an NL description of a StoryPoint for populating Undo and Redo buttons.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

STools

public STools()
Method Detail

getNodeComment

public static java.lang.String getNodeComment(DBCAccessor dbca,
                                              NodeAddress node)
                                       throws Scheherexception
Get a comment of a node.

Throws:
Scheherexception

startsWithVowel

public static boolean startsWithVowel(java.lang.String in)
Returns whether a string starts with a vowel.


getTrailingInt

public static int getTrailingInt(java.lang.String string)
                          throws Scheherexception
Returns the integer at the end of a string. The integer must be preceded by an underscore.

Throws:
Scheherexception

capitalize

public static java.lang.String capitalize(java.lang.String in)

separateCamelCase

public static java.lang.String separateCamelCase(java.lang.String in)

verbalizeUnknownObject

public static java.lang.String verbalizeUnknownObject(java.lang.Object ID,
                                                      StoryInterpreter story,
                                                      Verbalizer verbalizer,
                                                      PlannerRepository planners)
Verbalize a GenericScheherID of unknown type.


verbalizeVirgilCommand

public static java.lang.String verbalizeVirgilCommand(Virgil virgil,
                                                      StoryInterpreter story,
                                                      Verbalizer verbalizer,
                                                      PlannerRepository planners,
                                                      VirgilCommand command)
                                               throws Scheherexception
Create an NL description of a StoryPoint for populating Undo and Redo buttons.

Throws:
Scheherexception

verbalizeVirgilCommand

public static java.lang.String verbalizeVirgilCommand(Virgil virgil,
                                                      StoryInterpreter story,
                                                      Verbalizer verbalizer,
                                                      PlannerRepository planners,
                                                      StoryPoint point)
                                               throws Scheherexception
Throws:
Scheherexception

getValidPredicateType

public static GenericScheherID getValidPredicateType(ValidPredicate predicate)
                                              throws Scheherexception
Java is a bit strange for not letting me put "public GenericScheherID getType()" in the ValidPredicate interface, because each ValidPredicate returns a different type for getType() -- ValidProp returns PropType, for example. This is strange because every ValidProp is an instance of GenericScheherID. The return types have to match precisely. This workaround is the next best thing.

Throws:
Scheherexception

getProperties

public static AssignedConditionSet getProperties(StoryInterpreter story,
                                                 TimelineID timeline,
                                                 GenericScheherID ID)
                                          throws Scheherexception
Get the Properties of a certain GenericScheherID in the story.

Throws:
Scheherexception

sortActionsByAgent

public static java.util.Hashtable<NounName,AssignedActionSet> sortActionsByAgent(StoryInterpreter story,
                                                                                 AssignedActionSet actions)
                                                                          throws Scheherexception
Returns a hashtable that has an AssignedActionSet for each agent/mover key. No-agent actions are put under CharacterName SCHConstants.NO_AGENT.

Throws:
Scheherexception

sortConditionsByAgent

public static java.util.Hashtable<NounName,AssignedConditionSet> sortConditionsByAgent(StoryInterpreter story,
                                                                                       AssignedConditionSet conditions)
                                                                                throws Scheherexception
Returns a hashtable that has an AssignedConditionSet for each agent/mover

Throws:
Scheherexception

validVersion

public static boolean validVersion()
Checks to see if we are running java version >= 1.5. Borrowed from Wordfreak source.


getVersion

public static final java.lang.String getVersion(java.lang.Object object)
Read in the version number from src/version.txt


startupChecks

public static void startupChecks(java.lang.Object object)
                          throws Scheherexception
Stuff to do whenever Scheherazade starts.

Throws:
Scheherexception

getGroupMembers

public static java.util.TreeSet getGroupMembers(SCHArguments args,
                                                NounFlavor flavor)
                                         throws Scheherexception
Get the members of a group.

Throws:
Scheherexception

makeNounName

public static NounName makeNounName(NounFlavor nounFlavor,
                                    java.lang.String name)
                             throws Scheherexception
Switchboard for making a NounName

Throws:
Scheherexception

getOnsetTime

public static StateTime getOnsetTime(AssignedPredicate predicate)
                              throws Scheherexception
Throws:
Scheherexception

getPerspective

public static Perspective getPerspective(TransitionTime actionTime,
                                         TransitionTime actionTimeSlice,
                                         TimelineTime perceptionTimelineTime,
                                         boolean debug)
                                  throws Scheherexception
Get the perspective of a SLICE of an action from some time.

Throws:
Scheherexception

getPerspective

public static Perspective getPerspective(TransitionTime actionTime,
                                         TimelineTime perceptionTimelineTime)
                                  throws Scheherexception
Get the perspective of an action from some time.

Throws:
Scheherexception

getPredicateFlavor

public static PredicateFlavor getPredicateFlavor(ScheherIDWithType type)
                                          throws Scheherexception
Throws:
Scheherexception

isPredicateFlavor

public static boolean isPredicateFlavor(ScheherIDWithType type)
                                 throws Scheherexception
Throws:
Scheherexception

getType

public static ScheherIDWithType getType(java.lang.Object object)
                                 throws Scheherexception
Throws:
Scheherexception

makeStandardPluralForm

public static java.lang.String makeStandardPluralForm(java.lang.String singular)

removeTail

public static java.lang.String removeTail(java.lang.String string,
                                          int numLettersToRemove)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

isValidInterpLeftType

public static boolean isValidInterpLeftType(InterpretativeNodeType nodeType,
                                            InterpretativeArcType arcType)

isValidInterpRightType

public static boolean isValidInterpRightType(InterpretativeNodeType nodeType,
                                             InterpretativeArcType arcType)

compress

public static java.lang.String compress(java.lang.String in)
                                 throws Scheherexception
Throws:
Scheherexception

decompress

public static java.lang.String decompress(java.lang.String in)
                                   throws Scheherexception
Throws:
Scheherexception

getXMLAttribute

public static java.lang.String getXMLAttribute(org.w3c.dom.Element element,
                                               java.lang.String attname)
                                        throws Scheherexception
Throws:
Scheherexception

getXMLAttribute

public static java.lang.String getXMLAttribute(org.w3c.dom.Node node,
                                               java.lang.String attname)
                                        throws Scheherexception
Throws:
Scheherexception

getOnlyXMLChild

public static org.w3c.dom.Node getOnlyXMLChild(org.w3c.dom.Node node,
                                               java.lang.String tag)
                                        throws Scheherexception
Throws:
Scheherexception


Copyright © 2011 David K. Elson. All Rights Reserved.