Class LevelHierarchy
java.lang.Object
edu.upc.fib.inlab.imp.kse.logics.logicschema.domain.LevelHierarchy
This class implements the definition of hierarchical database as defined in "Basis for Deductive Database Systems" by J. W. Lloyd AND R. W. Topor.
A database is called hierarchical if its predicates can be partitioned into
levels so that the definitions of level 0 predicates consist solely of base predicates and the bodies of the derived
predicates of level j contain only level i predicates, where i < j
.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
getLevel
(int index) int
getLevelIndexOfPredicate
(Predicate predicate) May throw exception if predicate is not contained in the hierarchygetLevelOfPredicate
(Predicate predicate) May throw exception if predicate is not contained in the hierarchyint
iterator()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
spliterator
-
Constructor Details
-
LevelHierarchy
-
-
Method Details
-
getLevelOfPredicate
May throw exception if predicate is not contained in the hierarchy- Parameters:
predicate
- a non-null predicate- Returns:
- the level of the predicate
-
getLevel
-
getNumberOfLevels
public int getNumberOfLevels() -
getLevelIndexOfPredicate
May throw exception if predicate is not contained in the hierarchy- Parameters:
predicate
- a non-null predicate- Returns:
- the index of the predicate
-
getBasePredicatesLevel
- Returns:
- the 0-th level of the hierarchy, which contains the base predicates
-
getDerivedLevels
- Returns:
- a list with the levels representing derived predicates (i.e., i-th levels with i > 0)
-
iterator
-
forEach
-