📄 operation.java
字号:
/*====================================================================*\Operation.javaOperation class.------------------------------------------------------------------------This file is part of FuncPlotter, a combined Java application and appletfor plotting explicit functions in one variable.Copyright 2005-2007 Andy Morgan-Richards.FuncPlotter is free software: you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation, either version 3 of the License, or (at youroption) any later version.This program is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public License alongwith this program. If not, see <http://www.gnu.org/licenses/>.\*====================================================================*/// IMPORTSimport exception.AppException;import exception.TerminatedException;import java.io.File;import java.util.List;//----------------------------------------------------------------------// OPERATION CLASSabstract class Operation extends util.Operation{////////////////////////////////////////////////////////////////////////// Member classes : non-inner classes//////////////////////////////////////////////////////////////////////// // READ DOCUMENT OPERATION CLASS public static class ReadDocument extends Operation { //////////////////////////////////////////////////////////////////// // Constructors //////////////////////////////////////////////////////////////////// public ReadDocument( FunctionDocument document, File file, List<String> errorStrs ) { this.document = document; this.file = file; this.errorStrs = errorStrs; } //-------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // Instance methods : Runnable interface //////////////////////////////////////////////////////////////////// public void run( ) { // Perform operation try { document.read( file, errorStrs ); } catch ( AppException e ) { setException( e, false ); } // Remove thread removeThread( ); } //-------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // Instance variables //////////////////////////////////////////////////////////////////// private FunctionDocument document; private File file; private List<String> errorStrs; } //================================================================== // WRITE DOCUMENT OPERATION CLASS public static class WriteDocument extends Operation { //////////////////////////////////////////////////////////////////// // Constructors //////////////////////////////////////////////////////////////////// public WriteDocument( FunctionDocument document, FunctionDocument.FileEx fileEx, boolean includeColours ) { this.document = document; this.fileEx = fileEx; this.includeColours = includeColours; } //-------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // Instance methods : Runnable interface //////////////////////////////////////////////////////////////////// public void run( ) { // Perform operation try { document.write( fileEx, includeColours ); } catch ( TerminatedException e ) { // ignore } catch ( AppException e ) { setException( e, false ); } // Remove thread removeThread( ); } //-------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // Instance variables //////////////////////////////////////////////////////////////////// private FunctionDocument document; private FunctionDocument.FileEx fileEx; private boolean includeColours; } //================================================================== // WRITE IMAGE OPERATION CLASS public static class WriteImage extends Operation { //////////////////////////////////////////////////////////////////// // Constructors //////////////////////////////////////////////////////////////////// public WriteImage( FunctionDocument document, File file ) { this.document = document; this.file = file; } //-------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // Instance methods : Runnable interface //////////////////////////////////////////////////////////////////// public void run( ) { // Perform operation try { document.writeImage( file ); } catch ( TerminatedException e ) { // ignore } catch ( AppException e ) { setException( e, false ); } // Remove thread removeThread( ); } //-------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // Instance variables //////////////////////////////////////////////////////////////////// private FunctionDocument document; private File file; } //================================================================== // WRITE CONFIGURATION OPERATION CLASS public static class WriteConfig extends Operation { //////////////////////////////////////////////////////////////////// // Constructors //////////////////////////////////////////////////////////////////// public WriteConfig( File file ) { this.file = file; } //-------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // Instance methods : Runnable interface //////////////////////////////////////////////////////////////////// public void run( ) { // Perform operation try { AppConfig.getInstance( ).write( file ); } catch ( TerminatedException e ) { // ignore } catch ( AppException e ) { setException( e, false ); } // Remove thread removeThread( ); } //-------------------------------------------------------------- //////////////////////////////////////////////////////////////////// // Instance variables //////////////////////////////////////////////////////////////////// private File file; } //==================================================================////////////////////////////////////////////////////////////////////////// Constructors//////////////////////////////////////////////////////////////////////// private Operation( ) { } //------------------------------------------------------------------}//----------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -