Package jp.ac.kobe_u.cs.prolog.lang

Examples of jp.ac.kobe_u.cs.prolog.lang.IllegalTypeException


    Object value = null;

    // 3rd. argument (unbound variable)
    a3 = a3.dereference();
    if (!a3.isVariable()) {
      throw new IllegalTypeException(this, 3, "variable", a3);
    }
    try {
      // 1st. argument (atom or java term)
      a1 = a1.dereference();
      if (a1.isVariable()) {
        throw new PInstantiationException(this, 1);
      } else if (a1.isSymbol()) { // class
        clazz = Class.forName(((SymbolTerm) a1).name());
      } else if (a1.isJavaObject()) { // instance
        instance = ((JavaObjectTerm) a1).object();
        clazz = ((JavaObjectTerm) a1).getClazz();
      } else {
        throw new IllegalTypeException(this, 1, "atom_or_java", a1);
      }
      // 2nd. argument (atom)
      a2 = a2.dereference();
      if (a2.isVariable()) {
        throw new PInstantiationException(this, 2);
      } else if (!a2.isSymbol()) {
        throw new IllegalTypeException(this, 2, "atom", a2);
      }
      field = clazz.getDeclaredField(((SymbolTerm) a2).name());
      field.setAccessible(true);
      value = field.get(instance);
      // 3rd. argument
View Full Code Here


    a2 = a2.dereference();
    if (a2.isVariable()) {
      throw new PInstantiationException(this, 2);
    }
    if (!a2.isSymbol()) {
      throw new IllegalTypeException(this, 2, "character", a2);
    }
    // S_or_a
    a1 = a1.dereference();
    if (a1.isVariable()) {
      throw new PInstantiationException(this, 1);
    } else if (a1.isSymbol()) {
      if (!engine.getStreamManager().containsKey(a1)) {
        throw new ExistenceException(this, 1, "stream", a1, "");
      }
      stream = ((JavaObjectTerm) engine.getStreamManager().get(a1))
          .object();
    } else if (a1.isJavaObject()) {
      stream = ((JavaObjectTerm) a1).object();
    } else {
      throw new IllegalDomainException(this, 1, "stream_or_alias", a1);
    }
    if (!(stream instanceof PrintWriter)) {
      throw new PermissionException(this, "output", "stream", a1, "");
    }
    // print single character
    str = ((SymbolTerm) a2).name();
    if (str.length() != 1) {
      throw new IllegalTypeException(this, 2, "character", a2);
    }
    c = str.charAt(0);
    if (!Character.isDefined(c)) {
      throw new RepresentationException(this, 2, "character");
    }
View Full Code Here

    while (!tmp.isNil()) {
      if (tmp.isVariable()) {
        throw new PInstantiationException(this, 2);
      }
      if (!tmp.isList()) {
        throw new IllegalTypeException(this, 2, "list", a2);
      }
      Term car = ((ListTerm) tmp).car().dereference();
      if (car.isVariable()) {
        throw new PInstantiationException(this, 2);
      }
View Full Code Here

        }
        //END inline expansion
        //START inline expansion of $cut(a(3))
        a3 = a3.dereference();
        if (! a3.isInteger()) {
            throw new IllegalTypeException("integer", a3);
        } else {
            engine.cut(((IntegerTerm) a3).intValue());
        }
        //END inline expansion
        return new PRED_$stream_property_2(a1, a2, cont);
View Full Code Here

        }
        //END inline expansion
        //START inline expansion of $cut(a(7))
        a7 = a7.dereference();
        if (! a7.isInteger()) {
            throw new IllegalTypeException("integer", a7);
        } else {
            engine.cut(((IntegerTerm) a7).intValue());
        }
        //END inline expansion
        p1 = new PRED_$fast_write_2(a6, a1, cont);
View Full Code Here

        }
        //END inline expansion
        //START inline expansion of $cut(a(7))
        a7 = a7.dereference();
        if (! a7.isInteger()) {
            throw new IllegalTypeException("integer", a7);
        } else {
            engine.cut(((IntegerTerm) a7).intValue());
        }
        //END inline expansion
        p1 = new PRED_$fast_write_2(a6, a1, cont);
View Full Code Here

    a2 = a2.dereference();
    if (a2.isVariable()) {
      throw new PInstantiationException(this, 2);
    }
    if (!a2.isInteger()) {
      throw new IllegalTypeException(this, 2, "byte", a2);
    }
    c = ((IntegerTerm) a2).intValue();
    if (c < 0 || c > 255) {
      throw new IllegalTypeException(this, 2, "byte", a2);
    }
    // S_or_a
    a1 = a1.dereference();
    if (a1.isVariable()) {
      throw new PInstantiationException(this, 1);
View Full Code Here

        }
        //END inline expansion
        //START inline expansion of $cut(a(7))
        a7 = a7.dereference();
        if (! a7.isInteger()) {
            throw new IllegalTypeException("integer", a7);
        } else {
            engine.cut(((IntegerTerm) a7).intValue());
        }
        //END inline expansion
        p1 = new PRED_$fast_write_2(a6, a1, cont);
View Full Code Here

        }
        //END inline expansion
        //START inline expansion of $cut(a(7))
        a7 = a7.dereference();
        if (! a7.isInteger()) {
            throw new IllegalTypeException("integer", a7);
        } else {
            engine.cut(((IntegerTerm) a7).intValue());
        }
        //END inline expansion
        p1 = new PRED_$fast_write_2(a6, a1, cont);
View Full Code Here

        }
        //END inline expansion
        //START inline expansion of $cut(a(7))
        a7 = a7.dereference();
        if (! a7.isInteger()) {
            throw new IllegalTypeException("integer", a7);
        } else {
            engine.cut(((IntegerTerm) a7).intValue());
        }
        //END inline expansion
        return new PRED_$write_atom_5(a1, a3, a4, a5, a6, cont);
View Full Code Here

TOP

Related Classes of jp.ac.kobe_u.cs.prolog.lang.IllegalTypeException

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.