Index: libspi/collection.c
===================================================================
--- libspi/collection.c	(revision 980)
+++ libspi/collection.c	(working copy)
@@ -157,8 +157,7 @@
      mrp =  spimatchrule->_mrp;
      
      CORBA_free (mrp->attributes);
-     CORBA_free (mrp->roles);
-     CORBA_free (mrp->interfaces);
+     CORBA_free (mrp->roles);     CORBA_free (mrp->interfaces);
 
      g_free (mrp);
 
@@ -560,12 +559,11 @@
 		      Accessibility_Accessible obj, glong index, gboolean flag, 
 		      Accessibility_Accessible pobj, CORBA_boolean recurse, 
 		      CORBA_boolean traverse, CORBA_Environment *ev){
-
      gint i = index;
      glong acount  = Accessibility_Accessible__get_childCount (obj, ev);
      gboolean prev = pobj? TRUE : FALSE;
-   
-     for (; i < acount && (max == 0 || kount < max); i++){
+     
+     for (; i < acount &&  (max == 0 || kount < max); i++){
 	  Accessibility_Accessible child = Accessibility_Accessible_getChildAtIndex (obj, i, ev);
 
 	          
@@ -638,6 +636,12 @@
      return retval;
 }
 
+/*
+  GetMatchesTo es normal segun API. Podria usarse tambien para anterior cuando ya recorremos el arbol normalmente.
+  Este solamente sirve para encontrar los siguientes nodos a partir de current_object teniendo este como tope,
+  o siguientes matches tomando como marco el parent del current_object
+*/
+
 static Accessibility_AccessibleSet *
 impl_getMatchesFrom (PortableServer_Servant servant,
 		      const Accessibility_Accessible current_object,
@@ -675,7 +679,111 @@
 }
 
 
+/*
+  sort_order_canonical_in_order sirve para recorrer el arbol y dar los hijos de manera
+  in order. Probablemente este nombre de metodo es muy malo.
+*/
+
+static int
+balaju (Accessibility_Accessible collection, MatchRulePrivate *mrp, 
+	GList *ls, gint kount, gint max,
+	Accessibility_Accessible obj, 
+	gboolean flag,
+	Accessibility_Accessible pobj,
+	CORBA_boolean traverse,
+	CORBA_Environment *ev){
+
+  int i = 0;
+  
+  
+  /*aca sacamos todos los hijos desde el current object 
+   index es 0 por que siempre queremos todos los hijos */
+
+  /* I ==> segun mi diagrama 
+   */
+  
+  kount = sort_order_canonical (mrp, ls, kount, max, obj, 0, TRUE,
+				CORBA_OBJECT_NIL, TRUE, TRUE, ev); 
+  /*
+    aca es donde la diversion empieza 
+    recorrer al nivel superior y sacar hijos solamente de  los hijos 
+    quitando el hijo actual. Ver diagrama.
+    Hacerlo hasta que topemos con Collection que es nuestro objecto marco
+    Notese que solamente buscamos lados "derechos" del ultimo nodo al que nos 
+   fuimos a profundidad
+  */
+  /* hay que hacer algo con index para reflejar que ya no se visite el nodo anterior ;) */
+
+      
+  /* 
+     II* ==> del diagrama
+   */
+  
+  while ((max == 0 || kount < max) && CORBA_Object_is_equivalent (obj, collection, ev)){
+
+    i = Accessibility_Accessible_getIndexInParent (obj, ev) + 1;
+    Accessibility_Accessible parent =  Accessibility_Accessible__get_parent (obj, ev);
+    kount  = sort_order_canonical (mrp, ls, kount, max, parent, i, TRUE, FALSE, TRUE, TRUE, ev);
+    obj = parent;
+  }
+  
+  /*
+    Ya que tenemos el lado izuierdo del arbol recorrer la parte diestra
+    con recorrido normal sort_order_canonical 
+  */
+
+  /*
+    III ==> del diagrama
+  */
+  
+  if (kount < max)
+    kount = sort_order_canonical (mrp, ls, kount, max, obj, i + 1, TRUE, FALSE, TRUE, TRUE, ev);
+ 
+
+  return kount;
+
+}
+
+/*
+  GetMatchesInOrder sirve para encontrar siguientes matches a partir de current object en inorder.
+*/
+
 static Accessibility_AccessibleSet *
+impl_getMatchesInOrder (PortableServer_Servant servant,
+		   const Accessibility_Accessible current_object,
+		   const Accessibility_MatchRule rule,
+		   const Accessibility_Collection_SortOrder sortby,
+		   const CORBA_boolean recurse,
+		   CORBA_long count,
+		   const CORBA_boolean traverse, /* traverse into another collection */
+		   CORBA_Environment *ev){
+  GList *ls = NULL;
+  AtkObject *aobj;
+  Accessibility_Accessible obj, collection;
+  MatchRulePrivate *mrp;
+  gint kount = 0;
+
+  ls = g_list_append (ls, current_object);
+  mrp = get_collection_from_servant (servant)->_mrp;
+
+  aobj = get_atkobject_from_servant (servant);
+  obj = spi_accessible_new_return (aobj, FALSE, ev);
+  collection = obj;
+  
+  kount = balaju (collection, mrp, ls, 0, count, current_object, TRUE, CORBA_OBJECT_NIL, traverse, ev);
+ 
+  ls = g_list_next (ls);
+
+ 
+
+  if (sortby == Accessibility_Collection_SORT_ORDER_REVERSE_CANONICAL)
+    ls = g_list_reverse (ls);
+
+  return _accessible_list_to_set (ls, kount); 
+}
+
+
+static Accessibility_AccessibleSet *
 impl_getMatchesTo (PortableServer_Servant servant,
 		      const Accessibility_Accessible current_object,
 		      const Accessibility_MatchRule rule,
@@ -690,18 +798,17 @@
   AtkObject *aobj;
   Accessibility_Accessible obj;
   MatchRulePrivate *mrp;
-   gint kount = 0;
+  gint kount = 0;
 
 
   ls = g_list_append (ls, current_object); 
   mrp =  get_collection_from_servant (servant)->_mrp;
-  
-  
+    
   if (recurse){
     obj = Accessibility_Accessible__get_parent (current_object, ev);
     kount =  query_exec (mrp,  sortby, ls, 0, count,  obj, 0, TRUE, current_object, TRUE, traverse, ev);
   }
-  else{
+  else{ 
     aobj = get_atkobject_from_servant (servant);
     obj = spi_accessible_new_return (aobj, FALSE, ev);
     kount = query_exec (mrp,  sortby, ls, 0, count, obj, 0, TRUE, current_object, TRUE, traverse, ev); 
@@ -759,6 +866,7 @@
     epv->createMatchRule = impl_createMatchRule;
     epv->freeMatchRule   = impl_freeMatchRule;
     epv->getMatches      = impl_getMatches;
+    epv->getMatchesInOrder    = impl_getMatchesInOrder;
     epv->getMatchesTo    = impl_getMatchesTo;
     epv->getMatchesFrom  = impl_getMatchesFrom;
     
Index: idl/Accessibility_Collection.idl
===================================================================
--- idl/Accessibility_Collection.idl	(revision 980)
+++ idl/Accessibility_Collection.idl	(working copy)
@@ -75,6 +75,13 @@
 				  in long count,
                                   in boolean traverse); 
 
+       AccessibleSet getMatchesInOrder (in Accessible current_object,
+					in MatchRule rule, 
+					in SortOrder sortby, 
+					in boolean recurse,
+					in long count,
+					in boolean traverse);
+
 	AccessibleSet getMatchesTo (in Accessible current_object,
                                            in MatchRule rule, 
                                            in SortOrder sortby, 
