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
    RT0
 
Class List
Boolean
LongInt
LongReal
ObjectThis is the base type for all boxed versions of Oberon-2 values.
Set
String
Class Summary: Boolean [Detail]
  +---RT0.Object
       |
       +---Object.Object
            |
            +---ADT:Storable.Object
                 |
                 +---Object:Boxed.Object
                      |
                      +--Object:Boxed.Boolean
Field Summary
value-: BOOLEAN

          
Constructor Summary
NewBoolean(BOOLEAN): Boolean

          Deprecated.
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.
INIT(BOOLEAN)

          
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 RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode

From ADT:Storable.Object:

          Load, Store

From Object:Boxed.Object:

          Cmp, ToString

 
Class Summary: LongInt [Detail]
  +---RT0.Object
       |
       +---Object.Object
            |
            +---ADT:Storable.Object
                 |
                 +---Object:Boxed.Object
                      |
                      +--Object:Boxed.LongInt
Field Summary
value-: LONGINT

          
Constructor Summary
NewLongInt(LONGINT): LongInt

          Deprecated.
ParseLongInt(ARRAY OF CHAR): LongInt

          
Method Summary
Add(LongInt): LongInt

          
Cmp(Object): LONGINT

          
Div(LongInt): LongInt

          
Equals(Object): BOOLEAN

          Indicates whether some other object is "equal to" this one.
HashCode(): Hash

          Returns a hash code value for the object.
INIT(LONGINT)

          
Load(Reader)

          Loads data of v from r.
Mod(LongInt): LongInt

          
Mul(LongInt): LongInt

          
Neg(): LongInt

          
Sign(): LONGINT

          
Store(Writer)

          Stores data of v to w.
Sub(LongInt): LongInt

          
ToString(): STRING

          Returns a string representation of the object.
Inherited Methods

From RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode

From ADT:Storable.Object:

          Load, Store

From Object:Boxed.Object:

          Cmp, ToString

 
Class Summary: LongReal [Detail]
  +---RT0.Object
       |
       +---Object.Object
            |
            +---ADT:Storable.Object
                 |
                 +---Object:Boxed.Object
                      |
                      +--Object:Boxed.LongReal
Field Summary
value-: LONGREAL

          
Constructor Summary
NewLongReal(LONGREAL): LongReal

          Deprecated.
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.
INIT(LONGREAL)

          
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 RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode

From ADT:Storable.Object:

          Load, Store

From Object:Boxed.Object:

          Cmp, ToString

 
Class Summary: Object [Detail]
  +---RT0.Object
       |
       +---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 RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode, ToString

From ADT:Storable.Object:

          Load, Store

 
Class Summary: Set [Detail]
  +---RT0.Object
       |
       +---Object.Object
            |
            +---ADT:Storable.Object
                 |
                 +---Object:Boxed.Object
                      |
                      +--Object:Boxed.Set
Field Summary
value-: SET

          
Constructor Summary
NewSet(SET): Set

          Deprecated.
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.
INIT(SET)

          
Load(Reader)

          Loads data of v from r.
Store(Writer)

          Stores data of v to w.
ToLongInt(): LONGINT

          
ToString(): STRING

          Returns a string representation of the object.
Inherited Methods

From RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode

From ADT:Storable.Object:

          Load, Store

From Object:Boxed.Object:

          Cmp, ToString

 
Class Summary: String [Detail]
  +---RT0.Object
       |
       +---Object.Object
            |
            +---ADT:Storable.Object
                 |
                 +---Object:Boxed.Object
                      |
                      +--Object:Boxed.String
Field Summary
value-: STRING

          
Constructor Summary
NewString(STRING): String

          Deprecated.
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.
INIT(STRING)

          
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 RT0.Object:

          Finalize

From Object.Object:

          Equals, HashCode

From ADT:Storable.Object:

          Load, Store

From Object:Boxed.Object:

          Cmp, ToString

 
Type Summary
ParseFct = (ARRAY OF CHAR): Object

          
Procedure Summary
BooleanToString(BOOLEAN): STRING

          Equivalent to calling NewBoolean with value, and then Object.ToString on the result.
IntToString(LONGINT): STRING

          Equivalent to calling NewLongInt with value, and then Object.ToString on the result.
LongRealToString(LONGREAL): STRING

          Equivalent to calling NewLongReal with value, and then Object.ToString on the result.
SetToString(SET): STRING

          Equivalent to calling NewSet with value, and then Object.ToString on the result.
Variable Summary
false-: Boolean

          
oneLongInt-: LongInt

          
oneLongReal-: LongReal

          
true-: Boolean

          
zeroLongInt-: LongInt

          
zeroLongReal-: LongReal

          

Class Detail: Boolean
Field Detail

value

FIELD value-: BOOLEAN
Constructor Detail

NewBoolean

PROCEDURE NewBoolean(value: BOOLEAN): Boolean

Deprecated. Use NEW(Boolean, ...) instead.


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:

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:

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


INIT

PROCEDURE (v: Boolean) INIT(value: BOOLEAN)

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: LongInt
Field Detail

value

FIELD value-: LONGINT
Constructor Detail

NewLongInt

PROCEDURE NewLongInt(val: LONGINT): LongInt

Deprecated. Use NEW(Longint, ...) instead.


ParseLongInt

PROCEDURE ParseLongInt(s: ARRAY OF CHAR): LongInt
Method Detail

Add

PROCEDURE (v: LongInt) Add(right: LongInt): LongInt

Cmp

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

Redefines: Cmp


Div

PROCEDURE (v: LongInt) Div(right: LongInt): LongInt

Equals

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

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

The Object.Equals method implements an equivalence relation:

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: LongInt) 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:

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


INIT

PROCEDURE (v: LongInt) INIT(val: LONGINT)

Load

PROCEDURE (v: LongInt) 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


Mod

PROCEDURE (v: LongInt) Mod(right: LongInt): LongInt

Mul

PROCEDURE (v: LongInt) Mul(right: LongInt): LongInt

Neg

PROCEDURE (v: LongInt) Neg(): LongInt

Sign

PROCEDURE (v: LongInt) Sign(): LONGINT

Store

PROCEDURE (v: LongInt) 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: LongInt) Sub(right: LongInt): LongInt

ToString

PROCEDURE (v: LongInt) 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

Deprecated. Use NEW(LongReal, ...) instead.


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:

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:

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


INIT

PROCEDURE (v: LongReal) INIT(val: LONGREAL)

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

Deprecated. Use NEW(Set, ...) instead.

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:

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:

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


INIT

PROCEDURE (v: Set) INIT(value: SET)

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


ToLongInt

PROCEDURE (v: Set) ToLongInt(): LONGINT

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

Deprecated. Use NEW(String, ...) instead.


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:

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:

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


INIT

PROCEDURE (v: String) INIT(value: STRING)

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
Procedure Detail

BooleanToString

PROCEDURE BooleanToString(value: BOOLEAN): STRING

Equivalent to calling NewBoolean with value, and then Object.ToString on the result.


IntToString

PROCEDURE IntToString(value: LONGINT): STRING

Equivalent to calling NewLongInt with value, and then Object.ToString on the result.


LongRealToString

PROCEDURE LongRealToString(value: LONGREAL): STRING

Equivalent to calling NewLongReal with value, and then Object.ToString on the result.


SetToString

PROCEDURE SetToString(value: SET): STRING

Equivalent to calling NewSet with value, and then Object.ToString on the result.

Variable Detail

false

VAR false-: Boolean

oneLongInt

VAR oneLongInt-: LongInt

oneLongReal

VAR oneLongReal-: LongReal

true

VAR true-: Boolean

zeroLongInt

VAR zeroLongInt-: LongInt

zeroLongReal

VAR zeroLongReal-: LongReal