?? ctarray.java
字號:
package com.corba.mnq.tool.idl.type;
import com.corba.mnq.tool.CorbaFacility;
import com.corba.mnq.ui.MNQMutableTreeNode;
import java.util.Enumeration;
import org.omg.CORBA.Any;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.OutputStream;
public class CTArray extends TypeBase {
public CTArray() {
super();
// TODO Auto-generated constructor stub
valType = "java.lang.Object[]";
}
public TypeBase t_in;
public int len;
public boolean withAliasName = true;
public TypeBase cloneType() {
CTArray t = new CTArray();
t.disName = disName;
t.dmtn = dmtn;
t.dn = dn;
t.id = id;
t.rdn = rdn;
t.val = val;
t.len = len;
t.valType = valType;
if (t_in != null)
t.t_in = t_in.cloneType();
return t;
}
public TypeCode type() {
// TODO Auto-generated method stub
TypeCode __typeCode = t_in.type();
__typeCode = orb.create_array_tc(len, __typeCode);
if (withAliasName)
__typeCode = orb.create_alias_tc(id, rdn, __typeCode);
return __typeCode;
}
/**
* Method: "read"
*
* @param istream
* @return
*/
public Object read(org.omg.CORBA.portable.InputStream istream) {
Object[] value = null;
value = new Object[len];
for (int _o0 = 0; _o0 < len; ++_o0) {
value[_o0] = t_in.read(istream);
}
return value;
}
public void write(OutputStream ostream, Object value) {
Object[] val = (Object[]) value;
if (val.length != len)
throw new org.omg.CORBA.MARSHAL(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
for (int _i0 = 0; _i0 < len; ++_i0) {
t_in.write(ostream, val[_i0]);
}
}
public boolean compare(TypeBase t) {
if (!selected)
return true;
if (!type().equal(t.type()))
return false;
return true;
}
public void getValueFromTree() {
Object[] tmp = new Object[dmtn.getChildCount()];
int i = 0;
for (Enumeration e = dmtn.children(); e.hasMoreElements();) {
TypeBase tn = (TypeBase) (((MNQMutableTreeNode) e.nextElement()).getUserObject());
tn.getValueFromTree();
tmp[i] = tn.val;
i++;
}
val = tmp;
}
/**
* @param args
*/
public static void main_(String[] args) {
try {
// TODO Auto-generated method stub
CTBasic t0 = new CTBasic();
t0.rdn = "double";
CTDeclaration t1 = new CTDeclaration();
t1.t_in = t0;
t1.id = "IDL:3gppsa5.org/AlarmIRPConstDefs/One:1.0";
t1.rdn = "One";
CTDeclaration t2 = new CTDeclaration();
t2.t_in = t1;
t2.id = "IDL:3gppsa5.org/AlarmIRPConstDefs/Two:1.0";
t2.rdn = "Two";
CTArray t3 = new CTArray();
t3.t_in = t1;
t3.len = 2;
t3.id = "IDL:3gppsa5.org/AlarmIRPConstDefs/Three:1.0";
t3.rdn = "Three";
Any a = t0.orb.create_any();
Double[] val = new Double[2];
val[0] = new Double(1.1);
val[1] = new Double(2.2);
t3.insert(a, val);
System.out.println(CorbaFacility.toString(a, true));
} catch (Exception e) {
e.printStackTrace();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -