Package noop.model

Examples of noop.model.Library


  }

  @Test public void shouldRunTheHelloWorldProgram() throws Exception {
    UUID uuid = UUID.randomUUID();   
    Project project = new Project("Hello World", "com.example", "");
    project.addLibrary(new Library(uuid, "hello")).addFunction(new Function("go"));
    controller.addProject(new NewProjectOperation(project));
    repository.save(project);
    StandardLibraryBuilder stdLib = new StandardLibraryBuilder().build(controller);
    repository.save(stdLib.noop);
View Full Code Here


    Controller controller = new Controller(workspace, new VertexCreatingVisitor());

    for (String libraryPath : options.getLibraryPaths()) {
      CommandLineLibraryNameParser parser = new CommandLineLibraryNameParser(libraryPath).invoke();
      Project project = parser.getProject();
      Library library = repository.load(project, parser.getLibraryName());
      project.addLibrary(library);
      controller.addProject(new NewProjectOperation(project));
    }

    Library mainLib = workspace.lookupLibrary(UUID.fromString(options.getMainLib()));
    if (mainLib == null) {
      throw new IllegalArgumentException("No library found with id " + options.getMainLib());
    }

    Block entryPoint = (Block) mainLib.getElements().get(options.getEntryPoint());
    if (entryPoint == null) {
      throw new IllegalArgumentException("No block found named " + options.getEntryPoint());
    }
   
    System.out.println("entryPoint to execute: " + entryPoint.name);
View Full Code Here

    this.modelVisitor = modelVisitor;
  }

  @Override
  public void visit(MethodInvocation methodInvocation) {
    Library library = workspace.lookupLibrary(methodInvocation.vertex.libraryUid);
    Iterable<Edge> edges = library.edgesFrom(methodInvocation.vertex);
    LanguageElement target = null;
    for (Edge edge : edges) {
      switch (edge.type) {
        case TARGET:
          target = workspace.resolve(edge.dest);
View Full Code Here

public class VertexCreatingVisitorTest {
  @Test
  public void shouldCreateVerticesForEveryElementUnderAProject() {
    Project p = new Project("example", "p", "MIT license");
    UUID uid = UUID.randomUUID();
    Library l = new Library(uid, "l");
    Clazz c = new Clazz("c");
    Method m = new Method("m");
    Library l2 = new Library(UUID.randomUUID(), "l2");

    p.addLibrary(l);
    p.addLibrary(l2);
    l.addClazz(c);
    c.addBlock(m);
View Full Code Here

  public StandardLibraryBuilder build(Controller controller) {

    noop = new Project("Noop", "com.google", "Apache 2");

    lang = new Library(UUID.randomUUID(), "lang");
    noop.addLibrary(lang);

    stringClazz = new Clazz("String");
    lang.addClazz(stringClazz);

    voidClazz = new Clazz("Void");
    lang.addClazz(voidClazz);

    io = new Library(UUID.randomUUID(), "io");
    noop.addLibrary(io);

    consoleClazz = new Clazz("Console");
    io.addClazz(consoleClazz);
View Full Code Here

    this.workspace = workspace;
    this.addVertices = addVertices;
  }

  public void editNode(EditNodeOperation operation) {
    Library library = workspace.lookupLibrary(operation.vertex.libraryUid);
    LanguageElement currentValue = library.getElements().get(operation.vertex.index);
    if (currentValue.getClass() != operation.newValue.getClass()) {
      throw new IllegalArgumentException(String.format("Cannot edit node %s with %s because the current type is %s",
          operation.vertex, operation.newValue, currentValue.getClass()));
    }
    library.replace(operation.vertex.index, operation.newValue);
  }
View Full Code Here

      throw new IllegalArgumentException("src element has no vertex");
    }
    if (operation.dest.vertex == Vertex.NONE) {
      throw new IllegalArgumentException("dest element has no vertex");
    }
    Library srcLibrary = workspace.lookupLibrary(operation.src.vertex.libraryUid);
    srcLibrary.addEdge(new Edge(operation.src.vertex, operation.type, operation.dest.vertex));
  }
View Full Code Here

TOP

Related Classes of noop.model.Library

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.