+ return 0;
+}
+
+//! Change the case of a node
+/*!
+ * \param oldCase : the case value to change
+ * \param newCase : the new value to set
+ * raise an exception if the old case does not exist or if the new case already exists
+ */
+void Switch::edChangeCase(int oldCase, int newCase)
+{
+ std::map< int , Node * >::iterator iter=_mapOfNode.find(oldCase);
+ if(iter==_mapOfNode.end())
+ {
+ //the case does not exists
+ throw Exception("Switch::edChangeCase : case does not exist");
+ }
+ iter=_mapOfNode.find(newCase);
+ if(iter != _mapOfNode.end())
+ {
+ //the new case exists
+ throw Exception("Switch::edChangeCase : new case exists");
+ }
+ Node* node=_mapOfNode[oldCase];
+ _mapOfNode.erase(oldCase);
+ _mapOfNode[newCase]=node;
+ modified();
+}
+
+int Switch::getMaxCase()
+{
+ int aCase = 0;
+ map<int, Node*>::const_iterator it = _mapOfNode.begin();
+ for(; it != _mapOfNode.end(); ++it)
+ if ((*it).first > aCase)
+ aCase = (*it).first;
+ return aCase;
+}
+
+//! Get the progress weight of the graph
+/*!
+ * Only elementary nodes have weight. If the switch node is not done, we add the weight of all his descendants,
+ * otherwise only the weight of the used case count.
+ */
+list<ProgressWeight> Switch::getProgressWeight() const
+{
+ list<ProgressWeight> ret;
+ list<Node *> setOfNode=edGetDirectDescendants();
+ if (getState() == YACS::DONE)
+ {
+ for(list<Node *>::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
+ {
+ if (getEffectiveState(*iter) == YACS::DONE)
+ ret=(*iter)->getProgressWeight();
+ }
+ }
+ else
+ {
+ for(list<Node *>::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
+ {
+ list<ProgressWeight> myCurrentSet=(*iter)->getProgressWeight();
+ ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
+ }
+ }
+ return ret;
+}
+
+bool Switch::edAddChild(Node *node)
+{
+ int aCase = getMaxCase() + 1;
+ DEBTRACE(aCase);
+ bool ret = edSetNode(aCase, node);
+ DEBTRACE(ret);
+ return ret;