001 // edu.isi.gamebots.clients.Message 002 // Copyright 2000, University of Southern California, 003 // Information Science Institute 004 // 005 // Personal and Educational use is hereby granted. 006 // Permission required for commercial use and redistribution. 007 008 009 package edu.isi.gamebots.client; 010 011 import java.lang.*; 012 import java.util.*; 013 014 import edu.isi.gamebots.client.*; 015 016 017 /** 018 * @author <a href="mailto:amarshal#gamebots@isi.edu">Andrew n marshall</a> 019 */ 020 public class Message extends EventObject { 021 protected final String type; 022 protected final Properties props; 023 protected final boolean complete; 024 025 Message( GamebotsClient client, 026 String type, 027 Properties props, 028 boolean complete ) { 029 super( client ); 030 031 this.type = type; 032 this.props = props; 033 this.complete = complete; 034 } 035 036 public String getType() { 037 return type; 038 } 039 040 public Set getKeySet() { 041 return props.keySet(); 042 } 043 044 public String getProperty( String key ) { 045 return props.getProperty( key ); 046 } 047 048 public Set getPropertySet() { 049 return props.entrySet(); 050 } 051 052 public boolean isComplete() { 053 return complete; 054 } 055 056 public String toString() { 057 return toString( new StringBuffer(), 0 ).toString(); 058 } 059 060 public StringBuffer toString( StringBuffer sb, int indent ) { 061 for( int i=0; i<indent; i++ ) 062 sb.append( ' ' ); 063 sb.append( type+": "+props ); 064 return sb; 065 } 066 }