|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fzi.kadmos.api.ForwardingAlignment
public abstract class ForwardingAlignment
Abstract wrapper class for an Alignment
following the
Decorator pattern.
The class can be extended and additional functionality can be added without
accidentally changing the behaviour of the wrapped alignment implementation.
Note that the class is serialisable, thus extending classes must take care of proper serialisation and deserialisation of extra fields added. Care must also be taken if the wrapped alignment is not serialisable.
Extending classes should override equals
as follows:
public boolean equals( Object other ) { if( !(other instanceof MyExtension) ) return false; MyExtension otherAlignment = (MyExtension) other; return super.equals( otherAlignment.alignment ) && ... }where
...
is supposed to perform additional checks regarding the extension.
Extending classes should not forget to override the hashCode
function and the
clone
function.
Field Summary | |
---|---|
protected Alignment |
alignment
Wrapped alignment object. |
protected HashSet<AlignmentListener> |
listeners
Set of change listeners. |
Constructor Summary | |
---|---|
protected |
ForwardingAlignment(Alignment alignment)
Creates a new instance that wraps another alignment. |
Method Summary | ||
---|---|---|
void |
addCorrespondence(Correspondence<? extends OWLEntity> corr)
Adds a correspondence to an alignment if possible. |
|
void |
attachListener(AlignmentListener listener)
Registers an AlignmentListener . |
|
void |
clear()
Clears the alignment. |
|
ForwardingAlignment |
clone()
Creates a clone of this alignment. |
|
boolean |
contains(Correspondence<? extends OWLEntity> corr)
Checks if this alignment contains a correspondence with the same entities as the provided correspondence. |
|
boolean |
contains(IRI ent1,
IRI ent2)
Checks if a correspondence of two entities specified by their IRIs is part of this alignment. |
|
|
contains(T ent1,
T ent2)
Checks if a correspondence of two specified entities is part of this alignment. |
|
boolean |
containsEntity1(IRI ent)
Checks if this alignment contains a correspondence with a first entity specified by an IRI. |
|
boolean |
containsEntity1(OWLEntity ent)
Checks if this alignment contains a correspondence with a specific first entity. |
|
boolean |
containsEntity2(IRI ent)
Checks if this alignment contains a correspondence with a second entity specified by an IRI. |
|
boolean |
containsEntity2(OWLEntity ent)
Checks if this alignment contains a correspondence with a specific second entity. |
|
void |
detachListener(AlignmentListener listener)
Deregisters an AlignmentListener . |
|
boolean |
equals(Object other)
|
|
Set<Correspondence<? extends OWLEntity>> |
getCorrespondences()
Gets the set of correspondences of this alignment. |
|
Correspondence<? extends OWLEntity> |
getEntity1Corr(IRI ent)
Gets the correspondence with a specific entity as entity 1. |
|
|
getEntity1Corr(T ent)
Gets the correspondence with a specific entity as entity 1. |
|
Correspondence<? extends OWLEntity> |
getEntity2Corr(IRI ent)
Gets the correspondence with a specific entity as entity 2. |
|
|
getEntity2Corr(T ent)
Gets the correspondence with a specific entity as entity 2. |
|
Correspondence<? extends OWLEntity> |
getEntityCorr(IRI ent1,
IRI ent2)
Gets the correspondence with specific entities as entity 1 and entity2. |
|
|
getEntityCorr(T ent1,
T ent2)
Gets the correspondence with specific entities as entity 1 and entity 2. |
|
OWLOntology |
getOntology1()
Gets the first ontology of this alignment. |
|
OWLOntology |
getOntology2()
Gets the second ontology of this alignment. |
|
protected void |
guard_attachListener(AlignmentListener listener)
Guard for the attachListener(AlignmentListener) method. |
|
protected void |
guard_detachListener(AlignmentListener listener)
Guard for the detachListener(AlignmentListener) method. |
|
int |
hashCode()
|
|
boolean |
isEmpty()
Checks, whether this alignment is empty, i.e. |
|
Iterator<Correspondence<? extends OWLEntity>> |
iterator()
|
|
protected void |
notifyListeners(AlignmentChangeEvent changeEvent)
Notifies all registered listeners of the provided AlignmentChangeEvent . |
|
void |
removeCorrespondence(Correspondence<? extends OWLEntity> corr)
Removes a correspondence from this alignment if present. |
|
int |
size()
Gets the size of this alignment. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Alignment alignment
protected HashSet<AlignmentListener> listeners
Constructor Detail |
---|
protected ForwardingAlignment(Alignment alignment)
alignment
- The alignment to be wrapped.Method Detail |
---|
public void addCorrespondence(Correspondence<? extends OWLEntity> corr) throws MultiplicityException, IllegalArgumentException, IncompatibleOntologyException
addCorrespondence
in interface Alignment
corr
- The correspondence to be added.
MultiplicityException
- if multiplicity of correspondence is violated.
IllegalArgumentException
- if the argument is null
IncompatibleOntologyException
- if either of the corresponding entities is
not contained in the signature of the according
aligned ontology.public void clear()
clear
in interface Alignment
public boolean contains(Correspondence<? extends OWLEntity> corr)
contains
in interface Alignment
corr
- The correspondence to be checked if it is contained by this alignment.
true
if this alignment contains a correspondence with the same
entities as corr
, false
otherwise.public <T extends OWLEntity> boolean contains(T ent1, T ent2)
contains
in interface Alignment
T
- Type of the entities of correspondence to be checked.ent1
- Entity 1.ent2
- Entity 2.
true
if a correspondence of ent1
and ent2
is part of this alignment, false
otherwise.public boolean contains(IRI ent1, IRI ent2)
contains
in interface Alignment
ent1
- IRI of entity 1.ent2
- IRI of entity 2.
true
if a correspondence of ent1
and ent2
is part of this alignment, false
otherwise.public boolean containsEntity1(OWLEntity ent)
containsEntity1
in interface Alignment
ent
- Entity to be checked if present as entity 1 in a correspondence in this alignment.
true
if ent
participates as entity 1 of a correspondence in this alignment, false
otherwise.public boolean containsEntity1(IRI ent)
containsEntity1
in interface Alignment
ent
- IRI of entity to be checked if present as entity 1 in a correspondence in this alignment.
true
if ent
participates as entity 1 of a correspondence in this alignment, false
otherwise.public boolean containsEntity2(OWLEntity ent)
containsEntity2
in interface Alignment
ent
- Entity to be checked if present as entity 2 in a correspondence in this alignment.
true
if ent
participates as entity 2 of a correspondence in this alignment, false
otherwise.public boolean containsEntity2(IRI ent)
containsEntity2
in interface Alignment
ent
- IRI of entity to be checked if present as entity 2 in a correspondence in this alignment.
true
if ent
participates as entity 2 of a correspondence in this alignment, false
otherwise.public Set<Correspondence<? extends OWLEntity>> getCorrespondences()
getCorrespondences
in interface Alignment
public <T extends OWLEntity> Correspondence<T> getEntity1Corr(T ent)
null
will be returned.
getEntity1Corr
in interface Alignment
T
- Entity type.ent
- Entity 1 of the requested correspondence.
ent
as entity 1, or null
if no such correspondence exists.public Correspondence<? extends OWLEntity> getEntity1Corr(IRI ent)
null
will be returned.
getEntity1Corr
in interface Alignment
ent
- IRI of entity 1 of the requested correspondence.
ent
as entity 1, or null
if no such correspondence exists.public <T extends OWLEntity> Correspondence<T> getEntity2Corr(T ent)
null
will be returned.
getEntity2Corr
in interface Alignment
T
- Entity type.ent
- Entity 2 of the requested correspondence.
ent
as entity 2, or null
if no such correspondence exists.public Correspondence<? extends OWLEntity> getEntity2Corr(IRI ent)
null
will be returned.
getEntity2Corr
in interface Alignment
ent
- IRI of entity 2 of the requested correspondence.
ent
as entity 2, or null
if no such correspondence exists.public <T extends OWLEntity> Correspondence<T> getEntityCorr(T ent1, T ent2)
null
will be returned.
getEntityCorr
in interface Alignment
T
- Entity type.ent1
- Entity 1 of the requested correspondence.ent2
- Entity 2 of the requested correspondence.
ent
as entity 1 and ent
as entity 2,
or null
if no such correspondence exists.public Correspondence<? extends OWLEntity> getEntityCorr(IRI ent1, IRI ent2)
null
will be returned.
getEntityCorr
in interface Alignment
ent1
- IRI of entity 1 of the requested correspondence.ent2
- IRI of entity 2 of the requested correspondence.
ent1
as entity 1 and ent2
as entity 2
or null
if no such correspondence exists.public OWLOntology getOntology1()
getOntology1
in interface Alignment
public OWLOntology getOntology2()
getOntology2
in interface Alignment
public boolean isEmpty()
isEmpty
in interface Alignment
true
iff this alignment contains no correspondences,
false
otherwise.public void removeCorrespondence(Correspondence<? extends OWLEntity> corr)
removeCorrespondence
in interface Alignment
corr
- The correspondence to be removed.public int size()
size
in interface Alignment
public Iterator<Correspondence<? extends OWLEntity>> iterator()
iterator
in interface Iterable<Correspondence<? extends OWLEntity>>
public void attachListener(AlignmentListener listener)
AlignmentListener
.
The AlignmentListener
gets notified
when the alignment changes.
Calling this method with an AlignmentListener
that is already registered is a no-op.
attachListener
in interface Alignment
listener
- AlignmentListener
to register.public void detachListener(AlignmentListener listener)
AlignmentListener
.
The AlignmentListener
will be no longer
notified when the alignment changes.
Calling this method with an AlignmentListener
that is not registered is a no-op.
detachListener
in interface Alignment
listener
- AlignmentListener
to deregister.public ForwardingAlignment clone()
clone
in interface Alignment
clone
in class Object
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
protected final void notifyListeners(AlignmentChangeEvent changeEvent)
AlignmentChangeEvent
.
changeEvent
- The AlignmentChangeEvent
.protected void guard_attachListener(AlignmentListener listener)
attachListener(AlignmentListener)
method.
Ensures that the argument is not null
.
listener
- The listener argument.
NullPointerException
- if the argument is null
protected void guard_detachListener(AlignmentListener listener)
detachListener(AlignmentListener)
method.
Ensures that the argument is not null
.
listener
- The listener argument.
NullPointerException
- if the argument is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |