|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.ui.predictive.PredictiveInputModel<T>
public class PredictiveInputModel<T extends Comparable<? super T>>
Model class for predictive string input.
| Nested Class Summary | |
|---|---|
static class |
PredictiveInputModel.FragmentLineNumStrategy<X extends Comparable<? super X>>
Matching based on string fragments, supporting line numbers. |
static class |
PredictiveInputModel.FragmentStrategy<X extends Comparable<? super X>>
Matching based on string fragments. |
static interface |
PredictiveInputModel.MatchingStrategy<X extends Comparable<? super X>>
Strategy used for matching and mask extension. |
static class |
PredictiveInputModel.PrefixLineNumStrategy<X extends Comparable<? super X>>
Matching based on string prefix, supporting line numbers separated by :. |
static class |
PredictiveInputModel.PrefixStrategy<X extends Comparable<? super X>>
Matching based on string prefix. |
static class |
PredictiveInputModel.RegExLineNumStrategy<X extends Comparable<? super X>>
Matching based on string regular expressions, supporting line numbers. |
static class |
PredictiveInputModel.RegExStrategy<X extends Comparable<? super X>>
Matching based on string regular expressions. |
| Field Summary | |
|---|---|
private boolean |
_ignoreCase
True if case should be ignored. |
private int |
_index
Index of currently selected full string. |
private ArrayList<T> |
_items
Array of items. |
private String |
_mask
Currently entered mask. |
private ArrayList<T> |
_matchingItems
Array of matching items. |
private PredictiveInputModel.MatchingStrategy<T> |
_strategy
Matching strategy. |
| Constructor Summary | |
|---|---|
PredictiveInputModel(boolean ignoreCase,
PredictiveInputModel.MatchingStrategy<T> strategy,
Collection<T> items)
Create a new predictive input model. |
|
PredictiveInputModel(boolean ignoreCase,
PredictiveInputModel.MatchingStrategy<T> strategy,
T... items)
Create a new predictive input model. |
|
PredictiveInputModel(boolean ignoreCase,
PredictiveInputModel<T> pim)
Create a new predictive input model. |
|
| Method Summary | |
|---|---|
void |
extendMask(String extension)
Extends the mask. |
void |
extendSharedMask()
Extends the mask by the shared string. |
T |
getCurrentItem()
Get currently selected item. |
List<T> |
getItems()
Returns a copy of the list of items. |
String |
getMask()
Return the current mask. |
List<T> |
getMatchingItems()
Get matching items. |
String |
getSharedMaskExtension()
Returns the shared mask extension. |
private int |
indexOf(ArrayList<T> l,
T item)
Helper function that does indexOf with ignoreCase option. |
private void |
pickClosestMatch(T item)
Select as current item the item in the list of current matches that lexicographically precedes it most closely. |
void |
setCurrentItem(T item)
Set currently selected item. |
void |
setItems(Collection<T> items)
Sets the list. |
void |
setItems(PredictiveInputModel<T> pim)
Sets the list. |
void |
setItems(T... items)
Sets the list |
void |
setMask(String mask)
Set the current mask. |
void |
setStrategy(PredictiveInputModel.MatchingStrategy<T> strategy)
Sets the strategy |
private void |
updateMatchingStrings(ArrayList<T> items)
Update the list of matching strings and current index. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private volatile ArrayList<T extends Comparable<? super T>> _items
private volatile int _index
private final ArrayList<T extends Comparable<? super T>> _matchingItems
private volatile String _mask
private volatile boolean _ignoreCase
private volatile PredictiveInputModel.MatchingStrategy<T extends Comparable<? super T>> _strategy
| Constructor Detail |
|---|
public PredictiveInputModel(boolean ignoreCase,
PredictiveInputModel<T> pim)
ignoreCase - true if case should be ignoredpim - other predictive input model
public PredictiveInputModel(boolean ignoreCase,
PredictiveInputModel.MatchingStrategy<T> strategy,
Collection<T> items)
ignoreCase - true if case should be ignoredstrategy - matching strategy to useitems - list of items
public PredictiveInputModel(boolean ignoreCase,
PredictiveInputModel.MatchingStrategy<T> strategy,
T... items)
ignoreCase - true if case should be ignoredstrategy - matching strategy to useitems - varargs/array of items| Method Detail |
|---|
public void setStrategy(PredictiveInputModel.MatchingStrategy<T> strategy)
public List<T> getItems()
public void setItems(Collection<T> items)
items - list of itemspublic void setItems(T... items)
items - varargs/array of itemspublic void setItems(PredictiveInputModel<T> pim)
pim - other predictive input modelpublic String getMask()
public void setMask(String mask)
mask - new mask
private int indexOf(ArrayList<T> l,
T item)
l - listitem - item for which the index should be retrieved
private void updateMatchingStrings(ArrayList<T> items)
items - list of items to base the matching onpublic T getCurrentItem()
public void setCurrentItem(T item)
item - currently selected itemprivate void pickClosestMatch(T item)
item - item for witch to find the closest matchpublic List<T> getMatchingItems()
public String getSharedMaskExtension()
public void extendMask(String extension)
extension - string to append to maskpublic void extendSharedMask()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||