Package de.uniol.informatik.vlba.prototype

Examples of de.uniol.informatik.vlba.prototype.Config


  public static void main(String[] args) {

    // ---------------- Section: Necessary initializations and
    // registrations-----
    Config config = Config.getInstance();
    PackagingManager.getInstance()
        .registerPackager(new StateOnlyPackager());
    ResourceManager.getInstance().registerResourceProvider(
        new SimpleIntResourceProvider());
    ServiceManager.getInstance().registerService(
        new IntHarvestersHomeService(1000));// here the target value  <----
    ServiceManager.getInstance().registerService(
        new IntHarvestersForeignService());
    try {
      P2PManager.getInstance().registerP2PNetwork(
          (P2PNetwork) Class.forName(config.getP2p_protocol())
              .newInstance());
    } catch (Throwable e) {
      System.out.println(e.getMessage());
    }

    P2PManager.getInstance().connect();

    ContainerManager.getInstance().setContainer(
        SimpleContainer.getInstance());
    ContainerManager.getInstance().getContainer().addContainerListener(
        new SimpleContainerLogComponent());
    ContainerManager.getInstance().getContainer().addContainerListener(SimpleContainer.getInstance().scv);
    MessagingManager.getInstance().registerMessagingProvider(
        new PidginMessageProvider());
    // -----------------End Section-----------------------------------------
   
 
   
    // ---------------- Section: Test Cocoon with XML ----------------------
    try {
      List<Gene> genes = new ArrayList<Gene>();

      genes.add(new FieldGene(SimpleIntHarvester.class
          .getDeclaredField("danceThreshold"), 5));
      genes.add(new FieldGene(SimpleIntHarvester.class
          .getDeclaredField("someString"), "menewstring"));

      genes.add(new MethodGene(1, 1));
      genes.add(new MethodGene(2, 1));
      genes.add(new MethodGene(3, 1));
      genes.add(new MethodGene(4, 1));
      genes.add(new MethodGene(5, 1));
      genes.add(new MethodGene(6, 1));
      genes.add(new MethodGene(7, 1));
      genes.add(new MethodGene(8, 1));
      genes.add(new MethodGene(9, 1));
      genes.add(new MethodGene(10, 1));
      genes.add(new MethodGene(11, 1));

      BeeDNA b = new BeeDNA(genes, "SimpleIntHarvester");

      String repPath = "src/de/uniol/informatik/vlba/intharvesters/unittest/behavior_repository.xml";

      System.out.println("Get a cocoon");
      Cocoon cocoon = new Cocoon(SimpleIntHarvester.class);

      // cocoon.createBees(b, 10, repPath);
      List<Bee> beeslst = cocoon
          .instanciateBees(config.getAgent_number(),
              "de.uniol.informatik.vlba.prototype.agent.Agent_1270717415470");
      SimpleIntHarvester[] bees = (SimpleIntHarvester[]) (beeslst
          .toArray(new SimpleIntHarvester[0]));
     
      //-----------------------------Diversify---
View Full Code Here


   * <p>
   * Default constructor initializing the network.
   * </p>
   */
  public PidginP2P() {
    Config config = Config.getInstance();
    // Connect to DBus and get object of PurpleInterface
    this.connect();
    try {
      // read in account
      // BufferedReader in =
      // new BufferedReader(
      // new InputStreamReader(new FileInputStream("account.txt")));
      BufferedReader in = new BufferedReader(new InputStreamReader(
          new FileInputStream(config.getAccount_file())));
      while (account == 0 && in.ready()) {
        String line = in.readLine().trim();
        if (line.startsWith("#") || line.equals(""))
          continue;

View Full Code Here

   * @return <code>Array</code> with all buddies as <code>Node</code>s
   */
  @Override
  public Node[] getNeighborNodes() {
    // TODO Does the list of neighbors always have to be updated?
    Config config = Config.getInstance();
    refreshAvailableNeighbors(config, true);
    return nodesArray;
  }
View Full Code Here

   * @param args
   */
  public static void main(String[] args) {

    // ----------- Section: Necessary initializations and registrations-----
    Config config = Config.getInstance();
    PackagingManager.getInstance()
        .registerPackager(new StateOnlyPackager());
    ResourceManager.getInstance().registerResourceProvider(
        new SimpleIntResourceProvider());
    ServiceManager.getInstance().registerService(
        new SemBeesHomeService(1000));// here the target value <----
    ServiceManager.getInstance().registerService(
        new SemBeesForeignService());
    try {
      P2PManager.getInstance().registerP2PNetwork(
          (P2PNetwork) Class.forName(config.getP2p_protocol())
              .newInstance());
    } catch (Throwable e) {
      System.out.println(e.getMessage());
    }

    P2PManager.getInstance().connect();

    ContainerManager.getInstance().setContainer(SemContainer.getInstance());
    ContainerManager.getInstance().getContainer().addContainerListener(
        new SimpleContainerLogComponent());
    ContainerManager.getInstance().getContainer().addContainerListener(
        SemContainer.getInstance().scv);
    MessagingManager.getInstance().registerMessagingProvider(
        new PidginMessageProvider());
    // -----------------End Section-----------------------------------------

    // ---------------- Section: Test Cocoon with XML ----------------------
    try {
      List<Gene> genes = new ArrayList<Gene>();

      genes.add(new FieldGene(SemHarvester.class
          .getDeclaredField("danceThreshold"), 5));

      genes.add(new MethodGene(1, 2));
      genes.add(new MethodGene(2, 2));
      genes.add(new MethodGene(3, 2));
      genes.add(new MethodGene(4, 2));
      genes.add(new MethodGene(5, 2));
      genes.add(new MethodGene(6, 2));
      genes.add(new MethodGene(7, 2));
      genes.add(new MethodGene(8, 2));
      genes.add(new MethodGene(9, 2));
      genes.add(new MethodGene(10, 2));
      genes.add(new MethodGene(11, 2));

      BeeDNA b = new BeeDNA(genes, "SemHarvester");

      String repPath = "src/de/uniol/informatik/vlba/intharvesters/unittest/behavior_repository.xml";

      System.out.println("Get a cocoon");
      Cocoon cocoon = new Cocoon(SemHarvester.class);

      // cocoon.createBees(b, 10, repPath);
      List<Bee> beeslst = cocoon
          .instanciateBees(config.getAgent_number(),
              "de.uniol.informatik.vlba.prototype.agent.sembees.Agent_sem123456");
      SemHarvester[] bees = (SemHarvester[]) (beeslst
          .toArray(new SemHarvester[0]));

      // -----------------------------Diversify---
View Full Code Here

TOP

Related Classes of de.uniol.informatik.vlba.prototype.Config

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.