lcsim/src/org/lcsim/util/aida
diff -u -r1.1 -r1.2
--- AidaCursor.java 9 Feb 2007 22:35:58 -0000 1.1
+++ AidaCursor.java 9 Feb 2007 22:57:31 -0000 1.2
@@ -12,7 +12,7 @@
* file's contents sequentially.
*
* @author jeremym
- * @version $Id: AidaCursor.java,v 1.1 2007/02/09 22:35:58 jeremy Exp $
+ * @version $Id: AidaCursor.java,v 1.2 2007/02/09 22:57:31 jeremy Exp $
*/
public class AidaCursor
{
@@ -118,6 +118,15 @@
{
return objectTypes[position()];
}
+
+ /**
+ * Full name of current object.
+ * @return Name of current object.
+ */
+ public String name()
+ {
+ return objectNames[position()];
+ }
/**
* Increment the position by 1.
@@ -205,5 +214,23 @@
public boolean isdir()
{
return position() != end() && object().getClass() != IManagedObject.class;
- }
+ }
+
+ /**
+ * Find an object by name and set to its position.
+ * @param name Name of object to be found.
+ * @return New position if found or end() if not found.
+ */
+ public int find(String name)
+ {
+ for ( int i=seek(begin()); i<end(); i++ )
+ {
+ if ( name().compareTo(name) == 0 )
+ {
+ break;
+ }
+ next();
+ }
+ return position();
+ }
}
\ No newline at end of file