Package jline.lang
Class FeatureSet
java.lang.Object
jline.lang.FeatureSet
- All Implemented Interfaces:
Serializable
Class representing the features of a particular solver
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new FeatureSet with all features initialized to false. -
Method Summary
Modifier and TypeMethodDescriptionReturns the canonical registry of feature names (all features, enabled or not).static StringgeneralizationOf(String feature) The registry name a specialization falls back to when it is not declared, or null when the feature stands on its own.booleaninspectFeature(String feature) Checks whether the given feature is used or not in the current feature setvoidSets a single feature to false in the feature set.voidSets multiple features to false in the feature set.voidSets a single feature to true in the feature set.voidSets multiple features to true in the feature set.static booleansupports(FeatureSet supported, FeatureSet used) Checks if the used features are supported by the given solverstatic StringsupportsReason(FeatureSet supported, FeatureSet used) Same feature comparison assupports(jline.lang.FeatureSet, jline.lang.FeatureSet)but returns a human-readable reason instead of a boolean (empty string when every used feature is supported), and without the side-effect warning.unsupportedFeatures(FeatureSet supported, FeatureSet used) The names of the used features the given feature set does not cover, as a list rather than a message.
-
Constructor Details
-
FeatureSet
public FeatureSet()Creates a new FeatureSet with all features initialized to false. This represents the default state where no features are enabled.
-
-
Method Details
-
supports
Checks if the used features are supported by the given solver- Parameters:
supported- - the features supported by the solverused- - the used features- Returns:
- - true if the used features are supported, false otherwise
-
supportsReason
Same feature comparison assupports(jline.lang.FeatureSet, jline.lang.FeatureSet)but returns a human-readable reason instead of a boolean (empty string when every used feature is supported), and without the side-effect warning. Intended for the method-aware gate and for feature-driven method selection, which probe several candidate methods and must not warn on the non-covering ones.- Parameters:
supported- - the features supported by the (method of the) solverused- - the used features- Returns:
- - empty string if supported, else the offending feature list
-
unsupportedFeatures
The names of the used features the given feature set does not cover, as a list rather than a message. Dispatch decisions that depend on WHICH features are missing (e.g. the MAP/MMPP random-environment fallback, which fires only when the missing features are all non-renewal processes) read this instead of parsing supportsReason.- Parameters:
supported- - the features supported by the (method of the) solverused- - the used features- Returns:
- the offending feature names, empty when every used feature is supported
-
generalizationOf
The registry name a specialization falls back to when it is not declared, or null when the feature stands on its own. A few entries name a SPECIAL CASE of another entry rather than a capability of their own: "Cox2" is a Coxian restricted to two phases and "Trace" is a Replayer under another class name. Marking a model with only the general name left the specific entry unreachable, which is dead registry surface; marking it with the specific name alone would instead REJECT the model at every solver that declares only the general one, i.e. at every solver that accepts it today. So getFeatureName marks the most specific name and the gate falls back here. The fallback runs one way only: a solver supporting just the special case can still declare "Cox2" alone and keep refusing a five-phase Coxian.- Parameters:
feature- the used feature name- Returns:
- the more general feature name, or null if there is none
-
inspectFeature
Checks whether the given feature is used or not in the current feature set- Parameters:
feature- - the name of the given feature- Returns:
- - true if the given feature is used, false otherwise
-
featureNames
Returns the canonical registry of feature names (all features, enabled or not). Used by cross-codebase parity tooling to enumerate and compare per-method feature sets.- Returns:
- the set of all feature names in this FeatureSet
-
setFalse
Sets multiple features to false in the feature set.- Parameters:
features- array of feature names to disable- Throws:
RuntimeException- if any feature name is not recognized
-
setFalse
Sets a single feature to false in the feature set.- Parameters:
feature- the name of the feature to disable- Throws:
RuntimeException- if the feature name is not recognized
-
setTrue
Sets a single feature to true in the feature set.- Parameters:
feature- the name of the feature to enable- Throws:
RuntimeException- if the feature name is not recognized
-
setTrue
Sets multiple features to true in the feature set.- Parameters:
features- array of feature names to enable- Throws:
RuntimeException- if any feature name is not recognized
-