repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
osmdroid/osmdroid | osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java | SphericalUtil.computeOffset | public static IGeoPoint computeOffset(IGeoPoint from, double distance, double heading) {
distance /= EARTH_RADIUS;
heading = toRadians(heading);
// http://williams.best.vwh.net/avform.htm#LL
double fromLat = toRadians(from.getLatitude());
double fromLng = toRadians(from.getLongitude());
double cosDistance = cos(distance);
double sinDistance = sin(distance);
double sinFromLat = sin(fromLat);
double cosFromLat = cos(fromLat);
double sinLat = cosDistance * sinFromLat + sinDistance * cosFromLat * cos(heading);
double dLng = atan2(
sinDistance * cosFromLat * sin(heading),
cosDistance - sinFromLat * sinLat);
return new GeoPoint(toDegrees(asin(sinLat)), toDegrees(fromLng + dLng));
} | java | public static IGeoPoint computeOffset(IGeoPoint from, double distance, double heading) {
distance /= EARTH_RADIUS;
heading = toRadians(heading);
// http://williams.best.vwh.net/avform.htm#LL
double fromLat = toRadians(from.getLatitude());
double fromLng = toRadians(from.getLongitude());
double cosDistance = cos(distance);
double sinDistance = sin(distance);
double sinFromLat = sin(fromLat);
double cosFromLat = cos(fromLat);
double sinLat = cosDistance * sinFromLat + sinDistance * cosFromLat * cos(heading);
double dLng = atan2(
sinDistance * cosFromLat * sin(heading),
cosDistance - sinFromLat * sinLat);
return new GeoPoint(toDegrees(asin(sinLat)), toDegrees(fromLng + dLng));
} | [
"public",
"static",
"IGeoPoint",
"computeOffset",
"(",
"IGeoPoint",
"from",
",",
"double",
"distance",
",",
"double",
"heading",
")",
"{",
"distance",
"/=",
"EARTH_RADIUS",
";",
"heading",
"=",
"toRadians",
"(",
"heading",
")",
";",
"// http://williams.best.vwh.ne... | Returns the LatLng resulting from moving a distance from an origin
in the specified heading (expressed in degrees clockwise from north).
@param from The LatLng from which to start.
@param distance The distance to travel.
@param heading The heading in degrees clockwise from north. | [
"Returns",
"the",
"LatLng",
"resulting",
"from",
"moving",
"a",
"distance",
"from",
"an",
"origin",
"in",
"the",
"specified",
"heading",
"(",
"expressed",
"in",
"degrees",
"clockwise",
"from",
"north",
")",
"."
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java#L156-L171 |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/FileWriterServices.java | FileWriterServices.getFileObjectWriter | public Writer getFileObjectWriter(String path, String filename) throws IOException {
File dir = new File(path);
if (!dir.exists()) {
dir.mkdirs();
}
return new FileWriter(new File(dir, filename));
} | java | public Writer getFileObjectWriter(String path, String filename) throws IOException {
File dir = new File(path);
if (!dir.exists()) {
dir.mkdirs();
}
return new FileWriter(new File(dir, filename));
} | [
"public",
"Writer",
"getFileObjectWriter",
"(",
"String",
"path",
",",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"!",
"dir",
".",
"exists",
"(",
")",
")",
"{",
"dir",
... | Create writer from file path/filename
@param path
@param filename
@return
@throws IOException | [
"Create",
"writer",
"from",
"file",
"path",
"/",
"filename"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/FileWriterServices.java#L87-L93 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Image.java | Image.getInstance | public static Image getInstance(PdfWriter writer, java.awt.Image awtImage, float quality) throws BadElementException, IOException {
return getInstance(new PdfContentByte(writer), awtImage, quality);
} | java | public static Image getInstance(PdfWriter writer, java.awt.Image awtImage, float quality) throws BadElementException, IOException {
return getInstance(new PdfContentByte(writer), awtImage, quality);
} | [
"public",
"static",
"Image",
"getInstance",
"(",
"PdfWriter",
"writer",
",",
"java",
".",
"awt",
".",
"Image",
"awtImage",
",",
"float",
"quality",
")",
"throws",
"BadElementException",
",",
"IOException",
"{",
"return",
"getInstance",
"(",
"new",
"PdfContentByt... | Gets an instance of a Image from a java.awt.Image.
The image is added as a JPEG with a user defined quality.
@param writer
the <CODE>PdfWriter</CODE> object to which the image will be added
@param awtImage
the <CODE>java.awt.Image</CODE> to convert
@param quality
a float value between 0 and 1
@return an object of type <CODE>PdfTemplate</CODE>
@throws BadElementException
on error
@throws IOException | [
"Gets",
"an",
"instance",
"of",
"a",
"Image",
"from",
"a",
"java",
".",
"awt",
".",
"Image",
".",
"The",
"image",
"is",
"added",
"as",
"a",
"JPEG",
"with",
"a",
"user",
"defined",
"quality",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Image.java#L811-L813 |
bazaarvoice/ostrich | core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePool.java | ServicePool.executeOnEndPoint | <R> R executeOnEndPoint(ServiceEndPoint endPoint, ServiceCallback<S, R> callback)
throws Exception {
ServiceHandle<S> handle = null;
try {
handle = _serviceCache.checkOut(endPoint);
Timer.Context timer = _callbackExecutionTime.time();
try {
return callback.call(handle.getService());
} finally {
timer.stop();
}
} catch (NoCachedInstancesAvailableException e) {
LOG.info("Service cache exhausted. End point: {}", endPoint, e);
// Don't mark an end point as bad just because there are no cached end points for it.
throw e;
} catch (Exception e) {
if (_serviceFactory.isRetriableException(e)) {
// This is a known and supported exception indicating that something went wrong somewhere in the service
// layer while trying to communicate with the end point. These errors are often transient, so we
// enqueue a health check for the end point and mark it as unavailable for the time being.
markEndPointAsBad(endPoint);
LOG.info("Bad end point discovered. End point: {}", endPoint, e);
}
throw e;
} finally {
if (handle != null) {
try {
_serviceCache.checkIn(handle);
} catch (Exception e) {
// This should never happen, but log just in case.
LOG.warn("Error returning end point to cache. End point: {}, {}",
endPoint, e.toString());
LOG.debug("Exception", e);
}
}
}
} | java | <R> R executeOnEndPoint(ServiceEndPoint endPoint, ServiceCallback<S, R> callback)
throws Exception {
ServiceHandle<S> handle = null;
try {
handle = _serviceCache.checkOut(endPoint);
Timer.Context timer = _callbackExecutionTime.time();
try {
return callback.call(handle.getService());
} finally {
timer.stop();
}
} catch (NoCachedInstancesAvailableException e) {
LOG.info("Service cache exhausted. End point: {}", endPoint, e);
// Don't mark an end point as bad just because there are no cached end points for it.
throw e;
} catch (Exception e) {
if (_serviceFactory.isRetriableException(e)) {
// This is a known and supported exception indicating that something went wrong somewhere in the service
// layer while trying to communicate with the end point. These errors are often transient, so we
// enqueue a health check for the end point and mark it as unavailable for the time being.
markEndPointAsBad(endPoint);
LOG.info("Bad end point discovered. End point: {}", endPoint, e);
}
throw e;
} finally {
if (handle != null) {
try {
_serviceCache.checkIn(handle);
} catch (Exception e) {
// This should never happen, but log just in case.
LOG.warn("Error returning end point to cache. End point: {}, {}",
endPoint, e.toString());
LOG.debug("Exception", e);
}
}
}
} | [
"<",
"R",
">",
"R",
"executeOnEndPoint",
"(",
"ServiceEndPoint",
"endPoint",
",",
"ServiceCallback",
"<",
"S",
",",
"R",
">",
"callback",
")",
"throws",
"Exception",
"{",
"ServiceHandle",
"<",
"S",
">",
"handle",
"=",
"null",
";",
"try",
"{",
"handle",
"... | Execute a callback on a specific end point.
<p/>
NOTE: This method is package private specifically so that {@link AsyncServicePool} can call it. | [
"Execute",
"a",
"callback",
"on",
"a",
"specific",
"end",
"point",
".",
"<p",
"/",
">",
"NOTE",
":",
"This",
"method",
"is",
"package",
"private",
"specifically",
"so",
"that",
"{"
] | train | https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePool.java#L295-L333 |
andi12/msbuild-maven-plugin | msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java | AbstractMSBuildPluginMojo.getRelativeFile | protected File getRelativeFile( File baseDir, File targetFile ) throws IOException
{
String baseDirStr = baseDir.getPath();
String targetDirStr = targetFile.getPath();
if ( targetDirStr.equals( baseDirStr ) )
{
return new File( "." );
}
else if ( targetDirStr.startsWith( baseDirStr + File.separator ) ) // add slash to ensure directory
{
return new File( targetDirStr.substring( baseDirStr.length() + 1 ) ); // + slash char
}
throw new IOException( "Unable to relativize " + targetDirStr + " to " + baseDir );
} | java | protected File getRelativeFile( File baseDir, File targetFile ) throws IOException
{
String baseDirStr = baseDir.getPath();
String targetDirStr = targetFile.getPath();
if ( targetDirStr.equals( baseDirStr ) )
{
return new File( "." );
}
else if ( targetDirStr.startsWith( baseDirStr + File.separator ) ) // add slash to ensure directory
{
return new File( targetDirStr.substring( baseDirStr.length() + 1 ) ); // + slash char
}
throw new IOException( "Unable to relativize " + targetDirStr + " to " + baseDir );
} | [
"protected",
"File",
"getRelativeFile",
"(",
"File",
"baseDir",
",",
"File",
"targetFile",
")",
"throws",
"IOException",
"{",
"String",
"baseDirStr",
"=",
"baseDir",
".",
"getPath",
"(",
")",
";",
"String",
"targetDirStr",
"=",
"targetFile",
".",
"getPath",
"(... | Compute the relative path portion from a path and a base directory.
If basedir and target are the same "." is returned.
For example: Given C:\foo\bar and C:\foo\bar\baz this method will return baz
@param baseDir the base directory
@param targetFile the path to express as relative to basedir
@return the relative portion of the path between basedir and target
@throws IOException if the target is not basedir or a subpath of basedir | [
"Compute",
"the",
"relative",
"path",
"portion",
"from",
"a",
"path",
"and",
"a",
"base",
"directory",
".",
"If",
"basedir",
"and",
"target",
"are",
"the",
"same",
".",
"is",
"returned",
".",
"For",
"example",
":",
"Given",
"C",
":",
"\\",
"foo",
"\\",... | train | https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L215-L230 |
Waikato/moa | moa/src/main/java/moa/clusterers/outliers/utils/mtree/MTree.java | MTree.getNearestByRange | public Query getNearestByRange(DATA queryData, double range) {
return getNearest(queryData, range, Integer.MAX_VALUE);
} | java | public Query getNearestByRange(DATA queryData, double range) {
return getNearest(queryData, range, Integer.MAX_VALUE);
} | [
"public",
"Query",
"getNearestByRange",
"(",
"DATA",
"queryData",
",",
"double",
"range",
")",
"{",
"return",
"getNearest",
"(",
"queryData",
",",
"range",
",",
"Integer",
".",
"MAX_VALUE",
")",
";",
"}"
] | Performs a nearest-neighbors query on the M-Tree, constrained by distance.
@param queryData The query data object.
@param range The maximum distance from {@code queryData} to fetched
neighbors.
@return A {@link Query} object used to iterate on the results. | [
"Performs",
"a",
"nearest",
"-",
"neighbors",
"query",
"on",
"the",
"M",
"-",
"Tree",
"constrained",
"by",
"distance",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/utils/mtree/MTree.java#L410-L412 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/crypto/digest/DigestHelper.java | DigestHelper.sha1hmac | public static String sha1hmac(String key, String plaintext, int encoding)
{
byte[] signature = sha1hmac(key.getBytes(), plaintext.getBytes());
return encode(signature, encoding);
} | java | public static String sha1hmac(String key, String plaintext, int encoding)
{
byte[] signature = sha1hmac(key.getBytes(), plaintext.getBytes());
return encode(signature, encoding);
} | [
"public",
"static",
"String",
"sha1hmac",
"(",
"String",
"key",
",",
"String",
"plaintext",
",",
"int",
"encoding",
")",
"{",
"byte",
"[",
"]",
"signature",
"=",
"sha1hmac",
"(",
"key",
".",
"getBytes",
"(",
")",
",",
"plaintext",
".",
"getBytes",
"(",
... | Performs HMAC-SHA1 on the UTF-8 byte representation of strings, returning the hexidecimal hash as a result
@param key
@param plaintext
@return | [
"Performs",
"HMAC",
"-",
"SHA1",
"on",
"the",
"UTF",
"-",
"8",
"byte",
"representation",
"of",
"strings",
"returning",
"the",
"hexidecimal",
"hash",
"as",
"a",
"result"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/crypto/digest/DigestHelper.java#L56-L61 |
cdk/cdk | storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java | CxSmilesParser.processCoords | private static boolean processCoords(CharIter iter, CxSmilesState state) {
if (state.atomCoords == null)
state.atomCoords = new ArrayList<>();
while (iter.hasNext()) {
// end of coordinate list
if (iter.curr() == ')') {
iter.next();
iter.nextIf(','); // optional
return true;
}
double x = readDouble(iter);
if (!iter.nextIf(','))
return false;
double y = readDouble(iter);
if (!iter.nextIf(','))
return false;
double z = readDouble(iter);
iter.nextIf(';');
state.coordFlag = state.coordFlag || z != 0;
state.atomCoords.add(new double[]{x, y, z});
}
return false;
} | java | private static boolean processCoords(CharIter iter, CxSmilesState state) {
if (state.atomCoords == null)
state.atomCoords = new ArrayList<>();
while (iter.hasNext()) {
// end of coordinate list
if (iter.curr() == ')') {
iter.next();
iter.nextIf(','); // optional
return true;
}
double x = readDouble(iter);
if (!iter.nextIf(','))
return false;
double y = readDouble(iter);
if (!iter.nextIf(','))
return false;
double z = readDouble(iter);
iter.nextIf(';');
state.coordFlag = state.coordFlag || z != 0;
state.atomCoords.add(new double[]{x, y, z});
}
return false;
} | [
"private",
"static",
"boolean",
"processCoords",
"(",
"CharIter",
"iter",
",",
"CxSmilesState",
"state",
")",
"{",
"if",
"(",
"state",
".",
"atomCoords",
"==",
"null",
")",
"state",
".",
"atomCoords",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"while",
... | Coordinates are written between parenthesis. The z-coord may be omitted '(0,1,),(2,3,)'.
@param iter input characters, iterator is progressed by this method
@param state output CXSMILES state
@return parse was a success (or not) | [
"Coordinates",
"are",
"written",
"between",
"parenthesis",
".",
"The",
"z",
"-",
"coord",
"may",
"be",
"omitted",
"(",
"0",
"1",
")",
"(",
"2",
"3",
")",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java#L154-L179 |
JodaOrg/joda-time | src/main/java/org/joda/time/LocalDateTime.java | LocalDateTime.withTime | public LocalDateTime withTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) {
Chronology chrono = getChronology();
long instant = getLocalMillis();
instant = chrono.hourOfDay().set(instant, hourOfDay);
instant = chrono.minuteOfHour().set(instant, minuteOfHour);
instant = chrono.secondOfMinute().set(instant, secondOfMinute);
instant = chrono.millisOfSecond().set(instant, millisOfSecond);
return withLocalMillis(instant);
} | java | public LocalDateTime withTime(int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) {
Chronology chrono = getChronology();
long instant = getLocalMillis();
instant = chrono.hourOfDay().set(instant, hourOfDay);
instant = chrono.minuteOfHour().set(instant, minuteOfHour);
instant = chrono.secondOfMinute().set(instant, secondOfMinute);
instant = chrono.millisOfSecond().set(instant, millisOfSecond);
return withLocalMillis(instant);
} | [
"public",
"LocalDateTime",
"withTime",
"(",
"int",
"hourOfDay",
",",
"int",
"minuteOfHour",
",",
"int",
"secondOfMinute",
",",
"int",
"millisOfSecond",
")",
"{",
"Chronology",
"chrono",
"=",
"getChronology",
"(",
")",
";",
"long",
"instant",
"=",
"getLocalMillis... | Returns a copy of this datetime with the specified time,
retaining the date fields.
<p>
If the time is already the time passed in, then <code>this</code> is returned.
<p>
To set a single field use the properties, for example:
<pre>
LocalDateTime set = dt.hourOfDay().setCopy(6);
</pre>
@param hourOfDay the hour of the day
@param minuteOfHour the minute of the hour
@param secondOfMinute the second of the minute
@param millisOfSecond the millisecond of the second
@return a copy of this datetime with a different time
@throws IllegalArgumentException if any value if invalid | [
"Returns",
"a",
"copy",
"of",
"this",
"datetime",
"with",
"the",
"specified",
"time",
"retaining",
"the",
"date",
"fields",
".",
"<p",
">",
"If",
"the",
"time",
"is",
"already",
"the",
"time",
"passed",
"in",
"then",
"<code",
">",
"this<",
"/",
"code",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDateTime.java#L937-L945 |
alexnederlof/Jasper-report-maven-plugin | src/main/java/com/alexnederlof/jasperreport/JasperReporter.java | JasperReporter.jrxmlFilesToCompile | protected Set<File> jrxmlFilesToCompile(SourceMapping mapping) throws MojoExecutionException {
if (!sourceDirectory.isDirectory()) {
String message = sourceDirectory.getName() + " is not a directory";
if (failOnMissingSourceDirectory) {
throw new IllegalArgumentException(message);
}
else {
log.warn(message + ", skip JasperReports reports compiling.");
return Collections.emptySet();
}
}
try {
SourceInclusionScanner scanner = createSourceInclusionScanner();
scanner.addSourceMapping(mapping);
return scanner.getIncludedSources(sourceDirectory, outputDirectory);
}
catch (InclusionScanException e) {
throw new MojoExecutionException("Error scanning source root: \'" + sourceDirectory + "\'.", e);
}
} | java | protected Set<File> jrxmlFilesToCompile(SourceMapping mapping) throws MojoExecutionException {
if (!sourceDirectory.isDirectory()) {
String message = sourceDirectory.getName() + " is not a directory";
if (failOnMissingSourceDirectory) {
throw new IllegalArgumentException(message);
}
else {
log.warn(message + ", skip JasperReports reports compiling.");
return Collections.emptySet();
}
}
try {
SourceInclusionScanner scanner = createSourceInclusionScanner();
scanner.addSourceMapping(mapping);
return scanner.getIncludedSources(sourceDirectory, outputDirectory);
}
catch (InclusionScanException e) {
throw new MojoExecutionException("Error scanning source root: \'" + sourceDirectory + "\'.", e);
}
} | [
"protected",
"Set",
"<",
"File",
">",
"jrxmlFilesToCompile",
"(",
"SourceMapping",
"mapping",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"!",
"sourceDirectory",
".",
"isDirectory",
"(",
")",
")",
"{",
"String",
"message",
"=",
"sourceDirectory",
".... | Determines source files to be compiled.
@param mapping The source files
@return set of jxml files to compile
@throws MojoExecutionException When there's trouble with the input | [
"Determines",
"source",
"files",
"to",
"be",
"compiled",
"."
] | train | https://github.com/alexnederlof/Jasper-report-maven-plugin/blob/481c50c6db360ec71693034b6b9a2c1eb63277d8/src/main/java/com/alexnederlof/jasperreport/JasperReporter.java#L229-L249 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java | SeaGlassTableUI.paintDraggedArea | private void paintDraggedArea(SeaGlassContext context, Graphics g, int rMin, int rMax, TableColumn draggedColumn, int distance) {
int draggedColumnIndex = viewIndexForColumn(draggedColumn);
Rectangle minCell = table.getCellRect(rMin, draggedColumnIndex, true);
Rectangle maxCell = table.getCellRect(rMax, draggedColumnIndex, true);
Rectangle vacatedColumnRect = minCell.union(maxCell);
// Paint a gray well in place of the moving column.
g.setColor(table.getParent().getBackground());
g.fillRect(vacatedColumnRect.x, vacatedColumnRect.y, vacatedColumnRect.width, vacatedColumnRect.height);
// Move to the where the cell has been dragged.
vacatedColumnRect.x += distance;
// Fill the background.
g.setColor(context.getStyle().getColor(context, ColorType.BACKGROUND));
g.fillRect(vacatedColumnRect.x, vacatedColumnRect.y, vacatedColumnRect.width, vacatedColumnRect.height);
SynthGraphicsUtils synthG = context.getStyle().getGraphicsUtils(context);
// Paint the vertical grid lines if necessary.
if (table.getShowVerticalLines()) {
g.setColor(table.getGridColor());
int x1 = vacatedColumnRect.x;
int y1 = vacatedColumnRect.y;
int x2 = x1 + vacatedColumnRect.width - 1;
int y2 = y1 + vacatedColumnRect.height - 1;
// Left
synthG.drawLine(context, "Table.grid", g, x1 - 1, y1, x1 - 1, y2);
// Right
synthG.drawLine(context, "Table.grid", g, x2, y1, x2, y2);
}
for (int row = rMin; row <= rMax; row++) {
// Render the cell value
Rectangle r = table.getCellRect(row, draggedColumnIndex, false);
r.x += distance;
paintCell(context, g, r, row, draggedColumnIndex);
// Paint the (lower) horizontal grid line if necessary.
if (table.getShowHorizontalLines()) {
g.setColor(table.getGridColor());
Rectangle rcr = table.getCellRect(row, draggedColumnIndex, true);
rcr.x += distance;
int x1 = rcr.x;
int y1 = rcr.y;
int x2 = x1 + rcr.width - 1;
int y2 = y1 + rcr.height - 1;
synthG.drawLine(context, "Table.grid", g, x1, y2, x2, y2);
}
}
} | java | private void paintDraggedArea(SeaGlassContext context, Graphics g, int rMin, int rMax, TableColumn draggedColumn, int distance) {
int draggedColumnIndex = viewIndexForColumn(draggedColumn);
Rectangle minCell = table.getCellRect(rMin, draggedColumnIndex, true);
Rectangle maxCell = table.getCellRect(rMax, draggedColumnIndex, true);
Rectangle vacatedColumnRect = minCell.union(maxCell);
// Paint a gray well in place of the moving column.
g.setColor(table.getParent().getBackground());
g.fillRect(vacatedColumnRect.x, vacatedColumnRect.y, vacatedColumnRect.width, vacatedColumnRect.height);
// Move to the where the cell has been dragged.
vacatedColumnRect.x += distance;
// Fill the background.
g.setColor(context.getStyle().getColor(context, ColorType.BACKGROUND));
g.fillRect(vacatedColumnRect.x, vacatedColumnRect.y, vacatedColumnRect.width, vacatedColumnRect.height);
SynthGraphicsUtils synthG = context.getStyle().getGraphicsUtils(context);
// Paint the vertical grid lines if necessary.
if (table.getShowVerticalLines()) {
g.setColor(table.getGridColor());
int x1 = vacatedColumnRect.x;
int y1 = vacatedColumnRect.y;
int x2 = x1 + vacatedColumnRect.width - 1;
int y2 = y1 + vacatedColumnRect.height - 1;
// Left
synthG.drawLine(context, "Table.grid", g, x1 - 1, y1, x1 - 1, y2);
// Right
synthG.drawLine(context, "Table.grid", g, x2, y1, x2, y2);
}
for (int row = rMin; row <= rMax; row++) {
// Render the cell value
Rectangle r = table.getCellRect(row, draggedColumnIndex, false);
r.x += distance;
paintCell(context, g, r, row, draggedColumnIndex);
// Paint the (lower) horizontal grid line if necessary.
if (table.getShowHorizontalLines()) {
g.setColor(table.getGridColor());
Rectangle rcr = table.getCellRect(row, draggedColumnIndex, true);
rcr.x += distance;
int x1 = rcr.x;
int y1 = rcr.y;
int x2 = x1 + rcr.width - 1;
int y2 = y1 + rcr.height - 1;
synthG.drawLine(context, "Table.grid", g, x1, y2, x2, y2);
}
}
} | [
"private",
"void",
"paintDraggedArea",
"(",
"SeaGlassContext",
"context",
",",
"Graphics",
"g",
",",
"int",
"rMin",
",",
"int",
"rMax",
",",
"TableColumn",
"draggedColumn",
",",
"int",
"distance",
")",
"{",
"int",
"draggedColumnIndex",
"=",
"viewIndexForColumn",
... | DOCUMENT ME!
@param context DOCUMENT ME!
@param g DOCUMENT ME!
@param rMin DOCUMENT ME!
@param rMax DOCUMENT ME!
@param draggedColumn DOCUMENT ME!
@param distance DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L883-L938 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.getMethodSignature | private static String getMethodSignature(final String returnType, final String methodName, final Class<?>[] argTypes) {
final StringBuilder sb = new StringBuilder();
if (returnType != null) {
sb.append(returnType);
sb.append(" ");
}
sb.append(methodName);
sb.append("(");
if (argTypes != null) {
for (int i = 0; i < argTypes.length; i++) {
if (i > 0) {
sb.append(", ");
}
sb.append(argTypes[i].getName());
}
}
sb.append(")");
return sb.toString();
} | java | private static String getMethodSignature(final String returnType, final String methodName, final Class<?>[] argTypes) {
final StringBuilder sb = new StringBuilder();
if (returnType != null) {
sb.append(returnType);
sb.append(" ");
}
sb.append(methodName);
sb.append("(");
if (argTypes != null) {
for (int i = 0; i < argTypes.length; i++) {
if (i > 0) {
sb.append(", ");
}
sb.append(argTypes[i].getName());
}
}
sb.append(")");
return sb.toString();
} | [
"private",
"static",
"String",
"getMethodSignature",
"(",
"final",
"String",
"returnType",
",",
"final",
"String",
"methodName",
",",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"argTypes",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
... | Creates a textual representation of the method.
@param returnType
Return type of the method - Can be <code>null</code>.
@param methodName
Name of the method - Cannot be <code>null</code>.
@param argTypes
The list of parameters - Can be <code>null</code>.
@return Textual signature of the method. | [
"Creates",
"a",
"textual",
"representation",
"of",
"the",
"method",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L700-L718 |
mgm-tp/jfunk | jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/util/CharacterSet.java | CharacterSet.createCharacterSet | public static CharacterSet createCharacterSet(final String encoding, final String goodExpression, final String badExpression,
final String characterSetId) throws UnsupportedEncodingException {
if (characterSets.get().containsKey(characterSetId)) {
LOG.info("CharacterSet with id=" + characterSetId + " already created");
return characterSets.get().get(characterSetId);
}
CharacterSet cs = new CharacterSet(encoding, goodExpression, badExpression, characterSetId);
characterSets.get().put(characterSetId, cs);
LOG.info("Added " + cs);
return cs;
} | java | public static CharacterSet createCharacterSet(final String encoding, final String goodExpression, final String badExpression,
final String characterSetId) throws UnsupportedEncodingException {
if (characterSets.get().containsKey(characterSetId)) {
LOG.info("CharacterSet with id=" + characterSetId + " already created");
return characterSets.get().get(characterSetId);
}
CharacterSet cs = new CharacterSet(encoding, goodExpression, badExpression, characterSetId);
characterSets.get().put(characterSetId, cs);
LOG.info("Added " + cs);
return cs;
} | [
"public",
"static",
"CharacterSet",
"createCharacterSet",
"(",
"final",
"String",
"encoding",
",",
"final",
"String",
"goodExpression",
",",
"final",
"String",
"badExpression",
",",
"final",
"String",
"characterSetId",
")",
"throws",
"UnsupportedEncodingException",
"{",... | Creates a new CharacterSet. If there is already a CharacterSet with the given ID this will be
returned. | [
"Creates",
"a",
"new",
"CharacterSet",
".",
"If",
"there",
"is",
"already",
"a",
"CharacterSet",
"with",
"the",
"given",
"ID",
"this",
"will",
"be",
"returned",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/util/CharacterSet.java#L228-L238 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/World.java | World.resolveDynamic | public <DEPENDENCY> DEPENDENCY resolveDynamic(final String name, final Class<DEPENDENCY> anyDependencyClass) {
return anyDependencyClass.cast(this.dynamicDependencies.get(name));
} | java | public <DEPENDENCY> DEPENDENCY resolveDynamic(final String name, final Class<DEPENDENCY> anyDependencyClass) {
return anyDependencyClass.cast(this.dynamicDependencies.get(name));
} | [
"public",
"<",
"DEPENDENCY",
">",
"DEPENDENCY",
"resolveDynamic",
"(",
"final",
"String",
"name",
",",
"final",
"Class",
"<",
"DEPENDENCY",
">",
"anyDependencyClass",
")",
"{",
"return",
"anyDependencyClass",
".",
"cast",
"(",
"this",
".",
"dynamicDependencies",
... | Answers the {@code DEPENDENCY} instance of the {@code name} named dependency.
@param name the {@code String} name of the dynamic dependency
@param anyDependencyClass the {@code Class<DEPENDENCY>}
@param <DEPENDENCY> the dependency type
@return the DEPENDENCY instance | [
"Answers",
"the",
"{"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/World.java#L393-L395 |
samskivert/samskivert | src/main/java/com/samskivert/util/CollectionUtil.java | CollectionUtil.maxList | public static <T extends Comparable<? super T>> List<T> maxList (Iterable<T> iterable)
{
return maxList(iterable, new Comparator<T>() {
public int compare (T o1, T o2) {
return o1.compareTo(o2);
}
});
} | java | public static <T extends Comparable<? super T>> List<T> maxList (Iterable<T> iterable)
{
return maxList(iterable, new Comparator<T>() {
public int compare (T o1, T o2) {
return o1.compareTo(o2);
}
});
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"List",
"<",
"T",
">",
"maxList",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"{",
"return",
"maxList",
"(",
"iterable",
",",
"new",
"Comparator",
"<",
"T",... | Return a List containing all the elements of the specified Iterable that compare as being
equal to the maximum element.
@throws NoSuchElementException if the Iterable is empty. | [
"Return",
"a",
"List",
"containing",
"all",
"the",
"elements",
"of",
"the",
"specified",
"Iterable",
"that",
"compare",
"as",
"being",
"equal",
"to",
"the",
"maximum",
"element",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/CollectionUtil.java#L123-L130 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java | MatrixFeatures_ZDRM.isHermitian | public static boolean isHermitian(ZMatrixRMaj Q , double tol ) {
if( Q.numCols != Q.numRows )
return false;
Complex_F64 a = new Complex_F64();
Complex_F64 b = new Complex_F64();
for( int i = 0; i < Q.numCols; i++ ) {
for( int j = i; j < Q.numCols; j++ ) {
Q.get(i,j,a);
Q.get(j,i,b);
if( Math.abs(a.real-b.real)>tol)
return false;
if( Math.abs(a.imaginary+b.imaginary)>tol)
return false;
}
}
return true;
} | java | public static boolean isHermitian(ZMatrixRMaj Q , double tol ) {
if( Q.numCols != Q.numRows )
return false;
Complex_F64 a = new Complex_F64();
Complex_F64 b = new Complex_F64();
for( int i = 0; i < Q.numCols; i++ ) {
for( int j = i; j < Q.numCols; j++ ) {
Q.get(i,j,a);
Q.get(j,i,b);
if( Math.abs(a.real-b.real)>tol)
return false;
if( Math.abs(a.imaginary+b.imaginary)>tol)
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isHermitian",
"(",
"ZMatrixRMaj",
"Q",
",",
"double",
"tol",
")",
"{",
"if",
"(",
"Q",
".",
"numCols",
"!=",
"Q",
".",
"numRows",
")",
"return",
"false",
";",
"Complex_F64",
"a",
"=",
"new",
"Complex_F64",
"(",
")",
";",... | <p>Hermitian matrix is a square matrix with complex entries that are equal to its own conjugate transpose.</p>
<p>a[i,j] = conj(a[j,i])</p>
@param Q The matrix being tested. Not modified.
@param tol Tolerance.
@return True if it passes the test. | [
"<p",
">",
"Hermitian",
"matrix",
"is",
"a",
"square",
"matrix",
"with",
"complex",
"entries",
"that",
"are",
"equal",
"to",
"its",
"own",
"conjugate",
"transpose",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java#L264-L284 |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java | HadoopUtils.stringToFile | public static void stringToFile(FileSystem fs, Path path, String string)
throws IOException {
OutputStream os = fs.create(path, true);
PrintWriter pw = new PrintWriter(os);
pw.append(string);
pw.close();
} | java | public static void stringToFile(FileSystem fs, Path path, String string)
throws IOException {
OutputStream os = fs.create(path, true);
PrintWriter pw = new PrintWriter(os);
pw.append(string);
pw.close();
} | [
"public",
"static",
"void",
"stringToFile",
"(",
"FileSystem",
"fs",
",",
"Path",
"path",
",",
"String",
"string",
")",
"throws",
"IOException",
"{",
"OutputStream",
"os",
"=",
"fs",
".",
"create",
"(",
"path",
",",
"true",
")",
";",
"PrintWriter",
"pw",
... | Creates a file with the given string, overwritting if needed. | [
"Creates",
"a",
"file",
"with",
"the",
"given",
"string",
"overwritting",
"if",
"needed",
"."
] | train | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java#L59-L65 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/AbstractMultiDataSetNormalizer.java | AbstractMultiDataSetNormalizer.revertLabels | public void revertLabels(@NonNull INDArray[] labels, INDArray[] labelsMask) {
for (int i = 0; i < labels.length; i++) {
INDArray mask = (labelsMask == null ? null : labelsMask[i]);
revertLabels(labels[i], mask, i);
}
} | java | public void revertLabels(@NonNull INDArray[] labels, INDArray[] labelsMask) {
for (int i = 0; i < labels.length; i++) {
INDArray mask = (labelsMask == null ? null : labelsMask[i]);
revertLabels(labels[i], mask, i);
}
} | [
"public",
"void",
"revertLabels",
"(",
"@",
"NonNull",
"INDArray",
"[",
"]",
"labels",
",",
"INDArray",
"[",
"]",
"labelsMask",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"labels",
".",
"length",
";",
"i",
"++",
")",
"{",
"INDArray"... | Undo (revert) the normalization applied by this normalizer to the labels arrays.
If labels normalization is disabled (i.e., {@link #isFitLabel()} == false) then this is a no-op.
Can also be used to undo normalization for network output arrays, in the case of regression.
@param labels Labels arrays to revert the normalization on | [
"Undo",
"(",
"revert",
")",
"the",
"normalization",
"applied",
"by",
"this",
"normalizer",
"to",
"the",
"labels",
"arrays",
".",
"If",
"labels",
"normalization",
"is",
"disabled",
"(",
"i",
".",
"e",
".",
"{",
"@link",
"#isFitLabel",
"()",
"}",
"==",
"fa... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/AbstractMultiDataSetNormalizer.java#L257-L262 |
apache/groovy | src/main/groovy/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.doInvokeMethod | private Object doInvokeMethod(String methodName, Object name, Object args) {
Reference explicitResult = new Reference();
if (checkExplicitMethod(methodName, args, explicitResult)) {
return explicitResult.get();
} else {
try {
return dispatchNodeCall(name, args);
} catch(MissingMethodException mme) {
if(mme.getMethod().equals(methodName) && methodMissingDelegate != null) {
return methodMissingDelegate.call(methodName, args);
}
throw mme;
}
}
} | java | private Object doInvokeMethod(String methodName, Object name, Object args) {
Reference explicitResult = new Reference();
if (checkExplicitMethod(methodName, args, explicitResult)) {
return explicitResult.get();
} else {
try {
return dispatchNodeCall(name, args);
} catch(MissingMethodException mme) {
if(mme.getMethod().equals(methodName) && methodMissingDelegate != null) {
return methodMissingDelegate.call(methodName, args);
}
throw mme;
}
}
} | [
"private",
"Object",
"doInvokeMethod",
"(",
"String",
"methodName",
",",
"Object",
"name",
",",
"Object",
"args",
")",
"{",
"Reference",
"explicitResult",
"=",
"new",
"Reference",
"(",
")",
";",
"if",
"(",
"checkExplicitMethod",
"(",
"methodName",
",",
"args",... | This method is the workhorse of the builder.
@param methodName the name of the method being invoked
@param name the name of the node
@param args the arguments passed into the node
@return the object from the factory | [
"This",
"method",
"is",
"the",
"workhorse",
"of",
"the",
"builder",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L782-L796 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java | SequenceMixin.countAT | public static int countAT(Sequence<NucleotideCompound> sequence) {
CompoundSet<NucleotideCompound> cs = sequence.getCompoundSet();
NucleotideCompound A = cs.getCompoundForString("A");
NucleotideCompound T = cs.getCompoundForString("T");
NucleotideCompound a = cs.getCompoundForString("a");
NucleotideCompound t = cs.getCompoundForString("t");
return countCompounds(sequence, A, T, a, t);
} | java | public static int countAT(Sequence<NucleotideCompound> sequence) {
CompoundSet<NucleotideCompound> cs = sequence.getCompoundSet();
NucleotideCompound A = cs.getCompoundForString("A");
NucleotideCompound T = cs.getCompoundForString("T");
NucleotideCompound a = cs.getCompoundForString("a");
NucleotideCompound t = cs.getCompoundForString("t");
return countCompounds(sequence, A, T, a, t);
} | [
"public",
"static",
"int",
"countAT",
"(",
"Sequence",
"<",
"NucleotideCompound",
">",
"sequence",
")",
"{",
"CompoundSet",
"<",
"NucleotideCompound",
">",
"cs",
"=",
"sequence",
".",
"getCompoundSet",
"(",
")",
";",
"NucleotideCompound",
"A",
"=",
"cs",
".",
... | Returns the count of AT in the given sequence
@param sequence The {@link NucleotideCompound} {@link Sequence} to perform
the AT analysis on
@return The number of AT compounds in the sequence | [
"Returns",
"the",
"count",
"of",
"AT",
"in",
"the",
"given",
"sequence"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/SequenceMixin.java#L97-L104 |
phax/ph-bdve | ph-bdve-ubl/src/main/java/com/helger/bdve/ubl/UBLValidation.java | UBLValidation.initUBL22 | public static void initUBL22 (@Nonnull final ValidationExecutorSetRegistry aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");
// For better error messages
LocationBeautifierSPI.addMappings (UBL22NamespaceContext.getInstance ());
final boolean bNotDeprecated = false;
for (final EUBL22DocumentType e : EUBL22DocumentType.values ())
{
final String sName = e.getLocalName ();
final VESID aVESID = new VESID (GROUP_ID, sName.toLowerCase (Locale.US), VERSION_22);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"UBL " + sName + " " + VERSION_22,
bNotDeprecated,
ValidationExecutorXSD.create (e)));
}
} | java | public static void initUBL22 (@Nonnull final ValidationExecutorSetRegistry aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");
// For better error messages
LocationBeautifierSPI.addMappings (UBL22NamespaceContext.getInstance ());
final boolean bNotDeprecated = false;
for (final EUBL22DocumentType e : EUBL22DocumentType.values ())
{
final String sName = e.getLocalName ();
final VESID aVESID = new VESID (GROUP_ID, sName.toLowerCase (Locale.US), VERSION_22);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"UBL " + sName + " " + VERSION_22,
bNotDeprecated,
ValidationExecutorXSD.create (e)));
}
} | [
"public",
"static",
"void",
"initUBL22",
"(",
"@",
"Nonnull",
"final",
"ValidationExecutorSetRegistry",
"aRegistry",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aRegistry",
",",
"\"Registry\"",
")",
";",
"// For better error messages",
"LocationBeautifierSPI",
".",... | Register all standard UBL 2.2 validation execution sets to the provided
registry.
@param aRegistry
The registry to add the artefacts. May not be <code>null</code>. | [
"Register",
"all",
"standard",
"UBL",
"2",
".",
"2",
"validation",
"execution",
"sets",
"to",
"the",
"provided",
"registry",
"."
] | train | https://github.com/phax/ph-bdve/blob/2438f491174cd8989567fcdf129b273bd217e89f/ph-bdve-ubl/src/main/java/com/helger/bdve/ubl/UBLValidation.java#L398-L417 |
joniles/mpxj | src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java | ConceptDrawProjectReader.readTasks | private void readTasks(Document cdp)
{
//
// Sort the projects into the correct order
//
List<Project> projects = new ArrayList<Project>(cdp.getProjects().getProject());
final AlphanumComparator comparator = new AlphanumComparator();
Collections.sort(projects, new Comparator<Project>()
{
@Override public int compare(Project o1, Project o2)
{
return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber());
}
});
for (Project project : cdp.getProjects().getProject())
{
readProject(project);
}
} | java | private void readTasks(Document cdp)
{
//
// Sort the projects into the correct order
//
List<Project> projects = new ArrayList<Project>(cdp.getProjects().getProject());
final AlphanumComparator comparator = new AlphanumComparator();
Collections.sort(projects, new Comparator<Project>()
{
@Override public int compare(Project o1, Project o2)
{
return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber());
}
});
for (Project project : cdp.getProjects().getProject())
{
readProject(project);
}
} | [
"private",
"void",
"readTasks",
"(",
"Document",
"cdp",
")",
"{",
"//",
"// Sort the projects into the correct order",
"//",
"List",
"<",
"Project",
">",
"projects",
"=",
"new",
"ArrayList",
"<",
"Project",
">",
"(",
"cdp",
".",
"getProjects",
"(",
")",
".",
... | Read the projects from a ConceptDraw PROJECT file as top level tasks.
@param cdp ConceptDraw PROJECT file | [
"Read",
"the",
"projects",
"from",
"a",
"ConceptDraw",
"PROJECT",
"file",
"as",
"top",
"level",
"tasks",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L323-L343 |
datacleaner/DataCleaner | desktop/api/src/main/java/org/datacleaner/widgets/properties/FormPanel.java | FormPanel.addFormEntry | public void addFormEntry(String mainLabelText, final String minorLabelText, final JComponent component) {
if (!mainLabelText.endsWith(":")) {
mainLabelText += ":";
}
final DCLabel mainLabel = DCLabel.dark(mainLabelText);
mainLabel.setFont(WidgetUtils.FONT_NORMAL);
mainLabel.setBorder(new EmptyBorder(6, 0, 0, 0));
final JXLabel minorLabel;
if (StringUtils.isNullOrEmpty(minorLabelText)) {
minorLabel = null;
} else {
mainLabel.setToolTipText(minorLabelText);
minorLabel = new JXLabel(minorLabelText);
minorLabel.setLineWrap(true);
minorLabel.setFont(WidgetUtils.FONT_SMALL);
minorLabel.setBorder(new EmptyBorder(0, 4, 0, 0));
minorLabel.setVerticalAlignment(JXLabel.TOP);
minorLabel.setPreferredSize(new Dimension(FIELD_LABEL_WIDTH - 4, 0));
}
addFormEntry(mainLabel, minorLabel, component);
} | java | public void addFormEntry(String mainLabelText, final String minorLabelText, final JComponent component) {
if (!mainLabelText.endsWith(":")) {
mainLabelText += ":";
}
final DCLabel mainLabel = DCLabel.dark(mainLabelText);
mainLabel.setFont(WidgetUtils.FONT_NORMAL);
mainLabel.setBorder(new EmptyBorder(6, 0, 0, 0));
final JXLabel minorLabel;
if (StringUtils.isNullOrEmpty(minorLabelText)) {
minorLabel = null;
} else {
mainLabel.setToolTipText(minorLabelText);
minorLabel = new JXLabel(minorLabelText);
minorLabel.setLineWrap(true);
minorLabel.setFont(WidgetUtils.FONT_SMALL);
minorLabel.setBorder(new EmptyBorder(0, 4, 0, 0));
minorLabel.setVerticalAlignment(JXLabel.TOP);
minorLabel.setPreferredSize(new Dimension(FIELD_LABEL_WIDTH - 4, 0));
}
addFormEntry(mainLabel, minorLabel, component);
} | [
"public",
"void",
"addFormEntry",
"(",
"String",
"mainLabelText",
",",
"final",
"String",
"minorLabelText",
",",
"final",
"JComponent",
"component",
")",
"{",
"if",
"(",
"!",
"mainLabelText",
".",
"endsWith",
"(",
"\":\"",
")",
")",
"{",
"mainLabelText",
"+=",... | Adds a form entry to the panel
@param mainLabelText
@param minorLabelText
@param component | [
"Adds",
"a",
"form",
"entry",
"to",
"the",
"panel"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/properties/FormPanel.java#L67-L91 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.loadBalancing_serviceName_stickiness_POST | public OvhLoadBalancingTask loadBalancing_serviceName_stickiness_POST(String serviceName, OvhLoadBalancingStickinessEnum stickiness) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/stickiness";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "stickiness", stickiness);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhLoadBalancingTask.class);
} | java | public OvhLoadBalancingTask loadBalancing_serviceName_stickiness_POST(String serviceName, OvhLoadBalancingStickinessEnum stickiness) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/stickiness";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "stickiness", stickiness);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhLoadBalancingTask.class);
} | [
"public",
"OvhLoadBalancingTask",
"loadBalancing_serviceName_stickiness_POST",
"(",
"String",
"serviceName",
",",
"OvhLoadBalancingStickinessEnum",
"stickiness",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/loadBalancing/{serviceName}/stickiness\"",
";",
"Str... | Set Stickiness type. 'ipSource' will stick clients to a backend by their source ip, 'cookie' will stick them by inserting a cookie, 'none' is to set no stickiness
REST: POST /ip/loadBalancing/{serviceName}/stickiness
@param stickiness [required] The stickiness you want on your IP LoadBalancing
@param serviceName [required] The internal name of your IP load balancing | [
"Set",
"Stickiness",
"type",
".",
"ipSource",
"will",
"stick",
"clients",
"to",
"a",
"backend",
"by",
"their",
"source",
"ip",
"cookie",
"will",
"stick",
"them",
"by",
"inserting",
"a",
"cookie",
"none",
"is",
"to",
"set",
"no",
"stickiness"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1568-L1575 |
wcm-io/wcm-io-sling | commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java | RequestParam.getInt | public static int getInt(@NotNull ServletRequest request, @NotNull String param, int defaultValue) {
String value = request.getParameter(param);
return NumberUtils.toInt(value, defaultValue);
} | java | public static int getInt(@NotNull ServletRequest request, @NotNull String param, int defaultValue) {
String value = request.getParameter(param);
return NumberUtils.toInt(value, defaultValue);
} | [
"public",
"static",
"int",
"getInt",
"(",
"@",
"NotNull",
"ServletRequest",
"request",
",",
"@",
"NotNull",
"String",
"param",
",",
"int",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"request",
".",
"getParameter",
"(",
"param",
")",
";",
"return",
"... | Returns a request parameter as integer.
@param request Request.
@param param Parameter name.
@param defaultValue Default value.
@return Parameter value or default value if it does not exist or is not a number. | [
"Returns",
"a",
"request",
"parameter",
"as",
"integer",
"."
] | train | https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L156-L159 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseSaxpyi | public static int cusparseSaxpyi(
cusparseHandle handle,
int nnz,
Pointer alpha,
Pointer xVal,
Pointer xInd,
Pointer y,
int idxBase)
{
return checkResult(cusparseSaxpyiNative(handle, nnz, alpha, xVal, xInd, y, idxBase));
} | java | public static int cusparseSaxpyi(
cusparseHandle handle,
int nnz,
Pointer alpha,
Pointer xVal,
Pointer xInd,
Pointer y,
int idxBase)
{
return checkResult(cusparseSaxpyiNative(handle, nnz, alpha, xVal, xInd, y, idxBase));
} | [
"public",
"static",
"int",
"cusparseSaxpyi",
"(",
"cusparseHandle",
"handle",
",",
"int",
"nnz",
",",
"Pointer",
"alpha",
",",
"Pointer",
"xVal",
",",
"Pointer",
"xInd",
",",
"Pointer",
"y",
",",
"int",
"idxBase",
")",
"{",
"return",
"checkResult",
"(",
"c... | Description: Addition of a scalar multiple of a sparse vector x
and a dense vector y. | [
"Description",
":",
"Addition",
"of",
"a",
"scalar",
"multiple",
"of",
"a",
"sparse",
"vector",
"x",
"and",
"a",
"dense",
"vector",
"y",
"."
] | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L641-L651 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/LexiconEntry.java | LexiconEntry.parseLexiconEntry | public static LexiconEntry parseLexiconEntry(String lexiconLine) {
String[] parts = getCsvParser().parseLine(lexiconLine);
// Add the lexicon word sequence to the lexicon.
String wordPart = parts[0];
List<String> words = Lists.newArrayList();
String[] wordArray = wordPart.split(" ");
for (int i = 0; i < wordArray.length; i++) {
words.add(wordArray[i].intern());
}
CcgCategory category = CcgCategory.parseFrom(ArrayUtils.copyOfRange(parts, 1, parts.length));
return new LexiconEntry(words, category);
} | java | public static LexiconEntry parseLexiconEntry(String lexiconLine) {
String[] parts = getCsvParser().parseLine(lexiconLine);
// Add the lexicon word sequence to the lexicon.
String wordPart = parts[0];
List<String> words = Lists.newArrayList();
String[] wordArray = wordPart.split(" ");
for (int i = 0; i < wordArray.length; i++) {
words.add(wordArray[i].intern());
}
CcgCategory category = CcgCategory.parseFrom(ArrayUtils.copyOfRange(parts, 1, parts.length));
return new LexiconEntry(words, category);
} | [
"public",
"static",
"LexiconEntry",
"parseLexiconEntry",
"(",
"String",
"lexiconLine",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"getCsvParser",
"(",
")",
".",
"parseLine",
"(",
"lexiconLine",
")",
";",
"// Add the lexicon word sequence to the lexicon.",
"String",
... | Parses a line of a CCG lexicon into a lexicon entry. The expected format is
a comma separated tuple:
<code>
(space delimited word list),(syntactic type),(list of variable assignments and unfilled semantic dependencies)
</code>
The final two components of the list represent the CCG category. Examples:
<code>
baseball player,N{0},0 baseball_player
in,((N{1}\N{1}){0}/N{2}){0},0 concept:locatedIn,concept:locatedIn 1 1,concept:locatedIn 2 2
</code>
@param lexiconLine
@return | [
"Parses",
"a",
"line",
"of",
"a",
"CCG",
"lexicon",
"into",
"a",
"lexicon",
"entry",
".",
"The",
"expected",
"format",
"is",
"a",
"comma",
"separated",
"tuple",
":",
"<code",
">",
"(",
"space",
"delimited",
"word",
"list",
")",
"(",
"syntactic",
"type",
... | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/LexiconEntry.java#L54-L67 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java | StyleCache.setFeatureStyle | public boolean setFeatureStyle(MarkerOptions markerOptions, FeatureRow featureRow) {
return StyleUtils.setFeatureStyle(markerOptions, featureStyleExtension, featureRow, density, iconCache);
} | java | public boolean setFeatureStyle(MarkerOptions markerOptions, FeatureRow featureRow) {
return StyleUtils.setFeatureStyle(markerOptions, featureStyleExtension, featureRow, density, iconCache);
} | [
"public",
"boolean",
"setFeatureStyle",
"(",
"MarkerOptions",
"markerOptions",
",",
"FeatureRow",
"featureRow",
")",
"{",
"return",
"StyleUtils",
".",
"setFeatureStyle",
"(",
"markerOptions",
",",
"featureStyleExtension",
",",
"featureRow",
",",
"density",
",",
"iconC... | Set the feature row style (icon or style) into the marker options
@param markerOptions marker options
@param featureRow feature row
@return true if icon or style was set into the marker options | [
"Set",
"the",
"feature",
"row",
"style",
"(",
"icon",
"or",
"style",
")",
"into",
"the",
"marker",
"options"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java#L135-L137 |
gitblit/fathom | fathom-security/src/main/java/fathom/realm/Account.java | Account.checkPermissions | public void checkPermissions(String... permissions) throws AuthorizationException {
if (!isPermittedAll(permissions)) {
throw new AuthorizationException("'{}' does not have the permissions {}", toString(), Arrays.toString(permissions));
}
} | java | public void checkPermissions(String... permissions) throws AuthorizationException {
if (!isPermittedAll(permissions)) {
throw new AuthorizationException("'{}' does not have the permissions {}", toString(), Arrays.toString(permissions));
}
} | [
"public",
"void",
"checkPermissions",
"(",
"String",
"...",
"permissions",
")",
"throws",
"AuthorizationException",
"{",
"if",
"(",
"!",
"isPermittedAll",
"(",
"permissions",
")",
")",
"{",
"throw",
"new",
"AuthorizationException",
"(",
"\"'{}' does not have the permi... | Ensures this Account
{@link fathom.authz.Permission#implies(fathom.authz.Permission) implies} all of the
specified permission strings.
<p>
If this Account's existing associated permissions do not
{@link fathom.authz.Permission#implies(fathom.authz.Permission) imply} all of the given permissions,
an {@link fathom.authz.AuthorizationException} will be thrown.
<p>
This is an overloaded method for the corresponding type-safe {@link fathom.authz.Permission Permission} variant.
Please see the class-level JavaDoc for more information on these String-based permission methods.
@param permissions the string representations of Permissions to check.
@throws AuthorizationException if this Account does not have all of the given permissions. | [
"Ensures",
"this",
"Account",
"{",
"@link",
"fathom",
".",
"authz",
".",
"Permission#implies",
"(",
"fathom",
".",
"authz",
".",
"Permission",
")",
"implies",
"}",
"all",
"of",
"the",
"specified",
"permission",
"strings",
".",
"<p",
">",
"If",
"this",
"Acc... | train | https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-security/src/main/java/fathom/realm/Account.java#L329-L333 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/AbstractSequentialList.java | AbstractSequentialList.addAll | public boolean addAll(int index, Collection<? extends E> c) {
try {
boolean modified = false;
ListIterator<E> e1 = listIterator(index);
Iterator<? extends E> e2 = c.iterator();
while (e2.hasNext()) {
e1.add(e2.next());
modified = true;
}
return modified;
} catch (NoSuchElementException exc) {
throw new IndexOutOfBoundsException("Index: "+index);
}
} | java | public boolean addAll(int index, Collection<? extends E> c) {
try {
boolean modified = false;
ListIterator<E> e1 = listIterator(index);
Iterator<? extends E> e2 = c.iterator();
while (e2.hasNext()) {
e1.add(e2.next());
modified = true;
}
return modified;
} catch (NoSuchElementException exc) {
throw new IndexOutOfBoundsException("Index: "+index);
}
} | [
"public",
"boolean",
"addAll",
"(",
"int",
"index",
",",
"Collection",
"<",
"?",
"extends",
"E",
">",
"c",
")",
"{",
"try",
"{",
"boolean",
"modified",
"=",
"false",
";",
"ListIterator",
"<",
"E",
">",
"e1",
"=",
"listIterator",
"(",
"index",
")",
";... | Inserts all of the elements in the specified collection into this
list at the specified position (optional operation). Shifts the
element currently at that position (if any) and any subsequent
elements to the right (increases their indices). The new elements
will appear in this list in the order that they are returned by the
specified collection's iterator. The behavior of this operation is
undefined if the specified collection is modified while the
operation is in progress. (Note that this will occur if the specified
collection is this list, and it's nonempty.)
<p>This implementation gets an iterator over the specified collection and
a list iterator over this list pointing to the indexed element (with
<tt>listIterator(index)</tt>). Then, it iterates over the specified
collection, inserting the elements obtained from the iterator into this
list, one at a time, using <tt>ListIterator.add</tt> followed by
<tt>ListIterator.next</tt> (to skip over the added element).
<p>Note that this implementation will throw an
<tt>UnsupportedOperationException</tt> if the list iterator returned by
the <tt>listIterator</tt> method does not implement the <tt>add</tt>
operation.
@throws UnsupportedOperationException {@inheritDoc}
@throws ClassCastException {@inheritDoc}
@throws NullPointerException {@inheritDoc}
@throws IllegalArgumentException {@inheritDoc}
@throws IndexOutOfBoundsException {@inheritDoc} | [
"Inserts",
"all",
"of",
"the",
"elements",
"in",
"the",
"specified",
"collection",
"into",
"this",
"list",
"at",
"the",
"specified",
"position",
"(",
"optional",
"operation",
")",
".",
"Shifts",
"the",
"element",
"currently",
"at",
"that",
"position",
"(",
"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/AbstractSequentialList.java#L212-L225 |
spring-projects/spring-security-oauth | spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/filter/OAuthConsumerContextFilter.java | OAuthConsumerContextFilter.getUserAuthorizationRedirectURL | protected String getUserAuthorizationRedirectURL(ProtectedResourceDetails details, OAuthConsumerToken requestToken, String callbackURL) {
try {
String baseURL = details.getUserAuthorizationURL();
StringBuilder builder = new StringBuilder(baseURL);
char appendChar = baseURL.indexOf('?') < 0 ? '?' : '&';
builder.append(appendChar).append("oauth_token=");
builder.append(URLEncoder.encode(requestToken.getValue(), "UTF-8"));
if (!details.isUse10a()) {
builder.append('&').append("oauth_callback=");
builder.append(URLEncoder.encode(callbackURL, "UTF-8"));
}
return builder.toString();
}
catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
} | java | protected String getUserAuthorizationRedirectURL(ProtectedResourceDetails details, OAuthConsumerToken requestToken, String callbackURL) {
try {
String baseURL = details.getUserAuthorizationURL();
StringBuilder builder = new StringBuilder(baseURL);
char appendChar = baseURL.indexOf('?') < 0 ? '?' : '&';
builder.append(appendChar).append("oauth_token=");
builder.append(URLEncoder.encode(requestToken.getValue(), "UTF-8"));
if (!details.isUse10a()) {
builder.append('&').append("oauth_callback=");
builder.append(URLEncoder.encode(callbackURL, "UTF-8"));
}
return builder.toString();
}
catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
} | [
"protected",
"String",
"getUserAuthorizationRedirectURL",
"(",
"ProtectedResourceDetails",
"details",
",",
"OAuthConsumerToken",
"requestToken",
",",
"String",
"callbackURL",
")",
"{",
"try",
"{",
"String",
"baseURL",
"=",
"details",
".",
"getUserAuthorizationURL",
"(",
... | Get the URL to which to redirect the user for authorization of protected resources.
@param details The resource for which to get the authorization url.
@param requestToken The request token.
@param callbackURL The callback URL.
@return The URL. | [
"Get",
"the",
"URL",
"to",
"which",
"to",
"redirect",
"the",
"user",
"for",
"authorization",
"of",
"protected",
"resources",
"."
] | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/filter/OAuthConsumerContextFilter.java#L302-L318 |
js-lib-com/template.xhtml | src/main/java/js/template/xhtml/IfOperator.java | IfOperator.doExec | @Override
protected Object doExec(Element element, Object scope, String expression, Object... arguments) throws TemplateException {
ConditionalExpression conditionalExpression = new ConditionalExpression(content, scope, expression);
return conditionalExpression.value();
} | java | @Override
protected Object doExec(Element element, Object scope, String expression, Object... arguments) throws TemplateException {
ConditionalExpression conditionalExpression = new ConditionalExpression(content, scope, expression);
return conditionalExpression.value();
} | [
"@",
"Override",
"protected",
"Object",
"doExec",
"(",
"Element",
"element",
",",
"Object",
"scope",
",",
"String",
"expression",
",",
"Object",
"...",
"arguments",
")",
"throws",
"TemplateException",
"{",
"ConditionalExpression",
"conditionalExpression",
"=",
"new"... | Execute IF operator. Evaluate given <code>expression</code> and return evaluation result. Returned value acts as branch
enabled flag.
@param element context element, unused,
@param scope scope object,
@param expression conditional expression,
@param arguments optional arguments, not used.
@return true if <code>element</code> and all its descendants should be included in processed document.
@throws TemplateException if content value is undefined. | [
"Execute",
"IF",
"operator",
".",
"Evaluate",
"given",
"<code",
">",
"expression<",
"/",
"code",
">",
"and",
"return",
"evaluation",
"result",
".",
"Returned",
"value",
"acts",
"as",
"branch",
"enabled",
"flag",
"."
] | train | https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/IfOperator.java#L69-L73 |
SimplicityApks/ReminderDatePicker | lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java | DateSpinner.setMaxDate | public void setMaxDate(@Nullable Calendar maxDate) {
this.maxDate = maxDate;
// update the date picker (even if it is not used right now)
if(maxDate == null)
datePickerDialog.setMaxDate(null);
else if(minDate != null && compareCalendarDates(minDate, maxDate) > 0)
throw new IllegalArgumentException("Maximum date must be after minimum date!");
else
datePickerDialog.setMaxDate(new CalendarDay(maxDate));
updateEnabledItems();
} | java | public void setMaxDate(@Nullable Calendar maxDate) {
this.maxDate = maxDate;
// update the date picker (even if it is not used right now)
if(maxDate == null)
datePickerDialog.setMaxDate(null);
else if(minDate != null && compareCalendarDates(minDate, maxDate) > 0)
throw new IllegalArgumentException("Maximum date must be after minimum date!");
else
datePickerDialog.setMaxDate(new CalendarDay(maxDate));
updateEnabledItems();
} | [
"public",
"void",
"setMaxDate",
"(",
"@",
"Nullable",
"Calendar",
"maxDate",
")",
"{",
"this",
".",
"maxDate",
"=",
"maxDate",
";",
"// update the date picker (even if it is not used right now)",
"if",
"(",
"maxDate",
"==",
"null",
")",
"datePickerDialog",
".",
"set... | Sets the maximum allowed date.
Spinner items and dates in the date picker after the given date will get disabled.
@param maxDate The maximum date, or null to clear the previous max date. | [
"Sets",
"the",
"maximum",
"allowed",
"date",
".",
"Spinner",
"items",
"and",
"dates",
"in",
"the",
"date",
"picker",
"after",
"the",
"given",
"date",
"will",
"get",
"disabled",
"."
] | train | https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L384-L394 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/ChatApi.java | ChatApi.removeFromConference | public ApiSuccessResponse removeFromConference(String id, RemoveFromConferenceData removeFromConferenceData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = removeFromConferenceWithHttpInfo(id, removeFromConferenceData);
return resp.getData();
} | java | public ApiSuccessResponse removeFromConference(String id, RemoveFromConferenceData removeFromConferenceData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = removeFromConferenceWithHttpInfo(id, removeFromConferenceData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"removeFromConference",
"(",
"String",
"id",
",",
"RemoveFromConferenceData",
"removeFromConferenceData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"removeFromConferenceWithHttpInfo",
"(",
... | Remove an agent from a chat conference
Remove the specified agent from the chat conference.
@param id The ID of the chat interaction. (required)
@param removeFromConferenceData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Remove",
"an",
"agent",
"from",
"a",
"chat",
"conference",
"Remove",
"the",
"specified",
"agent",
"from",
"the",
"chat",
"conference",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L1318-L1321 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java | SpiderTransaction.addShardedLinkValue | public void addShardedLinkValue(String ownerObjID, FieldDefinition linkDef, String targetObjID, int targetShardNo) {
assert linkDef.isSharded();
assert targetShardNo > 0;
addColumn(SpiderService.termsStoreName(linkDef.getTableDef()),
SpiderService.shardedLinkTermRowKey(linkDef, ownerObjID, targetShardNo),
targetObjID);
} | java | public void addShardedLinkValue(String ownerObjID, FieldDefinition linkDef, String targetObjID, int targetShardNo) {
assert linkDef.isSharded();
assert targetShardNo > 0;
addColumn(SpiderService.termsStoreName(linkDef.getTableDef()),
SpiderService.shardedLinkTermRowKey(linkDef, ownerObjID, targetShardNo),
targetObjID);
} | [
"public",
"void",
"addShardedLinkValue",
"(",
"String",
"ownerObjID",
",",
"FieldDefinition",
"linkDef",
",",
"String",
"targetObjID",
",",
"int",
"targetShardNo",
")",
"{",
"assert",
"linkDef",
".",
"isSharded",
"(",
")",
";",
"assert",
"targetShardNo",
">",
"0... | Add a link value column on behalf of the given owner object, referencing the given
target object ID. This is used when a link is sharded and the owner's shard number
is > 0. The link value column is added to a special term record.
@param ownerObjID Object ID of object owns the link field.
@param linkDef {@link FieldDefinition} of the link field.
@param targetObjID Referenced (target) object ID (owning table is sharded).
@param targetShardNo Shard number of the target object. Must be > 0. | [
"Add",
"a",
"link",
"value",
"column",
"on",
"behalf",
"of",
"the",
"given",
"owner",
"object",
"referencing",
"the",
"given",
"target",
"object",
"ID",
".",
"This",
"is",
"used",
"when",
"a",
"link",
"is",
"sharded",
"and",
"the",
"owner",
"s",
"shard",... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L284-L290 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.getVpnclientIpsecParameters | public VpnClientIPsecParametersInner getVpnclientIpsecParameters(String resourceGroupName, String virtualNetworkGatewayName) {
return getVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | java | public VpnClientIPsecParametersInner getVpnclientIpsecParameters(String resourceGroupName, String virtualNetworkGatewayName) {
return getVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | [
"public",
"VpnClientIPsecParametersInner",
"getVpnclientIpsecParameters",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"getVpnclientIpsecParametersWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayNa... | The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The virtual network gateway name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VpnClientIPsecParametersInner object if successful. | [
"The",
"Get",
"VpnclientIpsecParameters",
"operation",
"retrieves",
"information",
"about",
"the",
"vpnclient",
"ipsec",
"policy",
"for",
"P2S",
"client",
"of",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"through",
"Network",
"re... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2826-L2828 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_task_id_relaunch_POST | public void zone_zoneName_task_id_relaunch_POST(String zoneName, Long id) throws IOException {
String qPath = "/domain/zone/{zoneName}/task/{id}/relaunch";
StringBuilder sb = path(qPath, zoneName, id);
exec(qPath, "POST", sb.toString(), null);
} | java | public void zone_zoneName_task_id_relaunch_POST(String zoneName, Long id) throws IOException {
String qPath = "/domain/zone/{zoneName}/task/{id}/relaunch";
StringBuilder sb = path(qPath, zoneName, id);
exec(qPath, "POST", sb.toString(), null);
} | [
"public",
"void",
"zone_zoneName_task_id_relaunch_POST",
"(",
"String",
"zoneName",
",",
"Long",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/task/{id}/relaunch\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
"... | Relaunch the task
REST: POST /domain/zone/{zoneName}/task/{id}/relaunch
@param zoneName [required] The internal name of your zone
@param id [required] Id of the object | [
"Relaunch",
"the",
"task"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L763-L767 |
grails/grails-core | grails-web-databinding/src/main/groovy/grails/web/databinding/DataBindingUtils.java | DataBindingUtils.bindToCollection | public static <T> void bindToCollection(final Class<T> targetType, final Collection<T> collectionToPopulate, final CollectionDataBindingSource collectionBindingSource) throws InstantiationException, IllegalAccessException {
final GrailsApplication application = Holders.findApplication();
PersistentEntity entity = null;
if (application != null) {
try {
entity = application.getMappingContext().getPersistentEntity(targetType.getClass().getName());
} catch (GrailsConfigurationException e) {
//no-op
}
}
final List<DataBindingSource> dataBindingSources = collectionBindingSource.getDataBindingSources();
for(final DataBindingSource dataBindingSource : dataBindingSources) {
final T newObject = targetType.newInstance();
bindObjectToDomainInstance(entity, newObject, dataBindingSource, getBindingIncludeList(newObject), Collections.emptyList(), null);
collectionToPopulate.add(newObject);
}
} | java | public static <T> void bindToCollection(final Class<T> targetType, final Collection<T> collectionToPopulate, final CollectionDataBindingSource collectionBindingSource) throws InstantiationException, IllegalAccessException {
final GrailsApplication application = Holders.findApplication();
PersistentEntity entity = null;
if (application != null) {
try {
entity = application.getMappingContext().getPersistentEntity(targetType.getClass().getName());
} catch (GrailsConfigurationException e) {
//no-op
}
}
final List<DataBindingSource> dataBindingSources = collectionBindingSource.getDataBindingSources();
for(final DataBindingSource dataBindingSource : dataBindingSources) {
final T newObject = targetType.newInstance();
bindObjectToDomainInstance(entity, newObject, dataBindingSource, getBindingIncludeList(newObject), Collections.emptyList(), null);
collectionToPopulate.add(newObject);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"bindToCollection",
"(",
"final",
"Class",
"<",
"T",
">",
"targetType",
",",
"final",
"Collection",
"<",
"T",
">",
"collectionToPopulate",
",",
"final",
"CollectionDataBindingSource",
"collectionBindingSource",
")",
"thro... | For each DataBindingSource provided by collectionBindingSource a new instance of targetType is created,
data binding is imposed on that instance with the DataBindingSource and the instance is added to the end of
collectionToPopulate
@param targetType The type of objects to create, must be a concrete class
@param collectionToPopulate A collection to populate with new instances of targetType
@param collectionBindingSource A CollectionDataBindingSource
@since 2.3 | [
"For",
"each",
"DataBindingSource",
"provided",
"by",
"collectionBindingSource",
"a",
"new",
"instance",
"of",
"targetType",
"is",
"created",
"data",
"binding",
"is",
"imposed",
"on",
"that",
"instance",
"with",
"the",
"DataBindingSource",
"and",
"the",
"instance",
... | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-databinding/src/main/groovy/grails/web/databinding/DataBindingUtils.java#L164-L180 |
xqbase/util | util/src/main/java/com/xqbase/util/Bytes.java | Bytes.toShort | public static int toShort(byte[] b, int off, boolean littleEndian) {
if (littleEndian) {
return ((b[off] & 0xFF) | ((b[off + 1] & 0xFF) << 8));
}
return (((b[off] & 0xFF) << 8) | (b[off + 1] & 0xFF));
} | java | public static int toShort(byte[] b, int off, boolean littleEndian) {
if (littleEndian) {
return ((b[off] & 0xFF) | ((b[off + 1] & 0xFF) << 8));
}
return (((b[off] & 0xFF) << 8) | (b[off + 1] & 0xFF));
} | [
"public",
"static",
"int",
"toShort",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"boolean",
"littleEndian",
")",
"{",
"if",
"(",
"littleEndian",
")",
"{",
"return",
"(",
"(",
"b",
"[",
"off",
"]",
"&",
"0xFF",
")",
"|",
"(",
"(",
"b",
... | Retrieve a <b>short</b> from a byte array in a given byte order | [
"Retrieve",
"a",
"<b",
">",
"short<",
"/",
"b",
">",
"from",
"a",
"byte",
"array",
"in",
"a",
"given",
"byte",
"order"
] | train | https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Bytes.java#L194-L199 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java | IOUtil.closeOnComplete | public static <S extends Closeable> void closeOnComplete(S stream, StreamTask<S> task) {
closeOnComplete(stream, task, DEFAULT_ERROR_HANDLER);
} | java | public static <S extends Closeable> void closeOnComplete(S stream, StreamTask<S> task) {
closeOnComplete(stream, task, DEFAULT_ERROR_HANDLER);
} | [
"public",
"static",
"<",
"S",
"extends",
"Closeable",
">",
"void",
"closeOnComplete",
"(",
"S",
"stream",
",",
"StreamTask",
"<",
"S",
">",
"task",
")",
"{",
"closeOnComplete",
"(",
"stream",
",",
"task",
",",
"DEFAULT_ERROR_HANDLER",
")",
";",
"}"
] | Helper method to run a specified task and automatically handle the closing of the stream.
@param stream
@param task | [
"Helper",
"method",
"to",
"run",
"a",
"specified",
"task",
"and",
"automatically",
"handle",
"the",
"closing",
"of",
"the",
"stream",
"."
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java#L229-L231 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/logging/hpel/LogRecordContext.java | LogRecordContext.registerExtension | public static void registerExtension(String key, Extension extension) {
if (key == null || extension == null) {
throw new IllegalArgumentException(
"Neither 'key' nor 'extension' parameter can be null.");
}
w.lock();
try {
if (extensionMap.containsKey(key)) {
throw new IllegalArgumentException("Extension with the key "
+ key + " is registered already");
}
extensionMap.put(key, new WeakReference<Extension>(extension));
} finally {
w.unlock();
}
} | java | public static void registerExtension(String key, Extension extension) {
if (key == null || extension == null) {
throw new IllegalArgumentException(
"Neither 'key' nor 'extension' parameter can be null.");
}
w.lock();
try {
if (extensionMap.containsKey(key)) {
throw new IllegalArgumentException("Extension with the key "
+ key + " is registered already");
}
extensionMap.put(key, new WeakReference<Extension>(extension));
} finally {
w.unlock();
}
} | [
"public",
"static",
"void",
"registerExtension",
"(",
"String",
"key",
",",
"Extension",
"extension",
")",
"{",
"if",
"(",
"key",
"==",
"null",
"||",
"extension",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Neither 'key' nor 'exte... | Registers new context extension. To avoid memory leaks Extensions are
stored as weak references. It means that caller need to keep strong
reference (a static field for example) to keep that extension in the
registration map.
@param key
String key to associate with the registered extension
@param extension
{@link Extension} implementation returning extension runtime
values
@throws IllegalArgumentException
if parameter <code>key</code> or <code>extension</code> are
<code>null</code>; or if <code>key</code> already has
extension associated with it. | [
"Registers",
"new",
"context",
"extension",
".",
"To",
"avoid",
"memory",
"leaks",
"Extensions",
"are",
"stored",
"as",
"weak",
"references",
".",
"It",
"means",
"that",
"caller",
"need",
"to",
"keep",
"strong",
"reference",
"(",
"a",
"static",
"field",
"for... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/logging/hpel/LogRecordContext.java#L241-L256 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java | ElemTemplateElement.getNamespaceForPrefix | public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context)
{
this.error(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, null);
return null;
} | java | public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context)
{
this.error(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, null);
return null;
} | [
"public",
"String",
"getNamespaceForPrefix",
"(",
"String",
"prefix",
",",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"context",
")",
"{",
"this",
".",
"error",
"(",
"XSLTErrorResources",
".",
"ER_CANT_RESOLVE_NSPREFIX",
",",
"null",
")",
";",
"return",
"nu... | Fullfill the PrefixResolver interface. Calling this for this class
will throw an error.
@param prefix The prefix to look up, which may be an empty string ("")
for the default Namespace.
@param context The node context from which to look up the URI.
@return null if the error listener does not choose to throw an exception. | [
"Fullfill",
"the",
"PrefixResolver",
"interface",
".",
"Calling",
"this",
"for",
"this",
"class",
"will",
"throw",
"an",
"error",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java#L887-L892 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.getIterationPerformance | public IterationPerformance getIterationPerformance(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) {
return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, getIterationPerformanceOptionalParameter).toBlocking().single().body();
} | java | public IterationPerformance getIterationPerformance(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) {
return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, getIterationPerformanceOptionalParameter).toBlocking().single().body();
} | [
"public",
"IterationPerformance",
"getIterationPerformance",
"(",
"UUID",
"projectId",
",",
"UUID",
"iterationId",
",",
"GetIterationPerformanceOptionalParameter",
"getIterationPerformanceOptionalParameter",
")",
"{",
"return",
"getIterationPerformanceWithServiceResponseAsync",
"(",
... | Get detailed performance information about an iteration.
@param projectId The id of the project the iteration belongs to
@param iterationId The id of the iteration to get
@param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the IterationPerformance object if successful. | [
"Get",
"detailed",
"performance",
"information",
"about",
"an",
"iteration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1616-L1618 |
qspin/qtaste | plugins_src/javagui-fx/src/main/java/com/qspin/qtaste/javaguifx/server/StructureAnalyzer.java | StructureAnalyzer.executeCommand | @Override
Object executeCommand(int timeout, String componentName, Object... data) throws QTasteException {
try {
prepareWriter(data[0].toString());
for (Window window : getDisplayableWindows()) {
analyzeComponent(window, 1);
}
mWriter.write("</root>");
mWriter.flush();
mWriter.close();
} catch (IOException e) {
throw new QTasteTestFailException("Error saving to file" + data[0].toString() + ":", e);
}
return null;
} | java | @Override
Object executeCommand(int timeout, String componentName, Object... data) throws QTasteException {
try {
prepareWriter(data[0].toString());
for (Window window : getDisplayableWindows()) {
analyzeComponent(window, 1);
}
mWriter.write("</root>");
mWriter.flush();
mWriter.close();
} catch (IOException e) {
throw new QTasteTestFailException("Error saving to file" + data[0].toString() + ":", e);
}
return null;
} | [
"@",
"Override",
"Object",
"executeCommand",
"(",
"int",
"timeout",
",",
"String",
"componentName",
",",
"Object",
"...",
"data",
")",
"throws",
"QTasteException",
"{",
"try",
"{",
"prepareWriter",
"(",
"data",
"[",
"0",
"]",
".",
"toString",
"(",
")",
")"... | Analyze the structure of a java application and save it in the specified filename in the current working directory.
@return null | [
"Analyze",
"the",
"structure",
"of",
"a",
"java",
"application",
"and",
"save",
"it",
"in",
"the",
"specified",
"filename",
"in",
"the",
"current",
"working",
"directory",
"."
] | train | https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/plugins_src/javagui-fx/src/main/java/com/qspin/qtaste/javaguifx/server/StructureAnalyzer.java#L46-L61 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.expectMax | public void expectMax(String name, double maxLength) {
expectMax(name, maxLength, messages.get(Validation.MAX_KEY.name(), name, maxLength));
} | java | public void expectMax(String name, double maxLength) {
expectMax(name, maxLength, messages.get(Validation.MAX_KEY.name(), name, maxLength));
} | [
"public",
"void",
"expectMax",
"(",
"String",
"name",
",",
"double",
"maxLength",
")",
"{",
"expectMax",
"(",
"name",
",",
"maxLength",
",",
"messages",
".",
"get",
"(",
"Validation",
".",
"MAX_KEY",
".",
"name",
"(",
")",
",",
"name",
",",
"maxLength",
... | Validates a given field to have a maximum length
@param maxLength The maximum length
@param name The field to check | [
"Validates",
"a",
"given",
"field",
"to",
"have",
"a",
"maximum",
"length"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L116-L118 |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java | EntityUtils.getTypedValue | public static Object getTypedValue(String valueStr, Attribute attr) {
// Reference types cannot be processed because we lack an entityManager in this route.
if (EntityTypeUtils.isReferenceType(attr)) {
throw new MolgenisDataException(
"getTypedValue(String, AttributeMetadata) can't be used for attributes referencing entities");
}
return getTypedValue(valueStr, attr, null);
} | java | public static Object getTypedValue(String valueStr, Attribute attr) {
// Reference types cannot be processed because we lack an entityManager in this route.
if (EntityTypeUtils.isReferenceType(attr)) {
throw new MolgenisDataException(
"getTypedValue(String, AttributeMetadata) can't be used for attributes referencing entities");
}
return getTypedValue(valueStr, attr, null);
} | [
"public",
"static",
"Object",
"getTypedValue",
"(",
"String",
"valueStr",
",",
"Attribute",
"attr",
")",
"{",
"// Reference types cannot be processed because we lack an entityManager in this route.",
"if",
"(",
"EntityTypeUtils",
".",
"isReferenceType",
"(",
"attr",
")",
")... | Convert a string value to a typed value based on a non-entity-referencing attribute data type.
@param valueStr string value
@param attr non-entity-referencing attribute
@return typed value
@throws MolgenisDataException if attribute references another entity | [
"Convert",
"a",
"string",
"value",
"to",
"a",
"typed",
"value",
"based",
"on",
"a",
"non",
"-",
"entity",
"-",
"referencing",
"attribute",
"data",
"type",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/util/EntityUtils.java#L38-L45 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java | AmazonS3Client.setBucketAcl | public void setBucketAcl(String bucketName, AccessControlList acl,
RequestMetricCollector requestMetricCollector) {
SetBucketAclRequest request = new SetBucketAclRequest(bucketName, acl)
.withRequestMetricCollector(requestMetricCollector);
setBucketAcl(request);
} | java | public void setBucketAcl(String bucketName, AccessControlList acl,
RequestMetricCollector requestMetricCollector) {
SetBucketAclRequest request = new SetBucketAclRequest(bucketName, acl)
.withRequestMetricCollector(requestMetricCollector);
setBucketAcl(request);
} | [
"public",
"void",
"setBucketAcl",
"(",
"String",
"bucketName",
",",
"AccessControlList",
"acl",
",",
"RequestMetricCollector",
"requestMetricCollector",
")",
"{",
"SetBucketAclRequest",
"request",
"=",
"new",
"SetBucketAclRequest",
"(",
"bucketName",
",",
"acl",
")",
... | Same as {@link #setBucketAcl(String, AccessControlList)}
but allows specifying a request metric collector. | [
"Same",
"as",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L1239-L1244 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/datamodel/Type.java | Type.hasAccess | public boolean hasAccess(final Instance _instance,
final AccessType _accessType)
throws EFapsException
{
return hasAccess(_instance, _accessType, null);
} | java | public boolean hasAccess(final Instance _instance,
final AccessType _accessType)
throws EFapsException
{
return hasAccess(_instance, _accessType, null);
} | [
"public",
"boolean",
"hasAccess",
"(",
"final",
"Instance",
"_instance",
",",
"final",
"AccessType",
"_accessType",
")",
"throws",
"EFapsException",
"{",
"return",
"hasAccess",
"(",
"_instance",
",",
"_accessType",
",",
"null",
")",
";",
"}"
] | Checks, if the current context user has all access defined in the list of
access types for the given instance.
@param _instance instance for which the access must be checked
@param _accessType list of access types which must be checked
@throws EFapsException on error
@return true if user has access, else false | [
"Checks",
"if",
"the",
"current",
"context",
"user",
"has",
"all",
"access",
"defined",
"in",
"the",
"list",
"of",
"access",
"types",
"for",
"the",
"given",
"instance",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Type.java#L697-L702 |
lkwg82/enforcer-rules | src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java | RequirePluginVersions.resolvePlugin | protected Plugin resolvePlugin( Plugin plugin, MavenProject project )
{
@SuppressWarnings( "unchecked" )
List<ArtifactRepository> pluginRepositories = project.getPluginArtifactRepositories();
Artifact artifact =
factory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(),
VersionRange.createFromVersion( "LATEST" ) );
try
{
this.resolver.resolve( artifact, pluginRepositories, this.local );
plugin.setVersion( artifact.getVersion() );
}
catch ( ArtifactResolutionException e )
{
}
catch ( ArtifactNotFoundException e )
{
}
return plugin;
} | java | protected Plugin resolvePlugin( Plugin plugin, MavenProject project )
{
@SuppressWarnings( "unchecked" )
List<ArtifactRepository> pluginRepositories = project.getPluginArtifactRepositories();
Artifact artifact =
factory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(),
VersionRange.createFromVersion( "LATEST" ) );
try
{
this.resolver.resolve( artifact, pluginRepositories, this.local );
plugin.setVersion( artifact.getVersion() );
}
catch ( ArtifactResolutionException e )
{
}
catch ( ArtifactNotFoundException e )
{
}
return plugin;
} | [
"protected",
"Plugin",
"resolvePlugin",
"(",
"Plugin",
"plugin",
",",
"MavenProject",
"project",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"ArtifactRepository",
">",
"pluginRepositories",
"=",
"project",
".",
"getPluginArtifactReposito... | Resolve plugin.
@param plugin the plugin
@param project the project
@return the plugin | [
"Resolve",
"plugin",
"."
] | train | https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java#L554-L576 |
mapbox/mapbox-plugins-android | plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java | BuildingPlugin.initLayer | private void initLayer(String belowLayer) {
light = style.getLight();
fillExtrusionLayer = new FillExtrusionLayer(LAYER_ID, "composite");
fillExtrusionLayer.setSourceLayer("building");
fillExtrusionLayer.setMinZoom(minZoomLevel);
fillExtrusionLayer.setProperties(
visibility(visible ? VISIBLE : NONE),
fillExtrusionColor(color),
fillExtrusionHeight(
interpolate(
exponential(1f),
zoom(),
stop(15, literal(0)),
stop(16, get("height"))
)
),
fillExtrusionOpacity(opacity)
);
addLayer(fillExtrusionLayer, belowLayer);
} | java | private void initLayer(String belowLayer) {
light = style.getLight();
fillExtrusionLayer = new FillExtrusionLayer(LAYER_ID, "composite");
fillExtrusionLayer.setSourceLayer("building");
fillExtrusionLayer.setMinZoom(minZoomLevel);
fillExtrusionLayer.setProperties(
visibility(visible ? VISIBLE : NONE),
fillExtrusionColor(color),
fillExtrusionHeight(
interpolate(
exponential(1f),
zoom(),
stop(15, literal(0)),
stop(16, get("height"))
)
),
fillExtrusionOpacity(opacity)
);
addLayer(fillExtrusionLayer, belowLayer);
} | [
"private",
"void",
"initLayer",
"(",
"String",
"belowLayer",
")",
"{",
"light",
"=",
"style",
".",
"getLight",
"(",
")",
";",
"fillExtrusionLayer",
"=",
"new",
"FillExtrusionLayer",
"(",
"LAYER_ID",
",",
"\"composite\"",
")",
";",
"fillExtrusionLayer",
".",
"s... | Initialises and adds the fill extrusion layer used by this plugin.
@param belowLayer optionally place the buildings layer below a provided layer id | [
"Initialises",
"and",
"adds",
"the",
"fill",
"extrusion",
"layer",
"used",
"by",
"this",
"plugin",
"."
] | train | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java#L101-L120 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java | NotificationsApi.disconnectWithHttpInfo | public ApiResponse<Void> disconnectWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = disconnectValidateBeforeCall(null, null);
return apiClient.execute(call);
} | java | public ApiResponse<Void> disconnectWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = disconnectValidateBeforeCall(null, null);
return apiClient.execute(call);
} | [
"public",
"ApiResponse",
"<",
"Void",
">",
"disconnectWithHttpInfo",
"(",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"disconnectValidateBeforeCall",
"(",
"null",
",",
"null",
")",
";",
"return",
"apiCli... | CometD disconnect
CometD disconnect, see https://docs.cometd.org/current/reference/#_bayeux_meta_disconnect
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"CometD",
"disconnect",
"CometD",
"disconnect",
"see",
"https",
":",
"//",
"docs",
".",
"cometd",
".",
"org",
"/",
"current",
"/",
"reference",
"/",
"#_bayeux_meta_disconnect"
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java#L237-L240 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java | FileSystemView.createDirectory | public Directory createDirectory(JimfsPath path, FileAttribute<?>... attrs) throws IOException {
return (Directory) createFile(path, store.directoryCreator(), true, attrs);
} | java | public Directory createDirectory(JimfsPath path, FileAttribute<?>... attrs) throws IOException {
return (Directory) createFile(path, store.directoryCreator(), true, attrs);
} | [
"public",
"Directory",
"createDirectory",
"(",
"JimfsPath",
"path",
",",
"FileAttribute",
"<",
"?",
">",
"...",
"attrs",
")",
"throws",
"IOException",
"{",
"return",
"(",
"Directory",
")",
"createFile",
"(",
"path",
",",
"store",
".",
"directoryCreator",
"(",
... | Creates a new directory at the given path. The given attributes will be set on the new file if
possible. | [
"Creates",
"a",
"new",
"directory",
"at",
"the",
"given",
"path",
".",
"The",
"given",
"attributes",
"will",
"be",
"set",
"on",
"the",
"new",
"file",
"if",
"possible",
"."
] | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L224-L226 |
wkgcass/Style | src/main/java/net/cassite/style/aggregation/MapFuncSup.java | MapFuncSup.forEach | public <R> R forEach(def<R> func) {
return forThose((k, v) -> true, func);
} | java | public <R> R forEach(def<R> func) {
return forThose((k, v) -> true, func);
} | [
"public",
"<",
"R",
">",
"R",
"forEach",
"(",
"def",
"<",
"R",
">",
"func",
")",
"{",
"return",
"forThose",
"(",
"(",
"k",
",",
"v",
")",
"->",
"true",
",",
"func",
")",
";",
"}"
] | define a function to deal with each entry in the map
@param func a function returns 'last loop result'
@return return 'last loop value'.<br>
check
<a href="https://github.com/wkgcass/Style/">tutorial</a> for
more info about 'last loop value' | [
"define",
"a",
"function",
"to",
"deal",
"with",
"each",
"entry",
"in",
"the",
"map"
] | train | https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/MapFuncSup.java#L96-L98 |
VoltDB/voltdb | src/frontend/org/voltdb/compiler/PlannerTool.java | PlannerTool.planSqlCore | public synchronized CompiledPlan planSqlCore(String sql, StatementPartitioning partitioning) {
TrivialCostModel costModel = new TrivialCostModel();
DatabaseEstimates estimates = new DatabaseEstimates();
CompiledPlan plan = null;
// This try-with-resources block acquires a global lock on all planning
// This is required until we figure out how to do parallel planning.
try (QueryPlanner planner = new QueryPlanner(
sql, "PlannerTool", "PlannerToolProc", m_database,
partitioning, m_hsql, estimates, !VoltCompiler.DEBUG_MODE,
costModel, null, null, DeterminismMode.FASTER, false)) {
// do the expensive full planning.
planner.parse();
plan = planner.plan();
assert(plan != null);
}
catch (Exception e) {
/*
* Don't log PlanningErrorExceptions or HSQLParseExceptions, as they
* are at least somewhat expected.
*/
String loggedMsg = "";
if (!(e instanceof PlanningErrorException || e instanceof HSQLParseException)) {
logException(e, "Error compiling query");
loggedMsg = " (Stack trace has been written to the log.)";
}
if (e.getMessage() != null) {
throw new RuntimeException("SQL error while compiling query: " + e.getMessage() + loggedMsg, e);
}
throw new RuntimeException("SQL error while compiling query: " + e.toString() + loggedMsg, e);
}
if (plan == null) {
throw new RuntimeException("Null plan received in PlannerTool.planSql");
}
return plan;
} | java | public synchronized CompiledPlan planSqlCore(String sql, StatementPartitioning partitioning) {
TrivialCostModel costModel = new TrivialCostModel();
DatabaseEstimates estimates = new DatabaseEstimates();
CompiledPlan plan = null;
// This try-with-resources block acquires a global lock on all planning
// This is required until we figure out how to do parallel planning.
try (QueryPlanner planner = new QueryPlanner(
sql, "PlannerTool", "PlannerToolProc", m_database,
partitioning, m_hsql, estimates, !VoltCompiler.DEBUG_MODE,
costModel, null, null, DeterminismMode.FASTER, false)) {
// do the expensive full planning.
planner.parse();
plan = planner.plan();
assert(plan != null);
}
catch (Exception e) {
/*
* Don't log PlanningErrorExceptions or HSQLParseExceptions, as they
* are at least somewhat expected.
*/
String loggedMsg = "";
if (!(e instanceof PlanningErrorException || e instanceof HSQLParseException)) {
logException(e, "Error compiling query");
loggedMsg = " (Stack trace has been written to the log.)";
}
if (e.getMessage() != null) {
throw new RuntimeException("SQL error while compiling query: " + e.getMessage() + loggedMsg, e);
}
throw new RuntimeException("SQL error while compiling query: " + e.toString() + loggedMsg, e);
}
if (plan == null) {
throw new RuntimeException("Null plan received in PlannerTool.planSql");
}
return plan;
} | [
"public",
"synchronized",
"CompiledPlan",
"planSqlCore",
"(",
"String",
"sql",
",",
"StatementPartitioning",
"partitioning",
")",
"{",
"TrivialCostModel",
"costModel",
"=",
"new",
"TrivialCostModel",
"(",
")",
";",
"DatabaseEstimates",
"estimates",
"=",
"new",
"Databa... | Stripped down compile that is ONLY used to plan default procedures. | [
"Stripped",
"down",
"compile",
"that",
"is",
"ONLY",
"used",
"to",
"plan",
"default",
"procedures",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/PlannerTool.java#L147-L185 |
ben-manes/caffeine | jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java | EventDispatcher.publishCreated | public void publishCreated(Cache<K, V> cache, K key, V value) {
publish(cache, EventType.CREATED, key, /* newValue */ null, value, /* quiet */ false);
} | java | public void publishCreated(Cache<K, V> cache, K key, V value) {
publish(cache, EventType.CREATED, key, /* newValue */ null, value, /* quiet */ false);
} | [
"public",
"void",
"publishCreated",
"(",
"Cache",
"<",
"K",
",",
"V",
">",
"cache",
",",
"K",
"key",
",",
"V",
"value",
")",
"{",
"publish",
"(",
"cache",
",",
"EventType",
".",
"CREATED",
",",
"key",
",",
"/* newValue */",
"null",
",",
"value",
",",... | Publishes a creation event for the entry to all of the interested listeners.
@param cache the cache where the entry was created
@param key the entry's key
@param value the entry's value | [
"Publishes",
"a",
"creation",
"event",
"for",
"the",
"entry",
"to",
"all",
"of",
"the",
"interested",
"listeners",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L113-L115 |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrQuery.java | CmsSolrQuery.addFilterQuery | public void addFilterQuery(String fieldName, List<String> vals, boolean all, boolean useQuotes) {
if (getFilterQueries() != null) {
for (String fq : getFilterQueries()) {
if (fq.startsWith(fieldName + ":")) {
removeFilterQuery(fq);
}
}
}
addFilterQuery(createFilterQuery(fieldName, vals, all, useQuotes));
} | java | public void addFilterQuery(String fieldName, List<String> vals, boolean all, boolean useQuotes) {
if (getFilterQueries() != null) {
for (String fq : getFilterQueries()) {
if (fq.startsWith(fieldName + ":")) {
removeFilterQuery(fq);
}
}
}
addFilterQuery(createFilterQuery(fieldName, vals, all, useQuotes));
} | [
"public",
"void",
"addFilterQuery",
"(",
"String",
"fieldName",
",",
"List",
"<",
"String",
">",
"vals",
",",
"boolean",
"all",
",",
"boolean",
"useQuotes",
")",
"{",
"if",
"(",
"getFilterQueries",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
... | Creates and adds a filter query.<p>
@param fieldName the field name to create a filter query on
@param vals the values that should match for the given field
@param all <code>true</code> to combine the given values with 'AND', <code>false</code> for 'OR'
@param useQuotes <code>true</code> to surround the given values with double quotes, <code>false</code> otherwise | [
"Creates",
"and",
"adds",
"a",
"filter",
"query",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrQuery.java#L206-L216 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java | StyleUtils.setFeatureStyle | public static boolean setFeatureStyle(MarkerOptions markerOptions, FeatureStyle featureStyle, float density) {
return setFeatureStyle(markerOptions, featureStyle, density, null);
} | java | public static boolean setFeatureStyle(MarkerOptions markerOptions, FeatureStyle featureStyle, float density) {
return setFeatureStyle(markerOptions, featureStyle, density, null);
} | [
"public",
"static",
"boolean",
"setFeatureStyle",
"(",
"MarkerOptions",
"markerOptions",
",",
"FeatureStyle",
"featureStyle",
",",
"float",
"density",
")",
"{",
"return",
"setFeatureStyle",
"(",
"markerOptions",
",",
"featureStyle",
",",
"density",
",",
"null",
")",... | Set the feature style (icon or style) into the marker options
@param markerOptions marker options
@param featureStyle feature style
@param density display density: {@link android.util.DisplayMetrics#density}
@return true if icon or style was set into the marker options | [
"Set",
"the",
"feature",
"style",
"(",
"icon",
"or",
"style",
")",
"into",
"the",
"marker",
"options"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L184-L186 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java | CompositeTextWatcher.addWatcher | public void addWatcher(int id, TextWatcher watcher, boolean enabled){
mWatchers.put(id, watcher);
mEnabledKeys.put(id, enabled);
} | java | public void addWatcher(int id, TextWatcher watcher, boolean enabled){
mWatchers.put(id, watcher);
mEnabledKeys.put(id, enabled);
} | [
"public",
"void",
"addWatcher",
"(",
"int",
"id",
",",
"TextWatcher",
"watcher",
",",
"boolean",
"enabled",
")",
"{",
"mWatchers",
".",
"put",
"(",
"id",
",",
"watcher",
")",
";",
"mEnabledKeys",
".",
"put",
"(",
"id",
",",
"enabled",
")",
";",
"}"
] | Add a {@link TextWatcher} with a specified Id and whether or not it is enabled by default
@param id the id of the {@link TextWatcher} to add
@param watcher the {@link TextWatcher} to add
@param enabled whether or not it is enabled by default | [
"Add",
"a",
"{",
"@link",
"TextWatcher",
"}",
"with",
"a",
"specified",
"Id",
"and",
"whether",
"or",
"not",
"it",
"is",
"enabled",
"by",
"default"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java#L109-L112 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java | TypeToStringUtils.toStringType | @SuppressWarnings("PMD.UseStringBufferForStringAppends")
public static String toStringType(final Type type, final Map<String, Type> generics) {
final String res;
if (type instanceof Class) {
res = processClass((Class) type);
} else if (type instanceof ParameterizedType) {
res = processParametrizedType((ParameterizedType) type, generics);
} else if (type instanceof GenericArrayType) {
res = toStringType(((GenericArrayType) type).getGenericComponentType(), generics) + "[]";
} else if (type instanceof WildcardType) {
res = processWildcardType((WildcardType) type, generics);
} else if (type instanceof ExplicitTypeVariable) {
// print generic name (only when PrintableGenericsMap used)
res = type.toString();
} else {
// deep generics nesting case
// when PrintableGenericsMap used and generics is not known, will print generic name (see above)
res = toStringType(declaredGeneric((TypeVariable) type, generics), generics);
}
return res;
} | java | @SuppressWarnings("PMD.UseStringBufferForStringAppends")
public static String toStringType(final Type type, final Map<String, Type> generics) {
final String res;
if (type instanceof Class) {
res = processClass((Class) type);
} else if (type instanceof ParameterizedType) {
res = processParametrizedType((ParameterizedType) type, generics);
} else if (type instanceof GenericArrayType) {
res = toStringType(((GenericArrayType) type).getGenericComponentType(), generics) + "[]";
} else if (type instanceof WildcardType) {
res = processWildcardType((WildcardType) type, generics);
} else if (type instanceof ExplicitTypeVariable) {
// print generic name (only when PrintableGenericsMap used)
res = type.toString();
} else {
// deep generics nesting case
// when PrintableGenericsMap used and generics is not known, will print generic name (see above)
res = toStringType(declaredGeneric((TypeVariable) type, generics), generics);
}
return res;
} | [
"@",
"SuppressWarnings",
"(",
"\"PMD.UseStringBufferForStringAppends\"",
")",
"public",
"static",
"String",
"toStringType",
"(",
"final",
"Type",
"type",
",",
"final",
"Map",
"<",
"String",
",",
"Type",
">",
"generics",
")",
"{",
"final",
"String",
"res",
";",
... | Prints type as string. E.g. {@code toStringType(ParameterizedType(List, String), [:]) == "List<String>"},
{@code toStringType(WildcardType(String), [:]) == "? extends String" }.
<p>
If {@link ParameterizedType} is inner class and contains information about outer generics, it will be printed
as {@code Outer<Generics>.Inner<Generics>} in order to indicate all available information.
In other cases outer class is not indicated.
@param type type to convert to string
@param generics type class generics type
@return string representation of provided type
@throws UnknownGenericException when found generic not declared on type (e.g. method generic)
@see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names
@see #toStringTypeIgnoringVariables(Type) shortcut to print Object instead of not known generic
@see #toStringType(Type) shortcut for types without variables | [
"Prints",
"type",
"as",
"string",
".",
"E",
".",
"g",
".",
"{",
"@code",
"toStringType",
"(",
"ParameterizedType",
"(",
"List",
"String",
")",
"[",
":",
"]",
")",
"==",
"List<String",
">",
"}",
"{",
"@code",
"toStringType",
"(",
"WildcardType",
"(",
"S... | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java#L69-L89 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.exportDevicesAsync | public ServiceFuture<JobResponseInner> exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters, final ServiceCallback<JobResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters), serviceCallback);
} | java | public ServiceFuture<JobResponseInner> exportDevicesAsync(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters, final ServiceCallback<JobResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"JobResponseInner",
">",
"exportDevicesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"ExportDevicesRequest",
"exportDevicesParameters",
",",
"final",
"ServiceCallback",
"<",
"JobResponseInner",
">",
"serviceC... | Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param exportDevicesParameters The parameters that specify the export devices operation.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Exports",
"all",
"the",
"device",
"identities",
"in",
"the",
"IoT",
"hub",
"identity",
"registry",
"to",
"an",
"Azure",
"Storage",
"blob",
"container",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L3082-L3084 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java | AbstractHibernateDao.countBySql | public long countBySql(String fullSql, Object[] paramValues, Type[] paramTypes){
Session session = this.getCurrentSession();
Query query = session.createSQLQuery(fullSql);
setupQuery(query, paramValues, paramTypes, null, null);
return ((Number)query.uniqueResult()).longValue();
} | java | public long countBySql(String fullSql, Object[] paramValues, Type[] paramTypes){
Session session = this.getCurrentSession();
Query query = session.createSQLQuery(fullSql);
setupQuery(query, paramValues, paramTypes, null, null);
return ((Number)query.uniqueResult()).longValue();
} | [
"public",
"long",
"countBySql",
"(",
"String",
"fullSql",
",",
"Object",
"[",
"]",
"paramValues",
",",
"Type",
"[",
"]",
"paramTypes",
")",
"{",
"Session",
"session",
"=",
"this",
".",
"getCurrentSession",
"(",
")",
";",
"Query",
"query",
"=",
"session",
... | Get the count of all records in database
@param fullSql
@param paramValues
@param paramTypes
@return the count | [
"Get",
"the",
"count",
"of",
"all",
"records",
"in",
"database"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L362-L367 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/FileUtils.java | FileUtils.osSensitiveEquals | public static boolean osSensitiveEquals( String s1, String s2 )
{
if ( OS_CASE_SENSITIVE )
{
return s1.equals( s2 );
}
else
{
return s1.equalsIgnoreCase( s2 );
}
} | java | public static boolean osSensitiveEquals( String s1, String s2 )
{
if ( OS_CASE_SENSITIVE )
{
return s1.equals( s2 );
}
else
{
return s1.equalsIgnoreCase( s2 );
}
} | [
"public",
"static",
"boolean",
"osSensitiveEquals",
"(",
"String",
"s1",
",",
"String",
"s2",
")",
"{",
"if",
"(",
"OS_CASE_SENSITIVE",
")",
"{",
"return",
"s1",
".",
"equals",
"(",
"s2",
")",
";",
"}",
"else",
"{",
"return",
"s1",
".",
"equalsIgnoreCase... | Compare two strings, with case sensitivity determined by the operating system.
@param s1 the first String to compare.
@param s2 the second String to compare.
@return <code>true</code> when:
<ul>
<li>the strings match exactly (including case), or,</li>
<li>the operating system is not case-sensitive with regard to file names, and the strings match,
ignoring case.</li>
</ul>
@see #isOSCaseSensitive() | [
"Compare",
"two",
"strings",
"with",
"case",
"sensitivity",
"determined",
"by",
"the",
"operating",
"system",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/FileUtils.java#L116-L126 |
Coveros/selenified | src/main/java/com/coveros/selenified/application/WaitFor.java | WaitFor.cookieMatches | public void cookieMatches(double seconds, String cookieName, String expectedCookiePattern) {
double end = System.currentTimeMillis() + (seconds * 1000);
while (app.is().cookiePresent(cookieName) && System.currentTimeMillis() < end) ;
if (app.is().cookiePresent(cookieName)) {
while (!app.get().cookieValue(cookieName).matches(expectedCookiePattern) && System.currentTimeMillis() < end) ;
}
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkCookieMatches(cookieName, expectedCookiePattern, seconds, timeTook);
} | java | public void cookieMatches(double seconds, String cookieName, String expectedCookiePattern) {
double end = System.currentTimeMillis() + (seconds * 1000);
while (app.is().cookiePresent(cookieName) && System.currentTimeMillis() < end) ;
if (app.is().cookiePresent(cookieName)) {
while (!app.get().cookieValue(cookieName).matches(expectedCookiePattern) && System.currentTimeMillis() < end) ;
}
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkCookieMatches(cookieName, expectedCookiePattern, seconds, timeTook);
} | [
"public",
"void",
"cookieMatches",
"(",
"double",
"seconds",
",",
"String",
"cookieName",
",",
"String",
"expectedCookiePattern",
")",
"{",
"double",
"end",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"(",
"seconds",
"*",
"1000",
")",
";",
"while... | Waits up to the provided wait time for a cookies with the provided name has a value matching the
expected pattern. This information will be logged and recorded, with a
screenshot for traceability and added debugging support.
@param cookieName the name of the cookie
@param expectedCookiePattern the expected value of the cookie
@param seconds the number of seconds to wait | [
"Waits",
"up",
"to",
"the",
"provided",
"wait",
"time",
"for",
"a",
"cookies",
"with",
"the",
"provided",
"name",
"has",
"a",
"value",
"matching",
"the",
"expected",
"pattern",
".",
"This",
"information",
"will",
"be",
"logged",
"and",
"recorded",
"with",
... | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L744-L752 |
Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/file/FileSystemUtils.java | FileSystemUtils.persistAndWait | public static void persistAndWait(final FileSystem fs, final AlluxioURI uri)
throws FileDoesNotExistException, IOException, AlluxioException, TimeoutException,
InterruptedException {
persistAndWait(fs, uri, -1);
} | java | public static void persistAndWait(final FileSystem fs, final AlluxioURI uri)
throws FileDoesNotExistException, IOException, AlluxioException, TimeoutException,
InterruptedException {
persistAndWait(fs, uri, -1);
} | [
"public",
"static",
"void",
"persistAndWait",
"(",
"final",
"FileSystem",
"fs",
",",
"final",
"AlluxioURI",
"uri",
")",
"throws",
"FileDoesNotExistException",
",",
"IOException",
",",
"AlluxioException",
",",
"TimeoutException",
",",
"InterruptedException",
"{",
"pers... | Convenience method for {@code #persistAndWait(fs, uri, -1)}. i.e. wait for an indefinite period
of time to persist. This will block for an indefinite period of time if the path is never
persisted. Use with care.
@param fs {@link FileSystem} to carry out Alluxio operations
@param uri the uri of the file to persist | [
"Convenience",
"method",
"for",
"{",
"@code",
"#persistAndWait",
"(",
"fs",
"uri",
"-",
"1",
")",
"}",
".",
"i",
".",
"e",
".",
"wait",
"for",
"an",
"indefinite",
"period",
"of",
"time",
"to",
"persist",
".",
"This",
"will",
"block",
"for",
"an",
"in... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/file/FileSystemUtils.java#L134-L138 |
jayantk/jklol | src/com/jayantkrish/jklol/models/FactorGraph.java | FactorGraph.addVariable | public FactorGraph addVariable(String variableName, Variable variable) {
Preconditions.checkArgument(!getVariables().contains(variableName));
int varNum = getAllVariables().size() > 0 ? Ints.max(getAllVariables().getVariableNumsArray()) + 1 : 0;
return addVariableWithIndex(variableName, variable, varNum);
} | java | public FactorGraph addVariable(String variableName, Variable variable) {
Preconditions.checkArgument(!getVariables().contains(variableName));
int varNum = getAllVariables().size() > 0 ? Ints.max(getAllVariables().getVariableNumsArray()) + 1 : 0;
return addVariableWithIndex(variableName, variable, varNum);
} | [
"public",
"FactorGraph",
"addVariable",
"(",
"String",
"variableName",
",",
"Variable",
"variable",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"!",
"getVariables",
"(",
")",
".",
"contains",
"(",
"variableName",
")",
")",
";",
"int",
"varNum",
"=",
... | Gets a new {@code FactorGraph} identical to this one, except with
an additional variable. The new variable is named
{@code variableName} and has type {@code variable}. Each variable
in a factor graph must have a unique name; hence {@code this}
must not already contain a variable named {@code variableName}. | [
"Gets",
"a",
"new",
"{"
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/FactorGraph.java#L457-L461 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/log/LogStreamWriter.java | LogStreamWriter.formatOutput | protected String formatOutput(String svc, LogLevel l, String msg, Throwable t)
{
// ??? for more severe output levels, a formatting routine which
// uses (part of) the throwable stack trace would be of advantage
final StringBuffer b = new StringBuffer(150);
synchronized (c) {
c.setTimeInMillis(System.currentTimeMillis());
b.append(c.get(Calendar.YEAR));
b.append('-').append(pad2Digits(c.get(Calendar.MONTH) + 1));
b.append('-').append(pad2Digits(c.get(Calendar.DAY_OF_MONTH)));
b.append(' ').append(pad2Digits(c.get(Calendar.HOUR_OF_DAY)));
b.append(':').append(pad2Digits(c.get(Calendar.MINUTE)));
b.append(':').append(pad2Digits(c.get(Calendar.SECOND)));
final int ms = c.get(Calendar.MILLISECOND);
b.append(',');
if (ms < 99)
b.append('0');
b.append(pad2Digits(ms));
}
b.append(" level=").append(l.toString());
b.append(", ");
final int dot = svc.lastIndexOf('.') + 1;
if (dot > 0 && dot < svc.length() && Character.isDigit(svc.charAt(dot)))
b.append(svc);
else
b.append(svc.substring(dot));
b.append(": ").append(msg);
if (t != null && t.getMessage() != null)
b.append(" (").append(t.getMessage()).append(")");
return b.toString();
} | java | protected String formatOutput(String svc, LogLevel l, String msg, Throwable t)
{
// ??? for more severe output levels, a formatting routine which
// uses (part of) the throwable stack trace would be of advantage
final StringBuffer b = new StringBuffer(150);
synchronized (c) {
c.setTimeInMillis(System.currentTimeMillis());
b.append(c.get(Calendar.YEAR));
b.append('-').append(pad2Digits(c.get(Calendar.MONTH) + 1));
b.append('-').append(pad2Digits(c.get(Calendar.DAY_OF_MONTH)));
b.append(' ').append(pad2Digits(c.get(Calendar.HOUR_OF_DAY)));
b.append(':').append(pad2Digits(c.get(Calendar.MINUTE)));
b.append(':').append(pad2Digits(c.get(Calendar.SECOND)));
final int ms = c.get(Calendar.MILLISECOND);
b.append(',');
if (ms < 99)
b.append('0');
b.append(pad2Digits(ms));
}
b.append(" level=").append(l.toString());
b.append(", ");
final int dot = svc.lastIndexOf('.') + 1;
if (dot > 0 && dot < svc.length() && Character.isDigit(svc.charAt(dot)))
b.append(svc);
else
b.append(svc.substring(dot));
b.append(": ").append(msg);
if (t != null && t.getMessage() != null)
b.append(" (").append(t.getMessage()).append(")");
return b.toString();
} | [
"protected",
"String",
"formatOutput",
"(",
"String",
"svc",
",",
"LogLevel",
"l",
",",
"String",
"msg",
",",
"Throwable",
"t",
")",
"{",
"// ??? for more severe output levels, a formatting routine which\r",
"// uses (part of) the throwable stack trace would be of advantage\r",
... | Creates a formatted output string from the input parameters.
<p>
Override this method to provide a different output format.<br>
The output returned by default follows the shown format. The date/time format is
according ISO 8601 representation, extended format with decimal fraction of second
(milliseconds):<br>
"YYYY-MM-DD hh:mm:ss,sss level=<code>level.toString()</code>,
<code>logService</code>: <code>msg</code> (<code>t.getMessage()</code>)"<br>
or, if throwable is <code>null</code> or throwable-message is <code>null</code><br>
"YYYY-MM-DD hh:mm:ss,sss logService, LogLevel=<code>level.toString()</code>:
<code>msg</code>".<br>
If <code>logService</code> contains '.' in the name, only the part after the last
'.' will be used. This way names like "package.subpackage.name" are shortened to
"name". Nevertheless, if the first character after '.' is numeric, no truncation
will be done to allow e.g. IP addresses in the log service name.
@param svc name of the log service the message comes from
@param l log level of message and throwable
@param msg message to format
@param t an optional throwable object to format, might be <code>null</code>
@return the formatted output | [
"Creates",
"a",
"formatted",
"output",
"string",
"from",
"the",
"input",
"parameters",
".",
"<p",
">",
"Override",
"this",
"method",
"to",
"provide",
"a",
"different",
"output",
"format",
".",
"<br",
">",
"The",
"output",
"returned",
"by",
"default",
"follow... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/log/LogStreamWriter.java#L257-L287 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/utils/ReflectionUtils.java | ReflectionUtils.invokeStaticMethod | public static Object invokeStaticMethod(final Class<?> cls, final String methodName,
final boolean throwException) throws IllegalArgumentException {
if (cls == null || methodName == null) {
if (throwException) {
throw new NullPointerException();
} else {
return null;
}
}
return invokeMethod(cls, null, methodName, false, null, null, throwException);
} | java | public static Object invokeStaticMethod(final Class<?> cls, final String methodName,
final boolean throwException) throws IllegalArgumentException {
if (cls == null || methodName == null) {
if (throwException) {
throw new NullPointerException();
} else {
return null;
}
}
return invokeMethod(cls, null, methodName, false, null, null, throwException);
} | [
"public",
"static",
"Object",
"invokeStaticMethod",
"(",
"final",
"Class",
"<",
"?",
">",
"cls",
",",
"final",
"String",
"methodName",
",",
"final",
"boolean",
"throwException",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"cls",
"==",
"null",
"|... | Invoke the named static method. If an exception is thrown while trying to call the method, and throwException
is true, then IllegalArgumentException is thrown wrapping the cause, otherwise this will return null. If
passed a null class reference, returns null unless throwException is true, then throws
IllegalArgumentException.
@param cls
The class.
@param methodName
The method name.
@param throwException
Whether to throw an exception on failure.
@return The result of the method invocation.
@throws IllegalArgumentException
If the method could not be invoked. | [
"Invoke",
"the",
"named",
"static",
"method",
".",
"If",
"an",
"exception",
"is",
"thrown",
"while",
"trying",
"to",
"call",
"the",
"method",
"and",
"throwException",
"is",
"true",
"then",
"IllegalArgumentException",
"is",
"thrown",
"wrapping",
"the",
"cause",
... | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/ReflectionUtils.java#L352-L362 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java | KernelResolverRepository.getCachedFeature | private ProvisioningFeatureDefinition getCachedFeature(String featureName) {
List<ProvisioningFeatureDefinition> featureList = symbolicNameToFeature.get(featureName);
if (featureList == null) {
featureName = publicNameToSymbolicName.get(featureName.toLowerCase());
if (featureName != null) {
featureList = symbolicNameToFeature.get(featureName);
}
}
if (featureList == null || featureList.isEmpty()) {
return null;
}
return getPreferredVersion(featureName, featureList);
} | java | private ProvisioningFeatureDefinition getCachedFeature(String featureName) {
List<ProvisioningFeatureDefinition> featureList = symbolicNameToFeature.get(featureName);
if (featureList == null) {
featureName = publicNameToSymbolicName.get(featureName.toLowerCase());
if (featureName != null) {
featureList = symbolicNameToFeature.get(featureName);
}
}
if (featureList == null || featureList.isEmpty()) {
return null;
}
return getPreferredVersion(featureName, featureList);
} | [
"private",
"ProvisioningFeatureDefinition",
"getCachedFeature",
"(",
"String",
"featureName",
")",
"{",
"List",
"<",
"ProvisioningFeatureDefinition",
">",
"featureList",
"=",
"symbolicNameToFeature",
".",
"get",
"(",
"featureName",
")",
";",
"if",
"(",
"featureList",
... | Get a feature by name, but without going and checking the remote repository if we don't know about it
@see #getFeature(String) | [
"Get",
"a",
"feature",
"by",
"name",
"but",
"without",
"going",
"and",
"checking",
"the",
"remote",
"repository",
"if",
"we",
"don",
"t",
"know",
"about",
"it"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java#L188-L203 |
qos-ch/slf4j | slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java | JavassistHelper.parameterNameFor | static String parameterNameFor(CtBehavior method, LocalVariableAttribute locals, int i) {
if (locals == null) {
return Integer.toString(i + 1);
}
int modifiers = method.getModifiers();
int j = i;
if (Modifier.isSynchronized(modifiers)) {
// skip object to synchronize upon.
j++;
// System.err.println("Synchronized");
}
if (Modifier.isStatic(modifiers) == false) {
// skip "this"
j++;
// System.err.println("Instance");
}
String variableName = locals.variableName(j);
// if (variableName.equals("this")) {
// System.err.println("'this' returned as a parameter name for "
// + method.getName() + " index " + j
// +
// ", names are probably shifted. Please submit source for class in slf4j bugreport");
// }
return variableName;
} | java | static String parameterNameFor(CtBehavior method, LocalVariableAttribute locals, int i) {
if (locals == null) {
return Integer.toString(i + 1);
}
int modifiers = method.getModifiers();
int j = i;
if (Modifier.isSynchronized(modifiers)) {
// skip object to synchronize upon.
j++;
// System.err.println("Synchronized");
}
if (Modifier.isStatic(modifiers) == false) {
// skip "this"
j++;
// System.err.println("Instance");
}
String variableName = locals.variableName(j);
// if (variableName.equals("this")) {
// System.err.println("'this' returned as a parameter name for "
// + method.getName() + " index " + j
// +
// ", names are probably shifted. Please submit source for class in slf4j bugreport");
// }
return variableName;
} | [
"static",
"String",
"parameterNameFor",
"(",
"CtBehavior",
"method",
",",
"LocalVariableAttribute",
"locals",
",",
"int",
"i",
")",
"{",
"if",
"(",
"locals",
"==",
"null",
")",
"{",
"return",
"Integer",
".",
"toString",
"(",
"i",
"+",
"1",
")",
";",
"}",... | Determine the name of parameter with index i in the given method. Use the
locals attributes about local variables from the classfile. Note: This is
still work in progress.
@param method
@param locals
@param i
@return the name of the parameter if available or a number if not. | [
"Determine",
"the",
"name",
"of",
"parameter",
"with",
"index",
"i",
"in",
"the",
"given",
"method",
".",
"Use",
"the",
"locals",
"attributes",
"about",
"local",
"variables",
"from",
"the",
"classfile",
".",
"Note",
":",
"This",
"is",
"still",
"work",
"in"... | train | https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java#L157-L185 |
vkostyukov/la4j | src/main/java/org/la4j/Vector.java | Vector.swapElements | public void swapElements(int i, int j) {
if (i != j) {
double s = get(i);
set(i, get(j));
set(j, s);
}
} | java | public void swapElements(int i, int j) {
if (i != j) {
double s = get(i);
set(i, get(j));
set(j, s);
}
} | [
"public",
"void",
"swapElements",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"if",
"(",
"i",
"!=",
"j",
")",
"{",
"double",
"s",
"=",
"get",
"(",
"i",
")",
";",
"set",
"(",
"i",
",",
"get",
"(",
"j",
")",
")",
";",
"set",
"(",
"j",
",",
... | Swaps the specified elements of this vector.
@param i element's index
@param j element's index | [
"Swaps",
"the",
"specified",
"elements",
"of",
"this",
"vector",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vector.java#L556-L562 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getCreateUploadVersionSessionRequest | public BoxRequestsFile.CreateNewVersionUploadSession getCreateUploadVersionSessionRequest(File file, String fileId)
throws FileNotFoundException {
return new BoxRequestsFile.CreateNewVersionUploadSession(file, getUploadSessionForNewFileVersionUrl(fileId), mSession);
} | java | public BoxRequestsFile.CreateNewVersionUploadSession getCreateUploadVersionSessionRequest(File file, String fileId)
throws FileNotFoundException {
return new BoxRequestsFile.CreateNewVersionUploadSession(file, getUploadSessionForNewFileVersionUrl(fileId), mSession);
} | [
"public",
"BoxRequestsFile",
".",
"CreateNewVersionUploadSession",
"getCreateUploadVersionSessionRequest",
"(",
"File",
"file",
",",
"String",
"fileId",
")",
"throws",
"FileNotFoundException",
"{",
"return",
"new",
"BoxRequestsFile",
".",
"CreateNewVersionUploadSession",
"(",... | Gets a request that creates an upload session for uploading a new file version
@param file The file to be uploaded
@param fileId The fileId
@return request to create an upload session for uploading a new file version | [
"Gets",
"a",
"request",
"that",
"creates",
"an",
"upload",
"session",
"for",
"uploading",
"a",
"new",
"file",
"version"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L603-L606 |
op4j/op4j-jodatime | src/main/java/org/op4j/jodatime/functions/FnPeriod.java | FnPeriod.timestampFieldArrayToPeriod | public static final Function<Timestamp[], Period> timestampFieldArrayToPeriod(final PeriodType periodType, final Chronology chronology) {
return new TimestampFieldArrayToPeriod(periodType, chronology);
} | java | public static final Function<Timestamp[], Period> timestampFieldArrayToPeriod(final PeriodType periodType, final Chronology chronology) {
return new TimestampFieldArrayToPeriod(periodType, chronology);
} | [
"public",
"static",
"final",
"Function",
"<",
"Timestamp",
"[",
"]",
",",
"Period",
">",
"timestampFieldArrayToPeriod",
"(",
"final",
"PeriodType",
"periodType",
",",
"final",
"Chronology",
"chronology",
")",
"{",
"return",
"new",
"TimestampFieldArrayToPeriod",
"(",... | <p>
The function receives an Array of two {@link Timestamp} elements used as the start and end of the
{@link Period} it creates. The {@link Period} will be created using the specified
specified {@link PeriodType} and {@link Chronology}
</p>
@param periodType the {@link PeriodType} to be created. It specifies which duration fields are to be used
@param chronology {@link Chronology} to be used
@return the {@link Period} created from the input and arguments | [
"<p",
">",
"The",
"function",
"receives",
"an",
"Array",
"of",
"two",
"{",
"@link",
"Timestamp",
"}",
"elements",
"used",
"as",
"the",
"start",
"and",
"end",
"of",
"the",
"{",
"@link",
"Period",
"}",
"it",
"creates",
".",
"The",
"{",
"@link",
"Period",... | train | https://github.com/op4j/op4j-jodatime/blob/26e5b8cda8553fb3b5a4a64b3109dbbf5df21194/src/main/java/org/op4j/jodatime/functions/FnPeriod.java#L300-L302 |
spotify/apollo | apollo-extra/src/main/java/com/spotify/apollo/route/HtmlSerializerMiddlewares.java | HtmlSerializerMiddlewares.serialize | public static <T> ByteString serialize(final String templateName, T object) {
StringWriter templateResults = new StringWriter();
try {
final Template template = configuration.getTemplate(templateName);
template.process(object, templateResults);
} catch (Exception e) {
throw Throwables.propagate(e);
}
return ByteString.encodeUtf8(templateResults.toString());
} | java | public static <T> ByteString serialize(final String templateName, T object) {
StringWriter templateResults = new StringWriter();
try {
final Template template = configuration.getTemplate(templateName);
template.process(object, templateResults);
} catch (Exception e) {
throw Throwables.propagate(e);
}
return ByteString.encodeUtf8(templateResults.toString());
} | [
"public",
"static",
"<",
"T",
">",
"ByteString",
"serialize",
"(",
"final",
"String",
"templateName",
",",
"T",
"object",
")",
"{",
"StringWriter",
"templateResults",
"=",
"new",
"StringWriter",
"(",
")",
";",
"try",
"{",
"final",
"Template",
"template",
"="... | Call the template engine and return the result.
@param templateName The template name, respective to the "resources" folder
@param object The parameter to pass to the template
@param <T> The Type of the parameters
@return The HTML | [
"Call",
"the",
"template",
"engine",
"and",
"return",
"the",
"result",
"."
] | train | https://github.com/spotify/apollo/blob/3aba09840538a2aff9cdac5be42cc114dd276c70/apollo-extra/src/main/java/com/spotify/apollo/route/HtmlSerializerMiddlewares.java#L65-L74 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/stax/StAXUtils.java | StAXUtils.getXMLStreamReader | public static XMLStreamReader getXMLStreamReader(XMLInputFactory factory, Source source) throws XMLStreamException
{
XMLStreamReader xmlStreamReader;
if (source instanceof StAXSource) {
// StAXSource is not supported by standard XMLInputFactory
StAXSource staxSource = (StAXSource) source;
if (staxSource.getXMLStreamReader() != null) {
xmlStreamReader = staxSource.getXMLStreamReader();
} else {
// TODO: add support for XMLStreamReader -> XMLEventReader
throw new XMLStreamException("XMLEventReader is not supported as source");
}
} else {
xmlStreamReader = factory.createXMLStreamReader(source);
}
return xmlStreamReader;
} | java | public static XMLStreamReader getXMLStreamReader(XMLInputFactory factory, Source source) throws XMLStreamException
{
XMLStreamReader xmlStreamReader;
if (source instanceof StAXSource) {
// StAXSource is not supported by standard XMLInputFactory
StAXSource staxSource = (StAXSource) source;
if (staxSource.getXMLStreamReader() != null) {
xmlStreamReader = staxSource.getXMLStreamReader();
} else {
// TODO: add support for XMLStreamReader -> XMLEventReader
throw new XMLStreamException("XMLEventReader is not supported as source");
}
} else {
xmlStreamReader = factory.createXMLStreamReader(source);
}
return xmlStreamReader;
} | [
"public",
"static",
"XMLStreamReader",
"getXMLStreamReader",
"(",
"XMLInputFactory",
"factory",
",",
"Source",
"source",
")",
"throws",
"XMLStreamException",
"{",
"XMLStreamReader",
"xmlStreamReader",
";",
"if",
"(",
"source",
"instanceof",
"StAXSource",
")",
"{",
"//... | Extract or create an instance of {@link XMLStreamReader} from the provided {@link Source}.
@param factory the {@link XMLStreamReader} to use (if needed)
@param source the source
@return the {@link XMLStreamReader}
@throws XMLStreamException when failing to extract xml stream reader
@since 9.5
@since 9.6RC1 | [
"Extract",
"or",
"create",
"an",
"instance",
"of",
"{",
"@link",
"XMLStreamReader",
"}",
"from",
"the",
"provided",
"{",
"@link",
"Source",
"}",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/stax/StAXUtils.java#L91-L109 |
jayantk/jklol | src/com/jayantkrish/jklol/models/TableFactor.java | TableFactor.mapKeyValuesToOutcomes | private Iterator<Outcome> mapKeyValuesToOutcomes(Iterator<KeyValue> iterator) {
final Outcome outcome = new Outcome(null, 0.0);
final VariableNumMap vars = getVars();
return Iterators.transform(iterator, new Function<KeyValue, Outcome>() {
@Override
public Outcome apply(KeyValue keyValue) {
outcome.setAssignment(vars.intArrayToAssignment(keyValue.getKey()));
outcome.setProbability(keyValue.getValue());
return outcome;
}
});
} | java | private Iterator<Outcome> mapKeyValuesToOutcomes(Iterator<KeyValue> iterator) {
final Outcome outcome = new Outcome(null, 0.0);
final VariableNumMap vars = getVars();
return Iterators.transform(iterator, new Function<KeyValue, Outcome>() {
@Override
public Outcome apply(KeyValue keyValue) {
outcome.setAssignment(vars.intArrayToAssignment(keyValue.getKey()));
outcome.setProbability(keyValue.getValue());
return outcome;
}
});
} | [
"private",
"Iterator",
"<",
"Outcome",
">",
"mapKeyValuesToOutcomes",
"(",
"Iterator",
"<",
"KeyValue",
">",
"iterator",
")",
"{",
"final",
"Outcome",
"outcome",
"=",
"new",
"Outcome",
"(",
"null",
",",
"0.0",
")",
";",
"final",
"VariableNumMap",
"vars",
"="... | Maps an iterator over a tensor's {@code KeyValue}s into {@code Outcome}s. | [
"Maps",
"an",
"iterator",
"over",
"a",
"tensor",
"s",
"{"
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/TableFactor.java#L256-L268 |
beanshell/beanshell | src/main/java/bsh/org/objectweb/asm/SymbolTable.java | SymbolTable.addConstantInteger | private void addConstantInteger(final int index, final int tag, final int value) {
add(new Entry(index, tag, value, hash(tag, value)));
} | java | private void addConstantInteger(final int index, final int tag, final int value) {
add(new Entry(index, tag, value, hash(tag, value)));
} | [
"private",
"void",
"addConstantInteger",
"(",
"final",
"int",
"index",
",",
"final",
"int",
"tag",
",",
"final",
"int",
"value",
")",
"{",
"add",
"(",
"new",
"Entry",
"(",
"index",
",",
"tag",
",",
"value",
",",
"hash",
"(",
"tag",
",",
"value",
")",... | Adds a new CONSTANT_Integer_info or CONSTANT_Float_info to the constant pool of this symbol
table.
@param index the constant pool index of the new Symbol.
@param tag one of {@link Symbol#CONSTANT_INTEGER_TAG} or {@link Symbol#CONSTANT_FLOAT_TAG}.
@param value an int or float. | [
"Adds",
"a",
"new",
"CONSTANT_Integer_info",
"or",
"CONSTANT_Float_info",
"to",
"the",
"constant",
"pool",
"of",
"this",
"symbol",
"table",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/org/objectweb/asm/SymbolTable.java#L516-L518 |
real-logic/agrona | agrona/src/main/java/org/agrona/BitUtil.java | BitUtil.isAligned | public static boolean isAligned(final long address, final int alignment)
{
if (!BitUtil.isPowerOfTwo(alignment))
{
throw new IllegalArgumentException("alignment must be a power of 2: alignment=" + alignment);
}
return (address & (alignment - 1)) == 0;
} | java | public static boolean isAligned(final long address, final int alignment)
{
if (!BitUtil.isPowerOfTwo(alignment))
{
throw new IllegalArgumentException("alignment must be a power of 2: alignment=" + alignment);
}
return (address & (alignment - 1)) == 0;
} | [
"public",
"static",
"boolean",
"isAligned",
"(",
"final",
"long",
"address",
",",
"final",
"int",
"alignment",
")",
"{",
"if",
"(",
"!",
"BitUtil",
".",
"isPowerOfTwo",
"(",
"alignment",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"alig... | Is an address aligned on a boundary.
@param address to be tested.
@param alignment boundary the address is tested against.
@return true if the address is on the aligned boundary otherwise false.
@throws IllegalArgumentException if the alignment is not a power of 2. | [
"Is",
"an",
"address",
"aligned",
"on",
"a",
"boundary",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/BitUtil.java#L325-L333 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Collectors.java | Collectors.partitioningBy | @NotNull
public static <T, D, A> Collector<T, ?, Map<Boolean, D>> partitioningBy(
@NotNull final Predicate<? super T> predicate,
@NotNull final Collector<? super T, A, D> downstream) {
final BiConsumer<A, ? super T> downstreamAccumulator = downstream.accumulator();
return new CollectorsImpl<T, Tuple2<A>, Map<Boolean, D>>(
new Supplier<Tuple2<A>>() {
@NotNull
@Override
public Tuple2<A> get() {
return new Tuple2<A>(
downstream.supplier().get(),
downstream.supplier().get());
}
},
new BiConsumer<Tuple2<A>, T>() {
@Override
public void accept(@NotNull Tuple2<A> container, T t) {
downstreamAccumulator.accept(
predicate.test(t) ? container.a : container.b, t);
}
},
new Function<Tuple2<A>, Map<Boolean, D>>() {
@NotNull
@Override
public Map<Boolean, D> apply(@NotNull Tuple2<A> container) {
final Function<A, D> finisher = downstream.finisher();
Map<Boolean, D> result = new HashMap<Boolean, D>(2);
result.put(Boolean.TRUE, finisher.apply(container.a));
result.put(Boolean.FALSE, finisher.apply(container.b));
return result;
}
}
);
} | java | @NotNull
public static <T, D, A> Collector<T, ?, Map<Boolean, D>> partitioningBy(
@NotNull final Predicate<? super T> predicate,
@NotNull final Collector<? super T, A, D> downstream) {
final BiConsumer<A, ? super T> downstreamAccumulator = downstream.accumulator();
return new CollectorsImpl<T, Tuple2<A>, Map<Boolean, D>>(
new Supplier<Tuple2<A>>() {
@NotNull
@Override
public Tuple2<A> get() {
return new Tuple2<A>(
downstream.supplier().get(),
downstream.supplier().get());
}
},
new BiConsumer<Tuple2<A>, T>() {
@Override
public void accept(@NotNull Tuple2<A> container, T t) {
downstreamAccumulator.accept(
predicate.test(t) ? container.a : container.b, t);
}
},
new Function<Tuple2<A>, Map<Boolean, D>>() {
@NotNull
@Override
public Map<Boolean, D> apply(@NotNull Tuple2<A> container) {
final Function<A, D> finisher = downstream.finisher();
Map<Boolean, D> result = new HashMap<Boolean, D>(2);
result.put(Boolean.TRUE, finisher.apply(container.a));
result.put(Boolean.FALSE, finisher.apply(container.b));
return result;
}
}
);
} | [
"@",
"NotNull",
"public",
"static",
"<",
"T",
",",
"D",
",",
"A",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Map",
"<",
"Boolean",
",",
"D",
">",
">",
"partitioningBy",
"(",
"@",
"NotNull",
"final",
"Predicate",
"<",
"?",
"super",
"T",
">",
"pre... | Returns a {@code Collector} that performs partitioning operation according to a predicate.
The returned {@code Map} always contains mappings for both {@code false} and {@code true} keys.
@param <T> the type of the input elements
@param <D> the result type of downstream reduction
@param <A> the accumulation type
@param predicate a predicate used for classifying input elements
@param downstream the collector of partitioned elements
@return a {@code Collector}
@since 1.1.9 | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"that",
"performs",
"partitioning",
"operation",
"according",
"to",
"a",
"predicate",
".",
"The",
"returned",
"{",
"@code",
"Map",
"}",
"always",
"contains",
"mappings",
"for",
"both",
"{",
"@code",
"false",
"}... | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L1015-L1050 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java | AbstractSessionHandler.bindValue | private void bindValue(Session session, String name, Object value) {
if (value instanceof SessionBindingListener) {
((SessionBindingListener)value).valueBound(session, name, value);
}
} | java | private void bindValue(Session session, String name, Object value) {
if (value instanceof SessionBindingListener) {
((SessionBindingListener)value).valueBound(session, name, value);
}
} | [
"private",
"void",
"bindValue",
"(",
"Session",
"session",
",",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"SessionBindingListener",
")",
"{",
"(",
"(",
"SessionBindingListener",
")",
"value",
")",
".",
"valueBound",
... | Bind value if value implements {@link SessionBindingListener}
(calls {@link SessionBindingListener#valueBound(Session, String, Object)})
@param session the basic session
@param name the name with which the object is bound or unbound
@param value the bound value | [
"Bind",
"value",
"if",
"value",
"implements",
"{",
"@link",
"SessionBindingListener",
"}",
"(",
"calls",
"{",
"@link",
"SessionBindingListener#valueBound",
"(",
"Session",
"String",
"Object",
")",
"}",
")"
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/AbstractSessionHandler.java#L300-L304 |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.getMessageText | public static String getMessageText(String key, Object... args) {
return getWpMessagesForCurrentLocale().key(key, args);
} | java | public static String getMessageText(String key, Object... args) {
return getWpMessagesForCurrentLocale().key(key, args);
} | [
"public",
"static",
"String",
"getMessageText",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"getWpMessagesForCurrentLocale",
"(",
")",
".",
"key",
"(",
"key",
",",
"args",
")",
";",
"}"
] | Gets the workplace message for the current locale and the given key and arguments.<p>
@param key the message key
@param args the message arguments
@return the message text for the current locale | [
"Gets",
"the",
"workplace",
"message",
"for",
"the",
"current",
"locale",
"and",
"the",
"given",
"key",
"and",
"arguments",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L644-L647 |
LearnLib/automatalib | incremental/src/main/java/net/automatalib/incremental/dfa/dag/IncrementalDFADAGBuilder.java | IncrementalDFADAGBuilder.createSuffix | private State createSuffix(Word<? extends I> suffix, Acceptance acc) {
StateSignature sig = new StateSignature(alphabetSize, acc);
sig.updateHashCode();
State last = replaceOrRegister(sig);
int len = suffix.length();
for (int i = len - 1; i >= 0; i--) {
sig = new StateSignature(alphabetSize, Acceptance.DONT_KNOW);
I sym = suffix.getSymbol(i);
int idx = inputAlphabet.getSymbolIndex(sym);
sig.successors.array[idx] = last;
sig.updateHashCode();
last = replaceOrRegister(sig);
}
return last;
} | java | private State createSuffix(Word<? extends I> suffix, Acceptance acc) {
StateSignature sig = new StateSignature(alphabetSize, acc);
sig.updateHashCode();
State last = replaceOrRegister(sig);
int len = suffix.length();
for (int i = len - 1; i >= 0; i--) {
sig = new StateSignature(alphabetSize, Acceptance.DONT_KNOW);
I sym = suffix.getSymbol(i);
int idx = inputAlphabet.getSymbolIndex(sym);
sig.successors.array[idx] = last;
sig.updateHashCode();
last = replaceOrRegister(sig);
}
return last;
} | [
"private",
"State",
"createSuffix",
"(",
"Word",
"<",
"?",
"extends",
"I",
">",
"suffix",
",",
"Acceptance",
"acc",
")",
"{",
"StateSignature",
"sig",
"=",
"new",
"StateSignature",
"(",
"alphabetSize",
",",
"acc",
")",
";",
"sig",
".",
"updateHashCode",
"(... | Creates a suffix state sequence, i.e., a linear sequence of states connected by transitions labeled by the
letters of the given suffix word.
@param suffix
the suffix word
@param acc
the acceptance status of the final state
@return the first state in the sequence | [
"Creates",
"a",
"suffix",
"state",
"sequence",
"i",
".",
"e",
".",
"a",
"linear",
"sequence",
"of",
"states",
"connected",
"by",
"transitions",
"labeled",
"by",
"the",
"letters",
"of",
"the",
"given",
"suffix",
"word",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/incremental/src/main/java/net/automatalib/incremental/dfa/dag/IncrementalDFADAGBuilder.java#L204-L220 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/dory/command/Command.java | Command.matchCommand | public static JsonObject matchCommand(JsonObject commandsJson, String commandName, String storageService) {
for (String key : commandsJson.keySet()) {
if (key.equals(storageService)) {
JsonObject commandCats = commandsJson.getJsonObject(key);
if (commandCats.containsKey(commandName)) {
return commandCats.getJsonObject(commandName);
}
}
}
return null;
} | java | public static JsonObject matchCommand(JsonObject commandsJson, String commandName, String storageService) {
for (String key : commandsJson.keySet()) {
if (key.equals(storageService)) {
JsonObject commandCats = commandsJson.getJsonObject(key);
if (commandCats.containsKey(commandName)) {
return commandCats.getJsonObject(commandName);
}
}
}
return null;
} | [
"public",
"static",
"JsonObject",
"matchCommand",
"(",
"JsonObject",
"commandsJson",
",",
"String",
"commandName",
",",
"String",
"storageService",
")",
"{",
"for",
"(",
"String",
"key",
":",
"commandsJson",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"key... | Finds out if a command is supported by Doradus
@param commandsJson
@param commandName
@param storageService
@return | [
"Finds",
"out",
"if",
"a",
"command",
"is",
"supported",
"by",
"Doradus"
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/dory/command/Command.java#L270-L280 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.resetPasswordAsync | public Observable<Void> resetPasswordAsync(String userName, ResetPasswordPayload resetPasswordPayload) {
return resetPasswordWithServiceResponseAsync(userName, resetPasswordPayload).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> resetPasswordAsync(String userName, ResetPasswordPayload resetPasswordPayload) {
return resetPasswordWithServiceResponseAsync(userName, resetPasswordPayload).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"resetPasswordAsync",
"(",
"String",
"userName",
",",
"ResetPasswordPayload",
"resetPasswordPayload",
")",
"{",
"return",
"resetPasswordWithServiceResponseAsync",
"(",
"userName",
",",
"resetPasswordPayload",
")",
".",
"map",
"(... | Resets the user password on an environment This operation can take a while to complete.
@param userName The name of the user.
@param resetPasswordPayload Represents the payload for resetting passwords.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Resets",
"the",
"user",
"password",
"on",
"an",
"environment",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L957-L964 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java | VarOptItemsSketch.updateHeavyREq1 | private void updateHeavyREq1(final T item, final double weight, final boolean mark) {
assert m_ == 0;
assert r_ == 1;
assert (r_ + h_) == k_;
push(item, weight, mark); // new item into H
popMinToMRegion(); // pop lightest back into M
// Any set of two items is downsample-able to one item,
// so the two lightest items are a valid starting point for the following
final int mSlot = k_ - 1; // array is k+1, 1 in R, so slot before is M
growCandidateSet(weights_.get(mSlot) + totalWtR_, 2);
} | java | private void updateHeavyREq1(final T item, final double weight, final boolean mark) {
assert m_ == 0;
assert r_ == 1;
assert (r_ + h_) == k_;
push(item, weight, mark); // new item into H
popMinToMRegion(); // pop lightest back into M
// Any set of two items is downsample-able to one item,
// so the two lightest items are a valid starting point for the following
final int mSlot = k_ - 1; // array is k+1, 1 in R, so slot before is M
growCandidateSet(weights_.get(mSlot) + totalWtR_, 2);
} | [
"private",
"void",
"updateHeavyREq1",
"(",
"final",
"T",
"item",
",",
"final",
"double",
"weight",
",",
"final",
"boolean",
"mark",
")",
"{",
"assert",
"m_",
"==",
"0",
";",
"assert",
"r_",
"==",
"1",
";",
"assert",
"(",
"r_",
"+",
"h_",
")",
"==",
... | /* The analysis of this case is similar to that of the general heavy case.
The one small technical difference is that since R < 2, we must grab an M item
to have a valid starting point for continue_by_growing_candidate_set () | [
"/",
"*",
"The",
"analysis",
"of",
"this",
"case",
"is",
"similar",
"to",
"that",
"of",
"the",
"general",
"heavy",
"case",
".",
"The",
"one",
"small",
"technical",
"difference",
"is",
"that",
"since",
"R",
"<",
"2",
"we",
"must",
"grab",
"an",
"M",
"... | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java#L937-L949 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java | Serializer.writeById | @SuppressWarnings("unchecked")
private BufferOutput writeById(int id, Object object, BufferOutput output, TypeSerializer serializer) {
for (Identifier identifier : Identifier.values()) {
if (identifier.accept(id)) {
identifier.write(id, output.writeByte(identifier.code()));
serializer.write(object, output, this);
return output;
}
}
throw new SerializationException("invalid type ID: " + id);
} | java | @SuppressWarnings("unchecked")
private BufferOutput writeById(int id, Object object, BufferOutput output, TypeSerializer serializer) {
for (Identifier identifier : Identifier.values()) {
if (identifier.accept(id)) {
identifier.write(id, output.writeByte(identifier.code()));
serializer.write(object, output, this);
return output;
}
}
throw new SerializationException("invalid type ID: " + id);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"BufferOutput",
"writeById",
"(",
"int",
"id",
",",
"Object",
"object",
",",
"BufferOutput",
"output",
",",
"TypeSerializer",
"serializer",
")",
"{",
"for",
"(",
"Identifier",
"identifier",
":",
"Ide... | Writes an object to the buffer using the given serialization ID. | [
"Writes",
"an",
"object",
"to",
"the",
"buffer",
"using",
"the",
"given",
"serialization",
"ID",
"."
] | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L883-L893 |
hawtio/hawtio | hawtio-ide/src/main/java/io/hawt/ide/IdeFacade.java | IdeFacade.ideaOpenAndNavigate | @Override
public String ideaOpenAndNavigate(String fileName, int line, int column) throws Exception {
if (line < 0) line = 0;
if (column < 0) column = 0;
String xml = "<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\n" +
"<methodCall>\n" +
" <methodName>fileOpener.openAndNavigate</methodName>\n" +
" <params>\n" +
" <param><value><string>" + fileName + "</string></value></param>\n" +
" <param><value><int>" + line + "</int></value></param>\n" +
" <param><value><int>" + column + "</int></value></param>\n" +
" </params>\n" +
"</methodCall>\n";
return ideaXmlRpc(xml);
} | java | @Override
public String ideaOpenAndNavigate(String fileName, int line, int column) throws Exception {
if (line < 0) line = 0;
if (column < 0) column = 0;
String xml = "<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\n" +
"<methodCall>\n" +
" <methodName>fileOpener.openAndNavigate</methodName>\n" +
" <params>\n" +
" <param><value><string>" + fileName + "</string></value></param>\n" +
" <param><value><int>" + line + "</int></value></param>\n" +
" <param><value><int>" + column + "</int></value></param>\n" +
" </params>\n" +
"</methodCall>\n";
return ideaXmlRpc(xml);
} | [
"@",
"Override",
"public",
"String",
"ideaOpenAndNavigate",
"(",
"String",
"fileName",
",",
"int",
"line",
",",
"int",
"column",
")",
"throws",
"Exception",
"{",
"if",
"(",
"line",
"<",
"0",
")",
"line",
"=",
"0",
";",
"if",
"(",
"column",
"<",
"0",
... | Uses Intellij's XmlRPC mechanism to open and navigate to a file | [
"Uses",
"Intellij",
"s",
"XmlRPC",
"mechanism",
"to",
"open",
"and",
"navigate",
"to",
"a",
"file"
] | train | https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/hawtio-ide/src/main/java/io/hawt/ide/IdeFacade.java#L130-L145 |
google/closure-compiler | src/com/google/javascript/jscomp/MaybeReachingVariableUse.java | MaybeReachingVariableUse.removeFromUseIfLocal | private void removeFromUseIfLocal(String name, ReachingUses use) {
Var var = allVarsInFn.get(name);
if (var == null) {
return;
}
if (!escaped.contains(var)) {
use.mayUseMap.removeAll(var);
}
} | java | private void removeFromUseIfLocal(String name, ReachingUses use) {
Var var = allVarsInFn.get(name);
if (var == null) {
return;
}
if (!escaped.contains(var)) {
use.mayUseMap.removeAll(var);
}
} | [
"private",
"void",
"removeFromUseIfLocal",
"(",
"String",
"name",
",",
"ReachingUses",
"use",
")",
"{",
"Var",
"var",
"=",
"allVarsInFn",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"var",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",... | Removes the variable for the given name from the node value in the upward
exposed lattice. Do nothing if the variable name is one of the escaped
variable. | [
"Removes",
"the",
"variable",
"for",
"the",
"given",
"name",
"from",
"the",
"node",
"value",
"in",
"the",
"upward",
"exposed",
"lattice",
".",
"Do",
"nothing",
"if",
"the",
"variable",
"name",
"is",
"one",
"of",
"the",
"escaped",
"variable",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MaybeReachingVariableUse.java#L323-L331 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java | Decimal.fromUnscaledBytes | public static Decimal fromUnscaledBytes(int precision, int scale, byte[] bytes) {
if (precision > MAX_COMPACT_PRECISION) {
BigDecimal bd = new BigDecimal(new BigInteger(bytes), scale);
return new Decimal(precision, scale, -1, bd);
}
assert bytes.length == 8;
long l = 0;
for (int i = 0; i < 8; i++) {
l <<= 8;
l |= (bytes[i] & (0xff));
}
return new Decimal(precision, scale, l, null);
} | java | public static Decimal fromUnscaledBytes(int precision, int scale, byte[] bytes) {
if (precision > MAX_COMPACT_PRECISION) {
BigDecimal bd = new BigDecimal(new BigInteger(bytes), scale);
return new Decimal(precision, scale, -1, bd);
}
assert bytes.length == 8;
long l = 0;
for (int i = 0; i < 8; i++) {
l <<= 8;
l |= (bytes[i] & (0xff));
}
return new Decimal(precision, scale, l, null);
} | [
"public",
"static",
"Decimal",
"fromUnscaledBytes",
"(",
"int",
"precision",
",",
"int",
"scale",
",",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"precision",
">",
"MAX_COMPACT_PRECISION",
")",
"{",
"BigDecimal",
"bd",
"=",
"new",
"BigDecimal",
"(",
"... | we assume the bytes were generated by us from toUnscaledBytes() | [
"we",
"assume",
"the",
"bytes",
"were",
"generated",
"by",
"us",
"from",
"toUnscaledBytes",
"()"
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java#L209-L221 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/extension/related/RelatedTablesExtension.java | RelatedTablesExtension.hasMapping | public boolean hasMapping(String tableName, long baseId, long relatedId) {
UserMappingDao userMappingDao = getMappingDao(tableName);
return userMappingDao.countByIds(baseId, relatedId) > 0;
} | java | public boolean hasMapping(String tableName, long baseId, long relatedId) {
UserMappingDao userMappingDao = getMappingDao(tableName);
return userMappingDao.countByIds(baseId, relatedId) > 0;
} | [
"public",
"boolean",
"hasMapping",
"(",
"String",
"tableName",
",",
"long",
"baseId",
",",
"long",
"relatedId",
")",
"{",
"UserMappingDao",
"userMappingDao",
"=",
"getMappingDao",
"(",
"tableName",
")",
";",
"return",
"userMappingDao",
".",
"countByIds",
"(",
"b... | Determine if the base id and related id mapping exists
@param tableName
mapping table name
@param baseId
base id
@param relatedId
related id
@return true if mapping exists
@since 3.2.0 | [
"Determine",
"if",
"the",
"base",
"id",
"and",
"related",
"id",
"mapping",
"exists"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/extension/related/RelatedTablesExtension.java#L263-L266 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/tracer/Tracers.java | Tracers.serverSend | public static void serverSend(SofaRequest request, SofaResponse response, Throwable throwable) {
if (openTrace) {
try {
tracer.serverSend(request, response, throwable);
} catch (Exception e) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn(e.getMessage(), e);
}
}
}
} | java | public static void serverSend(SofaRequest request, SofaResponse response, Throwable throwable) {
if (openTrace) {
try {
tracer.serverSend(request, response, throwable);
} catch (Exception e) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn(e.getMessage(), e);
}
}
}
} | [
"public",
"static",
"void",
"serverSend",
"(",
"SofaRequest",
"request",
",",
"SofaResponse",
"response",
",",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"openTrace",
")",
"{",
"try",
"{",
"tracer",
".",
"serverSend",
"(",
"request",
",",
"response",
","... | 3. 服务端返回请求或者异常
@param request 调用请求
@param response 调用响应
@param throwable 异常 | [
"3",
".",
"服务端返回请求或者异常"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/tracer/Tracers.java#L152-L162 |
datasift/datasift-java | src/main/java/com/datasift/client/managedsource/sources/Instagram.java | Instagram.byTag | public Instagram byTag(String tag, boolean exactMatch) {
addResource(Type.TAG, tag, -1, -1, -1, exactMatch, null);
return this;
} | java | public Instagram byTag(String tag, boolean exactMatch) {
addResource(Type.TAG, tag, -1, -1, -1, exactMatch, null);
return this;
} | [
"public",
"Instagram",
"byTag",
"(",
"String",
"tag",
",",
"boolean",
"exactMatch",
")",
"{",
"addResource",
"(",
"Type",
".",
"TAG",
",",
"tag",
",",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
",",
"exactMatch",
",",
"null",
")",
";",
"return",
"this... | /*
Adds a resource by tag
@param tag the tag, e.g cat
@param exactMatch true when a tag must be an exact match or false when the tag should match the instragram tag
search behaviour
@return this | [
"/",
"*",
"Adds",
"a",
"resource",
"by",
"tag"
] | train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/managedsource/sources/Instagram.java#L58-L61 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/storable/GeneralStructure.java | GeneralStructure.addValuePart | public boolean addValuePart(String name, int size) throws IOException {
if (INSTANCE_EXISITS) {
throw new IOException("A GeneralStroable was already instantiated. You cant further add Value Parts");
}
int hash = Arrays.hashCode(name.getBytes());
int index = valuePartNames.size();
if (valueHash2Index.containsKey(hash)) {
logger.error("A valuePart with the name {} already exists", name);
return false;
}
valuePartNames.add(name);
valueHash2Index.put(hash, index);
valueIndex2Hash.add(hash);
valueSizes.add(size);
valueByteOffsets.add(valueSize);
valueSize += size;
return true;
} | java | public boolean addValuePart(String name, int size) throws IOException {
if (INSTANCE_EXISITS) {
throw new IOException("A GeneralStroable was already instantiated. You cant further add Value Parts");
}
int hash = Arrays.hashCode(name.getBytes());
int index = valuePartNames.size();
if (valueHash2Index.containsKey(hash)) {
logger.error("A valuePart with the name {} already exists", name);
return false;
}
valuePartNames.add(name);
valueHash2Index.put(hash, index);
valueIndex2Hash.add(hash);
valueSizes.add(size);
valueByteOffsets.add(valueSize);
valueSize += size;
return true;
} | [
"public",
"boolean",
"addValuePart",
"(",
"String",
"name",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"if",
"(",
"INSTANCE_EXISITS",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"A GeneralStroable was already instantiated. You cant further add Value Parts\... | Adds a new ValuePart
@param name
the name of the key part. With this name you can access this part
@param size
the size of the key part in bytes
@return true if adding the value part was successful
@throws IOException | [
"Adds",
"a",
"new",
"ValuePart"
] | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/storable/GeneralStructure.java#L82-L99 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java | ChannelHelper.traceableChannel | public static final ByteChannel traceableChannel(ByteChannel channel, Consumer<ByteBuffer> tracer)
{
return new TraceableByteChannel(channel, tracer);
} | java | public static final ByteChannel traceableChannel(ByteChannel channel, Consumer<ByteBuffer> tracer)
{
return new TraceableByteChannel(channel, tracer);
} | [
"public",
"static",
"final",
"ByteChannel",
"traceableChannel",
"(",
"ByteChannel",
"channel",
",",
"Consumer",
"<",
"ByteBuffer",
">",
"tracer",
")",
"{",
"return",
"new",
"TraceableByteChannel",
"(",
"channel",
",",
"tracer",
")",
";",
"}"
] | Returns a ByteChannel having feature that for every read/write method the
tracer function is called with read/write data between position and limit.
<p>
This is planned to support calculating digestives.
@param channel
@param tracer
@return | [
"Returns",
"a",
"ByteChannel",
"having",
"feature",
"that",
"for",
"every",
"read",
"/",
"write",
"method",
"the",
"tracer",
"function",
"is",
"called",
"with",
"read",
"/",
"write",
"data",
"between",
"position",
"and",
"limit",
".",
"<p",
">",
"This",
"i... | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L614-L617 |
Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java | CommonsMetadataEngine.createTable | @Override
public final void createTable(ClusterName targetCluster, TableMetadata tableMetadata) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Creating table [" + tableMetadata.getName().getName() + "] in cluster [" + targetCluster
.getName() + "]");
}
createTable(tableMetadata, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug(
"Catalog [" + tableMetadata.getName().getName() + "] has been created successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
} | java | @Override
public final void createTable(ClusterName targetCluster, TableMetadata tableMetadata) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Creating table [" + tableMetadata.getName().getName() + "] in cluster [" + targetCluster
.getName() + "]");
}
createTable(tableMetadata, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug(
"Catalog [" + tableMetadata.getName().getName() + "] has been created successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
} | [
"@",
"Override",
"public",
"final",
"void",
"createTable",
"(",
"ClusterName",
"targetCluster",
",",
"TableMetadata",
"tableMetadata",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"target... | This method creates a table.
@param targetCluster the target cluster where the table will be created.
@param tableMetadata the table metadata.
@throws UnsupportedException if an operation is not supported.
@throws ExecutionException if an error happens. | [
"This",
"method",
"creates",
"a",
"table",
"."
] | train | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L109-L132 |
thymeleaf/thymeleaf-spring | thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/view/reactive/ThymeleafReactiveViewResolver.java | ThymeleafReactiveViewResolver.setRedirectViewProvider | public void setRedirectViewProvider(final Function<String, RedirectView> redirectViewProvider) {
Validate.notNull(redirectViewProvider, "RedirectView provider cannot be null");
this.redirectViewProvider = redirectViewProvider;
} | java | public void setRedirectViewProvider(final Function<String, RedirectView> redirectViewProvider) {
Validate.notNull(redirectViewProvider, "RedirectView provider cannot be null");
this.redirectViewProvider = redirectViewProvider;
} | [
"public",
"void",
"setRedirectViewProvider",
"(",
"final",
"Function",
"<",
"String",
",",
"RedirectView",
">",
"redirectViewProvider",
")",
"{",
"Validate",
".",
"notNull",
"(",
"redirectViewProvider",
",",
"\"RedirectView provider cannot be null\"",
")",
";",
"this",
... | <p>
Sets the provider function for creating {@link RedirectView} instances when a redirect
request is passed to the view resolver.
</p>
<p>
Note the parameter specified to the function will be the {@code URL} of the redirect
(as specified in the view name returned by the controller, without the {@code redirect:}
prefix).
</p>
@param redirectViewProvider the redirect-view provider function. | [
"<p",
">",
"Sets",
"the",
"provider",
"function",
"for",
"creating",
"{",
"@link",
"RedirectView",
"}",
"instances",
"when",
"a",
"redirect",
"request",
"is",
"passed",
"to",
"the",
"view",
"resolver",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Note",
"the",
... | train | https://github.com/thymeleaf/thymeleaf-spring/blob/9aa15a19017a0938e57646e3deefb8a90ab78dcb/thymeleaf-spring5/src/main/java/org/thymeleaf/spring5/view/reactive/ThymeleafReactiveViewResolver.java#L389-L392 |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/utils/MessageFormatterUtils.java | MessageFormatterUtils.format | public static String format(final String pattern, Object... params) {
return MessageFormatter.arrayFormat(pattern, params).getMessage();
} | java | public static String format(final String pattern, Object... params) {
return MessageFormatter.arrayFormat(pattern, params).getMessage();
} | [
"public",
"static",
"String",
"format",
"(",
"final",
"String",
"pattern",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"MessageFormatter",
".",
"arrayFormat",
"(",
"pattern",
",",
"params",
")",
".",
"getMessage",
"(",
")",
";",
"}"
] | based on String pattern, which contains placeholder <code>{}</code>, inserts params into
the pattern and returns resulting String
@param pattern string pattern with placeholders {}
@param params to replace placeholders with
@return String with params inserted into pattern | [
"based",
"on",
"String",
"pattern",
"which",
"contains",
"placeholder",
"<code",
">",
"{}",
"<",
"/",
"code",
">",
"inserts",
"params",
"into",
"the",
"pattern",
"and",
"returns",
"resulting",
"String"
] | train | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/utils/MessageFormatterUtils.java#L47-L49 |
ansell/csvstream | src/main/java/com/github/ansell/csv/stream/CSVStream.java | CSVStream.newCSVWriter | public static SequenceWriter newCSVWriter(final OutputStream outputStream, List<String> headers)
throws IOException {
return newCSVWriter(outputStream, buildSchema(headers));
} | java | public static SequenceWriter newCSVWriter(final OutputStream outputStream, List<String> headers)
throws IOException {
return newCSVWriter(outputStream, buildSchema(headers));
} | [
"public",
"static",
"SequenceWriter",
"newCSVWriter",
"(",
"final",
"OutputStream",
"outputStream",
",",
"List",
"<",
"String",
">",
"headers",
")",
"throws",
"IOException",
"{",
"return",
"newCSVWriter",
"(",
"outputStream",
",",
"buildSchema",
"(",
"headers",
")... | Returns a Jackson {@link SequenceWriter} which will write CSV lines to the
given {@link OutputStream} using the headers provided.
@param outputStream
The writer which will receive the CSV file.
@param headers
The column headers that will be used by the returned Jackson
{@link SequenceWriter}.
@return A Jackson {@link SequenceWriter} that can have
{@link SequenceWriter#write(Object)} called on it to emit CSV lines
to the given {@link OutputStream}.
@throws IOException
If there is a problem writing the CSV header line to the
{@link OutputStream}. | [
"Returns",
"a",
"Jackson",
"{",
"@link",
"SequenceWriter",
"}",
"which",
"will",
"write",
"CSV",
"lines",
"to",
"the",
"given",
"{",
"@link",
"OutputStream",
"}",
"using",
"the",
"headers",
"provided",
"."
] | train | https://github.com/ansell/csvstream/blob/9468bfbd6997fbc4237eafc990ba811cd5905dc1/src/main/java/com/github/ansell/csv/stream/CSVStream.java#L476-L479 |
eurekaclinical/protempa | protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/JDBCDecimalDayParser.java | JDBCDecimalDayParser.toPosition | @Override
public Long toPosition(ResultSet resultSet, int columnIndex, int colType)
throws SQLException {
int date = resultSet.getInt(columnIndex);
if (date < 10000000) {
return null;
}
int year = date / 10000;
int monthDay = date - year * 10000;
int month = monthDay / 100;
int day = monthDay - month * 100;
synchronized (calendar) {
calendar.clear();
calendar.set(year, month - 1, day);
return AbsoluteTimeGranularityUtil.asPosition(calendar.getTime());
}
} | java | @Override
public Long toPosition(ResultSet resultSet, int columnIndex, int colType)
throws SQLException {
int date = resultSet.getInt(columnIndex);
if (date < 10000000) {
return null;
}
int year = date / 10000;
int monthDay = date - year * 10000;
int month = monthDay / 100;
int day = monthDay - month * 100;
synchronized (calendar) {
calendar.clear();
calendar.set(year, month - 1, day);
return AbsoluteTimeGranularityUtil.asPosition(calendar.getTime());
}
} | [
"@",
"Override",
"public",
"Long",
"toPosition",
"(",
"ResultSet",
"resultSet",
",",
"int",
"columnIndex",
",",
"int",
"colType",
")",
"throws",
"SQLException",
"{",
"int",
"date",
"=",
"resultSet",
".",
"getInt",
"(",
"columnIndex",
")",
";",
"if",
"(",
"... | Parses strings with format <code>yyyyMMdd</code> into a position with a
granularity of
{@link org.protempa.proposition.value.AbsoluteTimeGranularity} with a
granularity of DAY.
@param resultSet a {@link ResultSet}.
@param columnIndex the column to parse.
@param colType the type of the column as a {@link java.sql.Types}.
@return a position with a granularity of
{@link org.protempa.proposition.value.AbsoluteTimeGranularity} with a
granularity of DAY.
@throws SQLException if an error occurred retrieving the value from
the result set. | [
"Parses",
"strings",
"with",
"format",
"<code",
">",
"yyyyMMdd<",
"/",
"code",
">",
"into",
"a",
"position",
"with",
"a",
"granularity",
"of",
"{",
"@link",
"org",
".",
"protempa",
".",
"proposition",
".",
"value",
".",
"AbsoluteTimeGranularity",
"}",
"with"... | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/JDBCDecimalDayParser.java#L64-L80 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java | GoogleCloudStorageImpl.listObjectInfo | @Override
public List<GoogleCloudStorageItemInfo> listObjectInfo(
String bucketName, String objectNamePrefix, String delimiter, long maxResults)
throws IOException {
logger.atFine().log(
"listObjectInfo(%s, %s, %s, %s)", bucketName, objectNamePrefix, delimiter, maxResults);
// Helper will handle going through pages of list results and accumulating them.
List<StorageObject> listedObjects = new ArrayList<>();
List<String> listedPrefixes = new ArrayList<>();
listStorageObjectsAndPrefixes(
bucketName,
objectNamePrefix,
delimiter,
/* includeTrailingDelimiter= */ true,
maxResults,
listedObjects,
listedPrefixes);
// For the listedObjects, we simply parse each item into a GoogleCloudStorageItemInfo without
// further work.
List<GoogleCloudStorageItemInfo> objectInfos = new ArrayList<>(listedObjects.size());
for (StorageObject obj : listedObjects) {
objectInfos.add(
createItemInfoForStorageObject(new StorageResourceId(bucketName, obj.getName()), obj));
}
if (listedPrefixes.isEmpty()) {
return objectInfos;
}
handlePrefixes(bucketName, listedPrefixes, objectInfos);
return objectInfos;
} | java | @Override
public List<GoogleCloudStorageItemInfo> listObjectInfo(
String bucketName, String objectNamePrefix, String delimiter, long maxResults)
throws IOException {
logger.atFine().log(
"listObjectInfo(%s, %s, %s, %s)", bucketName, objectNamePrefix, delimiter, maxResults);
// Helper will handle going through pages of list results and accumulating them.
List<StorageObject> listedObjects = new ArrayList<>();
List<String> listedPrefixes = new ArrayList<>();
listStorageObjectsAndPrefixes(
bucketName,
objectNamePrefix,
delimiter,
/* includeTrailingDelimiter= */ true,
maxResults,
listedObjects,
listedPrefixes);
// For the listedObjects, we simply parse each item into a GoogleCloudStorageItemInfo without
// further work.
List<GoogleCloudStorageItemInfo> objectInfos = new ArrayList<>(listedObjects.size());
for (StorageObject obj : listedObjects) {
objectInfos.add(
createItemInfoForStorageObject(new StorageResourceId(bucketName, obj.getName()), obj));
}
if (listedPrefixes.isEmpty()) {
return objectInfos;
}
handlePrefixes(bucketName, listedPrefixes, objectInfos);
return objectInfos;
} | [
"@",
"Override",
"public",
"List",
"<",
"GoogleCloudStorageItemInfo",
">",
"listObjectInfo",
"(",
"String",
"bucketName",
",",
"String",
"objectNamePrefix",
",",
"String",
"delimiter",
",",
"long",
"maxResults",
")",
"throws",
"IOException",
"{",
"logger",
".",
"a... | See {@link GoogleCloudStorage#listObjectInfo(String, String, String, long)} for details about
expected behavior. | [
"See",
"{"
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java#L1357-L1391 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java | UnsignedNumeric.writeUnsignedLong | public static void writeUnsignedLong(byte[] bytes, int offset, long i) {
while ((i & ~0x7F) != 0) {
bytes[offset++] = (byte) ((i & 0x7f) | 0x80);
i >>>= 7;
}
bytes[offset] = (byte) i;
} | java | public static void writeUnsignedLong(byte[] bytes, int offset, long i) {
while ((i & ~0x7F) != 0) {
bytes[offset++] = (byte) ((i & 0x7f) | 0x80);
i >>>= 7;
}
bytes[offset] = (byte) i;
} | [
"public",
"static",
"void",
"writeUnsignedLong",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"long",
"i",
")",
"{",
"while",
"(",
"(",
"i",
"&",
"~",
"0x7F",
")",
"!=",
"0",
")",
"{",
"bytes",
"[",
"offset",
"++",
"]",
"=",
"(",
... | Writes an int in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes.
Negative numbers are not supported.
@param i int to write | [
"Writes",
"an",
"int",
"in",
"a",
"variable",
"-",
"length",
"format",
".",
"Writes",
"between",
"one",
"and",
"nine",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"are",
"not",
"supported",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java#L204-L210 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.