Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replaced field declaration of Vector with List

Change-Id: I91e1b89c5c60abe97e3733265af8f6fd456cf97a
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information...
commit d796b4a4e7798cd3db55f2327f9b33c7a4942736 1 parent f97b493
@johnmay johnmay authored egonw committed
View
13 src/main/org/openscience/cdk/iupac/parser/AttachedGroup.java
@@ -24,8 +24,9 @@
package org.openscience.cdk.iupac.parser;
+import java.util.ArrayList;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
/**
* Holds data on a specific functional group or substituent.
@@ -38,7 +39,7 @@
/** The name of the group */
private String name = "";
/** The collection of locations the group is attached to */
- private Vector locations = new Vector();
+ private List<Token> locations = new ArrayList<Token>();
/** The length of the substituent chain */
private int length = 0;
@@ -47,14 +48,14 @@ public AttachedGroup() {
}
/** Creates a new instance of AttachedGroup with a Sting denoting the functional group */
- public AttachedGroup (Vector locations, String name)
+ public AttachedGroup (List<Token> locations, String name)
{
setLocations (locations);
setName (name);
}
/** Creates a new instance of AttachedGroup with an int denoting the length of the substituent chain */
- public AttachedGroup (Vector locations, int length)
+ public AttachedGroup (List<Token> locations, int length)
{
setLocations (locations);
setLength (length);
@@ -80,7 +81,7 @@ public void setName(java.lang.String name) {
* @return Value of property locations.
*
*/
- public java.util.Vector getLocations() {
+ public List<Token> getLocations() {
return locations;
}
@@ -88,7 +89,7 @@ public void setName(java.lang.String name) {
* @param locations New value of property locations.
*
*/
- public void setLocations(java.util.Vector locations) {
+ public void setLocations(List<Token> locations) {
this.locations = locations;
}
View
20 src/main/org/openscience/cdk/iupac/parser/MoleculeBuilder.java
@@ -25,7 +25,7 @@
package org.openscience.cdk.iupac.parser;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
import org.openscience.cdk.Atom;
import org.openscience.cdk.AtomContainer;
@@ -65,7 +65,7 @@
/**
* Builds the main chain which may act as a foundation for futher working groups.
*
- * @param mainChain The parsed prefix which depicts the chain's length.
+ * @param mainChain The parsed prefix which depicts the chain's length.
* @param isMainCyclic A flag to show if the molecule is a ring. 0 means not a ring, 1 means is a ring.
* @return A Molecule containing the requested chain.
*/
@@ -102,12 +102,12 @@ private IAtomContainer buildChain(int length, boolean isMainCyclic)
* @param attachedGroups A vector of AttachedGroup's representing functional groups.
* @see #addFunGroup
*/
- private void buildFunGroups(Vector attachedGroups)
+ private void buildFunGroups(List<AttachedGroup> attachedGroups)
{
- Iterator groupsIterator = attachedGroups.iterator();
+ Iterator<AttachedGroup> groupsIterator = attachedGroups.iterator();
while (groupsIterator.hasNext())
{
- AttachedGroup attachedGroup = (AttachedGroup) groupsIterator.next();
+ AttachedGroup attachedGroup = groupsIterator.next();
Iterator locationsIterator = attachedGroup.getLocations().iterator();
while (locationsIterator.hasNext())
@@ -483,12 +483,12 @@ private void addAtom(String newAtomType, IAtom otherConnectingAtom, Order bondOr
*
* @param attachedSubstituents A vector of AttachedGroup's representing substituents.
*/
- private void addHeads(Vector attachedSubstituents)
+ private void addHeads(List<AttachedGroup> attachedSubstituents)
{
- Iterator substituentsIterator = attachedSubstituents.iterator();
+ Iterator<AttachedGroup> substituentsIterator = attachedSubstituents.iterator();
while (substituentsIterator.hasNext())
{
- AttachedGroup attachedSubstituent = (AttachedGroup) substituentsIterator.next();
+ AttachedGroup attachedSubstituent = substituentsIterator.next();
Iterator locationsIterator = attachedSubstituent.getLocations().iterator();
while (locationsIterator.hasNext())
@@ -528,8 +528,8 @@ private void addHeads(Vector attachedSubstituents)
* @param isMainCyclic An indiacation of if the main chain is cyclic.
* @return The molecule as built from the parsed tokens.
*/
- protected IAtomContainer buildMolecule(int mainChain, Vector attachedSubstituents
- , Vector attachedGroups, boolean isMainCyclic, String name) throws
+ protected IAtomContainer buildMolecule(int mainChain, List<AttachedGroup> attachedSubstituents
+ , List<AttachedGroup> attachedGroups, boolean isMainCyclic, String name) throws
ParseException, CDKException
{
//Set up the molecle's name
View
22 src/main/org/openscience/cdk/iupac/parser/NomParser.jj
@@ -46,17 +46,17 @@ public class NomParser {
private static boolean isMainCyclic;
/** The tempory vector of locations the current group/substiuant is attached to */
- private static Vector tempLocation;
+ private static List<Token> tempLocation;
/** The vector of attached functional groups, with an instance of AttachedGroup for each
* functional group.
*/
- private static Vector attachedGroups;
+ private static List<AttachedGroup> attachedGroups;
/** The vector of attached substituent, with an instance of AttachedGroup for each
* substituent.
*/
- private static Vector attachedSubstituents;
+ private static List<AttachedGroup> attachedSubstituents;
/**
* Used in the build up of ancient greek style prfixes
@@ -74,9 +74,9 @@ public class NomParser {
public static IAtomContainer generate (String stringToParse) throws ParseException, CDKException
{
isMainCyclic = false;
- tempLocation = new Vector();
- attachedSubstituents = new Vector();
- attachedGroups = new Vector();
+ tempLocation = new ArrayList<Token>();
+ attachedSubstituents = new ArrayList<AttachedGroup>();
+ attachedGroups = new ArrayList<AttachedGroup>();
currentNumber = 0;
StringReader stringReader = new StringReader (stringToParse.toLowerCase() + "\n");
@@ -103,17 +103,17 @@ public class NomParser {
* @throws ParseException A taylored instance of ParseException so nomen can display
* the error to the user.
*/
- private static void checkConnections (Iterator vectorIterator) throws ParseException
+ private static void checkConnections (Iterator<AttachedGroup> vectorIterator) throws ParseException
{
while (vectorIterator.hasNext())
{
- AttachedGroup ag = (AttachedGroup) vectorIterator.next();
- Vector locations = ag.getLocations();
+ AttachedGroup ag = vectorIterator.next();
+ List<Token> locations = ag.getLocations();
- Iterator locationsIterator = locations.iterator();
+ Iterator<Token> locationsIterator = locations.iterator();
while (locationsIterator.hasNext())
{
- Token tok = (Token) locationsIterator.next();
+ Token tok = locationsIterator.next();
try
{
View
12 src/main/org/openscience/cdk/renderer/GraphRendererModel.java
@@ -26,6 +26,8 @@
package org.openscience.cdk.renderer;
import java.awt.Color;
+import java.util.ArrayList;
+import java.util.List;
import org.openscience.cdk.math.IFunction;
@@ -48,8 +50,8 @@
private String xtitle = "X title"; // Title of the x axis
private String ytitle = "Y title"; // Title of the y axis
- private java.util.Vector functions = new java.util.Vector();
- private java.util.Vector colors = new java.util.Vector();
+ private List<IFunction> functions = new ArrayList<IFunction>();
+ private List<Color> colors = new ArrayList<Color>();
/** Paints the function normal */
public final static int NORMAL = 0;
@@ -207,7 +209,7 @@ public void addFunction(IFunction function, Color color)
colors.add(color);
}
else
- colors.setElementAt(color, functions.indexOf(function));
+ colors.set(functions.indexOf(function), color);
}
/**
@@ -223,7 +225,7 @@ public int getFunctionsSize()
*/
public IFunction getFunction(int index)
{
- return (IFunction) functions.elementAt(index);
+ return functions.get(index);
}
/**
@@ -231,6 +233,6 @@ public IFunction getFunction(int index)
*/
public Color getFunctionColor(int index)
{
- return (Color) colors.elementAt(index);
+ return colors.get(index);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.