public static ListTree<Tree> emptyList() { return new ResourceListTreeImpl(ImmutableList.of(), ImmutableList.of()); } }
public TryStatementTreeImpl(List<CatchTreeImpl> catches, @Nullable InternalSyntaxToken finallyKeyword, @Nullable BlockTreeImpl finallyBlock) { super(Kind.TRY_STATEMENT); this.openParenToken = null; this.resources = ResourceListTreeImpl.emptyList(); this.variableTreeResources = ResourceListTreeImpl.emptyList(); this.closeParenToken = null; this.catches = getCatches(catches); this.finallyKeyword = finallyKeyword; this.finallyBlock = finallyBlock; }
private static ListTree filterVariableTreeResources(ResourceListTreeImpl resources) { ImmutableList.Builder<Tree> filteredResources = ImmutableList.builder(); ImmutableList.Builder<SyntaxToken> filteredSeparators = ImmutableList.builder(); Iterator<SyntaxToken> separators = resources.separators().iterator(); for (Tree resource : resources) { SyntaxToken separator = null; if (separators.hasNext()) { separator = separators.next(); } if (resource.is(Kind.VARIABLE)) { filteredResources.add(resource); if (separator != null) { filteredSeparators.add(separator); } } } return new ResourceListTreeImpl(filteredResources.build(), filteredSeparators.build()); }
private static ListTree filterVariableTreeResources(ResourceListTreeImpl resources) { ImmutableList.Builder<Tree> filteredResources = ImmutableList.builder(); ImmutableList.Builder<SyntaxToken> filteredSeparators = ImmutableList.builder(); Iterator<SyntaxToken> separators = resources.separators().iterator(); for (Tree resource : resources) { SyntaxToken separator = null; if (separators.hasNext()) { separator = separators.next(); } if (resource.is(Kind.VARIABLE)) { filteredResources.add(resource); if (separator != null) { filteredSeparators.add(separator); } } } return new ResourceListTreeImpl(filteredResources.build(), filteredSeparators.build()); }
public static ListTree<Tree> emptyList() { return new ResourceListTreeImpl(ImmutableList.of(), ImmutableList.of()); } }
public TryStatementTreeImpl(List<CatchTreeImpl> catches, @Nullable InternalSyntaxToken finallyKeyword, @Nullable BlockTreeImpl finallyBlock) { super(Kind.TRY_STATEMENT); this.openParenToken = null; this.resources = ResourceListTreeImpl.emptyList(); this.variableTreeResources = ResourceListTreeImpl.emptyList(); this.closeParenToken = null; this.catches = getCatches(catches); this.finallyKeyword = finallyKeyword; this.finallyBlock = finallyBlock; }
public static ListTree<VariableTree> emptyList() { return new ResourceListTreeImpl(ImmutableList.<VariableTree>of(), ImmutableList.<SyntaxToken>of()); } }
public TryStatementTreeImpl(List<CatchTreeImpl> catches, @Nullable InternalSyntaxToken finallyKeyword, @Nullable BlockTreeImpl finallyBlock) { super(Kind.TRY_STATEMENT); this.openParenToken = null; this.resources = ResourceListTreeImpl.emptyList(); this.closeParenToken = null; this.catches = getCatches(catches); this.finallyKeyword = finallyKeyword; this.finallyBlock = finallyBlock; }
public ResourceListTreeImpl newResources(List<AstNode> rests) { List<AstNode> children = Lists.newArrayList(); ImmutableList.Builder<VariableTreeImpl> resources = ImmutableList.builder(); for (AstNode rest : rests) { VariableTreeImpl resource = (VariableTreeImpl) rest.getFirstChild(); children.add(resource); resources.add(resource); if (rest.getNumberOfChildren() == 2) { children.add(rest.getLastChild()); } } return new ResourceListTreeImpl(resources.build(), children); }
public ResourceListTreeImpl newResources(List<Tuple<Tree, Optional<InternalSyntaxToken>>> rests) { ImmutableList.Builder<Tree> resources = ImmutableList.builder(); ImmutableList.Builder<SyntaxToken> separators = ImmutableList.builder(); for (Tuple<Tree, Optional<InternalSyntaxToken>> rest : rests) { if (rest.second().isPresent()) { separators.add(rest.second().get()); } resources.add(rest.first()); } return new ResourceListTreeImpl(resources.build(), separators.build()); }
public ResourceListTreeImpl newResources(List<Tuple<VariableTreeImpl, Optional<InternalSyntaxToken>>> rests) { ImmutableList.Builder<VariableTree> resources = ImmutableList.builder(); ImmutableList.Builder<SyntaxToken> separators = ImmutableList.builder(); for (Tuple<VariableTreeImpl, Optional<InternalSyntaxToken>> rest : rests) { if (rest.second().isPresent()) { separators.add(rest.second().get()); } resources.add(rest.first()); } return new ResourceListTreeImpl(resources.build(), separators.build()); }
public ResourceListTreeImpl newResources(List<Tuple<Tree, Optional<InternalSyntaxToken>>> rests) { ImmutableList.Builder<Tree> resources = ImmutableList.builder(); ImmutableList.Builder<SyntaxToken> separators = ImmutableList.builder(); for (Tuple<Tree, Optional<InternalSyntaxToken>> rest : rests) { if (rest.second().isPresent()) { separators.add(rest.second().get()); } resources.add(rest.first()); } return new ResourceListTreeImpl(resources.build(), separators.build()); }