Ejemplo n.º 1
0
 /**
  * @param attribute The attribute that changed.
  * @exception IllegalActionException
  */
 public void attributeChanged(Attribute attribute) throws IllegalActionException {
   getLogger().trace("{} attributeChanged() - entry : {}", getFullName(), attribute);
   if (attribute == startValueParam) {
     LongToken valueToken = (LongToken) startValueParam.getToken();
     if (valueToken != null) {
       setStartValue(valueToken.longValue());
       getLogger().debug("{} Counter start value changed to {}", getFullName(), getStartValue());
     }
   } else {
     super.attributeChanged(attribute);
   }
   getLogger().trace("{} attributeChanged() - exit", getFullName());
 }
Ejemplo n.º 2
0
 protected void doInitialize() throws InitializationException {
   super.doInitialize();
   // If something connected to the reset port, install a handler
   if (reset.getWidth() > 0) {
     resetHandler =
         createPortHandler(
             reset,
             new PortListenerAdapter() {
               public void tokenReceived() {
                 Token token = resetHandler.getToken();
                 if (token != null && !token.isNil()) {
                   getLogger().debug("{} Reset Event received", getFullName());
                   isReset = true;
                 }
               }
             });
     resetHandler.start();
   }
   setValue(getStartValue());
 }