Android Open Source - wiigee_android_test Processing Unit






From Project

Back to project page wiigee_android_test.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project wiigee_android_test listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.wiigee.logic;
/* ww w  .  j  av a 2s . co m*/
import java.util.Vector;

import org.wiigee.event.AccelerationEvent;
import org.wiigee.event.ButtonPressedEvent;
import org.wiigee.event.ButtonReleasedEvent;
import org.wiigee.event.AccelerationListener;
import org.wiigee.event.ButtonListener;
import org.wiigee.event.GestureEvent;
import org.wiigee.event.GestureListener;
import org.wiigee.event.MotionStartEvent;
import org.wiigee.event.MotionStopEvent;
import org.wiigee.util.Log;

public abstract class ProcessingUnit implements AccelerationListener, ButtonListener {

    // Classifier
    protected Classifier classifier;
    
    // Listener
    private Vector<GestureListener> gesturelistener = new Vector<GestureListener>();

    public ProcessingUnit() {
        this.classifier = new Classifier();
    }

    /**
     * Add an GestureListener to receive GestureEvents.
     *
     * @param g
     *   Class which implements GestureListener interface.
     */
    public void addGestureListener(GestureListener g) {
        this.gesturelistener.add(g);
    }

    protected void fireGestureEvent(boolean valid, int id, double probability) {
        GestureEvent w = new GestureEvent(this, valid, id, probability);
        for (int i = 0; i < this.gesturelistener.size(); i++) {
            this.gesturelistener.get(i).gestureReceived(w);
        }
    }

    public abstract void accelerationReceived(AccelerationEvent event);

    public abstract void buttonPressReceived(ButtonPressedEvent event);

    public abstract void buttonReleaseReceived(ButtonReleasedEvent event);

    public abstract void motionStartReceived(MotionStartEvent event);

    public abstract void motionStopReceived(MotionStopEvent event);

    /**
     * Resets the complete gesturemodel. After reset no gesture is known
     * to the system.
     */
    public void reset() {
        if (this.classifier.getCountOfGestures() > 0) {
            this.classifier.clear();
            Log.write("### Model reset ###");
        } else {
            Log.write("There doesn't exist any data to reset.");
        }
    }

    // File IO
    public abstract void loadGesture(String filename);

    public abstract void saveGesture(int id, String filename);
}




Java Source Code List

asus4.wiigeeandroid.Logger.java
asus4.wiigeeandroid.MainActivity.java
org.wiigee.control.AndroidWiigee.java
org.wiigee.control.Wiigee.java
org.wiigee.device.AndroidDevice.java
org.wiigee.device.Device.java
org.wiigee.event.AccelerationEvent.java
org.wiigee.event.AccelerationListener.java
org.wiigee.event.ActionStartEvent.java
org.wiigee.event.ActionStopEvent.java
org.wiigee.event.ButtonListener.java
org.wiigee.event.ButtonPressedEvent.java
org.wiigee.event.ButtonReleasedEvent.java
org.wiigee.event.GestureEvent.java
org.wiigee.event.GestureListener.java
org.wiigee.event.MotionStartEvent.java
org.wiigee.event.MotionStopEvent.java
org.wiigee.filter.DirectionalEquivalenceFilter.java
org.wiigee.filter.Filter.java
org.wiigee.filter.HighPassFilter.java
org.wiigee.filter.IdleStateFilter.java
org.wiigee.filter.LowPassFilter.java
org.wiigee.filter.MotionDetectFilter.java
org.wiigee.logic.Classifier.java
org.wiigee.logic.GestureModel.java
org.wiigee.logic.Gesture.java
org.wiigee.logic.HMM.java
org.wiigee.logic.PreciseHMM.java
org.wiigee.logic.ProcessingUnit.java
org.wiigee.logic.Quantizer.java
org.wiigee.logic.TriggeredProcessingUnit.java
org.wiigee.util.FileIO.java
org.wiigee.util.Log.java