|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.obsearch.example.OBSlice
public class OBSlice
Example Object that can be stored in OBSearch This class reads strings representations of trees and calculates the distance between the objects by using a tree distance function.
Field Summary | |
---|---|
protected SliceAST |
tree
The root node of the tree. |
Constructor Summary | |
---|---|
OBSlice()
Default constructor must be provided by every object that implements the interface OB. |
|
OBSlice(String slice)
Creates an slice object. |
Method Summary | |
---|---|
short |
distance(OBShort object)
Calculates the distance between two trees. |
boolean |
equals(Object obj)
Returns true of this.tree.equals(obj.tree). |
SliceAST |
getTree()
|
int |
hashCode()
A hashCode based on the string representation of the tree. |
void |
load(byte[] in)
Re-creates this object from the given byte stream |
int |
recordSize()
|
int |
size()
Returns the size (in nodes) of the tree. |
byte[] |
store()
Stores this object into the given byte stream. |
String |
toString()
|
protected void |
updateTree(String x)
Internal method that updates the Tree from the String |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected SliceAST tree
Constructor Detail |
---|
public OBSlice()
public OBSlice(String slice) throws OBException
slice
- A string representation of a tree.
OBException
Method Detail |
---|
public SliceAST getTree()
public final short distance(OBShort object) throws OBException
distance
in interface OBShort
object
- The other object to compare
OBException
- if something wrong happens.net.obsearch.OB#distance(net.obsearch.OB,
net.obsearch.result.Dim)
protected final void updateTree(String x) throws OBException
OBException
public final int size() throws OBException
OBException
- If something goes wrong.public final String toString()
toString
in class Object
public final void load(byte[] in) throws IOException, OBException
load
in interface Storable
in
- A byte vector from which the stream will be loaded.
OBException
- if the data cannot be loaded.
IOException
net.obsearch.Storable#load(com.sleepycat.bind.tuple.TupleInput)
public final int recordSize()
public final byte[] store() throws IOException
store
in interface Storable
out
- The byte stream to be used
IOException
net.obsearch.Storable#store(com.sleepycat.bind.tuple.TupleOutput)
public final boolean equals(Object obj)
equals
in class Object
obj
- Object to compare.
public final int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |