org.knime.base.node.preproc.matcher
Class SubsetMatcher

java.lang.Object
  extended by org.knime.base.node.preproc.matcher.SubsetMatcher
All Implemented Interfaces:
Comparable<SubsetMatcher>

public class SubsetMatcher
extends Object
implements Comparable<SubsetMatcher>

An ItemSetMatcher matches only one element of a transaction list. ItemSetMatcher are hierarchically organized. Thus the item sets and the transaction lists need to be sorted in the same way. An ItemSetMatcher hierarchy for the two item sets (A,B,D; B,C,E) A->B->D; B->C->E.

Author:
Tobias Koetter, University of Konstanz

Constructor Summary
SubsetMatcher(DataCell item, Comparator<DataCell> comparator)
          Constructor for class ItemSetMatcher.
 
Method Summary
 void appendChildMatcher(DataCell[] itemSet, int idx2process)
           
 int compare(DataCell val)
           
 int compareTo(SubsetMatcher o)
          Compares two SubsetMatcher objects based on the item they match using their comparator.
 int getChildCount()
          /**
 Collection<SubsetMatcher> getChildren()
           
 DataCell getItem()
           
 int getItemSetCount()
           
 void getItemSets(Collection<DataCell> itemSets, Collection<DataCell> previousItems)
           
 boolean isEnd()
           
 void match(DataCell[] transactionItems, int idx, Collection<SetMissmatches> matchingSets, Collection<DataCell> items, MismatchCounter mismatches)
           
 boolean matches(DataCell item)
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubsetMatcher

public SubsetMatcher(DataCell item,
                     Comparator<DataCell> comparator)
Constructor for class ItemSetMatcher.

Parameters:
item - the item this matcher matches
comparator - the comparator to use
Method Detail

appendChildMatcher

public void appendChildMatcher(DataCell[] itemSet,
                               int idx2process)
Parameters:
itemSet - the item set to create the child matcher for
idx2process - the index of the item to match

isEnd

public boolean isEnd()
Returns:
true if this matcher matches the last item of an item set

getChildren

public Collection<SubsetMatcher> getChildren()
Returns:
the children SubsetMatcher of this matcher if any

matches

public boolean matches(DataCell item)
Parameters:
item - the item to match
Returns:
true if the matcher matches the given item

getItem

public DataCell getItem()
Returns:
the item this matcher matches

compare

public int compare(DataCell val)
Parameters:
val - the value to compare with the one this matcher matches
Returns:
a negative integer, zero, or a positive integer as the matching item is less than, equal to, or greater than the given value.

match

public void match(DataCell[] transactionItems,
                  int idx,
                  Collection<SetMissmatches> matchingSets,
                  Collection<DataCell> items,
                  MismatchCounter mismatches)
Parameters:
transactionItems - the sorted transaction item list
idx - the index to process
matchingSets - all matching item sets
items - all processed items
mismatches - the MismatchCounter

getItemSets

public void getItemSets(Collection<DataCell> itemSets,
                        Collection<DataCell> previousItems)
Parameters:
itemSets - all item sets that are matched by the given matchers
previousItems - the previous items

getChildCount

public int getChildCount()
/**

Returns:
the number of children and sub children

getItemSetCount

public int getItemSetCount()
Returns:
the number of item sets that are matched by this matcher and its children

toString

public String toString()

Overrides:
toString in class Object

compareTo

public int compareTo(SubsetMatcher o)
Compares two SubsetMatcher objects based on the item they match using their comparator.

Specified by:
compareTo in interface Comparable<SubsetMatcher>


Copyright, 2003 - 2012. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.