diff --git a/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java b/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java index c24214cce..e633ae93f 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java +++ b/li.strolch.model/src/main/java/li/strolch/model/activity/Action.java @@ -71,6 +71,16 @@ public class Action extends GroupedParameterizedElement implements IActivityElem this.changes = new ArrayList<>(); } + @Override + public boolean isAction() { + return true; + } + + @Override + public boolean isActivity() { + return false; + } + /** * @return the id of the {@link Resource} the {@link Action} acts on */ @@ -88,7 +98,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem } /** - * @return the current State of the aAction + * @return the current {@code State} of the a {@code Action} */ @Override public State getState() { @@ -97,7 +107,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem /** * @param state - * the target State of the aAction + * the target {@code State} of the a {@code Action} */ public void setState(State state) { assertNotReadonly(); @@ -105,7 +115,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem } /** - * @return the type of the Resource this Action acts on + * @return the type of the {@code Resource} this {@code Action} acts on */ public String getResourceType() { return this.resourceType; @@ -131,7 +141,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem /** * @param change - * IValueChange to be applied to the Resource + * {@code IValueChange} to be applied to the {@code Resource} * * @return true (as specified by {@link Collection#add}) */ @@ -142,7 +152,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem } /** - * @return the list of IValueChange attached to the Action start + * @return the list of {@code IValueChange} attached to the {@code Action} start */ public List>> getChanges() { if (this.changes == null) @@ -274,7 +284,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem @Override public Long getStart() { - Long start = Long.MAX_VALUE; + long start = Long.MAX_VALUE; if (this.changes == null) return start; for (IValueChange change : this.changes) { @@ -285,7 +295,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem @Override public Long getEnd() { - Long end = 0L; + long end = 0L; if (this.changes == null) return end; for (IValueChange change : this.changes) { diff --git a/li.strolch.model/src/main/java/li/strolch/model/activity/Activity.java b/li.strolch.model/src/main/java/li/strolch/model/activity/Activity.java index 185066a45..d191139c9 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/activity/Activity.java +++ b/li.strolch.model/src/main/java/li/strolch/model/activity/Activity.java @@ -115,6 +115,16 @@ public class Activity extends AbstractStrolchRootElement } } + @Override + public boolean isAction() { + return false; + } + + @Override + public boolean isActivity() { + return true; + } + /** * Returns true if this {@link Activity} contains any children i.e. any of {@link Action} or {@link Activity} * @@ -139,7 +149,7 @@ public class Activity extends AbstractStrolchRootElement } /** - * add an activity element to the LinkedHashMap of IActivityElements + * add an activity element to the {@code LinkedHashMap} of {@code IActivityElements} * * @param activityElement * the element to add @@ -185,10 +195,10 @@ public class Activity extends AbstractStrolchRootElement } /** - * get IActivityElement by id + * get {@code IActivityElement} by id * * @param id - * the id of the IActivityElement + * the id of the {@code IActivityElement} * * @return IActivityElement */ @@ -291,7 +301,7 @@ public class Activity extends AbstractStrolchRootElement } /** - * @return get the LinkedHashMap of IActivityElements + * @return get the {@code LinkedHashMap} of {@code IActivityElements} */ public Map getElements() { if (this.elements == null) @@ -385,7 +395,7 @@ public class Activity extends AbstractStrolchRootElement @Override public Long getStart() { - Long start = Long.MAX_VALUE; + long start = Long.MAX_VALUE; if (this.elements == null) return start; Iterator> elementIterator = elementIterator(); @@ -398,7 +408,7 @@ public class Activity extends AbstractStrolchRootElement @Override public Long getEnd() { - Long end = 0L; + long end = 0L; if (this.elements == null) return end; Iterator> elementIterator = elementIterator(); diff --git a/li.strolch.model/src/main/java/li/strolch/model/activity/IActivityElement.java b/li.strolch.model/src/main/java/li/strolch/model/activity/IActivityElement.java index fd4fa00aa..f9f8b50aa 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/activity/IActivityElement.java +++ b/li.strolch.model/src/main/java/li/strolch/model/activity/IActivityElement.java @@ -32,24 +32,35 @@ public interface IActivityElement extends StrolchElement { /** * @return the start time of this element */ - public Long getStart(); + Long getStart(); /** * @return the end time of this element */ - public Long getEnd(); + Long getEnd(); /** * @return the {@link State} of this element */ - public State getState(); + State getState(); + + /** + * @return true if this element is an {@link Action} + */ + boolean isAction(); + + /** + * @return true if this element is an {@link Activity} + */ + boolean isActivity(); /** * Set the parent * * @param activity + * the activity to set as parent */ - public void setParent(Activity activity); + void setParent(Activity activity); /** *

@@ -63,7 +74,7 @@ public interface IActivityElement extends StrolchElement { * * @see GroupedParameterizedElement#getParameter(String, String) */ - public > T findParameter(String bagKey, String paramKey); + > T findParameter(String bagKey, String paramKey); /** *

@@ -72,22 +83,22 @@ public interface IActivityElement extends StrolchElement { *

* *

- * If the parameter does not exist and assertExists is true, then an + * If the parameter does not exist and {@code assertExists} is true, then an *

* * @see GroupedParameterizedElement#getParameter(String, String, boolean) */ - public > T findParameter(String bagKey, String paramKey, boolean assertExists) + > T findParameter(String bagKey, String paramKey, boolean assertExists) throws StrolchModelException; @Override - public Activity getParent(); + Activity getParent(); @Override - public Activity getRootElement(); + Activity getRootElement(); @Override - public IActivityElement getClone(); + IActivityElement getClone(); /** * Implements the visitor pattern. Concrete implementation will call the proper method on the visitor @@ -97,5 +108,5 @@ public interface IActivityElement extends StrolchElement { * * @return the result of the visitor being accepted */ - public T accept(StrolchElementVisitor visitor); + T accept(StrolchElementVisitor visitor); }