[New] added IActivityElement.asAction and .asActivity

This commit is contained in:
Robert von Burg 2020-11-19 18:22:12 +01:00
parent 16b1b727a5
commit 4a72ed8dae
2 changed files with 23 additions and 0 deletions

View File

@ -483,6 +483,11 @@ public class Activity extends AbstractStrolchRootElement
return this.elements.entrySet().stream();
}
@Override
public Activity asActivity() {
return this;
}
@Override
public Long getStart() {
long start = Long.MAX_VALUE;

View File

@ -188,4 +188,22 @@ public interface IActivityElement extends StrolchElement {
return parent;
}
/**
* Casts this {@link IActivityElement} to {@link Activity}
*
* @return this {@link IActivityElement} as {@link Activity}
*/
default Activity asActivity() {
return (Activity) this;
}
/**
* Casts this {@link IActivityElement} to {@link Action}
*
* @return this {@link IActivityElement} as {@link Action}
*/
default Action asAction() {
return (Action) this;
}
}