package org.expeditee.gio.input; import java.util.HashSet; import java.util.List; import java.util.Set; import org.expeditee.Util; import org.expeditee.gio.gesture.Gesture; import org.expeditee.gio.input.InputEvent.InputType; public abstract class InputEventToGestureTranslator { /** The set of monitored input types. */ protected HashSet _monitoredInputTypes = new HashSet(); /** Default constructor. */ protected InputEventToGestureTranslator() { } /** Constructor tells which input type this translator monitors. */ public InputEventToGestureTranslator(InputType monitoredInputType) { if (monitoredInputType != null) _monitoredInputTypes.add(monitoredInputType); } /** Constructor tells which input types this translator monitors. */ public InputEventToGestureTranslator(InputType[] monitoredInputTypes) { _monitoredInputTypes = Util.hashSetFromArray(monitoredInputTypes); } /** Returns a string describing this gesture. */ public abstract String details(); /** Method which receives input events and translates them into Expeditee gestures. */ public abstract List onInputEvent(InputEvent event); /** Gets the set of all input types that this translator monitors. */ public Set getMonitoredInputTypes() { return new HashSet(_monitoredInputTypes); } /** Finds out if the given input type is monitored by this translator. */ public boolean isMonitoredType(InputType type) { if (_monitoredInputTypes == null) return false; return _monitoredInputTypes.contains(type); } }