Examples of Factory


Examples of apigen.adt.api.Factory

    params.setFolding(false);
    return params;
  }

  public static void generateAPI(CGenerationParameters params, ADT adt) {
    Factory factory = Factory.getInstance(SingletonFactory.getInstance());
    APIGenerator apigen = new APIGenerator(params, adt);
    apigen.run();
    new CDictionaryGenerator(adt, params, factory.getPureFactory(), apigen
        .getAFunRegister()).run();
    try {
      PrintStream out = new PrintStream(new FileOutputStream(params
          .getOutputDirectory()
          + File.separatorChar + "apigen.env"));
View Full Code Here

Examples of au.csiro.ontology.Factory

        // This set will contain the base axioms
        Set<Axiom> baseAxioms = new HashSet<Axiom>();
       
        // The factory can be used to create axioms using the default
        // implementing classes
        Factory f = new Factory();
       
        // The factory returns IConcepts - in this case the actual type is
        // INamedConcept<String>
        Concept endocardium = f.createNamedConcept("Endocardium");
        Concept tissue = f.createNamedConcept("Tissue");
        Concept heartWall = f.createNamedConcept("HeartWall");
        Concept heartValve = f.createNamedConcept("HeartValve");
        Concept bodyWall = f.createNamedConcept("BodyWall");
        Concept heart = f.createNamedConcept("Heart");
        Concept bodyValve = f.createNamedConcept("BodyValve");
        Concept endocarditis = f.createNamedConcept("Endocarditis");
        Concept inflammation = f.createNamedConcept("Inflammation");
        Concept disease = f.createNamedConcept("Disease");
        Concept heartDisease = f.createNamedConcept("HeartDisease");
        Concept criticalDisease = f.createNamedConcept("CriticalDisease");
       
        // The factory can also be used to create roles
        Role actsOn = f.createNamedRole("acts-on");
        Role partOf = f.createNamedRole("part-of");
        Role contIn = f.createNamedRole("cont-in");
        Role hasLoc = f.createNamedRole("has-loc");
       
        // Finally, the factory can be used to create axioms
        Concept lhs = endocardium;
        Concept rhs = f.createConjunction(
                tissue,
                f.createExistential((NamedRole) contIn, heartWall),
                f.createExistential((NamedRole) contIn, heartValve)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        lhs = heartWall;
        rhs = f.createConjunction(
                bodyWall,
                f.createExistential((NamedRole) partOf, heart)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        lhs = heartValve;
        rhs = f.createConjunction(
                bodyValve,
                f.createExistential((NamedRole) partOf, heart)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        lhs = endocarditis;
        rhs = f.createConjunction(
                inflammation,
                f.createExistential((NamedRole) hasLoc, endocardium)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));

        lhs = inflammation;
        rhs = f.createConjunction(
                disease,
                f.createExistential(actsOn, tissue)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        lhs = f.createConjunction(
                heartDisease,
                f.createExistential(hasLoc, heartValve)
        );
        rhs = criticalDisease;
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        // There is no direct support in the API to create an equivalence axiom
        // so it has to be created using two concept inclusion axioms
        lhs = heartDisease;
        rhs = f.createConjunction(
                disease,
                f.createExistential(hasLoc, heart)
        );
        baseAxioms.add(f.createConceptInclusion(lhs, rhs));
        baseAxioms.add(f.createConceptInclusion(rhs, lhs));
       
        Role[] rlhs = new Role[]{partOf, partOf};
        Role rrhs = partOf;
        baseAxioms.add(f.createRoleInclusion(rlhs, rrhs));
       
        rlhs = new Role[]{partOf};
        rrhs = contIn;
        baseAxioms.add(f.createRoleInclusion(rlhs, rrhs));
       
        rlhs = new Role[]{hasLoc, contIn};
        rrhs = hasLoc;
        baseAxioms.add(f.createRoleInclusion(rlhs, rrhs));
       
        // The first time the classify method is called it runs a full
        // classification
        reasoner.loadAxioms(baseAxioms);
        reasoner.classify();
       
        // If classification worked properly then Endocarditis should be
        // classified not only as an Inflammation but also as a HeartDisease
        // and a CriticalDisease
        Ontology t = reasoner.getClassifiedOntology();
       
        // We use the same id that was used to create the concept to look for
        // the corresponding node in the taxonomy
        Node endocarditisNode = t.getNode("Endocarditis");
        System.out.println("Node for endocarditis:\n  "+
                endocarditisNode.getEquivalentConcepts());
       
       
        // We can now print the equivalent concepts in the node and the parent
        // nodes
        Set<Node> parentNodes = endocarditisNode.getParents();
        System.out.println("Parents of endocarditis:");
        for(Node parentNode : parentNodes) {
            System.out.println("  "+parentNode.getEquivalentConcepts());
        }
       
        // We can now add more axioms to the ontology and re-run the
        // classification
        Set<Axiom> additionalAxioms = new HashSet<Axiom>();
       
        Concept heartInflammation = f.createNamedConcept("HeartInflammation");
       
        lhs = heartInflammation;
        rhs = inflammation;
        additionalAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        lhs = endocarditis;
        rhs = f.createConjunction(
                heartInflammation,
                f.createExistential(hasLoc, endocardium)
        );
        additionalAxioms.add(f.createConceptInclusion(lhs, rhs));
       
        // Subsequent invocations will trigger an incremental classification
        System.out.println("Running incremental classification:");
        reasoner.loadAxioms(additionalAxioms);
        reasoner.classify();
View Full Code Here

Examples of com.alibaba.jstorm.zk.Factory

    try {
      List<String> tmpDirs = new ArrayList();

      String zkDir = getTmpDir();
      tmpDirs.add(zkDir);
      Factory zookeeper = startLocalZookeeper(zkDir);
      Map conf = getLocalConf(zookeeper.getZooKeeperServer()
          .getClientPort());

      String nimbusDir = getTmpDir();
      tmpDirs.add(nimbusDir);
      Map nimbusConf = deepCopyMap(conf);
View Full Code Here

Examples of com.commongroundpublishing.rubylet.Factory

     *
     * <p>FIXME: If any restartables throw exceptions, the old
     * factory will not be destroyed, and we may leak runtimes...
     */
    public void restart() {
        final Factory oldFactory = assertNotNull(factory);
        factory = null;
        init(assertNotNull(originalConfig));
       
        for (Restartable r : restartables) {
            try {
                r.restart();
            } catch (ServletException e) {
                logger.error("{}: error restarting {}",
                             new Object[] { this, r },
                             e);
            }
        }
       
        oldFactory.unreference(this)// find unref destroys factory
    }
View Full Code Here

Examples of com.github.youtube.vitess.jdbc.bson.VtoccBsonBlockingRpcChannel.Factory

   * Example: {@code -DvtoccServerSpec=localhost:1610}
   */
  @Test
  @Ignore
  public void testWithParentServer() throws Exception {
    Factory channelFactory = Guice.createInjector().getInstance(Factory.class);

    VtoccBsonBlockingRpcChannel channel =
        channelFactory.create(System.getProperty("vtoccServerSpec"));

    Message response = channel.callBlockingMethod("GetSessionId",
        SessionParams.newBuilder().setKeyspace("test_keyspace").setShard("0").build());

    assertNotNull(response);
View Full Code Here

Examples of com.google.api.explorer.client.base.ApiDirectory.Factory

    try {
      Reader reader = new InputStreamReader(stream, Charsets.UTF_8);
      String jsonString = CharStreams.toString(reader);
      stream.close();

      Factory factory = AutoBeanFactorySource.create(Factory.class);
      return AutoBeanCodex.decode(factory, ApiDirectory.class, jsonString).as();
    } catch (IOException e) {
      fail("IOException: " + e.getMessage());
    }
    return null;
View Full Code Here

Examples of com.google.api.explorer.client.base.rest.RestApiService.Helper.Factory

    try {
      Reader reader = new InputStreamReader(stream, Charsets.UTF_8);
      String jsonString = CharStreams.toString(reader);
      stream.close();

      Factory factory = AutoBeanFactorySource.create(Factory.class);
      RestApiService service =
          AutoBeanCodex.decode(factory, RestApiService.class, jsonString).as();
      return service;
    } catch (IOException e) {
      fail("IOException: " + e.getMessage());
View Full Code Here

Examples of com.google.gwt.gears.client.Factory

  public String getModuleName() {
    return "com.google.gwt.gears.Gears";
  }

  public void testCrop() {
    final Factory factory = Factory.getInstance();

    Canvas canvas = factory.createCanvas();
    canvas.crop(40, 40, 100, 100);
    assertEquals(100, canvas.getWidth());
    assertEquals(100, canvas.getHeight());
  }
View Full Code Here

Examples of com.google.jstestdriver.action.ConfigureGatewayAction.Factory

    assertSequence(expectedActions, sequence);
  }

  private Factory newConfigureGatewayActionFactory() {
    return new Factory() {
      @Override
      public ConfigureGatewayAction create(JsonArray gatewayConfig) {
        return new ConfigureGatewayAction(null, null, null, null, gatewayConfig);
      }
    };
View Full Code Here

Examples of com.ibm.icu.impl.ICUService.Factory

        RegisterFactoryThread(String name, ICUService service, long delay, TestLog log) {
            super("REG " + name, service, delay, log);
        }

        protected void iterate() {
            Factory f = new TestFactory(getCLV());
            service.registerFactory(f);
            log.logln(f.toString());
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.