Class Deps
java.lang.Object
de.hsh.graja.comment.applicability.Deps
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addDep
(Content c, ApplicabilityDependency dep) Adds a dependency, if c was created with aApplicabilityDependencyGroup
as it's applicability dependency (or null, which means the defaultApplicabilityDependencyUnion
).static void
addDirectDep
(Content subject, Content dependedOn) Adds a non-transitive leaf dependency to subject's applicablity spec.static void
addTransitiveDep
(Content subject, Content dependedOn) Adds a transitive leaf dependency to subject's applicablity spec.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.createDirectDependency
(Content dependedOn) Creates a ApplicabilityDependencyLeaf object that defines a non-transitive dependency on dependedOn.static ApplicabilitySpec
createDirectDependencySpec
(Content dependedOn) Creates a spec object that defines a non-transitive dependency on dependedOn.createTransitiveDependency
(Content dependedOn) Creates a ApplicabilityDependencyLeaf object that defines a transitive dependency on dependedOn.static ApplicabilitySpec
createTransitiveDependencySpec
(Content dependedOn) Creates a spec object that defines a transitive dependency on dependedOn.static ApplicabilitySpec
static ApplicabilitySpec
static void
setApplicabilitySpec
(Content c, ApplicabilitySpec spec) static void
set minimal own applicability.
-
Constructor Details
-
Deps
public Deps()
-
-
Method Details
-
getDefaultApplicabilitySpec
- Returns:
- a new specification object with minimum own applicability
-
getApplicabilitySpec
- Returns:
- the specification object of c's applicability (own and dependencies).
If there is no such spec object, the
getDefaultApplicabilitySpec()
is returned.
-
setApplicabilitySpec
- Parameters:
new
- applicability spec
-
setDefaultApplicabilitySpec
set minimal own applicability. You can add dependencies to this comment by callingaddDep(Content, ApplicabilityDependency)
. -
addDep
Adds a dependency, if c was created with aApplicabilityDependencyGroup
as it's applicability dependency (or null, which means the defaultApplicabilityDependencyUnion
). Otherwise anIllegalStateException
is thrown. This method will call addDep for all nested contents, e. g. in a Sequence or other container comment.- Parameters:
c
- the content objectdep
- dependency to be added- Throws:
IllegalStateException
- if c has an applicability dependency different fromApplicabilityDependencyGroup
.
-
addDirectDep
Adds a non-transitive leaf dependency to subject's applicablity spec. This only works, if this comment was created with aApplicabilityDependencyGroup
as it's applicability dependency (or null, which means the defaultApplicabilityDependencyUnion
). Otherwise anIllegalStateException
is thrown. This method will call addDep for all nested contents, e. g. in a Sequence or other container comment.- Parameters:
subject
- depending commentdependedOn
- comment to be added as dependency leaf- Throws:
IllegalStateException
- if this comment has an applicability dependency different fromApplicabilityDependencyGroup
.
-
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 aApplicabilityDependencyGroup
as it's applicability dependency (or null, which means the defaultApplicabilityDependencyUnion
). Otherwise anIllegalStateException
is thrown. This method will call addDep for all nested comments, e. g. in a Sequence or other container comment.- Parameters:
subject
- depending commentdependedOn
- comment to be added as dependency leaf- Throws:
IllegalStateException
- if this comment has an applicability dependency different fromApplicabilityDependencyGroup
.
-
createDirectDependency
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
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
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
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.
-