Class FrameClass

java.lang.Object
  |
  +--FrameClass
All Implemented Interfaces:
java.io.Serializable

public class FrameClass
extends java.lang.Object
implements java.io.Serializable

The class `FrameClass' represents a class of frames, serving to classify them and to specify the slots they should have.

See Also:
Serialized Form

Constructor Summary
FrameClass(jex.Entity fcEntity, jex.Schema frameClassSchema)
          Constructs this frame class by plugging in the given Jex Entity object which is taken to represent it (it does so by copying the reference, which is maximally efficient, but the client should not then alter the Entity directly, as that would compromise the integrity of the frame).
 
Method Summary
 void addInstance(Frame frame)
          Adds the given frame to the list of instances of this FrameClass.
 boolean anyInputModelFrames()
          Returns true just in case this frame class has any instance frames from the actual input model.
static void createFrameClasses(jex.Schema schema)
          Create a FrameClass for every entity in a given schema.
 void generateFILforInstances(boolean HTML, boolean suppress, java.io.PrintWriter indexHTML)
          Writes all instances of this frame class into a FIL file, called <frame-class>.fil.
static java.util.Enumeration getAllFrameClasses()
          Returns all the frame classes in the system.
 Frame getClassFrame()
          Delivers up the underlying frame of this frame class.
 java.util.Vector getInstances()
          Returns the instances of this frame class that have been created in the program's lifetime.
 java.lang.String getName()
          Returns the name of this frame class.
 Slot getSlot(java.lang.String slotName)
          Looks up the slot with the given name.
 java.util.Vector getSlots()
          Delivers up the slots in this frame.
 java.util.Vector getSubClasses()
          Returns the subclasses of this frame class.
 java.util.Vector getSuperClasses()
          Returns the superclasses of this frame class.
 boolean isAbstract()
          Returns true just in case this frame class is abstract (i.e.
static FrameClass lookup(jex.Entity frameClassEntity, jex.Schema frameClassSchema)
          Looks up the frame class corresponding to the given entity, creating such a frame class if it doesn't exist yet.
static FrameClass lookup(java.lang.String frameClassName)
          Looks up the frame class with the given name.
static FrameClass lookup(java.lang.String frameClassName, jex.Schema frameClassSchema)
          Looks up the frame class with the given name.
static FrameClass lookupX(java.lang.String frameClassName)
          Looks up the frame class with the given name, throwing an exception if no such frame class exists.
static void readClass(java.io.ObjectInput oi)
          Deserialises the static data members (class variables) of FrameClass.
 void removeInstance(Frame frame)
          Removes the given frame from the list of instances of this FrameClass.
 boolean subsumes(FrameClass subClass)
          Does this frame class subsume another? Returns true just in case the given frame class is equal to or a subclass of this one.
 java.lang.String toString()
          Returns a string representation of this frame class.
static void writeClass(java.io.ObjectOutput oo)
          Serialises the static data members (class variables) of FrameClass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FrameClass

public FrameClass(jex.Entity fcEntity,
                  jex.Schema frameClassSchema)
Constructs this frame class by plugging in the given Jex Entity object which is taken to represent it (it does so by copying the reference, which is maximally efficient, but the client should not then alter the Entity directly, as that would compromise the integrity of the frame).
Parameters:
fcEntity - A Jex Entity object to wrap in this frame.
frameClassSchema - The EXPRESS schema in which this frame class is defined, in case it has any superclasses which haven't been constructed yet.
Method Detail

getClassFrame

public Frame getClassFrame()
Delivers up the underlying frame of this frame class.
Returns:
The class frame representing this frame class.

getName

public java.lang.String getName()
Returns the name of this frame class.
Returns:
The name of this frame class.

isAbstract

public boolean isAbstract()
Returns true just in case this frame class is abstract (i.e. cannot be directly instantiated).
Returns:
Whether this frame class is abstract.

getSubClasses

public java.util.Vector getSubClasses()
Returns the subclasses of this frame class.
Returns:
The subclasses of this frame class.

getSuperClasses

public java.util.Vector getSuperClasses()
Returns the superclasses of this frame class.
Returns:
The superclasses of this frame class.

subsumes

public boolean subsumes(FrameClass subClass)
Does this frame class subsume another? Returns true just in case the given frame class is equal to or a subclass of this one.
Parameters:
subClass - The frame class to test whether it is a subclass of this one.
Returns:
Whether this frame class does subsume `subClass'.

getSlots

public java.util.Vector getSlots()
Delivers up the slots in this frame.
Returns:
A vector of the slots in this frame.

getInstances

public java.util.Vector getInstances()
Returns the instances of this frame class that have been created in the program's lifetime.
Returns:
A vector of frames that are instances of this frame class.

anyInputModelFrames

public boolean anyInputModelFrames()
Returns true just in case this frame class has any instance frames from the actual input model.
Returns:
Whether this frame class has any input model frames.

addInstance

public void addInstance(Frame frame)
                 throws InvalidFrameClass
Adds the given frame to the list of instances of this FrameClass.
Parameters:
frame - The instance frame to add (must be of this frame class).
Throws:
InvalidFrameClass - If the given frame is not of this frame class!

removeInstance

public void removeInstance(Frame frame)
                    throws InvalidFrameClass
Removes the given frame from the list of instances of this FrameClass.
Parameters:
frame - The instance frame to remove (must be of this frame class).
Throws:
InvalidFrameClass - If the given frame is not of this frame class!

toString

public java.lang.String toString()
Returns a string representation of this frame class.
Overrides:
toString in class java.lang.Object
Returns:
The string representation of this frame class.

getSlot

public Slot getSlot(java.lang.String slotName)
             throws InvalidSlot
Looks up the slot with the given name.
Parameters:
slotName - The name of the slot to return.
Returns:
The Slot object whose name is `slotName'.
Throws:
InvalidSlot - If the frame class does not have a slot of that name.

generateFILforInstances

public void generateFILforInstances(boolean HTML,
                                    boolean suppress,
                                    java.io.PrintWriter indexHTML)
Writes all instances of this frame class into a FIL file, called <frame-class>.fil.
Parameters:
HTML - If true, the file will be augmented with HTML tags and have the extension .html instead of .fil.
suppress - If true, only input model frames will be included in the file (i.e. frame class model frames and frames that are part of cases will be excluded).
indexHTML - The PrintWriter for index.html (optional).

createFrameClasses

public static void createFrameClasses(jex.Schema schema)
Create a FrameClass for every entity in a given schema.
Parameters:
schema - The schema.

getAllFrameClasses

public static java.util.Enumeration getAllFrameClasses()
Returns all the frame classes in the system.
Returns:
An enumeration of all the frame classes in the system.

lookup

public static FrameClass lookup(java.lang.String frameClassName)
Looks up the frame class with the given name. A quick and convenient method which assumes that the frame class of that name (already) exists - if not, it will report an error and exit from within.
Parameters:
frameClassName - The name of the frame class to return.
Returns:
The FrameClass object whose name is `frameClassName'.
See Also:
lookup(String,Schema), lookupX(String)

lookupX

public static FrameClass lookupX(java.lang.String frameClassName)
                          throws FrameClassDoesNotExist
Looks up the frame class with the given name, throwing an exception if no such frame class exists.
Parameters:
frameClassName - The name of the frame class to return.
Returns:
The FrameClass object whose name is `frameClassName'.
Throws:
FrameClassDoesNotExist - If no frame class of that name exists already.
See Also:
lookup(String), lookup(String,Schema)

lookup

public static FrameClass lookup(java.lang.String frameClassName,
                                jex.Schema frameClassSchema)
                         throws FrameClassDoesNotExist
Looks up the frame class with the given name. A more cumbersome version of the lookup method, for use when the frame class of that name may not have been constructed yet. If the frame class does not exist, it tries to construct it, looking up the entity of that name in the given EXPRESS schema. Failing that, it throws a FrameClassDoesNotExist exception.
Parameters:
frameClassName - The name of the frame class to return.
frameClassSchema - The EXPRESS model in which `frameClassName' is defined, in case that frame class hasn't been constructed yet.
Returns:
The FrameClass object whose name is `frameClassName'.
Throws:
FrameClassDoesNotExist - If no frame class of that name exists already, and there is no entity of that name in the frame class schema either.
See Also:
lookup(String)

lookup

public static FrameClass lookup(jex.Entity frameClassEntity,
                                jex.Schema frameClassSchema)
Looks up the frame class corresponding to the given entity, creating such a frame class if it doesn't exist yet.
Parameters:
frameClassEntity - The entity of the frame class to return.
frameClassSchema - The EXPRESS model in which `frameClassName' is defined, in case that frame class hasn't been constructed yet.
Returns:
The FrameClass object constructed from `frameClassEntity'.

writeClass

public static void writeClass(java.io.ObjectOutput oo)
                       throws java.io.IOException
Serialises the static data members (class variables) of FrameClass.
Parameters:
oo - An output stream to save the class data to.
Throws:
java.io.IOException - If an I/O exception occurs.

readClass

public static void readClass(java.io.ObjectInput oi)
                      throws java.io.IOException
Deserialises the static data members (class variables) of FrameClass.
Parameters:
oi - An input stream to save the class data to.
Throws:
java.io.IOException - If an I/O exception occurs.