lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andr...@apache.org
Subject cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/workflow/impl TransitionImpl.java
Date Wed, 28 May 2003 15:28:08 GMT
andreas     2003/05/28 08:28:08

  Modified:    src/java/org/apache/lenya/cms/workflow/impl
                        TransitionImpl.java
  Log:
  formatting changed
  added toString()
  
  Revision  Changes    Path
  1.3       +47 -21    cocoon-lenya/src/java/org/apache/lenya/cms/workflow/impl/TransitionImpl.java
  
  Index: TransitionImpl.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/workflow/impl/TransitionImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TransitionImpl.java	24 Apr 2003 13:53:00 -0000	1.2
  +++ TransitionImpl.java	28 May 2003 15:28:08 -0000	1.3
  @@ -19,64 +19,64 @@
    *
    * @author  andreas
    */
  -public class TransitionImpl
  -    implements Transition {
  -    
  +public class TransitionImpl implements Transition {
  +
       /** Creates a new instance of TransitionImpl */
       public TransitionImpl(State source, State destination) {
  -        
  +
           assert source != null;
           assert destination != null;
  -        
  +
           this.source = source;
           this.destination = destination;
       }
  -    
  +
       private List actions = new ArrayList();
  -    
  +
       public Action[] getActions() {
           return (Action[]) actions.toArray(new Action[actions.size()]);
       }
  -    
  +
       public void addAction(Action action) {
           assert action != null;
           actions.add(action);
       }
  -    
  +
       private List conditions = new ArrayList();
  -    
  +
       public Condition[] getConditions() {
  -        return (Condition[]) conditions.toArray(new Condition[conditions.size()]);
  +        return (Condition[]) conditions.toArray(
  +            new Condition[conditions.size()]);
       }
  -    
  +
       public void addCondition(Condition condition) {
           assert condition != null;
           conditions.add(condition);
       }
  -    
  +
       private Event event;
  -    
  +
       public Event getEvent() {
           return event;
       }
  -    
  +
       public void setEvent(Event event) {
           this.event = event;
           assert event != null;
       }
  -    
  +
       private State source;
  -    
  +
       public State getSource() {
           return source;
       }
  -    
  +
       private State destination;
  -    
  +
       public State getDestination() {
           return destination;
       }
  -    
  +
       /** Returns if the transition can fire in a certain situation.
        *
        */
  @@ -90,5 +90,31 @@
           }
           return canFire;
       }
  -    
  +
  +    /* (non-Javadoc)
  +     * @see java.lang.Object#toString()
  +     */
  +    public String toString() {
  +        
  +        String string = getEvent().getCommand() + " [";
  +        Condition conditions[] = getConditions();
  +        for (int i = 0; i < conditions.length; i++) {
  +            if (i > 0) string += ", ";
  +            string += conditions[i].toString();
  +        }
  +        
  +        string += "]";
  +        
  +        Action actions[] = getActions();
  +        if (actions.length > 0) {
  +            string += " / ";
  +            for (int i = 0; i < actions.length; i++) {
  +                if (i > 0) string += ", ";
  +                string += actions[i].toString();
  +            }
  +        }
  +        
  +        return string;
  +    }
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org


Mime
View raw message