All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ch.swisslife.ibgm.mc2.Cfg

java.lang.Object
   |
   +----ch.swisslife.ibgm.mc2.Cfg

public class Cfg
extends Object
implements Cloneable
Java data structure for CFG files. Represents a CFG File with its targets. The tagets are stored in a Vector.


Constructor Index

 o Cfg()
Constructor for Class Cfg.
 o Cfg(String)
Constructor for Class Cfg with URL where file is stored.
 o Cfg(String, String)
Constructor for class CFG WorkDir and IconDir Parameters.
 o Cfg(String, String, String)
Constructor for class CFG with URL, WorkDir and IconDir Parameters.

Method Index

 o addTarget(Target)
Prepends a target to the vector and returns its index
 o clone()
Clones itself and its Objects.
 o deleteTarget(int)
Deletes the target; int Version.
 o deleteTarget(String)
Deletes the target; String Version.
 o existTarget(int)
Checks whether a Target exists (is in vector) or not; int version.
 o existTarget(String)
Checks whether a Target exists (is in vector) or not; String version.
 o getIndex(String)
Returns the index of this target.
 o getNumberOfTargets()
Gets the number of targets in this Cfg file.
 o getValue(int, String)
Gets a value of the Target; int version.
 o getValue(String)
Gets the "global" fields stored in this Cfg file directly.
 o getValue(String, String)
Gets a value of the Target; String version.
 o isEmpty()
Tests if the vector is empty, which means no targets in Cfg file.
 o main(String[])
Main method of this class; used for testing only.
 o newTarget(String)
Creates new Target, prepends it to the vector and returns its index
 o setValue(int, String, String)
Sets a value of this target; int version.
 o setValue(String, String)
Sets one of the values stored in the Cfg file directly.
 o setValue(String, String, String)
Sets a value of this target; String version.

Constructors

 o Cfg
 public Cfg()
Constructor for Class Cfg. Does nothing than call the constructor of the super class.

 o Cfg
 public Cfg(String url)
Constructor for Class Cfg with URL where file is stored.

Parameters:
url - String containing URL of storage location of this Cfg file
 o Cfg
 public Cfg(String url,
            String wd,
            String id)
Constructor for class CFG with URL, WorkDir and IconDir Parameters. Usually, the IconDir and WorkDir location doesn't change, so it can be specified in the constructor.

Parameters:
url - String containing URL of storage location of this Cfg file
wd - String containing URL of WorkDir
id - String containing URL of IconDir
 o Cfg
 public Cfg(String wd,
            String id)
Constructor for class CFG WorkDir and IconDir Parameters. Usually, the IconDir and WorkDir location doesn't change, so it can be specified in the constructor.

Parameters:
wd - String containing URL of WorkDir
id - String containing URL of IconDir

Methods

 o clone
 public Object clone() throws CloneNotSupportedException
Clones itself and its Objects.

Returns:
A CFG as a copy of itself
Overrides:
clone in class Object
 o newTarget
 public int newTarget(String name)
Creates new Target, prepends it to the vector and returns its index

Parameters:
name - String containing name of this target
Returns:
int which contains the position of this target in the vector
 o addTarget
 public int addTarget(Target t)
Prepends a target to the vector and returns its index

Parameters:
name - String containing name of this target
Returns:
int which contains the position of this target in the vector
 o getIndex
 public int getIndex(String name)
Returns the index of this target.

Parameters:
name - String with the name of this target ("Target" = x)
Returns:
int with position of the target if target in vector; -1 otherwise.
 o deleteTarget
 public void deleteTarget(String name)
Deletes the target; String Version. Does the other elements to change position in the vector?

Parameters:
name - String with name of this target.
 o deleteTarget
 public void deleteTarget(int i)
Deletes the target; int Version. Does the other elements to change position in the vector?

Parameters:
i - int with position of this target in vector.
 o existTarget
 public boolean existTarget(String name)
Checks whether a Target exists (is in vector) or not; String version.

Parameters:
name - String with name of this target.
Returns:
true if targets exist, false otherwise.
 o existTarget
 public boolean existTarget(int i)
Checks whether a Target exists (is in vector) or not; int version.

Parameters:
i - int with position of this target in vector.
Returns:
true if targets exist, false otherwise.
 o getValue
 public String getValue(String name,
                        String option)
Gets a value of the Target; String version. Uses Target.getValue; avoids calling it directly.

Parameters:
name - String with name of this target
option - String with name of the option asked for
Returns:
String with the value of the option asked for
 o getValue
 public String getValue(int i,
                        String option)
Gets a value of the Target; int version. Uses Target.getValue; avoids calling it directly.

Parameters:
i - int with position of this target in vector
option - String with name of the option asked for
Returns:
String with the value of the option asked for
 o getValue
 public String getValue(String arg)
Gets the "global" fields stored in this Cfg file directly. Note: the only difference to the other setValue methods is the number of arguments!

Parameters:
arg - String with the name of the value asked for
 o getNumberOfTargets
 public int getNumberOfTargets()
Gets the number of targets in this Cfg file.

Returns:
int with number of targets in this Cfg file.
 o setValue
 public boolean setValue(String name,
                         String option,
                         String value)
Sets a value of this target; String version.

Parameters:
name - String with the name of this target
option - String with the name of the option to set
value - String with the value to be set
Returns:
true if successfull, false otherwise.
 o setValue
 public boolean setValue(int i,
                         String Option,
                         String Value)
Sets a value of this target; int version.

Parameters:
i - int with the position of this target in vector
option - String with the name of the option to set
value - String with the value to be set
Returns:
true if successfull, false otherwise.
 o setValue
 public boolean setValue(String arg,
                         String value)
Sets one of the values stored in the Cfg file directly. Note: the only difference to the other setValue methods is the number of arguments!

Parameters:
arg - String with the name of the field to set
value - String containin the value to be set
Returns:
true if successful, false otherwise
 o isEmpty
 public boolean isEmpty()
Tests if the vector is empty, which means no targets in Cfg file.

Returns:
true if empty, false otherwise.
 o main
 public static void main(String argv[])
Main method of this class; used for testing only. Calls test

Parameters:
argv[] - String argument vector; not used, just for compatibility,

All Packages  Class Hierarchy  This Package  Previous  Next  Index