*skip-deleted-unit-instance-class-change*GBBopen Corecheck-for-deleted-instancechange-classGoTo Top

change-class   instance new-class &key &allow-other-keys => changed-instance[Generic Function]

Purpose
Change the class of an instance to new-class.

Method signatures

change-class  :around (instance standard-object) (new-class standard-unit-class) &key &allow-other-keys => instance
change-class  :around (instance standard-object) (new-class standard-unit-class) &key &allow-other-keys => instance
change-class  :before (instance standard-unit-instance) (new-class standard-class) &key &allow-other-keys
change-class  :after (instance standard-unit-instance) (new-class standard-unit-class) &key &allow-other-keys
change-class  :after (instance standard-object) (new-class standard-unit-class) &key &allow-other-keys

Package   :gbbopen

Module   :gbbopen-core

Arguments and values

instance     A standard-object instance
new-class     A class designator
changed-instance     A standard-object instance

Returns
The destructively modified instance.

Events
If instance is a unit instance, a change-instance-class-event is signaled at the start of the class-change process. If new-class is a unit class, an instance-changed-class-event is signaled when the class change has been completed.

The following events may also be signaled:

Errors
The existing or supplied instance name of instance is identical to the instance name of an existing unit instance of new-class.

Description
When new-class is a unit class, an instance-name conflict with an existing unit instance of new-class must be avoided. If the old class of instance and new-class are both unit classes that use the global instance-name counter, the old instance-name value can be retained safetly. If new-class is a unit class with a class-based counter, specifying a new instance-name value (using next-class-instance-number) is recommended.

When the old class and new-class are both unit classes and no space-instances value is supplied to change-class, the changed instance remains on all space instances that allow new-class unit instances. In addition, instance is also added to all space instances defined as initial-space-instances for new-class. If a space-instances value is supplied, instance is removed from all space instances and then added to the supplied space instances.

See also
    define-unit-class
    make-duplicate-instance-changing-class
    next-class-instance-number

Example
Change the class of unit instance hyp from probable-hyp to rejected-hyp:

  > (change-class hyp 'rejected-hyp 
      :instance-name (next-class-instance-number 'rejected-hyp))
  #<rejected-hyp 1409 (896 388) .68>
  >
Note that the :instance-name initarg can be eliminated if both the old and new classes for hyp are using the global instance-name counter.


The GBBopen Project


*skip-deleted-unit-instance-class-change*GBBopen Corecheck-for-deleted-instancechange-classGoTo Top