public void buildAvatar(String pName, String pImagePath) {
   _nimblePlayer.setName(pName);
   _nimblePlayer.setAvatar(pImagePath);
   _nimblePlayer.setType(CharacterType.NIMBLE);
 }
Example #2
0
 public Mage(String s) {
   super(120, 20, 40, 4.0);
   super.setName(s);
 }
  public void run1() {

    long testStartTime = System.nanoTime();
    marktime = System.nanoTime();

    try {
      timelog("Beginning graph2 test...");

      DElementStore crewStore = new DElementStore();
      crewStore.setStoreKey(crewPath);
      crewStore.addType(Crew.class);
      DElementStore movieStore = new DElementStore();
      movieStore.setStoreKey(moviePath);
      movieStore.addType(Movie.class);
      DElementStore characterStore = new DElementStore();
      characterStore.setStoreKey(charactersPath);
      characterStore.addType(Character.class);
      DElementStore edgeStore = new DElementStore();
      edgeStore.setStoreKey(edgePath);
      //			DElementStore usersStore = new DElementStore();
      //			usersStore.setStoreKey(NoteCoordinate.Utils.getLongFromReplid(nabId));
      //			usersStore.setProxyStoreKey(NoteCoordinate.Utils.getLongFromReplid(usersId));
      //			usersStore.addType(User.class);

      DConfiguration config = new DConfiguration();
      graph = new DGraph(config);
      config.addElementStore(crewStore);
      config.addElementStore(movieStore);
      config.addElementStore(characterStore);
      config.addElementStore(edgeStore);
      //			config.addElementStore(usersStore);
      config.setDefaultElementStore(edgeStore.getStoreKey());
      DGraph graph = new DGraph(config);
      DFramedGraphFactory factory = new DFramedGraphFactory(config);
      FramedTransactionalGraph<DGraph> framedGraph = factory.create(graph);

      resetDbs();
      //			User ntfUser = framedGraph.getVertex(nabId + ntfUnid, User.class);

      Movie newhopeMovie = framedGraph.addVertex("Star Wars", Movie.class);
      newhopeMovie.setTitle("Star Wars");
      //			Likes ntfLikesNH = ntfUser.addLikes(newhopeMovie);
      //			ntfLikesNH.setRating(4);

      Movie empireMovie = framedGraph.addVertex("The Empire Strikes Back", Movie.class);
      empireMovie.setTitle("The Empire Strikes Back");
      //			Likes ntfLikesESB = ntfUser.addLikes(empireMovie);
      //			ntfLikesESB.setRating(5);

      Movie jediMovie = framedGraph.addVertex("Return of the Jedi", Movie.class);
      jediMovie.setTitle("Return of the Jedi");
      //			Likes ntfLikesRoJ = ntfUser.addLikes(jediMovie);
      //			ntfLikesRoJ.setRating(5);

      Movie phantomMovie = framedGraph.addVertex("The Phantom Menace", Movie.class);
      phantomMovie.setTitle("The Phantom Menace");

      Movie clonesMovie = framedGraph.addVertex("Attack of the Clones", Movie.class);
      clonesMovie.setTitle("Attack of the Clones");

      Movie revengeMovie = framedGraph.addVertex("Revenge of the Sith", Movie.class);
      revengeMovie.setTitle("Revenge of the Sith");

      Crew lucasCrew = framedGraph.addVertex("George Lucas", Crew.class);
      lucasCrew.setFullName("George Lucas");

      Crew kershnerCrew = framedGraph.addVertex("Irvin Kershner", Crew.class);
      kershnerCrew.setFullName("Irvin Kershner");

      Crew marquandCrew = framedGraph.addVertex("Richard Marquand", Crew.class);
      marquandCrew.setFullName("Richard Marquand");

      DirectedBy nhDirector = newhopeMovie.addDirectedBy(lucasCrew);
      nhDirector.setRating(4);

      DirectedBy esbDirector = empireMovie.addDirectedBy(kershnerCrew);
      esbDirector.setRating(5);

      DirectedBy rojDirector = jediMovie.addDirectedBy(marquandCrew);
      rojDirector.setRating(4);

      DirectedBy pmDirector = phantomMovie.addDirectedBy(lucasCrew);
      pmDirector.setRating(3);

      DirectedBy aocDirector = clonesMovie.addDirectedBy(lucasCrew);
      aocDirector.setRating(2);

      DirectedBy rosDirector = revengeMovie.addDirectedBy(lucasCrew);
      rosDirector.setRating(1);

      Character luke = framedGraph.addVertex("Luke Skywalker", Character.class);
      luke.setName("Luke Skywalker");
      luke.addAppearsIn(newhopeMovie);
      luke.addAppearsIn(empireMovie);
      luke.addAppearsIn(jediMovie);
      Character leia = framedGraph.addVertex("Leia Organa", Character.class);
      leia.setName("Leia Organa");
      leia.addAppearsIn(newhopeMovie);
      leia.addAppearsIn(empireMovie);
      leia.addAppearsIn(jediMovie);
      Character han = framedGraph.addVertex("Han Solo", Character.class);
      han.setName("Han Solo");
      han.addAppearsIn(newhopeMovie);
      han.addAppearsIn(empireMovie);
      han.addAppearsIn(jediMovie);
      Character chewy = framedGraph.addVertex("Chewbacca", Character.class);
      chewy.setName("Chewbacca");
      chewy.addAppearsIn(newhopeMovie);
      chewy.addAppearsIn(empireMovie);
      chewy.addAppearsIn(jediMovie);
      chewy.addAppearsIn(revengeMovie);
      Character threepio = framedGraph.addVertex("C-3PO", Character.class);
      threepio.setName("C-3PO");
      threepio.addAppearsIn(newhopeMovie);
      threepio.addAppearsIn(empireMovie);
      threepio.addAppearsIn(jediMovie);
      threepio.addAppearsIn(phantomMovie);
      threepio.addAppearsIn(clonesMovie);
      threepio.addAppearsIn(revengeMovie);
      Character artoo = framedGraph.addVertex("R2D2", Character.class);
      artoo.setName("R2D2");
      artoo.addAppearsIn(newhopeMovie);
      artoo.addAppearsIn(empireMovie);
      artoo.addAppearsIn(jediMovie);
      artoo.addAppearsIn(phantomMovie);
      artoo.addAppearsIn(clonesMovie);
      artoo.addAppearsIn(revengeMovie);
      Character lando = framedGraph.addVertex("Lando Calrissian", Character.class);
      lando.setName("Lando Calrissian");
      lando.addAppearsIn(empireMovie);
      lando.addAppearsIn(jediMovie);
      Character anakin = framedGraph.addVertex("Anakin Skywalker", Character.class);
      anakin.setName("Anakin Skywalker");
      anakin.addAppearsIn(newhopeMovie);
      anakin.addAppearsIn(empireMovie);
      anakin.addAppearsIn(jediMovie);
      anakin.addAppearsIn(phantomMovie);
      anakin.addAppearsIn(clonesMovie);
      anakin.addAppearsIn(revengeMovie);
      Character palpatine = framedGraph.addVertex("Darth Sidious", Character.class);
      palpatine.setName("Darth Sidious");
      palpatine.addAppearsIn(empireMovie);
      palpatine.addAppearsIn(jediMovie);
      palpatine.addAppearsIn(phantomMovie);
      palpatine.addAppearsIn(clonesMovie);
      palpatine.addAppearsIn(revengeMovie);
      Character obiwan = framedGraph.addVertex("Obi-Wan Kenobi", Character.class);
      obiwan.setName("Obi-Wan Kenobi");
      obiwan.addAppearsIn(newhopeMovie);
      obiwan.addAppearsIn(empireMovie);
      obiwan.addAppearsIn(jediMovie);
      obiwan.addAppearsIn(phantomMovie);
      obiwan.addAppearsIn(clonesMovie);
      obiwan.addAppearsIn(revengeMovie);
      Character quigon = framedGraph.addVertex("Qui-Gon Jinn", Character.class);
      quigon.setName("Qui-Gon Jinn");
      quigon.addAppearsIn(phantomMovie);
      Character yoda = framedGraph.addVertex("Yoda", Character.class);
      yoda.setName("Yoda");
      yoda.addAppearsIn(empireMovie);
      yoda.addAppearsIn(jediMovie);
      yoda.addAppearsIn(phantomMovie);
      yoda.addAppearsIn(clonesMovie);
      yoda.addAppearsIn(revengeMovie);
      Character jango = framedGraph.addVertex("Jango Fett", Character.class);
      jango.setName("Jango Fett");
      jango.addAppearsIn(clonesMovie);
      Character boba = framedGraph.addVertex("Boba Fett", Character.class);
      boba.setName("Boba Fett");
      boba.addAppearsIn(empireMovie);
      boba.addAppearsIn(jediMovie);
      boba.addAppearsIn(clonesMovie);
      Character padme = framedGraph.addVertex("Padme", Character.class);
      padme.setName("Padme");
      padme.addAppearsIn(phantomMovie);
      padme.addAppearsIn(clonesMovie);
      padme.addAppearsIn(revengeMovie);
      Character shmi = framedGraph.addVertex("Shmi Skywalker", Character.class);
      shmi.setName("Shmi Skywalker");
      shmi.addAppearsIn(phantomMovie);
      shmi.addAppearsIn(clonesMovie);
      Character tyranus = framedGraph.addVertex("Darth Tyranus", Character.class);
      tyranus.setName("Darth Tyranus");
      tyranus.addAppearsIn(clonesMovie);
      tyranus.addAppearsIn(revengeMovie);
      Character maul = framedGraph.addVertex("Darth Maul", Character.class);
      maul.setName("Darth Maul");
      maul.addAppearsIn(phantomMovie);
      maul.addAppearsIn(clonesMovie);
      Character tarkin = framedGraph.addVertex("Grand Moff Tarkin", Character.class);
      tarkin.setName("Grand Moff Tarkin");
      tarkin.addAppearsIn(newhopeMovie);
      Character windu = framedGraph.addVertex("Mace Windu", Character.class);
      windu.setName("Mace Windu");
      windu.addAppearsIn(phantomMovie);
      windu.addAppearsIn(clonesMovie);
      windu.addAppearsIn(revengeMovie);
      Character greedo = framedGraph.addVertex("Greedo", Character.class);
      greedo.setName("Greedo");
      greedo.addAppearsIn(newhopeMovie);
      Character wedge = framedGraph.addVertex("Wedge Antilles", Character.class);
      wedge.setName("Wedge Antilles");
      wedge.addAppearsIn(newhopeMovie);
      wedge.addAppearsIn(empireMovie);
      wedge.addAppearsIn(jediMovie);

      Crew ford = framedGraph.addVertex("Harrison Ford", Crew.class);
      ford.setFullName("Harrison Ford");
      ford.addStarsInMovie(newhopeMovie);
      ford.addStarsInMovie(empireMovie);
      ford.addStarsInMovie(jediMovie);
      han.addPortrayedBy(ford);

      Crew fischer = framedGraph.addVertex("Carrie Fischer", Crew.class);
      fischer.setFullName("Carrie Fischer");
      fischer.addStarsInMovie(newhopeMovie);
      fischer.addStarsInMovie(empireMovie);
      fischer.addStarsInMovie(jediMovie);
      fischer.addPortrayals(leia);

      Crew hammill = framedGraph.addVertex("Mark Hammill", Crew.class);
      hammill.setFullName("Mark Hammill");
      hammill.addStarsInMovie(newhopeMovie);
      hammill.addStarsInMovie(empireMovie);
      hammill.addStarsInMovie(jediMovie);
      hammill.addPortrayals(luke);

      Crew daniels = framedGraph.addVertex("Anthony Daniels", Crew.class);
      daniels.setFullName("Anthony Daniels");
      daniels.addStarsInMovie(newhopeMovie);
      daniels.addStarsInMovie(empireMovie);
      daniels.addStarsInMovie(jediMovie);
      daniels.addStarsInMovie(phantomMovie);
      daniels.addStarsInMovie(clonesMovie);
      daniels.addStarsInMovie(revengeMovie);
      daniels.addPortrayals(threepio);

      Crew baker = framedGraph.addVertex("Kenny Baker", Crew.class);
      baker.setFullName("Kenny Baker");
      baker.addStarsInMovie(newhopeMovie);
      baker.addStarsInMovie(empireMovie);
      baker.addStarsInMovie(jediMovie);
      baker.addStarsInMovie(phantomMovie);
      baker.addStarsInMovie(clonesMovie);
      baker.addStarsInMovie(revengeMovie);
      baker.addPortrayals(artoo);

      Crew prowse = framedGraph.addVertex("David Prowse", Crew.class);
      prowse.setFullName("David Prowse");
      prowse.addStarsInMovie(newhopeMovie);
      prowse.addStarsInMovie(empireMovie);
      prowse.addStarsInMovie(jediMovie);
      prowse.addPortrayals(anakin);

      Crew williams = framedGraph.addVertex("Billy Dee Williams", Crew.class);
      williams.setFullName("Billy Dee Williams");
      williams.addStarsInMovie(empireMovie);
      williams.addStarsInMovie(jediMovie);
      williams.addPortrayals(lando);

      Crew guinness = framedGraph.addVertex("Alec Guinness", Crew.class);
      guinness.setFullName("Alec Guinness");
      guinness.addStarsInMovie(newhopeMovie);
      guinness.addStarsInMovie(empireMovie);
      guinness.addStarsInMovie(jediMovie);
      guinness.addPortrayals(obiwan);

      Crew ewan = framedGraph.addVertex("Ewan McGregor", Crew.class);
      ewan.setFullName("Ewan McGregor");
      ewan.addStarsInMovie(phantomMovie);
      ewan.addStarsInMovie(clonesMovie);
      ewan.addStarsInMovie(revengeMovie);
      ewan.addPortrayals(obiwan);

      Crew cushing = framedGraph.addVertex("Peter Cushing", Crew.class);
      cushing.setFullName("Peter Cushing");
      cushing.addStarsInMovie(newhopeMovie);
      cushing.addPortrayals(tarkin);

      Crew mayhew = framedGraph.addVertex("Peter Mayhew", Crew.class);
      mayhew.setFullName("Peter Mayhew");
      mayhew.addStarsInMovie(newhopeMovie);
      mayhew.addStarsInMovie(empireMovie);
      mayhew.addStarsInMovie(jediMovie);
      mayhew.addStarsInMovie(revengeMovie);
      mayhew.addPortrayals(chewy);

      Crew oz = framedGraph.addVertex("Frank Oz", Crew.class);
      oz.setFullName("Frank Oz");
      oz.addStarsInMovie(empireMovie);
      oz.addStarsInMovie(jediMovie);
      oz.addStarsInMovie(phantomMovie);
      oz.addStarsInMovie(clonesMovie);
      oz.addStarsInMovie(revengeMovie);
      oz.addPortrayals(yoda);

      Crew bulloch = framedGraph.addVertex("Jeremy Bulloch", Crew.class);
      bulloch.setFullName("Jeremy Bulloch");
      bulloch.addStarsInMovie(empireMovie);
      bulloch.addStarsInMovie(jediMovie);
      bulloch.addPortrayals(boba);

      Crew revill = framedGraph.addVertex("Clive Revill", Crew.class);
      revill.setFullName("Clive Revill");
      revill.addStarsInMovie(empireMovie);
      revill.addPortrayals(palpatine);

      Crew ian = framedGraph.addVertex("Ian McDiarmid", Crew.class);
      ian.setFullName("Ian McDiarmid");
      ian.addStarsInMovie(jediMovie);
      ian.addStarsInMovie(phantomMovie);
      ian.addStarsInMovie(clonesMovie);
      ian.addStarsInMovie(revengeMovie);
      ian.addPortrayals(palpatine);

      Crew shaw = framedGraph.addVertex("Sebastian Shaw", Crew.class);
      shaw.setFullName("Sebastian Shaw");
      shaw.addStarsInMovie(jediMovie);
      shaw.addPortrayals(anakin);

      Crew liam = framedGraph.addVertex("Liam Neeson", Crew.class);
      liam.setFullName("Liam Neeson");
      liam.addStarsInMovie(phantomMovie);
      liam.addPortrayals(quigon);

      Crew portman = framedGraph.addVertex("Natalie Portman", Crew.class);
      portman.setFullName("Natalie Portman");
      portman.addStarsInMovie(phantomMovie);
      portman.addStarsInMovie(clonesMovie);
      portman.addStarsInMovie(revengeMovie);
      portman.addPortrayals(padme);

      Crew lloyd = framedGraph.addVertex("Jake Lloyd", Crew.class);
      lloyd.setFullName("Jake Lloyd");
      lloyd.addStarsInMovie(phantomMovie);
      lloyd.addPortrayals(anakin);

      Crew hayden = framedGraph.addVertex("Hayden Christensen", Crew.class);
      hayden.setFullName("Hayden Christensen");
      hayden.addStarsInMovie(clonesMovie);
      hayden.addStarsInMovie(revengeMovie);
      hayden.addPortrayals(anakin);

      Crew august = framedGraph.addVertex("Pernill August", Crew.class);
      august.setFullName("Pernill August");
      august.addStarsInMovie(phantomMovie);
      august.addStarsInMovie(clonesMovie);
      august.addPortrayals(shmi);

      Crew park = framedGraph.addVertex("Ray Park", Crew.class);
      park.setFullName("Ray Park");
      park.addStarsInMovie(phantomMovie);
      park.addPortrayals(maul);

      Crew samuel = framedGraph.addVertex("Samuel L. Jackson", Crew.class);
      samuel.setFullName("Samuel L. Jackson");
      samuel.addStarsInMovie(phantomMovie);
      samuel.addStarsInMovie(clonesMovie);
      samuel.addStarsInMovie(revengeMovie);
      samuel.addPortrayals(windu);

      Crew lee = framedGraph.addVertex("Christopher Lee", Crew.class);
      lee.setFullName("Christopher Lee");
      lee.addStarsInMovie(clonesMovie);
      lee.addStarsInMovie(revengeMovie);
      lee.addPortrayals(tyranus);

      Crew morrison = framedGraph.addVertex("Temuera Morrison", Crew.class);
      morrison.setFullName("Temuera Morrison");
      morrison.addStarsInMovie(clonesMovie);
      morrison.addPortrayals(jango);

      Crew logan = framedGraph.addVertex("Daniel Logan", Crew.class);
      logan.setFullName("Daniel Logan");
      logan.addStarsInMovie(clonesMovie);
      logan.addPortrayals(boba);

      Crew blake = framedGraph.addVertex("Paul Blake", Crew.class);
      blake.setFullName("Paul Blake");
      blake.addStarsInMovie(newhopeMovie);
      blake.addPortrayals(greedo);

      Crew lawson = framedGraph.addVertex("Denis Lawson", Crew.class);
      lawson.setFullName("Denis Lawson");
      lawson.addStarsInMovie(newhopeMovie);
      lawson.addStarsInMovie(empireMovie);
      lawson.addStarsInMovie(jediMovie);
      lawson.addPortrayals(wedge);

      Kills curKills = null;
      curKills = anakin.addKills(obiwan);
      curKills.setFilm(newhopeMovie.asVertex().getId().toString());
      curKills = luke.addKills(tarkin);
      curKills.setFilm(newhopeMovie.asVertex().getId().toString());
      curKills = windu.addKills(jango);
      curKills.setFilm(clonesMovie.asVertex().getId().toString());
      curKills = palpatine.addKills(windu);
      curKills.setFilm(revengeMovie.asVertex().getId().toString());
      curKills = wedge.addKills(anakin);
      curKills.setFilm(jediMovie.asVertex().getId().toString());
      curKills = lando.addKills(anakin);
      curKills.setFilm(jediMovie.asVertex().getId().toString());
      curKills = anakin.addKills(palpatine);
      curKills.setFilm(jediMovie.asVertex().getId().toString());
      curKills = maul.addKills(quigon);
      curKills.setFilm(phantomMovie.asVertex().getId().toString());
      curKills = obiwan.addKills(maul);
      curKills.setFilm(phantomMovie.asVertex().getId().toString());
      curKills = han.addKills(greedo);
      curKills.setFilm(newhopeMovie.asVertex().getId().toString());
      curKills = han.addKills(boba);
      curKills.setFilm(jediMovie.asVertex().getId().toString());
      curKills = anakin.addKills(tyranus);
      curKills.setFilm(revengeMovie.asVertex().getId().toString());

      anakin.addSpawns(threepio);
      anakin.addSpawns(luke);
      anakin.addSpawns(leia);
      padme.addSpawns(luke);
      padme.addSpawns(leia);
      shmi.addSpawns(anakin);
      jango.addSpawns(boba);

      graph.commit();

    } catch (Throwable t) {
      t.printStackTrace();
    }
    long testEndTime = System.nanoTime();
    System.out.println(
        "Completed "
            + getClass().getSimpleName()
            + " run in "
            + ((testEndTime - testStartTime) / 1000000)
            + " ms");
  }