auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private final void pyPassByRef() { Set<JsonObject> pyops = findOperatorsByKinds(graph, PY_FUNC_OPS); if (pyops.isEmpty()) return; for (JsonObject pyop : pyops) { JsonArray outputs = array(pyop, "outputs"); if (outputs == null || outputs.size() == 0) continue; assert outputs.size() == 1; int[] connCounts = new int[outputs.size()]; for (int port = 0; port < connCounts.length; port++) { connCounts[port] = -1; JsonObject output = outputs.get(port).getAsJsonObject(); if (!"tuple<blob __spl_po>".equals(jstring(output, "type"))) continue; JsonArray conns = array(output, "connections"); if (conns == null || conns.size() == 0) { connCounts[port] = 0; continue; } boolean canPassByRef = true; Set<JsonObject> connected = getDownstream(pyop, graph); for (JsonObject connectedOp : connected) { if (!PY_FUNC_OPS.contains(kind(connectedOp))) { canPassByRef = false; break; } if (!kind(connectedOp).endsWith("::Map") && !kind(connectedOp).endsWith("::ForEach")) { canPassByRef = false; break; } } if (canPassByRef) connCounts[port] = conns.size(); } boolean paramNeeded = false; for (int i = 0; i < connCounts.length; i++) { if (connCounts[0] != -1) { paramNeeded = true; break; } } if (paramNeeded) { JsonObject value = new JsonObject(); if (connCounts.length == 1) value.addProperty("value", connCounts[0]); else { JsonArray ocs = new JsonArray(); for (int oc : connCounts) ocs.add(new JsonPrimitive(oc)); value.add("value", ocs); } GraphUtilities.addOpParameter(pyop, "outputConnections", value); } } }

Target:
private final void pyPassByRef() { Set<JsonObject> pyops = findOperatorsByKinds(graph, PY_FUNC_OPS); if (pyops.isEmpty()) return; for (JsonObject pyop : pyops) { JsonArray outputs = array(pyop, "outputs"); if (outputs == null || outputs.size() == 0) continue; assert outputs.size() == 1; int[] connCounts = new int[outputs.size()]; for (int port = 0; port < connCounts.length; port++) { connCounts[port] = -1; JsonObject output = outputs.get(port).getAsJsonObject(); if (!"tuple<blob __spl_po>".equals(jstring(output, "type"))) continue; JsonArray conns = array(output, "connections"); if (conns == null || conns.size() == 0) { connCounts[port] = 0; continue; } boolean canPassByRef = true; Set<JsonObject> connected = getDownstream(pyop, graph); for (JsonObject connectedOp : connected) { if (!PY_FUNC_OPS.contains(kind(connectedOp))) { canPassByRef = false; break; } if (!kind(connectedOp).endsWith("::Map") && !kind(connectedOp).endsWith("::ForEach")) { canPassByRef = false; break; } } if (canPassByRef) connCounts[port] = conns.size(); } boolean paramNeeded = false; for (int oc: connCounts) { if (oc != -1) { paramNeeded = true; break; } } if (paramNeeded) { JsonObject value = new JsonObject(); if (connCounts.length == 1) value.addProperty("value", connCounts[0]); else { JsonArray ocs = new JsonArray(); for (int oc : connCounts) ocs.add(new JsonPrimitive(oc)); value.add("value", ocs); } GraphUtilities.addOpParameter(pyop, "outputConnections", value); } } }
Source:
public ApplicationRegistry getMetrics(@RequestParam Map<String, String> filters) throws IOException { boolean all = filters.get("all") != null; String filterMeterNameRegex = getWithDefault(filters, "meterNameRegex", ""); String filterTagNameRegex = getWithDefault(filters, "tagNameRegex", ""); String filterTagValueRegex = getWithDefault(filters, "tagValueRegex", ""); TagMeasurementFilter queryFilter = new TagMeasurementFilter( filterMeterNameRegex, filterTagNameRegex, filterTagValueRegex); MeasurementFilter filter; if (all) { filter = queryFilter; } else { filter = new ChainedMeasurementFilter(queryFilter, getDefaultMeasurementFilter()); } ApplicationRegistry response = new ApplicationRegistry(); response.setApplicationName(applicationName); response.setApplicationVersion(applicationVersion); response.setMetrics(encodeRegistry(registry, filter)); return response; }

Target:
public ApplicationRegistry getMetrics(@RequestParam Map<String, String> filters) throws IOException { boolean all = filters.get("all") != null; String filterMeterNameRegex = filters.getOrDefault("meterNameRegex", ""); String filterTagNameRegex = filters.getOrDefault("tagNameRegex", ""); String filterTagValueRegex = filters.getOrDefault("tagValueRegex", ""); TagMeasurementFilter queryFilter = new TagMeasurementFilter( filterMeterNameRegex, filterTagNameRegex, filterTagValueRegex); Predicate<Measurement> filter; if (all) { filter = queryFilter; } else { filter = queryFilter.and(getDefaultMeasurementFilter()); } ApplicationRegistry response = new ApplicationRegistry(); response.setApplicationName(applicationName); response.setApplicationVersion(applicationVersion); response.setMetrics(encodeRegistry(registry, filter)); return response; }
Source:
private static boolean isHostnameVerifierSignature(LambdaExpressionTree lambdaExpressionTree) { List<VariableTree> parameters = lambdaExpressionTree.parameters(); return lambdaExpressionTree.symbolType().isSubtypeOf("javax.net.ssl.HostnameVerifier") && parameters.size() == 2 && TYPE_CRITERIA_STRING.test(parameters.get(0).type().symbolType()) && TYPE_CRITERIA_SSL_SESSION.test(parameters.get(1).type().symbolType()); }

Target:
private static boolean isHostnameVerifierSignature(LambdaExpressionTree lambdaExpressionTree) { return lambdaExpressionTree.symbolType().isSubtypeOf("javax.net.ssl.HostnameVerifier"); }
Source:
public ListenableFuture<Void> write(String str, Charset charset) { return write(str, charset, null); }

Target:
public ListenableFuture<Void> write(String str, Charset charset) { return write(str, charset, ImmutableMap.<String, String>of()); }
Source:
private void addNotification(Context context,File file){ NotificationCompat.Builder builder = new NotificationCompat.Builder(this,"notification_channel") .addAction(R.drawable.ic_share_black_24dp, getString(R.string.share_notification), shareFileIntent(context,file)) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(getString(R.string.download_complete)) .setContentText(file.toString()); Intent notificationIntent = openFile(file); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(contentIntent); NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); manager.notify(0, builder.build()); }

Target:
private void addNotification(Context context,File file){ NotificationCompat.Builder builder = new NotificationCompat.Builder(this,"notification_channel") .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(getString(R.string.download_complete)) .setContentText(file.toString()); if (Build.VERSION.SDK_INT >= 21) { NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.ic_share_black_24dp, getString(R.string.share_notification), shareFileIntent(context,file)).build(); builder.addAction(action); } else{ NotificationCompat.Action action = new NotificationCompat.Action.Builder(0, getString(R.string.share_notification), shareFileIntent(context,file)).build(); builder.addAction(action); } Intent notificationIntent = openFile(file); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(contentIntent); NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); if(manager!=null) { manager.notify(0, builder.build()); } }
Source:
public static TServerSocket createTServerSocket(String portRange) throws IOException { TServerSocket tSocket = null; if (portRange == null || portRange.equals(":")) { try { tSocket = new TServerSocket(0); return tSocket; } catch (TTransportException e) { throw new IOException("Fail to create TServerSocket", e); } } int start = 1024; int end = 65535; String[] ports = portRange.split(":", -1); if (!ports[0].isEmpty()) { start = Integer.parseInt(ports[0]); } if (!ports[1].isEmpty()) { end = Integer.parseInt(ports[1]); } for (int i = start; i <= end; ++i) { try { tSocket = new TServerSocket(i); return tSocket; } catch (Exception e) { } } throw new IOException("No available port in the portRange: " + portRange); }

Target:
public static TServerSocket createTServerSocket(String portRange) throws IOException { TServerSocket tSocket = null; if (StringUtils.isBlank(portRange) || portRange.equals(":")) { try { tSocket = new TServerSocket(0); return tSocket; } catch (TTransportException e) { throw new IOException("Fail to create TServerSocket", e); } } int start = 1024; int end = 65535; String[] ports = portRange.split(":", -1); if (!ports[0].isEmpty()) { start = Integer.parseInt(ports[0]); } if (!ports[1].isEmpty()) { end = Integer.parseInt(ports[1]); } for (int i = start; i <= end; ++i) { try { tSocket = new TServerSocket(i); return tSocket; } catch (Exception e) { } } throw new IOException("No available port in the portRange: " + portRange); }
Source:
public void dispatch() { Set<RemoteProcedure> operationsTmp = operations; operations = Sets.newConcurrentHashSet(); if (operationsTmp.isEmpty()) { return; } remoteDispatch(getKey(), operations); operations.stream().filter(operation -> operation.storeInDispatchedQueue()) .forEach(operation -> dispatchedOperations.add(operation)); }

Target:
public void dispatch() { Set<RemoteProcedure> operationsTmp = operations; operations = Sets.newConcurrentHashSet(); if (operationsTmp.isEmpty()) { return; } remoteDispatch(getKey(), operations); operations.stream().filter(RemoteProcedure::storeInDispatchedQueue) .forEach(dispatchedOperations::add); }
Source:
private IDockerImage getDockerImage(final ILaunchConfiguration config, final IDockerConnection connection) throws CoreException { final String imageId = config.getAttribute( IRunDockerImageLaunchConfigurationConstants.IMAGE_NAME, (String) null); if (imageId != null) { return connection.getImage(imageId); } return null; }

Target:
private IDockerImage getDockerImage(final ILaunchConfiguration config, final IDockerConnection connection) throws CoreException { final String imageId = config.getAttribute( IRunDockerImageLaunchConfigurationConstants.IMAGE_NAME, (String) null); if (imageId != null) { return ((DockerConnection) connection).getImage(imageId); } return null; }
Source:
public void setDelay(int delay) { if ((this.delay > 999 && this.delay < delay) || (this.delay < 6 && this.delay > delay)) return; else this.delay = delay; }

Target:
public void setDelay(int delay) { if ((this.delay > 999 && this.delay < delay) || (this.delay < 6 && this.delay > delay)) { return; } else { this.delay = delay; } }
Source:
public void setUp() throws IOException { PreferencesService preferencesService = new PreferencesService(eventBus); preferencesService.postConstruct(); preferencesService.getPreferences().getMainWindow().setLastView("chat"); instance = new PrivateChatTabController(userService, chatService, platformService, preferencesService, playerService, audioService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, webViewConfigurer, threadPoolExecutor ); playerName = "testUser"; Player player = new Player(playerName); when(playerService.getPlayerForUsername(playerName)).thenReturn(player); TabPane tabPane = new TabPane(); tabPane.setSkin(new TabPaneSkin(tabPane)); loadFxml("theme/chat/private_chat_tab.fxml", clazz -> instance); instance.setReceiver(playerName); WaitForAsyncUtils.asyncFx(() -> { getRoot().getChildren().setAll(tabPane); tabPane.getTabs().add(instance.getRoot()); }); WaitForAsyncUtils.waitForFxEvents(); verify(webViewConfigurer).configureWebView(instance.messagesWebView); }

Target:
public void setUp() throws IOException { PreferencesService preferencesService = new PreferencesService(eventBus); preferencesService.postConstruct(); preferencesService.getPreferences().getMainWindow().setLastView(NavigationItem.CHAT.name()); instance = new PrivateChatTabController(clanService, userService, platformService, preferencesService, playerService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, audioService, chatService, mapService, webViewConfigurer, countryFlagService); playerName = "testUser"; Player player = new Player(playerName); when(playerService.getPlayerForUsername(playerName)).thenReturn(player); when(userService.getUsername()).thenReturn(playerName); when(uiService.getThemeFileUrl(CHAT_CONTAINER)).then(invocation -> getThemeFileUrl(invocation.getArgument(0))); TabPane tabPane = new TabPane(); tabPane.setSkin(new TabPaneSkin(tabPane)); loadFxml("theme/chat/private_chat_tab.fxml", clazz -> { if (clazz == PrivateUserInfoController.class) { return privateUserInfoController; } if (clazz == GameDetailController.class) { return gameDetailController; } if (clazz == WatchButtonController.class) { return watchButtonController; } return instance; }); instance.setReceiver(playerName); WaitForAsyncUtils.asyncFx(() -> { getRoot().getChildren().setAll(tabPane); tabPane.getTabs().add(instance.getRoot()); }); WaitForAsyncUtils.waitForFxEvents(); verify(webViewConfigurer).configureWebView(instance.messagesWebView); }
Source:
private Statistics computeStats(Dim dimension) { Statistics stats; Set<Integer> steps = new HashSet<Integer>(); for (int j = 0; j < fDataPoints.length; j++) { DataPoint dp = fDataPoints[j]; steps.add(new Integer(dp.getStep())); } if (steps.contains(new Integer(InternalPerformanceMeter.AVERAGE))) { stats = computeStatsFromAggregates(dimension); } else if (steps.contains(new Integer(InternalPerformanceMeter.AFTER))) { stats = computeStatsFromMeasurements(dimension, steps); } else { Assert.fail("illegal data set: contains neither AVERAGE nor AFTER values."); stats = null; } return stats; }

Target:
private Statistics computeStats(Dim dimension) { Statistics stats; Set<Integer> steps = new HashSet<>(); for (int j = 0; j < fDataPoints.length; j++) { DataPoint dp = fDataPoints[j]; steps.add(new Integer(dp.getStep())); } if (steps.contains(new Integer(InternalPerformanceMeter.AVERAGE))) { stats = computeStatsFromAggregates(dimension); } else if (steps.contains(new Integer(InternalPerformanceMeter.AFTER))) { stats = computeStatsFromMeasurements(dimension, steps); } else { Assert.fail("illegal data set: contains neither AVERAGE nor AFTER values."); stats = null; } return stats; }
Source:
public FilterWriter(boolean validationEnabled) throws JAXBException { this.marshaller = JAXBContext.newInstance(FilterType.class).createMarshaller(); if (validationEnabled) { LOGGER.info("Loading filter schemas..."); URL schemaLocation = FilterWriter.class.getResource(FILTER_XSD_RESOURCE_PATH); SchemaFactory schemaFactory = SchemaFactory.newInstance(SCHEMA_LANGUAGE); try { marshaller.setSchema(schemaFactory.newSchema(schemaLocation)); } catch (SAXException e) { throw new JAXBException("Error reading filter schema", e); } } }

Target:
public FilterWriter(boolean validationEnabled) throws JAXBException { this.marshaller = JAXBContext.newInstance(FilterType.class).createMarshaller(); if (validationEnabled) { LOGGER.info("Loading filter schemas"); URL schemaLocation = FilterWriter.class.getResource(FILTER_XSD_RESOURCE_PATH); SchemaFactory schemaFactory = SchemaFactory.newInstance(SCHEMA_LANGUAGE); try { marshaller.setSchema(schemaFactory.newSchema(schemaLocation)); } catch (SAXException e) { throw new JAXBException("Error reading filter schema", e); } } }
Source:
public void emitTuples() { if (currentWindowEmitCount < maxPerWindow) { POJO tuple = generatePOJO(); out.emit(tuple); currentWindowEmitCount++; logger.info("InputTuple: " + this.windowId + "-" + TimeBucket.MINUTE.roundDown(tuple.getTime()) + "-" + tuple.getTime() + "," + tuple.getAdvertiserId() + "," + tuple.getPublisherId() + "," + tuple.getLocationId() + "," + tuple.getClicks() + "," + tuple.getCost()); } }

Target:
public void emitTuples() { if (currentWindowEmitCount < maxPerWindow) { POJO tuple = generatePOJO(); out.emit(tuple); currentWindowEmitCount++; logger.info("InputTuple: " + this.windowId + "-" + TimeBucket.MINUTE.roundDown(tuple.getTime()) + "-" + tuple.getTime() + "," + tuple.getAdvertiserId() + "," + tuple.getPublisherId() + "," + tuple.getLocationId() + "," + tuple.getClicks() + "," + tuple.getCost()); } else { try { Thread.sleep(10); } catch (InterruptedException e) { logger.warn("Failed to sleep. Continuing..", e); } } }
Source:
public List<Project> getProjects() { List<Project> projects; try { projects = projectLoader.fetchAllActiveProjects(); for (Project proj : projects) { loadAllProjectFlows(proj); } } catch (ProjectManagerException e) { throw new RuntimeException("Could not load projects from store.", e); } return projects; }

Target:
public List<Project> getProjects() { List<Project> projects; try { projects = projectLoader.fetchAllActiveProjects(); } catch (ProjectManagerException e) { throw new RuntimeException("Could not load projects from store.", e); } return projects; }
Source:
public void testUpdateReusesIndexesString() { myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); SearchParameterMap m1 = new SearchParameterMap().add("family", new StringParam("family1")).setLoadSynchronous(true); SearchParameterMap m2 = new SearchParameterMap().add("family", new StringParam("family2")).setLoadSynchronous(true); myCountHolder.clear(); Patient pt = new Patient(); pt.addName().setFamily("FAMILY1"); IIdType id = myPatientDao.create(pt).getId().toUnqualifiedVersionless(); ourLog.info("Now have deleted", getQueryCount().getDelete()); ourLog.info("Now have inserts", getQueryCount().getInsert()); myCountHolder.clear(); assertEquals(1, myPatientDao.search(m1).size().intValue()); assertEquals(0, myPatientDao.search(m2).size().intValue()); ourLog.info("** About to update"); pt = new Patient(); pt.setId(id); pt.addName().setFamily("FAMILY2"); myPatientDao.update(pt); ourLog.info("Now have deletes", getQueryCount().getDelete()); ourLog.info("Now have inserts", getQueryCount().getInsert()); ourLog.info("Now have updates", getQueryCount().getUpdate()); assertEquals(0, getQueryCount().getDelete()); assertEquals(1, getQueryCount().getInsert()); assertEquals(2, getQueryCount().getUpdate()); assertEquals(0, myPatientDao.search(m1).size().intValue()); assertEquals(1, myPatientDao.search(m2).size().intValue()); }

Target:
public void testUpdateReusesIndexesString() { myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); SearchParameterMap m1 = new SearchParameterMap().add("family", new StringParam("family1")).setLoadSynchronous(true); SearchParameterMap m2 = new SearchParameterMap().add("family", new StringParam("family2")).setLoadSynchronous(true); myCountHolder.clear(); Patient pt = new Patient(); pt.addName().setFamily("FAMILY1"); IIdType id = myPatientDao.create(pt).getId().toUnqualifiedVersionless(); myCountHolder.clear(); assertEquals(1, myPatientDao.search(m1).size().intValue()); assertEquals(0, myPatientDao.search(m2).size().intValue()); ourLog.info("** About to update"); pt = new Patient(); pt.setId(id); pt.addName().setFamily("FAMILY2"); myPatientDao.update(pt); assertEquals(0, getQueryCount().getDelete()); assertEquals(1, getQueryCount().getInsert()); assertEquals(2, getQueryCount().getUpdate()); assertEquals(0, myPatientDao.search(m1).size().intValue()); assertEquals(1, myPatientDao.search(m2).size().intValue()); }
Source:
public void testElementAt() { int i = fullList.get(0); assertTrue(i == 1); try { fullList.get(fullList.size()); } catch (IndexOutOfBoundsException e) { return; } fail("Should raise an ArrayIndexOutOfBoundsException"); }

Target:
public void testElementAt() { int i = fullList.get(0); assertEquals(1,i); try { fullList.get(fullList.size()); } catch (IndexOutOfBoundsException e) { return; } fail("Should raise an ArrayIndexOutOfBoundsException"); }
Source:
public Collection<MgfMsSpectrum> getResult() { return null; }

Target:
public List<MgfMsSpectrum> getResult() { return spectra; }
Source:
public Result visit(Project e) { e.getVariablesSet(); Result x = visitChild(0, e.getInput()); parseCorrelTable(e, x); if (isStar(e.getChildExps(), e.getInput().getRowType(), e.getRowType())) { return x; } final Builder builder; if (e.getInput() instanceof Sort) { builder = x.builder(e); builder.clauses.add(Clause.SELECT); } else { builder = x.builder(e, Clause.SELECT); } final List<SqlNode> selectList = new ArrayList<>(); for (RexNode ref : e.getChildExps()) { SqlNode sqlExpr = builder.context.toSql(null, ref); if (SqlUtil.isNullLiteral(sqlExpr, false)) { sqlExpr = castNullType(sqlExpr, e.getRowType().getFieldList().get(selectList.size())); } addSelect(selectList, sqlExpr, e.getRowType()); } builder.setSelect(new SqlNodeList(selectList, POS)); return builder.result(); }

Target:
public Result visit(Project e) { e.getVariablesSet(); Result x = visitChild(0, e.getInput()); parseCorrelTable(e, x); if (isStar(e.getChildExps(), e.getInput().getRowType(), e.getRowType())) { return x; } final Builder builder = x.builder(e, Clause.SELECT); final List<SqlNode> selectList = new ArrayList<>(); for (RexNode ref : e.getChildExps()) { SqlNode sqlExpr = builder.context.toSql(null, ref); if (SqlUtil.isNullLiteral(sqlExpr, false)) { sqlExpr = castNullType(sqlExpr, e.getRowType().getFieldList().get(selectList.size())); } addSelect(selectList, sqlExpr, e.getRowType()); } builder.setSelect(new SqlNodeList(selectList, POS)); return builder.result(); }
Source:
private Resource loadPackage(URI uri, URI normalized) { if (uriCache.containsKey(normalized)) { return uriCache.get(normalized); } final URI trimmed = uri.trimFragment(); final Resource resource = createResource(trimmed, ContentHandler.UNSPECIFIED_CONTENT_TYPE); if (resource == null) { return null; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SRS@" + Integer.toHexString(hashCode()) + ".getResource - caching package " + uri); } InputStream stream = null; try { stream = getURIConverter().createInputStream(trimmed, null); resource.load(stream, Collections.emptyMap()); } catch (IOException e) { handleDemandLoadException(resource, e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { } } } Resource former = uriCache.putIfAbsent(normalized, resource); if (former != null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("SRS@" + Integer.toHexString(hashCode()) + ".getResource - duplicate caching has been avoided for " + uri); } return former; } return resource; }

Target:
private Resource loadPackage(URI uri, URI normalized) { final URI trimmed = uri.trimFragment(); final Resource resource = createResource(trimmed, ContentHandler.UNSPECIFIED_CONTENT_TYPE); if (resource == null) { return null; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SRS@" + Integer.toHexString(hashCode()) + ".getResource - caching package " + uri); } Resource former = uriCache.putIfAbsent(normalized, resource); if (former != null) { return former; } InputStream stream = null; try { stream = getURIConverter().createInputStream(trimmed, null); resource.load(stream, Collections.emptyMap()); } catch (IOException e) { handleDemandLoadException(resource, e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { } } } loadedPackages.add(resource); return resource; }
Source:
public Integer getDuration() { if (currentEntity != null) { MediaPlayer mp = currentEntity.getPlayer(); return mp.getDuration() / 1000; } return null; }

Target:
public Integer getDuration() { if (currentEntity != null) { MediaPlayer mp = currentEntity.getPlayer(); return mp.getDuration(); } return null; }
Source:
public int translate(int xid, FVSlicer fvSlicer) { int ret = this.nextID++; if (nextID < MIN_XID) nextID = MIN_XID; xidMap.put(Integer.valueOf(ret), new XidPair(xid, fvSlicer.getSliceName())); FVLog.log(LogLevel.DEBUG,null,"The Translated xid is: "+ret); return ret; }

Target:
public int translate(int xid, FVSlicer fvSlicer) { int ret = this.nextID++; if (nextID < MIN_XID) nextID = MIN_XID; xidMap.put(Integer.valueOf(ret), new XidPair(xid, fvSlicer.getSliceName())); return ret; }
Source:
public String getUrlName() { return Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ? "/selenium" : null; }

Target:
public String getUrlName() { return "/selenium"; }
Source:
public String addLeadingZeros(String s) { if (s.length() >= THREAD_NAME_LENGTH) return THREAD_NAME_PREFIX+s; else return THREAD_NAME_PREFIX+String.format("%0" + (THREAD_NAME_LENGTH - s.length()) + "d%s", 0, s); }

Target:
public String addLeadingZeros(String s) { if (s.length() >= THREAD_NAME_LENGTH) return THREAD_NAME_PREFIX + s; else return THREAD_NAME_PREFIX + StringUtils.leftPad(s, THREAD_NAME_LENGTH, "0"); }
Source:
public Matrix4 setToRotation(final Vector3 axis, double angle) { if (angle == 0) return identity(); return setAll(mQuat.fromAngleAxis(axis, angle)); }

Target:
public Matrix4 setToRotation(final Vector3 axis, double angle) { return angle == 0 ? identity() : setAll(mQuat.fromAngleAxis(axis, angle)); }
Source:
public void testConcurrentWriteRead() throws Exception { final MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), 1, 1); final AtomicReference<Message<?>> messageHolder = new AtomicReference<Message<?>>(); queue.offer(new GenericMessage<String>("hello"), 1000, TimeUnit.SECONDS); Thread t1 = new Thread(() -> { try { queue.offer(new GenericMessage<String>("Hi"), 1000, TimeUnit.SECONDS); } catch (Exception e) { e.printStackTrace(); } }); Thread t2 = new Thread(() -> { try { queue.poll(1000, TimeUnit.SECONDS); messageHolder.set(queue.poll(1000, TimeUnit.SECONDS)); } catch (Exception e) { e.printStackTrace(); } }); t1.start(); Thread.sleep(1000); t2.start(); Thread.sleep(1000); assertTrue(messageHolder.get().getPayload().equals("Hi")); }

Target:
public void testConcurrentWriteRead() throws Exception { final MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), 1, 1); final AtomicReference<Message<?>> messageHolder = new AtomicReference<Message<?>>(); queue.offer(new GenericMessage<String>("hello"), 1000, TimeUnit.SECONDS); Thread t1 = new Thread(() -> { try { queue.offer(new GenericMessage<String>("Hi"), 1000, TimeUnit.SECONDS); } catch (Exception e) { LogFactory.getLog(getClass()).error("queue offer failed", e); } }); Thread t2 = new Thread(() -> { try { queue.poll(1000, TimeUnit.SECONDS); messageHolder.set(queue.poll(1000, TimeUnit.SECONDS)); } catch (Exception e) { LogFactory.getLog(getClass()).error("queue poll failed", e); } }); t1.start(); Thread.sleep(1000); t2.start(); Thread.sleep(1000); assertTrue(messageHolder.get().getPayload().equals("Hi")); }
Source:
private void recoverOne(RuntimeInfrastructure infra, RuntimeIdentity identity) throws ServerException { Workspace workspace; try { workspace = workspaceDao.get(identity.getWorkspaceId()); } catch (NotFoundException x) { LOG.error("Workspace configuration is missing for the runtime '{}:{}'. Runtime won't be recovered", identity.getWorkspaceId(), identity.getEnvName()); return; } Environment environment = workspace.getConfig().getEnvironments().get(identity.getEnvName()); if (environment == null) { LOG.error("Environment configuration is missing for the runtime '{}:{}'. Runtime won't be recovered", identity.getWorkspaceId(), identity.getEnvName()); return; } InternalRuntime runtime; try { runtime = infra.prepare(identity, environment).getRuntime(); } catch (InfrastructureException | ValidationException x) { LOG.error("Couldn't recover runtime '{}:{}'. Error: {}", identity.getWorkspaceId(), identity.getEnvName(), x.getMessage()); return; } RuntimeState prev = runtimes.putIfAbsent(identity.getWorkspaceId(), new RuntimeState(runtime, RUNNING)); if (prev == null) { LOG.info("Successfully recovered workspace runtime '{}'", identity.getWorkspaceId(), identity.getEnvName()); } else { LOG.error("More than 1 runtime with id '{}:{}' found. " + "Duplicate provided by infrastructure '{}' will be skipped", identity.getWorkspaceId(), identity.getEnvName(), prev.runtime.getContext().getInfrastructure().getName(), infra.getName()); } }

Target:
void recoverOne(RuntimeInfrastructure infra, RuntimeIdentity identity) throws ServerException { Workspace workspace; try { workspace = workspaceDao.get(identity.getWorkspaceId()); } catch (NotFoundException x) { LOG.error("Workspace configuration is missing for the runtime '{}:{}'. Runtime won't be recovered", identity.getWorkspaceId(), identity.getEnvName()); return; } Environment environment = workspace.getConfig().getEnvironments().get(identity.getEnvName()); if (environment == null) { LOG.error("Environment configuration is missing for the runtime '{}:{}'. Runtime won't be recovered", identity.getWorkspaceId(), identity.getEnvName()); return; } InternalRuntime runtime; try { runtime = infra.prepare(identity, environment).getRuntime(); } catch (InfrastructureException | ValidationException x) { LOG.error("Couldn't recover runtime '{}:{}'. Error: {}", identity.getWorkspaceId(), identity.getEnvName(), x.getMessage()); return; } RuntimeState prev = runtimes.putIfAbsent(identity.getWorkspaceId(), new RuntimeState(runtime, RUNNING)); if (prev == null) { LOG.info("Successfully recovered workspace runtime '{}'", identity.getWorkspaceId(), identity.getEnvName()); } else { LOG.error("More than 1 runtime with id '{}:{}' found. " + "Duplicate provided by infrastructure '{}' will be skipped", identity.getWorkspaceId(), identity.getEnvName(), prev.runtime.getContext().getInfrastructure().getName(), infra.getName()); } }
Source:
public void dropRowRangeAsyncForTruncate(){ DropRowRangeRequest request = DropRowRangeRequest.newBuilder() .setName(TABLE_NAME) .setDeleteAllDataFromTable(true) .build(); when(mockAdminClient.dropRowRangeAsync(request)) .thenReturn(immediateFuture(Empty.newBuilder().build())); clientWrapper.dropRowRangeAsync(TABLE_ID, request.getRowKeyPrefix().toStringUtf8()); verify(mockAdminClient).dropRowRangeAsync(request); }

Target:
public void dropRowRangeAsyncForTruncate(){ DropRowRangeRequest request = DropRowRangeRequest.newBuilder() .setName(TABLE_NAME) .setDeleteAllDataFromTable(true) .build(); when(mockAdminClient.dropRowRangeAsync(request)) .thenReturn(immediateFuture(Empty.newBuilder().build())); clientWrapper.dropRowRangeAsync(TABLE_ID, null); verify(mockAdminClient).dropRowRangeAsync(request); }
Source:
public static LabelType fromApprovalCategory(ApprovalCategory ac, List<ApprovalCategoryValue> acvs) { List<LabelValue> values = new ArrayList<LabelValue>(acvs.size()); for (ApprovalCategoryValue acv : acvs) { values.add( new LabelValue(acv.getValue(), acv.getName())); } LabelType lt = new LabelType(ac.getId().get(), ac.getLabelName(), values); lt.setAbbreviatedName(ac.getAbbreviatedName()); lt.setFunctionName(ac.getFunctionName()); lt.setCopyMinScore(ac.isCopyMinScore()); lt.setCanOverride(false); return lt; }

Target:
public static LabelType fromApprovalCategory(ApprovalCategory ac, List<ApprovalCategoryValue> acvs) { List<LabelValue> values = new ArrayList<LabelValue>(acvs.size()); for (ApprovalCategoryValue acv : acvs) { values.add( new LabelValue(acv.getValue(), acv.getName())); } LabelType lt = new LabelType(ac.getId().get(), ac.getLabelName(), values); lt.setAbbreviatedName(ac.getAbbreviatedName()); lt.setFunctionName(ac.getFunctionName()); lt.setCopyMinScore(ac.isCopyMinScore()); lt.setCanOverride(true); return lt; }
Source:
public boolean test(@Nonnull ItemStack item) { if (items.isEmpty()) { return defaultValue; } int potentialMatches = 0; for (ItemStackWrapper stack : items) { if (stack.getType() == item.getType()) { potentialMatches++; } } if (potentialMatches == 0) { return defaultValue; } else { ItemStack subject = potentialMatches == 1 ? item : new ItemStackWrapper(item); for (ItemStackWrapper stack : items) { if (SlimefunUtils.isItemSimilar(subject, stack, checkLore, false)) { return !defaultValue; } } return defaultValue; } }

Target:
public boolean test(@Nonnull ItemStack item) { if (items.isEmpty()) { return rejectOnMatch; } int potentialMatches = 0; for (ItemStackWrapper stack : items) { if (stack.getType() == item.getType()) { potentialMatches++; } } if (potentialMatches == 0) { return rejectOnMatch; } else { ItemStack subject = potentialMatches == 1 ? item : new ItemStackWrapper(item); for (ItemStackWrapper stack : items) { if (SlimefunUtils.isItemSimilar(subject, stack, checkLore, false)) { return !rejectOnMatch; } } return rejectOnMatch; } }
Source:
public void coerce(RecordCursor delegate, int field) { if (delegate.isNull(field)) { setIsNull(true); return; } Block block = (Block) delegate.getObject(field); if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder mapBuilder = blockBuilder.beginBlockEntry(); for (int i = 0; i < block.getPositionCount(); i += 2) { if (block.isNull(i)) { mapBuilder.appendNull(); } else if (keyCoercer == null) { block.writePositionTo(i, mapBuilder); mapBuilder.closeEntry(); } else { rewriteBlock(fromKeyType, toKeyType, block.getSingleValueBlock(i), 0, mapBuilder, keyCoercer, field, bridgingRecordCursor); } if (block.isNull(i + 1)) { mapBuilder.appendNull(); } if (valueCoercer == null) { block.writePositionTo(i + 1, mapBuilder); mapBuilder.closeEntry(); } else { rewriteBlock(fromValueType, toValueType, block.getSingleValueBlock(i + 1), 0, mapBuilder, valueCoercer, field, bridgingRecordCursor); } } blockBuilder.closeEntry(); pageBuilder.declarePosition(); setObject(blockBuilder.getRegion(blockBuilder.getPositionCount() - 1, 1).getObject(0, Block.class)); }

Target:
public void coerce(RecordCursor delegate, int field) { if (delegate.isNull(field)) { setIsNull(true); return; } Block block = (Block) delegate.getObject(field); if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder mapBuilder = blockBuilder.beginBlockEntry(); for (int i = 0; i < block.getPositionCount(); i++) { int k = i % 2; if (coercers[k] == null) { toKeyValueTypes.get(k).appendTo(block, i, mapBuilder); } else { if (block.isNull(i)) { mapBuilder.appendNull(); } else { rewriteBlock(fromKeyValueTypes.get(k), toKeyValueTypes.get(k), block, i, mapBuilder, coercers[k], bridgingRecordCursor); } } } blockBuilder.closeEntry(); pageBuilder.declarePosition(); setObject(toType.getObject(blockBuilder, blockBuilder.getPositionCount() - 1)); }
Source:
public final Iterable<E> search( final B request, final GenomicsRequestInitializer<? super C> initializer) { final A api = getApi(genomics); return FluentIterable .from( new Iterable<Pair>() { @Override public Iterator<Pair> iterator() { try { return new AbstractSequentialIterator<Pair>( new Pair(createSearch(api, request, Optional.<String>absent()), null)) { @Override protected Pair computeNext(Pair pair) { return Optional.fromNullable(pair.request) .transform( new Function<C, Pair>() { @Override public Pair apply(C search) { try { D response = search.execute(); successfulRequests += 1; Optional<String> pageToken = Optional.fromNullable(getNextPageToken(response)); return new Pair( pageToken.isPresent() ? createSearch(api, request, pageToken) : null, response); } catch (IOException e) { throw new SearchException(e); } } }) .orNull(); } }; } catch (IOException e) { throw new SearchException(e); } } }) .skip(1) .transform( new Function<Pair, D>() { @Override public D apply(Pair pair) { return pair.response; } }) .transformAndConcat( new Function<D, Iterable<E>>() { @Override public Iterable<E> apply(D response) { return Optional.fromNullable(getResponses(response)).or(Collections.<E>emptyList()); } }); }

Target:
public final Iterable<E> search( final B request, final GenomicsRequestInitializer<? super C> initializer) { final A api = getApi(genomics); return FluentIterable .from( new Iterable<Pair>() { @Override public Iterator<Pair> iterator() { try { return new AbstractSequentialIterator<Pair>( new Pair(createSearch(api, request, Optional.<String>absent()), null)) { @Override protected Pair computeNext(Pair pair) { return Optional.fromNullable(pair.request) .transform( new Function<C, Pair>() { @Override public Pair apply(C search) { try { D response = search.execute(); successfulRequests++; Optional<String> pageToken = Optional.fromNullable(getNextPageToken(response)); return new Pair( pageToken.isPresent() ? createSearch(api, request, pageToken) : null, response); } catch (IOException e) { throw new SearchException(e); } } }) .orNull(); } }; } catch (IOException e) { throw new SearchException(e); } } }) .skip(1) .transform( new Function<Pair, D>() { @Override public D apply(Pair pair) { return pair.response; } }) .transformAndConcat( new Function<D, Iterable<E>>() { @Override public Iterable<E> apply(D response) { return Optional.fromNullable(getResponses(response)).or(Collections.<E>emptyList()); } }); }
Source:
private static User getUserByUUID(UUID uuid) { if (ess == null) { throw new RuntimeException(noCallBeforeLoad); } if (uuid == null) { throw new RuntimeException("Economy uuid cannot be null"); } return ess.getUser(uuid); }

Target:
private static User getUserByUUID(UUID uuid) { if (ess == null) { throw new RuntimeException(noCallBeforeLoad); } if (uuid == null) { throw new IllegalArgumentException("Economy uuid cannot be null"); } return ess.getUser(uuid); }
Source:
public static ResponseStatus getResponseStatus(RestServiceErrorCode restServiceErrorCode) { switch (restServiceErrorCode) { case Deleted: return ResponseStatus.Gone; case NotFound: return ResponseStatus.NotFound; case BadRequest: case InvalidArgs: case InvalidRequestState: case MalformedRequest: case MissingArgs: case UnknownHttpObject: case UnsupportedHttpMethod: case UnsupportedOperation: return ResponseStatus.BadRequest; case BlobMediaScanDirty: return ResponseStatus.FORBIDDEN; case Unauthorized: return ResponseStatus.Unauthorized; case BlobMediaScanInProgress: return ResponseStatus.PROXY_AUTHENTICATION_REQUIRED; case InternalServerError: case InternalObjectCreationError: case RequestChannelClosed: case RequestResponseQueuingFailure: case ResponseBuildingFailure: case ServiceUnavailable: case UnsupportedRestMethod: default: return ResponseStatus.InternalServerError; } }

Target:
public static ResponseStatus getResponseStatus(RestServiceErrorCode restServiceErrorCode) { switch (restServiceErrorCode) { case Deleted: return ResponseStatus.Gone; case NotFound: return ResponseStatus.NotFound; case BadRequest: case InvalidArgs: case InvalidRequestState: case MalformedRequest: case MissingArgs: case UnknownHttpObject: case UnsupportedHttpMethod: case UnsupportedOperation: return ResponseStatus.BadRequest; case ResourceDirty: return ResponseStatus.Forbidden; case Unauthorized: return ResponseStatus.Unauthorized; case ResourceScanInProgress: return ResponseStatus.ProxyAuthenticationRequired; case InternalServerError: case InternalObjectCreationError: case RequestChannelClosed: case RequestResponseQueuingFailure: case ResponseBuildingFailure: case ServiceUnavailable: case UnsupportedRestMethod: default: return ResponseStatus.InternalServerError; } }
Source:
public static CommandBase<?> createCommand(String className, Guid commandId) { Constructor<?> constructor = null; Boolean isAcessible = null; try { constructor = Class.forName(className).getDeclaredConstructor(Guid.class); if (!constructor.isAccessible()) { isAcessible = constructor.isAccessible(); constructor.setAccessible(true); } CommandBase<?> cmd = (CommandBase<?>) constructor.newInstance(commandId); Injector.injectMembers(cmd); return cmd; } catch (Exception e) { log.error( "CommandsFactory : Failed to get type information using " + "reflection for Class : " + className + ", Command Id:" + commandId, e); return null; } finally { if (isAcessible != null) { constructor.setAccessible(isAcessible); } } }

Target:
public static CommandBase<?> createCommand(String className, Guid commandId) { Constructor<?> constructor = null; Boolean isAcessible = null; try { constructor = Class.forName(className).getDeclaredConstructor(Guid.class); if (!constructor.isAccessible()) { isAcessible = constructor.isAccessible(); constructor.setAccessible(true); } CommandBase<?> cmd = (CommandBase<?>) constructor.newInstance(commandId); return Injector.injectMembers(cmd); } catch (Exception e) { log.error("CommandsFactory : Failed to get type information using reflection for Class '{}', Command Id '{}': {}", className, commandId, e.getMessage()); log.error("Exception", e); return null; } finally { if (isAcessible != null) { constructor.setAccessible(isAcessible); } } }
Source:
public void resourceChanged(IResourceChangeEvent event) { final IResourceDelta delta = event.getDelta(); if (delta == null) { return; } lock.lock(); try { delta.accept(new ModelResourceDeltaVisitor()); } catch (CoreException e) { EMFCompareIDEUIPlugin.getDefault().log(e); } finally { lock.unlock(); } }

Target:
public void resourceChanged(IResourceChangeEvent event) { final IResourceDelta delta = event.getDelta(); if (delta == null) { return; } internalLock.lock(); try { delta.accept(new ModelResourceDeltaVisitor()); } catch (CoreException e) { EMFCompareIDEUIPlugin.getDefault().log(e); } finally { internalLock.unlock(); } }
Source:
public void withR2D3(String userAction, final Command command) { withDependencies( "R2D3", userAction, new Dependency[] { Dependency.cranPackage("htmltools", "0.3.6"), Dependency.cranPackage("htmlwidgets", "1.2", true), Dependency.cranPackage("jsonlite", "0.9.19"), Dependency.cranPackage("r2d3", "0.2.0", true) }, true, succeeded -> { if (succeeded) command.execute(); }); }

Target:
public void withR2D3(String userAction, final Command command) { withDependencies( "R2D3", userAction, new Dependency[] { Dependency.cranPackage("htmltools", "0.3.6"), Dependency.cranPackage("htmlwidgets", "1.2", true), Dependency.cranPackage("jsonlite", "0.9.19"), Dependency.cranPackage("r2d3", "0.2.2", true) }, true, succeeded -> { if (succeeded) command.execute(); }); }
Source:
void addFieldListParams(String name, Iterable<?> values) { if (name == null) { throw new IllegalArgumentException("Field name must not be null."); } if (values == null) { throw new IllegalArgumentException("Field param values must not be null."); } for (Object value : values) { formBody.addField(name, value.toString()); } }

Target:
void addFieldListParams(String name, Iterable<?> values) { if (name == null) { throw new IllegalArgumentException("Field name must not be null."); } if (values == null) { throw new IllegalArgumentException("Field param values must not be null."); } for (Object value : values) { if (value != null) { formBody.addField(name, value.toString()); } } }
Source:
private void visitProperties(ObjectType objType, boolean isStatic) { visitProperties(objType, isStatic, null); }

Target:
private void visitProperties(ObjectType objType, boolean isStatic) { visitProperties(objType, isStatic, Collections.<String>emptySet()); }
Source:
public static void testGetLevelSizeOK() { final AbstractBAMFileIndex afi = new DiskBasedBAMFileIndex(new File(BAM_FILE.getPath() + ".bai"), null); Assert.assertEquals(afi.getLevelSize(0), 1); Assert.assertEquals(afi.getLevelSize(1), 8); Assert.assertEquals(afi.getLevelSize(2), 64); Assert.assertEquals(afi.getLevelSize(3), 512); Assert.assertEquals(afi.getLevelSize(4), 4096); Assert.assertEquals(afi.getLevelSize(5), 32768); }

Target:
public static void testGetLevelSizeOK() { Assert.assertEquals(afi.getLevelSize(0), 1); Assert.assertEquals(afi.getLevelSize(1), 8); Assert.assertEquals(afi.getLevelSize(2), 64); Assert.assertEquals(afi.getLevelSize(3), 512); Assert.assertEquals(afi.getLevelSize(4), 4096); Assert.assertEquals(afi.getLevelSize(5), 32768); }
Source:
public void merge() throws MergeException { setDestProject(); try { openSchema(); openRepository(); submitted = db.changes().submitted(destBranch).toList(); preMerge(); updateBranch(); updateChangeStatus(); updateSubscriptions(); } catch (OrmException e) { throw new MergeException("Cannot query the database", e); } finally { if (inserter != null) { inserter.release(); } if (rw != null) { rw.release(); } if (repo != null) { repo.close(); } db.close(); db = null; } }

Target:
public void merge() throws MergeException { setDestProject(); try { openSchema(); openRepository(); submitted = db.changes().submitted(destBranch).toList(); preMerge(); updateBranch(); updateChangeStatus(); updateSubscriptions(); } catch (OrmException e) { throw new MergeException("Cannot query the database", e); } finally { if (inserter != null) { inserter.release(); } if (rw != null) { rw.release(); } if (repo != null) { repo.close(); } if (db != null) { db.close(); } } }
Source:
public void setProvidedProducts(Collection<Product> providedProducts) { this.providedProductDtos = null; if (providedProducts != null) { this.providedProducts = new HashSet<>(providedProducts); } }

Target:
public void setProvidedProducts(Collection<Product> providedProducts) { this.providedProductDtos = null; if (providedProducts != null) { this.providedProducts = new HashSet<>(providedProducts); } else { this.providedProducts = new HashSet<>(); } }
Source:
public void testOpenFile(final Path sequenceFile) throws IOException { TwoBitSequenceFile tbf = new TwoBitSequenceFile(sequenceFile); final SAMSequenceDictionary dict = tbf.getSequenceDictionary(); Assert.assertNotNull(dict); Assert.assertEquals(dict.size(), 2); Assert.assertEquals(dict.getSequence(0).getSequenceName(), "chrM"); Assert.assertEquals(dict.getSequence(0).getSequenceLength(), 16_571); Assert.assertEquals(dict.getSequence(1).getSequenceName(), "chr20"); Assert.assertEquals(dict.getSequence(0).getSequenceLength(), 1_000_000); Assert.assertNull(tbf.getSequence("do_not_exists")); ReferenceSequence seq =tbf.getSequence("chrM"); Assert.assertNotNull(seq); Assert.assertEquals(seq.getName(), "chrM"); Assert.assertEquals(seq.length(), 16_571); tbf.getSequence("chr20"); Assert.assertNotNull(seq); Assert.assertEquals(seq.getName(), "chr20"); Assert.assertEquals(seq.length(), 1_000_000); final String chrM_100_120="GGAGCCGGAGCACCCTATGTC"; for(int i=0;i<=20;i++) { seq =tbf.getSubsequenceAt("chrM", 100, 100+i); Assert.assertEquals(seq.getName(), "chrM"); Assert.assertEquals(seq.length(), i+1); Assert.assertEquals(seq.getContigIndex() , 99); Assert.assertEquals(seq.getBaseString() , chrM_100_120.substring(0, i)); } tbf.close(); }

Target:
public void testOpenFile(final Path sequenceFile) throws IOException { TwoBitSequenceFile tbf = new TwoBitSequenceFile(sequenceFile); final SAMSequenceDictionary dict = tbf.getSequenceDictionary(); Assert.assertNotNull(dict); Assert.assertEquals(dict.size(), 2); Assert.assertEquals(dict.getSequence(0).getSequenceName(), "chrM"); Assert.assertEquals(dict.getSequence(0).getSequenceLength(), 16_571); Assert.assertEquals(dict.getSequence(1).getSequenceName(), "chr20"); Assert.assertEquals(dict.getSequence(1).getSequenceLength(), 1_000_000); Assert.assertNull(tbf.getSequence("do_not_exists")); ReferenceSequence seq =tbf.getSequence("chrM"); Assert.assertNotNull(seq); Assert.assertEquals(seq.getName(), "chrM"); Assert.assertEquals(seq.length(), 16_571); seq = tbf.getSequence("chr20"); Assert.assertNotNull(seq); Assert.assertEquals(seq.getName(), "chr20"); Assert.assertEquals(seq.length(), 1_000_000); final String chrM_100_120="GGAGCCGGAGCACCCTATGTC"; for(int i=0;i<=20;i++) { seq =tbf.getSubsequenceAt("chrM", 100, 100+i); Assert.assertEquals(seq.getName(), "chrM"); Assert.assertEquals(seq.length(), i+1); Assert.assertEquals(seq.getContigIndex() , 99); Assert.assertEquals(seq.getBaseString().toUpperCase() , chrM_100_120.substring(0, i+1)); } tbf.close(); }
Source:
public void onSaveButton(String scenarioType) { if (saveCommand != null) { simulationDescriptor.setSkipFromBuild(view.getSkipFromBuild().isChecked()); switch (ScenarioSimulationModel.Type.valueOf(scenarioType)) { case RULE: saveRuleSettings(); break; case DMN: saveDMNSettings(); break; } saveCommand.execute(); } }

Target:
public void onSaveButton(String scenarioType) { if (saveCommand != null) { simulationDescriptor.setSkipFromBuild(view.getSkipFromBuild().isChecked()); switch (ScenarioSimulationModel.Type.valueOf(scenarioType)) { case RULE: saveRuleSettings(); break; case DMN: saveDMNSettings(); break; default: } saveCommand.execute(); } }
Source:
private static boolean isBlockCommentOnOneLine(DetailAST commentBeginAst) { final DetailAST commentEnd = commentBeginAst.getFirstChild().getNextSibling(); return commentEnd.getLineNo() == commentBeginAst.getLineNo(); }

Target:
private static boolean isBlockCommentOnOneLine(DetailAST commentBeginAst) { final DetailAST commentEnd = commentBeginAst.getFirstChild().getNextSibling(); return TokenUtil.areOnSameLine(commentBeginAst, commentEnd); }