© 2006-2007 ETH Zurich

org.ximtec.igesture.core.composite
Class CardinalityDeviceConstraint

java.lang.Object
  extended by org.ximtec.igesture.core.DefaultPropertyChangeNotifier
      extended by org.ximtec.igesture.core.DefaultDataObject
          extended by org.ximtec.igesture.core.composite.DefaultConstraint
              extended by org.ximtec.igesture.core.composite.IntervalConstraint
                  extended by org.ximtec.igesture.core.composite.CardinalityDeviceConstraint
All Implemented Interfaces:
Serializable, Constraint, DataObject, PropertyChangeNotifier
Direct Known Subclasses:
CardinalityUserConstraint

public class CardinalityDeviceConstraint
extends IntervalConstraint

This class represents a cardinality constraint. A certain gesture has to be performed between a mimimum and a maximum number of times within a certain time interval. The main example for this kind of constraint is defining a majority. Each device has only one vote.

Author:
Bjorn Puype, bpuype@gmail.com
See Also:
Serialized Form

Nested Class Summary
static class CardinalityDeviceConstraint.Config
           
 
Field Summary
 
Fields inherited from class org.ximtec.igesture.core.composite.DefaultConstraint
DEFAULT_CONFIGURATION, df, gestures, gestureTime, processingTime, PROPERTY_GESTURES, setterMapping
 
Fields inherited from class org.ximtec.igesture.core.DefaultDataObject
PROPERTY_ID
 
Fields inherited from class org.ximtec.igesture.core.DefaultPropertyChangeNotifier
propertyChangeSupport
 
Constructor Summary
CardinalityDeviceConstraint()
           
 
Method Summary
 void addGestureClass(String gestureClass)
          Add a gesture class to the composite gesture.
 void addGestureClass(String gestureClass, int user)
          Add a gesture class to the composite gesture and specify the user that performs it.
 void addGestureClass(String gestureClass, int user, String deviceType, Set<String> devices)
          Add a gesture class to the composite gesture and specify the user and the device type used to perform it.
 void addGestureClass(String gestureClass, String deviceType, Set<String> devices)
          Add a gesture class to the composite gesture and specify the device type used to perform it.
 Set<String> generatePatterns(Map<String,String> charMapping)
          Generate all possible string patterns that represent the composite gesture.
 int getMaximumGestures()
          Get the maximum number of gestures that has to be performed
 int getMinimumGestures()
          Get the minimum number of gestures that has to be performed
 void setMaximumGestures(String max)
          Set the maximum number of gestures to perform
 void setMinimumGestures(String min)
          Set the minimum number of gestures to perform
 String toString()
           
 boolean validateConditions(List<Gesture<?>> gestures, IDeviceManager manager)
          Validate the constraint conditions.
 
Methods inherited from class org.ximtec.igesture.core.composite.IntervalConstraint
determineTimeWindows, getDuration, setDuration
 
Methods inherited from class org.ximtec.igesture.core.composite.DefaultConstraint
getDistinctGestureClasses, getGestureClasses, getGestureEntries, getGestureTime, getNumberOfGestures, getParameter, getParameters, getTimeStamp, removeAllGestureClasses, removeGestureClass, setGestureTime, setParameter
 
Methods inherited from class org.ximtec.igesture.core.DefaultDataObject
accept, getId, setId
 
Methods inherited from class org.ximtec.igesture.core.DefaultPropertyChangeNotifier
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ximtec.igesture.core.PropertyChangeNotifier
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

CardinalityDeviceConstraint

public CardinalityDeviceConstraint()
Method Detail

addGestureClass

public void addGestureClass(String gestureClass)
Description copied from interface: Constraint
Add a gesture class to the composite gesture. Note: All users and devices are allowed to perform the gesture.

Specified by:
addGestureClass in interface Constraint
Overrides:
addGestureClass in class DefaultConstraint

addGestureClass

public void addGestureClass(String gestureClass,
                            int user)
Description copied from interface: Constraint
Add a gesture class to the composite gesture and specify the user that performs it. Note: All devices are allowed to perform the gesture.

Specified by:
addGestureClass in interface Constraint
Overrides:
addGestureClass in class DefaultConstraint

addGestureClass

public void addGestureClass(String gestureClass,
                            String deviceType,
                            Set<String> devices)
Description copied from interface: Constraint
Add a gesture class to the composite gesture and specify the device type used to perform it. Note: all users are allowed to perform to gesture. If devices is null, all devices of type deviceType are allowed to perform the gesture.

Specified by:
addGestureClass in interface Constraint
Overrides:
addGestureClass in class DefaultConstraint

addGestureClass

public void addGestureClass(String gestureClass,
                            int user,
                            String deviceType,
                            Set<String> devices)
Description copied from interface: Constraint
Add a gesture class to the composite gesture and specify the user and the device type used to perform it. Note: if devices is null, all devices of type deviceType are allowed to perform the gesture.

Specified by:
addGestureClass in interface Constraint
Overrides:
addGestureClass in class DefaultConstraint

setMinimumGestures

public void setMinimumGestures(String min)
                        throws NumberFormatException
Set the minimum number of gestures to perform

Throws:
NumberFormatException

getMinimumGestures

public int getMinimumGestures()
Get the minimum number of gestures that has to be performed


setMaximumGestures

public void setMaximumGestures(String max)
                        throws NumberFormatException
Set the maximum number of gestures to perform

Throws:
NumberFormatException

getMaximumGestures

public int getMaximumGestures()
Get the maximum number of gestures that has to be performed


generatePatterns

public Set<String> generatePatterns(Map<String,String> charMapping)
Description copied from interface: Constraint
Generate all possible string patterns that represent the composite gesture.

Specified by:
generatePatterns in interface Constraint
Overrides:
generatePatterns in class IntervalConstraint
Parameters:
charMapping - Mapping between the gesture class name and the character representation

validateConditions

public boolean validateConditions(List<Gesture<?>> gestures,
                                  IDeviceManager manager)
Description copied from interface: Constraint
Validate the constraint conditions.

Specified by:
validateConditions in interface Constraint
Overrides:
validateConditions in class IntervalConstraint
Parameters:
gestures - Gestures that possibly compose the composite gesture.
manager - Device manager to check the associated users.
Returns:

toString

public String toString()
Specified by:
toString in interface Constraint
Overrides:
toString in class IntervalConstraint

© 2006-2007 ETH Zurich

Copyright © 2007-2010 Global Information Systems Group, ETH Zurich. All Rights Reserved.