package com.uxxu.konashi.lib.stores;

import android.util.SparseArray;

import com.uxxu.konashi.lib.Konashi;
import com.uxxu.konashi.lib.KonashiErrorReason;
import com.uxxu.konashi.lib.listeners.KonashiAnalogListener;

/**
 * Created by izumin on 8/18/15.
 */
public class AioStore implements KonashiAnalogListener{
    private static final int[] PINS = {Konashi.AIO0, Konashi.AIO1, Konashi.AIO2};
    private SparseArray<Integer> mAioValues;

    public AioStore() {
        mAioValues = new SparseArray<>();
        for (int pin : PINS) {
            mAioValues.put(pin, 0);
        }
    }

    public int getAnalogValue(int pin) {
        return mAioValues.get(pin);
    }

    @Override
    public void onUpdateAnalogValue(int pin, int value) {
        mAioValues.put(pin, value);
    }

    @Override
    public void onUpdateAnalogValueAio0(int value) {
        mAioValues.put(Konashi.AIO0, value);
    }

    @Override
    public void onUpdateAnalogValueAio1(int value) {
        mAioValues.put(Konashi.AIO1, value);
    }

    @Override
    public void onUpdateAnalogValueAio2(int value) {
        mAioValues.put(Konashi.AIO2, value);
    }

    @Override
    public void onError(KonashiErrorReason errorReason, String message) {
        // do nothing...
    }
}

@@ -286,37 +286,22 @@
 lements 
-KonashiAnalogListener
+Store 
 %7B%0A    pr
@@ -652,38 +652,24 @@
 in);%0A    %7D%0A%0A
-    @Override%0A
     public v
@@ -676,131 +676,11 @@
 oid 
-onUpdateAnalogValue(int pin, int value) %7B%0A        mAioValues.put(pin, value);%0A    %7D%0A%0A    @Override%0A    public void onUpdate
+set
 Anal
@@ -690,428 +690,66 @@
 alue
-Aio0
 (int 
-value) %7B%0A        mAioValues.put(Konashi.AIO0, value);%0A    %7D%0A%0A    @Override%0A    public void onUpdateAnalogValueAio1(int value) %7B%0A        mAioValues.put(Konashi.AIO1, value);%0A    %7D%0A%0A    @Override%0A    public void onUpdateAnalogValueAio2(int value) %7B%0A        mAioValues.put(Konashi.AIO2, value);%0A    %7D%0A%0A    @Override%0A    public void onError(KonashiErrorReason errorReason, String message) %7B%0A        // do nothing...
+pin, int value) %7B%0A        mAioValues.put(pin, value);
 %0A   

Remove AnalogListener methods from AioStore and make it implement Store