package org.mwg.ml.algorithm.regression.actions;

/**
 * Created by assaad on 07/12/2016.
 */
public class SetPrecision {
}

@@ -47,78 +47,1510 @@
 s;%0A%0A
-/**%0A * Created by assaad on 07/12/2016.%0A */%0Apublic class SetPrecision %7B
+import org.mwg.Callback;%0Aimport org.mwg.Type;%0Aimport org.mwg.ml.algorithm.regression.PolynomialNode;%0Aimport org.mwg.task.Action;%0Aimport org.mwg.task.Task;%0Aimport org.mwg.task.TaskContext;%0Aimport org.mwg.task.TaskResult;%0A%0Aimport static org.mwg.core.task.Actions.*;%0Aimport static org.mwg.core.task.Actions.readVar;%0A%0A/**%0A * Created by assaad on 07/12/2016.%0A */%0Apublic class SetPrecision implements Action %7B%0A%0A    public final static String NAME = %22setPrecision%22;%0A    private final Task polyTask;%0A%0A    private final String _relName;%0A    private final String _value;%0A%0A    public SetPrecision(final String relName, final String c_value) %7B%0A        if (relName == null %7C%7C c_value == null) %7B%0A            throw new RuntimeException(%22name or value should not be null%22);%0A        %7D%0A        this._relName = relName;%0A        this._value = c_value;%0A%0A        polyTask = newTask()%0A                .then(defineAsVar(%22origin%22))%0A                .then(traverse(_relName))%0A                .then(setAttribute(PolynomialNode.PRECISION, Type.DOUBLE, _value))%0A                .then(readVar(%22origin%22));%0A    %7D%0A%0A    @Override%0A    public void eval(final TaskContext context) %7B%0A        polyTask.executeWith(context.graph(), context.result(), new Callback%3CTaskResult%3E() %7B%0A            @Override%0A            public void on(TaskResult result) %7B%0A                context.continueWith(result);%0A            %7D%0A        %7D);%0A%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return NAME + %22(%5C'%22 + _relName + %22: %22 + _value + %22%5C')%22;%0A    %7D%0A
 %0A%7D%0A

set precision action