Package wprover
Class PanelGB
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JScrollPane
-
- wprover.PanelAlgebraic
-
- wprover.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
-
-
Field Summary
-
Fields inherited from class wprover.PanelAlgebraic
_mremainder, dp, gt, gxInstance, lan, main, poly, rund, running, tpane
-
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 voidaddSVdd(java.util.Vector v)Adds the non-degenerate conditions to the text pane.protected intdiv(TMono m1, TPoly p1)Divides the given polynomial by the terms in the specified TPoly.booleangb_finished(java.util.Vector v)Checks if the Groebner basis computation is finished.voidgbasis()Computes the Groebner basis for the current set of constraints and updates the text pane.voidgbasis(java.util.Vector pp)Computes the Groebner basis for the specified polynomial vector.protected TMonogetTMono(Cons c)Retrieves the TMono representation of the specified construction.voidmouseClicked(java.awt.event.MouseEvent e)Handles mouse click events to show the popup menu.voidmouseEntered(java.awt.event.MouseEvent e)voidmouseExited(java.awt.event.MouseEvent e)voidmousePressed(java.awt.event.MouseEvent e)voidmouseReleased(java.awt.event.MouseEvent e)voidprintTP(java.util.Vector v)Prints the terms in the specified vector to the text pane.voidprove(GTerm tm, DrawProcess dp)Initiates the proving process with the given GTerm and DrawProcess.voidrun()Runs the main process for computing the Groebner basis.voidsaveAsMaple()Saves the current data in Maple format.TMonosbasis(int x, java.util.Vector v, TMono mc)Computes a modified Groebner basis (SBasis) for the given polynomial vector and conclusion.voidstartTimer()Starts a timer to monitor the running process.voidstopRunning()Stops the running process and updates the status.voidtest(java.util.Vector pp, int dx)Tests the Groebner basis computation with the specified polynomial vector and index.voidwriteMaple(java.io.FileOutputStream out)Writes the current data in Maple format to the specified output stream.-
Methods inherited from class wprover.PanelAlgebraic
actionPerformed, addAlgebraicForm, addButton, addString, addString, addString1, addString2, addString2s, clearAll, getLanguage, isRunning, scrollToEnd, setXInstance, stop
-
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
-
-
-
-
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 paneltpane- the WuTextPane instance to associate with this panel
-
-
Method Detail
-
stopRunning
public void stopRunning()
Stops the running process and updates the status.- Specified by:
stopRunningin classPanelAlgebraic
-
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 provedp- 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 dividep1- 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:
getTMonoin classPanelAlgebraic- 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:
runin interfacejava.lang.Runnable- Overrides:
runin classPanelAlgebraic
-
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 termsdx- 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 iterationsv- the vector of polynomial terms (TMono objects) to be processed and updatedmc- the conclusion polynomial term (TMono) to be reduced- Returns:
- the reduced conclusion polynomial or
nullif 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:
mouseClickedin interfacejava.awt.event.MouseListener- Parameters:
e- the mouse event
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExitedin interfacejava.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.IOExceptionWrites 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
-
-