001 package com.croftsoft.apps.vaft.agent; 002 003 import java.io.Serializable; 004 005 import com.croftsoft.core.role.actor.Actor; 006 007 /********************************************************************* 008 * <P> 009 * @author 010 * <A HREF="http://www.alumni.caltech.edu/~croft">David W. Croft</A> 011 * @version 012 * 1998-04-26 013 *********************************************************************/ 014 015 public class CountAgent implements Actor, Runnable, Serializable { 016 ////////////////////////////////////////////////////////////////////// 017 ////////////////////////////////////////////////////////////////////// 018 019 public int max = -1; 020 021 ////////////////////////////////////////////////////////////////////// 022 // Initializers 023 ////////////////////////////////////////////////////////////////////// 024 025 static 026 ////////////////////////////////////////////////////////////////////// 027 { 028 System.out.println ( "First time to load class CountAgent." ); 029 } 030 031 ////////////////////////////////////////////////////////////////////// 032 // Instance initializer 033 ////////////////////////////////////////////////////////////////////// 034 { 035 System.out.println ( "Creating CountAgent instance in memory." ); 036 } 037 038 ////////////////////////////////////////////////////////////////////// 039 // Constructor method 040 ////////////////////////////////////////////////////////////////////// 041 042 public CountAgent ( ) 043 ////////////////////////////////////////////////////////////////////// 044 { 045 this.max = 3; 046 } 047 048 ////////////////////////////////////////////////////////////////////// 049 // Interface methods 050 ////////////////////////////////////////////////////////////////////// 051 052 public String [ ] getRoles ( ) 053 ////////////////////////////////////////////////////////////////////// 054 { 055 return new String [ ] { "java.lang.Runnable" }; 056 } 057 058 public void run ( ) 059 ////////////////////////////////////////////////////////////////////// 060 { 061 for ( int i = 0; i < max; i++ ) System.out.println ( "" + i ); 062 } 063 064 ////////////////////////////////////////////////////////////////////// 065 // Finalize method 066 ////////////////////////////////////////////////////////////////////// 067 068 public void finalize ( ) throws Throwable 069 ////////////////////////////////////////////////////////////////////// 070 { 071 System.out.println ( "Removing CountAgent instance from memory." ); 072 super.finalize ( ); 073 } 074 075 ////////////////////////////////////////////////////////////////////// 076 ////////////////////////////////////////////////////////////////////// 077 }