Example #1
0
        internal override bool match(ATerm pattern, ArrayList list)
        {
            if (pattern.getType() == ATermType.APPL)
            {
                ATermAppl appl = (ATermAppl)pattern;
                if (fun.equals(appl.getAFun()))
                {
                    return(matchArguments(appl.getArgumentArray(), list));
                }
                else
                {
                    return(false);
                }
            }

            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("appl") && !afun.isQuoted())
                    {
                        list.Add(fun.getName());
                        return(matchArguments(appl.getArgumentArray(), list));
                    }
                    else if (afun.getName().Equals("str") && !afun.isQuoted())
                    {
                        if (fun.isQuoted())
                        {
                            list.Add(fun.getName());
                            return(matchArguments(appl.getArgumentArray(), list));
                        }
                    }
                    else if (afun.getName().Equals("fun") && !afun.isQuoted())
                    {
                        if (!fun.isQuoted())
                        {
                            list.Add(fun.getName());
                            return(matchArguments(appl.getArgumentArray(), list));
                        }
                    }
                    else if (afun.getName().Equals("id") && !afun.isQuoted())
                    {
                        if (!fun.isQuoted())
                        {
                            list.Add(fun.getName());
                            return(matchArguments(appl.getArgumentArray(), list));
                        }
                    }
                }
            }
            return(base.match(pattern, list));
        }
Example #2
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));
        }
Example #3
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);
     }
 }
Example #4
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);
 }
Example #5
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);
 }