giden.GRDS
Class IndexArray

java.lang.Object
  |
  +--giden.GRDS.IndexArray
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
EdgeArray, NodeArray

public class IndexArray
extends java.lang.Object
implements java.io.Serializable

Copyright (c) 1993-2004 C. R. Coullard, D. S. Dilworth, J. H. Owen, All Rights Reserved.
We make no representations or warranties about the suitability of the software, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. We shall not be liable for any damages suffered by user as a result of using, modifying or distributing this software or its derivatives.

IndexArray is a base class that is inherited by the NodeArray and EdgeArray classes. An IndexArray stores and retrieves information using an object of type Index (e.g. Node and Edge). The length of the array is automatically resized to accomodate accesses that are beyond the size of the current array. The resizing involves creating a new array of a larger size, copying the contents of the old array to the new array, and then discarding the old array. Aside from time to resize the array, the resizing is transparent to the application.

Any type of Java Object can be stored in an IndexArray (including Node and Edge objects). A method is also provided to convert variables of type "int" into an object of type "Integer", and then store it in the IndexArray (methods for other types of non-objects may be added in the future).

Any type of supported variable can be stored using the overloaded Put method. Objects can be retrieved using the Get method and then casted to the appropriate type. Several methods are provided to perform this retrieve and cast operation (GetInt, GetNode, GetEdge).

Copyright (c) 1993-2003 C. R. Coullard, D. S. Dilworth, J. H. Owen, All Rights Reserved.

Version:
4.0a 2004 08 27
Author:
D. S. Dilworth
See Also:
EdgeArray, Index, Network, NodeArray, Serialized Form

Field Summary
static int ANY_TYPE
          Superset of all data types
static int DOUBLE_TYPE
          Double data type for IndexArray
static int EDGE_TYPE
          Edge data type for IndexArray
 java.lang.Object FillObject
          internal data member
 int FillType
          internal data member
static int FLOAT_TYPE
          Float data type for IndexArray
static int INTEGER_TYPE
          Integer data type for IndexArray
static int NODE_TYPE
          Node data type for IndexArray
static int STRING_TYPE
          String data type for IndexArray
 
Constructor Summary
IndexArray(int size, java.lang.String name)
          Creates an IndexArray with the given initial size and name and initializes the array components to null.
 
Method Summary
 void Fill(double value)
          Fills this array with the given double value
 void Fill(int value)
          Fills this array with the given integer value
 void Fill(java.lang.Object obj)
          Fills this array with the given Object
 java.lang.String GetAlias()
          Gets the alias String name of this array.
 double GetDouble(Index indexobject)
          Gets the double using the given Index object
 Edge GetEdge(Index indexobject)
          Gets the Edge using the given indexobject
 int GetInt(Index indexobject)
          Gets the integer using the given Index object
 java.lang.String GetName()
          Gets the String name of this array
 Node GetNode(Index indexobject)
          Gets the Node using the given Indexo bject
 java.lang.Object GetObj(Index indexobject)
          Gets the Object using the given Index object
 int GetSize()
          Gets the current size of this array
 java.lang.String GetString(Index indexobject)
          Gets the string using the given Index object
 giden.CORE.UiEdge GetUiEdge(Index indexobject)
          Gets the "DrawEdge" using the given indexobject
 giden.CORE.UiIndexArray GetUiIndexArray()
          internal method
 giden.CORE.UiNode GetUiNode(Index indexobject)
          Gets the "DrawNode" using the given indexobject
 boolean PutAlias(java.lang.String alias)
          Puts the alias String name for this array.
 void PutObj(Index indexobject, double value)
          Puts the double using the given Index object
 void PutObj(Index indexobject, int value)
          Puts the integer using the given Index object
 void PutObj(Index indexobject, java.lang.Object obj)
          Puts the Object using the given Index object
 void PutUiIndexArray(giden.CORE.UiIndexArray uiarray)
          internal method
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTEGER_TYPE

public static final int INTEGER_TYPE
Integer data type for IndexArray

FLOAT_TYPE

public static final int FLOAT_TYPE
Float data type for IndexArray

DOUBLE_TYPE

public static final int DOUBLE_TYPE
Double data type for IndexArray

STRING_TYPE

public static final int STRING_TYPE
String data type for IndexArray

NODE_TYPE

public static final int NODE_TYPE
Node data type for IndexArray

EDGE_TYPE

public static final int EDGE_TYPE
Edge data type for IndexArray

ANY_TYPE

public static final int ANY_TYPE
Superset of all data types

FillObject

public java.lang.Object FillObject
internal data member

FillType

public int FillType
internal data member
Constructor Detail

IndexArray

public IndexArray(int size,
                  java.lang.String name)
Creates an IndexArray with the given initial size and name and initializes the array components to null. If the given size is less than 100, then a size of 100 is used. Each array access is checked to determine whether it is beyond the bounds of the array. To accommodate array accesses beyond its bounds, the array is automatically resized, and the new components are initialized to the most recent Object used to Fill this array (default is null).
Parameters:
size - Initial size of the array
name - Name of the array
Method Detail

GetUiIndexArray

public giden.CORE.UiIndexArray GetUiIndexArray()
internal method

PutUiIndexArray

public void PutUiIndexArray(giden.CORE.UiIndexArray uiarray)
internal method

GetName

public java.lang.String GetName()
Gets the String name of this array
Returns:
The String name of this array

GetAlias

public java.lang.String GetAlias()
Gets the alias String name of this array. Solvers can temporarily rename an array it is saved as a result.
Returns:
The String name of this array

PutAlias

public boolean PutAlias(java.lang.String alias)
Puts the alias String name for this array. Used by solvers to temporarily rename an array before it is saved as a result. The alias name change only affects calls to GetAlias
Returns:
true if the Alias was previously null

GetSize

public int GetSize()
Gets the current size of this array
Returns:
The current size of the array. This value will change to accomodate accesses beyond its bounds.

Fill

public void Fill(int value)
Fills this array with the given integer value
Parameters:
value - The integer value to fill the array with

Fill

public void Fill(double value)
Fills this array with the given double value
Parameters:
value - The double value to fill the array with

Fill

public void Fill(java.lang.Object obj)
Fills this array with the given Object
Parameters:
obj - The Object to fill the array with

GetObj

public java.lang.Object GetObj(Index indexobject)
Gets the Object using the given Index object
Parameters:
indexobject - The Index object for this array
Returns:
The Object at the given Index in this array

PutObj

public void PutObj(Index indexobject,
                   java.lang.Object obj)
Puts the Object using the given Index object
Parameters:
indexobject - The Index object for this array
obj - The Object to store in the array

PutObj

public void PutObj(Index indexobject,
                   int value)
Puts the integer using the given Index object
Parameters:
indexobject - The object containing an array index
value - The integer value to store in this array

PutObj

public void PutObj(Index indexobject,
                   double value)
Puts the double using the given Index object
Parameters:
indexobject - The object containing an array index
value - The double value to store in this array

GetInt

public int GetInt(Index indexobject)
Gets the integer using the given Index object
Parameters:
indexobject - The object containing an array index
Returns:
The integer at the given index in this array

GetDouble

public double GetDouble(Index indexobject)
Gets the double using the given Index object
Parameters:
indexobject - The object containing an array index
Returns:
The double at the given index in this array

GetString

public java.lang.String GetString(Index indexobject)
Gets the string using the given Index object
Parameters:
indexobject - The object containing an array index
Returns:
The string at the given index in this array

GetNode

public Node GetNode(Index indexobject)
Gets the Node using the given Indexo bject
Parameters:
indexobject - The object containing an array index
Returns:
The Node at the given index in this array

GetEdge

public Edge GetEdge(Index indexobject)
Gets the Edge using the given indexobject
Parameters:
indexobject - The object containing an array index
Returns:
The Edge at the given index in this array

GetUiNode

public giden.CORE.UiNode GetUiNode(Index indexobject)
Gets the "DrawNode" using the given indexobject
Parameters:
indexobject - The object containing an array index
Returns:
The Color at the given index

GetUiEdge

public giden.CORE.UiEdge GetUiEdge(Index indexobject)
Gets the "DrawEdge" using the given indexobject
Parameters:
indexobject - The object containing an array index
Returns:
The Color at the given index