java.lang.Object
de.hsh.graja.comment.applicability.Deps

public class Deps extends Object
  • Constructor Details

    • Deps

      public Deps()
  • Method Details

    • getDefaultApplicabilitySpec

      public static ApplicabilitySpec getDefaultApplicabilitySpec()
      Returns:
      a new specification object with minimum own applicability
    • getApplicabilitySpec

      public static ApplicabilitySpec getApplicabilitySpec(Content c)
      Returns:
      the specification object of c's applicability (own and dependencies). If there is no such spec object, the getDefaultApplicabilitySpec() is returned.
    • setApplicabilitySpec

      public static void setApplicabilitySpec(Content c, ApplicabilitySpec spec)
      Parameters:
      new - applicability spec
    • setDefaultApplicabilitySpec

      public static void setDefaultApplicabilitySpec(Content c)
      set minimal own applicability. You can add dependencies to this comment by calling addDep(Content, ApplicabilityDependency).
    • addDep

      public static void addDep(Content c, ApplicabilityDependency dep) throws IllegalStateException
      Adds a dependency, if c was created with a ApplicabilityDependencyGroup as it's applicability dependency (or null, which means the default ApplicabilityDependencyUnion). Otherwise an IllegalStateException is thrown. This method will call addDep for all nested contents, e. g. in a Sequence or other container comment.
      Parameters:
      c - the content object
      dep - dependency to be added
      Throws:
      IllegalStateException - if c has an applicability dependency different from ApplicabilityDependencyGroup.
    • addDirectDep

      public static void addDirectDep(Content subject, Content dependedOn) throws IllegalStateException
      Adds a non-transitive leaf dependency to subject's applicablity spec. This only works, if this comment was created with a ApplicabilityDependencyGroup as it's applicability dependency (or null, which means the default ApplicabilityDependencyUnion). Otherwise an IllegalStateException is thrown. This method will call addDep for all nested contents, e. g. in a Sequence or other container comment.
      Parameters:
      subject - depending comment
      dependedOn - comment to be added as dependency leaf
      Throws:
      IllegalStateException - if this comment has an applicability dependency different from ApplicabilityDependencyGroup.
    • addTransitiveDep

      public static void addTransitiveDep(Content subject, Content dependedOn) throws IllegalStateException
      Adds a transitive leaf dependency to subject's applicablity spec. This only works, if this comment was created with a ApplicabilityDependencyGroup as it's applicability dependency (or null, which means the default ApplicabilityDependencyUnion). Otherwise an IllegalStateException is thrown. This method will call addDep for all nested comments, e. g. in a Sequence or other container comment.
      Parameters:
      subject - depending comment
      dependedOn - comment to be added as dependency leaf
      Throws:
      IllegalStateException - if this comment has an applicability dependency different from ApplicabilityDependencyGroup.
    • createDirectDependency

      public static ApplicabilityDependencyCommentLeaf createDirectDependency(Content dependedOn)
      Creates a ApplicabilityDependencyLeaf object that defines a non-transitive dependency on dependedOn. This can be used to create another comment whose applicability depends on dependedOn.
      Parameters:
      dependedOn - comment
      Returns:
      the new ApplicabilityDependencyLeaf object
    • createDirectDependencySpec

      public static ApplicabilitySpec createDirectDependencySpec(Content dependedOn)
      Creates a spec object that defines a non-transitive dependency on dependedOn. This can be used to create another comment whose applicability depends on this comment.
      Returns:
      the new spec object
    • createTransitiveDependency

      public static ApplicabilityDependencyCommentLeaf createTransitiveDependency(Content dependedOn)
      Creates a ApplicabilityDependencyLeaf object that defines a transitive dependency on dependedOn. This can be used to create another comment whose applicability depends on dependedOn.
      Parameters:
      dependedOn - comment
      Returns:
      the new ApplicabilityDependencyLeaf object
    • createTransitiveDependencySpec

      public static ApplicabilitySpec createTransitiveDependencySpec(Content dependedOn)
      Creates a spec object that defines a transitive dependency on dependedOn. This can be used to create another comment whose applicability depends on dependedOn.
      Returns:
      the new spec object
    • calcApplicability

      public static Applicability calcApplicability(Content c, ApplicabilityFilter filter, boolean followDependencies)

      For collections of comments this method returns the most severe level and the broadest audience of it's own applicability and of the applicabilities of all nested comments. This method also includes applicabilities of comment dependencies, if followDependencies is true.

      Returns:
      returns the applicability of the union of all comments represented by the instance of the subclass.