📄 testdatatype.java
字号:
cv = new CIMValue (new UnsignedInt8 ((byte)16), new CIMDataType (CIMDataType.UINT8)); if (DEBUG) { System.err.println ("cv = " + cv); System.err.println ("Setting a uint8"); } cimInstance.setProperty ("PropertyUint8", cv); if (DEBUG) System.err.println ("cimInstance = " + cimInstance); // get UINT8 CIMProperty cp = null; cp = cimInstance.getProperty ("PropertyUint8"); if (DEBUG) System.err.println ("cp = " + cp); cv = cp.getValue (); if (DEBUG) System.err.println ("cv = " + cv); Object o = cv.getValue (false); if (DEBUG) System.err.println ("o = " + o); UnsignedInt8 ui8 = (UnsignedInt8)o; if (DEBUG) System.err.println ("ui8 = " + ui8); return true; } catch (Exception e) { System.out.println ("Caught " + e); e.printStackTrace (); return false; } } private boolean runTestSINT8 (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop) { try { // set SINT8 CIMValue cv = null; cv = new CIMValue (new Byte ((byte)-42), new CIMDataType (CIMDataType.SINT8)); if (DEBUG) { System.err.println ("cv = " + cv); System.err.println ("Setting a sint8"); } cimInstance.setProperty ("PropertySint8", cv); if (DEBUG) System.err.println ("cimInstance = " + cimInstance); // get SINT8 CIMProperty cp = null; cp = cimInstance.getProperty ("PropertySint8"); if (DEBUG) System.err.println ("cp = " + cp); cv = cp.getValue (); if (DEBUG) System.err.println ("cv = " + cv); Object o = cv.getValue (false); if (DEBUG) System.err.println ("o = " + o); Byte b = (Byte)o; if (DEBUG) System.err.println ("b = " + b); return true; } catch (Exception e) { System.out.println ("Caught " + e); e.printStackTrace (); return false; } } private boolean runTestUINT16 (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop) { try { // set UINT16 CIMValue cv = null; cv = new CIMValue (new UnsignedInt16 ((int)9831), new CIMDataType (CIMDataType.UINT16)); if (DEBUG) { System.err.println ("cv = " + cv); System.err.println ("Setting a Uint16"); } cimInstance.setProperty ("PropertyUint16", cv); if (DEBUG) System.err.println ("cimInstance = " + cimInstance); // get UINT16 CIMProperty cp = null; cp = cimInstance.getProperty ("PropertyUint16"); if (DEBUG) System.err.println ("cp = " + cp); cv = cp.getValue (); if (DEBUG) System.err.println ("cv = " + cv); Object o = cv.getValue (false); if (DEBUG) System.err.println ("o = " + o); UnsignedInt16 ui16 = (UnsignedInt16)o; if (DEBUG) System.err.println ("ui16 = " + ui16); return true; } catch (Exception e) { System.out.println ("Caught " + e); e.printStackTrace (); return false; } } private boolean runTestSINT16 (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop) { try { // set SINT16 CIMValue cv = null; cv = new CIMValue (new Short ((short)-1578), new CIMDataType (CIMDataType.SINT16)); if (DEBUG) { System.err.println ("cv = " + cv); System.err.println ("Setting a sint16"); } cimInstance.setProperty ("PropertySint16", cv); if (DEBUG) System.err.println ("cimInstance = " + cimInstance); // get SINT16 CIMProperty cp = null; cp = cimInstance.getProperty ("PropertySint16"); if (DEBUG) System.err.println ("cp = " + cp); cv = cp.getValue (); if (DEBUG) System.err.println ("cv = " + cv); Object o = cv.getValue (false); if (DEBUG) System.err.println ("o = " + o); Short s = (Short)o; if (DEBUG) System.err.println ("s = " + s); return true; } catch (Exception e) { System.out.println ("Caught " + e); e.printStackTrace (); return false; } } private boolean runTestUINT32 (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop) { try { // set UINT32 CIMValue cv = null; cv = new CIMValue (new UnsignedInt32 (33000L), new CIMDataType (CIMDataType.UINT32)); if (DEBUG) { System.err.println ("cv = " + cv); System.err.println ("Setting a Uint32"); } cimInstance.setProperty ("PropertyUint32", cv); if (DEBUG) System.err.println ("cimInstance = " + cimInstance); // get UINT32 CIMProperty cp = null; cp = cimInstance.getProperty ("PropertyUint32"); if (DEBUG) System.err.println ("cp = " + cp); cv = cp.getValue (); if (DEBUG) System.err.println ("cv = " + cv); Object o = cv.getValue (false); if (DEBUG) System.err.println ("o = " + o); UnsignedInt32 ui32 = (UnsignedInt32)o; if (DEBUG) System.err.println ("ui32 = " + ui32); return true; } catch (Exception e) { System.out.println ("Caught " + e); e.printStackTrace (); return false; } } private boolean runTestSINT32 (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop) { try { // set SINT32 CIMValue cv = null; cv = new CIMValue (new Integer (-45000), new CIMDataType (CIMDataType.SINT32)); if (DEBUG) { System.err.println ("cv = " + cv); System.err.println ("Setting a Sint32"); } cimInstance.setProperty ("PropertySint32", cv); if (DEBUG) System.err.println ("cimInstance = " + cimInstance); // get SINT32 CIMProperty cp = null; cp = cimInstance.getProperty ("PropertySint32"); if (DEBUG) System.err.println ("cp = " + cp); cv = cp.getValue (); if (DEBUG) System.err.println ("cv = " + cv); Object o = cv.getValue (false); if (DEBUG) System.err.println ("o = " + o); Integer i = (Integer)o; if (DEBUG) System.err.println ("i = " + i); return true; } catch (Exception e) { System.out.println ("Caught " + e); e.printStackTrace (); return false; } } private boolean runTestUINT64 (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop) { try { // set UINT64 CIMValue cv = null; cv = new CIMValue (new UnsignedInt64 (new BigInteger ("77000000")), new CIMDataType (CIMDataType.UINT64)); if (DEBUG) { System.err.println ("cv = " + cv); System.err.println ("Setting a Uint64"); } cimInstance.setProperty ("PropertyUint64", cv); if (DEBUG) System.err.println ("cimInstance = " + cimInstance); // get UINT64 CIMProperty cp = null; cp = cimInstance.getProperty ("PropertyUint64"); if (DEBUG) System.err.println ("cp = " + cp); cv = cp.getValue (); if (DEBUG) System.err.println ("cv = " + cv); Object o = cv.getValue (false); if (DEBUG) System.err.println ("o = " + o); UnsignedInt64 ui64 = (UnsignedInt64)o; if (DEBUG) System.err.println ("ui64 = " + ui64); return true; } catch (Exception e) { System.out.println ("Caught " + e); e.printStackTrace (); return false; } } private boolean runTestSINT64 (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop) { try { // set SINT64 CIMValue cv = null; cv = new CIMValue (new Long ((long)-99000000), new CIMDataType (CIMDataType.SINT64)); if (DEBUG) { System.err.println ("cv = " + cv); System.err.println ("Setting a Sint64"); } cimInstance.setProperty ("PropertySint64", cv); if (DEBUG) System.err.println ("cimInstance = " + cimInstance); // get SINT64 CIMProperty cp = null; cp = cimInstance.getProperty ("PropertySint64"); if (DEBUG) System.err.println ("cp = " + cp); cv = cp.getValue (); if (DEBUG) System.err.println ("cv = " + cv); Object o = cv.getValue (false); if (DEBUG) System.err.println ("o = " + o); Long l = (Long)o; if (DEBUG) System.err.println ("l = " + l); return true; } catch (Exception e) { System.out.println ("Caught " + e); e.printStackTrace (); return false; } } private boolean runTestSTRING (CIMClient cimClient, CIMInstance cimInstance, CIMObjectPath cop) { try { // set STRING CIMValue cv = null; cv = new CIMValue ("Bob lives", new CIMDataType (CIMDataType.STRING)); if (DEBUG) { System.err.println ("cv = " + cv); System.err.println ("Setting a String"); } cimInstance.setProperty ("PropertyString", cv); if (DEBUG) System.err.println ("cimInstance = " + cimInstance); // get STRING CIMProperty cp = null; cp = cimInstance.getProperty ("PropertyString"); if (DEBUG) System.err.println ("cp = " + cp); cv = cp.getValue (); if (DEBUG) System.err.println ("cv = " + cv); Object o = cv.getValue (false); if (DEBUG) System.err.println ("o = " + o); String s = (String)o; if (DEBUG) System.err.println ("s = " + s); return true; } catch (Exception e) { System.out.println ("Caught " + e);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -