File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/main/java/edu/kit/kastel/mcse/ardoco/naer/recognizer Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ public abstract class Prompt {
2121 private static final Logger logger = LoggerFactory .getLogger (Prompt .class );
2222 protected final SystemMessage systemMessage = new SystemMessage ("You are a software engineer and software architect." );
2323 protected String text ;
24+ private boolean modified = false ;
2425
2526 /**
2627 * Constructs a new {@link Prompt} instance.
@@ -52,8 +53,16 @@ public String getText() {
5253 * as values. Each type represents a category (e.g., COMPONENT, INTERFACE),
5354 * and each set contains the names of entities belonging to that type.
5455 * Must not be null or contain null keys/values.
56+ * @throws IllegalStateException if the prompt has already been modified (addPossibleEntities can only be called once)
5557 */
5658 public void addPossibleEntities (Map <NamedEntityType , Set <String >> possibleEntities ) {
59+ if (modified ) {
60+ // TODO we need to refactor the modification of the prompt!
61+ throw new IllegalStateException ("Cannot modify prompt after already modified." );
62+ }
63+
64+ modified = true ;
65+
5766 StringBuilder sb = new StringBuilder ();
5867
5968 for (Map .Entry <NamedEntityType , Set <String >> entry : possibleEntities .entrySet ()) {
You can’t perform that action at this time.
0 commit comments