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

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


    a1 = a1.dereference();
    a2 = a2.dereference();

    if (a1.isVariable()) {
      throw new PInstantiationException(this, 1);
    }
    if (!a1.isSymbol()) {
      throw new IllegalTypeException(this, 1, "atom", a1);
    }
    length = ((SymbolTerm) a1).name().length();
View Full Code Here


    Object hash = null;

    a1 = a1.dereference();
    if (a1.isVariable()) {
      throw new PInstantiationException(this, 1);
    } else if (a1.isSymbol()) {
      if (!engine.getHashManager().containsKey(a1)) {
        throw new ExistenceException(this, 1, "hash", a1, "");
      }
      hash = ((JavaObjectTerm) engine.getHashManager().get(a1)).object();
View Full Code Here

    Object hash = null;

    a1 = a1.dereference();
    if (a1.isVariable()) {
      throw new PInstantiationException(this, 1);
    } else if (a1.isSymbol()) {
      if (!engine.getHashManager().containsKey(a1)) {
        throw new ExistenceException(this, 1, "hash", a1, "");
      }
      hash = ((JavaObjectTerm) engine.getHashManager().get(a1)).object();
View Full Code Here

    Object stream = null;

    // 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))
View Full Code Here

    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.getField(((SymbolTerm) a2).name());
      // 3rd. argument (term)
View Full Code Here

    Object stream = null;

    // 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))
View Full Code Here

    Object hash = null;

    a1 = a1.dereference();
    if (a1.isVariable()) {
      throw new PInstantiationException(this, 1);
    } else if (a1.isSymbol()) {
      if (!engine.getHashManager().containsKey(a1)) {
        throw new ExistenceException(this, 1, "hash", a1, "");
      }
      hash = ((JavaObjectTerm) engine.getHashManager().get(a1)).object();
View Full Code Here

        return engine.fail();
      }
    } else if (a1.isVariable()) {
      a2 = a2.dereference();
      if (a2.isVariable()) {
        throw new PInstantiationException(this, 2);
      } else if (a2.equals(SYM_NIL)) {
        throw new IllegalDomainException(this, 2, "non_empty_list", a2);
      } else if (!a2.isList()) {
        throw new IllegalTypeException(this, 2, "list", a2);
      }
      Term head = ((ListTerm) a2).car().dereference();
      Term tail = ((ListTerm) a2).cdr().dereference();
      if (head.isVariable()) {
        throw new PInstantiationException(this, 2);
      }
      if (tail.equals(SYM_NIL)) {
        if (head.isSymbol() || head.isNumber() || head.isJavaObject()
            || head.isClosure()) {
          if (!a1.unify(head, engine.trail)) {
            return engine.fail();
          }
          return cont;
        } else {
          throw new IllegalTypeException(this, 2, "atomic", head);
        }
      }
      if (!head.isSymbol()) {
        throw new IllegalTypeException(this, 2, "atom", head);
      }
      Term x = tail;
      while (!x.equals(SYM_NIL)) {
        if (x.isVariable()) {
          throw new PInstantiationException(this, 2);
        }
        if (!x.isList()) {
          throw new IllegalTypeException(this, 2, "list", a2);
        }
        x = ((ListTerm) x).cdr().dereference();
View Full Code Here

    Term a1;
    a1 = arg1;

    a1 = a1.dereference();
    if (a1.isVariable()) {
      throw new PInstantiationException(this, 1);
    }
    if (!a1.isJavaObject()) {
      throw new IllegalTypeException(this, 1, "java", a1);
    }
    Object obj = ((JavaObjectTerm) a1).object();
View Full Code Here

      }
    }
    // 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))
View Full Code Here

TOP

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

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.