before stringlengths 33 3.21M | after stringlengths 63 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
@Test
void bothValid() {
ClassNameScanner.setPomXmlPath(TESTUSER_POM_XML);
ClassNameScanner.setBuildGradlePath(TESTUSER_BUILD_GRADLE);
assertThat(ClassNameScanner.getPomXmlPath()).isEqualTo(TESTUSER_POM_XML);
assertThat(ClassNameScanner.getBuildGradlePath()).isEqualTo(TESTUSER_BUILD_GRADLE);
new ClassNameScanner("", "").getScanResult();
logs.stop();
if (!logs.list.isEmpty())
fail(logs.list.toString());
} | @Test
void bothValid() {
ClassNameScanner.setPomXmlPath(TESTUSER_POM_XML);
ClassNameScanner.setBuildGradlePath(TESTUSER_BUILD_GRADLE);
assertThat(ClassNameScanner.getPomXmlPath()).isEqualTo(TESTUSER_POM_XML);
assertThat(ClassNameScanner.getBuildGradlePath()).isEqualTo(TESTUSER_BUILD_GRADLE);
<DeepExtract>
new ClassNameScanner("", "").getScanResult();
logs.stop();
if (!logs.list.isEmpty())
fail(logs.list.toString());
</DeepExtract>
} | Ares | positive | 3,023 |
@Override
public IParseController getWrapped() {
try {
if (descriptor == null) {
descriptor = new SugarJDescriptor(createDescriptorWithRegisteredExtensions());
descriptor.setAttachmentProvider(SugarJParseControllerGenerated.class);
setDescriptor(descriptor);
org.strategoxt.imp.runtime.Environment.registerDescriptor(descriptor.getLanguage(), descriptor);
}
return descriptor;
} catch (BadDescriptorException e) {
org.strategoxt.imp.runtime.Environment.logException("Bad descriptor for " + LANGUAGE + " plugin", e);
throw new RuntimeException("Bad descriptor for " + LANGUAGE + " plugin", e);
}
IParseController result = super.getWrapped();
if (result instanceof SGLRParseController) {
JSGLRI parser = ((SGLRParseController) result).getParser();
if (!(parser instanceof SugarJParser)) {
sugarjParser = new SugarJParser(parser);
sugarjParser.setEnvironment(environment);
((SGLRParseController) result).setParser(sugarjParser);
}
}
return result;
} | @Override
public IParseController getWrapped() {
<DeepExtract>
try {
if (descriptor == null) {
descriptor = new SugarJDescriptor(createDescriptorWithRegisteredExtensions());
descriptor.setAttachmentProvider(SugarJParseControllerGenerated.class);
setDescriptor(descriptor);
org.strategoxt.imp.runtime.Environment.registerDescriptor(descriptor.getLanguage(), descriptor);
}
return descriptor;
} catch (BadDescriptorException e) {
org.strategoxt.imp.runtime.Environment.logException("Bad descriptor for " + LANGUAGE + " plugin", e);
throw new RuntimeException("Bad descriptor for " + LANGUAGE + " plugin", e);
}
</DeepExtract>
IParseController result = super.getWrapped();
if (result instanceof SGLRParseController) {
JSGLRI parser = ((SGLRParseController) result).getParser();
if (!(parser instanceof SugarJParser)) {
sugarjParser = new SugarJParser(parser);
sugarjParser.setEnvironment(environment);
((SGLRParseController) result).setParser(sugarjParser);
}
}
return result;
} | sugarj | positive | 3,024 |
public int remove() {
int ith = data.get(0);
int jth = data.get(this.data.size() - 1);
data.set(0, jth);
data.set(this.data.size() - 1, ith);
int rv = this.data.remove(this.data.size() - 1);
int lci = 2 * 0 + 1;
int rci = 2 * 0 + 2;
int mini = 0;
if (lci < this.data.size() && data.get(lci) < data.get(mini)) {
mini = lci;
}
if (rci < this.data.size() && data.get(rci) < data.get(mini)) {
mini = rci;
}
if (mini != 0) {
swap(mini, 0);
downheapify(mini);
}
return rv;
} | public int remove() {
int ith = data.get(0);
int jth = data.get(this.data.size() - 1);
data.set(0, jth);
data.set(this.data.size() - 1, ith);
int rv = this.data.remove(this.data.size() - 1);
<DeepExtract>
int lci = 2 * 0 + 1;
int rci = 2 * 0 + 2;
int mini = 0;
if (lci < this.data.size() && data.get(lci) < data.get(mini)) {
mini = lci;
}
if (rci < this.data.size() && data.get(rci) < data.get(mini)) {
mini = rci;
}
if (mini != 0) {
swap(mini, 0);
downheapify(mini);
}
</DeepExtract>
return rv;
} | JavaNagarroBootcampJan21 | positive | 3,025 |
final void readNumber() {
int pos = this.pos;
int startFlag = pos;
byte ch = sql[pos];
boolean has = true;
if (ch == '-' || ch == '+') {
pos += 1;
ch = sql[pos];
}
while ('0' <= ch && ch <= '9' && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
boolean isDouble = false;
if ((ch == '.') && has) {
if (sql[pos + 1] == '.') {
this.pos = pos - 1;
limitNumberCollector(startFlag, this.pos);
return;
}
pos += 2;
ch = sql[pos];
isDouble = true;
while ('0' <= ch && ch <= '9' && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
}
if ((ch == 'e' || ch == 'E') && has) {
pos += 2;
ch = sql[pos];
if (ch == '+' || ch == '-') {
pos += 2;
ch = sql[pos];
}
while (('0' <= ch && ch <= '9') && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
isDouble = true;
}
this.pos = has ? pos - 1 : pos;
if (isDouble) {
} else {
}
System.out.println(new String(sql, startFlag, this.pos - startFlag));
} | final void readNumber() {
int pos = this.pos;
int startFlag = pos;
byte ch = sql[pos];
boolean has = true;
if (ch == '-' || ch == '+') {
pos += 1;
ch = sql[pos];
}
while ('0' <= ch && ch <= '9' && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
boolean isDouble = false;
if ((ch == '.') && has) {
if (sql[pos + 1] == '.') {
this.pos = pos - 1;
limitNumberCollector(startFlag, this.pos);
return;
}
pos += 2;
ch = sql[pos];
isDouble = true;
while ('0' <= ch && ch <= '9' && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
}
if ((ch == 'e' || ch == 'E') && has) {
pos += 2;
ch = sql[pos];
if (ch == '+' || ch == '-') {
pos += 2;
ch = sql[pos];
}
while (('0' <= ch && ch <= '9') && has) {
if (pos <= sqlLength) {
ch = sql[pos];
++pos;
} else {
has = false;
}
}
isDouble = true;
}
this.pos = has ? pos - 1 : pos;
if (isDouble) {
} else {
}
<DeepExtract>
System.out.println(new String(sql, startFlag, this.pos - startFlag));
</DeepExtract>
} | SQLparser | positive | 3,026 |
public Criteria andRqzNotEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "rqz" + " cannot be null");
}
criteria.add(new Criterion("rqz <>", value));
return (Criteria) this;
} | public Criteria andRqzNotEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "rqz" + " cannot be null");
}
criteria.add(new Criterion("rqz <>", value));
</DeepExtract>
return (Criteria) this;
} | einvoice | positive | 3,027 |
private static String connectorAddress(int pid) throws IOException {
VirtualMachine vm;
try {
vm = VirtualMachine.attach(String.valueOf(pid));
} catch (AttachNotSupportedException ex) {
throw failed("VM does not support attach operation", ex);
} catch (IOException ex) {
throw failed("VM attach failed", ex);
}
String address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
final Properties systemProperties = vm.getSystemProperties();
List<String> diag = new ArrayList<String>(3);
try {
Method method = VirtualMachine.class.getMethod("startLocalManagementAgent");
return (String) method.invoke(vm);
} catch (NoSuchMethodException ex) {
diag.add("VirtualMachine.startLocalManagementAgent not supported");
} catch (InvocationTargetException ex) {
throw new AssertionError(ex);
} catch (IllegalAccessException ex) {
throw new AssertionError(ex);
}
try {
Class<?> hsvm = Class.forName("sun.tools.attach.HotSpotVirtualMachine");
if (hsvm.isInstance(vm)) {
Method method = hsvm.getMethod("executeJCmd", String.class);
InputStream in = (InputStream) method.invoke(vm, "ManagementAgent.start_local");
in.close();
address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("jcmd ManagementAgent.start_local succeeded");
}
} catch (ClassNotFoundException e) {
diag.add("not a HotSpot VM - jcmd likely unsupported");
} catch (NoSuchMethodException e) {
diag.add("HotSpot VM with no jcmd support");
} catch (InvocationTargetException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
String agentPath = systemProperties.getProperty("java.home") + File.separator + "lib" + File.separator + "management-agent.jar";
if (new File(agentPath).exists()) {
try {
vm.loadAgent(agentPath);
} catch (AgentLoadException ex) {
throw failed("Unable to load agent", ex);
} catch (AgentInitializationException ex) {
throw failed("Unable to initialize agent", ex);
}
address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("management-agent.jar loaded successfully");
} else {
diag.add("management-agent.jar not found");
}
try {
Class<?> ibmVmClass = Class.forName("com.ibm.tools.attach.VirtualMachine");
Method attach = ibmVmClass.getMethod("attach", String.class);
Object ibmVm = attach.invoke(null, String.valueOf(pid));
Method method = ibmVm.getClass().getMethod("getSystemProperties");
method.setAccessible(true);
Properties props = (Properties) method.invoke(ibmVm);
address = props.getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("IBM JDK attach successful - no address provided");
} catch (ClassNotFoundException e) {
diag.add("not an IBM JDK - unable to create local JMX connection; try HOSTNAME:PORT instead");
} catch (NoSuchMethodException e) {
diag.add("IBM JDK does not seem to support attach: " + e.getMessage());
} catch (InvocationTargetException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
throw failedUnsupported("Unable to connect to JVM: " + diag.toString(), systemProperties);
} | private static String connectorAddress(int pid) throws IOException {
<DeepExtract>
VirtualMachine vm;
try {
vm = VirtualMachine.attach(String.valueOf(pid));
} catch (AttachNotSupportedException ex) {
throw failed("VM does not support attach operation", ex);
} catch (IOException ex) {
throw failed("VM attach failed", ex);
}
</DeepExtract>
String address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
final Properties systemProperties = vm.getSystemProperties();
List<String> diag = new ArrayList<String>(3);
try {
Method method = VirtualMachine.class.getMethod("startLocalManagementAgent");
return (String) method.invoke(vm);
} catch (NoSuchMethodException ex) {
diag.add("VirtualMachine.startLocalManagementAgent not supported");
} catch (InvocationTargetException ex) {
throw new AssertionError(ex);
} catch (IllegalAccessException ex) {
throw new AssertionError(ex);
}
try {
Class<?> hsvm = Class.forName("sun.tools.attach.HotSpotVirtualMachine");
if (hsvm.isInstance(vm)) {
Method method = hsvm.getMethod("executeJCmd", String.class);
InputStream in = (InputStream) method.invoke(vm, "ManagementAgent.start_local");
in.close();
address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("jcmd ManagementAgent.start_local succeeded");
}
} catch (ClassNotFoundException e) {
diag.add("not a HotSpot VM - jcmd likely unsupported");
} catch (NoSuchMethodException e) {
diag.add("HotSpot VM with no jcmd support");
} catch (InvocationTargetException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
String agentPath = systemProperties.getProperty("java.home") + File.separator + "lib" + File.separator + "management-agent.jar";
if (new File(agentPath).exists()) {
try {
vm.loadAgent(agentPath);
} catch (AgentLoadException ex) {
throw failed("Unable to load agent", ex);
} catch (AgentInitializationException ex) {
throw failed("Unable to initialize agent", ex);
}
address = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("management-agent.jar loaded successfully");
} else {
diag.add("management-agent.jar not found");
}
try {
Class<?> ibmVmClass = Class.forName("com.ibm.tools.attach.VirtualMachine");
Method attach = ibmVmClass.getMethod("attach", String.class);
Object ibmVm = attach.invoke(null, String.valueOf(pid));
Method method = ibmVm.getClass().getMethod("getSystemProperties");
method.setAccessible(true);
Properties props = (Properties) method.invoke(ibmVm);
address = props.getProperty(CONNECTOR_ADDRESS);
if (address != null)
return address;
diag.add("IBM JDK attach successful - no address provided");
} catch (ClassNotFoundException e) {
diag.add("not an IBM JDK - unable to create local JMX connection; try HOSTNAME:PORT instead");
} catch (NoSuchMethodException e) {
diag.add("IBM JDK does not seem to support attach: " + e.getMessage());
} catch (InvocationTargetException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
throw failedUnsupported("Unable to connect to JVM: " + diag.toString(), systemProperties);
} | dumpling | positive | 3,028 |
@Override
protected void refreshVisuals() {
List<Point> bendpoints = ((ElementConnection) getModel()).getBendpoints();
List<Point> constraint = new ArrayList<Point>();
for (int i = 0; i < bendpoints.size(); ++i) {
constraint.add(new AbsoluteBendpoint(bendpoints.get(i)));
}
getConnectionFigure().setRoutingConstraint(constraint);
} | @Override
protected void refreshVisuals() {
<DeepExtract>
List<Point> bendpoints = ((ElementConnection) getModel()).getBendpoints();
List<Point> constraint = new ArrayList<Point>();
for (int i = 0; i < bendpoints.size(); ++i) {
constraint.add(new AbsoluteBendpoint(bendpoints.get(i)));
}
getConnectionFigure().setRoutingConstraint(constraint);
</DeepExtract>
} | tbbpm-designer | positive | 3,029 |
@Override
public void postAsync() {
if (TMLog.isDebug()) {
if (eventIds == null) {
throw new IllegalStateException("plz call registerEvents(int ...) or generateEventId before task post ");
}
}
preferredThread = RunningThread.BACKGROUND_THREAD;
} | @Override
public void postAsync() {
<DeepExtract>
if (TMLog.isDebug()) {
if (eventIds == null) {
throw new IllegalStateException("plz call registerEvents(int ...) or generateEventId before task post ");
}
}
</DeepExtract>
preferredThread = RunningThread.BACKGROUND_THREAD;
} | TaskManager | positive | 3,030 |
@Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
if (mDisableCircularTransformation) {
mBitmap = null;
} else {
mBitmap = getBitmapFromDrawable(getDrawable());
}
setup();
} | @Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
<DeepExtract>
if (mDisableCircularTransformation) {
mBitmap = null;
} else {
mBitmap = getBitmapFromDrawable(getDrawable());
}
setup();
</DeepExtract>
} | ShopSystem_2_App | positive | 3,031 |
public void testParseGtk20WithNoErrors() throws IOException {
assumeNotNull(System.getenv("VALA_HOME"));
PsiFile file = parseFile("gtk+-2.0.vapi");
assertThat("gtk+-2.0.vapi" + " had parse errors", file, hasNoErrors());
} | public void testParseGtk20WithNoErrors() throws IOException {
<DeepExtract>
assumeNotNull(System.getenv("VALA_HOME"));
PsiFile file = parseFile("gtk+-2.0.vapi");
assertThat("gtk+-2.0.vapi" + " had parse errors", file, hasNoErrors());
</DeepExtract>
} | vala-intellij-plugin | positive | 3,032 |
@Override
protected void onPause() {
mHandler = null;
super.onPause();
} | @Override
protected void onPause() {
<DeepExtract>
mHandler = null;
</DeepExtract>
super.onPause();
} | AndroidDemoProjects | positive | 3,033 |
@Override
public void onErrorResponse(VolleyError error) {
tracks = true;
if (tracks && count == 0) {
DatabaseManager dbManager = DatabaseManager.getInstance();
dbManager.clearDatabase();
dbManager.performInsertQueries(queries);
if (version != 1) {
}
if (mCallback != null) {
mCallback.onDataLoaded();
}
}
} | @Override
public void onErrorResponse(VolleyError error) {
tracks = true;
<DeepExtract>
if (tracks && count == 0) {
DatabaseManager dbManager = DatabaseManager.getInstance();
dbManager.clearDatabase();
dbManager.performInsertQueries(queries);
if (version != 1) {
}
if (mCallback != null) {
mCallback.onDataLoaded();
}
}
</DeepExtract>
} | ots15-companion | positive | 3,035 |
private void updateTone(float vs) {
if (vs >= minLiftThreshold) {
if (vs > maxLiftThreshold)
vs = maxLiftThreshold;
beepHz = interpolate(minLiftThreshold, maxLiftThreshold, minLiftHz, maxLiftHz, vs);
curTone = liftTone;
} else if (vs <= -minSinkThreshold) {
if (vs < -maxSinkThreshold)
vs = maxSinkThreshold;
beepHz = interpolate(minSinkThreshold, maxSinkThreshold, minSinkHz, maxSinkHz, -vs);
curTone = sinkTone;
} else
beepHz = -1f;
beepDelayMsec = (int) (1000 / beepHz);
Log.d(TAG, "vs=" + vs + " -> hz=" + beepHz + " delay=" + beepDelayMsec);
if (beepDelayMsec > 0) {
if (!isPlaying) {
isPlaying = true;
curTone.play();
handler.postDelayed(this, beepDelayMsec);
}
}
} | private void updateTone(float vs) {
if (vs >= minLiftThreshold) {
if (vs > maxLiftThreshold)
vs = maxLiftThreshold;
beepHz = interpolate(minLiftThreshold, maxLiftThreshold, minLiftHz, maxLiftHz, vs);
curTone = liftTone;
} else if (vs <= -minSinkThreshold) {
if (vs < -maxSinkThreshold)
vs = maxSinkThreshold;
beepHz = interpolate(minSinkThreshold, maxSinkThreshold, minSinkHz, maxSinkHz, -vs);
curTone = sinkTone;
} else
beepHz = -1f;
beepDelayMsec = (int) (1000 / beepHz);
Log.d(TAG, "vs=" + vs + " -> hz=" + beepHz + " delay=" + beepDelayMsec);
<DeepExtract>
if (beepDelayMsec > 0) {
if (!isPlaying) {
isPlaying = true;
curTone.play();
handler.postDelayed(this, beepDelayMsec);
}
}
</DeepExtract>
} | Gaggle | positive | 3,036 |
public Criteria andRefreshTokenKeyGreaterThan(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "refreshTokenKey" + " cannot be null");
}
criteria.add(new Criterion("refresh_token_key >", value));
return (Criteria) this;
} | public Criteria andRefreshTokenKeyGreaterThan(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "refreshTokenKey" + " cannot be null");
}
criteria.add(new Criterion("refresh_token_key >", value));
</DeepExtract>
return (Criteria) this;
} | oauth4j | positive | 3,038 |
@Override
public Number getResult(PercentageContext context) {
return getSumOfDataOne() / getSumOfDataTwo();
} | @Override
public Number getResult(PercentageContext context) {
<DeepExtract>
return getSumOfDataOne() / getSumOfDataTwo();
</DeepExtract>
} | ZK_Practice | positive | 3,039 |
@Override
public void vmLaunched(VM vm) {
idleVms.add(vm);
if (!idleVms.contains(vm)) {
return;
}
LinkedList<Task> vmqueue = vmQueues.get(vm);
Task task = vmqueue.peek();
if (task == null) {
getProvisioner().terminateVM(vm);
} else {
if (readyJobs.containsKey(task)) {
Job next = readyJobs.get(task);
submitJob(vm, next);
}
}
} | @Override
public void vmLaunched(VM vm) {
idleVms.add(vm);
<DeepExtract>
if (!idleVms.contains(vm)) {
return;
}
LinkedList<Task> vmqueue = vmQueues.get(vm);
Task task = vmqueue.peek();
if (task == null) {
getProvisioner().terminateVM(vm);
} else {
if (readyJobs.containsKey(task)) {
Job next = readyJobs.get(task);
submitJob(vm, next);
}
}
</DeepExtract>
} | cloudworkflowsimulator | positive | 3,041 |
private void fixHolesAndTryAssignmentRepair(HbckInfo hbi, String msg) throws IOException, KeeperException, InterruptedException {
LOG.info("Patching hbase:meta with with .regioninfo: " + hbi.getHdfsHRI());
int numReplicas = admin.getDescriptor(hbi.getTableName()).getRegionReplication();
HBaseFsckRepair.fixMetaHoleOnlineAndAddReplicas(getConf(), hbi.getHdfsHRI(), admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet(), numReplicas);
if (shouldFixAssignments()) {
errors.print(msg);
undeployRegions(hbi);
setShouldRerun();
RegionInfo hri = hbi.getHdfsHRI();
if (hri == null) {
hri = hbi.metaEntry;
}
HBaseFsckRepair.fixUnassigned(admin, hri);
HBaseFsckRepair.waitUntilAssigned(admin, hri);
if (hbi.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) {
return;
}
int replicationCount = admin.getDescriptor(hri.getTable()).getRegionReplication();
for (int i = 1; i < replicationCount; i++) {
hri = RegionReplicaUtil.getRegionInfoForReplica(hri, i);
HbckInfo h = regionInfoMap.get(hri.getEncodedName());
if (h != null) {
undeployRegions(h);
h.setSkipChecks(true);
}
HBaseFsckRepair.fixUnassigned(admin, hri);
HBaseFsckRepair.waitUntilAssigned(admin, hri);
}
}
} | private void fixHolesAndTryAssignmentRepair(HbckInfo hbi, String msg) throws IOException, KeeperException, InterruptedException {
LOG.info("Patching hbase:meta with with .regioninfo: " + hbi.getHdfsHRI());
int numReplicas = admin.getDescriptor(hbi.getTableName()).getRegionReplication();
HBaseFsckRepair.fixMetaHoleOnlineAndAddReplicas(getConf(), hbi.getHdfsHRI(), admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet(), numReplicas);
<DeepExtract>
if (shouldFixAssignments()) {
errors.print(msg);
undeployRegions(hbi);
setShouldRerun();
RegionInfo hri = hbi.getHdfsHRI();
if (hri == null) {
hri = hbi.metaEntry;
}
HBaseFsckRepair.fixUnassigned(admin, hri);
HBaseFsckRepair.waitUntilAssigned(admin, hri);
if (hbi.getReplicaId() != RegionInfo.DEFAULT_REPLICA_ID) {
return;
}
int replicationCount = admin.getDescriptor(hri.getTable()).getRegionReplication();
for (int i = 1; i < replicationCount; i++) {
hri = RegionReplicaUtil.getRegionInfoForReplica(hri, i);
HbckInfo h = regionInfoMap.get(hri.getEncodedName());
if (h != null) {
undeployRegions(h);
h.setSkipChecks(true);
}
HBaseFsckRepair.fixUnassigned(admin, hri);
HBaseFsckRepair.waitUntilAssigned(admin, hri);
}
}
</DeepExtract>
} | hbase-operator-tools | positive | 3,042 |
private void adjustDayInMonthIfNeeded(UmmalquraCalendar calendar) {
int day = calendar.get(UmmalquraCalendar.DAY_OF_MONTH);
int daysInMonth = calendar.getActualMaximum(UmmalquraCalendar.DAY_OF_MONTH);
if (day > daysInMonth) {
calendar.set(UmmalquraCalendar.DAY_OF_MONTH, daysInMonth);
}
if (!selectableDays.isEmpty()) {
UmmalquraCalendar newCalendar = null;
UmmalquraCalendar higher = selectableDays.ceiling(calendar);
UmmalquraCalendar lower = selectableDays.lower(calendar);
if (higher == null && lower != null)
newCalendar = lower;
else if (lower == null && higher != null)
newCalendar = higher;
if (newCalendar != null || higher == null) {
newCalendar = newCalendar == null ? calendar : newCalendar;
newCalendar.setTimeZone(getTimeZone());
calendar.setTimeInMillis(newCalendar.getTimeInMillis());
return;
}
long highDistance = Math.abs(higher.getTimeInMillis() - calendar.getTimeInMillis());
long lowDistance = Math.abs(calendar.getTimeInMillis() - lower.getTimeInMillis());
if (lowDistance < highDistance)
calendar.setTimeInMillis(lower.getTimeInMillis());
else
calendar.setTimeInMillis(higher.getTimeInMillis());
return;
}
if (!disabledDays.isEmpty()) {
UmmalquraCalendar forwardDate = (UmmalquraCalendar) calendar.clone();
UmmalquraCalendar backwardDate = (UmmalquraCalendar) calendar.clone();
while (isDisabled(forwardDate) && isDisabled(backwardDate)) {
forwardDate.add(UmmalquraCalendar.DAY_OF_MONTH, 1);
backwardDate.add(UmmalquraCalendar.DAY_OF_MONTH, -1);
}
if (!isDisabled(backwardDate)) {
calendar.setTimeInMillis(backwardDate.getTimeInMillis());
return;
}
if (!isDisabled(forwardDate)) {
calendar.setTimeInMillis(forwardDate.getTimeInMillis());
return;
}
}
if (isBeforeMin(calendar)) {
calendar.setTimeInMillis(mMinDate.getTimeInMillis());
return;
}
if (isAfterMax(calendar)) {
calendar.setTimeInMillis(mMaxDate.getTimeInMillis());
return;
}
} | private void adjustDayInMonthIfNeeded(UmmalquraCalendar calendar) {
int day = calendar.get(UmmalquraCalendar.DAY_OF_MONTH);
int daysInMonth = calendar.getActualMaximum(UmmalquraCalendar.DAY_OF_MONTH);
if (day > daysInMonth) {
calendar.set(UmmalquraCalendar.DAY_OF_MONTH, daysInMonth);
}
<DeepExtract>
if (!selectableDays.isEmpty()) {
UmmalquraCalendar newCalendar = null;
UmmalquraCalendar higher = selectableDays.ceiling(calendar);
UmmalquraCalendar lower = selectableDays.lower(calendar);
if (higher == null && lower != null)
newCalendar = lower;
else if (lower == null && higher != null)
newCalendar = higher;
if (newCalendar != null || higher == null) {
newCalendar = newCalendar == null ? calendar : newCalendar;
newCalendar.setTimeZone(getTimeZone());
calendar.setTimeInMillis(newCalendar.getTimeInMillis());
return;
}
long highDistance = Math.abs(higher.getTimeInMillis() - calendar.getTimeInMillis());
long lowDistance = Math.abs(calendar.getTimeInMillis() - lower.getTimeInMillis());
if (lowDistance < highDistance)
calendar.setTimeInMillis(lower.getTimeInMillis());
else
calendar.setTimeInMillis(higher.getTimeInMillis());
return;
}
if (!disabledDays.isEmpty()) {
UmmalquraCalendar forwardDate = (UmmalquraCalendar) calendar.clone();
UmmalquraCalendar backwardDate = (UmmalquraCalendar) calendar.clone();
while (isDisabled(forwardDate) && isDisabled(backwardDate)) {
forwardDate.add(UmmalquraCalendar.DAY_OF_MONTH, 1);
backwardDate.add(UmmalquraCalendar.DAY_OF_MONTH, -1);
}
if (!isDisabled(backwardDate)) {
calendar.setTimeInMillis(backwardDate.getTimeInMillis());
return;
}
if (!isDisabled(forwardDate)) {
calendar.setTimeInMillis(forwardDate.getTimeInMillis());
return;
}
}
if (isBeforeMin(calendar)) {
calendar.setTimeInMillis(mMinDate.getTimeInMillis());
return;
}
if (isAfterMax(calendar)) {
calendar.setTimeInMillis(mMaxDate.getTimeInMillis());
return;
}
</DeepExtract>
} | HijriDatePicker | positive | 3,043 |
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
View toolbarView = activity.findViewById(R.id.toolbar);
int toolbarHeight = toolbarView.getHeight();
final Scrollable scrollable = getCurrentScrollable();
if (scrollable == null) {
return;
}
int scrollY = scrollable.getCurrentScrollY();
if (scrollState == ScrollState.DOWN) {
showToolbar();
} else if (scrollState == ScrollState.UP) {
if (toolbarHeight <= scrollY - hideThreshold) {
hideToolbar();
} else {
showToolbar();
}
}
} | @Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
<DeepExtract>
View toolbarView = activity.findViewById(R.id.toolbar);
int toolbarHeight = toolbarView.getHeight();
final Scrollable scrollable = getCurrentScrollable();
if (scrollable == null) {
return;
}
int scrollY = scrollable.getCurrentScrollY();
if (scrollState == ScrollState.DOWN) {
showToolbar();
} else if (scrollState == ScrollState.UP) {
if (toolbarHeight <= scrollY - hideThreshold) {
hideToolbar();
} else {
showToolbar();
}
}
</DeepExtract>
} | moviedb-android | positive | 3,044 |
private InterfaceHttpData findMultipartDelimiter(String delimiter, MultiPartStatus dispositionStatus, MultiPartStatus closeDelimiterStatus) {
int readerIndex = undecodedChunk.readerIndex();
try {
skipControlCharacters(undecodedChunk);
} catch (NotEnoughDataDecoderException ignored) {
undecodedChunk.readerIndex(readerIndex);
return null;
}
if (!undecodedChunk.isReadable()) {
return false;
}
byte nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.CR) {
if (!undecodedChunk.isReadable()) {
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
return false;
}
nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.LF) {
return true;
}
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 2);
return false;
}
if (nextByte == HttpConstants.LF) {
return true;
}
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
return false;
try {
newline = readDelimiter(undecodedChunk, delimiter);
} catch (NotEnoughDataDecoderException ignored) {
undecodedChunk.readerIndex(readerIndex);
return null;
}
if (newline.equals(delimiter)) {
currentStatus = dispositionStatus;
return decodeMultipart(dispositionStatus);
}
if (newline.equals(delimiter + "--")) {
currentStatus = closeDelimiterStatus;
if (currentStatus == MultiPartStatus.HEADERDELIMITER) {
currentFieldAttributes = null;
return decodeMultipart(MultiPartStatus.HEADERDELIMITER);
}
return null;
}
undecodedChunk.readerIndex(readerIndex);
throw new ErrorDataDecoderException("No Multipart delimiter found");
} | private InterfaceHttpData findMultipartDelimiter(String delimiter, MultiPartStatus dispositionStatus, MultiPartStatus closeDelimiterStatus) {
int readerIndex = undecodedChunk.readerIndex();
try {
skipControlCharacters(undecodedChunk);
} catch (NotEnoughDataDecoderException ignored) {
undecodedChunk.readerIndex(readerIndex);
return null;
}
<DeepExtract>
if (!undecodedChunk.isReadable()) {
return false;
}
byte nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.CR) {
if (!undecodedChunk.isReadable()) {
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
return false;
}
nextByte = undecodedChunk.readByte();
if (nextByte == HttpConstants.LF) {
return true;
}
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 2);
return false;
}
if (nextByte == HttpConstants.LF) {
return true;
}
undecodedChunk.readerIndex(undecodedChunk.readerIndex() - 1);
return false;
</DeepExtract>
try {
newline = readDelimiter(undecodedChunk, delimiter);
} catch (NotEnoughDataDecoderException ignored) {
undecodedChunk.readerIndex(readerIndex);
return null;
}
if (newline.equals(delimiter)) {
currentStatus = dispositionStatus;
return decodeMultipart(dispositionStatus);
}
if (newline.equals(delimiter + "--")) {
currentStatus = closeDelimiterStatus;
if (currentStatus == MultiPartStatus.HEADERDELIMITER) {
currentFieldAttributes = null;
return decodeMultipart(MultiPartStatus.HEADERDELIMITER);
}
return null;
}
undecodedChunk.readerIndex(readerIndex);
throw new ErrorDataDecoderException("No Multipart delimiter found");
} | dorado | positive | 3,045 |
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mMeasureSpecHeight = View.MeasureSpec.getSize(heightMeasureSpec);
int newWidthMeasureSpec;
if (mCalendarViewPagerWidth == SIZE_UNSPECIFIED) {
newWidthMeasureSpec = widthMeasureSpec;
}
final int mode = View.MeasureSpec.getMode(widthMeasureSpec);
int smallestScreenWidthDp = getResources().getConfiguration().smallestScreenWidthDp;
int layoutWidth;
if (mode == MeasureSpec.AT_MOST) {
if (smallestScreenWidthDp >= 600) {
layoutWidth = getResources().getDimensionPixelSize(R.dimen.sesl_date_picker_dialog_min_width);
} else {
layoutWidth = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) smallestScreenWidthDp, getResources().getDisplayMetrics()) + 0.5f);
}
} else {
layoutWidth = View.MeasureSpec.getSize(widthMeasureSpec);
}
switch(mode) {
case MeasureSpec.AT_MOST:
if (smallestScreenWidthDp >= 600 && mLayoutMode == LAYOUT_MODE_DEFAULT) {
mCalendarViewPagerWidth = layoutWidth - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = layoutWidth - (mCalendarViewMargin * 2);
} else {
mCalendarViewPagerWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
}
newWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(layoutWidth, MeasureSpec.EXACTLY);
case MeasureSpec.UNSPECIFIED:
newWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(mCalendarViewPagerWidth, MeasureSpec.EXACTLY);
case MeasureSpec.EXACTLY:
if (smallestScreenWidthDp >= 600 && mLayoutMode == LAYOUT_MODE_DEFAULT) {
mCalendarViewPagerWidth = layoutWidth - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = layoutWidth - (mCalendarViewMargin * 2);
} else {
mCalendarViewPagerWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
}
newWidthMeasureSpec = widthMeasureSpec;
}
throw new IllegalArgumentException("Unknown measure mode: " + mode);
if (mIsFirstMeasure || mOldCalendarViewPagerWidth != mCalendarViewPagerWidth) {
mIsFirstMeasure = false;
mOldCalendarViewPagerWidth = mCalendarViewPagerWidth;
if (mCustomButtonLayout != null) {
mCustomButtonLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mCalendarHeaderLayoutHeight));
}
mCalendarHeaderLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mCalendarHeaderLayoutHeight));
mDayOfTheWeekLayout.setLayoutParams(new LinearLayout.LayoutParams(mDayOfTheWeekLayoutWidth, mDayOfTheWeekLayoutHeight));
mDayOfTheWeekView.setLayoutParams(new LinearLayout.LayoutParams(mDayOfTheWeekLayoutWidth, mDayOfTheWeekLayoutHeight));
mCalendarViewPager.setLayoutParams(new LinearLayout.LayoutParams(mCalendarViewPagerWidth, mCalendarViewPagerHeight));
mPickerView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mPickerViewHeight));
if (mIsRTL && mIsConfigurationChanged) {
mCalendarViewPager.seslSetConfigurationChanged(true);
}
mFirstBlankSpace.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mFirstBlankSpaceHeight));
mSecondBlankSpace.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mSecondBlankSpaceHeight));
}
super.onMeasure(newWidthMeasureSpec, heightMeasureSpec);
} | @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
mMeasureSpecHeight = View.MeasureSpec.getSize(heightMeasureSpec);
<DeepExtract>
int newWidthMeasureSpec;
if (mCalendarViewPagerWidth == SIZE_UNSPECIFIED) {
newWidthMeasureSpec = widthMeasureSpec;
}
final int mode = View.MeasureSpec.getMode(widthMeasureSpec);
int smallestScreenWidthDp = getResources().getConfiguration().smallestScreenWidthDp;
int layoutWidth;
if (mode == MeasureSpec.AT_MOST) {
if (smallestScreenWidthDp >= 600) {
layoutWidth = getResources().getDimensionPixelSize(R.dimen.sesl_date_picker_dialog_min_width);
} else {
layoutWidth = (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) smallestScreenWidthDp, getResources().getDisplayMetrics()) + 0.5f);
}
} else {
layoutWidth = View.MeasureSpec.getSize(widthMeasureSpec);
}
switch(mode) {
case MeasureSpec.AT_MOST:
if (smallestScreenWidthDp >= 600 && mLayoutMode == LAYOUT_MODE_DEFAULT) {
mCalendarViewPagerWidth = layoutWidth - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = layoutWidth - (mCalendarViewMargin * 2);
} else {
mCalendarViewPagerWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
}
newWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(layoutWidth, MeasureSpec.EXACTLY);
case MeasureSpec.UNSPECIFIED:
newWidthMeasureSpec = View.MeasureSpec.makeMeasureSpec(mCalendarViewPagerWidth, MeasureSpec.EXACTLY);
case MeasureSpec.EXACTLY:
if (smallestScreenWidthDp >= 600 && mLayoutMode == LAYOUT_MODE_DEFAULT) {
mCalendarViewPagerWidth = layoutWidth - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = layoutWidth - (mCalendarViewMargin * 2);
} else {
mCalendarViewPagerWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
mDayOfTheWeekLayoutWidth = mViewAnimator.getMeasuredWidth() - (mCalendarViewMargin * 2);
}
newWidthMeasureSpec = widthMeasureSpec;
}
throw new IllegalArgumentException("Unknown measure mode: " + mode);
</DeepExtract>
if (mIsFirstMeasure || mOldCalendarViewPagerWidth != mCalendarViewPagerWidth) {
mIsFirstMeasure = false;
mOldCalendarViewPagerWidth = mCalendarViewPagerWidth;
if (mCustomButtonLayout != null) {
mCustomButtonLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mCalendarHeaderLayoutHeight));
}
mCalendarHeaderLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mCalendarHeaderLayoutHeight));
mDayOfTheWeekLayout.setLayoutParams(new LinearLayout.LayoutParams(mDayOfTheWeekLayoutWidth, mDayOfTheWeekLayoutHeight));
mDayOfTheWeekView.setLayoutParams(new LinearLayout.LayoutParams(mDayOfTheWeekLayoutWidth, mDayOfTheWeekLayoutHeight));
mCalendarViewPager.setLayoutParams(new LinearLayout.LayoutParams(mCalendarViewPagerWidth, mCalendarViewPagerHeight));
mPickerView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mPickerViewHeight));
if (mIsRTL && mIsConfigurationChanged) {
mCalendarViewPager.seslSetConfigurationChanged(true);
}
mFirstBlankSpace.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mFirstBlankSpaceHeight));
mSecondBlankSpace.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mSecondBlankSpaceHeight));
}
super.onMeasure(newWidthMeasureSpec, heightMeasureSpec);
} | SamsungOneUi | positive | 3,046 |
public static void updateMenuIconColor(Context context, MenuItem m) {
if (m.getIcon() != null) {
m.getIcon().clearColorFilter();
m.getIcon().setColorFilter(getThemeColorAttr(context, m.isEnabled() ? android.R.attr.textColorTertiary : R.attr.colorPrimaryDark), PorterDuff.Mode.SRC_ATOP);
}
} | public static void updateMenuIconColor(Context context, MenuItem m) {
<DeepExtract>
if (m.getIcon() != null) {
m.getIcon().clearColorFilter();
m.getIcon().setColorFilter(getThemeColorAttr(context, m.isEnabled() ? android.R.attr.textColorTertiary : R.attr.colorPrimaryDark), PorterDuff.Mode.SRC_ATOP);
}
</DeepExtract>
} | onpc | positive | 3,047 |
public static String getSystemUrl(String value) {
Map<String, CodingSystem> urlMap = getUrlMap(Constants.CODING_SYSTEM_MAPPING);
if (StringUtils.startsWith(value, "http://") || StringUtils.startsWith(value, "https://") || StringUtils.startsWith(value, "urn")) {
return value;
} else if (value != null) {
CodingSystem system = urlMap.get(StringUtils.upperCase(value));
if (system != null) {
return system.getUrl();
}
}
return null;
} | public static String getSystemUrl(String value) {
<DeepExtract>
Map<String, CodingSystem> urlMap = getUrlMap(Constants.CODING_SYSTEM_MAPPING);
if (StringUtils.startsWith(value, "http://") || StringUtils.startsWith(value, "https://") || StringUtils.startsWith(value, "urn")) {
return value;
} else if (value != null) {
CodingSystem system = urlMap.get(StringUtils.upperCase(value));
if (system != null) {
return system.getUrl();
}
}
return null;
</DeepExtract>
} | hl7v2-fhir-converter | positive | 3,049 |
public static AlipayTradeCloseResponse tradeCloseToResponse(AlipayTradeCloseModel model) throws AlipayApiException {
AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
request.setBizModel(model);
if (AliPayApiConfigKit.getAliPayApiConfig().isCertModel()) {
return certificateExecute(request);
} else {
return execute(request);
}
} | public static AlipayTradeCloseResponse tradeCloseToResponse(AlipayTradeCloseModel model) throws AlipayApiException {
AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();
request.setBizModel(model);
<DeepExtract>
if (AliPayApiConfigKit.getAliPayApiConfig().isCertModel()) {
return certificateExecute(request);
} else {
return execute(request);
}
</DeepExtract>
} | IJPay | positive | 3,050 |
@Override
public CompletionStage<MemcacheStatus> append(final String key, final V value, final long cas) {
requireNonNull(value);
final byte[] valueBytes = valueTranscoder.encode(value);
SetRequest request = new SetRequest(OpCode.APPEND, encodeKey(key, charset, maxKeyLength), valueBytes, 0, cas, 0);
CompletionStage<MemcacheStatus> future = rawMemcacheClient.send(request);
metrics.measureSetFuture(future);
trace(OpCode.APPEND, key, valueBytes, future);
return future;
} | @Override
public CompletionStage<MemcacheStatus> append(final String key, final V value, final long cas) {
<DeepExtract>
requireNonNull(value);
final byte[] valueBytes = valueTranscoder.encode(value);
SetRequest request = new SetRequest(OpCode.APPEND, encodeKey(key, charset, maxKeyLength), valueBytes, 0, cas, 0);
CompletionStage<MemcacheStatus> future = rawMemcacheClient.send(request);
metrics.measureSetFuture(future);
trace(OpCode.APPEND, key, valueBytes, future);
return future;
</DeepExtract>
} | folsom | positive | 3,051 |
public String getDeleteSql(String schemaName, String tableName, String[] pkNames) {
StringBuilder sql = new StringBuilder();
sql.append("delete from ").append(makeFullName(schemaName, tableName)).append(" where ");
int size = pkNames.length;
for (int i = 0; i < size; i++) {
sql.append(" ").append(getColumnName(pkNames[i])).append(" = ").append("? ");
if (i != size - 1) {
sql.append("and");
}
}
return sql.toString().intern();
} | public String getDeleteSql(String schemaName, String tableName, String[] pkNames) {
StringBuilder sql = new StringBuilder();
sql.append("delete from ").append(makeFullName(schemaName, tableName)).append(" where ");
<DeepExtract>
int size = pkNames.length;
for (int i = 0; i < size; i++) {
sql.append(" ").append(getColumnName(pkNames[i])).append(" = ").append("? ");
if (i != size - 1) {
sql.append("and");
}
}
</DeepExtract>
return sql.toString().intern();
} | yugong | positive | 3,052 |
@Override
public boolean mouseMoved(int screenX, int screenY) {
messages.add("mouseMoved: screenX(" + screenX + ") screenY(" + screenY + ")" + " time: " + System.currentTimeMillis());
if (messages.size > MESSAGE_MAX) {
messages.removeIndex(0);
}
return true;
} | @Override
public boolean mouseMoved(int screenX, int screenY) {
<DeepExtract>
messages.add("mouseMoved: screenX(" + screenX + ") screenY(" + screenY + ")" + " time: " + System.currentTimeMillis());
if (messages.size > MESSAGE_MAX) {
messages.removeIndex(0);
}
</DeepExtract>
return true;
} | libgdx-cookbook | positive | 3,053 |
public static void touchScreenMove(Context ctx, int x, int y) {
byte[] report = new byte[6];
report[0] = 0x04;
if (false) {
report[1] = 0x01;
}
if (true) {
report[1] += 0x02;
}
report[2] = Util.getLSB(x);
report[3] = Util.getMSB(x);
report[4] = Util.getLSB(y);
report[5] = Util.getMSB(y);
touchScreenReport(ctx, report);
} | public static void touchScreenMove(Context ctx, int x, int y) {
<DeepExtract>
byte[] report = new byte[6];
report[0] = 0x04;
if (false) {
report[1] = 0x01;
}
if (true) {
report[1] += 0x02;
}
report[2] = Util.getLSB(x);
report[3] = Util.getMSB(x);
report[4] = Util.getLSB(y);
report[5] = Util.getMSB(y);
touchScreenReport(ctx, report);
</DeepExtract>
} | InputStickAPI-Android | positive | 3,054 |
public static void validateChainHash(ByteString hash, String name) throws ValidationException {
if (hash == null) {
throw new ValidationException(String.format("Missing %s", name));
}
if (hash.size() != Globals.BLOCKCHAIN_HASH_LEN) {
throw new ValidationException(String.format("Unexpected length for %s. Expected %d, got %d", name, Globals.BLOCKCHAIN_HASH_LEN, hash.size()));
}
} | public static void validateChainHash(ByteString hash, String name) throws ValidationException {
<DeepExtract>
if (hash == null) {
throw new ValidationException(String.format("Missing %s", name));
}
if (hash.size() != Globals.BLOCKCHAIN_HASH_LEN) {
throw new ValidationException(String.format("Unexpected length for %s. Expected %d, got %d", name, Globals.BLOCKCHAIN_HASH_LEN, hash.size()));
}
</DeepExtract>
} | snowblossom | positive | 3,056 |
@Override
public void onReset(LoggerContext context) {
log.info("Initializing Logstash logging");
LogstashTcpSocketAppender logstashAppender = new LogstashTcpSocketAppender();
logstashAppender.setName("LOGSTASH");
logstashAppender.setContext(context);
String customFields = "{\"app_name\":\"" + appName + "\",\"app_port\":\"" + serverPort + "\"}";
LogstashEncoder logstashEncoder = new LogstashEncoder();
logstashEncoder.setCustomFields(customFields);
logstashAppender.addDestinations(new InetSocketAddress(jHipsterProperties.getLogging().getLogstash().getHost(), jHipsterProperties.getLogging().getLogstash().getPort()));
ShortenedThrowableConverter throwableConverter = new ShortenedThrowableConverter();
throwableConverter.setRootCauseFirst(true);
logstashEncoder.setThrowableConverter(throwableConverter);
logstashEncoder.setCustomFields(customFields);
logstashAppender.setEncoder(logstashEncoder);
logstashAppender.start();
AsyncAppender asyncLogstashAppender = new AsyncAppender();
asyncLogstashAppender.setContext(context);
asyncLogstashAppender.setName("ASYNC_LOGSTASH");
asyncLogstashAppender.setQueueSize(jHipsterProperties.getLogging().getLogstash().getQueueSize());
asyncLogstashAppender.addAppender(logstashAppender);
asyncLogstashAppender.start();
context.getLogger("ROOT").addAppender(asyncLogstashAppender);
} | @Override
public void onReset(LoggerContext context) {
<DeepExtract>
log.info("Initializing Logstash logging");
LogstashTcpSocketAppender logstashAppender = new LogstashTcpSocketAppender();
logstashAppender.setName("LOGSTASH");
logstashAppender.setContext(context);
String customFields = "{\"app_name\":\"" + appName + "\",\"app_port\":\"" + serverPort + "\"}";
LogstashEncoder logstashEncoder = new LogstashEncoder();
logstashEncoder.setCustomFields(customFields);
logstashAppender.addDestinations(new InetSocketAddress(jHipsterProperties.getLogging().getLogstash().getHost(), jHipsterProperties.getLogging().getLogstash().getPort()));
ShortenedThrowableConverter throwableConverter = new ShortenedThrowableConverter();
throwableConverter.setRootCauseFirst(true);
logstashEncoder.setThrowableConverter(throwableConverter);
logstashEncoder.setCustomFields(customFields);
logstashAppender.setEncoder(logstashEncoder);
logstashAppender.start();
AsyncAppender asyncLogstashAppender = new AsyncAppender();
asyncLogstashAppender.setContext(context);
asyncLogstashAppender.setName("ASYNC_LOGSTASH");
asyncLogstashAppender.setQueueSize(jHipsterProperties.getLogging().getLogstash().getQueueSize());
asyncLogstashAppender.addAppender(logstashAppender);
asyncLogstashAppender.start();
context.getLogger("ROOT").addAppender(asyncLogstashAppender);
</DeepExtract>
} | ionic-jhipster-example | positive | 3,057 |
public PolyElement<E> sub(Element e) {
PolyElement<E> element = (PolyElement<E>) e;
n = coefficients.size();
n1 = element.coefficients.size();
if (n > n1) {
big = this;
n = n1;
n1 = coefficients.size();
} else {
big = element;
}
int k = coefficients.size();
while (k < n1) {
coefficients.add((E) field.getTargetField().newElement());
k++;
}
while (k > n1) {
k--;
coefficients.remove(coefficients.size() - 1);
}
for (i = 0; i < n; i++) {
coefficients.get(i).sub(element.coefficients.get(i));
}
for (; i < n1; i++) {
if (big == this) {
coefficients.get(i).set(big.coefficients.get(i));
} else {
coefficients.get(i).set(big.coefficients.get(i)).negate();
}
}
int n = coefficients.size() - 1;
while (n >= 0) {
Element e0 = coefficients.get(n);
if (!e0.isZero())
return;
coefficients.remove(n);
n--;
}
return this;
} | public PolyElement<E> sub(Element e) {
PolyElement<E> element = (PolyElement<E>) e;
n = coefficients.size();
n1 = element.coefficients.size();
if (n > n1) {
big = this;
n = n1;
n1 = coefficients.size();
} else {
big = element;
}
int k = coefficients.size();
while (k < n1) {
coefficients.add((E) field.getTargetField().newElement());
k++;
}
while (k > n1) {
k--;
coefficients.remove(coefficients.size() - 1);
}
for (i = 0; i < n; i++) {
coefficients.get(i).sub(element.coefficients.get(i));
}
for (; i < n1; i++) {
if (big == this) {
coefficients.get(i).set(big.coefficients.get(i));
} else {
coefficients.get(i).set(big.coefficients.get(i)).negate();
}
}
<DeepExtract>
int n = coefficients.size() - 1;
while (n >= 0) {
Element e0 = coefficients.get(n);
if (!e0.isZero())
return;
coefficients.remove(n);
n--;
}
</DeepExtract>
return this;
} | jlbc | positive | 3,059 |
public void setupCropBounds() {
int height = (int) (mThisWidth / mTargetAspectRatio);
if (height > mThisHeight) {
int width = (int) (mThisHeight * mTargetAspectRatio);
int halfDiff = (mThisWidth - width) / 2;
mCropViewRect.set(getPaddingLeft() + halfDiff, getPaddingTop(), getPaddingLeft() + width + halfDiff, getPaddingTop() + mThisHeight);
} else {
int halfDiff = (mThisHeight - height) / 2;
mCropViewRect.set(getPaddingLeft(), getPaddingTop() + halfDiff, getPaddingLeft() + mThisWidth, getPaddingTop() + height + halfDiff);
}
if (mCallback != null) {
mCallback.onCropRectUpdated(mCropViewRect);
}
mCropGridCorners = RectUtils.getCornersFromRect(mCropViewRect);
mCropGridCenter = RectUtils.getCenterFromRect(mCropViewRect);
mGridPoints = null;
mCircularPath.reset();
mCircularPath.addCircle(mCropViewRect.centerX(), mCropViewRect.centerY(), Math.min(mCropViewRect.width(), mCropViewRect.height()) / 2.f, Path.Direction.CW);
} | public void setupCropBounds() {
int height = (int) (mThisWidth / mTargetAspectRatio);
if (height > mThisHeight) {
int width = (int) (mThisHeight * mTargetAspectRatio);
int halfDiff = (mThisWidth - width) / 2;
mCropViewRect.set(getPaddingLeft() + halfDiff, getPaddingTop(), getPaddingLeft() + width + halfDiff, getPaddingTop() + mThisHeight);
} else {
int halfDiff = (mThisHeight - height) / 2;
mCropViewRect.set(getPaddingLeft(), getPaddingTop() + halfDiff, getPaddingLeft() + mThisWidth, getPaddingTop() + height + halfDiff);
}
if (mCallback != null) {
mCallback.onCropRectUpdated(mCropViewRect);
}
<DeepExtract>
mCropGridCorners = RectUtils.getCornersFromRect(mCropViewRect);
mCropGridCenter = RectUtils.getCenterFromRect(mCropViewRect);
mGridPoints = null;
mCircularPath.reset();
mCircularPath.addCircle(mCropViewRect.centerX(), mCropViewRect.centerY(), Math.min(mCropViewRect.width(), mCropViewRect.height()) / 2.f, Path.Direction.CW);
</DeepExtract>
} | Matisse-Kotlin | positive | 3,060 |
private void printall(Node parent) {
Map<String, Integer> map = new HashMap<>();
if (parent == null) {
String s = "";
return s;
}
String s = "(";
s += printduplicates(parent.left, map);
s += parent.data;
s += printduplicates(parent.right, map);
s += ")";
if (map.containsKey(s) && map.get(s) == 1) {
int i = 0;
System.out.print(parent.data + " ");
}
if (map.containsKey(s)) {
map.replace(s, map.get(s) + 1);
} else {
map.put(s, 1);
}
return s;
System.out.println(map);
int flag = 0;
if (flag == 0) {
System.out.println(-1);
}
} | private void printall(Node parent) {
Map<String, Integer> map = new HashMap<>();
<DeepExtract>
if (parent == null) {
String s = "";
return s;
}
String s = "(";
s += printduplicates(parent.left, map);
s += parent.data;
s += printduplicates(parent.right, map);
s += ")";
if (map.containsKey(s) && map.get(s) == 1) {
int i = 0;
System.out.print(parent.data + " ");
}
if (map.containsKey(s)) {
map.replace(s, map.get(s) + 1);
} else {
map.put(s, 1);
}
return s;
</DeepExtract>
System.out.println(map);
int flag = 0;
if (flag == 0) {
System.out.println(-1);
}
} | Java-Solutions | positive | 3,061 |
public Criteria andTypeGreaterThan(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "type" + " cannot be null");
}
criteria.add(new Criterion("type >", value));
return (Criteria) this;
} | public Criteria andTypeGreaterThan(Integer value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "type" + " cannot be null");
}
criteria.add(new Criterion("type >", value));
</DeepExtract>
return (Criteria) this;
} | community | positive | 3,062 |
public Tuple decodeArgs(byte[][] topics, byte[] data) {
Object[] result = new Object[inputs.size()];
for (int i = 0, topicIndex = 0, dataIndex = 0; i < indexManifest.length; i++) {
if (indexManifest[i]) {
result[i] = decodeTopicsArray(topics)[topicIndex++];
} else {
result[i] = decodeData(data).get(dataIndex++);
}
}
return new Tuple(result);
} | public Tuple decodeArgs(byte[][] topics, byte[] data) {
<DeepExtract>
Object[] result = new Object[inputs.size()];
for (int i = 0, topicIndex = 0, dataIndex = 0; i < indexManifest.length; i++) {
if (indexManifest[i]) {
result[i] = decodeTopicsArray(topics)[topicIndex++];
} else {
result[i] = decodeData(data).get(dataIndex++);
}
}
return new Tuple(result);
</DeepExtract>
} | headlong | positive | 3,063 |
public Criteria andSyncScriptEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "syncScript" + " cannot be null");
}
criteria.add(new Criterion("sync_script =", value));
return (Criteria) this;
} | public Criteria andSyncScriptEqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "syncScript" + " cannot be null");
}
criteria.add(new Criterion("sync_script =", value));
</DeepExtract>
return (Criteria) this;
} | AnyMock | positive | 3,064 |
void zoomOut() {
renderer.zoomOut();
createCanvas(BASE_CANVAS_WIDTH * renderer.getRelativeScale(), BASE_CANVAS_HEIGHT * renderer.getRelativeScale());
renderer.setCanvas(fieldCanvas);
renderer.doDraw();
} | void zoomOut() {
renderer.zoomOut();
<DeepExtract>
createCanvas(BASE_CANVAS_WIDTH * renderer.getRelativeScale(), BASE_CANVAS_HEIGHT * renderer.getRelativeScale());
renderer.setCanvas(fieldCanvas);
renderer.doDraw();
</DeepExtract>
} | Vector-Pinball-Editor | positive | 3,065 |
@Test
public void insert1000() throws SQLException {
stat.executeUpdate("create table in1000 (a);");
PreparedStatement prep = conn.prepareStatement("insert into in1000 values (?);");
conn.setAutoCommit(false);
for (int i = 0; i < 1000; i++) {
prep.setInt(1, i);
prep.executeUpdate();
}
conn.commit();
ResultSet rs = stat.executeQuery("select count(a) from in1000;");
assertTrue(rs.next());
assertEquals(rs.getInt(1), 1000);
stat.close();
conn.close();
} | @Test
public void insert1000() throws SQLException {
stat.executeUpdate("create table in1000 (a);");
PreparedStatement prep = conn.prepareStatement("insert into in1000 values (?);");
conn.setAutoCommit(false);
for (int i = 0; i < 1000; i++) {
prep.setInt(1, i);
prep.executeUpdate();
}
conn.commit();
ResultSet rs = stat.executeQuery("select count(a) from in1000;");
assertTrue(rs.next());
assertEquals(rs.getInt(1), 1000);
<DeepExtract>
stat.close();
conn.close();
</DeepExtract>
} | spatialite4-jdbc | positive | 3,066 |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
mTop = new LinearLayout(this);
mTop.setOrientation(LinearLayout.VERTICAL);
LinearLayout bottom = new LinearLayout(this);
mLog = new TextView(this);
mLog.setSingleLine(false);
ScrollView scrollView = new ScrollView(this);
scrollView.addView(mLog);
bottom.addView(scrollView, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1));
ListView actionList = new ListView(this);
onRegisterAction(mActionAdapter);
actionList.setAdapter(mActionAdapter);
bottom.addView(new SeperatorView(this, SeperatorView.MODE_VERTICAL));
bottom.addView(actionList, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1));
LinearLayout container = new LinearLayout(this);
container.setOrientation(LinearLayout.VERTICAL);
ScrollView topScrollView = new ScrollView(this);
topScrollView.addView(mTop);
topScrollView.setBackgroundColor(Color.WHITE);
container.addView(topScrollView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 3));
container.addView(new SeperatorView(this, SeperatorView.MODE_HORIZENTAL));
container.addView(bottom, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 2));
setContentView(container);
} | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
<DeepExtract>
mTop = new LinearLayout(this);
mTop.setOrientation(LinearLayout.VERTICAL);
LinearLayout bottom = new LinearLayout(this);
mLog = new TextView(this);
mLog.setSingleLine(false);
ScrollView scrollView = new ScrollView(this);
scrollView.addView(mLog);
bottom.addView(scrollView, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1));
ListView actionList = new ListView(this);
onRegisterAction(mActionAdapter);
actionList.setAdapter(mActionAdapter);
bottom.addView(new SeperatorView(this, SeperatorView.MODE_VERTICAL));
bottom.addView(actionList, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1));
LinearLayout container = new LinearLayout(this);
container.setOrientation(LinearLayout.VERTICAL);
ScrollView topScrollView = new ScrollView(this);
topScrollView.addView(mTop);
topScrollView.setBackgroundColor(Color.WHITE);
container.addView(topScrollView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 3));
container.addView(new SeperatorView(this, SeperatorView.MODE_HORIZENTAL));
container.addView(bottom, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 2));
setContentView(container);
</DeepExtract>
} | rxjava-examples | positive | 3,067 |
public static void install(Application application, TestRefWatcher refWatcher) {
stopWatchingActivities();
application.registerActivityLifecycleCallbacks(lifecycleCallbacks);
} | public static void install(Application application, TestRefWatcher refWatcher) {
<DeepExtract>
stopWatchingActivities();
application.registerActivityLifecycleCallbacks(lifecycleCallbacks);
</DeepExtract>
} | GH-Demo | positive | 3,068 |
public Criteria andStatusNotIn(List<Byte> values) {
if (values == null) {
throw new RuntimeException("Value for " + "status" + " cannot be null");
}
criteria.add(new Criterion("status not in", values));
return (Criteria) this;
} | public Criteria andStatusNotIn(List<Byte> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "status" + " cannot be null");
}
criteria.add(new Criterion("status not in", values));
</DeepExtract>
return (Criteria) this;
} | uccn | positive | 3,069 |
@Override
public CompletableFuture<RecordList<T, K>> nativeQueryListAsync(String sql, @Nullable Collection<?> parameters) throws SQLRuntimeException {
GaarasonDataSource gaarasonDataSource = getGaarasonDataSource();
boolean inTransaction = gaarasonDataSource.isLocalThreadInTransaction();
if (inTransaction) {
U value = doSomethingInConnection(preparedStatement -> {
ResultSet resultSet = preparedStatement.executeQuery();
return RecordFactory.newRecordList(getSelf(), resultSet, sql);
}, sql, parameters, false);
return CompletableFuture.completedFuture(value);
} else {
return CompletableFuture.supplyAsync(() -> doSomethingInConnection(preparedStatement -> {
ResultSet resultSet = preparedStatement.executeQuery();
return RecordFactory.newRecordList(getSelf(), resultSet, sql);
}, sql, parameters, false), getExecutorService());
}
} | @Override
public CompletableFuture<RecordList<T, K>> nativeQueryListAsync(String sql, @Nullable Collection<?> parameters) throws SQLRuntimeException {
<DeepExtract>
GaarasonDataSource gaarasonDataSource = getGaarasonDataSource();
boolean inTransaction = gaarasonDataSource.isLocalThreadInTransaction();
if (inTransaction) {
U value = doSomethingInConnection(preparedStatement -> {
ResultSet resultSet = preparedStatement.executeQuery();
return RecordFactory.newRecordList(getSelf(), resultSet, sql);
}, sql, parameters, false);
return CompletableFuture.completedFuture(value);
} else {
return CompletableFuture.supplyAsync(() -> doSomethingInConnection(preparedStatement -> {
ResultSet resultSet = preparedStatement.executeQuery();
return RecordFactory.newRecordList(getSelf(), resultSet, sql);
}, sql, parameters, false), getExecutorService());
}
</DeepExtract>
} | database-all | positive | 3,070 |
public final void ReadFromBytes(byte[] bytes) {
MyBuffer buff = new MyBuffer(bytes);
privateFlag = buff.get();
text = buff.getString();
} | public final void ReadFromBytes(byte[] bytes) {
MyBuffer buff = new MyBuffer(bytes);
privateFlag = buff.get();
<DeepExtract>
text = buff.getString();
</DeepExtract>
} | jt808server | positive | 3,071 |
@Override
public String getString(int columnIndex) {
super.checkPosition();
if (mWindow == null) {
throw new StaleDataException("Access closed cursor");
}
synchronized (mUpdatedRows) {
if (isFieldUpdated(columnIndex)) {
return (String) getUpdatedField(columnIndex);
}
}
return mWindow.getString(mPos, columnIndex);
} | @Override
public String getString(int columnIndex) {
<DeepExtract>
super.checkPosition();
if (mWindow == null) {
throw new StaleDataException("Access closed cursor");
}
</DeepExtract>
synchronized (mUpdatedRows) {
if (isFieldUpdated(columnIndex)) {
return (String) getUpdatedField(columnIndex);
}
}
return mWindow.getString(mPos, columnIndex);
} | android-database-sqlcipher | positive | 3,072 |
public void save(File file) {
for (int x = 1; x < this.arraySizeX - 1; x++) {
for (int y = 1; y < this.arraySizeY - 1; y++) {
for (int z = 1; z < this.arraySizeZ - 1; z++) {
if (isAirBlockInitiate(x, y, z)) {
this.isAirBlock[x][y][z] = true;
markNeighbors(x, y, z);
} else {
this.isAirBlock[x][y][z] = false;
}
}
}
}
markBorder();
int i = 0;
do {
Console.info("run");
this.rerun -= 1;
for (int y = 1; y < this.arraySizeY - 1; y++) {
for (int x = 1; x < this.arraySizeX - 1; x++) {
for (int z = 1; z < this.arraySizeZ - 1; z++) {
if (this.isNextToAir[x][y][z]) {
this.addableManager.add(x, y, z);
}
}
}
}
if (this.rerun > 0) {
Console.info("run");
int[][][] temp = this.materiatFieldRerun;
this.materiatFieldRerun = this.materialField;
this.materialField = temp;
this.rerun -= 1;
for (int y = 1; y < this.arraySizeY - 1; y++) {
for (int x = 1; x < this.arraySizeX - 1; x++) {
for (int z = 1; z < this.arraySizeZ - 1; z++) {
if (this.isNextToAir[x][y][z]) {
this.addableManager.add(x, y, z);
}
}
}
}
temp = this.materiatFieldRerun;
this.materiatFieldRerun = this.materialField;
this.materialField = temp;
this.rerun -= 1;
}
} while (this.rerun > 0);
addSubBlocksMap();
addSkyShell();
this.target.save(file);
} | public void save(File file) {
<DeepExtract>
for (int x = 1; x < this.arraySizeX - 1; x++) {
for (int y = 1; y < this.arraySizeY - 1; y++) {
for (int z = 1; z < this.arraySizeZ - 1; z++) {
if (isAirBlockInitiate(x, y, z)) {
this.isAirBlock[x][y][z] = true;
markNeighbors(x, y, z);
} else {
this.isAirBlock[x][y][z] = false;
}
}
}
}
markBorder();
int i = 0;
do {
Console.info("run");
this.rerun -= 1;
for (int y = 1; y < this.arraySizeY - 1; y++) {
for (int x = 1; x < this.arraySizeX - 1; x++) {
for (int z = 1; z < this.arraySizeZ - 1; z++) {
if (this.isNextToAir[x][y][z]) {
this.addableManager.add(x, y, z);
}
}
}
}
if (this.rerun > 0) {
Console.info("run");
int[][][] temp = this.materiatFieldRerun;
this.materiatFieldRerun = this.materialField;
this.materialField = temp;
this.rerun -= 1;
for (int y = 1; y < this.arraySizeY - 1; y++) {
for (int x = 1; x < this.arraySizeX - 1; x++) {
for (int z = 1; z < this.arraySizeZ - 1; z++) {
if (this.isNextToAir[x][y][z]) {
this.addableManager.add(x, y, z);
}
}
}
}
temp = this.materiatFieldRerun;
this.materiatFieldRerun = this.materialField;
this.materialField = temp;
this.rerun -= 1;
}
} while (this.rerun > 0);
addSubBlocksMap();
addSkyShell();
</DeepExtract>
this.target.save(file);
} | SourceCraft-Reborn | positive | 3,073 |
private static void genTagFeatures(List<Feature> f, Token[] tokens, int i) throws IOException {
if (i - 1 > 0)
addFeature(f, tokens[i].getNE() + tokens[i - 1].getNE());
f.add(new Feature(tokens[i].getNE() + tokens[i].getToken()));
if (i - 1 > 0)
addFeature(f, tokens[i].getNE() + tokens[i - 1].getToken());
if (i + 1 < tokens.length)
addFeature(f, tokens[i].getNE() + tokens[i + 1].getToken());
} | private static void genTagFeatures(List<Feature> f, Token[] tokens, int i) throws IOException {
if (i - 1 > 0)
addFeature(f, tokens[i].getNE() + tokens[i - 1].getNE());
<DeepExtract>
f.add(new Feature(tokens[i].getNE() + tokens[i].getToken()));
</DeepExtract>
if (i - 1 > 0)
addFeature(f, tokens[i].getNE() + tokens[i - 1].getToken());
if (i + 1 < tokens.length)
addFeature(f, tokens[i].getNE() + tokens[i + 1].getToken());
} | geolocator-3.0 | positive | 3,074 |
public StringBuilder appendln(String str) {
sb = sb.append(System.lineSeparator());
return this;
return this;
} | public StringBuilder appendln(String str) {
<DeepExtract>
sb = sb.append(System.lineSeparator());
return this;
</DeepExtract>
return this;
} | startup-os | positive | 3,075 |
public void saveVar(float var, String filename) {
if (text == null || !filename.equals(currentFile)) {
text = new Text();
text.write(filename, "", false);
currentFile = filename;
}
text.write(filename, String.valueOf(var), true);
} | public void saveVar(float var, String filename) {
<DeepExtract>
if (text == null || !filename.equals(currentFile)) {
text = new Text();
text.write(filename, "", false);
currentFile = filename;
}
</DeepExtract>
text.write(filename, String.valueOf(var), true);
} | promoss | positive | 3,077 |
private void extractConfigAnnotation(final VariableElement element) {
for (Class<? extends Annotation> configAnnotationClass : Configs.ALL) {
final Annotation annotation = element.getAnnotation(configAnnotationClass);
if (annotation != null) {
mConfigAnnotation = new LibraryConfigAnnotationParser(annotation);
return;
}
}
final List<? extends AnnotationMirror> elementAnnotations = element.getAnnotationMirrors();
for (AnnotationMirror annotationMirror : elementAnnotations) {
if (hasConfigTypeAnnotation(annotationMirror)) {
mConfigAnnotation = new CustomConfigAnnotationParser(mTypes, annotationMirror);
}
}
} | private void extractConfigAnnotation(final VariableElement element) {
for (Class<? extends Annotation> configAnnotationClass : Configs.ALL) {
final Annotation annotation = element.getAnnotation(configAnnotationClass);
if (annotation != null) {
mConfigAnnotation = new LibraryConfigAnnotationParser(annotation);
return;
}
}
<DeepExtract>
final List<? extends AnnotationMirror> elementAnnotations = element.getAnnotationMirrors();
for (AnnotationMirror annotationMirror : elementAnnotations) {
if (hasConfigTypeAnnotation(annotationMirror)) {
mConfigAnnotation = new CustomConfigAnnotationParser(mTypes, annotationMirror);
}
}
</DeepExtract>
} | aircon | positive | 3,078 |
@Override
protected void convertToVillager() {
EntityVillager villager = new EntityVillager(worldObj);
villager.copyLocationAndAnglesFrom(this);
setType(worldObj.rand.nextInt(6));
return super.onSpawnWithEgg((IEntityLivingData) null);
villager.setLookingForHome();
villager.setProfession(getType());
if (isChild())
villager.setGrowingAge(-24000);
worldObj.removeEntity(this);
worldObj.spawnEntityInWorld(villager);
villager.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0));
worldObj.playAuxSFXAtEntity(null, 1017, (int) posX, (int) posY, (int) posZ, 0);
} | @Override
protected void convertToVillager() {
EntityVillager villager = new EntityVillager(worldObj);
villager.copyLocationAndAnglesFrom(this);
<DeepExtract>
setType(worldObj.rand.nextInt(6));
return super.onSpawnWithEgg((IEntityLivingData) null);
</DeepExtract>
villager.setLookingForHome();
villager.setProfession(getType());
if (isChild())
villager.setGrowingAge(-24000);
worldObj.removeEntity(this);
worldObj.spawnEntityInWorld(villager);
villager.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0));
worldObj.playAuxSFXAtEntity(null, 1017, (int) posX, (int) posY, (int) posZ, 0);
} | Et-Futurum | positive | 3,079 |
public void newPwsStartScan() {
Utils.setPwsEndpoint(this, mPwCollection);
stopScan();
mScanStartTime = new Date().getTime();
startScan();
} | public void newPwsStartScan() {
Utils.setPwsEndpoint(this, mPwCollection);
<DeepExtract>
stopScan();
mScanStartTime = new Date().getTime();
startScan();
</DeepExtract>
} | physical-web | positive | 3,080 |
@Override
protected void actionPerformed(GuiButton button) throws IOException {
switch(button.id) {
case 1:
if (inventorySlots.getSlot(0).getStack() != null) {
refreshRecipe();
}
break;
case 2:
JustEnoughCalculation.proxy.getPlayerHandler().syncItemCalculator(inventorySlots.getSlot(0).getStack(), textFieldAmount.getText());
mc.displayGuiScreen(new GuiRecipeEditor(new ContainerRecipeEditor(), this));
break;
case 3:
List<Integer> list;
if (activeSlot == -1) {
list = JustEnoughCalculation.proxy.getPlayerHandler().getAllRecipeIndexOf(inventorySlots.getSlot(0).getStack(), null);
} else {
list = JustEnoughCalculation.proxy.getPlayerHandler().getAllRecipeIndexOf(inventorySlots.getSlot(activeSlot).getStack(), null);
}
mc.displayGuiScreen(new GuiRecipePicker(new ContainerRecipe(), this, list));
break;
case 4:
if (page > 1) {
page--;
}
break;
case 5:
if (page < total) {
page++;
}
break;
case 6:
switch(mode) {
case INPUT:
mode = EnumMode.OUTPUT;
break;
case OUTPUT:
mode = EnumMode.CATALYST;
break;
case CATALYST:
mode = EnumMode.INPUT;
break;
}
page = 1;
break;
case 7:
mc.displayGuiScreen(new GuiRecipeViewer(new ContainerRecipeViewer(), this));
break;
}
switch(mode) {
case OUTPUT:
buttonMode.displayString = StatCollector.translateToLocal("gui.calculator.output");
break;
case INPUT:
buttonMode.displayString = StatCollector.translateToLocal("gui.calculator.input");
break;
case CATALYST:
buttonMode.displayString = StatCollector.translateToLocal("gui.calculator.catalyst");
break;
}
boolean b = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipeOf(inventorySlots.getSlot(0).getStack(), null);
if (activeSlot == -1) {
buttonEdit.enabled = b;
} else {
buttonEdit.enabled = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipeOf(inventorySlots.getSlot(activeSlot).getStack(), null);
}
buttonCalculate.enabled = b;
buttonView.enabled = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipe(null);
if (costRecord != null) {
switch(mode) {
case OUTPUT:
total = (costRecord.getOutputStack().size() + 35) / 36;
fillSlotsWith(costRecord.getOutputStack(), (page - 1) * 36);
break;
case INPUT:
total = (costRecord.getInputStack().size() + 35) / 36;
fillSlotsWith(costRecord.getInputStack(), (page - 1) * 36);
break;
case CATALYST:
total = (costRecord.getCatalystStack().size() + 35) / 36;
fillSlotsWith(costRecord.getCatalystStack(), (page - 1) * 36);
break;
}
} else {
fillSlotsWith(new ArrayList<ItemStack>(), 0);
total = 0;
}
buttonLeft.enabled = page != 1;
buttonRight.enabled = page < total;
buttonView.enabled = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipe(null);
if (JustEnoughCalculation.JECConfig.EnumItems.EnableInventoryCheck.getProperty().getBoolean()) {
checkItem();
}
} | @Override
protected void actionPerformed(GuiButton button) throws IOException {
switch(button.id) {
case 1:
if (inventorySlots.getSlot(0).getStack() != null) {
refreshRecipe();
}
break;
case 2:
JustEnoughCalculation.proxy.getPlayerHandler().syncItemCalculator(inventorySlots.getSlot(0).getStack(), textFieldAmount.getText());
mc.displayGuiScreen(new GuiRecipeEditor(new ContainerRecipeEditor(), this));
break;
case 3:
List<Integer> list;
if (activeSlot == -1) {
list = JustEnoughCalculation.proxy.getPlayerHandler().getAllRecipeIndexOf(inventorySlots.getSlot(0).getStack(), null);
} else {
list = JustEnoughCalculation.proxy.getPlayerHandler().getAllRecipeIndexOf(inventorySlots.getSlot(activeSlot).getStack(), null);
}
mc.displayGuiScreen(new GuiRecipePicker(new ContainerRecipe(), this, list));
break;
case 4:
if (page > 1) {
page--;
}
break;
case 5:
if (page < total) {
page++;
}
break;
case 6:
switch(mode) {
case INPUT:
mode = EnumMode.OUTPUT;
break;
case OUTPUT:
mode = EnumMode.CATALYST;
break;
case CATALYST:
mode = EnumMode.INPUT;
break;
}
page = 1;
break;
case 7:
mc.displayGuiScreen(new GuiRecipeViewer(new ContainerRecipeViewer(), this));
break;
}
<DeepExtract>
switch(mode) {
case OUTPUT:
buttonMode.displayString = StatCollector.translateToLocal("gui.calculator.output");
break;
case INPUT:
buttonMode.displayString = StatCollector.translateToLocal("gui.calculator.input");
break;
case CATALYST:
buttonMode.displayString = StatCollector.translateToLocal("gui.calculator.catalyst");
break;
}
boolean b = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipeOf(inventorySlots.getSlot(0).getStack(), null);
if (activeSlot == -1) {
buttonEdit.enabled = b;
} else {
buttonEdit.enabled = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipeOf(inventorySlots.getSlot(activeSlot).getStack(), null);
}
buttonCalculate.enabled = b;
buttonView.enabled = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipe(null);
if (costRecord != null) {
switch(mode) {
case OUTPUT:
total = (costRecord.getOutputStack().size() + 35) / 36;
fillSlotsWith(costRecord.getOutputStack(), (page - 1) * 36);
break;
case INPUT:
total = (costRecord.getInputStack().size() + 35) / 36;
fillSlotsWith(costRecord.getInputStack(), (page - 1) * 36);
break;
case CATALYST:
total = (costRecord.getCatalystStack().size() + 35) / 36;
fillSlotsWith(costRecord.getCatalystStack(), (page - 1) * 36);
break;
}
} else {
fillSlotsWith(new ArrayList<ItemStack>(), 0);
total = 0;
}
buttonLeft.enabled = page != 1;
buttonRight.enabled = page < total;
buttonView.enabled = JustEnoughCalculation.proxy.getPlayerHandler().getHasRecipe(null);
if (JustEnoughCalculation.JECConfig.EnumItems.EnableInventoryCheck.getProperty().getBoolean()) {
checkItem();
}
</DeepExtract>
} | JustEnoughCalculation | positive | 3,081 |
public static int[] get_artist_mbtags_count(H5File h5, int songidx) throws Exception {
H5CompoundDS analysis = (H5CompoundDS) h5.get("musicbrainz" + "/songs");
analysis.init();
if ("idx_artist_mbtags".equals(""))
"idx_artist_mbtags" = "idx_" + "artist_mbtags_count";
int wantedMember = find(analysis.getMemberNames(), "idx_artist_mbtags");
assert (wantedMember >= 0);
Vector alldata = (Vector) analysis.getData();
int[] col = (int[]) alldata.get(wantedMember);
int pos1 = col[songidx];
H5ScalarDS array = (H5ScalarDS) h5.get("/" + "musicbrainz" + "/" + "artist_mbtags_count");
int[] data = (int[]) array.getData();
int pos2 = data.length;
if (songidx + 1 < col.length)
pos2 = col[songidx + 1];
int[] res = new int[pos2 - pos1];
for (int k = 0; k < res.length; k++) res[k] = data[pos1 + k];
return res;
} | public static int[] get_artist_mbtags_count(H5File h5, int songidx) throws Exception {
<DeepExtract>
H5CompoundDS analysis = (H5CompoundDS) h5.get("musicbrainz" + "/songs");
analysis.init();
if ("idx_artist_mbtags".equals(""))
"idx_artist_mbtags" = "idx_" + "artist_mbtags_count";
int wantedMember = find(analysis.getMemberNames(), "idx_artist_mbtags");
assert (wantedMember >= 0);
Vector alldata = (Vector) analysis.getData();
int[] col = (int[]) alldata.get(wantedMember);
int pos1 = col[songidx];
H5ScalarDS array = (H5ScalarDS) h5.get("/" + "musicbrainz" + "/" + "artist_mbtags_count");
int[] data = (int[]) array.getData();
int pos2 = data.length;
if (songidx + 1 < col.length)
pos2 = col[songidx + 1];
int[] res = new int[pos2 - pos1];
for (int k = 0; k < res.length; k++) res[k] = data[pos1 + k];
return res;
</DeepExtract>
} | Modulo7 | positive | 3,082 |
private void moveEventDeal(float eventX, float eventY) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
Point point = mPoints[i][j];
float dx = Math.abs(eventX - point.x);
float dy = Math.abs(eventY - point.y);
if (Math.sqrt(dx * dx + dy * dy) < mRadius) {
point.status = Point.POINT_PRESS_STATUS;
addPressPoint(point);
return;
}
}
}
} | private void moveEventDeal(float eventX, float eventY) {
<DeepExtract>
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
Point point = mPoints[i][j];
float dx = Math.abs(eventX - point.x);
float dy = Math.abs(eventY - point.y);
if (Math.sqrt(dx * dx + dy * dy) < mRadius) {
point.status = Point.POINT_PRESS_STATUS;
addPressPoint(point);
return;
}
}
}
</DeepExtract>
} | EnableHands | positive | 3,083 |
public static int getMaxExpBefore(int x, int j) {
if (j < 0) {
throw new UnsupportedOperationException();
}
if (j == 0) {
x = 1;
}
j--;
int xp = 2;
while (j > 0) {
j--;
xp *= 2;
}
return xp;
int exp = -1;
while (x > 0) {
exp++;
x /= 2;
}
return exp;
} | public static int getMaxExpBefore(int x, int j) {
if (j < 0) {
throw new UnsupportedOperationException();
}
if (j == 0) {
x = 1;
}
j--;
int xp = 2;
while (j > 0) {
j--;
xp *= 2;
}
return xp;
<DeepExtract>
int exp = -1;
while (x > 0) {
exp++;
x /= 2;
}
return exp;
</DeepExtract>
} | choco-graph | positive | 3,084 |
public void read(org.apache.thrift.protocol.TProtocol iprot, ping_result struct) throws org.apache.thrift.TException {
iprot.readStructBegin();
while (true) {
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch(schemeField.id) {
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
} | public void read(org.apache.thrift.protocol.TProtocol iprot, ping_result struct) throws org.apache.thrift.TException {
<DeepExtract>
</DeepExtract>
iprot.readStructBegin();
<DeepExtract>
</DeepExtract>
while (true) {
<DeepExtract>
</DeepExtract>
schemeField = iprot.readFieldBegin();
<DeepExtract>
</DeepExtract>
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
<DeepExtract>
</DeepExtract>
break;
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
switch(schemeField.id) {
<DeepExtract>
</DeepExtract>
default:
<DeepExtract>
</DeepExtract>
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
iprot.readFieldEnd();
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
iprot.readStructEnd();
<DeepExtract>
</DeepExtract>
} | Thrift-Connection-Pool | positive | 3,086 |
public void _set_object_ref(long ref) {
if (this.ref_ != 0) {
long ref = _get_object_ref();
_delete_object_ref(ref);
this.ref_ = 0;
}
this.ref_ = _narrow_object_ref(ref);
} | public void _set_object_ref(long ref) {
<DeepExtract>
if (this.ref_ != 0) {
long ref = _get_object_ref();
_delete_object_ref(ref);
this.ref_ = 0;
}
</DeepExtract>
this.ref_ = _narrow_object_ref(ref);
} | framework-core | positive | 3,087 |
public MappedFunction map(Object function, Object... arguments) throws ArityException, UnsupportedTypeException {
Object[] args = new Object[arguments.length + 1];
args[0] = function;
System.arraycopy(arguments, 0, args, 1, arguments.length);
if (args.length == 0) {
throw ArityException.create(1, 0);
}
Object function = args[0];
if (!INTEROP.isExecutable(function)) {
throw UnsupportedTypeException.create(args, "expecting executable function as first argument");
}
String description = null;
if (args.length > 1) {
Object last = args[args.length - 1];
if (INTEROP.isString(last)) {
try {
description = INTEROP.asString(last);
} catch (UnsupportedMessageException e) {
throw new GrCUDAInternalException("mismatch between isString and asString");
}
}
}
Object[] values = new Object[args.length - 1 - (description == null ? 0 : 1)];
ArgumentSet argSet = new ArgumentSet();
ArgumentSet shreddedArgSet = new ArgumentSet();
ArgumentSet valueSet = new ArgumentSet();
for (int i = 0; i < values.length; i++) {
values[i] = bindArgument(args[i + 1], argSet, shreddedArgSet, valueSet);
}
Object boundReturn = bindArgument(returnValue, argSet, shreddedArgSet, valueSet);
int[] shreddedIndexes = new int[shreddedArgSet.nameList.size()];
for (String name : shreddedArgSet.nameList.getKeys()) {
shreddedIndexes[shreddedArgSet.nameList.get(name)] = argSet.readMember(name);
}
Integer returnValueIndex = valueSet.nameList.get("return");
return new MappedFunction(function, values, shreddedIndexes, valueSet.nameList.size(), boundReturn, returnValueIndex, description);
} | public MappedFunction map(Object function, Object... arguments) throws ArityException, UnsupportedTypeException {
Object[] args = new Object[arguments.length + 1];
args[0] = function;
System.arraycopy(arguments, 0, args, 1, arguments.length);
<DeepExtract>
if (args.length == 0) {
throw ArityException.create(1, 0);
}
Object function = args[0];
if (!INTEROP.isExecutable(function)) {
throw UnsupportedTypeException.create(args, "expecting executable function as first argument");
}
String description = null;
if (args.length > 1) {
Object last = args[args.length - 1];
if (INTEROP.isString(last)) {
try {
description = INTEROP.asString(last);
} catch (UnsupportedMessageException e) {
throw new GrCUDAInternalException("mismatch between isString and asString");
}
}
}
Object[] values = new Object[args.length - 1 - (description == null ? 0 : 1)];
ArgumentSet argSet = new ArgumentSet();
ArgumentSet shreddedArgSet = new ArgumentSet();
ArgumentSet valueSet = new ArgumentSet();
for (int i = 0; i < values.length; i++) {
values[i] = bindArgument(args[i + 1], argSet, shreddedArgSet, valueSet);
}
Object boundReturn = bindArgument(returnValue, argSet, shreddedArgSet, valueSet);
int[] shreddedIndexes = new int[shreddedArgSet.nameList.size()];
for (String name : shreddedArgSet.nameList.getKeys()) {
shreddedIndexes[shreddedArgSet.nameList.get(name)] = argSet.readMember(name);
}
Integer returnValueIndex = valueSet.nameList.get("return");
return new MappedFunction(function, values, shreddedIndexes, valueSet.nameList.size(), boundReturn, returnValueIndex, description);
</DeepExtract>
} | grcuda | positive | 3,088 |
public Criteria andBalanceIsNull() {
if ("balance is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("balance is null"));
return (Criteria) this;
} | public Criteria andBalanceIsNull() {
<DeepExtract>
if ("balance is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("balance is null"));
</DeepExtract>
return (Criteria) this;
} | Online_Study_System | positive | 3,089 |
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields;
switch(fieldId) {
case 1:
fields = ID;
default:
fields = null;
}
if (fields == null)
throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
} | public static _Fields findByThriftIdOrThrow(int fieldId) {
<DeepExtract>
_Fields fields;
switch(fieldId) {
case 1:
fields = ID;
default:
fields = null;
}
</DeepExtract>
if (fields == null)
throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
} | imooc-Docker-Kubernetes-k8s | positive | 3,090 |
@Override
@Transactional
public String auth(Authentication auth) {
RESTAssert.assertNotNull(auth);
if ((auth.getToken() == null) || auth.getToken().isEmpty()) {
RESTAssert.assertNotEmpty(auth.getUsername());
RESTAssert.assertNotEmpty(auth.getPassword());
EUser user = this.authHandler.getUser(auth.getUsername(), auth.getPassword());
return this.getToken(user, AuthType.PERSON, null);
}
RESTAssert.assertNotEmpty(auth.getToken());
EUser user = this.authHandler.getUser(auth.getToken());
if (user == null) {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
EJWTToken ejwtToken = this.tokenHandler.generateJWTToken(user, AuthType.AGENT, auth.getToken());
if (ejwtToken == null) {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
return ejwtToken.getToken();
} | @Override
@Transactional
public String auth(Authentication auth) {
RESTAssert.assertNotNull(auth);
if ((auth.getToken() == null) || auth.getToken().isEmpty()) {
RESTAssert.assertNotEmpty(auth.getUsername());
RESTAssert.assertNotEmpty(auth.getPassword());
EUser user = this.authHandler.getUser(auth.getUsername(), auth.getPassword());
return this.getToken(user, AuthType.PERSON, null);
}
RESTAssert.assertNotEmpty(auth.getToken());
EUser user = this.authHandler.getUser(auth.getToken());
<DeepExtract>
if (user == null) {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
EJWTToken ejwtToken = this.tokenHandler.generateJWTToken(user, AuthType.AGENT, auth.getToken());
if (ejwtToken == null) {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
return ejwtToken.getToken();
</DeepExtract>
} | cloudconductor-server | positive | 3,091 |
private void myTouchUp(int id) {
touches[id].x = -1;
touches[id].y = -1;
if (id == touchid) {
touchid = -1;
deltax = deltay = touchx = touchy = 0;
touches_on_bk--;
}
clearDeltaXY();
return true;
if (id == touchid) {
touchid = -1;
deltax = deltay = touchx = touchy = 0;
touches_on_bk--;
}
clearDeltaXY();
return true;
if (id == touchid) {
touchid = -1;
deltax = deltay = touchx = touchy = 0;
touches_on_bk--;
}
clearDeltaXY();
return true;
for (MyPiece p : pieces) {
p.touchUp(id);
}
for (InvisibleDPad idp : invdpads) {
idp.touchUp(id);
}
} | private void myTouchUp(int id) {
touches[id].x = -1;
touches[id].y = -1;
<DeepExtract>
if (id == touchid) {
touchid = -1;
deltax = deltay = touchx = touchy = 0;
touches_on_bk--;
}
clearDeltaXY();
return true;
</DeepExtract>
if (id == touchid) {
touchid = -1;
deltax = deltay = touchx = touchy = 0;
touches_on_bk--;
}
clearDeltaXY();
return true;
<DeepExtract>
if (id == touchid) {
touchid = -1;
deltax = deltay = touchx = touchy = 0;
touches_on_bk--;
}
clearDeltaXY();
return true;
</DeepExtract>
for (MyPiece p : pieces) {
p.touchUp(id);
}
for (InvisibleDPad idp : invdpads) {
idp.touchUp(id);
}
} | midisheetmusicmemo | positive | 3,092 |
public void setStrokeWidth(float strokeWidth) {
mStrokeWidth = strokeWidth;
mArcPaint.setStrokeWidth(strokeWidth);
mRingCallback.invalidateDrawable(null);
} | public void setStrokeWidth(float strokeWidth) {
mStrokeWidth = strokeWidth;
mArcPaint.setStrokeWidth(strokeWidth);
<DeepExtract>
mRingCallback.invalidateDrawable(null);
</DeepExtract>
} | Android-rxjava-retrofit-okhttp-app | positive | 3,093 |
protected void setStepMethodFromElement(Element traceEventElement) {
String stepMethod = null;
Element element = traceEventElement.element("StepMethod");
if (element != null) {
stepMethod = element.getText();
} else {
element = traceEventElement.element("DBTSQLOperation");
if (element != null) {
stepMethod = element.getText();
}
}
this.stepMethod = stepMethod;
} | protected void setStepMethodFromElement(Element traceEventElement) {
String stepMethod = null;
Element element = traceEventElement.element("StepMethod");
if (element != null) {
stepMethod = element.getText();
} else {
element = traceEventElement.element("DBTSQLOperation");
if (element != null) {
stepMethod = element.getText();
}
}
<DeepExtract>
this.stepMethod = stepMethod;
</DeepExtract>
} | pega-tracerviewer | positive | 3,094 |
@Test
public void twoRowRS() throws SQLException {
PreparedStatement prep = conn.prepareStatement("select ? union all select ?;");
prep.setDouble(1, Double.MAX_VALUE);
prep.setDouble(2, Double.MIN_VALUE);
ResultSet rs = prep.executeQuery();
assertTrue(rs.next());
assertEquals(Double.MAX_VALUE, rs.getDouble(1));
assertTrue(rs.next());
assertEquals(Double.MIN_VALUE, rs.getDouble(1));
assertFalse(rs.next());
stat.close();
conn.close();
} | @Test
public void twoRowRS() throws SQLException {
PreparedStatement prep = conn.prepareStatement("select ? union all select ?;");
prep.setDouble(1, Double.MAX_VALUE);
prep.setDouble(2, Double.MIN_VALUE);
ResultSet rs = prep.executeQuery();
assertTrue(rs.next());
assertEquals(Double.MAX_VALUE, rs.getDouble(1));
assertTrue(rs.next());
assertEquals(Double.MIN_VALUE, rs.getDouble(1));
assertFalse(rs.next());
<DeepExtract>
stat.close();
conn.close();
</DeepExtract>
} | sqlitejdbc | positive | 3,095 |
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields;
switch(fieldId) {
case 1:
fields = ID;
case 2:
fields = NAME;
case 3:
fields = AGE;
default:
fields = null;
}
if (fields == null)
throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
} | public static _Fields findByThriftIdOrThrow(int fieldId) {
<DeepExtract>
_Fields fields;
switch(fieldId) {
case 1:
fields = ID;
case 2:
fields = NAME;
case 3:
fields = AGE;
default:
fields = null;
}
</DeepExtract>
if (fields == null)
throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
} | dubbo-thrift | positive | 3,096 |
@OnClick(R.id.mButton2)
public void onClick2() {
Toast.makeText(this, "Click2", Toast.LENGTH_SHORT).show();
View dialogView = getLayoutInflater().inflate(R.layout.ui_dialog, null);
new MaterialDialog.Builder(this).customView(dialogView, false).show();
} | @OnClick(R.id.mButton2)
public void onClick2() {
<DeepExtract>
Toast.makeText(this, "Click2", Toast.LENGTH_SHORT).show();
</DeepExtract>
View dialogView = getLayoutInflater().inflate(R.layout.ui_dialog, null);
new MaterialDialog.Builder(this).customView(dialogView, false).show();
} | AndroidPlayground | positive | 3,097 |
public void actionPerformed(ActionEvent e) {
try {
goWithForge(new FileInputStream(new File(txtForgeJar.getText())));
} catch (FileNotFoundException e) {
displayError("File not found: " + txtForgeJar.getText());
}
} | public void actionPerformed(ActionEvent e) {
<DeepExtract>
try {
goWithForge(new FileInputStream(new File(txtForgeJar.getText())));
} catch (FileNotFoundException e) {
displayError("File not found: " + txtForgeJar.getText());
}
</DeepExtract>
} | bearded-octo-nemesis | positive | 3,098 |
private void initialPaint() {
backgroundPaint.setStyle(Paint.Style.FILL);
barPaint.setStyle(Paint.Style.FILL);
backgroundPaint.setColor(Color.argb(255, 90, 90, 90));
invalidate();
barPaint.setColor(0xFFFF4081);
invalidate();
} | private void initialPaint() {
backgroundPaint.setStyle(Paint.Style.FILL);
barPaint.setStyle(Paint.Style.FILL);
backgroundPaint.setColor(Color.argb(255, 90, 90, 90));
invalidate();
<DeepExtract>
barPaint.setColor(0xFFFF4081);
invalidate();
</DeepExtract>
} | BeatmapService | positive | 3,099 |
public K proxy(String host, int port) {
proxy = new HttpHost(host, port);
return (K) this;
} | public K proxy(String host, int port) {
proxy = new HttpHost(host, port);
<DeepExtract>
return (K) this;
</DeepExtract>
} | androidquery | positive | 3,101 |
@Override
public void updateMeasureState(final TextPaint paint) {
int oldStyle;
Typeface old = paint.getTypeface();
if (old == null) {
oldStyle = 0;
} else {
oldStyle = old.getStyle();
}
int fake = oldStyle & ~newType.getStyle();
if ((fake & Typeface.BOLD) != 0) {
paint.setFakeBoldText(true);
}
if ((fake & Typeface.ITALIC) != 0) {
paint.setTextSkewX(-0.25f);
}
paint.getShader();
paint.setTypeface(newType);
} | @Override
public void updateMeasureState(final TextPaint paint) {
<DeepExtract>
int oldStyle;
Typeface old = paint.getTypeface();
if (old == null) {
oldStyle = 0;
} else {
oldStyle = old.getStyle();
}
int fake = oldStyle & ~newType.getStyle();
if ((fake & Typeface.BOLD) != 0) {
paint.setFakeBoldText(true);
}
if ((fake & Typeface.ITALIC) != 0) {
paint.setTextSkewX(-0.25f);
}
paint.getShader();
paint.setTypeface(newType);
</DeepExtract>
} | Android-utils | positive | 3,102 |
public void delete() {
SQLiteDatabase db = dbHelper.getWritableDatabase();
db.delete(TABLE, null, null);
this.dbHelper.close();
} | public void delete() {
SQLiteDatabase db = dbHelper.getWritableDatabase();
db.delete(TABLE, null, null);
<DeepExtract>
this.dbHelper.close();
</DeepExtract>
} | LearningAndroidYamba | positive | 3,103 |
@Test
public void testLegalMarcInJson() throws Exception {
InputStream input = getResourceAsStream(StaticTestRecords.RESOURCES_LEGAL_JSON_MARC_IN_JSON_JSON);
MarcReader reader = new MarcJsonReader(input);
if (!reader.hasNext()) {
fail("should have at least one record");
}
Record record = reader.next();
TestUtils.validateFreewheelingBobDylanRecord(record);
if (reader.hasNext()) {
fail("should not have more than one record");
}
} | @Test
public void testLegalMarcInJson() throws Exception {
<DeepExtract>
InputStream input = getResourceAsStream(StaticTestRecords.RESOURCES_LEGAL_JSON_MARC_IN_JSON_JSON);
MarcReader reader = new MarcJsonReader(input);
if (!reader.hasNext()) {
fail("should have at least one record");
}
Record record = reader.next();
TestUtils.validateFreewheelingBobDylanRecord(record);
if (reader.hasNext()) {
fail("should not have more than one record");
}
</DeepExtract>
} | marc4j | positive | 3,104 |
public void setBr(float val) {
br = val;
hue = hueModulo(hue);
sat = constrain(sat, 0, 1);
br = constrain(br, 0, 1);
alpha = constrain(alpha, 0, 1);
} | public void setBr(float val) {
br = val;
<DeepExtract>
hue = hueModulo(hue);
sat = constrain(sat, 0, 1);
br = constrain(br, 0, 1);
alpha = constrain(alpha, 0, 1);
</DeepExtract>
} | ProcessingSketches | positive | 3,105 |
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
TextView label = new TextView(Term.this);
String title = getSessionTitle(position, getString(R.string.window_title, position + 1));
label.setText(title);
if (AndroidCompat.SDK >= 13) {
label.setTextAppearance(Term.this, TextAppearance_Holo_Widget_ActionBar_Title);
} else {
label.setTextAppearance(Term.this, android.R.style.TextAppearance_Medium);
}
return label;
} | @Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
<DeepExtract>
TextView label = new TextView(Term.this);
String title = getSessionTitle(position, getString(R.string.window_title, position + 1));
label.setText(title);
if (AndroidCompat.SDK >= 13) {
label.setTextAppearance(Term.this, TextAppearance_Holo_Widget_ActionBar_Title);
} else {
label.setTextAppearance(Term.this, android.R.style.TextAppearance_Medium);
}
return label;
</DeepExtract>
} | ANDROID_Terminal_Emulator | positive | 3,106 |
@Override
public Object buildItem(Cursor c) {
Integer sectionId = IndexGroupAdapter.IndexGroupUtils.getSectionId(c);
String database = IndexGroupAdapter.IndexGroupUtils.getDatabase(c);
String name = IndexGroupAdapter.IndexGroupUtils.getName(c);
String url = IndexGroupAdapter.IndexGroupUtils.getUrl(c);
String description = IndexGroupAdapter.IndexGroupUtils.getDescription(c);
String prereqs = IndexGroupAdapter.IndexGroupUtils.getFeatPrereqs(c);
String featTypes = IndexGroupAdapter.IndexGroupUtils.getFeatTypes(c);
FeatListItem fla = new FeatListItem();
fla.setSectionId(sectionId);
fla.setDatabase(database);
fla.setName(name);
fla.setUrl(url);
fla.setDescription(description);
fla.setPrereqs(prereqs);
fla.setFeatTypes(featTypes);
return fla;
} | @Override
public Object buildItem(Cursor c) {
Integer sectionId = IndexGroupAdapter.IndexGroupUtils.getSectionId(c);
String database = IndexGroupAdapter.IndexGroupUtils.getDatabase(c);
String name = IndexGroupAdapter.IndexGroupUtils.getName(c);
String url = IndexGroupAdapter.IndexGroupUtils.getUrl(c);
String description = IndexGroupAdapter.IndexGroupUtils.getDescription(c);
String prereqs = IndexGroupAdapter.IndexGroupUtils.getFeatPrereqs(c);
String featTypes = IndexGroupAdapter.IndexGroupUtils.getFeatTypes(c);
<DeepExtract>
FeatListItem fla = new FeatListItem();
fla.setSectionId(sectionId);
fla.setDatabase(database);
fla.setName(name);
fla.setUrl(url);
fla.setDescription(description);
fla.setPrereqs(prereqs);
fla.setFeatTypes(featTypes);
return fla;
</DeepExtract>
} | PathfinderOpenReference | positive | 3,107 |
public void actionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
this.dispose();
} | public void actionPerformed(java.awt.event.ActionEvent evt) {
<DeepExtract>
this.setVisible(false);
this.dispose();
</DeepExtract>
} | tmc-netbeans | positive | 3,108 |
@NonNull
public MapperOptions missingFields(@NonNull final MissingItemsBehaviour missingFields) {
Objects.requireNonNull(missingFields, "Missing fields behaviour is required");
MapperOptions clone;
try {
clone = (MapperOptions) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
clone.missingFields = missingFields;
return clone;
} | @NonNull
public MapperOptions missingFields(@NonNull final MissingItemsBehaviour missingFields) {
Objects.requireNonNull(missingFields, "Missing fields behaviour is required");
<DeepExtract>
MapperOptions clone;
try {
clone = (MapperOptions) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
</DeepExtract>
clone.missingFields = missingFields;
return clone;
} | nifi-influxdb-bundle | positive | 3,110 |
public static PoseSteering[] loadPathFromFile(String fileName) {
ArrayList<PoseSteering> ret = new ArrayList<PoseSteering>();
try {
Scanner in = new Scanner(new FileReader(fileName));
String prevLine = "Gibberish";
while (in.hasNextLine()) {
String line = in.nextLine().trim();
if (!line.equals(prevLine)) {
prevLine = line;
if (line.length() != 0) {
String[] oneline = line.split(" |\t");
PoseSteering ps = null;
if (oneline.length == 4) {
ps = new PoseSteering(Double.parseDouble(oneline[0]), Double.parseDouble(oneline[1]), Double.parseDouble(oneline[2]), Double.parseDouble(oneline[3]));
} else {
ps = new PoseSteering(Double.parseDouble(oneline[0]), Double.parseDouble(oneline[1]), Double.parseDouble(oneline[2]), 0.0);
}
ret.add(ps);
}
}
}
in.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
PoseSteering[] retArray = ret.toArray(new PoseSteering[ret.size()]);
if (minPathDistance < 0)
return retArray;
ArrayList<PoseSteering> ret = new ArrayList<PoseSteering>();
PoseSteering lastAdded = retArray[0];
ret.add(lastAdded);
for (int i = 1; i < retArray.length; i++) {
Coordinate p1 = lastAdded.getPose().getPosition();
Coordinate p2 = retArray[i].getPose().getPosition();
if (p2.distance(p1) > minPathDistance) {
lastAdded = retArray[i];
ret.add(retArray[i]);
}
}
return ret.toArray(new PoseSteering[ret.size()]);
} | public static PoseSteering[] loadPathFromFile(String fileName) {
ArrayList<PoseSteering> ret = new ArrayList<PoseSteering>();
try {
Scanner in = new Scanner(new FileReader(fileName));
String prevLine = "Gibberish";
while (in.hasNextLine()) {
String line = in.nextLine().trim();
if (!line.equals(prevLine)) {
prevLine = line;
if (line.length() != 0) {
String[] oneline = line.split(" |\t");
PoseSteering ps = null;
if (oneline.length == 4) {
ps = new PoseSteering(Double.parseDouble(oneline[0]), Double.parseDouble(oneline[1]), Double.parseDouble(oneline[2]), Double.parseDouble(oneline[3]));
} else {
ps = new PoseSteering(Double.parseDouble(oneline[0]), Double.parseDouble(oneline[1]), Double.parseDouble(oneline[2]), 0.0);
}
ret.add(ps);
}
}
}
in.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
PoseSteering[] retArray = ret.toArray(new PoseSteering[ret.size()]);
<DeepExtract>
if (minPathDistance < 0)
return retArray;
ArrayList<PoseSteering> ret = new ArrayList<PoseSteering>();
PoseSteering lastAdded = retArray[0];
ret.add(lastAdded);
for (int i = 1; i < retArray.length; i++) {
Coordinate p1 = lastAdded.getPose().getPosition();
Coordinate p2 = retArray[i].getPose().getPosition();
if (p2.distance(p1) > minPathDistance) {
lastAdded = retArray[i];
ret.add(retArray[i]);
}
}
return ret.toArray(new PoseSteering[ret.size()]);
</DeepExtract>
} | coordination_oru | positive | 3,111 |
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
pref_btcguildKey = prefs.getString("btcguildKey", "");
pref_widgetMiningPayoutUnit = Integer.parseInt(prefs.getString("widgetMiningPayoutUnitPref", "0"));
View view = inflater.inflate(R.layout.fragment_table, container, false);
if (minerProgressDialog != null && minerProgressDialog.isShowing())
return;
Context context = view.getContext();
if (context != null)
minerProgressDialog = ProgressDialog.show(context, getString(R.string.working), getString(R.string.retreivingMinerStats), true, false);
MinerStatsThread gt = new MinerStatsThread();
gt.start();
return view;
} | @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
pref_btcguildKey = prefs.getString("btcguildKey", "");
pref_widgetMiningPayoutUnit = Integer.parseInt(prefs.getString("widgetMiningPayoutUnitPref", "0"));
View view = inflater.inflate(R.layout.fragment_table, container, false);
<DeepExtract>
if (minerProgressDialog != null && minerProgressDialog.isShowing())
return;
Context context = view.getContext();
if (context != null)
minerProgressDialog = ProgressDialog.show(context, getString(R.string.working), getString(R.string.retreivingMinerStats), true, false);
MinerStatsThread gt = new MinerStatsThread();
gt.start();
</DeepExtract>
return view;
} | bitcoinium | positive | 3,112 |
private void delete() {
if (Tools.isEmpty(etKeyDelete.getText().toString())) {
etKeyDelete.setError(getString(R.string.empty));
return;
}
sharedPreferences.edit().remove(etKeyDelete.getText().toString()).apply();
Tools.toast(this, etKeyDelete.getText().toString() + " remove !");
} | private void delete() {
if (Tools.isEmpty(etKeyDelete.getText().toString())) {
etKeyDelete.setError(getString(R.string.empty));
return;
}
sharedPreferences.edit().remove(etKeyDelete.getText().toString()).apply();
<DeepExtract>
Tools.toast(this, etKeyDelete.getText().toString() + " remove !");
</DeepExtract>
} | Android-development-with-example | positive | 3,113 |
public CommandState execute(CommandState state, String[] args) throws Exception {
CommandLine line = CommandLineHelper.getCommandLine(getUsage(), getOptions(), args);
if (line == null) {
return null;
}
IOHelper ioHelper = CommandLineHelper.getIOHelper(line);
if (state == null) {
state = new CommandState();
}
OWLOntology leftOntology = null;
if (state.getOntology() != null) {
leftOntology = state.getOntology();
}
if (leftOntology == null) {
String leftOntologyPath = CommandLineHelper.getOptionalValue(line, "left");
String leftOntologyIRI = CommandLineHelper.getOptionalValue(line, "left-iri");
String leftOntologyCatalog = CommandLineHelper.getOptionalValue(line, "left-catalog");
leftOntology = setOntology(ioHelper, leftOntologyPath, leftOntologyIRI, leftOntologyCatalog);
}
if (leftOntology == null) {
throw new IllegalArgumentException(missingLeftError);
}
String rightOntologyPath = CommandLineHelper.getOptionalValue(line, "right");
String rightOntologyIRI = CommandLineHelper.getOptionalValue(line, "right-iri");
String rightOntologyCatalog = CommandLineHelper.getOptionalValue(line, "right-catalog");
OWLOntology rightOntology;
if (rightOntologyPath != null && rightOntologyIRI != null) {
throw new IllegalArgumentException(doubleInputError);
} else if (rightOntologyPath != null) {
if (rightOntologyCatalog != null) {
rightOntology = ioHelper.loadOntology(rightOntologyPath, rightOntologyCatalog);
} else {
rightOntology = ioHelper.loadOntology(rightOntologyPath);
}
} else if (rightOntologyIRI != null) {
if (rightOntologyCatalog != null) {
rightOntology = ioHelper.loadOntology(IRI.create(rightOntologyIRI), rightOntologyCatalog);
} else {
rightOntology = ioHelper.loadOntology(IRI.create(rightOntologyIRI));
}
} else
rightOntology = null;
if (rightOntology == null) {
throw new IllegalArgumentException(missingRightError);
}
String outputPath = CommandLineHelper.getOptionalValue(line, "output");
if (outputPath != null) {
writer = new FileWriter(outputPath);
} else {
writer = new PrintWriter(System.out);
}
Map<String, String> options = new HashMap<>();
options.put("labels", CommandLineHelper.getDefaultValue(line, "labels", "false"));
options.put("format", CommandLineHelper.getDefaultValue(line, "format", "plain"));
DiffOperation.compare(leftOntology, rightOntology, ioHelper, writer, options);
writer.flush();
writer.close();
return state;
} | public CommandState execute(CommandState state, String[] args) throws Exception {
CommandLine line = CommandLineHelper.getCommandLine(getUsage(), getOptions(), args);
if (line == null) {
return null;
}
IOHelper ioHelper = CommandLineHelper.getIOHelper(line);
if (state == null) {
state = new CommandState();
}
OWLOntology leftOntology = null;
if (state.getOntology() != null) {
leftOntology = state.getOntology();
}
if (leftOntology == null) {
String leftOntologyPath = CommandLineHelper.getOptionalValue(line, "left");
String leftOntologyIRI = CommandLineHelper.getOptionalValue(line, "left-iri");
String leftOntologyCatalog = CommandLineHelper.getOptionalValue(line, "left-catalog");
leftOntology = setOntology(ioHelper, leftOntologyPath, leftOntologyIRI, leftOntologyCatalog);
}
if (leftOntology == null) {
throw new IllegalArgumentException(missingLeftError);
}
String rightOntologyPath = CommandLineHelper.getOptionalValue(line, "right");
String rightOntologyIRI = CommandLineHelper.getOptionalValue(line, "right-iri");
String rightOntologyCatalog = CommandLineHelper.getOptionalValue(line, "right-catalog");
<DeepExtract>
OWLOntology rightOntology;
if (rightOntologyPath != null && rightOntologyIRI != null) {
throw new IllegalArgumentException(doubleInputError);
} else if (rightOntologyPath != null) {
if (rightOntologyCatalog != null) {
rightOntology = ioHelper.loadOntology(rightOntologyPath, rightOntologyCatalog);
} else {
rightOntology = ioHelper.loadOntology(rightOntologyPath);
}
} else if (rightOntologyIRI != null) {
if (rightOntologyCatalog != null) {
rightOntology = ioHelper.loadOntology(IRI.create(rightOntologyIRI), rightOntologyCatalog);
} else {
rightOntology = ioHelper.loadOntology(IRI.create(rightOntologyIRI));
}
} else
rightOntology = null;
</DeepExtract>
if (rightOntology == null) {
throw new IllegalArgumentException(missingRightError);
}
String outputPath = CommandLineHelper.getOptionalValue(line, "output");
if (outputPath != null) {
writer = new FileWriter(outputPath);
} else {
writer = new PrintWriter(System.out);
}
Map<String, String> options = new HashMap<>();
options.put("labels", CommandLineHelper.getDefaultValue(line, "labels", "false"));
options.put("format", CommandLineHelper.getDefaultValue(line, "format", "plain"));
DiffOperation.compare(leftOntology, rightOntology, ioHelper, writer, options);
writer.flush();
writer.close();
return state;
} | robot | positive | 3,114 |
@Override
public void onBindViewHolder(@NonNull InstanceHolder holder, int position) {
cursor.moveToPosition(holder.getAdapterPosition());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onItemClick(v, holder.getAdapterPosition());
}
});
holder.title.setText(cursor.getString(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.DISPLAY_NAME)));
long lastStatusChangeDate = getCursor().getLong(getCursor().getColumnIndex(InstanceProviderAPI.InstanceColumns.LAST_STATUS_CHANGE_DATE));
String status = getCursor().getString(getCursor().getColumnIndex(InstanceProviderAPI.InstanceColumns.STATUS));
String subtext;
try {
if (status == null) {
subtext = new SimpleDateFormat(context.getString(R.string.added_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else if (InstanceProviderAPI.STATUS_INCOMPLETE.equalsIgnoreCase(status)) {
subtext = new SimpleDateFormat(context.getString(R.string.saved_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else if (InstanceProviderAPI.STATUS_COMPLETE.equalsIgnoreCase(status)) {
subtext = new SimpleDateFormat(context.getString(R.string.finalized_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else if (InstanceProviderAPI.STATUS_SUBMITTED.equalsIgnoreCase(status)) {
subtext = new SimpleDateFormat(context.getString(R.string.sent_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else if (InstanceProviderAPI.STATUS_SUBMISSION_FAILED.equalsIgnoreCase(status)) {
subtext = new SimpleDateFormat(context.getString(R.string.sending_failed_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else {
subtext = new SimpleDateFormat(context.getString(R.string.added_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
}
} catch (IllegalArgumentException e) {
Timber.e(e);
subtext = "";
}
holder.subtitle.setText(subtext);
long id = cursor.getLong(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns._ID));
holder.checkBox.setChecked(selectedInstances.contains(id));
holder.reviewedForms.setVisibility(View.GONE);
holder.unReviewedForms.setVisibility(View.GONE);
} | @Override
public void onBindViewHolder(@NonNull InstanceHolder holder, int position) {
cursor.moveToPosition(holder.getAdapterPosition());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listener.onItemClick(v, holder.getAdapterPosition());
}
});
holder.title.setText(cursor.getString(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.DISPLAY_NAME)));
long lastStatusChangeDate = getCursor().getLong(getCursor().getColumnIndex(InstanceProviderAPI.InstanceColumns.LAST_STATUS_CHANGE_DATE));
String status = getCursor().getString(getCursor().getColumnIndex(InstanceProviderAPI.InstanceColumns.STATUS));
<DeepExtract>
String subtext;
try {
if (status == null) {
subtext = new SimpleDateFormat(context.getString(R.string.added_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else if (InstanceProviderAPI.STATUS_INCOMPLETE.equalsIgnoreCase(status)) {
subtext = new SimpleDateFormat(context.getString(R.string.saved_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else if (InstanceProviderAPI.STATUS_COMPLETE.equalsIgnoreCase(status)) {
subtext = new SimpleDateFormat(context.getString(R.string.finalized_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else if (InstanceProviderAPI.STATUS_SUBMITTED.equalsIgnoreCase(status)) {
subtext = new SimpleDateFormat(context.getString(R.string.sent_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else if (InstanceProviderAPI.STATUS_SUBMISSION_FAILED.equalsIgnoreCase(status)) {
subtext = new SimpleDateFormat(context.getString(R.string.sending_failed_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
} else {
subtext = new SimpleDateFormat(context.getString(R.string.added_on_date_at_time), Locale.getDefault()).format(new Date(lastStatusChangeDate));
}
} catch (IllegalArgumentException e) {
Timber.e(e);
subtext = "";
}
</DeepExtract>
holder.subtitle.setText(subtext);
long id = cursor.getLong(cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns._ID));
holder.checkBox.setChecked(selectedInstances.contains(id));
holder.reviewedForms.setVisibility(View.GONE);
holder.unReviewedForms.setVisibility(View.GONE);
} | skunkworks-crow | positive | 3,115 |
public void setItem(mindustry.gen.Building build, mindustry.type.Item item, int amount) {
original = Vars.net;
staticNet.setNet(net).setProvider(provider);
Vars.net = staticNet;
mindustry.gen.Call.setItem(build, item, amount);
Vars.net = original;
original = null;
} | public void setItem(mindustry.gen.Building build, mindustry.type.Item item, int amount) {
original = Vars.net;
staticNet.setNet(net).setProvider(provider);
Vars.net = staticNet;
mindustry.gen.Call.setItem(build, item, amount);
<DeepExtract>
Vars.net = original;
original = null;
</DeepExtract>
} | Mindustry-Ozone | positive | 3,116 |
public void insertOrUpdateCategory(Category categoryNew) {
if (categoryNew == null) {
return;
}
CategoryDao categoryDao = MyApplication.getDaoSession().getCategoryDao();
Category categoryOld;
if (TextUtils.isEmpty(categoryNew.getKey())) {
categoryOld = null;
}
CategoryDao categoryDao = MyApplication.getDaoSession().getCategoryDao();
QueryBuilder<Category> queryBuilder = categoryDao.queryBuilder().where(CategoryDao.Properties.SelfKey.eq(categoryNew.getKey()));
if (queryBuilder.list().size() > 0) {
categoryOld = queryBuilder.list().get(0);
} else {
categoryOld = null;
}
if (categoryOld != null) {
ArrayList<String> contentUrlOld = categoryOld.getContentUrls();
ArrayList<String> contentUrlNew = categoryNew.getContentUrls();
if (!contentUrlOld.toString().equals(contentUrlNew.toString())) {
categoryNew.setId(categoryOld.getId());
categoryDao.update(categoryNew);
return;
}
ArrayList<String> nextNameOld = categoryOld.getNextNames();
ArrayList<String> nextNameNew = categoryNew.getNextNames();
if (!nextNameOld.toString().equals(nextNameNew.toString())) {
categoryNew.setId(categoryOld.getId());
categoryDao.update(categoryNew);
}
} else {
categoryDao.insert(categoryNew);
}
} | public void insertOrUpdateCategory(Category categoryNew) {
if (categoryNew == null) {
return;
}
CategoryDao categoryDao = MyApplication.getDaoSession().getCategoryDao();
<DeepExtract>
Category categoryOld;
if (TextUtils.isEmpty(categoryNew.getKey())) {
categoryOld = null;
}
CategoryDao categoryDao = MyApplication.getDaoSession().getCategoryDao();
QueryBuilder<Category> queryBuilder = categoryDao.queryBuilder().where(CategoryDao.Properties.SelfKey.eq(categoryNew.getKey()));
if (queryBuilder.list().size() > 0) {
categoryOld = queryBuilder.list().get(0);
} else {
categoryOld = null;
}
</DeepExtract>
if (categoryOld != null) {
ArrayList<String> contentUrlOld = categoryOld.getContentUrls();
ArrayList<String> contentUrlNew = categoryNew.getContentUrls();
if (!contentUrlOld.toString().equals(contentUrlNew.toString())) {
categoryNew.setId(categoryOld.getId());
categoryDao.update(categoryNew);
return;
}
ArrayList<String> nextNameOld = categoryOld.getNextNames();
ArrayList<String> nextNameNew = categoryNew.getNextNames();
if (!nextNameOld.toString().equals(nextNameNew.toString())) {
categoryNew.setId(categoryOld.getId());
categoryDao.update(categoryNew);
}
} else {
categoryDao.insert(categoryNew);
}
} | AiYue | positive | 3,117 |
public Criteria andParm2EqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "parm2" + " cannot be null");
}
criteria.add(new Criterion("PARM2 =", value));
return (Criteria) this;
} | public Criteria andParm2EqualTo(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "parm2" + " cannot be null");
}
criteria.add(new Criterion("PARM2 =", value));
</DeepExtract>
return (Criteria) this;
} | console | positive | 3,118 |
@Override
public LocalDateTime component4() {
return (LocalDateTime) get(3);
} | @Override
public LocalDateTime component4() {
<DeepExtract>
return (LocalDateTime) get(3);
</DeepExtract>
} | wdumper | positive | 3,119 |
public void loadMore() {
mStartLoadingTime = System.currentTimeMillis();
mStatus = PULL_UP;
mScroller.startScroll(0, getScrollY(), 0, mFooterHoldingPosition - getScrollY(), 400);
invalidate();
if (!isLoading) {
isLoading = true;
mListener.onLoadMore();
}
if (mStatus == PULL_DOWN) {
mHeaderIndicator.onLoading();
}
if (mStatus == PULL_UP) {
mFooterIndicator.onLoading();
}
} | public void loadMore() {
mStartLoadingTime = System.currentTimeMillis();
mStatus = PULL_UP;
mScroller.startScroll(0, getScrollY(), 0, mFooterHoldingPosition - getScrollY(), 400);
invalidate();
if (!isLoading) {
isLoading = true;
mListener.onLoadMore();
}
<DeepExtract>
if (mStatus == PULL_DOWN) {
mHeaderIndicator.onLoading();
}
if (mStatus == PULL_UP) {
mFooterIndicator.onLoading();
}
</DeepExtract>
} | QuickDevLib | positive | 3,121 |
@Override
public double convert(double d, BitUnit u) {
return toBits(d) / C_KIBIT;
} | @Override
public double convert(double d, BitUnit u) {
<DeepExtract>
return toBits(d) / C_KIBIT;
</DeepExtract>
} | hive-io-experimental | positive | 3,122 |
@Override
public void run() {
ISelection selection;
ISelectionProvider selectionProvider = getSelectionProvider();
if (selectionProvider != null)
selection = selectionProvider.getSelection();
else
selection = null;
if (selection instanceof ITextSelection) {
ITextSelection sel = (ITextSelection) selection;
System.err.println(sel);
try {
String[] lines = sel.getText().split("\n");
String newText = "{% for item in items %}\n";
for (String line : lines) {
newText += "\t" + line + "\n";
}
newText += "{% endfor %}\n";
getDocument().replace(sel.getOffset(), sel.getLength(), newText);
} catch (BadLocationException e) {
Logger.logException(e);
}
}
} | @Override
public void run() {
<DeepExtract>
ISelection selection;
ISelectionProvider selectionProvider = getSelectionProvider();
if (selectionProvider != null)
selection = selectionProvider.getSelection();
else
selection = null;
</DeepExtract>
if (selection instanceof ITextSelection) {
ITextSelection sel = (ITextSelection) selection;
System.err.println(sel);
try {
String[] lines = sel.getText().split("\n");
String newText = "{% for item in items %}\n";
for (String line : lines) {
newText += "\t" + line + "\n";
}
newText += "{% endfor %}\n";
getDocument().replace(sel.getOffset(), sel.getLength(), newText);
} catch (BadLocationException e) {
Logger.logException(e);
}
}
} | Twig-Eclipse-Plugin | positive | 3,123 |
private void nextQuestionActualQuiz() {
if (actualQuiz.isAdventureMode()) {
this.currQuestion = actualQuiz.getQuestion(this.idNextQuestion);
} else {
this.questionIndex++;
this.currQuestion = actualQuiz.getQuestion(ids.get(questionIndex));
}
if (currAnswers == null)
this.currAnswers = null;
Iterator<QuizAnswerDataItem> i = currAnswers.iterator();
List<String> toReturn = new ArrayList<String>();
while (i.hasNext()) {
QuizAnswerDataItem actual = (QuizAnswerDataItem) i.next();
toReturn.add(actual.getAnsText());
}
return toReturn;
Collections.shuffle(currAnswers);
} | private void nextQuestionActualQuiz() {
if (actualQuiz.isAdventureMode()) {
this.currQuestion = actualQuiz.getQuestion(this.idNextQuestion);
} else {
this.questionIndex++;
this.currQuestion = actualQuiz.getQuestion(ids.get(questionIndex));
}
<DeepExtract>
if (currAnswers == null)
this.currAnswers = null;
Iterator<QuizAnswerDataItem> i = currAnswers.iterator();
List<String> toReturn = new ArrayList<String>();
while (i.hasNext()) {
QuizAnswerDataItem actual = (QuizAnswerDataItem) i.next();
toReturn.add(actual.getAnsText());
}
return toReturn;
</DeepExtract>
Collections.shuffle(currAnswers);
} | emobc-android | positive | 3,125 |
public static void main(String[] args) throws FileNotFoundException {
String loc = "chr1:183,269,781-183,413,660";
loc = "chr1:134,869,918-134,928,273";
loc = "chr1:120,176,951-120,213,058";
loc = "chr1:95,650,693-95,689,757";
loc = "chr1:95,685,317-95,699,849";
loc = "chr1:88,235,609-88,268,664";
loc = "chr1:80,249,083-80,347,157";
loc = loc.replaceAll(",", "");
String chr = loc.split(":")[0];
int start = Integer.parseInt(loc.split(":")[1].split("-")[0]);
int end = Integer.parseInt(loc.split(":")[1].split("-")[1]);
String segmentationBed = "test_segmentation.bed";
String junctionBed = "test_junctions.bed";
SamReader sfr = SamReaderFactory.makeDefault().open(new File("/home/sol/data/sangercenter/hippocampus.bam"));
BEDIterator bi = new BEDIterator("test3.bed");
BEDWriter bw = new BEDWriter(segmentationBed);
for (AnnotatedRegion r : bi) {
if (r.chr.equals(chr) && r.start >= start && r.end <= end) {
System.out.println(r);
bw.write(r.chr, r.start, r.end, '.');
}
}
bw.close();
List<AnnotatedRegion> junctions = FindSpliceJunctions.spliceJunction(sfr, chr, start, end, true);
BEDWriter bw = new BEDWriter(junctionBed);
for (AnnotatedRegion r : junctions) {
bw.write(r.chr, r.start, r.end, r.strand);
}
bw.close();
BEDIterator junction_it = new BEDIterator(junctionBed);
StrandedGenomicIntervalTree<Map<String, Object>> junctions = new StrandedGenomicIntervalTree<Map<String, Object>>();
List<AnnotatedRegion> splices = new LinkedList<AnnotatedRegion>();
MapCounter<String> mc = new MapCounter<String>();
for (AnnotatedRegion junction : junction_it) {
boolean contained = false;
for (AnnotatedRegion overlap : junctions.overlappingRegions(junction.chr, junction.start, junction.end, junction.strand)) {
if (overlap.start == junction.start && overlap.end == junction.end) {
contained = true;
}
}
if (!contained) {
System.out.println(junction);
junctions.add(junction);
splices.add(junction);
}
mc.increment(junction.toString());
}
Collections.sort(splices, new Comparator<AnnotatedRegion>() {
public int compare(AnnotatedRegion arg0, AnnotatedRegion arg1) {
if (arg0.start != arg1.start)
return arg0.start - arg1.start;
else
return arg0.end - arg1.end;
}
});
Iterator<AnnotatedRegion> si = splices.iterator();
while (si.hasNext()) {
AnnotatedRegion next = si.next();
String nextS = next.toString();
int n = mc.get(nextS);
double usage = fraction_using_jnct(sfr, next.chr, next.start, next.end);
if (n < 3 || (n < 20 && usage < .15))
si.remove();
System.out.printf("%s\t%d\t%.2f\n", nextS, mc.get(nextS), usage);
}
List<Integer> segmentBoundaries = new LinkedList<Integer>();
GenomicIntervalSet gis = new GenomicIntervalSet();
BEDIterator bi = new BEDIterator(segmentationBed);
for (AnnotatedRegion r : bi) {
gis.add(r.chr, r.start, r.start);
gis.add(r.chr, r.end, r.end);
}
for (AnnotatedRegion r : splices) {
gis.remove(r.chr, r.start - 50, r.start + 50);
gis.remove(r.chr, r.end - 50, r.end + 50);
}
for (AnnotatedRegion r : gis) {
segmentBoundaries.add(r.start);
}
Collections.sort(segmentBoundaries);
String output = "test_assembly.bed";
BEDWriter bw = new BEDWriter(output);
for (Collection<Integer> boundary : new Util.subsetIterator<Integer>(segmentBoundaries, 2)) {
int min = Collections.min(boundary);
int max = Collections.max(boundary);
enumerateSpliceModels(chr, min, max, splices, bw);
}
bw.close();
} | public static void main(String[] args) throws FileNotFoundException {
String loc = "chr1:183,269,781-183,413,660";
loc = "chr1:134,869,918-134,928,273";
loc = "chr1:120,176,951-120,213,058";
loc = "chr1:95,650,693-95,689,757";
loc = "chr1:95,685,317-95,699,849";
loc = "chr1:88,235,609-88,268,664";
loc = "chr1:80,249,083-80,347,157";
loc = loc.replaceAll(",", "");
String chr = loc.split(":")[0];
int start = Integer.parseInt(loc.split(":")[1].split("-")[0]);
int end = Integer.parseInt(loc.split(":")[1].split("-")[1]);
String segmentationBed = "test_segmentation.bed";
String junctionBed = "test_junctions.bed";
SamReader sfr = SamReaderFactory.makeDefault().open(new File("/home/sol/data/sangercenter/hippocampus.bam"));
BEDIterator bi = new BEDIterator("test3.bed");
BEDWriter bw = new BEDWriter(segmentationBed);
for (AnnotatedRegion r : bi) {
if (r.chr.equals(chr) && r.start >= start && r.end <= end) {
System.out.println(r);
bw.write(r.chr, r.start, r.end, '.');
}
}
bw.close();
<DeepExtract>
List<AnnotatedRegion> junctions = FindSpliceJunctions.spliceJunction(sfr, chr, start, end, true);
BEDWriter bw = new BEDWriter(junctionBed);
for (AnnotatedRegion r : junctions) {
bw.write(r.chr, r.start, r.end, r.strand);
}
bw.close();
</DeepExtract>
BEDIterator junction_it = new BEDIterator(junctionBed);
StrandedGenomicIntervalTree<Map<String, Object>> junctions = new StrandedGenomicIntervalTree<Map<String, Object>>();
List<AnnotatedRegion> splices = new LinkedList<AnnotatedRegion>();
MapCounter<String> mc = new MapCounter<String>();
for (AnnotatedRegion junction : junction_it) {
boolean contained = false;
for (AnnotatedRegion overlap : junctions.overlappingRegions(junction.chr, junction.start, junction.end, junction.strand)) {
if (overlap.start == junction.start && overlap.end == junction.end) {
contained = true;
}
}
if (!contained) {
System.out.println(junction);
junctions.add(junction);
splices.add(junction);
}
mc.increment(junction.toString());
}
Collections.sort(splices, new Comparator<AnnotatedRegion>() {
public int compare(AnnotatedRegion arg0, AnnotatedRegion arg1) {
if (arg0.start != arg1.start)
return arg0.start - arg1.start;
else
return arg0.end - arg1.end;
}
});
Iterator<AnnotatedRegion> si = splices.iterator();
while (si.hasNext()) {
AnnotatedRegion next = si.next();
String nextS = next.toString();
int n = mc.get(nextS);
double usage = fraction_using_jnct(sfr, next.chr, next.start, next.end);
if (n < 3 || (n < 20 && usage < .15))
si.remove();
System.out.printf("%s\t%d\t%.2f\n", nextS, mc.get(nextS), usage);
}
List<Integer> segmentBoundaries = new LinkedList<Integer>();
GenomicIntervalSet gis = new GenomicIntervalSet();
BEDIterator bi = new BEDIterator(segmentationBed);
for (AnnotatedRegion r : bi) {
gis.add(r.chr, r.start, r.start);
gis.add(r.chr, r.end, r.end);
}
for (AnnotatedRegion r : splices) {
gis.remove(r.chr, r.start - 50, r.start + 50);
gis.remove(r.chr, r.end - 50, r.end + 50);
}
for (AnnotatedRegion r : gis) {
segmentBoundaries.add(r.start);
}
Collections.sort(segmentBoundaries);
String output = "test_assembly.bed";
BEDWriter bw = new BEDWriter(output);
for (Collection<Integer> boundary : new Util.subsetIterator<Integer>(segmentBoundaries, 2)) {
int min = Collections.min(boundary);
int max = Collections.max(boundary);
enumerateSpliceModels(chr, min, max, splices, bw);
}
bw.close();
} | isoscm | positive | 3,126 |
@Override
public void connectChain(FabrikChain3D newChain, int existingChainNumber, int existingBoneNumber) {
if (existingChainNumber > this.mChains.size()) {
throw new IllegalArgumentException("Cannot connect to chain " + existingChainNumber + " - no such chain (remember that chains are zero indexed).");
}
if (existingBoneNumber > mChains.get(existingChainNumber).getNumBones()) {
throw new IllegalArgumentException("Cannot connect to bone " + existingBoneNumber + " of chain " + existingChainNumber + " - no such bone (remember that bones are zero indexed).");
}
FabrikChain3D relativeChain = new FabrikChain3D(newChain);
relativeChain.connectToStructure(this, existingChainNumber, existingBoneNumber);
BoneConnectionPoint connectionPoint = this.getChain(existingChainNumber).getBone(existingBoneNumber).getBoneConnectionPoint();
if (connectionPoint == BoneConnectionPoint.START) {
connectionLocation = mChains.get(existingChainNumber).getBone(existingBoneNumber).getStartLocation();
} else {
connectionLocation = mChains.get(existingChainNumber).getBone(existingBoneNumber).getEndLocation();
}
relativeChain.setBaseLocation(connectionLocation);
for (int loop = 0; loop < this.mChains.size(); ++loop) {
mChains.get(loop).setFixedBaseMode(true);
}
for (int loop = 0; loop < relativeChain.getNumBones(); ++loop) {
Vec3f origStart = relativeChain.getBone(loop).getStartLocation();
Vec3f origEnd = relativeChain.getBone(loop).getEndLocation();
Vec3f translatedStart = origStart.plus(connectionLocation);
Vec3f translatedEnd = origEnd.plus(connectionLocation);
relativeChain.getBone(loop).setStartLocation(translatedStart);
relativeChain.getBone(loop).setEndLocation(translatedEnd);
}
mChains.add(relativeChain);
} | @Override
public void connectChain(FabrikChain3D newChain, int existingChainNumber, int existingBoneNumber) {
if (existingChainNumber > this.mChains.size()) {
throw new IllegalArgumentException("Cannot connect to chain " + existingChainNumber + " - no such chain (remember that chains are zero indexed).");
}
if (existingBoneNumber > mChains.get(existingChainNumber).getNumBones()) {
throw new IllegalArgumentException("Cannot connect to bone " + existingBoneNumber + " of chain " + existingChainNumber + " - no such bone (remember that bones are zero indexed).");
}
FabrikChain3D relativeChain = new FabrikChain3D(newChain);
relativeChain.connectToStructure(this, existingChainNumber, existingBoneNumber);
BoneConnectionPoint connectionPoint = this.getChain(existingChainNumber).getBone(existingBoneNumber).getBoneConnectionPoint();
if (connectionPoint == BoneConnectionPoint.START) {
connectionLocation = mChains.get(existingChainNumber).getBone(existingBoneNumber).getStartLocation();
} else {
connectionLocation = mChains.get(existingChainNumber).getBone(existingBoneNumber).getEndLocation();
}
relativeChain.setBaseLocation(connectionLocation);
for (int loop = 0; loop < this.mChains.size(); ++loop) {
mChains.get(loop).setFixedBaseMode(true);
}
for (int loop = 0; loop < relativeChain.getNumBones(); ++loop) {
Vec3f origStart = relativeChain.getBone(loop).getStartLocation();
Vec3f origEnd = relativeChain.getBone(loop).getEndLocation();
Vec3f translatedStart = origStart.plus(connectionLocation);
Vec3f translatedEnd = origEnd.plus(connectionLocation);
relativeChain.getBone(loop).setStartLocation(translatedStart);
relativeChain.getBone(loop).setEndLocation(translatedEnd);
}
<DeepExtract>
mChains.add(relativeChain);
</DeepExtract>
} | caliko | positive | 3,127 |
public void shutdown() {
if (inactivityFuture != null) {
inactivityFuture.cancel(true);
inactivityFuture = null;
}
inactivityTimer.shutdown();
} | public void shutdown() {
<DeepExtract>
if (inactivityFuture != null) {
inactivityFuture.cancel(true);
inactivityFuture = null;
}
</DeepExtract>
inactivityTimer.shutdown();
} | instabtbu | positive | 3,128 |
private ByteBuffer extract() {
final ByteBuffer[] items = this.items;
ByteBuffer item = items[takeIndex];
items[takeIndex] = null;
return (++takeIndex == items.length) ? 0 : takeIndex;
--count;
return item;
} | private ByteBuffer extract() {
final ByteBuffer[] items = this.items;
ByteBuffer item = items[takeIndex];
items[takeIndex] = null;
<DeepExtract>
return (++takeIndex == items.length) ? 0 : takeIndex;
</DeepExtract>
--count;
return item;
} | waterwave | positive | 3,130 |
@Override
public String toString() {
return String.valueOf(_value).toLowerCase();
} | @Override
public String toString() {
<DeepExtract>
return String.valueOf(_value).toLowerCase();
</DeepExtract>
} | neoj | positive | 3,131 |
@Override
public ElasticResponse scroll(String scrollId, Integer scrollTime) throws IOException {
final String path = "/_search/scroll";
final Map<String, Object> requestBody = new HashMap<>();
requestBody.put("scroll_id", scrollId);
requestBody.put("scroll", scrollTime + "s");
try (final InputStream inputStream = performRequest("POST", path, requestBody).getEntity().getContent()) {
return this.mapper.readValue(inputStream, ElasticResponse.class);
}
} | @Override
public ElasticResponse scroll(String scrollId, Integer scrollTime) throws IOException {
final String path = "/_search/scroll";
final Map<String, Object> requestBody = new HashMap<>();
requestBody.put("scroll_id", scrollId);
requestBody.put("scroll", scrollTime + "s");
<DeepExtract>
try (final InputStream inputStream = performRequest("POST", path, requestBody).getEntity().getContent()) {
return this.mapper.readValue(inputStream, ElasticResponse.class);
}
</DeepExtract>
} | elasticgeo | positive | 3,132 |
@Test
public void testChangePasswordLoggedIn() {
logoutTest();
loginTest(user01, pass01);
changePassword(getPasswordEditText(pass01), getPasswordEditText(pass01 + "new"));
assertEquals(whoAmI(), user01);
logoutTest();
loginTest(user01, pass01 + "new");
changePassword(getPasswordEditText(pass01 + "new"), getPasswordEditText(pass01));
assertEquals(whoAmI(), user01);
logoutTest();
loginTest(user01, pass01);
logoutTest();
} | @Test
public void testChangePasswordLoggedIn() {
<DeepExtract>
logoutTest();
loginTest(user01, pass01);
changePassword(getPasswordEditText(pass01), getPasswordEditText(pass01 + "new"));
assertEquals(whoAmI(), user01);
logoutTest();
loginTest(user01, pass01 + "new");
changePassword(getPasswordEditText(pass01 + "new"), getPasswordEditText(pass01));
assertEquals(whoAmI(), user01);
logoutTest();
loginTest(user01, pass01);
logoutTest();
</DeepExtract>
} | ZeroKit-Android-SDK | positive | 3,133 |
@Override
ModelItem getModelItem() {
return customElement;
} | @Override
ModelItem getModelItem() {
<DeepExtract>
return customElement;
</DeepExtract>
} | dsl | positive | 3,134 |
public static String getFirstDayOfQuarter(Integer year, Integer quarter) {
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.MONDAY);
Integer month = new Integer(0);
if (quarter == 1) {
month = 1 - 1;
} else if (quarter == 2) {
month = 4 - 1;
} else if (quarter == 3) {
month = 7 - 1;
} else if (quarter == 4) {
month = 10 - 1;
} else {
month = calendar.get(Calendar.MONTH);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.MONDAY);
if (year == null) {
year = calendar.get(Calendar.YEAR);
}
if (month == null) {
month = calendar.get(Calendar.MONTH);
}
calendar.set(year, month, 1);
return sdf.format(calendar.getTime());
} | public static String getFirstDayOfQuarter(Integer year, Integer quarter) {
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.MONDAY);
Integer month = new Integer(0);
if (quarter == 1) {
month = 1 - 1;
} else if (quarter == 2) {
month = 4 - 1;
} else if (quarter == 3) {
month = 7 - 1;
} else if (quarter == 4) {
month = 10 - 1;
} else {
month = calendar.get(Calendar.MONTH);
}
<DeepExtract>
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.MONDAY);
if (year == null) {
year = calendar.get(Calendar.YEAR);
}
if (month == null) {
month = calendar.get(Calendar.MONTH);
}
calendar.set(year, month, 1);
return sdf.format(calendar.getTime());
</DeepExtract>
} | SuperBoot | positive | 3,135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.