Package com.google.collide.dto

Examples of com.google.collide.dto.CodeBlock


    CodeGraph libsSubgraph = data.getLibsSubgraph();
    merged.setLibsSubgraph(this.freshness.getLibsSubgraph());
    boolean libsSubgraphUpdated = false;

    CodeBlock fileTree = data.getFileTree();
    merged.setFileTree(this.freshness.getFileTree());
    merged.setFileTreeHash(this.freshness.getFileTreeHash());
    boolean fileTreeUpdated = false;

    CodeGraph workspaceTree = data.getWorkspaceTree();
View Full Code Here


   *         function refused to create some part of it
   */
  public static CodeBlock getOrCreateCodeBlock(CodeBlock root, JsonArray<String> qname,
      Function<MissingChildCodeBlock, CodeBlock> createCodeBlock) {
    for (int nameIdx = 0, end = qname.size(); nameIdx < end; nameIdx++) {
      CodeBlock newRoot = null;
      for (int i = 0; i < root.getChildren().size(); i++) {
        if (root.getChildren().get(i).getName().equals(qname.get(nameIdx))) {
          newRoot = root.getChildren().get(i);
          break;
        }
View Full Code Here

    }
    JsonArray<String> keys = blockMap.getKeys();
    final int l = keys.size();
    for (int i = 0; i < l; i++) {
      String key = keys.get(i);
      CodeBlock codeBlock = blockMap.get(key);
      if (CodeBlock.Type.VALUE_FILE == codeBlock.getBlockType()) {
        if (filePath.equals(codeBlock.getName())) {
          return codeBlock;
        }
      }
    }
    return null;
View Full Code Here

    cursor = new Position(Document.createEmpty().getFirstLineInfo(), LAST_COLUMN + 2);
    assertFalse(proposalBuilder.doGetProposals(context, cursor, builder).isEmpty());
  }

  private ScopeTrieBuilder setupBuilder() {
    CodeBlock contextFile = createCodeBlockTree();
    JsoStringMap<CodeBlock> codeBlockMap = JsoStringMap.create();
    codeBlockMap.put(contextFile.getName(), contextFile);
    ScopeTrieBuilder builder = createScopeTrieBuilder(contextFile);
    builder.setCodeGraph(CodeGraphImpl.make().setCodeBlockMap(codeBlockMap));
    return builder;
  }
View Full Code Here

  public String getModuleName() {
    return "com.google.collide.client.TestCode";
  }

  public void testCaseInsensitiveSearch() {
    CodeBlock fileBar = createCodeBlock("1", "/bar.js", CodeBlock.Type.FILE, 0, 0, 0, 99);
    CodeBlock varBar = createCodeBlock(fileBar, "11", "Bar", CodeBlock.Type.FIELD, 0, 0, 0, 99);
    createCodeBlock(fileBar, "12", "doThis", CodeBlock.Type.FUNCTION, 1, 0, 10, 99);
    createCodeBlock(fileBar, "13", "doThat", CodeBlock.Type.FUNCTION, 11, 0, 20, 99);

    JsoStringMap<CodeBlock> files = JsoStringMap.<CodeBlock>create();
    files.put(fileBar.getName(), fileBar);
View Full Code Here

     * Bar {
     *   doThis: function() {},
     *   doThat: function() {}
     * }
     */
    CodeBlock fileBar = createCodeBlock("1", "/bar.js", CodeBlock.Type.FILE, 0, 0, 0, 99);
    CodeBlock varBar = createCodeBlock(fileBar, "11", "Bar", CodeBlock.Type.FIELD, 0, 0, 0, 99);
    createCodeBlock(fileBar, "12", "Bar.doThis", CodeBlock.Type.FUNCTION, 1, 0, 10, 99);
    createCodeBlock(fileBar, "13", "Bar.doThat", CodeBlock.Type.FUNCTION, 11, 0, 20, 99);

    /*
     * /foo.js:
     *
     * // @type {Bar}
     * var Foo;
     */
    CodeBlock fileFoo = createCodeBlock("0", "/foo.js", CodeBlock.Type.FILE, 0, 0, 0, 99);
    CodeBlock varFoo = createCodeBlock("11", "Foo", CodeBlock.Type.FIELD, 0, 0, 0, 99);
    fileFoo.getChildren().add(varFoo);

    JsoStringMap<CodeBlock> files = JsoStringMap.<CodeBlock>create();
    files.put(fileBar.getName(), fileBar);
    files.put(fileFoo.getName(), fileFoo);
View Full Code Here

        TestUtils.createNameSet(prefixIndex.search("Foo.")));
  }

  @Ignore
  public void testTypeAssociationChain() {
    CodeBlock fileFoo = createCodeBlock("0", "/foo.js", CodeBlock.Type.FILE, 0, 0, 99, 0);
    createCodeBlock(fileFoo, "11", "Foo", CodeBlock.Type.FIELD, 0, 0, 99, 0);
    CodeBlock typeFoo = createCodeBlock(
        fileFoo, "12", "Foo.prototype", CodeBlock.Type.FIELD, 0, 0, 99, 0);
    createCodeBlock(fileFoo, "13", "Foo.prototype.doThis", CodeBlock.Type.FUNCTION, 11, 0, 20, 0);

    CodeBlock fileBar = createCodeBlock("1", "/bar.js", CodeBlock.Type.FILE, 0, 0, 10, 0);
    createCodeBlock(fileBar, "11", "Bar", CodeBlock.Type.FIELD, 0, 0, 1, 0);
    CodeBlock typeBar = createCodeBlock(
        fileBar, "12", "Bar.prototype", CodeBlock.Type.FIELD, 0, 4, 1, 0);
    CodeBlock fieldFoo = createCodeBlock(
        fileBar, "13", "Bar.prototype.foo", CodeBlock.Type.FIELD, 0, 14, 1, 0);

    CodeBlock varBaz = createCodeBlock(fileBar, "14", "baz", CodeBlock.Type.FIELD, 5, 0, 6, 0);

    JsoStringMap<CodeBlock> files = JsoStringMap.<CodeBlock>create();
    files.put(fileBar.getName(), fileBar);
    files.put(fileFoo.getName(), fileFoo);
View Full Code Here

    /*
     * /window.js:
     *
     * Window.prototype.doThis = function() {}
     */
    CodeBlock fileWindow = createCodeBlock("1", "/bar.js", CodeBlock.Type.FILE, 0, 0, 0, 99);
    createCodeBlock(fileWindow, "11", "Window", CodeBlock.Type.FIELD, 0, 0, 0, 99);
    CodeBlock typeWindow = createCodeBlock(fileWindow, "12", "Window.prototype",
        CodeBlock.Type.FIELD, 0, 0, 0, 99);
    createCodeBlock(fileWindow, "13", "Window.prototype.doThis",
        CodeBlock.Type.FUNCTION, 0, 0, 0, 99);

    /*
     * /jquery.js:
     *
     * Window.prototype.doThat = function() {}
     */
    CodeBlock fileJquery = createCodeBlock("0", "/jquery.js", CodeBlock.Type.FILE, 0, 0, 0, 99);
    CodeBlock varJqueryWindow = createCodeBlock(fileJquery, "11", "Window",
        CodeBlock.Type.FIELD, 0, 0, 0, 99);
    createCodeBlock(fileJquery, "12", "Window.prototype",
        CodeBlock.Type.FIELD, 0, 0, 0, 99);
    createCodeBlock(fileJquery, "13", "Window.prototype.doThat",
        CodeBlock.Type.FUNCTION, 0, 0, 0, 99);

    /*
     * /decl.js:
     *
     * // @type{Window}
     * var top;
     */
    CodeBlock fileDecl = createCodeBlock("2", "/decl.js", CodeBlock.Type.FILE, 0, 0, 0, 99);
    CodeBlock varWindow = createCodeBlock(fileDecl, "11", "top",
        CodeBlock.Type.FIELD, 0, 0, 0, 99);

    JsoStringMap<CodeBlock> files = JsoStringMap.<CodeBlock>create();
    files.put(fileWindow.getName(), fileWindow);
    files.put(fileJquery.getName(), fileJquery);
View Full Code Here

     *
     * // @extends {Bar}
     * function Foo() {};
     * Foo.prototype.doThird = function() {};
     */
    CodeBlock fileBar = createCodeBlock("1", "/bar.js", CodeBlock.Type.FILE, 0, 0, 0, 99);
    createCodeBlock(fileBar, "11", "Bar", CodeBlock.Type.FUNCTION, 0, 0, 0, 99);
    CodeBlock prototypeBar = createCodeBlock(
        fileBar, "12", "Bar.prototype", CodeBlock.Type.FIELD, 0, 0, 0, 99);
    createCodeBlock(fileBar, "13", "Bar.prototype.doThis", CodeBlock.Type.FUNCTION, 1, 0, 10, 99);
    createCodeBlock(fileBar, "14", "Bar.prototype.doThat", CodeBlock.Type.FUNCTION, 11, 0, 20, 99);

    createCodeBlock(fileBar, "15", "Foo", CodeBlock.Type.FUNCTION, 100, 0, 199, 99);
    CodeBlock prototypeFoo = createCodeBlock(
        fileBar, "16", "Foo.prototype", CodeBlock.Type.FIELD, 100, 0, 199, 99);
    createCodeBlock(
        fileBar, "17", "Foo.prototype.doThird", CodeBlock.Type.FUNCTION, 101, 0, 120, 99);

    JsoStringMap<CodeBlock> files = JsoStringMap.<CodeBlock>create();
View Full Code Here

     * /lib.py:
     *
     * def foo:
     *   return 42;
     */
    CodeBlock fileLib = createCodeBlock("1", "/lib.py", CodeBlock.Type.FILE, 0, 0, 0, 99);
    CodeBlock funFoo = createCodeBlock(fileLib, "11", "foo", CodeBlock.Type.FUNCTION, 0, 0, 0, 99);

    /*
     * /api/ext/util.py:
     *
     * def bar:
     *   return None;
     */
    CodeBlock fileUtil = createCodeBlock("2", "/api/ext/util.py", CodeBlock.Type.FILE, 0, 0, 0, 99);
    CodeBlock funBar = createCodeBlock(fileUtil, "11", "bar", CodeBlock.Type.FUNCTION, 0, 0, 0, 99);

    /*
     * /main.py:
     *
     * import lib
     * from api.ext import util
     */
    CodeBlock fileMain = createCodeBlock("3", "/main.py", CodeBlock.Type.FILE, 0, 0, 0, 99);
    ImportAssociation importLib = createRootImportAssociation(fileMain, fileLib);
    ImportAssociation importUtil = createRootImportAssociation(fileMain, fileUtil);

    JsoStringMap<CodeBlock> files = JsoStringMap.<CodeBlock>create();
    files.put(fileLib.getId(), fileLib);
    files.put(fileMain.getId(), fileMain);
    files.put(fileUtil.getId(), fileUtil);

    CodeGraphImpl codeGraph = CodeGraphImpl.make();
    codeGraph.setCodeBlockMap(files);
    codeGraph.setImportAssociations(JsoArray.from(importLib, importUtil));
View Full Code Here

TOP

Related Classes of com.google.collide.dto.CodeBlock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.