001         package com.croftsoft.apps.chat.event;
002    
003         import com.croftsoft.core.lang.NullArgumentException;
004    
005         import com.croftsoft.core.animation.model.ModelId;
006         import com.croftsoft.core.math.geom.PointXY;
007         import com.croftsoft.core.math.geom.Point2DD;
008    
009         /*********************************************************************
010         * A model is moving.
011         *
012         * @version
013         *   2003-06-18
014         * @since
015         *   2003-06-07
016         * @author
017         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
018         *********************************************************************/
019    
020         public final class  MoveEvent
021           extends AbstractEvent
022         //////////////////////////////////////////////////////////////////////
023         //////////////////////////////////////////////////////////////////////
024         {
025    
026         private static final long  serialVersionUID = 0L;
027    
028         //
029    
030         private final ModelId  modelId;
031    
032         private final PointXY  origin;
033    
034         private final PointXY  destination;
035    
036         //////////////////////////////////////////////////////////////////////
037         //////////////////////////////////////////////////////////////////////
038    
039         public  MoveEvent (
040           ModelId  modelId,
041           PointXY  origin,
042           PointXY  destination )
043         //////////////////////////////////////////////////////////////////////
044         {
045           NullArgumentException.check ( this.modelId = modelId );
046    
047           if ( origin != null )
048           {
049             origin = new Point2DD ( origin );
050           }
051    
052           this.origin = origin;
053    
054           if ( destination != null )
055           {
056             destination = new Point2DD ( destination );
057           }
058    
059           this.destination = destination;
060         }
061    
062         //////////////////////////////////////////////////////////////////////
063         //////////////////////////////////////////////////////////////////////
064    
065         public ModelId  getModelId     ( ) { return modelId;     }
066    
067         public PointXY  getOrigin      ( ) { return origin;      }
068    
069         public PointXY  getDestination ( ) { return destination; }
070    
071         //////////////////////////////////////////////////////////////////////
072         //////////////////////////////////////////////////////////////////////
073    
074         public boolean  equals ( Object  other )
075         //////////////////////////////////////////////////////////////////////
076         {
077           if ( other == null )
078           {
079             return false;
080           }
081    
082           if ( other.getClass ( ) != MoveEvent.class )
083           {
084             return false;
085           }
086    
087           MoveEvent  that = ( MoveEvent ) other;
088    
089           return this.modelId.equals ( that.modelId );
090         }
091    
092         //////////////////////////////////////////////////////////////////////
093         //////////////////////////////////////////////////////////////////////
094         }