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

📄 ruleset.java

📁 具有不同语法高亮的编辑器实例
💻 JAVA
字号:
/*
 * RuleSet.java - A set of rules used by the user-defined syntax highlighting
 *                system.
 */
package org.fife.ui.rsyntaxtextarea.custom;

import org.fife.ui.rsyntaxtextarea.TokenMap;


/**
 * A set of rules used by the user-defined syntax highlighting system.
 *
 * @author Robert Futrell
 * @version 0.1
 */
public class RuleSet {

	private Rule[] rules;
	private int ruleCount;
	private TokenMap wordsToHighlight;


/*****************************************************************************/


	public RuleSet(Rule[] rules, TokenMap wordsToHighlight) {
		this.rules = rules;
		ruleCount = rules.length;
		this.wordsToHighlight = wordsToHighlight;
	}


/*****************************************************************************/


	public Rule getRule(int index) {
		if (index<0 || index>=getRuleCount())
			throw new IndexOutOfBoundsException("index must be " +
				"between 0 and " + (getRuleCount()-1));
		return rules[index];
	}


/*****************************************************************************/


	public int getRuleCount() {
		return ruleCount;
	}


/*****************************************************************************/


	public int getTokenTypeForIdentifier(String identifier) {
		int type = -1;
		if (wordsToHighlight!=null) {
			char[] array = identifier.toCharArray();
			type = wordsToHighlight.get(array, 0,array.length-1);
		}
		return type;
	}


/*****************************************************************************/

}

⌨️ 快捷键说明

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