Renamed package namespaces to assure a better usability with other libraries.
git-svn-id: svn://svn.code.sf.net/p/wiigee/code/trunk@81 c7eff9ee-dd40-0410-8832-91a4d88773cf
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
libs.junit_4.classpath=\
|
||||
${base}/junit_4/junit-4.5.jar
|
||||
libs.junit_4.javadoc=\
|
||||
${base}/junit_4/junit-4.5-api.zip
|
||||
libs.junit_4.src=\
|
||||
${base}/junit_4/junit-4.5-src.jar
|
||||
libs.junit.classpath=\
|
||||
${base}/junit/junit-3.8.2.jar
|
||||
libs.junit.javadoc=\
|
||||
${base}/junit/junit-3.8.2-api.zip
|
||||
|
||||
@@ -1,72 +1,73 @@
|
||||
application.title=wiigee-lib
|
||||
application.vendor=bepo
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/wiigee-lib.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
file.reference.android.jar=lib/android.jar
|
||||
file.reference.bluecove-2.1.0.jar=lib/bluecove-2.1.0.jar
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.bluecove-2.1.0.jar}:\
|
||||
${file.reference.android.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.source=1.5
|
||||
javac.target=1.5
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
jnlp.codebase.type=local
|
||||
jnlp.codebase.url=file:/Users/bepo/develop/java/waste/wiigee-lib/dist
|
||||
jnlp.descriptor=application
|
||||
jnlp.enabled=false
|
||||
jnlp.offline-allowed=false
|
||||
jnlp.signed=false
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
application.title=wiigee-lib
|
||||
application.vendor=bepo
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
build.dir=build
|
||||
build.generated.dir=${build.dir}/generated
|
||||
# Only compile against the classpath explicitly listed here:
|
||||
build.sysclasspath=ignore
|
||||
build.test.classes.dir=${build.dir}/test/classes
|
||||
build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=\
|
||||
${run.classpath}
|
||||
debug.test.classpath=\
|
||||
${run.test.classpath}
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/wiigee-lib.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
excludes=
|
||||
file.reference.android.jar=lib/android.jar
|
||||
file.reference.bluecove-2.1.0.jar=lib/bluecove-2.1.0.jar
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.bluecove-2.1.0.jar}:\
|
||||
${file.reference.android.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.source=1.5
|
||||
javac.target=1.5
|
||||
javac.test.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}:\
|
||||
${libs.junit.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
javadoc.private=false
|
||||
javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
jnlp.codebase.type=local
|
||||
jnlp.codebase.url=file:/Users/bepo/develop/java/wiigee/trunk/wiigee-lib/dist
|
||||
jnlp.descriptor=application
|
||||
jnlp.enabled=false
|
||||
jnlp.offline-allowed=false
|
||||
jnlp.signed=false
|
||||
meta.inf.dir=${src.dir}/META-INF
|
||||
platform.active=default_platform
|
||||
run.classpath=\
|
||||
${javac.classpath}:\
|
||||
${build.classes.dir}
|
||||
# Space-separated list of JVM arguments used when running the project
|
||||
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
|
||||
# or test-sys-prop.name=value to set system properties for unit tests):
|
||||
run.jvmargs=
|
||||
run.test.classpath=\
|
||||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
package control;
|
||||
package org.wiigee.control;
|
||||
|
||||
import device.AndroidDevice;
|
||||
import event.GestureListener;
|
||||
import filter.Filter;
|
||||
import util.Log;
|
||||
import org.wiigee.device.AndroidDevice;
|
||||
import org.wiigee.event.GestureListener;
|
||||
import org.wiigee.filter.Filter;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
/**
|
||||
* This is for using wiigee on Android Smartphones. This port has been
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package control;
|
||||
package org.wiigee.control;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
@@ -32,9 +32,9 @@ import javax.bluetooth.DiscoveryListener;
|
||||
import javax.bluetooth.RemoteDevice;
|
||||
import javax.bluetooth.ServiceRecord;
|
||||
|
||||
import util.Log;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
import device.Wiimote;
|
||||
import org.wiigee.device.Wiimote;
|
||||
|
||||
public class WiimoteDeviceDiscovery implements DiscoveryListener {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
package control;
|
||||
package org.wiigee.control;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
@@ -29,11 +29,11 @@ import java.util.Vector;
|
||||
import javax.bluetooth.DiscoveryAgent;
|
||||
import javax.bluetooth.LocalDevice;
|
||||
|
||||
import util.Log;
|
||||
import device.Wiimote;
|
||||
import event.DeviceListener;
|
||||
import event.GestureListener;
|
||||
import filter.Filter;
|
||||
import org.wiigee.util.Log;
|
||||
import org.wiigee.device.Wiimote;
|
||||
import org.wiigee.event.DeviceListener;
|
||||
import org.wiigee.event.GestureListener;
|
||||
import org.wiigee.filter.Filter;
|
||||
|
||||
// Singleton
|
||||
public class WiimoteWiigee {
|
||||
@@ -22,9 +22,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package device;
|
||||
package org.wiigee.device;
|
||||
|
||||
import android.hardware.SensorListener;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
|
||||
/**
|
||||
@@ -33,7 +35,7 @@ import android.hardware.SensorManager;
|
||||
* @author liangj01
|
||||
*
|
||||
*/
|
||||
public class AndroidDevice extends Device implements SensorListener {
|
||||
public class AndroidDevice extends Device implements SensorEventListener {
|
||||
|
||||
private float x0, y0, z0, x1, y1, z1;
|
||||
|
||||
@@ -48,8 +50,11 @@ public class AndroidDevice extends Device implements SensorListener {
|
||||
|
||||
}
|
||||
|
||||
public void onSensorChanged(int sensor, float[] values) {
|
||||
if (this.accelerationEnabled() && sensor == SensorManager.SENSOR_ACCELEROMETER) {
|
||||
public void onSensorChanged(SensorEvent sevent) {
|
||||
Sensor sensor = sevent.sensor;
|
||||
float[] values = sevent.values;
|
||||
|
||||
if (this.accelerationEnabled() && sensor.getType() == SensorManager.SENSOR_ACCELEROMETER) {
|
||||
|
||||
double x, y, z;
|
||||
float xraw, yraw, zraw;
|
||||
@@ -71,8 +76,8 @@ public class AndroidDevice extends Device implements SensorListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void onAccuracyChanged(int arg0, int arg1) {
|
||||
// TODO
|
||||
public void onAccuracyChanged(Sensor arg0, int arg1) {
|
||||
// Nothing to do.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,14 +22,16 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package device;
|
||||
package org.wiigee.device;
|
||||
|
||||
import org.wiigee.logic.ProcessingUnit;
|
||||
import org.wiigee.logic.TriggeredProcessingUnit;
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
import logic.*;
|
||||
import event.*;
|
||||
import filter.*;
|
||||
import org.wiigee.logic.*;
|
||||
import org.wiigee.event.*;
|
||||
import org.wiigee.filter.*;
|
||||
|
||||
public class Device {
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package device;
|
||||
package org.wiigee.device;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
import javax.bluetooth.L2CAPConnection;
|
||||
import javax.microedition.io.Connector;
|
||||
import event.*;
|
||||
import util.Log;
|
||||
import org.wiigee.event.*;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
/**
|
||||
* @author Benjamin 'BePo' Poppinga
|
||||
@@ -22,16 +22,16 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package device;
|
||||
package org.wiigee.device;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EventObject;
|
||||
|
||||
import javax.bluetooth.L2CAPConnection;
|
||||
|
||||
import event.ButtonPressedEvent;
|
||||
import event.ButtonReleasedEvent;
|
||||
import util.Log;
|
||||
import org.wiigee.event.ButtonPressedEvent;
|
||||
import org.wiigee.event.ButtonReleasedEvent;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
/**
|
||||
* This class listens to data sended by the wiimote and generates specific
|
||||
@@ -22,11 +22,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
import device.*;
|
||||
import org.wiigee.device.*;
|
||||
|
||||
/**
|
||||
* This Event would be generated if an acceleration has been detected.
|
||||
@@ -22,11 +22,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
import device.Device;
|
||||
import org.wiigee.device.Device;
|
||||
|
||||
public class ActionStartEvent extends EventObject {
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
import device.Device;
|
||||
import org.wiigee.device.Device;
|
||||
|
||||
public class ActionStopEvent extends EventObject {
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import device.*;
|
||||
import org.wiigee.device.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -22,11 +22,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
import device.*;
|
||||
import org.wiigee.device.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import logic.ProcessingUnit;
|
||||
import org.wiigee.logic.ProcessingUnit;
|
||||
|
||||
/**
|
||||
* This event would be generated if a gesture has been detected.
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
import device.Wiimote;
|
||||
import org.wiigee.device.Wiimote;
|
||||
|
||||
public class InfraredEvent extends EventObject {
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import device.Device;
|
||||
import org.wiigee.device.Device;
|
||||
|
||||
public class MotionStartEvent extends ActionStartEvent {
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import device.Device;
|
||||
import org.wiigee.device.Device;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -22,10 +22,10 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package event;
|
||||
package org.wiigee.event;
|
||||
|
||||
import java.util.EventObject;
|
||||
import logic.ProcessingUnit;
|
||||
import org.wiigee.logic.ProcessingUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package filter;
|
||||
package org.wiigee.filter;
|
||||
|
||||
public class DirectionalEquivalenceFilter extends Filter {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package filter;
|
||||
package org.wiigee.filter;
|
||||
|
||||
public abstract class Filter {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package filter;
|
||||
package org.wiigee.filter;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package filter;
|
||||
package org.wiigee.filter;
|
||||
|
||||
public class IdleStateFilter extends Filter {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package filter;
|
||||
package org.wiigee.filter;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -22,9 +22,9 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package filter;
|
||||
package org.wiigee.filter;
|
||||
|
||||
import device.Device;
|
||||
import org.wiigee.device.Device;
|
||||
|
||||
public class MotionDetectFilter extends Filter {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package logic;
|
||||
package org.wiigee.logic;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package logic;
|
||||
package org.wiigee.logic;
|
||||
|
||||
import java.util.Vector;
|
||||
import event.AccelerationEvent;
|
||||
import org.wiigee.event.AccelerationEvent;
|
||||
|
||||
/**
|
||||
* This class represents ONE movement trajectory in a
|
||||
@@ -22,11 +22,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package logic;
|
||||
package org.wiigee.logic;
|
||||
|
||||
import java.util.Vector;
|
||||
import event.AccelerationEvent;
|
||||
import util.Log;
|
||||
import org.wiigee.event.AccelerationEvent;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
/**
|
||||
* This Class units a Quantizer-Component and an Model-Component.
|
||||
@@ -22,10 +22,10 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package logic;
|
||||
package org.wiigee.logic;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Vector;
|
||||
import util.Log;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
/**
|
||||
* This is a Hidden Markov Model implementation which internally provides
|
||||
@@ -22,11 +22,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package logic;
|
||||
package org.wiigee.logic;
|
||||
import java.text.*;
|
||||
import java.util.Vector;
|
||||
import java.lang.Math;
|
||||
import util.Log;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
/**
|
||||
* This is a Hidden Markov Model implementation which internally provides
|
||||
@@ -248,7 +248,53 @@ public class PreciseHMM {
|
||||
|
||||
return sf;
|
||||
} // calculateScalingFactor
|
||||
|
||||
|
||||
// NEW
|
||||
// returns s(t).
|
||||
private double[] getScalingFactors(int[] sequence) {
|
||||
double[][] fwd = this.forwardProc(sequence); // i t
|
||||
double[] retVal = new double[fwd[0].length];
|
||||
|
||||
// init
|
||||
// fixed t = 0 time
|
||||
for(int i=0; i<fwd.length; i++) {
|
||||
retVal[0] += fwd[i][0];
|
||||
}
|
||||
|
||||
// iterate
|
||||
for(int t=1; t<fwd[0].length; t++) {
|
||||
for(int i=0; i<fwd.length; i++) {
|
||||
retVal[t] += fwd[i][t];
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
// NEW b = state/symbol
|
||||
private double[][] getScaledForwardProc(int[] sequence) {
|
||||
double[][] fwd = this.forwardProc(sequence);
|
||||
double[] s = this.getScalingFactors(sequence);
|
||||
double[][] retVal = new double[fwd.length][fwd[0].length];
|
||||
|
||||
// init
|
||||
// fixed t = 0 time
|
||||
retVal[0][0] = this.b[0][0];
|
||||
for(int i=0; i<retVal[0].length; i++) {
|
||||
retVal[0][i] = 0.0;
|
||||
}
|
||||
|
||||
// iterate
|
||||
// t > 0 time
|
||||
for(int t=1; t<retVal[0].length; t++) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/***
|
||||
* Returns the scaled Forward variable.
|
||||
* TODO: Maybe try out if the other precalculated method is faster.
|
||||
@@ -1,18 +1,18 @@
|
||||
package logic;
|
||||
package org.wiigee.logic;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import event.AccelerationEvent;
|
||||
import event.ButtonPressedEvent;
|
||||
import event.ButtonReleasedEvent;
|
||||
import event.DeviceListener;
|
||||
import event.GestureEvent;
|
||||
import event.GestureListener;
|
||||
import event.InfraredEvent;
|
||||
import event.MotionStartEvent;
|
||||
import event.MotionStopEvent;
|
||||
import event.StateEvent;
|
||||
import util.Log;
|
||||
import org.wiigee.event.AccelerationEvent;
|
||||
import org.wiigee.event.ButtonPressedEvent;
|
||||
import org.wiigee.event.ButtonReleasedEvent;
|
||||
import org.wiigee.event.DeviceListener;
|
||||
import org.wiigee.event.GestureEvent;
|
||||
import org.wiigee.event.GestureListener;
|
||||
import org.wiigee.event.InfraredEvent;
|
||||
import org.wiigee.event.MotionStartEvent;
|
||||
import org.wiigee.event.MotionStopEvent;
|
||||
import org.wiigee.event.StateEvent;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
public abstract class ProcessingUnit implements DeviceListener {
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package logic;
|
||||
package org.wiigee.logic;
|
||||
|
||||
import java.util.Vector;
|
||||
import event.AccelerationEvent;
|
||||
import util.Log;
|
||||
import org.wiigee.event.AccelerationEvent;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
/**
|
||||
* This class implements a quantization component. In this case a
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package logic;
|
||||
package org.wiigee.logic;
|
||||
import java.text.*;
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package logic;
|
||||
package org.wiigee.logic;
|
||||
|
||||
import java.util.Vector;
|
||||
import event.*;
|
||||
import util.Log;
|
||||
import org.wiigee.event.*;
|
||||
import org.wiigee.util.Log;
|
||||
|
||||
/**
|
||||
* This class analyzes the WiimoteAccelerationEvents emitted from a Wiimote
|
||||
@@ -184,13 +184,13 @@ public class TriggeredProcessingUnit extends ProcessingUnit {
|
||||
|
||||
@Override
|
||||
public void loadGesture(String filename) {
|
||||
GestureModel g = util.FileIO.readFromFile(filename);
|
||||
GestureModel g = org.wiigee.util.FileIO.readFromFile(filename);
|
||||
this.classifier.addGestureModel(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveGesture(int id, String filename) {
|
||||
util.FileIO.writeToFile(this.classifier.getGestureModel(id), filename);
|
||||
org.wiigee.util.FileIO.writeToFile(this.classifier.getGestureModel(id), filename);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,16 +22,16 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package util;
|
||||
package org.wiigee.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import logic.GestureModel;
|
||||
import logic.HMM;
|
||||
import logic.Quantizer;
|
||||
import org.wiigee.logic.GestureModel;
|
||||
import org.wiigee.logic.HMM;
|
||||
import org.wiigee.logic.Quantizer;
|
||||
|
||||
/**
|
||||
* This is a static class to support saving and loading complete gestures. I've
|
||||
@@ -1,4 +1,4 @@
|
||||
package util;
|
||||
package org.wiigee.util;
|
||||
|
||||
public class Log {
|
||||
|
||||
97
test/event/AccelerationEventTest.java
Normal file
97
test/event/AccelerationEventTest.java
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package event;
|
||||
|
||||
import org.wiigee.event.AccelerationEvent;
|
||||
import org.wiigee.device.Device;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author bepo
|
||||
*/
|
||||
public class AccelerationEventTest extends TestCase {
|
||||
|
||||
public AccelerationEventTest(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getSource method, of class AccelerationEvent.
|
||||
*/
|
||||
public void testGetSource() {
|
||||
System.out.println("getSource");
|
||||
AccelerationEvent instance = null;
|
||||
Device expResult = null;
|
||||
Device result = instance.getSource();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getX method, of class AccelerationEvent.
|
||||
*/
|
||||
public void testGetX() {
|
||||
System.out.println("getX");
|
||||
AccelerationEvent instance = null;
|
||||
double expResult = 0.0;
|
||||
double result = instance.getX();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getY method, of class AccelerationEvent.
|
||||
*/
|
||||
public void testGetY() {
|
||||
System.out.println("getY");
|
||||
AccelerationEvent instance = null;
|
||||
double expResult = 0.0;
|
||||
double result = instance.getY();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getZ method, of class AccelerationEvent.
|
||||
*/
|
||||
public void testGetZ() {
|
||||
System.out.println("getZ");
|
||||
AccelerationEvent instance = null;
|
||||
double expResult = 0.0;
|
||||
double result = instance.getZ();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAbsValue method, of class AccelerationEvent.
|
||||
*/
|
||||
public void testGetAbsValue() {
|
||||
System.out.println("getAbsValue");
|
||||
AccelerationEvent instance = null;
|
||||
double expResult = 0.0;
|
||||
double result = instance.getAbsValue();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user