Class Featurizable<E extends Feature>

java.lang.Object
org.oristool.util.Featurizable<E>
Type Parameters:
E - the type of allowed features
Direct Known Subclasses:
InhibitorArc, PetriNet, Place, Postcondition, Precondition, State, Succession, Transition

public abstract class Featurizable<E extends Feature> extends Object
Base implementation of a generic featurizable element.
See Also:
  • Field Details

  • Constructor Details

    • Featurizable

      public Featurizable()
  • Method Details

    • addFeature

      public void addFeature(E feature)
      Adds a feature to this featurizable object.
      Parameters:
      feature - the feature to be added
      Throws:
      IllegalArgumentException - if another feature of the same type is already present
    • getFeatures

      public Collection<E> getFeatures()
      Returns the collection of features associated with this object.
      Returns:
      a collection of features
    • getFeature

      public <F extends E> F getFeature(Class<F> typeToken)
      Returns the feature associated with this object for a given type.
      Type Parameters:
      F - type of the feature
      Parameters:
      typeToken - type of feature to be returned
      Returns:
      instance of the associated feature, or null if not present
    • hasFeature

      public <F extends E> boolean hasFeature(Class<F> typeToken)
      Returns true if this object has a feature with the given type.
      Type Parameters:
      F - type of the feature
      Parameters:
      typeToken - type of feature to be checked
      Returns:
      true if the feature is present
    • removeFeature

      public <F extends E> void removeFeature(Class<F> typeToken)
      Removes the feature with the given type from this object.
      Type Parameters:
      F - type of the feature
      Parameters:
      typeToken - type of the feature to be removed
    • toString

      public String toString()
      Overrides:
      toString in class Object