Package wprover
Class CProveField
- java.lang.Object
-
- wprover.CProveField
-
public class CProveField extends java.lang.ObjectCProveField is a class that represents a field for proving mathematical theorems. It handles the display and manipulation of proof steps and conditions.
-
-
Constructor Summary
Constructors Constructor Description CProveField()Default constructor for `CProveField`.CProveField(java.util.Vector ulist)Constructor for `CProveField` with a vector of undo structures.CProveField(java.util.Vector v, boolean head)Constructor for `CProveField` with a vector of conditions and a head flag.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearSelection()Clears the selection of all `CProveText` objects.voiddrag(double dx, double dy)Drags the selected proof text by the specified delta values.voiddraw(java.awt.Graphics2D g2)Draws the proof steps on the specified `Graphics2D` context.voiddraw(java.awt.Graphics2D g2, java.awt.Point p)Draws the proof steps.voiddrawAStep(CProveText cp, java.awt.Point p, java.awt.Graphics2D g2)Draws a single step of the proof for the specified `CProveText` object.voidexpandAll()Expands all proof steps and conditions.CProveTextfd_text(int index)Finds the `CProveText` object at the specified index.CProveTextfindPText(wprover.UndoStruct un)Finds the `CProveText` object for the specified undo structure.CProveTextgetSelect()Gets the currently selected proof text.voidLoad(java.io.DataInputStream in, DrawProcess dp)Loads the state of the `CProveField` from a `DataInputStream`.CProveTextmouseMove(double x, double y)Handles mouse movement events and returns the `CProveText` object at the specified coordinates.voidmove(double x, double y)Moves the proof steps by the specified x and y coordinates.booleannext(DrawProcess dp)Advances to the next proof step.booleannext_prove_step(DrawProcess dp)Advances to the next proof step.CProveTextnext_prove_step(DrawProcess dp, CProveText cpt, CBoolean find)Advances to the next proof step.CProveTextredo_invisible_head(DrawProcess dp)Redoes the invisible head step for the proof.voidreGenerateIndex()Regenerates the index for the proof steps.booleanrun_to_begin(DrawProcess dp)Runs the proof steps to the beginning.booleanrun_to_end(DrawProcess dp)Runs the proof to the end.voidSave(java.io.DataOutputStream out)Saves the state of the `CProveField` to a `DataOutputStream`.voidSavePS(java.io.FileOutputStream fp, int stype)Saves the proof text as a PostScript file.booleansaveText(java.io.DataOutputStream out, int space)Saves the proof text to a `DataOutputStream`.CProveTextselect(double x, double y, boolean on_select)Selects the `CProveText` object at the specified coordinates.voidsetFontSize(int size)Sets the font size for all proof texts.voidsetSelectedUndo(wprover.UndoStruct u, DrawProcess dp)Sets the selected undo step for the proof.voidsetStepRowDefault()Sets the default step row for the proof steps.voidsetXY(int x, int y)Sets the x and y coordinates of the point.booleanundo_default(DrawProcess dp)Undoes the default action for the proof steps.booleanundo_to_head(DrawProcess dp)Undoes the proof steps to the head.
-
-
-
Constructor Detail
-
CProveField
public CProveField()
Default constructor for `CProveField`. Initializes the point and vectors for proof steps and conditions.
-
CProveField
public CProveField(java.util.Vector v, boolean head)Constructor for `CProveField` with a vector of conditions and a head flag. Initializes the point, vectors, and proof text based on the head flag.- Parameters:
v- the vector of conditionshead- the head flag indicating the type of proof field
-
CProveField
public CProveField(java.util.Vector ulist)
Constructor for `CProveField` with a vector of undo structures. Initializes the point and vectors for proof steps and conditions.- Parameters:
ulist- the vector of undo structures
-
-
Method Detail
-
setXY
public void setXY(int x, int y)Sets the x and y coordinates of the point.- Parameters:
x- the x-coordinatey- the y-coordinate
-
drag
public void drag(double dx, double dy)Drags the selected proof text by the specified delta values.- Parameters:
dx- the change in x-coordinatedy- the change in y-coordinate
-
reGenerateIndex
public void reGenerateIndex()
Regenerates the index for the proof steps. Sets the visibility and index of each proof step based on the `HEAD` flag.
-
expandAll
public void expandAll()
Expands all proof steps and conditions. Sets the visibility of each proof text to expanded.
-
draw
public void draw(java.awt.Graphics2D g2)
Draws the proof steps on the specified `Graphics2D` context.- Parameters:
g2- the `Graphics2D` context to draw on
-
setFontSize
public void setFontSize(int size)
Sets the font size for all proof texts.- Parameters:
size- the font size to set
-
getSelect
public CProveText getSelect()
Gets the currently selected proof text.- Returns:
- the selected `CProveText` object
-
undo_to_head
public boolean undo_to_head(DrawProcess dp)
Undoes the proof steps to the head.- Parameters:
dp- the `DrawProcess` context- Returns:
- true if the undo operation was successful
-
run_to_begin
public boolean run_to_begin(DrawProcess dp)
Runs the proof steps to the beginning.- Parameters:
dp- the `DrawProcess` context- Returns:
- true if the operation was successful
-
undo_default
public boolean undo_default(DrawProcess dp)
Undoes the default action for the proof steps.- Parameters:
dp- the `DrawProcess` context- Returns:
- true if the undo operation was successful
-
run_to_end
public boolean run_to_end(DrawProcess dp)
Runs the proof to the end.- Parameters:
dp- the `DrawProcess` context- Returns:
- true if the operation was successful
-
redo_invisible_head
public CProveText redo_invisible_head(DrawProcess dp)
Redoes the invisible head step for the proof.- Parameters:
dp- the `DrawProcess` context- Returns:
- the `CProveText` object that was redone, or null if none was found
-
next
public boolean next(DrawProcess dp)
Advances to the next proof step.- Parameters:
dp- the `DrawProcess` context- Returns:
- true if the operation was successful
-
fd_text
public CProveText fd_text(int index)
Finds the `CProveText` object at the specified index.- Parameters:
index- the index to search for- Returns:
- the `CProveText` object at the specified index, or null if none was found
-
setStepRowDefault
public void setStepRowDefault()
Sets the default step row for the proof steps.
-
next_prove_step
public boolean next_prove_step(DrawProcess dp)
Advances to the next proof step.- Parameters:
dp- the `DrawProcess` context- Returns:
- true if the operation was successful
-
setSelectedUndo
public void setSelectedUndo(wprover.UndoStruct u, DrawProcess dp)Sets the selected undo step for the proof.- Parameters:
u- the `UndoStruct` object to setdp- the `DrawProcess` context
-
findPText
public CProveText findPText(wprover.UndoStruct un)
Finds the `CProveText` object for the specified undo structure.- Parameters:
un- the `UndoStruct` object to search for- Returns:
- the `CProveText` object for the specified undo structure, or null if none was found
-
next_prove_step
public CProveText next_prove_step(DrawProcess dp, CProveText cpt, CBoolean find)
Advances to the next proof step.- Parameters:
dp- the `DrawProcess` contextcpt- the current `CProveText` objectfind- a boolean indicating whether the step was found- Returns:
- the next `CProveText` object, or null if none was found
-
draw
public void draw(java.awt.Graphics2D g2, java.awt.Point p)Draws the proof steps.- Parameters:
g2- the `Graphics2D` context to draw onp- the current position to draw at
-
move
public void move(double x, double y)Moves the proof steps by the specified x and y coordinates.- Parameters:
x- the x-coordinate to move byy- the y-coordinate to move by
-
mouseMove
public CProveText mouseMove(double x, double y)
Handles mouse movement events and returns the `CProveText` object at the specified coordinates.- Parameters:
x- the x-coordinate of the mousey- the y-coordinate of the mouse- Returns:
- the `CProveText` object at the specified coordinates, or null if none is found
-
select
public CProveText select(double x, double y, boolean on_select)
Selects the `CProveText` object at the specified coordinates.- Parameters:
x- the x-coordinate of the selectiony- the y-coordinate of the selectionon_select- a boolean indicating whether the selection is active- Returns:
- the selected `CProveText` object, or null if none is found
-
clearSelection
public void clearSelection()
Clears the selection of all `CProveText` objects.
-
drawAStep
public void drawAStep(CProveText cp, java.awt.Point p, java.awt.Graphics2D g2)
Draws a single step of the proof for the specified `CProveText` object.- Parameters:
cp- the `CProveText` object to drawp- the current position to draw atg2- the `Graphics2D` context to draw on
-
SavePS
public void SavePS(java.io.FileOutputStream fp, int stype) throws java.io.IOExceptionSaves the proof text as a PostScript file.- Parameters:
fp- the `FileOutputStream` to write tostype- the type of save operation- Throws:
java.io.IOException- if an I/O error occurs
-
saveText
public boolean saveText(java.io.DataOutputStream out, int space) throws java.io.IOExceptionSaves the proof text to a `DataOutputStream`.- Parameters:
out- the `DataOutputStream` to write tospace- the amount of space to use for formatting- Returns:
- true if the save operation was successful
- Throws:
java.io.IOException- if an I/O error occurs
-
Save
public void Save(java.io.DataOutputStream out) throws java.io.IOExceptionSaves the state of the `CProveField` to a `DataOutputStream`.- Parameters:
out- the `DataOutputStream` to write to- Throws:
java.io.IOException- if an I/O error occurs
-
Load
public void Load(java.io.DataInputStream in, DrawProcess dp) throws java.io.IOExceptionLoads the state of the `CProveField` from a `DataInputStream`.- Parameters:
in- the `DataInputStream` to read fromdp- the `DrawProcess` context- Throws:
java.io.IOException- if an I/O error occurs
-
-