Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1751 - in development/main/planet/components/fsm: api/src/main/net/dpml/fsm basic/src/main/net/dpml/fsm/basic

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1751 - in development/main/planet/components/fsm: api/src/main/net/dpml/fsm basic/src/main/net/dpml/fsm/basic
  • Date: Mon, 07 Feb 2005 12:01:18 +0100

Author: niclas
Date: Mon Feb 7 12:01:14 2005
New Revision: 1751

Modified:
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/State.java

development/main/planet/components/fsm/api/src/main/net/dpml/fsm/Transition.java

development/main/planet/components/fsm/api/src/main/net/dpml/fsm/TransitionRule.java

development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/CommandRuleComponent.java

development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/StateComponent.java

development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/TransitionComponent.java

development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/TransitionImpl.java
Log:
Resolved a problem around the Comparable problem when running in Metro.

Modified:
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/State.java
==============================================================================
---
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/State.java
(original)
+++
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/State.java
Mon Feb 7 12:01:14 2005
@@ -47,6 +47,9 @@
* same State. From this also follows that one need to pay attention to
defining
* the identity namespace, to avoid conflicts.
* </p>
+ *
+ * @metro.service type="net.dpml.fsm.State" version="1.0"
+ * @metro.service type="java.io.Serializable" version="1.0"
*/
public interface State extends Serializable
{

Modified:
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/Transition.java
==============================================================================
---
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/Transition.java
(original)
+++
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/Transition.java
Mon Feb 7 12:01:14 2005
@@ -46,8 +46,10 @@
* </pre></code>
*
* @metro.service type="net.dpml.fsm.Transition" version="1.0"
+ * @metro.service type="java.lang.Comparable" version="1.0"
+ * @metro.service type="java.io.Serializable" version="1.0"
*/
-public interface Transition extends Serializable
+public interface Transition extends Serializable, Comparable
{
/** Returns the TransitionRule for this Transition.
* @return the TransitionRule for this Transition.

Modified:
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/TransitionRule.java
==============================================================================
---
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/TransitionRule.java
(original)
+++
development/main/planet/components/fsm/api/src/main/net/dpml/fsm/TransitionRule.java
Mon Feb 7 12:01:14 2005
@@ -32,6 +32,8 @@
* </p>
*
* @metro.service type="net.dpml.fsm.TransitionRule" version="1.0"
+ * @metro.service type="java.lang.Comparable" version="1.0"
+ * @metro.service type="java.io.Serializable" version="1.0"
*/
public interface TransitionRule extends Comparable, Serializable
{

Modified:
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/CommandRuleComponent.java
==============================================================================
---
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/CommandRuleComponent.java
(original)
+++
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/CommandRuleComponent.java
Mon Feb 7 12:01:14 2005
@@ -31,6 +31,8 @@
*
* @metro.component name="CommandRule" lifestyle="singleton"
collection="hard"
* @metro.service type="net.dpml.fsm.TransitionRule"
+ * @metro.service type="java.lang.Comparable" version="1.0"
+ * @metro.service type="java.io.Serializable" version="1.0"
*/
public class CommandRuleComponent extends CommandRuleImpl
implements TransitionRule

Modified:
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/StateComponent.java
==============================================================================
---
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/StateComponent.java
(original)
+++
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/StateComponent.java
Mon Feb 7 12:01:14 2005
@@ -48,6 +48,7 @@
*
* @metro.component name="state" lifestyle="singleton"
* @metro.service type="net.dpml.fsm.State"
+ * @metro.service type="java.io.Serializable" version="1.0"
*/
public class StateComponent extends AbstractState
implements State

Modified:
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/TransitionComponent.java
==============================================================================
---
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/TransitionComponent.java
(original)
+++
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/TransitionComponent.java
Mon Feb 7 12:01:14 2005
@@ -41,6 +41,7 @@
/**
* @metro.component name="transition" lifestyle="singleton" collection="hard"
* @metro.service type="net.dpml.fsm.Transition"
+ * @metro.service type="java.io.Serializable" version="1.0"
*/
public class TransitionComponent
implements Transition
@@ -92,11 +93,10 @@
m_beginState = beginState;
State endState = (State) man.lookup( "end" );
m_endState = endState;
- StateMachine sm = (StateMachine) man.lookup( "fsm" );
- sm.addTransition( this );
m_rule = (TransitionRule) man.lookup( "rule" );
-
m_listeners = new ArrayList();
+ StateMachine sm = (StateMachine) man.lookup( "fsm" );
+ sm.addTransition( this );
}

/** Returns the TransitionRule for this Transition.
@@ -277,6 +277,61 @@
return true;
}

+ /**
+ * Compares this object with the specified object for order. Returns a
negative integer, zero,
+ * or a positive integer as this object is less than, equal to, or
greater than the specified
+ * object.<p>
+ * <p/>
+ * In the foregoing description, the notation
<tt>sgn(</tt><i>expression</i><tt>)</tt>
+ * designates the mathematical <i>signum</i> function, which is defined
to return one of
+ * <tt>-1</tt>, <tt>0</tt>, or <tt>1</tt> according to whether the value
of <i>expression</i> is
+ * negative, zero or positive.
+ * <p/>
+ * The implementor must ensure <tt>sgn(x.compareTo(y)) ==
-sgn(y.compareTo(x))</tt> for all
+ * <tt>x</tt> and <tt>y</tt>. (This implies that
<tt>x.compareTo(y)</tt> must throw an
+ * exception iff <tt>y.compareTo(x)</tt> throws an exception.)<p>
+ * <p/>
+ * The implementor must also ensure that the relation is transitive:
<tt>(x.compareTo(y)&gt;0
+ * &amp;&amp; y.compareTo(z)&gt;0)</tt> implies
<tt>x.compareTo(z)&gt;0</tt>.<p>
+ * <p/>
+ * Finally, the implementer must ensure that <tt>x.compareTo(y)==0</tt>
implies that
+ * <tt>sgn(x.compareTo(z)) == sgn(y.compareTo(z))</tt>, for all
<tt>z</tt>.<p>
+ * <p/>
+ * It is strongly recommended, but <i>not</i> strictly required that
<tt>(x.compareTo(y)==0) ==
+ * (x.equals(y))</tt>. Generally speaking, any class that implements
the <tt>Comparable</tt>
+ * interface and violates this condition should clearly indicate this
fact. The recommended
+ * language is "Note: this class has a natural ordering that is
inconsistent with equals."
+ *
+ * @param o the Object to be compared.
+ *
+ * @return a negative integer, zero, or a positive integer as this
object is less than, equal
+ * to, or greater than the specified object.
+ *
+ */
+ public int compareTo( Object o )
+ {
+ if( o instanceof Transition )
+ {
+ Transition other = (Transition) o;
+ TransitionRule otherRule = other.getTransitionRule();
+ int otherPriority = otherRule.getPriority();
+ int thisPriority = m_rule.getPriority();
+ if( otherPriority == thisPriority )
+ {
+ return 0;
+ }
+ if( otherPriority > thisPriority )
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ return -1;
+ }
+
/** Override for hashCode().
* @return the hash value for this instance.
*/

Modified:
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/TransitionImpl.java
==============================================================================
---
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/TransitionImpl.java
(original)
+++
development/main/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/TransitionImpl.java
Mon Feb 7 12:01:14 2005
@@ -282,6 +282,61 @@
return hash;
}

+ /**
+ * Compares this object with the specified object for order. Returns a
negative integer, zero,
+ * or a positive integer as this object is less than, equal to, or
greater than the specified
+ * object.<p>
+ * <p/>
+ * In the foregoing description, the notation
<tt>sgn(</tt><i>expression</i><tt>)</tt>
+ * designates the mathematical <i>signum</i> function, which is defined
to return one of
+ * <tt>-1</tt>, <tt>0</tt>, or <tt>1</tt> according to whether the value
of <i>expression</i> is
+ * negative, zero or positive.
+ * <p/>
+ * The implementor must ensure <tt>sgn(x.compareTo(y)) ==
-sgn(y.compareTo(x))</tt> for all
+ * <tt>x</tt> and <tt>y</tt>. (This implies that
<tt>x.compareTo(y)</tt> must throw an
+ * exception iff <tt>y.compareTo(x)</tt> throws an exception.)<p>
+ * <p/>
+ * The implementor must also ensure that the relation is transitive:
<tt>(x.compareTo(y)&gt;0
+ * &amp;&amp; y.compareTo(z)&gt;0)</tt> implies
<tt>x.compareTo(z)&gt;0</tt>.<p>
+ * <p/>
+ * Finally, the implementer must ensure that <tt>x.compareTo(y)==0</tt>
implies that
+ * <tt>sgn(x.compareTo(z)) == sgn(y.compareTo(z))</tt>, for all
<tt>z</tt>.<p>
+ * <p/>
+ * It is strongly recommended, but <i>not</i> strictly required that
<tt>(x.compareTo(y)==0) ==
+ * (x.equals(y))</tt>. Generally speaking, any class that implements
the <tt>Comparable</tt>
+ * interface and violates this condition should clearly indicate this
fact. The recommended
+ * language is "Note: this class has a natural ordering that is
inconsistent with equals."
+ *
+ * @param o the Object to be compared.
+ *
+ * @return a negative integer, zero, or a positive integer as this
object is less than, equal
+ * to, or greater than the specified object.
+ *
+ */
+ public int compareTo( Object o )
+ {
+ if( o instanceof Transition )
+ {
+ Transition other = (Transition) o;
+ TransitionRule otherRule = other.getTransitionRule();
+ int otherPriority = otherRule.getPriority();
+ int thisPriority = getTransitionRule().getPriority();
+ if( otherPriority == thisPriority )
+ {
+ return 0;
+ }
+ if( otherPriority > thisPriority )
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ return -1;
+ }
+
/** Override toString() method.
* The returned string will be <code> "Transition[" + getIdentity() +
"]"</code>.
* @return string representation of this class.



  • svn commit: r1751 - in development/main/planet/components/fsm: api/src/main/net/dpml/fsm basic/src/main/net/dpml/fsm/basic, niclas, 02/07/2005

Archive powered by MHonArc 2.6.24.

Top of Page