meshi.util
Class MeshiProgram

java.lang.Object
  extended by meshi.util.MeshiProgram
Direct Known Subclasses:
AbInitio, Beautify, CalcGDT, CalculateEnergyFromStructuresListAverages, ChooseTemplate, ColorByEnergy, DistanceMatrix, EnergyStatistics, EnergyStatisticsForAtom, HeliumClusterMinimization, HydrogenTest, InitialEvaluation, MergeCorpora, MinimizeProtein, ModelRanker, Optimize, Pdb2Fasta, Refine, RoisFirstMeshiProgram, RunThreadingExperiment, Scmod, SCMOD, SelectForCASP, SimplestMinimizeProtein, TestElectrostatics

public class MeshiProgram
extends java.lang.Object

The (suggested) superclass of programs using the meshi package. It includes a bunch of usefull static methods and global variables.


Nested Class Summary
private static class MeshiProgram.GlobalElement
          An element of the keyword-value table.
private static class MeshiProgram.GlobalElementList
          A keyword-value table
 
Field Summary
protected static java.lang.String commandLine
          The command line with which the program was called.
private static MeshiProgram.GlobalElementList globalTable
          After program initiation, stores all the information needed for program execution.
protected static java.lang.String name
          Program name.
private static java.util.Random randomNumberGenerator
          The single random number generator used by the program.
private static int seed
          The seed of the random number generator.
 
Constructor Summary
MeshiProgram()
           
 
Method Summary
static java.lang.String about()
          What you always wanted to know.
static boolean debug()
          Gets the boolean value associated with the keyword debug.
protected static java.lang.String get2ndString(java.lang.String line, java.lang.String commandsFileName)
           
static boolean getb(java.lang.String key)
          Gets the boolean value associated with the keyword key.
static java.lang.Boolean getB(java.lang.String key)
          Gets the Boolean value associated with the keyword key.
private static java.lang.String getCommandLine(java.lang.String[] args)
          Assembles the command-line string from an array of command-line-words.
static double getd(java.lang.String key)
          Gets the double value associated with the keyword key.
static java.lang.Double getD(java.lang.String key)
          Gets the Double value associated with the keyword key.
protected static boolean getFlag(java.lang.String key, java.lang.String[] args)
          Get a boolean flag Searcheds for a the keyword key in args.
protected static java.lang.String getFlagedArgument(java.lang.String key, java.lang.String[] args)
          Searcheds for a the keyword key in args.
static int geti(java.lang.String key)
          Gets the int value associated with the keyword key.
static java.lang.Integer getI(java.lang.String key)
          Gets the Integer value associated with the keyword key.
protected static java.lang.String getOrderedArgument(java.lang.String[] args)
          Removes the first string in args and returns it.
static java.lang.String getS(java.lang.String key)
          Gets the String value associated with the keyword key.
static java.lang.String getS(java.lang.String key, StringList commands, java.lang.String commandsFileName)
           
protected static void initRandom()
          Initializes the random number generator.
static void initRandom(int seed)
           
protected static int initRandom(java.lang.String[] argv)
           
static void printGlobalTable()
          Print the keyword - value table.
static java.util.Random randomNumberGenerator()
          Gets the program's random number generator.
static int seed()
           
protected static java.lang.Object tableGet(java.lang.String key)
          Gets the value associated with the keyword key.
static boolean tableIncludes(java.lang.String key)
           
protected static java.lang.Object tableSet(java.lang.String key, java.lang.Object value)
          Associate a value to a keyword.
 java.lang.String toString()
           
static boolean verbose()
          Gets the boolean value associated with the keyword verbose.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

globalTable

private static MeshiProgram.GlobalElementList globalTable
After program initiation, stores all the information needed for program execution. It is arranged as a list of (key,value) pairs


name

protected static java.lang.String name
Program name.


commandLine

protected static java.lang.String commandLine
The command line with which the program was called.


randomNumberGenerator

private static java.util.Random randomNumberGenerator
The single random number generator used by the program.


seed

private static int seed
The seed of the random number generator.

Constructor Detail

MeshiProgram

public MeshiProgram()
Method Detail

seed

public static int seed()

getFlag

protected static boolean getFlag(java.lang.String key,
                                 java.lang.String[] args)
Get a boolean flag Searcheds for a the keyword key in args. If the keyword is found returns true and removed from args. If the keyword is not found in args returns false.


getFlagedArgument

protected static java.lang.String getFlagedArgument(java.lang.String key,
                                                    java.lang.String[] args)
Searcheds for a the keyword key in args. If the keyword is found, it is removed from args. The folloing word (the associated value) is also removed and returned. If the keyword is not found in argsnull is returned.


getOrderedArgument

protected static java.lang.String getOrderedArgument(java.lang.String[] args)
Removes the first string in args and returns it.


tableSet

protected static java.lang.Object tableSet(java.lang.String key,
                                           java.lang.Object value)
Associate a value to a keyword.


tableIncludes

public static boolean tableIncludes(java.lang.String key)

tableGet

protected static java.lang.Object tableGet(java.lang.String key)
Gets the value associated with the keyword key.


getD

public static java.lang.Double getD(java.lang.String key)
Gets the Double value associated with the keyword key.


getI

public static java.lang.Integer getI(java.lang.String key)
Gets the Integer value associated with the keyword key.


getB

public static java.lang.Boolean getB(java.lang.String key)
Gets the Boolean value associated with the keyword key.


getS

public static java.lang.String getS(java.lang.String key)
Gets the String value associated with the keyword key.


getS

public static java.lang.String getS(java.lang.String key,
                                    StringList commands,
                                    java.lang.String commandsFileName)

get2ndString

protected static java.lang.String get2ndString(java.lang.String line,
                                               java.lang.String commandsFileName)

getd

public static double getd(java.lang.String key)
Gets the double value associated with the keyword key.


geti

public static int geti(java.lang.String key)
Gets the int value associated with the keyword key.


getb

public static boolean getb(java.lang.String key)
Gets the boolean value associated with the keyword key.


verbose

public static boolean verbose()
Gets the boolean value associated with the keyword verbose.


debug

public static boolean debug()
Gets the boolean value associated with the keyword debug.


randomNumberGenerator

public static java.util.Random randomNumberGenerator()
Gets the program's random number generator.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

initRandom

protected static void initRandom()
Initializes the random number generator.


initRandom

public static void initRandom(int seed)

initRandom

protected static int initRandom(java.lang.String[] argv)

about

public static java.lang.String about()
What you always wanted to know.


getCommandLine

private static java.lang.String getCommandLine(java.lang.String[] args)
Assembles the command-line string from an array of command-line-words.


printGlobalTable

public static void printGlobalTable()
Print the keyword - value table.