ch.uzh.ifi.attempto.preditor
Class DefaultMenuItemComparator

java.lang.Object
  extended by ch.uzh.ifi.attempto.preditor.DefaultMenuItemComparator
All Implemented Interfaces:
java.util.Comparator<MenuItem>

public class DefaultMenuItemComparator
extends java.lang.Object
implements java.util.Comparator<MenuItem>

This class represents the default comparator to sort menu items in the menus of the predictive editor. Prefixes can be set that are ignored for comparison. By default, these prefixes are "the ", "a " and "and " plus their capizalized versions.

Author:
Tobias Kuhn

Constructor Summary
DefaultMenuItemComparator()
          Creates a new default comparator for menu items.
 
Method Summary
 void addPrefix(java.lang.String prefix)
          Adds a prefix.
 int compare(MenuItem m1, MenuItem m2)
           
 void setPrefixes(java.util.Set<java.lang.String> prefixes)
          Sets the prefixes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

DefaultMenuItemComparator

public DefaultMenuItemComparator()
Creates a new default comparator for menu items.

Method Detail

compare

public int compare(MenuItem m1,
                   MenuItem m2)
Specified by:
compare in interface java.util.Comparator<MenuItem>

addPrefix

public void addPrefix(java.lang.String prefix)
Adds a prefix.

Parameters:
prefix - The prefix to be added.

setPrefixes

public void setPrefixes(java.util.Set<java.lang.String> prefixes)
Sets the prefixes.

Parameters:
prefixes - The set of prefixes.


Copyright 2008-2012, AceWiki developers