before stringlengths 12 3.21M | after stringlengths 41 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
public synchronized void flush() throws IOException {
if (journalWriter == null) {
throw new IllegalStateException("cache is closed");
}
while (size > maxSize) {
final Map.Entry<String, Entry> toEvict = lruEntries.entrySet().iterator().next();
remove(toEvict.getKey());
}
journalWriter.flush();
} | public synchronized void flush() throws IOException {
if (journalWriter == null) {
throw new IllegalStateException("cache is closed");
}
<DeepExtract>
while (size > maxSize) {
final Map.Entry<String, Entry> toEvict = lruEntries.entrySet().iterator().next();
remove(toEvict.getKey());
}
</DeepExtract>
journalWriter.flush();
} | wanAndroid | positive | 3,839 |
private String readContentFromPost(String URL, String data) throws IOException {
if (debugCode) {
System.out.println("gtlog: " + data);
}
URL postUrl = new URL(URL);
HttpURLConnection connection = (HttpURLConnection) postUrl.openConnection();
connection.setConnectTimeout(2000);
connection.setReadTimeout(2000);
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(connection.getOutputStream(), "utf-8");
outputStreamWriter.write(data);
outputStreamWriter.flush();
outputStreamWriter.close();
if (connection.getResponseCode() == 200) {
StringBuffer sBuffer = new StringBuffer();
InputStream inStream = null;
byte[] buf = new byte[1024];
inStream = connection.getInputStream();
for (int n; (n = inStream.read(buf)) != -1; ) {
sBuffer.append(new String(buf, 0, n, "UTF-8"));
}
inStream.close();
connection.disconnect();
return sBuffer.toString();
} else {
return "fail";
}
} | private String readContentFromPost(String URL, String data) throws IOException {
<DeepExtract>
if (debugCode) {
System.out.println("gtlog: " + data);
}
</DeepExtract>
URL postUrl = new URL(URL);
HttpURLConnection connection = (HttpURLConnection) postUrl.openConnection();
connection.setConnectTimeout(2000);
connection.setReadTimeout(2000);
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.connect();
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(connection.getOutputStream(), "utf-8");
outputStreamWriter.write(data);
outputStreamWriter.flush();
outputStreamWriter.close();
if (connection.getResponseCode() == 200) {
StringBuffer sBuffer = new StringBuffer();
InputStream inStream = null;
byte[] buf = new byte[1024];
inStream = connection.getInputStream();
for (int n; (n = inStream.read(buf)) != -1; ) {
sBuffer.append(new String(buf, 0, n, "UTF-8"));
}
inStream.close();
connection.disconnect();
return sBuffer.toString();
} else {
return "fail";
}
} | YMall | positive | 3,840 |
@Override
protected void onNewIntent(Intent intent) {
LocalBroadcastHelper.sendBroadcast(this, RingtoneService.ACTION_NOTIFY_MISSED);
super.finish();
startActivity(intent);
} | @Override
protected void onNewIntent(Intent intent) {
LocalBroadcastHelper.sendBroadcast(this, RingtoneService.ACTION_NOTIFY_MISSED);
<DeepExtract>
super.finish();
</DeepExtract>
startActivity(intent);
} | ClockPlus | positive | 3,841 |
@Test
public void testSue() {
assertEquals("wrong key for '" + "Sue" + "'", "S000", SoundexComparator.soundex("Sue"));
} | @Test
public void testSue() {
<DeepExtract>
assertEquals("wrong key for '" + "Sue" + "'", "S000", SoundexComparator.soundex("Sue"));
</DeepExtract>
} | duke | positive | 3,842 |
@Test
public void parseCacheHeaders_normalExpire() {
long now = System.currentTimeMillis();
headers.put("Date", rfc1123Date(now));
headers.put("Last-Modified", rfc1123Date(now - ONE_DAY_MILLIS));
headers.put("Expires", rfc1123Date(now + ONE_HOUR_MILLIS));
Cache.Entry entry = HttpHeaderParser.parseCacheHeaders(response);
assertNotNull(entry);
assertNull(entry.etag);
long diff = Math.abs(entry.serverDate - now);
assertTrue(diff < ONE_MINUTE_MILLIS);
long diff = Math.abs(entry.lastModified - (now - ONE_DAY_MILLIS));
assertTrue(diff < ONE_MINUTE_MILLIS);
assertTrue(entry.softTtl >= (now + ONE_HOUR_MILLIS));
assertTrue(entry.ttl == entry.softTtl);
} | @Test
public void parseCacheHeaders_normalExpire() {
long now = System.currentTimeMillis();
headers.put("Date", rfc1123Date(now));
headers.put("Last-Modified", rfc1123Date(now - ONE_DAY_MILLIS));
headers.put("Expires", rfc1123Date(now + ONE_HOUR_MILLIS));
Cache.Entry entry = HttpHeaderParser.parseCacheHeaders(response);
assertNotNull(entry);
assertNull(entry.etag);
long diff = Math.abs(entry.serverDate - now);
assertTrue(diff < ONE_MINUTE_MILLIS);
<DeepExtract>
long diff = Math.abs(entry.lastModified - (now - ONE_DAY_MILLIS));
assertTrue(diff < ONE_MINUTE_MILLIS);
</DeepExtract>
assertTrue(entry.softTtl >= (now + ONE_HOUR_MILLIS));
assertTrue(entry.ttl == entry.softTtl);
} | grapevine | positive | 3,843 |
public void setUnitOfMeasure(int unitOfMeasure) {
if (_text.length() > 0) {
int[] kerning = calculateKerning(_text.toString(), OUTPUT_SCALE);
float w = calculateWidth(_text.toString()) / OUTPUT_SCALE;
float h = calculateFontHeight() / OUTPUT_SCALE;
float x = _x / OUTPUT_SCALE;
float y = _y / OUTPUT_SCALE;
_printer.printText(x, y, w, h, _text.toString(), kerning, this);
_x += calculateWidth(_text.toString());
_text = new StringBuffer();
}
_unitsOfMeasure = unitOfMeasure;
} | public void setUnitOfMeasure(int unitOfMeasure) {
<DeepExtract>
if (_text.length() > 0) {
int[] kerning = calculateKerning(_text.toString(), OUTPUT_SCALE);
float w = calculateWidth(_text.toString()) / OUTPUT_SCALE;
float h = calculateFontHeight() / OUTPUT_SCALE;
float x = _x / OUTPUT_SCALE;
float y = _y / OUTPUT_SCALE;
_printer.printText(x, y, w, h, _text.toString(), kerning, this);
_x += calculateWidth(_text.toString());
_text = new StringBuffer();
}
</DeepExtract>
_unitsOfMeasure = unitOfMeasure;
} | pcl-parser | positive | 3,844 |
public void demorph(EntityLivingBase target) {
if (Metamorph.proxy.config.disable_health) {
return;
}
float maxHealth = target.getMaxHealth();
float currentHealth = target.getHealth();
float ratio = currentHealth / maxHealth;
if (target instanceof EntityPlayer) {
IMorphing capability = Morphing.get((EntityPlayer) target);
if (capability != null) {
if (maxHealth > IMorphing.REASONABLE_HEALTH_VALUE) {
capability.setLastHealthRatio(ratio);
} else if (this.lastHealth <= 0.0F ? 20.0F : this.lastHealth > IMorphing.REASONABLE_HEALTH_VALUE) {
ratio = capability.getLastHealthRatio();
}
}
}
this.setMaxHealth(target, this.lastHealth <= 0.0F ? 20.0F : this.lastHealth);
float proportionalHealth = target.getMaxHealth() * ratio;
target.setHealth(proportionalHealth <= 0.0F ? Float.MIN_VALUE : proportionalHealth);
for (IAbility ability : this.settings.abilities) {
ability.onDemorph(target);
}
} | public void demorph(EntityLivingBase target) {
<DeepExtract>
if (Metamorph.proxy.config.disable_health) {
return;
}
float maxHealth = target.getMaxHealth();
float currentHealth = target.getHealth();
float ratio = currentHealth / maxHealth;
if (target instanceof EntityPlayer) {
IMorphing capability = Morphing.get((EntityPlayer) target);
if (capability != null) {
if (maxHealth > IMorphing.REASONABLE_HEALTH_VALUE) {
capability.setLastHealthRatio(ratio);
} else if (this.lastHealth <= 0.0F ? 20.0F : this.lastHealth > IMorphing.REASONABLE_HEALTH_VALUE) {
ratio = capability.getLastHealthRatio();
}
}
}
this.setMaxHealth(target, this.lastHealth <= 0.0F ? 20.0F : this.lastHealth);
float proportionalHealth = target.getMaxHealth() * ratio;
target.setHealth(proportionalHealth <= 0.0F ? Float.MIN_VALUE : proportionalHealth);
</DeepExtract>
for (IAbility ability : this.settings.abilities) {
ability.onDemorph(target);
}
} | metamorph | positive | 3,845 |
public Criteria andPaidAmountNotBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "paidAmount" + " cannot be null");
}
criteria.add(new Criterion("paid_amount not between", value1, value2));
return (Criteria) this;
} | public Criteria andPaidAmountNotBetween(String value1, String value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "paidAmount" + " cannot be null");
}
criteria.add(new Criterion("paid_amount not between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | sihai-maven-ssm-alipay | positive | 3,846 |
public Integer execute() {
return a + b;
} | public Integer execute() {
<DeepExtract>
return a + b;
</DeepExtract>
} | java_concurrency | positive | 3,847 |
public JSONArray getAsJSONArray(String key) {
String JSONString;
File file = mCache.get(key);
if (!file.exists())
JSONString = null;
boolean removeFile = false;
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(file));
String readString = "";
String currentLine;
while ((currentLine = in.readLine()) != null) {
readString += currentLine;
}
if (!Utils.isDue(readString)) {
JSONString = Utils.clearDateInfo(readString);
} else {
removeFile = true;
JSONString = null;
}
} catch (IOException e) {
e.printStackTrace();
JSONString = null;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (removeFile)
remove(key);
}
try {
JSONArray obj = new JSONArray(JSONString);
return obj;
} catch (Exception e) {
e.printStackTrace();
return null;
}
} | public JSONArray getAsJSONArray(String key) {
<DeepExtract>
String JSONString;
File file = mCache.get(key);
if (!file.exists())
JSONString = null;
boolean removeFile = false;
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(file));
String readString = "";
String currentLine;
while ((currentLine = in.readLine()) != null) {
readString += currentLine;
}
if (!Utils.isDue(readString)) {
JSONString = Utils.clearDateInfo(readString);
} else {
removeFile = true;
JSONString = null;
}
} catch (IOException e) {
e.printStackTrace();
JSONString = null;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (removeFile)
remove(key);
}
</DeepExtract>
try {
JSONArray obj = new JSONArray(JSONString);
return obj;
} catch (Exception e) {
e.printStackTrace();
return null;
}
} | AndroidProjectHelper | positive | 3,848 |
public Criteria andBidGreaterThanOrEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "bid" + " cannot be null");
}
criteria.add(new Criterion("bid >=", value));
return (Criteria) this;
} | public Criteria andBidGreaterThanOrEqualTo(Integer value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "bid" + " cannot be null");
}
criteria.add(new Criterion("bid >=", value));
</DeepExtract>
return (Criteria) this;
} | webike | positive | 3,849 |
public boolean register(Subscriber subscriber) {
synchronized (this.lock) {
boolean changed = false;
for (Subscriber sub : Lists.newArrayList(subscriber)) {
if (this.handlersByEvent.put(sub.getEventClass(), sub.getHandler())) {
changed = true;
}
}
if (changed) {
this.handlersCache.invalidateAll();
}
return changed;
}
} | public boolean register(Subscriber subscriber) {
<DeepExtract>
synchronized (this.lock) {
boolean changed = false;
for (Subscriber sub : Lists.newArrayList(subscriber)) {
if (this.handlersByEvent.put(sub.getEventClass(), sub.getHandler())) {
changed = true;
}
}
if (changed) {
this.handlersCache.invalidateAll();
}
return changed;
}
</DeepExtract>
} | PlotMe-Core | positive | 3,850 |
static String startWithDaysToKeep(String taskId, String name, String parentTaskId, LogParams logParams, int daysToKeep) {
return EventLogger.get().startEvent(taskId, name, parentTaskId, logParams, false, createDateToDelete(daysToKeep));
} | static String startWithDaysToKeep(String taskId, String name, String parentTaskId, LogParams logParams, int daysToKeep) {
<DeepExtract>
return EventLogger.get().startEvent(taskId, name, parentTaskId, logParams, false, createDateToDelete(daysToKeep));
</DeepExtract>
} | Timbermill | positive | 3,851 |
private static <T> void printInOrderMiddleLast(TrinaryNode<T> root) {
System.out.printf("Tree InOrder Middle Last : ");
if (root == null) {
return;
}
InOrderTraversalMiddleLast(root.left);
System.out.printf("%3s ", root.data);
InOrderTraversalMiddleLast(root.middle);
InOrderTraversalMiddleLast(root.right);
System.out.print("\n");
} | private static <T> void printInOrderMiddleLast(TrinaryNode<T> root) {
System.out.printf("Tree InOrder Middle Last : ");
<DeepExtract>
if (root == null) {
return;
}
InOrderTraversalMiddleLast(root.left);
System.out.printf("%3s ", root.data);
InOrderTraversalMiddleLast(root.middle);
InOrderTraversalMiddleLast(root.right);
</DeepExtract>
System.out.print("\n");
} | data-structures-in-java | positive | 3,852 |
public static Matrix abs(final Matrix m) {
for (int i = 0; i < m.dup().getLength(); ++i) {
m.dup().put(i, Math.abs(m.dup().get(i)));
}
return m.dup();
} | public static Matrix abs(final Matrix m) {
<DeepExtract>
for (int i = 0; i < m.dup().getLength(); ++i) {
m.dup().put(i, Math.abs(m.dup().get(i)));
}
return m.dup();
</DeepExtract>
} | dolphin | positive | 3,853 |
private void readPOST(ByteBuffer bytebuffer, String httpNotify) throws Exception {
int contentLength = 0;
if (httpContentLength != null)
contentLength = Integer.parseInt(httpContentLength);
else
throw new Exception("POST without Content-Length");
if (contentLength > bytebuffer.position())
return;
setDoingResponse();
if (httpNotify.startsWith("c-n-") && !httpNotify.equals(CacheNotify()))
send404();
else if (contentLength > 0) {
PostResponse pr = readWebObject(bytebuffer, contentLength, httpNotify, null, null, null);
if (pr.code == 200)
send200(null);
else if (pr.code == 201)
send201(pr.location);
else if (pr.code == 400)
send400();
else if (pr.code == 404)
send404();
else
send400();
} else
send200(null);
} | private void readPOST(ByteBuffer bytebuffer, String httpNotify) throws Exception {
int contentLength = 0;
if (httpContentLength != null)
contentLength = Integer.parseInt(httpContentLength);
else
throw new Exception("POST without Content-Length");
if (contentLength > bytebuffer.position())
return;
<DeepExtract>
setDoingResponse();
if (httpNotify.startsWith("c-n-") && !httpNotify.equals(CacheNotify()))
send404();
else if (contentLength > 0) {
PostResponse pr = readWebObject(bytebuffer, contentLength, httpNotify, null, null, null);
if (pr.code == 200)
send200(null);
else if (pr.code == 201)
send201(pr.location);
else if (pr.code == 400)
send400();
else if (pr.code == 404)
send404();
else
send400();
} else
send200(null);
</DeepExtract>
} | NetMash | positive | 3,854 |
public Criteria andUserIdNotEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "userId" + " cannot be null");
}
criteria.add(new Criterion("user_id <>", value));
return (Criteria) this;
} | public Criteria andUserIdNotEqualTo(Integer value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "userId" + " cannot be null");
}
criteria.add(new Criterion("user_id <>", value));
</DeepExtract>
return (Criteria) this;
} | SSM_BookSystem | positive | 3,855 |
static String getType3Message(final String user, final char[] password, final String host, final String domain, final byte[] nonce, final int type2Flags, final String target, final byte[] targetInformation, final Certificate peerServerCertificate, final byte[] type1Message, final byte[] type2Message) throws NTLMEngineException {
return new String(Base64.getEncoder().encode(getBytes()), StandardCharsets.US_ASCII);
} | static String getType3Message(final String user, final char[] password, final String host, final String domain, final byte[] nonce, final int type2Flags, final String target, final byte[] targetInformation, final Certificate peerServerCertificate, final byte[] type1Message, final byte[] type2Message) throws NTLMEngineException {
<DeepExtract>
return new String(Base64.getEncoder().encode(getBytes()), StandardCharsets.US_ASCII);
</DeepExtract>
} | vertx-mail-client | positive | 3,856 |
@Test
public void testStartTransaction() throws Exception {
String t = "START TRANSACTION;";
LOGGER.info(t);
byte[] bytes = t.getBytes();
parser.parse(bytes, context);
} | @Test
public void testStartTransaction() throws Exception {
String t = "START TRANSACTION;";
<DeepExtract>
LOGGER.info(t);
byte[] bytes = t.getBytes();
parser.parse(bytes, context);
</DeepExtract>
} | SQLparser | positive | 3,857 |
public Criteria andCouponNameGreaterThan(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "couponName" + " cannot be null");
}
criteria.add(new Criterion("coupon_name >", value));
return (Criteria) this;
} | public Criteria andCouponNameGreaterThan(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "couponName" + " cannot be null");
}
criteria.add(new Criterion("coupon_name >", value));
</DeepExtract>
return (Criteria) this;
} | oauth2-resource | positive | 3,858 |
@Test(timeout = 20000)
public void testFlushFromFollower() throws Exception {
QuorumTestCallback cb1 = new QuorumTestCallback();
QuorumTestCallback cb2 = new QuorumTestCallback();
TestStateMachine st1 = new TestStateMachine(3);
TestStateMachine st2 = new TestStateMachine(5);
final String server1 = getUniqueHostPort();
final String server2 = getUniqueHostPort();
PersistentState state1 = makeInitialState(server1, 0);
PersistentState state2 = makeInitialState(server2, 0);
ZabConfig config1 = new ZabConfig();
ZabConfig config2 = new ZabConfig();
Zab zab1 = new Zab(st1, config1, server1, server1, state1, cb1, null);
Zab zab2 = new Zab(st2, config2, server2, server1, state2, cb2, null);
this.semBroadcasting.acquire();
zab2.send(ByteBuffer.wrap("req1".getBytes()), null);
zab2.flush(ByteBuffer.wrap("flush1".getBytes()), null);
zab2.send(ByteBuffer.wrap("req2".getBytes()), null);
zab2.flush(ByteBuffer.wrap("flush2".getBytes()), null);
zab2.send(ByteBuffer.wrap("req3".getBytes()), null);
st1.txnsCount.await();
st2.txnsCount.await();
Assert.assertEquals(st1.deliveredTxns.size(), 3);
Assert.assertEquals(st2.deliveredTxns.size(), 5);
Assert.assertEquals(ByteBuffer.wrap("req1".getBytes()), st2.deliveredTxns.get(0).getBody());
Assert.assertEquals(ByteBuffer.wrap("flush1".getBytes()), st2.deliveredTxns.get(1).getBody());
Assert.assertEquals(ByteBuffer.wrap("req2".getBytes()), st2.deliveredTxns.get(2).getBody());
Assert.assertEquals(ByteBuffer.wrap("flush2".getBytes()), st2.deliveredTxns.get(3).getBody());
Assert.assertEquals(ByteBuffer.wrap("req3".getBytes()), st2.deliveredTxns.get(4).getBody());
zab1.shutdown();
zab2.shutdown();
} | @Test(timeout = 20000)
public void testFlushFromFollower() throws Exception {
QuorumTestCallback cb1 = new QuorumTestCallback();
QuorumTestCallback cb2 = new QuorumTestCallback();
TestStateMachine st1 = new TestStateMachine(3);
TestStateMachine st2 = new TestStateMachine(5);
final String server1 = getUniqueHostPort();
final String server2 = getUniqueHostPort();
PersistentState state1 = makeInitialState(server1, 0);
PersistentState state2 = makeInitialState(server2, 0);
ZabConfig config1 = new ZabConfig();
ZabConfig config2 = new ZabConfig();
Zab zab1 = new Zab(st1, config1, server1, server1, state1, cb1, null);
Zab zab2 = new Zab(st2, config2, server2, server1, state2, cb2, null);
<DeepExtract>
this.semBroadcasting.acquire();
</DeepExtract>
zab2.send(ByteBuffer.wrap("req1".getBytes()), null);
zab2.flush(ByteBuffer.wrap("flush1".getBytes()), null);
zab2.send(ByteBuffer.wrap("req2".getBytes()), null);
zab2.flush(ByteBuffer.wrap("flush2".getBytes()), null);
zab2.send(ByteBuffer.wrap("req3".getBytes()), null);
st1.txnsCount.await();
st2.txnsCount.await();
Assert.assertEquals(st1.deliveredTxns.size(), 3);
Assert.assertEquals(st2.deliveredTxns.size(), 5);
Assert.assertEquals(ByteBuffer.wrap("req1".getBytes()), st2.deliveredTxns.get(0).getBody());
Assert.assertEquals(ByteBuffer.wrap("flush1".getBytes()), st2.deliveredTxns.get(1).getBody());
Assert.assertEquals(ByteBuffer.wrap("req2".getBytes()), st2.deliveredTxns.get(2).getBody());
Assert.assertEquals(ByteBuffer.wrap("flush2".getBytes()), st2.deliveredTxns.get(3).getBody());
Assert.assertEquals(ByteBuffer.wrap("req3".getBytes()), st2.deliveredTxns.get(4).getBody());
zab1.shutdown();
zab2.shutdown();
} | jzab | positive | 3,860 |
public void setTextColorResource(int resId) {
this.tabTextColor = getResources().getColor(resId);
for (int i = 0; i < tabCount; i++) {
View v = tabsContainer.getChildAt(i);
v.setBackgroundResource(tabBackgroundResId);
if (v instanceof TextView) {
TextView tab = (TextView) v;
tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
tab.setTypeface(tabTypeface, tabTypefaceStyle);
tab.setTextColor(tabTextColor);
if (textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
tab.setAllCaps(true);
} else {
tab.setText(tab.getText().toString().toUpperCase(locale));
}
}
if (curViewPagerItem == i) {
tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize);
tab.setTypeface(tabTypeface, tabTypefaceStyle);
tab.setTextColor(selectedTabTextColor);
}
}
}
} | public void setTextColorResource(int resId) {
this.tabTextColor = getResources().getColor(resId);
<DeepExtract>
for (int i = 0; i < tabCount; i++) {
View v = tabsContainer.getChildAt(i);
v.setBackgroundResource(tabBackgroundResId);
if (v instanceof TextView) {
TextView tab = (TextView) v;
tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
tab.setTypeface(tabTypeface, tabTypefaceStyle);
tab.setTextColor(tabTextColor);
if (textAllCaps) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
tab.setAllCaps(true);
} else {
tab.setText(tab.getText().toString().toUpperCase(locale));
}
}
if (curViewPagerItem == i) {
tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize);
tab.setTypeface(tabTypeface, tabTypefaceStyle);
tab.setTextColor(selectedTabTextColor);
}
}
}
</DeepExtract>
} | funnyDemo | positive | 3,861 |
public Transform transform(Transform trans) {
float n00 = this.mat[0] * trans.mat[0] + this.mat[1] * trans.mat[4] + this.mat[2] * trans.mat[8] + this.mat[3] * trans.mat[12];
float n01 = this.mat[0] * trans.mat[1] + this.mat[1] * trans.mat[5] + this.mat[2] * trans.mat[9] + this.mat[3] * trans.mat[13];
float n02 = this.mat[0] * trans.mat[2] + this.mat[1] * trans.mat[6] + this.mat[2] * trans.mat[10] + this.mat[3] * trans.mat[14];
float n03 = this.mat[0] * trans.mat[3] + this.mat[1] * trans.mat[7] + this.mat[2] * trans.mat[11] + this.mat[3] * trans.mat[15];
float n04 = this.mat[4] * trans.mat[0] + this.mat[5] * trans.mat[4] + this.mat[6] * trans.mat[8] + this.mat[7] * trans.mat[12];
float n05 = this.mat[4] * trans.mat[1] + this.mat[5] * trans.mat[5] + this.mat[6] * trans.mat[9] + this.mat[7] * trans.mat[13];
float n06 = this.mat[4] * trans.mat[2] + this.mat[5] * trans.mat[6] + this.mat[6] * trans.mat[10] + this.mat[7] * trans.mat[14];
float n07 = this.mat[4] * trans.mat[3] + this.mat[5] * trans.mat[7] + this.mat[6] * trans.mat[11] + this.mat[7] * trans.mat[15];
float n08 = this.mat[8] * trans.mat[0] + this.mat[9] * trans.mat[4] + this.mat[10] * trans.mat[8] + this.mat[11] * trans.mat[12];
float n09 = this.mat[8] * trans.mat[1] + this.mat[9] * trans.mat[5] + this.mat[10] * trans.mat[9] + this.mat[11] * trans.mat[13];
float n10 = this.mat[8] * trans.mat[2] + this.mat[9] * trans.mat[6] + this.mat[10] * trans.mat[10] + this.mat[11] * trans.mat[14];
float n11 = this.mat[8] * trans.mat[3] + this.mat[9] * trans.mat[7] + this.mat[10] * trans.mat[11] + this.mat[11] * trans.mat[15];
float n12 = this.mat[12] * trans.mat[0] + this.mat[13] * trans.mat[4] + this.mat[14] * trans.mat[8] + this.mat[15] * trans.mat[12];
float n13 = this.mat[12] * trans.mat[1] + this.mat[13] * trans.mat[5] + this.mat[14] * trans.mat[9] + this.mat[15] * trans.mat[13];
float n14 = this.mat[12] * trans.mat[2] + this.mat[13] * trans.mat[6] + this.mat[14] * trans.mat[10] + this.mat[15] * trans.mat[14];
float n15 = this.mat[12] * trans.mat[3] + this.mat[13] * trans.mat[7] + this.mat[14] * trans.mat[11] + this.mat[15] * trans.mat[15];
this.mat[0] = n00;
this.mat[1] = n01;
this.mat[2] = n02;
this.mat[3] = n03;
this.mat[4] = n04;
this.mat[5] = n05;
this.mat[6] = n06;
this.mat[7] = n07;
this.mat[8] = n08;
this.mat[9] = n09;
this.mat[10] = n10;
this.mat[11] = n11;
this.mat[12] = n12;
this.mat[13] = n13;
this.mat[14] = n14;
this.mat[15] = n15;
return this;
} | public Transform transform(Transform trans) {
<DeepExtract>
float n00 = this.mat[0] * trans.mat[0] + this.mat[1] * trans.mat[4] + this.mat[2] * trans.mat[8] + this.mat[3] * trans.mat[12];
float n01 = this.mat[0] * trans.mat[1] + this.mat[1] * trans.mat[5] + this.mat[2] * trans.mat[9] + this.mat[3] * trans.mat[13];
float n02 = this.mat[0] * trans.mat[2] + this.mat[1] * trans.mat[6] + this.mat[2] * trans.mat[10] + this.mat[3] * trans.mat[14];
float n03 = this.mat[0] * trans.mat[3] + this.mat[1] * trans.mat[7] + this.mat[2] * trans.mat[11] + this.mat[3] * trans.mat[15];
float n04 = this.mat[4] * trans.mat[0] + this.mat[5] * trans.mat[4] + this.mat[6] * trans.mat[8] + this.mat[7] * trans.mat[12];
float n05 = this.mat[4] * trans.mat[1] + this.mat[5] * trans.mat[5] + this.mat[6] * trans.mat[9] + this.mat[7] * trans.mat[13];
float n06 = this.mat[4] * trans.mat[2] + this.mat[5] * trans.mat[6] + this.mat[6] * trans.mat[10] + this.mat[7] * trans.mat[14];
float n07 = this.mat[4] * trans.mat[3] + this.mat[5] * trans.mat[7] + this.mat[6] * trans.mat[11] + this.mat[7] * trans.mat[15];
float n08 = this.mat[8] * trans.mat[0] + this.mat[9] * trans.mat[4] + this.mat[10] * trans.mat[8] + this.mat[11] * trans.mat[12];
float n09 = this.mat[8] * trans.mat[1] + this.mat[9] * trans.mat[5] + this.mat[10] * trans.mat[9] + this.mat[11] * trans.mat[13];
float n10 = this.mat[8] * trans.mat[2] + this.mat[9] * trans.mat[6] + this.mat[10] * trans.mat[10] + this.mat[11] * trans.mat[14];
float n11 = this.mat[8] * trans.mat[3] + this.mat[9] * trans.mat[7] + this.mat[10] * trans.mat[11] + this.mat[11] * trans.mat[15];
float n12 = this.mat[12] * trans.mat[0] + this.mat[13] * trans.mat[4] + this.mat[14] * trans.mat[8] + this.mat[15] * trans.mat[12];
float n13 = this.mat[12] * trans.mat[1] + this.mat[13] * trans.mat[5] + this.mat[14] * trans.mat[9] + this.mat[15] * trans.mat[13];
float n14 = this.mat[12] * trans.mat[2] + this.mat[13] * trans.mat[6] + this.mat[14] * trans.mat[10] + this.mat[15] * trans.mat[14];
float n15 = this.mat[12] * trans.mat[3] + this.mat[13] * trans.mat[7] + this.mat[14] * trans.mat[11] + this.mat[15] * trans.mat[15];
this.mat[0] = n00;
this.mat[1] = n01;
this.mat[2] = n02;
this.mat[3] = n03;
this.mat[4] = n04;
this.mat[5] = n05;
this.mat[6] = n06;
this.mat[7] = n07;
this.mat[8] = n08;
this.mat[9] = n09;
this.mat[10] = n10;
this.mat[11] = n11;
this.mat[12] = n12;
this.mat[13] = n13;
this.mat[14] = n14;
this.mat[15] = n15;
</DeepExtract>
return this;
} | CustomOreGen | positive | 3,862 |
private void toAdd(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
InstrumentTypeService instrumentTypeService = new InstrumentTypeService();
List<InstrumentType> instrumentTypeList = instrumentTypeService.findAll();
request.setAttribute("instrumentTypeList", instrumentTypeList);
request.getRequestDispatcher("web/instru/addInstrument.jsp").forward(request, response);
} | private void toAdd(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
<DeepExtract>
InstrumentTypeService instrumentTypeService = new InstrumentTypeService();
List<InstrumentType> instrumentTypeList = instrumentTypeService.findAll();
request.setAttribute("instrumentTypeList", instrumentTypeList);
</DeepExtract>
request.getRequestDispatcher("web/instru/addInstrument.jsp").forward(request, response);
} | cailiao | positive | 3,863 |
@Test
public void testModelSavingWithCustomFieldType_shouldCorrectlySaveAndLoadModel() {
DatabaseConfig testDatabaseConfig = new DatabaseConfig.Builder(MyDatabase.class).addTypeSerializers(CustomTypeSerializer.class).addModelClasses(ModelWithDateField.class, ModelWithCustomField.class).build();
ReActiveAndroid.init(new ReActiveConfig.Builder(TestUtils.getApplication()).addDatabaseConfigs(testDatabaseConfig).build());
long modelId = new ModelWithCustomField(ModelWithCustomField.MyCustomType.TWO).save();
ModelWithCustomField model = Select.from(ModelWithCustomField.class).where("id = ?", modelId).fetchSingle();
assertEquals(ModelWithCustomField.MyCustomType.TWO, model.myCustomField);
} | @Test
public void testModelSavingWithCustomFieldType_shouldCorrectlySaveAndLoadModel() {
<DeepExtract>
DatabaseConfig testDatabaseConfig = new DatabaseConfig.Builder(MyDatabase.class).addTypeSerializers(CustomTypeSerializer.class).addModelClasses(ModelWithDateField.class, ModelWithCustomField.class).build();
ReActiveAndroid.init(new ReActiveConfig.Builder(TestUtils.getApplication()).addDatabaseConfigs(testDatabaseConfig).build());
</DeepExtract>
long modelId = new ModelWithCustomField(ModelWithCustomField.MyCustomType.TWO).save();
ModelWithCustomField model = Select.from(ModelWithCustomField.class).where("id = ?", modelId).fetchSingle();
assertEquals(ModelWithCustomField.MyCustomType.TWO, model.myCustomField);
} | ReActiveAndroid | positive | 3,864 |
public void setStalled(Runnable value) {
if (body != null && body.getMediaPlayer() != null) {
if (Platform.isFxApplicationThread())
body.getMediaPlayer().setOnStalled(value);
else
Platform.runLater(() -> body.getMediaPlayer().setOnStalled(value));
}
} | public void setStalled(Runnable value) {
<DeepExtract>
if (body != null && body.getMediaPlayer() != null) {
if (Platform.isFxApplicationThread())
body.getMediaPlayer().setOnStalled(value);
else
Platform.runLater(() -> body.getMediaPlayer().setOnStalled(value));
}
</DeepExtract>
} | xbrowser | positive | 3,865 |
protected Port parsePort(Element portEl, Definition def) throws WSDLException {
Port port = def.createPort();
List remainingAttrs = DOMUtils.getAttributes(portEl);
String name = DOMUtils.getAttribute(portEl, Constants.ATTR_NAME, remainingAttrs);
QName bindingStr;
try {
bindingStr = DOMUtils.getQualifiedAttributeValue(portEl, Constants.ATTR_BINDING, Constants.ELEM_PORT, false, def, remainingAttrs);
} catch (WSDLException e) {
if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED)) {
String attrValue = DOMUtils.getAttribute(portEl, Constants.ATTR_BINDING, remainingAttrs);
bindingStr = new QName(attrValue);
} else {
throw e;
}
}
if (name != null) {
port.setName(name);
}
if (bindingStr != null) {
Binding binding = def.getBinding(bindingStr);
if (binding == null) {
binding = def.createBinding();
binding.setQName(bindingStr);
def.addBinding(binding);
}
port.setBinding(binding);
}
NamedNodeMap attrs = portEl.getAttributes();
int size = attrs.getLength();
for (int i = 0; i < size; i++) {
Attr attr = (Attr) attrs.item(i);
String namespaceURI = attr.getNamespaceURI();
String localPart = attr.getLocalName();
String value = attr.getValue();
if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS)) {
if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS)) {
DOMUtils.registerUniquePrefix(localPart, value, def);
} else {
DOMUtils.registerUniquePrefix(null, value, def);
}
}
}
Element tempEl = DOMUtils.getFirstChildElement(portEl);
while (tempEl != null) {
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) {
port.setDocumentationElement(tempEl);
} else {
port.addExtensibilityElement(parseExtensibilityElement(Port.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
if (port == null)
return;
List nativeAttributeNames = port.getNativeAttributeNames();
NamedNodeMap nodeMap = portEl.getAttributes();
int length = nodeMap.getLength();
for (int i = 0; i < length; i++) {
Attr attribute = (Attr) nodeMap.item(i);
String localName = attribute.getLocalName();
String namespaceURI = attribute.getNamespaceURI();
String prefix = attribute.getPrefix();
QName qname = new QName(namespaceURI, localName);
if (namespaceURI != null && !namespaceURI.equals(Constants.NS_URI_WSDL)) {
if (!namespaceURI.equals(Constants.NS_URI_XMLNS)) {
DOMUtils.registerUniquePrefix(prefix, namespaceURI, def);
String strValue = attribute.getValue();
int attrType = AttributeExtensible.NO_DECLARED_TYPE;
ExtensionRegistry extReg = def.getExtensionRegistry();
if (extReg != null) {
attrType = extReg.queryExtensionAttributeType(Port.class, qname);
}
Object val = parseExtensibilityAttribute(portEl, attrType, strValue, def);
port.setExtensionAttribute(qname, val);
}
} else if (!nativeAttributeNames.contains(localName)) {
WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Encountered illegal " + "extension attribute '" + qname + "'. Extension " + "attributes must be in " + "a namespace other than " + "WSDL's.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(portEl));
throw wsdlExc;
}
}
return port;
} | protected Port parsePort(Element portEl, Definition def) throws WSDLException {
Port port = def.createPort();
List remainingAttrs = DOMUtils.getAttributes(portEl);
String name = DOMUtils.getAttribute(portEl, Constants.ATTR_NAME, remainingAttrs);
QName bindingStr;
try {
bindingStr = DOMUtils.getQualifiedAttributeValue(portEl, Constants.ATTR_BINDING, Constants.ELEM_PORT, false, def, remainingAttrs);
} catch (WSDLException e) {
if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED)) {
String attrValue = DOMUtils.getAttribute(portEl, Constants.ATTR_BINDING, remainingAttrs);
bindingStr = new QName(attrValue);
} else {
throw e;
}
}
if (name != null) {
port.setName(name);
}
if (bindingStr != null) {
Binding binding = def.getBinding(bindingStr);
if (binding == null) {
binding = def.createBinding();
binding.setQName(bindingStr);
def.addBinding(binding);
}
port.setBinding(binding);
}
NamedNodeMap attrs = portEl.getAttributes();
int size = attrs.getLength();
for (int i = 0; i < size; i++) {
Attr attr = (Attr) attrs.item(i);
String namespaceURI = attr.getNamespaceURI();
String localPart = attr.getLocalName();
String value = attr.getValue();
if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS)) {
if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS)) {
DOMUtils.registerUniquePrefix(localPart, value, def);
} else {
DOMUtils.registerUniquePrefix(null, value, def);
}
}
}
Element tempEl = DOMUtils.getFirstChildElement(portEl);
while (tempEl != null) {
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) {
port.setDocumentationElement(tempEl);
} else {
port.addExtensibilityElement(parseExtensibilityElement(Port.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
<DeepExtract>
if (port == null)
return;
List nativeAttributeNames = port.getNativeAttributeNames();
NamedNodeMap nodeMap = portEl.getAttributes();
int length = nodeMap.getLength();
for (int i = 0; i < length; i++) {
Attr attribute = (Attr) nodeMap.item(i);
String localName = attribute.getLocalName();
String namespaceURI = attribute.getNamespaceURI();
String prefix = attribute.getPrefix();
QName qname = new QName(namespaceURI, localName);
if (namespaceURI != null && !namespaceURI.equals(Constants.NS_URI_WSDL)) {
if (!namespaceURI.equals(Constants.NS_URI_XMLNS)) {
DOMUtils.registerUniquePrefix(prefix, namespaceURI, def);
String strValue = attribute.getValue();
int attrType = AttributeExtensible.NO_DECLARED_TYPE;
ExtensionRegistry extReg = def.getExtensionRegistry();
if (extReg != null) {
attrType = extReg.queryExtensionAttributeType(Port.class, qname);
}
Object val = parseExtensibilityAttribute(portEl, attrType, strValue, def);
port.setExtensionAttribute(qname, val);
}
} else if (!nativeAttributeNames.contains(localName)) {
WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Encountered illegal " + "extension attribute '" + qname + "'. Extension " + "attributes must be in " + "a namespace other than " + "WSDL's.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(portEl));
throw wsdlExc;
}
}
</DeepExtract>
return port;
} | libre-wsdl4j | positive | 3,866 |
public Edge addEdge(int n1, int n2, int o) {
this.edges.add(new Edge(n1, n2, o));
_bondMap.resetCache();
_nodeMap.resetCache();
_ring.resetCache();
_averageBondLength.resetCache();
return this.edges.get(this.edges.size() - 1);
} | public Edge addEdge(int n1, int n2, int o) {
this.edges.add(new Edge(n1, n2, o));
<DeepExtract>
_bondMap.resetCache();
_nodeMap.resetCache();
_ring.resetCache();
_averageBondLength.resetCache();
</DeepExtract>
return this.edges.get(this.edges.size() - 1);
} | molvec | positive | 3,867 |
public void testWithInitialAlarm_Deterministic() throws Exception {
final Alarm alarm = new Alarm(this.deterministicAlarmDefinition);
alarm.addAlarmedMetric(new MetricDefinitionAndTenantId(logErrorMetricDef, DET_TEST_ALARM_TENANT_ID));
alarm.addAlarmedMetric(new MetricDefinitionAndTenantId(logWarningMetricDef, DET_TEST_ALARM_TENANT_ID));
when(alarmDefinitionDAO.findById(this.deterministicAlarmDefinition.getId())).thenReturn(this.deterministicAlarmDefinition);
when(alarmDefinitionDAO.listAll()).thenReturn(Arrays.asList(this.deterministicAlarmDefinition));
when(alarmDAO.listAll()).thenReturn(Arrays.asList(alarm));
when(alarmDAO.findById(alarm.getId())).thenReturn(alarm);
when(alarmDAO.findForAlarmDefinitionId(this.deterministicAlarmDefinition.getId())).thenReturn(Arrays.asList(alarm));
shouldThreshold(new ThresholdSpec(this.deterministicAlarmDefinition.getId(), alarm.getId(), DET_TEST_ALARM_NAME, DET_TEST_ALARM_DESCRIPTION, DET_TEST_ALARM_TENANT_ID));
} | public void testWithInitialAlarm_Deterministic() throws Exception {
final Alarm alarm = new Alarm(this.deterministicAlarmDefinition);
alarm.addAlarmedMetric(new MetricDefinitionAndTenantId(logErrorMetricDef, DET_TEST_ALARM_TENANT_ID));
alarm.addAlarmedMetric(new MetricDefinitionAndTenantId(logWarningMetricDef, DET_TEST_ALARM_TENANT_ID));
<DeepExtract>
when(alarmDefinitionDAO.findById(this.deterministicAlarmDefinition.getId())).thenReturn(this.deterministicAlarmDefinition);
when(alarmDefinitionDAO.listAll()).thenReturn(Arrays.asList(this.deterministicAlarmDefinition));
when(alarmDAO.listAll()).thenReturn(Arrays.asList(alarm));
when(alarmDAO.findById(alarm.getId())).thenReturn(alarm);
when(alarmDAO.findForAlarmDefinitionId(this.deterministicAlarmDefinition.getId())).thenReturn(Arrays.asList(alarm));
shouldThreshold(new ThresholdSpec(this.deterministicAlarmDefinition.getId(), alarm.getId(), DET_TEST_ALARM_NAME, DET_TEST_ALARM_DESCRIPTION, DET_TEST_ALARM_TENANT_ID));
</DeepExtract>
} | monasca-thresh | positive | 3,868 |
public void shareMessage(String msg) {
ShareSDK.initSDK(context);
OnekeyShare oks = new OnekeyShare();
oks.setText(msg);
oks.setNotification(R.drawable.ic_launcher, context.getString(R.string.app_name));
oks.setTitle(context.getString(R.string.share_top_info));
oks.setTitleUrl(ViewSettings.WebRoot);
oks.setUrl(ViewSettings.WebRoot);
oks.setComment(context.getString(R.string.share_comment));
oks.setSite(context.getString(R.string.app_name));
oks.setSiteUrl(ViewSettings.WebRoot);
oks.setSilent(true);
oks.setCallback(new OneKeyShareCallback());
oks.show(context);
} | public void shareMessage(String msg) {
ShareSDK.initSDK(context);
OnekeyShare oks = new OnekeyShare();
oks.setText(msg);
<DeepExtract>
oks.setNotification(R.drawable.ic_launcher, context.getString(R.string.app_name));
oks.setTitle(context.getString(R.string.share_top_info));
oks.setTitleUrl(ViewSettings.WebRoot);
oks.setUrl(ViewSettings.WebRoot);
oks.setComment(context.getString(R.string.share_comment));
oks.setSite(context.getString(R.string.app_name));
oks.setSiteUrl(ViewSettings.WebRoot);
oks.setSilent(true);
oks.setCallback(new OneKeyShareCallback());
oks.show(context);
</DeepExtract>
} | AndroidLinkup | positive | 3,869 |
private void seekToRestartPosition(int restartPosition) {
checkPositionIndex(restartPosition, restartCount, "restartPosition");
int offset = restartPositions.getInt(restartPosition * SIZE_OF_INT);
data.setPosition(offset);
nextEntry = null;
requireNonNull(data, "data is null");
int sharedKeyLength = VariableLengthQuantity.readVariableLengthInt(data);
int nonSharedKeyLength = VariableLengthQuantity.readVariableLengthInt(data);
int valueLength = VariableLengthQuantity.readVariableLengthInt(data);
final Slice key;
if (sharedKeyLength > 0) {
key = Slices.allocate(sharedKeyLength + nonSharedKeyLength);
SliceOutput sliceOutput = key.output();
checkState(null != null, "Entry has a shared key but no previous entry was provided");
sliceOutput.writeBytes(null.getKey(), 0, sharedKeyLength);
sliceOutput.writeBytes(data, nonSharedKeyLength);
} else {
key = data.readSlice(nonSharedKeyLength);
}
Slice value = data.readSlice(valueLength);
return new BlockEntry(key, value);
} | private void seekToRestartPosition(int restartPosition) {
checkPositionIndex(restartPosition, restartCount, "restartPosition");
int offset = restartPositions.getInt(restartPosition * SIZE_OF_INT);
data.setPosition(offset);
nextEntry = null;
<DeepExtract>
requireNonNull(data, "data is null");
int sharedKeyLength = VariableLengthQuantity.readVariableLengthInt(data);
int nonSharedKeyLength = VariableLengthQuantity.readVariableLengthInt(data);
int valueLength = VariableLengthQuantity.readVariableLengthInt(data);
final Slice key;
if (sharedKeyLength > 0) {
key = Slices.allocate(sharedKeyLength + nonSharedKeyLength);
SliceOutput sliceOutput = key.output();
checkState(null != null, "Entry has a shared key but no previous entry was provided");
sliceOutput.writeBytes(null.getKey(), 0, sharedKeyLength);
sliceOutput.writeBytes(data, nonSharedKeyLength);
} else {
key = data.readSlice(nonSharedKeyLength);
}
Slice value = data.readSlice(valueLength);
return new BlockEntry(key, value);
</DeepExtract>
} | leveldb | positive | 3,870 |
public static PublicKey readRSAPublicKeyPemString(String publicPemString) throws Exception {
String rex = "-----[BEGIN[A-Z ]|END[A-Z ]]{1,}-----";
return publicPemString.replaceAll(rex, "");
byte[] keyBytes = Base64.decodeBase64(publicPemString);
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(keySpec);
return publicKey;
} | public static PublicKey readRSAPublicKeyPemString(String publicPemString) throws Exception {
<DeepExtract>
String rex = "-----[BEGIN[A-Z ]|END[A-Z ]]{1,}-----";
return publicPemString.replaceAll(rex, "");
</DeepExtract>
byte[] keyBytes = Base64.decodeBase64(publicPemString);
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(keySpec);
return publicKey;
} | littleca | positive | 3,871 |
private void moveObject() {
presentX += defaultWindSpeed * Math.sin(angle);
if (isWindChange) {
angle += (float) (random.nextBoolean() ? -1 : 1) * Math.random() * 0.0025;
}
if (lastDrawTime != 0) {
presentY += (SystemClock.elapsedRealtime() - lastDrawTime) * presentSpeed / 1000;
}
lastDrawTime = SystemClock.elapsedRealtime();
if (presentY > parentHeight || presentX < -bitmap.getWidth() || presentX > parentWidth + bitmap.getWidth()) {
reset();
}
} | private void moveObject() {
presentX += defaultWindSpeed * Math.sin(angle);
if (isWindChange) {
angle += (float) (random.nextBoolean() ? -1 : 1) * Math.random() * 0.0025;
}
<DeepExtract>
if (lastDrawTime != 0) {
presentY += (SystemClock.elapsedRealtime() - lastDrawTime) * presentSpeed / 1000;
}
lastDrawTime = SystemClock.elapsedRealtime();
</DeepExtract>
if (presentY > parentHeight || presentX < -bitmap.getWidth() || presentX > parentWidth + bitmap.getWidth()) {
reset();
}
} | SmartSwipe | positive | 3,872 |
@Override
public void addPortalTeleportPredicate(@NotNull PortalPredicate predicate) {
BetterPortalsAPI.get();
portalPredicateManager.addTeleportPredicate(predicate);
} | @Override
public void addPortalTeleportPredicate(@NotNull PortalPredicate predicate) {
<DeepExtract>
BetterPortalsAPI.get();
</DeepExtract>
portalPredicateManager.addTeleportPredicate(predicate);
} | BetterPortals | positive | 3,873 |
public void setGamesApiOptions(Games.GamesOptions options) {
if (mGoogleApiClientBuilder != null) {
String error = "GameHelper: you cannot call set*ApiOptions after the client " + "builder has been created. Call it before calling createApiClientBuilder() " + "or setup().";
logError(error);
throw new IllegalStateException(error);
}
mGamesApiOptions = options;
} | public void setGamesApiOptions(Games.GamesOptions options) {
<DeepExtract>
if (mGoogleApiClientBuilder != null) {
String error = "GameHelper: you cannot call set*ApiOptions after the client " + "builder has been created. Call it before calling createApiClientBuilder() " + "or setup().";
logError(error);
throw new IllegalStateException(error);
}
</DeepExtract>
mGamesApiOptions = options;
} | io2014-codelabs | positive | 3,874 |
@Override
public boolean canProtect(ProtectionType protectionType, Block block) {
if (protectionType != ProtectionType.CONTAINER)
return false;
if (!P.p.isEnabled() || !BConfig.useBlocklocker) {
return false;
}
if (!LegacyUtil.isWoodPlanks(block.getType()) && !LegacyUtil.isWoodStairs(block.getType())) {
return false;
}
if (Barrel.getByWood(block) != null) {
return true;
}
if (lastBarrelSign == null) {
return false;
}
for (BlockFace face : new BlockFace[] { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST }) {
Block sign = block.getRelative(face);
if (lastBarrelSign.equals(sign)) {
Block spigot = BarrelBody.getSpigotOfSign(sign);
byte signoffset = 0;
if (!spigot.equals(sign)) {
signoffset = (byte) (sign.getY() - spigot.getY());
}
Barrel barrel = new Barrel(spigot, signoffset);
return barrel.getBody().getBrokenBlock(true) == null;
}
}
return false;
} | @Override
public boolean canProtect(ProtectionType protectionType, Block block) {
if (protectionType != ProtectionType.CONTAINER)
return false;
<DeepExtract>
if (!P.p.isEnabled() || !BConfig.useBlocklocker) {
return false;
}
if (!LegacyUtil.isWoodPlanks(block.getType()) && !LegacyUtil.isWoodStairs(block.getType())) {
return false;
}
if (Barrel.getByWood(block) != null) {
return true;
}
if (lastBarrelSign == null) {
return false;
}
for (BlockFace face : new BlockFace[] { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST }) {
Block sign = block.getRelative(face);
if (lastBarrelSign.equals(sign)) {
Block spigot = BarrelBody.getSpigotOfSign(sign);
byte signoffset = 0;
if (!spigot.equals(sign)) {
signoffset = (byte) (sign.getY() - spigot.getY());
}
Barrel barrel = new Barrel(spigot, signoffset);
return barrel.getBody().getBrokenBlock(true) == null;
}
}
return false;
</DeepExtract>
} | Brewery | positive | 3,875 |
private void designForIntentCascadePortfolioAdd(String investorId) {
IndividualInvestorPortfolio individualInvestorPortfolio = portfoliosMap.get(fetchInvestorById(investorId).getId());
if (OPERATION_ADD == OPERATION_ADD) {
individualInvestorPortfolio.setStocksHoldCount(individualInvestorPortfolio.getStocksHoldCount() + 1);
logger.info("updated the portfolio for ADD stocks operation");
} else if (OPERATION_ADD == OPERATION_DELETE) {
individualInvestorPortfolio.setStocksHoldCount(individualInvestorPortfolio.getStocksHoldCount() - 1);
logger.info("updated the portfolio for Delete stocks operation");
}
} | private void designForIntentCascadePortfolioAdd(String investorId) {
<DeepExtract>
IndividualInvestorPortfolio individualInvestorPortfolio = portfoliosMap.get(fetchInvestorById(investorId).getId());
if (OPERATION_ADD == OPERATION_ADD) {
individualInvestorPortfolio.setStocksHoldCount(individualInvestorPortfolio.getStocksHoldCount() + 1);
logger.info("updated the portfolio for ADD stocks operation");
} else if (OPERATION_ADD == OPERATION_DELETE) {
individualInvestorPortfolio.setStocksHoldCount(individualInvestorPortfolio.getStocksHoldCount() - 1);
logger.info("updated the portfolio for Delete stocks operation");
}
</DeepExtract>
} | Hands-On-RESTful-API-Design-Patterns-and-Best-Practices | positive | 3,876 |
public int addCar(String manufacturer, String model, int year, String gear, String color, char category, int seats) throws AgencyException {
this.getPointsOfCategory(new Car(vehicleGlobalCounter, manufacturer, model, year, gear, color, category, seats).getCategory());
new Car(vehicleGlobalCounter, manufacturer, model, year, gear, color, category, seats).setId(vehicleGlobalCounter++);
vehicles.add(new Car(vehicleGlobalCounter, manufacturer, model, year, gear, color, category, seats));
return new Car(vehicleGlobalCounter, manufacturer, model, year, gear, color, category, seats).getId();
} | public int addCar(String manufacturer, String model, int year, String gear, String color, char category, int seats) throws AgencyException {
<DeepExtract>
this.getPointsOfCategory(new Car(vehicleGlobalCounter, manufacturer, model, year, gear, color, category, seats).getCategory());
new Car(vehicleGlobalCounter, manufacturer, model, year, gear, color, category, seats).setId(vehicleGlobalCounter++);
vehicles.add(new Car(vehicleGlobalCounter, manufacturer, model, year, gear, color, category, seats));
return new Car(vehicleGlobalCounter, manufacturer, model, year, gear, color, category, seats).getId();
</DeepExtract>
} | oop | positive | 3,877 |
private void closeGatt(BluetoothGatt gatt) {
if (getExecutor(gatt) != null) {
getExecutor(gatt).clear();
executors.remove(getExecutor(gatt).getDeviceAddress());
}
try {
gatt.close();
} catch (SecurityException se) {
log("Failed to call gatt.close() - No permission granted (Android 12)");
}
} | private void closeGatt(BluetoothGatt gatt) {
<DeepExtract>
if (getExecutor(gatt) != null) {
getExecutor(gatt).clear();
executors.remove(getExecutor(gatt).getDeviceAddress());
}
</DeepExtract>
try {
gatt.close();
} catch (SecurityException se) {
log("Failed to call gatt.close() - No permission granted (Android 12)");
}
} | tap-android-sdk | positive | 3,878 |
private void pop() {
super.close();
while (connections.isEmpty() == false) {
pop();
}
} | private void pop() {
<DeepExtract>
super.close();
while (connections.isEmpty() == false) {
pop();
}
</DeepExtract>
} | coxswain | positive | 3,879 |
public static boolean matches(Node node, String requiredLocalName, QName requiredNamespace) {
if (node == null) {
return false;
}
boolean matchingNamespace;
if (requiredNamespace == null) {
matchingNamespace = true;
} else {
matchingNamespace = requiredNamespace.getNamespaceURI().equals(node.getNamespaceURI());
}
return matchingNamespace && matchingLocalName(node, requiredLocalName);
} | public static boolean matches(Node node, String requiredLocalName, QName requiredNamespace) {
if (node == null) {
return false;
}
<DeepExtract>
boolean matchingNamespace;
if (requiredNamespace == null) {
matchingNamespace = true;
} else {
matchingNamespace = requiredNamespace.getNamespaceURI().equals(node.getNamespaceURI());
}
</DeepExtract>
return matchingNamespace && matchingLocalName(node, requiredLocalName);
} | carldav | positive | 3,880 |
@Test(timeout = 500)
public void shouldLetToSubmitAgainTheSameTaskIfResetWhenFinished() throws Exception {
mAwex = new Awex(mThreadHelper, new ConsoleLogger(), new LinearWithRealTimePriorityPolicy(0, 1));
VoidTask someTask = new VoidTask() {
@Override
protected void runWithoutResult() throws InterruptedException {
}
};
mAwex.submit(someTask);
someTask.getPromise().getResult();
someTask.reset();
mAwex.submit(someTask);
someTask.getPromise().getResult();
assertEquals(Promise.STATE_RESOLVED, someTask.getPromise().getState());
} | @Test(timeout = 500)
public void shouldLetToSubmitAgainTheSameTaskIfResetWhenFinished() throws Exception {
<DeepExtract>
mAwex = new Awex(mThreadHelper, new ConsoleLogger(), new LinearWithRealTimePriorityPolicy(0, 1));
</DeepExtract>
VoidTask someTask = new VoidTask() {
@Override
protected void runWithoutResult() throws InterruptedException {
}
};
mAwex.submit(someTask);
someTask.getPromise().getResult();
someTask.reset();
mAwex.submit(someTask);
someTask.getPromise().getResult();
assertEquals(Promise.STATE_RESOLVED, someTask.getPromise().getState());
} | awex | positive | 3,881 |
@NotNull
private static File getPluginLibHomeEclipse() {
File pluginHome;
if (isUnitTest()) {
if (new File("../lib/" + "eclipse").exists()) {
pluginHome = new File("../lib/" + "eclipse");
} else {
pluginHome = new File("lib/" + "eclipse");
}
} else {
pluginHome = new File(PathManager.getPluginsPath(), "EclipseFormatter/lib/");
File preInstalled = new File(PathManager.getPreInstalledPluginsPath(), "EclipseFormatter/lib/");
if (!pluginHome.exists() && preInstalled.exists()) {
pluginHome = preInstalled;
}
}
return pluginHome;
} | @NotNull
private static File getPluginLibHomeEclipse() {
<DeepExtract>
File pluginHome;
if (isUnitTest()) {
if (new File("../lib/" + "eclipse").exists()) {
pluginHome = new File("../lib/" + "eclipse");
} else {
pluginHome = new File("lib/" + "eclipse");
}
} else {
pluginHome = new File(PathManager.getPluginsPath(), "EclipseFormatter/lib/");
File preInstalled = new File(PathManager.getPreInstalledPluginsPath(), "EclipseFormatter/lib/");
if (!pluginHome.exists() && preInstalled.exists()) {
pluginHome = preInstalled;
}
}
return pluginHome;
</DeepExtract>
} | EclipseCodeFormatter | positive | 3,882 |
@Override
public void handleGetChannelAccessResponse(IpmiHandlerContext context, GetChannelAccessResponse response) {
handleDefault(context, response);
} | @Override
public void handleGetChannelAccessResponse(IpmiHandlerContext context, GetChannelAccessResponse response) {
<DeepExtract>
handleDefault(context, response);
</DeepExtract>
} | ipmi4j | positive | 3,883 |
@Override
public void run() {
PostsDialog dialog = new PostsDialog();
dialog.repliedTo = thread.postMap.get(quoterId);
dialog.adapter = new PostsDialogAdapter(thread.postMap.get(quotedId));
addPostsDialog(dialog);
} | @Override
public void run() {
<DeepExtract>
PostsDialog dialog = new PostsDialog();
dialog.repliedTo = thread.postMap.get(quoterId);
dialog.adapter = new PostsDialogAdapter(thread.postMap.get(quotedId));
addPostsDialog(dialog);
</DeepExtract>
} | chanobol | positive | 3,884 |
public Criteria andNameLessThan(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "name" + " cannot be null");
}
criteria.add(new Criterion("name <", value));
return (Criteria) this;
} | public Criteria andNameLessThan(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "name" + " cannot be null");
}
criteria.add(new Criterion("name <", value));
</DeepExtract>
return (Criteria) this;
} | PetStore | positive | 3,885 |
@PluginMethod()
public void copy(PluginCall call) {
saveCall(call);
String from = call.getString("from");
String to = call.getString("to");
String directory = call.getString("directory");
String toDirectory = call.getString("toDirectory");
if (toDirectory == null) {
toDirectory = directory;
}
if (from == null || from.isEmpty() || to == null || to.isEmpty()) {
call.error("Both to and from must be provided");
return;
}
File fromObject = getFileObject(from, directory);
File toObject = getFileObject(to, toDirectory);
assert fromObject != null;
assert toObject != null;
if (toObject.equals(fromObject)) {
call.success();
return;
}
if (!fromObject.exists()) {
call.error("The source object does not exist");
return;
}
if (toObject.getParentFile().isFile()) {
call.error("The parent object of the destination is a file");
return;
}
if (!toObject.getParentFile().exists()) {
call.error("The parent object of the destination does not exist");
return;
}
if (isPublicDirectory(directory) || isPublicDirectory(toDirectory)) {
if (false) {
if (!isStoragePermissionGranted(PluginRequestCodes.FILESYSTEM_REQUEST_RENAME_PERMISSIONS, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
return;
}
} else {
if (!isStoragePermissionGranted(PluginRequestCodes.FILESYSTEM_REQUEST_COPY_PERMISSIONS, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
return;
}
}
}
if (toObject.isDirectory()) {
call.error("Cannot overwrite a directory");
return;
}
toObject.delete();
assert fromObject != null;
boolean modified = false;
if (false) {
modified = fromObject.renameTo(toObject);
} else {
try {
copyRecursively(fromObject, toObject);
modified = true;
} catch (IOException ignored) {
}
}
if (!modified) {
call.error("Unable to perform action, unknown reason");
return;
}
call.success();
} | @PluginMethod()
public void copy(PluginCall call) {
<DeepExtract>
saveCall(call);
String from = call.getString("from");
String to = call.getString("to");
String directory = call.getString("directory");
String toDirectory = call.getString("toDirectory");
if (toDirectory == null) {
toDirectory = directory;
}
if (from == null || from.isEmpty() || to == null || to.isEmpty()) {
call.error("Both to and from must be provided");
return;
}
File fromObject = getFileObject(from, directory);
File toObject = getFileObject(to, toDirectory);
assert fromObject != null;
assert toObject != null;
if (toObject.equals(fromObject)) {
call.success();
return;
}
if (!fromObject.exists()) {
call.error("The source object does not exist");
return;
}
if (toObject.getParentFile().isFile()) {
call.error("The parent object of the destination is a file");
return;
}
if (!toObject.getParentFile().exists()) {
call.error("The parent object of the destination does not exist");
return;
}
if (isPublicDirectory(directory) || isPublicDirectory(toDirectory)) {
if (false) {
if (!isStoragePermissionGranted(PluginRequestCodes.FILESYSTEM_REQUEST_RENAME_PERMISSIONS, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
return;
}
} else {
if (!isStoragePermissionGranted(PluginRequestCodes.FILESYSTEM_REQUEST_COPY_PERMISSIONS, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
return;
}
}
}
if (toObject.isDirectory()) {
call.error("Cannot overwrite a directory");
return;
}
toObject.delete();
assert fromObject != null;
boolean modified = false;
if (false) {
modified = fromObject.renameTo(toObject);
} else {
try {
copyRecursively(fromObject, toObject);
modified = true;
} catch (IOException ignored) {
}
}
if (!modified) {
call.error("Unable to perform action, unknown reason");
return;
}
call.success();
</DeepExtract>
} | capacitor-music-controls-plugin | positive | 3,886 |
public float screenX(float x, float y) {
showWarning("screenX" + "(), or this particular variation of it, " + "is not available with this renderer.");
return 0;
} | public float screenX(float x, float y) {
<DeepExtract>
showWarning("screenX" + "(), or this particular variation of it, " + "is not available with this renderer.");
</DeepExtract>
return 0;
} | rainbow | positive | 3,887 |
public String getStringByDefaultSP(String key, String defaultValue) {
String result = defaultValue;
if (context != null && !TextUtils.isEmpty(USER_CONFING) && !TextUtils.isEmpty(key)) {
result = context.getSharedPreferences(USER_CONFING, Context.MODE_PRIVATE).getString(key, defaultValue);
}
return result;
} | public String getStringByDefaultSP(String key, String defaultValue) {
<DeepExtract>
String result = defaultValue;
if (context != null && !TextUtils.isEmpty(USER_CONFING) && !TextUtils.isEmpty(key)) {
result = context.getSharedPreferences(USER_CONFING, Context.MODE_PRIVATE).getString(key, defaultValue);
}
return result;
</DeepExtract>
} | Pluto-Android | positive | 3,888 |
@Override
public void onClick(View v) {
if (!switchViews())
return;
if (null == null) {
null = new Bundle();
}
null.putString(GerritService.CHANGE_ID, mSelectedChange);
null.putInt(GerritService.CHANGE_NUMBER, mChangeNumber);
GerritService.sendRequest(mParent, GerritService.DataType.CommitDetails, null);
} | @Override
public void onClick(View v) {
<DeepExtract>
if (!switchViews())
return;
if (null == null) {
null = new Bundle();
}
null.putString(GerritService.CHANGE_ID, mSelectedChange);
null.putInt(GerritService.CHANGE_NUMBER, mChangeNumber);
GerritService.sendRequest(mParent, GerritService.DataType.CommitDetails, null);
</DeepExtract>
} | external_jbirdvegas_mGerrit | positive | 3,889 |
private static int geMaxCollection(int[][] coins) {
int[][][] mem = new int[ROWS][COLS][COLS];
for (int i = 0; i < ROWS; i++) {
for (int j = 0; j < COLS; j++) {
for (int k = 0; k < COLS; k++) {
mem[i][j][k] = -1;
}
}
}
int answer, temp;
if (!isValid(0, 0, COLS - 1))
return Integer.MIN_VALUE;
if (0 == ROWS - 1 && 0 == 0 && COLS - 1 == COLS - 1)
return (0 == COLS - 1) ? coins[0][0] : coins[0][0] + coins[0][COLS - 1];
if (0 == ROWS - 1)
return Integer.MIN_VALUE;
if (mem[0][0][COLS - 1] != -1)
return mem[0][0][COLS - 1];
answer = Integer.MIN_VALUE;
temp = (0 == COLS - 1) ? coins[0][0] : coins[0][0] + coins[0][COLS - 1];
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0, COLS - 1 - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0, COLS - 1 + 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0, COLS - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 - 1, COLS - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 - 1, COLS - 1 - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 - 1, COLS - 1 + 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 + 1, COLS - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 + 1, COLS - 1 - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 + 1, COLS - 1 + 1));
return (mem[0][0][COLS - 1] = answer);
} | private static int geMaxCollection(int[][] coins) {
int[][][] mem = new int[ROWS][COLS][COLS];
for (int i = 0; i < ROWS; i++) {
for (int j = 0; j < COLS; j++) {
for (int k = 0; k < COLS; k++) {
mem[i][j][k] = -1;
}
}
}
<DeepExtract>
int answer, temp;
if (!isValid(0, 0, COLS - 1))
return Integer.MIN_VALUE;
if (0 == ROWS - 1 && 0 == 0 && COLS - 1 == COLS - 1)
return (0 == COLS - 1) ? coins[0][0] : coins[0][0] + coins[0][COLS - 1];
if (0 == ROWS - 1)
return Integer.MIN_VALUE;
if (mem[0][0][COLS - 1] != -1)
return mem[0][0][COLS - 1];
answer = Integer.MIN_VALUE;
temp = (0 == COLS - 1) ? coins[0][0] : coins[0][0] + coins[0][COLS - 1];
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0, COLS - 1 - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0, COLS - 1 + 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0, COLS - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 - 1, COLS - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 - 1, COLS - 1 - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 - 1, COLS - 1 + 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 + 1, COLS - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 + 1, COLS - 1 - 1));
answer = max(answer, temp + getMaxUtil(coins, mem, 0 + 1, 0 + 1, COLS - 1 + 1));
return (mem[0][0][COLS - 1] = answer);
</DeepExtract>
} | DSA_Java | positive | 3,890 |
public Optional<String> getPartitionId() {
return Optional.ofNullable(headers.get("PARTITION_ID"));
} | public Optional<String> getPartitionId() {
<DeepExtract>
return Optional.ofNullable(headers.get("PARTITION_ID"));
</DeepExtract>
} | eventuate-cdc | positive | 3,891 |
public void reset() {
this.windowSize = windowSize;
this.bins = bins;
this.numChannels = numChannels;
this.windows = new double[numChannels][windowSize];
this.currentFFTs = new double[numChannels][windowSize];
this.meanFFTs = new double[numChannels][windowSize];
this.meanFFTValue = new double[numChannels];
this.varFFTValue = new double[numChannels];
this.currentFFTPhases = new double[numChannels][windowSize];
this.currentFFTValue = new double[numChannels];
this.currentFFTBins = new double[bins][numChannels];
this.meanFFTValueCount = new int[bins][numChannels];
this.meanFFTBins = new double[bins][numChannels];
this.varFFTBins = new double[bins][numChannels];
this.relativeFFTBins = new double[bins][numChannels];
this.baselineFFTValues = new double[bins][numChannels];
this.shortMeanFFTBins = new double[bins][numChannels];
this.shortVarFFTBins = new double[bins][numChannels];
this.rewardFFTBins = new double[bins][numChannels];
this.currentFFTValue = new double[numChannels];
this.maxFFTValue = new double[numChannels];
this.notBrainwaves = new boolean[numChannels];
this.packagePenalty = new int[numChannels];
for (int c = 0; c < numChannels; c++) {
this.maxFFTValue[c] = 1d;
this.currentFFTValue[c] = .01d;
this.meanFFTValue[c] = .5d;
}
} | public void reset() {
<DeepExtract>
this.windowSize = windowSize;
this.bins = bins;
this.numChannels = numChannels;
this.windows = new double[numChannels][windowSize];
this.currentFFTs = new double[numChannels][windowSize];
this.meanFFTs = new double[numChannels][windowSize];
this.meanFFTValue = new double[numChannels];
this.varFFTValue = new double[numChannels];
this.currentFFTPhases = new double[numChannels][windowSize];
this.currentFFTValue = new double[numChannels];
this.currentFFTBins = new double[bins][numChannels];
this.meanFFTValueCount = new int[bins][numChannels];
this.meanFFTBins = new double[bins][numChannels];
this.varFFTBins = new double[bins][numChannels];
this.relativeFFTBins = new double[bins][numChannels];
this.baselineFFTValues = new double[bins][numChannels];
this.shortMeanFFTBins = new double[bins][numChannels];
this.shortVarFFTBins = new double[bins][numChannels];
this.rewardFFTBins = new double[bins][numChannels];
this.currentFFTValue = new double[numChannels];
this.maxFFTValue = new double[numChannels];
this.notBrainwaves = new boolean[numChannels];
this.packagePenalty = new int[numChannels];
for (int c = 0; c < numChannels; c++) {
this.maxFFTValue[c] = 1d;
this.currentFFTValue[c] = .01d;
this.meanFFTValue[c] = .5d;
}
</DeepExtract>
} | neurolab-android | positive | 3,892 |
@After
public void tearDown() throws Exception {
if (server != null && server.isRunning()) {
server.stop();
}
} | @After
public void tearDown() throws Exception {
<DeepExtract>
if (server != null && server.isRunning()) {
server.stop();
}
</DeepExtract>
} | Spring-Batch-in-Action | positive | 3,893 |
private void reOpen(Uri path, String name, boolean fromStart) {
if (isInitialized()) {
savePosition();
vPlayer.release();
vPlayer.releaseContext();
}
Intent i = getIntent();
i.putExtra("lockScreen", mMediaController.isLocked());
i.putExtra("startPosition", lastposition);
i.putExtra("fromStart", fromStart);
i.putExtra("displayName", name);
i.setData(path);
Uri dat = getIntentUri(i);
if (dat == null)
resultFinish(RESULT_FAILED);
String datString = dat.toString();
if (!datString.equals(dat.toString()))
dat = Uri.parse(datString);
mUri = dat;
mNeedLock = i.getBooleanExtra("lockScreen", false);
mDisplayName = i.getStringExtra("displayName");
mFromStart = i.getBooleanExtra("fromStart", false);
mSaveUri = i.getBooleanExtra("saveUri", true);
mStartPos = i.getFloatExtra("startPosition", -1.0f);
mLoopCount = i.getIntExtra("loopCount", 1);
mParentId = i.getIntExtra("parentId", 0);
mSubPath = i.getStringExtra("subPath");
mSubShown = i.getBooleanExtra("subShown", true);
mIsHWCodec = i.getBooleanExtra("hwCodec", false);
mUri = path;
if (mViewRoot != null)
mViewRoot.invalidate();
mOpened.set(false);
} | private void reOpen(Uri path, String name, boolean fromStart) {
if (isInitialized()) {
savePosition();
vPlayer.release();
vPlayer.releaseContext();
}
Intent i = getIntent();
i.putExtra("lockScreen", mMediaController.isLocked());
i.putExtra("startPosition", lastposition);
i.putExtra("fromStart", fromStart);
i.putExtra("displayName", name);
i.setData(path);
<DeepExtract>
Uri dat = getIntentUri(i);
if (dat == null)
resultFinish(RESULT_FAILED);
String datString = dat.toString();
if (!datString.equals(dat.toString()))
dat = Uri.parse(datString);
mUri = dat;
mNeedLock = i.getBooleanExtra("lockScreen", false);
mDisplayName = i.getStringExtra("displayName");
mFromStart = i.getBooleanExtra("fromStart", false);
mSaveUri = i.getBooleanExtra("saveUri", true);
mStartPos = i.getFloatExtra("startPosition", -1.0f);
mLoopCount = i.getIntExtra("loopCount", 1);
mParentId = i.getIntExtra("parentId", 0);
mSubPath = i.getStringExtra("subPath");
mSubShown = i.getBooleanExtra("subShown", true);
mIsHWCodec = i.getBooleanExtra("hwCodec", false);
</DeepExtract>
mUri = path;
if (mViewRoot != null)
mViewRoot.invalidate();
mOpened.set(false);
} | BambooPlayer | positive | 3,894 |
public void actionPerformed(ActionEvent evt) {
Rectangle rect = drawingAreaScroll.getViewport().getViewRect();
doZoom(1, new Point(rect.x + rect.width / 2, rect.y + rect.height / 2));
} | public void actionPerformed(ActionEvent evt) {
<DeepExtract>
Rectangle rect = drawingAreaScroll.getViewport().getViewRect();
doZoom(1, new Point(rect.x + rect.width / 2, rect.y + rect.height / 2));
</DeepExtract>
} | micropolis-java | positive | 3,895 |
public void setSurface(Surface surface) {
if (mScreenOnWhilePlaying && surface != null) {
LSLog.e("setScreenOnWhilePlaying(true) is ineffective for Surface");
}
mSurfaceHolder = null;
_setVideoSurface(surface);
if (mSurfaceHolder != null) {
mSurfaceHolder.setKeepScreenOn(mScreenOnWhilePlaying && mStayAwake);
}
} | public void setSurface(Surface surface) {
if (mScreenOnWhilePlaying && surface != null) {
LSLog.e("setScreenOnWhilePlaying(true) is ineffective for Surface");
}
mSurfaceHolder = null;
_setVideoSurface(surface);
<DeepExtract>
if (mSurfaceHolder != null) {
mSurfaceHolder.setKeepScreenOn(mScreenOnWhilePlaying && mStayAwake);
}
</DeepExtract>
} | react-native-camera-continued-shooting | positive | 3,896 |
private List<String> initialSetUpPart() {
this.setUpPart.add(utils.getScriptContent(String.format("templates/%s", "beforeTest.twig")));
this.setUpPart.add("");
return setUpPart;
} | private List<String> initialSetUpPart() {
this.setUpPart.add(utils.getScriptContent(String.format("templates/%s", "beforeTest.twig")));
this.setUpPart.add("");
<DeepExtract>
return setUpPart;
</DeepExtract>
} | SWET | positive | 3,897 |
public Criteria andArticleIdIn(List<Long> values) {
if (values == null) {
throw new RuntimeException("Value for " + "articleId" + " cannot be null");
}
criteria.add(new Criterion("article_id in", values));
return (Criteria) this;
} | public Criteria andArticleIdIn(List<Long> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "articleId" + " cannot be null");
}
criteria.add(new Criterion("article_id in", values));
</DeepExtract>
return (Criteria) this;
} | MyBlog | positive | 3,898 |
@Override
public void clear() {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __X_ISSET_ID, false);
this.x = 0.0;
} | @Override
public void clear() {
<DeepExtract>
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __X_ISSET_ID, false);
</DeepExtract>
this.x = 0.0;
} | tiny-mmo | positive | 3,899 |
public long getInviteCoolDownTime(UUID playerUUID, Location location) {
if (!playerCache.containsKey(playerUUID)) {
try {
final Players player = new Players(plugin, playerUUID);
playerCache.put(playerUUID, player);
} catch (Exception e) {
}
}
return playerCache.get(playerUUID).getInviteCoolDownTime(location);
} | public long getInviteCoolDownTime(UUID playerUUID, Location location) {
<DeepExtract>
if (!playerCache.containsKey(playerUUID)) {
try {
final Players player = new Players(plugin, playerUUID);
playerCache.put(playerUUID, player);
} catch (Exception e) {
}
}
</DeepExtract>
return playerCache.get(playerUUID).getInviteCoolDownTime(location);
} | askyblock | positive | 3,900 |
@Test
void should_read_report_utf8_bom() {
context.settings().setProperty(STYLELINT_REPORT_PATHS, "report-utf8-bom.json");
stylelintReportSensor.execute(context);
Collection<ExternalIssue> externalIssues = context.allExternalIssues();
assertThat(externalIssues).hasSize(2);
} | @Test
void should_read_report_utf8_bom() {
<DeepExtract>
context.settings().setProperty(STYLELINT_REPORT_PATHS, "report-utf8-bom.json");
</DeepExtract>
stylelintReportSensor.execute(context);
Collection<ExternalIssue> externalIssues = context.allExternalIssues();
assertThat(externalIssues).hasSize(2);
} | SonarJS | positive | 3,901 |
public synchronized void insertElementAt(E obj, int index) {
if (index > elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " > " + elementCount);
}
if (elementCount + 1 - elementData.length > 0)
grow(elementCount + 1);
System.arraycopy(elementData, index, elementData, index + 1, elementCount - index);
elementData[index] = obj;
elementCount++;
} | public synchronized void insertElementAt(E obj, int index) {
if (index > elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " > " + elementCount);
}
<DeepExtract>
if (elementCount + 1 - elementData.length > 0)
grow(elementCount + 1);
</DeepExtract>
System.arraycopy(elementData, index, elementData, index + 1, elementCount - index);
elementData[index] = obj;
elementCount++;
} | ProjectStudy | positive | 3,902 |
@Override
protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
_Fields setField;
switch(field.id) {
case 1:
setField = FULL_NAME;
case 2:
setField = GENDER;
case 3:
setField = LOCATION;
default:
setField = null;
}
if (setField != null) {
switch(setField) {
case FULL_NAME:
if (field.type == FULL_NAME_FIELD_DESC.type) {
String full_name;
full_name = iprot.readString();
return full_name;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case GENDER:
if (field.type == GENDER_FIELD_DESC.type) {
GenderType gender;
gender = GenderType.findByValue(iprot.readI32());
return gender;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case LOCATION:
if (field.type == LOCATION_FIELD_DESC.type) {
Location location;
location = new Location();
location.read(iprot);
return location;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
default:
throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
return null;
}
} | @Override
protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
<DeepExtract>
_Fields setField;
switch(field.id) {
case 1:
setField = FULL_NAME;
case 2:
setField = GENDER;
case 3:
setField = LOCATION;
default:
setField = null;
}
</DeepExtract>
if (setField != null) {
switch(setField) {
case FULL_NAME:
if (field.type == FULL_NAME_FIELD_DESC.type) {
String full_name;
full_name = iprot.readString();
return full_name;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case GENDER:
if (field.type == GENDER_FIELD_DESC.type) {
GenderType gender;
gender = GenderType.findByValue(iprot.readI32());
return gender;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case LOCATION:
if (field.type == LOCATION_FIELD_DESC.type) {
Location location;
location = new Location();
location.read(iprot);
return location;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
default:
throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
return null;
}
} | big-data-src | positive | 3,903 |
protected void printDetailed(JavaThing thing) {
if (thing == null) {
out.print("null");
return;
}
if (thing instanceof JavaHeapObject) {
JavaHeapObject ho = (JavaHeapObject) thing;
long id = ho.getId();
if (id != -1L) {
printThingAnchorTag(id);
if (ho.isNew())
out.print("<strong>");
}
Model model = getModelFor(thing, false);
printSummary(model, thing);
if (id != -1) {
if (ho.isNew())
out.print("[new]</strong>");
out.print("</a>");
if (true) {
printDetail(model, ho.getSize(), Integer.MAX_VALUE);
}
}
} else {
print(thing.toString());
}
} | protected void printDetailed(JavaThing thing) {
<DeepExtract>
if (thing == null) {
out.print("null");
return;
}
if (thing instanceof JavaHeapObject) {
JavaHeapObject ho = (JavaHeapObject) thing;
long id = ho.getId();
if (id != -1L) {
printThingAnchorTag(id);
if (ho.isNew())
out.print("<strong>");
}
Model model = getModelFor(thing, false);
printSummary(model, thing);
if (id != -1) {
if (ho.isNew())
out.print("[new]</strong>");
out.print("</a>");
if (true) {
printDetail(model, ho.getSize(), Integer.MAX_VALUE);
}
}
} else {
print(thing.toString());
}
</DeepExtract>
} | fasthat | positive | 3,904 |
private void configureGridView(GridView imageGrid) {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
mNumCols = size.x / COL_WIDTH;
mColWidth = size.x / mNumCols;
imageGrid.setColumnWidth(mColWidth);
imageGrid.setNumColumns(mNumCols);
if (mColWidth > 0)
mColWidth = mColWidth;
} | private void configureGridView(GridView imageGrid) {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
mNumCols = size.x / COL_WIDTH;
mColWidth = size.x / mNumCols;
imageGrid.setColumnWidth(mColWidth);
imageGrid.setNumColumns(mNumCols);
<DeepExtract>
if (mColWidth > 0)
mColWidth = mColWidth;
</DeepExtract>
} | POSA-15 | positive | 3,905 |
private void unregisterStage(Window removedStage) {
if (removedStage.getScene() != null) {
accept(CSSFXEvent.newEvent(EventType.SCENE_REMOVED, removedStage.getScene()));
}
for (Consumer<CSSFXEvent<?>> listener : eventListeners) {
listener.accept(CSSFXEvent.newEvent(EventType.STAGE_REMOVED, removedStage));
}
} | private void unregisterStage(Window removedStage) {
if (removedStage.getScene() != null) {
accept(CSSFXEvent.newEvent(EventType.SCENE_REMOVED, removedStage.getScene()));
}
<DeepExtract>
for (Consumer<CSSFXEvent<?>> listener : eventListeners) {
listener.accept(CSSFXEvent.newEvent(EventType.STAGE_REMOVED, removedStage));
}
</DeepExtract>
} | scenic-view | positive | 3,906 |
@Override
public void onPlayerStateChanged(boolean playWhenReady, int state) {
boolean playWhenReady = player.getPlayWhenReady();
int playbackState = getPlaybackState();
if (lastReportedPlayWhenReady != playWhenReady || lastReportedPlaybackState != playbackState) {
for (Listener listener : listeners) {
listener.onStateChanged(playWhenReady, playbackState);
}
lastReportedPlayWhenReady = playWhenReady;
lastReportedPlaybackState = playbackState;
}
} | @Override
public void onPlayerStateChanged(boolean playWhenReady, int state) {
<DeepExtract>
boolean playWhenReady = player.getPlayWhenReady();
int playbackState = getPlaybackState();
if (lastReportedPlayWhenReady != playWhenReady || lastReportedPlaybackState != playbackState) {
for (Listener listener : listeners) {
listener.onStateChanged(playWhenReady, playbackState);
}
lastReportedPlayWhenReady = playWhenReady;
lastReportedPlaybackState = playbackState;
}
</DeepExtract>
} | ijkplayer-android-demo | positive | 3,907 |
public Builder mergeFrom(com.deep007.mitmproxyjava.MitmproxyStopRequest other) {
if (other == com.deep007.mitmproxyjava.MitmproxyStopRequest.getDefaultInstance())
return this;
if (!other.getMitmproxyId().isEmpty()) {
mitmproxyId_ = other.mitmproxyId_;
onChanged();
}
return super.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
} | public Builder mergeFrom(com.deep007.mitmproxyjava.MitmproxyStopRequest other) {
if (other == com.deep007.mitmproxyjava.MitmproxyStopRequest.getDefaultInstance())
return this;
if (!other.getMitmproxyId().isEmpty()) {
mitmproxyId_ = other.mitmproxyId_;
onChanged();
}
<DeepExtract>
return super.mergeUnknownFields(other.unknownFields);
</DeepExtract>
onChanged();
return this;
} | mitmproxy-java | positive | 3,908 |
public Criteria andPermissionnameEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "permissionname" + " cannot be null");
}
criteria.add(new Criterion("permissionName =", value));
return (Criteria) this;
} | public Criteria andPermissionnameEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "permissionname" + " cannot be null");
}
criteria.add(new Criterion("permissionName =", value));
</DeepExtract>
return (Criteria) this;
} | songjhh_blog | positive | 3,909 |
private void attempt() throws Exception {
loggerRule = new LoggerRule();
loggerRule.recordPackage(CheckNewHardStrategy.class, Level.INFO).capture(10);
computer.console = console;
computer.state = state;
if (changeHostKey) {
Container.ExecResult removeResult = conRule.execInContainer("sh", "-c", "rm -f /etc/ssh/ssh_host_*");
assertThat(removeResult.getStderr(), emptyString());
assertThat(removeResult.getStdout(), emptyString());
Container.ExecResult regenResult = conRule.execInContainer("ssh-keygen", "-A");
assertThat(regenResult.getStderr(), emptyString());
}
try {
Connection con = conRule.connect(verifier);
con.close();
} catch (IOException ignored) {
}
if (isOfflineByKey) {
assertThat(String.format("Stage %d. isOffline failed on %s using %s strategy", stage, computer.getName(), verifier.strategy.getClass().getSimpleName()), computer.isOffline(), is(true));
assertThat(String.format("Stage %d. Offline reason failed on %s using %s strategy", stage, computer.getName(), verifier.strategy.getClass().getSimpleName()), computer.getOfflineCauseReason(), is(Messages.OfflineCause_SSHKeyCheckFailed()));
}
for (String messageInLog : messagesInLog) {
assertThat(String.format("Stage %d. Log message not found on %s using %s strategy", stage, computer.getName(), verifier.strategy.getClass().getSimpleName()), loggerRule, LoggerRule.recorded(StringContains.containsString(messageInLog)));
}
} | private void attempt() throws Exception {
loggerRule = new LoggerRule();
loggerRule.recordPackage(CheckNewHardStrategy.class, Level.INFO).capture(10);
computer.console = console;
computer.state = state;
if (changeHostKey) {
Container.ExecResult removeResult = conRule.execInContainer("sh", "-c", "rm -f /etc/ssh/ssh_host_*");
assertThat(removeResult.getStderr(), emptyString());
assertThat(removeResult.getStdout(), emptyString());
Container.ExecResult regenResult = conRule.execInContainer("ssh-keygen", "-A");
assertThat(regenResult.getStderr(), emptyString());
}
try {
Connection con = conRule.connect(verifier);
con.close();
} catch (IOException ignored) {
}
<DeepExtract>
if (isOfflineByKey) {
assertThat(String.format("Stage %d. isOffline failed on %s using %s strategy", stage, computer.getName(), verifier.strategy.getClass().getSimpleName()), computer.isOffline(), is(true));
assertThat(String.format("Stage %d. Offline reason failed on %s using %s strategy", stage, computer.getName(), verifier.strategy.getClass().getSimpleName()), computer.getOfflineCauseReason(), is(Messages.OfflineCause_SSHKeyCheckFailed()));
}
for (String messageInLog : messagesInLog) {
assertThat(String.format("Stage %d. Log message not found on %s using %s strategy", stage, computer.getName(), verifier.strategy.getClass().getSimpleName()), loggerRule, LoggerRule.recorded(StringContains.containsString(messageInLog)));
}
</DeepExtract>
} | ec2-plugin | positive | 3,910 |
public void FinishCoffee() {
System.out.println("After 5 minutes!");
System.out.println("Coffee is ok!");
this.GetMediator().GetMessage(0, this.name);
} | public void FinishCoffee() {
System.out.println("After 5 minutes!");
System.out.println("Coffee is ok!");
<DeepExtract>
this.GetMediator().GetMessage(0, this.name);
</DeepExtract>
} | learnforJava_DesignPattern | positive | 3,911 |
private static Bitmap loadScaledBitmap(File source, int targetWidth, int targetHeight) throws Utils.ApplicationError {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(source.getAbsolutePath(), options);
options.inJustDecodeBounds = false;
int inSampleSize = 1;
while (options.outWidth > targetWidth || options.outHeight > targetHeight) {
inSampleSize *= 2;
options.outWidth /= 2;
options.outHeight /= 2;
}
return inSampleSize;
try {
Bitmap bitmap = BitmapFactory.decodeFile(source.getAbsolutePath(), options);
if (bitmap == null) {
throw new Utils.ApplicationError(LOG_TAG, "cannot decode image");
}
return bitmap;
} catch (OutOfMemoryError e) {
throw new Utils.ApplicationError(LOG_TAG, "out of memory error");
}
} | private static Bitmap loadScaledBitmap(File source, int targetWidth, int targetHeight) throws Utils.ApplicationError {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(source.getAbsolutePath(), options);
options.inJustDecodeBounds = false;
int inSampleSize = 1;
while (options.outWidth > targetWidth || options.outHeight > targetHeight) {
inSampleSize *= 2;
options.outWidth /= 2;
options.outHeight /= 2;
}
return inSampleSize;
<DeepExtract>
try {
Bitmap bitmap = BitmapFactory.decodeFile(source.getAbsolutePath(), options);
if (bitmap == null) {
throw new Utils.ApplicationError(LOG_TAG, "cannot decode image");
}
return bitmap;
} catch (OutOfMemoryError e) {
throw new Utils.ApplicationError(LOG_TAG, "out of memory error");
}
</DeepExtract>
} | ploggy | positive | 3,912 |
public Criteria andUserMessageNotBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "userMessage" + " cannot be null");
}
criteria.add(new Criterion("userMessage not between", value1, value2));
return (Criteria) this;
} | public Criteria andUserMessageNotBetween(String value1, String value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "userMessage" + " cannot be null");
}
criteria.add(new Criterion("userMessage not between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | Gotrip | positive | 3,913 |
public Criteria andCompanyNameNotIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "companyName" + " cannot be null");
}
criteria.add(new Criterion("company_name not in", values));
return (Criteria) this;
} | public Criteria andCompanyNameNotIn(List<String> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "companyName" + " cannot be null");
}
criteria.add(new Criterion("company_name not in", values));
</DeepExtract>
return (Criteria) this;
} | Whome | positive | 3,914 |
@Override
public <T> T[] toArray(T[] a) {
mapping.entrySet().forEach(each -> getAndCheckExpire(each.getKey()));
return backingMap.mapping.values().toArray(a);
} | @Override
public <T> T[] toArray(T[] a) {
<DeepExtract>
mapping.entrySet().forEach(each -> getAndCheckExpire(each.getKey()));
</DeepExtract>
return backingMap.mapping.values().toArray(a);
} | InteractiveChat | positive | 3,915 |
public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
try {
stream = new ByteStream(out, (byte) 0x88);
if (UPLOAD_METHOD_SERIAL.equals(uploadMethod)) {
char[] inbuf = new char[16];
stream.hex("DA000004");
in.read(inbuf);
}
} catch (Exception e) {
pl.taskChanged(this, "Fail: " + e.getMessage());
throw e;
}
int len = "D812".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("D812".charAt(i), 16) << 4) + Character.digit("D812".charAt(i + 1), 16));
write(value);
}
return this;
int len = "F0".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("F0".charAt(i), 16) << 4) + Character.digit("F0".charAt(i + 1), 16));
write(value);
}
return this;
int len = "00".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("00".charAt(i), 16) << 4) + Character.digit("00".charAt(i + 1), 16));
write(value);
}
return this;
int len = "F10200".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("F10200".charAt(i), 16) << 4) + Character.digit("F10200".charAt(i + 1), 16));
write(value);
}
return this;
int len = "D800".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("D800".charAt(i), 16) << 4) + Character.digit("D800".charAt(i + 1), 16));
write(value);
}
return this;
return longint((long) (job.getStartY() * 1000.0));
double minX = 0.0;
double minY = 0.0;
double maxX = 0.0;
double maxY = 0.0;
boolean first = true;
for (JobPart p : job.getParts()) {
double min_x = Util.px2mm(p.getMinX(), p.getDPI());
double min_y = Util.px2mm(p.getMinY(), p.getDPI());
double max_x = Util.px2mm(p.getMaxX(), p.getDPI());
double max_y = Util.px2mm(p.getMaxY(), p.getDPI());
if (first) {
minX = min_x;
maxX = max_x;
minY = min_y;
maxY = max_y;
first = false;
} else {
if (min_x < minX) {
minX = min_x;
}
if (max_x > maxX) {
maxX = max_x;
}
if (min_y < minY) {
minY = min_y;
}
if (max_y > maxY) {
maxY = max_y;
}
}
}
stream.hex("E703").absoluteMM(minX).absoluteMM(minY);
stream.hex("E707").absoluteMM(maxX).absoluteMM(maxY);
stream.hex("E750").absoluteMM(minX).absoluteMM(minY);
stream.hex("E751").absoluteMM(maxX).absoluteMM(maxY);
stream.hex("E7040001000100000000000000000000");
stream.hex("E70500");
int part_number = 0;
write((byte) (job.getParts().size() - 1 & 0xff));
return this;
boolean first_prop = true;
boolean first_vector = true;
for (JobPart p : job.getParts()) {
float focus;
if ((p instanceof RasterPart) || (p instanceof Raster3dPart)) {
p = convertRasterizableToVectorPart((RasterizableJobPart) p, job, this.useBidirectionalRastering, true, true);
}
if (p instanceof VectorPart) {
double top_left_x = Util.px2mm(p.getMinX(), p.getDPI());
double top_left_y = Util.px2mm(p.getMinY(), p.getDPI());
double bottom_right_x = Util.px2mm(p.getMaxX(), p.getDPI());
double bottom_right_y = Util.px2mm(p.getMaxY(), p.getDPI());
stream.hex("E752").byteint(part_number).absoluteMM(top_left_x).absoluteMM(top_left_y);
stream.hex("E753").byteint(part_number).absoluteMM(bottom_right_x).absoluteMM(bottom_right_y);
stream.hex("E761").byteint(part_number).absoluteMM(top_left_x).absoluteMM(top_left_y);
stream.hex("E762").byteint(part_number).absoluteMM(bottom_right_x).absoluteMM(bottom_right_y);
VectorPart vp = (VectorPart) p;
for (VectorCommand cmd : vp.getCommandList()) {
switch(cmd.getType()) {
case LINETO:
case MOVETO:
{
if (first_vector) {
first_vector = false;
stream.hex("ca0100");
stream.hex("ca02").byteint(part_number);
stream.hex("ca0113");
stream.hex("c902").longint((int) currentSpeed);
stream.hex("c601").percent((int) currentMinPower);
stream.hex("c602").percent((int) currentMaxPower);
stream.hex("ca030f");
stream.hex("ca1000");
}
vector(cmd.getX(), cmd.getY(), p.getDPI(), cmd.getType() == CmdType.LINETO);
break;
}
case SETPROPERTY:
{
LaserProperty pr = cmd.getProperty();
FloatMinMaxPowerSpeedFrequencyProperty prop = (FloatMinMaxPowerSpeedFrequencyProperty) pr;
if (first_prop) {
first_prop = false;
currentMinPower = cmd_layer_percent("c631", part_number, currentMinPower, prop.getMinPower());
currentMaxPower = cmd_layer_percent("c632", part_number, currentMaxPower, prop.getPower());
currentSpeed = cmd_layer_absoluteMM("c904", part_number, currentSpeed, prop.getSpeed());
stream.hex("c660").byteint(part_number).hex("00").longint(prop.getFrequency());
long color = (0 << 16) + (0 << 8) + 100;
;
stream.hex("ca06").byteint(part_number).longint(color);
stream.hex("ca41").byteint(part_number).byteint(0);
} else {
currentMinPower = cmd_percent("c601", currentMinPower, prop.getMinPower());
currentMaxPower = cmd_percent("c602", currentMaxPower, prop.getPower());
currentSpeed = cmd_absoluteMM("c902", currentSpeed, prop.getSpeed());
}
break;
}
default:
{
System.out.println("*** Ruida unknown vector part(" + cmd.getType() + ")");
}
}
}
}
}
long mask = 0x7f0000000L;
for (int i = 0; i <= 4; i++) {
this.byteint((int) ((travel_distance & mask) >> ((4 - i) * 7)));
mask = mask >> 7;
}
return this;
int len = "EB".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("EB".charAt(i), 16) << 4) + Character.digit("EB".charAt(i + 1), 16));
write(value);
}
return this;
int len = "E700".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("E700".charAt(i), 16) << 4) + Character.digit("E700".charAt(i + 1), 16));
write(value);
}
return this;
int len = "D7".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("D7".charAt(i), 16) << 4) + Character.digit("D7".charAt(i + 1), 16));
write(value);
}
return this;
} | public void writeJobCode(LaserJob job, ProgressListener pl) throws IOException {
try {
stream = new ByteStream(out, (byte) 0x88);
if (UPLOAD_METHOD_SERIAL.equals(uploadMethod)) {
char[] inbuf = new char[16];
stream.hex("DA000004");
in.read(inbuf);
}
} catch (Exception e) {
pl.taskChanged(this, "Fail: " + e.getMessage());
throw e;
}
int len = "D812".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("D812".charAt(i), 16) << 4) + Character.digit("D812".charAt(i + 1), 16));
write(value);
}
return this;
int len = "F0".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("F0".charAt(i), 16) << 4) + Character.digit("F0".charAt(i + 1), 16));
write(value);
}
return this;
int len = "00".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("00".charAt(i), 16) << 4) + Character.digit("00".charAt(i + 1), 16));
write(value);
}
return this;
int len = "F10200".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("F10200".charAt(i), 16) << 4) + Character.digit("F10200".charAt(i + 1), 16));
write(value);
}
return this;
int len = "D800".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("D800".charAt(i), 16) << 4) + Character.digit("D800".charAt(i + 1), 16));
write(value);
}
return this;
return longint((long) (job.getStartY() * 1000.0));
double minX = 0.0;
double minY = 0.0;
double maxX = 0.0;
double maxY = 0.0;
boolean first = true;
for (JobPart p : job.getParts()) {
double min_x = Util.px2mm(p.getMinX(), p.getDPI());
double min_y = Util.px2mm(p.getMinY(), p.getDPI());
double max_x = Util.px2mm(p.getMaxX(), p.getDPI());
double max_y = Util.px2mm(p.getMaxY(), p.getDPI());
if (first) {
minX = min_x;
maxX = max_x;
minY = min_y;
maxY = max_y;
first = false;
} else {
if (min_x < minX) {
minX = min_x;
}
if (max_x > maxX) {
maxX = max_x;
}
if (min_y < minY) {
minY = min_y;
}
if (max_y > maxY) {
maxY = max_y;
}
}
}
stream.hex("E703").absoluteMM(minX).absoluteMM(minY);
stream.hex("E707").absoluteMM(maxX).absoluteMM(maxY);
stream.hex("E750").absoluteMM(minX).absoluteMM(minY);
stream.hex("E751").absoluteMM(maxX).absoluteMM(maxY);
stream.hex("E7040001000100000000000000000000");
stream.hex("E70500");
int part_number = 0;
write((byte) (job.getParts().size() - 1 & 0xff));
return this;
boolean first_prop = true;
boolean first_vector = true;
for (JobPart p : job.getParts()) {
float focus;
if ((p instanceof RasterPart) || (p instanceof Raster3dPart)) {
p = convertRasterizableToVectorPart((RasterizableJobPart) p, job, this.useBidirectionalRastering, true, true);
}
if (p instanceof VectorPart) {
double top_left_x = Util.px2mm(p.getMinX(), p.getDPI());
double top_left_y = Util.px2mm(p.getMinY(), p.getDPI());
double bottom_right_x = Util.px2mm(p.getMaxX(), p.getDPI());
double bottom_right_y = Util.px2mm(p.getMaxY(), p.getDPI());
stream.hex("E752").byteint(part_number).absoluteMM(top_left_x).absoluteMM(top_left_y);
stream.hex("E753").byteint(part_number).absoluteMM(bottom_right_x).absoluteMM(bottom_right_y);
stream.hex("E761").byteint(part_number).absoluteMM(top_left_x).absoluteMM(top_left_y);
stream.hex("E762").byteint(part_number).absoluteMM(bottom_right_x).absoluteMM(bottom_right_y);
VectorPart vp = (VectorPart) p;
for (VectorCommand cmd : vp.getCommandList()) {
switch(cmd.getType()) {
case LINETO:
case MOVETO:
{
if (first_vector) {
first_vector = false;
stream.hex("ca0100");
stream.hex("ca02").byteint(part_number);
stream.hex("ca0113");
stream.hex("c902").longint((int) currentSpeed);
stream.hex("c601").percent((int) currentMinPower);
stream.hex("c602").percent((int) currentMaxPower);
stream.hex("ca030f");
stream.hex("ca1000");
}
vector(cmd.getX(), cmd.getY(), p.getDPI(), cmd.getType() == CmdType.LINETO);
break;
}
case SETPROPERTY:
{
LaserProperty pr = cmd.getProperty();
FloatMinMaxPowerSpeedFrequencyProperty prop = (FloatMinMaxPowerSpeedFrequencyProperty) pr;
if (first_prop) {
first_prop = false;
currentMinPower = cmd_layer_percent("c631", part_number, currentMinPower, prop.getMinPower());
currentMaxPower = cmd_layer_percent("c632", part_number, currentMaxPower, prop.getPower());
currentSpeed = cmd_layer_absoluteMM("c904", part_number, currentSpeed, prop.getSpeed());
stream.hex("c660").byteint(part_number).hex("00").longint(prop.getFrequency());
long color = (0 << 16) + (0 << 8) + 100;
;
stream.hex("ca06").byteint(part_number).longint(color);
stream.hex("ca41").byteint(part_number).byteint(0);
} else {
currentMinPower = cmd_percent("c601", currentMinPower, prop.getMinPower());
currentMaxPower = cmd_percent("c602", currentMaxPower, prop.getPower());
currentSpeed = cmd_absoluteMM("c902", currentSpeed, prop.getSpeed());
}
break;
}
default:
{
System.out.println("*** Ruida unknown vector part(" + cmd.getType() + ")");
}
}
}
}
}
long mask = 0x7f0000000L;
for (int i = 0; i <= 4; i++) {
this.byteint((int) ((travel_distance & mask) >> ((4 - i) * 7)));
mask = mask >> 7;
}
return this;
int len = "EB".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("EB".charAt(i), 16) << 4) + Character.digit("EB".charAt(i + 1), 16));
write(value);
}
return this;
int len = "E700".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("E700".charAt(i), 16) << 4) + Character.digit("E700".charAt(i + 1), 16));
write(value);
}
return this;
<DeepExtract>
int len = "D7".length();
for (int i = 0; i < len; i += 2) {
byte value = (byte) ((Character.digit("D7".charAt(i), 16) << 4) + Character.digit("D7".charAt(i + 1), 16));
write(value);
}
return this;
</DeepExtract>
} | LibLaserCut | positive | 3,916 |
public static boolean isNativeMode() throws Exception {
loadSQLiteNativeLibrary();
return extracted;
return extracted;
} | public static boolean isNativeMode() throws Exception {
<DeepExtract>
loadSQLiteNativeLibrary();
return extracted;
</DeepExtract>
return extracted;
} | spatialite4-jdbc | positive | 3,917 |
public void setSalePositions(final Collection<SalePosition> positions) {
this.salePositions.clear();
if (isNotEmpty(positions)) {
positions.forEach(this::addSalePosition);
}
} | public void setSalePositions(final Collection<SalePosition> positions) {
this.salePositions.clear();
<DeepExtract>
if (isNotEmpty(positions)) {
positions.forEach(this::addSalePosition);
}
</DeepExtract>
} | AlexCoffee | positive | 3,918 |
public String getContextId() {
StringBuilder sb = new StringBuilder();
sb.append("d=").append(docId).append(",st=").append(sentenceId).append(",f=").append(firstTok).append(",l=").append(lastTok);
return getContextId();
} | public String getContextId() {
StringBuilder sb = new StringBuilder();
sb.append("d=").append(docId).append(",st=").append(sentenceId).append(",f=").append(firstTok).append(",l=").append(lastTok);
<DeepExtract>
return getContextId();
</DeepExtract>
} | jate | positive | 3,919 |
public Criteria andAllpriceLessThan(Double value) {
if (value == null) {
throw new RuntimeException("Value for " + "allprice" + " cannot be null");
}
criteria.add(new Criterion("allPrice <", value));
return (Criteria) this;
} | public Criteria andAllpriceLessThan(Double value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "allprice" + " cannot be null");
}
criteria.add(new Criterion("allPrice <", value));
</DeepExtract>
return (Criteria) this;
} | garbage-collection | positive | 3,920 |
@Override
public void onInit() {
super.onInit();
mGLUniformColorLevels = GLES20.glGetUniformLocation(getProgram(), "colorLevels");
mColorLevels = mColorLevels;
setFloat(mGLUniformColorLevels, mColorLevels);
} | @Override
public void onInit() {
super.onInit();
mGLUniformColorLevels = GLES20.glGetUniformLocation(getProgram(), "colorLevels");
<DeepExtract>
mColorLevels = mColorLevels;
setFloat(mGLUniformColorLevels, mColorLevels);
</DeepExtract>
} | android-instagram-image-filter | positive | 3,921 |
@Subscribe
public void onSignIn(@NonNull AuthState.SignedIn event) {
Log.d(TAG, "User signed in, uploading queued tracks");
Services.tasks.removeType(TaskType.trackUpload);
if (AuthState.getUser() != null) {
for (TrackFile track : Services.tracks.local.getLocalTracks()) {
Services.tasks.add(new UploadTrackTask(track));
}
}
} | @Subscribe
public void onSignIn(@NonNull AuthState.SignedIn event) {
Log.d(TAG, "User signed in, uploading queued tracks");
<DeepExtract>
Services.tasks.removeType(TaskType.trackUpload);
if (AuthState.getUser() != null) {
for (TrackFile track : Services.tracks.local.getLocalTracks()) {
Services.tasks.add(new UploadTrackTask(track));
}
}
</DeepExtract>
} | BASElineFlightComputer | positive | 3,922 |
public void dispose() {
_coord = null;
if (_edges != null) {
_edges.clear();
_edges = null;
}
if (_edgeOrientations != null) {
_edgeOrientations.clear();
_edgeOrientations = null;
}
if (_region != null) {
_region.clear();
_region = null;
}
_pool.push(this);
} | public void dispose() {
_coord = null;
<DeepExtract>
if (_edges != null) {
_edges.clear();
_edges = null;
}
if (_edgeOrientations != null) {
_edgeOrientations.clear();
_edgeOrientations = null;
}
if (_region != null) {
_region.clear();
_region = null;
}
</DeepExtract>
_pool.push(this);
} | nortantis | positive | 3,923 |
@Override
public void setValue(int[] value) {
this.values[0] = value[0];
this.values[1] = value[1];
if (true || valid) {
long longValue = DataTypeTools.LongFromIntegers(values[0], values[1]);
doubleTextBox.setText(DataTypeTools.formatLong(longValue, true, registerViewSettings.getNumberFormat().getRadix()));
}
if (true && !valid) {
setValid(true);
}
} | @Override
public void setValue(int[] value) {
this.values[0] = value[0];
this.values[1] = value[1];
<DeepExtract>
if (true || valid) {
long longValue = DataTypeTools.LongFromIntegers(values[0], values[1]);
doubleTextBox.setText(DataTypeTools.formatLong(longValue, true, registerViewSettings.getNumberFormat().getRadix()));
}
if (true && !valid) {
setValid(true);
}
</DeepExtract>
} | nevada | positive | 3,924 |
@Test
public void shouldSearchTrajStationMdMn() throws Exception {
ObjTrajectory traj = new ObjTrajectory();
traj.setUid("traj-search");
String query = traj.getXMLString("1.4.1.1");
ObjTrajectorys trajectorysQuery = WitsmlMarshal.deserialize(query, ObjTrajectorys.class);
ObjTrajectory singularTrajectoryQuery = trajectorysQuery.getTrajectory().get(0);
singularTrajectoryQuery.setName("traj-search");
com.hashmapinc.tempus.WitsmlObjects.v1411.MeasuredDepthCoord mDMnMeasuredDepth = new com.hashmapinc.tempus.WitsmlObjects.v1411.MeasuredDepthCoord();
com.hashmapinc.tempus.WitsmlObjects.v1411.MeasuredDepthCoord mDMxmeasuredDepth = new com.hashmapinc.tempus.WitsmlObjects.v1411.MeasuredDepthCoord();
mDMnMeasuredDepth.setValue(500.0);
singularTrajectoryQuery.setMdMn(mDMnMeasuredDepth);
mDMxmeasuredDepth.setValue(null);
singularTrajectoryQuery.setMdMx(mDMxmeasuredDepth);
List<AbstractWitsmlObject> wmlObjectsQuery = new ArrayList<>();
wmlObjectsQuery.add(singularTrajectoryQuery);
QueryContext qc = new QueryContext("1.4.1.1", "trajectory", null, query, wmlObjectsQuery, "goodUsername", "goodPassword", "shouldSearchTrajectoryCaseA");
assertEquals(true, this.valve.trajHasSearchQueryArgs(qc));
} | @Test
public void shouldSearchTrajStationMdMn() throws Exception {
ObjTrajectory traj = new ObjTrajectory();
traj.setUid("traj-search");
String query = traj.getXMLString("1.4.1.1");
ObjTrajectorys trajectorysQuery = WitsmlMarshal.deserialize(query, ObjTrajectorys.class);
ObjTrajectory singularTrajectoryQuery = trajectorysQuery.getTrajectory().get(0);
singularTrajectoryQuery.setName("traj-search");
<DeepExtract>
com.hashmapinc.tempus.WitsmlObjects.v1411.MeasuredDepthCoord mDMnMeasuredDepth = new com.hashmapinc.tempus.WitsmlObjects.v1411.MeasuredDepthCoord();
com.hashmapinc.tempus.WitsmlObjects.v1411.MeasuredDepthCoord mDMxmeasuredDepth = new com.hashmapinc.tempus.WitsmlObjects.v1411.MeasuredDepthCoord();
mDMnMeasuredDepth.setValue(500.0);
singularTrajectoryQuery.setMdMn(mDMnMeasuredDepth);
mDMxmeasuredDepth.setValue(null);
singularTrajectoryQuery.setMdMx(mDMxmeasuredDepth);
List<AbstractWitsmlObject> wmlObjectsQuery = new ArrayList<>();
wmlObjectsQuery.add(singularTrajectoryQuery);
QueryContext qc = new QueryContext("1.4.1.1", "trajectory", null, query, wmlObjectsQuery, "goodUsername", "goodPassword", "shouldSearchTrajectoryCaseA");
assertEquals(true, this.valve.trajHasSearchQueryArgs(qc));
</DeepExtract>
} | Drillflow | positive | 3,925 |
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
setDrawBounds(bounds.left, bounds.top, bounds.right, bounds.bottom);
} | @Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
<DeepExtract>
setDrawBounds(bounds.left, bounds.top, bounds.right, bounds.bottom);
</DeepExtract>
} | XKnife-Android | positive | 3,926 |
public void schedule() {
if (jobs.isEmpty())
return;
Job j = jobs.delMax();
Processor minp = procs.min();
while (!minp.isAvailable()) {
for (Processor p : procs) {
p.process();
}
minp = procs.min();
}
minp = procs.delMin();
jobs.addLast(j);
procs.insert(minp);
} | public void schedule() {
if (jobs.isEmpty())
return;
Job j = jobs.delMax();
Processor minp = procs.min();
while (!minp.isAvailable()) {
for (Processor p : procs) {
p.process();
}
minp = procs.min();
}
minp = procs.delMin();
<DeepExtract>
jobs.addLast(j);
</DeepExtract>
procs.insert(minp);
} | Algorithms | positive | 3,927 |
@Override
public StateEntry<K, N, S> next() {
Node nodeStorage = getNodeSegmentAndOffset(nodeIter.next());
MemorySegment segment = nodeStorage.nodeSegment;
int offsetInSegment = nodeStorage.nodeOffset;
int level = SkipListUtils.getLevel(segment, offsetInSegment);
int keyDataLen = SkipListUtils.getKeyLen(segment, offsetInSegment);
int keyDataOffset = offsetInSegment + SkipListUtils.getKeyDataOffset(level);
K key = skipListKeySerializer.deserializeKey(segment, keyDataOffset, keyDataLen);
N namespace = skipListKeySerializer.deserializeNamespace(segment, keyDataOffset, keyDataLen);
long valuePointer = SkipListUtils.getValuePointer(segment, offsetInSegment);
S state = helpGetState(valuePointer);
return new StateEntry.SimpleStateEntry<>(key, namespace, state);
} | @Override
public StateEntry<K, N, S> next() {
<DeepExtract>
Node nodeStorage = getNodeSegmentAndOffset(nodeIter.next());
MemorySegment segment = nodeStorage.nodeSegment;
int offsetInSegment = nodeStorage.nodeOffset;
int level = SkipListUtils.getLevel(segment, offsetInSegment);
int keyDataLen = SkipListUtils.getKeyLen(segment, offsetInSegment);
int keyDataOffset = offsetInSegment + SkipListUtils.getKeyDataOffset(level);
K key = skipListKeySerializer.deserializeKey(segment, keyDataOffset, keyDataLen);
N namespace = skipListKeySerializer.deserializeNamespace(segment, keyDataOffset, keyDataLen);
long valuePointer = SkipListUtils.getValuePointer(segment, offsetInSegment);
S state = helpGetState(valuePointer);
return new StateEntry.SimpleStateEntry<>(key, namespace, state);
</DeepExtract>
} | flink-spillable-statebackend | positive | 3,928 |
@Override
public int[] encodePosition(Location l, int[] positionBits, double[] lowerBounds, double[] upperBounds) {
int[] pos = new int[npos];
if (l.getOrdinate(0).floatValue() < lowerBounds[0])
pos[0] = 0;
int maxval = (int) (Math.pow(2, positionBits[0]) - 1);
if (l.getOrdinate(0).floatValue() >= upperBounds[0])
pos[0] = maxval;
return (int) ((l.getOrdinate(0).floatValue() - lowerBounds[0]) * ((maxval - 0) / (upperBounds[0] - lowerBounds[0])));
if (l.getOrdinate(1).floatValue() < lowerBounds[1])
pos[1] = 0;
int maxval = (int) (Math.pow(2, positionBits[1]) - 1);
if (l.getOrdinate(1).floatValue() >= upperBounds[1])
pos[1] = maxval;
return (int) ((l.getOrdinate(1).floatValue() - lowerBounds[1]) * ((maxval - 0) / (upperBounds[1] - lowerBounds[1])));
if (l instanceof AffineSimulationKeypointLocation) {
pos[2] = encode(l.getOrdinate(4).floatValue(), lowerBounds[2], upperBounds[2], positionBits[2]);
pos[3] = encode(l.getOrdinate(5).floatValue(), lowerBounds[3], upperBounds[3], positionBits[3]);
}
return pos;
} | @Override
public int[] encodePosition(Location l, int[] positionBits, double[] lowerBounds, double[] upperBounds) {
int[] pos = new int[npos];
if (l.getOrdinate(0).floatValue() < lowerBounds[0])
pos[0] = 0;
int maxval = (int) (Math.pow(2, positionBits[0]) - 1);
if (l.getOrdinate(0).floatValue() >= upperBounds[0])
pos[0] = maxval;
return (int) ((l.getOrdinate(0).floatValue() - lowerBounds[0]) * ((maxval - 0) / (upperBounds[0] - lowerBounds[0])));
<DeepExtract>
if (l.getOrdinate(1).floatValue() < lowerBounds[1])
pos[1] = 0;
int maxval = (int) (Math.pow(2, positionBits[1]) - 1);
if (l.getOrdinate(1).floatValue() >= upperBounds[1])
pos[1] = maxval;
return (int) ((l.getOrdinate(1).floatValue() - lowerBounds[1]) * ((maxval - 0) / (upperBounds[1] - lowerBounds[1])));
</DeepExtract>
if (l instanceof AffineSimulationKeypointLocation) {
pos[2] = encode(l.getOrdinate(4).floatValue(), lowerBounds[2], upperBounds[2], positionBits[2]);
pos[3] = encode(l.getOrdinate(5).floatValue(), lowerBounds[3], upperBounds[3], positionBits[3]);
}
return pos;
} | imageterrier | positive | 3,929 |
public static profileservice.proxies.Company load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException {
com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier);
return profileservice.proxies.Company.load(context, mendixObject);
} | public static profileservice.proxies.Company load(com.mendix.systemwideinterfaces.core.IContext context, com.mendix.systemwideinterfaces.core.IMendixIdentifier mendixIdentifier) throws com.mendix.core.CoreException {
com.mendix.systemwideinterfaces.core.IMendixObject mendixObject = com.mendix.core.Core.retrieveId(context, mendixIdentifier);
<DeepExtract>
return profileservice.proxies.Company.load(context, mendixObject);
</DeepExtract>
} | QueryApiBlogPost | positive | 3,930 |
public Builder mergeFrom(com.gnuradar.proto.Status.StatusMessage other) {
if (other == com.gnuradar.proto.Status.StatusMessage.getDefaultInstance())
return this;
if (other.hasName()) {
bitField0_ |= 0x00000001;
name_ = other.name_;
onChanged();
}
if (other.hasHead()) {
setHead(other.getHead());
}
if (other.hasTail()) {
setTail(other.getTail());
}
if (other.hasDepth()) {
setDepth(other.getDepth());
}
if (other.hasOverFlow()) {
setOverFlow(other.getOverFlow());
}
if (other.hasBytesPerBuffer()) {
setBytesPerBuffer(other.getBytesPerBuffer());
}
return super.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
} | public Builder mergeFrom(com.gnuradar.proto.Status.StatusMessage other) {
if (other == com.gnuradar.proto.Status.StatusMessage.getDefaultInstance())
return this;
if (other.hasName()) {
bitField0_ |= 0x00000001;
name_ = other.name_;
onChanged();
}
if (other.hasHead()) {
setHead(other.getHead());
}
if (other.hasTail()) {
setTail(other.getTail());
}
if (other.hasDepth()) {
setDepth(other.getDepth());
}
if (other.hasOverFlow()) {
setOverFlow(other.getOverFlow());
}
if (other.hasBytesPerBuffer()) {
setBytesPerBuffer(other.getBytesPerBuffer());
}
<DeepExtract>
return super.mergeUnknownFields(other.unknownFields);
</DeepExtract>
onChanged();
return this;
} | GnuRadar | positive | 3,931 |
public void updateSummary() {
if (KEY_DEFAULT_NAME.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_DEFAULT_NAME).setSummary(val);
} else if (KEY_DEFAULT_NAME.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_DEFAULT_NAME).setSummary(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "") + " MB");
} else if (KEY_DEFAULT_NAME.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_DEFAULT_NAME).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "")))]);
} else if (KEY_DEFAULT_NAME.equals(KEY_TEXT_SZ)) {
findPreference(KEY_DEFAULT_NAME).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "")))]);
} else if (KEY_DEFAULT_NAME.equals(KEY_REPLIES)) {
findPreference(KEY_DEFAULT_NAME).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "")))]);
} else {
findPreference(KEY_DEFAULT_NAME).setSummary(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, ""));
}
if (KEY_DEFAULT_EMAIL.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_DEFAULT_EMAIL).setSummary(val);
} else if (KEY_DEFAULT_EMAIL.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_DEFAULT_EMAIL).setSummary(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "") + " MB");
} else if (KEY_DEFAULT_EMAIL.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_DEFAULT_EMAIL).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "")))]);
} else if (KEY_DEFAULT_EMAIL.equals(KEY_TEXT_SZ)) {
findPreference(KEY_DEFAULT_EMAIL).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "")))]);
} else if (KEY_DEFAULT_EMAIL.equals(KEY_REPLIES)) {
findPreference(KEY_DEFAULT_EMAIL).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "")))]);
} else {
findPreference(KEY_DEFAULT_EMAIL).setSummary(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, ""));
}
if (KEY_INTERVAL.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_INTERVAL).setSummary(val);
} else if (KEY_INTERVAL.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_INTERVAL).setSummary(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0") + " MB");
} else if (KEY_INTERVAL.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_INTERVAL).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0")))]);
} else if (KEY_INTERVAL.equals(KEY_TEXT_SZ)) {
findPreference(KEY_INTERVAL).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0")))]);
} else if (KEY_INTERVAL.equals(KEY_REPLIES)) {
findPreference(KEY_INTERVAL).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0")))]);
} else {
findPreference(KEY_INTERVAL).setSummary(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0"));
}
if (KEY_CACHE_SIZE.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_CACHE_SIZE).setSummary(val);
} else if (KEY_CACHE_SIZE.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_CACHE_SIZE).setSummary(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25") + " MB");
} else if (KEY_CACHE_SIZE.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_CACHE_SIZE).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25")))]);
} else if (KEY_CACHE_SIZE.equals(KEY_TEXT_SZ)) {
findPreference(KEY_CACHE_SIZE).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25")))]);
} else if (KEY_CACHE_SIZE.equals(KEY_REPLIES)) {
findPreference(KEY_CACHE_SIZE).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25")))]);
} else {
findPreference(KEY_CACHE_SIZE).setSummary(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25"));
}
if (KEY_DL_DIR.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_DL_DIR).setSummary(val);
} else if (KEY_DL_DIR.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_DL_DIR).setSummary(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads") + " MB");
} else if (KEY_DL_DIR.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_DL_DIR).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads")))]);
} else if (KEY_DL_DIR.equals(KEY_TEXT_SZ)) {
findPreference(KEY_DL_DIR).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads")))]);
} else if (KEY_DL_DIR.equals(KEY_REPLIES)) {
findPreference(KEY_DL_DIR).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads")))]);
} else {
findPreference(KEY_DL_DIR).setSummary(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads"));
}
if (KEY_INTERVAL_UNIT.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_INTERVAL_UNIT).setSummary(val);
} else if (KEY_INTERVAL_UNIT.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_INTERVAL_UNIT).setSummary(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1") + " MB");
} else if (KEY_INTERVAL_UNIT.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_INTERVAL_UNIT).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1")))]);
} else if (KEY_INTERVAL_UNIT.equals(KEY_TEXT_SZ)) {
findPreference(KEY_INTERVAL_UNIT).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1")))]);
} else if (KEY_INTERVAL_UNIT.equals(KEY_REPLIES)) {
findPreference(KEY_INTERVAL_UNIT).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1")))]);
} else {
findPreference(KEY_INTERVAL_UNIT).setSummary(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1"));
}
if (KEY_THEME.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_THEME).setSummary(val);
} else if (KEY_THEME.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_THEME).setSummary(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto") + " MB");
} else if (KEY_THEME.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_THEME).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto")))]);
} else if (KEY_THEME.equals(KEY_TEXT_SZ)) {
findPreference(KEY_THEME).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto")))]);
} else if (KEY_THEME.equals(KEY_REPLIES)) {
findPreference(KEY_THEME).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto")))]);
} else {
findPreference(KEY_THEME).setSummary(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto"));
}
if (KEY_REPLIES.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_REPLIES).setSummary(val);
} else if (KEY_REPLIES.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_REPLIES).setSummary(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0") + " MB");
} else if (KEY_REPLIES.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_REPLIES).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0")))]);
} else if (KEY_REPLIES.equals(KEY_TEXT_SZ)) {
findPreference(KEY_REPLIES).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0")))]);
} else if (KEY_REPLIES.equals(KEY_REPLIES)) {
findPreference(KEY_REPLIES).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0")))]);
} else {
findPreference(KEY_REPLIES).setSummary(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0"));
}
if (KEY_TEXT_SZ.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_TEXT_SZ).setSummary(val);
} else if (KEY_TEXT_SZ.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_TEXT_SZ).setSummary(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0") + " MB");
} else if (KEY_TEXT_SZ.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_TEXT_SZ).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0")))]);
} else if (KEY_TEXT_SZ.equals(KEY_TEXT_SZ)) {
findPreference(KEY_TEXT_SZ).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0")))]);
} else if (KEY_TEXT_SZ.equals(KEY_REPLIES)) {
findPreference(KEY_TEXT_SZ).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0")))]);
} else {
findPreference(KEY_TEXT_SZ).setSummary(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0"));
}
if (KEY_PASS_PIN.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_PASS_PIN).setSummary(val);
} else if (KEY_PASS_PIN.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_PASS_PIN).setSummary(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "") + " MB");
} else if (KEY_PASS_PIN.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_PASS_PIN).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "")))]);
} else if (KEY_PASS_PIN.equals(KEY_TEXT_SZ)) {
findPreference(KEY_PASS_PIN).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "")))]);
} else if (KEY_PASS_PIN.equals(KEY_REPLIES)) {
findPreference(KEY_PASS_PIN).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "")))]);
} else {
findPreference(KEY_PASS_PIN).setSummary(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, ""));
}
if (KEY_PASS_TOKEN.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_PASS_TOKEN).setSummary(val);
} else if (KEY_PASS_TOKEN.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_PASS_TOKEN).setSummary(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "") + " MB");
} else if (KEY_PASS_TOKEN.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_PASS_TOKEN).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "")))]);
} else if (KEY_PASS_TOKEN.equals(KEY_TEXT_SZ)) {
findPreference(KEY_PASS_TOKEN).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "")))]);
} else if (KEY_PASS_TOKEN.equals(KEY_REPLIES)) {
findPreference(KEY_PASS_TOKEN).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "")))]);
} else {
findPreference(KEY_PASS_TOKEN).setSummary(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, ""));
}
} | public void updateSummary() {
if (KEY_DEFAULT_NAME.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_DEFAULT_NAME).setSummary(val);
} else if (KEY_DEFAULT_NAME.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_DEFAULT_NAME).setSummary(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "") + " MB");
} else if (KEY_DEFAULT_NAME.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_DEFAULT_NAME).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "")))]);
} else if (KEY_DEFAULT_NAME.equals(KEY_TEXT_SZ)) {
findPreference(KEY_DEFAULT_NAME).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "")))]);
} else if (KEY_DEFAULT_NAME.equals(KEY_REPLIES)) {
findPreference(KEY_DEFAULT_NAME).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, "")))]);
} else {
findPreference(KEY_DEFAULT_NAME).setSummary(findPreference(KEY_DEFAULT_NAME).getSharedPreferences().getString(KEY_DEFAULT_NAME, ""));
}
if (KEY_DEFAULT_EMAIL.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_DEFAULT_EMAIL).setSummary(val);
} else if (KEY_DEFAULT_EMAIL.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_DEFAULT_EMAIL).setSummary(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "") + " MB");
} else if (KEY_DEFAULT_EMAIL.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_DEFAULT_EMAIL).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "")))]);
} else if (KEY_DEFAULT_EMAIL.equals(KEY_TEXT_SZ)) {
findPreference(KEY_DEFAULT_EMAIL).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "")))]);
} else if (KEY_DEFAULT_EMAIL.equals(KEY_REPLIES)) {
findPreference(KEY_DEFAULT_EMAIL).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, "")))]);
} else {
findPreference(KEY_DEFAULT_EMAIL).setSummary(findPreference(KEY_DEFAULT_EMAIL).getSharedPreferences().getString(KEY_DEFAULT_EMAIL, ""));
}
if (KEY_INTERVAL.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_INTERVAL).setSummary(val);
} else if (KEY_INTERVAL.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_INTERVAL).setSummary(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0") + " MB");
} else if (KEY_INTERVAL.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_INTERVAL).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0")))]);
} else if (KEY_INTERVAL.equals(KEY_TEXT_SZ)) {
findPreference(KEY_INTERVAL).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0")))]);
} else if (KEY_INTERVAL.equals(KEY_REPLIES)) {
findPreference(KEY_INTERVAL).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0")))]);
} else {
findPreference(KEY_INTERVAL).setSummary(findPreference(KEY_INTERVAL).getSharedPreferences().getString(KEY_INTERVAL, "0"));
}
if (KEY_CACHE_SIZE.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_CACHE_SIZE).setSummary(val);
} else if (KEY_CACHE_SIZE.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_CACHE_SIZE).setSummary(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25") + " MB");
} else if (KEY_CACHE_SIZE.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_CACHE_SIZE).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25")))]);
} else if (KEY_CACHE_SIZE.equals(KEY_TEXT_SZ)) {
findPreference(KEY_CACHE_SIZE).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25")))]);
} else if (KEY_CACHE_SIZE.equals(KEY_REPLIES)) {
findPreference(KEY_CACHE_SIZE).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25")))]);
} else {
findPreference(KEY_CACHE_SIZE).setSummary(findPreference(KEY_CACHE_SIZE).getSharedPreferences().getString(KEY_CACHE_SIZE, "25"));
}
if (KEY_DL_DIR.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_DL_DIR).setSummary(val);
} else if (KEY_DL_DIR.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_DL_DIR).setSummary(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads") + " MB");
} else if (KEY_DL_DIR.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_DL_DIR).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads")))]);
} else if (KEY_DL_DIR.equals(KEY_TEXT_SZ)) {
findPreference(KEY_DL_DIR).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads")))]);
} else if (KEY_DL_DIR.equals(KEY_REPLIES)) {
findPreference(KEY_DL_DIR).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads")))]);
} else {
findPreference(KEY_DL_DIR).setSummary(findPreference(KEY_DL_DIR).getSharedPreferences().getString(KEY_DL_DIR, "downloads"));
}
if (KEY_INTERVAL_UNIT.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_INTERVAL_UNIT).setSummary(val);
} else if (KEY_INTERVAL_UNIT.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_INTERVAL_UNIT).setSummary(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1") + " MB");
} else if (KEY_INTERVAL_UNIT.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_INTERVAL_UNIT).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1")))]);
} else if (KEY_INTERVAL_UNIT.equals(KEY_TEXT_SZ)) {
findPreference(KEY_INTERVAL_UNIT).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1")))]);
} else if (KEY_INTERVAL_UNIT.equals(KEY_REPLIES)) {
findPreference(KEY_INTERVAL_UNIT).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1")))]);
} else {
findPreference(KEY_INTERVAL_UNIT).setSummary(findPreference(KEY_INTERVAL_UNIT).getSharedPreferences().getString(KEY_INTERVAL_UNIT, "1"));
}
if (KEY_THEME.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_THEME).setSummary(val);
} else if (KEY_THEME.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_THEME).setSummary(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto") + " MB");
} else if (KEY_THEME.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_THEME).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto")))]);
} else if (KEY_THEME.equals(KEY_TEXT_SZ)) {
findPreference(KEY_THEME).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto")))]);
} else if (KEY_THEME.equals(KEY_REPLIES)) {
findPreference(KEY_THEME).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto")))]);
} else {
findPreference(KEY_THEME).setSummary(findPreference(KEY_THEME).getSharedPreferences().getString(KEY_THEME, "Auto"));
}
if (KEY_REPLIES.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_REPLIES).setSummary(val);
} else if (KEY_REPLIES.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_REPLIES).setSummary(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0") + " MB");
} else if (KEY_REPLIES.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_REPLIES).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0")))]);
} else if (KEY_REPLIES.equals(KEY_TEXT_SZ)) {
findPreference(KEY_REPLIES).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0")))]);
} else if (KEY_REPLIES.equals(KEY_REPLIES)) {
findPreference(KEY_REPLIES).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0")))]);
} else {
findPreference(KEY_REPLIES).setSummary(findPreference(KEY_REPLIES).getSharedPreferences().getString(KEY_REPLIES, "0"));
}
if (KEY_TEXT_SZ.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_TEXT_SZ).setSummary(val);
} else if (KEY_TEXT_SZ.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_TEXT_SZ).setSummary(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0") + " MB");
} else if (KEY_TEXT_SZ.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_TEXT_SZ).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0")))]);
} else if (KEY_TEXT_SZ.equals(KEY_TEXT_SZ)) {
findPreference(KEY_TEXT_SZ).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0")))]);
} else if (KEY_TEXT_SZ.equals(KEY_REPLIES)) {
findPreference(KEY_TEXT_SZ).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0")))]);
} else {
findPreference(KEY_TEXT_SZ).setSummary(findPreference(KEY_TEXT_SZ).getSharedPreferences().getString(KEY_TEXT_SZ, "0"));
}
if (KEY_PASS_PIN.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_PASS_PIN).setSummary(val);
} else if (KEY_PASS_PIN.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_PASS_PIN).setSummary(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "") + " MB");
} else if (KEY_PASS_PIN.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_PASS_PIN).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "")))]);
} else if (KEY_PASS_PIN.equals(KEY_TEXT_SZ)) {
findPreference(KEY_PASS_PIN).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "")))]);
} else if (KEY_PASS_PIN.equals(KEY_REPLIES)) {
findPreference(KEY_PASS_PIN).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, "")))]);
} else {
findPreference(KEY_PASS_PIN).setSummary(findPreference(KEY_PASS_PIN).getSharedPreferences().getString(KEY_PASS_PIN, ""));
}
<DeepExtract>
if (KEY_PASS_TOKEN.equals(KEY_INTERVAL)) {
String val = findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "");
if (val.equals("0")) {
val = "Off";
}
findPreference(KEY_PASS_TOKEN).setSummary(val);
} else if (KEY_PASS_TOKEN.equals(KEY_CACHE_SIZE)) {
findPreference(KEY_PASS_TOKEN).setSummary(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "") + " MB");
} else if (KEY_PASS_TOKEN.equals(KEY_INTERVAL_UNIT)) {
findPreference(KEY_PASS_TOKEN).setSummary(getResources().getStringArray(R.array.auto_options)[Math.min(2, Integer.parseInt(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "")))]);
} else if (KEY_PASS_TOKEN.equals(KEY_TEXT_SZ)) {
findPreference(KEY_PASS_TOKEN).setSummary(getResources().getStringArray(R.array.textsz_options)[Math.min(1, Integer.parseInt(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "")))]);
} else if (KEY_PASS_TOKEN.equals(KEY_REPLIES)) {
findPreference(KEY_PASS_TOKEN).setSummary(getResources().getStringArray(R.array.replies_options)[Math.min(5, Integer.parseInt(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, "")))]);
} else {
findPreference(KEY_PASS_TOKEN).setSummary(findPreference(KEY_PASS_TOKEN).getSharedPreferences().getString(KEY_PASS_TOKEN, ""));
}
</DeepExtract>
} | ChanExplorer | positive | 3,932 |
public Criteria andPublisherIsNotNull() {
if ("publisher is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("publisher is not null"));
return (Criteria) this;
} | public Criteria andPublisherIsNotNull() {
<DeepExtract>
if ("publisher is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("publisher is not null"));
</DeepExtract>
return (Criteria) this;
} | BookLibrarySystem | positive | 3,933 |
public float getAnchorU() {
switch(mRotation) {
case 0:
return mAnchorU;
case 1:
return 1 - mAnchorV;
case 2:
return 1 - mAnchorU;
case 3:
return mAnchorV;
default:
}
throw new IllegalStateException();
} | public float getAnchorU() {
<DeepExtract>
switch(mRotation) {
case 0:
return mAnchorU;
case 1:
return 1 - mAnchorV;
case 2:
return 1 - mAnchorU;
case 3:
return mAnchorV;
default:
}
throw new IllegalStateException();
</DeepExtract>
} | GodsEYE | positive | 3,934 |
@Override
public void copyFrom(BigInteger s) {
byte[] array = BigIntegerMath.nonnegativeBigIntegerToBigEndianByteArrayForBitSize(s, size);
ArrayUtils.reverse(array);
try {
copyFrom(array);
} finally {
ArrayUtils.reverse(array);
}
assert checkSanity();
} | @Override
public void copyFrom(BigInteger s) {
byte[] array = BigIntegerMath.nonnegativeBigIntegerToBigEndianByteArrayForBitSize(s, size);
<DeepExtract>
ArrayUtils.reverse(array);
try {
copyFrom(array);
} finally {
ArrayUtils.reverse(array);
}
assert checkSanity();
</DeepExtract>
} | uzaygezen | positive | 3,935 |
@Override
public void validateWithException(T validatedObject) throws ValidationException {
if (!isInstanceTypeEquals(validatedObject)) {
throw new IllegalArgumentException("The type needed is not in conformity with the actual type");
}
if (!rule.matchAny(validatedObject)) {
ValidationErrorReport errorReport = doGetValidationErrorReport();
throw new ValidationException(errorReport);
}
} | @Override
public void validateWithException(T validatedObject) throws ValidationException {
<DeepExtract>
if (!isInstanceTypeEquals(validatedObject)) {
throw new IllegalArgumentException("The type needed is not in conformity with the actual type");
}
</DeepExtract>
if (!rule.matchAny(validatedObject)) {
ValidationErrorReport errorReport = doGetValidationErrorReport();
throw new ValidationException(errorReport);
}
} | qiuyj-code | positive | 3,936 |
public static AjaxResponse error(int code, String msg) {
return new AjaxResponse(code, msg, null);
} | public static AjaxResponse error(int code, String msg) {
<DeepExtract>
return new AjaxResponse(code, msg, null);
</DeepExtract>
} | raincat | positive | 3,937 |
public void initialize(Context context, TimePickerController controller, boolean hasInnerCircle, boolean disappearsOut, int selectionDegrees, boolean isInnerCircle) {
if (mIsInitialized) {
Log.e(TAG, "This RadialSelectorView may only be initialized once.");
return;
}
Resources res = context.getResources();
int accentColor = controller.getAccentColor();
mPaint.setColor(accentColor);
mPaint.setAntiAlias(true);
mSelectionAlpha = controller.isThemeDark() ? SELECTED_ALPHA_THEME_DARK : SELECTED_ALPHA;
mIs24HourMode = controller.is24HourMode();
if (mIs24HourMode || controller.getVersion() != TimePickerDialog.Version.VERSION_1) {
mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier_24HourMode));
} else {
mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier));
mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier));
}
mHasInnerCircle = hasInnerCircle;
if (hasInnerCircle) {
mInnerNumbersRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_inner));
mOuterNumbersRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_outer));
} else {
mNumbersRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_normal));
}
mSelectionRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_selection_radius_multiplier));
mAnimationRadiusMultiplier = 1;
mTransitionMidRadiusMultiplier = 1f + (0.05f * (disappearsOut ? -1 : 1));
mTransitionEndRadiusMultiplier = 1f + (0.3f * (disappearsOut ? 1 : -1));
mInvalidateUpdateListener = new InvalidateUpdateListener(this);
mSelectionDegrees = selectionDegrees;
mSelectionRadians = selectionDegrees * Math.PI / 180;
mForceDrawDot = false;
if (mHasInnerCircle) {
if (isInnerCircle) {
mNumbersRadiusMultiplier = mInnerNumbersRadiusMultiplier;
} else {
mNumbersRadiusMultiplier = mOuterNumbersRadiusMultiplier;
}
}
mIsInitialized = true;
} | public void initialize(Context context, TimePickerController controller, boolean hasInnerCircle, boolean disappearsOut, int selectionDegrees, boolean isInnerCircle) {
if (mIsInitialized) {
Log.e(TAG, "This RadialSelectorView may only be initialized once.");
return;
}
Resources res = context.getResources();
int accentColor = controller.getAccentColor();
mPaint.setColor(accentColor);
mPaint.setAntiAlias(true);
mSelectionAlpha = controller.isThemeDark() ? SELECTED_ALPHA_THEME_DARK : SELECTED_ALPHA;
mIs24HourMode = controller.is24HourMode();
if (mIs24HourMode || controller.getVersion() != TimePickerDialog.Version.VERSION_1) {
mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier_24HourMode));
} else {
mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier));
mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier));
}
mHasInnerCircle = hasInnerCircle;
if (hasInnerCircle) {
mInnerNumbersRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_inner));
mOuterNumbersRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_outer));
} else {
mNumbersRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_normal));
}
mSelectionRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_selection_radius_multiplier));
mAnimationRadiusMultiplier = 1;
mTransitionMidRadiusMultiplier = 1f + (0.05f * (disappearsOut ? -1 : 1));
mTransitionEndRadiusMultiplier = 1f + (0.3f * (disappearsOut ? 1 : -1));
mInvalidateUpdateListener = new InvalidateUpdateListener(this);
<DeepExtract>
mSelectionDegrees = selectionDegrees;
mSelectionRadians = selectionDegrees * Math.PI / 180;
mForceDrawDot = false;
if (mHasInnerCircle) {
if (isInnerCircle) {
mNumbersRadiusMultiplier = mInnerNumbersRadiusMultiplier;
} else {
mNumbersRadiusMultiplier = mOuterNumbersRadiusMultiplier;
}
}
</DeepExtract>
mIsInitialized = true;
} | JalaliMaterialDateTimePicker | positive | 3,938 |
public Criteria andTruenameNotIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "truename" + " cannot be null");
}
criteria.add(new Criterion("TRUENAME not in", values));
return (Criteria) this;
} | public Criteria andTruenameNotIn(List<String> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "truename" + " cannot be null");
}
criteria.add(new Criterion("TRUENAME not in", values));
</DeepExtract>
return (Criteria) this;
} | console | positive | 3,939 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.