before stringlengths 12 3.21M | after stringlengths 41 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
private static String timestamp(long startTime) {
double elapsedMillis = (System.nanoTime() - startTime) / 1000000.0;
String tString = String.valueOf(elapsedMillis);
StringBuilder sb = new StringBuilder("t=");
sb.append(tString);
int n = 10 - tString.length();
for (int i = 0; i < n; i++) {
sb.append('0');
}
return Strings.encode(buf, 0, count, Strings.HEX);
} | private static String timestamp(long startTime) {
double elapsedMillis = (System.nanoTime() - startTime) / 1000000.0;
String tString = String.valueOf(elapsedMillis);
StringBuilder sb = new StringBuilder("t=");
sb.append(tString);
int n = 10 - tString.length();
for (int i = 0; i < n; i++) {
sb.append('0');
}
<DeepExtract>
return Strings.encode(buf, 0, count, Strings.HEX);
</DeepExtract>
} | headlong | positive | 2,725 |
@Override
public boolean contains(Object o) {
int hash = hashOf(o);
return segmentFor(hash).containsKey(o, hash);
} | @Override
public boolean contains(Object o) {
<DeepExtract>
int hash = hashOf(o);
return segmentFor(hash).containsKey(o, hash);
</DeepExtract>
} | webx-restful | positive | 2,726 |
@Override
public void onDetailsClicked(Message message, Dialog dialog) {
PreviewMessageDialog.startDialog(getActivity(), message, activeUser);
} | @Override
public void onDetailsClicked(Message message, Dialog dialog) {
<DeepExtract>
PreviewMessageDialog.startDialog(getActivity(), message, activeUser);
</DeepExtract>
} | Spika | positive | 2,727 |
public void getModule_archs(List<TreeMap<String, Object>> list) {
query("select * from " + "module_archs", list);
} | public void getModule_archs(List<TreeMap<String, Object>> list) {
<DeepExtract>
query("select * from " + "module_archs", list);
</DeepExtract>
} | MTX_HackerTools | positive | 2,728 |
@Deprecated
public String getCustomerKey() {
return key;
} | @Deprecated
public String getCustomerKey() {
<DeepExtract>
return key;
</DeepExtract>
} | FuelSDK-Java | positive | 2,729 |
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
if (jobUri == null)
return;
String printer = (String) printersListView.getItemAtPosition(position);
ini.setDefaultPrinter(printer);
Intent sendIntent = new Intent(this, PrintJobActivity.class);
sendIntent.putExtra("type", "static");
sendIntent.putExtra("printer", printer);
sendIntent.putExtra("mimeType", mimeType);
sendIntent.setData(jobUri);
this.startActivityForResult(sendIntent, 500);
} | @Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
if (jobUri == null)
return;
String printer = (String) printersListView.getItemAtPosition(position);
ini.setDefaultPrinter(printer);
<DeepExtract>
Intent sendIntent = new Intent(this, PrintJobActivity.class);
sendIntent.putExtra("type", "static");
sendIntent.putExtra("printer", printer);
sendIntent.putExtra("mimeType", mimeType);
sendIntent.setData(jobUri);
this.startActivityForResult(sendIntent, 500);
</DeepExtract>
} | JfCupsPrintService | positive | 2,730 |
@Subscribe
public void onUploadError(UploadErrorEvent event) {
UUID videoId = event.getVideoId();
String message = event.getErrorMessage();
this.adapter.hideProgress(videoId);
if (message == null) {
message = getString(R.string.upload_error);
}
SnackbarManager.show(Snackbar.with(getActivity()).text(message));
} | @Subscribe
public void onUploadError(UploadErrorEvent event) {
<DeepExtract>
UUID videoId = event.getVideoId();
String message = event.getErrorMessage();
this.adapter.hideProgress(videoId);
if (message == null) {
message = getString(R.string.upload_error);
}
SnackbarManager.show(Snackbar.with(getActivity()).text(message));
</DeepExtract>
} | AchSo | positive | 2,731 |
public void connect(BleConnectOptions options, BleGeneralResponse response) {
checkRuntime();
if (mBleWorkList.size() < MAX_REQUEST_COUNT) {
new BleConnectRequest(options, response).setRuntimeChecker(this);
new BleConnectRequest(options, response).setAddress(mAddress);
new BleConnectRequest(options, response).setWorker(mWorker);
mBleWorkList.add(new BleConnectRequest(options, response));
} else {
new BleConnectRequest(options, response).onResponse(Code.REQUEST_OVERFLOW);
}
scheduleNextRequest(10);
} | public void connect(BleConnectOptions options, BleGeneralResponse response) {
<DeepExtract>
checkRuntime();
if (mBleWorkList.size() < MAX_REQUEST_COUNT) {
new BleConnectRequest(options, response).setRuntimeChecker(this);
new BleConnectRequest(options, response).setAddress(mAddress);
new BleConnectRequest(options, response).setWorker(mWorker);
mBleWorkList.add(new BleConnectRequest(options, response));
} else {
new BleConnectRequest(options, response).onResponse(Code.REQUEST_OVERFLOW);
}
scheduleNextRequest(10);
</DeepExtract>
} | Android-BluetoothKit | positive | 2,732 |
public Extension getExtension(Char c, int style) {
Typeface f = c.getFont();
int fc = c.getFontCode();
float s;
if (style < TeXConstants.STYLE_TEXT)
s = 1;
else if (style < TeXConstants.STYLE_SCRIPT)
s = generalSettings.get("textfactor").floatValue();
else if (style < TeXConstants.STYLE_SCRIPT_SCRIPT)
s = generalSettings.get("scriptfactor").floatValue();
else
s = generalSettings.get("scriptscriptfactor").floatValue();
FontInfo info = fontInfo[fc];
int[] ext = info.getExtension(c.getChar());
Char[] parts = new Char[ext.length];
for (int i = 0; i < ext.length; i++) {
if (ext[i] == NONE) {
parts[i] = null;
} else {
parts[i] = new Char((char) ext[i], f, fc, getMetrics(new CharFont((char) ext[i], fc), s));
}
}
return new Extension(parts[TOP], parts[MID], parts[REP], parts[BOT]);
} | public Extension getExtension(Char c, int style) {
Typeface f = c.getFont();
int fc = c.getFontCode();
<DeepExtract>
float s;
if (style < TeXConstants.STYLE_TEXT)
s = 1;
else if (style < TeXConstants.STYLE_SCRIPT)
s = generalSettings.get("textfactor").floatValue();
else if (style < TeXConstants.STYLE_SCRIPT_SCRIPT)
s = generalSettings.get("scriptfactor").floatValue();
else
s = generalSettings.get("scriptscriptfactor").floatValue();
</DeepExtract>
FontInfo info = fontInfo[fc];
int[] ext = info.getExtension(c.getChar());
Char[] parts = new Char[ext.length];
for (int i = 0; i < ext.length; i++) {
if (ext[i] == NONE) {
parts[i] = null;
} else {
parts[i] = new Char((char) ext[i], f, fc, getMetrics(new CharFont((char) ext[i], fc), s));
}
}
return new Extension(parts[TOP], parts[MID], parts[REP], parts[BOT]);
} | jlatexmath-android | positive | 2,733 |
public void addEntity(Entity unit) {
if ((unit.getCurrentPosition().getTileY() >= 0) && (unit.getCurrentPosition().getTileX() >= 0) && (unit.getCurrentPosition().getTileX() <= getWidth()) && (unit.getCurrentPosition().getTileY() <= getHeight())) {
final int originalScore = stateOfField[unit.getCurrentPosition().getTileX()][unit.getCurrentPosition().getTileY()].getScore();
final int newScore = unit.getScore();
final int difference = newScore - originalScore;
score += difference;
stateOfField[unit.getCurrentPosition().getTileX()][unit.getCurrentPosition().getTileY()].setUnit(unit);
stateOfField[unit.getCurrentPosition().getTileX()][unit.getCurrentPosition().getTileY()].setOccupied(true);
units.put(unit.getEntityID(), unit);
unit.setOnlyCurrentPosition(new TiledMapPosition().setPositionFromTiles(unit.getCurrentPosition().getTileX(), unit.getCurrentPosition().getTileY()));
}
} | public void addEntity(Entity unit) {
<DeepExtract>
if ((unit.getCurrentPosition().getTileY() >= 0) && (unit.getCurrentPosition().getTileX() >= 0) && (unit.getCurrentPosition().getTileX() <= getWidth()) && (unit.getCurrentPosition().getTileY() <= getHeight())) {
final int originalScore = stateOfField[unit.getCurrentPosition().getTileX()][unit.getCurrentPosition().getTileY()].getScore();
final int newScore = unit.getScore();
final int difference = newScore - originalScore;
score += difference;
stateOfField[unit.getCurrentPosition().getTileX()][unit.getCurrentPosition().getTileY()].setUnit(unit);
stateOfField[unit.getCurrentPosition().getTileX()][unit.getCurrentPosition().getTileY()].setOccupied(true);
units.put(unit.getEntityID(), unit);
unit.setOnlyCurrentPosition(new TiledMapPosition().setPositionFromTiles(unit.getCurrentPosition().getTileX(), unit.getCurrentPosition().getTileY()));
}
</DeepExtract>
} | Norii | positive | 2,734 |
private <C extends DomainEvent> Boolean isEventMessageOfType(Message m, Class<C> expectedDomainEventClass) {
return m.getHeader(EventMessageHeaders.EVENT_TYPE).map(ct -> ct.equals(expectedDomainEventClass.getName())).orElse(false);
} | private <C extends DomainEvent> Boolean isEventMessageOfType(Message m, Class<C> expectedDomainEventClass) {
<DeepExtract>
return m.getHeader(EventMessageHeaders.EVENT_TYPE).map(ct -> ct.equals(expectedDomainEventClass.getName())).orElse(false);
</DeepExtract>
} | eventuate-tram-core | positive | 2,735 |
public static boolean moveDir(final File srcDir, final File destDir, final OnReplaceListener listener) {
return copyOrMoveDir(getFileByPath(srcDir), getFileByPath(destDir), listener, true);
} | public static boolean moveDir(final File srcDir, final File destDir, final OnReplaceListener listener) {
<DeepExtract>
return copyOrMoveDir(getFileByPath(srcDir), getFileByPath(destDir), listener, true);
</DeepExtract>
} | CommonUtils | positive | 2,736 |
private void working() {
if (rootDir == null || !rootDir.exists())
return;
if (rootDir.isFile()) {
try {
curScan.put(rootDir.getCanonicalPath(), new TimeSize(rootDir.lastModified(), rootDir.length()));
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
} else if (rootDir.isDirectory()) {
File[] fs = rootDir.listFiles();
if (fs != null)
for (File f : fs) scan(f);
}
if (preScan.size() == 0)
return;
if (!preScan.equals(curScan))
onChange();
preScan.clear();
preScan.putAll(curScan);
curScan.clear();
} | private void working() {
if (rootDir == null || !rootDir.exists())
return;
if (rootDir.isFile()) {
try {
curScan.put(rootDir.getCanonicalPath(), new TimeSize(rootDir.lastModified(), rootDir.length()));
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
} else if (rootDir.isDirectory()) {
File[] fs = rootDir.listFiles();
if (fs != null)
for (File f : fs) scan(f);
}
<DeepExtract>
if (preScan.size() == 0)
return;
if (!preScan.equals(curScan))
onChange();
</DeepExtract>
preScan.clear();
preScan.putAll(curScan);
curScan.clear();
} | ICERest | positive | 2,738 |
@SuppressWarnings("unused")
public Boolean getPositionAccurate() {
return getDecodedValue(() -> positionAccuracy, value -> positionAccuracy = value, () -> Boolean.TRUE, () -> BOOLEAN_DECODER.apply(getBits(56, 57)));
} | @SuppressWarnings("unused")
public Boolean getPositionAccurate() {
<DeepExtract>
return getDecodedValue(() -> positionAccuracy, value -> positionAccuracy = value, () -> Boolean.TRUE, () -> BOOLEAN_DECODER.apply(getBits(56, 57)));
</DeepExtract>
} | aismessages | positive | 2,739 |
private void addIngestionResource(String resourceTypeName, String storageUrl) throws URISyntaxException {
ResourceType resourceType;
for (ResourceType resourceType : values()) {
if (resourceType.resourceTypeName.equalsIgnoreCase(resourceTypeName)) {
resourceType = resourceType;
}
}
throw new IllegalArgumentException(resourceTypeName);
switch(resourceType) {
case TEMP_STORAGE:
this.containers.addResource(new ContainerWithSas(storageUrl, httpClient));
break;
case INGESTIONS_STATUS_TABLE:
this.statusTable.addResource(new TableWithSas(storageUrl, httpClient));
break;
case SECURED_READY_FOR_AGGREGATION_QUEUE:
this.queues.addResource(new QueueWithSas(storageUrl, httpClient, this.queueRequestOptions));
break;
case SUCCESSFUL_INGESTIONS_QUEUE:
this.successfulIngestionsQueues.addResource(new QueueWithSas(storageUrl, httpClient, this.queueRequestOptions));
break;
case FAILED_INGESTIONS_QUEUE:
this.failedIngestionsQueues.addResource(new QueueWithSas(storageUrl, httpClient, this.queueRequestOptions));
break;
default:
throw new IllegalStateException("Unexpected value: " + resourceType);
}
} | private void addIngestionResource(String resourceTypeName, String storageUrl) throws URISyntaxException {
<DeepExtract>
ResourceType resourceType;
for (ResourceType resourceType : values()) {
if (resourceType.resourceTypeName.equalsIgnoreCase(resourceTypeName)) {
resourceType = resourceType;
}
}
throw new IllegalArgumentException(resourceTypeName);
</DeepExtract>
switch(resourceType) {
case TEMP_STORAGE:
this.containers.addResource(new ContainerWithSas(storageUrl, httpClient));
break;
case INGESTIONS_STATUS_TABLE:
this.statusTable.addResource(new TableWithSas(storageUrl, httpClient));
break;
case SECURED_READY_FOR_AGGREGATION_QUEUE:
this.queues.addResource(new QueueWithSas(storageUrl, httpClient, this.queueRequestOptions));
break;
case SUCCESSFUL_INGESTIONS_QUEUE:
this.successfulIngestionsQueues.addResource(new QueueWithSas(storageUrl, httpClient, this.queueRequestOptions));
break;
case FAILED_INGESTIONS_QUEUE:
this.failedIngestionsQueues.addResource(new QueueWithSas(storageUrl, httpClient, this.queueRequestOptions));
break;
default:
throw new IllegalStateException("Unexpected value: " + resourceType);
}
} | azure-kusto-java | positive | 2,740 |
public void engineInitDecrypt(byte[] key) throws CryptoException {
if (key == null)
throw new CryptoException(getAlgorithm() + ": Null user key");
int len = key.length;
if (len == 0)
throw new CryptoException(getAlgorithm() + ": Invalid user key length");
x = y = 0;
for (int i = 0; i < 256; i++) sBox[i] = i;
int i1 = 0, i2 = 0, t;
for (int i = 0; i < 256; i++) {
i2 = ((key[i1] & 0xFF) + sBox[i] + i2) & 0xFF;
t = sBox[i];
sBox[i] = sBox[i2];
sBox[i2] = t;
i1 = (i1 + 1) % len;
}
state = ENCRYPT;
} | public void engineInitDecrypt(byte[] key) throws CryptoException {
<DeepExtract>
if (key == null)
throw new CryptoException(getAlgorithm() + ": Null user key");
int len = key.length;
if (len == 0)
throw new CryptoException(getAlgorithm() + ": Invalid user key length");
x = y = 0;
for (int i = 0; i < 256; i++) sBox[i] = i;
int i1 = 0, i2 = 0, t;
for (int i = 0; i < 256; i++) {
i2 = ((key[i1] & 0xFF) + sBox[i] + i2) & 0xFF;
t = sBox[i];
sBox[i] = sBox[i2];
sBox[i2] = t;
i1 = (i1 + 1) % len;
}
</DeepExtract>
state = ENCRYPT;
} | JavaRDP | positive | 2,741 |
public String getDockerHubUrl() {
String name = dockerHubUrl.getName();
T tValue = dockerHubUrl.getValue();
Class<T> type = dockerHubUrl.getType();
return resolver(name, tValue, type);
} | public String getDockerHubUrl() {
<DeepExtract>
String name = dockerHubUrl.getName();
T tValue = dockerHubUrl.getValue();
Class<T> type = dockerHubUrl.getType();
return resolver(name, tValue, type);
</DeepExtract>
} | webdrivermanager | positive | 2,742 |
@Test
public void onDSTOffsetReceived_invalid() {
final Data data = new Data(new byte[] { 17 });
success = false;
invalidData = false;
result = null;
super.onDataReceived(null, data);
assertTrue(invalidData);
} | @Test
public void onDSTOffsetReceived_invalid() {
final Data data = new Data(new byte[] { 17 });
<DeepExtract>
success = false;
invalidData = false;
result = null;
super.onDataReceived(null, data);
</DeepExtract>
assertTrue(invalidData);
} | Android-BLE-Common-Library | positive | 2,743 |
public Criteria andPositionGreaterThanOrEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "position" + " cannot be null");
}
criteria.add(new Criterion("position >=", value));
return (Criteria) this;
} | public Criteria andPositionGreaterThanOrEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "position" + " cannot be null");
}
criteria.add(new Criterion("position >=", value));
</DeepExtract>
return (Criteria) this;
} | tools-bar | positive | 2,745 |
public Criteria andMessageNotIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "message" + " cannot be null");
}
criteria.add(new Criterion("message not in", values));
return (Criteria) this;
} | public Criteria andMessageNotIn(List<String> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "message" + " cannot be null");
}
criteria.add(new Criterion("message not in", values));
</DeepExtract>
return (Criteria) this;
} | cloud | positive | 2,746 |
public static void write(boolean x) {
buffer <<= 1;
if (x)
buffer |= 1;
N++;
if (N == 8)
clearBuffer();
} | public static void write(boolean x) {
<DeepExtract>
buffer <<= 1;
if (x)
buffer |= 1;
N++;
if (N == 8)
clearBuffer();
</DeepExtract>
} | java_jail | positive | 2,747 |
public Criteria andUserNumberIsNotNull() {
if ("user_number is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("user_number is not null"));
return (Criteria) this;
} | public Criteria andUserNumberIsNotNull() {
<DeepExtract>
if ("user_number is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("user_number is not null"));
</DeepExtract>
return (Criteria) this;
} | SSM_BookSystem | positive | 2,748 |
@ResponseBody
@ExceptionHandler(value = IOException.class)
public ResponseEntity exceptionHandler(IOException exc) {
log.error("catch IOException: []", exc);
RetCode errorDetail;
RetCode response = ErrorCodeHandleUtils.handleErrorMsg(exc.getMessage());
if (response == null) {
errorDetail = new RetCode(500, exc.getMessage());
} else {
errorDetail = response;
}
Map<String, Object> map = new HashMap<>();
map.put("errorMessage", errorDetail.getMessage());
map.put("code", errorDetail.getCode());
log.warn("bindExceptionHandler return:{}", JsonUtils.toJSONString(map));
return ResponseEntity.status(500).body(map);
} | @ResponseBody
@ExceptionHandler(value = IOException.class)
public ResponseEntity exceptionHandler(IOException exc) {
log.error("catch IOException: []", exc);
<DeepExtract>
RetCode errorDetail;
RetCode response = ErrorCodeHandleUtils.handleErrorMsg(exc.getMessage());
if (response == null) {
errorDetail = new RetCode(500, exc.getMessage());
} else {
errorDetail = response;
}
</DeepExtract>
Map<String, Object> map = new HashMap<>();
map.put("errorMessage", errorDetail.getMessage());
map.put("code", errorDetail.getCode());
log.warn("bindExceptionHandler return:{}", JsonUtils.toJSONString(map));
return ResponseEntity.status(500).body(map);
} | WeBASE-Front | positive | 2,749 |
@Test
public void testServiceGet() throws SparkAPIClientException {
c.stubGet("/listings/20060725224713296297000000", "listing.json", 200);
ListingService s = new ListingService(c);
assertEquals("20060725224713296297000000", s.get("20060725224713296297000000").getId());
assertEquals("Bonners Ferry", s.get("20060725224713296297000000").getStandardFields().getCity());
assertEquals(s.get("20060725224713296297000000").getId(), s.get("20060725224713296297000000").getStandardFields().getListingKey());
assertEquals(0, s.get("20060725224713296297000000").getAttributes().size());
assertEquals(0, s.get("20060725224713296297000000").getStandardFields().getAttributes().size());
} | @Test
public void testServiceGet() throws SparkAPIClientException {
c.stubGet("/listings/20060725224713296297000000", "listing.json", 200);
ListingService s = new ListingService(c);
<DeepExtract>
assertEquals("20060725224713296297000000", s.get("20060725224713296297000000").getId());
assertEquals("Bonners Ferry", s.get("20060725224713296297000000").getStandardFields().getCity());
assertEquals(s.get("20060725224713296297000000").getId(), s.get("20060725224713296297000000").getStandardFields().getListingKey());
assertEquals(0, s.get("20060725224713296297000000").getAttributes().size());
assertEquals(0, s.get("20060725224713296297000000").getStandardFields().getAttributes().size());
</DeepExtract>
} | SparkJava | positive | 2,750 |
@Test
public void checkHelloObservable(TestContext context) {
checkRequest(200, "onetwo", "/hello-observable", context, null);
} | @Test
public void checkHelloObservable(TestContext context) {
<DeepExtract>
checkRequest(200, "onetwo", "/hello-observable", context, null);
</DeepExtract>
} | redpipe | positive | 2,751 |
public static void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_LAPS);
db.execSQL("CREATE TABLE " + TABLE_LAPS + " (" + COLUMN_ID + " INTEGER PRIMARY KEY, " + COLUMN_T1 + " INTEGER NOT NULL, " + COLUMN_T2 + " INTEGER NOT NULL, " + COLUMN_PAUSE_TIME + " INTEGER NOT NULL, " + COLUMN_TOTAL_TIME_TEXT + " TEXT);");
} | public static void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_LAPS);
<DeepExtract>
db.execSQL("CREATE TABLE " + TABLE_LAPS + " (" + COLUMN_ID + " INTEGER PRIMARY KEY, " + COLUMN_T1 + " INTEGER NOT NULL, " + COLUMN_T2 + " INTEGER NOT NULL, " + COLUMN_PAUSE_TIME + " INTEGER NOT NULL, " + COLUMN_TOTAL_TIME_TEXT + " TEXT);");
</DeepExtract>
} | ClockPlus | positive | 2,752 |
public Criteria andPidLessThan(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "pid" + " cannot be null");
}
criteria.add(new Criterion("pid <", value));
return (Criteria) this;
} | public Criteria andPidLessThan(Integer value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "pid" + " cannot be null");
}
criteria.add(new Criterion("pid <", value));
</DeepExtract>
return (Criteria) this;
} | ssmxiaomi | positive | 2,753 |
public String getDockerBrowserTwilioImageFormat() {
String name = dockerBrowserTwilioImageFormat.getName();
T tValue = dockerBrowserTwilioImageFormat.getValue();
Class<T> type = dockerBrowserTwilioImageFormat.getType();
return resolver(name, tValue, type);
} | public String getDockerBrowserTwilioImageFormat() {
<DeepExtract>
String name = dockerBrowserTwilioImageFormat.getName();
T tValue = dockerBrowserTwilioImageFormat.getValue();
Class<T> type = dockerBrowserTwilioImageFormat.getType();
return resolver(name, tValue, type);
</DeepExtract>
} | webdrivermanager | positive | 2,754 |
public void onStartTrackingTouch(SeekBar bar) {
mDragging = true;
if (!mShowing && mAnchor != null && mAnchor.getWindowToken() != null) {
if (mPauseButton != null)
mPauseButton.requestFocus();
if (mFromXml) {
setVisibility(View.VISIBLE);
} else {
int[] location = new int[2];
mAnchor.getLocationOnScreen(location);
Rect anchorRect = new Rect(location[0], location[1], location[0] + mAnchor.getWidth(), location[1] + mAnchor.getHeight());
mWindow.setAnimationStyle(mAnimStyle);
setWindowLayoutType();
mWindow.showAtLocation(mAnchor, Gravity.NO_GRAVITY, anchorRect.left, anchorRect.bottom);
}
mShowing = true;
if (mShownListener != null)
mShownListener.onShown();
}
updatePausePlay();
mHandler.sendEmptyMessage(SHOW_PROGRESS);
if (3600000 != 0) {
mHandler.removeMessages(FADE_OUT);
mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), 3600000);
}
mHandler.removeMessages(SHOW_PROGRESS);
if (mInstantSeeking)
mAM.setStreamMute(AudioManager.STREAM_MUSIC, true);
if (mInfoView != null) {
mInfoView.setText("");
mInfoView.setVisibility(View.VISIBLE);
}
} | public void onStartTrackingTouch(SeekBar bar) {
mDragging = true;
<DeepExtract>
if (!mShowing && mAnchor != null && mAnchor.getWindowToken() != null) {
if (mPauseButton != null)
mPauseButton.requestFocus();
if (mFromXml) {
setVisibility(View.VISIBLE);
} else {
int[] location = new int[2];
mAnchor.getLocationOnScreen(location);
Rect anchorRect = new Rect(location[0], location[1], location[0] + mAnchor.getWidth(), location[1] + mAnchor.getHeight());
mWindow.setAnimationStyle(mAnimStyle);
setWindowLayoutType();
mWindow.showAtLocation(mAnchor, Gravity.NO_GRAVITY, anchorRect.left, anchorRect.bottom);
}
mShowing = true;
if (mShownListener != null)
mShownListener.onShown();
}
updatePausePlay();
mHandler.sendEmptyMessage(SHOW_PROGRESS);
if (3600000 != 0) {
mHandler.removeMessages(FADE_OUT);
mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT), 3600000);
}
</DeepExtract>
mHandler.removeMessages(SHOW_PROGRESS);
if (mInstantSeeking)
mAM.setStreamMute(AudioManager.STREAM_MUSIC, true);
if (mInfoView != null) {
mInfoView.setText("");
mInfoView.setVisibility(View.VISIBLE);
}
} | ListVideoViewBaseOnVitamio | positive | 2,755 |
public void execute() {
options.getLogFile().delete();
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().println("---------------------------------------------------------------");
ModelTest.getMainConsole().println("* *");
ModelTest.getMainConsole().println("* COMPUTATION OF LIKELIHOOD SCORES WITH PHYML *");
ModelTest.getMainConsole().println("* *");
ModelTest.getMainConsole().println("---------------------------------------------------------------");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().println("::Settings::");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().println(" Phyml version = " + PHYML_VERSION);
ModelTest.getMainConsole().println(" Phyml binary = " + phymlBinary.getName());
ModelTest.getMainConsole().println(" Phyml path = " + phymlBinary.getAbsolutePath().substring(0, phymlBinary.getAbsolutePath().lastIndexOf(File.separator)) + File.separator);
ModelTest.getMainConsole().println(" Candidate models = " + models.length);
ModelTest.getMainConsole().print(" number of substitution schemes = ");
if (options.getSubstTypeCode() == 0)
ModelTest.getMainConsole().println("3");
else if (options.getSubstTypeCode() == 1)
ModelTest.getMainConsole().println("5");
else if (options.getSubstTypeCode() == 2)
ModelTest.getMainConsole().println("7");
else
ModelTest.getMainConsole().println("11");
if (options.doF)
ModelTest.getMainConsole().println(" including models with equal/unequal base frequencies (+F)");
else
ModelTest.getMainConsole().println(" including only models with equal base frequencies");
if (options.doI)
ModelTest.getMainConsole().println(" including models with/without a proportion of invariable sites (+I)");
else
ModelTest.getMainConsole().println(" including only models without a proportion of invariable sites");
if (options.doG)
ModelTest.getMainConsole().println(" including models with/without rate variation among sites (+G)" + " (nCat = " + options.numGammaCat + ")");
else
ModelTest.getMainConsole().println(" including only models without rate variation among sites");
ModelTest.getMainConsole().print(" Optimized free parameters (K) =");
ModelTest.getMainConsole().print(" substitution parameters");
if (options.countBLasParameters)
ModelTest.getMainConsole().print(" + " + options.getNumBranches() + " branch lengths");
if (options.optimizeMLTopology)
ModelTest.getMainConsole().print(" + topology");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().print(" Base tree for likelihood calculations = ");
if (options.userTopologyExists) {
ModelTest.getMainConsole().println("fixed user tree topology.");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().print("User tree " + "(" + options.getInputTreeFile().getName() + ") = ");
ModelTest.getMainConsole().println(options.getUserTree());
ModelTest.getMainConsole().println(" ");
} else if (options.fixedTopology) {
ModelTest.getMainConsole().println("fixed BIONJ-JC tree topology");
} else if (options.optimizeMLTopology) {
ModelTest.getMainConsole().println("ML tree");
} else {
ModelTest.getMainConsole().println("BIONJ tree");
}
if (options.optimizeMLTopology) {
ModelTest.getMainConsole().print(" Tree topology search operation = ");
switch(options.treeSearchOperations) {
case NNI:
ModelTest.getMainConsole().println("NNI");
break;
case SPR:
ModelTest.getMainConsole().println("SPR");
break;
case BEST:
ModelTest.getMainConsole().println("BEST");
break;
}
}
if (options.isClusteringSearch()) {
ModelTest.getMainConsole().println(" Using hill-climbing hierarchical clustering");
}
if (options.isGuidedSearch()) {
ModelTest.getMainConsole().println(" Using heuristic model filtering ");
}
ModelTest.getMainConsole().println(" ");
if (options.doI && options.doG) {
searchFor = "GTR+I+G";
gtrParams = 10;
} else if (options.doI) {
searchFor = "GTR+I";
gtrParams = 9;
} else if (options.doG) {
searchFor = "GTR+G";
gtrParams = 9;
} else {
searchFor = "GTR";
gtrParams = 8;
}
for (int i = (models.length - 1); i >= 0; i--) {
if (models[i].getName().startsWith(searchFor)) {
gtrModel = models[i];
break;
}
}
if (gtrModel == null) {
gtrModel = new Model(0, searchFor, "012345", gtrParams, false, false, false, true, options.doI, options.doG, 2, 4);
}
if (options.fixedTopology) {
Model jcModel = null;
for (Model model : models) {
if (model.getName().equals("JC")) {
jcModel = model;
break;
}
}
if (jcModel != null) {
notifyObservers(ProgressInfo.BASE_TREE_INIT, 0, jcModel, null);
PhymlSingleModel jcModelPhyml = new PhymlSingleModel(jcModel, 0, true, false, options);
jcModelPhyml.addObserver(this);
jcModelPhyml.run();
TextOutputStream JCtreeFile = new TextOutputStream(options.getTreeFile().getAbsolutePath(), false);
JCtreeFile.print(jcModel.getTreeString() + "\n");
JCtreeFile.close();
notifyObservers(ProgressInfo.BASE_TREE_COMPUTED, 0, jcModel, null);
}
}
if (options.isGuidedSearch()) {
if (gtrModel != null) {
notifyObservers(ProgressInfo.GTR_OPTIMIZATION_INIT, models.length, gtrModel, null);
PhymlSingleModel gtrPhymlModel = new PhymlSingleModel(gtrModel, 0, false, false, options);
gtrPhymlModel.run();
notifyObservers(ProgressInfo.GTR_OPTIMIZATION_COMPLETED, models.length, gtrModel, null);
GuidedSearchManager gsm = new GuidedSearchManager(options.getGuidedSearchThreshold(), gtrModel, filterFrequencies, filterRateMatrix, filterRateVariation);
models = gsm.filterModels(models);
ModelTest.setCandidateModels(models);
} else {
notifyObservers(ProgressInfo.GTR_NOT_FOUND, models.length, models[0], null);
}
}
setChanged();
notifyObservers(new ProgressInfo(ProgressInfo.OPTIMIZATION_INIT, 0, models[0], null));
doPhyml();
} | public void execute() {
options.getLogFile().delete();
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().println("---------------------------------------------------------------");
ModelTest.getMainConsole().println("* *");
ModelTest.getMainConsole().println("* COMPUTATION OF LIKELIHOOD SCORES WITH PHYML *");
ModelTest.getMainConsole().println("* *");
ModelTest.getMainConsole().println("---------------------------------------------------------------");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().println("::Settings::");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().println(" Phyml version = " + PHYML_VERSION);
ModelTest.getMainConsole().println(" Phyml binary = " + phymlBinary.getName());
ModelTest.getMainConsole().println(" Phyml path = " + phymlBinary.getAbsolutePath().substring(0, phymlBinary.getAbsolutePath().lastIndexOf(File.separator)) + File.separator);
ModelTest.getMainConsole().println(" Candidate models = " + models.length);
ModelTest.getMainConsole().print(" number of substitution schemes = ");
if (options.getSubstTypeCode() == 0)
ModelTest.getMainConsole().println("3");
else if (options.getSubstTypeCode() == 1)
ModelTest.getMainConsole().println("5");
else if (options.getSubstTypeCode() == 2)
ModelTest.getMainConsole().println("7");
else
ModelTest.getMainConsole().println("11");
if (options.doF)
ModelTest.getMainConsole().println(" including models with equal/unequal base frequencies (+F)");
else
ModelTest.getMainConsole().println(" including only models with equal base frequencies");
if (options.doI)
ModelTest.getMainConsole().println(" including models with/without a proportion of invariable sites (+I)");
else
ModelTest.getMainConsole().println(" including only models without a proportion of invariable sites");
if (options.doG)
ModelTest.getMainConsole().println(" including models with/without rate variation among sites (+G)" + " (nCat = " + options.numGammaCat + ")");
else
ModelTest.getMainConsole().println(" including only models without rate variation among sites");
ModelTest.getMainConsole().print(" Optimized free parameters (K) =");
ModelTest.getMainConsole().print(" substitution parameters");
if (options.countBLasParameters)
ModelTest.getMainConsole().print(" + " + options.getNumBranches() + " branch lengths");
if (options.optimizeMLTopology)
ModelTest.getMainConsole().print(" + topology");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().print(" Base tree for likelihood calculations = ");
if (options.userTopologyExists) {
ModelTest.getMainConsole().println("fixed user tree topology.");
ModelTest.getMainConsole().println(" ");
ModelTest.getMainConsole().print("User tree " + "(" + options.getInputTreeFile().getName() + ") = ");
ModelTest.getMainConsole().println(options.getUserTree());
ModelTest.getMainConsole().println(" ");
} else if (options.fixedTopology) {
ModelTest.getMainConsole().println("fixed BIONJ-JC tree topology");
} else if (options.optimizeMLTopology) {
ModelTest.getMainConsole().println("ML tree");
} else {
ModelTest.getMainConsole().println("BIONJ tree");
}
if (options.optimizeMLTopology) {
ModelTest.getMainConsole().print(" Tree topology search operation = ");
switch(options.treeSearchOperations) {
case NNI:
ModelTest.getMainConsole().println("NNI");
break;
case SPR:
ModelTest.getMainConsole().println("SPR");
break;
case BEST:
ModelTest.getMainConsole().println("BEST");
break;
}
}
if (options.isClusteringSearch()) {
ModelTest.getMainConsole().println(" Using hill-climbing hierarchical clustering");
}
if (options.isGuidedSearch()) {
ModelTest.getMainConsole().println(" Using heuristic model filtering ");
}
ModelTest.getMainConsole().println(" ");
if (options.doI && options.doG) {
searchFor = "GTR+I+G";
gtrParams = 10;
} else if (options.doI) {
searchFor = "GTR+I";
gtrParams = 9;
} else if (options.doG) {
searchFor = "GTR+G";
gtrParams = 9;
} else {
searchFor = "GTR";
gtrParams = 8;
}
for (int i = (models.length - 1); i >= 0; i--) {
if (models[i].getName().startsWith(searchFor)) {
gtrModel = models[i];
break;
}
}
if (gtrModel == null) {
gtrModel = new Model(0, searchFor, "012345", gtrParams, false, false, false, true, options.doI, options.doG, 2, 4);
}
if (options.fixedTopology) {
Model jcModel = null;
for (Model model : models) {
if (model.getName().equals("JC")) {
jcModel = model;
break;
}
}
if (jcModel != null) {
notifyObservers(ProgressInfo.BASE_TREE_INIT, 0, jcModel, null);
PhymlSingleModel jcModelPhyml = new PhymlSingleModel(jcModel, 0, true, false, options);
jcModelPhyml.addObserver(this);
jcModelPhyml.run();
TextOutputStream JCtreeFile = new TextOutputStream(options.getTreeFile().getAbsolutePath(), false);
JCtreeFile.print(jcModel.getTreeString() + "\n");
JCtreeFile.close();
notifyObservers(ProgressInfo.BASE_TREE_COMPUTED, 0, jcModel, null);
}
}
if (options.isGuidedSearch()) {
if (gtrModel != null) {
notifyObservers(ProgressInfo.GTR_OPTIMIZATION_INIT, models.length, gtrModel, null);
PhymlSingleModel gtrPhymlModel = new PhymlSingleModel(gtrModel, 0, false, false, options);
gtrPhymlModel.run();
notifyObservers(ProgressInfo.GTR_OPTIMIZATION_COMPLETED, models.length, gtrModel, null);
GuidedSearchManager gsm = new GuidedSearchManager(options.getGuidedSearchThreshold(), gtrModel, filterFrequencies, filterRateMatrix, filterRateVariation);
models = gsm.filterModels(models);
ModelTest.setCandidateModels(models);
} else {
notifyObservers(ProgressInfo.GTR_NOT_FOUND, models.length, models[0], null);
}
}
<DeepExtract>
setChanged();
notifyObservers(new ProgressInfo(ProgressInfo.OPTIMIZATION_INIT, 0, models[0], null));
</DeepExtract>
doPhyml();
} | jmodeltest2 | positive | 2,756 |
public static void info(String format, Object... data) {
logger.log(Level.INFO, format, data);
} | public static void info(String format, Object... data) {
<DeepExtract>
logger.log(Level.INFO, format, data);
</DeepExtract>
} | carpentersblocks | positive | 2,757 |
public void run() {
final EditText promptInput = new EditText(cordova.getActivity());
Resources resources = cordova.getActivity().getResources();
int promptInputTextColor = resources.getColor(android.R.color.primary_text_light);
promptInput.setTextColor(promptInputTextColor);
promptInput.setText(defaultText);
AlertDialog.Builder dlg;
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
dlg = new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
} else {
dlg = new AlertDialog.Builder(cordova.getActivity());
}
dlg.setMessage(message);
dlg.setTitle(title);
dlg.setCancelable(true);
dlg.setView(promptInput);
final JSONObject result = new JSONObject();
if (buttonLabels.length() > 0) {
try {
dlg.setNegativeButton(buttonLabels.getString(0), new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
try {
result.put("buttonIndex", 1);
result.put("input1", promptInput.getText().toString().trim().length() == 0 ? defaultText : promptInput.getText());
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on first button.", e);
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
}
});
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on first button.");
}
}
if (buttonLabels.length() > 1) {
try {
dlg.setNeutralButton(buttonLabels.getString(1), new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
try {
result.put("buttonIndex", 2);
result.put("input1", promptInput.getText().toString().trim().length() == 0 ? defaultText : promptInput.getText());
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on second button.", e);
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
}
});
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on second button.");
}
}
if (buttonLabels.length() > 2) {
try {
dlg.setPositiveButton(buttonLabels.getString(2), new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
try {
result.put("buttonIndex", 3);
result.put("input1", promptInput.getText().toString().trim().length() == 0 ? defaultText : promptInput.getText());
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on third button.", e);
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
}
});
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on third button.");
}
}
dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
dialog.dismiss();
try {
result.put("buttonIndex", 0);
result.put("input1", promptInput.getText().toString().trim().length() == 0 ? defaultText : promptInput.getText());
} catch (JSONException e) {
e.printStackTrace();
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
}
});
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
dlg.create();
AlertDialog dialog = dlg.show();
if (currentapiVersion >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
TextView messageview = (TextView) dialog.findViewById(android.R.id.message);
messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE);
}
} | public void run() {
final EditText promptInput = new EditText(cordova.getActivity());
Resources resources = cordova.getActivity().getResources();
int promptInputTextColor = resources.getColor(android.R.color.primary_text_light);
promptInput.setTextColor(promptInputTextColor);
promptInput.setText(defaultText);
AlertDialog.Builder dlg;
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
dlg = new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
} else {
dlg = new AlertDialog.Builder(cordova.getActivity());
}
dlg.setMessage(message);
dlg.setTitle(title);
dlg.setCancelable(true);
dlg.setView(promptInput);
final JSONObject result = new JSONObject();
if (buttonLabels.length() > 0) {
try {
dlg.setNegativeButton(buttonLabels.getString(0), new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
try {
result.put("buttonIndex", 1);
result.put("input1", promptInput.getText().toString().trim().length() == 0 ? defaultText : promptInput.getText());
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on first button.", e);
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
}
});
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on first button.");
}
}
if (buttonLabels.length() > 1) {
try {
dlg.setNeutralButton(buttonLabels.getString(1), new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
try {
result.put("buttonIndex", 2);
result.put("input1", promptInput.getText().toString().trim().length() == 0 ? defaultText : promptInput.getText());
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on second button.", e);
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
}
});
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on second button.");
}
}
if (buttonLabels.length() > 2) {
try {
dlg.setPositiveButton(buttonLabels.getString(2), new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
try {
result.put("buttonIndex", 3);
result.put("input1", promptInput.getText().toString().trim().length() == 0 ? defaultText : promptInput.getText());
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on third button.", e);
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
}
});
} catch (JSONException e) {
LOG.d(LOG_TAG, "JSONException on third button.");
}
}
dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
dialog.dismiss();
try {
result.put("buttonIndex", 0);
result.put("input1", promptInput.getText().toString().trim().length() == 0 ? defaultText : promptInput.getText());
} catch (JSONException e) {
e.printStackTrace();
}
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
}
});
<DeepExtract>
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
dlg.create();
AlertDialog dialog = dlg.show();
if (currentapiVersion >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
TextView messageview = (TextView) dialog.findViewById(android.R.id.message);
messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE);
}
</DeepExtract>
} | vuejs-cordova-sample | positive | 2,758 |
@Override
public List<GiteaRepository> fetchOrganizationRepositories(GiteaOwner owner) throws IOException, InterruptedException {
if (organizations.containsKey(owner.getUsername()) || users.containsKey(owner.getUsername())) {
List<GiteaRepository> result = new ArrayList<>();
for (Map.Entry<String, GiteaRepository> entry : repositories.entrySet()) {
if (entry.getKey().startsWith(owner.getUsername() + "/")) {
result.add(entry.getValue().clone());
}
}
return result;
}
return notFoundIfNull(null);
} | @Override
public List<GiteaRepository> fetchOrganizationRepositories(GiteaOwner owner) throws IOException, InterruptedException {
<DeepExtract>
if (organizations.containsKey(owner.getUsername()) || users.containsKey(owner.getUsername())) {
List<GiteaRepository> result = new ArrayList<>();
for (Map.Entry<String, GiteaRepository> entry : repositories.entrySet()) {
if (entry.getKey().startsWith(owner.getUsername() + "/")) {
result.add(entry.getValue().clone());
}
}
return result;
}
return notFoundIfNull(null);
</DeepExtract>
} | gitea-plugin | positive | 2,760 |
public void performPruning(double UB) throws ContradictionException {
double delta = UB - treeCost;
assert delta >= 0;
ISet nei;
for (int i = 0; i < n; i++) {
ccTp[i] = -1;
}
useful.clear();
useful.set(0);
ccTp[0] = 0;
int first = 0;
int last = first;
int k = 0;
fifo[last++] = k;
while (first < last) {
k = fifo[first++];
nei = Tree.getNeighOf(k);
for (int s : nei) {
if (ccTp[s] == -1) {
ccTp[s] = k;
map[s][k] = -1;
map[k][s] = -1;
if (!useful.get(s)) {
fifo[last++] = s;
useful.set(s);
}
}
}
}
if (selectRelevantArcs(delta)) {
lca.preprocess(cctRoot, ccTree);
pruning(delta);
}
} | public void performPruning(double UB) throws ContradictionException {
double delta = UB - treeCost;
assert delta >= 0;
<DeepExtract>
ISet nei;
for (int i = 0; i < n; i++) {
ccTp[i] = -1;
}
useful.clear();
useful.set(0);
ccTp[0] = 0;
int first = 0;
int last = first;
int k = 0;
fifo[last++] = k;
while (first < last) {
k = fifo[first++];
nei = Tree.getNeighOf(k);
for (int s : nei) {
if (ccTp[s] == -1) {
ccTp[s] = k;
map[s][k] = -1;
map[k][s] = -1;
if (!useful.get(s)) {
fifo[last++] = s;
useful.set(s);
}
}
}
}
</DeepExtract>
if (selectRelevantArcs(delta)) {
lca.preprocess(cctRoot, ccTree);
pruning(delta);
}
} | choco-graph | positive | 2,761 |
public static LocalDateTime parseDateDefaultStrToLocalDateTime(String text) {
Objects.requireNonNull(EEE_MMM_DD_HH_MM_SS_ZZZ_YYYY_FMT, "formatter");
LocalDateTime localDateTime = null;
try {
localDateTime = DateTimeConverterUtil.toLocalDateTime(EEE_MMM_DD_HH_MM_SS_ZZZ_YYYY_FMT.parse(text));
} catch (DateTimeException e) {
if (e.getMessage().startsWith(Constant.PARSE_LOCAL_DATE_EXCEPTION)) {
localDateTime = DateTimeConverterUtil.toLocalDateTime(LocalDate.parse(text, EEE_MMM_DD_HH_MM_SS_ZZZ_YYYY_FMT));
} else {
throw e;
}
}
return localDateTime;
} | public static LocalDateTime parseDateDefaultStrToLocalDateTime(String text) {
<DeepExtract>
Objects.requireNonNull(EEE_MMM_DD_HH_MM_SS_ZZZ_YYYY_FMT, "formatter");
LocalDateTime localDateTime = null;
try {
localDateTime = DateTimeConverterUtil.toLocalDateTime(EEE_MMM_DD_HH_MM_SS_ZZZ_YYYY_FMT.parse(text));
} catch (DateTimeException e) {
if (e.getMessage().startsWith(Constant.PARSE_LOCAL_DATE_EXCEPTION)) {
localDateTime = DateTimeConverterUtil.toLocalDateTime(LocalDate.parse(text, EEE_MMM_DD_HH_MM_SS_ZZZ_YYYY_FMT));
} else {
throw e;
}
}
return localDateTime;
</DeepExtract>
} | jstarcraft-nlp | positive | 2,762 |
public Set<String> getAllDPNNetIDs() {
Set<String> s = new HashSet<String>();
Cursor c = null;
try {
c = getReadableDatabase().rawQuery("SELECT network from dataPoint group by network", null);
} catch (Exception e) {
msg("Error during query. Q=" + "SELECT network from dataPoint group by network");
closeCursor(c);
return s;
}
if (c == null)
return s;
if (c.getCount() < 1) {
msg("Warning: No records found using Q=" + "SELECT network from dataPoint group by network");
} else {
c.moveToFirst();
}
String thisData = "";
while (!c.isAfterLast()) {
thisData = c.getString(0);
if (thisData.length() > 0)
s.add(thisData);
c.moveToNext();
}
closeCursor(c);
return s;
} | public Set<String> getAllDPNNetIDs() {
<DeepExtract>
Set<String> s = new HashSet<String>();
Cursor c = null;
try {
c = getReadableDatabase().rawQuery("SELECT network from dataPoint group by network", null);
} catch (Exception e) {
msg("Error during query. Q=" + "SELECT network from dataPoint group by network");
closeCursor(c);
return s;
}
if (c == null)
return s;
if (c.getCount() < 1) {
msg("Warning: No records found using Q=" + "SELECT network from dataPoint group by network");
} else {
c.moveToFirst();
}
String thisData = "";
while (!c.isAfterLast()) {
thisData = c.getString(0);
if (thisData.length() > 0)
s.add(thisData);
c.moveToNext();
}
closeCursor(c);
return s;
</DeepExtract>
} | libvoyager | positive | 2,763 |
public void smoothScrollBy(int distance, int duration) {
if (mFlingRunnable == null) {
mFlingRunnable = new FlingRunnable();
} else {
mFlingRunnable.endFling();
}
int initialY = distance < 0 ? Integer.MAX_VALUE : 0;
mLastFlingY = initialY;
mScroller.startScroll(0, initialY, 0, distance, duration);
mTouchMode = TOUCH_MODE_FLING;
post(this);
} | public void smoothScrollBy(int distance, int duration) {
if (mFlingRunnable == null) {
mFlingRunnable = new FlingRunnable();
} else {
mFlingRunnable.endFling();
}
<DeepExtract>
int initialY = distance < 0 ? Integer.MAX_VALUE : 0;
mLastFlingY = initialY;
mScroller.startScroll(0, initialY, 0, distance, duration);
mTouchMode = TOUCH_MODE_FLING;
post(this);
</DeepExtract>
} | mshopping-android | positive | 2,764 |
public Criteria andSCreateTimeIsNotNull() {
if ("s_create_time is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("s_create_time is not null"));
return (Criteria) this;
} | public Criteria andSCreateTimeIsNotNull() {
<DeepExtract>
if ("s_create_time is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("s_create_time is not null"));
</DeepExtract>
return (Criteria) this;
} | webike | positive | 2,765 |
public static void launchForAppInfo(Context context) {
Intent intent = new Intent(context, VoIPGRIDPortalWebActivity.class);
intent.putExtra(VoIPGRIDPortalWebActivity.TITLE, context.getString(R.string.info_menu_item_title));
intent.putExtra(VoIPGRIDPortalWebActivity.PAGE, context.getString(R.string.url_app_info));
context.startActivity(intent);
} | public static void launchForAppInfo(Context context) {
<DeepExtract>
Intent intent = new Intent(context, VoIPGRIDPortalWebActivity.class);
intent.putExtra(VoIPGRIDPortalWebActivity.TITLE, context.getString(R.string.info_menu_item_title));
intent.putExtra(VoIPGRIDPortalWebActivity.PAGE, context.getString(R.string.url_app_info));
context.startActivity(intent);
</DeepExtract>
} | vialer-android | positive | 2,766 |
public static void main(String[] args) {
int[] num = null;
int use = 0;
Scanner sc = new Scanner(System.in);
use = sc.nextInt();
if (!(use > 10)) {
num = new int[use];
}
for (int i = 0; i < num.length; i++) {
num[i] = sc.nextInt();
}
Arrays.sort(num);
for (int k = num.length - 1; k >= 0; k--) {
System.out.print(num[k] + " ");
}
} | public static void main(String[] args) {
int[] num = null;
int use = 0;
Scanner sc = new Scanner(System.in);
use = sc.nextInt();
if (!(use > 10)) {
num = new int[use];
}
for (int i = 0; i < num.length; i++) {
num[i] = sc.nextInt();
}
<DeepExtract>
Arrays.sort(num);
for (int k = num.length - 1; k >= 0; k--) {
System.out.print(num[k] + " ");
}
</DeepExtract>
} | OnAlSt | positive | 2,767 |
@Override
public Message createMessage() throws JMSException {
if (closed) {
throw new IllegalStateException("Session is closed");
}
connection.checkNotClosed();
return new PulsarSimpleMessage();
} | @Override
public Message createMessage() throws JMSException {
<DeepExtract>
if (closed) {
throw new IllegalStateException("Session is closed");
}
connection.checkNotClosed();
</DeepExtract>
return new PulsarSimpleMessage();
} | pulsar-jms | positive | 2,768 |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_register);
EventBus.getDefault().register(this);
ButterKnife.bind(this);
List<Fragment> lists = new ArrayList<>();
lists.add(new UserLoginFragment());
lists.add(new UserRegisterFragment());
mViewPager.setAdapter(new LoginRegisterPagerAdapter(getSupportFragmentManager(), lists));
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
public void onPageSelected(int position) {
switch(position) {
case 0:
showLoginFragment();
break;
case 1:
showRegisterFragment();
break;
}
}
public void onPageScrollStateChanged(int state) {
}
});
login_tv.setOnClickListener(this);
register_tv.setOnClickListener(this);
} | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_register);
EventBus.getDefault().register(this);
ButterKnife.bind(this);
List<Fragment> lists = new ArrayList<>();
lists.add(new UserLoginFragment());
lists.add(new UserRegisterFragment());
mViewPager.setAdapter(new LoginRegisterPagerAdapter(getSupportFragmentManager(), lists));
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
public void onPageSelected(int position) {
switch(position) {
case 0:
showLoginFragment();
break;
case 1:
showRegisterFragment();
break;
}
}
public void onPageScrollStateChanged(int state) {
}
});
<DeepExtract>
login_tv.setOnClickListener(this);
register_tv.setOnClickListener(this);
</DeepExtract>
} | CinemaTicket | positive | 2,769 |
public List getAncestors() {
if (getParent() == null)
return null;
List ancestors = new ArrayList();
Tree t = this;
return null;
while (t != null) {
ancestors.add(0, t);
t = t.getParent();
}
return ancestors;
} | public List getAncestors() {
if (getParent() == null)
<DeepExtract>
return null;
</DeepExtract>
List ancestors = new ArrayList();
Tree t = this;
<DeepExtract>
return null;
</DeepExtract>
while (t != null) {
ancestors.add(0, t);
t = t.getParent();
}
return ancestors;
} | jtcc | positive | 2,770 |
public Criteria andTradeIdNotIn(List<Integer> values) {
if (values == null) {
throw new RuntimeException("Value for " + "tradeId" + " cannot be null");
}
criteria.add(new Criterion("trade_id not in", values));
return (Criteria) this;
} | public Criteria andTradeIdNotIn(List<Integer> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "tradeId" + " cannot be null");
}
criteria.add(new Criterion("trade_id not in", values));
</DeepExtract>
return (Criteria) this;
} | springcloud-e-book | positive | 2,771 |
protected void attackEntity(Entity target) {
if (this.thrower != null)
this.thrower.getEntityData().setInt("LastHitSummonedSwords", this.getEntityId());
if (target != null) {
this.hitYaw = this.rotationYaw - target.rotationYaw;
this.hitPitch = this.rotationPitch - target.rotationPitch;
this.hitX = this.lastTickPosX - target.posX;
this.hitY = this.lastTickPosY - target.posY;
this.hitZ = this.lastTickPosZ - target.posZ;
this.ridingEntity2 = target;
this.ticksExisted = 0;
}
if (!this.world.isRemote) {
float magicDamage = Math.max(1.0f, AttackLevel);
target.hurtResistantTime = 0;
DamageSource ds = new EntityDamageSource("directMagic", this.getThrower()).setDamageBypassesArmor().setMagicDamage();
target.attackEntityFrom(ds, magicDamage);
if (!blade.isEmpty() && target instanceof EntityLivingBase && thrower != null && thrower instanceof EntityLivingBase) {
StylishRankManager.setNextAttackType(this.thrower, StylishRankManager.AttackTypes.PhantomSword);
((ItemSlashBlade) blade.getItem()).hitEntity(blade, (EntityLivingBase) target, (EntityLivingBase) thrower);
ReflectionAccessHelper.setVelocity(target, 0, 0, 0);
target.addVelocity(0.0, 0.1D, 0.0);
((EntityLivingBase) target).hurtTime = 1;
((ItemSlashBlade) blade.getItem()).setDaunting(((EntityLivingBase) target));
}
}
} | protected void attackEntity(Entity target) {
if (this.thrower != null)
this.thrower.getEntityData().setInt("LastHitSummonedSwords", this.getEntityId());
<DeepExtract>
if (target != null) {
this.hitYaw = this.rotationYaw - target.rotationYaw;
this.hitPitch = this.rotationPitch - target.rotationPitch;
this.hitX = this.lastTickPosX - target.posX;
this.hitY = this.lastTickPosY - target.posY;
this.hitZ = this.lastTickPosZ - target.posZ;
this.ridingEntity2 = target;
this.ticksExisted = 0;
}
</DeepExtract>
if (!this.world.isRemote) {
float magicDamage = Math.max(1.0f, AttackLevel);
target.hurtResistantTime = 0;
DamageSource ds = new EntityDamageSource("directMagic", this.getThrower()).setDamageBypassesArmor().setMagicDamage();
target.attackEntityFrom(ds, magicDamage);
if (!blade.isEmpty() && target instanceof EntityLivingBase && thrower != null && thrower instanceof EntityLivingBase) {
StylishRankManager.setNextAttackType(this.thrower, StylishRankManager.AttackTypes.PhantomSword);
((ItemSlashBlade) blade.getItem()).hitEntity(blade, (EntityLivingBase) target, (EntityLivingBase) thrower);
ReflectionAccessHelper.setVelocity(target, 0, 0, 0);
target.addVelocity(0.0, 0.1D, 0.0);
((EntityLivingBase) target).hurtTime = 1;
((ItemSlashBlade) blade.getItem()).setDaunting(((EntityLivingBase) target));
}
}
} | SlashBlade | positive | 2,772 |
public static boolean isShowing(View v) {
return v.getVisibility() == VISIBLE;
} | public static boolean isShowing(View v) {
<DeepExtract>
return v.getVisibility() == VISIBLE;
</DeepExtract>
} | EasyAndroid | positive | 2,773 |
protected void onQueueItemProcessed() {
if (queueCountBroadcastsAllowed()) {
Intent broadcast = new Intent(ACTION_QUEUE_COUNT);
broadcast.putExtra(EXTRA_QUEUE_COUNT, getQueueCount());
broadcast.putExtra(EXTRA_QUEUE_NAME, getQueueName());
Log.d(DEBUG_TAG, "Dispatching queue count...");
sendBroadcast(broadcast);
} else {
Log.d(DEBUG_TAG, "NOT dispatching queue count (queueCountRequestsAllowed() returned false)...");
}
} | protected void onQueueItemProcessed() {
<DeepExtract>
if (queueCountBroadcastsAllowed()) {
Intent broadcast = new Intent(ACTION_QUEUE_COUNT);
broadcast.putExtra(EXTRA_QUEUE_COUNT, getQueueCount());
broadcast.putExtra(EXTRA_QUEUE_NAME, getQueueName());
Log.d(DEBUG_TAG, "Dispatching queue count...");
sendBroadcast(broadcast);
} else {
Log.d(DEBUG_TAG, "NOT dispatching queue count (queueCountRequestsAllowed() returned false)...");
}
</DeepExtract>
} | geohashdroid | positive | 2,774 |
private void testPredictionsNoManifest(Channel inferChannel, Channel mgmtChannel) throws InterruptedException, NoSuchFieldException, IllegalAccessException {
Field f = configManager.getClass().getDeclaredField("prop");
f.setAccessible(true);
Properties p = (Properties) f.get(configManager);
p.setProperty("default_service_handler", "service:handle");
result = null;
latch = new CountDownLatch(1);
String url = "/models?url=" + "noop-no-manifest" + "&model_name=" + "nomanifest" + "&initial_workers=1&synchronous=true";
HttpRequest req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url);
mgmtChannel.writeAndFlush(req);
latch.await();
result = null;
latch = new CountDownLatch(1);
DefaultFullHttpRequest req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/predictions/nomanifest");
req.content().writeCharSequence("{\"data\": \"test\"}", CharsetUtil.UTF_8);
HttpUtil.setContentLength(req, req.content().readableBytes());
req.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.APPLICATION_JSON);
inferChannel.writeAndFlush(req);
latch.await();
Assert.assertEquals(httpStatus, HttpResponseStatus.OK);
Assert.assertEquals(result, "OK");
result = null;
latch = new CountDownLatch(1);
String expected = "Model \"" + "nomanifest" + "\" unregistered";
String url = "/models/" + "nomanifest";
HttpRequest req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.DELETE, url);
mgmtChannel.writeAndFlush(req);
latch.await();
StatusResponse resp = JsonUtils.GSON.fromJson(result, StatusResponse.class);
Assert.assertEquals(resp.getStatus(), expected);
} | private void testPredictionsNoManifest(Channel inferChannel, Channel mgmtChannel) throws InterruptedException, NoSuchFieldException, IllegalAccessException {
Field f = configManager.getClass().getDeclaredField("prop");
f.setAccessible(true);
Properties p = (Properties) f.get(configManager);
p.setProperty("default_service_handler", "service:handle");
result = null;
latch = new CountDownLatch(1);
String url = "/models?url=" + "noop-no-manifest" + "&model_name=" + "nomanifest" + "&initial_workers=1&synchronous=true";
HttpRequest req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, url);
mgmtChannel.writeAndFlush(req);
latch.await();
result = null;
latch = new CountDownLatch(1);
DefaultFullHttpRequest req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/predictions/nomanifest");
req.content().writeCharSequence("{\"data\": \"test\"}", CharsetUtil.UTF_8);
HttpUtil.setContentLength(req, req.content().readableBytes());
req.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.APPLICATION_JSON);
inferChannel.writeAndFlush(req);
latch.await();
Assert.assertEquals(httpStatus, HttpResponseStatus.OK);
Assert.assertEquals(result, "OK");
<DeepExtract>
result = null;
latch = new CountDownLatch(1);
String expected = "Model \"" + "nomanifest" + "\" unregistered";
String url = "/models/" + "nomanifest";
HttpRequest req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.DELETE, url);
mgmtChannel.writeAndFlush(req);
latch.await();
StatusResponse resp = JsonUtils.GSON.fromJson(result, StatusResponse.class);
Assert.assertEquals(resp.getStatus(), expected);
</DeepExtract>
} | multi-model-server | positive | 2,775 |
@Test(expected = IllegalStateException.class)
public void shouldFailToSubmitTwoTimesTheSameTask() {
mAwex = new Awex(mThreadHelper, new ConsoleLogger(), new LinearWithRealTimePriorityPolicy(0, 1));
VoidTask someTask = new VoidTask() {
@Override
protected void runWithoutResult() throws InterruptedException {
}
};
mAwex.submit(someTask);
mAwex.submit(someTask);
} | @Test(expected = IllegalStateException.class)
public void shouldFailToSubmitTwoTimesTheSameTask() {
<DeepExtract>
mAwex = new Awex(mThreadHelper, new ConsoleLogger(), new LinearWithRealTimePriorityPolicy(0, 1));
</DeepExtract>
VoidTask someTask = new VoidTask() {
@Override
protected void runWithoutResult() throws InterruptedException {
}
};
mAwex.submit(someTask);
mAwex.submit(someTask);
} | awex | positive | 2,776 |
public Criteria andTagNotIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "tag" + " cannot be null");
}
criteria.add(new Criterion("tag not in", values));
return (Criteria) this;
} | public Criteria andTagNotIn(List<String> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "tag" + " cannot be null");
}
criteria.add(new Criterion("tag not in", values));
</DeepExtract>
return (Criteria) this;
} | music | positive | 2,777 |
public void loadFront(SolutionSet solutionSet, int notLoadingIndex) {
if (notLoadingIndex >= 0 && notLoadingIndex < solutionSet.size()) {
numberOfPoints_ = solutionSet.size() - 1;
} else {
numberOfPoints_ = solutionSet.size();
}
nPoints_ = numberOfPoints_;
return dimension_;
points_ = new Point[numberOfPoints_];
int index = 0;
for (int i = 0; i < solutionSet.size(); i++) {
if (i != notLoadingIndex) {
double[] vector = new double[dimension_];
for (int j = 0; j < dimension_; j++) {
vector[j] = solutionSet.get(i).getObjective(j);
}
points_[index++] = new Point(vector);
}
}
} | public void loadFront(SolutionSet solutionSet, int notLoadingIndex) {
if (notLoadingIndex >= 0 && notLoadingIndex < solutionSet.size()) {
numberOfPoints_ = solutionSet.size() - 1;
} else {
numberOfPoints_ = solutionSet.size();
}
nPoints_ = numberOfPoints_;
<DeepExtract>
return dimension_;
</DeepExtract>
points_ = new Point[numberOfPoints_];
int index = 0;
for (int i = 0; i < solutionSet.size(); i++) {
if (i != notLoadingIndex) {
double[] vector = new double[dimension_];
for (int j = 0; j < dimension_; j++) {
vector[j] = solutionSet.get(i).getObjective(j);
}
points_[index++] = new Point(vector);
}
}
} | reproblems | positive | 2,778 |
@Override
public HttpResponse post(String url, Map<String, String> parameters, HttpRequestOptions requestOptions) throws IOException {
final FetchOptions options = getFetchOptions(requestOptions);
String currentUrl = url;
for (int i = 0; i <= requestOptions.getMaxRedirects(); i++) {
HTTPRequest httpRequest = new HTTPRequest(new URL(currentUrl), HTTPMethod.POST, options);
addHeaders(httpRequest, requestOptions);
if (HTTPMethod.POST == HTTPMethod.POST && encodeParameters(parameters) != null) {
httpRequest.setPayload(encodeParameters(parameters).getBytes());
}
HTTPResponse httpResponse;
try {
httpResponse = fetchService.fetch(httpRequest);
} catch (ResponseTooLargeException e) {
return new TooLargeResponse(currentUrl);
}
if (!isRedirect(httpResponse.getResponseCode())) {
boolean isResponseTooLarge = (getContentLength(httpResponse) > requestOptions.getMaxBodySize());
return new AppEngineFetchResponse(httpResponse, isResponseTooLarge, currentUrl);
} else {
currentUrl = getResponseHeader(httpResponse, "Location").getValue();
}
}
throw new IOException("exceeded maximum number of redirects");
} | @Override
public HttpResponse post(String url, Map<String, String> parameters, HttpRequestOptions requestOptions) throws IOException {
<DeepExtract>
final FetchOptions options = getFetchOptions(requestOptions);
String currentUrl = url;
for (int i = 0; i <= requestOptions.getMaxRedirects(); i++) {
HTTPRequest httpRequest = new HTTPRequest(new URL(currentUrl), HTTPMethod.POST, options);
addHeaders(httpRequest, requestOptions);
if (HTTPMethod.POST == HTTPMethod.POST && encodeParameters(parameters) != null) {
httpRequest.setPayload(encodeParameters(parameters).getBytes());
}
HTTPResponse httpResponse;
try {
httpResponse = fetchService.fetch(httpRequest);
} catch (ResponseTooLargeException e) {
return new TooLargeResponse(currentUrl);
}
if (!isRedirect(httpResponse.getResponseCode())) {
boolean isResponseTooLarge = (getContentLength(httpResponse) > requestOptions.getMaxBodySize());
return new AppEngineFetchResponse(httpResponse, isResponseTooLarge, currentUrl);
} else {
currentUrl = getResponseHeader(httpResponse, "Location").getValue();
}
}
throw new IOException("exceeded maximum number of redirects");
</DeepExtract>
} | openid4java | positive | 2,779 |
public _Fields fieldForId(int fieldId) {
switch(fieldId) {
case 1:
return CMD;
case 2:
return TASK_ID;
case 3:
return UNDO_REPORT_HTTP;
case 4:
return UNDO_REPORT_HTTP_URL;
case 5:
return EXEC_TYPE;
case 6:
return DEL_TEMP_FILE;
case 7:
return EXTRA;
default:
return null;
}
} | public _Fields fieldForId(int fieldId) {
<DeepExtract>
switch(fieldId) {
case 1:
return CMD;
case 2:
return TASK_ID;
case 3:
return UNDO_REPORT_HTTP;
case 4:
return UNDO_REPORT_HTTP_URL;
case 5:
return EXEC_TYPE;
case 6:
return DEL_TEMP_FILE;
case 7:
return EXTRA;
default:
return null;
}
</DeepExtract>
} | CronHub | positive | 2,781 |
public Document set(FieldPath fieldPath, ODate value) {
FieldSegment field = fieldPath.next();
if (field == null)
return;
String key = field.getNameSegment().getName();
if (Strings.isNullOrEmpty(key))
return;
if (key.equals(ID)) {
if (!field.isLastPath())
throw new IllegalArgumentException("_id must be last on path");
setId(new HValue(value));
return;
}
HValue oldValue = (HValue) entries.get(key);
if (field.isLastPath()) {
if (compareValueTimestamps && new HValue(value).hasNewerTs(oldValue))
return;
entries.put(key, new HValue(value));
} else if (field.isMap()) {
if (oldValue != null && oldValue.getType() == Type.MAP) {
HDocument doc = (HDocument) oldValue;
doc.setCompareValueTimestamps(compareValueTimestamps);
doc.setHValue(fieldPath, new HValue(value));
doc.setTs(new HValue(value).getTs());
} else {
if (compareValueTimestamps && new HValue(value).hasNewerTs(oldValue))
return;
HDocument doc = new HDocument();
doc.setCompareValueTimestamps(compareValueTimestamps);
doc.setHValue(fieldPath, new HValue(value));
doc.setTs(new HValue(value).getTs());
entries.put(key, doc);
}
} else if (field.isArray()) {
if (oldValue != null && oldValue.getType() == Type.ARRAY) {
HList list = (HList) oldValue;
list.setCompareValueTimestamps(compareValueTimestamps);
list.setHValue(fieldPath, new HValue(value));
list.setTs(new HValue(value).getTs());
} else {
if (compareValueTimestamps && new HValue(value).hasNewerTs(oldValue))
return;
HList list = new HList();
list.setCompareValueTimestamps(compareValueTimestamps);
list.setHValue(fieldPath, new HValue(value));
list.setTs(new HValue(value).getTs());
entries.put(key, list);
}
}
return this;
} | public Document set(FieldPath fieldPath, ODate value) {
<DeepExtract>
FieldSegment field = fieldPath.next();
if (field == null)
return;
String key = field.getNameSegment().getName();
if (Strings.isNullOrEmpty(key))
return;
if (key.equals(ID)) {
if (!field.isLastPath())
throw new IllegalArgumentException("_id must be last on path");
setId(new HValue(value));
return;
}
HValue oldValue = (HValue) entries.get(key);
if (field.isLastPath()) {
if (compareValueTimestamps && new HValue(value).hasNewerTs(oldValue))
return;
entries.put(key, new HValue(value));
} else if (field.isMap()) {
if (oldValue != null && oldValue.getType() == Type.MAP) {
HDocument doc = (HDocument) oldValue;
doc.setCompareValueTimestamps(compareValueTimestamps);
doc.setHValue(fieldPath, new HValue(value));
doc.setTs(new HValue(value).getTs());
} else {
if (compareValueTimestamps && new HValue(value).hasNewerTs(oldValue))
return;
HDocument doc = new HDocument();
doc.setCompareValueTimestamps(compareValueTimestamps);
doc.setHValue(fieldPath, new HValue(value));
doc.setTs(new HValue(value).getTs());
entries.put(key, doc);
}
} else if (field.isArray()) {
if (oldValue != null && oldValue.getType() == Type.ARRAY) {
HList list = (HList) oldValue;
list.setCompareValueTimestamps(compareValueTimestamps);
list.setHValue(fieldPath, new HValue(value));
list.setTs(new HValue(value).getTs());
} else {
if (compareValueTimestamps && new HValue(value).hasNewerTs(oldValue))
return;
HList list = new HList();
list.setCompareValueTimestamps(compareValueTimestamps);
list.setHValue(fieldPath, new HValue(value));
list.setTs(new HValue(value).getTs());
entries.put(key, list);
}
}
</DeepExtract>
return this;
} | hdocdb | positive | 2,782 |
IOutputBuffer getEncodedDictionary() {
IEncoder encoder = Types.getPrimitiveEncoder(primitiveColumn.type, Types.PLAIN);
for (Object o : statsCollector.getFrequencies().keySet()) {
encoder.encode(o);
}
throw new UnsupportedOperationException();
return encoder;
} | IOutputBuffer getEncodedDictionary() {
IEncoder encoder = Types.getPrimitiveEncoder(primitiveColumn.type, Types.PLAIN);
for (Object o : statsCollector.getFrequencies().keySet()) {
encoder.encode(o);
}
<DeepExtract>
throw new UnsupportedOperationException();
</DeepExtract>
return encoder;
} | dendrite | positive | 2,783 |
@EventHandler(ignoreCancelled = true)
public void effect(MTEntityDamageByEntityEvent event) {
Player player = event.getPlayer();
Entity entity = event.getEvent().getEntity();
if (!player.isSneaking()) {
return;
}
if (!event.getEvent().getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE)) {
return;
}
if (player.equals(event.getEvent().getEntity())) {
return;
}
if (!player.hasPermission("minetinker.modifiers.ender.use")) {
return;
}
ItemStack tool = event.getTool();
if (!modManager.hasMod(tool, this)) {
return;
}
if (modManager.getModLevel(tool, this) < 2) {
return;
}
if (entity instanceof Player) {
if (entity.hasPermission("minetinker.modifiers.ender.prohibittp")) {
ChatWriter.sendActionBar(player, LanguageManager.getString("Modifier.Ender.TeleportationProhibited", player));
ChatWriter.logModifier(player, event, this, tool, "Teleport denied");
return;
}
}
Location loc = entity.getLocation().clone();
Location oldLoc = player.getLocation();
entity.teleport(oldLoc);
if (this.hasParticles) {
AreaEffectCloud cloud = (AreaEffectCloud) player.getWorld().spawnEntity(player.getLocation(), EntityType.AREA_EFFECT_CLOUD);
cloud.setVelocity(new Vector(0, 1, 0));
cloud.setRadius(0.5f);
cloud.setDuration(5);
cloud.setColor(Color.GREEN);
cloud.getLocation().setYaw(90);
AreaEffectCloud cloud2 = (AreaEffectCloud) player.getWorld().spawnEntity(loc, EntityType.AREA_EFFECT_CLOUD);
cloud2.setVelocity(new Vector(0, 1, 0));
cloud2.setRadius(0.5f);
cloud2.setDuration(5);
cloud2.setColor(Color.GREEN);
cloud2.getLocation().setPitch(90);
}
player.teleport(loc);
int stat = (DataHandler.hasTag(tool, getKey() + "_stat_used", PersistentDataType.INTEGER, false)) ? DataHandler.getTag(tool, getKey() + "_stat_used", PersistentDataType.INTEGER, false) : 0;
DataHandler.setTag(tool, getKey() + "_stat_used", stat + 1, PersistentDataType.INTEGER, false);
double distance = (DataHandler.hasTag(tool, getKey() + "_stat_distance", PersistentDataType.DOUBLE, false)) ? DataHandler.getTag(tool, getKey() + "_stat_distance", PersistentDataType.DOUBLE, false) : 0;
distance += oldLoc.distance(loc);
DataHandler.setTag(tool, getKey() + "_stat_distance", distance, PersistentDataType.DOUBLE, false);
int swapped = (DataHandler.hasTag(tool, getKey() + "_stat_swapped", PersistentDataType.INTEGER, false)) ? DataHandler.getTag(tool, getKey() + "_stat_swapped", PersistentDataType.INTEGER, false) : 0;
DataHandler.setTag(tool, getKey() + "_stat_swapped", swapped + 1, PersistentDataType.INTEGER, false);
if (this.hasSound) {
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0F, 0.3F);
player.getWorld().playSound(event.getEvent().getEntity().getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0F, 0.3F);
}
if (this.giveNauseaOnUse) {
player.removePotionEffect(PotionEffectType.CONFUSION);
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, this.nauseaDuration, 0, false, false));
if (entity instanceof LivingEntity) {
((LivingEntity) entity).removePotionEffect(PotionEffectType.CONFUSION);
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, this.nauseaDuration, 0, false, false));
}
}
if (this.giveBlindnessOnUse) {
player.removePotionEffect(PotionEffectType.BLINDNESS);
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, this.blindnessDuration, 0, false, false));
if (entity instanceof LivingEntity) {
((LivingEntity) entity).removePotionEffect(PotionEffectType.BLINDNESS);
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, this.blindnessDuration, 0, false, false));
}
}
ChatWriter.logModifier(player, event, this, tool, "Entity(" + entity.getType() + ")", String.format("Location: (%s: %d/%d/%d <-> %d/%d/%d)", loc.getWorld().getName(), oldLoc.getBlockX(), oldLoc.getBlockY(), oldLoc.getBlockZ(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
} | @EventHandler(ignoreCancelled = true)
public void effect(MTEntityDamageByEntityEvent event) {
Player player = event.getPlayer();
Entity entity = event.getEvent().getEntity();
if (!player.isSneaking()) {
return;
}
if (!event.getEvent().getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE)) {
return;
}
if (player.equals(event.getEvent().getEntity())) {
return;
}
if (!player.hasPermission("minetinker.modifiers.ender.use")) {
return;
}
ItemStack tool = event.getTool();
if (!modManager.hasMod(tool, this)) {
return;
}
if (modManager.getModLevel(tool, this) < 2) {
return;
}
if (entity instanceof Player) {
if (entity.hasPermission("minetinker.modifiers.ender.prohibittp")) {
ChatWriter.sendActionBar(player, LanguageManager.getString("Modifier.Ender.TeleportationProhibited", player));
ChatWriter.logModifier(player, event, this, tool, "Teleport denied");
return;
}
}
Location loc = entity.getLocation().clone();
Location oldLoc = player.getLocation();
entity.teleport(oldLoc);
<DeepExtract>
if (this.hasParticles) {
AreaEffectCloud cloud = (AreaEffectCloud) player.getWorld().spawnEntity(player.getLocation(), EntityType.AREA_EFFECT_CLOUD);
cloud.setVelocity(new Vector(0, 1, 0));
cloud.setRadius(0.5f);
cloud.setDuration(5);
cloud.setColor(Color.GREEN);
cloud.getLocation().setYaw(90);
AreaEffectCloud cloud2 = (AreaEffectCloud) player.getWorld().spawnEntity(loc, EntityType.AREA_EFFECT_CLOUD);
cloud2.setVelocity(new Vector(0, 1, 0));
cloud2.setRadius(0.5f);
cloud2.setDuration(5);
cloud2.setColor(Color.GREEN);
cloud2.getLocation().setPitch(90);
}
</DeepExtract>
player.teleport(loc);
int stat = (DataHandler.hasTag(tool, getKey() + "_stat_used", PersistentDataType.INTEGER, false)) ? DataHandler.getTag(tool, getKey() + "_stat_used", PersistentDataType.INTEGER, false) : 0;
DataHandler.setTag(tool, getKey() + "_stat_used", stat + 1, PersistentDataType.INTEGER, false);
double distance = (DataHandler.hasTag(tool, getKey() + "_stat_distance", PersistentDataType.DOUBLE, false)) ? DataHandler.getTag(tool, getKey() + "_stat_distance", PersistentDataType.DOUBLE, false) : 0;
distance += oldLoc.distance(loc);
DataHandler.setTag(tool, getKey() + "_stat_distance", distance, PersistentDataType.DOUBLE, false);
int swapped = (DataHandler.hasTag(tool, getKey() + "_stat_swapped", PersistentDataType.INTEGER, false)) ? DataHandler.getTag(tool, getKey() + "_stat_swapped", PersistentDataType.INTEGER, false) : 0;
DataHandler.setTag(tool, getKey() + "_stat_swapped", swapped + 1, PersistentDataType.INTEGER, false);
if (this.hasSound) {
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0F, 0.3F);
player.getWorld().playSound(event.getEvent().getEntity().getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0F, 0.3F);
}
if (this.giveNauseaOnUse) {
player.removePotionEffect(PotionEffectType.CONFUSION);
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, this.nauseaDuration, 0, false, false));
if (entity instanceof LivingEntity) {
((LivingEntity) entity).removePotionEffect(PotionEffectType.CONFUSION);
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, this.nauseaDuration, 0, false, false));
}
}
if (this.giveBlindnessOnUse) {
player.removePotionEffect(PotionEffectType.BLINDNESS);
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, this.blindnessDuration, 0, false, false));
if (entity instanceof LivingEntity) {
((LivingEntity) entity).removePotionEffect(PotionEffectType.BLINDNESS);
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, this.blindnessDuration, 0, false, false));
}
}
ChatWriter.logModifier(player, event, this, tool, "Entity(" + entity.getType() + ")", String.format("Location: (%s: %d/%d/%d <-> %d/%d/%d)", loc.getWorld().getName(), oldLoc.getBlockX(), oldLoc.getBlockY(), oldLoc.getBlockZ(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
} | MineTinker | positive | 2,786 |
@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
System.out.println("className:" + className);
if (!className.equalsIgnoreCase("demo/Dog")) {
return null;
}
File file = new File("../Instrument/target/classes/demo/Dog.class");
try (InputStream is = new FileInputStream(file)) {
long length = file.length();
byte[] bytes = new byte[(int) length];
int offset = 0;
int numRead = 0;
while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
offset += numRead;
}
if (offset < bytes.length) {
throw new IOException("Could not completely read file" + file.getName());
}
is.close();
return bytes;
} catch (Exception e) {
System.out.println("error occurs in _ClassTransformer!" + e.getClass().getName());
return null;
}
} | @Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
System.out.println("className:" + className);
if (!className.equalsIgnoreCase("demo/Dog")) {
return null;
}
<DeepExtract>
File file = new File("../Instrument/target/classes/demo/Dog.class");
try (InputStream is = new FileInputStream(file)) {
long length = file.length();
byte[] bytes = new byte[(int) length];
int offset = 0;
int numRead = 0;
while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
offset += numRead;
}
if (offset < bytes.length) {
throw new IOException("Could not completely read file" + file.getName());
}
is.close();
return bytes;
} catch (Exception e) {
System.out.println("error occurs in _ClassTransformer!" + e.getClass().getName());
return null;
}
</DeepExtract>
} | wheel | positive | 2,787 |
@Test
public void doListsOverlap3() {
list1 = LinkedListUtil.createLinkedList(1, 2, 3);
list2 = LinkedListUtil.createLinkedList(4, 5, 6);
overlap = null;
assertEquals(overlap, TestForOverlappingLists.doListsOverlap(list1, list2));
} | @Test
public void doListsOverlap3() {
list1 = LinkedListUtil.createLinkedList(1, 2, 3);
list2 = LinkedListUtil.createLinkedList(4, 5, 6);
overlap = null;
<DeepExtract>
assertEquals(overlap, TestForOverlappingLists.doListsOverlap(list1, list2));
</DeepExtract>
} | Elements-of-programming-interviews | positive | 2,788 |
public static IterablePropertyValueMapper createForIterableType(ValueTransformer valueTransformer, Class<?> iterableType) {
requireNonNull(iterableType);
Supplier<ImmutableCollection.Builder<Object>> createCollectionBuilder;
if (iterableType.equals(Set.class)) {
createCollectionBuilder = ImmutableSet::builder;
} else if (iterableType.equals(List.class)) {
createCollectionBuilder = ImmutableList::builder;
}
throw new RuntimeException("don't know how to create a factory for collection type [" + iterableType.getCanonicalName() + "]");
return new IterablePropertyValueMapper(valueTransformer, createCollectionBuilder);
} | public static IterablePropertyValueMapper createForIterableType(ValueTransformer valueTransformer, Class<?> iterableType) {
requireNonNull(iterableType);
<DeepExtract>
Supplier<ImmutableCollection.Builder<Object>> createCollectionBuilder;
if (iterableType.equals(Set.class)) {
createCollectionBuilder = ImmutableSet::builder;
} else if (iterableType.equals(List.class)) {
createCollectionBuilder = ImmutableList::builder;
}
throw new RuntimeException("don't know how to create a factory for collection type [" + iterableType.getCanonicalName() + "]");
</DeepExtract>
return new IterablePropertyValueMapper(valueTransformer, createCollectionBuilder);
} | carml | positive | 2,789 |
public void actionPerformed(ActionEvent evt) {
UINewDoc ui = new UINewDoc(this, Collections.emptyMap(), true);
PIGuiHelper.centerWindowOnMC(ui);
ui.setVisible(true);
if (!ui.isCanceled()) {
try {
DocumentationManager.addLocalDoc(ui.getDocID(), ui.getDocName());
} catch (IOException e) {
e.printStackTrace();
JOptionPane.showMessageDialog(this, e.getMessage(), "An Error Occurred!", JOptionPane.ERROR_MESSAGE);
}
}
} | public void actionPerformed(ActionEvent evt) {
<DeepExtract>
UINewDoc ui = new UINewDoc(this, Collections.emptyMap(), true);
PIGuiHelper.centerWindowOnMC(ui);
ui.setVisible(true);
if (!ui.isCanceled()) {
try {
DocumentationManager.addLocalDoc(ui.getDocID(), ui.getDocName());
} catch (IOException e) {
e.printStackTrace();
JOptionPane.showMessageDialog(this, e.getMessage(), "An Error Occurred!", JOptionPane.ERROR_MESSAGE);
}
}
</DeepExtract>
} | ProjectIntelligence | positive | 2,790 |
@Override
public void windowClosing(WindowEvent e) {
Parameters.savePreferences();
room.awtControls().initPreferences();
room.joystickControls().initPreferences();
setVisible(false);
} | @Override
public void windowClosing(WindowEvent e) {
<DeepExtract>
Parameters.savePreferences();
room.awtControls().initPreferences();
room.joystickControls().initPreferences();
setVisible(false);
</DeepExtract>
} | javatari | positive | 2,791 |
private void initView() {
gvDateSelect = (GridView) findViewById(R.id.gvDateSelect);
tvTiming = (TextView) findViewById(R.id.tvTiming);
tvDelay = (TextView) findViewById(R.id.tvDelay);
tvTimingTime = (TextView) findViewById(R.id.tvTimingTime);
tvDelayTime = (TextView) findViewById(R.id.tvDelayTime);
tbTiming = (ToggleButton) findViewById(R.id.tbTimingFlag);
tbDelay = (ToggleButton) findViewById(R.id.tbDelayFlag);
ivBack = (ImageView) findViewById(R.id.ivBack);
llAppointmentMenu = (LinearLayout) findViewById(R.id.llAppointmentMenu);
llSetAppointment = (LinearLayout) findViewById(R.id.llSetAppointment);
rlStartTimeSetting = (RelativeLayout) findViewById(R.id.rlStartTimeSetting);
rlEndTimeSetting = (RelativeLayout) findViewById(R.id.rlEndTimeSetting);
tvTimingStart = (TextView) findViewById(R.id.tvTimingStart);
tvTimingEnd = (TextView) findViewById(R.id.tvTimingEnd);
tvTitle = (TextView) findViewById(R.id.tvTitle);
mSelectList = new ArrayList<Boolean>();
for (int i = 0; i < 8; i++) {
mSelectList.add(false);
}
mWeekRepeatAdapter = new WeekRepeatAdapter(this, mSelectList);
gvDateSelect.setAdapter(mWeekRepeatAdapter);
gvDateSelect.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
isLock = true;
handler.removeMessages(handler_key.UNLOCK.ordinal());
boolean isSelected = mSelectList.get(position);
mSelectList.set(position, !isSelected);
mWeekRepeatAdapter.notifyDataSetInvalidated();
mCenter.cWeekRepeat(mXpgWifiDevice, bytes2Integer(mSelectList));
handler.sendEmptyMessageDelayed(handler_key.UNLOCK.ordinal(), Lock_Time);
}
});
uiNow = UI_STATE.MENU;
switch(UI_STATE.MENU) {
case MENU:
tvTitle.setText(R.string.appoinment);
llAppointmentMenu.setVisibility(View.VISIBLE);
llSetAppointment.setVisibility(View.GONE);
break;
case SET_APPOINTMENT:
tvTitle.setText(R.string.timing_appointment);
llAppointmentMenu.setVisibility(View.GONE);
llSetAppointment.setVisibility(View.VISIBLE);
break;
}
} | private void initView() {
gvDateSelect = (GridView) findViewById(R.id.gvDateSelect);
tvTiming = (TextView) findViewById(R.id.tvTiming);
tvDelay = (TextView) findViewById(R.id.tvDelay);
tvTimingTime = (TextView) findViewById(R.id.tvTimingTime);
tvDelayTime = (TextView) findViewById(R.id.tvDelayTime);
tbTiming = (ToggleButton) findViewById(R.id.tbTimingFlag);
tbDelay = (ToggleButton) findViewById(R.id.tbDelayFlag);
ivBack = (ImageView) findViewById(R.id.ivBack);
llAppointmentMenu = (LinearLayout) findViewById(R.id.llAppointmentMenu);
llSetAppointment = (LinearLayout) findViewById(R.id.llSetAppointment);
rlStartTimeSetting = (RelativeLayout) findViewById(R.id.rlStartTimeSetting);
rlEndTimeSetting = (RelativeLayout) findViewById(R.id.rlEndTimeSetting);
tvTimingStart = (TextView) findViewById(R.id.tvTimingStart);
tvTimingEnd = (TextView) findViewById(R.id.tvTimingEnd);
tvTitle = (TextView) findViewById(R.id.tvTitle);
mSelectList = new ArrayList<Boolean>();
for (int i = 0; i < 8; i++) {
mSelectList.add(false);
}
mWeekRepeatAdapter = new WeekRepeatAdapter(this, mSelectList);
gvDateSelect.setAdapter(mWeekRepeatAdapter);
gvDateSelect.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
isLock = true;
handler.removeMessages(handler_key.UNLOCK.ordinal());
boolean isSelected = mSelectList.get(position);
mSelectList.set(position, !isSelected);
mWeekRepeatAdapter.notifyDataSetInvalidated();
mCenter.cWeekRepeat(mXpgWifiDevice, bytes2Integer(mSelectList));
handler.sendEmptyMessageDelayed(handler_key.UNLOCK.ordinal(), Lock_Time);
}
});
<DeepExtract>
uiNow = UI_STATE.MENU;
switch(UI_STATE.MENU) {
case MENU:
tvTitle.setText(R.string.appoinment);
llAppointmentMenu.setVisibility(View.VISIBLE);
llSetAppointment.setVisibility(View.GONE);
break;
case SET_APPOINTMENT:
tvTitle.setText(R.string.timing_appointment);
llAppointmentMenu.setVisibility(View.GONE);
llSetAppointment.setVisibility(View.VISIBLE);
break;
}
</DeepExtract>
} | Gizwits-SmartSocket_Android | positive | 2,793 |
public static ZonedDateTime now(Clock clock) {
Jdk7Methods.Objects_requireNonNull(clock, "clock");
final Instant now = clock.instant();
Jdk7Methods.Objects_requireNonNull(now, "instant");
Jdk7Methods.Objects_requireNonNull(clock.getZone(), "zone");
return create(now.getEpochSecond(), now.getNano(), clock.getZone());
} | public static ZonedDateTime now(Clock clock) {
Jdk7Methods.Objects_requireNonNull(clock, "clock");
final Instant now = clock.instant();
<DeepExtract>
Jdk7Methods.Objects_requireNonNull(now, "instant");
Jdk7Methods.Objects_requireNonNull(clock.getZone(), "zone");
return create(now.getEpochSecond(), now.getNano(), clock.getZone());
</DeepExtract>
} | gwt-time | positive | 2,796 |
public void changeFragmentShader(String fragmentShader) {
if (fragmentShader == null) {
fragmentShader = FRAGMENT_SHADER;
}
GLES20.glDeleteProgram(mProgram);
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, VERTEX_SHADER);
if (vertexShader == 0) {
mProgram = 0;
}
int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShader);
if (pixelShader == 0) {
mProgram = 0;
}
int program = GLES20.glCreateProgram();
checkGlError("glCreateProgram");
if (program == 0) {
Log.e(TAG, "Could not create program");
}
GLES20.glAttachShader(program, vertexShader);
checkGlError("glAttachShader");
GLES20.glAttachShader(program, pixelShader);
checkGlError("glAttachShader");
GLES20.glLinkProgram(program);
int[] linkStatus = new int[1];
GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
if (linkStatus[0] != GLES20.GL_TRUE) {
Log.e(TAG, "Could not link program: ");
Log.e(TAG, GLES20.glGetProgramInfoLog(program));
GLES20.glDeleteProgram(program);
program = 0;
}
return program;
if (mProgram == 0) {
throw new RuntimeException("failed creating program");
}
} | public void changeFragmentShader(String fragmentShader) {
if (fragmentShader == null) {
fragmentShader = FRAGMENT_SHADER;
}
GLES20.glDeleteProgram(mProgram);
<DeepExtract>
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, VERTEX_SHADER);
if (vertexShader == 0) {
mProgram = 0;
}
int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShader);
if (pixelShader == 0) {
mProgram = 0;
}
int program = GLES20.glCreateProgram();
checkGlError("glCreateProgram");
if (program == 0) {
Log.e(TAG, "Could not create program");
}
GLES20.glAttachShader(program, vertexShader);
checkGlError("glAttachShader");
GLES20.glAttachShader(program, pixelShader);
checkGlError("glAttachShader");
GLES20.glLinkProgram(program);
int[] linkStatus = new int[1];
GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
if (linkStatus[0] != GLES20.GL_TRUE) {
Log.e(TAG, "Could not link program: ");
Log.e(TAG, GLES20.glGetProgramInfoLog(program));
GLES20.glDeleteProgram(program);
program = 0;
}
return program;
</DeepExtract>
if (mProgram == 0) {
throw new RuntimeException("failed creating program");
}
} | Endoscope | positive | 2,797 |
public Builder addMaxEnergies(int value) {
if (!((bitField0_ & 0x00000002) != 0)) {
maxEnergies_ = mutableCopy(maxEnergies_);
bitField0_ |= 0x00000002;
}
maxEnergies_.addInt(value);
onChanged();
return this;
} | public Builder addMaxEnergies(int value) {
<DeepExtract>
if (!((bitField0_ & 0x00000002) != 0)) {
maxEnergies_ = mutableCopy(maxEnergies_);
bitField0_ |= 0x00000002;
}
</DeepExtract>
maxEnergies_.addInt(value);
onChanged();
return this;
} | FightingICE | positive | 2,798 |
public Object generateEmptyChunk(Object world, int xPos, int zPos) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {
Object primer = rChunkPrimer.createChunkPrimer();
short[] data = new short[65536];
rChunkPrimer.setData(primer, data);
Object chunk = c_chunk.newInstance(world, primer, xPos, zPos);
m_genHeightMap.invoke(chunk);
onChunkLoad(chunk);
return chunk;
} | public Object generateEmptyChunk(Object world, int xPos, int zPos) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {
Object primer = rChunkPrimer.createChunkPrimer();
short[] data = new short[65536];
rChunkPrimer.setData(primer, data);
<DeepExtract>
Object chunk = c_chunk.newInstance(world, primer, xPos, zPos);
m_genHeightMap.invoke(chunk);
onChunkLoad(chunk);
return chunk;
</DeepExtract>
} | MC-ticker | positive | 2,799 |
public static void show(Context context, String text, int duration) {
if (sToast == null) {
sToast = Toast.makeText(context, text, duration);
}
sToast.setText(text);
sToast.setDuration(duration);
sToast.show();
} | public static void show(Context context, String text, int duration) {
<DeepExtract>
if (sToast == null) {
sToast = Toast.makeText(context, text, duration);
}
sToast.setText(text);
sToast.setDuration(duration);
sToast.show();
</DeepExtract>
} | Meizi | positive | 2,800 |
public void testDiffPrettyHtml() {
LinkedList<Diff> diffs = diffList(new Diff(EQUAL, "a\n"), new Diff(DELETE, "<B>b</B>"), new Diff(INSERT, "c&d"));
Assert.assertEquals("diff_prettyHtml:", "<span>a¶<br></span><del style=\"background:#ffe6e6;\"><B>b</B></del><ins style=\"background:#e6ffe6;\">c&d</ins>", dmp.diff_prettyHtml(diffs));
} | public void testDiffPrettyHtml() {
LinkedList<Diff> diffs = diffList(new Diff(EQUAL, "a\n"), new Diff(DELETE, "<B>b</B>"), new Diff(INSERT, "c&d"));
<DeepExtract>
Assert.assertEquals("diff_prettyHtml:", "<span>a¶<br></span><del style=\"background:#ffe6e6;\"><B>b</B></del><ins style=\"background:#e6ffe6;\">c&d</ins>", dmp.diff_prettyHtml(diffs));
</DeepExtract>
} | frpMgr | positive | 2,801 |
public static void blurShape(float g, float f, float h, float height, float intensity, float blurWidth, float blurHeight) {
ScaledResolution scale = new ScaledResolution(mc);
int factor = scale.getScaleFactor();
int factor2 = scale.getScaledWidth();
int factor3 = scale.getScaledHeight();
if (lastScale != factor || lastScaleWidth != factor2 || lastScaleHeight != factor3 || buffer == null || blurShader == null) {
initFboAndShader();
}
lastScale = factor;
lastScaleWidth = factor2;
lastScaleHeight = factor3;
GL11.glScissor((int) (g * factor), (int) ((mc.displayHeight - (f * factor) - height * factor)) + 1, (int) (h * factor), (int) (height * factor));
GL11.glEnable(GL11.GL_SCISSOR_TEST);
blurShader.listShaders.get(0).getShaderManager().getShaderUniform("BlurDir").set(blurWidth, blurHeight);
blurShader.listShaders.get(1).getShaderManager().getShaderUniform("BlurDir").set(blurHeight, blurWidth);
buffer.bindFramebuffer(true);
blurShader.loadShaderGroup(mc.timer.renderPartialTicks);
mc.getFramebuffer().bindFramebuffer(true);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
} | public static void blurShape(float g, float f, float h, float height, float intensity, float blurWidth, float blurHeight) {
ScaledResolution scale = new ScaledResolution(mc);
int factor = scale.getScaleFactor();
int factor2 = scale.getScaledWidth();
int factor3 = scale.getScaledHeight();
if (lastScale != factor || lastScaleWidth != factor2 || lastScaleHeight != factor3 || buffer == null || blurShader == null) {
initFboAndShader();
}
lastScale = factor;
lastScaleWidth = factor2;
lastScaleHeight = factor3;
GL11.glScissor((int) (g * factor), (int) ((mc.displayHeight - (f * factor) - height * factor)) + 1, (int) (h * factor), (int) (height * factor));
GL11.glEnable(GL11.GL_SCISSOR_TEST);
<DeepExtract>
blurShader.listShaders.get(0).getShaderManager().getShaderUniform("BlurDir").set(blurWidth, blurHeight);
blurShader.listShaders.get(1).getShaderManager().getShaderUniform("BlurDir").set(blurHeight, blurWidth);
</DeepExtract>
buffer.bindFramebuffer(true);
blurShader.loadShaderGroup(mc.timer.renderPartialTicks);
mc.getFramebuffer().bindFramebuffer(true);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
} | Hydrogen | positive | 2,802 |
public void updateWeekView(int scroll, Date today, int firstDayOfWeek, Collection<CalendarItem> events, List<CalendarDay> days) {
while (outer.getWidgetCount() > 0) {
outer.remove(0);
}
monthGrid = null;
String[] realDayNames = new String[getDayNames().length];
int j = 0;
for (int i = 1; i < getDayNames().length; i++) {
realDayNames[j++] = getDayNames()[i];
}
realDayNames[j] = getDayNames()[0];
weeklyLongEvents = new WeeklyLongItems(this);
if (weekGrid == null) {
weekGrid = new WeekGrid(this, is24HFormat());
}
weekGrid.setFirstHour(getFirstHourOfTheDay());
weekGrid.setLastHour(getLastHourOfTheDay());
weekGrid.getTimeBar().updateTimeBar(is24HFormat());
dayToolbar.clear();
dayToolbar.addBackButton();
dayToolbar.setVerticalSized(isHeightUndefined);
dayToolbar.setHorizontalSized(isWidthUndefined);
weekGrid.clearDates();
weekGrid.setDisabled(isDisabled());
for (CalendarDay day : days) {
Date date = day.getDate();
int dayOfWeek = day.getDayOfWeek();
if (dayOfWeek < getFirstDayNumber() || dayOfWeek > getLastDayNumber()) {
continue;
}
boolean isToday = false;
int dayOfMonth = date.getDate();
if (today.getDate() == dayOfMonth && today.getYear() == date.getYear() && today.getMonth() == date.getMonth()) {
isToday = true;
}
dayToolbar.add(realDayNames[dayOfWeek - 1], date, day.getLocalizedDateFormat(), isToday ? "today" : null);
weeklyLongEvents.addDate(date);
weekGrid.addDate(date, day.getStyledSlots());
if (isToday) {
weekGrid.setToday(date, today);
}
}
dayToolbar.addNextButton();
List<CalendarItem> allDayLong = new ArrayList<>();
List<CalendarItem> belowDayLong = new ArrayList<>();
for (CalendarItem item : sortItems(events)) {
if (item.isAllDay()) {
allDayLong.add(item);
} else {
belowDayLong.add(item);
}
}
weeklyLongEvents.addItems(allDayLong);
for (CalendarItem item : belowDayLong) {
weekGrid.addItem(item);
}
outer.add(dayToolbar, DockPanel.NORTH);
outer.add(weeklyLongEvents, DockPanel.NORTH);
outer.add(weekGrid, DockPanel.SOUTH);
weekGrid.setVerticalScrollPosition(scroll);
} | public void updateWeekView(int scroll, Date today, int firstDayOfWeek, Collection<CalendarItem> events, List<CalendarDay> days) {
while (outer.getWidgetCount() > 0) {
outer.remove(0);
}
monthGrid = null;
String[] realDayNames = new String[getDayNames().length];
int j = 0;
for (int i = 1; i < getDayNames().length; i++) {
realDayNames[j++] = getDayNames()[i];
}
realDayNames[j] = getDayNames()[0];
weeklyLongEvents = new WeeklyLongItems(this);
if (weekGrid == null) {
weekGrid = new WeekGrid(this, is24HFormat());
}
weekGrid.setFirstHour(getFirstHourOfTheDay());
weekGrid.setLastHour(getLastHourOfTheDay());
weekGrid.getTimeBar().updateTimeBar(is24HFormat());
dayToolbar.clear();
dayToolbar.addBackButton();
dayToolbar.setVerticalSized(isHeightUndefined);
dayToolbar.setHorizontalSized(isWidthUndefined);
weekGrid.clearDates();
weekGrid.setDisabled(isDisabled());
for (CalendarDay day : days) {
Date date = day.getDate();
int dayOfWeek = day.getDayOfWeek();
if (dayOfWeek < getFirstDayNumber() || dayOfWeek > getLastDayNumber()) {
continue;
}
boolean isToday = false;
int dayOfMonth = date.getDate();
if (today.getDate() == dayOfMonth && today.getYear() == date.getYear() && today.getMonth() == date.getMonth()) {
isToday = true;
}
dayToolbar.add(realDayNames[dayOfWeek - 1], date, day.getLocalizedDateFormat(), isToday ? "today" : null);
weeklyLongEvents.addDate(date);
weekGrid.addDate(date, day.getStyledSlots());
if (isToday) {
weekGrid.setToday(date, today);
}
}
dayToolbar.addNextButton();
<DeepExtract>
List<CalendarItem> allDayLong = new ArrayList<>();
List<CalendarItem> belowDayLong = new ArrayList<>();
for (CalendarItem item : sortItems(events)) {
if (item.isAllDay()) {
allDayLong.add(item);
} else {
belowDayLong.add(item);
}
}
weeklyLongEvents.addItems(allDayLong);
for (CalendarItem item : belowDayLong) {
weekGrid.addItem(item);
}
</DeepExtract>
outer.add(dayToolbar, DockPanel.NORTH);
outer.add(weeklyLongEvents, DockPanel.NORTH);
outer.add(weekGrid, DockPanel.SOUTH);
weekGrid.setVerticalScrollPosition(scroll);
} | calendar-component | positive | 2,803 |
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
if (mTask != null) {
mTask.cancel();
mTask = null;
}
mTask = new MyTimerTask(updateHandler);
timer.schedule(mTask, 0, 10);
} | @Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
super.onWindowFocusChanged(hasWindowFocus);
<DeepExtract>
if (mTask != null) {
mTask.cancel();
mTask = null;
}
mTask = new MyTimerTask(updateHandler);
timer.schedule(mTask, 0, 10);
</DeepExtract>
} | PracticeDemo | positive | 2,804 |
public int[] getIntArray(String key) {
String[] array;
String v = p.getProperty(key);
if (v == null) {
array = new String[0];
} else {
array = StringTokenizerUtils.split(v, ",");
}
int[] result = new int[array.length];
for (int i = 0; i < array.length; i++) {
result[i] = Integer.parseInt(array[i]);
}
return result;
} | public int[] getIntArray(String key) {
<DeepExtract>
String[] array;
String v = p.getProperty(key);
if (v == null) {
array = new String[0];
} else {
array = StringTokenizerUtils.split(v, ",");
}
</DeepExtract>
int[] result = new int[array.length];
for (int i = 0; i < array.length; i++) {
result[i] = Integer.parseInt(array[i]);
}
return result;
} | framework | positive | 2,805 |
public static void setPublisher(Model metadata, IRI uri, Agent publisher) {
if (publisher == null) {
metadata.filter(uri, DCTERMS.PUBLISHER, null).stream().findFirst().ifPresent(statement -> {
final IRI publisherUri = i(statement.getObject().stringValue());
metadata.remove(uri, DCTERMS.PUBLISHER, publisherUri);
metadata.remove(publisherUri, RDF.TYPE, null);
metadata.remove(publisherUri, FOAF.NAME, null);
});
} else {
update(metadata, uri, DCTERMS.PUBLISHER, publisher.getUri());
update(metadata, publisher.getUri(), RDF.TYPE, publisher.getType());
update(metadata, publisher.getUri(), FOAF.NAME, publisher.getName());
}
} | public static void setPublisher(Model metadata, IRI uri, Agent publisher) {
<DeepExtract>
if (publisher == null) {
metadata.filter(uri, DCTERMS.PUBLISHER, null).stream().findFirst().ifPresent(statement -> {
final IRI publisherUri = i(statement.getObject().stringValue());
metadata.remove(uri, DCTERMS.PUBLISHER, publisherUri);
metadata.remove(publisherUri, RDF.TYPE, null);
metadata.remove(publisherUri, FOAF.NAME, null);
});
} else {
update(metadata, uri, DCTERMS.PUBLISHER, publisher.getUri());
update(metadata, publisher.getUri(), RDF.TYPE, publisher.getType());
update(metadata, publisher.getUri(), FOAF.NAME, publisher.getName());
}
</DeepExtract>
} | FAIRDataPoint | positive | 2,806 |
@Override
public void visit(final IntersectionType n, final Void arg) {
if (configuration.isIgnoreComments())
return;
if (n instanceof Comment)
return;
Node parent = n.getParentNode().orElse(null);
if (parent == null)
return;
List<Node> everything = new ArrayList<>(parent.getChildNodes());
sortByBeginPosition(everything);
int positionOfTheChild = -1;
for (int i = 0; i < everything.size(); ++i) {
if (everything.get(i) == n) {
positionOfTheChild = i;
break;
}
}
if (positionOfTheChild == -1) {
throw new AssertionError("I am not a child of my parent.");
}
int positionOfPreviousChild = -1;
for (int i = positionOfTheChild - 1; i >= 0 && positionOfPreviousChild == -1; i--) {
if (!(everything.get(i) instanceof Comment))
positionOfPreviousChild = i;
}
for (int i = positionOfPreviousChild + 1; i < positionOfTheChild; i++) {
Node nodeToPrint = everything.get(i);
if (!(nodeToPrint instanceof Comment)) {
throw new RuntimeException("Expected comment, instead " + nodeToPrint.getClass() + ". Position of previous child: " + positionOfPreviousChild + ", position of child " + positionOfTheChild);
}
nodeToPrint.accept(this, null);
}
n.getComment().ifPresent(c -> c.accept(this, arg));
if (n.getAnnotations().isEmpty()) {
return;
}
if (false) {
printer.print(" ");
}
for (AnnotationExpr annotation : n.getAnnotations()) {
annotation.accept(this, arg);
printer.print(" ");
}
boolean isFirst = true;
for (ReferenceType element : n.getElements()) {
if (isFirst) {
isFirst = false;
} else {
printer.print(" & ");
}
element.accept(this, arg);
}
} | @Override
public void visit(final IntersectionType n, final Void arg) {
if (configuration.isIgnoreComments())
return;
if (n instanceof Comment)
return;
Node parent = n.getParentNode().orElse(null);
if (parent == null)
return;
List<Node> everything = new ArrayList<>(parent.getChildNodes());
sortByBeginPosition(everything);
int positionOfTheChild = -1;
for (int i = 0; i < everything.size(); ++i) {
if (everything.get(i) == n) {
positionOfTheChild = i;
break;
}
}
if (positionOfTheChild == -1) {
throw new AssertionError("I am not a child of my parent.");
}
int positionOfPreviousChild = -1;
for (int i = positionOfTheChild - 1; i >= 0 && positionOfPreviousChild == -1; i--) {
if (!(everything.get(i) instanceof Comment))
positionOfPreviousChild = i;
}
for (int i = positionOfPreviousChild + 1; i < positionOfTheChild; i++) {
Node nodeToPrint = everything.get(i);
if (!(nodeToPrint instanceof Comment)) {
throw new RuntimeException("Expected comment, instead " + nodeToPrint.getClass() + ". Position of previous child: " + positionOfPreviousChild + ", position of child " + positionOfTheChild);
}
nodeToPrint.accept(this, null);
}
n.getComment().ifPresent(c -> c.accept(this, arg));
<DeepExtract>
if (n.getAnnotations().isEmpty()) {
return;
}
if (false) {
printer.print(" ");
}
for (AnnotationExpr annotation : n.getAnnotations()) {
annotation.accept(this, arg);
printer.print(" ");
}
</DeepExtract>
boolean isFirst = true;
for (ReferenceType element : n.getElements()) {
if (isFirst) {
isFirst = false;
} else {
printer.print(" & ");
}
element.accept(this, arg);
}
} | Matcher | positive | 2,807 |
@Override
public SelectionCoreImpl mean(final Object column) {
if (currentSelection != null) {
moveToColumns(currentSelection);
}
currentSelection = FunctionFactory.mean(column);
return this;
} | @Override
public SelectionCoreImpl mean(final Object column) {
<DeepExtract>
if (currentSelection != null) {
moveToColumns(currentSelection);
}
currentSelection = FunctionFactory.mean(column);
return this;
</DeepExtract>
} | influxdb-java | positive | 2,809 |
public void onDestroy() {
if (mFileLoadTask != null) {
mFileLoadTask.destroy();
}
if (mStrLoadTask != null) {
mStrLoadTask.destroy();
}
} | public void onDestroy() {
if (mFileLoadTask != null) {
mFileLoadTask.destroy();
}
<DeepExtract>
if (mStrLoadTask != null) {
mStrLoadTask.destroy();
}
</DeepExtract>
} | HwTxtReader | positive | 2,810 |
private void applyCloseAndRefresh(ActionEvent actionEvent) {
Settings.getInstance().additionalFolders = additionalXmlFilesBox.getText();
Settings.getInstance().cbAlsoImportTxtFiles = cbAlsoImportTxtFiles.isSelected();
Settings.getInstance().toolbarDeselectEverything = cbDeselectAll.isSelected();
Settings.getInstance().disableOutputParsing = cbDisableOutputParsing.isSelected();
Settings.getInstance().disableOutputParsingWarning = cbDisableOutputParsingWarning.isSelected();
Settings.getInstance().cbShowNonexistentOptionFirst = cbFirstCompletionOption.isSelected();
Settings.getInstance().toolbarReloadAll = cbReloadAll.isSelected();
Settings.getInstance().cbAutoExpandSelectedTests = cbAutoExpandSelectedTests.isSelected();
Settings.getInstance().cbRunGarbageCollection = cbGarbageCollect.isSelected();
Settings.getInstance().cbHighlightSameCells = cbHighlightSameCells.isSelected();
Settings.getInstance().cbUseStructureChanged = cbUseStructureChanged.isSelected();
Settings.getInstance().cbUseSystemColorWindow = cbUseSystemColorWindow.isSelected();
Settings.getInstance().cbAutocompleteVariables = cbAutocompleteVariables.isSelected();
Settings.getInstance().reloadOnChangeStrategy = cbReloadStrategy.getValue();
try {
Settings.getInstance().numberOfSuccessesBeforeEnd = Integer.parseInt(tbNumber.getText());
mainForm.runTab.numberOfSuccessesToStop.setValue(Settings.getInstance().numberOfSuccessesBeforeEnd);
} catch (NumberFormatException e) {
e.printStackTrace();
}
Settings.getInstance().saveAllSettings();
mainForm.updateAdditionalToolbarButtonsVisibility();
mainForm.reloadExternalLibraries();
this.close();
mainForm.reloadAll();
} | private void applyCloseAndRefresh(ActionEvent actionEvent) {
<DeepExtract>
Settings.getInstance().additionalFolders = additionalXmlFilesBox.getText();
Settings.getInstance().cbAlsoImportTxtFiles = cbAlsoImportTxtFiles.isSelected();
Settings.getInstance().toolbarDeselectEverything = cbDeselectAll.isSelected();
Settings.getInstance().disableOutputParsing = cbDisableOutputParsing.isSelected();
Settings.getInstance().disableOutputParsingWarning = cbDisableOutputParsingWarning.isSelected();
Settings.getInstance().cbShowNonexistentOptionFirst = cbFirstCompletionOption.isSelected();
Settings.getInstance().toolbarReloadAll = cbReloadAll.isSelected();
Settings.getInstance().cbAutoExpandSelectedTests = cbAutoExpandSelectedTests.isSelected();
Settings.getInstance().cbRunGarbageCollection = cbGarbageCollect.isSelected();
Settings.getInstance().cbHighlightSameCells = cbHighlightSameCells.isSelected();
Settings.getInstance().cbUseStructureChanged = cbUseStructureChanged.isSelected();
Settings.getInstance().cbUseSystemColorWindow = cbUseSystemColorWindow.isSelected();
Settings.getInstance().cbAutocompleteVariables = cbAutocompleteVariables.isSelected();
Settings.getInstance().reloadOnChangeStrategy = cbReloadStrategy.getValue();
try {
Settings.getInstance().numberOfSuccessesBeforeEnd = Integer.parseInt(tbNumber.getText());
mainForm.runTab.numberOfSuccessesToStop.setValue(Settings.getInstance().numberOfSuccessesBeforeEnd);
} catch (NumberFormatException e) {
e.printStackTrace();
}
Settings.getInstance().saveAllSettings();
mainForm.updateAdditionalToolbarButtonsVisibility();
mainForm.reloadExternalLibraries();
this.close();
</DeepExtract>
mainForm.reloadAll();
} | snowride | positive | 2,811 |
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
if (action == MotionEvent.ACTION_DOWN) {
setSelected(true);
} else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
setSelected(false);
}
boolean ret = l.onTouch(v, event);
if (!ret && mOnTouchStateListener != null) {
return mOnTouchStateListener.onTouch(v, event);
} else {
return ret;
}
} | @Override
public boolean onTouch(View v, MotionEvent event) {
<DeepExtract>
int action = event.getAction();
if (action == MotionEvent.ACTION_DOWN) {
setSelected(true);
} else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
setSelected(false);
}
</DeepExtract>
boolean ret = l.onTouch(v, event);
if (!ret && mOnTouchStateListener != null) {
return mOnTouchStateListener.onTouch(v, event);
} else {
return ret;
}
} | FuAgoraDemoDroid | positive | 2,812 |
public void resume() {
openVideo(0);
} | public void resume() {
<DeepExtract>
openVideo(0);
</DeepExtract>
} | acfunm | positive | 2,813 |
@Override
public void actionPerformed(ActionEvent e) {
if (DownloadPanel.this.jTextField.getText() == null || DownloadPanel.this.jTextField.getText().trim().isEmpty()) {
} else if (DownloadPanel.this.jTextField.getText().startsWith("http://") || DownloadPanel.this.jTextField.getText().startsWith("https://")) {
addHttpDownloadTask(DownloadPanel.this.jTextField.getText().trim());
} else {
List<String> barcodes = newTaskInterpreter.getBarcodes(DownloadPanel.this.jTextField.getText().trim(), extractor);
for (String barcode : barcodes) {
addTask(barcode);
}
saveAllJobs(getTableModel().getModelData());
}
jTextField.setText("");
} | @Override
public void actionPerformed(ActionEvent e) {
<DeepExtract>
if (DownloadPanel.this.jTextField.getText() == null || DownloadPanel.this.jTextField.getText().trim().isEmpty()) {
} else if (DownloadPanel.this.jTextField.getText().startsWith("http://") || DownloadPanel.this.jTextField.getText().startsWith("https://")) {
addHttpDownloadTask(DownloadPanel.this.jTextField.getText().trim());
} else {
List<String> barcodes = newTaskInterpreter.getBarcodes(DownloadPanel.this.jTextField.getText().trim(), extractor);
for (String barcode : barcodes) {
addTask(barcode);
}
saveAllJobs(getTableModel().getModelData());
}
</DeepExtract>
jTextField.setText("");
} | dli-downloader | positive | 2,814 |
boolean moveToFist() {
P.bug(isUiThread());
P.bug(isUiThread());
if (0 < 0 || 0 >= mVs.length)
return false;
mVi = 0;
return true;
} | boolean moveToFist() {
P.bug(isUiThread());
<DeepExtract>
P.bug(isUiThread());
if (0 < 0 || 0 >= mVs.length)
return false;
mVi = 0;
return true;
</DeepExtract>
} | netmbuddy | positive | 2,815 |
public Criteria andFhLike(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "fh" + " cannot be null");
}
criteria.add(new Criterion("fh like", value));
return (Criteria) this;
} | public Criteria andFhLike(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "fh" + " cannot be null");
}
criteria.add(new Criterion("fh like", value));
</DeepExtract>
return (Criteria) this;
} | einvoice | positive | 2,816 |
public static MessageDigest getMd2Digest() {
try {
return MessageDigest.getInstance(MessageDigestAlgorithms.MD2);
} catch (final NoSuchAlgorithmException e) {
throw new IllegalArgumentException(e);
}
} | public static MessageDigest getMd2Digest() {
<DeepExtract>
try {
return MessageDigest.getInstance(MessageDigestAlgorithms.MD2);
} catch (final NoSuchAlgorithmException e) {
throw new IllegalArgumentException(e);
}
</DeepExtract>
} | pivaa | positive | 2,817 |
public void onDeath(PlayerDeathInArenaInfo info) {
SkyConfiguration config = plugin.getConfiguration();
SkyPlayer skyPlayer = plugin.getPlayers().getPlayer(info.getKilled().getUniqueId());
if (skyPlayer != null) {
skyPlayer.addScore(config.getDeathScoreDiff());
} else {
backend.addScore(info.getKilled().getUniqueId(), config.getDeathScoreDiff());
}
dataChanged();
} | public void onDeath(PlayerDeathInArenaInfo info) {
SkyConfiguration config = plugin.getConfiguration();
<DeepExtract>
SkyPlayer skyPlayer = plugin.getPlayers().getPlayer(info.getKilled().getUniqueId());
if (skyPlayer != null) {
skyPlayer.addScore(config.getDeathScoreDiff());
} else {
backend.addScore(info.getKilled().getUniqueId(), config.getDeathScoreDiff());
}
dataChanged();
</DeepExtract>
} | SkyWars | positive | 2,818 |
public DynamicResource getColorStrip(long platformId) {
final Minecraft minecraftClient = Minecraft.getInstance();
if (font == null || fontCjk == null) {
final ResourceManager resourceManager = minecraftClient.getResourceManager();
try {
font = Font.createFont(Font.TRUETYPE_FONT, Utilities.getInputStream(resourceManager.getResource(new ResourceLocation(MTR.MOD_ID, "font/noto-sans-semibold.ttf"))));
fontCjk = Font.createFont(Font.TRUETYPE_FONT, Utilities.getInputStream(resourceManager.getResource(new ResourceLocation(MTR.MOD_ID, "font/noto-serif-cjk-tc-semibold.ttf"))));
} catch (Exception e) {
e.printStackTrace();
}
}
if (!resourceRegistryQueue.isEmpty()) {
final Runnable runnable = resourceRegistryQueue.remove(0);
if (runnable != null) {
runnable.run();
}
}
final boolean needsRefresh = resourcesToRefresh.contains(String.format("color_%s", platformId));
final DynamicResource dynamicResource = dynamicResources.get(String.format("color_%s", platformId));
if (dynamicResource != null && !needsRefresh) {
return dynamicResource;
}
RouteMapGenerator.setConstants();
CompletableFuture.supplyAsync(() -> RouteMapGenerator.generateColorStrip(platformId)).thenAccept(nativeImage -> resourceRegistryQueue.add(() -> {
final DynamicResource staticTextureProviderOld = dynamicResources.get(String.format("color_%s", platformId));
if (staticTextureProviderOld != null) {
staticTextureProviderOld.remove();
}
final DynamicResource dynamicResourceNew;
if (nativeImage == null) {
dynamicResourceNew = DefaultRenderingColor.TRANSPARENT.dynamicResource;
} else {
final DynamicTexture dynamicTexture = new DynamicTexture(nativeImage);
String newKey = String.format("color_%s", platformId);
try {
newKey = URLEncoder.encode(String.format("color_%s", platformId), "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
final ResourceLocation resourceLocation = new ResourceLocation(MTR.MOD_ID, "dynamic_texture_" + newKey.toLowerCase(Locale.ENGLISH).replaceAll("[^0-9a-z_]", "_"));
minecraftClient.getTextureManager().register(resourceLocation, dynamicTexture);
dynamicResourceNew = new DynamicResource(resourceLocation, dynamicTexture);
}
dynamicResources.put(String.format("color_%s", platformId), dynamicResourceNew);
}));
if (needsRefresh) {
resourcesToRefresh.remove(String.format("color_%s", platformId));
}
if (dynamicResource == null) {
dynamicResources.put(String.format("color_%s", platformId), DefaultRenderingColor.TRANSPARENT.dynamicResource);
return DefaultRenderingColor.TRANSPARENT.dynamicResource;
} else {
return dynamicResource;
}
} | public DynamicResource getColorStrip(long platformId) {
<DeepExtract>
final Minecraft minecraftClient = Minecraft.getInstance();
if (font == null || fontCjk == null) {
final ResourceManager resourceManager = minecraftClient.getResourceManager();
try {
font = Font.createFont(Font.TRUETYPE_FONT, Utilities.getInputStream(resourceManager.getResource(new ResourceLocation(MTR.MOD_ID, "font/noto-sans-semibold.ttf"))));
fontCjk = Font.createFont(Font.TRUETYPE_FONT, Utilities.getInputStream(resourceManager.getResource(new ResourceLocation(MTR.MOD_ID, "font/noto-serif-cjk-tc-semibold.ttf"))));
} catch (Exception e) {
e.printStackTrace();
}
}
if (!resourceRegistryQueue.isEmpty()) {
final Runnable runnable = resourceRegistryQueue.remove(0);
if (runnable != null) {
runnable.run();
}
}
final boolean needsRefresh = resourcesToRefresh.contains(String.format("color_%s", platformId));
final DynamicResource dynamicResource = dynamicResources.get(String.format("color_%s", platformId));
if (dynamicResource != null && !needsRefresh) {
return dynamicResource;
}
RouteMapGenerator.setConstants();
CompletableFuture.supplyAsync(() -> RouteMapGenerator.generateColorStrip(platformId)).thenAccept(nativeImage -> resourceRegistryQueue.add(() -> {
final DynamicResource staticTextureProviderOld = dynamicResources.get(String.format("color_%s", platformId));
if (staticTextureProviderOld != null) {
staticTextureProviderOld.remove();
}
final DynamicResource dynamicResourceNew;
if (nativeImage == null) {
dynamicResourceNew = DefaultRenderingColor.TRANSPARENT.dynamicResource;
} else {
final DynamicTexture dynamicTexture = new DynamicTexture(nativeImage);
String newKey = String.format("color_%s", platformId);
try {
newKey = URLEncoder.encode(String.format("color_%s", platformId), "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
final ResourceLocation resourceLocation = new ResourceLocation(MTR.MOD_ID, "dynamic_texture_" + newKey.toLowerCase(Locale.ENGLISH).replaceAll("[^0-9a-z_]", "_"));
minecraftClient.getTextureManager().register(resourceLocation, dynamicTexture);
dynamicResourceNew = new DynamicResource(resourceLocation, dynamicTexture);
}
dynamicResources.put(String.format("color_%s", platformId), dynamicResourceNew);
}));
if (needsRefresh) {
resourcesToRefresh.remove(String.format("color_%s", platformId));
}
if (dynamicResource == null) {
dynamicResources.put(String.format("color_%s", platformId), DefaultRenderingColor.TRANSPARENT.dynamicResource);
return DefaultRenderingColor.TRANSPARENT.dynamicResource;
} else {
return dynamicResource;
}
</DeepExtract>
} | Minecraft-Transit-Railway | positive | 2,819 |
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXIST " + TABLE_PRODUCTS);
String query = "CREATE_TABLE" + TABLE_PRODUCTS + "(" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT" + COLUMN_PRODUCTNAME + "TEXT" + ")";
db.execSQL(query);
} | @Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXIST " + TABLE_PRODUCTS);
<DeepExtract>
String query = "CREATE_TABLE" + TABLE_PRODUCTS + "(" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT" + COLUMN_PRODUCTNAME + "TEXT" + ")";
db.execSQL(query);
</DeepExtract>
} | programming | positive | 2,820 |
public void mouseClicked(java.awt.event.MouseEvent evt) {
} | public void mouseClicked(java.awt.event.MouseEvent evt) {
<DeepExtract>
</DeepExtract>
} | vehler | positive | 2,822 |
public JsonObject buyItem(Item item, SRR req, Skins skins) throws NoConnectionException {
JsonObject ret = new JsonObject();
switch(item.section) {
case SRC.Store.dungeon:
cur = keys;
break;
case SRC.Store.event:
cur = eventcurrency;
break;
case SRC.Store.bones:
cur = bones;
break;
default:
cur = gold;
break;
}
int price = item.price;
if (price > getCurrency(cur)) {
ret.addProperty(SRC.errorMessage, "not enough " + cur.get());
return ret;
}
switch(item.name) {
case "chest":
ret.addProperty("buyType", BuyType.CHEST.toString());
Json.override(ret, Json.parseObj(req.purchaseChestItem(item.uid)));
if (ret.get(SRC.errorMessage).isJsonPrimitive())
return ret;
break;
case "skin":
ret.addProperty("buyType", BuyType.SKIN.toString());
Json.override(ret, Json.parseObj(req.purchaseStoreSkin(item.uid)));
if (ret.get(SRC.errorMessage).isJsonPrimitive())
return ret;
skins.addSkin(item.uid);
break;
default:
if (item.uid.equals("dailydrop")) {
ret.addProperty("buyType", BuyType.DAILY.toString());
Json.override(ret, Json.parseObj(req.grantDailyDrop()));
} else {
ret.addProperty("buyType", BuyType.ITEM.toString());
Json.override(ret, Json.parseObj(req.purchaseStoreItem(item.uid)));
}
if (ret.get(SRC.errorMessage).isJsonPrimitive())
return ret;
for (int i = 0; i < shopItems.size(); i++) {
JsonObject item_ = shopItems.get(i).getAsJsonObject();
if (item_.get("itemId").getAsString().equals(item.uid))
item_.addProperty("purchased", 1);
}
break;
}
decreaseCurrency(cur.get(), price);
return ret;
} | public JsonObject buyItem(Item item, SRR req, Skins skins) throws NoConnectionException {
JsonObject ret = new JsonObject();
switch(item.section) {
case SRC.Store.dungeon:
cur = keys;
break;
case SRC.Store.event:
cur = eventcurrency;
break;
case SRC.Store.bones:
cur = bones;
break;
default:
cur = gold;
break;
}
int price = item.price;
if (price > getCurrency(cur)) {
ret.addProperty(SRC.errorMessage, "not enough " + cur.get());
return ret;
}
switch(item.name) {
case "chest":
ret.addProperty("buyType", BuyType.CHEST.toString());
Json.override(ret, Json.parseObj(req.purchaseChestItem(item.uid)));
if (ret.get(SRC.errorMessage).isJsonPrimitive())
return ret;
break;
case "skin":
ret.addProperty("buyType", BuyType.SKIN.toString());
Json.override(ret, Json.parseObj(req.purchaseStoreSkin(item.uid)));
if (ret.get(SRC.errorMessage).isJsonPrimitive())
return ret;
skins.addSkin(item.uid);
break;
default:
if (item.uid.equals("dailydrop")) {
ret.addProperty("buyType", BuyType.DAILY.toString());
Json.override(ret, Json.parseObj(req.grantDailyDrop()));
} else {
ret.addProperty("buyType", BuyType.ITEM.toString());
Json.override(ret, Json.parseObj(req.purchaseStoreItem(item.uid)));
}
if (ret.get(SRC.errorMessage).isJsonPrimitive())
return ret;
for (int i = 0; i < shopItems.size(); i++) {
JsonObject item_ = shopItems.get(i).getAsJsonObject();
if (item_.get("itemId").getAsString().equals(item.uid))
item_.addProperty("purchased", 1);
}
break;
}
<DeepExtract>
decreaseCurrency(cur.get(), price);
</DeepExtract>
return ret;
} | StreamRaidersBot | positive | 2,823 |
public static void openGui(String searchText) {
try {
Class.forName("codechicken.nei.TextField").getDeclaredMethod("setText", String.class).invoke(Class.forName("codechicken.nei.LayoutManager").getDeclaredField("searchField").get(null), searchText);
} catch (Exception e) {
}
Minecraft.getMinecraft().displayGuiScreen(new GuiInventory(Minecraft.getMinecraft().thePlayer));
} | public static void openGui(String searchText) {
<DeepExtract>
try {
Class.forName("codechicken.nei.TextField").getDeclaredMethod("setText", String.class).invoke(Class.forName("codechicken.nei.LayoutManager").getDeclaredField("searchField").get(null), searchText);
} catch (Exception e) {
}
</DeepExtract>
Minecraft.getMinecraft().displayGuiScreen(new GuiInventory(Minecraft.getMinecraft().thePlayer));
} | Xenobyte | positive | 2,824 |
@Test
public void acquireReadWriteLocksOnTwoPages() throws Exception {
bp.getPage(tid1, p0, Permissions.READ_ONLY);
grabLock(tid2, p1, Permissions.READ_WRITE, true);
} | @Test
public void acquireReadWriteLocksOnTwoPages() throws Exception {
<DeepExtract>
bp.getPage(tid1, p0, Permissions.READ_ONLY);
grabLock(tid2, p1, Permissions.READ_WRITE, true);
</DeepExtract>
} | simple-db-hw | positive | 2,825 |
@Override
protected void onPostExecute(PassClickResult result) {
if (result.changed) {
changeReporter.run();
}
} | @Override
<DeepExtract>
</DeepExtract>
protected void onPostExecute(PassClickResult result) {
<DeepExtract>
</DeepExtract>
if (result.changed) {
<DeepExtract>
</DeepExtract>
changeReporter.run();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
} | zReader-mupdf | positive | 2,826 |
@Override
public void onRefresh() {
refreshSpinners();
new LoadStatData().execute(true);
} | @Override
public void onRefresh() {
<DeepExtract>
refreshSpinners();
new LoadStatData().execute(true);
</DeepExtract>
} | BetterBatteryStats | positive | 2,827 |
public static void smoothScrollToTargetView(RecyclerView recyclerView, View targetView) {
final RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (!(layoutManager instanceof ViewPagerLayoutManager))
return;
final int targetPosition = ((ViewPagerLayoutManager) layoutManager).getLayoutPositionOfView(targetView);
final int delta = (ViewPagerLayoutManager) layoutManager.getOffsetToPosition(targetPosition);
if ((ViewPagerLayoutManager) layoutManager.getOrientation() == ViewPagerLayoutManager.VERTICAL) {
recyclerView.smoothScrollBy(0, delta);
} else {
recyclerView.smoothScrollBy(delta, 0);
}
} | public static void smoothScrollToTargetView(RecyclerView recyclerView, View targetView) {
final RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (!(layoutManager instanceof ViewPagerLayoutManager))
return;
final int targetPosition = ((ViewPagerLayoutManager) layoutManager).getLayoutPositionOfView(targetView);
<DeepExtract>
final int delta = (ViewPagerLayoutManager) layoutManager.getOffsetToPosition(targetPosition);
if ((ViewPagerLayoutManager) layoutManager.getOrientation() == ViewPagerLayoutManager.VERTICAL) {
recyclerView.smoothScrollBy(0, delta);
} else {
recyclerView.smoothScrollBy(delta, 0);
}
</DeepExtract>
} | RxBanner | positive | 2,828 |
public void dump_with_types(PrintStream out, int n) {
dump_line(out, n);
out.println(Utilities.pad(n) + "_dispatch");
expr.dump_with_types(out, n + 2);
dump_AbstractSymbol(out, n + 2, name);
out.println(Utilities.pad(n + 2) + "(");
for (Enumeration e = actual.getElements(); e.hasMoreElements(); ) {
((Expression) e.nextElement()).dump_with_types(out, n + 2);
}
out.println(Utilities.pad(n + 2) + ")");
if (type != null) {
out.println(Utilities.pad(n) + ": " + type.getString());
} else {
out.println(Utilities.pad(n) + ": _no_type");
}
} | public void dump_with_types(PrintStream out, int n) {
dump_line(out, n);
out.println(Utilities.pad(n) + "_dispatch");
expr.dump_with_types(out, n + 2);
dump_AbstractSymbol(out, n + 2, name);
out.println(Utilities.pad(n + 2) + "(");
for (Enumeration e = actual.getElements(); e.hasMoreElements(); ) {
((Expression) e.nextElement()).dump_with_types(out, n + 2);
}
out.println(Utilities.pad(n + 2) + ")");
<DeepExtract>
if (type != null) {
out.println(Utilities.pad(n) + ": " + type.getString());
} else {
out.println(Utilities.pad(n) + ": _no_type");
}
</DeepExtract>
} | Cool-Compiler | positive | 2,830 |
@Override
public void onInitialApplication() {
ThMod.logger.info("SatelIllusPower : onInitialApplication : checkDrawPile");
int temp = AbstractDungeon.player.drawPile.size();
ThMod.logger.info("SatelIllusPower : checkDrawPile :" + " counter : " + counter + " ; drawPile size " + temp + " ; grant energy :" + (temp > counter));
if (temp > counter) {
this.flash();
AbstractDungeon.actionManager.addToBottom(new GainEnergyAction(this.amount));
}
if (temp != counter) {
counter = temp;
}
} | @Override
public void onInitialApplication() {
ThMod.logger.info("SatelIllusPower : onInitialApplication : checkDrawPile");
<DeepExtract>
int temp = AbstractDungeon.player.drawPile.size();
ThMod.logger.info("SatelIllusPower : checkDrawPile :" + " counter : " + counter + " ; drawPile size " + temp + " ; grant energy :" + (temp > counter));
if (temp > counter) {
this.flash();
AbstractDungeon.actionManager.addToBottom(new GainEnergyAction(this.amount));
}
if (temp != counter) {
counter = temp;
}
</DeepExtract>
} | STS_ThMod_MRS | positive | 2,831 |
public void launchPurchaseFlow(Activity act, String sku, String itemType, int requestCode, OnIabPurchaseFinishedListener listener, String extraData) {
if (mDisposed)
throw new IllegalStateException("IabHelper was disposed of, so it cannot be used.");
if (!mSetupDone) {
logError("Illegal state for operation (" + "launchPurchaseFlow" + "): IAB helper is not set up.");
throw new IllegalStateException("IAB helper is not set up. Can't perform operation: " + "launchPurchaseFlow");
}
if (mAsyncInProgress)
throw new IllegalStateException("Can't start async operation (" + "launchPurchaseFlow" + ") because another async operation(" + mAsyncOperation + ") is in progress.");
mAsyncOperation = "launchPurchaseFlow";
mAsyncInProgress = true;
logDebug("Starting async operation: " + "launchPurchaseFlow");
if (itemType.equals(ITEM_TYPE_SUBS) && !mSubscriptionsSupported) {
IabResult r = new IabResult(IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE, "Subscriptions are not available.");
flagEndAsync();
if (listener != null)
listener.onIabPurchaseFinished(r, null);
return;
}
try {
logDebug("Constructing buy intent for " + sku + ", item type: " + itemType);
Bundle buyIntentBundle = mService.getBuyIntent(3, mContext.getPackageName(), sku, itemType, extraData);
int response = getResponseCodeFromBundle(buyIntentBundle);
if (response != BILLING_RESPONSE_RESULT_OK) {
logError("Unable to buy item, Error response: " + getResponseDesc(response));
flagEndAsync();
result = new IabResult(response, "Unable to buy item");
if (listener != null)
listener.onIabPurchaseFinished(result, null);
return;
}
PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);
logDebug("Launching buy intent for " + sku + ". Request code: " + requestCode);
mRequestCode = requestCode;
mPurchaseListener = listener;
mPurchasingItemType = itemType;
act.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));
} catch (SendIntentException e) {
logError("SendIntentException while launching purchase flow for sku " + sku);
e.printStackTrace();
flagEndAsync();
result = new IabResult(IABHELPER_SEND_INTENT_FAILED, "Failed to send intent.");
if (listener != null)
listener.onIabPurchaseFinished(result, null);
} catch (RemoteException e) {
logError("RemoteException while launching purchase flow for sku " + sku);
e.printStackTrace();
flagEndAsync();
result = new IabResult(IABHELPER_REMOTE_EXCEPTION, "Remote exception while starting purchase flow");
if (listener != null)
listener.onIabPurchaseFinished(result, null);
}
} | public void launchPurchaseFlow(Activity act, String sku, String itemType, int requestCode, OnIabPurchaseFinishedListener listener, String extraData) {
if (mDisposed)
throw new IllegalStateException("IabHelper was disposed of, so it cannot be used.");
if (!mSetupDone) {
logError("Illegal state for operation (" + "launchPurchaseFlow" + "): IAB helper is not set up.");
throw new IllegalStateException("IAB helper is not set up. Can't perform operation: " + "launchPurchaseFlow");
}
<DeepExtract>
if (mAsyncInProgress)
throw new IllegalStateException("Can't start async operation (" + "launchPurchaseFlow" + ") because another async operation(" + mAsyncOperation + ") is in progress.");
mAsyncOperation = "launchPurchaseFlow";
mAsyncInProgress = true;
logDebug("Starting async operation: " + "launchPurchaseFlow");
</DeepExtract>
if (itemType.equals(ITEM_TYPE_SUBS) && !mSubscriptionsSupported) {
IabResult r = new IabResult(IABHELPER_SUBSCRIPTIONS_NOT_AVAILABLE, "Subscriptions are not available.");
flagEndAsync();
if (listener != null)
listener.onIabPurchaseFinished(r, null);
return;
}
try {
logDebug("Constructing buy intent for " + sku + ", item type: " + itemType);
Bundle buyIntentBundle = mService.getBuyIntent(3, mContext.getPackageName(), sku, itemType, extraData);
int response = getResponseCodeFromBundle(buyIntentBundle);
if (response != BILLING_RESPONSE_RESULT_OK) {
logError("Unable to buy item, Error response: " + getResponseDesc(response));
flagEndAsync();
result = new IabResult(response, "Unable to buy item");
if (listener != null)
listener.onIabPurchaseFinished(result, null);
return;
}
PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT);
logDebug("Launching buy intent for " + sku + ". Request code: " + requestCode);
mRequestCode = requestCode;
mPurchaseListener = listener;
mPurchasingItemType = itemType;
act.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));
} catch (SendIntentException e) {
logError("SendIntentException while launching purchase flow for sku " + sku);
e.printStackTrace();
flagEndAsync();
result = new IabResult(IABHELPER_SEND_INTENT_FAILED, "Failed to send intent.");
if (listener != null)
listener.onIabPurchaseFinished(result, null);
} catch (RemoteException e) {
logError("RemoteException while launching purchase flow for sku " + sku);
e.printStackTrace();
flagEndAsync();
result = new IabResult(IABHELPER_REMOTE_EXCEPTION, "Remote exception while starting purchase flow");
if (listener != null)
listener.onIabPurchaseFinished(result, null);
}
} | scdl | positive | 2,832 |
public void setFrom(Vector3 normal) {
if (released)
throw new IllegalStateException("plane released do not use it.");
zAxis.setFrom(normal);
xAxis.setFrom(normal);
xAxis.orthogonal();
yAxis.setFrom(normal);
yAxis.cross(xAxis);
xAxis.normalize();
yAxis.normalize();
zAxis.normalize();
} | public void setFrom(Vector3 normal) {
<DeepExtract>
if (released)
throw new IllegalStateException("plane released do not use it.");
</DeepExtract>
zAxis.setFrom(normal);
xAxis.setFrom(normal);
xAxis.orthogonal();
yAxis.setFrom(normal);
yAxis.cross(xAxis);
xAxis.normalize();
yAxis.normalize();
zAxis.normalize();
} | Tanks | positive | 2,833 |
@Override
public void onDestroy() {
if (mFrameBufferTextures != null) {
GLES20.glDeleteTextures(mFrameBufferTextures.length, mFrameBufferTextures, 0);
mFrameBufferTextures = null;
}
if (mFrameBuffers != null) {
GLES20.glDeleteFramebuffers(mFrameBuffers.length, mFrameBuffers, 0);
mFrameBuffers = null;
}
for (GPUImageFilter filter : mFilters) {
filter.destroy();
}
super.onDestroy();
} | @Override
public void onDestroy() {
<DeepExtract>
if (mFrameBufferTextures != null) {
GLES20.glDeleteTextures(mFrameBufferTextures.length, mFrameBufferTextures, 0);
mFrameBufferTextures = null;
}
if (mFrameBuffers != null) {
GLES20.glDeleteFramebuffers(mFrameBuffers.length, mFrameBuffers, 0);
mFrameBuffers = null;
}
</DeepExtract>
for (GPUImageFilter filter : mFilters) {
filter.destroy();
}
super.onDestroy();
} | KSYStreamer_Android | positive | 2,834 |
public WaybackStatistics getWayBackStatistics(int statusCode, String url, String url_norm, String crawlDate) throws Exception {
final long startNS = System.nanoTime();
WaybackStatistics stats = new WaybackStatistics();
stats.setStatusCode(statusCode);
stats.setUrl(url);
stats.setUrl_norm(url_norm);
stats.setLastHarvestDate(crawlDate);
stats.setFirstHarvestDate(crawlDate);
String domain = null;
stats.setHarvestDate(crawlDate);
final String statsField = "crawl_date";
long results = 0;
String query = "url_norm:\"" + url_norm + "\" AND crawl_date:{\"" + crawlDate + "\" TO *]";
SolrQuery solrQuery = new SolrQuery(query);
solrQuery.setRows(1);
solrQuery.setGetFieldStatistics(true);
solrQuery.setGetFieldStatistics(statsField);
long call1ns = -System.nanoTime();
SolrUtils.setSolrParams(solrQuery);
QueryResponse rsp;
SolrUtils.setSolrParams(solrQuery);
try {
rsp = METHOD.POST ? solrServer.query(solrQuery, METHOD.POST) : noCacheSolrServer.query(solrQuery, METHOD.POST);
} catch (SolrServerException e) {
throw new RuntimeException("SolrServerException issuing query", e);
} catch (IOException e) {
throw new RuntimeException("IOException issuing query", e);
}
call1ns += System.nanoTime();
final long call1nsSolr = rsp.getQTime();
results += rsp.getResults().getNumFound();
if (rsp.getResults().getNumFound() != 0) {
domain = (String) rsp.getResults().get(0).getFieldValue("domain");
final FieldStatsInfo fieldStats = rsp.getFieldStatsInfo().get(statsField);
if (fieldStats != null) {
stats.setLastHarvestDate(DateUtils.getSolrDate((Date) fieldStats.getMax()));
String next = DateUtils.getSolrDate((Date) fieldStats.getMin());
if (!crawlDate.equals(next)) {
stats.setNextHarvestDate(next);
}
}
}
solrQuery = new SolrQuery("(url_norm:\"" + url_norm + "\") AND crawl_date:[* TO \"" + crawlDate + "\"}");
solrQuery.setRows(1);
solrQuery.add("fl", "domain");
solrQuery.setGetFieldStatistics(true);
solrQuery.setGetFieldStatistics(statsField);
long call2ns = -System.nanoTime();
SolrUtils.setSolrParams(solrQuery);
SolrUtils.setSolrParams(solrQuery);
try {
rsp = METHOD.POST ? solrServer.query(solrQuery, METHOD.POST) : noCacheSolrServer.query(solrQuery, METHOD.POST);
} catch (SolrServerException e) {
throw new RuntimeException("SolrServerException issuing query", e);
} catch (IOException e) {
throw new RuntimeException("IOException issuing query", e);
}
call2ns += System.nanoTime();
final long call2nsSolr = rsp.getQTime();
results += rsp.getResults().getNumFound();
if (rsp.getResults().getNumFound() != 0) {
domain = (String) rsp.getResults().get(0).getFieldValue("domain");
final FieldStatsInfo fieldStats = rsp.getFieldStatsInfo().get(statsField);
if (fieldStats != null) {
stats.setFirstHarvestDate(DateUtils.getSolrDate((Date) fieldStats.getMin()));
String previous = DateUtils.getSolrDate((Date) fieldStats.getMax());
if (!crawlDate.equals(previous)) {
stats.setPreviousHarvestDate(previous);
}
}
}
stats.setNumberOfHarvest(results + 1);
long callDomain = -1;
long callDomainSolr = -1;
if (domain == null) {
solrQuery = new SolrQuery("url_norm:\"" + url_norm + "\"");
solrQuery.setRows(1);
solrQuery.setGetFieldStatistics(true);
solrQuery.setGetFieldStatistics(statsField);
callDomain = -System.nanoTime();
SolrUtils.setSolrParams(solrQuery);
rsp = solrServer.query(solrQuery, METHOD.POST);
callDomain += System.nanoTime();
callDomainSolr = rsp.getQTime();
if (rsp.getResults().size() == 0) {
return stats;
}
domain = (String) rsp.getResults().get(0).getFieldValue("domain");
}
stats.setDomain(domain);
solrQuery = new SolrQuery("domain:\"" + domain + "\"");
solrQuery.setRows(0);
solrQuery.setGetFieldStatistics(true);
solrQuery.setGetFieldStatistics("content_length");
long call3ns = -System.nanoTime();
SolrUtils.setSolrParams(solrQuery);
SolrUtils.setSolrParams(solrQuery);
try {
rsp = METHOD.POST ? solrServer.query(solrQuery, METHOD.POST) : noCacheSolrServer.query(solrQuery, METHOD.POST);
} catch (SolrServerException e) {
throw new RuntimeException("SolrServerException issuing query", e);
} catch (IOException e) {
throw new RuntimeException("IOException issuing query", e);
}
call3ns += System.nanoTime();
final long call3nsSolr = rsp.getQTime();
long numberHarvestDomain = rsp.getResults().getNumFound();
stats.setNumberHarvestDomain(numberHarvestDomain);
if (numberHarvestDomain != 0) {
final FieldStatsInfo fieldStats = rsp.getFieldStatsInfo().get("content_length");
if (fieldStats != null) {
double totalContentLength = (Double) fieldStats.getSum();
stats.setDomainHarvestTotalContentLength((long) totalContentLength);
}
}
log.info(String.format("Wayback statistics for url='%s', solrdate=%s extracted in %d ms " + "(call_1=%d ms (qtime=%d ms), call_2=%d ms (qtime=%d ms), call_3=%d ms (qtime=%d ms), " + "domain_call=%d ms (qtime=%d ms))", url_norm.length() > 50 ? url_norm.substring(0, 50) + "..." : url_norm, crawlDate, (System.nanoTime() - startNS) / M, call1ns / M, call1nsSolr, call2ns / M, call2nsSolr, call3ns / M, call3nsSolr, callDomain / M, callDomainSolr));
return stats;
} | public WaybackStatistics getWayBackStatistics(int statusCode, String url, String url_norm, String crawlDate) throws Exception {
final long startNS = System.nanoTime();
WaybackStatistics stats = new WaybackStatistics();
stats.setStatusCode(statusCode);
stats.setUrl(url);
stats.setUrl_norm(url_norm);
stats.setLastHarvestDate(crawlDate);
stats.setFirstHarvestDate(crawlDate);
String domain = null;
stats.setHarvestDate(crawlDate);
final String statsField = "crawl_date";
long results = 0;
String query = "url_norm:\"" + url_norm + "\" AND crawl_date:{\"" + crawlDate + "\" TO *]";
SolrQuery solrQuery = new SolrQuery(query);
solrQuery.setRows(1);
solrQuery.setGetFieldStatistics(true);
solrQuery.setGetFieldStatistics(statsField);
long call1ns = -System.nanoTime();
SolrUtils.setSolrParams(solrQuery);
QueryResponse rsp;
<DeepExtract>
SolrUtils.setSolrParams(solrQuery);
try {
rsp = METHOD.POST ? solrServer.query(solrQuery, METHOD.POST) : noCacheSolrServer.query(solrQuery, METHOD.POST);
} catch (SolrServerException e) {
throw new RuntimeException("SolrServerException issuing query", e);
} catch (IOException e) {
throw new RuntimeException("IOException issuing query", e);
}
</DeepExtract>
call1ns += System.nanoTime();
final long call1nsSolr = rsp.getQTime();
results += rsp.getResults().getNumFound();
if (rsp.getResults().getNumFound() != 0) {
domain = (String) rsp.getResults().get(0).getFieldValue("domain");
final FieldStatsInfo fieldStats = rsp.getFieldStatsInfo().get(statsField);
if (fieldStats != null) {
stats.setLastHarvestDate(DateUtils.getSolrDate((Date) fieldStats.getMax()));
String next = DateUtils.getSolrDate((Date) fieldStats.getMin());
if (!crawlDate.equals(next)) {
stats.setNextHarvestDate(next);
}
}
}
solrQuery = new SolrQuery("(url_norm:\"" + url_norm + "\") AND crawl_date:[* TO \"" + crawlDate + "\"}");
solrQuery.setRows(1);
solrQuery.add("fl", "domain");
solrQuery.setGetFieldStatistics(true);
solrQuery.setGetFieldStatistics(statsField);
long call2ns = -System.nanoTime();
SolrUtils.setSolrParams(solrQuery);
<DeepExtract>
SolrUtils.setSolrParams(solrQuery);
try {
rsp = METHOD.POST ? solrServer.query(solrQuery, METHOD.POST) : noCacheSolrServer.query(solrQuery, METHOD.POST);
} catch (SolrServerException e) {
throw new RuntimeException("SolrServerException issuing query", e);
} catch (IOException e) {
throw new RuntimeException("IOException issuing query", e);
}
</DeepExtract>
call2ns += System.nanoTime();
final long call2nsSolr = rsp.getQTime();
results += rsp.getResults().getNumFound();
if (rsp.getResults().getNumFound() != 0) {
domain = (String) rsp.getResults().get(0).getFieldValue("domain");
final FieldStatsInfo fieldStats = rsp.getFieldStatsInfo().get(statsField);
if (fieldStats != null) {
stats.setFirstHarvestDate(DateUtils.getSolrDate((Date) fieldStats.getMin()));
String previous = DateUtils.getSolrDate((Date) fieldStats.getMax());
if (!crawlDate.equals(previous)) {
stats.setPreviousHarvestDate(previous);
}
}
}
stats.setNumberOfHarvest(results + 1);
long callDomain = -1;
long callDomainSolr = -1;
if (domain == null) {
solrQuery = new SolrQuery("url_norm:\"" + url_norm + "\"");
solrQuery.setRows(1);
solrQuery.setGetFieldStatistics(true);
solrQuery.setGetFieldStatistics(statsField);
callDomain = -System.nanoTime();
SolrUtils.setSolrParams(solrQuery);
rsp = solrServer.query(solrQuery, METHOD.POST);
callDomain += System.nanoTime();
callDomainSolr = rsp.getQTime();
if (rsp.getResults().size() == 0) {
return stats;
}
domain = (String) rsp.getResults().get(0).getFieldValue("domain");
}
stats.setDomain(domain);
solrQuery = new SolrQuery("domain:\"" + domain + "\"");
solrQuery.setRows(0);
solrQuery.setGetFieldStatistics(true);
solrQuery.setGetFieldStatistics("content_length");
long call3ns = -System.nanoTime();
SolrUtils.setSolrParams(solrQuery);
<DeepExtract>
SolrUtils.setSolrParams(solrQuery);
try {
rsp = METHOD.POST ? solrServer.query(solrQuery, METHOD.POST) : noCacheSolrServer.query(solrQuery, METHOD.POST);
} catch (SolrServerException e) {
throw new RuntimeException("SolrServerException issuing query", e);
} catch (IOException e) {
throw new RuntimeException("IOException issuing query", e);
}
</DeepExtract>
call3ns += System.nanoTime();
final long call3nsSolr = rsp.getQTime();
long numberHarvestDomain = rsp.getResults().getNumFound();
stats.setNumberHarvestDomain(numberHarvestDomain);
if (numberHarvestDomain != 0) {
final FieldStatsInfo fieldStats = rsp.getFieldStatsInfo().get("content_length");
if (fieldStats != null) {
double totalContentLength = (Double) fieldStats.getSum();
stats.setDomainHarvestTotalContentLength((long) totalContentLength);
}
}
log.info(String.format("Wayback statistics for url='%s', solrdate=%s extracted in %d ms " + "(call_1=%d ms (qtime=%d ms), call_2=%d ms (qtime=%d ms), call_3=%d ms (qtime=%d ms), " + "domain_call=%d ms (qtime=%d ms))", url_norm.length() > 50 ? url_norm.substring(0, 50) + "..." : url_norm, crawlDate, (System.nanoTime() - startNS) / M, call1ns / M, call1nsSolr, call2ns / M, call2nsSolr, call3ns / M, call3nsSolr, callDomain / M, callDomainSolr));
return stats;
} | solrwayback | positive | 2,835 |
public static <T> Response<T> createSuccessResponse() {
Response<T> response = new Response<>();
response.setCode(SUCCESS);
if (null != null) {
response.setDescription(null);
}
return response;
} | public static <T> Response<T> createSuccessResponse() {
<DeepExtract>
Response<T> response = new Response<>();
response.setCode(SUCCESS);
if (null != null) {
response.setDescription(null);
}
return response;
</DeepExtract>
} | hkr-si | positive | 2,836 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.