Skip to content

Commit d7577e9

Browse files
committed
PlatformPredicate: add a combining constructor
1 parent 7a9c74c commit d7577e9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

snaploader/src/main/java/electrostatic4j/snaploader/platform/util/PlatformPredicate.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023-2024, The Electrostatic-Sandbox Distributed Simulation Framework, jSnapLoader
2+
* Copyright (c) 2023-2025, The Electrostatic-Sandbox Distributed Simulation Framework, jSnapLoader
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -134,6 +134,19 @@ public PlatformPredicate(boolean predicate) {
134134
this.predicate = predicate;
135135
}
136136

137+
/**
138+
* Instantiates a predicate object that combines a pre-existing predicate
139+
* with one or more instruction-set extensions. The result is true if and
140+
* only if the base predicate is true and all named extensions are present.
141+
*
142+
* @param base a pre-existing predicate (not null)
143+
* @param isaExtensions names of required ISA extensions
144+
*/
145+
public PlatformPredicate(PlatformPredicate base, String... isaExtensions) {
146+
this.predicate = base.evaluatePredicate()
147+
&& NativeVariant.Cpu.hasExtensions(isaExtensions);
148+
}
149+
137150
/**
138151
* Evaluate the propositions of the predefined platform-predicate.
139152
*

0 commit comments

Comments
 (0)