Package jp.ac.kobe_u.cs.prolog.builtin

Source Code of jp.ac.kobe_u.cs.prolog.builtin.PRED_$retract_spypoint_1_2

package jp.ac.kobe_u.cs.prolog.builtin;
import jp.ac.kobe_u.cs.prolog.lang.IntegerTerm;
import jp.ac.kobe_u.cs.prolog.lang.ListTerm;
import jp.ac.kobe_u.cs.prolog.lang.Predicate;
import jp.ac.kobe_u.cs.prolog.lang.Prolog;
import jp.ac.kobe_u.cs.prolog.lang.StructureTerm;
import jp.ac.kobe_u.cs.prolog.lang.SymbolTerm;
import jp.ac.kobe_u.cs.prolog.lang.Term;
import jp.ac.kobe_u.cs.prolog.lang.VariableTerm;
/*
This file is generated by Prolog Cafe.
PLEASE DO NOT EDIT!
*/
/**
<code>'$retract_spypoint'/1</code> defined in builtins.pl<br>
@author Mutsunori Banbara (banbara@kobe-u.ac.jp)
@author Naoyuki Tamura (tamura@kobe-u.ac.jp)
@version 1.0
*/
class PRED_$retract_spypoint_1 extends Predicate {
    static SymbolTerm s1 = SymbolTerm.makeSymbol(":", 2);
    static SymbolTerm s2 = SymbolTerm.makeSymbol("/", 2);
    static SymbolTerm s3 = SymbolTerm.makeSymbol("jp.ac.kobe_u.cs.prolog.builtin");
    static SymbolTerm s4 = SymbolTerm.makeSymbol("$current_spypoint", 3);
    static SymbolTerm s5 = SymbolTerm.makeSymbol("info");
    static SymbolTerm s6 = SymbolTerm.makeSymbol("spypoint");
    static SymbolTerm s7 = SymbolTerm.makeSymbol("is");
    static SymbolTerm s8 = SymbolTerm.makeSymbol("removed");
    static SymbolTerm s9 = SymbolTerm.makeSymbol("[]");
    static ListTerm s10 = new ListTerm(s8, s9);
    static ListTerm s11 = new ListTerm(s7, s10);
    static Predicate _$retract_spypoint_1_var = new PRED_$retract_spypoint_1_var();
    static Predicate _$retract_spypoint_1_var_1 = new PRED_$retract_spypoint_1_var_1();
    static Predicate _$retract_spypoint_1_1 = new PRED_$retract_spypoint_1_1();
    static Predicate _$retract_spypoint_1_2 = new PRED_$retract_spypoint_1_2();

    public Term arg1;

    public PRED_$retract_spypoint_1(Term a1, Predicate cont) {
        arg1 = a1;
        this.cont = cont;
    }

    public PRED_$retract_spypoint_1(){}

    public void setArgument(Term[] args, Predicate cont) {
        arg1 = args[0];
        this.cont = cont;
    }

    public int arity() { return 1; }

    public String toString() {
        return "$retract_spypoint(" + arg1 + ")";
    }

    public Predicate exec(Prolog engine) {
        engine.aregs[1] = arg1;
        engine.cont = cont;
        engine.setB0();
        return engine.switch_on_term(_$retract_spypoint_1_var, _$retract_spypoint_1_2, _$retract_spypoint_1_2, _$retract_spypoint_1_2, _$retract_spypoint_1_var, _$retract_spypoint_1_2);
    }
}

class PRED_$retract_spypoint_1_var extends PRED_$retract_spypoint_1 {
    public Predicate exec(Prolog engine) {
        return engine.jtry(_$retract_spypoint_1_1, _$retract_spypoint_1_var_1);
    }
}

class PRED_$retract_spypoint_1_var_1 extends PRED_$retract_spypoint_1 {
    public Predicate exec(Prolog engine) {
        return engine.trust(_$retract_spypoint_1_2);
    }
}

class PRED_$retract_spypoint_1_1 extends PRED_$retract_spypoint_1 {
    public Predicate exec(Prolog engine) {
    // '$retract_spypoint'(A:B/C):-retract('$current_spypoint'(A,B,C)),print_message(info,[spypoint,A:B/C,is,removed]),!
        Term a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12;
        Predicate p1, p2;
        Predicate cont;
        a1 = engine.aregs[1];
        cont = engine.cont;
    // '$retract_spypoint'(A:B/C):-['$get_level'(D),retract('jp.ac.kobe_u.cs.prolog.builtin':'$current_spypoint'(A,B,C)),print_message(info,[spypoint,A:B/C,is,removed]),'$cut'(D)]
        a1 = a1.dereference();
        if (a1.isStructure()){
            if (! s1.equals(((StructureTerm)a1).functor()))
                return engine.fail();
            Term[] args = ((StructureTerm)a1).args();
            a2 = args[0];
            a3 = args[1];
        } else if (a1.isVariable()){
            a2 = new VariableTerm(engine);
            a3 = new VariableTerm(engine);
            Term[] args = {a2, a3};
            ((VariableTerm) a1).bind(new StructureTerm(s1, args), engine.trail);
        } else {
            return engine.fail();
        }
        a3 = a3.dereference();
        if (a3.isStructure()){
            if (! s2.equals(((StructureTerm)a3).functor()))
                return engine.fail();
            Term[] args = ((StructureTerm)a3).args();
            a4 = args[0];
            a5 = args[1];
        } else if (a3.isVariable()){
            a4 = new VariableTerm(engine);
            a5 = new VariableTerm(engine);
            Term[] args = {a4, a5};
            ((VariableTerm) a3).bind(new StructureTerm(s2, args), engine.trail);
        } else {
            return engine.fail();
        }
        a6 = new VariableTerm(engine);
        //START inline expansion of $get_level(a(6))
        if (! a6.unify(new IntegerTerm(engine.B0), engine.trail)) {
            return engine.fail();
        }
        //END inline expansion
        Term[] y1 = {a2, a4, a5};
        a7 = new StructureTerm(s4, y1);
        Term[] y2 = {s3, a7};
        a8 = new StructureTerm(s1, y2);
        Term[] y3 = {a4, a5};
        a9 = new StructureTerm(s2, y3);
        Term[] y4 = {a2, a9};
        a10 = new StructureTerm(s1, y4);
        a11 = new ListTerm(a10, s11);
        a12 = new ListTerm(s6, a11);
        p1 = new PRED_$cut_1(a6, cont);
        p2 = new PRED_print_message_2(s5, a12, p1);
        return new PRED_retract_1(a8, p2);
    }
}

class PRED_$retract_spypoint_1_2 extends PRED_$retract_spypoint_1 {
    public Predicate exec(Prolog engine) {
    // '$retract_spypoint'(A):-true
        Term a1;
        Predicate cont;
        a1 = engine.aregs[1];
        cont = engine.cont;
    // '$retract_spypoint'(A):-[]
        return cont;
    }
}
TOP

Related Classes of jp.ac.kobe_u.cs.prolog.builtin.PRED_$retract_spypoint_1_2

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.