XES - Programmers Guide - nodeCase

for information about XES schema see these pages.

Switch

Call different blocks depending on value of variable.

	<xs:complexType name="switchType">
<xs:sequence>
<xs:element name="variable" type="variableType"/>
<xs:element name="case" type="caseType"/>
<xs:element name="default" type="caseType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="caseType">
<xs:sequence>
<xs:element name="constant" type="constantType"/>
<xs:element name="block" type="blockType"/>
</xs:sequence>
</xs:complexType>

Java

switch (number) {
  case 1: s="one";break;
  case 2: s="two";break; 
  default: s="more";break; 
}

Scala

object dictionary {
val data = Array(null, "A","B","C")

def apply(x:String) = x match {
case "one" => data(1)
case "two" => data(2)
case "three" => data(3)
}

def update(x:String,y:String) = x match {
case "one" => data(1) = y // ...this gets turned to data.update(1,y)
case "two" => data(2) = y
case "three" => data(3) = y
}

def main(args:Array[String]) { // ...shorthand for this.apply("one")
Console.println(this("one")+","+this("two")+","+this("three"))
this("one") = "X" // ...and this becomes this.update("one","X")
this("two") = "Y"
this("three") = "Z"
Console.println(this("one")+","+this("two")+","+this("three"))
}
}


metadata block
see also:

 

Correspondence about this page

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.