Class Frame

java.lang.Object
  |
  +--Frame
All Implemented Interfaces:
FILisable, FrameInterface, java.io.Serializable

public class Frame
extends java.lang.Object
implements FrameInterface, java.io.Serializable, FILisable

The class `Frame' represents a frame (an instance of a FrameClass).

See Also:
Serialized Form

Field Summary
static boolean _markFramesAsInputModel
           
protected  int _number
           
static int _numberOfFrames
           
 
Constructor Summary
Frame()
          Constructs this frame.
Frame(FrameClass frameClass)
          Constructs this frame.
Frame(java.lang.String frameClassName)
          Constructs this frame.
 
Method Summary
 void addElementToSlotFiller(Slot aggSlot, java.lang.Object element)
          Adds an element to an aggregation slot filler.
 void addElementToSlotFiller(java.lang.String aggSlotName, java.lang.Object element)
          Adds an element to an aggregation slot filler.
 void aesf(java.lang.String aggSlotName, java.lang.Object element)
          A quick and dirty version of addElementToSlotFiller(String,Object) for brevity.
 void deleteElementFromSlotFiller(Slot aggSlot, java.lang.Object element)
          Deletes an element from an aggregation slot filler.
 void deleteElementFromSlotFiller(java.lang.String aggSlotName, java.lang.Object element)
          Deletes an element from an aggregation slot filler.
 void desf(java.lang.String aggSlotName, java.lang.Object element)
          A quick and dirty version of deleteElementFromSlotFiller(String, Object) for brevity.
 java.lang.String FILise(boolean HTML)
          Returns an FIL reference to this frame.
static void generateFIL(boolean HTML, boolean suppress, java.io.PrintWriter indexHTML)
          Writes all frames in the system to a set of FIL files.
 void generateFIL(java.io.PrintWriter pw, boolean HTML, boolean suppress)
          Writes the frame into an FIL file.
 FrameClass getFrameClass()
          Returns the frame class of this frame.
 int getNumber()
          Returns this frame's instance number (unique to the frame class).
 java.lang.Object getSlotFiller(Slot slot)
          Returns the filler of a given slot.
 java.lang.Object getSlotFiller(java.lang.String slotName)
          Returns the filler of a given slot.
 java.util.ListIterator getSlots()
          Returns an iterator over the filled slots in this frame, in the order that they were filled.
 java.lang.Object gsf(java.lang.String slotName)
          A quick and dirty version of getSlotFiller(String) for brevity.
static void initialise()
          Initialises the Jex subclasses of Frame, after loading the EXPRESS metamodel from EXPRESS/frame_classes.exp.
 boolean isCaseProblemPart()
          Returns true just in case this frame is in the `problem' part of a case.
 boolean isInputModelFrame()
          Returns true just in case this frame is marked as being from an input model (as opposed to from the frame class model, or part of a case).
 boolean isSlotSetDirectly(Slot slot)
          Returns true just in case a given slot in this frame was written directly (i.e.
 void markCaseProblemPart()
          Marks this frame as being in the problem part of a case, recursing for all frames in the slot fillers of this frame.
 void print(java.io.PrintStream ps)
          Prints the frame in human-readable text form.
static void remove(Frame frame)
          Removes a frame from the index of its frame class.
 void setNumber(int number)
          Gives this frame an instance number which is unique to this frame class.
 void setSlotFiller(Slot slot, java.lang.Object filler)
          Fills a given slot with a given value.
 void setSlotFiller(java.lang.String slotName, java.lang.Object filler)
          Fills a given slot with a given value.
 void ssf(java.lang.String slotName, java.lang.Object filler)
          A quick and dirty version of setSlotFiller(String,Object) for brevity.
 java.lang.String toString()
          Returns a string representing this frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_markFramesAsInputModel

public static boolean _markFramesAsInputModel

_numberOfFrames

public static int _numberOfFrames

_number

protected int _number
Constructor Detail

Frame

public Frame()
Constructs this frame. This constructor should only be used when a frame's frame class has not been created yet - namely, when setting up the EXPRESS metamodel). In all other circumstances, the Frame(FrameClass) or Frame(String) constructors should be used.

Frame

public Frame(FrameClass frameClass)
Constructs this frame.
Parameters:
frameClass - The frame class of the frame to be constructed, which specifies the set of slots the frame should have.

Frame

public Frame(java.lang.String frameClassName)
Constructs this frame. The frame class is specified by name for convenience.
Parameters:
frameClassName - The name of the frame class of the frame to be constructed, which specifies the set of slots the frame should have.
Method Detail

initialise

public static void initialise()
Initialises the Jex subclasses of Frame, after loading the EXPRESS metamodel from EXPRESS/frame_classes.exp.

getFrameClass

public FrameClass getFrameClass()
Returns the frame class of this frame.
Specified by:
getFrameClass in interface FrameInterface
Returns:
The frame class of this frame.

getNumber

public int getNumber()
Returns this frame's instance number (unique to the frame class).
Returns:
This frame's instance number.

setNumber

public void setNumber(int number)
Gives this frame an instance number which is unique to this frame class.
Parameters:
An - instance number for this frame.

getSlotFiller

public java.lang.Object getSlotFiller(Slot slot)
Returns the filler of a given slot.
Specified by:
getSlotFiller in interface FrameInterface
Parameters:
slot - The slot whose filler you want to read.
Returns:
The filler of `slot', as held in this frame.

getSlotFiller

public java.lang.Object getSlotFiller(java.lang.String slotName)
                               throws InvalidSlot
Returns the filler of a given slot.
Specified by:
getSlotFiller in interface FrameInterface
Parameters:
slot - The name of the slot whose filler you want to read.
Returns:
The filler of the slot, as held in this frame.
Throws:
InvalidSlot - If the frame does not have a slot of that name (as specified in its frame class).

gsf

public java.lang.Object gsf(java.lang.String slotName)
A quick and dirty version of getSlotFiller(String) for brevity. Catches InvalidSlot exception within rather than throwing it out.
Parameters:
slot - The name of the slot whose filler you want to read.
Returns:
The filler of the slot, as held in this frame.

setSlotFiller

public void setSlotFiller(Slot slot,
                          java.lang.Object filler)
Fills a given slot with a given value. Records this slot as having been written directly.
Specified by:
setSlotFiller in interface FrameInterface
Parameters:
slot - The slot you want to write into.
filler - The filler (value) you want to write into `slot', which must be of the right type for `slot'.

setSlotFiller

public void setSlotFiller(java.lang.String slotName,
                          java.lang.Object filler)
                   throws InvalidSlot
Fills a given slot with a given value.
Specified by:
setSlotFiller in interface FrameInterface
Parameters:
slotName - The name of the slot you want to write into.
filler - The filler (value) you want to write into the slot, which must be of the right type for the slot.
Throws:
InvalidSlot - If the frame does not have that slot (as specified in its frame class).

ssf

public void ssf(java.lang.String slotName,
                java.lang.Object filler)
A quick and dirty version of setSlotFiller(String,Object) for brevity. Catches InvalidSlot exception within rather than throwing it out.
Parameters:
slotName - The name of the slot you want to write into.
filler - The filler (value) you want to write into the slot, which must be of the right type for the slot.

addElementToSlotFiller

public void addElementToSlotFiller(Slot aggSlot,
                                   java.lang.Object element)
Adds an element to an aggregation slot filler.
Parameters:
aggSlot - The aggregation slot you want to add an element to.
element - The element you want to add to the slot filler.

addElementToSlotFiller

public void addElementToSlotFiller(java.lang.String aggSlotName,
                                   java.lang.Object element)
                            throws InvalidSlot
Adds an element to an aggregation slot filler.
Parameters:
aggSlotName - The name of the aggregation slot you want to add an element to.
element - The element you want to add to the slot filler.
Throws:
InvalidSlot - If the frame does not have that slot (as specified in its frame class).

aesf

public void aesf(java.lang.String aggSlotName,
                 java.lang.Object element)
A quick and dirty version of addElementToSlotFiller(String,Object) for brevity. Catches InvalidSlot exception within rather than throwing it out.
Parameters:
aggSlotName - The name of the aggregation slot you want to add an element to.
element - The element you want to add to the slot filler.

deleteElementFromSlotFiller

public void deleteElementFromSlotFiller(Slot aggSlot,
                                        java.lang.Object element)
Deletes an element from an aggregation slot filler.
Parameters:
aggSlot - The aggregation slot you want to delete an element from.
element - The element you want to delete from the slot filler.

deleteElementFromSlotFiller

public void deleteElementFromSlotFiller(java.lang.String aggSlotName,
                                        java.lang.Object element)
                                 throws InvalidSlot
Deletes an element from an aggregation slot filler.
Parameters:
aggSlot - The name of the aggregation slot you want to delete an element from.
element - The element you want to delete from the slot filler.
Throws:
InvalidSlot - If the frame does not have that slot (as specified in its frame class).

desf

public void desf(java.lang.String aggSlotName,
                 java.lang.Object element)
A quick and dirty version of deleteElementFromSlotFiller(String, Object) for brevity. Catches InvalidSlot exception within rather than throwing it out.
Parameters:
aggSlot - The name of the aggregation slot you want to delete an element from.
element - The element you want to delete from the slot filler.

isSlotSetDirectly

public boolean isSlotSetDirectly(Slot slot)
Returns true just in case a given slot in this frame was written directly (i.e. not just filled in automatically as an inverse slot).
Parameters:
slot - A slot in this frame (presumably inverse).
Returns:
Whether `slot' has been written directly in this frame.

getSlots

public java.util.ListIterator getSlots()
Returns an iterator over the filled slots in this frame, in the order that they were filled. (If a slot was filled twice, its position in the iterator is determined by the first time it was filled.)
Specified by:
getSlots in interface FrameInterface
Returns:
An iterator over the filled slots in this frame.

markCaseProblemPart

public void markCaseProblemPart()
Marks this frame as being in the problem part of a case, recursing for all frames in the slot fillers of this frame.

isCaseProblemPart

public boolean isCaseProblemPart()
Returns true just in case this frame is in the `problem' part of a case.
Returns:
Whether this frame is in the `problem' part of a case.

isInputModelFrame

public boolean isInputModelFrame()
Returns true just in case this frame is marked as being from an input model (as opposed to from the frame class model, or part of a case).
Returns:
Whether this frame is from an input model.

toString

public java.lang.String toString()
Returns a string representing this frame. The format is frame-class#number.
Specified by:
toString in interface FrameInterface
Overrides:
toString in class java.lang.Object
Returns:
The string representation of this frame.

print

public void print(java.io.PrintStream ps)
Prints the frame in human-readable text form. Any references are just printed as they are.
Specified by:
print in interface FrameInterface
Parameters:
ps - A stream to print the frame to.

generateFIL

public static void generateFIL(boolean HTML,
                               boolean suppress,
                               java.io.PrintWriter indexHTML)
Writes all frames in the system to a set of FIL files.
Parameters:
HTML - If true, files 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).

generateFIL

public void generateFIL(java.io.PrintWriter pw,
                        boolean HTML,
                        boolean suppress)
Writes the frame into an FIL file. Any references are given corresponding hypertext links if the HTML flag is true.
Parameters:
pw - A file to generate the HTML into (with automatic line flushing enabled).
HTML - If true, file will be augmented with HTML tags.
suppress - If true, only input model frames will be included in the file (i.e. links to the frames representing the frame classes and slots will be suppressed).

FILise

public java.lang.String FILise(boolean HTML)
Returns an FIL reference to this frame.
Specified by:
FILise in interface FILisable
Parameters:
HTML - If true, the FIL will be augmented with HTML tags.
Returns:
A string representing the frame reference in FIL.

remove

public static void remove(Frame frame)
Removes a frame from the index of its frame class.
Parameters:
frame - The frame to remove.