Methods Summary |
---|
void | addInstance(Instance instance)Add an instance to the learner
mInstances.add(instance);
|
abstract java.util.ArrayList | classify(int sequenceType, int orientationType, float[] vector)
|
java.util.ArrayList | getInstances()Retrieve all the instances
return mInstances;
|
void | removeInstance(long id)Remove an instance based on its 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;
}
}
|
void | removeInstances(java.lang.String name)Remove all the instances of a category
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);
|