before
stringlengths
14
203k
after
stringlengths
37
104k
repo
stringlengths
2
50
type
stringclasses
1 value
private void logCallerMethodName(int depth) { String suffix = (this.name == null) ? null : "(" + this.name + ")"; final StackTraceElement[] ste = Thread.currentThread().getStackTrace(); final String callerName = ste[2 + 1 + depth].getMethodName(); System.out.println(); System.out.println(callerName + "()" + ((suffix == null) ? "" : " " + suffix)); }
<DeepExtract> final StackTraceElement[] ste = Thread.currentThread().getStackTrace(); final String callerName = ste[2 + 1 + depth].getMethodName(); System.out.println(); System.out.println(callerName + "()" + ((suffix == null) ? "" : " " + suffix)); </DeepExtract>
jafama
positive
public void actionPerformed(ActionEvent e) { Bot b = window.getActiveBot(); if (b != null) { HijackCanvas c = b.getCanvas(); boolean removed = false; if (c == null) { b.getLogger().log(new LogRecord(Level.SEVERE, "Error accessing canvas...")); return; } for (int i = 0; i < c.getListeners().size(); i++) { ProjectionListener pl = c.getListeners().get(i); if (pl.getClass().equals(DebugObjectInfo.class)) { ObjectDebugger d = (ObjectDebugger) pl; if (d.getType() == Objects.TYPE_FLOOR_DECORATION) { d.uninstall(); c.getListeners().remove(i); removed = true; floorObjectsInfo.setIcon(null); b.getLogger().log(new LogRecord(Level.FINE, "Uninstalled " + d.getClass().getSimpleName().replaceAll("Debug", "") + " debugger")); break; } } } if (!removed) { try { ObjectDebugger d = (ObjectDebugger) DebugObjectInfo.class.newInstance(); d.setType(Objects.TYPE_FLOOR_DECORATION); d.install(b); c.getListeners().add(d); floorObjectsInfo.setIcon(tickIcon); b.getLogger().log(new LogRecord(Level.FINE, "Installed " + d.getClass().getSimpleName().replaceAll("Debug", "") + " debugger")); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } }
<DeepExtract> Bot b = window.getActiveBot(); if (b != null) { HijackCanvas c = b.getCanvas(); boolean removed = false; if (c == null) { b.getLogger().log(new LogRecord(Level.SEVERE, "Error accessing canvas...")); return; } for (int i = 0; i < c.getListeners().size(); i++) { ProjectionListener pl = c.getListeners().get(i); if (pl.getClass().equals(DebugObjectInfo.class)) { ObjectDebugger d = (ObjectDebugger) pl; if (d.getType() == Objects.TYPE_FLOOR_DECORATION) { d.uninstall(); c.getListeners().remove(i); removed = true; floorObjectsInfo.setIcon(null); b.getLogger().log(new LogRecord(Level.FINE, "Uninstalled " + d.getClass().getSimpleName().replaceAll("Debug", "") + " debugger")); break; } } } if (!removed) { try { ObjectDebugger d = (ObjectDebugger) DebugObjectInfo.class.newInstance(); d.setType(Objects.TYPE_FLOOR_DECORATION); d.install(b); c.getListeners().add(d); floorObjectsInfo.setIcon(tickIcon); b.getLogger().log(new LogRecord(Level.FINE, "Installed " + d.getClass().getSimpleName().replaceAll("Debug", "") + " debugger")); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } </DeepExtract>
vInsert
positive
public void switchCamera() { cameraId = cameraId == 0 ? 1 : 0; mCameraDrawer.switchCamera(); try { mCamera.close(); mCamera.open(cameraId); mCameraDrawer.setCameraId(cameraId); final Point previewSize = mCamera.getPreviewSize(); dataWidth = previewSize.x; dataHeight = previewSize.y; SurfaceTexture texture = mCameraDrawer.getTexture(); texture.setOnFrameAvailableListener(this); mCamera.setPreviewTexture(texture); mCamera.preview(); } catch (Exception e) { } }
<DeepExtract> try { mCamera.close(); mCamera.open(cameraId); mCameraDrawer.setCameraId(cameraId); final Point previewSize = mCamera.getPreviewSize(); dataWidth = previewSize.x; dataHeight = previewSize.y; SurfaceTexture texture = mCameraDrawer.getTexture(); texture.setOnFrameAvailableListener(this); mCamera.setPreviewTexture(texture); mCamera.preview(); } catch (Exception e) { } </DeepExtract>
CaptureJz
positive
public TestHelper loginSystemAdmin() { client.login(systemAdminUser.getEmail(), systemAdminUser.getPassword()); return this; return this; }
<DeepExtract> client.login(systemAdminUser.getEmail(), systemAdminUser.getPassword()); return this; </DeepExtract>
mattermost4j
positive
@Override @NonNull @CheckResult public final <T> LifecycleTransformer<T> bindToLifecycle() { return RxLifecycle.bindUntilEvent(lifecycleSubject, ActivityEvent.DESTROY); }
<DeepExtract> return RxLifecycle.bindUntilEvent(lifecycleSubject, ActivityEvent.DESTROY); </DeepExtract>
JianshuApp
positive
@Override public void action(Network<CasperNode> network, CasperNode from, CasperNode to) { Set<Attestation> as = attestationsByHead.computeIfAbsent(this.head.id, k -> new HashSet<>()); as.add(this); if (blocksReceivedByBlockId.containsKey(this.head.id)) { blocksToReevaluate.add(this.head); } }
<DeepExtract> Set<Attestation> as = attestationsByHead.computeIfAbsent(this.head.id, k -> new HashSet<>()); as.add(this); if (blocksReceivedByBlockId.containsKey(this.head.id)) { blocksToReevaluate.add(this.head); } </DeepExtract>
wittgenstein
positive
@UiThreadTest public void testImageDrawable() { Drawable d = getActivity().getResources().getDrawable(R.drawable.icon); assertNotNull(d); aq.id(R.id.image).image(d); Drawable d = aq.getImageView().getDrawable(); int width = 0; if (d != null) { width = d.getIntrinsicWidth(); } if (true) { assertTrue(width > 0); } else { assertTrue(width <= 0); } }
<DeepExtract> Drawable d = aq.getImageView().getDrawable(); int width = 0; if (d != null) { width = d.getIntrinsicWidth(); } if (true) { assertTrue(width > 0); } else { assertTrue(width <= 0); } </DeepExtract>
androidquery
positive
public static void loadMessageDataWithPayloadAtOffset(byte[] messageData, int offset, UInt16 size, ProtocolField _protocol, UInt32 reserved, byte[] target, byte[] site, RoutingField _routing, UInt64 at_time, UInt16 type, byte[] reserved2, LxProtocolTypeBase payload) { int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = target; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = site; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved2; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; for (int i = 0; i < (memberData.length); i++) { messageData[(offset + i)] = memberData[i]; } offset += memberData.length; }
<DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract> <DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract> <DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract> <DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract> <DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract> <DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract> <DeepExtract> int offset = 0; byte[] bytes = new byte[getPayloadSize()]; byte[] memberData; memberData = size.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = _protocol.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; memberData = reserved.getBytes(); for (int i = 0; i < (memberData.length); i++) { bytes[(offset + i)] = memberData[i]; } offset += memberData.length; return bytes; </DeepExtract>
AndroidWearAndLIFX
positive
public <X0> Ennead<A, B, C, D, E, F, G, H, X0> add(final X0 value0) { return new Ennead<A, B, C, D, E, F, G, H, X0>(this.val0, this.val1, this.val2, this.val3, this.val4, this.val5, this.val6, this.val7, value0); }
<DeepExtract> return new Ennead<A, B, C, D, E, F, G, H, X0>(this.val0, this.val1, this.val2, this.val3, this.val4, this.val5, this.val6, this.val7, value0); </DeepExtract>
nlp-lang
positive
public void start() throws IllegalStateException { if (inShutdown()) { throw new IllegalStateException("processor has already been stopped and cannot be restarted"); } RxJavaPlugins.setErrorHandler(t -> { Throwable t0 = t; if (t instanceof UndeliverableException) { t0 = t.getCause(); } if (this.failedProcessorException == null) { this.failedProcessorException = t0; } if (t0 instanceof java.util.concurrent.RejectedExecutionException) { logger.debug("op=unhandled_rejected_execution action=continue {}", t0.getMessage()); } else { if (t0 instanceof NonRetryableNakadiException) { logger.error(String.format("op=unhandled_non_retryable_exception action=stopping type=NonRetryableNakadiException %s ", ((NonRetryableNakadiException) t0).problem()), t0); stopStreaming(); } else if (t0 instanceof Error) { logger.error(String.format("op=unhandled_error action=stopping type=NonRetryableNakadiException %s ", t.getMessage()), t0); stopStreaming(); } else { logger.error(String.format("unhandled_unknown_exception action=stopping type=%s %s", t0.getClass().getSimpleName(), t0.getMessage()), t0); stopStreaming(); } } }); if (!started.getAndSet(true)) { this.startStreaming(); } logger.info("stream_processor op=waiting_on_start startup_wait_time={}s", START_AWAIT_TIMEOUT_SECONDS); try { final boolean await = startLatch.await(START_AWAIT_TIMEOUT_SECONDS, START_AWAIT_TIMEOUT_UNIT); logger.info("stream_processor op=has_started startup_within_allowed_time=" + await); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
<DeepExtract> RxJavaPlugins.setErrorHandler(t -> { Throwable t0 = t; if (t instanceof UndeliverableException) { t0 = t.getCause(); } if (this.failedProcessorException == null) { this.failedProcessorException = t0; } if (t0 instanceof java.util.concurrent.RejectedExecutionException) { logger.debug("op=unhandled_rejected_execution action=continue {}", t0.getMessage()); } else { if (t0 instanceof NonRetryableNakadiException) { logger.error(String.format("op=unhandled_non_retryable_exception action=stopping type=NonRetryableNakadiException %s ", ((NonRetryableNakadiException) t0).problem()), t0); stopStreaming(); } else if (t0 instanceof Error) { logger.error(String.format("op=unhandled_error action=stopping type=NonRetryableNakadiException %s ", t.getMessage()), t0); stopStreaming(); } else { logger.error(String.format("unhandled_unknown_exception action=stopping type=%s %s", t0.getClass().getSimpleName(), t0.getMessage()), t0); stopStreaming(); } } }); </DeepExtract> <DeepExtract> logger.info("stream_processor op=waiting_on_start startup_wait_time={}s", START_AWAIT_TIMEOUT_SECONDS); try { final boolean await = startLatch.await(START_AWAIT_TIMEOUT_SECONDS, START_AWAIT_TIMEOUT_UNIT); logger.info("stream_processor op=has_started startup_within_allowed_time=" + await); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } </DeepExtract>
nakadi-java
positive
public int getBlockHeight() throws java.io.IOException, org.json.JSONException { Random rnd = new Random(); JSONObject msg = new JSONObject(); msg.put("id", "" + rnd.nextInt()); msg.put("method", "getblockcount"); JSONObject reply; String str = sendPost(getUrl(), msg.toString()); try { reply = new JSONObject(str); } catch (org.json.JSONException t) { System.out.println("Parse error: " + str); throw t; } return reply.getInt("result"); }
<DeepExtract> JSONObject reply; String str = sendPost(getUrl(), msg.toString()); try { reply = new JSONObject(str); } catch (org.json.JSONException t) { System.out.println("Parse error: " + str); throw t; } </DeepExtract>
jelectrum
positive
public Graphics2D paintMediumIcon(Graphics2D g2) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Color cTop = new Color(84, 121, 203, 200); Color cBottom = new Color(136, 169, 242, 200); int delta = 20; Color color = unit.getColor(); int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); int alpha = unit.hasDisplayBranch() ? 255 : 160; cTop = new Color((r - delta) > 255 ? 255 : r - delta, (g - delta) > 255 ? 255 : g - delta, (b - delta) > 255 ? 255 : b - delta, alpha); cBottom = new Color((r + delta) > 255 ? 255 : r + delta, (g + delta) > 255 ? 255 : g + delta, (b + delta) > 255 ? 255 : b + delta, alpha); GradientPaint gradient1 = new GradientPaint(x + 10, y + 10, cTop, x + 100, y + 30, cBottom); g2.setPaint(gradient1); g2.fillRoundRect(x, y, 50, 50, arc, arc); g2.setStroke(new BasicStroke(1f)); g2.setColor(new Color(0, 0, 0, 44)); g2.drawRoundRect(x, y, 50, 50, arc, arc); if (this.icon != null) { int iconWidth = icon.getWidth(null); int iconHeight = icon.getHeight(null); int xIcon = (50 / 2) - (iconWidth / 2) + this.x; int yIcon = (50 / 2) - (iconHeight / 2) + this.y; g2.drawImage(icon, xIcon, yIcon, null); } return g2; }
<DeepExtract> Color cTop = new Color(84, 121, 203, 200); Color cBottom = new Color(136, 169, 242, 200); int delta = 20; Color color = unit.getColor(); int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); int alpha = unit.hasDisplayBranch() ? 255 : 160; cTop = new Color((r - delta) > 255 ? 255 : r - delta, (g - delta) > 255 ? 255 : g - delta, (b - delta) > 255 ? 255 : b - delta, alpha); cBottom = new Color((r + delta) > 255 ? 255 : r + delta, (g + delta) > 255 ? 255 : g + delta, (b + delta) > 255 ? 255 : b + delta, alpha); GradientPaint gradient1 = new GradientPaint(x + 10, y + 10, cTop, x + 100, y + 30, cBottom); g2.setPaint(gradient1); g2.fillRoundRect(x, y, 50, 50, arc, arc); g2.setStroke(new BasicStroke(1f)); g2.setColor(new Color(0, 0, 0, 44)); g2.drawRoundRect(x, y, 50, 50, arc, arc); </DeepExtract> <DeepExtract> if (this.icon != null) { int iconWidth = icon.getWidth(null); int iconHeight = icon.getHeight(null); int xIcon = (50 / 2) - (iconWidth / 2) + this.x; int yIcon = (50 / 2) - (iconHeight / 2) + this.y; g2.drawImage(icon, xIcon, yIcon, null); } </DeepExtract>
imageflow
positive
public Criteria andPhone1IsNotNull() { if ("phone_1 is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("phone_1 is not null")); return (Criteria) this; }
<DeepExtract> if ("phone_1 is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("phone_1 is not null")); </DeepExtract>
health_online
positive
private void writeWithoutMAC(OutputStream out) throws IOException { writeWithoutMAC(initializationVector); initializationVector.write(mac); Encode.int16(curveType, out); int offset = Bytes.numberOfLeadingZeros(Points.getX(R)); int length = Points.getX(R).length - offset; Encode.int16(length, out); out.write(Points.getX(R), offset, length); int offset = Bytes.numberOfLeadingZeros(Points.getY(R)); int length = Points.getY(R).length - offset; Encode.int16(length, out); out.write(Points.getY(R), offset, length); writeWithoutMAC(encrypted); encrypted.write(mac); }
<DeepExtract> writeWithoutMAC(initializationVector); initializationVector.write(mac); </DeepExtract> <DeepExtract> int offset = Bytes.numberOfLeadingZeros(Points.getX(R)); int length = Points.getX(R).length - offset; Encode.int16(length, out); out.write(Points.getX(R), offset, length); </DeepExtract> <DeepExtract> int offset = Bytes.numberOfLeadingZeros(Points.getY(R)); int length = Points.getY(R).length - offset; Encode.int16(length, out); out.write(Points.getY(R), offset, length); </DeepExtract> <DeepExtract> writeWithoutMAC(encrypted); encrypted.write(mac); </DeepExtract>
Jabit
positive
public Scalar evaluate(String n, ScriptInstance i, Stack l) { String a = ((Scalar) l.pop()).toString(); String b = ((Scalar) l.pop()).toString(); Pattern pattern; Pattern temp = (Pattern) patternCache.get(a); if (temp != null) { pattern = temp; } else { temp = Pattern.compile(a); patternCache.put(a, temp); pattern = temp; } String[] results = l.isEmpty() ? pattern.split(b) : pattern.split(b, BridgeUtilities.getInt(l, 0)); Scalar array = SleepUtils.getArrayScalar(); for (int x = 0; x < results.length; x++) { array.getArray().push(SleepUtils.getScalar(results[x])); } return array; }
<DeepExtract> Pattern pattern; Pattern temp = (Pattern) patternCache.get(a); if (temp != null) { pattern = temp; } else { temp = Pattern.compile(a); patternCache.put(a, temp); pattern = temp; } </DeepExtract>
sleep
positive
final void withEffectiveVisibility(ViewMatchers.Visibility visibility) { cached = null; if (negateNextMatcher) { negateNextMatcher = false; ViewMatchers.withEffectiveVisibility(visibility) = Matchers.not(ViewMatchers.withEffectiveVisibility(visibility)); } matchers.add(ViewMatchers.withEffectiveVisibility(visibility)); }
<DeepExtract> cached = null; </DeepExtract> <DeepExtract> if (negateNextMatcher) { negateNextMatcher = false; ViewMatchers.withEffectiveVisibility(visibility) = Matchers.not(ViewMatchers.withEffectiveVisibility(visibility)); } matchers.add(ViewMatchers.withEffectiveVisibility(visibility)); </DeepExtract>
cortado
positive
public Criteria andIdGreaterThan(Long value) { if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id >", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id >", value)); </DeepExtract>
jtt808-simulator
positive
@Test public void test() throws Exception { HttpTestUtils.overrideJvmWideHttpsVerifier(); stubFor(get(urlEqualTo("/index.html")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/html").withHeader("Content-Length", "it <b>works</b> !!".length() + "").withBody("it <b>works</b> !!"))); config = new Properties(HTTP_ADMIN_SERVER_CONFIG); config.put("config.type", "database"); config.put("db.jdbc.url", "jdbc:herddb:localhost"); config.put("db.server.base.dir", tmpDir.newFolder().getAbsolutePath()); config.put("aws.accesskey", "accesskey"); config.put("aws.secretkey", "secretkey"); startServer(config); String defaultCertificate = TestUtils.deployResource("ia.p12", tmpDir.getRoot()); config.put("certificate.1.hostname", "*"); config.put("certificate.1.file", defaultCertificate); config.put("certificate.1.password", "changeit"); config.put("listener.1.host", "localhost"); config.put("listener.1.port", "8086"); config.put("listener.1.enabled", "true"); config.put("listener.1.defaultcertificate", "*"); config.put("backend.1.id", "localhost"); config.put("backend.1.enabled", "true"); config.put("backend.1.host", "localhost"); config.put("backend.1.port", wireMockRule.port() + ""); config.put("backend.2.id", "localhost2"); config.put("backend.2.enabled", "true"); config.put("backend.2.host", "localhost2"); config.put("backend.2.port", wireMockRule.port() + ""); config.put("director.1.id", "*"); config.put("director.1.backends", "localhost"); config.put("director.1.enabled", "true"); config.put("route.100.id", "default"); config.put("route.100.enabled", "true"); config.put("route.100.match", "all"); config.put("route.100.action", "proxy-all"); config.put("connectionsmanager.maxconnectionsperendpoint", "10"); config.put("connectionsmanager.borrowtimeout", "5000"); config.put("connectionsmanager.connecttimeout", "10000"); config.put("connectionsmanager.stuckrequesttimeout", "15000"); config.put("connectionsmanager.idletimeout", "20000"); config.put("connectionsmanager.disposetimeout", "50000"); config.put("connectionsmanager.keepaliveidle", "500"); config.put("connectionsmanager.keepaliveinterval", "50"); config.put("connectionsmanager.keepalivecount", "5"); config.put("connectionpool.1.id", "localhost"); config.put("connectionpool.1.domain", "localhost"); config.put("connectionpool.1.enabled", "true"); config.put("connectionpool.2.id", "localhost2"); config.put("connectionpool.2.domain", "localhost2"); config.put("connectionpool.2.enabled", "false"); config.put("connectionpool.3.id", "localhosts"); config.put("connectionpool.3.domain", "localhost[0-9]"); config.put("connectionpool.3.maxconnectionsperendpoint", "20"); config.put("connectionpool.3.borrowtimeout", "21000"); config.put("connectionpool.3.connecttimeout", "22000"); config.put("connectionpool.3.stuckrequesttimeout", "23000"); config.put("connectionpool.3.idletimeout", "24000"); config.put("connectionpool.3.disposetimeout", "25000"); config.put("connectionpool.3.keepaliveidle", "250"); config.put("connectionpool.3.keepaliveinterval", "25"); config.put("connectionpool.3.keepalivecount", "2"); config.put("connectionpool.3.enabled", "true"); changeDynamicConfiguration(config); int port = server.getLocalPort(); Map<ConnectionPoolConfiguration, ConnectionProvider> connectionPools = server.getProxyRequestsManager().getConnectionPools(); assertThat(connectionPools.size(), is(3)); ConnectionPoolConfiguration defaultPool = new ConnectionPoolConfiguration("*", "*", 10, 5_000, 10_000, 15_000, 20_000, 50_000, 500, 50, 5, true, true); { ConnectionProvider provider = connectionPools.get(defaultPool); assertThat(provider, not(nullValue())); Map<SocketAddress, Integer> maxConnectionsPerHost = provider.maxConnectionsPerHost(); assertThat(maxConnectionsPerHost.size(), is(2)); maxConnectionsPerHost.values().stream().allMatch(e -> e == 10); } ConnectionPoolConfiguration poolWithDefaults = new ConnectionPoolConfiguration("localhost", "localhost", 10, 5_000, 10_000, 15_000, 20_000, 50_000, 500, 50, 5, true, true); { ConnectionProvider provider = connectionPools.get(poolWithDefaults); assertThat(provider, not(nullValue())); Map<SocketAddress, Integer> maxConnectionsPerHost = provider.maxConnectionsPerHost(); assertThat(maxConnectionsPerHost.size(), is(2)); maxConnectionsPerHost.values().stream().allMatch(e -> e == 10); } ConnectionPoolConfiguration customPool = new ConnectionPoolConfiguration("localhosts", "localhost[0-9]", 20, 21_000, 22_000, 23_000, 24_000, 25_000, 250, 25, 2, true, true); { ConnectionProvider provider = connectionPools.get(customPool); assertThat(provider, not(nullValue())); Map<SocketAddress, Integer> maxConnectionsPerHost = provider.maxConnectionsPerHost(); assertThat(maxConnectionsPerHost.size(), is(2)); maxConnectionsPerHost.values().stream().allMatch(e -> e == 20); } ProxyRequestsManager.ConnectionsManager connectionsManager = server.getProxyRequestsManager().getConnectionsManager(); { HttpServerRequest request = mock(HttpServerRequest.class); ProxyRequest proxyRequest = mock(ProxyRequest.class); when(proxyRequest.getRequest()).thenReturn(request); when(proxyRequest.getRequestHostname()).thenReturn("localhost*"); Map.Entry<ConnectionPoolConfiguration, ConnectionProvider> res = connectionsManager.apply(proxyRequest); assertThat(res.getKey(), is(defaultPool)); ConnectionProvider provider = res.getValue(); Map<SocketAddress, Integer> maxConnectionsPerHost = provider.maxConnectionsPerHost(); assertThat(maxConnectionsPerHost.size(), is(2)); maxConnectionsPerHost.values().stream().allMatch(e -> e == 10); try (RawHttpClient client = new RawHttpClient("localhost", port)) { RawHttpClient.HttpResponse resp = client.executeRequest("GET /index.html HTTP/1.1\r\n" + HttpHeaderNames.HOST + ": localhost*" + "\r\n\r\n"); assertEquals("it <b>works</b> !!", resp.getBodyString()); } Map<String, HttpProxyServer.ConnectionPoolStats> stats = server.getConnectionPoolsStats().get(EndpointKey.make("localhost", wireMockRule.port())); assertThat(stats.get("*").getTotalConnections(), is(1)); assertThat(stats.get("localhost"), is(nullValue())); assertThat(stats.get("localhosts"), is(nullValue())); } { HttpServerRequest request = mock(HttpServerRequest.class); ProxyRequest proxyRequest = mock(ProxyRequest.class); when(proxyRequest.getRequest()).thenReturn(request); when(proxyRequest.getRequestHostname()).thenReturn("localhost"); Map.Entry<ConnectionPoolConfiguration, ConnectionProvider> res = connectionsManager.apply(proxyRequest); assertThat(res.getKey(), is(poolWithDefaults)); ConnectionProvider provider = res.getValue(); Map<SocketAddress, Integer> maxConnectionsPerHost = provider.maxConnectionsPerHost(); assertThat(maxConnectionsPerHost.size(), is(2)); maxConnectionsPerHost.values().stream().allMatch(e -> e == 10); try (RawHttpClient client = new RawHttpClient("localhost", port)) { RawHttpClient.HttpResponse resp = client.executeRequest("GET /index.html HTTP/1.1\r\n" + HttpHeaderNames.HOST + ": localhost" + "\r\n\r\n"); assertEquals("it <b>works</b> !!", resp.getBodyString()); } Map<String, HttpProxyServer.ConnectionPoolStats> stats = server.getConnectionPoolsStats().get(EndpointKey.make("localhost", wireMockRule.port())); assertThat(stats.get("*").getTotalConnections(), is(1)); assertThat(stats.get("localhost").getTotalConnections(), is(1)); assertThat(stats.get("localhosts"), is(nullValue())); } { HttpServerRequest request = mock(HttpServerRequest.class); ProxyRequest proxyRequest = mock(ProxyRequest.class); when(proxyRequest.getRequest()).thenReturn(request); when(proxyRequest.getRequestHostname()).thenReturn("localhost3"); Map.Entry<ConnectionPoolConfiguration, ConnectionProvider> res = connectionsManager.apply(proxyRequest); assertThat(res.getKey(), is(customPool)); ConnectionProvider provider = res.getValue(); Map<SocketAddress, Integer> maxConnectionsPerHost = provider.maxConnectionsPerHost(); assertThat(maxConnectionsPerHost.size(), is(2)); maxConnectionsPerHost.values().stream().allMatch(e -> e == 20); try (RawHttpClient client = new RawHttpClient("localhost", port)) { RawHttpClient.HttpResponse resp = client.executeRequest("GET /index.html HTTP/1.1\r\n" + HttpHeaderNames.HOST + ": localhost3" + "\r\n\r\n"); assertEquals("it <b>works</b> !!", resp.getBodyString()); } Map<String, HttpProxyServer.ConnectionPoolStats> stats = server.getConnectionPoolsStats().get(EndpointKey.make("localhost", wireMockRule.port())); assertThat(stats.get("*").getTotalConnections(), is(1)); assertThat(stats.get("localhost").getTotalConnections(), is(1)); assertThat(stats.get("localhosts").getTotalConnections(), is(1)); } }
<DeepExtract> HttpTestUtils.overrideJvmWideHttpsVerifier(); stubFor(get(urlEqualTo("/index.html")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/html").withHeader("Content-Length", "it <b>works</b> !!".length() + "").withBody("it <b>works</b> !!"))); config = new Properties(HTTP_ADMIN_SERVER_CONFIG); config.put("config.type", "database"); config.put("db.jdbc.url", "jdbc:herddb:localhost"); config.put("db.server.base.dir", tmpDir.newFolder().getAbsolutePath()); config.put("aws.accesskey", "accesskey"); config.put("aws.secretkey", "secretkey"); startServer(config); String defaultCertificate = TestUtils.deployResource("ia.p12", tmpDir.getRoot()); config.put("certificate.1.hostname", "*"); config.put("certificate.1.file", defaultCertificate); config.put("certificate.1.password", "changeit"); config.put("listener.1.host", "localhost"); config.put("listener.1.port", "8086"); config.put("listener.1.enabled", "true"); config.put("listener.1.defaultcertificate", "*"); config.put("backend.1.id", "localhost"); config.put("backend.1.enabled", "true"); config.put("backend.1.host", "localhost"); config.put("backend.1.port", wireMockRule.port() + ""); config.put("backend.2.id", "localhost2"); config.put("backend.2.enabled", "true"); config.put("backend.2.host", "localhost2"); config.put("backend.2.port", wireMockRule.port() + ""); config.put("director.1.id", "*"); config.put("director.1.backends", "localhost"); config.put("director.1.enabled", "true"); config.put("route.100.id", "default"); config.put("route.100.enabled", "true"); config.put("route.100.match", "all"); config.put("route.100.action", "proxy-all"); config.put("connectionsmanager.maxconnectionsperendpoint", "10"); config.put("connectionsmanager.borrowtimeout", "5000"); config.put("connectionsmanager.connecttimeout", "10000"); config.put("connectionsmanager.stuckrequesttimeout", "15000"); config.put("connectionsmanager.idletimeout", "20000"); config.put("connectionsmanager.disposetimeout", "50000"); config.put("connectionsmanager.keepaliveidle", "500"); config.put("connectionsmanager.keepaliveinterval", "50"); config.put("connectionsmanager.keepalivecount", "5"); config.put("connectionpool.1.id", "localhost"); config.put("connectionpool.1.domain", "localhost"); config.put("connectionpool.1.enabled", "true"); config.put("connectionpool.2.id", "localhost2"); config.put("connectionpool.2.domain", "localhost2"); config.put("connectionpool.2.enabled", "false"); config.put("connectionpool.3.id", "localhosts"); config.put("connectionpool.3.domain", "localhost[0-9]"); config.put("connectionpool.3.maxconnectionsperendpoint", "20"); config.put("connectionpool.3.borrowtimeout", "21000"); config.put("connectionpool.3.connecttimeout", "22000"); config.put("connectionpool.3.stuckrequesttimeout", "23000"); config.put("connectionpool.3.idletimeout", "24000"); config.put("connectionpool.3.disposetimeout", "25000"); config.put("connectionpool.3.keepaliveidle", "250"); config.put("connectionpool.3.keepaliveinterval", "25"); config.put("connectionpool.3.keepalivecount", "2"); config.put("connectionpool.3.enabled", "true"); changeDynamicConfiguration(config); </DeepExtract>
carapaceproxy
positive
@Override public void onAnimationUpdate(ValueAnimator animation) { float currentTopMargin = (float) animation.getAnimatedValue(); MarginLayoutParams params = (MarginLayoutParams) mRefreshView.getLayoutParams(); if ((int) currentTopMargin < -mRefreshViewHeight + 1) { (int) currentTopMargin = -mRefreshViewHeight + 1; } params.topMargin = (int) currentTopMargin; mRefreshView.setLayoutParams(params); Log.e("TAG", "marginTop:" + (int) currentTopMargin + ",layoutParams:" + ((MarginLayoutParams) mRefreshView.getLayoutParams()).topMargin); }
<DeepExtract> MarginLayoutParams params = (MarginLayoutParams) mRefreshView.getLayoutParams(); if ((int) currentTopMargin < -mRefreshViewHeight + 1) { (int) currentTopMargin = -mRefreshViewHeight + 1; } params.topMargin = (int) currentTopMargin; mRefreshView.setLayoutParams(params); Log.e("TAG", "marginTop:" + (int) currentTopMargin + ",layoutParams:" + ((MarginLayoutParams) mRefreshView.getLayoutParams()).topMargin); </DeepExtract>
gankzhihu
positive
public static void adbPush(String source, String target) throws IOException { RuntimeException re = null; try { String c = ""; for (int i = 0; i < new String[] { "adb", "push", source, target }.length; i++) { c += new String[] { "adb", "push", source, target }[i] + " "; } Gdx.app.log(TAG, "shell: " + c); StringBuilder sb = new StringBuilder(); ProcessBuilder pb = new ProcessBuilder(new String[] { "adb", "push", source, target }).redirectErrorStream(true); Process p = pb.start(); StreamGobbler errorGobbler = new StreamGobbler(p.getErrorStream(), "SHELL ERROR"); StreamGobbler outputGobbler = new StreamGobbler(p.getInputStream(), "SHELL OUTPUT"); errorGobbler.start(); outputGobbler.start(); int retCode = p.waitFor(); if (retCode != 0 || (null != null && !sb.toString().contains(null))) { String msg = sb.toString() + "\nreturn code: " + retCode; re = new RuntimeException(msg); Gdx.app.log(TAG, "-> error! msg:" + msg); } else { Gdx.app.log(TAG, " -> " + retCode); } } catch (Exception e) { throw new RuntimeException("Exception occurred: " + e.getClass().getName() + ", msg:" + e.getMessage()); } finally { if (re != null) { throw re; } } }
<DeepExtract> RuntimeException re = null; try { String c = ""; for (int i = 0; i < new String[] { "adb", "push", source, target }.length; i++) { c += new String[] { "adb", "push", source, target }[i] + " "; } Gdx.app.log(TAG, "shell: " + c); StringBuilder sb = new StringBuilder(); ProcessBuilder pb = new ProcessBuilder(new String[] { "adb", "push", source, target }).redirectErrorStream(true); Process p = pb.start(); StreamGobbler errorGobbler = new StreamGobbler(p.getErrorStream(), "SHELL ERROR"); StreamGobbler outputGobbler = new StreamGobbler(p.getInputStream(), "SHELL OUTPUT"); errorGobbler.start(); outputGobbler.start(); int retCode = p.waitFor(); if (retCode != 0 || (null != null && !sb.toString().contains(null))) { String msg = sb.toString() + "\nreturn code: " + retCode; re = new RuntimeException(msg); Gdx.app.log(TAG, "-> error! msg:" + msg); } else { Gdx.app.log(TAG, " -> " + retCode); } } catch (Exception e) { throw new RuntimeException("Exception occurred: " + e.getClass().getName() + ", msg:" + e.getMessage()); } finally { if (re != null) { throw re; } } </DeepExtract>
FabulaEngine
positive
@Override public void onAnimationUpdate(ValueAnimatorCompat animator) { if (animator.getAnimatedIntValue() != mScrimAlpha) { final Drawable contentScrim = mContentScrim; if (contentScrim != null && mToolbar != null) { ViewCompat.postInvalidateOnAnimation(mToolbar); } mScrimAlpha = animator.getAnimatedIntValue(); ViewCompat.postInvalidateOnAnimation(FlexibleToolbarLayout.this); } }
<DeepExtract> if (animator.getAnimatedIntValue() != mScrimAlpha) { final Drawable contentScrim = mContentScrim; if (contentScrim != null && mToolbar != null) { ViewCompat.postInvalidateOnAnimation(mToolbar); } mScrimAlpha = animator.getAnimatedIntValue(); ViewCompat.postInvalidateOnAnimation(FlexibleToolbarLayout.this); } </DeepExtract>
AppCompat-Extension-Library
positive
public void onRouteDetailsResult(Route route) { List<LegViewModel> legs = new ArrayList<>(); for (Leg leg : route.getLegs()) { legs.add(new LegViewModel(leg)); } mSubTripAdapter.setLegs(legs); mFooterView = createFooterView(legs); getListView().addFooterView(mFooterView); if (mJourneyQuery.destination.getSource() == Site.SOURCE_GOOGLE_PLACES) { View attributionView = getLayoutInflater().inflate(R.layout.trip_row_attribution, null, false); getListView().addFooterView(attributionView); } setListAdapter(mSubTripAdapter); mRoute = route; }
<DeepExtract> mSubTripAdapter.setLegs(legs); mFooterView = createFooterView(legs); getListView().addFooterView(mFooterView); if (mJourneyQuery.destination.getSource() == Site.SOURCE_GOOGLE_PLACES) { View attributionView = getLayoutInflater().inflate(R.layout.trip_row_attribution, null, false); getListView().addFooterView(attributionView); } setListAdapter(mSubTripAdapter); </DeepExtract>
sthlmtraveling
positive
public void setType(String mappingId) { return this.type; }
<DeepExtract> return this.type; </DeepExtract>
ecs-cf-service-broker
positive
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_set_updateinfo); initTopBarForBoth("修改昵称", R.drawable.base_action_bar_true_bg_selector, new HeaderLayout.onRightImageButtonClickListener() { @Override public void onClick() { String nick = edit_nick.getText().toString(); if (nick.equals("")) { ShowToast("请填写昵称!"); return; } updateInfo(nick); } }); edit_nick = (EditText) findViewById(R.id.edit_nick); }
<DeepExtract> initTopBarForBoth("修改昵称", R.drawable.base_action_bar_true_bg_selector, new HeaderLayout.onRightImageButtonClickListener() { @Override public void onClick() { String nick = edit_nick.getText().toString(); if (nick.equals("")) { ShowToast("请填写昵称!"); return; } updateInfo(nick); } }); edit_nick = (EditText) findViewById(R.id.edit_nick); </DeepExtract>
AMAP4
positive
double[] getArray() { if (DO_STATS) { stats.getOp++; } if (tail != 0) { final double[] array = arrays[--tail]; arrays[tail] = null; return array; } if (DO_STATS) { stats.createOp++; } return new double[arraySize]; }
<DeepExtract> return new double[arraySize]; </DeepExtract>
marlin-fx
positive
@Override public void onCreate() { super.onCreate(); playMode = CacheUtils.getPlaymode(this, "playMode"); new Thread() { @Override public void run() { super.run(); mediaItems = new ArrayList<>(); ContentResolver resolver = getContentResolver(); Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; String[] objs = { MediaStore.Audio.Media.DISPLAY_NAME, MediaStore.Audio.Media.DURATION, MediaStore.Audio.Media.SIZE, MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.ARTIST }; Cursor cursor = resolver.query(uri, objs, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { MediaItem mediaItem = new MediaItem(); mediaItems.add(mediaItem); String name = cursor.getString(0); mediaItem.setName(name); long duration = cursor.getLong(1); mediaItem.setDuration(duration); long size = cursor.getLong(2); mediaItem.setSize(size); String data = cursor.getString(3); mediaItem.setData(data); String artist = cursor.getString(4); mediaItem.setArtist(artist); } cursor.close(); } } }.start(); }
<DeepExtract> new Thread() { @Override public void run() { super.run(); mediaItems = new ArrayList<>(); ContentResolver resolver = getContentResolver(); Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; String[] objs = { MediaStore.Audio.Media.DISPLAY_NAME, MediaStore.Audio.Media.DURATION, MediaStore.Audio.Media.SIZE, MediaStore.Audio.Media.DATA, MediaStore.Audio.Media.ARTIST }; Cursor cursor = resolver.query(uri, objs, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { MediaItem mediaItem = new MediaItem(); mediaItems.add(mediaItem); String name = cursor.getString(0); mediaItem.setName(name); long duration = cursor.getLong(1); mediaItem.setDuration(duration); long size = cursor.getLong(2); mediaItem.setSize(size); String data = cursor.getString(3); mediaItem.setData(data); String artist = cursor.getString(4); mediaItem.setArtist(artist); } cursor.close(); } } }.start(); </DeepExtract>
gankzhihu
positive
public Criteria andTemperatureLessThanOrEqualTo(Float value) { if (value == null) { throw new RuntimeException("Value for " + "temperature" + " cannot be null"); } criteria.add(new Criterion("temperature <=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "temperature" + " cannot be null"); } criteria.add(new Criterion("temperature <=", value)); </DeepExtract>
health_online
positive
private void initSongInfo() { Bundle arguments = getArguments(); MusicDialogInfo info = getArguments().getParcelable("info"); mCurrenMusicInfo = info.getInfo(); mSongName.setText(StringUtil.getSongName(mCurrenMusicInfo.getTitle())); mArtistName.setText(mCurrenMusicInfo.getArtist()); mLyricsView.setLrcFile(mCurrenMusicInfo.getTitle(), mCurrenMusicInfo.getArtist()); mAlbumUrl = StringUtil.getAlbulm(mCurrenMusicInfo.getAlbumId()).toString(); Glide.with(MyApplication.getIntstance()).load(mAlbumUrl).asBitmap().into(mPlayingSongAlbum); }
<DeepExtract> Glide.with(MyApplication.getIntstance()).load(mAlbumUrl).asBitmap().into(mPlayingSongAlbum); </DeepExtract>
BigGirl
positive
public Builder clearToken() { Object ref = token_; if (ref instanceof String) { token_ = (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); token_ = s; token_ = s; } onChanged(); return this; }
<DeepExtract> Object ref = token_; if (ref instanceof String) { token_ = (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); token_ = s; token_ = s; } </DeepExtract>
java-wechat-grpc-local
positive
public CounterMetric getTimeoutCalls(TimeoutTimedOut timedOut) { return counterMetrics.computeIfAbsent(getMetricId(MetricDefinition.TIMEOUT_CALLS, timedOut), m -> new CounterMetric(registry, m)); }
<DeepExtract> return counterMetrics.computeIfAbsent(getMetricId(MetricDefinition.TIMEOUT_CALLS, timedOut), m -> new CounterMetric(registry, m)); </DeepExtract>
microprofile-fault-tolerance
positive
public final void prepare() { if (checkPrepared()) { if (mOnSegmentPrepareListener != null) { mOnSegmentPrepareListener.onSegmentPrepared(true); } return; } if (mAllocatedPhotos == null || mAllocatedPhotos.size() == 0) { return; } boolean allLocal = true; for (PhotoData photoData : mAllocatedPhotos) { if (photoData.getState() < PhotoData.STATE_LOCAL) { allLocal = false; break; } } mPhotos.clear(); if (allLocal) { mPhotos.addAll(mAllocatedPhotos); } else { mPhotos.addAll(mRetryStrategy.getAvailableData(mPhotoMovie, this)); } onPrepare(); if (IS_DURATION_VARIABLE) { mPhotoMovie.calcuDuration(); } }
<DeepExtract> if (mAllocatedPhotos == null || mAllocatedPhotos.size() == 0) { return; } boolean allLocal = true; for (PhotoData photoData : mAllocatedPhotos) { if (photoData.getState() < PhotoData.STATE_LOCAL) { allLocal = false; break; } } mPhotos.clear(); if (allLocal) { mPhotos.addAll(mAllocatedPhotos); } else { mPhotos.addAll(mRetryStrategy.getAvailableData(mPhotoMovie, this)); } </DeepExtract>
PhotoMovie
positive
private void handleHtmlSearchSources(PageWrapper pageWrapper, RequestAndResponse requestAndResponse, String query, String paneId) throws IOException, ServletException { requestAndResponse.println("<div class=\"infotext\">" + servletText.introTextSearchSources(false) + "</div>"); addMetaData(new KeyAndValue("touchInfoText", servletText.introTextSearchSources(true))); try { final StringBuilder result = new StringBuilder(); User queryUser = null; if (null != (queryUser = canUserSeeUsersData(requestAndResponse, true))) { final ArrayList<EntryInfo> entryInfoList = new ArrayList<EntryInfo>(); if (query.startsWith("http://") || query.startsWith("https://")) { final Entry entry = dbLogic.getEntryByUserIdAndUrl(queryUser.getId(), query); if (entry == null) { servletText.sentenceThereWereNoMatches(); } else { startItemList(result, paneId); addSourceHtml(entry, result, SourceEmbedContext.InSources, null, 1, paneId); addEntryToInfoList(entry, entryInfoList); finishItemList(result); } } else { final ResultsPaginator paginator = new ResultsPaginator(requestAndResponse, servletText.sentenceThereWereNoMatches(), result, servletText); try { final List<?> results = dbLogic.searchEntriesForUserBySourceTitle(queryUser.getId(), query, paginator.getStartPosition(), paginator.getMaxResults()); startItemList(result, paneId); for (final Object entryUncasted : results) { final Entry entry = (Entry) entryUncasted; final int resultNumber = paginator.next(); if (resultNumber == -1) { continue; } else if (resultNumber == 0) { break; } addSourceHtml(entry, result, SourceEmbedContext.InSources, null, resultNumber, paneId); addEntryToInfoList(entry, entryInfoList); } finishItemList(result); paginator.done(); } catch (EmptyQueryException e) { requestAndResponse.print(servletText.errorNeedLongerQuery()); } } result.append("\n<script type=\"application/json\" class=\"entryInfoDictJson\">\n"); addJsonForEntryInfos(result, entryInfoList, paneId); result.append("\n</script>\n"); } dbLogic.commit(); requestAndResponse.print(result.toString()); } catch (final PersistenceException e) { requestAndResponse.print(servletText.errorInternalDatabase()); } }
<DeepExtract> requestAndResponse.println("<div class=\"infotext\">" + servletText.introTextSearchSources(false) + "</div>"); addMetaData(new KeyAndValue("touchInfoText", servletText.introTextSearchSources(true))); </DeepExtract>
crushpaper
positive
private void setRootOverview(HOverview overview) { currentOverviews.clear(); currentOverviews.add(overview); setOverview(true); }
<DeepExtract> currentOverviews.add(overview); setOverview(true); </DeepExtract>
G-Earth
positive
@Test public void getArtistReturnsV2TagsArtistBeforeV1TagsArtist() { ID3v1 id3v1Tag = new ID3v1TagForTesting(); this.artist = "V1 Artist"; ID3v2 id3v2Tag = new ID3v2TagForTesting(); this.artist = "V2 Artist"; ID3Wrapper wrapper = new ID3Wrapper(id3v1Tag, id3v2Tag); assertEquals("V2 Artist", wrapper.getArtist()); }
<DeepExtract> this.artist = "V1 Artist"; </DeepExtract> <DeepExtract> this.artist = "V2 Artist"; </DeepExtract>
mp3agic
positive
public Upload.Route seralize() { Upload.Route.Builder route = Upload.Route.newBuilder(); if (name.equals("")) this.name = "Route " + id; else this.name = name; route.setRouteDescription(description); route.setRouteNotes(notes); route.setVehicleCapacity(vehicleCapacity); route.setVehicleType(vehicleType); route.setStartTime(startTime); long lastTimepoint = startMs; for (RoutePoint rp : points) { Upload.Route.Point.Builder point = Upload.Route.Point.newBuilder(); point.setLat((float) rp.location.getLatitude()); point.setLon((float) rp.location.getLongitude()); point.setTimeoffset((int) ((rp.time - lastTimepoint) / 1000)); lastTimepoint = rp.time; route.addPoint(point); } lastTimepoint = startMs; for (RouteStop rs : stops) { Upload.Route.Stop.Builder stop = Upload.Route.Stop.newBuilder(); stop.setLat((float) rs.location.getLatitude()); stop.setLon((float) rs.location.getLongitude()); stop.setArrivalTimeoffset((int) ((rs.arrivalTime - lastTimepoint) / 1000)); stop.setDepartureTimeoffset((int) ((rs.departureTime - lastTimepoint) / 1000)); stop.setAlight(rs.alight); stop.setBoard(rs.board); lastTimepoint = rs.arrivalTime; route.addStop(stop); } return route.build(); }
<DeepExtract> if (name.equals("")) this.name = "Route " + id; else this.name = name; </DeepExtract>
transit-wand
positive
private void updateUI() { CrimeLab crimeLab = CrimeLab.get(getActivity()); List<Crime> crimes = crimeLab.getCrimes(); if (mAdapter == null) { mAdapter = new CrimeAdapter(crimes); mCrimeRecyclerView.setAdapter(mAdapter); } else { mAdapter.setCrimes(crimes); mAdapter.notifyDataSetChanged(); } CrimeLab crimeLab = CrimeLab.get(getActivity()); int crimeCount = crimeLab.getCrimes().size(); String subtitle = getString(R.string.subtitle_format, crimeCount); if (!mSubtitleVisible) { subtitle = null; } AppCompatActivity activity = (AppCompatActivity) getActivity(); activity.getSupportActionBar().setSubtitle(subtitle); }
<DeepExtract> CrimeLab crimeLab = CrimeLab.get(getActivity()); int crimeCount = crimeLab.getCrimes().size(); String subtitle = getString(R.string.subtitle_format, crimeCount); if (!mSubtitleVisible) { subtitle = null; } AppCompatActivity activity = (AppCompatActivity) getActivity(); activity.getSupportActionBar().setSubtitle(subtitle); </DeepExtract>
AndroidBNR2
positive
public ItemPreviewType getPreviewType() { for (ItemPreviewType type : values) { if (type.value == previewType) { return type; } } return UnknownPreviewType_NotImplementedByAPI; }
<DeepExtract> for (ItemPreviewType type : values) { if (type.value == previewType) { return type; } } return UnknownPreviewType_NotImplementedByAPI; </DeepExtract>
steamworks4j
positive
@Override public void onChange(ConfigChangeEvent configChangeEvent) { appConfig.addChangeListener(DocumentationConfig.this); return resources(); }
<DeepExtract> appConfig.addChangeListener(DocumentationConfig.this); return resources(); </DeepExtract>
taodong-shop
positive
public void showHistoryWithUser(User user, List<LocalQuizHistory> history) { int wins = 0; int lose = 0; for (LocalQuizHistory l : history) { wins += l.getQuizResult() == Quiz.WON ? 1 : 0; lose += l.getQuizResult() == Quiz.LOOSE ? 1 : 0; } LinearLayout winLoseStrip = (LinearLayout) getApp().getActivity().getLayoutInflater().inflate(R.layout.quiz_wins_lose_strip, null); winLoseStrip.setBackgroundColor(getApp().getConfig().getAThemeColor()); ((GothamTextView) winLoseStrip.findViewById(R.id.title_text_view)).setText(UiText.YOU_VS_USER.getValue(user.getName())); GothamTextView debugMessage = (GothamTextView) winLoseStrip.findViewById(R.id.debugMessage); debugMessage.setTextSize(25); debugMessage.setText(wins + "-" + lose); if (userProfileWrapper != null) userProfileWrapper.addView(winLoseStrip); else addToScrollView(winLoseStrip); final QuizHistoryListAdapter quizHistoryAdapter = new QuizHistoryListAdapter(getApp(), 0, history); LinearLayout lView = (LinearLayout) getApp().getActivity().getLayoutInflater().inflate(R.layout.block_list_view, this, false); lView.setBackgroundColor(getResources().getColor(R.color.translucent_white)); EditText searchText = (EditText) lView.findViewById(R.id.search_text); GothamTextView debugMessage = (GothamTextView) lView.findViewById(R.id.debugMessage); if (history.size() == 0) { debugMessage.setVisibility(View.VISIBLE); debugMessage.setText(UiText.NO_ACTIVITY_AVAILABLE.getValue()); } searchText.setVisibility(View.GONE); GothamTextView titleView = (GothamTextView) lView.findViewById(R.id.title_text_view); titleView.setText(UiText.LOCAL_QUIZ_HISTORY.getValue()); titleView.setTextColor(Color.GRAY); ExpandableHeightListView listView = (ExpandableHeightListView) lView.findViewById(R.id.listView); listView.setDivider(new ColorDrawable(this.getResources().getColor(R.color.translucent_black))); listView.setDividerHeight(1); LayoutParams lParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lParams.setMargins(5, 0, 0, 5); listView.setLayoutParams(lParams); listView.setAdapter(quizHistoryAdapter); if (true) { listView.setExpanded(true); if (userProfileWrapper != null) { FrameLayout viewMore = (FrameLayout) lView.findViewById(R.id.view_all_wrapper); viewMore.setVisibility(View.GONE); userProfileWrapper.addView(lView); } else addToScrollView(lView); } else { addView(lView); FrameLayout viewMore = (FrameLayout) lView.findViewById(R.id.view_all_wrapper); viewMore.setVisibility(View.GONE); } }
<DeepExtract> final QuizHistoryListAdapter quizHistoryAdapter = new QuizHistoryListAdapter(getApp(), 0, history); LinearLayout lView = (LinearLayout) getApp().getActivity().getLayoutInflater().inflate(R.layout.block_list_view, this, false); lView.setBackgroundColor(getResources().getColor(R.color.translucent_white)); EditText searchText = (EditText) lView.findViewById(R.id.search_text); GothamTextView debugMessage = (GothamTextView) lView.findViewById(R.id.debugMessage); if (history.size() == 0) { debugMessage.setVisibility(View.VISIBLE); debugMessage.setText(UiText.NO_ACTIVITY_AVAILABLE.getValue()); } searchText.setVisibility(View.GONE); GothamTextView titleView = (GothamTextView) lView.findViewById(R.id.title_text_view); titleView.setText(UiText.LOCAL_QUIZ_HISTORY.getValue()); titleView.setTextColor(Color.GRAY); ExpandableHeightListView listView = (ExpandableHeightListView) lView.findViewById(R.id.listView); listView.setDivider(new ColorDrawable(this.getResources().getColor(R.color.translucent_black))); listView.setDividerHeight(1); LayoutParams lParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lParams.setMargins(5, 0, 0, 5); listView.setLayoutParams(lParams); listView.setAdapter(quizHistoryAdapter); if (true) { listView.setExpanded(true); if (userProfileWrapper != null) { FrameLayout viewMore = (FrameLayout) lView.findViewById(R.id.view_all_wrapper); viewMore.setVisibility(View.GONE); userProfileWrapper.addView(lView); } else addToScrollView(lView); } else { addView(lView); FrameLayout viewMore = (FrameLayout) lView.findViewById(R.id.view_all_wrapper); viewMore.setVisibility(View.GONE); } </DeepExtract>
QuizApp_Android
positive
public static void main(String[] args) throws IntrospectionException { BeanInfo info = Introspector.getBeanInfo(UserDTO.class); PropertyDescriptor[] pds = info.getPropertyDescriptors(); for (PropertyDescriptor pd : pds) { Method readMethod = pd.getReadMethod(); Method writeMethod = pd.getWriteMethod(); System.out.println(pd.getName()); } }
<DeepExtract> BeanInfo info = Introspector.getBeanInfo(UserDTO.class); PropertyDescriptor[] pds = info.getPropertyDescriptors(); for (PropertyDescriptor pd : pds) { Method readMethod = pd.getReadMethod(); Method writeMethod = pd.getWriteMethod(); System.out.println(pd.getName()); } </DeepExtract>
dragon
positive
public Criteria andEmailLessThanOrEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "email" + " cannot be null"); } criteria.add(new Criterion("email <=", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "email" + " cannot be null"); } criteria.add(new Criterion("email <=", value)); </DeepExtract>
ssmxiaomi
positive
public static void init(Context context) { if (tool == null) tool = new Tool(); tool.context = context; if (!HAD_GOT_SCREEN_SIZE) { Point p = new Point(); Display d = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); d.getRealSize(p); int width = p.x; int height = p.y; screenSize = new int[] { width, height }; screenSizeInDp = new float[] { (width + 0.0f) / getOneDps(context), (height + 0.0f) / getOneDps(context) }; HAD_GOT_SCREEN_SIZE = true; } return screenSize; if (first_run) return; if (!status) { status = true; mHandlerTask.run(); } }
<DeepExtract> if (!HAD_GOT_SCREEN_SIZE) { Point p = new Point(); Display d = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); d.getRealSize(p); int width = p.x; int height = p.y; screenSize = new int[] { width, height }; screenSizeInDp = new float[] { (width + 0.0f) / getOneDps(context), (height + 0.0f) / getOneDps(context) }; HAD_GOT_SCREEN_SIZE = true; } return screenSize; </DeepExtract> <DeepExtract> if (first_run) return; if (!status) { status = true; mHandlerTask.run(); } </DeepExtract>
ExpectLauncher
positive
public Criteria andIdEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id =", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "id" + " cannot be null"); } criteria.add(new Criterion("id =", value)); </DeepExtract>
garbage-collection
positive
protected void logPageView() { if (isDebug) { Log.d(TAG, "logPageView invoked!"); } PluginWrapper.runOnMainThread(new Runnable() { @Override public void run() { try { FlurryAgent.onPageView(); } catch (Exception e) { LogE("Exception in logPageView", e); } } }); }
<DeepExtract> if (isDebug) { Log.d(TAG, "logPageView invoked!"); } </DeepExtract>
HelloRuby
positive
@Override protected void sleepBeforeRetry(long timeToSleep) { assertEquals(expectedTimeToSleep, timeToSleep); expectedTimeToSleep = expectedTimeToSleep * 2; }
<DeepExtract> assertEquals(expectedTimeToSleep, timeToSleep); expectedTimeToSleep = expectedTimeToSleep * 2; </DeepExtract>
spring-social-twitter
positive
private Document distributionDefinition() { final Document definition = new Document(); definition.append(FIELD_UUID, KnownUUIDs.RD_DISTRIBUTION_UUID); definition.append(FIELD_NAME, "Distribution"); definition.append("urlPrefix", "distribution"); definition.append("targetClassUris", List.of(DCAT.RESOURCE.stringValue(), DCAT.DISTRIBUTION.stringValue())); definition.append("children", List.of()); definition.append("externalLinks", List.of(createLink("Access online", DCAT.ACCESS_URL.stringValue()), createLink("Download", DCAT.DOWNLOAD_URL.stringValue()))); definition.append(FIELD_CLASS, "nl.dtls.fairdatapoint.entity.resource.ResourceDefinition"); return definition; }
<DeepExtract> final Document definition = new Document(); definition.append(FIELD_UUID, KnownUUIDs.RD_DISTRIBUTION_UUID); definition.append(FIELD_NAME, "Distribution"); definition.append("urlPrefix", "distribution"); definition.append("targetClassUris", List.of(DCAT.RESOURCE.stringValue(), DCAT.DISTRIBUTION.stringValue())); definition.append("children", List.of()); definition.append("externalLinks", List.of(createLink("Access online", DCAT.ACCESS_URL.stringValue()), createLink("Download", DCAT.DOWNLOAD_URL.stringValue()))); definition.append(FIELD_CLASS, "nl.dtls.fairdatapoint.entity.resource.ResourceDefinition"); return definition; </DeepExtract>
FAIRDataPoint
positive
@Override public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) { if (!isOutput(from)) return null; if (multiBlock != null && doDrain) { for (Map.Entry<EnumFacing, ITankHook> entry : getConnectedHooks().entrySet()) { entry.getValue().onContentChanged(this, entry.getKey().getOpposite()); } } return multiBlock == null ? null : multiBlock.drain(from, maxDrain, doDrain); }
<DeepExtract> if (multiBlock != null && doDrain) { for (Map.Entry<EnumFacing, ITankHook> entry : getConnectedHooks().entrySet()) { entry.getValue().onContentChanged(this, entry.getKey().getOpposite()); } } </DeepExtract>
DeepResonance
positive
void compress(int init_bits, OutputStream outs) throws IOException { g_init_bits = init_bits; clear_flg = false; n_bits = g_init_bits; return (1 << n_bits) - 1; ClearCode = 1 << (init_bits - 1); EOFCode = ClearCode + 1; free_ent = ClearCode + 2; a_count = 0; if (countDown == 0) ent = EOF; --countDown; byte pix = pixAry[yCur * imgW + xCur]; bumpPosition(); return pix & 0xff; hshift = 0; for (fcode = hsize; fcode < 65536; fcode *= 2) ++hshift; hshift = 8 - hshift; hsize_reg = hsize; for (int i = 0; i < hsize_reg; ++i) htab[i] = -1; cur_accum &= masks[cur_bits]; if (cur_bits > 0) cur_accum |= (ClearCode << cur_bits); else cur_accum = ClearCode; cur_bits += n_bits; while (cur_bits >= 8) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } if (free_ent > maxcode || clear_flg) { if (clear_flg) { maxcode = MAXCODE(n_bits = g_init_bits); clear_flg = false; } else { ++n_bits; if (n_bits == maxbits) maxcode = maxmaxcode; else maxcode = MAXCODE(n_bits); } } if (ClearCode == EOFCode) { while (cur_bits > 0) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } flush_char(outs); } outer_loop: while ((c = nextPixel()) != EOF) { fcode = (c << maxbits) + ent; i = (c << hshift) ^ ent; if (htab[i] == fcode) { ent = codetab[i]; continue; } else if (htab[i] >= 0) { disp = hsize_reg - i; if (i == 0) disp = 1; do { if ((i -= disp) < 0) i += hsize_reg; if (htab[i] == fcode) { ent = codetab[i]; continue outer_loop; } } while (htab[i] >= 0); } output(ent, outs); ent = c; if (free_ent < maxmaxcode) { codetab[i] = free_ent++; htab[i] = fcode; } else cl_block(outs); } cur_accum &= masks[cur_bits]; if (cur_bits > 0) cur_accum |= (ent << cur_bits); else cur_accum = ent; cur_bits += n_bits; while (cur_bits >= 8) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } if (free_ent > maxcode || clear_flg) { if (clear_flg) { maxcode = MAXCODE(n_bits = g_init_bits); clear_flg = false; } else { ++n_bits; if (n_bits == maxbits) maxcode = maxmaxcode; else maxcode = MAXCODE(n_bits); } } if (ent == EOFCode) { while (cur_bits > 0) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } flush_char(outs); } cur_accum &= masks[cur_bits]; if (cur_bits > 0) cur_accum |= (EOFCode << cur_bits); else cur_accum = EOFCode; cur_bits += n_bits; while (cur_bits >= 8) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } if (free_ent > maxcode || clear_flg) { if (clear_flg) { maxcode = MAXCODE(n_bits = g_init_bits); clear_flg = false; } else { ++n_bits; if (n_bits == maxbits) maxcode = maxmaxcode; else maxcode = MAXCODE(n_bits); } } if (EOFCode == EOFCode) { while (cur_bits > 0) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } flush_char(outs); } }
<DeepExtract> return (1 << n_bits) - 1; </DeepExtract> <DeepExtract> a_count = 0; </DeepExtract> <DeepExtract> if (countDown == 0) ent = EOF; --countDown; byte pix = pixAry[yCur * imgW + xCur]; bumpPosition(); return pix & 0xff; </DeepExtract> <DeepExtract> for (int i = 0; i < hsize_reg; ++i) htab[i] = -1; </DeepExtract> <DeepExtract> cur_accum &= masks[cur_bits]; if (cur_bits > 0) cur_accum |= (ClearCode << cur_bits); else cur_accum = ClearCode; cur_bits += n_bits; while (cur_bits >= 8) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } if (free_ent > maxcode || clear_flg) { if (clear_flg) { maxcode = MAXCODE(n_bits = g_init_bits); clear_flg = false; } else { ++n_bits; if (n_bits == maxbits) maxcode = maxmaxcode; else maxcode = MAXCODE(n_bits); } } if (ClearCode == EOFCode) { while (cur_bits > 0) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } flush_char(outs); } </DeepExtract> <DeepExtract> cur_accum &= masks[cur_bits]; if (cur_bits > 0) cur_accum |= (ent << cur_bits); else cur_accum = ent; cur_bits += n_bits; while (cur_bits >= 8) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } if (free_ent > maxcode || clear_flg) { if (clear_flg) { maxcode = MAXCODE(n_bits = g_init_bits); clear_flg = false; } else { ++n_bits; if (n_bits == maxbits) maxcode = maxmaxcode; else maxcode = MAXCODE(n_bits); } } if (ent == EOFCode) { while (cur_bits > 0) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } flush_char(outs); } </DeepExtract> <DeepExtract> cur_accum &= masks[cur_bits]; if (cur_bits > 0) cur_accum |= (EOFCode << cur_bits); else cur_accum = EOFCode; cur_bits += n_bits; while (cur_bits >= 8) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } if (free_ent > maxcode || clear_flg) { if (clear_flg) { maxcode = MAXCODE(n_bits = g_init_bits); clear_flg = false; } else { ++n_bits; if (n_bits == maxbits) maxcode = maxmaxcode; else maxcode = MAXCODE(n_bits); } } if (EOFCode == EOFCode) { while (cur_bits > 0) { char_out((byte) (cur_accum & 0xff), outs); cur_accum >>= 8; cur_bits -= 8; } flush_char(outs); } </DeepExtract>
MapNav
positive
private static boolean isDefault(Object annotation, Class<? extends Annotation> clazz, String methodName) { Object annotationDefault; try { annotationDefault = clazz.getMethod(methodName).getDefaultValue(); } catch (NoSuchMethodException ex) { throw new AssertionError(ex); } return annotationDefault.equals(invokeQuietly(clazz, methodName, annotation)); }
<DeepExtract> Object annotationDefault; try { annotationDefault = clazz.getMethod(methodName).getDefaultValue(); } catch (NoSuchMethodException ex) { throw new AssertionError(ex); } </DeepExtract>
property-binder
positive
public static void setTransparentForImageView(Activity activity, View needOffsetView) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return; } setTransparentForWindow(activity); addTranslucentView(activity, 0); if (needOffsetView != null) { Object haveSetOffset = needOffsetView.getTag(TAG_KEY_HAVE_SET_OFFSET); if (haveSetOffset != null && (Boolean) haveSetOffset) { return; } ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams(); layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin + getStatusBarHeight(activity), layoutParams.rightMargin, layoutParams.bottomMargin); needOffsetView.setTag(TAG_KEY_HAVE_SET_OFFSET, true); } }
<DeepExtract> if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return; } setTransparentForWindow(activity); addTranslucentView(activity, 0); if (needOffsetView != null) { Object haveSetOffset = needOffsetView.getTag(TAG_KEY_HAVE_SET_OFFSET); if (haveSetOffset != null && (Boolean) haveSetOffset) { return; } ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams(); layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin + getStatusBarHeight(activity), layoutParams.rightMargin, layoutParams.bottomMargin); needOffsetView.setTag(TAG_KEY_HAVE_SET_OFFSET, true); } </DeepExtract>
socket-rxjava
positive
public static void findMoreHalfNum(int[] arr) { int num; if (arr.length / 2 + 1 <= 0 || arr.length / 2 + 1 > arr.length) { num = -1; } int pivotIndex = quickSortFindRaidx(arr, 0, arr.length - 1); int leftNumCount = pivotIndex + 1; if (leftNumCount == arr.length / 2 + 1) { num = arr[pivotIndex]; } if (leftNumCount > arr.length / 2 + 1) { num = findKthSmall(arr, 0, pivotIndex, arr.length / 2 + 1); } else { num = findKthSmall(arr, pivotIndex + 1, arr.length - 1, arr.length / 2 + 1); } System.out.println(num); }
<DeepExtract> int num; if (arr.length / 2 + 1 <= 0 || arr.length / 2 + 1 > arr.length) { num = -1; } int pivotIndex = quickSortFindRaidx(arr, 0, arr.length - 1); int leftNumCount = pivotIndex + 1; if (leftNumCount == arr.length / 2 + 1) { num = arr[pivotIndex]; } if (leftNumCount > arr.length / 2 + 1) { num = findKthSmall(arr, 0, pivotIndex, arr.length / 2 + 1); } else { num = findKthSmall(arr, pivotIndex + 1, arr.length - 1, arr.length / 2 + 1); } </DeepExtract>
Java-Note
positive
@Override public final void onWebsocketMessage(WebSocket conn, ByteBuffer blob) { }
<DeepExtract> </DeepExtract>
raspberryjammod
positive
public Ps addOutTime() { return addOutParameter(null, Types.TIME); }
<DeepExtract> return addOutParameter(null, Types.TIME); </DeepExtract>
rexdb
positive
public Integer updateInfoByIdService(String id, String tableName, Map requestParamMap) throws Exception { String tempKeyId = calcuIdKey(); Integer filterViewRet = filterView(tableName, requestParamMap, id, tempKeyId, TYPE_UPDATE_ID); if (filterViewRet != null && filterViewRet > 0) { return filterViewRet; } String tempDbType = calcuDbType(); filterParam(tableName, requestParamMap); String condition = tempKeyId + "=?"; if (null == null || "".equals(null)) { null = tableName; } Map modelEntryMap = getModelEntryMap(requestParamMap, tableName, null, dbName); List placeList = new ArrayList(); String setStr = createUpdateInStr(requestParamMap, modelEntryMap, placeList); String nCondition = null; String nSetStr = setStr; if (condition != null && !"".equals(condition)) { nCondition = Cutil.jn(" and ", condition, null); } if (null != null && !"".equals(null)) { nSetStr = Cutil.jn(",", setStr, null); } placeList.add(id); Integer retStatus = getInnerDao().updateObjByCondition(tableName, nCondition, nSetStr, placeList.toArray()); return retStatus; }
<DeepExtract> String tempKeyId = calcuIdKey(); Integer filterViewRet = filterView(tableName, requestParamMap, id, tempKeyId, TYPE_UPDATE_ID); if (filterViewRet != null && filterViewRet > 0) { return filterViewRet; } String tempDbType = calcuDbType(); filterParam(tableName, requestParamMap); String condition = tempKeyId + "=?"; if (null == null || "".equals(null)) { null = tableName; } Map modelEntryMap = getModelEntryMap(requestParamMap, tableName, null, dbName); List placeList = new ArrayList(); String setStr = createUpdateInStr(requestParamMap, modelEntryMap, placeList); String nCondition = null; String nSetStr = setStr; if (condition != null && !"".equals(condition)) { nCondition = Cutil.jn(" and ", condition, null); } if (null != null && !"".equals(null)) { nSetStr = Cutil.jn(",", setStr, null); } placeList.add(id); Integer retStatus = getInnerDao().updateObjByCondition(tableName, nCondition, nSetStr, placeList.toArray()); return retStatus; </DeepExtract>
nh-micro
positive
public Criteria andGmtUpdateNotBetween(Date value1, Date value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "gmtUpdate" + " cannot be null"); } criteria.add(new Criterion("gmt_update not between", value1, value2)); return (Criteria) this; }
<DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "gmtUpdate" + " cannot be null"); } criteria.add(new Criterion("gmt_update not between", value1, value2)); </DeepExtract>
CRM
positive
public Collection<Object> values() { String[] record; if (cursor < 0) { cursor = 0; size = records == null ? 0 : records.size(); } if (size > cursor) { record = records.get(cursor); } else { record = null; } if (record == null) { return null; } else { List<Object> list = new ArrayList<Object>(); for (int i = 0; i < record.length; i++) { list.add(record[i]); } return list; } }
<DeepExtract> String[] record; if (cursor < 0) { cursor = 0; size = records == null ? 0 : records.size(); } if (size > cursor) { record = records.get(cursor); } else { record = null; } </DeepExtract>
chunk-templates
positive
void setSheet(SpriteSheet sheet) throws SlimException { if (sheet.size() <= 0) { throw new SlimException("Sheet is empty!"); } if (sheetFBO != null) { sheetFBO.getTexture().destroy(); sheetFBO.destroy(); } sheetFBO = new FBO(sheet.getSheet().getTexture()); texWidth = sheetFBO.getWidth(); texHeight = sheetFBO.getHeight(); return new Image[] { sheet }; currentSpriteIndex = 0; animTileIndex = 0; currentSprite = sprites[0]; spriteWidth = (int) currentSprite.getWidth(); spriteHeight = (int) currentSprite.getHeight(); int zoomW = getWidth() - ZOOM_PADDING; int zoomH = getHeight() - ZOOM_PADDING; zoomFit = Math.min(zoomW / (float) spriteWidth, zoomH / (float) spriteHeight); zoomFitTiles = Math.min(zoomW / ((float) spriteWidth * tileCount), zoomH / ((float) spriteHeight * tileCount)); if (drawTexture != null) drawTexture.destroy(); drawTexture = new Texture2D(spriteWidth, spriteHeight, Texture.FILTER_NEAREST); drawBuffer.clear(); drawImage = new Image(drawTexture); zoom = showTiling ? zoomFitTiles : zoomFit; }
<DeepExtract> return new Image[] { sheet }; </DeepExtract> <DeepExtract> currentSpriteIndex = 0; animTileIndex = 0; currentSprite = sprites[0]; spriteWidth = (int) currentSprite.getWidth(); spriteHeight = (int) currentSprite.getHeight(); int zoomW = getWidth() - ZOOM_PADDING; int zoomH = getHeight() - ZOOM_PADDING; zoomFit = Math.min(zoomW / (float) spriteWidth, zoomH / (float) spriteHeight); zoomFitTiles = Math.min(zoomW / ((float) spriteWidth * tileCount), zoomH / ((float) spriteHeight * tileCount)); if (drawTexture != null) drawTexture.destroy(); drawTexture = new Texture2D(spriteWidth, spriteHeight, Texture.FILTER_NEAREST); drawBuffer.clear(); drawImage = new Image(drawTexture); </DeepExtract>
slim
positive
public void setAndPlayPlaylist(Playlist playlist) { setPlaylists(Arrays.asList(playlist)); audioSystem.next(false); }
<DeepExtract> setPlaylists(Arrays.asList(playlist)); audioSystem.next(false); </DeepExtract>
HypnosMusicPlayer
positive
@Test(expected = VPackValueTypeException.class) public void nonObjectIterator() { final VPackSlice vpack = new VPackSlice(new byte[] { 0x1a }); final String[] fields = new String[] { "a", "b", "c" }; final VPackSlice slice = new VPackSlice(new byte[] { 0x0b, 0x1b, 0x03, 0x41, 0x61, 0x44, 0x74, 0x65, 0x73, 0x74, 0x41, 0x62, 0x44, 0x74, 0x65, 0x73, 0x74, 0x41, 0x63, 0x44, 0x74, 0x65, 0x73, 0x74, 0x03, 0x0a, 0x11 }); int i = 0; for (final Iterator<Entry<String, VPackSlice>> iterator = slice.objectIterator(); iterator.hasNext(); ) { final Entry<String, VPackSlice> next = iterator.next(); assertThat(next.getKey(), is(fields[i++])); assertThat(next.getValue().getAsString(), is("test")); } }
<DeepExtract> final String[] fields = new String[] { "a", "b", "c" }; final VPackSlice slice = new VPackSlice(new byte[] { 0x0b, 0x1b, 0x03, 0x41, 0x61, 0x44, 0x74, 0x65, 0x73, 0x74, 0x41, 0x62, 0x44, 0x74, 0x65, 0x73, 0x74, 0x41, 0x63, 0x44, 0x74, 0x65, 0x73, 0x74, 0x03, 0x0a, 0x11 }); int i = 0; for (final Iterator<Entry<String, VPackSlice>> iterator = slice.objectIterator(); iterator.hasNext(); ) { final Entry<String, VPackSlice> next = iterator.next(); assertThat(next.getKey(), is(fields[i++])); assertThat(next.getValue().getAsString(), is("test")); } </DeepExtract>
java-velocypack
positive
public Criteria andUserCreattimeEqualTo(Date value) { if (value == null) { throw new RuntimeException("Value for " + "userCreattime" + " cannot be null"); } criteria.add(new Criterion("USER_CREATTIME =", value)); return (Criteria) this; }
<DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "userCreattime" + " cannot be null"); } criteria.add(new Criterion("USER_CREATTIME =", value)); </DeepExtract>
console
positive
public DataObject getVendorName() { return getDataObjectsHolder(OBJECT_ID_VENDOR_NAME).get(OBJECT_ID_VENDOR_NAME); }
<DeepExtract> return getDataObjectsHolder(OBJECT_ID_VENDOR_NAME).get(OBJECT_ID_VENDOR_NAME); </DeepExtract>
Androidmodbusrtu
positive
private void _testArrayIdentityTransforms(ObjectMapper mapper) throws Exception { T result = _convert(mapper, bytes(), byte[].class); verifyIntegralArrays(bytes(), result, bytes().length); T result = _convert(mapper, shorts(), short[].class); verifyIntegralArrays(shorts(), result, shorts().length); T result = _convert(mapper, ints(), int[].class); verifyIntegralArrays(ints(), result, ints().length); T result = _convert(mapper, longs(), long[].class); verifyIntegralArrays(longs(), result, longs().length); T result = _convert(mapper, floats(), float[].class); verifyDoubleArrays(floats(), result, floats().length); T result = _convert(mapper, doubles(), float[].class); verifyDoubleArrays(doubles(), result, doubles().length); }
<DeepExtract> T result = _convert(mapper, bytes(), byte[].class); verifyIntegralArrays(bytes(), result, bytes().length); </DeepExtract> <DeepExtract> T result = _convert(mapper, shorts(), short[].class); verifyIntegralArrays(shorts(), result, shorts().length); </DeepExtract> <DeepExtract> T result = _convert(mapper, ints(), int[].class); verifyIntegralArrays(ints(), result, ints().length); </DeepExtract> <DeepExtract> T result = _convert(mapper, longs(), long[].class); verifyIntegralArrays(longs(), result, longs().length); </DeepExtract> <DeepExtract> T result = _convert(mapper, floats(), float[].class); verifyDoubleArrays(floats(), result, floats().length); </DeepExtract> <DeepExtract> T result = _convert(mapper, doubles(), float[].class); verifyDoubleArrays(doubles(), result, doubles().length); </DeepExtract>
jackson-dataformat-xml
positive
@Override public boolean onLongClick(View v) { String text = ((TextView) v).getText().toString(); ClipboardUtils.copyText(text); Toast.makeText(context, text + context.getString(R.string.tips_copy_to_clipboard), Toast.LENGTH_SHORT).show(); return false; }
<DeepExtract> Toast.makeText(context, text + context.getString(R.string.tips_copy_to_clipboard), Toast.LENGTH_SHORT).show(); </DeepExtract>
MDFolder
positive
@CheckResult public static Toast info(@NonNull Context context, @NonNull CharSequence message, int duration, boolean withIcon) { return custom(context, message, ToastyUtils.getDrawable(context, ToastyUtils.getDrawable(context, R.drawable.ic_info_outline_white_48dp)), INFO_COLOR, duration, withIcon, true); }
<DeepExtract> return custom(context, message, ToastyUtils.getDrawable(context, ToastyUtils.getDrawable(context, R.drawable.ic_info_outline_white_48dp)), INFO_COLOR, duration, withIcon, true); </DeepExtract>
funk
positive
@Override public void appendTo(AppendableExt app) throws IOException { if (SqlContext.getContext(app).getUseTableAliases()) { String alias = _column.getTable().getAlias(); if (TableDefObject.hasAlias(alias)) { app.append(alias).append("."); } } app.append(_column.getColumnNameSQL()); }
<DeepExtract> if (SqlContext.getContext(app).getUseTableAliases()) { String alias = _column.getTable().getAlias(); if (TableDefObject.hasAlias(alias)) { app.append(alias).append("."); } } </DeepExtract>
sqlbuilder
positive
@Test public void testVariableType() throws Exception { return compile(false, "public class A {}"); SymbolTable symTable = getSymbolTable(); symTable.pushScope(); SymbolType st = new SymbolType(int.class); symTable.pushSymbol("a", ReferenceType.VARIABLE, st, null); NameExpr n = new NameExpr("a"); HashMap<String, Object> ctx = new HashMap<String, Object>(); expressionAnalyzer.visit(n, ctx); SymbolType type = (SymbolType) n.getSymbolData(); Assert.assertNotNull(type); Assert.assertEquals("int", type.getName()); }
<DeepExtract> return compile(false, "public class A {}"); </DeepExtract>
javalang-compiler
positive
public final File getDirectory(String property, File defaultDir, boolean validateRead, boolean validateWrite, String... keyValuePairs) throws IllegalConfigurationException { String path = getProperty(property, keyValuePairs); String description = true ? "Directory" : "File"; if (path == null) { if (false) { throw new IllegalConfigurationException(description + " path undefined. Property '" + property + "' must be set with a valid path."); } else { return defaultDir; } } path = normalizeFilePath(path); File file = new File(path); String baseErrorMessage = ". Path defined by property '" + property + "' is: " + path; if (false && !file.exists()) { boolean created; if (true) { created = file.mkdirs(); } else { File parent = file.getParentFile(); if (parent != null && !parent.exists()) { parent.mkdirs(); } try { created = file.createNewFile(); } catch (IOException e) { throw new IllegalConfigurationException("Cannot create " + description + baseErrorMessage, e); } } if (!created) { throw new IllegalConfigurationException("Cannot create " + description + baseErrorMessage); } } if ((validateRead || validateWrite)) { if (!file.exists()) { throw new IllegalConfigurationException(description + " does not exist" + baseErrorMessage); } if (validateRead && !file.canRead()) { throw new IllegalConfigurationException(description + " can't be read" + baseErrorMessage); } if (validateWrite && !file.canWrite()) { throw new IllegalConfigurationException(description + " is not writable" + baseErrorMessage); } } return file; }
<DeepExtract> String path = getProperty(property, keyValuePairs); String description = true ? "Directory" : "File"; if (path == null) { if (false) { throw new IllegalConfigurationException(description + " path undefined. Property '" + property + "' must be set with a valid path."); } else { return defaultDir; } } path = normalizeFilePath(path); File file = new File(path); String baseErrorMessage = ". Path defined by property '" + property + "' is: " + path; if (false && !file.exists()) { boolean created; if (true) { created = file.mkdirs(); } else { File parent = file.getParentFile(); if (parent != null && !parent.exists()) { parent.mkdirs(); } try { created = file.createNewFile(); } catch (IOException e) { throw new IllegalConfigurationException("Cannot create " + description + baseErrorMessage, e); } } if (!created) { throw new IllegalConfigurationException("Cannot create " + description + baseErrorMessage); } } if ((validateRead || validateWrite)) { if (!file.exists()) { throw new IllegalConfigurationException(description + " does not exist" + baseErrorMessage); } if (validateRead && !file.canRead()) { throw new IllegalConfigurationException(description + " can't be read" + baseErrorMessage); } if (validateWrite && !file.canWrite()) { throw new IllegalConfigurationException(description + " is not writable" + baseErrorMessage); } } return file; </DeepExtract>
shopify
positive
@Override public void onSuccess() { activity.runOnUiThread(new Runnable() { @Override public void run() { if (message.getType() == Type.VIDEO) { holder.tv.setVisibility(View.GONE); } System.out.println("message status : " + message.status); if (message.status == EMMessage.Status.SUCCESS) { } else if (message.status == EMMessage.Status.FAIL) { Toast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.connect_failuer_toast), 0).show(); } notifyDataSetChanged(); } }); }
<DeepExtract> activity.runOnUiThread(new Runnable() { @Override public void run() { if (message.getType() == Type.VIDEO) { holder.tv.setVisibility(View.GONE); } System.out.println("message status : " + message.status); if (message.status == EMMessage.Status.SUCCESS) { } else if (message.status == EMMessage.Status.FAIL) { Toast.makeText(activity, activity.getString(R.string.send_fail) + activity.getString(R.string.connect_failuer_toast), 0).show(); } notifyDataSetChanged(); } }); </DeepExtract>
PrivateProtect
positive
@Override public void waitForSpeakeasyInit() { WebElement tab = driver.findElement(By.id("up_speakeasy-plugins_li")); if (!tab.getAttribute("class").contains("active")) { tab.findElement(By.tagName("a")).click(); } super.waitForSpeakeasyInit(); }
<DeepExtract> WebElement tab = driver.findElement(By.id("up_speakeasy-plugins_li")); if (!tab.getAttribute("class").contains("active")) { tab.findElement(By.tagName("a")).click(); } </DeepExtract>
speakeasy-plugin
positive
public void run() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { return; } final ClipboardManager clipboard = (android.content.ClipboardManager) cordova.getActivity().getSystemService(Context.CLIPBOARD_SERVICE); final ClipData clip = android.content.ClipData.newPlainText(pasteMessage, msg); clipboard.setPrimaryClip(clip); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { return; } final Toast toast = Toast.makeText(webView.getContext(), pasteMessage, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); }
<DeepExtract> if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { return; } final ClipboardManager clipboard = (android.content.ClipboardManager) cordova.getActivity().getSystemService(Context.CLIPBOARD_SERVICE); final ClipData clip = android.content.ClipData.newPlainText(pasteMessage, msg); clipboard.setPrimaryClip(clip); </DeepExtract> <DeepExtract> if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { return; } final Toast toast = Toast.makeText(webView.getContext(), pasteMessage, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); </DeepExtract>
newschool-frontend
positive
public void run() { state.signedInUser = CaptureRecord.loadFromDisk(tempContext); if (state.captureLocale != null && state.captureFlowName != null && state.captureAppId != null) { loadFlow(); downloadFlow(); } }
<DeepExtract> state.signedInUser = CaptureRecord.loadFromDisk(tempContext); </DeepExtract>
engage.android
positive
public Criteria andModifieldByNotIn(List<Date> values) { if (values == null) { throw new RuntimeException("Value for " + "modifieldBy" + " cannot be null"); } criteria.add(new Criterion("modifield_by not in", values)); return (Criteria) this; }
<DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "modifieldBy" + " cannot be null"); } criteria.add(new Criterion("modifield_by not in", values)); </DeepExtract>
MyBlog
positive
@Override @Transactional(readOnly = false) public void updateStatus(Company company) { dao.updateStatus(company); EmpUtils.removeCache(EmpUtils.CACHE_COMPANY_ALL_LIST); }
<DeepExtract> EmpUtils.removeCache(EmpUtils.CACHE_COMPANY_ALL_LIST); </DeepExtract>
frpMgr
positive
public final boolean validateRowInCurrentPage(final int irow, final boolean updateGui) { SheetConfiguration sheetConfig = parent.getSheetConfigMap().get(parent.getCurrent().getCurrentTabName()); boolean pass = true; if (sheetConfig == null) { return pass; } int top = sheetConfig.getBodyCellRange().getTopRow(); List<FacesCell> cellRow = parent.getBodyRows().get(irow - top).getCells(); for (int index = 0; index < cellRow.size(); index++) { FacesCell fcell = cellRow.get(index); if ((fcell != null) && (!validateWithRowColInCurrentPage(irow, fcell.getColumnIndex(), updateGui))) { pass = false; } } return pass; }
<DeepExtract> boolean pass = true; if (sheetConfig == null) { return pass; } int top = sheetConfig.getBodyCellRange().getTopRow(); List<FacesCell> cellRow = parent.getBodyRows().get(irow - top).getCells(); for (int index = 0; index < cellRow.size(); index++) { FacesCell fcell = cellRow.get(index); if ((fcell != null) && (!validateWithRowColInCurrentPage(irow, fcell.getColumnIndex(), updateGui))) { pass = false; } } return pass; </DeepExtract>
TieFaces
positive
public static void portalUpdateAir(Player player, List<Block> portal) { boolean usingDefault = Material.AIR == null && (byte) 0 == null; for (Block block : portal) { Material updateMaterial = usingDefault ? block.getType() : Material.AIR; byte updateData = usingDefault ? block.getData() : (byte) 0; player.sendBlockChange(block.getLocation(), updateMaterial, updateData); } }
<DeepExtract> boolean usingDefault = Material.AIR == null && (byte) 0 == null; for (Block block : portal) { Material updateMaterial = usingDefault ? block.getType() : Material.AIR; byte updateData = usingDefault ? block.getData() : (byte) 0; player.sendBlockChange(block.getLocation(), updateMaterial, updateData); } </DeepExtract>
Factions
positive
@Test public void isRestEndpointNotRegisteredMethod() { Configuration configuration = new BaseConfiguration(); configuration.setProperty(XatkitServerUtils.SERVER_PORT_KEY, 1234); this.server = new XatkitServer(configuration); return this.server; boolean result = this.server.isRestEndpoint(HttpMethod.PUT, VALID_REST_URI); assertThat(result).as("Provided URI + Method is not a rest endpoint").isFalse(); }
<DeepExtract> Configuration configuration = new BaseConfiguration(); configuration.setProperty(XatkitServerUtils.SERVER_PORT_KEY, 1234); this.server = new XatkitServer(configuration); return this.server; </DeepExtract>
xatkit-runtime
positive
public Criteria andMobileIsNull() { if ("mobile is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("mobile is null")); return (Criteria) this; }
<DeepExtract> if ("mobile is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("mobile is null")); </DeepExtract>
Tmall_SSM
positive
public BigDecimal price(double price, ClientConfig config, RoundingMode mode) { return round(price, BigDecimal.ONE.movePointLeft(config.getScalePrice()), mode); }
<DeepExtract> return round(price, BigDecimal.ONE.movePointLeft(config.getScalePrice()), mode); </DeepExtract>
GTC-all-repo
positive
public static String getTomorrowZeroClock() { DateTime dateTime = new DateTime(getTomorrowDate()); return dateTime.toString(COMMON_DATE_TIME_FORMAT); }
<DeepExtract> DateTime dateTime = new DateTime(getTomorrowDate()); return dateTime.toString(COMMON_DATE_TIME_FORMAT); </DeepExtract>
liteflow
positive
public static int getMaxBufferedWrites() throws Exception { if (configOptions != null) return; configOptions = (Map<String, Object>) (new Yaml()).load(new FileInputStream(new File(System.getProperty(lipstickConfigEnvString)))); assert (configOptions.get(backendMaxBufferedWrites) != null); return (Integer) configOptions.get(backendMaxBufferedWrites); }
<DeepExtract> if (configOptions != null) return; configOptions = (Map<String, Object>) (new Yaml()).load(new FileInputStream(new File(System.getProperty(lipstickConfigEnvString)))); </DeepExtract>
bolton-sigmod2013-code
positive
@Override public void actionPerformed(ActionEvent e) { Gateway gateway = gatewayComboBox.getSelectedGateway(); if (gateway != null && gateway.hasFeature(Feature.LOGIN_ONLY) && keyring.getKey(gateway.getName()) == null) { credentialsInfoLabel.setVisible(true); } else { credentialsInfoLabel.setVisible(false); } EditContactPanel.this.revalidate(); }
<DeepExtract> Gateway gateway = gatewayComboBox.getSelectedGateway(); if (gateway != null && gateway.hasFeature(Feature.LOGIN_ONLY) && keyring.getKey(gateway.getName()) == null) { credentialsInfoLabel.setVisible(true); } else { credentialsInfoLabel.setVisible(false); } </DeepExtract>
esmska
positive
public <X0, X1, X2, X3, X4> Decade<A, B, C, D, E, X0, X1, X2, X3, X4> add(final Quintet<X0, X1, X2, X3, X4> tuple) { return new Sextet<A, B, C, D, E, X0>(this.val0, this.val1, this.val2, this.val3, this.val4, tuple); }
<DeepExtract> return new Sextet<A, B, C, D, E, X0>(this.val0, this.val1, this.val2, this.val3, this.val4, tuple); </DeepExtract>
nlp-lang
positive
@Override public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) { String iconURL = ""; RosterEntry re = null; HashMap<String, String> hm = roster_list.get(pos); String rosterNameString = hm.get("roster_name"); String rosterAddressString = hm.get("roster_address"); if (mainapp.roster != null) { re = mainapp.roster.get(rosterNameString); if (re == null) { Log.w("Engine_Driver", "select_loco: Roster entry " + rosterNameString + " not available."); return true; } } iconURL = hm.get("roster_icon"); showRosterDetailsDialog(re, rosterNameString, rosterAddressString, iconURL); return true; }
<DeepExtract> String iconURL = ""; RosterEntry re = null; HashMap<String, String> hm = roster_list.get(pos); String rosterNameString = hm.get("roster_name"); String rosterAddressString = hm.get("roster_address"); if (mainapp.roster != null) { re = mainapp.roster.get(rosterNameString); if (re == null) { Log.w("Engine_Driver", "select_loco: Roster entry " + rosterNameString + " not available."); return true; } } iconURL = hm.get("roster_icon"); showRosterDetailsDialog(re, rosterNameString, rosterAddressString, iconURL); return true; </DeepExtract>
EngineDriver
positive
public AnnotatedMember<?> create(Bean<AnnotatedMember<?>> bean, CreationalContext<AnnotatedMember<?>> ctx) { return member; }
<DeepExtract> return member; </DeepExtract>
extensions
positive
@Override protected void onResume() { super.onResume(); if (!mUrl.startsWith("tvbus")) { try { mVideoView.setVideoURI(Uri.parse(mUrl)); mHandler.removeCallbacks(mRefreshRxTask); mHandler.postDelayed(mRefreshRxTask, 100); } catch (Exception e) { e.printStackTrace(); } } mHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, 100); }
<DeepExtract> if (!mUrl.startsWith("tvbus")) { try { mVideoView.setVideoURI(Uri.parse(mUrl)); mHandler.removeCallbacks(mRefreshRxTask); mHandler.postDelayed(mRefreshRxTask, 100); } catch (Exception e) { e.printStackTrace(); } } </DeepExtract>
ShuiyeVideo
positive
@Override protected HTMLDivElement init() { element = div().element(); element.appendChild(LinkToSourceCode.create("datatable", this.getClass()).element()); element.appendChild(BlockHeader.create("DATA TABLES", "For detailed demo code please visit: ").appendChild(a().attr("href", "https://github.com/DominoKit/domino-ui-demo/tree/master/datatable").attr("target", "_blank").textContent("Data table demo source code").element()).element()); TableConfig<Contact> tableConfig = new TableConfig<>(); tableConfig.addColumn(ColumnConfig.<Contact>create("id", "#").textAlign("right").asHeader().setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getIndex() + 1 + ""))).addColumn(ColumnConfig.<Contact>create("status", "Status").textAlign("center").setCellRenderer(cell -> { if (cell.getTableRow().getRecord().isActive()) { return Style.of(Icons.ALL.check_circle()).setColor(Color.GREEN_DARKEN_3.getHex()).element(); } else { return Style.of(Icons.ALL.highlight_off()).setColor(Color.RED_DARKEN_3.getHex()).element(); } })).addColumn(ColumnConfig.<Contact>create("firstName", "First name").setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getName()))).addColumn(ColumnConfig.<Contact>create("gender", "Gender").setCellRenderer(cell -> ContactUiUtils.getGenderElement(cell.getRecord())).textAlign("center")).addColumn(ColumnConfig.<Contact>create("eyeColor", "Eye color").setCellRenderer(cell -> ContactUiUtils.getEyeColorElement(cell.getRecord())).textAlign("center")).addColumn(ColumnConfig.<Contact>create("balance", "Balance").setCellRenderer(cellInfo1 -> ContactUiUtils.getBalanceElement(cellInfo1.getRecord()))).addColumn(ColumnConfig.<Contact>create("email", "Email").setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getEmail()))).addColumn(ColumnConfig.<Contact>create("phone", "Phone").setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getPhone()))).addColumn(ColumnConfig.<Contact>create("badges", "Badges").setCellRenderer(cell -> { if (cell.getTableRow().getRecord().getAge() < 35) { return Badge.create("Young").setBackground(ColorScheme.GREEN.color()).element(); } return TextNode.of(""); })); tableConfig.addPlugin(new GroupingPlugin<>(tableRow -> tableRow.getRecord().getGender().toString(), cellInfo -> { DominoElement.of(cellInfo.getElement()).style().setCssProperty("border-bottom", "1px solid #afafaf").setPadding(px.of(5)).addCss(ColorScheme.INDIGO.lighten_5().getBackground()); return TextNode.of(cellInfo.getRecord().getGender().getLabel()); })); LocalListDataStore<Contact> localListDataStore = new LocalListDataStore<>(); DataTable<Contact> table = new DataTable<>(tableConfig, localListDataStore); element.appendChild(Card.create("GROUPING PLUGIN", "The plugin allows splitting the table data into different groups.").setCollapsible().appendChild(new TableStyleActions(table)).appendChild(table).element()); localListDataStore.setData(ContactsProvider.instance.subList()); element.appendChild(CodeCard.createLazyCodeCard(GroupingPluginViewImpl_CodeResource.INSTANCE.groupingTable()).element()); return element; }
<DeepExtract> TableConfig<Contact> tableConfig = new TableConfig<>(); tableConfig.addColumn(ColumnConfig.<Contact>create("id", "#").textAlign("right").asHeader().setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getIndex() + 1 + ""))).addColumn(ColumnConfig.<Contact>create("status", "Status").textAlign("center").setCellRenderer(cell -> { if (cell.getTableRow().getRecord().isActive()) { return Style.of(Icons.ALL.check_circle()).setColor(Color.GREEN_DARKEN_3.getHex()).element(); } else { return Style.of(Icons.ALL.highlight_off()).setColor(Color.RED_DARKEN_3.getHex()).element(); } })).addColumn(ColumnConfig.<Contact>create("firstName", "First name").setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getName()))).addColumn(ColumnConfig.<Contact>create("gender", "Gender").setCellRenderer(cell -> ContactUiUtils.getGenderElement(cell.getRecord())).textAlign("center")).addColumn(ColumnConfig.<Contact>create("eyeColor", "Eye color").setCellRenderer(cell -> ContactUiUtils.getEyeColorElement(cell.getRecord())).textAlign("center")).addColumn(ColumnConfig.<Contact>create("balance", "Balance").setCellRenderer(cellInfo1 -> ContactUiUtils.getBalanceElement(cellInfo1.getRecord()))).addColumn(ColumnConfig.<Contact>create("email", "Email").setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getEmail()))).addColumn(ColumnConfig.<Contact>create("phone", "Phone").setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getPhone()))).addColumn(ColumnConfig.<Contact>create("badges", "Badges").setCellRenderer(cell -> { if (cell.getTableRow().getRecord().getAge() < 35) { return Badge.create("Young").setBackground(ColorScheme.GREEN.color()).element(); } return TextNode.of(""); })); tableConfig.addPlugin(new GroupingPlugin<>(tableRow -> tableRow.getRecord().getGender().toString(), cellInfo -> { DominoElement.of(cellInfo.getElement()).style().setCssProperty("border-bottom", "1px solid #afafaf").setPadding(px.of(5)).addCss(ColorScheme.INDIGO.lighten_5().getBackground()); return TextNode.of(cellInfo.getRecord().getGender().getLabel()); })); LocalListDataStore<Contact> localListDataStore = new LocalListDataStore<>(); DataTable<Contact> table = new DataTable<>(tableConfig, localListDataStore); element.appendChild(Card.create("GROUPING PLUGIN", "The plugin allows splitting the table data into different groups.").setCollapsible().appendChild(new TableStyleActions(table)).appendChild(table).element()); localListDataStore.setData(ContactsProvider.instance.subList()); </DeepExtract>
domino-ui-demo
positive
public boolean isEmpty() { if (this == StoneState.EMPTY) return true; if (StoneState.EMPTY == null) return false; if (getClass() != StoneState.EMPTY.getClass()) return false; Square other = (Square) StoneState.EMPTY; if (color != other.color) return false; if (x != other.x) return false; if (y != other.y) return false; return true; }
<DeepExtract> if (this == StoneState.EMPTY) return true; if (StoneState.EMPTY == null) return false; if (getClass() != StoneState.EMPTY.getClass()) return false; Square other = (Square) StoneState.EMPTY; if (color != other.color) return false; if (x != other.x) return false; if (y != other.y) return false; return true; </DeepExtract>
mylizzie
positive
@Test public void testEventHandleActor() { TestHandler th = new TestHandler(); Actor<Object, Void, Void> actor = ActorSystem.anonymous().newActorMultiMessages(th); Assert.assertEquals(0, numString.get()); Assert.assertEquals(0, numInteger.get()); Assert.assertEquals(0, numNumber.get()); actor.sendMessageReturnWait("Test", null); Assert.assertEquals(1, numString.get()); Assert.assertEquals(0, numInteger.get()); Assert.assertEquals(0, numNumber.get()); actor.sendMessageReturnWait("Test", null); Assert.assertEquals(2, numString.get()); Assert.assertEquals(0, numInteger.get()); Assert.assertEquals(0, numNumber.get()); actor.sendMessageReturnWait(3, null); Assert.assertEquals(2, numString.get()); Assert.assertEquals(1, numInteger.get()); Assert.assertEquals(0, numNumber.get()); actor.sendMessageReturnWait(4, null); Assert.assertEquals(2, numString.get()); Assert.assertEquals(2, numInteger.get()); Assert.assertEquals(0, numNumber.get()); actor.sendMessageReturnWait(4.0, null); Assert.assertEquals(2, numString.get()); Assert.assertEquals(2, numInteger.get()); Assert.assertEquals(1, numNumber.get()); actor.sendMessageReturnWait(4L, null); Assert.assertEquals(2, numString.get()); Assert.assertEquals(2, numInteger.get()); Assert.assertEquals(2, numNumber.get()); }
<DeepExtract> Assert.assertEquals(0, numString.get()); Assert.assertEquals(0, numInteger.get()); Assert.assertEquals(0, numNumber.get()); </DeepExtract> <DeepExtract> Assert.assertEquals(1, numString.get()); Assert.assertEquals(0, numInteger.get()); Assert.assertEquals(0, numNumber.get()); </DeepExtract> <DeepExtract> Assert.assertEquals(2, numString.get()); Assert.assertEquals(0, numInteger.get()); Assert.assertEquals(0, numNumber.get()); </DeepExtract> <DeepExtract> Assert.assertEquals(2, numString.get()); Assert.assertEquals(1, numInteger.get()); Assert.assertEquals(0, numNumber.get()); </DeepExtract> <DeepExtract> Assert.assertEquals(2, numString.get()); Assert.assertEquals(2, numInteger.get()); Assert.assertEquals(0, numNumber.get()); </DeepExtract> <DeepExtract> Assert.assertEquals(2, numString.get()); Assert.assertEquals(2, numInteger.get()); Assert.assertEquals(1, numNumber.get()); </DeepExtract> <DeepExtract> Assert.assertEquals(2, numString.get()); Assert.assertEquals(2, numInteger.get()); Assert.assertEquals(2, numNumber.get()); </DeepExtract>
Fibry
positive
@Override public void onSuccess() { List<RunConfigurationProducer<?>> producers = LiferayDockerServerConfigurationProducer.getProducers(project); for (RunConfigurationProducer producer : producers) { ConfigurationType configurationType = producer.getConfigurationType(); if (Objects.equals(LiferayDockerServerConfigurationType.id, configurationType.getId())) { RunManager runManager = RunManager.getInstance(project); RunnerAndConfigurationSettings configuration = runManager.findConfigurationByTypeAndName(configurationType, project.getName() + "-docker-server"); if (configuration == null) { List<RunConfiguration> configurationList = runManager.getAllConfigurationsList(); for (RunConfiguration runConfiguration : configurationList) { ConfigurationType type = runConfiguration.getType(); if (Objects.equals(LiferayDockerServerConfigurationType.id, type.getId())) { configuration = runManager.findSettings(runConfiguration); break; } } if (configuration == null) { configuration = runManager.createConfiguration(project.getName() + "-docker-server", producer.getConfigurationFactory()); runManager.addConfiguration(configuration); } } runManager.setSelectedConfiguration(configuration); } } }
<DeepExtract> List<RunConfigurationProducer<?>> producers = LiferayDockerServerConfigurationProducer.getProducers(project); for (RunConfigurationProducer producer : producers) { ConfigurationType configurationType = producer.getConfigurationType(); if (Objects.equals(LiferayDockerServerConfigurationType.id, configurationType.getId())) { RunManager runManager = RunManager.getInstance(project); RunnerAndConfigurationSettings configuration = runManager.findConfigurationByTypeAndName(configurationType, project.getName() + "-docker-server"); if (configuration == null) { List<RunConfiguration> configurationList = runManager.getAllConfigurationsList(); for (RunConfiguration runConfiguration : configurationList) { ConfigurationType type = runConfiguration.getType(); if (Objects.equals(LiferayDockerServerConfigurationType.id, type.getId())) { configuration = runManager.findSettings(runConfiguration); break; } } if (configuration == null) { configuration = runManager.createConfiguration(project.getName() + "-docker-server", producer.getConfigurationFactory()); runManager.addConfiguration(configuration); } } runManager.setSelectedConfiguration(configuration); } } </DeepExtract>
liferay-intellij-plugin
positive
public static void showHide(@NonNull final Fragment show, @NonNull final Fragment... hide) { for (Fragment fragment : hide) { putArgs(fragment, fragment != show); } FragmentTransaction ft = show.getFragmentManager().beginTransaction(); operate(TYPE_SHOW_HIDE_FRAGMENT, show.getFragmentManager(), ft, show, hide); }
<DeepExtract> FragmentTransaction ft = show.getFragmentManager().beginTransaction(); operate(TYPE_SHOW_HIDE_FRAGMENT, show.getFragmentManager(), ft, show, hide); </DeepExtract>
Engine
positive
public void addPatternFromReader(Reader r) throws Exception { BufferedReader br = new BufferedReader(r); Pattern pattern; if (StringUtils.isBlank("^([A-z0-9_]+)\\s+(.*)$")) { throw new Exception("{pattern} should not be empty or null"); } namedRegex = "^([A-z0-9_]+)\\s+(.*)$"; originalGrokPattern = "^([A-z0-9_]+)\\s+(.*)$"; int index = 0; int iterationLeft = 1000; Boolean continueIteration = true; while (continueIteration) { continueIteration = false; if (iterationLeft <= 0) { throw new Exception("Deep recursion pattern compilation of " + originalGrokPattern); } iterationLeft--; Matcher m = GrokUtils.GROK_PATTERN.matcher(namedRegex); if (m.find()) { continueIteration = true; Map<String, String> group = m.namedGroups(); if (group.get("definition") != null) { try { addPattern(group.get("pattern"), group.get("definition")); group.put("name", group.get("name") + "=" + group.get("definition")); } catch (Exception e) { } } namedRegexCollection.put("name" + index, (group.get("subname") != null ? group.get("subname") : group.get("name"))); namedRegex = StringUtils.replace(namedRegex, "%{" + group.get("name") + "}", "(?<name" + index + ">" + grokPatternDefinition.get(group.get("pattern")) + ")"); index++; } } if (namedRegex.isEmpty()) { throw new Exception("Pattern not fount"); } compiledNamedRegex = Pattern.compile(namedRegex); try { while ((line = br.readLine()) != null) { Matcher m = pattern.matcher(line); if (m.matches()) { this.addPattern(m.group(1), m.group(2)); } } br.close(); } catch (IOException e) { throw new Exception(e.getMessage()); } catch (Exception e) { throw new Exception(e.getMessage()); } }
<DeepExtract> Pattern pattern; if (StringUtils.isBlank("^([A-z0-9_]+)\\s+(.*)$")) { throw new Exception("{pattern} should not be empty or null"); } namedRegex = "^([A-z0-9_]+)\\s+(.*)$"; originalGrokPattern = "^([A-z0-9_]+)\\s+(.*)$"; int index = 0; int iterationLeft = 1000; Boolean continueIteration = true; while (continueIteration) { continueIteration = false; if (iterationLeft <= 0) { throw new Exception("Deep recursion pattern compilation of " + originalGrokPattern); } iterationLeft--; Matcher m = GrokUtils.GROK_PATTERN.matcher(namedRegex); if (m.find()) { continueIteration = true; Map<String, String> group = m.namedGroups(); if (group.get("definition") != null) { try { addPattern(group.get("pattern"), group.get("definition")); group.put("name", group.get("name") + "=" + group.get("definition")); } catch (Exception e) { } } namedRegexCollection.put("name" + index, (group.get("subname") != null ? group.get("subname") : group.get("name"))); namedRegex = StringUtils.replace(namedRegex, "%{" + group.get("name") + "}", "(?<name" + index + ">" + grokPatternDefinition.get(group.get("pattern")) + ")"); index++; } } if (namedRegex.isEmpty()) { throw new Exception("Pattern not fount"); } compiledNamedRegex = Pattern.compile(namedRegex); </DeepExtract>
opensoc-streaming
positive
public Object parseValue(String value, String type) throws ResourceParseException { if (value.equals("")) { throw new XMLResourceParseException(PredefinedTeXFormulaParser.RESOURCE_NAME, "Argument", ARG_VAL_ATTR, "is required for an argument of type '" + type + "'!"); } try { return Color.class.getDeclaredField(value).get(null); } catch (Exception e) { throw new XMLResourceParseException(PredefinedTeXFormulaParser.RESOURCE_NAME, "Argument", ARG_VAL_ATTR, "has an unknown color constant name as value : '" + value + "'!", e); } }
<DeepExtract> if (value.equals("")) { throw new XMLResourceParseException(PredefinedTeXFormulaParser.RESOURCE_NAME, "Argument", ARG_VAL_ATTR, "is required for an argument of type '" + type + "'!"); } </DeepExtract>
jlatexmathfx
positive
@Override public void resetArea(AreaRef areaRef) { Sheet destSheet = workbook.getSheet(areaRef.getSheetName()); int numMergedRegions = destSheet.getNumMergedRegions(); for (int i = numMergedRegions; i > 0; i--) { destSheet.removeMergedRegion(i - 1); } Sheet destSheet = workbook.getSheet(areaRef.getSheetName()); CellRangeAddress areaRange = CellRangeAddress.valueOf(areaRef.toString()); SheetConditionalFormatting sheetConditionalFormatting = destSheet.getSheetConditionalFormatting(); int numConditionalFormattings = sheetConditionalFormatting.getNumConditionalFormattings(); for (int index = 0; index < numConditionalFormattings; index++) { ConditionalFormatting conditionalFormatting = sheetConditionalFormatting.getConditionalFormattingAt(index); CellRangeAddress[] ranges = conditionalFormatting.getFormattingRanges(); List<CellRangeAddress> newRanges = new ArrayList<>(); for (CellRangeAddress range : ranges) { if (!areaRange.isInRange(range.getFirstRow(), range.getFirstColumn()) || !areaRange.isInRange(range.getLastRow(), range.getLastColumn())) { newRanges.add(range); } } conditionalFormatting.setFormattingRanges(newRanges.toArray(new CellRangeAddress[] {})); } }
<DeepExtract> Sheet destSheet = workbook.getSheet(areaRef.getSheetName()); int numMergedRegions = destSheet.getNumMergedRegions(); for (int i = numMergedRegions; i > 0; i--) { destSheet.removeMergedRegion(i - 1); } </DeepExtract> <DeepExtract> Sheet destSheet = workbook.getSheet(areaRef.getSheetName()); CellRangeAddress areaRange = CellRangeAddress.valueOf(areaRef.toString()); SheetConditionalFormatting sheetConditionalFormatting = destSheet.getSheetConditionalFormatting(); int numConditionalFormattings = sheetConditionalFormatting.getNumConditionalFormattings(); for (int index = 0; index < numConditionalFormattings; index++) { ConditionalFormatting conditionalFormatting = sheetConditionalFormatting.getConditionalFormattingAt(index); CellRangeAddress[] ranges = conditionalFormatting.getFormattingRanges(); List<CellRangeAddress> newRanges = new ArrayList<>(); for (CellRangeAddress range : ranges) { if (!areaRange.isInRange(range.getFirstRow(), range.getFirstColumn()) || !areaRange.isInRange(range.getLastRow(), range.getLastColumn())) { newRanges.add(range); } } conditionalFormatting.setFormattingRanges(newRanges.toArray(new CellRangeAddress[] {})); } </DeepExtract>
jxls
positive
public void insertDownloadTaskTable(DownloadBean downloadBean) { DownloadTaskTable downloadTaskTable = queryDownloadTask(downloadBean.getTaskId()); if (downloadTaskTable != null) { mDownloadTaskTableDao.delete(downloadTaskTable); } DownloadTaskTable mDownloadTaskTable = new DownloadTaskTable(); mDownloadTaskTable.setTaskId(downloadBean.getTaskId()); mDownloadTaskTable.setDownloadUrl(downloadBean.getDownloadUrl()); mDownloadTaskTable.setSavePath(downloadBean.getSavePath()); mDownloadTaskTable.setFileName(downloadBean.getFileName()); mDownloadTaskTable.setLoadedLength(downloadBean.getLoadedLength()); mDownloadTaskTable.setTotalSize(downloadBean.getTotalSize()); mDownloadTaskTableDao.insertOrReplaceInTx(mDownloadTaskTable); }
<DeepExtract> DownloadTaskTable downloadTaskTable = queryDownloadTask(downloadBean.getTaskId()); if (downloadTaskTable != null) { mDownloadTaskTableDao.delete(downloadTaskTable); } </DeepExtract>
AppStore
positive
public void testConvertDrawScalePNG() throws Exception { InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "input_256png-result.jpg"); try { File f = new File(dir, "input_256.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "input_256.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "super1_png-result.jpg"); try { File f = new File(dir, "super1_png.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "super1_png.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "super2_png-result.jpg"); try { File f = new File(dir, "super2_png.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "super2_png.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "input_bwpng-result.jpg"); try { File f = new File(dir, "input_bw.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "input_bw.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "input_monopng-result.jpg"); try { File f = new File(dir, "input_mono.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "input_mono.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "input_truecolorpng-result.jpg"); try { File f = new File(dir, "input_truecolor.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "input_truecolor.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); }
<DeepExtract> InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "input_256png-result.jpg"); try { File f = new File(dir, "input_256.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "input_256.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); </DeepExtract> <DeepExtract> InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "super1_png-result.jpg"); try { File f = new File(dir, "super1_png.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "super1_png.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); </DeepExtract> <DeepExtract> InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "super2_png-result.jpg"); try { File f = new File(dir, "super2_png.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "super2_png.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); </DeepExtract> <DeepExtract> InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "input_bwpng-result.jpg"); try { File f = new File(dir, "input_bw.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "input_bw.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); </DeepExtract> <DeepExtract> InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "input_monopng-result.jpg"); try { File f = new File(dir, "input_mono.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "input_mono.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); </DeepExtract> <DeepExtract> InputStream in = null; OutputStream output = null; ImageRender wr = null; File dir = new File(path, "png"); File resultFile = new File(resultDir, "input_truecolorpng-result.jpg"); try { File f = new File(dir, "input_truecolor.png"); in = new FileInputStream(f); ReadRender rr = new ReadRender(in); DrawTextParameter dp = new DrawTextParameter(); dp.addTextInfo(new FixDrawTextItem("1234554321")); DrawTextRender dtr = new DrawTextRender(rr, dp); ScaleParameter param = new ScaleParameter(1024, 1024, ScaleParameter.Algorithm.AUTO); ImageRender sr = new ScaleRender(dtr, param); output = new FileOutputStream(resultFile); ImageFormat outputFormat = "input_truecolor.png".endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG; wr = new WriteRender(sr, output, outputFormat); wr.render(); } finally { if (wr != null) { wr.dispose(); } IOUtils.closeQuietly(output); IOUtils.closeQuietly(in); } doCheckResult(resultFile); </DeepExtract>
simpleimage
positive
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= 21) { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); getWindow().setStatusBarColor(Color.TRANSPARENT); } setContentView(R.layout.activity_news_inform_list); ly_back = (LinearLayout) findViewById(R.id.ly_back); ly_back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); initGridView(); initBannerData(); initCollapsingToolBarlayout(); initRecyclerView(); }
<DeepExtract> if (Build.VERSION.SDK_INT >= 21) { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); getWindow().setStatusBarColor(Color.TRANSPARENT); } </DeepExtract> <DeepExtract> ly_back = (LinearLayout) findViewById(R.id.ly_back); ly_back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); initGridView(); initBannerData(); initCollapsingToolBarlayout(); initRecyclerView(); </DeepExtract>
Sukeda
positive
public Response post(String url, String json, okhttp3.MediaType mediaType) { RequestBody body = RequestBody.create(mediaType, json); try { Request.Builder requestBuilder = new Request.Builder().url(url); Request request = builder -> builder.post(body).apply(requestBuilder).build(); return retrofit.callFactory().newCall(request).execute(); } catch (IOException e) { throw new NuxeoClientException("Error during call on url=" + url, e); } }
<DeepExtract> try { Request.Builder requestBuilder = new Request.Builder().url(url); Request request = builder -> builder.post(body).apply(requestBuilder).build(); return retrofit.callFactory().newCall(request).execute(); } catch (IOException e) { throw new NuxeoClientException("Error during call on url=" + url, e); } </DeepExtract>
nuxeo-java-client
positive
@Override public void setBlockBoundsForItemRender() { int j = 0 & 7; float f = (float) (2 * (1 + j)) / 16.0F; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); }
<DeepExtract> int j = 0 & 7; float f = (float) (2 * (1 + j)) / 16.0F; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); </DeepExtract>
Atum
positive
private Object writeReplace() { if (unwrapped == null) { switch(dataType) { case KEY: try { unwrapped = converter.apply(record.keySchema(), record.key()); } catch (Exception e) { throw new DataException(format("Could not convert key `%s` into a BsonDocument.", record.key()), e); } break; case VALUE: try { unwrapped = converter.apply(record.valueSchema(), record.value()); } catch (Exception e) { throw new DataException(format("Could not convert value `%s` into a BsonDocument.", record.value()), e); } break; default: throw new DataException(format("Unknown data type %s.", dataType)); } } return unwrapped; }
<DeepExtract> if (unwrapped == null) { switch(dataType) { case KEY: try { unwrapped = converter.apply(record.keySchema(), record.key()); } catch (Exception e) { throw new DataException(format("Could not convert key `%s` into a BsonDocument.", record.key()), e); } break; case VALUE: try { unwrapped = converter.apply(record.valueSchema(), record.value()); } catch (Exception e) { throw new DataException(format("Could not convert value `%s` into a BsonDocument.", record.value()), e); } break; default: throw new DataException(format("Unknown data type %s.", dataType)); } } return unwrapped; </DeepExtract>
mongo-kafka
positive
public void glTranslatex(int x, int y, int z) { Matrix.translateM(mMatrix, mTop, fixedToFloat(x), fixedToFloat(y), fixedToFloat(z)); }
<DeepExtract> Matrix.translateM(mMatrix, mTop, fixedToFloat(x), fixedToFloat(y), fixedToFloat(z)); </DeepExtract>
AndroidOpenGLTutorial
positive