Package wprover

Class PanelGB

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.ScrollPaneConstants

    public class PanelGB
    extends PanelAlgebraic
    implements java.awt.event.MouseListener
    PanelGB is a graphical panel for performing Groebner basis computations. It extends the PanelAlgebraic class and implements MouseListener for handling mouse events. This class provides methods to compute Groebner bases, handle user interactions, and save results in Maple format.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JScrollPane

        javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      • Fields inherited from class javax.swing.JScrollPane

        columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • Fields inherited from interface javax.swing.ScrollPaneConstants

        COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
    • Constructor Summary

      Constructors 
      Constructor Description
      PanelGB​(DrawProcess dp, WuTextPane tpane)
      Constructs a new PanelGB with the specified DrawProcess and WuTextPane.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addSVdd​(java.util.Vector v)
      Adds the non-degenerate conditions to the text pane.
      protected int div​(TMono m1, TPoly p1)
      Divides the given polynomial by the terms in the specified TPoly.
      boolean gb_finished​(java.util.Vector v)
      Checks if the Groebner basis computation is finished.
      void gbasis()
      Computes the Groebner basis for the current set of constraints and updates the text pane.
      void gbasis​(java.util.Vector pp)
      Computes the Groebner basis for the specified polynomial vector.
      protected TMono getTMono​(Cons c)
      Retrieves the TMono representation of the specified construction.
      void mouseClicked​(java.awt.event.MouseEvent e)
      Handles mouse click events to show the popup menu.
      void mouseEntered​(java.awt.event.MouseEvent e)  
      void mouseExited​(java.awt.event.MouseEvent e)  
      void mousePressed​(java.awt.event.MouseEvent e)  
      void mouseReleased​(java.awt.event.MouseEvent e)  
      void printTP​(java.util.Vector v)
      Prints the terms in the specified vector to the text pane.
      void prove​(GTerm tm, DrawProcess dp)
      Initiates the proving process with the given GTerm and DrawProcess.
      void run()
      Runs the main process for computing the Groebner basis.
      void saveAsMaple()
      Saves the current data in Maple format.
      TMono sbasis​(int x, java.util.Vector v, TMono mc)
      Computes a modified Groebner basis (SBasis) for the given polynomial vector and conclusion.
      void startTimer()
      Starts a timer to monitor the running process.
      void stopRunning()
      Stops the running process and updates the status.
      void test​(java.util.Vector pp, int dx)
      Tests the Groebner basis computation with the specified polynomial vector and index.
      void writeMaple​(java.io.FileOutputStream out)
      Writes the current data in Maple format to the specified output stream.
      • Methods inherited from class javax.swing.JScrollPane

        createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PanelGB

        public PanelGB​(DrawProcess dp,
                       WuTextPane tpane)
        Constructs a new PanelGB with the specified DrawProcess and WuTextPane.
        Parameters:
        dp - the DrawProcess instance to associate with this panel
        tpane - the WuTextPane instance to associate with this panel
    • Method Detail

      • stopRunning

        public void stopRunning()
        Stops the running process and updates the status.
        Specified by:
        stopRunning in class PanelAlgebraic
      • prove

        public void prove​(GTerm tm,
                          DrawProcess dp)
        Initiates the proving process with the given GTerm and DrawProcess.
        Parameters:
        tm - the GTerm instance representing the term to prove
        dp - the DrawProcess instance to use for proving
      • startTimer

        public void startTimer()
        Starts a timer to monitor the running process.
      • div

        protected int div​(TMono m1,
                          TPoly p1)
        Divides the given polynomial by the terms in the specified TPoly.
        Parameters:
        m1 - the polynomial to divide
        p1 - the TPoly containing the terms to divide by
        Returns:
        0 if the division is successful, 1 if the process is interrupted
      • getTMono

        protected TMono getTMono​(Cons c)
        Retrieves the TMono representation of the specified construction.
        Overrides:
        getTMono in class PanelAlgebraic
        Parameters:
        c - the construction
        Returns:
        the TMono representation of the construction
      • run

        public void run()
        Runs the main process for computing the Groebner basis.
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class PanelAlgebraic
      • printTP

        public void printTP​(java.util.Vector v)
        Prints the terms in the specified vector to the text pane.
        Parameters:
        v - the vector containing the terms to print
      • gb_finished

        public boolean gb_finished​(java.util.Vector v)
        Checks if the Groebner basis computation is finished.
        Parameters:
        v - the vector containing the terms to check
        Returns:
        true if the computation is finished, false otherwise
      • test

        public void test​(java.util.Vector pp,
                         int dx)
        Tests the Groebner basis computation with the specified polynomial vector and index.
        Parameters:
        pp - the vector containing the polynomial terms
        dx - the index value for the computation
      • gbasis

        public void gbasis​(java.util.Vector pp)
        Computes the Groebner basis for the specified polynomial vector.
        Parameters:
        pp - the vector containing the polynomial terms
      • sbasis

        public TMono sbasis​(int x,
                            java.util.Vector v,
                            TMono mc)
        Computes a modified Groebner basis (SBasis) for the given polynomial vector and conclusion.

        This method selects and removes polynomial terms from the vector based on the provided index, computes intermediate deltas and nondegenerate conditions, and applies a series of polynomial updates and reductions. It modifies the input vector with updated terms and returns the reduced conclusion polynomial.

        Parameters:
        x - the maximum index value controlling term selection and iterations
        v - the vector of polynomial terms (TMono objects) to be processed and updated
        mc - the conclusion polynomial term (TMono) to be reduced
        Returns:
        the reduced conclusion polynomial or null if the process is interrupted
      • addSVdd

        public void addSVdd​(java.util.Vector v)
        Adds the non-degenerate conditions to the text pane.
        Parameters:
        v - the vector containing the non-degenerate conditions
      • gbasis

        public void gbasis()
        Computes the Groebner basis for the current set of constraints and updates the text pane.
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        Handles mouse click events to show the popup menu.
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
        Parameters:
        e - the mouse event
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • saveAsMaple

        public void saveAsMaple()
        Saves the current data in Maple format. Opens a file chooser dialog to select the save location. If the file exists, it will be overwritten. If the file does not exist, it will be created.
      • writeMaple

        public void writeMaple​(java.io.FileOutputStream out)
                        throws java.io.IOException
        Writes the current data in Maple format to the specified output stream.
        Parameters:
        out - the output stream to write the data to
        Throws:
        java.io.IOException - if an I/O error occurs