Skip to content

Commit

Permalink
removed unnecessary function params
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Goina committed May 30, 2024
1 parent b808a77 commit d611ff1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class FileDataUtils {

private static final Map<Path, Map<String, List<String>>> FILE_NAMES_CACHE = new HashMap<>();

public static FileData lookupVariantFileData(List<String> variantLocations, String fastLookup, Pattern variantPattern, String sourceCDMName, String variantSuffix, Function<String, String> variantSuffixMapping) {
public static FileData lookupVariantFileData(List<String> variantLocations, String fastLookup, Pattern variantPattern) {
if (CollectionUtils.isEmpty(variantLocations)) {
return null;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,7 @@ private void createColorDepthSearchInputData(Pair<FileData.FileDataType, Map<Str
ComputeFileType.ZGapImage,
ComputeFileType.Vol3DSegmentation
),
libraryVariants,
searchableLibraryVariant.variantTypeSuffix))
libraryVariants))
.peek(cdmip -> this.updateTag(cdmip.getNeuronMetadata()))
.map(InputCDMipNeuron::getNeuronMetadata)
.collect(Collectors.toList());
Expand All @@ -385,8 +384,7 @@ private void createColorDepthSearchInputData(Pair<FileData.FileDataType, Map<Str

private <N extends AbstractNeuronEntity> void populateOtherComputeFilesFromInput(N neuronEntity,
Set<ComputeFileType> computeFileTypes,
List<LibraryVariantArg> libraryVariants,
String computeInputVariantSuffix) {
List<LibraryVariantArg> libraryVariants) {
String searchableMIPFile = new File(neuronEntity.getComputeFileName(ComputeFileType.InputColorDepthImage)).getName();
String searchableMIPBaseName = RegExUtils.replacePattern(searchableMIPFile, "(_CDM)?\\..*$", "");
String[] searchableMIPNameComps = StringUtils.split(searchableMIPBaseName, "-_");
Expand All @@ -411,25 +409,15 @@ private <N extends AbstractNeuronEntity> void populateOtherComputeFilesFromInput
.append(")|(.*")
.append(searchableMIPBaseName)
.append(".*)");
Pattern variantPattern = Pattern.compile(patternBuilder.toString(), Pattern.CASE_INSENSITIVE);
Pattern variantPattern = Pattern.compile(patternBuilder.toString());
libraryVariants.stream()
.filter(variant -> computeFileTypes.contains(ComputeFileType.fromName(args.variantFileTypeMapping.get(variant.variantType))))
.forEach(variant -> {
ComputeFileType variantFileType = ComputeFileType.fromName(args.variantFileTypeMapping.get(variant.variantType));
FileData variantFileData = FileDataUtils.lookupVariantFileData(
Collections.singletonList(variant.variantPath),
neuronEntity.getNeuronId(),
variantPattern,
neuronEntity.getComputeFileName(ComputeFileType.SourceColorDepthImage),
variant.variantNameSuffix,
nc -> {
String suffix = StringUtils.defaultIfBlank(variant.variantTypeSuffix, "");
if (StringUtils.isNotBlank(computeInputVariantSuffix)) {
return StringUtils.replaceIgnoreCase(nc, computeInputVariantSuffix, "") + suffix;
} else {
return nc + suffix;
}
}
variantPattern
);
LOG.debug("Set variant {} file data for {} to {}", variantFileType, neuronEntity, variantFileData);
neuronEntity.setComputeFileData(variantFileType, variantFileData);
Expand Down Expand Up @@ -632,8 +620,7 @@ private void createColorDepthSearchInputDataFromLocalData(Pair<FileData.FileData
.peek(cdmip -> populateOtherComputeFilesFromInput(
cdmip.getNeuronMetadata(),
EnumSet.of(ComputeFileType.GradientImage, ComputeFileType.ZGapImage),
libraryVariants,
searchableLibraryVariant.variantTypeSuffix))
libraryVariants))
.peek(cdmip -> this.updateTag(cdmip.getNeuronMetadata()))
.map(InputCDMipNeuron::getNeuronMetadata)
.collect(Collectors.toList());
Expand Down

0 comments on commit d611ff1

Please sign in to comment.