before
stringlengths
14
203k
after
stringlengths
37
104k
repo
stringlengths
2
50
type
stringclasses
1 value
public Criteria andMobileNotIn(List<String> values) { if (values == null) { throw new RuntimeException("Value for " + "mobile" + " cannot be null"); } criteria.add(new Criterion("mobile not in", values)); return (Criteria) this; }
<DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "mobile" + " cannot be null"); } criteria.add(new Criterion("mobile not in", values)); </DeepExtract>
Gotrip
positive
@Override public void visitINVOKEVIRTUAL(InstructionHandle handle) { InstructionHandle nextHandle = handle.getNext(); sb.append(String.format("%d[label=\"%s\"];\n", handle.getPosition(), handle.toString())); if (nextHandle != null) { sb.append(String.format("%d -> %d[label=\"next\", color=\"#839096\"];\n", handle.getPosition(), nextHandle.getPosition())); } else { System.out.println("next == null"); } }
<DeepExtract> InstructionHandle nextHandle = handle.getNext(); sb.append(String.format("%d[label=\"%s\"];\n", handle.getPosition(), handle.toString())); if (nextHandle != null) { sb.append(String.format("%d -> %d[label=\"next\", color=\"#839096\"];\n", handle.getPosition(), nextHandle.getPosition())); } else { System.out.println("next == null"); } </DeepExtract>
Java-Bytecode-Editor
positive
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_custom_tab_layout); getSupportActionBar().setDisplayHomeAsUpEnabled(true); tabLayout = findViewById(R.id.tabLayout); viewPager = findViewById(R.id.viewPager); customAdapter = new CustomAdapter(getSupportFragmentManager(), fragments); viewPager.setAdapter(customAdapter); tabLayout.setupWithViewPager(viewPager); for (int i = 0; i < fragments.length; i++) { TabLayout.Tab tab = tabLayout.getTabAt(i); if (tab != null) { tab.setCustomView(customAdapter.getTabView(i, titles[i], images[i], this)); } } tabLayout.addOnTabSelectedListener(tabListener); viewPager.setCurrentItem(1); viewPager.setCurrentItem(0); }
<DeepExtract> getSupportActionBar().setDisplayHomeAsUpEnabled(true); tabLayout = findViewById(R.id.tabLayout); viewPager = findViewById(R.id.viewPager); customAdapter = new CustomAdapter(getSupportFragmentManager(), fragments); viewPager.setAdapter(customAdapter); tabLayout.setupWithViewPager(viewPager); for (int i = 0; i < fragments.length; i++) { TabLayout.Tab tab = tabLayout.getTabAt(i); if (tab != null) { tab.setCustomView(customAdapter.getTabView(i, titles[i], images[i], this)); } } tabLayout.addOnTabSelectedListener(tabListener); viewPager.setCurrentItem(1); viewPager.setCurrentItem(0); </DeepExtract>
Android-development-with-example
positive
@SuppressWarnings("deprecation") public void setBehindWidth(int i) { Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); try { Class<?> cls = Display.class; Class<?>[] parameterTypes = { Point.class }; Point parameter = new Point(); Method method = cls.getMethod("getSize", parameterTypes); method.invoke(display, parameter); width = parameter.x; } catch (Exception e) { width = display.getWidth(); } mViewBehind.setWidthOffset(width - i); }
<DeepExtract> mViewBehind.setWidthOffset(width - i); </DeepExtract>
quickmark
positive
public void notifyDataSetChanged() { tabsContainer.removeAllViews(); tabCount = pager.getAdapter().getCount(); for (int i = 0; i < tabCount; i++) { if (pager.getAdapter() instanceof IconTabProvider) { addIconTab(i, ((IconTabProvider) pager.getAdapter()).getPageIconResId(i)); } else { addTextTab(i, pager.getAdapter().getPageTitle(i).toString()); } } for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { getViewTreeObserver().removeGlobalOnLayoutListener(this); currentPosition = pager.getCurrentItem(); scrollToChild(currentPosition, 0); } }); }
<DeepExtract> for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } </DeepExtract>
H5Game-Android-App
positive
protected void round2(int[] d) { return (((A + G(B, C, D) + d[0] + 0x5a827999) << 3) | ((A + G(B, C, D) + d[0] + 0x5a827999) >>> (32 - 3))); return (((D + G(A, B, C) + d[4] + 0x5a827999) << 5) | ((D + G(A, B, C) + d[4] + 0x5a827999) >>> (32 - 5))); return (((C + G(D, A, B) + d[8] + 0x5a827999) << 9) | ((C + G(D, A, B) + d[8] + 0x5a827999) >>> (32 - 9))); return (((B + G(C, D, A) + d[12] + 0x5a827999) << 13) | ((B + G(C, D, A) + d[12] + 0x5a827999) >>> (32 - 13))); return (((A + G(B, C, D) + d[1] + 0x5a827999) << 3) | ((A + G(B, C, D) + d[1] + 0x5a827999) >>> (32 - 3))); return (((D + G(A, B, C) + d[5] + 0x5a827999) << 5) | ((D + G(A, B, C) + d[5] + 0x5a827999) >>> (32 - 5))); return (((C + G(D, A, B) + d[9] + 0x5a827999) << 9) | ((C + G(D, A, B) + d[9] + 0x5a827999) >>> (32 - 9))); return (((B + G(C, D, A) + d[13] + 0x5a827999) << 13) | ((B + G(C, D, A) + d[13] + 0x5a827999) >>> (32 - 13))); return (((A + G(B, C, D) + d[2] + 0x5a827999) << 3) | ((A + G(B, C, D) + d[2] + 0x5a827999) >>> (32 - 3))); return (((D + G(A, B, C) + d[6] + 0x5a827999) << 5) | ((D + G(A, B, C) + d[6] + 0x5a827999) >>> (32 - 5))); return (((C + G(D, A, B) + d[10] + 0x5a827999) << 9) | ((C + G(D, A, B) + d[10] + 0x5a827999) >>> (32 - 9))); return (((B + G(C, D, A) + d[14] + 0x5a827999) << 13) | ((B + G(C, D, A) + d[14] + 0x5a827999) >>> (32 - 13))); return (((A + G(B, C, D) + d[3] + 0x5a827999) << 3) | ((A + G(B, C, D) + d[3] + 0x5a827999) >>> (32 - 3))); return (((D + G(A, B, C) + d[7] + 0x5a827999) << 5) | ((D + G(A, B, C) + d[7] + 0x5a827999) >>> (32 - 5))); return (((C + G(D, A, B) + d[11] + 0x5a827999) << 9) | ((C + G(D, A, B) + d[11] + 0x5a827999) >>> (32 - 9))); return (((B + G(C, D, A) + d[15] + 0x5a827999) << 13) | ((B + G(C, D, A) + d[15] + 0x5a827999) >>> (32 - 13))); }
<DeepExtract> return (((A + G(B, C, D) + d[0] + 0x5a827999) << 3) | ((A + G(B, C, D) + d[0] + 0x5a827999) >>> (32 - 3))); </DeepExtract> <DeepExtract> return (((D + G(A, B, C) + d[4] + 0x5a827999) << 5) | ((D + G(A, B, C) + d[4] + 0x5a827999) >>> (32 - 5))); </DeepExtract> <DeepExtract> return (((C + G(D, A, B) + d[8] + 0x5a827999) << 9) | ((C + G(D, A, B) + d[8] + 0x5a827999) >>> (32 - 9))); </DeepExtract> <DeepExtract> return (((B + G(C, D, A) + d[12] + 0x5a827999) << 13) | ((B + G(C, D, A) + d[12] + 0x5a827999) >>> (32 - 13))); </DeepExtract> <DeepExtract> return (((A + G(B, C, D) + d[1] + 0x5a827999) << 3) | ((A + G(B, C, D) + d[1] + 0x5a827999) >>> (32 - 3))); </DeepExtract> <DeepExtract> return (((D + G(A, B, C) + d[5] + 0x5a827999) << 5) | ((D + G(A, B, C) + d[5] + 0x5a827999) >>> (32 - 5))); </DeepExtract> <DeepExtract> return (((C + G(D, A, B) + d[9] + 0x5a827999) << 9) | ((C + G(D, A, B) + d[9] + 0x5a827999) >>> (32 - 9))); </DeepExtract> <DeepExtract> return (((B + G(C, D, A) + d[13] + 0x5a827999) << 13) | ((B + G(C, D, A) + d[13] + 0x5a827999) >>> (32 - 13))); </DeepExtract> <DeepExtract> return (((A + G(B, C, D) + d[2] + 0x5a827999) << 3) | ((A + G(B, C, D) + d[2] + 0x5a827999) >>> (32 - 3))); </DeepExtract> <DeepExtract> return (((D + G(A, B, C) + d[6] + 0x5a827999) << 5) | ((D + G(A, B, C) + d[6] + 0x5a827999) >>> (32 - 5))); </DeepExtract> <DeepExtract> return (((C + G(D, A, B) + d[10] + 0x5a827999) << 9) | ((C + G(D, A, B) + d[10] + 0x5a827999) >>> (32 - 9))); </DeepExtract> <DeepExtract> return (((B + G(C, D, A) + d[14] + 0x5a827999) << 13) | ((B + G(C, D, A) + d[14] + 0x5a827999) >>> (32 - 13))); </DeepExtract> <DeepExtract> return (((A + G(B, C, D) + d[3] + 0x5a827999) << 3) | ((A + G(B, C, D) + d[3] + 0x5a827999) >>> (32 - 3))); </DeepExtract> <DeepExtract> return (((D + G(A, B, C) + d[7] + 0x5a827999) << 5) | ((D + G(A, B, C) + d[7] + 0x5a827999) >>> (32 - 5))); </DeepExtract> <DeepExtract> return (((C + G(D, A, B) + d[11] + 0x5a827999) << 9) | ((C + G(D, A, B) + d[11] + 0x5a827999) >>> (32 - 9))); </DeepExtract> <DeepExtract> return (((B + G(C, D, A) + d[15] + 0x5a827999) << 13) | ((B + G(C, D, A) + d[15] + 0x5a827999) >>> (32 - 13))); </DeepExtract>
androidquery
positive
@RequestMapping(method = RequestMethod.GET) public String getAdminPage(Model model) { AdminSettings settings = new AdminSettings(); model.addAttribute("adminSettings", settings); model.addAttribute("paused", timerService.isPaused()); List<String> list = gameSettingsService.getGameLevelsList(); model.addAttribute("levelsList", list); settings.setSelectedLevels(gameSettingsService.getCurrentGameLevels()); List<String> list = gameSettingsService.getProtocols(); model.addAttribute("protocolsList", list); settings.setSelectedProtocol(gameSettingsService.getCurentProtocol()); List<PlayerInfo> players = playerService.getPlayersGames(); if (!players.isEmpty()) { model.addAttribute("players", players); } settings.setPlayers(players); return "admin"; }
<DeepExtract> model.addAttribute("paused", timerService.isPaused()); </DeepExtract> <DeepExtract> List<String> list = gameSettingsService.getGameLevelsList(); model.addAttribute("levelsList", list); settings.setSelectedLevels(gameSettingsService.getCurrentGameLevels()); </DeepExtract> <DeepExtract> List<String> list = gameSettingsService.getProtocols(); model.addAttribute("protocolsList", list); settings.setSelectedProtocol(gameSettingsService.getCurentProtocol()); </DeepExtract> <DeepExtract> List<PlayerInfo> players = playerService.getPlayersGames(); if (!players.isEmpty()) { model.addAttribute("players", players); } settings.setPlayers(players); </DeepExtract>
tetris
positive
public Criteria andUpdate_timeLessThanOrEqualTo(Date value) { if (value == null) { throw new RuntimeException("Value for " + "update_time" + " cannot be null"); } criteria.add(new Criterion("update_time <=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "update_time" + " cannot be null"); } criteria.add(new Criterion("update_time <=", value)); </DeepExtract>
SpringBootLearning
positive
@Override public void repaint() { if (model.size() == 0) return; GraphicsContext gc = canvas.getGraphicsContext2D(); this.w = canvas.getWidth(); this.h = canvas.getHeight(); gc.clearRect(0, 0, w, h); double rectCalc = w - 2 * XPAD; rectLength = rectCalc < h - 2 * YPAD ? rectCalc : h - 2 * YPAD; this.rectLength = rectCalc / model.size(); this.x0 = (w - model.size() * rectLength) / 2; this.y0 = h / 2 - rectLength / 2; gc.setFont(markerFont); gc.setTextBaseline(VPos.BOTTOM); synchronized (markers) { for (Map.Entry<Integer, String> entry : markers.entrySet()) { gc.setFill(highlightedMarkers.contains(entry.getKey()) ? Color.RED : Color.BLACK); double x = getX(entry.getKey()); gc.beginPath(); gc.fillText(entry.getValue(), x + rectLength / 2, y0 - 7, rectLength); gc.closePath(); } } gc.setTextBaseline(VPos.CENTER); synchronized (list) { for (int i = 0; i < list.length; ++i) { if (swapping && (i == animatedLeftIndex || i == animatedRightIndex)) continue; else if (emphasising && i == emphasiseIndex) { Color blend = Color.SKYBLUE.interpolate(Color.RED, emphasiseProgress.doubleValue()); drawTextBox(gc, i, list[i] + "", blend); } else drawTextBox(gc, i, list[i] + ""); } } if (swapping) { drawTextBox(gc, animatedLeftX.doubleValue() * w, animatedLeftY.doubleValue() * h, animatedLeftLabel); drawTextBox(gc, animatedRightX.doubleValue() * w, animatedRightY.doubleValue() * h, animatedRightLabel); } }
<DeepExtract> double rectCalc = w - 2 * XPAD; rectLength = rectCalc < h - 2 * YPAD ? rectCalc : h - 2 * YPAD; this.rectLength = rectCalc / model.size(); this.x0 = (w - model.size() * rectLength) / 2; this.y0 = h / 2 - rectLength / 2; </DeepExtract> <DeepExtract> gc.setFont(markerFont); gc.setTextBaseline(VPos.BOTTOM); synchronized (markers) { for (Map.Entry<Integer, String> entry : markers.entrySet()) { gc.setFill(highlightedMarkers.contains(entry.getKey()) ? Color.RED : Color.BLACK); double x = getX(entry.getKey()); gc.beginPath(); gc.fillText(entry.getValue(), x + rectLength / 2, y0 - 7, rectLength); gc.closePath(); } } </DeepExtract> <DeepExtract> gc.setTextBaseline(VPos.CENTER); synchronized (list) { for (int i = 0; i < list.length; ++i) { if (swapping && (i == animatedLeftIndex || i == animatedRightIndex)) continue; else if (emphasising && i == emphasiseIndex) { Color blend = Color.SKYBLUE.interpolate(Color.RED, emphasiseProgress.doubleValue()); drawTextBox(gc, i, list[i] + "", blend); } else drawTextBox(gc, i, list[i] + ""); } } </DeepExtract>
Simulizer
positive
public boolean logEnabled() { if (mapProperties == null) { return true; } final Object object = mapProperties.get("log4jdbc.enabled"); if (object == null) { return true; } final String property = (String) object; return Boolean.valueOf(property).booleanValue(); }
<DeepExtract> if (mapProperties == null) { return true; } final Object object = mapProperties.get("log4jdbc.enabled"); if (object == null) { return true; } final String property = (String) object; return Boolean.valueOf(property).booleanValue(); </DeepExtract>
log4jdbc
positive
@Override public void showMediaData(MediaEntity mediaEntity) { mVideoPlayHeader.bindData(mediaEntity); }
<DeepExtract> mVideoPlayHeader.bindData(mediaEntity); </DeepExtract>
meiShi
positive
public static void main(String[] args) { int[] bucket = new int[10]; for (int bucketInt : bucket) { bucketInt = 0; } for (int i = 0; i < 100; i++) { int random = randInt(); if (random <= 10) { bucket[0]++; } else if (random <= 20) { bucket[1]++; } else if (random <= 30) { bucket[2]++; } else if (random <= 40) { bucket[3]++; } else if (random <= 50) { bucket[4]++; } else if (random <= 60) { bucket[5]++; } else if (random <= 70) { bucket[6]++; } else if (random <= 80) { bucket[7]++; } else if (random <= 90) { bucket[8]++; } else if (random <= 100) { bucket[9]++; } System.out.println(random); } System.out.println("BucketList"); for (int bucketCell : bucket) { System.out.println(bucketCell); } }
<DeepExtract> int[] bucket = new int[10]; for (int bucketInt : bucket) { bucketInt = 0; } for (int i = 0; i < 100; i++) { int random = randInt(); if (random <= 10) { bucket[0]++; } else if (random <= 20) { bucket[1]++; } else if (random <= 30) { bucket[2]++; } else if (random <= 40) { bucket[3]++; } else if (random <= 50) { bucket[4]++; } else if (random <= 60) { bucket[5]++; } else if (random <= 70) { bucket[6]++; } else if (random <= 80) { bucket[7]++; } else if (random <= 90) { bucket[8]++; } else if (random <= 100) { bucket[9]++; } System.out.println(random); } System.out.println("BucketList"); for (int bucketCell : bucket) { System.out.println(bucketCell); } </DeepExtract>
coding
positive
public static boolean isIP(String str) { String num = "(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)"; String regex = "^" + num + "\\." + num + "\\." + num + "\\." + num + "$"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(str); return matcher.matches(); }
<DeepExtract> Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(str); return matcher.matches(); </DeepExtract>
resys-one
positive
@Test public void testEditImagePreservesFullReferences() { switchToSource(); setSourceText("[[image:xwiki:[email protected]]] [[image:[email protected]]]"); switchToWysiwyg(); selectNode("document.body.firstChild.firstChild"); clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_EDIT_IMAGE)); clickMenu(MENU_EDIT_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_SELECTOR)); getDriver().waitUntilElementIsVisible(By.className(STEP_EXPLORER)); getDriver().waitUntilElementIsVisible(By.xpath(SPACE_SELECTOR + "/option[. = \"" + "XWiki" + "\"]")); assertEquals("XWiki", getSelenium().getSelectedLabel(SPACE_SELECTOR)); getDriver().waitUntilElementIsVisible(By.xpath(PAGE_SELECTOR + "/option[. = \"" + "AdminSheet" + "\"]")); assertEquals("AdminSheet", getSelenium().getSelectedLabel(PAGE_SELECTOR)); assertImageSelected("import.png"); clickButtonWithText(BUTTON_SELECT); getDriver().waitUntilElementIsVisible(By.className(STEP_CONFIG)); clickButtonWithText(BUTTON_INSERT_IMAGE); waitForDialogToClose(); selectNode("document.body.firstChild.childNodes[2]"); clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_EDIT_IMAGE)); clickMenu(MENU_EDIT_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_SELECTOR)); getDriver().waitUntilElementIsVisible(By.className(STEP_EXPLORER)); getDriver().waitUntilElementIsVisible(By.xpath(SPACE_SELECTOR + "/option[. = \"" + "XWiki" + "\"]")); assertEquals("XWiki", getSelenium().getSelectedLabel(SPACE_SELECTOR)); getDriver().waitUntilElementIsVisible(By.xpath(PAGE_SELECTOR + "/option[. = \"" + "AdminSheet" + "\"]")); assertEquals("AdminSheet", getSelenium().getSelectedLabel(PAGE_SELECTOR)); assertImageSelected("export.png"); clickButtonWithText(BUTTON_SELECT); getDriver().waitUntilElementIsVisible(By.className(STEP_CONFIG)); clickButtonWithText(BUTTON_INSERT_IMAGE); waitForDialogToClose(); switchToSource(); assertSourceText("[[image:xwiki:[email protected]]] [[image:[email protected]]]"); }
<DeepExtract> clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_EDIT_IMAGE)); clickMenu(MENU_EDIT_IMAGE); waitForDialogToLoad(); </DeepExtract> <DeepExtract> getDriver().waitUntilElementIsVisible(By.className(STEP_SELECTOR)); </DeepExtract> <DeepExtract> getDriver().waitUntilElementIsVisible(By.className(STEP_EXPLORER)); </DeepExtract> <DeepExtract> getDriver().waitUntilElementIsVisible(By.xpath(SPACE_SELECTOR + "/option[. = \"" + "XWiki" + "\"]")); assertEquals("XWiki", getSelenium().getSelectedLabel(SPACE_SELECTOR)); getDriver().waitUntilElementIsVisible(By.xpath(PAGE_SELECTOR + "/option[. = \"" + "AdminSheet" + "\"]")); assertEquals("AdminSheet", getSelenium().getSelectedLabel(PAGE_SELECTOR)); assertImageSelected("import.png"); </DeepExtract> <DeepExtract> getDriver().waitUntilElementIsVisible(By.className(STEP_CONFIG)); </DeepExtract> <DeepExtract> clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_EDIT_IMAGE)); clickMenu(MENU_EDIT_IMAGE); waitForDialogToLoad(); </DeepExtract> <DeepExtract> getDriver().waitUntilElementIsVisible(By.className(STEP_SELECTOR)); </DeepExtract> <DeepExtract> getDriver().waitUntilElementIsVisible(By.className(STEP_EXPLORER)); </DeepExtract> <DeepExtract> getDriver().waitUntilElementIsVisible(By.xpath(SPACE_SELECTOR + "/option[. = \"" + "XWiki" + "\"]")); assertEquals("XWiki", getSelenium().getSelectedLabel(SPACE_SELECTOR)); getDriver().waitUntilElementIsVisible(By.xpath(PAGE_SELECTOR + "/option[. = \"" + "AdminSheet" + "\"]")); assertEquals("AdminSheet", getSelenium().getSelectedLabel(PAGE_SELECTOR)); assertImageSelected("export.png"); </DeepExtract> <DeepExtract> getDriver().waitUntilElementIsVisible(By.className(STEP_CONFIG)); </DeepExtract>
xwiki-enterprise
positive
public Criteria andUidLessThan(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "uid" + " cannot be null"); } criteria.add(new Criterion("uid <", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "uid" + " cannot be null"); } criteria.add(new Criterion("uid <", value)); </DeepExtract>
CuitJavaEEPractice
positive
static Parameter currentPeriod() { try { return Parameters.class.getMethod("methodWithCurrentPeriodParameter", Period.class).getParameters()[0]; } catch (final NoSuchMethodException e) { throw new RuntimeException(e); } }
<DeepExtract> try { return Parameters.class.getMethod("methodWithCurrentPeriodParameter", Period.class).getParameters()[0]; } catch (final NoSuchMethodException e) { throw new RuntimeException(e); } </DeepExtract>
fyodor
positive
private int getMaxPlayer() { return Player.matchPair(getPlayerTurn()); }
<DeepExtract> return Player.matchPair(getPlayerTurn()); </DeepExtract>
gnubridge
positive
private String createNameOfCompositeCommand(List<Command> commands, String operator) { StringBuffer result = new StringBuffer(operator); commands.forEach(event -> result.append("_" + event.getName())); StringBuffer result = new StringBuffer(" Event: " + name + " (" + this.getClass().getSimpleName() + ")"); result.append(" triggers " + triggeredAlternativeCommands.size() + " command(s): "); triggeredAlternativeCommands.forEach(command -> result.append(command.getName() + " (" + command.getClass().getSimpleName() + ") ")); return result.toString() + "\n"; }
<DeepExtract> StringBuffer result = new StringBuffer(" Event: " + name + " (" + this.getClass().getSimpleName() + ")"); result.append(" triggers " + triggeredAlternativeCommands.size() + " command(s): "); triggeredAlternativeCommands.forEach(command -> result.append(command.getName() + " (" + command.getClass().getSimpleName() + ") ")); return result.toString() + "\n"; </DeepExtract>
MDSL-Specification
positive
public void dealCards() { prefs.saveCanfieldDrawModeOld(); moveToStack(getMainStack().getTopCard(), stacks[5], OPTION_NO_RECORD); stacks[5].getTopCard().flipUp(); startCardValue = stacks[5].getTopCard().getValue(); Bitmap bitmap; switch(startCardValue) { case 1: default: bitmap = Stack.background1; break; case 2: bitmap = Stack.background2; break; case 3: bitmap = Stack.background3; break; case 4: bitmap = Stack.background4; break; case 5: bitmap = Stack.background5; break; case 6: bitmap = Stack.background6; break; case 7: bitmap = Stack.background7; break; case 8: bitmap = Stack.background8; break; case 9: bitmap = Stack.background9; break; case 10: bitmap = Stack.background10; break; case 11: bitmap = Stack.background11; break; case 12: bitmap = Stack.background12; break; case 13: bitmap = Stack.background13; break; } for (int i = 5; i < 9; i++) { stacks[i].setImageBitmap(bitmap); } if (prefs.getSavedCanfieldDrawModeOld().equals("3")) { for (int i = 0; i < 3; i++) { moveToStack(getMainStack().getTopCard(), stacks[9 + i], OPTION_NO_RECORD); stacks[9 + i].getCard(0).flipUp(); } } else { if (!getMainStack().isEmpty()) { moveToStack(getMainStack().getTopCard(), stacks[11], OPTION_NO_RECORD); stacks[11].getCard(0).flipUp(); } } for (int i = 0; i < 4; i++) { moveToStack(getMainStack().getTopCard(), stacks[i], OPTION_NO_RECORD); stacks[i].getCard(0).flipUp(); } for (int i = 0; i < prefs.getSavedCanfieldSizeOfReserve(); i++) { moveToStack(getMainStack().getTopCard(), stacks[4], OPTION_NO_RECORD); } stacks[4].flipTopCardUp(); }
<DeepExtract> Bitmap bitmap; switch(startCardValue) { case 1: default: bitmap = Stack.background1; break; case 2: bitmap = Stack.background2; break; case 3: bitmap = Stack.background3; break; case 4: bitmap = Stack.background4; break; case 5: bitmap = Stack.background5; break; case 6: bitmap = Stack.background6; break; case 7: bitmap = Stack.background7; break; case 8: bitmap = Stack.background8; break; case 9: bitmap = Stack.background9; break; case 10: bitmap = Stack.background10; break; case 11: bitmap = Stack.background11; break; case 12: bitmap = Stack.background12; break; case 13: bitmap = Stack.background13; break; } for (int i = 5; i < 9; i++) { stacks[i].setImageBitmap(bitmap); } </DeepExtract>
Simple-Solitaire
positive
public void setViewPager(ViewPager pager) { this.pager = pager; if (pager.getAdapter() == null) { throw new IllegalStateException("ViewPager does not have adapter instance."); } this.delegatePageListener = pageListener; tabsContainer.removeAllViews(); tabCount = pager.getAdapter().getCount(); for (int i = 0; i < tabCount; i++) { if (pager.getAdapter() instanceof IconTabProvider) { addIconTab(i, ((IconTabProvider) pager.getAdapter()).getPageIconResId(i)); } else { addTextTab(i, pager.getAdapter().getPageTitle(i).toString()); } } updateTabStyles(); getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @SuppressWarnings("deprecation") @SuppressLint("NewApi") @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { getViewTreeObserver().removeOnGlobalLayoutListener(this); } currentPosition = pager.getCurrentItem(); scrollToChild(currentPosition, 0); } }); }
<DeepExtract> this.delegatePageListener = pageListener; </DeepExtract> <DeepExtract> tabsContainer.removeAllViews(); tabCount = pager.getAdapter().getCount(); for (int i = 0; i < tabCount; i++) { if (pager.getAdapter() instanceof IconTabProvider) { addIconTab(i, ((IconTabProvider) pager.getAdapter()).getPageIconResId(i)); } else { addTextTab(i, pager.getAdapter().getPageTitle(i).toString()); } } updateTabStyles(); getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @SuppressWarnings("deprecation") @SuppressLint("NewApi") @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { getViewTreeObserver().removeOnGlobalLayoutListener(this); } currentPosition = pager.getCurrentItem(); scrollToChild(currentPosition, 0); } }); </DeepExtract>
Android_Study_Demos
positive
@EventHandler(priority = EventPriority.NORMAL) public void motdNormal(PlayerJoinEvent event) { final Player player = event.getPlayer(); if (MUtil.isntPlayer(player)) return; final MPlayer mplayer = MPlayer.get(player); final Faction faction = mplayer.getFaction(); if (!faction.hasMotd()) return; if (EventPriority.NORMAL != MConf.get().motdPriority) return; if (!MixinActual.get().isActualJoin(event)) return; final List<Object> messages = faction.getMotdMessages(); if (MConf.get().motdDelayTicks < 0) { MixinMessage.get().messageOne(player, messages); } else { Bukkit.getScheduler().scheduleSyncDelayedTask(Factions.get(), new Runnable() { @Override public void run() { MixinMessage.get().messageOne(player, messages); } }, MConf.get().motdDelayTicks); } }
<DeepExtract> final Player player = event.getPlayer(); if (MUtil.isntPlayer(player)) return; final MPlayer mplayer = MPlayer.get(player); final Faction faction = mplayer.getFaction(); if (!faction.hasMotd()) return; if (EventPriority.NORMAL != MConf.get().motdPriority) return; if (!MixinActual.get().isActualJoin(event)) return; final List<Object> messages = faction.getMotdMessages(); if (MConf.get().motdDelayTicks < 0) { MixinMessage.get().messageOne(player, messages); } else { Bukkit.getScheduler().scheduleSyncDelayedTask(Factions.get(), new Runnable() { @Override public void run() { MixinMessage.get().messageOne(player, messages); } }, MConf.get().motdDelayTicks); } </DeepExtract>
Factions
positive
void copyAndMerge(OpPrivateBlocksList copy, OpPrivateBlocksList parent, int superBlockDepth) { if (dbAccess != null) { throw new UnsupportedOperationException(); } blocks.addAll(copy.blocks); blocks.addAll(parent.blocks); blockHeaders.addAll(copy.blockHeaders); blockHeaders.addAll(parent.blockHeaders); blocksInfo.putAll(copy.blocksInfo); blocksInfo.putAll(parent.blocksInfo); String sb = getSuperBlockHash(); for (OpBlock blHeader : blockHeaders) { blHeader.putCacheObject(OpBlock.F_SUPERBLOCK_HASH, sb); } }
<DeepExtract> String sb = getSuperBlockHash(); for (OpBlock blHeader : blockHeaders) { blHeader.putCacheObject(OpBlock.F_SUPERBLOCK_HASH, sb); } </DeepExtract>
opendb
positive
public static boolean isExtension(String filename, Collection<String> extensions) { if (filename == null) { return false; } if (extensions == null || extensions.isEmpty()) { return indexOfExtension(filename) == -1; } String fileExt; if (filename == null) { fileExt = null; } int index = indexOfExtension(filename); if (index == -1) { fileExt = ""; } else { fileExt = filename.substring(index + 1); } for (String extension : extensions) { if (fileExt.equals(extension)) { return true; } } return false; }
<DeepExtract> String fileExt; if (filename == null) { fileExt = null; } int index = indexOfExtension(filename); if (index == -1) { fileExt = ""; } else { fileExt = filename.substring(index + 1); } </DeepExtract>
BtcMonitor
positive
@Test public void testGreaterThanEqNegative() { MockObject mockObject = new MockObject("someid", "hello", 10); mockObject.simpleList = Arrays.asList("a", "b", "c"); coll.insert(mockObject); return mockObject; final MongoCursor<MockObject> cursor = coll.find(DBQuery.greaterThanEquals("integer", 11)).iterator(); assertThat(cursor.hasNext(), equalTo(false)); }
<DeepExtract> MockObject mockObject = new MockObject("someid", "hello", 10); mockObject.simpleList = Arrays.asList("a", "b", "c"); coll.insert(mockObject); return mockObject; </DeepExtract>
mongojack
positive
public static TextureAtlasSprite forItem(TextureMap ir, Item item) { return ir.registerSprite(new ResourceLocation(ConstantMod.modId, item.getUnlocalizedName().replaceAll("item\\.", ""))); }
<DeepExtract> return ir.registerSprite(new ResourceLocation(ConstantMod.modId, item.getUnlocalizedName().replaceAll("item\\.", ""))); </DeepExtract>
Aura-Cascade
positive
public void startDocument(String encoding, Boolean standalone) throws IOException, IllegalArgumentException, IllegalStateException { int pos = mPos; if (pos >= (BUFFER_LEN - 1)) { flush(); pos = mPos; } mText[pos] = "<?xml version='1.0' encoding='utf-8' standalone='" + (standalone ? "yes" : "no") + "' ?>\n"; mPos = pos + 1; mLineStart = true; }
<DeepExtract> int pos = mPos; if (pos >= (BUFFER_LEN - 1)) { flush(); pos = mPos; } mText[pos] = "<?xml version='1.0' encoding='utf-8' standalone='" + (standalone ? "yes" : "no") + "' ?>\n"; mPos = pos + 1; </DeepExtract>
XPrivacy
positive
public void onAccount(AccountData accountData) { Event event = new Event(EventTypeEnum.EVENT_ACCOUNT, accountData); eventDispatcher.putEvent(event); }
<DeepExtract> Event event = new Event(EventTypeEnum.EVENT_ACCOUNT, accountData); eventDispatcher.putEvent(event); </DeepExtract>
QuantWorld
positive
private void startAudienceTimer() { Log.d(Constants.LOG_TAG, "startAudienceTimer ...."); if (mLiveAudienceComeTimer == null || mLiveAudienceComeTimerGoneTimer == null) { mLiveAudienceComeTimer = new Timer(); mLiveAudienceComeTimerGoneTimer = new Timer(); } mLiveAudienceComeTimer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { liveHandler.postDelayed(mAudienceComeRunnable, 100); } }, 100, 6000); mLiveAudienceComeTimerGoneTimer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { liveHandler.postDelayed(mAudienceComeGoneRunnable, 100); } }, 100, 8000); }
<DeepExtract> mLiveAudienceComeTimer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { liveHandler.postDelayed(mAudienceComeRunnable, 100); } }, 100, 6000); </DeepExtract> <DeepExtract> mLiveAudienceComeTimerGoneTimer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { liveHandler.postDelayed(mAudienceComeGoneRunnable, 100); } }, 100, 8000); </DeepExtract>
KSYMediaPlayerKit_Android
positive
@Override public void onClick(DialogInterface dialogInterface, int i, boolean b) { int s = 0; for (int j = 0; j < 4; j++) if (chks[j]) s |= 1 << j; SharedPreferences.Editor edit = sp.edit(); edit.putInt("pyrv", solvePyr = s); edit.apply(); if (currentScramble.isPyrScramble()) { if (s > 0) { final int sel = s; new Thread() { public void run() { handler.sendEmptyMessage(4); currentScramble.updateHint(sel); showScramble(); scrambleState = SCRAMBLING_NEXT; if (nextScramble != null) nextScramble.updateHint(sel); scrambleState = SCRAMBLE_DONE; handler.sendEmptyMessage(26); } }.start(); } else { currentScramble.updateHint(0); tvScramble.setText(currentScramble.getScramble()); if (nextScramble != null) nextScramble.updateHint(0); } } }
<DeepExtract> SharedPreferences.Editor edit = sp.edit(); edit.putInt("pyrv", solvePyr = s); edit.apply(); </DeepExtract>
DCTimer-Android
positive
@Test public void testAlignBottomInside() { Abstract3dModel ts = testSubject.align(Side.BOTTOM, base, true); assertBoundaryEquals(testSubjectsBoundaries.getX(), ts.getBoundaries().getX()); assertBoundaryEquals(testSubjectsBoundaries.getY(), ts.getBoundaries().getY()); assertDoubleEquals(base.getBoundaries().getZ().getMin(), ts.getBoundaries().getZ().getMin()); }
<DeepExtract> assertBoundaryEquals(testSubjectsBoundaries.getX(), ts.getBoundaries().getX()); </DeepExtract> <DeepExtract> assertBoundaryEquals(testSubjectsBoundaries.getY(), ts.getBoundaries().getY()); </DeepExtract>
javascad
positive
@Override public void setupViews() { setContentView(R.layout.warning_layout); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle("Warning"); toolbar.setTitleTextColor(Color.parseColor("#ffffff")); setSupportActionBar(toolbar); mLowEditText = (EditText) findViewById(R.id.et_lowprice); mHightTeEditText = (EditText) findViewById(R.id.et_highprice); mSpinnerWarnPlatiform = (Spinner) findViewById(R.id.sp_warnplatiform); mSpinnerPf1 = (Spinner) findViewById(R.id.sp_pf1); mSpinnerPf2 = (Spinner) findViewById(R.id.sp_pf2); mPriceInterval = (EditText) findViewById(R.id.et_priceinterval); mBtnSave = (Button) findViewById(R.id.btn_save); mBtnSave.setOnClickListener(this); String[] pfName = getResources().getStringArray(R.array.platiform_name); mWarnPfAdapter = new PfNameSpinnerAdapter(this, pfName); mSpinnerWarnPlatiform.setAdapter(mWarnPfAdapter); mSpinnerPf1.setAdapter(mWarnPfAdapter); mSpinnerPf2.setAdapter(mWarnPfAdapter); }
<DeepExtract> Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle("Warning"); toolbar.setTitleTextColor(Color.parseColor("#ffffff")); setSupportActionBar(toolbar); </DeepExtract>
BtcMonitor
positive
public YearMonth plusYears(long yearsToAdd) { if (yearsToAdd == 0) { return this; } int newYear = YEAR.checkValidIntValue(this.year + yearsToAdd); if (this.year == newYear && this.month == this.month) { return this; } return new YearMonth(newYear, this.month); }
<DeepExtract> if (this.year == newYear && this.month == this.month) { return this; } return new YearMonth(newYear, this.month); </DeepExtract>
gwt-time
positive
@Override public void convert() { if (isCorona && !skins.isEmpty() && mapConverter.convertTextures()) { for (final UPackageRessource skinMaterial : this.skins) { skinMaterial.export(UTPackageExtractor.getExtractor(mapConverter, skinMaterial)); replaceWith(T3DEmitter.createLensFlare(mapConverter, this)); } return; } if (mapConverter.isFrom(UnrealEngine.UE1, UE2) && mapConverter.isTo(UnrealEngine.UE3, UnrealEngine.UE4, UnrealEngine.UE5)) { this.rgbColor = ImageUtils.HSVToLinearRGB(hue, Math.abs(saturation - 255), Math.min(brightness, 255), true); if (isCorona) { radius = 0; } } if (mapConverter.isFrom(UnrealEngine.UE3) && mapConverter.isTo(UnrealEngine.UE4, UnrealEngine.UE5)) { this.intensity = this.brightness; this.radius *= 1.25; } if (mapConverter.isFrom(UnrealEngine.UE1, UE2) && mapConverter.isTo(UnrealEngine.UE3, UnrealEngine.UE4, UnrealEngine.UE5)) { this.radius *= 32; this.radius *= 1.1; this.lightFalloffExponent = 3d; this.intensity = mapConverter.isFrom(UE1) ? 15f : 1f; if (mapConverter.isFrom(UE2) && brightness > 255) { intensity += Double.valueOf(Math.log(Math.min(brightness - 255f, 100)) / 2).floatValue(); } } if (mapConverter.isFromUE1UE2ToUE3UE4()) { if (outerConeAngle != null) { outerConeAngle *= (255d / 360d) / 2; } } if (mapConverter.isFrom(UnrealEngine.UE1, UE2, UnrealEngine.UE3) && mapConverter.isTo(UnrealEngine.UE4) && scale3d != null) { if ((scale3d.x < 0 || scale3d.y < 0 || scale3d.z < 0) && rotation == null) { rotation = new Vector3d(); } final double DEFAULT_PI_UE = Rotator.getDefaultTwoPi(UnrealEngine.from(mapConverter.getInputGame().getUeVersion())); final double DEFAULT_PI_UE_HALF = DEFAULT_PI_UE / 2d; if (scale3d.x < 0) { rotation.x += DEFAULT_PI_UE_HALF; rotation.z += DEFAULT_PI_UE_HALF; scale3d.x = Math.abs(scale3d.x); } if (scale3d.y < 0) { rotation.y += DEFAULT_PI_UE_HALF; rotation.z += DEFAULT_PI_UE_HALF; scale3d.y = Math.abs(scale3d.y); } if (scale3d.z < 0) { rotation.x += DEFAULT_PI_UE_HALF; rotation.y += DEFAULT_PI_UE_HALF; scale3d.z = Math.abs(scale3d.z); } } if (mapConverter.isFrom(UE3)) { convertUE3ClassAndMobility(); } else if (mapConverter.isFrom(UE1, UE2)) { convertUE12ClassAndMobility(); } else { t3dClass = UE4_LightActor.PointLight.name(); } super.convert(); }
<DeepExtract> if (mapConverter.isFrom(UE3)) { convertUE3ClassAndMobility(); } else if (mapConverter.isFrom(UE1, UE2)) { convertUE12ClassAndMobility(); } else { t3dClass = UE4_LightActor.PointLight.name(); } </DeepExtract>
UT4X-Converter
positive
@Override protected void initializeNewInstance(Dissector newInstance) { this.inputType = inputType; this.outputType = outputType; this.outputName = outputName; this.salt = salt; }
<DeepExtract> this.inputType = inputType; this.outputType = outputType; this.outputName = outputName; this.salt = salt; </DeepExtract>
logparser
positive
public static void deleteSettings(int uid) { if (PrivacyService.isRegistered()) { Util.log(null, Log.ERROR, "Privacy manager call from service"); Util.logStack(null, Log.ERROR); } try { PrivacyService.getClient().deleteSettings(uid); synchronized (mSettingsCache) { mSettingsCache.clear(); } } catch (Throwable ex) { Util.bug(null, ex); } }
<DeepExtract> if (PrivacyService.isRegistered()) { Util.log(null, Log.ERROR, "Privacy manager call from service"); Util.logStack(null, Log.ERROR); } </DeepExtract>
XPrivacy
positive
public static void appendLineToFile(String filename, String line) throws FileNotFoundException, IOException { File file = new File(filename); if (!file.exists()) { throw new FileNotFoundException(); } FileWriter writer = new FileWriter(file, true); writer.write(line + "\r\n"); writer.close(); }
<DeepExtract> File file = new File(filename); if (!file.exists()) { throw new FileNotFoundException(); } FileWriter writer = new FileWriter(file, true); writer.write(line + "\r\n"); writer.close(); </DeepExtract>
OnlineGuru
positive
public void setUp() throws Exception { super.setUp(); server = new JsUnitStandardServer(new Configuration(configurationSource), false); server.start(); return new TestRunManager(server, overrideURL); }
<DeepExtract> return new TestRunManager(server, overrideURL); </DeepExtract>
Testing-and-Debugging-JavaScript
positive
@Override public V get(K key) { Node node; if (null == root) node = null; if (key.equals(root.key)) { node = root; } else if (key.compareTo(root.key) < 0) { node = getNode(root.left, key); } else { node = getNode(root.right, key); } return null == node ? null : node.value; }
<DeepExtract> Node node; if (null == root) node = null; if (key.equals(root.key)) { node = root; } else if (key.compareTo(root.key) < 0) { node = getNode(root.left, key); } else { node = getNode(root.right, key); } </DeepExtract>
ExerciseJava
positive
@Override @NonNull public MethodUnhooker<Hooker<Method>, Method> hook(@NonNull Method origin, @NonNull Hooker<Method> hooker) { if (Modifier.isAbstract(origin.getModifiers())) { throw new IllegalArgumentException("Cannot hook abstract methods: " + origin); } else if (origin.getDeclaringClass().getClassLoader() == LSPosedContext.class.getClassLoader()) { throw new IllegalArgumentException("Do not allow hooking inner methods"); } else if (origin.getDeclaringClass() == Method.class && origin.getName().equals("invoke")) { throw new IllegalArgumentException("Cannot hook Method.invoke"); } if (hooker == null) { throw new IllegalArgumentException("hooker should not be null!"); } if (HookBridge.hookMethod(origin, XposedBridge.AdditionalHookInfo.class, PRIORITY_DEFAULT, hooker)) { return new MethodUnhooker<>() { @NonNull @Override public U getOrigin() { return origin; } @NonNull @Override public T getHooker() { return hooker; } @Override public void unhook() { HookBridge.unhookMethod(origin, hooker); } }; } throw new HookFailedError("Cannot hook " + origin); }
<DeepExtract> if (Modifier.isAbstract(origin.getModifiers())) { throw new IllegalArgumentException("Cannot hook abstract methods: " + origin); } else if (origin.getDeclaringClass().getClassLoader() == LSPosedContext.class.getClassLoader()) { throw new IllegalArgumentException("Do not allow hooking inner methods"); } else if (origin.getDeclaringClass() == Method.class && origin.getName().equals("invoke")) { throw new IllegalArgumentException("Cannot hook Method.invoke"); } if (hooker == null) { throw new IllegalArgumentException("hooker should not be null!"); } if (HookBridge.hookMethod(origin, XposedBridge.AdditionalHookInfo.class, PRIORITY_DEFAULT, hooker)) { return new MethodUnhooker<>() { @NonNull @Override public U getOrigin() { return origin; } @NonNull @Override public T getHooker() { return hooker; } @Override public void unhook() { HookBridge.unhookMethod(origin, hooker); } }; } throw new HookFailedError("Cannot hook " + origin); </DeepExtract>
LSPosed
positive
public static Set<Resource> getAllSuperProperties(Property subProperty) { Set<Resource> set = new HashSet<Resource>(); addTransitiveObjects(set, subProperty, RDFS.subPropertyOf); set.remove(subProperty); return set; }
<DeepExtract> Set<Resource> set = new HashSet<Resource>(); addTransitiveObjects(set, subProperty, RDFS.subPropertyOf); set.remove(subProperty); return set; </DeepExtract>
spinrdf
positive
public static Document fromTokens(List<Token> tokens) { String text = WordHelpers.tokensToText(tokens, 0); String lang = detectLanguage(text); Document doc = new Document(); doc.setLanguage(lang); createSentencesFromTokens(tokens, lang).forEach(sentence -> { doc.addSentence(sentence, false); }); return doc; }
<DeepExtract> String text = WordHelpers.tokensToText(tokens, 0); String lang = detectLanguage(text); Document doc = new Document(); doc.setLanguage(lang); createSentencesFromTokens(tokens, lang).forEach(sentence -> { doc.addSentence(sentence, false); }); return doc; </DeepExtract>
SECTOR
positive
@Override public void onClick(View view) { Log.i(Util.LOG_TAG, "Launching " + new ReceiveFragment().getClass().getSimpleName()); getFragmentManager().beginTransaction().replace(R.id.fragment_container, new ReceiveFragment()).commit(); }
<DeepExtract> Log.i(Util.LOG_TAG, "Launching " + new ReceiveFragment().getClass().getSimpleName()); getFragmentManager().beginTransaction().replace(R.id.fragment_container, new ReceiveFragment()).commit(); </DeepExtract>
FOUNDERS_3rd
positive
private void noForm() { metadata.getChildren().clear(); metadata.getChildren().addAll(metadataTopBox, metaText); topButtons.remove(toggleForm); metadataTopBox.getChildren().removeAll(addMetadata, removeMetadata, toggleForm, validationButton, metadataCombo); metadataTopBox.getChildren().remove(metadataTopSeparator); if (topButtons.contains(toggleForm)) metadataTopBox.getChildren().add(toggleForm); if (topButtons.contains(validationButton)) metadataTopBox.getChildren().add(validationButton); if (topButtons.contains(toggleForm) || topButtons.contains(validationButton)) metadataTopBox.getChildren().add(metadataTopSeparator); if (topButtons.contains(addMetadata)) metadataTopBox.getChildren().add(addMetadata); if (topButtons.contains(removeMetadata)) metadataTopBox.getChildren().add(removeMetadata); if (topButtons.contains(metadataCombo)) metadataTopBox.getChildren().add(metadataCombo); metadataTopBox.requestFocus(); }
<DeepExtract> metadataTopBox.getChildren().removeAll(addMetadata, removeMetadata, toggleForm, validationButton, metadataCombo); metadataTopBox.getChildren().remove(metadataTopSeparator); if (topButtons.contains(toggleForm)) metadataTopBox.getChildren().add(toggleForm); if (topButtons.contains(validationButton)) metadataTopBox.getChildren().add(validationButton); if (topButtons.contains(toggleForm) || topButtons.contains(validationButton)) metadataTopBox.getChildren().add(metadataTopSeparator); if (topButtons.contains(addMetadata)) metadataTopBox.getChildren().add(addMetadata); if (topButtons.contains(removeMetadata)) metadataTopBox.getChildren().add(removeMetadata); if (topButtons.contains(metadataCombo)) metadataTopBox.getChildren().add(metadataCombo); metadataTopBox.requestFocus(); </DeepExtract>
roda-in
positive
User putUser(final User user) throws StoreException { var savedUser; try (var conn = dbConnect(); var stmt = conn.prepareStatement("SELECT * FROM " + TABLE + " WHERE " + COL_ID + " = ? ")) { stmt.setString(1, user.getUserid()); LOG.debug("getUser() request: {}", stmt); savedUser = firstFromStatement(stmt); } catch (SQLException s) { throw new StoreException("SQL Exception : " + s); } if (savedUser == null) { return null; } if (user.getDescription() != null) { savedUser.setDescription(user.getDescription()); } if (user.getName() != null) { savedUser.setName(user.getName()); } if (user.isEnabled() != null) { savedUser.setEnabled(user.isEnabled()); } if (user.getEmail() != null) { savedUser.setEmail(user.getEmail()); } if (user.getPassword() != null) { String salt = user.getSalt(); if (salt == null) { salt = savedUser.getSalt(); } final var passwordHash = passwordService.getPasswordHash(user.getPassword(), salt); savedUser.setPassword(passwordHash.getHashedPassword()); } try (var conn = dbConnect(); var stmt = conn.prepareStatement("UPDATE " + TABLE + " SET " + COL_EMAIL + " = ?, " + COL_PASSWORD + " = ?," + COL_DESC + " = ?, " + COL_ENABLED + "= ? WHERE " + COL_ID + " = ?")) { stmt.setString(1, savedUser.getEmail()); stmt.setString(2, savedUser.getPassword()); stmt.setString(3, savedUser.getDescription()); stmt.setBoolean(4, savedUser.isEnabled()); stmt.setString(5, savedUser.getUserid()); LOG.debug("putUser() request: {}", stmt); stmt.executeUpdate(); } catch (SQLException s) { throw new StoreException("SQL Exception : " + s); } return savedUser; }
<DeepExtract> var savedUser; try (var conn = dbConnect(); var stmt = conn.prepareStatement("SELECT * FROM " + TABLE + " WHERE " + COL_ID + " = ? ")) { stmt.setString(1, user.getUserid()); LOG.debug("getUser() request: {}", stmt); savedUser = firstFromStatement(stmt); } catch (SQLException s) { throw new StoreException("SQL Exception : " + s); } </DeepExtract>
aaa
positive
private static int read_write_biginteger(String basekey, TransactionSingleOp sc, Mode mode) { int failed = 0; key = basekey + "_bigint_0"; value = new BigInteger("0"); try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; key = basekey + "_bigint_1"; value = new BigInteger("1"); try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; key = basekey + "_bigint_min"; value = new BigInteger("-100000000000000000000"); try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; key = basekey + "_bigint_max"; value = new BigInteger("100000000000000000000"); try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; key = basekey + "_bigint_max_div_2"; value = new BigInteger("100000000000000000000").divide(new BigInteger("2")); try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; return failed; }
<DeepExtract> try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; </DeepExtract> <DeepExtract> try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; </DeepExtract> <DeepExtract> try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; </DeepExtract> <DeepExtract> try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; </DeepExtract> <DeepExtract> try { switch(mode) { case READ: System.out.println("read(" + key + ")"); ErlangValue result = sc.read(key); System.out.println(" expected: " + valueToStr(value)); System.out.println(" read raw: " + result.value().toString()); Object jresult = null; if (value instanceof Boolean) { jresult = result.boolValue(); } else if (value instanceof Integer) { jresult = result.intValue(); } else if (value instanceof Long) { jresult = result.longValue(); } else if (value instanceof BigInteger) { jresult = result.bigIntValue(); } else if (value instanceof Double) { jresult = result.doubleValue(); } else if (value instanceof String) { jresult = result.stringValue(); } else if (value instanceof byte[]) { jresult = result.binaryValue(); } else if (value instanceof List<?>) { jresult = result.listValue(); } else if (value instanceof Map<?, ?>) { jresult = result.jsonValue(); } System.out.println(" read java: " + valueToStr(jresult)); if (compare(jresult, value)) { System.out.println("ok"); failed = 0; } else { System.out.println("fail"); failed = 1; } case WRITE: System.out.println("write(" + key + ", " + valueToStr(value) + ")"); sc.write(key, value); failed = 0; } } catch (ConnectionException e) { System.out.println("failed with connection error"); } catch (TimeoutException e) { System.out.println("failed with timeout"); } catch (AbortException e) { System.out.println("failed with abort"); } catch (NotFoundException e) { System.out.println("failed with not_found"); } catch (UnknownException e) { System.out.println("failed with unknown"); e.printStackTrace(); } catch (ClassCastException e) { System.out.println("failed with ClassCastException"); e.printStackTrace(); } return 1; </DeepExtract>
bencherl
positive
public static void exportSave(Path folderPath, String mapname, SCMap map) throws IOException { File file = folderPath.resolve(mapname).resolve(mapname + "_save.lua").toFile(); file.createNewFile(); out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); out.writeBytes("Scenario = {\n"); out.writeBytes(" next_area_id = '1',\n"); out.writeBytes(" Props = {},\n"); out.writeBytes(" Areas = {},\n"); out.writeBytes(" MasterChain = {\n"); out.writeBytes(" ['_MASTERCHAIN_'] = {\n"); out.writeBytes(" Markers = {\n"); for (int i = 0; i < map.getSpawns().length; i++) { out.writeBytes(" ['ARMY_" + (i + 1) + "'] = {\n"); out.writeBytes(" ['type'] = STRING( 'Blank Marker' ),\n"); out.writeBytes(" ['position'] = VECTOR3( " + (map.getSpawns()[i].x + 0.5f) + ", " + map.getSpawns()[i].y + ", " + (map.getSpawns()[i].z + 0.5f) + " ),\n"); out.writeBytes(" ['orientation'] = VECTOR3( 0.00, 0.00, 0.00 ),\n"); out.writeBytes(" ['color'] = STRING( 'ff800080' ),\n"); out.writeBytes(" ['prop'] = STRING( '/env/common/props/markers/M_Blank_prop.bp' ),\n"); out.writeBytes(" },\n"); } for (int i = 0; i < map.getMexs().length; i++) { out.writeBytes(" ['MASS_" + (i + 1) + "'] = {\n"); out.writeBytes(" ['size'] = FLOAT( 1.000000 ),\n"); out.writeBytes(" ['resource'] = BOOLEAN( true ),\n"); out.writeBytes(" ['amount'] = FLOAT( 100.000000 ),\n"); out.writeBytes(" ['color'] = STRING( 'ff808080' ),\n"); out.writeBytes(" ['type'] = STRING( 'Mass' ),\n"); out.writeBytes(" ['prop'] = STRING( '/env/common/props/markers/M_Mass_prop.bp' ),\n"); out.writeBytes(" ['orientation'] = VECTOR3( 0, 0, 0 ),\n"); out.writeBytes(" ['position'] = VECTOR3( " + (map.getMexs()[i].x + 0.5f) + ", " + map.getMexs()[i].y + ", " + (map.getMexs()[i].z + 0.5f) + " ),\n"); out.writeBytes(" },\n"); } for (int i = 0; i < map.getHydros().length; i++) { out.writeBytes(" ['Hydrocarbon_" + (i + 1) + "'] = {\n"); out.writeBytes(" ['size'] = FLOAT( 3.00 ),\n"); out.writeBytes(" ['resource'] = BOOLEAN( true ),\n"); out.writeBytes(" ['amount'] = FLOAT( 100.000000 ),\n"); out.writeBytes(" ['color'] = STRING( 'ff808080' ),\n"); out.writeBytes(" ['type'] = STRING( 'Hydrocarbon' ),\n"); out.writeBytes(" ['prop'] = STRING( '/env/common/props/markers/M_Hydrocarbon_prop.bp' ),\n"); out.writeBytes(" ['orientation'] = VECTOR3( 0, 0, 0 ),\n"); out.writeBytes(" ['position'] = VECTOR3( " + (map.getHydros()[i].x + 0.5f) + ", " + map.getHydros()[i].y + ", " + (map.getHydros()[i].z + 0.5f) + " ),\n"); out.writeBytes(" },\n"); } out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" Chains = {},\n"); out.writeBytes(" next_queue_id = '1',\n"); out.writeBytes(" Orders = {},\n"); out.writeBytes(" next_platoon_id = '1',\n"); out.writeBytes(" Platoons = {},\n"); out.writeBytes(" next_army_id = '1',\n"); out.writeBytes(" next_group_id = '1',\n"); out.writeBytes(" next_unit_id = '1',\n"); out.writeBytes(" Armies = {\n"); for (int i = 0; i < map.getSpawns().length; i++) { saveArmy("ARMY_" + (i + 1)); } out.writeBytes(" ['" + "ARMY_9" + "'] = {\n"); out.writeBytes(" personality = '',\n"); out.writeBytes(" plans = '',\n"); out.writeBytes(" color = 0,\n"); out.writeBytes(" faction = 0,\n"); out.writeBytes(" Economy = {mass = 0, energy = 0},\n"); out.writeBytes(" Alliances = {},\n"); out.writeBytes(" ['Units'] = GROUP {\n"); out.writeBytes(" orders = '',\n"); out.writeBytes(" platoon = '',\n"); out.writeBytes(" Units = {\n"); out.writeBytes(" ['INITIAL'] = GROUP {\n"); out.writeBytes(" orders = '',\n"); out.writeBytes(" platoon = '',\n"); out.writeBytes(" Units = {},\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" PlatoonBuilders = {\n"); out.writeBytes(" next_platoon_builder_id = '0',\n"); out.writeBytes(" Builders = {},\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" ['" + "NEUTRAL_CIVILIAN" + "'] = {\n"); out.writeBytes(" personality = '',\n"); out.writeBytes(" plans = '',\n"); out.writeBytes(" color = 0,\n"); out.writeBytes(" faction = 0,\n"); out.writeBytes(" Economy = {mass = 0, energy = 0},\n"); out.writeBytes(" Alliances = {},\n"); out.writeBytes(" ['Units'] = GROUP {\n"); out.writeBytes(" orders = '',\n"); out.writeBytes(" platoon = '',\n"); out.writeBytes(" Units = {\n"); out.writeBytes(" ['INITIAL'] = GROUP {\n"); out.writeBytes(" orders = '',\n"); out.writeBytes(" platoon = '',\n"); out.writeBytes(" Units = {},\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" PlatoonBuilders = {\n"); out.writeBytes(" next_platoon_builder_id = '0',\n"); out.writeBytes(" Builders = {},\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes("}\n"); out.flush(); out.close(); }
<DeepExtract> out.writeBytes(" ['" + "ARMY_9" + "'] = {\n"); out.writeBytes(" personality = '',\n"); out.writeBytes(" plans = '',\n"); out.writeBytes(" color = 0,\n"); out.writeBytes(" faction = 0,\n"); out.writeBytes(" Economy = {mass = 0, energy = 0},\n"); out.writeBytes(" Alliances = {},\n"); out.writeBytes(" ['Units'] = GROUP {\n"); out.writeBytes(" orders = '',\n"); out.writeBytes(" platoon = '',\n"); out.writeBytes(" Units = {\n"); out.writeBytes(" ['INITIAL'] = GROUP {\n"); out.writeBytes(" orders = '',\n"); out.writeBytes(" platoon = '',\n"); out.writeBytes(" Units = {},\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" PlatoonBuilders = {\n"); out.writeBytes(" next_platoon_builder_id = '0',\n"); out.writeBytes(" Builders = {},\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); </DeepExtract> <DeepExtract> out.writeBytes(" ['" + "NEUTRAL_CIVILIAN" + "'] = {\n"); out.writeBytes(" personality = '',\n"); out.writeBytes(" plans = '',\n"); out.writeBytes(" color = 0,\n"); out.writeBytes(" faction = 0,\n"); out.writeBytes(" Economy = {mass = 0, energy = 0},\n"); out.writeBytes(" Alliances = {},\n"); out.writeBytes(" ['Units'] = GROUP {\n"); out.writeBytes(" orders = '',\n"); out.writeBytes(" platoon = '',\n"); out.writeBytes(" Units = {\n"); out.writeBytes(" ['INITIAL'] = GROUP {\n"); out.writeBytes(" orders = '',\n"); out.writeBytes(" platoon = '',\n"); out.writeBytes(" Units = {},\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); out.writeBytes(" PlatoonBuilders = {\n"); out.writeBytes(" next_platoon_builder_id = '0',\n"); out.writeBytes(" Builders = {},\n"); out.writeBytes(" },\n"); out.writeBytes(" },\n"); </DeepExtract>
Neroxis-Map-Generator
positive
@Override public void onReceive(StreamInfo info) { if (DEBUG) Log.d(TAG, "onReceive() called with: info = [" + info + "]"); if (info == null || isRemoving() || !isVisible()) return; if (DEBUG) Log.d(TAG, "handleStreamInfo() called with: info = [" + info + "]"); currentStreamInfo = info; selectVideo(info.service_id, info.webpage_url, info.title); loadingProgressBar.setVisibility(View.GONE); AnimationUtils.animateView(thumbnailPlayButton, true, 200); if (true) videoTitleTextView.setText(info.title); if (!TextUtils.isEmpty(info.uploader)) uploaderTextView.setText(info.uploader); uploaderTextView.setVisibility(!TextUtils.isEmpty(info.uploader) ? View.VISIBLE : View.GONE); uploaderButton.setVisibility(!TextUtils.isEmpty(info.channel_url) ? View.VISIBLE : View.GONE); uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); if (info.view_count >= 0) videoCountView.setText(Localization.localizeViewCount(info.view_count, activity)); videoCountView.setVisibility(info.view_count >= 0 ? View.VISIBLE : View.GONE); if (info.dislike_count == -1 && info.like_count == -1) { thumbsDownImageView.setVisibility(View.VISIBLE); thumbsUpImageView.setVisibility(View.VISIBLE); thumbsUpTextView.setVisibility(View.GONE); thumbsDownTextView.setVisibility(View.GONE); thumbsDisabledTextView.setVisibility(View.VISIBLE); } else { thumbsDisabledTextView.setVisibility(View.GONE); if (info.dislike_count >= 0) thumbsDownTextView.setText(getShortCount((long) info.dislike_count)); thumbsDownTextView.setVisibility(info.dislike_count >= 0 ? View.VISIBLE : View.GONE); thumbsDownImageView.setVisibility(info.dislike_count >= 0 ? View.VISIBLE : View.GONE); if (info.like_count >= 0) thumbsUpTextView.setText(getShortCount((long) info.like_count)); thumbsUpTextView.setVisibility(info.like_count >= 0 ? View.VISIBLE : View.GONE); thumbsUpImageView.setVisibility(info.like_count >= 0 ? View.VISIBLE : View.GONE); } if (!TextUtils.isEmpty(info.upload_date)) videoUploadDateView.setText(Localization.localizeDate(info.upload_date, activity)); videoUploadDateView.setVisibility(!TextUtils.isEmpty(info.upload_date) ? View.VISIBLE : View.GONE); if (!TextUtils.isEmpty(info.description)) { videoDescriptionView.setText(Build.VERSION.SDK_INT >= 24 ? Html.fromHtml(info.description, 0) : Html.fromHtml(info.description)); } videoDescriptionView.setVisibility(!TextUtils.isEmpty(info.description) ? View.VISIBLE : View.GONE); videoDescriptionRootLayout.setVisibility(View.GONE); videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); videoTitleToggleArrow.setVisibility(View.VISIBLE); videoTitleRoot.setClickable(true); AnimationUtils.animateView(spinnerToolbar, true, 500); setupActionBarHandler(info); initThumbnailViews(info); initRelatedVideos(info); if (wasRelatedStreamsExpanded) { toggleExpandRelatedVideos(currentStreamInfo); wasRelatedStreamsExpanded = false; } setTitleToUrl(info.webpage_url, info.title); setStreamInfoToUrl(info.webpage_url, info); int translationY = (int) (getResources().getDisplayMetrics().heightPixels * (0 > 0.0f ? 0 : .12f)); contentRootLayoutHiding.animate().setListener(null).cancel(); contentRootLayoutHiding.setAlpha(0f); contentRootLayoutHiding.setTranslationY(translationY); contentRootLayoutHiding.setVisibility(View.VISIBLE); contentRootLayoutHiding.animate().alpha(1f).translationY(0).setStartDelay(0).setDuration(300).setInterpolator(new FastOutSlowInInterpolator()).start(); uploaderRootLayout.animate().setListener(null).cancel(); uploaderRootLayout.setAlpha(0f); uploaderRootLayout.setTranslationY(translationY); uploaderRootLayout.setVisibility(View.VISIBLE); uploaderRootLayout.animate().alpha(1f).translationY(0).setStartDelay((long) (300 * .5f) + 0).setDuration(300).setInterpolator(new FastOutSlowInInterpolator()).start(); if (showRelatedStreams) { relatedStreamRootLayout.animate().setListener(null).cancel(); relatedStreamRootLayout.setAlpha(0f); relatedStreamRootLayout.setTranslationY(translationY); relatedStreamRootLayout.setVisibility(View.VISIBLE); relatedStreamRootLayout.animate().alpha(1f).translationY(0).setStartDelay((long) (300 * .8f) + 0).setDuration(300).setInterpolator(new FastOutSlowInInterpolator()).start(); } AnimationUtils.animateView(loadingProgressBar, false, 200); if (autoPlayEnabled) { playVideo(info); autoPlayEnabled = false; } StreamInfoCache.getInstance().putInfo(info); isLoading.set(false); }
<DeepExtract> if (DEBUG) Log.d(TAG, "handleStreamInfo() called with: info = [" + info + "]"); currentStreamInfo = info; selectVideo(info.service_id, info.webpage_url, info.title); loadingProgressBar.setVisibility(View.GONE); AnimationUtils.animateView(thumbnailPlayButton, true, 200); if (true) videoTitleTextView.setText(info.title); if (!TextUtils.isEmpty(info.uploader)) uploaderTextView.setText(info.uploader); uploaderTextView.setVisibility(!TextUtils.isEmpty(info.uploader) ? View.VISIBLE : View.GONE); uploaderButton.setVisibility(!TextUtils.isEmpty(info.channel_url) ? View.VISIBLE : View.GONE); uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); if (info.view_count >= 0) videoCountView.setText(Localization.localizeViewCount(info.view_count, activity)); videoCountView.setVisibility(info.view_count >= 0 ? View.VISIBLE : View.GONE); if (info.dislike_count == -1 && info.like_count == -1) { thumbsDownImageView.setVisibility(View.VISIBLE); thumbsUpImageView.setVisibility(View.VISIBLE); thumbsUpTextView.setVisibility(View.GONE); thumbsDownTextView.setVisibility(View.GONE); thumbsDisabledTextView.setVisibility(View.VISIBLE); } else { thumbsDisabledTextView.setVisibility(View.GONE); if (info.dislike_count >= 0) thumbsDownTextView.setText(getShortCount((long) info.dislike_count)); thumbsDownTextView.setVisibility(info.dislike_count >= 0 ? View.VISIBLE : View.GONE); thumbsDownImageView.setVisibility(info.dislike_count >= 0 ? View.VISIBLE : View.GONE); if (info.like_count >= 0) thumbsUpTextView.setText(getShortCount((long) info.like_count)); thumbsUpTextView.setVisibility(info.like_count >= 0 ? View.VISIBLE : View.GONE); thumbsUpImageView.setVisibility(info.like_count >= 0 ? View.VISIBLE : View.GONE); } if (!TextUtils.isEmpty(info.upload_date)) videoUploadDateView.setText(Localization.localizeDate(info.upload_date, activity)); videoUploadDateView.setVisibility(!TextUtils.isEmpty(info.upload_date) ? View.VISIBLE : View.GONE); if (!TextUtils.isEmpty(info.description)) { videoDescriptionView.setText(Build.VERSION.SDK_INT >= 24 ? Html.fromHtml(info.description, 0) : Html.fromHtml(info.description)); } videoDescriptionView.setVisibility(!TextUtils.isEmpty(info.description) ? View.VISIBLE : View.GONE); videoDescriptionRootLayout.setVisibility(View.GONE); videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); videoTitleToggleArrow.setVisibility(View.VISIBLE); videoTitleRoot.setClickable(true); AnimationUtils.animateView(spinnerToolbar, true, 500); setupActionBarHandler(info); initThumbnailViews(info); initRelatedVideos(info); if (wasRelatedStreamsExpanded) { toggleExpandRelatedVideos(currentStreamInfo); wasRelatedStreamsExpanded = false; } setTitleToUrl(info.webpage_url, info.title); setStreamInfoToUrl(info.webpage_url, info); </DeepExtract> <DeepExtract> int translationY = (int) (getResources().getDisplayMetrics().heightPixels * (0 > 0.0f ? 0 : .12f)); contentRootLayoutHiding.animate().setListener(null).cancel(); contentRootLayoutHiding.setAlpha(0f); contentRootLayoutHiding.setTranslationY(translationY); contentRootLayoutHiding.setVisibility(View.VISIBLE); contentRootLayoutHiding.animate().alpha(1f).translationY(0).setStartDelay(0).setDuration(300).setInterpolator(new FastOutSlowInInterpolator()).start(); uploaderRootLayout.animate().setListener(null).cancel(); uploaderRootLayout.setAlpha(0f); uploaderRootLayout.setTranslationY(translationY); uploaderRootLayout.setVisibility(View.VISIBLE); uploaderRootLayout.animate().alpha(1f).translationY(0).setStartDelay((long) (300 * .5f) + 0).setDuration(300).setInterpolator(new FastOutSlowInInterpolator()).start(); if (showRelatedStreams) { relatedStreamRootLayout.animate().setListener(null).cancel(); relatedStreamRootLayout.setAlpha(0f); relatedStreamRootLayout.setTranslationY(translationY); relatedStreamRootLayout.setVisibility(View.VISIBLE); relatedStreamRootLayout.animate().alpha(1f).translationY(0).setStartDelay((long) (300 * .8f) + 0).setDuration(300).setInterpolator(new FastOutSlowInInterpolator()).start(); } </DeepExtract>
Float-Tube
positive
@Override public void run() { if (placedBall == false) post(new Runnable() { @Override public void run() { setValue(value); } }); else { this.value = value; float division = (ball.xFin - ball.xIni) / max; ViewHelper.setX(ball, value * division + getHeight() / 2 - ball.getWidth() / 2); ball.changeBackground(); } }
<DeepExtract> if (placedBall == false) post(new Runnable() { @Override public void run() { setValue(value); } }); else { this.value = value; float division = (ball.xFin - ball.xIni) / max; ViewHelper.setX(ball, value * division + getHeight() / 2 - ball.getWidth() / 2); ball.changeBackground(); } </DeepExtract>
Charismatic_YiChang
positive
@NotNull public static ConcordionFilesRefactoring deletePaired(@NotNull ConcordionPairedFileType file, @NotNull ConcordionFilesRefactoring rememberedState) { if (ApplicationManager.getApplication().isUnitTestMode()) { return ConcordionFilesRefactoring.BOTH; } if (rememberedState != ConcordionFilesRefactoring.ASK) { return rememberedState; } return ConcordionFilesRefactoring.fromDialogReturnCode(Messages.showYesNoDialog(ConcordionBundle.message("concordion.refactoring.delete_paired." + file.name()), "Concordion", "Yes", "No", Messages.getQuestionIcon(), new ConcordionPairedFileDoNotAskOption(ConcordionSettings.getInstance()::setDeletePairs))); }
<DeepExtract> if (ApplicationManager.getApplication().isUnitTestMode()) { return ConcordionFilesRefactoring.BOTH; } if (rememberedState != ConcordionFilesRefactoring.ASK) { return rememberedState; } return ConcordionFilesRefactoring.fromDialogReturnCode(Messages.showYesNoDialog(ConcordionBundle.message("concordion.refactoring.delete_paired." + file.name()), "Concordion", "Yes", "No", Messages.getQuestionIcon(), new ConcordionPairedFileDoNotAskOption(ConcordionSettings.getInstance()::setDeletePairs))); </DeepExtract>
idea-concordion-support
positive
public Criteria andStockIsNotNull() { if ("stock is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("stock is not null")); return (Criteria) this; }
<DeepExtract> if ("stock is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("stock is not null")); </DeepExtract>
ssmxiaomi
positive
private void receiveStatistics() throws ChannelException { try { _stats._totalBytesWritten = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } try { _stats._totalBytesRead = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } try { _stats._totalFileSize = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } try { _stats._fileListBuildTime = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } try { _stats._fileListTransferTime = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } }
<DeepExtract> try { _stats._totalBytesWritten = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } </DeepExtract> <DeepExtract> try { _stats._totalBytesRead = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } </DeepExtract> <DeepExtract> try { _stats._totalFileSize = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } </DeepExtract> <DeepExtract> try { _stats._fileListBuildTime = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } </DeepExtract> <DeepExtract> try { _stats._fileListTransferTime = IntegerCoder.decodeLong(_in, 3); } catch (Exception e) { throw new ChannelException(e.getMessage()); } </DeepExtract>
yajsync
positive
public void onClickMonkey(View view) { animateView(binding.homeMonkey, View.GONE, 0, 200); animateView(binding.monkeyOverlay, View.VISIBLE, 1.0f, 200); }
<DeepExtract> animateView(binding.homeMonkey, View.GONE, 0, 200); animateView(binding.monkeyOverlay, View.VISIBLE, 1.0f, 200); </DeepExtract>
kalium-android-wallet
positive
@Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); backgroundbatch.begin(); parallaxBackground.draw(parallaxCamera, backgroundbatch); backgroundbatch.end(); stage.act(delta); stage.draw(); if (ServerCommunicator.getInstance().isNextMessageOfType(MessageType.BATTLE)) { NetworkMessage message = ServerCommunicator.getInstance().getOldestMessageFromServer(); UnitOwner enemyTeamLeader = "true".equals(message.getPlayerStart()) ? new OnlineEnemy(message.getFighter2(), message.getTeam2(), false, message.getGameID()) : new OnlineEnemy(message.getFighter1(), message.getTeam1(), true, message.getGameID()); Player.getInstance().setGameID(message.getGameID()); MapType mapType = MapType.valueOf(message.getMap()); AssetManagerUtility.loadMapAsset(mapType.toString()); ScreenManager.getInstance().showScreen(ScreenEnum.LOAD, enemyTeamLeader, mapType); } parallaxCamera.translate(2, 0, 0); }
<DeepExtract> backgroundbatch.begin(); parallaxBackground.draw(parallaxCamera, backgroundbatch); backgroundbatch.end(); </DeepExtract> <DeepExtract> if (ServerCommunicator.getInstance().isNextMessageOfType(MessageType.BATTLE)) { NetworkMessage message = ServerCommunicator.getInstance().getOldestMessageFromServer(); UnitOwner enemyTeamLeader = "true".equals(message.getPlayerStart()) ? new OnlineEnemy(message.getFighter2(), message.getTeam2(), false, message.getGameID()) : new OnlineEnemy(message.getFighter1(), message.getTeam1(), true, message.getGameID()); Player.getInstance().setGameID(message.getGameID()); MapType mapType = MapType.valueOf(message.getMap()); AssetManagerUtility.loadMapAsset(mapType.toString()); ScreenManager.getInstance().showScreen(ScreenEnum.LOAD, enemyTeamLeader, mapType); } </DeepExtract>
Norii
positive
@Test public void testTrigram() { final StringWordIndexer wordIndexer = new StringWordIndexer(); final int order = new double[] { 0.75f, 0.6f, 0.6f }.length; wordIndexer.setStartSymbol("<s>"); wordIndexer.setEndSymbol("</s>"); wordIndexer.setUnkSymbol("<unk>"); final String txtFile = FileUtils.getFile("tiny_test_trigram" + ".txt").getPath(); final File goldArpaFile = FileUtils.getFile("tiny_test_trigram" + ".arpa"); final StringWriter stringWriter = new StringWriter(); final TextReader<String> reader = new TextReader<String>(Arrays.asList(txtFile), wordIndexer); final ConfigOptions opts = new ConfigOptions(); opts.kneserNeyDiscounts = new double[] { 0.75f, 0.6f, 0.6f }; opts.kneserNeyMinCounts = new double[] { 0, 0, 0, 0, 0, 0, 0 }; final KneserNeyLmReaderCallback<String> kneserNeyReader = new KneserNeyLmReaderCallback<String>(wordIndexer, order, opts); reader.parse(kneserNeyReader); KneserNeyFileWritingLmReaderCallback<String> kneserNeyFileWriter = new KneserNeyFileWritingLmReaderCallback<String>(new PrintWriter(stringWriter), wordIndexer); kneserNeyReader.parse(kneserNeyFileWriter); final List<String> arpaLines = new ArrayList<String>(Arrays.asList(stringWriter.toString().split("\n"))); sortAndRemoveBlankLines(arpaLines); final List<String> goldArpaLines = getLines(goldArpaFile); sortAndRemoveBlankLines(goldArpaLines); compareLines(arpaLines, goldArpaLines); }
<DeepExtract> final StringWordIndexer wordIndexer = new StringWordIndexer(); final int order = new double[] { 0.75f, 0.6f, 0.6f }.length; wordIndexer.setStartSymbol("<s>"); wordIndexer.setEndSymbol("</s>"); wordIndexer.setUnkSymbol("<unk>"); final String txtFile = FileUtils.getFile("tiny_test_trigram" + ".txt").getPath(); final File goldArpaFile = FileUtils.getFile("tiny_test_trigram" + ".arpa"); final StringWriter stringWriter = new StringWriter(); final TextReader<String> reader = new TextReader<String>(Arrays.asList(txtFile), wordIndexer); final ConfigOptions opts = new ConfigOptions(); opts.kneserNeyDiscounts = new double[] { 0.75f, 0.6f, 0.6f }; opts.kneserNeyMinCounts = new double[] { 0, 0, 0, 0, 0, 0, 0 }; final KneserNeyLmReaderCallback<String> kneserNeyReader = new KneserNeyLmReaderCallback<String>(wordIndexer, order, opts); reader.parse(kneserNeyReader); KneserNeyFileWritingLmReaderCallback<String> kneserNeyFileWriter = new KneserNeyFileWritingLmReaderCallback<String>(new PrintWriter(stringWriter), wordIndexer); kneserNeyReader.parse(kneserNeyFileWriter); final List<String> arpaLines = new ArrayList<String>(Arrays.asList(stringWriter.toString().split("\n"))); sortAndRemoveBlankLines(arpaLines); final List<String> goldArpaLines = getLines(goldArpaFile); sortAndRemoveBlankLines(goldArpaLines); compareLines(arpaLines, goldArpaLines); </DeepExtract>
berkeleylm
positive
public final LC pack(String width, String height) { packW = width != null ? ConstraintParser.parseBoundSize(width, false, true) : BoundSize.NULL_SIZE != null ? width != null ? ConstraintParser.parseBoundSize(width, false, true) : BoundSize.NULL_SIZE : BoundSize.NULL_SIZE; packH = height != null ? ConstraintParser.parseBoundSize(height, false, false) : BoundSize.NULL_SIZE != null ? height != null ? ConstraintParser.parseBoundSize(height, false, false) : BoundSize.NULL_SIZE : BoundSize.NULL_SIZE; return this; }
<DeepExtract> packW = width != null ? ConstraintParser.parseBoundSize(width, false, true) : BoundSize.NULL_SIZE != null ? width != null ? ConstraintParser.parseBoundSize(width, false, true) : BoundSize.NULL_SIZE : BoundSize.NULL_SIZE; </DeepExtract> <DeepExtract> packH = height != null ? ConstraintParser.parseBoundSize(height, false, false) : BoundSize.NULL_SIZE != null ? height != null ? ConstraintParser.parseBoundSize(height, false, false) : BoundSize.NULL_SIZE : BoundSize.NULL_SIZE; </DeepExtract>
miglayout
positive
public Vec3d plus(Vec3d arg) { Vec3d tmp = new Vec3d(); x = this.x + arg.x; y = this.y + arg.y; z = this.z + arg.z; return tmp; }
<DeepExtract> x = this.x + arg.x; y = this.y + arg.y; z = this.z + arg.z; </DeepExtract>
jogl-utils
positive
@Test public void testRegexp() { final String sql = "SELECT a, b FROM foo WHERE b " + "REGEXP" + " 'abc%'"; String expectedRel = "LogicalProject(a=[$0], b=[$1])\n" + " LogicalFilter(condition=[" + "REGEXP".toUpperCase() + "($1, 'abc%')])\n" + " LogicalTableScan(table=[[hive, default, foo]])\n"; RelNode rel = toRel(sql); assertEquals(relToStr(rel), expectedRel); String expectedSql = "SELECT \"a\", \"b\"\nFROM \"hive\".\"default\".\"foo\"\n" + "WHERE \"b\" " + "REGEXP".toUpperCase() + " 'abc%'"; assertEquals(relToSql(rel), expectedSql); }
<DeepExtract> final String sql = "SELECT a, b FROM foo WHERE b " + "REGEXP" + " 'abc%'"; String expectedRel = "LogicalProject(a=[$0], b=[$1])\n" + " LogicalFilter(condition=[" + "REGEXP".toUpperCase() + "($1, 'abc%')])\n" + " LogicalTableScan(table=[[hive, default, foo]])\n"; RelNode rel = toRel(sql); assertEquals(relToStr(rel), expectedRel); String expectedSql = "SELECT \"a\", \"b\"\nFROM \"hive\".\"default\".\"foo\"\n" + "WHERE \"b\" " + "REGEXP".toUpperCase() + " 'abc%'"; assertEquals(relToSql(rel), expectedSql); </DeepExtract>
coral
positive
@Override protected void setUp() throws Exception { super.setUp(); this.setupServerWithHandler(null, null, null); }
<DeepExtract> this.setupServerWithHandler(null, null, null); </DeepExtract>
jrpip
positive
public boolean put(K key, V value) { List<V> existing; List<V> values = _map.get(key); if (values == null) { existing = Collections.emptyList(); } else { existing = values; } if (existing.isEmpty()) { existing = new ArrayList<>(); _map.put(key, existing); } boolean isAdded = existing.add(value); if (isAdded) { _size++; } return isAdded; }
<DeepExtract> List<V> existing; List<V> values = _map.get(key); if (values == null) { existing = Collections.emptyList(); } else { existing = values; } </DeepExtract>
yajsync
positive
public static void main(String[] args) { Stack stack = new Stack(5); if (isFull()) { return false; } return elems.offerLast("Justin"); if (isFull()) { return false; } return elems.offerLast("Monica"); if (isFull()) { return false; } return elems.offerLast("Irene"); out.println(stack.pop()); out.println(stack.pop()); out.println(stack.pop()); }
<DeepExtract> if (isFull()) { return false; } return elems.offerLast("Justin"); </DeepExtract> <DeepExtract> if (isFull()) { return false; } return elems.offerLast("Monica"); </DeepExtract> <DeepExtract> if (isFull()) { return false; } return elems.offerLast("Irene"); </DeepExtract>
JavaSE8Tutorial
positive
@Test public void f64_div() throws IOException { WasmOptions options = new WasmOptions(new HashMap<>()); WatParser parser = new WatParser(); WasmCodeBuilder codeBuilder = parser; codeBuilder.init(options, null); parser.parse("f64.div", null, null, 100); StringBuilder builder = new StringBuilder(); ModuleWriter writer = new TextModuleWriter(new WasmTarget(builder), options); writer.writeMethodStart(new FunctionName("A.a()V"), null); for (WasmInstruction instruction : codeBuilder.getInstructions()) { instruction.writeTo(writer); } writer.writeMethodFinish(); writer.close(); String expected = normalize("(module (func $A.a " + "f64.div" + " ) )"); String actual = normalize(builder); assertEquals(expected, actual); writer = new BinaryModuleWriter(new WasmTarget(builder), new WasmOptions(new HashMap<>())); writer.writeMethodStart(new FunctionName("A.a()V"), null); for (WasmInstruction instruction : codeBuilder.getInstructions()) { instruction.writeTo(writer); } }
<DeepExtract> WasmOptions options = new WasmOptions(new HashMap<>()); WatParser parser = new WatParser(); WasmCodeBuilder codeBuilder = parser; codeBuilder.init(options, null); parser.parse("f64.div", null, null, 100); StringBuilder builder = new StringBuilder(); ModuleWriter writer = new TextModuleWriter(new WasmTarget(builder), options); writer.writeMethodStart(new FunctionName("A.a()V"), null); for (WasmInstruction instruction : codeBuilder.getInstructions()) { instruction.writeTo(writer); } writer.writeMethodFinish(); writer.close(); String expected = normalize("(module (func $A.a " + "f64.div" + " ) )"); String actual = normalize(builder); assertEquals(expected, actual); writer = new BinaryModuleWriter(new WasmTarget(builder), new WasmOptions(new HashMap<>())); writer.writeMethodStart(new FunctionName("A.a()V"), null); for (WasmInstruction instruction : codeBuilder.getInstructions()) { instruction.writeTo(writer); } </DeepExtract>
JWebAssembly
positive
public void sortCol(int pHeaderCol) { iSortList.remove(HEADER[pHeaderCol]); iSortList.add(0, HEADER[pHeaderCol]); Collections.sort(iItems, new Comparator() { public int compare(Object pObj1, Object pObj2) { D2Item lItem1 = (D2Item) pObj1; D2Item lItem2 = (D2Item) pObj2; for (int i = 0; i < iSortList.size(); i++) { Object lSort = iSortList.get(i); if (lSort == HEADER[0]) { return lItem1.getName().compareTo(lItem2.getName()); } else if (lSort == HEADER[1]) { return lItem1.getReqLvl() - lItem2.getReqLvl(); } else if (lSort == HEADER[2]) { return lItem1.getReqStr() - lItem2.getReqStr(); } else if (lSort == HEADER[3]) { return lItem1.getReqDex() - lItem2.getReqDex(); } else if (lSort == HEADER[4]) { String lFileName1 = ((D2ItemListAll) iStash).getFilename(lItem1); String lFileName2 = ((D2ItemListAll) iStash).getFilename(lItem2); return lFileName1.compareTo(lFileName2); } } return 0; } }); fireTableChanged(); }
<DeepExtract> Collections.sort(iItems, new Comparator() { public int compare(Object pObj1, Object pObj2) { D2Item lItem1 = (D2Item) pObj1; D2Item lItem2 = (D2Item) pObj2; for (int i = 0; i < iSortList.size(); i++) { Object lSort = iSortList.get(i); if (lSort == HEADER[0]) { return lItem1.getName().compareTo(lItem2.getName()); } else if (lSort == HEADER[1]) { return lItem1.getReqLvl() - lItem2.getReqLvl(); } else if (lSort == HEADER[2]) { return lItem1.getReqStr() - lItem2.getReqStr(); } else if (lSort == HEADER[3]) { return lItem1.getReqDex() - lItem2.getReqDex(); } else if (lSort == HEADER[4]) { String lFileName1 = ((D2ItemListAll) iStash).getFilename(lItem1); String lFileName2 = ((D2ItemListAll) iStash).getFilename(lItem2); return lFileName1.compareTo(lFileName2); } } return 0; } }); fireTableChanged(); </DeepExtract>
gomule
positive
public CacheBean parseAndGet() throws ConfigurationException { Field[] _fields = type.getDeclaredFields(); this.fields = new ArrayList<Field>(_fields.length); for (Field field : _fields) { Transient t = field.getAnnotation(Transient.class); if (null == t) { this.fields.add(field); } } this.fields.trimToSize(); Cache cache = type.getAnnotation(Cache.class); if (cache == null) return; String prefix = cache.value(); if (null == prefix || "".equals(prefix)) { prefix = type.getSimpleName(); } target.setXbeanClass(type); target.setLevel(CacheLevel.REDIS); target.setKeyBuilder(cache.keyBuilder()); target.setPrefix(prefix); if (target.getXbeanClass() == null) return null; MiniTable mt = type.getAnnotation(MiniTable.class); target.setMiniTable(mt == null ? false : true); List<Merging> mergingList = new ArrayList<Merging>(); Merging merging = type.getAnnotation(Merging.class); if (merging != null) { mergingList.add(merging); } else { MergingList ml = type.getAnnotation(MergingList.class); if (ml == null) return; mergingList.addAll(Arrays.asList(ml.value())); } Map<Class<?>, List<RefrenceBean>> refrences = ListUtil.grouping(_parseRefrence()); Map<Class<?>, MergingBean> mapMg = new HashMap<Class<?>, MergingBean>(); for (Merging mg : mergingList) { Class<?> dtoClass = mg.value(); mapMg.put(dtoClass, _parseMerging(mg, refrences)); } this.target.setMergings(mapMg); List<ModelField> fieldList = new ArrayList<ModelField>(fields.size()); for (Field field : fields) { fieldList.add(new ModelField(field.getName())); } target.setFields(fieldList); List<KeyPropertyBean> keys = new ArrayList<KeyPropertyBean>(); for (Field field : fields) { KeyProperty kp = field.getAnnotation(KeyProperty.class); if (kp != null) { keys.add(new KeyPropertyBean(field.getName(), kp.value())); } } Collections.sort(keys); this.target.setKeyPropertyList(keys); List<GroupBean> groups = new ArrayList<GroupBean>(); for (Field field : fields) { Group group = field.getAnnotation(Group.class); if (group != null) { String groupName = group.name(); if ("".equals(groupName)) { groupName = Configuration.DEFAULT_GROUP_NAME; } groups.add(new GroupBean(groupName, field.getName(), group.value())); } } Map<String, List<GroupBean>> groupMap = ListUtil.grouping(groups); Set<String> keySet = groupMap.keySet(); for (String groupName : keySet) { Collections.sort(groupMap.get(groupName)); } this.target.setGroups(groupMap); if (needAppendInnerGroup()) { appendInnerGroup(); } return this.target; }
<DeepExtract> Field[] _fields = type.getDeclaredFields(); this.fields = new ArrayList<Field>(_fields.length); for (Field field : _fields) { Transient t = field.getAnnotation(Transient.class); if (null == t) { this.fields.add(field); } } this.fields.trimToSize(); </DeepExtract> <DeepExtract> Cache cache = type.getAnnotation(Cache.class); if (cache == null) return; String prefix = cache.value(); if (null == prefix || "".equals(prefix)) { prefix = type.getSimpleName(); } target.setXbeanClass(type); target.setLevel(CacheLevel.REDIS); target.setKeyBuilder(cache.keyBuilder()); target.setPrefix(prefix); </DeepExtract> <DeepExtract> MiniTable mt = type.getAnnotation(MiniTable.class); target.setMiniTable(mt == null ? false : true); </DeepExtract> <DeepExtract> List<Merging> mergingList = new ArrayList<Merging>(); Merging merging = type.getAnnotation(Merging.class); if (merging != null) { mergingList.add(merging); } else { MergingList ml = type.getAnnotation(MergingList.class); if (ml == null) return; mergingList.addAll(Arrays.asList(ml.value())); } Map<Class<?>, List<RefrenceBean>> refrences = ListUtil.grouping(_parseRefrence()); Map<Class<?>, MergingBean> mapMg = new HashMap<Class<?>, MergingBean>(); for (Merging mg : mergingList) { Class<?> dtoClass = mg.value(); mapMg.put(dtoClass, _parseMerging(mg, refrences)); } this.target.setMergings(mapMg); </DeepExtract> <DeepExtract> List<ModelField> fieldList = new ArrayList<ModelField>(fields.size()); for (Field field : fields) { fieldList.add(new ModelField(field.getName())); } target.setFields(fieldList); </DeepExtract> <DeepExtract> List<KeyPropertyBean> keys = new ArrayList<KeyPropertyBean>(); for (Field field : fields) { KeyProperty kp = field.getAnnotation(KeyProperty.class); if (kp != null) { keys.add(new KeyPropertyBean(field.getName(), kp.value())); } } Collections.sort(keys); this.target.setKeyPropertyList(keys); </DeepExtract> <DeepExtract> List<GroupBean> groups = new ArrayList<GroupBean>(); for (Field field : fields) { Group group = field.getAnnotation(Group.class); if (group != null) { String groupName = group.name(); if ("".equals(groupName)) { groupName = Configuration.DEFAULT_GROUP_NAME; } groups.add(new GroupBean(groupName, field.getName(), group.value())); } } Map<String, List<GroupBean>> groupMap = ListUtil.grouping(groups); Set<String> keySet = groupMap.keySet(); for (String groupName : keySet) { Collections.sort(groupMap.get(groupName)); } this.target.setGroups(groupMap); </DeepExtract>
easyooo-framework
positive
private void setListShown(boolean shown, boolean animate) { if (mList != null) { return; } View root = getView(); if (root == null) { throw new IllegalStateException("Content view not yet created"); } View rawList = root.findViewById(android.R.id.list); if (mEmptyView == null) { throw new RuntimeException("Your content must have a View whose id attribute is 'R.id.empty'"); } if (mProgressContainer == null) { throw new RuntimeException("Your content must have a View whose id attribute is 'R.id.loading'"); } mProgressContainer.setVisibility(View.GONE); if (rawList == null) { throw new RuntimeException("Your content must have a ListView whose id attribute is 'R.id.list'"); } if (!(rawList instanceof AbsListView)) { throw new RuntimeException("Content has view with id attribute 'R.id.list' that is not a AbsListView class"); } mList = (AbsListView) rawList; mListShown = true; mList.setOnItemClickListener(mOnClickListener); mList.setOnScrollListener(mOnScrollListener); if (mAdapter != null) { ListAdapter adapter = mAdapter; mAdapter = null; setListAdapter(adapter); } else { if (mProgressContainer != null) { setListShown(false, false); } } mHandler.post(mRequestFocus); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mListShown == shown) { return; } mListShown = shown; if (shown) { if (animate) { mList.setAlpha(0.0f); mList.animate().alpha(1.0f).setInterpolator(new DecelerateInterpolator()); } else { mList.clearAnimation(); } mList.setVisibility(View.VISIBLE); } else { if (animate) { mList.setAlpha(1.0f); mList.animate().alpha(0.0f).setInterpolator(new AccelerateInterpolator()); } else { mList.clearAnimation(); } mList.setVisibility(View.GONE); } }
<DeepExtract> if (mList != null) { return; } View root = getView(); if (root == null) { throw new IllegalStateException("Content view not yet created"); } View rawList = root.findViewById(android.R.id.list); if (mEmptyView == null) { throw new RuntimeException("Your content must have a View whose id attribute is 'R.id.empty'"); } if (mProgressContainer == null) { throw new RuntimeException("Your content must have a View whose id attribute is 'R.id.loading'"); } mProgressContainer.setVisibility(View.GONE); if (rawList == null) { throw new RuntimeException("Your content must have a ListView whose id attribute is 'R.id.list'"); } if (!(rawList instanceof AbsListView)) { throw new RuntimeException("Content has view with id attribute 'R.id.list' that is not a AbsListView class"); } mList = (AbsListView) rawList; mListShown = true; mList.setOnItemClickListener(mOnClickListener); mList.setOnScrollListener(mOnScrollListener); if (mAdapter != null) { ListAdapter adapter = mAdapter; mAdapter = null; setListAdapter(adapter); } else { if (mProgressContainer != null) { setListShown(false, false); } } mHandler.post(mRequestFocus); </DeepExtract>
frisbee
positive
@Override public UserOrBuilder getUserOrBuilder() { return user_ == null ? User.getDefaultInstance() : user_; }
<DeepExtract> return user_ == null ? User.getDefaultInstance() : user_; </DeepExtract>
java-wechat-grpc-local
positive
private void sendUserId(int uid) throws ChannelException { if (_log.isLoggable(Level.FINER)) { _log.finer("sending user id " + uid); } sendEncodedLong(uid, 1); }
<DeepExtract> sendEncodedLong(uid, 1); </DeepExtract>
yajsync
positive
@Override public void onPrepared(MediaPlayer mp) { EventBus.getDefault().post(mediaItem); service.playMusic(); }
<DeepExtract> service.playMusic(); </DeepExtract>
gankzhihu
positive
private void createOutputOfInputMalletAndOrgTable(WikiTextToCSVForeward textTocsv) { try { bwCSVOrigText.append(textTocsv.getCSV()); } catch (IOException e) { System.err.println("append to bw "); e.printStackTrace(); } try { bwInputSQLParsedText.append(textTocsv.getOrgTableString()); } catch (IOException e) { System.err.println("append to inputsql "); e.printStackTrace(); } }
<DeepExtract> try { bwCSVOrigText.append(textTocsv.getCSV()); } catch (IOException e) { System.err.println("append to bw "); e.printStackTrace(); } </DeepExtract> <DeepExtract> try { bwInputSQLParsedText.append(textTocsv.getOrgTableString()); } catch (IOException e) { System.err.println("append to inputsql "); e.printStackTrace(); } </DeepExtract>
TopicExplorer
positive
@Test public void testThisReference() throws IOException { SignatureProcessor sp = new SignatureProcessor("class KTypeVTypeFoo<KType, VType> { public void foo() { KTypeVTypeFoo.this.foo(); } }"); check(new TemplateOptions(Type.FLOAT, Type.DOUBLE), sp, "class FloatDoubleFoo { public void foo() { FloatDoubleFoo.this.foo(); } }"); }
<DeepExtract> check(new TemplateOptions(Type.FLOAT, Type.DOUBLE), sp, "class FloatDoubleFoo { public void foo() { FloatDoubleFoo.this.foo(); } }"); </DeepExtract>
hppc
positive
@Override public void requestContinueDownload() { Message m = Message.obtain(null, MSG_REQUEST_CONTINUE_DOWNLOAD); m.setData(new Bundle()); try { mMsg.send(m); } catch (RemoteException e) { e.printStackTrace(); } }
<DeepExtract> Message m = Message.obtain(null, MSG_REQUEST_CONTINUE_DOWNLOAD); m.setData(new Bundle()); try { mMsg.send(m); } catch (RemoteException e) { e.printStackTrace(); } </DeepExtract>
rapt
positive
@Override public Object handle(Request request, Response response) throws Exception { Req requestParams = parseRequestParams(request); Res result = processRequest(requestParams, response); return gson.toJson(result); }
<DeepExtract> return gson.toJson(result); </DeepExtract>
skeleton-sp19
positive
public boolean isTextPresent(final String text) { driver = WebUIDriver.getWebDriver(); element = driver.findElement(by); return element.getText().contains(text); }
<DeepExtract> driver = WebUIDriver.getWebDriver(); element = driver.findElement(by); </DeepExtract>
seleniumtestsframework
positive
public void reset(String latex) { parseString = new StringBuffer(latex); len = parseString.length(); formula.root = null; pos = 0; spos = 0; line = 0; col = 0; group = 0; insertion = false; atIsLetter = 0; arrayMode = false; ignoreWhiteSpace = true; if (len != 0) { char ch; String com; int spos; String[] args; MacroInfo mac; while (pos < len) { ch = parseString.charAt(pos); switch(ch) { case ESCAPE: spos = pos; com = getCommand(); if ("newcommand".equals(com) || "renewcommand".equals(com)) { args = getOptsArgs(2, 2); mac = MacroInfo.Commands.get(com); try { mac.invoke(this, args); } catch (ParseException e) { if (!isPartial) { throw e; } } parseString.delete(spos, pos); len = parseString.length(); pos = spos; } else if (NewCommandMacro.isMacro(com)) { mac = MacroInfo.Commands.get(com); args = getOptsArgs(mac.nbArgs, mac.hasOptions ? 1 : 0); args[0] = com; try { parseString.replace(spos, pos, (String) mac.invoke(this, args)); } catch (ParseException e) { if (!isPartial) { throw e; } else { spos += com.length() + 1; } } len = parseString.length(); pos = spos; } else if ("begin".equals(com)) { args = getOptsArgs(1, 0); mac = MacroInfo.Commands.get(args[1] + "@env"); if (mac == null) { if (!isPartial) { throw new ParseException("Unknown environment: " + args[1] + " at position " + getLine() + ":" + getCol()); } } else { try { String[] optarg = getOptsArgs(mac.nbArgs - 1, 0); String grp = getGroup("\\begin{" + args[1] + "}", "\\end{" + args[1] + "}"); String expr = "{\\makeatletter \\" + args[1] + "@env"; for (int i = 1; i <= mac.nbArgs - 1; i++) expr += "{" + optarg[i] + "}"; expr += "{" + grp + "}\\makeatother}"; parseString.replace(spos, pos, expr); len = parseString.length(); pos = spos; } catch (ParseException e) { if (!isPartial) { throw e; } } } } else if ("makeatletter".equals(com)) atIsLetter++; else if ("makeatother".equals(com)) atIsLetter--; else if (unparsedContents.contains(com)) { getOptsArgs(1, 0); } break; case PERCENT: spos = pos++; char chr; while (pos < len) { chr = parseString.charAt(pos++); if (chr == '\r' || chr == '\n') { break; } } if (pos < len) { pos--; } parseString.replace(spos, pos, ""); len = parseString.length(); pos = spos; break; case DEGRE: parseString.replace(pos, pos + 1, "^{\\circ}"); len = parseString.length(); pos++; break; case SUPTWO: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{2}"); len = parseString.length(); pos++; break; case SUPTHREE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{3}"); len = parseString.length(); pos++; break; case SUPONE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{1}"); len = parseString.length(); pos++; break; case SUPZERO: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{0}"); len = parseString.length(); pos++; break; case SUPFOUR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{4}"); len = parseString.length(); pos++; break; case SUPFIVE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{5}"); len = parseString.length(); pos++; break; case SUPSIX: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{6}"); len = parseString.length(); pos++; break; case SUPSEVEN: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{7}"); len = parseString.length(); pos++; break; case SUPEIGHT: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{8}"); len = parseString.length(); pos++; break; case SUPNINE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{9}"); len = parseString.length(); pos++; break; case SUPPLUS: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{+}"); len = parseString.length(); pos++; break; case SUPMINUS: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{-}"); len = parseString.length(); pos++; break; case SUPEQUAL: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{=}"); len = parseString.length(); pos++; break; case SUPLPAR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{(}"); len = parseString.length(); pos++; break; case SUPRPAR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{)}"); len = parseString.length(); pos++; break; case SUPN: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{n}"); len = parseString.length(); pos++; break; case SUBTWO: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{2}"); len = parseString.length(); pos++; break; case SUBTHREE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{3}"); len = parseString.length(); pos++; break; case SUBONE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{1}"); len = parseString.length(); pos++; break; case SUBZERO: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{0}"); len = parseString.length(); pos++; break; case SUBFOUR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{4}"); len = parseString.length(); pos++; break; case SUBFIVE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{5}"); len = parseString.length(); pos++; break; case SUBSIX: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{6}"); len = parseString.length(); pos++; break; case SUBSEVEN: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{7}"); len = parseString.length(); pos++; break; case SUBEIGHT: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{8}"); len = parseString.length(); pos++; break; case SUBNINE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{9}"); len = parseString.length(); pos++; break; case SUBPLUS: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{+}"); len = parseString.length(); pos++; break; case SUBMINUS: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{-}"); len = parseString.length(); pos++; break; case SUBEQUAL: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{=}"); len = parseString.length(); pos++; break; case SUBLPAR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{(}"); len = parseString.length(); pos++; break; case SUBRPAR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{)}"); len = parseString.length(); pos++; break; default: pos++; } } pos = 0; len = parseString.length(); } }
<DeepExtract> if (len != 0) { char ch; String com; int spos; String[] args; MacroInfo mac; while (pos < len) { ch = parseString.charAt(pos); switch(ch) { case ESCAPE: spos = pos; com = getCommand(); if ("newcommand".equals(com) || "renewcommand".equals(com)) { args = getOptsArgs(2, 2); mac = MacroInfo.Commands.get(com); try { mac.invoke(this, args); } catch (ParseException e) { if (!isPartial) { throw e; } } parseString.delete(spos, pos); len = parseString.length(); pos = spos; } else if (NewCommandMacro.isMacro(com)) { mac = MacroInfo.Commands.get(com); args = getOptsArgs(mac.nbArgs, mac.hasOptions ? 1 : 0); args[0] = com; try { parseString.replace(spos, pos, (String) mac.invoke(this, args)); } catch (ParseException e) { if (!isPartial) { throw e; } else { spos += com.length() + 1; } } len = parseString.length(); pos = spos; } else if ("begin".equals(com)) { args = getOptsArgs(1, 0); mac = MacroInfo.Commands.get(args[1] + "@env"); if (mac == null) { if (!isPartial) { throw new ParseException("Unknown environment: " + args[1] + " at position " + getLine() + ":" + getCol()); } } else { try { String[] optarg = getOptsArgs(mac.nbArgs - 1, 0); String grp = getGroup("\\begin{" + args[1] + "}", "\\end{" + args[1] + "}"); String expr = "{\\makeatletter \\" + args[1] + "@env"; for (int i = 1; i <= mac.nbArgs - 1; i++) expr += "{" + optarg[i] + "}"; expr += "{" + grp + "}\\makeatother}"; parseString.replace(spos, pos, expr); len = parseString.length(); pos = spos; } catch (ParseException e) { if (!isPartial) { throw e; } } } } else if ("makeatletter".equals(com)) atIsLetter++; else if ("makeatother".equals(com)) atIsLetter--; else if (unparsedContents.contains(com)) { getOptsArgs(1, 0); } break; case PERCENT: spos = pos++; char chr; while (pos < len) { chr = parseString.charAt(pos++); if (chr == '\r' || chr == '\n') { break; } } if (pos < len) { pos--; } parseString.replace(spos, pos, ""); len = parseString.length(); pos = spos; break; case DEGRE: parseString.replace(pos, pos + 1, "^{\\circ}"); len = parseString.length(); pos++; break; case SUPTWO: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{2}"); len = parseString.length(); pos++; break; case SUPTHREE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{3}"); len = parseString.length(); pos++; break; case SUPONE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{1}"); len = parseString.length(); pos++; break; case SUPZERO: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{0}"); len = parseString.length(); pos++; break; case SUPFOUR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{4}"); len = parseString.length(); pos++; break; case SUPFIVE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{5}"); len = parseString.length(); pos++; break; case SUPSIX: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{6}"); len = parseString.length(); pos++; break; case SUPSEVEN: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{7}"); len = parseString.length(); pos++; break; case SUPEIGHT: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{8}"); len = parseString.length(); pos++; break; case SUPNINE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{9}"); len = parseString.length(); pos++; break; case SUPPLUS: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{+}"); len = parseString.length(); pos++; break; case SUPMINUS: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{-}"); len = parseString.length(); pos++; break; case SUPEQUAL: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{=}"); len = parseString.length(); pos++; break; case SUPLPAR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{(}"); len = parseString.length(); pos++; break; case SUPRPAR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{)}"); len = parseString.length(); pos++; break; case SUPN: parseString.replace(pos, pos + 1, "\\jlatexmathcumsup{n}"); len = parseString.length(); pos++; break; case SUBTWO: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{2}"); len = parseString.length(); pos++; break; case SUBTHREE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{3}"); len = parseString.length(); pos++; break; case SUBONE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{1}"); len = parseString.length(); pos++; break; case SUBZERO: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{0}"); len = parseString.length(); pos++; break; case SUBFOUR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{4}"); len = parseString.length(); pos++; break; case SUBFIVE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{5}"); len = parseString.length(); pos++; break; case SUBSIX: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{6}"); len = parseString.length(); pos++; break; case SUBSEVEN: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{7}"); len = parseString.length(); pos++; break; case SUBEIGHT: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{8}"); len = parseString.length(); pos++; break; case SUBNINE: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{9}"); len = parseString.length(); pos++; break; case SUBPLUS: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{+}"); len = parseString.length(); pos++; break; case SUBMINUS: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{-}"); len = parseString.length(); pos++; break; case SUBEQUAL: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{=}"); len = parseString.length(); pos++; break; case SUBLPAR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{(}"); len = parseString.length(); pos++; break; case SUBRPAR: parseString.replace(pos, pos + 1, "\\jlatexmathcumsub{)}"); len = parseString.length(); pos++; break; default: pos++; } } pos = 0; len = parseString.length(); } </DeepExtract>
jlatexmath
positive
public static String encryptRSA2HexString(final byte[] data, final byte[] publicKey, final int keySize, final String transformation) { if (encryptRSA(data, publicKey, keySize, transformation) == null) return ""; int len = encryptRSA(data, publicKey, keySize, transformation).length; if (len <= 0) return ""; char[] ret = new char[len << 1]; for (int i = 0, j = 0; i < len; i++) { ret[j++] = HEX_DIGITS[encryptRSA(data, publicKey, keySize, transformation)[i] >> 4 & 0x0f]; ret[j++] = HEX_DIGITS[encryptRSA(data, publicKey, keySize, transformation)[i] & 0x0f]; } return new String(ret); }
<DeepExtract> if (encryptRSA(data, publicKey, keySize, transformation) == null) return ""; int len = encryptRSA(data, publicKey, keySize, transformation).length; if (len <= 0) return ""; char[] ret = new char[len << 1]; for (int i = 0, j = 0; i < len; i++) { ret[j++] = HEX_DIGITS[encryptRSA(data, publicKey, keySize, transformation)[i] >> 4 & 0x0f]; ret[j++] = HEX_DIGITS[encryptRSA(data, publicKey, keySize, transformation)[i] & 0x0f]; } return new String(ret); </DeepExtract>
Utils-Everywhere
positive
@Override public synchronized ListenableFuture<ReplicatorReceipt> logData(List<ByteBuffer> data) { SettableFuture<ReplicatorReceipt> receiptFuture = SettableFuture.create(); final long thisSeqNum = nextSeqNum; nextSeqNum++; fiber.execute(() -> { receiptFuture.set(new ReplicatorReceipt(term, thisSeqNum)); doLater(() -> commitNoticeChannel.publish(new IndexCommitNotice(quorumId, nodeId, thisSeqNum, thisSeqNum, term))); }); return receiptFuture; }
<DeepExtract> fiber.execute(() -> { receiptFuture.set(new ReplicatorReceipt(term, thisSeqNum)); doLater(() -> commitNoticeChannel.publish(new IndexCommitNotice(quorumId, nodeId, thisSeqNum, thisSeqNum, term))); }); </DeepExtract>
c5-replicator
positive
@Override public void resume() { mGetDrinkListInteractor.execute(new DrinkListSubscriber()); }
<DeepExtract> mGetDrinkListInteractor.execute(new DrinkListSubscriber()); </DeepExtract>
CleanFit
positive
@Override public void visitDUP_X1(InstructionHandle instructionHandle) { InstructionHandle nextHandle = instructionHandle.getNext(); sb.append(String.format("%d[label=\"%s\"];\n", instructionHandle.getPosition(), instructionHandle.toString())); if (nextHandle != null) { sb.append(String.format("%d -> %d[label=\"next\", color=\"#839096\"];\n", instructionHandle.getPosition(), nextHandle.getPosition())); } else { System.out.println("next == null"); } }
<DeepExtract> InstructionHandle nextHandle = instructionHandle.getNext(); sb.append(String.format("%d[label=\"%s\"];\n", instructionHandle.getPosition(), instructionHandle.toString())); if (nextHandle != null) { sb.append(String.format("%d -> %d[label=\"next\", color=\"#839096\"];\n", instructionHandle.getPosition(), nextHandle.getPosition())); } else { System.out.println("next == null"); } </DeepExtract>
Java-Bytecode-Editor
positive
public static boolean hasContactsPermissions(Context context) { if (!sIsAtLeastM) return true; return context.checkSelfPermission(CONTACTS) == PackageManager.PERMISSION_GRANTED; }
<DeepExtract> if (!sIsAtLeastM) return true; return context.checkSelfPermission(CONTACTS) == PackageManager.PERMISSION_GRANTED; </DeepExtract>
BtcMonitor
positive
private void init(Context ctx) { mCubic = new DecelerateInterpolator(1.5f); mGapPosition = INVALID_POSITION; setHorizontalScrollBarEnabled(false); setVerticalScrollBarEnabled(false); mContentView = new ContentLayout(ctx, this); mContentView.setOrientation(LinearLayout.VERTICAL); if (LinearLayout.VERTICAL == LinearLayout.HORIZONTAL) { mContentView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); } else { mContentView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } super.setOrientation(LinearLayout.VERTICAL); addView(mContentView); mContentView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); if (mGapPosition != INVALID_POSITION) { mGap = getGap(); postInvalidate(); } mFlingVelocity = getContext().getResources().getDisplayMetrics().density * MIN_VELOCITY; }
<DeepExtract> mContentView.setOrientation(LinearLayout.VERTICAL); if (LinearLayout.VERTICAL == LinearLayout.HORIZONTAL) { mContentView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); } else { mContentView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); } super.setOrientation(LinearLayout.VERTICAL); </DeepExtract> <DeepExtract> if (mGapPosition != INVALID_POSITION) { mGap = getGap(); postInvalidate(); } </DeepExtract>
TintBrowser
positive
public Optional<String> getLanguage() { int indexOfLanguage = value.indexOf("language: "); if (hasText(value) && indexOfLanguage != -1) { return Optional.of(value.substring(indexOfLanguage + "language: ".length()).trim()); } return Optional.empty(); }
<DeepExtract> int indexOfLanguage = value.indexOf("language: "); if (hasText(value) && indexOfLanguage != -1) { return Optional.of(value.substring(indexOfLanguage + "language: ".length()).trim()); } return Optional.empty(); </DeepExtract>
cukedoctor
positive
public void mouseEntered(java.awt.event.MouseEvent evt) { logOutButton.setBackground(new Color(85, 65, 118)); }
<DeepExtract> logOutButton.setBackground(new Color(85, 65, 118)); </DeepExtract>
vehler
positive
public static final String hashMac(Context context, String clear) { String hashProgram = Aware.getSetting(context.getApplicationContext(), Aware_Preferences.HASH_FUNCTION_MAC); if (hashProgram.equals("")) { hashProgram = "clear"; } if (clear == null || clear.length() == 0) return ""; if (hashProgram.length() > 0) { String[] hashProgramCommands = hashProgram.split(","); for (String command : hashProgramCommands) { if (command.equals("salt=device_id")) { clear = clear + Aware.getSetting(context, Aware_Preferences.DEVICE_ID); } else if (command.startsWith("salt=")) { String[] command_split = command.split("="); if (command_split.length == 1) continue; clear = clear + command_split[1]; } else if (command.equals("normalize")) { clear = clear.replaceAll("[^\\d+]", ""); } else if (command.equals("normalizeAlnum")) { clear = clear.replaceAll("[^\\dA-Za-z+]", ""); } else if (command.startsWith("last=")) { int start_idx = clear.length() - Integer.parseInt(command.split("=")[1]); if (start_idx < 0) start_idx = 0; clear = clear.substring(start_idx); } else if (command.equals("clear")) { return clear; } else if (command.equals("true")) { return hash(context, clear); } else { return hashGeneric(clear, command); } } } return hash(context, clear); }
<DeepExtract> if (clear == null || clear.length() == 0) return ""; if (hashProgram.length() > 0) { String[] hashProgramCommands = hashProgram.split(","); for (String command : hashProgramCommands) { if (command.equals("salt=device_id")) { clear = clear + Aware.getSetting(context, Aware_Preferences.DEVICE_ID); } else if (command.startsWith("salt=")) { String[] command_split = command.split("="); if (command_split.length == 1) continue; clear = clear + command_split[1]; } else if (command.equals("normalize")) { clear = clear.replaceAll("[^\\d+]", ""); } else if (command.equals("normalizeAlnum")) { clear = clear.replaceAll("[^\\dA-Za-z+]", ""); } else if (command.startsWith("last=")) { int start_idx = clear.length() - Integer.parseInt(command.split("=")[1]); if (start_idx < 0) start_idx = 0; clear = clear.substring(start_idx); } else if (command.equals("clear")) { return clear; } else if (command.equals("true")) { return hash(context, clear); } else { return hashGeneric(clear, command); } } } return hash(context, clear); </DeepExtract>
aware-client
positive
public Criteria andGiftImgIn(List<String> values) { if (values == null) { throw new RuntimeException("Value for " + "giftImg" + " cannot be null"); } criteria.add(new Criterion("GIFT_IMG in", values)); return (Criteria) this; }
<DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "giftImg" + " cannot be null"); } criteria.add(new Criterion("GIFT_IMG in", values)); </DeepExtract>
ECPS
positive
protected void save(int i) { String file; JFileChooser chooser = new JFileChooser(); chooser.setApproveButtonText("Save"); FileNameExtensionFilter filter = new FileNameExtensionFilter(getFileType(), getFileExtension()); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { System.out.println("You chose to call the file: " + chooser.getSelectedFile().getName()); file = chooser.getCurrentDirectory() + "\\" + chooser.getSelectedFile().getName(); } else { System.out.println("file not saved"); file = null; } if (file != null) { save(file, i); } else { System.out.println("Saving cancelled"); } }
<DeepExtract> String file; JFileChooser chooser = new JFileChooser(); chooser.setApproveButtonText("Save"); FileNameExtensionFilter filter = new FileNameExtensionFilter(getFileType(), getFileExtension()); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { System.out.println("You chose to call the file: " + chooser.getSelectedFile().getName()); file = chooser.getCurrentDirectory() + "\\" + chooser.getSelectedFile().getName(); } else { System.out.println("file not saved"); file = null; } </DeepExtract>
CPPNArtEvolution
positive
@Test public void test10000() throws IOException, ClassNotFoundException { l = new int[10000]; a = new byte[10000][]; for (int i = 0; i < 10000; i++) l[i] = (int) (Math.abs(r.nextGaussian()) * 32); for (int i = 0; i < 10000; i++) a[i] = new byte[l[i]]; for (int i = 0; i < 10000; i++) for (int j = 0; j < l[i]; j++) a[i][j] = genKey(); ByteArrayFrontCodedList m = new ByteArrayFrontCodedList(it.unimi.dsi.fastutil.objects.ObjectIterators.wrap(a), r.nextInt(4) + 1); final it.unimi.dsi.fastutil.objects.ObjectArrayList t = new it.unimi.dsi.fastutil.objects.ObjectArrayList(a); assertTrue("Error: m does not equal t at creation", contentEquals(m, t)); assertTrue("Error: m does not equal m.clone()", contentEquals(m, m.clone())); { ObjectListIterator i; java.util.ListIterator j; i = m.listIterator(); j = t.listIterator(); for (int k = 0; k < 2 * 10000; k++) { assertTrue("Error: divergence in hasNext()", i.hasNext() == j.hasNext()); assertTrue("Error: divergence in hasPrevious()", i.hasPrevious() == j.hasPrevious()); if (r.nextFloat() < .8 && i.hasNext()) { assertTrue("Error: divergence in next()", java.util.Arrays.equals((byte[]) i.next(), (byte[]) j.next())); } else if (r.nextFloat() < .2 && i.hasPrevious()) { assertTrue("Error: divergence in previous()", java.util.Arrays.equals((byte[]) i.previous(), (byte[]) j.previous())); } assertTrue("Error: divergence in nextIndex()", i.nextIndex() == j.nextIndex()); assertTrue("Error: divergence in previousIndex()", i.previousIndex() == j.previousIndex()); } } { final int from = r.nextInt(m.size() + 1); ObjectListIterator i; java.util.ListIterator j; i = m.listIterator(from); j = t.listIterator(from); for (int k = 0; k < 2 * 10000; k++) { assertTrue("Error: divergence in hasNext() (iterator with starting point " + from + ")", i.hasNext() == j.hasNext()); assertTrue("Error: divergence in hasPrevious() (iterator with starting point " + from + ")", i.hasPrevious() == j.hasPrevious()); if (r.nextFloat() < .8 && i.hasNext()) { assertTrue("Error: divergence in next() (iterator with starting point " + from + ")", java.util.Arrays.equals((byte[]) i.next(), (byte[]) j.next())); } else if (r.nextFloat() < .2 && i.hasPrevious()) { assertTrue("Error: divergence in previous() (iterator with starting point " + from + ")", java.util.Arrays.equals((byte[]) i.previous(), (byte[]) j.previous())); } } } final java.io.File ff = new java.io.File("it.unimi.dsi.fastutil.test.junit." + m.getClass().getSimpleName() + "." + 10000); final java.io.OutputStream os = new java.io.FileOutputStream(ff); final java.io.ObjectOutputStream oos = new java.io.ObjectOutputStream(os); oos.writeObject(m); oos.close(); final java.io.InputStream is = new java.io.FileInputStream(ff); final java.io.ObjectInputStream ois = new java.io.ObjectInputStream(is); m = (ByteArrayFrontCodedList) ois.readObject(); ois.close(); ff.delete(); assertTrue("Error: m does not equal t after save/read", contentEquals(m, t)); return; }
<DeepExtract> l = new int[10000]; a = new byte[10000][]; for (int i = 0; i < 10000; i++) l[i] = (int) (Math.abs(r.nextGaussian()) * 32); for (int i = 0; i < 10000; i++) a[i] = new byte[l[i]]; for (int i = 0; i < 10000; i++) for (int j = 0; j < l[i]; j++) a[i][j] = genKey(); ByteArrayFrontCodedList m = new ByteArrayFrontCodedList(it.unimi.dsi.fastutil.objects.ObjectIterators.wrap(a), r.nextInt(4) + 1); final it.unimi.dsi.fastutil.objects.ObjectArrayList t = new it.unimi.dsi.fastutil.objects.ObjectArrayList(a); assertTrue("Error: m does not equal t at creation", contentEquals(m, t)); assertTrue("Error: m does not equal m.clone()", contentEquals(m, m.clone())); { ObjectListIterator i; java.util.ListIterator j; i = m.listIterator(); j = t.listIterator(); for (int k = 0; k < 2 * 10000; k++) { assertTrue("Error: divergence in hasNext()", i.hasNext() == j.hasNext()); assertTrue("Error: divergence in hasPrevious()", i.hasPrevious() == j.hasPrevious()); if (r.nextFloat() < .8 && i.hasNext()) { assertTrue("Error: divergence in next()", java.util.Arrays.equals((byte[]) i.next(), (byte[]) j.next())); } else if (r.nextFloat() < .2 && i.hasPrevious()) { assertTrue("Error: divergence in previous()", java.util.Arrays.equals((byte[]) i.previous(), (byte[]) j.previous())); } assertTrue("Error: divergence in nextIndex()", i.nextIndex() == j.nextIndex()); assertTrue("Error: divergence in previousIndex()", i.previousIndex() == j.previousIndex()); } } { final int from = r.nextInt(m.size() + 1); ObjectListIterator i; java.util.ListIterator j; i = m.listIterator(from); j = t.listIterator(from); for (int k = 0; k < 2 * 10000; k++) { assertTrue("Error: divergence in hasNext() (iterator with starting point " + from + ")", i.hasNext() == j.hasNext()); assertTrue("Error: divergence in hasPrevious() (iterator with starting point " + from + ")", i.hasPrevious() == j.hasPrevious()); if (r.nextFloat() < .8 && i.hasNext()) { assertTrue("Error: divergence in next() (iterator with starting point " + from + ")", java.util.Arrays.equals((byte[]) i.next(), (byte[]) j.next())); } else if (r.nextFloat() < .2 && i.hasPrevious()) { assertTrue("Error: divergence in previous() (iterator with starting point " + from + ")", java.util.Arrays.equals((byte[]) i.previous(), (byte[]) j.previous())); } } } final java.io.File ff = new java.io.File("it.unimi.dsi.fastutil.test.junit." + m.getClass().getSimpleName() + "." + 10000); final java.io.OutputStream os = new java.io.FileOutputStream(ff); final java.io.ObjectOutputStream oos = new java.io.ObjectOutputStream(os); oos.writeObject(m); oos.close(); final java.io.InputStream is = new java.io.FileInputStream(ff); final java.io.ObjectInputStream ois = new java.io.ObjectInputStream(is); m = (ByteArrayFrontCodedList) ois.readObject(); ois.close(); ff.delete(); assertTrue("Error: m does not equal t after save/read", contentEquals(m, t)); return; </DeepExtract>
fastutil
positive
@Override public void startFlight(Flight flight, DragonType dragonType) { this.flight = flight; this.currentWayPointIndex = 0; this.dragonType = dragonType; this.toLoc = flight.getWaypoints().get(currentWayPointIndex).getAsLocation(); this.fromLoc = getEntity().getLocation(); double distX = fromLoc.getX() - flight.getWaypoints().get(currentWayPointIndex).getX(); double distY = fromLoc.getY() - flight.getWaypoints().get(currentWayPointIndex).getY(); double distZ = fromLoc.getZ() - flight.getWaypoints().get(currentWayPointIndex).getZ(); double tick = Math.sqrt((distX * distX) + (distY * distY) + (distZ * distZ)) / DragonTravel.getInstance().getConfigHandler().getSpeed(); this.xPerTick = Math.abs(distX) / tick; this.yPerTick = Math.abs(distY) / tick; this.zPerTick = Math.abs(distZ) / tick; }
<DeepExtract> double distX = fromLoc.getX() - flight.getWaypoints().get(currentWayPointIndex).getX(); double distY = fromLoc.getY() - flight.getWaypoints().get(currentWayPointIndex).getY(); double distZ = fromLoc.getZ() - flight.getWaypoints().get(currentWayPointIndex).getZ(); double tick = Math.sqrt((distX * distX) + (distY * distY) + (distZ * distZ)) / DragonTravel.getInstance().getConfigHandler().getSpeed(); this.xPerTick = Math.abs(distX) / tick; this.yPerTick = Math.abs(distY) / tick; this.zPerTick = Math.abs(distZ) / tick; </DeepExtract>
DragonTravel
positive
public Builder addAllLonlats(java.lang.Iterable<? extends java.lang.Double> values) { if (!((bitField0_ & 0x00000040) == 0x00000040)) { lonlats_ = new java.util.ArrayList<java.lang.Double>(lonlats_); bitField0_ |= 0x00000040; } com.google.protobuf.AbstractMessageLite.Builder.addAll(values, lonlats_); onChanged(); return this; }
<DeepExtract> if (!((bitField0_ & 0x00000040) == 0x00000040)) { lonlats_ = new java.util.ArrayList<java.lang.Double>(lonlats_); bitField0_ |= 0x00000040; } </DeepExtract>
sharedstreets-builder
positive
public static String getLockedTimeZoneId(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); return prefs == null ? "" : prefs.getString(PREF_LOCKED_TIME_ZONE_ID, ""); }
<DeepExtract> SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); return prefs == null ? "" : prefs.getString(PREF_LOCKED_TIME_ZONE_ID, ""); </DeepExtract>
calendar-widget
positive
public static void gotoTakePhoto(Activity activity, int requestCode, File outputFile) { if (getTakePhotoIntent(outputFile) == null) return; if (activity != null) { activity.startActivityForResult(getTakePhotoIntent(outputFile), requestCode); } else if (null != null) { null.startActivityForResult(getTakePhotoIntent(outputFile), requestCode); } }
<DeepExtract> if (getTakePhotoIntent(outputFile) == null) return; if (activity != null) { activity.startActivityForResult(getTakePhotoIntent(outputFile), requestCode); } else if (null != null) { null.startActivityForResult(getTakePhotoIntent(outputFile), requestCode); } </DeepExtract>
Utils-Everywhere
positive
protected IModel<String> newCompanyRegisterEntryNumberModel() { return ResourceModelFactory.newResourceModel(ResourceBundleKey.builder().key("main.global.company.register.entry.court.number").defaultValue("").build(), this); }
<DeepExtract> return ResourceModelFactory.newResourceModel(ResourceBundleKey.builder().key("main.global.company.register.entry.court.number").defaultValue("").build(), this); </DeepExtract>
jaulp-wicket
positive
@Test public void test1() throws Exception { Assert.assertTrue(config.parseArgs("dummy")); CodeBase code = new CodeBase(config); List<CodeStatement> statements1 = parseSequenceString("and a", "\n", code); List<CodeStatement> statements2 = parseSequenceString("and a", "\n", code); Assert.assertTrue(comparePrograms(statements1, statements2, HNflags, code, false, REPETITIONS)); }
<DeepExtract> Assert.assertTrue(config.parseArgs("dummy")); CodeBase code = new CodeBase(config); List<CodeStatement> statements1 = parseSequenceString("and a", "\n", code); List<CodeStatement> statements2 = parseSequenceString("and a", "\n", code); Assert.assertTrue(comparePrograms(statements1, statements2, HNflags, code, false, REPETITIONS)); </DeepExtract>
mdlz80optimizer
positive
public void mouseExited(java.awt.event.MouseEvent evt) { bookRideButton.setBackground(new Color(51, 0, 102)); }
<DeepExtract> bookRideButton.setBackground(new Color(51, 0, 102)); </DeepExtract>
vehler
positive
@Override public float getItemInHandDropChance() { return 1; }
<DeepExtract> return 1; </DeepExtract>
CraftFabric
positive
@Before public void before() throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException, IOException, SingerLogException { LogStreamManager.getInstance().getSingerLogPaths().clear(); SingerSettings.getFsMonitorMap().clear(); LogStreamManager.reset(); KubeService.reset(); SingerSettings.reset(); SingerSettings.setBackgroundTaskExecutor(Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setDaemon(true).build())); config = new SingerConfig(); config.setKubernetesEnabled(true); SingerSettings.setSingerConfig(config); kubeConfig = new KubeConfig(); config.setKubeConfig(kubeConfig); podLogPath = new File("").getAbsolutePath() + "/target/pods"; kubeConfig.setPodLogDirectory(podLogPath); if (new File(podLogPath).isDirectory()) { if (new File(podLogPath).list().length == 0) { return new File(podLogPath).delete(); } else { String[] files = new File(podLogPath).list(); boolean result = false; for (String temp : files) { File fileDelete = new File(new File(podLogPath), temp); result = delete(fileDelete); if (!result) { return false; } } if (new File(podLogPath).list().length == 0) { new File(podLogPath).delete(); } return result; } } else { return new File(podLogPath).delete(); } new File(podLogPath).mkdirs(); System.out.println("Creating pod parent directory:" + podLogPath); }
<DeepExtract> if (new File(podLogPath).isDirectory()) { if (new File(podLogPath).list().length == 0) { return new File(podLogPath).delete(); } else { String[] files = new File(podLogPath).list(); boolean result = false; for (String temp : files) { File fileDelete = new File(new File(podLogPath), temp); result = delete(fileDelete); if (!result) { return false; } } if (new File(podLogPath).list().length == 0) { new File(podLogPath).delete(); } return result; } } else { return new File(podLogPath).delete(); } </DeepExtract>
singer
positive
@Override public void update() { this.overridenOI.update(); this.overridingOI.update(); if (!Arrays.equals(this.overridingOI.getLeftRightOutput(), new double[] { 0, 0 }) || this.button.get()) { this.cachedLeftRightOutput = this.overridingOI.getLeftRightOutput(); } else { this.cachedLeftRightOutput = this.overridenOI.getLeftRightOutput(); } if (!Arrays.equals(this.overridingOI.getLeftRightOutput(), new double[] { 0, 0 }) || this.button.get()) { this.cachedFwdRotOutput = this.overridingOI.getFwdRotOutput(); } else { this.cachedFwdRotOutput = this.overridenOI.getFwdRotOutput(); } }
<DeepExtract> if (!Arrays.equals(this.overridingOI.getLeftRightOutput(), new double[] { 0, 0 }) || this.button.get()) { this.cachedLeftRightOutput = this.overridingOI.getLeftRightOutput(); } else { this.cachedLeftRightOutput = this.overridenOI.getLeftRightOutput(); } </DeepExtract> <DeepExtract> if (!Arrays.equals(this.overridingOI.getLeftRightOutput(), new double[] { 0, 0 }) || this.button.get()) { this.cachedFwdRotOutput = this.overridingOI.getFwdRotOutput(); } else { this.cachedFwdRotOutput = this.overridenOI.getFwdRotOutput(); } </DeepExtract>
449-central-repo
positive
@Override public void caseAWhileActionStatement(AWhileActionStatement node) { Label start = new Label(); Label end = new Label(); context.writer.mark(start); context.writer.sequencePoint(node.getWhile().getLine()); node.getExpr().apply(new ExpressionCompiler(context)); try { context.writer.invokeInstance(ArdenValue.class.getMethod("isTrue")); } catch (SecurityException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } context.writer.jumpIfZero(end); node.getActionBlock().apply(this); context.writer.jump(start); context.writer.markForwardJumpsOnly(end); }
<DeepExtract> Label start = new Label(); Label end = new Label(); context.writer.mark(start); context.writer.sequencePoint(node.getWhile().getLine()); node.getExpr().apply(new ExpressionCompiler(context)); try { context.writer.invokeInstance(ArdenValue.class.getMethod("isTrue")); } catch (SecurityException e) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } context.writer.jumpIfZero(end); node.getActionBlock().apply(this); context.writer.jump(start); context.writer.markForwardJumpsOnly(end); </DeepExtract>
arden2bytecode
positive
@Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { String content = (String) adapter.getData().get(position); if (historySearchData != null && historySearchData.size() > 0) { for (int i = 0; i < historySearchData.size(); i++) { if (content.equals(historySearchData.get(i))) { position = i; } } if (position != -1) { historySearchData.remove(position); historySearchData.add(0, content); } else { historySearchData.add(0, content); } } else { historySearchData.add(content); } mHistorySearchAdapter.notifyDataSetChanged(); String histortStr = new Gson().toJson(historySearchData); PreferencesUtils.putString(SearchActivity.this, "histortStr", histortStr); Bundle bundle = new Bundle(); bundle.putString("search", content); Intent intent = new Intent(SearchActivity.this, SearchResultActivity.class); intent.putExtras(bundle); startActivity(intent); }
<DeepExtract> if (historySearchData != null && historySearchData.size() > 0) { for (int i = 0; i < historySearchData.size(); i++) { if (content.equals(historySearchData.get(i))) { position = i; } } if (position != -1) { historySearchData.remove(position); historySearchData.add(0, content); } else { historySearchData.add(0, content); } } else { historySearchData.add(content); } mHistorySearchAdapter.notifyDataSetChanged(); String histortStr = new Gson().toJson(historySearchData); PreferencesUtils.putString(SearchActivity.this, "histortStr", histortStr); Bundle bundle = new Bundle(); bundle.putString("search", content); Intent intent = new Intent(SearchActivity.this, SearchResultActivity.class); intent.putExtras(bundle); startActivity(intent); </DeepExtract>
ShopSystem_2_App
positive
public void setTabPaddingLeftRight(int paddingPx) { this.tabPadding = paddingPx; for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } }
<DeepExtract> for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } } </DeepExtract>
v2ex-android
positive
public static String decryptByPrivateKeyCert(String decryptData, String certPath, String certPwd) throws Exception { String publicKey = RSA.getPrivateKeyByCert(certPath, certPwd); String[] data = decryptData.split("\\|"); String desKey = RSAUtil.decryptByPrivateKey(data[1], publicKey); byte[] desdata = Base64Util.decodeBase64(data[2]); String result = DESedeUtil.decryptString(desdata, desKey.getBytes()); return result; }
<DeepExtract> String[] data = decryptData.split("\\|"); String desKey = RSAUtil.decryptByPrivateKey(data[1], publicKey); byte[] desdata = Base64Util.decodeBase64(data[2]); String result = DESedeUtil.decryptString(desdata, desKey.getBytes()); return result; </DeepExtract>
springmore
positive
public static AppVersionConfig defaultConfig() { final AppVersionConfig config = new AppVersionConfig(); for (AppVersionSettings setting : EnumSet.allOf(AppVersionSettings.class)) { config.setSetting(setting, setting.getDefault()); } configVariables.put("COPYRIGHTDATE", String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); displayedVersionNumber = 1; return config; }
<DeepExtract> configVariables.put("COPYRIGHTDATE", String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); </DeepExtract> <DeepExtract> displayedVersionNumber = 1; </DeepExtract>
TestingApp
positive