Author: mes
Date: 2012-05-25 12:58:51 -0700 (Fri, 25 May 2012)
New Revision: 29360

Modified:
   core3/api/trunk/model-api/src/main/java/org/cytoscape/model/CyRow.java
   core3/api/trunk/model-api/src/main/java/org/cytoscape/model/CyTable.java
   
core3/api/trunk/model-api/src/test/java/org/cytoscape/model/AbstractCyTableTest.java
Log:
updated javadocs and tidied up some unit tests

Modified: core3/api/trunk/model-api/src/main/java/org/cytoscape/model/CyRow.java
===================================================================
--- core3/api/trunk/model-api/src/main/java/org/cytoscape/model/CyRow.java      
2012-05-25 19:39:18 UTC (rev 29359)
+++ core3/api/trunk/model-api/src/main/java/org/cytoscape/model/CyRow.java      
2012-05-25 19:58:51 UTC (rev 29360)
@@ -39,12 +39,13 @@
 public interface CyRow {
        /**
         * Returns the value found for this row in the specified column
-        * with the specified type.
+        * with the specified type. If the column name doesn't exist
         * @param <T> The generic type of the specified column.
         * @param columnName The name identifying the attribute.
         * @param type The type of the column.
-        * @return the value found for this row in the specified column
-        * Please not that this method cannot be used to retrieve values that 
are Lists!
+        * @return The value found for this row in the specified column and
+        * null if the column does not exist.
+        * Please note that this method should not be used to retrieve values 
that are Lists!
         */
        <T> T get(String columnName, Class<?extends T> type);
 
@@ -55,8 +56,9 @@
         * @param columnName The name identifying the attribute.
         * @param type The type of the column.
         * @param defaultValue The value to return if the column has not 
previously been set. 
-        * @return the value found for this row in the specified column
-        * Please not that this method cannot be used to retrieve values that 
are Lists!
+        * @return The value found for this row in the specified column, the 
default value
+        * if the row has not yet been set, and null if the column does not 
exist.
+        * Please note that this method should not be used to retrieve values 
that are Lists!
         */
        <T> T get(String columnName, Class<?extends T> type, T defaultValue);
 
@@ -66,8 +68,9 @@
         * @param <T> the generic type of the elements of the list we wish to 
retrieve.
         * @param columnName The name identifying the attribute.
         * @param listElementType  The type of the elements of the list that we 
wish to retrieve.
-        * @return the value found for this row in the specified column
-        * Please not that this method can only be used to retrieve values that 
are Lists!
+        * @return The value found for this row in the specified column and
+        * null if the column does not exist.
+        * Please note that this method can only be used to retrieve values 
that are Lists!
         */
        <T> List<T> getList(String columnName, Class<T> listElementType);
 
@@ -78,8 +81,9 @@
         * @param columnName The name identifying the attribute.
         * @param listElementType  The type of the elements of the list that we 
wish to retrieve.
         * @param defaultValue The List to return if the column has not 
previously been set. 
-        * @return the value found for this row in the specified column
-        * Please not that this method can only be used to retrieve values that 
are Lists!
+        * @return The value found for this row in the specified column, the 
default value
+        * if the row has not yet been set, and null if the column does not 
exist.
+        * Please note that this method can only be used to retrieve values 
that are Lists!
         */
        <T> List<T> getList(String columnName, Class<T> listElementType, 
List<T> defaultValue);
 
@@ -92,6 +96,8 @@
         * Please note that if "value" is a List it is your responsibility that 
all the
         * elements are of the type specified when the column was created with
         * {@link CyTable#createListColumn}!
+        * @throws IllegalArgumentException If the column does not yet exist or 
if the 
+        * the value does not match the column type.
         */
        <T> void set(String columnName, T value);
 

Modified: 
core3/api/trunk/model-api/src/main/java/org/cytoscape/model/CyTable.java
===================================================================
--- core3/api/trunk/model-api/src/main/java/org/cytoscape/model/CyTable.java    
2012-05-25 19:39:18 UTC (rev 29359)
+++ core3/api/trunk/model-api/src/main/java/org/cytoscape/model/CyTable.java    
2012-05-25 19:58:51 UTC (rev 29360)
@@ -116,9 +116,9 @@
        CyColumn getPrimaryKey();
 
        /**
-        * Returns the type of a column for this table.
-        * @param columnName  The name of the column whose type we desire.
-        * @return The column type of the column whose column name was 
provided, or null if there is
+        * Returns the column for the specified name. 
+        * @param columnName  The name of the column.
+        * @return The column for the name provided, or null if there is
         *         no column named "columnName".
         */
        CyColumn getColumn(String columnName);

Modified: 
core3/api/trunk/model-api/src/test/java/org/cytoscape/model/AbstractCyTableTest.java
===================================================================
--- 
core3/api/trunk/model-api/src/test/java/org/cytoscape/model/AbstractCyTableTest.java
        2012-05-25 19:39:18 UTC (rev 29359)
+++ 
core3/api/trunk/model-api/src/test/java/org/cytoscape/model/AbstractCyTableTest.java
        2012-05-25 19:58:51 UTC (rev 29360)
@@ -33,7 +33,6 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.awt.Color;
 import java.util.ArrayList;
@@ -170,47 +169,26 @@
                table.createListColumn("someList", String.class, false);
        }
 
-       @Test
+       @Test(expected=IllegalArgumentException.class)
        public void testAddBadAttr() {
-               try {
-                       attrs.set("nodeColor", Color.white);
-               } catch (IllegalArgumentException e) {
-                       // successfully caught the exception
-                       return;
-               }
-
-               // shouldn't get here
-               fail();
+               attrs.set("nodeColor", Color.white);
        }
 
-       @Test
+       @Test(expected=IllegalArgumentException.class)
        public void testAddBadList() {
                List<Color> l = new LinkedList<Color>();
                l.add(Color.white);
                l.add(Color.red);
 
-               try {
-                       attrs.set("someList", l);
-               } catch (IllegalArgumentException e) {
-                       // successfully caught the exception
-                       return;
-               }
-
-               // shouldn't get here
-               fail();
+               attrs.set("someList", l);
        }
 
        // You can't have an attribute with the same name, but
        // a different type.
-       @Test
+       @Test(expected=Exception.class)
        public void testAddDuplicateNameAttr() {
                table.createColumn("something", String.class, false);
-               try {
-                       table.createColumn("something", Integer.class, false);
-               } catch (Exception e) {
-                       return;
-               }
-               fail();
+               table.createColumn("something", Integer.class, false);
        }
 
        @Test

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to