proper.database
Class Writer

java.lang.Object
  extended by proper.core.ProperObject
      extended by proper.database.ConnectorObject
          extended by proper.database.Writer
All Implemented Interfaces:
ProperInterface

public class Writer
extends ConnectorObject

This class is used for writing a table to an ARFF-file.

Version:
$Revision: 1.2 $
Author:
FracPete

Field Summary
static boolean USE_TOSTRING
          whether to use the memory consuming Instances.toString() method for writing the instances to a file
 
Fields inherited from interface proper.core.ProperInterface
VERSION
 
Constructor Summary
Writer(Connector conn)
          initializes the object
Writer(Connector conn, java.lang.String table, java.lang.String field)
          initializes the object
 
Method Summary
 java.lang.String getField()
          returns the field used as class
 java.lang.String getFieldList()
          returns the list of fields to retrieve (comma separated list)
 java.lang.String getFilename()
          returns the name of the output file
 weka.core.Instances getInstances()
          returns the instances
 java.lang.String getNominalList()
          returns the list of fields to treat additionally as nominals (comma separated list)
 java.lang.String getNoNullsList()
          returns the list of fields where no NULL values are allowed
 java.lang.String getOrderBy()
          returns the field used for ordering
 double getPercentage()
          returns the currently set percentage to retrieve from the table.
 java.lang.String getRelationName()
          returns the name of the relation
 boolean getSort()
          returns whether the attributes are sorted or not
 java.lang.String getTable()
          returns the name of the table to read from
 void setField(java.lang.String field)
          sets the field to use as class
 void setFieldList(java.lang.String fields)
          sets the list (comma separated) of fields to retrieve in this order from the table
 void setFilename(java.lang.String filename)
          sets the name of the output file
 void setInstances(weka.core.Instances instances)
          sets the instancs to write
 void setNominalList(java.lang.String fields)
          sets the list (comma separated) of fields to treat additionally as nominals the table
 void setNoNullsList(java.lang.String fields)
          sets the list (comma separated) of fields where no NULL values are allowed
 void setOrderBy(java.lang.String orderBy)
          sets the fields to order by (only ASC!)
 void setPercentage(double percentage)
          sets the percentage of instances we want to retrieve from the table.
 void setRelationName(java.lang.String relation)
          sets the name of the relation
 void setSort(boolean sort)
          sets whether to sort the attributes or not
 void setTable(java.lang.String table)
          sets the name of the table to use
 void write()
          writes the instances from the table to an ARFF-file
 void write(weka.core.Instances instances)
          writes the given instances to an ARFF-file.
 
Methods inherited from class proper.database.ConnectorObject
getConnector
 
Methods inherited from class proper.core.ProperObject
addListener, addOutput, classInVerbose, debugprint, debugprint, debugprint, debugprint, debugprintln, debugprintln, debugprintln, debugprintln, debugprintln, getListeners, getRuntime, getVerbose, getVerboseLevel, getVerboseLevelForClass, getVerboseString, getVerboseStringForClass, notifyListener, notifyListeners, print, print, print, print, println, println, println, println, println, printMemory, removeListener, setOutput, setVerbose, setVerboseLevel, setVerboseString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

USE_TOSTRING

public static final boolean USE_TOSTRING
whether to use the memory consuming Instances.toString() method for writing the instances to a file

See Also:
Constant Field Values
Constructor Detail

Writer

public Writer(Connector conn)
initializes the object

Parameters:
conn - the Connector used for Database-Handling

Writer

public Writer(Connector conn,
              java.lang.String table,
              java.lang.String field)
initializes the object

Parameters:
conn - the Connector used for Database-Handling
table - the table to use for reading
field - the field that contains the class
Method Detail

setRelationName

public void setRelationName(java.lang.String relation)
sets the name of the relation


getRelationName

public java.lang.String getRelationName()
returns the name of the relation


setTable

public void setTable(java.lang.String table)
sets the name of the table to use


getTable

public java.lang.String getTable()
returns the name of the table to read from


setField

public void setField(java.lang.String field)
sets the field to use as class


getField

public java.lang.String getField()
returns the field used as class


setOrderBy

public void setOrderBy(java.lang.String orderBy)
sets the fields to order by (only ASC!)


getOrderBy

public java.lang.String getOrderBy()
returns the field used for ordering


setSort

public void setSort(boolean sort)
sets whether to sort the attributes or not


getSort

public boolean getSort()
returns whether the attributes are sorted or not


setFilename

public void setFilename(java.lang.String filename)
sets the name of the output file


getFilename

public java.lang.String getFilename()
returns the name of the output file


setFieldList

public void setFieldList(java.lang.String fields)
sets the list (comma separated) of fields to retrieve in this order from the table


getFieldList

public java.lang.String getFieldList()
returns the list of fields to retrieve (comma separated list)


setNominalList

public void setNominalList(java.lang.String fields)
sets the list (comma separated) of fields to treat additionally as nominals the table


getNominalList

public java.lang.String getNominalList()
returns the list of fields to treat additionally as nominals (comma separated list)


setNoNullsList

public void setNoNullsList(java.lang.String fields)
sets the list (comma separated) of fields where no NULL values are allowed


getNoNullsList

public java.lang.String getNoNullsList()
returns the list of fields where no NULL values are allowed


setPercentage

public void setPercentage(double percentage)
sets the percentage of instances we want to retrieve from the table. for each class the same percentage is retrieved (= stratified). 0 or 100 percent means just to retrieve all instances.


getPercentage

public double getPercentage()
returns the currently set percentage to retrieve from the table. 0 or 100 percent means just to retrieve all instances.


setInstances

public void setInstances(weka.core.Instances instances)
sets the instancs to write


getInstances

public weka.core.Instances getInstances()
returns the instances


write

public void write()
writes the instances from the table to an ARFF-file


write

public void write(weka.core.Instances instances)
writes the given instances to an ARFF-file. Since calling the toString() method of the instances-object is too memory consuming, we basically do the same as this method, but directly writing to a file and not to a String.

See Also:
USE_TOSTRING