DJAVA

au.gov.aao.drama
Class Arg

java.lang.Object
  extended by au.gov.aao.drama.SdsID
      extended by au.gov.aao.drama.Arg
Direct Known Subclasses:
Sdp.Sds

public class Arg
extends SdsID

This class implements an interface to the AAO's DRAMA SDS Library Java equivalent to the Arg library interface to SDS.

See Self Defining Data System for full details on SDS, including Arg.

The main aim of the Arg class is to simplify access to SDS for particular styles of SDS structures - where we are interested in scaler or string values of a given name within the specified structure. Note that you have complete access to the normal SDS facilities.

Most but not all of the SdsID constructors are available as Arg contructors. You cannot read an SDS file directly into an Arg class item, due to a confict. In this case, you will have to create an intermediate SdsID class item and then access that using a new Arg item.

You should note that mutilple SDS ID's can refer to the one underlying SDS Structure.

Version:
@(#) $Id: ACMM:DramaJava/Arg.java,v 3.52 17-Sep-2009 14:08:21+10 tjf $
Author:
Tony Farrell
See Also:
DramaTask, SdsID

Nested Class Summary
static interface Arg.StructList
          This inteface is used by the Arg.List() method to print a single line when listing an SDS structure.
 
Field Summary
static String RCSID
          The RCS (ACMM) ID.
 
Fields inherited from class au.gov.aao.drama.SdsID
id, SDS_BYTE, SDS_CHAR, SDS_DOUBLE, SDS_FLOAT, SDS_I64, SDS_INT, SDS_SHORT, SDS_STRUCT, SDS_UBYTE, SDS_UI64, SDS_UINT, SDS_USHORT
 
Constructor Summary
Arg()
          Create a new Arg instance item including creation of the underlying SDS structure.
Arg(int item)
          Create an Arg instance using a C SDS ID value.
Arg(int item, boolean free)
          Create an Arg instance using a C SDS ID value, with free flag specified.
Arg(int item, boolean free, boolean delete)
          Create an Arg instance using a SDS C ID value, with free and delete flags.
Arg(int item, boolean free, boolean del, boolean readfree)
          Create an Arg instance using a SDS C ID value, with all flags specifyable.
Arg(SdsID source)
          Create a copy of an existing SDS item.
Arg(SdsID sdsID, boolean outlives)
          Create a new Arg instance refering to the same SDS item as an SdsID instance.
Arg(SdsID source, int index)
          Create an access to a existing SDS structure by index
Arg(SdsID array_id, int[] dims)
          Create an access to a cell of an existing SDS structure array.
Arg(SdsID sdsID, String name)
          Create a new Arg instance refering a component of an SDS structure.
Arg(SdsID parent_id, String name, int code)
          Create a new child ARG item (of an SDS structure).
Arg(SdsID parent_id, String name, int code, int[] dims)
          Create a new array child ARG item
Arg(String name)
          Create a new Arg instance item including creation of the underlying SDS structure.
Arg(String name, int code, int[] dims)
          Create a new array top-level ARG item
 
Method Summary
 boolean BoolValue(String Name)
          Return an boolean from a named Arg item.
 int IntValue(String Name)
          Return an integer (up to 32 bit value) from a named Arg item.
 void List(Arg.StructList obj)
          List an SDS structure using a line output object.
 long LongValue(String Name)
          Return a long (up to 64 bit value) from a named Arg item.
 void Put(String Name, boolean value)
          Put an boolean item into an Arg structure.
 void Put(String Name, char value)
          Put a char (8 bit) item into an Arg structure.
 void Put(String Name, double value)
          Put an double length floating point item into an Arg structure.
 void Put(String Name, int value)
          Put an int (32 bit) item into an Arg structure.
 void Put(String Name, long value)
          Put an long (64 bit) item into an Arg structure.
 void Put(String Name, short value)
          Put a short (16 bit) item into an Arg structure.
 void Put(String Name, String value)
          Put an string item into an Arg structure.
 double RealValue(String Name)
          Return an real from a named Arg item.
 String StringValue(String Name)
          Return an string from a named Arg item.
 
Methods inherited from class au.gov.aao.drama.SdsID
ClearDelete, ClearFree, ClearFreeIDWatch, ClearReadFree, Code, Debug, Debug, Debug, DeepCopy, Delete, Dims, EnableFreeIDWatch, Extract, FillArray, finalize, Get, Get, Get, Get, Get, Get, Get, Get, GetContructorLocation, ID, Insert, Insert, List, Name, Outlives, Put, Put, Put, Put, Put, Put, Rename, Resize, SetDebugging, SetDelete, SetFree, SetReadFree, ShallowCopyNoOutlive, ShallowCopyOutlive, StuffUp, toString, Write
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RCSID

public static final String RCSID
The RCS (ACMM) ID. This field returns the source code archive ID of this class's source file.

The returned string corresponds to the version string seen above (in the class description comments), but will contain the version details of the compiled class file's actual source file.

(ACMM is the source code archive system used by the AAO. If the string returned by RCSID does not contain the string ACMM, then it is likely the source code has been archived again outside the AAO).

See Also:
Constant Field Values
Constructor Detail

Arg

public Arg(int item)
Create an Arg instance using a C SDS ID value.

The underlying SDS structure is NOT deleted or ID freeed when the Java object is finalized.

Parameters:
item - An integer representation of an SDS/Arg ID.

Arg

public Arg(int item,
           boolean free)
Create an Arg instance using a C SDS ID value, with free flag specified.

The underlying SDS structure is NOT deleted when java object is finailized

Parameters:
item - An integer representation of an SDS/Arg ID.
free - Set true if SDS ID is to be freeed when the the Java object is finalized, false if this is not to be done.

Arg

public Arg(int item,
           boolean free,
           boolean delete)
Create an Arg instance using a SDS C ID value, with free and delete flags.

Parameters:
item - An integer representation of an SDS/Arg ID.
free - Set true if SDS ID is to be freeed when the the Java object is finalized, false if this is not to be done.
delete - Set true if underlying SDS structure is to be deleted when the the Java object is finalized, false if this is not to be done.

Arg

public Arg(int item,
           boolean free,
           boolean del,
           boolean readfree)
Create an Arg instance using a SDS C ID value, with all flags specifyable.

Note that is does not make sense for "delete" and "readfree" to both be true, but this is not checked as yet.

Parameters:
item - An integer representation of an SDS ID.
free - Set true if SDS ID is to be freeed when the the Java object is finalized, false if this is not to be done.
del - Set true if underlying SDS structure is to be deleted when the the Java object is finalized, false if this is not to be done.
readfree - Set true if SdsReadFree is to be invoked on the SDS ID when the object is finalized - used if ID is of an SDS structure which has been read from a file.

Arg

public Arg()
    throws DramaException
Create a new Arg instance item including creation of the underlying SDS structure.

The structure name will be ArgStructure.

Throws:
DramaException - Thrown on errors in the DRAMA code.

Arg

public Arg(String name)
    throws DramaException
Create a new Arg instance item including creation of the underlying SDS structure. The structure name is specified.

Parameters:
name - The name for the SDS structure to be created.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Arg

public Arg(SdsID sdsID,
           boolean outlives)
    throws DramaException
Create a new Arg instance refering to the same SDS item as an SdsID instance.

This is just a way of creating an Arg instance which refers to a SDS item for which we already have a pre-existing SdsID instance, thus extending the range of available functions.

Parameters:
sdsID - The SDS ID to copy.
outlives - If true, then this item will outlive the SdsID item and should keep hold of the underlying SDS item. If false, the SdsID item will outlive. Note that if you don't specify this argument at all, you will do a deep copy of the source SDS item.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Arg

public Arg(SdsID sdsID,
           String name)
    throws DramaException
Create a new Arg instance refering a component of an SDS structure.

This method provides a way of accessing using Arg an SDS structure contained within an existing SDS structure.

Parameters:
sdsID - The SDS ID to copy.
name - The name of the item.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Arg

public Arg(SdsID parent_id,
           String name,
           int code)
    throws DramaException
Create a new child ARG item (of an SDS structure).

Parameters:
parent_id - The SDS structure to create this item within.
name - The name of this new item
code - The SDS Code for the item type.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Arg

public Arg(SdsID parent_id,
           String name,
           int code,
           int[] dims)
    throws DramaException
Create a new array child ARG item

Parameters:
parent_id - The SDS structure to create this item within.
name - The name of this new item
code - The SDS Code for the item type.
dims - The dimensions. Maximum of 7.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Arg

public Arg(String name,
           int code,
           int[] dims)
    throws DramaException
Create a new array top-level ARG item

Parameters:
name - The name of this new item. Would normally be "ArgStructure" but does not have to be.
code - The SDS Code for the item type.
dims - The dimensions. Maximum of 7.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Arg

public Arg(SdsID array_id,
           int[] dims)
    throws DramaException
Create an access to a cell of an existing SDS structure array.

Parameters:
array_id - The SDS structure array we are accessing.
dims - The dimensions of the element we are accessing
Throws:
DramaException - Thrown on errors in the DRAMA code.

Arg

public Arg(SdsID source)
    throws DramaException
Create a copy of an existing SDS item. This does a deep copy - the SDS structure is duplicated

Parameters:
source - The structure we want to copy.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Arg

public Arg(SdsID source,
           int index)
    throws DramaException
Create an access to a existing SDS structure by index

Parameters:
source - The SDS structure we are accessing
index - The index to the item we want to access.
Throws:
DramaException - Thrown on errors in the DRAMA code.
Method Detail

Put

public void Put(String Name,
                char value)
         throws DramaException
Put a char (8 bit) item into an Arg structure.

Parameters:
Name - The name of the Arg item to insert in to/create.
value - The value to insert.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Put

public void Put(String Name,
                short value)
         throws DramaException
Put a short (16 bit) item into an Arg structure.

Parameters:
Name - The name of the Arg item to insert in to/create.
value - The value to insert.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Put

public void Put(String Name,
                int value)
         throws DramaException
Put an int (32 bit) item into an Arg structure.

Parameters:
Name - The name of the Arg item to insert in to/create.
value - The value to insert.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Put

public void Put(String Name,
                long value)
         throws DramaException
Put an long (64 bit) item into an Arg structure.

Parameters:
Name - The name of the Arg item to insert in to/create.
value - The value to insert.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Put

public void Put(String Name,
                double value)
         throws DramaException
Put an double length floating point item into an Arg structure.

Parameters:
Name - The name of the Arg item to insert in to/create.
value - The value to insert.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Put

public void Put(String Name,
                boolean value)
         throws DramaException
Put an boolean item into an Arg structure.

Parameters:
Name - The name of the Arg item to insert in to/create.
value - The value to insert.
Throws:
DramaException - Thrown on errors in the DRAMA code.

Put

public void Put(String Name,
                String value)
         throws DramaException
Put an string item into an Arg structure.

Parameters:
Name - The name of the Arg item to insert in to/create.
value - The value to insert.
Throws:
DramaException - Thrown on errors in the DRAMA code.

IntValue

public int IntValue(String Name)
             throws DramaException
Return an integer (up to 32 bit value) from a named Arg item.

Parameters:
Name - The name of the Arg item the value of which is to be returned.
Returns:
The value converted to a 32 bit value if possible.
Throws:
DramaException - Thrown on errors in the DRAMA code.

LongValue

public long LongValue(String Name)
               throws DramaException
Return a long (up to 64 bit value) from a named Arg item.

Parameters:
Name - The name of the Arg item the value of which is to be returned.
Throws:
DramaException - Thrown on errors in the DRAMA code.

RealValue

public double RealValue(String Name)
                 throws DramaException
Return an real from a named Arg item.

Parameters:
Name - The name of the Arg item the value of which is to be returned.
Returns:
The value converted to a 32 double floating point if possible.
Throws:
DramaException - Thrown on errors in the DRAMA code.

BoolValue

public boolean BoolValue(String Name)
                  throws DramaException
Return an boolean from a named Arg item.

Parameters:
Name - The name of the Arg item the value of which is to be returned.
Returns:
The value converted to a boolean value if possible
Throws:
DramaException - Thrown on errors in the DRAMA code.

StringValue

public String StringValue(String Name)
                   throws DramaException
Return an string from a named Arg item.

Parameters:
Name - The name of the Arg item the value of which is to be returned.
Returns:
The value converted to a string.
Throws:
DramaException - Thrown on errors in the DRAMA code.

List

public void List(Arg.StructList obj)
          throws DramaException
List an SDS structure using a line output object.

Similar to the SdsID.List() method, this method allows the specification of an object to be invoked to print each line, allowing output to be directed anywhere.

Parameters:
obj - The object who's PrintLine method is invoked for each line of output
Throws:
DramaException - Thrown on errors in the DRAMA code.

DJAVA

Click here for the DRAMA home page and here for the AAO home page.

For more information, contact tjf@aaoepp.aao.gov.au.