@@ -315,6 +315,14 @@ def has_values_for(self, entity_class: EntityClass) -> bool:
315315 """Check if the annotation has values for the given entity class."""
316316 return self .get (entity_class ) is not None
317317
318+ def add_valuations_for (self , entity_class : EntityClass ) -> EntityValuations :
319+ """Add a new EntityValuations for the given entity class."""
320+ if self .has_values_for (entity_class ):
321+ raise ValueError (f"Annotation already has values for entity class { entity_class } " )
322+ valuations = EntityValuations ()
323+ self [entity_class ] = valuations
324+ return valuations
325+
318326 def get_valuations_for (self , entity_class : EntityClass ) -> EntityValuations :
319327 """
320328 Get the values for the given entity class.
@@ -382,8 +390,20 @@ def observation_valuations(self) -> EntityValuations:
382390 def player_valuations (self ) -> EntityValuations :
383391 return self .get_valuations_for (EntityClass .PLAYERS )
384392
385- def add_state_valuation (self ):
386- return self .get_valuations_for (EntityClass .STATES )
393+ def add_state_valuations (self ) -> EntityValuations :
394+ return self .add_valuations_for (EntityClass .STATES )
395+
396+ def add_choice_valuations (self ) -> EntityValuations :
397+ return self .add_valuations_for (EntityClass .CHOICES )
398+
399+ def add_branch_valuations (self ) -> EntityValuations :
400+ return self .add_valuations_for (EntityClass .BRANCHES )
401+
402+ def add_observation_valuations (self ) -> EntityValuations :
403+ return self .add_valuations_for (EntityClass .OBSERVATIONS )
404+
405+ def add_player_valuations (self ) -> EntityValuations :
406+ return self .add_valuations_for (EntityClass .PLAYERS )
387407
388408 def set_state_valuations (self , values : EntityValuations ):
389409 self .set_valuations_for (EntityClass .STATES , values )
0 commit comments