auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void onEvents() { ReactingRepository repository = new ReactingRepository(); boundedContext().register(repository); ProjectId parentId = givenAggregateId("parent"); ProjectId childId = givenAggregateId("child"); TestEventFactory factory = TestEventFactory.newInstance(Identifier.pack(parentId), getClass()); AggProjectArchived msg = AggProjectArchived .newBuilder() .setProjectId(parentId) .addChildProjectId(childId) .build(); Event event = factory.createEvent(msg); boundedContext().eventBus() .post(event); Optional<ReactingAggregate> optional = repository.find(childId); assertTrue(optional.isPresent()); assertEquals(ReactingAggregate.PROJECT_ARCHIVED, optional.get() .state() .getValue()); }

Target:
void onEvents() { ReactingRepository repository = new ReactingRepository(); boundedContext().register(repository); ProjectId parentId = givenAggregateId("parent"); ProjectId childId = givenAggregateId("child"); TestEventFactory factory = TestEventFactory.newInstance(Identifier.pack(parentId), getClass()); AggProjectArchived msg = AggProjectArchived .newBuilder() .setProjectId(parentId) .addChildProjectId(childId) .vBuild(); Event event = factory.createEvent(msg); boundedContext().eventBus() .post(event); Optional<ReactingAggregate> optional = repository.find(childId); assertTrue(optional.isPresent()); assertEquals(ReactingAggregate.PROJECT_ARCHIVED, optional.get() .state() .getValue()); }
Source:
private void createSuperTypeCombo(Composite parent) { final Label label= new Label(parent, SWT.NONE); label.setText(RefactoringMessages.PullUpInputPage1_Select_destination); label.setLayoutData(new GridData()); fSuperTypesCombo= new Combo(parent, SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(fSuperTypesCombo); if (fCandidateTypes.length > 0) { for (IType fCandidateType : fCandidateTypes) { final String comboLabel= fCandidateType.getFullyQualifiedName('.'); fSuperTypesCombo.add(comboLabel); } fSuperTypesCombo.select(fCandidateTypes.length - 1); fSuperTypesCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); } }

Target:
private void createSuperTypeCombo(Composite parent) { final Label label= new Label(parent, SWT.NONE); label.setText(RefactoringMessages.PullUpInputPage1_Select_destination); label.setLayoutData(new GridData()); fSuperTypesCombo= new Combo(parent, SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(fSuperTypesCombo); if (fCandidateTypes.length > 0) { for (IType candidateType : fCandidateTypes) { final String comboLabel= candidateType.getFullyQualifiedName('.'); fSuperTypesCombo.add(comboLabel); } fSuperTypesCombo.select(fCandidateTypes.length - 1); fSuperTypesCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); } }
Source:
private void requireNoActiveOrderOfSameType(Patient patient1, Patient patient2) { List<Order> ordersByPatient1 = Context.getOrderService().getAllOrdersByPatient(patient1); List<Order> ordersByPatient2 = Context.getOrderService().getAllOrdersByPatient(patient2); ordersByPatient1.forEach((Order order1)->{ ordersByPatient2.forEach((Order order2)->{ if(order1.isActive() && order2.isActive() && order1.getOrderType().equals(order2.getOrderType())){ log.debug("Merge operation cancelled: Cannot merge patient" + patient1.getPatientId() + " to patient" + patient2.getPatientId()); log.debug("Patients having active order of " + order1.getOrderType()); throw new APIException("Patient.cannot.merge", (Object[]) null); } }); }); }

Target:
private void requireNoActiveOrderOfSameType(Patient patient1, Patient patient2) { String messageKey = "Patient.merge.cannotHaveSameTypeActiveOrders"; List<Order> ordersByPatient1 = Context.getOrderService().getAllOrdersByPatient(patient1); List<Order> ordersByPatient2 = Context.getOrderService().getAllOrdersByPatient(patient2); ordersByPatient1.forEach((Order order1) -> { ordersByPatient2.forEach((Order order2) -> { if (order1.isActive() && order2.isActive() && order1.getOrderType().equals(order2.getOrderType())) { Object[] parameters = { patient1.getPatientId(), patient2.getPatientId(), order1.getOrderType() }; String message = Context.getMessageSourceService().getMessage(messageKey, parameters, Context.getLocale()); log.debug(message); throw new APIException(message); } }); }); }
Source:
default <N> Optional<N> findParent(Class<N> type) { Optional<Node> possibleParent = getParentNode(); while (possibleParent.isPresent()) { Node parent = possibleParent.get(); if (type.isAssignableFrom(parent.getClass())) { return Optional.of(type.cast(parent)); } possibleParent = parent.getParentNode(); } return Optional.empty(); }

Target:
default <N> Optional<N> findParent(Class<N> type) { return findAncestor(type); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Foo foo1 = (Foo) o; return Objects.equals(this.foo, foo1.foo); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Foo foo1 = (Foo) o; return this.foo != null ? this.foo.equals(foo1.foo) : foo1.foo == null; }
Source:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_GROUP_RESOURCE_ATTR_DEF); attr.setFriendlyName("projectOwnerLogin"); attr.setDisplayName("projectOwnerLogin"); attr.setType(String.class.getName()); attr.setDescription("Login of user, who is owner of project directory."); return attr; }

Target:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_GROUP_RESOURCE_ATTR_DEF); attr.setFriendlyName("projectOwnerLogin"); attr.setDisplayName("Project owner login"); attr.setType(String.class.getName()); attr.setDescription("Login of user, who is owner of project directory."); return attr; }
Source:
private ReportInit() { AsyncDataProvider.GetRedirectServletReportsPage(new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { setReportBaseUrl((String) returnValue); } })); }

Target:
private ReportInit() { }
Source:
public boolean noCredentials() { return getElement(by.tagName("options")) == null; }

Target:
public boolean noCredentials() { try { credentialId.resolve().findElement(by.tagName("option")); return false; } catch (NoSuchElementException ex){ return true; } }
Source:
default Set<Image> getImageResponseFromQuay(String repo, String tagName) { final String tagUrl = QUAY_URL + "repository/" + repo + "/tag/" + "?specificTag=" + tagName; Optional<String> response; Map<String, String> errorMap = new HashMap<>(); try { URL url = new URL(tagUrl); response = Optional.of(IOUtils.toString(url, StandardCharsets.UTF_8)); } catch (IOException ex) { LOG.error("Unable to get response from Quay", ex); response = Optional.empty(); } Set<Image> quayImages = new HashSet<>(); if (response.isPresent()) { Map<String, ArrayList<Map<String, String>>> map = new HashMap<>(); String errorKey = "error_message"; map = (Map<String, ArrayList<Map<String, String>>>)GSON.fromJson(response.get(), map.getClass()); errorMap = (Map<String, String>)GSON.fromJson(response.get(), errorMap.getClass()); if (errorMap.get(errorKey) != null) { LOG.error("Error response from Quay: " + errorMap.get(errorKey)); } else { try { final List<Map<String, String>> array = map.get("tags"); for (Map<String, String> tag : array) { final String digest = tag.get("manifest_digest"); final String imageID = tag.get("image_id"); List<Checksum> checksums = new ArrayList<>(); checksums.add(new Checksum(digest.split(":")[0], digest.split(":")[1])); quayImages.add(new Image(checksums, repo, tagName, imageID, Registry.QUAY_IO)); } } catch (IndexOutOfBoundsException | NullPointerException ex) { LOG.error("Could not get checksum information for " + repo, ex); } } } else { LOG.error("Could not get response from Quay for " + repo); } return quayImages; }

Target:
default Set<Image> getImageResponseFromQuay(String repo, String tagName) { Set<Image> quayImages = new HashSet<>(); RepositoryApi api = new RepositoryApi(API_CLIENT); try { final QuayRepo quayRepo = api.getRepo(repo, false); QuayTag tag = quayRepo.getTags().get(tagName); if (tag == null) { LOG.error("Unable to get find tag: " + tagName + " from Quay in repo " + repo); return quayImages; } final String digest = tag.getManifestDigest(); final String imageID = tag.getImageId(); List<Checksum> checksums = Collections.singletonList(new Checksum(digest.split(":")[0], digest.split(":")[1])); quayImages.add(new Image(checksums, repo, tagName, imageID, Registry.QUAY_IO)); } catch (ApiException ex) { LOG.error("Could not read from " + repo, ex); } return quayImages; }
Source:
protected PlotDatasetDto generatePlotDatasetDto(MetricDto metricDto) { List<PointDto> list = new ArrayList<PointDto>(); List<MetricValueDto> metricList = new ArrayList<MetricValueDto>(); for(MetricValueDto value :metricDto.getValues()) { metricList.add(value); } Collections.sort(metricList, new Comparator<MetricValueDto>() { @Override public int compare(MetricValueDto o1, MetricValueDto o2) { return o2.getSessionId() < o1.getSessionId() ? 1 : -1; } }); for (MetricValueDto value: metricList) { double temp = Double.parseDouble(value.getValue()); list.add(new PointDto(value.getSessionId(), temp)); } String legend = metricDto.getMetricName().getMetricDisplayName(); return new PlotDatasetDto( list, legend, ColorCodeGenerator.getHexColorCode(metricDto.getMetricName().getMetricName(), new String()) ); }

Target:
protected PlotDatasetDto generatePlotDatasetDto(MetricDto metricDto) { List<PointDto> list = new ArrayList<PointDto>(); List<MetricValueDto> metricList = new ArrayList<MetricValueDto>(); for(MetricValueDto value :metricDto.getValues()) { metricList.add(value); } Collections.sort(metricList, new Comparator<MetricValueDto>() { @Override public int compare(MetricValueDto o1, MetricValueDto o2) { return o2.getSessionId() < o1.getSessionId() ? 1 : -1; } }); for (MetricValueDto value: metricList) { double temp = Double.parseDouble(value.getValue()); list.add(new PointDto(value.getSessionId(), temp)); } String legend = metricDto.getMetricName().getMetricDisplayName(); return new PlotDatasetDto( list, legend, ColorCodeGenerator.getHexColorCode(metricDto.getMetricName().getMetricName(), "") ); }
Source:
public TestConfiguration(Class<?> testClass, Method testMethod, Collection<Class<?>> additionalClasses) { this.testClass = testClass; this.testMethod = testMethod; this.additionalClasses = additionalClasses != null ? additionalClasses : new ArrayList<>(); }

Target:
public TestConfiguration(Class<?> testClass, Method testMethod, Collection<Class<?>> additionalClasses) { this.testClass = testClass; this.testMethod = testMethod; if (additionalClasses == null) { throw new NullPointerException("Expected AdditionalClasses not null."); } this.additionalClasses = additionalClasses; }
Source:
public static KeyPair toJavaKeyPair(SignatureKeyPair keyPair) { try { final PrivateKey privateKey = KeyFactory.getInstance(keyPair.getPrivateKey().getAlgorithm()) .generatePrivate(getKeySpec(keyPair.getPrivateKey())); final PublicKey publicKey = KeyFactory.getInstance(keyPair.getPublicKey().getAlgorithm()) .generatePublic(getKeySpec(keyPair.getPublicKey())); return new KeyPair(publicKey, privateKey); } catch (NoSuchAlgorithmException | InvalidKeySpecException ex) { LOG.error("Failed to convert signature key pair to Java keys cause: {}", ex.getMessage()); return null; } }

Target:
public static KeyPair toJavaKeyPair(SignatureKeyPair keyPair) throws ServerException { try { final PrivateKey privateKey = KeyFactory.getInstance(keyPair.getPrivateKey().getAlgorithm()) .generatePrivate(getKeySpec(keyPair.getPrivateKey())); final PublicKey publicKey = KeyFactory.getInstance(keyPair.getPublicKey().getAlgorithm()) .generatePublic(getKeySpec(keyPair.getPublicKey())); return new KeyPair(publicKey, privateKey); } catch (NoSuchAlgorithmException | InvalidKeySpecException ex) { LOG.error("Failed to convert signature key pair to Java keys. Cause: {}", ex.getMessage()); throw new ServerException("Failed to convert signature key pair to Java keys."); } }
Source:
public SpanBatchDeleteInformation(Optional<String> nodeId, int batchSize, Column column, Span span) { super(batchSize, Task.Delete, column, span); Preconditions.checkNotNull(nodeId); this.nodeId = nodeId; }

Target:
public SpanBatchDeleteInformation(Optional<String> nodeId, int batchSize, Column column, Span span) { super(batchSize, Task.Delete, column, span); checkNotNull(nodeId); this.nodeId = nodeId; }
Source:
private Map<String, String> getFullSinkOptions() { Map<String, String> tableOptions = new HashMap<>(); tableOptions.put("connector", factoryIdentifier()); tableOptions.put("topic", TOPIC); tableOptions.put("properties.group.id", "dummy"); tableOptions.put("properties.bootstrap.servers", "dummy"); tableOptions.put("sink.partitioner", KafkaOptions.SINK_PARTITIONER_VALUE_FIXED); tableOptions.put("sink.semantic", KafkaOptions.SINK_SEMANTIC_VALUE_AT_LEAST_ONCE); tableOptions.put("format", TestFormatFactory.IDENTIFIER); final String formatDelimiterKey = String.format("%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.DELIMITER.key()); tableOptions.put(formatDelimiterKey, ","); return tableOptions; }

Target:
protected Map<String, String> getFullSinkOptions() { Map<String, String> tableOptions = new HashMap<>(); tableOptions.put("connector", factoryIdentifier()); tableOptions.put("topic", TOPIC); tableOptions.put("properties.group.id", "dummy"); tableOptions.put("properties.bootstrap.servers", "dummy"); tableOptions.put("sink.partitioner", KafkaOptions.SINK_PARTITIONER_VALUE_FIXED); tableOptions.put("sink.semantic", KafkaOptions.SINK_SEMANTIC_VALUE_EXACTLY_ONCE); tableOptions.put("format", TestFormatFactory.IDENTIFIER); final String formatDelimiterKey = String.format("%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.DELIMITER.key()); tableOptions.put(formatDelimiterKey, ","); return tableOptions; }
Source:
private DocumentBuilder newDocumentBuilder(StringWriter writer, boolean xhtmlStrict) { HtmlLanguage language = builder.add(BlockType.PARAGRAPH) .setXhtmlStrict(xhtmlStrict) .document("", "") .name("Test") .create(); return language.createDocumentBuilder(writer); }

Target:
private DocumentBuilder newDocumentBuilder(StringWriter writer, boolean xhtmlStrict) { return builder.add(BlockType.PARAGRAPH) .setXhtmlStrict(xhtmlStrict) .document("", "") .name("Test") .create().createDocumentBuilder(writer); }
Source:
private static Predicate<Expression> isStringSatisfying(Predicate<String> pred) { return expr -> { if (expr.is(Tree.Kind.STRING_LITERAL)) { return pred.test(((StringLiteral) expr).trimmedQuotesValue()); } else { return false; } }; }

Target:
private static Predicate<Expression> isStringSatisfying(Predicate<String> pred) { return expr -> expr.is(Tree.Kind.STRING_LITERAL) && pred.test(((StringLiteral) expr).trimmedQuotesValue()); }
Source:
private static GitSynchronizer getSynchronizer() { Display display = Display.getCurrent(); Assert.isNotNull(display); if (Activator.getDefault().getPreferenceStore() .getBoolean(UIPreferences.USE_LOGICAL_MODEL)) { return new ModelAwareGitSynchronizer(display); } return new DefaultGitSynchronizer(display); }

Target:
private static GitSynchronizer getSynchronizer() { if (Activator.getDefault().getPreferenceStore() .getBoolean(UIPreferences.USE_LOGICAL_MODEL)) { return new ModelAwareGitSynchronizer(); } return new DefaultGitSynchronizer(); }
Source:
public void setup() { MockitoAnnotations.initMocks(this); initializeBridge(); thingConfiguration.put(CONFIG_ID, TEST_ID); thingProperties.put(PROPERTY_SENSORCOUNT, "1"); thingProperties.put(PROPERTY_THING_TYPE_VERSION, "1"); thingProperties.put(PROPERTY_MODELID, "AMS"); channels.add(ChannelBuilder.create(CHANNEL_UID_PRESENT, "Switch").build()); channels.add(ChannelBuilder.create(CHANNEL_UID_TEMPERATURE, "Number").build()); channels.add(ChannelBuilder.create(CHANNEL_UID_HUMIDITY, "Number").build()); channels.add(ChannelBuilder.create(CHANNEL_UID_ABSOLUTE_HUMIDITY, "Number").build()); channels.add(ChannelBuilder.create(CHANNEL_UID_DEWPOINT, "Number").build()); thing = ThingBuilder.create(THING_TYPE_MS_TH, "testthing").withLabel("Test thing").withChannels(channels) .withConfiguration(new Configuration(thingConfiguration)).withProperties(thingProperties) .withBridge(bridge.getUID()).build(); thingHandler = new MultisensorThingHandler(thing, stateProvider) { @Override protected Bridge getBridge() { return bridge; } }; initializeHandlerMocks(); }

Target:
public void setup() { MockitoAnnotations.initMocks(this); initializeBridge(); thingConfiguration.put(CONFIG_ID, TEST_ID); thingProperties.put(PROPERTY_SENSORCOUNT, "1"); thingProperties.put(PROPERTY_THING_TYPE_VERSION, "1"); channels.add(ChannelBuilder.create(CHANNEL_UID_PRESENT, "Switch").build()); channels.add(ChannelBuilder.create(CHANNEL_UID_TEMPERATURE, "Number").build()); channels.add(ChannelBuilder.create(CHANNEL_UID_HUMIDITY, "Number").build()); channels.add(ChannelBuilder.create(CHANNEL_UID_ABSOLUTE_HUMIDITY, "Number").build()); channels.add(ChannelBuilder.create(CHANNEL_UID_DEWPOINT, "Number").build()); thing = ThingBuilder.create(THING_TYPE_MS_TH, "testthing").withLabel("Test thing").withChannels(channels) .withConfiguration(new Configuration(thingConfiguration)).withProperties(thingProperties) .withBridge(bridge.getUID()).build(); thingHandler = new MultisensorThingHandler(thing, stateProvider) { @Override protected Bridge getBridge() { return bridge; } }; initializeHandlerMocks(); }
Source:
protected void autoSelectGraphicsDevice() { if (getParameters().getGraphicsDevices().size() == 0) { DisplayType defaultDisplayType = getParameters().getVmStaticData().getDefaultDisplayType(); int osId = getParameters().getVmStaticData().getOsId(); Version clusterVersion = getVdsGroup().getCompatibilityVersion(); List<GraphicsType> templateGraphics = VmDeviceUtils.getGraphicsTypesOfEntity(getVmTemplateId()); if (!VmValidationUtils.isGraphicsAndDisplaySupported(osId, clusterVersion, templateGraphics, defaultDisplayType)) { GraphicsType defaultGraphicsType = null; List<Pair<GraphicsType, DisplayType>> pairs = osRepository.getGraphicsAndDisplays().get(osId).get(clusterVersion); for (Pair<GraphicsType, DisplayType> pair : pairs) { if (pair.getSecond().equals(defaultDisplayType)) { defaultGraphicsType = pair.getFirst(); break; } } if (defaultGraphicsType != null) { VmDeviceType vmDisplayType = defaultDisplayType.getDefaultVmDeviceType(); GraphicsDevice defaultGraphicsDevice = new GraphicsDevice(vmDisplayType); getParameters().getGraphicsDevices().put(defaultGraphicsType, defaultGraphicsDevice); } } } }

Target:
protected void autoSelectGraphicsDevice() { if (getParameters().getGraphicsDevices().size() == 0 && getVdsGroup() != null) { OsRepository osRepository = SimpleDependecyInjector.getInstance().get(OsRepository.class); DisplayType defaultDisplayType = getParameters().getVmStaticData().getDefaultDisplayType(); int osId = getParameters().getVmStaticData().getOsId(); Version clusterVersion = getVdsGroup().getCompatibilityVersion(); List<GraphicsType> templateGraphics = VmDeviceUtils.getGraphicsTypesOfEntity(getVmTemplateId()); if (!VmValidationUtils.isGraphicsAndDisplaySupported(osId, clusterVersion, templateGraphics, defaultDisplayType)) { GraphicsType defaultGraphicsType = null; List<Pair<GraphicsType, DisplayType>> pairs = osRepository.getGraphicsAndDisplays(osId, clusterVersion); for (Pair<GraphicsType, DisplayType> pair : pairs) { if (pair.getSecond().equals(defaultDisplayType)) { defaultGraphicsType = pair.getFirst(); break; } } if (defaultGraphicsType != null) { VmDeviceType vmDisplayType = defaultDisplayType.getDefaultVmDeviceType(); GraphicsDevice defaultGraphicsDevice = new GraphicsDevice(vmDisplayType); getParameters().getGraphicsDevices().put(defaultGraphicsType, defaultGraphicsDevice); } } } }
Source:
public AbstractCursorWrappingIndexHits( int size, float score ) { this.size = size; this.score = score; }

Target:
AbstractCursorWrappingIndexHits( int size, float score ) { this.size = size; this.score = score; }
Source:
public Optional<RevCommit> areAllReachable(Collection<RevCommit> targets, Collection<RevCommit> starters) throws MissingObjectException, IncorrectObjectTypeException, IOException { walk.reset(); walk.setRetainBody(false); if (topoSort) { walk.sort(RevSort.TOPO); } for (RevCommit target: targets) { walk.markStart(target); } for (RevCommit starter : starters) { walk.markUninteresting(starter); } return Optional.ofNullable(walk.next()); }

Target:
public Optional<RevCommit> areAllReachable(Collection<RevCommit> targets, Collection<RevCommit> starters) throws MissingObjectException, IncorrectObjectTypeException, IOException { walk.reset(); if (topoSort) { walk.sort(RevSort.TOPO); } for (RevCommit target: targets) { walk.markStart(target); } for (RevCommit starter : starters) { walk.markUninteresting(starter); } return Optional.ofNullable(walk.next()); }
Source:
public void onInstanceConfigChange(List<InstanceConfig> configs, NotificationContext changeContext) { logger.trace("InstanceConfig change triggered in with: {}", dcName, configs); synchronized (notificationLock) { if (!instanceConfigInitialized.get()) { logger.info("Received initial notification for instance config change from {}", dcName); try { initializeInstances(configs); } catch (Exception e) { initializationException.compareAndSet(null, e); } instanceConfigInitialized.set(true); } else if (!clusterMapConfig.clusterMapEnablePartitionOverride) { updateSealedStateOfReplicas(configs); } sealedStateChangeCounter.incrementAndGet(); helixClusterManagerMetrics.instanceConfigChangeTriggerCount.inc(); } }

Target:
public void onInstanceConfigChange(List<InstanceConfig> configs, NotificationContext changeContext) { logger.trace("InstanceConfig change triggered in with: {}", dcName, configs); synchronized (notificationLock) { if (!instanceConfigInitialized.get()) { logger.info("Received initial notification for instance config change from {}", dcName); try { initializeInstances(configs); } catch (Exception e) { initializationException.compareAndSet(null, e); } instanceConfigInitialized.set(true); } else { updateStateOfReplicas(configs); } sealedStateChangeCounter.incrementAndGet(); helixClusterManagerMetrics.instanceConfigChangeTriggerCount.inc(); } }
Source:
private String confirmTarget(IProgressMonitor monitor) { if (target == null) return null; Optional<Repository> invalidRepo = Stream.of(repositories) .filter(r -> !r.getRepositoryState().canCheckout()) .findFirst(); if (invalidRepo.isPresent()) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { showRepositoryInInvalidStateForCheckout(invalidRepo.get()); } }); return null; } Collection<Repository> repos = Arrays.asList(repositories); if (LaunchFinder.shouldCancelBecauseOfRunningLaunches(repos, monitor)) { return null; } askForTargetIfNecessary(); return target; }

Target:
private String confirmTarget(IProgressMonitor monitor) { if (target == null) { return null; } Optional<Repository> invalidRepo = Stream.of(repositories) .filter(r -> !r.getRepositoryState().canCheckout()) .findFirst(); if (invalidRepo.isPresent()) { PlatformUI.getWorkbench().getDisplay() .asyncExec(() -> showRepositoryInInvalidStateForCheckout( invalidRepo.get())); return null; } Collection<Repository> repos = Arrays.asList(repositories); if (LaunchFinder.shouldCancelBecauseOfRunningLaunches(repos, monitor)) { return null; } askForTargetIfNecessary(); return target; }
Source:
public void consumeWork() { long workConsumed = m_workConsumed.incrementAndGet(); if (m_doneProducing && m_workProduced == workConsumed) { synchronized (this) { notify(); } } }

Target:
public void consumeWork() { m_workConsumed.increment(); }
Source:
protected void doExecute(Task task, BulkRequest bulkRequest, ActionListener<BulkResponse> listener) { long indexingBytes = DocWriteRequest.writeSizeInBytes(bulkRequest.requests.stream()); final Releasable releasable = writeMemoryLimits.markCoordinatingOperationStarted(indexingBytes); final ActionListener<BulkResponse> releasingListener = ActionListener.runAfter(listener, releasable::close); threadPool.executor(ThreadPool.Names.WRITE).execute(new ActionRunnable<>(releasingListener) { @Override protected void doRun() { doDispatchedExecute(task, bulkRequest, releasingListener); } }); }

Target:
protected void doExecute(Task task, BulkRequest bulkRequest, ActionListener<BulkResponse> listener) { long indexingBytes = DocWriteRequest.writeSizeInBytes(bulkRequest.requests.stream()); final Releasable releasable = writeMemoryLimits.markCoordinatingOperationStarted(indexingBytes); final ActionListener<BulkResponse> releasingListener = ActionListener.runBefore(listener, releasable::close); try { doInternalExecute(task, bulkRequest, releasingListener); } catch (Exception e) { releasingListener.onFailure(e); } }
Source:
public void verify() { for (int k = 0; k < maxAccounts; k++) { ILock lock = targetInstance.getLock(basename + k); assertFalse(basename + ": Lock should be unlocked", lock.isLocked()); } long totalValue = 0; IList<Long> accounts = targetInstance.getList(basename); for (long value : accounts) { totalValue += value; } log.info(basename + ": totalValue=" + totalValue); assertEquals(basename+" totalInitalValue != totalValue ", totalInitalValue, totalValue); long totalExceptions=0; IList<Long> exceptionCount = targetInstance.getList(basename+"exceptions"); for (long count : exceptionCount) { totalExceptions += count; } log.info(basename + ": total exceptions " + totalExceptions); }

Target:
public void verify() { for (int k = 0; k < maxAccounts; k++) { ILock lock = targetInstance.getLock(basename + k); assertFalse(id + " Lock should be unlocked", lock.isLocked()); } long totalValue = 0; IList<Long> accounts = targetInstance.getList(basename); for (long value : accounts) { totalValue += value; } log.info(": totalValue=" + totalValue); assertEquals(id + " totalInitalValue != totalValue ", totalInitalValue, totalValue); Counter total = new Counter(); IList<Counter> totals = targetInstance.getList(basename+"count"); for (Counter count : totals) { total.add(count); } log.info(" total count " + total); }
Source:
private void getBuilderFromJsonAttribute( String nodeName, JsonNode node, JsonBuilder currentBuilder) { String strNode = node.asText(); String filter = null; if (strNode.contains(FILTERKEY)) { String[] arrNode = strNode.split(","); strNode = arrNode[1]; filter = arrNode[0]; filter = filter.replace("$filter{", "").replace("}", ""); } if (node.toString().contains(EXPRSTART) && !node.asText().equals("FeatureCollection")) { DynamicValueBuilder dynamicBuilder = new DynamicValueBuilder(nodeName, strNode, namespaces); if (filter != null) { setFilterToBuilder(dynamicBuilder, filter); } currentBuilder.addChild(dynamicBuilder); } else { StaticBuilder staticBuilder; if (filter != null) { staticBuilder = new StaticBuilder(nodeName, strNode, namespaces); setFilterToBuilder(staticBuilder, filter); } else { staticBuilder = new StaticBuilder(nodeName, node, namespaces); } currentBuilder.addChild(staticBuilder); } }

Target:
private void getBuilderFromJsonAttribute( String nodeName, JsonNode node, JsonBuilder currentBuilder) { String strNode = node.asText(); String filter = null; if (strNode.contains(FILTERKEY)) { strNode = strNode.replace(FILTERKEY + "{", ""); int sepIndex = strNode.indexOf('}') + 1; String sep = String.valueOf(strNode.charAt(sepIndex)); String[] arrNode = strNode.split(sep); strNode = arrNode[1]; filter = arrNode[0]; filter = filter.substring(0, filter.length() - 1); } if (node.toString().contains(EXPRSTART) && !node.asText().equals("FeatureCollection")) { DynamicValueBuilder dynamicBuilder = new DynamicValueBuilder(nodeName, strNode, namespaces); if (filter != null) { setFilterToBuilder(dynamicBuilder, filter); } currentBuilder.addChild(dynamicBuilder); } else { StaticBuilder staticBuilder; if (filter != null) { staticBuilder = new StaticBuilder(nodeName, strNode, namespaces); setFilterToBuilder(staticBuilder, filter); } else { staticBuilder = new StaticBuilder(nodeName, node, namespaces); } currentBuilder.addChild(staticBuilder); } }
Source:
public boolean evaluate( String ip, String xForwardedFor, String uriHost, String uriPath, String httpStatus ) { LegacyPageview legacy_pageview_inst = LegacyPageview.getInstance(); return legacy_pageview_inst.isLegacyPageview( ip, xForwardedFor, uriHost, uriPath, httpStatus ); }

Target:
public boolean evaluate( String ip, String xForwardedFor, String uriHost, String uriPath, String httpStatus ) { LegacyPageviewDefinition legacyPageviewDefinitionInstance = LegacyPageviewDefinition.getInstance(); return legacyPageviewDefinitionInstance.isLegacyPageview( ip, xForwardedFor, uriHost, uriPath, httpStatus ); }
Source:
public static boolean isSupported(AST ast, int nodeType) { switch (nodeType) { case ASTNode.SWITCH_EXPRESSION: case ASTNode.YIELD_STATEMENT: if (ast.apiLevel() < AST.JLS14_INTERNAL) { return false; } break; case ASTNode.TEXT_BLOCK: return ast.isPreviewEnabled(); } return true; }

Target:
public static boolean isSupported(AST ast, int nodeType) { switch (nodeType) { case ASTNode.SWITCH_EXPRESSION: case ASTNode.YIELD_STATEMENT: return ast.apiLevel() >= AST.JLS14_INTERNAL; case ASTNode.TEXT_BLOCK: return ast.isPreviewEnabled(); } return true; }
Source:
private void populate(List<EngineSetting> engineSettings) { final VBox displayPane = new VBox(); final Text title = new TextWithStyle(tr("Display settings"), TITLE_CSS_CLASS); displayPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS); displayPane.getChildren().add(title); final GridPane displayContentPane = new GridPane(); displayContentPane.getStyleClass().add("grid"); int row = 0; for (EngineSetting setting : engineSettings) { final ComboBox<String> comboBox = new ComboBox<>(); comboBox.setMaxWidth(Double.MAX_VALUE); comboBox.setValue(setting.getCurrentOption()); comboBox.valueProperty().addListener((observable, oldValue, newValue) -> Platform.runLater(() -> { setting.setOption(this.container.getName(), newValue); this.unlockAll(); })); ObservableList<String> items = FXCollections.observableArrayList(setting.getOptions()); comboBox.setItems(items); displayContentPane.add(new TextWithStyle(setting.getText(), CAPTION_TITLE_CSS_CLASS), 0, 0); displayContentPane.add(comboBox, 1, row); lockableElements.add(comboBox); ++row; } Region spacer = new Region(); GridPane.setHgrow(spacer, Priority.ALWAYS); displayContentPane.add(spacer, 2, 0); displayPane.getChildren().addAll(displayContentPane); this.setContent(displayPane); }

Target:
private void populate(List<EngineSetting> engineSettings) { final VBox displayPane = new VBox(); displayPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS); final GridPane displayContentPane = new GridPane(); displayContentPane.getStyleClass().add("grid"); int row = 0; for (EngineSetting setting : engineSettings) { final ComboBox<String> comboBox = new ComboBox<>(); comboBox.setMaxWidth(Double.MAX_VALUE); ObservableList<String> items = FXCollections.observableArrayList(setting.getOptions()); comboBox.setItems(items); comboBox.setValue(setting.getCurrentOption(this.container.getName())); comboBox.valueProperty().addListener((observable, oldValue, newValue) -> Platform.runLater(() -> { this.lockAll(); setting.setOption(this.container.getName(), items.indexOf(newValue)); this.unlockAll(); })); displayContentPane.add(new TextWithStyle(setting.getText(), CAPTION_TITLE_CSS_CLASS), 0, row); displayContentPane.add(comboBox, 1, row); lockableElements.add(comboBox); ++row; } Region spacer = new Region(); GridPane.setHgrow(spacer, Priority.ALWAYS); displayContentPane.add(spacer, 2, 0); displayPane.getChildren().addAll(displayContentPane); this.setContent(displayPane); }
Source:
public GoogleCloudStorageItemInfo getItemInfo(StorageResourceId resourceId) throws IOException { GoogleCloudStorageItemInfo item = cache.getItem(resourceId); if (item == null && resourceId.isStorageObject() && !resourceId.isDirectory() && cache.getItem(resourceId.toDirectoryId()) != null) { return GoogleCloudStorageItemInfo.createNotFound(resourceId); } if (item == null && resourceId.isStorageObject()) { String bucketName = resourceId.getBucketName(); String objectName = resourceId.getObjectName(); int lastDelimiterIndex = objectName.lastIndexOf(PATH_DELIMITER); String directoryName = lastDelimiterIndex >= 0 ? objectName.substring(0, lastDelimiterIndex + 1) : null; if (!cache.isPrefixCached( directoryName == null ? new StorageResourceId(bucketName) : new StorageResourceId(bucketName, directoryName))) { listObjectInfoPage( bucketName, directoryName, ListObjectOptions.DEFAULT, null); item = cache.getItem(resourceId); if (item == null && !resourceId.isDirectory() && cache.getItem(resourceId.toDirectoryId()) != null) { return GoogleCloudStorageItemInfo.createNotFound(resourceId); } } } if (item == null) { item = super.getItemInfo(resourceId); cache.putItem(item); } return item; }

Target:
public GoogleCloudStorageItemInfo getItemInfo(StorageResourceId resourceId) throws IOException { GoogleCloudStorageItemInfo item = cache.getItem(resourceId); if (item == null && resourceId.isStorageObject() && !resourceId.isDirectory() && cache.getItem(resourceId.toDirectoryId()) != null) { return GoogleCloudStorageItemInfo.createNotFound(resourceId); } if (item == null && resourceId.isStorageObject()) { String bucketName = resourceId.getBucketName(); String objectName = resourceId.getObjectName(); int lastDelimiterIndex = objectName.lastIndexOf(PATH_DELIMITER); String directoryName = lastDelimiterIndex >= 0 ? objectName.substring(0, lastDelimiterIndex + 1) : null; if (!cache.isPrefixCached( directoryName == null ? new StorageResourceId(bucketName) : new StorageResourceId(bucketName, directoryName))) { listObjectInfoPage( bucketName, directoryName, ListObjectOptions.DEFAULT, null); item = cache.getItem(resourceId); } } if (item == null && !resourceId.isDirectory() && cache.getItem(resourceId.toDirectoryId()) != null) { return GoogleCloudStorageItemInfo.createNotFound(resourceId); } if (item == null) { item = super.getItemInfo(resourceId); cache.putItem(item); } return item; }
Source:
public InputStream lookupFileStrict(URI uri, ClassLoader cl) throws FileNotFoundException { String scheme = uri.getScheme(); switch (scheme) { case "jar": case "file": String uriAsString = uri.toString(); String fileName = uriAsString.substring(uriAsString.lastIndexOf(":") + 1); return new FileInputStream(new File(fileName)); default: InputStream streamToBeReturned = getAsInputStreamFromClassLoader(uri.toString(), cl); if(streamToBeReturned == null) { throw log.unableToLoadFileUsingScheme(scheme); } return streamToBeReturned; } }

Target:
public InputStream lookupFileStrict(URI uri, ClassLoader cl) throws FileNotFoundException { String scheme = uri.getScheme(); switch (scheme) { case "file": return new FileInputStream(new File(uri.getPath())); case "jar": String uriAsString = uri.toString(); String fileName = uriAsString.substring(uriAsString.lastIndexOf(":") + 1); return new FileInputStream(new File(fileName)); default: InputStream streamToBeReturned = getAsInputStreamFromClassLoader(uri.toString(), cl); if(streamToBeReturned == null) { throw log.unableToLoadFileUsingScheme(scheme); } return streamToBeReturned; } }
Source:
public boolean isPublisherTraceEnabled(String eventPublisherName) { EventPublisherService eventPublisherService = EventPublisherAdminServiceValueHolder.getEventPublisherService(); List<EventPublisherConfiguration> eventPublisherConfigurationList = null; boolean isTraceEnabled = true; try { eventPublisherConfigurationList = eventPublisherService.getAllActiveEventPublisherConfigurations(); Iterator eventReceiverConfigurationIterator = eventPublisherConfigurationList.iterator(); while (eventReceiverConfigurationIterator.hasNext()) { EventPublisherConfiguration eventPublisherConfiguration = (EventPublisherConfiguration) eventReceiverConfigurationIterator.next(); if (eventPublisherConfiguration.getEventPublisherName().equalsIgnoreCase(eventPublisherName)) { isTraceEnabled = eventPublisherConfiguration.isTracingEnabled(); } } } catch (EventPublisherConfigurationException e) { log.error(e.getMessage(), e); } return isTraceEnabled; }

Target:
public boolean isPublisherTraceEnabled(String eventPublisherName) { EventPublisherService eventPublisherService = EventPublisherAdminServiceValueHolder.getEventPublisherService(); List<EventPublisherConfiguration> eventPublisherConfigurationList = null; boolean isTraceEnabled = false; try { eventPublisherConfigurationList = eventPublisherService.getAllActiveEventPublisherConfigurations(); Iterator eventReceiverConfigurationIterator = eventPublisherConfigurationList.iterator(); while (eventReceiverConfigurationIterator.hasNext()) { EventPublisherConfiguration eventPublisherConfiguration = (EventPublisherConfiguration) eventReceiverConfigurationIterator.next(); if (eventPublisherConfiguration.getEventPublisherName().equalsIgnoreCase(eventPublisherName)) { isTraceEnabled = eventPublisherConfiguration.isTracingEnabled(); } } } catch (EventPublisherConfigurationException e) { log.error(e.getMessage(), e); } return isTraceEnabled; }
Source:
public @NonNull String getName() { return "Event Context"; }

Target:
public @NonNull String getName() { return Messages.getMessage(Messages.CtfEventContextAspect_name); }
Source:
private void updateAssignment() { this.acknowlegmentHandler.addPartitions(kafkaConsumer.assignment()); for (TopicPartition partition : kafkaConsumer.assignment()) { this.flowControl.merge(partition, new AtomicInteger(), (oldValue, newValue) -> oldValue == null ? newValue : oldValue); } }

Target:
private void updateAssignment() { acknowledgmentHandler.addPartitions(kafkaConsumer.assignment()); for (TopicPartition partition : kafkaConsumer.assignment()) { this.flowControl.merge(partition, new AtomicInteger(), (oldValue, newValue) -> oldValue == null ? newValue : oldValue); } }
Source:
public Media getItemAtPosition(int i) { if (i == -1 || contributionList == null || contributionList.size() < i+1) { return null; } return contributionList.get(i); }

Target:
public Media getItemAtPosition(int i) { if (i == -1 || contributionList.size() < i+1) { return null; } return contributionList.get(i); }
Source:
public Stream<Arguments> provideArguments(ExtensionContext context) { Class<?> testClass = context.getRequiredTestClass(); Object testInstance = context.getTestInstance().orElse(null); return Arrays.stream(methodNames) .filter(Objects::nonNull) .map(methodName -> methodName.isEmpty() && context.getTestMethod().isPresent() ? context.getRequiredTestMethod().getName() : methodName) .map(methodName -> ReflectionUtils.findMethod(testClass, methodName) .orElseThrow(() -> new JUnitException("Could not find method on " + testClass + ": " + methodName))) .map(method -> ReflectionUtils.invokeMethod(method, testInstance)) .flatMap(CollectionUtils::toStream) .map(MethodArgumentsProvider::toArguments); }

Target:
public Stream<Arguments> provideArguments(ExtensionContext context) { Class<?> testClass = context.getRequiredTestClass(); Object testInstance = context.getTestInstance().orElse(null); return Arrays.stream(methodNames) .map(methodName -> methodName.isEmpty() && context.getTestMethod().isPresent() ? context.getRequiredTestMethod().getName() : methodName) .map(methodName -> ReflectionUtils.findMethod(testClass, methodName) .orElseThrow(() -> new JUnitException("Could not find method on " + testClass + ": " + methodName))) .map(method -> ReflectionUtils.invokeMethod(method, testInstance)) .flatMap(CollectionUtils::toStream) .map(MethodArgumentsProvider::toArguments); }
Source:
protected ReplayFile call() throws Exception { LOG.info("Uploading replay " + take); providers.forEach(provider -> { final StormParser parser = new StormParser(take.getFile()); Replay replay = null; Status preStatus; try { replay = parser.parseReplay(); preStatus = provider.getPreStatus(replay); } catch (MpqException e) { LOG.warn("Could not parse replay, deferring to upload." + take, e); preStatus = Status.EXCEPTION; } if (preStatus == Status.UPLOADED || preStatus == Status.UNSUPPORTED_GAME_MODE || preStatus == Status.EXCEPTION) { LOG.info("Parsed preStatus reported no need to upload " + take.getFile() + " for provider " + provider.getName()); applyStatus(provider, preStatus); } else { final Status upload = provider.upload(take); if (upload == null) { throw new RuntimeException("Failed"); } applyStatus(provider, upload); } succeeded(); }); return take; }

Target:
protected ReplayFile call() throws Exception { LOG.info("Uploading replay " + take); providers.forEach(provider -> { final StormParser parser = new StormParser(take.getFile()); Replay replay = null; Status preStatus; try { replay = parser.parseReplay(); preStatus = provider.getPreStatus(replay); } catch (MpqException e) { LOG.warn("Could not parse replay, deferring to upload." + take, e); preStatus = Status.EXCEPTION; } if (preStatus == Status.UPLOADED || preStatus == Status.UNSUPPORTED_GAME_MODE) { LOG.info("Parsed preStatus reported no need to upload " + take.getFile() + " for provider " + provider.getName()); applyStatus(provider, preStatus); } else { final Status upload = provider.upload(take); if (upload == null) { throw new RuntimeException("Failed"); } applyStatus(provider, upload); } succeeded(); }); return take; }
Source:
public ResultScanner getScanner(final Scan scan) throws IOException { if (scan.getStartRow() != null && scan.getStartRow().length > 0 && scan.getStopRow() != null && scan.getStopRow().length > 0 && Bytes.compareTo(scan.getStartRow(), scan.getStopRow()) > 0) { throw new IOException("StopRow needs to be greater than StartRow"); } final SettableFuture<Long> future = SettableFuture.create(); final RegionSpecifier regionSpecifier = new RegionSpecifier(RegionSpecifier.RegionSpecifierType.REGION_NAME, getRegion(scan.getStartRow())); final ScanRequest scanRequest = new ScanRequest(regionSpecifier, ProtobufUtil.toScan(scan), 0L, C5Constants.DEFAULT_INIT_SCAN, false, 0L); try { handler.call(ProtobufUtil.getScanCall(commandId.incrementAndGet(), scanRequest), future, channel); final Long scannerId = future.get(C5Constants.TIMEOUT, TimeUnit.MILLISECONDS); return clientScannerManager.get(scannerId); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new IOException(e); } }

Target:
public ResultScanner getScanner(final Scan scan) throws IOException { if (scan.getStartRow() != null && scan.getStartRow().length > 0 && scan.getStopRow() != null && scan.getStopRow().length > 0 && Bytes.compareTo(scan.getStartRow(), scan.getStopRow()) > 0) { throw new IOException("StopRow needs to be greater than StartRow"); } final SettableFuture<Long> future = SettableFuture.create(); final RegionSpecifier regionSpecifier = new RegionSpecifier(RegionSpecifier.RegionSpecifierType.REGION_NAME, getRegion(scan.getStartRow())); final ScanRequest scanRequest = new ScanRequest(regionSpecifier, ProtobufUtil.toScan(scan), 0L, C5Constants.DEFAULT_INIT_SCAN, false, 0L); try { handler.callScan(ProtobufUtil.getScanCall(commandId.incrementAndGet(), scanRequest), future, channel); final long scannerId = future.get(C5Constants.TIMEOUT, TimeUnit.MILLISECONDS); return clientScannerManager.get(scannerId); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new IOException(e); } }
Source:
private void atomicWriteToFile(String content, File file) throws IOException { File directory = file.getParentFile(); File tempFile = File.createTempFile(file.getName(), null, directory); FileOutputStream out = new FileOutputStream(tempFile); try { IOUtils.write(content, out); } catch (IOException iox) { if (out != null) out.close(); tempFile.delete(); throw iox; } out.close(); FileSystem defaultFileSystem = FileSystems.getDefault(); Path tempFilePath = defaultFileSystem.getPath(tempFile.getCanonicalPath()); Path destinationFilePath = defaultFileSystem.getPath(file.getCanonicalPath()); try { Files.move(tempFilePath, destinationFilePath, StandardCopyOption.ATOMIC_MOVE); } catch (IOException iox) { tempFile.delete(); throw iox; } }

Target:
private void atomicWriteToFile(String content, File file) throws IOException { File directory = file.getParentFile(); File tempFile = File.createTempFile(file.getName(), null, directory); FileOutputStream out = new FileOutputStream(tempFile); try { IOUtils.write(content, out); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } out.close(); FileSystem defaultFileSystem = FileSystems.getDefault(); Path tempFilePath = defaultFileSystem.getPath(tempFile.getCanonicalPath()); Path destinationFilePath = defaultFileSystem.getPath(file.getCanonicalPath()); try { Files.move(tempFilePath, destinationFilePath, StandardCopyOption.ATOMIC_MOVE); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } }
Source:
public BlockFormEvent callEvent(@Nonnull Block block) { BlockState state = PaperLib.getBlockState(block, false).getState(); BlockFormEvent event = new BlockFormEvent(block, state); Bukkit.getPluginManager().callEvent(event); return event; }

Target:
public BlockFormEvent callEvent(@Nonnull Block block) { Validate.notNull(block, "The Block cannot be null!"); BlockState state = PaperLib.getBlockState(block, false).getState(); BlockFormEvent event = new BlockFormEvent(block, state); Bukkit.getPluginManager().callEvent(event); return event; }
Source:
public static void testAvgDur1(APMLog apmLog, APMLogUnitTest parent) throws UnsupportedEncodingException { APMLogFilter apmLogFilter = new APMLogFilter(apmLog); PLog pLog = apmLogFilter.getPLog(); pLog.updateStats(); DurSubGraph subGraph = pLog.getAttributeGraph().getNextValueDurations("concept:name", "A"); DoubleArrayList durList = subGraph.getValDurListMap().get("A"); double avg = getAverage(durList); double twoHours = 1000 * 60 * 60 * 2d; if (avg != twoHours) { throw new AssertionError("TEST FAILED. RESULT MISMATCH.\n expected value=" + twoHours + "; output value=" + avg); } else { parent.printString("'Attribute arc duration (4) - Average duration' test PASS.\n"); } }

Target:
public static void testAvgDur1(APMLog apmLog, APMLogUnitTest parent) throws UnsupportedEncodingException { APMLogFilter apmLogFilter = new APMLogFilter(apmLog); PLog pLog = apmLogFilter.getPLog(); pLog.updateStats(); DurSubGraph subGraph = pLog.getAttributeGraph().getNextValueDurations("concept:name", "A"); DoubleArrayList durList = subGraph.getValDurListMap().get("A"); assertEquals(1000 * 60 * 60 * 2d, durList.average(), 0 ); }
Source:
public ValueType typeCheck(TypeContext ctx) { if (settingDynamicObject(ctx)) return Util.dynType(); StructuralType varTypeStructural = objectExpr.typeCheck(ctx).getStructuralType(ctx); ValueType varTypeExpr = exprToAssign.typeCheck(ctx); DeclType declTypeField = varTypeStructural.findDecl(fieldName, ctx); if (declTypeField == null) ToolError.reportError(ErrorMessage.NO_SUCH_FIELD, this, fieldName); if (!(declTypeField instanceof VarDeclType)) ToolError.reportError(ErrorMessage.CANNOT_BE_ASSIGNED, this, declTypeField.getName()); ValueType valTypeField = ((VarDeclType) declTypeField).getResultType(View.from(objectExpr, ctx)); if (!varTypeExpr.isSubtypeOf(valTypeField, ctx)) ToolError.reportError(ErrorMessage.ASSIGNMENT_SUBTYPING, this); return Util.unitType(); }

Target:
public ValueType typeCheck(TypeContext ctx) { if (settingDynamicObject(ctx)) { exprToAssign.typeCheck(ctx); return Util.dynType(); } StructuralType varTypeStructural = objectExpr.typeCheck(ctx).getStructuralType(ctx); ValueType varTypeExpr = exprToAssign.typeCheck(ctx); DeclType declTypeField = varTypeStructural.findDecl(fieldName, ctx); if (declTypeField == null) ToolError.reportError(ErrorMessage.NO_SUCH_FIELD, this, fieldName); if (!(declTypeField instanceof VarDeclType)) ToolError.reportError(ErrorMessage.CANNOT_BE_ASSIGNED, this, declTypeField.getName()); ValueType valTypeField = ((VarDeclType) declTypeField).getResultType(View.from(objectExpr, ctx)); if (!varTypeExpr.isSubtypeOf(valTypeField, ctx)) ToolError.reportError(ErrorMessage.ASSIGNMENT_SUBTYPING, this); return Util.unitType(); }