com.fdsapi.arrays
Class ArrayHeaderLocator

java.lang.Object
  |
  +--com.fdsapi.arrays.ArrayHeaderLocator
All Implemented Interfaces:
java.lang.Cloneable

public class ArrayHeaderLocator
extends java.lang.Object
implements java.lang.Cloneable

This class is used internal to the ArrayFilter, and ArrayComparator classes to allow them to locate array entries by a column lable as opposed to an index. The contsructor takes an array of header names, and one method converts the name to an index based on the position the name has in the array. Another method allows you to associate a column name with an index position even if you don't want/need to provide the whole header array. Note column names are case insensitive (i.e. fname is the same as FName)



View Code


Field Summary
 int NOT_IN_HEADER
           
 
Constructor Summary
ArrayHeaderLocator()
           
ArrayHeaderLocator(boolean throwExceptions)
           
ArrayHeaderLocator(java.lang.String[] header)
           
ArrayHeaderLocator(java.lang.String[] header, boolean throwExceptions)
           
 
Method Summary
 java.lang.Object clone()
          Clone this factory
 boolean containsColName(java.lang.String colName)
          Returns true if the this column name is valid
 boolean containsColNum(int index)
          Returns true if the this column number is valid
 ArrayHeaderLocator copy()
          Clones the object and then casts it to the appropriate type
 java.lang.String getColName(int index)
          Return the column name associated with the passed in index (i.e.
 int getColNum(java.lang.String columnName)
          Returns the column number when passed a column name that matches the header array passed into the Constructor
 boolean getThrowExceptions()
           
static void main(java.lang.String[] args)
           
 void setColName(java.lang.String columnName, int index)
          Allows you to explicitly associate a named label with a column index for the array (starting at 0).
 void setThrowExceptions(boolean throwExceptions)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_IN_HEADER

public final int NOT_IN_HEADER
See Also:
Constant Field Values
Constructor Detail

ArrayHeaderLocator

public ArrayHeaderLocator()

ArrayHeaderLocator

public ArrayHeaderLocator(boolean throwExceptions)

ArrayHeaderLocator

public ArrayHeaderLocator(java.lang.String[] header)

ArrayHeaderLocator

public ArrayHeaderLocator(java.lang.String[] header,
                          boolean throwExceptions)
Method Detail

getColNum

public int getColNum(java.lang.String columnName)
Returns the column number when passed a column name that matches the header array passed into the Constructor


setThrowExceptions

public void setThrowExceptions(boolean throwExceptions)

getThrowExceptions

public boolean getThrowExceptions()

getColName

public java.lang.String getColName(int index)
Return the column name associated with the passed in index (i.e. starts at 0)


containsColNum

public boolean containsColNum(int index)
Returns true if the this column number is valid


containsColName

public boolean containsColName(java.lang.String colName)
Returns true if the this column name is valid


setColName

public void setColName(java.lang.String columnName,
                       int index)
Allows you to explicitly associate a named label with a column index for the array (starting at 0). This is useful if you don't want to provide a whole header in the contructor, but would like to refer to a column or 2 by name. Note after calling this method you will be able to get a column index if passed a column name, or vice versa.


clone

public java.lang.Object clone()
Clone this factory

Overrides:
clone in class java.lang.Object

copy

public ArrayHeaderLocator copy()
Clones the object and then casts it to the appropriate type


toString

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

main

public static void main(java.lang.String[] args)