[New] Added IActivityElement.isAction() and .isActivity() methods
This commit is contained in:
parent
102fe87b63
commit
534b555af4
|
@ -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 <code>State</code> of the a<code>Action</code>
|
||||
* @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 <code>State</code> of the a<code>Action</code>
|
||||
* 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 <code>Resource</code> this <code>Action</code> 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
|
||||
* <code>IValueChange</code> to be applied to the <code>Resource</code>
|
||||
* {@code IValueChange} to be applied to the {@code Resource}
|
||||
*
|
||||
* @return <tt>true</tt> (as specified by {@link Collection#add})
|
||||
*/
|
||||
|
@ -142,7 +152,7 @@ public class Action extends GroupedParameterizedElement implements IActivityElem
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the list of <code>IValueChange</code> attached to the <code>Action</code> start
|
||||
* @return the list of {@code IValueChange} attached to the {@code Action} start
|
||||
*/
|
||||
public List<IValueChange<? extends IValue<?>>> 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) {
|
||||
|
|
|
@ -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 <code>LinkedHashMap</code> of <code>IActivityElements</code>
|
||||
* 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 <code>IActivityElement</code> by id
|
||||
* get {@code IActivityElement} by id
|
||||
*
|
||||
* @param id
|
||||
* the id of the <code>IActivityElement</code>
|
||||
* the id of the {@code IActivityElement}
|
||||
*
|
||||
* @return IActivityElement
|
||||
*/
|
||||
|
@ -291,7 +301,7 @@ public class Activity extends AbstractStrolchRootElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @return get the <code>LinkedHashMap</code> of <code>IActivityElements</code>
|
||||
* @return get the {@code LinkedHashMap} of {@code IActivityElements}
|
||||
*/
|
||||
public Map<String, IActivityElement> 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<Entry<String, IActivityElement>> 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<Entry<String, IActivityElement>> elementIterator = elementIterator();
|
||||
|
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -63,7 +74,7 @@ public interface IActivityElement extends StrolchElement {
|
|||
*
|
||||
* @see GroupedParameterizedElement#getParameter(String, String)
|
||||
*/
|
||||
public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey);
|
||||
<U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -72,22 +83,22 @@ public interface IActivityElement extends StrolchElement {
|
|||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If the parameter does not exist and <code>assertExists</code> is true, then an
|
||||
* If the parameter does not exist and {@code assertExists} is true, then an
|
||||
* </p>
|
||||
*
|
||||
* @see GroupedParameterizedElement#getParameter(String, String, boolean)
|
||||
*/
|
||||
public <U, T extends Parameter<U>> T findParameter(String bagKey, String paramKey, boolean assertExists)
|
||||
<U, T extends Parameter<U>> 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> T accept(StrolchElementVisitor<T> visitor);
|
||||
<T> T accept(StrolchElementVisitor<T> visitor);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue