anonymizer
Class EquivalenceTable

java.lang.Object
  extended by anonymizer.EquivalenceTable

public class EquivalenceTable
extends java.lang.Object

The class that manages equivalence classes. Typical schema of the table contains:


Field Summary
private  QIDAttribute[] qid
          Quasi-identifier attributes
private  SQLWrapper sqlwrapper
          SQL connection/querying object
private  java.lang.String tableName
          Name of the table
 
Constructor Summary
EquivalenceTable(QIDAttribute[] qid, java.lang.String tableName)
          Class constructor
 
Method Summary
private  void createTable()
          Creates the table that will store Equivalence objects
 void deleteEquivalence(java.lang.Long eid)
          Deletes the equivalence
 void drop()
          Drops this table from the database
 java.lang.Long getEID(java.lang.String[] genVals)
          Get the equivalence ID for the provided set of generalized values
 java.lang.String[] getGeneralization(double eid)
          Get the generalization for an equivalence
 java.lang.String getName()
          Getter for tableName
 java.lang.Long insertEquivalence(java.lang.String[] genVals)
          Inserts a new equivalence
 java.lang.Long insertTuple(java.lang.String[] vals)
          Inserts a nwe tuple
 void setGeneralization(double eid, java.lang.String[] newVals)
          Overwrites the generalized values of this equivalence with the specified set of values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

qid

private QIDAttribute[] qid
Quasi-identifier attributes


tableName

private java.lang.String tableName
Name of the table


sqlwrapper

private SQLWrapper sqlwrapper
SQL connection/querying object

Constructor Detail

EquivalenceTable

public EquivalenceTable(QIDAttribute[] qid,
                        java.lang.String tableName)
Class constructor

Parameters:
qid - Quasi-identifier attribtues
tableName - Name of the table
Method Detail

createTable

private void createTable()
Creates the table that will store Equivalence objects


getName

public java.lang.String getName()
Getter for tableName

Returns:
Name of the table

getEID

public java.lang.Long getEID(java.lang.String[] genVals)
                      throws java.sql.SQLException
Get the equivalence ID for the provided set of generalized values

Parameters:
genVals - String representations of Interval objects (one per QI-attribute)
Returns:
EID of the matching equivalence or -1 if not found
Throws:
java.sql.SQLException

getGeneralization

public java.lang.String[] getGeneralization(double eid)
                                     throws java.sql.SQLException
Get the generalization for an equivalence

Parameters:
eid - Equivalence ID of the equivalence
Returns:
an array of generalized values (i.e., string representation of the intervals)
Throws:
java.sql.SQLException

setGeneralization

public void setGeneralization(double eid,
                              java.lang.String[] newVals)
                       throws java.sql.SQLException
Overwrites the generalized values of this equivalence with the specified set of values

Parameters:
eid - Equivalence id of the equivalence
newVals - new generalization values
Throws:
java.sql.SQLException

insertTuple

public java.lang.Long insertTuple(java.lang.String[] vals)
                           throws java.lang.Exception
Inserts a nwe tuple

Parameters:
vals - Values of the tuple, as read from the data source (i.e., before any generalization)
Returns:
Equivalence id of the new or existing equivalence
Throws:
java.lang.Exception

insertEquivalence

public java.lang.Long insertEquivalence(java.lang.String[] genVals)
                                 throws java.sql.SQLException
Inserts a new equivalence

Parameters:
genVals - String representation of generalized values (i.e., generated with Interval.toString)
Returns:
Equivalence id of the new or existing equivalence
Throws:
SQLExpcetion
java.sql.SQLException

deleteEquivalence

public void deleteEquivalence(java.lang.Long eid)
Deletes the equivalence

Parameters:
eid - Equivalence ID of the equivalence to be deleted

drop

public void drop()
Drops this table from the database