⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 janet.java

📁 JaNet: Java Neural Network Toolkit resume: A well documented toolkit for designing and training, a
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				break;			case QUIT_SAVEALL_CONFIRM:				if(currentProject != null){					try{						currentProject.save();					}catch(IOException ioe){						todo = ""+ioe;					}					currentProject.close();					currentProject = null;					setProjectInactive();				}				exit();				break;			case QUIT_ASK_CONFIRM:				if(currentProject != null){					if(currentProject.needSave()){						jaNetConfirmDialog = new confirmDialog(this, "Save project before quit ?", QUIT_SAVEALL_CONFIRM);						jaNetConfirmDialog.show();						return;					}					currentProject.close();					currentProject = null;					setProjectInactive();				}				setProjectInactive();				exit();				break;			case PRJ_SAVE:				try{					currentProject.save();				}catch(IOException ioe){					todo = ""+ioe;				}				currentProject.close();				currentProject = null;				setProjectInactive();				break;		}	}	public void confirmIsNo(int id){		switch(id){			case PRJ_SAVE:				currentProject.close();				currentProject = null;				setProjectInactive();				break;			case QUIT_SAVEALL_CONFIRM:				currentProject.close();				currentProject = null;				setProjectInactive();				exit();				break;		}			}//////////////////////////////////////////////////////////////////////	menu's selection methods////////////////////////////////////////////////////////////////////	public void selectedNewModule(String label){		NNeMo	tempNNeMo;		// may be a new module ??		for(int j=0; j< moduleTypeTable.size(); j++){			ModuleTypes mt = (ModuleTypes)moduleTypeTable.elementAt(j);			if (label.equalsIgnoreCase( mt.ModuleTypeName)){				// we found it, try to load and start it				String className = mt.ModuleClassName;				try{					// try to load and create a new instance of a class which the name is specified in fnclassname string.					tempNNeMo = (NNeMo) Class.forName(className).newInstance();				}catch (InstantiationException instex){					todo = "Error in instantiation "+className+".class ("+instex+").";					return;				}catch (IllegalAccessException illaccex){					todo = "Error in accessing "+className+".class ("+illaccex+").";					return;				}catch (ClassNotFoundException classnotfound){					todo = "Error, "+className+".class not found ("+classnotfound+").";					return;				}catch(IncompatibleClassChangeError icce){					todo = ""+icce;					return;				}				// now run it				ModuleEntry me = new ModuleEntry(currentProject.pathName, null , mt, tempNNeMo);				currentProject.addNewModuleEntry(me);				tempNNeMo.NNeMoInit(me);				return;			}		}		return;	}	public void selectedOptions() {		if(jaNetOptionsBox == null)jaNetOptionsBox = new OptionsBox(this);		jaNetOptionsBox.show(moduleTypeTable);	}	public void selectedExitSaveAll() {		jaNetConfirmDialog = new confirmDialog(this, "Are You sure to quit jaNet ?", QUIT_SAVEALL_CONFIRM);		jaNetConfirmDialog.show();	}	public void selectedExitDiscard() {		jaNetConfirmDialog = new confirmDialog(this, "Are You sure to quit jaNet ?", QUIT_CONFIRM);		jaNetConfirmDialog.show();	}    public void selectedExit() {		jaNetConfirmDialog = new confirmDialog(this, "Are You sure to quit jaNet ?", QUIT_ASK_CONFIRM);		jaNetConfirmDialog.show();    }	public void selectedNewProject() {		if(currentProject != null){			todo = "Close project before creating a new.";			return;		}		FilenameFilter filter = new EndsWithFilter("prj");		jaNetProject tempPrj = null;;		String path, file;				if(createProjectFD == null) createProjectFD = new FileDialog(this, "Create Project",FileDialog.SAVE);		createProjectFD.setFilenameFilter(filter);		createProjectFD.show();				file = createProjectFD.getFile();		path = createProjectFD.getDirectory();				// clicked Cancel ?		if(file==null || path==null) return;		if(file.endsWith("*.*")) file = file.substring(file.length()-3,file.length());		// do it remains something ?		if(file.length() == 0) return;				try{			tempPrj = new jaNetProject(path,file);			tempPrj.save();		}catch(IOException ioe){			todo = "selectedNewProject: "+ioe;			return;		}		currentProject = tempPrj;		setProjectActive();	}	public void selectedOpenProject() {		if(currentProject != null){			todo = "Close project before opening a new.";			return;		}		FilenameFilter filter = new EndsWithFilter("prj");		jaNetProject tempPrj = null;;		String path, file;				if(openProjectFD == null) openProjectFD = new FileDialog(this, "Open Project",FileDialog.LOAD);		openProjectFD.setFilenameFilter(filter);		openProjectFD.show();				file = openProjectFD.getFile();		path = openProjectFD.getDirectory();				// clicked Cancel ?		if(file==null || path==null) return;		if(file.endsWith("*.*")) file = file.substring(file.length()-3,file.length());		try{			tempPrj = new jaNetProject(path,file);			tempPrj.load();		}catch(IOException ioe){			System.out.println(""+ioe);			return;		}		currentProject = tempPrj;		setProjectActive();	}	public void selectedEditProject() {		todo = "Sorry, not yet implemented !";		// to do: put event handler code here.	}	public void selectedCloseProject() {		if(currentProject == null) return;				if(currentProject.needSave()){			jaNetConfirmDialog = new confirmDialog(this, "Save project before close ?", PRJ_SAVE);			jaNetConfirmDialog.show();			return;		}		currentProject.close();		currentProject = null;		setProjectInactive();	}	public void selectedModuleList() {		if (jaNetModuleList == null) jaNetModuleList = new ModuleList();		jaNetModuleList.show(currentProject);	}	public void selectedContents() {		// to do: put event handler code here.	}	public void selectedJavaAPI() {		try{			Runtime.getRuntime().exec("/bin/sh -c \"netscape "+homePage+"\"");		}catch(IOException ioe){			//System.out.println(""+ioe);		}	}    public void selectedAbout() {		if(jaNetAboutBox == null) jaNetAboutBox = new AboutBox(this, jaNetHomePath);		jaNetAboutBox.show();	}//////////////////////////////////////////////////////////////////////	Read and save configuration file////////////////////////////////////////////////////////////////////	public void readConfigFile(String path, String name) {		try {			System.out.println(path+name);			File jaNetConfig = new File(path, name);			RandomAccessFile file = new RandomAccessFile(jaNetConfig,"r");			readConfigFile(file);			file.close();		}		catch (IOException ioe) {			System.out.println(ioe);		}		catch(SecurityException se){			System.out.println(se);		}	}	public void readConfigFile(RandomAccessFile file) throws IOException {				// read header		if(file.readUTF().compareTo(getClass().getName()+version) != 0){			throw new IOException("jaNet: Error in readConfigFile, unknown version.");		}		// read number of modules in file		int nModules = file.readInt();		ModuleTypes modTemp;				for(int i=0; i< nModules; i++){			modTemp = new ModuleTypes(file);			moduleTypeTable.addElement(modTemp);        }    }	public void writeConfigFile(String path, String name) {		try {			File jaNetConfig = new File(path, name);			RandomAccessFile file = new RandomAccessFile(jaNetConfig,"rw");			writeConfigFile(file);			file.close();		}		catch (IOException ioe) {			todo = ""+ioe;		}		catch(SecurityException se){			todo = ""+se;		}	}	public void writeConfigFile(RandomAccessFile file) throws IOException {		// write "jaNet1.0"		file.writeUTF(getClass().getName()+version);		// write the number of elements in the hash table		file.writeInt(moduleTypeTable.size());		// write each module type in the config file		for(int i=0; i< moduleTypeTable.size(); i++){			((ModuleTypes)moduleTypeTable.elementAt(i)).writeModuleType(file);		}    }//////////////////////////////////////////////////////////////////////	thread guard starter, stopper and body////////////////////////////////////////////////////////////////////	public void start() { 	  if(threadGuard == null){			threadGuard = new Thread(this, "jaNet guard");			threadGuard.start();		}	}	public void stop(){		threadGuard.stop();		threadGuard = null;	}		public void run(){		while(true){			if(todo.compareTo(NOTHING) != 0){				errorDialog jaNeterrorDialog = new errorDialog(this,todo);				jaNeterrorDialog.show();								todo = NOTHING;			}			// never try to free some memory ...			System.gc();			// wait a tenth of a second, then test it again!			try {Thread.sleep(500);} catch (InterruptedException e){};		}	}  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -