[ONOS-7732] Automating switch workflow - program counter refactoring
Change-Id: Ic5271121dad45222ded24ea41dbb2f5efba1ff2e
diff --git a/apps/workflow/api/src/main/java/org/onosproject/workflow/api/ProgramCounter.java b/apps/workflow/api/src/main/java/org/onosproject/workflow/api/ProgramCounter.java
index 6af50e0..b6db8e7 100644
--- a/apps/workflow/api/src/main/java/org/onosproject/workflow/api/ProgramCounter.java
+++ b/apps/workflow/api/src/main/java/org/onosproject/workflow/api/ProgramCounter.java
@@ -62,6 +62,30 @@
this.workletIndex = workletIndex;
}
+ /**
+ * Clones this workflow Program Counter.
+ * @return clone of this workflow Program Counter
+ */
+ public ProgramCounter clone() {
+ return ProgramCounter.valueOf(this.workletType(), this.workletIndex());
+ }
+
+ /**
+ * Returns whether this program counter is INIT worklet program counter.
+ * @return whether this program counter is INIT worklet program counter
+ */
+ public boolean isInit() {
+ return Worklet.Common.INIT.tag().equals(this.workletType);
+ }
+
+ /**
+ * Returns whether this program counter is COMPLETED worklet program counter.
+ * @return whether this program counter is COMPLETED worklet program counter
+ */
+ public boolean isCompleted() {
+ return Worklet.Common.COMPLETED.tag().equals(this.workletType);
+ }
+
@Override
public int hashCode() {
return Objects.hash(this.toString());