001         package com.croftsoft.core.util.state;
002    
003         import com.croftsoft.core.util.consumer.Consumer;
004    
005         /*********************************************************************
006         *
007         * Adapts the StateListener interface to the Consumer interface.
008         *
009         * @author
010         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
011         * @version
012         *   1998-12-05
013         *********************************************************************/
014    
015         public class  StateListenerConsumer implements Consumer
016         //////////////////////////////////////////////////////////////////////
017         //////////////////////////////////////////////////////////////////////
018         {
019    
020         protected StateListener  stateListener;
021    
022         //////////////////////////////////////////////////////////////////////
023         //////////////////////////////////////////////////////////////////////
024    
025         public  StateListenerConsumer ( StateListener  stateListener )
026         //////////////////////////////////////////////////////////////////////
027         {
028           this.stateListener = stateListener;
029         }
030    
031         //////////////////////////////////////////////////////////////////////
032         //////////////////////////////////////////////////////////////////////
033    
034         public void  consume ( Object  o )
035         //////////////////////////////////////////////////////////////////////
036         {
037           stateListener.stateListen ( ( State ) o );
038         }
039    
040         //////////////////////////////////////////////////////////////////////
041         //////////////////////////////////////////////////////////////////////
042         }