FileDocCategorySizeDatePackage
Learner.javaAPI DocAndroid 5.1 API2432Thu Mar 12 22:22:10 GMT 2015android.gesture

Learner

public abstract class Learner extends Object
The abstract class of a gesture learner

Fields Summary
private final ArrayList
mInstances
Constructors Summary
Methods Summary
voidaddInstance(Instance instance)
Add an instance to the learner

param
instance


                  
       
        mInstances.add(instance);
    
abstract java.util.ArrayListclassify(int sequenceType, int orientationType, float[] vector)

java.util.ArrayListgetInstances()
Retrieve all the instances

return
instances

        return mInstances;
    
voidremoveInstance(long id)
Remove an instance based on its id

param
id

        ArrayList<Instance> instances = mInstances;
        int count = instances.size();
        for (int i = 0; i < count; i++) {
            Instance instance = instances.get(i);
            if (id == instance.id) {
                instances.remove(instance);
                return;
            }
        }
    
voidremoveInstances(java.lang.String name)
Remove all the instances of a category

param
name the category name

        final ArrayList<Instance> toDelete = new ArrayList<Instance>();
        final ArrayList<Instance> instances = mInstances;
        final int count = instances.size();

        for (int i = 0; i < count; i++) {
            final Instance instance = instances.get(i);
            // the label can be null, as specified in Instance
            if ((instance.label == null && name == null)
                    || (instance.label != null && instance.label.equals(name))) {
                toDelete.add(instance);
            }
        }
        instances.removeAll(toDelete);