Examples of Atom


Examples of org.nutz.trans.Atom

    });
  }

  @Test
  public void update_links() {
    TableName.run(platoon, new Atom() {
      public void run() {
        Tank t = dao.fetchLinks(dao.fetch(Tank.class, "T92"), "members");
        t.setWeight(42);
        t.getMembers().get("ZZH").setAge(30);
        t.getMembers().get("Mick").setAge(22);
View Full Code Here

Examples of org.nutz.trans.Atom

    });
  }

  @Test
  public void update_with() {
    TableName.run(platoon, new Atom() {
      public void run() {
        Tank t = dao.fetchLinks(dao.fetch(Tank.class, "T92"), "members");
        t.setWeight(42);
        t.getMembers().get("ZZH").setAge(30);
        t.getMembers().get("Mick").setAge(22);
View Full Code Here

Examples of org.nutz.trans.Atom

    assertTrue(null != dao.fetch(Pet.class, 1));
    assertTrue(null != dao.fetch(Pet.class, 2));
    assertTrue(null != dao.fetch(Pet.class, 3));

    FieldFilter.create(Pet.class, "name|id").run(new Atom() {
      public void run() {
        assertTrue(null != dao.fetch(Pet.class));
      }
    });
  }
View Full Code Here

Examples of org.nutz.trans.Atom

    pojos.dropPlatoon(p.getId());
  }

  @Test
  public void fetch_null_field_links() {
    TableName.run(platoon, new Atom() {
      public void run() {
        Platoon p = dao.fetchLinks(dao.fetch(Platoon.class), "tanks|soliders");
        assertEquals(2, p.getTanks().size());
        assertEquals(5, p.getSoliders().size());
      }
View Full Code Here

Examples of org.nutz.trans.Atom

    });
  }

  @Test
  public void delete_links() {
    TableName.run(platoon, new Atom() {
      public void run() {
        Soldier s = dao.fetchLinks(dao.fetch(Soldier.class, "ZZH"), "guns");
        assertEquals(3, s.getGuns().length);
        dao.deleteLinks(s, "guns");
        assertEquals(8, dao.count(Gun.class));
View Full Code Here

Examples of org.nutz.trans.Atom

  public Platoon create4Platoon(Base base, String name) {
    final Platoon p = dao().insert(Platoon.make(base, name));
    int id = p.getId();
    initPlatoon(id);
    TableName.run(id, new Atom() {
      public void run() {
        Soldier mick = Soldier.make("Mick");
        Soldier zzh = Soldier.make("ZZH");
        Soldier peter = Soldier.make("Peter");
        Soldier sm = Soldier.make("Super Man");
View Full Code Here

Examples of org.openscience.cdk.Atom

      }
    }

    if(mol == null && request.getParameter("element") != null && (request.getParameter("element").length() > 0)) {
      String elemSymbol = request.getParameter("element");
      Atom a = new Atom(elemSymbol);
      a.setPoint2d(new Point2d(0.0, 0.0));
      mol = new Molecule();
      mol.addAtom(a);
      makeStructure = false;
    }
   
View Full Code Here

Examples of org.semanticweb.HermiT.model.Atom

        }
        public DLClause getSwappedDLClause(int bodyIndex) {
            m_nodeIDComparisonAtoms.clear();
            for (int index=m_usedAtoms.length-1;index>=0;--index) {
                m_usedAtoms[index]=false;
                Atom atom=m_dlClause.getBodyAtom(index);
                if (NodeIDLessEqualThan.INSTANCE.equals(atom.getDLPredicate()))
                    m_nodeIDComparisonAtoms.add(atom);
            }
            m_reorderedAtoms.clear();
            m_boundVariables.clear();
            Atom atom=m_dlClause.getBodyAtom(bodyIndex);
            atom.getVariables(m_boundVariables);
            m_reorderedAtoms.add(atom);
            m_usedAtoms[bodyIndex]=true;
            while (m_reorderedAtoms.size()!=m_usedAtoms.length) {
                Atom bestAtom=null;
                int bestAtomIndex=-1;
                int bestAtomGoodness=-1000;
                for (int index=m_usedAtoms.length-1;index>=0;--index)
                    if (!m_usedAtoms[index]) {
                        atom=m_dlClause.getBodyAtom(index);
                        int atomGoodness=getAtomGoodness(atom);
                        if (atomGoodness>bestAtomGoodness) {
                            bestAtom=atom;
                            bestAtomGoodness=atomGoodness;
                            bestAtomIndex=index;
                        }
                    }
                m_reorderedAtoms.add(bestAtom);
                m_usedAtoms[bestAtomIndex]=true;
                bestAtom.getVariables(m_boundVariables);
                m_nodeIDComparisonAtoms.remove(bestAtom);
            }
            Atom[] bodyAtoms=new Atom[m_reorderedAtoms.size()];
            m_reorderedAtoms.toArray(bodyAtoms);
            return m_dlClause.getChangedDLClause(null,bodyAtoms);
View Full Code Here

Examples of org.semanticweb.HermiT.model.Atom

                    if (m_boundVariables.contains(unboundVariable))
                        unboundVariable=atom.getArgumentVariable(1);
                    // At this point, unboundVariable must be really unbound because
                    // we have already established that numberOfUnboundVariables==1.
                    for (int compareAtomIndex=m_nodeIDComparisonAtoms.size()-1;compareAtomIndex>=0;--compareAtomIndex) {
                        Atom compareAtom=m_nodeIDComparisonAtoms.get(compareAtomIndex);
                        Variable argument0=compareAtom.getArgumentVariable(0);
                        Variable argument1=compareAtom.getArgumentVariable(1);
                        if ((m_boundVariables.contains(argument0) || unboundVariable.equals(argument0)) && (m_boundVariables.contains(argument1) || unboundVariable.equals(argument1))) {
                            goodness+=5;
                            break;
                        }
                    }
View Full Code Here

Examples of org.semanticweb.HermiT.model.Atom

            m_bodyDLClause=bodyDLClause;
            m_headDLClauses=headDLClauses;
            m_variables=new ArrayList<Variable>();
            int numberOfRealAtoms=0;
            for (int bodyIndex=0;bodyIndex<getBodyLength();bodyIndex++) {
                Atom atom=getBodyAtom(bodyIndex);
                for (int argumentIndex=0;argumentIndex<atom.getArity();argumentIndex++) {
                    Variable variable=atom.getArgumentVariable(argumentIndex);
                    if (variable!=null && !m_variables.contains(variable) && occursInBodyAtomsAfter(variable,bodyIndex+1))
                        m_variables.add(variable);
                }
                if (!atom.getDLPredicate().equals(NodeIDLessEqualThan.INSTANCE) && !(atom.getDLPredicate() instanceof NodeIDsAscendingOrEqual))
                    numberOfRealAtoms++;
            }
            for (int dlClauseIndex=0;dlClauseIndex<getNumberOfHeads();dlClauseIndex++) {
                for (int headIndex=0;headIndex<getHeadLength(dlClauseIndex);headIndex++) {
                    Atom atom=getHeadAtom(dlClauseIndex,headIndex);
                    for (int argumentIndex=0;argumentIndex<atom.getArity();argumentIndex++) {
                        Variable variable=atom.getArgumentVariable(argumentIndex);
                        if (variable!=null && !m_variables.contains(variable))
                            m_variables.add(variable);
                    }
                }
            }
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.