當前位置: 首頁>>代碼示例>>Java>>正文


Java BidiIterator類代碼示例

本文整理匯總了Java中org.eclipse.xtext.nodemodel.BidiIterator的典型用法代碼示例。如果您正苦於以下問題:Java BidiIterator類的具體用法?Java BidiIterator怎麽用?Java BidiIterator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BidiIterator類屬於org.eclipse.xtext.nodemodel包,在下文中一共展示了BidiIterator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: reverse

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
@Override
public BidiIterable<AbstractNode> reverse() {
	return new BidiIterable<AbstractNode>() {

		@Override
		public BidiIterator<AbstractNode> iterator() {
			BidiIterator<AbstractNode> delegate = BasicNodeIterable.this.iterator(); 
			return new ReversedBidiIterator<AbstractNode>(delegate);
		}

		@Override
		public BidiIterable<AbstractNode> reverse() {
			return BasicNodeIterable.this;
		}
	};
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:17,代碼來源:BasicNodeIterable.java

示例2: getLinkedMetaModel

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
private List<EObject> getLinkedMetaModel(TypeRef context, EReference ref, ILeafNode text) throws IllegalNodeException {
	final ICompositeNode parentNode = text.getParent();
	BidiIterator<INode> iterator = parentNode.getChildren().iterator();
	while(iterator.hasPrevious()) {
		INode child = iterator.previous();
		if (child instanceof ILeafNode) {
			ILeafNode leaf = (ILeafNode) child;
			if (text == leaf)
				return super.getLinkedObjects(context, ref, text);
			if (!(leaf.getGrammarElement() instanceof Keyword) && !leaf.isHidden()) {
				IScope scope = getScope(context, ref);
				return XtextMetamodelReferenceHelper.findBestMetamodelForType(
						context, text.getText(), leaf.getText(), scope);
			}
		}
	}
	return Collections.emptyList();
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:19,代碼來源:XtextLinkingService.java

示例3: getTypeRefName

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
public static String getTypeRefName(TypeRef typeRef) {
	if (typeRef.getClassifier() != null)
		return typeRef.getClassifier().getName();
	final ICompositeNode node = NodeModelUtils.getNode(typeRef);
	if (node != null) {
		final BidiIterator<INode> leafNodes = node.getAsTreeIterable().iterator();
		while (leafNodes.hasPrevious()) {
			INode previous = leafNodes.previous();
			if (previous instanceof ILeafNode && !((ILeafNode) previous).isHidden()) {
				String result = previous.getText();
				if (result != null && result.startsWith("^")) {
					result = result.substring(1);
				}
				return result;
			}
		}
	}
	return null;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:20,代碼來源:GrammarUtil.java

示例4: setStyles

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
private void setStyles( IHighlightedPositionAcceptor acceptor, BidiIterator<INode> it, String...styles )
{
	for( String s : styles )
	{
		if( !it.hasNext() ) return;
		INode n = skipWhiteSpace( acceptor, it );
		if( n != null && s != null ) acceptor.addPosition( n.getOffset(), n.getLength(), s );
	}
}
 
開發者ID:jason-lang,項目名稱:jason-eclipse-plugin,代碼行數:10,代碼來源:AslHighlightingCalculator.java

示例5: skipWhiteSpace

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
private INode skipWhiteSpace( IHighlightedPositionAcceptor acceptor, BidiIterator<INode> it )
{
	INode n = null;
	
	while ( it.hasNext() && ( n = it.next() ).getClass() == HiddenLeafNode.class )
		processHiddenNode( acceptor, (HiddenLeafNode)n );
	return n;
}
 
開發者ID:jason-lang,項目名稱:jason-eclipse-plugin,代碼行數:9,代碼來源:AslHighlightingCalculator.java

示例6: getLength

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
@Override
public int getLength() {
	BidiIterator<AbstractNode> iter = basicIterator();
	while(iter.hasPrevious()) {
		INode prev = iter.previous();
		if (prev instanceof ILeafNode && !((ILeafNode) prev).isHidden()) {
			int offset = getOffset();
			return prev.getTotalEndOffset() - offset;
		}
	}
	return getTotalLength();
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:13,代碼來源:AbstractNode.java

示例7: getEndOffset

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
/**
 * @since 2.5
 */
@Override
public int getEndOffset() {
	BidiIterator<AbstractNode> iter = basicIterator();
	while(iter.hasPrevious()) {
		INode prev = iter.previous();
		if (prev instanceof ILeafNode && !((ILeafNode) prev).isHidden()) {
			return prev.getTotalEndOffset();
		}
	}
	return getTotalEndOffset();
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:15,代碼來源:AbstractNode.java

示例8: collectNodesEnclosingChangeRegion

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
private void collectNodesEnclosingChangeRegion(ICompositeNode parent, Range range,
		List<ICompositeNode> nodesEnclosingRegion) {
	nodesEnclosingRegion.add(parent);
	BidiIterator<INode> iterator = parent.getChildren().iterator();
	while(iterator.hasPrevious()) {
		INode prev = iterator.previous();
		if (prev instanceof ICompositeNode) {
			if (nodeEnclosesRegion((ICompositeNode) prev, range)) {
				collectNodesEnclosingChangeRegion((ICompositeNode) prev, range, nodesEnclosingRegion);
				break;
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:15,代碼來源:PartialParsingHelper.java

示例9: findEntryRuleOrRuleCall

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
/**
 * @return either a RuleCall or a ParserRule
 */
public EObject findEntryRuleOrRuleCall(ICompositeNode replaceRootNode) {
	EObject grammarElement = replaceRootNode.getGrammarElement();
	if (grammarElement instanceof CrossReference) {
		grammarElement = ((CrossReference) grammarElement).getTerminal();
	}
	if (GrammarUtil.isParserRuleCall(grammarElement)) {
		return grammarElement;
	}
	else if (grammarElement instanceof ParserRule) {
		return grammarElement;
	}
	else if (grammarElement instanceof Action) {
		BidiIterator<INode> iterator = replaceRootNode.getChildren().iterator();
		while(iterator.hasNext()) {
			INode next = iterator.next();
			if (next instanceof ICompositeNode) {
				return findEntryRuleOrRuleCall((ICompositeNode) next);
			}
		}
		throw new IllegalArgumentException("Invalid parsetree: Action node does not have a Composite child");
	}
	else
		throw new IllegalArgumentException(
				"Entry rule can only be resolved for parser rules, rule calls, cross-references or actions, but tried to resolve for: "
				+ replaceRootNode.getGrammarElement().eClass().getName());
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:30,代碼來源:PartialParsingPointers.java

示例10: findContextNode

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
protected INode findContextNode(EObject semanticObject) {
	INode node = NodeModelUtils.findActualNodeFor(semanticObject);
	if (node != null) {
		BidiIterator<INode> nodes = node.getAsTreeIterable().iterator();
		while (nodes.hasNext()) {
			INode next = nodes.next();
			if (next.getGrammarElement() instanceof RuleCall)
				return next;
			if (next.getGrammarElement() instanceof ParserRule
					&& ((ParserRule) next.getGrammarElement()).getType().getClassifier() instanceof EClass)
				return next;
		}
	}
	throw new RuntimeException("no context found");
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:16,代碼來源:NodeModelSemanticSequencer.java

示例11: collectNodesEnclosingChangeRegion

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
private void collectNodesEnclosingChangeRegion(final ICompositeNode parent, final Range range, final List<ICompositeNode> nodesEnclosingRegion) {
  nodesEnclosingRegion.add(parent);
  BidiIterator<INode> iterator = parent.getChildren().iterator();
  while (iterator.hasPrevious()) {
    INode prev = iterator.previous();
    if (prev instanceof ICompositeNode) {
      if (nodeEnclosesRegion((ICompositeNode) prev, range)) {
        collectNodesEnclosingChangeRegion((ICompositeNode) prev, range, nodesEnclosingRegion);
        break;
      }
    }
  }
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:14,代碼來源:FixedPartialParsingHelper.java

示例12: iterator

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
@Override
public BidiIterator<INode> iterator() {
	return new NodeIterator(startWith);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:5,代碼來源:NodeIterable.java

示例13: iterator

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
@Override
public BidiIterator<T> iterator() {
	return SingletonBidiIterator.<T>create(value);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:5,代碼來源:SingletonBidiIterable.java

示例14: iterator

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
@Override
public BidiIterator<T> iterator() {
	BidiIterator<T> delegate = getDelegate().iterator(); 
	return new ReversedBidiIterator<T>(delegate);
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:6,代碼來源:ReversedBidiIterable.java

示例15: instance

import org.eclipse.xtext.nodemodel.BidiIterator; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public static <T> BidiIterator<T> instance() {
	return (BidiIterator<T>) INSTANCE;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:5,代碼來源:EmptyBidiIterator.java


注:本文中的org.eclipse.xtext.nodemodel.BidiIterator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。