Author: rahul
Date: Tue Jan 8 11:56:54 2008
New Revision: 610118
URL: http://svn.apache.org/viewvc?rev=610118&view=rev
Log:
Type safety improvements, remove unnecessary casts.
Modified:
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/Parallel.java
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/State.java
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java
Modified:
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/Parallel.java
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/Parallel.java?rev=610118&r1=610117&r2=610118&view=diff
==============================================================================
---
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/Parallel.java
(original)
+++
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/Parallel.java
Tue Jan 8 11:56:54 2008
@@ -38,13 +38,13 @@
/**
* The set of parallel state machines contained in this <parallel>.
*/
- private Set children;
+ private Set<TransitionTarget> children;
/**
* Constructor.
*/
public Parallel() {
- this.children = new LinkedHashSet();
+ this.children = new LinkedHashSet<TransitionTarget>();
}
/**
@@ -54,7 +54,7 @@
*
* @deprecated Use getChildren() instead.
*/
- public final Set getStates() {
+ public final Set<TransitionTarget> getStates() {
return children;
}
@@ -80,7 +80,7 @@
*
* @since 0.7
*/
- public final Set getChildren() {
+ public final Set<TransitionTarget> getChildren() {
return children;
}
Modified:
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/State.java
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/State.java?rev=610118&r1=610117&r2=610118&view=diff
==============================================================================
---
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/State.java
(original)
+++
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/State.java
Tue Jan 8 11:56:54 2008
@@ -38,7 +38,7 @@
* The Map containing immediate children of this State, keyed by
* their IDs. Incompatible with the parallel or invoke property.
*/
- private Map children;
+ private Map<String, TransitionTarget> children;
/**
* The Parallel child, which defines a set of parallel substates.
@@ -72,7 +72,7 @@
/**
* A list of outgoing Transitions from this state, by document order.
*/
- private List transitions;
+ private List<Transition> transitions;
/**
* Applies to composite states only. If one of its final children is
@@ -87,8 +87,8 @@
* Constructor.
*/
public State() {
- this.children = new LinkedHashMap();
- this.transitions = new ArrayList();
+ this.children = new LinkedHashMap<String, TransitionTarget>();
+ this.transitions = new ArrayList<Transition>();
}
/**
@@ -206,16 +206,16 @@
* @deprecated Use [EMAIL PROTECTED] #getTransitionsList()} instead
*/
public final Map getTransitions() {
- Map transitionsMap = new HashMap();
+ Map<String, List<Transition>> transitionsMap = new HashMap<String,
List<Transition>>();
for (int i = 0; i < transitions.size(); i++) {
- Transition transition = (Transition) transitions.get(i);
+ Transition transition = transitions.get(i);
String event = transition.getEvent();
if (!transitionsMap.containsKey(event)) {
- List eventTransitions = new ArrayList();
+ List<Transition> eventTransitions = new
ArrayList<Transition>();
eventTransitions.add(transition);
transitionsMap.put(event, eventTransitions);
} else {
- ((List) transitionsMap.get(event)).add(transition);
+ transitionsMap.get(event).add(transition);
}
}
return transitionsMap;
@@ -229,13 +229,13 @@
* @return List Returns the candidate transitions for given event
*/
public final List getTransitionsList(final String event) {
- List matchingTransitions = null; // since we returned null upto v0.6
+ List<Transition> matchingTransitions = null; // since we returned null
upto v0.6
for (int i = 0; i < transitions.size(); i++) {
- Transition t = (Transition) transitions.get(i);
+ Transition t = transitions.get(i);
if ((event == null && t.getEvent() == null)
|| (event != null && event.equals(t.getEvent()))) {
if (matchingTransitions == null) {
- matchingTransitions = new ArrayList();
+ matchingTransitions = new ArrayList<Transition>();
}
matchingTransitions.add(t);
}
Modified:
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java
URL:
http://svn.apache.org/viewvc/commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java?rev=610118&r1=610117&r2=610118&view=diff
==============================================================================
---
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java
(original)
+++
commons/proper/scxml/branches/J5/src/main/java/org/apache/commons/scxml/model/TransitionTarget.java
Tue Jan 8 11:56:54 2008
@@ -60,7 +60,7 @@
* List of history states owned by a given state (applies to non-leaf
* states).
*/
- private List history;
+ private List<History> history;
/**
* Constructor.
@@ -72,7 +72,7 @@
onExit = new OnExit(); //empty defaults
onExit.setParent(this);
parent = null;
- history = new ArrayList();
+ history = new ArrayList<History>();
}
/**