Class QueryChemObject

    • Method Detail

      • getListenerCount

        public int getListenerCount()
        Returns the number of ChemObjectListeners registered with this object.
        Specified by:
        getListenerCount in interface IChemObject
        Returns:
        the number of registered listeners.
      • notifyChanged

        public void notifyChanged()
        This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.
        Specified by:
        notifyChanged in interface IChemObject
      • notifyChanged

        public void notifyChanged​(IChemObjectChangeEvent evt)
        This should be triggered by an method that changes the content of an object to that the registered listeners can react to it. This is a version of notifyChanged() which allows to propagate a change event while preserving the original origin.
        Specified by:
        notifyChanged in interface IChemObject
        Parameters:
        evt - A ChemObjectChangeEvent pointing to the source of where the change happend
      • getProperty

        public <T> T getProperty​(Object description,
                                 Class<T> c)
        Access a property of the given description and cast the specified class.
        
        
             IAtom atom = new Atom("C");
             atom.setProperty("number", 1); // set an integer property
        
             // access the property and automatically cast to an int
             Integer number = atom.getProperty("number");
        
             // if the method is in a chain or needs to be nested the type
             // can be provided
             methodAcceptingInt(atom.getProperty("number", Integer.class));
        
             // the type cannot be checked and so...
             String number = atom.getProperty("number"); // ClassCastException
        
             // if the type is provided a more meaningful error is thrown
             atom.getProperty("number", String.class); // IllegalArgumentException
        
         
        Specified by:
        getProperty in interface IChemObject
        Type Parameters:
        T - generic type (of provided class)
        Parameters:
        description - description of a property (normally a string)
        c - type of the value to be returned
        Returns:
        the value stored for the specified description.
        See Also:
        IChemObject.getProperty(Object), IChemObject.addProperties(java.util.Map)
      • setID

        public void setID​(String identifier)
        Sets the identifier (ID) of this object.
        Specified by:
        setID in interface IChemObject
        Parameters:
        identifier - a String representing the ID value
        See Also:
        getID()
      • setFlag

        public void setFlag​(int mask,
                            boolean value)
        Sets the value of some flag. The flag is a mask from a given CDKConstant (e.g. IChemObject.AROMATIC or IChemObject.VISITED). The flags are intrinsic internal properties and should not be used to store custom values, please use IChemObject.setProperty(Object, Object).
        
         // set this chem object to be aromatic
         chemObject.setFlag(CDKConstants.ISAROMATIC, Boolean.TRUE);
         // ...
         // indicate we have visited this chem object
         chemObject.setFlag(CDKConstants.VISITED, Boolean.TRUE);
         
        Specified by:
        setFlag in interface IChemObject
        Parameters:
        mask - flag to set the value for
        value - value to assign to flag
        See Also:
        IChemObject.getFlag(int)
      • getFlag

        public boolean getFlag​(int mask)
        Returns the value of a given flag. The flag is a mask from a given CDKConstant (e.g. IChemObject.AROMATIC).
        
         if(chemObject.getFlag(CDKConstants.ISAROMATIC)){
             // handle aromatic flag on this chem object
         }
         
        Specified by:
        getFlag in interface IChemObject
        Parameters:
        mask - flag to retrieve the value of
        Returns:
        true if the flag flag_type is set
        See Also:
        IChemObject.setFlag(int, boolean)
      • setProperties

        public void setProperties​(Map<Object,​Object> properties)
        Set the properties of this object to the provided map (shallow copy). Any existing properties are removed.
        Specified by:
        setProperties in interface IChemObject
        Parameters:
        properties - map key-value pairs
      • getFlagValue

        public Integer getFlagValue()
        Access the internal value used to store the flags. The flags are stored on a single numeric value and are set/cleared.
        Specified by:
        getFlagValue in interface IChemObject
        Returns:
        numeric representation of the flags
      • set

        public void set​(int flags)
        Description copied from interface: IChemObject
        Set the provided flags. Any on-bits in the input parameter are set on in the ChemObject.
        Specified by:
        set in interface IChemObject
        Parameters:
        flags - the flags
      • clear

        public void clear​(int flags)
        Description copied from interface: IChemObject
        Clear the provided flags. Any on-bits in the input parameter are set on in the ChemObject.
        Specified by:
        clear in interface IChemObject
        Parameters:
        flags - the flags
      • is

        public boolean is​(int flags)
        Description copied from interface: IChemObject
        Test if a flag(s) are set on this ChemObject. If multiple flags are provided they must all be set to return true.
        
         atom.set(IS_IN_RING);
         atom.is(IS_IN_RING); // false!
         atom.is(IS_IN_RING+IS_AROMATIC); // false!
         atom.set(IS_AROMATIC);
         atom.is(IS_IN_RING+IS_AROMATIC); // true!
         
        Specified by:
        is in interface IChemObject
        Parameters:
        flags - the flags
      • flags

        public int flags()
        Description copied from interface: IChemObject
        Access the current value of the flags for this ChemObject.
        Specified by:
        flags in interface IChemObject
        Returns:
        the flag value (32-bit integer)
      • setNotification

        public void setNotification​(boolean bool)
        Description copied from interface: IChemObject
        Set a flag to use or not use notification. By default it should be set to true.
        Specified by:
        setNotification in interface IChemObject
        Parameters:
        bool - if true, then notification messages are sent.
        See Also:
        IChemObject.getNotification()
      • matches

        public boolean matches​(IAtom atom)