⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elevator.java

📁 用于串口通讯测试的工具软件。完全使用java语言编写。
💻 JAVA
字号:
/***********************************************************************
 * Module:  Elevator.java
 * Author:  jzx
 * Purpose: Defines the Class Elevator
 ***********************************************************************/

package com.zcsoft.stock;

import java.util.*;
import java.beans.*;

/** 升降台 */
public class Elevator extends Device
{
	/** use serialVersionUID from JDK 1.0.2 for interoperability */
	private static final long serialVersionUID = -8605125614052003001L;
	/** 水平运行方向:入库 */
	private boolean inward;
	/** 水平运行方向:入库 */
	private boolean outward;
	/** 垂直运行方向:上升 */
	private boolean upward;
	/** 水平运行速度:高速 */
	private boolean speedHigh;
	/** 水平运行速度:低速 */
	private boolean speedLow;
	/** 台的垂直高度位置:高位 */
	private boolean locationHigh;
	/** 台的垂直高度位置:低位 */
	private boolean locationLow;
	/** 其上是否有托盘 */
	private boolean available = false;

	/** @param ID 设备唯一标识号 */
	public Elevator(Object ID)
	{
		super(ID);
	}

	/**
	 *
	 * @return Boolean.TRUE=入库;Boolean.FALSE=出库;null=静止
	 */
	public Boolean getHorizonalDirection()
	{
		return inward?Boolean.TRUE:(outward?Boolean.FALSE:null);
	}


	/** @param an */
	public void copyFieldFrom(Device an)
	{
		super.copyFieldFrom(an);
		Elevator e = (Elevator)an;
		this.setSpeedHigh(e.speedHigh);
		this.setSpeedLow(e.speedLow);
		this.setInward(e.inward);
		this.setOutward(e.outward);
		this.setUpward(e.upward);
//		this.setDownward(e.downward);
		this.setLocationHigh(e.locationHigh);
		this.setLocationLow(e.locationLow);
		this.setAvailable(e.available);
	}


	/**
	 *
	 * @return Boolean.TRUE=高位;Boolean.FALSE=低位;null=中间状态
	 */
	public Boolean getVerticalLocation()
	{
		return locationHigh?Boolean.TRUE:(locationLow?Boolean.FALSE:null);
	}

	/**
	 *
	 * @return Boolean.TRUE=上升;Boolean.FALSE=下降;null=静止
	 */
	public Boolean getVerticalDirection()
	{
		return this.getVerticalLocation() != null?null:(upward?Boolean.TRUE:Boolean.FALSE);
	}

	/**
	 * 获取水平方向的运行速度
	 * @return  Boolean.TRUE=高速;Boolean.FALSE=低速;null=静止
	 */
	public Boolean getSpeed()
	{
		return speedHigh?Boolean.TRUE:(speedLow?Boolean.FALSE:null);
	}


	public void setInward(boolean inward)
	{
		boolean old = this.inward;
		this.inward = inward;
		if (inward)
		{
			outward = false;
		}
		this.firePropertyChange("inward", old, inward);
	}


	public void setOutward(boolean outward)
	{
		boolean old = this.outward;
		this.outward = outward;
		if (outward)
		{
			inward = false;
		}

		this.firePropertyChange("outward", old, outward);
	}


	public void setUpward(boolean upward)
	{
		boolean old = this.upward;
		this.upward = upward;
		this.firePropertyChange("upward", old, upward);
	}



	public void setSpeedHigh(boolean high)
	{
		boolean old = this.speedHigh;
		this.speedHigh = high;
		if (high)
		{
			this.speedLow = false;
		}
		this.firePropertyChange("speedHigh", old, high);
	}


	public void setSpeedLow(boolean low)
	{
		boolean old = speedLow;
		this.speedLow = low;
		if (low)
		{
			this.speedHigh = false;
		}
		this.firePropertyChange("speedLow", old, low);
	}


	public void setLocationHigh(boolean high)
	{
		boolean old = this.locationHigh;
		this.locationHigh = high;
		this.firePropertyChange("locationHigh", old, high);
	}


	public void setLocationLow(boolean low)
	{
		boolean old = this.locationLow;
		this.locationLow = low;
		this.firePropertyChange("locationLow", old, low);
	}


	public void setAvailable(boolean b)
	{
		boolean old = this.available;
		this.available = b;
		this.firePropertyChange("available", old, b);
	}


	public boolean isAvailable()
	{
		return available;
	}


}

⌨️ 快捷键说明

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