use of soot.tagkit.PositionTag in project soot by Sable.
the class Attribute method addTag.
public void addTag(Tag t) {
if (t instanceof LineNumberTag) {
int lnNum = (new Integer(((LineNumberTag) t).toString())).intValue();
javaStartLn(lnNum);
javaEndLn(lnNum);
} else if (t instanceof JimpleLineNumberTag) {
JimpleLineNumberTag jlnTag = (JimpleLineNumberTag) t;
jimpleStartLn(jlnTag.getStartLineNumber());
jimpleEndLn(jlnTag.getEndLineNumber());
} else if (t instanceof SourceLnPosTag) {
SourceLnPosTag jlnTag = (SourceLnPosTag) t;
javaStartLn(jlnTag.startLn());
javaEndLn(jlnTag.endLn());
javaStartPos(jlnTag.startPos());
javaEndPos(jlnTag.endPos());
} else if (t instanceof LinkTag) {
LinkTag lt = (LinkTag) t;
Host h = lt.getLink();
LinkAttribute link = new LinkAttribute(lt.getInfo(), getJimpleLnOfHost(h), getJavaLnOfHost(h), lt.getClassName(), lt.getAnalysisType());
addLink(link);
} else if (t instanceof StringTag) {
StringTag st = (StringTag) t;
StringAttribute string = new StringAttribute(formatForXML(st.getInfo()), st.getAnalysisType());
addText(string);
} else if (t instanceof PositionTag) {
PositionTag pt = (PositionTag) t;
jimpleStartPos(pt.getStartOffset());
jimpleEndPos(pt.getEndOffset());
} else if (t instanceof ColorTag) {
ColorTag ct = (ColorTag) t;
ColorAttribute ca = new ColorAttribute(ct.getRed(), ct.getGreen(), ct.getBlue(), ct.isForeground(), ct.getAnalysisType());
// color(ca);
addColor(ca);
} else /*else if (t instanceof SourcePositionTag){
}
else if (t instanceof SourceLineNumberTag){
}*/
{
// System.out.println("t is: "+t.getClass());
StringAttribute sa = new StringAttribute(t.toString(), t.getName());
addText(sa);
}
}
use of soot.tagkit.PositionTag in project soot by Sable.
the class JavaAttribute method printAttributeTag.
private void printAttributeTag(Tag t) {
if (t instanceof LineNumberTag) {
int lnNum = (new Integer(((LineNumberTag) t).toString())).intValue();
printJavaLnAttr(lnNum, lnNum);
} else if (t instanceof JimpleLineNumberTag) {
JimpleLineNumberTag jlnTag = (JimpleLineNumberTag) t;
printJimpleLnAttr(jlnTag.getStartLineNumber(), jlnTag.getEndLineNumber());
} else /*else if (t instanceof SourceLineNumberTag) {
SourceLineNumberTag jlnTag = (SourceLineNumberTag)t;
printJavaLnAttr(jlnTag.getStartLineNumber(), jlnTag.getEndLineNumber());
}*/
if (t instanceof LinkTag) {
LinkTag lt = (LinkTag) t;
Host h = lt.getLink();
printLinkAttr(formatForXML(lt.toString()), getJimpleLnOfHost(h), getJavaLnOfHost(h), lt.getClassName());
} else if (t instanceof StringTag) {
printTextAttr(formatForXML(((StringTag) t).toString()));
} else if (t instanceof SourcePositionTag) {
SourcePositionTag pt = (SourcePositionTag) t;
printSourcePositionAttr(pt.getStartOffset(), pt.getEndOffset());
} else if (t instanceof PositionTag) {
PositionTag pt = (PositionTag) t;
printJimplePositionAttr(pt.getStartOffset(), pt.getEndOffset());
} else if (t instanceof ColorTag) {
ColorTag ct = (ColorTag) t;
printColorAttr(ct.getRed(), ct.getGreen(), ct.getBlue(), ct.isForeground());
} else {
printTextAttr(t.toString());
}
}
Aggregations