Class InstanceTaxonomyOrderPredicateImpl
- java.lang.Object
-
- de.uni_trier.wi2.procake.data.model.base.impl.InstancePredicateImpl
-
- de.uni_trier.wi2.procake.data.model.base.impl.InstanceEnumerationPredicateImpl
-
- de.uni_trier.wi2.procake.data.model.base.impl.InstanceValueOrderPredicateImpl
-
- de.uni_trier.wi2.procake.data.model.base.impl.InstanceTaxonomyOrderPredicateImpl
-
- All Implemented Interfaces:
InstanceEnumerationPredicate,InstancePredicate,InstanceTaxonomyOrderPredicate,InstanceValueOrderPredicate
public class InstanceTaxonomyOrderPredicateImpl extends InstanceValueOrderPredicateImpl implements InstanceTaxonomyOrderPredicate
Description is missing- Author:
- Rainer Maximini
-
-
Field Summary
-
Fields inherited from class de.uni_trier.wi2.procake.data.model.base.impl.InstancePredicateImpl
atomicClass
-
Fields inherited from interface de.uni_trier.wi2.procake.data.model.base.InstanceTaxonomyOrderPredicate
COMPONENT, COMPONENT_KEY, LOG_CHILD_ALREADY_EXISTS, LOG_CHILD_NOT_FOUND, LOG_ROOT_ALREADY_DEFINED
-
Fields inherited from interface de.uni_trier.wi2.procake.data.model.base.InstanceValueOrderPredicate
COMPONENT, COMPONENT_KEY, LOG_VALUE_ALREADY_DEFINED, LOG_VALUE_NOT_FOUND, LOG_VALUE_UPDATE_FAILED
-
-
Constructor Summary
Constructors Constructor Description InstanceTaxonomyOrderPredicateImpl(StringClassImpl parentClass)Constructor for InstanceTaxonomyOrderPredicateImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRelation(AtomicObject father, AtomicObject son)To add a relation to the taxonomy the father and the son must be specified.booleancontains(AtomicObject value)Returnstrueif the order contains the specified value.AtomicObject[]getAllSons(AtomicObject father)Returns all sons of the given father.AtomicObjectgetCommonFather(AtomicObject[] sons)Determines the common father of all given sons.AtomicObjectgetCommonFather(AtomicObject firstSon, AtomicObject secondSon)Determines the common father offirstSonandsecondSon.AtomicObjectgetFather(AtomicObject son)getFather.AtomicObject[]getOrderValues()getOrderValues.AtomicObjectgetRoot()getRoot.AtomicObject[]getSons(AtomicObject father)Returns all direct sons of the given father.booleanisAfter(AtomicObject first, AtomicObject last)isAfter.booleanisBefore(AtomicObject first, AtomicObject last)isBefore.booleanisChild(AtomicObject child, AtomicObject father)trueifchildis a sub node offather.booleanisTaxonomyOrderPredicate()isTaxonomyOrderPredicate.voidremove(AtomicObject son)Removes a value from the value order.voidupdate(AtomicObject oldValue, AtomicObject newValue)To update a value in the order theoldValueand thenewValuemust be specified.voidupdateRelation(AtomicObject oldFather, AtomicObject newFather, AtomicObject son)To move a son node with all sub nodes to another father this method can be used.-
Methods inherited from class de.uni_trier.wi2.procake.data.model.base.impl.InstanceValueOrderPredicateImpl
isTotalOrderPredicate
-
Methods inherited from class de.uni_trier.wi2.procake.data.model.base.impl.InstanceEnumerationPredicateImpl
addValue, checkFinishEditing, getValues, hasValueOrder, holdsFor, isEnumerationPredicate, removeValue, updateValue
-
Methods inherited from class de.uni_trier.wi2.procake.data.model.base.impl.InstancePredicateImpl
finishEditing, getAtomicClass, isIntervalPredicate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.uni_trier.wi2.procake.data.model.base.InstanceEnumerationPredicate
addValue, getValues, hasValueOrder, removeValue, updateValue
-
Methods inherited from interface de.uni_trier.wi2.procake.data.model.base.InstancePredicate
getAtomicClass, holdsFor, isEnumerationPredicate, isIntervalPredicate, isTotalOrderPredicate
-
-
-
-
Constructor Detail
-
InstanceTaxonomyOrderPredicateImpl
public InstanceTaxonomyOrderPredicateImpl(StringClassImpl parentClass)
Constructor for InstanceTaxonomyOrderPredicateImpl.
- Parameters:
parentClass- aStringClassImplobject
-
-
Method Detail
-
addRelation
public void addRelation(AtomicObject father, AtomicObject son) throws IllegalEditException, ObjectAlreadyExistsException, ObjectNotFoundException
To add a relation to the taxonomy the father and the son must be specified. Iffather=nullroot node of the taxonomy is defined withsonas root. Only one root can be defined why this method throws anIllegalEditExceptionif a root is already defined. To update the root node the old root must be removedremove(getRoot())first.The relation is only be added if the father is already included in the taxonomy and the son is not included. To change a relation, the
InstanceTaxonomyOrderPredicate.updateRelation(AtomicObject, AtomicObject, AtomicObject)method should be used.- Specified by:
addRelationin interfaceInstanceTaxonomyOrderPredicate- Parameters:
father- the value of the father nodeson- the value of the son node- Throws:
IllegalEditExceptionObjectAlreadyExistsException- Is thrown when thesonis already in the order.ObjectNotFoundException- Is thrown when thefatheris not an element of the order.
-
contains
public boolean contains(AtomicObject value)
Returnstrueif the order contains the specified value.- Specified by:
containsin interfaceInstanceValueOrderPredicate- Parameters:
value- value whose presence in this order is to be tested.- Returns:
trueif this order contains the specified element.
-
getCommonFather
public AtomicObject getCommonFather(AtomicObject firstSon, AtomicObject secondSon) throws ObjectNotFoundException
Determines the common father offirstSonandsecondSon.- Specified by:
getCommonFatherin interfaceInstanceTaxonomyOrderPredicate- Parameters:
firstSon- aAtomicObjectobjectsecondSon- aAtomicObjectobject- Returns:
- Returns the common father of son
firstSonandsecondSon. - Throws:
ObjectNotFoundException- Is thrown when thefirstSonor thesecondSonare not an element of the order.
-
getCommonFather
public AtomicObject getCommonFather(AtomicObject[] sons) throws ObjectNotFoundException
Determines the common father of all given sons.- Specified by:
getCommonFatherin interfaceInstanceTaxonomyOrderPredicate- Parameters:
sons- Thesonswhose common father should be returned.- Returns:
- The common father of all sons.
- Throws:
ObjectNotFoundException- Is thrown when one of thesonsare not an element of the order.
-
getFather
public AtomicObject getFather(AtomicObject son) throws ObjectNotFoundException
getFather.
- Specified by:
getFatherin interfaceInstanceTaxonomyOrderPredicate- Parameters:
son- Thesonwhose father should be returned.- Returns:
- Returns the father value of the
sonornullif the son is root node (InstanceTaxonomyOrderPredicate.getRoot()) and no father exists. - Throws:
ObjectNotFoundException- Is thrown when thesonis not an element of the order.
-
getRoot
public AtomicObject getRoot()
getRoot.
- Specified by:
getRootin interfaceInstanceTaxonomyOrderPredicate- Returns:
- The root value of the taxonomy or
nullif no root is defined.
-
getSons
public AtomicObject[] getSons(AtomicObject father) throws ObjectNotFoundException
Returns all direct sons of the given father. If the taxonomy does not containsfatherorfather == nullaObjectNotFoundExceptionwill be thrown.- Specified by:
getSonsin interfaceInstanceTaxonomyOrderPredicate- Parameters:
father- Thefatherwhose sons should be returned.- Returns:
- All child values of the given father. The result is never be null.
- Throws:
ObjectNotFoundException- Is thrown when thefatheris not an element of the order.
-
getOrderValues
public AtomicObject[] getOrderValues()
getOrderValues.
- Specified by:
getOrderValuesin interfaceInstanceValueOrderPredicate- Returns:
- an array of all values in the order, the array is never be
null.
-
isAfter
public boolean isAfter(AtomicObject first, AtomicObject last) throws ObjectNotFoundException
isAfter.
- Specified by:
isAfterin interfaceInstanceValueOrderPredicate- Parameters:
first- aAtomicObjectobjectlast- aAtomicObjectobject- Returns:
trueiffirstis afterlast, otherwisefalse- Throws:
ObjectNotFoundException- Is thrown when thefirstorlastvalue is not an element of the order.
-
isBefore
public boolean isBefore(AtomicObject first, AtomicObject last) throws ObjectNotFoundException
isBefore.
- Specified by:
isBeforein interfaceInstanceValueOrderPredicate- Parameters:
first- aAtomicObjectobjectlast- aAtomicObjectobject- Returns:
trueiffirstis beforelast, otherwisefalse- Throws:
ObjectNotFoundException- Is thrown when thefirstorlastvalue is not an element of the order.
-
isChild
public boolean isChild(AtomicObject child, AtomicObject father) throws ObjectNotFoundException
trueifchildis a sub node offather. If the child or father isnullor not defined the exceptionObjectNotFoundExceptionis thrown.- Specified by:
isChildin interfaceInstanceTaxonomyOrderPredicate- Parameters:
child- aAtomicObjectobjectfather- aAtomicObjectobject- Returns:
trueif thechildis a sub node of thefather.- Throws:
ObjectNotFoundException- Is thrown when thechildor thefatherare not an element of the order.
-
isTaxonomyOrderPredicate
public boolean isTaxonomyOrderPredicate()
isTaxonomyOrderPredicate.
- Specified by:
isTaxonomyOrderPredicatein interfaceInstancePredicate- Overrides:
isTaxonomyOrderPredicatein classInstanceValueOrderPredicateImpl- Returns:
trueif the order is a taxonomy- See Also:
InstanceTaxonomyOrderPredicate
-
remove
public void remove(AtomicObject son) throws ObjectNotFoundException
Removes a value from the value order. Ifvalue == nullnothing happens. If the value order does not cotain thevalueaObjectNotFoundExceptionwill be thrown.- Specified by:
removein interfaceInstanceValueOrderPredicate- Parameters:
son- aAtomicObjectobject- Throws:
ObjectNotFoundException- Is thrown when the value is not an element of the order.
-
update
public void update(AtomicObject oldValue, AtomicObject newValue) throws ObjectNotFoundException, ObjectAlreadyExistsException
To update a value in the order theoldValueand thenewValuemust be specified. ThenewValueis only be applied if and only if the order contains theoldValueand the order not contains thenewValue.- Specified by:
updatein interfaceInstanceValueOrderPredicate- Parameters:
oldValue- aAtomicObjectobjectnewValue- aAtomicObjectobject- Throws:
ObjectNotFoundException- Is thrown when theoldValueis not an element of the order.ObjectAlreadyExistsException- Is thrown when thenewValueis already in the order.
-
updateRelation
public void updateRelation(AtomicObject oldFather, AtomicObject newFather, AtomicObject son) throws ObjectNotFoundException
To move a son node with all sub nodes to another father this method can be used.- Specified by:
updateRelationin interfaceInstanceTaxonomyOrderPredicate- Parameters:
oldFather- The value of the old father that must exist.newFather- The value of the new father that must exist.son- The value of the son that must exist as son of the old father.- Throws:
ObjectNotFoundException- Is thrown when theoldFather, thenewFather, otsonare not an element of the order.
-
getAllSons
public AtomicObject[] getAllSons(AtomicObject father)
Returns all sons of the given father. If the taxonomy does not containsfatherorfather == nullaObjectNotFoundExceptionwill be thrown.- Specified by:
getAllSonsin interfaceInstanceTaxonomyOrderPredicate- Parameters:
father- Thefatherwhose sons should be returned.- Returns:
- All child values of the given father. The result is never be null.
-
-