message.java.svn-base

来自「這是一個JAVA語言寫的多代理人程式用來模擬飛機起飛或是降落的程式」· SVN-BASE 代码 · 共 94 行

SVN-BASE
94
字号
package gui;

public class Message {
	
	// Instance Variables
	private String to,       // the name of the agent receiving the message
	               from,     // the name of the agent sending the message
	               message;  // the message being sent to & from agents
	
	/** 
	 * Default constructor:
	 * sets all variables to empty strings
	*/
	public Message()
	{
		to = "";
		from = "";
		message = "";
	}
	
	/**
	 * Overloaded constructor:
	 * 
	 * @param   to  the name of the agent receiving the message
	 * @param   from  the name of the agent sending the message
	 * @param   message  the message being sent to & from agents
	 * @return  void
	 */
	public Message(String to, String from, String message)
	{
		this.to = to;
		this.from = from;
		this.message = message;
	}
		
	/**
	 * setter method for message (String)
	 * 
	 * @param   message  the message being sent to & from agents
	 * @return  void
	 */
	public void setMessage(String message) {
		this.message = message;
	}
	
	/**
	 * getter method for message (String)
	 * 
	 * @return  String  returns the stored message
	 */
	public String getMessage() {
		return message;
	}
	
	/**
	 * setter method for from (String)
	 * 
	 * @param   from  the name of the agent sending the message
	 * @return  void
	 */
	public void setFrom(String from) {
		this.from = from;
	}
	
	/**
	 * getter method for from (String)
	 * 
	 * @return  String  returns the stored agent's name who sent the message
	 */
	public String getFrom() {
		return from;
	}
	
	/**
	 * setter method for to (String)
	 * 
	 * @param   to  the name of the agent receiving the message
	 * @return  void
	 */
	public void setTo(String to) {
		this.to = to;
	}
	
	/**
	 * getter method for to (String)
	 * 
	 * @return  String  returns the stored agent's name who received the message
	 */
	public String getTo() {
		return to;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?