|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--org.omegahat.Environment.Utils.OrderedTable
|
+--org.omegahat.DataStructures.Data.DataFrame
Represents a collection of VariableInt
objects as a named group for accessing them individually
or in sub-groups,
indexable by name, and reducable/subsettable by
observation index or observation name.
| Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
| Field Summary | |
protected java.util.Hashtable |
metaData
|
protected boolean |
readHeader
|
protected java.lang.String[] |
rowNames
An ordered collection of identifiers for the different records in the dataset. |
static VariableInt |
UnknownVariable
|
| Fields inherited from class org.omegahat.Environment.Utils.OrderedTable |
listeners, name, orderedElements, orderedKeys, state |
| Fields inherited from interface org.omegahat.Environment.Databases.Database |
ALL, ASSIGN, ATTACH, DETACH, NULL_ENTRY, READ, READ_WRITE, REMOVE |
| Fields inherited from interface org.omegahat.Environment.Databases.Activable |
ACTIVE, INACTIVE |
| Constructor Summary | |
DataFrame()
Constructor that provides no information about the number or types of variables or the number of observations. |
|
DataFrame(EventDataScanner scanner)
Reads the contents of the data from the specified scanner by being notified when a complete record has been consumed by the scanner. |
|
DataFrame(EventDataScanner scanner,
boolean readHeader)
|
|
DataFrame(java.io.File file)
|
|
DataFrame(java.io.File file,
boolean readHeader)
|
|
DataFrame(java.io.InputStream stream)
Reads the values from the specified stream by converting it to a reader and then creating a EventDataScanner. |
|
DataFrame(java.io.InputStream stream,
boolean readHeader)
|
|
DataFrame(int l)
Constructor specifying the number of records that will be in this dataset. |
|
DataFrame(int l,
Database dbase)
Constructor specifying the number of records that will be in this dataset and a database containing variables to which should be added to this dataset. |
|
DataFrame(java.lang.Integer l)
Constructor specifying the number of records that will be in this dataset. |
|
DataFrame(java.io.Reader reader)
Reads the values from the specified connection/stream. |
|
DataFrame(java.io.Reader reader,
boolean readHeader)
|
|
| Method Summary | |
int |
add(java.util.Collection col)
Treat the entries in the collection as components of a single record and append them to the corresponding variables, using the default ordering of the variable names |
int |
add(java.util.Iterator els)
Process each element in the iterator as an element in a record by adding it to the variable identified by the corresponding variable identified using the default names. |
int |
add(java.util.Iterator els,
java.lang.String[] names)
Process each element in the iterator by adding it to the variable identified by the corresponding element in name. |
void |
add(java.lang.String name)
|
void |
add(java.lang.String name,
VariableInt v)
|
VariableInt |
addVariable(java.lang.String name,
VariableInt var)
Extract the specified variable identified by name. |
VariableInt |
createDefaultVariable(java.lang.String name)
|
VariableInt |
createDefaultVariable(java.lang.String name,
int num)
|
VariableInt |
createVariable(int which)
|
protected VariableInt |
createVariable(java.lang.Object obj)
This creates a VariableInt object
of the appropriate class based on the type of
the argument obj. |
protected int |
createVariables(int howMany)
Create generic RealVariable objects
and give each the name Vari
where i runs from 1 to howMany |
java.lang.Object[] |
get(int obsNo)
|
DataFrame |
get(int[] obsNos)
|
DataFrame |
get(int[] obsNos,
java.lang.String[] name)
|
DataFrame |
get(java.lang.String[] name)
|
boolean |
getReadHeader()
Accessor for readHeader field |
VariableInt |
getVariable(java.lang.String name)
Extract the specified variable identified by name. |
java.lang.String[] |
getVariableNames()
Return a (ordered) list of the names of the variables contained in this collection. |
java.util.Hashtable |
metaData()
Accessor for metaData field |
java.util.Hashtable |
metaData(java.util.Hashtable value)
Accessor for setting metaData field |
boolean |
newRecord(java.lang.Object value,
ObjectReader source)
Notification event called by a EventDataScanner
when it has read a complete record. |
long |
numObservations()
Return the number of observations available in each of the variables. |
long |
numVariables()
Return the number of variables contained in this frame. |
long |
read(EventDataScanner scanner,
boolean readHeader)
Reads the records/observations for the data frame one at a time by being notified by the scanner. |
java.lang.String |
rowName(java.lang.String value,
int which)
|
java.lang.String[] |
rowNames()
Returns an array of the identifiers of the row names. |
java.lang.String[] |
rowNames(java.io.InputStream stream)
|
java.lang.String[] |
rowNames(java.lang.String[] value)
|
java.lang.String[] |
rowNames(java.util.Vector v)
|
boolean |
setNames(java.util.Collection els)
|
boolean |
setReadHeader(boolean value)
Accessor for setting readHeader field |
BasicFrameInt |
subsetObservations(int[] whichRows)
Create a new data frame consisting of the rows identified in the array passed to this method. |
BasicFrameInt |
subsetObservations(int start,
int which)
Get the subset of the data frame of the continguous rows starting at start and ending at which, inclusive. |
java.lang.String |
toString()
|
| Methods inherited from class org.omegahat.Environment.Utils.OrderedTable |
add, add, addListListener, assign, assignSubset, attach, clear, copy, copy, detach, elementAt, exists, get, getName, getState, keys, listeners, listeners, notifyListeners, objects, ordered, orderedKeys, put, put, put, remove, remove, removeElement, removeElement, removeElementAt, removeElementAt, removeListListener, setElementAt, setName, setState, subset, subset, subset |
| Methods inherited from class java.util.Hashtable |
clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, rehash, size, values |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.omegahat.Environment.Databases.Database |
assign, attach, clear, detach, exists, get, getName, objects, remove, setName, size |
| Methods inherited from interface org.omegahat.Environment.Databases.Activable |
getState, setState |
| Field Detail |
public static VariableInt UnknownVariable
protected java.lang.String[] rowNames
protected boolean readHeader
protected java.util.Hashtable metaData
| Constructor Detail |
public DataFrame()
public DataFrame(java.lang.Integer l)
public DataFrame(int l)
public DataFrame(int l,
Database dbase)
public DataFrame(EventDataScanner scanner)
public DataFrame(EventDataScanner scanner,
boolean readHeader)
public DataFrame(java.io.Reader reader,
boolean readHeader)
public DataFrame(java.io.Reader reader)
#read(org.omegahat.Environment.Tools.EventDataScanner,boolean)public DataFrame(java.io.InputStream stream)
EventDataScanner.read(org.omegahat.Environment.Tools.DataScanner.EventDataScanner,boolean)
public DataFrame(java.io.InputStream stream,
boolean readHeader)
#read(org.omegahat.Environment.Tools.EventDataScanner,boolean)
public DataFrame(java.io.File file,
boolean readHeader)
throws java.io.FileNotFoundException
public DataFrame(java.io.File file)
throws java.io.FileNotFoundException
| Method Detail |
public java.lang.String[] getVariableNames()
BasicFrameIntgetVariableNames in interface BasicFrameInt
public void add(java.lang.String name,
VariableInt v)
throws java.lang.Exception
public java.lang.Object[] get(int obsNo)
public DataFrame get(java.lang.String[] name)
throws java.lang.Exception
public DataFrame get(int[] obsNos)
throws java.lang.Exception
public DataFrame get(int[] obsNos,
java.lang.String[] name)
throws java.lang.Exception
public long numObservations()
BasicFrameIntnumObservations in interface BasicFrameIntpublic long numVariables()
BasicFrameIntnumVariables in interface BasicFrameIntpublic VariableInt getVariable(java.lang.String name)
BasicFrameIntgetVariable in interface BasicFrameInt
public VariableInt addVariable(java.lang.String name,
VariableInt var)
BasicFrameIntaddVariable in interface BasicFrameIntpublic boolean setNames(java.util.Collection els)
public java.lang.String toString()
toString in class java.util.Hashtablepublic boolean getReadHeader()
readHeader fieldpublic boolean setReadHeader(boolean value)
readHeader fieldpublic java.lang.String[] rowNames()
BasicFrameIntrowNames in interface BasicFrameIntpublic java.lang.String[] rowNames(java.lang.String[] value)
public java.lang.String[] rowNames(java.util.Vector v)
public java.util.Hashtable metaData()
metaData fieldmetaData in interface DataFrameIntpublic java.util.Hashtable metaData(java.util.Hashtable value)
metaData fieldprotected VariableInt createVariable(java.lang.Object obj)
VariableInt object
of the appropriate class based on the type of
the argument obj.
In this implementation, if this is a number, we create
a RealVariable, and if it is a
String we create a
FactorVariable.protected int createVariables(int howMany)
RealVariable objects
and give each the name Vari
where i runs from 1 to howManypublic VariableInt createVariable(int which)
public VariableInt createDefaultVariable(java.lang.String name,
int num)
public VariableInt createDefaultVariable(java.lang.String name)
public void add(java.lang.String name)
public java.lang.String[] rowNames(java.io.InputStream stream)
throws java.io.IOException
rowNames in interface BasicFrameInt
public java.lang.String rowName(java.lang.String value,
int which)
rowName in interface BasicFrameIntpublic BasicFrameInt subsetObservations(int[] whichRows)
DataFrameIntsubsetObservations in interface DataFrameInt
public BasicFrameInt subsetObservations(int start,
int which)
DataFrameIntsubsetObservations in interface DataFrameInt
public boolean newRecord(java.lang.Object value,
ObjectReader source)
EventDataScanner
when it has read a complete record.newRecord in interface RecordStreamListenerpublic int add(java.util.Collection col)
getVariableNames(),
add(java.util.Iterator,String[])public int add(java.util.Iterator els)
getVariableNames(),
add(java.util.Iterator,String[])
public int add(java.util.Iterator els,
java.lang.String[] names)
public long read(EventDataScanner scanner,
boolean readHeader)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||