lp.unit
Class GeneralizedLogicProgram

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<E>
              extended by java.util.LinkedHashSet<LpRule>
                  extended by lp.unit.GeneralizedLogicProgram
All Implemented Interfaces:
Serializable, Cloneable, Iterable<LpRule>, Collection<LpRule>, Set<LpRule>, LogicProgram
Direct Known Subclasses:
TransformedDlp, TransformedEvolp

public class GeneralizedLogicProgram
extends LinkedHashSet<LpRule>
implements LogicProgram

A default implementation of the LogicProgram interface.

Version:
1.0.0
Author:
Martin Slota
See Also:
Serialized Form

Field Summary
private static LpGroundDecider GD
          A static LpGroundDecider instance used in the isGround() method.
 
Constructor Summary
GeneralizedLogicProgram()
          Creates a new instance of GeneralizedLogicProgram representing an empty logic program.
 
Method Summary
 LpRule get(int index)
          Returns the i-th rule in this logic program.
 boolean isGround()
          Returns true iff this logic programs contains only ground rules, i.e. rules that contain no variables.
 
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Field Detail

GD

private static final LpGroundDecider GD
A static LpGroundDecider instance used in the isGround() method.

Constructor Detail

GeneralizedLogicProgram

public GeneralizedLogicProgram()
Creates a new instance of GeneralizedLogicProgram representing an empty logic program.

Method Detail

get

public LpRule get(int index)
Returns the i-th rule in this logic program. Rules are required to be in the order they were added to the program (just like in a list) . But this order is not important when determining if two logic programs are equal. Multiple appearance of one rule is also not important in this respect.

Specified by:
get in interface LogicProgram

isGround

public boolean isGround()
Returns true iff this logic programs contains only ground rules, i.e. rules that contain no variables.

Specified by:
isGround in interface LogicProgram
Returns:
as specified above
See Also:
LpGroundDecider.isGround(LpStructureUnit)