package janet.services.tasks; import janet.services.*; /** A compositional Task, whose inputs & output are Integer. */ public final class AddInteger extends Compose { /** This method's returned value is the Integer whose intValue is the sum * of the intValues of its Integer inputs. * @return the Integer whose intValue is the sum of the intValues of its Integer inputs. * @param environment Not used by this Task. */ public Object execute ( Environment environment ) { int sum = 0; for ( int i = 0; i < numInputs(); i++ ) { sum += ((Integer) getInput( i )).intValue(); } return new Integer( sum ); } }