auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void putObject() throws IOException, SignatureException, URISyntaxException { final String jobIdString = "a4a586a1-cb80-4441-84e2-48974e982d51"; final Map<String, String> queryParams = new HashMap<>(); queryParams.put("job", jobIdString); queryParams.put("offset", Long.toString(0)); final Path resourceFile = ResourceUtils.loadFileResource("LoremIpsumTwice.txt"); final byte[] fileBytes = Files.readAllBytes(resourceFile); final String output = new String(fileBytes, Charset.forName("UTF-8")); final FileChannel channel = FileChannel.open(resourceFile, StandardOpenOption.READ); MockNetwork .expecting(HttpVerb.PUT, "/bucketName/objectName", queryParams, output) .returning(200, "") .asClient() .putObject(new PutObjectRequest("bucketName", "objectName", UUID.fromString(jobIdString), fileBytes.length, 0, channel)); }

Target:
public void putObject() throws IOException, SignatureException, URISyntaxException { final String jobIdString = "a4a586a1-cb80-4441-84e2-48974e982d51"; final Map<String, String> queryParams = new HashMap<>(); queryParams.put("job", jobIdString); queryParams.put("offset", Long.toString(0)); final Path resourcePath = ResourceUtils.loadFileResource("LoremIpsumTwice.txt"); final byte[] fileBytes = Files.readAllBytes(resourcePath); final String output = new String(fileBytes, Charset.forName("UTF-8")); final FileChannel channel = FileChannel.open(resourcePath, StandardOpenOption.READ); MockNetwork .expecting(HttpVerb.PUT, "/bucketName/objectName", queryParams, output) .returning(200, "") .asClient() .putObject(new PutObjectRequest("bucketName", "objectName", UUID.fromString(jobIdString), fileBytes.length, 0, channel)); }
Source:
public ByteBuffer message(ByteBuffer messagesBuf) { if (messagesBuf.limit() == messagesBuf.position()) { return null; } if (m_partialMessageLength.position() != 0) { if (!startMessage(messagesBuf)) { return null; } } else if (m_currentMessageLength == -1) { if (!startMessage(messagesBuf)) { return null; } } int remainingInMessage = m_currentMessageLength - (messagesBuf.position() - m_currentMessageStart); if (messagesBuf.remaining() >= remainingInMessage) { int oldLimit = messagesBuf.limit(); messagesBuf.position(m_currentMessageStart); messagesBuf.limit(messagesBuf.position() + m_currentMessageLength); ByteBuffer message = ByteBuffer.allocate(m_currentMessageLength); message.put(messagesBuf); message.flip(); messagesBuf.limit(oldLimit); int remainingMessageLength = messagesBuf.remaining(); messagesBuf.compact(); messagesBuf.flip(); m_currentMessageLength = -1; return message; } else { messagesBuf.position(messagesBuf.limit()); return null; } }

Target:
public ByteBuffer message(ByteBuffer messagesBuf) { if (messagesBuf.limit() == messagesBuf.position()) { return null; } if (m_partialMessageLength.position() != 0 || m_currentMessage == null) { if (!startMessage(messagesBuf)) { return null; } } if (messagesBuf.remaining() >= m_currentMessage.remaining()) { int oldLimit = messagesBuf.limit(); messagesBuf.limit(messagesBuf.position() + m_currentMessage.remaining()); m_currentMessage.put(messagesBuf); m_currentMessage.flip(); messagesBuf.limit(oldLimit); ByteBuffer message = m_currentMessage; m_currentMessage = null; return message; } else { m_currentMessage.put(messagesBuf); return null; } }
Source:
protected boolean matchesSafely(T item) { if (condition.matches(itemToMatchCondition)) { return matcher.matches(item); } else { Description conditionDescription = new StringDescription() .appendValue(itemToMatchCondition) .appendDescriptionOf(condition); throw new AssumptionViolatedException( String.format("Condition is not satisfied: %s", conditionDescription)); } }

Target:
protected boolean matchesSafely(T item) { if (condition.matches(itemToMatchCondition)) { return matcher.matches(item); } Description conditionDescription = new StringDescription() .appendValue(itemToMatchCondition) .appendDescriptionOf(condition); throw new AssumptionViolatedException( String.format("Condition is not satisfied: %s", conditionDescription)); }
Source:
public void setupGatewayAccount() { DatabaseFixtures databaseFixtures = DatabaseFixtures.withDatabaseTestHelper(app.getDatabaseTestHelper()); DatabaseFixtures.TestCardType mastercard = databaseFixtures.aMastercardDebitCardType().insert(); DatabaseFixtures.TestCardType visa = databaseFixtures.aVisaCreditCardType().insert(); app.getDatabaseTestHelper().addGatewayAccount(accountId, paymentProvider, description, analyticsId, 200L, 50L); app.getDatabaseTestHelper().addAcceptedCardType(Long.valueOf(accountId), mastercard.getId()); app.getDatabaseTestHelper().addAcceptedCardType(Long.valueOf(accountId), visa.getId()); }

Target:
public void setupGatewayAccount() { DatabaseFixtures databaseFixtures = DatabaseFixtures.withDatabaseTestHelper(app.getDatabaseTestHelper()); DatabaseFixtures.TestCardType mastercard = databaseFixtures.aMastercardDebitCardType().insert(); DatabaseFixtures.TestCardType visa = databaseFixtures.aVisaCreditCardType().insert(); app.getDatabaseTestHelper().addGatewayAccount(accountId, paymentProvider, description, analyticsId, corporateCreditCardSurchargeAmount, corporateDebitCardSurchargeAmount); app.getDatabaseTestHelper().addAcceptedCardType(Long.valueOf(accountId), mastercard.getId()); app.getDatabaseTestHelper().addAcceptedCardType(Long.valueOf(accountId), visa.getId()); }
Source:
private void promptInvalid() { jumpTo.clear(); jumpTo.setPromptText(ERROR); jumpTo.setStyle("-fx-prompt-text-fill: red;"); }

Target:
private void promptInvalid() { jumpTo.clear(); jumpTo.setPromptText(ERROR); jumpTo.getStyleClass().add(INVALIDPROMPT); }
Source:
public synchronized static LightblueFactory getFactory( final PluginConfiguration pluginConfiguration) { if (factory == null) { appendToThreadClassLoader(pluginConfiguration); return getFactory(loadDefaultDatasources()); } return factory; }

Target:
public static LightblueFactory getFactory( final PluginConfiguration pluginConfiguration) { LightblueFactory f = factory; if (f == null) { synchronized (RestConfiguration.class) { f = factory; if (f == null) { appendToThreadClassLoader(pluginConfiguration); return getFactory(loadDefaultDatasources()); } } } return f; }
Source:
public void testExecute() { initMocks(this); doReturn(null).when(diagram).getGraph(); final PerformAutomaticLayoutCommand command = mock(PerformAutomaticLayoutCommand.class); doCallRealMethod().when(command).execute(callback); doReturn(diagram).when(command).getDiagram(); command.execute(callback); verify(command).getExecutor(); verify(callback).onSuccess(); }

Target:
public void testExecute() { doReturn(diagram).when(command).getDiagram(); doReturn(executor).when(command).makeExecutor(); command.execute(callback); verify(layoutHelper).applyLayout(diagram, executor, true); verify(callback).onSuccess(); verify(command).executeLock(); }
Source:
private void reportMetrics() { System.out.println("\n"); metricRegistry.getCounters().entrySet().forEach(e -> System.out.printf(e.getKey() + ": " + e.getValue().getCount() + "\n")); }

Target:
private void reportMetrics() { metricRegistry.getCounters().entrySet().forEach(e -> logger.info(e.getKey() + ": " + e.getValue().getCount())); }
Source:
protected void executeCommand() { boolean success = true; StorageServerConnections connection = getConnection(); if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { Pair<Boolean, Integer> result = connectHostToStorage(); boolean isValidConnection = result.getFirst(); if (!isValidConnection) { VdcFault fault = new VdcFault(); fault.setError(VdcBllErrors.forValue(result.getSecond())); getReturnValue().setFault(fault); success = false; } } if (success) { connection.setid(Guid.newGuid().toString()); saveConnection(connection); getReturnValue().setActionReturnValue(getConnection().getid()); } setSucceeded(success); }

Target:
protected void executeCommand() { boolean success = true; if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { Pair<Boolean, Integer> result = connectHostToStorage(); boolean isValidConnection = result.getFirst(); if (!isValidConnection) { VdcFault fault = new VdcFault(); fault.setError(VdcBllErrors.forValue(result.getSecond())); getReturnValue().setFault(fault); success = false; } } if (success) { StorageServerConnections connection = getConnection(); connection.setid(Guid.newGuid().toString()); saveConnection(connection); getReturnValue().setActionReturnValue(connection.getid()); } setSucceeded(success); }
Source:
public void testWindowsNode() throws RunNodesException { final String groupName = String.format("win%s", System.getProperty("user.name").substring(0, 3)); final TemplateBuilder templateBuilder = view.getComputeService().templateBuilder(); templateBuilder.imageId("westus/MicrosoftWindowsServer/WindowsServer/2016-Technical-Preview-with-Containers"); templateBuilder.hardwareId("Standard_A0"); templateBuilder.locationId("westus"); final Template template = templateBuilder.build(); final TemplateOptions options = template.getOptions().as(TemplateOptions.class); options.inboundPorts(5985); try { Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(groupName, 1, template); assertThat(nodes).hasSize(1); } finally { view.getComputeService().destroyNodesMatching(inGroup(groupName)); } }

Target:
public void testWindowsNode() throws RunNodesException { final String groupName = this.azureGroup; final TemplateBuilder templateBuilder = view.getComputeService().templateBuilder(); templateBuilder.imageId("global/MicrosoftWindowsServer/WindowsServer/Windows-Server-Technical-Preview"); templateBuilder.hardwareId("Standard_A0"); templateBuilder.locationId("westus"); final Template template = templateBuilder.build(); try { Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(groupName, 1, template); assertThat(nodes).hasSize(1); } finally { view.getComputeService().destroyNodesMatching(inGroup(groupName)); } }
Source:
public boolean add(Entity entity){ return entities.add(entity); }

Target:
public boolean add(Entity entity){ if (entity == null){ throw new IllegalArgumentException("Cannot add null entity"); } if (!entity.isPassable()){ if (!isPassable()) return false; impassableEntity = entity; return true; } return passableEntities.add(entity); }
Source:
public void _list(ListOptions options) throws Exception { List<BundleDTO> installedBundles = agent.getBundles(); installedBundles.forEach(this::prettyPrintBundleDTO); }

Target:
public void _list(ListOptions options) throws Exception { List<BundleDTO> installedBundles = agent.getBundles(); outputAs(options.json(), installedBundles); }
Source:
private JComponent createDetailTextArea() { JPanel detailPanel = new JPanel(new BorderLayout()); JLabel detailLabel = new JLabel("Details"); detailPanel.add(detailLabel, BorderLayout.NORTH); detailTextArea = new JTextArea(); detailTextArea.setRows(4); detailTextArea.setEditable(false); detailPanel.add(detailTextArea, BorderLayout.SOUTH); return detailPanel; }

Target:
private JComponent createDetailTextArea() { JPanel detailPanel = new JPanel(new BorderLayout()); JLabel detailLabel = new JLabel("Details"); detailPanel.add(detailLabel, BorderLayout.NORTH); detailTextArea = new JTextArea(4, 80); detailTextArea.setEditable(false); detailPanel.add(detailTextArea, BorderLayout.SOUTH); return detailPanel; }
Source:
public void visitNode(Tree tree) { if (!hasSemantic() || !(context instanceof AnalyzerMessageReporter)) { return; } ClassTree classTree = (ClassTree) tree; String classPackageName = packageNameOf(classTree); Optional<AnnotationTree> componentScanAnnotation = classTree.modifiers().annotations().stream() .filter(SpringBeansShouldBeAccessibleCheck::isComponentScan).findFirst(); if (componentScanAnnotation.isPresent()) { componentScanAnnotation.get().arguments().forEach(this::addToScannedPackages); } else if (hasAnnotation(classTree, SPRING_BOOT_APP_ANNOTATION)) { scannedPackages.add(classPackageName); } else if (hasAnnotation(classTree, SPRING_BEAN_ANNOTATIONS)) { addMessageToMap(classPackageName, classTree); } }

Target:
public void visitNode(Tree tree) { ClassTree classTree = (ClassTree) tree; if (!hasSemantic() || classTree.simpleName() == null) { return; } String classPackageName = packageNameOf(classTree.symbol()); SymbolMetadata classSymbolMetadata = classTree.symbol().metadata(); List<SymbolMetadata.AnnotationValue> componentScanValues = classSymbolMetadata.valuesForAnnotation(COMPONENT_SCAN_ANNOTATION); if (componentScanValues != null) { componentScanValues.forEach(this::addToScannedPackages); } else if (hasAnnotation(classSymbolMetadata, SPRING_BOOT_APP_ANNOTATION)) { packagesScannedBySpring.add(classPackageName); } else if (hasAnnotation(classSymbolMetadata, SPRING_BEAN_ANNOTATIONS)) { addMessageToMap(classPackageName, classTree.simpleName()); } }
Source:
public ChannelOptions(Credentials credential, String authority, String userAgent, String callTimingReportPath, String callStatusReportPath, RetryOptions unaryCallRetryOptions, ScheduledExecutorService scheduledExecutorService, long timeoutMs, int channelCount) { Preconditions.checkArgument(!Strings.isNullOrEmpty(userAgent), "UserAgent must not be empty or null"); this.credential = credential; this.authority = authority; this.userAgent = userAgent; this.callTimingReportPath = callTimingReportPath; this.callStatusReportPath = callStatusReportPath; this.scheduledExecutorService = scheduledExecutorService; this.unaryCallRetryOptions = unaryCallRetryOptions; this.timeoutMs = timeoutMs; this.channelCount = channelCount; }

Target:
public ChannelOptions(Credentials credential, String authority, String userAgent, String callTimingReportPath, String callStatusReportPath, RetryOptions unaryCallRetryOptions, ScheduledExecutorService scheduledExecutorService, long timeoutMs, int channelCount) { Preconditions.checkArgument(!Strings.isNullOrEmpty(userAgent), "UserAgent must not be empty or null"); Preconditions.checkArgument(channelCount > 0, "Channel count has to be at least 1."); Preconditions.checkArgument(timeoutMs >= -1, "ChannelTimeoutMs has to be positive, or -1 for none."); this.credential = credential; this.authority = authority; this.userAgent = userAgent; this.callTimingReportPath = callTimingReportPath; this.callStatusReportPath = callStatusReportPath; this.scheduledExecutorService = scheduledExecutorService; this.unaryCallRetryOptions = unaryCallRetryOptions; this.timeoutMs = timeoutMs; this.channelCount = channelCount; }
Source:
public static void setupJoysticks() { DriveCode.leftJoystickChannel = Igneous.joystick1.getYAxisSource(); DriveCode.rightJoystickChannel = Igneous.joystick1.getAxisSource(6); DriveCode.octocanumShifting = BooleanMixing.createDispatch(Igneous.joystick1.getButtonChannel(1), Igneous.globalPeriodic); Rollers.runRollersButton = BooleanMixing.createDispatch(Igneous.joystick2.getButtonChannel(3), Igneous.globalPeriodic); Rollers.toggleRollersButton = BooleanMixing.createDispatch(Igneous.joystick2.getButtonChannel(4), Igneous.globalPeriodic); }

Target:
public static void setupJoysticks() { DriveCode.leftJoystickChannel = Igneous.joystick1.getYAxisSource(); DriveCode.rightJoystickChannel = Igneous.joystick1.getAxisSource(6); DriveCode.octocanumShifting = BooleanMixing.createDispatch(Igneous.joystick1.getButtonChannel(1), Igneous.globalPeriodic); Rollers.runRollersButton = Igneous.joystick2.getButtonSource(3); Rollers.toggleRollersButton =Igneous.joystick2.getButtonSource(4); }
Source:
public CCExport(String siteId, ContentHostingService contentHostingService) { this.siteId = siteId; this.contentService = contentHostingService; this.messageForumsForumManager = ComponentManager.get(org.sakaiproject.api.app.messageforums.MessageForumsForumManager.class); this.messageForumsMessageManager = ComponentManager.get(org.sakaiproject.api.app.messageforums.MessageForumsMessageManager.class); exportUtil = new ExportUtil(siteId); forumsExport = new ForumsExport(exportUtil, messageForumsForumManager, messageForumsMessageManager); }

Target:
public CCExport(String siteId, ContentHostingService contentHostingService) throws IdUnusedException { this.siteId = siteId; this.contentService = contentHostingService; site = SiteService.getSite(siteId); this.messageForumsForumManager = ComponentManager.get(MessageForumsForumManager.class); this.messageForumsMessageManager = ComponentManager.get(MessageForumsMessageManager.class); exportUtil = new ExportUtil(siteId); forumsExport = new ForumsExport(exportUtil, messageForumsForumManager, messageForumsMessageManager); }
Source:
private List<Brick> setupLegoEv3CategoryList() { List<Brick> legoEV3BrickList = new ArrayList<Brick>(); legoEV3BrickList.add(new LegoEv3MotorTurnAngleBrick(LegoEv3MotorTurnAngleBrick.Motor.MOTOR_A, BrickValues.LEGO_ANGLE)); legoEV3BrickList.add(new LegoEv3MotorMoveBrick(LegoEv3MotorMoveBrick.Motor.MOTOR_A, BrickValues.LEGO_POWER)); legoEV3BrickList.add(new LegoEv3MotorStopBrick(LegoEv3MotorStopBrick.Motor.MOTOR_A)); legoEV3BrickList.add(new LegoEv3PlayToneBrick(BrickValues.LEGO_FREQUENCY, BrickValues.LEGO_DURATION, BrickValues.LEGO_VOLUME)); legoEV3BrickList.add(new LegoEv3SetLedBrick(LegoEv3SetLedBrick.LedStatus.LED_GREEN)); return legoEV3BrickList; }

Target:
private List<Brick> setupLegoEv3CategoryList() { List<Brick> legoEV3BrickList = new ArrayList<Brick>(); legoEV3BrickList.add(new LegoEv3MotorTurnAngleBrick(LegoEv3MotorTurnAngleBrick.Motor.MOTOR_A, BrickValues.LEGO_ANGLE)); legoEV3BrickList.add(new LegoEv3MotorMoveBrick(LegoEv3MotorMoveBrick.Motor.MOTOR_A, BrickValues.LEGO_SPEED)); legoEV3BrickList.add(new LegoEv3MotorStopBrick(LegoEv3MotorStopBrick.Motor.MOTOR_A)); legoEV3BrickList.add(new LegoEv3PlayToneBrick(BrickValues.LEGO_FREQUENCY, BrickValues.LEGO_DURATION, BrickValues.LEGO_VOLUME)); legoEV3BrickList.add(new LegoEv3SetLedBrick(LegoEv3SetLedBrick.LedStatus.LED_GREEN)); return legoEV3BrickList; }
Source:
public void initialize() { getDiskModel().initialize(); getDiskModel().getSize().setIsChangeable(false); imageInfoModel.getEntityChangedEvent().addListener((ev, sender, args) -> { getDiskModel().getSize().setIsChangeable(false); if (imageInfoModel.getContentType() == DiskContentType.ISO) { getDiskModel().getAlias().setEntity(imageInfoModel.getFileName()); getDiskModel().getDescription().setEntity(imageInfoModel.getFileName()); getDiskModel().getSize().setEntity(imageInfoModel.getActualSize()); } else { getDiskModel().getAlias().setEntity(null); getDiskModel().getDescription().setEntity(null); getDiskModel().getSize().setEntity( ((NewDiskModel) getDiskModel()).getMinimumDiskSize()); } }); }

Target:
public void initialize() { getDiskModel().initialize(); imageInfoModel.getEntityChangedEvent().addListener((ev, sender, args) -> { getDiskModel().getSize().setIsChangeable(false); if (imageInfoModel.getContentType() == DiskContentType.ISO) { getDiskModel().getAlias().setEntity(imageInfoModel.getFileName()); getDiskModel().getDescription().setEntity(imageInfoModel.getFileName()); getDiskModel().getSize().setEntity(imageInfoModel.getActualSize()); } else { getDiskModel().getAlias().setEntity(null); getDiskModel().getDescription().setEntity(null); getDiskModel().getSize().setEntity( ((NewDiskModel) getDiskModel()).getMinimumDiskSize()); } }); }
Source:
public static void reset() { injectCalled = false; postConstructCalled = false; preDestroyCalled = false; }

Target:
public static void reset() { injectCalled = false; postConstructCalled = false; preDestroyCalled = false; produceCalled = false; }
Source:
public CompositeSearchKeywordResolver() { this.size = 0; this.resolvers = new SearchKeywordResolver[2]; }

Target:
public CompositeSearchKeywordResolver() { this.resolvers = new ArrayList<>(NUMBER_OF_DEFAULT_IMPLEMENTATIONS); }
Source:
public List<Span> getChildren(String tenant, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } Set<Span> children = childrenCache.get(id); return children == null ? null : new ArrayList<>(children); }

Target:
public Set<Span> getChildren(String tenant, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } Set<Span> children = childrenCache.get(id); return children == null ? null : Collections.unmodifiableSet(children); }
Source:
public void pulse() { super.pulse(); if (ticksLived % 11 == 0) { if (location.getBlock().getRelative(getAttachedFace()).getType() == Material.AIR) { if (EventFactory.callEvent(new HangingBreakEvent(this, RemoveCause.PHYSICS)).isCancelled()) { return; } world.dropItemNaturally(location, new ItemStack(Material.PAINTING)); remove(); } } if (ticksLived % (20 * 5) == 0 && isObstructed()) { if (EventFactory.callEvent(new HangingBreakEvent(this, RemoveCause.PHYSICS)).isCancelled()) { return; } if (location.getBlock().getRelative(getAttachedFace()).getType() == Material.AIR) { world.dropItemNaturally(location, new ItemStack(Material.PAINTING)); remove(); } } }

Target:
public void pulse() { super.pulse(); if (ticksLived % (20 * 5) == 0 && isObstructed()) { if (EventFactory.callEvent(new HangingBreakEvent(this, RemoveCause.PHYSICS)).isCancelled()) { return; } if (location.getBlock().getRelative(getAttachedFace()).getType() == Material.AIR) { world.dropItemNaturally(location, new ItemStack(Material.PAINTING)); remove(); } } }
Source:
public ReplyHeader submitRequest(RequestHeader h, Record request, Record response, WatchRegistration watchRegistration, WatchDeregistration watchDeregistration) throws InterruptedException { ReplyHeader r = new ReplyHeader(); Packet packet = queuePacket(h, r, request, response, null, null, null, null, watchRegistration, watchDeregistration); synchronized (packet) { long waitStartTime = System.currentTimeMillis(); while (!packet.finished) { packet.wait(requestTimeout); if (!packet.finished && ((System.currentTimeMillis() - waitStartTime) >= requestTimeout)) { LOG.error("Time out error occurred for the packet '{}'.", packet); r.setErr(Code.TIMEOUT.intValue()); break; } } } if (r.getErr() == Code.TIMEOUT.intValue()) { sendThread.cleanAndNotifyState(); } return r; }

Target:
public ReplyHeader submitRequest(RequestHeader h, Record request, Record response, WatchRegistration watchRegistration, WatchDeregistration watchDeregistration) throws InterruptedException { ReplyHeader r = new ReplyHeader(); Packet packet = queuePacket(h, r, request, response, null, null, null, null, watchRegistration, watchDeregistration); synchronized (packet) { if (requestTimeout > 0) { waitForPacketFinish(r, packet); } else { while (!packet.finished) { packet.wait(); } } } if (r.getErr() == Code.REQUESTTIMEOUT.intValue()) { sendThread.cleanAndNotifyState(); } return r; }
Source:
public SortedMap<byte[], RowResult<byte[]>> getRows(TableReference tableRef, Iterable<byte[]> rows, ColumnSelection columnSelection) { if (Iterables.isEmpty(rows)) { if (log.isTraceEnabled()) { log.trace("Attempted getRows on '{}' table and with empty rows argument", tableRef, columnSelection, new Exception()); } else if (log.isDebugEnabled()) { log.debug("Attempted getRows on '{}' table and with empty rows argument", tableRef, columnSelection); } return AbstractTransaction.EMPTY_SORTED_ROWS; } if (columnSelection.allColumnsSelected()) { SortedMap<byte[], RowResult<byte[]>> loaded = super.getRows(tableRef, rows, columnSelection); cacheLoadedRows(tableRef, loaded.values()); return loaded; } else { Set<byte[]> toLoad = Sets.newHashSet(); ImmutableSortedMap.Builder<byte[], RowResult<byte[]>> inCache = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); for (byte[] row : rows) { ImmutableSortedMap.Builder<byte[], byte[]> matches = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); boolean nonEmpty = false; boolean shouldLoad = false; for (byte[] col : columnSelection.getSelectedColumns()) { byte[] val = getCachedCellIfPresent(tableRef, Cell.create(row, col)); if (val == null) { shouldLoad = true; break; } else if (val.length != 0) { matches.put(col, val); nonEmpty = true; } } if (shouldLoad) { toLoad.add(row); } else if (nonEmpty) { inCache.put(row, RowResult.create(row, matches.build())); } } SortedMap<byte[], RowResult<byte[]>> results = super.getRows(tableRef, toLoad, columnSelection); cacheLoadedRows(tableRef, results.values()); inCache.putAll(results); return inCache.build(); } }

Target:
public SortedMap<byte[], RowResult<byte[]>> getRows(TableReference tableRef, Iterable<byte[]> rows, ColumnSelection columnSelection) { if (Iterables.isEmpty(rows)) { return AbstractTransaction.EMPTY_SORTED_ROWS; } if (columnSelection.allColumnsSelected()) { SortedMap<byte[], RowResult<byte[]>> loaded = super.getRows(tableRef, rows, columnSelection); cacheLoadedRows(tableRef, loaded.values()); return loaded; } else { Set<byte[]> toLoad = Sets.newHashSet(); ImmutableSortedMap.Builder<byte[], RowResult<byte[]>> inCache = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); for (byte[] row : rows) { ImmutableSortedMap.Builder<byte[], byte[]> matches = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); boolean nonEmpty = false; boolean shouldLoad = false; for (byte[] col : columnSelection.getSelectedColumns()) { byte[] val = getCachedCellIfPresent(tableRef, Cell.create(row, col)); if (val == null) { shouldLoad = true; break; } else if (val.length != 0) { matches.put(col, val); nonEmpty = true; } } if (shouldLoad) { toLoad.add(row); } else if (nonEmpty) { inCache.put(row, RowResult.create(row, matches.build())); } } SortedMap<byte[], RowResult<byte[]>> results = super.getRows(tableRef, toLoad, columnSelection); cacheLoadedRows(tableRef, results.values()); inCache.putAll(results); return inCache.build(); } }
Source:
public GlusterBrick update(GlusterBrick incomingBrick) { validateParameters(incomingBrick, "id", "status"); QueryIdResolver<Guid> brickResolver = new QueryIdResolver<Guid>(VdcQueryType.GetGlusterBrickById, IdQueryParameters.class); GlusterBrickEntity entity = getEntity(brickResolver, true); return performUpdate(incomingBrick, entity, map(entity), brickResolver, VdcActionType.UpdateGlusterVolumeBricks, new UpdateParametersProvider()); }

Target:
public GlusterBrick update(GlusterBrick incomingBrick) { validateParameters(incomingBrick, "id", "status", "status.detail"); QueryIdResolver<Guid> brickResolver = new QueryIdResolver<Guid>(VdcQueryType.GetGlusterBrickById, IdQueryParameters.class); GlusterBrickEntity entity = getEntity(brickResolver, true); return performUpdate(incomingBrick, entity, map(entity), brickResolver, VdcActionType.UpdateGlusterVolumeBricks, new UpdateParametersProvider()); }
Source:
public static Date getProcessValidityStart(Process process, String clusterName) throws FalconException { Cluster feedCluster = getCluster(process, clusterName); if (feedCluster != null) { return feedCluster.getValidity().getStart(); } else { throw new FalconException("No matching cluster " + clusterName + "found for feed " + process.getName()); } }

Target:
public static Date getProcessValidityStart(Process process, String clusterName) throws FalconException { Cluster processCluster = getCluster(process, clusterName); if (processCluster != null) { return processCluster.getValidity().getStart(); } else { throw new FalconException("No matching cluster " + clusterName + "found for process " + process.getName()); } }
Source:
public void checkinRoles(List<Role> roles) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Role role : roles) { List<Role> result = queryService.queryByString(Role.class, "name:\"" + role.getName() + "\""); if (result.size() == 0) { commit.addInsert(role); } else { commit.addUpdate(role); } } persistService.commit(commit); revokePersistenceAccess(); }

Target:
public void checkinRoles(List<Role> roles) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Role role : roles) { List<Role> result = queryService.query(Role.class, QueryRequest.query("name", role.getName())); if (result.size() == 0) { commit.addInsert(role); } else { commit.addUpdate(role); } } persistService.commit(commit); revokePersistenceAccess(); }
Source:
public static boolean getScalabilityCapabilitiesOfModule(Map<String, Object> modules, String elementName) { try { Map<String, Object> moduleInfo; if (modules.containsKey(elementName)) { moduleInfo = (Map<String, Object>) modules.get(elementName); } else { return true; } Map<String, Object> moduleProperties; if (moduleInfo.containsKey(TOSCAkeywords.MODULE_PROPERTIES_TAG)) { moduleProperties = (Map<String, Object>) moduleInfo.get(TOSCAkeywords.MODULE_PROPERTIES_TAG); } else { return true; } if(moduleProperties.containsKey(TOSCAkeywords.MODULE_AUTOSCALE_PROPERTY)){ return (boolean) moduleProperties.get(TOSCAkeywords.MODULE_AUTOSCALE_PROPERTY); }else { return true; } } catch (ClassCastException e) { log.debug("For module it was not found information in the AAM regarding its possibility to scale", elementName); } return true; }

Target:
public static boolean getScalabilityCapabilitiesOfModule(Map<String, Object> modules, String elementName) { try { Map<String, Object> moduleInfo; if (modules.containsKey(elementName)) { moduleInfo = (Map<String, Object>) modules.get(elementName); } else { return DEFAULT_SCALABILITY; } Map<String, Object> moduleProperties; if (moduleInfo.containsKey(TOSCAkeywords.MODULE_PROPERTIES_TAG)) { moduleProperties = (Map<String, Object>) moduleInfo.get(TOSCAkeywords.MODULE_PROPERTIES_TAG); } else { return DEFAULT_SCALABILITY; } if(moduleProperties.containsKey(TOSCAkeywords.MODULE_AUTOSCALE_PROPERTY)){ return (boolean) moduleProperties.get(TOSCAkeywords.MODULE_AUTOSCALE_PROPERTY); }else { return DEFAULT_SCALABILITY; } } catch (ClassCastException e) { log.debug("For module it was not found information in the AAM regarding its possibility to scale", elementName); } return DEFAULT_SCALABILITY; }
Source:
protected void buildVmCD() { XmlRpcStruct struct; if (vm.getVmPayload() != null && vm.getVmPayload().getType() == VmDeviceType.CDROM) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, vm.getVmPayload().getSpecParams(), true, true, true); struct = new XmlRpcStruct(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, ""); } else if (vm.isRunOnce() && !StringHelper.isNullOrEmpty(vm.getCdPath())) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, vm.getVmPayload().getSpecParams(), true, true, true); struct = new XmlRpcStruct(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, vm.getCdPath()); } else { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDAO() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName()); for (VmDevice vmDevice : vmDevices) { if (!vmDevice.getIsManaged()) { continue; } if (!VmPayload.IsPayload(vmDevice.getSpecParams()) && vmDevices.size() > 1) { continue; } struct = new XmlRpcStruct(); String file = (String) vmDevice.getSpecParams().get(VdsProperties.Path); addCdDetails(vmDevice, struct); addAddress(vmDevice, struct); if (!StringHelper.isNullOrEmpty(file)) { addCdOrFloppyFileDetails(file, struct); } else { file = ""; } addDevice(struct, vmDevice, file); break; } } }

Target:
protected void buildVmCD() { XmlRpcStruct struct; if (vm.getVmPayload() != null && vm.getVmPayload().getType() == VmDeviceType.CDROM) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, vm.getVmPayload().getSpecParams(), true, true, true); struct = new XmlRpcStruct(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, ""); } else if (vm.isRunOnce() && !StringHelper.isNullOrEmpty(vm.getCdPath())) { VmDevice vmDevice = new VmDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName(), "", 0, (vm.getVmPayload() == null) ? null : vm.getVmPayload().getSpecParams(), true, true, true); struct = new XmlRpcStruct(); addCdDetails(vmDevice, struct); addDevice(struct, vmDevice, vm.getCdPath()); } else { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDAO() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceType.DISK.getName(), VmDeviceType.CDROM.getName()); for (VmDevice vmDevice : vmDevices) { if (!vmDevice.getIsManaged()) { continue; } if (!VmPayload.isPayload(vmDevice.getSpecParams()) && vmDevices.size() > 1) { continue; } struct = new XmlRpcStruct(); String file = (String) vmDevice.getSpecParams().get(VdsProperties.Path); addCdDetails(vmDevice, struct); addAddress(vmDevice, struct); if (!StringHelper.isNullOrEmpty(file)) { addCdOrFloppyFileDetails(file, struct); } else { file = ""; } addDevice(struct, vmDevice, file); break; } } }
Source:
private Activity getCurrentActivity() { final Activity[] activity = new Activity[1]; java.util.Collection<Activity> activities = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(Stage.RESUMED); activity[0] = Iterables.getOnlyElement(activities); return activity[0]; }

Target:
private Activity getCurrentActivity() { Activity activity; java.util.Collection<Activity> activities = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(Stage.RESUMED); activity = Iterables.getOnlyElement(activities); return activity; }
Source:
private void breakBlock(BlockMenu menu, Collection<ItemStack> drops, Block block) { for (ItemStack drop : drops) { menu.pushItem(drop, getOutputSlots()); } InfiniteBlockGenerator generator = InfiniteBlockGenerator.findAt(block, firesEvent.getValue()); if (generator != null) { block.getWorld().playSound(block.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 0.075F, 0.8F); block.getWorld().spawnParticle(Particle.SMOKE_NORMAL, block.getX() + 0.5, block.getY() + 1.25, block.getZ() + 0.5, 8, 0.5, 0.5, 0.5, 0.015); } else { block.setType(Material.AIR); } }

Target:
private void breakBlock(BlockMenu menu, Collection<ItemStack> drops, Block block) { for (ItemStack drop : drops) { menu.pushItem(drop, getOutputSlots()); } InfiniteBlockGenerator generator = InfiniteBlockGenerator.findAt(block); if (generator != null) { if (firesEvent.getValue()) { generator.callEvent(block); } block.getWorld().playSound(block.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 0.075F, 0.8F); block.getWorld().spawnParticle(Particle.SMOKE_NORMAL, block.getX() + 0.5, block.getY() + 1.25, block.getZ() + 0.5, 8, 0.5, 0.5, 0.5, 0.015); } else { block.setType(Material.AIR); } }
Source:
private CompletionStage<RestResponse> getCaches(RestRequest request) { NettyRestResponse.Builder responseBuilder = checkCacheManager(request); if (responseBuilder.getHttpStatus() == NOT_FOUND) return completedFuture(responseBuilder.build()); class CacheInfo { public String status; public String name; public String type; public long size; public boolean simpleCache; public boolean transactional; public boolean persistent; } try { Set<CacheInfo> caches = cacheManager.getCacheNames().stream().map(cacheName -> { Cache<Object, Object> cache = cacheManager.getCache(cacheName); CacheInfo cacheInfo = new CacheInfo(); cacheInfo.name = cacheName; cacheInfo.type = cache.getCacheConfiguration().clustering().cacheMode().toCacheType(); cacheInfo.status = cache.getStatus().name(); cacheInfo.size = cache.size(); cacheInfo.simpleCache = cache.getCacheConfiguration().simpleCache(); cacheInfo.transactional = cache.getCacheConfiguration().transaction().transactionMode().isTransactional(); cacheInfo.persistent = false; return cacheInfo; }).collect(Collectors.toSet()); byte[] bytes = objectMapper.writeValueAsBytes(caches); responseBuilder.contentType(APPLICATION_JSON).entity(bytes); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }

Target:
private CompletionStage<RestResponse> getCaches(RestRequest request) { NettyRestResponse.Builder responseBuilder = checkCacheManager(request); if (responseBuilder.getHttpStatus() == NOT_FOUND) return completedFuture(responseBuilder.build()); return CompletableFuture.supplyAsync(() -> { try { Set<CacheInfo> caches = cacheManager.getCacheNames().stream().map(cacheName -> { Cache<Object, Object> cache = cacheManager.getCache(cacheName); CacheInfo cacheInfo = new CacheInfo(); cacheInfo.name = cacheName; Configuration cacheConfiguration = cache.getCacheConfiguration(); cacheInfo.type = cacheConfiguration.clustering().cacheMode().toCacheType(); cacheInfo.status = cache.getStatus().name(); cacheInfo.size = cache.size(); cacheInfo.simpleCache = cacheConfiguration.simpleCache(); cacheInfo.transactional = cacheConfiguration.transaction().transactionMode().isTransactional(); cacheInfo.persistent = cacheConfiguration.persistence().usingStores(); cacheInfo.bounded = cacheConfiguration.expiration().maxIdle() != -1 || cacheConfiguration.expiration().lifespan() != -1 ; cacheInfo.secured = cacheConfiguration.security().authorization().enabled(); cacheInfo.indexed = cacheConfiguration.indexing().index().isEnabled(); cacheInfo.hasRemoteBackup = cacheConfiguration.sites().hasEnabledBackups(); return cacheInfo; }).collect(Collectors.toSet()); byte[] bytes = objectMapper.writeValueAsBytes(caches); responseBuilder.contentType(APPLICATION_JSON).entity(bytes); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return responseBuilder.build(); }, executor); }
Source:
private void writeOs() { writer.writeStartElement("os"); writer.writeStartElement("type"); writer.writeAttributeString("arch", vm.getClusterArch().toString()); writer.writeAttributeString("machine", emulatedMachine); writer.writeRaw("hvm"); writer.writeEndElement(); if (!StringUtils.isEmpty(vm.getInitrdUrl())) { writer.writeElement("initrd", vm.getInitrdUrl()); } if (!StringUtils.isEmpty(vm.getKernelUrl())) { writer.writeElement("kernel", vm.getKernelUrl()); if (!StringUtils.isEmpty(vm.getKernelParams())) { writer.writeElement("cmdline", vm.getKernelParams()); } } if (vm.getClusterArch().getFamily() == ArchitectureType.x86) { writer.writeStartElement("smbios"); writer.writeAttributeString("mode", "sysinfo"); writer.writeEndElement(); } if (vm.isBootMenuEnabled()) { writer.writeStartElement("bootmenu"); writer.writeAttributeString("enable", "yes"); writer.writeAttributeString("timeout", String.valueOf(BOOT_MENU_TIMEOUT)); writer.writeEndElement(); } if (serialConsolePath != null && vm.getClusterArch().getFamily() == ArchitectureType.x86) { writer.writeStartElement("bios"); writer.writeAttributeString("useserial", "yes"); writer.writeEndElement(); } if (vm.getBiosType().isOvmf()) { writer.writeStartElement("loader"); writer.writeAttributeString("readonly", "yes"); writer.writeAttributeString("secure", vm.getBiosType() == BiosType.Q35_SECURE_BOOT ? "yes" : "no"); writer.writeAttributeString("type", "pflash"); writer.writeRaw("/usr/share/OVMF/OVMF_CODE.secboot.fd"); writer.writeEndElement(); writer.writeStartElement("nvram"); writer.writeAttributeString("template", "/usr/share/OVMF/OVMF_VARS.fd"); writer.writeRaw(String.format("/var/lib/libvirt/qemu/nvram/%s.fd", vm.getId())); writer.writeEndElement(); } writer.writeEndElement(); }

Target:
private void writeOs() { writer.writeStartElement("os"); writer.writeStartElement("type"); writer.writeAttributeString("arch", vm.getClusterArch().toString()); writer.writeAttributeString("machine", emulatedMachine); writer.writeRaw("hvm"); writer.writeEndElement(); if (!StringUtils.isEmpty(vm.getInitrdUrl())) { writer.writeElement("initrd", vm.getInitrdUrl()); } if (!StringUtils.isEmpty(vm.getKernelUrl())) { writer.writeElement("kernel", vm.getKernelUrl()); if (!StringUtils.isEmpty(vm.getKernelParams())) { writer.writeElement("cmdline", vm.getKernelParams()); } } if (vm.getClusterArch().getFamily() == ArchitectureType.x86) { writer.writeStartElement("smbios"); writer.writeAttributeString("mode", "sysinfo"); writer.writeEndElement(); } if (vm.isBootMenuEnabled()) { writer.writeStartElement("bootmenu"); writer.writeAttributeString("enable", "yes"); writer.writeAttributeString("timeout", String.valueOf(BOOT_MENU_TIMEOUT)); writer.writeEndElement(); } if (serialConsolePath != null && vm.getClusterArch().getFamily() == ArchitectureType.x86) { writer.writeStartElement("bios"); writer.writeAttributeString("useserial", "yes"); writer.writeEndElement(); } writer.writeEndElement(); }
Source:
public Result execute(UIExecutionContext context) throws Exception { JavaResource javaResource = targetClass.getValue(); JavaClassSource targetClass = javaResource.getJavaType(); List<FieldSource<JavaClassSource>> selectedFields = new ArrayList<>(); for(String fieldString : fields.getValue()) { selectedFields.add(targetClass.getField(fieldString)); } Refactory.createHashCodeAndEquals(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); setCurrentWorkingResource(context, targetClass); return Results.success("Methods were generated succesfully"); }

Target:
public Result execute(UIExecutionContext context) throws Exception { JavaResource javaResource = targetClass.getValue(); JavaClassSource targetClass = javaResource.getJavaType(); List<FieldSource<JavaClassSource>> selectedFields = new ArrayList<>(); for(String fieldString : fields.getValue()) { selectedFields.add(targetClass.getField(fieldString)); } UIPrompt prompt = context.getPrompt(); if(targetClass.hasMethodSignature("equals", Object.class)) { if(prompt.promptBoolean("Class already has an equals method. Would you like it to be overwritten?")) { Refactory.createEquals(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); } } else { Refactory.createEquals(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); } if(targetClass.hasMethodSignature("hashcode")) { if(prompt.promptBoolean("Class already has a hashcode method. Would you like it to be overwritten?")) { Refactory.createHashCode(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); } } else { Refactory.createHashCode(targetClass, selectedFields.toArray(new FieldSource<?>[selectedFields.size()])); } setCurrentWorkingResource(context, targetClass); return Results.success("Command for generation ended successfully"); }
Source:
private static void addAllCus(HashSet<ICompilationUnit> collector, IJavaElement javaElement) throws JavaModelException { switch (javaElement.getElementType()) { case IJavaElement.JAVA_PROJECT: IJavaProject javaProject= (IJavaProject) javaElement; IPackageFragmentRoot[] packageFragmentRoots= javaProject.getPackageFragmentRoots(); for (IPackageFragmentRoot packageFragmentRoot2 : packageFragmentRoots) addAllCus(collector, packageFragmentRoot2); return; case IJavaElement.PACKAGE_FRAGMENT_ROOT: IPackageFragmentRoot packageFragmentRoot= (IPackageFragmentRoot) javaElement; if (packageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE) return; IJavaElement[] packageFragments= packageFragmentRoot.getChildren(); for (IJavaElement packageFragment2 : packageFragments) addAllCus(collector, packageFragment2); return; case IJavaElement.PACKAGE_FRAGMENT: IPackageFragment packageFragment= (IPackageFragment) javaElement; collector.addAll(Arrays.asList(packageFragment.getCompilationUnits())); return; case IJavaElement.COMPILATION_UNIT: collector.add((ICompilationUnit) javaElement); return; default: IJavaElement cu= javaElement.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) collector.add((ICompilationUnit) cu); } }

Target:
private static void addAllCus(HashSet<ICompilationUnit> collector, IJavaElement javaElement) throws JavaModelException { switch (javaElement.getElementType()) { case IJavaElement.JAVA_PROJECT: IJavaProject javaProject= (IJavaProject) javaElement; IPackageFragmentRoot[] packageFragmentRoots= javaProject.getPackageFragmentRoots(); for (int i= 0; i < packageFragmentRoots.length; i++) addAllCus(collector, packageFragmentRoots[i]); return; case IJavaElement.PACKAGE_FRAGMENT_ROOT: IPackageFragmentRoot packageFragmentRoot= (IPackageFragmentRoot) javaElement; if (packageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE) return; IJavaElement[] packageFragments= packageFragmentRoot.getChildren(); for (int j= 0; j < packageFragments.length; j++) addAllCus(collector, packageFragments[j]); return; case IJavaElement.PACKAGE_FRAGMENT: IPackageFragment packageFragment= (IPackageFragment) javaElement; collector.addAll(Arrays.asList(packageFragment.getCompilationUnits())); return; case IJavaElement.COMPILATION_UNIT: collector.add((ICompilationUnit) javaElement); return; default: IJavaElement cu= javaElement.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) collector.add((ICompilationUnit) cu); } }
Source:
protected Map<String, Object> postProcessSourceProperties(String sourceName, Map<String, Object> properties) { if(PatternMatchUtils.simpleMatch(sourceNamePatterns, sourceName)) { properties.replaceAll((key, value) -> "******"); } return super.postProcessSourceProperties(sourceName, properties); }

Target:
protected Map<String, Object> postProcessSourceProperties(String sourceName, Map<String, Object> properties) { if(PatternMatchUtils.simpleMatch(sourceNamePatterns, sourceName)) { return Collections.singletonMap("******", message); } return super.postProcessSourceProperties(sourceName, properties); }
Source:
public abstract E parseFromInput(String input, ParserContext context) throws InputParseException; public List<String> getSuggestions() { return Lists.newArrayList(); }

Target:
public abstract E parseFromInput(String input, ParserContext context) throws InputParseException; public List<String> getSuggestions() { return Collections.emptyList(); }
Source:
private void trackAATestCourseOutline() { if (!isVideoMode && environment.getConfig().getFirebaseConfig().isEnabled()) { FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); firebaseRemoteConfig.fetchAndActivate().addOnCompleteListener(task -> { String group = firebaseRemoteConfig.getString(Analytics.Keys.AA_EXPERIMENT); if (!TextUtils.isEmpty(group)) { final Map<String, String> values = new HashMap<>(); values.put(Analytics.Keys.EXPERIMENT, Analytics.Keys.AA_EXPERIMENT); values.put(Analytics.Keys.GROUP, group); values.put(Analytics.Keys.USER_ID, environment.getLoginPrefs().getCurrentUserProfile().id.toString()); values.put(Analytics.Keys.COURSE_ID, courseData.getCourse().getId()); environment.getAnalyticsRegistry().trackRemoteConfigs(values); } }); } }

Target:
private void trackAATestCourseOutline() { if (!isVideoMode && environment.getConfig().getFirebaseConfig().isEnabled()) { final FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); firebaseRemoteConfig.fetchAndActivate().addOnCompleteListener(task -> { final String group = firebaseRemoteConfig.getString(Analytics.Keys.AA_EXPERIMENT); if (!TextUtils.isEmpty(group)) { final Map<String, String> values = new HashMap<>(); values.put(Analytics.Keys.EXPERIMENT, Analytics.Keys.AA_EXPERIMENT); values.put(Analytics.Keys.GROUP, group); values.put(Analytics.Keys.USER_ID, environment.getLoginPrefs().getCurrentUserProfile().id.toString()); values.put(Analytics.Keys.COURSE_ID, courseData.getCourse().getId()); environment.getAnalyticsRegistry().trackExperimentParams(Analytics.Events.MOBILE_EXPERIMENT_EVALUATED, values); } }); } }