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.InstanceEnumerationPredicate
LOG_SUPER_PREDICATE_MUST_BE_DEFINED_IN_INHERITED_PREDICATE
Fields inherited from interface de.uni_trier.wi2.procake.data.model.base.InstanceTaxonomyOrderPredicate
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
LOG_VALUE_ALREADY_DEFINED, LOG_VALUE_NOT_FOUND, LOG_VALUE_UPDATE_FAILED
-
Constructor Summary
ConstructorDescriptionInstanceTaxonomyOrderPredicateImpl
(StringClassImpl parentClass) Constructor for InstanceTaxonomyOrderPredicateImpl. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRelation
(AtomicObject parent, AtomicObject child) To add a relation to the taxonomy the father and the son must be specified.boolean
contains
(AtomicObject value) Returnstrue
if the order contains the specified value.getAllSons
(AtomicObject father) Returns all sons of the given father.getCommonFather
(AtomicObject[] children) Determines the common father of all given sons.getCommonFather
(AtomicObject firstChild, AtomicObject secondChild) Determines the common father offirstSon
andsecondSon
.getFather
(AtomicObject child) getFather.getOrderValues.getRoot()
getRoot.getSons
(AtomicObject parent) Returns all direct sons of the given father.boolean
isAfter
(AtomicObject first, AtomicObject last) isAfter.boolean
isBefore
(AtomicObject first, AtomicObject last) isBefore.boolean
isChild
(AtomicObject child, AtomicObject father) true
ifchild
is a sub node offather
.boolean
isTaxonomyOrderPredicate.void
remove
(AtomicObject child) Removes a value from the value order.void
update
(AtomicObject oldValue, AtomicObject newValue) To update a value in the order theoldValue
and thenewValue
must be specified.void
updateRelation
(AtomicObject oldParent, AtomicObject newParent, AtomicObject child) 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, isInherited, removeValue, setInheritance, updateValue
Methods inherited from class de.uni_trier.wi2.procake.data.model.base.impl.InstancePredicateImpl
finishEditing, getAtomicClass, isIntervalPredicate, isOntologyOrderPredicate
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, isInherited, removeValue, setInheritance, updateValue
Methods inherited from interface de.uni_trier.wi2.procake.data.model.base.InstancePredicate
getAtomicClass, holdsFor, isEnumerationPredicate, isIntervalPredicate, isOntologyOrderPredicate, isTotalOrderPredicate
-
Constructor Details
-
InstanceTaxonomyOrderPredicateImpl
Constructor for InstanceTaxonomyOrderPredicateImpl.
- Parameters:
parentClass
- aStringClassImpl
object
-
-
Method Details
-
addRelation
public void addRelation(AtomicObject parent, AtomicObject child) throws IllegalEditException, ObjectAlreadyExistsException, ObjectNotFoundException To add a relation to the taxonomy the father and the son must be specified. Iffather=null
root node of the taxonomy is defined withson
as root. Only one root can be defined why this method throws anIllegalEditException
if 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:
addRelation
in interfaceInstanceTaxonomyOrderPredicate
- Parameters:
parent
- the value of the father nodechild
- the value of the son node- Throws:
IllegalEditException
ObjectAlreadyExistsException
- Is thrown when theson
is already in the order.ObjectNotFoundException
- Is thrown when thefather
is not an element of the order.
-
contains
Returnstrue
if the order contains the specified value.- Specified by:
contains
in interfaceInstanceValueOrderPredicate
- Parameters:
value
- value whose presence in this order is to be tested.- Returns:
true
if this order contains the specified element.
-
getCommonFather
public AtomicObject getCommonFather(AtomicObject firstChild, AtomicObject secondChild) throws ObjectNotFoundException Determines the common father offirstSon
andsecondSon
.- Specified by:
getCommonFather
in interfaceInstanceTaxonomyOrderPredicate
- Parameters:
firstChild
- aAtomicObject
objectsecondChild
- aAtomicObject
object- Returns:
- Returns the common father of son
firstSon
andsecondSon
. - Throws:
ObjectNotFoundException
- Is thrown when thefirstSon
or thesecondSon
are not an element of the order.
-
getCommonFather
Determines the common father of all given sons.- Specified by:
getCommonFather
in interfaceInstanceTaxonomyOrderPredicate
- Parameters:
children
- Thesons
whose common father should be returned.- Returns:
- The common father of all sons.
- Throws:
ObjectNotFoundException
- Is thrown when one of thesons
are not an element of the order.
-
getFather
getFather.
- Specified by:
getFather
in interfaceInstanceTaxonomyOrderPredicate
- Parameters:
child
- Theson
whose father should be returned.- Returns:
- Returns the father value of the
son
ornull
if the son is root node (InstanceTaxonomyOrderPredicate.getRoot()
) and no father exists. - Throws:
ObjectNotFoundException
- Is thrown when theson
is not an element of the order.
-
getRoot
getRoot.
- Specified by:
getRoot
in interfaceInstanceTaxonomyOrderPredicate
- Returns:
- The root value of the taxonomy or
null
if no root is defined.
-
getSons
Returns all direct sons of the given father. If the taxonomy does not containsfather
orfather == null
aObjectNotFoundException
will be thrown.- Specified by:
getSons
in interfaceInstanceTaxonomyOrderPredicate
- Parameters:
parent
- Thefather
whose sons should be returned.- Returns:
- All child values of the given father. The result is never be null.
- Throws:
ObjectNotFoundException
- Is thrown when thefather
is not an element of the order.
-
getOrderValues
getOrderValues.
- Specified by:
getOrderValues
in interfaceInstanceValueOrderPredicate
- Returns:
- an array of all values in the order, the array is never be
null
.
-
isAfter
isAfter.
- Specified by:
isAfter
in interfaceInstanceValueOrderPredicate
- Parameters:
first
- aAtomicObject
objectlast
- aAtomicObject
object- Returns:
true
iffirst
is afterlast
, otherwisefalse
- Throws:
ObjectNotFoundException
- Is thrown when thefirst
orlast
value is not an element of the order.
-
isBefore
isBefore.
- Specified by:
isBefore
in interfaceInstanceValueOrderPredicate
- Parameters:
first
- aAtomicObject
objectlast
- aAtomicObject
object- Returns:
true
iffirst
is beforelast
, otherwisefalse
- Throws:
ObjectNotFoundException
- Is thrown when thefirst
orlast
value is not an element of the order.
-
isChild
true
ifchild
is a sub node offather
. If the child or father isnull
or not defined the exceptionObjectNotFoundException
is thrown.- Specified by:
isChild
in interfaceInstanceTaxonomyOrderPredicate
- Parameters:
child
- aAtomicObject
objectfather
- aAtomicObject
object- Returns:
true
if thechild
is a sub node of thefather
.- Throws:
ObjectNotFoundException
- Is thrown when thechild
or thefather
are not an element of the order.
-
isTaxonomyOrderPredicate
public boolean isTaxonomyOrderPredicate()isTaxonomyOrderPredicate.
- Specified by:
isTaxonomyOrderPredicate
in interfaceInstancePredicate
- Overrides:
isTaxonomyOrderPredicate
in classInstanceValueOrderPredicateImpl
- Returns:
true
if the order is a taxonomy- See Also:
-
remove
Removes a value from the value order. Ifvalue == null
nothing happens. If the value order does not cotain thevalue
aObjectNotFoundException
will be thrown.- Specified by:
remove
in interfaceInstanceValueOrderPredicate
- Parameters:
child
- aAtomicObject
object- 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 theoldValue
and thenewValue
must be specified. ThenewValue
is only be applied if and only if the order contains theoldValue
and the order not contains thenewValue
.- Specified by:
update
in interfaceInstanceValueOrderPredicate
- Parameters:
oldValue
- aAtomicObject
objectnewValue
- aAtomicObject
object- Throws:
ObjectNotFoundException
- Is thrown when theoldValue
is not an element of the order.ObjectAlreadyExistsException
- Is thrown when thenewValue
is already in the order.
-
updateRelation
public void updateRelation(AtomicObject oldParent, AtomicObject newParent, AtomicObject child) throws ObjectNotFoundException To move a son node with all sub nodes to another father this method can be used.- Specified by:
updateRelation
in interfaceInstanceTaxonomyOrderPredicate
- Parameters:
oldParent
- The value of the old father that must exist.newParent
- The value of the new father that must exist.child
- The value of the son that must exist as son of the old father.- Throws:
ObjectNotFoundException
- Is thrown when theoldFather
, thenewFather
, orson
are not an element of the order.
-
getAllSons
Returns all sons of the given father. If the taxonomy does not containsfather
orfather == null
aObjectNotFoundException
will be thrown.- Specified by:
getAllSons
in interfaceInstanceTaxonomyOrderPredicate
- Parameters:
father
- Thefather
whose sons should be returned.- Returns:
- All child values of the given father. The result is never be null.
-