Pandora
Class ProofBox

java.lang.Object
  extended by Pandora.ProofItem
      extended by Pandora.ProofBox
All Implemented Interfaces:
java.awt.event.MouseListener, java.io.Serializable, java.util.EventListener

public class ProofBox
extends ProofItem
implements java.awt.event.MouseListener

Implements a box in a proof.
Extends ProofItem, so a proof is made up of a list of ProofItems.
Contains a linked list of ProofItems, which make up the lines of the proof in the box.

See Also:
Serialized Form

Field Summary
 int skolem
           
 
Constructor Summary
ProofBox(ProofLine goal, ProofWindow parentWindow, ProofBox parentBox)
          Constructs a ProofBox (with Goal).
ProofBox(ProofWindow parentWindow)
          Constructs a ProofBox (Outer).
ProofBox(ProofWindow parentWindow, ProofBox parentBox)
          Constructs a ProofBox.
 
Method Summary
 void addItem(int index, ProofItem item)
          Adds ProofItem to specified position in LinkedList of ProofItems.
 void addItem(ProofItem item)
          Adds ProofItem to the LinkedList of ProofItems in the ProofBox.
 void addSkolems(ProofBox parBox, PanSignature temp)
           
 void addToSignature(java.util.List<Atom> newAtoms)
          Adds the given list of Atoms to the signature of the ProofBox.
 void cleanup()
          Removes the empty line before a goal line when that goal has become proved but there are still goals remaining in the proof.
 void deselectAll()
          Used to deselect the items once a rule has been executed or the rule failed to execute.
 javax.swing.JPanel display()
          Returns the ProofBox within a JPanel.
 boolean getDisplayBorder()
          Returns true is the box is displayed.
 boolean getDisplayItems()
          Returns true if box's ProofItems are not hidden, otherwise false.
 int getIndex(ProofItem current)
          Returns the index of a given ProofItem
 PanSignature getMainSignature()
           
 ProofBox getNextBox()
          Returns the next ProofBox in the list.
 ProofBox getOlderSiblingBox()
          Returns the ProofBox that references this ProofBox as its nextBox.
 java.util.List<ProofItem> getProofItems()
          Returns the list of ProofItems contained in the box.
 PanSignature getSignature()
          Returns the signature of the ProofBox.
 boolean hasNextBox()
          A ProofBox item in a proof may be a list of ProofBoxes.
 boolean isProved()
           
 void mouseClicked(java.awt.event.MouseEvent e)
          Responds to a ProofBox with a mouse listener being clicked.
 ProofItem next(ProofItem current)
          Returns the next ProofItem in the ProofItems list
 int recalculateLineNum(int line)
          Recalculates the line numbers within the ProofBox.
 void regenerate(ProofBox outsideBox, ProofWindow parentWindow)
          Copies (this) ProofBox to the given outsideBox.
 void removeItem(int index)
          Removes the specified item from the list of ProofItems
 void setBoxStarted(boolean option)
          Sets if the box has been started or not
 void setDashedBox(boolean option)
          Controls the appearance of the ProofBox.
 void setDisplayBorder(boolean option)
          Used to set the display options of the ProofBox.
 void setDisplayItems(boolean option)
          Controls if the content of the ProofBox should be displayed.
 ProofBox setNextBox()
          Creates a new ProofBox to follow the current ProofBox and returns this new sibling ProofBox.
 void setOlderSiblingBox(ProofBox sibling)
          Sets the olderSiblingBox of this ProofBox as the ProofBox that refernces this ProofBox as its nextBox.
 
Methods inherited from class Pandora.ProofItem
displayColour, getParentBox, getParentWindow, mouseEntered, mouseExited, mousePressed, mouseReleased, setParentBox
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mouseEntered, mouseExited, mousePressed, mouseReleased
 

Field Detail

skolem

public int skolem
Constructor Detail

ProofBox

public ProofBox(ProofWindow parentWindow)
Constructs a ProofBox (Outer).
Used to construct the outer ProofBox.

Parameters:
parentWindow - The ProofWindow that the box is inside.

ProofBox

public ProofBox(ProofWindow parentWindow,
                ProofBox parentBox)
Constructs a ProofBox.
Used to construct a ProofBox inside a parent ProofBox.

Parameters:
parentWindow - The ProofWindow that the box is inside.
parentBox - The outer ProofBox that contains this ProofBox.

ProofBox

public ProofBox(ProofLine goal,
                ProofWindow parentWindow,
                ProofBox parentBox)
Constructs a ProofBox (with Goal).
Used to construct a ProofBox inside a parent ProofBox with an initialised goal.
Not currently used in Pandora implementation.

Parameters:
goal - The goal of the ProofBox
parentWindow - The ProofWindow that the box is inside.
parentBox - The outer ProofBox that contains this ProofBox.
Method Detail

getNextBox

public ProofBox getNextBox()
Returns the next ProofBox in the list.


setNextBox

public ProofBox setNextBox()
Creates a new ProofBox to follow the current ProofBox and returns this new sibling ProofBox.


hasNextBox

public boolean hasNextBox()
A ProofBox item in a proof may be a list of ProofBoxes.


getOlderSiblingBox

public ProofBox getOlderSiblingBox()
Returns the ProofBox that references this ProofBox as its nextBox.


setOlderSiblingBox

public void setOlderSiblingBox(ProofBox sibling)
Sets the olderSiblingBox of this ProofBox as the ProofBox that refernces this ProofBox as its nextBox.


setBoxStarted

public void setBoxStarted(boolean option)
Sets if the box has been started or not


isProved

public boolean isProved()

getDisplayBorder

public boolean getDisplayBorder()
Returns true is the box is displayed.
Returns false when the box has been compressed.


setDisplayBorder

public void setDisplayBorder(boolean option)
Used to set the display options of the ProofBox.

Parameters:
option - Box is displayed when true, otherwise hidden

getDisplayItems

public boolean getDisplayItems()
Returns true if box's ProofItems are not hidden, otherwise false.


setDisplayItems

public void setDisplayItems(boolean option)
Controls if the content of the ProofBox should be displayed.

Parameters:
option - Box is displayed when true, otherwise hidden

setDashedBox

public void setDashedBox(boolean option)
Controls the appearance of the ProofBox.
i.e. whether the ProofBox has dashed or solid borders.

Parameters:
option - A dashed line ProofBox is displayed when true

getProofItems

public java.util.List<ProofItem> getProofItems()
Returns the list of ProofItems contained in the box.


recalculateLineNum

public int recalculateLineNum(int line)
Recalculates the line numbers within the ProofBox.

Specified by:
recalculateLineNum in class ProofItem
Parameters:
line - The value of the first line in the ProofBox

next

public ProofItem next(ProofItem current)
Returns the next ProofItem in the ProofItems list

Parameters:
current - current ProofItem

getIndex

public int getIndex(ProofItem current)
Returns the index of a given ProofItem

Parameters:
current - current ProofItem

addItem

public void addItem(ProofItem item)
Adds ProofItem to the LinkedList of ProofItems in the ProofBox.
Appends the item to the end of List.

Parameters:
item - ProofItem to be added

addItem

public void addItem(int index,
                    ProofItem item)
Adds ProofItem to specified position in LinkedList of ProofItems.

Parameters:
index - Position to add
item - ProofItem to be added

removeItem

public void removeItem(int index)
Removes the specified item from the list of ProofItems

Parameters:
index - Index of ProofItem to be removed

addSkolems

public void addSkolems(ProofBox parBox,
                       PanSignature temp)

addToSignature

public void addToSignature(java.util.List<Atom> newAtoms)
Adds the given list of Atoms to the signature of the ProofBox.
Only Atoms not already in the signature are added to the signture.

Parameters:
newAtoms - the atoms to be added to the signature

getSignature

public PanSignature getSignature()
Returns the signature of the ProofBox.


getMainSignature

public PanSignature getMainSignature()

deselectAll

public void deselectAll()
Used to deselect the items once a rule has been executed or the rule failed to execute.


display

public javax.swing.JPanel display()
Returns the ProofBox within a JPanel.

Specified by:
display in class ProofItem

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Responds to a ProofBox with a mouse listener being clicked.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class ProofItem
Parameters:
e - the object with a mouse listener that was clicked

cleanup

public void cleanup()
Removes the empty line before a goal line when that goal has become proved but there are still goals remaining in the proof.


regenerate

public void regenerate(ProofBox outsideBox,
                       ProofWindow parentWindow)
Copies (this) ProofBox to the given outsideBox.
It is recreated to ensure ActionListeners function.

Parameters:
outsideBox - destination of regenerated ProofBox
parentWindow - window which the current and new ProofBox belong to