edu.rice.cs.drjava.ui.predictive
Interface PredictiveInputModel.MatchingStrategy<X extends Comparable<? super X>>

All Known Implementing Classes:
PredictiveInputModel.FragmentLineNumStrategy, PredictiveInputModel.FragmentStrategy, PredictiveInputModel.PrefixLineNumStrategy, PredictiveInputModel.PrefixStrategy, PredictiveInputModel.RegExLineNumStrategy, PredictiveInputModel.RegExStrategy
Enclosing class:
PredictiveInputModel<T extends Comparable<? super T>>

public static interface PredictiveInputModel.MatchingStrategy<X extends Comparable<? super X>>

Strategy used for matching and mask extension.


Method Summary
 int compare(X item1, X item2, PredictiveInputModel<X> pim)
          Compare the two items and return -1, 0, or 1 if item1 is less than, equal to, or greater than item2.
 boolean equivalent(X item1, X item2, PredictiveInputModel<X> pim)
          Returns true if the two items are equivalent under this matching strategy.
 String force(X item, String mask)
          Force the mask to fit this entry.
 String getExtendedSharedMask(List<X> items, PredictiveInputModel<X> pim)
          Returns the mask extended by the shared extension.
 X getLongestMatch(X item, List<X> items, PredictiveInputModel<X> pim)
          Returns the item from the list that is the longest match.
 String getSharedMaskExtension(List<X> items, PredictiveInputModel<X> pim)
          Returns the shared mask extension for the list of items.
 boolean isMatch(X item, PredictiveInputModel<X> pim)
          Returns true if the item is a match.
 boolean isPerfectMatch(X item, PredictiveInputModel<X> pim)
          Returns true if the item is perfect a match.
 

Method Detail

isMatch

boolean isMatch(X item,
                PredictiveInputModel<X> pim)
Returns true if the item is a match.

Parameters:
item - item to check
pim - predictive input model
Returns:
true if the item is a match

isPerfectMatch

boolean isPerfectMatch(X item,
                       PredictiveInputModel<X> pim)
Returns true if the item is perfect a match.

Parameters:
item - item to check
pim - predictive input model
Returns:
true if the item is a match

equivalent

boolean equivalent(X item1,
                   X item2,
                   PredictiveInputModel<X> pim)
Returns true if the two items are equivalent under this matching strategy.

Parameters:
item1 - first item
item2 - second item
pim - predictive input model
Returns:
true if equivalent

compare

int compare(X item1,
            X item2,
            PredictiveInputModel<X> pim)
Compare the two items and return -1, 0, or 1 if item1 is less than, equal to, or greater than item2.

Parameters:
item1 - first item
item2 - second item
pim - predictive input model
Returns:
-1, 0, or 1

getLongestMatch

X getLongestMatch(X item,
                  List<X> items,
                  PredictiveInputModel<X> pim)
Returns the item from the list that is the longest match.

Parameters:
item - target item
items - list with items
pim - predictive input model
Returns:
longest match

getSharedMaskExtension

String getSharedMaskExtension(List<X> items,
                              PredictiveInputModel<X> pim)
Returns the shared mask extension for the list of items.

Parameters:
items - items for which the mask extension should be generated
pim - predictive input model
Returns:
the shared mask extension

getExtendedSharedMask

String getExtendedSharedMask(List<X> items,
                             PredictiveInputModel<X> pim)
Returns the mask extended by the shared extension.

Parameters:
items - items for which the mask extension should be generated
pim - predictive input model
Returns:
the extended shared mask

force

String force(X item,
             String mask)
Force the mask to fit this entry. The matching strategies that accept line numbers can combine the current item with the line number. Other strategies just return the current item.

Returns:
forced string