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

📄 typebase.java

📁 UCS (Ultra Corba Simulator) is one more powerful corba client/servant simulator tool than other simi
💻 JAVA
字号:
package com.corba.mnq.tool.idl.type;

import com.corba.mnq.tool.CorbaFacility;
import com.corba.mnq.tool.Warehouse;
import com.corba.mnq.ui.ArgsTable;
import com.corba.mnq.ui.MNQMutableTreeNode;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;

public abstract class TypeBase {

    public static ORB orb = CorbaFacility.orb; // org.omg.CORBA.ORB.init(new

    // String[0], null);

    // store operation mode
    public String argModes;

    // display name in the parameterTree panel
    public String disName = null;

    // store the MNQMutableTreeNode for this node
    public MNQMutableTreeNode dmtn;

    // e.g. AlarmIRPConstDefs::DN
    public String dn;

    // e.g. IDL:3gppsa5.org/AlarmIRPConstDefs/DN:1.0
    public String id;

    // e.g. DN
    public String rdn;

    // whether this type will be checked or not
    public boolean selected = true;

    // string value in the paratable
    public String strval = null;

    // e.g. "SubNetwork=1"
    public Object val;

    // indicate the java type for val
    protected String valType = "java.lang.String";

    public TypeBase() {
        super();
        // TODO Auto-generated constructor stub
    }

    public abstract TypeBase cloneType();

    public abstract boolean compare(TypeBase t);

    /**
     * Method: "extract"
     * 
     * @param a
     * @return
     */
    public Object extract(org.omg.CORBA.Any a) {
        return read(a.create_input_stream());
    }

    public String[] getMutiValue() {
        ArgsTable table = (ArgsTable) Warehouse.node2table.get(dmtn);
        return table.getMultiValue();
    }

    /**
     * getter for valType
     * 
     * @return Returns the valType.
     */
    public String getValType() {
        return valType;
    }

    public void getValueFromTree() {
        ArgsTable table = (ArgsTable) Warehouse.node2table.get(dmtn);
        val = table.getInputValue();
    }

    public void insert(org.omg.CORBA.Any a, Object that) {
        org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
        a.type(type());
        write(out, that);
        a.read_value(out.create_input_stream(), type());
    }

    protected boolean match(String pattern, String input) {
        Pattern pType = Pattern.compile(pattern, Pattern.DOTALL + Pattern.MULTILINE);
        Matcher mType = pType.matcher(input);
        if (mType.matches())
            return true;

        return false;
    }

    /**
     * Method: "read"
     * 
     * @param istream
     * @return
     */
    public abstract Object read(org.omg.CORBA.portable.InputStream istream);

    public void setStrValue(String str) {
        val = str;
    }

    public void setValueToTree(String value) {
        ArgsTable table = (ArgsTable) Warehouse.node2table.get(dmtn);
        table.setInputValue(value);
    }

    public Any toAny() {
        Any ret = orb.create_any();
        insert(ret, this.val);
        return ret;
    }

    public String toCaseLabel(Object item) {
        return rdn;
    }

    public String toString() {
        if (disName != null) { return disName; }
        return rdn;
    }

    public abstract org.omg.CORBA.TypeCode type();


    public abstract void write(org.omg.CORBA.portable.OutputStream ostream, Object value);

}
/* EOF */

⌨️ 快捷键说明

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