@@ -16,6 +16,7 @@ public class PaperStatisticsObject extends StatisticsObject<PaperStatisticsObjec
1616 private int unreachable ;
1717 private int erroneous ;
1818 private int unknown ;
19+ private int topStackHead ;
1920
2021 /**
2122 * Creates a new {@code PaperStatisticsObject} with default values.
@@ -26,6 +27,7 @@ private PaperStatisticsObject() {
2627 this .unreachable = 0 ;
2728 this .erroneous = 0 ;
2829 this .unknown = 0 ;
30+ this .topStackHead = 0 ;
2931 }
3032
3133 /**
@@ -36,23 +38,26 @@ private PaperStatisticsObject() {
3638 * @param totalJumps the total number of jumps
3739 * @param totalEdges the total number of edges
3840 * @param resolved the number of resolved jumps
39- * @param unreachable the number of definitely unreachable jumps
40- * @param erroneous the number of maybe unreachable jumps
41- * @param unknown the number of unsound jumps
41+ * @param unreachable the number of unreachable jumps
42+ * @param erroneous the number of erroneous jumps
43+ * @param unknown the number of unknown jumps
44+ * @param topStackHead the number of unknown jumps that have a top stack head
4245 * @param json the JSON representation of the object
4346 */
4447 private PaperStatisticsObject (String address , int totalOpcodes , int totalJumps , int totalEdges ,
45- int resolved , int unreachable , int erroneous , int unknown , JSONObject json ) {
48+ int resolved , int unreachable , int erroneous , int unknown , int topStackHead , JSONObject json ) {
4649 super (address , totalOpcodes , totalJumps , totalEdges , json );
4750 this .resolved = resolved ;
4851 this .unreachable = unreachable ;
4952 this .erroneous = erroneous ;
5053 this .unknown = unknown ;
54+ this .topStackHead = topStackHead ;
5155
5256 this .json .put ("resolved_jumps" , this .resolved );
5357 this .json .put ("unreachable_jumps" , this .unreachable );
5458 this .json .put ("erroneous_jumps" , this .erroneous );
5559 this .json .put ("unknown_jumps" , this .unknown );
60+ this .json .put ("top_stack_head_jumps" , this .topStackHead );
5661 }
5762
5863 /**
@@ -91,6 +96,15 @@ public int getUnknown() {
9196 return unknown ;
9297 }
9398
99+ /**
100+ * Returns the number of unknown jumps with a top stack head.
101+ *
102+ * @return the unknown jumps with a top stack head
103+ */
104+ public int getTopStackHead () {
105+ return topStackHead ;
106+ }
107+
94108 /**
95109 * Creates a new {@code PaperStatisticsObject} with default values.
96110 *
@@ -148,6 +162,19 @@ public PaperStatisticsObject unknown(int unknown) {
148162 return this ;
149163 }
150164
165+
166+ /**
167+ * Sets the number of unknown jumps with a top stack head.
168+ *
169+ * @param topStackHead the unknown jumps with a top stack head
170+ *
171+ * @return the updated {@code PaperStatisticsObject} instance
172+ */
173+ public PaperStatisticsObject topStackHead (int topStackHead ) {
174+ this .topStackHead = topStackHead ;
175+ return this ;
176+ }
177+
151178 /**
152179 * Builds a new {@code PaperStatisticsObject} with the specified values.
153180 *
@@ -156,7 +183,7 @@ public PaperStatisticsObject unknown(int unknown) {
156183 @ Override
157184 public PaperStatisticsObject build () {
158185 return new PaperStatisticsObject (address , totalOpcodes , totalJumps , totalEdges , resolved , unreachable ,
159- erroneous , unknown , json );
186+ erroneous , unknown , topStackHead , json );
160187 }
161188
162189 @ Override
@@ -170,12 +197,13 @@ public boolean equals(Object o) {
170197 && resolved == that .resolved
171198 && unreachable == that .unreachable
172199 && erroneous == that .erroneous
173- && unknown == that .unknown ;
200+ && unknown == that .unknown
201+ && topStackHead == that .topStackHead ;
174202 }
175203
176204 @ Override
177205 public int hashCode () {
178- return super .hashCode () ^ Objects .hash (resolved , unreachable , erroneous , unknown );
206+ return super .hashCode () ^ Objects .hash (resolved , unreachable , erroneous , unknown , topStackHead );
179207 }
180208
181209 /**
@@ -192,5 +220,6 @@ public void printStatistics() {
192220 log .info ("Unreachable jumps: {}" , getUnreachable ());
193221 log .info ("Erroneous jumps: {}" , getErroneous ());
194222 log .info ("Unknown jumps: {}" , getUnknown ());
223+ log .info ("Unknown jumps with top stack head: {}" , getTopStackHead ());
195224 }
196225}
0 commit comments