Author: mes
Date: 2012-05-07 15:19:00 -0700 (Mon, 07 May 2012)
New Revision: 29140

Removed:
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/CyAttributesReader.java.asdf
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java.asdf
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReaderFactory.java.asdf
Modified:
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/CyActivator.java
Log:
removed unused code

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/CyActivator.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/CyActivator.java
      2012-05-07 22:10:30 UTC (rev 29139)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/CyActivator.java
      2012-05-07 22:19:00 UTC (rev 29140)
@@ -145,7 +145,6 @@
                BasicCyFileFilter pdfFilter = new BasicCyFileFilter(new 
String[]{"pdf"}, new String[]{"image/pdf"}, "PDF File",DataCategory.IMAGE, 
streamUtil);
                BasicCyFileFilter psFilter = new BasicCyFileFilter(new 
String[]{"ps"}, new String[]{"image/ps"}, "Post Script (PS) 
File",DataCategory.IMAGE, streamUtil);
                BasicCyFileFilter svgFilter = new BasicCyFileFilter(new 
String[]{"svg"}, new String[]{"image/svg"}, "Scalable Vector Graphics (SVG) 
File",DataCategory.IMAGE, streamUtil);
-               BasicCyFileFilter textTableFilter = new BasicCyFileFilter(new 
String[]{}, new String[]{"text/plain"}, "Any text file",DataCategory.TABLE, 
streamUtil);
                BasicCyFileFilter attrsFilter = new BasicCyFileFilter(new 
String[]{"attrs"}, new String[]{"text/plain"}, "Any text 
file",DataCategory.TABLE, streamUtil);
                BasicCyFileFilter sifFilter = new BasicCyFileFilter(new 
String[]{"sif"}, new String[]{"text/sif"}, "SIF files",DataCategory.NETWORK, 
streamUtil);
                BasicCyFileFilter csvFilter = new BasicCyFileFilter(new 
String[]{"csv"}, new String[]{"text/plain"}, "CSV file",DataCategory.TABLE, 
streamUtil);

Deleted: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/CyAttributesReader.java.asdf
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/CyAttributesReader.java.asdf
   2012-05-07 22:10:30 UTC (rev 29139)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/CyAttributesReader.java.asdf
   2012-05-07 22:19:00 UTC (rev 29140)
@@ -1,334 +0,0 @@
-/*
-  File: CyAttributesReader.java
-
-  Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org)
-
-  The Cytoscape Consortium is:
-  - Institute for Systems Biology
-  - University of California San Diego
-  - Memorial Sloan-Kettering Cancer Center
-  - Institut Pasteur
-  - Agilent Technologies
-
-  This library is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2.1 of the License, or
-  any later version.
-
-  This library is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
-  MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  The software and
-  documentation provided hereunder is on an "as is" basis, and the
-  Institute for Systems Biology and the Whitehead Institute
-  have no obligations to provide maintenance, support,
-  updates, enhancements or modifications.  In no event shall the
-  Institute for Systems Biology and the Whitehead Institute
-  be liable to any party for direct, indirect, special,
-  incidental or consequential damages, including lost profits, arising
-  out of the use of this software and its documentation, even if the
-  Institute for Systems Biology and the Whitehead Institute
-  have been advised of the possibility of such damage.  See
-  the GNU Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with this library; if not, write to the Free Software Foundation,
-  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-package cytoscape.data.readers;
-
-import org.cytoscape.model.CyRow;
-import org.cytoscape.attributes.MultiHashMapDefinition;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-
-// I hate writing parsing code.  Grumble grumble grumble.
-/**
- *
- */
-public class CyAttributesReader {
-       /**
-        *  DOCUMENT ME!
-        *
-        * @param cyAttrs DOCUMENT ME!
-        * @param fileIn DOCUMENT ME!
-        *
-        * @throws IOException DOCUMENT ME!
-        */
-       public static void loadAttributes(CyAttributes cyAttrs, Reader fileIn)
-           throws IOException {
-               int lineNum = 0;
-
-               try {
-                       final BufferedReader reader;
-
-                       if (fileIn instanceof BufferedReader) {
-                               reader = (BufferedReader) fileIn;
-                       } else {
-                               reader = new BufferedReader(fileIn);
-                       }
-
-                       String attributeName;
-                       byte type = -1;
-
-                       {
-                               final String firstLine = reader.readLine();
-                               lineNum++;
-
-                               if (firstLine == null) {
-                                       return;
-                               }
-
-                               final String searchStr = "class=";
-                               final int inx = firstLine.indexOf(searchStr);
-
-                               if (inx < 0) {
-                                       attributeName = firstLine.trim();
-                               } else {
-                                       attributeName = firstLine.substring(0, 
inx - 1).trim();
-
-                                       String foo = firstLine.substring(inx);
-                                       final StringTokenizer tokens = new 
StringTokenizer(foo);
-                                       foo = tokens.nextToken();
-
-                                       String className = 
foo.substring(searchStr.length()).trim();
-
-                                       if (className.endsWith(")")) {
-                                               className = 
className.substring(0, className.length() - 1);
-                                       }
-
-                                       if 
(className.equalsIgnoreCase("java.lang.String")
-                                           || 
className.equalsIgnoreCase("String")) {
-                                               type = 
MultiHashMapDefinition.TYPE_STRING;
-                                       } else if 
(className.equalsIgnoreCase("java.lang.Boolean")
-                                                  || 
className.equalsIgnoreCase("Boolean")) {
-                                               type = 
MultiHashMapDefinition.TYPE_BOOLEAN;
-                                       } else if 
(className.equalsIgnoreCase("java.lang.Integer")
-                                                  || 
className.equalsIgnoreCase("Integer")) {
-                                               type = 
MultiHashMapDefinition.TYPE_INTEGER;
-                                       } else if 
(className.equalsIgnoreCase("java.lang.Double")
-                                                  || 
className.equalsIgnoreCase("Double")
-                                                  || 
className.equalsIgnoreCase("java.lang.Float")
-                                                  || 
className.equalsIgnoreCase("Float")) {
-                                               type = 
MultiHashMapDefinition.TYPE_FLOATING_POINT;
-                                       }
-                               }
-                       }
-
-                       if (attributeName.indexOf("(") >= 0) {
-                               attributeName = attributeName.substring(0, 
attributeName.indexOf("(")).trim();
-                       }
-
-                       boolean firstLine = true;
-                       boolean list = false;
-
-                       while (true) {
-                               final String line = reader.readLine();
-                               lineNum++;
-
-                               if (line == null) {
-                                       break;
-                               }
-
-                               if ("".equals(line.trim())) {
-                                       continue;
-                               }
-
-                               int inx = line.indexOf('=');
-                               final String key = line.substring(0, 
inx).trim();
-                               String val = line.substring(inx + 1).trim();
-
-                               if (firstLine && val.startsWith("(")) {
-                                       list = true;
-                               }
-
-                               if (list) {
-                                       // Chop away leading '(' and trailing 
')'.
-                                       val = val.substring(1).trim();
-                                       val = val.substring(0, val.length() - 
1).trim();
-
-                                       // Home-grown parsing (ughh) to handle 
escape sequences.
-                                       final ArrayList<Object> elmsBuff = new 
ArrayList<Object>();
-
-                                       while (val.length() > 0) {
-                                               final StringBuilder elmBuff = 
new StringBuilder();
-                                               int inx2;
-
-                                               for (inx2 = 0; inx2 < 
val.length(); inx2++) {
-                                                       char ch = 
val.charAt(inx2);
-
-                                                       if (ch == ':') {
-                                                               inx2++;
-                                                               inx2++;
-
-                                                               break;
-                                                       } else if (ch == '\\') {
-                                                               if ((inx2 + 1) 
< val.length()) {
-                                                                       inx2++;
-
-                                                                       char 
ch2 = val.charAt(inx2);
-
-                                                                       if (ch2 
== 'n') {
-                                                                               
elmBuff.append('\n');
-                                                                       } else 
if (ch2 == 't') {
-                                                                               
elmBuff.append('\t');
-                                                                       } else 
if (ch2 == 'b') {
-                                                                               
elmBuff.append('\b');
-                                                                       } else 
if (ch2 == 'r') {
-                                                                               
elmBuff.append('\r');
-                                                                       } else 
if (ch2 == 'f') {
-                                                                               
elmBuff.append('\f');
-                                                                       } else {
-                                                                               
elmBuff.append(ch2);
-                                                                       }
-                                                               } else {
-                                                                       /* val 
ends in '\' - just ignore it. */ }
-                                                       } else {
-                                                               
elmBuff.append(ch);
-                                                       }
-                                               }
-
-                                               elmsBuff.add(new 
String(elmBuff));
-                                               val = val.substring(inx2);
-                                       }
-
-                                       if (firstLine) {
-                                               if (type < 0) {
-                                                       while (true) {
-                                                               try {
-                                                                       
Integer.valueOf((String) elmsBuff.get(0));
-                                                                       type = 
MultiHashMapDefinition.TYPE_INTEGER;
-
-                                                                       break;
-                                                               } catch 
(Exception e) {
-                                                               }
-
-                                                               try {
-                                                                       new 
Double((String) elmsBuff.get(0));
-                                                                       type = 
MultiHashMapDefinition.TYPE_FLOATING_POINT;
-
-                                                                       break;
-                                                               } catch 
(Exception e) {
-                                                               }
-
-                                                               //              
 try {
-                                                               //              
   new Boolean((String) elmsBuff.get(0));
-                                                               //              
   type = MultiHashMapDefinition.TYPE_BOOLEAN;
-                                                               //              
   break; }
-                                                               //              
 catch (Exception e) {}
-                                                               type = 
MultiHashMapDefinition.TYPE_STRING;
-
-                                                               break;
-                                                       }
-                                               }
-
-                                               firstLine = false;
-                                       }
-
-                                       for (int i = 0; i < elmsBuff.size(); 
i++) {
-                                               if (type == 
MultiHashMapDefinition.TYPE_INTEGER) {
-                                                       elmsBuff.set(i, 
Integer.valueOf((String) elmsBuff.get(i)));
-                                               } else if (type == 
MultiHashMapDefinition.TYPE_BOOLEAN) {
-                                                       elmsBuff.set(i, new 
Boolean((String) elmsBuff.get(i)));
-                                               } else if (type == 
MultiHashMapDefinition.TYPE_FLOATING_POINT) {
-                                                       elmsBuff.set(i, new 
Double((String) elmsBuff.get(i)));
-                                               } else {
-                                                       // A string; do nothing.
-                                               }
-                                       }
-
-                                       cyAttrs.setListAttribute(key, 
attributeName, elmsBuff);
-                               } else { // Not a list.
-                                            // Do the escaping thing.
-
-                                       final StringBuilder elmBuff = new 
StringBuilder();
-                                       int inx2;
-
-                                       for (inx2 = 0; inx2 < val.length(); 
inx2++) {
-                                               char ch = val.charAt(inx2);
-
-                                               if (ch == '\\') {
-                                                       if ((inx2 + 1) < 
val.length()) {
-                                                               inx2++;
-
-                                                               char ch2 = 
val.charAt(inx2);
-
-                                                               if (ch2 == 'n') 
{
-                                                                       
elmBuff.append('\n');
-                                                               } else if (ch2 
== 't') {
-                                                                       
elmBuff.append('\t');
-                                                               } else if (ch2 
== 'b') {
-                                                                       
elmBuff.append('\b');
-                                                               } else if (ch2 
== 'r') {
-                                                                       
elmBuff.append('\r');
-                                                               } else if (ch2 
== 'f') {
-                                                                       
elmBuff.append('\f');
-                                                               } else {
-                                                                       
elmBuff.append(ch2);
-                                                               }
-                                                       } else {
-                                                               /* val ends in 
'\' - just ignore it. */ }
-                                               } else {
-                                                       elmBuff.append(ch);
-                                               }
-                                       }
-
-                                       val = new String(elmBuff);
-
-                                       if (firstLine) {
-                                               if (type < 0) {
-                                                       while (true) {
-                                                               try {
-                                                                       
Integer.valueOf(val);
-                                                                       type = 
MultiHashMapDefinition.TYPE_INTEGER;
-
-                                                                       break;
-                                                               } catch 
(Exception e) {
-                                                               }
-
-                                                               try {
-                                                                       new 
Double(val);
-                                                                       type = 
MultiHashMapDefinition.TYPE_FLOATING_POINT;
-
-                                                                       break;
-                                                               } catch 
(Exception e) {
-                                                               }
-
-                                                               //              
 try {
-                                                               //              
   new Boolean(val);
-                                                               //              
   type = MultiHashMapDefinition.TYPE_BOOLEAN;
-                                                               //              
   break; }
-                                                               //              
 catch (Exception e) {}
-                                                               type = 
MultiHashMapDefinition.TYPE_STRING;
-
-                                                               break;
-                                                       }
-                                               }
-
-                                               firstLine = false;
-                                       }
-
-                                       if (type == 
MultiHashMapDefinition.TYPE_INTEGER) {
-                                               cyAttrs.setAttribute(key, 
attributeName, Integer.valueOf(val));
-                                       } else if (type == 
MultiHashMapDefinition.TYPE_BOOLEAN) {
-                                               cyAttrs.setAttribute(key, 
attributeName, new Boolean(val));
-                                       } else if (type == 
MultiHashMapDefinition.TYPE_FLOATING_POINT) {
-                                               cyAttrs.setAttribute(key, 
attributeName, new Double(val));
-                                       } else {
-                                               cyAttrs.setAttribute(key, 
attributeName, val);
-                                       }
-                               }
-                       }
-               } catch (Exception e) {
-                       e.printStackTrace();
-
-                       String message = "failed parsing attributes file at 
line: " + lineNum
-                                        + " with exception: ";
-                       throw new IOException(message + e.getMessage());
-               }
-       }
-}

Deleted: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java.asdf
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java.asdf
  2012-05-07 22:10:30 UTC (rev 29139)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java.asdf
  2012-05-07 22:19:00 UTC (rev 29140)
@@ -1,119 +0,0 @@
-package org.cytoscape.io.internal.read.datatable;
-
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-
-import org.cytoscape.io.internal.read.AbstractTableReader;
-import org.cytoscape.model.CyTable;
-import org.cytoscape.model.CyTableFactory;
-import org.cytoscape.model.CyRow;
-import org.cytoscape.work.TaskMonitor;
-import org.cytoscape.work.Tunable;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.cytoscape.model.CyTableEntry.*;
-
-
-public class TextDataTableReader extends AbstractTableReader {
-       @Tunable(description="Column delimiter character")
-       public String delimiter = "\t";
-
-       @Tunable(description="Table name")
-       public String tableName = "";
-
-       private String[] columnNames;
-       private static final Logger logger = 
LoggerFactory.getLogger(TextDataTableReader.class);
-
-       public TextDataTableReader(InputStream inputStream, CyTableFactory 
tableFactory) {
-               super(inputStream, tableFactory);
-       }
-
-       @Override
-       public void run(TaskMonitor tm) throws IOException {
-               try {
-       
-               
-                       String line;
-                       final BufferedReader br = new BufferedReader(new 
InputStreamReader(inputStream));
-               
-                       line = br.readLine();
-                       final CyTable table = createTable(line);
-               
-                       while ((line = br.readLine()) != null) 
-                               processLine(table, line);
-       
-                       cyTables = new CyTable[] { table };
-
-               } finally {
-                       if (inputStream != null) {
-                               inputStream.close();
-                               inputStream = null;
-                       }
-               }
-
-               tm.setProgress(1.0);
-       }
-
-       @Override
-       public void cancel() {
-       }
-
-       private CyTable createTable(String line) throws IOException {
-               if (line == null)
-                       throw new IllegalStateException("Column names cannot be 
null");
-               
-               columnNames = line.split(delimiter);
-
-               checkForDuplicates( columnNames );
-               final CyTable table = tableFactory.createTable(tableName, 
columnNames[0], 
-                                                              String.class, 
true, true);
-               
-               for (String col : Arrays.copyOfRange(columnNames, 1, 
columnNames.length))
-                       table.createColumn(col, String.class, false);
-
-               return table;
-       }
-
-       private void checkForDuplicates(String[] names) throws IOException {
-               Map<String,Integer> map = new HashMap<String,Integer>();
-
-               for ( String n : names ) {
-                       if ( !map.containsKey(n) )
-                               map.put(n,0);
-                       map.put(n, map.get(n) + 1 );
-               }
-       
-               if (map.keySet().size() != names.length) {
-                       String dupes = " ";
-                       for ( Map.Entry<String,Integer> entry : map.entrySet() )
-                               if ( entry.getValue() > 1 )
-                                       dupes += entry.getKey() + " ";
-               
-                       throw new IOException("Illegal duplicate column headers 
found: " + dupes);
-               }
-       }
-
-       private void processLine(CyTable table, String line) {
-               String[] buffer = line.split(delimiter);
-
-               if ( buffer.length != columnNames.length ) {
-                       logger.warn("Skipping line: '" + line + "' due to 
incorrect length");
-                       return;
-               }
-               
-               CyRow row = table.getRow(buffer[0]);
-
-               for(int i = 0; i<buffer.length; i++) 
-                       row.set(columnNames[i], buffer[i]);
-       }
-}

Deleted: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReaderFactory.java.asdf
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReaderFactory.java.asdf
   2012-05-07 22:10:30 UTC (rev 29139)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReaderFactory.java.asdf
   2012-05-07 22:19:00 UTC (rev 29140)
@@ -1,20 +0,0 @@
-package org.cytoscape.io.internal.read.datatable;
-
-
-import org.cytoscape.io.CyFileFilter;
-import org.cytoscape.io.read.CyTableReader;
-import org.cytoscape.io.internal.read.AbstractTableReaderFactory;
-import org.cytoscape.model.CyTable;
-import org.cytoscape.model.CyTableFactory;
-import org.cytoscape.work.TaskIterator;
-
-
-public class TextDataTableReaderFactory extends AbstractTableReaderFactory {
-       public TextDataTableReaderFactory(CyFileFilter filter, CyTableFactory 
factory) {
-               super(filter, factory);
-       }
-
-       public TaskIterator getTaskIterator() {
-               return new TaskIterator(new TextDataTableReader(inputStream, 
tableFactory));
-       }
-}

-- 
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