BasicClasses.poosl
Data classes:
Data classes
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.
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).
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.
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.
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.
Nil (extends Object)
This primitive, permanent, native class extends Object. It represents the class of instance nil.Variables:
Methods:
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.
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.