org.tm4j.topicmap.utils.extractors
Class AssociatedTopicsExtractor

java.lang.Object
  extended byorg.tm4j.topicmap.utils.extractors.AssociatedTopicsExtractor
All Implemented Interfaces:
uk.co.jezuk.mango.UnaryFunction

public class AssociatedTopicsExtractor
extends java.lang.Object
implements uk.co.jezuk.mango.UnaryFunction

An extractor which returns a list of all topics associated with the input topic with an optionally specified association type and role specs for the the input topic and its associated topic.


Constructor Summary
AssociatedTopicsExtractor()
           
 
Method Summary
 java.lang.Object fn(java.lang.Object o)
          Function implementation.
 void setAssociationTester(uk.co.jezuk.mango.Predicate assocTester)
          Sets the predicate which tests the associations traversed from the input topic to the set of returned topics.
 void setOtherRoleTester(uk.co.jezuk.mango.Predicate otherRoleTester)
          Sets the predicate which filters the roles of the associations processed.
 void setThisRoleTester(uk.co.jezuk.mango.Predicate thisRoleTester)
          Sets the predicate which filters the roles of the input topic for the associations to be processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssociatedTopicsExtractor

public AssociatedTopicsExtractor()
Method Detail

fn

public java.lang.Object fn(java.lang.Object o)
Function implementation. This function returns a list of all the topics associated with the Topic passed in as the argument o. If the associationTester, thisRoleTester or otherRoleTester properties are set, then they will be used to filter the returns to only those topics whose associations pass the associationTester where the role played by o passes the thisRoleTester and the role played by the returned Topics pass the otherRoleTester.

Specified by:
fn in interface uk.co.jezuk.mango.UnaryFunction
Parameters:
o - the Topic to get all associated topics for.
Returns:
a List of Topic instances. If o is not a Topic, the return value is an empty list.

setAssociationTester

public void setAssociationTester(uk.co.jezuk.mango.Predicate assocTester)
Sets the predicate which tests the associations traversed from the input topic to the set of returned topics. If specified, then only topics which are associated with the input topic by associations which pass the specified predicate will be extracted.


setThisRoleTester

public void setThisRoleTester(uk.co.jezuk.mango.Predicate thisRoleTester)
Sets the predicate which filters the roles of the input topic for the associations to be processed. All roles of the input topic are tested against this predicate. Only the associations which are parents of roles that pass this predicate will be processed.


setOtherRoleTester

public void setOtherRoleTester(uk.co.jezuk.mango.Predicate otherRoleTester)
Sets the predicate which filters the roles of the associations processed. If the association role passes the filter, then the role players are returned in the output collection.