@Property public <T, U> void or( BiPredicate<T, U> first, BiPredicate<? super T, ? super U> second, T firstArg, U secondArg) { boolean firstResult = first.test(firstArg, secondArg); boolean secondResult = second.test(firstArg, secondArg); assertEquals(firstResult || secondResult, first.or(second).test(firstArg, secondArg)); }
private static boolean orShortCircuit(StepCondition left, StepCondition right, DslModel model, Context context) { return left.predicate().or(right.predicate()).test(model, context); }
/** * Copies the resources from the specified module that affects itself. Resources that affect dependencies of the * specified module are not copied. */ private void copyOwnResources(List<CarnotzetModule> processedModules, CarnotzetModule module) throws IOException { Path expandedJarPath = expandedJars.resolve(module.getName()); Path resolvedModulePath = resolved.resolve(module.getServiceId()); if (!resolvedModulePath.toFile().exists() && !resolvedModulePath.toFile().mkdirs()) { throw new CarnotzetDefinitionException("Could not create directory " + resolvedModulePath); } // copy all regular files at the root of the expanded jar (such as carnotzet.properties) // copy all directories that do not reconfigure another module from the expanded jar recursively Files.find(expandedJarPath, 1, isRegularFile().or(nameMatchesModule(processedModules).negate())) .forEach(source -> { try { if (Files.isRegularFile(source)) { Files.copy(source, resolvedModulePath.resolve(source.getFileName()), StandardCopyOption.REPLACE_EXISTING); } else if (Files.isDirectory(source)) { FileUtils.copyDirectory(source.toFile(), resolvedModulePath.resolve(source.getFileName()).toFile()); } } catch (IOException e) { throw new UncheckedIOException(e); } }); }
}; predicate = predicate == null ? thisPredicate : predicate.or(thisPredicate);