Package wprover

Class CProveField


  • public class CProveField
    extends java.lang.Object
    CProveField 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
      void clearSelection()
      Clears the selection of all `CProveText` objects.
      void drag​(double dx, double dy)
      Drags the selected proof text by the specified delta values.
      void draw​(java.awt.Graphics2D g2)
      Draws the proof steps on the specified `Graphics2D` context.
      void draw​(java.awt.Graphics2D g2, java.awt.Point p)
      Draws the proof steps.
      void drawAStep​(CProveText cp, java.awt.Point p, java.awt.Graphics2D g2)
      Draws a single step of the proof for the specified `CProveText` object.
      void expandAll()
      Expands all proof steps and conditions.
      CProveText fd_text​(int index)
      Finds the `CProveText` object at the specified index.
      CProveText findPText​(wprover.UndoStruct un)
      Finds the `CProveText` object for the specified undo structure.
      CProveText getSelect()
      Gets the currently selected proof text.
      void Load​(java.io.DataInputStream in, DrawProcess dp)
      Loads the state of the `CProveField` from a `DataInputStream`.
      CProveText mouseMove​(double x, double y)
      Handles mouse movement events and returns the `CProveText` object at the specified coordinates.
      void move​(double x, double y)
      Moves the proof steps by the specified x and y coordinates.
      boolean next​(DrawProcess dp)
      Advances to the next proof step.
      boolean next_prove_step​(DrawProcess dp)
      Advances to the next proof step.
      CProveText next_prove_step​(DrawProcess dp, CProveText cpt, CBoolean find)
      Advances to the next proof step.
      CProveText redo_invisible_head​(DrawProcess dp)
      Redoes the invisible head step for the proof.
      void reGenerateIndex()
      Regenerates the index for the proof steps.
      boolean run_to_begin​(DrawProcess dp)
      Runs the proof steps to the beginning.
      boolean run_to_end​(DrawProcess dp)
      Runs the proof to the end.
      void Save​(java.io.DataOutputStream out)
      Saves the state of the `CProveField` to a `DataOutputStream`.
      void SavePS​(java.io.FileOutputStream fp, int stype)
      Saves the proof text as a PostScript file.
      boolean saveText​(java.io.DataOutputStream out, int space)
      Saves the proof text to a `DataOutputStream`.
      CProveText select​(double x, double y, boolean on_select)
      Selects the `CProveText` object at the specified coordinates.
      void setFontSize​(int size)
      Sets the font size for all proof texts.
      void setSelectedUndo​(wprover.UndoStruct u, DrawProcess dp)
      Sets the selected undo step for the proof.
      void setStepRowDefault()
      Sets the default step row for the proof steps.
      void setXY​(int x, int y)
      Sets the x and y coordinates of the point.
      boolean undo_default​(DrawProcess dp)
      Undoes the default action for the proof steps.
      boolean undo_to_head​(DrawProcess dp)
      Undoes the proof steps to the head.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 conditions
        head - 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-coordinate
        y - 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-coordinate
        dy - 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 set
        dp - 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` context
        cpt - the current `CProveText` object
        find - 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 on
        p - 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 by
        y - 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 mouse
        y - 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 selection
        y - the y-coordinate of the selection
        on_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 draw
        p - the current position to draw at
        g2 - the `Graphics2D` context to draw on
      • SavePS

        public void SavePS​(java.io.FileOutputStream fp,
                           int stype)
                    throws java.io.IOException
        Saves the proof text as a PostScript file.
        Parameters:
        fp - the `FileOutputStream` to write to
        stype - 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.IOException
        Saves the proof text to a `DataOutputStream`.
        Parameters:
        out - the `DataOutputStream` to write to
        space - 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.IOException
        Saves 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.IOException
        Loads the state of the `CProveField` from a `DataInputStream`.
        Parameters:
        in - the `DataInputStream` to read from
        dp - the `DrawProcess` context
        Throws:
        java.io.IOException - if an I/O error occurs