Logo Search packages:      
Sourcecode: cdk version File versions  Download package

AttachedGroup.java
/* $RCSfile$
 * $Author$    
 * $Date$    
 * $Revision$
 * 
 *   Copyright (C) 2003  University of Manchester
 *   Copyright (C) 2003-2007  The Chemistry Development Kit (CDK) Project
 *
 *   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 (at your option) 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.  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, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 
 *   (or see http://www.gnu.org/copyleft/lesser.html)
 */

package org.openscience.cdk.iupac.parser;

import java.util.Iterator;
import java.util.Vector;

/**
 * Holds data on a specific functional group or substituent.
 *
 * @author  Stephen Tomkinson
 * @cdk.githash
 * @cdk.require ant1.6
 */
00037 public class AttachedGroup {
    /** The name of the group */
00039     private String name = "";
    /** The collection of locations the group is attached to */
00041     private Vector locations = new Vector();
    /** The length of the substituent chain */
00043     private int length = 0;
    
    /** Creates a new instance of FunctionalGroup */
00046     public AttachedGroup() {
    }
    
    /** Creates a new instance of AttachedGroup with a Sting denoting the functional group */
00050     public AttachedGroup (Vector locations, String name)
    {
        setLocations (locations);
        setName (name);
    }
    
    /** Creates a new instance of AttachedGroup with an int denoting the length of the substituent chain */
00057     public AttachedGroup (Vector locations, int length)
    {
        setLocations (locations);
        setLength (length);
    }
    
    /** Getter for property name.
     * @return Value of property name.
     *
     */
00067     public java.lang.String getName() {
        return name;
    }
    
    /** Setter for property name.
     * @param name New value of property name.
     *
     */
00075     public void setName(java.lang.String name) {
        this.name = name;
    }
    
    /** Getter for property locations.
     * @return Value of property locations.
     *
     */
00083     public java.util.Vector getLocations() {
        return locations;
    }
    
    /** Setter for property locations.
     * @param locations New value of property locations.
     *
     */
00091     public void setLocations(java.util.Vector locations) {
        this.locations = locations;
    }
    
    /**
     * A debug string which represents the contents of the class.
     */
00098     public String toString ()
    {
        String returnString = name + ": ";
        
        Iterator locationsIterator = locations.iterator();
        while (locationsIterator.hasNext())
        {
            Token locationToken = (Token) locationsIterator.next();
            returnString += locationToken.image + " ";
        }
        
        return returnString;
    }
    
    /** Getter for property length.
     * @return Value of property length.
     *
     */
00116     public int getLength()
    {
        return length;
    }
    
    /** Setter for property length.
     * @param length New value of property length.
     *
     */
00125     public void setLength(int length)
    {
        this.length = length;
    }   
}

Generated by  Doxygen 1.6.0   Back to index