planet.java

来自「Java mulitplayer strategy game. Adaptati」· Java 代码 · 共 156 行

JAVA
156
字号
package net.sf.jawp.api.domain;




import net.sf.jawp.gf.api.EntityHolder;
import net.sf.jawp.gf.api.domain.NamedEntity;


/**
 * just a planet
 * 
 * @author jarek
 * @version $Revision: 1.16 $
 *
 */
public abstract class Planet extends NamedEntity
{
	/**
	 * version 2 - production changed to float
	 * 
	 */
	private static final long serialVersionUID = 2L;
	/**
	 * coords
	 */
	private final SpaceCoords coords;
	
	private float productivity;
	
	private float produced;
	
	
	
	//private static final Log LOG = Log.getLog(Planet.class);
	
	private  EntityHolder<Realm> owner;
	
	public Planet(final long k, final String name, final Realm ownerArg,
				final int x, final int y, final int z)
	{
		
		this( k, name, new EntityHolder<Realm>(ownerArg), new SpaceCoords(x, y, z) );
		
	}

	public Planet(final long k, final String name, final EntityHolder<Realm> ownerArg,
				final SpaceCoords coords)
	{
		super(k, name);
		this.owner = ownerArg;
		this.coords = new SpaceCoords( coords);
		
	}
	
	/*public Planet(final long k, final String name, final Realm ownerArg,
			final SpaceCoords coords)
{
	this( k, name, new EntityHolder<Realm>(ownerArg), coords);
	
	
}*/
	
	/**
	 * Returns the x.
	 * @return the value of x
	 */
	public final float getX()
	{
		return this.coords.getX();
	}

	/**
	 * Returns the y.
	 * @return the value of y
	 */
	public final float getY()
	{
		return this.coords.getY();
	}

	/**
	 * Returns the z.
	 * @return the value of z
	 */
	public final float getZ()
	{
		return this.coords.getZ();
	}
	
	public final EntityHolder<Realm> getOwner()
	{
		return this.owner;
	}


	
	/**
	 * Returns the produced.
	 * @return the value of produced
	 */
	public final float getProduced()
	{
		return produced;
	}

	/**
	 * Sets the value of produced.
	 * @param produced The produced to set.
	 */
	public final void setProduced(final float produced)
	{
		this.produced = produced;
	}

	/**
	 * Returns the productivity.
	 * @return the value of productivity
	 */
	public final float getProductivity()
	{
		return productivity;
	}

	/**
	 * Sets the value of productivity.
	 * @param productivity The productivity to set.
	 */
	public final void setProductivity(final float productivity)
	{
		this.productivity = productivity;
	}
	
	public float getCurrentProductivity()
	{
		return getProductivity();
	}
	
	public abstract int getHomeFleetSize();
	
	public final SpaceCoords getCoords()
	{
		return this.coords;
	}
	
	public final void setOwner( final EntityHolder<Realm> ow)
	{
		this.owner = ow;
	}
	
	public final double calcDistance( final Planet target)
	{
		return this.getCoords().getDistance( target.getCoords());
	}
}

⌨️ 快捷键说明

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