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

📄 options.java

📁 emacs的一个非常有用的插件,叫xrefactory,可以实现source insight里的那种函数跳转.和cscope(跳回来不方便)配合使用,非常的不错.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			return(new Option(desc, vals));		}		public static final int MAX_PROJECTS = 1000;		public void reParseSingleProject(Options cp) throws Exception {			cp.optioni = 0;			while (ind<sslen) {				Option oo = parseOption();				if (oo.option == optProjectMarker) {					cp.add(new Option(optProjectMarker, getProjectChangeDirs(oo.fulltext[1])));				} else {					cp.add(oo);				}				ind = s.skipBlank(ss, ind, sslen);			}		}		public Options[] parseFile() throws Exception {			Options[] res = new Options[MAX_PROJECTS];			Options cp;			int resi = 0;			res[resi++] = cp = new Options("", "");			while (ind<sslen) {				Option oo = parseOption();				if (oo.option == optProjectMarker) {					String pname = getProjectName(oo.fulltext[1]);					String chdirs = getProjectChangeDirs(oo.fulltext[1]);					res[resi++] = cp = new Options(pname, chdirs);				} else {					cp.add(oo);				}				ind = s.skipBlank(ss, ind, sslen);			}			Options[] rres = new Options[resi];			System.arraycopy(res, 0, rres, 0, resi);			return(rres);		}		OptionParser(File ff) throws Exception {			ss = new XrefCharBuffer();			ss.appendFileContent(ff);			sslen = ss.length();			ind = 0;		}		OptionParser(String  s) {			ss = new XrefCharBuffer(s);			sslen = ss.length();			ind = 0;		}	} // (OptionParser)	// ------------------------- Options -------------------------------    public static final int OPTIONS_ALLOCC_CHUNK = 2;	String		projectName;    Option[] 	option = new Option[0];    int			optioni = 0;    int			allocatedSize = 0;	// copy constructor, if adding fiels, do not forget to add it here	Options(Options op) {		int i;		projectName = op.projectName;		option = new Option[op.option.length];		for(i=0; i<op.optioni; i++) {			option[i] = new Option(op.option[i]);		}		optioni = op.optioni;		allocatedSize = op.allocatedSize;	}    int indexOf(Option opt) {		for(int i=0; i<optioni; i++) {			if (s.stringArrayEqual(option[i].fulltext, opt.fulltext)) return(i);		}		return(-1);    }    boolean contains(Option opt) {		return(indexOf(opt)!=-1);    }	Option getContainedOption(OptionDescription od) {		for(int i=0; i<optioni; i++) {			if (option[i].option == od) return(option[i]);		}		return(null);	}	void add(Option o) {		if (optioni >= allocatedSize) {			Option[] n = new Option[allocatedSize+OPTIONS_ALLOCC_CHUNK];			System.arraycopy(option, 0, n, 0, allocatedSize);			option = n;			allocatedSize += OPTIONS_ALLOCC_CHUNK;		}		if (o.option.addAtBeginning) {			System.arraycopy(option, 0, option, 1, optioni);			option[0] = o;					} else {			option[optioni] = o;		}		optioni++;	}	void add(Option o, int preferedIndex) {		if (optioni >= allocatedSize) {			Option[] n = new Option[allocatedSize+OPTIONS_ALLOCC_CHUNK];			System.arraycopy(option, 0, n, 0, allocatedSize);			option = n;			allocatedSize += OPTIONS_ALLOCC_CHUNK;		}		if (preferedIndex < 0 || preferedIndex >= optioni) {			option[optioni] = o;		} else {			for(int i=optioni; i>preferedIndex; i--) option[i] = option[i-1];			option[preferedIndex] = o;		}		optioni++;	}    void delete(int i) {		s.assertt(optioni > 0);		optioni --;		for(int j=i; j<optioni; j++) option[j] = option[j+1];    }    int delete(Option opt) {		int i = indexOf(opt);		if (i != -1) delete(i);		return(i);    }	String getProjectAutoDetectionOpt() {		for(int i=0; i<optioni; i++) {			if (option[i].option == optProjectMarker) {				return(option[i].fulltext[1]);			}		}		return("");	}	String getOptionText(Option o) {		String res = "";		if (o.option.compact) {			String oo = "";			for(int j=0; j<o.fulltext.length; j++) {				oo += o.fulltext[j];			}			if (o.option == optCommentOption) {				res += oo + "\n";			} else {				res += s.sprintOption(oo);			}		} else {			for(int j=0; j<o.fulltext.length; j++) {				if (j!=0) res += " ";				res += s.sprintOption(o.fulltext[j]);			}		}		return(res);	}    public String toString(boolean fileFormat) {		String res = "\n";		if (!projectName.equals("")) {			res += "[" + projectName;			String changeDirectories = getProjectAutoDetectionOpt();			if (! changeDirectories.equals("")) res += s.classPathSeparator + changeDirectories;			res += "]\n  ";		} else {			res += "  ";		}		for(int i=0; i<optioni; i++) {			if (option[i].option != optProjectMarker) {				res += getOptionText(option[i]);				if (res.charAt(res.length()-1)=='\n') {					res += "  ";				} else {					res += "\n  ";				}			}		}		return(res);    }    public String toString() {		return(toString(false));	}	public static void printOptions(Options[] pp, PrintStream oo) {		for(int i=0; i<pp.length; i++) {			oo.println(pp[i].toString());		}	}	public static boolean projectMarkersOverlapps(String d1, String d2) {			int d1len = d1.length();		int d2len = d2.length();		if (d1len == d2len) {			if (d1.equals(d2)) return(true);		} else if (d1len < d2len) {			if (d1.equals(d2.substring(0,d1len-1))) {				if (d2.substring(d1len, d1len+1).equals(s.slash)) return(true);			}		} else {			if (d2.equals(d1.substring(0,d2len-1))) {				if (d1.substring(d2len, d2len+1).equals(s.slash)) return(true);			}		}		return(false);	}	public static String getProjectName(String oo) {		PathIterator ii = new PathIterator(oo,s.classPathSeparator);		if (! ii.hasNext()) return("");		while (ii.hasNext()) {			String p = ii.next();			if (p.length()>0 && !p.substring(0,1).equals(s.slash)) return(p);		}		ii = new PathIterator(oo,s.classPathSeparator);		return(ii.next());	}	public static String getProjectChangeDirs(String oo) {		String pname = getProjectName(oo);		PathIterator ii = new PathIterator(oo,s.classPathSeparator);		if (! ii.hasNext()) return("");		String res = "";		while (ii.hasNext()) {			String p = ii.next();			if (!p.equals(pname)) {				if (res.equals("")) res = p;				else res += s.classPathSeparator + p;			}		}		return(res);	}	public static String [] getProjectNames(Options [] projects, String zeroName) {		String[] pn = new String[projects.length];		for(int i=0; i<projects.length; i++) {			pn[i] = projects[i].projectName;		}		pn[0] = zeroName;		return(pn);	}	public static void saveOptions(Options[] pp, String fileName) {		PrintStream ps = null;		try {			ps = new PrintStream(new FileOutputStream(fileName));			//&PrintStream ps = System.err;			printOptions(pp, ps);			ps.close();		} catch (Exception e) {			if (s.debug) e.printStackTrace(System.err);			JOptionPane.showMessageDialog(s.view, "While saving options: " + e, 										  "Xrefactory Error", 										  JOptionPane.ERROR_MESSAGE);							if (ps!=null) ps.close();		}	}	public static void dump(Options[] pp) {		printOptions(pp, System.err);	}	void addNewProjectOptions(String projectName, String changeDirectories,							  String classPath, String sourcePath		) {		add(new Option(optInputFile, changeDirectories));		add(new Option(optPruneDirs, "CVS"+s.classPathSeparator+"backup"));		add(new Option(optXrefsFile, s.tagFilesDirectory+projectName));		add(new Option(optXrefNum, ""+10));		add(new Option(optClassPath, classPath));		add(new Option(optSourcePath, sourcePath));		add(new Option(optJavaVersion, "1.3"));		add(new Option(optCSuffixes, "c"+s.classPathSeparator+"C"));		add(new Option(optJavaSuffixes, "java"));		add(new Option(optJdkClassPath, s.jdkClassPath));		String jdkhome = new File(s.javaHome).getParent();		if (jdkhome!=null) {			add(new Option(optJavaDocPath, jdkhome+"/docs/api"));		}	}	Options(String projectName, String changeDirectories) {		this.projectName = projectName;		optioni = 0;		add(new Option(optProjectMarker, changeDirectories));	}}

⌨️ 快捷键说明

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