before stringlengths 12 3.21M | after stringlengths 41 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (mEtSearch.getText().toString().length() >= 1) {
mToolbarSearch.getMenu().clear();
mToolbarSearch.inflateMenu(R.menu.menu_search_clear);
} else {
mToolbarSearch.getMenu().clear();
mToolbarSearch.inflateMenu(R.menu.menu_search);
}
mItem.clear();
if (mItem.size() == 0) {
mListViewSearchResults.setVisibility(View.GONE);
} else {
mListViewSearchResults.setVisibility(View.VISIBLE);
}
mEtSearchAdapter.notifyDataSetChanged();
} | @Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (mEtSearch.getText().toString().length() >= 1) {
mToolbarSearch.getMenu().clear();
mToolbarSearch.inflateMenu(R.menu.menu_search_clear);
} else {
mToolbarSearch.getMenu().clear();
mToolbarSearch.inflateMenu(R.menu.menu_search);
}
mItem.clear();
<DeepExtract>
if (mItem.size() == 0) {
mListViewSearchResults.setVisibility(View.GONE);
} else {
mListViewSearchResults.setVisibility(View.VISIBLE);
}
mEtSearchAdapter.notifyDataSetChanged();
</DeepExtract>
} | FitHealthBetaGitRepo | positive | 3,620 |
@Override
public Bitmap execute(Context context, Bitmap resource) throws PreprocessException {
if (p1.x == p2.x || p1.y == p2.y) {
throw new PreprocessException("Points do not make a diagonal");
}
if (p1.x < p2.x) {
startX = p1.x;
width = p2.x - p1.x;
} else {
startX = p2.x;
width = p1.x - p2.x;
}
if (p1.y < p2.y) {
startY = p1.y;
height = p2.y - p1.y;
} else {
startY = p2.y;
height = p1.y - p2.y;
}
boolean isOutOfBounds = false;
if (startX < 0 || startX > resource.getWidth()) {
isOutOfBounds = true;
} else if (width > resource.getWidth() || startX + width > resource.getWidth()) {
isOutOfBounds = true;
} else if (startY < 0 || startY > resource.getHeight()) {
isOutOfBounds = true;
} else if (height > resource.getHeight() || startY + height > resource.getHeight()) {
isOutOfBounds = true;
}
if (isOutOfBounds) {
throw new PreprocessException("Out of bounds");
}
return Bitmap.createBitmap(resource, startX, startY, width, height);
} | @Override
public Bitmap execute(Context context, Bitmap resource) throws PreprocessException {
if (p1.x == p2.x || p1.y == p2.y) {
throw new PreprocessException("Points do not make a diagonal");
}
if (p1.x < p2.x) {
startX = p1.x;
width = p2.x - p1.x;
} else {
startX = p2.x;
width = p1.x - p2.x;
}
if (p1.y < p2.y) {
startY = p1.y;
height = p2.y - p1.y;
} else {
startY = p2.y;
height = p1.y - p2.y;
}
<DeepExtract>
boolean isOutOfBounds = false;
if (startX < 0 || startX > resource.getWidth()) {
isOutOfBounds = true;
} else if (width > resource.getWidth() || startX + width > resource.getWidth()) {
isOutOfBounds = true;
} else if (startY < 0 || startY > resource.getHeight()) {
isOutOfBounds = true;
} else if (height > resource.getHeight() || startY + height > resource.getHeight()) {
isOutOfBounds = true;
}
if (isOutOfBounds) {
throw new PreprocessException("Out of bounds");
}
</DeepExtract>
return Bitmap.createBitmap(resource, startX, startY, width, height);
} | cloudinary_android | positive | 3,621 |
private void addOffer(TradingOffer offer) {
assert offer != null;
Iterator<TradingOffer> iterator = offers.iterator();
while (iterator.hasNext()) {
if (Utils.isSimilar(iterator.next().getResultItem(), offer.getResultItem())) {
iterator.remove();
break;
}
}
offers.add(offer);
} | private void addOffer(TradingOffer offer) {
assert offer != null;
<DeepExtract>
Iterator<TradingOffer> iterator = offers.iterator();
while (iterator.hasNext()) {
if (Utils.isSimilar(iterator.next().getResultItem(), offer.getResultItem())) {
iterator.remove();
break;
}
}
</DeepExtract>
offers.add(offer);
} | Shopkeepers | positive | 3,622 |
@Override
public void onClick(View v) {
fragmentManager = getFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
if (f1 != null) {
transaction.hide(f1);
}
if (f2 != null) {
transaction.hide(f2);
}
if (f3 != null) {
transaction.hide(f3);
}
switch(v.getId()) {
case R.id.tab_circulate:
selected();
tabCirculate.setSelected(true);
if (f2 == null) {
f2 = new CirculateFragment();
transaction.add(R.id.fragment_container, f2);
} else {
transaction.show(f2);
}
break;
case R.id.tab_first_page:
selected();
tabFirstPage.setSelected(true);
if (f1 == null) {
f1 = new FirstFragment();
transaction.add(R.id.fragment_container, f1);
} else {
transaction.show(f1);
}
break;
case R.id.tab_my:
selected();
tabMy.setSelected(true);
if (f3 == null) {
f3 = new MyFragment();
transaction.add(R.id.fragment_container, f3);
} else {
transaction.show(f3);
}
break;
}
transaction.commit();
} | @Override
public void onClick(View v) {
fragmentManager = getFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
<DeepExtract>
if (f1 != null) {
transaction.hide(f1);
}
if (f2 != null) {
transaction.hide(f2);
}
if (f3 != null) {
transaction.hide(f3);
}
</DeepExtract>
switch(v.getId()) {
case R.id.tab_circulate:
selected();
tabCirculate.setSelected(true);
if (f2 == null) {
f2 = new CirculateFragment();
transaction.add(R.id.fragment_container, f2);
} else {
transaction.show(f2);
}
break;
case R.id.tab_first_page:
selected();
tabFirstPage.setSelected(true);
if (f1 == null) {
f1 = new FirstFragment();
transaction.add(R.id.fragment_container, f1);
} else {
transaction.show(f1);
}
break;
case R.id.tab_my:
selected();
tabMy.setSelected(true);
if (f3 == null) {
f3 = new MyFragment();
transaction.add(R.id.fragment_container, f3);
} else {
transaction.show(f3);
}
break;
}
transaction.commit();
} | Ethereum-Coupon | positive | 3,623 |
@Override
public void onFailure(@NonNull Error error) {
DebugLog.e(error.getMessage(), error.getException());
getView().hideProgressDialog();
getView().showBriefMessage(ResString.getLoginFail());
} | @Override
public void onFailure(@NonNull Error error) {
DebugLog.e(error.getMessage(), error.getException());
getView().hideProgressDialog();
<DeepExtract>
getView().showBriefMessage(ResString.getLoginFail());
</DeepExtract>
} | GitEgo | positive | 3,624 |
@Override
protected void addAsWork() {
requireNotStopped(this);
return workQueue.addWaitingWork(this);
} | @Override
protected void addAsWork() {
<DeepExtract>
requireNotStopped(this);
return workQueue.addWaitingWork(this);
</DeepExtract>
} | JALSE | positive | 3,626 |
public void onDownloadError(Exception e) {
status = STATUS.ERROR;
loaded = total = 0;
if (this.listener != null)
this.listener.onDownloadError(this, e);
} | public void onDownloadError(Exception e) {
<DeepExtract>
status = STATUS.ERROR;
loaded = total = 0;
</DeepExtract>
if (this.listener != null)
this.listener.onDownloadError(this, e);
} | DynamicWallpaper | positive | 3,627 |
public void writeLong(long v) {
assert (hasCapacity(8));
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 0) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 8) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 16) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 24) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 32) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 40) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 48) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 56) & 0xFF;
buffer.length--;
} | public void writeLong(long v) {
assert (hasCapacity(8));
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 0) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 8) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 16) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 24) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 32) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 40) & 0xFF;
buffer.length--;
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 48) & 0xFF;
buffer.length--;
<DeepExtract>
assert (hasCapacity(1));
buffer.data[buffer.offset++] = (byte) (int) (v >>> 56) & 0xFF;
buffer.length--;
</DeepExtract>
} | hawtbuf | positive | 3,628 |
public E poll() {
if (head.next == null)
return null;
E min = null;
Node<E> nodeBeforeMin = null;
for (Node<E> prevNode = head; ; ) {
Node<E> node = prevNode.next;
if (node == null)
break;
if (min == null || node.value.compareTo(min) < 0) {
min = node.value;
nodeBeforeMin = prevNode;
}
prevNode = node;
}
assert min != null && nodeBeforeMin != null;
Node<E> minNode = nodeBeforeMin.next;
nodeBeforeMin.next = minNode.next;
minNode.next = null;
if (minNode.removeRoot() == this)
throw new IllegalArgumentException();
merge(minNode.removeRoot().head.next);
minNode.removeRoot().head.next = null;
return min;
} | public E poll() {
if (head.next == null)
return null;
E min = null;
Node<E> nodeBeforeMin = null;
for (Node<E> prevNode = head; ; ) {
Node<E> node = prevNode.next;
if (node == null)
break;
if (min == null || node.value.compareTo(min) < 0) {
min = node.value;
nodeBeforeMin = prevNode;
}
prevNode = node;
}
assert min != null && nodeBeforeMin != null;
Node<E> minNode = nodeBeforeMin.next;
nodeBeforeMin.next = minNode.next;
minNode.next = null;
<DeepExtract>
if (minNode.removeRoot() == this)
throw new IllegalArgumentException();
merge(minNode.removeRoot().head.next);
minNode.removeRoot().head.next = null;
</DeepExtract>
return min;
} | Nayuki-web-published-code | positive | 3,629 |
@Test
void test_patient_encounter_no_message_header() throws IOException {
String hl7message = "MSH|^~\\&|SE050|050|PACS|050|20120912011230||ADT^A01|102|T|2.6|||AL|NE|764|ASCII||||||\r" + "EVN||201209122222\r" + "PID|0010||PID1234^5^M11^A^MR^HOSP~1234568965^^^USA^SS||DOE^JOHN^A^||19800202|F||W|111 TEST_STREET_NAME^^TEST_CITY^NY^111-1111^USA||(905)111-1111|||S|ZZ|12^^^124|34-13-312||||TEST_BIRTH_PLACE\r" + "PV1|1|ff|yyy|EL|ABC||200^ATTEND_DOC_FAMILY_TEST^ATTEND_DOC_GIVEN_TEST|201^REFER_DOC_FAMILY_TEST^REFER_DOC_GIVEN_TEST|202^CONSULTING_DOC_FAMILY_TEST^CONSULTING_DOC_GIVEN_TEST|MED|||||B6|E|272^ADMITTING_DOC_FAMILY_TEST^ADMITTING_DOC_GIVEN_TEST||48390|||||||||||||||||||||||||201409122200|20150206031726\r" + "OBX|1|TX|1234||ECHOCARDIOGRAPHIC REPORT||||||F|||||2740^TRDSE^Janetary~2913^MRTTE^Darren^F~3065^MGHOBT^Paul^J~4723^LOTHDEW^Robert^L|\r" + "AL1|1|DRUG|00000741^OXYCODONE||HYPOTENSION\r" + "AL1|2|DRUG|00001433^TRAMADOL||SEIZURES~VOMITING\r" + "PRB|AD|200603150625|aortic stenosis|53692||2||200603150625";
String json = ftv.convert(hl7message, OPTIONS);
LOGGER.debug("FHIR json result:\n" + json);
FHIRContext context = new FHIRContext();
IBaseResource bundleResource = context.getParser().parseResource(json);
assertThat(bundleResource).isNotNull();
Bundle b = (Bundle) bundleResource;
assertThat(b.getType()).isEqualTo(Constants.DEFAULT_BUNDLE_TYPE);
assertThat(b.getId()).isNotNull();
assertThat(b.getMeta().getLastUpdated()).isNotNull();
List<BundleEntryComponent> e = b.getEntry();
List<Resource> patientResource = e.stream().filter(v -> ResourceType.Patient == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(patientResource).hasSize(1);
List<Resource> encounterResource = e.stream().filter(v -> ResourceType.Encounter == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(encounterResource).hasSize(1);
List<Resource> obsResource = e.stream().filter(v -> ResourceType.Observation == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(obsResource).isEmpty();
List<Resource> pracResource = e.stream().filter(v -> ResourceType.Practitioner == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(pracResource).hasSize(4);
List<Resource> allergyResources = e.stream().filter(v -> ResourceType.AllergyIntolerance == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(allergyResources).hasSize(2);
if (false) {
List<Resource> messageHeader = e.stream().filter(v -> ResourceType.MessageHeader == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(messageHeader).hasSize(1);
}
} | @Test
void test_patient_encounter_no_message_header() throws IOException {
String hl7message = "MSH|^~\\&|SE050|050|PACS|050|20120912011230||ADT^A01|102|T|2.6|||AL|NE|764|ASCII||||||\r" + "EVN||201209122222\r" + "PID|0010||PID1234^5^M11^A^MR^HOSP~1234568965^^^USA^SS||DOE^JOHN^A^||19800202|F||W|111 TEST_STREET_NAME^^TEST_CITY^NY^111-1111^USA||(905)111-1111|||S|ZZ|12^^^124|34-13-312||||TEST_BIRTH_PLACE\r" + "PV1|1|ff|yyy|EL|ABC||200^ATTEND_DOC_FAMILY_TEST^ATTEND_DOC_GIVEN_TEST|201^REFER_DOC_FAMILY_TEST^REFER_DOC_GIVEN_TEST|202^CONSULTING_DOC_FAMILY_TEST^CONSULTING_DOC_GIVEN_TEST|MED|||||B6|E|272^ADMITTING_DOC_FAMILY_TEST^ADMITTING_DOC_GIVEN_TEST||48390|||||||||||||||||||||||||201409122200|20150206031726\r" + "OBX|1|TX|1234||ECHOCARDIOGRAPHIC REPORT||||||F|||||2740^TRDSE^Janetary~2913^MRTTE^Darren^F~3065^MGHOBT^Paul^J~4723^LOTHDEW^Robert^L|\r" + "AL1|1|DRUG|00000741^OXYCODONE||HYPOTENSION\r" + "AL1|2|DRUG|00001433^TRAMADOL||SEIZURES~VOMITING\r" + "PRB|AD|200603150625|aortic stenosis|53692||2||200603150625";
String json = ftv.convert(hl7message, OPTIONS);
LOGGER.debug("FHIR json result:\n" + json);
<DeepExtract>
FHIRContext context = new FHIRContext();
IBaseResource bundleResource = context.getParser().parseResource(json);
assertThat(bundleResource).isNotNull();
Bundle b = (Bundle) bundleResource;
assertThat(b.getType()).isEqualTo(Constants.DEFAULT_BUNDLE_TYPE);
assertThat(b.getId()).isNotNull();
assertThat(b.getMeta().getLastUpdated()).isNotNull();
List<BundleEntryComponent> e = b.getEntry();
List<Resource> patientResource = e.stream().filter(v -> ResourceType.Patient == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(patientResource).hasSize(1);
List<Resource> encounterResource = e.stream().filter(v -> ResourceType.Encounter == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(encounterResource).hasSize(1);
List<Resource> obsResource = e.stream().filter(v -> ResourceType.Observation == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(obsResource).isEmpty();
List<Resource> pracResource = e.stream().filter(v -> ResourceType.Practitioner == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(pracResource).hasSize(4);
List<Resource> allergyResources = e.stream().filter(v -> ResourceType.AllergyIntolerance == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(allergyResources).hasSize(2);
if (false) {
List<Resource> messageHeader = e.stream().filter(v -> ResourceType.MessageHeader == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
assertThat(messageHeader).hasSize(1);
}
</DeepExtract>
} | hl7v2-fhir-converter | positive | 3,630 |
public void beginUserInitiatedSignIn() {
if (mDebugLog) {
Log.d(TAG, "GameHelper: " + "beginUserInitiatedSignIn: resetting attempt count.");
}
SharedPreferences.Editor editor = mAppContext.getSharedPreferences(GAMEHELPER_SHARED_PREFS, Context.MODE_PRIVATE).edit();
editor.putInt(KEY_SIGN_IN_CANCELLATIONS, 0);
editor.commit();
mSignInCancelled = false;
mConnectOnStart = true;
if (mGoogleApiClient.isConnected()) {
logWarn("beginUserInitiatedSignIn() called when already connected. " + "Calling listener directly to notify of success.");
notifyListener(true);
return;
} else if (mConnecting) {
logWarn("beginUserInitiatedSignIn() called when already connecting. " + "Be patient! You can only call this method after you get an " + "onSignInSucceeded() or onSignInFailed() callback. Suggestion: disable " + "the sign-in button on startup and also when it's clicked, and re-enable " + "when you get the callback.");
return;
}
if (mDebugLog) {
Log.d(TAG, "GameHelper: " + "Starting USER-INITIATED sign-in flow.");
}
mUserInitiatedSignIn = true;
if (mConnectionResult != null) {
debugLog("beginUserInitiatedSignIn: continuing pending sign-in flow.");
mConnecting = true;
resolveConnectionResult();
} else {
debugLog("beginUserInitiatedSignIn: starting new sign-in flow.");
mConnecting = true;
connect();
}
} | public void beginUserInitiatedSignIn() {
if (mDebugLog) {
Log.d(TAG, "GameHelper: " + "beginUserInitiatedSignIn: resetting attempt count.");
}
SharedPreferences.Editor editor = mAppContext.getSharedPreferences(GAMEHELPER_SHARED_PREFS, Context.MODE_PRIVATE).edit();
editor.putInt(KEY_SIGN_IN_CANCELLATIONS, 0);
editor.commit();
mSignInCancelled = false;
mConnectOnStart = true;
if (mGoogleApiClient.isConnected()) {
logWarn("beginUserInitiatedSignIn() called when already connected. " + "Calling listener directly to notify of success.");
notifyListener(true);
return;
} else if (mConnecting) {
logWarn("beginUserInitiatedSignIn() called when already connecting. " + "Be patient! You can only call this method after you get an " + "onSignInSucceeded() or onSignInFailed() callback. Suggestion: disable " + "the sign-in button on startup and also when it's clicked, and re-enable " + "when you get the callback.");
return;
}
<DeepExtract>
if (mDebugLog) {
Log.d(TAG, "GameHelper: " + "Starting USER-INITIATED sign-in flow.");
}
</DeepExtract>
mUserInitiatedSignIn = true;
if (mConnectionResult != null) {
debugLog("beginUserInitiatedSignIn: continuing pending sign-in flow.");
mConnecting = true;
resolveConnectionResult();
} else {
debugLog("beginUserInitiatedSignIn: starting new sign-in flow.");
mConnecting = true;
connect();
}
} | ChaseWhisplyProject | positive | 3,631 |
private Shape getRoundedClipShape(int x, int y, int w, int h, int arcw, int arch, int corners) {
if (roundedClipShape == null) {
roundedClipShape = new RoundRectClipShape();
}
this.corners = corners;
this.x = x;
this.y = y;
this.width = w;
this.height = h;
this.arcwidth = arcw;
this.archeight = arch;
return roundedClipShape;
} | private Shape getRoundedClipShape(int x, int y, int w, int h, int arcw, int arch, int corners) {
if (roundedClipShape == null) {
roundedClipShape = new RoundRectClipShape();
}
<DeepExtract>
this.corners = corners;
this.x = x;
this.y = y;
this.width = w;
this.height = h;
this.arcwidth = arcw;
this.archeight = arch;
</DeepExtract>
return roundedClipShape;
} | javancss | positive | 3,632 |
@Override
public void run() {
switch((SendAuth.Resp) baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
handleSuccess((SendAuth.Resp) baseResp);
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
finishWithCancel();
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
finishWithError(new SocialException(getPlatform(), SocialConstants.ERR_AUTH_DENIED, (SendAuth.Resp) baseResp.errCode, (SendAuth.Resp) baseResp.errStr, (SendAuth.Resp) baseResp));
break;
default:
finishWithError(new SocialException(getPlatform(), SocialConstants.ERR_OTHER, (SendAuth.Resp) baseResp.errCode, (SendAuth.Resp) baseResp.errStr, (SendAuth.Resp) baseResp));
break;
}
} | @Override
public void run() {
<DeepExtract>
switch((SendAuth.Resp) baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
handleSuccess((SendAuth.Resp) baseResp);
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
finishWithCancel();
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
finishWithError(new SocialException(getPlatform(), SocialConstants.ERR_AUTH_DENIED, (SendAuth.Resp) baseResp.errCode, (SendAuth.Resp) baseResp.errStr, (SendAuth.Resp) baseResp));
break;
default:
finishWithError(new SocialException(getPlatform(), SocialConstants.ERR_OTHER, (SendAuth.Resp) baseResp.errCode, (SendAuth.Resp) baseResp.errStr, (SendAuth.Resp) baseResp));
break;
}
</DeepExtract>
} | RxSocialLib | positive | 3,633 |
private String titleize(final String string) {
final String[] titleParts = string.split("[-._]");
final StringBuilder titleizedString = new StringBuilder();
for (final String part : titleParts) {
if (part != null && part.length() != 0) {
titleizedString.append(StringUtils.capitalise(part));
}
}
return ":" + name().toLowerCase();
} | private String titleize(final String string) {
final String[] titleParts = string.split("[-._]");
final StringBuilder titleizedString = new StringBuilder();
for (final String part : titleParts) {
if (part != null && part.length() != 0) {
titleizedString.append(StringUtils.capitalise(part));
}
}
<DeepExtract>
return ":" + name().toLowerCase();
</DeepExtract>
} | jruby-maven-plugins | positive | 3,634 |
public Criteria andPhoneGreaterThanOrEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "phone" + " cannot be null");
}
criteria.add(new Criterion("phone >=", value));
return (Criteria) this;
} | public Criteria andPhoneGreaterThanOrEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "phone" + " cannot be null");
}
criteria.add(new Criterion("phone >=", value));
</DeepExtract>
return (Criteria) this;
} | health_online | positive | 3,635 |
@Override
public void save(IMappingSpecification specification) {
File mappingFile = new File(mappingSpecDirectory, specification.getInfoModel().getId().getPrettyFormat().replace(":", "_") + "-mappingspec.json");
if (mappingFile.exists()) {
mappingFile.delete();
} else {
try {
mappingFile.createNewFile();
} catch (IOException e) {
logger.error("Problem creating mapping file in filesystem.", e);
throw new RuntimeException("Problem occured when saving mapping specification", e);
}
}
ObjectMapper mapper = new ObjectMapper();
try {
byte[] mappingSpecContent = mapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(specification);
FileUtils.writeByteArrayToFile(mappingFile, mappingSpecContent);
} catch (JsonProcessingException e) {
logger.error("Could not serialize mapping spec ", e);
throw new RuntimeException("Problem occured when installing mapping specification", e);
} catch (IOException e) {
logger.error("Could not write file filesystem", e);
throw new RuntimeException("Problem occured when installing mapping specification", e);
}
} | @Override
public void save(IMappingSpecification specification) {
<DeepExtract>
File mappingFile = new File(mappingSpecDirectory, specification.getInfoModel().getId().getPrettyFormat().replace(":", "_") + "-mappingspec.json");
if (mappingFile.exists()) {
mappingFile.delete();
} else {
try {
mappingFile.createNewFile();
} catch (IOException e) {
logger.error("Problem creating mapping file in filesystem.", e);
throw new RuntimeException("Problem occured when saving mapping specification", e);
}
}
ObjectMapper mapper = new ObjectMapper();
try {
byte[] mappingSpecContent = mapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(specification);
FileUtils.writeByteArrayToFile(mappingFile, mappingSpecContent);
} catch (JsonProcessingException e) {
logger.error("Could not serialize mapping spec ", e);
throw new RuntimeException("Problem occured when installing mapping specification", e);
} catch (IOException e) {
logger.error("Could not write file filesystem", e);
throw new RuntimeException("Problem occured when installing mapping specification", e);
}
</DeepExtract>
} | vorto-examples | positive | 3,636 |
@Override
public boolean equals(Object object) {
Person otherPerson = (Person) object;
int compareLastNames;
int compareLastNames = this.getLastName().compareTo(otherPerson.getLastName().getLastName());
if (compareLastNames != 0) {
compareLastNames = compareLastNames;
} else {
compareLastNames = this.getFirstName().compareTo(otherPerson.getLastName().getFirstName());
}
int compareFirstNames;
int compareLastNames = this.getLastName().compareTo(otherPerson.getFirstName().getLastName());
if (compareLastNames != 0) {
compareFirstNames = compareLastNames;
} else {
compareFirstNames = this.getFirstName().compareTo(otherPerson.getFirstName().getFirstName());
}
return ((compareLastNames == 0) && (compareFirstNames == 0));
} | @Override
public boolean equals(Object object) {
Person otherPerson = (Person) object;
int compareLastNames;
int compareLastNames = this.getLastName().compareTo(otherPerson.getLastName().getLastName());
if (compareLastNames != 0) {
compareLastNames = compareLastNames;
} else {
compareLastNames = this.getFirstName().compareTo(otherPerson.getLastName().getFirstName());
}
<DeepExtract>
int compareFirstNames;
int compareLastNames = this.getLastName().compareTo(otherPerson.getFirstName().getLastName());
if (compareLastNames != 0) {
compareFirstNames = compareLastNames;
} else {
compareFirstNames = this.getFirstName().compareTo(otherPerson.getFirstName().getFirstName());
}
</DeepExtract>
return ((compareLastNames == 0) && (compareFirstNames == 0));
} | Java-9-Concurrency-Cookbook-Second-Edition | positive | 3,637 |
public Builder clone() {
if (buildPartial() instanceof net.osrg.namazu.InspectorMessage.InspectorMsgReq_Event_FuncCall) {
return mergeFrom((net.osrg.namazu.InspectorMessage.InspectorMsgReq_Event_FuncCall) buildPartial());
} else {
super.mergeFrom(buildPartial());
return this;
}
} | public Builder clone() {
<DeepExtract>
if (buildPartial() instanceof net.osrg.namazu.InspectorMessage.InspectorMsgReq_Event_FuncCall) {
return mergeFrom((net.osrg.namazu.InspectorMessage.InspectorMsgReq_Event_FuncCall) buildPartial());
} else {
super.mergeFrom(buildPartial());
return this;
}
</DeepExtract>
} | namazu | positive | 3,638 |
@Override
public void doProcessBlocked() throws Exception {
this.bossGroup = new NioEventLoopGroup(bossThreadCount);
this.workerGroup = new NioEventLoopGroup(workThreadCount);
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).childHandler(this.jt808NettyChildHandlerInitializer);
serverConfigure.configureServerBootstrap(serverBootstrap);
log.info("----> netty tcp server started, port = {}", this.port);
ChannelFuture channelFuture = serverBootstrap.bind(port).sync();
channelFuture.channel().closeFuture().sync();
} | @Override
public void doProcessBlocked() throws Exception {
<DeepExtract>
this.bossGroup = new NioEventLoopGroup(bossThreadCount);
this.workerGroup = new NioEventLoopGroup(workThreadCount);
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).childHandler(this.jt808NettyChildHandlerInitializer);
serverConfigure.configureServerBootstrap(serverBootstrap);
log.info("----> netty tcp server started, port = {}", this.port);
ChannelFuture channelFuture = serverBootstrap.bind(port).sync();
channelFuture.channel().closeFuture().sync();
</DeepExtract>
} | jt-framework | positive | 3,639 |
public void surfaceDestroyed(SurfaceHolder holder) {
mSurfaceHolder = null;
if (mMediaPlayer != null) {
mMediaPlayer.reset();
mMediaPlayer.release();
mMediaPlayer = null;
mCurrentState = STATE_IDLE;
if (true) {
mTargetState = STATE_IDLE;
}
}
} | public void surfaceDestroyed(SurfaceHolder holder) {
mSurfaceHolder = null;
<DeepExtract>
if (mMediaPlayer != null) {
mMediaPlayer.reset();
mMediaPlayer.release();
mMediaPlayer = null;
mCurrentState = STATE_IDLE;
if (true) {
mTargetState = STATE_IDLE;
}
}
</DeepExtract>
} | Cocos2d-x-Guessing-Game | positive | 3,641 |
public HtmlPolicyBuilder allowUrlsInStyles(AttributePolicy newStyleUrlPolicy) {
compiledState = null;
this.styleUrlPolicy = newStyleUrlPolicy;
return this;
} | public HtmlPolicyBuilder allowUrlsInStyles(AttributePolicy newStyleUrlPolicy) {
<DeepExtract>
compiledState = null;
</DeepExtract>
this.styleUrlPolicy = newStyleUrlPolicy;
return this;
} | java-html-sanitizer | positive | 3,642 |
public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color, int statusBarAlpha) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
} else {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
View fakeStatusBarView = contentLayout.findViewById(FAKE_STATUS_BAR_VIEW_ID);
if (fakeStatusBarView != null) {
if (fakeStatusBarView.getVisibility() == View.GONE) {
fakeStatusBarView.setVisibility(View.VISIBLE);
}
fakeStatusBarView.setBackgroundColor(color);
} else {
contentLayout.addView(createStatusBarView(activity, color), 0);
}
if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
contentLayout.getChildAt(1).setPadding(contentLayout.getPaddingLeft(), getStatusBarHeight(activity) + contentLayout.getPaddingTop(), contentLayout.getPaddingRight(), contentLayout.getPaddingBottom());
}
ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
drawerLayout.setFitsSystemWindows(false);
contentLayout.setFitsSystemWindows(false);
contentLayout.setClipToPadding(true);
drawer.setFitsSystemWindows(false);
ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
View fakeTranslucentView = contentView.findViewById(FAKE_TRANSLUCENT_VIEW_ID);
if (fakeTranslucentView != null) {
if (fakeTranslucentView.getVisibility() == View.GONE) {
fakeTranslucentView.setVisibility(View.VISIBLE);
}
fakeTranslucentView.setBackgroundColor(Color.argb(statusBarAlpha, 0, 0, 0));
} else {
contentView.addView(createTranslucentStatusBarView(activity, statusBarAlpha));
}
} | public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color, int statusBarAlpha) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
} else {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
View fakeStatusBarView = contentLayout.findViewById(FAKE_STATUS_BAR_VIEW_ID);
if (fakeStatusBarView != null) {
if (fakeStatusBarView.getVisibility() == View.GONE) {
fakeStatusBarView.setVisibility(View.VISIBLE);
}
fakeStatusBarView.setBackgroundColor(color);
} else {
contentLayout.addView(createStatusBarView(activity, color), 0);
}
if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
contentLayout.getChildAt(1).setPadding(contentLayout.getPaddingLeft(), getStatusBarHeight(activity) + contentLayout.getPaddingTop(), contentLayout.getPaddingRight(), contentLayout.getPaddingBottom());
}
ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
drawerLayout.setFitsSystemWindows(false);
contentLayout.setFitsSystemWindows(false);
contentLayout.setClipToPadding(true);
drawer.setFitsSystemWindows(false);
<DeepExtract>
ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
View fakeTranslucentView = contentView.findViewById(FAKE_TRANSLUCENT_VIEW_ID);
if (fakeTranslucentView != null) {
if (fakeTranslucentView.getVisibility() == View.GONE) {
fakeTranslucentView.setVisibility(View.VISIBLE);
}
fakeTranslucentView.setBackgroundColor(Color.argb(statusBarAlpha, 0, 0, 0));
} else {
contentView.addView(createTranslucentStatusBarView(activity, statusBarAlpha));
}
</DeepExtract>
} | XFrame | positive | 3,643 |
private static void commentsTest() {
int flags = Pattern.COMMENTS;
Pattern pattern = Pattern.compile("aa \\# aa", flags);
Matcher matcher = pattern.matcher("aa#aa");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah", flags);
matcher = pattern.matcher("aa");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa blah", flags);
matcher = pattern.matcher("aablah");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah blech ", flags);
matcher = pattern.matcher("aa");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah\n ", flags);
matcher = pattern.matcher("aa");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah\nbc # blech", flags);
matcher = pattern.matcher("aabc");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah\nbc# blech", flags);
matcher = pattern.matcher("aabc");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah\nbc\\# blech", flags);
matcher = pattern.matcher("aabc#blech");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa \\# aa"), flags);
matcher = pattern.matcher(toSupplementaries("aa#aa"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah"), flags);
matcher = pattern.matcher(toSupplementaries("aa"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa blah"), flags);
matcher = pattern.matcher(toSupplementaries("aablah"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah blech "), flags);
matcher = pattern.matcher(toSupplementaries("aa"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah\n "), flags);
matcher = pattern.matcher(toSupplementaries("aa"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah\nbc # blech"), flags);
matcher = pattern.matcher(toSupplementaries("aabc"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah\nbc# blech"), flags);
matcher = pattern.matcher(toSupplementaries("aabc"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah\nbc\\# blech"), flags);
matcher = pattern.matcher(toSupplementaries("aabc#blech"));
if (!matcher.matches())
failCount++;
int spacesToAdd = 30 - "Comments".length();
StringBuffer paddedNameBuffer = new StringBuffer("Comments");
for (int i = 0; i < spacesToAdd; i++) paddedNameBuffer.append(" ");
String paddedName = paddedNameBuffer.toString();
System.err.println(paddedName + ": " + (failCount == 0 ? "Passed" : "Failed(" + failCount + ")"));
if (failCount > 0) {
failure = true;
if (firstFailure == null) {
firstFailure = "Comments";
}
}
failCount = 0;
} | private static void commentsTest() {
int flags = Pattern.COMMENTS;
Pattern pattern = Pattern.compile("aa \\# aa", flags);
Matcher matcher = pattern.matcher("aa#aa");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah", flags);
matcher = pattern.matcher("aa");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa blah", flags);
matcher = pattern.matcher("aablah");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah blech ", flags);
matcher = pattern.matcher("aa");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah\n ", flags);
matcher = pattern.matcher("aa");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah\nbc # blech", flags);
matcher = pattern.matcher("aabc");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah\nbc# blech", flags);
matcher = pattern.matcher("aabc");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile("aa # blah\nbc\\# blech", flags);
matcher = pattern.matcher("aabc#blech");
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa \\# aa"), flags);
matcher = pattern.matcher(toSupplementaries("aa#aa"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah"), flags);
matcher = pattern.matcher(toSupplementaries("aa"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa blah"), flags);
matcher = pattern.matcher(toSupplementaries("aablah"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah blech "), flags);
matcher = pattern.matcher(toSupplementaries("aa"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah\n "), flags);
matcher = pattern.matcher(toSupplementaries("aa"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah\nbc # blech"), flags);
matcher = pattern.matcher(toSupplementaries("aabc"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah\nbc# blech"), flags);
matcher = pattern.matcher(toSupplementaries("aabc"));
if (!matcher.matches())
failCount++;
pattern = Pattern.compile(toSupplementaries("aa # blah\nbc\\# blech"), flags);
matcher = pattern.matcher(toSupplementaries("aabc#blech"));
if (!matcher.matches())
failCount++;
<DeepExtract>
int spacesToAdd = 30 - "Comments".length();
StringBuffer paddedNameBuffer = new StringBuffer("Comments");
for (int i = 0; i < spacesToAdd; i++) paddedNameBuffer.append(" ");
String paddedName = paddedNameBuffer.toString();
System.err.println(paddedName + ": " + (failCount == 0 ? "Passed" : "Failed(" + failCount + ")"));
if (failCount > 0) {
failure = true;
if (firstFailure == null) {
firstFailure = "Comments";
}
}
failCount = 0;
</DeepExtract>
} | com.florianingerl.util.regex | positive | 3,644 |
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mBlocks_RecyclerView = view.findViewById(R.id.RecentBlocks_blocks_recyclerView);
mSwipeRefreshLayout = view.findViewById(R.id.RecentBlocks_swipe_container);
mSwipeRefreshLayout.setOnRefreshListener(this);
mLayoutManager = new WrapContentLinearLayoutManager(getContext());
mLayoutManager.setReverseLayout(true);
mLayoutManager.setStackFromEnd(true);
mBlocks_RecyclerView.setHasFixedSize(true);
mBlocks_RecyclerView.setLayoutManager(mLayoutManager);
mBlocks_RecyclerView.setAdapter(mBlockItemListAdapter);
mSwipeRefreshLayout.setRefreshing(true);
BlockExplorerUpdater.singleShot(BlockExplorerUpdater.UpdateTask.Blockchain, true);
} | @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mBlocks_RecyclerView = view.findViewById(R.id.RecentBlocks_blocks_recyclerView);
mSwipeRefreshLayout = view.findViewById(R.id.RecentBlocks_swipe_container);
mSwipeRefreshLayout.setOnRefreshListener(this);
mLayoutManager = new WrapContentLinearLayoutManager(getContext());
mLayoutManager.setReverseLayout(true);
mLayoutManager.setStackFromEnd(true);
mBlocks_RecyclerView.setHasFixedSize(true);
mBlocks_RecyclerView.setLayoutManager(mLayoutManager);
mBlocks_RecyclerView.setAdapter(mBlockItemListAdapter);
<DeepExtract>
mSwipeRefreshLayout.setRefreshing(true);
BlockExplorerUpdater.singleShot(BlockExplorerUpdater.UpdateTask.Blockchain, true);
</DeepExtract>
} | tron-wallet-android | positive | 3,645 |
public T setDefineRequestBody(InputStream requestBody, String contentType) {
if (!getRequestMethod().allowRequestBody())
throw new IllegalArgumentException("Request body" + " only supports these handle methods: POST/PUT/PATCH/DELETE.");
if (requestBody == null || TextUtils.isEmpty(contentType))
throw new NullPointerException("The requestBody and contentType must be can't be null");
if (requestBody instanceof ByteArrayInputStream || requestBody instanceof FileInputStream) {
this.mRequestBody = requestBody;
mHeaders.set(Headers.HEAD_KEY_CONTENT_TYPE, contentType);
} else
throw new IllegalArgumentException("Can only accept ByteArrayInputStream and FileInputStream " + "type of stream");
return (T) this;
} | public T setDefineRequestBody(InputStream requestBody, String contentType) {
if (!getRequestMethod().allowRequestBody())
throw new IllegalArgumentException("Request body" + " only supports these handle methods: POST/PUT/PATCH/DELETE.");
<DeepExtract>
if (requestBody == null || TextUtils.isEmpty(contentType))
throw new NullPointerException("The requestBody and contentType must be can't be null");
</DeepExtract>
if (requestBody instanceof ByteArrayInputStream || requestBody instanceof FileInputStream) {
this.mRequestBody = requestBody;
mHeaders.set(Headers.HEAD_KEY_CONTENT_TYPE, contentType);
} else
throw new IllegalArgumentException("Can only accept ByteArrayInputStream and FileInputStream " + "type of stream");
return (T) this;
} | NoHttp | positive | 3,646 |
@Override
public final void showNoNetView(View.OnClickListener listener) {
clearLoadingView();
mBaseViewHelper.showNoNetView(getString(R.string.no_net_tips), listener);
if (getView() == null) {
return;
}
mBaseViewHelper.getView().setClickable(true);
if (mNestedParentLayout != null) {
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(-1, -1);
mNestedParentLayout.addView(mBaseViewHelper.getView(), params);
} else {
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(-1, -1);
mContentView.addView(mBaseViewHelper.getView(), params);
}
} | @Override
public final void showNoNetView(View.OnClickListener listener) {
clearLoadingView();
mBaseViewHelper.showNoNetView(getString(R.string.no_net_tips), listener);
<DeepExtract>
if (getView() == null) {
return;
}
mBaseViewHelper.getView().setClickable(true);
if (mNestedParentLayout != null) {
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(-1, -1);
mNestedParentLayout.addView(mBaseViewHelper.getView(), params);
} else {
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(-1, -1);
mContentView.addView(mBaseViewHelper.getView(), params);
}
</DeepExtract>
} | BaseMyProject | positive | 3,647 |
public void setSelectedElementIndexes(Collection<Integer> indexes) {
List<EditableFieldElement> selected = new ArrayList<>();
for (int i : indexes) {
selected.add(elements.get(i));
}
selectedElements.clear();
selectedElements.addAll(selected);
runSelectionChangeCallback();
} | public void setSelectedElementIndexes(Collection<Integer> indexes) {
List<EditableFieldElement> selected = new ArrayList<>();
for (int i : indexes) {
selected.add(elements.get(i));
}
<DeepExtract>
selectedElements.clear();
selectedElements.addAll(selected);
runSelectionChangeCallback();
</DeepExtract>
} | Vector-Pinball-Editor | positive | 3,648 |
@Override
protected Collection<String> prepareStatements() {
String statement;
if (this.checkStatement(this.query.getStatementName())) {
statement = null;
}
switch(this.query.getSqlCommandType()) {
case INSERT:
statement = this.insertStatement();
case UPDATE:
statement = this.updateStatement();
case DELETE:
statement = this.deleteStatement();
case SELECT:
statement = this.selectStatement();
default:
throw new MappingException("Unsupported SQL Command Type: " + this.query.getSqlCommandType().name());
}
return StringUtils.isEmpty(statement) ? Collections.emptyList() : Collections.singletonList(statement);
} | @Override
protected Collection<String> prepareStatements() {
<DeepExtract>
String statement;
if (this.checkStatement(this.query.getStatementName())) {
statement = null;
}
switch(this.query.getSqlCommandType()) {
case INSERT:
statement = this.insertStatement();
case UPDATE:
statement = this.updateStatement();
case DELETE:
statement = this.deleteStatement();
case SELECT:
statement = this.selectStatement();
default:
throw new MappingException("Unsupported SQL Command Type: " + this.query.getSqlCommandType().name());
}
</DeepExtract>
return StringUtils.isEmpty(statement) ? Collections.emptyList() : Collections.singletonList(statement);
} | spring-data-mybatis | positive | 3,649 |
public static Map<String, Object> freshPapayaColor(AALinearGradientDirection direction) {
return linearGradient(direction, new Object[][] { { 0, "#ED1C24" }, { 1, "#FCEE21" } });
} | public static Map<String, Object> freshPapayaColor(AALinearGradientDirection direction) {
<DeepExtract>
return linearGradient(direction, new Object[][] { { 0, "#ED1C24" }, { 1, "#FCEE21" } });
</DeepExtract>
} | AAChartCore | positive | 3,650 |
@Override
public Object execute() {
LOG.info("Starting Log Import {}", props.getProperty(MudrodConstants.TIME_SUFFIX));
startTime = System.currentTimeMillis();
String httplogpath = null;
String ftplogpath = null;
File directory = new File(props.getProperty(MudrodConstants.DATA_DIR));
File[] fList = directory.listFiles();
for (File file : fList) {
if (file.isFile() && file.getName().contains(props.getProperty(MudrodConstants.TIME_SUFFIX))) {
if (file.getName().contains(props.getProperty(MudrodConstants.HTTP_PREFIX))) {
httplogpath = file.getAbsolutePath();
}
if (file.getName().contains(props.getProperty(MudrodConstants.FTP_PREFIX))) {
ftplogpath = file.getAbsolutePath();
}
}
}
if (httplogpath == null || ftplogpath == null) {
LOG.error("WWW file or FTP logs cannot be found, please check your data directory.");
return;
}
readFileInParallel(httplogpath, ftplogpath);
endTime = System.currentTimeMillis();
LOG.info("Log Import complete. Time elapsed {} seconds", (endTime - startTime) / 1000);
es.refreshIndex();
return null;
} | @Override
public Object execute() {
LOG.info("Starting Log Import {}", props.getProperty(MudrodConstants.TIME_SUFFIX));
startTime = System.currentTimeMillis();
<DeepExtract>
String httplogpath = null;
String ftplogpath = null;
File directory = new File(props.getProperty(MudrodConstants.DATA_DIR));
File[] fList = directory.listFiles();
for (File file : fList) {
if (file.isFile() && file.getName().contains(props.getProperty(MudrodConstants.TIME_SUFFIX))) {
if (file.getName().contains(props.getProperty(MudrodConstants.HTTP_PREFIX))) {
httplogpath = file.getAbsolutePath();
}
if (file.getName().contains(props.getProperty(MudrodConstants.FTP_PREFIX))) {
ftplogpath = file.getAbsolutePath();
}
}
}
if (httplogpath == null || ftplogpath == null) {
LOG.error("WWW file or FTP logs cannot be found, please check your data directory.");
return;
}
readFileInParallel(httplogpath, ftplogpath);
</DeepExtract>
endTime = System.currentTimeMillis();
LOG.info("Log Import complete. Time elapsed {} seconds", (endTime - startTime) / 1000);
es.refreshIndex();
return null;
} | incubator-sdap-mudrod | positive | 3,651 |
public static TimePickerDialogFragment newInstance(DialogFragmentCallbackProvider provider, int hour, int minute, boolean is24hour) {
assertListenerBindable(provider);
TimePickerDialogFragment fragment = new TimePickerDialogFragment();
Bundle args = new Bundle();
args.putInt(THEME, VALUE_NULL);
args.putInt(HOUR, hour);
args.putInt(MINUTE, minute);
args.putBoolean(IS_24_HOUR, is24hour);
fragment.setArguments(args);
return fragment;
} | public static TimePickerDialogFragment newInstance(DialogFragmentCallbackProvider provider, int hour, int minute, boolean is24hour) {
<DeepExtract>
assertListenerBindable(provider);
TimePickerDialogFragment fragment = new TimePickerDialogFragment();
Bundle args = new Bundle();
args.putInt(THEME, VALUE_NULL);
args.putInt(HOUR, hour);
args.putInt(MINUTE, minute);
args.putBoolean(IS_24_HOUR, is24hour);
fragment.setArguments(args);
return fragment;
</DeepExtract>
} | Android-DialogFragments | positive | 3,652 |
@Override
public HttpURLConnection buildHttpURLConnection(final URLConnection url) {
if (url instanceof HttpsURLConnection) {
final HttpsURLConnection httpsConnection = (HttpsURLConnection) url;
final SSLSocketFactory socketFactory = this.createSSLSocketFactory();
if (socketFactory != null) {
httpsConnection.setSSLSocketFactory(socketFactory);
}
if (isIgnoreSslFailures()) {
httpsConnection.setHostnameVerifier(new AnyHostnameVerifier());
} else if (this.hostnameVerifier != null) {
httpsConnection.setHostnameVerifier(this.hostnameVerifier);
}
}
return (HttpURLConnection) url;
} | @Override
public HttpURLConnection buildHttpURLConnection(final URLConnection url) {
<DeepExtract>
if (url instanceof HttpsURLConnection) {
final HttpsURLConnection httpsConnection = (HttpsURLConnection) url;
final SSLSocketFactory socketFactory = this.createSSLSocketFactory();
if (socketFactory != null) {
httpsConnection.setSSLSocketFactory(socketFactory);
}
if (isIgnoreSslFailures()) {
httpsConnection.setHostnameVerifier(new AnyHostnameVerifier());
} else if (this.hostnameVerifier != null) {
httpsConnection.setHostnameVerifier(this.hostnameVerifier);
}
}
return (HttpURLConnection) url;
</DeepExtract>
} | java-cas-client | positive | 3,653 |
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
logger.error(cause.getMessage(), cause);
if (cause instanceof java.io.IOException) {
logger.error(cause.getMessage());
}
logger.error(cause.getMessage(), cause);
long sessionId = ctx.channel().attr(NettyTcpSessionBuilder.SESSION_ID).get();
NettyTcpSession nettySession = (NettyTcpSession) SpringServiceManager.springLoadService.getNetTcpSessionLoopUpService().findNettySession(sessionId);
if (nettySession == null) {
logger.error("TCP NET SESSION NULL CHANNEL ID IS:" + ctx.channel().id().asLongText());
return;
}
nettySession.close();
ctx.close();
} | @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
logger.error(cause.getMessage(), cause);
if (cause instanceof java.io.IOException) {
logger.error(cause.getMessage());
}
logger.error(cause.getMessage(), cause);
<DeepExtract>
long sessionId = ctx.channel().attr(NettyTcpSessionBuilder.SESSION_ID).get();
NettyTcpSession nettySession = (NettyTcpSession) SpringServiceManager.springLoadService.getNetTcpSessionLoopUpService().findNettySession(sessionId);
if (nettySession == null) {
logger.error("TCP NET SESSION NULL CHANNEL ID IS:" + ctx.channel().id().asLongText());
return;
}
nettySession.close();
</DeepExtract>
ctx.close();
} | twjitm-core | positive | 3,654 |
private MSStringBuilder getUriNew(String sender, String addr, MSStringBuilder seite, Charset encoding, String meldung, int versuch, boolean lVersuch, String token) {
long load = 0;
try {
seite.setLength(0);
if (MserverDaten.debug) {
Log.sysLog("Durchsuche: " + addr);
}
final Request.Builder builder = createRequestBuilder(addr, token);
load = webCall(builder.build(), seite, encoding);
} catch (UnknownHostException | SocketTimeoutException ignored) {
if (MserverDaten.debug) {
printDebugMessage(meldung, addr, sender, versuch, ignored);
}
} catch (IOException ex) {
if (lVersuch) {
printDebugMessage(meldung, addr, sender, versuch, ex);
}
} catch (Exception ex) {
Log.errorLog(973969801, ex, "");
}
FilmeSuchen.listeSenderLaufen.inc(sender, RunSender.Count.SUM_DATA_BYTE, load);
FilmeSuchen.listeSenderLaufen.inc(sender, RunSender.Count.SUM_TRAFFIC_BYTE, load);
FilmeSuchen.listeSenderLaufen.inc(sender, RunSender.Count.SUM_TRAFFIC_LOADART_NIX, load);
return seite;
} | private MSStringBuilder getUriNew(String sender, String addr, MSStringBuilder seite, Charset encoding, String meldung, int versuch, boolean lVersuch, String token) {
long load = 0;
try {
seite.setLength(0);
if (MserverDaten.debug) {
Log.sysLog("Durchsuche: " + addr);
}
final Request.Builder builder = createRequestBuilder(addr, token);
load = webCall(builder.build(), seite, encoding);
} catch (UnknownHostException | SocketTimeoutException ignored) {
if (MserverDaten.debug) {
printDebugMessage(meldung, addr, sender, versuch, ignored);
}
} catch (IOException ex) {
if (lVersuch) {
printDebugMessage(meldung, addr, sender, versuch, ex);
}
} catch (Exception ex) {
Log.errorLog(973969801, ex, "");
}
<DeepExtract>
FilmeSuchen.listeSenderLaufen.inc(sender, RunSender.Count.SUM_DATA_BYTE, load);
FilmeSuchen.listeSenderLaufen.inc(sender, RunSender.Count.SUM_TRAFFIC_BYTE, load);
FilmeSuchen.listeSenderLaufen.inc(sender, RunSender.Count.SUM_TRAFFIC_LOADART_NIX, load);
</DeepExtract>
return seite;
} | MServer | positive | 3,655 |
public void testNormalizeRequest() {
Request expected = new Request(" Hello Alice. How are you? You look fine! Please forgive my manners; I am so happy today... ", new Sentence(" Hello Alice. ", new Integer[] { 0, 6, 13 }, " HELLO ALICE "), new Sentence(" How are you? ", new Integer[] { 0, 4, 8, 13 }, " HOW ARE YOU "), new Sentence(" You look fine! ", new Integer[] { 0, 4, 9, 15 }, " YOU LOOK FINE "), new Sentence(" Please forgive my manners; ", new Integer[] { 0, 7, 15, 18, 27 }, " PLEASE FORGIVE MY MANNERS "), new Sentence(" I am so happy today... ", new Integer[] { 0, 2, 5, 8, 14, 23 }, " I AM SO HAPPY TODAY "));
Request actual = new Request("Hello Alice. How are you? You look fine! Please forgive my manners; I am so happy today...");
transformations.normalization(actual);
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
expected = new Request(" Thanks. ", new Sentence(" Thanks. ", new Integer[] { 0, null, 8 }, " THANK YOU "));
actual = new Request("Thanks.");
transformations.normalization(actual);
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
expected = new Request(" Do you see the fire in my eyes? ", new Sentence(" Do you see the fire in my eyes? ", new Integer[] { 0, 3, 7, 11, 15, 20, 23, 26, 32 }, " DO YOU SEE THE FIRE IN MY EYES "));
actual = new Request(" Do you see the fire in my eyes? ");
transformations.normalization(actual);
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
expected = new Request(" I said \"Hello Unknown Person!\". ", new Sentence(" I said \"Hello Unknown Person!\". ", new Integer[] { 0, 2, 7, 14, 22, 32 }, " I SAID HELLO UNKNOWN PERSON "));
actual = new Request("I said \"Hello Unknown Person!\".");
transformations.normalization(actual);
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
expected = new Request(" Hello Unknown Person! My name is Alice, who are you? ", new Sentence(" Hello Unknown Person! ", new Integer[] { 0, 6, 14, 22 }, " HELLO UNKNOWN PERSON "), new Sentence(" My name is Alice, who are you? ", new Integer[] { 0, 3, 8, 11, 18, 22, 26, 31 }, " MY NAME IS ALICE WHO ARE YOU "));
actual = new Request("Hello Unknown Person! My name is Alice, who are you?");
transformations.normalization(actual);
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
expected = new Request(" HELLO ", new Sentence(" HELLO ", new Integer[] { 0, 6 }, " HELLO "));
actual = new Request("HELLO");
transformations.normalization(actual);
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
} | public void testNormalizeRequest() {
Request expected = new Request(" Hello Alice. How are you? You look fine! Please forgive my manners; I am so happy today... ", new Sentence(" Hello Alice. ", new Integer[] { 0, 6, 13 }, " HELLO ALICE "), new Sentence(" How are you? ", new Integer[] { 0, 4, 8, 13 }, " HOW ARE YOU "), new Sentence(" You look fine! ", new Integer[] { 0, 4, 9, 15 }, " YOU LOOK FINE "), new Sentence(" Please forgive my manners; ", new Integer[] { 0, 7, 15, 18, 27 }, " PLEASE FORGIVE MY MANNERS "), new Sentence(" I am so happy today... ", new Integer[] { 0, 2, 5, 8, 14, 23 }, " I AM SO HAPPY TODAY "));
Request actual = new Request("Hello Alice. How are you? You look fine! Please forgive my manners; I am so happy today...");
transformations.normalization(actual);
<DeepExtract>
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
</DeepExtract>
expected = new Request(" Thanks. ", new Sentence(" Thanks. ", new Integer[] { 0, null, 8 }, " THANK YOU "));
actual = new Request("Thanks.");
transformations.normalization(actual);
<DeepExtract>
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
</DeepExtract>
expected = new Request(" Do you see the fire in my eyes? ", new Sentence(" Do you see the fire in my eyes? ", new Integer[] { 0, 3, 7, 11, 15, 20, 23, 26, 32 }, " DO YOU SEE THE FIRE IN MY EYES "));
actual = new Request(" Do you see the fire in my eyes? ");
transformations.normalization(actual);
<DeepExtract>
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
</DeepExtract>
expected = new Request(" I said \"Hello Unknown Person!\". ", new Sentence(" I said \"Hello Unknown Person!\". ", new Integer[] { 0, 2, 7, 14, 22, 32 }, " I SAID HELLO UNKNOWN PERSON "));
actual = new Request("I said \"Hello Unknown Person!\".");
transformations.normalization(actual);
<DeepExtract>
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
</DeepExtract>
expected = new Request(" Hello Unknown Person! My name is Alice, who are you? ", new Sentence(" Hello Unknown Person! ", new Integer[] { 0, 6, 14, 22 }, " HELLO UNKNOWN PERSON "), new Sentence(" My name is Alice, who are you? ", new Integer[] { 0, 3, 8, 11, 18, 22, 26, 31 }, " MY NAME IS ALICE WHO ARE YOU "));
actual = new Request("Hello Unknown Person! My name is Alice, who are you?");
transformations.normalization(actual);
<DeepExtract>
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
</DeepExtract>
expected = new Request(" HELLO ", new Sentence(" HELLO ", new Integer[] { 0, 6 }, " HELLO "));
actual = new Request("HELLO");
transformations.normalization(actual);
<DeepExtract>
assertEquals(expected.getOriginal(), actual.getOriginal());
Sentence[] expSentences = expected.getSentences();
Sentence[] actSentences = actual.getSentences();
assertEquals(expSentences.length, actSentences.length);
for (int i = 0, n = actSentences.length; i < n; i++) assertSentence(expSentences[i], actSentences[i]);
</DeepExtract>
} | alice_bot | positive | 3,657 |
public RequestHandle get(Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
if (null != null) {
new HttpGet(getUrlWithQueryString(isUrlEncodingEnabled, url, params)).addHeader("Content-Type", null);
}
Future<?> request = threadPool.submit(new AsyncHttpRequest(httpClient, httpContext, new HttpGet(getUrlWithQueryString(isUrlEncodingEnabled, url, params)), responseHandler));
if (context != null) {
List<WeakReference<Future<?>>> requestList = requestMap.get(context);
if (requestList == null) {
requestList = new LinkedList<WeakReference<Future<?>>>();
requestMap.put(context, requestList);
}
requestList.add(new WeakReference<Future<?>>(request));
}
return new RequestHandle(request);
} | public RequestHandle get(Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
<DeepExtract>
if (null != null) {
new HttpGet(getUrlWithQueryString(isUrlEncodingEnabled, url, params)).addHeader("Content-Type", null);
}
Future<?> request = threadPool.submit(new AsyncHttpRequest(httpClient, httpContext, new HttpGet(getUrlWithQueryString(isUrlEncodingEnabled, url, params)), responseHandler));
if (context != null) {
List<WeakReference<Future<?>>> requestList = requestMap.get(context);
if (requestList == null) {
requestList = new LinkedList<WeakReference<Future<?>>>();
requestMap.put(context, requestList);
}
requestList.add(new WeakReference<Future<?>>(request));
}
return new RequestHandle(request);
</DeepExtract>
} | LDXY | positive | 3,658 |
public E removeLast() {
if (size - 1 < 0 || size - 1 >= size) {
throw new IllegalArgumentException("Remove failed. index is Illegal.");
}
E result = data[size - 1];
for (int i = size - 1 + 1; i < size; i++) {
data[i - 1] = data[i];
}
size--;
data[size] = null;
if (size == data.length / 4 && data.length / 2 != 0) {
resize(data.length / 2);
}
return result;
} | public E removeLast() {
<DeepExtract>
if (size - 1 < 0 || size - 1 >= size) {
throw new IllegalArgumentException("Remove failed. index is Illegal.");
}
E result = data[size - 1];
for (int i = size - 1 + 1; i < size; i++) {
data[i - 1] = data[i];
}
size--;
data[size] = null;
if (size == data.length / 4 && data.length / 2 != 0) {
resize(data.length / 2);
}
return result;
</DeepExtract>
} | Play-with-Data-Structures-Ronglexie | positive | 3,659 |
double dNudge(double[] dp) {
double[] dpo = new double[onadj];
double[] dpr = new double[rnadj];
for (i = 0; i < onadj; i++) dpo[i] = dp[i];
boolean bAngle = false;
for (int iadj = 0; iadj < onadj; iadj++) {
int surf = optEditor.getAdjSurf(iadj);
int attr = optEditor.getAdjAttrib(iadj);
if ((attr == OTILT) || (attr == OPITCH) || (attr == OROLL))
bAngle = true;
int field = optEditor.getAdjField(iadj);
RT13.surfs[surf][attr] += dpo[iadj];
optEditor.putFieldDouble(field, surf + 2, RT13.surfs[surf][attr]);
int nSlaves = optEditor.getSlaves(iadj).size();
for (int i = 0; i < nSlaves; i++) {
Integer jSlave = optEditor.getSlaves(iadj).get(i);
int j = jSlave.intValue();
double dSign = (j > 0) ? +1.0 : -1.0;
j = Math.abs(j);
RT13.surfs[j][attr] += dSign * dpo[iadj];
optEditor.putFieldDouble(field, j + 2, RT13.surfs[j][attr]);
}
if (attr == OSHAPE)
RT13.surfs[surf][OASPHER] += dpo[iadj];
}
if (bAngle)
RT13.setEulers();
optEditor.repaint();
for (i = 0; i < rnadj; i++) dpr[i] = dp[onadj + i];
for (int iadj = 0; iadj < rnadj; iadj++) {
int kray = rayEditor.getAdjRay(iadj);
int attr = rayEditor.getAdjAttrib(iadj);
int field = rayEditor.getAdjField(iadj);
RT13.raystarts[kray][attr] += dpr[iadj];
rayEditor.putFieldDouble(field, kray + 2, RT13.raystarts[kray][attr]);
int nSlaves = rayEditor.getSlaves(iadj).size();
for (int i = 0; i < nSlaves; i++) {
Integer jSlave = rayEditor.getSlaves(iadj).get(i);
int k = jSlave.intValue();
double dSign = (k > 0) ? +1.0 : -1.0;
k = Math.abs(k);
RT13.raystarts[k][attr] += dSign * dpr[iadj];
rayEditor.putFieldDouble(field, k + 2, RT13.raystarts[k][attr]);
}
}
rayEditor.repaint();
int nrays = RT13.iBuildRays(false);
if (nrays < ngood) {
return BIGVAL;
}
Comparo.doResiduals();
sos = Comparo.dGetSOS();
rms = Comparo.dGetRMS();
return sos;
} | double dNudge(double[] dp) {
double[] dpo = new double[onadj];
double[] dpr = new double[rnadj];
for (i = 0; i < onadj; i++) dpo[i] = dp[i];
boolean bAngle = false;
for (int iadj = 0; iadj < onadj; iadj++) {
int surf = optEditor.getAdjSurf(iadj);
int attr = optEditor.getAdjAttrib(iadj);
if ((attr == OTILT) || (attr == OPITCH) || (attr == OROLL))
bAngle = true;
int field = optEditor.getAdjField(iadj);
RT13.surfs[surf][attr] += dpo[iadj];
optEditor.putFieldDouble(field, surf + 2, RT13.surfs[surf][attr]);
int nSlaves = optEditor.getSlaves(iadj).size();
for (int i = 0; i < nSlaves; i++) {
Integer jSlave = optEditor.getSlaves(iadj).get(i);
int j = jSlave.intValue();
double dSign = (j > 0) ? +1.0 : -1.0;
j = Math.abs(j);
RT13.surfs[j][attr] += dSign * dpo[iadj];
optEditor.putFieldDouble(field, j + 2, RT13.surfs[j][attr]);
}
if (attr == OSHAPE)
RT13.surfs[surf][OASPHER] += dpo[iadj];
}
if (bAngle)
RT13.setEulers();
optEditor.repaint();
for (i = 0; i < rnadj; i++) dpr[i] = dp[onadj + i];
for (int iadj = 0; iadj < rnadj; iadj++) {
int kray = rayEditor.getAdjRay(iadj);
int attr = rayEditor.getAdjAttrib(iadj);
int field = rayEditor.getAdjField(iadj);
RT13.raystarts[kray][attr] += dpr[iadj];
rayEditor.putFieldDouble(field, kray + 2, RT13.raystarts[kray][attr]);
int nSlaves = rayEditor.getSlaves(iadj).size();
for (int i = 0; i < nSlaves; i++) {
Integer jSlave = rayEditor.getSlaves(iadj).get(i);
int k = jSlave.intValue();
double dSign = (k > 0) ? +1.0 : -1.0;
k = Math.abs(k);
RT13.raystarts[k][attr] += dSign * dpr[iadj];
rayEditor.putFieldDouble(field, k + 2, RT13.raystarts[k][attr]);
}
}
rayEditor.repaint();
<DeepExtract>
int nrays = RT13.iBuildRays(false);
if (nrays < ngood) {
return BIGVAL;
}
Comparo.doResiduals();
sos = Comparo.dGetSOS();
rms = Comparo.dGetRMS();
return sos;
</DeepExtract>
} | BeamFour | positive | 3,660 |
@Override
public Long component1() {
return (Long) get(0);
} | @Override
public Long component1() {
<DeepExtract>
return (Long) get(0);
</DeepExtract>
} | openvsx | positive | 3,661 |
public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
String methodCall = "updateSQLXML(" + columnLabel + ", " + xmlObject + ")";
try {
realResultSet.updateSQLXML(columnLabel, xmlObject);
} catch (SQLException s) {
reportException(methodCall, s);
throw s;
}
reportAllReturns(methodCall, "");
} | public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
String methodCall = "updateSQLXML(" + columnLabel + ", " + xmlObject + ")";
try {
realResultSet.updateSQLXML(columnLabel, xmlObject);
} catch (SQLException s) {
reportException(methodCall, s);
throw s;
}
<DeepExtract>
reportAllReturns(methodCall, "");
</DeepExtract>
} | miniprofiler-jvm | positive | 3,662 |
public void setBuildConfig(F buildConfig) {
if (animator.isRunning()) {
this.animator.end();
}
if (null != workThread) {
this.workThread.removeAllMessage();
}
if (null != uiHandler) {
this.uiHandler.removeMessages(0);
}
this.buildConfig = buildConfig;
if (getCount() == 0)
return;
if (null == workThread) {
this.workThread = new WorkThread<>();
}
this.workThread.post(new BuildData<>(buildConfig, cloneDataList(), ObserverArg.INIT, 0, null), this);
} | public void setBuildConfig(F buildConfig) {
if (animator.isRunning()) {
this.animator.end();
}
if (null != workThread) {
this.workThread.removeAllMessage();
}
if (null != uiHandler) {
this.uiHandler.removeMessages(0);
}
this.buildConfig = buildConfig;
if (getCount() == 0)
return;
<DeepExtract>
if (null == workThread) {
this.workThread = new WorkThread<>();
}
this.workThread.post(new BuildData<>(buildConfig, cloneDataList(), ObserverArg.INIT, 0, null), this);
</DeepExtract>
} | InteractiveChart | positive | 3,663 |
public List<Integer> readAsInteger(File file) {
List<String> strings = mapToString(saxExcelReader.read(file));
return strings.stream().map(s -> s == null ? null : Integer::valueOf.apply(s)).collect(Collectors.toCollection(LinkedList::new));
} | public List<Integer> readAsInteger(File file) {
<DeepExtract>
List<String> strings = mapToString(saxExcelReader.read(file));
return strings.stream().map(s -> s == null ? null : Integer::valueOf.apply(s)).collect(Collectors.toCollection(LinkedList::new));
</DeepExtract>
} | myexcel | positive | 3,664 |
@Override
public NQLObject visit(TupleExpn e) {
if (log.isDebugEnabled()) {
_evalStack.append(" (");
_evalStack.append(e.getTreeNode().getText());
}
List<NQLObject> expressions = new ArrayList<NQLObject>();
for (Expn expn : e.getExpressions()) expressions.add(expn.accept(this));
NQLObject result = new TupleObject(expressions.toArray(new NQLObject[0]));
if (log.isDebugEnabled()) {
_evalStack.append(" => ");
_evalStack.append(toTypeString(result));
_evalStack.append(")");
}
return result;
return result;
} | @Override
public NQLObject visit(TupleExpn e) {
if (log.isDebugEnabled()) {
_evalStack.append(" (");
_evalStack.append(e.getTreeNode().getText());
}
List<NQLObject> expressions = new ArrayList<NQLObject>();
for (Expn expn : e.getExpressions()) expressions.add(expn.accept(this));
NQLObject result = new TupleObject(expressions.toArray(new NQLObject[0]));
<DeepExtract>
if (log.isDebugEnabled()) {
_evalStack.append(" => ");
_evalStack.append(toTypeString(result));
_evalStack.append(")");
}
return result;
</DeepExtract>
return result;
} | bowser | positive | 3,666 |
public void close() {
writer.println("==== End of log ====");
writer.close();
} | public void close() {
<DeepExtract>
writer.println("==== End of log ====");
</DeepExtract>
writer.close();
} | GraphicMultiThreadDesignPattern | positive | 3,667 |
@Deprecated
public static StatusFlag valueOf(int value) {
switch(value) {
case 3:
return DATA;
case 4:
return BINDATA;
case 5:
return STRDATA;
case 6:
return JSONDATA;
case 0:
return DATAONEOF_NOT_SET;
default:
return null;
}
} | @Deprecated
public static StatusFlag valueOf(int value) {
<DeepExtract>
switch(value) {
case 3:
return DATA;
case 4:
return BINDATA;
case 5:
return STRDATA;
case 6:
return JSONDATA;
case 0:
return DATAONEOF_NOT_SET;
default:
return null;
}
</DeepExtract>
} | dl_inference | positive | 3,668 |
public void testHSLGreen() {
RgbaColor start = RgbaColor.from("#0f0");
float[] HSL = start.convertToHsl();
assertEquals(Math.round(new float[] { 120, 100, 50 }[0]), Math.round(HSL[0]));
assertEquals(Math.round(new float[] { 120, 100, 50 }[1]), Math.round(HSL[1]));
assertEquals(Math.round(new float[] { 120, 100, 50 }[2]), Math.round(HSL[2]));
RgbaColor end = RgbaColor.fromHsl(HSL);
assertEquals(start, end);
} | public void testHSLGreen() {
<DeepExtract>
RgbaColor start = RgbaColor.from("#0f0");
float[] HSL = start.convertToHsl();
assertEquals(Math.round(new float[] { 120, 100, 50 }[0]), Math.round(HSL[0]));
assertEquals(Math.round(new float[] { 120, 100, 50 }[1]), Math.round(HSL[1]));
assertEquals(Math.round(new float[] { 120, 100, 50 }[2]), Math.round(HSL[2]));
RgbaColor end = RgbaColor.fromHsl(HSL);
assertEquals(start, end);
</DeepExtract>
} | gwt-traction | positive | 3,669 |
@Override
public String toString() {
return "SUCCESS";
} | @Override
public String toString() {
<DeepExtract>
return "SUCCESS";
</DeepExtract>
} | li-apache-kafka-clients | positive | 3,670 |
public void setContentLength(long len) {
setHeader(HTTP.CONTENT_LENGTH, Long.toString(len));
} | public void setContentLength(long len) {
<DeepExtract>
setHeader(HTTP.CONTENT_LENGTH, Long.toString(len));
</DeepExtract>
} | dlna_framework | positive | 3,671 |
int queryPurchases(Inventory inv, String itemType) throws JSONException, RemoteException {
if (mDebugLog)
Log.d(mDebugTag, "Querying owned items, item type: " + itemType);
if (mDebugLog)
Log.d(mDebugTag, "Package name: " + mContext.getPackageName());
boolean verificationFailed = false;
String continueToken = null;
do {
logDebug("Calling getPurchases with continuation token: " + continueToken);
Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(), itemType, continueToken);
int response = getResponseCodeFromBundle(ownedItems);
logDebug("Owned items response: " + String.valueOf(response));
if (response != BILLING_RESPONSE_RESULT_OK) {
logDebug("getPurchases() failed: " + getResponseDesc(response));
return response;
}
if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) {
logError("Bundle returned from getPurchases() doesn't contain required fields.");
return IABHELPER_BAD_RESPONSE;
}
ArrayList<String> ownedSkus = ownedItems.getStringArrayList(RESPONSE_INAPP_ITEM_LIST);
ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);
ArrayList<String> signatureList = ownedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST);
for (int i = 0; i < purchaseDataList.size(); ++i) {
String purchaseData = purchaseDataList.get(i);
String signature = signatureList.get(i);
String sku = ownedSkus.get(i);
if (Security.verifyPurchase(mSignatureBase64, purchaseData, signature)) {
logDebug("Sku is owned: " + sku);
Purchase purchase = new Purchase(itemType, purchaseData, signature);
if (TextUtils.isEmpty(purchase.getToken())) {
logWarn("BUG: empty/null token!");
logDebug("Purchase data: " + purchaseData);
}
inv.addPurchase(purchase);
} else {
logWarn("Purchase signature verification **FAILED**. Not adding item.");
logDebug(" Purchase data: " + purchaseData);
logDebug(" Signature: " + signature);
verificationFailed = true;
}
}
continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN);
logDebug("Continuation token: " + continueToken);
} while (!TextUtils.isEmpty(continueToken));
return verificationFailed ? IABHELPER_VERIFICATION_FAILED : BILLING_RESPONSE_RESULT_OK;
} | int queryPurchases(Inventory inv, String itemType) throws JSONException, RemoteException {
if (mDebugLog)
Log.d(mDebugTag, "Querying owned items, item type: " + itemType);
<DeepExtract>
if (mDebugLog)
Log.d(mDebugTag, "Package name: " + mContext.getPackageName());
</DeepExtract>
boolean verificationFailed = false;
String continueToken = null;
do {
logDebug("Calling getPurchases with continuation token: " + continueToken);
Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(), itemType, continueToken);
int response = getResponseCodeFromBundle(ownedItems);
logDebug("Owned items response: " + String.valueOf(response));
if (response != BILLING_RESPONSE_RESULT_OK) {
logDebug("getPurchases() failed: " + getResponseDesc(response));
return response;
}
if (!ownedItems.containsKey(RESPONSE_INAPP_ITEM_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_PURCHASE_DATA_LIST) || !ownedItems.containsKey(RESPONSE_INAPP_SIGNATURE_LIST)) {
logError("Bundle returned from getPurchases() doesn't contain required fields.");
return IABHELPER_BAD_RESPONSE;
}
ArrayList<String> ownedSkus = ownedItems.getStringArrayList(RESPONSE_INAPP_ITEM_LIST);
ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);
ArrayList<String> signatureList = ownedItems.getStringArrayList(RESPONSE_INAPP_SIGNATURE_LIST);
for (int i = 0; i < purchaseDataList.size(); ++i) {
String purchaseData = purchaseDataList.get(i);
String signature = signatureList.get(i);
String sku = ownedSkus.get(i);
if (Security.verifyPurchase(mSignatureBase64, purchaseData, signature)) {
logDebug("Sku is owned: " + sku);
Purchase purchase = new Purchase(itemType, purchaseData, signature);
if (TextUtils.isEmpty(purchase.getToken())) {
logWarn("BUG: empty/null token!");
logDebug("Purchase data: " + purchaseData);
}
inv.addPurchase(purchase);
} else {
logWarn("Purchase signature verification **FAILED**. Not adding item.");
logDebug(" Purchase data: " + purchaseData);
logDebug(" Signature: " + signature);
verificationFailed = true;
}
}
continueToken = ownedItems.getString(INAPP_CONTINUATION_TOKEN);
logDebug("Continuation token: " + continueToken);
} while (!TextUtils.isEmpty(continueToken));
return verificationFailed ? IABHELPER_VERIFICATION_FAILED : BILLING_RESPONSE_RESULT_OK;
} | advanced-android-book | positive | 3,672 |
@SuppressWarnings("unchecked")
private void decreaseKey(Node<K, V> n, K newKey) {
if (comparator == null) {
c = ((Comparable<? super K>) newKey).compareTo(n.key);
} else {
c = comparator.compare(newKey, n.key);
}
if (c > 0) {
throw new IllegalArgumentException("Keys can only be decreased!");
}
if (c == 0 || root == n) {
n.key = newKey;
return;
}
if (n == root) {
deleteMin();
return;
}
if (n.y_s == null) {
throw new IllegalArgumentException("Invalid handle!");
}
Node<K, V> childTree = unlinkAndUnionChildren(n);
Node<K, V> p = getParent(n);
if (childTree == null) {
if (p.o_c == n) {
if (n.y_s == p) {
p.o_c = null;
} else {
p.o_c = n.y_s;
}
} else {
p.o_c.y_s = p;
}
} else {
if (p.o_c == n) {
childTree.y_s = n.y_s;
p.o_c = childTree;
} else {
p.o_c.y_s = childTree;
childTree.y_s = p;
}
}
size--;
n.o_c = null;
n.y_s = null;
n.key = newKey;
if (comparator == null) {
root = union(root, n);
} else {
root = unionWithComparator(root, n);
}
size++;
} | @SuppressWarnings("unchecked")
private void decreaseKey(Node<K, V> n, K newKey) {
if (comparator == null) {
c = ((Comparable<? super K>) newKey).compareTo(n.key);
} else {
c = comparator.compare(newKey, n.key);
}
if (c > 0) {
throw new IllegalArgumentException("Keys can only be decreased!");
}
if (c == 0 || root == n) {
n.key = newKey;
return;
}
<DeepExtract>
if (n == root) {
deleteMin();
return;
}
if (n.y_s == null) {
throw new IllegalArgumentException("Invalid handle!");
}
Node<K, V> childTree = unlinkAndUnionChildren(n);
Node<K, V> p = getParent(n);
if (childTree == null) {
if (p.o_c == n) {
if (n.y_s == p) {
p.o_c = null;
} else {
p.o_c = n.y_s;
}
} else {
p.o_c.y_s = p;
}
} else {
if (p.o_c == n) {
childTree.y_s = n.y_s;
p.o_c = childTree;
} else {
p.o_c.y_s = childTree;
childTree.y_s = p;
}
}
size--;
n.o_c = null;
n.y_s = null;
</DeepExtract>
n.key = newKey;
if (comparator == null) {
root = union(root, n);
} else {
root = unionWithComparator(root, n);
}
size++;
} | jheaps | positive | 3,673 |
@DebugSetter(ID = "paddingLeft", creator = IntegerSpinnerCreator.class)
public CoordSysRenderer setPaddingLeft(int padding) {
this.paddingLeft = padding;
this.isDirty = true;
return this;
} | @DebugSetter(ID = "paddingLeft", creator = IntegerSpinnerCreator.class)
public CoordSysRenderer setPaddingLeft(int padding) {
this.paddingLeft = padding;
<DeepExtract>
this.isDirty = true;
</DeepExtract>
return this;
} | JPlotter | positive | 3,675 |
public Criteria andBookNameNotEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "bookName" + " cannot be null");
}
criteria.add(new Criterion("book_name <>", value));
return (Criteria) this;
} | public Criteria andBookNameNotEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "bookName" + " cannot be null");
}
criteria.add(new Criterion("book_name <>", value));
</DeepExtract>
return (Criteria) this;
} | springboot-BMSystem | positive | 3,676 |
static int getG(int color) {
return (color & GREEN_MASK) >> GREEN_SHIFT;
} | static int getG(int color) {
<DeepExtract>
return (color & GREEN_MASK) >> GREEN_SHIFT;
</DeepExtract>
} | arquillian-rusheye | positive | 3,677 |
public void moveTo(BindablePoint bindablePoint) {
MoveTo moveTo = new MoveTo();
if (bindablePoint.isBindWidth()) {
bindX(moveTo.xProperty(), bindablePoint.getXOrOffset());
} else if (bindablePoint.isBindPrevX()) {
bind(moveTo.xProperty(), previousPointX, bindablePoint.getXOrOffset());
} else {
moveTo.xProperty().set(bindablePoint.getXOrOffset());
}
if (bindablePoint.isBindHeight()) {
bindY(moveTo.yProperty(), bindablePoint.getYOrOffset());
} else if (bindablePoint.isBindPrevY()) {
bind(moveTo.yProperty(), previousPointY, bindablePoint.getYOrOffset());
} else {
moveTo.yProperty().set(bindablePoint.getYOrOffset());
}
getElements().add(moveTo);
this.previousPointX = moveTo.xProperty();
this.previousPointY = moveTo.yProperty();
} | public void moveTo(BindablePoint bindablePoint) {
MoveTo moveTo = new MoveTo();
if (bindablePoint.isBindWidth()) {
bindX(moveTo.xProperty(), bindablePoint.getXOrOffset());
} else if (bindablePoint.isBindPrevX()) {
bind(moveTo.xProperty(), previousPointX, bindablePoint.getXOrOffset());
} else {
moveTo.xProperty().set(bindablePoint.getXOrOffset());
}
if (bindablePoint.isBindHeight()) {
bindY(moveTo.yProperty(), bindablePoint.getYOrOffset());
} else if (bindablePoint.isBindPrevY()) {
bind(moveTo.yProperty(), previousPointY, bindablePoint.getYOrOffset());
} else {
moveTo.yProperty().set(bindablePoint.getYOrOffset());
}
getElements().add(moveTo);
<DeepExtract>
this.previousPointX = moveTo.xProperty();
this.previousPointY = moveTo.yProperty();
</DeepExtract>
} | LitFX | positive | 3,678 |
public Criteria andU_passwordNotBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "u_password" + " cannot be null");
}
criteria.add(new Criterion("u_password not between", value1, value2));
return (Criteria) this;
} | public Criteria andU_passwordNotBetween(String value1, String value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "u_password" + " cannot be null");
}
criteria.add(new Criterion("u_password not between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | BaiChengNews | positive | 3,679 |
public int synthesis_init(Info vi) {
this.vi = vi;
modebits = Util.ilog2(vi.modes);
transform[0] = new Object[VI_TRANSFORMB];
transform[1] = new Object[VI_TRANSFORMB];
transform[0][0] = new Mdct();
transform[1][0] = new Mdct();
((Mdct) transform[0][0]).init(vi.blocksizes[0]);
((Mdct) transform[1][0]).init(vi.blocksizes[1]);
window[0][0][0] = new float[VI_WINDOWB][];
window[0][0][1] = window[0][0][0];
window[0][1][0] = window[0][0][0];
window[0][1][1] = window[0][0][0];
window[1][0][0] = new float[VI_WINDOWB][];
window[1][0][1] = new float[VI_WINDOWB][];
window[1][1][0] = new float[VI_WINDOWB][];
window[1][1][1] = new float[VI_WINDOWB][];
for (int i = 0; i < VI_WINDOWB; i++) {
window[0][0][0][i] = window(i, vi.blocksizes[0], vi.blocksizes[0] / 2, vi.blocksizes[0] / 2);
window[1][0][0][i] = window(i, vi.blocksizes[1], vi.blocksizes[0] / 2, vi.blocksizes[0] / 2);
window[1][0][1][i] = window(i, vi.blocksizes[1], vi.blocksizes[0] / 2, vi.blocksizes[1] / 2);
window[1][1][0][i] = window(i, vi.blocksizes[1], vi.blocksizes[1] / 2, vi.blocksizes[0] / 2);
window[1][1][1][i] = window(i, vi.blocksizes[1], vi.blocksizes[1] / 2, vi.blocksizes[1] / 2);
}
fullbooks = new CodeBook[vi.books];
for (int i = 0; i < vi.books; i++) {
fullbooks[i] = new CodeBook();
fullbooks[i].init_decode(vi.book_param[i]);
}
pcm_storage = 8192;
pcm = new float[vi.channels][];
{
for (int i = 0; i < vi.channels; i++) {
pcm[i] = new float[pcm_storage];
}
}
lW = 0;
W = 0;
centerW = vi.blocksizes[1] / 2;
pcm_current = centerW;
mode = new Object[vi.modes];
for (int i = 0; i < vi.modes; i++) {
int mapnum = vi.mode_param[i].mapping;
int maptype = vi.map_type[mapnum];
mode[i] = FuncMapping.mapping_P[maptype].look(this, vi.mode_param[i], vi.map_param[mapnum]);
}
return (0);
pcm_returned = centerW;
centerW -= vi.blocksizes[W] / 4 + vi.blocksizes[lW] / 4;
granulepos = -1;
sequence = -1;
return (0);
} | public int synthesis_init(Info vi) {
<DeepExtract>
this.vi = vi;
modebits = Util.ilog2(vi.modes);
transform[0] = new Object[VI_TRANSFORMB];
transform[1] = new Object[VI_TRANSFORMB];
transform[0][0] = new Mdct();
transform[1][0] = new Mdct();
((Mdct) transform[0][0]).init(vi.blocksizes[0]);
((Mdct) transform[1][0]).init(vi.blocksizes[1]);
window[0][0][0] = new float[VI_WINDOWB][];
window[0][0][1] = window[0][0][0];
window[0][1][0] = window[0][0][0];
window[0][1][1] = window[0][0][0];
window[1][0][0] = new float[VI_WINDOWB][];
window[1][0][1] = new float[VI_WINDOWB][];
window[1][1][0] = new float[VI_WINDOWB][];
window[1][1][1] = new float[VI_WINDOWB][];
for (int i = 0; i < VI_WINDOWB; i++) {
window[0][0][0][i] = window(i, vi.blocksizes[0], vi.blocksizes[0] / 2, vi.blocksizes[0] / 2);
window[1][0][0][i] = window(i, vi.blocksizes[1], vi.blocksizes[0] / 2, vi.blocksizes[0] / 2);
window[1][0][1][i] = window(i, vi.blocksizes[1], vi.blocksizes[0] / 2, vi.blocksizes[1] / 2);
window[1][1][0][i] = window(i, vi.blocksizes[1], vi.blocksizes[1] / 2, vi.blocksizes[0] / 2);
window[1][1][1][i] = window(i, vi.blocksizes[1], vi.blocksizes[1] / 2, vi.blocksizes[1] / 2);
}
fullbooks = new CodeBook[vi.books];
for (int i = 0; i < vi.books; i++) {
fullbooks[i] = new CodeBook();
fullbooks[i].init_decode(vi.book_param[i]);
}
pcm_storage = 8192;
pcm = new float[vi.channels][];
{
for (int i = 0; i < vi.channels; i++) {
pcm[i] = new float[pcm_storage];
}
}
lW = 0;
W = 0;
centerW = vi.blocksizes[1] / 2;
pcm_current = centerW;
mode = new Object[vi.modes];
for (int i = 0; i < vi.modes; i++) {
int mapnum = vi.mode_param[i].mapping;
int maptype = vi.map_type[mapnum];
mode[i] = FuncMapping.mapping_P[maptype].look(this, vi.mode_param[i], vi.map_param[mapnum]);
}
return (0);
</DeepExtract>
pcm_returned = centerW;
centerW -= vi.blocksizes[W] / 4 + vi.blocksizes[lW] / 4;
granulepos = -1;
sequence = -1;
return (0);
} | StegDroid | positive | 3,680 |
public void setDiscNumber(Transaction txn, int discNumber) {
UShortChunk.checkUShortRange(discNumber);
if (txn != null) {
txn.addTxn(this, createNewTxn("discNumber", discNumber));
} else {
setValue("discNumber", discNumber);
}
} | public void setDiscNumber(Transaction txn, int discNumber) {
<DeepExtract>
UShortChunk.checkUShortRange(discNumber);
if (txn != null) {
txn.addTxn(this, createNewTxn("discNumber", discNumber));
} else {
setValue("discNumber", discNumber);
}
</DeepExtract>
} | daap | positive | 3,681 |
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<>();
resources.add(PersonResource.class);
return resources;
} | @Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<>();
<DeepExtract>
resources.add(PersonResource.class);
</DeepExtract>
return resources;
} | Payara-Examples | positive | 3,682 |
public static void setTheme(ViewGroup root, @ColorInt int background) {
AppStyles instance = new AppStyles(root.getContext());
root.setBackgroundColor(background);
for (int pos = 0; pos < root.getChildCount(); pos++) {
View child = root.getChildAt(pos);
if (child instanceof SwitchButton) {
SwitchButton sw = (SwitchButton) child;
int[] color = { settings.getIconColor() };
sw.setTintColor(settings.getHighlightColor());
sw.setThumbColor(new ColorStateList(SWITCH_STATES, color));
} else if (child instanceof SeekBar) {
SeekBar seekBar = (SeekBar) child;
setSeekBarColor(seekBar, settings);
} else if (child instanceof Spinner) {
Spinner dropdown = (Spinner) child;
setDrawableColor(dropdown.getBackground(), settings.getIconColor());
} else if (child instanceof TextView) {
TextView tv = (TextView) child;
tv.setTypeface(settings.getTypeFace());
tv.setTextColor(settings.getTextColor());
setDrawableColor(tv, settings.getIconColor());
if (child instanceof Button) {
Button btn = (Button) child;
setButtonColor(btn, settings.getTextColor());
} else if (child instanceof EditText) {
EditText edit = (EditText) child;
edit.setHintTextColor(settings.getTextColor() & HINT_TRANSPARENCY);
}
} else if (child instanceof ImageView) {
ImageView img = (ImageView) child;
setDrawableColor(img.getDrawable(), settings.getIconColor());
if (child instanceof ImageButton) {
ImageButton btn = (ImageButton) child;
setButtonColor(btn, settings.getTextColor());
}
} else if (child instanceof ViewGroup) {
if (child instanceof CardView) {
CardView card = (CardView) child;
card.setCardBackgroundColor(settings.getCardColor());
setSubViewTheme(card);
} else if (!(child instanceof ViewPager2)) {
setSubViewTheme((ViewGroup) child);
}
}
}
} | public static void setTheme(ViewGroup root, @ColorInt int background) {
AppStyles instance = new AppStyles(root.getContext());
root.setBackgroundColor(background);
<DeepExtract>
for (int pos = 0; pos < root.getChildCount(); pos++) {
View child = root.getChildAt(pos);
if (child instanceof SwitchButton) {
SwitchButton sw = (SwitchButton) child;
int[] color = { settings.getIconColor() };
sw.setTintColor(settings.getHighlightColor());
sw.setThumbColor(new ColorStateList(SWITCH_STATES, color));
} else if (child instanceof SeekBar) {
SeekBar seekBar = (SeekBar) child;
setSeekBarColor(seekBar, settings);
} else if (child instanceof Spinner) {
Spinner dropdown = (Spinner) child;
setDrawableColor(dropdown.getBackground(), settings.getIconColor());
} else if (child instanceof TextView) {
TextView tv = (TextView) child;
tv.setTypeface(settings.getTypeFace());
tv.setTextColor(settings.getTextColor());
setDrawableColor(tv, settings.getIconColor());
if (child instanceof Button) {
Button btn = (Button) child;
setButtonColor(btn, settings.getTextColor());
} else if (child instanceof EditText) {
EditText edit = (EditText) child;
edit.setHintTextColor(settings.getTextColor() & HINT_TRANSPARENCY);
}
} else if (child instanceof ImageView) {
ImageView img = (ImageView) child;
setDrawableColor(img.getDrawable(), settings.getIconColor());
if (child instanceof ImageButton) {
ImageButton btn = (ImageButton) child;
setButtonColor(btn, settings.getTextColor());
}
} else if (child instanceof ViewGroup) {
if (child instanceof CardView) {
CardView card = (CardView) child;
card.setCardBackgroundColor(settings.getCardColor());
setSubViewTheme(card);
} else if (!(child instanceof ViewPager2)) {
setSubViewTheme((ViewGroup) child);
}
}
}
</DeepExtract>
} | Shitter | positive | 3,683 |
public Box createBox(TeXEnvironment env) {
if (textStyle == null) {
String ts = env.getTextStyle();
if (ts != null) {
textStyle = ts;
}
}
boolean smallCap = env.getSmallCap();
Char ch;
char chr = c;
if (smallCap) {
if (Character.isLowerCase(c)) {
chr = Character.toUpperCase(c);
}
}
if (textStyle == null) {
ch = env.getTeXFont().getDefaultChar(chr, env.getStyle());
} else {
ch = env.getTeXFont().getChar(chr, textStyle, env.getStyle());
}
Box box = new CharBox(ch);
if (smallCap && Character.isLowerCase(c)) {
box = new ScaleBox(box, 0.8f, 0.8f);
}
return box;
} | public Box createBox(TeXEnvironment env) {
if (textStyle == null) {
String ts = env.getTextStyle();
if (ts != null) {
textStyle = ts;
}
}
boolean smallCap = env.getSmallCap();
<DeepExtract>
Char ch;
char chr = c;
if (smallCap) {
if (Character.isLowerCase(c)) {
chr = Character.toUpperCase(c);
}
}
if (textStyle == null) {
ch = env.getTeXFont().getDefaultChar(chr, env.getStyle());
} else {
ch = env.getTeXFont().getChar(chr, textStyle, env.getStyle());
}
</DeepExtract>
Box box = new CharBox(ch);
if (smallCap && Character.isLowerCase(c)) {
box = new ScaleBox(box, 0.8f, 0.8f);
}
return box;
} | jlatexmathfx | positive | 3,684 |
public short[] samU8(int offset, int length) throws java.io.IOException {
while (offset + length > bufLen) {
int newBufLen = bufLen << 1;
byte[] newBuf = new byte[newBufLen];
System.arraycopy(buffer, 0, newBuf, 0, bufLen);
if (stream != null) {
readFully(stream, newBuf, bufLen, newBufLen - bufLen);
}
bufLen = newBufLen;
buffer = newBuf;
}
short[] sampleData = new short[length];
for (int idx = 0; idx < length; idx++) {
sampleData[idx] = (short) (((buffer[offset + idx] & 0xFF) - 128) << 8);
}
return sampleData;
} | public short[] samU8(int offset, int length) throws java.io.IOException {
<DeepExtract>
while (offset + length > bufLen) {
int newBufLen = bufLen << 1;
byte[] newBuf = new byte[newBufLen];
System.arraycopy(buffer, 0, newBuf, 0, bufLen);
if (stream != null) {
readFully(stream, newBuf, bufLen, newBufLen - bufLen);
}
bufLen = newBufLen;
buffer = newBuf;
}
</DeepExtract>
short[] sampleData = new short[length];
for (int idx = 0; idx < length; idx++) {
sampleData[idx] = (short) (((buffer[offset + idx] & 0xFF) - 128) << 8);
}
return sampleData;
} | micromod | positive | 3,685 |
@Override
public void write() throws IOException {
transformer.write();
} | @Override
<DeepExtract>
</DeepExtract>
public void write() throws IOException {
<DeepExtract>
</DeepExtract>
transformer.write();
<DeepExtract>
</DeepExtract>
} | jxls | positive | 3,686 |
public void resumeCurrentView() {
EmulatorView view = (EmulatorView) getCurrentView();
if (view == null) {
return;
}
if (mbPollForWindowSizeChange) {
mCheckSize.run();
}
resumeCurrentView();
view.requestFocus();
} | public void resumeCurrentView() {
EmulatorView view = (EmulatorView) getCurrentView();
if (view == null) {
return;
}
<DeepExtract>
if (mbPollForWindowSizeChange) {
mCheckSize.run();
}
resumeCurrentView();
</DeepExtract>
view.requestFocus();
} | TerminalEmulator-Android | positive | 3,688 |
public CustomDialog create() {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final CustomDialog customDialog = new CustomDialog(context, R.style.MyCustomDialog);
if (layoutId == 0) {
layout = inflater.inflate(R.layout.dialog_normal_layout, null);
} else {
layout = inflater.inflate(layoutId, null);
}
customDialog.addContentView(layout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
((TextView) layout.findViewById(R.id.title)).setText(title);
if (!TextUtils.isEmpty(positiveButtonText)) {
((TextView) layout.findViewById(R.id.positiveButton)).setText(positiveButtonText);
if (positiveButtonClickListener != null) {
(layout.findViewById(R.id.positiveButton)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText editText = (EditText) layout.findViewById(R.id.serialnum_input);
inputText = String.valueOf(editText.getText()).trim();
positiveButtonClickListener.onClick(customDialog, DialogInterface.BUTTON_POSITIVE);
}
});
}
} else {
layout.findViewById(R.id.positiveButton).setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(negativeButtonText)) {
((TextView) layout.findViewById(R.id.negativeButton)).setText(negativeButtonText);
if (negativeButtonClickListener != null) {
(layout.findViewById(R.id.negativeButton)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText editText = (EditText) layout.findViewById(R.id.serialnum_input);
inputText = String.valueOf(editText.getText()).trim();
negativeButtonClickListener.onClick(customDialog, DialogInterface.BUTTON_NEGATIVE);
}
});
}
} else {
layout.findViewById(R.id.negativeButton).setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(message)) {
((TextView) layout.findViewById(R.id.message)).setText(message);
} else if (contentView != null) {
((LinearLayout) layout.findViewById(R.id.content)).removeAllViews();
((LinearLayout) layout.findViewById(R.id.content)).addView(contentView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
this.contentView = layout;
return this;
return customDialog;
} | public CustomDialog create() {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final CustomDialog customDialog = new CustomDialog(context, R.style.MyCustomDialog);
if (layoutId == 0) {
layout = inflater.inflate(R.layout.dialog_normal_layout, null);
} else {
layout = inflater.inflate(layoutId, null);
}
customDialog.addContentView(layout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
((TextView) layout.findViewById(R.id.title)).setText(title);
if (!TextUtils.isEmpty(positiveButtonText)) {
((TextView) layout.findViewById(R.id.positiveButton)).setText(positiveButtonText);
if (positiveButtonClickListener != null) {
(layout.findViewById(R.id.positiveButton)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText editText = (EditText) layout.findViewById(R.id.serialnum_input);
inputText = String.valueOf(editText.getText()).trim();
positiveButtonClickListener.onClick(customDialog, DialogInterface.BUTTON_POSITIVE);
}
});
}
} else {
layout.findViewById(R.id.positiveButton).setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(negativeButtonText)) {
((TextView) layout.findViewById(R.id.negativeButton)).setText(negativeButtonText);
if (negativeButtonClickListener != null) {
(layout.findViewById(R.id.negativeButton)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText editText = (EditText) layout.findViewById(R.id.serialnum_input);
inputText = String.valueOf(editText.getText()).trim();
negativeButtonClickListener.onClick(customDialog, DialogInterface.BUTTON_NEGATIVE);
}
});
}
} else {
layout.findViewById(R.id.negativeButton).setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(message)) {
((TextView) layout.findViewById(R.id.message)).setText(message);
} else if (contentView != null) {
((LinearLayout) layout.findViewById(R.id.content)).removeAllViews();
((LinearLayout) layout.findViewById(R.id.content)).addView(contentView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
<DeepExtract>
this.contentView = layout;
return this;
</DeepExtract>
return customDialog;
} | AiYue | positive | 3,689 |
public static List<String> getDefinitionForYOUDAO(String word) {
String wordDefinition = MySQLUtils.getWordDefinition(word, Dictionary.YOUDAO.name());
if (StringUtils.isNotBlank(wordDefinition)) {
return Arrays.asList(wordDefinition.split("<br/>"));
}
String html = getContent(WordLinker.YOUDAO + word);
List<String> list = parseDefinitionFromHtml(html, YOUDAO_CSS_PATH, word, Dictionary.YOUDAO);
if (!list.isEmpty()) {
MySQLUtils.saveWordDefinition(word, Dictionary.YOUDAO.name(), concat(list, "<br/>"));
}
return list;
} | public static List<String> getDefinitionForYOUDAO(String word) {
<DeepExtract>
String wordDefinition = MySQLUtils.getWordDefinition(word, Dictionary.YOUDAO.name());
if (StringUtils.isNotBlank(wordDefinition)) {
return Arrays.asList(wordDefinition.split("<br/>"));
}
String html = getContent(WordLinker.YOUDAO + word);
List<String> list = parseDefinitionFromHtml(html, YOUDAO_CSS_PATH, word, Dictionary.YOUDAO);
if (!list.isEmpty()) {
MySQLUtils.saveWordDefinition(word, Dictionary.YOUDAO.name(), concat(list, "<br/>"));
}
return list;
</DeepExtract>
} | superword | positive | 3,690 |
public void actionPerformed(java.awt.event.ActionEvent evt) {
JFileChooser chooser = new XFileChooser(XFileChooser.AUTOMATION_FILE);
chooser.showDialog(this, "Import");
File target = chooser.getSelectedFile();
if (target == null) {
return;
}
try {
importAutomation(target);
} catch (ParserConfigurationException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
} catch (SAXException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
}
} | public void actionPerformed(java.awt.event.ActionEvent evt) {
<DeepExtract>
JFileChooser chooser = new XFileChooser(XFileChooser.AUTOMATION_FILE);
chooser.showDialog(this, "Import");
File target = chooser.getSelectedFile();
if (target == null) {
return;
}
try {
importAutomation(target);
} catch (ParserConfigurationException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
} catch (SAXException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(AutomationEditor.class.getName()).log(Level.SEVERE, null, ex);
}
</DeepExtract>
} | ModbusPal | positive | 3,691 |
public void onRtlPropertiesChanged(int i) {
super.onRtlPropertiesChanged(i);
SeslViewReflector.resetPaddingToInitialValues(this);
int i = this.mCheckMarkDrawable != null ? this.mCheckMarkWidth + this.mBasePadding + this.mDrawablePadding : this.mBasePadding;
boolean z = true;
if (isCheckMarkAtStart()) {
boolean z2 = this.mNeedRequestlayout;
if (SeslViewReflector.getField_mPaddingLeft(this) == i) {
z = false;
}
this.mNeedRequestlayout = z2 | z;
SeslViewReflector.setField_mPaddingLeft(this, i);
} else {
boolean z3 = this.mNeedRequestlayout;
if (SeslViewReflector.getField_mPaddingRight(this) == i) {
z = false;
}
this.mNeedRequestlayout = z3 | z;
SeslViewReflector.setField_mPaddingRight(this, i);
}
if (this.mNeedRequestlayout) {
requestLayout();
this.mNeedRequestlayout = false;
}
} | public void onRtlPropertiesChanged(int i) {
super.onRtlPropertiesChanged(i);
<DeepExtract>
SeslViewReflector.resetPaddingToInitialValues(this);
int i = this.mCheckMarkDrawable != null ? this.mCheckMarkWidth + this.mBasePadding + this.mDrawablePadding : this.mBasePadding;
boolean z = true;
if (isCheckMarkAtStart()) {
boolean z2 = this.mNeedRequestlayout;
if (SeslViewReflector.getField_mPaddingLeft(this) == i) {
z = false;
}
this.mNeedRequestlayout = z2 | z;
SeslViewReflector.setField_mPaddingLeft(this, i);
} else {
boolean z3 = this.mNeedRequestlayout;
if (SeslViewReflector.getField_mPaddingRight(this) == i) {
z = false;
}
this.mNeedRequestlayout = z3 | z;
SeslViewReflector.setField_mPaddingRight(this, i);
}
if (this.mNeedRequestlayout) {
requestLayout();
this.mNeedRequestlayout = false;
}
</DeepExtract>
} | SamsungOneUi | positive | 3,692 |
public int getMoneyAmount(int n) {
int[][] dp = new int[n + 1][n + 1];
if (1 >= n) {
return 0;
}
if (0 != dp[1][n]) {
return dp[1][n];
}
int ans = Integer.MAX_VALUE;
for (int n = 1; n <= n; ++n) {
int tmp = n + Math.max(dfs(dp, 1, n - 1), dfs(dp, n + 1, n));
if (tmp < ans) {
ans = tmp;
}
}
dp[1][n] = ans;
return ans;
return dp[1][n];
} | public int getMoneyAmount(int n) {
int[][] dp = new int[n + 1][n + 1];
<DeepExtract>
if (1 >= n) {
return 0;
}
if (0 != dp[1][n]) {
return dp[1][n];
}
int ans = Integer.MAX_VALUE;
for (int n = 1; n <= n; ++n) {
int tmp = n + Math.max(dfs(dp, 1, n - 1), dfs(dp, n + 1, n));
if (tmp < ans) {
ans = tmp;
}
}
dp[1][n] = ans;
return ans;
</DeepExtract>
return dp[1][n];
} | CodingInterview | positive | 3,693 |
private long getLong(final String[] tags, int offset) {
final long hashCode = Arrays.hashCode(tags);
int i;
int start = (Math.abs((int) hashCode) % capacity);
int i = start < 0 ? 0 : start * RECORD_SIZE;
boolean failSafe = false;
for (int counter = 1; ; counter++) {
final long offset = Unsafe.ARRAY_LONG_BASE_OFFSET + i * Unsafe.ARRAY_LONG_INDEX_SCALE;
final long candidate = unsafe.getLongVolatile(table, offset);
if (hashCode == candidate) {
unsafe.putIntVolatile(this, scanLengthOffset, counter);
i = i;
}
if (0L == candidate) {
if (unsafe.compareAndSwapLong(table, offset, 0L, hashCode)) {
final int localUsed = unsafe.getAndAddInt(this, usedOffset, 1) + 1;
unsafe.putLongVolatile(table, offset + 3 * Unsafe.ARRAY_LONG_INDEX_SCALE, Long.MAX_VALUE);
unsafe.putLongVolatile(table, offset + 4 * Unsafe.ARRAY_LONG_INDEX_SCALE, Long.MIN_VALUE);
unsafe.putIntVolatile(this, scanLengthOffset, counter);
i = i;
}
} else {
i += RECORD_SIZE;
if (i >= table.length) {
if (failSafe) {
throw new IllegalStateException("No more space in linear probing table");
} else {
i = 0;
failSafe = true;
}
}
}
}
final long base = Unsafe.ARRAY_LONG_BASE_OFFSET + i * Unsafe.ARRAY_LONG_INDEX_SCALE;
return unsafe.getLongVolatile(table, base + offset * Unsafe.ARRAY_LONG_INDEX_SCALE);
} | private long getLong(final String[] tags, int offset) {
final long hashCode = Arrays.hashCode(tags);
<DeepExtract>
int i;
int start = (Math.abs((int) hashCode) % capacity);
int i = start < 0 ? 0 : start * RECORD_SIZE;
boolean failSafe = false;
for (int counter = 1; ; counter++) {
final long offset = Unsafe.ARRAY_LONG_BASE_OFFSET + i * Unsafe.ARRAY_LONG_INDEX_SCALE;
final long candidate = unsafe.getLongVolatile(table, offset);
if (hashCode == candidate) {
unsafe.putIntVolatile(this, scanLengthOffset, counter);
i = i;
}
if (0L == candidate) {
if (unsafe.compareAndSwapLong(table, offset, 0L, hashCode)) {
final int localUsed = unsafe.getAndAddInt(this, usedOffset, 1) + 1;
unsafe.putLongVolatile(table, offset + 3 * Unsafe.ARRAY_LONG_INDEX_SCALE, Long.MAX_VALUE);
unsafe.putLongVolatile(table, offset + 4 * Unsafe.ARRAY_LONG_INDEX_SCALE, Long.MIN_VALUE);
unsafe.putIntVolatile(this, scanLengthOffset, counter);
i = i;
}
} else {
i += RECORD_SIZE;
if (i >= table.length) {
if (failSafe) {
throw new IllegalStateException("No more space in linear probing table");
} else {
i = 0;
failSafe = true;
}
}
}
}
</DeepExtract>
final long base = Unsafe.ARRAY_LONG_BASE_OFFSET + i * Unsafe.ARRAY_LONG_INDEX_SCALE;
return unsafe.getLongVolatile(table, base + offset * Unsafe.ARRAY_LONG_INDEX_SCALE);
} | metrics | positive | 3,694 |
@Override
public void putNull() {
buffer.putInt(0);
update(4);
} | @Override
public void putNull() {
<DeepExtract>
buffer.putInt(0);
update(4);
</DeepExtract>
} | maven-compiler-plugin | positive | 3,695 |
@Override
public void onClick(View v) {
if (!DataManager.isLogin(getActivity()))
return;
Intent intent = new Intent(getActivity(), StepActivity.class);
startActivity(intent);
} | @Override
public void onClick(View v) {
<DeepExtract>
if (!DataManager.isLogin(getActivity()))
return;
Intent intent = new Intent(getActivity(), StepActivity.class);
startActivity(intent);
</DeepExtract>
} | jkapp | positive | 3,696 |
protected void layoutBlockPositioned(BlockBox subbox, BlockLayoutStatus stat) {
int wlimit = availwidth;
if (leftset)
wlimit -= coords.left;
if (rightset)
wlimit -= coords.right;
fleft = new FloatList(subbox);
fright = new FloatList(subbox);
floatXl = 0;
floatXr = 0;
floatY = 0;
if (!displayed) {
content.setSize(0, 0);
bounds.setSize(0, 0);
return true;
}
clearSplitted();
if (!hasFixedWidth()) {
int min = Math.max(getMinimalContentWidthLimit(), getMinimalContentWidth());
int max = getMaximalContentWidth();
int availcont = wlimit - emargin.left - border.left - padding.left - emargin.right - border.right - padding.right;
int pref = Math.min(Math.max(min, availcont), max);
setContentWidth(pref);
updateChildSizes();
}
widthComputed = true;
setAvailableWidth(totalWidth());
if (!contblock)
layoutInline();
else
layoutBlocks();
return true;
} | protected void layoutBlockPositioned(BlockBox subbox, BlockLayoutStatus stat) {
int wlimit = availwidth;
if (leftset)
wlimit -= coords.left;
if (rightset)
wlimit -= coords.right;
fleft = new FloatList(subbox);
fright = new FloatList(subbox);
floatXl = 0;
floatXr = 0;
floatY = 0;
<DeepExtract>
if (!displayed) {
content.setSize(0, 0);
bounds.setSize(0, 0);
return true;
}
clearSplitted();
if (!hasFixedWidth()) {
int min = Math.max(getMinimalContentWidthLimit(), getMinimalContentWidth());
int max = getMaximalContentWidth();
int availcont = wlimit - emargin.left - border.left - padding.left - emargin.right - border.right - padding.right;
int pref = Math.min(Math.max(min, availcont), max);
setContentWidth(pref);
updateChildSizes();
}
widthComputed = true;
setAvailableWidth(totalWidth());
if (!contblock)
layoutInline();
else
layoutBlocks();
return true;
</DeepExtract>
} | CSSBox | positive | 3,697 |
public static void main(String[] args) {
String terms = "0^0|1&1^1|0|1";
boolean result = true;
int count = 0;
boolean isDone = true;
if (new HashMap<String, Boolean>().containsKey(terms)) {
return 0;
}
for (int i = 0; i < new boolean[(terms.length() - 1) / 2].length; i++) {
if (!new boolean[(terms.length() - 1) / 2][i]) {
new boolean[(terms.length() - 1) / 2][i] = true;
String newexpression = insertParensAround(terms, i);
isDone = false;
count += bruteForce(newexpression, new HashMap<String, Boolean>(), result, new boolean[(terms.length() - 1) / 2]);
new boolean[(terms.length() - 1) / 2][i] = false;
}
}
if (isDone) {
if (evaluate(terms, 0, terms.length() - 1) == result) {
System.out.println(terms + " = " + result);
return 1;
} else {
System.out.println(terms + " = " + !result);
return 0;
}
}
new HashMap<String, Boolean>().put(terms, true);
return count;
System.out.println(countR(terms, result, 0, terms.length() - 1));
System.out.println(countDP(terms, result, 0, terms.length() - 1, new HashMap<String, Integer>()));
System.out.println(countDPEff(terms, result, 0, terms.length() - 1, new HashMap<String, Integer>()));
} | public static void main(String[] args) {
String terms = "0^0|1&1^1|0|1";
boolean result = true;
<DeepExtract>
int count = 0;
boolean isDone = true;
if (new HashMap<String, Boolean>().containsKey(terms)) {
return 0;
}
for (int i = 0; i < new boolean[(terms.length() - 1) / 2].length; i++) {
if (!new boolean[(terms.length() - 1) / 2][i]) {
new boolean[(terms.length() - 1) / 2][i] = true;
String newexpression = insertParensAround(terms, i);
isDone = false;
count += bruteForce(newexpression, new HashMap<String, Boolean>(), result, new boolean[(terms.length() - 1) / 2]);
new boolean[(terms.length() - 1) / 2][i] = false;
}
}
if (isDone) {
if (evaluate(terms, 0, terms.length() - 1) == result) {
System.out.println(terms + " = " + result);
return 1;
} else {
System.out.println(terms + " = " + !result);
return 0;
}
}
new HashMap<String, Boolean>().put(terms, true);
return count;
</DeepExtract>
System.out.println(countR(terms, result, 0, terms.length() - 1));
System.out.println(countDP(terms, result, 0, terms.length() - 1, new HashMap<String, Integer>()));
System.out.println(countDPEff(terms, result, 0, terms.length() - 1, new HashMap<String, Integer>()));
} | ctci | positive | 3,698 |
@Override
public SQLWarning getWarnings() throws SQLException {
if (isClosed)
throw new SQLAlreadyClosedException(this.getClass().getSimpleName());
return null;
} | @Override
public SQLWarning getWarnings() throws SQLException {
<DeepExtract>
if (isClosed)
throw new SQLAlreadyClosedException(this.getClass().getSimpleName());
</DeepExtract>
return null;
} | mongo-jdbc-driver | positive | 3,699 |
private static void withForwardProxyEnabled(String proxyHost, int proxyPort, PortAwareRunnable runnable) throws Exception {
Map<String, String> env = new HashMap<>();
env.put("PROXY_HOST", proxyHost);
env.put("PROXY_PORT", valueOf(proxyPort));
env.put("BASIC_AUTH", "off");
try (GenericContainer<?> proxy = new GenericContainer<>("confluencepublisher/forward-proxy-it:1.0.0").withEnv(env).withNetwork(SHARED).withNetworkAliases(proxyHost).withExposedPorts(proxyPort).withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(AsciidocConfluencePublisherCommandLineClientIntegrationTest.class))).waitingFor(forListeningPort())) {
proxy.start();
runnable.run(proxy.getMappedPort(proxyPort));
}
} | private static void withForwardProxyEnabled(String proxyHost, int proxyPort, PortAwareRunnable runnable) throws Exception {
Map<String, String> env = new HashMap<>();
env.put("PROXY_HOST", proxyHost);
env.put("PROXY_PORT", valueOf(proxyPort));
env.put("BASIC_AUTH", "off");
<DeepExtract>
try (GenericContainer<?> proxy = new GenericContainer<>("confluencepublisher/forward-proxy-it:1.0.0").withEnv(env).withNetwork(SHARED).withNetworkAliases(proxyHost).withExposedPorts(proxyPort).withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger(AsciidocConfluencePublisherCommandLineClientIntegrationTest.class))).waitingFor(forListeningPort())) {
proxy.start();
runnable.run(proxy.getMappedPort(proxyPort));
}
</DeepExtract>
} | confluence-publisher | positive | 3,700 |
@Override
public void setListenerOrientation(float lookX, float lookY, float lookZ, float upX, float upY, float upZ) {
super.setListenerOrientation(lookX, lookY, lookZ, upX, upY, upZ);
this.listenerOrientation.put(0, lookX);
this.listenerOrientation.put(1, lookY);
this.listenerOrientation.put(2, lookZ);
this.listenerOrientation.put(3, upX);
this.listenerOrientation.put(4, upY);
this.listenerOrientation.put(5, upZ);
AL10.alListener(4111, this.listenerOrientation);
switch(AL10.alGetError()) {
case 0:
{
return false;
}
case 40961:
{
this.errorMessage("Invalid name parameter.");
return true;
}
case 40962:
{
this.errorMessage("Invalid parameter.");
return true;
}
case 40963:
{
this.errorMessage("Invalid enumerated parameter value.");
return true;
}
case 40964:
{
this.errorMessage("Illegal call.");
return true;
}
case 40965:
{
this.errorMessage("Unable to allocate memory.");
return true;
}
}
this.errorMessage("An unrecognized error occurred.");
return true;
} | @Override
public void setListenerOrientation(float lookX, float lookY, float lookZ, float upX, float upY, float upZ) {
super.setListenerOrientation(lookX, lookY, lookZ, upX, upY, upZ);
this.listenerOrientation.put(0, lookX);
this.listenerOrientation.put(1, lookY);
this.listenerOrientation.put(2, lookZ);
this.listenerOrientation.put(3, upX);
this.listenerOrientation.put(4, upY);
this.listenerOrientation.put(5, upZ);
AL10.alListener(4111, this.listenerOrientation);
<DeepExtract>
switch(AL10.alGetError()) {
case 0:
{
return false;
}
case 40961:
{
this.errorMessage("Invalid name parameter.");
return true;
}
case 40962:
{
this.errorMessage("Invalid parameter.");
return true;
}
case 40963:
{
this.errorMessage("Invalid enumerated parameter value.");
return true;
}
case 40964:
{
this.errorMessage("Illegal call.");
return true;
}
case 40965:
{
this.errorMessage("Unable to allocate memory.");
return true;
}
}
this.errorMessage("An unrecognized error occurred.");
return true;
</DeepExtract>
} | VoiceChat | positive | 3,701 |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isOrigin = getIntent().getBooleanExtra(ImagePreviewActivity.ISORIGIN, false);
imagePicker.addOnImageSelectedListener(this);
mBtnOk = (Button) findViewById(R.id.btn_ok);
mBtnOk.setVisibility(View.VISIBLE);
mBtnOk.setOnClickListener(this);
bottomBar = findViewById(R.id.bottom_bar);
bottomBar.setVisibility(View.VISIBLE);
mCbCheck = (SuperCheckBox) findViewById(R.id.cb_check);
mCbOrigin = (SuperCheckBox) findViewById(R.id.cb_origin);
marginView = findViewById(R.id.margin_bottom);
mCbOrigin.setText(getString(R.string.ip_origin));
mCbOrigin.setOnCheckedChangeListener(this);
mCbOrigin.setChecked(isOrigin);
if (imagePicker.getSelectImageCount() > 0) {
mBtnOk.setText(getString(R.string.ip_select_complete, imagePicker.getSelectImageCount(), imagePicker.getSelectLimit()));
} else {
mBtnOk.setText(getString(R.string.ip_complete));
}
if (mCbOrigin.isChecked()) {
long size = 0;
for (ImageItem imageItem : selectedImages) size += imageItem.size;
String fileSize = Formatter.formatFileSize(this, size);
mCbOrigin.setText(getString(R.string.ip_origin_size, fileSize));
}
ImageItem item = mImageItems.get(mCurrentPosition);
boolean isSelected = imagePicker.isSelect(item);
mTitleCount.setText(getString(R.string.ip_preview_image_count, mCurrentPosition + 1, mImageItems.size()));
mCbCheck.setChecked(isSelected);
mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
mCurrentPosition = position;
ImageItem item = mImageItems.get(mCurrentPosition);
boolean isSelected = imagePicker.isSelect(item);
mCbCheck.setChecked(isSelected);
mTitleCount.setText(getString(R.string.ip_preview_image_count, mCurrentPosition + 1, mImageItems.size()));
}
});
mCbCheck.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ImageItem imageItem = mImageItems.get(mCurrentPosition);
int selectLimit = imagePicker.getSelectLimit();
if (mCbCheck.isChecked() && selectedImages.size() >= selectLimit) {
Toast.makeText(ImagePreviewActivity.this, getString(R.string.ip_select_limit, selectLimit), Toast.LENGTH_SHORT).show();
mCbCheck.setChecked(false);
} else {
imagePicker.addSelectedImageItem(mCurrentPosition, imageItem, mCbCheck.isChecked());
}
}
});
NavigationBarChangeListener.with(this).setListener(new NavigationBarChangeListener.OnSoftInputStateChangeListener() {
@Override
public void onNavigationBarShow(int orientation, int height) {
marginView.setVisibility(View.VISIBLE);
ViewGroup.LayoutParams layoutParams = marginView.getLayoutParams();
if (layoutParams.height == 0) {
layoutParams.height = Utils.getNavigationBarHeight(ImagePreviewActivity.this);
marginView.requestLayout();
}
}
@Override
public void onNavigationBarHide(int orientation) {
marginView.setVisibility(View.GONE);
}
});
NavigationBarChangeListener.with(this, NavigationBarChangeListener.ORIENTATION_HORIZONTAL).setListener(new NavigationBarChangeListener.OnSoftInputStateChangeListener() {
@Override
public void onNavigationBarShow(int orientation, int height) {
topBar.setPadding(0, 0, height, 0);
bottomBar.setPadding(0, 0, height, 0);
}
@Override
public void onNavigationBarHide(int orientation) {
topBar.setPadding(0, 0, 0, 0);
bottomBar.setPadding(0, 0, 0, 0);
}
});
} | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isOrigin = getIntent().getBooleanExtra(ImagePreviewActivity.ISORIGIN, false);
imagePicker.addOnImageSelectedListener(this);
mBtnOk = (Button) findViewById(R.id.btn_ok);
mBtnOk.setVisibility(View.VISIBLE);
mBtnOk.setOnClickListener(this);
bottomBar = findViewById(R.id.bottom_bar);
bottomBar.setVisibility(View.VISIBLE);
mCbCheck = (SuperCheckBox) findViewById(R.id.cb_check);
mCbOrigin = (SuperCheckBox) findViewById(R.id.cb_origin);
marginView = findViewById(R.id.margin_bottom);
mCbOrigin.setText(getString(R.string.ip_origin));
mCbOrigin.setOnCheckedChangeListener(this);
mCbOrigin.setChecked(isOrigin);
<DeepExtract>
if (imagePicker.getSelectImageCount() > 0) {
mBtnOk.setText(getString(R.string.ip_select_complete, imagePicker.getSelectImageCount(), imagePicker.getSelectLimit()));
} else {
mBtnOk.setText(getString(R.string.ip_complete));
}
if (mCbOrigin.isChecked()) {
long size = 0;
for (ImageItem imageItem : selectedImages) size += imageItem.size;
String fileSize = Formatter.formatFileSize(this, size);
mCbOrigin.setText(getString(R.string.ip_origin_size, fileSize));
}
</DeepExtract>
ImageItem item = mImageItems.get(mCurrentPosition);
boolean isSelected = imagePicker.isSelect(item);
mTitleCount.setText(getString(R.string.ip_preview_image_count, mCurrentPosition + 1, mImageItems.size()));
mCbCheck.setChecked(isSelected);
mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
mCurrentPosition = position;
ImageItem item = mImageItems.get(mCurrentPosition);
boolean isSelected = imagePicker.isSelect(item);
mCbCheck.setChecked(isSelected);
mTitleCount.setText(getString(R.string.ip_preview_image_count, mCurrentPosition + 1, mImageItems.size()));
}
});
mCbCheck.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ImageItem imageItem = mImageItems.get(mCurrentPosition);
int selectLimit = imagePicker.getSelectLimit();
if (mCbCheck.isChecked() && selectedImages.size() >= selectLimit) {
Toast.makeText(ImagePreviewActivity.this, getString(R.string.ip_select_limit, selectLimit), Toast.LENGTH_SHORT).show();
mCbCheck.setChecked(false);
} else {
imagePicker.addSelectedImageItem(mCurrentPosition, imageItem, mCbCheck.isChecked());
}
}
});
NavigationBarChangeListener.with(this).setListener(new NavigationBarChangeListener.OnSoftInputStateChangeListener() {
@Override
public void onNavigationBarShow(int orientation, int height) {
marginView.setVisibility(View.VISIBLE);
ViewGroup.LayoutParams layoutParams = marginView.getLayoutParams();
if (layoutParams.height == 0) {
layoutParams.height = Utils.getNavigationBarHeight(ImagePreviewActivity.this);
marginView.requestLayout();
}
}
@Override
public void onNavigationBarHide(int orientation) {
marginView.setVisibility(View.GONE);
}
});
NavigationBarChangeListener.with(this, NavigationBarChangeListener.ORIENTATION_HORIZONTAL).setListener(new NavigationBarChangeListener.OnSoftInputStateChangeListener() {
@Override
public void onNavigationBarShow(int orientation, int height) {
topBar.setPadding(0, 0, height, 0);
bottomBar.setPadding(0, 0, height, 0);
}
@Override
public void onNavigationBarHide(int orientation) {
topBar.setPadding(0, 0, 0, 0);
bottomBar.setPadding(0, 0, 0, 0);
}
});
} | EasyOk | positive | 3,702 |
public static void main(String[] args) throws Exception {
NonInferrableReturnTypeStreamJob concreteModelTest = new NonInferrableReturnTypeStreamJob();
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.fromCollection(this.abstractDataModelList).map(new MyMapFunctionNonInferrableReturnType()).returns(TypeInformation.of(String.class)).addSink(sink);
env.execute();
} | public static void main(String[] args) throws Exception {
NonInferrableReturnTypeStreamJob concreteModelTest = new NonInferrableReturnTypeStreamJob();
<DeepExtract>
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.fromCollection(this.abstractDataModelList).map(new MyMapFunctionNonInferrableReturnType()).returns(TypeInformation.of(String.class)).addSink(sink);
env.execute();
</DeepExtract>
} | explore-flink | positive | 3,704 |
public void switchCamera() {
if (camera != null) {
camera.setPreviewCallback(null);
camera.stopPreview();
camera.release();
camera = null;
}
selectedCameraId = (selectedCameraId + 1) % numberOfCameras;
if (disableCamera)
return;
camera = Camera.open(selectedCameraId);
List<Size> supportedPreviewSizes = camera.getParameters().getSupportedPreviewSizes();
Size previewSize = Utils.getOptimalPreviewSize(supportedPreviewSizes, EXPECTED_PREVIEW_WIDTH, EXPECTED_PREVIEW_HEIGHT);
Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(previewSize.width, previewSize.height);
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
}
camera.setParameters(parameters);
int degree = Utils.getCameraDisplayOrientation(context, selectedCameraId);
camera.setDisplayOrientation(degree);
boolean rotate = degree == 90 || degree == 270;
textureWidth = rotate ? previewSize.height : previewSize.width;
textureHeight = rotate ? previewSize.width : previewSize.height;
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
GLES20.glDeleteFramebuffers(1, fbo, 0);
GLES20.glDeleteTextures(1, drawTexureId, 0);
GLES20.glDeleteTextures(1, fboTexureId, 0);
GLES20.glGenTextures(1, drawTexureId, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, drawTexureId[0]);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, textureWidth, textureHeight, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
GLES20.glGenTextures(1, fboTexureId, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, fboTexureId[0]);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, textureWidth, textureHeight, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
GLES20.glGenFramebuffers(1, fbo, 0);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo[0]);
GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, fboTexureId[0], 0);
try {
camera.setPreviewTexture(surfaceTexture);
} catch (IOException exception) {
Log.e(TAG, "IOException caused by setPreviewDisplay()", exception);
}
camera.startPreview();
} | public void switchCamera() {
if (camera != null) {
camera.setPreviewCallback(null);
camera.stopPreview();
camera.release();
camera = null;
}
selectedCameraId = (selectedCameraId + 1) % numberOfCameras;
<DeepExtract>
if (disableCamera)
return;
camera = Camera.open(selectedCameraId);
List<Size> supportedPreviewSizes = camera.getParameters().getSupportedPreviewSizes();
Size previewSize = Utils.getOptimalPreviewSize(supportedPreviewSizes, EXPECTED_PREVIEW_WIDTH, EXPECTED_PREVIEW_HEIGHT);
Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(previewSize.width, previewSize.height);
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
}
camera.setParameters(parameters);
int degree = Utils.getCameraDisplayOrientation(context, selectedCameraId);
camera.setDisplayOrientation(degree);
boolean rotate = degree == 90 || degree == 270;
textureWidth = rotate ? previewSize.height : previewSize.width;
textureHeight = rotate ? previewSize.width : previewSize.height;
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
GLES20.glDeleteFramebuffers(1, fbo, 0);
GLES20.glDeleteTextures(1, drawTexureId, 0);
GLES20.glDeleteTextures(1, fboTexureId, 0);
GLES20.glGenTextures(1, drawTexureId, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, drawTexureId[0]);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, textureWidth, textureHeight, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
GLES20.glGenTextures(1, fboTexureId, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, fboTexureId[0]);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, textureWidth, textureHeight, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
GLES20.glGenFramebuffers(1, fbo, 0);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo[0]);
GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, fboTexureId[0], 0);
try {
camera.setPreviewTexture(surfaceTexture);
} catch (IOException exception) {
Log.e(TAG, "IOException caused by setPreviewDisplay()", exception);
}
camera.startPreview();
</DeepExtract>
} | Paddle-Lite-Demo | positive | 3,705 |
public void setStartKey(int startKey) {
optMap.put(PARAM_STARTKEY, Integer.toString(startKey));
} | public void setStartKey(int startKey) {
<DeepExtract>
optMap.put(PARAM_STARTKEY, Integer.toString(startKey));
</DeepExtract>
} | CouchbaseMock | positive | 3,706 |
void onCancel() {
if (mFlingRunnable.mScroller.isFinished()) {
scrollIntoSlots();
}
dispatchUnpress();
} | void onCancel() {
<DeepExtract>
if (mFlingRunnable.mScroller.isFinished()) {
scrollIntoSlots();
}
dispatchUnpress();
</DeepExtract>
} | android_support_v4 | positive | 3,707 |
public void componentResized(java.awt.event.ComponentEvent evt) {
fixTempSignaturePosition(false);
} | public void componentResized(java.awt.event.ComponentEvent evt) {
<DeepExtract>
fixTempSignaturePosition(false);
</DeepExtract>
} | aCCinaPDF | positive | 3,708 |
public Float call() {
System.out.println("starting " + x + " + " + y);
try {
TimeUnit.MILLISECONDS.sleep(100 + rand.nextInt(2000));
} catch (InterruptedException e) {
System.out.println("sleep() interrupted");
}
return x + y;
} | public Float call() {
System.out.println("starting " + x + " + " + y);
<DeepExtract>
try {
TimeUnit.MILLISECONDS.sleep(100 + rand.nextInt(2000));
} catch (InterruptedException e) {
System.out.println("sleep() interrupted");
}
</DeepExtract>
return x + y;
} | learning-note | positive | 3,709 |
private void removeTail() {
Integer key = tail.prev.key;
Node node = map.get(key);
Node prev = node.prev;
node.next.prev = prev;
prev.next = node.next;
if (!map.containsKey(key)) {
return 0;
}
Node node = map.get(key);
map.remove(key);
removeNode(node);
return 0;
} | private void removeTail() {
Integer key = tail.prev.key;
Node node = map.get(key);
Node prev = node.prev;
node.next.prev = prev;
prev.next = node.next;
<DeepExtract>
if (!map.containsKey(key)) {
return 0;
}
Node node = map.get(key);
map.remove(key);
removeNode(node);
return 0;
</DeepExtract>
} | Elements-of-programming-interviews | positive | 3,710 |
public Criteria andUnameNotEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "uname" + " cannot be null");
}
criteria.add(new Criterion("uname <>", value));
return (Criteria) this;
} | public Criteria andUnameNotEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "uname" + " cannot be null");
}
criteria.add(new Criterion("uname <>", value));
</DeepExtract>
return (Criteria) this;
} | Ordering | positive | 3,711 |
public Vector3 getPerpendicular() {
if (this.z == 0.0F) {
return this.zCrossProduct();
}
return new Vector3(0.0D, this.z, -this.y);
} | public Vector3 getPerpendicular() {
if (this.z == 0.0F) {
return this.zCrossProduct();
}
<DeepExtract>
return new Vector3(0.0D, this.z, -this.y);
</DeepExtract>
} | WarpDrive | positive | 3,712 |
public String ifModifiedSince() {
if (headerMaps.containsKey(HttpReqHead.IF_MODIFIED_SINCE)) {
return headerMaps.get(HttpReqHead.IF_MODIFIED_SINCE).getValue();
}
return null;
} | public String ifModifiedSince() {
<DeepExtract>
if (headerMaps.containsKey(HttpReqHead.IF_MODIFIED_SINCE)) {
return headerMaps.get(HttpReqHead.IF_MODIFIED_SINCE).getValue();
}
return null;
</DeepExtract>
} | spring-cloud-netflix-itoken | positive | 3,713 |
@Override
public File call(File file) {
int minSize = 60;
int longSide = 720;
int shortSide = 1280;
String filePath = file.getAbsolutePath();
String thumbFilePath = mCacheDir.getAbsolutePath() + File.separator + (TextUtils.isEmpty(filename) ? System.currentTimeMillis() : filename) + ".jpg";
long size = 0;
long maxSize = file.length() / 5;
int angle = getImageSpinAngle(filePath);
int[] imgSize = getImageSize(filePath);
int width = 0, height = 0;
if (imgSize[0] <= imgSize[1]) {
double scale = (double) imgSize[0] / (double) imgSize[1];
if (scale <= 1.0 && scale > 0.5625) {
width = imgSize[0] > shortSide ? shortSide : imgSize[0];
height = width * imgSize[1] / imgSize[0];
size = minSize;
} else if (scale <= 0.5625) {
height = imgSize[1] > longSide ? longSide : imgSize[1];
width = height * imgSize[0] / imgSize[1];
size = maxSize;
}
} else {
double scale = (double) imgSize[1] / (double) imgSize[0];
if (scale <= 1.0 && scale > 0.5625) {
height = imgSize[1] > shortSide ? shortSide : imgSize[1];
width = height * imgSize[0] / imgSize[1];
size = minSize;
} else if (scale <= 0.5625) {
width = imgSize[0] > longSide ? longSide : imgSize[0];
height = width * imgSize[1] / imgSize[0];
size = maxSize;
}
}
return compress(filePath, thumbFilePath, width, height, angle, size);
} | @Override
public File call(File file) {
<DeepExtract>
int minSize = 60;
int longSide = 720;
int shortSide = 1280;
String filePath = file.getAbsolutePath();
String thumbFilePath = mCacheDir.getAbsolutePath() + File.separator + (TextUtils.isEmpty(filename) ? System.currentTimeMillis() : filename) + ".jpg";
long size = 0;
long maxSize = file.length() / 5;
int angle = getImageSpinAngle(filePath);
int[] imgSize = getImageSize(filePath);
int width = 0, height = 0;
if (imgSize[0] <= imgSize[1]) {
double scale = (double) imgSize[0] / (double) imgSize[1];
if (scale <= 1.0 && scale > 0.5625) {
width = imgSize[0] > shortSide ? shortSide : imgSize[0];
height = width * imgSize[1] / imgSize[0];
size = minSize;
} else if (scale <= 0.5625) {
height = imgSize[1] > longSide ? longSide : imgSize[1];
width = height * imgSize[0] / imgSize[1];
size = maxSize;
}
} else {
double scale = (double) imgSize[1] / (double) imgSize[0];
if (scale <= 1.0 && scale > 0.5625) {
height = imgSize[1] > shortSide ? shortSide : imgSize[1];
width = height * imgSize[0] / imgSize[1];
size = minSize;
} else if (scale <= 0.5625) {
width = imgSize[0] > longSide ? longSide : imgSize[0];
height = width * imgSize[1] / imgSize[0];
size = maxSize;
}
}
return compress(filePath, thumbFilePath, width, height, angle, size);
</DeepExtract>
} | MVP_Project | positive | 3,714 |
public Criteria andTemperatureIsNull() {
if ("temperature is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("temperature is null"));
return (Criteria) this;
} | public Criteria andTemperatureIsNull() {
<DeepExtract>
if ("temperature is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("temperature is null"));
</DeepExtract>
return (Criteria) this;
} | health_online | positive | 3,715 |
public synchronized static void resetBitmapCache(float percent) {
bitmapCachePercent = percent;
if (null != bitmapMemoryCache) {
bitmapMemoryCache.removeAll();
bitmapMemoryCache = null;
}
} | public synchronized static void resetBitmapCache(float percent) {
bitmapCachePercent = percent;
<DeepExtract>
if (null != bitmapMemoryCache) {
bitmapMemoryCache.removeAll();
bitmapMemoryCache = null;
}
</DeepExtract>
} | bigapple | positive | 3,716 |
@Override
public void warn(final String format, final Object arg) {
if (!WARN.isGreaterOrEqual(minimum))
throw new IllegalStateException(format("%s logging disabled for logger \"%s\" [%s]", WARN, getName(), getClass().getName()));
super.warn(format, arg);
} | @Override
public void warn(final String format, final Object arg) {
<DeepExtract>
if (!WARN.isGreaterOrEqual(minimum))
throw new IllegalStateException(format("%s logging disabled for logger \"%s\" [%s]", WARN, getName(), getClass().getName()));
</DeepExtract>
super.warn(format, arg);
} | binkley | positive | 3,717 |
public void install(Context context, String apkPath) {
File optimizedDirectory = context.getDir(OPT_DIR, Context.MODE_PRIVATE);
mClassLoader = new DexClassLoader(apkPath, optimizedDirectory.getAbsolutePath(), null, context.getClassLoader());
AssetManager assetManager = null;
try {
assetManager = AssetManager.class.newInstance();
Method addAssetPath = assetManager.getClass().getMethod("addAssetPath", String.class);
addAssetPath.invoke(assetManager, apkPath);
} catch (Exception e) {
e.printStackTrace();
}
Resources superRes = context.getResources();
mAppResources = new Resources(assetManager, superRes.getDisplayMetrics(), superRes.getConfiguration());
PackageManager pm = context.getPackageManager();
packageInfo = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES);
} | public void install(Context context, String apkPath) {
File optimizedDirectory = context.getDir(OPT_DIR, Context.MODE_PRIVATE);
mClassLoader = new DexClassLoader(apkPath, optimizedDirectory.getAbsolutePath(), null, context.getClassLoader());
AssetManager assetManager = null;
try {
assetManager = AssetManager.class.newInstance();
Method addAssetPath = assetManager.getClass().getMethod("addAssetPath", String.class);
addAssetPath.invoke(assetManager, apkPath);
} catch (Exception e) {
e.printStackTrace();
}
Resources superRes = context.getResources();
mAppResources = new Resources(assetManager, superRes.getDisplayMetrics(), superRes.getConfiguration());
<DeepExtract>
PackageManager pm = context.getPackageManager();
packageInfo = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES);
</DeepExtract>
} | AndroidDemos | positive | 3,718 |
private void handleActive() {
LogUtil.d(TAG, "findToPlay");
Iterator<Map.Entry<Integer, ChannelMediaPlayerInfo>> it = currentPlayMap.entrySet().iterator();
if (!it.hasNext()) {
return;
}
Map.Entry<Integer, ChannelMediaPlayerInfo> entry = it.next();
ChannelMediaPlayerInfo info = entry.getValue();
LogUtil.d(TAG, "findToPlay-channelName:" + info.channelName);
if (info.mediaPlayer.getPlayState() == IMediaPlayer.PlayState.PAUSED) {
LogUtil.d(TAG, "findToPlay-value-resume:" + info.priority);
info.mediaPlayer.resume();
} else {
LogUtil.d(TAG, "findToPlay-PlayState:" + info.mediaPlayer.getPlayState());
if (info.mediaPlayer.getPlayState() != IMediaPlayer.PlayState.PLAYING && info.mediaPlayer.getPlayState() != IMediaPlayer.PlayState.PREPARING && info.mediaPlayer.getPlayState() != IMediaPlayer.PlayState.PREPARED) {
LogUtil.d(TAG, "findToPlay-value-play:" + info.priority);
info.mediaPlayer.play(info.mediaResource);
} else {
LogUtil.d(TAG, "findToPlay-value-isPlaying-false:" + info.priority);
}
}
} | private void handleActive() {
<DeepExtract>
LogUtil.d(TAG, "findToPlay");
Iterator<Map.Entry<Integer, ChannelMediaPlayerInfo>> it = currentPlayMap.entrySet().iterator();
if (!it.hasNext()) {
return;
}
Map.Entry<Integer, ChannelMediaPlayerInfo> entry = it.next();
ChannelMediaPlayerInfo info = entry.getValue();
LogUtil.d(TAG, "findToPlay-channelName:" + info.channelName);
if (info.mediaPlayer.getPlayState() == IMediaPlayer.PlayState.PAUSED) {
LogUtil.d(TAG, "findToPlay-value-resume:" + info.priority);
info.mediaPlayer.resume();
} else {
LogUtil.d(TAG, "findToPlay-PlayState:" + info.mediaPlayer.getPlayState());
if (info.mediaPlayer.getPlayState() != IMediaPlayer.PlayState.PLAYING && info.mediaPlayer.getPlayState() != IMediaPlayer.PlayState.PREPARING && info.mediaPlayer.getPlayState() != IMediaPlayer.PlayState.PREPARED) {
LogUtil.d(TAG, "findToPlay-value-play:" + info.priority);
info.mediaPlayer.play(info.mediaResource);
} else {
LogUtil.d(TAG, "findToPlay-value-isPlaying-false:" + info.priority);
}
}
</DeepExtract>
} | dcs-sdk-java | positive | 3,719 |
public static void reset() {
return MarioOptions.getInstance().getBool(BoolOption.SIMULATION_POWER_RESTORATION);
return MarioOptions.getInstance().getBool(BoolOption.SIMULATION_GAMEPLAY_STOPPED);
SimulatorOptions.nextFrameIfPaused = false;
} | public static void reset() {
return MarioOptions.getInstance().getBool(BoolOption.SIMULATION_POWER_RESTORATION);
<DeepExtract>
return MarioOptions.getInstance().getBool(BoolOption.SIMULATION_GAMEPLAY_STOPPED);
</DeepExtract>
SimulatorOptions.nextFrameIfPaused = false;
} | MarioAI | positive | 3,720 |
public void hideEdge(Edge hideEdge) {
visibleLocality.removeEdge(hideEdge);
if (mouseOverE == hideEdge)
setMouseOverE(null);
tgLayout.resetDamper();
} | public void hideEdge(Edge hideEdge) {
visibleLocality.removeEdge(hideEdge);
if (mouseOverE == hideEdge)
setMouseOverE(null);
<DeepExtract>
tgLayout.resetDamper();
</DeepExtract>
} | s3db | positive | 3,721 |
public Criteria andTypeIn(List<Byte> values) {
if (values == null) {
throw new RuntimeException("Value for " + "type" + " cannot be null");
}
criteria.add(new Criterion("type in", values));
return (Criteria) this;
} | public Criteria andTypeIn(List<Byte> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "type" + " cannot be null");
}
criteria.add(new Criterion("type in", values));
</DeepExtract>
return (Criteria) this;
} | uccn | positive | 3,722 |
public void dumpTest() {
if (worst != null) {
Path2D p2d = worst.path2d;
double[] coords = new double[6];
System.out.println("test case with " + worst.numerrors + " errors and " + worst.numwarnings + " warnings:");
System.out.print("Path=");
PathIterator pi = p2d.getPathIterator(null);
while (!pi.isDone()) {
int type = pi.currentSegment(coords);
System.out.print(' ');
System.out.print(svgcommand.charAt(type));
for (int i = 0; i < coordcount[type]; i++) {
if (i > 0) {
System.out.print(',');
}
System.out.print(coords[i]);
}
pi.next();
}
System.out.println();
System.out.println("Path2D p = new Path2D.Double();");
pi = p2d.getPathIterator(null);
while (!pi.isDone()) {
int type = pi.currentSegment(coords);
System.out.print("p.");
System.out.print(pathCommands[type]);
System.out.print("(");
for (int i = 0; i < coordcount[type]; i++) {
if (i > 0) {
System.out.print(", ");
}
System.out.print(coords[i]);
}
System.out.println(");");
pi.next();
}
}
} | public void dumpTest() {
<DeepExtract>
if (worst != null) {
Path2D p2d = worst.path2d;
double[] coords = new double[6];
System.out.println("test case with " + worst.numerrors + " errors and " + worst.numwarnings + " warnings:");
System.out.print("Path=");
PathIterator pi = p2d.getPathIterator(null);
while (!pi.isDone()) {
int type = pi.currentSegment(coords);
System.out.print(' ');
System.out.print(svgcommand.charAt(type));
for (int i = 0; i < coordcount[type]; i++) {
if (i > 0) {
System.out.print(',');
}
System.out.print(coords[i]);
}
pi.next();
}
System.out.println();
System.out.println("Path2D p = new Path2D.Double();");
pi = p2d.getPathIterator(null);
while (!pi.isDone()) {
int type = pi.currentSegment(coords);
System.out.print("p.");
System.out.print(pathCommands[type]);
System.out.print("(");
for (int i = 0; i < coordcount[type]; i++) {
if (i > 0) {
System.out.print(", ");
}
System.out.print(coords[i]);
}
System.out.println(");");
pi.next();
}
}
</DeepExtract>
} | marlin-fx | positive | 3,723 |
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
super.onCreate(savedInstanceState);
setContentView(R.layout.register);
password01 = (EditText) findViewById(R.id.loginPass01);
password02 = (EditText) findViewById(R.id.loginPass02);
nickName = (EditText) findViewById(R.id.newNickName);
userTel = (EditText) findViewById(R.id.loginName);
CircularImage cover_user_photo = (CircularImage) findViewById(R.id.cover_user_photo);
cover_user_photo.setImageResource(R.drawable.head);
CircularImage cover_user_photo_circle = (CircularImage) findViewById(R.id.circle);
cover_user_photo_circle.setImageResource(R.drawable.circle);
Button btn = (Button) findViewById(R.id.makeRoad_GoBack);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startAnimActivity(LoginActivity.class);
RegiActivity.this.finish();
}
});
Button regbtn = (Button) findViewById(R.id.registerBtn);
regbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
register();
}
});
} | @Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
super.onCreate(savedInstanceState);
setContentView(R.layout.register);
<DeepExtract>
password01 = (EditText) findViewById(R.id.loginPass01);
password02 = (EditText) findViewById(R.id.loginPass02);
nickName = (EditText) findViewById(R.id.newNickName);
userTel = (EditText) findViewById(R.id.loginName);
CircularImage cover_user_photo = (CircularImage) findViewById(R.id.cover_user_photo);
cover_user_photo.setImageResource(R.drawable.head);
CircularImage cover_user_photo_circle = (CircularImage) findViewById(R.id.circle);
cover_user_photo_circle.setImageResource(R.drawable.circle);
</DeepExtract>
Button btn = (Button) findViewById(R.id.makeRoad_GoBack);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startAnimActivity(LoginActivity.class);
RegiActivity.this.finish();
}
});
Button regbtn = (Button) findViewById(R.id.registerBtn);
regbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
register();
}
});
} | AMAP4 | positive | 3,724 |
public Response delete(String url, Map<String, Object> params) throws ResourceException, RequestException, ServerException {
return request(HttpMethod.DELETE, url, params, null, null);
} | public Response delete(String url, Map<String, Object> params) throws ResourceException, RequestException, ServerException {
<DeepExtract>
return request(HttpMethod.DELETE, url, params, null, null);
</DeepExtract>
} | basecrm-java | positive | 3,725 |
@Override
public void run() {
if (filter != null)
filter.destroy();
filter = null;
filter = MagicFilterFactory.initFilters(type);
if (filter != null)
filter.init();
if (filter != null) {
filter.onDisplaySizeChanged(surfaceWidth, surfaceHeight);
filter.onInputSizeChanged(imageWidth, imageHeight);
}
} | @Override
public void run() {
if (filter != null)
filter.destroy();
filter = null;
filter = MagicFilterFactory.initFilters(type);
if (filter != null)
filter.init();
<DeepExtract>
if (filter != null) {
filter.onDisplaySizeChanged(surfaceWidth, surfaceHeight);
filter.onInputSizeChanged(imageWidth, imageHeight);
}
</DeepExtract>
} | MagicShow | positive | 3,726 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.