class DistinguishedName implements Name {

	public boolean contains(DistinguishedName path) {

		List shortlist = path.getNames();

		// this path must be at least as long
		if (getNames().size() < shortlist.size()) {
            return false;
        }

		// must have names
		if (shortlist.size() == 0) {
            return false;
        }

		Iterator longiter = getNames().iterator();
		Iterator shortiter = shortlist.iterator();

		LdapRdn longname = (LdapRdn) longiter.next();
		LdapRdn shortname = (LdapRdn) shortiter.next();

		// find first match
		while (!longname.equals(shortname) && longiter.hasNext()) {
			longname = (LdapRdn) longiter.next();
		}

		// Done?
		if (!shortiter.hasNext() && longname.equals(shortname)) {
            return true;
        }
		if (!longiter.hasNext()) {
            return false;
        }

		// compare
		while (longname.equals(shortname) && longiter.hasNext() && shortiter.hasNext()) {
			longname = (LdapRdn) longiter.next();
			shortname = (LdapRdn) shortiter.next();
		}

		// Done
        return !shortiter.hasNext() && longname.equals(shortname);

	}

	public  DistinguishedName();
	public  DistinguishedName(String path);
	public  DistinguishedName(List list);
	public  DistinguishedName(Name name);

}