001package org.biopax.paxtools.io.sbgn;
002
003import org.biopax.paxtools.model.level3.PhysicalEntity;
004
005import java.util.Set;
006
007/**
008 * Detects ubiquitous molecules using a given ID set.
009 *
010 * @author Ozgun Babur
011 */
012public class ListUbiqueDetector implements UbiqueDetector
013{
014        /**
015         * IDs of ubiques.
016         */
017        Set<String> ubiqueIDs;
018
019        /**
020         * Contructor with the Ubique IDs.
021         * @param ubiqueIDs IDs of ubiques
022         */
023        public ListUbiqueDetector(Set<String> ubiqueIDs)
024        {
025                this.ubiqueIDs = ubiqueIDs;
026        }
027
028        /**
029         * Checks if the ID of the PhysicalEntity is in the set.
030         * @param pe PhysicalEntity to check
031         * @return true if ubique
032         */
033        @Override
034        public boolean isUbique(PhysicalEntity pe)
035        {
036                return ubiqueIDs.contains(pe.getRDFId());
037        }
038}