/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
*
* Jalview 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. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.io;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
import java.util.Vector;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.xml.sax.SAXException;
-
-import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
-import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
-import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied;
-import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
-
/**
* DOCUMENT ME!
*
/**
* Properties to be added to generated alignment object
*/
- protected Hashtable properties;
+ protected Hashtable<Object, Object> properties;
long start;
*/
public AlignFile()
{
- // Shouldn't we init data structures (JBPNote: not sure - initData is for initialising the structures used for reading from a datasource, and the bare constructor hasn't got any datasource)
- initData();
+ // Shouldn't we init data structures (JBPNote: not sure - initData is for
+ // initialising the structures used for reading from a datasource, and the
+ // bare constructor hasn't got any datasource)
+ initData();
}
/**
* Filename to read from.
* @param type
* What type of file to read from (File, URL)
- * @throws Exception
*/
- public AlignFile(String inFile, String type) throws Exception
+ public AlignFile(String inFile, String type) throws IOException
{
super(inFile, type);
initData();
* off.
*
* @param source
- * @throws Exception
+ * @throws IOException
*/
- public AlignFile(FileParse source) throws Exception
+ public AlignFile(FileParse source) throws IOException
{
super(source);
initData();
for (int i = 0; i < seqs.size(); i++)
{
- s[i] = (SequenceI) seqs.elementAt(i);
+ s[i] = seqs.elementAt(i);
}
return s;
{
if (properties != null && properties.size() > 0)
{
- Enumeration keys = properties.keys();
- Enumeration vals = properties.elements();
+ Enumeration<Object> keys = properties.keys();
+ Enumeration<Object> vals = properties.elements();
while (keys.hasMoreElements())
{
al.setProperty(keys.nextElement(), vals.nextElement());
}
if (properties == null)
{
- properties = new Hashtable();
+ properties = new Hashtable<Object, Object>();
}
properties.put(key, value);
}
*/
protected void initData()
{
- seqs = new Vector();
+ seqs = new Vector<SequenceI>();
annotations = new Vector();
}
/**
+ * Return the alignment properties (or null if none set)
+ *
+ * @return
+ */
+ protected Set<Map.Entry<Object, Object>> getAlignmentProperties()
+ {
+ return (this.properties == null ? null : this.properties.entrySet());
+ }
+ /**
* DOCUMENT ME!
*
* @param s
*/
protected void setSeqs(SequenceI[] s)
{
- seqs = new Vector();
+ seqs = new Vector<SequenceI>();
for (int i = 0; i < s.length; i++)
{
/**
* This method must be implemented to parse the contents of the file.
-
*/
- public abstract void parse() throws Exception;
+ public abstract void parse() throws IOException;
/**
* Print out in alignment file format the Sequences in the seqs Vector.
/**
* vector of String[] treeName, newickString pairs
*/
- Vector newickStrings = null;
+ Vector<String[]> newickStrings = null;
protected void addNewickTree(String treeName, String newickString)
{
if (newickStrings == null)
{
- newickStrings = new Vector();
+ newickStrings = new Vector<String[]>();
}
newickStrings.addElement(new String[]
{ treeName, newickString });