## RECLASS Change class of objects

The dyadic system function RECLASS allows you to change the class of one or more object instances, provided these are user-defined APL objects.

The left argument should be either a single class reference, or a class name as a character vector. The right argument should be an array of object instances to be converted to the class specified in the left argument.

If the instances being reclassified contain non-default property values, these will be deleted unless they are also valid in the new class.

The main occasion when RECLASS is useful is if you have modified the class hierarchy. For example, you might have a class `Car` which inherits from `Vehicle`. You now decide you would like to create new classes `SportsCar` and `FamilyCar`, and change the class of your existing `Car` objects. To do this, you can use INSTANCES to find all instances of `Car` in the workspace, and change their class according to some criterion which you set:

          AllCars  1 INSTANCES Car
          AllCars.TopSpeed
    130 135 143 120 91 141 117 123 98 84 135 155 111 122
          SportsCar RECLASS ((AllCars.TopSpeed) > 140)/AllCars
          FamilyCar RECLASS ((AllCars.TopSpeed)  140)/AllCars
          AllCars
    [FamilyCar] [FamilyCar] [SportsCar] [FamilyCar] [FamilyCar] [SportsCar]
          [FamilyCar] [FamilyCar] [FamilyCar] [FamilyCar] [FamilyCar] [SportsCar]
          [FamilyCar] [FamilyCar]

Topic: APLX Help : Help on APL language : System Functions & Variables : RECLASS Change class of objects

[ Previous | Next | Contents | Index ]