Class cern.lhcias.csgui.Utils.dgslStatement

java.lang.Object
   |
   +----cern.lhcias.csgui.Utils.dgslStatement

public class dgslStatement
extends Object

This class is able to interpret a set of dgsl statements which are connected to
a parameter of a dgsl command. Such statements are in the form of "data streams"
- input data streams are typically used to change one of the parameters of the dgsl
command according to values contained in a "TagArrays"
- ouput data streams are typically used to affect TagArrays according to some user
action on the dgsl object created by the dgls command.

Data stream syntax:
data_stream


data_stream


input_data_stream


output_data_stream


condition


statement


validity



Examples:
a/ $d1
b/ $(default;$d1+3;)@d2
c/ $($d1<5;$d2+20;)$(default;100;)
b/ @($d5==1;d4=$input+$d6;)@d7$(default;100;)@($d1<5;d7;1,2,3)@(;d8=$input1+$input;)


Variable Index

 o COLOR
 
 o DOUBLE
 
 o FONT
 
 o IMAGE
 
 o INTEGER
 
 o LONGESTSTATEMENT
 
 o MAXSTREAM
 
 o SOUND
 
 o STRING
 

Constructor Index

 o dgslStatement(int, String, TagArrays)
Same as the other constructor but whitout the possibility to retrieve the parameter as an image or as a sound
 o dgslStatement(int, String, TagArrays, String, Panel)
 

Method Index

 o find_colors(String)

Given a color as a string, it returns the color as java.awt.Color
Possible string colors are:
white, blue, red, green, black, grey, yellow, orange, magenta
or #RRGGBB (in hexa)
 o find_font(String)
Given a font as a string, it returns the font as java.awt.Font
Possible string fonts are:
small, large
or fontname or fontname|fontsize (ex: Serif|18)
 o get_load_value()
if an error happens during the evaluation of the parameter or during
the setting of one of
the variables used in the parameter, then the method returns false.
 o getColorValue()
the method will return the evaluated value as a java.awt.Color It assumes a call to get_load_value has been made.
 o getDoubleValue()
the method will return the evaluated value as a double.
 o getFontValue()
the method will return the evaluated value as a java.awt.Font It assumes a call to get_load_value has been made.
 o getImageValue()
the method will return the evaluated value as a java.awt.Image It assumes a call to get_load_value has been made.
 o getInput_params()
This method returns the list of variables starting with "input" present in the parameter.
 o getIntValue()
the method will return the evaluated value as an int.
 o getOutputStreamNb()
returns the number of output streams present in the parameter
 o getOValidity()
returns the validity String.
 o getSoundValue()
the method will return the evaluated value as a symantec.itools.multimedia.SoundPlayer It assumes a call to get_load_value has been made.
 o getStringValue()
the method will return the evaluated value as a String It assumes a call to get_load_value has been made.
 o getTagNames()
This method returns the list of the variables (tags) in the parameter.
 o getTagNamesAsVector()
This method returns the list of the variables (tags) in the parameter.
 o getType()
returns the type of the parameter.
 o isConstant()
if the parameter doesn't contain any variable, it will return true.
 o replaceTags(String, Vector, TagArrays)

Given a string containing variables such as (3.1+$d1/2*(3+$d4)), it will
replace the variables in the string by their values.
 o setValues(Vector)
If there are any output stream, this method will evaluate the streams and send the result to the tc TagArrays.

Variables

 o MAXSTREAM

 public static final int MAXSTREAM

 o LONGESTSTATEMENT

 public static final int LONGESTSTATEMENT

 o INTEGER

 public static final int INTEGER

 o DOUBLE

 public static final int DOUBLE

 o STRING

 public static final int STRING

 o COLOR

 public static final int COLOR

 o IMAGE

 public static final int IMAGE

 o SOUND

 public static final int SOUND

 o FONT

 public static final int FONT

Constructors

 o dgslStatement

 public dgslStatement(int Type,
                      String param,
                      TagArrays ta,
                      String ImageURL,
                      Panel Pa)
Parameters:
Type - defines the type of the parameter. It can take one of the following value: INTEGER DOUBLE STRING COLOR IMAGE SOUND FONT
param - contains the statements
tc - is the TagArrays from where to take the values of the variables contained in the input streams and where to send the output streams.
ImageURL - is used as the Image Base location to get the images and the sounds from
Pa - is used to retrieve the images.

 o dgslStatement

 public dgslStatement(int Type,
                      String param,
                      TagArrays ta)
Same as the other constructor but whitout the possibility to retrieve the parameter as an image or as a sound

Methods

 o find_colors

 public static Color find_colors(String colorstr)

Given a color as a string, it returns the color as java.awt.Color
Possible string colors are:
white, blue, red, green, black, grey, yellow, orange, magenta
or #RRGGBB (in hexa)

 o find_font

 public static Font find_font(String fontstr)
Given a font as a string, it returns the font as java.awt.Font
Possible string fonts are:
small, large
or fontname or fontname|fontsize (ex: Serif|18)

 o replaceTags

 public static String replaceTags(String ligne,
                                  Vector Values,
                                  TagArrays tc)

Given a string containing variables such as (3.1+$d1/2*(3+$d4)), it will
replace the variables in the string by their values.
If d1 holds 2.3 and d4 holds 1, then it will return something like
(3.1+2.3/2*(3+1))
The values can be passed to the method in the Values Vector. The vector
contains n couples of string: one couple consists of the name of the variable
and its value. Ex: Values may contain {d1,2.3,d4,1}
If the variable is not found in the Vector, the method will attempt

In case of failure, a null is returned.

 o getTagNames

 public String getTagNames()
This method returns the list of the variables (tags) in the parameter.
The names of the variables are separated by commas in the returned String.
ex: d1,d2,d3

 o getTagNamesAsVector

 public Vector getTagNamesAsVector()
This method returns the list of the variables (tags) in the parameter.

 o getType

 public int getType()
returns the type of the parameter. The type is one of the following constant: (final static int) INTEGER DOUBLE STRING COLOR IMAGE SOUND FONT

 o isConstant

 public boolean isConstant()
if the parameter doesn't contain any variable, it will return true.
In the other case, it will return false.
Ex: (1+$d1) -> false
32 -> true
(32+2) -> true

 o get_load_value

 public boolean get_load_value()
if an error happens during the evaluation of the parameter or during
the setting of one of
the variables used in the parameter, then the method returns false.
If all the variables are correctly set or if the parameter
is constant, then it returns true.
This method must absolutely be called prior to get the evaluated
value of the parameter with one of the getXXXValue

 o getIntValue

 public int getIntValue()
the method will return the evaluated value as an int. It assumes a call to get_load_value has been made.

 o getDoubleValue

 public double getDoubleValue()
the method will return the evaluated value as a double. It assumes a call to get_load_value has been made.

 o getStringValue

 public String getStringValue()
the method will return the evaluated value as a String It assumes a call to get_load_value has been made.

 o getColorValue

 public Color getColorValue()
the method will return the evaluated value as a java.awt.Color It assumes a call to get_load_value has been made.

 o getFontValue

 public Font getFontValue()
the method will return the evaluated value as a java.awt.Font It assumes a call to get_load_value has been made.

 o getImageValue

 public Image getImageValue()
the method will return the evaluated value as a java.awt.Image It assumes a call to get_load_value has been made.

 o getSoundValue

 public SoundPlayer getSoundValue()
the method will return the evaluated value as a symantec.itools.multimedia.SoundPlayer It assumes a call to get_load_value has been made.

 o getOutputStreamNb

 public int getOutputStreamNb()
returns the number of output streams present in the parameter

 o getInput_params

 public Vector getInput_params()
This method returns the list of variables starting with "input" present in the parameter. It returns this list in the form of a Vector of Strings.

 o setValues

 public void setValues(Vector Values)
If there are any output stream, this method will evaluate the streams and send the result to the tc TagArrays. The variables values can be passed to the method in the Values Vector.
The vector contains n couples of string: one couple consists of the name of the variable and its value. Ex: Values may contain {d1,2.3,d4,1}
If the variable is not found in the Vector, the method will attempt to retrieve it from the tc TagArrays (if tc is not null).

 o getOValidity

 public String getOValidity()
returns the validity String. If the validity string contains a variable, it will be replaced first by the content of this variable