1 /* Copyright (C) 2009-2010 Syed Asad Rahman <asad@ebi.ac.uk> 2 * 3 * Contact: cdk-devel@lists.sourceforge.net 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public License 7 * as published by the Free Software Foundation; either version 2.1 8 * of the License, or (at your option) any later version. 9 * All we ask is that proper credit is given for our work, which includes 10 * - but is not limited to - adding the above copyright notice to the beginning 11 * of your source code files, and to any copyright notice that you may distribute 12 * with programs based on this work. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 22 */ 23 package org.openscience.cdk.smsd.algorithm.vflib.builder; 24 25 import java.util.ArrayList; 26 import java.util.Collections; 27 import java.util.List; 28 29 import org.openscience.cdk.smsd.algorithm.matchers.VFAtomMatcher; 30 import org.openscience.cdk.smsd.algorithm.vflib.interfaces.IEdge; 31 import org.openscience.cdk.smsd.algorithm.vflib.interfaces.INode; 32 33 /** 34 * Class for building/storing nodes (atoms) in the graph with atom 35 * query capabilities. 36 * @cdk.module smsd 37 * @cdk.githash 38 * @author Syed Asad Rahman <asad@ebi.ac.uk> 39 * @deprecated SMSD has been deprecated from the CDK with a newer, more recent 40 * version of SMSD is available at <a href="http://github.com/asad/smsd">http://github.com/asad/smsd</a>. 41 */ 42 @Deprecated 43 public class NodeBuilder implements INode { 44 45 private List<INode> neighborsList; 46 private List<IEdge> edgesList; 47 private VFAtomMatcher matcher; 48 49 /** 50 * Construct a node for a query atom 51 * @param matcher 52 */ NodeBuilder(VFAtomMatcher matcher)53 protected NodeBuilder(VFAtomMatcher matcher) { 54 edgesList = new ArrayList<IEdge>(); 55 neighborsList = new ArrayList<INode>(); 56 this.matcher = matcher; 57 } 58 59 /** {@inheritDoc} */ 60 @Override countNeighbors()61 public int countNeighbors() { 62 return neighborsList.size(); 63 } 64 65 /** {@inheritDoc} */ 66 @Override neighbors()67 public Iterable<INode> neighbors() { 68 return Collections.unmodifiableList(neighborsList); 69 } 70 71 /** {@inheritDoc} */ 72 @Override getAtomMatcher()73 public VFAtomMatcher getAtomMatcher() { 74 return matcher; 75 } 76 77 /** {@inheritDoc} */ 78 @Override getEdges()79 public List<IEdge> getEdges() { 80 return Collections.unmodifiableList(edgesList); 81 } 82 83 /** {@inheritDoc} */ 84 @Override addEdge(EdgeBuilder edge)85 public void addEdge(EdgeBuilder edge) { 86 edgesList.add(edge); 87 } 88 89 /** {@inheritDoc} */ 90 @Override addNeighbor(NodeBuilder node)91 public void addNeighbor(NodeBuilder node) { 92 neighborsList.add(node); 93 } 94 } 95