Update of /cvsroot/xpg-xml/org/dinopolis/util
In directory usw-pr-cvs1:/tmp/cvs-serv16716
Modified Files:
DFactory.java
Log Message:
two new methodes:
boolean existsSearchPath(String path)
void appendSearchPath(String path)
Index: DFactory.java
===================================================================
RCS file: /cvsroot/xpg-xml/org/dinopolis/util/DFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DFactory.java 7 Feb 2002 14:02:51 -0000 1.2
--- DFactory.java 14 Feb 2002 22:29:02 -0000 1.3
***************
*** 40,43 ****
--- 40,44 ----
*
* @author Peter Grundner
+ * @author Stefan Thalauer
* @version $Revision$
*/
***************
*** 215,218 ****
--- 216,286 ----
cache_.clear();
}
+
+ // FIXXME (Stefan Thalauer, Feb14 2002 22:30) -> two new methodes:
+ // boolean existsSearchPath(String path)
+ // void appendSearchPath(String path)
+
+ //----------------------------------------------------------------------
+ /**
+ * This method checks if a path is in the current Search path
+ *
+ * @param path
+ * @return returns true if the new path allready exists in the search
+ * path
+ * @exception IllegalStateException thrown if no path has been
+ * set before
+ */
+ public boolean existSearchPath(String path)
+ throws IllegalStateException
+ {
+ if (path_==null)
+ {
+ throw new IllegalStateException();
+ }
+ for(int count=0; count < path_.length ; count++)
+ {
+ if ( path_[count].equals(path) )
+ return true;
+ }
+ return false;
+ }
+
+
+ //----------------------------------------------------------------------
+ /**
+ * This method appends a path to the current path.
+ *
+ * @exception IllegalStateException thrown if no path has been
+ * set before
+ */
+
+ public void appendSearchPath(String path)
+ throws IllegalStateException
+ {
+ if (path == null)
+ throw(new IllegalArgumentException("new path must not be <null>"));
+ if (existSearchPath(path))
+ System.err.println("Path: \"" + path +"\" allready registered in search path");
+ else
+ {
+ String[] new_path = new String [path_.length + 1];
+ for (int count = 0; count< path_.length;count++)
+ {
+ new_path[count]=path_[count];
+ }
+ new_path[path_.length] = path;
+ path_ = new_path;
+ }
+ }
+
+ // END FIXXME (Stefan Thalauer, Feb14 2002 22:32)
}
+
+
+
+
+
+
+
+
|