public class MyFunction extends AbstractFunction<Double> { public static final SDFDatatype[][] accTypes = new SDFDatatype[][] {{ SDFDatatype.DOUBLE }, { SDFDatatype.DOUBLE }}; @Override public String getSymbol() { return "myFunction"; } @Override public Double getValue() { double a = this.getInputValue(0); double b = this.getInputValue(1); return a +b; } @Override public SDFDatatype getReturnType() { return SDFDatatype.DOUBLE; } @Override public int getArity() { return 2; } @Override public SDFDatatype[] getAcceptedTypes(int argPos) { if (argPos < 0) { throw new IllegalArgumentException( "negative argument index not allowed"); } if (argPos > this.getArity()) { throw new IllegalArgumentException(this.getSymbol() + " has only " + this.getArity() + " arguments: Two double values."); } return accTypes[argPos]; } } |
To access the meta attributes of an incoming streaming object you can use the getMetaAttribute function.
To access the additional content of an incoming streaming object you can use the getAdditionalContents method to access all contents. If you only want to access a special field you can issue the getAdditionalContent(fieldName) method.