📄 variant.java
字号:
package com.zcsoft.opc;/** * <p>Title: 串口通信</p> * <p>Description: 串口通信实验</p> * <p>Copyright: Copyright (c) 2004-2005</p> * <p>Company: Zhicheng Software&Service Co. Ltd.</p> * @author 蒋智湘 * @version 1.0 *//** 变量值存储数据类 */public class Variant implements java.io.Serializable{ //数据类型定义 /** nothing */ //public static final short VT_VT_EMPTY = 0; /** SQL style Null */ //public static final short VT_NULL = 1; /** 2 byte signed int */ public static final short VT_I2 = 2; /** 4 byte signed int */ public static final short VT_I4 = 3;// /** 4 byte real */// public static final short VT_R4 = 4;// /** 8 byte real */// public static final short VT_R8 = 5;// /** 8 byte currency */// public static final short VT_CY = 6;// /** 8 byte date */// public static final short VT_DATE = 7;// /** OLE Automation string */// public static final short VT_BSTR = 8; //public static final short VT_DISPATCH = 9; //public static final short VT_ERROR = 10;//long// /** boolean value */// public static final short VT_BOOL = 11; //public static final short VT_VARIANT = 12; //public static final short VT_UNKNOWN = 13;// public static final short VT_DECIMAL = 14;//16 byte fixed point /** signed byte */ public static final short VT_I1 = 16; /** unsigned byte */ public static final short VT_UI1 = 17; /** unsigned char */ public static final short VT_UI2 = 18;// /** 4 byte unsigned integer */// public static final short VT_UI4 = 19;// /** 8 byte unsigned long integer */// public static final short VT_I8 = 20; //public static final short VT_UI8 = 21; //public static final short VT_INT = 22;//signed machine int //public static final short VT_UINT = 23;//unsigned machine int //public static final short VT_VOID = 24; //public static final short VT_HRESULT = 25; //public static final short VT_PTR = 26; //public static final short VT_SAFEARRAY = 27; //public static final short VT_CARRAY = 28; //public static final short VT_USERDEFINED = 29; //public static final short VT_LPSTR = 30; //public static final short VT_LPWSTR = 31; //public static final short VT_RECORD = 36; //public static final short VT_FILETIME = 64; /*public static final short VT_BLOB = 65; public static final short VT_STREAM = 66; public static final short VT_STORAGE = 67; public static final short VT_STREAMED_OBJECT = 68; public static final short VT_STORED_OBJECT = 69; public static final short VT_BLOB_OBJECT = 70; public static final short VT_CF = 71; //public static final short VT_CLSID = 72; public static final short VT_BSTR_BLOB = 0xfff; public static final short VT_VECTOR = 0x1000; public static final short VT_ARRAY = 0x2000; public static final short VT_BYREF = 0x4000;*/ //public static final short VT_RESERVED = (short)0x8000; //public static final short VT_ILLEGAL = (short)0xffff; //public static final short VT_ILLEGALMASKED = 0xfff; //public static final short VT_TYPEMASK = 0xfff; /** 实际的数据类型 */ final short vt;// public boolean zValue; public int iValue;// public long jValue;// public String lValue;// public float fValue;// public double dValue; /** * 构造一个数据类型为<code>VT_I1</code>的Variant实例 */ public Variant() { this(VT_I1); } /** * * @param vt 数据类型 * 数据类型同对应的值存储变量关系对照如下表 * <table> * <tr> * <td>VT_BOOL</td><td>zValue</td> * </tr> * <tr> * <td>VT_I1</td><td>iValue</td> * </tr> * <tr> * <td>VT_UI1, VT_I2</td><td>iValue</td> * </tr> * <tr> * <td>VT_UI2,VT_I4</td><td>iValue</td> * </tr> * <tr> * <td>VT_UI4, VT_I8</td><td>jValue</td> * </tr> * <tr> * <td>VT_CY</td><td>jValue</td> * </tr> * <tr> * <td>VT_DATE</td><td>jValue</td> * </tr> * <tr> * <td>VT_BSTR</td><td>lValue</td> * </tr> * <tr> * <td>VT_R4</td><td>fValue</td> * </tr> * <tr> * <td>VT_R8</td><td>dValue</td> * </tr> * </table> */ public Variant(short vt) { this.vt = vt; }// public Variant copy()// {// return new Variant(vt);// } public short getValueType() { return vt; }// /**// *// * @param value 新的变量值// * @return 返回修改前值// */// public int setIntValue(int value)// {// int old = this.iValue;// if(old != value)// {// this.iValue = value;// }// return old;// } public String toString() { String s; switch (vt) { case VT_I1://该类型最常用 case VT_UI2: case VT_I4://前三者常用 case VT_UI1: case VT_I2: s = String.valueOf(iValue); break;// case VT_UI4:// case VT_I8:// s = String.valueOf(jValue);// break; default: s = ""; } return s; }// public int intValue()// {// return iValue;// }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -