writer.println("usage: originStats");
writer.println(" Prints origin information for the nodes in the current model.");
}
public void execute(String[] args) {
Map<Concept,OriginInfo> originInfos=new HashMap<Concept,OriginInfo>();
Node node=m_debugger.getTableau().getFirstTableauNode();
while (node!=null) {
Debugger.NodeCreationInfo nodeCreationInfo=m_debugger.getNodeCreationInfo(node);
ExistentialConcept existentialConcept=nodeCreationInfo.m_createdByExistential;
if (existentialConcept instanceof AtLeastConcept) {
Concept toConcept=((AtLeastConcept)existentialConcept).getToConcept();
OriginInfo originInfo=originInfos.get(toConcept);
if (originInfo==null) {
originInfo=new OriginInfo(toConcept);
originInfos.put(toConcept,originInfo);
}
originInfo.m_nodes.add(node);
if (!node.isActive())
originInfo.m_numberOfNonactiveOccurrences++;
}
node=node.getNextTableauNode();
}
OriginInfo[] originInfosArray=new OriginInfo[originInfos.size()];
originInfos.values().toArray(originInfosArray);
Arrays.sort(originInfosArray,OriginInfoComparator.INSTANCE);
CharArrayWriter buffer=new CharArrayWriter();
PrintWriter writer=new PrintWriter(buffer);
writer.println("Statistics of node origins");
writer.println("====================================");
writer.println(" Occurrence Nonactive Concept");
writer.println("====================================");
for (OriginInfo originInfo : originInfosArray) {
writer.print(" ");
Printing.printPadded(writer,originInfo.m_nodes.size(),8);
writer.print(" ");
Printing.printPadded(writer,originInfo.m_numberOfNonactiveOccurrences,8);
writer.print(" ");
writer.print(originInfo.m_concept.toString(m_debugger.getPrefixes()));
if (originInfo.m_nodes.size()<=5) {
writer.print(" [ ");
for (int index=0;index<originInfo.m_nodes.size();index++) {
if (index!=0)
writer.print(", ");
node=originInfo.m_nodes.get(index);
writer.print(node.getNodeID());
if (!node.isActive())
writer.print('*');
}
writer.print(" ]");
}
writer.println();