BasicClasses.poosl

Data classes:


Data classes


Boolean (extends Object)

This primitive, permanent, native class extends Object. It represents the class of Booleans. This class has two instances represented with the constants true and false.

Variables:

Methods:

!(): Boolean

Using prefix notation, operator ! returns the logical inverse of the receiver. It is equivalent to b not, where b acts as the receiver.

&(b: Boolean): Boolean

Returns the logical and of the receiver and b. It has a special syntax of the form b1 & b2, where b1 acts as the receiver and b2 as the argument.

|(b: Boolean): Boolean

Returns the logical or of the receiver and b. It has a special syntax of the form b1 | b2, where b1 acts as the receiver and b2 as the argument.

not(): Boolean

Returns the logical inverse of the receiver. In addition to the normal syntax, it also has a special syntax of the form ! b, where b acts as the receiver.

xor(b: Boolean): Boolean

Returns the logical xor of the receiver and b. It is equivalent to (receiver!= B).

asJSON(): String

Returns the receiver as a valid JSON (single line) string.


Char (extends Object)

This primitive, permanent, native class extends Object. It represents the class of individual Extended ASCII characters and therefore has 256 instances representing each of the extended ASCII characters.

Variables:

Methods:

asciiIndex(): Integer

Returns the ASCII index number of the receiver.

asString(): String

Returns a new String consisting of the single receiver character.

asJSON(): String

Returns the receiver as a valid JSON (single line) string.


Console (extends Object)

This native class extends Object. It provides a means to write information to the console.

Variables:

Methods:

write(s: String): Console

Writes the String s as standard output to the console (not its syntactic representation). It returns the receiver.

writeLine(s: String): Console

Writes the String s as standard output to the console (its characters, not its syntactic representation) followed by new line character LF(10). It returns the receiver.

writeError(s: String): Console

Writes the String s as standard error to the console (not its syntactic representation). It returns the receiver.

writeLineError(s: String): Console

Writes the String s as standard error to the console (its characters, not its syntactic representation) followed by new line character LF(10). It returns the receiver.


FileIn (extends Object)

This native class extends Object. It provides a means to read information from files. Creating a new FileIn yields an object without referring to any concrete file.

Variables:

Methods:

source(s: String): FileIn

Specifies the file to read information from. s is a file name (possibly with an absolute or relative path reference - where the syntactic symbols / and \ for path references can be used interchangeably independent of OS). It returns the receiver.

open(): FileIn

Locks the referred file for read access. It assumes that method source has previously been called to identify the concrete file to refer to. Otherwise, an error is generated. It returns the receiver.

atEndOfFile(): Boolean

Returns true in case the read pointer in the file points at the end of the file and false otherwise.

close(): FileIn

This method and releases the referred file for further access. It returns the receiver.

read(i: Integer): String

This method reads the next first i characters from the referred file and returns that as a String if i is non-negative. If fewer than i characters are available, a String is returned consisting of the number of available characters (until the end of the file). The read pointer in the file has been advanced till after the last read character. In case i is negative an error is produced.

readUntil(c: Char): String

This method returns nil if the read pointer is at the end of the file. Otherwise, it returns the sequence of characters (as a String) until the next occurrence of character c in the file, or until the end of the file, whichever comes first. The read pointer has been advanced till after the character c if c was found or is at the end of the file if the end of the file has been encountered. The character c is not part of the returned String.

readWord(): String

This method returns nil if no non-white space characters exist until the end of the file. Otherwise, it returns the next consecutive sequence of non-white space characters (as a String) until the first white space character after this sequence, or until the end of the file, whichever comes first. The read pointer has been advanced till the first white space character after the sequence in the former case or is at the end of the file in the latter. None of the white space characters are part of the returned String.

readLine(): String

This method returns nil if the read pointer is at the end of the file. Otherwise, it returns the next (possibly empty) sequence of non-newline characters (as a String) until the first new line character sequence , or until the end of the file, whichever comes first. The read pointer has been advanced till after the longest newline character sequence after the sequence of non-newline characters (if the line ends in CR(13) followed by LF(10) it advances till after the LF(10)). None of the newline characters are part of the returned String.

readString(): String

This method advances until the next occurrence of a double quote character ". In case the character sequence starting from the double quote character is a valid syntactical representation of a String, then this String is returned and the read pointer in the file has advanced till after the end of the String representation. If it is not a valid syntactical representation of a String, an error is generated. If no double quote character is encountered, nil is returned.


FileOut (extends Object)

This native class extends Object. It provides a means to write information to files. Creating a new FileOut yields an object without referring to any concrete file.

Variables:

Methods:

destination(s: String): FileOut

Specifies the file to be referred to for writing information to. s is a file name (possibly with an absolute or relative path reference - where the syntactic symbols / and \ for path references can be used interchangeably independent of OS). In case a file with destination indicated by s already exists, that particular file is emptied. It returns the receiver.

open(): FileOut

(Re-)opens the referred file for write access. Performing such write accesses will result in first clearing all existing information in the file (if any). It assumes that method destination has previously been called to identify the concrete file to refer to. Otherwise, an error is generated. It returns the receiver.

append(): FileOut

(Re-)opens the referred file for write access. Performing such write accesses will result in appending the written information without overwriting the existing information in the file (if any). It assumes that method destination has previously been called to identify the concrete file to refer to. Otherwise, an error is generated. It returns the receiver.

flush(): FileOut

This method flushes all write buffers to file. It returns the receiver.

close(): FileOut

This method flushes all write buffers and releases the referred file for further access. It returns the receiver.

write(s: String): FileOut

Writes the String s to the referred file (not its syntactic representation). It returns the receiver.

writeLine(s: String): FileOut

Writes the String s to the file (its characters, not its syntactic representation) followed by new line character LF(10). It returns the receiver.

writeString(s: String): FileOut

Writes a syntactic representation of String s to the file. It returns the receiver.


Float (extends Object)

This primitive, permanent, native class extends Object. Its instances represents floating-point numbers using IEEE 754-2008 double-precision floating point representations. Note that the arithmetic operators operate as specified by this standard. Instances of the Float class can be distinguished from the Real class by the 'f' (or 'F') postfix, or the literals nan and inf.

Variables:

Methods:

-(): Float

Returns the negation of the receiver. It has a special syntax of the form -r, where r acts as the receiver.

+(r: Float): Float

Returns the sum of the receiver with r. It has a special syntax of the form r1 + r2, where r1 acts as the receiver and r2 as the argument.

/(r: Float): Float

Returns the quotient of the receiver with r. It has a special syntax of the form r1 / r2, where r1 acts as the receiver and r2 as the argument.

*(r: Float): Float

Returns the product of the receiver and r. It has a special syntax of the form r1 * r2, where r1 acts as the receiver and r2 as the argument.

>=(r: Float): Boolean

Returns true in case the receiver is greater than or equal to r and false otherwise. It has a special syntax of the form r1 >= r2, where r1 acts as the receiver and r2 as the argument.

>(r: Float): Boolean

Returns true in case the receiver is greater than r and false otherwise. It has a special syntax of the form r1 > r2, where r1 acts as the receiver and r2 as the argument.

<=(r: Float): Boolean

Returns true in case the receiver is smaller than or equal to r and false otherwise. It has a special syntax of the form r1 <= r2, where r1 acts as the receiver and r2 as the argument.

<(r: Float): Boolean

Returns true in case the receiver is smaller than r and false otherwise. It has a special syntax of the form r1 < r2, where r1 acts as the receiver and r2 as the argument.

-(r: Float): Float

Subtracts r from the receiver and returns the result. It has a special syntax of the form r1 - r2, where r1 acts as the receiver and r2 as the argument.

abs(): Float

Returns the absolute value of the receiver.

acosh(): Float

Returns the inverse hyperbolic sine of the receiver if the receiver is a positive value. Otherwise, an error is generated.

asinh(): Float

Returns the inverse hyperbolic cosine of the receiver.

atanh(): Float

Returns the inverse hyperbolic tangent of the receiver for values smaller or equal to (-)1. Otherwise, an error is generated.

cosh(): Float

Returns the hyperbolic cosine of the receiver.

sinh(): Float

Returns the hyperbolic sine of the receiver.

tanh(): Float

Returns the hyperbolic tangent of the receiver.

acos(): Float

Returns the arc cosine of the receiver.

asin(): Float

Returns the arc sine of the receiver.

atan(): Float

Returns the arc tangent of the receiver.

atan2(p: Float): Float

Returns the principal value of the arc tangent of the receiver / argument(p), using the signs of the receiver and argument (p) to determine the quadrant of the result.

ceil(): Float

Returns the smallest integral value that is not less then the receiver.

cos(): Float

Returns the cosine value of the receiver.

exp(): Float

Returns the value of e to the power of the receiver.

floor(): Float

Returns the largest integral value that is not greater than the receiver.

log(): Float

Returns the natural logarithm of the receiver.

log10(): Float

Returns the base 10 logarithm of the receiver.

pow(p: Float): Float

Returns the receiver raised to the power of p.

round(): Float

Returns the nearest integer value of the receiver, but round halfway cases away from 0.

sin(): Float

Returns the sine value of the receiver.

sqr(): Float

Returns the square of the receiver.

sqrt(): Float

Returns the square root of the receiver if the receiver is non-negative. Otherwise an error is generated.

tan(): Float

Returns the tangent of the receiver.

min(p: Float): Float

Returns the smallest value of the receiver and p.

max(p: Float): Float

Returns the biggest value of the receiver and p.

monus(p: Float): Float

Returns the difference of the receiver with p if the receiver > p or 0 otherwise.

printString(): String

Returns the textual representation of the value of the receiver.

asInteger(): Integer

Returns an Integer representation of the receiver denoting the integer number closest to the receiver. Rounding is as follows: for positive numbers: x rounds to ceil(x+1/2) for negative numbers x rounds to floor(x-1/2). It will throw an exception when the value of the receiver cannot be represented as an Integer.

asFloat(): Float

Returns the receiver.

asReal(): Real

Returns the receiver as a Real if it is a valid Real number. Otherwise an error is generated.

nearbyint(): Float

Returns the nearest integer value. This function returns a Float.

nextafter(p: Float): Float

Returns the next representable floating-point value following the receiver in the direction of p.

remainder(p: Float): Float

Returns the remainder of dividing x by y. The return value is x-n*y, where n is the value x / y, rounded to the nearest integer. If the absolute value of x-n*y is 0.5, n is chosen to be even.

cbrt(): Float

Returns the cube root of the receiver.

erf(): Float

Returns the error function of the receiver (x), defined as: erf(x) = 2/sqrt(pi)* integral from 0 to x of exp(-t*t) dt.

erfc(): Float

Returns 1.0f - r erf().

exp2(): Float

Returns base-2 exponential function

expm1(): Float

Returns exp(x) - 1.

rint(): Float

Same as round, but will raise exception when inexact.

trunc(): Float

Returns the rounded integer value not larger in absolute value.

copysign(p: Float): Float

Returns a value whose magnitude is taken from x and whose sign is taken from y.

fma(y: Float, z: Float): Float

Returns the result of r* y + z. The result is rounded as one ternary operation.

fdim(x: Float): Float

Returns the positive difference between the receiver and x.

fmod(x: Float): Float

Returns the value r - n*y, for some integer n, such that the returned value has the same sign as the receiver and a magnitude less than the magnitude of y.

hypot(y: Float): Float

Returns sqrt(r*r+y*y).

tgamma(): Float

Returns the Gamma function of the receiver. The gamma function is defined as: Gamma(x) = integral from 0 to infinity of t^(x-1) e^-t dt.

lgamma(): Float

Returns the natural logarithm of the absolute value of the Gamma function on the receiver.

log1p(): Float

Returns the logarithm of 1 plus the receiver.

log2(): Float

Returns the base-2 logarithmic of the receiver.

logb(): Float

Returns the exponent of the internal float representation of the receiver.

ilogb(): Integer

Returns the integer exponent of the internal floating-point representation of the receiver.

isnan(): Boolean

Returns true if the receiver is ''Not a Number''.

isinf(): Boolean

Returns true if the receiver is a positive or negative infinity.

asJSON(): String

Returns the receiver as a valid JSON (single line) string.


Integer (extends Object)

This primitive, permanent, native class extends Object. It represents the class of (unbounded) integer numbers.

Variables:

Methods:

-(): Integer

Returns the negation of the receiver. It has a special syntax of the form -i, where i acts as the receiver.

-(i: Integer): Integer

Subtracts i from the receiver and returns the result. It has a special syntax of the form i1 - i2, where i1 acts as the receiver and i2 as the argument.

*(i: Integer): Integer

Returns the product of the receiver and i. It has a special syntax of the form i1 * i2, where i1 acts as the receiver and i2 as the argument.

/(i: Integer): Integer

This method is identical to the method div. Returns the Integer A such that A*i + B equals the receiver for some B and 0 <= B < i if i > 0 and i < B <= 0 if i < 0.

&(i: Integer): Integer

Returns an Integer representing the bit-wise and of the two's-complement of the receiver with i. It has a special syntax of the form i1 & i2, where i1 acts as the receiver and i2 as the argument.

+(i: Integer): Integer

Returns the sum of the receiver with i. It has a special syntax of the form i1 + i2, where i1 acts as the receiver and i2 as the argument.

<(i: Integer): Boolean

Returns true in case the receiver is smaller than i and false otherwise. It has a special syntax of the form i1 < i2, where i1 acts as the receiver and i2 as the argument.

<=(i: Integer): Boolean

Returns true in case the receiver is smaller than or equal to i and false otherwise. It has a special syntax of the form i1 <= i2, where i1 acts as the receiver and i2 as the argument.

>(i: Integer): Boolean

Returns true in case the receiver is greater than i and false otherwise. It has a special syntax of the form i1 > i2, where i1 acts as the receiver and i2 as the argument.

>=(i: Integer): Boolean

Returns true in case the receiver is greater than or equal to i and false otherwise. It has a special syntax of the form i1 >= i2, where i1 acts as the receiver and i2 as the argument.

|(i: Integer): Integer

Returns an Integer representing the bit-wise or of the two's-complement of the receiver with i. It has a special syntax of the form i1 | i2, where i1 acts as the receiver and i2 as the argument.

abs(): Integer

Returns the absolute value of the receiver.

asAsciiChar(): Char

Returns the character by using the receiver as its ASCII index number in case the receiver ranges between 0 and 255. Otherwise, an index out-of-bound error is generated.

asFloat(): Float

Returns a Float object with the same value as the receiver.

asInteger(): Integer

Returns the receiver. (Only for compatibility with Real::asInteger.)

asReal(): Real

Returns a Real object with the same value as the receiver.

div(i: Integer): Integer

Returns the Integer A such that A*i + B equals the receiver for some B and 0 <= B < i if i > 0 and i < B <= 0 if i < 0.

fac(): Integer

Returns the factorial of the receiver in case the receiver is non-negative. Otherwise, an error is generated. (Notice that 0! = 1).

modulo(i: Integer): Integer

Returns the Integer B such that A * i + B equals the receiver for some Integer A and 0 <= B < i if i > 0 and i < B <= 0 if i < 0.

monus(i: Integer): Integer

Returns the difference of the receiver with i if the receiver > i or 0 otherwise.

power(i: Integer): Integer

Returns the receiver raised to the power of i in case i is non-negative. Otherwise, an error is generated.

sqr(): Integer

Returns the square of the receiver.

max(i: Integer): Integer

Returns the maximum of the receiver and i.

not(): Integer

Returns the bit-wise negation of the receiver. It is equivalent to: -receiver - 1.

min(i: Integer): Integer

Returns the minimum of the receiver and i.

xor(i: Integer): Integer

Returns the bit-wise xor of the receiver and i.

asJSON(): String

Returns the receiver as a valid JSON (single line) string.


Nil (extends Object)

This primitive, permanent, native class extends Object. It represents the class of instance nil.

Variables:

Methods:

asJSON(): String

Returns the receiver as a valid JSON (single line) string.


Object

This permanent, native class represents the root superclass of any other data class. It therefore provides generic methods that are applicable to all data objects.

Variables:

Methods:

!=(o: Object): Boolean

Returns true in case o is not equal to the receiver and false otherwise. The result is equivalent to (receiver = o) not. It has a special syntax of the form o1 != o2, where o1 acts as the receiver and o2 as the argument

!==(o: Object): Boolean

Returns true in case o is not identical to the receiver and false otherwise. The result is equivalent to: (receiver == o) not. It has a special syntax of the form o1 !== o2, where o1 acts as the receiver and o2 as the argument.

=(o: Object): Boolean

Implements the equality relation. For primitive objects (except for Float value nan), = is equivalent to ==. For user-defined classes, it returns true if o is an object of the same class as the receiver and all instance variables of o and the receiver are (recursively) equal as well. Otherwise, it returns false. For non-primitive native classes, the behavior is as defined for the user-defined classes, unless specified differently at the description of the class. It has a special syntax of the form o1 = o2, where o1 acts as the receiver and o2 as the argument.

==(o: Object): Boolean

Implements the identity relation. Returns true in case o refers to the same object as the receiver. Otherwise, it returns false. It has a special syntax of the form o1 == o2, where o1 acts as the receiver and o2 as the argument.

deepCopy(): Object

For user-defined classes not extending non-permanent native classes, it returns a clone of the receiver as a new object. This means that a new instance of the receiver's class is returned, where each instance variable is assigned to clones in a recursive manner, such that all (indirect) references to the same original object result in references to a single cloned object. The original and cloned data object structures are isomorphic. For primitive classes, the receiver itself is returned. The non-permanent native classes (and any user-defined subclasses) do not support copying and therefore, an error is generated. For non-primitive permanent classes, the behavior is as defined for the user-defined classes, unless specified differently at the description of the class.

error(s: String): Object

This method allows to signal erroneous behavior. Semantically it does nothing, but tools tend to halt execution of a model after this method and show message s to the user.

assert(b: Boolean, s: String): Object

This method allows to signal erroneous behavior for a condition b. Semantically it does nothing, but tools tend to halt execution of a model after this method when expression b evaluates to false and show message s to the user.

marshal(): String

Returns a standardized String representation of the receiver. The inverse functionality is implemented as method unmarshal in class String. It can for example be used to communicate arbitrary objects between different POOSL models via files or sockets in a standardized way.

printString(): String

Returns a String representation of the receiver. It is the typical means used by tools to retrieve a representation of an object to users of those tools. The standard behavior in class Object returns just the class name. This is overridden in subclasses to display more specific information on the object. If the receiver is an instance of a primitive class or class String, the syntactic constant representation of the receiver is returned.

shallowCopy(): Object

For user-defined classes not extending non-permanent native classes, it returns a shallow copy of the receiver. This means that a new object of the receiver's class is created, for which the instance variables refer to the same objects as the corresponding instance variables of the receiver. For primitive classes, the receiver itself is returned. For non-permanent native classes (and any user-defined subclasses), an error is generated. For non-primitive permanent classes, the behavior is as defined for the user-defined classes, unless specified differently at the description of the class.

isOfType(s: String): Boolean

If s does not refer to the name of an existing data class, an error is generated. In case s does refer to the name of an existing data class, true is returned in case the receiver is of the type associated with the data class with name s and false otherwise.


Observer (extends Object)

This native class extends Object. It can be used to monitor the simulated system and it provides a means for POOSL tools to terminate an execution or interact with other tools based on observation results. Creating a new Observer yields an unregistered observer object. While unregistered it has no effect on execution of a model. Registering an Observer makes it relevant in the condition to terminate the execution. In case method complete has been called for all Observer instances in a POOSL model since their registration (and there is at least one registered Observer), the execution terminates. Execution also terminates when method halt is called for any registered Observer.

Variables:

Methods:

identifyWith(s: String): Observer

Sets the Observer's human-readable identity to s.

identity(): String

Returns the Observer's identity.

result(): String

This method returns a String representation of the results for the monitored property. Tools typically use it to communicate observer state to external tools. By default, the result of method printString is returned. Method result can be overridden in subclasses to return specific information on the monitored properties.

register(): Observer

Marks the Observer to be relevant for terminating the simulation. If the Observer executed the complete method before, it is only considered activated until it executes the complete method again.

deregister(): Observer

Marks the Observer to be irrelevant for terminating the simulation.

complete(): Observer

Marks the Observer as activated to terminate the simulation. The simulation actually terminates at the moment that all observers were activated by calling method complete since their registration.

halt(): Observer

The simulation terminates immediately when any registered Observer executes this method.

isLast(): Boolean

Returns true when the receiver is the last Observer not yet activated.


RandomGenerator (extends Object)

This native class extends Object. It represents a generator of pseudo-random values with a uniform distribution U[0,1).

Variables:

Methods:

random(): Real

Returns a Real sample from distribution U[0, 1).

randomInt(i: Integer): Integer

Returns an Integer sample from discrete uniform distribution [0, i-1] for i > 0. In case i <= 0, an error is generated.

randomiseSeed(): RandomGenerator

This method arbitrarily modifies the seed for the sequence of pseudo-random numbers successively produced by calling methods random and randomInt. The exact behavior is implementation dependent, typically setting the seed to a time-dependent value. Note that when the randomiseSeed or seed methods are not used, every instance of this class will produce the same sequence of pseudo random numbers. Using randomiseSeed disables exact reproductions of executions. It returns the receiver.

seed(i: Integer): RandomGenerator

Sets the seed of the receiver to i. It returns the receiver.


Real (extends Object)

This primitive, permanent, native class extends Object. Custom floating point implementation; see data class Float for the IEEE 754-2008 standard.

Variables:

Methods:

-(): Real

Returns the negation of the receiver. It has a special syntax of the form -r, where r acts as the receiver.

-(r: Real): Real

Subtracts r from the receiver and returns the result. It has a special syntax of the form r1 - r2, where r1 acts as the receiver and r2 as the argument.

*(r: Real): Real

Returns the product of the receiver and r. It has a special syntax of the form r1 * r2, where r1 acts as the receiver and r2 as the argument.

/(r: Real): Real

Returns the quotient of the receiver with r. It has a special syntax of the form r1 / r2, where r1 acts as the receiver and r2 as the argument.

+(r: Real): Real

Returns the sum of the receiver with r. It has a special syntax of the form r1 + r2, where r1 acts as the receiver and r2 as the argument.

<(r: Real): Boolean

Returns true in case the receiver is smaller than r and false otherwise. It has a special syntax of the form r1 < r2, where r1 acts as the receiver and r2 as the argument.

<=(r: Real): Boolean

Returns true in case the receiver is smaller than or equal to r and false otherwise. It has a special syntax of the form r1 <= r2, where r1 acts as the receiver and r2 as the argument.

>(r: Real): Boolean

Returns true in case the receiver is greater than r and false otherwise. It has a special syntax of the form r1 > r2, where r1 acts as the receiver and r2 as the argument.

>=(r: Real): Boolean

Returns true in case the receiver is greater than or equal to r and false otherwise. It has a special syntax of the form r1 >= r2, where r1 acts as the receiver and r2 as the argument.

abs(): Real

Returns the absolute value of the receiver.

acos(): Real

Returns the arccosine of the receiver if the receiver is in [-1.0, 1.0]. Otherwise, an error is generated.

asin(): Real

Returns the arcsine of the receiver if the receiver is in [-1.0, 1.0]. Otherwise, an error is generated.

asFloat(): Float

Returns a Float object with the same value as the receiver.

asInteger(): Integer

Returns an Integer representation of the receiver denoting the integer number closest to the receiver. Rounding is as follows: for positive numbers: x rounds to floor(x + 1/2) for negative numbers x rounds to ceiling(x - 1/2).

asReal(): Real

Returns the receiver. (Only for compatibility with Integer::asReal.)

atan(): Real

Returns the arctangent of the receiver.

atan2(r: Real): Real

Returns the angle in radians between the vector (receiver, r) and the vector (1, 0).

ceiling(): Real

Returns the smallest rounded Real that is not smaller than the receiver.

cos(): Real

Returns the cosine of the receiver (as an angle in radians).

exp(): Real

Returns e (the base of the natural logarithm) to the power of the receiver.

floor(): Real

Returns the largest rounded Real that is not larger than the receiver.

ln(): Real

Returns the natural logarithm of the receiver if the receiver is positive. Otherwise, an error is generated.

log(): Real

Returns the 10-based logarithm of the receiver if the receiver is positive. Otherwise, an error is generated.

monus(r: Real): Real

Returns the difference of the receiver with r if the receiver > r or 0 otherwise.

power(r: Real): Real

Returns the receiver raised to the power of r.

round(): Real

Returns the rounded Real closest to the receiver (as an Integer). Rounding is as follows: for positive numbers: x rounds to floor(x + 1/2) for negative numbers x rounds to ceiling(x - 1/2).

sin(): Real

Returns the sine of the receiver (as an angle in radians).

sqr(): Real

Returns the square of the receiver.

sqrt(): Real

Returns the square root of the receiver in case the receiver is non-negative. Otherwise, an error is generated.

tan(): Real

Returns the tangent of the receiver (as an angle in radians).

max(r: Real): Real

Returns the maximum of the receiver and r.

min(r: Real): Real

Returns the minimum of the receiver and r.

asJSON(): String

Returns the receiver as a valid JSON (single line) string.


Socket (extends Object)

This native class extends Object. It provides a means to communicate via TCP/IP through sockets. Creating a new Socket yields an unconnected TCP/IP socket. For simplicity reasons, a Socket supports at most one connection between a server and client.

Variables:

Methods:

acceptFrom(i: Integer): Socket

Passively accepts a TCP/IP connection from local port i. It returns the receiver.

connectTo(s: String, i: Integer): Socket

Actively establishes a TCP/IP connection to a remote socket with remote server named s or with IP address s and remote port number i. It returns the receiver.

isConnected(): Boolean

Returns true in case is the receiver is connected and false otherwise.

isDisconnected(): Boolean

Returns true in case is the receiver is disconnected and false otherwise.

close(): Socket

Releases the concrete socket (if it was created) for further communication. It returns the receiver.

hasCharacters(i: Integer): Boolean

Returns true in case there are at least i characters available for reading and false otherwise.

readCharacters(i: Integer): Array

This method returns nil in case less than i characters are available for reading (without advancing the read pointer). Otherwise, it returns the sequence of first i characters (as an Array containing Char elements). The read pointer has been advanced till after the last read character.

read(i: Integer): String

This method reads the next sequence of i available characters and returns them as a String if i is non-negative. If fewer than i characters are available, a String is returned consisting of the number of available characters. The read pointer has been advanced till after the last read character. In case i is negative, an error is produced.

hasCharacter(c: Char): Boolean

Returns true in case there is at least one occurrence of character c available for reading and false otherwise.

readUntil(c: Char): String

This method returns nil in case no character 'c' is available (without advancing the read pointer). Otherwise, it returns the sequence of characters (as a String) until the first occurrence of character 'c'. The read pointer has been advanced till after the last read character. The character 'c' is not returned as part of the String.

hasWord(): Boolean

Returns true in case a non-empty sequence of non-white space characters is available for reading, preceded by a possibly empty sequence of white-space characters and succeeded by at least one white space character. Otherwise, it returns false.

readWord(): String

This method returns nil in case no sequence of non-white space characters is available that is succeeded by a white space character (without advancing the read pointer). Otherwise, it returns the sequence of non-white space characters (as a String) after a possibly empty sequence of white-space characters, until the first white space character after this sequence. The read pointer has been advanced till immediately after the first white space character after the sequence of non-white space characters. None of the white space characters before or after the word are part of the returned String.

hasLine(): Boolean

Returns true in case a newline character sequence is available (possibly after other characters) and false otherwise.

readLine(): String

This method returns nil in case no new line character sequence is available (without advancing the read pointer). Otherwise it returns the sequence of non-new line characters (as a String) until the first new-line character sequence after this sequence. The read pointer has been advanced till after the longest new-line character sequence immediately following the non-newline characters (if the line ends in CR(13) followed by LF(10) it advances till after the LF(10)). The new line characters are not part of the returned String.

hasString(): Boolean

Returns true in case in the sequence available for reading the first occurrence of a double quote forms with a sequence of following characters either a (complete) syntactic representation of a String, or is an invalid beginning of a syntactic representation of a String, i.e., cannot be completed to a valid String constant. It returns false otherwise.

readString(): String

This method advances until the next occurrence of a double quote character ". In case the character sequence starting from the double quote character is a valid syntactical representation of a String, then this String is returned. The read pointer has advanced till after the end of the String representation. In case the character sequence is not a valid syntactical representation of a String and cannot be completed to a valid String, an error is generated. In all other cases, nil is returned (without advancing the read pointer).

write(s: String): Socket

Writes the String s to the referred socket (not its syntactic representation). It returns the receiver.

writeCharacters(a: Array): Socket

Writes the characters in the array to the socket. The array parameter is only allowed to contain characters. It returns the receiver.

writeLine(s: String): Socket

Writes the String s to the referred file (not its syntactic representation) followed by new line character LF(10). It returns the receiver.

writeString(s: String): Socket

Writes the syntactic representation of s to the socket. It returns the receiver.


String (extends Object)

This permanent, native class extends Object. It represents the class of strings (of arbitrary size).

Variables:

Methods:

=(o: Object): Boolean

Returns true in case o refers to a String identical to the receiver. Otherwise, it returns false. It has a special syntax of the form o1 = o2, where o1 acts as the receiver and o2 as the argument.

+(s: String): String

Returns the concatenation of the receiver and s (as a new String). It has a special syntax of the form s1 + s2, where s1 acts as the receiver and s2 as the argument.

deepCopy(): Object

Returns a new String, identical to the receiver.

shallowCopy(): Object

Returns a new String, identical to the receiver.

concat(s: String): String

Modifies the receiver by concatenation with s. It returns the receiver.

cr(): String

Modifies the receiver by concatenation with a carriage return character CR(13). It returns the receiver.

lf(): String

Modifies the receiver by concatenation with a line feed character LF(10). It returns the receiver.

tab(): String

Modifies the receiver by concatenation with a tab character HT(9). It returns the receiver.

find(i: Integer, s: String): Integer

This method searches the receiver for a substring s, starting from index i. If pattern s is found, the index (between 1 and the size of the receiver) at which s starts is returned. In case i is smaller than 1 or larger than the size of the receiver, an index out-of-bounds error is generated. In all other cases, it returns 0.

at(i: Integer): Char

Returns the character at index i in case i ranges between 1 and the size of the receiver. Otherwise, an index out-of-bounds error is generated.

size(): Integer

Returns the number of characters constituting the receiver.

putAt(i: Integer, c: Char): String

Modifies the receiver by replacing the character at index i with c in case i ranges between 1 and the size of the receiver. Otherwise, an index out-of-bounds error is generated. It returns the receiver.

subString(i: Integer, l: Integer): String

Returns a new String containing a copy of the substring with size l, starting at index i in case i is between 1 and the size of the receiver, l is non-negative and i + l-1 is at most equal to the size of the receiver. Otherwise, an index out-of-bounds error is generated.

unmarshal(): Object

This method reconstructs an Object from a standardized String representation as created by the method marshal of class Object. If the receiver does not conform to the marshal syntax, an error occurs.

splitOn(c: Char): Array

Returns an Array of String objects, constructed by splitting the receiver into substrings at characters c. The new String objects in the returned Array do not contain character c. Notice that in case the receiver contains a sequence of characters c, the returned Array will contain empty Strings. In case c is not included in the receiver, the returned Array solely contains a copy of the receiver.

splitOnWhiteSpace(): Array

Returns an Array of String objects, constructed by splitting the receiver into substrings delimited by one or more white space characters. The new String objects in the returned Array do not contain any white space characters. White space characters at the beginning and end of the receiver are ignored and if the receiver consists of white space characters only, an empty Array is returned. In case the receiver does not contain any white-space characters, the returned Array solely contains a copy of the receiver.

splitOnString(s: String): Array

Returns an Array of String objects, constructed by splitting the receiver into substrings at string s. The new String objects in the returned Array do not contain string s. Notice that in case the receiver contains a sequence of string s, the returned Array will contain empty Strings. In case s is not included in the receiver, the returned Array solely contains a copy of the receiver. Splitting the string is done from left to right. Splitting the string "aapppoa" on "pp" therefor results in: "aa", "poa".

splitOnAny(c: String): Array

Returns an Array of String objects, constructed by splitting the receiver into substrings at any of characters in s. The new String objects in the returned Array do not contain any of the characters in s. Notice that in case the receiver contains a sequence of characters in s, the returned Array will contain empty Strings. In case any of the characters of s is not included in the receiver, the returned Array solely contains a copy of the receiver.

trim(): String

Returns a new string where the leading and trailing whitespaces are removed.

isBoolean(): Boolean

Returns true in case the receiver is the String representation of a Boolean object and false otherwise. No extra white space or other characters are allowed.

isChar(): Boolean

Returns true in case the receiver is the String representation of a Char object and false otherwise. The character must include surrounding single quotes and may use escape characters. No extra white space or other characters are allowed.

isNumber(): Boolean

Returns "receiver isFloat | receiver isInteger | receiver isReal".

isFloat(): Boolean

Returns true in case the receiver is the String representation of a Float object and false otherwise. No extra white space or other characters are allowed.

isInteger(): Boolean

Returns true in case the receiver is the String representation of an Integer object and false otherwise. No extra white space or other characters are allowed.

isReal(): Boolean

Returns true in case the receiver is the String representation of a Real object and false otherwise. No extra white space or other characters are allowed.

parseAsFloat(): Float

If "receiver isFloat", it returns "receiver toFloat". If "receiver isReal", it returns "receiver toReal asFloat". If "receiver isInteger", it returns "receiver toInteger asFloat". Otherwise, it returns nil.

parseAsInteger(): Integer

If "receiver isInteger", it returns "receiver toInteger". If "receiver isReal", it returns "receiver toReal asInteger". Otherwise, it returns nil.

parseAsReal(): Real

If "receiver isReal", it returns "receiver toReal". If "receiver isInteger", it returns "receiver toInteger asReal". Otherwise, it returns nil.

toBoolean(): Boolean

If the receiver is the String representation of a Boolean object (in line with the isBoolean method), this object is returned. Otherwise, nil is returned.

toChar(): Char

If the receiver is the String representation of a Char object (in line with the isChar method), this object is returned. Otherwise, nil is returned.

toFloat(): Float

If the receiver is the String representation of a Float object (in line with the isFloat method), this object is returned. Otherwise, nil is returned.

toInteger(): Integer

If the receiver is the String representation of an Integer object (in line with the isInteger method), this object is returned. Otherwise, nil is returned.

toReal(): Real

If the receiver is the String representation of a Real object (in line with the isReal method), this object is returned. Otherwise, nil is returned.

parseJSON(): Object

If the receiver denotes a valid JSON string, a POOSL object for the JSON string is returned. Otherwise, nil is returned.

asJSON(): String

Returns the receiver as a valid JSON (single line) string.


Array (extends Object)

This permanent, native class extends Object. It represents an indexed list of (arbitrary typed) objects. Creating a new Array yields an indexed list of size 0 (empty Array). Valid indices for non-empty Arrays range from 1 to the size of the Array.

Variables:

Methods:

=(o: Object): Boolean

Returns true in case o is an Array of the same size as the receiver and for each index, the objects both Arrays refer to are equal (in terms of =). Otherwise, it returns false.

+(a: Array): Array

Returns a new Array consisting of a copy of the receiver that has the size of the receiver plus the size of a, where the indices between 1 and the size of the receiver are filled with the objects in the receiver (in the same order) and the indices between the size of the receiver + 1 and the size of the returned Array contain the objects in a (in the same order). It has a special syntax of the form a1 + a2, where a1 acts as the receiver and a2 as the argument.

deepCopy(): Object

Returns a new Array object with the same size as the receiver and at each index, a recursive deepCopy of the object referred to by the receiver at that index.

shallowCopy(): Object

Returns a new Array object with the same size as the receiver and at each index, it refers to the same object referred to by the receiver at that index.

printString(): String

Returns a String equal to "Empty Array" in case the receiver has size 0. Otherwise, it consists of String "Array(" followed by a comma separated list of Strings, the result s of calling printString on the objects from index 1 to the size of the receiver, followed by ")".

at(i: Integer): Object

Returns the object located at index i in case i ranges between 1 and the size the receiver. Otherwise, an index out-of-bounds error is generated.

size(): Integer

Returns the size of the receiver.

putAt(i: Integer, o: Object): Array

Replaces the object at index i with o in case i ranges between 1 and the size of the receiver. Otherwise, an index out-of-bounds error is generated. It returns the receiver.

putAll(o: Object): Array

Makes all indices in the receiver refer to object o (without making copies). It returns the receiver.

resize(i: Integer): Array

Modifies the size of the receiver to i (in case i >= 0). In case i < 0, an error is generated. When i is larger than the original size of the receiver, all new locations are filled with nil. When i is smaller than the original size of the receiver, the objects at indices between i+1 and the original size will no longer be contained. It returns the receiver.

concat(a: Array): Array

Modifies the receiver by increasing its size with the size of a, where the indices between the size of the receiver + 1 and the size of the returned Array contain the objects in a (in the same order).

find(i: Integer, o: Object): Integer

This method searches the receiver for object o, starting from index i. If an object equal to o is found, the index (between 1 and the size of the receiver) at which o is located is returned. In case i is smaller than 1 or larger than the size of the receiver, an index out-of-bounds error is generated. In all other cases, it returns 0.

subArray(i: Integer, l: Integer): Array

Returns a new Array of size l containing a copy of the objects in the receiver starting at index i in case i is between 1 and the size of the receiver, l is non-negative and i + l-1 is at most equal to the size of the receiver. Otherwise, an index out-of-bounds error is generated.

asJSON(): String

Returns the receiver as a valid JSON (single line) string. It will throw an exception when it contains a non-serializable object.


Collection (extends Object)

Collection - Super class for Bag, Set, Map, Stack, Queue and Sequence

Variables:

Methods:

clear(): Collection

Clears the contents of the Collection (by removing all elements)

isEmpty(): Boolean

Returns true in case the Collection does not contain any elements. Otherwise, it returns false

size(): Integer

Returns the number of elements in the Collection

excludes(O: Object): Boolean

Returns true in case O is not contained in the Collection. Otherwise, it returns false

excludesAll(C: Collection): Boolean

Returns true in case (no instance of) each element in C is not contained in the Collection. Otherwise, it returns false. In case C is not a Collection, an error is generated

includes(O: Object): Boolean

Returns true in case O is contained in the Collection. Otherwise, it returns false

includessAll(C: Collection): Boolean

Returns true in case ( all instances of) each element in C is contained in the Collection. Otherwise, it returns false. In case C is not a Collection, an error is generated

toArray(): Array

Returns an Array that contains the elements in the Collection (with duplicate instances). In case the Collection is a Sequence, the ordering of the elements (and indices of the elements) is preserved

toBag(): Bag

Returns a Bag that contains all elements in the Collection (with duplicate instances)

toSequence(): Sequence

Returns a Sequence that contains all elements in the Collection (with duplicate instances). In case the collection is a Sequence, the ordering of the elements (and indices of the elements) is preserved

count(O: Object): Integer

Returns the number of duplicate instances of O in the Bag


Bag (extends Collection)

Bag (Unordered Multi-Set) - Creating a Bag yields an empty Unordered Collection (Possibly With Duplicate Instances)

Variables:

Methods:

=(B: Object): Boolean

Returns true in case B is a Bag and the Bag and B contain the same objects in equal numbers. Otherwise, false is returned

!=(B: Object): Boolean

Returns !(self = B)

+(B: Bag): Bag

Returns a new Bag that contains those elements included in both the receiver and B. The number of duplicate instances becomes the sum of the number of the duplicate instances in the receiver and B. In case B is not a Bag, an error is generated

-(B: Bag): Bag

Returns a new Bag that only contains those elements of the receiver that are not included in B. The number of duplicate instances becomes the number of the duplicate instances in the receiver minus the number of duplicate instances in B (if larger than 0, otherwise they are all removed). In case B is not a Bag, an error is generated

>(B: Bag): Boolean

Returns true in case the Bag is a strict super bag of B, where the number of duplicate instances (for each least one element) in the Bag must be strictly larger than the number of duplicate instances in B. Otherwise, false is returned. In case B is not a Bag, an error is generated

>=(B: Bag): Boolean

Returns true in case the Bag is a super bag of B, where the number of duplicate instances in the Bag must be larger than or equal to the number of duplicate instances in B. Otherwise, false is returned. In case B is not a Bag, an error is generated

<(B: Bag): Boolean

Returns true in case the Bag is a strict sub bag of B, where the number of duplicate instances (for each least one element) in the Bag must be strictly smaller than the number of duplicate instances in B. Otherwise, false is returned. In case B is not a Bag, an error is generated

<=(B: Bag): Boolean

Returns true in case the Bag is a sub bag of B, where the number of duplicate instances in the Bag must be smaller than or equal to the number of duplicate instances in B. Otherwise, false is returned. In case B is not a Bag, an error is generated

iterator(): BagIterator

Returns an iterator for traversing the Bag

fromArray(A: Array): Bag

Modifies the Bag by clearing its contents and subsequently adding all elements of Array A

isUnique(): Boolean

Returns true in case the Bag does not contain duplicate instances. Otherwise, false is returned

count(O: Object): Integer

Returns the number of duplicate instances of O in the Bag

add(O: Object): Bag

Modifies and returns the Bag after adding object O

addMultiple(O: Object, N: Integer): Bag

Modifies and returns the Bag after adding N duplicate instances of O if N is a non-negative integer. Otherwise, an error is generated

remove(O: Object): Bag

Removes one instance of O from the Bag (if such instance is included). It returns the Bag

removeMultiple(O: Object, N: Integer): Bag

Removes N instances of O from the Bag (if such instances are included) if N is a non-negative Integer. If N is larger than the number of duplicate instances of O in the Bag, all duplicate instances of O are removed. It returns the Bag

removeDuplicates(): Bag

Returns the Bag after removing all duplicate instances of elements (if any)

union(B: Bag): Bag

Modifies the Bag by adding all elements from B. The number of duplicate instances becomes the sum of the number of the duplicate instances in the Bag and B. In case B is not a Bag, an error is generated

subtract(B: Bag): Bag

Modifies the Bag by removing all elements from B. The number of duplicate instances becomes the number of the duplicate instances in the Bag minus the number of duplicate instances in B (if larger than 0, otherwise they are all removed). In case B is not a Bag, an error is generated

difference(B: Bag): Bag

Modifies the Bag to become the symmetric difference of the Bag and B. This means that those elements of the Bag that are in B are removed (such that a minimum number of duplicate instances remains, if positive) and those elements in B that are not in the Bag are added (including duplicate instances). In case B is not a Bag, an error is generated

intersection(B: Bag): Bag

Modifies the Bag to contain only those elements that are contained in both the Bag and B. The number of duplicate instances becomes the minimum of the number of the duplicate instances included in the Bag and B. In case B is not a Bag, an error is generated

printString(): String

Returns a pretty print


Sequence (extends Collection)

Sequence (Bi-Directional List) - Creating a Sequence yields an empty Ordered Collection (Possibly With Duplicate Instances). Valid indices for non-empty Sequences range from 1 to the size of the Sequence

Variables:

Methods:

+(S: Sequence): Sequence

Returns a new Sequence containing all elements in the receiver succeeded by all elements of S. In case S is not a Sequence, an error is generated

iterator(): SequenceIterator

Returns a (forward directed) iterator for traversing the Sequence

fromArray(A: Array): Sequence

Modifies the Sequence by clearing its contents and subsequently appending all elements of Array A (with duplicate instances and preserving the ordering)

isUnique(): Boolean

Returns true in case the Sequence does not contain any duplicate instances. Otherwise, false is returned

count(O: Object): Integer

Returns the number of duplicate instances of O in the Sequence

append(O: Object): Sequence

Adds O to the Sequence after the last position

prepend(O: Object): Sequence

Adds O to the Sequence before the first position

putAt(I: Integer, O: Object): Sequence

Modifies the Sequence by replacing the element at index I with O. In case I is not an Integer or if it is smaller than 1 or greater than the size of the Sequence, an error is generated

insertAt(I: Integer, O: Object): Sequence

Modifies the Sequence by inserting element O at index I. In case I is not an Integer or if it is smaller than 1 or greater than the size of the Sequence, an error is generated

at(I: Integer): Object

Returns the element at index I. In case I is not an Integer or if it is smaller than 1 or greater than the size of the Sequence, an error is generated

first(): Object

Returns the first element in the Sequence (or nil if it is empty)

last(): Object

Returns the last element in the Sequence (or nil if it is empty)

removeAt(I: Integer): Sequence

Modifies the Sequence by removing the element at index I. In case I is not an Integer or if it is smaller than 1 or greater than the size of the Sequence, an error is generated

removeFirst(): Sequence

Returns the Sequence after removing the first element (if not empty)

removeLast(): Sequence

Returns the Sequence after removing the last element (if not empty)

concat(S: Sequence): Sequence

Modifies the Sequence by appending all elements of S. In case S is not a Sequence, an error is generated

reverse(): Sequence

Modifies the Sequence by reversing the order of the elements

splice(I: Integer, S: Sequence): Sequence

Modifies the Sequence by inserting all elements of S from index I onwards. In case the Sequence is not empty, an error is generated if S is not a Sequence, if I is not an Integer or if it is smaller than 1 or greater than the size of the Sequence

swap(I: Integer, J: Integer): Sequence

Modifies the Sequence by swapping the elements at index I and J. In case the Sequence is not empty and I differs from J then an error is generated if either I or J is not an Integer or if I and J are smaller than 1 or greater than the size of the Sequence

subSequence(I: Integer, L: Integer): Sequence

Returns a new Sequence that will contain the elements of the receiver from and including index I until and including index I + L. In case the receiver is not empty, an error is generated in case I and L are not Integers, if L is negative or if I and I + L + 1 range outside the index range of the Sequence

find(I: Integer, O: Object): Integer

This method searches the Sequence for the first instance of O, starting from index I. If an instance of O is found, the index (between 1 and the size of the Sequence) at which O is located is returned. In all other cases, it returns 0. In case the Sequence is not empty, an error is generated if I is not an Integer or if it is smaller than 1 or greater than the size of the Sequence

iteratorAt(I: Integer): SequenceIterator

Returns a (forward directed) Iterator to the element at index I of the Sequence if I is an Integer not smaller than 1 and not greater than the size of the Sequence. Otherwise, either an error is generated in case the Sequence is not empty or a finalized Iterator is returned in case the Sequence is empty

printString(): String

Returns a pretty print


Queue (extends Collection)

Queue (First-In-First-Out Ordering) of Unbounded or Finite Size - Creating a new Queue yields a Queue of unbounded size (capacity)

Variables:

Methods:

clear(): Queue

Clears the contents of the Queue (by removing all elements)

resize(S: Integer): Queue

Modifies the size (capacity) of the Queue. If S is smaller than the current size (capacity), elements at the tail of the Queue are removed. If S equals nil then the size (capacity) is set to unbounded. If S is not nil or an Integer smaller than 1, an error is generated

size(): Integer

Returns the size (capacity) of the Queue or nil if unbounded

occupation(): Integer

Returns the number of elements in the Queue

isEmpty(): Boolean

Returns true in case the Queue does not contain any elements. Otherwise, it returns false

isFull(): Boolean

Returns true in case the size (capacity) of the Queue is bounded and equals its capacity. Otherwise, it returns false

excludes(O: Object): Boolean

Returns true in case there are no instances of O contained in the Queue. Otherwise, it returns false

includes(O: Object): Boolean

Returns true in case at least one instance of O is contained in the Queue. Otherwise, it returns false

count(O: Object): Integer

Returns the number of instances of O in the Queue

add(O: Object): Queue

Adds object O to the end (tail) of the Queue in case it is not full

inspect(): Object

Returns the first element (head) in the Queue if it is not empty. Otherwise, it returns nil. It does not modify the Queue

remove(): Object

Returns the first element (head) in the Queue and removes it from the Queue if not empty. Otherwise, it returns nil

printString(): String

Returns a pretty print


Stack (extends Collection)

Stack (Last-In-First-Out Ordering) of Unbounded or Finite Size - Creating a new Stack yields a Stack of unbounded size (capacity)

Variables:

Methods:

clear(): Stack

Clears the contents of the Stack (by removing all elements)

resize(S: Integer): Stack

Modifies the size (capacity) of the Stack. If S is smaller than the current size (capacity), elements at the tail of the Stack are removed. If S equals nil then the size (capacity) is set to unbounded. If S is not nil or an Integer smaller than 1, an error is generated

size(): Integer

Returns the size (capacity) of the Stack or nil if unbounded

occupation(): Integer

Returns the number of elements in the Stack

isEmpty(): Boolean

Returns true in case the Stack does not contain any elements. Otherwise, it returns false

isFull(): Boolean

Returns true in case the size (capacity) of the Stack is bounded and equals its capacity. Otherwise, it returns false

excludes(O: Object): Boolean

Returns true in case there are no instances of O contained in the Stack. Otherwise, it returns false

includes(O: Object): Boolean

Returns true in case at least one instance of O is contained in the Stack. Otherwise, it returns false

count(O: Object): Integer

Returns the number of instances of O in the Stack

push(O: Object): Stack

Adds object O to the end (tail) of the Stack in case it is not full

inspect(): Object

Returns the last element (tail) in the Stack if it is not empty. Otherwise, it returns nil. It does not modify the Stack

pop(): Object

Returns the last element (tail) in the Stack and removes it in case the Stack is not empty. Otherwise, it returns nil

printString(): String

Returns a pretty print


Set (extends Collection)

Set (Unordered Set) - Creating a new Set yields an empty Unordered Collection (Without Duplicate Instances)

Variables:

Methods:

=(S: Object): Boolean

Returns true in case S is a Set and the receiver and S contain the same objects. Otherwise, false is returned

!=(S: Object): Boolean

Returns !(self = S)

+(S: Set): Set

Returns a new Set containing all elements of both the receiver and S (without duplicate instances). In case S is not a Set, an error is generated

-(S: Set): Set

Returns a new Set that contains only elements that are contained in the receiver but not in S (Set Difference). In case S is not a Set, an error is generated

>(S: Set): Boolean

Returns true in case the Set is a strict super set of S (i.e., the Set includes all elements of S and at least one other element). Otherwise, false is returned. In case S is not a Set, an error is generated

>=(S: Set): Boolean

Returns true in case the Set is a super set of S (i.e., the Set includes all elements of S). Otherwise, false is returned. In case S is not a Set, an error is generated

<(S: Set): Boolean

Returns true in case the Set is a strict sub set of S. Otherwise, false is returned. In case S is not a Set, an error is generated

<=(S: Set): Boolean

Returns true in case the Set is a sub set of S (i.e., S includes all elements of the Set and at least one other element). Otherwise, false is returned. In case S is not a Set, an error is generated

iterator(): Iterator

Returns an iterator for traversing the Set

fromArray(A: Array): Set

Modifies the Set by clearing its contents and subsequently adding all elements of Array A (without duplicate instances)

count(O: Object): Integer

Returns 1 in case O is included in the Set. Otherwise, 0 is returned

add(O: Object): Set

Adds O to the Set if it was not yet included. Otherwise, the Set remains unchanged

remove(O: Object): Set

Removes O from the Set if it was included. Otherwise, the Set remains unchanged

union(S: Set): Set

Modifies the Set by adding all elements of S to it (without duplicate instances). In case S is not a Set, an error is generated

subtract(S: Set): Set

Modifies the Set to no longer include the elements in S. In case S is not a Set, an error is generated

difference(S: Set): Set

Modifies the Set to become the symmetric difference of the Set and S. This means that those elements of the Set that are also in S are removed and those elements in S that are not in the Set are added. In case S is not a Set, an error is generated

intersection(S: Set): Set

Modifies the Set to contain only those elements that are contained in both the Set and S. In case S is not a Set, an error is generated

printString(): String

Returns a pretty print


Map (extends Collection)

Map (Key-Value Dictionary) - Creating a new Map yields an empty Key-Value Dictionary

Variables:

Methods:

=(M: Object): Boolean

Returns true if M is a Map and the receiver and M contain the same key-value pairs. Otherwise, it returns false

!=(M: Object): Boolean

Returns !(self = M)

clear(): Map

Clears the contents of the Map (by removing all key-value pairs)

isEmpty(): Boolean

Returns true in case the Map does not contain any key-value pairs. Otherwise, it returns false

size(): Integer

Returns the number of key-value pairs in the Map

iterator(): MapIterator

Returns an iterator for traversing the Map

includesKey(K: Object): Boolean

Returns true in case key K is included in the Map. Otherwise, it returns false

includesValue(V: Object): Boolean

Returns true in case at least one instance of value V is included in the Map. Otherwise, it returns false

keys(): Set

Returns a Set with all keys in the Map

values(): Bag

Returns a Bag with all values corresponding to all keys (which may contain duplicate instances)

putAt(Key: Object, Value: Object): Map

Modifies the Map to store value V at key K. In case key K was not yet included, it is added

at(Key: Object): Object

Returns the value at key K if such key is included in the Map. Otherwise, it returns nil

removeAt(Key: Object): Map

Modifies the Map by removing the key-value pair with key K (if it was included)

printString(): String

Returns a pretty print

asJSON(): String

Returns the receiver as a valid JSON (single line) string. It will throw an exception when it contains a non-serializable object.


Iterator (extends Object)

Iterator (Abstract super class used by MapIterator, BagIterator, SetIterator, SequenceIterator)

Variables:

Methods:

isDone(): Boolean

Returns true in case all elements in the structure have been referred to. Otherwise, false is returned

advance(): Iterator

Modifies the Iterator to refer to the next element if there is still such element. Otherwise, the Iterator remains unchanged

remove(): Iterator

Modifies the underlying structure by removing the element to which the Iterator is pointing. The iterator advances to the next element in the underlying structure

printString(): String

Returns a pretty print

key(): Object

Returns the key (on map)

value(): Object

Returns the value

element(): Object

Returns the value


MapIterator (extends Iterator)

MapIterator - Iterator for stepping through a map

Variables:

Methods:

key(): Object

Returns the key of the key-value pair to which the iterator is pointing in the Map in case the Map is not empty. Otherwise, nil is returned

isDone(): Boolean

Returns true in case all elements in the structure have been referred to. Otherwise, false is returned

value(): Object

Returns the value of the key-value pair to which the iterator is pointing in the Map in case the Map is not empty. Otherwise, nil is returned

remove(): Iterator

Modifies the underlying structure by removing the element to which the Iterator is pointing. The iterator advances to the next element in the underlying structure

advance(): Iterator

Modifies the Iterator to refer to the next element if there is still such element. Otherwise, the Iterator remains unchanged


BagIterator (extends Iterator)

BagIterator - Iterator for stepping through a bag

Variables:

Methods:

advance(): BagIterator

Modifies the Iterator to refer to the next instance of the element in the Bag if there is still a next instance. Otherwise, the Iterator advances to the next element

remove(): BagIterator

Modifies the underlying Bag by removing one instance of the element to which the Iterator is pointing

printString(): String

Returns a pretty print

count(): Object

returns the count (number of times the object exists in the bag)


SetIterator (extends Iterator)

SetIterator - Iterator for stepping through a set

Variables:

Methods:


SequenceIterator (extends Iterator)

SequenceIterator - Iterator for stepping through a sequence

Variables:

Methods:

first(): SequenceIterator

Modifies the Iterator to point to the first element in the Sequence

last(): SequenceIterator

Modifies the Iterator to point to the last element in the Sequence

advance(): SequenceIterator

Modifies the Iterator to refer to the next element (for forward directed iterators) or previous element (for reversely directed iterators) in the Sequence if there is still such element. Otherwise, the Iterator remains unchanged

addBefore(O: Object): SequenceIterator

Modifies the underlying sequence by inserting an element referring to the specified object. The element is inserted in the sequence before the currently referred element, not considering whether the direction of the iterator is reversed

addAfter(O: Object): SequenceIterator

Modifies the underlying sequence by inserting an element referring to the specified object. The element is inserted in the sequence after the currently referred element, not considering whether the direction of the iterator is reversed. If isDone holds or the referred element is removed, an error is triggered. The iterator is not modified.