Skip to content
Snippets Groups Projects
Commit a9c497c4 authored by Jarik's avatar Jarik
Browse files

simple evaluation metrics

parent 3e263fa7
No related branches found
No related tags found
No related merge requests found
......@@ -2,4 +2,7 @@ package BDD;
public interface ITE {
String toString();
int size();
int paths();
String evaluation();
}
......@@ -41,5 +41,27 @@ public class Structure implements ITE {
return String.format("ITE(%s, %s, %s)", variable.toString(), left.toString(), right.toString());
}
/**
* Returns the size of the tree.
* @return size of the tree.
*/
public int size(){
return 1 + left.size() + right.size();
}
/**
* Returns the amount of paths in the tree.
* @return paths in the tree
*/
public int paths() {
return left.paths() + right.paths();
}
/**
* Tree evaluation
* @return evaluation metrics
*/
public String evaluation() {
return String.format("Summary:\nsize:%d\npaths:%d", size(), paths());
}
}
......@@ -18,4 +18,27 @@ public class Value implements ITE {
public String toString() {
return value ? "1" : "0";
}
/**
* Returns the size of the tree.
* @return size of the tree.
*/
public int size() {
return 1;
}
/**
* Returns the amount of paths in the tree.
* @return paths in the tree
*/
public int paths() {
return 1;
}
/**
* Tree evaluation
* @return evaluation metrics
*/
public String evaluation() {
return String.format("Summary:\n size:%d\npaths:%d", size(), paths());
}
}
......@@ -37,5 +37,7 @@ public class BDDTransformationTests {
ITE ite = FaultTreeToITE.createITE(ft, order);
System.out.println(ite.toString());
System.out.println(ite.evaluation());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment