Module Interface Object:Boxed

SUMMARY: MODULE | CLASS | TYPE | PROC | VAR | CONST | DETAIL: TYPE | PROC | VAR | CONST

# Object:Boxed

This module provides "boxed" representations for the predefined types of Oberon-2. For every predefined type, there is a corresponding class definition. (Ok, that is the theory. Not all types are implemented. If you need one, add it. And do not forget to send me the patch!)

All boxed values are derived from the class Object. Instances are immutable. That is, they take on a value when created and never change it during their lifetime.

### Import List

        ADT:Storable
        IO
        Object
        Object

Class List
Boolean |
LongReal |
Object | This is the base type for all boxed versions of Oberon-2 values.
Set |
String |

Class Summary: Boolean [Detail]
      +---Object.Object
           |
           +---ADT:Storable.Object
                |
                +---Object:Boxed.Object
                     |
                     +--Object:Boxed.Boolean
Field Summary
value-: BOOLEAN
Constructor Summary
NewBoolean(BOOLEAN): Boolean
ParseBoolean(ARRAY OF CHAR): Boolean
Method Summary
Cmp(Object): LONGINT
Equals(Object): BOOLEAN Indicates whether some other object is "equal to" this one.
HashCode(): Hash Returns a hash code value for the object.
Load(Reader) Loads data of v from r.
Store(Writer) Stores data of v to w.
ToString(): String Returns a string representation of the object.
Inherited Methods
From Object.Object: Equals, HashCode From ADT:Storable.Object: Load, Store From Object:Boxed.Object: Cmp, ToString

Class Summary: LongReal [Detail]
      +---Object.Object
           |
           +---ADT:Storable.Object
                |
                +---Object:Boxed.Object
                     |
                     +--Object:Boxed.LongReal
Field Summary
value-: LONGREAL
Constructor Summary
NewLongReal(LONGREAL): LongReal Return a LongReal for val.
ParseLongReal(ARRAY OF CHAR): LongReal
ParseLongRealLiteral(ARRAY OF CHAR): LongReal Like ParseLongReal, but the character of the exponent decides whether the value should be treated as a REAL or LONGREAL literal.
Method Summary
Add(LongReal): LongReal
Cmp(Object): LONGINT
Div(LongReal): LongReal
Equals(Object): BOOLEAN Indicates whether some other object is "equal to" this one.
HashCode(): Hash Returns a hash code value for the object.
Load(Reader) Loads data of v from r.
Mul(LongReal): LongReal
Neg(): LongReal
Sign(): LONGINT
Store(Writer) Stores data of v to w.
Sub(LongReal): LongReal
ToLongReal(): LONGREAL
ToString(): String Returns a string representation of the object.
Inherited Methods
From Object.Object: Equals, HashCode From ADT:Storable.Object: Load, Store From Object:Boxed.Object: Cmp, ToString

Class Summary: Object [Detail]
      +---Object.Object
           |
           +---ADT:Storable.Object
                |
                +--Object:Boxed.Object
This is the base type for all boxed versions of Oberon-2 values.
Method Summary
Cmp(Object): LONGINT
ToString(): String Returns a string representation of the object.
Inherited Methods
From Object.Object: Equals, HashCode, ToString From ADT:Storable.Object: Load, Store

Class Summary: Set [Detail]
      +---Object.Object
           |
           +---ADT:Storable.Object
                |
                +---Object:Boxed.Object
                     |
                     +--Object:Boxed.Set
Field Summary
value-: SET
Constructor Summary
NewSet(SET): Set
Method Summary
Cmp(Object): LONGINT
Equals(Object): BOOLEAN Indicates whether some other object is "equal to" this one.
HashCode(): Hash Returns a hash code value for the object.
Load(Reader) Loads data of v from r.
Store(Writer) Stores data of v to w.
ToString(): String Returns a string representation of the object.
Inherited Methods
From Object.Object: Equals, HashCode From ADT:Storable.Object: Load, Store From Object:Boxed.Object: Cmp, ToString

Class Summary: String [Detail]
      +---Object.Object
           |
           +---ADT:Storable.Object
                |
                +---Object:Boxed.Object
                     |
                     +--Object:Boxed.String
Field Summary
value-: String
Constructor Summary
NewString(String): String
ParseString(ARRAY OF CHAR): String
Method Summary
Cmp(Object): LONGINT
Equals(Object): BOOLEAN Indicates whether some other object is "equal to" this one.
HashCode(): Hash Returns a hash code value for the object.
Load(Reader) Loads data of v from r.
Store(Writer) Stores data of v to w.
ToString(): String Returns a string representation of the object.
Inherited Methods
From Object.Object: Equals, HashCode From ADT:Storable.Object: Load, Store From Object:Boxed.Object: Cmp, ToString

Type Summary
ParseFct = (ARRAY OF CHAR): Object

Variable Summary
false-: Boolean
true-: Boolean
zeroLongReal-: LongReal

Class Detail: Boolean

Field Detail

### value

    FIELD value-: BOOLEAN

Constructor Detail

### NewBoolean

    PROCEDURE NewBoolean(value: BOOLEAN): Boolean

### ParseBoolean

    PROCEDURE ParseBoolean(str: ARRAY OF CHAR): Boolean

Method Detail

### Cmp

    PROCEDURE (v: Boolean) Cmp(y: Object): LONGINT

> Redefines: Cmp

### Equals

    PROCEDURE (v: Boolean) Equals(y: Object): BOOLEAN

> Indicates whether some other object is "equal to" this one.

> The Object.Equals method implements an equivalence relation:

> - It is reflexive: for any reference value ``x`', ``x.Equals(x)`' should return TRUE.

> - It is symmetric: for any reference values ``x`' and ``y`', ``x.Equals(y)`' should return TRUE if and only if ``y.Equals(x)`' returns TRUE.

> - It is transitive: for any reference values ``x`', ``y`', and ``z`', if ``x.Equals(y)`' returns TRUE and ``y.Equals(z)`' returns TRUE, then ``x.Equals(z)`' should return TRUE.

> - It is consistent: for any reference values ``x`' and ``y`', multiple invocations of ``x.Equals(y)`' consistently return TRUE or consistently return FALSE, provided no information used in equals comparisons on the object is modified.

> - For any non-NIL reference value ``x`', ``x.Equals(NIL)`' should return FALSE.

> The ``Equals`' method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values ``x`' and ``y`', this method returns TRUE if and only if ``x`' and ``y`' refer to the same object (``x=y`' has the value TRUE).

> [Description inherited from Equals]

> Redefines: Equals, Equals, Equals

### HashCode

    PROCEDURE (v: Boolean) HashCode(): Hash

> Returns a hash code value for the object. This method is supported for the benefit of dictionaries such as those provided by ADT:Dictionary..

> The general contract of Object.HashCode is:

> - Whenever it is invoked on the same object more than once during an execution of an application, the Object.HashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.

> - If two objects are equal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce the same integer result.

> - It is not required that if two objects are unequal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of dictionaries.

> As much as is reasonably practical, the Object.HashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required.)

> [Description inherited from HashCode]

> Redefines: HashCode, HashCode, HashCode

### Load

    PROCEDURE (v: Boolean) Load(r: Reader)
      RAISES Error;

> Loads data of v from r. Nested record pointers are loaded by calling the type-bound procecdure Reader.ReadObject. This procedure must be symmetric to Object.Store, or data internalization will break, causing undefined object state or program termination.

> Note: When internalizing a file with alien objects, it is possible that the type-bound procedure Object.Load is invoked more than once for a single object. Except for the results of the last call, all duplicates are discarded. Because of this, all changes by this procedure to any program state that is not part of the object v are deprecated.

> Pre-condition: This procedure is either activated by a super call, or from the procedure Reader.ReadObject.

> [Description inherited from Load]

> Redefines: Load, Load

### Store

    PROCEDURE (v: Boolean) Store(w: Writer)
      RAISES Error;

> Stores data of v to w. Nested record pointers are stored by calling the type-bound procedure Writer.WriteObject. The procedure is not allowed to make any changes to the global state of the program, except for calling the ``Write`' methods of the writer w. Any redefinition of this procedure must include a super call, preferably as the first statement of the procedure body.

> Pre-condition: This procedure is either activated by a super call, or from the procedure Writer.WriteObject.

> [Description inherited from Store]

> Redefines: Store, Store

### ToString

    PROCEDURE (v: Boolean) ToString(): String

> Returns a string representation of the object. Typically, the string is some form of "natural" representation of the value. For complex objects, it should describe the type and essential attributes of the object. The exact format of the returned value is intentionally left vague.

> [Description inherited from ToString]

> Redefines: ToString, ToString, ToString

Class Detail: LongReal

Field Detail

### value

    FIELD value-: LONGREAL

Constructor Detail

### NewLongReal

    PROCEDURE NewLongReal(val: LONGREAL): LongReal

> Return a LongReal for val.

### ParseLongReal

    PROCEDURE ParseLongReal(s: ARRAY OF CHAR): LongReal

### ParseLongRealLiteral

    PROCEDURE ParseLongRealLiteral(s: ARRAY OF CHAR): LongReal

> Like ParseLongReal, but the character of the exponent decides whether the value should be treated as a REAL or LONGREAL literal.

Method Detail

### Add

    PROCEDURE (v: LongReal) Add(right: LongReal): LongReal

### Cmp

    PROCEDURE (v: LongReal) Cmp(right: Object): LONGINT

> Redefines: Cmp

### Div

    PROCEDURE (v: LongReal) Div(right: LongReal): LongReal

### Equals

    PROCEDURE (v: LongReal) Equals(y: Object): BOOLEAN

> Indicates whether some other object is "equal to" this one.

> The Object.Equals method implements an equivalence relation:

> - It is reflexive: for any reference value ``x`', ``x.Equals(x)`' should return TRUE.

> - It is symmetric: for any reference values ``x`' and ``y`', ``x.Equals(y)`' should return TRUE if and only if ``y.Equals(x)`' returns TRUE.

> - It is transitive: for any reference values ``x`', ``y`', and ``z`', if ``x.Equals(y)`' returns TRUE and ``y.Equals(z)`' returns TRUE, then ``x.Equals(z)`' should return TRUE.

> - It is consistent: for any reference values ``x`' and ``y`', multiple invocations of ``x.Equals(y)`' consistently return TRUE or consistently return FALSE, provided no information used in equals comparisons on the object is modified.

> - For any non-NIL reference value ``x`', ``x.Equals(NIL)`' should return FALSE.

> The ``Equals`' method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values ``x`' and ``y`', this method returns TRUE if and only if ``x`' and ``y`' refer to the same object (``x=y`' has the value TRUE).

> [Description inherited from Equals]

> Redefines: Equals, Equals, Equals

### HashCode

    PROCEDURE (v: LongReal) HashCode(): Hash

> Returns a hash code value for the object. This method is supported for the benefit of dictionaries such as those provided by ADT:Dictionary..

> The general contract of Object.HashCode is:

> - Whenever it is invoked on the same object more than once during an execution of an application, the Object.HashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.

> - If two objects are equal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce the same integer result.

> - It is not required that if two objects are unequal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of dictionaries.

> As much as is reasonably practical, the Object.HashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required.)

> [Description inherited from HashCode]

> Redefines: HashCode, HashCode, HashCode

### Load

    PROCEDURE (v: LongReal) Load(r: Reader)
      RAISES Error;

> Loads data of v from r. Nested record pointers are loaded by calling the type-bound procecdure Reader.ReadObject. This procedure must be symmetric to Object.Store, or data internalization will break, causing undefined object state or program termination.

> Note: When internalizing a file with alien objects, it is possible that the type-bound procedure Object.Load is invoked more than once for a single object. Except for the results of the last call, all duplicates are discarded. Because of this, all changes by this procedure to any program state that is not part of the object v are deprecated.

> Pre-condition: This procedure is either activated by a super call, or from the procedure Reader.ReadObject.

> [Description inherited from Load]

> Redefines: Load, Load

### Mul

    PROCEDURE (v: LongReal) Mul(right: LongReal): LongReal

### Neg

    PROCEDURE (v: LongReal) Neg(): LongReal

### Sign

    PROCEDURE (v: LongReal) Sign(): LONGINT

### Store

    PROCEDURE (v: LongReal) Store(w: Writer)
      RAISES Error;

> Stores data of v to w. Nested record pointers are stored by calling the type-bound procedure Writer.WriteObject. The procedure is not allowed to make any changes to the global state of the program, except for calling the ``Write`' methods of the writer w. Any redefinition of this procedure must include a super call, preferably as the first statement of the procedure body.

> Pre-condition: This procedure is either activated by a super call, or from the procedure Writer.WriteObject.

> [Description inherited from Store]

> Redefines: Store, Store

### Sub

    PROCEDURE (v: LongReal) Sub(right: LongReal): LongReal

### ToLongReal

    PROCEDURE (v: LongReal) ToLongReal(): LONGREAL

### ToString

    PROCEDURE (v: LongReal) ToString(): String

> Returns a string representation of the object. Typically, the string is some form of "natural" representation of the value. For complex objects, it should describe the type and essential attributes of the object. The exact format of the returned value is intentionally left vague.

> [Description inherited from ToString]

> Redefines: ToString, ToString, ToString

Class Detail: Object

Method Detail

### Cmp

    PROCEDURE (v: Object) Cmp(y: Object): LONGINT

### ToString

    PROCEDURE (v: Object) ToString(): String

> Returns a string representation of the object. Typically, the string is some form of "natural" representation of the value. For complex objects, it should describe the type and essential attributes of the object. The exact format of the returned value is intentionally left vague.

> [Description inherited from ToString]

> Redefines: ToString, ToString

Class Detail: Set

Field Detail

### value

    FIELD value-: SET

Constructor Detail

### NewSet

    PROCEDURE NewSet(value: SET): Set

Method Detail

### Cmp

    PROCEDURE (v: Set) Cmp(y: Object): LONGINT

> Redefines: Cmp

### Equals

    PROCEDURE (v: Set) Equals(y: Object): BOOLEAN

> Indicates whether some other object is "equal to" this one.

> The Object.Equals method implements an equivalence relation:

> - It is reflexive: for any reference value ``x`', ``x.Equals(x)`' should return TRUE.

> - It is symmetric: for any reference values ``x`' and ``y`', ``x.Equals(y)`' should return TRUE if and only if ``y.Equals(x)`' returns TRUE.

> - It is transitive: for any reference values ``x`', ``y`', and ``z`', if ``x.Equals(y)`' returns TRUE and ``y.Equals(z)`' returns TRUE, then ``x.Equals(z)`' should return TRUE.

> - It is consistent: for any reference values ``x`' and ``y`', multiple invocations of ``x.Equals(y)`' consistently return TRUE or consistently return FALSE, provided no information used in equals comparisons on the object is modified.

> - For any non-NIL reference value ``x`', ``x.Equals(NIL)`' should return FALSE.

> The ``Equals`' method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values ``x`' and ``y`', this method returns TRUE if and only if ``x`' and ``y`' refer to the same object (``x=y`' has the value TRUE).

> [Description inherited from Equals]

> Redefines: Equals, Equals, Equals

### HashCode

    PROCEDURE (v: Set) HashCode(): Hash

> Returns a hash code value for the object. This method is supported for the benefit of dictionaries such as those provided by ADT:Dictionary..

> The general contract of Object.HashCode is:

> - Whenever it is invoked on the same object more than once during an execution of an application, the Object.HashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.

> - If two objects are equal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce the same integer result.

> - It is not required that if two objects are unequal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of dictionaries.

> As much as is reasonably practical, the Object.HashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required.)

> [Description inherited from HashCode]

> Redefines: HashCode, HashCode, HashCode

### Load

    PROCEDURE (v: Set) Load(r: Reader)
      RAISES Error;

> Loads data of v from r. Nested record pointers are loaded by calling the type-bound procecdure Reader.ReadObject. This procedure must be symmetric to Object.Store, or data internalization will break, causing undefined object state or program termination.

> Note: When internalizing a file with alien objects, it is possible that the type-bound procedure Object.Load is invoked more than once for a single object. Except for the results of the last call, all duplicates are discarded. Because of this, all changes by this procedure to any program state that is not part of the object v are deprecated.

> Pre-condition: This procedure is either activated by a super call, or from the procedure Reader.ReadObject.

> [Description inherited from Load]

> Redefines: Load, Load

### Store

    PROCEDURE (v: Set) Store(w: Writer)
      RAISES Error;

> Stores data of v to w. Nested record pointers are stored by calling the type-bound procedure Writer.WriteObject. The procedure is not allowed to make any changes to the global state of the program, except for calling the ``Write`' methods of the writer w. Any redefinition of this procedure must include a super call, preferably as the first statement of the procedure body.

> Pre-condition: This procedure is either activated by a super call, or from the procedure Writer.WriteObject.

> [Description inherited from Store]

> Redefines: Store, Store

### ToString

    PROCEDURE (v: Set) ToString(): String

> Returns a string representation of the object. Typically, the string is some form of "natural" representation of the value. For complex objects, it should describe the type and essential attributes of the object. The exact format of the returned value is intentionally left vague.

> [Description inherited from ToString]

> Redefines: ToString, ToString, ToString

Class Detail: String

Field Detail

### value

    FIELD value-: String

Constructor Detail

### NewString

    PROCEDURE NewString(value: String): String

### ParseString

    PROCEDURE ParseString(str: ARRAY OF CHAR): String

Method Detail

### Cmp

    PROCEDURE (v: String) Cmp(str: Object): LONGINT

> Redefines: Cmp

### Equals

    PROCEDURE (v: String) Equals(y: Object): BOOLEAN

> Indicates whether some other object is "equal to" this one.

> The Object.Equals method implements an equivalence relation:

> - It is reflexive: for any reference value ``x`', ``x.Equals(x)`' should return TRUE.

> - It is symmetric: for any reference values ``x`' and ``y`', ``x.Equals(y)`' should return TRUE if and only if ``y.Equals(x)`' returns TRUE.

> - It is transitive: for any reference values ``x`', ``y`', and ``z`', if ``x.Equals(y)`' returns TRUE and ``y.Equals(z)`' returns TRUE, then ``x.Equals(z)`' should return TRUE.

> - It is consistent: for any reference values ``x`' and ``y`', multiple invocations of ``x.Equals(y)`' consistently return TRUE or consistently return FALSE, provided no information used in equals comparisons on the object is modified.

> - For any non-NIL reference value ``x`', ``x.Equals(NIL)`' should return FALSE.

> The ``Equals`' method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values ``x`' and ``y`', this method returns TRUE if and only if ``x`' and ``y`' refer to the same object (``x=y`' has the value TRUE).

> [Description inherited from Equals]

> Redefines: Equals, Equals, Equals

### HashCode

    PROCEDURE (v: String) HashCode(): Hash

> Returns a hash code value for the object. This method is supported for the benefit of dictionaries such as those provided by ADT:Dictionary..

> The general contract of Object.HashCode is:

> - Whenever it is invoked on the same object more than once during an execution of an application, the Object.HashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.

> - If two objects are equal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce the same integer result.

> - It is not required that if two objects are unequal according to the Object.Equals method, then calling the Object.HashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of dictionaries.

> As much as is reasonably practical, the Object.HashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required.)

> [Description inherited from HashCode]

> Redefines: HashCode, HashCode, HashCode

### Load

    PROCEDURE (v: String) Load(r: Reader)
      RAISES Error;

> Loads data of v from r. Nested record pointers are loaded by calling the type-bound procecdure Reader.ReadObject. This procedure must be symmetric to Object.Store, or data internalization will break, causing undefined object state or program termination.

> Note: When internalizing a file with alien objects, it is possible that the type-bound procedure Object.Load is invoked more than once for a single object. Except for the results of the last call, all duplicates are discarded. Because of this, all changes by this procedure to any program state that is not part of the object v are deprecated.

> Pre-condition: This procedure is either activated by a super call, or from the procedure Reader.ReadObject.

> [Description inherited from Load]

> Redefines: Load, Load

### Store

    PROCEDURE (v: String) Store(w: Writer)
      RAISES Error;

> Stores data of v to w. Nested record pointers are stored by calling the type-bound procedure Writer.WriteObject. The procedure is not allowed to make any changes to the global state of the program, except for calling the ``Write`' methods of the writer w. Any redefinition of this procedure must include a super call, preferably as the first statement of the procedure body.

> Pre-condition: This procedure is either activated by a super call, or from the procedure Writer.WriteObject.

> [Description inherited from Store]

> Redefines: Store, Store

### ToString

    PROCEDURE (v: String) ToString(): String

> Returns a string representation of the object. Typically, the string is some form of "natural" representation of the value. For complex objects, it should describe the type and essential attributes of the object. The exact format of the returned value is intentionally left vague.

> [Description inherited from ToString]

> Redefines: ToString, ToString, ToString

Type Detail

### ParseFct

    TYPE ParseFct = (str: ARRAY OF CHAR): Object

Variable Detail

### false

    VAR false-: Boolean

### true

    VAR true-: Boolean

### zeroLongReal

    VAR zeroLongReal-: LongReal