From 2f4ebeef657bee352eef74026064fe0ee873bec7 Mon Sep 17 00:00:00 2001 From: Frank Liu Date: Sat, 14 Oct 2023 03:53:09 +0800 Subject: [PATCH] [api] Allows cancel Input (#2805) --- api/src/main/java/ai/djl/modality/Input.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/api/src/main/java/ai/djl/modality/Input.java b/api/src/main/java/ai/djl/modality/Input.java index ecd0679661b..45c6f8161f7 100644 --- a/api/src/main/java/ai/djl/modality/Input.java +++ b/api/src/main/java/ai/djl/modality/Input.java @@ -37,6 +37,7 @@ public class Input { protected Map properties; protected PairList content; + private boolean cancelled; /** Constructs a new {@code Input} instance. */ public Input() { @@ -44,6 +45,24 @@ public Input() { content = new PairList<>(); } + /** + * Returns {@code true} if the input is cancelled. + * + * @return {@code true} if the input is cancelled. + */ + public boolean isCancelled() { + return cancelled; + } + + /** + * Sets the cancelled status. + * + * @param cancelled the cancelled status + */ + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + /** * Returns the properties of the input. *