Ejemplo n.º 1
0
        internal virtual void init(int hashCode, ATermList annos, AFun fun, ATerm[] i_args)
        {
            base.init(hashCode, annos);
            this.fun  = fun;
            this.args = new ATerm[fun.getArity()];

            for (int i = 0; i < fun.getArity(); i++)
            {
                this.args[i] = i_args[i];
            }
        }
Ejemplo n.º 2
0
		internal virtual void init(int hashCode, ATermList annos, AFun fun, ATerm[] i_args) 
		{
			base.init(hashCode, annos);
			this.fun = fun;
			this.args = new ATerm[fun.getArity()];
    
			for(int i=0; i<fun.getArity(); i++) 
			{
				this.args[i] = i_args[i];
			}
		}
Ejemplo n.º 3
0
        internal override bool match(ATerm pattern, ArrayList list)
        {
            if (this.equals(pattern))
            {
                return(true);
            }

            if (pattern.getType() == ATermType.PLACEHOLDER)
            {
                ATerm type = ((ATermPlaceholder)pattern).getPlaceholder();
                if (type.getType() == ATermType.APPL)
                {
                    ATermAppl appl = (ATermAppl)type;
                    AFun      afun = appl.getAFun();
                    if (afun.getName().Equals("blob") &&
                        afun.getArity() == 0 &&
                        !afun.isQuoted())
                    {
                        list.Add(data);
                        return(true);
                    }
                }
            }
            return(base.match(pattern, list));
        }
Ejemplo n.º 4
0
 public override bool equivalent(SharedObject obj)
 {
     try
     {
         AFun peer = (AFun)obj;
         return(peer.getName() == name &&
                peer.getArity() == arity &&
                peer.isQuoted() == _isQuoted);
     }
     catch (InvalidCastException)
     {
         return(false);
     }
 }
Ejemplo n.º 5
0
        public override void visitAppl(ATermAppl appl)         // throws VisitFailure
        {
            AFun   fun  = appl.getAFun();
            string name = fun.ToString();

            stream.Write(name);
            position += name.Length;
            if (fun.getArity() > 0 || name.Equals(""))
            {
                stream.Write('(');
                position++;
                for (int i = 0; i < fun.getArity(); i++)
                {
                    if (i != 0)
                    {
                        stream.Write(',');
                        position++;
                    }
                    visitChild(appl.getArgument(i));
                }
                stream.Write(')');
                position++;
            }
        }
Ejemplo n.º 6
0
 private bool isListPlaceHolder(ATerm pattern)
 {
     if (pattern.getType() == ATermType.PLACEHOLDER)
     {
         ATerm type = ((ATermPlaceholder)pattern).getPlaceholder();
         if (type.getType() == ATermType.APPL)
         {
             ATermAppl appl = (ATermAppl)type;
             AFun      afun = appl.getAFun();
             if (afun.getName().Equals("list") && afun.getArity() == 0 && !afun.isQuoted())
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 7
0
 internal virtual bool match(ATerm pattern, ArrayList list)
 {
     if (pattern.getType() == ATermType.PLACEHOLDER)
     {
         ATerm type = ((ATermPlaceholder)pattern).getPlaceholder();
         if (type.getType() == ATermType.APPL)
         {
             ATermAppl appl = (ATermAppl)type;
             AFun      afun = appl.getAFun();
             if (afun.getName().Equals("term") && afun.getArity() == 0 && !afun.isQuoted())
             {
                 list.Add(this);
                 return(true);
             }
         }
     }
     return(false);
 }