|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.tm4j.topicmap.utils.testers.InScopeTester
Predicate function which returns true if the tested object is a scoped object and if the scope of the object matches the context specified in the tester's constructor.
The tester supports two kinds of comparison. The default comparison
will return true if the context specified in the constructor contains one or
more topics which are in the scope of the scoped object being tester. If
the matchAll
option in the constructor is set to true, then
the tester will return true only if every topic in the scope of the tested object
is found in the context specified in the constructor.
Note To handle merging, this method normalises both the context and the scoping topics to their base topics. So if the context is specified as {TopicA, TopicB} and TopicA is merged with TopicA2, then this context will match scopes {TopicA}, {TopicB}, {TopicA, TopicB}, {TopicA2, TopicB} and {TopicA, TopicA2, TopicB2}
Constructor Summary | |
InScopeTester(java.util.Collection context)
Create a new InScopeTester which will test scoped objects against a scope comrising themes . |
|
InScopeTester(java.util.Collection context,
boolean matchAll)
Create a new InScopeTester which will test scoped objects against a context comprising of the specified themes. |
|
InScopeTester(Topic[] context)
Create a new InScopeTester which will test scoped objects against a scope comrising themes . |
|
InScopeTester(Topic[] context,
boolean matchAll)
Create a new InScopeTester which will test scoped objects against a context comprising of the specified themes. |
Method Summary | |
boolean |
test(java.lang.Object x)
Test if x is a ScopedObject which is in the scope
of the themes specified in the constructor of this tester. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public InScopeTester(Topic[] context)
themes
.
context
- an array of Topic objects that ScopedObjects
scopes will be tested against. If this parameter
is null, then all ScopedObject instances will
pass this test.public InScopeTester(Topic[] context, boolean matchAll)
context
- the collection of Topic objects which define the context to test against.matchAll
- if true, then a ScopedObject will pass this test only if all the
topics in the context are found in the Scope of the ScopedObject.
If false, then a ScopedObject will pass this test if one or more
topics in the context are found in the Scope of the ScopedObject.public InScopeTester(java.util.Collection context)
themes
.
context
- a Collection of Topic objects that ScopedObjects
scopes will be tested against. If this parameter
is null, or the Collection is empty then all ScopedObject instances will
pass this test, otherwise only those ScopedObject
instances whose scope contains one or more Topic objects in context
will pass the test.public InScopeTester(java.util.Collection context, boolean matchAll)
context
- the collection of Topic objects which define the context to test against.matchAll
- if true, then a ScopedObject will pass this test only if all the
topics in the context are found in the Scope of the ScopedObject.
If false, then a ScopedObject will pass this test if one or more
topics in the context are found in the Scope of the ScopedObject.Method Detail |
public boolean test(java.lang.Object x)
x
is a ScopedObject which is in the scope
of the themes specified in the constructor of this tester.
test
in interface uk.co.jezuk.mango.Predicate
x
- the object to be tested.
x
is not a ScopedObject; true if
x
is a ScopedObject and the set of test
themes is empty; or else true if the set of scoping topics for the
matches the context specified for this tester. If the boolean matchAll
property is set to true, then a match is determined if and only if every
scoping topic for x
is in the context, otherwise a match
is determined if one or more scoping topics of x
are found
in the context.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |