org.openrdf.model.impl
Class StatementImpl

java.lang.Object
  extended by org.openrdf.model.impl.StatementImpl
All Implemented Interfaces:
Serializable, Statement
Direct Known Subclasses:
ContextStatementImpl

public class StatementImpl
extends Object
implements Statement

An implementation of the Statement interface for statements that don't have an associated context. For statements that do have an associated context, ContextStatementImpl can be used.

See Also:
Serialized Form

Constructor Summary
StatementImpl(Resource subject, URI predicate, Value object)
          Creates a new Statement with the supplied subject, predicate and object.
 
Method Summary
 boolean equals(Object other)
          Compares a statement object to another object.
 Resource getContext()
          Gets the context of this statement.
 Value getObject()
          Gets the object of this statement.
 URI getPredicate()
          Gets the predicate of this statement.
 Resource getSubject()
          Gets the subject of this statement.
 int hashCode()
          The hash code of a statement is defined as: 961 * subject.hashCode() + 31 * predicate.hashCode() + object.hashCode().
 String toString()
          Gives a String-representation of this Statement that can be used for debugging.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StatementImpl

public StatementImpl(Resource subject,
                     URI predicate,
                     Value object)
Creates a new Statement with the supplied subject, predicate and object.

Parameters:
subject - The statement's subject, must not be null.
predicate - The statement's predicate, must not be null.
object - The statement's object, must not be null.
Method Detail

getSubject

public Resource getSubject()
Description copied from interface: Statement
Gets the subject of this statement.

Specified by:
getSubject in interface Statement
Returns:
The statement's subject.

getPredicate

public URI getPredicate()
Description copied from interface: Statement
Gets the predicate of this statement.

Specified by:
getPredicate in interface Statement
Returns:
The statement's predicate.

getObject

public Value getObject()
Description copied from interface: Statement
Gets the object of this statement.

Specified by:
getObject in interface Statement
Returns:
The statement's object.

getContext

public Resource getContext()
Description copied from interface: Statement
Gets the context of this statement.

Specified by:
getContext in interface Statement
Returns:
The statement's context, or null in case of the null context or if not applicable.

equals

public boolean equals(Object other)
Description copied from interface: Statement
Compares a statement object to another object.

Specified by:
equals in interface Statement
Overrides:
equals in class Object
Parameters:
other - The object to compare this statement to.
Returns:
true if the other object is an instance of Statement and if their subjects, predicates and objects are equal.

hashCode

public int hashCode()
Description copied from interface: Statement
The hash code of a statement is defined as: 961 * subject.hashCode() + 31 * predicate.hashCode() + object.hashCode(). This is similar to how String.hashCode() is defined.

Specified by:
hashCode in interface Statement
Overrides:
hashCode in class Object
Returns:
A hash code for the statement.

toString

public String toString()
Gives a String-representation of this Statement that can be used for debugging.

Overrides:
toString in class Object


Copyright © 2001-2008 Aduna. All Rights Reserved.