net.sourceforge.jparam.paramset
Class ParamSet

java.lang.Object
  |
  +--net.sourceforge.jparam.paramset.ParamSet
All Implemented Interfaces:
AssignmentListener

public class ParamSet
extends java.lang.Object
implements AssignmentListener

This class helps in parsing and handling user input from the command line, you can define sets of parameters, give them types and binding information and use this to read the entire input as a whole

Author:
ron_sidi

Constructor Summary
ParamSet()
          Create an empty ParamSet object.
ParamSet(java.lang.String description)
          Create a ParamSet object with the given general description, and no parameters.
 
Method Summary
 void addParam(Param param)
          Adds the given parameter to the set.
 void check()
          Checks that all parameters have values.
 void clearValues()
           
 void feedback_enabled(boolean b)
           
 java.lang.String getDescription()
          Returns the ParamSet's general description
 Param getParam(java.lang.String name)
          Returns the parameter with the given name, or null if no such parameter exists.
 java.util.Collection getParams()
          Returns all parameters
 void ignore_unexpected(boolean b)
           
 java.lang.String info()
          Returns a human readable description of the ParamSet, including all parameters
 void input(java.io.InputStream in)
          Reads values for all input parameter from given InputStream.
 void input(java.io.InputStream in, boolean check)
          Reads values for all input parameter from given InputStream.
 void input(java.lang.String[] args)
          Reads values for all input parameter from 'args'.
 void input(java.lang.String[] args, boolean check)
          Reads values for all input parameter from 'args'.
 void max_feedback_length(int i)
           
 void notifyAssignment(java.lang.String name, TreeNode value)
          Called by parser for each assignemnt to value set.
 void output()
          Writes all output parameters to outStream
 void output(java.io.PrintStream out)
          Writes all output parameters to given PrintStream.
 void set_feedback_stream(java.io.PrintStream ps)
           
 void setDescription(java.lang.String description)
          Sets the ParamSet's general description
 void setOutput(java.io.PrintStream outStream)
           
 void warning_is_error(boolean b)
           
 void write_feedback()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParamSet

public ParamSet()
Create an empty ParamSet object.

ParamSet

public ParamSet(java.lang.String description)
Create a ParamSet object with the given general description, and no parameters.
Method Detail

clearValues

public void clearValues()

setDescription

public void setDescription(java.lang.String description)
Sets the ParamSet's general description

getDescription

public java.lang.String getDescription()
Returns the ParamSet's general description

addParam

public void addParam(Param param)
              throws JParamException
Adds the given parameter to the set. Throws an exception if a parameter by the same name already exists in the set.

getParam

public Param getParam(java.lang.String name)
               throws MatchException
Returns the parameter with the given name, or null if no such parameter exists.

getParams

public java.util.Collection getParams()
Returns all parameters

info

public java.lang.String info()
Returns a human readable description of the ParamSet, including all parameters

input

public void input(java.io.InputStream in)
           throws JParamException
Reads values for all input parameter from given InputStream. Checks that all parameters have values.

input

public void input(java.io.InputStream in,
                  boolean check)
           throws JParamException
Reads values for all input parameter from given InputStream. If check is true, checks that all parameters have values.

input

public void input(java.lang.String[] args)
           throws JParamException
Reads values for all input parameter from 'args'. Checks that all parameters have values.

input

public void input(java.lang.String[] args,
                  boolean check)
           throws JParamException
Reads values for all input parameter from 'args'. If check is true, checks that all parameters have values.

check

public void check()
           throws JParamException
Checks that all parameters have values. Throws an exception if check fails.

output

public void output()
            throws JParamException
Writes all output parameters to outStream

output

public void output(java.io.PrintStream out)
            throws JParamException
Writes all output parameters to given PrintStream.

write_feedback

public void write_feedback()

notifyAssignment

public void notifyAssignment(java.lang.String name,
                             TreeNode value)
                      throws JParamException
Called by parser for each assignemnt to value set.
Specified by:
notifyAssignment in interface AssignmentListener

setOutput

public void setOutput(java.io.PrintStream outStream)

warning_is_error

public void warning_is_error(boolean b)

ignore_unexpected

public void ignore_unexpected(boolean b)

feedback_enabled

public void feedback_enabled(boolean b)

max_feedback_length

public void max_feedback_length(int i)

set_feedback_stream

public void set_feedback_stream(java.io.PrintStream ps)


Copyright © 2004 SourceForge. All Rights Reserved.