📄 idlbase.java
字号:
package com.corba.mnq.tool.idl;
import com.corba.mnq.ui.MNQMutableTreeNode;
import java.util.List;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public abstract class IdlBase implements Comparable {
// the complete name
public String cName;
// the short name
public String sName;
// the complete content value
public String content;
// the contained value
public String val;
// the contained sibling
public List sibling = new Vector();
// store the MNQMutableTreeNode for this node
public MNQMutableTreeNode dmtn;
// store its parent IdlFile
public IdlBase fn;
// prefix in id()
// TODO need to updated in the future, not hard coding.
public String prefix = "";
public String id() {
if (prefix.equalsIgnoreCase("")) { return "IDL:" + cName.replaceAll("::", "/").substring(1)
+ ":1.0"; }
return "IDL:" + prefix + cName.replaceAll("::", "/") + ":1.0";
}
public String getPrefix() {
String ret = "";
// Fix one prefix bug
IdlFile file;
try {
file = (IdlFile) fn;
} catch (RuntimeException e) {
// TODO Auto-generated catch block
return ret;
}
// int pos = fn.content.indexOf(content);
int pos = file.contentNoComment.indexOf(content);
if (pos < 0)
return ret;
// group 1--prefix
String prefix_dcl = "#pragma\\s+prefix\\s+\"(\\S+)\"";
Pattern pPre = Pattern.compile(prefix_dcl, Pattern.DOTALL + Pattern.MULTILINE);
// Matcher mPre = pPre.matcher(fn.content);
Matcher mPre = pPre.matcher(file.contentNoComment);
while (mPre.find()) {
if (mPre.start() > pos)
break;
String pre = mPre.group(1);
if (pre != null)
ret = pre;
}
return ret;
}
public IdlBase() {
super();
// TODO Auto-generated constructor stub
}
abstract public void recurContent();
public String getIconName() {
return "default.gif";
}
public String toString() {
return sName;
}
public int compareTo(Object o) {
int ret;
ret = sName.compareToIgnoreCase(((IdlBase) o).sName);
return ret;
}
/**
* @param args
*/
public static void main_(String[] args) {
// TODO Auto-generated method stub
}
}
/* EOF */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -