edu.ksu.cis.kdd.data
Class Table

java.lang.Object
  extended byedu.ksu.cis.kdd.data.Table
All Implemented Interfaces:
java.lang.Cloneable, Data

public class Table
extends java.lang.Object
implements java.lang.Cloneable, Data

Author:
Roby Joehanes

Field Summary
static java.lang.String ARFF_FORMAT
           
protected  java.util.LinkedList attributes
           
protected  int classIndex
           
static java.lang.String CSF_FORMAT
           
static java.lang.String DAT_FORMAT
           
protected  boolean fixedLength
           
static java.lang.String LIBB_FORMAT
           
protected  java.lang.String name
           
protected  Database owner
           
protected  TableProperty property
           
protected  TableTally tally
           
protected  java.util.LinkedList tuples
           
static java.lang.String XML_FORMAT
           
 
Constructor Summary
Table()
           
Table(boolean isFixed)
           
 
Method Summary
 void addAttribute(Attribute attr)
           
 void addAttributes(java.util.List attributeList)
           
 void addTuple(Tuple tuple)
           
 java.lang.Object clone()
          Table are cloned, but list of attributes are not!
 Table get(int start, int end)
           
 Table getAllExcept(int start, int end)
           
 Attribute getAttribute(int index)
           
 Attribute getAttribute(java.lang.String name)
           
 int getAttributeIndex(Attribute attr)
           
 int getAttributeIndex(java.lang.String attrName)
           
 java.util.List getAttributeNames()
           
 java.util.List getAttributes()
           
 Attribute getClassAttribute()
           
 int getClassIndex()
           
 Table getFirst(int n)
          Get the first n tuples
 Table getLast(int n)
          Get the last n tuples
 java.lang.String getName()
          Returns the name.
 Database getOwner()
           
 java.util.List getPrimaryKeys()
           
 TableProperty getProperty()
          Returns the property.
 java.util.List getReferenceKeys()
           
 java.util.List getRelevantAttributes()
           
 java.util.List getTableAttributes()
           
 Tally getTallyer()
           
 Tuple getTuple(int index)
           
 java.util.List getTuples()
           
 double[] getWeights()
          get the weights of all instances
 boolean isFixedLength()
          Returns the fixedLength.
 boolean isRemote()
          Returns the isRemote.
static Table load(java.lang.String filename)
           
static Table load(java.lang.String filename, java.lang.String format)
           
static void main(java.lang.String[] args)
           
 void randomizeSequence()
           
 void randomizeSequence(long seed)
           
 void remove(int start, int end)
           
 void removeAttribute(Attribute attr)
           
 void removeAttributes(java.util.List attributeList)
           
 void removeTuple(Tuple tuple)
           
 void save(java.io.OutputStream out, java.lang.String format)
           
 void save(java.lang.String filename)
           
 void save(java.lang.String filename, java.lang.String format)
          saves in different format
 void setAttributes(java.util.List newAttr)
           
 void setClassAttribute(Attribute attr)
           
 void setClassAttribute(int index)
           
 void setFixedLength(boolean fixedLength)
          Sets the fixedLength.
 void setName(java.lang.String name)
          Sets the name.
 void setOwner(Database db)
           
 void setProperty(TableProperty property)
          Sets the property.
 void setTuples(java.util.List newTuples)
           
 void setWeights(double[] weights)
          set the weights of all instances.
 int size()
           
 Data subsample(int n)
           
 Data subsample(int n, long seed)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tuples

protected java.util.LinkedList tuples

attributes

protected java.util.LinkedList attributes

classIndex

protected int classIndex

property

protected TableProperty property

fixedLength

protected boolean fixedLength

name

protected java.lang.String name

owner

protected Database owner

CSF_FORMAT

public static final java.lang.String CSF_FORMAT
See Also:
Constant Field Values

ARFF_FORMAT

public static final java.lang.String ARFF_FORMAT
See Also:
Constant Field Values

XML_FORMAT

public static final java.lang.String XML_FORMAT
See Also:
Constant Field Values

LIBB_FORMAT

public static final java.lang.String LIBB_FORMAT
See Also:
Constant Field Values

DAT_FORMAT

public static final java.lang.String DAT_FORMAT
See Also:
Constant Field Values

tally

protected TableTally tally
Constructor Detail

Table

public Table()

Table

public Table(boolean isFixed)
Method Detail

addTuple

public void addTuple(Tuple tuple)

addAttribute

public void addAttribute(Attribute attr)

removeTuple

public void removeTuple(Tuple tuple)

removeAttribute

public void removeAttribute(Attribute attr)

removeAttributes

public void removeAttributes(java.util.List attributeList)

addAttributes

public void addAttributes(java.util.List attributeList)

getTallyer

public Tally getTallyer()
Specified by:
getTallyer in interface Data

getTuple

public Tuple getTuple(int index)

getTuples

public java.util.List getTuples()
Specified by:
getTuples in interface Data

getWeights

public double[] getWeights()
get the weights of all instances

Specified by:
getWeights in interface Data
Returns:

setWeights

public void setWeights(double[] weights)
set the weights of all instances.

Specified by:
setWeights in interface Data
Returns:

getPrimaryKeys

public java.util.List getPrimaryKeys()

getReferenceKeys

public java.util.List getReferenceKeys()

subsample

public Data subsample(int n)
Specified by:
subsample in interface Data

subsample

public Data subsample(int n,
                      long seed)
Specified by:
subsample in interface Data

getFirst

public Table getFirst(int n)
Get the first n tuples


getLast

public Table getLast(int n)
Get the last n tuples


get

public Table get(int start,
                 int end)

getAllExcept

public Table getAllExcept(int start,
                          int end)

remove

public void remove(int start,
                   int end)

randomizeSequence

public void randomizeSequence(long seed)

randomizeSequence

public void randomizeSequence()

setTuples

public void setTuples(java.util.List newTuples)

setOwner

public void setOwner(Database db)

getOwner

public Database getOwner()

getAttribute

public Attribute getAttribute(int index)

getAttribute

public Attribute getAttribute(java.lang.String name)

getAttributeIndex

public int getAttributeIndex(Attribute attr)

getAttributeIndex

public int getAttributeIndex(java.lang.String attrName)

getAttributes

public java.util.List getAttributes()
Specified by:
getAttributes in interface Data

getRelevantAttributes

public java.util.List getRelevantAttributes()
Specified by:
getRelevantAttributes in interface Data

getAttributeNames

public java.util.List getAttributeNames()

getTableAttributes

public java.util.List getTableAttributes()

setAttributes

public void setAttributes(java.util.List newAttr)

getClassAttribute

public Attribute getClassAttribute()

getClassIndex

public int getClassIndex()

setClassAttribute

public void setClassAttribute(Attribute attr)

setClassAttribute

public void setClassAttribute(int index)

size

public int size()

toString

public java.lang.String toString()

getProperty

public TableProperty getProperty()
Returns the property.

Returns:
TuplesProperty

setProperty

public void setProperty(TableProperty property)
Sets the property.

Parameters:
property - The property to set

isFixedLength

public boolean isFixedLength()
Returns the fixedLength.

Returns:
boolean

setFixedLength

public void setFixedLength(boolean fixedLength)
Sets the fixedLength.

Parameters:
fixedLength - The fixedLength to set

clone

public java.lang.Object clone()
Table are cloned, but list of attributes are not!


getName

public java.lang.String getName()
Returns the name.

Specified by:
getName in interface Data
Returns:
String

setName

public void setName(java.lang.String name)
Sets the name.

Parameters:
name - The name to set

load

public static Table load(java.lang.String filename,
                         java.lang.String format)

load

public static Table load(java.lang.String filename)

save

public void save(java.lang.String filename)

save

public void save(java.lang.String filename,
                 java.lang.String format)
saves in different format

Parameters:
filename - name of the output file

save

public void save(java.io.OutputStream out,
                 java.lang.String format)

isRemote

public boolean isRemote()
Returns the isRemote.

Returns:
boolean

main

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