当前位置: 首页>>代码示例>>Java>>正文


Java ListBuffer.append方法代码示例

本文整理汇总了Java中com.sun.tools.javac.util.ListBuffer.append方法的典型用法代码示例。如果您正苦于以下问题:Java ListBuffer.append方法的具体用法?Java ListBuffer.append怎么用?Java ListBuffer.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.util.ListBuffer的用法示例。


在下文中一共展示了ListBuffer.append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * Process Win32-style command files for the specified command line
 * arguments and return the resulting arguments. A command file argument
 * is of the form '@file' where 'file' is the name of the file whose
 * contents are to be parsed for additional arguments. The contents of
 * the command file are parsed using StreamTokenizer and the original
 * '@file' argument replaced with the resulting tokens. Recursive command
 * files are not supported. The '@' character itself can be quoted with
 * the sequence '@@'.
 */
public static String[] parse(String[] args)
    throws IOException
{
    ListBuffer<String> newArgs = new ListBuffer<String>();
    for (int i = 0; i < args.length; i++) {
        String arg = args[i];
        if (arg.length() > 1 && arg.charAt(0) == '@') {
            arg = arg.substring(1);
            if (arg.charAt(0) == '@') {
                newArgs.append(arg);
            } else {
                loadCmdFile(arg, newArgs);
            }
        } else {
            newArgs.append(arg);
        }
    }
    return newArgs.toList().toArray(new String[newArgs.length()]);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:CommandLine.java

示例2: locateNestedTypes

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
private void locateNestedTypes(Type type, TypeAnnotationPosition p) {
    // The number of "steps" to get from the full type to the
    // left-most outer type.
    ListBuffer<TypePathEntry> depth = new ListBuffer<>();

    Type encl = type.getEnclosingType();
    while (encl != null &&
            encl.getKind() != TypeKind.NONE &&
            encl.getKind() != TypeKind.ERROR) {
        depth = depth.append(TypePathEntry.INNER_TYPE);
        encl = encl.getEnclosingType();
    }
    if (depth.nonEmpty()) {
        p.location = p.location.prependList(depth.toList());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:TypeAnnotations.java

示例3: getFiles

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * Returns the set of source files for a package.
 *
 * @param packageName the specified package
 * @return the set of file objects for the specified package
 * @throws ToolException if an error occurs while accessing the files
 */
private List<JavaFileObject> getFiles(ModulePackage modpkg,
        boolean recurse) throws ToolException {
    Entry e = getEntry(modpkg);
    // The files may have been found as a side effect of searching for subpackages
    if (e.files != null) {
        return e.files;
    }

    ListBuffer<JavaFileObject> lb = new ListBuffer<>();
    List<Location> locs = getLocation(modpkg);
    if (locs.isEmpty()) {
        return Collections.emptyList();
    }
    String pname = modpkg.packageName;
    for (Location packageLocn : locs) {
        for (JavaFileObject fo : fmList(packageLocn, pname, sourceKinds, recurse)) {
            String binaryName = fm.inferBinaryName(packageLocn, fo);
            String simpleName = getSimpleName(binaryName);
            if (isValidClassName(simpleName)) {
                lb.append(fo);
            }
        }
    }
    return lb.toList();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:ElementsTable.java

示例4: list

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * Insert all files in a subdirectory of the platform image
 * which match fileKinds into resultList.
 */
@Override
public void list(Path userPath,
                 RelativeDirectory subdirectory,
                 Set<JavaFileObject.Kind> fileKinds,
                 boolean recurse,
                 ListBuffer<JavaFileObject> resultList) throws IOException {
    try {
        JRTIndex.Entry e = getJRTIndex().getEntry(subdirectory);
        if (symbolFileEnabled && e.ctSym.hidden)
            return;
        for (Path file: e.files.values()) {
            if (fileKinds.contains(getKind(file))) {
                JavaFileObject fe
                        = PathFileObject.forJRTPath(JavacFileManager.this, file);
                resultList.append(fe);
            }
        }

        if (recurse) {
            for (RelativeDirectory rd: e.subdirs) {
                list(userPath, rd, fileKinds, recurse, resultList);
            }
        }
    } catch (IOException ex) {
        ex.printStackTrace(System.err);
        log.error(Errors.ErrorReadingFile(userPath, getMessage(ex)));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:JavacFileManager.java

示例5: listDirectory

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * Insert all files in subdirectory subdirectory of directory directory
 * which match fileKinds into resultList
 */
private void listDirectory(File directory,
                           RelativeDirectory subdirectory,
                           Set<JavaFileObject.Kind> fileKinds,
                           boolean recurse,
                           ListBuffer<JavaFileObject> resultList) {
    File d = subdirectory.getFile(directory);
    if (!caseMapCheck(d, subdirectory))
        return;

    File[] files = d.listFiles();
    if (files == null)
        return;

    if (sortFiles != null)
        Arrays.sort(files, sortFiles);

    for (File f : files) {
        String fname = f.getName();
        if (f.isDirectory()) {
            if (recurse && SourceVersion.isIdentifier(fname)) {
                listDirectory(directory,
                        new RelativeDirectory(subdirectory, fname),
                        fileKinds,
                        recurse,
                        resultList);
            }
        } else {
            if (isValidFile(fname, fileKinds)) {
                JavaFileObject fe =
                        new RegularFileObject(this, fname, new File(d, fname));
                resultList.append(fe);
            }
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:40,代码来源:JavacFileManager.java

示例6: visitTypes

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * Get a localized string representation for all the types in the input list.
 *
 * @param ts types to be displayed
 * @param locale the locale in which the string is to be rendered
 * @return localized string representation
 */
public String visitTypes(List<Type> ts, Locale locale) {
    ListBuffer<String> sbuf = ListBuffer.lb();
    for (Type t : ts) {
        sbuf.append(visit(t, locale));
    }
    return sbuf.toList().toString();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:15,代码来源:Printer.java

示例7: processTopLevel

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
void processTopLevel(Element tlTag) {
    String kind = tlTag.getTagName();

    if (kind.equals("annodecl")) {
        // decls stored separately, does not affect bases
        String declId = tlTag.getAttribute("id");
        if (!declId.startsWith("@"))
            declId = "@" + declId;
        idAnnos.put(declId, processAnnoDecl(tlTag));
        return;
    }

    ListBuffer<JCTree>[] bases = processBases(tlTag, null);

    for (JCTree base : bases[0]) { // [0] - bases namely
        JCPackageDecl pkg = make.PackageDecl(
                                List.<JCAnnotation>nil(),
                                make.QualIdent(
                                    new Symbol.PackageSymbol(
                                        names.fromString(packageName),
                                        null)));
        ListBuffer<JCTree> topLevelParts = new ListBuffer<>();
        topLevelParts.append(pkg);
        topLevelParts.appendList(bases[1]); // [1] imports
        topLevelParts.append(base);

        JCCompilationUnit topLevel = make.TopLevel(topLevelParts.toList());
        documentifier.documentify(topLevel, fx);
        topLevels.add(topLevel);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:PackageGenerator.java

示例8: listClasses

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * From a list of top level trees, return the list of contained class definitions
 */
List<JCClassDecl> listClasses(List<JCCompilationUnit> trees) {
    ListBuffer<JCClassDecl> result = new ListBuffer<>();
    for (JCCompilationUnit t : trees) {
        for (JCTree def : t.defs) {
            if (def.hasTag(JCTree.Tag.CLASSDEF))
                result.append((JCClassDecl)def);
        }
    }
    return result.toList();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:JavadocTool.java

示例9: thrownExceptions

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * Return exceptions this method or constructor throws.
 *
 * @return an array of ClassDoc[] representing the exceptions
 * thrown by this method.
 */
public ClassDoc[] thrownExceptions() {
    ListBuffer<ClassDocImpl> l = new ListBuffer<>();
    for (Type ex : sym.type.getThrownTypes()) {
        ex = env.types.erasure(ex);
        //### Will these casts succeed in the face of static semantic
        //### errors in the documented code?
        ClassDocImpl cdi = env.getClassDoc((ClassSymbol)ex.tsym);
        if (cdi != null) l.append(cdi);
    }
    return l.toArray(new ClassDocImpl[l.length()]);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:ExecutableMemberDocImpl.java

示例10: copy

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
public <T extends JCTree> List<T> copy(List<T> trees, P p) {
    if (trees == null)
        return null;
    ListBuffer<T> lb = new ListBuffer<>();
    for (T tree: trees)
        lb.append(copy(tree, p));
    return lb.toList();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:TreeCopier.java

示例11: interfaces

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * Get included interfaces in this package, omitting annotation types.
 *
 * @return included interfaces in this package.
 */
public ClassDoc[] interfaces() {
    ListBuffer<ClassDocImpl> ret = new ListBuffer<>();
    for (ClassDocImpl c : getClasses(true)) {
        if (c.isInterface()) {
            ret.append(c);
        }
    }
    return ret.toArray(new ClassDocImpl[ret.length()]);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:PackageDocImpl.java

示例12: addToList

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
void addToList(ListBuffer<String> list, String str){
    StringTokenizer st = new StringTokenizer(str, ":");
    String current;
    while(st.hasMoreTokens()){
        current = st.nextToken();
        list.append(current);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:ToolOption.java

示例13: serialFieldTags

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * Return serialField tags in this comment.
 */
SerialFieldTag[] serialFieldTags() {
    ListBuffer<SerialFieldTag> found = new ListBuffer<SerialFieldTag>();
    for (Tag next : tagList) {
        if (next instanceof SerialFieldTag) {
            found.append((SerialFieldTag)next);
        }
    }
    return found.toArray(new SerialFieldTag[found.length()]);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:Comment.java

示例14: visitTypes

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
/**
 * Get a localized string representation for all the types in the input list.
 *
 * @param ts types to be displayed
 * @param locale the locale in which the string is to be rendered
 * @return localized string representation
 */
public String visitTypes(List<Type> ts, Locale locale) {
    ListBuffer<String> sbuf = new ListBuffer<>();
    for (Type t : ts) {
        sbuf.append(visit(t, locale));
    }
    return sbuf.toList().toString();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:Printer.java

示例15: AnnotatedType

import com.sun.tools.javac.util.ListBuffer; //导入方法依赖的package包/类
public AnnotatedTypeTree AnnotatedType(List<? extends AnnotationTree> annotations, Tree underlyingType) {
    ListBuffer<JCAnnotation> lb = new ListBuffer<JCAnnotation>();
    for (AnnotationTree t : annotations)
        lb.append((JCAnnotation)t);
    return make.at(NOPOS).AnnotatedType(lb.toList(), (JCExpression)underlyingType);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:TreeFactory.java


注:本文中的com.sun.tools.javac.util.ListBuffer.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。