net.sf.bddbddb
Class LSRelation

java.lang.Object
  extended by net.sf.bddbddb.Relation
      extended by net.sf.bddbddb.LSRelation

public class LSRelation
extends Relation

LSRelation

Version:
$Id: LSRelation.java 649 2006-09-16 05:51:04Z joewhaley $
Author:
jwhaley

Nested Class Summary
static class LSRelation.TupleComparator
           
 
Field Summary
static LSRelation.TupleComparator TUPLE_COMPARATOR
           
 
Fields inherited from class net.sf.bddbddb.Relation
attributes, id, name, negated
 
Method Summary
 boolean add(java.math.BigInteger[] t)
          Add tuple to this relation.
protected  int compress(java.math.BigInteger[] arr)
          Compress the given array into a packed value.
 boolean contains(int k, java.math.BigInteger j)
          Returns true iff this relation contains a tuple where the kth field is value j.
 Relation copy()
          Make a copy of this relation.
 double dsize()
          Return the number of tuples in this relation, in double format.
protected  void extract(java.math.BigInteger[] arr, int x)
          Extract packed value x into given array.
 void free()
          Free the memory associated with this relation.
 void initialize()
          Initialize this relation.
 TupleIterator iterator()
          Return an iterator over the tuples of this relation.
 TupleIterator iterator(java.math.BigInteger[] j)
          Return an iterator over the tuples where the fields match the values in the given array.
 TupleIterator iterator(int k)
          Return an iterator over the values in the kth field of the relation.
 TupleIterator iterator(int k, java.math.BigInteger j)
          Return an iterator over the tuples where the kth field has value j.
 void load()
          Load this relation from disk in its native format.
 void loadTuples()
          Load the tuple form of this relation from disk.
 void loadTuples(java.lang.String filename)
          Load this relation in tuple form from the given file.
 void save()
          Save the current value of this relation to disk in its native format.
 void saveTuples()
          Save the current value of this relation to disk in tuple form.
 void saveTuples(java.lang.String filename)
          Save the value of this relation in tuple form to the given file.
 java.lang.String verboseToString()
          Returns a verbose representation of the relation
 
Methods inherited from class net.sf.bddbddb.Relation
elementsToString, fromXMLElement, getAttribNameMap, getAttribute, getAttribute, getAttributes, getConstraints, getNegated, hashCode, makeNegated, numberOfAttributes, setConstraints, size, toString, toXMLElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TUPLE_COMPARATOR

public static final LSRelation.TupleComparator TUPLE_COMPARATOR
Method Detail

add

public boolean add(java.math.BigInteger[] t)
Add tuple to this relation.

Specified by:
add in class Relation
Parameters:
t - tuple to add
Returns:
whether relation has changed

extract

protected void extract(java.math.BigInteger[] arr,
                       int x)
Extract packed value x into given array.

Parameters:
arr - array to extract into
x - packed value

compress

protected int compress(java.math.BigInteger[] arr)
Compress the given array into a packed value.

Parameters:
arr - array to compress
Returns:
packed value

initialize

public void initialize()
Description copied from class: Relation
Initialize this relation.

Specified by:
initialize in class Relation

load

public void load()
          throws java.io.IOException
Description copied from class: Relation
Load this relation from disk in its native format.

Specified by:
load in class Relation
Throws:
java.io.IOException

loadTuples

public void loadTuples()
                throws java.io.IOException
Description copied from class: Relation
Load the tuple form of this relation from disk.

Specified by:
loadTuples in class Relation
Throws:
java.io.IOException

loadTuples

public void loadTuples(java.lang.String filename)
                throws java.io.IOException
Description copied from class: Relation
Load this relation in tuple form from the given file.

Specified by:
loadTuples in class Relation
Parameters:
filename - the file to load
Throws:
java.io.IOException

save

public void save()
          throws java.io.IOException
Description copied from class: Relation
Save the current value of this relation to disk in its native format.

Specified by:
save in class Relation
Throws:
java.io.IOException

saveTuples

public void saveTuples()
                throws java.io.IOException
Description copied from class: Relation
Save the current value of this relation to disk in tuple form.

Specified by:
saveTuples in class Relation
Throws:
java.io.IOException

saveTuples

public void saveTuples(java.lang.String filename)
                throws java.io.IOException
Description copied from class: Relation
Save the value of this relation in tuple form to the given file.

Specified by:
saveTuples in class Relation
Parameters:
filename - name of file to save
Throws:
java.io.IOException

copy

public Relation copy()
Description copied from class: Relation
Make a copy of this relation. The new relation will have the same attributes and a derived name.

Specified by:
copy in class Relation
Returns:
the new relation

free

public void free()
Description copied from class: Relation
Free the memory associated with this relation. After calling this, the relation can no longer be used.

Specified by:
free in class Relation

dsize

public double dsize()
Description copied from class: Relation
Return the number of tuples in this relation, in double format.

Specified by:
dsize in class Relation
Returns:
number of tuples in relation

iterator

public TupleIterator iterator()
Description copied from class: Relation
Return an iterator over the tuples of this relation.

Specified by:
iterator in class Relation
Returns:
iterator of BigInteger[]

iterator

public TupleIterator iterator(int k)
Description copied from class: Relation
Return an iterator over the values in the kth field of the relation. k is zero-based.

Specified by:
iterator in class Relation
Parameters:
k - zero-based field number
Returns:
iterator of BigInteger[]

iterator

public TupleIterator iterator(int k,
                              java.math.BigInteger j)
Description copied from class: Relation
Return an iterator over the tuples where the kth field has value j. k is zero-based.

Specified by:
iterator in class Relation
Parameters:
k - zero-based field number
j - value
Returns:
iterator of BigInteger[]

iterator

public TupleIterator iterator(java.math.BigInteger[] j)
Description copied from class: Relation
Return an iterator over the tuples where the fields match the values in the given array. A -1 value in the array matches any value.

Specified by:
iterator in class Relation
Parameters:
j - values
Returns:
iterator of BigInteger[]

contains

public boolean contains(int k,
                        java.math.BigInteger j)
Description copied from class: Relation
Returns true iff this relation contains a tuple where the kth field is value j. k is zero-based.

Specified by:
contains in class Relation
Parameters:
k - zero-based field number
j - value
Returns:
whether the given value appears in the given field

verboseToString

public java.lang.String verboseToString()
Description copied from class: Relation
Returns a verbose representation of the relation

Specified by:
verboseToString in class Relation


Copyright © 2004-2008 Stanford SUIF Compiler Group. All Rights Reserved.