org.tm4j.topicmap.utils.extractors
Class OccurrencesExtractor

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

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

This is a UnaryFunction that retrieves a Collection of Occurrence from a Topic.


Constructor Summary
OccurrencesExtractor()
          Constructs an OccurrencesExtractor which returns all of the occurrences on the input Topic.
OccurrencesExtractor(uk.co.jezuk.mango.Predicate tester)
          Constructs an OccurrencesExtractor which returns only those occurrences on the input Topic that pass the tester Predicate.
 
Method Summary
 java.lang.Object fn(java.lang.Object in)
          The processing function for this extractor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OccurrencesExtractor

public OccurrencesExtractor()
Constructs an OccurrencesExtractor which returns all of the occurrences on the input Topic.


OccurrencesExtractor

public OccurrencesExtractor(uk.co.jezuk.mango.Predicate tester)
Constructs an OccurrencesExtractor which returns only those occurrences on the input Topic that pass the tester Predicate.

Parameters:
tester - the test to be applied to each occurrence on the topic. Only those that evaluate to true by this predicate will be returned as the output from this function.
Method Detail

fn

public java.lang.Object fn(java.lang.Object in)
The processing function for this extractor.

Specified by:
fn in interface uk.co.jezuk.mango.UnaryFunction
Parameters:
in - the topic to extract the occurrences from. The value of this parameter must be a Topic instance.
Returns:
an unmodifiable collection of Occurrence instances.
Throws:
java.lang.IllegalArgumentException - if in is not an instace of org.tm4j.topicmap.Topic.