method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public void setJustification(justifyTypes justify) {
if (justify == justifyTypes.BEGIN) mTextView.setGravity(Gravity.LEFT);
else if (justify == justifyTypes.MIDDLE) mTextView.setGravity(Gravity.CENTER);
else if (justify == justifyTypes.END) mTextView.setGravity(Gravity.RIGHT);
else if (justify == justifyTypes.FIRST) mTextView.setGravity(Gravity.START);
else mTextView.setGravity(Gravity.NO_GRAVITY);
} | void function(justifyTypes justify) { if (justify == justifyTypes.BEGIN) mTextView.setGravity(Gravity.LEFT); else if (justify == justifyTypes.MIDDLE) mTextView.setGravity(Gravity.CENTER); else if (justify == justifyTypes.END) mTextView.setGravity(Gravity.RIGHT); else if (justify == justifyTypes.FIRST) mTextView.setGravity(Gravity.START); else mTextView.setGravity(Gravity.NO_GRAVITY); } | /**
* set the justification to left, center/middle or right. The values from
* the enumerated type are from X3D's <FontStyle> justify setting.
* @param justify
*/ | set the justification to left, center/middle or right. The values from the enumerated type are from X3D's justify setting | setJustification | {
"repo_name": "NolaDonato/GearVRf",
"path": "GVRf/Framework/framework/src/main/java/org/gearvrf/scene_objects/GVRTextViewSceneObject.java",
"license": "apache-2.0",
"size": 24503
} | [
"android.view.Gravity"
] | import android.view.Gravity; | import android.view.*; | [
"android.view"
] | android.view; | 224,443 |
void removeKeys(String tableSegmentName, int keyCount, boolean conditional, Duration elapsed); | void removeKeys(String tableSegmentName, int keyCount, boolean conditional, Duration elapsed); | /**
* Notifies a set of Keys has been removed.
*
* @param tableSegmentName Table Segment Name.
* @param keyCount Number of keys removed.
* @param conditional Whether the removal is conditional.
* @param elapsed Elapsed time.
*/ | Notifies a set of Keys has been removed | removeKeys | {
"repo_name": "pravega/pravega",
"path": "segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/stat/TableSegmentStatsRecorder.java",
"license": "apache-2.0",
"size": 4699
} | [
"java.time.Duration"
] | import java.time.Duration; | import java.time.*; | [
"java.time"
] | java.time; | 2,734,024 |
public ResourceGroupInner withProperties(ResourceGroupProperties properties) {
this.properties = properties;
return this;
} | ResourceGroupInner function(ResourceGroupProperties properties) { this.properties = properties; return this; } | /**
* Set the properties value.
*
* @param properties the properties value to set
* @return the ResourceGroupInner object itself.
*/ | Set the properties value | withProperties | {
"repo_name": "pomortaz/azure-sdk-for-java",
"path": "azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ResourceGroupInner.java",
"license": "mit",
"size": 3619
} | [
"com.microsoft.azure.management.resources.ResourceGroupProperties"
] | import com.microsoft.azure.management.resources.ResourceGroupProperties; | import com.microsoft.azure.management.resources.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 1,284,080 |
int loadFSEdits(StorageDirectory sd) throws IOException {
int numEdits = 0;
EditLogFileInputStream edits = new EditLogFileInputStream(getImageFile(sd, NameNodeFile.EDITS));
numEdits = FSEditLog.loadFSEdits(edits);
edits.close();
File editsNew = getImageFile(sd, NameNodeFile.EDITS_NEW);
if (editsNew.exists() && editsNew.length() > 0) {
edits = new EditLogFileInputStream(editsNew);
numEdits += FSEditLog.loadFSEdits(edits);
edits.close();
}
// update the counts.
FSNamesystem.getFSNamesystem().dir.updateCountForINodeWithQuota();
return numEdits;
} | int loadFSEdits(StorageDirectory sd) throws IOException { int numEdits = 0; EditLogFileInputStream edits = new EditLogFileInputStream(getImageFile(sd, NameNodeFile.EDITS)); numEdits = FSEditLog.loadFSEdits(edits); edits.close(); File editsNew = getImageFile(sd, NameNodeFile.EDITS_NEW); if (editsNew.exists() && editsNew.length() > 0) { edits = new EditLogFileInputStream(editsNew); numEdits += FSEditLog.loadFSEdits(edits); edits.close(); } FSNamesystem.getFSNamesystem().dir.updateCountForINodeWithQuota(); return numEdits; } | /**
* Load and merge edits from two edits files
*
* @param sd
* storage directory
* @return number of edits loaded
* @throws IOException
*/ | Load and merge edits from two edits files | loadFSEdits | {
"repo_name": "dongpf/hadoop-0.19.1",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java",
"license": "apache-2.0",
"size": 59930
} | [
"java.io.File",
"java.io.IOException",
"org.apache.hadoop.hdfs.server.namenode.FSEditLog"
] | import java.io.File; import java.io.IOException; import org.apache.hadoop.hdfs.server.namenode.FSEditLog; | import java.io.*; import org.apache.hadoop.hdfs.server.namenode.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 557,606 |
@Override public void exitActionParams(@NotNull final PDDL31Parser.ActionParamsContext ctx) {
for (Variable variable: getVariables()) {
actionBuilder.parameter(variable);
}
} | @Override void function(@NotNull final PDDL31Parser.ActionParamsContext ctx) { for (Variable variable: getVariables()) { actionBuilder.parameter(variable); } } | /**
* Collect the action's parameters and add them to the action builder.
* @param ctx the rule context.
*/ | Collect the action's parameters and add them to the action builder | exitActionParams | {
"repo_name": "gerryai/pddl-parser",
"path": "src/main/java/org/gerryai/planning/parser/pddl/internal/ExtractDomainListener.java",
"license": "gpl-3.0",
"size": 7908
} | [
"org.antlr.v4.runtime.misc.NotNull",
"org.gerryai.planning.model.logic.Variable",
"org.gerryai.planning.parser.pddl.antlr.PDDL31Parser"
] | import org.antlr.v4.runtime.misc.NotNull; import org.gerryai.planning.model.logic.Variable; import org.gerryai.planning.parser.pddl.antlr.PDDL31Parser; | import org.antlr.v4.runtime.misc.*; import org.gerryai.planning.model.logic.*; import org.gerryai.planning.parser.pddl.antlr.*; | [
"org.antlr.v4",
"org.gerryai.planning"
] | org.antlr.v4; org.gerryai.planning; | 35,148 |
public static void main(final String[] args) throws Exception {
System.exit(ToolRunner.run(new WeightedPageRankBenchmark(), args));
} | static void function(final String[] args) throws Exception { System.exit(ToolRunner.run(new WeightedPageRankBenchmark(), args)); } | /**
* Execute the benchmark.
*
* @param args Typically the command line arguments.
* @throws Exception Any exception from the computation.
*/ | Execute the benchmark | main | {
"repo_name": "basio/graph",
"path": "giraph-core/src/main/java/org/apache/giraph/benchmark/WeightedPageRankBenchmark.java",
"license": "apache-2.0",
"size": 6644
} | [
"org.apache.hadoop.util.ToolRunner"
] | import org.apache.hadoop.util.ToolRunner; | import org.apache.hadoop.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 316,738 |
@Test
public void testShortcuts() throws Exception
{
for (Platform platform : Platforms.PLATFORMS)
{
if (platform.isA(Platform.Name.UNIX))
{
checkCreate(Shortcut.class, platform, Unix_Shortcut.class);
}
else if (platform.isA(Platform.Name.WINDOWS))
{
checkCreate(Shortcut.class, platform, Win_Shortcut.class);
}
}
} | void function() throws Exception { for (Platform platform : Platforms.PLATFORMS) { if (platform.isA(Platform.Name.UNIX)) { checkCreate(Shortcut.class, platform, Unix_Shortcut.class); } else if (platform.isA(Platform.Name.WINDOWS)) { checkCreate(Shortcut.class, platform, Win_Shortcut.class); } } } | /**
* Verifies that the correct {@link Shortcut} is created for a platform.
* <p/>
* Currently:
* <ul>
* <li>{@link Unix_Shortcut} is created for all Unix platforms.</li>
* <li>{@link Win_Shortcut} is created for all Windows platforms</li>
* <li>{@link Shortcut} is created for all other platforms</li>
* </ul>
*
* @throws Exception for any error
*/ | Verifies that the correct <code>Shortcut</code> is created for a platform. Currently: <code>Unix_Shortcut</code> is created for all Unix platforms. <code>Win_Shortcut</code> is created for all Windows platforms <code>Shortcut</code> is created for all other platforms | testShortcuts | {
"repo_name": "Murdock01/izpack",
"path": "izpack-installer/src/test/java/com/izforge/izpack/util/InstallerTargetPlatformFactoryTest.java",
"license": "apache-2.0",
"size": 5275
} | [
"com.izforge.izpack.util.os.Shortcut"
] | import com.izforge.izpack.util.os.Shortcut; | import com.izforge.izpack.util.os.*; | [
"com.izforge.izpack"
] | com.izforge.izpack; | 1,905,408 |
public Collection<OriginEntryGroup> getOlderGroups(Date day); | Collection<OriginEntryGroup> function(Date day); | /**
* Get all the groups that are older than a date
*
* @param day the date groups returned should be older than
* @return a Collection of origin entry groups older than that date
*/ | Get all the groups that are older than a date | getOlderGroups | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-core/src/main/java/org/kuali/kfs/gl/dataaccess/OriginEntryGroupDao.java",
"license": "agpl-3.0",
"size": 3854
} | [
"java.sql.Date",
"java.util.Collection",
"org.kuali.kfs.gl.businessobject.OriginEntryGroup"
] | import java.sql.Date; import java.util.Collection; import org.kuali.kfs.gl.businessobject.OriginEntryGroup; | import java.sql.*; import java.util.*; import org.kuali.kfs.gl.businessobject.*; | [
"java.sql",
"java.util",
"org.kuali.kfs"
] | java.sql; java.util; org.kuali.kfs; | 2,125,308 |
private void writeInt(String key, int value) {
SharedPreferences.Editor ed = mSharedPreferences.edit();
ed.putInt(key, value);
ed.apply();
} | void function(String key, int value) { SharedPreferences.Editor ed = mSharedPreferences.edit(); ed.putInt(key, value); ed.apply(); } | /**
* Writes the given int value to the named shared preference.
*
* @param key The name of the preference to modify.
* @param value The new value for the preference.
*/ | Writes the given int value to the named shared preference | writeInt | {
"repo_name": "ds-hwang/chromium-crosswalk",
"path": "chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java",
"license": "bsd-3-clause",
"size": 14477
} | [
"android.content.SharedPreferences"
] | import android.content.SharedPreferences; | import android.content.*; | [
"android.content"
] | android.content; | 1,539,731 |
private Image getSymbol(Color color) {
// Check cache
if (symbols.containsKey(color)) {
return symbols.get(color);
}
// Define
final int WIDTH = 16;
final int HEIGHT = 16;
// "Fix" for Bug #50163
Image image = IS_LINUX ? getTransparentImage(table.getDisplay(), WIDTH, HEIGHT) :
new Image(table.getDisplay(), WIDTH, HEIGHT);
// Prepare
GC gc = new GC(image);
gc.setBackground(color);
// Render
if (!IS_LINUX) {
gc.fillRectangle(0, 0, WIDTH, HEIGHT);
} else {
gc.setAntialias(SWT.ON);
gc.fillOval(0, 0, WIDTH, HEIGHT);
gc.setAntialias(SWT.OFF);
}
// Cleanup
gc.dispose();
// Store in cache and return
symbols.put(color, image);
return image;
}
| Image function(Color color) { if (symbols.containsKey(color)) { return symbols.get(color); } final int WIDTH = 16; final int HEIGHT = 16; Image image = IS_LINUX ? getTransparentImage(table.getDisplay(), WIDTH, HEIGHT) : new Image(table.getDisplay(), WIDTH, HEIGHT); GC gc = new GC(image); gc.setBackground(color); if (!IS_LINUX) { gc.fillRectangle(0, 0, WIDTH, HEIGHT); } else { gc.setAntialias(SWT.ON); gc.fillOval(0, 0, WIDTH, HEIGHT); gc.setAntialias(SWT.OFF); } gc.dispose(); symbols.put(color, image); return image; } | /**
* Dynamically creates an image with the given color
* @param color
* @return
*/ | Dynamically creates an image with the given color | getSymbol | {
"repo_name": "arx-deidentifier/arx",
"path": "src/gui/org/deidentifier/arx/gui/view/impl/explore/ViewList.java",
"license": "apache-2.0",
"size": 14529
} | [
"org.eclipse.swt.graphics.Color",
"org.eclipse.swt.graphics.Image"
] | import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; | import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,843,416 |
public void writeRecord(byte[] record) throws IOException {
if (debug) {
System.err.println("WriteRecord: recIdx = " + currRecIdx
+ " blkIdx = " + currBlkIdx);
}
if (outStream == null) {
throw new IOException("writing to an input buffer");
}
if (record.length != recordSize) {
throw new IOException("record to write has length '"
+ record.length
+ "' which is not the record size of '"
+ recordSize + "'");
}
if (currRecIdx >= recsPerBlock) {
writeBlock();
}
System.arraycopy(record, 0, blockBuffer,
(currRecIdx * recordSize),
recordSize);
currRecIdx++;
} | void function(byte[] record) throws IOException { if (debug) { System.err.println(STR + currRecIdx + STR + currBlkIdx); } if (outStream == null) { throw new IOException(STR); } if (record.length != recordSize) { throw new IOException(STR + record.length + STR + recordSize + "'"); } if (currRecIdx >= recsPerBlock) { writeBlock(); } System.arraycopy(record, 0, blockBuffer, (currRecIdx * recordSize), recordSize); currRecIdx++; } | /**
* Write an archive record to the archive.
*
* @param record The record data to write to the archive.
* @throws IOException on error
*/ | Write an archive record to the archive | writeRecord | {
"repo_name": "chirino/activemq",
"path": "activemq-console/src/main/java/org/apache/activemq/console/command/store/tar/TarBuffer.java",
"license": "apache-2.0",
"size": 13945
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,090,245 |
public Builder addAllExpand(List<String> elements) {
if (this.expand == null) {
this.expand = new ArrayList<>();
}
this.expand.addAll(elements);
return this;
} | Builder function(List<String> elements) { if (this.expand == null) { this.expand = new ArrayList<>(); } this.expand.addAll(elements); return this; } | /**
* Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* TransferReversalUpdateParams#expand} for the field documentation.
*/ | Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See <code>TransferReversalUpdateParams#expand</code> for the field documentation | addAllExpand | {
"repo_name": "stripe/stripe-java",
"path": "src/main/java/com/stripe/param/TransferReversalUpdateParams.java",
"license": "mit",
"size": 6207
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,279,864 |
void close() throws IOException; | void close() throws IOException; | /**
* Release any resources associated with this reader
*/ | Release any resources associated with this reader | close | {
"repo_name": "TerraMobile/TerraMobile",
"path": "sldparser/src/main/geotools/data/AttributeReader.java",
"license": "apache-2.0",
"size": 2231
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,714,027 |
public int getMetaFromState(IBlockState state)
{
return ((EnumFacing)state.getValue(FACING)).getIndex() | (((Boolean)state.getValue(CONDITIONAL)).booleanValue() ? 8 : 0);
}
| int function(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex() (((Boolean)state.getValue(CONDITIONAL)).booleanValue() ? 8 : 0); } | /**
* Convert the BlockState into the correct metadata value
*/ | Convert the BlockState into the correct metadata value | getMetaFromState | {
"repo_name": "lucemans/ShapeClient-SRC",
"path": "net/minecraft/block/BlockCommandBlock.java",
"license": "mpl-2.0",
"size": 13103
} | [
"net.minecraft.block.state.IBlockState",
"net.minecraft.util.EnumFacing"
] | import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; | import net.minecraft.block.state.*; import net.minecraft.util.*; | [
"net.minecraft.block",
"net.minecraft.util"
] | net.minecraft.block; net.minecraft.util; | 2,518,981 |
private void loadSettings() {
Uri uri = Uri.parse(getResources().getString(
R.string.default_video_path));
if (mSharedPref == null) {
Xlog.w(TAG, "has no SharedPreferences, use default");
mUri = uri;
mStartTime = VideoScene.DEFAULT_START;
mEndTime = VideoScene.DEFAULT_END;
mCurrentPos = VideoScene.DEFAULT_START;
} else {
mBucketId = mSharedPref.getString(VideoScene.BUCKET_ID, null);
String uriString = mSharedPref.getString(VideoScene.WALLPAPER_URI,
uri.toString());
mUri = Uri.parse(uriString);
mStartTime = (int) mSharedPref.getLong(VideoScene.START_TIME,
VideoScene.DEFAULT_START);
mEndTime = (int) mSharedPref.getLong(VideoScene.END_TIME,
VideoScene.DEFAULT_END);
mCurrentPos = (int) mSharedPref.getLong(
VideoScene.CURRENT_POSITION, VideoScene.DEFAULT_START);
}
if (DEBUG) {
Xlog.i(TAG, String.format(
"restore from preference, bucket id %s, Uri %s, start time %d, "
+ "end time %d, paused position %d", mBucketId,
mUri, mStartTime, mEndTime, mCurrentPos));
}
if (mBucketId != null) {
mUriList = Utils.getUrisFromBucketId(this, mBucketId);
for (int index = 0; index < mUriList.size(); index++) {
if (mUriList.get(index).equals(mUri)) {
mMode = index;
break;
}
}
}
} | void function() { Uri uri = Uri.parse(getResources().getString( R.string.default_video_path)); if (mSharedPref == null) { Xlog.w(TAG, STR); mUri = uri; mStartTime = VideoScene.DEFAULT_START; mEndTime = VideoScene.DEFAULT_END; mCurrentPos = VideoScene.DEFAULT_START; } else { mBucketId = mSharedPref.getString(VideoScene.BUCKET_ID, null); String uriString = mSharedPref.getString(VideoScene.WALLPAPER_URI, uri.toString()); mUri = Uri.parse(uriString); mStartTime = (int) mSharedPref.getLong(VideoScene.START_TIME, VideoScene.DEFAULT_START); mEndTime = (int) mSharedPref.getLong(VideoScene.END_TIME, VideoScene.DEFAULT_END); mCurrentPos = (int) mSharedPref.getLong( VideoScene.CURRENT_POSITION, VideoScene.DEFAULT_START); } if (DEBUG) { Xlog.i(TAG, String.format( STR + STR, mBucketId, mUri, mStartTime, mEndTime, mCurrentPos)); } if (mBucketId != null) { mUriList = Utils.getUrisFromBucketId(this, mBucketId); for (int index = 0; index < mUriList.size(); index++) { if (mUriList.get(index).equals(mUri)) { mMode = index; break; } } } } | /**
* Get state info from shared preference. if no video URI is set then use
* the default video URI.
*/ | Get state info from shared preference. if no video URI is set then use the default video URI | loadSettings | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "mediatek/packages/wallpapers/MTKVideoLiveWallpaper/src/com/mediatek/vlw/VideoEditor.java",
"license": "gpl-2.0",
"size": 51504
} | [
"android.net.Uri",
"com.mediatek.xlog.Xlog"
] | import android.net.Uri; import com.mediatek.xlog.Xlog; | import android.net.*; import com.mediatek.xlog.*; | [
"android.net",
"com.mediatek.xlog"
] | android.net; com.mediatek.xlog; | 1,773,859 |
return new TestSuite(CategoryTickTests.class);
}
public CategoryTickTests(String name) {
super(name);
} | return new TestSuite(CategoryTickTests.class); } public CategoryTickTests(String name) { super(name); } | /**
* Returns the tests as a test suite.
*
* @return The test suite.
*/ | Returns the tests as a test suite | suite | {
"repo_name": "raedle/univis",
"path": "lib/jfreechart-1.0.1/src/org/jfree/chart/axis/junit/CategoryTickTests.java",
"license": "lgpl-2.1",
"size": 6447
} | [
"junit.framework.TestSuite"
] | import junit.framework.TestSuite; | import junit.framework.*; | [
"junit.framework"
] | junit.framework; | 261,985 |
public void sendUnauthorized(final HttpServletResponse response) {
for (final SecurityFilterProvider provider : this.providers) {
provider.sendUnauthorized(response);
}
} | void function(final HttpServletResponse response) { for (final SecurityFilterProvider provider : this.providers) { provider.sendUnauthorized(response); } } | /**
* Send authorization headers.
*
* @param response
* Http Response
*/ | Send authorization headers | sendUnauthorized | {
"repo_name": "victorbriz/waffle",
"path": "Source/JNA/waffle-jna/src/main/java/waffle/servlet/spi/SecurityFilterProviderCollection.java",
"license": "epl-1.0",
"size": 7204
} | [
"javax.servlet.http.HttpServletResponse"
] | import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 20,097 |
public static void updateWidget(Context context, AppWidgetManager manager, Song song, int state)
{
if (!sEnabled)
return;
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_d);
Bitmap cover = null;
if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) {
views.setViewVisibility(R.id.buttons, View.GONE);
views.setViewVisibility(R.id.title, View.GONE);
views.setInt(R.id.artist, "setText", R.string.no_songs);
} else if (song == null) {
views.setViewVisibility(R.id.buttons, View.VISIBLE);
views.setViewVisibility(R.id.title, View.GONE);
views.setInt(R.id.artist, "setText", R.string.app_name);
} else {
views.setViewVisibility(R.id.title, View.VISIBLE);
views.setViewVisibility(R.id.buttons, View.VISIBLE);
views.setTextViewText(R.id.title, song.title);
views.setTextViewText(R.id.artist, song.artist);
cover = song.getCover(context);
}
if (cover == null) {
views.setImageViewResource(R.id.cover, R.drawable.fallback_cover);
} else {
views.setImageViewBitmap(R.id.cover, cover);
}
boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0;
views.setImageViewResource(R.id.play_pause, playing ? R.drawable.pause : R.drawable.play);
views.setImageViewResource(R.id.end_action, SongTimeline.FINISH_ICONS[PlaybackService.finishAction(state)]);
views.setImageViewResource(R.id.shuffle, SongTimeline.SHUFFLE_ICONS[PlaybackService.shuffleMode(state)]);
Intent intent;
PendingIntent pendingIntent;
ComponentName service = new ComponentName(context, PlaybackService.class);
intent = new Intent(context, LibraryActivity.class);
intent.setAction(Intent.ACTION_MAIN);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.cover, pendingIntent);
intent = new Intent(PlaybackService.ACTION_TOGGLE_PLAYBACK).setComponent(service);
pendingIntent = PendingIntent.getService(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.play_pause, pendingIntent);
intent = new Intent(PlaybackService.ACTION_NEXT_SONG).setComponent(service);
pendingIntent = PendingIntent.getService(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.next, pendingIntent);
intent = new Intent(PlaybackService.ACTION_PREVIOUS_SONG).setComponent(service);
pendingIntent = PendingIntent.getService(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.previous, pendingIntent);
intent = new Intent(PlaybackService.ACTION_CYCLE_SHUFFLE).setComponent(service);
pendingIntent = PendingIntent.getService(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.shuffle, pendingIntent);
intent = new Intent(PlaybackService.ACTION_CYCLE_REPEAT).setComponent(service);
pendingIntent = PendingIntent.getService(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.end_action, pendingIntent);
manager.updateAppWidget(new ComponentName(context, WidgetD.class), views);
} | static void function(Context context, AppWidgetManager manager, Song song, int state) { if (!sEnabled) return; RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_d); Bitmap cover = null; if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) { views.setViewVisibility(R.id.buttons, View.GONE); views.setViewVisibility(R.id.title, View.GONE); views.setInt(R.id.artist, STR, R.string.no_songs); } else if (song == null) { views.setViewVisibility(R.id.buttons, View.VISIBLE); views.setViewVisibility(R.id.title, View.GONE); views.setInt(R.id.artist, STR, R.string.app_name); } else { views.setViewVisibility(R.id.title, View.VISIBLE); views.setViewVisibility(R.id.buttons, View.VISIBLE); views.setTextViewText(R.id.title, song.title); views.setTextViewText(R.id.artist, song.artist); cover = song.getCover(context); } if (cover == null) { views.setImageViewResource(R.id.cover, R.drawable.fallback_cover); } else { views.setImageViewBitmap(R.id.cover, cover); } boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0; views.setImageViewResource(R.id.play_pause, playing ? R.drawable.pause : R.drawable.play); views.setImageViewResource(R.id.end_action, SongTimeline.FINISH_ICONS[PlaybackService.finishAction(state)]); views.setImageViewResource(R.id.shuffle, SongTimeline.SHUFFLE_ICONS[PlaybackService.shuffleMode(state)]); Intent intent; PendingIntent pendingIntent; ComponentName service = new ComponentName(context, PlaybackService.class); intent = new Intent(context, LibraryActivity.class); intent.setAction(Intent.ACTION_MAIN); pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.cover, pendingIntent); intent = new Intent(PlaybackService.ACTION_TOGGLE_PLAYBACK).setComponent(service); pendingIntent = PendingIntent.getService(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.play_pause, pendingIntent); intent = new Intent(PlaybackService.ACTION_NEXT_SONG).setComponent(service); pendingIntent = PendingIntent.getService(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.next, pendingIntent); intent = new Intent(PlaybackService.ACTION_PREVIOUS_SONG).setComponent(service); pendingIntent = PendingIntent.getService(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.previous, pendingIntent); intent = new Intent(PlaybackService.ACTION_CYCLE_SHUFFLE).setComponent(service); pendingIntent = PendingIntent.getService(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.shuffle, pendingIntent); intent = new Intent(PlaybackService.ACTION_CYCLE_REPEAT).setComponent(service); pendingIntent = PendingIntent.getService(context, 0, intent, 0); views.setOnClickPendingIntent(R.id.end_action, pendingIntent); manager.updateAppWidget(new ComponentName(context, WidgetD.class), views); } | /**
* Populate the widgets with the given ids with the given info.
*
* @param context A Context to use.
* @param manager The AppWidgetManager that will be used to update the
* widget.
* @param song The current Song in PlaybackService.
* @param state The current PlaybackService state.
*/ | Populate the widgets with the given ids with the given info | updateWidget | {
"repo_name": "Gordon01/vanilla",
"path": "src/ch/blinkenlights/android/vanilla/WidgetD.java",
"license": "gpl-3.0",
"size": 5778
} | [
"android.app.PendingIntent",
"android.appwidget.AppWidgetManager",
"android.content.ComponentName",
"android.content.Context",
"android.content.Intent",
"android.graphics.Bitmap",
"android.view.View",
"android.widget.RemoteViews"
] | import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.view.View; import android.widget.RemoteViews; | import android.app.*; import android.appwidget.*; import android.content.*; import android.graphics.*; import android.view.*; import android.widget.*; | [
"android.app",
"android.appwidget",
"android.content",
"android.graphics",
"android.view",
"android.widget"
] | android.app; android.appwidget; android.content; android.graphics; android.view; android.widget; | 2,226,001 |
public Output<T> output() {
return output;
} | Output<T> function() { return output; } | /**
* Gets output.
* The max pooled output tensor.
* @return output.
*/ | Gets output. The max pooled output tensor | output | {
"repo_name": "tensorflow/java",
"path": "tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPool3d.java",
"license": "apache-2.0",
"size": 6941
} | [
"org.tensorflow.Output"
] | import org.tensorflow.Output; | import org.tensorflow.*; | [
"org.tensorflow"
] | org.tensorflow; | 1,578,963 |
public static Map<String, CmsXmlContentProperty> resolveMacrosForPropertyInfo(
CmsObject cms,
CmsResource resource,
Map<String, CmsXmlContentProperty> propertiesConf) throws CmsException {
if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
I_CmsXmlContentHandler contentHandler = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource);
CmsMacroResolver resolver = getMacroResolverForProperties(cms, contentHandler);
return resolveMacrosInProperties(propertiesConf, resolver);
}
return propertiesConf;
} | static Map<String, CmsXmlContentProperty> function( CmsObject cms, CmsResource resource, Map<String, CmsXmlContentProperty> propertiesConf) throws CmsException { if (CmsResourceTypeXmlContent.isXmlContent(resource)) { I_CmsXmlContentHandler contentHandler = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource); CmsMacroResolver resolver = getMacroResolverForProperties(cms, contentHandler); return resolveMacrosInProperties(propertiesConf, resolver); } return propertiesConf; } | /**
* Resolves macros in the given property information for the given resource (type) AND the current user.<p>
*
* @param cms the current CMS context
* @param resource the resource
* @param propertiesConf the property information
*
* @return the property information
*
* @throws CmsException if something goes wrong
*/ | Resolves macros in the given property information for the given resource (type) AND the current user | resolveMacrosForPropertyInfo | {
"repo_name": "it-tavis/opencms-core",
"path": "src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java",
"license": "lgpl-2.1",
"size": 34363
} | [
"java.util.Map",
"org.opencms.file.CmsObject",
"org.opencms.file.CmsResource",
"org.opencms.file.types.CmsResourceTypeXmlContent",
"org.opencms.main.CmsException",
"org.opencms.util.CmsMacroResolver",
"org.opencms.xml.CmsXmlContentDefinition"
] | import java.util.Map; import org.opencms.file.CmsObject; import org.opencms.file.CmsResource; import org.opencms.file.types.CmsResourceTypeXmlContent; import org.opencms.main.CmsException; import org.opencms.util.CmsMacroResolver; import org.opencms.xml.CmsXmlContentDefinition; | import java.util.*; import org.opencms.file.*; import org.opencms.file.types.*; import org.opencms.main.*; import org.opencms.util.*; import org.opencms.xml.*; | [
"java.util",
"org.opencms.file",
"org.opencms.main",
"org.opencms.util",
"org.opencms.xml"
] | java.util; org.opencms.file; org.opencms.main; org.opencms.util; org.opencms.xml; | 2,384,244 |
public static void addBookmarkAndShowSnackbar(EnhancedBookmarksModel bookmarkModel, Tab tab,
final SnackbarManager snackbarManager, final Activity activity) {
// TODO(ianwen): remove activity from argument list.
final BookmarkId enhancedId = bookmarkModel.addBookmark(bookmarkModel.getDefaultFolder(),
0, tab.getTitle(), tab.getUrl());
Pair<EnhancedBookmarksModel, BookmarkId> pair = Pair.create(bookmarkModel, enhancedId);
SnackbarController snackbarController = new SnackbarController() {
@Override
public void onDismissForEachType(boolean isTimeout) {} | static void function(EnhancedBookmarksModel bookmarkModel, Tab tab, final SnackbarManager snackbarManager, final Activity activity) { final BookmarkId enhancedId = bookmarkModel.addBookmark(bookmarkModel.getDefaultFolder(), 0, tab.getTitle(), tab.getUrl()); Pair<EnhancedBookmarksModel, BookmarkId> pair = Pair.create(bookmarkModel, enhancedId); SnackbarController snackbarController = new SnackbarController() { public void onDismissForEachType(boolean isTimeout) {} | /**
* Static method used for activities to show snackbar that notifies user that the bookmark has
* been added successfully. Note this method also starts fetching salient image in background.
*/ | Static method used for activities to show snackbar that notifies user that the bookmark has been added successfully. Note this method also starts fetching salient image in background | addBookmarkAndShowSnackbar | {
"repo_name": "SaschaMester/delicium",
"path": "chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUtils.java",
"license": "bsd-3-clause",
"size": 7990
} | [
"android.app.Activity",
"android.util.Pair",
"org.chromium.chrome.browser.Tab",
"org.chromium.chrome.browser.enhanced_bookmarks.EnhancedBookmarksModel",
"org.chromium.chrome.browser.snackbar.SnackbarManager",
"org.chromium.components.bookmarks.BookmarkId"
] | import android.app.Activity; import android.util.Pair; import org.chromium.chrome.browser.Tab; import org.chromium.chrome.browser.enhanced_bookmarks.EnhancedBookmarksModel; import org.chromium.chrome.browser.snackbar.SnackbarManager; import org.chromium.components.bookmarks.BookmarkId; | import android.app.*; import android.util.*; import org.chromium.chrome.browser.*; import org.chromium.chrome.browser.enhanced_bookmarks.*; import org.chromium.chrome.browser.snackbar.*; import org.chromium.components.bookmarks.*; | [
"android.app",
"android.util",
"org.chromium.chrome",
"org.chromium.components"
] | android.app; android.util; org.chromium.chrome; org.chromium.components; | 2,821,016 |
File getPidFile() {
return pidFile;
} | File getPidFile() { return pidFile; } | /**
* Returns the pid file.
*
* @return the pid file
*/ | Returns the pid file | getPidFile | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/process/LocalProcessLauncher.java",
"license": "apache-2.0",
"size": 5102
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,796,523 |
public void enableDashedLine(float lineLength, float spaceLength, float phase) {
mDashPathEffect = new DashPathEffect(new float[]{
lineLength, spaceLength
}, phase);
} | void function(float lineLength, float spaceLength, float phase) { mDashPathEffect = new DashPathEffect(new float[]{ lineLength, spaceLength }, phase); } | /**
* Enables the line to be drawn in dashed mode, e.g. like this
* "- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF.
* Keep in mind that hardware acceleration boosts performance.
*
* @param lineLength the length of the line pieces
* @param spaceLength the length of space in between the pieces
* @param phase offset, in degrees (normally, use 0)
*/ | Enables the line to be drawn in dashed mode, e.g. like this "- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF. Keep in mind that hardware acceleration boosts performance | enableDashedLine | {
"repo_name": "xsingHu/xs-android-architecture",
"path": "study-view/xs-MPAndroidChartDemo/MPChartLib/src/main/java/com/github/mikephil/charting/data/LineDataSet.java",
"license": "apache-2.0",
"size": 10835
} | [
"android.graphics.DashPathEffect"
] | import android.graphics.DashPathEffect; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,433,283 |
private void addBookmark(int quickmarkNumber) {
ITextEditor editor = getActiveEditor();
if (editor != null) {
Integer key = new Integer(quickmarkNumber);
Map attributes = new HashMap();
ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
int charStart = selection.getOffset();
int charEnd = charStart;
MarkerUtilities.setCharStart(attributes, charStart);
MarkerUtilities.setCharEnd(attributes, charEnd);
IFile file = getActiveFile();
String message = MessageFormat.format(Messages.getString("SetQuickmarkAction.quickmarkMessage"), new Object[]{key}); //$NON-NLS-1$
MarkerUtilities.setMessage(attributes, message);
attributes.put(QuickmarksPlugin.NUMBER, key);
attributes.put(QuickmarksPlugin.FILE, file);
boolean OK = true;
Map markers = getMarkers();
if (markers.containsKey(key)) {
IMarker marker = (IMarker) markers.get(key);
try {
Integer markerCharStart = (Integer) marker.getAttribute(IMarker.CHAR_START);
Integer markerCharEnd = (Integer) marker.getAttribute(IMarker.CHAR_END);
if (markerCharStart != null && markerCharStart.intValue() == charStart && markerCharEnd != null && markerCharEnd.intValue() == charEnd) {
OK = false;
}
marker.delete();
} catch (CoreException e) {
QuickmarksPlugin.debug(e);
}
}
if (OK) {
try {
MarkerUtilities.createMarker(file, attributes, getMarkerType());
} catch (Exception e) {
QuickmarksPlugin.log(e);
}
}
}
} | void function(int quickmarkNumber) { ITextEditor editor = getActiveEditor(); if (editor != null) { Integer key = new Integer(quickmarkNumber); Map attributes = new HashMap(); ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection(); int charStart = selection.getOffset(); int charEnd = charStart; MarkerUtilities.setCharStart(attributes, charStart); MarkerUtilities.setCharEnd(attributes, charEnd); IFile file = getActiveFile(); String message = MessageFormat.format(Messages.getString(STR), new Object[]{key}); MarkerUtilities.setMessage(attributes, message); attributes.put(QuickmarksPlugin.NUMBER, key); attributes.put(QuickmarksPlugin.FILE, file); boolean OK = true; Map markers = getMarkers(); if (markers.containsKey(key)) { IMarker marker = (IMarker) markers.get(key); try { Integer markerCharStart = (Integer) marker.getAttribute(IMarker.CHAR_START); Integer markerCharEnd = (Integer) marker.getAttribute(IMarker.CHAR_END); if (markerCharStart != null && markerCharStart.intValue() == charStart && markerCharEnd != null && markerCharEnd.intValue() == charEnd) { OK = false; } marker.delete(); } catch (CoreException e) { QuickmarksPlugin.debug(e); } } if (OK) { try { MarkerUtilities.createMarker(file, attributes, getMarkerType()); } catch (Exception e) { QuickmarksPlugin.log(e); } } } } | /**
* Adds a new quickmark in the active editor. If the same quickmark number
* already exists (in the workspace), the existing quickmark is replaced
* with the new (i.e. the quickmark is moved). If the same quickmark already
* exists in the same location, the quickmark is removed.
*
* @param quickmarkNumber
*/ | Adds a new quickmark in the active editor. If the same quickmark number already exists (in the workspace), the existing quickmark is replaced with the new (i.e. the quickmark is moved). If the same quickmark already exists in the same location, the quickmark is removed | addBookmark | {
"repo_name": "linnet/eclipse-tools",
"path": "dk.kamstruplinnet.quickmarks/src/dk/kamstruplinnet/quickmarks/SetQuickmarkAction.java",
"license": "epl-1.0",
"size": 3222
} | [
"java.text.MessageFormat",
"java.util.HashMap",
"java.util.Map",
"org.eclipse.core.resources.IFile",
"org.eclipse.core.resources.IMarker",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.jface.text.ITextSelection",
"org.eclipse.ui.texteditor.ITextEditor",
"org.eclipse.ui.texteditor.MarkerUtilities"
] | import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.text.ITextSelection; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.MarkerUtilities; | import java.text.*; import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.jface.text.*; import org.eclipse.ui.texteditor.*; | [
"java.text",
"java.util",
"org.eclipse.core",
"org.eclipse.jface",
"org.eclipse.ui"
] | java.text; java.util; org.eclipse.core; org.eclipse.jface; org.eclipse.ui; | 1,748,225 |
public Set allLinks() {
Set res = new HashSet();
Iterator it = fLinkSets.values().iterator();
while ( it.hasNext() ) {
MLinkSet ls = (MLinkSet) it.next();
res.addAll(ls.links());
}
return res;
} | Set function() { Set res = new HashSet(); Iterator it = fLinkSets.values().iterator(); while ( it.hasNext() ) { MLinkSet ls = (MLinkSet) it.next(); res.addAll(ls.links()); } return res; } | /**
* Returns the set of all links in this state.
*
* @return Set(MLink)
*/ | Returns the set of all links in this state | allLinks | {
"repo_name": "stormymauldin/stuff",
"path": "src/main/org/tzi/use/uml/sys/MSystemState.java",
"license": "gpl-2.0",
"size": 19446
} | [
"java.util.HashSet",
"java.util.Iterator",
"java.util.Set"
] | import java.util.HashSet; import java.util.Iterator; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,037,696 |
private Object readOrdinaryObject(boolean unshared)
throws IOException
{
if (bin.readByte() != TC_OBJECT) {
throw new InternalError();
}
ObjectStreamClass desc = readClassDesc(false);
desc.checkDeserialize();
Class<?> cl = desc.forClass();
if (cl == String.class || cl == Class.class
|| cl == ObjectStreamClass.class) {
throw new InvalidClassException("invalid class descriptor");
}
Object obj;
try {
obj = desc.isInstantiable() ? desc.newInstance() : null;
} catch (Exception ex) {
throw (IOException) new InvalidClassException(
desc.forClass().getName(),
"unable to create instance").initCause(ex);
}
passHandle = handles.assign(unshared ? unsharedMarker : obj);
ClassNotFoundException resolveEx = desc.getResolveException();
if (resolveEx != null) {
handles.markException(passHandle, resolveEx);
}
if (desc.isExternalizable()) {
readExternalData((Externalizable) obj, desc);
} else {
readSerialData(obj, desc);
}
handles.finish(passHandle);
if (obj != null &&
handles.lookupException(passHandle) == null &&
desc.hasReadResolveMethod())
{
Object rep = desc.invokeReadResolve(obj);
if (unshared && rep.getClass().isArray()) {
rep = cloneArray(rep);
}
if (rep != obj) {
// Filter the replacement object
if (rep != null) {
if (rep.getClass().isArray()) {
filterCheck(rep.getClass(), Array.getLength(rep));
} else {
filterCheck(rep.getClass(), -1);
}
}
handles.setObject(passHandle, obj = rep);
}
}
return obj;
} | Object function(boolean unshared) throws IOException { if (bin.readByte() != TC_OBJECT) { throw new InternalError(); } ObjectStreamClass desc = readClassDesc(false); desc.checkDeserialize(); Class<?> cl = desc.forClass(); if (cl == String.class cl == Class.class cl == ObjectStreamClass.class) { throw new InvalidClassException(STR); } Object obj; try { obj = desc.isInstantiable() ? desc.newInstance() : null; } catch (Exception ex) { throw (IOException) new InvalidClassException( desc.forClass().getName(), STR).initCause(ex); } passHandle = handles.assign(unshared ? unsharedMarker : obj); ClassNotFoundException resolveEx = desc.getResolveException(); if (resolveEx != null) { handles.markException(passHandle, resolveEx); } if (desc.isExternalizable()) { readExternalData((Externalizable) obj, desc); } else { readSerialData(obj, desc); } handles.finish(passHandle); if (obj != null && handles.lookupException(passHandle) == null && desc.hasReadResolveMethod()) { Object rep = desc.invokeReadResolve(obj); if (unshared && rep.getClass().isArray()) { rep = cloneArray(rep); } if (rep != obj) { if (rep != null) { if (rep.getClass().isArray()) { filterCheck(rep.getClass(), Array.getLength(rep)); } else { filterCheck(rep.getClass(), -1); } } handles.setObject(passHandle, obj = rep); } } return obj; } | /**
* Reads and returns "ordinary" (i.e., not a String, Class,
* ObjectStreamClass, array, or enum constant) object, or null if object's
* class is unresolvable (in which case a ClassNotFoundException will be
* associated with object's handle). Sets passHandle to object's assigned
* handle.
*/ | Reads and returns "ordinary" (i.e., not a String, Class, ObjectStreamClass, array, or enum constant) object, or null if object's class is unresolvable (in which case a ClassNotFoundException will be associated with object's handle). Sets passHandle to object's assigned handle | readOrdinaryObject | {
"repo_name": "dmlloyd/openjdk-modules",
"path": "jdk/src/java.base/share/classes/java/io/ObjectInputStream.java",
"license": "gpl-2.0",
"size": 156139
} | [
"java.lang.reflect.Array"
] | import java.lang.reflect.Array; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,059,258 |
public static StAXBuilder getSOAPBuilder(InputStream inStream) throws XMLStreamException {
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream);
try {
return new StAXSOAPModelBuilder(xmlReader);
} catch (OMException e) {
log.info("OMException in getSOAPBuilder", e);
try {
log.info("Remaining input stream :[" +
new String(IOUtils.getStreamAsByteArray(inStream) , "UTF-8") + "]");
} catch (IOException e1) {
// Nothing here?
}
throw e;
}
} | static StAXBuilder function(InputStream inStream) throws XMLStreamException { XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream); try { return new StAXSOAPModelBuilder(xmlReader); } catch (OMException e) { log.info(STR, e); try { log.info(STR + new String(IOUtils.getStreamAsByteArray(inStream) , "UTF-8") + "]"); } catch (IOException e1) { } throw e; } } | /**
* Creates an OMBuilder for a SOAP message. Default character set encording is used.
*
* @param inStream InputStream for a SOAP message
* @return Handler to a OMBuilder implementation instance
* @throws javax.xml.stream.XMLStreamException
*/ | Creates an OMBuilder for a SOAP message. Default character set encording is used | getSOAPBuilder | {
"repo_name": "hasithajayasundara/carbon-gateway-framework",
"path": "message-readers/xml-message-reader/components/org.wso2.ballerina.message.readers.xmlreader/src/main/java/org/wso2/carbon/gateway/message/readers/xmlreader/XMLUtil.java",
"license": "apache-2.0",
"size": 13144
} | [
"java.io.IOException",
"java.io.InputStream",
"javax.xml.stream.XMLStreamException",
"javax.xml.stream.XMLStreamReader",
"org.apache.axiom.attachments.utils.IOUtils",
"org.apache.axiom.om.OMException",
"org.apache.axiom.om.impl.builder.StAXBuilder",
"org.apache.axiom.om.util.StAXUtils",
"org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder"
] | import java.io.IOException; import java.io.InputStream; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.axiom.attachments.utils.IOUtils; import org.apache.axiom.om.OMException; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.util.StAXUtils; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; | import java.io.*; import javax.xml.stream.*; import org.apache.axiom.attachments.utils.*; import org.apache.axiom.om.*; import org.apache.axiom.om.impl.builder.*; import org.apache.axiom.om.util.*; import org.apache.axiom.soap.impl.builder.*; | [
"java.io",
"javax.xml",
"org.apache.axiom"
] | java.io; javax.xml; org.apache.axiom; | 1,579,134 |
void reinitializeDevice(Address from, ReinitializedStateOfDevice reinitializedStateOfDevice); | void reinitializeDevice(Address from, ReinitializedStateOfDevice reinitializedStateOfDevice); | /**
* Notification that the device should be reinitialized. The local device's password has already been validated at
* this point, the the indicated action should be carried out.
*
* @param from
* @param reinitializedStateOfDevice
*/ | Notification that the device should be reinitialized. The local device's password has already been validated at this point, the the indicated action should be carried out | reinitializeDevice | {
"repo_name": "mlohbihler/BACnet4J",
"path": "src/main/java/com/serotonin/bacnet4j/event/DeviceEventListener.java",
"license": "gpl-3.0",
"size": 7351
} | [
"com.serotonin.bacnet4j.service.confirmed.ReinitializeDeviceRequest",
"com.serotonin.bacnet4j.type.constructed.Address"
] | import com.serotonin.bacnet4j.service.confirmed.ReinitializeDeviceRequest; import com.serotonin.bacnet4j.type.constructed.Address; | import com.serotonin.bacnet4j.service.confirmed.*; import com.serotonin.bacnet4j.type.constructed.*; | [
"com.serotonin.bacnet4j"
] | com.serotonin.bacnet4j; | 171,647 |
// This method is always executed under exclusive lock, no other synchronization or CAS required.
while (true) {
if (curIdx >= pagesCnt)
curIdx = 0;
long ptr = flagsPtr + ((curIdx >> 3) & (~7L));
long flags = GridUnsafe.getLong(ptr);
if (((curIdx & 63) == 0) && (flags == ~0L)) {
GridUnsafe.putLong(ptr, 0L);
curIdx += 64;
continue;
}
long mask = ~0L << curIdx;
int bitIdx = Long.numberOfTrailingZeros(~flags & mask);
if (bitIdx == 64) {
GridUnsafe.putLong(ptr, flags & ~mask);
curIdx = (curIdx & ~63) + 64;
}
else {
mask &= ~(~0L << bitIdx);
GridUnsafe.putLong(ptr, flags & ~mask);
curIdx = (curIdx & ~63) + bitIdx + 1;
if (curIdx <= pagesCnt)
return curIdx - 1;
}
}
} | while (true) { if (curIdx >= pagesCnt) curIdx = 0; long ptr = flagsPtr + ((curIdx >> 3) & (~7L)); long flags = GridUnsafe.getLong(ptr); if (((curIdx & 63) == 0) && (flags == ~0L)) { GridUnsafe.putLong(ptr, 0L); curIdx += 64; continue; } long mask = ~0L << curIdx; int bitIdx = Long.numberOfTrailingZeros(~flags & mask); if (bitIdx == 64) { GridUnsafe.putLong(ptr, flags & ~mask); curIdx = (curIdx & ~63) + 64; } else { mask &= ~(~0L << bitIdx); GridUnsafe.putLong(ptr, flags & ~mask); curIdx = (curIdx & ~63) + bitIdx + 1; if (curIdx <= pagesCnt) return curIdx - 1; } } } | /**
* Find page to replace.
*
* @return Page index to replace.
*/ | Find page to replace | poll | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/ClockPageReplacementFlags.java",
"license": "apache-2.0",
"size": 4364
} | [
"org.apache.ignite.internal.util.GridUnsafe"
] | import org.apache.ignite.internal.util.GridUnsafe; | import org.apache.ignite.internal.util.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,784,697 |
public void updateSymbol(RasterSymbolizer rasterSymbolizer); | void function(RasterSymbolizer rasterSymbolizer); | /**
* Update symbol for a raster symbolizer.
*
* @param rasterSymbolizer the raster symbolizer
*/ | Update symbol for a raster symbolizer | updateSymbol | {
"repo_name": "robward-scisys/sldeditor",
"path": "modules/application/src/main/java/com/sldeditor/ui/detail/vendor/geoserver/VendorOptionInterface.java",
"license": "gpl-3.0",
"size": 4254
} | [
"org.geotools.styling.RasterSymbolizer"
] | import org.geotools.styling.RasterSymbolizer; | import org.geotools.styling.*; | [
"org.geotools.styling"
] | org.geotools.styling; | 71,987 |
public void setDetailsGenerator(DetailsGenerator detailsGenerator)
throws IllegalArgumentException {
if (detailsGenerator == null) {
throw new IllegalArgumentException(
"Details generator may not be null");
}
for (Integer index : visibleDetails) {
setDetailsVisible(index, false);
}
this.detailsGenerator = detailsGenerator;
// this will refresh all visible spacers
escalator.getBody().setSpacerUpdater(gridSpacerUpdater);
} | void function(DetailsGenerator detailsGenerator) throws IllegalArgumentException { if (detailsGenerator == null) { throw new IllegalArgumentException( STR); } for (Integer index : visibleDetails) { setDetailsVisible(index, false); } this.detailsGenerator = detailsGenerator; escalator.getBody().setSpacerUpdater(gridSpacerUpdater); } | /**
* Sets a new details generator for row details.
* <p>
* The currently opened row details will be re-rendered.
*
* @since 7.5.0
* @param detailsGenerator
* the details generator to set
* @throws IllegalArgumentException
* if detailsGenerator is <code>null</code>;
*/ | Sets a new details generator for row details. The currently opened row details will be re-rendered | setDetailsGenerator | {
"repo_name": "kironapublic/vaadin",
"path": "client/src/main/java/com/vaadin/client/widgets/Grid.java",
"license": "apache-2.0",
"size": 330612
} | [
"com.vaadin.client.widget.grid.DetailsGenerator"
] | import com.vaadin.client.widget.grid.DetailsGenerator; | import com.vaadin.client.widget.grid.*; | [
"com.vaadin.client"
] | com.vaadin.client; | 839,256 |
public Set<Cover> getCovers() {
return this.covers;
}
| Set<Cover> function() { return this.covers; } | /**
* Get the covers for this theme.
*
* @return A set of covers for the theme.
*/ | Get the covers for this theme | getCovers | {
"repo_name": "caris/OSCAR-js",
"path": "oscarexchange4j/src/main/java/com/caris/oscarexchange4j/theme/Theme.java",
"license": "apache-2.0",
"size": 12254
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,588,358 |
public ServiceCall getDictionaryValidAsync(final ServiceCallback<Map<String, Map<String, String>>> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
} | ServiceCall function(final ServiceCallback<Map<String, Map<String, String>>> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException(STR); } | /**
* Get an dictionaries of dictionaries of type <string, string> with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/ | Get an dictionaries of dictionaries of type <string, string> with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}} | getDictionaryValidAsync | {
"repo_name": "John-Hart/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java",
"license": "mit",
"size": 172079
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback",
"java.util.Map"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import java.util.Map; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 2,322,942 |
@Nonnull
public Iterator<Authorizable> findAuthorizables(@Nonnull String relPath,
@Nullable String value,
@Nonnull AuthorizableType authorizableType) throws RepositoryException {
return findAuthorizables(relPath, value, authorizableType, true);
} | Iterator<Authorizable> function(@Nonnull String relPath, @Nullable String value, @Nonnull AuthorizableType authorizableType) throws RepositoryException { return findAuthorizables(relPath, value, authorizableType, true); } | /**
* Find the authorizables matching the following search parameters within
* the sub-tree defined by an authorizable tree:
*
* @param relPath A relative path (or a name) pointing to properties within
* the tree defined by a given authorizable node.
* @param value The property value to look for.
* @param authorizableType Filter the search results to only return authorizable
* trees of a given type. Passing {@link org.apache.jackrabbit.oak.spi.security.user.AuthorizableType#AUTHORIZABLE} indicates that
* no filtering for a specific authorizable type is desired. However, properties
* might still be search in the complete sub-tree of authorizables depending
* on the other query parameters.
* @return An iterator of authorizable trees that match the specified
* search parameters and filters or an empty iterator if no result can be
* found.
* @throws javax.jcr.RepositoryException If an error occurs.
*/ | Find the authorizables matching the following search parameters within the sub-tree defined by an authorizable tree: | findAuthorizables | {
"repo_name": "denismo/jackrabbit-dynamodb-store",
"path": "oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/UserQueryManager.java",
"license": "apache-2.0",
"size": 14125
} | [
"java.util.Iterator",
"javax.annotation.Nonnull",
"javax.annotation.Nullable",
"javax.jcr.RepositoryException",
"org.apache.jackrabbit.api.security.user.Authorizable",
"org.apache.jackrabbit.oak.spi.security.user.AuthorizableType"
] | import java.util.Iterator; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.jcr.RepositoryException; import org.apache.jackrabbit.api.security.user.Authorizable; import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType; | import java.util.*; import javax.annotation.*; import javax.jcr.*; import org.apache.jackrabbit.api.security.user.*; import org.apache.jackrabbit.oak.spi.security.user.*; | [
"java.util",
"javax.annotation",
"javax.jcr",
"org.apache.jackrabbit"
] | java.util; javax.annotation; javax.jcr; org.apache.jackrabbit; | 2,111,280 |
@Test(expected = NullPointerException.class)
public void testJobUpdateNull() throws P4JavaException {
jobDelegator.updateJob(null);
} | @Test(expected = NullPointerException.class) void function() throws P4JavaException { jobDelegator.updateJob(null); } | /**
* Test job update null.
*
* @throws P4JavaException the p4 java exception
*/ | Test job update null | testJobUpdateNull | {
"repo_name": "groboclown/p4ic4idea",
"path": "p4java/r19-1/src/test/java/com/perforce/p4java/impl/mapbased/server/cmd/JobDelegatorTest.java",
"license": "apache-2.0",
"size": 18238
} | [
"com.perforce.p4java.exception.P4JavaException",
"org.junit.Test"
] | import com.perforce.p4java.exception.P4JavaException; import org.junit.Test; | import com.perforce.p4java.exception.*; import org.junit.*; | [
"com.perforce.p4java",
"org.junit"
] | com.perforce.p4java; org.junit; | 193,791 |
public static File[] createVersionFile(NodeType nodeType, File[] parent,
StorageInfo version) throws IOException
{
Storage storage = null;
File[] versionFiles = new File[parent.length];
for (int i = 0; i < parent.length; i++) {
File versionFile = new File(parent[i], "VERSION");
FileUtil.fullyDelete(versionFile);
switch (nodeType) {
case NAME_NODE:
storage = new FSImage(version);
break;
case DATA_NODE:
storage = new DataStorage(version, "doNotCare");
break;
}
StorageDirectory sd = storage.new StorageDirectory(parent[i].getParentFile());
sd.write(versionFile);
versionFiles[i] = versionFile;
}
return versionFiles;
} | static File[] function(NodeType nodeType, File[] parent, StorageInfo version) throws IOException { Storage storage = null; File[] versionFiles = new File[parent.length]; for (int i = 0; i < parent.length; i++) { File versionFile = new File(parent[i], STR); FileUtil.fullyDelete(versionFile); switch (nodeType) { case NAME_NODE: storage = new FSImage(version); break; case DATA_NODE: storage = new DataStorage(version, STR); break; } StorageDirectory sd = storage.new StorageDirectory(parent[i].getParentFile()); sd.write(versionFile); versionFiles[i] = versionFile; } return versionFiles; } | /**
* Create a <code>version</code> file inside the specified parent
* directory. If such a file already exists, it will be overwritten.
* The given version string will be written to the file as the layout
* version. None of the parameters may be null.
*
* @param version
*
* @return the created version file
*/ | Create a <code>version</code> file inside the specified parent directory. If such a file already exists, it will be overwritten. The given version string will be written to the file as the layout version. None of the parameters may be null | createVersionFile | {
"repo_name": "cumulusyebl/cumulus",
"path": "src/test/hdfs/org/apache/hadoop/hdfs/UpgradeUtilities.java",
"license": "apache-2.0",
"size": 15335
} | [
"java.io.File",
"java.io.IOException",
"org.apache.hadoop.fs.FileUtil",
"org.apache.hadoop.hdfs.server.common.HdfsConstants",
"org.apache.hadoop.hdfs.server.common.Storage",
"org.apache.hadoop.hdfs.server.common.StorageInfo",
"org.apache.hadoop.hdfs.server.datanode.DataStorage",
"org.apache.hadoop.hdfs.server.namenode.FSImage"
] | import java.io.File; import java.io.IOException; import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.hdfs.server.common.HdfsConstants; import org.apache.hadoop.hdfs.server.common.Storage; import org.apache.hadoop.hdfs.server.common.StorageInfo; import org.apache.hadoop.hdfs.server.datanode.DataStorage; import org.apache.hadoop.hdfs.server.namenode.FSImage; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.server.common.*; import org.apache.hadoop.hdfs.server.datanode.*; import org.apache.hadoop.hdfs.server.namenode.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,359,355 |
public void testCallWMSServlet_ParseRequestAndData_Proxy() {
try {
DataWrapper data = this.getWrapper();
OGCRequest ogRequest = this.getOGCRequest();
ogRequest.addOrReplaceParameters(OGCConstants.PROXY_URL + "=http://localhost:8000&" + OGCConstants.SERVICE + "=" + OGCConstants.NONOGC_SERVICE_PROXY);
data.setOgcrequest(ogRequest);
this.servlet.parseRequestAndData(data, user);
fail("Function should throw a IllegalBlockSizeException exception");
} catch (IllegalBlockSizeException e) {
assertTrue(true);
} catch (Exception e) {
fail("Exception " + e.getLocalizedMessage());
}
} | void function() { try { DataWrapper data = this.getWrapper(); OGCRequest ogRequest = this.getOGCRequest(); ogRequest.addOrReplaceParameters(OGCConstants.PROXY_URL + STRFunction should throw a IllegalBlockSizeException exceptionSTRException " + e.getLocalizedMessage()); } } | /**
* Test of parseRequestAndData method, of class CallWMSServlet.
* Proxy
*/ | Test of parseRequestAndData method, of class CallWMSServlet. Proxy | testCallWMSServlet_ParseRequestAndData_Proxy | {
"repo_name": "B3Partners/kaartenbalie",
"path": "src/test/java/nl/b3p/kaartenbalie/service/servlet/CallWMSServletTest.java",
"license": "lgpl-3.0",
"size": 13050
} | [
"javax.crypto.IllegalBlockSizeException",
"nl.b3p.kaartenbalie.service.requesthandler.DataWrapper",
"nl.b3p.ogc.utils.OGCConstants",
"nl.b3p.ogc.utils.OGCRequest"
] | import javax.crypto.IllegalBlockSizeException; import nl.b3p.kaartenbalie.service.requesthandler.DataWrapper; import nl.b3p.ogc.utils.OGCConstants; import nl.b3p.ogc.utils.OGCRequest; | import javax.crypto.*; import nl.b3p.kaartenbalie.service.requesthandler.*; import nl.b3p.ogc.utils.*; | [
"javax.crypto",
"nl.b3p.kaartenbalie",
"nl.b3p.ogc"
] | javax.crypto; nl.b3p.kaartenbalie; nl.b3p.ogc; | 520,898 |
protected void pushFromClause(AST fromNode, AST inputFromNode) {
FromClause newFromClause = ( FromClause ) fromNode;
newFromClause.setParentFromClause( currentFromClause );
currentFromClause = newFromClause;
} | void function(AST fromNode, AST inputFromNode) { FromClause newFromClause = ( FromClause ) fromNode; newFromClause.setParentFromClause( currentFromClause ); currentFromClause = newFromClause; } | /**
* Sets the current 'FROM' context.
*
* @param fromNode The new 'FROM' context.
* @param inputFromNode The from node from the input AST.
*/ | Sets the current 'FROM' context | pushFromClause | {
"repo_name": "raedle/univis",
"path": "lib/hibernate-3.1.3/src/org/hibernate/hql/ast/HqlSqlWalker.java",
"license": "lgpl-2.1",
"size": 37411
} | [
"org.hibernate.hql.ast.tree.FromClause"
] | import org.hibernate.hql.ast.tree.FromClause; | import org.hibernate.hql.ast.tree.*; | [
"org.hibernate.hql"
] | org.hibernate.hql; | 2,468,473 |
private void internalDeleteAttachments(Iterable<Attachment> attachments)
throws Exception {
ServiceResponseCollection<DeleteAttachmentResponse> responses =
this.owner
.getService().deleteAttachments(attachments);
Enumeration<DeleteAttachmentResponse> enumerator = responses
.getEnumerator();
while (enumerator.hasMoreElements()) {
DeleteAttachmentResponse response = enumerator.nextElement();
// We remove all attachments that were successfully deleted from the
// change log. We should never
// receive a warning from EWS, so we ignore them.
if (response.getResult() != ServiceResult.Error) {
this.removeFromChangeLog(response.getAttachment());
}
}
// TODO : Should we throw for warnings as well?
if (responses.getOverallResult() == ServiceResult.Error) {
throw new DeleteAttachmentException(responses,
Strings.AtLeastOneAttachmentCouldNotBeDeleted);
}
} | void function(Iterable<Attachment> attachments) throws Exception { ServiceResponseCollection<DeleteAttachmentResponse> responses = this.owner .getService().deleteAttachments(attachments); Enumeration<DeleteAttachmentResponse> enumerator = responses .getEnumerator(); while (enumerator.hasMoreElements()) { DeleteAttachmentResponse response = enumerator.nextElement(); if (response.getResult() != ServiceResult.Error) { this.removeFromChangeLog(response.getAttachment()); } } if (responses.getOverallResult() == ServiceResult.Error) { throw new DeleteAttachmentException(responses, Strings.AtLeastOneAttachmentCouldNotBeDeleted); } } | /**
* Calls the DeleteAttachment web method to delete a list of attachments.
*
* @param attachments
* the attachments
* @throws Exception
* the exception
*/ | Calls the DeleteAttachment web method to delete a list of attachments | internalDeleteAttachments | {
"repo_name": "kaaaaang/ews-java-api",
"path": "src/main/java/microsoft/exchange/webservices/data/AttachmentCollection.java",
"license": "mit",
"size": 13516
} | [
"java.util.Enumeration"
] | import java.util.Enumeration; | import java.util.*; | [
"java.util"
] | java.util; | 529,612 |
public final void setQuantileListValues(final List<Double> values) {
if(values != null && !values.isEmpty())
{
List<Quantile> list = new ArrayList<Quantile>(values.size());
for (double value : values) {
list.add(new Quantile(value));
}
this.setQuantileList(list);
}
}
| final void function(final List<Double> values) { if(values != null && !values.isEmpty()) { List<Quantile> list = new ArrayList<Quantile>(values.size()); for (double value : values) { list.add(new Quantile(value)); } this.setQuantileList(list); } } | /**
* Sets the quantile list values.
*
* @param values
* the new quantile list values
*/ | Sets the quantile list values | setQuantileListValues | {
"repo_name": "SampleSizeShop/WebServiceCommon",
"path": "src/edu/ucdenver/bios/webservice/common/domain/StudyDesign.java",
"license": "gpl-2.0",
"size": 37979
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 897,655 |
GridLayout gridLayout = new GridLayout(3, false);
setLayout(gridLayout);
Label lblIcon = new Label(this, SWT.NONE);
Image logo = JFaceResources.getImageRegistry().get(SEARCH_ICON);
if (logo == null) {
Path path = new Path("rsc/icons/magnifier-left-24.png");
URL fileLocation =
FileLocator.find(FrameworkUtil.getBundle(SpotlightShell.class), path, null);
ImageDescriptor id = ImageDescriptor.createFromURL(fileLocation);
JFaceResources.getImageRegistry().put(SEARCH_ICON, id);
logo = JFaceResources.getImageRegistry().get(SEARCH_ICON);
}
lblIcon.setImage(logo);
lblIcon.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
filterComposite = new Composite(this, SWT.NO_FOCUS);
filterComposite.setLayout(new GridLayout(1, false));
filterComposite.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
filterComposite.setBackground(this.getBackground());
if (spotlightContextParameters != null) {
if (spotlightContextParameters
.containsKey(ISpotlightService.CONTEXT_FILTER_PATIENT_ID)) {
Label patientFilter = new Label(filterComposite, SWT.None);
patientFilter.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
patientFilter.setImage(Images.IMG_PERSON.getImage());
patientFilter.setBackground(getDisplay().getSystemColor(SWT.COLOR_GRAY));
patientFilter.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
}
}
txtSearchInput = new Text(this, SWT.None);
txtSearchInput.setBackground(this.getBackground());
Font biggerFont;
if (JFaceResources.getFontRegistry().hasValueFor(SEARCHTEXT_FONT)) {
biggerFont = JFaceResources.getFontRegistry().get(SEARCHTEXT_FONT);
} else {
FontData[] fontData = txtSearchInput.getFont().getFontData();
fontData[0].setHeight(20);
JFaceResources.getFontRegistry().put(SEARCHTEXT_FONT, fontData);
biggerFont = JFaceResources.getFontRegistry().get(SEARCHTEXT_FONT);
}
txtSearchInput.setFont(biggerFont);
txtSearchInput.setMessage("Suchbegriff eingeben");
txtSearchInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
txtSearchInput.setTextLimit(256);
txtSearchInput.addModifyListener(change -> {
final String text = ((Text) change.widget).getText();
if (timer != null) {
timer.cancel();
}
boolean isReadyMode = StringUtils.isEmpty(text);
switchReadyResultMode(isReadyMode);
layeredComposite.layout(true, true);
| GridLayout gridLayout = new GridLayout(3, false); setLayout(gridLayout); Label lblIcon = new Label(this, SWT.NONE); Image logo = JFaceResources.getImageRegistry().get(SEARCH_ICON); if (logo == null) { Path path = new Path(STR); URL fileLocation = FileLocator.find(FrameworkUtil.getBundle(SpotlightShell.class), path, null); ImageDescriptor id = ImageDescriptor.createFromURL(fileLocation); JFaceResources.getImageRegistry().put(SEARCH_ICON, id); logo = JFaceResources.getImageRegistry().get(SEARCH_ICON); } lblIcon.setImage(logo); lblIcon.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); filterComposite = new Composite(this, SWT.NO_FOCUS); filterComposite.setLayout(new GridLayout(1, false)); filterComposite.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false)); filterComposite.setBackground(this.getBackground()); if (spotlightContextParameters != null) { if (spotlightContextParameters .containsKey(ISpotlightService.CONTEXT_FILTER_PATIENT_ID)) { Label patientFilter = new Label(filterComposite, SWT.None); patientFilter.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); patientFilter.setImage(Images.IMG_PERSON.getImage()); patientFilter.setBackground(getDisplay().getSystemColor(SWT.COLOR_GRAY)); patientFilter.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false)); } } txtSearchInput = new Text(this, SWT.None); txtSearchInput.setBackground(this.getBackground()); Font biggerFont; if (JFaceResources.getFontRegistry().hasValueFor(SEARCHTEXT_FONT)) { biggerFont = JFaceResources.getFontRegistry().get(SEARCHTEXT_FONT); } else { FontData[] fontData = txtSearchInput.getFont().getFontData(); fontData[0].setHeight(20); JFaceResources.getFontRegistry().put(SEARCHTEXT_FONT, fontData); biggerFont = JFaceResources.getFontRegistry().get(SEARCHTEXT_FONT); } txtSearchInput.setFont(biggerFont); txtSearchInput.setMessage(STR); txtSearchInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); txtSearchInput.setTextLimit(256); txtSearchInput.addModifyListener(change -> { final String text = ((Text) change.widget).getText(); if (timer != null) { timer.cancel(); } boolean isReadyMode = StringUtils.isEmpty(text); switchReadyResultMode(isReadyMode); layeredComposite.layout(true, true); | /**
* Create contents of the shell.
*
* @param spotlightService
*/ | Create contents of the shell | createContents | {
"repo_name": "elexis/elexis-3-core",
"path": "bundles/ch.elexis.core.spotlight.ui/src/ch/elexis/core/spotlight/ui/internal/SpotlightShell.java",
"license": "epl-1.0",
"size": 8904
} | [
"ch.elexis.core.spotlight.ISpotlightService",
"ch.elexis.core.ui.icons.Images",
"org.apache.commons.lang3.StringUtils",
"org.eclipse.core.runtime.FileLocator",
"org.eclipse.core.runtime.Path",
"org.eclipse.jface.resource.ImageDescriptor",
"org.eclipse.jface.resource.JFaceResources",
"org.eclipse.swt.graphics.Font",
"org.eclipse.swt.graphics.FontData",
"org.eclipse.swt.graphics.Image",
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.layout.GridLayout",
"org.eclipse.swt.widgets.Composite",
"org.eclipse.swt.widgets.Label",
"org.eclipse.swt.widgets.Text",
"org.osgi.framework.FrameworkUtil"
] | import ch.elexis.core.spotlight.ISpotlightService; import ch.elexis.core.ui.icons.Images; import org.apache.commons.lang3.StringUtils; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Path; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.osgi.framework.FrameworkUtil; | import ch.elexis.core.spotlight.*; import ch.elexis.core.ui.icons.*; import org.apache.commons.lang3.*; import org.eclipse.core.runtime.*; import org.eclipse.jface.resource.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.osgi.framework.*; | [
"ch.elexis.core",
"org.apache.commons",
"org.eclipse.core",
"org.eclipse.jface",
"org.eclipse.swt",
"org.osgi.framework"
] | ch.elexis.core; org.apache.commons; org.eclipse.core; org.eclipse.jface; org.eclipse.swt; org.osgi.framework; | 885,505 |
protected Transferable createTransferable(JComponent jcIn)
{
EzimContactTransferable ectOut = null;
if
(
jcIn instanceof JList
&& ((JList<?>) jcIn).getModel() instanceof EzimContactList
)
{
@SuppressWarnings("unchecked")
JList<EzimContact> jlstEc = (JList<EzimContact>) jcIn;
ectOut = new EzimContactTransferable
(
jlstEc.getSelectedValuesList()
);
}
return ectOut;
} | Transferable function(JComponent jcIn) { EzimContactTransferable ectOut = null; if ( jcIn instanceof JList && ((JList<?>) jcIn).getModel() instanceof EzimContactList ) { @SuppressWarnings(STR) JList<EzimContact> jlstEc = (JList<EzimContact>) jcIn; ectOut = new EzimContactTransferable ( jlstEc.getSelectedValuesList() ); } return ectOut; } | /**
* create a transferable to use as the source for a data transfer
* @param jcIn component holding the data to be transferred
*/ | create a transferable to use as the source for a data transfer | createTransferable | {
"repo_name": "ldohxc/SOEN343",
"path": "org/ezim/core/EzimContactTransferHandler.java",
"license": "gpl-3.0",
"size": 8376
} | [
"java.awt.datatransfer.Transferable",
"javax.swing.JComponent",
"javax.swing.JList",
"org.ezim.core.EzimContact",
"org.ezim.core.EzimContactList"
] | import java.awt.datatransfer.Transferable; import javax.swing.JComponent; import javax.swing.JList; import org.ezim.core.EzimContact; import org.ezim.core.EzimContactList; | import java.awt.datatransfer.*; import javax.swing.*; import org.ezim.core.*; | [
"java.awt",
"javax.swing",
"org.ezim.core"
] | java.awt; javax.swing; org.ezim.core; | 2,810,758 |
public void setParent(View parent) {
IMPL.setParent(mInfo, parent);
} | void function(View parent) { IMPL.setParent(mInfo, parent); } | /**
* Sets the parent.
* <p>
* <strong>Note:</strong> Cannot be called from an
* {@link android.accessibilityservice.AccessibilityService}. This class is
* made immutable before being delivered to an AccessibilityService.
* </p>
*
* @param parent The parent.
* @throws IllegalStateException If called from an AccessibilityService.
*/ | Sets the parent. Note: Cannot be called from an <code>android.accessibilityservice.AccessibilityService</code>. This class is made immutable before being delivered to an AccessibilityService. | setParent | {
"repo_name": "masconsult/android-recipes-app",
"path": "vendors/android-support-v7-appcompat/libs-src/android-support-v4/android/support/v4/view/accessibility/AccessibilityNodeInfoCompat.java",
"license": "apache-2.0",
"size": 66994
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 772,897 |
public Map<String, String> getSqlTypes() {
return sqlTypes;
} | Map<String, String> function() { return sqlTypes; } | /******************************
* public Getters and Setters *
******************************/ | public Getters and Setters | getSqlTypes | {
"repo_name": "cschneider/openhab",
"path": "bundles/persistence/org.openhab.persistence.jdbc/java/org/openhab/persistence/jdbc/db/JdbcBaseDAO.java",
"license": "epl-1.0",
"size": 24017
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,639,868 |
public static String getLoginTokenValue(cfSession _Session) {
String loginTokenValue = null;
cfApplicationData appData = _Session.getApplicationData();
// appData may be null
String loginStorageType = getLoginStorageType(appData);
// test for loginStorage=="session"
if (cfAPPLICATION.ALT_LOGIN_STORAGE_1.equalsIgnoreCase(loginStorageType)) {
// login token is/will-be an attribute in the session scope (which may be
// a J2EE session scope or may be the CF session scope)
cfSessionData session = (cfSessionData) _Session.getQualifiedData(variableStore.SESSION_SCOPE);
if (session != null) {
SessionLoginToken loginToken = (SessionLoginToken) session.getData(getLoginSessionAttributeName());
if (loginToken != null)
loginTokenValue = loginToken.toString();
}
}
else // the default (login token is/will-be a cookie)
{
HttpServletRequest req = _Session.REQ;
Cookie[] cookies = req.getCookies();
if (cookies != null) {
String cookieName = getLoginCookieName(appData);
for (int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i];
if (cookie.getName().equals(cookieName)) {
loginTokenValue = cookie.getValue();
break;
}
}
}
}
return loginTokenValue;
} | static String function(cfSession _Session) { String loginTokenValue = null; cfApplicationData appData = _Session.getApplicationData(); String loginStorageType = getLoginStorageType(appData); if (cfAPPLICATION.ALT_LOGIN_STORAGE_1.equalsIgnoreCase(loginStorageType)) { cfSessionData session = (cfSessionData) _Session.getQualifiedData(variableStore.SESSION_SCOPE); if (session != null) { SessionLoginToken loginToken = (SessionLoginToken) session.getData(getLoginSessionAttributeName()); if (loginToken != null) loginTokenValue = loginToken.toString(); } } else { HttpServletRequest req = _Session.REQ; Cookie[] cookies = req.getCookies(); if (cookies != null) { String cookieName = getLoginCookieName(appData); for (int i = 0; i < cookies.length; i++) { Cookie cookie = cookies[i]; if (cookie.getName().equals(cookieName)) { loginTokenValue = cookie.getValue(); break; } } } } return loginTokenValue; } | /**
* This method will search either the cookie scope or the session scope for
* the value.
*
* @param _Session
* @return The value of the login token, which will be
* <username>:<password>:<applicationToken> (base64 encoded)
* @throws cfmRunTimeException
*/ | This method will search either the cookie scope or the session scope for the value | getLoginTokenValue | {
"repo_name": "OpenBD/openbd-core",
"path": "src/com/naryx/tagfusion/cfm/tag/cfLOGIN.java",
"license": "gpl-3.0",
"size": 16009
} | [
"com.nary.security.SessionLoginToken",
"javax.servlet.http.Cookie",
"javax.servlet.http.HttpServletRequest"
] | import com.nary.security.SessionLoginToken; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; | import com.nary.security.*; import javax.servlet.http.*; | [
"com.nary.security",
"javax.servlet"
] | com.nary.security; javax.servlet; | 2,743,801 |
int process(List<File> files) throws CheckstyleException; | int process(List<File> files) throws CheckstyleException; | /**
* Processes a set of files.
* Once this is done, it is highly recommended to call for
* the destroy method to close and remove the listeners.
* @param files the list of files to be audited.
* @return the total number of errors found
* @throws CheckstyleException if error condition within Checkstyle occurs
* @see #destroy()
*/ | Processes a set of files. Once this is done, it is highly recommended to call for the destroy method to close and remove the listeners | process | {
"repo_name": "sharang108/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/api/RootModule.java",
"license": "lgpl-2.1",
"size": 2391
} | [
"java.io.File",
"java.util.List"
] | import java.io.File; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 224,803 |
private int loadMainDataFromFile(String dctFilePath) throws IOException {
int i, cnt, length, total = 0;
// The file only counted 6763 Chinese characters plus 5 reserved slots 3756~3760.
// The 3756th is used (as a header) to store information.
int[] buffer = new int[3];
byte[] intBuffer = new byte[4];
String tmpword;
DataInputStream dctFile = new DataInputStream(Files.newInputStream(Paths.get(dctFilePath)));
// GB2312 characters 0 - 6768
for (i = GB2312_FIRST_CHAR; i < GB2312_FIRST_CHAR + CHAR_NUM_IN_FILE; i++) {
// if (i == 5231)
// System.out.println(i);
dctFile.read(intBuffer);
// the dictionary was developed for C, and byte order must be converted to work with Java
cnt = ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN).getInt();
if (cnt <= 0) {
wordItem_charArrayTable[i] = null;
wordItem_frequencyTable[i] = null;
continue;
}
wordItem_charArrayTable[i] = new char[cnt][];
wordItem_frequencyTable[i] = new int[cnt];
total += cnt;
int j = 0;
while (j < cnt) {
// wordItemTable[i][j] = new WordItem();
dctFile.read(intBuffer);
buffer[0] = ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN)
.getInt();// frequency
dctFile.read(intBuffer);
buffer[1] = ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN)
.getInt();// length
dctFile.read(intBuffer);
buffer[2] = ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN)
.getInt();// handle
// wordItemTable[i][j].frequency = buffer[0];
wordItem_frequencyTable[i][j] = buffer[0];
length = buffer[1];
if (length > 0) {
byte[] lchBuffer = new byte[length];
dctFile.read(lchBuffer);
tmpword = new String(lchBuffer, "GB2312");
// indexTable[i].wordItems[j].word = tmpword;
// wordItemTable[i][j].charArray = tmpword.toCharArray();
wordItem_charArrayTable[i][j] = tmpword.toCharArray();
} else {
// wordItemTable[i][j].charArray = null;
wordItem_charArrayTable[i][j] = null;
}
// System.out.println(indexTable[i].wordItems[j]);
j++;
}
String str = getCCByGB2312Id(i);
setTableIndex(str.charAt(0), i);
}
dctFile.close();
return total;
} | int function(String dctFilePath) throws IOException { int i, cnt, length, total = 0; int[] buffer = new int[3]; byte[] intBuffer = new byte[4]; String tmpword; DataInputStream dctFile = new DataInputStream(Files.newInputStream(Paths.get(dctFilePath))); for (i = GB2312_FIRST_CHAR; i < GB2312_FIRST_CHAR + CHAR_NUM_IN_FILE; i++) { dctFile.read(intBuffer); cnt = ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN).getInt(); if (cnt <= 0) { wordItem_charArrayTable[i] = null; wordItem_frequencyTable[i] = null; continue; } wordItem_charArrayTable[i] = new char[cnt][]; wordItem_frequencyTable[i] = new int[cnt]; total += cnt; int j = 0; while (j < cnt) { dctFile.read(intBuffer); buffer[0] = ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN) .getInt(); dctFile.read(intBuffer); buffer[1] = ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN) .getInt(); dctFile.read(intBuffer); buffer[2] = ByteBuffer.wrap(intBuffer).order(ByteOrder.LITTLE_ENDIAN) .getInt(); wordItem_frequencyTable[i][j] = buffer[0]; length = buffer[1]; if (length > 0) { byte[] lchBuffer = new byte[length]; dctFile.read(lchBuffer); tmpword = new String(lchBuffer, STR); wordItem_charArrayTable[i][j] = tmpword.toCharArray(); } else { wordItem_charArrayTable[i][j] = null; } j++; } String str = getCCByGB2312Id(i); setTableIndex(str.charAt(0), i); } dctFile.close(); return total; } | /**
* Load the datafile into this WordDictionary
*
* @param dctFilePath path to word dictionary (coredict.dct)
* @return number of words read
* @throws IOException If there is a low-level I/O error.
*/ | Load the datafile into this WordDictionary | loadMainDataFromFile | {
"repo_name": "yida-lxw/solr-5.3.1",
"path": "lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/hhmm/WordDictionary.java",
"license": "apache-2.0",
"size": 18324
} | [
"java.io.DataInputStream",
"java.io.IOException",
"java.nio.ByteBuffer",
"java.nio.ByteOrder",
"java.nio.file.Files",
"java.nio.file.Paths"
] | import java.io.DataInputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.file.Files; import java.nio.file.Paths; | import java.io.*; import java.nio.*; import java.nio.file.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,296,416 |
public static String getCommitEncoding(final Project project, VirtualFile root) {
@NonNls String encoding = null;
try {
encoding = getValue(project, root, "i18n.commitencoding");
}
catch (VcsException e) {
// ignore exception
}
if (encoding == null || encoding.length() == 0) {
encoding = CharsetToolkit.UTF8;
}
return encoding;
} | static String function(final Project project, VirtualFile root) { @NonNls String encoding = null; try { encoding = getValue(project, root, STR); } catch (VcsException e) { } if (encoding == null encoding.length() == 0) { encoding = CharsetToolkit.UTF8; } return encoding; } | /**
* Get commit encoding for the specified root
*
* @param project the context project
* @param root the project root
* @return the commit encoding or UTF-8 if the encoding is note explicitly specified
*/ | Get commit encoding for the specified root | getCommitEncoding | {
"repo_name": "jk1/intellij-community",
"path": "plugins/git4idea/src/git4idea/config/GitConfigUtil.java",
"license": "apache-2.0",
"size": 6287
} | [
"com.intellij.openapi.project.Project",
"com.intellij.openapi.vcs.VcsException",
"com.intellij.openapi.vfs.CharsetToolkit",
"com.intellij.openapi.vfs.VirtualFile",
"org.jetbrains.annotations.NonNls"
] | import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NonNls; | import com.intellij.openapi.project.*; import com.intellij.openapi.vcs.*; import com.intellij.openapi.vfs.*; import org.jetbrains.annotations.*; | [
"com.intellij.openapi",
"org.jetbrains.annotations"
] | com.intellij.openapi; org.jetbrains.annotations; | 2,630,158 |
public void startExecuting()
{
this.taskOwner.setAttackTarget(this.theTarget);
EntityLivingBase var1 = this.theEntityTameable.getOwner();
if (var1 != null)
{
this.field_142050_e = var1.getLastAttackerTime();
}
super.startExecuting();
} | void function() { this.taskOwner.setAttackTarget(this.theTarget); EntityLivingBase var1 = this.theEntityTameable.getOwner(); if (var1 != null) { this.field_142050_e = var1.getLastAttackerTime(); } super.startExecuting(); } | /**
* Execute a one shot task or start executing a continuous task
*/ | Execute a one shot task or start executing a continuous task | startExecuting | {
"repo_name": "TheHecticByte/BananaJ1.7.10Beta",
"path": "src/net/minecraft/Server1_7_10/entity/ai/EntityAIOwnerHurtTarget.java",
"license": "gpl-3.0",
"size": 1707
} | [
"net.minecraft.Server1_7_10"
] | import net.minecraft.Server1_7_10; | import net.minecraft.*; | [
"net.minecraft"
] | net.minecraft; | 872,328 |
RouteDefinition getRouteDefinition(String routeId, String camelContextName); | RouteDefinition getRouteDefinition(String routeId, String camelContextName); | /**
* Return the definition of a route identified by a ID and a Camel context.
*
* @param routeId the route ID.
* @param camelContextName the Camel context.
* @return the <code>RouteDefinition</code>.
*/ | Return the definition of a route identified by a ID and a Camel context | getRouteDefinition | {
"repo_name": "cexbrayat/camel",
"path": "platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/CamelController.java",
"license": "apache-2.0",
"size": 2762
} | [
"org.apache.camel.model.RouteDefinition"
] | import org.apache.camel.model.RouteDefinition; | import org.apache.camel.model.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,148,943 |
public Map<String, InterMineBag> orderBags(Map<String, InterMineBag> bags) {
Map<String, InterMineBag> bagsOrdered = new TreeMap<String, InterMineBag>(new ByTagOrder());
bagsOrdered.putAll(bags);
return bagsOrdered;
} | Map<String, InterMineBag> function(Map<String, InterMineBag> bags) { Map<String, InterMineBag> bagsOrdered = new TreeMap<String, InterMineBag>(new ByTagOrder()); bagsOrdered.putAll(bags); return bagsOrdered; } | /**
* Order a map of bags by im:order:n tag
* @param bags unordered
* @return an ordered Map of InterMineBags
*/ | Order a map of bags by im:order:n tag | orderBags | {
"repo_name": "elsiklab/intermine",
"path": "intermine/api/main/src/org/intermine/api/bag/BagManager.java",
"license": "lgpl-2.1",
"size": 27746
} | [
"java.util.Map",
"java.util.TreeMap",
"org.intermine.api.profile.InterMineBag"
] | import java.util.Map; import java.util.TreeMap; import org.intermine.api.profile.InterMineBag; | import java.util.*; import org.intermine.api.profile.*; | [
"java.util",
"org.intermine.api"
] | java.util; org.intermine.api; | 1,716,749 |
public void test_10_parameterMetaData() throws Exception
{
//
// Parameter meta data is not available on JSR-169 platforms,
// so skip this test in those environments.
//
if ( JDBC.vmSupportsJSR169() ) { return; }
Connection conn = getConnection();
goodStatement( conn, "create type price_10_a external name 'org.apache.derbyTesting.functionTests.tests.lang.Price' language java\n" );
goodStatement( conn, "create table t_10_a( a price_10_a )\n" );
// ANSI UDT
checkPMD
(
conn,
"insert into t_10_a( a ) values ( ? )\n",
"org.apache.derbyTesting.functionTests.tests.lang.Price",
java.sql.Types.JAVA_OBJECT,
"\"APP\".\"PRICE_10_A\"",
0,
0
);
//
// I don't know of any way to create a statement with a parameter
// whose type is an old-style object from Derby's system tables.
// If you figure out how to trick Derby into letting you do that,
// this would be a good place to assert the shape of the parameter
// meta data for that statement.
//
} | void function() throws Exception { Connection conn = getConnection(); goodStatement( conn, STR ); goodStatement( conn, STR ); checkPMD ( conn, STR, STR, java.sql.Types.JAVA_OBJECT, "\"APP\".\"PRICE_10_A\"", 0, 0 ); | /**
* <p>
* Check parameter metadata for UDT parameters.
* </p>
*/ | Check parameter metadata for UDT parameters. | test_10_parameterMetaData | {
"repo_name": "viaper/DBPlus",
"path": "DerbyHodgepodge/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java",
"license": "apache-2.0",
"size": 58737
} | [
"java.sql.Connection"
] | import java.sql.Connection; | import java.sql.*; | [
"java.sql"
] | java.sql; | 126,979 |
public final Property<Boolean> observationTimes() {
return metaBean().observationTimes().createProperty(this);
} | final Property<Boolean> function() { return metaBean().observationTimes().createProperty(this); } | /**
* Gets the the {@code observationTimes} property.
* @return the property, not null
*/ | Gets the the observationTimes property | observationTimes | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master/src/main/java/com/opengamma/master/historicaltimeseries/HistoricalTimeSeriesInfoMetaDataRequest.java",
"license": "apache-2.0",
"size": 12569
} | [
"org.joda.beans.Property"
] | import org.joda.beans.Property; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 161,147 |
@Override
public Tuple getValue() {
if (accumUnion_ != null) {
final DoublesSketch resultSketch = accumUnion_.getResultAndReset();
if (resultSketch != null) {
return tupleFactory_.newTuple(new DataByteArray(resultSketch.toByteArray(true)));
}
}
// return empty sketch
return tupleFactory_.newTuple(new DataByteArray(unionBuilder_.build().getResult().toByteArray(true)));
} | Tuple function() { if (accumUnion_ != null) { final DoublesSketch resultSketch = accumUnion_.getResultAndReset(); if (resultSketch != null) { return tupleFactory_.newTuple(new DataByteArray(resultSketch.toByteArray(true))); } } return tupleFactory_.newTuple(new DataByteArray(unionBuilder_.build().getResult().toByteArray(true))); } | /**
* Returns the result of the Union that has been built up by multiple calls to {@link #accumulate}.
*
* @return Sketch Tuple. (see {@link #exec} for return tuple format)
* @see "org.apache.pig.Accumulator.getValue()"
*/ | Returns the result of the Union that has been built up by multiple calls to <code>#accumulate</code> | getValue | {
"repo_name": "DataSketches/sketches-pig",
"path": "src/main/java/org/apache/datasketches/pig/quantiles/DataToDoublesSketch.java",
"license": "apache-2.0",
"size": 12912
} | [
"org.apache.datasketches.quantiles.DoublesSketch",
"org.apache.pig.data.DataByteArray",
"org.apache.pig.data.Tuple"
] | import org.apache.datasketches.quantiles.DoublesSketch; import org.apache.pig.data.DataByteArray; import org.apache.pig.data.Tuple; | import org.apache.datasketches.quantiles.*; import org.apache.pig.data.*; | [
"org.apache.datasketches",
"org.apache.pig"
] | org.apache.datasketches; org.apache.pig; | 1,661,624 |
static boolean usePartitionedWriteProperty(Value base, Value propName, Value valueToWrite) {
if (Options.get().isNoPropNamePartitioning() || (!(base instanceof PartitionedValue) && !(propName instanceof PartitionedValue)) || !(valueToWrite instanceof PartitionedValue))
return false;
return (propName instanceof PartitionedValue ? ((PartitionedValue) propName) : ((PartitionedValue) base)).getPartitionNodes().stream().anyMatch(pn -> ((PartitionedValue) valueToWrite).getPartitionNodes().contains(pn));
} | static boolean usePartitionedWriteProperty(Value base, Value propName, Value valueToWrite) { if (Options.get().isNoPropNamePartitioning() (!(base instanceof PartitionedValue) && !(propName instanceof PartitionedValue)) !(valueToWrite instanceof PartitionedValue)) return false; return (propName instanceof PartitionedValue ? ((PartitionedValue) propName) : ((PartitionedValue) base)).getPartitionNodes().stream().anyMatch(pn -> ((PartitionedValue) valueToWrite).getPartitionNodes().contains(pn)); } | /**
* Decides whether or not to use value partitioning at property write operation.
* Returns true if the base value or property name value as well as the value to be written are partitioned values and their partitions have non-disjoint partitioning nodes.
*/ | Decides whether or not to use value partitioning at property write operation. Returns true if the base value or property name value as well as the value to be written are partitioned values and their partitions have non-disjoint partitioning nodes | usePartitionedWriteProperty | {
"repo_name": "cs-au-dk/TAJS",
"path": "src/dk/brics/tajs/analysis/js/Partitioning.java",
"license": "apache-2.0",
"size": 39026
} | [
"dk.brics.tajs.lattice.PartitionedValue",
"dk.brics.tajs.lattice.Value",
"dk.brics.tajs.options.Options"
] | import dk.brics.tajs.lattice.PartitionedValue; import dk.brics.tajs.lattice.Value; import dk.brics.tajs.options.Options; | import dk.brics.tajs.lattice.*; import dk.brics.tajs.options.*; | [
"dk.brics.tajs"
] | dk.brics.tajs; | 1,507,473 |
EReference getObjectServiceDefinition_Object(); | EReference getObjectServiceDefinition_Object(); | /**
* Returns the meta object for the reference '{@link org.xtuml.bp.xtext.masl.masl.structure.ObjectServiceDefinition#getObject <em>Object</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Object</em>'.
* @see org.xtuml.bp.xtext.masl.masl.structure.ObjectServiceDefinition#getObject()
* @see #getObjectServiceDefinition()
* @generated
*/ | Returns the meta object for the reference '<code>org.xtuml.bp.xtext.masl.masl.structure.ObjectServiceDefinition#getObject Object</code>'. | getObjectServiceDefinition_Object | {
"repo_name": "lwriemen/bridgepoint",
"path": "src/org.xtuml.bp.xtext.masl.parent/org.xtuml.bp.xtext.masl/emf-gen/org/xtuml/bp/xtext/masl/masl/structure/StructurePackage.java",
"license": "apache-2.0",
"size": 189771
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,703,218 |
private void filterPropertiesForUpdate(Node node)
{
for (String propertyURI : VOS.READ_ONLY_PROPERTIES)
{
int propertyIndex = node.getProperties().indexOf(new NodeProperty(propertyURI, ""));
if (propertyIndex != -1)
{
node.getProperties().remove(propertyIndex);
}
}
} | void function(Node node) { for (String propertyURI : VOS.READ_ONLY_PROPERTIES) { int propertyIndex = node.getProperties().indexOf(new NodeProperty(propertyURI, "")); if (propertyIndex != -1) { node.getProperties().remove(propertyIndex); } } } | /**
* Remove any properties from the Node that cannot be updated.
* @param node
*/ | Remove any properties from the Node that cannot be updated | filterPropertiesForUpdate | {
"repo_name": "opencadc/vos",
"path": "cadc-vos-server/src/main/java/ca/nrc/cadc/vos/server/web/restlet/action/UpdatePropertiesAction.java",
"license": "agpl-3.0",
"size": 7075
} | [
"ca.nrc.cadc.vos.Node",
"ca.nrc.cadc.vos.NodeProperty"
] | import ca.nrc.cadc.vos.Node; import ca.nrc.cadc.vos.NodeProperty; | import ca.nrc.cadc.vos.*; | [
"ca.nrc.cadc"
] | ca.nrc.cadc; | 2,194,061 |
@PUT
@Path("/{versionableInode}/_bringback")
@JSONP
@NoCache
@Consumes(MediaType.APPLICATION_JSON)
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public Response bringBack(@Context final HttpServletRequest httpRequest,
@Context final HttpServletResponse httpResponse,
@PathParam("versionableInode") final String versionableInode)
throws DotDataException, DotSecurityException {
final InitDataObject initData = new WebResource.InitBuilder(this.webResource)
.requestAndResponse(httpRequest, httpResponse).rejectWhenNoUser(true)
.requiredBackendUser(true).init();
final User user = initData.getUser();
final PageMode mode = PageMode.get(httpRequest);
Logger.debug(this, () -> "Finding the version: " + versionableInode);
//Check if is an inode
final String type = Try
.of(() -> InodeUtils.getAssetTypeFromDB(versionableInode)).getOrNull();
if (null == type) {
throw new DoesNotExistException(
"The versionable with uuid: " + versionableInode + " does not exists");
}
final VersionableView versionable = this.versionableHelper
.getAssetTypeByVersionableFindVersionMap().getOrDefault(type,
this.versionableHelper.getDefaultVersionableFindVersionStrategy())
.findVersion(versionableInode, user, mode.respectAnonPerms);
if (versionable.getVersionable() instanceof Permissionable) {
this.versionableHelper.checkWritePermissions((Permissionable)versionable.getVersionable(), user);
} else {
throw new DotSecurityException(
"Can not use versionable with uuid: " + versionableInode);
}
Logger.debug(this, () -> "Restoring to the version: " + versionableInode);
final VersionableView newVersionable = this.versionableHelper
.getAssetTypeByVersionableRestoreVersionMap().getOrDefault(type,
this.versionableHelper.getDefaultVersionableRestoreVersionStrategy())
.restoreVersion(versionable.getVersionable(), user, false);
return Response.ok(new ResponseEntityView(newVersionable)).build();
} | @Path(STR) @Consumes(MediaType.APPLICATION_JSON) @Produces({MediaType.APPLICATION_JSON, STR}) Response function(@Context final HttpServletRequest httpRequest, @Context final HttpServletResponse httpResponse, @PathParam(STR) final String versionableInode) throws DotDataException, DotSecurityException { final InitDataObject initData = new WebResource.InitBuilder(this.webResource) .requestAndResponse(httpRequest, httpResponse).rejectWhenNoUser(true) .requiredBackendUser(true).init(); final User user = initData.getUser(); final PageMode mode = PageMode.get(httpRequest); Logger.debug(this, () -> STR + versionableInode); final String type = Try .of(() -> InodeUtils.getAssetTypeFromDB(versionableInode)).getOrNull(); if (null == type) { throw new DoesNotExistException( STR + versionableInode + STR); } final VersionableView versionable = this.versionableHelper .getAssetTypeByVersionableFindVersionMap().getOrDefault(type, this.versionableHelper.getDefaultVersionableFindVersionStrategy()) .findVersion(versionableInode, user, mode.respectAnonPerms); if (versionable.getVersionable() instanceof Permissionable) { this.versionableHelper.checkWritePermissions((Permissionable)versionable.getVersionable(), user); } else { throw new DotSecurityException( STR + versionableInode); } Logger.debug(this, () -> STR + versionableInode); final VersionableView newVersionable = this.versionableHelper .getAssetTypeByVersionableRestoreVersionMap().getOrDefault(type, this.versionableHelper.getDefaultVersionableRestoreVersionStrategy()) .restoreVersion(versionable.getVersionable(), user, false); return Response.ok(new ResponseEntityView(newVersionable)).build(); } | /**
* Finds the versionable for the passed inode and sets this version as a working
*
* User executing the action needs to have Edit Permissions over the element.
*
* If the UUID does not exists, 404 is returned. If exists set the version and returns it
*
* @param versionableInode {@link String} UUID of the element inode
* @return {@link VersionableView} versionable view object
*/ | Finds the versionable for the passed inode and sets this version as a working User executing the action needs to have Edit Permissions over the element. If the UUID does not exists, 404 is returned. If exists set the version and returns it | bringBack | {
"repo_name": "dotCMS/core",
"path": "dotCMS/src/main/java/com/dotcms/rest/api/v1/versionable/VersionableResource.java",
"license": "gpl-3.0",
"size": 10026
} | [
"com.dotcms.rest.InitDataObject",
"com.dotcms.rest.ResponseEntityView",
"com.dotcms.rest.WebResource",
"com.dotmarketing.business.Permissionable",
"com.dotmarketing.exception.DoesNotExistException",
"com.dotmarketing.exception.DotDataException",
"com.dotmarketing.exception.DotSecurityException",
"com.dotmarketing.util.InodeUtils",
"com.dotmarketing.util.Logger",
"com.dotmarketing.util.PageMode",
"com.liferay.portal.model.User",
"io.vavr.control.Try",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"javax.ws.rs.Consumes",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.core.Context",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response"
] | import com.dotcms.rest.InitDataObject; import com.dotcms.rest.ResponseEntityView; import com.dotcms.rest.WebResource; import com.dotmarketing.business.Permissionable; import com.dotmarketing.exception.DoesNotExistException; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; import com.dotmarketing.util.InodeUtils; import com.dotmarketing.util.Logger; import com.dotmarketing.util.PageMode; import com.liferay.portal.model.User; import io.vavr.control.Try; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; | import com.dotcms.rest.*; import com.dotmarketing.business.*; import com.dotmarketing.exception.*; import com.dotmarketing.util.*; import com.liferay.portal.model.*; import io.vavr.control.*; import javax.servlet.http.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"com.dotcms.rest",
"com.dotmarketing.business",
"com.dotmarketing.exception",
"com.dotmarketing.util",
"com.liferay.portal",
"io.vavr.control",
"javax.servlet",
"javax.ws"
] | com.dotcms.rest; com.dotmarketing.business; com.dotmarketing.exception; com.dotmarketing.util; com.liferay.portal; io.vavr.control; javax.servlet; javax.ws; | 465,808 |
private void startTimerNotification() {
// Get Emergency Callback Mode timeout value
long ecmTimeout = SystemProperties.getLong(
TelephonyProperties.PROPERTY_ECM_EXIT_TIMER, DEFAULT_ECM_EXIT_TIMER_VALUE);
// Show the notification
showNotification(ecmTimeout);
// Start countdown timer for the notification updates
if (mTimer != null) {
mTimer.cancel();
} else {
mTimer = new CountDownTimer(ecmTimeout, 1000) { | void function() { long ecmTimeout = SystemProperties.getLong( TelephonyProperties.PROPERTY_ECM_EXIT_TIMER, DEFAULT_ECM_EXIT_TIMER_VALUE); showNotification(ecmTimeout); if (mTimer != null) { mTimer.cancel(); } else { mTimer = new CountDownTimer(ecmTimeout, 1000) { | /**
* Start timer notification for Emergency Callback Mode
*/ | Start timer notification for Emergency Callback Mode | startTimerNotification | {
"repo_name": "md5555/android_packages_services_Telephony",
"path": "src/com/android/phone/EmergencyCallbackModeService.java",
"license": "apache-2.0",
"size": 9147
} | [
"android.os.CountDownTimer",
"android.os.SystemProperties",
"com.android.internal.telephony.TelephonyProperties"
] | import android.os.CountDownTimer; import android.os.SystemProperties; import com.android.internal.telephony.TelephonyProperties; | import android.os.*; import com.android.internal.telephony.*; | [
"android.os",
"com.android.internal"
] | android.os; com.android.internal; | 799,301 |
public static GetRepositoriesRequest getRepositoryRequest(String... repositories) {
return new GetRepositoriesRequest(repositories);
} | static GetRepositoriesRequest function(String... repositories) { return new GetRepositoriesRequest(repositories); } | /**
* Gets snapshot repository
*
* @param repositories names of repositories
* @return get repository request
*/ | Gets snapshot repository | getRepositoryRequest | {
"repo_name": "wayeast/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/client/Requests.java",
"license": "apache-2.0",
"size": 20980
} | [
"org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest"
] | import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest; | import org.elasticsearch.action.admin.cluster.repositories.get.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 2,456,983 |
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (this.field_143015_k < 0)
{
this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (this.field_143015_k < 0)
{
return true;
}
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 9 - 1, 0);
}
this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 7, 5, 4, 0, 0, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 8, 0, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 8, 5, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 1, 8, 6, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 7, 2, 8, 7, 3, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
int i = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3);
int j = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 2);
int k;
int l;
for (k = -1; k <= 2; ++k)
{
for (l = 0; l <= 8; ++l)
{
this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, i, l, 6 + k, k, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, j, l, 6 + k, 5 - k, par3StructureBoundingBox);
}
}
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 0, 1, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 5, 8, 1, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 1, 0, 8, 1, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 1, 0, 7, 1, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 0, 4, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 5, 0, 4, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 2, 5, 8, 4, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 2, 0, 8, 4, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 1, 0, 4, 4, Block.planks.blockID, Block.planks.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 5, 7, 4, 5, Block.planks.blockID, Block.planks.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 2, 1, 8, 4, 4, Block.planks.blockID, Block.planks.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 0, 7, 4, 0, Block.planks.blockID, Block.planks.blockID, false);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 2, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 2, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 2, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 3, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 3, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 3, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 2, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 3, 2, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 3, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 2, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 3, 2, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 3, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 2, 5, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 3, 2, 5, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 2, 5, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 2, 5, par3StructureBoundingBox);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 1, 7, 4, 1, Block.planks.blockID, Block.planks.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 4, 7, 4, 4, Block.planks.blockID, Block.planks.blockID, false);
this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 4, 7, 3, 4, Block.bookShelf.blockID, Block.bookShelf.blockID, false);
this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 7, 1, 4, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 0), 7, 1, 3, par3StructureBoundingBox);
k = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3);
this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, k, 6, 1, 4, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, k, 5, 1, 4, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, k, 4, 1, 4, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, k, 3, 1, 4, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 6, 1, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 6, 2, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 1, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 4, 2, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.workbench.blockID, 0, 7, 1, 1, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 1, 0, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 2, 0, par3StructureBoundingBox);
this.placeDoorAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 1, 1, 0, this.getMetadataWithOffset(Block.doorWood.blockID, 1));
if (this.getBlockIdAtCurrentPosition(par1World, 1, 0, -1, par3StructureBoundingBox) == 0 && this.getBlockIdAtCurrentPosition(par1World, 1, -1, -1, par3StructureBoundingBox) != 0)
{
this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 1, 0, -1, par3StructureBoundingBox);
}
for (l = 0; l < 6; ++l)
{
for (int i1 = 0; i1 < 9; ++i1)
{
this.clearCurrentPositionBlocksUpwards(par1World, i1, 9, l, par3StructureBoundingBox);
this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, i1, -1, l, par3StructureBoundingBox);
}
}
this.spawnVillagers(par1World, par3StructureBoundingBox, 2, 1, 2, 1);
return true;
} | boolean function(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (this.field_143015_k < 0) { this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); if (this.field_143015_k < 0) { return true; } this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 9 - 1, 0); } this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 7, 5, 4, 0, 0, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 8, 0, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 8, 5, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 1, 8, 6, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 7, 2, 8, 7, 3, Block.cobblestone.blockID, Block.cobblestone.blockID, false); int i = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3); int j = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 2); int k; int l; for (k = -1; k <= 2; ++k) { for (l = 0; l <= 8; ++l) { this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, i, l, 6 + k, k, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, j, l, 6 + k, 5 - k, par3StructureBoundingBox); } } this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 0, 1, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 5, 8, 1, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 1, 0, 8, 1, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 1, 0, 7, 1, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 0, 4, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 5, 0, 4, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 2, 5, 8, 4, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 2, 0, 8, 4, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 1, 0, 4, 4, Block.planks.blockID, Block.planks.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 5, 7, 4, 5, Block.planks.blockID, Block.planks.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 2, 1, 8, 4, 4, Block.planks.blockID, Block.planks.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 0, 7, 4, 0, Block.planks.blockID, Block.planks.blockID, false); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 2, 0, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 2, 0, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 2, 0, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 3, 0, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 3, 0, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 3, 0, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 3, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 3, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 3, 2, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 3, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 2, 5, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 3, 2, 5, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 2, 5, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 2, 5, par3StructureBoundingBox); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 1, 7, 4, 1, Block.planks.blockID, Block.planks.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 4, 7, 4, 4, Block.planks.blockID, Block.planks.blockID, false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 4, 7, 3, 4, Block.bookShelf.blockID, Block.bookShelf.blockID, false); this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 7, 1, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 0), 7, 1, 3, par3StructureBoundingBox); k = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3); this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, k, 6, 1, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, k, 5, 1, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, k, 4, 1, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, k, 3, 1, 4, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 6, 1, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 6, 2, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 1, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 4, 2, 3, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, Block.workbench.blockID, 0, 7, 1, 1, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 1, 0, par3StructureBoundingBox); this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 2, 0, par3StructureBoundingBox); this.placeDoorAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 1, 1, 0, this.getMetadataWithOffset(Block.doorWood.blockID, 1)); if (this.getBlockIdAtCurrentPosition(par1World, 1, 0, -1, par3StructureBoundingBox) == 0 && this.getBlockIdAtCurrentPosition(par1World, 1, -1, -1, par3StructureBoundingBox) != 0) { this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 1, 0, -1, par3StructureBoundingBox); } for (l = 0; l < 6; ++l) { for (int i1 = 0; i1 < 9; ++i1) { this.clearCurrentPositionBlocksUpwards(par1World, i1, 9, l, par3StructureBoundingBox); this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, i1, -1, l, par3StructureBoundingBox); } } this.spawnVillagers(par1World, par3StructureBoundingBox, 2, 1, 2, 1); return true; } | /**
* second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
* the end, it adds Fences...
*/ | second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences.. | addComponentParts | {
"repo_name": "HATB0T/RuneCraftery",
"path": "forge/mcp/src/minecraft/net/minecraft/world/gen/structure/ComponentVillageHouse1.java",
"license": "lgpl-3.0",
"size": 10142
} | [
"java.util.Random",
"net.minecraft.block.Block",
"net.minecraft.world.World"
] | import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; | import java.util.*; import net.minecraft.block.*; import net.minecraft.world.*; | [
"java.util",
"net.minecraft.block",
"net.minecraft.world"
] | java.util; net.minecraft.block; net.minecraft.world; | 1,621,769 |
private Object waitingGet(boolean interruptible) {
Signaller q = null;
boolean queued = false;
int spins = -1;
Object r;
while ((r = result) == null) {
if (spins < 0)
spins = (Runtime.getRuntime().availableProcessors() > 1) ?
1 << 8 : 0; // Use brief spin-wait on multiprocessors
else if (spins > 0) {
if (ThreadLocalRandom.nextSecondarySeed() >= 0)
--spins;
}
else if (q == null)
q = new Signaller(interruptible, 0L, 0L);
else if (!queued)
queued = tryPushStack(q);
else if (interruptible && q.interruptControl < 0) {
q.thread = null;
cleanStack();
return null;
}
else if (q.thread != null && result == null) {
try {
ForkJoinPool.managedBlock(q);
} catch (InterruptedException ie) {
q.interruptControl = -1;
}
}
}
if (q != null) {
q.thread = null;
if (q.interruptControl < 0) {
if (interruptible)
r = null; // report interruption
else
Thread.currentThread().interrupt();
}
}
postComplete();
return r;
} | Object function(boolean interruptible) { Signaller q = null; boolean queued = false; int spins = -1; Object r; while ((r = result) == null) { if (spins < 0) spins = (Runtime.getRuntime().availableProcessors() > 1) ? 1 << 8 : 0; else if (spins > 0) { if (ThreadLocalRandom.nextSecondarySeed() >= 0) --spins; } else if (q == null) q = new Signaller(interruptible, 0L, 0L); else if (!queued) queued = tryPushStack(q); else if (interruptible && q.interruptControl < 0) { q.thread = null; cleanStack(); return null; } else if (q.thread != null && result == null) { try { ForkJoinPool.managedBlock(q); } catch (InterruptedException ie) { q.interruptControl = -1; } } } if (q != null) { q.thread = null; if (q.interruptControl < 0) { if (interruptible) r = null; else Thread.currentThread().interrupt(); } } postComplete(); return r; } | /**
* Returns raw result after waiting, or null if interruptible and
* interrupted.
*/ | Returns raw result after waiting, or null if interruptible and interrupted | waitingGet | {
"repo_name": "flyzsd/java-code-snippets",
"path": "ibm.jdk8/src/java/util/concurrent/CompletableFuture.java",
"license": "mit",
"size": 90520
} | [
"java.util.concurrent.ForkJoinPool",
"java.util.concurrent.ThreadLocalRandom"
] | import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ThreadLocalRandom; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,624,379 |
private Request request(Request request) {
request = request.socketTimeout(this.socketTimeoutInMillis)
.connectTimeout(this.connectionTimeoutInMillis);
if (this.proxy != null) {
request = request.viaProxy(this.proxy.toString());
}
return request;
}
public static class HttpClientOptionsBuilder {
private URI host = null;
private URI proxy = null;
private int socketTimeoutInMillis = 1000;
private int connectionTimeoutInMillis = 1000;
private final TimeUnit timeUnit = TimeUnit.MILLISECONDS;
public HttpClientOptionsBuilder() {
} | Request function(Request request) { request = request.socketTimeout(this.socketTimeoutInMillis) .connectTimeout(this.connectionTimeoutInMillis); if (this.proxy != null) { request = request.viaProxy(this.proxy.toString()); } return request; } public static class HttpClientOptionsBuilder { private URI host = null; private URI proxy = null; private int socketTimeoutInMillis = 1000; private int connectionTimeoutInMillis = 1000; private final TimeUnit timeUnit = TimeUnit.MILLISECONDS; public HttpClientOptionsBuilder() { } | /**
* Returns a new http request with default parameters.
*
* @return Returns a new http request with default parameters.
*/ | Returns a new http request with default parameters | request | {
"repo_name": "PantherCode/arctic-core",
"path": "src/main/java/org/panthercode/arctic/core/http/HttpClientOptions.java",
"license": "apache-2.0",
"size": 19892
} | [
"java.util.concurrent.TimeUnit",
"org.apache.http.client.fluent.Request"
] | import java.util.concurrent.TimeUnit; import org.apache.http.client.fluent.Request; | import java.util.concurrent.*; import org.apache.http.client.fluent.*; | [
"java.util",
"org.apache.http"
] | java.util; org.apache.http; | 1,950,456 |
public Cipher getCipherForDecryptionMode(CredentialEncryptionMode encryptionMode, byte[] dataToBeDecrypted) throws KeyPermanentlyInvalidatedException, KeyStoreException, CryptoError {
Key key = this.getDataKey(encryptionMode);
Cipher cipher;
try {
cipher = Cipher.getInstance(AES_DATA_ALGORITHM, ANDROID_KEY_STORE_BC_WORKAROUND);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | NoSuchProviderException e) {
throw new RuntimeException(e);
}
byte[] iv = this.getIV(dataToBeDecrypted);
try {
cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv));
} catch (KeyPermanentlyInvalidatedException e) {
keyStore.deleteEntry(keyAliasForEncryptionMode(encryptionMode));
throw e;
} catch (InvalidKeyException e) {
throw new KeyStoreException(e);
} catch (InvalidAlgorithmParameterException e) {
throw new CryptoError(e);
}
return cipher;
} | Cipher function(CredentialEncryptionMode encryptionMode, byte[] dataToBeDecrypted) throws KeyPermanentlyInvalidatedException, KeyStoreException, CryptoError { Key key = this.getDataKey(encryptionMode); Cipher cipher; try { cipher = Cipher.getInstance(AES_DATA_ALGORITHM, ANDROID_KEY_STORE_BC_WORKAROUND); } catch (NoSuchAlgorithmException NoSuchPaddingException NoSuchProviderException e) { throw new RuntimeException(e); } byte[] iv = this.getIV(dataToBeDecrypted); try { cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv)); } catch (KeyPermanentlyInvalidatedException e) { keyStore.deleteEntry(keyAliasForEncryptionMode(encryptionMode)); throw e; } catch (InvalidKeyException e) { throw new KeyStoreException(e); } catch (InvalidAlgorithmParameterException e) { throw new CryptoError(e); } return cipher; } | /**
* Get initialized cipher for decryption. Will use {@param dataToBeDecrypted} to extract IV.
* Cipher will be configured for AES-CBC-PKC7 algorithm.
* @param encryptionMode
* @param dataToBeDecrypted
* @return
* @throws KeyStoreException if the data key for encryption mode cannot be accessed.
* @throws CryptoError if encrypted data does not contain valid IV
*/ | Get initialized cipher for decryption. Will use dataToBeDecrypted to extract IV. Cipher will be configured for AES-CBC-PKC7 algorithm | getCipherForDecryptionMode | {
"repo_name": "tutao/tutanota",
"path": "app-android/app/src/main/java/de/tutao/tutanota/AndroidKeyStoreFacade.java",
"license": "gpl-3.0",
"size": 11748
} | [
"android.security.keystore.KeyPermanentlyInvalidatedException",
"de.tutao.tutanota.credentials.CredentialEncryptionMode",
"java.security.InvalidAlgorithmParameterException",
"java.security.InvalidKeyException",
"java.security.Key",
"java.security.KeyStoreException",
"java.security.NoSuchAlgorithmException",
"java.security.NoSuchProviderException",
"javax.crypto.Cipher",
"javax.crypto.NoSuchPaddingException",
"javax.crypto.spec.IvParameterSpec"
] | import android.security.keystore.KeyPermanentlyInvalidatedException; import de.tutao.tutanota.credentials.CredentialEncryptionMode; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.Key; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; | import android.security.keystore.*; import de.tutao.tutanota.credentials.*; import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; | [
"android.security",
"de.tutao.tutanota",
"java.security",
"javax.crypto"
] | android.security; de.tutao.tutanota; java.security; javax.crypto; | 986,020 |
public void addAllowedPackage(String packageName) {
if (packageName.endsWith(".")) {
packageName = packageName.substring(0, packageName.length() - 1);
}
String packageRegex = START+dotsToRegex(packageName)+SEP+JAVA_IDENTIFIER_PART+"+.class$";
if (DEBUG) System.out.println("Package regex: " + packageRegex);
patternList.add(Pattern.compile(packageRegex).matcher(""));
} | void function(String packageName) { if (packageName.endsWith(".")) { packageName = packageName.substring(0, packageName.length() - 1); } String packageRegex = START+dotsToRegex(packageName)+SEP+JAVA_IDENTIFIER_PART+STR; if (DEBUG) System.out.println(STR + packageRegex); patternList.add(Pattern.compile(packageRegex).matcher("")); } | /**
* Add the name of a package to be matched by the screener.
* All class files that appear to be in the package should be matched.
*
* @param packageName name of the package to be matched
*/ | Add the name of a package to be matched by the screener. All class files that appear to be in the package should be matched | addAllowedPackage | {
"repo_name": "optivo-org/fingbugs-1.3.9-optivo",
"path": "src/java/edu/umd/cs/findbugs/ClassScreener.java",
"license": "lgpl-2.1",
"size": 6004
} | [
"java.util.regex.Pattern"
] | import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 685,024 |
private boolean add(final HTree members, final byte[] key) {
if(members.contains(key)) {
return false;
}
// Add to the map.
members.insert(key, null);
return true;
}
}
| boolean function(final HTree members, final byte[] key) { if(members.contains(key)) { return false; } members.insert(key, null); return true; } } | /**
* Add to {@link HTree}.
*
* @param members
* @param key
* @return <code>true</code> iff not already present.
*/ | Add to <code>HTree</code> | add | {
"repo_name": "wikimedia/wikidata-query-blazegraph",
"path": "bigdata-core/bigdata-rdf/src/java/com/bigdata/bop/rdf/filter/NativeDistinctFilter.java",
"license": "gpl-2.0",
"size": 23019
} | [
"com.bigdata.htree.HTree"
] | import com.bigdata.htree.HTree; | import com.bigdata.htree.*; | [
"com.bigdata.htree"
] | com.bigdata.htree; | 1,959,245 |
int getFirst() throws NoSuchElementException;
| int getFirst() throws NoSuchElementException; | /**
* Returns the first integer in this list.
*
* @return the first integer in this list
* @throws NoSuchElementException - if the list is empty
*/ | Returns the first integer in this list | getFirst | {
"repo_name": "marcelherd/hochschule-mannheim",
"path": "Workspace/ADS/src/com/marcelherd/uebung5/list/LinkedList.java",
"license": "apache-2.0",
"size": 4638
} | [
"java.util.NoSuchElementException"
] | import java.util.NoSuchElementException; | import java.util.*; | [
"java.util"
] | java.util; | 2,804,122 |
public final Iterator<ModuleIdentifier> iterateModules(final ModuleIdentifier baseIdentifier, final boolean recursive) {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(MODULE_ITERATE_PERM);
}
return new Iterator<ModuleIdentifier>() {
int idx;
Iterator<ModuleIdentifier> nested; | final Iterator<ModuleIdentifier> function(final ModuleIdentifier baseIdentifier, final boolean recursive) { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(MODULE_ITERATE_PERM); } return new Iterator<ModuleIdentifier>() { int idx; Iterator<ModuleIdentifier> nested; | /**
* Iterate the modules which can be located via this module loader.
*
* @param baseIdentifier the identifier to start with, or {@code null} to iterate all modules
* @param recursive {@code true} to find recursively nested modules, {@code false} to only find immediately nested modules
* @return an iterator for the modules in this module finder
* @throws SecurityException if the caller does not have permission to iterate module loaders
*/ | Iterate the modules which can be located via this module loader | iterateModules | {
"repo_name": "doctau/jboss-modules",
"path": "src/main/java/org/jboss/modules/ModuleLoader.java",
"license": "apache-2.0",
"size": 43362
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 760,347 |
public List getMessagesAndClear() {
List list = new ArrayList();
for(Iterator iter = messages.iterator(); iter.hasNext();) {
list.add(((MessageDecorator)iter.next()).getMessage());
}
messages.clear();
return list;
} | List function() { List list = new ArrayList(); for(Iterator iter = messages.iterator(); iter.hasNext();) { list.add(((MessageDecorator)iter.next()).getMessage()); } messages.clear(); return list; } | /**
* Returns the current list of FacesMessages, then removes them from the local list.
* @return list of MessageDecorator
*/ | Returns the current list of FacesMessages, then removes them from the local list | getMessagesAndClear | {
"repo_name": "pushyamig/sakai",
"path": "sections/sections-app-util/src/java/org/sakaiproject/tool/section/jsf/MessagingBean.java",
"license": "apache-2.0",
"size": 4485
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List"
] | import java.util.ArrayList; import java.util.Iterator; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,096,504 |
public static <E> E expectAndGetFirstTopLevelElement(MutableDocument<? super E, E, ?> doc,
String tag) {
return getOrCreateFirstTopLevelElement(doc, tag, Expectation.PRESENT);
} | static <E> E function(MutableDocument<? super E, E, ?> doc, String tag) { return getOrCreateFirstTopLevelElement(doc, tag, Expectation.PRESENT); } | /**
* Gets the first top-level element if it is present.
*
* @param doc document
* @param tag tag name for the top-level element
* @throws RuntimeException if there is no such element, or it does not match
* the specific tag.
* @return the first top-level element. Never null.
*/ | Gets the first top-level element if it is present | expectAndGetFirstTopLevelElement | {
"repo_name": "gburd/wave",
"path": "src/org/waveprotocol/wave/model/document/util/DocHelper.java",
"license": "apache-2.0",
"size": 37653
} | [
"org.waveprotocol.wave.model.document.MutableDocument"
] | import org.waveprotocol.wave.model.document.MutableDocument; | import org.waveprotocol.wave.model.document.*; | [
"org.waveprotocol.wave"
] | org.waveprotocol.wave; | 1,097,333 |
private List<KeyValue> filterUsedTypes(final List<KeyValue> unfiltered) {
assert unfiltered != null : "unfiltered is null";
final List<KeyValue> filtered = new ArrayList<KeyValue>();
for (KeyValue item : unfiltered) {
if (!this.containsType((String) item.getKey())) {
filtered.add(item);
}
}
return filtered;
} | List<KeyValue> function(final List<KeyValue> unfiltered) { assert unfiltered != null : STR; final List<KeyValue> filtered = new ArrayList<KeyValue>(); for (KeyValue item : unfiltered) { if (!this.containsType((String) item.getKey())) { filtered.add(item); } } return filtered; } | /**
* returns a KeyValue list removing all items with type codes matching the type codes contained in
* {@link #filterTypes filterTypes}.
* @param unfiltered the unfiltered list.
* @return a filtered list.
*/ | returns a KeyValue list removing all items with type codes matching the type codes contained in <code>#filterTypes filterTypes</code> | filterUsedTypes | {
"repo_name": "vivantech/kc_fixes",
"path": "src/main/java/org/kuali/kra/irb/noteattachment/ProtocolAttachmentTypeByGroupValuesFinder.java",
"license": "apache-2.0",
"size": 7013
} | [
"java.util.ArrayList",
"java.util.List",
"org.kuali.rice.core.api.util.KeyValue"
] | import java.util.ArrayList; import java.util.List; import org.kuali.rice.core.api.util.KeyValue; | import java.util.*; import org.kuali.rice.core.api.util.*; | [
"java.util",
"org.kuali.rice"
] | java.util; org.kuali.rice; | 2,890,044 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteEntity(String partitionKey, String rowKey) {
return deleteEntity(partitionKey, rowKey, null);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Void> function(String partitionKey, String rowKey) { return deleteEntity(partitionKey, rowKey, null); } | /**
* Deletes an entity from the table.
*
* @param partitionKey The partition key of the entity.
* @param rowKey The partition key of the entity.
*
* @return An empty reactive result.
* @throws TableServiceErrorException if no entity with the provided partition key and row key exists within the
* table.
* @throws IllegalArgumentException if the provided partition key or row key are {@code null} or empty.
*/ | Deletes an entity from the table | deleteEntity | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/tables/azure-data-tables/src/main/java/com/azure/data/tables/TableAsyncClient.java",
"license": "mit",
"size": 41804
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; | import com.azure.core.annotation.*; | [
"com.azure.core"
] | com.azure.core; | 1,594,638 |
private static void drawClearDiv(ResponseWriter writer, UIComponent tabView)
throws IOException {
writer.startElement("div", tabView);
writer.writeAttribute("style", "clear:both;", "style");
writer.endElement("div");
} | static void function(ResponseWriter writer, UIComponent tabView) throws IOException { writer.startElement("div", tabView); writer.writeAttribute("style", STR, "style"); writer.endElement("div"); } | /**
* Draw a clear div
* @param writer
* @param tabView
* @throws IOException
*/ | Draw a clear div | drawClearDiv | {
"repo_name": "asterd/BootsFaces-OSP",
"path": "src/main/java/net/bootsfaces/component/tabView/TabViewRenderer.java",
"license": "apache-2.0",
"size": 14717
} | [
"java.io.IOException",
"javax.faces.component.UIComponent",
"javax.faces.context.ResponseWriter"
] | import java.io.IOException; import javax.faces.component.UIComponent; import javax.faces.context.ResponseWriter; | import java.io.*; import javax.faces.component.*; import javax.faces.context.*; | [
"java.io",
"javax.faces"
] | java.io; javax.faces; | 499,064 |
public static GameConstructionEvent createGameConstructionEvent(Cause cause, GameState state) {
HashMap<String, Object> values = new HashMap<>();
values.put("cause", cause);
values.put("state", state);
return SpongeEventFactoryUtils.createEventImpl(GameConstructionEvent.class, values);
} | static GameConstructionEvent function(Cause cause, GameState state) { HashMap<String, Object> values = new HashMap<>(); values.put("cause", cause); values.put("state", state); return SpongeEventFactoryUtils.createEventImpl(GameConstructionEvent.class, values); } | /**
* AUTOMATICALLY GENERATED, DO NOT EDIT.
* Creates a new instance of
* {@link org.spongepowered.api.event.game.state.GameConstructionEvent}.
*
* @param cause The cause
* @param state The state
* @return A new game construction event
*/ | AUTOMATICALLY GENERATED, DO NOT EDIT. Creates a new instance of <code>org.spongepowered.api.event.game.state.GameConstructionEvent</code> | createGameConstructionEvent | {
"repo_name": "kashike/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/event/SpongeEventFactory.java",
"license": "mit",
"size": 215110
} | [
"java.util.HashMap",
"org.spongepowered.api.GameState",
"org.spongepowered.api.event.cause.Cause",
"org.spongepowered.api.event.game.state.GameConstructionEvent"
] | import java.util.HashMap; import org.spongepowered.api.GameState; import org.spongepowered.api.event.cause.Cause; import org.spongepowered.api.event.game.state.GameConstructionEvent; | import java.util.*; import org.spongepowered.api.*; import org.spongepowered.api.event.cause.*; import org.spongepowered.api.event.game.state.*; | [
"java.util",
"org.spongepowered.api"
] | java.util; org.spongepowered.api; | 1,946,748 |
public Iterable<JsonNode> getIssuesFromJqlSearch(String jql); | Iterable<JsonNode> function(String jql); | /**
* Get Issues based on JQL (Jira Query Language)
*
* @param jql
* @return
*/ | Get Issues based on JQL (Jira Query Language) | getIssuesFromJqlSearch | {
"repo_name": "jbossorg/jive-jira",
"path": "src/main/java/org/jboss/community/sbs/plugin/jira/RemoteJiraManager.java",
"license": "apache-2.0",
"size": 1384
} | [
"com.fasterxml.jackson.databind.JsonNode"
] | import com.fasterxml.jackson.databind.JsonNode; | import com.fasterxml.jackson.databind.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 1,576,251 |
public void setMask(Mask newMask) {
if ((newMask == null) && (mask == null))
return; // No change still no mask.
fireGraphicsNodeChangeStarted();
invalidateGeometryCache();
mask = newMask;
fireGraphicsNodeChangeCompleted();
} | void function(Mask newMask) { if ((newMask == null) && (mask == null)) return; fireGraphicsNodeChangeStarted(); invalidateGeometryCache(); mask = newMask; fireGraphicsNodeChangeCompleted(); } | /**
* Sets the mask of this node.
*
* @param newMask the new mask of this node
*/ | Sets the mask of this node | setMask | {
"repo_name": "srnsw/xena",
"path": "plugins/image/ext/src/batik-1.7/sources/org/apache/batik/gvt/AbstractGraphicsNode.java",
"license": "gpl-3.0",
"size": 31193
} | [
"org.apache.batik.gvt.filter.Mask"
] | import org.apache.batik.gvt.filter.Mask; | import org.apache.batik.gvt.filter.*; | [
"org.apache.batik"
] | org.apache.batik; | 2,306,293 |
public InputStream getFileStream(String file)
throws FileBasedHelperException {
SftpGetMonitor monitor = new SftpGetMonitor();
try {
return this.channelSftp.get(file, monitor);
} catch (SftpException e) {
throw new FileBasedHelperException("Cannot download file " + file + " due to " + e.getMessage(), e);
}
} | InputStream function(String file) throws FileBasedHelperException { SftpGetMonitor monitor = new SftpGetMonitor(); try { return this.channelSftp.get(file, monitor); } catch (SftpException e) { throw new FileBasedHelperException(STR + file + STR + e.getMessage(), e); } } | /**
* Executes a get SftpCommand and returns an input stream to the file
* @param cmd is the command to execute
* @param sftp is the channel to execute the command on
* @throws SftpException
*/ | Executes a get SftpCommand and returns an input stream to the file | getFileStream | {
"repo_name": "slietz/gobblin",
"path": "gobblin-core/src/main/java/gobblin/source/extractor/extract/sftp/SftpFsHelper.java",
"license": "apache-2.0",
"size": 8450
} | [
"com.jcraft.jsch.SftpException",
"java.io.InputStream"
] | import com.jcraft.jsch.SftpException; import java.io.InputStream; | import com.jcraft.jsch.*; import java.io.*; | [
"com.jcraft.jsch",
"java.io"
] | com.jcraft.jsch; java.io; | 1,916,823 |
public Histogram toHistogram(final float bucketSize, final float offset)
{
final float minFloor = (float) Math.floor((min() - offset) / bucketSize) * bucketSize + offset;
final float lowerLimitFloor = (float) Math.floor((lowerLimit - offset) / bucketSize) * bucketSize + offset;
final float firstBreak = Math.max(minFloor, lowerLimitFloor);
final float maxCeil = (float) Math.ceil((max() - offset) / bucketSize) * bucketSize + offset;
final float upperLimitCeil = (float) Math.ceil((upperLimit - offset) / bucketSize) * bucketSize + offset;
final float lastBreak = Math.min(maxCeil, upperLimitCeil);
final float cutoff = 0.1f;
final ArrayList<Float> breaks = new ArrayList<Float>();
// to deal with left inclusivity when the min is the same as a break
final float bottomBreak = minFloor - bucketSize;
if (bottomBreak != firstBreak && (sum(firstBreak) - sum(bottomBreak) > cutoff)) {
breaks.add(bottomBreak);
}
float left = firstBreak;
boolean leftSet = false;
//the + bucketSize / 10 is because floating point addition is always slightly incorrect and so we need to account for that
while (left + bucketSize <= lastBreak + (bucketSize / 10)) {
final float right = left + bucketSize;
if (sum(right) - sum(left) > cutoff) {
if (!leftSet) {
breaks.add(left);
}
breaks.add(right);
leftSet = true;
} else {
leftSet = false;
}
left = right;
}
if (breaks.get(breaks.size() - 1) != maxCeil && (sum(maxCeil) - sum(breaks.get(breaks.size() - 1)) > cutoff)) {
breaks.add(maxCeil);
}
return toHistogram(Floats.toArray(breaks));
} | Histogram function(final float bucketSize, final float offset) { final float minFloor = (float) Math.floor((min() - offset) / bucketSize) * bucketSize + offset; final float lowerLimitFloor = (float) Math.floor((lowerLimit - offset) / bucketSize) * bucketSize + offset; final float firstBreak = Math.max(minFloor, lowerLimitFloor); final float maxCeil = (float) Math.ceil((max() - offset) / bucketSize) * bucketSize + offset; final float upperLimitCeil = (float) Math.ceil((upperLimit - offset) / bucketSize) * bucketSize + offset; final float lastBreak = Math.min(maxCeil, upperLimitCeil); final float cutoff = 0.1f; final ArrayList<Float> breaks = new ArrayList<Float>(); final float bottomBreak = minFloor - bucketSize; if (bottomBreak != firstBreak && (sum(firstBreak) - sum(bottomBreak) > cutoff)) { breaks.add(bottomBreak); } float left = firstBreak; boolean leftSet = false; while (left + bucketSize <= lastBreak + (bucketSize / 10)) { final float right = left + bucketSize; if (sum(right) - sum(left) > cutoff) { if (!leftSet) { breaks.add(left); } breaks.add(right); leftSet = true; } else { leftSet = false; } left = right; } if (breaks.get(breaks.size() - 1) != maxCeil && (sum(maxCeil) - sum(breaks.get(breaks.size() - 1)) > cutoff)) { breaks.add(maxCeil); } return toHistogram(Floats.toArray(breaks)); } | /**
* Computes a visual representation given an initial breakpoint, offset, and a bucket size.
*
* @param bucketSize the size of each bucket
* @param offset the location of one breakpoint
*
* @return visual representation of the histogram
*/ | Computes a visual representation given an initial breakpoint, offset, and a bucket size | toHistogram | {
"repo_name": "zhihuij/druid",
"path": "extensions-core/histogram/src/main/java/io/druid/query/aggregation/histogram/ApproximateHistogram.java",
"license": "apache-2.0",
"size": 50368
} | [
"com.google.common.primitives.Floats",
"java.util.ArrayList"
] | import com.google.common.primitives.Floats; import java.util.ArrayList; | import com.google.common.primitives.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 20,281 |
private static void getBuiltinsForGlslVersionTexture(
Map<String, List<FunctionPrototype>> builtinsForVersion,
ShadingLanguageVersion shadingLanguageVersion,
ShaderKind shaderKind) {
if (shadingLanguageVersion.supportedTexture()) {
final String name = "texture";
// The following come from:
// gvec4 texture(gsampler2D sampler, vec2 P, [float bias]);
addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER2D,
BasicType.VEC2);
addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER2D,
BasicType.VEC2);
addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER2D,
BasicType.VEC2);
if (shaderKind == ShaderKind.FRAGMENT) {
addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER2D,
BasicType.VEC2, BasicType.FLOAT);
addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER2D,
BasicType.VEC2, BasicType.FLOAT);
addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER2D,
BasicType.VEC2, BasicType.FLOAT);
}
// The following come from:
// gvec4 texture(gsampler3D sampler, vec3 P, [float bias]);
addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER3D,
BasicType.VEC3);
addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER3D,
BasicType.VEC3);
addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER3D,
BasicType.VEC3);
if (shaderKind == ShaderKind.FRAGMENT) {
addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER3D,
BasicType.VEC3, BasicType.FLOAT);
addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER3D,
BasicType.VEC3, BasicType.FLOAT);
addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER3D,
BasicType.VEC3, BasicType.FLOAT);
}
// The following come from:
// gvec4 texture(gsamplerCube sampler, vec3 P, [float bias]);
addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLERCUBE,
BasicType.VEC3);
addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLERCUBE,
BasicType.VEC3);
addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLERCUBE,
BasicType.VEC3);
if (shaderKind == ShaderKind.FRAGMENT) {
addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLERCUBE,
BasicType.VEC3, BasicType.FLOAT);
addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLERCUBE,
BasicType.VEC3, BasicType.FLOAT);
addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLERCUBE,
BasicType.VEC3, BasicType.FLOAT);
}
// The following come from:
// float texture(sampler2DShadow sampler, vec3 P, [float bias]);
addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLER2DSHADOW,
BasicType.VEC3);
if (shaderKind == ShaderKind.FRAGMENT) {
addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLER2DSHADOW,
BasicType.VEC3, BasicType.FLOAT);
}
// The following come from:
// float texture(samplerCubeShadow sampler, vec4 P, [float bias]);
addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLERCUBESHADOW,
BasicType.VEC4);
if (shaderKind == ShaderKind.FRAGMENT) {
addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLERCUBESHADOW,
BasicType.VEC4, BasicType.FLOAT);
}
// The following come from:
// gvec4 texture(gsampler2DArray sampler, vec3 P,[float bias]);
addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER2DARRAY,
BasicType.VEC3);
addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER2DARRAY,
BasicType.VEC3);
addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER2DARRAY,
BasicType.VEC3);
if (shaderKind == ShaderKind.FRAGMENT) {
addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER2DARRAY,
BasicType.VEC3, BasicType.FLOAT);
addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER2DARRAY,
BasicType.VEC3, BasicType.FLOAT);
addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER2DARRAY,
BasicType.VEC3, BasicType.FLOAT);
}
// The following comes from:
// float texture(sampler2DArrayShadow sampler, vec4 P);
addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLER2DARRAYSHADOW,
BasicType.VEC4);
}
} | static void function( Map<String, List<FunctionPrototype>> builtinsForVersion, ShadingLanguageVersion shadingLanguageVersion, ShaderKind shaderKind) { if (shadingLanguageVersion.supportedTexture()) { final String name = STR; addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER2D, BasicType.VEC2); addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER2D, BasicType.VEC2); addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER2D, BasicType.VEC2); if (shaderKind == ShaderKind.FRAGMENT) { addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER2D, BasicType.VEC2, BasicType.FLOAT); addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER2D, BasicType.VEC2, BasicType.FLOAT); addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER2D, BasicType.VEC2, BasicType.FLOAT); } addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER3D, BasicType.VEC3); addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER3D, BasicType.VEC3); addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER3D, BasicType.VEC3); if (shaderKind == ShaderKind.FRAGMENT) { addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER3D, BasicType.VEC3, BasicType.FLOAT); addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER3D, BasicType.VEC3, BasicType.FLOAT); addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER3D, BasicType.VEC3, BasicType.FLOAT); } addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLERCUBE, BasicType.VEC3); addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLERCUBE, BasicType.VEC3); addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLERCUBE, BasicType.VEC3); if (shaderKind == ShaderKind.FRAGMENT) { addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLERCUBE, BasicType.VEC3, BasicType.FLOAT); addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLERCUBE, BasicType.VEC3, BasicType.FLOAT); addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLERCUBE, BasicType.VEC3, BasicType.FLOAT); } addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLER2DSHADOW, BasicType.VEC3); if (shaderKind == ShaderKind.FRAGMENT) { addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLER2DSHADOW, BasicType.VEC3, BasicType.FLOAT); } addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLERCUBESHADOW, BasicType.VEC4); if (shaderKind == ShaderKind.FRAGMENT) { addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLERCUBESHADOW, BasicType.VEC4, BasicType.FLOAT); } addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER2DARRAY, BasicType.VEC3); addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER2DARRAY, BasicType.VEC3); addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER2DARRAY, BasicType.VEC3); if (shaderKind == ShaderKind.FRAGMENT) { addBuiltin(builtinsForVersion, name, BasicType.VEC4, SamplerType.SAMPLER2DARRAY, BasicType.VEC3, BasicType.FLOAT); addBuiltin(builtinsForVersion, name, BasicType.IVEC4, SamplerType.ISAMPLER2DARRAY, BasicType.VEC3, BasicType.FLOAT); addBuiltin(builtinsForVersion, name, BasicType.UVEC4, SamplerType.USAMPLER2DARRAY, BasicType.VEC3, BasicType.FLOAT); } addBuiltin(builtinsForVersion, name, BasicType.FLOAT, SamplerType.SAMPLER2DARRAYSHADOW, BasicType.VEC4); } } | /**
* Helper function to register built-in function prototypes for Texture Functions,
* as specified in section 8.9 of the GLSL 4.6 and ESSL 3.2 specifications.
*
* @param builtinsForVersion the list of builtins to add prototypes to
* @param shadingLanguageVersion the version of GLSL in use
* @param shaderKind the kind of shader for which builtins are being queried
*/ | Helper function to register built-in function prototypes for Texture Functions, as specified in section 8.9 of the GLSL 4.6 and ESSL 3.2 specifications | getBuiltinsForGlslVersionTexture | {
"repo_name": "google/graphicsfuzz",
"path": "ast/src/main/java/com/graphicsfuzz/common/typing/TyperHelper.java",
"license": "apache-2.0",
"size": 58902
} | [
"com.graphicsfuzz.common.ast.decl.FunctionPrototype",
"com.graphicsfuzz.common.ast.type.BasicType",
"com.graphicsfuzz.common.ast.type.SamplerType",
"com.graphicsfuzz.common.glslversion.ShadingLanguageVersion",
"com.graphicsfuzz.common.util.ShaderKind",
"java.util.List",
"java.util.Map"
] | import com.graphicsfuzz.common.ast.decl.FunctionPrototype; import com.graphicsfuzz.common.ast.type.BasicType; import com.graphicsfuzz.common.ast.type.SamplerType; import com.graphicsfuzz.common.glslversion.ShadingLanguageVersion; import com.graphicsfuzz.common.util.ShaderKind; import java.util.List; import java.util.Map; | import com.graphicsfuzz.common.ast.decl.*; import com.graphicsfuzz.common.ast.type.*; import com.graphicsfuzz.common.glslversion.*; import com.graphicsfuzz.common.util.*; import java.util.*; | [
"com.graphicsfuzz.common",
"java.util"
] | com.graphicsfuzz.common; java.util; | 148,444 |
void render(StringOutput sb, Renderer renderer, Object val, Locale locale, int alignment, String action); | void render(StringOutput sb, Renderer renderer, Object val, Locale locale, int alignment, String action); | /**
* this method is called by CustomRenderColumnDescriptor.
*
* @param sb the StringOuput to put the rendering into
* @param renderer the renderer to use
* @param val the value from the tablemodel to be rendered.
* @param locale the locale to use
* @param alignment the alignment (see ColumnDescriptor.ALIGNMENT...)
* @param action the action. if not null, then the output should be clickable
* and produce a command uri with action
*/ | this method is called by CustomRenderColumnDescriptor | render | {
"repo_name": "stevenhva/InfoLearn_OpenOLAT",
"path": "src/main/java/org/olat/core/gui/components/table/CustomCellRenderer.java",
"license": "apache-2.0",
"size": 2146
} | [
"java.util.Locale",
"org.olat.core.gui.render.Renderer",
"org.olat.core.gui.render.StringOutput"
] | import java.util.Locale; import org.olat.core.gui.render.Renderer; import org.olat.core.gui.render.StringOutput; | import java.util.*; import org.olat.core.gui.render.*; | [
"java.util",
"org.olat.core"
] | java.util; org.olat.core; | 614,314 |
static String classNameOf(TypeElement type) {
String name = type.getQualifiedName().toString();
String pkgName = packageNameOf(type);
return pkgName.isEmpty() ? name : name.substring(pkgName.length() + 1);
} | static String classNameOf(TypeElement type) { String name = type.getQualifiedName().toString(); String pkgName = packageNameOf(type); return pkgName.isEmpty() ? name : name.substring(pkgName.length() + 1); } | /**
* Returns the name of the given type, including any enclosing types but not the package.
*/ | Returns the name of the given type, including any enclosing types but not the package | classNameOf | {
"repo_name": "sopak/auto-value-step-builder",
"path": "auto-value-step-builder/src/main/java/cz/jcode/auto/value/step/builder/TypeSimplifier.java",
"license": "apache-2.0",
"size": 25237
} | [
"javax.lang.model.element.TypeElement"
] | import javax.lang.model.element.TypeElement; | import javax.lang.model.element.*; | [
"javax.lang"
] | javax.lang; | 215,703 |
private static String ymNameForDate(long date) {
if (calendar == null)
calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
calendar.setTimeInMillis(date);
// The URLs we're after contain the date, so we have to construct them.
// Each file is a calendar month of data -- of course we may be at
// the start of a month. So get this month's and last month's,
// to guarantee 30 days * 24 hours.
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
return String.format("%04d%02d", year, month);
}
// ******************************************************************** //
// Fetched Data Handling.
// ******************************************************************** // | static String function(long date) { if (calendar == null) calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.setTimeInMillis(date); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH) + 1; return String.format(STR, year, month); } | /**
* Get the year and month name for a given date.
*
* @param date The date in ms UTC.
* @return Date year-month name, as in "20091231".
*/ | Get the year and month name for a given date | ymNameForDate | {
"repo_name": "jmwhite999/_android_utilpad",
"path": "HermitAndroid/src/org/hermit/android/net/WebBasedData.java",
"license": "gpl-2.0",
"size": 14128
} | [
"java.util.Calendar",
"java.util.TimeZone"
] | import java.util.Calendar; import java.util.TimeZone; | import java.util.*; | [
"java.util"
] | java.util; | 2,171,340 |
public Date parseDate(String value, Object locale)
{
return parseDate(value, this.dateFormat, locale);
} | Date function(String value, Object locale) { return parseDate(value, this.dateFormat, locale); } | /**
* Converts a string to an instance of {@link Date} using the
* configured date format and specified {@link Locale} to parse it.
*
* @param value - the date to convert
* @param locale - the Locale to use
* @return the string as a {@link Date} or <code>null</code> if no
* conversion is possible
* @see java.text.SimpleDateFormat#parse
*/ | Converts a string to an instance of <code>Date</code> using the configured date format and specified <code>Locale</code> to parse it | parseDate | {
"repo_name": "fluidinfo/velocity-tools-packaging",
"path": "src/main/java/org/apache/velocity/tools/generic/ConversionTool.java",
"license": "apache-2.0",
"size": 24755
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,274,798 |
public @Nullable byte[] getObjectMask(final int objectNumber) {
if (objectNumber > getMaxObject()) {
return null;
}
final byte[] pixels = new byte[objectMask.length];
for (int i = 0; i < pixels.length; i++) {
if (objectMask[i] == objectNumber) {
pixels[i] = (byte) 255;
}
}
return pixels;
} | @Nullable byte[] function(final int objectNumber) { if (objectNumber > getMaxObject()) { return null; } final byte[] pixels = new byte[objectMask.length]; for (int i = 0; i < pixels.length; i++) { if (objectMask[i] == objectNumber) { pixels[i] = (byte) 255; } } return pixels; } | /**
* Gets the object mask.
*
* @param objectNumber The object number
* @return A byte mask of the object (objects pixels set to (byte)255)
*/ | Gets the object mask | getObjectMask | {
"repo_name": "aherbert/GDSC-SMLM",
"path": "src/main/java/uk/ac/sussex/gdsc/smlm/ij/utils/ObjectAnalyzer.java",
"license": "gpl-3.0",
"size": 10136
} | [
"uk.ac.sussex.gdsc.core.annotation.Nullable"
] | import uk.ac.sussex.gdsc.core.annotation.Nullable; | import uk.ac.sussex.gdsc.core.annotation.*; | [
"uk.ac.sussex"
] | uk.ac.sussex; | 1,814,890 |
protected Connection createConnection() throws DatabaseException {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://66.172.33.253:3306/"+MYSQL_DB,MYSQL_USER,MYSQL_PW );
conn.setAutoCommit(false);
conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
return conn;
} catch (Exception e) {
//Slog.error(e, "DB Error");
throw new DatabaseException(e);
}
}
| Connection function() throws DatabaseException { try { Class.forName(STR).newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql: conn.setAutoCommit(false); conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); return conn; } catch (Exception e) { throw new DatabaseException(e); } } | /**
* Creates a connection to the database using the specified driver, connection url, username and
* password.
*
* @return
* Connection
* @throws DatabaseException
*/ | Creates a connection to the database using the specified driver, connection url, username and password | createConnection | {
"repo_name": "ZabinX/DuskRPG",
"path": "DuskFiles/Dusk3.0.1/src/in/groan/dusk/db/Accounts.java",
"license": "gpl-2.0",
"size": 31017
} | [
"java.sql.Connection",
"java.sql.DriverManager"
] | import java.sql.Connection; import java.sql.DriverManager; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,272,926 |
@Test
@Documented
public void add_many_nodes_to_the_spatial_layer() throws Exception {
data.get();
String response = post(Status.OK,"{\"layer\":\"geom\", \"lat\":\"lat\", \"lon\":\"lon\"}", ENDPOINT + "/graphdb/addSimplePointLayer");
int nodeId = getNodeId(post(Status.CREATED, "{\"lat\":60.1, \"lon\":15.2}", "http://localhost:" + PORT + "/db/data/node"));
int nodeId2 = getNodeId(post(Status.CREATED,"{\"lat\":60.1, \"lon\":15.3}", "http://localhost:"+PORT+"/db/data/node"));
response = post(Status.OK,"{\"layer\":\"geom\", \"nodes\": [\"http://localhost:"+PORT+"/db/data/node/"+nodeId+"\",\"http://localhost:"+PORT+"/db/data/node/"+nodeId2+"\"]}", ENDPOINT + "/graphdb/addNodesToLayer");
System.out.println("response = " + response);
response = post(Status.OK,String.format("{\"layer\":\"%s\", \"pointX\":%s,\"pointY\":%s,\"distanceInKm\":%s}","geom",15.2,60.1,10.0 ), ENDPOINT + "/graphdb/findGeometriesWithinDistance");
System.out.println("response = " + response);
assertTrue(response.contains("15.2"));
assertTrue(response.contains("15.3"));
} | void function() throws Exception { data.get(); String response = post(Status.OK,"{\"layer\":\"geom\STRlat\":\"lat\STRlon\":\"lon\"}", ENDPOINT + STR); int nodeId = getNodeId(post(Status.CREATED, "{\"lat\STRlon\STR, STR{\"lat\STRlon\":15.3}STRhttp: response = post(Status.OK,"{\"layer\":\"geom\STRnodes\STRhttp: System.out.println(STR + response); response = post(Status.OK,String.format("{\"layer\":\"%s\STRpointX\":%s,\"pointY\":%s,\"distanceInKm\":%s}","geom",15.2,60.1,10.0 ), ENDPOINT + STR); System.out.println(STR + response); assertTrue(response.contains("15.2")); assertTrue(response.contains("15.3")); } | /**
* Add multiple nodes to the spatial layer.
*/ | Add multiple nodes to the spatial layer | add_many_nodes_to_the_spatial_layer | {
"repo_name": "1manStartup/spatial",
"path": "src/test/java/org/neo4j/gis/spatial/SpatialPluginFunctionalTest.java",
"license": "agpl-3.0",
"size": 20868
} | [
"javax.ws.rs.core.Response",
"org.junit.Assert"
] | import javax.ws.rs.core.Response; import org.junit.Assert; | import javax.ws.rs.core.*; import org.junit.*; | [
"javax.ws",
"org.junit"
] | javax.ws; org.junit; | 870,654 |
@Generated
@Selector("setWorldToMetersConversionScale:")
public native void setWorldToMetersConversionScale(float value); | @Selector(STR) native void function(float value); | /**
* World to meters conversion scale. Required for certain calculations.
*/ | World to meters conversion scale. Required for certain calculations | setWorldToMetersConversionScale | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/modelio/MDLCamera.java",
"license": "apache-2.0",
"size": 11249
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 831,669 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String userPath = request.getServletPath();
HttpSession session = request.getSession();
ShoppingCart cart = (ShoppingCart) session.getAttribute("cart");
Validator validator = new Validator() {};
// if addToCart action is called
if (userPath.equals("/addToCart")) {
// TODO: Implement add product to cart action
// if user is adding item to cart for first time
// create cart object and attach it to user session
if (cart == null){
cart = new ShoppingCart();
session.setAttribute("cart", cart);
}
// get user input from request
String productId = request.getParameter("productId");
//if product id exist in request
if (!productId.isEmpty()){
Product product = productFacade.find(Integer.parseInt(productId));
cart.addItem(product);
}
userPath = "/category";
}
else if (userPath.equals("/updateCart")) {
// TODO: Implement update cart action
// get input from request
String productId = request.getParameter("productId");
String quantity = request.getParameter("quantity");
Product product = productFacade.find(Integer.parseInt(productId));
cart.update(product, quantity);
userPath = "/cart";
// if purchase action is called
}
else if (userPath.equals("/purchase")) {
// TODO: Implement purchase action
if (cart != null){
// extract user data from request
String name = request.getParameter("name");
String email = request.getParameter("email");
String phone = request.getParameter("phone");
String address = request.getParameter("address");
String cityRegion = request.getParameter("cityRegion");
boolean validationErrorFlag;
validationErrorFlag = validator.validateForm(name, email, phone, address, cityRegion, request);
// if validation error found, return user to checkout
if (true == validationErrorFlag) {
request.setAttribute("validationErrorFlag", validationErrorFlag);
userPath = "/checkout";
// otherwise, save order to database
}
else {
int orderId = orderManager.placeOrder(name, email, phone, address, cityRegion, cart);
// if order processed successfully send user to confirmation page
if (orderId != 0) {
// dissociate shopping cart from session
Locale locale = (Locale) session.getAttribute("javax.servlet.jsp.jstl.fmt.locale.session");
String language = "";
if (locale != null) {
language = (String) locale.getLanguage();
}
// dissociate shopping cart from session
//cart = null;
// end session
session.invalidate();
// get order details
Map orderMap = orderManager.getOrderDetails(orderId);
// place order details in request scope
request.setAttribute("customer", orderMap.get("customer"));
request.setAttribute("products", orderMap.get("products"));
request.setAttribute("orderRecord", orderMap.get("orderRecord"));
request.setAttribute("orderedProducts", orderMap.get("orderedProducts"));
userPath = "/confirmation";
}
else {
// otherwise, send back to checkout page and display error
userPath = "/checkout";
request.setAttribute("orderFailureFlag", true);
}
}
}
}
// use RequestDispatcher to forward request internally
String url = "/WEB-INF/view" + userPath + ".jsp";
try {
request.getRequestDispatcher(url).forward(request, response);
} catch (ServletException | IOException ex) {
ex.toString();
}
}
| void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String userPath = request.getServletPath(); HttpSession session = request.getSession(); ShoppingCart cart = (ShoppingCart) session.getAttribute("cart"); Validator validator = new Validator() {}; if (userPath.equals(STR)) { if (cart == null){ cart = new ShoppingCart(); session.setAttribute("cart", cart); } String productId = request.getParameter(STR); if (!productId.isEmpty()){ Product product = productFacade.find(Integer.parseInt(productId)); cart.addItem(product); } userPath = STR; } else if (userPath.equals(STR)) { String productId = request.getParameter(STR); String quantity = request.getParameter(STR); Product product = productFacade.find(Integer.parseInt(productId)); cart.update(product, quantity); userPath = "/cart"; } else if (userPath.equals(STR)) { if (cart != null){ String name = request.getParameter("name"); String email = request.getParameter("email"); String phone = request.getParameter("phone"); String address = request.getParameter(STR); String cityRegion = request.getParameter(STR); boolean validationErrorFlag; validationErrorFlag = validator.validateForm(name, email, phone, address, cityRegion, request); if (true == validationErrorFlag) { request.setAttribute(STR, validationErrorFlag); userPath = STR; } else { int orderId = orderManager.placeOrder(name, email, phone, address, cityRegion, cart); if (orderId != 0) { Locale locale = (Locale) session.getAttribute(STR); String language = STRcustomerSTRcustomerSTRproductsSTRproductsSTRorderRecordSTRorderRecordSTRorderedProductsSTRorderedProductsSTR/confirmation"; } else { userPath = STR; request.setAttribute("orderFailureFlagSTR/WEB-INF/viewSTR.jsp"; try { request.getRequestDispatcher(url).forward(request, response); } catch (ServletException IOException ex) { ex.toString(); } } | /**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Handles the HTTP <code>POST</code> method | doPost | {
"repo_name": "RetinaInc/Extended-Ecommerce",
"path": "controller/ControllerServlet.java",
"license": "lgpl-3.0",
"size": 12065
} | [
"java.io.IOException",
"java.util.Locale",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"javax.servlet.http.HttpSession"
] | import java.io.IOException; import java.util.Locale; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; | import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"java.util",
"javax.servlet"
] | java.io; java.util; javax.servlet; | 1,837,144 |
@Idempotent
public void setAcl(String src, List<AclEntry> aclSpec) throws IOException; | void function(String src, List<AclEntry> aclSpec) throws IOException; | /**
* Fully replaces ACL of files and directories, discarding all existing
* entries.
*/ | Fully replaces ACL of files and directories, discarding all existing entries | setAcl | {
"repo_name": "bysslord/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java",
"license": "apache-2.0",
"size": 58964
} | [
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.fs.permission.AclEntry"
] | import java.io.IOException; import java.util.List; import org.apache.hadoop.fs.permission.AclEntry; | import java.io.*; import java.util.*; import org.apache.hadoop.fs.permission.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 2,063,260 |
private JComboBox getHour() {
if (hour == null) {
hour = new JComboBox();
hour.addItem("12");
hour.addItem("01");
hour.addItem("02");
hour.addItem("03");
hour.addItem("04");
hour.addItem("05");
hour.addItem("06");
hour.addItem("07");
hour.addItem("08");
hour.addItem("09");
hour.addItem("10");
hour.addItem("11");
;
if (startOfDay) {
hour.setSelectedItem("12");
} else {
hour.setSelectedItem("11");
}
}
return hour;
} | JComboBox function() { if (hour == null) { hour = new JComboBox(); hour.addItem("12"); hour.addItem("01"); hour.addItem("02"); hour.addItem("03"); hour.addItem("04"); hour.addItem("05"); hour.addItem("06"); hour.addItem("07"); hour.addItem("08"); hour.addItem("09"); hour.addItem("10"); hour.addItem("11"); ; if (startOfDay) { hour.setSelectedItem("12"); } else { hour.setSelectedItem("11"); } } return hour; } | /**
* This method initializes hour
*
* @return javax.swing.JComboBox
*/ | This method initializes hour | getHour | {
"repo_name": "NCIP/cagrid-core",
"path": "caGrid/projects/gaards-ui/src/org/cagrid/gaards/ui/common/SelectDateDialog.java",
"license": "bsd-3-clause",
"size": 9612
} | [
"javax.swing.JComboBox"
] | import javax.swing.JComboBox; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,255,279 |
@org.junit.Test
public void testLowIterationEncryption() throws Exception {
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
UsernameToken usernameToken = new UsernameToken(true, doc, null);
usernameToken.setName("bob");
WSSConfig config = WSSConfig.getNewInstance();
usernameToken.setID(config.getIdAllocator().createId("UsernameToken-", usernameToken));
usernameToken.addIteration(doc, 500);
byte[] salt = usernameToken.addSalt(doc, null, false);
byte[] derivedKey = UsernameToken.generateDerivedKey("security", salt, 500);
//
// Derived key encryption
//
WSSecDKEncrypt encrBuilder = new WSSecDKEncrypt();
encrBuilder.setSymmetricEncAlgorithm(WSConstants.AES_128);
encrBuilder.setExternalKey(derivedKey, usernameToken.getID());
encrBuilder.setCustomValueType(WSConstants.WSS_USERNAME_TOKEN_VALUE_TYPE);
Document encryptedDoc = encrBuilder.build(doc, secHeader);
WSSecurityUtil.prependChildElement(
secHeader.getSecurityHeader(), usernameToken.getElement()
);
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
assertTrue(outputString.indexOf("wsse:Username") != -1);
assertTrue(outputString.indexOf("wsse:Password") == -1);
assertTrue(outputString.indexOf("wsse11:Salt") != -1);
assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
if (LOG.isDebugEnabled()) {
LOG.debug(outputString);
}
try {
verify(encryptedDoc);
fail("Failure expected on a low iteration value");
} catch (WSSecurityException ex) {
// expected
}
// Turn off BSP compliance and it should work
config.setWsiBSPCompliant(false);
WSSecurityEngine newEngine = new WSSecurityEngine();
newEngine.setWssConfig(config);
newEngine.processSecurityHeader(doc, null, callbackHandler, crypto);
} | @org.junit.Test void function() throws Exception { Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(); secHeader.insertSecurityHeader(doc); UsernameToken usernameToken = new UsernameToken(true, doc, null); usernameToken.setName("bob"); WSSConfig config = WSSConfig.getNewInstance(); usernameToken.setID(config.getIdAllocator().createId(STR, usernameToken)); usernameToken.addIteration(doc, 500); byte[] salt = usernameToken.addSalt(doc, null, false); byte[] derivedKey = UsernameToken.generateDerivedKey(STR, salt, 500); encrBuilder.setSymmetricEncAlgorithm(WSConstants.AES_128); encrBuilder.setExternalKey(derivedKey, usernameToken.getID()); encrBuilder.setCustomValueType(WSConstants.WSS_USERNAME_TOKEN_VALUE_TYPE); Document encryptedDoc = encrBuilder.build(doc, secHeader); WSSecurityUtil.prependChildElement( secHeader.getSecurityHeader(), usernameToken.getElement() ); String outputString = org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc); assertTrue(outputString.indexOf(STR) != -1); assertTrue(outputString.indexOf(STR) == -1); assertTrue(outputString.indexOf(STR) != -1); assertTrue(outputString.indexOf(STR) != -1); if (LOG.isDebugEnabled()) { LOG.debug(outputString); } try { verify(encryptedDoc); fail(STR); } catch (WSSecurityException ex) { } config.setWsiBSPCompliant(false); WSSecurityEngine newEngine = new WSSecurityEngine(); newEngine.setWssConfig(config); newEngine.processSecurityHeader(doc, null, callbackHandler, crypto); } | /**
* Unit test for creating a Username Token with an iteration value < 1000 that is used for
* deriving a key for encryption.
*/ | Unit test for creating a Username Token with an iteration value < 1000 that is used for deriving a key for encryption | testLowIterationEncryption | {
"repo_name": "fatfredyy/wss4j-ecc",
"path": "src/test/java/org/apache/ws/security/message/UTDerivedKeyTest.java",
"license": "apache-2.0",
"size": 32790
} | [
"org.apache.ws.security.WSConstants",
"org.apache.ws.security.WSSConfig",
"org.apache.ws.security.WSSecurityEngine",
"org.apache.ws.security.WSSecurityException",
"org.apache.ws.security.common.SOAPUtil",
"org.apache.ws.security.message.token.UsernameToken",
"org.apache.ws.security.util.WSSecurityUtil",
"org.w3c.dom.Document"
] | import org.apache.ws.security.WSConstants; import org.apache.ws.security.WSSConfig; import org.apache.ws.security.WSSecurityEngine; import org.apache.ws.security.WSSecurityException; import org.apache.ws.security.common.SOAPUtil; import org.apache.ws.security.message.token.UsernameToken; import org.apache.ws.security.util.WSSecurityUtil; import org.w3c.dom.Document; | import org.apache.ws.security.*; import org.apache.ws.security.common.*; import org.apache.ws.security.message.token.*; import org.apache.ws.security.util.*; import org.w3c.dom.*; | [
"org.apache.ws",
"org.w3c.dom"
] | org.apache.ws; org.w3c.dom; | 2,781,467 |
private void saveNMEALog() {
if (NMEALOG_SD) {
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
String strTime = DATE_FORMAT.format(new Date(System
.currentTimeMillis()));
File file = new File(Environment.getExternalStorageDirectory(),
NMEA_LOG_PREX + strTime + NMEA_LOG_SUFX);
FileOutputStream fileOutputStream = null;
boolean flag = true;
try {
if (!file.createNewFile()) {
Toast.makeText(this, R.string.toast_create_file_failed,
Toast.LENGTH_LONG).show();
return;
}
fileOutputStream = new FileOutputStream(file);
String nmea = ((TextView) findViewById(R.id.tv_nmea_log))
.getText().toString();
if (0 == nmea.getBytes().length) {
Toast.makeText(this, R.string.toast_no_log,
Toast.LENGTH_LONG).show();
return;
}
fileOutputStream.write(nmea.getBytes(), 0,
nmea.getBytes().length);
fileOutputStream.flush();
fileOutputStream.close();
} catch (NotFoundException e) {
Log.v("@M_" + TAG, "Save nmealog NotFoundException: "
+ e.getMessage());
flag = false;
} catch (IOException e) {
Log.v("@M_" + TAG, "Save nmealog IOException: " + e.getMessage());
flag = false;
} finally {
if (null != fileOutputStream) {
try {
fileOutputStream.close();
} catch (IOException e) {
Log.v("@M_" + TAG, "Save nmealog exception in finally: "
+ e.getMessage());
flag = false;
}
}
}
if (flag) {
Log.v("@M_" + TAG, "Save Nmealog to file Finished");
Toast.makeText(
this,
String
.format(
getString(R.string.toast_save_log_succeed_to),
Environment
.getExternalStorageDirectory()
.getAbsolutePath()),
Toast.LENGTH_LONG).show();
} else {
Log.w("@M_" + TAG, "Save Nmealog Failed");
Toast.makeText(this, R.string.toast_save_log_failed,
Toast.LENGTH_LONG).show();
}
} else {
Log.v("@M_" + TAG, "saveNMEALog function: No SD card");
Toast.makeText(this, (R.string.no_sdcard), Toast.LENGTH_LONG)
.show();
}
} else {
String strTime = DATE_FORMAT.format(new Date(System
.currentTimeMillis()));
File nmeaPath = new File(NMEALOG_PATH);
if (!nmeaPath.exists()) {
nmeaPath.mkdirs();
}
File file = new File(nmeaPath, NMEA_LOG_PREX + strTime
+ NMEA_LOG_SUFX);
if (file != null) {
FileOutputStream outs = null;
boolean flag = true;
try {
file.createNewFile();
outs = new FileOutputStream(file);
String nmea = ((TextView) findViewById(R.id.tv_nmea_log))
.getText().toString();
if (0 == nmea.getBytes().length) {
Toast.makeText(this, R.string.toast_no_log,
Toast.LENGTH_LONG).show();
return;
}
outs.write(nmea.getBytes(), 0, nmea.getBytes().length);
outs.flush();
} catch (IOException e) {
Log.v("@M_" + TAG, "Save nmealog IOException: " + e.getMessage());
flag = false;
} finally {
if (null != outs) {
try {
outs.close();
} catch (IOException e) {
Log.v("@M_" + TAG, "Save nmealog exception in finally: "
+ e.getMessage());
flag = false;
}
}
}
if (flag) {
Log.v("@M_" + TAG, "Save Nmealog to file Finished");
Toast
.makeText(
this,
String
.format(
getString(R.string.toast_save_log_succeed_to),
NMEALOG_PATH),
Toast.LENGTH_LONG).show();
} else {
Log.w("@M_" + TAG, "Save NmeaLog failed!");
Toast.makeText(this, R.string.toast_save_log_failed,
Toast.LENGTH_LONG).show();
}
}
}
} | void function() { if (NMEALOG_SD) { if (Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED)) { String strTime = DATE_FORMAT.format(new Date(System .currentTimeMillis())); File file = new File(Environment.getExternalStorageDirectory(), NMEA_LOG_PREX + strTime + NMEA_LOG_SUFX); FileOutputStream fileOutputStream = null; boolean flag = true; try { if (!file.createNewFile()) { Toast.makeText(this, R.string.toast_create_file_failed, Toast.LENGTH_LONG).show(); return; } fileOutputStream = new FileOutputStream(file); String nmea = ((TextView) findViewById(R.id.tv_nmea_log)) .getText().toString(); if (0 == nmea.getBytes().length) { Toast.makeText(this, R.string.toast_no_log, Toast.LENGTH_LONG).show(); return; } fileOutputStream.write(nmea.getBytes(), 0, nmea.getBytes().length); fileOutputStream.flush(); fileOutputStream.close(); } catch (NotFoundException e) { Log.v("@M_" + TAG, STR + e.getMessage()); flag = false; } catch (IOException e) { Log.v("@M_" + TAG, STR + e.getMessage()); flag = false; } finally { if (null != fileOutputStream) { try { fileOutputStream.close(); } catch (IOException e) { Log.v("@M_" + TAG, STR + e.getMessage()); flag = false; } } } if (flag) { Log.v("@M_" + TAG, STR); Toast.makeText( this, String .format( getString(R.string.toast_save_log_succeed_to), Environment .getExternalStorageDirectory() .getAbsolutePath()), Toast.LENGTH_LONG).show(); } else { Log.w("@M_" + TAG, STR); Toast.makeText(this, R.string.toast_save_log_failed, Toast.LENGTH_LONG).show(); } } else { Log.v("@M_" + TAG, STR); Toast.makeText(this, (R.string.no_sdcard), Toast.LENGTH_LONG) .show(); } } else { String strTime = DATE_FORMAT.format(new Date(System .currentTimeMillis())); File nmeaPath = new File(NMEALOG_PATH); if (!nmeaPath.exists()) { nmeaPath.mkdirs(); } File file = new File(nmeaPath, NMEA_LOG_PREX + strTime + NMEA_LOG_SUFX); if (file != null) { FileOutputStream outs = null; boolean flag = true; try { file.createNewFile(); outs = new FileOutputStream(file); String nmea = ((TextView) findViewById(R.id.tv_nmea_log)) .getText().toString(); if (0 == nmea.getBytes().length) { Toast.makeText(this, R.string.toast_no_log, Toast.LENGTH_LONG).show(); return; } outs.write(nmea.getBytes(), 0, nmea.getBytes().length); outs.flush(); } catch (IOException e) { Log.v("@M_" + TAG, STR + e.getMessage()); flag = false; } finally { if (null != outs) { try { outs.close(); } catch (IOException e) { Log.v("@M_" + TAG, STR + e.getMessage()); flag = false; } } } if (flag) { Log.v("@M_" + TAG, STR); Toast .makeText( this, String .format( getString(R.string.toast_save_log_succeed_to), NMEALOG_PATH), Toast.LENGTH_LONG).show(); } else { Log.w("@M_" + TAG, STR); Toast.makeText(this, R.string.toast_save_log_failed, Toast.LENGTH_LONG).show(); } } } } | /**
* Save NMEA log to file.
*/ | Save NMEA log to file | saveNMEALog | {
"repo_name": "mtk6582/android_device_lg_leon",
"path": "gps/YGPS/src/com/mediatek/ygps/YgpsActivity.java",
"license": "gpl-2.0",
"size": 104247
} | [
"android.content.res.Resources",
"android.os.Environment",
"android.util.Log",
"android.widget.TextView",
"android.widget.Toast",
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException",
"java.util.Date"
] | import android.content.res.Resources; import android.os.Environment; import android.util.Log; import android.widget.TextView; import android.widget.Toast; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Date; | import android.content.res.*; import android.os.*; import android.util.*; import android.widget.*; import java.io.*; import java.util.*; | [
"android.content",
"android.os",
"android.util",
"android.widget",
"java.io",
"java.util"
] | android.content; android.os; android.util; android.widget; java.io; java.util; | 426,927 |
public void setDatabaseConfigurationFactory(DatabaseConfigurationFactory factory) {
if (factory == null) {
throw new IllegalArgumentException("The factory cannot be null");
}
this.databaseConfigFactory = factory;
}
| void function(DatabaseConfigurationFactory factory) { if (factory == null) { throw new IllegalArgumentException(STR); } this.databaseConfigFactory = factory; } | /**
* Set the database configuration factory that should be used to get a
* {@link DatabaseConfiguration} for configuring Hibernate's session factory. By default an
* instance of {@link HibernateDatabaseConfigurationFactory} will be used.
*
* @param factory
* the factory to use. Must not be null.
*/ | Set the database configuration factory that should be used to get a <code>DatabaseConfiguration</code> for configuring Hibernate's session factory. By default an instance of <code>HibernateDatabaseConfigurationFactory</code> will be used | setDatabaseConfigurationFactory | {
"repo_name": "Communote/communote-server",
"path": "communote/core/src/main/java/com/communote/server/core/database/spring/CommunoteSessionFactoryBean.java",
"license": "apache-2.0",
"size": 5205
} | [
"com.communote.server.api.core.config.database.DatabaseConfigurationFactory"
] | import com.communote.server.api.core.config.database.DatabaseConfigurationFactory; | import com.communote.server.api.core.config.database.*; | [
"com.communote.server"
] | com.communote.server; | 2,010,578 |
public static int compare(ByteBuf bufferA, ByteBuf bufferB) {
final int aLen = bufferA.readableBytes();
final int bLen = bufferB.readableBytes();
final int minLength = Math.min(aLen, bLen);
final int uintCount = minLength >>> 2;
final int byteCount = minLength & 3;
int aIndex = bufferA.readerIndex();
int bIndex = bufferB.readerIndex();
if (uintCount > 0) {
boolean bufferAIsBigEndian = bufferA.order() == ByteOrder.BIG_ENDIAN;
final long res;
int uintCountIncrement = uintCount << 2;
if (bufferA.order() == bufferB.order()) {
res = bufferAIsBigEndian ? compareUintBigEndian(bufferA, bufferB, aIndex, bIndex, uintCountIncrement) :
compareUintLittleEndian(bufferA, bufferB, aIndex, bIndex, uintCountIncrement);
} else {
res = bufferAIsBigEndian ? compareUintBigEndianA(bufferA, bufferB, aIndex, bIndex, uintCountIncrement) :
compareUintBigEndianB(bufferA, bufferB, aIndex, bIndex, uintCountIncrement);
}
if (res != 0) {
// Ensure we not overflow when cast
return (int) Math.min(Integer.MAX_VALUE, res);
}
aIndex += uintCountIncrement;
bIndex += uintCountIncrement;
}
for (int aEnd = aIndex + byteCount; aIndex < aEnd; ++aIndex, ++bIndex) {
int comp = bufferA.getUnsignedByte(aIndex) - bufferB.getUnsignedByte(bIndex);
if (comp != 0) {
return comp;
}
}
return aLen - bLen;
} | static int function(ByteBuf bufferA, ByteBuf bufferB) { final int aLen = bufferA.readableBytes(); final int bLen = bufferB.readableBytes(); final int minLength = Math.min(aLen, bLen); final int uintCount = minLength >>> 2; final int byteCount = minLength & 3; int aIndex = bufferA.readerIndex(); int bIndex = bufferB.readerIndex(); if (uintCount > 0) { boolean bufferAIsBigEndian = bufferA.order() == ByteOrder.BIG_ENDIAN; final long res; int uintCountIncrement = uintCount << 2; if (bufferA.order() == bufferB.order()) { res = bufferAIsBigEndian ? compareUintBigEndian(bufferA, bufferB, aIndex, bIndex, uintCountIncrement) : compareUintLittleEndian(bufferA, bufferB, aIndex, bIndex, uintCountIncrement); } else { res = bufferAIsBigEndian ? compareUintBigEndianA(bufferA, bufferB, aIndex, bIndex, uintCountIncrement) : compareUintBigEndianB(bufferA, bufferB, aIndex, bIndex, uintCountIncrement); } if (res != 0) { return (int) Math.min(Integer.MAX_VALUE, res); } aIndex += uintCountIncrement; bIndex += uintCountIncrement; } for (int aEnd = aIndex + byteCount; aIndex < aEnd; ++aIndex, ++bIndex) { int comp = bufferA.getUnsignedByte(aIndex) - bufferB.getUnsignedByte(bIndex); if (comp != 0) { return comp; } } return aLen - bLen; } | /**
* Compares the two specified buffers as described in {@link ByteBuf#compareTo(ByteBuf)}.
* This method is useful when implementing a new buffer type.
*/ | Compares the two specified buffers as described in <code>ByteBuf#compareTo(ByteBuf)</code>. This method is useful when implementing a new buffer type | compare | {
"repo_name": "maliqq/netty",
"path": "buffer/src/main/java/io/netty/buffer/ByteBufUtil.java",
"license": "apache-2.0",
"size": 49167
} | [
"java.nio.ByteOrder"
] | import java.nio.ByteOrder; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,951,150 |
public static final IV fromString(final String s) {
if (s.startsWith("TermIV")) {
return TermId.fromString(s);
} else if (s.startsWith("BlobIV")) {
return BlobIV.fromString(s);
} else {
final String type = s.substring(0, s.indexOf('('));
final String val = s.substring(s.indexOf('('), s.length()-1);
final DTE dte = Enum.valueOf(DTE.class, type);
switch (dte) {
case XSDBoolean: {
final boolean b = Boolean.valueOf(val);
if (b) {
return XSDBooleanIV.TRUE;
} else {
return XSDBooleanIV.FALSE;
}
}
case XSDByte: {
final byte x = Byte.valueOf(val);
return new XSDNumericIV<BigdataLiteral>(x);
}
case XSDShort: {
final short x = Short.valueOf(val);
return new XSDNumericIV<BigdataLiteral>(x);
}
case XSDInt: {
final int x = Integer.valueOf(val);
return new XSDNumericIV<BigdataLiteral>(x);
}
case XSDLong: {
final long x = Long.valueOf(val);
return new XSDNumericIV<BigdataLiteral>(x);
}
case XSDFloat: {
final float x = Float.valueOf(val);
return new XSDNumericIV<BigdataLiteral>(x);
}
case XSDDouble: {
final double x = Double.valueOf(val);
return new XSDNumericIV<BigdataLiteral>(x);
}
case UUID: {
final UUID x = UUID.fromString(val);
return new UUIDLiteralIV<BigdataLiteral>(x);
}
case XSDInteger: {
final BigInteger x = new BigInteger(val);
return new XSDIntegerIV<BigdataLiteral>(x);
}
case XSDDecimal: {
final BigDecimal x = new BigDecimal(val);
return new XSDDecimalIV<BigdataLiteral>(x);
}
// case XSDUnsignedByte:
// keyBuilder.appendUnsigned(t.byteValue());
// break;
// case XSDUnsignedShort:
// keyBuilder.appendUnsigned(t.shortValue());
// break;
// case XSDUnsignedInt:
// keyBuilder.appendUnsigned(t.intValue());
// break;
// case XSDUnsignedLong:
// keyBuilder.appendUnsigned(t.longValue());
// break;
default:
throw new UnsupportedOperationException("dte=" + dte);
}
}
}
| static final IV function(final String s) { if (s.startsWith(STR)) { return TermId.fromString(s); } else if (s.startsWith(STR)) { return BlobIV.fromString(s); } else { final String type = s.substring(0, s.indexOf('(')); final String val = s.substring(s.indexOf('('), s.length()-1); final DTE dte = Enum.valueOf(DTE.class, type); switch (dte) { case XSDBoolean: { final boolean b = Boolean.valueOf(val); if (b) { return XSDBooleanIV.TRUE; } else { return XSDBooleanIV.FALSE; } } case XSDByte: { final byte x = Byte.valueOf(val); return new XSDNumericIV<BigdataLiteral>(x); } case XSDShort: { final short x = Short.valueOf(val); return new XSDNumericIV<BigdataLiteral>(x); } case XSDInt: { final int x = Integer.valueOf(val); return new XSDNumericIV<BigdataLiteral>(x); } case XSDLong: { final long x = Long.valueOf(val); return new XSDNumericIV<BigdataLiteral>(x); } case XSDFloat: { final float x = Float.valueOf(val); return new XSDNumericIV<BigdataLiteral>(x); } case XSDDouble: { final double x = Double.valueOf(val); return new XSDNumericIV<BigdataLiteral>(x); } case UUID: { final UUID x = UUID.fromString(val); return new UUIDLiteralIV<BigdataLiteral>(x); } case XSDInteger: { final BigInteger x = new BigInteger(val); return new XSDIntegerIV<BigdataLiteral>(x); } case XSDDecimal: { final BigDecimal x = new BigDecimal(val); return new XSDDecimalIV<BigdataLiteral>(x); } default: throw new UnsupportedOperationException("dte=" + dte); } } } | /**
* Decode an IV from its string representation as encoded by
* {@link BlobIV#toString()} and {@link AbstractInlineIV#toString()} (this
* is used by the prototype IRIS integration.)
*
* @param s
* the string representation
* @return the IV
*/ | Decode an IV from its string representation as encoded by <code>BlobIV#toString()</code> and <code>AbstractInlineIV#toString()</code> (this is used by the prototype IRIS integration.) | fromString | {
"repo_name": "smalyshev/blazegraph",
"path": "bigdata-rdf/src/java/com/bigdata/rdf/internal/IVUtility.java",
"license": "gpl-2.0",
"size": 31448
} | [
"com.bigdata.rdf.internal.impl.BlobIV",
"com.bigdata.rdf.internal.impl.TermId",
"com.bigdata.rdf.internal.impl.literal.UUIDLiteralIV",
"com.bigdata.rdf.internal.impl.literal.XSDBooleanIV",
"com.bigdata.rdf.internal.impl.literal.XSDDecimalIV",
"com.bigdata.rdf.internal.impl.literal.XSDIntegerIV",
"com.bigdata.rdf.internal.impl.literal.XSDNumericIV",
"com.bigdata.rdf.model.BigdataLiteral",
"java.math.BigDecimal",
"java.math.BigInteger",
"java.util.UUID"
] | import com.bigdata.rdf.internal.impl.BlobIV; import com.bigdata.rdf.internal.impl.TermId; import com.bigdata.rdf.internal.impl.literal.UUIDLiteralIV; import com.bigdata.rdf.internal.impl.literal.XSDBooleanIV; import com.bigdata.rdf.internal.impl.literal.XSDDecimalIV; import com.bigdata.rdf.internal.impl.literal.XSDIntegerIV; import com.bigdata.rdf.internal.impl.literal.XSDNumericIV; import com.bigdata.rdf.model.BigdataLiteral; import java.math.BigDecimal; import java.math.BigInteger; import java.util.UUID; | import com.bigdata.rdf.internal.impl.*; import com.bigdata.rdf.internal.impl.literal.*; import com.bigdata.rdf.model.*; import java.math.*; import java.util.*; | [
"com.bigdata.rdf",
"java.math",
"java.util"
] | com.bigdata.rdf; java.math; java.util; | 1,154,306 |
public void setTimeOut(String timeOut) {
this.timeOut = Val.chkStr(timeOut);
} | void function(String timeOut) { this.timeOut = Val.chkStr(timeOut); } | /**
* Sets the time out.
*
* @param timeOut the new time out
*/ | Sets the time out | setTimeOut | {
"repo_name": "GeoinformationSystems/GeoprocessingAppstore",
"path": "src/com/esri/gpt/catalog/search/SearchConfig.java",
"license": "apache-2.0",
"size": 21308
} | [
"com.esri.gpt.framework.util.Val"
] | import com.esri.gpt.framework.util.Val; | import com.esri.gpt.framework.util.*; | [
"com.esri.gpt"
] | com.esri.gpt; | 1,716,786 |
public void fill(Menu parent, int index); | void function(Menu parent, int index); | /**
* Fills the given menu with controls representing this widget.
*
* @param parent
* the parent menu
* @param index
* the index where the controls are inserted, or <code>-1</code>
* to insert at the end
*/ | Fills the given menu with controls representing this widget | fill | {
"repo_name": "AntoineDelacroix/NewSuperProject-",
"path": "org.eclipse.jface/src/org/eclipse/jface/menus/IWidget.java",
"license": "gpl-2.0",
"size": 2494
} | [
"org.eclipse.swt.widgets.Menu"
] | import org.eclipse.swt.widgets.Menu; | import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 828,857 |
public static boolean validateEncountersSectionCode(EncountersSection encountersSection, DiagnosticChain diagnostics, Map<Object, Object> context) {
if (VALIDATE_ENCOUNTERS_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(CCDPackage.Literals.ENCOUNTERS_SECTION);
try {
VALIDATE_ENCOUNTERS_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_ENCOUNTERS_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
}
catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(VALIDATE_ENCOUNTERS_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(encountersSection)) {
if (diagnostics != null) {
diagnostics.add
(new BasicDiagnostic
(Diagnostic.ERROR,
CCDValidator.DIAGNOSTIC_SOURCE,
CCDValidator.ENCOUNTERS_SECTION__ENCOUNTERS_SECTION_CODE,
CCDPlugin.INSTANCE.getString("EncountersSectionCode"),
new Object [] { encountersSection }));
}
return false;
}
return true;
}
protected static final String VALIDATE_ENCOUNTERS_SECTION_TITLE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "not self.title.oclIsUndefined()";
protected static Constraint VALIDATE_ENCOUNTERS_SECTION_TITLE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
| static boolean function(EncountersSection encountersSection, DiagnosticChain diagnostics, Map<Object, Object> context) { if (VALIDATE_ENCOUNTERS_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { OCL.Helper helper = EOCL_ENV.createOCLHelper(); helper.setContext(CCDPackage.Literals.ENCOUNTERS_SECTION); try { VALIDATE_ENCOUNTERS_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_ENCOUNTERS_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); } catch (ParserException pe) { throw new UnsupportedOperationException(pe.getLocalizedMessage()); } } if (!EOCL_ENV.createQuery(VALIDATE_ENCOUNTERS_SECTION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(encountersSection)) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, CCDValidator.DIAGNOSTIC_SOURCE, CCDValidator.ENCOUNTERS_SECTION__ENCOUNTERS_SECTION_CODE, CCDPlugin.INSTANCE.getString(STR), new Object [] { encountersSection })); } return false; } return true; } protected static final String VALIDATE_ENCOUNTERS_SECTION_TITLE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = STR; protected static Constraint VALIDATE_ENCOUNTERS_SECTION_TITLE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; | /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* not self.code.oclIsUndefined() and self.code.oclIsKindOf(datatypes::CE) and
* let value : datatypes::CE = self.code.oclAsType(datatypes::CE) in (
* value.code = '46240-8' and value.codeSystem = '2.16.840.1.113883.6.1')
* @param encountersSection The receiving '<em><b>Encounters Section</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/ | not self.code.oclIsUndefined() and self.code.oclIsKindOf(datatypes::CE) and let value : datatypes::CE = self.code.oclAsType(datatypes::CE) in ( value.code = '46240-8' and value.codeSystem = '2.16.840.1.113883.6.1') | validateEncountersSectionCode | {
"repo_name": "drbgfc/mdht",
"path": "cda/deprecated/org.openhealthtools.mdht.uml.cda.ccd/src/org/openhealthtools/mdht/uml/cda/ccd/operations/EncountersSectionOperations.java",
"license": "epl-1.0",
"size": 10523
} | [
"java.util.Map",
"org.eclipse.emf.common.util.BasicDiagnostic",
"org.eclipse.emf.common.util.Diagnostic",
"org.eclipse.emf.common.util.DiagnosticChain",
"org.eclipse.ocl.ParserException",
"org.eclipse.ocl.ecore.Constraint",
"org.openhealthtools.mdht.uml.cda.ccd.CCDPackage",
"org.openhealthtools.mdht.uml.cda.ccd.CCDPlugin",
"org.openhealthtools.mdht.uml.cda.ccd.EncountersSection",
"org.openhealthtools.mdht.uml.cda.ccd.util.CCDValidator"
] | import java.util.Map; import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.DiagnosticChain; import org.eclipse.ocl.ParserException; import org.eclipse.ocl.ecore.Constraint; import org.openhealthtools.mdht.uml.cda.ccd.CCDPackage; import org.openhealthtools.mdht.uml.cda.ccd.CCDPlugin; import org.openhealthtools.mdht.uml.cda.ccd.EncountersSection; import org.openhealthtools.mdht.uml.cda.ccd.util.CCDValidator; | import java.util.*; import org.eclipse.emf.common.util.*; import org.eclipse.ocl.*; import org.eclipse.ocl.ecore.*; import org.openhealthtools.mdht.uml.cda.ccd.*; import org.openhealthtools.mdht.uml.cda.ccd.util.*; | [
"java.util",
"org.eclipse.emf",
"org.eclipse.ocl",
"org.openhealthtools.mdht"
] | java.util; org.eclipse.emf; org.eclipse.ocl; org.openhealthtools.mdht; | 543,348 |
public LogicExpression getSection(Collection<String> variables) {
if (variables.isEmpty()) {
return null;
}
if (!getVariableNames().containsAll(variables)) {
throw new IllegalArgumentException("Unrecognised variables in request");
}
if (root instanceof Variable) {
return this;
} else if (root instanceof Or) {
if (variables.containsAll(getVariableNames())) {
return this;
} else {
throw new IllegalArgumentException("Expression " + toString() + " cannot be split");
}
} else {
And and = (And) root;
StringBuffer retval = new StringBuffer();
boolean needComma = false;
for (Node node : and.getChildren()) {
Set<String> hasVariables = new HashSet<String>();
getVariableNames(hasVariables, node);
boolean containsAll = true;
boolean containsNone = true;
for (String var : hasVariables) {
if (variables.contains(var)) {
containsNone = false;
} else {
containsAll = false;
}
}
if ((!containsNone) && (!containsAll)) {
throw new IllegalArgumentException("Expression " + node + " cannot be split");
}
if (containsAll) {
if (needComma) {
retval.append(" and ");
}
needComma = true;
retval.append("(" + node.toString() + ")");
}
}
return new LogicExpression(retval.toString());
}
} | LogicExpression function(Collection<String> variables) { if (variables.isEmpty()) { return null; } if (!getVariableNames().containsAll(variables)) { throw new IllegalArgumentException(STR); } if (root instanceof Variable) { return this; } else if (root instanceof Or) { if (variables.containsAll(getVariableNames())) { return this; } else { throw new IllegalArgumentException(STR + toString() + STR); } } else { And and = (And) root; StringBuffer retval = new StringBuffer(); boolean needComma = false; for (Node node : and.getChildren()) { Set<String> hasVariables = new HashSet<String>(); getVariableNames(hasVariables, node); boolean containsAll = true; boolean containsNone = true; for (String var : hasVariables) { if (variables.contains(var)) { containsNone = false; } else { containsAll = false; } } if ((!containsNone) && (!containsAll)) { throw new IllegalArgumentException(STR + node + STR); } if (containsAll) { if (needComma) { retval.append(STR); } needComma = true; retval.append("(" + node.toString() + ")"); } } return new LogicExpression(retval.toString()); } } | /**
* Take a Collection of String variable names, and return the part of the Logic Expression that
* contains those variables.
*
* @param variables a Collection of variable names
* @return a section of the LogicExpression
* @throws IllegalArgumentException if there are unrecognised variables, or if the expression
* cannot be split up in that way
*/ | Take a Collection of String variable names, and return the part of the Logic Expression that contains those variables | getSection | {
"repo_name": "JoeCarlson/intermine",
"path": "intermine/pathquery/main/src/org/intermine/pathquery/LogicExpression.java",
"license": "lgpl-2.1",
"size": 20378
} | [
"java.util.Collection",
"java.util.HashSet",
"java.util.Set"
] | import java.util.Collection; import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,904,100 |
int insertSelective(FormCustomFieldValueWithBLOBs record); | int insertSelective(FormCustomFieldValueWithBLOBs record); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table m_form_custom_field_value
*
* @mbggenerated Mon Sep 21 13:52:03 ICT 2015
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table m_form_custom_field_value | insertSelective | {
"repo_name": "maduhu/mycollab",
"path": "mycollab-services/src/main/java/com/esofthead/mycollab/form/dao/FormCustomFieldValueMapper.java",
"license": "agpl-3.0",
"size": 5189
} | [
"com.esofthead.mycollab.form.domain.FormCustomFieldValueWithBLOBs"
] | import com.esofthead.mycollab.form.domain.FormCustomFieldValueWithBLOBs; | import com.esofthead.mycollab.form.domain.*; | [
"com.esofthead.mycollab"
] | com.esofthead.mycollab; | 2,099,171 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.