Types
String
Available operations for Strings:
- substring (lower : int, upper : int) :
String
- returns the substring from index lower to index upper
- subStringBefore (beforeString: String) :
String
- returns the substring of this string occurring before the
‘beforeString’
- subStringAfter (afterString: String) :
String
- returns the substring of this string occurring after the
‘afterString’
- toLower () : String
- converts the string to lower case
- toUpper () : String
- converts the string to upper case
- firstToUpper () : String
- converts the first letter of the string to upper case
- firstToLower () : String
- converts the first letter of the string to lower case
- size () : int
- returns the size of the string
- indexOf (indexStr : String) : int
- returns the index of the first occurrence of the
‘indexStr’ or -1 if it does not exist.
- endsWith (str : String) : Boolean
- returns true if the string ends with ‘str’, else false
- startsWith (str : String) :
Boolean
- returns true if the string starts with
‘str’, else false
- trim () : String
- removes all trailing and leading white space
- normalizeSpace () : String
- Trims the
string and replaces all sequences of white space characters with a
single space.
- replace (replaceWhat : String , withWhat
: String) : String
- replaces all occurrences that matches the regular
expression ‘replaceWhat’ with the ‘withWhat’
string
- equals (str : String) : Boolean
- returns true if the string is equals to ‘str’, else false
- equalsIgnoreCase (str : String) :
Boolean
- returns true if the string is equal to the string
‘str’ ignoring casing
- isUpperCase (int index) : Boolean
- returns true if character at position ‘index’ is upper
case. If no index is given, first posision (index=0) is used.
- isLowerCase (int index) : Boolean
- returns true if character at posision ‘index’ is lower
case. If no index is given, first posision (index=0) is used.
- charAt (int index) : String
- returns the character (as a String) at posision ‘index’.
- matches (String regex) : Boolean
- Checks if the string matches the regular expression 'regexp'
- forEach ()
Integer
The Integer type represents integer values.
Available operations for integers:
- forEach ()
- Standard arithmetic operations: +, -, *, /
Real
Available operations for reals:
- Standard arithmetic operations: +, -, *, /
Boolean
List
The List type represents an ordered list. A List is untyped and can contain any kind of values or objects.
Available operations for the List type:
- add (e:Object) - add by copy
- addOrg (e:Object) - add by reference
- addAll (list:List) - adds a list of objects by copy
- addAllFirst (list:List) - adds a list of objects first into the target (by copy)
- addBefore
(item:Object, list:List/obj) - adds an object or a list of objects
before a specific object in the collection (by copy)
- addAfter (item:Object, list:List/obj) - adds an object or a list of objects after a specific object in the collection (by copy)
- remove (e:Object)
- size () : Integer
- clear () : void
- first () : Object
- last () : Object
- isEmpty () : Boolean
- get (index:Integer) - Gets the i'th object in the list
- contains (obj:Object):Boolean
- ->forEach () [iterator operation]
- ->select () - select operation
Hashtable (Dictionary)
The Hashtable type represents a dictionary of key/value pairs. It's semantics is similar to that of Java Hashtable.
Available operations for the Hashtable type
- put (key: Object, value: Object)
- get (key: Object)
- size () : Integer
- clear () : void
- keys () : List
- values () : List
- first () : Object
- last () : Object
- isEmpty () : Boolean
- forEach () [iterator operation]
Object
The Object type can represent any type. Variables of this type may reference any kind of value or object.
Available operation for object types (i.e. for any kind of object):
- oclGetType () : String
- Returns the name of the type of the object
- oclIsTypeOf (input type): Boolean
- Returns 'true' if the type in question is exactly the same as the input type, false otherwise.
- oclIsKindOf (input type): Boolean
- Returns 'true' if the type in question is the same or a subtype of the input type, false otherwise.
- clone ()
- shallowCopy ()
- A shallow copy: only copies the attribute values.
Model
Available operations for model types:
- objectsOfType (input type)
- returns all instances of a type witin a model. Example: ecoreModel.objectsOfType (ecoreModel.EClass) returns all EClass instances in the model 'ecoreModel', which is assumed to be an input model parameter to the transformation.
- store (file uri)
- Stores the model to the given file uri.
Model Collection Operations
- The same operations apply to model collections as to List.