本文整理汇总了Java中org.netbeans.editor.Syntax.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java Syntax.getClass方法的具体用法?Java Syntax.getClass怎么用?Java Syntax.getClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.editor.Syntax
的用法示例。
在下文中一共展示了Syntax.getClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import org.netbeans.editor.Syntax; //导入方法依赖的package包/类
/** Goes through all the syntaxes and inits them. If the multi-state-info has
* valid state-info for the given syntax the state-info is used.
* Otherwise the syntax is inited to the init state.
*/
void load(MultiSyntax masterSyntax, char[] buffer, int offset, int len,
boolean lastBuffer, int stopPosition) {
SyntaxInfo syntaxItem = masterSyntax.slaveSyntaxChain;
while (syntaxItem != null) {
StateInfo loadInfo = null;
int masterOffsetDelta = 0;
Syntax s = syntaxItem.syntax;
if (syntaxItem.active) {
Class sc = s.getClass();
ChainItem item = stateInfoChain;
while (item != null) {
if (item.syntaxClass == sc && item.valid) {
loadInfo = item.stateInfo;
masterOffsetDelta = item.masterOffsetDelta;
break;
}
item = item.prev;
}
}
s.load(loadInfo, buffer, offset + masterOffsetDelta,
len - masterOffsetDelta, lastBuffer, stopPosition);
syntaxItem = syntaxItem.next;
}
}
示例2: store
import org.netbeans.editor.Syntax; //导入方法依赖的package包/类
void store(MultiSyntax masterSyntax) {
// Invalidate all state-info chain items
ChainItem item = stateInfoChain;
while (item != null) {
item.valid = false;
item = item.prev;
}
// Go through active syntaxes and store their info and master-offset
SyntaxInfo syntaxItem = masterSyntax.slaveSyntaxChain;
while (syntaxItem != null) {
if (syntaxItem.active) {
Syntax s = syntaxItem.syntax;
Class sc = s.getClass();
item = stateInfoChain;
while (item != null) {
if (item.syntaxClass == sc) { // found right item
break;
}
item = item.prev;
}
if (item == null) { // not found, add new
item = stateInfoChain = new ChainItem(s.createStateInfo(),
sc, stateInfoChain);
}
// Store the state and compute masterOffsetDelta
s.storeState(item.stateInfo);
item.masterOffsetDelta = s.getOffset() - masterSyntax.getOffset();
item.valid = true;
}
syntaxItem = syntaxItem.next;
}
}