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 Criteria andIdmypatientBetween(Integer value1, Integer value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "idmypatient" + " cannot be null");
}
criteria.add(new Criterion("idmypatient between", value1, value2));
return (Criteria) this;
} | public Criteria andIdmypatientBetween(Integer value1, Integer value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "idmypatient" + " cannot be null");
}
criteria.add(new Criterion("idmypatient between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | ehealth_start | positive | 4,070 |
@Override
public void containsText(String text) {
fluentWait.waitFor(new ElementContainsText(element, text));
} | @Override
public void containsText(String text) {
<DeepExtract>
fluentWait.waitFor(new ElementContainsText(element, text));
</DeepExtract>
} | teasy | positive | 4,073 |
public void onClose(WebSocketConnection conn) {
if (conn != null) {
conn.close();
}
viewer = null;
connection = null;
System.out.println("Connection closed");
} | public void onClose(WebSocketConnection conn) {
<DeepExtract>
if (conn != null) {
conn.close();
}
viewer = null;
connection = null;
</DeepExtract>
System.out.println("Connection closed");
} | OculusGoStreamer | positive | 4,074 |
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mMonthReceiver = new MonthReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(ADD_EVENT);
filter.addAction(UPDATE_EVENT);
filter.addAction(DELETE_EVENT);
filter.addAction(UPDATE_UI);
filter.addAction(SKIP);
filter.addAction(SELECTED);
filter.addAction(WEEK_SETTING);
mHostActivity.registerReceiver(mMonthReceiver, filter);
} | @Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
<DeepExtract>
mMonthReceiver = new MonthReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(ADD_EVENT);
filter.addAction(UPDATE_EVENT);
filter.addAction(DELETE_EVENT);
filter.addAction(UPDATE_UI);
filter.addAction(SKIP);
filter.addAction(SELECTED);
filter.addAction(WEEK_SETTING);
mHostActivity.registerReceiver(mMonthReceiver, filter);
</DeepExtract>
} | CalendarII | positive | 4,075 |
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder().include(ConsumeMostlySuccess.class.getSimpleName()).warmupIterations(10).measurementIterations(10).threads(2).forks(1).build();
new Runner(opt).run();
} | public static void main(String[] args) throws RunnerException {
<DeepExtract>
Options opt = new OptionsBuilder().include(ConsumeMostlySuccess.class.getSimpleName()).warmupIterations(10).measurementIterations(10).threads(2).forks(1).build();
new Runner(opt).run();
</DeepExtract>
} | bucket4j | positive | 4,076 |
@Test
public void mustIdentifyAssignabilityToArraysOfLesserDimensions() {
boolean expected = Number[][].class.isAssignableFrom(Integer[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Number[][].class), Type.getType(Integer[][][].class));
assertEquals(expected, actual);
boolean expected = Integer[][].class.isAssignableFrom(Number[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Integer[][].class), Type.getType(Number[][][].class));
assertEquals(expected, actual);
boolean expected = Integer[][].class.isAssignableFrom(Number[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Integer[][].class), Type.getType(Number[][][].class));
assertEquals(expected, actual);
boolean expected = int[][].class.isAssignableFrom(int[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(int[][].class), Type.getType(int[][][].class));
assertEquals(expected, actual);
boolean expected = Object[][].class.isAssignableFrom(Integer[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Object[][].class), Type.getType(Integer[][][].class));
assertEquals(expected, actual);
boolean expected = Object[][].class.isAssignableFrom(Number[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Object[][].class), Type.getType(Number[][][].class));
assertEquals(expected, actual);
} | @Test
public void mustIdentifyAssignabilityToArraysOfLesserDimensions() {
boolean expected = Number[][].class.isAssignableFrom(Integer[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Number[][].class), Type.getType(Integer[][][].class));
assertEquals(expected, actual);
boolean expected = Integer[][].class.isAssignableFrom(Number[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Integer[][].class), Type.getType(Number[][][].class));
assertEquals(expected, actual);
boolean expected = Integer[][].class.isAssignableFrom(Number[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Integer[][].class), Type.getType(Number[][][].class));
assertEquals(expected, actual);
boolean expected = int[][].class.isAssignableFrom(int[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(int[][].class), Type.getType(int[][][].class));
assertEquals(expected, actual);
boolean expected = Object[][].class.isAssignableFrom(Integer[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Object[][].class), Type.getType(Integer[][][].class));
assertEquals(expected, actual);
<DeepExtract>
boolean expected = Object[][].class.isAssignableFrom(Number[][][].class);
boolean actual = TypeUtils.isAssignableFrom(repo, Type.getType(Object[][].class), Type.getType(Number[][][].class));
assertEquals(expected, actual);
</DeepExtract>
} | coroutines | positive | 4,077 |
@Override
public void run() {
Animation exitAnim = AnimationUtils.loadAnimation(getOwnActivity() == null ? boxRoot.getContext() : getOwnActivity(), exitAnimResId == 0 ? R.anim.anim_dialogx_default_exit : exitAnimResId);
long exitAnimDuration = getExitAnimationDuration(exitAnim);
exitAnim.setDuration(exitAnimDuration);
exitAnim.setFillAfter(true);
boxBody.startAnimation(exitAnim);
boxRoot.animate().alpha(0f).setInterpolator(new AccelerateInterpolator()).setDuration(exitAnimDuration);
runOnMainDelay(new Runnable() {
@Override
public void run() {
waitForDismiss();
}
}, getExitAnimationDuration(null));
} | @Override
public void run() {
<DeepExtract>
Animation exitAnim = AnimationUtils.loadAnimation(getOwnActivity() == null ? boxRoot.getContext() : getOwnActivity(), exitAnimResId == 0 ? R.anim.anim_dialogx_default_exit : exitAnimResId);
long exitAnimDuration = getExitAnimationDuration(exitAnim);
exitAnim.setDuration(exitAnimDuration);
exitAnim.setFillAfter(true);
boxBody.startAnimation(exitAnim);
boxRoot.animate().alpha(0f).setInterpolator(new AccelerateInterpolator()).setDuration(exitAnimDuration);
</DeepExtract>
runOnMainDelay(new Runnable() {
@Override
public void run() {
waitForDismiss();
}
}, getExitAnimationDuration(null));
} | DialogX | positive | 4,078 |
public static MyStringValue createMyStringValue(String string) {
MyStringValue val = new MyStringValue();
this.string = string;
return val;
} | public static MyStringValue createMyStringValue(String string) {
MyStringValue val = new MyStringValue();
<DeepExtract>
this.string = string;
</DeepExtract>
return val;
} | qson | positive | 4,079 |
@Override
public void onDestroy() {
if (useEventBus())
EventBus.getDefault().unregister(this);
if (mCompositeSubscription != null) {
mCompositeSubscription.unsubscribe();
}
this.mCompositeSubscription = null;
} | @Override
public void onDestroy() {
if (useEventBus())
EventBus.getDefault().unregister(this);
<DeepExtract>
if (mCompositeSubscription != null) {
mCompositeSubscription.unsubscribe();
}
</DeepExtract>
this.mCompositeSubscription = null;
} | MVPArt | positive | 4,081 |
public void setRange(@NonNull String key, String value, long offset) {
ArgumentAssert.notEmpty(key, KEY_NOT_NULL);
boolean cacheNullVal = offset.length > 0 ? offset[0] : defaultCacheNullVal;
if (!cacheNullVal && value == null) {
return;
}
valueOps.set(key, value == null ? newNullVal() : value);
} | public void setRange(@NonNull String key, String value, long offset) {
<DeepExtract>
ArgumentAssert.notEmpty(key, KEY_NOT_NULL);
boolean cacheNullVal = offset.length > 0 ? offset[0] : defaultCacheNullVal;
if (!cacheNullVal && value == null) {
return;
}
valueOps.set(key, value == null ? newNullVal() : value);
</DeepExtract>
} | sparkzxl-component | positive | 4,082 |
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
int size = memoizedSerializedSize;
if (size != -1)
return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getIdBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getSignBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getLabelBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(4, getTitleBytes());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, summary_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(6, getLinkBytes());
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(7, getExtendedLinkBytes());
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(10, getAuthorBytes());
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(11, getPublishDateBytes());
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
size += com.google.protobuf.CodedOutputStream.computeUInt64Size(12, tsUpdate_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getIdBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getSignBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, getLabelBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeBytes(4, getTitleBytes());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeMessage(5, summary_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeBytes(6, getLinkBytes());
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeBytes(7, getExtendedLinkBytes());
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeBytes(10, getAuthorBytes());
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
output.writeBytes(11, getPublishDateBytes());
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
output.writeUInt64(12, tsUpdate_);
}
getUnknownFields().writeTo(output);
} | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
<DeepExtract>
int size = memoizedSerializedSize;
if (size != -1)
return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getIdBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getSignBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getLabelBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(4, getTitleBytes());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, summary_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(6, getLinkBytes());
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(7, getExtendedLinkBytes());
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(10, getAuthorBytes());
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
size += com.google.protobuf.CodedOutputStream.computeBytesSize(11, getPublishDateBytes());
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
size += com.google.protobuf.CodedOutputStream.computeUInt64Size(12, tsUpdate_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
</DeepExtract>
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getIdBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getSignBytes());
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, getLabelBytes());
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeBytes(4, getTitleBytes());
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeMessage(5, summary_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeBytes(6, getLinkBytes());
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeBytes(7, getExtendedLinkBytes());
}
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeBytes(10, getAuthorBytes());
}
if (((bitField0_ & 0x00000100) == 0x00000100)) {
output.writeBytes(11, getPublishDateBytes());
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
output.writeUInt64(12, tsUpdate_);
}
getUnknownFields().writeTo(output);
} | xpath_proto_builder | positive | 4,083 |
public boolean remove(Object o) {
if (o == null)
return false;
int mask = elements.length - 1;
int i = head;
E x;
while ((x = elements[i]) != null) {
if (o.equals(x)) {
delete(i);
return true;
}
i = (i + 1) & mask;
}
return false;
} | public boolean remove(Object o) {
<DeepExtract>
if (o == null)
return false;
int mask = elements.length - 1;
int i = head;
E x;
while ((x = elements[i]) != null) {
if (o.equals(x)) {
delete(i);
return true;
}
i = (i + 1) & mask;
}
return false;
</DeepExtract>
} | tvframe | positive | 4,084 |
@Override
public void onNext(@NonNull Map<String, List<Double>> logs) {
OpenLoopFuelingCorrectionViewModel.this.afrLogMap = logs;
if (me7LogMap != null && afrLogMap != null && mlhfmMap != null) {
OpenLoopMlhfmCorrectionManager openLoopMlhfmCorrectionManager = new OpenLoopMlhfmCorrectionManager(OpenLoopFuelingLogFilterPreferences.getMinThrottleAnglePreference(), OpenLoopFuelingLogFilterPreferences.getMinRpmPreference(), OpenLoopFuelingLogFilterPreferences.getMinMe7PointsPreference(), OpenLoopFuelingLogFilterPreferences.getMinAfrPointsPreference(), OpenLoopFuelingLogFilterPreferences.getMaxAfrPreference());
openLoopMlhfmCorrectionManager.correct(me7LogMap, afrLogMap, mlhfmMap);
OpenLoopMlhfmCorrection openLoopMlhfmCorrection = openLoopMlhfmCorrectionManager.getOpenLoopCorrection();
if (openLoopMlhfmCorrection != null) {
publishSubject.onNext(openLoopMlhfmCorrection);
}
}
} | @Override
public void onNext(@NonNull Map<String, List<Double>> logs) {
OpenLoopFuelingCorrectionViewModel.this.afrLogMap = logs;
<DeepExtract>
if (me7LogMap != null && afrLogMap != null && mlhfmMap != null) {
OpenLoopMlhfmCorrectionManager openLoopMlhfmCorrectionManager = new OpenLoopMlhfmCorrectionManager(OpenLoopFuelingLogFilterPreferences.getMinThrottleAnglePreference(), OpenLoopFuelingLogFilterPreferences.getMinRpmPreference(), OpenLoopFuelingLogFilterPreferences.getMinMe7PointsPreference(), OpenLoopFuelingLogFilterPreferences.getMinAfrPointsPreference(), OpenLoopFuelingLogFilterPreferences.getMaxAfrPreference());
openLoopMlhfmCorrectionManager.correct(me7LogMap, afrLogMap, mlhfmMap);
OpenLoopMlhfmCorrection openLoopMlhfmCorrection = openLoopMlhfmCorrectionManager.getOpenLoopCorrection();
if (openLoopMlhfmCorrection != null) {
publishSubject.onNext(openLoopMlhfmCorrection);
}
}
</DeepExtract>
} | ME7Tuner | positive | 4,085 |
public void cleanData() {
mData = null;
super.notifyDataSetChanged();
if (mDataChangeListener != null) {
mDataChangeListener.onAdapterDataChange();
}
} | public void cleanData() {
mData = null;
<DeepExtract>
super.notifyDataSetChanged();
if (mDataChangeListener != null) {
mDataChangeListener.onAdapterDataChange();
}
</DeepExtract>
} | AZList | positive | 4,086 |
public Criteria andUuidIsNull() {
if ("uuid is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("uuid is null"));
return (Criteria) this;
} | public Criteria andUuidIsNull() {
<DeepExtract>
if ("uuid is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("uuid is null"));
</DeepExtract>
return (Criteria) this;
} | lightconf | positive | 4,088 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher("/profile.jsp").forward(request, response);
System.out.println("Redirected to profile.jsp");
} | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
<DeepExtract>
request.getRequestDispatcher("/profile.jsp").forward(request, response);
System.out.println("Redirected to profile.jsp");
</DeepExtract>
} | javaee8-cookbook | positive | 4,089 |
public void writeToRemotePath(final String content, final String path) throws SftpException, IOException, SftpUtilException {
LogUtil.entering();
if (sftpChannel == null || !sftpChannel.isConnected()) {
connect();
}
LogUtil.exiting();
try (final InputStream is = IOUtils.toInputStream(content, StandardCharsets.UTF_8)) {
sftpChannel.put(is, path);
}
} | public void writeToRemotePath(final String content, final String path) throws SftpException, IOException, SftpUtilException {
<DeepExtract>
LogUtil.entering();
if (sftpChannel == null || !sftpChannel.isConnected()) {
connect();
}
LogUtil.exiting();
</DeepExtract>
try (final InputStream is = IOUtils.toInputStream(content, StandardCharsets.UTF_8)) {
sftpChannel.put(is, path);
}
} | MergeProcessor | positive | 4,090 |
@Override
public String[] getHeaders(String key) {
if (state >= STATE_REQUEST_HEADERS_LOADED)
return;
loadRequestLine();
RequestHeaderLoader loader = new RequestHeaderLoader();
feeder.feedTo(loader);
requestHeaders = loader.getCompactMap();
state = STATE_REQUEST_HEADERS_LOADED;
return requestHeaders.get(key.toUpperCase());
} | @Override
public String[] getHeaders(String key) {
<DeepExtract>
if (state >= STATE_REQUEST_HEADERS_LOADED)
return;
loadRequestLine();
RequestHeaderLoader loader = new RequestHeaderLoader();
feeder.feedTo(loader);
requestHeaders = loader.getCompactMap();
state = STATE_REQUEST_HEADERS_LOADED;
</DeepExtract>
return requestHeaders.get(key.toUpperCase());
} | stream-m | positive | 4,091 |
private Object doDownload(CloseableHttpResponse response, String downloadDir, String fileName, String... ignoreContentTypes) {
if (response == null || response.getEntity() == null) {
return null;
}
if (!validateContent(response, ignoreContentTypes)) {
try {
return EntityUtils.toString(response.getEntity());
} catch (ParseException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
} catch (IOException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
}
}
File dir = new File(downloadDir);
if (!dir.exists()) {
dir.mkdirs();
}
if (fileName == null) {
fileName = resolveFileName(response);
}
if (fileName == null) {
Random random = new Random();
fileName = String.format("download_%s_%s", System.currentTimeMillis(), random.nextInt(1000));
}
return fileName;
File file = new File(downloadDir + File.separator + fileName);
InputStream is = null;
FileOutputStream fos = null;
try {
is = response.getEntity().getContent();
fos = new FileOutputStream(file);
byte[] buffer = new byte[1024];
int len = 0;
while ((len = is.read(buffer, 0, 1024)) != -1) {
fos.write(buffer, 0, len);
}
fos.flush();
} catch (FileNotFoundException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
} catch (IOException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
}
}
}
return file;
} | private Object doDownload(CloseableHttpResponse response, String downloadDir, String fileName, String... ignoreContentTypes) {
if (response == null || response.getEntity() == null) {
return null;
}
if (!validateContent(response, ignoreContentTypes)) {
try {
return EntityUtils.toString(response.getEntity());
} catch (ParseException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
} catch (IOException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
}
}
File dir = new File(downloadDir);
if (!dir.exists()) {
dir.mkdirs();
}
<DeepExtract>
if (fileName == null) {
fileName = resolveFileName(response);
}
if (fileName == null) {
Random random = new Random();
fileName = String.format("download_%s_%s", System.currentTimeMillis(), random.nextInt(1000));
}
return fileName;
</DeepExtract>
File file = new File(downloadDir + File.separator + fileName);
InputStream is = null;
FileOutputStream fos = null;
try {
is = response.getEntity().getContent();
fos = new FileOutputStream(file);
byte[] buffer = new byte[1024];
int len = 0;
while ((len = is.read(buffer, 0, 1024)) != -1) {
fos.write(buffer, 0, len);
}
fos.flush();
} catch (FileNotFoundException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
} catch (IOException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
logger.error(ExceptionUtil.getExceptionDetails(e));
}
}
}
return file;
} | wechatty-project | positive | 4,092 |
@Test
public void testCase4() {
danny = new Student();
danny.setName("Danny");
danny.setAge(14);
mick = new Student();
mick.setName("Mick");
mick.setAge(13);
cam = new Teacher();
cam.setTeacherName("Cam");
cam.setAge(33);
cam.setSex(true);
cam.setTeachYears(5);
jack = new Teacher();
jack.setTeacherName("Jack");
jack.setAge(36);
jack.setSex(false);
jack.setTeachYears(11);
if (Math.random() >= 0.5) {
danny.getTeachers().add(jack);
danny.getTeachers().add(cam);
mick.getTeachers().add(jack);
mick.getTeachers().add(cam);
} else {
cam.getStudents().add(danny);
cam.getStudents().add(mick);
jack.getStudents().add(danny);
jack.getStudents().add(mick);
}
List<LitePalSupport> modelList = getModelList();
while (!modelList.isEmpty()) {
Random rand = new Random();
int index = rand.nextInt(modelList.size());
LitePalSupport model = modelList.remove(index);
model.save();
}
assertTrue(isDataExists(getTableName(danny), danny.getId()));
assertTrue(isDataExists(getTableName(mick), mick.getId()));
assertTrue(isDataExists(getTableName(cam), cam.getId()));
assertTrue(isDataExists(getTableName(jack), jack.getId()));
assertM2M(getTableName(danny), getTableName(cam), danny.getId(), cam.getId());
assertM2M(getTableName(danny), getTableName(jack), danny.getId(), jack.getId());
assertM2M(getTableName(mick), getTableName(cam), mick.getId(), cam.getId());
assertM2M(getTableName(mick), getTableName(jack), mick.getId(), jack.getId());
} | @Test
public void testCase4() {
danny = new Student();
danny.setName("Danny");
danny.setAge(14);
mick = new Student();
mick.setName("Mick");
mick.setAge(13);
cam = new Teacher();
cam.setTeacherName("Cam");
cam.setAge(33);
cam.setSex(true);
cam.setTeachYears(5);
jack = new Teacher();
jack.setTeacherName("Jack");
jack.setAge(36);
jack.setSex(false);
jack.setTeachYears(11);
if (Math.random() >= 0.5) {
danny.getTeachers().add(jack);
danny.getTeachers().add(cam);
mick.getTeachers().add(jack);
mick.getTeachers().add(cam);
} else {
cam.getStudents().add(danny);
cam.getStudents().add(mick);
jack.getStudents().add(danny);
jack.getStudents().add(mick);
}
<DeepExtract>
List<LitePalSupport> modelList = getModelList();
while (!modelList.isEmpty()) {
Random rand = new Random();
int index = rand.nextInt(modelList.size());
LitePalSupport model = modelList.remove(index);
model.save();
}
</DeepExtract>
assertTrue(isDataExists(getTableName(danny), danny.getId()));
assertTrue(isDataExists(getTableName(mick), mick.getId()));
assertTrue(isDataExists(getTableName(cam), cam.getId()));
assertTrue(isDataExists(getTableName(jack), jack.getId()));
assertM2M(getTableName(danny), getTableName(cam), danny.getId(), cam.getId());
assertM2M(getTableName(danny), getTableName(jack), danny.getId(), jack.getId());
assertM2M(getTableName(mick), getTableName(cam), mick.getId(), cam.getId());
assertM2M(getTableName(mick), getTableName(jack), mick.getId(), jack.getId());
} | LitePal | positive | 4,093 |
@Override
public int turn(final Turn turn, final int state) {
return move1.turn(turn, state / stateSize2) * stateSize2 + move2.turn(turn, state % stateSize2);
} | @Override
public int turn(final Turn turn, final int state) {
<DeepExtract>
return move1.turn(turn, state / stateSize2) * stateSize2 + move2.turn(turn, state % stateSize2);
</DeepExtract>
} | acube | positive | 4,094 |
public static UUID from32(byte[] data, int offset, boolean littleEndian) {
if (data == null || offset < 0 || data.length <= (offset + 3) || (Integer.MAX_VALUE - 3) < offset) {
return null;
}
if (littleEndian) {
v0 = data[offset + 3] & 0xFF;
v1 = data[offset + 2] & 0xFF;
v2 = data[offset + 1] & 0xFF;
v3 = data[offset + 0] & 0xFF;
} else {
v0 = data[offset + 0] & 0xFF;
v1 = data[offset + 1] & 0xFF;
v2 = data[offset + 2] & 0xFF;
v3 = data[offset + 3] & 0xFF;
}
return UUID.fromString(String.format(BASE_UUID_FORMAT, v0, v1, v2, v3));
} | public static UUID from32(byte[] data, int offset, boolean littleEndian) {
if (data == null || offset < 0 || data.length <= (offset + 3) || (Integer.MAX_VALUE - 3) < offset) {
return null;
}
if (littleEndian) {
v0 = data[offset + 3] & 0xFF;
v1 = data[offset + 2] & 0xFF;
v2 = data[offset + 1] & 0xFF;
v3 = data[offset + 0] & 0xFF;
} else {
v0 = data[offset + 0] & 0xFF;
v1 = data[offset + 1] & 0xFF;
v2 = data[offset + 2] & 0xFF;
v3 = data[offset + 3] & 0xFF;
}
<DeepExtract>
return UUID.fromString(String.format(BASE_UUID_FORMAT, v0, v1, v2, v3));
</DeepExtract>
} | beacon-simulator-android | positive | 4,095 |
static int compareTo(Object tree1, Object tree2) {
if (tree1 == tree2)
return 0;
int size1;
if (tree1 == null)
size1 = 0;
else if (!(tree1 instanceof Node))
size1 = ((Object[]) tree1).length >> 1;
else
size1 = ((Node) tree1).size;
int size2;
if (tree2 == null)
size2 = 0;
else if (!(tree2 instanceof Node))
size2 = ((Object[]) tree2).length >> 1;
else
size2 = ((Node) tree2).size;
if (size1 < size2)
return -1;
else if (size1 > size2)
return 1;
else
return compareTo(tree1, 0, tree2, 0, 0, size1);
} | static int compareTo(Object tree1, Object tree2) {
if (tree1 == tree2)
return 0;
int size1;
if (tree1 == null)
size1 = 0;
else if (!(tree1 instanceof Node))
size1 = ((Object[]) tree1).length >> 1;
else
size1 = ((Node) tree1).size;
<DeepExtract>
int size2;
if (tree2 == null)
size2 = 0;
else if (!(tree2 instanceof Node))
size2 = ((Object[]) tree2).length >> 1;
else
size2 = ((Node) tree2).size;
</DeepExtract>
if (size1 < size2)
return -1;
else if (size1 > size2)
return 1;
else
return compareTo(tree1, 0, tree2, 0, 0, size1);
} | fset-java | positive | 4,096 |
private void addAutomation(String imagePath, String type, int[] keyCodes, String trigger, String focusedProgram, long minDelay, long timeout, String midiSignature, float scanRate, boolean isMovable) {
Vector<Object> rowData = new Vector<Object>();
rowData.add(getColumn(COLNAME_IMAGE).getModelIndex(), initScreenshotIcon(imagePath));
rowData.add(getColumn(COLNAME_TYPE).getModelIndex(), initType(type));
rowData.add(getColumn(COLNAME_KEYS).getModelIndex(), initKeys(keyCodes));
rowData.add(getColumn(COLNAME_TRIGGER).getModelIndex(), initTrigger(trigger));
rowData.add(getColumn(COLNAME_FOCUS).getModelIndex(), initFocusedProgram(focusedProgram));
rowData.add(getColumn(COLNAME_MIN_DELAY).getModelIndex(), minDelay);
rowData.add(getColumn(COLNAME_TIMEOUT).getModelIndex(), timeout);
rowData.add(getColumn(COLNAME_MIDI_SIGNATURE).getModelIndex(), initMidiMessage(midiSignature));
rowData.add(getColumn(COLNAME_SCAN_RATE).getModelIndex(), scanRate);
rowData.add(getColumn(COLNAME_MOVABLE).getModelIndex(), isMovable);
JTableComboBoxEditor cellEditor = (JTableComboBoxEditor) getCellEditor(tableModel.getRowCount() - 1, getColumn(COLNAME_TRIGGER).getModelIndex());
@SuppressWarnings("unchecked")
JComboBox<String> triggerEditorComboBox = (JComboBox<String>) cellEditor.getComponent();
triggerEditorComboBox.setName(NAME_COMBOBOX_TRIGGER_EDITOR + "_" + (tableModel.getRowCount() - 1));
tableModel.addRow(rowData);
} | private void addAutomation(String imagePath, String type, int[] keyCodes, String trigger, String focusedProgram, long minDelay, long timeout, String midiSignature, float scanRate, boolean isMovable) {
Vector<Object> rowData = new Vector<Object>();
rowData.add(getColumn(COLNAME_IMAGE).getModelIndex(), initScreenshotIcon(imagePath));
rowData.add(getColumn(COLNAME_TYPE).getModelIndex(), initType(type));
rowData.add(getColumn(COLNAME_KEYS).getModelIndex(), initKeys(keyCodes));
rowData.add(getColumn(COLNAME_TRIGGER).getModelIndex(), initTrigger(trigger));
rowData.add(getColumn(COLNAME_FOCUS).getModelIndex(), initFocusedProgram(focusedProgram));
rowData.add(getColumn(COLNAME_MIN_DELAY).getModelIndex(), minDelay);
rowData.add(getColumn(COLNAME_TIMEOUT).getModelIndex(), timeout);
rowData.add(getColumn(COLNAME_MIDI_SIGNATURE).getModelIndex(), initMidiMessage(midiSignature));
rowData.add(getColumn(COLNAME_SCAN_RATE).getModelIndex(), scanRate);
rowData.add(getColumn(COLNAME_MOVABLE).getModelIndex(), isMovable);
<DeepExtract>
JTableComboBoxEditor cellEditor = (JTableComboBoxEditor) getCellEditor(tableModel.getRowCount() - 1, getColumn(COLNAME_TRIGGER).getModelIndex());
@SuppressWarnings("unchecked")
JComboBox<String> triggerEditorComboBox = (JComboBox<String>) cellEditor.getComponent();
triggerEditorComboBox.setName(NAME_COMBOBOX_TRIGGER_EDITOR + "_" + (tableModel.getRowCount() - 1));
</DeepExtract>
tableModel.addRow(rowData);
} | MIDI-Automator | positive | 4,097 |
@Override
public void run(Context context) {
Message message = null;
String name = this.getEventName(context);
URI source = getSource(context);
URI target = this.getTarget(context);
String sendId;
if (this.idLocation != null) {
String result = UUID.randomUUID().toString();
context.updateData(this.idLocation, result);
}
sendId = this.getId(context);
Object body = this.getBody(context);
message = new BasicMessage(sendId, name, source, target, body);
return message;
IOProcessor ioProcessor = context.searchIOProcessor(this.getType(context));
ioProcessor.sendMessageFromFSM(message);
} | @Override
public void run(Context context) {
<DeepExtract>
Message message = null;
String name = this.getEventName(context);
URI source = getSource(context);
URI target = this.getTarget(context);
String sendId;
if (this.idLocation != null) {
String result = UUID.randomUUID().toString();
context.updateData(this.idLocation, result);
}
sendId = this.getId(context);
Object body = this.getBody(context);
message = new BasicMessage(sendId, name, source, target, body);
return message;
</DeepExtract>
IOProcessor ioProcessor = context.searchIOProcessor(this.getType(context));
ioProcessor.sendMessageFromFSM(message);
} | scxml-java | positive | 4,098 |
public static JoinRobustTree LineitemOnTpch19() {
Random rand = new Random();
String stringLineitem = "l_orderkey long, l_partkey int, l_suppkey int, l_linenumber int, l_quantity double, l_extendedprice double, l_discount double, l_tax double, l_returnflag string, l_linestatus string, l_shipdate date, l_commitdate date, l_receiptdate date, l_shipinstruct string, l_shipmode string";
Schema schemaLineitem = Schema.createSchema(stringLineitem);
String brand_19 = "Brand#" + (rand.nextInt(5) + 1) + "" + (rand.nextInt(5) + 1);
String shipInstruct_19 = "DELIVER IN PERSON";
double quantity_19 = rand.nextInt(10) + 1;
Predicate p1_19 = new Predicate(schemaLineitem.getAttributeId("l_shipinstruct"), TypeUtils.TYPE.STRING, shipInstruct_19, Predicate.PREDTYPE.EQ);
Predicate p4_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TypeUtils.TYPE.DOUBLE, quantity_19, Predicate.PREDTYPE.GT);
quantity_19 += 10;
Predicate p5_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TypeUtils.TYPE.DOUBLE, quantity_19, Predicate.PREDTYPE.LEQ);
Predicate p8_19 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TypeUtils.TYPE.STRING, "AIR", Predicate.PREDTYPE.LEQ);
JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), new Predicate[] { p1_19, p4_19, p5_19, p8_19 });
MDIndex.Bucket.maxBucketId = 0;
TableInfo tableInfo = Globals.getTableInfo(lineitem);
JoinRobustTree rt = new JoinRobustTree(tableInfo);
rt.joinAttributeDepth = 0;
rt.setMaxBuckets(lineitemBuckets);
rt.loadSample(lineitemSample);
rt.initProbe(q_l);
return rt;
} | public static JoinRobustTree LineitemOnTpch19() {
Random rand = new Random();
String stringLineitem = "l_orderkey long, l_partkey int, l_suppkey int, l_linenumber int, l_quantity double, l_extendedprice double, l_discount double, l_tax double, l_returnflag string, l_linestatus string, l_shipdate date, l_commitdate date, l_receiptdate date, l_shipinstruct string, l_shipmode string";
Schema schemaLineitem = Schema.createSchema(stringLineitem);
String brand_19 = "Brand#" + (rand.nextInt(5) + 1) + "" + (rand.nextInt(5) + 1);
String shipInstruct_19 = "DELIVER IN PERSON";
double quantity_19 = rand.nextInt(10) + 1;
Predicate p1_19 = new Predicate(schemaLineitem.getAttributeId("l_shipinstruct"), TypeUtils.TYPE.STRING, shipInstruct_19, Predicate.PREDTYPE.EQ);
Predicate p4_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TypeUtils.TYPE.DOUBLE, quantity_19, Predicate.PREDTYPE.GT);
quantity_19 += 10;
Predicate p5_19 = new Predicate(schemaLineitem.getAttributeId("l_quantity"), TypeUtils.TYPE.DOUBLE, quantity_19, Predicate.PREDTYPE.LEQ);
Predicate p8_19 = new Predicate(schemaLineitem.getAttributeId("l_shipmode"), TypeUtils.TYPE.STRING, "AIR", Predicate.PREDTYPE.LEQ);
JoinQuery q_l = new JoinQuery(lineitem, schemaLineitem.getAttributeId("l_partkey"), new Predicate[] { p1_19, p4_19, p5_19, p8_19 });
<DeepExtract>
MDIndex.Bucket.maxBucketId = 0;
TableInfo tableInfo = Globals.getTableInfo(lineitem);
JoinRobustTree rt = new JoinRobustTree(tableInfo);
rt.joinAttributeDepth = 0;
rt.setMaxBuckets(lineitemBuckets);
rt.loadSample(lineitemSample);
rt.initProbe(q_l);
return rt;
</DeepExtract>
} | AdaptDB | positive | 4,099 |
private void updateState(boolean enabled) {
if (enabled) {
ILogViewEditor editor = (ILogViewEditor) getWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(ILogViewEditor.class);
if (editor != null) {
Integer selectedPage = (Integer) editor.getSelectedPage();
updateWidgets(true, selectedPage.intValue(), editor.getPageCount());
} else {
enabled = false;
}
}
if (!enabled) {
updateWidgets(false, 0, 0);
}
boolean updated = false;
for (ToolItem item : toolBar.getItems()) {
if ((item.getControl() != null) && item.getControl().equals(root)) {
int newWidth = computeWidth(root);
if (item.getWidth() != newWidth) {
item.setWidth(newWidth);
updated = true;
}
break;
}
}
if (updated) {
for (CoolItem item : coolBar.getItems()) {
if ((item.getControl() != null) && item.getControl().equals(toolBar)) {
Point pt = item.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
item.setSize(item.computeSize(pt.x, pt.y));
break;
}
}
coolBar.update();
}
} | private void updateState(boolean enabled) {
if (enabled) {
ILogViewEditor editor = (ILogViewEditor) getWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(ILogViewEditor.class);
if (editor != null) {
Integer selectedPage = (Integer) editor.getSelectedPage();
updateWidgets(true, selectedPage.intValue(), editor.getPageCount());
} else {
enabled = false;
}
}
if (!enabled) {
updateWidgets(false, 0, 0);
}
<DeepExtract>
boolean updated = false;
for (ToolItem item : toolBar.getItems()) {
if ((item.getControl() != null) && item.getControl().equals(root)) {
int newWidth = computeWidth(root);
if (item.getWidth() != newWidth) {
item.setWidth(newWidth);
updated = true;
}
break;
}
}
if (updated) {
for (CoolItem item : coolBar.getItems()) {
if ((item.getControl() != null) && item.getControl().equals(toolBar)) {
Point pt = item.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
item.setSize(item.computeSize(pt.x, pt.y));
break;
}
}
coolBar.update();
}
</DeepExtract>
} | logsaw-app | positive | 4,100 |
@Override
public byte[] createClosingMessage(ECKey receiverECKey, Address senderAddress, BigInteger openBlockNum, BigInteger owedBalance) {
byte[] closingMsgHash = createClosingMsgHashRaw(senderAddress, openBlockNum, owedBalance, channelManagerAddr);
return receiverECKey.sign(closingMsgHash).toByteArray();
} | @Override
public byte[] createClosingMessage(ECKey receiverECKey, Address senderAddress, BigInteger openBlockNum, BigInteger owedBalance) {
<DeepExtract>
byte[] closingMsgHash = createClosingMsgHashRaw(senderAddress, openBlockNum, owedBalance, channelManagerAddr);
return receiverECKey.sign(closingMsgHash).toByteArray();
</DeepExtract>
} | asf-sdk | positive | 4,101 |
public List<ParsingElement> load(boolean reload) {
if (isLoaded() && !reload) {
return getParsingElements();
}
Map<String, Object> map = configLoader.readConfiguration();
if (map.containsKey(PARAMS)) {
Object value = map.get(PARAMS);
boolean isInstanceOfMap = value instanceof Map<?, ?>;
if (isInstanceOfMap) {
getParams().putAll((Map<String, Object>) value);
}
}
MapWrapper mainMap = new MapWrapper(map, null);
if (mainMap.isExist(EXTENDS)) {
if (mainMap.isList(EXTENDS)) {
List<Object> list = mainMap.toList(EXTENDS);
for (Object row : list) {
if (row == null) {
continue;
}
String path = row.toString().trim();
extendsToExternalConfig(mainMap, path);
}
} else {
String value = mainMap.toString(EXTENDS, true).trim();
extendsToExternalConfig(mainMap, value);
}
}
mainMap.getField(RESULT, true);
if (map.containsKey(PARAMS)) {
Object value = map.get(PARAMS);
boolean isInstanceOfMap = value instanceof Map<?, ?>;
if (isInstanceOfMap) {
getParams().putAll((Map<String, Object>) value);
}
}
if (map.containsKey(FUNCTIONS)) {
Object value = map.get(FUNCTIONS);
boolean isInstanceOfMap = value instanceof Map<?, ?>;
if (isInstanceOfMap) {
functionContext.merge((Map<String, String>) value);
}
}
if (map.containsKey(FRAGMENTS)) {
MapUtils.mergeMap(getDefinitions(), (Map<String, Object>) map.get(FRAGMENTS));
}
if (map.containsKey(TRANSFORMATIONS)) {
Object value = map.get(TRANSFORMATIONS);
boolean isInstanceOfMap = value instanceof Map<?, ?>;
if (isInstanceOfMap) {
fillTransformations((Map<String, Object>) value);
}
}
if (map.containsKey(RESULT)) {
Object value = map.get(RESULT);
if (value instanceof Map) {
buildParsingElementTree(value, RESULT, null, 0);
} else if (value instanceof List) {
int i = 0;
List<Object> list = (List<Object>) value;
for (Object o : list) {
buildParsingElementTree(o, RESULT, null, i++);
}
}
}
isLoaded = true;
return parsingElements;
} | public List<ParsingElement> load(boolean reload) {
if (isLoaded() && !reload) {
return getParsingElements();
}
Map<String, Object> map = configLoader.readConfiguration();
if (map.containsKey(PARAMS)) {
Object value = map.get(PARAMS);
boolean isInstanceOfMap = value instanceof Map<?, ?>;
if (isInstanceOfMap) {
getParams().putAll((Map<String, Object>) value);
}
}
MapWrapper mainMap = new MapWrapper(map, null);
if (mainMap.isExist(EXTENDS)) {
if (mainMap.isList(EXTENDS)) {
List<Object> list = mainMap.toList(EXTENDS);
for (Object row : list) {
if (row == null) {
continue;
}
String path = row.toString().trim();
extendsToExternalConfig(mainMap, path);
}
} else {
String value = mainMap.toString(EXTENDS, true).trim();
extendsToExternalConfig(mainMap, value);
}
}
mainMap.getField(RESULT, true);
if (map.containsKey(PARAMS)) {
Object value = map.get(PARAMS);
boolean isInstanceOfMap = value instanceof Map<?, ?>;
if (isInstanceOfMap) {
getParams().putAll((Map<String, Object>) value);
}
}
if (map.containsKey(FUNCTIONS)) {
Object value = map.get(FUNCTIONS);
boolean isInstanceOfMap = value instanceof Map<?, ?>;
if (isInstanceOfMap) {
functionContext.merge((Map<String, String>) value);
}
}
if (map.containsKey(FRAGMENTS)) {
MapUtils.mergeMap(getDefinitions(), (Map<String, Object>) map.get(FRAGMENTS));
}
if (map.containsKey(TRANSFORMATIONS)) {
Object value = map.get(TRANSFORMATIONS);
boolean isInstanceOfMap = value instanceof Map<?, ?>;
if (isInstanceOfMap) {
fillTransformations((Map<String, Object>) value);
}
}
if (map.containsKey(RESULT)) {
Object value = map.get(RESULT);
if (value instanceof Map) {
buildParsingElementTree(value, RESULT, null, 0);
} else if (value instanceof List) {
int i = 0;
List<Object> list = (List<Object>) value;
for (Object o : list) {
buildParsingElementTree(o, RESULT, null, i++);
}
}
}
isLoaded = true;
<DeepExtract>
return parsingElements;
</DeepExtract>
} | dsm | positive | 4,102 |
public final void destroy() {
mIsInitialized = false;
GLES20.glDeleteProgram(mGLProgId);
} | public final void destroy() {
<DeepExtract>
</DeepExtract>
mIsInitialized = false;
<DeepExtract>
</DeepExtract>
GLES20.glDeleteProgram(mGLProgId);
<DeepExtract>
</DeepExtract>
} | PhotoEditDemo | positive | 4,104 |
@Test
public void testTextChange_onIncorrectInsertion() {
textChangeListener.onTextChanged("1--3--", anyInt, anyInt, anyInt);
final InOrder inOrder = inOrder(editText);
inOrder.verify(editText).removeTextChangedListener(textChangeListener);
inOrder.verify(editText).setText("13----");
inOrder.verify(editText).setSelection(2);
inOrder.verify(editText).addTextChangedListener(textChangeListener);
if (false) {
verify(contentChangeCallback).whileComplete();
} else {
verify(contentChangeCallback).whileIncomplete();
}
} | @Test
public void testTextChange_onIncorrectInsertion() {
textChangeListener.onTextChanged("1--3--", anyInt, anyInt, anyInt);
<DeepExtract>
final InOrder inOrder = inOrder(editText);
inOrder.verify(editText).removeTextChangedListener(textChangeListener);
inOrder.verify(editText).setText("13----");
inOrder.verify(editText).setSelection(2);
inOrder.verify(editText).addTextChangedListener(textChangeListener);
if (false) {
verify(contentChangeCallback).whileComplete();
} else {
verify(contentChangeCallback).whileIncomplete();
}
</DeepExtract>
} | def-guide-to-firebase | positive | 4,105 |
private void testInitialSetup() {
System.out.println("running testInitialSetup()");
selectTab(0);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.All.getTagName()));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.All.getTagName())));
selectTab(1);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.NotGrouped.getTagName()));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.Archive.getTagName())));
selectTab(5);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.Archive.getTagName()));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.Archive.getTagName())));
selectTab(2);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test1"));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test1")));
selectTab(3);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test2"));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test2")));
selectTab(4);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test3"));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test3")));
} | private void testInitialSetup() {
System.out.println("running testInitialSetup()");
selectTab(0);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.All.getTagName()));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.All.getTagName())));
selectTab(1);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.NotGrouped.getTagName()));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.Archive.getTagName())));
selectTab(5);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith(TagManager.ReservedTag.Archive.getTagName()));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup(TagManager.ReservedTag.Archive.getTagName())));
selectTab(2);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test1"));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test1")));
selectTab(3);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test2"));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test2")));
<DeepExtract>
selectTab(4);
assertTrue("Check tab name", ((Label) groupsPaneFXML.getSelectionModel().getSelectedItem().getGraphic()).getText().startsWith("Test3"));
assertTrue("Check notes count", (notesTableFXML.getItems().size() == myTestdata.getNotesCountForGroup("Test3")));
</DeepExtract>
} | ownNoteEditor | positive | 4,106 |
public static void varIntList(long[] values, ByteBuffer buffer) {
varInt(values.length, buffer, null);
for (long value : values) {
varInt(value, buffer);
}
} | public static void varIntList(long[] values, ByteBuffer buffer) {
<DeepExtract>
varInt(values.length, buffer, null);
</DeepExtract>
for (long value : values) {
varInt(value, buffer);
}
} | Jabit | positive | 4,107 |
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int width = widthMode == MeasureSpec.EXACTLY ? widthSize : getSuggestedMinimumWidth();
if (!showLabels)
return;
int twoDp = getContext().getResources().getDimensionPixelSize(R.dimen.stpi_two_dp);
int gridWidth = width / stepCount - twoDp;
if (gridWidth <= 0)
return;
labelLayouts = new StaticLayout[labels.length];
maxLabelHeight = 0F;
float labelSingleLineHeight = labelPaint.descent() - labelPaint.ascent();
for (int i = 0; i < labels.length; i++) {
if (labels[i] == null)
continue;
labelLayouts[i] = new StaticLayout(labels[i], labelPaint, gridWidth, Layout.Alignment.ALIGN_NORMAL, 1, 0, false);
maxLabelHeight = Math.max(maxLabelHeight, labelLayouts[i].getLineCount() * labelSingleLineHeight);
}
int desiredHeight = (int) Math.ceil((circleRadius * EXPAND_MARK * 2) + circlePaint.getStrokeWidth() + getBottomIndicatorHeight() + getMaxLabelHeight());
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int height = heightMode == MeasureSpec.EXACTLY ? heightSize : desiredHeight;
setMeasuredDimension(width, height);
} | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int width = widthMode == MeasureSpec.EXACTLY ? widthSize : getSuggestedMinimumWidth();
<DeepExtract>
if (!showLabels)
return;
int twoDp = getContext().getResources().getDimensionPixelSize(R.dimen.stpi_two_dp);
int gridWidth = width / stepCount - twoDp;
if (gridWidth <= 0)
return;
labelLayouts = new StaticLayout[labels.length];
maxLabelHeight = 0F;
float labelSingleLineHeight = labelPaint.descent() - labelPaint.ascent();
for (int i = 0; i < labels.length; i++) {
if (labels[i] == null)
continue;
labelLayouts[i] = new StaticLayout(labels[i], labelPaint, gridWidth, Layout.Alignment.ALIGN_NORMAL, 1, 0, false);
maxLabelHeight = Math.max(maxLabelHeight, labelLayouts[i].getLineCount() * labelSingleLineHeight);
}
</DeepExtract>
int desiredHeight = (int) Math.ceil((circleRadius * EXPAND_MARK * 2) + circlePaint.getStrokeWidth() + getBottomIndicatorHeight() + getMaxLabelHeight());
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int height = heightMode == MeasureSpec.EXACTLY ? heightSize : desiredHeight;
setMeasuredDimension(width, height);
} | Android-Example | positive | 4,108 |
static Optional<ModuleSourceLayout> lookupForJdkLayout(Path root) {
Objects.requireNonNull(root);
if (!exists(root) || !exists(root.resolve("src"))) {
return Optional.empty();
}
return Objects.requireNonNull(JDK_LAYOUT);
} | static Optional<ModuleSourceLayout> lookupForJdkLayout(Path root) {
Objects.requireNonNull(root);
if (!exists(root) || !exists(root.resolve("src"))) {
return Optional.empty();
}
<DeepExtract>
return Objects.requireNonNull(JDK_LAYOUT);
</DeepExtract>
} | pro | positive | 4,109 |
@Override
public Matrix subi(final Matrix matrix) {
if (!(matrix instanceof MatrixJBLASImpl)) {
throw new IllegalArgumentException("The given matrix should be JBLAS based");
}
jblasMatrix.subi(((MatrixJBLASImpl) matrix).jblasMatrix);
return this;
} | @Override
public Matrix subi(final Matrix matrix) {
<DeepExtract>
if (!(matrix instanceof MatrixJBLASImpl)) {
throw new IllegalArgumentException("The given matrix should be JBLAS based");
}
</DeepExtract>
jblasMatrix.subi(((MatrixJBLASImpl) matrix).jblasMatrix);
return this;
} | dolphin | positive | 4,110 |
public void goToChapter() {
getReflowChapterScreen().setTask(getGoToChapterTask());
Display display = getDisplay();
if (null == null) {
display.setCurrent(getReflowChapterScreen());
} else {
display.setCurrent(null, getReflowChapterScreen());
}
} | public void goToChapter() {
getReflowChapterScreen().setTask(getGoToChapterTask());
<DeepExtract>
Display display = getDisplay();
if (null == null) {
display.setCurrent(getReflowChapterScreen());
} else {
display.setCurrent(null, getReflowChapterScreen());
}
</DeepExtract>
} | AlbiteREADER | positive | 4,111 |
public static int runPipeline(String tablename, String deviceID, String friendlyName) throws Exception {
Job job = SKJobFactory.createJob(deviceID, friendlyName, JobNames.TIKA_TEXT_EXTRACTION);
job.setJarByClass(FSEntryTikaTextExtractor.class);
job.setMapperClass(TikaTextExtractorMapper.class);
job.setNumReduceTasks(0);
job.setOutputKeyClass(ImmutableHexWritable.class);
job.setOutputValueClass(FsEntry.class);
job.setInputFormatClass(FsEntryHBaseInputFormat.class);
job.setOutputFormatClass(FsEntryHBaseOutputFormat.class);
FsEntryHBaseInputFormat.setupJob(job, deviceID);
System.out.println("Spinning off TextExtraction Job...");
job.waitForCompletion(true);
return 0;
} | public static int runPipeline(String tablename, String deviceID, String friendlyName) throws Exception {
<DeepExtract>
Job job = SKJobFactory.createJob(deviceID, friendlyName, JobNames.TIKA_TEXT_EXTRACTION);
job.setJarByClass(FSEntryTikaTextExtractor.class);
job.setMapperClass(TikaTextExtractorMapper.class);
job.setNumReduceTasks(0);
job.setOutputKeyClass(ImmutableHexWritable.class);
job.setOutputValueClass(FsEntry.class);
job.setInputFormatClass(FsEntryHBaseInputFormat.class);
job.setOutputFormatClass(FsEntryHBaseOutputFormat.class);
FsEntryHBaseInputFormat.setupJob(job, deviceID);
System.out.println("Spinning off TextExtraction Job...");
job.waitForCompletion(true);
</DeepExtract>
return 0;
} | sleuthkit-hadoop | positive | 4,112 |
@Override
public void onSuccess(PeriodSolution result) {
solution.setKey(result.getKey());
solution.setModified(result.getModified());
solution.setModifiedPretty(result.getModifiedPretty());
PeriodSolution[] array = ctx.getState().getPeriodSolutions();
if (array != null) {
if (ctx.getState().getPeriodSolution(solution.getKey()) == null) {
List<PeriodSolution> list = new ArrayList<PeriodSolution>();
for (PeriodSolution s : array) list.add(s);
list.add(solution);
PeriodSolution[] newArray = list.toArray(new PeriodSolution[list.size()]);
ctx.getState().setPeriodSolutions(newArray);
} else {
deleteOrUpdatePeriodSolution(solution, false);
ctx.getMenu().setPeriodSolutionsCount(ctx.getState().getPeriodSolutions().length);
return;
}
}
ctx.getSolutionsTable().refresh(ctx.getState().getPeriodSolutions());
ctx.getMenu().setPeriodSolutionsCount(ctx.getState().getPeriodSolutions().length);
hideAllContainers();
ctx.getPageTitlePanel().setHTML(i18n.solutions());
RootPanel.get(CONTAINER_SOLUTION_TABLE).setVisible(true);
} | @Override
public void onSuccess(PeriodSolution result) {
solution.setKey(result.getKey());
solution.setModified(result.getModified());
solution.setModifiedPretty(result.getModifiedPretty());
PeriodSolution[] array = ctx.getState().getPeriodSolutions();
if (array != null) {
if (ctx.getState().getPeriodSolution(solution.getKey()) == null) {
List<PeriodSolution> list = new ArrayList<PeriodSolution>();
for (PeriodSolution s : array) list.add(s);
list.add(solution);
PeriodSolution[] newArray = list.toArray(new PeriodSolution[list.size()]);
ctx.getState().setPeriodSolutions(newArray);
} else {
deleteOrUpdatePeriodSolution(solution, false);
ctx.getMenu().setPeriodSolutionsCount(ctx.getState().getPeriodSolutions().length);
return;
}
}
ctx.getSolutionsTable().refresh(ctx.getState().getPeriodSolutions());
ctx.getMenu().setPeriodSolutionsCount(ctx.getState().getPeriodSolutions().length);
<DeepExtract>
hideAllContainers();
ctx.getPageTitlePanel().setHTML(i18n.solutions());
RootPanel.get(CONTAINER_SOLUTION_TABLE).setVisible(true);
</DeepExtract>
} | shifts-solver | positive | 4,113 |
public PhaseStatistics getPhaseStatistics(TimeRange range) {
if (range == null) {
range = new TimeRange(getStartTime(), getEndTime());
}
double start = Math.max(range.getStart(), getStartTime());
double end = Math.min(range.getEnd(), getEndTime());
return new TimeRange(start, end);
List<GCEventType> parents = getParentEventTypes();
Map<String, DoubleData[]> parentData = new HashMap<>();
List<Map<String, DoubleData[]>> phaseData = new ArrayList<>();
List<Map<String, DoubleData[]>> causeData = new ArrayList<>();
for (int i = 0; i < parents.size(); i++) {
phaseData.add(new HashMap<>());
causeData.add(new HashMap<>());
}
int indexLow = binarySearchEventIndex(gcEvents, range.getStart(), true);
int indexHigh = binarySearchEventIndex(gcEvents, range.getEnd(), false);
for (int i = indexLow; i < indexHigh; i++) {
event -> {
int index = parents.indexOf(event.getEventType());
if (index < 0) {
return;
}
putPhaseStatisticData(event, event.getEventType().getName(), parentData, true);
if (event.getCause() != null) {
putPhaseStatisticData(event, event.getCause().getName(), causeData.get(index), false);
}
event.phasesDoDFS(phase -> putPhaseStatisticData(phase, phase.getEventType().getName(), phaseData.get(index), true));
}.accept(gcEvents.get(i));
}
List<ParentStatisticsInfo> result = new ArrayList<>();
for (int i = 0; i < parents.size(); i++) {
String name = parents.get(i).getName();
if (parentData.containsKey(name)) {
result.add(new ParentStatisticsInfo(makePhaseStatisticItem(parents.get(i).getName(), parentData.get(name)), phaseData.get(i).entrySet().stream().map(entry -> makePhaseStatisticItem(entry.getKey(), entry.getValue())).collect(Collectors.toList()), causeData.get(i).entrySet().stream().map(entry -> makePhaseStatisticItem(entry.getKey(), entry.getValue())).collect(Collectors.toList())));
}
}
return new PhaseStatistics(result);
} | public PhaseStatistics getPhaseStatistics(TimeRange range) {
if (range == null) {
range = new TimeRange(getStartTime(), getEndTime());
}
double start = Math.max(range.getStart(), getStartTime());
double end = Math.min(range.getEnd(), getEndTime());
return new TimeRange(start, end);
List<GCEventType> parents = getParentEventTypes();
Map<String, DoubleData[]> parentData = new HashMap<>();
List<Map<String, DoubleData[]>> phaseData = new ArrayList<>();
List<Map<String, DoubleData[]>> causeData = new ArrayList<>();
for (int i = 0; i < parents.size(); i++) {
phaseData.add(new HashMap<>());
causeData.add(new HashMap<>());
}
<DeepExtract>
int indexLow = binarySearchEventIndex(gcEvents, range.getStart(), true);
int indexHigh = binarySearchEventIndex(gcEvents, range.getEnd(), false);
for (int i = indexLow; i < indexHigh; i++) {
event -> {
int index = parents.indexOf(event.getEventType());
if (index < 0) {
return;
}
putPhaseStatisticData(event, event.getEventType().getName(), parentData, true);
if (event.getCause() != null) {
putPhaseStatisticData(event, event.getCause().getName(), causeData.get(index), false);
}
event.phasesDoDFS(phase -> putPhaseStatisticData(phase, phase.getEventType().getName(), phaseData.get(index), true));
}.accept(gcEvents.get(i));
}
</DeepExtract>
List<ParentStatisticsInfo> result = new ArrayList<>();
for (int i = 0; i < parents.size(); i++) {
String name = parents.get(i).getName();
if (parentData.containsKey(name)) {
result.add(new ParentStatisticsInfo(makePhaseStatisticItem(parents.get(i).getName(), parentData.get(name)), phaseData.get(i).entrySet().stream().map(entry -> makePhaseStatisticItem(entry.getKey(), entry.getValue())).collect(Collectors.toList()), causeData.get(i).entrySet().stream().map(entry -> makePhaseStatisticItem(entry.getKey(), entry.getValue())).collect(Collectors.toList())));
}
}
return new PhaseStatistics(result);
} | jifa | positive | 4,114 |
public final void sendeeprom_sync_write(Short address, Byte value) {
FixedSizePacket fsp = null;
fsp = JArduinoProtocol.createEeprom_sync_write(address, value);
if (fsp != null) {
System.out.println(fsp + " --> " + fsp.getPacket());
for (JArduinoClientObserver h : handlers) {
h.receiveMsg(fsp.getPacket());
}
} else {
System.out.println("Data is null");
}
} | public final void sendeeprom_sync_write(Short address, Byte value) {
FixedSizePacket fsp = null;
fsp = JArduinoProtocol.createEeprom_sync_write(address, value);
<DeepExtract>
if (fsp != null) {
System.out.println(fsp + " --> " + fsp.getPacket());
for (JArduinoClientObserver h : handlers) {
h.receiveMsg(fsp.getPacket());
}
} else {
System.out.println("Data is null");
}
</DeepExtract>
} | JArduino | positive | 4,115 |
@Test
public void testCleanLockFromPrimary() throws IOException {
ThemisLock from = getLock(COLUMN);
writeLockAndData(COLUMN);
if (false) {
writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs);
} else {
writeData(SECONDARY_COLUMNS[0], prewriteTs);
}
for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) {
writeLockAndData(SECONDARY_COLUMNS[i]);
}
lockCleaner.cleanLock(from);
checkTransactionRollback();
deleteOldDataAndUpdateTs();
writePutAndData(COLUMN, prewriteTs, commitTs);
if (true) {
writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs);
} else {
writeData(SECONDARY_COLUMNS[0], prewriteTs);
}
for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) {
writeLockAndData(SECONDARY_COLUMNS[i]);
}
from = getLock(COLUMN);
lockCleaner.cleanLock(from);
checkTransactionCommitSuccess();
deleteOldDataAndUpdateTs();
writeData(COLUMN, prewriteTs);
if (false) {
writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs);
} else {
writeData(SECONDARY_COLUMNS[0], prewriteTs);
}
for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) {
writeLockAndData(SECONDARY_COLUMNS[i]);
}
from = getLock(COLUMN);
lockCleaner.cleanLock(from);
checkTransactionRollback();
} | @Test
public void testCleanLockFromPrimary() throws IOException {
ThemisLock from = getLock(COLUMN);
writeLockAndData(COLUMN);
<DeepExtract>
if (false) {
writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs);
} else {
writeData(SECONDARY_COLUMNS[0], prewriteTs);
}
for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) {
writeLockAndData(SECONDARY_COLUMNS[i]);
}
</DeepExtract>
lockCleaner.cleanLock(from);
checkTransactionRollback();
deleteOldDataAndUpdateTs();
writePutAndData(COLUMN, prewriteTs, commitTs);
if (true) {
writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs);
} else {
writeData(SECONDARY_COLUMNS[0], prewriteTs);
}
for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) {
writeLockAndData(SECONDARY_COLUMNS[i]);
}
from = getLock(COLUMN);
lockCleaner.cleanLock(from);
checkTransactionCommitSuccess();
deleteOldDataAndUpdateTs();
writeData(COLUMN, prewriteTs);
<DeepExtract>
if (false) {
writePutAndData(SECONDARY_COLUMNS[0], prewriteTs, commitTs);
} else {
writeData(SECONDARY_COLUMNS[0], prewriteTs);
}
for (int i = 1; i < SECONDARY_COLUMNS.length; ++i) {
writeLockAndData(SECONDARY_COLUMNS[i]);
}
</DeepExtract>
from = getLock(COLUMN);
lockCleaner.cleanLock(from);
checkTransactionRollback();
} | themis | positive | 4,116 |
public void setByPassState(boolean b) {
byPass = b;
if (cbNotifyList != null && cbNotifyList.size() >= 1) {
for (CircuitBreakerNotificationCallback notifyObject : cbNotifyList) {
notifyObject.notify(getStatus());
}
}
} | public void setByPassState(boolean b) {
byPass = b;
<DeepExtract>
if (cbNotifyList != null && cbNotifyList.size() >= 1) {
for (CircuitBreakerNotificationCallback notifyObject : cbNotifyList) {
notifyObject.notify(getStatus());
}
}
</DeepExtract>
} | jrugged | positive | 4,117 |
public Criteria andUploadTimeIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "uploadTime" + " cannot be null");
}
criteria.add(new Criterion("upload_time in", values));
return (Criteria) this;
} | public Criteria andUploadTimeIn(List<String> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "uploadTime" + " cannot be null");
}
criteria.add(new Criterion("upload_time in", values));
</DeepExtract>
return (Criteria) this;
} | einvoice | positive | 4,118 |
public void abort() throws IOException {
if (started) {
if (true) {
Database.getLogFile().logAbort(tid);
}
Database.getBufferPool().transactionComplete(tid, !true);
if (!true) {
Database.getLogFile().logCommit(tid);
}
started = false;
}
} | public void abort() throws IOException {
<DeepExtract>
if (started) {
if (true) {
Database.getLogFile().logAbort(tid);
}
Database.getBufferPool().transactionComplete(tid, !true);
if (!true) {
Database.getLogFile().logCommit(tid);
}
started = false;
}
</DeepExtract>
} | simple-db-hw-2021 | positive | 4,119 |
public static void invokeSub(Dispatch dispatchTarget, String name, int dispid, int lcid, int wFlags, Object[] oArg, int[] uArgErr) {
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);
invokev(dispatchTarget, name, dispid, lcid, wFlags, VariantUtilities.objectsToVariants(oArg), uArgErr);
} | public static void invokeSub(Dispatch dispatchTarget, String name, int dispid, int lcid, int wFlags, Object[] oArg, int[] uArgErr) {
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);
invokev(dispatchTarget, name, dispid, lcid, wFlags, VariantUtilities.objectsToVariants(oArg), uArgErr);
</DeepExtract>
} | jacob | positive | 4,120 |
public static String getDescriptor(final Class<?> clazz) {
StringBuilder stringBuilder = new StringBuilder();
Class<?> currentClass = clazz;
while (currentClass.isArray()) {
stringBuilder.append('[');
currentClass = currentClass.getComponentType();
}
if (currentClass.isPrimitive()) {
char descriptor;
if (currentClass == Integer.TYPE) {
descriptor = 'I';
} else if (currentClass == Void.TYPE) {
descriptor = 'V';
} else if (currentClass == Boolean.TYPE) {
descriptor = 'Z';
} else if (currentClass == Byte.TYPE) {
descriptor = 'B';
} else if (currentClass == Character.TYPE) {
descriptor = 'C';
} else if (currentClass == Short.TYPE) {
descriptor = 'S';
} else if (currentClass == Double.TYPE) {
descriptor = 'D';
} else if (currentClass == Float.TYPE) {
descriptor = 'F';
} else if (currentClass == Long.TYPE) {
descriptor = 'J';
} else {
throw new AssertionError();
}
stringBuilder.append(descriptor);
} else {
stringBuilder.append('L').append(getInternalName(currentClass)).append(';');
}
return getDescriptor();
} | public static String getDescriptor(final Class<?> clazz) {
StringBuilder stringBuilder = new StringBuilder();
Class<?> currentClass = clazz;
while (currentClass.isArray()) {
stringBuilder.append('[');
currentClass = currentClass.getComponentType();
}
if (currentClass.isPrimitive()) {
char descriptor;
if (currentClass == Integer.TYPE) {
descriptor = 'I';
} else if (currentClass == Void.TYPE) {
descriptor = 'V';
} else if (currentClass == Boolean.TYPE) {
descriptor = 'Z';
} else if (currentClass == Byte.TYPE) {
descriptor = 'B';
} else if (currentClass == Character.TYPE) {
descriptor = 'C';
} else if (currentClass == Short.TYPE) {
descriptor = 'S';
} else if (currentClass == Double.TYPE) {
descriptor = 'D';
} else if (currentClass == Float.TYPE) {
descriptor = 'F';
} else if (currentClass == Long.TYPE) {
descriptor = 'J';
} else {
throw new AssertionError();
}
stringBuilder.append(descriptor);
} else {
stringBuilder.append('L').append(getInternalName(currentClass)).append(';');
}
<DeepExtract>
return getDescriptor();
</DeepExtract>
} | jvm-tail-recursion | positive | 4,121 |
@Override
public DecisionResult evaluate(final DecisionRequest individualDecisionRequest) {
if (!initialized) {
final String cause;
if (confLocation == null) {
cause = "Missing parameter: configuration file";
} else if (extSchemaLocation == null) {
cause = "Missing parameter: extension schema file";
} else if (catalogLocation == null) {
cause = "Missing parameter: XML catalog file";
} else {
cause = "Check previous errors.";
}
throw new RuntimeException("PDP not initialized: " + cause);
}
return pdp.evaluate(individualDecisionRequest);
} | @Override
public DecisionResult evaluate(final DecisionRequest individualDecisionRequest) {
<DeepExtract>
if (!initialized) {
final String cause;
if (confLocation == null) {
cause = "Missing parameter: configuration file";
} else if (extSchemaLocation == null) {
cause = "Missing parameter: extension schema file";
} else if (catalogLocation == null) {
cause = "Missing parameter: XML catalog file";
} else {
cause = "Check previous errors.";
}
throw new RuntimeException("PDP not initialized: " + cause);
}
</DeepExtract>
return pdp.evaluate(individualDecisionRequest);
} | core | positive | 4,122 |
public List<Favorite> getFavoriteListFileNotUploaded() {
adapter.open();
List<Favorite> mainlist = new ArrayList<Favorite>();
Favorite listFavorite;
if (adapter.getFavoriteDataFileNotUploaded().getCount() >= 1) {
adapter.getFavoriteDataFileNotUploaded().moveToFirst();
do {
listFavorite = new Favorite();
listFavorite.amount = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_AMOUNT));
listFavorite.id = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_ID));
listFavorite.description = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_TAG));
listFavorite.type = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_TYPE));
listFavorite.location = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_LOCATION));
listFavorite.myHash = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_MY_HASH));
listFavorite.updatedAt = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_UPDATED_AT));
listFavorite.deleted = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_DELETE_BIT)) > 0;
listFavorite.idFromServer = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_ID_FROM_SERVER));
listFavorite.fileUploaded = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_UPLOADED)) > 0;
listFavorite.fileToDownload = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_TO_DOWNLOAD)) > 0;
listFavorite.syncBit = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_SYNC_BIT));
listFavorite.fileUpdatedAt = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_UPDATED_AT));
if (listFavorite.description == null || listFavorite.description.equals("")) {
if (listFavorite.type.equals(context.getString(R.string.text))) {
listFavorite.description = context.getString(R.string.finished_textentry);
} else if (listFavorite.type.equals(context.getString(R.string.voice))) {
listFavorite.description = context.getString(R.string.finished_voiceentry);
} else if (listFavorite.type.equals(context.getString(R.string.camera))) {
listFavorite.description = context.getString(R.string.finished_cameraentry);
}
}
mainlist.add(listFavorite);
adapter.getFavoriteDataFileNotUploaded().moveToNext();
} while (!adapter.getFavoriteDataFileNotUploaded().isAfterLast());
}
adapter.getFavoriteDataFileNotUploaded().close();
adapter.close();
return mainlist;
} | public List<Favorite> getFavoriteListFileNotUploaded() {
adapter.open();
<DeepExtract>
List<Favorite> mainlist = new ArrayList<Favorite>();
Favorite listFavorite;
if (adapter.getFavoriteDataFileNotUploaded().getCount() >= 1) {
adapter.getFavoriteDataFileNotUploaded().moveToFirst();
do {
listFavorite = new Favorite();
listFavorite.amount = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_AMOUNT));
listFavorite.id = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_ID));
listFavorite.description = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_TAG));
listFavorite.type = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_TYPE));
listFavorite.location = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_LOCATION));
listFavorite.myHash = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_MY_HASH));
listFavorite.updatedAt = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_UPDATED_AT));
listFavorite.deleted = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_DELETE_BIT)) > 0;
listFavorite.idFromServer = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_ID_FROM_SERVER));
listFavorite.fileUploaded = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_UPLOADED)) > 0;
listFavorite.fileToDownload = adapter.getFavoriteDataFileNotUploaded().getInt(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_TO_DOWNLOAD)) > 0;
listFavorite.syncBit = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_SYNC_BIT));
listFavorite.fileUpdatedAt = adapter.getFavoriteDataFileNotUploaded().getString(adapter.getFavoriteDataFileNotUploaded().getColumnIndex(DatabaseAdapter.KEY_FILE_UPDATED_AT));
if (listFavorite.description == null || listFavorite.description.equals("")) {
if (listFavorite.type.equals(context.getString(R.string.text))) {
listFavorite.description = context.getString(R.string.finished_textentry);
} else if (listFavorite.type.equals(context.getString(R.string.voice))) {
listFavorite.description = context.getString(R.string.finished_voiceentry);
} else if (listFavorite.type.equals(context.getString(R.string.camera))) {
listFavorite.description = context.getString(R.string.finished_cameraentry);
}
}
mainlist.add(listFavorite);
adapter.getFavoriteDataFileNotUploaded().moveToNext();
} while (!adapter.getFavoriteDataFileNotUploaded().isAfterLast());
}
adapter.getFavoriteDataFileNotUploaded().close();
adapter.close();
return mainlist;
</DeepExtract>
} | expense-tracker | positive | 4,123 |
public void stateChanged(javax.swing.event.ChangeEvent evt) {
megacrypter_reverse_port_label.setEnabled(megacrypter_reverse_checkbox.isSelected());
megacrypter_reverse_port_spinner.setEnabled(megacrypter_reverse_checkbox.isSelected());
megacrypter_reverse_warning_label.setEnabled(megacrypter_reverse_checkbox.isSelected());
} | public void stateChanged(javax.swing.event.ChangeEvent evt) {
<DeepExtract>
megacrypter_reverse_port_label.setEnabled(megacrypter_reverse_checkbox.isSelected());
megacrypter_reverse_port_spinner.setEnabled(megacrypter_reverse_checkbox.isSelected());
megacrypter_reverse_warning_label.setEnabled(megacrypter_reverse_checkbox.isSelected());
</DeepExtract>
} | megabasterd | positive | 4,124 |
@Test
public void commaSeparated() throws Exception {
String expected = "?myParam=foo,bar,baz";
StringClient client = builder().queryParamStyle(QueryParamStyle.COMMA_SEPARATED).build(StringClient.class);
String responseStr = client.multiValues(Arrays.asList("foo", "bar", "baz"));
assertNotNull(responseStr, "Response entity is null");
assertTrue(responseStr.contains(expected), "Expected snippet, " + expected + ", in: " + responseStr);
} | @Test
public void commaSeparated() throws Exception {
String expected = "?myParam=foo,bar,baz";
StringClient client = builder().queryParamStyle(QueryParamStyle.COMMA_SEPARATED).build(StringClient.class);
<DeepExtract>
String responseStr = client.multiValues(Arrays.asList("foo", "bar", "baz"));
assertNotNull(responseStr, "Response entity is null");
assertTrue(responseStr.contains(expected), "Expected snippet, " + expected + ", in: " + responseStr);
</DeepExtract>
} | microprofile-rest-client | positive | 4,125 |
@Override
public boolean newSession(ICustomTabsCallback callback) {
final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback, null);
try {
DeathRecipient deathRecipient = () -> cleanUpSession(sessionToken);
synchronized (mDeathRecipientMap) {
callback.asBinder().linkToDeath(deathRecipient, 0);
mDeathRecipientMap.put(callback.asBinder(), deathRecipient);
}
return CustomTabsService.this.newSession(sessionToken);
} catch (RemoteException e) {
return false;
}
} | @Override
public boolean newSession(ICustomTabsCallback callback) {
<DeepExtract>
final CustomTabsSessionToken sessionToken = new CustomTabsSessionToken(callback, null);
try {
DeathRecipient deathRecipient = () -> cleanUpSession(sessionToken);
synchronized (mDeathRecipientMap) {
callback.asBinder().linkToDeath(deathRecipient, 0);
mDeathRecipientMap.put(callback.asBinder(), deathRecipient);
}
return CustomTabsService.this.newSession(sessionToken);
} catch (RemoteException e) {
return false;
}
</DeepExtract>
} | custom-tabs-client | positive | 4,126 |
@Test
public void testValidationServiceCounter() {
LOG.info("ValidationServiceTest.testValidationServiceCounter() called");
configuration.put(Applier.Configuration.TYPE, "HBASE");
configuration.put(ValidationService.Configuration.VALIDATION_BROKER, "localhost:9092");
configuration.put(ValidationService.Configuration.VALIDATION_THROTTLE_ONE_EVERY, "2");
configuration.put(ValidationService.Configuration.VALIDATION_TOPIC, "replicator_validation");
configuration.put(ValidationService.Configuration.VALIDATION_TAG, "test_hbase");
configuration.put(ValidationService.Configuration.VALIDATION_SOURCE_DATA_SOURCE, "av1msql");
configuration.put(ValidationService.Configuration.VALIDATION_TARGET_DATA_SOURCE, "avbigtable");
configuration.put(Applier.Configuration.TYPE, "HBASE");
ValidationService validationService = ValidationService.getInstance(configuration);
Assert.assertNotNull(validationService);
DataSource dummy = new DataSource("constant", new ConstantQueryOptions(Types.CONSTANT.getValue(), new HashMap<String, Object>() {
{
put("a", 1);
}
}, null));
for (int i = 0; i < 10; i++) {
validationService.registerValidationTask("sample-id-" + i, dummy, dummy);
}
Assert.assertEquals(10L, validationService.getValidationTaskCounter());
} | @Test
public void testValidationServiceCounter() {
LOG.info("ValidationServiceTest.testValidationServiceCounter() called");
<DeepExtract>
configuration.put(Applier.Configuration.TYPE, "HBASE");
configuration.put(ValidationService.Configuration.VALIDATION_BROKER, "localhost:9092");
configuration.put(ValidationService.Configuration.VALIDATION_THROTTLE_ONE_EVERY, "2");
configuration.put(ValidationService.Configuration.VALIDATION_TOPIC, "replicator_validation");
configuration.put(ValidationService.Configuration.VALIDATION_TAG, "test_hbase");
configuration.put(ValidationService.Configuration.VALIDATION_SOURCE_DATA_SOURCE, "av1msql");
configuration.put(ValidationService.Configuration.VALIDATION_TARGET_DATA_SOURCE, "avbigtable");
</DeepExtract>
configuration.put(Applier.Configuration.TYPE, "HBASE");
ValidationService validationService = ValidationService.getInstance(configuration);
Assert.assertNotNull(validationService);
DataSource dummy = new DataSource("constant", new ConstantQueryOptions(Types.CONSTANT.getValue(), new HashMap<String, Object>() {
{
put("a", 1);
}
}, null));
for (int i = 0; i < 10; i++) {
validationService.registerValidationTask("sample-id-" + i, dummy, dummy);
}
Assert.assertEquals(10L, validationService.getValidationTaskCounter());
} | replicator | positive | 4,127 |
public static int countSteps(int k) {
HashSet<Point> hset = new HashSet<>();
int len = 0;
len += countSum(0);
len += countSum(0);
if (len > k) {
return;
}
hset.add(new Point(0, 0));
for (int i = 0; i < dir.length; i++) {
int xVal = 0 + dir[i][0];
int yVal = 0 + dir[i][1];
if (!hset.contains(new Point(xVal, yVal))) {
dfs(hset, xVal, yVal, k);
}
}
return hset.size();
} | public static int countSteps(int k) {
HashSet<Point> hset = new HashSet<>();
<DeepExtract>
int len = 0;
len += countSum(0);
len += countSum(0);
if (len > k) {
return;
}
hset.add(new Point(0, 0));
for (int i = 0; i < dir.length; i++) {
int xVal = 0 + dir[i][0];
int yVal = 0 + dir[i][1];
if (!hset.contains(new Point(xVal, yVal))) {
dfs(hset, xVal, yVal, k);
}
}
</DeepExtract>
return hset.size();
} | leetCodeInterview | positive | 4,128 |
public FeatureFrequency increment(Feature feature) {
FeatureFrequency freq = null;
if (containsFeature(feature)) {
freq = get(feature);
freq.frequency += 1;
}
return freq;
} | public FeatureFrequency increment(Feature feature) {
<DeepExtract>
FeatureFrequency freq = null;
if (containsFeature(feature)) {
freq = get(feature);
freq.frequency += 1;
}
return freq;
</DeepExtract>
} | ensemble-clustering | positive | 4,129 |
public void setAdapter(TvBaseAdapter adapter) {
this.adapter = adapter;
if (adapter != null) {
adapter.registerDataSetObservable(mDataSetObservable);
}
itemIds.clear();
this.removeAllViews();
this.clearDisappearingChildren();
this.destroyDrawingCache();
focusIsOut = true;
mScroller.setFinalY(0);
parentLayout = false;
currentChildCount = 0;
if (isInit) {
initGridView();
isInit = false;
}
Message msg = handler.obtainMessage();
msg.what = ACTION_INIT_ITEMS;
handler.sendMessageDelayed(msg, DELAY);
} | public void setAdapter(TvBaseAdapter adapter) {
this.adapter = adapter;
if (adapter != null) {
adapter.registerDataSetObservable(mDataSetObservable);
}
<DeepExtract>
itemIds.clear();
this.removeAllViews();
this.clearDisappearingChildren();
this.destroyDrawingCache();
focusIsOut = true;
mScroller.setFinalY(0);
parentLayout = false;
currentChildCount = 0;
</DeepExtract>
if (isInit) {
initGridView();
isInit = false;
}
Message msg = handler.obtainMessage();
msg.what = ACTION_INIT_ITEMS;
handler.sendMessageDelayed(msg, DELAY);
} | tvframe | positive | 4,130 |
public void setPendingAccAmount(BigDecimal deltaAccEth, BigDecimal deltaAccErc20) {
log.info("Set pending [{}, {}]", deltaAccEth, deltaAccErc20);
this.pendingAccEth = deltaAccEth;
this.pendingAccErc20 = deltaAccErc20;
} | public void setPendingAccAmount(BigDecimal deltaAccEth, BigDecimal deltaAccErc20) {
log.info("Set pending [{}, {}]", deltaAccEth, deltaAccErc20);
this.pendingAccEth = deltaAccEth;
<DeepExtract>
this.pendingAccErc20 = deltaAccErc20;
</DeepExtract>
} | CoFiX-hedger | positive | 4,131 |
@java.lang.Override
public cc.vector_tile.VectorTile.Tile.GeomType getType() {
cc.vector_tile.VectorTile.Tile.GeomType result;
switch(type_) {
case 0:
result = UNKNOWN;
case 1:
result = POINT;
case 2:
result = LINESTRING;
case 3:
result = POLYGON;
default:
result = null;
}
return result == null ? cc.vector_tile.VectorTile.Tile.GeomType.UNKNOWN : result;
} | @java.lang.Override
public cc.vector_tile.VectorTile.Tile.GeomType getType() {
<DeepExtract>
cc.vector_tile.VectorTile.Tile.GeomType result;
switch(type_) {
case 0:
result = UNKNOWN;
case 1:
result = POINT;
case 2:
result = LINESTRING;
case 3:
result = POLYGON;
default:
result = null;
}
</DeepExtract>
return result == null ? cc.vector_tile.VectorTile.Tile.GeomType.UNKNOWN : result;
} | carma-cloud | positive | 4,132 |
public static boolean clear() {
checkValid();
return mUtil.clear();
} | public static boolean clear() {
<DeepExtract>
checkValid();
return mUtil.clear();
</DeepExtract>
} | PureNote | positive | 4,133 |
public void actionPerformed(ActionEvent evt) {
rotationAngle += rotAngleDelta;
if (rotationAngle > 2 * Math.PI)
rotationAngle -= 2 * Math.PI;
diagram.setRotationAngle(rotationAngle);
diagram.project2d(rotationAngle);
repaint();
} | public void actionPerformed(ActionEvent evt) {
<DeepExtract>
rotationAngle += rotAngleDelta;
if (rotationAngle > 2 * Math.PI)
rotationAngle -= 2 * Math.PI;
diagram.setRotationAngle(rotationAngle);
diagram.project2d(rotationAngle);
repaint();
</DeepExtract>
} | conexp-clj | positive | 4,134 |
@Override
public void onShow(DialogInterface dialog) {
super.onShow(dialog);
if (numberOfActionButtons() <= 1) {
return;
} else if (mBuilder.forceStacking) {
isStacked = true;
invalidateActions();
return;
}
isStacked = false;
int buttonsWidth = 0;
positiveButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
neutralButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
negativeButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
if (mBuilder.positiveText != null)
buttonsWidth += positiveButton.getMeasuredWidth();
if (mBuilder.neutralText != null)
buttonsWidth += neutralButton.getMeasuredWidth();
if (mBuilder.negativeText != null)
buttonsWidth += negativeButton.getMeasuredWidth();
final int buttonFrameWidth = view.findViewById(R.id.buttonDefaultFrame).getWidth();
isStacked = buttonsWidth > buttonFrameWidth;
invalidateActions();
if (view.getMeasuredWidth() == 0) {
return;
}
View contentScrollView = view.findViewById(R.id.contentScrollView);
final int contentHorizontalPadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_dialog_frame_margin);
content.setPadding(contentHorizontalPadding, 0, contentHorizontalPadding, 0);
if (mBuilder.customView != null) {
contentScrollView.setVisibility(View.GONE);
customViewFrame.setVisibility(View.VISIBLE);
boolean topScroll = canViewOrChildScroll(customViewFrame.getChildAt(0), false);
boolean bottomScroll = canViewOrChildScroll(customViewFrame.getChildAt(0), true);
setDividerVisibility(topScroll, bottomScroll);
} else if ((mBuilder.items != null && mBuilder.items.length > 0) || mBuilder.adapter != null) {
contentScrollView.setVisibility(View.GONE);
boolean canScroll = titleFrame.getVisibility() == View.VISIBLE && canListViewScroll();
setDividerVisibility(canScroll, canScroll);
} else {
contentScrollView.setVisibility(View.VISIBLE);
boolean canScroll = canContentScroll();
if (canScroll) {
final int contentVerticalPadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom);
content.setPadding(contentHorizontalPadding, contentVerticalPadding, contentHorizontalPadding, contentVerticalPadding);
final int titlePaddingBottom = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom_list);
titleFrame.setPadding(titleFrame.getPaddingLeft(), titleFrame.getPaddingTop(), titleFrame.getPaddingRight(), titlePaddingBottom);
}
setDividerVisibility(canScroll, canScroll);
}
} | @Override
public void onShow(DialogInterface dialog) {
super.onShow(dialog);
if (numberOfActionButtons() <= 1) {
return;
} else if (mBuilder.forceStacking) {
isStacked = true;
invalidateActions();
return;
}
isStacked = false;
int buttonsWidth = 0;
positiveButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
neutralButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
negativeButton.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
if (mBuilder.positiveText != null)
buttonsWidth += positiveButton.getMeasuredWidth();
if (mBuilder.neutralText != null)
buttonsWidth += neutralButton.getMeasuredWidth();
if (mBuilder.negativeText != null)
buttonsWidth += negativeButton.getMeasuredWidth();
final int buttonFrameWidth = view.findViewById(R.id.buttonDefaultFrame).getWidth();
isStacked = buttonsWidth > buttonFrameWidth;
invalidateActions();
<DeepExtract>
if (view.getMeasuredWidth() == 0) {
return;
}
View contentScrollView = view.findViewById(R.id.contentScrollView);
final int contentHorizontalPadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_dialog_frame_margin);
content.setPadding(contentHorizontalPadding, 0, contentHorizontalPadding, 0);
if (mBuilder.customView != null) {
contentScrollView.setVisibility(View.GONE);
customViewFrame.setVisibility(View.VISIBLE);
boolean topScroll = canViewOrChildScroll(customViewFrame.getChildAt(0), false);
boolean bottomScroll = canViewOrChildScroll(customViewFrame.getChildAt(0), true);
setDividerVisibility(topScroll, bottomScroll);
} else if ((mBuilder.items != null && mBuilder.items.length > 0) || mBuilder.adapter != null) {
contentScrollView.setVisibility(View.GONE);
boolean canScroll = titleFrame.getVisibility() == View.VISIBLE && canListViewScroll();
setDividerVisibility(canScroll, canScroll);
} else {
contentScrollView.setVisibility(View.VISIBLE);
boolean canScroll = canContentScroll();
if (canScroll) {
final int contentVerticalPadding = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom);
content.setPadding(contentHorizontalPadding, contentVerticalPadding, contentHorizontalPadding, contentVerticalPadding);
final int titlePaddingBottom = (int) mBuilder.context.getResources().getDimension(R.dimen.md_title_frame_margin_bottom_list);
titleFrame.setPadding(titleFrame.getPaddingLeft(), titleFrame.getPaddingTop(), titleFrame.getPaddingRight(), titlePaddingBottom);
}
setDividerVisibility(canScroll, canScroll);
}
</DeepExtract>
} | File_Quest | positive | 4,135 |
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(TAG, "surfaceDestroyed");
Log.d(TAG, "stopVideoRecording");
if (mediaRecorderRecording || mediaRecorder != null) {
try {
videoPacketizer.stopStreaming();
if (mediaRecorderRecording && mediaRecorder != null) {
try {
mediaRecorder.setOnErrorListener(null);
mediaRecorder.setOnInfoListener(null);
mediaRecorder.stop();
} catch (RuntimeException e) {
Log.e(TAG, "stop fail: " + e.getMessage());
}
mediaRecorderRecording = false;
}
} catch (Exception e) {
Log.e(TAG, "stopVideoRecording failed");
e.printStackTrace();
} finally {
releaseMediaRecorder();
}
}
} | public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(TAG, "surfaceDestroyed");
<DeepExtract>
Log.d(TAG, "stopVideoRecording");
if (mediaRecorderRecording || mediaRecorder != null) {
try {
videoPacketizer.stopStreaming();
if (mediaRecorderRecording && mediaRecorder != null) {
try {
mediaRecorder.setOnErrorListener(null);
mediaRecorder.setOnInfoListener(null);
mediaRecorder.stop();
} catch (RuntimeException e) {
Log.e(TAG, "stop fail: " + e.getMessage());
}
mediaRecorderRecording = false;
}
} catch (Exception e) {
Log.e(TAG, "stopVideoRecording failed");
e.printStackTrace();
} finally {
releaseMediaRecorder();
}
}
</DeepExtract>
} | RTSP-Camera-for-Android | positive | 4,136 |
private void parse(NetworkOperatingSystem nos) {
try {
JSONObject doc = (JSONObject) JSONValue.parse(new FileReader(this.filename));
JSONArray nodes = (JSONArray) doc.get("nodes");
@SuppressWarnings("unchecked")
Iterator<JSONObject> iter = nodes.iterator();
while (iter.hasNext()) {
JSONObject node = iter.next();
String nodeType = (String) node.get("type");
String nodeName = (String) node.get("name");
String dcName = (String) node.get("datacenter");
if (null != null && !null.equals(dcName)) {
continue;
}
if (nodeType.equalsIgnoreCase("host")) {
long pes = (Long) node.get("pes");
long mips = (Long) node.get("mips");
int ram = new BigDecimal((Long) node.get("ram")).intValueExact();
long storage = (Long) node.get("storage");
long bw = new BigDecimal((Long) node.get("bw")).intValueExact();
int num = 1;
if (node.get("nums") != null)
num = new BigDecimal((Long) node.get("nums")).intValueExact();
for (int n = 0; n < num; n++) {
String nodeName2 = nodeName;
if (num > 1)
nodeName2 = nodeName + n;
SDNHost sdnHost = hostFactory.createHost(ram, bw, storage, pes, mips, nodeName);
nameNodeTable.put(nodeName2, sdnHost);
this.sdnHosts.put(dcName, sdnHost);
}
} else {
int MAX_PORTS = 256;
long bw = new BigDecimal((Long) node.get("bw")).longValueExact();
long iops = (Long) node.get("iops");
int upports = MAX_PORTS;
int downports = MAX_PORTS;
if (node.get("upports") != null)
upports = new BigDecimal((Long) node.get("upports")).intValueExact();
if (node.get("downports") != null)
downports = new BigDecimal((Long) node.get("downports")).intValueExact();
Switch sw = null;
if (nodeType.equalsIgnoreCase("core")) {
sw = new CoreSwitch(nodeName, bw, iops, upports, downports);
} else if (nodeType.equalsIgnoreCase("aggregate")) {
sw = new AggregationSwitch(nodeName, bw, iops, upports, downports);
} else if (nodeType.equalsIgnoreCase("edge")) {
sw = new EdgeSwitch(nodeName, bw, iops, upports, downports);
} else if (nodeType.equalsIgnoreCase("intercloud")) {
sw = new IntercloudSwitch(nodeName, bw, iops, upports, downports);
} else if (nodeType.equalsIgnoreCase("gateway")) {
if (nameNodeTable.get(nodeName) != null)
sw = (Switch) nameNodeTable.get(nodeName);
else
sw = new GatewaySwitch(nodeName, bw, iops, upports, downports);
} else {
throw new IllegalArgumentException("No switch found!");
}
if (sw != null) {
nameNodeTable.put(nodeName, sw);
this.switches.put(dcName, sw);
}
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
JSONObject doc = (JSONObject) JSONValue.parse(new FileReader(this.filename));
JSONArray links = (JSONArray) doc.get("links");
@SuppressWarnings("unchecked")
Iterator<JSONObject> linksIter = links.iterator();
while (linksIter.hasNext()) {
JSONObject link = linksIter.next();
String src = (String) link.get("source");
String dst = (String) link.get("destination");
double lat = (Double) link.get("latency");
Node srcNode = nameNodeTable.get(src);
Node dstNode = nameNodeTable.get(dst);
Link l = new Link(srcNode, dstNode, lat, -1);
this.links.add(l);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} | private void parse(NetworkOperatingSystem nos) {
try {
JSONObject doc = (JSONObject) JSONValue.parse(new FileReader(this.filename));
JSONArray nodes = (JSONArray) doc.get("nodes");
@SuppressWarnings("unchecked")
Iterator<JSONObject> iter = nodes.iterator();
while (iter.hasNext()) {
JSONObject node = iter.next();
String nodeType = (String) node.get("type");
String nodeName = (String) node.get("name");
String dcName = (String) node.get("datacenter");
if (null != null && !null.equals(dcName)) {
continue;
}
if (nodeType.equalsIgnoreCase("host")) {
long pes = (Long) node.get("pes");
long mips = (Long) node.get("mips");
int ram = new BigDecimal((Long) node.get("ram")).intValueExact();
long storage = (Long) node.get("storage");
long bw = new BigDecimal((Long) node.get("bw")).intValueExact();
int num = 1;
if (node.get("nums") != null)
num = new BigDecimal((Long) node.get("nums")).intValueExact();
for (int n = 0; n < num; n++) {
String nodeName2 = nodeName;
if (num > 1)
nodeName2 = nodeName + n;
SDNHost sdnHost = hostFactory.createHost(ram, bw, storage, pes, mips, nodeName);
nameNodeTable.put(nodeName2, sdnHost);
this.sdnHosts.put(dcName, sdnHost);
}
} else {
int MAX_PORTS = 256;
long bw = new BigDecimal((Long) node.get("bw")).longValueExact();
long iops = (Long) node.get("iops");
int upports = MAX_PORTS;
int downports = MAX_PORTS;
if (node.get("upports") != null)
upports = new BigDecimal((Long) node.get("upports")).intValueExact();
if (node.get("downports") != null)
downports = new BigDecimal((Long) node.get("downports")).intValueExact();
Switch sw = null;
if (nodeType.equalsIgnoreCase("core")) {
sw = new CoreSwitch(nodeName, bw, iops, upports, downports);
} else if (nodeType.equalsIgnoreCase("aggregate")) {
sw = new AggregationSwitch(nodeName, bw, iops, upports, downports);
} else if (nodeType.equalsIgnoreCase("edge")) {
sw = new EdgeSwitch(nodeName, bw, iops, upports, downports);
} else if (nodeType.equalsIgnoreCase("intercloud")) {
sw = new IntercloudSwitch(nodeName, bw, iops, upports, downports);
} else if (nodeType.equalsIgnoreCase("gateway")) {
if (nameNodeTable.get(nodeName) != null)
sw = (Switch) nameNodeTable.get(nodeName);
else
sw = new GatewaySwitch(nodeName, bw, iops, upports, downports);
} else {
throw new IllegalArgumentException("No switch found!");
}
if (sw != null) {
nameNodeTable.put(nodeName, sw);
this.switches.put(dcName, sw);
}
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
<DeepExtract>
try {
JSONObject doc = (JSONObject) JSONValue.parse(new FileReader(this.filename));
JSONArray links = (JSONArray) doc.get("links");
@SuppressWarnings("unchecked")
Iterator<JSONObject> linksIter = links.iterator();
while (linksIter.hasNext()) {
JSONObject link = linksIter.next();
String src = (String) link.get("source");
String dst = (String) link.get("destination");
double lat = (Double) link.get("latency");
Node srcNode = nameNodeTable.get(src);
Node dstNode = nameNodeTable.get(dst);
Link l = new Link(srcNode, dstNode, lat, -1);
this.links.add(l);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
</DeepExtract>
} | cloudsimsdn | positive | 4,137 |
@Override
public boolean onError(MediaPlayer mediaPlayer, int what, int more) {
Log.w(TAG, "Media player error: " + new Exception("MediaPlayer error: " + what + " (" + more + ")"), new Exception("MediaPlayer error: " + what + " (" + more + ")"));
mediaPlayer.reset();
setPlayerState(IDLE);
return false;
} | @Override
public boolean onError(MediaPlayer mediaPlayer, int what, int more) {
<DeepExtract>
Log.w(TAG, "Media player error: " + new Exception("MediaPlayer error: " + what + " (" + more + ")"), new Exception("MediaPlayer error: " + what + " (" + more + ")"));
mediaPlayer.reset();
setPlayerState(IDLE);
</DeepExtract>
return false;
} | Subsonic-Android | positive | 4,138 |
public void cacheAllInfo(String dir) {
File file = new File(dir);
File[] classes = file.listFiles();
for (File classFile : classes) {
if (classFile.isDirectory()) {
loadAllMetaInfo(classFile.getAbsolutePath());
} else {
loadSingleMetaInfo(classFile);
}
}
for (String name : metaInfos.keySet()) {
constructSubNames(name);
}
} | public void cacheAllInfo(String dir) {
File file = new File(dir);
File[] classes = file.listFiles();
for (File classFile : classes) {
if (classFile.isDirectory()) {
loadAllMetaInfo(classFile.getAbsolutePath());
} else {
loadSingleMetaInfo(classFile);
}
}
<DeepExtract>
for (String name : metaInfos.keySet()) {
constructSubNames(name);
}
</DeepExtract>
} | vinja | positive | 4,140 |
public byte i2() {
assert (2 <= 8);
return (byte) readInt(2, true);
} | public byte i2() {
<DeepExtract>
assert (2 <= 8);
return (byte) readInt(2, true);
</DeepExtract>
} | testing-video | positive | 4,141 |
public void newAgent(Vertex vertex) throws IOException {
String s = keyword("agent") + "(" + vertex.getID() + optionalAttributes(vertex.getAttributes()) + ")";
buffer.write(s);
if (!standaloneExpression) {
buffer.newLine();
}
} | public void newAgent(Vertex vertex) throws IOException {
String s = keyword("agent") + "(" + vertex.getID() + optionalAttributes(vertex.getAttributes()) + ")";
<DeepExtract>
buffer.write(s);
if (!standaloneExpression) {
buffer.newLine();
}
</DeepExtract>
} | prov-viewer | positive | 4,142 |
@Test
public void docToTxtOfficeTest() throws Exception {
mockTransformCommand(DOC, TXT, MIMETYPE_WORD, false);
this.targetMimetype = MIMETYPE_TEXT_PLAIN;
System.out.println("Test " + OFFICE + " " + DOC + " to " + TXT);
MockHttpServletRequestBuilder requestBuilder = null == null ? mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", this.targetExtension) : mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", this.targetExtension, INCLUDE_CONTENTS, null.toString());
MvcResult result = mockMvc.perform(requestBuilder).andExpect(status().is(OK.value())).andExpect(header().string("Content-Disposition", "attachment; filename*=UTF-8''transform." + this.targetExtension)).andReturn();
String content = result.getResponse().getContentAsString();
assertTrue(content.contains(EXPECTED_TEXT_CONTENT_CONTAINS), "The content did not include \"" + EXPECTED_TEXT_CONTENT_CONTAINS);
} | @Test
public void docToTxtOfficeTest() throws Exception {
<DeepExtract>
mockTransformCommand(DOC, TXT, MIMETYPE_WORD, false);
this.targetMimetype = MIMETYPE_TEXT_PLAIN;
System.out.println("Test " + OFFICE + " " + DOC + " to " + TXT);
MockHttpServletRequestBuilder requestBuilder = null == null ? mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", this.targetExtension) : mockMvcRequest(ENDPOINT_TRANSFORM, sourceFile, "targetExtension", this.targetExtension, INCLUDE_CONTENTS, null.toString());
MvcResult result = mockMvc.perform(requestBuilder).andExpect(status().is(OK.value())).andExpect(header().string("Content-Disposition", "attachment; filename*=UTF-8''transform." + this.targetExtension)).andReturn();
String content = result.getResponse().getContentAsString();
assertTrue(content.contains(EXPECTED_TEXT_CONTENT_CONTAINS), "The content did not include \"" + EXPECTED_TEXT_CONTENT_CONTAINS);
</DeepExtract>
} | alfresco-transform-core | positive | 4,143 |
@Before
public void init() {
deFiConsumerManager = new DeFiConsumerManager(consumerIdsChangeListener, adjustQueueNumStrategy);
mockChannel = mock(Channel.class);
clientChannelInfo = new ClientChannelInfo(mockChannel, clientId, LanguageCode.JAVA, 100);
ConsumerData consumerData = new ConsumerData();
consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY);
consumerData.setGroupName(group);
consumerData.setMessageModel(MessageModel.CLUSTERING);
Set<SubscriptionData> subscriptionDataSet = new HashSet<>();
SubscriptionData subscriptionData = new SubscriptionData();
subscriptionData.setTopic(topic);
subscriptionData.setSubString("*");
subscriptionData.setSubVersion(100L);
subscriptionDataSet.add(subscriptionData);
consumerData.setSubscriptionDataSet(subscriptionDataSet);
return consumerData;
deFiConsumerManager.registerConsumer(consumerData.getGroupName(), clientChannelInfo, consumerData.getConsumeType(), consumerData.getMessageModel(), consumerData.getConsumeFromWhere(), consumerData.getSubscriptionDataSet(), false);
} | @Before
public void init() {
deFiConsumerManager = new DeFiConsumerManager(consumerIdsChangeListener, adjustQueueNumStrategy);
mockChannel = mock(Channel.class);
clientChannelInfo = new ClientChannelInfo(mockChannel, clientId, LanguageCode.JAVA, 100);
<DeepExtract>
ConsumerData consumerData = new ConsumerData();
consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY);
consumerData.setGroupName(group);
consumerData.setMessageModel(MessageModel.CLUSTERING);
Set<SubscriptionData> subscriptionDataSet = new HashSet<>();
SubscriptionData subscriptionData = new SubscriptionData();
subscriptionData.setTopic(topic);
subscriptionData.setSubString("*");
subscriptionData.setSubVersion(100L);
subscriptionDataSet.add(subscriptionData);
consumerData.setSubscriptionDataSet(subscriptionDataSet);
return consumerData;
</DeepExtract>
deFiConsumerManager.registerConsumer(consumerData.getGroupName(), clientChannelInfo, consumerData.getConsumeType(), consumerData.getMessageModel(), consumerData.getConsumeFromWhere(), consumerData.getSubscriptionDataSet(), false);
} | DeFiBus | positive | 4,146 |
private void rethrow(Throwable e) {
Lib.assertTrue(privileged != null && privilegeCount > 0);
privilegeCount--;
if (privilegeCount == 0)
privileged = null;
if (e instanceof RuntimeException)
throw (RuntimeException) e;
else if (e instanceof Error)
throw (Error) e;
else
Lib.assertNotReached();
} | private void rethrow(Throwable e) {
<DeepExtract>
Lib.assertTrue(privileged != null && privilegeCount > 0);
privilegeCount--;
if (privilegeCount == 0)
privileged = null;
</DeepExtract>
if (e instanceof RuntimeException)
throw (RuntimeException) e;
else if (e instanceof Error)
throw (Error) e;
else
Lib.assertNotReached();
} | CS162 | positive | 4,147 |
@SuppressWarnings("UnusedDeclaration")
public void setKmFrom(double distance) {
Preconditions.checkArgument(limits instanceof RadialBound);
this.radius = distance * 0.621371 / EARTH_RADIUS;
Preconditions.checkArgument(Math.toDegrees(this.radius) < 70, "Outrageously large radius");
} | @SuppressWarnings("UnusedDeclaration")
public void setKmFrom(double distance) {
Preconditions.checkArgument(limits instanceof RadialBound);
<DeepExtract>
this.radius = distance * 0.621371 / EARTH_RADIUS;
Preconditions.checkArgument(Math.toDegrees(this.radius) < 70, "Outrageously large radius");
</DeepExtract>
} | log-synth | positive | 4,148 |
@Override
public View onCreateInputView() {
keyboardFrame = new FrameLayout(this);
keyboardFrame.removeAllViews();
if (lastLanguage != NumberKeyboard.LANGUAGE_ID)
lastLanguage = lastLanguage;
final Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
final Point point = new Point();
display.getSize(point);
final View view = lastLanguage != KeyboardPicker.LANGUAGE_ID ? keyboard = BaldKeyboard.newInstance(lastLanguage, this, this, this::backspace, getCurrentInputEditorInfo().imeOptions) : new KeyboardPicker(this);
keyboardFrame.addView(view, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, point.x > point.y ? (int) (point.y * 0.8) : ViewGroup.LayoutParams.MATCH_PARENT));
return keyboardFrame;
} | @Override
public View onCreateInputView() {
keyboardFrame = new FrameLayout(this);
<DeepExtract>
keyboardFrame.removeAllViews();
if (lastLanguage != NumberKeyboard.LANGUAGE_ID)
lastLanguage = lastLanguage;
final Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
final Point point = new Point();
display.getSize(point);
final View view = lastLanguage != KeyboardPicker.LANGUAGE_ID ? keyboard = BaldKeyboard.newInstance(lastLanguage, this, this, this::backspace, getCurrentInputEditorInfo().imeOptions) : new KeyboardPicker(this);
keyboardFrame.addView(view, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, point.x > point.y ? (int) (point.y * 0.8) : ViewGroup.LayoutParams.MATCH_PARENT));
</DeepExtract>
return keyboardFrame;
} | BaldPhone | positive | 4,149 |
public void reset() {
mEmulator.reset();
if (mNotify != null) {
mNotify.onUpdate();
}
} | public void reset() {
mEmulator.reset();
<DeepExtract>
if (mNotify != null) {
mNotify.onUpdate();
}
</DeepExtract>
} | TerminalEmulator-Android | positive | 4,150 |
@Test
public void addDateTag() {
Instant instant = Instant.ofEpochMilli(0L);
addTagByType(Date.from(instant), "1970-01-01", RecordFieldType.DATE.getDataType());
} | @Test
public void addDateTag() {
Instant instant = Instant.ofEpochMilli(0L);
<DeepExtract>
addTagByType(Date.from(instant), "1970-01-01", RecordFieldType.DATE.getDataType());
</DeepExtract>
} | nifi-influxdb-bundle | positive | 4,151 |
public Criteria andAddressGreaterThanOrEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "address" + " cannot be null");
}
criteria.add(new Criterion("address >=", value));
return (Criteria) this;
} | public Criteria andAddressGreaterThanOrEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "address" + " cannot be null");
}
criteria.add(new Criterion("address >=", value));
</DeepExtract>
return (Criteria) this;
} | Ordering | positive | 4,152 |
public void setServer(CommandSender sender, String server, Boolean auto) {
if (server.contains(":")) {
botServerPort = Integer.parseInt(server.split(":")[1]);
botServer = server.split(":")[0];
} else {
botServer = server;
}
botServer = botServer.replace("^.*\\/\\/", "");
botServer = botServer.replace(":\\d+$", "");
saveConfig("server", botServer);
autoConnect = auto;
plugin.logDebug("Saving [" + "server" + "]: " + botServer.toString());
config.set("server", botServer);
saveConfig();
plugin.logDebug("Saving [" + "port" + "]: " + botServerPort.toString());
config.set("port", botServerPort);
saveConfig();
plugin.logDebug("Saving [" + "autoconnect" + "]: " + autoConnect.toString());
config.set("autoconnect", autoConnect);
saveConfig();
sender.sendMessage("IRC server changed to \"" + botServer + ":" + botServerPort + "\". (AutoConnect: " + autoConnect + ")");
} | public void setServer(CommandSender sender, String server, Boolean auto) {
if (server.contains(":")) {
botServerPort = Integer.parseInt(server.split(":")[1]);
botServer = server.split(":")[0];
} else {
botServer = server;
}
botServer = botServer.replace("^.*\\/\\/", "");
botServer = botServer.replace(":\\d+$", "");
saveConfig("server", botServer);
autoConnect = auto;
plugin.logDebug("Saving [" + "server" + "]: " + botServer.toString());
config.set("server", botServer);
saveConfig();
plugin.logDebug("Saving [" + "port" + "]: " + botServerPort.toString());
config.set("port", botServerPort);
saveConfig();
<DeepExtract>
plugin.logDebug("Saving [" + "autoconnect" + "]: " + autoConnect.toString());
config.set("autoconnect", autoConnect);
saveConfig();
</DeepExtract>
sender.sendMessage("IRC server changed to \"" + botServer + ":" + botServerPort + "\". (AutoConnect: " + autoConnect + ")");
} | PurpleIRC | positive | 4,153 |
public static boolean compareAnnotatedCallable(AnnotatedCallable<?> m1, AnnotatedCallable<?> m2) {
if (!m1.getJavaMember().equals(m2.getJavaMember())) {
return false;
}
if (!compareAnnotated(m1, m2)) {
return false;
}
if (m1.getParameters().size() != m2.getParameters().size()) {
return false;
}
for (int i = 0; i < m1.getParameters().size(); ++i) {
if (!compareAnnotated(m1.getParameters().get(i), m2.getParameters().get(i))) {
return false;
}
}
return true;
} | public static boolean compareAnnotatedCallable(AnnotatedCallable<?> m1, AnnotatedCallable<?> m2) {
if (!m1.getJavaMember().equals(m2.getJavaMember())) {
return false;
}
if (!compareAnnotated(m1, m2)) {
return false;
}
<DeepExtract>
if (m1.getParameters().size() != m2.getParameters().size()) {
return false;
}
for (int i = 0; i < m1.getParameters().size(); ++i) {
if (!compareAnnotated(m1.getParameters().get(i), m2.getParameters().get(i))) {
return false;
}
}
return true;
</DeepExtract>
} | extensions | positive | 4,154 |
@Override
final void sendFormatted(String formatted) {
tasks.offer(() -> {
for (EventSource subscriber : subscribers) {
subscriber.sendFormatted(formatted);
}
});
trySchedule();
} | @Override
final void sendFormatted(String formatted) {
<DeepExtract>
tasks.offer(() -> {
for (EventSource subscriber : subscribers) {
subscriber.sendFormatted(formatted);
}
});
trySchedule();
</DeepExtract>
} | titanite | positive | 4,155 |
public void onPause() {
AsyncTask<?, ?, ?> task = inactivityTask;
if (task != null) {
task.cancel(true);
inactivityTask = null;
}
activity.unregisterReceiver(powerStatusReceiver);
} | public void onPause() {
<DeepExtract>
AsyncTask<?, ?, ?> task = inactivityTask;
if (task != null) {
task.cancel(true);
inactivityTask = null;
}
</DeepExtract>
activity.unregisterReceiver(powerStatusReceiver);
} | sichu_android | positive | 4,156 |
public static String getOriginalPug2ResourcePath(String fileName) throws FileNotFoundException, URISyntaxException {
String path = Paths.get(TestFileHelper.class.getResource(TESTFILE_PUG2_ORIGINAL_FOLDER + fileName).toURI()).toString();
LoggerFactory.getLogger(TestFileHelper.class.getClass()).debug(path);
return path;
} | public static String getOriginalPug2ResourcePath(String fileName) throws FileNotFoundException, URISyntaxException {
<DeepExtract>
String path = Paths.get(TestFileHelper.class.getResource(TESTFILE_PUG2_ORIGINAL_FOLDER + fileName).toURI()).toString();
LoggerFactory.getLogger(TestFileHelper.class.getClass()).debug(path);
return path;
</DeepExtract>
} | pug4j | positive | 4,158 |
public Criteria andN_titleLessThan(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "n_title" + " cannot be null");
}
criteria.add(new Criterion("n_title <", value));
return (Criteria) this;
} | public Criteria andN_titleLessThan(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "n_title" + " cannot be null");
}
criteria.add(new Criterion("n_title <", value));
</DeepExtract>
return (Criteria) this;
} | BaiChengNews | positive | 4,159 |
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
isDragging = true;
if (!isShowing) {
$.id(R.id.app_video_top_box).visible();
if (!isLive) {
showBottomControl(true);
}
if (!fullScreenOnly) {
$.id(R.id.app_video_fullscreen).visible();
}
isShowing = true;
onControlPanelVisibilityChangeListener.change(true);
}
updatePausePlay();
handler.sendEmptyMessage(MESSAGE_SHOW_PROGRESS);
handler.removeMessages(MESSAGE_FADE_OUT);
if (3600000 != 0) {
handler.sendMessageDelayed(handler.obtainMessage(MESSAGE_FADE_OUT), 3600000);
}
handler.removeMessages(MESSAGE_SHOW_PROGRESS);
if (instantSeeking) {
audioManager.setStreamMute(AudioManager.STREAM_MUSIC, true);
}
} | @Override
public void onStartTrackingTouch(SeekBar seekBar) {
isDragging = true;
<DeepExtract>
if (!isShowing) {
$.id(R.id.app_video_top_box).visible();
if (!isLive) {
showBottomControl(true);
}
if (!fullScreenOnly) {
$.id(R.id.app_video_fullscreen).visible();
}
isShowing = true;
onControlPanelVisibilityChangeListener.change(true);
}
updatePausePlay();
handler.sendEmptyMessage(MESSAGE_SHOW_PROGRESS);
handler.removeMessages(MESSAGE_FADE_OUT);
if (3600000 != 0) {
handler.sendMessageDelayed(handler.obtainMessage(MESSAGE_FADE_OUT), 3600000);
}
</DeepExtract>
handler.removeMessages(MESSAGE_SHOW_PROGRESS);
if (instantSeeking) {
audioManager.setStreamMute(AudioManager.STREAM_MUSIC, true);
}
} | MKVideoPlayer | positive | 4,160 |
@Test
public void addTuple() throws Exception {
byte[] data = BTreeLeafPage.createEmptyPageData();
BTreeLeafPage page0 = new BTreeLeafPage(pid, data, 0);
BTreeLeafPage page1 = new BTreeLeafPage(pid, data, 1);
ArrayList<Tuple> tuples = new ArrayList<Tuple>();
for (int[] tuple : EXAMPLE_VALUES) {
Tuple tup = new Tuple(Utility.getTupleDesc(2));
for (int i = 0; i < tuple.length; i++) {
tup.setField(i, new IntField(tuple[i]));
}
tuples.add(tup);
page0.insertTuple(tup);
page1.insertTuple(tup);
}
Collections.sort(tuples, new TupleComparator(0));
Iterator<Tuple> it0 = page0.iterator();
for (Tuple tup : tuples) {
assertTrue(tup.equals(it0.next()));
}
Collections.sort(tuples, new TupleComparator(1));
Iterator<Tuple> it1 = page1.iterator();
for (Tuple tup : tuples) {
assertTrue(tup.equals(it1.next()));
}
int free;
BTreeLeafPage page = new BTreeLeafPage(pid, EXAMPLE_DATA, 0);
assertEquals(482, page.getNumEmptySlots());
for (int i = 0; i < free; ++i) {
Tuple addition = BTreeUtility.getBTreeTuple(i, 2);
page0.insertTuple(addition);
assertEquals(free - i - 1, page0.getNumEmptySlots());
Iterator<Tuple> it = page0.iterator();
boolean found = false;
while (it.hasNext()) {
Tuple tup = it.next();
if (TestUtil.compareTuples(addition, tup)) {
found = true;
assertTrue(page0.getId().equals(tup.getRecordId().getPageId()));
break;
}
}
assertTrue(found);
}
try {
page0.insertTuple(BTreeUtility.getBTreeTuple(0, 2));
throw new Exception("page should be full; expected DbException");
} catch (DbException e) {
}
} | @Test
public void addTuple() throws Exception {
byte[] data = BTreeLeafPage.createEmptyPageData();
BTreeLeafPage page0 = new BTreeLeafPage(pid, data, 0);
BTreeLeafPage page1 = new BTreeLeafPage(pid, data, 1);
ArrayList<Tuple> tuples = new ArrayList<Tuple>();
for (int[] tuple : EXAMPLE_VALUES) {
Tuple tup = new Tuple(Utility.getTupleDesc(2));
for (int i = 0; i < tuple.length; i++) {
tup.setField(i, new IntField(tuple[i]));
}
tuples.add(tup);
page0.insertTuple(tup);
page1.insertTuple(tup);
}
Collections.sort(tuples, new TupleComparator(0));
Iterator<Tuple> it0 = page0.iterator();
for (Tuple tup : tuples) {
assertTrue(tup.equals(it0.next()));
}
Collections.sort(tuples, new TupleComparator(1));
Iterator<Tuple> it1 = page1.iterator();
for (Tuple tup : tuples) {
assertTrue(tup.equals(it1.next()));
}
<DeepExtract>
int free;
BTreeLeafPage page = new BTreeLeafPage(pid, EXAMPLE_DATA, 0);
assertEquals(482, page.getNumEmptySlots());
</DeepExtract>
for (int i = 0; i < free; ++i) {
Tuple addition = BTreeUtility.getBTreeTuple(i, 2);
page0.insertTuple(addition);
assertEquals(free - i - 1, page0.getNumEmptySlots());
Iterator<Tuple> it = page0.iterator();
boolean found = false;
while (it.hasNext()) {
Tuple tup = it.next();
if (TestUtil.compareTuples(addition, tup)) {
found = true;
assertTrue(page0.getId().equals(tup.getRecordId().getPageId()));
break;
}
}
assertTrue(found);
}
try {
page0.insertTuple(BTreeUtility.getBTreeTuple(0, 2));
throw new Exception("page should be full; expected DbException");
} catch (DbException e) {
}
} | simple-db | positive | 4,161 |
public void validateMetricDefAdded() {
MetricDefinitionAndTenantId metricDefinitionAndTenantId = new MetricDefinitionAndTenantId(metricDef1, TENANT_ID);
assertNull(bolt.metricDefToSubAlarmStatsRepos.get(metricDefinitionAndTenantId));
final MkTupleParam tupleParam = new MkTupleParam();
tupleParam.setFields(AlarmCreationBolt.ALARM_CREATION_FIELDS);
tupleParam.setStream(AlarmCreationBolt.ALARM_CREATION_STREAM);
final String alarmDefinitionString = "";
final Tuple tuple = Testing.testTuple(Arrays.asList(EventProcessingBolt.CREATED, new TenantIdAndMetricName(TENANT_ID, metricDef1.name), new MetricDefinitionAndTenantId(metricDef1, TENANT_ID), alarmDefinitionString, subAlarm1), tupleParam);
bolt.execute(tuple);
assertNotNull(bolt.metricDefToSubAlarmStatsRepos.get(metricDefinitionAndTenantId).get(ALARM_ID_1));
} | public void validateMetricDefAdded() {
MetricDefinitionAndTenantId metricDefinitionAndTenantId = new MetricDefinitionAndTenantId(metricDef1, TENANT_ID);
assertNull(bolt.metricDefToSubAlarmStatsRepos.get(metricDefinitionAndTenantId));
<DeepExtract>
final MkTupleParam tupleParam = new MkTupleParam();
tupleParam.setFields(AlarmCreationBolt.ALARM_CREATION_FIELDS);
tupleParam.setStream(AlarmCreationBolt.ALARM_CREATION_STREAM);
final String alarmDefinitionString = "";
final Tuple tuple = Testing.testTuple(Arrays.asList(EventProcessingBolt.CREATED, new TenantIdAndMetricName(TENANT_ID, metricDef1.name), new MetricDefinitionAndTenantId(metricDef1, TENANT_ID), alarmDefinitionString, subAlarm1), tupleParam);
bolt.execute(tuple);
</DeepExtract>
assertNotNull(bolt.metricDefToSubAlarmStatsRepos.get(metricDefinitionAndTenantId).get(ALARM_ID_1));
} | monasca-thresh | positive | 4,162 |
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_notification);
findPreference("notifications_new_message_ringtone").setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
sBindPreferenceSummaryToValueListener.onPreferenceChange(findPreference("notifications_new_message_ringtone"), PreferenceManager.getDefaultSharedPreferences(findPreference("notifications_new_message_ringtone").getContext()).getString(findPreference("notifications_new_message_ringtone").getKey(), ""));
} | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_notification);
<DeepExtract>
findPreference("notifications_new_message_ringtone").setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
sBindPreferenceSummaryToValueListener.onPreferenceChange(findPreference("notifications_new_message_ringtone"), PreferenceManager.getDefaultSharedPreferences(findPreference("notifications_new_message_ringtone").getContext()).getString(findPreference("notifications_new_message_ringtone").getKey(), ""));
</DeepExtract>
} | aad | positive | 4,163 |
public String countByExample(UserExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("wk_user");
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (false) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
return sql.toString();
} | public String countByExample(UserExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("wk_user");
<DeepExtract>
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (false) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
</DeepExtract>
return sql.toString();
} | wukong-framework | positive | 4,164 |
private GenerationTaskResult launchBundleGeneration(String bundleName) {
if (telosysProject == null || model == null) {
throw new RuntimeException("Launcher is not initialized");
}
if (specificDestinationFolder != null) {
String newDestinationFolder = StrUtil.replaceVar(specificDestinationFolder, "${BUNDLE}", bundleName);
telosysProject.getTelosysToolsCfg().setSpecificDestinationFolder(newDestinationFolder);
}
try {
return telosysProject.launchGeneration(model, bundleName);
} catch (TelosysToolsException e) {
throw new RuntimeException("Generation error (TelosysToolsException): " + e.getMessage());
}
} | private GenerationTaskResult launchBundleGeneration(String bundleName) {
<DeepExtract>
if (telosysProject == null || model == null) {
throw new RuntimeException("Launcher is not initialized");
}
</DeepExtract>
if (specificDestinationFolder != null) {
String newDestinationFolder = StrUtil.replaceVar(specificDestinationFolder, "${BUNDLE}", bundleName);
telosysProject.getTelosysToolsCfg().setSpecificDestinationFolder(newDestinationFolder);
}
try {
return telosysProject.launchGeneration(model, bundleName);
} catch (TelosysToolsException e) {
throw new RuntimeException("Generation error (TelosysToolsException): " + e.getMessage());
}
} | telosys-cli | positive | 4,165 |
public void crush(int mx, int my) {
int screen_x = (mc.displayWidth / 2);
int screen_y = (mc.displayHeight / 2);
this.x = mx - this.move_x;
this.y = my - this.move_y;
if (this.x + this.width >= screen_x) {
this.x = screen_x - this.width - 1;
}
if (this.x <= 0) {
this.x = 1;
}
if (this.y + this.height >= screen_y) {
this.y = screen_y - this.height - 1;
}
if (this.y <= 0) {
this.y = 1;
}
if (this.x % 2 != 0) {
this.x += this.x % 2;
}
if (this.y % 2 != 0) {
this.y += this.y % 2;
}
} | public void crush(int mx, int my) {
int screen_x = (mc.displayWidth / 2);
int screen_y = (mc.displayHeight / 2);
this.x = mx - this.move_x;
<DeepExtract>
this.y = my - this.move_y;
</DeepExtract>
if (this.x + this.width >= screen_x) {
this.x = screen_x - this.width - 1;
}
if (this.x <= 0) {
this.x = 1;
}
if (this.y + this.height >= screen_y) {
this.y = screen_y - this.height - 1;
}
if (this.y <= 0) {
this.y = 1;
}
if (this.x % 2 != 0) {
this.x += this.x % 2;
}
if (this.y % 2 != 0) {
this.y += this.y % 2;
}
} | wurstplus-two | positive | 4,166 |
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("DROP TABLE IF EXISTS " + SHADERS);
db.execSQL("CREATE TABLE " + SHADERS + " (" + SHADERS_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + SHADERS_FRAGMENT_SHADER + " TEXT NOT NULL," + SHADERS_THUMB + " BLOB," + SHADERS_NAME + " TEXT," + SHADERS_CREATED + " DATETIME," + SHADERS_MODIFIED + " DATETIME," + SHADERS_QUALITY + " REAL);");
insertInitalShaders(db, context);
db.execSQL("DROP TABLE IF EXISTS " + TEXTURES);
db.execSQL("CREATE TABLE " + TEXTURES + " (" + TEXTURES_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + TEXTURES_NAME + " TEXT NOT NULL UNIQUE," + TEXTURES_WIDTH + " INTEGER," + TEXTURES_HEIGHT + " INTEGER," + TEXTURES_RATIO + " REAL," + TEXTURES_THUMB + " BLOB," + TEXTURES_MATRIX + " BLOB);");
insertInitalTextures(db, context);
} | @Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("DROP TABLE IF EXISTS " + SHADERS);
db.execSQL("CREATE TABLE " + SHADERS + " (" + SHADERS_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + SHADERS_FRAGMENT_SHADER + " TEXT NOT NULL," + SHADERS_THUMB + " BLOB," + SHADERS_NAME + " TEXT," + SHADERS_CREATED + " DATETIME," + SHADERS_MODIFIED + " DATETIME," + SHADERS_QUALITY + " REAL);");
insertInitalShaders(db, context);
<DeepExtract>
db.execSQL("DROP TABLE IF EXISTS " + TEXTURES);
db.execSQL("CREATE TABLE " + TEXTURES + " (" + TEXTURES_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + TEXTURES_NAME + " TEXT NOT NULL UNIQUE," + TEXTURES_WIDTH + " INTEGER," + TEXTURES_HEIGHT + " INTEGER," + TEXTURES_RATIO + " REAL," + TEXTURES_THUMB + " BLOB," + TEXTURES_MATRIX + " BLOB);");
insertInitalTextures(db, context);
</DeepExtract>
} | ShaderEditor | positive | 4,167 |
public void testIntNumberType() throws Exception {
JsonArray array1 = Json.createArrayBuilder().add(Integer.MIN_VALUE).add(Integer.MAX_VALUE).add(Integer.MIN_VALUE + 1).add(Integer.MAX_VALUE - 1).add(12).add(12l).add(new BigInteger("0")).build();
for (JsonValue value : array1) {
assertEquals(true, ((JsonNumber) value).isIntegral());
}
StringReader sr = new StringReader("[" + "-2147483648, " + "2147483647, " + "-2147483647, " + "2147483646, " + "12, " + "12, " + "0 " + "]");
JsonReader reader = Json.createReader(sr);
JsonArray array2 = reader.readArray();
reader.close();
for (JsonValue value : array2) {
assertEquals(true, ((JsonNumber) value).isIntegral());
}
assertEquals(array1, array2);
} | public void testIntNumberType() throws Exception {
JsonArray array1 = Json.createArrayBuilder().add(Integer.MIN_VALUE).add(Integer.MAX_VALUE).add(Integer.MIN_VALUE + 1).add(Integer.MAX_VALUE - 1).add(12).add(12l).add(new BigInteger("0")).build();
for (JsonValue value : array1) {
assertEquals(true, ((JsonNumber) value).isIntegral());
}
StringReader sr = new StringReader("[" + "-2147483648, " + "2147483647, " + "-2147483647, " + "2147483646, " + "12, " + "12, " + "0 " + "]");
JsonReader reader = Json.createReader(sr);
JsonArray array2 = reader.readArray();
reader.close();
<DeepExtract>
for (JsonValue value : array2) {
assertEquals(true, ((JsonNumber) value).isIntegral());
}
</DeepExtract>
assertEquals(array1, array2);
} | jsonp | positive | 4,168 |
public boolean doCaptcha(String captchaToken) {
Session session;
Subject subject = SecurityUtils.getSubject();
Session session = subject.getSession();
if (session == null) {
throw new UnknownSessionException("Unable found required Session");
} else {
session = session;
}
if (session.getAttribute(AppConstants.CAPTCHA_NAME) != null) {
String captcha = session.getAttribute(AppConstants.CAPTCHA_NAME).toString();
if (captchaToken != null && captcha.equalsIgnoreCase(EncriptionUtils.encrypt(captchaToken))) {
return true;
}
}
return false;
} | public boolean doCaptcha(String captchaToken) {
<DeepExtract>
Session session;
Subject subject = SecurityUtils.getSubject();
Session session = subject.getSession();
if (session == null) {
throw new UnknownSessionException("Unable found required Session");
} else {
session = session;
}
</DeepExtract>
if (session.getAttribute(AppConstants.CAPTCHA_NAME) != null) {
String captcha = session.getAttribute(AppConstants.CAPTCHA_NAME).toString();
if (captchaToken != null && captcha.equalsIgnoreCase(EncriptionUtils.encrypt(captchaToken))) {
return true;
}
}
return false;
} | dreampie | positive | 4,169 |
void registerBreakpoint(InstrumentedCodeBreakpoint breakPoint) {
synchronized (threadMap) {
ThreadInfo info = getThreadInfoTolerant(breakPoint.getThread());
info.breakPoints.add(breakPoint);
breakPoint.setOwner(this);
}
} | void registerBreakpoint(InstrumentedCodeBreakpoint breakPoint) {
<DeepExtract>
synchronized (threadMap) {
ThreadInfo info = getThreadInfoTolerant(breakPoint.getThread());
info.breakPoints.add(breakPoint);
breakPoint.setOwner(this);
}
</DeepExtract>
} | thread-weaver | positive | 4,170 |
public void jump() {
this.isJumping = true;
if (currentAnimation() == currLeftAnim || currentAnimation() == stillLeft || currentAnimation() == changeRight) {
if (inWater) {
if (dy < 0) {
setAnimation(swimActiveLeft);
frameMode = 12;
} else {
setAnimation(swimPassiveLeft);
frameMode = 13;
}
return;
} else {
setAnimation(jumpLeft);
frameMode = 4;
}
}
if (currentAnimation() == currRightAnim || currentAnimation() == stillRight || currentAnimation() == changeLeft) {
frameMode = 10;
if (inWater) {
setX(getX() + getWidth() - swimActiveRight.getWidth());
if (dy < 0) {
setAnimation(swimActiveRight);
frameMode = 14;
} else {
setAnimation(swimPassiveRight);
frameMode = 15;
}
return;
} else {
setAnimation(jumpRight);
frameMode = 10;
}
}
if (dy > 0 && currentAnimation() == swimActiveRight)
setAnimation(swimPassiveRight);
if (dy < 0 && currentAnimation() == swimPassiveRight)
setAnimation(swimActiveRight);
if (dy > 0 && currentAnimation() == swimActiveLeft)
setAnimation(swimPassiveLeft);
if (dy < 0 && currentAnimation() == swimPassiveLeft)
setAnimation(swimActiveLeft);
} | public void jump() {
<DeepExtract>
this.isJumping = true;
</DeepExtract>
if (currentAnimation() == currLeftAnim || currentAnimation() == stillLeft || currentAnimation() == changeRight) {
if (inWater) {
if (dy < 0) {
setAnimation(swimActiveLeft);
frameMode = 12;
} else {
setAnimation(swimPassiveLeft);
frameMode = 13;
}
return;
} else {
setAnimation(jumpLeft);
frameMode = 4;
}
}
if (currentAnimation() == currRightAnim || currentAnimation() == stillRight || currentAnimation() == changeLeft) {
frameMode = 10;
if (inWater) {
setX(getX() + getWidth() - swimActiveRight.getWidth());
if (dy < 0) {
setAnimation(swimActiveRight);
frameMode = 14;
} else {
setAnimation(swimPassiveRight);
frameMode = 15;
}
return;
} else {
setAnimation(jumpRight);
frameMode = 10;
}
}
if (dy > 0 && currentAnimation() == swimActiveRight)
setAnimation(swimPassiveRight);
if (dy < 0 && currentAnimation() == swimPassiveRight)
setAnimation(swimActiveRight);
if (dy > 0 && currentAnimation() == swimActiveLeft)
setAnimation(swimPassiveLeft);
if (dy < 0 && currentAnimation() == swimPassiveLeft)
setAnimation(swimActiveLeft);
} | -Android-Super-Mario | positive | 4,171 |
@Override
public void process(final Throwable exception) throws Exception {
System.out.println("Get => " + exception);
System.out.println("Set " + request.getValue() + " => " + null);
rp.processResponse(null);
} | @Override
public void process(final Throwable exception) throws Exception {
System.out.println("Get => " + exception);
<DeepExtract>
System.out.println("Set " + request.getValue() + " => " + null);
rp.processResponse(null);
</DeepExtract>
} | JActor | positive | 4,172 |
@Before
public void setUp() throws Exception {
try {
this.logPath = Files.createTempDirectory("elegitLogs");
} catch (IOException e) {
e.printStackTrace();
}
this.logPath.toFile().deleteOnExit();
System.setProperty("logFolder", logPath.toString());
this.directoryPath = Files.createTempDirectory("unitTestRepos");
directoryPath.toFile().deleteOnExit();
testFileLocation = System.getProperty("user.home") + File.separator + "elegitTests" + File.separator;
File strictTestingFile = new File(testFileLocation + "strictAuthenticationTesting.txt");
looseTesting = !strictTestingFile.exists();
} | @Before
public void setUp() throws Exception {
<DeepExtract>
try {
this.logPath = Files.createTempDirectory("elegitLogs");
} catch (IOException e) {
e.printStackTrace();
}
this.logPath.toFile().deleteOnExit();
System.setProperty("logFolder", logPath.toString());
</DeepExtract>
this.directoryPath = Files.createTempDirectory("unitTestRepos");
directoryPath.toFile().deleteOnExit();
testFileLocation = System.getProperty("user.home") + File.separator + "elegitTests" + File.separator;
File strictTestingFile = new File(testFileLocation + "strictAuthenticationTesting.txt");
looseTesting = !strictTestingFile.exists();
} | Elegit | positive | 4,173 |
public <R> R applyMutation(P1 param1, P2 param2, P3 param3, QuadFunction<P1, P2, P3, ? super C, R> mutativeFunc) {
final MutationNode<P1, P2, P3, C> myNode = new MutationNode<P1, P2, P3, C>(param1, param2, param3, mutativeFunc);
Combined<P1, P2, P3, C> curComb = combinedRef;
while (true) {
final MutationNode<P1, P2, P3, C> localTail = tail;
final MutationNode<P1, P2, P3, C> node = localTail.next;
if (localTail == tail) {
if (node == null) {
if (localTail.casNext(null, myNode)) {
casTail(localTail, myNode);
return;
}
} else {
casTail(localTail, node);
}
}
}
final C mutatedInstance = (C) curComb.instance.copyOf();
for (MutationNode<P1, P2, P3, C> mn = curComb.head.next; mn != myNode; mn = mn.next) {
mn.mutation.apply(mn.param1, mn.param2, mn.param3, mutatedInstance);
}
final R retValue = mutativeFunc.apply(param1, param2, param3, mutatedInstance);
final Combined<P1, P2, P3, C> newComb = new Combined<P1, P2, P3, C>(myNode, mutatedInstance);
do {
if (curComb != combinedRef) {
curComb = combinedRef;
MutationNode<P1, P2, P3, C> ltail = tail;
for (MutationNode<P1, P2, P3, C> mn = curComb.head; mn != myNode; mn = mn.next) if (mn == ltail)
return retValue;
}
} while (!casRef(curComb, newComb));
return retValue;
} | public <R> R applyMutation(P1 param1, P2 param2, P3 param3, QuadFunction<P1, P2, P3, ? super C, R> mutativeFunc) {
final MutationNode<P1, P2, P3, C> myNode = new MutationNode<P1, P2, P3, C>(param1, param2, param3, mutativeFunc);
Combined<P1, P2, P3, C> curComb = combinedRef;
<DeepExtract>
while (true) {
final MutationNode<P1, P2, P3, C> localTail = tail;
final MutationNode<P1, P2, P3, C> node = localTail.next;
if (localTail == tail) {
if (node == null) {
if (localTail.casNext(null, myNode)) {
casTail(localTail, myNode);
return;
}
} else {
casTail(localTail, node);
}
}
}
</DeepExtract>
final C mutatedInstance = (C) curComb.instance.copyOf();
for (MutationNode<P1, P2, P3, C> mn = curComb.head.next; mn != myNode; mn = mn.next) {
mn.mutation.apply(mn.param1, mn.param2, mn.param3, mutatedInstance);
}
final R retValue = mutativeFunc.apply(param1, param2, param3, mutatedInstance);
final Combined<P1, P2, P3, C> newComb = new Combined<P1, P2, P3, C>(myNode, mutatedInstance);
do {
if (curComb != combinedRef) {
curComb = combinedRef;
MutationNode<P1, P2, P3, C> ltail = tail;
for (MutationNode<P1, P2, P3, C> mn = curComb.head; mn != myNode; mn = mn.next) if (mn == ltail)
return retValue;
}
} while (!casRef(curComb, newComb));
return retValue;
} | ConcurrencyFreaks | positive | 4,174 |
@Get("html")
public Representation handleGetHTML() throws Exception {
Map<String, Object> variablesForTemplate = new HashMap<String, Object>();
Collection ehrColl;
XMLResource resource;
Node ehrNode;
NodeModel freeMarkerNodeModel;
try {
ehrColl = ((XMLDBHelper) dbHelper).getRootCollection().getChildCollection("EHR");
resource = (XMLResource) ehrColl.getResource(ehrId);
if (resource == null) {
throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "The EHR with ID " + ehrId + " does not exist in this system");
} else {
ehrNode = resource.getContentAsDOM();
freeMarkerNodeModel = NodeModel.wrap(ehrNode.getFirstChild());
}
} catch (XMLDBException e) {
throw new ResourceException(Status.SERVER_ERROR_INTERNAL, "Could not access EHR database currently.", e);
}
variablesForTemplate.put("ehrNode", freeMarkerNodeModel);
variablesForTemplate.put("ehrId", ehrId);
reprToReturn = handleResponseViaFreemarkerTemplate("html", MediaType.TEXT_HTML, variablesForTemplate);
if (etag != null) {
reprToReturn.setTag(new Tag(etag));
}
return reprToReturn;
} | @Get("html")
public Representation handleGetHTML() throws Exception {
Map<String, Object> variablesForTemplate = new HashMap<String, Object>();
<DeepExtract>
Collection ehrColl;
XMLResource resource;
Node ehrNode;
NodeModel freeMarkerNodeModel;
try {
ehrColl = ((XMLDBHelper) dbHelper).getRootCollection().getChildCollection("EHR");
resource = (XMLResource) ehrColl.getResource(ehrId);
if (resource == null) {
throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "The EHR with ID " + ehrId + " does not exist in this system");
} else {
ehrNode = resource.getContentAsDOM();
freeMarkerNodeModel = NodeModel.wrap(ehrNode.getFirstChild());
}
} catch (XMLDBException e) {
throw new ResourceException(Status.SERVER_ERROR_INTERNAL, "Could not access EHR database currently.", e);
}
variablesForTemplate.put("ehrNode", freeMarkerNodeModel);
variablesForTemplate.put("ehrId", ehrId);
</DeepExtract>
reprToReturn = handleResponseViaFreemarkerTemplate("html", MediaType.TEXT_HTML, variablesForTemplate);
if (etag != null) {
reprToReturn.setTag(new Tag(etag));
}
return reprToReturn;
} | EEE | positive | 4,175 |
public static AresSecurityConfiguration generateConfiguration(TestContext context) {
var config = AresSecurityConfigurationBuilder.create();
config.configureFromContext(context);
config.withPath(Path.of(""));
config.addWhitelistedClassNames(generateClassWhiteList(context));
config.withPathWhitelist(generatePathWhiteList(context));
config.withPathBlacklist(generatePathBlackList(context));
config.withAllowedThreadCount(getAllowedThreadCount(context));
config.withPackageBlacklist(generatePackageBlackList(context));
config.withPackageWhitelist(generatePackageWhiteList(context));
config.withTrustedPackages(getTrustedPackages(context));
config.withThreadTrustScope(getThreadTrustScope(context));
TestContextUtils.findAnnotationIn(context, AllowLocalPort.class).ifPresent(allowLocalPort -> {
config.withAllowedLocalPorts(IntStream.of(allowLocalPort.value()).boxed().collect(Collectors.toSet()));
config.withAllowLocalPortsAbove(OptionalInt.of(allowLocalPort.allowPortsAbove()));
config.withExcludedLocalPorts(IntStream.of(allowLocalPort.exclude()).boxed().collect(Collectors.toSet()));
});
return config.build();
} | public static AresSecurityConfiguration generateConfiguration(TestContext context) {
var config = AresSecurityConfigurationBuilder.create();
config.configureFromContext(context);
config.withPath(Path.of(""));
config.addWhitelistedClassNames(generateClassWhiteList(context));
config.withPathWhitelist(generatePathWhiteList(context));
config.withPathBlacklist(generatePathBlackList(context));
config.withAllowedThreadCount(getAllowedThreadCount(context));
config.withPackageBlacklist(generatePackageBlackList(context));
config.withPackageWhitelist(generatePackageWhiteList(context));
config.withTrustedPackages(getTrustedPackages(context));
config.withThreadTrustScope(getThreadTrustScope(context));
<DeepExtract>
TestContextUtils.findAnnotationIn(context, AllowLocalPort.class).ifPresent(allowLocalPort -> {
config.withAllowedLocalPorts(IntStream.of(allowLocalPort.value()).boxed().collect(Collectors.toSet()));
config.withAllowLocalPortsAbove(OptionalInt.of(allowLocalPort.allowPortsAbove()));
config.withExcludedLocalPorts(IntStream.of(allowLocalPort.exclude()).boxed().collect(Collectors.toSet()));
});
</DeepExtract>
return config.build();
} | Ares | positive | 4,176 |
public void registerProperties(PropertiesApplicator applicator) {
if (features != null) {
for (FeaturePattern feature : features) {
checkNotNull(emptyToNull(feature.getFeature().getName()), "Empty feature name found");
applicator.register(feature);
}
}
this.userFiles = userFiles != null ? userFiles : new FnPatternList();
} | public void registerProperties(PropertiesApplicator applicator) {
if (features != null) {
for (FeaturePattern feature : features) {
checkNotNull(emptyToNull(feature.getFeature().getName()), "Empty feature name found");
applicator.register(feature);
}
}
<DeepExtract>
this.userFiles = userFiles != null ? userFiles : new FnPatternList();
</DeepExtract>
} | Launcher | positive | 4,177 |
protected void skipTestIfGroovyPluginDisabled() {
testEnabled = pluginShouldBeEnabled(OptionalPluginTestDependency.Groovy);
Assert.assertEquals(testEnabled, isPluginEnabled(OptionalPluginTestDependency.Groovy));
} | protected void skipTestIfGroovyPluginDisabled() {
<DeepExtract>
testEnabled = pluginShouldBeEnabled(OptionalPluginTestDependency.Groovy);
Assert.assertEquals(testEnabled, isPluginEnabled(OptionalPluginTestDependency.Groovy));
</DeepExtract>
} | testme-idea | positive | 4,178 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.