[MOBY-guts] biomoby commit

Martin Senger senger at pub.open-bio.org
Thu Nov 10 08:54:32 UTC 2005


senger
Thu Nov 10 03:54:32 EST 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory pub.open-bio.org:/tmp/cvs-serv3825/src/main/org/biomoby/shared

Modified Files:
	MobyDataType.java MobyServiceType.java Utils.java 
Log Message:


moby-live/Java/src/main/org/biomoby/shared MobyDataType.java,1.11,1.12 MobyServiceType.java,1.4,1.5 Utils.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java	2005/10/28 07:58:08	1.11
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyDataType.java	2005/11/10 08:54:32	1.12
@@ -154,6 +154,20 @@
 	    return names;
 	}
     }
+
+    /**
+     * Return the first parent name (at the moment the only one set
+     * and used, anyway. This is a convenient method to {@link
+     * #getParentNames}. <p>
+     *
+     * @return parent name, or an empty string if there is no parent
+     * set
+     */
+    public String getParentName() {
+	String[] names = getParentNames();
+	return (names.length == 0 ? "" : names[0]);
+    }
+
     /**
      * @see #getParentNames
      * @param value is a set of parent names (usually just one name,

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyServiceType.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyServiceType.java	2005/10/28 11:30:37	1.4
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyServiceType.java	2005/11/10 08:54:32	1.5
@@ -83,6 +83,11 @@
 	description = (value == null ? "" : value);
     }
 
+    public String getParentName() {
+	String[] names = getParentNames();
+	return (names.length == 0 ? "" : names[0]);
+    }
+
     public String[] getParentNames() {
 	synchronized (parentNames) {
 	    String[] names = new String [parentNames.length];

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Utils.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Utils.java	2005/11/07 07:03:50	1.7
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/Utils.java	2005/11/10 08:54:32	1.8
@@ -106,6 +106,25 @@
     }
 
     /*************************************************************************
+     * Give back an elapsed time (given in milllis) in a human
+     * readable form. <p>
+     *
+     * @param millis is a time interval in milliseconds
+     * @return formatted, human-readable, time
+     *************************************************************************/
+    public static String ms2Human (long millis) {
+	StringBuffer buf = new StringBuffer (100);
+	long seconds = millis / 1000;
+	long minutes = seconds / 60;
+	long hours = minutes / 60;
+	long days = hours / 24;
+	if (days > 0)
+	    buf.append (days + " days and ");
+	buf.append ((hours % 24) + ":" + (minutes % 60) + ":" + (seconds % 60) + "." + (millis % 1000));
+	return new String (buf);
+    }
+
+    /*************************************************************************
      * Return just the last part of the LSID identifier. An example of
      * an LSID identifier as used by and returned from the Moby
      * registry is <tt>urn:lsid:biomoby.org:objectclass:object</tt>.




More information about the MOBY-guts mailing list