private Hashtable getCommuntativeMatch(Term input, Term pattern) {


	Hashtable result = new Hashtable();

	if (input.operation.equals(pattern.operation)) {

	    Term subpat0 = pattern.subterms[0];
	    Term subpat1 = pattern.subterms[1];

	    Term term0 = input.subterms[0];
	    Term term1 = input.subterms[1];

	    Hashtable ht0 = getMatch(term0, subpat1);
	    Hashtable ht1 = getMatch(term1, subpat0);


	    if (ht0 != null && ht1 != null) {
		result = ht0;
		Enumeration e = ht1.keys();
		while (e.hasMoreElements()) {
		    Variable var = (Variable)e.nextElement();

		    
                    Variable var1 = null;
		    Enumeration ee = result.keys();
		    while (ee.hasMoreElements()) {
			Variable vtmp = (Variable)ee.nextElement();
		        if (vtmp.equals(var)) {
			    var1 = vtmp;
			    break;
			}
		    }
		    
		     
		    Term trm1 = (Term)ht1.get(var);
		    Term trm2 = var1 == null? null : (Term)result.get(var1);
		    
		    if (trm2 == null) {
			result.put(var, trm1);
		    } else if (!trm1.equals(trm2)) {
			return null;
		    }
		}
	    } else {
		result = null;
	    }

	} else {
	    result = null;
	}
	return result;
    }