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 void dropTable(Class<?> clazz) { if (!tableIsExist(TableInfo.get(clazz))) { String sql = SqlBuilder.getCreatTableSQL(clazz); debugSql(sql); db.execSQL(sql); } TableInfo table = TableInfo.get(clazz); String sql = "DROP TABLE " + table.getTableName(); if (config != null && config.isDebug()) Log.d("Debug SQL", ">>>>>> " + sql); db.execSQL(sql); table.setCheckDatabese(false); }
public void dropTable(Class<?> clazz) { if (!tableIsExist(TableInfo.get(clazz))) { String sql = SqlBuilder.getCreatTableSQL(clazz); debugSql(sql); db.execSQL(sql); } TableInfo table = TableInfo.get(clazz); String sql = "DROP TABLE " + table.getTableName(); <DeepExtract> if (config != null && config.isDebug()) Log.d("Debug SQL", ">>>>>> " + sql); </DeepExtract> db.execSQL(sql); table.setCheckDatabese(false); }
JJEvent
positive
698
private void readZrlePalette(int[] palette, int palSize) throws Exception { if (bytesPerPixel == 1) { if (palSize > readPixelsBuffer.length) { readPixelsBuffer = new byte[palSize]; } zrleInStream.readBytes(readPixelsBuffer, 0, palSize); for (int i = 0; i < palSize; i++) { palette[i] = (int) readPixelsBuffer[i] & 0xFF; } } else { final int l = palSize * 3; if (l > readPixelsBuffer.length) { readPixelsBuffer = new byte[l]; } zrleInStream.readBytes(readPixelsBuffer, 0, l); for (int i = 0; i < palSize; i++) { final int idx = i * 3; palette[i] = ((readPixelsBuffer[idx + 2] & 0xFF) << 16 | (readPixelsBuffer[idx + 1] & 0xFF) << 8 | (readPixelsBuffer[idx] & 0xFF)); } } }
private void readZrlePalette(int[] palette, int palSize) throws Exception { <DeepExtract> if (bytesPerPixel == 1) { if (palSize > readPixelsBuffer.length) { readPixelsBuffer = new byte[palSize]; } zrleInStream.readBytes(readPixelsBuffer, 0, palSize); for (int i = 0; i < palSize; i++) { palette[i] = (int) readPixelsBuffer[i] & 0xFF; } } else { final int l = palSize * 3; if (l > readPixelsBuffer.length) { readPixelsBuffer = new byte[l]; } zrleInStream.readBytes(readPixelsBuffer, 0, l); for (int i = 0; i < palSize; i++) { final int idx = i * 3; palette[i] = ((readPixelsBuffer[idx + 2] & 0xFF) << 16 | (readPixelsBuffer[idx + 1] & 0xFF) << 8 | (readPixelsBuffer[idx] & 0xFF)); } } </DeepExtract> }
androidVNC
positive
699
public Criteria andDropGreaterThanColumn(TestEntity.Column column) { if (new StringBuilder("`drop` > ").append(column.getEscapedColumnName()).toString() == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(new StringBuilder("`drop` > ").append(column.getEscapedColumnName()).toString())); return (Criteria) this; }
public Criteria andDropGreaterThanColumn(TestEntity.Column column) { <DeepExtract> if (new StringBuilder("`drop` > ").append(column.getEscapedColumnName()).toString() == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(new StringBuilder("`drop` > ").append(column.getEscapedColumnName()).toString())); </DeepExtract> return (Criteria) this; }
mybatis-generator-gui-extension
positive
700
public static void callSub(Dispatch dispatchTarget, String name, Object... attributes) { if (dispatchTarget == null) { throw new IllegalArgumentException("Can't pass in null Dispatch object"); } else if (dispatchTarget.isAttached()) { return; } else { throw new IllegalStateException("Dispatch not hooked to windows memory"); } throwIfUnattachedDispatch(dispatchTarget); invokeSubv(dispatchTarget, name, Dispatch.Method | Dispatch.Get, VariantUtilities.objectsToVariants(attributes), new int[attributes.length]); }
public static void callSub(Dispatch dispatchTarget, String name, Object... attributes) { if (dispatchTarget == null) { throw new IllegalArgumentException("Can't pass in null Dispatch object"); } else if (dispatchTarget.isAttached()) { return; } else { throw new IllegalStateException("Dispatch not hooked to windows memory"); } <DeepExtract> throwIfUnattachedDispatch(dispatchTarget); invokeSubv(dispatchTarget, name, Dispatch.Method | Dispatch.Get, VariantUtilities.objectsToVariants(attributes), new int[attributes.length]); </DeepExtract> }
jacob
positive
701
public static String getMethodTypeByIMethodDefIdx(ConstantPool cp, int mdIdx) { ConstantInfo methodInfo = cp.infos[mdIdx - 1]; InterfaceMethodDef methodDef = (InterfaceMethodDef) methodInfo; int idx = ((NameAndType) cp.infos[methodDef.nameAndTypeIndex - 1]).descriptionIndex; return getString(cp, idx); }
public static String getMethodTypeByIMethodDefIdx(ConstantPool cp, int mdIdx) { ConstantInfo methodInfo = cp.infos[mdIdx - 1]; InterfaceMethodDef methodDef = (InterfaceMethodDef) methodInfo; <DeepExtract> int idx = ((NameAndType) cp.infos[methodDef.nameAndTypeIndex - 1]).descriptionIndex; return getString(cp, idx); </DeepExtract> }
mini-jvm
positive
702
@Override public void run() { cacheService.shutdown(); executorStart = false; }
@Override public void run() { <DeepExtract> cacheService.shutdown(); executorStart = false; </DeepExtract> }
opensharding-spi-impl
positive
703
@Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { getViewTreeObserver().removeOnGlobalLayoutListener(this); } currentPosition = pager.getCurrentItem(); if (tabCount == 0) { return; } View v = tabsContainer.getChildAt(currentPosition); int newScrollX = v.getLeft() + 0; if (currentPosition > 0 || 0 > 0) { scrollOffset = (getWidth() / 2) - (v.getWidth() / 2); newScrollX -= scrollOffset; } if (newScrollX != lastScrollX) { lastScrollX = newScrollX; scrollTo(newScrollX, 0); } }
@Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { getViewTreeObserver().removeOnGlobalLayoutListener(this); } currentPosition = pager.getCurrentItem(); <DeepExtract> if (tabCount == 0) { return; } View v = tabsContainer.getChildAt(currentPosition); int newScrollX = v.getLeft() + 0; if (currentPosition > 0 || 0 > 0) { scrollOffset = (getWidth() / 2) - (v.getWidth() / 2); newScrollX -= scrollOffset; } if (newScrollX != lastScrollX) { lastScrollX = newScrollX; scrollTo(newScrollX, 0); } </DeepExtract> }
SunmiUI
positive
704
private List getTorrentContents(final ContentsListCallback callback) { final List<ContentFile> contentFiles = new ArrayList<>(); String url = MainActivity.buildURL(); url = url + "/api/v2/torrents/files?hash=" + hash; JsonArrayRequest jsArrayRequest = new JsonArrayRequest(Request.Method.GET, url, null, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { Type listType = new TypeToken<List<ContentFile>>() { }.getType(); contentFiles.addAll((List<ContentFile>) new Gson().fromJson(response.toString(), listType)); callback.onSuccess(contentFiles); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { NetworkResponse networkResponse = error.networkResponse; if (networkResponse != null) { Log.d("Debug", "getTorrentContents - statusCode: " + networkResponse.statusCode); } Log.d("Debug", "getTorrentContents - Error in JSON response: " + error.getMessage()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<>(); params.put("User-Agent", "qBittorrent for Android"); params.put("Referer", protocol + "://" + hostname + (port != -1 ? ":" + port : "")); params.put("Content-Type", "application/x-www-form-urlencoded"); params.put("Cookie", cookie); return params; } }; VolleySingleton.getInstance(getActivity().getApplication()).addToRequestQueueHttps(jsArrayRequest, keystore_path, keystore_password); return contentFiles; }
private List getTorrentContents(final ContentsListCallback callback) { final List<ContentFile> contentFiles = new ArrayList<>(); String url = MainActivity.buildURL(); url = url + "/api/v2/torrents/files?hash=" + hash; JsonArrayRequest jsArrayRequest = new JsonArrayRequest(Request.Method.GET, url, null, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { Type listType = new TypeToken<List<ContentFile>>() { }.getType(); contentFiles.addAll((List<ContentFile>) new Gson().fromJson(response.toString(), listType)); callback.onSuccess(contentFiles); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { NetworkResponse networkResponse = error.networkResponse; if (networkResponse != null) { Log.d("Debug", "getTorrentContents - statusCode: " + networkResponse.statusCode); } Log.d("Debug", "getTorrentContents - Error in JSON response: " + error.getMessage()); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> params = new HashMap<>(); params.put("User-Agent", "qBittorrent for Android"); params.put("Referer", protocol + "://" + hostname + (port != -1 ? ":" + port : "")); params.put("Content-Type", "application/x-www-form-urlencoded"); params.put("Cookie", cookie); return params; } }; <DeepExtract> VolleySingleton.getInstance(getActivity().getApplication()).addToRequestQueueHttps(jsArrayRequest, keystore_path, keystore_password); </DeepExtract> return contentFiles; }
qBittorrent-Controller
positive
705
public static <T> T decode(String json, Class<T> clazz) throws DecodeException { JsonParser parser = null; try { parser = factory.createParser(json); parser.nextToken(); res = parseAny(parser); remaining = parser.nextToken(); } catch (IOException e) { throw new DecodeException("Failed to decode:" + e.getMessage(), e); } finally { close(parser); } if (remaining != null) { throw new DecodeException("Unexpected trailing token"); } if (res instanceof Map) { if (!clazz.isAssignableFrom(Map.class)) { throw new DecodeException("Failed to decode"); } if (clazz == Object.class) { res = new JsonObject((Map) res); } return clazz.cast(res); } else if (res instanceof List) { if (!clazz.isAssignableFrom(List.class)) { throw new DecodeException("Failed to decode"); } if (clazz == Object.class) { res = new JsonArray((List) res); } return clazz.cast(res); } else if (res instanceof String) { if (!clazz.isAssignableFrom(String.class)) { throw new DecodeException("Failed to decode"); } return clazz.cast(res); } else if (res instanceof Boolean) { if (!clazz.isAssignableFrom(Boolean.class)) { throw new DecodeException("Failed to decode"); } return clazz.cast(res); } else if (res == null) { return null; } else { Number number = (Number) res; if (clazz == Integer.class) { res = number.intValue(); } else if (clazz == Long.class) { res = number.longValue(); } else if (clazz == Float.class) { res = number.floatValue(); } else if (clazz == Double.class) { res = number.doubleValue(); } else if (clazz == Byte.class) { res = number.byteValue(); } else if (clazz == Short.class) { res = number.shortValue(); } else if (clazz == Object.class || clazz.isAssignableFrom(Number.class)) { } else { throw new DecodeException("Failed to decode"); } return clazz.cast(res); } }
public static <T> T decode(String json, Class<T> clazz) throws DecodeException { JsonParser parser = null; try { parser = factory.createParser(json); parser.nextToken(); res = parseAny(parser); remaining = parser.nextToken(); } catch (IOException e) { throw new DecodeException("Failed to decode:" + e.getMessage(), e); } finally { close(parser); } if (remaining != null) { throw new DecodeException("Unexpected trailing token"); } <DeepExtract> if (res instanceof Map) { if (!clazz.isAssignableFrom(Map.class)) { throw new DecodeException("Failed to decode"); } if (clazz == Object.class) { res = new JsonObject((Map) res); } return clazz.cast(res); } else if (res instanceof List) { if (!clazz.isAssignableFrom(List.class)) { throw new DecodeException("Failed to decode"); } if (clazz == Object.class) { res = new JsonArray((List) res); } return clazz.cast(res); } else if (res instanceof String) { if (!clazz.isAssignableFrom(String.class)) { throw new DecodeException("Failed to decode"); } return clazz.cast(res); } else if (res instanceof Boolean) { if (!clazz.isAssignableFrom(Boolean.class)) { throw new DecodeException("Failed to decode"); } return clazz.cast(res); } else if (res == null) { return null; } else { Number number = (Number) res; if (clazz == Integer.class) { res = number.intValue(); } else if (clazz == Long.class) { res = number.longValue(); } else if (clazz == Float.class) { res = number.floatValue(); } else if (clazz == Double.class) { res = number.doubleValue(); } else if (clazz == Byte.class) { res = number.byteValue(); } else if (clazz == Short.class) { res = number.shortValue(); } else if (clazz == Object.class || clazz.isAssignableFrom(Number.class)) { } else { throw new DecodeException("Failed to decode"); } return clazz.cast(res); } </DeepExtract> }
Lealone-Plugins
positive
706
public double getMoneyOfPlayer(UUID playerUUID) { OfflinePlayer player = PlayerUtils.getOfflinePlayer(playerUUID); Boolean ret = this.economy.hasAccount(player); if (!ret && true) this.economy.createPlayerAccount(player); return ret; return this.economy.getBalance(player); }
public double getMoneyOfPlayer(UUID playerUUID) { OfflinePlayer player = PlayerUtils.getOfflinePlayer(playerUUID); <DeepExtract> Boolean ret = this.economy.hasAccount(player); if (!ret && true) this.economy.createPlayerAccount(player); return ret; </DeepExtract> return this.economy.getBalance(player); }
GlobalMarketChest
positive
707
public static AnnotationCollection fetchByUserAndProject(User user, Project project) throws CytomineException { Map<String, Object> parameters = new HashMap<>(); parameters.put(user.getClass().getSimpleName().toLowerCase(), user.getId()); parameters.put(project.getClass().getSimpleName().toLowerCase(), project.getId()); return fetchWithParameters(Cytomine.getInstance().getDefaultCytomineConnection(), parameters, 0, 0); }
public static AnnotationCollection fetchByUserAndProject(User user, Project project) throws CytomineException { Map<String, Object> parameters = new HashMap<>(); parameters.put(user.getClass().getSimpleName().toLowerCase(), user.getId()); parameters.put(project.getClass().getSimpleName().toLowerCase(), project.getId()); <DeepExtract> return fetchWithParameters(Cytomine.getInstance().getDefaultCytomineConnection(), parameters, 0, 0); </DeepExtract> }
Cytomine-java-client
positive
708
@Override public long toKB(long size) { if (size > MAX / (C2 / C1)) return Long.MAX_VALUE; if (size < -MAX / (C2 / C1)) return Long.MIN_VALUE; return size * C2 / C1; }
@Override public long toKB(long size) { <DeepExtract> if (size > MAX / (C2 / C1)) return Long.MAX_VALUE; if (size < -MAX / (C2 / C1)) return Long.MIN_VALUE; return size * C2 / C1; </DeepExtract> }
csdn_common
positive
709
@Override public void onSurfaceChanged(GL10 gl, int width, int height) { super.onSurfaceChanged(gl, width, height); if (CameraEngine.getCamera() == null) CameraEngine.openCamera(); CameraInfo info = CameraEngine.getCameraInfo(); if (info.orientation == 90 || info.orientation == 270) { imageWidth = info.previewHeight; imageHeight = info.previewWidth; } else { imageWidth = info.previewWidth; imageHeight = info.previewHeight; } cameraInputFilter.onInputSizeChanged(imageWidth, imageHeight); adjustSize(info.orientation, info.isFront, true); if (surfaceTexture != null) CameraEngine.startPreview(surfaceTexture); }
@Override public void onSurfaceChanged(GL10 gl, int width, int height) { super.onSurfaceChanged(gl, width, height); <DeepExtract> if (CameraEngine.getCamera() == null) CameraEngine.openCamera(); CameraInfo info = CameraEngine.getCameraInfo(); if (info.orientation == 90 || info.orientation == 270) { imageWidth = info.previewHeight; imageHeight = info.previewWidth; } else { imageWidth = info.previewWidth; imageHeight = info.previewHeight; } cameraInputFilter.onInputSizeChanged(imageWidth, imageHeight); adjustSize(info.orientation, info.isFront, true); if (surfaceTexture != null) CameraEngine.startPreview(surfaceTexture); </DeepExtract> }
MagicCamera-ImageReader
positive
710
@Deprecated public static int[] readInts() { String[] fields = readAllStrings(); int[] vals = new int[fields.length]; for (int i = 0; i < fields.length; i++) vals[i] = Integer.parseInt(fields[i]); return vals; }
@Deprecated public static int[] readInts() { <DeepExtract> String[] fields = readAllStrings(); int[] vals = new int[fields.length]; for (int i = 0; i < fields.length; i++) vals[i] = Integer.parseInt(fields[i]); return vals; </DeepExtract> }
CS112-Rutgers
positive
711
@Override public Integer value7() { return (Integer) get(6); }
@Override public Integer value7() { <DeepExtract> return (Integer) get(6); </DeepExtract> }
wdumper
positive
712
private void scrollReleaseToLoadMoreToLoadingMore() { removeCallbacks(this); mmLastY = 0; if (!mScroller.isFinished()) { mScroller.forceFinished(true); } mScroller.startScroll(0, 0, 0, -mFooterOffset - mFooterHeight, mReleaseToLoadMoreToLoadingMoreScrollingDuration); post(this); mRunning = true; }
private void scrollReleaseToLoadMoreToLoadingMore() { <DeepExtract> removeCallbacks(this); mmLastY = 0; if (!mScroller.isFinished()) { mScroller.forceFinished(true); } mScroller.startScroll(0, 0, 0, -mFooterOffset - mFooterHeight, mReleaseToLoadMoreToLoadingMoreScrollingDuration); post(this); mRunning = true; </DeepExtract> }
SwipeToLoadLayout
positive
714
int read_frame_data(int bytesize) throws BitstreamException { int numread = 0; int nRead = 0; try { while (bytesize > 0) { int bytesread = source.read(frame_bytes, 0, bytesize); if (bytesread == -1) { while (bytesize-- > 0) { frame_bytes[0++] = 0; } break; } nRead = nRead + bytesread; 0 += bytesread; bytesize -= bytesread; } } catch (IOException ex) { throw newBitstreamException(STREAM_ERROR, ex); } return nRead; framesize = bytesize; wordpointer = -1; bitindex = -1; return numread; }
int read_frame_data(int bytesize) throws BitstreamException { int numread = 0; <DeepExtract> int nRead = 0; try { while (bytesize > 0) { int bytesread = source.read(frame_bytes, 0, bytesize); if (bytesread == -1) { while (bytesize-- > 0) { frame_bytes[0++] = 0; } break; } nRead = nRead + bytesread; 0 += bytesread; bytesize -= bytesread; } } catch (IOException ex) { throw newBitstreamException(STREAM_ERROR, ex); } return nRead; </DeepExtract> framesize = bytesize; wordpointer = -1; bitindex = -1; return numread; }
MineTunes
positive
715
public Criteria andSINGLENotEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "SINGLE" + " cannot be null"); } criteria.add(new Criterion("SINGLE <>", value)); return (Criteria) this; }
public Criteria andSINGLENotEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "SINGLE" + " cannot be null"); } criteria.add(new Criterion("SINGLE <>", value)); </DeepExtract> return (Criteria) this; }
mybatis-generator-gui-extension
positive
718
@Before public void before() { return createHelper(LocalIntObj.class); }
@Before public void before() { <DeepExtract> return createHelper(LocalIntObj.class); </DeepExtract> }
Squeaky
positive
719
public static Fragment hideAllShowFragment(@NonNull Fragment fragment) { List<Fragment> fragments = getFragments(fragment.getFragmentManager()); if (fragments.isEmpty()) { return; } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null) { hideFragment(fragment); } } return operateFragment(fragment.getFragmentManager(), null, fragment, TYPE_SHOW_FRAGMENT); }
public static Fragment hideAllShowFragment(@NonNull Fragment fragment) { <DeepExtract> List<Fragment> fragments = getFragments(fragment.getFragmentManager()); if (fragments.isEmpty()) { return; } for (int i = fragments.size() - 1; i >= 0; --i) { Fragment fragment = fragments.get(i); if (fragment != null) { hideFragment(fragment); } } </DeepExtract> return operateFragment(fragment.getFragmentManager(), null, fragment, TYPE_SHOW_FRAGMENT); }
MVVMArms
positive
720
public int totalNQueens(int n) { boolean[] cols = new boolean[n]; boolean[] d1 = new boolean[2 * n]; boolean[] d2 = new boolean[2 * n]; if (0 == n) { res++; return; } for (int col = 0; col < n; col++) { int id1 = col - 0 + n; int id2 = col + 0; if (cols[col] || d1[id1] || d2[id2]) continue; cols[col] = true; d1[id1] = true; d2[id2] = true; helper(0 + 1, cols, d1, d2, n); cols[col] = false; d1[id1] = false; d2[id2] = false; } return res; }
public int totalNQueens(int n) { boolean[] cols = new boolean[n]; boolean[] d1 = new boolean[2 * n]; boolean[] d2 = new boolean[2 * n]; <DeepExtract> if (0 == n) { res++; return; } for (int col = 0; col < n; col++) { int id1 = col - 0 + n; int id2 = col + 0; if (cols[col] || d1[id1] || d2[id2]) continue; cols[col] = true; d1[id1] = true; d2[id2] = true; helper(0 + 1, cols, d1, d2, n); cols[col] = false; d1[id1] = false; d2[id2] = false; } </DeepExtract> return res; }
cspiration
positive
721
public Criteria andCollegeidIn(List<Integer> values) { if (values == null) { throw new RuntimeException("Value for " + "collegeid" + " cannot be null"); } criteria.add(new Criterion("collegeID in", values)); return (Criteria) this; }
public Criteria andCollegeidIn(List<Integer> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "collegeid" + " cannot be null"); } criteria.add(new Criterion("collegeID in", values)); </DeepExtract> return (Criteria) this; }
examination_system-
positive
722
@Test public void testEventuallyCollect() throws Exception { setupEventuallyCollect(20, 10); assertEquals(future, underTest.eventuallyCollect(callables, consumer, supplier, 10)); verifyEventuallyCollect(20, 10); }
@Test public void testEventuallyCollect() throws Exception { <DeepExtract> setupEventuallyCollect(20, 10); assertEquals(future, underTest.eventuallyCollect(callables, consumer, supplier, 10)); verifyEventuallyCollect(20, 10); </DeepExtract> }
tiny-async-java
positive
723
public void toggleShowingComplexSetup() { this.complex.toggleShowingComplexSetup(); this.changed = true; fireState(); fireComplexState(); final int c = this.textPane.getCaretPosition(); final Map<String, Object> model = new HashMap<String, Object>(); final Config config = Config.getInstance(); model.put("complex", this.complex); model.put("print", false); model.put("config", config); final String content = TemplateFactory.processTemplate(template, model); this.textPane.setText(content); this.textPane.setCaretPosition(Math.min(this.textPane.getDocument().getLength() - 1, c)); this.textPane.requestFocus(); }
public void toggleShowingComplexSetup() { this.complex.toggleShowingComplexSetup(); this.changed = true; fireState(); fireComplexState(); <DeepExtract> final int c = this.textPane.getCaretPosition(); final Map<String, Object> model = new HashMap<String, Object>(); final Config config = Config.getInstance(); model.put("complex", this.complex); model.put("print", false); model.put("config", config); final String content = TemplateFactory.processTemplate(template, model); this.textPane.setText(content); this.textPane.setCaretPosition(Math.min(this.textPane.getDocument().getLength() - 1, c)); this.textPane.requestFocus(); </DeepExtract> }
xadrian
positive
724
public void update(GameContainer container, int delta) throws SlickException { previousx = x; previousy = y; if (stateManager.isActive()) { stateManager.update(container, delta); return; } if (currentAnim != null) { Animation anim = animations.get(currentAnim); if (anim != null) { anim.update(delta); } } if (speed != null) { x += speed.x; y += speed.y; } previousx = x; previousy = y; }
public void update(GameContainer container, int delta) throws SlickException { previousx = x; previousy = y; if (stateManager.isActive()) { stateManager.update(container, delta); return; } <DeepExtract> if (currentAnim != null) { Animation anim = animations.get(currentAnim); if (anim != null) { anim.update(delta); } } </DeepExtract> if (speed != null) { x += speed.x; y += speed.y; } previousx = x; previousy = y; }
MarteEngine
positive
725
@Override public void deleteElogFile(Integer eLogId) { elogMapper.deleteElog(eLogId); }
@Override public void deleteElogFile(Integer eLogId) { <DeepExtract> elogMapper.deleteElog(eLogId); </DeepExtract> }
warmerblog
positive
726
public void onClick(View v) { if (Constants.LOG_V) Log.v(TAG, "onStartNewGameButton()"); savePuzzlePreferences(); String puzzleSourceId = getSelectedPuzzleSource(); new GameLauncher(this, db).startNewGame(puzzleSourceId); }
public void onClick(View v) { <DeepExtract> if (Constants.LOG_V) Log.v(TAG, "onStartNewGameButton()"); savePuzzlePreferences(); String puzzleSourceId = getSelectedPuzzleSource(); new GameLauncher(this, db).startNewGame(puzzleSourceId); </DeepExtract> }
andoku
positive
727
@Override public void actionPerformed(java.awt.event.ActionEvent evt) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Directory Select"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { folderField.setText(chooser.getSelectedFile().getAbsolutePath() + File.separator); } }
@Override public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Directory Select"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { folderField.setText(chooser.getSelectedFile().getAbsolutePath() + File.separator); } </DeepExtract> }
OkapiBarcode
positive
728
@Override public final void asyncSubmit(final List list) { if (list == null) throw new IllegalArgumentException("list must not be null"); if (this.port == null) throw new UsbDisconnectedException(); for (final Object item : list) { if (!(item instanceof UsbControlIrp)) throw new IllegalArgumentException("List contains non-UsbControlIrp objects"); asyncSubmit((UsbControlIrp) item); } }
@Override public final void asyncSubmit(final List list) { if (list == null) throw new IllegalArgumentException("list must not be null"); <DeepExtract> if (this.port == null) throw new UsbDisconnectedException(); </DeepExtract> for (final Object item : list) { if (!(item instanceof UsbControlIrp)) throw new IllegalArgumentException("List contains non-UsbControlIrp objects"); asyncSubmit((UsbControlIrp) item); } }
usb4java-javax
positive
729
public ImageIcon LeftIcon() { try { URL iconPath = getClass().getClassLoader().getResource(Left); return new ImageIcon(new ImageIcon(iconPath).getImage()); } catch (Exception ex) { LogWriter.WriteToLog(ex.fillInStackTrace()); return new ImageIcon(createTransparentImage(1, 1)); } }
public ImageIcon LeftIcon() { <DeepExtract> try { URL iconPath = getClass().getClassLoader().getResource(Left); return new ImageIcon(new ImageIcon(iconPath).getImage()); } catch (Exception ex) { LogWriter.WriteToLog(ex.fillInStackTrace()); return new ImageIcon(createTransparentImage(1, 1)); } </DeepExtract> }
MQAdminTool
positive
730
private void checkMojo(MojoDescriptor mojoDescriptor) { assertEquals("test:testGoal", mojoDescriptor.getFullGoalName()); assertEquals("org.apache.maven.tools.plugin.generator.TestMojo", mojoDescriptor.getImplementation()); assertEquals("per-lookup", mojoDescriptor.getInstantiationStrategy()); assertNotNull(mojoDescriptor.isDependencyResolutionRequired()); assertEquals("dir", mojoDescriptor.getParameters().get(0).getName()); assertEquals(String.class.getName(), mojoDescriptor.getParameters().get(0).getType()); assertTrue(mojoDescriptor.getParameters().get(0).isRequired()); assertEquals("some.alias", mojoDescriptor.getParameters().get(0).getAlias()); Parameter parameterWithGenerics = mojoDescriptor.getParameters().get(2); assertNotNull(parameterWithGenerics); assertEquals("parameterWithGenerics", parameterWithGenerics.getName()); assertEquals("java.util.Collection", parameterWithGenerics.getType()); PlexusConfiguration configurations = mojoDescriptor.getMojoConfiguration(); assertNotNull(configurations); PlexusConfiguration configuration = configurations.getChild("parameterWithGenerics"); assertEquals("java.util.Collection", configuration.getAttribute("implementation")); assertEquals("a,b,c", configuration.getAttribute("default-value")); assertEquals("${customParam}", configuration.getValue()); }
private void checkMojo(MojoDescriptor mojoDescriptor) { assertEquals("test:testGoal", mojoDescriptor.getFullGoalName()); assertEquals("org.apache.maven.tools.plugin.generator.TestMojo", mojoDescriptor.getImplementation()); assertEquals("per-lookup", mojoDescriptor.getInstantiationStrategy()); assertNotNull(mojoDescriptor.isDependencyResolutionRequired()); <DeepExtract> assertEquals("dir", mojoDescriptor.getParameters().get(0).getName()); assertEquals(String.class.getName(), mojoDescriptor.getParameters().get(0).getType()); assertTrue(mojoDescriptor.getParameters().get(0).isRequired()); assertEquals("some.alias", mojoDescriptor.getParameters().get(0).getAlias()); </DeepExtract> Parameter parameterWithGenerics = mojoDescriptor.getParameters().get(2); assertNotNull(parameterWithGenerics); assertEquals("parameterWithGenerics", parameterWithGenerics.getName()); assertEquals("java.util.Collection", parameterWithGenerics.getType()); PlexusConfiguration configurations = mojoDescriptor.getMojoConfiguration(); assertNotNull(configurations); PlexusConfiguration configuration = configurations.getChild("parameterWithGenerics"); assertEquals("java.util.Collection", configuration.getAttribute("implementation")); assertEquals("a,b,c", configuration.getAttribute("default-value")); assertEquals("${customParam}", configuration.getValue()); }
maven-plugin-tools
positive
731
@Test public void testEntityReference1() throws Exception { QuickTestConfiguration.setXsdLocation("./data/general/empty.xsd"); QuickTestConfiguration.setXmlLocation("./data/general/entityReference1.xml"); QuickTestConfiguration.setExiLocation("./out/general/entityReference1.xml.exi"); FidelityOptions noValidOptions = FidelityOptions.createStrict(); noValidOptions.setFidelity(FidelityOptions.FEATURE_LEXICAL_VALUE, true); _test(noValidOptions); }
@Test public void testEntityReference1() throws Exception { <DeepExtract> QuickTestConfiguration.setXsdLocation("./data/general/empty.xsd"); QuickTestConfiguration.setXmlLocation("./data/general/entityReference1.xml"); QuickTestConfiguration.setExiLocation("./out/general/entityReference1.xml.exi"); </DeepExtract> FidelityOptions noValidOptions = FidelityOptions.createStrict(); noValidOptions.setFidelity(FidelityOptions.FEATURE_LEXICAL_VALUE, true); _test(noValidOptions); }
exificient
positive
732
public Criteria andConfDescNotEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "confDesc" + " cannot be null"); } criteria.add(new Criterion("conf_desc <>", value)); return (Criteria) this; }
public Criteria andConfDescNotEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "confDesc" + " cannot be null"); } criteria.add(new Criterion("conf_desc <>", value)); </DeepExtract> return (Criteria) this; }
lightconf
positive
733
public <T> void register(Class<T> clazz, List<Class<?>> typeClasses, JsonReader reader) { Node<Class<?>, JsonReader<?>> typeTree = typedReaders.get(clazz); if (typeTree == null) { typeTree = new Node<Class<?>, JsonReader<?>>(clazz); } Node<Class<?>, T> child = typeTree.addChildNode(typeClasses.get(0)); if (typeClasses.size() > 1) { registerPath(child, typeClasses.subList(1, typeClasses.size()), reader); } else { child.setValue(reader); } typedReaders.put(clazz, typeTree); }
public <T> void register(Class<T> clazz, List<Class<?>> typeClasses, JsonReader reader) { Node<Class<?>, JsonReader<?>> typeTree = typedReaders.get(clazz); if (typeTree == null) { typeTree = new Node<Class<?>, JsonReader<?>>(clazz); } <DeepExtract> Node<Class<?>, T> child = typeTree.addChildNode(typeClasses.get(0)); if (typeClasses.size() > 1) { registerPath(child, typeClasses.subList(1, typeClasses.size()), reader); } else { child.setValue(reader); } </DeepExtract> typedReaders.put(clazz, typeTree); }
piriti
positive
734
public CollectionComposer<MapComposer<PARENT>, ?> startArrayProperty(String propName) { if (_child != null) { Object value = _child._finish(); _map.put(_propName, value); _child = null; } _propName = propName; CollectionComposer<MapComposer<PARENT>, ?> child = _startCollection(this); _map.put(propName, child._collection ? Boolean.TRUE : Boolean.FALSE); return this; return child; }
public CollectionComposer<MapComposer<PARENT>, ?> startArrayProperty(String propName) { if (_child != null) { Object value = _child._finish(); _map.put(_propName, value); _child = null; } _propName = propName; CollectionComposer<MapComposer<PARENT>, ?> child = _startCollection(this); <DeepExtract> _map.put(propName, child._collection ? Boolean.TRUE : Boolean.FALSE); return this; </DeepExtract> return child; }
jackson-jr
positive
735
public static ChartPanel get(String title, String xLabel, String yLabel, Map<String, WordStatistic> data, Type type) { JFreeChart lineChart = ChartFactory.createXYLineChart(title, xLabel, yLabel, createDataset(getMap(data, type), type), PlotOrientation.VERTICAL, false, true, false); ((XYPlot) lineChart.getPlot()).getDomainAxis().setRange(((XYPlot) lineChart.getPlot()).getDomainAxis().getLowerBound() - ((XYPlot) lineChart.getPlot()).getDomainAxis().getUpperBound() / 100f, ((XYPlot) lineChart.getPlot()).getDomainAxis().getUpperBound()); ((XYPlot) lineChart.getPlot()).getRangeAxis().setRange(((XYPlot) lineChart.getPlot()).getRangeAxis().getLowerBound() - ((XYPlot) lineChart.getPlot()).getRangeAxis().getUpperBound() / 100f, ((XYPlot) lineChart.getPlot()).getRangeAxis().getUpperBound()); ((XYPlot) lineChart.getPlot()).getRenderer().setSeriesStroke(0, new BasicStroke(4.0f)); ChartPanel chartPanel = new ChartPanel(lineChart); chartPanel.setSize(300, 100); return chartPanel; }
public static ChartPanel get(String title, String xLabel, String yLabel, Map<String, WordStatistic> data, Type type) { JFreeChart lineChart = ChartFactory.createXYLineChart(title, xLabel, yLabel, createDataset(getMap(data, type), type), PlotOrientation.VERTICAL, false, true, false); <DeepExtract> ((XYPlot) lineChart.getPlot()).getDomainAxis().setRange(((XYPlot) lineChart.getPlot()).getDomainAxis().getLowerBound() - ((XYPlot) lineChart.getPlot()).getDomainAxis().getUpperBound() / 100f, ((XYPlot) lineChart.getPlot()).getDomainAxis().getUpperBound()); ((XYPlot) lineChart.getPlot()).getRangeAxis().setRange(((XYPlot) lineChart.getPlot()).getRangeAxis().getLowerBound() - ((XYPlot) lineChart.getPlot()).getRangeAxis().getUpperBound() / 100f, ((XYPlot) lineChart.getPlot()).getRangeAxis().getUpperBound()); ((XYPlot) lineChart.getPlot()).getRenderer().setSeriesStroke(0, new BasicStroke(4.0f)); </DeepExtract> ChartPanel chartPanel = new ChartPanel(lineChart); chartPanel.setSize(300, 100); return chartPanel; }
university
positive
736
public static String getMD5AndSalt(String str, String salt) { byte[] data = encryptMD5(str).concat(salt).getBytes(); MessageDigest md5 = null; try { md5 = MessageDigest.getInstance("MD5"); md5.update(data); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } byte[] resultBytes = md5.digest(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < resultBytes.length; i++) { if (Integer.toHexString(0xFF & resultBytes[i]).length() == 1) { builder.append("0").append(Integer.toHexString(0xFF & resultBytes[i])); } else { builder.append(Integer.toHexString(0xFF & resultBytes[i])); } } return builder.toString(); }
public static String getMD5AndSalt(String str, String salt) { <DeepExtract> byte[] data = encryptMD5(str).concat(salt).getBytes(); MessageDigest md5 = null; try { md5 = MessageDigest.getInstance("MD5"); md5.update(data); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } byte[] resultBytes = md5.digest(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < resultBytes.length; i++) { if (Integer.toHexString(0xFF & resultBytes[i]).length() == 1) { builder.append("0").append(Integer.toHexString(0xFF & resultBytes[i])); } else { builder.append(Integer.toHexString(0xFF & resultBytes[i])); } } return builder.toString(); </DeepExtract> }
ChuMuYa
positive
737
@Override public Future<Long> llen(byte[] key) { return execCmd(objectConverter, encode(channel.alloc(), longConverter, encode(channel.alloc(), LLEN.raw, key))); }
@Override public Future<Long> llen(byte[] key) { <DeepExtract> return execCmd(objectConverter, encode(channel.alloc(), longConverter, encode(channel.alloc(), LLEN.raw, key))); </DeepExtract> }
nedis
positive
738
public void init(boolean forEncryption, CipherParameters params) { if (!(params instanceof KeyParameter)) { throw new IllegalArgumentException("invalid parameter passed to RC6 init - " + params.getClass().getName()); } KeyParameter p = (KeyParameter) params; this.forEncryption = forEncryption; BigInteger[] L = new BigInteger[(p.getKey().length + bytesPerWord - 1) / bytesPerWord]; for (int i = 0; i != p.getKey().length; i++) { BigInteger b = shiftLeft(BigInteger.valueOf((long) (p.getKey()[i] & 0xff)), (8 * (i % bytesPerWord))); BigInteger val = L[i / bytesPerWord]; if (val == null) { val = BigInteger.ZERO; } L[i / bytesPerWord] = add(val, b); } _S = new BigInteger[2 + 2 * _noRounds + 2]; _S[0] = P64; for (int i = 1; i < _S.length; i++) { _S[i] = add(_S[i - 1], Q64); } int iter; if (L.length > _S.length) { iter = 3 * L.length; } else { iter = 3 * _S.length; } BigInteger A = BigInteger.ZERO; BigInteger B = BigInteger.ZERO; int i = 0, j = 0; for (int k = 0; k < iter; k++) { A = _S[i] = rotateLeft(add(add(_S[i], A), B), BigInteger.valueOf(3)); B = L[j] = rotateLeft(add(add(L[j], A), B), add(A, B)); i = (i + 1) % _S.length; j = (j + 1) % L.length; } }
public void init(boolean forEncryption, CipherParameters params) { if (!(params instanceof KeyParameter)) { throw new IllegalArgumentException("invalid parameter passed to RC6 init - " + params.getClass().getName()); } KeyParameter p = (KeyParameter) params; this.forEncryption = forEncryption; <DeepExtract> BigInteger[] L = new BigInteger[(p.getKey().length + bytesPerWord - 1) / bytesPerWord]; for (int i = 0; i != p.getKey().length; i++) { BigInteger b = shiftLeft(BigInteger.valueOf((long) (p.getKey()[i] & 0xff)), (8 * (i % bytesPerWord))); BigInteger val = L[i / bytesPerWord]; if (val == null) { val = BigInteger.ZERO; } L[i / bytesPerWord] = add(val, b); } _S = new BigInteger[2 + 2 * _noRounds + 2]; _S[0] = P64; for (int i = 1; i < _S.length; i++) { _S[i] = add(_S[i - 1], Q64); } int iter; if (L.length > _S.length) { iter = 3 * L.length; } else { iter = 3 * _S.length; } BigInteger A = BigInteger.ZERO; BigInteger B = BigInteger.ZERO; int i = 0, j = 0; for (int k = 0; k < iter; k++) { A = _S[i] = rotateLeft(add(add(_S[i], A), B), BigInteger.valueOf(3)); B = L[j] = rotateLeft(add(add(L[j], A), B), add(A, B)); i = (i + 1) % _S.length; j = (j + 1) % L.length; } </DeepExtract> }
continent
positive
739
public Criteria andIdGreaterThan(Long value) { if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id >", value)); return (Criteria) this; }
public Criteria andIdGreaterThan(Long value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id >", value)); </DeepExtract> return (Criteria) this; }
MarketServer
positive
740
@Override protected void replaceConfigurationImpl(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy) { if (implicitConfigurationReplacement != null) { new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy) = new CheckConfigurationVersionAndExecuteCommand<T>(new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy), implicitConfigurationReplacement.getDesiredConfigurationVersion()); } boolean wasInitializedBeforeExecution = wasInitialized.get(); CommandResult<T> result = commandExecutor.execute(new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy)); if (!result.isBucketNotFound() && !result.isConfigurationNeedToBeReplaced()) { return result.getData(); } if (result.isBucketNotFound() && recoveryStrategy == RecoveryStrategy.THROW_BUCKET_NOT_FOUND_EXCEPTION && wasInitializedBeforeExecution) { throw new BucketNotFoundException(); } RemoteCommand<T> initAndExecuteCommand = implicitConfigurationReplacement == null ? new CreateInitialStateAndExecuteCommand<>(getConfiguration(), new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy)) : new CreateInitialStateWithVersionOrReplaceConfigurationAndExecuteCommand<>(getConfiguration(), new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy), implicitConfigurationReplacement.getDesiredConfigurationVersion(), implicitConfigurationReplacement.getTokensInheritanceStrategy()); CommandResult<T> resultAfterInitialization = commandExecutor.execute(initAndExecuteCommand); if (resultAfterInitialization.isBucketNotFound()) { throw new IllegalStateException("Bucket is not initialized properly"); } T data = resultAfterInitialization.getData(); wasInitialized.set(true); return data; }
@Override protected void replaceConfigurationImpl(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy) { <DeepExtract> if (implicitConfigurationReplacement != null) { new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy) = new CheckConfigurationVersionAndExecuteCommand<T>(new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy), implicitConfigurationReplacement.getDesiredConfigurationVersion()); } boolean wasInitializedBeforeExecution = wasInitialized.get(); CommandResult<T> result = commandExecutor.execute(new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy)); if (!result.isBucketNotFound() && !result.isConfigurationNeedToBeReplaced()) { return result.getData(); } if (result.isBucketNotFound() && recoveryStrategy == RecoveryStrategy.THROW_BUCKET_NOT_FOUND_EXCEPTION && wasInitializedBeforeExecution) { throw new BucketNotFoundException(); } RemoteCommand<T> initAndExecuteCommand = implicitConfigurationReplacement == null ? new CreateInitialStateAndExecuteCommand<>(getConfiguration(), new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy)) : new CreateInitialStateWithVersionOrReplaceConfigurationAndExecuteCommand<>(getConfiguration(), new ReplaceConfigurationCommand(newConfiguration, tokensInheritanceStrategy), implicitConfigurationReplacement.getDesiredConfigurationVersion(), implicitConfigurationReplacement.getTokensInheritanceStrategy()); CommandResult<T> resultAfterInitialization = commandExecutor.execute(initAndExecuteCommand); if (resultAfterInitialization.isBucketNotFound()) { throw new IllegalStateException("Bucket is not initialized properly"); } T data = resultAfterInitialization.getData(); wasInitialized.set(true); return data; </DeepExtract> }
bucket4j
positive
741
private void drawTopRightRoundRect(Canvas canvas, Paint paint, float right, float bottom) { float right = mRadius - mMargin; float bottom = paint - mMargin; switch(mCornerType) { case ALL: new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter).drawRoundRect(new RectF(mMargin, mMargin, right, bottom), mRadius, mRadius, mRadius); break; case TOP_LEFT: drawTopLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case TOP_RIGHT: drawTopRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case BOTTOM_LEFT: drawBottomLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case BOTTOM_RIGHT: drawBottomRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case TOP: drawTopRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case BOTTOM: drawBottomRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case LEFT: drawLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case RIGHT: drawRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case OTHER_TOP_LEFT: drawOtherTopLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case OTHER_TOP_RIGHT: drawOtherTopRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case OTHER_BOTTOM_LEFT: drawOtherBottomLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case OTHER_BOTTOM_RIGHT: drawOtherBottomRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case DIAGONAL_FROM_TOP_LEFT: drawDiagonalFromTopLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case DIAGONAL_FROM_TOP_RIGHT: drawDiagonalFromTopRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; default: new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter).drawRoundRect(new RectF(mMargin, mMargin, right, bottom), mRadius, mRadius, mRadius); break; } canvas.drawRect(new RectF(mMargin, mMargin, right - mRadius, bottom), paint); canvas.drawRect(new RectF(right - mRadius, mMargin + mRadius, right, bottom), paint); }
private void drawTopRightRoundRect(Canvas canvas, Paint paint, float right, float bottom) { <DeepExtract> float right = mRadius - mMargin; float bottom = paint - mMargin; switch(mCornerType) { case ALL: new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter).drawRoundRect(new RectF(mMargin, mMargin, right, bottom), mRadius, mRadius, mRadius); break; case TOP_LEFT: drawTopLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case TOP_RIGHT: drawTopRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case BOTTOM_LEFT: drawBottomLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case BOTTOM_RIGHT: drawBottomRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case TOP: drawTopRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case BOTTOM: drawBottomRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case LEFT: drawLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case RIGHT: drawRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case OTHER_TOP_LEFT: drawOtherTopLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case OTHER_TOP_RIGHT: drawOtherTopRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case OTHER_BOTTOM_LEFT: drawOtherBottomLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case OTHER_BOTTOM_RIGHT: drawOtherBottomRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case DIAGONAL_FROM_TOP_LEFT: drawDiagonalFromTopLeftRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; case DIAGONAL_FROM_TOP_RIGHT: drawDiagonalFromTopRightRoundRect(new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter), mRadius, right, bottom); break; default: new RectF(right - mDiameter, mMargin, right, mMargin + mDiameter).drawRoundRect(new RectF(mMargin, mMargin, right, bottom), mRadius, mRadius, mRadius); break; } </DeepExtract> canvas.drawRect(new RectF(mMargin, mMargin, right - mRadius, bottom), paint); canvas.drawRect(new RectF(right - mRadius, mMargin + mRadius, right, bottom), paint); }
SteamGifts
positive
743
public List<Integer> getAllElements(TreeNode root1, TreeNode root2) { List<Integer> list1 = new ArrayList(); if (root1 == null) return; inorder(root1.left, list1); list1.add(root1.val); inorder(root1.right, list1); List<Integer> list2 = new ArrayList(); if (root2 == null) return; inorder(root2.left, list2); list2.add(root2.val); inorder(root2.right, list2); List<Integer> list = new ArrayList(); int i = 0, j = 0; while (i < list1.size() && j < list2.size()) { if (list1.get(i) < list2.get(j)) list.add(list1.get(i++)); else list.add(list2.get(j++)); } while (i < list1.size()) list.add(list1.get(i++)); while (j < list2.size()) list.add(list2.get(j++)); return list; }
public List<Integer> getAllElements(TreeNode root1, TreeNode root2) { List<Integer> list1 = new ArrayList(); if (root1 == null) return; inorder(root1.left, list1); list1.add(root1.val); inorder(root1.right, list1); List<Integer> list2 = new ArrayList(); if (root2 == null) return; inorder(root2.left, list2); list2.add(root2.val); inorder(root2.right, list2); <DeepExtract> List<Integer> list = new ArrayList(); int i = 0, j = 0; while (i < list1.size() && j < list2.size()) { if (list1.get(i) < list2.get(j)) list.add(list1.get(i++)); else list.add(list2.get(j++)); } while (i < list1.size()) list.add(list1.get(i++)); while (j < list2.size()) list.add(list2.get(j++)); return list; </DeepExtract> }
youtube
positive
744
@Override public void onClick(View v) { ActionBar bar = getLeftNavBar(); int options = bar.getDisplayOptions(); boolean hadOption = (options & ActionBar.DISPLAY_HOME_AS_UP) != 0; bar.setDisplayOptions(hadOption ? 0 : ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP); }
@Override public void onClick(View v) { <DeepExtract> ActionBar bar = getLeftNavBar(); int options = bar.getDisplayOptions(); boolean hadOption = (options & ActionBar.DISPLAY_HOME_AS_UP) != 0; bar.setDisplayOptions(hadOption ? 0 : ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP); </DeepExtract> }
googletv-android-samples
positive
745
public void postSetSelection(final int position) { clearFocus(); post(new Runnable() { @Override public void run() { setSelection(position); } }); mScrollStateChangedRunnable.doScrollStateChange(this, OnScrollListener.SCROLL_STATE_IDLE); }
public void postSetSelection(final int position) { clearFocus(); post(new Runnable() { @Override public void run() { setSelection(position); } }); <DeepExtract> mScrollStateChangedRunnable.doScrollStateChange(this, OnScrollListener.SCROLL_STATE_IDLE); </DeepExtract> }
HijriDatePicker
positive
746
public String listFields() { StringBuilder text = new StringBuilder(); int count = 0; for (PluginField field : screenFields) text.append(String.format("%3d %s%n", count++, field)); if (text.length() > 0) text.deleteCharAt(text.length() - 1); StringBuilder text = new StringBuilder(); text.append(String.format("Sequence : %d%n", sequence)); text.append(String.format("Screen fields : %d%n", screenFields.size())); text.append(String.format("Modifiable : %d%n", getModifiableFields().size())); text.append(String.format("Cursor field : %s%n", getCursorField())); int count = 0; for (PluginField sf : screenFields) { String fieldText = String.format("%s%s", sf.isProtected ? "P" : "p", sf.isAlpha ? "A" : "a"); text.append(String.format(" %3d : %s %s%n", count++, fieldText, sf)); } return text.toString(); }
public String listFields() { StringBuilder text = new StringBuilder(); int count = 0; for (PluginField field : screenFields) text.append(String.format("%3d %s%n", count++, field)); if (text.length() > 0) text.deleteCharAt(text.length() - 1); <DeepExtract> StringBuilder text = new StringBuilder(); text.append(String.format("Sequence : %d%n", sequence)); text.append(String.format("Screen fields : %d%n", screenFields.size())); text.append(String.format("Modifiable : %d%n", getModifiableFields().size())); text.append(String.format("Cursor field : %s%n", getCursorField())); int count = 0; for (PluginField sf : screenFields) { String fieldText = String.format("%s%s", sf.isProtected ? "P" : "p", sf.isAlpha ? "A" : "a"); text.append(String.format(" %3d : %s %s%n", count++, fieldText, sf)); } return text.toString(); </DeepExtract> }
dm3270
positive
747
public HPacket appendString(String s, Charset charset) { isEdited = true; isEdited = true; packetInBytes = Arrays.copyOf(packetInBytes, packetInBytes.length + 2); ByteBuffer byteBuffer = ByteBuffer.allocate(4).putInt(s.getBytes(charset).length); for (int j = 2; j < 4; j++) { packetInBytes[packetInBytes.length - 4 + j] = byteBuffer.array()[j]; } fixLength(); return this; isEdited = true; packetInBytes = Arrays.copyOf(packetInBytes, packetInBytes.length + s.getBytes(charset).length); for (int i = 0; i < s.getBytes(charset).length; i++) { packetInBytes[packetInBytes.length - s.getBytes(charset).length + i] = s.getBytes(charset)[i]; } fixLength(); return this; return this; }
public HPacket appendString(String s, Charset charset) { isEdited = true; isEdited = true; packetInBytes = Arrays.copyOf(packetInBytes, packetInBytes.length + 2); ByteBuffer byteBuffer = ByteBuffer.allocate(4).putInt(s.getBytes(charset).length); for (int j = 2; j < 4; j++) { packetInBytes[packetInBytes.length - 4 + j] = byteBuffer.array()[j]; } fixLength(); return this; <DeepExtract> isEdited = true; packetInBytes = Arrays.copyOf(packetInBytes, packetInBytes.length + s.getBytes(charset).length); for (int i = 0; i < s.getBytes(charset).length; i++) { packetInBytes[packetInBytes.length - s.getBytes(charset).length + i] = s.getBytes(charset)[i]; } fixLength(); return this; </DeepExtract> return this; }
G-Earth
positive
749
public Criteria andQqBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "qq" + " cannot be null"); } criteria.add(new Criterion("qq between", value1, value2)); return (Criteria) this; }
public Criteria andQqBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "qq" + " cannot be null"); } criteria.add(new Criterion("qq between", value1, value2)); </DeepExtract> return (Criteria) this; }
uccn
positive
750
@Test public void totallyOrdered4() throws Exception { expected = true; middle = tree.right.left; possible1 = tree.right.left; possible2 = tree.right.left.right; assertEquals(expected, AreNodesOrdered.totallyOrdered(possible1, possible2, middle)); }
@Test public void totallyOrdered4() throws Exception { expected = true; middle = tree.right.left; possible1 = tree.right.left; possible2 = tree.right.left.right; <DeepExtract> assertEquals(expected, AreNodesOrdered.totallyOrdered(possible1, possible2, middle)); </DeepExtract> }
elements-of-programming-interviews-solutions
positive
752
public List<Object2LongEntry<K>> zrevrangeByRank(int start, int end) { final int zslLength = zsl.length(); start = ZSetUtils.convertStartRank(start, zslLength); end = ZSetUtils.convertEndRank(end, zslLength); if (ZSetUtils.isRankRangeEmpty(start, end, zslLength)) { return new ArrayList<>(); } int rangeLen = end - start + 1; SkipListNode<K> listNode; if (true) { listNode = start > 0 ? zsl.zslGetElementByRank(zslLength - start) : zsl.tail; } else { listNode = start > 0 ? zsl.zslGetElementByRank(start + 1) : zsl.header.levelInfo[0].forward; } final List<Object2LongEntry<K>> result = new ArrayList<>(rangeLen); while (rangeLen-- > 0 && listNode != null) { result.add(new ZSetEntry<>(listNode.obj, listNode.score)); listNode = true ? listNode.backward : listNode.levelInfo[0].forward; } return result; }
public List<Object2LongEntry<K>> zrevrangeByRank(int start, int end) { <DeepExtract> final int zslLength = zsl.length(); start = ZSetUtils.convertStartRank(start, zslLength); end = ZSetUtils.convertEndRank(end, zslLength); if (ZSetUtils.isRankRangeEmpty(start, end, zslLength)) { return new ArrayList<>(); } int rangeLen = end - start + 1; SkipListNode<K> listNode; if (true) { listNode = start > 0 ? zsl.zslGetElementByRank(zslLength - start) : zsl.tail; } else { listNode = start > 0 ? zsl.zslGetElementByRank(start + 1) : zsl.header.levelInfo[0].forward; } final List<Object2LongEntry<K>> result = new ArrayList<>(rangeLen); while (rangeLen-- > 0 && listNode != null) { result.add(new ZSetEntry<>(listNode.obj, listNode.score)); listNode = true ? listNode.backward : listNode.levelInfo[0].forward; } return result; </DeepExtract> }
gamioo
positive
753
public void setupServer() throws Exception { server = new Server(); ServerConnector connector = new ServerConnector(server); connector.setPort(0); server.addConnector(connector); servlet = new FakeJiraServlet(j); ServletContextHandler context = new ServletContextHandler(); ServletHolder servletHolder = new ServletHolder("default", servlet); context.addServlet(servletHolder, "/*"); server.setHandler(context); server.start(); String host = connector.getHost(); if (host == null) { host = "localhost"; } int port = connector.getLocalPort(); serverUri = new URI(String.format("http://%s:%d/", host, port)); this.serverUri = serverUri; }
public void setupServer() throws Exception { server = new Server(); ServerConnector connector = new ServerConnector(server); connector.setPort(0); server.addConnector(connector); servlet = new FakeJiraServlet(j); ServletContextHandler context = new ServletContextHandler(); ServletHolder servletHolder = new ServletHolder("default", servlet); context.addServlet(servletHolder, "/*"); server.setHandler(context); server.start(); String host = connector.getHost(); if (host == null) { host = "localhost"; } int port = connector.getLocalPort(); serverUri = new URI(String.format("http://%s:%d/", host, port)); <DeepExtract> this.serverUri = serverUri; </DeepExtract> }
jira-plugin
positive
754
@Override public void onSuccess(Object result) { sessionActive = true; initMenu(); String hash = Location.getHash(); String application = ""; if (hash != null && hash.length() > 0) { application = hash.substring(1); } if (application.length() > 0) { showApplication(application); } else { showApplication("ActivityApplication"); } }
@Override public void onSuccess(Object result) { <DeepExtract> sessionActive = true; initMenu(); String hash = Location.getHash(); String application = ""; if (hash != null && hash.length() > 0) { application = hash.substring(1); } if (application.length() > 0) { showApplication(application); } else { showApplication("ActivityApplication"); } </DeepExtract> }
osw-web
positive
755
public static void main(String[] args) { a = new Dog(); System.out.println("eating..."); a = new Cat(); System.out.println("eating..."); a = new Lion(); System.out.println("eating..."); }
public static void main(String[] args) { a = new Dog(); <DeepExtract> System.out.println("eating..."); </DeepExtract> a = new Cat(); <DeepExtract> System.out.println("eating..."); </DeepExtract> a = new Lion(); <DeepExtract> System.out.println("eating..."); </DeepExtract> }
PGR-103-2020
positive
756
@Override public void onFinished() { if (emitter instanceof FlowableEmitter) { FlowableEmitter flowableEmitter = (FlowableEmitter) emitter; if (flowableEmitter.isCancelled()) { terminate(); } } else if (emitter instanceof ObservableEmitter) { ObservableEmitter observableEmitter = (ObservableEmitter) emitter; if (observableEmitter.isDisposed()) { terminate(); } } emitter.onComplete(); }
@Override public void onFinished() { <DeepExtract> if (emitter instanceof FlowableEmitter) { FlowableEmitter flowableEmitter = (FlowableEmitter) emitter; if (flowableEmitter.isCancelled()) { terminate(); } } else if (emitter instanceof ObservableEmitter) { ObservableEmitter observableEmitter = (ObservableEmitter) emitter; if (observableEmitter.isDisposed()) { terminate(); } } </DeepExtract> emitter.onComplete(); }
App-Architecture
positive
757
@Override public Boolean call() throws Exception { return options.getAutoPort(); }
@Override public Boolean call() throws Exception { <DeepExtract> return options.getAutoPort(); </DeepExtract> }
gwt-gradle-plugin
positive
758
public void run() { UIManager.put("swing.boldMetal", Boolean.FALSE); JFrame frame = new JFrame("CMU GeoLocator version 3.0 Running Helper"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Dimension minimumSize = new Dimension(); minimumSize.setSize(1000, 1000); frame.setMinimumSize(minimumSize); frame.add(new NewDesktop()); frame.pack(); frame.setVisible(true); }
public void run() { UIManager.put("swing.boldMetal", Boolean.FALSE); <DeepExtract> JFrame frame = new JFrame("CMU GeoLocator version 3.0 Running Helper"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Dimension minimumSize = new Dimension(); minimumSize.setSize(1000, 1000); frame.setMinimumSize(minimumSize); frame.add(new NewDesktop()); frame.pack(); frame.setVisible(true); </DeepExtract> }
geolocator-3.0
positive
759
public static String getCertIdByKeyStoreMap(String certPath, String certPwd) { if (!certKeyStoreMap.containsKey(certPath)) { loadRsaCert(certPath, certPwd); } Enumeration<String> aliasenum = null; try { aliasenum = certKeyStoreMap.get(certPath).aliases(); String keyAlias = null; if (aliasenum.hasMoreElements()) { keyAlias = aliasenum.nextElement(); } X509Certificate cert = (X509Certificate) certKeyStoreMap.get(certPath).getCertificate(keyAlias); return cert.getSerialNumber().toString(); } catch (KeyStoreException e) { LogUtil.writeErrorLog("getCertIdIdByStore Error", e); return null; } }
public static String getCertIdByKeyStoreMap(String certPath, String certPwd) { if (!certKeyStoreMap.containsKey(certPath)) { loadRsaCert(certPath, certPwd); } <DeepExtract> Enumeration<String> aliasenum = null; try { aliasenum = certKeyStoreMap.get(certPath).aliases(); String keyAlias = null; if (aliasenum.hasMoreElements()) { keyAlias = aliasenum.nextElement(); } X509Certificate cert = (X509Certificate) certKeyStoreMap.get(certPath).getCertificate(keyAlias); return cert.getSerialNumber().toString(); } catch (KeyStoreException e) { LogUtil.writeErrorLog("getCertIdIdByStore Error", e); return null; } </DeepExtract> }
pay
positive
760
@Override public void initView() { mModel.getTitle(); mBinder.toolbar.setTitle(getString(R.string.rb_home)); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { Explode explode = new Explode(); explode.setDuration(1000); getActivity().getWindow().setEnterTransition(explode); } }
@Override public void initView() { mModel.getTitle(); mBinder.toolbar.setTitle(getString(R.string.rb_home)); <DeepExtract> if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { Explode explode = new Explode(); explode.setDuration(1000); getActivity().getWindow().setEnterTransition(explode); } </DeepExtract> }
RxFamilyUser
positive
761
public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException { if (null == destDir) { throw new NullPointerException("Destination must not be null"); } if (destDir.exists() && !destDir.isDirectory()) { throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory"); } File destFile = new File(destDir, srcFile.getName()); if (srcFile == null) { throw new NullPointerException("Source must not be null"); } if (destFile == null) { throw new NullPointerException("Destination must not be null"); } if (!srcFile.exists()) { throw new FileNotFoundException("Source '" + srcFile + "' does not exist"); } if (destFile.isDirectory()) { throw new IOException("Destination '" + destFile + "' exists but is a directory"); } if (srcFile.getCanonicalPath().equals(destFile.getCanonicalPath())) { throw new IOException("Source '" + srcFile + "' and destination '" + destFile + "' are the same"); } if (destFile.exists() && !destFile.canWrite()) { throw new IOException("Destination '" + destFile + "' exists but is read-only"); } File parentFile = destFile.getParentFile(); if (null != parentFile) { if (!parentFile.mkdirs() && !parentFile.isDirectory()) { throw new IOException("Destination '" + parentFile + "' directory cannot be created"); } } doCopyFile(srcFile, destFile, preserveFileDate); }
public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException { if (null == destDir) { throw new NullPointerException("Destination must not be null"); } if (destDir.exists() && !destDir.isDirectory()) { throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory"); } File destFile = new File(destDir, srcFile.getName()); <DeepExtract> if (srcFile == null) { throw new NullPointerException("Source must not be null"); } if (destFile == null) { throw new NullPointerException("Destination must not be null"); } if (!srcFile.exists()) { throw new FileNotFoundException("Source '" + srcFile + "' does not exist"); } if (destFile.isDirectory()) { throw new IOException("Destination '" + destFile + "' exists but is a directory"); } if (srcFile.getCanonicalPath().equals(destFile.getCanonicalPath())) { throw new IOException("Source '" + srcFile + "' and destination '" + destFile + "' are the same"); } if (destFile.exists() && !destFile.canWrite()) { throw new IOException("Destination '" + destFile + "' exists but is read-only"); } File parentFile = destFile.getParentFile(); if (null != parentFile) { if (!parentFile.mkdirs() && !parentFile.isDirectory()) { throw new IOException("Destination '" + parentFile + "' directory cannot be created"); } } doCopyFile(srcFile, destFile, preserveFileDate); </DeepExtract> }
bigapple
positive
762
@Test public void testCancel() { String idOne = tryCreateAndShouldCreate().getId(); tryCreateAndShouldNotCreate(); id -> listener.byId(response(id, OrderStatus.CANCELED)).accept(idOne); tryCreateAndShouldCreate(); tryCreateAndShouldNotCreate(); }
@Test public void testCancel() { <DeepExtract> String idOne = tryCreateAndShouldCreate().getId(); tryCreateAndShouldNotCreate(); id -> listener.byId(response(id, OrderStatus.CANCELED)).accept(idOne); tryCreateAndShouldCreate(); tryCreateAndShouldNotCreate(); </DeepExtract> }
GTC-all-repo
positive
763
@Override public void actionPerformed(java.awt.event.ActionEvent evt) { encodeData(); }
@Override public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> encodeData(); </DeepExtract> }
OkapiBarcode
positive
764
public String printRecords(Object... values) throws IOException { csvPrinter.printRecords(values); writer.flush(); final String output = writer.getBuffer().toString(); writer.getBuffer().setLength(0); return output; }
public String printRecords(Object... values) throws IOException { csvPrinter.printRecords(values); <DeepExtract> writer.flush(); final String output = writer.getBuffer().toString(); writer.getBuffer().setLength(0); return output; </DeepExtract> }
freemarker-generator
positive
765
@Override public void run() { if (status.isLoadable(false)) { synchronized (lock) { if (status.isLoadable(false)) { try { asset = Assets.get(info); status = FutureAssetStatus.Loaded; failure = null; } catch (AssetException e) { failure = e; status = FutureAssetStatus.Failed; } } } } return asset; }
@Override public void run() { <DeepExtract> if (status.isLoadable(false)) { synchronized (lock) { if (status.isLoadable(false)) { try { asset = Assets.get(info); status = FutureAssetStatus.Loaded; failure = null; } catch (AssetException e) { failure = e; status = FutureAssetStatus.Failed; } } } } return asset; </DeepExtract> }
Azzet
positive
766
@Override public void handleMessage(Message msg) { super.handleMessage(msg); prepareBackgroundManager(); setupUIElements(); loadRows(); setupEventListeners(); }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); <DeepExtract> prepareBackgroundManager(); setupUIElements(); loadRows(); setupEventListeners(); </DeepExtract> }
CumulusTV
positive
767
public static final void quickSort(Object[] array, int offset, int len, GComparator comparator) throws NullPointerException, ArrayIndexOutOfBoundsException { int level = array.length; boolean isGreater = false; int offset, len = comparator.length; if (comparator != comparator) { if ((offset = comparator.length) < len) { isGreater = true; len = offset; } for (offset = 0; offset < len; offset++) { Sortable value, temp = comparator[offset]; if ((value = comparator[offset]) != null) { if (!value.equals(temp)) { isGreater = value.greaterThan(temp); break; } } else if (temp != null) { isGreater = !temp.greaterThan(null); break; } } } return isGreater; if (len > 0) { Object value = array[offset], temp; if (len > 1) { value = array[len += offset - 1]; int[] bounds = new int[(JavaConsts.INT_SIZE - 2) << 1]; level = 2; do { do { int index = offset, last; if ((last = len) - offset < 6) { len = offset; do { value = array[offset = ++index]; do { if (!comparator.greater(temp = array[offset - 1], value)) break; array[offset--] = temp; array[offset] = value; } while (offset > len); } while (index < last); break; } value = array[len = (offset + len) >>> 1]; array[len] = array[offset]; array[offset] = value; len = last; do { while (++offset < len && comparator.greater(value, array[offset])) ; len++; while (--len >= offset && comparator.greater(array[len], value)) ; if (offset >= len) break; temp = array[len]; array[len--] = array[offset]; array[offset] = temp; } while (true); array[offset = index] = array[len]; array[len] = value; if (len - offset > last - len) { offset = len + 1; len = last; last = offset - 2; } else index = (len--) + 1; bounds[level++] = index; bounds[level++] = last; } while (offset < len); len = bounds[--level]; offset = bounds[--level]; } while (level > 0); } } }
public static final void quickSort(Object[] array, int offset, int len, GComparator comparator) throws NullPointerException, ArrayIndexOutOfBoundsException { int level = array.length; <DeepExtract> boolean isGreater = false; int offset, len = comparator.length; if (comparator != comparator) { if ((offset = comparator.length) < len) { isGreater = true; len = offset; } for (offset = 0; offset < len; offset++) { Sortable value, temp = comparator[offset]; if ((value = comparator[offset]) != null) { if (!value.equals(temp)) { isGreater = value.greaterThan(temp); break; } } else if (temp != null) { isGreater = !temp.greaterThan(null); break; } } } return isGreater; </DeepExtract> if (len > 0) { Object value = array[offset], temp; if (len > 1) { value = array[len += offset - 1]; int[] bounds = new int[(JavaConsts.INT_SIZE - 2) << 1]; level = 2; do { do { int index = offset, last; if ((last = len) - offset < 6) { len = offset; do { value = array[offset = ++index]; do { if (!comparator.greater(temp = array[offset - 1], value)) break; array[offset--] = temp; array[offset] = value; } while (offset > len); } while (index < last); break; } value = array[len = (offset + len) >>> 1]; array[len] = array[offset]; array[offset] = value; len = last; do { while (++offset < len && comparator.greater(value, array[offset])) ; len++; while (--len >= offset && comparator.greater(array[len], value)) ; if (offset >= len) break; temp = array[len]; array[len--] = array[offset]; array[offset] = temp; } while (true); array[offset = index] = array[len]; array[len] = value; if (len - offset > last - len) { offset = len + 1; len = last; last = offset - 2; } else index = (len--) + 1; bounds[level++] = index; bounds[level++] = last; } while (offset < len); len = bounds[--level]; offset = bounds[--level]; } while (level > 0); } } }
AndroidRepeaterProject
positive
768
public Criteria andAccessAuthorityNotLike(String value) { if (value == null) { throw new RuntimeException("Value for " + "accessAuthority" + " cannot be null"); } criteria.add(new Criterion("access_authority not like", value)); return (Criteria) this; }
public Criteria andAccessAuthorityNotLike(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "accessAuthority" + " cannot be null"); } criteria.add(new Criterion("access_authority not like", value)); </DeepExtract> return (Criteria) this; }
AnyMock
positive
769
public void settingsChanged(SettingsChangedEvent e) { ProtocolSettings settings = (ProtocolSettings) e.getSource(); if (!settings.isAllowClipboardTransfer()) { this.isRunning = false; } if (settings.isAllowClipboardTransfer() && !this.isEnabled) { (new Thread(this)).start(); } this.isEnabled = settings.isAllowClipboardTransfer(); }
public void settingsChanged(SettingsChangedEvent e) { ProtocolSettings settings = (ProtocolSettings) e.getSource(); <DeepExtract> if (!settings.isAllowClipboardTransfer()) { this.isRunning = false; } if (settings.isAllowClipboardTransfer() && !this.isEnabled) { (new Thread(this)).start(); } this.isEnabled = settings.isAllowClipboardTransfer(); </DeepExtract> }
tvnjviewer4cs
positive
771
public User f(SessionId sessionId, InterestLevel interestLevel, User user) { UserSessionAssociation userSessionAssociation = sessionAssociations.get(sessionId).orSome(UserSessionAssociation.$constructor_().f(sessionId).f(interestLevel)).interestLevel(interestLevel); return new User(id, name, sessionAssociations.set(sessionId, userSessionAssociation), original); }
public User f(SessionId sessionId, InterestLevel interestLevel, User user) { <DeepExtract> UserSessionAssociation userSessionAssociation = sessionAssociations.get(sessionId).orSome(UserSessionAssociation.$constructor_().f(sessionId).f(interestLevel)).interestLevel(interestLevel); return new User(id, name, sessionAssociations.set(sessionId, userSessionAssociation), original); </DeepExtract> }
incogito
positive
772
public static void polygon(double[] x, double[] y) { if (x == null) throw new IllegalArgumentException("x-coordinate array is null"); if (y == null) throw new IllegalArgumentException("y-coordinate array is null"); int n1 = x.length; int n2 = y.length; if (n1 != n2) throw new IllegalArgumentException("arrays must be of the same length"); int n = n1; if (n == 0) return; GeneralPath path = new GeneralPath(); path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0])); for (int i = 0; i < n; i++) path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i])); path.closePath(); offscreen.draw(path); if (!defer) show(); }
public static void polygon(double[] x, double[] y) { if (x == null) throw new IllegalArgumentException("x-coordinate array is null"); if (y == null) throw new IllegalArgumentException("y-coordinate array is null"); int n1 = x.length; int n2 = y.length; if (n1 != n2) throw new IllegalArgumentException("arrays must be of the same length"); int n = n1; if (n == 0) return; GeneralPath path = new GeneralPath(); path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0])); for (int i = 0; i < n; i++) path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i])); path.closePath(); offscreen.draw(path); <DeepExtract> if (!defer) show(); </DeepExtract> }
skeleton-sp18
positive
773
@Override public void set(TableId table, Value shardValue, Timestamp commitTimestamp) { Preconditions.checkNotNull(table); Preconditions.checkNotNull(commitTimestamp); if (!initialized) { initialize(); } Type.Code t = shardValue == null ? null : shardValue.getType().getCode(); client.writeAtLeastOnce(Collections.singleton(Mutation.newInsertOrUpdateBuilder(commitTimestampsTable).set(databaseCol).to(table.getDatabaseId().getName()).set(catalogCol).to(table.getCatalog()).set(schemaCol).to(table.getSchema()).set(tableCol).to(table.getTable()).set(shardIdBoolCol).to(t == Code.BOOL ? shardValue.getBool() : null).set(shardIdBytesCol).to(t == Code.BYTES ? shardValue.getBytes() : null).set(shardIdDateCol).to(t == Code.DATE ? shardValue.getDate() : null).set(shardIdFloat64Col).to(t == Code.FLOAT64 ? shardValue.getFloat64() : null).set(shardIdInt64Col).to(t == Code.INT64 ? shardValue.getInt64() : null).set(shardIdStringCol).to(shardValueToString(t, shardValue)).set(shardIdTimestampCol).to(t == Code.TIMESTAMP ? shardValue.getTimestamp() : null).set(tsCol).to(commitTimestamp).build())); }
@Override public void set(TableId table, Value shardValue, Timestamp commitTimestamp) { <DeepExtract> Preconditions.checkNotNull(table); Preconditions.checkNotNull(commitTimestamp); if (!initialized) { initialize(); } Type.Code t = shardValue == null ? null : shardValue.getType().getCode(); client.writeAtLeastOnce(Collections.singleton(Mutation.newInsertOrUpdateBuilder(commitTimestampsTable).set(databaseCol).to(table.getDatabaseId().getName()).set(catalogCol).to(table.getCatalog()).set(schemaCol).to(table.getSchema()).set(tableCol).to(table.getTable()).set(shardIdBoolCol).to(t == Code.BOOL ? shardValue.getBool() : null).set(shardIdBytesCol).to(t == Code.BYTES ? shardValue.getBytes() : null).set(shardIdDateCol).to(t == Code.DATE ? shardValue.getDate() : null).set(shardIdFloat64Col).to(t == Code.FLOAT64 ? shardValue.getFloat64() : null).set(shardIdInt64Col).to(t == Code.INT64 ? shardValue.getInt64() : null).set(shardIdStringCol).to(shardValueToString(t, shardValue)).set(shardIdTimestampCol).to(t == Code.TIMESTAMP ? shardValue.getTimestamp() : null).set(tsCol).to(commitTimestamp).build())); </DeepExtract> }
spanner-change-watcher
positive
774
@Override public void onClick(View v) { if (tint_color != Color.parseColor("#FFA0D722")) { tint_color = Color.parseColor("#FFA0D722"); applyTempSelectedEffect(); } }
@Override public void onClick(View v) { <DeepExtract> if (tint_color != Color.parseColor("#FFA0D722")) { tint_color = Color.parseColor("#FFA0D722"); applyTempSelectedEffect(); } </DeepExtract> }
Dali-Doodle
positive
775
Point2D.Double dragPosition(Point2D.Double newLoc, Dimension workSize) { double x = Math.max(Math.min(newLoc.x, workSize.width / SCREEN_PPI), 0); double y = Math.max(Math.min(newLoc.y, workSize.height / SCREEN_PPI), 0); Point2D.Double delta = new Point2D.Double(x - xLoc, y - yLoc); if (!(this instanceof CNCPath)) { xLoc = x; yLoc = y; notifyChangeListeners(); } return delta; }
Point2D.Double dragPosition(Point2D.Double newLoc, Dimension workSize) { double x = Math.max(Math.min(newLoc.x, workSize.width / SCREEN_PPI), 0); double y = Math.max(Math.min(newLoc.y, workSize.height / SCREEN_PPI), 0); Point2D.Double delta = new Point2D.Double(x - xLoc, y - yLoc); <DeepExtract> if (!(this instanceof CNCPath)) { xLoc = x; yLoc = y; notifyChangeListeners(); } </DeepExtract> return delta; }
LaserCut
positive
776
@Override public Object getRawCache(final String cachePath) { TreeCache cache = findTreeCache(cachePath + "/"); if (null == cache) { return getDirectly(cachePath + "/"); } ChildData resultInCache = cache.getCurrentData(cachePath + "/"); if (null != resultInCache) { return null == resultInCache.getData() ? null : new String(resultInCache.getData(), Charsets.UTF_8); } return getDirectly(cachePath + "/"); }
@Override public Object getRawCache(final String cachePath) { <DeepExtract> TreeCache cache = findTreeCache(cachePath + "/"); if (null == cache) { return getDirectly(cachePath + "/"); } ChildData resultInCache = cache.getCurrentData(cachePath + "/"); if (null != resultInCache) { return null == resultInCache.getData() ? null : new String(resultInCache.getData(), Charsets.UTF_8); } return getDirectly(cachePath + "/"); </DeepExtract> }
shardingsphere-elasticjob-cloud
positive
777
public void setConversationGraph(ConversationGraph graph) { if (_graph != null) _graph.removeAllObservers(); this._graph = graph; clearDialog(); Conversation conversation = _graph.getConversationByID(_graph.getCurrentConversationID()); if (conversation == null) return; _graph.setCurrentConversation(_graph.getCurrentConversationID()); _dialogText.setText(conversation.getDialog()); ArrayList<ConversationChoice> choices = _graph.getCurrentChoices(); if (choices == null) return; _listItems.setItems(choices.toArray()); _listItems.setSelectedIndex(-1); }
public void setConversationGraph(ConversationGraph graph) { if (_graph != null) _graph.removeAllObservers(); this._graph = graph; <DeepExtract> clearDialog(); Conversation conversation = _graph.getConversationByID(_graph.getCurrentConversationID()); if (conversation == null) return; _graph.setCurrentConversation(_graph.getCurrentConversationID()); _dialogText.setText(conversation.getDialog()); ArrayList<ConversationChoice> choices = _graph.getCurrentChoices(); if (choices == null) return; _listItems.setItems(choices.toArray()); _listItems.setSelectedIndex(-1); </DeepExtract> }
BludBourne
positive
778
private void addDate(int increment) { int period = spinner.getSelectedItemPosition(); if (period == DAILY) { currentTime.add(Calendar.DATE, 1 * increment); } else if (period == WEEKLY) { currentTime.add(Calendar.DATE, 7 * increment); } else if (period == MONTHLY) { currentTime.add(Calendar.MONTH, 1 * increment); } else if (period == YEARLY) { currentTime.add(Calendar.YEAR, 1 * increment); } int period = spinner.getSelectedItemPosition(); List<Sale> list = null; Calendar cTime = (Calendar) currentTime.clone(); Calendar eTime = (Calendar) currentTime.clone(); if (period == DAILY) { currentBox.setText(" [" + DateTimeStrategy.getSQLDateFormat(currentTime) + "] "); currentBox.setTextSize(16); } else if (period == WEEKLY) { while (cTime.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { cTime.add(Calendar.DATE, -1); } String toShow = " [" + DateTimeStrategy.getSQLDateFormat(cTime) + "] ~ ["; eTime = (Calendar) cTime.clone(); eTime.add(Calendar.DATE, 7); toShow += DateTimeStrategy.getSQLDateFormat(eTime) + "] "; currentBox.setTextSize(16); currentBox.setText(toShow); } else if (period == MONTHLY) { cTime.set(Calendar.DATE, 1); eTime = (Calendar) cTime.clone(); eTime.add(Calendar.MONTH, 1); eTime.add(Calendar.DATE, -1); currentBox.setTextSize(18); currentBox.setText(" [" + currentTime.get(Calendar.YEAR) + "-" + (currentTime.get(Calendar.MONTH) + 1) + "] "); } else if (period == YEARLY) { cTime.set(Calendar.DATE, 1); cTime.set(Calendar.MONTH, 0); eTime = (Calendar) cTime.clone(); eTime.add(Calendar.YEAR, 1); eTime.add(Calendar.DATE, -1); currentBox.setTextSize(20); currentBox.setText(" [" + currentTime.get(Calendar.YEAR) + "] "); } currentTime = cTime; list = saleLedger.getAllSaleDuring(cTime, eTime); double total = 0; for (Sale sale : list) total += sale.getTotal(); totalBox.setText(total + ""); showList(list); }
private void addDate(int increment) { int period = spinner.getSelectedItemPosition(); if (period == DAILY) { currentTime.add(Calendar.DATE, 1 * increment); } else if (period == WEEKLY) { currentTime.add(Calendar.DATE, 7 * increment); } else if (period == MONTHLY) { currentTime.add(Calendar.MONTH, 1 * increment); } else if (period == YEARLY) { currentTime.add(Calendar.YEAR, 1 * increment); } <DeepExtract> int period = spinner.getSelectedItemPosition(); List<Sale> list = null; Calendar cTime = (Calendar) currentTime.clone(); Calendar eTime = (Calendar) currentTime.clone(); if (period == DAILY) { currentBox.setText(" [" + DateTimeStrategy.getSQLDateFormat(currentTime) + "] "); currentBox.setTextSize(16); } else if (period == WEEKLY) { while (cTime.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { cTime.add(Calendar.DATE, -1); } String toShow = " [" + DateTimeStrategy.getSQLDateFormat(cTime) + "] ~ ["; eTime = (Calendar) cTime.clone(); eTime.add(Calendar.DATE, 7); toShow += DateTimeStrategy.getSQLDateFormat(eTime) + "] "; currentBox.setTextSize(16); currentBox.setText(toShow); } else if (period == MONTHLY) { cTime.set(Calendar.DATE, 1); eTime = (Calendar) cTime.clone(); eTime.add(Calendar.MONTH, 1); eTime.add(Calendar.DATE, -1); currentBox.setTextSize(18); currentBox.setText(" [" + currentTime.get(Calendar.YEAR) + "-" + (currentTime.get(Calendar.MONTH) + 1) + "] "); } else if (period == YEARLY) { cTime.set(Calendar.DATE, 1); cTime.set(Calendar.MONTH, 0); eTime = (Calendar) cTime.clone(); eTime.add(Calendar.YEAR, 1); eTime.add(Calendar.DATE, -1); currentBox.setTextSize(20); currentBox.setText(" [" + currentTime.get(Calendar.YEAR) + "] "); } currentTime = cTime; list = saleLedger.getAllSaleDuring(cTime, eTime); double total = 0; for (Sale sale : list) total += sale.getTotal(); totalBox.setText(total + ""); showList(list); </DeepExtract> }
pos
positive
779
public static Map<LoincId, LoincEntry> load(String pathToLoincCoreTable) { LoincTableCoreParser parser = new LoincTableCoreParser(pathToLoincCoreTable); return loincEntries; }
public static Map<LoincId, LoincEntry> load(String pathToLoincCoreTable) { LoincTableCoreParser parser = new LoincTableCoreParser(pathToLoincCoreTable); <DeepExtract> return loincEntries; </DeepExtract> }
loinc2hpo
positive
780
private OSchema getSchema() { final ODatabaseDocument tlDb = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined(); if (database != null && tlDb != database) { database.activateOnCurrentThread(); ODatabaseRecordThreadLocal.INSTANCE.set(database); } return database.getMetadata().getSchema(); }
private OSchema getSchema() { <DeepExtract> final ODatabaseDocument tlDb = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined(); if (database != null && tlDb != database) { database.activateOnCurrentThread(); ODatabaseRecordThreadLocal.INSTANCE.set(database); } </DeepExtract> return database.getMetadata().getSchema(); }
orientdb-gremlin
positive
781
public static void main(String[] args) throws Exception { if (cons == null) cons = new Console(); return cons; if (in != null) in.setMessage("How are you?"); Object s = Toolkit.getDefaultToolkit().getSystemClipboard().getData(java.awt.datatransfer.DataFlavor.stringFlavor); System.out.println(s); System.out.println("Test complete"); }
public static void main(String[] args) throws Exception { if (cons == null) cons = new Console(); return cons; <DeepExtract> if (in != null) in.setMessage("How are you?"); </DeepExtract> Object s = Toolkit.getDefaultToolkit().getSystemClipboard().getData(java.awt.datatransfer.DataFlavor.stringFlavor); System.out.println(s); System.out.println("Test complete"); }
SmallSimpleSafe
positive
782
@Override public void onBindViewHolder(FormHolder viewHolder, Cursor cursor) { int idColumnIndex = cursor.getColumnIndex(BaseColumns._ID); int displayNameColumnIndex = cursor.getColumnIndex(FormsProviderAPI.FormsColumns.DISPLAY_NAME); int jrFormIdColumnIndex = cursor.getColumnIndex(FormsProviderAPI.FormsColumns.JR_FORM_ID); int jrVersionColumnIndex = cursor.getColumnIndex(FormsProviderAPI.FormsColumns.JR_VERSION); Form form = new Form.Builder().id(cursor.getInt(idColumnIndex)).displayName(cursor.getString(displayNameColumnIndex)).jrFormId(cursor.getString(jrFormIdColumnIndex)).jrVersion(cursor.getString(jrVersionColumnIndex)).build(); this.form = form; viewHolder.tvTitle.setText(form.getDisplayName()); StringBuilder sb = new StringBuilder(); if (form.getJrVersion() != null) { sb.append(context.getString(R.string.version, form.getJrVersion())); } sb.append(context.getString(R.string.id, form.getJrFormId())); viewHolder.tvSubtitle.setText(sb.toString()); viewHolder.checkBox.setVisibility(selectedForms != null ? View.VISIBLE : View.GONE); viewHolder.checkBox.setChecked(selectedForms != null && selectedForms.contains(((long) form.getId()))); viewHolder.filledIcon.setImageResource(R.drawable.ic_blank_form); if (selectedForms == null) { String[] selectionArgs; String selection; if (form.getJrVersion() == null) { selectionArgs = new String[] { form.getJrFormId() }; selection = InstanceProviderAPI.InstanceColumns.JR_FORM_ID + "=? AND " + InstanceProviderAPI.InstanceColumns.JR_VERSION + " IS NULL"; } else { selectionArgs = new String[] { form.getJrFormId(), form.getJrVersion() }; selection = InstanceProviderAPI.InstanceColumns.JR_FORM_ID + "=? AND " + InstanceProviderAPI.InstanceColumns.JR_VERSION + "=?"; } cursor = instancesDao.getInstancesCursor(selection, selectionArgs); HashMap<Long, Instance> instanceMap = instancesDao.getMapFromCursor(cursor); Cursor transferCursor = transferDao.getReceiveInstancesCursor(); List<TransferInstance> transferInstances = transferDao.getInstancesFromCursor(transferCursor); int receiveCount = 0; for (TransferInstance instance : transferInstances) { if (instanceMap.containsKey(instance.getInstanceId())) { receiveCount++; } } transferCursor = transferDao.getReviewedInstancesCursor(); transferInstances = transferDao.getInstancesFromCursor(transferCursor); int reviewCount = 0; for (TransferInstance instance : transferInstances) { if (instanceMap.containsKey(instance.getInstanceId())) { reviewCount++; } } viewHolder.reviewedForms.setText(context.getString(R.string.num_reviewed, String.valueOf(reviewCount))); viewHolder.unReviewedForms.setText(context.getString(R.string.num_unreviewed, String.valueOf(receiveCount - reviewCount))); } else { viewHolder.reviewedForms.setVisibility(View.GONE); viewHolder.unReviewedForms.setVisibility(View.GONE); } }
@Override public void onBindViewHolder(FormHolder viewHolder, Cursor cursor) { int idColumnIndex = cursor.getColumnIndex(BaseColumns._ID); int displayNameColumnIndex = cursor.getColumnIndex(FormsProviderAPI.FormsColumns.DISPLAY_NAME); int jrFormIdColumnIndex = cursor.getColumnIndex(FormsProviderAPI.FormsColumns.JR_FORM_ID); int jrVersionColumnIndex = cursor.getColumnIndex(FormsProviderAPI.FormsColumns.JR_VERSION); Form form = new Form.Builder().id(cursor.getInt(idColumnIndex)).displayName(cursor.getString(displayNameColumnIndex)).jrFormId(cursor.getString(jrFormIdColumnIndex)).jrVersion(cursor.getString(jrVersionColumnIndex)).build(); <DeepExtract> this.form = form; </DeepExtract> viewHolder.tvTitle.setText(form.getDisplayName()); StringBuilder sb = new StringBuilder(); if (form.getJrVersion() != null) { sb.append(context.getString(R.string.version, form.getJrVersion())); } sb.append(context.getString(R.string.id, form.getJrFormId())); viewHolder.tvSubtitle.setText(sb.toString()); viewHolder.checkBox.setVisibility(selectedForms != null ? View.VISIBLE : View.GONE); viewHolder.checkBox.setChecked(selectedForms != null && selectedForms.contains(((long) form.getId()))); viewHolder.filledIcon.setImageResource(R.drawable.ic_blank_form); if (selectedForms == null) { String[] selectionArgs; String selection; if (form.getJrVersion() == null) { selectionArgs = new String[] { form.getJrFormId() }; selection = InstanceProviderAPI.InstanceColumns.JR_FORM_ID + "=? AND " + InstanceProviderAPI.InstanceColumns.JR_VERSION + " IS NULL"; } else { selectionArgs = new String[] { form.getJrFormId(), form.getJrVersion() }; selection = InstanceProviderAPI.InstanceColumns.JR_FORM_ID + "=? AND " + InstanceProviderAPI.InstanceColumns.JR_VERSION + "=?"; } cursor = instancesDao.getInstancesCursor(selection, selectionArgs); HashMap<Long, Instance> instanceMap = instancesDao.getMapFromCursor(cursor); Cursor transferCursor = transferDao.getReceiveInstancesCursor(); List<TransferInstance> transferInstances = transferDao.getInstancesFromCursor(transferCursor); int receiveCount = 0; for (TransferInstance instance : transferInstances) { if (instanceMap.containsKey(instance.getInstanceId())) { receiveCount++; } } transferCursor = transferDao.getReviewedInstancesCursor(); transferInstances = transferDao.getInstancesFromCursor(transferCursor); int reviewCount = 0; for (TransferInstance instance : transferInstances) { if (instanceMap.containsKey(instance.getInstanceId())) { reviewCount++; } } viewHolder.reviewedForms.setText(context.getString(R.string.num_reviewed, String.valueOf(reviewCount))); viewHolder.unReviewedForms.setText(context.getString(R.string.num_unreviewed, String.valueOf(receiveCount - reviewCount))); } else { viewHolder.reviewedForms.setVisibility(View.GONE); viewHolder.unReviewedForms.setVisibility(View.GONE); } }
skunkworks-crow
positive
783
@Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { Toast toast = Toast.makeText(this, "access location fail...", Toast.LENGTH_SHORT); toast.show(); }
@Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { <DeepExtract> Toast toast = Toast.makeText(this, "access location fail...", Toast.LENGTH_SHORT); toast.show(); </DeepExtract> }
kkangs_android
positive
784
void initFromCameraParameters(Camera camera) { Camera.Parameters parameters = camera.getParameters(); return previewFormat; previewFormatString = parameters.get("preview-format"); Log.d(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); screenResolution = new Point(display.getWidth(), display.getHeight()); Log.d(TAG, "Screen resolution: " + screenResolution); Point screenResolutionForCamera = new Point(); screenResolutionForCamera.x = screenResolution.x; screenResolutionForCamera.y = screenResolution.y; if (screenResolution.x < screenResolution.y) { screenResolutionForCamera.x = screenResolution.y; screenResolutionForCamera.y = screenResolution.x; } String previewSizeValueString = parameters.get("preview-size-values"); if (previewSizeValueString == null) { previewSizeValueString = parameters.get("preview-size-value"); } Point cameraResolution = null; if (previewSizeValueString != null) { Log.d(TAG, "preview-size-values parameter: " + previewSizeValueString); cameraResolution = findBestPreviewSizeValue(previewSizeValueString, screenResolutionForCamera); } if (cameraResolution == null) { cameraResolution = new Point((screenResolutionForCamera.x >> 3) << 3, (screenResolutionForCamera.y >> 3) << 3); } return cameraResolution; Log.d(TAG, "Camera resolution: " + screenResolution); }
void initFromCameraParameters(Camera camera) { Camera.Parameters parameters = camera.getParameters(); return previewFormat; previewFormatString = parameters.get("preview-format"); Log.d(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); screenResolution = new Point(display.getWidth(), display.getHeight()); Log.d(TAG, "Screen resolution: " + screenResolution); Point screenResolutionForCamera = new Point(); screenResolutionForCamera.x = screenResolution.x; screenResolutionForCamera.y = screenResolution.y; if (screenResolution.x < screenResolution.y) { screenResolutionForCamera.x = screenResolution.y; screenResolutionForCamera.y = screenResolution.x; } <DeepExtract> String previewSizeValueString = parameters.get("preview-size-values"); if (previewSizeValueString == null) { previewSizeValueString = parameters.get("preview-size-value"); } Point cameraResolution = null; if (previewSizeValueString != null) { Log.d(TAG, "preview-size-values parameter: " + previewSizeValueString); cameraResolution = findBestPreviewSizeValue(previewSizeValueString, screenResolutionForCamera); } if (cameraResolution == null) { cameraResolution = new Point((screenResolutionForCamera.x >> 3) << 3, (screenResolutionForCamera.y >> 3) << 3); } return cameraResolution; </DeepExtract> Log.d(TAG, "Camera resolution: " + screenResolution); }
Android_BaseLib
positive
785
public boolean cellInDbiBts(int lac, int cellID) { String query = String.format(Locale.US, "SELECT CID,LAC FROM DBi_bts WHERE LAC = %d AND CID = %d", lac, cellID); Cursor cursor = mDb.rawQuery(query, null); boolean exists = cursor.getCount() > 0; mDb.close(); return exists; }
public boolean cellInDbiBts(int lac, int cellID) { String query = String.format(Locale.US, "SELECT CID,LAC FROM DBi_bts WHERE LAC = %d AND CID = %d", lac, cellID); Cursor cursor = mDb.rawQuery(query, null); boolean exists = cursor.getCount() > 0; <DeepExtract> mDb.close(); </DeepExtract> return exists; }
AIMSICDL
positive
786
public static Album diamondsAndPearls() { Album album = new Album(6, "Diamonds And Pearls", 1991, prince(), new ArrayList<Song>()); Song song = new Song(16, "Thunder", album); album.getSongs().add(song); Song song = new Song(17, "Cream", album); album.getSongs().add(song); Song song = new Song(18, "Gett Off", album); album.getSongs().add(song); return album; }
public static Album diamondsAndPearls() { Album album = new Album(6, "Diamonds And Pearls", 1991, prince(), new ArrayList<Song>()); Song song = new Song(16, "Thunder", album); album.getSongs().add(song); Song song = new Song(17, "Cream", album); album.getSongs().add(song); <DeepExtract> Song song = new Song(18, "Gett Off", album); album.getSongs().add(song); </DeepExtract> return album; }
yoga
positive
787
public void setTintColor(int color) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundColor(color); } if (mNavBarAvailable) { mNavBarTintView.setBackgroundColor(color); } }
public void setTintColor(int color) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundColor(color); } <DeepExtract> if (mNavBarAvailable) { mNavBarTintView.setBackgroundColor(color); } </DeepExtract> }
jkapp
positive
788
private static int getColorAtCoords(int x, int z) { double mountain = MountainLayer.INSTANCE.mountainNoise.sample((x + MountainLayer.INSTANCE.mountainOffsetX) / 3f, (z + MountainLayer.INSTANCE.mountainOffsetZ) / 3f) * 1.25; double mountainRanges = 1 - Math.abs(MountainLayer.INSTANCE.mountainRangesNoise.sample((x - MountainLayer.INSTANCE.mountainOffsetX) / 6f, (z - MountainLayer.INSTANCE.mountainOffsetZ) / 6f)); mountain *= MountainLayer.distFactor(x, z); if (mountain > 0.75) { return getIntFromColor(50, 50, 50); } if (mountain > 0.5) { return getIntFromColor(150, 150, 150); } if (mountain < -0.8 + (mountainRanges * 0.2)) { return getIntFromColor(50, 50, 170); } 255 = (255 << 16) & 0x00FF0000; 255 = (255 << 8) & 0x0000FF00; 255 = 255 & 0x000000FF; return 0xFF000000 | 255 | 255 | 255; }
private static int getColorAtCoords(int x, int z) { double mountain = MountainLayer.INSTANCE.mountainNoise.sample((x + MountainLayer.INSTANCE.mountainOffsetX) / 3f, (z + MountainLayer.INSTANCE.mountainOffsetZ) / 3f) * 1.25; double mountainRanges = 1 - Math.abs(MountainLayer.INSTANCE.mountainRangesNoise.sample((x - MountainLayer.INSTANCE.mountainOffsetX) / 6f, (z - MountainLayer.INSTANCE.mountainOffsetZ) / 6f)); mountain *= MountainLayer.distFactor(x, z); if (mountain > 0.75) { return getIntFromColor(50, 50, 50); } if (mountain > 0.5) { return getIntFromColor(150, 150, 150); } if (mountain < -0.8 + (mountainRanges * 0.2)) { return getIntFromColor(50, 50, 170); } <DeepExtract> 255 = (255 << 16) & 0x00FF0000; 255 = (255 << 8) & 0x0000FF00; 255 = 255 & 0x000000FF; return 0xFF000000 | 255 | 255 | 255; </DeepExtract> }
ecotones
positive
789
@Override public void onClick(View v) { startActivity(new Intent(SplashScreenActivity.this, HomeActivity.class)); finish(); }
@Override public void onClick(View v) { <DeepExtract> startActivity(new Intent(SplashScreenActivity.this, HomeActivity.class)); finish(); </DeepExtract> }
microbit
positive
790
@Override public boolean onPreDraw() { nextView.getViewTreeObserver().removeOnPreDrawListener(this); if (state == ConnectButtonState.Enabled) { nextView.setPadding(smallPadding, 0, largePadding, 0); } else { nextView.setPadding(largePadding, 0, smallPadding, 0); } return false; }
@Override public boolean onPreDraw() { nextView.getViewTreeObserver().removeOnPreDrawListener(this); <DeepExtract> if (state == ConnectButtonState.Enabled) { nextView.setPadding(smallPadding, 0, largePadding, 0); } else { nextView.setPadding(largePadding, 0, smallPadding, 0); } </DeepExtract> return false; }
ConnectSDK-Android
positive
791
@Test public void test1() throws Exception { TestHelper helper = TestHelper.builder().interceptorClass(EnterInterceptor.class).methodMatcher("hello").reTransform(true); byte[] bytes = helper.process(Sample.class); System.err.println(Decompiler.decompile(bytes)); if (false) { throw new RuntimeException("test exception"); } return "abc".length(); String actual = capture.toString(); assertThat(actual).contains("onEnter, object:"); assertThat(actual).contains("enter: 3"); assertThat(actual).contains("onExit, object:"); assertThat(actual).contains("exit: 3"); }
@Test public void test1() throws Exception { TestHelper helper = TestHelper.builder().interceptorClass(EnterInterceptor.class).methodMatcher("hello").reTransform(true); byte[] bytes = helper.process(Sample.class); System.err.println(Decompiler.decompile(bytes)); <DeepExtract> if (false) { throw new RuntimeException("test exception"); } return "abc".length(); </DeepExtract> String actual = capture.toString(); assertThat(actual).contains("onEnter, object:"); assertThat(actual).contains("enter: 3"); assertThat(actual).contains("onExit, object:"); assertThat(actual).contains("exit: 3"); }
bytekit
positive
792
@Test public void methodLevelSeedAnnotationOverridesClassLevelSeedAnnotation() throws Throwable { throw reasonForFailure.get(); assertThat(capturingSeed.captured()).isEqualTo(123456L); }
@Test public void methodLevelSeedAnnotationOverridesClassLevelSeedAnnotation() throws Throwable { <DeepExtract> throw reasonForFailure.get(); </DeepExtract> assertThat(capturingSeed.captured()).isEqualTo(123456L); }
fyodor
positive
793
public void setColors(int[] colors) { mColors = colors; mColorIndex = 0; }
public void setColors(int[] colors) { mColors = colors; <DeepExtract> mColorIndex = 0; </DeepExtract> }
MousePaint
positive
795
@Test public void testChoiceWithBaseComplexType2() { ChoiceOfElementsTwo choiceOfElementsTwo = ChoiceOfElementsTwo.builder().withBike().withName("my bike").withFrameSize(58).end().build(); assertThat(choiceOfElementsTwo.getTransport()).isNotNull(); Transport transport = choiceOfElementsTwo.getTransport(); assertThat(transport.getName()).isEqualTo("my bike"); assertThat(transport).isInstanceOf(Bike.class); assertThat(((Bike) transport).getFrameSize()).isEqualTo(58); }
@Test public void testChoiceWithBaseComplexType2() { ChoiceOfElementsTwo choiceOfElementsTwo = ChoiceOfElementsTwo.builder().withBike().withName("my bike").withFrameSize(58).end().build(); <DeepExtract> assertThat(choiceOfElementsTwo.getTransport()).isNotNull(); Transport transport = choiceOfElementsTwo.getTransport(); assertThat(transport.getName()).isEqualTo("my bike"); assertThat(transport).isInstanceOf(Bike.class); assertThat(((Bike) transport).getFrameSize()).isEqualTo(58); </DeepExtract> }
jaxb2-rich-contract-plugin
positive
796
@Override protected void afterBuild(World w, int x, int y, int z, Object o) { SeedingShip.SHIP.placeStargate(w, x + 3, y + 5, z, 3); LootGenerator.generateLootChest(w, x, y + 1, z - 3, LootLevel.RARE); w.setBlockMetadataWithNotify(x, y + 1, z - 3, 3, 3); LootGenerator.generateLootChest(w, x, y + 1, z + 3, LootLevel.RARE); w.setBlockMetadataWithNotify(x, y + 1, z + 3, 2, 3); LootGenerator.generateLootChest(w, x - 3, y + 1, z, LootLevel.EPIC); w.setBlockMetadataWithNotify(x - 3, y + 1, z, 5, 3); for (int i = -2; i <= 2; i++) { for (int j = 5; j <= 8; j++) { if (!w.isSideSolid(x + i, y - 1, z + j, ForgeDirection.UP, false)) destroyColumn(w, x + i, y, z + j); if (!w.isSideSolid(x + i, y - 1, z - j, ForgeDirection.UP, false)) destroyColumn(w, x + i, y, z - j); if (!w.isSideSolid(x - j, y - 1, z + i, ForgeDirection.UP, false)) destroyColumn(w, x - j, y, z + i); } } }
@Override protected void afterBuild(World w, int x, int y, int z, Object o) { SeedingShip.SHIP.placeStargate(w, x + 3, y + 5, z, 3); LootGenerator.generateLootChest(w, x, y + 1, z - 3, LootLevel.RARE); w.setBlockMetadataWithNotify(x, y + 1, z - 3, 3, 3); LootGenerator.generateLootChest(w, x, y + 1, z + 3, LootLevel.RARE); w.setBlockMetadataWithNotify(x, y + 1, z + 3, 2, 3); LootGenerator.generateLootChest(w, x - 3, y + 1, z, LootLevel.EPIC); w.setBlockMetadataWithNotify(x - 3, y + 1, z, 5, 3); <DeepExtract> for (int i = -2; i <= 2; i++) { for (int j = 5; j <= 8; j++) { if (!w.isSideSolid(x + i, y - 1, z + j, ForgeDirection.UP, false)) destroyColumn(w, x + i, y, z + j); if (!w.isSideSolid(x + i, y - 1, z - j, ForgeDirection.UP, false)) destroyColumn(w, x + i, y, z - j); if (!w.isSideSolid(x - j, y - 1, z + i, ForgeDirection.UP, false)) destroyColumn(w, x - j, y, z + i); } } </DeepExtract> }
StargateTech2
positive
797
public K next() { if (!hasNext()) throw new NoSuchElementException(); K next = a[lastOffset = offset].next(); while (length != 0) { if (a[offset].hasNext()) break; length--; offset++; } return; return next; }
public K next() { if (!hasNext()) throw new NoSuchElementException(); K next = a[lastOffset = offset].next(); <DeepExtract> while (length != 0) { if (a[offset].hasNext()) break; length--; offset++; } return; </DeepExtract> return next; }
jhighlight
positive
798
public void setCompatible(String compatible) { PropertyDescriptor property = dataSourceProperties.get("compatible"); if ((property == null || property.getReadMethod() == null) && commonProperties.contains("compatible")) { return; } try { dataSourceProperties.get("compatible").getWriteMethod().invoke(commonDataSource, compatible); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new IllegalStateException(e); } }
public void setCompatible(String compatible) { <DeepExtract> PropertyDescriptor property = dataSourceProperties.get("compatible"); if ((property == null || property.getReadMethod() == null) && commonProperties.contains("compatible")) { return; } try { dataSourceProperties.get("compatible").getWriteMethod().invoke(commonDataSource, compatible); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new IllegalStateException(e); } </DeepExtract> }
omnipersistence
positive
800
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { IColorTheme theme = Client.getSettings().getTheme(); View page = inflater.inflate(R.layout.post_layout, container, false); page.setBackgroundColor(getResources().getColor(theme.getBackground1())); editText = (EditText) page.findViewById(R.id.editText_tweet); frameInReplyTo = (FrameLayout) page.findViewById(R.id.frame_inreplyto); imagePict = (ImageView) page.findViewById(R.id.image_pict); textCount = (TextView) page.findViewById(R.id.textView_count); textCount.setTextColor(getResources().getColor(theme.getNormalTextColor())); Button imageButtonSubmit = (Button) page.findViewById(R.id.imBtn_tweet); ImageButton imageButtonDelete = (ImageButton) page.findViewById(R.id.post_delete); ImageButton imageButtonMenu = (ImageButton) page.findViewById(R.id.post_menu); ImageButton imageButtonPict = (ImageButton) page.findViewById(R.id.post_pickpict); ImageButton config = (ImageButton) page.findViewById(R.id.post_config); config.setImageResource(theme.getConfigIcon()); config.setOnClickListener(this); iconView = (NetworkImageView) page.findViewById(R.id.post_myIcon); screenNameView = (TextView) page.findViewById(R.id.post_myName); screenNameView.setTextColor(getResources().getColor(theme.getNormalTextColor())); PostEditTextListener listener = new PostEditTextListener(textCount); editText.setTextSize(Client.getSettings().getTextSize() + 3); editText.addTextChangedListener(listener); editText.setOnFocusChangeListener(listener); editText.setMovementMethod(new ArrowKeyMovementMethod() { @Override protected boolean right(TextView widget, Spannable buffer) { return widget.getSelectionEnd() == widget.length() || super.right(widget, buffer); } }); if (Client.<Boolean>getPreferenceValue(EnumPreferenceKey.OPEN_IME)) { editText.requestFocus(); } imageButtonSubmit.setOnClickListener(this); imageButtonDelete.setImageResource(theme.getDeleteIcon()); imageButtonDelete.setOnClickListener(this); imageButtonMenu.setImageResource(theme.getMenuIcon()); imageButtonMenu.setOnClickListener(this); imageButtonPict.setImageResource(theme.getPictureIcon()); imageButtonPict.setOnClickListener(this); imagePict.setOnClickListener(this); PostPageState state = getState(); if (editText != null) { String text = state.getText(); int selectionStart = state.getSelectionStart(); int selectionEnd = state.getSelectionEnd(); setText(text); setSelection(selectionStart, selectionEnd); } if (frameInReplyTo != null) { long inReplyTo = state.getInReplyToStatusId(); setInReplyTo(inReplyTo); } if (imagePict != null) { String picturePath = state.getPicturePath(); setPicture(picturePath); } if (!inited && iconView != null && Client.getMainAccount() != null) { initMyInformation(); } if (Client.getMainAccount() != null) { initMyInformation(); } return page; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { IColorTheme theme = Client.getSettings().getTheme(); View page = inflater.inflate(R.layout.post_layout, container, false); page.setBackgroundColor(getResources().getColor(theme.getBackground1())); editText = (EditText) page.findViewById(R.id.editText_tweet); frameInReplyTo = (FrameLayout) page.findViewById(R.id.frame_inreplyto); imagePict = (ImageView) page.findViewById(R.id.image_pict); textCount = (TextView) page.findViewById(R.id.textView_count); textCount.setTextColor(getResources().getColor(theme.getNormalTextColor())); Button imageButtonSubmit = (Button) page.findViewById(R.id.imBtn_tweet); ImageButton imageButtonDelete = (ImageButton) page.findViewById(R.id.post_delete); ImageButton imageButtonMenu = (ImageButton) page.findViewById(R.id.post_menu); ImageButton imageButtonPict = (ImageButton) page.findViewById(R.id.post_pickpict); ImageButton config = (ImageButton) page.findViewById(R.id.post_config); config.setImageResource(theme.getConfigIcon()); config.setOnClickListener(this); iconView = (NetworkImageView) page.findViewById(R.id.post_myIcon); screenNameView = (TextView) page.findViewById(R.id.post_myName); screenNameView.setTextColor(getResources().getColor(theme.getNormalTextColor())); PostEditTextListener listener = new PostEditTextListener(textCount); editText.setTextSize(Client.getSettings().getTextSize() + 3); editText.addTextChangedListener(listener); editText.setOnFocusChangeListener(listener); editText.setMovementMethod(new ArrowKeyMovementMethod() { @Override protected boolean right(TextView widget, Spannable buffer) { return widget.getSelectionEnd() == widget.length() || super.right(widget, buffer); } }); if (Client.<Boolean>getPreferenceValue(EnumPreferenceKey.OPEN_IME)) { editText.requestFocus(); } imageButtonSubmit.setOnClickListener(this); imageButtonDelete.setImageResource(theme.getDeleteIcon()); imageButtonDelete.setOnClickListener(this); imageButtonMenu.setImageResource(theme.getMenuIcon()); imageButtonMenu.setOnClickListener(this); imageButtonPict.setImageResource(theme.getPictureIcon()); imageButtonPict.setOnClickListener(this); imagePict.setOnClickListener(this); <DeepExtract> PostPageState state = getState(); if (editText != null) { String text = state.getText(); int selectionStart = state.getSelectionStart(); int selectionEnd = state.getSelectionEnd(); setText(text); setSelection(selectionStart, selectionEnd); } if (frameInReplyTo != null) { long inReplyTo = state.getInReplyToStatusId(); setInReplyTo(inReplyTo); } if (imagePict != null) { String picturePath = state.getPicturePath(); setPicture(picturePath); } if (!inited && iconView != null && Client.getMainAccount() != null) { initMyInformation(); } </DeepExtract> if (Client.getMainAccount() != null) { initMyInformation(); } return page; }
SmileEssence-Lite
positive
802
@CheckResult public static Toast error(@NonNull Context context, @NonNull CharSequence message, int duration, boolean withIcon) { return custom(context, message, ToastyUtils.getDrawable(context, ToastyUtils.getDrawable(context, R.drawable.ic_clear_white_48dp)), ERROR_COLOR, duration, withIcon, true); }
@CheckResult public static Toast error(@NonNull Context context, @NonNull CharSequence message, int duration, boolean withIcon) { <DeepExtract> return custom(context, message, ToastyUtils.getDrawable(context, ToastyUtils.getDrawable(context, R.drawable.ic_clear_white_48dp)), ERROR_COLOR, duration, withIcon, true); </DeepExtract> }
funk
positive
803
public void onWin(WinEvent e) { _drawVictory = true; if (_tcMode) { _out.println("TC score: " + (_gunDataManager.getDamageGiven() / (_robot.getRoundNum() + 1))); } GunEnemy duelEnemy = _gunDataManager.duelEnemy(); if (is1v1() && duelEnemy != null) { _virtualGuns.printGunRatings(duelEnemy.botName); } }
public void onWin(WinEvent e) { _drawVictory = true; <DeepExtract> if (_tcMode) { _out.println("TC score: " + (_gunDataManager.getDamageGiven() / (_robot.getRoundNum() + 1))); } GunEnemy duelEnemy = _gunDataManager.duelEnemy(); if (is1v1() && duelEnemy != null) { _virtualGuns.printGunRatings(duelEnemy.botName); } </DeepExtract> }
Diamond
positive
805
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View fragmentView = inflater.inflate(R.layout.fragment_scan_radar, container, false); unbinder = ButterKnife.bind(this, fragmentView); ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar); ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); if (actionBar != null) { mToolbar.setSubtitle(R.string.title_fragment_radar_beacons); } mRadar.setUseMetric(true); mRadar.setDistanceView(mDistView); return fragmentView; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View fragmentView = inflater.inflate(R.layout.fragment_scan_radar, container, false); unbinder = ButterKnife.bind(this, fragmentView); <DeepExtract> ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar); ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); if (actionBar != null) { mToolbar.setSubtitle(R.string.title_fragment_radar_beacons); } </DeepExtract> mRadar.setUseMetric(true); mRadar.setDistanceView(mDistView); return fragmentView; }
beaconloc
positive
807
public static void serialize(JsonElement e, OutputStream out) throws IOException { NSObject nsObject; if (e.isArray()) { nsObject = toNsObject(e.asArray()); } else if (e.isObject()) { nsObject = toNsObject(e.asObject()); } else { nsObject = toNsObject(e.asPrimitive()); } BinaryPropertyListWriter.write(out, nsObject); }
public static void serialize(JsonElement e, OutputStream out) throws IOException { <DeepExtract> NSObject nsObject; if (e.isArray()) { nsObject = toNsObject(e.asArray()); } else if (e.isObject()) { nsObject = toNsObject(e.asObject()); } else { nsObject = toNsObject(e.asPrimitive()); } </DeepExtract> BinaryPropertyListWriter.write(out, nsObject); }
jsonj
positive
808
@Override public MethodSpec.Builder setterBuilt(ObjectPluginContext objectPluginContext, TypeDeclaration declaration, MethodSpec.Builder methodSpec, EventType eventType) { MethodSpec spec = methodSpec.build(); MethodSpec seen = methodSpec.build(); MethodSpec.Builder newBuilder = MethodSpec.methodBuilder("with" + spec.name.substring(3)).addModifiers(seen.modifiers).returns(objectPluginContext.creationResult().getJavaName(EventType.INTERFACE)); for (ParameterSpec parameter : seen.parameters) { newBuilder.addParameter(parameter); } for (AnnotationSpec annotation : seen.annotations) { newBuilder.addAnnotation(annotation); } if (eventType == EventType.IMPLEMENTATION) { newBuilder.addCode(spec.code).addStatement("return this"); return newBuilder; } if (eventType == EventType.INTERFACE) { return newBuilder; } return methodSpec; }
@Override public MethodSpec.Builder setterBuilt(ObjectPluginContext objectPluginContext, TypeDeclaration declaration, MethodSpec.Builder methodSpec, EventType eventType) { MethodSpec spec = methodSpec.build(); MethodSpec seen = methodSpec.build(); MethodSpec.Builder newBuilder = MethodSpec.methodBuilder("with" + spec.name.substring(3)).addModifiers(seen.modifiers).returns(objectPluginContext.creationResult().getJavaName(EventType.INTERFACE)); <DeepExtract> for (ParameterSpec parameter : seen.parameters) { newBuilder.addParameter(parameter); } for (AnnotationSpec annotation : seen.annotations) { newBuilder.addAnnotation(annotation); } </DeepExtract> if (eventType == EventType.IMPLEMENTATION) { newBuilder.addCode(spec.code).addStatement("return this"); return newBuilder; } if (eventType == EventType.INTERFACE) { return newBuilder; } return methodSpec; }
raml-java-tools
positive
809