001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 */ 020 021package org.biojava.utils; 022 023/** 024 * This is a flag interface that defines the common add/remove listener methods 025 * for classes and interfaces that wish to indicate that they are sources of 026 * ChangeEvents. 027 * 028 * @author Matthew Pocock 029 */ 030public interface Changeable { 031 /** 032 * Add a listener that will be informed of all changes. 033 * 034 * @param cl the ChangeListener to add 035 * @deprecated use addChangeListener(cl, ChangeType.UNKNOWN) 036 */ 037 public void addChangeListener(ChangeListener cl); 038 039 /** 040 * Add a listener that will be informed of changes of a given type. 041 * 042 * @param cl the ChangeListener 043 * @param ct the ChangeType it is to be informed of 044 */ 045 public void addChangeListener(ChangeListener cl, ChangeType ct); 046 047 /** 048 * Remove a listener that was interested in all types of changes. 049 * 050 * @param cl a ChangeListener to remove 051 * @deprecated use removeChangeListener(cl, ChangeType.UNKNOWN) 052 */ 053 public void removeChangeListener(ChangeListener cl); 054 055 /** 056 * Remove a listener that was interested in a specific types of changes. 057 * 058 * @param cl a ChangeListener to remove 059 * @param ct the ChangeType that it was interested in 060 */ 061 public void removeChangeListener(ChangeListener cl, ChangeType ct); 062 063 /** 064 * <p> 065 * A particular ChangeType can never be raised by this Changeable. 066 * </p> 067 * 068 * <p> 069 * If this returns true, then it is guaranteed that change events of this type 070 * (and all child types) can never under any circumstances be fired by this 071 * Changeable instance. If it returns false, that does not mean that this type 072 * of event will or even can be raised, but that it is worth registering 073 * listeners incase. 074 * </p> 075 * 076 * @param ct the ChangeType to check 077 * @return true if ChangeEvents of this type are guaranteed to never be fired 078 */ 079 public boolean isUnchanging(ChangeType ct); 080}