sam.rules
Class Syntax

java.lang.Object
  |
  +--sam.rules.Syntax
Direct Known Subclasses:
Syntax.Resource

public abstract class Syntax
extends java.lang.Object

Class describing a rule.

This includes parsing, verbose explainations, etc.


Nested Class Summary
protected static class Syntax.Resource
          Class for specifications of pure resources that are not user-selectable
 
Field Summary
 java.lang.String description
          A human-readable description of this single Syntax element
 java.lang.String name
          The name of this single Syntax element
protected static char NON_SELECTABLE_TYPE
          Special switch type for abstract syntactic elements that are not really user-selectable
 
Constructor Summary
protected Syntax(char switchType, java.lang.String name, java.lang.String description)
          Builds a new Syntax element
 
Method Summary
protected abstract  void doParse(java.lang.String command)
          Really parses a command-line supplied switch
abstract  java.lang.String example()
          Builds an example for this single Syntax element
abstract  sam.rules.Rule getRule()
          Gets the Rule specified by this RuleSpecification.
abstract  void load(java.util.zip.ZipFile archive)
          Loads a Rule from specified archive
 void parse(java.lang.String command)
          Parses a command-line supplied switch This is a failsafe wrapper to doParse(java.lang.String)
protected  int parseInteger(java.lang.String valueSpecifiation, java.lang.String title, int min, int max)
          Shortcut for easily parsing an integer
 boolean recognizesSwitch(char proposedSwitchType)
          Wether this syntax element recognizes proposed switch type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public final java.lang.String name
The name of this single Syntax element


description

public final java.lang.String description
A human-readable description of this single Syntax element


NON_SELECTABLE_TYPE

protected static final char NON_SELECTABLE_TYPE
Special switch type for abstract syntactic elements that are not really user-selectable

See Also:
Syntax.Resource, Constant Field Values
Constructor Detail

Syntax

protected Syntax(char switchType,
                 java.lang.String name,
                 java.lang.String description)
Builds a new Syntax element

Parameters:
switchType - the switchType character
name - the name
description - a human-readable description
Method Detail

recognizesSwitch

public boolean recognizesSwitch(char proposedSwitchType)
Wether this syntax element recognizes proposed switch type


doParse

protected abstract void doParse(java.lang.String command)
Really parses a command-line supplied switch


parse

public final void parse(java.lang.String command)
Parses a command-line supplied switch This is a failsafe wrapper to doParse(java.lang.String)


load

public abstract void load(java.util.zip.ZipFile archive)
Loads a Rule from specified archive


getRule

public abstract sam.rules.Rule getRule()
Gets the Rule specified by this RuleSpecification. This might require prompting the user for a correct specification through the current RulingInterface


example

public abstract java.lang.String example()
Builds an example for this single Syntax element


parseInteger

protected int parseInteger(java.lang.String valueSpecifiation,
                           java.lang.String title,
                           int min,
                           int max)
Shortcut for easily parsing an integer