auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldCreateEncounterWithGivenParameters() { Location location = new Location(); location.setName("testLocation"); Patient patient = new Patient(); patient.setUuid("10"); Provider provider = new Provider(); provider.setUuid("20"); Person person = new Person(); person.setUuid("30"); provider.setPerson(person); DateTime encounterDatetime = new DateTime("2000-08-16T07:22:05Z"); Map<String, String> observations = new HashMap(); observations.put("1","1"); List<Observation> obsList = convertObservationMapToList(observations, encounterDatetime); Encounter encounter = new Encounter(location, new EncounterType("testEncounterType"), encounterDatetime.toDate(), patient, provider.getPerson(), obsList); doReturn(Collections.singletonList(location)).when(locationService).getLocations(eq(null), eq(location.getName())); doReturn(patient).when(patientService).getPatientByUuid(eq(null), eq(patient.getUuid())); doReturn(provider).when(providerService).getProviderByUuid(eq(null), eq(provider.getUuid())); openMRSActionProxyService.createEncounter(new DateTime(encounter.getEncounterDatetime()), encounter.getEncounterType().getName(), location.getName(), patient.getUuid(), provider.getUuid(), observations); verify(encounterService).createEncounter(eq(null), encounterCaptor.capture()); assertEquals(encounter, encounterCaptor.getValue()); }

Target:
public void shouldCreateEncounterWithGivenParameters() { Location location = new Location(); location.setName("testLocation"); Patient patient = new Patient(); patient.setUuid("10"); Provider provider = new Provider(); provider.setUuid("20"); Person person = new Person(); person.setUuid("30"); provider.setPerson(person); DateTime encounterDatetime = new DateTime("2000-08-16T07:22:05Z"); Map<String, String> observations = new HashMap<>(); observations.put("testConceptName","testObservationValueName"); List<Observation> obsList = createObservationList(); Encounter encounter = new Encounter(location, new EncounterType("testEncounterType"), encounterDatetime.toDate(), patient, provider.getPerson(), obsList); doReturn(Collections.singletonList(location)).when(locationService).getLocations(eq(null), eq(location.getName())); doReturn(patient).when(patientService).getPatientByUuid(eq(null), eq(patient.getUuid())); doReturn(provider).when(providerService).getProviderByUuid(eq(null), eq(provider.getUuid())); openMRSActionProxyService.createEncounter(new DateTime(encounter.getEncounterDatetime()), encounter.getEncounterType().getName(), location.getName(), patient.getUuid(), provider.getUuid(), observations); verify(encounterService).createEncounter(eq(null), encounterCaptor.capture()); assertEquals(encounter, encounterCaptor.getValue()); }
Source:
public Boolean getUserPropertyAsBoolean(String propertyKey) { String userProperty = this.getUserProperty(propertyKey); if(userProperty != null && "1".equals(userProperty)) { return true; } else { return false; } }

Target:
public Boolean getUserPropertyAsBoolean(String propertyKey) { String userProperty = this.getUserProperty(propertyKey); return userProperty != null && "1".equals(userProperty); }
Source:
private List<Tag> configureTags(CloudSigma2TemplateOptions options) { ImmutableList.Builder<Tag> builder = ImmutableList.builder(); for (String tagName : options.getTags()) { String nameWithPrefix = groupNamingConvention.sharedNameForGroup(tagName); builder.add(new Tag.Builder().name(nameWithPrefix).build()); } List<Tag> tags = builder.build(); List<Tag> result = Lists.newArrayList(); if (!tags.isEmpty()) { logger.debug(">> creating tags..."); result.addAll(api.createTags(tags)); } return result; }

Target:
private List<Tag> configureTags(CloudSigma2TemplateOptions options) { ImmutableList.Builder<Tag> builder = ImmutableList.builder(); for (String tagName : options.getTags()) { String nameWithPrefix = groupNamingConvention.sharedNameForGroup(tagName); builder.add(new Tag.Builder().name(nameWithPrefix).build()); } List<Tag> tags = builder.build(); builder = ImmutableList.builder(); if (!tags.isEmpty()) { logger.debug(">> creating tags..."); builder.addAll(api.createTags(tags)); } return builder.build(); }
Source:
public String getDefaultEndpointURL(String hcid, String sUniformServiceName, String exchangeName) throws ExchangeManagerException { LOG.info("Picking endpoint from exchange", null == exchangeName ? getDefaultExchange() : exchangeName); OrganizationType org = this.getOrganization(exchangeName, hcid); if (null == org) { return ""; } if (org.getEndpointList() != null && CollectionUtils.isNotEmpty(org.getEndpointList().getEndpoint())) { for (EndpointType epType : org.getEndpointList().getEndpoint()) { if (ExchangeManagerHelper.hasService(epType, sUniformServiceName)) { NhincConstants.UDDI_SPEC_VERSION highestVersion = ExchangeManagerHelper.getHighestUDDISpecVersion( ExchangeManagerHelper.getSpecVersions(epType)); return StoreUtil.addGatewayAlias(ExchangeManagerHelper.getEndpointURLBySpecVersion( epType.getEndpointConfigurationList(), highestVersion), getGatewayAlias(exchangeName)); } } } return ""; }

Target:
public String getDefaultEndpointURL(String hcid, String sUniformServiceName, String exchangeName) throws ExchangeManagerException { LOG.info("Picking endpoint from exchange", null == exchangeName ? getDefaultExchange() : exchangeName); OrganizationType org = this.getOrganization(exchangeName, hcid); if (null == org) { return ""; } if (org.getEndpointList() != null && CollectionUtils.isNotEmpty(org.getEndpointList().getEndpoint())) { for (EndpointType epType : org.getEndpointList().getEndpoint()) { if (ExchangeManagerHelper.hasService(epType, sUniformServiceName)) { NhincConstants.UDDI_SPEC_VERSION highestVersion = ExchangeManagerHelper.getHighestUDDISpecVersion( ExchangeManagerHelper.getSpecVersions(epType)); String url = ExchangeManagerHelper .getEndpointURLBySpecVersion(epType.getEndpointConfigurationList(), highestVersion); return StoreUtil.addGatewayAlias(url, getGatewayAlias(exchangeName)); } } } return ""; }
Source:
public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); TiledReaderWriter tiledReadWriter = new TiledReaderWriter(args[0], args[1], tileSizeX, tileSizeY); boolean initializationSuccess = tiledReadWriter.initialize(); tiledReadWriter.readWriteTiles(); tiledReadWriter.cleanup(); }

Target:
public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); TiledReaderWriter tiledReadWriter = new TiledReaderWriter(args[0], args[1], tileSizeX, tileSizeY); tiledReadWriter.initialize(); try { tiledReadWriter.readWriteTiles(); } catch(Exception e) { System.err.println("Failed to read and write tiles."); e.printStackTrace(); throw e; } finally { tiledReadWriter.cleanup(); } }
Source:
public boolean isEvaluable(TermContext context) { if (evaluable != null) { return evaluable; } evaluable = false; if (!(kLabel instanceof KLabelConstant)) { return evaluable; } KLabelConstant kLabelConstant = (KLabelConstant) kLabel; if (!(kList instanceof KList)) { return evaluable; } if (kLabelConstant.label().startsWith("is") || !context.definition().functionRules().get(kLabelConstant).isEmpty() || BuiltinFunction.isBuiltinKLabel(kLabelConstant)) { return evaluable = true; } return evaluable; }

Target:
public boolean isEvaluable(TermContext context) { if (evaluable != null) { return evaluable; } evaluable = false; if (!(kLabel instanceof KLabelConstant)) { return false; } KLabelConstant kLabelConstant = (KLabelConstant) kLabel; if (!(kList instanceof KList)) { return false; } if (kLabelConstant.label().startsWith("is") || !context.definition().functionRules().get(kLabelConstant).isEmpty() || BuiltinFunction.isBuiltinKLabel(kLabelConstant)) { evaluable = true; } return evaluable; }
Source:
public Mono<VirtualNetworkGatewayConnection> createResourceAsync() { beforeCreating(); return myManager .serviceClient() .getVirtualNetworkGatewayConnections() .createOrUpdateAsync(this.resourceGroupName(), this.name(), this.innerModel()) .map(innerToFluentMap(this)) .flatMap(virtualNetworkGatewayConnection -> { if (updateSharedKey == null) { return Mono.just(virtualNetworkGatewayConnection); } return myManager.serviceClient().getVirtualNetworkGatewayConnections() .setSharedKeyAsync( this.resourceGroupName(), this.name(), new ConnectionSharedKeyInner().withValue(updateSharedKey)) .map(inner -> { updateSharedKey = null; return inner; }) .then(myManager.serviceClient().getVirtualNetworkGatewayConnections() .getByResourceGroupAsync(this.resourceGroupName(), this.name()) .map(innerToFluentMap(this))); }); }

Target:
public Mono<VirtualNetworkGatewayConnection> createResourceAsync() { beforeCreating(); return myManager .serviceClient() .getVirtualNetworkGatewayConnections() .createOrUpdateAsync(this.resourceGroupName(), this.name(), this.innerModel()) .map(innerToFluentMap(this)) .flatMap(virtualNetworkGatewayConnection -> { if (updateSharedKey == null) { return Mono.just(virtualNetworkGatewayConnection); } return myManager.serviceClient().getVirtualNetworkGatewayConnections() .setSharedKeyAsync( this.resourceGroupName(), this.name(), new ConnectionSharedKeyInner().withValue(updateSharedKey)) .doOnSuccess(inner -> { updateSharedKey = null; }) .then(myManager.serviceClient().getVirtualNetworkGatewayConnections() .getByResourceGroupAsync(this.resourceGroupName(), this.name()) .map(innerToFluentMap(this))); }); }
Source:
private void service() throws IOException { if (biDirectionalPipe) sendAdvertisedRefs(new PacketLineOutRefAdvertiser(pckOut)); else { refs = refFilter.filter(db.getAllRefs()); for (Ref r : refs.values()) { try { walk.parseAny(r.getObjectId()).add(ADVERTISED); } catch (IOException e) { } } } recvWants(); if (wantAll.isEmpty()) return; if (options.contains(OPTION_MULTI_ACK_DETAILED)) multiAck = MultiAck.DETAILED; else if (options.contains(OPTION_MULTI_ACK)) multiAck = MultiAck.CONTINUE; else multiAck = MultiAck.OFF; if (depth != 0) { processShallow(); } if (negotiate()) { sendPack(); } }

Target:
private void service() throws IOException { if (biDirectionalPipe) sendAdvertisedRefs(new PacketLineOutRefAdvertiser(pckOut)); else { refs = refFilter.filter(db.getAllRefs()); for (Ref r : refs.values()) { try { walk.parseAny(r.getObjectId()).add(ADVERTISED); } catch (IOException e) { } } } recvWants(); if (wantAll.isEmpty()) return; if (options.contains(OPTION_MULTI_ACK_DETAILED)) multiAck = MultiAck.DETAILED; else if (options.contains(OPTION_MULTI_ACK)) multiAck = MultiAck.CONTINUE; else multiAck = MultiAck.OFF; if (depth != 0) processShallow(); if (negotiate()) sendPack(); }
Source:
public Block appendNull() { int desiredLength = idsOffset + positionCount + 1; int[] newIds = Arrays.copyOf(ids, desiredLength); Block newDictionary = dictionary; int nullIndex = findNull(dictionary); if (nullIndex == NULL_NOT_FOUND) { newIds[idsOffset + positionCount] = dictionary.getPositionCount(); newDictionary = dictionary.appendNull(); } else { newIds[idsOffset + positionCount] = nullIndex; } return new DictionaryBlock(idsOffset, positionCount + 1, newDictionary, newIds, isCompact(), getDictionarySourceId()); }

Target:
public Block appendNull() { int desiredLength = idsOffset + positionCount + 1; int[] newIds = Arrays.copyOf(ids, desiredLength); Block newDictionary = dictionary; int nullIndex = NULL_NOT_FOUND; if (dictionary.mayHaveNull()) { int dictionaryPositionCount = dictionary.getPositionCount(); for (int i = 0; i < dictionaryPositionCount; i++) { if (dictionary.isNull(i)) { nullIndex = i; break; } } } if (nullIndex == NULL_NOT_FOUND) { newIds[idsOffset + positionCount] = dictionary.getPositionCount(); newDictionary = dictionary.appendNull(); } else { newIds[idsOffset + positionCount] = nullIndex; } return new DictionaryBlock(idsOffset, positionCount + 1, newDictionary, newIds, isCompact(), getDictionarySourceId()); }
Source:
generateExpressionsArrayOnStack(ExpressionClassBuilder acb, MethodBuilder mb, ResultColumnList resultColumns) { boolean genExpressions = resultColumns != null; int numberOfValues = genExpressions ? resultColumns.size() : 0; String expressions = new String[numberOfValues]; int i = 0; if (genExpressions) { for (ResultColumn rc : resultColumns) { expressions[i] = OperatorToString.opToSparkString(rc.getExpression()); if (expressions[i] == null) { genExpressions = false; numberOfValues = 0; break; } i++; } } String stringClassName = "java.lang.String"; LocalField arrayField = acb.newFieldDeclaration( Modifier.PRIVATE, stringClassName + "[]"); mb.pushNewArray(stringClassName, numberOfValues); mb.setField(arrayField); i = 0; if (genExpressions) { for (ResultColumn rc : resultColumns) { mb.getField(arrayField); mb.push(expressions[i]); mb.setArrayElement(i++); } } mb.getField(arrayField); }

Target:
generateExpressionsArrayOnStack(ExpressionClassBuilder acb, MethodBuilder mb, ResultColumnList resultColumns) throws StandardException { boolean genExpressions = resultColumns != null; int numberOfValues = genExpressions ? resultColumns.size() : 0; String expressions = new String[numberOfValues]; int i = 0; if (genExpressions) { for (ResultColumn rc : resultColumns) { expressions[i] = OperatorToString.opToSparkString(rc.getExpression()); if (expressions[i].isEmpty()) { genExpressions = false; numberOfValues = 0; break; } i++; } } String stringClassName = "java.lang.String"; LocalField arrayField = acb.newFieldDeclaration( Modifier.PRIVATE, stringClassName + "[]"); mb.pushNewArray(stringClassName, numberOfValues); mb.setField(arrayField); i = 0; if (genExpressions) { for (ResultColumn rc : resultColumns) { mb.getField(arrayField); mb.push(expressions[i]); mb.setArrayElement(i++); } } mb.getField(arrayField); }
Source:
public void updateSpawner() { if (isActivated()) { BlockPos blockpos = this.getSpawnerPosition(); if (!getSpawnerWorld().isRemote) { if (this.spawnDelay == -1) { this.resetTimer(); } if (this.spawnDelay > 0) { --this.spawnDelay; return; } if ((getSpawnerWorld().getWorldTime()) % 24000 < this.spawnedLast) { this.spawnedToday = 0; this.flag = true; } if (!this.flag) return; boolean flag1 = false; for (int i = 0; i < this.spawnCount; ++i) { Entity entity = EntityList.createEntityByIDFromName(this.getEntityName(), this.getSpawnerWorld()); if (entity == null) { break; } int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), getSpawningBox()).size(); if (j >= this.maxNearbyEntities) { this.resetTimer(); break; } if (limitType != null) { int total = this.getSpawnerWorld().countEntities(limitType, true); total = total * UtilLib.countPlayerLoadedChunks(this.getSpawnerWorld()) / MOB_COUNT_DIV; if (total > limitType.getMaxNumberOfCreature()) { this.resetTimer(); break; } } if (UtilLib.spawnEntityInWorld(getSpawnerWorld(), getSpawningBox(), entity, 1)) { onSpawned(entity); flag1 = true; } } if (flag1) { this.resetTimer(); this.spawnedToday++; this.spawnedLast = getSpawnerWorld().getWorldTime(); } } } }

Target:
public void updateSpawner() { if (isActivated()) { BlockPos blockpos = this.getSpawnerPosition(); if (!getSpawnerWorld().isRemote) { if (this.spawnDelay == -1) { this.resetTimer(); } if (this.spawnDelay > 0) { --this.spawnDelay; return; } if ((getSpawnerWorld().getTotalWorldTime()) % 24000 < this.spawnedLast) { this.spawnedToday = 0; this.flag = true; } if (!this.flag) return; boolean flag1 = false; for (int i = 0; i < this.spawnCount; ++i) { Entity entity = EntityList.createEntityByIDFromName(this.getEntityName(), this.getSpawnerWorld()); if (entity == null) { break; } int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), getSpawningBox()).size(); if (j >= this.maxNearbyEntities) { this.resetTimer(); break; } if (limitType != null) { int total = this.getSpawnerWorld().countEntities(limitType, true); total = total * UtilLib.countPlayerLoadedChunks(this.getSpawnerWorld()) / MOB_COUNT_DIV; if (total > limitType.getMaxNumberOfCreature()) { this.resetTimer(); break; } } if (UtilLib.spawnEntityInWorld(getSpawnerWorld(), getSpawningBox(), entity, 1)) { onSpawned(entity); flag1 = true; } } if (flag1) { this.resetTimer(); this.spawnedToday++; this.spawnedLast = getSpawnerWorld().getTotalWorldTime() % 24000; } } } }
Source:
public void visit(Consumer<? super T> consumer) { }

Target:
public void visit(Consumer<? super T> consumer) { consumer.accept(expression); }
Source:
public TaskRepository repository() { repository = new TaskRepository(getConnectorKind(), getRepositoryUrl()); return repository; }

Target:
public TaskRepository repository() { return new TaskRepository(getConnectorKind(), getRepositoryUrl()); }
Source:
public RequestProp(String name, ModelNode props, ModelNode value) { this.name = name; this.props = props; this.value = value; this.type = props.get("type").asType(); if (props.get("description").isDefined()) { this.description = props.get("description").asString(); } if (props.get("required").isDefined()) { this.isRequired = props.get("required").asBoolean(); } if (props.get("nillable").isDefined()) { this.nillable = props.get("nillable").asBoolean(); } if (props.get("expressions-allowed").isDefined()) { this.expressionsAllowed = props.get("expressions-allowed").asBoolean(); } if (props.get("default").isDefined()) { this.defaultValue = props.get("default"); } setInputComponent(); setInputComponentValue(); }

Target:
public RequestProp(String name, ModelNode props, ModelNode value) { this.name = name; this.props = props; this.value = value; this.type = props.get("type").asType(); if (props.hasDefined("description")) { this.description = props.get("description").asString(); } if (props.hasDefined("required")) { this.isRequired = props.get("required").asBoolean(); } if (props.hasDefined("nillable")) { this.nillable = props.get("nillable").asBoolean(); } if (props.hasDefined("expressions-allowed")) { this.expressionsAllowed = props.get("expressions-allowed").asBoolean(); } if (props.hasDefined("default")) { this.defaultValue = props.get("default"); } setInputComponent(); setInputComponentValue(); }
Source:
public InputStream getObject(String bucketName, String objectName, SecretKey key) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, InvalidEncryptionMetadataException { if (key == null) { throw new InvalidArgumentException("empty decryption key not allowed"); } String keyDecryptionCipherMode = "AES/ECB/PKCS5Padding"; return getObject(bucketName, objectName, key, keyDecryptionCipherMode); }

Target:
public InputStream getObject(String bucketName, String objectName, SecretKey key) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, InvalidEncryptionMetadataException { if (key == null) { throw new InvalidArgumentException("empty decryption key not allowed"); } return getObject(bucketName, objectName, key, "AES/ECB/PKCS5Padding"); }
Source:
String generateSequenceName(int groupId) { if (taskGroups.get(groupId) == null) { log.warn("taskGroups does not contain groupId %s, returning null sequenceName", groupId); return null; } return generateSequenceName( taskGroups.get(groupId).partitionOffsets, taskGroups.get(groupId).minimumMessageTime, taskGroups.get(groupId).maximumMessageTime ); }

Target:
String generateSequenceName(int groupId) { return generateSequenceName( taskGroups.get(groupId).partitionOffsets, taskGroups.get(groupId).minimumMessageTime, taskGroups.get(groupId).maximumMessageTime ); }
Source:
public void close() { cleanup(); for (OperationController oc : ocList) { try { oc.requestResponseHandlerThread.join(SHUTDOWN_WAIT_MS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }

Target:
public void close() { doClose(); waitForResponseHandlerThreadExit(); }
Source:
public Object visit(ASTOrExpression node, Object data) { Context context = (Context) data; node.childrenAccept(this, context); BinaryOperation current = null; LinkedList<ExpressionStatement> statements = new LinkedList<>(); for (int i = 0; i < node.count() + 1; i++) { statements.addFirst((ExpressionStatement) context.objectStack.pop()); } int i = 2; for (int j = 0; j < node.count(); j++) { if (current == null) { current = new BinaryOperation(OperatorType.OR, statements.get(0), statements.get(1)); } else { current = new BinaryOperation(OperatorType.OR, current, statements.get(i)); i = i + 1; } } context.objectStack.push(current); node.setIrElement(current); return data; }

Target:
public Object visit(ASTOrExpression node, Object data) { Context context = (Context) data; node.childrenAccept(this, context); List<ExpressionStatement> statements = operatorStatements(context, node.count()); BinaryOperation operation = assembleBinaryOperation(statements, nCopies(node.count(), OperatorType.OR)); context.objectStack.push(operation); node.setIrElement(operation); return data; }
Source:
public void update(Map<String, Object> properties) { logger.trace("Configuring ConfigurationManagerImpl..."); ConfigManagerConfiguration temp = ConfigManagerConfigurationBuilder.newBuilder() .properties(properties) .build(); if (!temp.equals(config)) { configure(config); config = temp; } }

Target:
public void update(Map<String, Object> properties) { logger.trace("Configuring ConfigurationManagerImpl..."); ConfigManagerConfiguration newConfig = ConfigManagerConfigurationBuilder.newBuilder() .properties(properties) .build(); if (Compare.isDifferent(config, newConfig)) { configure(newConfig); config = newConfig; } }
Source:
static Pair<ReadCountCollection, double[]> subsetReadCountsToUsableTargets(final ReadCountCollection readCounts, final double targetFactorPercentileThreshold, final Logger logger) { final double[] targetFactors = calculateTargetFactors(readCounts); final Percentile percentile = new Percentile(targetFactorPercentileThreshold); final double threshold = percentile.evaluate(targetFactors); final List<Target> targetByIndex = readCounts.targets(); final Set<Target> result = IntStream.range(0, targetFactors.length).filter(i -> targetFactors[i] >= threshold) .mapToObj(targetByIndex::get) .collect(Collectors.toCollection(LinkedHashSet::new)); if (result.size() == targetByIndex.size()) { logger.info(String.format("All %d targets are kept", targetByIndex.size())); return new ImmutablePair<>(readCounts, targetFactors); } else { final int discardedCount = targetFactors.length - result.size(); logger.info(String.format("Discarded %d target(s) out of %d with factors below %.2g (%.2f percentile)", discardedCount, targetFactors.length, threshold, targetFactorPercentileThreshold )); final double[] targetFactorSubset = DoubleStream.of(targetFactors).filter(i -> i >= threshold).toArray(); return new ImmutablePair<>(readCounts.subsetTargets(result), targetFactorSubset); } }

Target:
static Pair<ReadCountCollection, double[]> subsetReadCountsToUsableTargets(final ReadCountCollection readCounts, final double targetFactorPercentileThreshold, final Logger logger) { final double[] targetFactors = calculateTargetFactors(readCounts); final double threshold = new Percentile(targetFactorPercentileThreshold).evaluate(targetFactors); final List<Target> targetByIndex = readCounts.targets(); final Set<Target> result = IntStream.range(0, targetFactors.length).filter(i -> targetFactors[i] >= threshold) .mapToObj(targetByIndex::get) .collect(Collectors.toCollection(LinkedHashSet::new)); if (result.size() == targetByIndex.size()) { logger.info(String.format("All %d targets are kept", targetByIndex.size())); return new ImmutablePair<>(readCounts, targetFactors); } else { final int discardedCount = targetFactors.length - result.size(); logger.info(String.format("Discarded %d target(s) out of %d with factors below %.2g (%.2f percentile)", discardedCount, targetFactors.length, threshold, targetFactorPercentileThreshold )); final double[] targetFactorSubset = DoubleStream.of(targetFactors).filter(i -> i >= threshold).toArray(); return new ImmutablePair<>(readCounts.subsetTargets(result), targetFactorSubset); } }
Source:
public void testBehaviourWithZeroChecks() throws Exception { final TreeWalker treeWalker = new TreeWalker(); treeWalker.configure(new DefaultConfiguration("default config")); treeWalker.processFiltered(temporaryFolder.newFile("file.java"), new ArrayList<>()); }

Target:
public void testBehaviourWithZeroChecks() throws Exception { final String errMsg = "No checks -> No parsing"; final TreeWalker treeWalkerSpy = spy(new TreeWalker()); final Class<?> classAstState = Class.forName("com.puppycrawl.tools.checkstyle.TreeWalker$AstState"); mockStatic(TreeWalker.class); when(TreeWalker.parse(any(FileContents.class))) .thenThrow(new IllegalStateException(errMsg)); doNothing().when(treeWalkerSpy, "walk", any(DetailAST.class), any(FileContents.class), any(classAstState)); treeWalkerSpy.processFiltered(temporaryFolder.newFile("file.java"), new ArrayList<>()); verifyPrivate(treeWalkerSpy, never()).invoke("walk", any(DetailAST.class), any(FileContents.class), any(classAstState)); }
Source:
private void processLiteralThis(DetailAST ast) { final DetailAST nextSibling = ast.getNextSibling(); if (nextSibling != null && nextSibling.getType() == TokenTypes.IDENT) { final int parentType = ast.getParent().getParent().getType(); if (parentType == TokenTypes.METHOD_CALL) { if (checkMethods) { log(ast, MSG_METHOD, nextSibling.getText()); } } else { if (checkFields) { final AbstractFrame classFrame = getNearestClassFrame(); final AbstractFrame shadowingFrame = findFrame(nextSibling, false); if (classFrame.equals(shadowingFrame)) { log(ast, MSG_VARIABLE, nextSibling.getText()); } } } } }

Target:
private void processLiteralThis(DetailAST ast) { final DetailAST nextSibling = ast.getNextSibling(); if (nextSibling != null && nextSibling.getType() == TokenTypes.IDENT) { final int parentType = ast.getParent().getParent().getType(); if (parentType == TokenTypes.METHOD_CALL) { if (checkMethods) { log(ast, MSG_METHOD, nextSibling.getText()); } } else if (checkFields) { final AbstractFrame classFrame = getNearestClassFrame(); final AbstractFrame shadowingFrame = findFrame(nextSibling, false); if (classFrame.equals(shadowingFrame)) { log(ast, MSG_VARIABLE, nextSibling.getText()); } } } }
Source:
public void update(float delta) { switch (this.currentState) { case RUNNING: { frames.get(currentFrame).update(delta); if (frames.get(currentFrame).isFinished()) { currentFrame++; if (currentFrame >= frames.size()) { currentRepeatCount++; if (currentRepeatCount >= repeat || currentRepeatCount >= -(repeat + 1)) { end(); } else { currentFrame = 0; elapsedTime = 0; } } } break; } default: break; } }

Target:
public void update(float delta) { switch (this.currentState) { case RUNNING: { frames.get(currentFrame).update(delta); if (frames.get(currentFrame).isFinished()) { currentFrame++; if (currentFrame >= frames.size()) { currentRepeatCount++; switch (repeatMode) { case RUN_ONCE: end(); break; case REPEAT: case INVERSE: if (currentRepeatCount >= repeatCount) { end(); break; } if (repeatMode.equals(RepeatMode.INVERSE)) { flipFrames(); } currentFrame = 0; elapsedTime = 0; break; case REPEAT_INFINITE: case INVERSE_INFINITE: if (repeatMode.equals(RepeatMode.INVERSE) || repeatMode.equals(RepeatMode.INVERSE_INFINITE)) { flipFrames(); } currentFrame = 0; elapsedTime = 0; break; } } } break; } default: break; } }
Source:
public static void initDefaults(final IPreferenceStore preferenceStore) { DiagramsPreferencePage.initDefaults(preferenceStore); preferenceStore.setDefault(SiriusDiagramUiInternalPreferencesKeys.PREF_AUTOSIZE_ON_ARRANGE.name(), true); preferenceStore.setDefault(SiriusDiagramUiInternalPreferencesKeys.PREF_AUTO_PIN_ON_MOVE.name(), true); preferenceStore.setDefault(SiriusDiagramUiInternalPreferencesKeys.PREF_REMOVE_HIDE_NOTE_WHEN_ANNOTED_ELEMENT_HIDDEN_OR_REMOVE.name(), true); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_SHOW_SYNCHRONIZE_STATUS_DECORATOR.name(), false); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_SCALE_DIAGRAMS_ON_EXPORT.name(), true); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name(), 100); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_MAXIMUM_EXPORT_BUFFER_SIZE.name(), 4125000); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_MAXIMUM_EXPORT_BUFFER_SIZE_WINDOWS.name(), 50000000); }

Target:
public static void initDefaults(final IPreferenceStore preferenceStore) { DiagramsPreferencePage.initDefaults(preferenceStore); preferenceStore.setDefault(SiriusDiagramUiInternalPreferencesKeys.PREF_AUTOSIZE_ON_ARRANGE.name(), true); preferenceStore.setDefault(SiriusDiagramUiInternalPreferencesKeys.PREF_AUTO_PIN_ON_MOVE.name(), true); preferenceStore.setDefault(SiriusDiagramUiInternalPreferencesKeys.PREF_REMOVE_HIDE_NOTE_WHEN_ANNOTED_ELEMENT_HIDDEN_OR_REMOVE.name(), true); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_SHOW_SYNCHRONIZE_STATUS_DECORATOR.name(), false); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_SCALE_DIAGRAMS_ON_EXPORT.name(), true); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name(), 10); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_MAXIMUM_EXPORT_BUFFER_SIZE.name(), 4125000); preferenceStore.setDefault(SiriusDiagramUiPreferencesKeys.PREF_MAXIMUM_EXPORT_BUFFER_SIZE_WINDOWS.name(), 50000000); }
Source:
private void remove(ResponseTracking tracking, JsonNode id, JsonRpcResponse response) { try (LockWrapper wrapper = new LockWrapper(this.lock)) { JsonRpcCall call = this.runningCalls.remove(id); if (call != null) { call.addResponse(response); if (call.getCallback() != null && executorService != null) { executorService.schedule(() -> call.getCallback().onFailure(mapValues(response.getError())), 0, TimeUnit.SECONDS); } } removeRequestFromTracking(id); if (tracking != null && tracking.getClient() != null) { tracking.getCall().addResponse(response); if (tracking.getCall().getCallback() != null && executorService != null) { executorService.schedule(() -> tracking.getCall() .getCallback() .onFailure(mapValues(response.getError())), 0, TimeUnit.SECONDS); } } } }

Target:
private void remove(ResponseTracking tracking, JsonNode id, JsonRpcResponse response) { try (LockWrapper wrapper = new LockWrapper(this.lock)) { JsonRpcCall call = this.runningCalls.remove(id); boolean callbackNotified = false; if (call != null) { call.addResponse(response); if (call.getCallback() != null && executorService != null) { callbackNotified = true; executorService.schedule(() -> call.getCallback().onFailure(mapValues(response.getError())), 0, TimeUnit.SECONDS); } } removeRequestFromTracking(id); if (!callbackNotified && tracking != null && tracking.getClient() != null) { tracking.getCall().addResponse(response); if (tracking.getCall().getCallback() != null && executorService != null) { executorService.schedule(() -> tracking.getCall() .getCallback() .onFailure(mapValues(response.getError())), 0, TimeUnit.SECONDS); } } } }
Source:
public ImportMappingJob(File mappingFile) { super("CallStackView function name mapping"); fMappingFile = mappingFile; }

Target:
public ImportMappingJob(File mappingFile) { super(Messages.CallStackView_ImportMappingJobName); fMappingFile = mappingFile; }
Source:
public static Properties loadPropertyFile(Resource f) throws IOException { InputStream in = f.in(); try { return loadUniversal(in); } finally { in.close(); } }

Target:
public static Properties loadPropertyFile(Resource f) throws IOException { try (InputStream in = f.in()) { return loadUniversal(in); } }
Source:
public void testV42PedigreeParsing() { final Path vcfWithPedigreeHeaderLine = TEST_PATH.resolve("vcf42HeaderLines.vcf"); final VCFHeader headerWithPedigree = new VCFFileReader(vcfWithPedigreeHeaderLine, false).getFileHeader(); final VCFHeaderLine vcf42PedigreeLine = headerWithPedigree.getMetaDataInInputOrder() .stream().filter((l) -> l.getKey().equals("PEDIGREE")).findFirst().get(); Assert.assertEquals(vcf42PedigreeLine.getClass(), VCFHeaderLine.class); Assert.assertEquals(vcf42PedigreeLine.getValue(), "<Derived=NA12891, Original=NA12878>"); }

Target:
public void testV42PedigreeParsing() { final Path vcfWithPedigreeHeaderLine = TEST_PATH.resolve("vcf42HeaderLines.vcf"); final VCFHeader headerWithPedigree = new VCFFileReader(vcfWithPedigreeHeaderLine, false).getFileHeader(); final VCFHeaderLine vcf42PedigreeLine = headerWithPedigree.getMetaDataInInputOrder() .stream().filter((l) -> l.getKey().equals(VCFConstants.PEDIGREE_HEADER_KEY)).findFirst().get(); Assert.assertEquals(vcf42PedigreeLine.getClass(), VCFHeaderLine.class); Assert.assertEquals(vcf42PedigreeLine.getValue(), "<Derived=NA12891, Original=NA12878>"); }
Source:
public static void addAvgAndMaxToSensor(final Sensor sensor, final String group, final Map<String, String> tags, final String operation) { addAvgAndMaxToSensor( sensor, group, tags, operation, "The average value of " + operation + ".", "The maximum value of " + operation + "." ); }

Target:
public static void addAvgAndMaxToSensor(final Sensor sensor, final String group, final Map<String, String> tags, final String operation) { addAvgAndMaxToSensor( sensor, group, tags, operation, AVG_VALUE_DOC + operation + ".", MAX_VALUE_DOC + operation + "." ); }
Source:
public Material getItemMaterial() { return Utils.getMaterialByConfig("specials.Arrow-Blocker.item", Material.BARRIER); }

Target:
public Material getItemMaterial() { return Utils.getMaterialByConfig("specials.arrow-blocker.item", Material.EYE_OF_ENDER); }
Source:
private void onUnrecoverableError(EventProducer eventProducer) { List<DatastreamTask> tasks = findTasksUsingEventProducer(eventProducer); LOG.warn(String.format("Producer %s failed with unrecoverable error, shutting down the producer " + ", creating a new producer and assigning them to the tasks %s", eventProducer.getProducerid(), tasks)); boolean customCheckpointing = eventProducer.getCheckpointPolicy() == EventProducer.CheckpointPolicy.CUSTOM; _producerPool.get(customCheckpointing).remove(eventProducer); TransportProvider transport = _transportProviderFactory.createTransportProvider(_transportProviderConfig); EventProducer newEventProducer = new EventProducer(transport, _checkpointProvider, _eventProducerConfig, customCheckpointing, this::onUnrecoverableError); tasks.forEach(t -> assignEventProducerToTask(newEventProducer, t)); eventProducer.shutdown(); }

Target:
private synchronized void onUnrecoverableError(EventProducer eventProducer) { List<DatastreamTask> tasks = findTasksUsingEventProducer(eventProducer); LOG.warn(String.format("Producer %s failed with unrecoverable error, shutting down the producer " + ", creating a new producer and assigning them to the tasks %s", eventProducer.getProducerid(), tasks)); boolean customCheckpointing = eventProducer.getCheckpointPolicy() == EventProducer.CheckpointPolicy.CUSTOM; _producerPool.get(customCheckpointing).remove(eventProducer); TransportProvider transport = _transportProviderFactory.createTransportProvider(_transportProviderConfig); EventProducer newEventProducer = new EventProducer(transport, _checkpointProvider, _eventProducerConfig, customCheckpointing, this::onUnrecoverableError); tasks.forEach(t -> assignEventProducerToTask(newEventProducer, t)); eventProducer.shutdown(); }
Source:
public boolean isAuthorized(final WebContext context, final List<CommonProfile> profiles) { final boolean checkRequest = !onlyCheckPostRequest || ContextHelper.isPost(context); if (checkRequest) { final String parameterToken = context.getRequestParameter(parameterName); final String headerToken = context.getRequestHeader(headerName); final String sessionToken = (String) context.getSessionStore().get(context, Pac4jConstants.CSRF_TOKEN).get(); return sessionToken != null && (sessionToken.equals(parameterToken) || sessionToken.equals(headerToken)); } else { return true; } }

Target:
public boolean isAuthorized(final WebContext context, final List<CommonProfile> profiles) { final boolean checkRequest = !onlyCheckPostRequest || ContextHelper.isPost(context); if (checkRequest) { final String parameterToken = context.getRequestParameter(parameterName).orElse(null); final String headerToken = context.getRequestHeader(headerName).orElse(null); final Optional<String> sessionToken = context.getSessionStore().get(context, Pac4jConstants.CSRF_TOKEN); return sessionToken.isPresent() && (sessionToken.get().equals(parameterToken) || sessionToken.get().equals(headerToken)); } else { return true; } }
Source:
public void executeSuppressed() throws SystemException, InvalidTransactionException { transactionManagerReturnsTransaction(); suspendReturnsTransaction(); assertTrue(TransactionSupport.executeInScope(TransactionScopeOption.Suppress, tm)); verify(mgr).suspend(); verify(mgr).resume(transaction); }

Target:
public void executeSuppressed() throws SystemException, InvalidTransactionException { transactionManagerReturnsTransaction(); suspendReturnsTransaction(); assertTrue(TransactionSupport.executeInScope(TransactionScopeOption.Suppress, tm)); InOrder inOrder = inOrder(mgr); inOrder.verify(mgr).suspend(); inOrder.verify(mgr).resume(transaction); }
Source:
private List<Trigger> filterTriggers(List<Trigger> triggers) { Resource resource = getResource(); List<Trigger> filteredTriggers = new ArrayList<>(); for (Trigger trigger : triggers) { if ( trigger.getTags()!=null && trigger.getTags().containsKey("resourceId") && trigger.getTags().get ("resourceId").equals(resource.getId())) { filteredTriggers.add(trigger); } } return filteredTriggers; }

Target:
private List<Trigger> filterTriggers(List<Trigger> triggers) { Resource resource = getResource(); List<Trigger> filteredTriggers = new ArrayList<>(); for (Trigger trigger : triggers) { if (trigger.getTags() != null && trigger.getTags().get("resourceId").equals(resource.getId())) { filteredTriggers.add(trigger); } } return filteredTriggers; }
Source:
public void testSimpleStatedump() { Path dir = null; try { dir = checkNotNull(Files.createTempDirectory("ss-serialization-test")); String ssid = "test-ssid"; final int nbAttributes = 6; final int version = 0; List<String @NonNull []> initialAttributes = Arrays.asList( new String[] { "Threads" }, new String[] { "Threads", "1000" }, new String[] { "Threads", "1000", "Status" }, new String[] { "Threads", "2000" }, new String[] { "Threads", "2000", "Status" }, new String[] { "Threads", "2000", "PPID" }); List<@NonNull ITmfStateValue> initialValues = Arrays.asList( TmfStateValue.nullValue(), TmfStateValue.nullValue(), TmfStateValue.newValueString("Running"), TmfStateValue.nullValue(), TmfStateValue.newValueInt(1), TmfStateValue.newValueLong(1000L)); Statedump statedump = new Statedump(initialAttributes, initialValues, version); statedump.dumpState(dir, ssid); Statedump results = Statedump.loadState(dir, ssid); assertNotNull(results); assertEquals(version, results.getVersion()); List<String[]> newAttributes = results.getAttributes(); List<ITmfStateValue> newValues = results.getStates(); assertEquals(nbAttributes, newAttributes.size()); assertEquals(nbAttributes, newValues.size()); for (int i = 0; i < nbAttributes; i++) { assertArrayEquals(initialAttributes.get(i), newAttributes.get(i)); assertEquals(initialValues.get(i), newValues.get(i)); } } catch (IOException e) { fail(e.getMessage()); } finally { if (dir != null) { FileUtils.deleteQuietly(dir.toFile()); } } }

Target:
public void testSimpleStatedump() { Path dir = null; try { dir = checkNotNull(Files.createTempDirectory("ss-serialization-test")); String ssid = "test-ssid"; final int version = 0; ImmutableMap.Builder<String @NonNull [], @Nullable Object> initialStates = new Builder<>(); initialStates.put(new String[] { "Threads" },null); initialStates.put(new String[] { "Threads", "1000" }, null); initialStates.put(new String[] { "Threads", "1000", "Status" },"Running"); initialStates.put(new String[] { "Threads", "2000" },null); initialStates.put(new String[] { "Threads", "2000", "Status" },Integer.valueOf(1)); initialStates.put(new String[] { "Threads", "2000", "PPID" },Long.valueOf(1000)); ImmutableMap<String @NonNull [], @Nullable Object> expected = initialStates.build(); StateSnapshot snapshot = new StateSnapshot(expected,ssid, version); snapshot.write(dir); StateSnapshot results = StateSnapshot.read(dir, ssid); assertNotNull(results); assertEquals(version, results.getVersion()); assertEquals(ssid, results.getSsid()); assertEquals(expected, results.getStates()); } catch (IOException e) { fail(e.getMessage()); } finally { if (dir != null) { FileUtils.deleteQuietly(dir.toFile()); } } }
Source:
public CompletableFuture<Void> visitEntrySetCommand(InvocationContext ctx, EntrySetCommand command) throws Throwable { if (ctx.isOriginLocal()) { TypeConverter<Object, Object, Object, Object> converter = determineTypeConverter(command.getFlags()); CacheSet<CacheEntry<K, V>> set = (CacheSet<CacheEntry<K, V>>) ctx.forkInvocationSync(command); return ctx.shortCircuit(new AbstractDelegatingEntryCacheSet<K, V>(Caches.getCacheWithFlags(cache, command), set) { @Override public CloseableIterator<CacheEntry<K, V>> iterator() { return new TypeConverterIterator<>(super.iterator(), converter, entryFactory); } @Override public CloseableSpliterator<CacheEntry<K, V>> spliterator() { return new IteratorAsSpliterator.Builder<>(iterator()) .setEstimateRemaining(super.spliterator().estimateSize()) .setCharacteristics(Spliterator.CONCURRENT | Spliterator.DISTINCT | Spliterator.NONNULL) .get(); } protected CacheStream<CacheEntry<K, V>> getStream(boolean parallel) { DistributionManager dm = cache.getAdvancedCache().getDistributionManager(); CloseableSpliterator<CacheEntry<K, V>> closeableSpliterator = super.spliterator(); CacheStream<CacheEntry<K, V>> stream = new LocalCacheStream<>(new EntryStreamSupplier<>(cache, dm != null ? dm.getConsistentHash() : null, () -> StreamSupport.stream(closeableSpliterator, parallel)), parallel, cache.getAdvancedCache().getComponentRegistry()); stream.onClose(() -> closeableSpliterator.close()); return new TypeConverterStream(stream, converter, entryFactory); } }); } return ctx.continueInvocation(); }

Target:
public CompletableFuture<Void> visitEntrySetCommand(InvocationContext ctx, EntrySetCommand command) throws Throwable { if (ctx.isOriginLocal()) { TypeConverter<Object, Object, Object, Object> converter = determineTypeConverter(command.getFlags()); CacheSet<CacheEntry<K, V>> set = (CacheSet<CacheEntry<K, V>>) ctx.forkInvocationSync(command); return ctx.shortCircuit(new AbstractDelegatingEntryCacheSet<K, V>(Caches.getCacheWithFlags(cache, command), set) { @Override public CloseableIterator<CacheEntry<K, V>> iterator() { return new TypeConverterIterator<>(super.iterator(), converter, entryFactory); } @Override public CloseableSpliterator<CacheEntry<K, V>> spliterator() { return new IteratorAsSpliterator.Builder<>(iterator()) .setEstimateRemaining(super.spliterator().estimateSize()) .setCharacteristics(Spliterator.CONCURRENT | Spliterator.DISTINCT | Spliterator.NONNULL) .get(); } protected CacheStream<CacheEntry<K, V>> getStream(boolean parallel) { DistributionManager dm = cache.getAdvancedCache().getDistributionManager(); CloseableSpliterator<CacheEntry<K, V>> closeableSpliterator = super.spliterator(); CacheStream<CacheEntry<K, V>> stream = new LocalCacheStream<>(new EntryStreamSupplier<>(cache, dm != null ? dm.getConsistentHash() : null, () -> StreamSupport.stream(closeableSpliterator, parallel)), parallel, cache.getAdvancedCache().getComponentRegistry()); stream.onClose(closeableSpliterator::close); return new TypeConverterStream(stream, converter, entryFactory); } }); } return ctx.continueInvocation(); }
Source:
protected IndentLevel getChildrenExpectedIndent() { IndentLevel expectedIndent = new IndentLevel(getIndent(), getIndentCheck().getArrayInitIndent(), getIndentCheck().getLineWrappingIndentation()); final int firstLine = getFirstLine(Integer.MAX_VALUE, getListChild()); final int lcurlyPos = expandedTabsColumnNo(getLeftCurly()); final int firstChildPos = getNextFirstNonBlankOnLineAfter(firstLine, lcurlyPos); final int notExist = -1; if (firstChildPos != notExist) { expectedIndent = IndentLevel.addAcceptable(expectedIndent, firstChildPos, lcurlyPos + getLineWrappingIndentation()); } return expectedIndent; }

Target:
protected IndentLevel getChildrenExpectedIndent() { IndentLevel expectedIndent = new IndentLevel(getIndent(), getIndentCheck().getArrayInitIndent(), getIndentCheck().getLineWrappingIndentation()); final int firstLine = getFirstLine(Integer.MAX_VALUE, getListChild()); final int lcurlyPos = expandedTabsColumnNo(getLeftCurly()); final int firstChildPos = getNextFirstNonBlankOnLineAfter(firstLine, lcurlyPos); if (firstChildPos != NOT_EXIST) { expectedIndent = IndentLevel.addAcceptable(expectedIndent, firstChildPos, lcurlyPos + getLineWrappingIndentation()); } return expectedIndent; }
Source:
public boolean matchesPrefix(Optional<QualifiedName> prefix) { if (!prefix.isPresent() || relationAlias.isPresent() && relationAlias.get().hasSuffix(prefix.get())) { return true; } if (!originTable.isPresent()) { return false; } int idx = 0; boolean match = true; QualifiedObjectName origin = originTable.get(); List<String> prefixes = prefix.get().getParts(); switch (prefixes.size()) { case 3: match = origin.getCatalogName().equalsIgnoreCase(prefixes.get(idx++)); case 2: match = match && origin.getSchemaName().equalsIgnoreCase(prefixes.get(idx++)); case 1: match = match && origin.getObjectName().equalsIgnoreCase(prefixes.get(idx++)); } return idx > 0 && match; }

Target:
public boolean matchesPrefix(Optional<QualifiedName> prefix) { if (!prefix.isPresent() || relationAlias.isPresent() && relationAlias.get().hasSuffix(prefix.get())) { return true; } if (!originTable.isPresent()) { return false; } QualifiedObjectName origin = originTable.get(); List<String> prefixes = prefix.get().getParts(); if (prefixes.size() == 3 && (!origin.getCatalogName().equalsIgnoreCase(prefixes.get(0)) || !origin.getSchemaName().equalsIgnoreCase(prefixes.get(1)))) { return false; } else if (prefixes.size() == 2 && !origin.getSchemaName().equalsIgnoreCase(prefixes.get(0))) { return false; } return origin.getObjectName().equalsIgnoreCase(prefixes.get(prefixes.size() - 1)); }
Source:
public String getPossibleValuesDisplayName(Object possibleValue) { if (!isAPossibleValue(possibleValue)) { throw new TalendRuntimeException(CommonErrorCodes.UNEXPECTED_ARGUMENT, ExceptionContext.build().put("argument", "possibleValues").put("value", possibleValue)); } if (possibleValue != null) { String displayName = possibleValue.toString(); if (NamedThing.class.isAssignableFrom(possibleValue.getClass())) { displayName = ((NamedThing) possibleValue).getDisplayName(); } String i18nMessage = getI18nMessage( I18N_PROPERTY_POSSIBLE_VALUE_PREFIX + displayName + NamedThing.I18N_DISPLAY_NAME_SUFFIX); if (i18nMessage.endsWith(NamedThing.I18N_DISPLAY_NAME_SUFFIX)) { return displayName; } else { return i18nMessage; } } else { return "null"; } }

Target:
public String getPossibleValuesDisplayName(Object possibleValue) { if (!isAPossibleValue(possibleValue)) { throw new TalendRuntimeException(CommonErrorCodes.UNEXPECTED_ARGUMENT, ExceptionContext.build().put("argument", "possibleValues").put("value", possibleValue)); } if (possibleValue != null) { String possibleValueDisplayName = possibleValue.toString(); if (NamedThing.class.isAssignableFrom(possibleValue.getClass())) { possibleValueDisplayName = ((NamedThing) possibleValue).getDisplayName(); } String i18nMessage = getI18nMessage( I18N_PROPERTY_POSSIBLE_VALUE_PREFIX + possibleValueDisplayName + NamedThing.I18N_DISPLAY_NAME_SUFFIX); if (i18nMessage.endsWith(NamedThing.I18N_DISPLAY_NAME_SUFFIX)) { return possibleValueDisplayName; } else { return i18nMessage; } } else { return "null"; } }