001 package com.croftsoft.core.animation.model.seri; 002 003 import java.io.Serializable; 004 005 import com.croftsoft.core.animation.model.Model; 006 import com.croftsoft.core.animation.model.ModelId; 007 import com.croftsoft.core.lang.NullArgumentException; 008 009 /********************************************************************* 010 * The base abstract class for a game world object Model. 011 * 012 * @version 013 * 2003-06-07 014 * @since 015 * 2003-03-30 016 * @author 017 * <a href="https://www.croftsoft.com/">David Wallace Croft</a> 018 *********************************************************************/ 019 020 public abstract class SeriModel 021 implements Model, Serializable 022 ////////////////////////////////////////////////////////////////////// 023 ////////////////////////////////////////////////////////////////////// 024 { 025 026 private static final long serialVersionUID = 0L; 027 028 // 029 030 protected final ModelId modelId; 031 032 ////////////////////////////////////////////////////////////////////// 033 ////////////////////////////////////////////////////////////////////// 034 035 public SeriModel ( ModelId modelId ) 036 ////////////////////////////////////////////////////////////////////// 037 { 038 NullArgumentException.check ( this.modelId = modelId ); 039 } 040 041 ////////////////////////////////////////////////////////////////////// 042 ////////////////////////////////////////////////////////////////////// 043 044 public ModelId getModelId ( ) { return modelId; } 045 046 ////////////////////////////////////////////////////////////////////// 047 // interface Comparable method 048 ////////////////////////////////////////////////////////////////////// 049 050 public int compareTo ( Object other ) 051 ////////////////////////////////////////////////////////////////////// 052 { 053 double otherZ = ( ( Model ) other ).getZ ( ); 054 055 double z = getZ ( ); 056 057 if ( z < otherZ ) 058 { 059 return -1; 060 } 061 062 if ( z > otherZ ) 063 { 064 return 1; 065 } 066 067 return 0; 068 } 069 070 ////////////////////////////////////////////////////////////////////// 071 ////////////////////////////////////////////////////////////////////// 072 }