@Test public void testAlgorithmChainingWithWindowing() throws InvalidIdentification { final ArrayList<ParameterValue> params = new ArrayList<>(); int subscriptionId = prm.addRequest(Arrays.asList( prm.getParameter("/REFMDB/SUBSYS1/AlgoFloatAverage"), prm.getParameter("/REFMDB/SUBSYS1/IntegerPara1_1_1")), (ParameterConsumer) (subscriptionId1, items) -> params.addAll(items)); proc.start(); tmGenerator.generate_PKT1_1(); assertEquals(1, params.size()); assertEquals(tmGenerator.pIntegerPara1_1_1, params.get(0).getEngValue().getUint32Value()); params.clear(); tmGenerator.generate_PKT1_1(); assertEquals(2, params.size()); assertEquals(tmGenerator.pIntegerPara1_1_1, params.get(0).getEngValue().getUint32Value()); assertEquals((20 + 20 + 20 + (20 / 3.0)) / 4.0, params.get(1).getEngValue().getFloatValue(), 0.001); params.clear(); prm.removeItemsFromRequest(subscriptionId, prm.getParameter("/REFMDB/SUBSYS1/AlgoFloatAverage")); tmGenerator.generate_PKT1_1(); tmGenerator.generate_PKT1_1(); assertEquals(2, params.size()); assertEquals(tmGenerator.pIntegerPara1_1_1, params.get(0).getEngValue().getUint32Value()); assertEquals(tmGenerator.pIntegerPara1_1_1, params.get(1).getEngValue().getUint32Value()); params.clear(); prm.addItemsToRequest(subscriptionId, Arrays.asList( prm.getParameter("/REFMDB/SUBSYS1/AlgoFloatAverage"), prm.getParameter("/REFMDB/SUBSYS1/AlgoFloatMultiplication"))); prm.removeItemsFromRequest(subscriptionId, prm.getParameter("/REFMDB/SUBSYS1/AlgoFloatAverage")); tmGenerator.generate_PKT1_1(); assertEquals(2, params.size()); assertEquals("/REFMDB/SUBSYS1/IntegerPara1_1_1", params.get(0).getParameter().getQualifiedName()); assertEquals("/REFMDB/SUBSYS1/AlgoFloatMultiplication", params.get(1).getParameter().getQualifiedName()); }
@Override public Parameter getParameter(NamedObjectId paraId) throws InvalidIdentification { Parameter p; if (paraId.hasNamespace()) { p = outParamIndex.get(paraId.getNamespace(), paraId.getName()); } else { p = outParamIndex.get(paraId.getName()); } if (p != null) { return p; } else { throw new InvalidIdentification(); } }
AlgorithmManager extends AbstractProcessorService implements ParameterProvider, DVParameterConsumer, ProcessorService { @Override public Parameter getParameter(NamedObjectId paraId) throws InvalidIdentification { Parameter p; if (paraId.hasNamespace()) { p = outParamIndex.get(paraId.getNamespace(), paraId.getName()); } else { p = outParamIndex.get(paraId.getName()); } if (p != null) { return p; } else { throw new InvalidIdentification(); } } }
AlgorithmManager extends AbstractProcessorService implements ParameterProvider, DVParameterConsumer, ProcessorService { @Override public Parameter getParameter(NamedObjectId paraId) throws InvalidIdentification { Parameter p; if (paraId.hasNamespace()) { p = outParamIndex.get(paraId.getNamespace(), paraId.getName()); } else { p = outParamIndex.get(paraId.getName()); } if (p != null) { return p; } else { throw new InvalidIdentification(); } }  }
AlgorithmManager extends AbstractProcessorService implements ParameterProvider, DVParameterConsumer, ProcessorService { @Override public Parameter getParameter(NamedObjectId paraId) throws InvalidIdentification { Parameter p; if (paraId.hasNamespace()) { p = outParamIndex.get(paraId.getNamespace(), paraId.getName()); } else { p = outParamIndex.get(paraId.getName()); } if (p != null) { return p; } else { throw new InvalidIdentification(); } }  @Override void init(Processor processor, YConfiguration config, Object spec); static void registerAlgorithmEngine(String name, AlgorithmEngine eng); int getSubscriptionId(); @Override void startProviding(Parameter paramDef); AlgorithmExecutionContext createContext(String name); void activateAlgorithm(Algorithm algorithm, AlgorithmExecutionContext execCtx,
            AlgorithmExecListener listener); void deactivateAlgorithm(Algorithm algorithm, AlgorithmExecutionContext execCtx); @Override void startProvidingAll(); @Override void stopProviding(Parameter paramDef); @Override boolean canProvide(Parameter p); @Override boolean canProvide(NamedObjectId itemId); @Override Parameter getParameter(NamedObjectId paraId); @Override List<ParameterValue> updateParameters(int subscriptionId, List<ParameterValue> items); List<ParameterValue> updateParameters(List<ParameterValue> items, AlgorithmExecutionContext ctx); @Override void setParameterListener(ParameterListener parameterRequestManager); Processor getProcessor(); void clearAlgorithmOverride(CustomAlgorithm calg); void setAlgorithmText(CustomAlgorithm calg, String text); }
AlgorithmManager extends AbstractProcessorService implements ParameterProvider, DVParameterConsumer, ProcessorService { @Override public Parameter getParameter(NamedObjectId paraId) throws InvalidIdentification { Parameter p; if (paraId.hasNamespace()) { p = outParamIndex.get(paraId.getNamespace(), paraId.getName()); } else { p = outParamIndex.get(paraId.getName()); } if (p != null) { return p; } else { throw new InvalidIdentification(); } }  @Override void init(Processor processor, YConfiguration config, Object spec); static void registerAlgorithmEngine(String name, AlgorithmEngine eng); int getSubscriptionId(); @Override void startProviding(Parameter paramDef); AlgorithmExecutionContext createContext(String name); void activateAlgorithm(Algorithm algorithm, AlgorithmExecutionContext execCtx,
            AlgorithmExecListener listener); void deactivateAlgorithm(Algorithm algorithm, AlgorithmExecutionContext execCtx); @Override void startProvidingAll(); @Override void stopProviding(Parameter paramDef); @Override boolean canProvide(Parameter p); @Override boolean canProvide(NamedObjectId itemId); @Override Parameter getParameter(NamedObjectId paraId); @Override List<ParameterValue> updateParameters(int subscriptionId, List<ParameterValue> items); List<ParameterValue> updateParameters(List<ParameterValue> items, AlgorithmExecutionContext ctx); @Override void setParameterListener(ParameterListener parameterRequestManager); Processor getProcessor(); void clearAlgorithmOverride(CustomAlgorithm calg); void setAlgorithmText(CustomAlgorithm calg, String text);  }