com.hp.hpl.jena.daml.common
Class LiteralAccessorImpl

java.lang.Object
  |
  +--com.hp.hpl.jena.daml.common.PropertyAccessorImpl
        |
        +--com.hp.hpl.jena.daml.common.LiteralAccessorImpl
All Implemented Interfaces:
LiteralAccessor, PropertyAccessor
Direct Known Subclasses:
IntLiteralAccessorImpl

public class LiteralAccessorImpl
extends PropertyAccessorImpl
implements LiteralAccessor

Encapsulates the standard methods of modifying a property on a DAML object, where the value of the property is an RDF literal (as opposed to another DAML value, see PropertyAccessor.

Version:
CVS info: $Id: LiteralAccessorImpl.java,v 1.1 2001/09/24 17:02:43 ijd Exp $
Author:
Ian Dickinson, HP Labs (email)

Constructor Summary
LiteralAccessorImpl(Property property, DAMLCommon val)
          Construct a new accessor for literal values of the given property.
 
Method Summary
 void addValue(Literal value)
          Add a value to the encapsulated property.
 void addValue(java.lang.String value)
          Add a value to the encapsulated property.
 Literal getValue()
          Answer the a value of the encapsulated property.
 NodeIterator getValues()
          Answer an iteration over the literal values that this property has in the RDF model.
 boolean hasValue(Literal value)
          Answer true if the encapsulated property has the given value as one of its values.
 boolean hasValue(java.lang.String value)
          Answer true if the encapsulated property has the given value as one of its values.
 void removeValue(Literal value)
          Remove a value from the encapsulated property.
 void removeValue(java.lang.String value)
          Remove a value from the encapsulated property.
 
Methods inherited from class com.hp.hpl.jena.daml.common.PropertyAccessorImpl
add, count, get, getAll, getDAMLValue, getProperty, hasValue, remove
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.jena.daml.PropertyAccessor
add, count, get, getAll, getDAMLValue, getProperty, hasValue, remove
 

Constructor Detail

LiteralAccessorImpl

public LiteralAccessorImpl(Property property,
                           DAMLCommon val)
Construct a new accessor for literal values of the given property.
Parameters:
property - The property that this accessor works on
val - The DAML value that has this property
Method Detail

getValues

public NodeIterator getValues()
Answer an iteration over the literal values that this property has in the RDF model.
Specified by:
getValues in interface LiteralAccessor
Returns:
An iteration over the values of the encapsulated property. Each member of the iteration will be an RDF literal.

getValue

public Literal getValue()
Answer the a value of the encapsulated property. If it has no values, answer null. If it has one value, answer that value. Otherwise, answer an undetermined member of the set of values.
Specified by:
getValue in interface LiteralAccessor
Returns:
A value for the encapsulated property, or null if the property has no value.

addValue

public void addValue(java.lang.String value)
Add a value to the encapsulated property.
Specified by:
addValue in interface LiteralAccessor
Parameters:
value - The value to be added, as a string.

addValue

public void addValue(Literal value)
Add a value to the encapsulated property.
Specified by:
addValue in interface LiteralAccessor
Parameters:
value - The value to be added, as an RDF literal.

removeValue

public void removeValue(java.lang.String value)
Remove a value from the encapsulated property.
Specified by:
removeValue in interface LiteralAccessor
Parameters:
value - The value to be removed, as a string.

removeValue

public void removeValue(Literal value)
Remove a value from the encapsulated property.
Specified by:
removeValue in interface LiteralAccessor
Parameters:
value - The value to be removed, as a literal.

hasValue

public boolean hasValue(java.lang.String value)
Answer true if the encapsulated property has the given value as one of its values.
Specified by:
hasValue in interface LiteralAccessor
Parameters:
value - A DAML value to test for
Returns:
True if the RDF model contains a statement giving a value for the encapsulated property matching the given value.

hasValue

public boolean hasValue(Literal value)
Answer true if the encapsulated property has the given value as one of its values.
Specified by:
hasValue in interface LiteralAccessor
Parameters:
value - A DAML value to test for
Returns:
True if the RDF model contains a statement giving a value for the encapsulated property matching the given value.


Copyright © 2001 Hewlett-Packard. All Rights Reserved.