lp.struct
Class LpAbstractStructureUnit

java.lang.Object
  extended by lp.struct.LpAbstractStructureUnit
All Implemented Interfaces:
LpStructureUnit
Direct Known Subclasses:
LpAtom, LpCompoundTerm, LpConstant, LpFunction, LpLiteral, LpPredicate, LpRule, LpVariable

public abstract class LpAbstractStructureUnit
extends Object
implements LpStructureUnit

This abstract class offers a default implementation of the toString() method for all classes implementing the LpStructureUnit interface.

Version:
1.0.0
Author:
Martin Slota
See Also:
LpStructureUnit, LpConstant, LpVariable, LpCompoundTerm, LpFunction, LpPredicate, LpAtom, LpLiteral, LpRule

Field Summary
protected static LpBuffer TO_STRING_BUFFER
          A single LpBuffer instance for the toString() method.
 
Constructor Summary
LpAbstractStructureUnit()
           
 
Method Summary
 String toString()
          
protected static
<T> List<T>
toUnmodifiableList(List<T> list)
          Converts the given list to an unmodifiable list using the Collections.unmodifiableList(List) method.
protected static
<T> Set<T>
toUnmodifiableSet(Set<T> set)
          Converts the given set to an unmodifiable set using the Collections.unmodifiableSet(Set) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface lp.struct.LpStructureUnit
accept
 

Field Detail

TO_STRING_BUFFER

protected static final LpBuffer TO_STRING_BUFFER
A single LpBuffer instance for the toString() method. All calls to toString() are synchronized on it, so it is not a good idea to call toString() on LpStructureUnits from many threads...

Constructor Detail

LpAbstractStructureUnit

public LpAbstractStructureUnit()
Method Detail

toString

public String toString()

Overrides:
toString in class Object

toUnmodifiableList

protected static <T> List<T> toUnmodifiableList(List<T> list)
Converts the given list to an unmodifiable list using the Collections.unmodifiableList(List) method. But there are two differences:

Parameters:
list - the list whose read-only view should be returned
Returns:
as specified above

toUnmodifiableSet

protected static <T> Set<T> toUnmodifiableSet(Set<T> set)
Converts the given set to an unmodifiable set using the Collections.unmodifiableSet(Set) method. But there are two differences:

Parameters:
set - the set whose read-only view should be returned
Returns:
as specified above