use of com.ibm.streamsx.topology.internal.logic.Constants in project streamsx.topology by IBMStreams.
the class Topology method _source.
private <T> TStream<T> _source(Supplier<Iterable<T>> data, Type tupleType) {
String opName = LogicUtils.functionName(data);
if (opName.isEmpty()) {
opName = getTupleName(tupleType) + "Source";
} else if (data instanceof Constants) {
opName = getTupleName(tupleType) + opName;
}
BOperatorInvocation bop = JavaFunctional.addFunctionalOperator(this, opName, FunctionSource.class, data);
SourceInfo.setSourceInfo(bop, getClass());
return JavaFunctional.addJavaOutput(this, bop, tupleType);
}
use of com.ibm.streamsx.topology.internal.logic.Constants in project streamsx.topology by IBMStreams.
the class Topology method _periodicMultiSource.
private <T> TStream<T> _periodicMultiSource(Supplier<Iterable<T>> data, long period, TimeUnit unit, Type tupleType) {
String opName = LogicUtils.functionName(data);
if (opName.isEmpty()) {
opName = TypeDiscoverer.getTupleName(tupleType) + "PeriodicMultiSource";
} else if (data instanceof Constants) {
opName = TypeDiscoverer.getTupleName(tupleType) + opName;
}
double dperiod = ((double) unit.toMillis(period)) / 1000.0;
Map<String, Object> params = new HashMap<>();
params.put("period", dperiod);
BOperatorInvocation bop = JavaFunctional.addFunctionalOperator(this, opName, FunctionPeriodicSource.class, data, params);
SourceInfo.setSourceInfo(bop, getClass());
return JavaFunctional.addJavaOutput(this, bop, tupleType);
}
Aggregations