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.
-
Cfg()
- Constructor for Class Cfg.
-
Cfg(String)
- Constructor for Class Cfg with URL where file is stored.
-
Cfg(String, String)
- Constructor for class CFG WorkDir and IconDir Parameters.
-
Cfg(String, String, String)
- Constructor for class CFG with URL, WorkDir and IconDir Parameters.
-
addTarget(Target)
- Prepends a target to the vector and returns its index
-
clone()
- Clones itself and its Objects.
-
deleteTarget(int)
- Deletes the target; int Version.
-
deleteTarget(String)
- Deletes the target; String Version.
-
existTarget(int)
- Checks whether a Target exists (is in vector) or not; int version.
-
existTarget(String)
- Checks whether a Target exists (is in vector) or not; String version.
-
getIndex(String)
- Returns the index of this target.
-
getNumberOfTargets()
- Gets the number of targets in this Cfg file.
-
getValue(int, String)
- Gets a value of the Target; int version.
-
getValue(String)
- Gets the "global" fields stored in this Cfg file directly.
-
getValue(String, String)
- Gets a value of the Target; String version.
-
isEmpty()
- Tests if the vector is empty, which means no targets in Cfg file.
-
main(String[])
- Main method of this class; used for testing only.
-
newTarget(String)
- Creates new Target, prepends it to the vector and returns its index
-
setValue(int, String, String)
- Sets a value of this target; int version.
-
setValue(String, String)
- Sets one of the values stored in the Cfg file directly.
-
setValue(String, String, String)
- Sets a value of this target; String version.
Cfg
public Cfg()
- Constructor for Class Cfg. Does nothing than call the constructor of the super class.
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
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
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
clone
public Object clone() throws CloneNotSupportedException
- Clones itself and its Objects.
- Returns:
- A CFG as a copy of itself
- Overrides:
- clone in class Object
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
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
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.
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.
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.
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.
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.
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
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
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
getNumberOfTargets
public int getNumberOfTargets()
- Gets the number of targets in this Cfg file.
- Returns:
- int with number of targets in this Cfg file.
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.
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.
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
isEmpty
public boolean isEmpty()
- Tests if the vector is empty, which means no targets in Cfg file.
- Returns:
-
true
if empty, false
otherwise.
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