Ejemplo n.º 1
0
        private void accumulate(ArcState state, double value)
        {
            if (Double.IsNaN(value))
            {
                state.setNanSteps(state.getNanSteps() + 1);
            }
            else
            {
                ConsolFun cf = new ConsolFun(ConsolFun.ValueOf(consolFun.get()));
                switch (cf.CSType)
                {
                case ConsolFun.ConsolFunTypes.MIN:
                    state.setAccumValue(Util.min(state.getAccumValue(), value));
                    break;

                case ConsolFun.ConsolFunTypes.MAX:
                    state.setAccumValue(Util.max(state.getAccumValue(), value));
                    break;

                case ConsolFun.ConsolFunTypes.LAST:
                    state.setAccumValue(value);
                    break;

                case ConsolFun.ConsolFunTypes.AVERAGE:
                    state.setAccumValue(Util.sum(state.getAccumValue(), value));
                    break;

                case ConsolFun.ConsolFunTypes.TOTAL:
                    state.setAccumValue(Util.sum(state.getAccumValue(), value));
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void finalizeStep(ArcState state, Robin robin)
        {
            // should store
            long   arcSteps = steps.get();
            double arcXff   = xff.get();
            long   nanSteps = state.getNanSteps();
            //double nanPct = (double) nanSteps / (double) arcSteps;
            double accumValue = state.getAccumValue();

            if (nanSteps <= arcXff * arcSteps && !Double.IsNaN(accumValue))
            {
                if (getConsolFun().CSType == ConsolFun.ConsolFunTypes.AVERAGE)
                {
                    accumValue /= (arcSteps - nanSteps);
                }
                robin.store(accumValue);
            }
            else
            {
                robin.store(Double.NaN);
            }
            state.setAccumValue(Double.NaN);
            state.setNanSteps(0);
        }
Ejemplo n.º 3
0
 private void finalizeStep(ArcState state, Robin robin)
 {
    // should store
    long arcSteps = steps.get();
    double arcXff = xff.get();
    long nanSteps = state.getNanSteps();
    //double nanPct = (double) nanSteps / (double) arcSteps;
    double accumValue = state.getAccumValue();
    if (nanSteps <= arcXff * arcSteps && !Double.IsNaN(accumValue))
    {
       if (getConsolFun().CSType == ConsolFun.ConsolFunTypes.AVERAGE)
       {
          accumValue /= (arcSteps - nanSteps);
       }
       robin.store(accumValue);
    }
    else
    {
       robin.store(Double.NaN);
    }
    state.setAccumValue(Double.NaN);
    state.setNanSteps(0);
 }
Ejemplo n.º 4
0
 private void accumulate(ArcState state, double value)
 {
    if (Double.IsNaN(value))
    {
       state.setNanSteps(state.getNanSteps() + 1);
    }
    else
    {
       ConsolFun cf = new ConsolFun(ConsolFun.ValueOf(consolFun.get()));
       switch (cf.CSType)
       {
          case ConsolFun.ConsolFunTypes.MIN:
             state.setAccumValue(Util.min(state.getAccumValue(), value));
             break;
          case ConsolFun.ConsolFunTypes.MAX:
             state.setAccumValue(Util.max(state.getAccumValue(), value));
             break;
          case ConsolFun.ConsolFunTypes.LAST:
             state.setAccumValue(value);
             break;
          case ConsolFun.ConsolFunTypes.AVERAGE:
             state.setAccumValue(Util.sum(state.getAccumValue(), value));
             break;
          case ConsolFun.ConsolFunTypes.TOTAL:
             state.setAccumValue(Util.sum(state.getAccumValue(), value));
             break;
       }
    }
 }