before
stringlengths
12
3.21M
after
stringlengths
41
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
@Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { super.readFromNBT(packet.getNbtCompound()); block1 = Block.getBlockById(packet.getNbtCompound().getInteger("block1")); block2 = Block.getBlockById(packet.getNbtCompound().getInteger("block2")); metadata1 = packet.getNbtCompound().getInteger("metadata1"); metadata2 = packet.getNbtCompound().getInteger("metadata2"); }
@Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { <DeepExtract> super.readFromNBT(packet.getNbtCompound()); block1 = Block.getBlockById(packet.getNbtCompound().getInteger("block1")); block2 = Block.getBlockById(packet.getNbtCompound().getInteger("block2")); metadata1 = packet.getNbtCompound().getInteger("metadata1"); metadata2 = packet.getNbtCompound().getInteger("metadata2"); </DeepExtract> }
MalisisDoors
positive
441,044
@Test void testOneSampleDatasetThrows() { final double m = 0; final double v = 1; final long n = 5; TestUtils.assertThrowsWithMessage(IllegalArgumentException.class, () -> TTest.withDefaults()::statistic.accept(m, v, 1), "values", "size"); TestUtils.assertThrowsWithMessage(IllegalArgumentException.class, () -> TTest.withDefaults()::statistic.accept(m, -1, n), "negative"); final double m = 0; final double v = 1; final long n = 5; TestUtils.assertThrowsWithMessage(IllegalArgumentException.class, () -> TTest.withDefaults()::test.accept(m, v, 1), "values", "size"); TestUtils.assertThrowsWithMessage(IllegalArgumentException.class, () -> TTest.withDefaults()::test.accept(m, -1, n), "negative"); }
@Test void testOneSampleDatasetThrows() { final double m = 0; final double v = 1; final long n = 5; TestUtils.assertThrowsWithMessage(IllegalArgumentException.class, () -> TTest.withDefaults()::statistic.accept(m, v, 1), "values", "size"); TestUtils.assertThrowsWithMessage(IllegalArgumentException.class, () -> TTest.withDefaults()::statistic.accept(m, -1, n), "negative"); <DeepExtract> final double m = 0; final double v = 1; final long n = 5; TestUtils.assertThrowsWithMessage(IllegalArgumentException.class, () -> TTest.withDefaults()::test.accept(m, v, 1), "values", "size"); TestUtils.assertThrowsWithMessage(IllegalArgumentException.class, () -> TTest.withDefaults()::test.accept(m, -1, n), "negative"); </DeepExtract> }
commons-statistics
positive
441,045
@Override public void update(Configuration confuguration) throws IOException { FileOutputStream fileOut = new FileOutputStream(defaultFile.getAbsolutePath()); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(confuguration); out.close(); fileOut.close(); }
@Override public void update(Configuration confuguration) throws IOException { <DeepExtract> FileOutputStream fileOut = new FileOutputStream(defaultFile.getAbsolutePath()); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(confuguration); out.close(); fileOut.close(); </DeepExtract> }
B4D
positive
441,047
private void start() { try { sendChat("Hello, how are you?"); } catch (ConnectionUnavailableException e) { System.out.println("Caught a connection unavailable Exception!"); } if (chatServer == null) throw new IllegalChatServerException("Chat server is empty"); }
private void start() { try { sendChat("Hello, how are you?"); } catch (ConnectionUnavailableException e) { System.out.println("Caught a connection unavailable Exception!"); } <DeepExtract> if (chatServer == null) throw new IllegalChatServerException("Chat server is empty"); </DeepExtract> }
java-8-recipes
positive
441,049
public void resetOrientation() { this.orientation = this.orientation.toUpperCase(); this.orientation = this.orientation; final String PORTRAIT = "PORTRAIT"; final String LANDSCAPE = "LANDSCAPE"; if (PORTRAIT.equals(this.orientation)) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (LANDSCAPE.equals(this.orientation)) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } }
public void resetOrientation() { <DeepExtract> this.orientation = this.orientation.toUpperCase(); this.orientation = this.orientation; final String PORTRAIT = "PORTRAIT"; final String LANDSCAPE = "LANDSCAPE"; if (PORTRAIT.equals(this.orientation)) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else if (LANDSCAPE.equals(this.orientation)) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } </DeepExtract> }
baker-android
positive
441,050
@Override public void copyTo(AttributeImpl target) { TypeAttribute t = (TypeAttribute) target; this.type = type; }
@Override public void copyTo(AttributeImpl target) { TypeAttribute t = (TypeAttribute) target; <DeepExtract> this.type = type; </DeepExtract> }
chinesesegmentor
positive
441,051
@Override public void endpointRemoved(@NotNull String endpointId) { logger.info("Endpoint " + endpointId + " was removed from the conference. Re-inviting participant."); if (!Collections.singletonList(endpointId).isEmpty()) { ConferenceMetrics.participantsMoved.addAndGet(Collections.singletonList(endpointId).size()); synchronized (participantLock) { List<Participant> participantsToReinvite = new ArrayList<>(); for (Participant participant : participants.values()) { if (Collections.singletonList(endpointId).contains(participant.getEndpointId())) { participantsToReinvite.add(participant); } } if (participantsToReinvite.size() != Collections.singletonList(endpointId).size()) { logger.error("Can not re-invite all participants, no Participant object for some of them."); } reInviteParticipants(participantsToReinvite, false); } } }
@Override public void endpointRemoved(@NotNull String endpointId) { logger.info("Endpoint " + endpointId + " was removed from the conference. Re-inviting participant."); <DeepExtract> if (!Collections.singletonList(endpointId).isEmpty()) { ConferenceMetrics.participantsMoved.addAndGet(Collections.singletonList(endpointId).size()); synchronized (participantLock) { List<Participant> participantsToReinvite = new ArrayList<>(); for (Participant participant : participants.values()) { if (Collections.singletonList(endpointId).contains(participant.getEndpointId())) { participantsToReinvite.add(participant); } } if (participantsToReinvite.size() != Collections.singletonList(endpointId).size()) { logger.error("Can not re-invite all participants, no Participant object for some of them."); } reInviteParticipants(participantsToReinvite, false); } } </DeepExtract> }
jicofo
positive
441,052
public static boolean setStatusBarDarkMode(Activity activity, boolean dark) { Window window = activity.getWindow(); if (RomUtil.isMiui()) { boolean result = setStatusBarDarkMIUI(activity, dark); return result || setStatusBarDarkMarshmallow(window, dark); } else if (RomUtil.isFlyme()) { boolean result = setStatusBarDarkFlyme(window, dark); return result || setStatusBarDarkMarshmallow(window, dark); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { View decorView = window.getDecorView(); if (decorView != null) { int vis = decorView.getSystemUiVisibility(); if (dark) { vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; } else { vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; } decorView.setSystemUiVisibility(vis); } return true; } return false; }
public static boolean setStatusBarDarkMode(Activity activity, boolean dark) { Window window = activity.getWindow(); if (RomUtil.isMiui()) { boolean result = setStatusBarDarkMIUI(activity, dark); return result || setStatusBarDarkMarshmallow(window, dark); } else if (RomUtil.isFlyme()) { boolean result = setStatusBarDarkFlyme(window, dark); return result || setStatusBarDarkMarshmallow(window, dark); } <DeepExtract> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { View decorView = window.getDecorView(); if (decorView != null) { int vis = decorView.getSystemUiVisibility(); if (dark) { vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; } else { vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; } decorView.setSystemUiVisibility(vis); } return true; } return false; </DeepExtract> }
Headline_News_Kotlin_App
positive
441,055
public Criteria andU_groupLessThan(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "u_group" + " cannot be null"); } criteria.add(new Criterion("u_group <", value)); return (Criteria) this; }
public Criteria andU_groupLessThan(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "u_group" + " cannot be null"); } criteria.add(new Criterion("u_group <", value)); </DeepExtract> return (Criteria) this; }
BaiChengNews
positive
441,057
public void terminate() { if (_isStopping.get()) throw new IllegalStateException("Transport is stopped"); _isStopping.set(true); if (_fd != null) { _hb.halt(); try { _hb.join(); } catch (InterruptedException anIE) { } _fd.stop(); } _parent.destroy(this); synchronized (this) { for (Dispatcher d : _dispatcher) try { d.terminate(); } catch (Exception anE) { _logger.warn("Dispatcher didn't terminate cleanly", anE); } } }
public void terminate() { <DeepExtract> if (_isStopping.get()) throw new IllegalStateException("Transport is stopped"); </DeepExtract> _isStopping.set(true); if (_fd != null) { _hb.halt(); try { _hb.join(); } catch (InterruptedException anIE) { } _fd.stop(); } _parent.destroy(this); synchronized (this) { for (Dispatcher d : _dispatcher) try { d.terminate(); } catch (Exception anE) { _logger.warn("Dispatcher didn't terminate cleanly", anE); } } }
paxos
positive
441,059
private void setScrollPosition(int position, boolean force) { int height = getHeight(); position = Util.clamp(position, 0, mScrollHeight - height); if (!force && position == mScrollY) return; mScrollY = position; int n = mModel.size(); int start = 0; int end = 0; for (start = 0; start < n; ++start) { if (position < mModel.getView(start).mBounds.bottom) break; } int bottom = position + height; for (end = start; end < n; ++end) { if (bottom <= mModel.getView(end).mBounds.top) break; } if (start == mVisibleStart && end == mVisibleEnd) return; mVisibleStart = start; mVisibleEnd = end; invalidate(); }
private void setScrollPosition(int position, boolean force) { int height = getHeight(); position = Util.clamp(position, 0, mScrollHeight - height); if (!force && position == mScrollY) return; mScrollY = position; int n = mModel.size(); int start = 0; int end = 0; for (start = 0; start < n; ++start) { if (position < mModel.getView(start).mBounds.bottom) break; } int bottom = position + height; for (end = start; end < n; ++end) { if (bottom <= mModel.getView(end).mBounds.top) break; } <DeepExtract> if (start == mVisibleStart && end == mVisibleEnd) return; mVisibleStart = start; mVisibleEnd = end; </DeepExtract> invalidate(); }
QuickSnap
positive
441,060
public void testAbstractVoid() throws Exception { String testSourceCode = "package foo.bar;\n" + "import retroweibo.RetroWeibo;\n" + "@RetroWeibo\n" + "public abstract class Baz {\n" + " public abstract void foo();\n" + "}\n"; ImmutableMultimap<Diagnostic.Kind, Pattern> expectedDiagnostics = ImmutableMultimap.of(Diagnostic.Kind.WARNING, CANNOT_HAVE_NON_PROPERTIES, Diagnostic.Kind.ERROR, Pattern.compile("RetroWeibo_Baz")); assertFalse(ImmutableList.of(testSourceCode).isEmpty()); StringWriter compilerOut = new StringWriter(); List<String> options = ImmutableList.of("-sourcepath", tmpDir.getPath(), "-d", tmpDir.getPath(), "-processor", RetroWeiboProcessor.class.getName(), "-Xlint"); javac.getTask(compilerOut, fileManager, diagnosticCollector, options, null, null); List<String> classNames = Lists.newArrayList(); List<JavaFileObject> sourceFiles = Lists.newArrayList(); for (String source : ImmutableList.of(testSourceCode)) { ClassName className = ClassName.extractFromSource(source); File dir = new File(tmpDir, className.sourceDirectoryName()); dir.mkdirs(); assertTrue(dir.isDirectory()); String sourceName = className.simpleName + ".java"; Files.write(source, new File(dir, sourceName), Charsets.UTF_8); classNames.add(className.fullName()); JavaFileObject sourceFile = fileManager.getJavaFileForInput(StandardLocation.SOURCE_PATH, className.fullName(), Kind.SOURCE); sourceFiles.add(sourceFile); } assertEquals(classNames.size(), sourceFiles.size()); JavaCompiler.CompilationTask javacTask = javac.getTask(compilerOut, fileManager, diagnosticCollector, options, classNames, sourceFiles); boolean compiledOk = javacTask.call(); Multimap<Diagnostic.Kind, String> diagnostics = ArrayListMultimap.create(); for (Diagnostic<?> diagnostic : diagnosticCollector.getDiagnostics()) { boolean ignore = (diagnostic.getKind() == Diagnostic.Kind.NOTE || (diagnostic.getKind() == Diagnostic.Kind.WARNING && diagnostic.getMessage(null).contains("No processor claimed any of these annotations"))); if (!ignore) { diagnostics.put(diagnostic.getKind(), diagnostic.getMessage(null)); } } assertEquals(diagnostics.containsKey(Diagnostic.Kind.ERROR), !compiledOk); assertEquals("Diagnostic kinds should match: " + diagnostics, expectedDiagnostics.keySet(), diagnostics.keySet()); for (Map.Entry<Diagnostic.Kind, Pattern> expectedDiagnostic : expectedDiagnostics.entries()) { Collection<String> actualDiagnostics = diagnostics.get(expectedDiagnostic.getKey()); assertTrue("Diagnostics should contain " + expectedDiagnostic + ": " + diagnostics, Iterables.any(actualDiagnostics, Predicates.contains(expectedDiagnostic.getValue()))); } }
public void testAbstractVoid() throws Exception { String testSourceCode = "package foo.bar;\n" + "import retroweibo.RetroWeibo;\n" + "@RetroWeibo\n" + "public abstract class Baz {\n" + " public abstract void foo();\n" + "}\n"; ImmutableMultimap<Diagnostic.Kind, Pattern> expectedDiagnostics = ImmutableMultimap.of(Diagnostic.Kind.WARNING, CANNOT_HAVE_NON_PROPERTIES, Diagnostic.Kind.ERROR, Pattern.compile("RetroWeibo_Baz")); <DeepExtract> assertFalse(ImmutableList.of(testSourceCode).isEmpty()); StringWriter compilerOut = new StringWriter(); List<String> options = ImmutableList.of("-sourcepath", tmpDir.getPath(), "-d", tmpDir.getPath(), "-processor", RetroWeiboProcessor.class.getName(), "-Xlint"); javac.getTask(compilerOut, fileManager, diagnosticCollector, options, null, null); List<String> classNames = Lists.newArrayList(); List<JavaFileObject> sourceFiles = Lists.newArrayList(); for (String source : ImmutableList.of(testSourceCode)) { ClassName className = ClassName.extractFromSource(source); File dir = new File(tmpDir, className.sourceDirectoryName()); dir.mkdirs(); assertTrue(dir.isDirectory()); String sourceName = className.simpleName + ".java"; Files.write(source, new File(dir, sourceName), Charsets.UTF_8); classNames.add(className.fullName()); JavaFileObject sourceFile = fileManager.getJavaFileForInput(StandardLocation.SOURCE_PATH, className.fullName(), Kind.SOURCE); sourceFiles.add(sourceFile); } assertEquals(classNames.size(), sourceFiles.size()); JavaCompiler.CompilationTask javacTask = javac.getTask(compilerOut, fileManager, diagnosticCollector, options, classNames, sourceFiles); boolean compiledOk = javacTask.call(); Multimap<Diagnostic.Kind, String> diagnostics = ArrayListMultimap.create(); for (Diagnostic<?> diagnostic : diagnosticCollector.getDiagnostics()) { boolean ignore = (diagnostic.getKind() == Diagnostic.Kind.NOTE || (diagnostic.getKind() == Diagnostic.Kind.WARNING && diagnostic.getMessage(null).contains("No processor claimed any of these annotations"))); if (!ignore) { diagnostics.put(diagnostic.getKind(), diagnostic.getMessage(null)); } } assertEquals(diagnostics.containsKey(Diagnostic.Kind.ERROR), !compiledOk); assertEquals("Diagnostic kinds should match: " + diagnostics, expectedDiagnostics.keySet(), diagnostics.keySet()); for (Map.Entry<Diagnostic.Kind, Pattern> expectedDiagnostic : expectedDiagnostics.entries()) { Collection<String> actualDiagnostics = diagnostics.get(expectedDiagnostic.getKey()); assertTrue("Diagnostics should contain " + expectedDiagnostic + ": " + diagnostics, Iterables.any(actualDiagnostics, Predicates.contains(expectedDiagnostic.getValue()))); } </DeepExtract> }
SimpleWeibo
positive
441,061
public static Type[] getGenericInterfaces(Class<?> clz) { if (!Types.isIgnorable(clz)) { CoverageMonitor.t(clz); } return clz.getGenericInterfaces(); }
public static Type[] getGenericInterfaces(Class<?> clz) { <DeepExtract> if (!Types.isIgnorable(clz)) { CoverageMonitor.t(clz); } </DeepExtract> return clz.getGenericInterfaces(); }
ekstazi
positive
441,064
@Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.special); setTitle("Special keys"); ctlKey = (CheckBox) findViewById(R.id.Ctl); altKey = (CheckBox) findViewById(R.id.Alt); shiftKey = (CheckBox) findViewById(R.id.Shilft); characterSpinner = ((Spinner) findViewById(R.id.characters)); specialSpinner = ((Spinner) findViewById(R.id.Special)); functionSpinner = ((Spinner) findViewById(R.id.Function)); Combination = (TextView) findViewById(R.id.combination); sendButton = ((Button) findViewById(R.id.send)); sendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(altKey.isChecked(), ctlKey.isChecked(), shiftKey.isChecked(), scanCode); dismiss(); } }); ArrayAdapter<String> charAdapter = new ArrayAdapter<String>(getOwnerActivity(), android.R.layout.simple_spinner_item); characterSpinner.setAdapter(charAdapter); for (int i = 0; i < 26; i++) charAdapter.add(CharacterKeys[i]); ArrayAdapter<String> specialAdapter = new ArrayAdapter<String>(getOwnerActivity(), android.R.layout.simple_spinner_item); specialSpinner.setAdapter(specialAdapter); for (int i = 0; i < SpecialKeys.length; i++) specialAdapter.add(SpecialKeys[i]); ArrayAdapter<String> functionAdapter = new ArrayAdapter<String>(getOwnerActivity(), android.R.layout.simple_spinner_item); functionSpinner.setAdapter(functionAdapter); for (int i = 0; i < 12; i++) functionAdapter.add(FunctionKeys[i]); characterSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String text = ""; Combination.setText(""); if (shiftKey.isChecked()) text += "Shift + "; if (altKey.isChecked()) text += "Alt + "; if (ctlKey.isChecked()) text += "Ctl + "; text += CharacterKeys[arg2]; scanCode = CharScanCode[arg2]; Combination.setText(text); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); specialSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String text = ""; Combination.setText(""); if (shiftKey.isChecked()) text += "Shift + "; if (altKey.isChecked()) text += "Alt + "; if (ctlKey.isChecked()) text += "Ctl + "; text += SpecialKeys[arg2]; scanCode = SpecialScanCode[arg2]; Combination.setText(text); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); functionSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String text = ""; Combination.setText(""); if (shiftKey.isChecked()) text += "Shift + "; if (altKey.isChecked()) text += "Alt + "; if (ctlKey.isChecked()) text += "Ctl + "; text += FunctionKeys[arg2]; scanCode = FunctionScanCode[arg2]; Combination.setText(text); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); ((Button) findViewById(R.id.ctlc)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x2e); dismiss(); } }); ((Button) findViewById(R.id.ctlx)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x2d); dismiss(); } }); ((Button) findViewById(R.id.ctlv)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x2f); dismiss(); } }); ((Button) findViewById(R.id.ctls)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x1f); dismiss(); } }); ((Button) findViewById(R.id.ctlz)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x2c); dismiss(); } }); ((Button) findViewById(R.id.alt_ctl_del)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(true, true, false, 0xd3); dismiss(); } }); ((Button) findViewById(R.id.altf4)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(true, false, false, 0x3e); dismiss(); } }); ((Button) findViewById(R.id.shift_del)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, false, true, 0xd3); dismiss(); } }); super.onCreate(savedInstanceState); }
@Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.special); setTitle("Special keys"); ctlKey = (CheckBox) findViewById(R.id.Ctl); altKey = (CheckBox) findViewById(R.id.Alt); shiftKey = (CheckBox) findViewById(R.id.Shilft); characterSpinner = ((Spinner) findViewById(R.id.characters)); specialSpinner = ((Spinner) findViewById(R.id.Special)); functionSpinner = ((Spinner) findViewById(R.id.Function)); Combination = (TextView) findViewById(R.id.combination); sendButton = ((Button) findViewById(R.id.send)); sendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(altKey.isChecked(), ctlKey.isChecked(), shiftKey.isChecked(), scanCode); dismiss(); } }); ArrayAdapter<String> charAdapter = new ArrayAdapter<String>(getOwnerActivity(), android.R.layout.simple_spinner_item); characterSpinner.setAdapter(charAdapter); for (int i = 0; i < 26; i++) charAdapter.add(CharacterKeys[i]); ArrayAdapter<String> specialAdapter = new ArrayAdapter<String>(getOwnerActivity(), android.R.layout.simple_spinner_item); specialSpinner.setAdapter(specialAdapter); for (int i = 0; i < SpecialKeys.length; i++) specialAdapter.add(SpecialKeys[i]); ArrayAdapter<String> functionAdapter = new ArrayAdapter<String>(getOwnerActivity(), android.R.layout.simple_spinner_item); functionSpinner.setAdapter(functionAdapter); <DeepExtract> for (int i = 0; i < 12; i++) functionAdapter.add(FunctionKeys[i]); </DeepExtract> characterSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String text = ""; Combination.setText(""); if (shiftKey.isChecked()) text += "Shift + "; if (altKey.isChecked()) text += "Alt + "; if (ctlKey.isChecked()) text += "Ctl + "; text += CharacterKeys[arg2]; scanCode = CharScanCode[arg2]; Combination.setText(text); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); specialSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String text = ""; Combination.setText(""); if (shiftKey.isChecked()) text += "Shift + "; if (altKey.isChecked()) text += "Alt + "; if (ctlKey.isChecked()) text += "Ctl + "; text += SpecialKeys[arg2]; scanCode = SpecialScanCode[arg2]; Combination.setText(text); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); functionSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { String text = ""; Combination.setText(""); if (shiftKey.isChecked()) text += "Shift + "; if (altKey.isChecked()) text += "Alt + "; if (ctlKey.isChecked()) text += "Ctl + "; text += FunctionKeys[arg2]; scanCode = FunctionScanCode[arg2]; Combination.setText(text); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); ((Button) findViewById(R.id.ctlc)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x2e); dismiss(); } }); ((Button) findViewById(R.id.ctlx)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x2d); dismiss(); } }); ((Button) findViewById(R.id.ctlv)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x2f); dismiss(); } }); ((Button) findViewById(R.id.ctls)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x1f); dismiss(); } }); ((Button) findViewById(R.id.ctlz)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, true, false, 0x2c); dismiss(); } }); ((Button) findViewById(R.id.alt_ctl_del)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(true, true, false, 0xd3); dismiss(); } }); ((Button) findViewById(R.id.altf4)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(true, false, false, 0x3e); dismiss(); } }); ((Button) findViewById(R.id.shift_del)).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Common.inputHandler.sendKeyCombinations(false, false, true, 0xd3); dismiss(); } }); super.onCreate(savedInstanceState); }
omnidesk
positive
441,066
@Override public void mousePressed(MouseEvent e) { if (connection.mode == ConnectionTelemetry.Mode.DEMO) return; int datasetNumber = dataStructureTable.getSelectedRow() - datasets.syncWordByteCount; if (datasetNumber < 0) { boolean remove = JOptionPane.showConfirmDialog(DataStructureBinaryView.this, "Remove the sync word?", "Remove the Sync Word?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; if (remove) { byte oldValue = datasets.syncWord; datasets.removeSyncWord(); int offset = datasets.getFirstAvailableLocation(); offsetTextfield.setText(offset == -1 ? " - " : Integer.toString(offset)); if (offset == 0) { processorCombobox.setSelectedIndex(0); nameTextfield.setText(String.format("0x%02X", oldValue)); } } } else if (datasetNumber < connection.datasets.getCount()) { Dataset dataset = connection.datasets.getByIndex(datasetNumber); String title = "Remove " + dataset.name + "?"; String message = "<html>Remove the " + dataset.name + " dataset?"; if (connection.getSampleCount() > 0) message += "<br>WARNING: This will also remove all acquired samples from EVERY dataset!</html>"; boolean remove = JOptionPane.showConfirmDialog(DataStructureBinaryView.this, message, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; if (remove) { offsetTextfield.setText(Integer.toString(dataset.location)); for (ActionListener al : processorCombobox.getActionListeners()) processorCombobox.removeActionListener(al); for (int i = 0; i < processorCombobox.getItemCount(); i++) if (processorCombobox.getItemAt(i).toString().equals(dataset.processor.toString())) processorCombobox.setSelectedIndex(i); processorCombobox.addActionListener(event -> updateGui(true)); nameTextfield.setText(dataset.name); colorButton.setForeground(dataset.color); unitTextfield.setText(dataset.unit); unitLabel.setText(dataset.unit); conversionFactorAtextfield.setText(Float.toString(dataset.conversionFactorA)); conversionFactorBtextfield.setText(Float.toString(dataset.conversionFactorB)); connection.datasets.removeAllData(); connection.datasets.remove(dataset.location); } } else { String title = "Remove checksum?"; String message = "<html>Remove the " + connection.datasets.getChecksumProcessor() + "?"; if (connection.getSampleCount() > 0) message += "<br>WARNING: This will also remove all acquired samples from EVERY dataset!</html>"; boolean remove = JOptionPane.showConfirmDialog(DataStructureBinaryView.this, message, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; if (remove) { offsetTextfield.setText(Integer.toString(connection.datasets.getChecksumProcessorOffset())); processorCombobox.setSelectedItem(connection.datasets.getChecksumProcessor()); connection.datasets.removeAllData(); connection.datasets.removeChecksum(); } } dataStructureTable.clearSelection(); if (connection.mode == ConnectionTelemetry.Mode.DEMO) { dsdLabel.setText("Data Structure Definition: (Not Editable in Demo Mode)"); offsetTextfield.setEnabled(false); processorCombobox.setEnabled(false); nameLabel.setText("Name"); nameTextfield.setEnabled(false); colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(false); doneButton.setEnabled(true); SwingUtilities.invokeLater(() -> { doneButton.requestFocus(); }); } else if (bitfieldDefinitionInProgress) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(false); processorCombobox.setEnabled(false); nameLabel.setText("Name"); nameTextfield.setEnabled(false); colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(false); doneButton.setEnabled(false); unitTextfield.setText(""); unitLabel.setText(""); conversionFactorAtextfield.setText("1.0"); conversionFactorBtextfield.setText("1.0"); } else if (datasets.getFirstAvailableLocation() == -1) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(false); processorCombobox.setEnabled(false); nameLabel.setText("Name"); nameTextfield.setEnabled(false); colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(false); doneButton.setEnabled(true); SwingUtilities.invokeLater(() -> { doneButton.requestFocus(); }); } else if (processorCombobox.getSelectedItem().toString().endsWith("Bitfield")) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(true); processorCombobox.setEnabled(true); nameLabel.setText("Name"); nameTextfield.setEnabled(true); colorButton.setEnabled(true); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(true); doneButton.setEnabled(true); unitTextfield.setText(""); unitLabel.setText(""); conversionFactorAtextfield.setText("1.0"); conversionFactorBtextfield.setText("1.0"); if (false) { int offset = datasets.getFirstAvailableLocation(); offsetTextfield.setText(offset == -1 ? " - " : Integer.toString(offset)); } SwingUtilities.invokeLater(() -> { nameTextfield.requestFocus(); nameTextfield.selectAll(); }); } else if (processorCombobox.getSelectedItem() instanceof String) { if (datasets.getFirstAvailableLocation() != 0) { processorCombobox.setSelectedIndex(1); updateGui(false); return; } dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(false); offsetTextfield.setText("0"); processorCombobox.setEnabled(true); nameLabel.setText("Value"); nameTextfield.setEnabled(true); try { String text = nameTextfield.getText(); int number = text.toLowerCase().startsWith("0x") ? Integer.parseInt(text.substring(2), 16) : Integer.parseInt(text); if (number < 0 || number > 255) throw new Exception(); text = String.format("0x%02X", number); nameTextfield.setText(text); } catch (Exception e2) { nameTextfield.setText("0xAA"); } colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(true); doneButton.setEnabled(true); SwingUtilities.invokeLater(() -> { nameTextfield.requestFocus(); nameTextfield.selectAll(); }); } else if (processorCombobox.getSelectedItem() instanceof DatasetsController.BinaryFieldProcessor) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(true); processorCombobox.setEnabled(true); nameLabel.setText("Name"); nameTextfield.setEnabled(true); colorButton.setEnabled(true); unitTextfield.setEnabled(true); conversionFactorAtextfield.setEnabled(true); conversionFactorBtextfield.setEnabled(true); addButton.setEnabled(true); doneButton.setEnabled(true); if (false) { int offset = datasets.getFirstAvailableLocation(); offsetTextfield.setText(offset == -1 ? " - " : Integer.toString(offset)); if (processorCombobox.getSelectedItem().toString().endsWith("Bitfield") || processorCombobox.getSelectedItem() instanceof DatasetsController.BinaryChecksumProcessor) processorCombobox.setSelectedIndex(0); } SwingUtilities.invokeLater(() -> { nameTextfield.requestFocus(); nameTextfield.selectAll(); }); } else if (processorCombobox.getSelectedItem() instanceof DatasetsController.BinaryChecksumProcessor) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(true); processorCombobox.setEnabled(true); nameLabel.setText("Name"); nameTextfield.setEnabled(false); colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(true); doneButton.setEnabled(true); nameTextfield.setText(""); unitTextfield.setText(""); unitLabel.setText(""); conversionFactorAtextfield.setText("1.0"); conversionFactorBtextfield.setText("1.0"); SwingUtilities.invokeLater(() -> { nameTextfield.requestFocus(); nameTextfield.selectAll(); }); } dataStructureTable.revalidate(); dataStructureTable.repaint(); updateExampleCode(); revalidate(); repaint(); }
@Override public void mousePressed(MouseEvent e) { if (connection.mode == ConnectionTelemetry.Mode.DEMO) return; int datasetNumber = dataStructureTable.getSelectedRow() - datasets.syncWordByteCount; if (datasetNumber < 0) { boolean remove = JOptionPane.showConfirmDialog(DataStructureBinaryView.this, "Remove the sync word?", "Remove the Sync Word?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; if (remove) { byte oldValue = datasets.syncWord; datasets.removeSyncWord(); int offset = datasets.getFirstAvailableLocation(); offsetTextfield.setText(offset == -1 ? " - " : Integer.toString(offset)); if (offset == 0) { processorCombobox.setSelectedIndex(0); nameTextfield.setText(String.format("0x%02X", oldValue)); } } } else if (datasetNumber < connection.datasets.getCount()) { Dataset dataset = connection.datasets.getByIndex(datasetNumber); String title = "Remove " + dataset.name + "?"; String message = "<html>Remove the " + dataset.name + " dataset?"; if (connection.getSampleCount() > 0) message += "<br>WARNING: This will also remove all acquired samples from EVERY dataset!</html>"; boolean remove = JOptionPane.showConfirmDialog(DataStructureBinaryView.this, message, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; if (remove) { offsetTextfield.setText(Integer.toString(dataset.location)); for (ActionListener al : processorCombobox.getActionListeners()) processorCombobox.removeActionListener(al); for (int i = 0; i < processorCombobox.getItemCount(); i++) if (processorCombobox.getItemAt(i).toString().equals(dataset.processor.toString())) processorCombobox.setSelectedIndex(i); processorCombobox.addActionListener(event -> updateGui(true)); nameTextfield.setText(dataset.name); colorButton.setForeground(dataset.color); unitTextfield.setText(dataset.unit); unitLabel.setText(dataset.unit); conversionFactorAtextfield.setText(Float.toString(dataset.conversionFactorA)); conversionFactorBtextfield.setText(Float.toString(dataset.conversionFactorB)); connection.datasets.removeAllData(); connection.datasets.remove(dataset.location); } } else { String title = "Remove checksum?"; String message = "<html>Remove the " + connection.datasets.getChecksumProcessor() + "?"; if (connection.getSampleCount() > 0) message += "<br>WARNING: This will also remove all acquired samples from EVERY dataset!</html>"; boolean remove = JOptionPane.showConfirmDialog(DataStructureBinaryView.this, message, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; if (remove) { offsetTextfield.setText(Integer.toString(connection.datasets.getChecksumProcessorOffset())); processorCombobox.setSelectedItem(connection.datasets.getChecksumProcessor()); connection.datasets.removeAllData(); connection.datasets.removeChecksum(); } } dataStructureTable.clearSelection(); <DeepExtract> if (connection.mode == ConnectionTelemetry.Mode.DEMO) { dsdLabel.setText("Data Structure Definition: (Not Editable in Demo Mode)"); offsetTextfield.setEnabled(false); processorCombobox.setEnabled(false); nameLabel.setText("Name"); nameTextfield.setEnabled(false); colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(false); doneButton.setEnabled(true); SwingUtilities.invokeLater(() -> { doneButton.requestFocus(); }); } else if (bitfieldDefinitionInProgress) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(false); processorCombobox.setEnabled(false); nameLabel.setText("Name"); nameTextfield.setEnabled(false); colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(false); doneButton.setEnabled(false); unitTextfield.setText(""); unitLabel.setText(""); conversionFactorAtextfield.setText("1.0"); conversionFactorBtextfield.setText("1.0"); } else if (datasets.getFirstAvailableLocation() == -1) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(false); processorCombobox.setEnabled(false); nameLabel.setText("Name"); nameTextfield.setEnabled(false); colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(false); doneButton.setEnabled(true); SwingUtilities.invokeLater(() -> { doneButton.requestFocus(); }); } else if (processorCombobox.getSelectedItem().toString().endsWith("Bitfield")) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(true); processorCombobox.setEnabled(true); nameLabel.setText("Name"); nameTextfield.setEnabled(true); colorButton.setEnabled(true); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(true); doneButton.setEnabled(true); unitTextfield.setText(""); unitLabel.setText(""); conversionFactorAtextfield.setText("1.0"); conversionFactorBtextfield.setText("1.0"); if (false) { int offset = datasets.getFirstAvailableLocation(); offsetTextfield.setText(offset == -1 ? " - " : Integer.toString(offset)); } SwingUtilities.invokeLater(() -> { nameTextfield.requestFocus(); nameTextfield.selectAll(); }); } else if (processorCombobox.getSelectedItem() instanceof String) { if (datasets.getFirstAvailableLocation() != 0) { processorCombobox.setSelectedIndex(1); updateGui(false); return; } dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(false); offsetTextfield.setText("0"); processorCombobox.setEnabled(true); nameLabel.setText("Value"); nameTextfield.setEnabled(true); try { String text = nameTextfield.getText(); int number = text.toLowerCase().startsWith("0x") ? Integer.parseInt(text.substring(2), 16) : Integer.parseInt(text); if (number < 0 || number > 255) throw new Exception(); text = String.format("0x%02X", number); nameTextfield.setText(text); } catch (Exception e2) { nameTextfield.setText("0xAA"); } colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(true); doneButton.setEnabled(true); SwingUtilities.invokeLater(() -> { nameTextfield.requestFocus(); nameTextfield.selectAll(); }); } else if (processorCombobox.getSelectedItem() instanceof DatasetsController.BinaryFieldProcessor) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(true); processorCombobox.setEnabled(true); nameLabel.setText("Name"); nameTextfield.setEnabled(true); colorButton.setEnabled(true); unitTextfield.setEnabled(true); conversionFactorAtextfield.setEnabled(true); conversionFactorBtextfield.setEnabled(true); addButton.setEnabled(true); doneButton.setEnabled(true); if (false) { int offset = datasets.getFirstAvailableLocation(); offsetTextfield.setText(offset == -1 ? " - " : Integer.toString(offset)); if (processorCombobox.getSelectedItem().toString().endsWith("Bitfield") || processorCombobox.getSelectedItem() instanceof DatasetsController.BinaryChecksumProcessor) processorCombobox.setSelectedIndex(0); } SwingUtilities.invokeLater(() -> { nameTextfield.requestFocus(); nameTextfield.selectAll(); }); } else if (processorCombobox.getSelectedItem() instanceof DatasetsController.BinaryChecksumProcessor) { dsdLabel.setText("Data Structure Definition:"); offsetTextfield.setEnabled(true); processorCombobox.setEnabled(true); nameLabel.setText("Name"); nameTextfield.setEnabled(false); colorButton.setEnabled(false); unitTextfield.setEnabled(false); conversionFactorAtextfield.setEnabled(false); conversionFactorBtextfield.setEnabled(false); addButton.setEnabled(true); doneButton.setEnabled(true); nameTextfield.setText(""); unitTextfield.setText(""); unitLabel.setText(""); conversionFactorAtextfield.setText("1.0"); conversionFactorBtextfield.setText("1.0"); SwingUtilities.invokeLater(() -> { nameTextfield.requestFocus(); nameTextfield.selectAll(); }); } dataStructureTable.revalidate(); dataStructureTable.repaint(); updateExampleCode(); revalidate(); repaint(); </DeepExtract> }
TelemetryViewer
positive
441,068
public Builder<BT> withFilter(String key, String... values) { paramBuilder.put(format("filter[%s]", key), Arrays.asList(values)); return this; }
public Builder<BT> withFilter(String key, String... values) { <DeepExtract> paramBuilder.put(format("filter[%s]", key), Arrays.asList(values)); return this; </DeepExtract> }
wp-api-v2-client-java
positive
441,069
public Criteria andCreatorLessThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "creator" + " cannot be null"); } criteria.add(new Criterion("creator <", value)); return (Criteria) this; }
public Criteria andCreatorLessThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "creator" + " cannot be null"); } criteria.add(new Criterion("creator <", value)); </DeepExtract> return (Criteria) this; }
dtsopensource
positive
441,070
@Test public void linsert() throws Exception { String key = keyPrefix + "_LINSERT"; conn.createStatement().execute("RPUSH " + key + " a c"); assertEquals(3, executeSingleIntegerResult("LINSERT " + key + " BEFORE c a")); execute("DEL " + key); }
@Test public void linsert() throws Exception { String key = keyPrefix + "_LINSERT"; conn.createStatement().execute("RPUSH " + key + " a c"); assertEquals(3, executeSingleIntegerResult("LINSERT " + key + " BEFORE c a")); <DeepExtract> execute("DEL " + key); </DeepExtract> }
jdbc-redis
positive
441,071
public void onUploadSuccess(String objectName, Path tempFileAbsolutePath) { log.info("upload success: {}", objectName); Path path = getTempFileCache(objectName); if (path != null) { tempFileCache.invalidate(objectName); try { Files.delete(path); } catch (IOException e) { log.warn(e.getMessage(), e); } } String objectParentName = getObjectParentName(objectName); Set<String> fileNameList = getTempFileListCache(objectParentName); if (fileNameList != null) { String objectFileName = Paths.get(objectName).getFileName().toString(); if (fileNameList.contains(objectFileName)) { fileNameList.remove(objectFileName); setTempFileListCache(objectParentName, fileNameList); } if (fileNameList.isEmpty()) { tempFileListCache.invalidate(objectParentName); } } if (objectName.length() > 1 && objectName.endsWith("/")) { objectName = objectName.substring(0, objectName.length() - 1); } fileInfoCache.put(objectName, newFileInfo(objectName, tempFileAbsolutePath.toFile())); Path objectNamePath = Paths.get(objectName); if (objectNamePath.getNameCount() > 1) { String pathObjectName = objectNamePath.getParent().toString() + MyWebdavServlet.PATH_DELIMITER; fileInfoListCache.invalidate(pathObjectName); for (String key : fileInfoListCache.asMap().keySet()) { if (key.startsWith(objectName)) { fileInfoListCache.invalidate(key); } } } else { fileInfoListCache.invalidate(objectName); fileInfoListCache.invalidate(""); } waitingUploadCache.invalidate(objectName); }
public void onUploadSuccess(String objectName, Path tempFileAbsolutePath) { log.info("upload success: {}", objectName); Path path = getTempFileCache(objectName); if (path != null) { tempFileCache.invalidate(objectName); try { Files.delete(path); } catch (IOException e) { log.warn(e.getMessage(), e); } } String objectParentName = getObjectParentName(objectName); Set<String> fileNameList = getTempFileListCache(objectParentName); if (fileNameList != null) { String objectFileName = Paths.get(objectName).getFileName().toString(); if (fileNameList.contains(objectFileName)) { fileNameList.remove(objectFileName); setTempFileListCache(objectParentName, fileNameList); } if (fileNameList.isEmpty()) { tempFileListCache.invalidate(objectParentName); } } if (objectName.length() > 1 && objectName.endsWith("/")) { objectName = objectName.substring(0, objectName.length() - 1); } fileInfoCache.put(objectName, newFileInfo(objectName, tempFileAbsolutePath.toFile())); Path objectNamePath = Paths.get(objectName); if (objectNamePath.getNameCount() > 1) { String pathObjectName = objectNamePath.getParent().toString() + MyWebdavServlet.PATH_DELIMITER; fileInfoListCache.invalidate(pathObjectName); for (String key : fileInfoListCache.asMap().keySet()) { if (key.startsWith(objectName)) { fileInfoListCache.invalidate(key); } } } else { fileInfoListCache.invalidate(objectName); fileInfoListCache.invalidate(""); } <DeepExtract> waitingUploadCache.invalidate(objectName); </DeepExtract> }
jmal-cloud-server
positive
441,073
public static void enqueuePushAlert(String alertMessage, String[] deviceTokens) { if (alertMessage == null) { throw new IllegalArgumentException("alertMessage cannot be null"); } if (deviceTokens == null) { throw new IllegalArgumentException("deviceTokens cannot be null"); } Queue notificationQueue = QueueFactory.getQueue("notification-delivery"); notificationQueue.add(TaskOptions.Builder.withMethod(TaskOptions.Method.PULL).param("alert", alertMessage).param("devices", new Gson().toJson(deviceTokens))); }
public static void enqueuePushAlert(String alertMessage, String[] deviceTokens) { if (alertMessage == null) { throw new IllegalArgumentException("alertMessage cannot be null"); } if (deviceTokens == null) { throw new IllegalArgumentException("deviceTokens cannot be null"); } <DeepExtract> Queue notificationQueue = QueueFactory.getQueue("notification-delivery"); notificationQueue.add(TaskOptions.Builder.withMethod(TaskOptions.Method.PULL).param("alert", alertMessage).param("devices", new Gson().toJson(deviceTokens))); </DeepExtract> }
io2014-codelabs
positive
441,074
@Nullable private String isSolution(String candidate) { List<String> solutions; if (order == AB_MODE.A) solutions = cVocable.getAMeanings(); else solutions = cVocable.getBMeanings(); if (settings.trimSpaces) candidate = candidate.trim(); for (String solution : solutions) { if (settings.trimSpaces) solution = solution.trim(); if (this.settings.caseSensitive && solution.equalsIgnoreCase(candidate)) return solution; else if (solution.equals(candidate)) return solution; } return null; }
@Nullable private String isSolution(String candidate) { <DeepExtract> List<String> solutions; if (order == AB_MODE.A) solutions = cVocable.getAMeanings(); else solutions = cVocable.getBMeanings(); </DeepExtract> if (settings.trimSpaces) candidate = candidate.trim(); for (String solution : solutions) { if (settings.trimSpaces) solution = solution.trim(); if (this.settings.caseSensitive && solution.equalsIgnoreCase(candidate)) return solution; else if (solution.equals(candidate)) return solution; } return null; }
VocableTrainer-Android
positive
441,075
public static void writeJavaScript(HttpServletResponse response, String content) { try { response.setCharacterEncoding("utf-8"); response.setContentType("text/html"); response.getWriter().print(String.format("<script type=\"text/javascript\">%s</script>", content)); } catch (Exception e) { log.info("输出错误:", e); } }
public static void writeJavaScript(HttpServletResponse response, String content) { <DeepExtract> try { response.setCharacterEncoding("utf-8"); response.setContentType("text/html"); response.getWriter().print(String.format("<script type=\"text/javascript\">%s</script>", content)); } catch (Exception e) { log.info("输出错误:", e); } </DeepExtract> }
howsun-javaee-framework
positive
441,076
@Test public void shouldIgnoreIncompleteMpegFrame() throws Exception { Mp3File mp3File = new Mp3File(MP3_WITH_INCOMPLETE_MPEG_FRAME, 256); assertEquals(0x44B, mp3File.getXingOffset()); assertEquals(0x5EC, mp3File.getStartOffset()); assertEquals(0xF17, mp3File.getEndOffset()); assertTrue(mp3File.hasId3v1Tag()); assertTrue(mp3File.hasId3v2Tag()); assertEquals(5, mp3File.getFrameCount()); }
@Test public void shouldIgnoreIncompleteMpegFrame() throws Exception { Mp3File mp3File = new Mp3File(MP3_WITH_INCOMPLETE_MPEG_FRAME, 256); <DeepExtract> assertEquals(0x44B, mp3File.getXingOffset()); assertEquals(0x5EC, mp3File.getStartOffset()); assertEquals(0xF17, mp3File.getEndOffset()); assertTrue(mp3File.hasId3v1Tag()); assertTrue(mp3File.hasId3v2Tag()); assertEquals(5, mp3File.getFrameCount()); </DeepExtract> }
mp3agic
positive
441,077
protected void refreshFromDrawerAction(String state, String title) { this.title = title.split("\\Q(\\E")[0].trim(); if (currentCategory != null && currentCategory != "") { getSupportActionBar().setTitle(title.split("\\Q(\\E")[0].trim() + " (" + currentCategory + ")"); } else { getSupportActionBar().setTitle(title.split("\\Q(\\E")[0].trim()); } if (!hostname.equals("")) { listViewRefreshing = true; if (AboutFragment.mSwipeRefreshLayout != null) { AboutFragment.mSwipeRefreshLayout.setRefreshing(true); } if (com.lgallardo.qbittorrentclient.ItemstFragment.mSwipeRefreshLayout != null) { com.lgallardo.qbittorrentclient.ItemstFragment.mSwipeRefreshLayout.setRefreshing(true); com.lgallardo.qbittorrentclient.ItemstFragment.mSwipeRefreshLayout.setEnabled(false); } if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.mSwipeRefreshLayout != null) { com.lgallardo.qbittorrentclient.TorrentDetailsFragment.mSwipeRefreshLayout.setRefreshing(true); } } if (firstFragment != null && firstFragment.mActionMode != null) { return; } getCookie(); ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected() && !networkInfo.isFailover()) { if (CustomLogger.isMainActivityReporting()) { generateSettingsReport(); } if (hostname.equals("")) { qBittorrentNoSettingsFoundDialog(R.string.info, R.string.about_help1); } else { if (qb_version.equals("3.2.x") && (cookie == null || cookie.equals(""))) { if (connection403ErrorCounter > 1) { toastText(R.string.error403); httpStatusCode = 0; disableRefreshSwipeLayout(); } else { getCookie(); } } else { if (connection403ErrorCounter > 1) { if (cookie != null && !cookie.equals("")) { toastText(R.string.error403); cookie = null; } httpStatusCode = 0; disableRefreshSwipeLayout(); } else { getTorrentList(state, currentCategory); } } } } else { toastText(R.string.connection_error); disableRefreshSwipeLayout(); } currentState = state; savePreferenceAsString("lastState", state); }
protected void refreshFromDrawerAction(String state, String title) { this.title = title.split("\\Q(\\E")[0].trim(); if (currentCategory != null && currentCategory != "") { getSupportActionBar().setTitle(title.split("\\Q(\\E")[0].trim() + " (" + currentCategory + ")"); } else { getSupportActionBar().setTitle(title.split("\\Q(\\E")[0].trim()); } if (!hostname.equals("")) { listViewRefreshing = true; if (AboutFragment.mSwipeRefreshLayout != null) { AboutFragment.mSwipeRefreshLayout.setRefreshing(true); } if (com.lgallardo.qbittorrentclient.ItemstFragment.mSwipeRefreshLayout != null) { com.lgallardo.qbittorrentclient.ItemstFragment.mSwipeRefreshLayout.setRefreshing(true); com.lgallardo.qbittorrentclient.ItemstFragment.mSwipeRefreshLayout.setEnabled(false); } if (com.lgallardo.qbittorrentclient.TorrentDetailsFragment.mSwipeRefreshLayout != null) { com.lgallardo.qbittorrentclient.TorrentDetailsFragment.mSwipeRefreshLayout.setRefreshing(true); } } if (firstFragment != null && firstFragment.mActionMode != null) { return; } getCookie(); ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected() && !networkInfo.isFailover()) { if (CustomLogger.isMainActivityReporting()) { generateSettingsReport(); } if (hostname.equals("")) { qBittorrentNoSettingsFoundDialog(R.string.info, R.string.about_help1); } else { if (qb_version.equals("3.2.x") && (cookie == null || cookie.equals(""))) { if (connection403ErrorCounter > 1) { toastText(R.string.error403); httpStatusCode = 0; disableRefreshSwipeLayout(); } else { getCookie(); } } else { if (connection403ErrorCounter > 1) { if (cookie != null && !cookie.equals("")) { toastText(R.string.error403); cookie = null; } httpStatusCode = 0; disableRefreshSwipeLayout(); } else { getTorrentList(state, currentCategory); } } } } else { toastText(R.string.connection_error); disableRefreshSwipeLayout(); } <DeepExtract> currentState = state; savePreferenceAsString("lastState", state); </DeepExtract> }
qBittorrent-Controller
positive
441,078
@Override public void setCurrentDaySelectedIconRes(int currentDaySelectedIconRes) { settingsManager.setCurrentDaySelectedIconRes(currentDaySelectedIconRes); if (monthAdapter != null) { monthAdapter.notifyDataSetChanged(); rvMonths.scrollToPosition(lastVisibleMonthPosition); multipleSelectionBarAdapter.notifyDataSetChanged(); } }
@Override public void setCurrentDaySelectedIconRes(int currentDaySelectedIconRes) { settingsManager.setCurrentDaySelectedIconRes(currentDaySelectedIconRes); <DeepExtract> if (monthAdapter != null) { monthAdapter.notifyDataSetChanged(); rvMonths.scrollToPosition(lastVisibleMonthPosition); multipleSelectionBarAdapter.notifyDataSetChanged(); } </DeepExtract> }
CosmoCalendar
positive
441,079
public boolean isWildcardPortDst() { return isBitsSet(Wildcard.OFPFW_TP_DST.bitfield); }
public boolean isWildcardPortDst() { <DeepExtract> return isBitsSet(Wildcard.OFPFW_TP_DST.bitfield); </DeepExtract> }
envi
positive
441,080
@Override public int apply(int color) { float[] hsb = Color.RGBtoHSB((color >> 16) & 255, (color >> 8) & 255, color & 255, null); int idx; switch(this) { case HUE: idx = 0; case SATURATION: idx = 1; default: idx = 2; } hsb[idx] = level * value + (1 - level) * hsb[idx]; return Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]); }
@Override public int apply(int color) { float[] hsb = Color.RGBtoHSB((color >> 16) & 255, (color >> 8) & 255, color & 255, null); <DeepExtract> int idx; switch(this) { case HUE: idx = 0; case SATURATION: idx = 1; default: idx = 2; } </DeepExtract> hsb[idx] = level * value + (1 - level) * hsb[idx]; return Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]); }
GIFKR
positive
441,081
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); Sun = new DirectionalLight(); Sun.setDirection(SunVec); float Z = SunVec.z; if (Z > 0) { Sun.setColor(Suncolor.mult(0.0f)); } else { Sun.setColor(Suncolor.mult((0.6f) * (Z * -1))); } }
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); Sun = new DirectionalLight(); <DeepExtract> Sun.setDirection(SunVec); float Z = SunVec.z; if (Z > 0) { Sun.setColor(Suncolor.mult(0.0f)); } else { Sun.setColor(Suncolor.mult((0.6f) * (Z * -1))); } </DeepExtract> }
Khazad
positive
441,083
public void oneway(final ConnectionURL connectionURL, final Object request, final InvokeContext invokeContext) throws RemotingException, InterruptedException { if (!this.switches().isOn(GlobalSwitch.SERVER_MANAGE_CONNECTION_SWITCH)) { throw new UnsupportedOperationException("Please enable connection manage feature of RPC Server before call this method! See comments in constructor RGPDefaultRemoteServer(int port, boolean manageConnection) to find how to enable!"); } this.remoting.oneway(connectionURL, request, invokeContext); }
public void oneway(final ConnectionURL connectionURL, final Object request, final InvokeContext invokeContext) throws RemotingException, InterruptedException { <DeepExtract> if (!this.switches().isOn(GlobalSwitch.SERVER_MANAGE_CONNECTION_SWITCH)) { throw new UnsupportedOperationException("Please enable connection manage feature of RPC Server before call this method! See comments in constructor RGPDefaultRemoteServer(int port, boolean manageConnection) to find how to enable!"); } </DeepExtract> this.remoting.oneway(connectionURL, request, invokeContext); }
RGP-NETTY
positive
441,084
@ParameterizedTest @ValueSource(ints = { 0, 2 }) void sendWithoutCompression(int failures) throws IOException { AwsS3Sender.Config config = new AwsS3Sender.Config(); config.setCompressionEnabled(false); S3Client s3Client = mock(S3Client.class); S3ClientBuilder s3ClientBuilder = mock(S3ClientBuilder.class); doReturn(s3Client).when(s3ClientBuilder).build(); AtomicInteger retryCount = new AtomicInteger(); doAnswer(invocation -> { PutObjectRequest request = invocation.getArgument(0); assertEquals("hello.world", request.bucket()); assertEquals("2345/01/31/23/59-59-99999.data", request.key()); RequestBody body = invocation.getArgument(1); try (InputStream s3In = body.contentStreamProvider().newStream(); InputStream in = false ? new GZIPInputStream(s3In) : s3In) { byte[] content = ByteStreams.toByteArray(in); assertEquals("0123456789", new String(content, StandardCharsets.UTF_8)); } if (retryCount.getAndIncrement() < failures) { throw new RuntimeException("Something happened"); } return null; }).when(s3Client).putObject(any(PutObjectRequest.class), any(RequestBody.class)); AwsS3Sender sender = new AwsS3Sender(s3ClientBuilder, config); sender.send("hello.world", "2345/01/31/23/59-59-99999.data", ByteBuffer.wrap("0123456789".getBytes(StandardCharsets.UTF_8))); verify(s3Client, times(failures + 1)).putObject(any(PutObjectRequest.class), any(RequestBody.class)); sender.close(); }
@ParameterizedTest @ValueSource(ints = { 0, 2 }) void sendWithoutCompression(int failures) throws IOException { AwsS3Sender.Config config = new AwsS3Sender.Config(); config.setCompressionEnabled(false); <DeepExtract> S3Client s3Client = mock(S3Client.class); S3ClientBuilder s3ClientBuilder = mock(S3ClientBuilder.class); doReturn(s3Client).when(s3ClientBuilder).build(); AtomicInteger retryCount = new AtomicInteger(); doAnswer(invocation -> { PutObjectRequest request = invocation.getArgument(0); assertEquals("hello.world", request.bucket()); assertEquals("2345/01/31/23/59-59-99999.data", request.key()); RequestBody body = invocation.getArgument(1); try (InputStream s3In = body.contentStreamProvider().newStream(); InputStream in = false ? new GZIPInputStream(s3In) : s3In) { byte[] content = ByteStreams.toByteArray(in); assertEquals("0123456789", new String(content, StandardCharsets.UTF_8)); } if (retryCount.getAndIncrement() < failures) { throw new RuntimeException("Something happened"); } return null; }).when(s3Client).putObject(any(PutObjectRequest.class), any(RequestBody.class)); AwsS3Sender sender = new AwsS3Sender(s3ClientBuilder, config); sender.send("hello.world", "2345/01/31/23/59-59-99999.data", ByteBuffer.wrap("0123456789".getBytes(StandardCharsets.UTF_8))); verify(s3Client, times(failures + 1)).putObject(any(PutObjectRequest.class), any(RequestBody.class)); sender.close(); </DeepExtract> }
fluency
positive
441,085
public void update(Graphics rg) { Dimension d = getSize(); offScrWidth = d.width; offScrHeight = d.height; int availWidth = offScrWidth - (xBorder * 2); int availHeight = offScrHeight - (yBorder * 2); Graphics og = rg; og.setColor(Color.white); og.fillRect(0, 0, getWidth(), getHeight()); if (scores == null) { return; } int numRows = 1; while ((scores.length > (availWidth * numRows)) && (((numRows * yBorder) + (numRows * minRowHeight)) < availHeight)) { numRows++; } int rowHeight = (availHeight / numRows) - yBorder; float x = xBorder; float y = yBorder + rowHeight; float pixelsPerBar = (float) (numRows * availWidth) / (float) scores.length; int intPixelsPerBar = Math.max(1, (int) pixelsPerBar - 1); x = xBorder; y = yBorder + rowHeight; for (int i = 0; i < scores.length; i++) { og.setColor(Color.BLUE); if (scores[i] > 0) { int height = (int) ((float) rowHeight * (scores[i] / max)); og.fillRect((int) x, (int) y - height, intPixelsPerBar, height); } og.setColor(Color.BLACK); int len = 2; if (i % 5 == 0) len = 4; og.drawLine((int) x, (int) y, (int) x, (int) y + len); x += pixelsPerBar; if (x > availWidth) { x = xBorder; y += rowHeight + yBorder; } } }
public void update(Graphics rg) { <DeepExtract> Dimension d = getSize(); offScrWidth = d.width; offScrHeight = d.height; int availWidth = offScrWidth - (xBorder * 2); int availHeight = offScrHeight - (yBorder * 2); Graphics og = rg; og.setColor(Color.white); og.fillRect(0, 0, getWidth(), getHeight()); if (scores == null) { return; } int numRows = 1; while ((scores.length > (availWidth * numRows)) && (((numRows * yBorder) + (numRows * minRowHeight)) < availHeight)) { numRows++; } int rowHeight = (availHeight / numRows) - yBorder; float x = xBorder; float y = yBorder + rowHeight; float pixelsPerBar = (float) (numRows * availWidth) / (float) scores.length; int intPixelsPerBar = Math.max(1, (int) pixelsPerBar - 1); x = xBorder; y = yBorder + rowHeight; for (int i = 0; i < scores.length; i++) { og.setColor(Color.BLUE); if (scores[i] > 0) { int height = (int) ((float) rowHeight * (scores[i] / max)); og.fillRect((int) x, (int) y - height, intPixelsPerBar, height); } og.setColor(Color.BLACK); int len = 2; if (i % 5 == 0) len = 4; og.drawLine((int) x, (int) y, (int) x, (int) y + len); x += pixelsPerBar; if (x > availWidth) { x = xBorder; y += rowHeight + yBorder; } } </DeepExtract> }
luke
positive
441,086
protected void setTitleStatus() { setTitle(); if (isOutcome) { for (SortBill e : noteBean.getOutSortList()) { if (e.getSortName() == bundle.getString("sortName")) lastBean = e; } } else { for (SortBill e : noteBean.getInSortList()) { if (e.getSortName() == bundle.getString("sortName")) lastBean = e; } } return null; if (lastBean == null) lastBean = mDatas.get(0); sortTv.setText(lastBean.getSortName()); initViewPager(); }
protected void setTitleStatus() { setTitle(); <DeepExtract> if (isOutcome) { for (SortBill e : noteBean.getOutSortList()) { if (e.getSortName() == bundle.getString("sortName")) lastBean = e; } } else { for (SortBill e : noteBean.getInSortList()) { if (e.getSortName() == bundle.getString("sortName")) lastBean = e; } } return null; </DeepExtract> if (lastBean == null) lastBean = mDatas.get(0); sortTv.setText(lastBean.getSortName()); initViewPager(); }
bill
positive
441,088
public void deleteFEParameters(CombinedField combinedField) { DocState ds = new DocState(); ds.packet = packet; ds.userModel = toPOJO(userModel); undoController.beforeContentReplace(ds); userModel.deleteFEFieldInstruction(combinedField); if (getVmInstructions().isEmpty()) { userModel.clearFeParameters(); } PacketData newPkt = packetDataService.buildPacket(userModel.buildScapyModel(), userModel.getVmInstructionsModel()); this.packet = newPkt; fireUpdateViewEvent(); }
public void deleteFEParameters(CombinedField combinedField) { DocState ds = new DocState(); ds.packet = packet; ds.userModel = toPOJO(userModel); undoController.beforeContentReplace(ds); userModel.deleteFEFieldInstruction(combinedField); if (getVmInstructions().isEmpty()) { userModel.clearFeParameters(); } PacketData newPkt = packetDataService.buildPacket(userModel.buildScapyModel(), userModel.getVmInstructionsModel()); <DeepExtract> this.packet = newPkt; fireUpdateViewEvent(); </DeepExtract> }
trex-packet-editor
positive
441,089
@ExceptionHandler(value = BizException.class) public ModelAndView bizErrorHandler(HttpServletRequest request, HandlerMethod handlerMethod, Exception exception) { if (log.isDebugEnabled()) { log.debug("catch exception : ", exception); } ErrorResult errorResult = null; HttpStatus httpStatus = null; if (needResolve) { for (ExceptionResolver resolver : exceptionResolvers) { if (resolver.canResolve(exception)) { errorResult = resolver.resolve(exception); httpStatus = resolver.status(exception); break; } } } if (errorResult == null) { errorResult = ((BizException) exception).getErrorResult(); } if (httpStatus == null) { httpStatus = null; } return errorHandler.handle(request, handlerMethod, errorResult, httpStatus); }
@ExceptionHandler(value = BizException.class) public ModelAndView bizErrorHandler(HttpServletRequest request, HandlerMethod handlerMethod, Exception exception) { if (log.isDebugEnabled()) { log.debug("catch exception : ", exception); } <DeepExtract> ErrorResult errorResult = null; HttpStatus httpStatus = null; if (needResolve) { for (ExceptionResolver resolver : exceptionResolvers) { if (resolver.canResolve(exception)) { errorResult = resolver.resolve(exception); httpStatus = resolver.status(exception); break; } } } if (errorResult == null) { errorResult = ((BizException) exception).getErrorResult(); } if (httpStatus == null) { httpStatus = null; } return errorHandler.handle(request, handlerMethod, errorResult, httpStatus); </DeepExtract> }
morphling
positive
441,091
@Override public void withParameter(String name, String[] values) { if (name == null || name.trim().isEmpty()) { throw new DescriptorBuilderException("a valid parameter name is required"); } if (values == null) { throw new DescriptorBuilderException("parameter values cannot be null"); } if (parameters.containsKey(name)) { throw new DescriptorBuilderException("duplicate annotation parameter name found: " + name); } parameters.put(name, values); }
@Override public void withParameter(String name, String[] values) { <DeepExtract> if (name == null || name.trim().isEmpty()) { throw new DescriptorBuilderException("a valid parameter name is required"); } if (values == null) { throw new DescriptorBuilderException("parameter values cannot be null"); } if (parameters.containsKey(name)) { throw new DescriptorBuilderException("duplicate annotation parameter name found: " + name); } parameters.put(name, values); </DeepExtract> }
Flapi
positive
441,093
public XBitSet articulations(BitSet vertices) { articulationSet = new XBitSet(n); dfCount = 1; dfn = new int[n]; low = new int[n]; for (int v = 0; v < n; v++) { if (!vertices.get(v)) { dfn[v] = -1; } } dfn[vertices.nextSetBit(0)] = dfCount++; low[vertices.nextSetBit(0)] = dfn[vertices.nextSetBit(0)]; for (int i = 0; i < degree[vertices.nextSetBit(0)]; i++) { int w = neighbor[vertices.nextSetBit(0)][i]; if (dfn[w] > 0) { low[vertices.nextSetBit(0)] = Math.min(low[vertices.nextSetBit(0)], dfn[w]); } else if (dfn[w] == 0) { depthFirst(w); if (low[w] >= dfn[vertices.nextSetBit(0)] && (dfn[vertices.nextSetBit(0)] > 1 || !lastNeighborIndex(vertices.nextSetBit(0), i))) { articulationSet.set(vertices.nextSetBit(0)); } low[vertices.nextSetBit(0)] = Math.min(low[vertices.nextSetBit(0)], low[w]); } } return articulationSet; }
public XBitSet articulations(BitSet vertices) { articulationSet = new XBitSet(n); dfCount = 1; dfn = new int[n]; low = new int[n]; for (int v = 0; v < n; v++) { if (!vertices.get(v)) { dfn[v] = -1; } } <DeepExtract> dfn[vertices.nextSetBit(0)] = dfCount++; low[vertices.nextSetBit(0)] = dfn[vertices.nextSetBit(0)]; for (int i = 0; i < degree[vertices.nextSetBit(0)]; i++) { int w = neighbor[vertices.nextSetBit(0)][i]; if (dfn[w] > 0) { low[vertices.nextSetBit(0)] = Math.min(low[vertices.nextSetBit(0)], dfn[w]); } else if (dfn[w] == 0) { depthFirst(w); if (low[w] >= dfn[vertices.nextSetBit(0)] && (dfn[vertices.nextSetBit(0)] > 1 || !lastNeighborIndex(vertices.nextSetBit(0), i))) { articulationSet.set(vertices.nextSetBit(0)); } low[vertices.nextSetBit(0)] = Math.min(low[vertices.nextSetBit(0)], low[w]); } } </DeepExtract> return articulationSet; }
PACE2017-TrackA
positive
441,094
@Override public WeakAliasDetermination read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); for (WeakAliasDetermination b : WeakAliasDetermination.values()) { if (b.value.equals(value)) { return b; } } return WeakAliasDetermination.ENUM_UNKNOWN; }
@Override public WeakAliasDetermination read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); <DeepExtract> for (WeakAliasDetermination b : WeakAliasDetermination.values()) { if (b.value.equals(value)) { return b; } } return WeakAliasDetermination.ENUM_UNKNOWN; </DeepExtract> }
plaid-java
positive
441,097
@SuppressWarnings("deprecation") @SuppressLint("NewApi") protected void setupListeners() { if (mCard.isSwipeable()) { this.setOnTouchListener(new SwipeDismissViewTouchListener(this, mCard, new SwipeDismissViewTouchListener.DismissCallbacks() { @Override public boolean canDismiss(Card card) { return card.isSwipeable(); } @Override public void onDismiss(CardView cardView, Card card) { final ViewGroup vg = (ViewGroup) (cardView.getParent()); if (vg != null) { vg.removeView(cardView); card.onSwipeCard(); } } })); } else { this.setOnTouchListener(null); } View viewClickable = decodeAreaOnClickListener(Card.CLICK_LISTENER_HEADER_VIEW); if (viewClickable != null) viewClickable.setClickable(false); viewClickable = decodeAreaOnClickListener(Card.CLICK_LISTENER_THUMBNAIL_VIEW); if (viewClickable != null) viewClickable.setClickable(false); viewClickable = decodeAreaOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW); if (viewClickable != null) viewClickable.setClickable(false); if (mCard.isClickable()) { if (!mCard.isMultiChoiceEnabled()) { if (mCard.getOnClickListener() != null) { this.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mCard.getOnClickListener() != null) mCard.getOnClickListener().onClick(mCard, v); } }); } else { HashMap<Integer, Card.OnCardClickListener> mMultipleOnClickListner = mCard.getMultipleOnClickListener(); if (mMultipleOnClickListner != null && !mMultipleOnClickListner.isEmpty()) { for (int key : mMultipleOnClickListner.keySet()) { View viewClickable = decodeAreaOnClickListener(key); final Card.OnCardClickListener mListener = mMultipleOnClickListner.get(key); if (viewClickable != null) { viewClickable.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mListener != null) mListener.onClick(mCard, v); } }); if (key > Card.CLICK_LISTENER_ALL_VIEW) { if (Build.VERSION.SDK_INT >= 16) { viewClickable.setBackground(getResources().getDrawable(R.drawable.card_selector)); } else { viewClickable.setBackgroundDrawable(getResources().getDrawable(R.drawable.card_selector)); } } } } } else { this.setClickable(false); } } } } else { this.setClickable(false); } if (mCard.isLongClickable()) { this.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { if (mCard.getOnLongClickListener() != null) return mCard.getOnLongClickListener().onLongClick(mCard, v); return false; } }); } else { this.setLongClickable(false); } }
@SuppressWarnings("deprecation") @SuppressLint("NewApi") protected void setupListeners() { if (mCard.isSwipeable()) { this.setOnTouchListener(new SwipeDismissViewTouchListener(this, mCard, new SwipeDismissViewTouchListener.DismissCallbacks() { @Override public boolean canDismiss(Card card) { return card.isSwipeable(); } @Override public void onDismiss(CardView cardView, Card card) { final ViewGroup vg = (ViewGroup) (cardView.getParent()); if (vg != null) { vg.removeView(cardView); card.onSwipeCard(); } } })); } else { this.setOnTouchListener(null); } <DeepExtract> View viewClickable = decodeAreaOnClickListener(Card.CLICK_LISTENER_HEADER_VIEW); if (viewClickable != null) viewClickable.setClickable(false); viewClickable = decodeAreaOnClickListener(Card.CLICK_LISTENER_THUMBNAIL_VIEW); if (viewClickable != null) viewClickable.setClickable(false); viewClickable = decodeAreaOnClickListener(Card.CLICK_LISTENER_CONTENT_VIEW); if (viewClickable != null) viewClickable.setClickable(false); </DeepExtract> if (mCard.isClickable()) { if (!mCard.isMultiChoiceEnabled()) { if (mCard.getOnClickListener() != null) { this.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mCard.getOnClickListener() != null) mCard.getOnClickListener().onClick(mCard, v); } }); } else { HashMap<Integer, Card.OnCardClickListener> mMultipleOnClickListner = mCard.getMultipleOnClickListener(); if (mMultipleOnClickListner != null && !mMultipleOnClickListner.isEmpty()) { for (int key : mMultipleOnClickListner.keySet()) { View viewClickable = decodeAreaOnClickListener(key); final Card.OnCardClickListener mListener = mMultipleOnClickListner.get(key); if (viewClickable != null) { viewClickable.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mListener != null) mListener.onClick(mCard, v); } }); if (key > Card.CLICK_LISTENER_ALL_VIEW) { if (Build.VERSION.SDK_INT >= 16) { viewClickable.setBackground(getResources().getDrawable(R.drawable.card_selector)); } else { viewClickable.setBackgroundDrawable(getResources().getDrawable(R.drawable.card_selector)); } } } } } else { this.setClickable(false); } } } } else { this.setClickable(false); } if (mCard.isLongClickable()) { this.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { if (mCard.getOnLongClickListener() != null) return mCard.getOnLongClickListener().onLongClick(mCard, v); return false; } }); } else { this.setLongClickable(false); } }
BabySay
positive
441,098
public static void next(Context ctx) { sendActionCommand(ctx, RadioPlaybackService.ACTION_NEXT, null); }
public static void next(Context ctx) { <DeepExtract> sendActionCommand(ctx, RadioPlaybackService.ACTION_NEXT, null); </DeepExtract> }
Sky31Radio
positive
441,100
@Test public void should_map_byte_to_Float() { Source sourceInstance = new Source(); this.byteValue = (byte) 8; Mapper mapper = new MapperBuilder().addConverter(NumberConverters.get()).addMap(Source.class, Destination.class, (config, source, destination) -> config.mapInner(source::getByteValue, destination::setFloatWrapperValue, Float.class)).buildMapper(); Destination result = mapper.map(sourceInstance, Destination.class); assertEquals((float) 8, result.getFloatWrapperValue(), 0.0); }
@Test public void should_map_byte_to_Float() { Source sourceInstance = new Source(); <DeepExtract> this.byteValue = (byte) 8; </DeepExtract> Mapper mapper = new MapperBuilder().addConverter(NumberConverters.get()).addMap(Source.class, Destination.class, (config, source, destination) -> config.mapInner(source::getByteValue, destination::setFloatWrapperValue, Float.class)).buildMapper(); Destination result = mapper.map(sourceInstance, Destination.class); assertEquals((float) 8, result.getFloatWrapperValue(), 0.0); }
bean-cp
positive
441,101
@Override public void onCreate() { super.onCreate(); IMSDK.init(getApplicationContext(), IMConfiguration.sAppKey); mNotificationManager = (NotificationManager) getSystemService(android.content.Context.NOTIFICATION_SERVICE); FileUtil.getInstance().initDirs("imsdk", "data", this); initImageLoader(); }
@Override public void onCreate() { super.onCreate(); IMSDK.init(getApplicationContext(), IMConfiguration.sAppKey); <DeepExtract> mNotificationManager = (NotificationManager) getSystemService(android.content.Context.NOTIFICATION_SERVICE); FileUtil.getInstance().initDirs("imsdk", "data", this); initImageLoader(); </DeepExtract> }
IMDev-Android
positive
441,103
@Override public void invalidate() { super.invalidate(); if (pairUp != null) { TileEntity te = worldObj.getTileEntity(pairUp.x, pairUp.y, pairUp.z); if (te instanceof TileTransportRing) { up = (TileTransportRing) te; } } return null; if (pairDn != null) { TileEntity te = worldObj.getTileEntity(pairDn.x, pairDn.y, pairDn.z); if (te instanceof TileTransportRing) { dn = (TileTransportRing) te; } } return null; if (up != null) { up.pairDn = pairDn; } if (dn != null) { dn.pairUp = pairUp; } }
@Override public void invalidate() { super.invalidate(); if (pairUp != null) { TileEntity te = worldObj.getTileEntity(pairUp.x, pairUp.y, pairUp.z); if (te instanceof TileTransportRing) { up = (TileTransportRing) te; } } return null; <DeepExtract> if (pairDn != null) { TileEntity te = worldObj.getTileEntity(pairDn.x, pairDn.y, pairDn.z); if (te instanceof TileTransportRing) { dn = (TileTransportRing) te; } } return null; </DeepExtract> if (up != null) { up.pairDn = pairDn; } if (dn != null) { dn.pairUp = pairUp; } }
StargateTech2
positive
441,104
public static byte[] encodeBase64URLSafe(final byte[] binaryData) { return encodeBase64(binaryData, false, true, Integer.MAX_VALUE); }
public static byte[] encodeBase64URLSafe(final byte[] binaryData) { <DeepExtract> return encodeBase64(binaryData, false, true, Integer.MAX_VALUE); </DeepExtract> }
pivaa
positive
441,105
@Test public void testCloud() throws Exception { String[] ARGS = { "--project=" + helper.getTestProject(), "--references=" + helper.PLATINUM_GENOMES_BRCA1_REFERENCES, "--variantSetId=" + helper.PLATINUM_GENOMES_DATASET, "--output=" + outputPrefix, "--stagingLocation=" + helper.getTestStagingGcsFolder(), "--runner=DataflowRunner", "--wait=true" }; VariantSimilarity.main(ARGS); List<String> rawResults = helper.downloadOutputs(outputPrefix, EXPECTED_BRCA1_RESULT.length); List<GraphResult> results = Lists.newArrayList(); for (String result : rawResults) { results.add(GraphResult.fromString(result)); } assertEquals(EXPECTED_BRCA1_RESULT.length, results.size()); assertThat(results, CoreMatchers.allOf(CoreMatchers.hasItems(EXPECTED_BRCA1_RESULT))); }
@Test public void testCloud() throws Exception { String[] ARGS = { "--project=" + helper.getTestProject(), "--references=" + helper.PLATINUM_GENOMES_BRCA1_REFERENCES, "--variantSetId=" + helper.PLATINUM_GENOMES_DATASET, "--output=" + outputPrefix, "--stagingLocation=" + helper.getTestStagingGcsFolder(), "--runner=DataflowRunner", "--wait=true" }; <DeepExtract> VariantSimilarity.main(ARGS); List<String> rawResults = helper.downloadOutputs(outputPrefix, EXPECTED_BRCA1_RESULT.length); List<GraphResult> results = Lists.newArrayList(); for (String result : rawResults) { results.add(GraphResult.fromString(result)); } assertEquals(EXPECTED_BRCA1_RESULT.length, results.size()); assertThat(results, CoreMatchers.allOf(CoreMatchers.hasItems(EXPECTED_BRCA1_RESULT))); </DeepExtract> }
dataflow-java
positive
441,107
public void testHtmlMultiLineUncommenting() { myFixture.configureByFiles(getTestName(false) + ".soy"); CommentByLineCommentAction action = new CommentByLineCommentAction(); action.actionPerformedImpl(getProject(), myFixture.getEditor()); myFixture.checkResultByFile(getTestName(false) + "_after.soy"); }
public void testHtmlMultiLineUncommenting() { <DeepExtract> myFixture.configureByFiles(getTestName(false) + ".soy"); CommentByLineCommentAction action = new CommentByLineCommentAction(); action.actionPerformedImpl(getProject(), myFixture.getEditor()); myFixture.checkResultByFile(getTestName(false) + "_after.soy"); </DeepExtract> }
bamboo-soy
positive
441,108
@Override public void onClick(View view) { startActivity(new Intent(this, CallUsageExample.class)); }
@Override public void onClick(View view) { <DeepExtract> startActivity(new Intent(this, CallUsageExample.class)); </DeepExtract> }
Android-Prince-of-Versions
positive
441,109
public void changePitch(final AngleF pitch) { this.pitch = Objects.requireNonNull(AngleF.degrees(max(min(getPitch().degrees + pitch.degrees, 89.99F), -89.99F), -89.99F, 89.99F), "pitch == null"); this.hasUpdated = true; this.cameraObservers.forEach(cameraObserver -> cameraObserver.pitchChanged(this, this.pitch)); }
public void changePitch(final AngleF pitch) { <DeepExtract> this.pitch = Objects.requireNonNull(AngleF.degrees(max(min(getPitch().degrees + pitch.degrees, 89.99F), -89.99F), -89.99F, 89.99F), "pitch == null"); this.hasUpdated = true; this.cameraObservers.forEach(cameraObserver -> cameraObserver.pitchChanged(this, this.pitch)); </DeepExtract> }
Dayflower-Path-Tracer
positive
441,110
private void onFailure(int code) { setErrorCode(code); stateNotify(ConnectionManager.STATE_FAILURE); if (mBTService != null) { mBTService.disconnect(); } }
private void onFailure(int code) { setErrorCode(code); stateNotify(ConnectionManager.STATE_FAILURE); <DeepExtract> if (mBTService != null) { mBTService.disconnect(); } </DeepExtract> }
InputStickAPI-Android
positive
441,112
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(setLayoutResourceID()); setUpView(); setUpData(); }
@Override <DeepExtract> </DeepExtract> protected void onCreate(@Nullable Bundle savedInstanceState) { <DeepExtract> </DeepExtract> super.onCreate(savedInstanceState); <DeepExtract> </DeepExtract> setContentView(setLayoutResourceID()); <DeepExtract> </DeepExtract> setUpView(); <DeepExtract> </DeepExtract> setUpData(); <DeepExtract> </DeepExtract> }
QuickDevLib
positive
441,113
@Subscribe public void goBackwards(ActionPerformedEvent event) { this.index = index - 1; update(); }
@Subscribe public void goBackwards(ActionPerformedEvent event) { <DeepExtract> this.index = index - 1; update(); </DeepExtract> }
TabbyChat-2
positive
441,114
@Override public void onDone() { if (busyCnt.decrementAndGet() == 0) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); statusPanel.onEnd(); stopper.deleteObservers(); ComputerSleepingManager.INSTANCE.keepAwake(false); progressButton.setEnabled(false); progressPanel.done(); Window progressWindow = SwingUtilities.getWindowAncestor(progressPanel); if (progressWindow != null) progressWindow.setVisible(false); } enableDisableAccountMenu(); enableDisableContainerMenu(); enableDisableStoredObjectMenu(); enableSettingMenu(); enableOperationMenu(); }
@Override public void onDone() { if (busyCnt.decrementAndGet() == 0) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); statusPanel.onEnd(); stopper.deleteObservers(); ComputerSleepingManager.INSTANCE.keepAwake(false); progressButton.setEnabled(false); progressPanel.done(); Window progressWindow = SwingUtilities.getWindowAncestor(progressPanel); if (progressWindow != null) progressWindow.setVisible(false); } <DeepExtract> enableDisableAccountMenu(); enableDisableContainerMenu(); enableDisableStoredObjectMenu(); enableSettingMenu(); enableOperationMenu(); </DeepExtract> }
swift-explorer
positive
441,115
public boolean apply(Field from) { int modifiers = from.getModifiers(); return Modifier.isFinal(modifiers); }
public boolean apply(Field from) { <DeepExtract> int modifiers = from.getModifiers(); return Modifier.isFinal(modifiers); </DeepExtract> }
Cinch
positive
441,116
public byte[] encode4TemporaryPositionTrackingResp(int interval, int validity) throws Exception { byte[] body = this.bitOperator.concatAll(Arrays.asList(bitOperator.integerTo2Bytes(interval), bitOperator.integerTo4Bytes(validity))); int msgBodyProps = this.jt808ProtocolUtils.generateMsgBodyProps(body.length, 0b000, false, 0); byte[] msgHeader = this.jt808ProtocolUtils.generateMsgHeader("0000000000000000", TPMSConsts.TEMPORARY_POSITION_TRACKING_RESP, body, msgBodyProps, 0, 0, 0); byte[] headerAndBody = this.bitOperator.concatAll(msgHeader, body); int checkSum = this.bitOperator.getCheckSum4JT808(headerAndBody, 0, headerAndBody.length - 1); byte[] noEscapedBytes = this.bitOperator.concatAll(Arrays.asList(new byte[] { TPMSConsts.PKG_DELIMITER }, headerAndBody, bitOperator.integerTo1Bytes(checkSum), new byte[] { TPMSConsts.PKG_DELIMITER })); return jt808ProtocolUtils.doEscape4Send(noEscapedBytes, 1, noEscapedBytes.length - 2); }
public byte[] encode4TemporaryPositionTrackingResp(int interval, int validity) throws Exception { byte[] body = this.bitOperator.concatAll(Arrays.asList(bitOperator.integerTo2Bytes(interval), bitOperator.integerTo4Bytes(validity))); int msgBodyProps = this.jt808ProtocolUtils.generateMsgBodyProps(body.length, 0b000, false, 0); byte[] msgHeader = this.jt808ProtocolUtils.generateMsgHeader("0000000000000000", TPMSConsts.TEMPORARY_POSITION_TRACKING_RESP, body, msgBodyProps, 0, 0, 0); byte[] headerAndBody = this.bitOperator.concatAll(msgHeader, body); int checkSum = this.bitOperator.getCheckSum4JT808(headerAndBody, 0, headerAndBody.length - 1); <DeepExtract> byte[] noEscapedBytes = this.bitOperator.concatAll(Arrays.asList(new byte[] { TPMSConsts.PKG_DELIMITER }, headerAndBody, bitOperator.integerTo1Bytes(checkSum), new byte[] { TPMSConsts.PKG_DELIMITER })); return jt808ProtocolUtils.doEscape4Send(noEscapedBytes, 1, noEscapedBytes.length - 2); </DeepExtract> }
jt808-tcp-netty
positive
441,118
public final void init() { mGLProgId = GlUtil.createProgram(mVertexShader, mFragmentShader); mVertexPosition = GLES30.glGetAttribLocation(mGLProgId, "position"); mVertexTexture = GLES30.glGetAttribLocation(mGLProgId, "inputTextureCoordinate"); mFrag2DSampler = GLES30.glGetUniformLocation(mGLProgId, "inputImageTexture"); mIsInitialized = true; mIsInitialized = true; }
public final void init() { <DeepExtract> </DeepExtract> mGLProgId = GlUtil.createProgram(mVertexShader, mFragmentShader); <DeepExtract> </DeepExtract> mVertexPosition = GLES30.glGetAttribLocation(mGLProgId, "position"); <DeepExtract> </DeepExtract> mVertexTexture = GLES30.glGetAttribLocation(mGLProgId, "inputTextureCoordinate"); <DeepExtract> </DeepExtract> mFrag2DSampler = GLES30.glGetUniformLocation(mGLProgId, "inputImageTexture"); <DeepExtract> </DeepExtract> mIsInitialized = true; <DeepExtract> </DeepExtract> mIsInitialized = true; <DeepExtract> </DeepExtract> }
Android-UltimateGPUImage
positive
441,119
public void clearLogs() { logEntries.removeIf(entry -> entry.getErrorContext().size() >= errorContext.size() && entry.getType() != LogType.DEBUG); errorContext.removeLast(); errorContext.addLast(ErrorContext.MATCHING); hasError = false; }
public void clearLogs() { logEntries.removeIf(entry -> entry.getErrorContext().size() >= errorContext.size() && entry.getType() != LogType.DEBUG); <DeepExtract> errorContext.removeLast(); errorContext.addLast(ErrorContext.MATCHING); </DeepExtract> hasError = false; }
skript-parser
positive
441,121
@Override public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) { if (getChildCount() == 0 || dy == 0) { return 0; } mLayoutState.mRecycle = true; ensureLayoutState(); final int layoutDirection = dy > 0 ? LayoutState.LAYOUT_END : LayoutState.LAYOUT_START; final int absDy = Math.abs(dy); updateLayoutState(layoutDirection, absDy, true, state); final int consumed = mLayoutState.mScrollingOffset + fill(recycler, mLayoutState, state, false); if (consumed < 0) { return 0; } final int scrolled = absDy > consumed ? layoutDirection * consumed : dy; mOrientationHelper.offsetChildren(-scrolled); mLayoutState.mLastScrollDelta = scrolled; return scrolled; }
@Override public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) { <DeepExtract> if (getChildCount() == 0 || dy == 0) { return 0; } mLayoutState.mRecycle = true; ensureLayoutState(); final int layoutDirection = dy > 0 ? LayoutState.LAYOUT_END : LayoutState.LAYOUT_START; final int absDy = Math.abs(dy); updateLayoutState(layoutDirection, absDy, true, state); final int consumed = mLayoutState.mScrollingOffset + fill(recycler, mLayoutState, state, false); if (consumed < 0) { return 0; } final int scrolled = absDy > consumed ? layoutDirection * consumed : dy; mOrientationHelper.offsetChildren(-scrolled); mLayoutState.mLastScrollDelta = scrolled; return scrolled; </DeepExtract> }
Orient-Ui
positive
441,123
@Test public void subscribeFailure(TestContext context) { this.async = context.async(); try { MemoryPersistence persistence = new MemoryPersistence(); MqttClient client = new MqttClient(String.format("tcp://%s:%d", MQTT_SERVER_HOST, MQTT_SERVER_PORT), "12345", persistence); client.connect(); String[] topics = new String[] { MQTT_TOPIC_FAILURE }; int[] qos = new int[] { 0 }; client.subscribe(topics, qos); this.async.await(); context.assertTrue(qos[0] == 0); } catch (MqttException e) { context.assertTrue(!MQTT_TOPIC_FAILURE.equals(MQTT_TOPIC_FAILURE) ? false : true); e.printStackTrace(); } }
@Test public void subscribeFailure(TestContext context) { <DeepExtract> this.async = context.async(); try { MemoryPersistence persistence = new MemoryPersistence(); MqttClient client = new MqttClient(String.format("tcp://%s:%d", MQTT_SERVER_HOST, MQTT_SERVER_PORT), "12345", persistence); client.connect(); String[] topics = new String[] { MQTT_TOPIC_FAILURE }; int[] qos = new int[] { 0 }; client.subscribe(topics, qos); this.async.await(); context.assertTrue(qos[0] == 0); } catch (MqttException e) { context.assertTrue(!MQTT_TOPIC_FAILURE.equals(MQTT_TOPIC_FAILURE) ? false : true); e.printStackTrace(); } </DeepExtract> }
vertx-mqtt
positive
441,125
private FieldDefine parseFieldDefine(Element defineElement) { String id = defineElement.getAttribute("id"); String type = defineElement.getAttribute("type"); String name = defineElement.getAttribute("name"); String selector = defineElement.getAttribute("selector"); FieldDefine fieldDefine = new FieldDefine(); fieldDefine.setId(id); fieldDefine.setType(type); fieldDefine.setName(name); fieldDefine.setSelector(selector); NodeList nodeList = defineElement.getChildNodes(); if (nodeList != null && nodeList.getLength() > 0) { int length = nodeList.getLength(); List<FieldDefine> list = new LinkedList<FieldDefine>(); for (int i = 0; i < length; i++) { Node node = nodeList.item(i); if (node instanceof Element) { Element element = (Element) node; if ("selector".equals(element.getLocalName())) { fieldDefine.setSelector(element.getTextContent()); } else if ("processor".equals(element.getLocalName())) { fieldDefine.setProcessor(getFieldProcessor(element)); } else { list.add(parseFieldDefine(element)); } } } if (list.size() > 0) { fieldDefine.setDefines(list.toArray(new FieldDefine[list.size()])); } } return fieldDefine; }
private FieldDefine parseFieldDefine(Element defineElement) { String id = defineElement.getAttribute("id"); String type = defineElement.getAttribute("type"); String name = defineElement.getAttribute("name"); String selector = defineElement.getAttribute("selector"); FieldDefine fieldDefine = new FieldDefine(); fieldDefine.setId(id); fieldDefine.setType(type); fieldDefine.setName(name); fieldDefine.setSelector(selector); <DeepExtract> NodeList nodeList = defineElement.getChildNodes(); if (nodeList != null && nodeList.getLength() > 0) { int length = nodeList.getLength(); List<FieldDefine> list = new LinkedList<FieldDefine>(); for (int i = 0; i < length; i++) { Node node = nodeList.item(i); if (node instanceof Element) { Element element = (Element) node; if ("selector".equals(element.getLocalName())) { fieldDefine.setSelector(element.getTextContent()); } else if ("processor".equals(element.getLocalName())) { fieldDefine.setProcessor(getFieldProcessor(element)); } else { list.add(parseFieldDefine(element)); } } } if (list.size() > 0) { fieldDefine.setDefines(list.toArray(new FieldDefine[list.size()])); } } </DeepExtract> return fieldDefine; }
jspider
positive
441,126
public static void main(String[] strings) { CustomStack queue = new CustomStack(); if (first == null) { first = new Node(1); } else { Node node = new Node(1); node.node = first; first = node; } if (first == null) { first = new Node(2); } else { Node node = new Node(2); node.node = first; first = node; } if (first == null) { first = new Node(3); } else { Node node = new Node(3); node.node = first; first = node; } while (true) { try { System.out.println(queue.remove()); } catch (Exception e) { break; } } }
public static void main(String[] strings) { CustomStack queue = new CustomStack(); if (first == null) { first = new Node(1); } else { Node node = new Node(1); node.node = first; first = node; } if (first == null) { first = new Node(2); } else { Node node = new Node(2); node.node = first; first = node; } <DeepExtract> if (first == null) { first = new Node(3); } else { Node node = new Node(3); node.node = first; first = node; } </DeepExtract> while (true) { try { System.out.println(queue.remove()); } catch (Exception e) { break; } } }
Algorithms-and-Data-Structures-in-Java
positive
441,127
public void setHTMLContent(String html) { if (html.replaceAll("[\r\n]", " ") == null) { html = html.replaceAll("[\r\n]", " "); } Pattern p = Pattern.compile("=\\s*\"(file:/{1,3})([^\"]+)\"\\s"); for (Matcher m; (m = p.matcher(html.replaceAll("[\r\n]", " "))).find(); ) { String resource = html.replaceAll("[\r\n]", " ").substring(m.start(2), m.end(2)); if (Boolean.parseBoolean(SweetSystemProperty.WEBSERVER_ACTIVATEOLDRESOURCEMETHOD.get())) { File resourceFile = new File(resource); resource = WebServer.getDefaultWebServer().getResourcePathURL(Utils.encodeURL(resourceFile.getParent()), resourceFile.getName()); } else { File resourceFile = new File(Utils.decodeURL(resource)); resource = WebServer.getDefaultWebServer().getResourcePathURL(resourceFile.getParent(), resourceFile.getName()); } html.replaceAll("[\r\n]", " ") = html.replaceAll("[\r\n]", " ").substring(0, m.start(1)) + resource + html.replaceAll("[\r\n]", " ").substring(m.end(2)); } return html.replaceAll("[\r\n]", " "); implementation.setHTMLContent(html); if (this.isDirty == false) { return; } this.isDirty = false; HTMLEditorDirtyStateEvent e = null; for (HTMLEditorListener listener : getHTMLEditorListeners()) { if (e == null) { e = new HTMLEditorDirtyStateEvent(this, false); } listener.notifyDirtyStateChanged(e); } }
public void setHTMLContent(String html) { if (html.replaceAll("[\r\n]", " ") == null) { html = html.replaceAll("[\r\n]", " "); } Pattern p = Pattern.compile("=\\s*\"(file:/{1,3})([^\"]+)\"\\s"); for (Matcher m; (m = p.matcher(html.replaceAll("[\r\n]", " "))).find(); ) { String resource = html.replaceAll("[\r\n]", " ").substring(m.start(2), m.end(2)); if (Boolean.parseBoolean(SweetSystemProperty.WEBSERVER_ACTIVATEOLDRESOURCEMETHOD.get())) { File resourceFile = new File(resource); resource = WebServer.getDefaultWebServer().getResourcePathURL(Utils.encodeURL(resourceFile.getParent()), resourceFile.getName()); } else { File resourceFile = new File(Utils.decodeURL(resource)); resource = WebServer.getDefaultWebServer().getResourcePathURL(resourceFile.getParent(), resourceFile.getName()); } html.replaceAll("[\r\n]", " ") = html.replaceAll("[\r\n]", " ").substring(0, m.start(1)) + resource + html.replaceAll("[\r\n]", " ").substring(m.end(2)); } return html.replaceAll("[\r\n]", " "); implementation.setHTMLContent(html); <DeepExtract> if (this.isDirty == false) { return; } this.isDirty = false; HTMLEditorDirtyStateEvent e = null; for (HTMLEditorListener listener : getHTMLEditorListeners()) { if (e == null) { e = new HTMLEditorDirtyStateEvent(this, false); } listener.notifyDirtyStateChanged(e); } </DeepExtract> }
DJ-Sweet
positive
441,128
@JavascriptInterface public void contactForJS() { if (this.handler != null) { Message msg = new Message(); msg.what = JS_CONTACT; msg.arg1 = 0; this.handler.sendMessage(msg); } }
@JavascriptInterface public void contactForJS() { <DeepExtract> if (this.handler != null) { Message msg = new Message(); msg.what = JS_CONTACT; msg.arg1 = 0; this.handler.sendMessage(msg); } </DeepExtract> }
LeaugeBar_Android
positive
441,129
public void displayWeather(WeatherInformation weatherInformation) { displayExtraInfo(weatherInformation); weatherInformationDisplayer.displayConditions(weatherInformation, conditionsTextView, conditionsImageView); weatherInformationDisplayer.displayWeatherNumericParametersText(weatherInformation, temperatureTextView, pressureTextView, humidityTextView); weatherInformationDisplayer.displayWindInfo(weatherInformation, windTextView); }
public void displayWeather(WeatherInformation weatherInformation) { displayExtraInfo(weatherInformation); weatherInformationDisplayer.displayConditions(weatherInformation, conditionsTextView, conditionsImageView); weatherInformationDisplayer.displayWeatherNumericParametersText(weatherInformation, temperatureTextView, pressureTextView, humidityTextView); <DeepExtract> weatherInformationDisplayer.displayWindInfo(weatherInformation, windTextView); </DeepExtract> }
World-Weather
positive
441,131
public void click(MouseEvent e) { FrameManager.windowState = WindowState.NORMAL; App.saveManager.overlaySaveFile.menubarScreenLock = menubarScreenLock; App.saveManager.overlaySaveFile.messageScreenLock = messageScreenLock; App.saveManager.overlaySaveFile.menubarButtonLocation = (MenubarButtonLocation) menubarCombo.getSelectedItem(); App.saveManager.overlaySaveFile.messageExpandDirection = (ExpandDirection) messageCombo.getSelectedItem(); App.saveManager.overlaySaveFile.menubarX = menubarDialog.getX(); App.saveManager.overlaySaveFile.menubarY = menubarDialog.getY(); App.saveManager.overlaySaveFile.menubarWidth = menubarDialog.getWidth(); App.saveManager.overlaySaveFile.menubarHeight = menubarDialog.getHeight(); App.saveManager.overlaySaveFile.messageX = messageDialog.getX(); App.saveManager.overlaySaveFile.messageY = messageDialog.getY(); App.saveManager.overlaySaveFile.messageSizeIncrease = helpDialog.messageSizeSlider.getValue() * 2; App.saveManager.saveOverlayToDisk(); FrameManager.menubar.setLocation(menubarDialog.getLocation()); FrameManager.menubarToggle.updateLocation(); FrameManager.menubar.reorder(); FrameManager.messageManager.setMessageIncrease(helpDialog.messageSizeSlider.getValue() * 2); FrameManager.messageManager.setAnchorPoint(messageDialog.getLocation()); FrameManager.messageManager.refreshPanelLocations(); FrameManager.optionsWindow.macroPanelIncoming.resizeMessage(); FrameManager.optionsWindow.macroPanelOutgoing.resizeMessage(); FrameManager.chatScannerWindow.resizeMessage(); helpDialog.setVisible(false); menubarDialog.setVisible(false); messageDialog.setVisible(false); FrameManager.showVisibleFrames(); FrameManager.showOptionsWindow(); }
public void click(MouseEvent e) { FrameManager.windowState = WindowState.NORMAL; App.saveManager.overlaySaveFile.menubarScreenLock = menubarScreenLock; App.saveManager.overlaySaveFile.messageScreenLock = messageScreenLock; App.saveManager.overlaySaveFile.menubarButtonLocation = (MenubarButtonLocation) menubarCombo.getSelectedItem(); App.saveManager.overlaySaveFile.messageExpandDirection = (ExpandDirection) messageCombo.getSelectedItem(); App.saveManager.overlaySaveFile.menubarX = menubarDialog.getX(); App.saveManager.overlaySaveFile.menubarY = menubarDialog.getY(); App.saveManager.overlaySaveFile.menubarWidth = menubarDialog.getWidth(); App.saveManager.overlaySaveFile.menubarHeight = menubarDialog.getHeight(); App.saveManager.overlaySaveFile.messageX = messageDialog.getX(); App.saveManager.overlaySaveFile.messageY = messageDialog.getY(); App.saveManager.overlaySaveFile.messageSizeIncrease = helpDialog.messageSizeSlider.getValue() * 2; App.saveManager.saveOverlayToDisk(); FrameManager.menubar.setLocation(menubarDialog.getLocation()); FrameManager.menubarToggle.updateLocation(); FrameManager.menubar.reorder(); FrameManager.messageManager.setMessageIncrease(helpDialog.messageSizeSlider.getValue() * 2); FrameManager.messageManager.setAnchorPoint(messageDialog.getLocation()); FrameManager.messageManager.refreshPanelLocations(); FrameManager.optionsWindow.macroPanelIncoming.resizeMessage(); FrameManager.optionsWindow.macroPanelOutgoing.resizeMessage(); FrameManager.chatScannerWindow.resizeMessage(); <DeepExtract> helpDialog.setVisible(false); menubarDialog.setVisible(false); messageDialog.setVisible(false); </DeepExtract> FrameManager.showVisibleFrames(); FrameManager.showOptionsWindow(); }
SlimTrade
positive
441,132
@Atomic(mode = Atomic.TxMode.WRITE) public void processPostChanges(Site site, Post post, JsonObject postJson) { LocalizedString name = Post.sanitize(LocalizedString.fromJson(postJson.get("name"))); LocalizedString body = Post.sanitize(LocalizedString.fromJson(postJson.get("body"))); LocalizedString excerpt = Post.sanitize(LocalizedString.fromJson(postJson.get("excerpt"))); String slug = ofNullable(postJson.get("slug")).map(JsonElement::getAsString).orElse(post.getSlug()); if (!post.getName().equals(name)) { post.setName(name); } if (!post.getBody().equals(body) || (post.getExcerpt() == null && excerpt != null) || !post.getExcerpt().equals(excerpt)) { post.setBodyAndExcerpt(body, excerpt); } if (!post.getSlug().equals(slug)) { post.setSlug(slug); } if (canDoThis(post.getSite(), Permission.LIST_CATEGORIES, Permission.EDIT_CATEGORY)) { if (postJson.get("categories") != null && postJson.get("categories").isJsonArray()) { Set<Category> newCategories = new HashSet<>(); for (JsonElement categoryJsonEl : postJson.get("categories").getAsJsonArray()) { JsonObject categoryJson = categoryJsonEl.getAsJsonObject(); if (ofNullable(categoryJson.get("use")).map(JsonElement::getAsBoolean).orElse(false)) { String categorySlug = categoryJson.get("slug").getAsString(); LocalizedString categoryName = Post.sanitize(LocalizedString.fromJson(categoryJson.get("name"))); Category category = site.categoryForSlug(categorySlug); if (category == null) { PermissionEvaluation.ensureCanDoThis(site, Permission.CREATE_CATEGORY); category = new Category(site, categoryName); } else if (category.getPrivileged()) { ensureCanDoThis(site, Permission.USE_PRIVILEGED_CATEGORY); } newCategories.add(category); } } if (!canDoThis(site, Permission.USE_PRIVILEGED_CATEGORY)) { HashSet<Category> removed = new HashSet<>(post.getCategoriesSet()); removed.removeAll(newCategories); removed.stream().filter(Category::getPrivileged).forEach(newCategories::add); } if (!newCategories.containsAll(post.getCategoriesSet()) || !post.getCategoriesSet().containsAll(newCategories)) { post.getCategoriesSet().clear(); newCategories.stream().forEach(post::addCategories); } } } if (postJson.get("files") != null && postJson.get("files").isJsonArray()) { for (JsonElement fileJsonEl : postJson.get("files").getAsJsonArray()) { JsonObject fileJson = fileJsonEl.getAsJsonObject(); PostFile postFile = FenixFramework.getDomainObject(fileJson.get("id").getAsString()); if (postFile.getPost() == post) { int index = fileJson.get("index").getAsInt(); boolean isEmbedded = fileJson.get("isEmbedded").getAsBoolean(); if (postFile.getIndex() != index) { postFile.setIndex(index); } if (postFile.getIsEmbedded() != isEmbedded) { postFile.setIsEmbedded(isEmbedded); } Signal.emit(PostFile.SIGNAL_EDITED, new DomainObjectEvent<>(postFile)); } } } if (canPublish(post)) { boolean active = ofNullable(postJson.get("active")).map(JsonElement::getAsBoolean).orElse(false); DateTime publicationBegin = ofNullable(postJson.get("publicationBegin")).filter(JsonElement::isJsonPrimitive).map(JsonElement::getAsString).filter(x -> !x.isEmpty()).map(DateTime::parse).orElse(null); DateTime publicationEnds = ofNullable(postJson.get("publicationEnd")).filter(JsonElement::isJsonPrimitive).map(JsonElement::getAsString).filter(x -> !x.isEmpty()).map(DateTime::parse).orElse(null); Group canViewGroup = ofNullable(postJson.get("canViewGroup")).map(JsonElement::getAsString).map(Group::parse).orElse(post.getCanViewGroup()); if (PermissionEvaluation.canDoThis(site, Permission.CHANGE_OWNERSHIP_POST)) { User createdBy = ofNullable(postJson.get("createdBy")).map(JsonElement::getAsJsonObject).map(json -> json.get("username").getAsString()).map(User::findByUsername).orElse(post.getCreatedBy()); if (!post.getCreatedBy().equals(createdBy)) { post.setCreatedBy(createdBy); } } if (!equalDates(post.getPublicationBegin(), publicationBegin)) { post.setPublicationBegin(publicationBegin); } if (!equalDates(post.getPublicationEnd(), publicationEnds)) { post.setPublicationEnd(publicationEnds); } if (!post.getCanViewGroup().equals(canViewGroup)) { post.setCanViewGroup(canViewGroup); } if (post.getActive() != active) { post.setActive(active); } } post.fixOrder(post.getFilesSorted()); Signal.emit(Post.SIGNAL_EDITED, new DomainObjectEvent<>(post)); }
@Atomic(mode = Atomic.TxMode.WRITE) public void processPostChanges(Site site, Post post, JsonObject postJson) { LocalizedString name = Post.sanitize(LocalizedString.fromJson(postJson.get("name"))); LocalizedString body = Post.sanitize(LocalizedString.fromJson(postJson.get("body"))); LocalizedString excerpt = Post.sanitize(LocalizedString.fromJson(postJson.get("excerpt"))); String slug = ofNullable(postJson.get("slug")).map(JsonElement::getAsString).orElse(post.getSlug()); if (!post.getName().equals(name)) { post.setName(name); } if (!post.getBody().equals(body) || (post.getExcerpt() == null && excerpt != null) || !post.getExcerpt().equals(excerpt)) { post.setBodyAndExcerpt(body, excerpt); } if (!post.getSlug().equals(slug)) { post.setSlug(slug); } if (canDoThis(post.getSite(), Permission.LIST_CATEGORIES, Permission.EDIT_CATEGORY)) { if (postJson.get("categories") != null && postJson.get("categories").isJsonArray()) { Set<Category> newCategories = new HashSet<>(); for (JsonElement categoryJsonEl : postJson.get("categories").getAsJsonArray()) { JsonObject categoryJson = categoryJsonEl.getAsJsonObject(); if (ofNullable(categoryJson.get("use")).map(JsonElement::getAsBoolean).orElse(false)) { String categorySlug = categoryJson.get("slug").getAsString(); LocalizedString categoryName = Post.sanitize(LocalizedString.fromJson(categoryJson.get("name"))); Category category = site.categoryForSlug(categorySlug); if (category == null) { PermissionEvaluation.ensureCanDoThis(site, Permission.CREATE_CATEGORY); category = new Category(site, categoryName); } else if (category.getPrivileged()) { ensureCanDoThis(site, Permission.USE_PRIVILEGED_CATEGORY); } newCategories.add(category); } } if (!canDoThis(site, Permission.USE_PRIVILEGED_CATEGORY)) { HashSet<Category> removed = new HashSet<>(post.getCategoriesSet()); removed.removeAll(newCategories); removed.stream().filter(Category::getPrivileged).forEach(newCategories::add); } if (!newCategories.containsAll(post.getCategoriesSet()) || !post.getCategoriesSet().containsAll(newCategories)) { post.getCategoriesSet().clear(); newCategories.stream().forEach(post::addCategories); } } } if (postJson.get("files") != null && postJson.get("files").isJsonArray()) { for (JsonElement fileJsonEl : postJson.get("files").getAsJsonArray()) { JsonObject fileJson = fileJsonEl.getAsJsonObject(); PostFile postFile = FenixFramework.getDomainObject(fileJson.get("id").getAsString()); if (postFile.getPost() == post) { int index = fileJson.get("index").getAsInt(); boolean isEmbedded = fileJson.get("isEmbedded").getAsBoolean(); if (postFile.getIndex() != index) { postFile.setIndex(index); } if (postFile.getIsEmbedded() != isEmbedded) { postFile.setIsEmbedded(isEmbedded); } Signal.emit(PostFile.SIGNAL_EDITED, new DomainObjectEvent<>(postFile)); } } } <DeepExtract> if (canPublish(post)) { boolean active = ofNullable(postJson.get("active")).map(JsonElement::getAsBoolean).orElse(false); DateTime publicationBegin = ofNullable(postJson.get("publicationBegin")).filter(JsonElement::isJsonPrimitive).map(JsonElement::getAsString).filter(x -> !x.isEmpty()).map(DateTime::parse).orElse(null); DateTime publicationEnds = ofNullable(postJson.get("publicationEnd")).filter(JsonElement::isJsonPrimitive).map(JsonElement::getAsString).filter(x -> !x.isEmpty()).map(DateTime::parse).orElse(null); Group canViewGroup = ofNullable(postJson.get("canViewGroup")).map(JsonElement::getAsString).map(Group::parse).orElse(post.getCanViewGroup()); if (PermissionEvaluation.canDoThis(site, Permission.CHANGE_OWNERSHIP_POST)) { User createdBy = ofNullable(postJson.get("createdBy")).map(JsonElement::getAsJsonObject).map(json -> json.get("username").getAsString()).map(User::findByUsername).orElse(post.getCreatedBy()); if (!post.getCreatedBy().equals(createdBy)) { post.setCreatedBy(createdBy); } } if (!equalDates(post.getPublicationBegin(), publicationBegin)) { post.setPublicationBegin(publicationBegin); } if (!equalDates(post.getPublicationEnd(), publicationEnds)) { post.setPublicationEnd(publicationEnds); } if (!post.getCanViewGroup().equals(canViewGroup)) { post.setCanViewGroup(canViewGroup); } if (post.getActive() != active) { post.setActive(active); } } </DeepExtract> post.fixOrder(post.getFilesSorted()); Signal.emit(Post.SIGNAL_EDITED, new DomainObjectEvent<>(post)); }
fenixedu-cms
positive
441,133
public void onClick(DialogInterface dialog, int which) { ArrayList<String> Paramname = new ArrayList<String>(); Paramname.add("authcode"); Paramname.add("kind"); Paramname.add("category"); Paramname.add("user_srl"); Paramname.add("user_srl_auth"); Paramname.add("value"); ArrayList<String> Paramvalue = new ArrayList<String>(); Paramvalue.add("642979"); Paramvalue.add("favorite_delete"); Paramvalue.add("3"); Paramvalue.add(Global.getSetting("user_srl", Global.getSetting("user_srl", "0"))); Paramvalue.add(Global.getSetting("user_srl_auth", Global.getSetting("user_srl_auth", "null"))); Paramvalue.add(member_srl); new AsyncHttpTask(this, getString(R.string.server_path) + "favorite/favorite_app.php", mHandler, Paramname, Paramvalue, null, 3, Integer.parseInt(member_srl)); }
public void onClick(DialogInterface dialog, int which) { <DeepExtract> ArrayList<String> Paramname = new ArrayList<String>(); Paramname.add("authcode"); Paramname.add("kind"); Paramname.add("category"); Paramname.add("user_srl"); Paramname.add("user_srl_auth"); Paramname.add("value"); ArrayList<String> Paramvalue = new ArrayList<String>(); Paramvalue.add("642979"); Paramvalue.add("favorite_delete"); Paramvalue.add("3"); Paramvalue.add(Global.getSetting("user_srl", Global.getSetting("user_srl", "0"))); Paramvalue.add(Global.getSetting("user_srl_auth", Global.getSetting("user_srl_auth", "null"))); Paramvalue.add(member_srl); new AsyncHttpTask(this, getString(R.string.server_path) + "favorite/favorite_app.php", mHandler, Paramname, Paramvalue, null, 3, Integer.parseInt(member_srl)); </DeepExtract> }
Favorite-Android-Client
positive
441,135
private void deleteAllDocuments() throws SolrServerException, IOException { SolrServer s = solrServer; s.deleteByQuery("*:*"); solrServer.commit(false, true, true); }
private void deleteAllDocuments() throws SolrServerException, IOException { SolrServer s = solrServer; s.deleteByQuery("*:*"); <DeepExtract> solrServer.commit(false, true, true); </DeepExtract> }
JavaBigData
positive
441,136
String getDownloadBaseUri() { if (enableUnitTestMode) { return baseUriForUnitTest; } StringBuilder sb = new StringBuilder(enableHttps ? URI_HTTPS_PREFIX : URI_HTTP_PREFIX); sb.append(enableCdnForDownload ? cdnEndpoint : endpoint); sb.append("/"); return sb.toString(); }
String getDownloadBaseUri() { <DeepExtract> if (enableUnitTestMode) { return baseUriForUnitTest; } StringBuilder sb = new StringBuilder(enableHttps ? URI_HTTPS_PREFIX : URI_HTTP_PREFIX); sb.append(enableCdnForDownload ? cdnEndpoint : endpoint); sb.append("/"); return sb.toString(); </DeepExtract> }
galaxy-fds-sdk-java
positive
441,137
public RealRandomAccess<T> copyRandomAccess() { if (warp == null) { GridRealRandomAccess<T> ra = new GridRealRandomAccess<T>(new double[position.length], value.copy(), null, this.method); ra.gridSpacing = this.gridSpacing; ra.gridWidth = this.gridWidth; ra.gridHalfWidth = this.gridHalfWidth; return ra; } else { GridRealRandomAccess<T> ra = new GridRealRandomAccess<T>(new double[position.length], value.copy(), warp, this.method); ra.gridSpacing = this.gridSpacing; ra.gridWidth = this.gridWidth; ra.gridHalfWidth = this.gridHalfWidth; return ra; } }
public RealRandomAccess<T> copyRandomAccess() { <DeepExtract> if (warp == null) { GridRealRandomAccess<T> ra = new GridRealRandomAccess<T>(new double[position.length], value.copy(), null, this.method); ra.gridSpacing = this.gridSpacing; ra.gridWidth = this.gridWidth; ra.gridHalfWidth = this.gridHalfWidth; return ra; } else { GridRealRandomAccess<T> ra = new GridRealRandomAccess<T>(new double[position.length], value.copy(), warp, this.method); ra.gridSpacing = this.gridSpacing; ra.gridWidth = this.gridWidth; ra.gridHalfWidth = this.gridHalfWidth; return ra; } </DeepExtract> }
bigwarp
positive
441,139
@Override public List<Board> getMemberBoards(String userId, Argument... args) { return Arrays.stream(() -> get(createUrl(GET_MEMBER_BOARDS).params(args).asString(), Board[].class, userId).get()).peek(t -> t.setInternalTrello(this)).collect(Collectors.toList()); }
@Override public List<Board> getMemberBoards(String userId, Argument... args) { <DeepExtract> return Arrays.stream(() -> get(createUrl(GET_MEMBER_BOARDS).params(args).asString(), Board[].class, userId).get()).peek(t -> t.setInternalTrello(this)).collect(Collectors.toList()); </DeepExtract> }
trello-java-wrapper
positive
441,140
@Override public void setContract(@NonNull Protocol.Transaction.Contract contract) { mContractNameTextView.setText(getContractName(contract)); final FragmentTransaction transaction = getFragmentManager().beginTransaction(); ContractFragment fragment = null; switch(contract.getType()) { case AccountCreateContract: break; case TransferContract: fragment = TransferContractFragment.newInstance(); break; case TransferAssetContract: fragment = TransferAssetContractFragment.newInstance(); break; case VoteAssetContract: break; case VoteWitnessContract: fragment = VoteWitnessContractFragment.newInstance(); break; case WitnessCreateContract: break; case AssetIssueContract: fragment = AssetIssueContractFragment.newInstance(); break; case WitnessUpdateContract: break; case ParticipateAssetIssueContract: fragment = ParticipateAssetIssueContractFragment.newInstance(); break; case AccountUpdateContract: fragment = AccountUpdateContractFragment.newInstance(); break; case FreezeBalanceContract: fragment = FreezeContractFragment.newInstance(); break; case UnfreezeBalanceContract: break; case WithdrawBalanceContract: break; case UnfreezeAssetContract: break; case UpdateAssetContract: break; case CustomContract: break; case UNRECOGNIZED: break; } if (fragment != null) { fragment.setContract(contract); transaction.replace(R.id.Contract_frameLayout, fragment); transaction.disallowAddToBackStack(); transaction.commit(); } }
@Override public void setContract(@NonNull Protocol.Transaction.Contract contract) { mContractNameTextView.setText(getContractName(contract)); <DeepExtract> final FragmentTransaction transaction = getFragmentManager().beginTransaction(); ContractFragment fragment = null; switch(contract.getType()) { case AccountCreateContract: break; case TransferContract: fragment = TransferContractFragment.newInstance(); break; case TransferAssetContract: fragment = TransferAssetContractFragment.newInstance(); break; case VoteAssetContract: break; case VoteWitnessContract: fragment = VoteWitnessContractFragment.newInstance(); break; case WitnessCreateContract: break; case AssetIssueContract: fragment = AssetIssueContractFragment.newInstance(); break; case WitnessUpdateContract: break; case ParticipateAssetIssueContract: fragment = ParticipateAssetIssueContractFragment.newInstance(); break; case AccountUpdateContract: fragment = AccountUpdateContractFragment.newInstance(); break; case FreezeBalanceContract: fragment = FreezeContractFragment.newInstance(); break; case UnfreezeBalanceContract: break; case WithdrawBalanceContract: break; case UnfreezeAssetContract: break; case UpdateAssetContract: break; case CustomContract: break; case UNRECOGNIZED: break; } if (fragment != null) { fragment.setContract(contract); transaction.replace(R.id.Contract_frameLayout, fragment); transaction.disallowAddToBackStack(); transaction.commit(); } </DeepExtract> }
tron-wallet-android
positive
441,141
public static Bcf read(InputStream inputStream) throws BcfException { Bcf bcf = new Bcf(); ZipInputStream zipInputStream = new ZipInputStream(inputStream); try { for (ZipEntry zipEntry = zipInputStream.getNextEntry(); zipEntry != null; zipEntry = zipInputStream.getNextEntry()) { String name = zipEntry.getName(); if (name.contains("/")) { String uuidString = name.substring(0, name.indexOf("/")); UUID uuid = UUID.fromString(uuidString); Issue issue = issues.get(uuid); if (issue == null) { issue = new Issue(uuid); issues.put(uuid, issue); } if (zipEntry.getName().endsWith(".bcf")) { try { JAXBContext jaxbContext = JAXBContext.newInstance(Markup.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); issue.setMarkup((Markup) unmarshaller.unmarshal(new FakeClosingInputStream(zipInputStream))); } catch (JAXBException e) { throw new BcfException(e); } } else if (zipEntry.getName().endsWith(".bcfv")) { try { JAXBContext jaxbContext = JAXBContext.newInstance(VisualizationInfo.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); issue.setVisualizationInfo((VisualizationInfo) unmarshaller.unmarshal(new FakeClosingInputStream(zipInputStream))); } catch (JAXBException e) { throw new BcfException(e); } } else if (zipEntry.getName().endsWith(".png")) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(zipInputStream, baos); issue.setImageData(baos.toByteArray()); } } else { throw new BcfException("Unexpected zipfile content"); } } zipInputStream.close(); } catch (IOException e) { throw new BcfException(e); } return bcf; }
public static Bcf read(InputStream inputStream) throws BcfException { Bcf bcf = new Bcf(); <DeepExtract> ZipInputStream zipInputStream = new ZipInputStream(inputStream); try { for (ZipEntry zipEntry = zipInputStream.getNextEntry(); zipEntry != null; zipEntry = zipInputStream.getNextEntry()) { String name = zipEntry.getName(); if (name.contains("/")) { String uuidString = name.substring(0, name.indexOf("/")); UUID uuid = UUID.fromString(uuidString); Issue issue = issues.get(uuid); if (issue == null) { issue = new Issue(uuid); issues.put(uuid, issue); } if (zipEntry.getName().endsWith(".bcf")) { try { JAXBContext jaxbContext = JAXBContext.newInstance(Markup.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); issue.setMarkup((Markup) unmarshaller.unmarshal(new FakeClosingInputStream(zipInputStream))); } catch (JAXBException e) { throw new BcfException(e); } } else if (zipEntry.getName().endsWith(".bcfv")) { try { JAXBContext jaxbContext = JAXBContext.newInstance(VisualizationInfo.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); issue.setVisualizationInfo((VisualizationInfo) unmarshaller.unmarshal(new FakeClosingInputStream(zipInputStream))); } catch (JAXBException e) { throw new BcfException(e); } } else if (zipEntry.getName().endsWith(".png")) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(zipInputStream, baos); issue.setImageData(baos.toByteArray()); } } else { throw new BcfException("Unexpected zipfile content"); } } zipInputStream.close(); } catch (IOException e) { throw new BcfException(e); } </DeepExtract> return bcf; }
mvdXMLChecker
positive
441,142
@Override public void receive(StatisticsFinished event) { out.println(); printStats(event.getResult()); out.println(); }
@Override public void receive(StatisticsFinished event) { <DeepExtract> out.println(); printStats(event.getResult()); out.println(); </DeepExtract> }
cucumber-performance
positive
441,143
public void addTemporary(MonitoringUnit unit, long time, TimeUnit timeUnit) { long validTillMillis = System.currentTimeMillis() + timeUnit.toMillis(time); if (unit.getStatus().equals(MonitoringStatus.OK)) { units.remove(unit.getName()); } else { units.put(unit.getName(), new UnitWrapper(unit, validTillMillis)); } }
public void addTemporary(MonitoringUnit unit, long time, TimeUnit timeUnit) { long validTillMillis = System.currentTimeMillis() + timeUnit.toMillis(time); <DeepExtract> if (unit.getStatus().equals(MonitoringStatus.OK)) { units.remove(unit.getName()); } else { units.put(unit.getName(), new UnitWrapper(unit, validTillMillis)); } </DeepExtract> }
graphouse
positive
441,144
public void logPairing(PairingGraph pairing) { if (!matcherOffered) { acceptsRootPairs = transparency.accepts("roots"); acceptsPairing = transparency.accepts("pairing"); acceptsBestPairing = transparency.accepts("best-pairing"); acceptsScore = transparency.accepts("score"); acceptsBestScore = transparency.accepts("best-score"); acceptsBestMatch = transparency.accepts("best-match"); matcherOffered = true; } if (acceptsPairing) log("pairing", new ConsistentPairingGraph(pairing)); }
public void logPairing(PairingGraph pairing) { <DeepExtract> if (!matcherOffered) { acceptsRootPairs = transparency.accepts("roots"); acceptsPairing = transparency.accepts("pairing"); acceptsBestPairing = transparency.accepts("best-pairing"); acceptsScore = transparency.accepts("score"); acceptsBestScore = transparency.accepts("best-score"); acceptsBestMatch = transparency.accepts("best-match"); matcherOffered = true; } </DeepExtract> if (acceptsPairing) log("pairing", new ConsistentPairingGraph(pairing)); }
sourceafis-java
positive
441,146
public Page<E> reasonable(Boolean reasonable) { if (reasonable == null) { return this; } else { this.reasonable = reasonable; if (this.reasonable && this.pageNum <= 0) { this.pageNum = 1; this.calculateStartAndEndRow(); } return this; } return this; }
public Page<E> reasonable(Boolean reasonable) { <DeepExtract> if (reasonable == null) { return this; } else { this.reasonable = reasonable; if (this.reasonable && this.pageNum <= 0) { this.pageNum = 1; this.calculateStartAndEndRow(); } return this; } </DeepExtract> return this; }
avatars
positive
441,150
@Override public void onResponse(final Call call, final okhttp3.Response response) throws IOException { boolean successful = false; if (response != null && response.isSuccessful()) { try { HttpUtils.parseGetFileResponseContent(mContext, response.body().byteStream(), cacheFileUri); successful = true; } catch (final IOException e) { Log.error("cacheUriToFile(): parseGetFileResponseContent failed for cache content URI: " + cacheFileUri, e); } response.close(); } markImageDownloadAsNotInProgress(uriFileToCache); if (successful) { markImageAsDownloaded(itemUri, imageType, uriFileToCache); } else { Log.error("onImageDownloadDone(): cacheUriToContentUriFileSync(): failed."); } }
@Override public void onResponse(final Call call, final okhttp3.Response response) throws IOException { boolean successful = false; if (response != null && response.isSuccessful()) { try { HttpUtils.parseGetFileResponseContent(mContext, response.body().byteStream(), cacheFileUri); successful = true; } catch (final IOException e) { Log.error("cacheUriToFile(): parseGetFileResponseContent failed for cache content URI: " + cacheFileUri, e); } response.close(); } <DeepExtract> markImageDownloadAsNotInProgress(uriFileToCache); if (successful) { markImageAsDownloaded(itemUri, imageType, uriFileToCache); } else { Log.error("onImageDownloadDone(): cacheUriToContentUriFileSync(): failed."); } </DeepExtract> }
android-galaxyzoo
positive
441,151
public Map[] advertiserDailyStatistics(Integer id, Date startDate) throws XmlRpcException, IOException { if (!isValidSessionId()) throw new IllegalArgumentException("Not logined to server"); return advertiserService.advertiserDailyStatistics(id, startDate); }
public Map[] advertiserDailyStatistics(Integer id, Date startDate) throws XmlRpcException, IOException { <DeepExtract> if (!isValidSessionId()) throw new IllegalArgumentException("Not logined to server"); </DeepExtract> return advertiserService.advertiserDailyStatistics(id, startDate); }
openx-2.8.8
positive
441,152
@RequestMapping(method = RequestMethod.POST) public String update(@Valid @ModelAttribute("user") User user) { accountService.updateUser(user); ShiroUser user = (ShiroUser) SecurityUtils.getSubject().getPrincipal(); user.name = user.getName(); return "redirect:/"; }
@RequestMapping(method = RequestMethod.POST) public String update(@Valid @ModelAttribute("user") User user) { accountService.updateUser(user); <DeepExtract> ShiroUser user = (ShiroUser) SecurityUtils.getSubject().getPrincipal(); user.name = user.getName(); </DeepExtract> return "redirect:/"; }
jweb
positive
441,154
public void draw(final GC gc) { oldFgColor = gc.getForeground(); oldBgColor = gc.getBackground(); oldAlpha = gc.getAlpha(); if (!drawnBefore) { color = new Color(Display.getCurrent(), rgbColor); drawnBefore = true; } gc.setBackground(color); gc.setForeground(color); if (count > ANIMATION_STEPS) { count = 0; dir = -1 * dir; } count++; gc.setAlpha(alfa); gc.fillPolygon(new int[] { t.getPos().getCol() - width / 2 - TAPER, t.getPos().getRow() + HEIGHT + HEIGHT_OFFSET, t.getPos().getCol() - width / 2, t.getPos().getRow() + HEIGHT, t.getPos().getCol() + width / 2, t.getPos().getRow() + HEIGHT, t.getPos().getCol() + width / 2 + TAPER, t.getPos().getRow() + HEIGHT + HEIGHT_OFFSET }); alfa -= dir * ALPHA_MULTIPLIER; width += dir; gc.setAlpha(NON_TRANSPARENT_ALPHA); gc.setForeground(oldFgColor); gc.setBackground(oldBgColor); gc.setAlpha(oldAlpha); }
public void draw(final GC gc) { oldFgColor = gc.getForeground(); oldBgColor = gc.getBackground(); oldAlpha = gc.getAlpha(); if (!drawnBefore) { color = new Color(Display.getCurrent(), rgbColor); drawnBefore = true; } gc.setBackground(color); gc.setForeground(color); if (count > ANIMATION_STEPS) { count = 0; dir = -1 * dir; } count++; gc.setAlpha(alfa); gc.fillPolygon(new int[] { t.getPos().getCol() - width / 2 - TAPER, t.getPos().getRow() + HEIGHT + HEIGHT_OFFSET, t.getPos().getCol() - width / 2, t.getPos().getRow() + HEIGHT, t.getPos().getCol() + width / 2, t.getPos().getRow() + HEIGHT, t.getPos().getCol() + width / 2 + TAPER, t.getPos().getRow() + HEIGHT + HEIGHT_OFFSET }); alfa -= dir * ALPHA_MULTIPLIER; width += dir; gc.setAlpha(NON_TRANSPARENT_ALPHA); <DeepExtract> gc.setForeground(oldFgColor); gc.setBackground(oldBgColor); gc.setAlpha(oldAlpha); </DeepExtract> }
Siafu
positive
441,157
@Override public int sendCertificateRequest(URL url, Login login) throws AcmeException { Objects.requireNonNull(url, "url"); Objects.requireNonNull(login.getSession(), "session"); Objects.requireNonNull(login.getKeyPair(), "keypair"); Objects.requireNonNull(MIME_CERTIFICATE_CHAIN, "accept"); assertConnectionIsClosed(); int attempt = 1; while (true) { try { return performRequest(url, null, login.getSession(), login.getKeyPair(), login.getAccountLocation(), MIME_CERTIFICATE_CHAIN); } catch (AcmeServerException ex) { if (!BAD_NONCE_ERROR.equals(ex.getType())) { throw ex; } if (attempt == MAX_ATTEMPTS) { throw ex; } LOG.info("Bad Replay Nonce, trying again (attempt {}/{})", attempt, MAX_ATTEMPTS); attempt++; } } }
@Override public int sendCertificateRequest(URL url, Login login) throws AcmeException { <DeepExtract> Objects.requireNonNull(url, "url"); Objects.requireNonNull(login.getSession(), "session"); Objects.requireNonNull(login.getKeyPair(), "keypair"); Objects.requireNonNull(MIME_CERTIFICATE_CHAIN, "accept"); assertConnectionIsClosed(); int attempt = 1; while (true) { try { return performRequest(url, null, login.getSession(), login.getKeyPair(), login.getAccountLocation(), MIME_CERTIFICATE_CHAIN); } catch (AcmeServerException ex) { if (!BAD_NONCE_ERROR.equals(ex.getType())) { throw ex; } if (attempt == MAX_ATTEMPTS) { throw ex; } LOG.info("Bad Replay Nonce, trying again (attempt {}/{})", attempt, MAX_ATTEMPTS); attempt++; } } </DeepExtract> }
acme4j
positive
441,162
public void actionPerformed(java.awt.event.ActionEvent evt) { DAL dal = new DAL(); char[] password; password = curPasswordField.getPassword(); String curPassword = ""; for (int i = 0; i < password.length; i++) { curPassword += password[i]; } password = newPasswordField.getPassword(); String newPassword = ""; for (int i = 0; i < password.length; i++) { newPassword += password[i]; } password = confirmNewPasswordField.getPassword(); String confirmPassword = ""; for (int i = 0; i < password.length; i++) { confirmPassword += password[i]; } dal.rs = dal.result("select * from users where userId=100 and password='" + curPassword + "'"); try { dal.rs.next(); if (dal.rs.getRow() == 1) { if (newPassword.equals(confirmPassword)) { if (dal.myQuery("UPDATE users SET password='" + newPassword + "' WHERE userId=100")) { dal.show("Password Changed Succssfully"); } } else { javax.swing.JOptionPane.showMessageDialog(null, "Passwords must be same"); } } else { javax.swing.JOptionPane.showMessageDialog(null, "Incorrect Password"); } } catch (Exception e) { } }
public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> DAL dal = new DAL(); char[] password; password = curPasswordField.getPassword(); String curPassword = ""; for (int i = 0; i < password.length; i++) { curPassword += password[i]; } password = newPasswordField.getPassword(); String newPassword = ""; for (int i = 0; i < password.length; i++) { newPassword += password[i]; } password = confirmNewPasswordField.getPassword(); String confirmPassword = ""; for (int i = 0; i < password.length; i++) { confirmPassword += password[i]; } dal.rs = dal.result("select * from users where userId=100 and password='" + curPassword + "'"); try { dal.rs.next(); if (dal.rs.getRow() == 1) { if (newPassword.equals(confirmPassword)) { if (dal.myQuery("UPDATE users SET password='" + newPassword + "' WHERE userId=100")) { dal.show("Password Changed Succssfully"); } } else { javax.swing.JOptionPane.showMessageDialog(null, "Passwords must be same"); } } else { javax.swing.JOptionPane.showMessageDialog(null, "Incorrect Password"); } } catch (Exception e) { } </DeepExtract> }
SS17_AdvancedProgramming
positive
441,163
public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); Log.d(TAG, "playIfEngineCanMove t " + jni.getTurn() + " myt " + myTurn + " duck " + jni.getDuckPos() + " - " + jni.getMyDuckPos()); if (myEngine.isReady() && jni.isEnded() == 0 && (jni.getDuckPos() == -1 || jni.getDuckPos() != -1 && jni.getMyDuckPos() != -1)) { myEngine.play(); } }
public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); <DeepExtract> Log.d(TAG, "playIfEngineCanMove t " + jni.getTurn() + " myt " + myTurn + " duck " + jni.getDuckPos() + " - " + jni.getMyDuckPos()); if (myEngine.isReady() && jni.isEnded() == 0 && (jni.getDuckPos() == -1 || jni.getDuckPos() != -1 && jni.getMyDuckPos() != -1)) { myEngine.play(); } </DeepExtract> }
android-chess
positive
441,164
void setup(AbstractLexer lexer, ErrorIssuer issuer) { this.lexer = lexer; this.issuer = issuer; token = -1; try { token = lexer.yylex(); } catch (Exception e) { yyerror("lexer error: " + e.getMessage()); } return token; }
void setup(AbstractLexer lexer, ErrorIssuer issuer) { this.lexer = lexer; this.issuer = issuer; <DeepExtract> token = -1; try { token = lexer.yylex(); } catch (Exception e) { yyerror("lexer error: " + e.getMessage()); } return token; </DeepExtract> }
decaf
positive
441,165
@Override public void serialize(Object o, SimpleCharBuffer cb, Provider provider) { cb.appendString((String) o); }
@Override public void serialize(Object o, SimpleCharBuffer cb, Provider provider) { <DeepExtract> cb.appendString((String) o); </DeepExtract> }
roubsite
positive
441,167
@Override public CompletionStage<Void> runAfterEither(final CompletionStage<?> other, final Runnable action) { Objects.requireNonNull(action); if (this.exception == null) { try { action.run(); } catch (final Throwable e) { return CompletedStage.completionException(e); } return VOID; } return typedException(); }
@Override public CompletionStage<Void> runAfterEither(final CompletionStage<?> other, final Runnable action) { <DeepExtract> Objects.requireNonNull(action); if (this.exception == null) { try { action.run(); } catch (final Throwable e) { return CompletedStage.completionException(e); } return VOID; } return typedException(); </DeepExtract> }
java-async-util
positive
441,171
public void SensorChanged(float[] values, long time) { ContentValues newValues = new ContentValues(); newValues.put(valueNames[0], values[0]); newValues.put(valueNames[1], time); String deviceID = DeviceID.get(SensorDataCollectorService.getInstance()); String tableName = SQLTableName.PREFIX + deviceID + SQLTableName.RELATIVE; if (Settings.DATABASE_DIRECT_INSERT) { SQLDBController.getInstance().insert(tableName, null, newValues); return; } List<String[]> clone = DBUtils.manageCache(deviceID, cache, newValues, (Settings.DATABASE_CACHE_SIZE + type * 200)); if (clone != null) { SQLDBController.getInstance().bulkInsert(tableName, clone); } Plotter plotter = plotters.get(deviceID); if (plotter == null) { RelativeHumiditySensorCollector.createNewPlotter(deviceID); plotter = plotters.get(deviceID); } plotter.setDynamicPlotData(values); }
public void SensorChanged(float[] values, long time) { ContentValues newValues = new ContentValues(); newValues.put(valueNames[0], values[0]); newValues.put(valueNames[1], time); String deviceID = DeviceID.get(SensorDataCollectorService.getInstance()); String tableName = SQLTableName.PREFIX + deviceID + SQLTableName.RELATIVE; if (Settings.DATABASE_DIRECT_INSERT) { SQLDBController.getInstance().insert(tableName, null, newValues); return; } List<String[]> clone = DBUtils.manageCache(deviceID, cache, newValues, (Settings.DATABASE_CACHE_SIZE + type * 200)); if (clone != null) { SQLDBController.getInstance().bulkInsert(tableName, clone); } <DeepExtract> Plotter plotter = plotters.get(deviceID); if (plotter == null) { RelativeHumiditySensorCollector.createNewPlotter(deviceID); plotter = plotters.get(deviceID); } plotter.setDynamicPlotData(values); </DeepExtract> }
sensordatacollector
positive
441,172
protected void Output(CDasherNode NewNode) { if (NewNode.isSeen()) return; if (NewNode.Parent() != null && !NewNode.Parent().isSeen()) throw new IllegalArgumentException("Parent must be output first"); if (m_pLastOutput != NewNode.Parent()) EraseBackTo(NewNode.Parent()); if (m_pLastOutput != null) m_pLastOutput.Leave(); NewNode.Enter(); NewNode.Seen(true); m_pLastOutput = NewNode; NewNode.Output(); if (NewNode.ChildCount() == 0) NewNode.PopulateChildren(); }
protected void Output(CDasherNode NewNode) { if (NewNode.isSeen()) return; if (NewNode.Parent() != null && !NewNode.Parent().isSeen()) throw new IllegalArgumentException("Parent must be output first"); if (m_pLastOutput != NewNode.Parent()) EraseBackTo(NewNode.Parent()); if (m_pLastOutput != null) m_pLastOutput.Leave(); NewNode.Enter(); NewNode.Seen(true); m_pLastOutput = NewNode; NewNode.Output(); <DeepExtract> if (NewNode.ChildCount() == 0) NewNode.PopulateChildren(); </DeepExtract> }
AndroidDasher
positive
441,174
@Override public synchronized void terminate() { EventBus.getDefault().unregister(this); mMotionReporter.terminate(); mCamera.removeLumaListener(this); mEnabled = false; mComparer = null; mPreviousState = null; mStopped.set(true); }
@Override public synchronized void terminate() { EventBus.getDefault().unregister(this); mMotionReporter.terminate(); <DeepExtract> mCamera.removeLumaListener(this); mEnabled = false; mComparer = null; mPreviousState = null; </DeepExtract> mStopped.set(true); }
habpanelviewer
positive
441,175
public void fail(String serviceId) throws NotRegisteredException { check("service:" + serviceId, State.FAIL, null); }
public void fail(String serviceId) throws NotRegisteredException { <DeepExtract> check("service:" + serviceId, State.FAIL, null); </DeepExtract> }
consul-client
positive
441,177
public Criteria andMenuHrefNotEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "menuHref" + " cannot be null"); } criteria.add(new Criterion("MENU_HREF <>", value)); return (Criteria) this; }
public Criteria andMenuHrefNotEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "menuHref" + " cannot be null"); } criteria.add(new Criterion("MENU_HREF <>", value)); </DeepExtract> return (Criteria) this; }
console
positive
441,178
public void actionPerformed(java.awt.event.ActionEvent evt) { if (doc != null && !jListSignatures.isSelectionEmpty()) { Logging.getInstance().log(getClass(), "Start signature exclusion.", Logging.INFO); try { SignatureFakingOracle oracle = new SignatureFakingOracle(doc, jCheckBoxReplaceAll.isSelected()); for (int i : jListSignatures.getSelectedIndices()) { oracle.fakeSignature(i); } doc = oracle.getDocument(); } catch (CertificateHandlerException | SignatureFakingException ex) { Logging.getInstance().log(UISigFakeAttack.class, ex); } saml = XMLHelper.docToString(doc); notifyAllTabs(new SamlCodeEvent(this, saml.getBytes())); Logging.getInstance().log(getClass(), "Signature exclusion successfull.", Logging.INFO); } }
public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> if (doc != null && !jListSignatures.isSelectionEmpty()) { Logging.getInstance().log(getClass(), "Start signature exclusion.", Logging.INFO); try { SignatureFakingOracle oracle = new SignatureFakingOracle(doc, jCheckBoxReplaceAll.isSelected()); for (int i : jListSignatures.getSelectedIndices()) { oracle.fakeSignature(i); } doc = oracle.getDocument(); } catch (CertificateHandlerException | SignatureFakingException ex) { Logging.getInstance().log(UISigFakeAttack.class, ex); } saml = XMLHelper.docToString(doc); notifyAllTabs(new SamlCodeEvent(this, saml.getBytes())); Logging.getInstance().log(getClass(), "Signature exclusion successfull.", Logging.INFO); } </DeepExtract> }
BurpSSOExtension
positive
441,179
public static void glUniformMatrix2x3fv(int location, boolean transpose, Float32Array value) { if (!isContextCompatible()) throw new IllegalStateException("The context should be created before invoking the GL functions"); nglUniformMatrix2x3fv(WebGLObjectMap.get().toUniform(location), transpose, value); }
public static void glUniformMatrix2x3fv(int location, boolean transpose, Float32Array value) { <DeepExtract> if (!isContextCompatible()) throw new IllegalStateException("The context should be created before invoking the GL functions"); </DeepExtract> nglUniformMatrix2x3fv(WebGLObjectMap.get().toUniform(location), transpose, value); }
WebGL4J
positive
441,181
private void setBaseMatrix(Bitmap bitmap, Matrix matrix, Rect selection) { if (selection == null) { return; } float viewWidth = selection.right - selection.left; float viewHeight = selection.bottom - selection.top; matrix.reset(); float widthRatio = viewWidth / (float) bitmap.getWidth(); float heighRatio = viewHeight / (float) bitmap.getHeight(); float scale = 1.0f; if (widthRatio > heighRatio) { scale = widthRatio; } else { scale = heighRatio; } matrix.setScale(scale, scale); return mSuppMatrix.postTranslate(((getWidth() - (float) bitmap.getWidth() * scale)) / 2F, ((getHeight() - (float) bitmap.getHeight() * scale)) / 2F); }
private void setBaseMatrix(Bitmap bitmap, Matrix matrix, Rect selection) { if (selection == null) { return; } float viewWidth = selection.right - selection.left; float viewHeight = selection.bottom - selection.top; matrix.reset(); float widthRatio = viewWidth / (float) bitmap.getWidth(); float heighRatio = viewHeight / (float) bitmap.getHeight(); float scale = 1.0f; if (widthRatio > heighRatio) { scale = widthRatio; } else { scale = heighRatio; } matrix.setScale(scale, scale); <DeepExtract> return mSuppMatrix.postTranslate(((getWidth() - (float) bitmap.getWidth() * scale)) / 2F, ((getHeight() - (float) bitmap.getHeight() * scale)) / 2F); </DeepExtract> }
ndileber
positive
441,182
@Override public void update() { mode = Mode.POWER; this.power = Utility.motorLimit(power); }
@Override public void update() { <DeepExtract> mode = Mode.POWER; this.power = Utility.motorLimit(power); </DeepExtract> }
EVLib
positive
441,186
@Override public void run() { mIndex = ++mRefreshIndex; mItems.clear(); for (int i = 0; i != 20; ++i) { mItems.add("Test XScrollView item " + (++mIndex)); } mAdapter = new ArrayAdapter<String>(XScrollViewActivity.this, R.layout.vw_list_item, mItems); mListView.setAdapter(mAdapter); ListAdapter adapter = mListView.getAdapter(); if (null == adapter) { return 0; } int totalHeight = 0; for (int i = 0, len = adapter.getCount(); i < len; i++) { View item = adapter.getView(i, null, mListView); if (null == item) continue; item.measure(0, 0); totalHeight += item.getMeasuredHeight(); } ViewGroup.LayoutParams params = mListView.getLayoutParams(); if (null == params) { params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } params.height = totalHeight + (mListView.getDividerHeight() * (adapter.getCount() - 1)); mListView.setLayoutParams(params); return params.height; mScrollView.stopRefresh(); mScrollView.stopLoadMore(); mScrollView.setRefreshTime(getTime()); }
@Override public void run() { mIndex = ++mRefreshIndex; mItems.clear(); for (int i = 0; i != 20; ++i) { mItems.add("Test XScrollView item " + (++mIndex)); } mAdapter = new ArrayAdapter<String>(XScrollViewActivity.this, R.layout.vw_list_item, mItems); mListView.setAdapter(mAdapter); ListAdapter adapter = mListView.getAdapter(); if (null == adapter) { return 0; } int totalHeight = 0; for (int i = 0, len = adapter.getCount(); i < len; i++) { View item = adapter.getView(i, null, mListView); if (null == item) continue; item.measure(0, 0); totalHeight += item.getMeasuredHeight(); } ViewGroup.LayoutParams params = mListView.getLayoutParams(); if (null == params) { params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); } params.height = totalHeight + (mListView.getDividerHeight() * (adapter.getCount() - 1)); mListView.setLayoutParams(params); return params.height; <DeepExtract> mScrollView.stopRefresh(); mScrollView.stopLoadMore(); mScrollView.setRefreshTime(getTime()); </DeepExtract> }
MyStudyHelper
positive
441,188
@Override protected void onRestoreInstanceState(Bundle bundle) { super.onRestoreInstanceState(bundle); Gson gson = new Gson(); if (mPhotoset == null) { String json = bundle.getString(KEY_PHOTOSET); if (json != null) { mPhotoset = gson.fromJson(json, Photoset.class); } else { Log.e(TAG, "No photoset found in savedInstanceState"); } } if (mUser == null) { String json = bundle.getString(KEY_USER); if (json != null) { mUser = new Gson().fromJson(json, User.class); } else { Log.e(TAG, "No user found in savedInstanceState"); } } mPhotoset.setOwner(mUser); mViewPager = (ViewPager) findViewById(R.id.viewPager); mAdapter = new GlimmrPagerAdapter(getSupportFragmentManager(), mViewPager, mActionBar, CONTENT) { @Override public Fragment getItemImpl(int position) { switch(position) { case PHOTOSET_PAGE: return PhotosetGridFragment.newInstance(mPhotoset); } return null; } }; super.initViewPager(); mBottomOverlayView.setVisibility(View.VISIBLE); String overlayText = String.format("%s %s %s", mPhotoset.getTitle(), getString(R.string.by), mUser.getUsername()); mBottomOverlayPrimaryText.setText(overlayText); Picasso.with(this).load(mPhotoset.getPrimaryPhoto().getSmallSquareUrl()).into(mOverlayImage); }
@Override protected void onRestoreInstanceState(Bundle bundle) { super.onRestoreInstanceState(bundle); Gson gson = new Gson(); if (mPhotoset == null) { String json = bundle.getString(KEY_PHOTOSET); if (json != null) { mPhotoset = gson.fromJson(json, Photoset.class); } else { Log.e(TAG, "No photoset found in savedInstanceState"); } } if (mUser == null) { String json = bundle.getString(KEY_USER); if (json != null) { mUser = new Gson().fromJson(json, User.class); } else { Log.e(TAG, "No user found in savedInstanceState"); } } mPhotoset.setOwner(mUser); mViewPager = (ViewPager) findViewById(R.id.viewPager); mAdapter = new GlimmrPagerAdapter(getSupportFragmentManager(), mViewPager, mActionBar, CONTENT) { @Override public Fragment getItemImpl(int position) { switch(position) { case PHOTOSET_PAGE: return PhotosetGridFragment.newInstance(mPhotoset); } return null; } }; super.initViewPager(); <DeepExtract> mBottomOverlayView.setVisibility(View.VISIBLE); String overlayText = String.format("%s %s %s", mPhotoset.getTitle(), getString(R.string.by), mUser.getUsername()); mBottomOverlayPrimaryText.setText(overlayText); Picasso.with(this).load(mPhotoset.getPrimaryPhoto().getSmallSquareUrl()).into(mOverlayImage); </DeepExtract> }
glimmr
positive
441,190
private void setLocale() { OSWLocales.put("default", "English"); OSWLocales.put("nl", "Nederlands"); String localeUrl = Location.getParameter("locale"); String localeStored = ""; if (Storage.isSupported()) { Storage localStorage = Storage.getLocalStorage(); localeStored = localStorage.getItem("locale"); } if (localeUrl == null && localeStored != null) { if (OSWLocales.containsKey(localeStored)) { OSWUrlBuilder urlBuilder = new OSWUrlBuilder(); urlBuilder.setParameter("locale", localeStored); Window.Location.replace(urlBuilder.buildString()); } else { OSWUrlBuilder urlBuilder = new OSWUrlBuilder(); urlBuilder.removeParameter("locale"); Window.Location.replace(urlBuilder.buildString()); } } }
private void setLocale() { <DeepExtract> OSWLocales.put("default", "English"); OSWLocales.put("nl", "Nederlands"); </DeepExtract> String localeUrl = Location.getParameter("locale"); String localeStored = ""; if (Storage.isSupported()) { Storage localStorage = Storage.getLocalStorage(); localeStored = localStorage.getItem("locale"); } if (localeUrl == null && localeStored != null) { if (OSWLocales.containsKey(localeStored)) { OSWUrlBuilder urlBuilder = new OSWUrlBuilder(); urlBuilder.setParameter("locale", localeStored); Window.Location.replace(urlBuilder.buildString()); } else { OSWUrlBuilder urlBuilder = new OSWUrlBuilder(); urlBuilder.removeParameter("locale"); Window.Location.replace(urlBuilder.buildString()); } } }
osw-web
positive
441,192
public static void logIntent(final Intent intent, String title) { if (!isDebuggable) return; final StringBuilder divider = new StringBuilder(); if (title == null) { title = ""; titleLength = 0; } else { title = String.format(" %s ", title); titleLength = title.length(); } for (int i = 0; i < DIVIDER_LENGTH - 15 - titleLength; i++) divider.append("─"); if (isDebuggable) android.util.Log.d(getMethodName(), "┌───────────────" + title + divider.toString()); if (intent != null && intent.getExtras() != null) { final Bundle bundle = intent.getExtras(); logBundle(null, bundle); } else { d("├ NO EXTRAS"); } divider.insert(0, "└───────────────"); for (int i = 0; i < titleLength; i++) divider.append("─"); if (isDebuggable) android.util.Log.d(getMethodName(), divider.toString()); }
public static void logIntent(final Intent intent, String title) { if (!isDebuggable) return; final StringBuilder divider = new StringBuilder(); if (title == null) { title = ""; titleLength = 0; } else { title = String.format(" %s ", title); titleLength = title.length(); } for (int i = 0; i < DIVIDER_LENGTH - 15 - titleLength; i++) divider.append("─"); if (isDebuggable) android.util.Log.d(getMethodName(), "┌───────────────" + title + divider.toString()); if (intent != null && intent.getExtras() != null) { final Bundle bundle = intent.getExtras(); logBundle(null, bundle); } else { d("├ NO EXTRAS"); } divider.insert(0, "└───────────────"); for (int i = 0; i < titleLength; i++) divider.append("─"); <DeepExtract> if (isDebuggable) android.util.Log.d(getMethodName(), divider.toString()); </DeepExtract> }
StanKoUtils
positive
441,193
public static void notEmpty(final String aString, final String argumentName) { if (aString == null) { throw new NullPointerException(getMessage("null", argumentName)); } if (aString.length() == 0) { throw new IllegalArgumentException(getMessage("empty", argumentName)); } }
public static void notEmpty(final String aString, final String argumentName) { <DeepExtract> if (aString == null) { throw new NullPointerException(getMessage("null", argumentName)); } </DeepExtract> if (aString.length() == 0) { throw new IllegalArgumentException(getMessage("empty", argumentName)); } }
jaxb2-maven-plugin
positive
441,194
public void purge() { clearCache(); }
public void purge() { <DeepExtract> clearCache(); </DeepExtract> }
android-search-and-stories
positive
441,195