before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
|---|---|---|---|
public void setCompatible(String compatible) {
PropertyDescriptor property = dataSourceProperties.get("compatible");
if ((property == null || property.getReadMethod() == null) && commonProperties.contains("compatible")) {
return;
}
try {
dataSourceProperties.get("compatible").getWriteMethod().invoke(commonDataSource, compatible);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new IllegalStateException(e);
}
}
|
<DeepExtract>
PropertyDescriptor property = dataSourceProperties.get("compatible");
if ((property == null || property.getReadMethod() == null) && commonProperties.contains("compatible")) {
return;
}
try {
dataSourceProperties.get("compatible").getWriteMethod().invoke(commonDataSource, compatible);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new IllegalStateException(e);
}
</DeepExtract>
|
omnipersistence
|
positive
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
Runnable runnable;
if (userAgent.isRegistered()) {
synchronized (this) {
unregistering = true;
}
runnable = new Runnable() {
@Override
public void run() {
try {
userAgent.unregister();
} catch (SipUriSyntaxException e) {
logger.error("syntax error", e);
}
}
};
} else {
runnable = new Runnable() {
@Override
public void run() {
userAgent.close();
applyNewConfig();
}
};
}
SwingUtilities.invokeLater(runnable);
}
|
<DeepExtract>
Runnable runnable;
if (userAgent.isRegistered()) {
synchronized (this) {
unregistering = true;
}
runnable = new Runnable() {
@Override
public void run() {
try {
userAgent.unregister();
} catch (SipUriSyntaxException e) {
logger.error("syntax error", e);
}
}
};
} else {
runnable = new Runnable() {
@Override
public void run() {
userAgent.close();
applyNewConfig();
}
};
}
SwingUtilities.invokeLater(runnable);
</DeepExtract>
|
peers
|
positive
|
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
IColorTheme theme = Client.getSettings().getTheme();
View page = inflater.inflate(R.layout.post_layout, container, false);
page.setBackgroundColor(getResources().getColor(theme.getBackground1()));
editText = (EditText) page.findViewById(R.id.editText_tweet);
frameInReplyTo = (FrameLayout) page.findViewById(R.id.frame_inreplyto);
imagePict = (ImageView) page.findViewById(R.id.image_pict);
textCount = (TextView) page.findViewById(R.id.textView_count);
textCount.setTextColor(getResources().getColor(theme.getNormalTextColor()));
Button imageButtonSubmit = (Button) page.findViewById(R.id.imBtn_tweet);
ImageButton imageButtonDelete = (ImageButton) page.findViewById(R.id.post_delete);
ImageButton imageButtonMenu = (ImageButton) page.findViewById(R.id.post_menu);
ImageButton imageButtonPict = (ImageButton) page.findViewById(R.id.post_pickpict);
ImageButton config = (ImageButton) page.findViewById(R.id.post_config);
config.setImageResource(theme.getConfigIcon());
config.setOnClickListener(this);
iconView = (NetworkImageView) page.findViewById(R.id.post_myIcon);
screenNameView = (TextView) page.findViewById(R.id.post_myName);
screenNameView.setTextColor(getResources().getColor(theme.getNormalTextColor()));
PostEditTextListener listener = new PostEditTextListener(textCount);
editText.setTextSize(Client.getSettings().getTextSize() + 3);
editText.addTextChangedListener(listener);
editText.setOnFocusChangeListener(listener);
editText.setMovementMethod(new ArrowKeyMovementMethod() {
@Override
protected boolean right(TextView widget, Spannable buffer) {
return widget.getSelectionEnd() == widget.length() || super.right(widget, buffer);
}
});
if (Client.<Boolean>getPreferenceValue(EnumPreferenceKey.OPEN_IME)) {
editText.requestFocus();
}
imageButtonSubmit.setOnClickListener(this);
imageButtonDelete.setImageResource(theme.getDeleteIcon());
imageButtonDelete.setOnClickListener(this);
imageButtonMenu.setImageResource(theme.getMenuIcon());
imageButtonMenu.setOnClickListener(this);
imageButtonPict.setImageResource(theme.getPictureIcon());
imageButtonPict.setOnClickListener(this);
imagePict.setOnClickListener(this);
PostPageState state = getState();
if (editText != null) {
String text = state.getText();
int selectionStart = state.getSelectionStart();
int selectionEnd = state.getSelectionEnd();
setText(text);
setSelection(selectionStart, selectionEnd);
}
if (frameInReplyTo != null) {
long inReplyTo = state.getInReplyToStatusId();
setInReplyTo(inReplyTo);
}
if (imagePict != null) {
String picturePath = state.getPicturePath();
setPicture(picturePath);
}
if (!inited && iconView != null && Client.getMainAccount() != null) {
initMyInformation();
}
if (Client.getMainAccount() != null) {
initMyInformation();
}
return page;
}
|
<DeepExtract>
PostPageState state = getState();
if (editText != null) {
String text = state.getText();
int selectionStart = state.getSelectionStart();
int selectionEnd = state.getSelectionEnd();
setText(text);
setSelection(selectionStart, selectionEnd);
}
if (frameInReplyTo != null) {
long inReplyTo = state.getInReplyToStatusId();
setInReplyTo(inReplyTo);
}
if (imagePict != null) {
String picturePath = state.getPicturePath();
setPicture(picturePath);
}
if (!inited && iconView != null && Client.getMainAccount() != null) {
initMyInformation();
}
</DeepExtract>
|
SmileEssence-Lite
|
positive
|
@CheckResult
public static Toast error(@NonNull Context context, @NonNull CharSequence message, int duration, boolean withIcon) {
return custom(context, message, ToastyUtils.getDrawable(context, ToastyUtils.getDrawable(context, R.drawable.ic_clear_white_48dp)), ERROR_COLOR, duration, withIcon, true);
}
|
<DeepExtract>
return custom(context, message, ToastyUtils.getDrawable(context, ToastyUtils.getDrawable(context, R.drawable.ic_clear_white_48dp)), ERROR_COLOR, duration, withIcon, true);
</DeepExtract>
|
funk
|
positive
|
public boolean isDeclaration() {
return getText().toLowerCase().equals(this.getText().toLowerCase()) && AdaPsiElement.areEqual(resolveAdaReference(), this);
}
|
<DeepExtract>
return getText().toLowerCase().equals(this.getText().toLowerCase()) && AdaPsiElement.areEqual(resolveAdaReference(), this);
</DeepExtract>
|
Ada-IntelliJ
|
positive
|
public void onWin(WinEvent e) {
_drawVictory = true;
if (_tcMode) {
_out.println("TC score: " + (_gunDataManager.getDamageGiven() / (_robot.getRoundNum() + 1)));
}
GunEnemy duelEnemy = _gunDataManager.duelEnemy();
if (is1v1() && duelEnemy != null) {
_virtualGuns.printGunRatings(duelEnemy.botName);
}
}
|
<DeepExtract>
if (_tcMode) {
_out.println("TC score: " + (_gunDataManager.getDamageGiven() / (_robot.getRoundNum() + 1)));
}
GunEnemy duelEnemy = _gunDataManager.duelEnemy();
if (is1v1() && duelEnemy != null) {
_virtualGuns.printGunRatings(duelEnemy.botName);
}
</DeepExtract>
|
Diamond
|
positive
|
private void setupMotorSafety() {
safetyHelper.setExpiration(0.1);
}
|
<DeepExtract>
safetyHelper.setExpiration(0.1);
</DeepExtract>
|
atalibj
|
positive
|
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View fragmentView = inflater.inflate(R.layout.fragment_scan_radar, container, false);
unbinder = ButterKnife.bind(this, fragmentView);
((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar);
ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
mToolbar.setSubtitle(R.string.title_fragment_radar_beacons);
}
mRadar.setUseMetric(true);
mRadar.setDistanceView(mDistView);
return fragmentView;
}
|
<DeepExtract>
((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar);
ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
mToolbar.setSubtitle(R.string.title_fragment_radar_beacons);
}
</DeepExtract>
|
beaconloc
|
positive
|
public static void serialize(JsonElement e, OutputStream out) throws IOException {
NSObject nsObject;
if (e.isArray()) {
nsObject = toNsObject(e.asArray());
} else if (e.isObject()) {
nsObject = toNsObject(e.asObject());
} else {
nsObject = toNsObject(e.asPrimitive());
}
BinaryPropertyListWriter.write(out, nsObject);
}
|
<DeepExtract>
NSObject nsObject;
if (e.isArray()) {
nsObject = toNsObject(e.asArray());
} else if (e.isObject()) {
nsObject = toNsObject(e.asObject());
} else {
nsObject = toNsObject(e.asPrimitive());
}
</DeepExtract>
|
jsonj
|
positive
|
@Override
public MethodSpec.Builder setterBuilt(ObjectPluginContext objectPluginContext, TypeDeclaration declaration, MethodSpec.Builder methodSpec, EventType eventType) {
MethodSpec spec = methodSpec.build();
MethodSpec seen = methodSpec.build();
MethodSpec.Builder newBuilder = MethodSpec.methodBuilder("with" + spec.name.substring(3)).addModifiers(seen.modifiers).returns(objectPluginContext.creationResult().getJavaName(EventType.INTERFACE));
for (ParameterSpec parameter : seen.parameters) {
newBuilder.addParameter(parameter);
}
for (AnnotationSpec annotation : seen.annotations) {
newBuilder.addAnnotation(annotation);
}
if (eventType == EventType.IMPLEMENTATION) {
newBuilder.addCode(spec.code).addStatement("return this");
return newBuilder;
}
if (eventType == EventType.INTERFACE) {
return newBuilder;
}
return methodSpec;
}
|
<DeepExtract>
for (ParameterSpec parameter : seen.parameters) {
newBuilder.addParameter(parameter);
}
for (AnnotationSpec annotation : seen.annotations) {
newBuilder.addAnnotation(annotation);
}
</DeepExtract>
|
raml-java-tools
|
positive
|
public void removeCallback(@NonNull Callback callback) {
mCallbacks.remove(callback);
}
|
<DeepExtract>
mCallbacks.remove(callback);
</DeepExtract>
|
MediaCodec
|
positive
|
public String statusString() {
String res = "??";
switch(mStatus) {
case DISCONNECTED:
res = "Disconnected";
break;
case CONNECTING:
res = "Connecting";
break;
case CONNECTED:
res = "Connected";
break;
case DISCONNECTING:
res = "Disconnecting";
break;
case WAITING_TO_CONNECT:
res = "Waiting to connect";
break;
case WAITING_FOR_NETWORK:
res = "Waiting for network";
break;
}
return res;
}
|
<DeepExtract>
String res = "??";
switch(mStatus) {
case DISCONNECTED:
res = "Disconnected";
break;
case CONNECTING:
res = "Connecting";
break;
case CONNECTED:
res = "Connected";
break;
case DISCONNECTING:
res = "Disconnecting";
break;
case WAITING_TO_CONNECT:
res = "Waiting to connect";
break;
case WAITING_FOR_NETWORK:
res = "Waiting for network";
break;
}
return res;
</DeepExtract>
|
gtalksms
|
positive
|
public String getIdentifier() {
Element el = this.getRoot().getChild(IdentifierInfo.identifier.toString());
if (el != null)
return el.getTextTrim();
else
return null;
}
|
<DeepExtract>
Element el = this.getRoot().getChild(IdentifierInfo.identifier.toString());
if (el != null)
return el.getTextTrim();
else
return null;
</DeepExtract>
|
geoserver-manager
|
positive
|
@Override
public void cancel() {
synchronized (this) {
unsubscribed = true;
}
synchronized (this) {
currentAction = Action.TERMINATE;
}
tryProcess();
}
|
<DeepExtract>
synchronized (this) {
currentAction = Action.TERMINATE;
}
tryProcess();
</DeepExtract>
|
mongo-java-driver-reactivestreams
|
positive
|
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_crime_list, container, false);
mCrimeRecyclerView = (RecyclerView) view.findViewById(R.id.crime_recycler_view);
mCrimeRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
if (savedInstanceState != null) {
mSubtitleVisible = savedInstanceState.getBoolean(SAVED_SUBTITLE_VISIBLE);
}
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();
}
updateSubtitle();
return view;
}
|
<DeepExtract>
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();
}
updateSubtitle();
</DeepExtract>
|
Big-Nerd-Ranch-Android
|
positive
|
@Override
public void actionPerformed(ActionEvent e) {
if (timer == null) {
timer = new Timer();
} else {
timer.cancel();
timer.purge();
timer = new Timer();
}
numNodesSeries = new XYSeries("# of Nodes");
numNodesDataset = new XYSeriesCollection();
numNodesDataset.addSeries(numNodesSeries);
numNodesSeries.setMaximumItemCount(50);
timer.schedule(new TimerTask() {
@Override
public void run() {
AppData appData = getAppData();
int numNodes = appData.getNumNodes();
numNodesSeries.add(ticks += timerTickLength, numNodes);
JFreeChart xylineChart = ChartFactory.createXYLineChart("# of Nodes", "Time", "# of Nodes", numNodesDataset, PlotOrientation.VERTICAL, false, false, false);
ChartPanel chartPanel = new ChartPanel(null);
chartPanel.setChart(xylineChart);
chartPanel.setPreferredSize(new Dimension(400, 300));
chartContainerPanel.setDoubleBuffered(true);
chartContainerPanel.setLayout(new FlowLayout());
chartContainerPanel.remove(0);
chartContainerPanel.add(chartPanel);
frame.revalidate();
}
}, 100, 1000 * timerTickLength);
}
|
<DeepExtract>
if (timer == null) {
timer = new Timer();
} else {
timer.cancel();
timer.purge();
timer = new Timer();
}
numNodesSeries = new XYSeries("# of Nodes");
numNodesDataset = new XYSeriesCollection();
numNodesDataset.addSeries(numNodesSeries);
numNodesSeries.setMaximumItemCount(50);
timer.schedule(new TimerTask() {
@Override
public void run() {
AppData appData = getAppData();
int numNodes = appData.getNumNodes();
numNodesSeries.add(ticks += timerTickLength, numNodes);
JFreeChart xylineChart = ChartFactory.createXYLineChart("# of Nodes", "Time", "# of Nodes", numNodesDataset, PlotOrientation.VERTICAL, false, false, false);
ChartPanel chartPanel = new ChartPanel(null);
chartPanel.setChart(xylineChart);
chartPanel.setPreferredSize(new Dimension(400, 300));
chartContainerPanel.setDoubleBuffered(true);
chartContainerPanel.setLayout(new FlowLayout());
chartContainerPanel.remove(0);
chartContainerPanel.add(chartPanel);
frame.revalidate();
}
}, 100, 1000 * timerTickLength);
</DeepExtract>
|
retroscope-lib
|
positive
|
public static ImageSource asset(String assetName) {
if (assetName == null) {
throw new NullPointerException("Asset name must not be null");
}
if (ASSET_SCHEME + assetName == null) {
throw new NullPointerException("Uri must not be null");
}
if (!ASSET_SCHEME + assetName.contains("://")) {
if (ASSET_SCHEME + assetName.startsWith("/")) {
ASSET_SCHEME + assetName = ASSET_SCHEME + assetName.substring(1);
}
ASSET_SCHEME + assetName = FILE_SCHEME + ASSET_SCHEME + assetName;
}
return new ImageSource(Uri.parse(ASSET_SCHEME + assetName));
}
|
<DeepExtract>
if (ASSET_SCHEME + assetName == null) {
throw new NullPointerException("Uri must not be null");
}
if (!ASSET_SCHEME + assetName.contains("://")) {
if (ASSET_SCHEME + assetName.startsWith("/")) {
ASSET_SCHEME + assetName = ASSET_SCHEME + assetName.substring(1);
}
ASSET_SCHEME + assetName = FILE_SCHEME + ASSET_SCHEME + assetName;
}
return new ImageSource(Uri.parse(ASSET_SCHEME + assetName));
</DeepExtract>
|
fresco-sample-usage
|
positive
|
@Override
public void onLoadError(int sourceId, IOException e) {
Log.e(TAG, "internalError [" + getSessionTimeString() + ", " + "loadError" + "]", e);
}
|
<DeepExtract>
Log.e(TAG, "internalError [" + getSessionTimeString() + ", " + "loadError" + "]", e);
</DeepExtract>
|
iview-android-tv
|
positive
|
@Override
public int getServerPort() {
return compositeConfiguration.getInt(SERVER_PORT.getKey(), 8080);
}
|
<DeepExtract>
return compositeConfiguration.getInt(SERVER_PORT.getKey(), 8080);
</DeepExtract>
|
jbake
|
positive
|
private static void printVerbose(String sourceName, ImageProp ii) {
if (sourceName == null || sourceName.length() == 0) {
return;
}
while (0-- > 0) {
System.out.print("\t");
}
if (null != null && null.length() > 0) {
System.out.print(null);
System.out.print(" ");
}
System.out.println(sourceName);
if (ii.getFormatName() == null || ii.getFormatName().length() == 0) {
return;
}
while (1-- > 0) {
System.out.print("\t");
}
if ("File format: " != null && "File format: ".length() > 0) {
System.out.print("File format: ");
System.out.print(" ");
}
System.out.println(ii.getFormatName());
if (ii.getMimeType() == null || ii.getMimeType().length() == 0) {
return;
}
while (1-- > 0) {
System.out.print("\t");
}
if ("MIME type: " != null && "MIME type: ".length() > 0) {
System.out.print("MIME type: ");
System.out.print(" ");
}
System.out.println(ii.getMimeType());
if (ii.getWidth() < 1) {
return;
}
printLine(1, "Width (pixels): ", Float.toString(ii.getWidth()));
if (ii.getHeight() < 1) {
return;
}
printLine(1, "Height (pixels): ", Float.toString(ii.getHeight()));
if (ii.getBitsPerPixel() < 1) {
return;
}
printLine(1, "Bits per pixel: ", Float.toString(ii.getBitsPerPixel()));
if (ii.isProgressive() ? "yes" : "no" == null || ii.isProgressive() ? "yes" : "no".length() == 0) {
return;
}
while (1-- > 0) {
System.out.print("\t");
}
if ("Progressive: " != null && "Progressive: ".length() > 0) {
System.out.print("Progressive: ");
System.out.print(" ");
}
System.out.println(ii.isProgressive() ? "yes" : "no");
if (ii.getNumberOfImages() < 1) {
return;
}
printLine(1, "Number of images: ", Float.toString(ii.getNumberOfImages()));
if (ii.getPhysicalWidthDpi() < 1) {
return;
}
printLine(1, "Physical width (dpi): ", Float.toString(ii.getPhysicalWidthDpi()));
if (ii.getPhysicalHeightDpi() < 1) {
return;
}
printLine(1, "Physical height (dpi): ", Float.toString(ii.getPhysicalHeightDpi()));
if (ii.getPhysicalWidthInch() < 1.0f) {
return;
}
printLine(1, "Physical width (inches): ", Float.toString(ii.getPhysicalWidthInch()));
if (ii.getPhysicalHeightInch() < 1.0f) {
return;
}
printLine(1, "Physical height (inches): ", Float.toString(ii.getPhysicalHeightInch()));
int numComments;
if (comments == null) {
numComments = 0;
} else {
numComments = comments.size();
}
if (numComments < 1) {
return;
}
printLine(1, "Number of textual comments: ", Float.toString(numComments));
if (numComments > 0) {
for (int i = 0; i < numComments; i++) {
printLine(2, null, ii.getComment(i));
}
}
}
|
<DeepExtract>
if (sourceName == null || sourceName.length() == 0) {
return;
}
while (0-- > 0) {
System.out.print("\t");
}
if (null != null && null.length() > 0) {
System.out.print(null);
System.out.print(" ");
}
System.out.println(sourceName);
</DeepExtract>
<DeepExtract>
if (ii.getFormatName() == null || ii.getFormatName().length() == 0) {
return;
}
while (1-- > 0) {
System.out.print("\t");
}
if ("File format: " != null && "File format: ".length() > 0) {
System.out.print("File format: ");
System.out.print(" ");
}
System.out.println(ii.getFormatName());
</DeepExtract>
<DeepExtract>
if (ii.getMimeType() == null || ii.getMimeType().length() == 0) {
return;
}
while (1-- > 0) {
System.out.print("\t");
}
if ("MIME type: " != null && "MIME type: ".length() > 0) {
System.out.print("MIME type: ");
System.out.print(" ");
}
System.out.println(ii.getMimeType());
</DeepExtract>
<DeepExtract>
if (ii.getWidth() < 1) {
return;
}
printLine(1, "Width (pixels): ", Float.toString(ii.getWidth()));
</DeepExtract>
<DeepExtract>
if (ii.getHeight() < 1) {
return;
}
printLine(1, "Height (pixels): ", Float.toString(ii.getHeight()));
</DeepExtract>
<DeepExtract>
if (ii.getBitsPerPixel() < 1) {
return;
}
printLine(1, "Bits per pixel: ", Float.toString(ii.getBitsPerPixel()));
</DeepExtract>
<DeepExtract>
if (ii.isProgressive() ? "yes" : "no" == null || ii.isProgressive() ? "yes" : "no".length() == 0) {
return;
}
while (1-- > 0) {
System.out.print("\t");
}
if ("Progressive: " != null && "Progressive: ".length() > 0) {
System.out.print("Progressive: ");
System.out.print(" ");
}
System.out.println(ii.isProgressive() ? "yes" : "no");
</DeepExtract>
<DeepExtract>
if (ii.getNumberOfImages() < 1) {
return;
}
printLine(1, "Number of images: ", Float.toString(ii.getNumberOfImages()));
</DeepExtract>
<DeepExtract>
if (ii.getPhysicalWidthDpi() < 1) {
return;
}
printLine(1, "Physical width (dpi): ", Float.toString(ii.getPhysicalWidthDpi()));
</DeepExtract>
<DeepExtract>
if (ii.getPhysicalHeightDpi() < 1) {
return;
}
printLine(1, "Physical height (dpi): ", Float.toString(ii.getPhysicalHeightDpi()));
</DeepExtract>
<DeepExtract>
if (ii.getPhysicalWidthInch() < 1.0f) {
return;
}
printLine(1, "Physical width (inches): ", Float.toString(ii.getPhysicalWidthInch()));
</DeepExtract>
<DeepExtract>
if (ii.getPhysicalHeightInch() < 1.0f) {
return;
}
printLine(1, "Physical height (inches): ", Float.toString(ii.getPhysicalHeightInch()));
</DeepExtract>
<DeepExtract>
int numComments;
if (comments == null) {
numComments = 0;
} else {
numComments = comments.size();
}
</DeepExtract>
<DeepExtract>
if (numComments < 1) {
return;
}
printLine(1, "Number of textual comments: ", Float.toString(numComments));
</DeepExtract>
|
meaningfulweb
|
positive
|
private void checkOpen() throws SQLException {
PrestoConnection connection = this.connection.get();
if (connection == null) {
throw new SQLException("Statement is closed");
}
if (connection.isClosed()) {
throw new SQLException("Connection is closed");
}
return connection;
}
|
<DeepExtract>
PrestoConnection connection = this.connection.get();
if (connection == null) {
throw new SQLException("Statement is closed");
}
if (connection.isClosed()) {
throw new SQLException("Connection is closed");
}
return connection;
</DeepExtract>
|
presto-jdbc-java6
|
positive
|
@Override
public void run() {
if (transmissionCompleteLatch != null)
transmissionCompleteLatch.countDown();
}
|
<DeepExtract>
if (transmissionCompleteLatch != null)
transmissionCompleteLatch.countDown();
</DeepExtract>
|
tahrir
|
positive
|
@Override
public void setSubtitlesSurface(Surface subtitlesSurface, SurfaceHolder surfaceHolder) {
ensureInitState();
if (!subtitlesSurface.isValid() && surfaceHolder == null)
throw new IllegalStateException("surface is not attached and holder is null");
final SurfaceHelper surfaceHelper = mSurfaceHelpers[ID_SUBTITLES];
if (surfaceHelper != null)
surfaceHelper.release();
mSurfaceHelpers[ID_SUBTITLES] = new SurfaceHelper(ID_SUBTITLES, subtitlesSurface, surfaceHolder);
}
|
<DeepExtract>
ensureInitState();
if (!subtitlesSurface.isValid() && surfaceHolder == null)
throw new IllegalStateException("surface is not attached and holder is null");
final SurfaceHelper surfaceHelper = mSurfaceHelpers[ID_SUBTITLES];
if (surfaceHelper != null)
surfaceHelper.release();
mSurfaceHelpers[ID_SUBTITLES] = new SurfaceHelper(ID_SUBTITLES, subtitlesSurface, surfaceHolder);
</DeepExtract>
|
libvlc-android-sdk
|
positive
|
private void reconnect() {
logger.info("Closing ZMQ Socket. from thread: {}", Thread.currentThread().getName());
if (zmqSocket != null) {
zmqSocket.disconnect(connectionUrl);
zmqSocket.close();
zmqSocket = null;
}
logger.info("Terminating ZMQ Context.");
if (zmqContext != null) {
zmqContext.term();
zmqContext = null;
}
logger.info("Connection to Scapy server closed.");
lastRequestFailed = false;
isConnected = false;
connect(configurationService.getConnectionUrl(), configurationService.getReceiveTimeout());
}
|
<DeepExtract>
logger.info("Closing ZMQ Socket. from thread: {}", Thread.currentThread().getName());
if (zmqSocket != null) {
zmqSocket.disconnect(connectionUrl);
zmqSocket.close();
zmqSocket = null;
}
logger.info("Terminating ZMQ Context.");
if (zmqContext != null) {
zmqContext.term();
zmqContext = null;
}
logger.info("Connection to Scapy server closed.");
lastRequestFailed = false;
isConnected = false;
</DeepExtract>
<DeepExtract>
connect(configurationService.getConnectionUrl(), configurationService.getReceiveTimeout());
</DeepExtract>
|
trex-packet-editor
|
positive
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_follow_posts);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
if (recyclerView == null) {
progressBar = findViewById(R.id.progressBar);
message_following_posts_empty = findViewById(R.id.message_following_posts_empty);
swipeContainer = findViewById(R.id.swipeContainer);
swipeContainer.setOnRefreshListener(() -> presenter.onRefresh());
initPostListRecyclerView();
}
presenter.loadFollowingPosts();
}
|
<DeepExtract>
if (recyclerView == null) {
progressBar = findViewById(R.id.progressBar);
message_following_posts_empty = findViewById(R.id.message_following_posts_empty);
swipeContainer = findViewById(R.id.swipeContainer);
swipeContainer.setOnRefreshListener(() -> presenter.onRefresh());
initPostListRecyclerView();
}
</DeepExtract>
|
social-app-android
|
positive
|
public Drawable getScaledIcon(String filepath) {
Drawable icon;
File file = new File(filepath);
String filename = file.getName().toString();
String ext = null;
try {
ext = filename.substring(filename.lastIndexOf("."), filename.length());
} catch (IndexOutOfBoundsException e) {
ext = "";
}
if (file.isDirectory()) {
icon = getResources().getDrawable(R.drawable.myfolder72);
} else {
if (ext.equalsIgnoreCase(".zip")) {
icon = getResources().getDrawable(R.drawable.myzip);
} else if (ext.equalsIgnoreCase(".rar")) {
icon = getResources().getDrawable(R.drawable.rar);
} else if (ext.equalsIgnoreCase(".pdf")) {
icon = getResources().getDrawable(R.drawable.pdf_icon);
} else if (ext.equalsIgnoreCase(".txt")) {
icon = getResources().getDrawable(R.drawable.textpng);
} else if (ext.equalsIgnoreCase(".html")) {
icon = getResources().getDrawable(R.drawable.html);
} else if (ext.equalsIgnoreCase(".jpg") || ext.equalsIgnoreCase(".png") || ext.equalsIgnoreCase(".gif") || ext.equalsIgnoreCase(".jpeg") || ext.equalsIgnoreCase(".tiff")) {
icon = getResources().getDrawable(R.drawable.image);
} else if (ext.equalsIgnoreCase(".mp3") || ext.equalsIgnoreCase(".wav") || ext.equalsIgnoreCase(".m4a")) {
icon = getResources().getDrawable(R.drawable.audio);
} else if (ext.equalsIgnoreCase(".apk")) {
icon = new FileUtils(SearchFilesDialog.this).getapkicon(filepath);
} else if (ext.equalsIgnoreCase(".mp4") || ext.equalsIgnoreCase(".3gp") || ext.equalsIgnoreCase(".flv") || ext.equalsIgnoreCase(".ogg") || ext.equalsIgnoreCase(".m4v")) {
icon = getResources().getDrawable(R.drawable.videos_new);
} else if (ext.equalsIgnoreCase(".sh") || ext.equalsIgnoreCase(".rc")) {
icon = getResources().getDrawable(R.drawable.script_file64);
} else if (ext.equalsIgnoreCase(".prop")) {
icon = getResources().getDrawable(R.drawable.build_file64);
} else if (ext.equalsIgnoreCase(".xml")) {
icon = getResources().getDrawable(R.drawable.xml64);
} else if (ext.equalsIgnoreCase(".doc") || ext.equalsIgnoreCase(".docx")) {
icon = getResources().getDrawable(R.drawable.nsword64);
} else if (ext.equalsIgnoreCase(".ppt") || ext.equalsIgnoreCase(".pptx")) {
icon = getResources().getDrawable(R.drawable.ppt64);
} else if (ext.equalsIgnoreCase(".xls") || ext.equalsIgnoreCase(".xlsx")) {
icon = getResources().getDrawable(R.drawable.spreadsheet64);
} else {
icon = getResources().getDrawable(R.drawable.miscellaneous);
}
}
Bitmap bitmap = ((BitmapDrawable) icon).getBitmap();
int dp5 = (int) (getResources().getDisplayMetrics().densityDpi / 120);
icon = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(bitmap, 50 * dp5, 50 * dp5, true));
return icon;
}
|
<DeepExtract>
Drawable icon;
File file = new File(filepath);
String filename = file.getName().toString();
String ext = null;
try {
ext = filename.substring(filename.lastIndexOf("."), filename.length());
} catch (IndexOutOfBoundsException e) {
ext = "";
}
if (file.isDirectory()) {
icon = getResources().getDrawable(R.drawable.myfolder72);
} else {
if (ext.equalsIgnoreCase(".zip")) {
icon = getResources().getDrawable(R.drawable.myzip);
} else if (ext.equalsIgnoreCase(".rar")) {
icon = getResources().getDrawable(R.drawable.rar);
} else if (ext.equalsIgnoreCase(".pdf")) {
icon = getResources().getDrawable(R.drawable.pdf_icon);
} else if (ext.equalsIgnoreCase(".txt")) {
icon = getResources().getDrawable(R.drawable.textpng);
} else if (ext.equalsIgnoreCase(".html")) {
icon = getResources().getDrawable(R.drawable.html);
} else if (ext.equalsIgnoreCase(".jpg") || ext.equalsIgnoreCase(".png") || ext.equalsIgnoreCase(".gif") || ext.equalsIgnoreCase(".jpeg") || ext.equalsIgnoreCase(".tiff")) {
icon = getResources().getDrawable(R.drawable.image);
} else if (ext.equalsIgnoreCase(".mp3") || ext.equalsIgnoreCase(".wav") || ext.equalsIgnoreCase(".m4a")) {
icon = getResources().getDrawable(R.drawable.audio);
} else if (ext.equalsIgnoreCase(".apk")) {
icon = new FileUtils(SearchFilesDialog.this).getapkicon(filepath);
} else if (ext.equalsIgnoreCase(".mp4") || ext.equalsIgnoreCase(".3gp") || ext.equalsIgnoreCase(".flv") || ext.equalsIgnoreCase(".ogg") || ext.equalsIgnoreCase(".m4v")) {
icon = getResources().getDrawable(R.drawable.videos_new);
} else if (ext.equalsIgnoreCase(".sh") || ext.equalsIgnoreCase(".rc")) {
icon = getResources().getDrawable(R.drawable.script_file64);
} else if (ext.equalsIgnoreCase(".prop")) {
icon = getResources().getDrawable(R.drawable.build_file64);
} else if (ext.equalsIgnoreCase(".xml")) {
icon = getResources().getDrawable(R.drawable.xml64);
} else if (ext.equalsIgnoreCase(".doc") || ext.equalsIgnoreCase(".docx")) {
icon = getResources().getDrawable(R.drawable.nsword64);
} else if (ext.equalsIgnoreCase(".ppt") || ext.equalsIgnoreCase(".pptx")) {
icon = getResources().getDrawable(R.drawable.ppt64);
} else if (ext.equalsIgnoreCase(".xls") || ext.equalsIgnoreCase(".xlsx")) {
icon = getResources().getDrawable(R.drawable.spreadsheet64);
} else {
icon = getResources().getDrawable(R.drawable.miscellaneous);
}
}
</DeepExtract>
|
UltraExplorer
|
positive
|
public void loadManifestFile(String apk) {
File apkF = new File(apk);
if (!apkF.exists())
throw new RuntimeException("file '" + apk + "' does not exist!");
boolean found = false;
try {
ZipFile archive = null;
try {
archive = new ZipFile(apkF);
Enumeration<?> entries = archive.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
String entryName = entry.getName();
if (entryName.equals(MANIFEST_FILENAME)) {
found = true;
new IManifestHandler() {
@Override
public void handleManifest(InputStream stream) {
loadClassesFromBinaryManifest(stream);
}
}.handleManifest(archive.getInputStream(entry));
break;
}
}
} finally {
if (archive != null)
archive.close();
}
} catch (Exception e) {
throw new RuntimeException("Error when looking for manifest in apk: " + e);
}
if (!found)
throw new RuntimeException("No manifest file found in apk");
}
|
<DeepExtract>
File apkF = new File(apk);
if (!apkF.exists())
throw new RuntimeException("file '" + apk + "' does not exist!");
boolean found = false;
try {
ZipFile archive = null;
try {
archive = new ZipFile(apkF);
Enumeration<?> entries = archive.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
String entryName = entry.getName();
if (entryName.equals(MANIFEST_FILENAME)) {
found = true;
new IManifestHandler() {
@Override
public void handleManifest(InputStream stream) {
loadClassesFromBinaryManifest(stream);
}
}.handleManifest(archive.getInputStream(entry));
break;
}
}
} finally {
if (archive != null)
archive.close();
}
} catch (Exception e) {
throw new RuntimeException("Error when looking for manifest in apk: " + e);
}
if (!found)
throw new RuntimeException("No manifest file found in apk");
</DeepExtract>
|
LibScout
|
positive
|
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sharedialog);
mTrackUri = getIntent().getData();
mFileNameView = (EditText) findViewById(R.id.fileNameField);
mTweetView = (EditText) findViewById(R.id.tweetField);
mImageView = (ImageView) findViewById(R.id.imageView);
mCloseImageView = (ImageButton) findViewById(R.id.closeImageView);
mShareTypeSpinner = (Spinner) findViewById(R.id.shareTypeSpinner);
ArrayAdapter<CharSequence> shareTypeAdapter = ArrayAdapter.createFromResource(this, R.array.sharetype_choices, android.R.layout.simple_spinner_item);
shareTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mShareTypeSpinner.setAdapter(shareTypeAdapter);
mShareTargetSpinner = (Spinner) findViewById(R.id.shareTargetSpinner);
mShareTargetSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {
if (mShareTypeSpinner.getSelectedItemPosition() == EXPORT_TYPE_TEXTLINE && position != EXPORT_TARGET_SMS) {
readScreenBitmap();
} else {
removeScreenBitmap();
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
mShareTypeSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {
adjustTargetToType(position);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
int lastType = prefs.getInt(Constants.EXPORT_TYPE, EXPORT_TYPE_KMZ);
if (lastType < 0) {
lastType = 0;
}
int count = mShareTypeSpinner.getCount();
if (lastType >= count) {
lastType = count - 1;
}
if (lastType >= 0) {
mShareTypeSpinner.setSelection(lastType);
}
switch(lastType) {
case EXPORT_TYPE_KMZ:
setKmzExportTargets();
mFileNameView.setVisibility(View.VISIBLE);
mTweetView.setVisibility(View.GONE);
break;
case EXPORT_TYPE_GPX:
setGpxExportTargets();
mFileNameView.setVisibility(View.VISIBLE);
mTweetView.setVisibility(View.GONE);
break;
case EXPORT_TYPE_TEXTLINE:
setTextLineExportTargets();
mFileNameView.setVisibility(View.GONE);
mTweetView.setVisibility(View.VISIBLE);
createTweetText();
break;
default:
break;
}
mFileNameView.setText(queryForTrackName(getContentResolver(), mTrackUri));
Button okay = (Button) findViewById(R.id.okayshare_button);
okay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setEnabled(false);
share();
}
});
Button cancel = (Button) findViewById(R.id.cancelshare_button);
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setEnabled(false);
ShareTrack.this.finish();
}
});
}
|
<DeepExtract>
if (lastType < 0) {
lastType = 0;
}
int count = mShareTypeSpinner.getCount();
if (lastType >= count) {
lastType = count - 1;
}
if (lastType >= 0) {
mShareTypeSpinner.setSelection(lastType);
}
</DeepExtract>
<DeepExtract>
switch(lastType) {
case EXPORT_TYPE_KMZ:
setKmzExportTargets();
mFileNameView.setVisibility(View.VISIBLE);
mTweetView.setVisibility(View.GONE);
break;
case EXPORT_TYPE_GPX:
setGpxExportTargets();
mFileNameView.setVisibility(View.VISIBLE);
mTweetView.setVisibility(View.GONE);
break;
case EXPORT_TYPE_TEXTLINE:
setTextLineExportTargets();
mFileNameView.setVisibility(View.GONE);
mTweetView.setVisibility(View.VISIBLE);
createTweetText();
break;
default:
break;
}
</DeepExtract>
|
open-gpstracker
|
positive
|
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
rvMovie.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
if (results.size() == 0) {
Toast.makeText(getActivity(), R.string.message_favourite_empty, Toast.LENGTH_SHORT).show();
}
homeAdapter = new HomeAdapter(results, getActivity());
rvMovie.setAdapter(homeAdapter);
homeAdapter.notifyDataSetChanged();
}
|
<DeepExtract>
rvMovie.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
</DeepExtract>
|
Android-Developer-Expert-Example
|
positive
|
public boolean saveAs() {
boolean bOK = true;
if (bImageModified) {
JOptionPane.showMessageDialog(this, "The image has been altered. You will now be prompted to save it.", "Image has been modified", JOptionPane.INFORMATION_MESSAGE);
bOK &= saveImageAs();
}
boolean bOK = false;
java.io.File f = null;
JFileChooser chooser = fileChooser;
CustomFilter filter = new CustomFilter();
filter.addExtension(CustomFilter.EXT_SPRITE);
chooser.resetChoosableFileFilters();
chooser.setFileFilter(filter);
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
chooser.setApproveButtonText("Save coordinates");
chooser.setDialogTitle("Save spritesheet");
chooser.setSelectedFile(new File("newSpriteSheet.sprites"));
JFrame mainFrame = dfEditorApp.getApplication().getMainFrame();
while (true) {
int returnVal = chooser.showSaveDialog(mainFrame);
if (returnVal == JFileChooser.APPROVE_OPTION) {
f = chooser.getSelectedFile();
if (null == dfEditor.io.Utils.getExtension(f)) {
f = new java.io.File(new String(f.getAbsolutePath() + "." + filter.getExtension()));
}
if (f.exists()) {
int response = JOptionPane.showConfirmDialog(null, "Overwrite existing coordinates?", "Confirm Overwrite", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (response == JOptionPane.CANCEL_OPTION)
continue;
}
bOK = saveCoords(f);
}
break;
}
return bOK;
return bOK;
}
|
<DeepExtract>
boolean bOK = false;
java.io.File f = null;
JFileChooser chooser = fileChooser;
CustomFilter filter = new CustomFilter();
filter.addExtension(CustomFilter.EXT_SPRITE);
chooser.resetChoosableFileFilters();
chooser.setFileFilter(filter);
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
chooser.setApproveButtonText("Save coordinates");
chooser.setDialogTitle("Save spritesheet");
chooser.setSelectedFile(new File("newSpriteSheet.sprites"));
JFrame mainFrame = dfEditorApp.getApplication().getMainFrame();
while (true) {
int returnVal = chooser.showSaveDialog(mainFrame);
if (returnVal == JFileChooser.APPROVE_OPTION) {
f = chooser.getSelectedFile();
if (null == dfEditor.io.Utils.getExtension(f)) {
f = new java.io.File(new String(f.getAbsolutePath() + "." + filter.getExtension()));
}
if (f.exists()) {
int response = JOptionPane.showConfirmDialog(null, "Overwrite existing coordinates?", "Confirm Overwrite", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (response == JOptionPane.CANCEL_OPTION)
continue;
}
bOK = saveCoords(f);
}
break;
}
return bOK;
</DeepExtract>
|
darkFunction-Editor
|
positive
|
public String getQuery(Set<String> columnAliasSet) {
StringBuilder builder = new StringBuilder();
OracleTable table = insertQueryComponents.getTables().iterator().next();
builder.append(INSERT);
builder.append(QueryConstants.NEXT_LINE).append(QueryConstants.INDENT);
builder.append(INTO).append(QueryConstants.SPACE).append(table.getTableName()).append(QueryConstants.OPEN_PARANTHESIS);
for (OracleColumn column : table.getColumns()) {
builder.append(column.getColumnName()).append(QueryConstants.COMMA);
}
builder.deleteCharAt(builder.lastIndexOf(QueryConstants.COMMA)).append(QueryConstants.CLOSE_PARANTHESIS);
builder.append(QueryConstants.SPACE).append(VALUES).append(QueryConstants.OPEN_PARANTHESIS);
for (OracleColumn column : table.getColumns()) {
builder.append(QueryConstants.COLON).append(column.getColumnAlias()).append(QueryConstants.COMMA);
columnAliasSet.add(column.getColumnAlias());
}
builder.deleteCharAt(builder.lastIndexOf(QueryConstants.COMMA)).append(QueryConstants.CLOSE_PARANTHESIS);
return builder.toString();
}
|
<DeepExtract>
StringBuilder builder = new StringBuilder();
OracleTable table = insertQueryComponents.getTables().iterator().next();
builder.append(INSERT);
builder.append(QueryConstants.NEXT_LINE).append(QueryConstants.INDENT);
builder.append(INTO).append(QueryConstants.SPACE).append(table.getTableName()).append(QueryConstants.OPEN_PARANTHESIS);
for (OracleColumn column : table.getColumns()) {
builder.append(column.getColumnName()).append(QueryConstants.COMMA);
}
builder.deleteCharAt(builder.lastIndexOf(QueryConstants.COMMA)).append(QueryConstants.CLOSE_PARANTHESIS);
builder.append(QueryConstants.SPACE).append(VALUES).append(QueryConstants.OPEN_PARANTHESIS);
for (OracleColumn column : table.getColumns()) {
builder.append(QueryConstants.COLON).append(column.getColumnAlias()).append(QueryConstants.COMMA);
columnAliasSet.add(column.getColumnAlias());
}
builder.deleteCharAt(builder.lastIndexOf(QueryConstants.COMMA)).append(QueryConstants.CLOSE_PARANTHESIS);
return builder.toString();
</DeepExtract>
|
mongodb-rdbms-sync
|
positive
|
public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException {
var factory = DocumentBuilderFactory.newInstance();
var loader = factory.newDocumentBuilder();
var document = loader.parse("src/main/resources/continents.xml");
var traversal = (DocumentTraversal) document;
var walker = traversal.createTreeWalker(document.getDocumentElement(), NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null, true);
var node = walker.getCurrentNode();
if (node.getNodeType() == Node.ELEMENT_NODE) {
System.out.println("" + node.getNodeName());
}
if (node.getNodeType() == Node.TEXT_NODE) {
var content_trimmed = node.getTextContent().trim();
if (content_trimmed.length() > 0) {
System.out.print("");
System.out.printf("%s%n", content_trimmed);
}
}
for (var n = walker.firstChild(); n != null; n = walker.nextSibling()) {
traverseLevel(walker, "" + " ");
}
walker.setCurrentNode(node);
}
|
<DeepExtract>
var node = walker.getCurrentNode();
if (node.getNodeType() == Node.ELEMENT_NODE) {
System.out.println("" + node.getNodeName());
}
if (node.getNodeType() == Node.TEXT_NODE) {
var content_trimmed = node.getTextContent().trim();
if (content_trimmed.length() > 0) {
System.out.print("");
System.out.printf("%s%n", content_trimmed);
}
}
for (var n = walker.firstChild(); n != null; n = walker.nextSibling()) {
traverseLevel(walker, "" + " ");
}
walker.setCurrentNode(node);
</DeepExtract>
|
Java-Advanced
|
positive
|
public static void w() {
if (!IS_SHOW_ChuMuKLog) {
return;
}
String[] contents = wrapperContent(STACK_TRACE_INDEX_5, null, DEFAULT_MESSAGE);
String tag = contents[0];
String msg = contents[1];
String headString = contents[2];
switch(W) {
case V:
case D:
case I:
case W:
case E:
case A:
ChuMuBaseLog.printDefault(W, tag, headString + msg);
break;
case JSON:
JsonLog.printJson(tag, msg, headString);
break;
case XML:
XmlLog.printXml(tag, msg, headString);
break;
}
}
|
<DeepExtract>
if (!IS_SHOW_ChuMuKLog) {
return;
}
String[] contents = wrapperContent(STACK_TRACE_INDEX_5, null, DEFAULT_MESSAGE);
String tag = contents[0];
String msg = contents[1];
String headString = contents[2];
switch(W) {
case V:
case D:
case I:
case W:
case E:
case A:
ChuMuBaseLog.printDefault(W, tag, headString + msg);
break;
case JSON:
JsonLog.printJson(tag, msg, headString);
break;
case XML:
XmlLog.printXml(tag, msg, headString);
break;
}
</DeepExtract>
|
ChuMuYa
|
positive
|
protected void putResult(Object value) {
put(result, key, value);
}
|
<DeepExtract>
put(result, key, value);
</DeepExtract>
|
mungbean
|
positive
|
public static void launch(File openApiJsonFile, File generatedFrontendDirectory, String defaultClientPath) {
CodegenConfigurator configurator = new CodegenConfigurator();
configurator.setLang(VaadinConnectTsGenerator.class.getName());
configurator.setInputSpecURL(openApiJsonFile.toString());
configurator.setOutputDir(generatedFrontendDirectory.toString());
configurator.addAdditionalProperty(CLIENT_PATH_TEMPLATE_PROPERTY, getDefaultClientPath(defaultClientPath));
SwaggerParseResult parseResult = getParseResult(configurator);
if (parseResult != null && parseResult.getMessages().isEmpty()) {
OpenAPI openAPI = parseResult.getOpenAPI();
if (openAPI.getComponents() == null) {
openAPI.setComponents(new Components());
}
ClientOptInput clientOptInput = configurator.toClientOptInput().openAPI(openAPI);
Set<File> generatedFiles = new VaadinConnectTSOnlyGenerator().opts(clientOptInput).generate().stream().filter(Objects::nonNull).collect(Collectors.toSet());
cleanGeneratedFolder(configurator.getOutputDir(), generatedFiles);
} else {
String error = parseResult == null ? "" : StringUtils.join(parseResult.getMessages().toArray());
cleanGeneratedFolder(configurator.getOutputDir(), Collections.emptySet());
throw getUnexpectedOpenAPIException(configurator.getInputSpecURL(), error);
}
}
|
<DeepExtract>
SwaggerParseResult parseResult = getParseResult(configurator);
if (parseResult != null && parseResult.getMessages().isEmpty()) {
OpenAPI openAPI = parseResult.getOpenAPI();
if (openAPI.getComponents() == null) {
openAPI.setComponents(new Components());
}
ClientOptInput clientOptInput = configurator.toClientOptInput().openAPI(openAPI);
Set<File> generatedFiles = new VaadinConnectTSOnlyGenerator().opts(clientOptInput).generate().stream().filter(Objects::nonNull).collect(Collectors.toSet());
cleanGeneratedFolder(configurator.getOutputDir(), generatedFiles);
} else {
String error = parseResult == null ? "" : StringUtils.join(parseResult.getMessages().toArray());
cleanGeneratedFolder(configurator.getOutputDir(), Collections.emptySet());
throw getUnexpectedOpenAPIException(configurator.getInputSpecURL(), error);
}
</DeepExtract>
|
vaadin-connect
|
positive
|
protected void saturationVibrancePass(PGraphics pg) {
String saturationVibrance = "postFX/saturationVibranceFrag.glsl";
uniform(saturationVibrance).set("saturation", slider("saturation", 0, 0.5f, 0));
uniform(saturationVibrance).set("vibrance", slider("vibrance", 0, 0.5f, 0));
hotShader(saturationVibrance, null, true, pg);
}
|
<DeepExtract>
hotShader(saturationVibrance, null, true, pg);
</DeepExtract>
|
ProcessingSketches
|
positive
|
@Override
public void sendEvent(String name, SocketIOClient excludedClient, Object... data) {
Packet packet = new Packet(PacketType.MESSAGE);
packet.setSubType(PacketType.EVENT);
packet.setName(name);
packet.setData(Arrays.asList(data));
for (SocketIOClient client : clients) {
if (client.getSessionId().equals(excludedClient.getSessionId())) {
continue;
}
client.send(packet);
}
this.storeFactory.pubSubStore().publish(PubSubType.DISPATCH, new DispatchMessage(this.room, packet, this.namespace));
}
|
<DeepExtract>
this.storeFactory.pubSubStore().publish(PubSubType.DISPATCH, new DispatchMessage(this.room, packet, this.namespace));
</DeepExtract>
|
netty-socketio
|
positive
|
@Override
public void process(CommandSender sender, String name, UUID uuid, boolean group) {
PermissionEntity entity = storageStrategy.getPermissionService().getEntity(name, uuid, false);
if (entity == null || entity.getPermissions().isEmpty()) {
sendMessage(sender, colorize("{RED}Player has no declared permissions."));
return;
}
List<String> lines = new ArrayList<>();
lines.add(String.format(colorize("{YELLOW}Declared permissions for {AQUA}%s{YELLOW}:"), entity.getDisplayName()));
if (filter != null) {
filter = filter.toLowerCase().trim();
if (filter.isEmpty())
filter = null;
}
for (Entry e : Utils.sortPermissions(entity.getPermissions())) {
if (filter != null && !((e.getRegion() != null && e.getRegion().getName().contains(filter)) || (e.getWorld() != null && e.getWorld().getName().contains(filter)) || e.getPermission().contains(filter)))
continue;
lines.add(formatEntry(sender, e));
}
ToHMessageUtils.displayLines(plugin, sender, lines);
}
|
<DeepExtract>
PermissionEntity entity = storageStrategy.getPermissionService().getEntity(name, uuid, false);
if (entity == null || entity.getPermissions().isEmpty()) {
sendMessage(sender, colorize("{RED}Player has no declared permissions."));
return;
}
List<String> lines = new ArrayList<>();
lines.add(String.format(colorize("{YELLOW}Declared permissions for {AQUA}%s{YELLOW}:"), entity.getDisplayName()));
if (filter != null) {
filter = filter.toLowerCase().trim();
if (filter.isEmpty())
filter = null;
}
for (Entry e : Utils.sortPermissions(entity.getPermissions())) {
if (filter != null && !((e.getRegion() != null && e.getRegion().getName().contains(filter)) || (e.getWorld() != null && e.getWorld().getName().contains(filter)) || e.getPermission().contains(filter)))
continue;
lines.add(formatEntry(sender, e));
}
ToHMessageUtils.displayLines(plugin, sender, lines);
</DeepExtract>
|
zPermissions
|
positive
|
public Criteria andSimLevelIsNotNull() {
if ("SIM_LEVEL is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("SIM_LEVEL is not null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("SIM_LEVEL is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("SIM_LEVEL is not null"));
</DeepExtract>
|
ECPS
|
positive
|
public static void main(String[] args) {
String path = "/nfs/guille/xfern/users/xie/Experiment/experiment/";
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
String folderName = dateFormat.format(date);
ExperimentGeneration generator = new ExperimentGeneration(path, folderName);
generateMainFolder();
generateSubFolders();
}
|
<DeepExtract>
generateMainFolder();
generateSubFolders();
</DeepExtract>
|
cross-document-coreference-resolution
|
positive
|
@Test
public void testKeyOpenRange() {
List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "key", SecQueries.<Integer, Integer>builder().ltKey(8).build());
List<TestEntInd> values = ENTITY3.batchGetList(velvet, keys);
String result = values.stream().map(TestEntInd::getStr).collect(Collectors.joining(""));
Assert.assertEquals("limhefc", result);
List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "w2", SecQueries.<Integer, Integer>builder().geKey(8).build());
List<TestEntInd> values = ENTITY3.batchGetList(velvet, keys);
String result = values.stream().map(TestEntInd::getStr).collect(Collectors.joining(""));
Assert.assertEquals("kfd", result);
List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "str", SecQueries.<Integer, Integer>builder().leKey(8).build());
List<TestEntInd> values = ENTITY3.batchGetList(velvet, keys);
String result = values.stream().map(TestEntInd::getStr).collect(Collectors.joining(""));
Assert.assertEquals("abcdefghijk", result);
}
|
<DeepExtract>
List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "key", SecQueries.<Integer, Integer>builder().ltKey(8).build());
List<TestEntInd> values = ENTITY3.batchGetList(velvet, keys);
String result = values.stream().map(TestEntInd::getStr).collect(Collectors.joining(""));
Assert.assertEquals("limhefc", result);
</DeepExtract>
<DeepExtract>
List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "w2", SecQueries.<Integer, Integer>builder().geKey(8).build());
List<TestEntInd> values = ENTITY3.batchGetList(velvet, keys);
String result = values.stream().map(TestEntInd::getStr).collect(Collectors.joining(""));
Assert.assertEquals("kfd", result);
</DeepExtract>
<DeepExtract>
List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "str", SecQueries.<Integer, Integer>builder().leKey(8).build());
List<TestEntInd> values = ENTITY3.batchGetList(velvet, keys);
String result = values.stream().map(TestEntInd::getStr).collect(Collectors.joining(""));
Assert.assertEquals("abcdefghijk", result);
</DeepExtract>
|
velvetdb
|
positive
|
@Override
public void loadData() {
Log.d("PermissionActivity", "checkPermission");
Intent powerManagerIntent = PermissionsUtils.presentSettingIntent(this);
if (powerManagerIntent != null) {
startActivity(powerManagerIntent);
}
}
|
<DeepExtract>
Log.d("PermissionActivity", "checkPermission");
</DeepExtract>
|
AndroidCommonLibrary
|
positive
|
@Override
public String toString() {
return ROOT_EVAL.toJavaStringUncached();
}
|
<DeepExtract>
return ROOT_EVAL.toJavaStringUncached();
</DeepExtract>
|
simplelanguage
|
positive
|
private static void defaultExport(List<Map<String, Object>> list, String fileName, HttpServletResponse response) {
Workbook workbook = ExcelExportUtil.exportExcel(list, ExcelType.HSSF);
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
workbook.write(response.getOutputStream());
} catch (IOException e) {
throw new BusinessException("5101", e.getMessage());
}
}
|
<DeepExtract>
try {
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
workbook.write(response.getOutputStream());
} catch (IOException e) {
throw new BusinessException("5101", e.getMessage());
}
</DeepExtract>
|
erp-framework
|
positive
|
@Test
public void unpooledIndividualWrites() throws IOException {
ByteArrayPool pool = new ByteArrayPool(0);
byte[] data = new byte[16384];
for (int i = 0; i < data.length; i++) {
data[i] = (byte) (i & 0xff);
}
PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool);
for (int i = 0; i < data.length; i++) {
os.write(data[i]);
}
assertTrue(Arrays.equals(data, os.toByteArray()));
byte[] data = new byte[16384];
for (int i = 0; i < data.length; i++) {
data[i] = (byte) (i & 0xff);
}
PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool);
for (int i = 0; i < data.length; i++) {
os.write(data[i]);
}
assertTrue(Arrays.equals(data, os.toByteArray()));
byte[] data = new byte[16384];
for (int i = 0; i < data.length; i++) {
data[i] = (byte) (i & 0xff);
}
PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool);
for (int i = 0; i < data.length; i++) {
os.write(data[i]);
}
assertTrue(Arrays.equals(data, os.toByteArray()));
}
|
<DeepExtract>
byte[] data = new byte[16384];
for (int i = 0; i < data.length; i++) {
data[i] = (byte) (i & 0xff);
}
PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool);
for (int i = 0; i < data.length; i++) {
os.write(data[i]);
}
assertTrue(Arrays.equals(data, os.toByteArray()));
</DeepExtract>
<DeepExtract>
byte[] data = new byte[16384];
for (int i = 0; i < data.length; i++) {
data[i] = (byte) (i & 0xff);
}
PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool);
for (int i = 0; i < data.length; i++) {
os.write(data[i]);
}
assertTrue(Arrays.equals(data, os.toByteArray()));
</DeepExtract>
<DeepExtract>
byte[] data = new byte[16384];
for (int i = 0; i < data.length; i++) {
data[i] = (byte) (i & 0xff);
}
PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool);
for (int i = 0; i < data.length; i++) {
os.write(data[i]);
}
assertTrue(Arrays.equals(data, os.toByteArray()));
</DeepExtract>
|
device-database
|
positive
|
public PlayerBalance getPlayerBalanceInWorld(OfflinePlayer offlinePlayer, String world, GameMode gamemode) {
String worldGroup = Core.getWorldGroupManager().getWorldGroup(world);
if (mBalances.containsKey(offlinePlayer.getUniqueId()))
if (mBalances.get(offlinePlayer.getUniqueId()).has(worldGroup, gamemode)) {
return mBalances.get(offlinePlayer.getUniqueId()).getPlayerBalance(worldGroup, gamemode);
} else {
plugin.getMessages().debug("PlayerBalanceManager: creating new %s and %s", worldGroup, gamemode);
PlayerBalances ps = mBalances.get(offlinePlayer.getUniqueId());
PlayerBalance pb = new PlayerBalance(offlinePlayer, worldGroup, gamemode);
ps.putPlayerBalance(pb);
setPlayerBalance(offlinePlayer, pb);
return pb;
}
else {
PlayerBalances ps = new PlayerBalances();
PlayerBalance pb = new PlayerBalance(offlinePlayer, worldGroup, gamemode);
try {
plugin.getMessages().debug("PlayerBalanceManager: loading %s balance (%s,%s) from DB", offlinePlayer.getName(), worldGroup, gamemode);
ps = plugin.getStoreManager().loadPlayerBalances(offlinePlayer);
pb = ps.getPlayerBalance(worldGroup, gamemode);
} catch (UserNotFoundException e) {
plugin.getMessages().debug("PlayerBalanceManager: UserNotFoundException - setPlayerBalances:%s", pb.toString());
setPlayerBalance(offlinePlayer, pb);
} catch (DataStoreException e) {
e.printStackTrace();
}
if (!ps.has(worldGroup, gamemode)) {
plugin.getMessages().debug("PlayerBalanceManager: creating new balance:%s", pb.toString());
setPlayerBalance(offlinePlayer, pb);
}
mBalances.put(offlinePlayer.getUniqueId(), ps);
return pb;
}
}
|
<DeepExtract>
if (mBalances.containsKey(offlinePlayer.getUniqueId()))
if (mBalances.get(offlinePlayer.getUniqueId()).has(worldGroup, gamemode)) {
return mBalances.get(offlinePlayer.getUniqueId()).getPlayerBalance(worldGroup, gamemode);
} else {
plugin.getMessages().debug("PlayerBalanceManager: creating new %s and %s", worldGroup, gamemode);
PlayerBalances ps = mBalances.get(offlinePlayer.getUniqueId());
PlayerBalance pb = new PlayerBalance(offlinePlayer, worldGroup, gamemode);
ps.putPlayerBalance(pb);
setPlayerBalance(offlinePlayer, pb);
return pb;
}
else {
PlayerBalances ps = new PlayerBalances();
PlayerBalance pb = new PlayerBalance(offlinePlayer, worldGroup, gamemode);
try {
plugin.getMessages().debug("PlayerBalanceManager: loading %s balance (%s,%s) from DB", offlinePlayer.getName(), worldGroup, gamemode);
ps = plugin.getStoreManager().loadPlayerBalances(offlinePlayer);
pb = ps.getPlayerBalance(worldGroup, gamemode);
} catch (UserNotFoundException e) {
plugin.getMessages().debug("PlayerBalanceManager: UserNotFoundException - setPlayerBalances:%s", pb.toString());
setPlayerBalance(offlinePlayer, pb);
} catch (DataStoreException e) {
e.printStackTrace();
}
if (!ps.has(worldGroup, gamemode)) {
plugin.getMessages().debug("PlayerBalanceManager: creating new balance:%s", pb.toString());
setPlayerBalance(offlinePlayer, pb);
}
mBalances.put(offlinePlayer.getUniqueId(), ps);
return pb;
}
</DeepExtract>
|
BagOfGold
|
positive
|
@Override
public void actionPerformed(ActionEvent e) {
Object selected = team[0].getSelectedItem();
if (selected == null) {
return;
}
outTeam[0] = Integer.parseInt(((String) selected).split(" \\(")[1].split("\\)")[0]);
colorNames[0] = Teams.getColors(outTeam[0]).clone();
if (colorNames[0] == null || colorNames[0].length == 0) {
colorNames[0] = new String[] { "blue", "red" };
} else if (colorNames[0].length == 1) {
colorNames[0] = new String[] { colorNames[0][0], !"red".equals(colorNames[0][0]) ? "red" : "blue" };
}
if (false && colorNames[0][0].equals(colorNames[1 - 0][0])) {
switchTeamColor(0);
} else {
updateTeamColorIndicator(0);
}
colorNames[1] = Teams.getColors(outTeam[1]).clone();
if (colorNames[1] == null || colorNames[1].length == 0) {
colorNames[1] = new String[] { "blue", "red" };
} else if (colorNames[1].length == 1) {
colorNames[1] = new String[] { colorNames[1][0], !"red".equals(colorNames[1][0]) ? "red" : "blue" };
}
if (true && colorNames[1][0].equals(colorNames[1 - 1][0])) {
switchTeamColor(1);
} else {
updateTeamColorIndicator(1);
}
for (int i = 0; i < 2; ++i) {
teamContainer[i].setImage(getImage(i, colorNames[i][0]));
outTeamColor[i] = fromColorName(colorNames[i][0]);
}
teamIcon[0] = new ImageIcon(Teams.getIcon(outTeam[0]));
float scaleFactor;
if (teamIcon[0].getImage().getWidth(null) > teamIcon[0].getImage().getHeight(null)) {
scaleFactor = (float) IMAGE_SIZE / teamIcon[0].getImage().getWidth(null);
} else {
scaleFactor = (float) IMAGE_SIZE / teamIcon[0].getImage().getHeight(null);
}
BufferedImage image = (BufferedImage) teamIcon[0].getImage();
if (image.getType() != BufferedImage.TYPE_INT_ARGB) {
BufferedImage temp = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics g = temp.createGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
image = temp;
}
teamIcon[0].setImage(image.getScaledInstance((int) (teamIcon[0].getImage().getWidth(null) * scaleFactor), (int) (teamIcon[0].getImage().getHeight(null) * scaleFactor), Image.SCALE_SMOOTH));
teamIconLabel[0].setIcon(teamIcon[0]);
teamIconLabel[0].repaint();
teamIconLabel[1].repaint();
start.setEnabled(outTeam[0] != outTeam[1] && outTeamColor[0] != outTeamColor[1] && (fulltime.isSelected() || nofulltime.isSelected() || !fulltime.isVisible()));
}
|
<DeepExtract>
colorNames[0] = Teams.getColors(outTeam[0]).clone();
if (colorNames[0] == null || colorNames[0].length == 0) {
colorNames[0] = new String[] { "blue", "red" };
} else if (colorNames[0].length == 1) {
colorNames[0] = new String[] { colorNames[0][0], !"red".equals(colorNames[0][0]) ? "red" : "blue" };
}
if (false && colorNames[0][0].equals(colorNames[1 - 0][0])) {
switchTeamColor(0);
} else {
updateTeamColorIndicator(0);
}
</DeepExtract>
<DeepExtract>
colorNames[1] = Teams.getColors(outTeam[1]).clone();
if (colorNames[1] == null || colorNames[1].length == 0) {
colorNames[1] = new String[] { "blue", "red" };
} else if (colorNames[1].length == 1) {
colorNames[1] = new String[] { colorNames[1][0], !"red".equals(colorNames[1][0]) ? "red" : "blue" };
}
if (true && colorNames[1][0].equals(colorNames[1 - 1][0])) {
switchTeamColor(1);
} else {
updateTeamColorIndicator(1);
}
</DeepExtract>
<DeepExtract>
for (int i = 0; i < 2; ++i) {
teamContainer[i].setImage(getImage(i, colorNames[i][0]));
outTeamColor[i] = fromColorName(colorNames[i][0]);
}
</DeepExtract>
<DeepExtract>
teamIcon[0] = new ImageIcon(Teams.getIcon(outTeam[0]));
float scaleFactor;
if (teamIcon[0].getImage().getWidth(null) > teamIcon[0].getImage().getHeight(null)) {
scaleFactor = (float) IMAGE_SIZE / teamIcon[0].getImage().getWidth(null);
} else {
scaleFactor = (float) IMAGE_SIZE / teamIcon[0].getImage().getHeight(null);
}
BufferedImage image = (BufferedImage) teamIcon[0].getImage();
if (image.getType() != BufferedImage.TYPE_INT_ARGB) {
BufferedImage temp = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics g = temp.createGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
image = temp;
}
teamIcon[0].setImage(image.getScaledInstance((int) (teamIcon[0].getImage().getWidth(null) * scaleFactor), (int) (teamIcon[0].getImage().getHeight(null) * scaleFactor), Image.SCALE_SMOOTH));
</DeepExtract>
<DeepExtract>
start.setEnabled(outTeam[0] != outTeam[1] && outTeamColor[0] != outTeamColor[1] && (fulltime.isSelected() || nofulltime.isSelected() || !fulltime.isVisible()));
</DeepExtract>
|
GameController
|
positive
|
public Criteria andFoodIdIsNull() {
if ("food_id is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("food_id is null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("food_id is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("food_id is null"));
</DeepExtract>
|
hotel_ssm
|
positive
|
public String toString() {
return title;
}
|
<DeepExtract>
return title;
</DeepExtract>
|
CanadaWeather
|
positive
|
@SneakyThrows
@Override
public String rerun(String correlationId, Report originalReport, SecurityContext securityContext, ReportRunner reportRunner) {
originalReport.getCheckpoints().get(0);
Integer firstMessage = (Integer) originalReport.getCheckpoints().get(0).getMessageAsObject();
assertEquals((Integer) 10, firstMessage);
firstMessage = 100;
firstMessage = testTool.startpoint(correlationId, null, reportName, firstMessage);
i = i + firstMessage;
i = testTool.endpoint(correlationId, null, reportName, i);
return null;
}
|
<DeepExtract>
firstMessage = testTool.startpoint(correlationId, null, reportName, firstMessage);
i = i + firstMessage;
i = testTool.endpoint(correlationId, null, reportName, i);
</DeepExtract>
|
ibis-ladybug
|
positive
|
private static void groupCaptureTest() throws Exception {
Pattern pattern = Pattern.compile("x+(?>y+)z+");
Matcher matcher = pattern.matcher("xxxyyyzzz");
matcher.find();
try {
String blah = matcher.group(1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
}
pattern = Pattern.compile("x+(?:y+)z+");
matcher = pattern.matcher("xxxyyyzzz");
matcher.find();
try {
String blah = matcher.group(1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
}
pattern = Pattern.compile(toSupplementaries("x+(?>y+)z+"));
matcher = pattern.matcher(toSupplementaries("xxxyyyzzz"));
matcher.find();
try {
String blah = matcher.group(1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
}
pattern = Pattern.compile(toSupplementaries("x+(?:y+)z+"));
matcher = pattern.matcher(toSupplementaries("xxxyyyzzz"));
matcher.find();
try {
String blah = matcher.group(1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
}
int spacesToAdd = 30 - "GroupCapture".length();
StringBuffer paddedNameBuffer = new StringBuffer("GroupCapture");
for (int i = 0; i < spacesToAdd; i++) paddedNameBuffer.append(" ");
String paddedName = paddedNameBuffer.toString();
System.err.println(paddedName + ": " + (failCount == 0 ? "Passed" : "Failed(" + failCount + ")"));
if (failCount > 0)
failure = true;
failCount = 0;
}
|
<DeepExtract>
int spacesToAdd = 30 - "GroupCapture".length();
StringBuffer paddedNameBuffer = new StringBuffer("GroupCapture");
for (int i = 0; i < spacesToAdd; i++) paddedNameBuffer.append(" ");
String paddedName = paddedNameBuffer.toString();
System.err.println(paddedName + ": " + (failCount == 0 ? "Passed" : "Failed(" + failCount + ")"));
if (failCount > 0)
failure = true;
failCount = 0;
</DeepExtract>
|
RegExodus
|
positive
|
@Deprecated
public void change(int i, Key key) {
if (i < 0 || i >= NMAX)
throw new IndexOutOfBoundsException();
if (!contains(i))
throw new NoSuchElementException("index is not in the priority queue");
keys[i] = key;
swim(qp[i]);
sink(qp[i]);
}
|
<DeepExtract>
if (i < 0 || i >= NMAX)
throw new IndexOutOfBoundsException();
if (!contains(i))
throw new NoSuchElementException("index is not in the priority queue");
keys[i] = key;
swim(qp[i]);
sink(qp[i]);
</DeepExtract>
|
algorithms-java
|
positive
|
public void startFFREW(int increment) {
if (ffrewHandler != null) {
ffrewHandler.cancel();
}
if (updateHandler != null) {
updateHandler.cancel();
}
ffrewHandler = new FFREWHandler();
this.increment = increment;
transportTimer.scheduleAtFixedRate(ffrewHandler, 0, 250);
}
|
<DeepExtract>
this.increment = increment;
</DeepExtract>
|
janos
|
positive
|
public static void isFalse(boolean expect, String code, Object... params) {
if (!!expect) {
throw ValidationException.of(code, params);
}
}
|
<DeepExtract>
if (!!expect) {
throw ValidationException.of(code, params);
}
</DeepExtract>
|
ms-spring-ddd-examples
|
positive
|
@Override
public boolean visit(ParenthesizedExpression node) {
out.print("(");
node.getExpression().accept(this);
out.print(")");
return false;
}
|
<DeepExtract>
out.print("(");
</DeepExtract>
<DeepExtract>
out.print(")");
</DeepExtract>
|
j2c
|
positive
|
@Test
void subscribeAndRequestOnSubscribeAndConnect() {
final Pipeline<?> target = new Pipeline<>();
final AtomicReference<Subscription> subscription = new AtomicReference<>();
final AtomicBoolean cancellation = new AtomicBoolean();
final AtomicLong requests = new AtomicLong();
if (!this.subscription.compareAndSet(null, new TestSubscription(requests, cancellation))) {
throw new IllegalStateException("Pipeline should not subscribe twice");
}
target.connect(new TestSubscriber(subscription));
MatcherAssert.assertThat("Not requested one item", requests.get(), new IsEqual<>(1L));
MatcherAssert.assertThat("Cancelled on request", cancellation.get(), new IsEqual<>(false));
MatcherAssert.assertThat("Not subscribed", subscription.get(), new IsEqual<>(target));
}
|
<DeepExtract>
if (!this.subscription.compareAndSet(null, new TestSubscription(requests, cancellation))) {
throw new IllegalStateException("Pipeline should not subscribe twice");
}
</DeepExtract>
|
http
|
positive
|
public TreeNode lowestCommonAncestorRecursive(TreeNode root, TreeNode p, TreeNode q) {
Map<TreeNode, Integer> levels = new HashMap<>();
LinkedList<TreeNode> order = new LinkedList<>();
levels.put(root, 0);
order.add(root);
if (root.left != null) {
dfs(root.left, order, levels, 0 + 1);
order.add(root);
}
if (root.right != null) {
dfs(root.right, order, levels, 0 + 1);
order.add(root);
}
TreeNode lca = null;
int lowestLevel = Integer.MAX_VALUE;
boolean foundP = false, foundQ = false;
boolean foundP = false, foundQ = false;
for (TreeNode node : order) {
if (foundP && foundQ)
break;
if (node == p)
foundP = true;
if (node == q)
foundQ = true;
if (foundP || foundQ) {
int nodeLevel = levels.get(node);
if (nodeLevel < lowestLevel) {
lowestLevel = nodeLevel;
lca = node;
}
}
}
return lca;
}
|
<DeepExtract>
levels.put(root, 0);
order.add(root);
if (root.left != null) {
dfs(root.left, order, levels, 0 + 1);
order.add(root);
}
if (root.right != null) {
dfs(root.right, order, levels, 0 + 1);
order.add(root);
}
</DeepExtract>
|
bsharp
|
positive
|
@Override
public void applyStyles(TextStyle textStyle) {
if (fBoldFont == null) {
Font font = getDialogArea().getFont();
FontData[] data = font.getFontData();
for (int i = 0; i < data.length; i++) {
data[i].setStyle(SWT.BOLD);
}
fBoldFont = new Font(font.getDevice(), data);
}
return fBoldFont;
}
|
<DeepExtract>
if (fBoldFont == null) {
Font font = getDialogArea().getFont();
FontData[] data = font.getFontData();
for (int i = 0; i < data.length; i++) {
data[i].setStyle(SWT.BOLD);
}
fBoldFont = new Font(font.getDevice(), data);
}
return fBoldFont;
</DeepExtract>
|
angularjs-eclipse
|
positive
|
public void clearReference(Entity entity) {
RefList entities;
lock.lock();
try {
int hash = hash(entity);
RefEntry node = this.loop(entity, this.entries[hash]);
if (node == null)
entities = null;
else
entities = node.val();
} finally {
lock.unlock();
}
if (entities == null)
return;
for (WeakEntity<?> e : entities) e.clear();
lock.lock();
try {
hasNodes.signal();
} finally {
lock.unlock();
}
}
|
<DeepExtract>
RefList entities;
lock.lock();
try {
int hash = hash(entity);
RefEntry node = this.loop(entity, this.entries[hash]);
if (node == null)
entities = null;
else
entities = node.val();
} finally {
lock.unlock();
}
</DeepExtract>
<DeepExtract>
lock.lock();
try {
hasNodes.signal();
} finally {
lock.unlock();
}
</DeepExtract>
|
TridentSDK
|
positive
|
private String getFullPlayNotes(String notes, int playTime) {
StringBuilder fullNotes = new StringBuilder();
for (String key : sharp.keySet()) {
notes = notes.replaceAll(key, sharp.get(key));
}
return notes;
for (int i = 0; i < playTime / notes.length(); i++) {
fullNotes.append(notes);
}
fullNotes.append(notes, 0, playTime % notes.length());
return fullNotes.toString();
}
|
<DeepExtract>
for (String key : sharp.keySet()) {
notes = notes.replaceAll(key, sharp.get(key));
}
return notes;
</DeepExtract>
|
algorithm-study
|
positive
|
public static void recreateCards() {
mCardUI.clearCards();
String sectionColor = fa.getString(R.string.sound_control_color);
mCardUI.addStack(new CardStack(""));
if (!Helpers.doesFileExist(FAUX_SC_VERSION)) {
mCardUI.addCard(new CardTextStripe(fa.getString(R.string.unsupported), fa.getString(R.string.sound_control_unsupported), "#C74B46", "#C74B46", false));
} else {
String[] headphoneGains = CPUHelper.readOneLineNotRoot(FAUX_SC_HEADPHONE).split(" ");
int headphoneGainLeft = Integer.valueOf(headphoneGains[0]);
if (headphoneGainLeft > 100)
headphoneGainLeft -= 256;
int headphoneGainRight = Integer.valueOf(headphoneGains[1]);
if (headphoneGainRight > 100)
headphoneGainRight -= 256;
final CardDoubleSeekBar headphoneCard = new CardDoubleSeekBar(fa.getString(R.string.sc_headphone_digital_gain), fa.getString(R.string.sc_headphone_digital_gain_desc), sectionColor, "", FAUX_SC_HEADPHONE, 40, headphoneGainLeft + 30, headphoneGainRight + 30, fa, null);
mCards.add(headphoneCard);
mCardUI.addCard(headphoneCard);
String[] headphonePAGains = CPUHelper.readOneLineNotRoot(FAUX_SC_HEADPHONE_POWERAMP).split(" ");
int headphonePAGainLeft = Integer.valueOf(headphonePAGains[0]);
int headphonePAGainRight = Integer.valueOf(headphonePAGains[1]);
CardDoubleSeekBarPA headphonePaCard = new CardDoubleSeekBarPA(fa.getString(R.string.sc_headphone_analog_gain), fa.getString(R.string.sc_headphone_analog_gain_desc), sectionColor, "", FAUX_SC_HEADPHONE_POWERAMP, 12, headphonePAGainLeft, headphonePAGainRight, fa, null);
mCards.add(headphonePaCard);
mCardUI.addCard(headphonePaCard);
String[] speakerGains = CPUHelper.readOneLineNotRoot(FAUX_SC_SPEAKER).split(" ");
int speakerGainLeft = Integer.valueOf(speakerGains[0]);
if (speakerGainLeft > 100)
speakerGainLeft -= 256;
int speakerGainRight = Integer.valueOf(speakerGains[1]);
if (speakerGainRight > 100)
speakerGainRight -= 256;
CardDoubleSeekBar speakerCard = new CardDoubleSeekBar(fa.getString(R.string.sc_speaker_gain), fa.getString(R.string.sc_speaker_gain_desc), fa.getString(R.string.sound_control_color), "", FAUX_SC_SPEAKER, 40, speakerGainLeft + 30, speakerGainRight + 30, fa, null);
mCards.add(speakerCard);
mCardUI.addCard(speakerCard);
int micGain = Integer.valueOf(CPUHelper.readOneLine(FAUX_SC_MIC));
if (micGain > 100)
micGain -= 256;
CardSeekBarSC micCard = new CardSeekBarSC(fa.getString(R.string.sc_mic_gain), fa.getString(R.string.sc_mic_gain_desc), fa.getString(R.string.sound_control_color), "", FAUX_SC_MIC, 40, micGain + 30, fa, new ActionMode.Callback() {
private Boolean isApplied = false;
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
MenuInflater inflater = actionMode.getMenuInflater();
inflater.inflate(R.menu.contextual_menu, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
switch(menuItem.getItemId()) {
case R.id.cancel:
actionMode.finish();
break;
case R.id.apply:
isApplied = true;
SharedPreferences prefs = fa.getSharedPreferences("syskernelsound_control_3gpl_mic_gain", 0);
int toApply = prefs.getInt("VALUE", 0);
Helpers.CMDProcessorWrapper.runSuCommand("busybox echo 0 > " + FAUX_SC_LOCKED + "\n" + "busybox echo " + toApply + " " + Helpers.getSoundCountrolBitRepresentation(toApply, 0) + " > " + FAUX_SC_MIC + "\n" + "busybox echo 1 > " + FAUX_SC_LOCKED);
bootPrefs.edit().putString("SC_MIC", toApply + " " + Helpers.getSoundCountrolBitRepresentation(toApply, 0)).commit();
actionMode.finish();
}
return false;
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
if (!isApplied) {
mCardUI.clearCards();
createCards();
}
}
});
mCards.add(micCard);
mCardUI.addCard(micCard);
int camMicGain = Integer.valueOf(CPUHelper.readOneLine(FAUX_SC_CAM_MIC));
if (camMicGain > 100)
camMicGain -= 256;
CardSeekBarSC camCard = new CardSeekBarSC(fa.getString(R.string.sc_cam_mic_gain), fa.getString(R.string.sc_cam_mic_gain_desc), fa.getString(R.string.sound_control_color), "", FAUX_SC_CAM_MIC, 40, camMicGain + 30, fa, new ActionMode.Callback() {
private Boolean isApplied = false;
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
MenuInflater inflater = actionMode.getMenuInflater();
inflater.inflate(R.menu.contextual_menu, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
switch(menuItem.getItemId()) {
case R.id.cancel:
actionMode.finish();
break;
case R.id.apply:
isApplied = true;
SharedPreferences prefs = fa.getSharedPreferences("syskernelsound_control_3gpl_cam_mic_gain", 0);
int toApply = prefs.getInt("VALUE", 0);
Helpers.CMDProcessorWrapper.runSuCommand("busybox echo 0 > " + FAUX_SC_LOCKED + "\n" + "busybox echo " + toApply + " " + Helpers.getSoundCountrolBitRepresentation(toApply, 0) + " > " + FAUX_SC_CAM_MIC + "\n" + "busybox echo 1 > " + FAUX_SC_LOCKED);
bootPrefs.edit().putString("SC_CAM_MIC", toApply + " " + Helpers.getSoundCountrolBitRepresentation(toApply, 0)).commit();
actionMode.finish();
break;
}
return false;
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
if (!isApplied) {
mCardUI.clearCards();
createCards();
}
}
});
mCards.add(camCard);
mCardUI.addCard(camCard);
}
mCardUI.refresh();
}
|
<DeepExtract>
String sectionColor = fa.getString(R.string.sound_control_color);
mCardUI.addStack(new CardStack(""));
if (!Helpers.doesFileExist(FAUX_SC_VERSION)) {
mCardUI.addCard(new CardTextStripe(fa.getString(R.string.unsupported), fa.getString(R.string.sound_control_unsupported), "#C74B46", "#C74B46", false));
} else {
String[] headphoneGains = CPUHelper.readOneLineNotRoot(FAUX_SC_HEADPHONE).split(" ");
int headphoneGainLeft = Integer.valueOf(headphoneGains[0]);
if (headphoneGainLeft > 100)
headphoneGainLeft -= 256;
int headphoneGainRight = Integer.valueOf(headphoneGains[1]);
if (headphoneGainRight > 100)
headphoneGainRight -= 256;
final CardDoubleSeekBar headphoneCard = new CardDoubleSeekBar(fa.getString(R.string.sc_headphone_digital_gain), fa.getString(R.string.sc_headphone_digital_gain_desc), sectionColor, "", FAUX_SC_HEADPHONE, 40, headphoneGainLeft + 30, headphoneGainRight + 30, fa, null);
mCards.add(headphoneCard);
mCardUI.addCard(headphoneCard);
String[] headphonePAGains = CPUHelper.readOneLineNotRoot(FAUX_SC_HEADPHONE_POWERAMP).split(" ");
int headphonePAGainLeft = Integer.valueOf(headphonePAGains[0]);
int headphonePAGainRight = Integer.valueOf(headphonePAGains[1]);
CardDoubleSeekBarPA headphonePaCard = new CardDoubleSeekBarPA(fa.getString(R.string.sc_headphone_analog_gain), fa.getString(R.string.sc_headphone_analog_gain_desc), sectionColor, "", FAUX_SC_HEADPHONE_POWERAMP, 12, headphonePAGainLeft, headphonePAGainRight, fa, null);
mCards.add(headphonePaCard);
mCardUI.addCard(headphonePaCard);
String[] speakerGains = CPUHelper.readOneLineNotRoot(FAUX_SC_SPEAKER).split(" ");
int speakerGainLeft = Integer.valueOf(speakerGains[0]);
if (speakerGainLeft > 100)
speakerGainLeft -= 256;
int speakerGainRight = Integer.valueOf(speakerGains[1]);
if (speakerGainRight > 100)
speakerGainRight -= 256;
CardDoubleSeekBar speakerCard = new CardDoubleSeekBar(fa.getString(R.string.sc_speaker_gain), fa.getString(R.string.sc_speaker_gain_desc), fa.getString(R.string.sound_control_color), "", FAUX_SC_SPEAKER, 40, speakerGainLeft + 30, speakerGainRight + 30, fa, null);
mCards.add(speakerCard);
mCardUI.addCard(speakerCard);
int micGain = Integer.valueOf(CPUHelper.readOneLine(FAUX_SC_MIC));
if (micGain > 100)
micGain -= 256;
CardSeekBarSC micCard = new CardSeekBarSC(fa.getString(R.string.sc_mic_gain), fa.getString(R.string.sc_mic_gain_desc), fa.getString(R.string.sound_control_color), "", FAUX_SC_MIC, 40, micGain + 30, fa, new ActionMode.Callback() {
private Boolean isApplied = false;
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
MenuInflater inflater = actionMode.getMenuInflater();
inflater.inflate(R.menu.contextual_menu, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
switch(menuItem.getItemId()) {
case R.id.cancel:
actionMode.finish();
break;
case R.id.apply:
isApplied = true;
SharedPreferences prefs = fa.getSharedPreferences("syskernelsound_control_3gpl_mic_gain", 0);
int toApply = prefs.getInt("VALUE", 0);
Helpers.CMDProcessorWrapper.runSuCommand("busybox echo 0 > " + FAUX_SC_LOCKED + "\n" + "busybox echo " + toApply + " " + Helpers.getSoundCountrolBitRepresentation(toApply, 0) + " > " + FAUX_SC_MIC + "\n" + "busybox echo 1 > " + FAUX_SC_LOCKED);
bootPrefs.edit().putString("SC_MIC", toApply + " " + Helpers.getSoundCountrolBitRepresentation(toApply, 0)).commit();
actionMode.finish();
}
return false;
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
if (!isApplied) {
mCardUI.clearCards();
createCards();
}
}
});
mCards.add(micCard);
mCardUI.addCard(micCard);
int camMicGain = Integer.valueOf(CPUHelper.readOneLine(FAUX_SC_CAM_MIC));
if (camMicGain > 100)
camMicGain -= 256;
CardSeekBarSC camCard = new CardSeekBarSC(fa.getString(R.string.sc_cam_mic_gain), fa.getString(R.string.sc_cam_mic_gain_desc), fa.getString(R.string.sound_control_color), "", FAUX_SC_CAM_MIC, 40, camMicGain + 30, fa, new ActionMode.Callback() {
private Boolean isApplied = false;
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
MenuInflater inflater = actionMode.getMenuInflater();
inflater.inflate(R.menu.contextual_menu, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
switch(menuItem.getItemId()) {
case R.id.cancel:
actionMode.finish();
break;
case R.id.apply:
isApplied = true;
SharedPreferences prefs = fa.getSharedPreferences("syskernelsound_control_3gpl_cam_mic_gain", 0);
int toApply = prefs.getInt("VALUE", 0);
Helpers.CMDProcessorWrapper.runSuCommand("busybox echo 0 > " + FAUX_SC_LOCKED + "\n" + "busybox echo " + toApply + " " + Helpers.getSoundCountrolBitRepresentation(toApply, 0) + " > " + FAUX_SC_CAM_MIC + "\n" + "busybox echo 1 > " + FAUX_SC_LOCKED);
bootPrefs.edit().putString("SC_CAM_MIC", toApply + " " + Helpers.getSoundCountrolBitRepresentation(toApply, 0)).commit();
actionMode.finish();
break;
}
return false;
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
if (!isApplied) {
mCardUI.clearCards();
createCards();
}
}
});
mCards.add(camCard);
mCardUI.addCard(camCard);
}
mCardUI.refresh();
</DeepExtract>
|
Pimp_my_Z1
|
positive
|
static public void loadAsm(Machine machine, String filename) {
Assembler assembler = new Assembler();
ErrorCatcher errorCatcher = assembler.errorCatcher;
Program program = assembler.assemble(Utils.readFile(filename));
if (errorCatcher.count() > 0) {
errorCatcher.print();
return;
}
Writer writer = new StringWriter();
assembler.generateObj(program, writer, false);
Reader reader = new StringReader(writer.toString());
try {
if (reader.read() != 'H')
return false;
readString(reader, 6);
int start = readWord(reader);
int length = readWord(reader);
if (reader.read() == '\r')
reader.read();
Memory mem = machine.memory;
int ch = reader.read();
while (ch == 'T') {
int loc = readWord(reader);
int len = readByte(reader);
while (len-- > 0) {
if (loc < start || loc >= start + length)
return false;
byte val = (byte) readByte(reader);
mem.setByteRaw(loc++, val);
}
if (reader.read() == '\r')
reader.read();
ch = reader.read();
}
while (ch == 'M') {
readWord(reader);
readByte(reader);
if (reader.read() == '\r')
reader.read();
ch = reader.read();
}
if (ch != 'E')
return false;
machine.registers.setPC(readWord(reader));
} catch (IOException e) {
return false;
}
return true;
}
|
<DeepExtract>
try {
if (reader.read() != 'H')
return false;
readString(reader, 6);
int start = readWord(reader);
int length = readWord(reader);
if (reader.read() == '\r')
reader.read();
Memory mem = machine.memory;
int ch = reader.read();
while (ch == 'T') {
int loc = readWord(reader);
int len = readByte(reader);
while (len-- > 0) {
if (loc < start || loc >= start + length)
return false;
byte val = (byte) readByte(reader);
mem.setByteRaw(loc++, val);
}
if (reader.read() == '\r')
reader.read();
ch = reader.read();
}
while (ch == 'M') {
readWord(reader);
readByte(reader);
if (reader.read() == '\r')
reader.read();
ch = reader.read();
}
if (ch != 'E')
return false;
machine.registers.setPC(readWord(reader));
} catch (IOException e) {
return false;
}
return true;
</DeepExtract>
|
SicTools
|
positive
|
public static boolean hasSameId(GraphObject a, GraphObject b) {
if (a == null || b == null || !a.asMap().containsKey("id") || !b.asMap().containsKey("id")) {
return false;
}
if (a.equals(b)) {
return true;
}
Object idA = a.getProperty("id");
Object idB = b.getProperty("id");
if (idA == null || idB == null || !(idA instanceof String) || !(idB instanceof String)) {
return false;
}
if (this == idB)
return true;
if (getClass() != idB.getClass()) {
return false;
}
@SuppressWarnings("unchecked")
GraphObjectListImpl<T> other = (GraphObjectListImpl<T>) idB;
return state.equals(other.state);
}
|
<DeepExtract>
if (this == idB)
return true;
if (getClass() != idB.getClass()) {
return false;
}
@SuppressWarnings("unchecked")
GraphObjectListImpl<T> other = (GraphObjectListImpl<T>) idB;
return state.equals(other.state);
</DeepExtract>
|
HypFacebook
|
positive
|
@POST
public final void doDeleteRevision(StaplerRequest req, StaplerResponse rsp) {
getAccessControlledObject().checkPermission(JobConfigHistory.DELETEENTRY_PERMISSION);
final String timestamp = req.getParameter("timestamp");
final String name = req.getParameter("name");
final File[] candidatesArray = (name.contains(DeletedFileFilter.DELETED_MARKER)) ? getOverviewHistoryDao().getDeletedJobs() : getOverviewHistoryDao().getSystemConfigs();
final List<File> candidates = Arrays.stream(candidatesArray).filter(file -> file.getName().equals(name)).collect(Collectors.toList());
if (candidates.size() == 1) {
getHistoryDao().deleteRevision(candidates.get(0), timestamp);
} else {
LOG.log(WARNING, "there should be only one entry for \"{0}\". Instead there are {1}", new Object[] { name, candidates.size() });
}
}
|
<DeepExtract>
getAccessControlledObject().checkPermission(JobConfigHistory.DELETEENTRY_PERMISSION);
</DeepExtract>
|
jobConfigHistory-plugin
|
positive
|
public List<System> getAllDeadWithQueueItems(int minLastAliveSeconds) {
Calendar cal = new GregorianCalendar();
cal.add(Calendar.SECOND, (-1) * minLastAliveSeconds);
TypedQuery<System> query = getEntityManager().createQuery("SELECT s FROM System s " + "WHERE s.lastAlive <= :lastAlive AND " + "s.systemId IN (SELECT i.systemId FROM SendQueueItem i GROUP BY i.systemId) " + "ORDER BY s.systemId ASC", System.class);
query.setParameter("lastAlive", cal.getTime());
List<System> result = query.getResultList();
return result;
}
|
<DeepExtract>
</DeepExtract>
|
tubewarder
|
positive
|
public Criteria andPasswordIsNotNull() {
if ("password is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("password is not null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("password is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("password is not null"));
</DeepExtract>
|
Ordering
|
positive
|
@Override
public Fragment getItem(int position) {
RecipeFragment fragment = new RecipeFragment();
fragment.recipe = recipe;
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, position + 1);
fragment.setArguments(args);
return fragment;
}
|
<DeepExtract>
RecipeFragment fragment = new RecipeFragment();
fragment.recipe = recipe;
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, position + 1);
fragment.setArguments(args);
return fragment;
</DeepExtract>
|
AndroidDashboardView
|
positive
|
@Test
public void shouldPassSslSessionAndHostnameToHostnameVerifierCDI() {
ConfigurableHostnameVerifier.setAccepting(true);
assertEquals("bar", clientWithHostnameVerifier.get("1").getString("foo"));
try {
assertEquals("localhost", ConfigurableHostnameVerifier.getHostname());
assertNotNull(ConfigurableHostnameVerifier.getSslSession());
assertNotNull(ConfigurableHostnameVerifier.getSslSession().getCipherSuite());
assertNotNull(ConfigurableHostnameVerifier.getSslSession().getPeerCertificates());
return true;
} catch (SSLPeerUnverifiedException e) {
throw new RuntimeException("failed to verify ssl session and hostname", e);
}
}
|
<DeepExtract>
try {
assertEquals("localhost", ConfigurableHostnameVerifier.getHostname());
assertNotNull(ConfigurableHostnameVerifier.getSslSession());
assertNotNull(ConfigurableHostnameVerifier.getSslSession().getCipherSuite());
assertNotNull(ConfigurableHostnameVerifier.getSslSession().getPeerCertificates());
return true;
} catch (SSLPeerUnverifiedException e) {
throw new RuntimeException("failed to verify ssl session and hostname", e);
}
</DeepExtract>
|
microprofile-rest-client
|
positive
|
public void showAnalyze() {
addScreen(Screens.ANALYZE, new Object[] {});
setContentView(R.layout.activity_main);
SeparatedListAdapter sadapter = new SeparatedListAdapter(this, 0);
sadapter.addSection(getString(R.string.analyze_analyze), new ArrayAdapter<>(getApplicationContext(), R.layout.listitem, new String[] { getString(R.string.analyze_analyze_database) }));
List<Triple<String, String, String>> activeSensors = new ArrayList<>();
Set<String> devices = ListenerService.getDevices();
Set<Integer> enabledSensors = SensorDataCollectorService.getInstance().getSCM().getEnabledCollectors();
for (Integer enabledSensor : enabledSensors) {
String name = SensorDataUtil.getSensorType(enabledSensor);
for (String device : devices) {
if (enabledSensor > 0) {
SensorCollector sc = SensorDataCollectorService.getInstance().getSCM().getSensorCollectors().get(enabledSensor);
if (sc.isRegistered) {
activeSensors.add(new Triple<>(StringUtils.formatSensorName(name), getString(R.string.analyze_analyzelive_collecting), device));
}
} else {
CustomCollector cc = SensorDataCollectorService.getInstance().getSCM().getCustomCollectors().get(enabledSensor);
if (cc.isRegistered() && cc.getPlotter(device) != null && cc.getPlotter(device).plottingEnabled()) {
activeSensors.add(new Triple<>(StringUtils.formatSensorName(name), getString(R.string.analyze_analyzelive_collecting), device));
} else if (cc.isRegistered() && cc.getPlotter(device) != null && SensorDataUtil.getSensorType(cc.getType()).equals("TYPE_GPS")) {
activeSensors.add(new Triple<>(StringUtils.formatSensorName(name), getString(R.string.analyze_analyzelive_collecting), device));
}
}
}
}
Collections.sort(activeSensors);
sadapter.addSection(getString(R.string.analyze_analyzelive), new AnalyzeRowAdapter(this, R.layout.listitemueberblick, activeSensors));
ListView lv = (ListView) findViewById(R.id.mainlist);
lv.setAdapter(sadapter);
lv.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (view instanceof TextView) {
showAnalyzeDatabase();
}
if (!(view instanceof RelativeLayout)) {
return;
}
RelativeLayout layout = (RelativeLayout) view;
TextView title = layout.findViewById(R.id.list_item_ueberblick_title);
String sensorName = title.getText().toString();
TextView value = layout.findViewById(R.id.list_item_ueberblick_title_subtitle);
String deviceID = value.getText().toString().replace(getString(R.string.analyze_analyzelive_device) + ": ", "");
int sensorId = SensorDataUtil.getSensorTypeInt("TYPE_" + sensorName.toUpperCase(Locale.ENGLISH).replace(" ", "_"));
showAnalyzeLive(deviceID, sensorId);
}
});
}
|
<DeepExtract>
addScreen(Screens.ANALYZE, new Object[] {});
</DeepExtract>
|
sensordatacollector
|
positive
|
public void rebuildOjectGraphAndInject() {
Mortar.destroyRootScope(applicationScope);
long start = System.nanoTime();
ObjectGraph objectGraph = ObjectGraph.create(Modules.list(this));
objectGraph.inject(this);
applicationScope = Mortar.createRootScope(BuildConfig.DEBUG, objectGraph);
long diff = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
Timber.i("Global object graph creation took %sms", diff);
}
|
<DeepExtract>
long start = System.nanoTime();
ObjectGraph objectGraph = ObjectGraph.create(Modules.list(this));
objectGraph.inject(this);
applicationScope = Mortar.createRootScope(BuildConfig.DEBUG, objectGraph);
long diff = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
Timber.i("Global object graph creation took %sms", diff);
</DeepExtract>
|
u2020-mortar
|
positive
|
public int executeUpdate(String sql) throws SQLException {
String methodCall = "executeUpdate(" + sql + ")";
_reportSql((DriverSpy.StatementUsageWarn ? StatementSqlWarning : "") + sql, methodCall);
long tstart = System.currentTimeMillis();
try {
int result = realStatement.executeUpdate(sql);
reportStatementSqlTiming(System.currentTimeMillis() - tstart, sql, methodCall);
return reportReturn(methodCall, result);
} catch (SQLException s) {
reportException(methodCall, s, sql, System.currentTimeMillis() - tstart);
throw s;
}
}
|
<DeepExtract>
_reportSql((DriverSpy.StatementUsageWarn ? StatementSqlWarning : "") + sql, methodCall);
</DeepExtract>
|
miniprofiler-jvm
|
positive
|
public static void main(String[] args) {
MarioGame game = new MarioGame();
System.out.println("****************************************************************");
System.out.println("Game Status: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getGameStatus().toString() + " Percentage Completion: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getCompletionPercentage());
System.out.println("Lives: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getCurrentLives() + " Coins: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getCurrentCoins() + " Remaining Time: " + (int) Math.ceil(game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getRemainingTime() / 1000f));
System.out.println("Mario State: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getMarioMode() + " (Mushrooms: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getNumCollectedMushrooms() + " Fire Flowers: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getNumCollectedFireflower() + ")");
System.out.println("Total Kills: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsTotal() + " (Stomps: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsByStomp() + " Fireballs: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsByFire() + " Shells: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsByShell() + " Falls: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsByFall() + ")");
System.out.println("Bricks: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getNumDestroyedBricks() + " Jumps: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getNumJumps() + " Max X Jump: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getMaxXJump() + " Max Air Time: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getMaxJumpAirTime());
System.out.println("****************************************************************");
}
|
<DeepExtract>
System.out.println("****************************************************************");
System.out.println("Game Status: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getGameStatus().toString() + " Percentage Completion: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getCompletionPercentage());
System.out.println("Lives: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getCurrentLives() + " Coins: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getCurrentCoins() + " Remaining Time: " + (int) Math.ceil(game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getRemainingTime() / 1000f));
System.out.println("Mario State: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getMarioMode() + " (Mushrooms: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getNumCollectedMushrooms() + " Fire Flowers: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getNumCollectedFireflower() + ")");
System.out.println("Total Kills: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsTotal() + " (Stomps: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsByStomp() + " Fireballs: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsByFire() + " Shells: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsByShell() + " Falls: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getKillsByFall() + ")");
System.out.println("Bricks: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getNumDestroyedBricks() + " Jumps: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getNumJumps() + " Max X Jump: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getMaxXJump() + " Max Air Time: " + game.runGame(new agents.robinBaumgarten.Agent(), getLevel("./levels/original/lvl-1.txt"), 20, 0, true).getMaxJumpAirTime());
System.out.println("****************************************************************");
</DeepExtract>
|
Mario-AI-Framework
|
positive
|
public Criteria andGmtModifiedGreaterThan(Long value) {
if (value == null) {
throw new RuntimeException("Value for " + "gmtModified" + " cannot be null");
}
criteria.add(new Criterion("gmt_modified >", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "gmtModified" + " cannot be null");
}
criteria.add(new Criterion("gmt_modified >", value));
</DeepExtract>
|
community
|
positive
|
@UiThread
private void transitionForward(State oldState, final State newState) {
mPreviousStateView.setVisibility(View.VISIBLE);
mCurrentStateView.setVisibility(View.VISIBLE);
switch(oldState) {
case SEARCHING:
mPreviousStateView.setBackgroundResource(R.color.state_searching);
mPreviousStateView.setText(R.string.status_searching);
break;
case CONNECTED:
mPreviousStateView.setBackgroundColor(mConnectedColor);
mPreviousStateView.setText(R.string.status_connected);
break;
default:
mPreviousStateView.setBackgroundResource(R.color.state_unknown);
mPreviousStateView.setText(R.string.status_unknown);
break;
}
switch(newState) {
case SEARCHING:
mCurrentStateView.setBackgroundResource(R.color.state_searching);
mCurrentStateView.setText(R.string.status_searching);
break;
case CONNECTED:
mCurrentStateView.setBackgroundColor(mConnectedColor);
mCurrentStateView.setText(R.string.status_connected);
break;
default:
mCurrentStateView.setBackgroundResource(R.color.state_unknown);
mCurrentStateView.setText(R.string.status_unknown);
break;
}
if (ViewCompat.isLaidOut(mCurrentStateView)) {
mCurrentAnimator = createAnimator(false);
mCurrentAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationEnd(Animator animator) {
updateTextView(mCurrentStateView, newState);
}
});
mCurrentAnimator.start();
}
}
|
<DeepExtract>
switch(oldState) {
case SEARCHING:
mPreviousStateView.setBackgroundResource(R.color.state_searching);
mPreviousStateView.setText(R.string.status_searching);
break;
case CONNECTED:
mPreviousStateView.setBackgroundColor(mConnectedColor);
mPreviousStateView.setText(R.string.status_connected);
break;
default:
mPreviousStateView.setBackgroundResource(R.color.state_unknown);
mPreviousStateView.setText(R.string.status_unknown);
break;
}
</DeepExtract>
<DeepExtract>
switch(newState) {
case SEARCHING:
mCurrentStateView.setBackgroundResource(R.color.state_searching);
mCurrentStateView.setText(R.string.status_searching);
break;
case CONNECTED:
mCurrentStateView.setBackgroundColor(mConnectedColor);
mCurrentStateView.setText(R.string.status_connected);
break;
default:
mCurrentStateView.setBackgroundResource(R.color.state_unknown);
mCurrentStateView.setText(R.string.status_unknown);
break;
}
</DeepExtract>
|
connectivity-samples
|
positive
|
@Override
public void onDraw(Canvas canvas) {
frame = CameraManager.get().getFramingRect();
if (frame == null) {
return;
}
int width = canvas.getWidth();
int height = canvas.getHeight();
if (mSlideTop == -1) {
mSlideTop = frame.top;
}
paint.reset();
paint.setAntiAlias(true);
paint.setColor(getResources().getColor(R.color.shadow));
canvas.drawRect(0, 0, width, frame.top, paint);
canvas.drawRect(0, frame.top, frame.left, frame.bottom, paint);
canvas.drawRect(frame.right, frame.top, width, frame.bottom, paint);
canvas.drawRect(0, frame.bottom, width, height, paint);
paint.reset();
paint.setAntiAlias(true);
paint.setColor(getResources().getColor(R.color.corner));
canvas.drawRect(frame.left, frame.top, frame.left + RECT_CORNER_WIDTH, frame.top + mCornerLength, paint);
canvas.drawRect(frame.left, frame.top, frame.left + mCornerLength, frame.top + RECT_CORNER_WIDTH, paint);
canvas.drawRect(frame.right - mCornerLength, frame.top, frame.right, frame.top + RECT_CORNER_WIDTH, paint);
canvas.drawRect(frame.right - RECT_CORNER_WIDTH, frame.top, frame.right, frame.top + mCornerLength, paint);
canvas.drawRect(frame.left, frame.bottom - mCornerLength, frame.left + RECT_CORNER_WIDTH, frame.bottom, paint);
canvas.drawRect(frame.left, frame.bottom - RECT_CORNER_WIDTH, frame.left + mCornerLength, frame.bottom, paint);
canvas.drawRect(frame.right - mCornerLength, frame.bottom - RECT_CORNER_WIDTH, frame.right, frame.bottom, paint);
canvas.drawRect(frame.right - RECT_CORNER_WIDTH, frame.bottom - mCornerLength, frame.right, frame.bottom, paint);
int barWidth = frame.right - frame.left - 2 * mCornerLength;
int width = mScanBar.getWidth();
float scaleWidth = ((float) barWidth) / width;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, 1.0f);
mScanBar = Bitmap.createBitmap(mScanBar, 0, 0, width, mScanBar.getHeight(), matrix, true);
paint.reset();
canvas.drawBitmap(mScanBar, frame.left + mCornerLength, mSlideTop + mCornerLength, paint);
paint.reset();
paint.setColor(Color.WHITE);
String scanTip = getResources().getString(R.string.scan_tip);
float textSize = (frame.right - frame.left) / scanTip.length();
paint.setTextSize(textSize);
canvas.drawText(scanTip, frame.left, frame.bottom + getFontHeight() + mCornerLength, paint);
Collection<ResultPoint> currentPossible = possibleResultPoints;
Collection<ResultPoint> currentLast = lastPossibleResultPoints;
if (currentPossible.isEmpty()) {
lastPossibleResultPoints = null;
} else {
possibleResultPoints = new HashSet<ResultPoint>(5);
lastPossibleResultPoints = currentPossible;
paint.setAlpha(OPAQUE);
paint.setColor(resultPointColor);
for (ResultPoint point : currentPossible) {
canvas.drawCircle(frame.left + point.getX(), frame.top + point.getY(), 6.0f, paint);
}
}
if (currentLast != null) {
paint.setAlpha(OPAQUE / 2);
paint.setColor(resultPointColor);
for (ResultPoint point : currentLast) {
canvas.drawCircle(frame.left + point.getX(), frame.top + point.getY(), 3.0f, paint);
}
}
mSlideTop += 16;
if (mSlideTop >= frame.bottom) {
mSlideTop = frame.top;
}
if (!isPause) {
postInvalidateDelayed(ANIMATION_DELAY, frame.left, frame.top, frame.right, frame.bottom);
}
}
|
<DeepExtract>
paint.reset();
paint.setAntiAlias(true);
paint.setColor(getResources().getColor(R.color.shadow));
canvas.drawRect(0, 0, width, frame.top, paint);
canvas.drawRect(0, frame.top, frame.left, frame.bottom, paint);
canvas.drawRect(frame.right, frame.top, width, frame.bottom, paint);
canvas.drawRect(0, frame.bottom, width, height, paint);
</DeepExtract>
<DeepExtract>
paint.reset();
paint.setAntiAlias(true);
paint.setColor(getResources().getColor(R.color.corner));
canvas.drawRect(frame.left, frame.top, frame.left + RECT_CORNER_WIDTH, frame.top + mCornerLength, paint);
canvas.drawRect(frame.left, frame.top, frame.left + mCornerLength, frame.top + RECT_CORNER_WIDTH, paint);
canvas.drawRect(frame.right - mCornerLength, frame.top, frame.right, frame.top + RECT_CORNER_WIDTH, paint);
canvas.drawRect(frame.right - RECT_CORNER_WIDTH, frame.top, frame.right, frame.top + mCornerLength, paint);
canvas.drawRect(frame.left, frame.bottom - mCornerLength, frame.left + RECT_CORNER_WIDTH, frame.bottom, paint);
canvas.drawRect(frame.left, frame.bottom - RECT_CORNER_WIDTH, frame.left + mCornerLength, frame.bottom, paint);
canvas.drawRect(frame.right - mCornerLength, frame.bottom - RECT_CORNER_WIDTH, frame.right, frame.bottom, paint);
canvas.drawRect(frame.right - RECT_CORNER_WIDTH, frame.bottom - mCornerLength, frame.right, frame.bottom, paint);
</DeepExtract>
<DeepExtract>
int barWidth = frame.right - frame.left - 2 * mCornerLength;
int width = mScanBar.getWidth();
float scaleWidth = ((float) barWidth) / width;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, 1.0f);
mScanBar = Bitmap.createBitmap(mScanBar, 0, 0, width, mScanBar.getHeight(), matrix, true);
</DeepExtract>
<DeepExtract>
paint.reset();
canvas.drawBitmap(mScanBar, frame.left + mCornerLength, mSlideTop + mCornerLength, paint);
</DeepExtract>
<DeepExtract>
paint.reset();
paint.setColor(Color.WHITE);
String scanTip = getResources().getString(R.string.scan_tip);
float textSize = (frame.right - frame.left) / scanTip.length();
paint.setTextSize(textSize);
canvas.drawText(scanTip, frame.left, frame.bottom + getFontHeight() + mCornerLength, paint);
</DeepExtract>
|
AndroidDemo
|
positive
|
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(getString(R.string.heading_edit_exercise));
final EditExerciseView editView = (EditExerciseView) getActivity().getLayoutInflater().inflate(R.layout.dialog_edit_exercise, null);
this.exercise = exercise;
builder.setView(editView);
builder.setCancelable(true);
builder.setNegativeButton(android.R.string.cancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
editView.update();
listener.onUpdated();
}
});
return builder.create();
}
|
<DeepExtract>
this.exercise = exercise;
</DeepExtract>
|
HIITMe
|
positive
|
public static CityForecastEntity fromContentValues(ContentValues contentValues) {
CityForecastEntity cityForecastEntity = new CityForecastEntity();
if (contentValues == null) {
return cityForecastEntity;
}
city_name = contentValues.getAsString(COLUMN_NAME);
this.adcode = contentValues.getAsString(COLUMN_CODE);
this.date = contentValues.getAsString(COLUMN_DATE);
this.week = contentValues.getAsString(COLUMN_WEEK);
this.dayweather = contentValues.getAsString(COLUMN_DAY_WEATHER);
this.nightweather = contentValues.getAsString(COLUMN_NIGHT_WEATHER);
this.daywind = contentValues.getAsString(COLUMN_DAY_WIND);
this.nightwind = contentValues.getAsString(COLUMN_NIGHT_WIND);
this.daypower = contentValues.getAsString(COLUMN_DAY_POWER);
this.nightpower = contentValues.getAsString(COLUMN_NIGHT_POWER);
return cityForecastEntity;
}
|
<DeepExtract>
city_name = contentValues.getAsString(COLUMN_NAME);
</DeepExtract>
<DeepExtract>
this.adcode = contentValues.getAsString(COLUMN_CODE);
</DeepExtract>
<DeepExtract>
this.date = contentValues.getAsString(COLUMN_DATE);
</DeepExtract>
<DeepExtract>
this.week = contentValues.getAsString(COLUMN_WEEK);
</DeepExtract>
<DeepExtract>
this.dayweather = contentValues.getAsString(COLUMN_DAY_WEATHER);
</DeepExtract>
<DeepExtract>
this.nightweather = contentValues.getAsString(COLUMN_NIGHT_WEATHER);
</DeepExtract>
<DeepExtract>
this.daywind = contentValues.getAsString(COLUMN_DAY_WIND);
</DeepExtract>
<DeepExtract>
this.nightwind = contentValues.getAsString(COLUMN_NIGHT_WIND);
</DeepExtract>
<DeepExtract>
this.daypower = contentValues.getAsString(COLUMN_DAY_POWER);
</DeepExtract>
<DeepExtract>
this.nightpower = contentValues.getAsString(COLUMN_NIGHT_POWER);
</DeepExtract>
|
WeatherApp
|
positive
|
public void play(int start, PlayDirection direction) {
if (mPlaying)
return;
mTotal = mPlayable.getTotal();
if (mTotal <= 1) {
return;
}
mPlaying = true;
mPlayable.playTo(start);
final Handler handler = new Handler(Looper.myLooper());
mTimerTask = new Runnable() {
@Override
public void run() {
if (!mPaused) {
playNextFrame();
}
if (mPlaying) {
handler.postDelayed(mTimerTask, mTimeInterval);
}
}
};
handler.postDelayed(mTimerTask, mTimeInterval);
}
|
<DeepExtract>
mPlayable.playTo(start);
</DeepExtract>
|
cube-sdk
|
positive
|
@Override
public String component7() {
return (String) get(6);
}
|
<DeepExtract>
return (String) get(6);
</DeepExtract>
|
wdumper
|
positive
|
private void deleteContact() {
contentResolver.delete(Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, contact.getLookupKey()), null, null);
changed = true;
if (changed)
setResult(RESULT_OK);
super.finish();
}
|
<DeepExtract>
if (changed)
setResult(RESULT_OK);
super.finish();
</DeepExtract>
|
BaldPhone
|
positive
|
public static void isNull(Object object, CodeMessage errorEnum, Object... params) {
if (!object == null) {
throw newException(errorEnum, params);
}
}
|
<DeepExtract>
if (!object == null) {
throw newException(errorEnum, params);
}
</DeepExtract>
|
mayfly
|
positive
|
public static boolean verify(String rspContent, String signature, String alipayPublicKey) throws Exception {
PublicKey publicKey = getPublicKeyFromBase64String(alipayPublicKey);
Signature publicSignature = Signature.getInstance(SHA256WITHRSA);
publicSignature.initVerify(publicKey);
publicSignature.update(rspContent.getBytes(DEFAULT_CHARSET));
byte[] signatureBytes = base64Encryptor.decode(decode(signature, DEFAULT_CHARSET));
return publicSignature.verify(signatureBytes);
}
|
<DeepExtract>
PublicKey publicKey = getPublicKeyFromBase64String(alipayPublicKey);
Signature publicSignature = Signature.getInstance(SHA256WITHRSA);
publicSignature.initVerify(publicKey);
publicSignature.update(rspContent.getBytes(DEFAULT_CHARSET));
byte[] signatureBytes = base64Encryptor.decode(decode(signature, DEFAULT_CHARSET));
return publicSignature.verify(signatureBytes);
</DeepExtract>
|
global-open-sdk-java
|
positive
|
public static HttpHeaders createEntityUpdateAlert(String entityName, String param) {
HttpHeaders headers = new HttpHeaders();
headers.add("X-" + APPLICATION_NAME + "-alert", "A " + entityName + " is updated with identifier " + param);
headers.add("X-" + APPLICATION_NAME + "-params", param);
return headers;
}
|
<DeepExtract>
HttpHeaders headers = new HttpHeaders();
headers.add("X-" + APPLICATION_NAME + "-alert", "A " + entityName + " is updated with identifier " + param);
headers.add("X-" + APPLICATION_NAME + "-params", param);
return headers;
</DeepExtract>
|
JMPisces
|
positive
|
@Override
public Stormtrooper updateStormtrooper(String id, Stormtrooper stormtrooper) {
if (stormtrooper.getId() == null || stormtrooper.getId().trim().isEmpty()) {
stormtrooper.setId(generateRandomId());
}
trooperMap.put(stormtrooper.getId(), stormtrooper);
return stormtrooper;
}
|
<DeepExtract>
if (stormtrooper.getId() == null || stormtrooper.getId().trim().isEmpty()) {
stormtrooper.setId(generateRandomId());
}
trooperMap.put(stormtrooper.getId(), stormtrooper);
return stormtrooper;
</DeepExtract>
|
okta-auth-java
|
positive
|
public void attachSound() {
if (soundEffects != null)
throw new RuntimeException("Already attached.");
soundEffects = new JavaSoundSFX();
this.proxy.addListener(soundEffects);
}
|
<DeepExtract>
this.proxy.addListener(soundEffects);
</DeepExtract>
|
jdyna
|
positive
|
private Map<String, String> getAttributionParameters(String initiatedBy) {
ContentResolver contentResolver = adjustConfig.context.getContentResolver();
Map<String, String> parameters = new HashMap<String, String>();
Map<String, String> imeiParameters = Reflection.getImeiParameters(adjustConfig.context, logger);
if (imeiParameters != null) {
parameters.putAll(imeiParameters);
}
Map<String, String> oaidParameters = Reflection.getOaidParameters(adjustConfig.context, logger);
if (oaidParameters != null) {
parameters.putAll(oaidParameters);
}
deviceInfo.reloadPlayIds(adjustConfig.context);
if (TextUtils.isEmpty(activityStateCopy.uuid)) {
return;
}
parameters.put("android_uuid", activityStateCopy.uuid);
if (TextUtils.isEmpty(deviceInfo.playAdId)) {
return;
}
parameters.put("gps_adid", deviceInfo.playAdId);
if (deviceInfo.playAdIdAttempt < 0) {
return;
}
String valueString = Long.toString(deviceInfo.playAdIdAttempt);
PackageBuilder.addString(parameters, "gps_adid_attempt", valueString);
if (TextUtils.isEmpty(deviceInfo.playAdIdSource)) {
return;
}
parameters.put("gps_adid_src", deviceInfo.playAdIdSource);
if (deviceInfo.isTrackingEnabled == null) {
return;
}
int intValue = deviceInfo.isTrackingEnabled ? 1 : 0;
PackageBuilder.addLong(parameters, "tracking_enabled", intValue);
if (TextUtils.isEmpty(Util.getFireAdvertisingId(contentResolver))) {
return;
}
parameters.put("fire_adid", Util.getFireAdvertisingId(contentResolver));
if (Util.getFireTrackingEnabled(contentResolver) == null) {
return;
}
int intValue = Util.getFireTrackingEnabled(contentResolver) ? 1 : 0;
PackageBuilder.addLong(parameters, "fire_tracking_enabled", intValue);
if (!containsPlayIds(parameters) && !containsFireIds(parameters)) {
logger.warn("Google Advertising ID or Fire Advertising ID not detected, " + "fallback to non Google Play and Fire identifiers will take place");
deviceInfo.reloadNonPlayIds(adjustConfig.context);
PackageBuilder.addString(parameters, "android_id", deviceInfo.androidId);
PackageBuilder.addString(parameters, "mac_md5", deviceInfo.macShortMd5);
PackageBuilder.addString(parameters, "mac_sha1", deviceInfo.macSha1);
}
if (TextUtils.isEmpty(deviceInfo.apiLevel)) {
return;
}
parameters.put("api_level", deviceInfo.apiLevel);
if (TextUtils.isEmpty(adjustConfig.appSecret)) {
return;
}
parameters.put("app_secret", adjustConfig.appSecret);
if (TextUtils.isEmpty(adjustConfig.appToken)) {
return;
}
parameters.put("app_token", adjustConfig.appToken);
if (TextUtils.isEmpty(deviceInfo.appVersion)) {
return;
}
parameters.put("app_version", deviceInfo.appVersion);
if (true == null) {
return;
}
int intValue = true ? 1 : 0;
PackageBuilder.addLong(parameters, "attribution_deeplink", intValue);
if (createdAt <= 0) {
return;
}
Date date = new Date(createdAt);
PackageBuilder.addDate(parameters, "created_at", date);
if (adjustConfig.deviceKnown == null) {
return;
}
int intValue = adjustConfig.deviceKnown ? 1 : 0;
PackageBuilder.addLong(parameters, "device_known", intValue);
if (adjustConfig.needsCost == null) {
return;
}
int intValue = adjustConfig.needsCost ? 1 : 0;
PackageBuilder.addLong(parameters, "needs_cost", intValue);
if (TextUtils.isEmpty(deviceInfo.deviceName)) {
return;
}
parameters.put("device_name", deviceInfo.deviceName);
if (TextUtils.isEmpty(deviceInfo.deviceType)) {
return;
}
parameters.put("device_type", deviceInfo.deviceType);
if (TextUtils.isEmpty(adjustConfig.environment)) {
return;
}
parameters.put("environment", adjustConfig.environment);
if (adjustConfig.eventBufferingEnabled == null) {
return;
}
int intValue = adjustConfig.eventBufferingEnabled ? 1 : 0;
PackageBuilder.addLong(parameters, "event_buffering_enabled", intValue);
if (TextUtils.isEmpty(adjustConfig.externalDeviceId)) {
return;
}
parameters.put("external_device_id", adjustConfig.externalDeviceId);
if (TextUtils.isEmpty(initiatedBy)) {
return;
}
parameters.put("initiated_by", initiatedBy);
if (true == null) {
return;
}
int intValue = true ? 1 : 0;
PackageBuilder.addLong(parameters, "needs_response_details", intValue);
if (TextUtils.isEmpty(deviceInfo.osName)) {
return;
}
parameters.put("os_name", deviceInfo.osName);
if (TextUtils.isEmpty(deviceInfo.osVersion)) {
return;
}
parameters.put("os_version", deviceInfo.osVersion);
if (TextUtils.isEmpty(deviceInfo.packageName)) {
return;
}
parameters.put("package_name", deviceInfo.packageName);
if (TextUtils.isEmpty(activityStateCopy.pushToken)) {
return;
}
parameters.put("push_token", activityStateCopy.pushToken);
if (TextUtils.isEmpty(adjustConfig.secretId)) {
return;
}
parameters.put("secret_id", adjustConfig.secretId);
if (parameters != null && !parameters.containsKey("mac_sha1") && !parameters.containsKey("mac_md5") && !parameters.containsKey("android_id") && !parameters.containsKey("gps_adid") && !parameters.containsKey("oaid") && !parameters.containsKey("imei") && !parameters.containsKey("meid") && !parameters.containsKey("device_id") && !parameters.containsKey("imeis") && !parameters.containsKey("meids") && !parameters.containsKey("device_ids")) {
logger.error("Missing device id's. Please check if Proguard is correctly set with Adjust SDK");
}
return parameters;
}
|
<DeepExtract>
if (TextUtils.isEmpty(activityStateCopy.uuid)) {
return;
}
parameters.put("android_uuid", activityStateCopy.uuid);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(deviceInfo.playAdId)) {
return;
}
parameters.put("gps_adid", deviceInfo.playAdId);
</DeepExtract>
<DeepExtract>
if (deviceInfo.playAdIdAttempt < 0) {
return;
}
String valueString = Long.toString(deviceInfo.playAdIdAttempt);
PackageBuilder.addString(parameters, "gps_adid_attempt", valueString);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(deviceInfo.playAdIdSource)) {
return;
}
parameters.put("gps_adid_src", deviceInfo.playAdIdSource);
</DeepExtract>
<DeepExtract>
if (deviceInfo.isTrackingEnabled == null) {
return;
}
int intValue = deviceInfo.isTrackingEnabled ? 1 : 0;
PackageBuilder.addLong(parameters, "tracking_enabled", intValue);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(Util.getFireAdvertisingId(contentResolver))) {
return;
}
parameters.put("fire_adid", Util.getFireAdvertisingId(contentResolver));
</DeepExtract>
<DeepExtract>
if (Util.getFireTrackingEnabled(contentResolver) == null) {
return;
}
int intValue = Util.getFireTrackingEnabled(contentResolver) ? 1 : 0;
PackageBuilder.addLong(parameters, "fire_tracking_enabled", intValue);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(deviceInfo.apiLevel)) {
return;
}
parameters.put("api_level", deviceInfo.apiLevel);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(adjustConfig.appSecret)) {
return;
}
parameters.put("app_secret", adjustConfig.appSecret);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(adjustConfig.appToken)) {
return;
}
parameters.put("app_token", adjustConfig.appToken);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(deviceInfo.appVersion)) {
return;
}
parameters.put("app_version", deviceInfo.appVersion);
</DeepExtract>
<DeepExtract>
if (true == null) {
return;
}
int intValue = true ? 1 : 0;
PackageBuilder.addLong(parameters, "attribution_deeplink", intValue);
</DeepExtract>
<DeepExtract>
if (createdAt <= 0) {
return;
}
Date date = new Date(createdAt);
PackageBuilder.addDate(parameters, "created_at", date);
</DeepExtract>
<DeepExtract>
if (adjustConfig.deviceKnown == null) {
return;
}
int intValue = adjustConfig.deviceKnown ? 1 : 0;
PackageBuilder.addLong(parameters, "device_known", intValue);
</DeepExtract>
<DeepExtract>
if (adjustConfig.needsCost == null) {
return;
}
int intValue = adjustConfig.needsCost ? 1 : 0;
PackageBuilder.addLong(parameters, "needs_cost", intValue);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(deviceInfo.deviceName)) {
return;
}
parameters.put("device_name", deviceInfo.deviceName);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(deviceInfo.deviceType)) {
return;
}
parameters.put("device_type", deviceInfo.deviceType);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(adjustConfig.environment)) {
return;
}
parameters.put("environment", adjustConfig.environment);
</DeepExtract>
<DeepExtract>
if (adjustConfig.eventBufferingEnabled == null) {
return;
}
int intValue = adjustConfig.eventBufferingEnabled ? 1 : 0;
PackageBuilder.addLong(parameters, "event_buffering_enabled", intValue);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(adjustConfig.externalDeviceId)) {
return;
}
parameters.put("external_device_id", adjustConfig.externalDeviceId);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(initiatedBy)) {
return;
}
parameters.put("initiated_by", initiatedBy);
</DeepExtract>
<DeepExtract>
if (true == null) {
return;
}
int intValue = true ? 1 : 0;
PackageBuilder.addLong(parameters, "needs_response_details", intValue);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(deviceInfo.osName)) {
return;
}
parameters.put("os_name", deviceInfo.osName);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(deviceInfo.osVersion)) {
return;
}
parameters.put("os_version", deviceInfo.osVersion);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(deviceInfo.packageName)) {
return;
}
parameters.put("package_name", deviceInfo.packageName);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(activityStateCopy.pushToken)) {
return;
}
parameters.put("push_token", activityStateCopy.pushToken);
</DeepExtract>
<DeepExtract>
if (TextUtils.isEmpty(adjustConfig.secretId)) {
return;
}
parameters.put("secret_id", adjustConfig.secretId);
</DeepExtract>
<DeepExtract>
if (parameters != null && !parameters.containsKey("mac_sha1") && !parameters.containsKey("mac_md5") && !parameters.containsKey("android_id") && !parameters.containsKey("gps_adid") && !parameters.containsKey("oaid") && !parameters.containsKey("imei") && !parameters.containsKey("meid") && !parameters.containsKey("device_id") && !parameters.containsKey("imeis") && !parameters.containsKey("meids") && !parameters.containsKey("device_ids")) {
logger.error("Missing device id's. Please check if Proguard is correctly set with Adjust SDK");
}
</DeepExtract>
|
adobe_air_sdk
|
positive
|
public Criteria andIntervaltimeBetween(Integer value1, Integer value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "intervaltime" + " cannot be null");
}
criteria.add(new Criterion("intervalTime between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "intervaltime" + " cannot be null");
}
criteria.add(new Criterion("intervalTime between", value1, value2));
</DeepExtract>
|
emotional_analysis
|
positive
|
public Criteria andUsernameNotEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "username" + " cannot be null");
}
criteria.add(new Criterion("username <>", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "username" + " cannot be null");
}
criteria.add(new Criterion("username <>", value));
</DeepExtract>
|
BookLibrarySystem
|
positive
|
@Override
public int read() throws IOException {
if (end) {
return -1;
}
if (inBufPos < 16) {
return;
}
if (end) {
return;
}
int read = BlockInputStream.fullyRead(this.in, cipherBuf, 0, 16);
if (read == -1) {
this.end = true;
} else if (read != 16) {
throw new IOException("Couldn't read 16 bytes of data " + read);
} else {
try {
cipher.update(cipherBuf, 0, 16, inBuf);
} catch (ShortBufferException e) {
throw new IOException(e);
}
}
inBufPos = 0;
if (end) {
return -1;
}
return inBuf[inBufPos++];
}
|
<DeepExtract>
if (inBufPos < 16) {
return;
}
if (end) {
return;
}
int read = BlockInputStream.fullyRead(this.in, cipherBuf, 0, 16);
if (read == -1) {
this.end = true;
} else if (read != 16) {
throw new IOException("Couldn't read 16 bytes of data " + read);
} else {
try {
cipher.update(cipherBuf, 0, 16, inBuf);
} catch (ShortBufferException e) {
throw new IOException(e);
}
}
inBufPos = 0;
</DeepExtract>
|
jrpip
|
positive
|
@Override
protected void notifyErrorListener(final Task<Throwable> task) {
new Thread(new Runnable() {
@Override
public void run() {
AsyncTasksHolder.super.notifyErrorListener(task);
}
}).start();
}
|
<DeepExtract>
new Thread(new Runnable() {
@Override
public void run() {
AsyncTasksHolder.super.notifyErrorListener(task);
}
}).start();
</DeepExtract>
|
RairDemo
|
positive
|
@Override
public void putCached(final int[] ngram, final int startPos, final int endPos, final float f, final int hash) {
final int[] arrayHere = !threadSafe ? threadUnsafeArray : threadSafeArray.get();
return arrayHere[startOfStruct(hash) + VAL_OFFSET] = Float.floatToIntBits(f);
return arrayHere[startOfStruct(hash) + WORD_OFFSET] = ngram[endPos - 1];
for (int i = startPos; i < endPos - 1; ++i) {
arrayHere[getKeyStart(hash) + i - startPos] = ngram[i];
}
for (int i = endPos - 1; i < arrayLength; ++i) {
arrayHere[getKeyStart(hash) + i - startPos] = EMPTY;
}
}
|
<DeepExtract>
return arrayHere[startOfStruct(hash) + VAL_OFFSET] = Float.floatToIntBits(f);
</DeepExtract>
<DeepExtract>
return arrayHere[startOfStruct(hash) + WORD_OFFSET] = ngram[endPos - 1];
</DeepExtract>
|
maul
|
positive
|
public void put(Object routeKey, DataSource dataSource, boolean isDefault) {
wrapperDataSources.put(routeKey, dataSource);
if (isDefault ? dataSource : null != null) {
this.setDefaultTargetDataSource(isDefault ? dataSource : null);
}
this.setTargetDataSources(wrapperDataSources);
this.afterPropertiesSet();
}
|
<DeepExtract>
if (isDefault ? dataSource : null != null) {
this.setDefaultTargetDataSource(isDefault ? dataSource : null);
}
this.setTargetDataSources(wrapperDataSources);
this.afterPropertiesSet();
</DeepExtract>
|
Milkomeda
|
positive
|
public String getSelection() {
return "SelectionBuilder[table=" + mTable + ", selection=" + getSelection() + ", selectionArgs=" + Arrays.toString(getSelectionArgs()) + "]";
}
|
<DeepExtract>
return "SelectionBuilder[table=" + mTable + ", selection=" + getSelection() + ", selectionArgs=" + Arrays.toString(getSelectionArgs()) + "]";
</DeepExtract>
|
ElectricSleep
|
positive
|
private ResponseMessage loadResponse() throws IOException {
int len;
if (false) {
len = 0;
} else {
byte tmp = (byte) inStream.read();
if (tmp >= 0) {
len = tmp;
} else {
int result = tmp & 127;
if (false) {
len = 0;
} else {
if ((tmp = (byte) inStream.read()) >= 0) {
result |= tmp << 7;
} else {
result |= (tmp & 127) << 7;
if ((tmp = (byte) inStream.read()) >= 0) {
result |= tmp << 14;
} else {
result |= (tmp & 127) << 14;
if ((tmp = (byte) inStream.read()) >= 0) {
result |= tmp << 21;
} else {
result |= (tmp & 127) << 21;
result |= (tmp = (byte) inStream.read()) << 28;
if (tmp < 0) {
throw new RuntimeException("ERROR on Decode");
}
}
}
}
len = result;
}
}
}
int curOffset = 0;
if (buffer.length < len)
buffer = new byte[len];
do {
curOffset = inStream.read(buffer, curOffset, len);
} while (curOffset < len);
return ResponseMessage.parser().parseFrom(buffer, 0, len);
}
|
<DeepExtract>
int len;
if (false) {
len = 0;
} else {
byte tmp = (byte) inStream.read();
if (tmp >= 0) {
len = tmp;
} else {
int result = tmp & 127;
if (false) {
len = 0;
} else {
if ((tmp = (byte) inStream.read()) >= 0) {
result |= tmp << 7;
} else {
result |= (tmp & 127) << 7;
if ((tmp = (byte) inStream.read()) >= 0) {
result |= tmp << 14;
} else {
result |= (tmp & 127) << 14;
if ((tmp = (byte) inStream.read()) >= 0) {
result |= tmp << 21;
} else {
result |= (tmp & 127) << 21;
result |= (tmp = (byte) inStream.read()) << 28;
if (tmp < 0) {
throw new RuntimeException("ERROR on Decode");
}
}
}
}
len = result;
}
}
}
</DeepExtract>
|
timecrypt
|
positive
|
public ProcessingMessage setLogLevel(final LogLevel level) {
BUNDLE.checkNotNull(level, "processing.nullLevel");
this.level = level;
if ("level" == null)
return this;
if (level == null)
return putNull("level");
map.put("level", level.deepCopy());
return this;
}
|
<DeepExtract>
if ("level" == null)
return this;
if (level == null)
return putNull("level");
map.put("level", level.deepCopy());
return this;
</DeepExtract>
|
json-schema-core
|
positive
|
public FacetResult runDrillDown() throws IOException {
IndexWriterConfig iwc = new IndexWriterConfig(new WhitespaceAnalyzer()).setOpenMode(OpenMode.CREATE);
IndexWriter indexWriter = new IndexWriter(indexDir, iwc);
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);
Document doc = new Document();
doc.add(new IntAssociationFacetField(3, "tags", "lucene"));
doc.add(new FloatAssociationFacetField(0.87f, "genre", "computing"));
indexWriter.addDocument(config.build(taxoWriter, doc));
doc = new Document();
doc.add(new IntAssociationFacetField(1, "tags", "lucene"));
doc.add(new IntAssociationFacetField(2, "tags", "solr"));
doc.add(new FloatAssociationFacetField(0.75f, "genre", "computing"));
doc.add(new FloatAssociationFacetField(0.34f, "genre", "software"));
indexWriter.addDocument(config.build(taxoWriter, doc));
indexWriter.close();
taxoWriter.close();
DirectoryReader indexReader = DirectoryReader.open(indexDir);
IndexSearcher searcher = new IndexSearcher(indexReader);
TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);
DrillDownQuery q = new DrillDownQuery(config);
q.add("tags", "solr");
FacetsCollector fc = new FacetsCollector();
FacetsCollector.search(searcher, q, 10, fc);
Facets facets = new TaxonomyFacetSumFloatAssociations("$genre", taxoReader, config, fc);
FacetResult result = facets.getTopChildren(10, "genre");
indexReader.close();
taxoReader.close();
return result;
}
|
<DeepExtract>
IndexWriterConfig iwc = new IndexWriterConfig(new WhitespaceAnalyzer()).setOpenMode(OpenMode.CREATE);
IndexWriter indexWriter = new IndexWriter(indexDir, iwc);
DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);
Document doc = new Document();
doc.add(new IntAssociationFacetField(3, "tags", "lucene"));
doc.add(new FloatAssociationFacetField(0.87f, "genre", "computing"));
indexWriter.addDocument(config.build(taxoWriter, doc));
doc = new Document();
doc.add(new IntAssociationFacetField(1, "tags", "lucene"));
doc.add(new IntAssociationFacetField(2, "tags", "solr"));
doc.add(new FloatAssociationFacetField(0.75f, "genre", "computing"));
doc.add(new FloatAssociationFacetField(0.34f, "genre", "software"));
indexWriter.addDocument(config.build(taxoWriter, doc));
indexWriter.close();
taxoWriter.close();
</DeepExtract>
<DeepExtract>
DirectoryReader indexReader = DirectoryReader.open(indexDir);
IndexSearcher searcher = new IndexSearcher(indexReader);
TaxonomyReader taxoReader = new DirectoryTaxonomyReader(taxoDir);
DrillDownQuery q = new DrillDownQuery(config);
q.add("tags", "solr");
FacetsCollector fc = new FacetsCollector();
FacetsCollector.search(searcher, q, 10, fc);
Facets facets = new TaxonomyFacetSumFloatAssociations("$genre", taxoReader, config, fc);
FacetResult result = facets.getTopChildren(10, "genre");
indexReader.close();
taxoReader.close();
return result;
</DeepExtract>
|
kooder
|
positive
|
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "type" + " cannot be null");
}
criteria.add(new Criterion("TYPE >=", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "type" + " cannot be null");
}
criteria.add(new Criterion("TYPE >=", value));
</DeepExtract>
|
communitycode
|
positive
|
private void setDaysOfWeekTitles() {
settingsManager.setShowDaysOfWeekTitle(settingsManager.getCalendarOrientation() != LinearLayoutManager.HORIZONTAL);
if (settingsManager.getCalendarOrientation() != LinearLayoutManager.HORIZONTAL) {
showDaysOfWeekTitle();
} else {
hideDaysOfWeekTitle();
}
settingsManager.setShowDaysOfWeek(settingsManager.getCalendarOrientation() == LinearLayoutManager.HORIZONTAL);
recreateInitialMonth();
if (llDaysOfWeekTitles == null) {
createDaysOfWeekTitle();
}
if (settingsManager.isShowDaysOfWeekTitle()) {
showDaysOfWeekTitle();
} else {
hideDaysOfWeekTitle();
}
}
|
<DeepExtract>
settingsManager.setShowDaysOfWeekTitle(settingsManager.getCalendarOrientation() != LinearLayoutManager.HORIZONTAL);
if (settingsManager.getCalendarOrientation() != LinearLayoutManager.HORIZONTAL) {
showDaysOfWeekTitle();
} else {
hideDaysOfWeekTitle();
}
</DeepExtract>
<DeepExtract>
settingsManager.setShowDaysOfWeek(settingsManager.getCalendarOrientation() == LinearLayoutManager.HORIZONTAL);
recreateInitialMonth();
</DeepExtract>
|
CosmoCalendar
|
positive
|
@Test
public void test() throws Exception {
ReadExcel readExcel = new ReadExcel();
File file = ResourceUtils.getFile("D:/javatest/test2.xls");
List listProduct = readExcel.readExcel(file);
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://" + "192.168.100.91:3306/youhuigou", "root", "1367356");
con.setAutoCommit(false);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss:SS");
TimeZone t = sdf.getTimeZone();
t.setRawOffset(0);
sdf.setTimeZone(t);
Long startTime = System.currentTimeMillis();
PreparedStatement pst = (PreparedStatement) con.prepareStatement("insert into product values (0,?,?,?,?,?,?,?,?,?,?,?,?)");
Iterator<Product> iterator = listProduct.iterator();
while (iterator.hasNext()) {
Product product = iterator.next();
pst.setString(1, product.getId());
pst.setString(2, product.getName());
pst.setString(3, product.getImage());
pst.setString(4, product.getCategory());
pst.setString(5, product.getPrice());
pst.setString(6, product.getSale());
pst.setString(7, product.getPlatform());
pst.setString(8, product.getDisSum());
pst.setString(9, product.getDisSize());
pst.setString(10, product.getStartTime());
pst.setString(11, product.getEndTime());
pst.setString(12, product.getDisherf());
pst.addBatch();
}
pst.executeBatch();
con.commit();
Long endTime = System.currentTimeMillis();
System.out.println("用时:" + sdf.format(new Date(endTime - startTime)));
pst.close();
con.close();
}
|
<DeepExtract>
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://" + "192.168.100.91:3306/youhuigou", "root", "1367356");
con.setAutoCommit(false);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss:SS");
TimeZone t = sdf.getTimeZone();
t.setRawOffset(0);
sdf.setTimeZone(t);
Long startTime = System.currentTimeMillis();
PreparedStatement pst = (PreparedStatement) con.prepareStatement("insert into product values (0,?,?,?,?,?,?,?,?,?,?,?,?)");
Iterator<Product> iterator = listProduct.iterator();
while (iterator.hasNext()) {
Product product = iterator.next();
pst.setString(1, product.getId());
pst.setString(2, product.getName());
pst.setString(3, product.getImage());
pst.setString(4, product.getCategory());
pst.setString(5, product.getPrice());
pst.setString(6, product.getSale());
pst.setString(7, product.getPlatform());
pst.setString(8, product.getDisSum());
pst.setString(9, product.getDisSize());
pst.setString(10, product.getStartTime());
pst.setString(11, product.getEndTime());
pst.setString(12, product.getDisherf());
pst.addBatch();
}
pst.executeBatch();
con.commit();
Long endTime = System.currentTimeMillis();
System.out.println("用时:" + sdf.format(new Date(endTime - startTime)));
pst.close();
con.close();
</DeepExtract>
|
youhuigou123
|
positive
|
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
try {
register = Register.getInstance();
} catch (NoDaoSetException e) {
e.printStackTrace();
}
View view = inflater.inflate(R.layout.layout_sale, container, false);
res = getResources();
saleListView = (ListView) view.findViewById(R.id.sale_List);
totalPrice = (TextView) view.findViewById(R.id.totalPrice);
clearButton = (Button) view.findViewById(R.id.clearButton);
endButton = (Button) view.findViewById(R.id.endButton);
saleListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
showEditPopup(arg1, arg2);
}
});
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ViewPager viewPager = ((MainActivity) getActivity()).getViewPager();
viewPager.setCurrentItem(1);
}
});
endButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (register.hasSale()) {
showPopup(v);
} else {
Toast.makeText(getActivity().getBaseContext(), res.getString(R.string.hint_empty_sale), Toast.LENGTH_SHORT).show();
}
}
});
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!register.hasSale() || register.getCurrentSale().getAllLineItem().isEmpty()) {
Toast.makeText(getActivity().getBaseContext(), res.getString(R.string.hint_empty_sale), Toast.LENGTH_SHORT).show();
} else {
showConfirmClearDialog();
}
}
});
return view;
}
|
<DeepExtract>
saleListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
showEditPopup(arg1, arg2);
}
});
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ViewPager viewPager = ((MainActivity) getActivity()).getViewPager();
viewPager.setCurrentItem(1);
}
});
endButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (register.hasSale()) {
showPopup(v);
} else {
Toast.makeText(getActivity().getBaseContext(), res.getString(R.string.hint_empty_sale), Toast.LENGTH_SHORT).show();
}
}
});
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!register.hasSale() || register.getCurrentSale().getAllLineItem().isEmpty()) {
Toast.makeText(getActivity().getBaseContext(), res.getString(R.string.hint_empty_sale), Toast.LENGTH_SHORT).show();
} else {
showConfirmClearDialog();
}
}
});
</DeepExtract>
|
pos
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.