IsDefined() public method

public IsDefined ( string label ) : bool
label string
return bool
        /// <summary>
        /// Call a predicate that takes no arguments
        /// </summary>
        /// <param name="predicateName">predicate name only.</param>
        /// <returns>success or failure</returns>
        public bool Call(string predicateName)
        {
            AMProgram program = (AMProgram)_program;

            AMInstructionSet iset = new AMInstructionSet();

            if (!program.IsDefined(predicateName + "/0"))
            {
                return(false);
            }

            // Add the call instruction
            program.P = new ProgramNode(iset.CreateInstruction("call", predicateName, "0"));

            program.AddProgramNode(program.P);

            // Add the halt insturction
            program.AddInstruction(iset.CreateInstruction("halt"));

            // Execute the program
            Transition();

            return(!_fail);
        }
        public bool Call(string predicateName, int arity, object[] args)
        {
            AMProgram        program = (AMProgram)_program;
            AMHeap           heap    = (AMHeap)_dataArea;
            AMInstructionSet iset    = new AMInstructionSet();

            if (!program.IsDefined(predicateName + "/" + arity))
            {
                return(false);
            }
            ArrayList a = new ArrayList();

            ProgramNode entryPoint = null;

            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i].GetType().ToString())
                {
                case "System.String":
                case "System.Int32":
                case "System.Boolean":
                    if (entryPoint == null)
                    {
                        entryPoint = new ProgramNode(iset.CreateInstruction("put_constant", args[i].ToString(), "X" + i.ToString()));
                        program.AddProgramNode(entryPoint);
                    }
                    else
                    {
                        program.AddInstruction(iset.CreateInstruction("put_constant", args[i].ToString(), "X" + i.ToString()));
                    }
                    break;

                case "Axiom.Runtime.AbstractTerm":
                    a.Add(i);
                    if (entryPoint == null)
                    {
                        entryPoint = new ProgramNode(iset.CreateInstruction("put_variable", "X" + args[i].ToString(), "X" + i.ToString()));
                        program.AddProgramNode(entryPoint);
                    }
                    else
                    {
                        program.AddInstruction(iset.CreateInstruction("put_variable", "X" + args[i].ToString(), "X" + args[i].ToString()));
                    }
                    break;
                }
            }

            // Add the call instruction
            program.AddInstruction(iset.CreateInstruction("call", predicateName, arity.ToString()));

            // Add the halt insturction
            program.AddInstruction(iset.CreateInstruction("halt"));

            program.P = entryPoint;

            // Execute the program
            Transition();

            foreach (int argumentNumber in a)
            {
                AbstractTerm var = (AbstractTerm)args[argumentNumber];
                var.Assign((AbstractTerm)this["X" + argumentNumber.ToString()]);
            }

            return(!_fail);
        }