Index: libspi/matchrule.c
===================================================================
--- libspi/matchrule.c	(revision 0)
+++ libspi/matchrule.c	(revision 0)
@@ -0,0 +1,60 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* matchrule.c: implements the Matchrule interface */
+
+
+#include <config.h>
+#include <stdio.h>
+#include <bonobo/bonobo-exception.h>
+#include <libspi/matchrule.h> 
+#include <libspi/spi-private.h>
+
+SpiMatchrule *
+spi_matchrule_interface_new ()
+{
+
+     SpiMatchrule *new_matchrule = g_object_new (SPI_MATCHRULE_TYPE, NULL);
+
+     spi_base_construct_default (SPI_BASE (new_matchrule));
+
+     return new_matchrule;
+
+}
+
+static void
+spi_matchrule_class_init (SpiMatchruleClass *klass)
+{
+}
+
+static void
+spi_matchrule_init (SpiMatchrule *matchrule)
+{
+}
+
+BONOBO_TYPE_FUNC_FULL (SpiMatchrule,
+		      Accessibility_MatchRule,
+		      SPI_TYPE_BASE,
+		      spi_matchrule)
+
+
Index: libspi/libspi.h
===================================================================
--- libspi/libspi.h	(revision 882)
+++ libspi/libspi.h	(working copy)
@@ -28,6 +28,7 @@
 #include <libspi/accessible.h>
 #include <libspi/action.h>
 #include <libspi/application.h>
+#include <libspi/collection.h>
 #include <libspi/component.h>
 #include <libspi/document.h>
 #include <libspi/editabletext.h>
Index: libspi/matchrule.h
===================================================================
--- libspi/matchrule.h	(revision 0)
+++ libspi/matchrule.h	(revision 0)
@@ -0,0 +1,57 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SPI_MATCHRULE_H_
+#define SPI_MATCHRULE_H_
+
+#include <libspi/base.h>
+
+G_BEGIN_DECLS
+
+#define SPI_MATCHRULE_TYPE         (spi_matchrule_get_type ())
+#define SPI_MATCHRULE(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_MATCHRULE_TYPE, SpiMatchrule))
+#define SPI_MATCHRULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_MATCHRULE_TYPE, SpiMatchruleClass))
+#define IS_MATCHRULE(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj, SPI_MATCHRULE_TYPE))
+#define IS_MATCHRULE_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), SPI_MATCHRULE_TYPE))
+
+typedef struct _SpiMatchrule SpiMatchrule;
+typedef struct _SpiMatchruleClass SpiMatchruleClass;
+
+struct _SpiMatchrule {
+     SpiBase parent;
+
+};
+
+struct _SpiMatchruleClass {
+  SpiBaseClass parent_class;
+  POA_Accessibility_MatchRule__epv epv;
+};
+
+GType        spi_matchrule_get_type       (void);
+void         spi_matchrule_construct      (SpiMatchrule *matchrule);
+					    
+SpiMatchrule *spi_matchrule_interface_new  (void);
+
+G_END_DECLS
+
+#endif /* SPI_MATCHRULE_H_ */
Index: libspi/collection.c
===================================================================
--- libspi/collection.c	(revision 0)
+++ libspi/collection.c	(revision 0)
@@ -0,0 +1,188 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* collection.c: implements the Collection interface */
+
+#include <config.h>
+#include <stdio.h>
+#include <bonobo/bonobo-exception.h>
+#include <libspi/collection.h>
+#include <libspi/matchrule.h> 
+#include <libspi/spi-private.h>
+
+typedef struct _MatchRulePrivate MatchRulePrivate;
+
+struct _MatchRulePrivate {
+
+     Accessibility_StateSet states;
+     Accessibility_Collection_MatchType statematchtype;
+     Accessibility_AttributeSet  *attributes;
+     Accessibility_Collection_MatchType attributematchtype;
+     Accessibility_RoleSet *roles;
+     Accessibility_Collection_MatchType rolematchtype;
+     CORBA_char *interfaces;
+     Accessibility_Collection_MatchType interfacematchtype;
+     gboolean invert;
+
+};
+
+#define MATCH_RULE_PRIVATE(o)\
+     G_TYPE_INSTANCE_GET_PRIVATE((o), SPI_MATCHRULE_TYPE, MatchRulePrivate)
+
+
+SpiCollection *
+spi_collection_interface_new ()
+{
+
+     SpiCollection *new_collection = g_object_new (SPI_COLLECTION_TYPE, NULL);
+
+     spi_base_construct_default (SPI_BASE (new_collection));
+
+     return new_collection;
+
+}
+
+/*
+static SpiCollection *
+get_collection_from_servant (PortableServer_Servant servant)
+{
+     SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
+
+     g_return_val_if_fail (object, NULL);
+     
+     return SPI_COLLECTION (object->gobj);
+				
+}
+*/
+
+static Accessibility_MatchRule 
+impl_createMatchRule (PortableServer_Servant servant,
+		      const Accessibility_StateSet states,
+		      const Accessibility_Collection_MatchType statematchtype,
+		      const Accessibility_AttributeSet *attributes,
+		      const Accessibility_Collection_MatchType attributematchtype,
+		      const Accessibility_RoleSet *roles,
+		      const Accessibility_Collection_MatchType rolematchtype,
+		      const CORBA_char *interfaces,
+		      const Accessibility_Collection_MatchType interfacematchtype,
+		      const CORBA_boolean invert,
+		      CORBA_Environment *ev){
+
+     Accessibility_MatchRule  retval = NULL;
+
+     SpiMatchrule *matchrule = spi_matchrule_interface_new ();
+     MatchRulePrivate *mrp   = MATCH_RULE_PRIVATE (matchrule);
+     int i;
+
+     mrp->states  = states;
+     mrp->statematchtype = statematchtype;
+
+/* attributes */
+
+     mrp->attributes = CORBA_sequence_CORBA_string__alloc ();
+     mrp->attributes->_maximum = attributes->_maximum;
+     mrp->attributes->_length = attributes->_length;
+     mrp->attributes->_buffer = CORBA_sequence_CORBA_string_allocbuf (attributes->_length);
+
+     for (i = 0; i < mrp->attributes->_length; i++)
+	  mrp->attributes->_buffer [i]= CORBA_string_dup (attributes->_buffer [i]);
+    
+     CORBA_sequence_set_release (mrp->attributes, TRUE);
+     mrp->attributematchtype = attributematchtype;
+
+/* roles */
+
+     mrp->roles = Accessibility_RoleSet__alloc ();
+     mrp->roles->_maximum = roles->_maximum;
+     mrp->roles->_length = roles->_length;
+     mrp->roles->_buffer = Accessibility_RoleSet_allocbuf (roles->_length);
+
+     for (i = 0; i < roles->_length; i++)
+	  mrp->roles->_buffer [i] = roles->_buffer [i];
+     
+     CORBA_sequence_set_release (mrp->roles, TRUE);
+     mrp->rolematchtype = rolematchtype;
+
+/* interfaces */
+     
+     mrp->interfaces = CORBA_string_dup (interfaces);
+     mrp->interfacematchtype = interfacematchtype;
+
+     mrp->invert = invert;
+     
+     retval = CORBA_Object_duplicate (BONOBO_OBJREF (matchrule), ev);
+
+     return retval;
+
+}
+
+static void impl_freeMatchRule (PortableServer_Servant servant,
+				Accessibility_MatchRule matchrule,     
+				CORBA_Environment *ev){
+
+     SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
+     SpiMatchrule *spimatchrule;
+
+     MatchRulePrivate *mrp;  
+
+     spimatchrule = SPI_MATCHRULE (object->gobj);
+     mrp =  MATCH_RULE_PRIVATE (spimatchrule);;
+     
+     CORBA_free (mrp->attributes);
+     CORBA_free (mrp->roles);
+     CORBA_free (mrp->interfaces);     
+     
+     g_free (spimatchrule);
+
+}
+static void
+spi_collection_class_init (SpiCollectionClass *klass)
+{
+
+    POA_Accessibility_Collection__epv *epv  = &klass->epv;
+
+    /*    epv->isAncestorOf = impl_isAncestorOf; */
+    
+   epv->createMatchRule =  impl_createMatchRule;
+   epv->freeMatchRule = impl_freeMatchRule;
+   
+   /*
+     epv->getChildren = impl_getChildren;
+     epv->getPreviousChildren = impl_getPreviousChildren;
+     epv->getNextChildren = impl_getNextChildren;
+     epv->getActiveDescendant = impl_getActiveDescendant;
+   */
+
+   g_type_class_add_private (klass, sizeof (MatchRulePrivate));
+}
+
+static void
+spi_collection_init (SpiCollection *collection)
+{
+}
+
+BONOBO_TYPE_FUNC_FULL (SpiCollection,
+		       Accessibility_Collection,
+		       SPI_TYPE_BASE,
+		       spi_collection)
+
Index: libspi/collection.h
===================================================================
--- libspi/collection.h	(revision 0)
+++ libspi/collection.h	(revision 0)
@@ -0,0 +1,61 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SPI_COLLECTION_H_
+#define SPI_COLLECTION_H_
+
+#include <libspi/base.h>
+
+G_BEGIN_DECLS
+
+#define SPI_COLLECTION_TYPE         (spi_collection_get_type ())
+#define SPI_COLLECTION(obj)         (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_COLLECTION_TYPE, SpiCollection))
+#define SPI_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_COLLECTION_TYPE, SpiCollectionClass))
+#define IS_COLLECTION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj, SPI_COLLECTION_TYPE))
+#define IS_COLLECTION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), SPI_COLLECTION_TYPE))
+
+typedef struct _SpiCollection SpiCollection;
+typedef struct _SpiCollectionClass SpiCollectionClass;
+
+struct _SpiCollection {
+  SpiBase parent;
+
+
+};
+
+struct _SpiCollectionClass {
+  SpiBaseClass parent_class;
+  POA_Accessibility_Collection__epv epv;
+};
+
+GType        spi_collection_get_type       (void);
+
+void         spi_collection_construct      (SpiCollection *collection);
+					    
+SpiCollection *spi_collection_interface_new  (void);
+
+G_END_DECLS
+
+#endif /* SPI_COLLECTION_H_ */
+
+
Index: libspi/Makefile.am
===================================================================
--- libspi/Makefile.am	(revision 882)
+++ libspi/Makefile.am	(working copy)
@@ -20,6 +20,7 @@
 	action.h		\
 	application.h		\
 	base.h			\
+	collection.h		\
 	component.h		\
 	document.h		\
 	editabletext.h		\
@@ -31,6 +32,7 @@
 	keymasks.h		\
 	libspi.h		\
 	listener.h		\
+	matchrule.h		\
 	relation.h		\
 	remoteobject.h		\
 	selection.h		\
@@ -47,6 +49,7 @@
 	$(top_srcdir)/idl/Accessibility_Accessible.idl		\
 	$(top_srcdir)/idl/Accessibility_Action.idl		\
 	$(top_srcdir)/idl/Accessibility_Application.idl		\
+	$(top_srcdir)/idl/Accessibility_Collection.idl		\
 	$(top_srcdir)/idl/Accessibility_Component.idl		\
 	$(top_srcdir)/idl/Accessibility_Desktop.idl		\
 	$(top_srcdir)/idl/Accessibility_EditableText.idl	\
@@ -74,6 +77,7 @@
 	action.c		\
 	application.c		\
 	base.c			\
+	collection.c            \
 	component.c		\
 	document.c		\
 	editabletext.c		\
@@ -81,6 +85,7 @@
 	hypertext.c		\
 	image.c			\
 	devicelistener.c	\
+	matchrule.c 		\
 	relation.c		\
 	remoteobject.c		\
 	selection.c		\
Index: cspi/spi-impl.h
===================================================================
--- cspi/spi-impl.h	(revision 882)
+++ cspi/spi-impl.h	(working copy)
@@ -36,12 +36,14 @@
 
 typedef Accessible AccessibleAction;
 typedef Accessible AccessibleApplication;
+typedef Accessible AccessibleCollection;
 typedef Accessible AccessibleComponent;
 typedef Accessible AccessibleDocument;
 typedef Accessible AccessibleEditableText;
 typedef Accessible AccessibleHyperlink;
 typedef Accessible AccessibleHypertext;
 typedef Accessible AccessibleImage;
+typedef Accessible AccessibleMatchRule;
 typedef Accessible AccessibleRelation;
 typedef Accessible AccessibleSelection;
 typedef Accessible AccessibleStreamableContent;
Index: cspi/spi.h
===================================================================
--- cspi/spi.h	(revision 882)
+++ cspi/spi.h	(working copy)
@@ -43,6 +43,29 @@
 #endif
 
 /**
+ *AccessibleCollectionMatchType:
+ *
+ *@SPI_COLLECTION_MATCH_INVALID 	
+ *@SPI_COLLECTION_MATCH_ALL 	TRUE if all of the criteria are met
+ *@SPI_COLLECTION_MATCH_ANY 	TRUE if any of the criteria are met
+ *@SPI_COLLECTION_MATCH_NONE 	TRUE if none of the criteria are met
+ *@SPI_COLLECTION_MATCH_EMPTY 	Same as MATCH_ALL if the criteria is non-empty; 
+ * for empty criteria this rule requires returned value to also have empty set.
+ *@SPI_COLLECTION_MATCH_LAST_DEFINED 	
+ *
+ **/
+typedef enum
+{
+     SPI_COLLECTION_MATCH_INVALID,
+     SPI_COLLECTION_MATCH_ALL,
+     SPI_COLLECTION_MATCH_ANY,
+     SPI_COLLECTION_MATCH_NONE,
+     SPI_COLLECTION_MATCH_EMPTY,
+     SPI_COLLECTION_MATCH_LAST_DEFINED
+}AccessibleCollectionMatchType;
+
+
+/**
  *AccessibleTextBoundaryType:
  *@SPI_TEXT_BOUNDARY_CHAR: Delimiter is the current character's bounds.
  *@SPI_TEXT_BOUNDARY_CURSOR_POS: Delimiter is the current text caret position.
@@ -401,6 +424,14 @@
     char **attributes;
 } AccessibleAttributeSet;
 
+typedef struct _AccessibleRoleSet
+{
+     int len;
+     AccessibleRole *roles;
+} AccessibleRoleSet;
+
+
+
 /* Basic SPI initialization and event loop function prototypes */
 
 int              SPI_init         (void);
@@ -524,11 +555,13 @@
 
 SPIBoolean Accessible_isAction            (Accessible *obj);
 SPIBoolean Accessible_isApplication       (Accessible *obj);
+SPIBoolean Accessible_isCollection        (Accessible *obj);
 SPIBoolean Accessible_isComponent         (Accessible *obj);
 SPIBoolean Accessible_isDocument          (Accessible *obj);
 SPIBoolean Accessible_isEditableText      (Accessible *obj);
 SPIBoolean Accessible_isHypertext         (Accessible *obj);
 SPIBoolean Accessible_isImage             (Accessible *obj);
+SPIBoolean Accessible_isMatchRule         (Accessible *obj);
 SPIBoolean Accessible_isSelection         (Accessible *obj);
 SPIBoolean Accessible_isStreamableContent (Accessible *obj);
 SPIBoolean Accessible_isTable             (Accessible *obj);
@@ -537,11 +570,13 @@
 
 AccessibleAction *            Accessible_getAction            (Accessible *obj);
 AccessibleApplication *       Accessible_getApplication       (Accessible *obj);
+AccessibleCollection *        Accessible_getCollection        (Accessible *obj);
 AccessibleComponent *         Accessible_getComponent         (Accessible *obj);
 AccessibleDocument *          Accessible_getDocument          (Accessible *obj);
 AccessibleEditableText *      Accessible_getEditableText      (Accessible *obj);
 AccessibleHypertext *         Accessible_getHypertext         (Accessible *obj);
 AccessibleImage *             Accessible_getImage             (Accessible *obj);
+AccessibleMatchRule *         Accessible_getMatchRule         (Accessible *obj);
 AccessibleSelection *         Accessible_getSelection         (Accessible *obj);
 AccessibleStreamableContent * Accessible_getStreamableContent (Accessible *obj);
 AccessibleTable *             Accessible_getTable             (Accessible *obj);
@@ -575,6 +610,23 @@
 SPIBoolean AccessibleApplication_pause          (AccessibleApplication *obj);
 SPIBoolean AccessibleApplication_resume         (AccessibleApplication *obj);
 
+/* AccessibleCollection function prototypes */
+void       AccessibleCollection_ref (AccessibleCollection *obj);
+void       AccessibleCollection_unref (AccessibleCollection *obj);
+AccessibleMatchRule *
+AccessibleCollection_createMatchRule (AccessibleCollection *obj,
+				      AccessibleStateSet *states,
+				      AccessibleCollectionMatchType statematchtype,
+				      AccessibleAttributeSet *attributes,
+				      AccessibleCollectionMatchType attributematchtype,
+				      AccessibleRoleSet *roles,
+				      AccessibleCollectionMatchType rolematchtype,
+				      char *interfaces,
+				      AccessibleCollectionMatchType interfacematchtype,
+				      long int invert);
+void
+AccessibleCollection_freeMatchRule (AccessibleCollection *obj,
+				    AccessibleMatchRule  *matchrule);
 /* AccessibleComponent function prototypes */
 
 void        AccessibleComponent_ref         (AccessibleComponent *obj);
@@ -749,6 +801,14 @@
 
 /*
  *
+ * AccessibleMatchRule function prototypes
+ *
+ */
+void       AccessibleMatchRule_ref (AccessibleMatchRule *obj);
+void       AccessibleMatchRule_unref (AccessibleMatchRule *obj);
+
+/*
+ *
  * AccessibleRelation function prototypes
  *
  */
Index: cspi/spi_accessible.c
===================================================================
--- cspi/spi_accessible.c	(revision 882)
+++ cspi/spi_accessible.c	(working copy)
@@ -690,6 +690,21 @@
 			      "IDL:Accessibility/Application:1.0");
 }
 
+/**                      
+ * Accessible_isCollection:                                                                                                                                                                          * @obj: a pointer to the #Accessible instance to query.                                                                                                                                          
+ *                          
+ * Query whether the specified #Accessible implements #AccessibleCollection.    
+ * Returns: #TRUE if @obj implements the #AccessibleCollection interface,                                                                                                               
+ *          #FALSE otherwise.
+ **/
+
+SPIBoolean
+Accessible_isCollection (Accessible *obj)
+{
+     return cspi_accessible_is_a (obj,
+				  "IDL:Accessibility/Collection:1.0");
+}
+
 /**
  * Accessible_isComponent:
  * @obj: a pointer to the #Accessible instance to query.
@@ -737,6 +752,22 @@
   return cspi_accessible_is_a (obj,
 			      "IDL:Accessibility/EditableText:1.0");
 }
+                                                                                                                                                                        
+/**
+ * Accessible_isMatchRule:
+ * @obj: a pointer to the #Accessible instance to query.
+ *
+ * Query whether the specified #Accessible implements #AccessibleMatchRule.
+ *
+ * Returns: #TRUE if @obj implements the #AccessibleMatchRule interface,
+ *          #FALSE otherwise.
+ **/
+SPIBoolean
+Accessible_isMatchRule (Accessible *obj)
+{
+     return cspi_accessible_is_a (obj, 
+				  "IDL:Accessibility/MatchRule:1.0");
+}
 
 /**
  * Accessible_isHypertext:
@@ -883,6 +914,23 @@
 	  obj, "IDL:Accessibility/Action:1.0");
 }
 
+
+/**
+ * Accessible_getCollection:
+ * @obj: a pointer to the #Accessible instance to query.
+ *
+ * Get the #AccessibleCollection interface for an #Accessible.
+ *
+ * Returns: a pointer to an #AccessibleCollection interface instance, or
+ *          NULL if @obj does not implement #AccessibleCollection.
+ **/
+AccessibleCollection *
+Accessible_getCollection (Accessible *obj)
+{
+  return (AccessibleCollection *) Accessible_queryInterface (
+	  obj, "IDL:Accessibility/Collection:1.0");
+}
+
 /**
  * Accessible_getComponent:
  * @obj: a pointer to the #Accessible instance to query.
@@ -966,7 +1014,21 @@
 	  obj, "IDL:Accessibility/Image:1.0");
 }
 
-
+/**
+ * Accessible_getMatchRule:
+ * @obj: a pointer to the #Accessible instance to query.
+ *
+ * Get the #AccessibleMatchRule interface for an #Accessible.
+ *
+ * Returns: a pointer to an #AccessibleMatchRule interface instance, or
+ *          NULL if @obj does not implement #AccessibleMatchRule.
+ **/
+AccessibleMatchRule *
+Accessible_getMatchRule (Accessible *obj)
+{
+  return (AccessibleMatchRule *) Accessible_queryInterface (
+	  obj, "IDL:Accessibility/MatchRule:1.0");
+}
 
 /**
  * Accessible_getSelection:
Index: cspi/Makefile.am
===================================================================
--- cspi/Makefile.am	(revision 882)
+++ cspi/Makefile.am	(working copy)
@@ -29,6 +29,7 @@
 	spi_accessible.c	\
 	spi_action.c		\
 	spi_application.c	\
+	spi_collection.c	\
 	spi_component.c		\
 	spi_document.c		\
 	spi_editabletext.c	\
@@ -37,6 +38,7 @@
 	spi_hypertext.c		\
 	spi_image.c		\
 	spi_main.c		\
+	spi_matchrule.c		\
 	spi-private.h		\
 	spi_registry.c		\
 	spi_selection.c		\
Index: idl/Accessibility.idl
===================================================================
--- idl/Accessibility.idl	(revision 882)
+++ idl/Accessibility.idl	(working copy)
@@ -131,6 +131,8 @@
 #include <Accessibility_LoginHelper.idl>
 #include <Accessibility_Selector.idl>
 
+#include <Accessibility_Collection.idl>
+
 #ifndef __ACCESSIBILITY_COMPILATION__
 #ifdef  __ORBIT_IDL__
 #pragma inhibit pop
Index: idl/Makefile.am
===================================================================
--- idl/Makefile.am	(revision 882)
+++ idl/Makefile.am	(working copy)
@@ -5,6 +5,7 @@
 	Accessibility_Accessible.idl		\
 	Accessibility_Action.idl		\
 	Accessibility_Application.idl		\
+        Accessibility_Collection.idl            \
 	Accessibility_Component.idl		\
 	Accessibility_Desktop.idl		\
 	Accessibility_Document.idl		\
Index: idl/Accessibility_Collection.idl
===================================================================
--- idl/Accessibility_Collection.idl	(revision 0)
+++ idl/Accessibility_Collection.idl	(revision 0)
@@ -0,0 +1,104 @@
+ /* 
+  * AT-SPI - Assistive Technology Service Provider Interface 
+  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+  *
+  * Copyright 2005 Sun Microsystems, Inc.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+  * License as published by the Free Software Foundation; either
+  * version 2 of the License, or (at your option) any later version.
+  *
+  * This library is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Library General Public License for more details.
+  *
+  * You should have received a copy of the GNU Library General Public
+  * License along with this library; if not, write to the
+  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+  * Boston, MA 02111-1307, USA.
+  */
+
+#ifndef __ACCESSIBILITY_COLLECTION_DEFINED__
+#define __ACCESSIBILITY_COLLECTION_DEFINED__
+ 
+module Accessibility {
+
+struct AccessibleSetEntry {
+         Accessible accessible;
+         string     name;
+         Role       role;
+};
+
+typedef sequence<AccessibleSetEntry> AccessibleSet;
+ 
+     interface MatchRule {
+     };
+
+
+     interface Collection : Bonobo::Unknown {
+ 
+       enum SortOrder {
+	    SORT_ORDER_INVALID,
+	    SORT_ORDER_CANONICAL, 
+	    SORT_ORDER_FLOW, 
+	    SORT_ORDER_TAB, 
+	    SORT_ORDER_REVERSE_CANONICAL, 
+	    SORT_ORDER_REVERSE_FLOW, 
+	    SORT_ORDER_REVERSE_TAB, 
+	    SORT_ORDER_LAST_DEFINED
+       };
+   
+       enum MatchType {
+           MATCH_INVALID, 
+           MATCH_ALL, 
+           MATCH_ANY, 
+	   MATCH_NONE,
+	   MATCH_EMPTY,
+           MATCH_LAST_DEFINED
+	   };
+
+
+	boolean isAncestorOf (in Accessible object); 
+  
+	MatchRule        createMatchRule (in StateSet states,
+					  in MatchType statematchtype,
+                                          in AttributeSet attributes,
+                                          in MatchType attributematchtype,
+                                          in RoleSet roles,
+					  in MatchType rolematchtype,
+                                          in string interfaces,
+                                          in MatchType interfacematchtype,
+                                          in boolean invert);
+
+	void             freeMatchRule (in MatchRule rule);
+
+	AccessibleSet getChildren (in MatchRule rule,
+                                   in SortOrder sortby,
+				   in boolean recurse,
+                                   inout long count); /* inOut not accepted */
+
+	AccessibleSet getPreviousChildren (in Accessible current_object,
+                                           in MatchRule rule, 
+                                           in SortOrder sortby, 
+                                           in boolean recurse,
+                                           inout long count);
+
+
+        AccessibleSet getNextChildren (in Accessible current_object,
+				       in MatchRule rule, 
+                                       in SortOrder sortby, 
+                                       in boolean recurse,
+                                       inout long count);
+
+        Accessible getActiveDescendant ();
+        
+	void unImplemented ();
+	void unImplemented2 ();
+        void unImplemented3 ();
+        void unImplemented4 ();	
+   };
+};
+
+#endif
\ No newline at end of file
