before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
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 static void clickWheel() { MouseHandler.getEventHandler().pressMouse(2); MouseHandler.getEventHandler().releaseMouse(2); }
public static void clickWheel() { MouseHandler.getEventHandler().pressMouse(2); <DeepExtract> MouseHandler.getEventHandler().releaseMouse(2); </DeepExtract> }
RuneDream-API
positive
441,196
@Override @Transactional(readOnly = false) public void updateStatus(EmpUser empUser) { userService.delete(empUser); employeeService.delete(empUser.getEmployee()); userService.delete(empUser.getEmployee()); employeeService.delete(empUser.getEmployee().getEmployee()); }
@Override @Transactional(readOnly = false) public void updateStatus(EmpUser empUser) { userService.delete(empUser); employeeService.delete(empUser.getEmployee()); <DeepExtract> userService.delete(empUser.getEmployee()); employeeService.delete(empUser.getEmployee().getEmployee()); </DeepExtract> }
frpMgr
positive
441,199
public Criteria andBlogIdNotIn(List<Integer> values) { if (values == null) { throw new RuntimeException("Value for " + "blogId" + " cannot be null"); } criteria.add(new Criterion("blog_id not in", values)); return (Criteria) this; }
public Criteria andBlogIdNotIn(List<Integer> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "blogId" + " cannot be null"); } criteria.add(new Criterion("blog_id not in", values)); </DeepExtract> return (Criteria) this; }
LightBlog
positive
441,201
@Override public void handleGetSensorReadingResponse(IpmiHandlerContext context, GetSensorReadingResponse response) { handleDefault(context, response); }
@Override public void handleGetSensorReadingResponse(IpmiHandlerContext context, GetSensorReadingResponse response) { <DeepExtract> handleDefault(context, response); </DeepExtract> }
ipmi4j
positive
441,202
public Point2D.Double transform(Point2D.Double src, Point2D.Double dst) { double x = src.x * DTR; if (projectionLongitude != 0) { x = MapMath.normalizeLongitude(x - projectionLongitude); } dst.x = x; dst.y = src.y * DTR; return dst; dst.x = totalScale * dst.x + totalFalseEasting; dst.y = totalScale * dst.y + totalFalseNorthing; return dst; }
public Point2D.Double transform(Point2D.Double src, Point2D.Double dst) { double x = src.x * DTR; if (projectionLongitude != 0) { x = MapMath.normalizeLongitude(x - projectionLongitude); } <DeepExtract> dst.x = x; dst.y = src.y * DTR; return dst; </DeepExtract> dst.x = totalScale * dst.x + totalFalseEasting; dst.y = totalScale * dst.y + totalFalseNorthing; return dst; }
ungentry
positive
441,203
@Override public <T> List<T> findAllByPartialTextContent(Class<T> type, String partialTextContent) { return context.findAllByNested(type, root, By.nested(root, By.partialTextContent(partialTextContent))); }
@Override public <T> List<T> findAllByPartialTextContent(Class<T> type, String partialTextContent) { <DeepExtract> return context.findAllByNested(type, root, By.nested(root, By.partialTextContent(partialTextContent))); </DeepExtract> }
darcy-webdriver
positive
441,204
private void filllistview() { mImageUris.clear(); say("Loading videos Uris"); String path = Environment.getExternalStorageDirectory().toString() + "/DCIM/Camera"; Log.d("Files", "Path: " + path); File f = new File(path); File[] file = f.listFiles(); Log.d("Files", "Size: " + file.length); for (int i = 0; i < file.length; i++) { String name = file[i].getName(); if (name.contains(".mp4")) { Log.d("Files", "FileName:" + name); Uri uri = Uri.parse(path + "/" + name); mImageUris.add(uri); } } Comparator comparator = Collections.reverseOrder(); Collections.sort(mImageUris, comparator); say("Videos Uris loaded"); if (mImageUris.size() > 0) { currenturi = 0; dynamicUri = mImageUris.get(currenturi); } }
private void filllistview() { <DeepExtract> mImageUris.clear(); say("Loading videos Uris"); String path = Environment.getExternalStorageDirectory().toString() + "/DCIM/Camera"; Log.d("Files", "Path: " + path); File f = new File(path); File[] file = f.listFiles(); Log.d("Files", "Size: " + file.length); for (int i = 0; i < file.length; i++) { String name = file[i].getName(); if (name.contains(".mp4")) { Log.d("Files", "FileName:" + name); Uri uri = Uri.parse(path + "/" + name); mImageUris.add(uri); } } Comparator comparator = Collections.reverseOrder(); Collections.sort(mImageUris, comparator); say("Videos Uris loaded"); </DeepExtract> if (mImageUris.size() > 0) { currenturi = 0; dynamicUri = mImageUris.get(currenturi); } }
Trycorder5
positive
441,205
private int partition(int[] arr, int left, int right) { int p = arr[left]; int k = left; for (int i = left + 1; i <= right; i++) { if (arr[i] < p) { k++; swap(arr, i, k); } } if (left == k) { return; } int temp = arr[left]; arr[left] = arr[k]; arr[k] = temp; return k; }
private int partition(int[] arr, int left, int right) { int p = arr[left]; int k = left; for (int i = left + 1; i <= right; i++) { if (arr[i] < p) { k++; swap(arr, i, k); } } <DeepExtract> if (left == k) { return; } int temp = arr[left]; arr[left] = arr[k]; arr[k] = temp; </DeepExtract> return k; }
Algorithms-Learning-Java
positive
441,207
private void writeMetaFile() throws AndrolibException { MetaInfo meta = new MetaInfo(); meta.version = Androlib.getVersion(); meta.apkFileName = mApkFile.getName(); if (mDecodeResources != DECODE_RESOURCES_NONE && (hasManifest() || hasResources())) { meta.isFrameworkApk = mAndrolib.isFrameworkApk(getResTable()); putUsesFramework(meta); putSdkInfo(meta); putPackageInfo(meta); putVersionInfo(meta); putSharedLibraryInfo(meta); putSparseResourcesInfo(meta); } meta.unknownFiles = mAndrolib.mResUnknownFiles.getUnknownFiles(); if (mUncompressedFiles != null && !mUncompressedFiles.isEmpty()) { meta.doNotCompress = mUncompressedFiles; } mAndrolib.writeMetaFile(mOutDir, meta); }
private void writeMetaFile() throws AndrolibException { MetaInfo meta = new MetaInfo(); meta.version = Androlib.getVersion(); meta.apkFileName = mApkFile.getName(); if (mDecodeResources != DECODE_RESOURCES_NONE && (hasManifest() || hasResources())) { meta.isFrameworkApk = mAndrolib.isFrameworkApk(getResTable()); putUsesFramework(meta); putSdkInfo(meta); putPackageInfo(meta); putVersionInfo(meta); putSharedLibraryInfo(meta); putSparseResourcesInfo(meta); } meta.unknownFiles = mAndrolib.mResUnknownFiles.getUnknownFiles(); <DeepExtract> if (mUncompressedFiles != null && !mUncompressedFiles.isEmpty()) { meta.doNotCompress = mUncompressedFiles; } </DeepExtract> mAndrolib.writeMetaFile(mOutDir, meta); }
ratel
positive
441,210
public static void main(String[] args) { Figure2 figure2 = new Rectangle2(3, 4); System.out.println("The area of the rectangle is: " + (length * breadth)); System.out.println("******************************************************"); figure2 = new Triangle2(3, 4); System.out.println("The area of the rectangle is: " + (length * breadth)); System.out.println("******************************************************"); }
public static void main(String[] args) { Figure2 figure2 = new Rectangle2(3, 4); <DeepExtract> System.out.println("The area of the rectangle is: " + (length * breadth)); </DeepExtract> System.out.println("******************************************************"); figure2 = new Triangle2(3, 4); <DeepExtract> System.out.println("The area of the rectangle is: " + (length * breadth)); </DeepExtract> System.out.println("******************************************************"); }
JavaConcepts
positive
441,211
private static void createAndShowGUI(File file, String command) { String lookAndFeel = null; if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK+")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } JFrame.setDefaultLookAndFeelDecorated(true); HexGui app = new HexGui(file, command); }
private static void createAndShowGUI(File file, String command) { <DeepExtract> String lookAndFeel = null; if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK+")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } </DeepExtract> JFrame.setDefaultLookAndFeelDecorated(true); HexGui app = new HexGui(file, command); }
hexgui
positive
441,213
public Builder clearSectionProperties() { java.lang.Object ref = sectionProperties_; if (ref instanceof java.lang.String) { sectionProperties_ = (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); sectionProperties_ = s; sectionProperties_ = s; } onChanged(); return this; }
public Builder clearSectionProperties() { <DeepExtract> java.lang.Object ref = sectionProperties_; if (ref instanceof java.lang.String) { sectionProperties_ = (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); sectionProperties_ = s; sectionProperties_ = s; } </DeepExtract> onChanged(); return this; }
sharedstreets-builder
positive
441,215
public final void deleteDatabase() { DropDatabase dropDatabase = new DropDatabase(); dropDatabase.setDatabase(this.getDbName()); this.runMigration(dropDatabase, true); }
public final void deleteDatabase() { DropDatabase dropDatabase = new DropDatabase(); dropDatabase.setDatabase(this.getDbName()); <DeepExtract> this.runMigration(dropDatabase, true); </DeepExtract> }
rafy4j
positive
441,216
final public void header_entity() throws ParseException { Token name = null; Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == KEYWORD) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } name = token; } token = oldToken; jj_kind = KEYWORD; throw generateParseException(); Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == LPAREN) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = LPAREN; throw generateParseException(); if (jj_2_3(3)) { parameter_list(); } else { ; } if (name.image.indexOf("FILE_SCHEMA") > -1) { String schema_name = ((String[]) ((Vector) current_record.get(9)).get(0))[1]; this.setSchemaName(schema_name); } Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == RPAREN) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = RPAREN; throw generateParseException(); Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == SEMICOLON) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = SEMICOLON; throw generateParseException(); }
final public void header_entity() throws ParseException { Token name = null; Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == KEYWORD) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } name = token; } token = oldToken; jj_kind = KEYWORD; throw generateParseException(); Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == LPAREN) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = LPAREN; throw generateParseException(); if (jj_2_3(3)) { parameter_list(); } else { ; } if (name.image.indexOf("FILE_SCHEMA") > -1) { String schema_name = ((String[]) ((Vector) current_record.get(9)).get(0))[1]; this.setSchemaName(schema_name); } Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == RPAREN) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = RPAREN; throw generateParseException(); <DeepExtract> Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == SEMICOLON) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = SEMICOLON; throw generateParseException(); </DeepExtract> }
BuildingSMARTLibrary
positive
441,217
public static void setWallpaperPreference(Context context, String value) { if (preferences == null) { preferences = PreferenceManager.getDefaultSharedPreferences(context); } if (KEY_ENABLE_NOTIFICATION == null || KEY_ENABLE_NOTIFICATION.isEmpty()) { KEY_ENABLE_NOTIFICATION = context.getResources().getString(R.string.pref_key_enable_notification); } if (KEY_SHOW_LOCKSCREEN_NOTIFICATIONS == null || KEY_SHOW_LOCKSCREEN_NOTIFICATIONS.isEmpty()) { KEY_SHOW_LOCKSCREEN_NOTIFICATIONS = context.getResources().getString(R.string.pref_key_show_lockscreen_notifications); } if (KEY_HIDE_LOW_PRIORITY_NOTIFICATIONS == null || KEY_HIDE_LOW_PRIORITY_NOTIFICATIONS.isEmpty()) { KEY_HIDE_LOW_PRIORITY_NOTIFICATIONS = context.getResources().getString(R.string.pref_key_hide_low_priority_notifications); } if (KEY_HIDE_PERSISTENT_NOTIFICATIONS == null || KEY_HIDE_PERSISTENT_NOTIFICATIONS.isEmpty()) { KEY_HIDE_PERSISTENT_NOTIFICATIONS = context.getResources().getString(R.string.pref_key_hide_persistent_notifications); } if (KEY_PATTERN_TYPE == null || KEY_PATTERN_TYPE.isEmpty()) { KEY_PATTERN_TYPE = context.getResources().getString(R.string.pref_key_pattern_type); } if (KEY_PATTERN_VISIBLE == null || KEY_PATTERN_VISIBLE.isEmpty()) { KEY_PATTERN_VISIBLE = context.getResources().getString(R.string.pref_key_is_visible_pattern); } SharedPreferences.Editor editor = preferences.edit(); editor.putString(context.getString(R.string.pref_key_lockscreen_wallpaper), value); editor.apply(); preferences = null; }
public static void setWallpaperPreference(Context context, String value) { <DeepExtract> if (preferences == null) { preferences = PreferenceManager.getDefaultSharedPreferences(context); } if (KEY_ENABLE_NOTIFICATION == null || KEY_ENABLE_NOTIFICATION.isEmpty()) { KEY_ENABLE_NOTIFICATION = context.getResources().getString(R.string.pref_key_enable_notification); } if (KEY_SHOW_LOCKSCREEN_NOTIFICATIONS == null || KEY_SHOW_LOCKSCREEN_NOTIFICATIONS.isEmpty()) { KEY_SHOW_LOCKSCREEN_NOTIFICATIONS = context.getResources().getString(R.string.pref_key_show_lockscreen_notifications); } if (KEY_HIDE_LOW_PRIORITY_NOTIFICATIONS == null || KEY_HIDE_LOW_PRIORITY_NOTIFICATIONS.isEmpty()) { KEY_HIDE_LOW_PRIORITY_NOTIFICATIONS = context.getResources().getString(R.string.pref_key_hide_low_priority_notifications); } if (KEY_HIDE_PERSISTENT_NOTIFICATIONS == null || KEY_HIDE_PERSISTENT_NOTIFICATIONS.isEmpty()) { KEY_HIDE_PERSISTENT_NOTIFICATIONS = context.getResources().getString(R.string.pref_key_hide_persistent_notifications); } if (KEY_PATTERN_TYPE == null || KEY_PATTERN_TYPE.isEmpty()) { KEY_PATTERN_TYPE = context.getResources().getString(R.string.pref_key_pattern_type); } if (KEY_PATTERN_VISIBLE == null || KEY_PATTERN_VISIBLE.isEmpty()) { KEY_PATTERN_VISIBLE = context.getResources().getString(R.string.pref_key_is_visible_pattern); } </DeepExtract> SharedPreferences.Editor editor = preferences.edit(); editor.putString(context.getString(R.string.pref_key_lockscreen_wallpaper), value); editor.apply(); preferences = null; }
SmartLockScreen
positive
441,219
@Override public Object read(final Kryo kryo, final Input input, final Class<Object> clazz) { final int ordinal = input.readInt(true); final UnmodifiableCollection unmodifiableCollection = UnmodifiableCollection.values()[ordinal]; final Object sourceCollection = kryo.readClassAndObject(input); return Collections.unmodifiableCollection((Collection<?>) sourceCollection); }
@Override public Object read(final Kryo kryo, final Input input, final Class<Object> clazz) { final int ordinal = input.readInt(true); final UnmodifiableCollection unmodifiableCollection = UnmodifiableCollection.values()[ordinal]; final Object sourceCollection = kryo.readClassAndObject(input); <DeepExtract> return Collections.unmodifiableCollection((Collection<?>) sourceCollection); </DeepExtract> }
nextflow
positive
441,220
public void read(CDataReadWriteAccess in) throws IOException { byte[] magic = new byte[BLENDER_MAGIC.length()]; in.readFully(magic); if (!CStringUtils.toString(magic).equals(BLENDER_MAGIC)) { throw new IOException("not a blender file"); } char c = (char) in.readByte(); if (c == LITTLE_ENDIAN.code) pointerSize = LITTLE_ENDIAN; else if (c == BIG_ENDIAN.code) pointerSize = BIG_ENDIAN; else throw new IllegalArgumentException("undefined endianess code '" + in.readByte() + "'"); char c = (char) in.readByte(); if (c == LITTLE_ENDIAN.code) endianess = LITTLE_ENDIAN; else if (c == BIG_ENDIAN.code) endianess = BIG_ENDIAN; else throw new IllegalArgumentException("undefined endianess code '" + in.readByte() + "'"); version = Version.read(in); }
public void read(CDataReadWriteAccess in) throws IOException { byte[] magic = new byte[BLENDER_MAGIC.length()]; in.readFully(magic); if (!CStringUtils.toString(magic).equals(BLENDER_MAGIC)) { throw new IOException("not a blender file"); } char c = (char) in.readByte(); if (c == LITTLE_ENDIAN.code) pointerSize = LITTLE_ENDIAN; else if (c == BIG_ENDIAN.code) pointerSize = BIG_ENDIAN; else throw new IllegalArgumentException("undefined endianess code '" + in.readByte() + "'"); <DeepExtract> char c = (char) in.readByte(); if (c == LITTLE_ENDIAN.code) endianess = LITTLE_ENDIAN; else if (c == BIG_ENDIAN.code) endianess = BIG_ENDIAN; else throw new IllegalArgumentException("undefined endianess code '" + in.readByte() + "'"); </DeepExtract> version = Version.read(in); }
org.cakelab.blender.io
positive
441,221
public static String certificateToPEMEncoded(String content) { if ("CERTIFICATE" == null) { throw new NullPointerException("title is null"); } if (content == null) { return null; } if (content.length() > MAX_DATA_LENGTH) { throw new RuntimeException("content length out of limit, current:" + content.length() + ", limit:" + MAX_DATA_LENGTH); } int lineNum = (content.length() >> 6) + 1; StringBuilder stringBuilder = new StringBuilder(content.length() + lineNum + ("CERTIFICATE".length() << 1) + HEAD_TAIL_LENGTH); stringBuilder.append(HEAD_PREFIX); stringBuilder.append("CERTIFICATE"); stringBuilder.append(HEAD_SUFFIX); int line = 0; int start; for (; line < lineNum - 1; line++) { start = line << 6; stringBuilder.append(content, start, start + 64); stringBuilder.append(NEWLINE); } start = line << 6; if (start < content.length() - 1) { stringBuilder.append(content, start, content.length()); stringBuilder.append(NEWLINE); } stringBuilder.append(TAIL_PREFIX); stringBuilder.append("CERTIFICATE"); stringBuilder.append(TAIL_SUFFIX); return stringBuilder.toString(); }
public static String certificateToPEMEncoded(String content) { <DeepExtract> if ("CERTIFICATE" == null) { throw new NullPointerException("title is null"); } if (content == null) { return null; } if (content.length() > MAX_DATA_LENGTH) { throw new RuntimeException("content length out of limit, current:" + content.length() + ", limit:" + MAX_DATA_LENGTH); } int lineNum = (content.length() >> 6) + 1; StringBuilder stringBuilder = new StringBuilder(content.length() + lineNum + ("CERTIFICATE".length() << 1) + HEAD_TAIL_LENGTH); stringBuilder.append(HEAD_PREFIX); stringBuilder.append("CERTIFICATE"); stringBuilder.append(HEAD_SUFFIX); int line = 0; int start; for (; line < lineNum - 1; line++) { start = line << 6; stringBuilder.append(content, start, start + 64); stringBuilder.append(NEWLINE); } start = line << 6; if (start < content.length() - 1) { stringBuilder.append(content, start, content.length()); stringBuilder.append(NEWLINE); } stringBuilder.append(TAIL_PREFIX); stringBuilder.append("CERTIFICATE"); stringBuilder.append(TAIL_SUFFIX); return stringBuilder.toString(); </DeepExtract> }
thistle
positive
441,227
public List<List<Integer>> combinationSum2(int[] cand, int target) { Arrays.sort(cand); List<List<Integer>> res = new ArrayList<List<Integer>>(); List<Integer> path = new ArrayList<Integer>(); if (target == 0) { res.add(new ArrayList(path)); return; } if (target < 0) return; for (int i = 0; i < cand.length; i++) { if (i > 0 && cand[i] == cand[i - 1]) continue; path.add(path.size(), cand[i]); dfs_com(cand, i + 1, target - cand[i], path, res); path.remove(path.size() - 1); } return res; }
public List<List<Integer>> combinationSum2(int[] cand, int target) { Arrays.sort(cand); List<List<Integer>> res = new ArrayList<List<Integer>>(); List<Integer> path = new ArrayList<Integer>(); <DeepExtract> if (target == 0) { res.add(new ArrayList(path)); return; } if (target < 0) return; for (int i = 0; i < cand.length; i++) { if (i > 0 && cand[i] == cand[i - 1]) continue; path.add(path.size(), cand[i]); dfs_com(cand, i + 1, target - cand[i], path, res); path.remove(path.size() - 1); } </DeepExtract> return res; }
Leetcode-for-Fun
positive
441,228
public void submit(Runnable task) { Future future = comletions.submit(task, null); futures.add(future); if (future.isDone()) { try { future.get(); } catch (Throwable e) { cacelAllFutures(); throw new RuntimeException(e); } } }
public void submit(Runnable task) { Future future = comletions.submit(task, null); futures.add(future); <DeepExtract> if (future.isDone()) { try { future.get(); } catch (Throwable e) { cacelAllFutures(); throw new RuntimeException(e); } } </DeepExtract> }
yugong
positive
441,229
public static void w(String tag, String msg) { if (DEBUG) { int strLength = msg.length(); int start = 0; int end = LOG_MAX_LENGTH; int logPart = 50; for (int i = 0; i < logPart; i++) { if (strLength > end) { switch(W) { case V: Log.v(tag + i, msg.substring(start, end)); break; case D: Log.d(tag + i, msg.substring(start, end)); break; case I: Log.i(tag + i, msg.substring(start, end)); break; case W: Log.w(tag + i, msg.substring(start, end)); break; case E: Log.e(tag + i, msg.substring(start, end)); break; default: break; } start = end; end = end + LOG_MAX_LENGTH; } else { switch(W) { case V: Log.v(tag, msg.substring(start, strLength)); break; case D: Log.d(tag, msg.substring(start, strLength)); break; case I: Log.i(tag, msg.substring(start, strLength)); break; case W: Log.w(tag, msg.substring(start, strLength)); break; case E: Log.e(tag, msg.substring(start, strLength)); break; default: break; } break; } } } }
public static void w(String tag, String msg) { <DeepExtract> if (DEBUG) { int strLength = msg.length(); int start = 0; int end = LOG_MAX_LENGTH; int logPart = 50; for (int i = 0; i < logPart; i++) { if (strLength > end) { switch(W) { case V: Log.v(tag + i, msg.substring(start, end)); break; case D: Log.d(tag + i, msg.substring(start, end)); break; case I: Log.i(tag + i, msg.substring(start, end)); break; case W: Log.w(tag + i, msg.substring(start, end)); break; case E: Log.e(tag + i, msg.substring(start, end)); break; default: break; } start = end; end = end + LOG_MAX_LENGTH; } else { switch(W) { case V: Log.v(tag, msg.substring(start, strLength)); break; case D: Log.d(tag, msg.substring(start, strLength)); break; case I: Log.i(tag, msg.substring(start, strLength)); break; case W: Log.w(tag, msg.substring(start, strLength)); break; case E: Log.e(tag, msg.substring(start, strLength)); break; default: break; } break; } } } </DeepExtract> }
StockAssistant
positive
441,233
private boolean bindTexture(BasicTexture texture) { if (!texture.onBind(this)) { return false; } int target = texture.getTarget(); if (mTextureTarget == target) { return; } if (mTextureTarget != 0) { mGL.glDisable(mTextureTarget); } mTextureTarget = target; if (mTextureTarget != 0) { mGL.glEnable(mTextureTarget); } mGL.glBindTexture(target, texture.getId()); return true; }
private boolean bindTexture(BasicTexture texture) { if (!texture.onBind(this)) { return false; } int target = texture.getTarget(); <DeepExtract> if (mTextureTarget == target) { return; } if (mTextureTarget != 0) { mGL.glDisable(mTextureTarget); } mTextureTarget = target; if (mTextureTarget != 0) { mGL.glEnable(mTextureTarget); } </DeepExtract> mGL.glBindTexture(target, texture.getId()); return true; }
PhotoMovie
positive
441,234
protected void writeNoraUiCliFiles(NoraUiCliFile noraUiCliFile, boolean verbose) { Gson gson = new GsonBuilder().setPrettyPrinting().create(); for (NoraUiApplicationFile noraUiApplicationFile : noraUiCliFile.getApplicationFiles()) { if (new File(CLI_FILES_DIR + File.separator + CLI_APPLICATIONS_FILES_DIR + File.separator + noraUiApplicationFile.getName() + JSON).exists() && !noraUiApplicationFile.getStatus()) { deleteFileApplicationsNoraUiCliFiles(verbose, noraUiApplicationFile); } if (noraUiApplicationFile.getStatus()) { createFileApplicationsNoraUiCliFiles(verbose, gson, noraUiApplicationFile); updateFileApplicationsNoraUiCliFiles(gson, noraUiApplicationFile); } } for (NoraUiScenarioFile noraUiScenarioFile : noraUiCliFile.getScenarioFiles()) { if (new File(CLI_FILES_DIR + File.separator + CLI_SCENARIOS_FILES_DIR + File.separator + noraUiScenarioFile.getName() + JSON).exists() && !noraUiScenarioFile.getStatus()) { deleteFileScenarioNoraUiCliFiles(verbose, noraUiScenarioFile); } if (noraUiScenarioFile.getStatus()) { createFileScenarioNoraUiCliFiles(verbose, gson, noraUiScenarioFile); updateFileScenarioNoraUiCliFiles(gson, noraUiScenarioFile); } } }
protected void writeNoraUiCliFiles(NoraUiCliFile noraUiCliFile, boolean verbose) { Gson gson = new GsonBuilder().setPrettyPrinting().create(); for (NoraUiApplicationFile noraUiApplicationFile : noraUiCliFile.getApplicationFiles()) { if (new File(CLI_FILES_DIR + File.separator + CLI_APPLICATIONS_FILES_DIR + File.separator + noraUiApplicationFile.getName() + JSON).exists() && !noraUiApplicationFile.getStatus()) { deleteFileApplicationsNoraUiCliFiles(verbose, noraUiApplicationFile); } if (noraUiApplicationFile.getStatus()) { createFileApplicationsNoraUiCliFiles(verbose, gson, noraUiApplicationFile); updateFileApplicationsNoraUiCliFiles(gson, noraUiApplicationFile); } } <DeepExtract> for (NoraUiScenarioFile noraUiScenarioFile : noraUiCliFile.getScenarioFiles()) { if (new File(CLI_FILES_DIR + File.separator + CLI_SCENARIOS_FILES_DIR + File.separator + noraUiScenarioFile.getName() + JSON).exists() && !noraUiScenarioFile.getStatus()) { deleteFileScenarioNoraUiCliFiles(verbose, noraUiScenarioFile); } if (noraUiScenarioFile.getStatus()) { createFileScenarioNoraUiCliFiles(verbose, gson, noraUiScenarioFile); updateFileScenarioNoraUiCliFiles(gson, noraUiScenarioFile); } } </DeepExtract> }
NoraUi
positive
441,235
public void actionPerformed(java.awt.event.ActionEvent evt) { JFrame help = new JFrame(); JLabel helptext = new JLabel(); help.setName("help"); helptext.setText("<HTML><center>You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE</center><br><br>" + "<ul><li><b>1 : map values * albedo;</li>" + "<li><b>2 : map values ^ albedo;</li>" + "</ul></HTML>"); help.setLayout(new BorderLayout()); help.setSize(500, 160); help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); help.setTitle("Metalness Map Apply Scale Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); BufferedImage myImg = ImageIO.read(imgStream); help.setIconImage(myImg); } catch (IOException ex) { } }
public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> JFrame help = new JFrame(); JLabel helptext = new JLabel(); help.setName("help"); helptext.setText("<HTML><center>You can apply color from const float3 albedo = 1.0; to change colors in your texture by set code to the ALBEDO_MAP_APPLY_SCALE</center><br><br>" + "<ul><li><b>1 : map values * albedo;</li>" + "<li><b>2 : map values ^ albedo;</li>" + "</ul></HTML>"); help.setLayout(new BorderLayout()); help.setSize(500, 160); help.setLocationRelativeTo(this); help.setResizable(true); help.setVisible(true); help.add(helptext); help.setTitle("Metalness Map Apply Scale Help"); try { InputStream imgStream = getClass().getResourceAsStream("/icon/ico.png"); BufferedImage myImg = ImageIO.read(imgStream); help.setIconImage(myImg); } catch (IOException ex) { } </DeepExtract> }
RMT
positive
441,237
final private void listOfAttributes() throws ParseException { switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BACKTICK: jj_consume_token(BACKTICK); jj_consume_token(IDENTIFIER); label_2: while (true) { switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case DOT: ; break; default: jj_la1[5] = jj_gen; break label_2; } jj_consume_token(DOT); jj_consume_token(IDENTIFIER); } jj_consume_token(BACKTICK); break; case IDENTIFIER: jj_consume_token(IDENTIFIER); break; default: jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } label_1: while (true) { switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[4] = jj_gen; break label_1; } jj_consume_token(COMMA); attributeName(); } }
final private void listOfAttributes() throws ParseException { <DeepExtract> switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case BACKTICK: jj_consume_token(BACKTICK); jj_consume_token(IDENTIFIER); label_2: while (true) { switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case DOT: ; break; default: jj_la1[5] = jj_gen; break label_2; } jj_consume_token(DOT); jj_consume_token(IDENTIFIER); } jj_consume_token(BACKTICK); break; case IDENTIFIER: jj_consume_token(IDENTIFIER); break; default: jj_la1[6] = jj_gen; jj_consume_token(-1); throw new ParseException(); } </DeepExtract> label_1: while (true) { switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case COMMA: ; break; default: jj_la1[4] = jj_gen; break label_1; } jj_consume_token(COMMA); attributeName(); } }
spring-data-simpledb
positive
441,238
public void sendInitialPacket() throws ProtocolException { ByteBuffer buffer = ByteBuffer.allocate(2 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 16 + 96 + 128 + 1 + 1 + 2 + 0 + this.session.username.length + 1); buffer.putShort((short) 3); buffer.putShort((short) 0); buffer.putInt(this.session.clientOs); buffer.putInt(0x00000000); buffer.putInt(this.session.clientRevision); buffer.putInt(0x1541ECD0); buffer.putInt(0x01000000); buffer.putInt(this.session.clientId); buffer.putInt(0x00000001); buffer.put(this.session.clientRandom); buffer.put(this.session.dhClientKeyPair.getPublicKeyBytes()); buffer.put(this.session.rsaClientKeyPair.getPublicKeyBytes()); buffer.put((byte) 0); buffer.put((byte) this.session.username.length); buffer.putShort((short) 0x0100); buffer.put(this.session.username); buffer.put((byte) 0x5F); buffer.putShort(2, (short) buffer.position()); buffer.flip(); this.session.initialClientPacket = new byte[buffer.remaining()]; buffer.get(this.session.initialClientPacket); buffer.flip(); try { this.channel.write(buffer); } catch (IOException e) { throw new ProtocolException("Error writing data to socket!", e); } }
public void sendInitialPacket() throws ProtocolException { ByteBuffer buffer = ByteBuffer.allocate(2 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 16 + 96 + 128 + 1 + 1 + 2 + 0 + this.session.username.length + 1); buffer.putShort((short) 3); buffer.putShort((short) 0); buffer.putInt(this.session.clientOs); buffer.putInt(0x00000000); buffer.putInt(this.session.clientRevision); buffer.putInt(0x1541ECD0); buffer.putInt(0x01000000); buffer.putInt(this.session.clientId); buffer.putInt(0x00000001); buffer.put(this.session.clientRandom); buffer.put(this.session.dhClientKeyPair.getPublicKeyBytes()); buffer.put(this.session.rsaClientKeyPair.getPublicKeyBytes()); buffer.put((byte) 0); buffer.put((byte) this.session.username.length); buffer.putShort((short) 0x0100); buffer.put(this.session.username); buffer.put((byte) 0x5F); buffer.putShort(2, (short) buffer.position()); buffer.flip(); this.session.initialClientPacket = new byte[buffer.remaining()]; buffer.get(this.session.initialClientPacket); buffer.flip(); <DeepExtract> try { this.channel.write(buffer); } catch (IOException e) { throw new ProtocolException("Error writing data to socket!", e); } </DeepExtract> }
jotify
positive
441,239
public boolean visit(PostfixExpression expr) { int lin = compilationUnit.getLineNumber(expr.getStartPosition()); if (lines.contains(lin)) { MethodDeclaration md = findMethod(expr); if (md != null) { String methodName = md.getName().getIdentifier(); String className = JavaUtil.getFullNameOfCompilationUnit(compilationUnit); ClassLocation location = new ClassLocation(className, methodName, lin); mutationPoints.add(location); } } return false; }
public boolean visit(PostfixExpression expr) { <DeepExtract> int lin = compilationUnit.getLineNumber(expr.getStartPosition()); if (lines.contains(lin)) { MethodDeclaration md = findMethod(expr); if (md != null) { String methodName = md.getName().getIdentifier(); String className = JavaUtil.getFullNameOfCompilationUnit(compilationUnit); ClassLocation location = new ClassLocation(className, methodName, lin); mutationPoints.add(location); } } </DeepExtract> return false; }
tregression
positive
441,242
public void rgb(int r, int g, int b) throws ExecutionException { if (Platform.isFxApplicationThread()) { body.getGraphicsContext2D().setFill(Color.web(Color.rgb(r, g, b).toString())); body.getGraphicsContext2D().setStroke(Color.web(Color.rgb(r, g, b).toString())); } else { counter++; if (counter > maxCounter) { throw new ExecutionException(new Exception(hint)); } Platform.runLater(() -> { body.getGraphicsContext2D().setFill(Color.web(Color.rgb(r, g, b).toString())); body.getGraphicsContext2D().setStroke(Color.web(Color.rgb(r, g, b).toString())); }); } }
public void rgb(int r, int g, int b) throws ExecutionException { <DeepExtract> if (Platform.isFxApplicationThread()) { body.getGraphicsContext2D().setFill(Color.web(Color.rgb(r, g, b).toString())); body.getGraphicsContext2D().setStroke(Color.web(Color.rgb(r, g, b).toString())); } else { counter++; if (counter > maxCounter) { throw new ExecutionException(new Exception(hint)); } Platform.runLater(() -> { body.getGraphicsContext2D().setFill(Color.web(Color.rgb(r, g, b).toString())); body.getGraphicsContext2D().setStroke(Color.web(Color.rgb(r, g, b).toString())); }); } </DeepExtract> }
xbrowser
positive
441,243
public UdsServer getAlarm() { UdsServer tmp = null; for (UdsServer udsServer : getUdsServerList()) { if (udsServer.getNodeClusterType().equals(Constants.THREAD_NAME_ALARM_SERVER)) { if (!udsServer.getIsEnable()) { continue; } if (ObjectUtils.isEmpty(tmp) || tmp.getId() > udsServer.getId()) { tmp = udsServer; } } } return tmp; }
public UdsServer getAlarm() { <DeepExtract> UdsServer tmp = null; for (UdsServer udsServer : getUdsServerList()) { if (udsServer.getNodeClusterType().equals(Constants.THREAD_NAME_ALARM_SERVER)) { if (!udsServer.getIsEnable()) { continue; } if (ObjectUtils.isEmpty(tmp) || tmp.getId() > udsServer.getId()) { tmp = udsServer; } } } return tmp; </DeepExtract> }
harrier
positive
441,246
public Criteria andNotifierNameNotIn(List<String> values) { if (values == null) { throw new RuntimeException("Value for " + "notifierName" + " cannot be null"); } criteria.add(new Criterion("notifier_name not in", values)); return (Criteria) this; }
public Criteria andNotifierNameNotIn(List<String> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "notifierName" + " cannot be null"); } criteria.add(new Criterion("notifier_name not in", values)); </DeepExtract> return (Criteria) this; }
community
positive
441,247
@Test public void testNoExtensionAtRoot() { Path originalPath = Paths.get("test"); Path expectedPath = Paths.get("test.santa"); Path actual = FileNameTool.ensureSessionFileHasSuffix(originalPath); assertEquals(expectedPath, actual, "Path match"); }
@Test public void testNoExtensionAtRoot() { <DeepExtract> Path originalPath = Paths.get("test"); Path expectedPath = Paths.get("test.santa"); Path actual = FileNameTool.ensureSessionFileHasSuffix(originalPath); assertEquals(expectedPath, actual, "Path match"); </DeepExtract> }
Santulator
positive
441,248
void initRobot() { _motorCntrller.set(TalonFXControlMode.PercentOutput, 0); _motorCntrller.configFactoryDefault(); _canifLimits.configFactoryDefault(); _talonLimits.configFactoryDefault(); _imu.configFactoryDefault(); _talonLimits.configSelectedFeedbackSensor(TalonFXFeedbackDevice.IntegratedSensor, 0, 0); _motorCntrller.setSensorPhase(true); _motorCntrller.setInverted(false); _motorCntrller.configForwardSoftLimitEnable(true, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitEnable(true, Constants.kTimeoutMs); _canifLimits.setStatusFramePeriod(CANifierStatusFrame.Status_2_General, 10, Constants.kTimeoutMs); _canifLimits.setStatusFramePeriod(CANifierStatusFrame.Status_4_PwmInputs1, 10, Constants.kTimeoutMs); if (1 == 1) { _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.IntegratedSensor, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Quad, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Quad, Constants.kTimeoutMs); System.out.println("Using local integrated sensor."); } else if (1 == 2) { _motorCntrller.configRemoteFeedbackFilter(_talonLimits.getDeviceID(), RemoteSensorSource.TalonFX_SelectedSensor, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor0, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Quad, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Quad, Constants.kTimeoutMs); System.out.println("Using remote Talon's sensor."); } else if (1 == 3) { _motorCntrller.configRemoteFeedbackFilter(_canifLimits.getDeviceID(), RemoteSensorSource.CANifier_Quadrature, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor0, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Quad, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Quad, Constants.kTimeoutMs); System.out.println("Using remote CANifier's quadrature encoder."); } else if (1 == 4) { _motorCntrller.configRemoteFeedbackFilter(_talonLimits.getDeviceID(), RemoteSensorSource.GadgeteerPigeon_Yaw, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor0, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Pigeon, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Pigeon, Constants.kTimeoutMs); System.out.println("Using remote Pigeon Yaw that is plugged into a remote Talon."); } else if (1 == 5) { _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(_imu.getDeviceID(), RemoteSensorSource.Pigeon_Yaw, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor1, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Pigeon, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Pigeon, Constants.kTimeoutMs); System.out.println("Using remote Pigeon that is CAN bus connected."); } else if (1 == 7) { _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(_canifLimits.getDeviceID(), RemoteSensorSource.CANifier_PWMInput0, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor1, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_PWMInput, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_PWMInput, Constants.kTimeoutMs); System.out.println("Using remote CANifier PWM input 1."); } }
void initRobot() { _motorCntrller.set(TalonFXControlMode.PercentOutput, 0); _motorCntrller.configFactoryDefault(); _canifLimits.configFactoryDefault(); _talonLimits.configFactoryDefault(); _imu.configFactoryDefault(); _talonLimits.configSelectedFeedbackSensor(TalonFXFeedbackDevice.IntegratedSensor, 0, 0); _motorCntrller.setSensorPhase(true); _motorCntrller.setInverted(false); _motorCntrller.configForwardSoftLimitEnable(true, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitEnable(true, Constants.kTimeoutMs); _canifLimits.setStatusFramePeriod(CANifierStatusFrame.Status_2_General, 10, Constants.kTimeoutMs); _canifLimits.setStatusFramePeriod(CANifierStatusFrame.Status_4_PwmInputs1, 10, Constants.kTimeoutMs); <DeepExtract> if (1 == 1) { _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.IntegratedSensor, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Quad, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Quad, Constants.kTimeoutMs); System.out.println("Using local integrated sensor."); } else if (1 == 2) { _motorCntrller.configRemoteFeedbackFilter(_talonLimits.getDeviceID(), RemoteSensorSource.TalonFX_SelectedSensor, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor0, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Quad, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Quad, Constants.kTimeoutMs); System.out.println("Using remote Talon's sensor."); } else if (1 == 3) { _motorCntrller.configRemoteFeedbackFilter(_canifLimits.getDeviceID(), RemoteSensorSource.CANifier_Quadrature, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor0, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Quad, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Quad, Constants.kTimeoutMs); System.out.println("Using remote CANifier's quadrature encoder."); } else if (1 == 4) { _motorCntrller.configRemoteFeedbackFilter(_talonLimits.getDeviceID(), RemoteSensorSource.GadgeteerPigeon_Yaw, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor0, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Pigeon, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Pigeon, Constants.kTimeoutMs); System.out.println("Using remote Pigeon Yaw that is plugged into a remote Talon."); } else if (1 == 5) { _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(_imu.getDeviceID(), RemoteSensorSource.Pigeon_Yaw, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor1, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_Pigeon, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_Pigeon, Constants.kTimeoutMs); System.out.println("Using remote Pigeon that is CAN bus connected."); } else if (1 == 7) { _motorCntrller.configRemoteFeedbackFilter(0x00, RemoteSensorSource.Off, Constants.REMOTE_0, Constants.kTimeoutMs); _motorCntrller.configRemoteFeedbackFilter(_canifLimits.getDeviceID(), RemoteSensorSource.CANifier_PWMInput0, Constants.REMOTE_1, Constants.kTimeoutMs); _motorCntrller.configSelectedFeedbackSensor(TalonFXFeedbackDevice.RemoteSensor1, Constants.PID_PRIMARY, Constants.kTimeoutMs); _motorCntrller.configForwardSoftLimitThreshold(Constants.kForwardSoftLimit_PWMInput, Constants.kTimeoutMs); _motorCntrller.configReverseSoftLimitThreshold(Constants.kReverseSoftLimit_PWMInput, Constants.kTimeoutMs); System.out.println("Using remote CANifier PWM input 1."); } </DeepExtract> }
Phoenix-Examples-Languages
positive
441,249
@Test public void testExtractorEn() throws Exception { ex = new RedirectExtractor("en", new File(RESOURCESPATH + "/input/" + enWikiFileName)); ex.extract(new File(RESOURCESPATH + "/output"), new File(RESOURCESPATH + "/output"), "testing RedirectExtractor in language: " + "en"); compareOutputWithExpected("en"); }
@Test public void testExtractorEn() throws Exception { <DeepExtract> ex = new RedirectExtractor("en", new File(RESOURCESPATH + "/input/" + enWikiFileName)); ex.extract(new File(RESOURCESPATH + "/output"), new File(RESOURCESPATH + "/output"), "testing RedirectExtractor in language: " + "en"); compareOutputWithExpected("en"); </DeepExtract> }
yago3
positive
441,251
@Override public void caseAFuncExprAgo(AFuncExprAgo node) { if (this != ExpressionCompiler.this) throw new RuntimeException("unexpected switch"); invokeOperator(UnaryOperator.TIME, exprString); }
@Override public void caseAFuncExprAgo(AFuncExprAgo node) { <DeepExtract> if (this != ExpressionCompiler.this) throw new RuntimeException("unexpected switch"); invokeOperator(UnaryOperator.TIME, exprString); </DeepExtract> }
arden2bytecode
positive
441,253
@Test public void executeOrder_SellCounterActionDifferentQtd() { TradingParams.trading_position_edit_enabled = true; OrderBuilder orderBuilder = new OrderBuilder(); OrderDto orderBuy = orderBuilder.build(); OrderDto orderSell = orderBuilder.withAction(OrderDto.OrderAction.SELL).withQtd(100).build(); simulatedBroker.executeOrder(orderBuy); simulatedBroker.executeOrder(orderSell); Map<String, FilledOrderDto> portfolio; assertTrue(simulatedBroker.getPortfolio().isEmpty()); OrderBuilder orderBuilder = new OrderBuilder(); OrderDto build = orderBuilder.build(); simulatedBroker.executeOrder(build); assertEquals(1, simulatedBroker.getPortfolio().size()); assertEquals(1, portfolio.size()); assertEquals(900, portfolio.get(orderBuy.symbol()).quantity()); }
@Test public void executeOrder_SellCounterActionDifferentQtd() { TradingParams.trading_position_edit_enabled = true; OrderBuilder orderBuilder = new OrderBuilder(); OrderDto orderBuy = orderBuilder.build(); OrderDto orderSell = orderBuilder.withAction(OrderDto.OrderAction.SELL).withQtd(100).build(); simulatedBroker.executeOrder(orderBuy); simulatedBroker.executeOrder(orderSell); <DeepExtract> Map<String, FilledOrderDto> portfolio; assertTrue(simulatedBroker.getPortfolio().isEmpty()); OrderBuilder orderBuilder = new OrderBuilder(); OrderDto build = orderBuilder.build(); simulatedBroker.executeOrder(build); assertEquals(1, simulatedBroker.getPortfolio().size()); </DeepExtract> assertEquals(1, portfolio.size()); assertEquals(900, portfolio.get(orderBuy.symbol()).quantity()); }
trading-system
positive
441,254
public static int find_in_sorted(int[] arr, int x) { if (0 == arr.length) { return -1; } int mid = 0 + (arr.length - 0) / 2; if (x < arr[mid]) { return binsearch(arr, x, 0, mid); } else if (x > arr[mid]) { return binsearch(arr, x, mid, arr.length); } else { return mid; } }
public static int find_in_sorted(int[] arr, int x) { <DeepExtract> if (0 == arr.length) { return -1; } int mid = 0 + (arr.length - 0) / 2; if (x < arr[mid]) { return binsearch(arr, x, 0, mid); } else if (x > arr[mid]) { return binsearch(arr, x, mid, arr.length); } else { return mid; } </DeepExtract> }
QuixBugs
positive
441,255
void setRunArguments(String args) { if (!initialized) { initialized = true; load(); } synchronized (this) { this.runArguments = runArguments; } task.schedule(1000); }
void setRunArguments(String args) { <DeepExtract> if (!initialized) { initialized = true; load(); } </DeepExtract> synchronized (this) { this.runArguments = runArguments; } task.schedule(1000); }
nb-nodejs
positive
441,256
private void parseOr(NfaParserView nfa) throws ReSyntaxException { parsePostfixedAtom(nfa); while (token != TOK_EOF && token != TOK_OR && token != TOK_CPAREN) { parsePostfixedAtom(nfa); nfa.seq(); } while (token == TOK_OR) { nextToken(); parseSequence(nfa); nfa.or(); } }
private void parseOr(NfaParserView nfa) throws ReSyntaxException { <DeepExtract> parsePostfixedAtom(nfa); while (token != TOK_EOF && token != TOK_OR && token != TOK_CPAREN) { parsePostfixedAtom(nfa); nfa.seq(); } </DeepExtract> while (token == TOK_OR) { nextToken(); parseSequence(nfa); nfa.or(); } }
monqjfa
positive
441,257
@Override public boolean apply(PackageEntry packageEntry) { log.debug("Emitting summary for package {}", packageEntry.name()); packageEntry.subPackages().allMatch(emitPackageSummary()); packageEntry.classes().allMatch(emitClassSummary(packageEntry)); return true; }
@Override public boolean apply(PackageEntry packageEntry) { <DeepExtract> log.debug("Emitting summary for package {}", packageEntry.name()); packageEntry.subPackages().allMatch(emitPackageSummary()); packageEntry.classes().allMatch(emitClassSummary(packageEntry)); </DeepExtract> return true; }
tzatziki
positive
441,258
@Nullable public static Object invoke(Object instance, Method method, Object... arguments) { if (method == null) { return null; } if (!method.isAccessible()) { method.setAccessible(true); } return method; try { return method.invoke(instance, arguments); } catch (IllegalAccessException | InvocationTargetException exception) { exception.printStackTrace(); return null; } }
@Nullable public static Object invoke(Object instance, Method method, Object... arguments) { if (method == null) { return null; } <DeepExtract> if (!method.isAccessible()) { method.setAccessible(true); } return method; </DeepExtract> try { return method.invoke(instance, arguments); } catch (IllegalAccessException | InvocationTargetException exception) { exception.printStackTrace(); return null; } }
Floodgate
positive
441,259
@Override public boolean canProvideTo(EnumFacing direction) { return direction == null || settings.get(direction) == Mode.SETTING_PROVIDE; }
@Override public boolean canProvideTo(EnumFacing direction) { <DeepExtract> return direction == null || settings.get(direction) == Mode.SETTING_PROVIDE; </DeepExtract> }
DeepResonance
positive
441,261
@Override public FirstOrderFunctionCall<IntegerValue> newCall(final List<Expression<?>> argExpressions, final Datatype<?>... remainingArgTypes) throws IllegalArgumentException { return new Call(funcSig, argExpressions, remainingArgTypes); }
@Override public FirstOrderFunctionCall<IntegerValue> newCall(final List<Expression<?>> argExpressions, final Datatype<?>... remainingArgTypes) throws IllegalArgumentException { <DeepExtract> return new Call(funcSig, argExpressions, remainingArgTypes); </DeepExtract> }
core
positive
441,262
@Test public void testRefreshFlowsCreateQosQosTapsWithExistingQosTap() { updateThenRefreshFlowsThenCheck(qtapA); writeEvents(eventsA[0], eventsB[0], eventsC[0]); forTap(qtapA).verifyEvents(eventsA[0]); forTap(qtapB).verifyNoFlow(); forTap(qtapC).verifyNoFlow(); updateThenRefreshFlowsThenCheck(qtapA, qtapB, qtapC); writeEvents(eventsA[1], eventsB[1], eventsC[1]); forTap(qtapA).verifyEvents(eventsA[0], eventsA[1]); forTap(qtapB).verifyEvents(eventsB[1]); forTap(qtapC).verifyEvents(eventsC[1]); updateThenRefreshFlowsThenCheck(qtapA); writeEvents(eventsA[2], eventsB[2], eventsC[2]); forTap(qtapA).verifyEvents(eventsA[0], eventsA[1], eventsA[2]); forTap(qtapB).verifyEvents(eventsB[1]); forTap(qtapC).verifyEvents(eventsC[1]); }
@Test public void testRefreshFlowsCreateQosQosTapsWithExistingQosTap() { <DeepExtract> updateThenRefreshFlowsThenCheck(qtapA); writeEvents(eventsA[0], eventsB[0], eventsC[0]); forTap(qtapA).verifyEvents(eventsA[0]); forTap(qtapB).verifyNoFlow(); forTap(qtapC).verifyNoFlow(); updateThenRefreshFlowsThenCheck(qtapA, qtapB, qtapC); writeEvents(eventsA[1], eventsB[1], eventsC[1]); forTap(qtapA).verifyEvents(eventsA[0], eventsA[1]); forTap(qtapB).verifyEvents(eventsB[1]); forTap(qtapC).verifyEvents(eventsC[1]); updateThenRefreshFlowsThenCheck(qtapA); writeEvents(eventsA[2], eventsB[2], eventsC[2]); forTap(qtapA).verifyEvents(eventsA[0], eventsA[1], eventsA[2]); forTap(qtapB).verifyEvents(eventsB[1]); forTap(qtapC).verifyEvents(eventsC[1]); </DeepExtract> }
event-collector
positive
441,265
public void restart(Runnable stoppedLogic) { testContextManager.getTestContext().markApplicationContextDirty(DirtiesContext.HierarchyMode.EXHAUSTIVE); if (stoppedLogic != null) { stoppedLogic.run(); } testContextManager.getTestContext().getApplicationContext(); testContextManager.getTestExecutionListeners().stream().filter(listener -> listener instanceof DependencyInjectionTestExecutionListener).findFirst().ifPresent(listener -> { try { listener.prepareTestInstance(testContextManager.getTestContext()); } catch (Exception e) { e.printStackTrace(); } }); }
public void restart(Runnable stoppedLogic) { testContextManager.getTestContext().markApplicationContextDirty(DirtiesContext.HierarchyMode.EXHAUSTIVE); if (stoppedLogic != null) { stoppedLogic.run(); } testContextManager.getTestContext().getApplicationContext(); <DeepExtract> testContextManager.getTestExecutionListeners().stream().filter(listener -> listener instanceof DependencyInjectionTestExecutionListener).findFirst().ifPresent(listener -> { try { listener.prepareTestInstance(testContextManager.getTestContext()); } catch (Exception e) { e.printStackTrace(); } }); </DeepExtract> }
eventeum
positive
441,267
@Test public void shouldNoopIfDeleteCalledForKeyAndItDoesNotExist() throws Exception { final long originalIndex = 36; localStore.setLastAppliedIndexForUnitTestsOnly(originalIndex); final long newIndex = originalIndex + 1; localStore.delete(newIndex, KEY); assertThat(localStore.getKeyValueForUnitTestsOnly(KEY), equalTo(null)); assertThat(localStore.getLastAppliedIndex(), equalTo(newIndex)); }
@Test public void shouldNoopIfDeleteCalledForKeyAndItDoesNotExist() throws Exception { final long originalIndex = 36; localStore.setLastAppliedIndexForUnitTestsOnly(originalIndex); final long newIndex = originalIndex + 1; localStore.delete(newIndex, KEY); assertThat(localStore.getKeyValueForUnitTestsOnly(KEY), equalTo(null)); <DeepExtract> assertThat(localStore.getLastAppliedIndex(), equalTo(newIndex)); </DeepExtract> }
libraft
positive
441,268
public <V> PoiColumnItems<T2, V> addColumnItems2(ItemFunction<T2, Collection<V>> valueFunction, ItemFunction<V, String[]> titles) { new PoiColumnItems<>(valueFunction, titles).parent(this); new PoiColumnItems<>(valueFunction, titles).setDataIndex(2); columns.add(new PoiColumnItems<>(valueFunction, titles)); return new PoiColumnItems<>(valueFunction, titles); }
public <V> PoiColumnItems<T2, V> addColumnItems2(ItemFunction<T2, Collection<V>> valueFunction, ItemFunction<V, String[]> titles) { <DeepExtract> new PoiColumnItems<>(valueFunction, titles).parent(this); new PoiColumnItems<>(valueFunction, titles).setDataIndex(2); columns.add(new PoiColumnItems<>(valueFunction, titles)); return new PoiColumnItems<>(valueFunction, titles); </DeepExtract> }
D8gerStarters
positive
441,269
public Long getPropagatedMillisInQueue(Long value) { if (propagatedMillisInQueue == null) { return value; } else { return propagatedMillisInQueue; } }
public Long getPropagatedMillisInQueue(Long value) { <DeepExtract> if (propagatedMillisInQueue == null) { return value; } else { return propagatedMillisInQueue; } </DeepExtract> }
datadog-plugin
positive
441,271
@Override public void onClick(View v) { ivLastSelectd.setSelected(false); ivLastSelectd = ivProtectEyeStyle; ivProtectEyeStyle.setSelected(true); if (onReadStyleChangeListener != null) { onReadStyleChangeListener.onChange(ReadStyle.protectedEye); } }
@Override public void onClick(View v) { <DeepExtract> ivLastSelectd.setSelected(false); ivLastSelectd = ivProtectEyeStyle; ivProtectEyeStyle.setSelected(true); if (onReadStyleChangeListener != null) { onReadStyleChangeListener.onChange(ReadStyle.protectedEye); } </DeepExtract> }
MissZzzReader
positive
441,272
@Post @Path("/orders") @Consumes public void add(Order order) { int id = 0; for (Item i : order.getItems()) { i.use(order, ++id); } database.save(order); order = database.getOrder(order.getId()); if (order != null) { Serializer serializer = result.use(representation()).from(order); serializer.include("items").include("location"); serializer.include("payment").serialize(); } else { status.notFound(); } status.created(routes.getUri()); }
@Post @Path("/orders") @Consumes public void add(Order order) { int id = 0; for (Item i : order.getItems()) { i.use(order, ++id); } database.save(order); <DeepExtract> order = database.getOrder(order.getId()); if (order != null) { Serializer serializer = result.use(representation()).from(order); serializer.include("items").include("location"); serializer.include("payment").serialize(); } else { status.notFound(); } </DeepExtract> status.created(routes.getUri()); }
restfulie-java
positive
441,273
@Override public int skip(int skipLength) { if (readHead.position == dataSpec.length) { return -1; } int bytesToRead = (int) Math.min(loadPosition - readHead.position, skipLength); if (bytesToRead == 0) { return 0; } if (readHead.position == 0) { readHead.fragmentIndex = 0; readHead.fragmentOffset = allocation.getFragmentOffset(0); readHead.fragmentRemaining = allocation.getFragmentLength(0); } int bytesRead = 0; byte[][] buffers = allocation.getBuffers(); while (bytesRead < bytesToRead) { int bufferReadLength = Math.min(readHead.fragmentRemaining, bytesToRead - bytesRead); if (null != null) { null.put(buffers[readHead.fragmentIndex], readHead.fragmentOffset, bufferReadLength); } else if (null != null) { System.arraycopy(buffers[readHead.fragmentIndex], readHead.fragmentOffset, null, 0, bufferReadLength); 0 += bufferReadLength; } readHead.position += bufferReadLength; bytesRead += bufferReadLength; readHead.fragmentOffset += bufferReadLength; readHead.fragmentRemaining -= bufferReadLength; if (readHead.fragmentRemaining == 0 && readHead.position < resolvedLength) { readHead.fragmentIndex++; readHead.fragmentOffset = allocation.getFragmentOffset(readHead.fragmentIndex); readHead.fragmentRemaining = allocation.getFragmentLength(readHead.fragmentIndex); } } return bytesRead; }
@Override public int skip(int skipLength) { <DeepExtract> if (readHead.position == dataSpec.length) { return -1; } int bytesToRead = (int) Math.min(loadPosition - readHead.position, skipLength); if (bytesToRead == 0) { return 0; } if (readHead.position == 0) { readHead.fragmentIndex = 0; readHead.fragmentOffset = allocation.getFragmentOffset(0); readHead.fragmentRemaining = allocation.getFragmentLength(0); } int bytesRead = 0; byte[][] buffers = allocation.getBuffers(); while (bytesRead < bytesToRead) { int bufferReadLength = Math.min(readHead.fragmentRemaining, bytesToRead - bytesRead); if (null != null) { null.put(buffers[readHead.fragmentIndex], readHead.fragmentOffset, bufferReadLength); } else if (null != null) { System.arraycopy(buffers[readHead.fragmentIndex], readHead.fragmentOffset, null, 0, bufferReadLength); 0 += bufferReadLength; } readHead.position += bufferReadLength; bytesRead += bufferReadLength; readHead.fragmentOffset += bufferReadLength; readHead.fragmentRemaining -= bufferReadLength; if (readHead.fragmentRemaining == 0 && readHead.position < resolvedLength) { readHead.fragmentIndex++; readHead.fragmentOffset = allocation.getFragmentOffset(readHead.fragmentIndex); readHead.fragmentRemaining = allocation.getFragmentLength(readHead.fragmentIndex); } } return bytesRead; </DeepExtract> }
ExoPlayerLeanback
positive
441,274
public void skip(int size) throws IOException { if (pos + size > buf.length) { resize(pos + size); } pos += size; }
public void skip(int size) throws IOException { <DeepExtract> </DeepExtract> if (pos + size > buf.length) { <DeepExtract> </DeepExtract> resize(pos + size); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> pos += size; <DeepExtract> </DeepExtract> }
hawtbuf
positive
441,277
@Override public void onBindViewHolder(@NonNull VideoViewHolder holder, int position) { tvTitle.setText(list.get(position).title); tvDuration.setText(Tools.displayDuration(list.get(position).duration)); ivCover.setImageResource(R.drawable.ic_video_library_black_24dp); Tools.loadImage(context, list.get(position).uri, ivCover); }
@Override public void onBindViewHolder(@NonNull VideoViewHolder holder, int position) { <DeepExtract> tvTitle.setText(list.get(position).title); tvDuration.setText(Tools.displayDuration(list.get(position).duration)); ivCover.setImageResource(R.drawable.ic_video_library_black_24dp); Tools.loadImage(context, list.get(position).uri, ivCover); </DeepExtract> }
Android-development-with-example
positive
441,278
@Override public void close() { Objects.requireNonNull(this, "key cannot be null"); final V originalValue = get(this); byte[] keyBytes = keySerde().serializer().serialize(null, (K) this); DatabaseEntry dbKey = new DatabaseEntry(keyBytes); db.delete(null, dbKey); return originalValue; cursor.close(); }
@Override public void close() { <DeepExtract> Objects.requireNonNull(this, "key cannot be null"); final V originalValue = get(this); byte[] keyBytes = keySerde().serializer().serialize(null, (K) this); DatabaseEntry dbKey = new DatabaseEntry(keyBytes); db.delete(null, dbKey); return originalValue; </DeepExtract> cursor.close(); }
kcache
positive
441,281
public StateVertix getSourceStateVertix() throws CrawljaxException { try { return (StateVertix) searchSuperField("source").get(this); } catch (IllegalArgumentException e) { throw new CrawljaxException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new CrawljaxException(e.getMessage(), e); } }
public StateVertix getSourceStateVertix() throws CrawljaxException { <DeepExtract> try { return (StateVertix) searchSuperField("source").get(this); } catch (IllegalArgumentException e) { throw new CrawljaxException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new CrawljaxException(e.getMessage(), e); } </DeepExtract> }
JSNose
positive
441,285
@Override public synchronized void close() throws IOException { if (list == null) { synchronized (list) { list.remove(this); list = null; } } in.close(); }
@Override public synchronized void close() throws IOException { <DeepExtract> if (list == null) { synchronized (list) { list.remove(this); list = null; } } </DeepExtract> in.close(); }
AndroidUIO
positive
441,287
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json"); String goodsId = request.getParameter("goodsId"); ShopBrief shopInfo = null; if (goodsId != null) { shopInfo = UserService.getShopBriefInfoByGoodsId(goodsId); } Gson gson = new Gson(); gson.toJson(shopInfo, response.getWriter()); }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { <DeepExtract> response.setContentType("application/json"); String goodsId = request.getParameter("goodsId"); ShopBrief shopInfo = null; if (goodsId != null) { shopInfo = UserService.getShopBriefInfoByGoodsId(goodsId); } Gson gson = new Gson(); gson.toJson(shopInfo, response.getWriter()); </DeepExtract> }
OnlineShoppingSystem
positive
441,288
public DirectionalShadowLight setBounds(BoundingBox box) { float w = box.getWidth(); float h = box.getHeight(); float d = box.getDepth(); float s = Math.max(Math.max(w, h), d); w = h = d = s * SQRT2; return center.set(this.center); cam.viewportWidth = w; cam.viewportHeight = h; cam.near = 0; cam.far = d; return this; }
public DirectionalShadowLight setBounds(BoundingBox box) { float w = box.getWidth(); float h = box.getHeight(); float d = box.getDepth(); float s = Math.max(Math.max(w, h), d); w = h = d = s * SQRT2; return center.set(this.center); <DeepExtract> cam.viewportWidth = w; cam.viewportHeight = h; cam.near = 0; cam.far = d; return this; </DeepExtract> }
gdx-gltf
positive
441,290
public void onError(String msg) { logger.error("IRC source error: {}", msg); headers.put(IRCConstants.HEADER_TYPE, "error"); ChannelProcessor channelProcessor = getChannelProcessor(); sourceCounter.addToEventReceivedCount(1); sourceCounter.incrementAppendBatchReceivedCount(); channelProcessor.processEvent(EventBuilder.withBody(msg, Charset.forName("UTF-8"), headers)); sourceCounter.addToEventAcceptedCount(1); sourceCounter.incrementAppendBatchAcceptedCount(); headers.clear(); }
public void onError(String msg) { logger.error("IRC source error: {}", msg); headers.put(IRCConstants.HEADER_TYPE, "error"); <DeepExtract> ChannelProcessor channelProcessor = getChannelProcessor(); sourceCounter.addToEventReceivedCount(1); sourceCounter.incrementAppendBatchReceivedCount(); channelProcessor.processEvent(EventBuilder.withBody(msg, Charset.forName("UTF-8"), headers)); sourceCounter.addToEventAcceptedCount(1); sourceCounter.incrementAppendBatchAcceptedCount(); headers.clear(); </DeepExtract> }
ingestion
positive
441,294
public static void main(String[] args) { int[] p = new int[2]; int a = 47; int b = 30; if (a % b == 1) { p[0] = 1; p[1] = -(a - 1) / b; return p; } else { RSA(b, a % b, p); int t = p[0]; p[0] = p[1]; p[1] = t - (a / b) * p[1]; return p; } System.out.print("p[0] is: " + p[0] + ";p[1] is: " + p[1]); }
public static void main(String[] args) { int[] p = new int[2]; int a = 47; int b = 30; <DeepExtract> if (a % b == 1) { p[0] = 1; p[1] = -(a - 1) / b; return p; } else { RSA(b, a % b, p); int t = p[0]; p[0] = p[1]; p[1] = t - (a / b) * p[1]; return p; } </DeepExtract> System.out.print("p[0] is: " + p[0] + ";p[1] is: " + p[1]); }
Algorithms-Fourth-Edition-Exercises
positive
441,295
@Override public void setParameters(Map<String, String> parameters) { this.mappingFile = parameters.get(PropertiesLoader.WARC_FILE_RESOLVER_UNQUALIFIED); log.info("Initializing file mapping parameter: " + mappingFile); }
@Override public void setParameters(Map<String, String> parameters) { <DeepExtract> this.mappingFile = parameters.get(PropertiesLoader.WARC_FILE_RESOLVER_UNQUALIFIED); </DeepExtract> log.info("Initializing file mapping parameter: " + mappingFile); }
solrwayback
positive
441,296
@Test public void shouldReuseClientAfterFailure() throws Throwable { stubFor(get(urlEqualTo("/" + 1)).willReturn(aResponse().withBody("{\"content\": true}").withHeader("Content-Type", "application/json"))); stubFor(get(urlEqualTo("/" + 2)).willReturn(aResponse().withBody("Not a json").withHeader("Content-Type", "application/json"))); stubFor(get(urlEqualTo("/" + 3)).willReturn(aResponse().withBody("{\"content\": true}").withHeader("Content-Type", "application/json"))); ExecutorService executorService = Executors.newFixedThreadPool(1); try { List<Future<Object>> futures = executorService.invokeAll(Collections.singleton(this::testReuseClientAfterFailure), 20, TimeUnit.SECONDS); futures.iterator().next().get(); } catch (InterruptedException | CancellationException e) { e.printStackTrace(); Assert.fail("the test didn't finish in " + 20 + " " + TimeUnit.SECONDS); } catch (ExecutionException e) { Throwable unwrappedError = e.getCause(); throw unwrappedError; } }
@Test public void shouldReuseClientAfterFailure() throws Throwable { stubFor(get(urlEqualTo("/" + 1)).willReturn(aResponse().withBody("{\"content\": true}").withHeader("Content-Type", "application/json"))); stubFor(get(urlEqualTo("/" + 2)).willReturn(aResponse().withBody("Not a json").withHeader("Content-Type", "application/json"))); stubFor(get(urlEqualTo("/" + 3)).willReturn(aResponse().withBody("{\"content\": true}").withHeader("Content-Type", "application/json"))); <DeepExtract> ExecutorService executorService = Executors.newFixedThreadPool(1); try { List<Future<Object>> futures = executorService.invokeAll(Collections.singleton(this::testReuseClientAfterFailure), 20, TimeUnit.SECONDS); futures.iterator().next().get(); } catch (InterruptedException | CancellationException e) { e.printStackTrace(); Assert.fail("the test didn't finish in " + 20 + " " + TimeUnit.SECONDS); } catch (ExecutionException e) { Throwable unwrappedError = e.getCause(); throw unwrappedError; } </DeepExtract> }
microprofile-rest-client
positive
441,297
public byte[] readAY() throws BinaryDataExecption { if (pos + 1 > count) throw new BinaryDataExecption("not enough data"); final int real = read(); if (real != SerialAtom.TYPE_AY) throw new BinaryDataExecption("type mismatch (exp: " + SerialAtom.TYPE_AY + ", real: " + real + ")"); if (pos + 4 > count) throw new BinaryDataExecption("not enough data"); final int len = readInt(); if (pos + len > count) throw new BinaryDataExecption("not enough data"); final byte[] ay = new byte[len]; try { read(ay); } catch (IOException e) { } return ay; }
public byte[] readAY() throws BinaryDataExecption { if (pos + 1 > count) throw new BinaryDataExecption("not enough data"); final int real = read(); if (real != SerialAtom.TYPE_AY) throw new BinaryDataExecption("type mismatch (exp: " + SerialAtom.TYPE_AY + ", real: " + real + ")"); <DeepExtract> if (pos + 4 > count) throw new BinaryDataExecption("not enough data"); final int len = readInt(); if (pos + len > count) throw new BinaryDataExecption("not enough data"); final byte[] ay = new byte[len]; try { read(ay); } catch (IOException e) { } return ay; </DeepExtract> }
remuco
positive
441,298
public String toJson(JsonElement jsonElement) { StringWriter writer = new StringWriter(); toJson(jsonElement, writer); return new StringBuilder("{serializeNulls:").append(serializeNulls).append(",factories:").append(factories).append(",instanceCreators:").append(constructorConstructor).append("}").toString(); }
public String toJson(JsonElement jsonElement) { StringWriter writer = new StringWriter(); toJson(jsonElement, writer); <DeepExtract> return new StringBuilder("{serializeNulls:").append(serializeNulls).append(",factories:").append(factories).append(",instanceCreators:").append(constructorConstructor).append("}").toString(); </DeepExtract> }
JJEvent
positive
441,299
@Test public void moveWithReplaceExisting() throws IOException { final String content = "sample-content"; AmazonS3ClientMock client = AmazonS3MockFactory.getAmazonClientMock(); client.bucket("bucketA").dir("dir").file("dir/file1", content.getBytes()).file("dir/file2", "different-content".getBytes()); FileSystem fs; try { fs = s3fsProvider.getFileSystem(S3EndpointConstant.S3_GLOBAL_URI_TEST); } catch (FileSystemNotFoundException e) { fs = (S3FileSystem) FileSystems.newFileSystem(S3EndpointConstant.S3_GLOBAL_URI_TEST, null); } Path file = fs.getPath("/bucketA/dir/file1"); Path fileDest = fs.getPath("/bucketA", "dir", "file2"); s3fsProvider.move(file, fileDest, StandardCopyOption.REPLACE_EXISTING); assertTrue(Files.exists(fileDest)); assertTrue(Files.notExists(file)); assertArrayEquals(content.getBytes(), Files.readAllBytes(fileDest)); }
@Test public void moveWithReplaceExisting() throws IOException { final String content = "sample-content"; AmazonS3ClientMock client = AmazonS3MockFactory.getAmazonClientMock(); client.bucket("bucketA").dir("dir").file("dir/file1", content.getBytes()).file("dir/file2", "different-content".getBytes()); <DeepExtract> FileSystem fs; try { fs = s3fsProvider.getFileSystem(S3EndpointConstant.S3_GLOBAL_URI_TEST); } catch (FileSystemNotFoundException e) { fs = (S3FileSystem) FileSystems.newFileSystem(S3EndpointConstant.S3_GLOBAL_URI_TEST, null); } </DeepExtract> Path file = fs.getPath("/bucketA/dir/file1"); Path fileDest = fs.getPath("/bucketA", "dir", "file2"); s3fsProvider.move(file, fileDest, StandardCopyOption.REPLACE_EXISTING); assertTrue(Files.exists(fileDest)); assertTrue(Files.notExists(file)); assertArrayEquals(content.getBytes(), Files.readAllBytes(fileDest)); }
nifi-minio
positive
441,300
@Test void constructorContext() { MapNode node = (MapNode) Node.parse("{foo:1,bar:2}", GyroParser::map); List<PairNode> entries; PairNode entry0 = mock(PairNode.class); PairNode entry1 = mock(PairNode.class); MapNode node = new MapNode(Arrays.asList(entry0, entry1)); assertThat(node.getEntries()).containsExactly(entry0, entry1); assertThat(entries).hasSize(2); entries.forEach(entry -> assertThat(entry.getValue()).isInstanceOf(ValueNode.class)); }
@Test void constructorContext() { MapNode node = (MapNode) Node.parse("{foo:1,bar:2}", GyroParser::map); <DeepExtract> List<PairNode> entries; PairNode entry0 = mock(PairNode.class); PairNode entry1 = mock(PairNode.class); MapNode node = new MapNode(Arrays.asList(entry0, entry1)); assertThat(node.getEntries()).containsExactly(entry0, entry1); </DeepExtract> assertThat(entries).hasSize(2); entries.forEach(entry -> assertThat(entry.getValue()).isInstanceOf(ValueNode.class)); }
gyro
positive
441,301
public void toggleDoor() { doorOpened = !doorOpened; if (getWorld() == null) return; IBlockState state = getWorld().getBlockState(getPos()); getWorld().notifyBlockUpdate(getPos(), state, state, 3); super.markDirty(); }
public void toggleDoor() { doorOpened = !doorOpened; <DeepExtract> if (getWorld() == null) return; IBlockState state = getWorld().getBlockState(getPos()); getWorld().notifyBlockUpdate(getPos(), state, state, 3); super.markDirty(); </DeepExtract> }
OCDevices
positive
441,302
protected T directCall() { if (hasRun()) { return this.cache; } else { synchronized (this) { if (hasRun()) { return this.cache; } this.generatedWithVersion = CachedSupplier.generatedVersion.get(); this.cache = directCall(); this.run = true; return this.cache; } } }
protected T directCall() { <DeepExtract> if (hasRun()) { return this.cache; } else { synchronized (this) { if (hasRun()) { return this.cache; } this.generatedWithVersion = CachedSupplier.generatedVersion.get(); this.cache = directCall(); this.run = true; return this.cache; } } </DeepExtract> }
molvec
positive
441,303
public void flush() throws IOException { this.mac.update(this.mac.doFinal()); this.buffer.write(this.mac.doFinal()); this.buffer.writeTo(this.out); }
public void flush() throws IOException { <DeepExtract> this.mac.update(this.mac.doFinal()); this.buffer.write(this.mac.doFinal()); </DeepExtract> this.buffer.writeTo(this.out); }
UCE
positive
441,304
public void selectByValue(final String[] values) { TestLogging.logWebStep("make selection using values\"" + values + "\" on " + toHTML(), false); driver = WebUIDriver.getWebDriver(); element = driver.findElement(this.getBy()); try { select = getNewSelectElement(element); options = select.getOptions(); } catch (UnexpectedTagNameException e) { if (element.getTagName().equalsIgnoreCase("ul")) { options = element.findElements(By.tagName("li")); } } for (int i = 0; i < values.length; i++) { for (WebElement option : options) { if (option.getAttribute("value").equals(values[i])) { setSelected(option); break; } } } }
public void selectByValue(final String[] values) { TestLogging.logWebStep("make selection using values\"" + values + "\" on " + toHTML(), false); <DeepExtract> driver = WebUIDriver.getWebDriver(); element = driver.findElement(this.getBy()); try { select = getNewSelectElement(element); options = select.getOptions(); } catch (UnexpectedTagNameException e) { if (element.getTagName().equalsIgnoreCase("ul")) { options = element.findElements(By.tagName("li")); } } </DeepExtract> for (int i = 0; i < values.length; i++) { for (WebElement option : options) { if (option.getAttribute("value").equals(values[i])) { setSelected(option); break; } } } }
seleniumtestsframework
positive
441,308
@Test(expected = RedisCacheException.class) public void sizeThrowIOException() throws ConnectionException, IOException { doThrow(new IOException("")).when(client).dbsize(); int size = 3; doReturn(size).when(client).dbsize(); long actualSize = cache.size(); assertEquals(size, actualSize); }
@Test(expected = RedisCacheException.class) public void sizeThrowIOException() throws ConnectionException, IOException { doThrow(new IOException("")).when(client).dbsize(); <DeepExtract> int size = 3; doReturn(size).when(client).dbsize(); long actualSize = cache.size(); assertEquals(size, actualSize); </DeepExtract> }
imcache
positive
441,311
@Override public Rectangle setCenter(final float x, final float y) { super.setCenter(x, y); bl.set(x, y); br.set(x + width, y); tl.set(x, y + height); tr.set(x + width, y + height); return this; }
@Override public Rectangle setCenter(final float x, final float y) { super.setCenter(x, y); <DeepExtract> bl.set(x, y); br.set(x + width, y); tl.set(x, y + height); tr.set(x + width, y + height); </DeepExtract> return this; }
cell-rpg
positive
441,312
public List<ResourceServerAndSecret> processResources(String[] audiences, String[] resources, UserDataRepository userDataService, String user, String password) { List<ResourceServerAndSecret> resurceServers = new ArrayList<>(); Map<String, Map<String, ResourceServer>> resourceServersMultiMap = resourceServerService.getAll().toMultiMap(); if (audiences != null) filterServersByAudience(audiences, resourceServersMultiMap, resurceServers); if (resources != null) filterServersByResources(resources, resourceServersMultiMap, resurceServers); if (resurceServers.isEmpty()) return resurceServers; if (userDataService == null) return; UserCredentials userCredentials = userDataService.loadUserCredentials(user, password); boolean store = false; if (userCredentials == null) { userCredentials = new UserCredentials(); store = true; } for (ResourceServerAndSecret resourceServer : resurceServers) { String credentialForResourceServer = userCredentials.getCredentialForResourceServer(resourceServer.getResourceServer().getAudience()); if (credentialForResourceServer == null) { SecureRandom secureRandomInstance = new SecureRandom(); credentialForResourceServer = RandomStringUtils.random(16, 33, 126, false, false, null, secureRandomInstance); userCredentials.setCredentialForResourceServer(resourceServer.getResourceServer().getAudience(), credentialForResourceServer); store = true; } resourceServer.setRawSecret(credentialForResourceServer); } if (store) { userDataService.storeUserCredentials(user, password, userCredentials); } for (ResourceServerAndSecret resourceServerAndSecret : resurceServers) { encryptSecret(resourceServerAndSecret); } return resurceServers; }
public List<ResourceServerAndSecret> processResources(String[] audiences, String[] resources, UserDataRepository userDataService, String user, String password) { List<ResourceServerAndSecret> resurceServers = new ArrayList<>(); Map<String, Map<String, ResourceServer>> resourceServersMultiMap = resourceServerService.getAll().toMultiMap(); if (audiences != null) filterServersByAudience(audiences, resourceServersMultiMap, resurceServers); if (resources != null) filterServersByResources(resources, resourceServersMultiMap, resurceServers); if (resurceServers.isEmpty()) return resurceServers; <DeepExtract> if (userDataService == null) return; UserCredentials userCredentials = userDataService.loadUserCredentials(user, password); boolean store = false; if (userCredentials == null) { userCredentials = new UserCredentials(); store = true; } for (ResourceServerAndSecret resourceServer : resurceServers) { String credentialForResourceServer = userCredentials.getCredentialForResourceServer(resourceServer.getResourceServer().getAudience()); if (credentialForResourceServer == null) { SecureRandom secureRandomInstance = new SecureRandom(); credentialForResourceServer = RandomStringUtils.random(16, 33, 126, false, false, null, secureRandomInstance); userCredentials.setCredentialForResourceServer(resourceServer.getResourceServer().getAudience(), credentialForResourceServer); store = true; } resourceServer.setRawSecret(credentialForResourceServer); } if (store) { userDataService.storeUserCredentials(user, password, userCredentials); } </DeepExtract> for (ResourceServerAndSecret resourceServerAndSecret : resurceServers) { encryptSecret(resourceServerAndSecret); } return resurceServers; }
secure-token-service
positive
441,316
@Override public void setARGB(int x, int y, int a, int r, int g, int b) { super.setARGB(x, y, a, r, g, b); updateRGBtoHSBCache(r, g, b); hue.setData(x, y, (int) (RGBtoHSBCache[0] * 255)); saturation.setData(x, y, (int) (RGBtoHSBCache[1] * 255)); brightness.setData(x, y, (int) (RGBtoHSBCache[2] * 255)); luminance.setData(x, y, ImageTools.getPerceivedLuminanceFromRGB(r, g, b)); }
@Override public void setARGB(int x, int y, int a, int r, int g, int b) { super.setARGB(x, y, a, r, g, b); <DeepExtract> updateRGBtoHSBCache(r, g, b); hue.setData(x, y, (int) (RGBtoHSBCache[0] * 255)); saturation.setData(x, y, (int) (RGBtoHSBCache[1] * 255)); brightness.setData(x, y, (int) (RGBtoHSBCache[2] * 255)); luminance.setData(x, y, ImageTools.getPerceivedLuminanceFromRGB(r, g, b)); </DeepExtract> }
DrawingBotV3
positive
441,317
@Action public void clear() { getNodes().clear(); dashboardPanel.clear(); dashboardPanel.revalidate(); dashboardPanel.repaint(); }
@Action public void clear() { <DeepExtract> getNodes().clear(); dashboardPanel.clear(); dashboardPanel.revalidate(); dashboardPanel.repaint(); </DeepExtract> }
imageflow
positive
441,318
@Override public void unregisterOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) { mValues.remove(listener); return this; }
@Override public void unregisterOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) { <DeepExtract> mValues.remove(listener); return this; </DeepExtract> }
ZI
positive
441,319
public static String resourceprep(String string, JxmppContext context) throws XmppStringprepException { if (string == null) { throw new XmppStringprepException(string, XmppAddressParttype.resourcepart + " can't be null"); } if (string.isEmpty()) { throw new XmppStringprepException(string, XmppAddressParttype.resourcepart + " can't be the empty string"); } if (context.isCachingEnabled()) { res = RESOURCEPREP_CACHE.lookup(string); if (res != null) { return res; } } res = context.xmppStringprep.resourceprep(string); if (context.isCachingEnabled()) { RESOURCEPREP_CACHE.put(string, res); } return res; }
public static String resourceprep(String string, JxmppContext context) throws XmppStringprepException { <DeepExtract> if (string == null) { throw new XmppStringprepException(string, XmppAddressParttype.resourcepart + " can't be null"); } if (string.isEmpty()) { throw new XmppStringprepException(string, XmppAddressParttype.resourcepart + " can't be the empty string"); } </DeepExtract> if (context.isCachingEnabled()) { res = RESOURCEPREP_CACHE.lookup(string); if (res != null) { return res; } } res = context.xmppStringprep.resourceprep(string); if (context.isCachingEnabled()) { RESOURCEPREP_CACHE.put(string, res); } return res; }
jxmpp
positive
441,320
public void testRetryForResult() { exec = new AsyncExecutionImpl<>(Arrays.asList(RetryPolicy.builder().handleResult(null).build()), scheduler, future, true, innerFn); exec.preExecute(); exec.recordResult(null); assertFalse(exec.isComplete()); exec = exec.copy(); exec.preExecute(); exec.recordResult(null); assertFalse(exec.isComplete()); exec = exec.copy(); exec.preExecute(); exec.recordResult(1); assertTrue(exec.isComplete()); assertEquals(exec.getAttemptCount(), 3); assertEquals(exec.getExecutionCount(), 3); assertTrue(exec.isComplete()); assertEquals(exec.getLastResult(), 1); assertNull(exec.getLastException()); verify(scheduler, times(2)).schedule(any(Callable.class), any(Long.class), any(TimeUnit.class)); verify(future).completeResult(ExecutionResult.success(1)); }
public void testRetryForResult() { exec = new AsyncExecutionImpl<>(Arrays.asList(RetryPolicy.builder().handleResult(null).build()), scheduler, future, true, innerFn); exec.preExecute(); exec.recordResult(null); assertFalse(exec.isComplete()); exec = exec.copy(); exec.preExecute(); exec.recordResult(null); assertFalse(exec.isComplete()); exec = exec.copy(); exec.preExecute(); exec.recordResult(1); assertTrue(exec.isComplete()); assertEquals(exec.getAttemptCount(), 3); assertEquals(exec.getExecutionCount(), 3); assertTrue(exec.isComplete()); assertEquals(exec.getLastResult(), 1); assertNull(exec.getLastException()); <DeepExtract> verify(scheduler, times(2)).schedule(any(Callable.class), any(Long.class), any(TimeUnit.class)); </DeepExtract> verify(future).completeResult(ExecutionResult.success(1)); }
failsafe
positive
441,321
public void setMaxWidth(int maxWidth) { this.maxWidth = maxWidth; maxHeight = (int) Math.max(maxHeight, maxHeightRatio * ZUIHelper.getScreenHeight(getContext())); if (minHeight > 0 && minHeightRatio > 0) { minHeight = (int) Math.min(minHeight, minHeightRatio * ZUIHelper.getScreenHeight(getContext())); } else if (minHeightRatio > 0) { minHeight = (int) (minHeightRatio * ZUIHelper.getScreenHeight(getContext())); } maxWidth = (int) Math.max(maxWidth, maxWidthRatio * ZUIHelper.getScreenWidth(getContext())); if (minWidth > 0 && minWidthRatio > 0) { minWidth = (int) Math.min(minWidth, minWidthRatio * ZUIHelper.getScreenWidth(getContext())); } else if (minWidthRatio > 0) { minWidth = (int) (minWidthRatio * ZUIHelper.getScreenWidth(getContext())); } fixWidth = (int) Math.max(fixWidth, fixWidthRatio * ZUIHelper.getScreenWidth(getContext())); fixHeight = (int) Math.max(fixHeight, fixHeightRatio * ZUIHelper.getScreenHeight(getContext())); requestLayout(); }
public void setMaxWidth(int maxWidth) { this.maxWidth = maxWidth; <DeepExtract> maxHeight = (int) Math.max(maxHeight, maxHeightRatio * ZUIHelper.getScreenHeight(getContext())); if (minHeight > 0 && minHeightRatio > 0) { minHeight = (int) Math.min(minHeight, minHeightRatio * ZUIHelper.getScreenHeight(getContext())); } else if (minHeightRatio > 0) { minHeight = (int) (minHeightRatio * ZUIHelper.getScreenHeight(getContext())); } maxWidth = (int) Math.max(maxWidth, maxWidthRatio * ZUIHelper.getScreenWidth(getContext())); if (minWidth > 0 && minWidthRatio > 0) { minWidth = (int) Math.min(minWidth, minWidthRatio * ZUIHelper.getScreenWidth(getContext())); } else if (minWidthRatio > 0) { minWidth = (int) (minWidthRatio * ZUIHelper.getScreenWidth(getContext())); } fixWidth = (int) Math.max(fixWidth, fixWidthRatio * ZUIHelper.getScreenWidth(getContext())); fixHeight = (int) Math.max(fixHeight, fixHeightRatio * ZUIHelper.getScreenHeight(getContext())); </DeepExtract> requestLayout(); }
ZUILib
positive
441,322
public void initBook(Book book) { List<ResourceSearchIndex> result = new ArrayList<ResourceSearchIndex>(); if (book == null) { this.resourceSearchIndexes = result; } for (Resource resource : book.getContents()) { ResourceSearchIndex resourceSearchIndex = createResourceSearchIndex(resource); if (resourceSearchIndex != null) { result.add(resourceSearchIndex); } } return result; }
public void initBook(Book book) { <DeepExtract> List<ResourceSearchIndex> result = new ArrayList<ResourceSearchIndex>(); if (book == null) { this.resourceSearchIndexes = result; } for (Resource resource : book.getContents()) { ResourceSearchIndex resourceSearchIndex = createResourceSearchIndex(resource); if (resourceSearchIndex != null) { result.add(resourceSearchIndex); } } return result; </DeepExtract> }
epublib
positive
441,323
@Override public void logF(String tag, String filename, String funcname, int line, int pid, long tid, long maintid, final String log) { if (level > LEVEL_FATAL) { return; } e(tag, log, (Object[]) null); if (toastSupportContext != null) { handler.post(new Runnable() { @Override public void run() { Toast.makeText(toastSupportContext, log, Toast.LENGTH_LONG).show(); } }); } }
@Override public void logF(String tag, String filename, String funcname, int line, int pid, long tid, long maintid, final String log) { if (level > LEVEL_FATAL) { return; } <DeepExtract> e(tag, log, (Object[]) null); </DeepExtract> if (toastSupportContext != null) { handler.post(new Runnable() { @Override public void run() { Toast.makeText(toastSupportContext, log, Toast.LENGTH_LONG).show(); } }); } }
Mas
positive
441,325
@Override public int generateRequestToken(ByteBuf sessionToken, ByteBuf message, long count) { ByteBuf bytes; sessionToken.resetReaderIndex(); message.resetReaderIndex(); ByteBuf buffer = ByteBufAllocator.DEFAULT.heapBuffer(sessionToken.readableBytes() + 8); try { buffer.writeBytes(sessionToken).writeLong(count); SecretKeySpec keySpec = new SecretKeySpec(buffer.array(), 0, buffer.readableBytes(), ALGORITHM); Mac mac = Mac.getInstance(ALGORITHM); mac.init(keySpec); mac.update(message.nioBuffer()); bytes = Unpooled.wrappedBuffer(mac.doFinal()); } catch (Exception e) { throw new RuntimeException(e); } finally { buffer.release(); } return bytes.getInt(bytes.readerIndex()); }
@Override public int generateRequestToken(ByteBuf sessionToken, ByteBuf message, long count) { <DeepExtract> ByteBuf bytes; sessionToken.resetReaderIndex(); message.resetReaderIndex(); ByteBuf buffer = ByteBufAllocator.DEFAULT.heapBuffer(sessionToken.readableBytes() + 8); try { buffer.writeBytes(sessionToken).writeLong(count); SecretKeySpec keySpec = new SecretKeySpec(buffer.array(), 0, buffer.readableBytes(), ALGORITHM); Mac mac = Mac.getInstance(ALGORITHM); mac.init(keySpec); mac.update(message.nioBuffer()); bytes = Unpooled.wrappedBuffer(mac.doFinal()); } catch (Exception e) { throw new RuntimeException(e); } finally { buffer.release(); } </DeepExtract> return bytes.getInt(bytes.readerIndex()); }
netifi-java
positive
441,327
public T get() throws NoSuchFieldException, IllegalAccessException, IllegalArgumentException { if (isInited) return; isInited = true; Class<?> c = mObject.getClass(); while (c != null) { try { Field f = c.getDeclaredField(mFieldName); f.setAccessible(true); mField = f; return; } catch (Exception e) { } finally { c = c.getSuperclass(); } } if (mField == null) throw new NoSuchFieldException(); try { @SuppressWarnings("unchecked") T r = (T) mField.get(mObject); return r; } catch (ClassCastException e) { throw new IllegalArgumentException("unable to cast object"); } }
public T get() throws NoSuchFieldException, IllegalAccessException, IllegalArgumentException { <DeepExtract> if (isInited) return; isInited = true; Class<?> c = mObject.getClass(); while (c != null) { try { Field f = c.getDeclaredField(mFieldName); f.setAccessible(true); mField = f; return; } catch (Exception e) { } finally { c = c.getSuperclass(); } } </DeepExtract> if (mField == null) throw new NoSuchFieldException(); try { @SuppressWarnings("unchecked") T r = (T) mField.get(mObject); return r; } catch (ClassCastException e) { throw new IllegalArgumentException("unable to cast object"); } }
AndroidPlugin
positive
441,328
public static void renameFile(File origFile, File newFile, boolean overwrite) { if (!origFile.exists()) { Log.e(TAG, "Error renaming file: " + origFile + " does not exist"); throw new TodoException("Error renaming file: " + origFile + " does not exist"); } if (newFile == null) { throw new TodoException("createParentDirectory: dest is null"); } File dir = newFile.getParentFile(); if (dir != null && !dir.exists()) { createParentDirectory(dir); } if (!dir.exists()) { if (!dir.mkdirs()) { Log.e(TAG, "Could not create dirs: " + dir.getAbsolutePath()); throw new TodoException("Could not create dirs: " + dir.getAbsolutePath()); } } if (overwrite && newFile.exists()) { if (!newFile.delete()) { Log.e(TAG, "Error renaming file: failed to delete " + newFile); throw new TodoException("Error renaming file: failed to delete " + newFile); } } if (!origFile.renameTo(newFile)) { Log.e(TAG, "Error renaming " + origFile + " to " + newFile); throw new TodoException("Error renaming " + origFile + " to " + newFile); } }
public static void renameFile(File origFile, File newFile, boolean overwrite) { if (!origFile.exists()) { Log.e(TAG, "Error renaming file: " + origFile + " does not exist"); throw new TodoException("Error renaming file: " + origFile + " does not exist"); } <DeepExtract> if (newFile == null) { throw new TodoException("createParentDirectory: dest is null"); } File dir = newFile.getParentFile(); if (dir != null && !dir.exists()) { createParentDirectory(dir); } if (!dir.exists()) { if (!dir.mkdirs()) { Log.e(TAG, "Could not create dirs: " + dir.getAbsolutePath()); throw new TodoException("Could not create dirs: " + dir.getAbsolutePath()); } } </DeepExtract> if (overwrite && newFile.exists()) { if (!newFile.delete()) { Log.e(TAG, "Error renaming file: failed to delete " + newFile); throw new TodoException("Error renaming file: failed to delete " + newFile); } } if (!origFile.renameTo(newFile)) { Log.e(TAG, "Error renaming " + origFile + " to " + newFile); throw new TodoException("Error renaming " + origFile + " to " + newFile); } }
endpoints-codelab-android
positive
441,329
public static AlertDialog showPrompt(Context context, String message, String confirmButton) { AlertDialog.Builder promptBuilder = new AlertDialog.Builder(context); if (null != null) { promptBuilder.setTitle(null); } if (message != null) { promptBuilder.setMessage(message); } if (confirmButton != null) { promptBuilder.setPositiveButton(confirmButton, null); } if (null != null) { promptBuilder.setNeutralButton(null, null); } if (null != null) { promptBuilder.setNegativeButton(null, null); } promptBuilder.setCancelable(true); if (true) { promptBuilder.setOnCancelListener(null); } AlertDialog alertDialog = promptBuilder.create(); if (!(context instanceof Activity)) { alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); } alertDialog.setOnDismissListener(null); alertDialog.setOnShowListener(null); alertDialog.show(); return alertDialog; }
public static AlertDialog showPrompt(Context context, String message, String confirmButton) { <DeepExtract> AlertDialog.Builder promptBuilder = new AlertDialog.Builder(context); if (null != null) { promptBuilder.setTitle(null); } if (message != null) { promptBuilder.setMessage(message); } if (confirmButton != null) { promptBuilder.setPositiveButton(confirmButton, null); } if (null != null) { promptBuilder.setNeutralButton(null, null); } if (null != null) { promptBuilder.setNegativeButton(null, null); } promptBuilder.setCancelable(true); if (true) { promptBuilder.setOnCancelListener(null); } AlertDialog alertDialog = promptBuilder.create(); if (!(context instanceof Activity)) { alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); } alertDialog.setOnDismissListener(null); alertDialog.setOnShowListener(null); alertDialog.show(); return alertDialog; </DeepExtract> }
Lazy
positive
441,331
private static byte[] create__resolver_scanner_eof_actions() { byte[] r = new byte[108]; r[0] = 0; r[1] = 0; r[2] = 0; r[3] = 0; r[4] = 0; r[5] = 0; r[6] = 0; r[7] = 0; r[8] = 0; r[9] = 0; r[10] = 0; r[11] = 0; r[12] = 0; r[13] = 0; r[14] = 0; r[15] = 0; r[16] = 0; r[17] = 0; r[18] = 0; r[19] = 0; r[20] = 0; r[21] = 0; r[22] = 0; r[23] = 0; r[24] = 0; r[25] = 0; r[26] = 0; r[27] = 0; r[28] = 0; r[29] = 0; r[30] = 0; r[31] = 0; r[32] = 0; r[33] = 0; r[34] = 0; r[35] = 0; r[36] = 0; r[37] = 0; r[38] = 0; r[39] = 0; r[40] = 0; r[41] = 0; r[42] = 0; r[43] = 0; r[44] = 0; r[45] = 0; r[46] = 0; r[47] = 0; r[48] = 0; r[49] = 0; r[50] = 0; r[51] = 0; r[52] = 0; r[53] = 0; r[54] = 0; r[55] = 0; r[56] = 0; r[57] = 0; r[58] = 0; r[59] = 0; r[60] = 0; r[61] = 0; r[62] = 0; r[63] = 0; r[64] = 0; r[65] = 0; r[66] = 0; r[67] = 0; r[68] = 0; r[69] = 0; r[70] = 0; r[71] = 0; r[72] = 0; r[73] = 0; r[74] = 0; r[75] = 0; r[76] = 0; r[77] = 5; r[78] = 13; r[79] = 13; r[80] = 13; r[81] = 15; r[82] = 15; r[83] = 15; r[84] = 15; r[85] = 15; r[86] = 15; r[87] = 15; r[88] = 15; r[89] = 15; r[90] = 15; r[91] = 15; r[92] = 15; r[93] = 15; r[94] = 15; r[95] = 15; r[96] = 15; r[97] = 9; r[98] = 9; r[99] = 9; r[100] = 7; r[101] = 15; r[102] = 15; r[103] = 15; r[104] = 15; r[105] = 3; r[106] = 11; r[107] = 1; return r; }
private static byte[] create__resolver_scanner_eof_actions() { byte[] r = new byte[108]; <DeepExtract> r[0] = 0; r[1] = 0; r[2] = 0; r[3] = 0; r[4] = 0; r[5] = 0; r[6] = 0; r[7] = 0; r[8] = 0; r[9] = 0; r[10] = 0; r[11] = 0; r[12] = 0; r[13] = 0; r[14] = 0; r[15] = 0; r[16] = 0; r[17] = 0; r[18] = 0; r[19] = 0; r[20] = 0; r[21] = 0; r[22] = 0; r[23] = 0; r[24] = 0; r[25] = 0; r[26] = 0; r[27] = 0; r[28] = 0; r[29] = 0; r[30] = 0; r[31] = 0; r[32] = 0; r[33] = 0; r[34] = 0; r[35] = 0; r[36] = 0; r[37] = 0; r[38] = 0; r[39] = 0; r[40] = 0; r[41] = 0; r[42] = 0; r[43] = 0; r[44] = 0; r[45] = 0; r[46] = 0; r[47] = 0; r[48] = 0; r[49] = 0; r[50] = 0; r[51] = 0; r[52] = 0; r[53] = 0; r[54] = 0; r[55] = 0; r[56] = 0; r[57] = 0; r[58] = 0; r[59] = 0; r[60] = 0; r[61] = 0; r[62] = 0; r[63] = 0; r[64] = 0; r[65] = 0; r[66] = 0; r[67] = 0; r[68] = 0; r[69] = 0; r[70] = 0; r[71] = 0; r[72] = 0; r[73] = 0; r[74] = 0; r[75] = 0; r[76] = 0; r[77] = 5; r[78] = 13; r[79] = 13; r[80] = 13; r[81] = 15; r[82] = 15; r[83] = 15; r[84] = 15; r[85] = 15; r[86] = 15; r[87] = 15; r[88] = 15; r[89] = 15; r[90] = 15; r[91] = 15; r[92] = 15; r[93] = 15; r[94] = 15; r[95] = 15; r[96] = 15; r[97] = 9; r[98] = 9; r[99] = 9; r[100] = 7; r[101] = 15; r[102] = 15; r[103] = 15; r[104] = 15; r[105] = 3; r[106] = 11; r[107] = 1; </DeepExtract> return r; }
jvyamlb
positive
441,332
public Criteria andSongsheetidsLessThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "songsheetids" + " cannot be null"); } criteria.add(new Criterion("songSheetIds <", value)); return (Criteria) this; }
public Criteria andSongsheetidsLessThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "songsheetids" + " cannot be null"); } criteria.add(new Criterion("songSheetIds <", value)); </DeepExtract> return (Criteria) this; }
music
positive
441,333
@Override public void write(final byte[] b, final int off, final int len) throws IOException { if (disregardMode || closed) { return; } final String contentLengthHeader = owner.getHeader(WinstoneConstant.CONTENT_LENGTH_HEADER); if ((contentLengthHeader != null) && ((bytesCommitted + len) > Long.parseLong(contentLengthHeader))) { return; } buffer.write(b, off, len); bufferPosition += len; if (bufferPosition >= bufferSize) { commit(); } else if ((contentLengthHeader != null) && ((bufferPosition + bytesCommitted) >= Long.parseLong(contentLengthHeader))) { commit(); } }
@Override public void write(final byte[] b, final int off, final int len) throws IOException { if (disregardMode || closed) { return; } final String contentLengthHeader = owner.getHeader(WinstoneConstant.CONTENT_LENGTH_HEADER); if ((contentLengthHeader != null) && ((bytesCommitted + len) > Long.parseLong(contentLengthHeader))) { return; } buffer.write(b, off, len); <DeepExtract> bufferPosition += len; if (bufferPosition >= bufferSize) { commit(); } else if ((contentLengthHeader != null) && ((bufferPosition + bytesCommitted) >= Long.parseLong(contentLengthHeader))) { commit(); } </DeepExtract> }
winstone
positive
441,334
@Override public boolean writeProperty(String name, Double val, boolean comma) { if (val == null) return comma; if (comma) writeByte(IntChar.INT_COMMA); write((long) name); writeByte(IntChar.INT_COLON); write((long) val); return true; }
@Override public boolean writeProperty(String name, Double val, boolean comma) { if (val == null) return comma; if (comma) writeByte(IntChar.INT_COMMA); write((long) name); writeByte(IntChar.INT_COLON); <DeepExtract> write((long) val); </DeepExtract> return true; }
qson
positive
441,335
@Override public void onSuccess(String t) { L.i("Music More:" + t); MusicData data = new MusicData(); try { JSONObject jsonObject = new JSONObject(t); JSONObject jsonData = jsonObject.getJSONObject("data"); JSONObject jsonAuthor = jsonData.getJSONObject("author"); data.setImgBgUrl(jsonData.getString("cover")); data.setImgPhotoUrl(jsonAuthor.getString("web_url")); mListImg.add(jsonData.getString("cover")); data.setName(jsonAuthor.getString("user_name")); data.setTime(jsonData.getString("last_update_date")); data.setMusicUrl(jsonData.getString("web_url")); data.setTvTitle(jsonData.getString("title")); data.setTvMessage(jsonData.getString("charge_edt")); data.setStory_title(jsonData.getString("story_title")); data.setTvContent(jsonData.getString("story")); mList.add(data); if (mList.size() == mListId.size()) { handler.sendEmptyMessage(Constants.HANDLER_LOFING_MUSIC_LIST); } } catch (JSONException e) { progressBar.setVisibility(View.GONE); } }
@Override public void onSuccess(String t) { L.i("Music More:" + t); <DeepExtract> MusicData data = new MusicData(); try { JSONObject jsonObject = new JSONObject(t); JSONObject jsonData = jsonObject.getJSONObject("data"); JSONObject jsonAuthor = jsonData.getJSONObject("author"); data.setImgBgUrl(jsonData.getString("cover")); data.setImgPhotoUrl(jsonAuthor.getString("web_url")); mListImg.add(jsonData.getString("cover")); data.setName(jsonAuthor.getString("user_name")); data.setTime(jsonData.getString("last_update_date")); data.setMusicUrl(jsonData.getString("web_url")); data.setTvTitle(jsonData.getString("title")); data.setTvMessage(jsonData.getString("charge_edt")); data.setStory_title(jsonData.getString("story_title")); data.setTvContent(jsonData.getString("story")); mList.add(data); if (mList.size() == mListId.size()) { handler.sendEmptyMessage(Constants.HANDLER_LOFING_MUSIC_LIST); } } catch (JSONException e) { progressBar.setVisibility(View.GONE); } </DeepExtract> }
LateNight
positive
441,338
public com.eprosima.idl.parser.tree.Exception createException(String name, Token token) { com.eprosima.idl.parser.tree.Exception exceptionObject = new com.eprosima.idl.parser.tree.Exception(m_scopeFile, isInScopedFile(), m_scope, name, token); com.eprosima.idl.parser.tree.Exception prev = m_exceptions.put(exceptionObject.getScopedname(), exceptionObject); if (prev != null) { System.out.println("Warning: Redefined exception " + prev.getScopedname()); } return exceptionObject; }
public com.eprosima.idl.parser.tree.Exception createException(String name, Token token) { com.eprosima.idl.parser.tree.Exception exceptionObject = new com.eprosima.idl.parser.tree.Exception(m_scopeFile, isInScopedFile(), m_scope, name, token); <DeepExtract> com.eprosima.idl.parser.tree.Exception prev = m_exceptions.put(exceptionObject.getScopedname(), exceptionObject); if (prev != null) { System.out.println("Warning: Redefined exception " + prev.getScopedname()); } </DeepExtract> return exceptionObject; }
IDL-Parser
positive
441,339
@Override public Ticker getTicker(boolean latest) { try { return this.e::getTicker.apply(latest); } catch (Exception ignored) { } return null; }
@Override public Ticker getTicker(boolean latest) { <DeepExtract> try { return this.e::getTicker.apply(latest); } catch (Exception ignored) { } return null; </DeepExtract> }
GOAi
positive
441,341
@Override public ApiResponse<TeamList> getTeamsForUser(String userId, String etag) { return doApiRequest(HttpMethod.GET, apiUrl + getUserRoute(userId) + "/teams", null, etag, TeamList.class); }
@Override public ApiResponse<TeamList> getTeamsForUser(String userId, String etag) { <DeepExtract> return doApiRequest(HttpMethod.GET, apiUrl + getUserRoute(userId) + "/teams", null, etag, TeamList.class); </DeepExtract> }
mattermost4j
positive
441,343
public Object remove(Object key) { String skey; if (key == null) { throw new IllegalArgumentException(); } else if (key instanceof String) { skey = ((String) key); } else { skey = (key.toString()); } Object previous = request.getAttribute(skey); request.removeAttribute(skey); return previous; }
public Object remove(Object key) { <DeepExtract> String skey; if (key == null) { throw new IllegalArgumentException(); } else if (key instanceof String) { skey = ((String) key); } else { skey = (key.toString()); } </DeepExtract> Object previous = request.getAttribute(skey); request.removeAttribute(skey); return previous; }
deface
positive
441,344
public boolean beginFakeDrag() { if (mIsBeingDragged) { return false; } mFakeDragging = true; if (mScrollState == SCROLL_STATE_DRAGGING) { return; } mScrollState = SCROLL_STATE_DRAGGING; if (mPageTransformer != null) { enableLayers(SCROLL_STATE_DRAGGING != SCROLL_STATE_IDLE); } if (mOnPageChangeListener != null) { mOnPageChangeListener.onPageScrollStateChanged(SCROLL_STATE_DRAGGING); } mInitialMotionX = mLastMotionX = 0; if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } else { mVelocityTracker.clear(); } final long time = SystemClock.uptimeMillis(); final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0); mVelocityTracker.addMovement(ev); ev.recycle(); mFakeDragBeginTime = time; return true; }
public boolean beginFakeDrag() { if (mIsBeingDragged) { return false; } mFakeDragging = true; <DeepExtract> if (mScrollState == SCROLL_STATE_DRAGGING) { return; } mScrollState = SCROLL_STATE_DRAGGING; if (mPageTransformer != null) { enableLayers(SCROLL_STATE_DRAGGING != SCROLL_STATE_IDLE); } if (mOnPageChangeListener != null) { mOnPageChangeListener.onPageScrollStateChanged(SCROLL_STATE_DRAGGING); } </DeepExtract> mInitialMotionX = mLastMotionX = 0; if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } else { mVelocityTracker.clear(); } final long time = SystemClock.uptimeMillis(); final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0); mVelocityTracker.addMovement(ev); ev.recycle(); mFakeDragBeginTime = time; return true; }
androidRapid
positive
441,345
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_realm_test); getSupportActionBar().setDisplayHomeAsUpEnabled(true); controllerTest = new RealmControllerTest(); etName = findViewById(R.id.editText_nameInsert); etAddress = findViewById(R.id.editText_addressInsert); etNumber = findViewById(R.id.editText_numberInsert); etIdRead = findViewById(R.id.editText_idRead); etIdDelete = findViewById(R.id.editText_idDelete); findViewById(R.id.button_insert).setOnClickListener(this); findViewById(R.id.button_read).setOnClickListener(this); findViewById(R.id.button_delete).setOnClickListener(this); findViewById(R.id.button_readAll).setOnClickListener(this); findViewById(R.id.button_deleteAll).setOnClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_realm_test); <DeepExtract> getSupportActionBar().setDisplayHomeAsUpEnabled(true); controllerTest = new RealmControllerTest(); etName = findViewById(R.id.editText_nameInsert); etAddress = findViewById(R.id.editText_addressInsert); etNumber = findViewById(R.id.editText_numberInsert); etIdRead = findViewById(R.id.editText_idRead); etIdDelete = findViewById(R.id.editText_idDelete); findViewById(R.id.button_insert).setOnClickListener(this); findViewById(R.id.button_read).setOnClickListener(this); findViewById(R.id.button_delete).setOnClickListener(this); findViewById(R.id.button_readAll).setOnClickListener(this); findViewById(R.id.button_deleteAll).setOnClickListener(this); </DeepExtract> }
Android-development-with-example
positive
441,346
private JsonApiParameterBean getRealParam(JsonApiParameterBean bean) { JsonApiParameterBean realBean; IJsonApiParameter realObj = getRealObj(bean.getRef()); if (realObj != null) { realBean = (JsonApiParameterBean) realObj; } else { realBean = bean; } if (realBean.getSchema() != null) { realBean.getSchema().setRealParam(getRealObj(realBean.getSchema().getRef())); } return realBean; }
private JsonApiParameterBean getRealParam(JsonApiParameterBean bean) { JsonApiParameterBean realBean; IJsonApiParameter realObj = getRealObj(bean.getRef()); if (realObj != null) { realBean = (JsonApiParameterBean) realObj; } else { realBean = bean; } <DeepExtract> if (realBean.getSchema() != null) { realBean.getSchema().setRealParam(getRealObj(realBean.getSchema().getRef())); } </DeepExtract> return realBean; }
developer-be
positive
441,347
public Criteria andSignatureEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "signature" + " cannot be null"); } criteria.add(new Criterion("signature =", value)); return (Criteria) this; }
public Criteria andSignatureEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "signature" + " cannot be null"); } criteria.add(new Criterion("signature =", value)); </DeepExtract> return (Criteria) this; }
wukong-framework
positive
441,348
@Nullable private static PsiFile findProjectFile(@NotNull String original, @NotNull String path, @NotNull String fileName, @NotNull Project project, @NotNull PsiElement originalElement) { debug(original, "path::" + path, project); debug(original, "file::" + fileName, project); if (path.contains("./")) { VirtualFile workingDir = originalElement.getContainingFile().getVirtualFile().getParent(); VirtualFile relativePath = workingDir.findFileByRelativePath(path); if (relativePath != null && relativePath.isDirectory() && relativePath.getCanonicalPath() != null) { debug(original, "changing relative path to: " + relativePath.getCanonicalPath(), project); path = relativePath.getCanonicalPath(); if (!path.endsWith("/")) { path += "/"; } } } PsiFile[] files = FilenameIndex.getFilesByName(project, fileName, ProjectScope.getContentScope(project)); StringBuilder builder = new StringBuilder(); builder.append(path); builder.append(fileName); path = builder.reverse().toString(); debug(original, "matching: " + arrayToString(files), project); for (PsiFile file : files) { debug(original, "trying: " + file.getVirtualFile().getCanonicalPath(), project); if (acceptablePath(path, file)) { debug(original, "matched: " + file.getVirtualFile().getCanonicalPath(), project); return file; } } debug(original, "no acceptable matches", project); return null; }
@Nullable private static PsiFile findProjectFile(@NotNull String original, @NotNull String path, @NotNull String fileName, @NotNull Project project, @NotNull PsiElement originalElement) { <DeepExtract> debug(original, "path::" + path, project); debug(original, "file::" + fileName, project); if (path.contains("./")) { VirtualFile workingDir = originalElement.getContainingFile().getVirtualFile().getParent(); VirtualFile relativePath = workingDir.findFileByRelativePath(path); if (relativePath != null && relativePath.isDirectory() && relativePath.getCanonicalPath() != null) { debug(original, "changing relative path to: " + relativePath.getCanonicalPath(), project); path = relativePath.getCanonicalPath(); if (!path.endsWith("/")) { path += "/"; } } } PsiFile[] files = FilenameIndex.getFilesByName(project, fileName, ProjectScope.getContentScope(project)); StringBuilder builder = new StringBuilder(); builder.append(path); builder.append(fileName); path = builder.reverse().toString(); debug(original, "matching: " + arrayToString(files), project); for (PsiFile file : files) { debug(original, "trying: " + file.getVirtualFile().getCanonicalPath(), project); if (acceptablePath(path, file)) { debug(original, "matched: " + file.getVirtualFile().getCanonicalPath(), project); return file; } } debug(original, "no acceptable matches", project); return null; </DeepExtract> }
intellibot
positive
441,349