auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void handleSetAdministrativeStatusResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleSetAdministrativeStatusResponse for MessageType: {}, with result: {}", deviceMessageMetadata.getMessageType(), deviceResult.toString()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleSetAdministrativeStatusResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleSetAdministrativeStatusResponse for MessageType: {}, with result: {}", deviceMessageMetadata.getMessageType(), deviceResult.toString()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception).withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
public GridSearch(Map<String, Object> rawParams, List<String> configFileContent) { this.rawParams = rawParams; List<Map<String, Object>> gridParams = parseParams(configFileContent); if(gridParams != null && gridParams.size() > 0) { assert this.hasHyperParam(rawParams) == false; Set<String> hyperParams = new HashSet<String>(); for(Map<String, Object> map: gridParams) { for(Map.Entry<String, Object> gridEntry: map.entrySet()) { hyperParams.add(gridEntry.getKey()); } for(Map.Entry<String, Object> kvEntry: this.rawParams.entrySet()) { map.put(kvEntry.getKey(), kvEntry.getValue()); } } this.flattenParams = gridParams; this.hyperParamCount = hyperParams.size(); this.flattenParamsCount = this.flattenParams.size(); } else { assert rawParams != null; this.hyperParamCount = 0; parseParams(this.rawParams); } }

Target:
public GridSearch(Map<String, Object> rawParams, List<String> configFileContent) { this.rawParams = rawParams; List<Map<String, Object>> gridParams = parseParams(configFileContent); if(gridParams != null && gridParams.size() > 0) { assert this.hasHyperParam(rawParams) == false; Set<String> hyperParams = new HashSet<String>(); for(Map<String, Object> map: gridParams) { for(Map.Entry<String, Object> gridEntry: map.entrySet()) { hyperParams.add(gridEntry.getKey()); } for(Map.Entry<String, Object> kvEntry: this.rawParams.entrySet()) { if(!map.containsKey(kvEntry.getKey())) { map.put(kvEntry.getKey(), kvEntry.getValue()); } } } this.flattenParams = gridParams; this.hyperParamCount = hyperParams.size(); this.flattenParamsCount = this.flattenParams.size(); } else { assert rawParams != null; this.hyperParamCount = 0; parseParams(this.rawParams); } checkParamsThreshold(); }
Source:
public Health health() { ZkClient zkClient = new ZkClient(binder.getZkAddress(), 10000, 10000, ZKStringSerializer$.MODULE$); Seq<Broker> allBrokersInCluster = ZkUtils$.MODULE$.getAllBrokersInCluster(zkClient); Collection<Broker> brokersInCluster = JavaConversions.asJavaCollection(allBrokersInCluster); Set<String> brokersInClusterSet = new HashSet<>(); for (Broker broker: brokersInCluster) { brokersInClusterSet.add(broker.connectionString()); } List<String> downMessages = new ArrayList<>(); for (Map.Entry<String, Collection<Partition>> entry : binder.getTopicsInUse().entrySet()) { for (Partition partition : entry.getValue()) { BrokerAddress address = binder.getConnectionFactory().getLeader(partition); if (!brokersInClusterSet.contains(address.toString())) { downMessages.add(address.toString()); } } } if (downMessages.isEmpty()) { return Health.up().build(); } return Health.down().withDetail("Following brokers are down: ", downMessages.toString()).build(); }

Target:
public Health health() { ZkClient zkClient = new ZkClient(binder.getZkAddress(), binder.getZkSessionTimeout(), binder.getZkConnectionTimeout(), ZKStringSerializer$.MODULE$); Set<String> brokersInClusterSet = new HashSet<>(); try { Seq<Broker> allBrokersInCluster = ZkUtils$.MODULE$.getAllBrokersInCluster(zkClient); Collection<Broker> brokersInCluster = JavaConversions.asJavaCollection(allBrokersInCluster); for (Broker broker : brokersInCluster) { brokersInClusterSet.add(broker.connectionString()); } } catch (Exception e) { return Health.down(e).build(); } finally { if (zkClient != null) { try { zkClient.close(); } catch (Exception e) { } } } Set<String> downMessages = new HashSet<>(); for (Map.Entry<String, Collection<Partition>> entry : binder.getTopicsInUse().entrySet()) { for (Partition partition : entry.getValue()) { BrokerAddress address = binder.getConnectionFactory().getLeader(partition); if (!brokersInClusterSet.contains(address.toString())) { downMessages.add(address.toString()); } } } if (downMessages.isEmpty()) { return Health.up().build(); } return Health.down().withDetail("Following brokers are down: ", downMessages.toString()).build(); }
Source:
public ViewMode getViewMode() { return viewMode.get(); }

Target:
synchronized public ViewMode getViewMode() { return viewMode.get(); }
Source:
private ServerErrorCode validateRequest(PartitionId partition, RequestOrResponseType requestType, boolean skipPartitionAndDiskAvailableCheck) { if (partition == null) { metrics.badRequestError.inc(); return ServerErrorCode.Bad_Request; } if (!skipPartitionAndDiskAvailableCheck) { ReplicaId localReplica = storageManager.getLocalReplica(partition); if (localReplica != null && localReplica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } if (storageManager.getStore(partition) == null) { if (localReplica != null) { if (storageManager.isDiskUnavailable(storageManager.getDiskManager(partition))) { metrics.diskUnavailableError.inc(); localReplica.markDiskDown(); return ServerErrorCode.Disk_Unavailable; } else { metrics.replicaUnavailableError.inc(); return ServerErrorCode.Replica_Unavailable; } } else { metrics.partitionUnknownError.inc(); return ServerErrorCode.Partition_Unknown; } } } if (requestType.equals(RequestOrResponseType.PutRequest) && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } if (!isRequestEnabled(requestType, partition)) { metrics.temporarilyDisabledError.inc(); return ServerErrorCode.Temporarily_Disabled; } return ServerErrorCode.No_Error; }

Target:
private ServerErrorCode validateRequest(PartitionId partition, RequestOrResponseType requestType, boolean skipPartitionAndDiskAvailableCheck) { if (partition == null) { metrics.badRequestError.inc(); return ServerErrorCode.Bad_Request; } if (!skipPartitionAndDiskAvailableCheck) { ReplicaId localReplica = localPartitionToReplicaMap.get(partition); if (localReplica != null && localReplica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } if (storageManager.getStore(partition) == null) { if (localReplica != null) { if (!storageManager.isDiskAvailable(localReplica.getDiskId())) { metrics.diskUnavailableError.inc(); localReplica.markDiskDown(); return ServerErrorCode.Disk_Unavailable; } else { metrics.replicaUnavailableError.inc(); return ServerErrorCode.Replica_Unavailable; } } else { metrics.partitionUnknownError.inc(); return ServerErrorCode.Partition_Unknown; } } } if (requestType.equals(RequestOrResponseType.PutRequest) && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } if (!isRequestEnabled(requestType, partition)) { metrics.temporarilyDisabledError.inc(); return ServerErrorCode.Temporarily_Disabled; } return ServerErrorCode.No_Error; }
Source:
public TreeFillingConfigurationDialog(final Shell parentShell, final TreeFillingConfiguration treefillingConfiguration, final List<ILabelProviderConfiguration> existingLabelProvidersConfiguration, final List<PasteEObjectConfiguration> existingPasteConfigurations) { super(parentShell); this.modifiedTreefillingConfiguration = EcoreUtil.copy(treefillingConfiguration); this.existingLabelProviderConfigurations = existingLabelProvidersConfiguration; this.existingPasteConfigurations = existingPasteConfigurations; setTitle(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.TreeFillingConfigurationDialog_treeFillingConfigurationDialogName); }

Target:
public TreeFillingConfigurationDialog(final Shell parentShell, final TreeFillingConfiguration treefillingConfiguration, final List<ILabelProviderConfiguration> existingLabelProvidersConfiguration, final List<PasteEObjectConfiguration> existingPasteConfigurations) { super(parentShell); this.modifiedTreefillingConfiguration = EcoreUtil.copy(treefillingConfiguration); this.existingLabelProviderConfigurations = existingLabelProvidersConfiguration; this.existingPasteConfigurations = existingPasteConfigurations; setTitle(Messages.TreeFillingConfigurationDialog_treeFillingConfigurationDialogName); }
Source:
public static void setup() throws Exception { PhysicalPlans.InstanceInfo info = PhysicalPlans.InstanceInfo.newBuilder() .setTaskId(TASK_ID) .setComponentIndex(COMPONENT_INDEX) .setComponentName(COMPONENT_NAME) .build(); instance = PhysicalPlans.Instance.newBuilder() .setInstanceId(INSTANCE_ID) .setStmgrId(STMGR_ID) .setInfo(info) .build(); instanceStateCheckpoint = CheckpointManager.InstanceStateCheckpoint.newBuilder() .setCheckpointId(CHECKPOINT_ID) .setState(ByteString.copyFrom(BYTES)) .build(); saveInstanceStateRequest = CheckpointManager.SaveInstanceStateRequest.newBuilder() .setInstance(instance) .setCheckpoint(instanceStateCheckpoint) .build(); getInstanceStateRequest = CheckpointManager.GetInstanceStateRequest.newBuilder() .setInstance(instance) .setCheckpointId(CHECKPOINT_ID) .build(); cleanStatefulCheckpointRequest = CheckpointManager.CleanStatefulCheckpointRequest.newBuilder() .setCleanAllCheckpoints(true) .setOldestCheckpointPreserved(CHECKPOINT_ID) .build(); registerStmgrRequest = CheckpointManager.RegisterStMgrRequest.newBuilder() .setTopologyId(TOPOLOGY_ID) .setStmgrId(STMGR_ID) .setTopologyName(TOPOLOGY_NAME) .build(); registerTMasterRequest = CheckpointManager.RegisterTMasterRequest.newBuilder() .setTopologyId(TOPOLOGY_ID) .setTopologyName(TOPOLOGY_NAME) .build(); }

Target:
public static void setup() throws Exception { final String INSTANCE_ID = "instance_id"; final String STMGR_ID = "stmgr_id"; final int TASK_ID = 1; final int COMPONENT_INDEX = 1; final String COMPONENT_NAME = "component_name"; final byte[] BYTES = "checkpoint manager server test bytes".getBytes(); PhysicalPlans.InstanceInfo info = PhysicalPlans.InstanceInfo.newBuilder() .setTaskId(TASK_ID) .setComponentIndex(COMPONENT_INDEX) .setComponentName(COMPONENT_NAME) .build(); instance = PhysicalPlans.Instance.newBuilder() .setInstanceId(INSTANCE_ID) .setStmgrId(STMGR_ID) .setInfo(info) .build(); instanceStateCheckpoint = CheckpointManager.InstanceStateCheckpoint.newBuilder() .setCheckpointId(CHECKPOINT_ID) .setState(ByteString.copyFrom(BYTES)) .build(); saveInstanceStateRequest = CheckpointManager.SaveInstanceStateRequest.newBuilder() .setInstance(instance) .setCheckpoint(instanceStateCheckpoint) .build(); getInstanceStateRequest = CheckpointManager.GetInstanceStateRequest.newBuilder() .setInstance(instance) .setCheckpointId(CHECKPOINT_ID) .build(); cleanStatefulCheckpointRequest = CheckpointManager.CleanStatefulCheckpointRequest.newBuilder() .setCleanAllCheckpoints(true) .setOldestCheckpointPreserved(CHECKPOINT_ID) .build(); registerStmgrRequest = CheckpointManager.RegisterStMgrRequest.newBuilder() .setTopologyId(TOPOLOGY_ID) .setStmgrId(STMGR_ID) .setTopologyName(TOPOLOGY_NAME) .build(); registerTMasterRequest = CheckpointManager.RegisterTMasterRequest.newBuilder() .setTopologyId(TOPOLOGY_ID) .setTopologyName(TOPOLOGY_NAME) .build(); }
Source:
public void patchOwnMetadataByNonAdminUser() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .withPassword(password) .build(); String newName = "JohnReplace"; context.restoreAuthSystemState(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/metadata/eperson.firstname", newName); ops.add(replaceOperation); String patchBody = getPatchContent(ops); String token = getAuthToken(ePerson.getEmail(), password); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.metadata", Matchers.allOf( MetadataMatcher.matchMetadata("eperson.firstname", newName)))); }

Target:
public void patchOwnMetadataByNonAdminUser() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@example.com") .withPassword(password) .build(); String newName = "JohnReplace"; context.restoreAuthSystemState(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/metadata/eperson.firstname", newName); ops.add(replaceOperation); String patchBody = getPatchContent(ops); String token = getAuthToken(ePerson.getEmail(), password); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.metadata", Matchers.allOf( MetadataMatcher.matchMetadata("eperson.firstname", newName)))); getClient(token).perform(get("/api/eperson/epersons/" + ePerson.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", hasJsonPath("$.metadata", allOf( matchMetadata("eperson.firstname", newName))))); }
Source:
private CardAuthorisationGatewayRequest buildTestAuthorisation3ds2RequestWithProvidedParameters(GatewayAccountEntity accountEntity) { ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId("mq4ht90j2oir6am585afk58kml") .withGatewayAccountEntity(accountEntity) .build(); AuthCardDetails authCardDetails = buildTestAuthCardDetails(); authCardDetails.setJsScreenColorDepth("15"); authCardDetails.setJsScreenHeight("1500"); authCardDetails.setJsScreenWidth("1500"); authCardDetails.setJsTimezoneOffsetMins("3"); authCardDetails.setJsNavigatorLanguage("cy"); return new CardAuthorisationGatewayRequest(chargeEntity, authCardDetails); }

Target:
private CardAuthorisationGatewayRequest buildTestAuthorisation3ds2RequestWithProvidedParameters(GatewayAccountEntity accountEntity) { ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId("mq4ht90j2oir6am585afk58kml") .withGatewayAccountEntity(accountEntity) .build(); AuthCardDetails authCardDetails = buildTestAuthCardDetails(); authCardDetails.setJsScreenColorDepth("15"); authCardDetails.setJsScreenHeight("1500"); authCardDetails.setJsScreenWidth("1000"); authCardDetails.setJsTimezoneOffsetMins("3"); authCardDetails.setJsNavigatorLanguage("cy"); return new CardAuthorisationGatewayRequest(chargeEntity, authCardDetails); }
Source:
public void testWriteDistributedMap() { Map<Integer, String> map = createMapByEntryCount(); mapChannel.send(this.messageBuilderFactory.withPayload(map).build()); verifyDistributedMap(); }

Target:
public void testWriteDistributedMap() { Map<Integer, String> map = createMapByEntryCount(); mapChannel.send(new GenericMessage<>(map)); verifyDistributedMap(); }
Source:
private Optional<ScmInfo> getScmInfoForComponent(Component component) { ScannerReport.Changesets changesets = scannerReportReader.readChangesets(component.getReportAttributes().getRef()); if (changesets != null) { if (changesets.getChangesetCount() == 0) { return generateAndMergeDb(component, changesets.getCopyFromPrevious()); } return getScmInfoFromReport(component, changesets); } LOGGER.trace("No SCM info for file '{}'", component.getKey()); return generateAndMergeDb(component, false); }

Target:
private Optional<ScmInfo> getScmInfoForComponent(Component component) { ScannerReport.Changesets changesets = scannerReportReader.readChangesets(component.getReportAttributes().getRef()); if (changesets == null) { LOGGER.trace("No SCM info for file '{}'", component.getKey()); return generateAndMergeDb(component, false); } if (changesets.getChangesetCount() == 0) { return generateAndMergeDb(component, changesets.getCopyFromPrevious()); } return getScmInfoFromReport(component, changesets); }
Source:
private void runReleaseHooks() { Set<Map.Entry<String, Runnable>> hooks = releaseHooks.entrySet(); if (!hooks.isEmpty()) { for (Map.Entry<String, Runnable> hookEntry : hooks) { try { LOG.debug("Running class loader shutdown hook: {}.", hookEntry.getKey()); hookEntry.getValue().run(); } catch (Throwable t) { LOG.debug("Failed to run release hook '{}' for user code class loader.", hookEntry.getValue(), t); } } releaseHooks.clear(); } }

Target:
private void runReleaseHooks() { Set<Map.Entry<String, Runnable>> hooks = releaseHooks.entrySet(); if (!hooks.isEmpty()) { for (Map.Entry<String, Runnable> hookEntry : hooks) { try { LOG.debug("Running class loader shutdown hook: {}.", hookEntry.getKey()); hookEntry.getValue().run(); } catch (Throwable t) { LOG.warn("Failed to run release hook '{}' for user code class loader.", hookEntry.getValue(), t); } } releaseHooks.clear(); } }
Source:
public String getDiplayableSystemPosition() { if(null == getParentSystem() || null == sysPos) { return "?"; } Integer pos = 0; for(int i = 1; i <= sysPos; i++) { if(getParentSystem().getPlanet(i).getPlanetType().equals("Asteroid Belt")) { continue; } pos++; } return pos.toString(); }

Target:
public String getDiplayableSystemPosition() { if(null == getParentSystem() || null == sysPos) { return "?"; } int pos = 0; for(int i = 1; i <= sysPos; i++) { if(getParentSystem().getPlanet(i).getPlanetType().equals("Asteroid Belt")) { continue; } pos++; } return Integer.toString(pos); }
Source:
public void execute(SensorContext context, Map<InputFile, Set<Integer>> linesOfCode) { String baseDir = context.fileSystem().baseDir().getPath(); Settings settings = context.settings(); HashSet<InputFile> filesCovered = new HashSet<>(); List<File> reports = new ArrayList<>(); reports.addAll(getReports(settings, baseDir, REPORT_PATH_KEY, DEFAULT_REPORT_PATH)); reports.addAll(getReports(settings, baseDir, IT_REPORT_PATH_KEY, DEFAULT_REPORT_PATH)); reports.addAll(getReports(settings, baseDir, OVERALL_REPORT_PATH_KEY, DEFAULT_REPORT_PATH)); if (!reports.isEmpty()) { LOG.info("Python test coverage"); for (File report : reports) { Map<InputFile, NewCoverage> coverageMeasures = parseReport(report, context); saveMeasures(coverageMeasures, filesCovered); } } if (settings.getBoolean(FORCE_ZERO_COVERAGE_KEY) || (!settings.hasKey(FORCE_ZERO_COVERAGE_KEY) && !reports.isEmpty())) { LOG.debug("Zeroing coverage information for untouched files"); zeroMeasuresWithoutReports(context, filesCovered, linesOfCode); } }

Target:
public void execute(SensorContext context, Map<InputFile, Set<Integer>> linesOfCode) { String baseDir = context.fileSystem().baseDir().getPath(); Settings settings = context.settings(); HashSet<InputFile> filesCovered = new HashSet<>(); List<File> reports = new ArrayList<>(); reports.addAll(getReports(settings, baseDir, REPORT_PATH_KEY, DEFAULT_REPORT_PATH)); reports.addAll(getReports(settings, baseDir, IT_REPORT_PATH_KEY, IT_DEFAULT_REPORT_PATH)); reports.addAll(getReports(settings, baseDir, OVERALL_REPORT_PATH_KEY, OVERALL_DEFAULT_REPORT_PATH)); if (!reports.isEmpty()) { LOG.info("Python test coverage"); for (File report : reports) { Map<InputFile, NewCoverage> coverageMeasures = parseReport(report, context); saveMeasures(coverageMeasures, filesCovered); } } if (settings.getBoolean(FORCE_ZERO_COVERAGE_KEY)) { LOG.debug("Zeroing coverage information for untouched files"); zeroMeasuresWithoutReports(context, filesCovered, linesOfCode); } }
Source:
public String outString() { return RawParseUtils.decode(out.toByteArray()); }

Target:
public String outString() { return new String(out.toByteArray(), UTF_8); }
Source:
public Pair<Case.Alternative,Set<Block>> getAlternative() { Pair<Expression, Set<Block>> pair = result.getLocalExpr(); LetExpression guards = new LetExpression(pair.a, true); Set<Block> surroundingBlocks = pair.b; result.extendExprGraph(guards, this, surroundingBlocks); attachedBlocks.stream().filter(Block::isBottomMost).forEach(block -> { if (block instanceof MatchBlock) { guards.addLetBinding(((MatchBlock)block).getPrimaryBinder(), block.getAllInputs().get(0).getFullExpr()); } else { block.getAllOutputs().forEach(anchor -> { guards.addLetBinding(new ConstructorBinder("True", Collections.EMPTY_LIST), anchor.getVariable()); anchor.extendExprGraph(guards, this, surroundingBlocks); }); } block.extendExprGraph(guards, this, surroundingBlocks); }); return new Pair<>(new Case.Alternative(new ConstructorBinder("()", Collections.EMPTY_LIST), guards), surroundingBlocks); }

Target:
public Pair<Case.Alternative,Set<Block>> getAlternative() { Pair<Expression, Set<Block>> pair = result.getLocalExpr(); LetExpression guards = new LetExpression(pair.a, true); Set<Block> surroundingBlocks = pair.b; result.extendExprGraph(guards, Optional.of(this), surroundingBlocks); attachedBlocks.stream().filter(Block::isBottomMost).forEach(block -> { if (block instanceof MatchBlock) { guards.addLetBinding(((MatchBlock)block).getPrimaryBinder(), block.getAllInputs().get(0).getFullExpr()); } else { block.getAllOutputs().forEach(anchor -> { guards.addLetBinding(new ConstructorBinder("True"), anchor.getVariable()); anchor.extendExprGraph(guards, Optional.of(this), surroundingBlocks); }); } block.extendExprGraph(guards, Optional.of(this), surroundingBlocks); }); return new Pair<>(new Case.Alternative(new ConstructorBinder("()"), guards), surroundingBlocks); }
Source:
private ImmutableSet<ExecutableElement> methodsToImplement( TypeElement autoValueClass, Set<ExecutableElement> methods) { ImmutableSet.Builder<ExecutableElement> toImplement = ImmutableSet.builder(); boolean ok = true; for (ExecutableElement method : methods) { if (method.getModifiers().contains(Modifier.ABSTRACT) && objectMethodToOverride(method) == ObjectMethodToOverride.NONE) { if (method.getParameters().isEmpty() && method.getReturnType().getKind() != TypeKind.VOID) { ok &= checkReturnType(autoValueClass, method); toImplement.add(method); } else { errorReporter.reportWarning("@AutoValue classes cannot have abstract methods other than" + " property getters and Builder converters", method); } } } if (!ok) { throw new AbortProcessingException(); } return toImplement.build(); }

Target:
private ImmutableSet<ExecutableElement> methodsToImplement( TypeElement autoValueClass, Set<ExecutableElement> methods) { ImmutableSet.Builder<ExecutableElement> toImplement = ImmutableSet.builder(); Set<Name> toImplementNames = Sets.newHashSet(); boolean ok = true; for (ExecutableElement method : methods) { if (method.getModifiers().contains(Modifier.ABSTRACT) && objectMethodToOverride(method) == ObjectMethodToOverride.NONE) { if (method.getParameters().isEmpty() && method.getReturnType().getKind() != TypeKind.VOID) { ok &= checkReturnType(autoValueClass, method); if (toImplementNames.add(method.getSimpleName())) { toImplement.add(method); } } else { errorReporter.reportWarning("@AutoValue classes cannot have abstract methods other than" + " property getters and Builder converters", method); } } } if (!ok) { throw new AbortProcessingException(); } return toImplement.build(); }
Source:
public void addEvents(Collection<IEventDeclaration> events) throws CTFReaderException { if (fEvents != Collections.EMPTY_LIST) { for (IEventDeclaration event : events) { if (event != null) { int index = event.getId().intValue(); while (fEvents.size() >= index) { fEvents.add(null); } if (fEvents.get(index) != null) { throw new CTFReaderException("Both lists have an event defined at position " + index); } fEvents.set(index, event); } } } else { fEvents = new ArrayList<>(events); } }

Target:
public void addEvents(Collection<IEventDeclaration> events) throws CTFReaderException { if (fEvents != Collections.EMPTY_LIST) { if (fEventUnsetId) { throw new CTFReaderException("Cannot add to a stream with an unidentified event"); } for (IEventDeclaration event : events) { if (event != null) { int index = event.getId().intValue(); while (fEvents.size() >= index) { fEvents.add(null); } if (fEvents.get(index) != null) { throw new CTFReaderException("Both lists have an event defined at position " + index); } fEvents.set(index, event); } } } else { fEvents = new ArrayList<>(events); } }
Source:
public static List<BasicML> loadBasicModels(ModelConfig modelConfig, EvalConfig evalConfig, SourceType sourceType, boolean gbtConvertToProb, String gbtScoreConvertStrategy) throws IOException { List<BasicML> models = new ArrayList<BasicML>(); FileSystem fs = ShifuFileUtils.getFileSystemBySourceType(sourceType); if(Constants.GENERIC.equals(modelConfig.getAlgorithm())) { List<FileStatus> genericModelConfigs = findGenericModels(modelConfig, evalConfig, sourceType); if(genericModelConfigs.isEmpty()) { throw new RuntimeException("Load generic model failed."); } loadGenericModels(modelConfig, genericModelConfigs, sourceType, models); log.debug("return generic model {}", models.size()); return models; } List<FileStatus> modelFileStats = locateBasicModels(modelConfig, evalConfig, sourceType); if(CollectionUtils.isNotEmpty(modelFileStats)) { for(FileStatus f: modelFileStats) { models.add(loadModel(modelConfig, f.getPath(), fs, gbtConvertToProb, gbtScoreConvertStrategy)); } } return models; }

Target:
public static List<BasicML> loadBasicModels(ModelConfig modelConfig, EvalConfig evalConfig, SourceType sourceType, boolean gbtConvertToProb, String gbtScoreConvertStrategy) throws IOException { List<BasicML> models = new ArrayList<BasicML>(); FileSystem fs = ShifuFileUtils.getFileSystemBySourceType(sourceType); if(Constants.GENERIC.equals(modelConfig.getAlgorithm())) { List<FileStatus> genericModelConfigs = findGenericModels(modelConfig, evalConfig, sourceType); if(genericModelConfigs.isEmpty()) { throw new RuntimeException("Load generic model failed."); } loadGenericModels(modelConfig, genericModelConfigs, sourceType, models); log.debug("return generic model {}", models.size()); return models; } List<FileStatus> modelFileStats = locateBasicModels(modelConfig, evalConfig, sourceType); if(CollectionUtils.isNotEmpty(modelFileStats)) { for(FileStatus fst: modelFileStats) { models.add(loadModel(modelConfig, fst.getPath(), fs, gbtConvertToProb, gbtScoreConvertStrategy)); } } return models; }
Source:
public void testNormalCdf() throws Exception { assertFunction("normal_cdf(0, 1, 1.96)", DOUBLE, 0.9750021048517796); assertFunction("normal_cdf(10, 9, 10)", DOUBLE, 0.5); assertFunction("normal_cdf(-1.5, 2.1, -7.8)", DOUBLE, 0.0013498980316301035); assertInvalidFunction("normal_cdf(4, 0, 0.4)", "sd must > 0"); }

Target:
public void testNormalCdf() throws Exception { assertFunction("normal_cdf(0, 1, 1.96)", DOUBLE, 0.9750021048517796); assertFunction("normal_cdf(10, 9, 10)", DOUBLE, 0.5); assertFunction("normal_cdf(-1.5, 2.1, -7.8)", DOUBLE, 0.0013498980316301035); assertFunction("normal_cdf(0, 1, infinity())", DOUBLE, 1.0); assertFunction("normal_cdf(0, 1, -infinity())", DOUBLE, 0.0); assertFunction("normal_cdf(infinity(), 1, 0)", DOUBLE, 0.0); assertFunction("normal_cdf(-infinity(), 1, 0)", DOUBLE, 1.0); assertFunction("normal_cdf(0, infinity(), 0)", DOUBLE, 0.5); assertFunction("normal_cdf(nan(), 1, 0)", DOUBLE, Double.NaN); assertFunction("normal_cdf(0, 1, nan())", DOUBLE, Double.NaN); assertInvalidFunction("normal_cdf(0, 0, 0.1985)", "sd must > 0"); assertInvalidFunction("normal_cdf(0, nan(), 0.1985)", "sd must > 0"); }
Source:
protected static synchronized List<IWorkspaceClassifierResolver> readExtensions() { List<IWorkspaceClassifierResolver> resolvers = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint ccpExtensionPoint = registry.getExtensionPoint(EXTENSION_WORKSPACE_CLASSIFIER_RESOLVERS); if(ccpExtensionPoint != null) { IExtension[] ccpExtensions = ccpExtensionPoint.getExtensions(); for(IExtension extension : ccpExtensions) { for(IConfigurationElement element : extension.getConfigurationElements()) { try { resolvers.add((IWorkspaceClassifierResolver) element.createExecutableExtension("class")); } catch(CoreException ex) { log.debug("Cannot instantiate IWorkspaceClassifierResolver", ex); } } } } resolvers.sort((l, r) -> l.getPriority() - r.getPriority()); return resolvers; }

Target:
protected static List<IWorkspaceClassifierResolver> readExtensions() { List<IWorkspaceClassifierResolver> resolvers = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint ccpExtensionPoint = registry.getExtensionPoint(EXTENSION_WORKSPACE_CLASSIFIER_RESOLVERS); if(ccpExtensionPoint != null) { IExtension[] ccpExtensions = ccpExtensionPoint.getExtensions(); for(IExtension extension : ccpExtensions) { for(IConfigurationElement element : extension.getConfigurationElements()) { try { resolvers.add((IWorkspaceClassifierResolver) element.createExecutableExtension("class")); } catch(CoreException ex) { log.error("Cannot instantiate IWorkspaceClassifierResolver", ex); } } } } resolvers.sort((l, r) -> l.getPriority() - r.getPriority()); return resolvers; }
Source:
public Workbook strictParseWorkbook(final File file, final String programUUID) throws WorkbookParserException { final WorkbookParser parser = new WorkbookParser(this.maxRowLimit); final OntologyDataManagerImpl ontology = new OntologyDataManagerImpl(this.getSessionProvider()); final GermplasmDataManager germplasmDataManager = new GermplasmDataManagerImpl(this.getSessionProvider()); return this.strictParseWorkbook(file, parser, parser.parseFile(file, true), ontology, germplasmDataManager, programUUID); }

Target:
public Workbook strictParseWorkbook(final File file, final String programUUID) throws WorkbookParserException { final WorkbookParser parser = new WorkbookParser(this.maxRowLimit); return this.strictParseWorkbook(file, parser, parser.parseFile(file, true), programUUID); }
Source:
public SecurityHjsonIntegrationTestResourceConfig() { register(new AbstractBinder() { @Override protected void configure() { EntityDictionary dictionary = new EntityDictionary(TestCheckMappings.MAPPINGS); try { dictionary.addSecurityChecks(COMPILER.findAnnotatedClasses(SecurityCheck.class)); dictionary.addSecurityChecks(Collections.singleton(OperatorCheck.class)); } catch (ClassNotFoundException e) { } Elide elide = new Elide(new ElideSettingsBuilder(getDataStore()) .withEntityDictionary(dictionary) .withAuditLogger(new TestAuditLogger()) .withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", Calendar.getInstance().getTimeZone()) .build()); bind(elide).to(Elide.class).named("elide"); } }); register(new ContainerRequestFilter() { @Override public void filter(final ContainerRequestContext requestContext) throws IOException { requestContext.setSecurityContext(securityContextMock); } }); }

Target:
public SecurityHjsonIntegrationTestResourceConfig() { register(new AbstractBinder() { @Override protected void configure() { Map<String, Class<? extends Check>> map = new HashMap<>(TestCheckMappings.MAPPINGS); map.put(OperatorCheck.OPERTOR_CHECK, OperatorCheck.class); EntityDictionary dictionary = new EntityDictionary(map); try { dictionary.addSecurityChecks(COMPILER.findAnnotatedClasses(SecurityCheck.class)); } catch (ClassNotFoundException e) { } Elide elide = new Elide(new ElideSettingsBuilder(getDataStore()) .withEntityDictionary(dictionary) .withAuditLogger(new TestAuditLogger()) .withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", Calendar.getInstance().getTimeZone()) .build()); bind(elide).to(Elide.class).named("elide"); } }); register(new ContainerRequestFilter() { @Override public void filter(final ContainerRequestContext requestContext) throws IOException { requestContext.setSecurityContext(securityContextMock); } }); }
Source:
public int getPartition(BytesWritable bytesWritable, Text text, int numPartitions) { final ByteBuffer bytes = ByteBuffer.wrap(bytesWritable.getBytes()); bytes.position(4); int shardNum = bytes.getInt(); return shardNum % numPartitions; }

Target:
public int getPartition(BytesWritable bytesWritable, Text text, int numPartitions) { final ByteBuffer bytes = ByteBuffer.wrap(bytesWritable.getBytes()); bytes.position(4); int shardNum = bytes.getInt(); if (config.get("mapred.job.tracker").equals("local")) { return shardNum % numPartitions; } else { if (shardNum >= numPartitions) { throw new ISE("Not enough partitions, shard[%,d] >= numPartitions[%,d]", shardNum, numPartitions); } return shardNum; } }
Source:
public void updateTimerLongerDelayTest() { CountDownProcessEventListener countDownListener = new CountDownProcessEventListener(TIMER_NAME, 1); setProcessScenario(TIMER_FILE); kieSession.addEventListener(countDownListener); final List<Long> list = new ArrayList<Long>(); kieSession.addEventListener(new DefaultProcessEventListener() { @Override public void beforeProcessStarted(ProcessStartedEvent event) { list.add(event.getProcessInstance().getId()); } }); assertEquals(0, list.size()); long id = kieSession.startProcess(PROCESS_NAME).getId(); long startTime = System.currentTimeMillis(); assertEquals(1, list.size()); kieSession.execute(new UpdateTimerCommand(id, TIMER_NAME, 8)); countDownListener.waitTillCompleted(); assertTrue("The timer has not fired!", timerHasFired()); long firedTime = timerFiredTime(); long timeDifference = Math.abs(firedTime - startTime - 8000); logger.info("Start time: " + startTime + ", fired time: " + firedTime + ", difference: " + (firedTime-startTime)); assertTrue("Timer is fired in wrong time", timeDifference < 500); assertNull("Process is not ended.", kieSession.getProcessInstance(id)); }

Target:
public void updateTimerLongerDelayTest() { CountDownProcessEventListener countDownListener = new CountDownProcessEventListener(TIMER_NAME, 1); setProcessScenario(TIMER_FILE); kieSession.addEventListener(countDownListener); final List<Long> list = new ArrayList<Long>(); kieSession.addEventListener(new DefaultProcessEventListener() { @Override public void beforeProcessStarted(ProcessStartedEvent event) { list.add(event.getProcessInstance().getId()); } }); Assertions.assertThat(list).isEmpty(); long id = kieSession.startProcess(PROCESS_NAME).getId(); long startTime = System.currentTimeMillis(); Assertions.assertThat(list).isNotEmpty(); kieSession.execute(new UpdateTimerCommand(id, TIMER_NAME, 8)); countDownListener.waitTillCompleted(); Assertions.assertThat(timerHasFired()).isTrue(); long firedTime = timerFiredTime(); long timeDifference = Math.abs(firedTime - startTime - 8000); logger.info("Start time: " + startTime + ", fired time: " + firedTime + ", difference: " + (firedTime-startTime)); Assertions.assertThat(timeDifference).isLessThan(500); Assertions.assertThat(kieSession.getProcessInstance(id)).isNull(); }
Source:
public VdsStatic(String hostName, String uniqueId, int port, int sshPort, String sshUsername, Guid clusterId, Guid vdsId, String vdsName, boolean serverSslEnabled, VDSType vdsType, Guid hostProviderId) { this(); this.hostName = hostName; this.uniqueId = uniqueId; this.port = port; if (sshPort > 0) { this.sshPort = sshPort; } if (sshUsername != null) { this.sshUsername = sshUsername; } this.clusterId = clusterId; this.id = vdsId; this.name = vdsName; this.serverSslEnabled = serverSslEnabled; this.setVdsType(vdsType); this.hostProviderId = hostProviderId; comment = ""; this.vgpuPlacement = VgpuPlacementEnum.COMPACT.getValue(); }

Target:
public VdsStatic(String hostName, String uniqueId, int port, int sshPort, String sshUsername, Guid clusterId, Guid vdsId, String vdsName, boolean serverSslEnabled, VDSType vdsType, Guid hostProviderId) { this(); this.hostName = hostName; this.uniqueId = uniqueId; this.port = port; if (sshPort > 0) { this.sshPort = sshPort; } if (sshUsername != null) { this.sshUsername = sshUsername; } this.clusterId = clusterId; this.id = vdsId; this.name = vdsName; this.serverSslEnabled = serverSslEnabled; this.setVdsType(vdsType); this.hostProviderId = hostProviderId; comment = ""; }
Source:
public void run() { while (!stopThread) { try { synchronized(close) { connect(); try { close.wait(); } catch (InterruptedException ie) { stopThread = true; disconnect(); } } } catch (Exception e1) { try { listener.onConnectException(e1); } catch (Exception e2) { break; } if (!stopThread && reconnect) { try { Thread.sleep(reconnectInterval); } catch (InterruptedException ie) { stopThread = true; } } } } }

Target:
public void run() { while (!stopThread) { try { synchronized(close) { connect(); try { close.wait(); } catch (InterruptedException ie) { throw ie; } } } catch (InterruptedException ie) { } catch (Exception e1) { try { listener.onConnectException(e1); } catch (Exception e2) { break; } if (!stopThread && reconnect) { try { Thread.sleep(reconnectInterval); } catch (InterruptedException ie) { } } } } try { disconnect(); } catch (Exception e) { } }
Source:
public void validateFullRepresentation() throws Exception { super.validateDefaultRepresentation(); assertPropPresent("uuid"); assertPropPresent("diagnosis"); assertPropPresent("patient"); assertPropPresent("condition"); assertPropPresent("certainty"); assertPropPresent("rank"); assertPropPresent("voided"); assertPropPresent("auditInfo"); assertPropPresent("display"); }

Target:
public void validateFullRepresentation() throws Exception { super.validateDefaultRepresentation(); assertPropPresent("uuid"); assertPropEquals("diagnosis", getObject().getDiagnosis()); assertPropPresent("patient"); assertPropPresent("condition"); assertPropEquals("certainty", getObject().getCertainty()); assertPropEquals("rank", getObject().getRank()); assertPropEquals("voided", getObject().getVoided()); assertPropPresent("auditInfo"); assertPropPresent("display"); }
Source:
public static AlarmStatus isValidAlarms(final List<Alarm> alarms, final DateTime now, final DateTimeZone timeZone){ final Set<Integer> alarmDays = new HashSet<Integer>(); for(final Alarm alarm: alarms){ if(!alarm.isEnabled) { return AlarmStatus.OK; } if(!alarm.isRepeated){ if (!isValidNoneRepeatedAlarm(alarm)) { return AlarmStatus.NOT_VALID_NON_REPEATED_ALARM; } if(alarm.isSmart){ final DateTime expectedRingTime = new DateTime(alarm.year, alarm.month, alarm.day, alarm.hourOfDay, alarm.minuteOfHour, timeZone); if(alarmDays.contains(expectedRingTime.getDayOfWeek())){ return AlarmStatus.SMART_ALARM_ALREADY_SET; } alarmDays.add(expectedRingTime.getDayOfWeek()); } }else{ if(!alarm.isSmart) { continue; } for (final Integer dayOfWeek : alarm.dayOfWeek) { if (alarmDays.contains(dayOfWeek)) { return AlarmStatus.DUPLICATE_DAYS; } alarmDays.add(dayOfWeek); } } } return AlarmStatus.OK; }

Target:
public static AlarmStatus isValidAlarms(final List<Alarm> alarms, final DateTime now, final DateTimeZone timeZone){ final Set<Integer> alarmDays = new HashSet<Integer>(); for(final Alarm alarm: alarms){ if(!alarm.isEnabled) { return AlarmStatus.OK; } if(!alarm.isRepeated){ if (!isValidNoneRepeatedAlarm(alarm)) { return AlarmStatus.NOT_VALID_NON_REPEATED_ALARM; } if(alarm.isSmart){ final DateTime expectedRingTime = new DateTime(alarm.year, alarm.month, alarm.day, alarm.hourOfDay, alarm.minuteOfHour, timeZone); if(alarmDays.contains(expectedRingTime.getDayOfWeek())){ return AlarmStatus.SMART_ALARM_ALREADY_SET; } alarmDays.add(expectedRingTime.getDayOfWeek()); } }else{ if(!alarm.isSmart) { continue; } for (final Integer dayOfWeek : alarm.dayOfWeek) { if (alarmDays.contains(dayOfWeek)) { return AlarmStatus.SMART_ALARM_ALREADY_SET; } alarmDays.add(dayOfWeek); } } } return AlarmStatus.OK; }
Source:
public boolean preservesOrdering() { return false; }

Target:
public boolean preservesOrdering() { return index == 0 ? true : false; }
Source:
public static VClass getLangAwardRangeVClass(VitroRequest vreq) { WebappDaoFactory ctxDaoFact = ModelAccess.on(vreq).getWebappDaoFactory(LanguageOption.LANGUAGE_AWARE); return ctxDaoFact.getVClassDao().getVClassByURI(getRangeUri(vreq)); }

Target:
public static VClass getLangAwardRangeVClass(VitroRequest vreq) { WebappDaoFactory vreqDaoFact = ModelAccess.on(vreq).getWebappDaoFactory( LanguageOption.LANGUAGE_AWARE); return vreqDaoFact.getVClassDao().getVClassByURI(getRangeUri(vreq)); }
Source:
public long freeMemory(long windowId) throws IOException { long memoryFreed = 0; Iterator<Map.Entry<Long, Map<Slice, BucketedValue>>> entryIter = committedData.entrySet().iterator(); while (entryIter.hasNext()) { Map.Entry<Long, Map<Slice, BucketedValue>> bucketEntry = entryIter.next(); if (bucketEntry.getKey() > windowId) { break; } Map<Slice, BucketedValue> windowData = bucketEntry.getValue(); entryIter.remove(); for (Map.Entry<Slice, BucketedValue> entry : windowData.entrySet()) { memoryFreed += entry.getKey().length + entry.getValue().getSize(); } } fileCache.clear(); if (cachedBucketMetas != null) { for (BucketsFileSystem.TimeBucketMeta tbm : cachedBucketMetas.values()) { FileAccess.FileReader reader = readers.remove(tbm.getTimeBucketId()); if (reader != null) { memoryFreed += tbm.getSizeInBytes(); reader.close(); } } cachedBucketMetas.clear(); } cachedBucketMetas = null; sizeInBytes.getAndAdd(-memoryFreed); windowsForFreeMemory.add(windowId); return memoryFreed; }

Target:
public long freeMemory(long windowId) throws IOException { long memoryFreed = 0; Iterator<Map.Entry<Long, Map<Slice, BucketedValue>>> entryIter = committedData.entrySet().iterator(); while (entryIter.hasNext()) { Map.Entry<Long, Map<Slice, BucketedValue>> bucketEntry = entryIter.next(); if (bucketEntry.getKey() > windowId) { break; } Map<Slice, BucketedValue> windowData = bucketEntry.getValue(); entryIter.remove(); for (Map.Entry<Slice, BucketedValue> entry : windowData.entrySet()) { memoryFreed += entry.getKey().length + entry.getValue().getSize(); } } fileCache.clear(); if (cachedBucketMetas != null) { for (BucketsFileSystem.TimeBucketMeta tbm : cachedBucketMetas.values()) { FileAccess.FileReader reader = readers.remove(tbm.getTimeBucketId()); if (reader != null) { memoryFreed += tbm.getSizeInBytes(); reader.close(); } } } sizeInBytes.getAndAdd(-memoryFreed); windowsForFreeMemory.add(windowId); return memoryFreed; }
Source:
private com.alliander.osgp.dto.valueobjects.smartmetering.DayProfile processDayProfile(final DayProfile dp) { final com.alliander.osgp.dto.valueobjects.smartmetering.DayProfile dpDto = new com.alliander.osgp.dto.valueobjects.smartmetering.DayProfile(); if (dp.getDayId() != null) { dpDto.setDayId(dp.getDayId().intValue()); } dpDto.setDayProfileActionCollection(this.processDayProfileAction(dp.getDayProfileActionCollection())); return dpDto; }

Target:
private com.alliander.osgp.dto.valueobjects.smartmetering.DayProfile processDayProfile(final DayProfile dp) { return new com.alliander.osgp.dto.valueobjects.smartmetering.DayProfile(dp.getDayId(), this.processDayProfileAction(dp.getDayProfileActionList())); }
Source:
public void shouldConcatenateTwoListsWithSameElements() { final List<Integer> list1 = Collections.unmodifiableList( IntStream.range(0, 4).boxed().collect(Collectors.toList()) ); final List<Integer> list2 = Collections.unmodifiableList( IntStream.range(1, 6).boxed().collect(Collectors.toList()) ); final List<Integer> sortedCancatenatedList = Stream.concat(list1.stream(), list2.stream()) .collect(Collectors.toList()); Collections.sort(sortedCancatenatedList); final List<Integer> expected = Collections.unmodifiableList( sortedCancatenatedList); final List<Integer> actual = ListOps.concat(list1, list2); Collections.sort(actual); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }

Target:
public void shouldConcatenateTwoListsWithSameElements() { final List<Integer> list1 = Collections.unmodifiableList( Arrays.asList(0, 1, 2, 3, 4) ); final List<Integer> list2 = Collections.unmodifiableList( Arrays.asList(1, 2, 3, 4, 5, 6) ); final List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6); final List<Integer> actual = ListOps.concat(list1, list2); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }
Source:
private Prepared parseWith() { List<TableView> viewsCreated = new ArrayList<>(); readIf("RECURSIVE"); boolean isPersistent = readIf("PERSISTENT"); if(session.isParsingView()){ isPersistent = true; } do { viewsCreated.add(parseSingleCommonTableExpression(isPersistent)); } while (readIf(",")); Prepared p = null; if(isToken("SELECT")) { Query query = parseSelectUnion(); query.setPrepareAlways(true); query.setNeverLazy(true); p = query; } else if(readIf("INSERT")) { p = parseInsert(); p.setPrepareAlways(true); } else if(readIf("UPDATE")) { p = parseUpdate(); p.setPrepareAlways(true); } else if(readIf("MERGE")) { p = parseMerge(); p.setPrepareAlways(true); } else if(readIf("DELETE")) { p = parseDelete(); p.setPrepareAlways(true); } else if(readIf("CREATE")) { if (!isToken("TABLE")){ throw DbException.get(ErrorCode.SYNTAX_ERROR_1, WITH_STATEMENT_SUPPORTS_LIMITED_STATEMENTS); } p = parseCreate(); p.setPrepareAlways(true); } else { throw DbException.get(ErrorCode.SYNTAX_ERROR_1, WITH_STATEMENT_SUPPORTS_LIMITED_STATEMENTS); } if(!isPersistent){ Collections.reverse(viewsCreated); p.setCteCleanups(viewsCreated); } return p; }

Target:
private Prepared parseWith() { List<TableView> viewsCreated = new ArrayList<>(); readIf("RECURSIVE"); boolean isPersistent = readIf("PERSISTENT"); if (session.isParsingCreateView()) { isPersistent = true; } do { viewsCreated.add(parseSingleCommonTableExpression(isPersistent)); } while (readIf(",")); Prepared p = null; Collections.reverse(viewsCreated); if (isToken("SELECT")) { Query query = parseSelectUnion(); query.setPrepareAlways(true); query.setNeverLazy(true); p = query; } else if (readIf("INSERT")) { p = parseInsert(); p.setPrepareAlways(true); } else if (readIf("UPDATE")) { p = parseUpdate(); p.setPrepareAlways(true); } else if (readIf("MERGE")) { p = parseMerge(); p.setPrepareAlways(true); } else if (readIf("DELETE")) { p = parseDelete(); p.setPrepareAlways(true); } else if (readIf("CREATE")) { if (!isToken("TABLE")) { throw DbException.get(ErrorCode.SYNTAX_ERROR_1, WITH_STATEMENT_SUPPORTS_LIMITED_SUB_STATEMENTS); } p = parseCreate(); p.setPrepareAlways(true); } else { throw DbException.get(ErrorCode.SYNTAX_ERROR_1, WITH_STATEMENT_SUPPORTS_LIMITED_SUB_STATEMENTS); } if (!isPersistent) { p.setCteCleanups(viewsCreated); } return p; }
Source:
public ContentEvent nextEvent() { return this.deserializer.deserialize(buffer.remove(buffer.size() - 1)); }

Target:
public ContentEvent nextEvent() { return this.deserializer.deserialize(buffer.remove(0)); }