lp.unit
Class TransformedEvolp

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
                      extended by lp.unit.TransformedEvolp
All Implemented Interfaces:
Serializable, Cloneable, Iterable<LpRule>, Collection<LpRule>, Set<LpRule>, LogicProgram

public class TransformedEvolp
extends GeneralizedLogicProgram

Represents the normal logic program that was constructed from an evolving logic program. It can be used as an ordinary logic program but it also offers the possibility to remember the types and group numbers of the rules in it. A rule of a specific type can be added by using the add(LpRule, int, TransEvolpRuleType) method. The getGroup(int, TransEvolpRuleType) will return all rules that were added to a specific group with a specific type.

Version:
1.0.0
Author:
Martin Slota
See Also:
EvolpTransformer.transform(EvolpProgram), Serialized Form

Field Summary
private  int maxGroup
          Maximum group used in this transformed program.
private  Map<String,LogicProgram> ruleGroups
          A mapping of groups and types to logic programs.
 
Constructor Summary
TransformedEvolp()
          Creates a new instance of TransformedEvolp.
 
Method Summary
 boolean add(LpRule rule, int group, TransEvolpRuleType type)
          Adds the rule rule to this program and remembers it to be in the group no.
 LogicProgram getGroup(int group, TransEvolpRuleType type)
          Returns a LogicProgram containing all rules from group no.
 int getMaxGroup()
          Returns the maximum number of group used in this transformed program.
 
Methods inherited from class lp.unit.GeneralizedLogicProgram
get, isGround
 
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

ruleGroups

private final Map<String,LogicProgram> ruleGroups
A mapping of groups and types to logic programs.


maxGroup

private int maxGroup
Maximum group used in this transformed program.

Constructor Detail

TransformedEvolp

public TransformedEvolp()
Creates a new instance of TransformedEvolp. It is intially empty.

Method Detail

add

public boolean add(LpRule rule,
                   int group,
                   TransEvolpRuleType type)
Adds the rule rule to this program and remembers it to be in the group no. group and of type type.

Parameters:
rule - the rule to add
group - number of the group to which the rule belongs
type - type of the rule
Returns:
true if this program did not already contain the specified rule

getGroup

public LogicProgram getGroup(int group,
                             TransEvolpRuleType type)
Returns a LogicProgram containing all rules from group no. group and of the type type.

Parameters:
group - number of the group from which rules should be returned
type - type of the rules that should returned
Returns:
as specified above

getMaxGroup

public int getMaxGroup()
Returns the maximum number of group used in this transformed program.

Returns:
as specified above