Fixed some bugs with focus on State-Events: Removed State Event and added a 'valid'-boolean to a Gesture object, to validate if the gesture detected is a valid gesture.
git-svn-id: svn://svn.code.sf.net/p/wiigee/code/trunk@98 c7eff9ee-dd40-0410-8832-91a4d88773cf
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import org.wiigee.logic.ProcessingUnit;
|
||||
@@ -36,31 +35,37 @@ import org.wiigee.logic.ProcessingUnit;
|
||||
*/
|
||||
public class GestureEvent {
|
||||
|
||||
int id;
|
||||
double probability;
|
||||
ProcessingUnit analyzer;
|
||||
|
||||
/** Create a GestureEvent
|
||||
*
|
||||
* @param source The Source, which detected the gesture.
|
||||
* @param id A gesture ID for identifying a gesture.
|
||||
* @param probability The Bayes-Classifier calculated probability.
|
||||
*/
|
||||
public GestureEvent(ProcessingUnit source, int id, double probability) {
|
||||
this.analyzer=source;
|
||||
this.id=id;
|
||||
this.probability=probability;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public double getProbability() {
|
||||
return this.probability;
|
||||
}
|
||||
|
||||
public ProcessingUnit getSource() {
|
||||
return this.analyzer;
|
||||
}
|
||||
int id;
|
||||
boolean valid;
|
||||
double probability;
|
||||
ProcessingUnit analyzer;
|
||||
|
||||
/** Create a GestureEvent
|
||||
*
|
||||
* @param source The Source, which detected the gesture.
|
||||
* @param id A gesture ID for identifying a gesture.
|
||||
* @param probability The Bayes-Classifier calculated probability.
|
||||
*/
|
||||
public GestureEvent(ProcessingUnit source, boolean valid, int id, double probability) {
|
||||
this.analyzer = source;
|
||||
this.valid = valid;
|
||||
this.id = id;
|
||||
this.probability = probability;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return this.valid;
|
||||
}
|
||||
|
||||
public double getProbability() {
|
||||
return this.probability;
|
||||
}
|
||||
|
||||
public ProcessingUnit getSource() {
|
||||
return this.analyzer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008, 2009 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: wiigee@benjaminpoppinga.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
import org.wiigee.logic.ProcessingUnit;
|
||||
|
||||
/**
|
||||
* This is a StateEvent, telling the listeners in which state of recognition
|
||||
* the tool is:
|
||||
* 1 = training,
|
||||
* 2 = recognition
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*/
|
||||
public class StateEvent extends EventObject {
|
||||
|
||||
public final int STATE_LEARNING=1;
|
||||
public final int STATE_RECOGNIZING=2;
|
||||
|
||||
int state;
|
||||
ProcessingUnit analyzer;
|
||||
|
||||
/**
|
||||
* Create a StateEvent.
|
||||
*
|
||||
* @param source The source of which the state has changed.
|
||||
* @param state The state the source has switched to.
|
||||
*/
|
||||
public StateEvent(ProcessingUnit source, int state) {
|
||||
super(source);
|
||||
this.analyzer=source;
|
||||
this.state=state;
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
public ProcessingUnit getSource() {
|
||||
return this.analyzer;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* wiigee - accelerometerbased gesture recognition
|
||||
* Copyright (C) 2007, 2008, 2009 Benjamin Poppinga
|
||||
*
|
||||
* Developed at University of Oldenburg
|
||||
* Contact: wiigee@benjaminpoppinga.de
|
||||
*
|
||||
* This file is part of wiigee.
|
||||
*
|
||||
* wiigee is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This is the StateListener interface which has to be implemented
|
||||
* by any application which should receive recognized statechanges.
|
||||
*
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
*
|
||||
*/
|
||||
public interface StateListener extends EventListener {
|
||||
|
||||
/**
|
||||
* This method would be called if the gesture-recognizing system
|
||||
* switched the state from recognition to training or otherwise.
|
||||
*
|
||||
* @param event The StateEvent containing information about the
|
||||
* state-change.
|
||||
*/
|
||||
public abstract void stateReceived(StateEvent event);
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user