org.openanzo.glitter.rdf
Class Variable

java.lang.Object
  extended by org.openanzo.glitter.rdf.Variable
All Implemented Interfaces:
java.lang.Comparable<Bindable>, Bindable, TriplePatternComponent

public class Variable
extends java.lang.Object
implements Bindable, TriplePatternComponent

A variable in a SPARQL query. The Variable class maintains a cache to reuse Variable objects sharing the same name.

Author:
lee

Method Summary
 int compareTo(Bindable o)
           
 int compareTo(TriplePatternComponent o)
          Compares to TriplePatternComponents for ordering.
static Variable createVariable(java.lang.String variableName)
          Static factory method that uses an LRU cache to reuse Variable objects for variables with the same name.
 boolean equalName(Variable other)
          Determines variable equality solely based on the name, rather than object equality.
 boolean equals(java.lang.Object other)
           
 java.lang.String getName()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createVariable

public static Variable createVariable(java.lang.String variableName)
Static factory method that uses an LRU cache to reuse Variable objects for variables with the same name.

Parameters:
variableName - name of variable
Returns:
Variable for given name

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Returns:
The name of the variable (excludes any leading ? or $ characters).

equals

public boolean equals(java.lang.Object other)
Specified by:
equals in interface TriplePatternComponent
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equalName

public boolean equalName(Variable other)
Determines variable equality solely based on the name, rather than object equality.

Parameters:
other - variable for which to determine equality
Returns:
true if other variable's name is equal to this variables name

compareTo

public int compareTo(Bindable o)
Specified by:
compareTo in interface java.lang.Comparable<Bindable>

compareTo

public int compareTo(TriplePatternComponent o)
Description copied from interface: TriplePatternComponent
Compares to TriplePatternComponents for ordering.

Specified by:
compareTo in interface TriplePatternComponent
Returns:
-1 if this comes before other; 0 if TriplePatternComponent.equals(Object) is true, and 1 otherwise.


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.