コード例 #1
0
ファイル: TestNeq.java プロジェクト: rssh/termware2
 public boolean runTest(IEnv env) {
   try {
     TermSystem general = TermWare.getInstance().getRoot().resolveSystem("general");
     Term t = TermWare.getInstance().getTermFactory().createParsedTerm("neq(p(x),p(x))");
     Term r = general.reduce(t);
     if (!(r.isBoolean() && r.getBoolean() == false)) {
       System.out.println("r1=" + TermHelper.termToString(r));
       return false;
     }
     t = TermWare.getInstance().getTermFactory().createParsedTerm("neq(p(\"x\"),p(\"x\"))");
     r = general.reduce(t);
     if (r.isBoolean()) {
       if (r.getBoolean() == false) {
         return true;
       } else {
         return false;
       }
     } else {
       System.out.println("r2=" + TermHelper.termToString(r));
       return false;
     }
   } catch (TermWareException ex) {
     ex.printStackTrace();
     return false;
   }
 }
コード例 #2
0
 public JavaWildcardBoundsTypeModel(
     Term t, JavaTypeModel where, List<JavaTypeVariableAbstractModel> typeParameters)
     throws TermWareException {
   super(where.getPackageModel());
   if (t.getName().equals("WildcardBounds")) {
     String stype = t.getSubtermAt(0).getName();
     if (stype.equals("extends")) {
       kind_ = JavaWildcardBoundsKind.EXTENDS;
     } else if (stype.equals("super")) {
       kind_ = JavaWildcardBoundsKind.SUPER;
     } else {
       throw new AssertException(
           "'extends' or 'super' is expected as the 0 subterm of " + TermHelper.termToString(t));
     }
     try {
       boundTypeModel_ = JavaResolver.resolveTypeToModel(t.getSubtermAt(1), where, typeParameters);
     } catch (EntityNotFoundException ex) {
       boundTypeModel_ = JavaUnknownTypeModel.INSTANCE;
     }
   } else {
     throw new AssertException(
         "WildcardBounds term is expected, instead " + TermHelper.termToString(t));
   }
 }