before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
|---|---|---|---|
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;
}
|
<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>
|
mybatis-generator-gui-extension
|
positive
|
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]);
}
|
<DeepExtract>
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>
<DeepExtract>
throwIfUnattachedDispatch(dispatchTarget);
invokeSubv(dispatchTarget, name, Dispatch.Method | Dispatch.Get, VariantUtilities.objectsToVariants(attributes), new int[attributes.length]);
</DeepExtract>
|
jacob
|
positive
|
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);
}
|
<DeepExtract>
int idx = ((NameAndType) cp.infos[methodDef.nameAndTypeIndex - 1]).descriptionIndex;
return getString(cp, idx);
</DeepExtract>
|
mini-jvm
|
positive
|
@Override
public void run() {
cacheService.shutdown();
executorStart = false;
}
|
<DeepExtract>
cacheService.shutdown();
executorStart = false;
</DeepExtract>
|
opensharding-spi-impl
|
positive
|
@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);
}
}
|
<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
|
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;
}
|
<DeepExtract>
VolleySingleton.getInstance(getActivity().getApplication()).addToRequestQueueHttps(jsArrayRequest, keystore_path, keystore_password);
</DeepExtract>
|
qBittorrent-Controller
|
positive
|
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);
}
}
|
<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
|
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);
}
|
<DeepExtract>
Boolean ret = this.economy.hasAccount(player);
if (!ret && true)
this.economy.createPlayerAccount(player);
return ret;
</DeepExtract>
|
GlobalMarketChest
|
positive
|
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);
}
|
<DeepExtract>
return fetchWithParameters(Cytomine.getInstance().getDefaultCytomineConnection(), parameters, 0, 0);
</DeepExtract>
|
Cytomine-java-client
|
positive
|
@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;
}
|
<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
|
@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);
}
|
<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
|
@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;
}
|
<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
|
@Override
public Integer value7() {
return (Integer) get(6);
}
|
<DeepExtract>
return (Integer) get(6);
</DeepExtract>
|
wdumper
|
positive
|
public void set(long index, Value value) {
self.put((String) get(index), unwrapValue(value));
}
|
<DeepExtract>
self.put((String) get(index), unwrapValue(value));
</DeepExtract>
|
es4x
|
positive
|
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;
}
|
<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
|
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;
}
|
<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>
|
MineTunes
|
positive
|
public static void showDialogQuestion(Activity activity, CharSequence msg, DialogInterface.OnClickListener posLis, DialogInterface.OnClickListener negLis) {
activity.runOnUiThread(new Runnable() {
public void run() {
if (activity.isFinishing())
return;
AlertDialog.Builder b = new AlertDialog.Builder(activity);
b.setCancelable(false);
b.setTitle(activity.getText(R.string.question));
b.setIcon(R.drawable.var_empty);
b.setMessage(msg);
if (!TextUtils.isEmpty(activity.getString(R.string.yes))) {
b.setPositiveButton(activity.getString(R.string.yes), posLis);
}
if (!TextUtils.isEmpty(activity.getString(R.string.no))) {
b.setNegativeButton(activity.getString(R.string.no), negLis);
}
if (!activity.isFinishing())
b.show();
}
});
}
|
<DeepExtract>
activity.runOnUiThread(new Runnable() {
public void run() {
if (activity.isFinishing())
return;
AlertDialog.Builder b = new AlertDialog.Builder(activity);
b.setCancelable(false);
b.setTitle(activity.getText(R.string.question));
b.setIcon(R.drawable.var_empty);
b.setMessage(msg);
if (!TextUtils.isEmpty(activity.getString(R.string.yes))) {
b.setPositiveButton(activity.getString(R.string.yes), posLis);
}
if (!TextUtils.isEmpty(activity.getString(R.string.no))) {
b.setNegativeButton(activity.getString(R.string.no), negLis);
}
if (!activity.isFinishing())
b.show();
}
});
</DeepExtract>
|
WhereYouGo
|
positive
|
@Override
public void onPlaylist(long plid, Object user) {
Task<Void> t = new Task<Void>() {
@Override
protected Void doAsync() {
Err err = Err.NO_ERR;
DB db = DB.get();
db.beginTransaction();
try {
for (long mid : vids) {
DB.Err dbErr = db.insertVideoToPlaylist(plid, mid);
if (DB.Err.NO_ERR != dbErr) {
if (DB.Err.DUPLICATED != dbErr || 1 == vids.length && !move)
err = Err.map(dbErr);
} else {
if (move) {
if (free.yhc.netmbuddy.utils.UxUtil.isUserPlaylist(srcPlid))
db.deleteVideoFrom(srcPlid, mid);
else
db.deleteVideoExcept(plid, mid);
}
}
db.setTransactionSuccessful();
}
} finally {
db.endTransaction();
}
final Err result = err;
AppEnv.getUiHandler().post(new Runnable() {
@Override
public void run() {
listener.onPostExecute(result, user);
}
});
return null;
}
};
DialogTask.Builder<DialogTask.Builder> b = new DialogTask.Builder<>(activity, t);
b.setCancelButtonText(R.string.cancel).setMessage(move ? R.string.moving : R.string.adding);
if (!b.create().start())
P.bug();
}
|
<DeepExtract>
Task<Void> t = new Task<Void>() {
@Override
protected Void doAsync() {
Err err = Err.NO_ERR;
DB db = DB.get();
db.beginTransaction();
try {
for (long mid : vids) {
DB.Err dbErr = db.insertVideoToPlaylist(plid, mid);
if (DB.Err.NO_ERR != dbErr) {
if (DB.Err.DUPLICATED != dbErr || 1 == vids.length && !move)
err = Err.map(dbErr);
} else {
if (move) {
if (free.yhc.netmbuddy.utils.UxUtil.isUserPlaylist(srcPlid))
db.deleteVideoFrom(srcPlid, mid);
else
db.deleteVideoExcept(plid, mid);
}
}
db.setTransactionSuccessful();
}
} finally {
db.endTransaction();
}
final Err result = err;
AppEnv.getUiHandler().post(new Runnable() {
@Override
public void run() {
listener.onPostExecute(result, user);
}
});
return null;
}
};
DialogTask.Builder<DialogTask.Builder> b = new DialogTask.Builder<>(activity, t);
b.setCancelButtonText(R.string.cancel).setMessage(move ? R.string.moving : R.string.adding);
if (!b.create().start())
P.bug();
</DeepExtract>
|
netmbuddy
|
positive
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "SINGLE" + " cannot be null");
}
criteria.add(new Criterion("SINGLE <>", value));
</DeepExtract>
|
mybatis-generator-gui-extension
|
positive
|
@Before
public void before() {
return createHelper(LocalIntObj.class);
}
|
<DeepExtract>
return createHelper(LocalIntObj.class);
</DeepExtract>
|
Squeaky
|
positive
|
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);
}
|
<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>
|
MVVMArms
|
positive
|
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;
}
|
<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>
|
cspiration
|
positive
|
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;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "collegeid" + " cannot be null");
}
criteria.add(new Criterion("collegeID in", values));
</DeepExtract>
|
examination_system-
|
positive
|
@Test
public void testEventuallyCollect() throws Exception {
setupEventuallyCollect(20, 10);
assertEquals(future, underTest.eventuallyCollect(callables, consumer, supplier, 10));
verifyEventuallyCollect(20, 10);
}
|
<DeepExtract>
setupEventuallyCollect(20, 10);
assertEquals(future, underTest.eventuallyCollect(callables, consumer, supplier, 10));
verifyEventuallyCollect(20, 10);
</DeepExtract>
|
tiny-async-java
|
positive
|
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();
}
|
<DeepExtract>
this.changed = true;
fireState();
fireComplexState();
</DeepExtract>
<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
|
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;
}
|
<DeepExtract>
if (currentAnim != null) {
Animation anim = animations.get(currentAnim);
if (anim != null) {
anim.update(delta);
}
}
</DeepExtract>
|
MarteEngine
|
positive
|
@Override
public void deleteElogFile(Integer eLogId) {
elogMapper.deleteElog(eLogId);
}
|
<DeepExtract>
elogMapper.deleteElog(eLogId);
</DeepExtract>
|
warmerblog
|
positive
|
public void onClick(View v) {
if (Constants.LOG_V)
Log.v(TAG, "onStartNewGameButton()");
savePuzzlePreferences();
String puzzleSourceId = getSelectedPuzzleSource();
new GameLauncher(this, db).startNewGame(puzzleSourceId);
}
|
<DeepExtract>
if (Constants.LOG_V)
Log.v(TAG, "onStartNewGameButton()");
savePuzzlePreferences();
String puzzleSourceId = getSelectedPuzzleSource();
new GameLauncher(this, db).startNewGame(puzzleSourceId);
</DeepExtract>
|
andoku
|
positive
|
@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);
}
}
|
<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
|
@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);
}
}
|
<DeepExtract>
if (this.port == null)
throw new UsbDisconnectedException();
</DeepExtract>
|
usb4java-javax
|
positive
|
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));
}
}
|
<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
|
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());
}
|
<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>
|
maven-plugin-tools
|
positive
|
@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);
}
|
<DeepExtract>
QuickTestConfiguration.setXsdLocation("./data/general/empty.xsd");
QuickTestConfiguration.setXmlLocation("./data/general/entityReference1.xml");
QuickTestConfiguration.setExiLocation("./out/general/entityReference1.xml.exi");
</DeepExtract>
|
exificient
|
positive
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "confDesc" + " cannot be null");
}
criteria.add(new Criterion("conf_desc <>", value));
</DeepExtract>
|
lightconf
|
positive
|
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);
}
|
<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>
|
piriti
|
positive
|
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;
}
|
<DeepExtract>
if (_child != null) {
Object value = _child._finish();
_map.put(_propName, value);
_child = null;
}
</DeepExtract>
<DeepExtract>
_map.put(propName, child._collection ? Boolean.TRUE : Boolean.FALSE);
return this;
</DeepExtract>
|
jackson-jr
|
positive
|
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;
}
|
<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>
|
university
|
positive
|
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();
}
|
<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
|
@Override
public Future<Long> llen(byte[] key) {
return execCmd(objectConverter, encode(channel.alloc(), longConverter, encode(channel.alloc(), LLEN.raw, key)));
}
|
<DeepExtract>
return execCmd(objectConverter, encode(channel.alloc(), longConverter, encode(channel.alloc(), LLEN.raw, key)));
</DeepExtract>
|
nedis
|
positive
|
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;
}
}
|
<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
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "id" + " cannot be null");
}
criteria.add(new Criterion("id >", value));
</DeepExtract>
|
MarketServer
|
positive
|
@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;
}
|
<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
|
public static int w(String tag, String msg, Throwable tr) {
System.out.println(msg + '\n' + getStackTraceString(tr));
return 0;
}
|
<DeepExtract>
System.out.println(msg + '\n' + getStackTraceString(tr));
return 0;
</DeepExtract>
|
Android-ORM
|
positive
|
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);
}
|
<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>
|
SteamGifts
|
positive
|
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;
}
|
<DeepExtract>
if (root1 == null)
return;
inorder(root1.left, list1);
list1.add(root1.val);
inorder(root1.right, list1);
</DeepExtract>
<DeepExtract>
if (root2 == null)
return;
inorder(root2.left, list2);
list2.add(root2.val);
inorder(root2.right, list2);
</DeepExtract>
<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
|
@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);
}
|
<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
|
public void postSetSelection(final int position) {
clearFocus();
post(new Runnable() {
@Override
public void run() {
setSelection(position);
}
});
mScrollStateChangedRunnable.doScrollStateChange(this, OnScrollListener.SCROLL_STATE_IDLE);
}
|
<DeepExtract>
mScrollStateChangedRunnable.doScrollStateChange(this, OnScrollListener.SCROLL_STATE_IDLE);
</DeepExtract>
|
HijriDatePicker
|
positive
|
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();
}
|
<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
|
public static Builder newBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
|
<DeepExtract>
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
</DeepExtract>
|
pomelo
|
positive
|
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;
}
|
<DeepExtract>
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>
<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>
|
G-Earth
|
positive
|
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;
}
|
<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>
|
uccn
|
positive
|
@Override
public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
scheduledExecutor.schedule(new Runnable() {
@Override
public void run() {
((ExampleRunnable) r).getSprite().setRejected();
}
}, 500, TimeUnit.MILLISECONDS);
message2("DiscardPolicy invoked. Discarding", ConcurrentExampleConstants.WARNING_MESSAGE_COLOR);
}
|
<DeepExtract>
scheduledExecutor.schedule(new Runnable() {
@Override
public void run() {
((ExampleRunnable) r).getSprite().setRejected();
}
}, 500, TimeUnit.MILLISECONDS);
</DeepExtract>
|
java-concurrent-animated
|
positive
|
@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));
}
|
<DeepExtract>
assertEquals(expected, AreNodesOrdered.totallyOrdered(possible1, possible2, middle));
</DeepExtract>
|
elements-of-programming-interviews-solutions
|
positive
|
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;
}
|
<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
|
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;
}
|
<DeepExtract>
this.serverUri = serverUri;
</DeepExtract>
|
jira-plugin
|
positive
|
@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");
}
}
|
<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
|
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...");
}
|
<DeepExtract>
System.out.println("eating...");
</DeepExtract>
<DeepExtract>
System.out.println("eating...");
</DeepExtract>
<DeepExtract>
System.out.println("eating...");
</DeepExtract>
|
PGR-103-2020
|
positive
|
@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();
}
|
<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>
|
App-Architecture
|
positive
|
@Override
public Boolean call() throws Exception {
return options.getAutoPort();
}
|
<DeepExtract>
return options.getAutoPort();
</DeepExtract>
|
gwt-gradle-plugin
|
positive
|
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);
}
|
<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
|
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;
}
}
|
<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
|
@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);
}
}
|
<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
|
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);
}
|
<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
|
@Test
public void testCancel() {
String idOne = tryCreateAndShouldCreate().getId();
tryCreateAndShouldNotCreate();
id -> listener.byId(response(id, OrderStatus.CANCELED)).accept(idOne);
tryCreateAndShouldCreate();
tryCreateAndShouldNotCreate();
}
|
<DeepExtract>
String idOne = tryCreateAndShouldCreate().getId();
tryCreateAndShouldNotCreate();
id -> listener.byId(response(id, OrderStatus.CANCELED)).accept(idOne);
tryCreateAndShouldCreate();
tryCreateAndShouldNotCreate();
</DeepExtract>
|
GTC-all-repo
|
positive
|
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
encodeData();
}
|
<DeepExtract>
encodeData();
</DeepExtract>
|
OkapiBarcode
|
positive
|
public String printRecords(Object... values) throws IOException {
csvPrinter.printRecords(values);
writer.flush();
final String output = writer.getBuffer().toString();
writer.getBuffer().setLength(0);
return output;
}
|
<DeepExtract>
writer.flush();
final String output = writer.getBuffer().toString();
writer.getBuffer().setLength(0);
return output;
</DeepExtract>
|
freemarker-generator
|
positive
|
@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;
}
|
<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
|
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
prepareBackgroundManager();
setupUIElements();
loadRows();
setupEventListeners();
}
|
<DeepExtract>
prepareBackgroundManager();
setupUIElements();
loadRows();
setupEventListeners();
</DeepExtract>
|
CumulusTV
|
positive
|
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);
}
}
}
|
<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>
|
AndroidRepeaterProject
|
positive
|
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;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "accessAuthority" + " cannot be null");
}
criteria.add(new Criterion("access_authority not like", value));
</DeepExtract>
|
AnyMock
|
positive
|
public void onLayoutComplete() {
return mLayoutManager.getWidth() - mLayoutManager.getPaddingLeft() - mLayoutManager.getPaddingRight();
}
|
<DeepExtract>
return mLayoutManager.getWidth() - mLayoutManager.getPaddingLeft() - mLayoutManager.getPaddingRight();
</DeepExtract>
|
RxBanner
|
positive
|
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();
}
|
<DeepExtract>
if (!settings.isAllowClipboardTransfer()) {
this.isRunning = false;
}
if (settings.isAllowClipboardTransfer() && !this.isEnabled) {
(new Thread(this)).start();
}
this.isEnabled = settings.isAllowClipboardTransfer();
</DeepExtract>
|
tvnjviewer4cs
|
positive
|
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);
}
|
<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
|
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();
}
|
<DeepExtract>
if (!defer)
show();
</DeepExtract>
|
skeleton-sp18
|
positive
|
@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()));
}
|
<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
|
@Override
public void onClick(View v) {
if (tint_color != Color.parseColor("#FFA0D722")) {
tint_color = Color.parseColor("#FFA0D722");
applyTempSelectedEffect();
}
}
|
<DeepExtract>
if (tint_color != Color.parseColor("#FFA0D722")) {
tint_color = Color.parseColor("#FFA0D722");
applyTempSelectedEffect();
}
</DeepExtract>
|
Dali-Doodle
|
positive
|
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;
}
|
<DeepExtract>
if (!(this instanceof CNCPath)) {
xLoc = x;
yLoc = y;
notifyChangeListeners();
}
</DeepExtract>
|
LaserCut
|
positive
|
@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 + "/");
}
|
<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
|
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);
}
|
<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
|
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);
}
|
<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
|
public static Map<LoincId, LoincEntry> load(String pathToLoincCoreTable) {
LoincTableCoreParser parser = new LoincTableCoreParser(pathToLoincCoreTable);
return loincEntries;
}
|
<DeepExtract>
return loincEntries;
</DeepExtract>
|
loinc2hpo
|
positive
|
private OSchema getSchema() {
final ODatabaseDocument tlDb = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();
if (database != null && tlDb != database) {
database.activateOnCurrentThread();
ODatabaseRecordThreadLocal.INSTANCE.set(database);
}
return database.getMetadata().getSchema();
}
|
<DeepExtract>
final ODatabaseDocument tlDb = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();
if (database != null && tlDb != database) {
database.activateOnCurrentThread();
ODatabaseRecordThreadLocal.INSTANCE.set(database);
}
</DeepExtract>
|
orientdb-gremlin
|
positive
|
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");
}
|
<DeepExtract>
if (cons == null)
cons = new Console();
return cons;
</DeepExtract>
<DeepExtract>
if (in != null)
in.setMessage("How are you?");
</DeepExtract>
|
SmallSimpleSafe
|
positive
|
@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);
}
}
|
<DeepExtract>
this.form = form;
</DeepExtract>
|
skunkworks-crow
|
positive
|
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Toast toast = Toast.makeText(this, "access location fail...", Toast.LENGTH_SHORT);
toast.show();
}
|
<DeepExtract>
Toast toast = Toast.makeText(this, "access location fail...", Toast.LENGTH_SHORT);
toast.show();
</DeepExtract>
|
kkangs_android
|
positive
|
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);
}
|
<DeepExtract>
return previewFormat;
</DeepExtract>
<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>
|
Android_BaseLib
|
positive
|
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;
}
|
<DeepExtract>
mDb.close();
</DeepExtract>
|
AIMSICDL
|
positive
|
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;
}
|
<DeepExtract>
Song song = new Song(16, "Thunder", album);
album.getSongs().add(song);
</DeepExtract>
<DeepExtract>
Song song = new Song(17, "Cream", album);
album.getSongs().add(song);
</DeepExtract>
<DeepExtract>
Song song = new Song(18, "Gett Off", album);
album.getSongs().add(song);
</DeepExtract>
|
yoga
|
positive
|
public void setTintColor(int color) {
if (mStatusBarAvailable) {
mStatusBarTintView.setBackgroundColor(color);
}
if (mNavBarAvailable) {
mNavBarTintView.setBackgroundColor(color);
}
}
|
<DeepExtract>
if (mStatusBarAvailable) {
mStatusBarTintView.setBackgroundColor(color);
}
</DeepExtract>
<DeepExtract>
if (mNavBarAvailable) {
mNavBarTintView.setBackgroundColor(color);
}
</DeepExtract>
|
jkapp
|
positive
|
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;
}
|
<DeepExtract>
255 = (255 << 16) & 0x00FF0000;
255 = (255 << 8) & 0x0000FF00;
255 = 255 & 0x000000FF;
return 0xFF000000 | 255 | 255 | 255;
</DeepExtract>
|
ecotones
|
positive
|
@Override
public void onClick(View v) {
startActivity(new Intent(SplashScreenActivity.this, HomeActivity.class));
finish();
}
|
<DeepExtract>
startActivity(new Intent(SplashScreenActivity.this, HomeActivity.class));
finish();
</DeepExtract>
|
microbit
|
positive
|
@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;
}
|
<DeepExtract>
if (state == ConnectButtonState.Enabled) {
nextView.setPadding(smallPadding, 0, largePadding, 0);
} else {
nextView.setPadding(largePadding, 0, smallPadding, 0);
}
</DeepExtract>
|
ConnectSDK-Android
|
positive
|
@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");
}
|
<DeepExtract>
if (false) {
throw new RuntimeException("test exception");
}
return "abc".length();
</DeepExtract>
|
bytekit
|
positive
|
@Test
public void methodLevelSeedAnnotationOverridesClassLevelSeedAnnotation() throws Throwable {
throw reasonForFailure.get();
assertThat(capturingSeed.captured()).isEqualTo(123456L);
}
|
<DeepExtract>
throw reasonForFailure.get();
</DeepExtract>
|
fyodor
|
positive
|
private synchronized void playPre() {
index--;
if (index < 0) {
index = urls.size() - 1;
}
mPaused = false;
showPlay(true);
setCurrentTime(ZEROTIME);
setTotalTime(ZEROTIME);
setTitle(getCurrentPlayPath());
stopAutoIncreasing();
stopAutoPlaying();
new Thread() {
public void run() {
final boolean isSuccess = mController.play(mDevice, getCurrentPlayPath());
if (isSuccess) {
LogUtil.d(TAG, "play success");
} else {
LogUtil.d(TAG, "play failed..");
}
runOnUiThread(new Runnable() {
public void run() {
LogUtil.d(TAG, "play success and start to get media duration");
if (isSuccess) {
mPlaying = true;
startAutoIncreasing();
}
showPlay(!isSuccess);
getMediaDuration();
}
});
}
}.start();
}
|
<DeepExtract>
mPaused = false;
showPlay(true);
setCurrentTime(ZEROTIME);
setTotalTime(ZEROTIME);
setTitle(getCurrentPlayPath());
stopAutoIncreasing();
stopAutoPlaying();
new Thread() {
public void run() {
final boolean isSuccess = mController.play(mDevice, getCurrentPlayPath());
if (isSuccess) {
LogUtil.d(TAG, "play success");
} else {
LogUtil.d(TAG, "play failed..");
}
runOnUiThread(new Runnable() {
public void run() {
LogUtil.d(TAG, "play success and start to get media duration");
if (isSuccess) {
mPlaying = true;
startAutoIncreasing();
}
showPlay(!isSuccess);
getMediaDuration();
}
});
}
}.start();
</DeepExtract>
|
CyberLink4Android
|
positive
|
public void setColors(int[] colors) {
mColors = colors;
mColorIndex = 0;
}
|
<DeepExtract>
mColorIndex = 0;
</DeepExtract>
|
MousePaint
|
positive
|
@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);
}
|
<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
|
@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);
}
}
}
|
<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
|
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;
}
|
<DeepExtract>
while (length != 0) {
if (a[offset].hasNext())
break;
length--;
offset++;
}
return;
</DeepExtract>
|
jhighlight
|
positive
|
public void enableCaseSensitiveLike(boolean enable) {
setPragma(Pragma.CASE_SENSITIVE_LIKE, Boolean.toString(enable));
}
|
<DeepExtract>
setPragma(Pragma.CASE_SENSITIVE_LIKE, Boolean.toString(enable));
</DeepExtract>
|
spatialite4-jdbc
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.