auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void saveForm_whenReasonRequiredToSave_returnsSaveResult_inChangeReasonRequiredState() { whenReasonRequiredToSave(); viewModel.saveForm(Uri.parse("file://form"), true, "", false); LiveData<FormSaveViewModel.SaveResult> saveResult = viewModel.getSavedResult(); assertThat(saveResult.getValue().getState(), equalTo(CHANGE_REASON_REQUIRED)); }

Target:
public void saveForm_whenReasonRequiredToSave_returnsSaveResult_inChangeReasonRequiredState() { whenReasonRequiredToSave(); LiveData<FormSaveViewModel.SaveResult> saveResult = viewModel.getSavedResult(); viewModel.saveForm(Uri.parse("file://form"), true, "", false); assertThat(saveResult.getValue().getState(), equalTo(CHANGE_REASON_REQUIRED)); }
Source:
public EObject getStereotypeApplication(final View view, Stereotype stereo) { EObject appliedStereo = null; if (isInStereotypeComment((Node) view)) { if (getCommentSemanticElement(getTopContainer(view)) != null) { appliedStereo = getCommentSemanticElement(getTopContainer(view)).getStereotypeApplication(stereo); } } if (getContainerSemanticElement(view) != null) { appliedStereo = getContainerSemanticElement(view).getStereotypeApplication(stereo); } return appliedStereo; }

Target:
public EObject getStereotypeApplication(final View view, Stereotype stereo) { EObject appliedStereotypes = null; if (isInStereotypeComment((Node) view)) { if (getCommentSemanticElement(getTopContainer(view)) != null) { appliedStereotypes = getCommentSemanticElement(getTopContainer(view)).getStereotypeApplication(stereo); } } if (getContainerSemanticElement(view) != null) { appliedStereotypes = getContainerSemanticElement(view).getStereotypeApplication(stereo); } return appliedStereotypes; }
Source:
public Monetary parse(String str) throws NumberFormatException { return Coin.valueOf(parseValue(str)); }

Target:
public Coin parse(String str) throws NumberFormatException { return Coin.valueOf(parseValue(str, Coin.SMALLEST_UNIT_EXPONENT)); }
Source:
private IEntityGroup findGroupByName(String groupName) { EntityIdentifier[] identifiers = GroupService.searchForGroups(groupName, GroupService.IS, EntityEnum.GROUP.getClazz()); logger.debug("Found indentifier(s) for group name {}", identifiers.length, groupName); for (EntityIdentifier entityIdentifier : identifiers) { logger.debug(entityIdentifier.toString()); if (entityIdentifier.getType().equals(IEntityGroup.class)) { return GroupService.findGroup(entityIdentifier.getKey()); } } return null; }

Target:
private static IEntityGroup findGroupByName(String groupName) { EntityIdentifier[] identifiers = GroupService.searchForGroups(groupName, GroupService.IS, IPerson.class); for (EntityIdentifier entityIdentifier : identifiers) { if (entityIdentifier.getType().equals(IEntityGroup.class)) { return GroupService.findGroup(entityIdentifier.getKey()); } } return null; }
Source:
private void registerUser(String email) { Data myData = new Data.Builder() .putString(TravelBehaviorConstants.USER_EMAIL, email) .build(); Constraints constraints = new Constraints.Builder() .setRequiredNetworkType(NetworkType.CONNECTED) .build(); OneTimeWorkRequest workRequest = new OneTimeWorkRequest. Builder(RegisterTravelBehaviorParticipantWorker.class) .setInputData(myData) .setConstraints(constraints) .build(); WorkManager workManager = WorkManager.getInstance(); workManager.enqueue(workRequest); ListenableFuture<WorkInfo> listenableFuture = workManager. getWorkInfoById(workRequest.getId()); Futures.addCallback(listenableFuture, new FutureCallback<WorkInfo>() { @Override public void onSuccess(@NullableDecl WorkInfo result) { startCollectingData(); Activity activity = (Activity) mActivityContext; activity.runOnUiThread(() -> Toast.makeText(mApplicationContext, R.string.travel_behavior_enroll_success, Toast.LENGTH_LONG).show()); } @Override public void onFailure(Throwable t) { Activity activity = (Activity) mActivityContext; activity.runOnUiThread(() -> Toast.makeText(mApplicationContext, R.string.travel_behavior_enroll_fail, Toast.LENGTH_LONG).show()); } }, TravelBehaviorFileSaverExecutorManager.getInstance().getThreadPoolExecutor()); }

Target:
private void registerUser(String email) { Data myData = new Data.Builder() .putString(TravelBehaviorConstants.USER_EMAIL, email) .build(); Constraints constraints = new Constraints.Builder() .setRequiredNetworkType(NetworkType.CONNECTED) .build(); OneTimeWorkRequest workRequest = new OneTimeWorkRequest. Builder(RegisterTravelBehaviorParticipantWorker.class) .setInputData(myData) .setConstraints(constraints) .build(); WorkManager workManager = WorkManager.getInstance(); workManager.enqueue(workRequest); ListenableFuture<WorkInfo> listenableFuture = workManager. getWorkInfoById(workRequest.getId()); Futures.addCallback(listenableFuture, new FutureCallback<WorkInfo>() { @Override public void onSuccess(@NullableDecl WorkInfo result) { Activity activity = (Activity) mActivityContext; activity.runOnUiThread(() -> Toast.makeText(mApplicationContext, R.string.travel_behavior_enroll_success, Toast.LENGTH_LONG).show()); } @Override public void onFailure(Throwable t) { Activity activity = (Activity) mActivityContext; activity.runOnUiThread(() -> Toast.makeText(mApplicationContext, R.string.travel_behavior_enroll_fail, Toast.LENGTH_LONG).show()); } }, TravelBehaviorFileSaverExecutorManager.getInstance().getThreadPoolExecutor()); }
Source:
public void setClaimedJobId(@NotBlank final String jobId) { setIfNullOrTrow(jobId, claimedJobIdRef); }

Target:
public void setClaimedJobId(@NotBlank final String jobId) { setIfNullOrThrow(jobId, claimedJobIdRef); }
Source:
public static boolean isVerificationSuccessful(String captchaResponse) { if (captchaResponse == null || captchaResponse.isEmpty()) { return false; } try { URIBuilder urlb = new URIBuilder(VERIFY_URL); urlb.setParameter("secret", SECRET_KEY); urlb.setParameter("response", captchaResponse); HttpPost post = new HttpPost(urlb.build()); try (CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpResponse resp = client.execute(post); BufferedReader br = new BufferedReader(new InputStreamReader(resp.getEntity().getContent()))) { String output = br.lines().collect(Collectors.joining(System.lineSeparator())); if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { log.info("reCAPTCHA verification request successful:" + System.lineSeparator() + output); JsonObject jsonObject = JsonUtils.parse(output).getAsJsonObject(); if (jsonObject.has("error-codes")) { JsonArray errorCodes = jsonObject.get("error-codes").getAsJsonArray(); log.warning("Error codes during reCAPTCHA verification: " + errorCodes.toString()); } return Boolean.parseBoolean(jsonObject.get("success").toString()); } else { log.severe("reCAPTCHA verification request failure:" + System.lineSeparator() + output); return false; } } catch (IOException e) { log.severe("reCAPTCHA verification request failure: " + e.getMessage()); return false; } } catch (URISyntaxException e) { log.severe("reCAPTCHA verification request failure: " + e.getMessage()); return false; } }

Target:
public boolean isVerificationSuccessful(String captchaResponse) { return isVerificationSuccessful(captchaResponse, SECRET_KEY); }
Source:
public DistributionSnapshot getRuntimeSnapshot() { if (isSiteMode()) { throw new RuntimeException("Live runtime cannot be snapshotted."); } if (runtimeSnapshot == null) { synchronized (this) { if (runtimeSnapshot == null) { runtimeSnapshot = RuntimeSnapshot.build(); } } } return runtimeSnapshot; }

Target:
public DistributionSnapshot getRuntimeSnapshot() { if (isSiteMode()) { throw new RuntimeServiceException("Live runtime cannot be snapshotted."); } if (runtimeSnapshot == null) { synchronized (this) { if (runtimeSnapshot == null) { runtimeSnapshot = RuntimeSnapshot.build(); } } } return runtimeSnapshot; }
Source:
public void stop() { if (engine != null) { engine.shutdown(); } }

Target:
public synchronized void stop() { if (engine != null) { engine.shutdown(); engine = null; } }
Source:
public static XmlDataProviderManager getInstance() { if (INSTANCE == null) { INSTANCE = new XmlDataProviderManager(); } return INSTANCE; }

Target:
public static synchronized XmlDataProviderManager getInstance() { if (INSTANCE == null) { INSTANCE = new XmlDataProviderManager(); } return INSTANCE; }
Source:
public static Pattern generateNickHighlightPattern(final String nick) { return Pattern.compile("(?<=(^|\\s))" + Pattern.quote(nick) + "\\b", Pattern.UNICODE_CASE); }

Target:
public static Pattern generateNickHighlightPattern(final String nick) { return Pattern.compile("(?<=(^|\\s))" + Pattern.quote(nick) + "\\b"); }
Source:
public double getLogProb(double value) { return Math.log(getProb(value)); }

Target:
public double getLogProb(double value) { checkHasParams(); if (value < 0) { return Double.NEGATIVE_INFINITY; } else { return logLambda - lambda * value + (k - 1) * Math.log(lambda * value) - logGammaK; } }
Source:
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { is.defaultReadObject(); this.internalParameters = new HashMap<>(); }

Target:
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { is.defaultReadObject(); this.internalParameters = new HashMap<>(INTERNAL_PARAMETERS_INITIAL_CAPACITY); }
Source:
public static String getCheckerWorkflowPath(DockstoreWebserviceConfiguration config, Entry entry) { if (entry.getCheckerWorkflow() == null) { return null; } else { String newID = "#workflow/" + entry.getCheckerWorkflow().getWorkflowPath(); return getUrlFromId(config, newID); } }

Target:
private static String getCheckerWorkflowPath(DockstoreWebserviceConfiguration config, Entry entry) { if (entry.getCheckerWorkflow() == null) { return null; } else { String newID = "#workflow/" + entry.getCheckerWorkflow().getWorkflowPath(); return getUrlFromId(config, newID); } }
Source:
private void createSubscriptionLocked() { if (getZk().createSubscription()) { final Map<Partition.PartitionKey, String> cursors = getKafka().getSubscriptionOffsets().entrySet() .stream().collect( Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().getOffset() ) ); getZk().fillEmptySubscription(cursors); } else { final Session[] sessions = getZk().listSessions(); final Partition[] partitions = getZk().listPartitions(); if (sessions.length >= partitions.length) { switchState(new CleanupState(new NoStreamingSlotsAvailable(partitions.length))); return; } } if (getZk().isCursorResetInProgress()) { switchState(new CleanupState( new NakadiException("Resetting subscription cursors request still in the progress") { @Override protected Response.StatusType getStatus() { return Response.Status.CONFLICT; } })); return; } registerSession(); try { getOut().onInitialized(getSessionId()); switchState(new StreamingState()); } catch (final IOException e) { getLog().error("Failed to notify of initialization. Switch to cleanup directly", e); switchState(new CleanupState(e)); } }

Target:
private void createSubscriptionLocked() { if (getZk().createSubscription()) { final Map<Partition.PartitionKey, String> cursors = getKafka().getSubscriptionOffsets().entrySet() .stream().collect( Collectors.toMap( Map.Entry::getKey, entry -> entry.getValue().getOffset() ) ); getZk().fillEmptySubscription(cursors); } else { final Session[] sessions = getZk().listSessions(); final Partition[] partitions = getZk().listPartitions(); if (sessions.length >= partitions.length) { switchState(new CleanupState(new NoStreamingSlotsAvailable(partitions.length))); return; } } if (getZk().isCursorResetInProgress()) { switchState(new CleanupState( new NakadiException("Resetting subscription cursors request is still in progress") { @Override protected Response.StatusType getStatus() { return Response.Status.CONFLICT; } })); return; } registerSession(); try { getOut().onInitialized(getSessionId()); switchState(new StreamingState()); } catch (final IOException e) { getLog().error("Failed to notify of initialization. Switch to cleanup directly", e); switchState(new CleanupState(e)); } }
Source:
private Object getHiveTableProperty(String tableName, Function<HiveTableLayoutHandle, Object> propertyGetter) { Session session = getSession(); Metadata metadata = ((DistributedQueryRunner) getQueryRunner()).getCoordinator().getMetadata(); return transaction(getQueryRunner().getTransactionManager(), getQueryRunner().getAccessControl()) .readOnly() .execute(session, transactionSession -> { Optional<TableHandle> tableHandle = metadata.getTableHandle(transactionSession, new QualifiedObjectName(catalog, TPCH_SCHEMA, tableName)); assertTrue(tableHandle.isPresent()); TableLayout layout = metadata.getLayout(transactionSession, tableHandle.get(), Constraint.alwaysTrue(), Optional.empty()) .get() .getLayout(); return propertyGetter.apply((HiveTableLayoutHandle) layout.getHandle().getConnectorHandle()); }); }

Target:
private Object getHiveTableProperty(String tableName, Function<HiveTableLayoutHandle, Object> propertyGetter) { Session session = getSession(); Metadata metadata = ((DistributedQueryRunner) getQueryRunner()).getCoordinator().getMetadata(); return transaction(getQueryRunner().getTransactionManager(), getQueryRunner().getAccessControl()) .readOnly() .execute(session, transactionSession -> { Optional<TableHandle> tableHandle = metadata.getTableHandle(transactionSession, new QualifiedObjectName(catalog, TPCH_SCHEMA, tableName)); assertTrue(tableHandle.isPresent()); TableLayout layout = metadata.getLayout(transactionSession, tableHandle.get(), Constraint.alwaysTrue(), Optional.empty()) .getLayout(); return propertyGetter.apply((HiveTableLayoutHandle) layout.getNewTableHandle().getLayout().get()); }); }
Source:
public String param(String key) { WebService.Param definition = action.param(key); String value = defaultString(readParam(key, definition), definition.defaultValue()); Integer maximumLength = definition.maximumLength(); if (value != null && maximumLength != null) { int valueLength = value.length(); checkArgument(valueLength <= maximumLength, "'%s' length (%s) is longer than the maximum authorized (%s)", key, valueLength, maximumLength); } String trimmedValue = value == null ? null : CharMatcher.WHITESPACE.trimFrom(value); if (trimmedValue != null) { validateValue(trimmedValue, definition); } return trimmedValue; }

Target:
public String param(String key) { WebService.Param definition = action.param(key); String valueOrDefault = defaultString(readParam(key, definition), definition.defaultValue()); String value = valueOrDefault == null ? null : CharMatcher.WHITESPACE.trimFrom(valueOrDefault); if (value == null) { return null; } validatePossibleValues(key, value, definition); validateMaximumLength(key, definition, valueOrDefault); validateMaximumValue(key, definition, value); return value; }
Source:
private void moveControl(MElementContainer<MUIElement> elementContainer, MUIElement element) { if (element == null || elementContainer == null) return; PositionInfo positionInfo = findMovePositionInfo(element); if (positionInfo != null) { List<MUIElement> elements = elementContainer.getChildren(); if (elements.remove(element)) { switch (positionInfo.getPosition()) { case LAST: elements.add(element); break; case FIRST: elements.add(0, element); break; case INDEX: int index = positionInfo.getPositionReferenceAsInteger(); if (index >= 0 && index < elements.size()) { elements.add(index, element); } else { elements.add(element); } break; case BEFORE: case AFTER: int idx = indexOfElementWithID(elements, positionInfo.getPositionReference()); if (idx < 0) { elements.add(element); } else { if (positionInfo.getPosition() == Position.AFTER) { idx++; } if (idx < elements.size()) { elements.add(idx, element); } else { elements.add(element); } } break; default: throw new IllegalArgumentException( "Unknown position: " + positionInfo.getPosition()); } } } }

Target:
private void moveControl(MElementContainer<MUIElement> elementContainer, MUIElement element) { if (element == null || elementContainer == null) return; PositionInfo positionInfo = findMovePositionInfo(element); if (positionInfo != null) { List<MUIElement> elements = elementContainer.getChildren(); if (elements.remove(element)) { switch (positionInfo.getPosition()) { case LAST: elements.add(element); break; case FIRST: elements.add(0, element); break; case INDEX: int index = positionInfo.getPositionReferenceAsInteger(); if (index >= 0 && index < elements.size()) { elements.add(index, element); } else { elements.add(element); } break; case BEFORE: case AFTER: int idx = indexOfElementWithID(elements, positionInfo.getPositionReference()); if (idx < 0) { elements.add(element); } else { if (positionInfo.getPosition() == Position.AFTER) { idx++; } if (idx < elements.size()) { elements.add(idx, element); } else { elements.add(element); } } break; default: WorkbenchPlugin.log("Can't position control '" + element.getElementId() + "' because of the unknown position type '" + positionInfo.getPosition() + "'!"); } } } }
Source:
toWorkspaceVolumes(CheContainer container) throws InfrastructureException { Map<String, VolumeImpl> result = new HashMap<>(); if (container.isMountSources()) { result.put(PROJECTS_VOLUME_NAME, new VolumeImpl().withPath(PROJECTS_MOUNT_PATH)); } for (Volume volume : container.getVolumes()) { if (volume.getName().equals(PROJECTS_VOLUME_NAME)) { throw new InfrastructureException( format( "Plugin '%s' tried to manually mount the projects volume into its container '%s'." + " This is illegal. Set the mountSources attribute to true instead. The mount" + " path of the sources will then be available automatically in the " + PROJECTS_MOUNT_PATH_ENV_VAR_NAME + " environment variable.", pluginName, container.getName())); } result.put(volume.getName(), new VolumeImpl().withPath(volume.getMountPath())); } return result; }

Target:
toWorkspaceVolumes(CheContainer container) throws InfrastructureException { Map<String, VolumeImpl> result = new HashMap<>(); if (container.isMountSources()) { result.put(PROJECTS_VOLUME_NAME, new VolumeImpl().withPath(projectsRootPathEnvVar.second)); } for (Volume volume : container.getVolumes()) { if (volume.getName().equals(PROJECTS_VOLUME_NAME) && !projectsRootPathEnvVar.second.equals(volume.getMountPath())) { throw new InfrastructureException( format( "Plugin '%s' tried to manually mount the '%s' volume into its container '%s' on" + " path '%s'. This is illegal because sources need to be mounted to '%s'. Set" + " the mountSources attribute to true instead and remove the manual volume" + " mount in the plugin. After that the mount path of the sources will be" + " available automatically in the '%s' environment variable.", pluginId, PROJECTS_VOLUME_NAME, container.getName(), volume.getMountPath(), projectsRootPathEnvVar.second, projectsRootPathEnvVar.first)); } result.put(volume.getName(), new VolumeImpl().withPath(volume.getMountPath())); } return result; }
Source:
protected void updateConfigFile(String content, Path configFile) throws IOException { Files.write(configFile, content.getBytes(), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE); }

Target:
private void updateConfigFile(String content, Path configFile) throws IOException { Files.write(configFile, content.getBytes(), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE); }
Source:
VisibilityCache(FluoConfiguration conf) { visCache = CacheBuilder.newBuilder() .expireAfterAccess(FluoConfigurationImpl.getTxIfoCacheTimeout(conf, TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS) .maximumWeight(FluoConfigurationImpl.getVisibilityCacheSize(conf)).weigher(new VisWeigher()) .concurrencyLevel(10).build(); }

Target:
VisibilityCache(FluoConfiguration conf) { visCache = CacheBuilder.newBuilder() .expireAfterAccess(FluoConfigurationImpl.getVisibilityCacheTimeout(conf, TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS) .maximumWeight(FluoConfigurationImpl.getVisibilityCacheSize(conf)).weigher(new VisWeigher()) .concurrencyLevel(10).build(); }
Source:
public static boolean handlePistonEvent(IMixinWorldServer world, WorldServer.ServerBlockEventList list, Object obj, BlockPos pos, Block blockIn, int eventId, int eventParam) { boolean extending = (eventId == 0); final IBlockState blockstate = ((net.minecraft.world.World)world).getBlockState(pos); EnumFacing direction = (EnumFacing) blockstate.getValue(BlockDirectional.FACING); List<BlockPos> blocks = new ArrayList<BlockPos>(); blocks.add(pos); BlockPistonStructureHelper movedBlocks = new BlockPistonStructureHelper((WorldServer) (Object) world, pos, direction, extending); movedBlocks.canMove(); List<BlockPos> blocksToAdd = new ArrayList<BlockPos>(); blocksToAdd.addAll(movedBlocks.getBlocksToDestroy()); blocksToAdd.addAll(movedBlocks.getBlocksToMove()); for (BlockPos add : blocksToAdd) { boolean duplicate = false; for (BlockPos equals : blocks) { if (equals.getX() == add.getX() && equals.getY() == add.getY() && equals.getZ() == add.getZ()) { duplicate = true; } } if (!duplicate) blocks.add(add); } List<Location<org.spongepowered.api.world.World>> locations = new ArrayList<Location<org.spongepowered.api.world.World>>(); for (BlockPos block : blocks) { locations.add(new Location<>((World)world, block.getX(), block.getY(), block.getZ())); } String namedCause = extending ? NamedCause.PISTON_EXTEND : NamedCause.PISTON_RETRACT; return SpongeCommonEventFactory.callChangeBlockEventPre(world, ImmutableList.copyOf(locations), NamedCause.of(namedCause, world), ((World) world).createSnapshot(pos.getX(), pos.getY(), pos.getZ())).isCancelled(); }

Target:
public static boolean handlePistonEvent(IMixinWorldServer world, WorldServer.ServerBlockEventList list, Object obj, BlockPos pos, Block blockIn, int eventId, int eventParam) { boolean extending = (eventId == 0); final IBlockState blockstate = ((net.minecraft.world.World) world).getBlockState(pos); EnumFacing direction = (EnumFacing) blockstate.getValue(BlockDirectional.FACING); HashSet<Location<org.spongepowered.api.world.World>> locations = new HashSet<Location<org.spongepowered.api.world.World>>(); locations.add(new Location<>((World) world, pos.getX(), pos.getY(), pos.getZ())); BlockPistonStructureHelper movedBlocks = new BlockPistonStructureHelper((WorldServer) (Object) world, pos, direction, extending); movedBlocks.canMove(); Stream.concat(movedBlocks.getBlocksToMove().stream(), movedBlocks.getBlocksToDestroy().stream()) .map(block -> new Location<>((World) world, block.getX(), block.getY(), block.getZ())) .collect(Collectors.toCollection(() -> locations)); String namedCause = extending ? NamedCause.PISTON_EXTEND : NamedCause.PISTON_RETRACT; return SpongeCommonEventFactory.callChangeBlockEventPre(world, ImmutableList.copyOf(locations), NamedCause.of(namedCause, world), ((World) world).createSnapshot(pos.getX(), pos.getY(), pos.getZ())).isCancelled(); }
Source:
@Override public void onDeleteFeatureClicked(String featureId) { QueryParameters queryParameters = new QueryParameters(); queryParameters.setWhereClause(String.format("OBJECTID = %s", featureId)); ListenableFuture<FeatureQueryResult> featureQueryResult = mFeatureLayer.getFeatureTable() .queryFeaturesAsync(queryParameters); featureQueryResult.addDoneListener(() -> { try { if (featureQueryResult.get().iterator().hasNext()) { Feature foundFeature = featureQueryResult.get().iterator().next(); deleteFeature(foundFeature, mFeatureTable, () -> { applyEdits(mFeatureTable); }); } } catch (InterruptedException | ExecutionException e) { logToUser(true, getString(R.string.error_feature_deletion, e.getCause().getMessage())); } }); }

Target:
@Override public void onDeleteFeatureClicked(String featureId) { QueryParameters queryParameters = new QueryParameters(); queryParameters.setWhereClause(String.format("OBJECTID = %s", featureId)); ListenableFuture<FeatureQueryResult> featureQueryResult = mFeatureLayer.getFeatureTable() .queryFeaturesAsync(queryParameters); featureQueryResult.addDoneListener(() -> { try { if (featureQueryResult.get().iterator().hasNext()) { Feature foundFeature = featureQueryResult.get().iterator().next(); deleteFeature(foundFeature, mFeatureTable, () -> applyEdits(mFeatureTable)); } } catch (InterruptedException | ExecutionException e) { logToUser(true, getString(R.string.error_feature_deletion, e.getCause().getMessage())); } }); }
Source:
public void dispatchEvent(final DistributedObjectEventPacket eventPacket, Object ignore) { String serviceName = eventPacket.getServiceName(); if (eventPacket.getEventType() == CREATED) { try { final ProxyRegistry registry = getOrCreateRegistry(serviceName); if (!registry.contains(eventPacket.getName())) { registry.createProxy(eventPacket.getName(), false, true, true); } } catch (HazelcastInstanceNotActiveException ignored) { ignore(ignored); } } else { final ProxyRegistry registry = registries.get(serviceName); if (registry != null) { registry.destroyProxy(eventPacket.getName(), true); } } }

Target:
public void dispatchEvent(final DistributedObjectEventPacket eventPacket, Object ignore) { String serviceName = eventPacket.getServiceName(); if (eventPacket.getEventType() == CREATED) { try { final ProxyRegistry registry = getOrCreateRegistry(serviceName); if (!registry.contains(eventPacket.getName())) { registry.createProxy(eventPacket.getName(), true, true); } } catch (HazelcastInstanceNotActiveException ignored) { ignore(ignored); } } else { final ProxyRegistry registry = registries.get(serviceName); if (registry != null) { registry.destroyProxy(eventPacket.getName(), false); } } }
Source:
public FileMockContext(Context context) { mContext = context; requestedPermissionName = "android.permission.INTERNET"; responsePermissionFlag = PackageManager.PERMISSION_GRANTED; permissionMap.put(requestedPermissionName,responsePermissionFlag); }

Target:
public FileMockContext(Context context) { mContext = context; String requestedPermissionName = "android.permission.INTERNET"; int responsePermissionFlag = PackageManager.PERMISSION_GRANTED; permissionMap.put(requestedPermissionName,responsePermissionFlag); }
Source:
public boolean filterOut(final SAMRecord first, final SAMRecord second) { return (readNameFilterSet.contains(first.getReadName()) && readNameFilterSet.contains(second.getReadName())) != includeReads; }

Target:
public boolean filterOut(final SAMRecord first, final SAMRecord second) { if (includeReads) { if (readNameFilterSet.contains(first.getReadName()) && readNameFilterSet.contains(second.getReadName())) { return false; } } else { if (!readNameFilterSet.contains(first.getReadName()) && !readNameFilterSet.contains(second.getReadName())) { return false; } } return true; }
Source:
private void stopTestingServer() { if (!synapseServer.getLocalServer().isEmpty()) { try { getLog().info("Stopping unit testing agent runs on port " + synapseServer.getUnitTestPort()); if (System.getProperty("os.name").toLowerCase().contains("win")) { Runtime runTime = Runtime.getRuntime(); Process proc = runTime.exec("cmd /c netstat -ano | findstr " + synapseServer.getUnitTestPort()); BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream())); String stream = stdInput.readLine(); if (stream != null) { int index = stream.lastIndexOf(' '); String pid = stream.substring(index); getLog().info("Unit testing agent runs with PID of " + pid); runTime.exec("cmd /c Taskkill /PID" + pid + " /T /F"); } } else { Process pr = Runtime.getRuntime().exec("lsof -t -i:" + synapseServer.getUnitTestPort()); BufferedReader read = new BufferedReader(new InputStreamReader(pr.getInputStream())); String pid = read.readLine(); getLog().info("Unit testing agent runs with PID of " + pid); Runtime.getRuntime().exec("kill -9 " + pid); } getLog().info("Unit testing agent stopped"); } catch (Exception e) { getLog().error("Error in closing the server"); } } }

Target:
private void stopTestingServer() { String unitTestPort = synapseServer.getUnitTestPort(); if (!synapseServer.getLocalServer().isEmpty()) { try { getLog().info("Stopping unit testing agent runs on port " + unitTestPort); BufferedReader bufferReader; if (System.getProperty("os.name").toLowerCase().contains("win")) { Runtime runTime = Runtime.getRuntime(); Process proc = runTime.exec("cmd /c netstat -ano | findstr " + unitTestPort); bufferReader = new BufferedReader(new InputStreamReader(proc.getInputStream())); String stream = bufferReader.readLine(); if (stream != null) { int index = stream.lastIndexOf(' '); String pid = stream.substring(index); getLog().info("Unit testing agent runs with PID of " + pid); runTime.exec("cmd /c Taskkill /PID" + pid + " /T /F"); } } else { Process pr = Runtime.getRuntime().exec("lsof -t -i:" + unitTestPort); bufferReader = new BufferedReader(new InputStreamReader(pr.getInputStream())); String pid = bufferReader.readLine(); getLog().info("Unit testing agent runs with PID of " + pid); Runtime.getRuntime().exec("kill -9 " + pid); } bufferReader.close(); getLog().info("Unit testing agent stopped"); } catch (Exception e) { getLog().error("Error in closing the server", e); } } }
Source:
public void writeWallet(Wallet wallet, OutputStream output) throws IOException { Protos.Wallet walletProto = walletToProto(wallet); int serializedSize = walletProto.getSerializedSize(); int bufferSize = serializedSize > this.walletWriteBufferSize ? this.walletWriteBufferSize : serializedSize; final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output, bufferSize); walletProto.writeTo(codedOutput); codedOutput.flush(); }

Target:
public void writeWallet(Wallet wallet, OutputStream output) throws IOException { Protos.Wallet walletProto = walletToProto(wallet); final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output, this.walletWriteBufferSize); walletProto.writeTo(codedOutput); codedOutput.flush(); }
Source:
public double getDistanceToPoint(XYPair otherPoint) { return Math.sqrt(Math.pow((otherPoint.x - this.x), 2) + Math.pow((otherPoint.y - this.y), 2)); }

Target:
public double getDistanceToPoint(XYPair otherPoint) { XYPair normalizedPoint = this.clone().add(otherPoint.clone().scale(-1)); return normalizedPoint.getMagnitude(); }
Source:
public void init(ServletConfig servletConfig) throws ServletException { try { ServletContext ctx = servletConfig.getServletContext(); configProps = ConfigurationProperties.getBean(ctx); if (!configurationPresent()) { throw new ServletException("TPF not in config"); } else { if (!tpfActiveFlag.equals("true")) { throw new ServletException("TPF not set to true"); } } RDFService rdfService = ModelAccess.on(ctx).getRDFService(); RDFServiceBasedRequestProcessorForTPFs.setRDFService(rdfService); OntologyDao dao = ModelAccess.on(ctx).getWebappDaoFactory().getOntologyDao(); config = new ConfigReader(new StringReader(getConfigJson(dao))); for ( Entry<String,IDataSourceType> typeEntry : config.getDataSourceTypes().entrySet() ) { if (!DataSourceTypesRegistry.isRegistered(typeEntry.getKey())) { DataSourceTypesRegistry.register( typeEntry.getKey(), typeEntry.getValue() ); } } for (Entry<String, JsonNode> dataSource : config.getDataSources().entrySet()) { dataSources.put(dataSource.getKey(), DataSourceFactory.create(dataSource.getValue())); } MIMEParse.register("text/html"); MIMEParse.register(Lang.TTL.getHeaderString()); MIMEParse.register(Lang.JSONLD.getHeaderString()); MIMEParse.register(Lang.NTRIPLES.getHeaderString()); MIMEParse.register(Lang.RDFXML.getHeaderString()); HtmlTriplePatternFragmentWriterImpl.setContextPath(servletConfig.getServletContext().getContextPath()); } catch (Exception e) { throw new ServletException(e); } }

Target:
public void init(ServletConfig servletConfig) throws ServletException { try { ServletContext ctx = servletConfig.getServletContext(); configProps = ConfigurationProperties.getBean(ctx); if (!configurationPresent()) { throw new ServletException("TPF is currently disabled. To enable, add 'tpfActive.flag=true' to the runtime.properties."); } else { if (!tpfActiveFlag.equalsIgnoreCase("true")) { throw new ServletException("TPF is currently disabled. To enable, set 'tpfActive.flag=true' in runtime.properties."); } } RDFService rdfService = ModelAccess.on(ctx).getRDFService(); RDFServiceBasedRequestProcessorForTPFs.setRDFService(rdfService); OntologyDao dao = ModelAccess.on(ctx).getWebappDaoFactory().getOntologyDao(); config = new ConfigReader(new StringReader(getConfigJson(dao))); for ( Entry<String,IDataSourceType> typeEntry : config.getDataSourceTypes().entrySet() ) { if (!DataSourceTypesRegistry.isRegistered(typeEntry.getKey())) { DataSourceTypesRegistry.register( typeEntry.getKey(), typeEntry.getValue() ); } } for (Entry<String, JsonNode> dataSource : config.getDataSources().entrySet()) { dataSources.put(dataSource.getKey(), DataSourceFactory.create(dataSource.getValue())); } MIMEParse.register("text/html"); MIMEParse.register(Lang.TTL.getHeaderString()); MIMEParse.register(Lang.JSONLD.getHeaderString()); MIMEParse.register(Lang.NTRIPLES.getHeaderString()); MIMEParse.register(Lang.RDFXML.getHeaderString()); HtmlTriplePatternFragmentWriterImpl.setContextPath(servletConfig.getServletContext().getContextPath()); } catch (Exception e) { throw new ServletException(e); } }
Source:
private static void sendBlobStoreControlRequest(ServerAdminTool serverAdminTool, DataNodeId dataNodeId, PartitionId partitionId, short numReplicasCaughtUpPerPartition, boolean enable) throws IOException, TimeoutException { ServerErrorCode errorCode = serverAdminTool.controlBlobStore(dataNodeId, partitionId, numReplicasCaughtUpPerPartition, enable); if (errorCode == ServerErrorCode.No_Error) { LOGGER.info("Enable state of replication from "); } else { LOGGER.error("From {}, received server error code for request to set enable state for replication for {}", dataNodeId, errorCode, enable, partitionId); } }

Target:
private static void sendBlobStoreControlRequest(ServerAdminTool serverAdminTool, DataNodeId dataNodeId, PartitionId partitionId, short numReplicasCaughtUpPerPartition, boolean enable) throws IOException, TimeoutException { ServerErrorCode errorCode = serverAdminTool.controlBlobStore(dataNodeId, partitionId, numReplicasCaughtUpPerPartition, enable); if (errorCode == ServerErrorCode.No_Error) { LOGGER.info("Enable state of controlling BlobStore from has been set to for on {}", enable, partitionId, dataNodeId); } else { LOGGER.error( "From {}, received server error code for request to set enable state for controlling BlobStore for {}", dataNodeId, errorCode, enable, partitionId); } }
Source:
protected InputStream loadFile(String keycloakConfigFile) { if (keycloakConfigFile.startsWith("classpath:")) { String classPathLocation = keycloakConfigFile.substring(10); return getClass().getClassLoader().getResourceAsStream(classPathLocation); } else { try { if (!keycloakConfigFile.contains(":")) { keycloakConfigFile = "file://" + keycloakConfigFile; } return new URL(keycloakConfigFile).openStream(); } catch (Exception e) { LOG.warn("Couldn't find keycloak config file on location: " + keycloakConfigFile); LOG.debug("ouldn't find keycloak config file", e); return null; } } }

Target:
protected InputStream loadFile(String keycloakConfigFile) { if (keycloakConfigFile.startsWith("classpath:")) { String classPathLocation = keycloakConfigFile.substring(10); return getClass().getClassLoader().getResourceAsStream(classPathLocation); } else { try { if (!keycloakConfigFile.contains(":")) { keycloakConfigFile = "file://" + keycloakConfigFile; } return new URL(keycloakConfigFile).openStream(); } catch (Exception e) { LOG.warn("Couldn't find keycloak config file on location: " + keycloakConfigFile); LOG.debug("Couldn't find keycloak config file", e); return null; } } }
Source:
public void testAvatar() { UrlValidator urlValidator = new UrlValidator(); assertTrue(urlValidator.isValid(faker.avatar().image())); }

Target:
public void testAvatar() { String avatar = faker.avatar().image(); assertThat(avatar, matchesRegularExpression("^https:\\/\\/s3.amazonaws\\.com\\/uifaces\\/faces\\/twitter\\/[a-zA-Z0-9_]+\\/128\\.jpg$")); }
Source:
void notifyCallbackWithSuccess(RealmResults<PermissionOffer> permissions) { activeTasks.remove(this); callback.onSuccess(permissions); }

Target:
void notifyCallbackWithSuccess(RealmResults<PermissionOffer> permissions) { try { callback.onSuccess(permissions); } finally { activeTasks.remove(this); } }
Source:
public void checkConfigFile(File configFile, File serverDir) { try { ServerFeature servUtil = new ServerFeature(); Set<String> features = servUtil.getServerFeatures(serverDir); features.removeAll(existingFeatures); if (!features.isEmpty()) { List<String> configFeatures = new ArrayList<String>(features); log.info("Configuration features have been added"); runMojo("net.wasdev.wlp.maven.plugins:liberty-maven-plugin", "install-feature", serverName, configFeatures); this.existingFeatures.addAll(features); } } catch (Exception e) { log.debug("Failed to read configuration file", e); } }

Target:
public void checkConfigFile(File configFile, File serverDir) { try { ServerFeature servUtil = getServerFeatureUtil(); Set<String> features = servUtil.getServerFeatures(serverDir); features.removeAll(existingFeatures); if (!features.isEmpty()) { List<String> configFeatures = new ArrayList<String>(features); log.info("Configuration features have been added"); runMojo("net.wasdev.wlp.maven.plugins:liberty-maven-plugin", "install-feature", serverName, configFeatures); this.existingFeatures.addAll(features); } } catch (MojoExecutionException e) { log.error("Failed to install features from configuration file", e); } }
Source:
private HBox createMilestoneDetailsBox() { HBox milestoneDetailsBox = new HBox(); milestoneDetailsBox.setSpacing(3); milestoneDetailsBox.setPrefWidth(250); milestoneDetailsBox.setAlignment(Pos.CENTER_RIGHT); if (getDueDate().isPresent()) { Label dueDate = new Label("Due on: " + getDueDate().get().toString()); dueDate.setPrefWidth(150); milestoneDetailsBox.getChildren().add(dueDate); } int totalIssues = getOpenIssues() + getClosedIssues(); double progressValue = totalIssues > 0 ? (double) getClosedIssues() / (getOpenIssues() + getClosedIssues()) : 0; MilestoneProgressBar progressBar = new MilestoneProgressBar(progressValue); Label progressLabel = new Label(String.format("%3.0f%%", progressValue * 100)); progressLabel.setPrefWidth(50); milestoneDetailsBox.getChildren().addAll(progressBar, progressLabel); return milestoneDetailsBox; }

Target:
private HBox createMilestoneDetailsBox() { HBox milestoneDetailsBox = new HBox(); milestoneDetailsBox.setSpacing(3); milestoneDetailsBox.setPrefWidth(250); milestoneDetailsBox.setAlignment(Pos.CENTER_RIGHT); if (getDueDate().isPresent()) { Label dueDate = new Label("Due on: " + getDueDate().get().toString()); dueDate.setPrefWidth(150); milestoneDetailsBox.getChildren().add(dueDate); } MilestoneProgressBar progressBar = new MilestoneProgressBar(getProgress()); Label progressLabel = new Label(String.format("%3.0f%%", getProgress() * 100)); progressLabel.setPrefWidth(50); milestoneDetailsBox.getChildren().addAll(progressBar, progressLabel); return milestoneDetailsBox; }
Source:
private String getFormattedAmountByLocaleAndInvoiceCurrency(BigDecimal amount) { final DecimalFormat number = (DecimalFormat) DecimalFormat.getCurrencyInstance(locale); java.util.Currency currency = java.util.Currency.getInstance(invoice.getCurrency().toString()); DecimalFormatSymbols dfs = number.getDecimalFormatSymbols(); dfs.setInternationalCurrencySymbol(currency.getCurrencyCode()); dfs.setCurrencySymbol(currency.getSymbol(currencyLocaleMap.get(currency))); number.setDecimalFormatSymbols(dfs); return number.format(amount.doubleValue()); }

Target:
private String getFormattedAmountByLocaleAndInvoiceCurrency(BigDecimal amount) { String invoiceCurrencyCode = invoice.getCurrency().toString(); CurrencyUnit currencyUnit = CurrencyUnit.of(invoiceCurrencyCode); final DecimalFormat numberFormatter = (DecimalFormat) DecimalFormat.getCurrencyInstance(locale); DecimalFormatSymbols dfs = numberFormatter.getDecimalFormatSymbols(); dfs.setInternationalCurrencySymbol(currencyUnit.getCurrencyCode()); try { final java.util.Currency currency = java.util.Currency.getInstance(invoiceCurrencyCode); dfs.setCurrencySymbol(currency.getSymbol(currencyLocaleMap.get(currency))); } catch (Exception e) { dfs.setCurrencySymbol(currencyUnit.getSymbol(locale)); } numberFormatter.setDecimalFormatSymbols(dfs); numberFormatter.setMinimumFractionDigits(currencyUnit.getDefaultFractionDigits()); numberFormatter.setMaximumFractionDigits(currencyUnit.getDefaultFractionDigits()); return numberFormatter.format(amount.doubleValue()); }
Source:
private synchronized boolean updateWeatherData() { try { weatherData = getWeatherData( "<LINK_0>*%20FROM%20weather.forecast%20WHERE%20u=%27c%27%20AND%20woeid%20=%20%27" + location + "%27"); if (weatherData != null) { updateStatus(ThingStatus.ONLINE); return true; } } catch (IOException e) { logger.warn("Error accessing Yahoo weather: {}", e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, e.getMessage()); } return false; }

Target:
private synchronized boolean updateWeatherData() { try { weatherData = getWeatherData("SELECT * FROM weather.forecast WHERE u = 'c' AND woeid = " + location); if (weatherData != null) { updateStatus(ThingStatus.ONLINE); return true; } } catch (IOException e) { logger.warn("Error accessing Yahoo weather: {}", e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, e.getMessage()); } return false; }
Source:
public RecyclerView.ViewHolder onCreateViewHolder(final ViewGroup parent, int viewType) { final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); RecyclerView.ViewHolder holder; View view; if (viewType == HEADER_TYPE) { view = inflater.inflate(R.layout.header_list_item_layout, null); holder = new HeaderViewHolder(view); } else { view = inflater.inflate(R.layout.contact_list_item_layout, null); holder = new ContactListViewHolder(view, new ContactListViewHolder.OnSelectionChanged() { @Override public void clickedItem(GenericContact contact) { itemClicked(contact); } @Override public void follow(final GenericContact item, final int position) { TwitterService.follow(item.getScreenName(), new Callback<TwitterUser>() { @Override public void success(Result<TwitterUser> result) { CustomContactListAdapter.this.follow(item); showSnackBar(parent, item, true); } @Override public void failure(TwitterException e) { Toast.makeText(mContext, R.string.cant_follow, Toast.LENGTH_LONG).show(); } }); } @Override public void unfollow(final GenericContact item, final int position) { if (mContactType == BaseContactFragment.FOLLOWING) { removeItem(position); } TwitterService.unfollow(item.getScreenName(), new Callback<TwitterUser>() { @Override public void success(Result<TwitterUser> result) { CustomContactListAdapter.this.unfollow(item); showSnackBar(parent, item, false); } @Override public void failure(TwitterException e) { Toast.makeText(mContext, R.string.cant_unfollow, Toast.LENGTH_LONG).show(); } }); } }); } return holder; }

Target:
public RecyclerView.ViewHolder onCreateViewHolder(final ViewGroup parent, int viewType) { final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); RecyclerView.ViewHolder holder; View view; if (viewType == HEADER_TYPE) { view = inflater.inflate(R.layout.header_list_item_layout, null); holder = new HeaderViewHolder(view); } else { view = inflater.inflate(R.layout.contact_list_item_layout, null); holder = new ContactListViewHolder(view, new ContactListViewHolder.OnSelectionChanged() { @Override public void clickedItem(GenericContact contact) { itemClicked(contact); if (mOnContactSelectionChanged != null){ mOnContactSelectionChanged.clickedItem(contact); } } @Override public void follow(final GenericContact item, final int position) { if (mOnContactSelectionChanged != null){ mOnContactSelectionChanged.follow(item, position); } } @Override public void unfollow(final GenericContact item, final int position) { if (mContactType == BaseContactFragment.FOLLOWING) { removeItem(position); } if (mOnContactSelectionChanged != null){ mOnContactSelectionChanged.unfollow(item, position); } } }); } return holder; }
Source:
public Product getProduct() { Product product = new Product(); String productTitle = informationClient.getProductTitle(); Integer productInventory = inventoryClient.getProductInventories(); if (productTitle != null) { product.setTitle(productTitle); } else { product.setTitle("Error: Fetching Product Title Failed"); } if (productInventory != null) { product.setProductInventories(productInventory); } else { product.setProductInventories(-1); } return product; }

Target:
public Product getProduct() { var product = new Product(); String productTitle = informationClient.getProductTitle(); Integer productInventory = inventoryClient.getProductInventories(); if (productTitle != null) { product.setTitle(productTitle); } else { product.setTitle("Error: Fetching Product Title Failed"); } if (productInventory != null) { product.setProductInventories(productInventory); } else { product.setProductInventories(-1); } return product; }
Source:
public Collection<Cookie> getRequestCookies() { final Collection<Cookie> pac4jCookies = new LinkedHashSet<>(); for (javax.servlet.http.Cookie c : this.request.getCookies()) { final Cookie cookie = new Cookie(c.getName(), c.getValue()); cookie.setComment(c.getComment()); cookie.setDomain(c.getDomain()); cookie.setHttpOnly(c.isHttpOnly()); cookie.setMaxAge(c.getMaxAge()); cookie.setPath(c.getPath()); cookie.setSecure(c.getSecure()); pac4jCookies.add(cookie); } return pac4jCookies; }

Target:
public Collection<Cookie> getRequestCookies() { final Collection<Cookie> pac4jCookies = new LinkedHashSet<>(); final javax.servlet.http.Cookie[] cookies = this.request.getCookies(); if (cookies != null) { for (javax.servlet.http.Cookie c : cookies) { final Cookie cookie = new Cookie(c.getName(), c.getValue()); cookie.setComment(c.getComment()); cookie.setDomain(c.getDomain()); cookie.setHttpOnly(c.isHttpOnly()); cookie.setMaxAge(c.getMaxAge()); cookie.setPath(c.getPath()); cookie.setSecure(c.getSecure()); pac4jCookies.add(cookie); } } return pac4jCookies; }
Source:
Pair<StoreKey, PersistentIndex.IndexEntryType> getResetKey() { if (version == (short) 1 && resetKey != null) { return new Pair<>(resetKey.getFirst(), PersistentIndex.IndexEntryType.values()[resetKey.getSecond()]); } else { return null; } }

Target:
Pair<StoreKey, PersistentIndex.IndexEntryType> getResetKey() { return resetKey; }
Source:
public List<ICompletionProposal> getExpressionTextPrefixes() { final List<ICompletionProposal> result = new ArrayList<ICompletionProposal>(); result.add(new TextCompletionProposal(AstBuilderListener.NOT_OPERATOR + SPACE, 0)); result.add(new TextCompletionProposal(AstBuilderListener.UNARY_MIN_OPERATOR + SPACE, 0)); result.add(new TextCompletionProposal("()", 1)); result.add(new TextCompletionProposal("true", 0)); result.add(new TextCompletionProposal("false", 0)); result.add(new TextCompletionProposal("null", 0)); result.add(new TextCompletionProposal("{}", 1)); result.add(new TextCompletionProposal("Sequence()", 1)); result.add(new TextCompletionProposal("OrderedSet()", 1)); result.add(new TextCompletionProposal(AstBuilderListener.LET_OPERATOR + SPACE, 0)); result.add(new TextCompletionProposal(AstBuilderListener.CONDITIONAL_OPERATOR + SPACE, 0)); return result; }

Target:
public List<ICompletionProposal> getExpressionTextPrefixes() { final List<ICompletionProposal> result = new ArrayList<ICompletionProposal>(); result.add(new TextCompletionProposal(AstBuilderListener.NOT_OPERATOR + SPACE, 0)); result.add(new TextCompletionProposal(AstBuilderListener.UNARY_MIN_OPERATOR + SPACE, 0)); result.add(new TextCompletionProposal("()", 1)); result.add(new TextCompletionProposal("true", 0)); result.add(new TextCompletionProposal("false", 0)); result.add(new TextCompletionProposal("null", 0)); result.add(new TextCompletionProposal("{}", 1)); result.add(new TextCompletionProposal("Sequence{}", 1)); result.add(new TextCompletionProposal("OrderedSet{}", 1)); result.add(new TextCompletionProposal(AstBuilderListener.LET_OPERATOR + SPACE, 0)); result.add(new TextCompletionProposal(AstBuilderListener.CONDITIONAL_OPERATOR + SPACE, 0)); return result; }