
package com.uwetrottmann.shopr.algorithm.model;

public abstract class GenericAttribute<T> {

    private T currentValue;

    double[] mValueWeights;

    public double[] getValueWeights() {
        return mValueWeights;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        T[] values = getValueSymbols();

        builder.append("[");
        for (int i = 0; i < mValueWeights.length; i++) {
            if (mValueWeights[i] != 0) {
                builder.append(values[i]).append(":").append(mValueWeights[i]).append(" ");
            }
        }
        builder.append("]");

        return builder.toString();
    }

    public abstract T[] getValueSymbols();

    public T currentValue() {
        return currentValue;
    }

    public GenericAttribute<T> currentValue(T currentValue) {
        this.currentValue = currentValue;
        return this;
    }

}

@@ -485,20 +485,20 @@
 %5Bi%5D 
-!= 0
+== 1
 ) %7B%0A    
     
@@ -485,32 +485,113 @@
 %5Bi%5D == 1) %7B%0A    
+            return %22%5B%22 + values%5Bi%5D + %22:%22 + mValueWeights%5Bi%5D + %22%5D%22;%0A            %7D%0A
             buil
@@ -662,30 +662,16 @@
 d(%22 %22);%0A
-            %7D%0A
         

Print zero weights if there is no 1.0 weight.