wpi.associations.arminer
Class DBReader

java.lang.Object
  extended bywpi.associations.arminer.DBReader

public class DBReader
extends java.lang.Object

DBReader.java

A DBReader is used to read data from a database.


Field Summary
private  ARMinerItemset[] attribute_itemset
           
private  int current_instance
           
private  weka.core.Instances instances
           
private  java.util.Hashtable number_hash
           
private static java.lang.String SET_DELIMETERS
           
private  java.util.Hashtable value_hash
           
 
Constructor Summary
DBReader(weka.core.Instances instances)
          Loads a WEKA Instances object and sets the valid items
 
Method Summary
 ARMinerItemset getAttributeItemset(int i)
          Function to return an ARMinerItemset containing all items in a particular attribute.
 ARMinerItemset getFirstRow()
          Function to return the first instance as an ARMinerItemset
 ARMinerItemset getNextRow()
          Function to return the instance at current_instance as an ARMinerItemset
 java.util.Hashtable getNumberHash()
          Function to return the item ID Integer to Attribute=Value string hashtable for use in translating back from from numbers to strings by WEKA.
 long getNumColumns()
          Function to return the number of columns (attribute value items)
 long getNumRows()
          Function to return the number of rows (instances)
 boolean hasMoreRows()
          Function to check if there are more rows (instances)
static void main(java.lang.String[] arg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value_hash

private java.util.Hashtable value_hash

number_hash

private java.util.Hashtable number_hash

instances

private weka.core.Instances instances

current_instance

private int current_instance

attribute_itemset

private ARMinerItemset[] attribute_itemset

SET_DELIMETERS

private static java.lang.String SET_DELIMETERS
Constructor Detail

DBReader

public DBReader(weka.core.Instances instances)
         throws weka.core.UnsupportedAttributeTypeException
Loads a WEKA Instances object and sets the valid items

Parameters:
instances - the instances to read itemsets from
Throws:
exception - if the instances contain a numeric attribute
weka.core.UnsupportedAttributeTypeException
Method Detail

getNumRows

public long getNumRows()
Function to return the number of rows (instances)

Returns:
the number of instances

getNumColumns

public long getNumColumns()
Function to return the number of columns (attribute value items)

Returns:
the number of attribute value items

getFirstRow

public ARMinerItemset getFirstRow()
                           throws java.io.IOException
Function to return the first instance as an ARMinerItemset

Returns:
an ARMinerItemset of the first instance
Throws:
java.io.IOException

getNextRow

public ARMinerItemset getNextRow()
Function to return the instance at current_instance as an ARMinerItemset

Returns:
an ARMinerItemset of the current instance

hasMoreRows

public boolean hasMoreRows()
Function to check if there are more rows (instances)

Returns:
true if current_instance < number of instances, false otherwise

getNumberHash

public java.util.Hashtable getNumberHash()
Function to return the item ID Integer to Attribute=Value string hashtable for use in translating back from from numbers to strings by WEKA.

Returns:
a Hashtable where Attribute=Value Strings are keyed by Integers

getAttributeItemset

public ARMinerItemset getAttributeItemset(int i)
Function to return an ARMinerItemset containing all items in a particular attribute. Used by WEKA to specify constraints to AprioriRules.java.

Parameters:
i - the index of the attribute
Returns:
an ARMinerItemset of items in the given attribute

main

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