next up previous

13.11.1.4 Examining a Class

This function provides a verbose description of a class including: abstract role (whether direct instances can be created or not), direct superclasses and subclasses, class precedence list, slots with all their facets and sources, and all recognized message-handlers. This function has no return value.

Syntax

(describe-class <class-name>)

Example

CLIPS>
(defclass CHILD (is-a USER)
  (role abstract)
  (multislot parents (cardinality 2 2))
  (slot age (type INTEGER)
            (range 0 18))
  (slot sex (access read-only)
            (type SYMBOL)
            (allowed-symbols male female)
            (storage shared)))
CLIPS>
(defclass BOY (is-a CHILD)
  (slot sex (source composite)
            (default male)))
CLIPS>
(defmessage-handler BOY play ()
   (printout t "The boy is now playing..." crlf))
CLIPS> (describe-class CHILD)
====================================================================
********************************************************************
Abstract: direct instances of this class cannot be created.
Direct Superclasses: USER
Inheritance Precedence: CHILD USER OBJECT
Direct Subclasses: BOY
--------------------------------------------------------------------
SLOTS   : FLD DEF PRP ACC STO MCH SRC VIS CRT OVRD-MSG    SOURCE(S)
parents : MLT STC INH RW  LCL RCT EXC PRV NIL put-parents CHILD
age     : SGL STC INH RW  LCL RCT EXC PRV NIL put-age     CHILD
sex     : SGL STC INH  R  SHR RCT EXC PRV NIL NIL         CHILD
Constraint information for slots:
SLOTS   : SYM STR INN INA EXA FTA INT FLT
parents :  +   +   +   +   +   +   +   +  RNG:[-oo..+oo] CRD:[2..2]
age     :                          +      RNG:[0..18]
sex     :  #
-------------------------------------------------------------------
Recognized message-handlers:
init primary in class USER
delete primary in class USER
print primary in class USER
direct-modify primary in class USER
message-modify primary in class USER
direct-duplicate primary in class USER
message-duplicate primary in class USER
********************************************************************
====================================================================
CLIPS>

The following table explains the fields and their possible values in the slot descriptions:


Field        Values          Explanation

FLD          SGL/MLT         Field type (singlefield or multifield)

    DEF        STC/DYN/NIL   Default value (static, dynamic or none)

    PRP          INH/NIL     Propagation to subclasses (Inheritable or not
                             inheritable)

    ACC         RW/R/INT     Access (readwrite, readonly or initializeonly)

    STO          LCL/SHR     Storage (local or shared)

    MCH          RCT/NIL     Patternmatch (reactive or nonreactive)

    SRC          CMP/EXC     Source type (composite or exclusive)

    VIS          PUB/PRV     Visibility (public or private)

    CRT        R/W/RW/NIL    Automatically created accessors (read, write,
                             read-write or none)

  OVRD-MSG   <message-name>  Name of message sent for slotoverrides in
                             makeinstance, etc.

SOURCE(S)    <class-name>+   Source of slot (more than one class for composite)



In the constraint information summary for the slots, each of the columns shows one of the primitive data types . A + in the column means that any value of that type is allowed in the slot. A # in the column means that some values of that type are allowed in the slot. Range and cardinality constraints are displayed to the far right of each slot's row. The following table explains the abbreviations used in the constraint information summary for the slots:


Abbreviation      Explanation

SYM               Symbol

       STR              String

       INN          Instance Name

       INA         Instance Address

       EXA         External Address

       FTA           Fact Address

       INT             Integer

       FLT              Float

       RNG              Range

CRD               Cardinality





next up previous