auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String getPlatformInformation() { StringBuilder ret = new StringBuilder(); ret.append(String.format("Java Version: {%s}\n", System.getProperty("java.version"))); ret.append(String.format("Java Vendor: {%s}\n", System.getProperty("java.vendor"))); ret.append(String.format("JVM Version: {%s}\n", System.getProperty("java.vm.version"))); ret.append(String.format("JVM Name: {%s}\n", System.getProperty("java.vm.name"))); ret.append(String.format("OS: {%s}\n", System.getProperty("os.name"))); ret.append(String.format("OS Arch: {%s}\n", System.getProperty("os.arch"))); ret.append(String.format("OS Version: {%s}\n", System.getProperty("os.version"))); return ret.toString(); }

Target:
public static String getPlatformInformation() { return String.format("Java Version: {%s}\n", System.getProperty("java.version")) + String.format("Java Vendor: {%s}\n", System.getProperty("java.vendor")) + String.format("JVM Version: {%s}\n", System.getProperty("java.vm.version")) + String.format("JVM Name: {%s}\n", System.getProperty("java.vm.name")) + String.format("OS: {%s}\n", System.getProperty("os.name")) + String.format("OS Arch: {%s}\n", System.getProperty("os.arch")) + String.format("OS Version: {%s}\n", System.getProperty("os.version")); }
Source:
private Catalog replayFailedCatalogRebuildUnderDebug( VoltCompiler autoGenCompiler, List<VoltCompilerReader> autogenReaderList, InMemoryJarfile autoGenJarOutput) { Catalog autoGenCatalog = autoGenCompiler.compileCatalogInternal(null, null, autogenReaderList, new ArrayList<>(), autoGenJarOutput); return autoGenCatalog; }

Target:
private Catalog replayFailedCatalogRebuildUnderDebug( VoltCompiler autoGenCompiler, List<VoltCompilerReader> autogenReaderList, InMemoryJarfile autoGenJarOutput) { Catalog autoGenCatalog = autoGenCompiler.compileCatalogInternal(null, null, autogenReaderList, Collections.emptyList(), autoGenJarOutput); return autoGenCatalog; }
Source:
public void assertIsEqualToWithSortedQueryParameters(AssertionInfo info, URL actual, URL expected) { assertNotNull(info, actual); if (expected.getQuery() == null || actual.getQuery() == null) if (expected.getQuery() == null && actual.getQuery() == null) return; else throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); String expected_non_query = expected.toString().substring(0, expected.toString().length() - expected.getQuery().length()); String actual_non_query = actual.toString().substring(0, actual.toString().length() - actual.getQuery().length()); if (!expected_non_query.equals(actual_non_query)) throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); String[] expected_query_params = expected.getQuery().split("&"); String[] actual_query_params = actual.getQuery().split("&"); java.util.Arrays.sort(expected_query_params); java.util.Arrays.sort(actual_query_params); if (!java.util.Arrays.toString(expected_query_params).equals(Arrays.toString(actual_query_params))) throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); }

Target:
public void assertIsEqualToWithSortedQueryParameters(AssertionInfo info, URL actual, URL expected) { assertNotNull(info, actual); if (!extractNonQueryParams(expected).equals(extractNonQueryParams(actual))) throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); if (!Objects.deepEquals(extractSortedQueryParams(expected), extractSortedQueryParams(actual))) throw failures.failure(info, shouldBeEqualToWithSortedQueryParameters(actual, expected)); }
Source:
public void setTreatments(List<Treatment> treatments) { if (treatments != null) { for (int i = 0; i < treatments.size(); i++) { treatments.get(i).setDrugs(treatments.get(i).getDrugs()); treatments.get(i).setPriority(i); } this.treatments = new HashSet<>(treatments); } }

Target:
public void setTreatments(List<Treatment> treatments) { if (treatments != null) { for (int i = 0; i < treatments.size(); i++) { treatments.get(i).setDrugs(treatments.get(i).getDrugs()); if(treatments.get(i).getPriority() == null) { treatments.get(i).setPriority(i+1); } } this.treatments = new HashSet<>(treatments); } }
Source:
void createSessionReceiverForNonSessionEntity(MessagingEntityType entityType) { String sessionId = "test-session-id"; ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder builder = getBuilder(false) .sessionReceiver(); if (entityType == MessagingEntityType.QUEUE) { builder.queueName(getQueueName()); } else if (entityType == MessagingEntityType.SUBSCRIPTION) { builder.topicName(getTopicName()); builder.subscriptionName(getSubscriptionName()); } ServiceBusReceiverAsyncClient invalidReceiver = builder.sessionId(sessionId).buildAsyncClient(); StepVerifier.create(invalidReceiver.receive()) .verifyErrorMatches(error -> error instanceof UnsupportedOperationException); }

Target:
void createSessionReceiverForNonSessionEntity(MessagingEntityType entityType) { String sessionId = "test-session-id"; ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder builder = getBuilder(false) .sessionReceiver(); if (entityType == MessagingEntityType.QUEUE) { builder.queueName(getQueueName()); } else if (entityType == MessagingEntityType.SUBSCRIPTION) { builder.topicName(getTopicName()).subscriptionName(getSubscriptionName()); } ServiceBusReceiverAsyncClient invalidReceiver = builder.sessionId(sessionId).buildAsyncClient(); StepVerifier.create(invalidReceiver.receive()) .verifyErrorMatches(error -> error instanceof UnsupportedOperationException); }
Source:
public static void main(String[] args) { ICommandService commands = new CommandServiceImpl(); commands.authorCreated("eEvans", "Eric Evans", "eEvans@email.com"); commands.authorCreated("jBloch", "Joshua Bloch", "jBloch@email.com"); commands.authorCreated("mFowler", "Martin Fowler", "mFowler@email.com"); commands.bookAddedToAuthor("Domain-Driven Design", 60.08, "eEvans"); commands.bookAddedToAuthor("Effective Java", 40.54, "jBloch"); commands.bookAddedToAuthor("Java Puzzlers", 39.99, "jBloch"); commands.bookAddedToAuthor("Java Concurrency in Practice", 29.40, "jBloch"); commands.bookAddedToAuthor("Patterns of Enterprise Application Architecture", 54.01, "mFowler"); commands.bookAddedToAuthor("Domain Specific Languages", 48.89, "mFowler"); commands.authorNameUpdated("eEvans", "Eric J. Evans"); IQueryService queries = new QueryServiceImpl(); Author nullAuthor = queries.getAuthorByUsername("username"); Author eEvans = queries.getAuthorByUsername("eEvans"); BigInteger jBlochBooksCount = queries.getAuthorBooksCount("jBloch"); BigInteger authorsCount = queries.getAuthorsCount(); Book dddBook = queries.getBook("Domain-Driven Design"); List<Book> jBlochBooks = queries.getAuthorBooks("jBloch"); System.out.println("Author username : " + nullAuthor); System.out.println("Author eEvans : " + eEvans); System.out.println("jBloch number of books : " + jBlochBooksCount); System.out.println("Number of authors : " + authorsCount); System.out.println("DDD book : " + dddBook); System.out.println("jBloch books : " + jBlochBooks); HibernateUtil.getSessionFactory().close(); }

Target:
public static void main(String[] args) { ICommandService commands = new CommandServiceImpl(); commands.authorCreated("eEvans", "Eric Evans", "eEvans@email.com"); commands.authorCreated("jBloch", "Joshua Bloch", "jBloch@email.com"); commands.authorCreated("mFowler", "Martin Fowler", "mFowler@email.com"); commands.bookAddedToAuthor("Domain-Driven Design", 60.08, "eEvans"); commands.bookAddedToAuthor("Effective Java", 40.54, "jBloch"); commands.bookAddedToAuthor("Java Puzzlers", 39.99, "jBloch"); commands.bookAddedToAuthor("Java Concurrency in Practice", 29.40, "jBloch"); commands.bookAddedToAuthor("Patterns of Enterprise Application Architecture", 54.01, "mFowler"); commands.bookAddedToAuthor("Domain Specific Languages", 48.89, "mFowler"); commands.authorNameUpdated("eEvans", "Eric J. Evans"); IQueryService queries = new QueryServiceImpl(); Author nullAuthor = queries.getAuthorByUsername("username"); Author eEvans = queries.getAuthorByUsername("eEvans"); BigInteger jBlochBooksCount = queries.getAuthorBooksCount("jBloch"); BigInteger authorsCount = queries.getAuthorsCount(); Book dddBook = queries.getBook("Domain-Driven Design"); List<Book> jBlochBooks = queries.getAuthorBooks("jBloch"); LOGGER.info("Author username : {}", nullAuthor); LOGGER.info("Author eEvans : {}", eEvans); LOGGER.info("jBloch number of books : {}", jBlochBooksCount); LOGGER.info("Number of authors : {}", authorsCount); LOGGER.info("DDD book : {}", dddBook); LOGGER.info("jBloch books : {}", jBlochBooks); HibernateUtil.getSessionFactory().close(); }
Source:
public void performCancel(IProgressMonitor monitor) throws CoreException { super.performCancel(monitor); trackNewServerEvent(UsageEventType.FAILED_VALUE); }

Target:
public void performCancel(IProgressMonitor monitor) throws CoreException { super.performCancel(monitor); trackNewServerEvent(0); }
Source:
public void testOne() throws Exception { final File fileToProcess = new File( getPath("SuppressionXpathRegressionMissingLeadingAsterisk.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingLeadingAsteriskCheck.class); final String[] expectedViolation = { "3:1: " + getCheckMessage(JavadocStyleCheck.class, MissingLeadingAsteriskCheck.MSG_MISSING_ASTERISK), }; final List<String> expectedXpathQueries = Collections.singletonList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMissingLeadingAsterisk']]" + "/MODIFIERS/BLOCK_COMMENT_BEGIN"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }

Target:
public void testOne() throws Exception { final File fileToProcess = new File( getPath("SuppressionXpathRegressionMissingLeadingAsterisk.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingLeadingAsteriskCheck.class); final String[] expectedViolation = { "3:1: " + getCheckMessage(MissingLeadingAsteriskCheck.class, MissingLeadingAsteriskCheck.MSG_MISSING_ASTERISK), }; final List<String> expectedXpathQueries = Collections.singletonList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMissingLeadingAsterisk']]" + "/MODIFIERS/BLOCK_COMMENT_BEGIN"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }
Source:
private static @NonNull Iterable<ITmfEventAspect<?>> getExperimentAspects( final TmfExperiment experiment) { List<ITmfTrace> traces = experiment.getTraces(); ImmutableSet.Builder<ITmfEventAspect<?>> builder = new ImmutableSet.Builder<>(); builder.add(TmfBaseAspects.getTraceNameAspect()); String commonTraceType = getCommonTraceType(experiment); ArrayList<ITmfEventAspect<?>> list = new ArrayList<>(); if (commonTraceType != null) { builder.addAll(traces.get(0).getEventAspects()); list.addAll(builder.build()); } else { builder.addAll(experiment.getEventAspects()); for (ITmfTrace trace : traces) { Iterable<ITmfEventAspect<?>> traceAspects = trace.getEventAspects(); builder.addAll(traceAspects); } list.addAll(builder.build()); if (list.remove(TmfBaseAspects.getContentsAspect())) { list.add(TmfBaseAspects.getContentsAspect()); } } return ImmutableList.copyOf(list); }

Target:
private static @NonNull Iterable<ITmfEventAspect<?>> getExperimentAspects( final TmfExperiment experiment) { List<ITmfTrace> traces = experiment.getTraces(); HashSet<ITmfEventAspect<?>> builder = new LinkedHashSet<>(); builder.add(TmfBaseAspects.getTraceNameAspect()); String commonTraceType = getCommonTraceType(experiment); if (commonTraceType != null) { traces.get(0).getEventAspects().forEach(builder::add); } else { experiment.getEventAspects().forEach(builder::add); for (ITmfTrace trace : traces) { Iterable<ITmfEventAspect<?>> traceAspects = trace.getEventAspects(); traceAspects.forEach(builder::add); } if (builder.remove(TmfBaseAspects.getContentsAspect())) { builder.add(TmfBaseAspects.getContentsAspect()); } } return ImmutableSet.copyOf(builder); }
Source:
public boolean canBeMember(PerunSession sess, Vo vo, User user, String loa) throws InternalErrorException, VoNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getPerunBl().getVosManagerBl().checkVoExists(sess, vo); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.SELF, user) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "canBeMember"); } return getMembersManagerBl().canBeMember(sess, vo, user, loa); }

Target:
public boolean canBeMember(PerunSession sess, Vo vo, User user, String loa) throws InternalErrorException, VoNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getPerunBl().getVosManagerBl().checkVoExists(sess, vo); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER, vo) && !AuthzResolver.isAuthorized(sess, Role.SELF, user) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "canBeMember"); } return getMembersManagerBl().canBeMember(sess, vo, user, loa); }
Source:
public final void reset() { resetMC(); setpoint = sensor.pidGet(); synchronized (justReset) { justReset = true; } }

Target:
public final void reset() { resetErrorToZero(); setpoint = sensor.pidGet(); justReset = true; }
Source:
public List<Column> columns() { final Collection<XML> nodes; try { nodes = new JdkRequest( UriBuilder.fromUri(this.home).build() ) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .nodes("/page/columns/column"); } catch (IOException ex) { throw new IllegalStateException(ex); } final List<Column> columns = new ArrayList<Column>(nodes.size()); for (final XML node : nodes) { columns.add( new Column.Simple( node.xpath("title/text()").get(0), !node.nodes("links/link[@rel='group']").isEmpty(), !node.nodes("./@sum").isEmpty() ) ); } return columns; }

Target:
public List<Column> columns() { final Collection<XML> nodes; try { nodes = new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .nodes("/page/columns/column"); } catch (IOException ex) { throw new IllegalStateException(ex); } final List<Column> columns = new ArrayList<Column>(nodes.size()); for (final XML node : nodes) { columns.add( new Column.Simple( node.xpath("title/text()").get(0), !node.nodes("links/link[@rel='group']").isEmpty(), !node.nodes("./@sum").isEmpty() ) ); } return columns; }
Source:
public static void showPushNotification(Context context, Intent messageIntent) { final MPConfig config = MPConfig.getInstance(context); String resourcePackage = config.getResourcePackageName(); if (null == resourcePackage) { resourcePackage = context.getPackageName(); } final ResourceIds drawableIds = new ResourceReader.Drawables(resourcePackage, context); final Context applicationContext = context.getApplicationContext(); MixpanelPushNotification mixpanelPushNotification = new MixpanelPushNotification(applicationContext, drawableIds); Notification notification = mixpanelPushNotification.createNotification(messageIntent); if (null != notification) { final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); if (mixpanelPushNotification.tag != null) { notificationManager.notify(mixpanelPushNotification.tag ,0, notification); } else { notificationManager.notify(0, notification); } } }

Target:
public static void showPushNotification(Context context, Intent messageIntent) { final MPConfig config = MPConfig.getInstance(context); String resourcePackage = config.getResourcePackageName(); if (null == resourcePackage) { resourcePackage = context.getPackageName(); } final ResourceIds drawableIds = new ResourceReader.Drawables(resourcePackage, context); final Context applicationContext = context.getApplicationContext(); MixpanelPushNotification mixpanelPushNotification = new MixpanelPushNotification(applicationContext, drawableIds); Notification notification = mixpanelPushNotification.createNotification(messageIntent); if (null != notification) { final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); if (mixpanelPushNotification.data.tag != null) { notificationManager.notify(mixpanelPushNotification.data.tag, 0, notification); } else { notificationManager.notify(0, notification); } } }
Source:
void notNull__non_null_argument_returns_argument() { final String value = "testValue"; String actual = ValidationUtils.notNull(value); Assertions.assertEquals(value, actual); }

Target:
void notNull__non_null_argument_returns_argument() { String actual = ValidationUtils.notNull("testValue"); Assertions.assertEquals("testValue", actual); }
Source:
public void startSubscriber() throws FalconException { try { connection = createAndGetConnection(implementation, userName, password, url); connection.setClientID(FALCON_CLIENT_ID); topicSession = (TopicSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic destination = topicSession.createTopic(topicName); topicSubscriber = topicSession.createDurableSubscriber(destination, FALCON_CLIENT_ID); topicSubscriber.setMessageListener(this); connection.setExceptionListener(this); connection.start(); } catch (Exception e) { LOG.error("Error starting topicSubscriber of topic: " + this.toString(), e); throw new FalconException(e); } }

Target:
public void startSubscriber() throws FalconException { try { connection = createAndGetConnection(implementation, userName, password, url); connection.setClientID(FALCON_CLIENT_ID); topicSession = (TopicSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic destination = topicSession.createTopic(topicName); topicSubscriber = topicSession.createDurableSubscriber(destination, FALCON_CLIENT_ID, WorkflowNameBuilder.WorkflowName.getJMSFalconSelector(), false); topicSubscriber.setMessageListener(this); connection.setExceptionListener(this); connection.start(); } catch (Exception e) { LOG.error("Error starting topicSubscriber of topic: " + this.toString(), e); throw new FalconException(e); } }
Source:
public void configureResources(Context context) { if (context == null) { return; } mNormalTextColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.colorOnSurface); mNormalBackgroundColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.colorSurface); mAgoTextColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.wpColorOnSurfaceMedium); mUnapprovedTextColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.wpColorWarningDark); mIndentedLeftPadding = context.getResources().getDimensionPixelSize(R.dimen.margin_extra_large) * 2; }

Target:
public void configureResources(Context context) { if (context == null) { return; } mNormalBackgroundColor = ContextExtensionsKt.getColorFromAttribute(context, R.attr.colorSurface); mIndentedLeftPadding = context.getResources().getDimensionPixelSize(R.dimen.margin_extra_large) * 2; }
Source:
public void varDefValidation() { final String mark = "+"; Queue<String> checks = new LinkedList<String>(getUsedVariables()); checks.offer(mark); final Set<String> varWithValue = new HashSet<String>(); int lastvarWithValueCnt = varWithValue.size(); String lastCheck = ""; final Set<String> lasttodocheck = new HashSet<String>(); while (!checks.isEmpty()) { String check = checks.peek(); if (mark.equals(check)) { if (varWithValue.size() < lastvarWithValueCnt ) { throw new ExpressionException("circular reference var"); } else if (varWithValue.size() == lastvarWithValueCnt && lasttodocheck.contains(lastCheck)){ throw new ExpressionException("circular reference var"); } else { lastvarWithValueCnt = varWithValue.size(); if (checks.size() > 1) { checks.add(mark); } } } else { if (!variables.containsKey(check)) { throw new ExpressionException("unknown var : " + check); } lastCheck = check; LazyNumber innerVariable = variables.get(check); String innerExp = innerVariable.getString(); if (isNumber(innerExp)) { varWithValue.add(check); } else { Expression exp = createEmbeddedExpression(innerExp); Set<String> tocheck = new HashSet<String>(exp.getUsedVariables()); tocheck.removeAll(varWithValue); if (tocheck.isEmpty()) { varWithValue.add(check); } else { lasttodocheck.addAll(tocheck); checks.addAll(tocheck); } } } checks.poll(); } }

Target:
public void varDefValidation() { final String mark = "+"; Queue<String> checks = new LinkedList<String>(getUsedVariables()); checks.offer(mark); final Set<String> varWithValue = new HashSet<String>(); int lastvarWithValueCnt = varWithValue.size(); String lastCheckVar = ""; final Set<String> alreadyCheckSet = new HashSet<String>(); final Set<String> lastCheckSet = new HashSet<String>(); while (!checks.isEmpty()) { String check = checks.peek(); if (mark.equals(check)) { lastCheckSet.removeAll(varWithValue); if (varWithValue.size() < lastvarWithValueCnt || (varWithValue.size() == lastvarWithValueCnt && alreadyCheckSet.containsAll(lastCheckSet))) { throw new ExpressionException("circular reference var : " + lastCheckVar); } else { lastvarWithValueCnt = varWithValue.size(); if (checks.size() > 1) { checks.add(mark); } } } else { if (!variables.containsKey(check)) { throw new ExpressionException("unknown var : " + check); } LazyNumber innerVariable = variables.get(check); String innerExp = innerVariable.getString(); if (varWithValue.contains(check) || isNumber(innerExp)) { varWithValue.add(check); } else { Expression exp = createEmbeddedExpression(innerExp); Set<String> tocheck = new HashSet<String>(exp.getUsedVariables()); tocheck.removeAll(varWithValue); if (tocheck.isEmpty()) { varWithValue.add(check); } else { lastCheckVar = check; alreadyCheckSet.add(check); lastCheckSet.addAll(tocheck); checks.addAll(tocheck); } } } checks.poll(); } }
Source:
public void hasNoActiveMemberships_shouldReturnTrueIfNoneExists() throws Exception{ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date endDateEarlier = dateFormat.parse("2007-02-01 00:00:00"); Date endDateLater = dateFormat.parse("2100-02-01 00:00:00"); Cohort cohort = new Cohort(3); CohortMembership temp = new CohortMembership(7); temp.setVoided(true); temp.setEndDate(endDateLater); cohort.addMembership(temp); temp = new CohortMembership(8); temp.setVoided(true); cohort.addMembership(temp); temp = new CohortMembership(9); temp.setEndDate(endDateEarlier); cohort.addMembership(temp); temp = new CohortMembership(10); temp.setVoided(true); cohort.addMembership(temp); assertTrue(cohort.hasNoActiveMemberships()); }

Target:
public void hasNoActiveMemberships_shouldReturnTrueIfNoneExists() throws Exception{ Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); Date endDateLater = calendar.getTime(); calendar.add(Calendar.DAY_OF_YEAR, -2); Date endDateEarlier = calendar.getTime(); Cohort cohort = new Cohort(3); CohortMembership temp = new CohortMembership(7); temp.setVoided(true); temp.setEndDate(endDateLater); cohort.addMembership(temp); temp = new CohortMembership(8); temp.setVoided(true); cohort.addMembership(temp); temp = new CohortMembership(9); temp.setEndDate(endDateEarlier); cohort.addMembership(temp); temp = new CohortMembership(10); temp.setVoided(true); cohort.addMembership(temp); assertTrue(cohort.hasNoActiveMemberships()); }
Source:
private void add(String requestDomain, String requestPath, Cookie cookie) { AbstractMap.SimpleEntry<String, Boolean> pair = cookieDomain(cookie.domain(), requestDomain); String keyDomain = pair.getKey(); boolean hostOnly = pair.getValue(); String keyPath = cookiePath(cookie.path(), requestPath); CookieKey key = new CookieKey(cookie.name().toLowerCase(), keyPath); if (hasCookieExpired(cookie, 0)) cookieJar.getOrDefault(keyDomain, Collections.emptyMap()).remove(key); else { cookieJar.putIfAbsent(keyDomain, new ConcurrentHashMap<>()); cookieJar.get(keyDomain).put(key, new StoredCookie(cookie, hostOnly, cookie.maxAge() != Cookie.UNDEFINED_MAX_AGE)); } }

Target:
private void add(String requestDomain, String requestPath, Cookie cookie) { AbstractMap.SimpleEntry<String, Boolean> pair = cookieDomain(cookie.domain(), requestDomain); String keyDomain = pair.getKey(); boolean hostOnly = pair.getValue(); String keyPath = cookiePath(cookie.path(), requestPath); CookieKey key = new CookieKey(cookie.name().toLowerCase(), keyPath); if (hasCookieExpired(cookie, 0)) cookieJar.getOrDefault(keyDomain, Collections.emptyMap()).remove(key); else { final Map<CookieKey, StoredCookie> innerMap = cookieJar.computeIfAbsent(keyDomain, domain -> new ConcurrentHashMap<>()); innerMap.put(key, new StoredCookie(cookie, hostOnly, cookie.maxAge() != Cookie.UNDEFINED_MAX_AGE)); } }
Source:
void cancelScheduleMessage() { long sequenceNumberReturned = 10; when(managementNode.cancelScheduledMessage(eq(sequenceNumberReturned))) .thenReturn(Mono.empty()); StepVerifier.create(sender.cancelScheduledMessage(sequenceNumberReturned)) .verifyComplete(); }

Target:
void cancelScheduleMessage() { long sequenceNumberReturned = 10; when(managementNode.cancelScheduledMessage(eq(sequenceNumberReturned))).thenReturn(Mono.empty()); StepVerifier.create(sender.cancelScheduledMessage(sequenceNumberReturned)) .verifyComplete(); verify(managementNode).cancelScheduledMessage(sequenceNumberReturned); }
Source:
public void unlock() { boolean status = leaseBlobManager.releaseLease(leaseId.get()); if (status) { LOG.info("Unlocked successfully."); hasLock.set(false); leaseId.getAndSet(null); } else { LOG.info("Unable to unlock."); } }

Target:
public void unlock() { boolean status = leaseBlobManager.releaseLease(leaseId.get()); if (status) { LOG.info("Unlocked successfully."); hasLock.getAndSet(false); leaseId.getAndSet(null); } else { LOG.info("Unable to unlock."); } }
Source:
public int getRankFromBasePair(int base) { Map<String, Object> parameters = new HashMap<>(1); parameters.put("dist", base); return query(e -> (int) e.execute(GET_RANK_FROM_BASEPAIR, parameters).columnAs("rank").next()); }

Target:
public int getRankFromBasePair(int base) { Map<String, Object> parameters = Collections.singletonMap("dist", base); return query(e -> (int) e.execute(GET_RANK_FROM_BASEPAIR, parameters) .columnAs("rank").next()); }
Source:
public static void close(Closeable closeable) { try { Closeables.close(closeable, true); } catch (IOException e) { throw new ISE("WTF?! A swallowedException bubbled up?!"); } }

Target:
public static void close(Closeable closeable) { if (closeable == null) { return; } try { closeable.close(); } catch (IOException e) { log.error(e, "IOException thrown while closing Closeable."); } }
Source:
public Object call() throws Exception { Reader reader = null; try { DefaultHandler handler = null; if (nodesList.size() > 0) { SAXLoopCompositeHandler chd = new SAXLoopCompositeHandler(); for (int i = 0; i < nodesList.size(); i++) { XMLNodes ns = nodesList.get(i); chd.register(new SimpleSAXLoopHandler(ns, multiCache)); } handler = chd; } else { hd = new SimpleSAXLoopHandler(nodes, bcache); handler = hd; } SAXParser saxParser = null; SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); spf.setFeature(DISALLOW_DOCTYPE_DECL, true); if (ignoreDTD) { spf.setFeature("<LINK_0>", false); } saxParser = spf.newSAXParser(); saxParser.setProperty("<LINK_1>", handler); if (fileURL != null) { reader = new UnicodeReader(new java.io.FileInputStream(fileURL), this.charset); org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader); saxParser.parse(inSource, handler); } else { reader = new UnicodeReader(is, this.charset); org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader); saxParser.parse(inSource, handler); } } finally { try { if (reader != null) { reader.close(); } } finally { if (multiCache != null) { multiCache.notifyErrorOccurred(); } if (bcache != null) { bcache.notifyErrorOccurred(); } } } return null; }

Target:
public Object call() throws Exception { Reader reader = null; try { DefaultHandler handler = null; if (nodesList.size() > 0) { SAXLoopCompositeHandler chd = new SAXLoopCompositeHandler(); for (int i = 0; i < nodesList.size(); i++) { XMLNodes ns = nodesList.get(i); chd.register(new SimpleSAXLoopHandler(ns, multiCache)); } handler = chd; } else { hd = new SimpleSAXLoopHandler(nodes, bcache); handler = hd; } SAXParser saxParser = null; SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE); if (ignoreDTD) { spf.setFeature(DISALLOW_DOCTYPE_DECL, true); spf.setFeature("<LINK_0>", false); } saxParser = spf.newSAXParser(); saxParser.setProperty("<LINK_1>", handler); if (fileURL != null) { reader = new UnicodeReader(new java.io.FileInputStream(fileURL), this.charset); org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader); saxParser.parse(inSource, handler); } else { reader = new UnicodeReader(is, this.charset); org.xml.sax.InputSource inSource = new org.xml.sax.InputSource(reader); saxParser.parse(inSource, handler); } } finally { try { if (reader != null) { reader.close(); } } finally { if (multiCache != null) { multiCache.notifyErrorOccurred(); } if (bcache != null) { bcache.notifyErrorOccurred(); } } } return null; }
Source:
public void configure(Type type, Properties params, Dialect dialect) throws MappingException { params.setProperty( SEGMENT_VALUE_PARAM, PropertiesHelper.getString( SEQUENCE_NAME, params, params.getProperty( TABLE_NAME ) ) ); tableGenerator.configure( type, params, dialect ); }

Target:
public void configure(Type type, Properties params, Dialect dialect) throws MappingException { Properties newParams = new Properties( params ); for ( Map.Entry<Object, Object> param : params.entrySet() ) { newParams.put( param.getKey(), param.getValue() ); } newParams.setProperty( OgmTableGenerator.SEGMENT_VALUE_PARAM, PropertiesHelper.getString( OgmTableGenerator.SEGMENT_VALUE_PARAM, newParams, newParams.getProperty( PersistentIdentifierGenerator.TABLE ) ) ); tableGenerator.configure( type, newParams, dialect ); }
Source:
private boolean connectSocket() { try { if (mPseRec == null) { if (DBG) Log.v(TAG, "connectSocket: UUID: " + BluetoothUuid.PBAP_PSE.getUuid()); mSocket = mDevice.createRfcommSocketToServiceRecord(BluetoothUuid.PBAP_PSE.getUuid()); } else if (mPseRec.getL2capPsm() != L2CAP_INVALID_PSM) { if (DBG) Log.v(TAG, "connectSocket: PSM: " + mPseRec.getL2capPsm()); mSocket = mDevice.createL2capSocket(mPseRec.getL2capPsm()); } else { if (DBG) Log.v(TAG, "connectSocket: channel: " + mPseRec.getRfcommChannelNumber()); mSocket = mDevice.createRfcommSocket(mPseRec.getRfcommChannelNumber()); } if (mSocket != null) { mSocket.connect(); return true; } else { Log.w(TAG, "Could not create socket"); } } catch (IOException e) { Log.e(TAG, "Error while connecting socket", e); } return false; }

Target:
private boolean connectSocket() { try { if (mPseRec == null) { if (VDBG) Log.v(TAG, "connectSocket: UUID: " + BluetoothUuid.PBAP_PSE.getUuid()); mSocket = mDevice.createRfcommSocketToServiceRecord(BluetoothUuid.PBAP_PSE.getUuid()); } else if (mPseRec.getL2capPsm() != L2CAP_INVALID_PSM) { if (VDBG) Log.v(TAG, "connectSocket: PSM: " + mPseRec.getL2capPsm()); mSocket = mDevice.createL2capSocket(mPseRec.getL2capPsm()); } else { if (VDBG) Log.v(TAG, "connectSocket: channel: " + mPseRec.getRfcommChannelNumber()); mSocket = mDevice.createRfcommSocket(mPseRec.getRfcommChannelNumber()); } if (mSocket != null) { mSocket.connect(); return true; } else { Log.w(TAG, "Could not create socket"); } } catch (IOException e) { Log.e(TAG, "Error while connecting socket", e); } return false; }
Source:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvp1 = args[0]; TaggedValuePointable tvp2 = args[1]; if (!(tvp1.getTag() == ValueTag.ARRAY_TAG || tvp1.getTag() == ValueTag.OBJECT_TAG)) { throw new SystemException(ErrorCode.FORG0006); } if (tvp1.getTag() == ValueTag.ARRAY_TAG) { if (tvp2.getTag() != ValueTag.XS_INTEGER_TAG) { throw new SystemException(ErrorCode.FORG0006); } TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class); mvs.reset(); try { sb.reset(mvs); tvp1.getValue(ap); tvp2.getValue(lp); if ((int) lp.getLong() > ap.getEntryCount()) { XDMConstants.setEmptySequence(result); return; } ap.getEntry((int) lp.getLong() - 1, tempTvp); sb.addItem(ap.getEntryCount() != 0 ? tempTvp : tvp1); sb.finish(); result.set(mvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } finally { ppool.giveBack(tempTvp); } } else if (tvp1.getTag() == ValueTag.OBJECT_TAG) { if (tvp2.getTag() != ValueTag.XS_STRING_TAG) { throw new SystemException(ErrorCode.FORG0006); } TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class); try { mvs.reset(); sb.reset(mvs); tvp1.getValue(op); tvp2.getValue(sp); if (op.getValue(sp, tempTvp)) { sb.addItem(tempTvp); } sb.finish(); result.set(mvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } }

Target:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvp1 = args[0]; TaggedValuePointable tvp2 = args[1]; if (!(tvp1.getTag() == ValueTag.ARRAY_TAG || tvp1.getTag() == ValueTag.OBJECT_TAG)) { throw new SystemException(ErrorCode.FORG0006); } if (tvp1.getTag() == ValueTag.ARRAY_TAG) { if (tvp2.getTag() != ValueTag.XS_INTEGER_TAG) { throw new SystemException(ErrorCode.FORG0006); } TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class); mvs.reset(); try { sb.reset(mvs); tvp1.getValue(ap); tvp2.getValue(lp); if ((int) lp.getLong() > ap.getEntryCount()) { XDMConstants.setEmptySequence(result); return; } ap.getEntry((int) lp.getLong() - 1, tempTvp); sb.addItem(ap.getEntryCount() != 0 ? tempTvp : tvp1); sb.finish(); result.set(mvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } finally { ppool.giveBack(tempTvp); } } else if (tvp1.getTag() == ValueTag.OBJECT_TAG) { if (tvp2.getTag() != ValueTag.XS_STRING_TAG) { throw new SystemException(ErrorCode.FORG0006); } TaggedValuePointable tempTvp = ppool.takeOne(TaggedValuePointable.class); try { mvs.reset(); sb.reset(mvs); tvp1.getValue(op); tvp2.getValue(sp); if (op.getValue(sp, tempTvp)) { sb.addItem(tempTvp); } sb.finish(); result.set(mvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } finally { ppool.giveBack(tempTvp); } } }
Source:
protected VmDevice createVmDevice() { return new VmDevice(new VmDeviceId(disk.getId(), getVmId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", null, true, getParameters().isPlugUnPlug(), getDiskVmElement().isReadOnly(), FeatureSupported.isDomainXMLSupported(getVm().getClusterCompatibilityVersion()) ? String.format("%s%s", DomainXmlUtils.USER_ALIAS_PREFIX, disk.getId()) : "", null, getParameters().getSnapshotId(), null); }

Target:
protected VmDevice createVmDevice() { return new VmDevice(new VmDeviceId(disk.getId(), getVmId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName(), "", null, true, getParameters().isPlugUnPlug(), getDiskVmElement().isReadOnly(), getDeviceAliasForDisk(disk), null, getParameters().getSnapshotId(), null); }
Source:
private void showTextBox() { if (textBox == null) { textBox = new TextBox(); textBox.setText(getText()); textBox.setVisibleLength(visibleLen); textBox.setReadOnly(readOnly); textBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(final KeyPressEvent event) { if (event.isControlKeyDown() || event.isMetaKeyDown()) { switch (event.getCharCode()) { case 'c': case 'x': Scheduler.get().scheduleDeferred(new Command() { public void execute() { hideTextBox(); } }); break; } } } }); textBox.addBlurHandler(new BlurHandler() { @Override public void onBlur(final BlurEvent event) { hideTextBox(); } }); content.insert(textBox, 1); } textLabel.setVisible(false); textBox.setVisible(true); Scheduler.get().scheduleDeferred(new Command() { @Override public void execute() { textBox.selectAll(); textBox.setFocus(true); } }); }

Target:
private void showTextBox() { if (textBox == null) { textBox = new TextBox(); textBox.setText(getText()); textBox.setVisibleLength(visibleLen); textBox.setReadOnly(true); textBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(final KeyPressEvent event) { if (event.isControlKeyDown() || event.isMetaKeyDown()) { switch (event.getCharCode()) { case 'c': case 'x': Scheduler.get().scheduleDeferred(new Command() { public void execute() { hideTextBox(); } }); break; } } } }); textBox.addBlurHandler(new BlurHandler() { @Override public void onBlur(final BlurEvent event) { hideTextBox(); } }); content.insert(textBox, 1); } textLabel.setVisible(false); textBox.setVisible(true); Scheduler.get().scheduleDeferred(new Command() { @Override public void execute() { textBox.selectAll(); textBox.setFocus(true); } }); }
Source:
public static void main(String[] args) { GatewayServer gatewayServer = new GatewayServer(new DeepLearning4jEntryPoint()); gatewayServer.start(); logger.info("DeepLearning4j Gateway server running"); }

Target:
public static void main(String[] args) { GatewayServer gatewayServer = new GatewayServer(new DeepLearning4jEntryPoint()); gatewayServer.start(); log.info("DeepLearning4j Gateway server running"); }
Source:
private static ResultHolder getTypeFromVarInit(HaxeVarInit init) { final ResultHolder abstractEnumFieldInitType = HaxeAbstractEnumUtil.getStaticMemberExpression(init.getExpression()); if (abstractEnumFieldInitType != null) { return abstractEnumFieldInitType; } return HaxeTypeResolver.getPsiElementType(init.getExpression(), new HaxeGenericResolver()); }

Target:
private static ResultHolder getTypeFromVarInit(HaxeVarInit init) { final ResultHolder abstractEnumFieldInitType = HaxeAbstractEnumUtil.getStaticMemberExpression(init.getExpression()); if (abstractEnumFieldInitType != null) { return abstractEnumFieldInitType; } return HaxeTypeResolver.getPsiElementType(init.getExpression(), HaxeGenericResolverUtil.generateResolverFromScopeParents(init)); }
Source:
public void stop() { executor.shutdown(); super.stop(); setAttribute(Startable.SERVICE_UP, false); }

Target:
public void stop() { executor.shutdownNow(); super.stop(); setAttribute(Startable.SERVICE_UP, false); }
Source:
public void testRegistryFactoryIpCache() throws Exception { Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":2233")); Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostAddress() + ":2233")); Assert.assertNotSame(registry1, registry2); }

Target:
public void testRegistryFactoryIpCache() throws Exception { String hostName = NetUtils.getLocalAddress().getHostName(); String ip = NetUtils.getLocalAddress().getHostAddress(); Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + hostName + ":2233")); Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + ip + ":2233")); if (hostName.equals(ip)) { Assert.assertEquals(registry1, registry2); } else { Assert.assertNotSame(registry1, registry2); } }
Source:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); disp = new CompositeDisposable(); }

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); api = new OpenFoodAPIClient(requireActivity()); }
Source:
protected static void retrieveExpectedIssuesFromFile(File xmlFile, CheckVerifier checkVerifier) { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); try (FileInputStream is = new FileInputStream(xmlFile)) { XMLStreamReader reader = factory.createXMLStreamReader(is); while (reader.hasNext()) { int line = reader.getLocation().getLineNumber(); reader.next(); if (reader.getEventType() == XMLStreamReader.COMMENT) { String text = reader.getText().trim(); checkVerifier.collectExpectedIssues(text, line); } } reader.close(); } catch (XMLStreamException | IOException e) { Fail.fail("The test file can not be parsed to retrieve comments", e); } }

Target:
protected static void retrieveExpectedIssuesFromFile(File xmlFile, CheckVerifier checkVerifier) { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); try (FileInputStream is = new FileInputStream(xmlFile)) { XMLStreamReader reader = factory.createXMLStreamReader(is); while (reader.hasNext()) { int line = reader.getLocation().getLineNumber(); reader.next(); if (reader.getEventType() == XMLStreamReader.COMMENT) { String text = reader.getText().trim(); checkVerifier.collectExpectedIssues(text, line); } } } catch (XMLStreamException | IOException e) { Fail.fail("The test file can not be parsed to retrieve comments", e); } }
Source:
protected static void verifyPresentInDatastore(FeedbackQuestionAttributes expected, boolean wildcardId) { FeedbackQuestionAttributes actual = fqDb.getFeedbackQuestion(expected.feedbackSessionName, expected.courseId, expected.questionNumber); if (wildcardId) { expected.setId(actual.getId()); } setEqualTimestampBetweenExpectedAndActual(expected, actual); assertEquals(gson.toJson(expected), gson.toJson(actual)); }

Target:
protected static void verifyPresentInDatastore(FeedbackQuestionAttributes expected, boolean wildcardId) { FeedbackQuestionAttributes actual = fqDb.getFeedbackQuestion(expected.feedbackSessionName, expected.courseId, expected.questionNumber); if (wildcardId) { expected.setId(actual.getId()); } assertEquals(gson.toJson(expected), gson.toJson(actual)); }
Source:
public boolean existsTable(String databaseName, String tableName) throws TDClientException { try { for (TDTable table : listTables(databaseName)) { if (table.getName().equals(tableName)) { return true; } } return false; } catch (TDClientHttpException e) { if (e.getStatusCode() == 404) { return false; } else { throw e; } } }

Target:
public boolean existsTable(String databaseName, String tableName) throws TDClientException { try { for (TDTable table : listTables(databaseName)) { if (table.getName().equals(tableName)) { return true; } } return false; } catch (TDClientHttpException e) { if (e.getStatusCode() == HttpStatus.NOT_FOUND_404) { return false; } else { throw e; } } }
Source:
void handleActionResult(final VdcActionType actionType, final VdcActionParametersBase parameters, final VdcReturnValueBase result, final IFrontendActionAsyncCallback callback, final Object state, final boolean showErrorDialog) { logger.log(Level.FINER, "Retrieved action result from RunAction."); FrontendActionAsyncResult f = new FrontendActionAsyncResult(actionType, parameters, result, state); boolean failedOnCanDoAction = !result.getCanDoAction(); if (failedOnCanDoAction) { result.setCanDoActionMessages((ArrayList<String>) translateError(result)); } else if (showErrorDialog && result.getIsSyncronious() && !result.getSucceeded()) { runActionExecutionFailed(actionType, result.getFault()); } callback.executed(f); if (showErrorDialog && failedOnCanDoAction && (getEventsHandler() != null) && (getEventsHandler().isRaiseErrorModalPanel(actionType, result.getFault()))) { ArrayList<String> messages = result.getCanDoActionMessages(); failureEventHandler(result.getDescription(), messages.isEmpty() ? Collections.singletonList(getConstants().noCanDoActionMessage()) : messages); } }

Target:
void handleActionResult(final VdcActionType actionType, final VdcActionParametersBase parameters, final VdcReturnValueBase result, final IFrontendActionAsyncCallback callback, final Object state, final boolean showErrorDialog) { logger.log(Level.FINER, "Retrieved action result from RunAction."); FrontendActionAsyncResult f = new FrontendActionAsyncResult(actionType, parameters, result, state); boolean failedOnCanDoAction = !result.getCanDoAction(); if (failedOnCanDoAction) { result.setCanDoActionMessages((ArrayList<String>) translateError(result)); } else if (!result.getSucceeded()) { VdcFault fault = result.getFault(); fault.setMessage(translateVdcFault(fault)); if (showErrorDialog && result.getIsSyncronious() && getEventsHandler() != null) { getEventsHandler().runActionExecutionFailed(actionType, fault); } } callback.executed(f); if (showErrorDialog && failedOnCanDoAction && (getEventsHandler() != null) && (getEventsHandler().isRaiseErrorModalPanel(actionType, result.getFault()))) { ArrayList<String> messages = result.getCanDoActionMessages(); failureEventHandler(result.getDescription(), messages.isEmpty() ? Collections.singletonList(getConstants().noCanDoActionMessage()) : messages); } }
Source:
private double getIntegrandGivenArtifact(final double f, final double epsilon, final int nWithArtifact, final int nNoArtifact, final int xWithArtifact, final int xNoArtifact){ final BinomialDistribution binomWithArtifact = new BinomialDistribution(nWithArtifact, f + epsilon * (1-f)); final BinomialDistribution binomNoArtifact = new BinomialDistribution(nNoArtifact, f); final BetaDistribution betaPrior = new BetaDistribution(ALPHA, BETA); return betaPrior.density(epsilon) * binomWithArtifact.probability(xWithArtifact) * binomNoArtifact.probability(xNoArtifact); }

Target:
private double getIntegrandGivenArtifact(final double f, final double epsilon, final int nWithArtifact, final int nNoArtifact, final int xWithArtifact, final int xNoArtifact){ return betaPrior.density(epsilon) * MathUtils.binomialProbability(nWithArtifact, xWithArtifact, f + epsilon * (1-f)) * MathUtils.binomialProbability(nNoArtifact, xNoArtifact, f); }
Source:
protected void executeCommand() { try { VDSReturnValue vdsReturnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.DeleteImageGroup, new DeleteImageGroupVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getParameters().getImageGroupID(), getParameters() .getWipeAfterDelete(), false, getStoragePool().getcompatibility_version().toString())); if (vdsReturnValue.getSucceeded()) { getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), VdcActionType.RemoveVmTemplate, VdcObjectType.Storage, getParameters().getStorageDomainId())); setSucceeded(true); } } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { getReturnValue().setFault(new VdcFault(e, e.getErrorCode())); log.errorFormat("Image {0} does not exist in domain {1}.", getDiskImage().getId(), getParameters().getStorageDomainId()); setSucceeded(true); } else { throw e; } } }

Target:
protected void executeCommand() { VDSReturnValue vdsReturnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.DeleteImageGroup, new DeleteImageGroupVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getParameters().getImageGroupID(), getParameters() .getWipeAfterDelete(), false, getStoragePool().getcompatibility_version().toString())); if (vdsReturnValue.getSucceeded()) { getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), VdcActionType.RemoveVmTemplate, VdcObjectType.Storage, getParameters().getStorageDomainId())); setSucceeded(true); } }
Source:
public void testOffer() { FixedBucketsHistogram h = buildHistogram( 0, 200, 200, FixedBucketsHistogram.OutlierHandlingMode.OVERFLOW, VALUES2 ); float[] quantiles = h.percentilesFloat(new double[]{12.5f, 50.0f, 98f}); double[] doubles = new double[VALUES2.length]; for (int i = 0; i < doubles.length; i++) { doubles[i] = VALUES2[i]; } Percentile percentile = new Percentile(); percentile.setData(doubles); log.debug("MY-P12.5: " + quantiles[0]); log.debug("MY-P50: " + quantiles[1]); log.debug("MY-P98: " + quantiles[2]); log.debug("THEIR-P12.5: " + percentile.evaluate(12.5)); log.debug("THEIR-P50: " + percentile.evaluate(50)); log.debug("THEIR-P98: " + percentile.evaluate(98)); Assert.assertArrayEquals( new float[]{2.5f, 20.0f, 46.76f}, quantiles, 0.01f ); }

Target:
public void testOffer() { FixedBucketsHistogram h = buildHistogram( 0, 200, 200, FixedBucketsHistogram.OutlierHandlingMode.OVERFLOW, VALUES2 ); float[] quantiles = h.percentilesFloat(new double[]{12.5f, 50.0f, 98f}); double[] doubles = new double[VALUES2.length]; for (int i = 0; i < doubles.length; i++) { doubles[i] = VALUES2[i]; } Assert.assertArrayEquals( new float[]{2.5f, 20.0f, 46.76f}, quantiles, 0.01f ); }