/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * JavaWorld Library, Copyright 2011 Bryan Chadwick * * * * FILE: ./universe/Package.java * * * * This file is part of JavaWorld. * * * * JavaWorld is free software: you can redistribute it and/or * * modify it under the terms of the GNU General Public License * * as published by the Free Software Foundation, either version * * 3 of the License, or (at your option) any later version. * * * * JavaWorld is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with JavaWorld. If not, see . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ package universe; import universe.world.World; import java.io.Serializable; /** Represents the results of {@link universe.world.World World} functions with * a possible message to the connected {@link universe.Universe Universe}. */ public class Package{ private World world; private Msg msg; /** Construct a Package with the given state of the World. */ public Package(World w){ this(w,null); } /** Construct a Package with the given state of the World * and a message to the Universe. */ public Package(World w, Msg m){ this.world = w; this.msg = m; } /** Access the current state of the World within this Package */ public World getWorld(){ return this.world; } /** Does this Package contain a message? */ public boolean hasMsg(){ return this.msg != null; } /** Get the message associated with this Package/World */ public Msg getMsg(){ return this.msg; } }