internal override bool match(ATerm pattern, ArrayList list) { if (pattern.getType() == ATermType.LIST) { ATermList l = (ATermList)pattern; if (l.isEmpty()) { return(this.isEmpty()); } if (l.getFirst().getType() == ATermType.PLACEHOLDER) { ATerm ph_type = ((ATermPlaceholder)l.getFirst()).getPlaceholder(); if (ph_type.getType() == ATermType.APPL) { ATermAppl appl = (ATermAppl)ph_type; if (appl.getName().Equals("list") && appl.getArguments().isEmpty()) { list.Add(this); return(true); } } } if (!isEmpty()) { ArrayList submatches = first.match(l.getFirst()); if (submatches == null) { return(false); } list.AddRange(submatches); submatches = next.match(l.getNext()); if (submatches == null) { return(false); } list.AddRange(submatches); return(true); } else { return(l.isEmpty()); } } return(base.match(pattern, list)); }