repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendPingBlocking | public static void sendPingBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException {
sendBlockingInternal(pooledData, WebSocketFrameType.PING, wsChannel);
} | java | public static void sendPingBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException {
sendBlockingInternal(pooledData, WebSocketFrameType.PING, wsChannel);
} | [
"public",
"static",
"void",
"sendPingBlocking",
"(",
"final",
"PooledByteBuffer",
"pooledData",
",",
"final",
"WebSocketChannel",
"wsChannel",
")",
"throws",
"IOException",
"{",
"sendBlockingInternal",
"(",
"pooledData",
",",
"WebSocketFrameType",
".",
"PING",
",",
"w... | Sends a complete ping message using blocking IO
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel | [
"Sends",
"a",
"complete",
"ping",
"message",
"using",
"blocking",
"IO",
"Automatically",
"frees",
"the",
"pooled",
"byte",
"buffer",
"when",
"done",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L399-L401 |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/context/condition/Condition.java | Condition.getConditionValues | public List<Comparable<?>> getConditionValues(final List<?> parameters) {
List<Comparable<?>> result = new LinkedList<>(positionValueMap.values());
for (Entry<Integer, Integer> entry : positionIndexMap.entrySet()) {
Object parameter = parameters.get(entry.getValue());
if (!(parameter instanceof Comparable<?>)) {
throw new ShardingException("Parameter `%s` should extends Comparable for sharding value.", parameter);
}
if (entry.getKey() < result.size()) {
result.add(entry.getKey(), (Comparable<?>) parameter);
} else {
result.add((Comparable<?>) parameter);
}
}
return result;
} | java | public List<Comparable<?>> getConditionValues(final List<?> parameters) {
List<Comparable<?>> result = new LinkedList<>(positionValueMap.values());
for (Entry<Integer, Integer> entry : positionIndexMap.entrySet()) {
Object parameter = parameters.get(entry.getValue());
if (!(parameter instanceof Comparable<?>)) {
throw new ShardingException("Parameter `%s` should extends Comparable for sharding value.", parameter);
}
if (entry.getKey() < result.size()) {
result.add(entry.getKey(), (Comparable<?>) parameter);
} else {
result.add((Comparable<?>) parameter);
}
}
return result;
} | [
"public",
"List",
"<",
"Comparable",
"<",
"?",
">",
">",
"getConditionValues",
"(",
"final",
"List",
"<",
"?",
">",
"parameters",
")",
"{",
"List",
"<",
"Comparable",
"<",
"?",
">",
">",
"result",
"=",
"new",
"LinkedList",
"<>",
"(",
"positionValueMap",
... | Get condition values.
@param parameters parameters
@return condition values | [
"Get",
"condition",
"values",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/context/condition/Condition.java#L115-L129 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Image.java | Image.setColor | public void setColor(int corner, float r, float g, float b, float a) {
if (corners == null) {
corners = new Color[] {new Color(1,1,1,1f),new Color(1,1,1,1f), new Color(1,1,1,1f), new Color(1,1,1,1f)};
}
corners[corner].r = r;
corners[corner].g = g;
corners[corner].b = b;
corners[corner].a = a;
} | java | public void setColor(int corner, float r, float g, float b, float a) {
if (corners == null) {
corners = new Color[] {new Color(1,1,1,1f),new Color(1,1,1,1f), new Color(1,1,1,1f), new Color(1,1,1,1f)};
}
corners[corner].r = r;
corners[corner].g = g;
corners[corner].b = b;
corners[corner].a = a;
} | [
"public",
"void",
"setColor",
"(",
"int",
"corner",
",",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"if",
"(",
"corners",
"==",
"null",
")",
"{",
"corners",
"=",
"new",
"Color",
"[",
"]",
"{",
"new",
"Color",... | Set the color of the given corner when this image is rendered. This is
useful lots of visual effect but especially light maps
@param corner The corner identifier for the corner to be set
@param r The red component value to set (between 0 and 1)
@param g The green component value to set (between 0 and 1)
@param b The blue component value to set (between 0 and 1)
@param a The alpha component value to set (between 0 and 1) | [
"Set",
"the",
"color",
"of",
"the",
"given",
"corner",
"when",
"this",
"image",
"is",
"rendered",
".",
"This",
"is",
"useful",
"lots",
"of",
"visual",
"effect",
"but",
"especially",
"light",
"maps"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L375-L384 |
lessthanoptimal/BoofCV | demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java | DemoThreeViewStereoApp.scaleBuffered | private BufferedImage scaleBuffered( BufferedImage input ) {
int m = Math.max(input.getWidth(),input.getHeight());
if( m <= controls.maxImageSize )
return input;
else {
double scale = controls.maxImageSize/(double)m;
int w = (int)(scale*input.getWidth()+0.5);
int h = (int)(scale*input.getHeight()+0.5);
// Use BoofCV to down sample since Graphics2D introduced too many aliasing artifacts
BufferedImage output = new BufferedImage(w,h,input.getType());
Planar<GrayU8> a = new Planar<>(GrayU8.class,input.getWidth(),input.getHeight(),3);
Planar<GrayU8> b = new Planar<>(GrayU8.class,w,h,3);
ConvertBufferedImage.convertFrom(input,a,true);
AverageDownSampleOps.down(a,b);
ConvertBufferedImage.convertTo(b,output,true);
return output;
}
} | java | private BufferedImage scaleBuffered( BufferedImage input ) {
int m = Math.max(input.getWidth(),input.getHeight());
if( m <= controls.maxImageSize )
return input;
else {
double scale = controls.maxImageSize/(double)m;
int w = (int)(scale*input.getWidth()+0.5);
int h = (int)(scale*input.getHeight()+0.5);
// Use BoofCV to down sample since Graphics2D introduced too many aliasing artifacts
BufferedImage output = new BufferedImage(w,h,input.getType());
Planar<GrayU8> a = new Planar<>(GrayU8.class,input.getWidth(),input.getHeight(),3);
Planar<GrayU8> b = new Planar<>(GrayU8.class,w,h,3);
ConvertBufferedImage.convertFrom(input,a,true);
AverageDownSampleOps.down(a,b);
ConvertBufferedImage.convertTo(b,output,true);
return output;
}
} | [
"private",
"BufferedImage",
"scaleBuffered",
"(",
"BufferedImage",
"input",
")",
"{",
"int",
"m",
"=",
"Math",
".",
"max",
"(",
"input",
".",
"getWidth",
"(",
")",
",",
"input",
".",
"getHeight",
"(",
")",
")",
";",
"if",
"(",
"m",
"<=",
"controls",
... | Scale buffered image so that it meets the image size restrictions | [
"Scale",
"buffered",
"image",
"so",
"that",
"it",
"meets",
"the",
"image",
"size",
"restrictions"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/sfm/multiview/DemoThreeViewStereoApp.java#L309-L327 |
schallee/alib4j | core/src/main/java/net/darkmist/alib/io/BufferUtil.java | BufferUtil.allocateAndReadAll | public static ByteBuffer allocateAndReadAll(int size, ReadableByteChannel channel) throws IOException
{
ByteBuffer buf = ByteBuffer.allocate(size);
int justRead;
int totalRead = 0;
// FIXME, this will be a tight loop if the channel is non-blocking...
while(totalRead < size)
{
logger.debug("reading totalRead={}", totalRead);
if((justRead = channel.read(buf))<0)
throw new EOFException("Unexpected end of stream after reading " + totalRead + " bytes");
totalRead += justRead;
}
buf.rewind();
return buf;
} | java | public static ByteBuffer allocateAndReadAll(int size, ReadableByteChannel channel) throws IOException
{
ByteBuffer buf = ByteBuffer.allocate(size);
int justRead;
int totalRead = 0;
// FIXME, this will be a tight loop if the channel is non-blocking...
while(totalRead < size)
{
logger.debug("reading totalRead={}", totalRead);
if((justRead = channel.read(buf))<0)
throw new EOFException("Unexpected end of stream after reading " + totalRead + " bytes");
totalRead += justRead;
}
buf.rewind();
return buf;
} | [
"public",
"static",
"ByteBuffer",
"allocateAndReadAll",
"(",
"int",
"size",
",",
"ReadableByteChannel",
"channel",
")",
"throws",
"IOException",
"{",
"ByteBuffer",
"buf",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"size",
")",
";",
"int",
"justRead",
";",
"int",
... | Allocate a buffer and fill it from a channel. The returned
buffer will be rewound to the begining.
@return Buffer containing size bytes from the channel.
@throws IOException if the channel read does.
@throws EOFException if a end of stream is encountered
before the full size is read. | [
"Allocate",
"a",
"buffer",
"and",
"fill",
"it",
"from",
"a",
"channel",
".",
"The",
"returned",
"buffer",
"will",
"be",
"rewound",
"to",
"the",
"begining",
"."
] | train | https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/io/BufferUtil.java#L57-L73 |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/TokenList.java | TokenList.insertAfter | public void insertAfter(Token before, TokenList list ) {
Token after = before.next;
before.next = list.first;
list.first.previous = before;
if( after == null ) {
last = list.last;
} else {
after.previous = list.last;
list.last.next = after;
}
size += list.size;
} | java | public void insertAfter(Token before, TokenList list ) {
Token after = before.next;
before.next = list.first;
list.first.previous = before;
if( after == null ) {
last = list.last;
} else {
after.previous = list.last;
list.last.next = after;
}
size += list.size;
} | [
"public",
"void",
"insertAfter",
"(",
"Token",
"before",
",",
"TokenList",
"list",
")",
"{",
"Token",
"after",
"=",
"before",
".",
"next",
";",
"before",
".",
"next",
"=",
"list",
".",
"first",
";",
"list",
".",
"first",
".",
"previous",
"=",
"before",... | Inserts the LokenList immediately following the 'before' token | [
"Inserts",
"the",
"LokenList",
"immediately",
"following",
"the",
"before",
"token"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/TokenList.java#L217-L229 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/generic/WrappingUtils.java | WrappingUtils.maybeWrapWithScaleType | @Nullable
static Drawable maybeWrapWithScaleType(
@Nullable Drawable drawable,
@Nullable ScalingUtils.ScaleType scaleType,
@Nullable PointF focusPoint) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("WrappingUtils#maybeWrapWithScaleType");
}
if (drawable == null || scaleType == null) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
return drawable;
}
ScaleTypeDrawable scaleTypeDrawable = new ScaleTypeDrawable(drawable, scaleType);
if (focusPoint != null) {
scaleTypeDrawable.setFocusPoint(focusPoint);
}
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
return scaleTypeDrawable;
} | java | @Nullable
static Drawable maybeWrapWithScaleType(
@Nullable Drawable drawable,
@Nullable ScalingUtils.ScaleType scaleType,
@Nullable PointF focusPoint) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("WrappingUtils#maybeWrapWithScaleType");
}
if (drawable == null || scaleType == null) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
return drawable;
}
ScaleTypeDrawable scaleTypeDrawable = new ScaleTypeDrawable(drawable, scaleType);
if (focusPoint != null) {
scaleTypeDrawable.setFocusPoint(focusPoint);
}
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
return scaleTypeDrawable;
} | [
"@",
"Nullable",
"static",
"Drawable",
"maybeWrapWithScaleType",
"(",
"@",
"Nullable",
"Drawable",
"drawable",
",",
"@",
"Nullable",
"ScalingUtils",
".",
"ScaleType",
"scaleType",
",",
"@",
"Nullable",
"PointF",
"focusPoint",
")",
"{",
"if",
"(",
"FrescoSystrace",... | Wraps the given drawable with a new {@link ScaleTypeDrawable}.
<p>If the provided drawable or scale type is null, the given drawable is returned without being
wrapped.
@return the wrapping scale type drawable, or the original drawable if the wrapping didn't take
place | [
"Wraps",
"the",
"given",
"drawable",
"with",
"a",
"new",
"{",
"@link",
"ScaleTypeDrawable",
"}",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/generic/WrappingUtils.java#L80-L102 |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/AttributePayload.java | AttributePayload.withAttributes | public AttributePayload withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public AttributePayload withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"AttributePayload",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A JSON string containing up to three key-value pair in JSON format. For example:
</p>
<p>
<code>{\"attributes\":{\"string1\":\"string2\"}}</code>
</p>
@param attributes
A JSON string containing up to three key-value pair in JSON format. For example:</p>
<p>
<code>{\"attributes\":{\"string1\":\"string2\"}}</code>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"JSON",
"string",
"containing",
"up",
"to",
"three",
"key",
"-",
"value",
"pair",
"in",
"JSON",
"format",
".",
"For",
"example",
":",
"<",
"/",
"p",
">",
"<p",
">",
"<code",
">",
"{",
"\\",
"attributes",
"\\",
":",
"{",
"\\",
"str... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/AttributePayload.java#L103-L106 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/FileUtils.java | FileUtils.toXML | public static String toXML(final String aFilePath, final String aPattern) throws FileNotFoundException,
TransformerException {
return toXML(aFilePath, aPattern, false);
} | java | public static String toXML(final String aFilePath, final String aPattern) throws FileNotFoundException,
TransformerException {
return toXML(aFilePath, aPattern, false);
} | [
"public",
"static",
"String",
"toXML",
"(",
"final",
"String",
"aFilePath",
",",
"final",
"String",
"aPattern",
")",
"throws",
"FileNotFoundException",
",",
"TransformerException",
"{",
"return",
"toXML",
"(",
"aFilePath",
",",
"aPattern",
",",
"false",
")",
";"... | Creates a string of XML that describes the supplied file or directory (and all its subdirectories). Includes
absolute path, last modified time, read/write permissions, etc.
@param aFilePath The file or directory to be returned as XML
@param aPattern A regular expression that file names must match
@return A string of XML describing the supplied file system path's structure
@throws FileNotFoundException If the supplied file or directory can not be found
@throws TransformerException If there is trouble with the XSL transformation | [
"Creates",
"a",
"string",
"of",
"XML",
"that",
"describes",
"the",
"supplied",
"file",
"or",
"directory",
"(",
"and",
"all",
"its",
"subdirectories",
")",
".",
"Includes",
"absolute",
"path",
"last",
"modified",
"time",
"read",
"/",
"write",
"permissions",
"... | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L137-L140 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.writeDependency | public int writeDependency(Object id, ValueSet vs) { // SKS-O
int returnCode = htod.writeDependency(id, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | java | public int writeDependency(Object id, ValueSet vs) { // SKS-O
int returnCode = htod.writeDependency(id, vs);
if (returnCode == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
return returnCode;
} | [
"public",
"int",
"writeDependency",
"(",
"Object",
"id",
",",
"ValueSet",
"vs",
")",
"{",
"// SKS-O",
"int",
"returnCode",
"=",
"htod",
".",
"writeDependency",
"(",
"id",
",",
"vs",
")",
";",
"if",
"(",
"returnCode",
"==",
"HTODDynacache",
".",
"DISK_EXCEP... | Call this method to write a dependency id with a collection of cache ids to the disk.
@param id
- dependency id.
@param vs
- a collection of cache ids. | [
"Call",
"this",
"method",
"to",
"write",
"a",
"dependency",
"id",
"with",
"a",
"collection",
"of",
"cache",
"ids",
"to",
"the",
"disk",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1564-L1570 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java | IterableOfProtosSubject.usingDoubleToleranceForFields | public IterableOfProtosFluentAssertion<M> usingDoubleToleranceForFields(
double tolerance, Iterable<Integer> fieldNumbers) {
return usingConfig(config.usingDoubleToleranceForFields(tolerance, fieldNumbers));
} | java | public IterableOfProtosFluentAssertion<M> usingDoubleToleranceForFields(
double tolerance, Iterable<Integer> fieldNumbers) {
return usingConfig(config.usingDoubleToleranceForFields(tolerance, fieldNumbers));
} | [
"public",
"IterableOfProtosFluentAssertion",
"<",
"M",
">",
"usingDoubleToleranceForFields",
"(",
"double",
"tolerance",
",",
"Iterable",
"<",
"Integer",
">",
"fieldNumbers",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"usingDoubleToleranceForFields",
"(",
... | Compares double fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance. | [
"Compares",
"double",
"fields",
"with",
"these",
"explicitly",
"specified",
"top",
"-",
"level",
"field",
"numbers",
"using",
"the",
"provided",
"absolute",
"tolerance",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java#L764-L767 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java | DatastreamResource.deleteDatastream | @Path("/{dsID}")
@DELETE
@Produces(MediaType.APPLICATION_JSON)
public Response deleteDatastream(@PathParam(RestParam.PID) String pid,
@PathParam(RestParam.DSID) String dsID,
@QueryParam(RestParam.START_DT) String startDT,
@QueryParam(RestParam.END_DT) String endDT,
@QueryParam(RestParam.LOG_MESSAGE) String logMessage,
@QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) {
try {
Context context = getContext();
Date startDate = DateUtility.parseDateOrNull(startDT);
Date endDate = DateUtility.parseDateOrNull(endDT);
Date[] purged = m_management.purgeDatastream(context,
pid,
dsID,
startDate,
endDate,
logMessage);
// convert purged into a String[] so we can return it as a JSON array
List<String> results = new ArrayList<String>(purged.length);
for (Date d : purged) {
results.add(DateUtility.convertDateToXSDString(d));
}
return Response.ok(m_mapper.writeValueAsString(results)).build();
} catch (Exception ex) {
return handleException(ex, flash);
}
} | java | @Path("/{dsID}")
@DELETE
@Produces(MediaType.APPLICATION_JSON)
public Response deleteDatastream(@PathParam(RestParam.PID) String pid,
@PathParam(RestParam.DSID) String dsID,
@QueryParam(RestParam.START_DT) String startDT,
@QueryParam(RestParam.END_DT) String endDT,
@QueryParam(RestParam.LOG_MESSAGE) String logMessage,
@QueryParam(RestParam.FLASH) @DefaultValue("false") boolean flash) {
try {
Context context = getContext();
Date startDate = DateUtility.parseDateOrNull(startDT);
Date endDate = DateUtility.parseDateOrNull(endDT);
Date[] purged = m_management.purgeDatastream(context,
pid,
dsID,
startDate,
endDate,
logMessage);
// convert purged into a String[] so we can return it as a JSON array
List<String> results = new ArrayList<String>(purged.length);
for (Date d : purged) {
results.add(DateUtility.convertDateToXSDString(d));
}
return Response.ok(m_mapper.writeValueAsString(results)).build();
} catch (Exception ex) {
return handleException(ex, flash);
}
} | [
"@",
"Path",
"(",
"\"/{dsID}\"",
")",
"@",
"DELETE",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"public",
"Response",
"deleteDatastream",
"(",
"@",
"PathParam",
"(",
"RestParam",
".",
"PID",
")",
"String",
"pid",
",",
"@",
"PathParam",
... | <p>Invoke API-M.purgeDatastream
</p><p>
DELETE /objects/{pid}/datastreams/{dsID} ? startDT endDT logMessage</p> | [
"<p",
">",
"Invoke",
"API",
"-",
"M",
".",
"purgeDatastream",
"<",
"/",
"p",
">",
"<p",
">",
"DELETE",
"/",
"objects",
"/",
"{",
"pid",
"}",
"/",
"datastreams",
"/",
"{",
"dsID",
"}",
"?",
"startDT",
"endDT",
"logMessage<",
"/",
"p",
">"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java#L293-L323 |
protegeproject/jpaul | src/main/java/jpaul/DataStructs/Relation.java | Relation.forAllEntries | public void forAllEntries(EntryVisitor<K,V> visitor) {
try {
for(K key : keys()) {
for(V value : _getValues(key)) {
visitor.visit(key, value);
}
}
}
catch(InterruptTraversalException itex) {
// Do nothing; InterruptTraversalException is only a way
// to terminate the traversal prematurely.
}
} | java | public void forAllEntries(EntryVisitor<K,V> visitor) {
try {
for(K key : keys()) {
for(V value : _getValues(key)) {
visitor.visit(key, value);
}
}
}
catch(InterruptTraversalException itex) {
// Do nothing; InterruptTraversalException is only a way
// to terminate the traversal prematurely.
}
} | [
"public",
"void",
"forAllEntries",
"(",
"EntryVisitor",
"<",
"K",
",",
"V",
">",
"visitor",
")",
"{",
"try",
"{",
"for",
"(",
"K",
"key",
":",
"keys",
"(",
")",
")",
"{",
"for",
"(",
"V",
"value",
":",
"_getValues",
"(",
"key",
")",
")",
"{",
"... | Visits all the entries <code><key,value></code> of
<code>this</code> relation and calls
<code>visitor.visit</code> on each of them. This traversal of
the relation entries can be stopped at any point by throwing
an {@link jpaul.DataStructs.InterruptTraversalException
InterruptTraversalException} from the visitor; the exception
is caught internally by the implementation of this method. | [
"Visits",
"all",
"the",
"entries",
"<code",
">",
"<",
";",
"key",
"value>",
";",
"<",
"/",
"code",
">",
"of",
"<code",
">",
"this<",
"/",
"code",
">",
"relation",
"and",
"calls",
"<code",
">",
"visitor",
".",
"visit<",
"/",
"code",
">",
"on",
"... | train | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/Relation.java#L189-L201 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SessionBeanO.java | SessionBeanO.getEJBObject | @Override
public EJBObject getEJBObject()
{
EJBObject result = null;
// d367572.1 start
if (state == PRE_CREATE || state == DESTROYED)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Incorrect state: " + getStateName(state));
throw new IllegalStateException(getStateName(state));
}
// d367572.1 end
try
{
//
// Convert this result to a stub. Stubs are essential
// to our exception handling semantics as well as to other
// ORB related behaviors.
// d111679 d156807.1
EJSWrapper wrapper = container.wrapperManager.getWrapper(beanId).getRemoteWrapper();
Object wrapperRef = container.getEJBRuntime().getRemoteReference(wrapper);
// "The container must implement the SessionContext.getEJBObject
// method such that the bean instance can use the Java language cast
// to convert the returned value to the session bean’s remote
// component interface type. Specifically, the bean instance does
// not have to use the PortableRemoteObject.narrow method for the
// type conversion."
result = (EJBObject) PortableRemoteObject.narrow(wrapperRef, home.beanMetaData.remoteInterfaceClass);
} catch (IllegalStateException ise) { // d116480
// FFDC not logged for this spec required scenario
throw ise;
} catch (Exception ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".getEJBObject", "204", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d144064
Tr.debug(tc, "getEJBObject() failed", ex);
throw new IllegalStateException("Failed to obtain EJBObject", ex);
}
return result;
} | java | @Override
public EJBObject getEJBObject()
{
EJBObject result = null;
// d367572.1 start
if (state == PRE_CREATE || state == DESTROYED)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Incorrect state: " + getStateName(state));
throw new IllegalStateException(getStateName(state));
}
// d367572.1 end
try
{
//
// Convert this result to a stub. Stubs are essential
// to our exception handling semantics as well as to other
// ORB related behaviors.
// d111679 d156807.1
EJSWrapper wrapper = container.wrapperManager.getWrapper(beanId).getRemoteWrapper();
Object wrapperRef = container.getEJBRuntime().getRemoteReference(wrapper);
// "The container must implement the SessionContext.getEJBObject
// method such that the bean instance can use the Java language cast
// to convert the returned value to the session bean’s remote
// component interface type. Specifically, the bean instance does
// not have to use the PortableRemoteObject.narrow method for the
// type conversion."
result = (EJBObject) PortableRemoteObject.narrow(wrapperRef, home.beanMetaData.remoteInterfaceClass);
} catch (IllegalStateException ise) { // d116480
// FFDC not logged for this spec required scenario
throw ise;
} catch (Exception ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".getEJBObject", "204", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d144064
Tr.debug(tc, "getEJBObject() failed", ex);
throw new IllegalStateException("Failed to obtain EJBObject", ex);
}
return result;
} | [
"@",
"Override",
"public",
"EJBObject",
"getEJBObject",
"(",
")",
"{",
"EJBObject",
"result",
"=",
"null",
";",
"// d367572.1 start",
"if",
"(",
"state",
"==",
"PRE_CREATE",
"||",
"state",
"==",
"DESTROYED",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAny... | Obtain a reference to the EJB object that is currently associated with
the instance. <p>
An instance of a session enterprise Bean can call this method at anytime
between the ejbCreate() and ejbRemove() methods, including from within the
ejbCreate() and ejbRemove() methods. <p>
An instance can use this method, for example, when it wants to pass a
reference to itself in a method argument or result.
@return The EJB object currently associated with the instance.
@exception IllegalStateException Thrown if the instance invokes this
method while the instance is in a state that does not allow the
instance to invoke this method, or if the instance does not
have a remote interface. | [
"Obtain",
"a",
"reference",
"to",
"the",
"EJB",
"object",
"that",
"is",
"currently",
"associated",
"with",
"the",
"instance",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/SessionBeanO.java#L319-L360 |
hawtio/hawtio | hawtio-system/src/main/java/io/hawt/web/auth/LoginServlet.java | LoginServlet.doPost | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
clearSession(request);
JSONObject json = ServletHelpers.readObject(request.getReader());
String username = (String) json.get("username");
String password = (String) json.get("password");
AuthenticateResult result = Authenticator.authenticate(
authConfiguration, request, username, password,
subject -> {
LOG.info("Logging in user: {}", AuthHelpers.getUsername(subject));
setupSession(request, subject, username);
sendResponse(response, subject);
});
switch (result) {
case AUTHORIZED:
// response was sent using the authenticated subject, nothing more to do
break;
case NOT_AUTHORIZED:
case NO_CREDENTIALS:
ServletHelpers.doForbidden(response);
break;
}
} | java | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
clearSession(request);
JSONObject json = ServletHelpers.readObject(request.getReader());
String username = (String) json.get("username");
String password = (String) json.get("password");
AuthenticateResult result = Authenticator.authenticate(
authConfiguration, request, username, password,
subject -> {
LOG.info("Logging in user: {}", AuthHelpers.getUsername(subject));
setupSession(request, subject, username);
sendResponse(response, subject);
});
switch (result) {
case AUTHORIZED:
// response was sent using the authenticated subject, nothing more to do
break;
case NOT_AUTHORIZED:
case NO_CREDENTIALS:
ServletHelpers.doForbidden(response);
break;
}
} | [
"@",
"Override",
"protected",
"void",
"doPost",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"clearSession",
"(",
"request",
")",
";",
"JSONObject",
"json",
"=",
"ServletHelpers",
".",
"readObject",... | POST with username/password tries authentication and returns result as JSON | [
"POST",
"with",
"username",
"/",
"password",
"tries",
"authentication",
"and",
"returns",
"result",
"as",
"JSON"
] | train | https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/hawtio-system/src/main/java/io/hawt/web/auth/LoginServlet.java#L90-L115 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java | TupleGenerator.makeSatisfied | private boolean makeSatisfied( TestCaseDef testCase, VarTupleSet tuples)
{
// Test case still missing a required property?
boolean satisfied = testCase.isSatisfied();
if( !satisfied)
{
// Yes, find tuples that contain satisfying bindings.
int prevBindings = testCase.getBindingCount();
for( Iterator<Tuple> satisfyingTuples = getSatisfyingTuples( testCase, tuples);
// Does this tuple lead to satisfaction of all current test case conditions?
satisfyingTuples.hasNext()
&& !(satisfied = makeSatisfied( testCase, tuples, satisfyingTuples.next()));
// No, try next tuple
testCase.revertBindings( prevBindings));
}
return satisfied;
} | java | private boolean makeSatisfied( TestCaseDef testCase, VarTupleSet tuples)
{
// Test case still missing a required property?
boolean satisfied = testCase.isSatisfied();
if( !satisfied)
{
// Yes, find tuples that contain satisfying bindings.
int prevBindings = testCase.getBindingCount();
for( Iterator<Tuple> satisfyingTuples = getSatisfyingTuples( testCase, tuples);
// Does this tuple lead to satisfaction of all current test case conditions?
satisfyingTuples.hasNext()
&& !(satisfied = makeSatisfied( testCase, tuples, satisfyingTuples.next()));
// No, try next tuple
testCase.revertBindings( prevBindings));
}
return satisfied;
} | [
"private",
"boolean",
"makeSatisfied",
"(",
"TestCaseDef",
"testCase",
",",
"VarTupleSet",
"tuples",
")",
"{",
"// Test case still missing a required property?",
"boolean",
"satisfied",
"=",
"testCase",
".",
"isSatisfied",
"(",
")",
";",
"if",
"(",
"!",
"satisfied",
... | Using selections from the given set of tuples, completes bindings to satisfy all current test case conditions.
Returns true if and only if all conditions satisfied. | [
"Using",
"selections",
"from",
"the",
"given",
"set",
"of",
"tuples",
"completes",
"bindings",
"to",
"satisfy",
"all",
"current",
"test",
"case",
"conditions",
".",
"Returns",
"true",
"if",
"and",
"only",
"if",
"all",
"conditions",
"satisfied",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java#L482-L501 |
MTDdk/jawn | jawn-templates-stringtemplate/src/main/java/net/javapla/jawn/templates/stringtemplate/rewrite/STFastGroupDir.java | STFastGroupDir.loadTemplateResource | private final CompiledST loadTemplateResource(String prefix, String unqualifiedFileName) {
//if (resourceRoot == null) return null;
//return loadTemplate(resourceRoot, prefix, unqualifiedFileName);
if (resourceRoots.isEmpty()) return null;
CompiledST template = null;
for (URL resourceRoot : resourceRoots) {
if ((template = loadTemplate(resourceRoot, prefix, unqualifiedFileName)) != null)
return template;
}
return null;
} | java | private final CompiledST loadTemplateResource(String prefix, String unqualifiedFileName) {
//if (resourceRoot == null) return null;
//return loadTemplate(resourceRoot, prefix, unqualifiedFileName);
if (resourceRoots.isEmpty()) return null;
CompiledST template = null;
for (URL resourceRoot : resourceRoots) {
if ((template = loadTemplate(resourceRoot, prefix, unqualifiedFileName)) != null)
return template;
}
return null;
} | [
"private",
"final",
"CompiledST",
"loadTemplateResource",
"(",
"String",
"prefix",
",",
"String",
"unqualifiedFileName",
")",
"{",
"//if (resourceRoot == null) return null;",
"//return loadTemplate(resourceRoot, prefix, unqualifiedFileName);",
"if",
"(",
"resourceRoots",
".",
"is... | Loads from a jar or similar resource if the template could not be found
directly on the filesystem. | [
"Loads",
"from",
"a",
"jar",
"or",
"similar",
"resource",
"if",
"the",
"template",
"could",
"not",
"be",
"found",
"directly",
"on",
"the",
"filesystem",
"."
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-templates-stringtemplate/src/main/java/net/javapla/jawn/templates/stringtemplate/rewrite/STFastGroupDir.java#L123-L133 |
liyiorg/weixin-popular | src/main/java/weixin/popular/client/LocalHttpClient.java | LocalHttpClient.executeXmlResult | public static <T> T executeXmlResult(HttpUriRequest request,Class<T> clazz){
return execute(request,XmlResponseHandler.createResponseHandler(clazz));
} | java | public static <T> T executeXmlResult(HttpUriRequest request,Class<T> clazz){
return execute(request,XmlResponseHandler.createResponseHandler(clazz));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"executeXmlResult",
"(",
"HttpUriRequest",
"request",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"execute",
"(",
"request",
",",
"XmlResponseHandler",
".",
"createResponseHandler",
"(",
"clazz",
")",
")"... | 数据返回自动XML对象解析
@param request request
@param clazz clazz
@param <T> T
@return result | [
"数据返回自动XML对象解析"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/client/LocalHttpClient.java#L166-L168 |
hageldave/ImagingKit | ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ComplexImg.java | ComplexImg.setValueR | public void setValueR(int x, int y, double value) {
int idx=y*width+x;
setValueR_atIndex(idx, value);
} | java | public void setValueR(int x, int y, double value) {
int idx=y*width+x;
setValueR_atIndex(idx, value);
} | [
"public",
"void",
"setValueR",
"(",
"int",
"x",
",",
"int",
"y",
",",
"double",
"value",
")",
"{",
"int",
"idx",
"=",
"y",
"*",
"width",
"+",
"x",
";",
"setValueR_atIndex",
"(",
"idx",
",",
"value",
")",
";",
"}"
] | Sets the real part at the specified position
<br>
If {@link #isSynchronizePowerSpectrum()} is true, then this will also
update the corresponding power value.
@param x coordinate
@param y coordinate
@param value to be set | [
"Sets",
"the",
"real",
"part",
"at",
"the",
"specified",
"position",
"<br",
">",
"If",
"{"
] | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ComplexImg.java#L430-L433 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java | ObjectEnvelopeOrdering.buildConcreteMNEdge | protected Edge buildConcreteMNEdge(Vertex vertex1, Vertex vertex2)
{
ModificationState state1 = vertex1.getEnvelope().getModificationState();
ModificationState state2 = vertex2.getEnvelope().getModificationState();
if (state1.needsUpdate() || state1.needsInsert())
{
if (state2.needsInsert())
{
// (2) must be inserted before we can create a link to it
return new Edge(vertex2, vertex1, CONCRETE_EDGE_WEIGHT);
}
}
else if (state1.needsDelete())
{
if (state2.needsDelete())
{
// there is a link from (1) to (2) which must be deleted first,
// which will happen when deleting (1) - thus:
return new Edge(vertex1, vertex2, POTENTIAL_EDGE_WEIGHT);
}
}
return null;
} | java | protected Edge buildConcreteMNEdge(Vertex vertex1, Vertex vertex2)
{
ModificationState state1 = vertex1.getEnvelope().getModificationState();
ModificationState state2 = vertex2.getEnvelope().getModificationState();
if (state1.needsUpdate() || state1.needsInsert())
{
if (state2.needsInsert())
{
// (2) must be inserted before we can create a link to it
return new Edge(vertex2, vertex1, CONCRETE_EDGE_WEIGHT);
}
}
else if (state1.needsDelete())
{
if (state2.needsDelete())
{
// there is a link from (1) to (2) which must be deleted first,
// which will happen when deleting (1) - thus:
return new Edge(vertex1, vertex2, POTENTIAL_EDGE_WEIGHT);
}
}
return null;
} | [
"protected",
"Edge",
"buildConcreteMNEdge",
"(",
"Vertex",
"vertex1",
",",
"Vertex",
"vertex2",
")",
"{",
"ModificationState",
"state1",
"=",
"vertex1",
".",
"getEnvelope",
"(",
")",
".",
"getModificationState",
"(",
")",
";",
"ModificationState",
"state2",
"=",
... | Checks if the database operations associated with two object envelopes
that are related via an m:n collection reference needs to be performed
in a particular order and if so builds and returns a corresponding
directed edge weighted with <code>CONCRETE_EDGE_WEIGHT</code>.
The following cases are considered (* means object needs update, + means
object needs insert, - means object needs to be deleted):
<table>
<tr><td>(1)* -(m:n)-> (2)*</td><td>no edge</td></tr>
<tr><td>(1)* -(m:n)-> (2)+</td><td>(2)->(1) edge</td></tr>
<tr><td>(1)* -(m:n)-> (2)-</td><td>no edge (cannot occur)</td></tr>
<tr><td>(1)+ -(m:n)-> (2)*</td><td>no edge</td></tr>
<tr><td>(1)+ -(m:n)-> (2)+</td><td>(2)->(1) edge</td></tr>
<tr><td>(1)+ -(m:n)-> (2)-</td><td>no edge (cannot occur)</td></tr>
<tr><td>(1)- -(m:n)-> (2)*</td><td>no edge</td></tr>
<tr><td>(1)- -(m:n)-> (2)+</td><td>no edge</td></tr>
<tr><td>(1)- -(m:n)-> (2)-</td><td>(1)->(2) edge</td></tr>
<table>
@param vertex1 object envelope vertex of the object holding the
collection
@param vertex2 object envelope vertex of the object contained in the
collection
@return an Edge object or null if the two database operations can
be performed in any order | [
"Checks",
"if",
"the",
"database",
"operations",
"associated",
"with",
"two",
"object",
"envelopes",
"that",
"are",
"related",
"via",
"an",
"m",
":",
"n",
"collection",
"reference",
"needs",
"to",
"be",
"performed",
"in",
"a",
"particular",
"order",
"and",
"... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java#L603-L625 |
nextreports/nextreports-engine | src/ro/nextreports/engine/exporter/ResultExporter.java | ResultExporter.getFunctionTemplate | private String getFunctionTemplate(GroupCache gc, FunctionBandElement fbe, boolean previous) throws QueryException {
StringBuilder templateKey = new StringBuilder();
if (gc == null) {
// function in Header
templateKey.append("F_").
append(fbe.getFunction()).append("_").
append(fbe.getColumn());
return templateKey.toString();
}
// function in group header
String groupColumn = gc.getGroup().getColumn();
Object groupValue;
if (previous) {
if (resultSetRow == 0) {
groupValue = getResult().nextValue(groupColumn);
} else {
groupValue = previousRow[getResult().getColumnIndex(groupColumn)];
}
} else {
groupValue = getResult().nextValue(groupColumn);
}
// keep the current value of the group
groupTemplateKeys.put("G"+ gc.getGroup().getName(), "G"+ gc.getGroup().getName() + "_" + previousRow[getResult().getColumnIndex(groupColumn)]);
templateKey.append("G").append(gc.getGroup().getName()).append("_F_").
append(fbe.getFunction()).append("_").
append(fbe.getColumn()).append("_").
append(groupValue);
int group = Integer.parseInt(gc.getGroup().getName());
StringBuilder result = new StringBuilder();
for (int i=1; i<group; i++) {
result.append(groupTemplateKeys.get("G"+ i)).append("_");
}
result.append(templateKey.toString());
return result.toString();
} | java | private String getFunctionTemplate(GroupCache gc, FunctionBandElement fbe, boolean previous) throws QueryException {
StringBuilder templateKey = new StringBuilder();
if (gc == null) {
// function in Header
templateKey.append("F_").
append(fbe.getFunction()).append("_").
append(fbe.getColumn());
return templateKey.toString();
}
// function in group header
String groupColumn = gc.getGroup().getColumn();
Object groupValue;
if (previous) {
if (resultSetRow == 0) {
groupValue = getResult().nextValue(groupColumn);
} else {
groupValue = previousRow[getResult().getColumnIndex(groupColumn)];
}
} else {
groupValue = getResult().nextValue(groupColumn);
}
// keep the current value of the group
groupTemplateKeys.put("G"+ gc.getGroup().getName(), "G"+ gc.getGroup().getName() + "_" + previousRow[getResult().getColumnIndex(groupColumn)]);
templateKey.append("G").append(gc.getGroup().getName()).append("_F_").
append(fbe.getFunction()).append("_").
append(fbe.getColumn()).append("_").
append(groupValue);
int group = Integer.parseInt(gc.getGroup().getName());
StringBuilder result = new StringBuilder();
for (int i=1; i<group; i++) {
result.append(groupTemplateKeys.get("G"+ i)).append("_");
}
result.append(templateKey.toString());
return result.toString();
} | [
"private",
"String",
"getFunctionTemplate",
"(",
"GroupCache",
"gc",
",",
"FunctionBandElement",
"fbe",
",",
"boolean",
"previous",
")",
"throws",
"QueryException",
"{",
"StringBuilder",
"templateKey",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"gc",
... | string template used by functions in header and group header bands | [
"string",
"template",
"used",
"by",
"functions",
"in",
"header",
"and",
"group",
"header",
"bands"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/exporter/ResultExporter.java#L2105-L2144 |
vdurmont/emoji-java | src/main/java/com/vdurmont/emoji/EmojiParser.java | EmojiParser.parseToHtmlHexadecimal | public static String parseToHtmlHexadecimal(
String input,
final FitzpatrickAction fitzpatrickAction
) {
EmojiTransformer emojiTransformer = new EmojiTransformer() {
public String transform(UnicodeCandidate unicodeCandidate) {
switch (fitzpatrickAction) {
default:
case PARSE:
case REMOVE:
return unicodeCandidate.getEmoji().getHtmlHexadecimal();
case IGNORE:
return unicodeCandidate.getEmoji().getHtmlHexadecimal() +
unicodeCandidate.getFitzpatrickUnicode();
}
}
};
return parseFromUnicode(input, emojiTransformer);
} | java | public static String parseToHtmlHexadecimal(
String input,
final FitzpatrickAction fitzpatrickAction
) {
EmojiTransformer emojiTransformer = new EmojiTransformer() {
public String transform(UnicodeCandidate unicodeCandidate) {
switch (fitzpatrickAction) {
default:
case PARSE:
case REMOVE:
return unicodeCandidate.getEmoji().getHtmlHexadecimal();
case IGNORE:
return unicodeCandidate.getEmoji().getHtmlHexadecimal() +
unicodeCandidate.getFitzpatrickUnicode();
}
}
};
return parseFromUnicode(input, emojiTransformer);
} | [
"public",
"static",
"String",
"parseToHtmlHexadecimal",
"(",
"String",
"input",
",",
"final",
"FitzpatrickAction",
"fitzpatrickAction",
")",
"{",
"EmojiTransformer",
"emojiTransformer",
"=",
"new",
"EmojiTransformer",
"(",
")",
"{",
"public",
"String",
"transform",
"(... | Replaces the emoji's unicode occurrences by their html hex
representation.<br>
Example: <code>👦</code> will be replaced by <code>&#x1f466;</code><br>
<br>
When a fitzpatrick modifier is present with a PARSE or REMOVE action, the
modifier will be deleted.<br>
Example: <code>👦🏿</code> will be replaced by
<code>&#x1f466;</code><br>
<br>
When a fitzpatrick modifier is present with a IGNORE action, the modifier
will be ignored and will remain in the string.<br>
Example: <code>👦🏿</code> will be replaced by
<code>&#x1f466;🏿</code>
@param input the string to parse
@param fitzpatrickAction the action to apply for the fitzpatrick modifiers
@return the string with the emojis replaced by their html hex
representation. | [
"Replaces",
"the",
"emoji",
"s",
"unicode",
"occurrences",
"by",
"their",
"html",
"hex",
"representation",
".",
"<br",
">",
"Example",
":",
"<code",
">",
"👦<",
"/",
"code",
">",
"will",
"be",
"replaced",
"by",
"<code",
">",
"&",
";",
"#x1f466",
";",
... | train | https://github.com/vdurmont/emoji-java/blob/8cf5fbe0d7c1020b926791f2b342a263ed07bb0f/src/main/java/com/vdurmont/emoji/EmojiParser.java#L261-L280 |
digitalheir/java-xml-to-json | src/main/java/org/leibnizcenter/xml/TerseJson.java | TerseJson.toXml | public Document toXml(InputStream json) throws IOException, NotImplemented {
JsonReader reader = null;
try {
reader = new JsonReader(new InputStreamReader(json, "utf-8"));
return parse(reader);
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
} finally {
if (reader != null) reader.close();
if (json != null) json.close();
}
} | java | public Document toXml(InputStream json) throws IOException, NotImplemented {
JsonReader reader = null;
try {
reader = new JsonReader(new InputStreamReader(json, "utf-8"));
return parse(reader);
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
} finally {
if (reader != null) reader.close();
if (json != null) json.close();
}
} | [
"public",
"Document",
"toXml",
"(",
"InputStream",
"json",
")",
"throws",
"IOException",
",",
"NotImplemented",
"{",
"JsonReader",
"reader",
"=",
"null",
";",
"try",
"{",
"reader",
"=",
"new",
"JsonReader",
"(",
"new",
"InputStreamReader",
"(",
"json",
",",
... | First element must be a document
@param json JSON stream
@return XML document | [
"First",
"element",
"must",
"be",
"a",
"document"
] | train | https://github.com/digitalheir/java-xml-to-json/blob/94b4cef671bea9b79fb6daa685cd5bf78c222179/src/main/java/org/leibnizcenter/xml/TerseJson.java#L214-L225 |
spotify/styx | styx-scheduler-service/src/main/java/com/spotify/styx/ScheduledExecutionUtil.java | ScheduledExecutionUtil.scheduleWithJitter | public static void scheduleWithJitter(Runnable runnable, ScheduledExecutorService exec, Duration interval) {
final double jitter = ThreadLocalRandom.current().nextDouble(1.0 - JITTER, 1.0 + JITTER);
final long delayMillis = (long) (jitter * interval.toMillis());
exec.schedule(() -> {
runGuarded(runnable);
scheduleWithJitter(runnable, exec, interval);
}, delayMillis, MILLISECONDS);
} | java | public static void scheduleWithJitter(Runnable runnable, ScheduledExecutorService exec, Duration interval) {
final double jitter = ThreadLocalRandom.current().nextDouble(1.0 - JITTER, 1.0 + JITTER);
final long delayMillis = (long) (jitter * interval.toMillis());
exec.schedule(() -> {
runGuarded(runnable);
scheduleWithJitter(runnable, exec, interval);
}, delayMillis, MILLISECONDS);
} | [
"public",
"static",
"void",
"scheduleWithJitter",
"(",
"Runnable",
"runnable",
",",
"ScheduledExecutorService",
"exec",
",",
"Duration",
"interval",
")",
"{",
"final",
"double",
"jitter",
"=",
"ThreadLocalRandom",
".",
"current",
"(",
")",
".",
"nextDouble",
"(",
... | Schedule a runnable to execute at randomized intervals with a mean value of {@param interval}.
The random intervals are values from the uniform distribution interval * [1.0 - JITTER, 1.0 + JITTER].
@param runnable The {@link Runnable} to schedule.
@param exec The {@link ScheduledExecutorService} to schedule the runnable on.
@param interval The mean scheduled execution interval. | [
"Schedule",
"a",
"runnable",
"to",
"execute",
"at",
"randomized",
"intervals",
"with",
"a",
"mean",
"value",
"of",
"{",
"@param",
"interval",
"}",
".",
"The",
"random",
"intervals",
"are",
"values",
"from",
"the",
"uniform",
"distribution",
"interval",
"*",
... | train | https://github.com/spotify/styx/blob/0d63999beeb93a17447e3bbccaa62175b74cf6e4/styx-scheduler-service/src/main/java/com/spotify/styx/ScheduledExecutionUtil.java#L46-L53 |
jenkinsci/jenkins | core/src/main/java/jenkins/security/apitoken/ApiTokenStore.java | ApiTokenStore.renameToken | public synchronized boolean renameToken(@Nonnull String tokenUuid, @Nonnull String newName) {
for (HashedToken token : tokenList) {
if (token.uuid.equals(tokenUuid)) {
token.rename(newName);
return true;
}
}
LOGGER.log(Level.FINER, "The target token for rename does not exist, for uuid = {0}, with desired name = {1}", new Object[]{tokenUuid, newName});
return false;
} | java | public synchronized boolean renameToken(@Nonnull String tokenUuid, @Nonnull String newName) {
for (HashedToken token : tokenList) {
if (token.uuid.equals(tokenUuid)) {
token.rename(newName);
return true;
}
}
LOGGER.log(Level.FINER, "The target token for rename does not exist, for uuid = {0}, with desired name = {1}", new Object[]{tokenUuid, newName});
return false;
} | [
"public",
"synchronized",
"boolean",
"renameToken",
"(",
"@",
"Nonnull",
"String",
"tokenUuid",
",",
"@",
"Nonnull",
"String",
"newName",
")",
"{",
"for",
"(",
"HashedToken",
"token",
":",
"tokenList",
")",
"{",
"if",
"(",
"token",
".",
"uuid",
".",
"equal... | Given a token identifier and a name, the system will try to find a corresponding token and rename it
@return {@code true} iff the token was found and the rename was successful | [
"Given",
"a",
"token",
"identifier",
"and",
"a",
"name",
"the",
"system",
"will",
"try",
"to",
"find",
"a",
"corresponding",
"token",
"and",
"rename",
"it"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/apitoken/ApiTokenStore.java#L289-L299 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java | SyncGroupsInner.cancelSync | public void cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) {
cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body();
} | java | public void cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) {
cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).toBlocking().single().body();
} | [
"public",
"void",
"cancelSync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"syncGroupName",
")",
"{",
"cancelSyncWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseNam... | Cancels a sync group synchronization.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database on which the sync group is hosted.
@param syncGroupName The name of the sync group.
@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 | [
"Cancels",
"a",
"sync",
"group",
"synchronization",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java#L916-L918 |
aalmiray/Json-lib | src/main/jdk15/net/sf/json/JSONArray.java | JSONArray._fromArray | private static JSONArray _fromArray( Enum e, JsonConfig jsonConfig ) {
if( !addInstance( e ) ){
try{
return jsonConfig.getCycleDetectionStrategy()
.handleRepeatedReferenceAsArray( e );
}catch( JSONException jsone ){
removeInstance( e );
fireErrorEvent( jsone, jsonConfig );
throw jsone;
}catch( RuntimeException re ){
removeInstance( e );
JSONException jsone = new JSONException( re );
fireErrorEvent( jsone, jsonConfig );
throw jsone;
}
}
fireArrayStartEvent( jsonConfig );
JSONArray jsonArray = new JSONArray();
if( e != null ){
jsonArray.addValue( e, jsonConfig );
fireElementAddedEvent( 0, jsonArray.get( 0 ), jsonConfig );
}else{
JSONException jsone = new JSONException( "enum value is null" );
removeInstance( e );
fireErrorEvent( jsone, jsonConfig );
throw jsone;
}
removeInstance( e );
fireArrayEndEvent( jsonConfig );
return jsonArray;
} | java | private static JSONArray _fromArray( Enum e, JsonConfig jsonConfig ) {
if( !addInstance( e ) ){
try{
return jsonConfig.getCycleDetectionStrategy()
.handleRepeatedReferenceAsArray( e );
}catch( JSONException jsone ){
removeInstance( e );
fireErrorEvent( jsone, jsonConfig );
throw jsone;
}catch( RuntimeException re ){
removeInstance( e );
JSONException jsone = new JSONException( re );
fireErrorEvent( jsone, jsonConfig );
throw jsone;
}
}
fireArrayStartEvent( jsonConfig );
JSONArray jsonArray = new JSONArray();
if( e != null ){
jsonArray.addValue( e, jsonConfig );
fireElementAddedEvent( 0, jsonArray.get( 0 ), jsonConfig );
}else{
JSONException jsone = new JSONException( "enum value is null" );
removeInstance( e );
fireErrorEvent( jsone, jsonConfig );
throw jsone;
}
removeInstance( e );
fireArrayEndEvent( jsonConfig );
return jsonArray;
} | [
"private",
"static",
"JSONArray",
"_fromArray",
"(",
"Enum",
"e",
",",
"JsonConfig",
"jsonConfig",
")",
"{",
"if",
"(",
"!",
"addInstance",
"(",
"e",
")",
")",
"{",
"try",
"{",
"return",
"jsonConfig",
".",
"getCycleDetectionStrategy",
"(",
")",
".",
"handl... | Construct a JSONArray from an Enum value.
@param e A enum value.
@throws JSONException If there is a syntax error. | [
"Construct",
"a",
"JSONArray",
"from",
"an",
"Enum",
"value",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/jdk15/net/sf/json/JSONArray.java#L816-L847 |
GistLabs/mechanize | src/main/java/com/gistlabs/mechanize/util/apache/URLEncodedUtils.java | URLEncodedUtils.encUserInfo | static String encUserInfo(final String content, final Charset charset) {
return urlencode(content, charset, USERINFO, false);
} | java | static String encUserInfo(final String content, final Charset charset) {
return urlencode(content, charset, USERINFO, false);
} | [
"static",
"String",
"encUserInfo",
"(",
"final",
"String",
"content",
",",
"final",
"Charset",
"charset",
")",
"{",
"return",
"urlencode",
"(",
"content",
",",
"charset",
",",
"USERINFO",
",",
"false",
")",
";",
"}"
] | Encode a String using the {@link #USERINFO} set of characters.
<p>
Used by URIBuilder to encode the userinfo segment.
@param content the string to encode, does not convert space to '+'
@param charset the charset to use
@return the encoded string | [
"Encode",
"a",
"String",
"using",
"the",
"{",
"@link",
"#USERINFO",
"}",
"set",
"of",
"characters",
".",
"<p",
">",
"Used",
"by",
"URIBuilder",
"to",
"encode",
"the",
"userinfo",
"segment",
"."
] | train | https://github.com/GistLabs/mechanize/blob/32ddd0774439a4c08513c05d7ac7416a3899efed/src/main/java/com/gistlabs/mechanize/util/apache/URLEncodedUtils.java#L494-L496 |
overturetool/overture | core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java | SyntaxReader.throwMessage | protected void throwMessage(int number, String message)
throws ParserException, LexException
{
throw new ParserException(number, message, lastToken().location, reader.getTokensRead());
} | java | protected void throwMessage(int number, String message)
throws ParserException, LexException
{
throw new ParserException(number, message, lastToken().location, reader.getTokensRead());
} | [
"protected",
"void",
"throwMessage",
"(",
"int",
"number",
",",
"String",
"message",
")",
"throws",
"ParserException",
",",
"LexException",
"{",
"throw",
"new",
"ParserException",
"(",
"number",
",",
"message",
",",
"lastToken",
"(",
")",
".",
"location",
",",... | Raise a {@link ParserException} at the current location.
@param number
The error number.
@param message
The error message.
@throws ParserException
@throws LexException | [
"Raise",
"a",
"{",
"@link",
"ParserException",
"}",
"at",
"the",
"current",
"location",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java#L489-L493 |
adamfisk/littleshoot-commons-id | src/main/java/org/apache/commons/id/uuid/UUID.java | UUID.nameUUIDFromString | public static UUID nameUUIDFromString(String name, UUID namespace) {
return nameUUIDFromString(name, namespace, UUID.MD5_ENCODING);
} | java | public static UUID nameUUIDFromString(String name, UUID namespace) {
return nameUUIDFromString(name, namespace, UUID.MD5_ENCODING);
} | [
"public",
"static",
"UUID",
"nameUUIDFromString",
"(",
"String",
"name",
",",
"UUID",
"namespace",
")",
"{",
"return",
"nameUUIDFromString",
"(",
"name",
",",
"namespace",
",",
"UUID",
".",
"MD5_ENCODING",
")",
";",
"}"
] | <p>Returns a new version three UUID given a name and the namespace's UUID.</p>
@param name String the name to calculate the UUID for.
@param namespace UUID assigned to this namespace.
@return a new version three UUID given a name and the namespace's UUID. | [
"<p",
">",
"Returns",
"a",
"new",
"version",
"three",
"UUID",
"given",
"a",
"name",
"and",
"the",
"namespace",
"s",
"UUID",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/adamfisk/littleshoot-commons-id/blob/49a8f5f2b10831c509876ca463bf1a87e1e49ae9/src/main/java/org/apache/commons/id/uuid/UUID.java#L471-L473 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getSecretAsync | public ServiceFuture<SecretBundle> getSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, final ServiceCallback<SecretBundle> serviceCallback) {
return ServiceFuture.fromResponse(getSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion), serviceCallback);
} | java | public ServiceFuture<SecretBundle> getSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, final ServiceCallback<SecretBundle> serviceCallback) {
return ServiceFuture.fromResponse(getSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"SecretBundle",
">",
"getSecretAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"secretName",
",",
"String",
"secretVersion",
",",
"final",
"ServiceCallback",
"<",
"SecretBundle",
">",
"serviceCallback",
")",
"{",
"return",
"Serv... | Get a specified secret from a given key vault.
The GET operation is applicable to any secret stored in Azure Key Vault. This operation requires the secrets/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@param secretVersion The version of the secret.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Get",
"a",
"specified",
"secret",
"from",
"a",
"given",
"key",
"vault",
".",
"The",
"GET",
"operation",
"is",
"applicable",
"to",
"any",
"secret",
"stored",
"in",
"Azure",
"Key",
"Vault",
".",
"This",
"operation",
"requires",
"the",
"secrets",
"/",
"get",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3843-L3845 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_sound_soundId_DELETE | public void billingAccount_easyHunting_serviceName_sound_soundId_DELETE(String billingAccount, String serviceName, Long soundId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/sound/{soundId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, soundId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void billingAccount_easyHunting_serviceName_sound_soundId_DELETE(String billingAccount, String serviceName, Long soundId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/sound/{soundId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, soundId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"billingAccount_easyHunting_serviceName_sound_soundId_DELETE",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"soundId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/easyHunting/{service... | Delete the given sound
REST: DELETE /telephony/{billingAccount}/easyHunting/{serviceName}/sound/{soundId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param soundId [required] | [
"Delete",
"the",
"given",
"sound"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2228-L2232 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/growl/GrowlRenderer.java | GrowlRenderer.encodeSeverityMessage | private void encodeSeverityMessage(FacesContext facesContext, Growl uiGrowl, FacesMessage msg)
throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
String summary = msg.getSummary() != null ? msg.getSummary() : "";
String detail = msg.getDetail() != null ? msg.getDetail() : summary;
if(uiGrowl.isEscape()) {
summary = BsfUtils.escapeHtml(summary);
detail = BsfUtils.escapeHtml(detail);
}
summary = summary.replace("'", "\\\'");
detail = detail.replace("'", "\\\'");
// get message type
String messageType = getMessageType(msg);
// get icon for message
String icon = uiGrowl.getIcon() != null ? "fa fa-" + uiGrowl.getIcon() : getSeverityIcon(msg);
String template = null;
if (uiGrowl.getStyle()!= null) {
template = TEMPLATE.replace("{8}", "style='" + uiGrowl.getStyle() + "'");
}
if (uiGrowl.getStyleClass() != null) {
if (null == template) {
template = TEMPLATE;
}
template = template.replace("{9}", uiGrowl.getStyleClass());
}
if (null == template) {
template="";
} else {
template = ", template: \"" + template.replace("{8}", "").replace("{9}", "").replace("\n", "") + "\"";
System.out.println(template);
}
writer.writeText("" +
"$.notify({" +
" title: '" + (uiGrowl.isShowSummary() ? summary : "") + "', " +
" message: '" + (uiGrowl.isShowDetail() ? detail : "") + "', " +
" icon: '" + icon + "'" +
"}, {" +
" position: null, " +
" type: '" + messageType + "', " +
" allow_dismiss: " + uiGrowl.isAllowDismiss() + ", " +
" newest_on_top: " + uiGrowl.isNewestOnTop() + ", " +
" delay: " + uiGrowl.getDelay() + ", " +
" timer: " + uiGrowl.getTimer() + ", " +
" placement: { " +
" from: '" + uiGrowl.getPlacementFrom() + "'," +
" align: '" + uiGrowl.getPlacementAlign() + "'" +
" }, " +
" animate: { " +
" enter: '" + uiGrowl.getAnimationEnter() + "', " +
" exit: '" + uiGrowl.getAnimationExit() + "' " +
" } " +
" " + template +
" }); " +
"", null);
} | java | private void encodeSeverityMessage(FacesContext facesContext, Growl uiGrowl, FacesMessage msg)
throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
String summary = msg.getSummary() != null ? msg.getSummary() : "";
String detail = msg.getDetail() != null ? msg.getDetail() : summary;
if(uiGrowl.isEscape()) {
summary = BsfUtils.escapeHtml(summary);
detail = BsfUtils.escapeHtml(detail);
}
summary = summary.replace("'", "\\\'");
detail = detail.replace("'", "\\\'");
// get message type
String messageType = getMessageType(msg);
// get icon for message
String icon = uiGrowl.getIcon() != null ? "fa fa-" + uiGrowl.getIcon() : getSeverityIcon(msg);
String template = null;
if (uiGrowl.getStyle()!= null) {
template = TEMPLATE.replace("{8}", "style='" + uiGrowl.getStyle() + "'");
}
if (uiGrowl.getStyleClass() != null) {
if (null == template) {
template = TEMPLATE;
}
template = template.replace("{9}", uiGrowl.getStyleClass());
}
if (null == template) {
template="";
} else {
template = ", template: \"" + template.replace("{8}", "").replace("{9}", "").replace("\n", "") + "\"";
System.out.println(template);
}
writer.writeText("" +
"$.notify({" +
" title: '" + (uiGrowl.isShowSummary() ? summary : "") + "', " +
" message: '" + (uiGrowl.isShowDetail() ? detail : "") + "', " +
" icon: '" + icon + "'" +
"}, {" +
" position: null, " +
" type: '" + messageType + "', " +
" allow_dismiss: " + uiGrowl.isAllowDismiss() + ", " +
" newest_on_top: " + uiGrowl.isNewestOnTop() + ", " +
" delay: " + uiGrowl.getDelay() + ", " +
" timer: " + uiGrowl.getTimer() + ", " +
" placement: { " +
" from: '" + uiGrowl.getPlacementFrom() + "'," +
" align: '" + uiGrowl.getPlacementAlign() + "'" +
" }, " +
" animate: { " +
" enter: '" + uiGrowl.getAnimationEnter() + "', " +
" exit: '" + uiGrowl.getAnimationExit() + "' " +
" } " +
" " + template +
" }); " +
"", null);
} | [
"private",
"void",
"encodeSeverityMessage",
"(",
"FacesContext",
"facesContext",
",",
"Growl",
"uiGrowl",
",",
"FacesMessage",
"msg",
")",
"throws",
"IOException",
"{",
"ResponseWriter",
"writer",
"=",
"facesContext",
".",
"getResponseWriter",
"(",
")",
";",
"String... | Encode single faces message as growl
@param facesContext
@param uiGrowl
@param msg
@throws IOException | [
"Encode",
"single",
"faces",
"message",
"as",
"growl"
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/growl/GrowlRenderer.java#L104-L163 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpPacketFactory.java | RtcpPacketFactory.buildReceiverReport | private static RtcpReceiverReport buildReceiverReport(RtpStatistics statistics, boolean padding) {
RtcpReceiverReport report = new RtcpReceiverReport(padding, statistics.getSsrc());
long ssrc = statistics.getSsrc();
// Add receiver reports for each registered member
List<Long> members = statistics.getMembersList();
for (Long memberSsrc : members) {
if (ssrc != memberSsrc) {
RtpMember memberStats = statistics.getMember(memberSsrc.longValue());
RtcpReportBlock rcvrReport = buildSubReceiverReport(memberStats);
report.addReceiverReport(rcvrReport);
}
}
return report;
} | java | private static RtcpReceiverReport buildReceiverReport(RtpStatistics statistics, boolean padding) {
RtcpReceiverReport report = new RtcpReceiverReport(padding, statistics.getSsrc());
long ssrc = statistics.getSsrc();
// Add receiver reports for each registered member
List<Long> members = statistics.getMembersList();
for (Long memberSsrc : members) {
if (ssrc != memberSsrc) {
RtpMember memberStats = statistics.getMember(memberSsrc.longValue());
RtcpReportBlock rcvrReport = buildSubReceiverReport(memberStats);
report.addReceiverReport(rcvrReport);
}
}
return report;
} | [
"private",
"static",
"RtcpReceiverReport",
"buildReceiverReport",
"(",
"RtpStatistics",
"statistics",
",",
"boolean",
"padding",
")",
"{",
"RtcpReceiverReport",
"report",
"=",
"new",
"RtcpReceiverReport",
"(",
"padding",
",",
"statistics",
".",
"getSsrc",
"(",
")",
... | Builds a packet containing an RTCP Receiver Report
@param statistics
The statistics of the RTP session
@return The RTCP packet | [
"Builds",
"a",
"packet",
"containing",
"an",
"RTCP",
"Receiver",
"Report"
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpPacketFactory.java#L118-L132 |
thombergs/docx-stamper | src/main/java/org/wickedsource/docxstamper/util/RunUtil.java | RunUtil.applyParagraphStyle | public static void applyParagraphStyle(P p, R run) {
if (p.getPPr() != null && p.getPPr().getRPr() != null) {
RPr runProperties = new RPr();
StyleUtil.apply(p.getPPr().getRPr(), runProperties);
run.setRPr(runProperties);
}
} | java | public static void applyParagraphStyle(P p, R run) {
if (p.getPPr() != null && p.getPPr().getRPr() != null) {
RPr runProperties = new RPr();
StyleUtil.apply(p.getPPr().getRPr(), runProperties);
run.setRPr(runProperties);
}
} | [
"public",
"static",
"void",
"applyParagraphStyle",
"(",
"P",
"p",
",",
"R",
"run",
")",
"{",
"if",
"(",
"p",
".",
"getPPr",
"(",
")",
"!=",
"null",
"&&",
"p",
".",
"getPPr",
"(",
")",
".",
"getRPr",
"(",
")",
"!=",
"null",
")",
"{",
"RPr",
"run... | Applies the style of the given paragraph to the given content object (if the content object is a Run).
@param p the paragraph whose style to use.
@param run the Run to which the style should be applied. | [
"Applies",
"the",
"style",
"of",
"the",
"given",
"paragraph",
"to",
"the",
"given",
"content",
"object",
"(",
"if",
"the",
"content",
"object",
"is",
"a",
"Run",
")",
"."
] | train | https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/util/RunUtil.java#L53-L59 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/LocationUrl.java | LocationUrl.getInStorePickupLocationUrl | public static MozuUrl getInStorePickupLocationUrl(Boolean includeAttributeDefinition, String locationCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/storefront/locationUsageTypes/SP/locations/{locationCode}?includeAttributeDefinition={includeAttributeDefinition}&responseFields={responseFields}");
formatter.formatUrl("includeAttributeDefinition", includeAttributeDefinition);
formatter.formatUrl("locationCode", locationCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getInStorePickupLocationUrl(Boolean includeAttributeDefinition, String locationCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/storefront/locationUsageTypes/SP/locations/{locationCode}?includeAttributeDefinition={includeAttributeDefinition}&responseFields={responseFields}");
formatter.formatUrl("includeAttributeDefinition", includeAttributeDefinition);
formatter.formatUrl("locationCode", locationCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getInStorePickupLocationUrl",
"(",
"Boolean",
"includeAttributeDefinition",
",",
"String",
"locationCode",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/storefront/lo... | Get Resource Url for GetInStorePickupLocation
@param includeAttributeDefinition True if you want to include the custom attribute definition for the location.
@param locationCode The unique, user-defined code that identifies a location.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetInStorePickupLocation"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/LocationUrl.java#L77-L84 |
att/AAF | cadi/core/src/main/java/com/att/cadi/util/Vars.java | Vars.convert | public static String convert(final String text, final List<String> vars) {
String[] array = new String[vars.size()];
StringBuilder sb = new StringBuilder();
convert(sb,text,vars.toArray(array));
return sb.toString();
} | java | public static String convert(final String text, final List<String> vars) {
String[] array = new String[vars.size()];
StringBuilder sb = new StringBuilder();
convert(sb,text,vars.toArray(array));
return sb.toString();
} | [
"public",
"static",
"String",
"convert",
"(",
"final",
"String",
"text",
",",
"final",
"List",
"<",
"String",
">",
"vars",
")",
"{",
"String",
"[",
"]",
"array",
"=",
"new",
"String",
"[",
"vars",
".",
"size",
"(",
")",
"]",
";",
"StringBuilder",
"sb... | Simplified Conversion based on typical use of getting AT&T style RESTful Error Messages
@param text
@param vars
@return | [
"Simplified",
"Conversion",
"based",
"on",
"typical",
"use",
"of",
"getting",
"AT&T",
"style",
"RESTful",
"Error",
"Messages"
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/util/Vars.java#L15-L20 |
VoltDB/voltdb | src/frontend/org/voltdb/exportclient/ElasticSearchHttpExportClient.java | ElasticSearchHttpExportClient.makeRequest | private HttpUriRequest makeRequest(URI uri, final String requestBody)
{
HttpPost post = new HttpPost(uri);
post.setEntity(new StringEntity(requestBody, m_contentType));
return post;
} | java | private HttpUriRequest makeRequest(URI uri, final String requestBody)
{
HttpPost post = new HttpPost(uri);
post.setEntity(new StringEntity(requestBody, m_contentType));
return post;
} | [
"private",
"HttpUriRequest",
"makeRequest",
"(",
"URI",
"uri",
",",
"final",
"String",
"requestBody",
")",
"{",
"HttpPost",
"post",
"=",
"new",
"HttpPost",
"(",
"uri",
")",
";",
"post",
".",
"setEntity",
"(",
"new",
"StringEntity",
"(",
"requestBody",
",",
... | Generate the HTTP request.
@param uri The request URI
@param requestBody The request body, URL encoded if necessary
@return The HTTP request. | [
"Generate",
"the",
"HTTP",
"request",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exportclient/ElasticSearchHttpExportClient.java#L271-L276 |
threerings/nenya | core/src/main/java/com/threerings/media/TimerView.java | TimerView.setWarning | public void setWarning (float warnPercent, ResultListener<TimerView> warner)
{
// This warning hasn't triggered yet
_warned = false;
// Here are the details
_warnPercent = warnPercent;
_warner = warner;
} | java | public void setWarning (float warnPercent, ResultListener<TimerView> warner)
{
// This warning hasn't triggered yet
_warned = false;
// Here are the details
_warnPercent = warnPercent;
_warner = warner;
} | [
"public",
"void",
"setWarning",
"(",
"float",
"warnPercent",
",",
"ResultListener",
"<",
"TimerView",
">",
"warner",
")",
"{",
"// This warning hasn't triggered yet",
"_warned",
"=",
"false",
";",
"// Here are the details",
"_warnPercent",
"=",
"warnPercent",
";",
"_w... | Setup a warning to trigger after the timer is "warnPercent"
or more completed. If "warner" is non-null, it will be
called at that time. | [
"Setup",
"a",
"warning",
"to",
"trigger",
"after",
"the",
"timer",
"is",
"warnPercent",
"or",
"more",
"completed",
".",
"If",
"warner",
"is",
"non",
"-",
"null",
"it",
"will",
"be",
"called",
"at",
"that",
"time",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/TimerView.java#L93-L101 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java | BaseMessagingEngineImpl.deleteLocalizationPoint | final void deleteLocalizationPoint(JsBus bus, LWMConfig dest) {
String thisMethodName = "deleteLocalizationPoint";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, dest);
}
try {
_localizer.deleteLocalizationPoint(bus, dest);
} catch (SIBExceptionBase ex) {
SibTr.exception(tc, ex);
} catch (SIException e) {
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | java | final void deleteLocalizationPoint(JsBus bus, LWMConfig dest) {
String thisMethodName = "deleteLocalizationPoint";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, dest);
}
try {
_localizer.deleteLocalizationPoint(bus, dest);
} catch (SIBExceptionBase ex) {
SibTr.exception(tc, ex);
} catch (SIException e) {
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} | [
"final",
"void",
"deleteLocalizationPoint",
"(",
"JsBus",
"bus",
",",
"LWMConfig",
"dest",
")",
"{",
"String",
"thisMethodName",
"=",
"\"deleteLocalizationPoint\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEn... | Pass the request to delete a localization point onto the localizer object.
@param lp localization point definition | [
"Pass",
"the",
"request",
"to",
"delete",
"a",
"localization",
"point",
"onto",
"the",
"localizer",
"object",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1519-L1540 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/requests/restaction/pagination/PaginationAction.java | PaginationAction.takeRemainingAsync | public RequestFuture<List<T>> takeRemainingAsync(int amount)
{
return takeAsync0(amount, (task, list) -> forEachRemainingAsync(val -> {
list.add(val);
return list.size() < amount;
}, task::completeExceptionally));
} | java | public RequestFuture<List<T>> takeRemainingAsync(int amount)
{
return takeAsync0(amount, (task, list) -> forEachRemainingAsync(val -> {
list.add(val);
return list.size() < amount;
}, task::completeExceptionally));
} | [
"public",
"RequestFuture",
"<",
"List",
"<",
"T",
">",
">",
"takeRemainingAsync",
"(",
"int",
"amount",
")",
"{",
"return",
"takeAsync0",
"(",
"amount",
",",
"(",
"task",
",",
"list",
")",
"->",
"forEachRemainingAsync",
"(",
"val",
"->",
"{",
"list",
"."... | Convenience method to retrieve an amount of entities from this pagination action.
<br>Unlike {@link #takeAsync(int)} this does not include already cached entities.
@param amount
The maximum amount to retrieve
@return {@link net.dv8tion.jda.core.requests.RequestFuture RequestFuture} - Type: {@link java.util.List List}
@see #forEachRemainingAsync(Procedure) | [
"Convenience",
"method",
"to",
"retrieve",
"an",
"amount",
"of",
"entities",
"from",
"this",
"pagination",
"action",
".",
"<br",
">",
"Unlike",
"{",
"@link",
"#takeAsync",
"(",
"int",
")",
"}",
"this",
"does",
"not",
"include",
"already",
"cached",
"entities... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/pagination/PaginationAction.java#L348-L354 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesInner.java | DatabaseTableAuditingPoliciesInner.createOrUpdateAsync | public Observable<DatabaseTableAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseTableAuditingPolicyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseTableAuditingPolicyInner>, DatabaseTableAuditingPolicyInner>() {
@Override
public DatabaseTableAuditingPolicyInner call(ServiceResponse<DatabaseTableAuditingPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseTableAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseTableAuditingPolicyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseTableAuditingPolicyInner>, DatabaseTableAuditingPolicyInner>() {
@Override
public DatabaseTableAuditingPolicyInner call(ServiceResponse<DatabaseTableAuditingPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseTableAuditingPolicyInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"DatabaseTableAuditingPolicyInner",
"parameters",
")",
"{",
"return",
"createOrU... | Creates or updates a database's table auditing policy. Table auditing is deprecated, use blob auditing instead.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database for which the table auditing policy will be defined.
@param parameters The database table auditing policy.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseTableAuditingPolicyInner object | [
"Creates",
"or",
"updates",
"a",
"database",
"s",
"table",
"auditing",
"policy",
".",
"Table",
"auditing",
"is",
"deprecated",
"use",
"blob",
"auditing",
"instead",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesInner.java#L206-L213 |
datacleaner/DataCleaner | desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java | ComboButton.addButton | public AbstractButton addButton(final String text, final String iconImagePath, final boolean toggleButton) {
final ImageIcon icon = ImageManager.get().getImageIcon(iconImagePath, IconUtils.ICON_SIZE_MEDIUM);
return addButton(text, icon, toggleButton);
} | java | public AbstractButton addButton(final String text, final String iconImagePath, final boolean toggleButton) {
final ImageIcon icon = ImageManager.get().getImageIcon(iconImagePath, IconUtils.ICON_SIZE_MEDIUM);
return addButton(text, icon, toggleButton);
} | [
"public",
"AbstractButton",
"addButton",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"iconImagePath",
",",
"final",
"boolean",
"toggleButton",
")",
"{",
"final",
"ImageIcon",
"icon",
"=",
"ImageManager",
".",
"get",
"(",
")",
".",
"getImageIcon",
"... | Adds a button to this {@link ComboButton}
@param text
the text of the button
@param iconImagePath
the icon path of the button
@param toggleButton
whether or not this button should be a toggle button (true) or
a regular button (false)
@return | [
"Adds",
"a",
"button",
"to",
"this",
"{",
"@link",
"ComboButton",
"}"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java#L176-L179 |
lucee/Lucee | core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java | LDAPClient.setCredential | public void setCredential(String username, String password) {
if (username != null) {
env.put("java.naming.security.principal", username);
env.put("java.naming.security.credentials", password);
}
else {
env.remove("java.naming.security.principal");
env.remove("java.naming.security.credentials");
}
} | java | public void setCredential(String username, String password) {
if (username != null) {
env.put("java.naming.security.principal", username);
env.put("java.naming.security.credentials", password);
}
else {
env.remove("java.naming.security.principal");
env.remove("java.naming.security.credentials");
}
} | [
"public",
"void",
"setCredential",
"(",
"String",
"username",
",",
"String",
"password",
")",
"{",
"if",
"(",
"username",
"!=",
"null",
")",
"{",
"env",
".",
"put",
"(",
"\"java.naming.security.principal\"",
",",
"username",
")",
";",
"env",
".",
"put",
"(... | sets username password for the connection
@param username
@param password | [
"sets",
"username",
"password",
"for",
"the",
"connection"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ldap/LDAPClient.java#L114-L123 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java | PublicanPODocBookBuilder.addPOTEntry | protected void addPOTEntry(final String tag, final String source, final StringBuilder potFile) {
addPOEntry(tag, source, "", false, potFile);
} | java | protected void addPOTEntry(final String tag, final String source, final StringBuilder potFile) {
addPOEntry(tag, source, "", false, potFile);
} | [
"protected",
"void",
"addPOTEntry",
"(",
"final",
"String",
"tag",
",",
"final",
"String",
"source",
",",
"final",
"StringBuilder",
"potFile",
")",
"{",
"addPOEntry",
"(",
"tag",
",",
"source",
",",
"\"\"",
",",
"false",
",",
"potFile",
")",
";",
"}"
] | Add an entry to a POT file.
@param tag The XML element name.
@param source The original source string.
@param potFile The POT file to add to. | [
"Add",
"an",
"entry",
"to",
"a",
"POT",
"file",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1452-L1454 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/AbstractFacesInitializer.java | AbstractFacesInitializer._dispatchApplicationEvent | private void _dispatchApplicationEvent(ServletContext servletContext, Class<? extends SystemEvent> eventClass)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
Application application = facesContext.getApplication();
application.publishEvent(facesContext, eventClass, Application.class, application);
} | java | private void _dispatchApplicationEvent(ServletContext servletContext, Class<? extends SystemEvent> eventClass)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
Application application = facesContext.getApplication();
application.publishEvent(facesContext, eventClass, Application.class, application);
} | [
"private",
"void",
"_dispatchApplicationEvent",
"(",
"ServletContext",
"servletContext",
",",
"Class",
"<",
"?",
"extends",
"SystemEvent",
">",
"eventClass",
")",
"{",
"FacesContext",
"facesContext",
"=",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
";",
"Ap... | Eventually we can use our plugin infrastructure for this as well
it would be a cleaner interception point than the base class
but for now this position is valid as well
<p/>
Note we add it for now here because the application factory object
leaves no possibility to have a destroy interceptor
and applications are per web application singletons
Note if this does not work out
move the event handler into the application factory
@param servletContext the servlet context to be passed down
@param eventClass the class to be passed down into the dispatching
code | [
"Eventually",
"we",
"can",
"use",
"our",
"plugin",
"infrastructure",
"for",
"this",
"as",
"well",
"it",
"would",
"be",
"a",
"cleaner",
"interception",
"point",
"than",
"the",
"base",
"class",
"but",
"for",
"now",
"this",
"position",
"is",
"valid",
"as",
"w... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/webapp/AbstractFacesInitializer.java#L340-L345 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.addTag | public GitlabTag addTag(Serializable projectId, String tagName, String ref, String message, String releaseDescription) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabTag.URL;
return dispatch()
.with("tag_name", tagName)
.with("ref", ref)
.with("message", message)
.with("release_description", releaseDescription)
.to(tailUrl, GitlabTag.class);
} | java | public GitlabTag addTag(Serializable projectId, String tagName, String ref, String message, String releaseDescription) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + GitlabTag.URL;
return dispatch()
.with("tag_name", tagName)
.with("ref", ref)
.with("message", message)
.with("release_description", releaseDescription)
.to(tailUrl, GitlabTag.class);
} | [
"public",
"GitlabTag",
"addTag",
"(",
"Serializable",
"projectId",
",",
"String",
"tagName",
",",
"String",
"ref",
",",
"String",
"message",
",",
"String",
"releaseDescription",
")",
"throws",
"IOException",
"{",
"String",
"tailUrl",
"=",
"GitlabProject",
".",
"... | Create tag in specific project
@param projectId
@param tagName
@param ref
@param message
@param releaseDescription
@return
@throws IOException on gitlab api call error | [
"Create",
"tag",
"in",
"specific",
"project"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3389-L3397 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java | StructureTools.getAtomsInContact | public static AtomContactSet getAtomsInContact(Chain chain, double cutoff) {
return getAtomsInContact(chain, (String[]) null, cutoff);
} | java | public static AtomContactSet getAtomsInContact(Chain chain, double cutoff) {
return getAtomsInContact(chain, (String[]) null, cutoff);
} | [
"public",
"static",
"AtomContactSet",
"getAtomsInContact",
"(",
"Chain",
"chain",
",",
"double",
"cutoff",
")",
"{",
"return",
"getAtomsInContact",
"(",
"chain",
",",
"(",
"String",
"[",
"]",
")",
"null",
",",
"cutoff",
")",
";",
"}"
] | Returns the set of intra-chain contacts for the given chain for all non-H
atoms of non-hetatoms, i.e. the contact map. Uses a geometric hashing
algorithm that speeds up the calculation without need of full distance
matrix. The parsing mode
{@link FileParsingParameters#setAlignSeqRes(boolean)} needs to be set to
true for this to work.
@param chain
@param cutoff
@return | [
"Returns",
"the",
"set",
"of",
"intra",
"-",
"chain",
"contacts",
"for",
"the",
"given",
"chain",
"for",
"all",
"non",
"-",
"H",
"atoms",
"of",
"non",
"-",
"hetatoms",
"i",
".",
"e",
".",
"the",
"contact",
"map",
".",
"Uses",
"a",
"geometric",
"hashi... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java#L1435-L1437 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_util.java | Scs_util.cs_dalloc | public static Scsd cs_dalloc(int m, int n) {
Scsd S;
S = new Scsd();
S.p = new int[m];
S.r = new int[m + 6];
S.q = new int[n];
S.s = new int[n + 6];
S.cc = new int[5];
S.rr = new int[5];
return S;
} | java | public static Scsd cs_dalloc(int m, int n) {
Scsd S;
S = new Scsd();
S.p = new int[m];
S.r = new int[m + 6];
S.q = new int[n];
S.s = new int[n + 6];
S.cc = new int[5];
S.rr = new int[5];
return S;
} | [
"public",
"static",
"Scsd",
"cs_dalloc",
"(",
"int",
"m",
",",
"int",
"n",
")",
"{",
"Scsd",
"S",
";",
"S",
"=",
"new",
"Scsd",
"(",
")",
";",
"S",
".",
"p",
"=",
"new",
"int",
"[",
"m",
"]",
";",
"S",
".",
"r",
"=",
"new",
"int",
"[",
"m... | Allocate a Scsd object (a Sulmage-Mendelsohn decomposition).
@param m
number of rows of the matrix A to be analyzed
@param n
number of columns of the matrix A to be analyzed
@return Sulmage-Mendelsohn decomposition | [
"Allocate",
"a",
"Scsd",
"object",
"(",
"a",
"Sulmage",
"-",
"Mendelsohn",
"decomposition",
")",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_util.java#L108-L118 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/CommonUtils.java | CommonUtils.getUnixGroups | public static List<String> getUnixGroups(String user) throws IOException {
String result;
List<String> groups = new ArrayList<>();
try {
result = ShellUtils.execCommand(ShellUtils.getGroupsForUserCommand(user));
} catch (ExitCodeException e) {
// if we didn't get the group - just return empty list
LOG.warn("got exception trying to get groups for user " + user + ": " + e.getMessage());
return groups;
}
StringTokenizer tokenizer = new StringTokenizer(result, ShellUtils.TOKEN_SEPARATOR_REGEX);
while (tokenizer.hasMoreTokens()) {
groups.add(tokenizer.nextToken());
}
return groups;
} | java | public static List<String> getUnixGroups(String user) throws IOException {
String result;
List<String> groups = new ArrayList<>();
try {
result = ShellUtils.execCommand(ShellUtils.getGroupsForUserCommand(user));
} catch (ExitCodeException e) {
// if we didn't get the group - just return empty list
LOG.warn("got exception trying to get groups for user " + user + ": " + e.getMessage());
return groups;
}
StringTokenizer tokenizer = new StringTokenizer(result, ShellUtils.TOKEN_SEPARATOR_REGEX);
while (tokenizer.hasMoreTokens()) {
groups.add(tokenizer.nextToken());
}
return groups;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getUnixGroups",
"(",
"String",
"user",
")",
"throws",
"IOException",
"{",
"String",
"result",
";",
"List",
"<",
"String",
">",
"groups",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"result",
... | Gets the current user's group list from Unix by running the command 'groups' NOTE. For
non-existing user it will return EMPTY list. This method may return duplicate groups.
@param user user name
@return the groups list that the {@code user} belongs to. The primary group is returned first | [
"Gets",
"the",
"current",
"user",
"s",
"group",
"list",
"from",
"Unix",
"by",
"running",
"the",
"command",
"groups",
"NOTE",
".",
"For",
"non",
"-",
"existing",
"user",
"it",
"will",
"return",
"EMPTY",
"list",
".",
"This",
"method",
"may",
"return",
"dup... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/CommonUtils.java#L246-L262 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java | WebhooksInner.beginUpdateAsync | public Observable<WebhookInner> beginUpdateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() {
@Override
public WebhookInner call(ServiceResponse<WebhookInner> response) {
return response.body();
}
});
} | java | public Observable<WebhookInner> beginUpdateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() {
@Override
public WebhookInner call(ServiceResponse<WebhookInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WebhookInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"webhookName",
",",
"WebhookUpdateParameters",
"webhookUpdateParameters",
")",
"{",
"return",
"beginUpdateWithServiceRespo... | Updates a webhook with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param webhookName The name of the webhook.
@param webhookUpdateParameters The parameters for updating a webhook.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WebhookInner object | [
"Updates",
"a",
"webhook",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L683-L690 |
apereo/cas | core/cas-server-core-logout-api/src/main/java/org/apereo/cas/logout/slo/BaseSingleLogoutServiceMessageHandler.java | BaseSingleLogoutServiceMessageHandler.getLogoutHttpMessageToSend | protected LogoutHttpMessage getLogoutHttpMessageToSend(final SingleLogoutRequest request, final SingleLogoutMessage logoutMessage) {
return new LogoutHttpMessage(request.getLogoutUrl(), logoutMessage.getPayload(), this.asynchronous);
} | java | protected LogoutHttpMessage getLogoutHttpMessageToSend(final SingleLogoutRequest request, final SingleLogoutMessage logoutMessage) {
return new LogoutHttpMessage(request.getLogoutUrl(), logoutMessage.getPayload(), this.asynchronous);
} | [
"protected",
"LogoutHttpMessage",
"getLogoutHttpMessageToSend",
"(",
"final",
"SingleLogoutRequest",
"request",
",",
"final",
"SingleLogoutMessage",
"logoutMessage",
")",
"{",
"return",
"new",
"LogoutHttpMessage",
"(",
"request",
".",
"getLogoutUrl",
"(",
")",
",",
"log... | Gets logout http message to send.
@param request the request
@param logoutMessage the logout message
@return the logout http message to send | [
"Gets",
"logout",
"http",
"message",
"to",
"send",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-logout-api/src/main/java/org/apereo/cas/logout/slo/BaseSingleLogoutServiceMessageHandler.java#L204-L206 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.asyncGetBulk | @Override
public BulkFuture<Map<String, Object>> asyncGetBulk(
Iterator<String> keyIter) {
return asyncGetBulk(keyIter, transcoder);
} | java | @Override
public BulkFuture<Map<String, Object>> asyncGetBulk(
Iterator<String> keyIter) {
return asyncGetBulk(keyIter, transcoder);
} | [
"@",
"Override",
"public",
"BulkFuture",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"asyncGetBulk",
"(",
"Iterator",
"<",
"String",
">",
"keyIter",
")",
"{",
"return",
"asyncGetBulk",
"(",
"keyIter",
",",
"transcoder",
")",
";",
"}"
] | Asynchronously get a bunch of objects from the cache and decode them with
the given transcoder.
@param keyIter Iterator that produces the keys to request
@return a Future result of that fetch
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests | [
"Asynchronously",
"get",
"a",
"bunch",
"of",
"objects",
"from",
"the",
"cache",
"and",
"decode",
"them",
"with",
"the",
"given",
"transcoder",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1429-L1433 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/ShanksSimulation3DGUI.java | ShanksSimulation3DGUI.addDisplay | public void addDisplay(String displayID, Display3D display)
throws ShanksException {
Scenario3DPortrayal scenarioPortrayal = (Scenario3DPortrayal) this
.getSimulation().getScenarioPortrayal();
HashMap<String, Display3D> displays = scenarioPortrayal.getDisplays();
if (!displays.containsKey(displayID)) {
displays.put(displayID, display);
} else {
throw new DuplictaedDisplayIDException(displayID);
}
} | java | public void addDisplay(String displayID, Display3D display)
throws ShanksException {
Scenario3DPortrayal scenarioPortrayal = (Scenario3DPortrayal) this
.getSimulation().getScenarioPortrayal();
HashMap<String, Display3D> displays = scenarioPortrayal.getDisplays();
if (!displays.containsKey(displayID)) {
displays.put(displayID, display);
} else {
throw new DuplictaedDisplayIDException(displayID);
}
} | [
"public",
"void",
"addDisplay",
"(",
"String",
"displayID",
",",
"Display3D",
"display",
")",
"throws",
"ShanksException",
"{",
"Scenario3DPortrayal",
"scenarioPortrayal",
"=",
"(",
"Scenario3DPortrayal",
")",
"this",
".",
"getSimulation",
"(",
")",
".",
"getScenari... | Add a display to the simulation
@param displayID
@param display
@throws DuplictaedDisplayIDException
@throws DuplicatedPortrayalIDException
@throws ScenarioNotFoundException | [
"Add",
"a",
"display",
"to",
"the",
"simulation"
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/ShanksSimulation3DGUI.java#L308-L318 |
revapi/revapi | revapi/src/main/java/org/revapi/AnalysisResult.java | AnalysisResult.fakeSuccess | public static AnalysisResult fakeSuccess() {
return new AnalysisResult(null, new Extensions(Collections.emptyMap(), Collections.emptyMap(),
Collections.emptyMap(), Collections.emptyMap()));
} | java | public static AnalysisResult fakeSuccess() {
return new AnalysisResult(null, new Extensions(Collections.emptyMap(), Collections.emptyMap(),
Collections.emptyMap(), Collections.emptyMap()));
} | [
"public",
"static",
"AnalysisResult",
"fakeSuccess",
"(",
")",
"{",
"return",
"new",
"AnalysisResult",
"(",
"null",
",",
"new",
"Extensions",
"(",
"Collections",
".",
"emptyMap",
"(",
")",
",",
"Collections",
".",
"emptyMap",
"(",
")",
",",
"Collections",
".... | A factory method for users that need to report success without actually running any analysis. The returned
result will be successful, but will not contain the actual configurations of extensions.
@return a "fake" successful analysis result | [
"A",
"factory",
"method",
"for",
"users",
"that",
"need",
"to",
"report",
"success",
"without",
"actually",
"running",
"any",
"analysis",
".",
"The",
"returned",
"result",
"will",
"be",
"successful",
"but",
"will",
"not",
"contain",
"the",
"actual",
"configura... | train | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/AnalysisResult.java#L58-L61 |
alkacon/opencms-core | src/org/opencms/cmis/A_CmsCmisRepository.java | A_CmsCmisRepository.getOpenCmsProperties | protected List<CmsProperty> getOpenCmsProperties(Map<String, PropertyData<?>> properties) {
List<CmsProperty> cmsProperties = new ArrayList<CmsProperty>();
for (Map.Entry<String, PropertyData<?>> entry : properties.entrySet()) {
String propId = entry.getKey();
if (propId.startsWith(CmsCmisTypeManager.PROPERTY_PREFIX)) {
String propName = propId.substring(CmsCmisTypeManager.PROPERTY_PREFIX.length());
String value = (String)entry.getValue().getFirstValue();
if (value == null) {
value = "";
}
cmsProperties.add(new CmsProperty(propName, value, null));
}
}
return cmsProperties;
} | java | protected List<CmsProperty> getOpenCmsProperties(Map<String, PropertyData<?>> properties) {
List<CmsProperty> cmsProperties = new ArrayList<CmsProperty>();
for (Map.Entry<String, PropertyData<?>> entry : properties.entrySet()) {
String propId = entry.getKey();
if (propId.startsWith(CmsCmisTypeManager.PROPERTY_PREFIX)) {
String propName = propId.substring(CmsCmisTypeManager.PROPERTY_PREFIX.length());
String value = (String)entry.getValue().getFirstValue();
if (value == null) {
value = "";
}
cmsProperties.add(new CmsProperty(propName, value, null));
}
}
return cmsProperties;
} | [
"protected",
"List",
"<",
"CmsProperty",
">",
"getOpenCmsProperties",
"(",
"Map",
"<",
"String",
",",
"PropertyData",
"<",
"?",
">",
">",
"properties",
")",
"{",
"List",
"<",
"CmsProperty",
">",
"cmsProperties",
"=",
"new",
"ArrayList",
"<",
"CmsProperty",
"... | Helper method to create OpenCms property objects from a map of CMIS properties.<p>
@param properties the CMIS properties
@return the OpenCms properties | [
"Helper",
"method",
"to",
"create",
"OpenCms",
"property",
"objects",
"from",
"a",
"map",
"of",
"CMIS",
"properties",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/A_CmsCmisRepository.java#L337-L352 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateGeneral | public static <T extends CharSequence> T validateGeneral(T value, int min, String errorMsg) throws ValidateException {
return validateGeneral(value, min, 0, errorMsg);
} | java | public static <T extends CharSequence> T validateGeneral(T value, int min, String errorMsg) throws ValidateException {
return validateGeneral(value, min, 0, errorMsg);
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateGeneral",
"(",
"T",
"value",
",",
"int",
"min",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"return",
"validateGeneral",
"(",
"value",
",",
"min",
",",
"0",
... | 验证是否为给定最小长度的英文字母 、数字和下划线
@param <T> 字符串类型
@param value 值
@param min 最小长度,负数自动识别为0
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为给定最小长度的英文字母",
"、数字和下划线"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L423-L425 |
phax/ph-commons | ph-dao/src/main/java/com/helger/dao/wal/WALListener.java | WALListener.registerForLaterWriting | public void registerForLaterWriting (@Nonnull final AbstractWALDAO <?> aDAO,
@Nonnull final String sWALFilename,
@Nonnull final TimeValue aWaitingWime)
{
// In case many DAOs of the same class exist, the filename is also added
final String sKey = aDAO.getClass ().getName () + "::" + sWALFilename;
// Check if the passed DAO is already scheduled for writing
final boolean bDoScheduleForWriting = m_aRWLock.writeLocked ( () -> m_aWaitingDAOs.add (sKey));
if (bDoScheduleForWriting)
{
// We need to schedule it now
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Now scheduling writing for DAO " + sKey);
// What should be executed upon writing
final Runnable r = () -> {
// Use DAO lock!
aDAO.internalWriteLocked ( () -> {
// Main DAO writing
aDAO._writeToFileAndResetPendingChanges ("ScheduledWriter.run");
// Delete the WAL file
aDAO._deleteWALFileAfterProcessing (sWALFilename);
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Finished scheduled writing for DAO " + sKey);
});
// Remove from the internal set so that another job will be
// scheduled for the same DAO
// Do this after the writing to the file
m_aRWLock.writeLocked ( () -> {
// Remove from the overall set as well as from the scheduled items
m_aWaitingDAOs.remove (sKey);
m_aScheduledItems.remove (sKey);
});
};
// Schedule exactly once in the specified waiting time
final ScheduledFuture <?> aFuture = m_aES.schedule (r, aWaitingWime.getDuration (), aWaitingWime.getTimeUnit ());
// Remember the scheduled item and the runnable so that the task can
// be rescheduled upon shutdown.
m_aRWLock.writeLocked ( () -> m_aScheduledItems.put (sKey, new WALItem (aFuture, r)));
}
// else the writing of the passed DAO is already scheduled and no further
// action is necessary
} | java | public void registerForLaterWriting (@Nonnull final AbstractWALDAO <?> aDAO,
@Nonnull final String sWALFilename,
@Nonnull final TimeValue aWaitingWime)
{
// In case many DAOs of the same class exist, the filename is also added
final String sKey = aDAO.getClass ().getName () + "::" + sWALFilename;
// Check if the passed DAO is already scheduled for writing
final boolean bDoScheduleForWriting = m_aRWLock.writeLocked ( () -> m_aWaitingDAOs.add (sKey));
if (bDoScheduleForWriting)
{
// We need to schedule it now
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Now scheduling writing for DAO " + sKey);
// What should be executed upon writing
final Runnable r = () -> {
// Use DAO lock!
aDAO.internalWriteLocked ( () -> {
// Main DAO writing
aDAO._writeToFileAndResetPendingChanges ("ScheduledWriter.run");
// Delete the WAL file
aDAO._deleteWALFileAfterProcessing (sWALFilename);
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Finished scheduled writing for DAO " + sKey);
});
// Remove from the internal set so that another job will be
// scheduled for the same DAO
// Do this after the writing to the file
m_aRWLock.writeLocked ( () -> {
// Remove from the overall set as well as from the scheduled items
m_aWaitingDAOs.remove (sKey);
m_aScheduledItems.remove (sKey);
});
};
// Schedule exactly once in the specified waiting time
final ScheduledFuture <?> aFuture = m_aES.schedule (r, aWaitingWime.getDuration (), aWaitingWime.getTimeUnit ());
// Remember the scheduled item and the runnable so that the task can
// be rescheduled upon shutdown.
m_aRWLock.writeLocked ( () -> m_aScheduledItems.put (sKey, new WALItem (aFuture, r)));
}
// else the writing of the passed DAO is already scheduled and no further
// action is necessary
} | [
"public",
"void",
"registerForLaterWriting",
"(",
"@",
"Nonnull",
"final",
"AbstractWALDAO",
"<",
"?",
">",
"aDAO",
",",
"@",
"Nonnull",
"final",
"String",
"sWALFilename",
",",
"@",
"Nonnull",
"final",
"TimeValue",
"aWaitingWime",
")",
"{",
"// In case many DAOs o... | This is the main method for registration of later writing.
@param aDAO
The DAO to be written
@param sWALFilename
The filename of the WAL file for later deletion (in case the
filename changes over time).
@param aWaitingWime
The time to wait, until the file is physically written. May not be
<code>null</code>. | [
"This",
"is",
"the",
"main",
"method",
"for",
"registration",
"of",
"later",
"writing",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/WALListener.java#L128-L176 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java | MandatoryWarningHandler.reportDeferredDiagnostic | public void reportDeferredDiagnostic() {
if (deferredDiagnosticKind != null) {
if (deferredDiagnosticArg == null)
logMandatoryNote(deferredDiagnosticSource, deferredDiagnosticKind.getKey(prefix));
else
logMandatoryNote(deferredDiagnosticSource, deferredDiagnosticKind.getKey(prefix), deferredDiagnosticArg);
if (!verbose)
logMandatoryNote(deferredDiagnosticSource, prefix + ".recompile");
}
} | java | public void reportDeferredDiagnostic() {
if (deferredDiagnosticKind != null) {
if (deferredDiagnosticArg == null)
logMandatoryNote(deferredDiagnosticSource, deferredDiagnosticKind.getKey(prefix));
else
logMandatoryNote(deferredDiagnosticSource, deferredDiagnosticKind.getKey(prefix), deferredDiagnosticArg);
if (!verbose)
logMandatoryNote(deferredDiagnosticSource, prefix + ".recompile");
}
} | [
"public",
"void",
"reportDeferredDiagnostic",
"(",
")",
"{",
"if",
"(",
"deferredDiagnosticKind",
"!=",
"null",
")",
"{",
"if",
"(",
"deferredDiagnosticArg",
"==",
"null",
")",
"logMandatoryNote",
"(",
"deferredDiagnosticSource",
",",
"deferredDiagnosticKind",
".",
... | Report any diagnostic that might have been deferred by previous calls of report(). | [
"Report",
"any",
"diagnostic",
"that",
"might",
"have",
"been",
"deferred",
"by",
"previous",
"calls",
"of",
"report",
"()",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java#L171-L181 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.templateModem_name_PUT | public void templateModem_name_PUT(String name, OvhTemplateModem body) throws IOException {
String qPath = "/xdsl/templateModem/{name}";
StringBuilder sb = path(qPath, name);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void templateModem_name_PUT(String name, OvhTemplateModem body) throws IOException {
String qPath = "/xdsl/templateModem/{name}";
StringBuilder sb = path(qPath, name);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"templateModem_name_PUT",
"(",
"String",
"name",
",",
"OvhTemplateModem",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/templateModem/{name}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"name",
")"... | Alter this object properties
REST: PUT /xdsl/templateModem/{name}
@param body [required] New object properties
@param name [required] Name of the Modem Template | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L136-L140 |
fernandospr/javapns-jdk16 | src/main/java/javapns/notification/PushNotificationPayload.java | PushNotificationPayload.getCompatibleProperty | @SuppressWarnings("unchecked")
private <T> T getCompatibleProperty(String propertyName, Class<T> expectedClass, String exceptionMessage, JSONObject dictionary) throws JSONException {
Object propertyValue = null;
try {
propertyValue = dictionary.get(propertyName);
} catch (Exception e) {
}
if (propertyValue == null) return null;
if (propertyValue.getClass().equals(expectedClass)) return (T) propertyValue;
try {
exceptionMessage = String.format(exceptionMessage, propertyValue);
} catch (Exception e) {
}
throw new PayloadAlertAlreadyExistsException(exceptionMessage);
} | java | @SuppressWarnings("unchecked")
private <T> T getCompatibleProperty(String propertyName, Class<T> expectedClass, String exceptionMessage, JSONObject dictionary) throws JSONException {
Object propertyValue = null;
try {
propertyValue = dictionary.get(propertyName);
} catch (Exception e) {
}
if (propertyValue == null) return null;
if (propertyValue.getClass().equals(expectedClass)) return (T) propertyValue;
try {
exceptionMessage = String.format(exceptionMessage, propertyValue);
} catch (Exception e) {
}
throw new PayloadAlertAlreadyExistsException(exceptionMessage);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"getCompatibleProperty",
"(",
"String",
"propertyName",
",",
"Class",
"<",
"T",
">",
"expectedClass",
",",
"String",
"exceptionMessage",
",",
"JSONObject",
"dictionary",
")",
"thr... | Get the value of a given property, but only if it is of the expected class.
If the value exists but is of a different class than expected, an
exception is thrown.
This method is useful for properly supporting properties that can have a simple
or complex value (such as "alert")
@param <T> the property value's class
@param propertyName the name of the property to get
@param expectedClass the property value's expected (required) class
@param exceptionMessage the exception message to throw if the value is not of the expected class
@param dictionary the dictionary where to get the property from
@return the property's value
@throws JSONException | [
"Get",
"the",
"value",
"of",
"a",
"given",
"property",
"but",
"only",
"if",
"it",
"is",
"of",
"the",
"expected",
"class",
".",
"If",
"the",
"value",
"exists",
"but",
"is",
"of",
"a",
"different",
"class",
"than",
"expected",
"an",
"exception",
"is",
"t... | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/notification/PushNotificationPayload.java#L277-L292 |
google/closure-compiler | src/com/google/javascript/jscomp/JSModule.java | JSModule.addAfter | public void addAfter(CompilerInput input, CompilerInput other) {
checkState(inputs.contains(other));
inputs.add(inputs.indexOf(other), input);
input.setModule(this);
} | java | public void addAfter(CompilerInput input, CompilerInput other) {
checkState(inputs.contains(other));
inputs.add(inputs.indexOf(other), input);
input.setModule(this);
} | [
"public",
"void",
"addAfter",
"(",
"CompilerInput",
"input",
",",
"CompilerInput",
"other",
")",
"{",
"checkState",
"(",
"inputs",
".",
"contains",
"(",
"other",
")",
")",
";",
"inputs",
".",
"add",
"(",
"inputs",
".",
"indexOf",
"(",
"other",
")",
",",
... | Adds a source code input to this module directly after other. | [
"Adds",
"a",
"source",
"code",
"input",
"to",
"this",
"module",
"directly",
"after",
"other",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModule.java#L165-L169 |
Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java | FlatteningDeserializer.findNestedNode | private static JsonNode findNestedNode(JsonNode jsonNode, String composedKey) {
String[] jsonNodeKeys = splitKeyByFlatteningDots(composedKey);
for (String jsonNodeKey : jsonNodeKeys) {
jsonNode = jsonNode.get(unescapeEscapedDots(jsonNodeKey));
if (jsonNode == null) {
return null;
}
}
return jsonNode;
} | java | private static JsonNode findNestedNode(JsonNode jsonNode, String composedKey) {
String[] jsonNodeKeys = splitKeyByFlatteningDots(composedKey);
for (String jsonNodeKey : jsonNodeKeys) {
jsonNode = jsonNode.get(unescapeEscapedDots(jsonNodeKey));
if (jsonNode == null) {
return null;
}
}
return jsonNode;
} | [
"private",
"static",
"JsonNode",
"findNestedNode",
"(",
"JsonNode",
"jsonNode",
",",
"String",
"composedKey",
")",
"{",
"String",
"[",
"]",
"jsonNodeKeys",
"=",
"splitKeyByFlatteningDots",
"(",
"composedKey",
")",
";",
"for",
"(",
"String",
"jsonNodeKey",
":",
"... | Given a json node, find a nested node using given composed key.
@param jsonNode the parent json node
@param composedKey a key combines multiple keys using flattening dots.
Flattening dots are dot character '.' those are not preceded by slash '\'
Each flattening dot represents a level with following key as field key in that level
@return nested json node located using given composed key | [
"Given",
"a",
"json",
"node",
"find",
"a",
"nested",
"node",
"using",
"given",
"composed",
"key",
"."
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java#L168-L177 |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java | AbstractSubclassFactory.overrideFinalize | protected boolean overrideFinalize(MethodBodyCreator creator) {
Method finalize = null;
final ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
try {
finalize = data.getMethod("finalize", void.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
return overrideMethod(finalize, MethodIdentifier.getIdentifierForMethod(finalize), creator);
} | java | protected boolean overrideFinalize(MethodBodyCreator creator) {
Method finalize = null;
final ClassMetadataSource data = reflectionMetadataSource.getClassMetadata(Object.class);
try {
finalize = data.getMethod("finalize", void.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
return overrideMethod(finalize, MethodIdentifier.getIdentifierForMethod(finalize), creator);
} | [
"protected",
"boolean",
"overrideFinalize",
"(",
"MethodBodyCreator",
"creator",
")",
"{",
"Method",
"finalize",
"=",
"null",
";",
"final",
"ClassMetadataSource",
"data",
"=",
"reflectionMetadataSource",
".",
"getClassMetadata",
"(",
"Object",
".",
"class",
")",
";"... | Override the finalize method using the given {@link MethodBodyCreator}.
@param creator the method body creator to use | [
"Override",
"the",
"finalize",
"method",
"using",
"the",
"given",
"{",
"@link",
"MethodBodyCreator",
"}",
"."
] | train | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java#L324-L333 |
phax/ph-web | ph-httpclient/src/main/java/com/helger/httpclient/HttpClientFactory.java | HttpClientFactory.setProxy | public final void setProxy (@Nullable final HttpHost aProxy, @Nullable final Credentials aProxyCredentials)
{
m_aProxy = aProxy;
m_aProxyCredentials = aProxyCredentials;
} | java | public final void setProxy (@Nullable final HttpHost aProxy, @Nullable final Credentials aProxyCredentials)
{
m_aProxy = aProxy;
m_aProxyCredentials = aProxyCredentials;
} | [
"public",
"final",
"void",
"setProxy",
"(",
"@",
"Nullable",
"final",
"HttpHost",
"aProxy",
",",
"@",
"Nullable",
"final",
"Credentials",
"aProxyCredentials",
")",
"{",
"m_aProxy",
"=",
"aProxy",
";",
"m_aProxyCredentials",
"=",
"aProxyCredentials",
";",
"}"
] | Set proxy host and proxy credentials.
@param aProxy
The proxy host to be used. May be <code>null</code>.
@param aProxyCredentials
The proxy server credentials to be used. May be <code>null</code>.
They are only used if a proxy host is present! Usually they are of
type {@link org.apache.http.auth.UsernamePasswordCredentials}.
@since 8.8.0
@see #setProxy(HttpHost) | [
"Set",
"proxy",
"host",
"and",
"proxy",
"credentials",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-httpclient/src/main/java/com/helger/httpclient/HttpClientFactory.java#L350-L354 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/pubmed/ManualDescriptor.java | ManualDescriptor.setKeywordList | public void setKeywordList(int i, Keyword v) {
if (ManualDescriptor_Type.featOkTst && ((ManualDescriptor_Type)jcasType).casFeat_keywordList == null)
jcasType.jcas.throwFeatMissing("keywordList", "de.julielab.jules.types.pubmed.ManualDescriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_keywordList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_keywordList), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setKeywordList(int i, Keyword v) {
if (ManualDescriptor_Type.featOkTst && ((ManualDescriptor_Type)jcasType).casFeat_keywordList == null)
jcasType.jcas.throwFeatMissing("keywordList", "de.julielab.jules.types.pubmed.ManualDescriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_keywordList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_keywordList), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setKeywordList",
"(",
"int",
"i",
",",
"Keyword",
"v",
")",
"{",
"if",
"(",
"ManualDescriptor_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"ManualDescriptor_Type",
")",
"jcasType",
")",
".",
"casFeat_keywordList",
"==",
"null",
")",
"jcasType",
... | indexed setter for keywordList - sets an indexed value - A collection of objects of type uima.julielab.uima.Keyword, O
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"keywordList",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"A",
"collection",
"of",
"objects",
"of",
"type",
"uima",
".",
"julielab",
".",
"uima",
".",
"Keyword",
"O"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/pubmed/ManualDescriptor.java#L253-L257 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/codec/TIFFDirectory.java | TIFFDirectory.getFieldAsDouble | public double getFieldAsDouble(int tag, int index) {
Integer i = (Integer)fieldIndex.get(Integer.valueOf(tag));
return fields[i.intValue()].getAsDouble(index);
} | java | public double getFieldAsDouble(int tag, int index) {
Integer i = (Integer)fieldIndex.get(Integer.valueOf(tag));
return fields[i.intValue()].getAsDouble(index);
} | [
"public",
"double",
"getFieldAsDouble",
"(",
"int",
"tag",
",",
"int",
"index",
")",
"{",
"Integer",
"i",
"=",
"(",
"Integer",
")",
"fieldIndex",
".",
"get",
"(",
"Integer",
".",
"valueOf",
"(",
"tag",
")",
")",
";",
"return",
"fields",
"[",
"i",
"."... | Returns the value of a particular index of a given tag as a
double. The caller is responsible for ensuring that the tag is
present and has numeric type (all but TIFF_UNDEFINED and
TIFF_ASCII). | [
"Returns",
"the",
"value",
"of",
"a",
"particular",
"index",
"of",
"a",
"given",
"tag",
"as",
"a",
"double",
".",
"The",
"caller",
"is",
"responsible",
"for",
"ensuring",
"that",
"the",
"tag",
"is",
"present",
"and",
"has",
"numeric",
"type",
"(",
"all",... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/codec/TIFFDirectory.java#L509-L512 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java | TileBoundingBoxUtils.getWGS84BoundingBox | public static BoundingBox getWGS84BoundingBox(TileGrid tileGrid, int zoom) {
int tilesPerLat = tilesPerWGS84LatSide(zoom);
int tilesPerLon = tilesPerWGS84LonSide(zoom);
double tileSizeLat = tileSizeLatPerWGS84Side(tilesPerLat);
double tileSizeLon = tileSizeLonPerWGS84Side(tilesPerLon);
double minLon = (-1 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)
+ (tileGrid.getMinX() * tileSizeLon);
double maxLon = (-1 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)
+ ((tileGrid.getMaxX() + 1) * tileSizeLon);
double minLat = ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT
- ((tileGrid.getMaxY() + 1) * tileSizeLat);
double maxLat = ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT
- (tileGrid.getMinY() * tileSizeLat);
BoundingBox box = new BoundingBox(minLon, minLat, maxLon, maxLat);
return box;
} | java | public static BoundingBox getWGS84BoundingBox(TileGrid tileGrid, int zoom) {
int tilesPerLat = tilesPerWGS84LatSide(zoom);
int tilesPerLon = tilesPerWGS84LonSide(zoom);
double tileSizeLat = tileSizeLatPerWGS84Side(tilesPerLat);
double tileSizeLon = tileSizeLonPerWGS84Side(tilesPerLon);
double minLon = (-1 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)
+ (tileGrid.getMinX() * tileSizeLon);
double maxLon = (-1 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)
+ ((tileGrid.getMaxX() + 1) * tileSizeLon);
double minLat = ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT
- ((tileGrid.getMaxY() + 1) * tileSizeLat);
double maxLat = ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT
- (tileGrid.getMinY() * tileSizeLat);
BoundingBox box = new BoundingBox(minLon, minLat, maxLon, maxLat);
return box;
} | [
"public",
"static",
"BoundingBox",
"getWGS84BoundingBox",
"(",
"TileGrid",
"tileGrid",
",",
"int",
"zoom",
")",
"{",
"int",
"tilesPerLat",
"=",
"tilesPerWGS84LatSide",
"(",
"zoom",
")",
";",
"int",
"tilesPerLon",
"=",
"tilesPerWGS84LonSide",
"(",
"zoom",
")",
";... | Get the WGS84 tile bounding box from the tile grid and zoom level
@param tileGrid
tile grid
@param zoom
zoom
@return wgs84 bounding box
@since 1.2.0 | [
"Get",
"the",
"WGS84",
"tile",
"bounding",
"box",
"from",
"the",
"tile",
"grid",
"and",
"zoom",
"level"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L1177-L1197 |
app55/app55-java | src/support/java/org/apache/harmony/beans/internal/nls/Messages.java | Messages.getString | static public String getString(String msg, int arg)
{
return getString(msg, new Object[] { Integer.toString(arg) });
} | java | static public String getString(String msg, int arg)
{
return getString(msg, new Object[] { Integer.toString(arg) });
} | [
"static",
"public",
"String",
"getString",
"(",
"String",
"msg",
",",
"int",
"arg",
")",
"{",
"return",
"getString",
"(",
"msg",
",",
"new",
"Object",
"[",
"]",
"{",
"Integer",
".",
"toString",
"(",
"arg",
")",
"}",
")",
";",
"}"
] | Retrieves a message which takes 1 integer argument.
@param msg
String the key to look up.
@param arg
int the integer to insert in the formatted output.
@return String the message for that key in the system message bundle. | [
"Retrieves",
"a",
"message",
"which",
"takes",
"1",
"integer",
"argument",
"."
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/org/apache/harmony/beans/internal/nls/Messages.java#L89-L92 |
google/closure-compiler | src/com/google/javascript/refactoring/RefactoringDriver.java | RefactoringDriver.drive | public List<SuggestedFix> drive(Scanner scanner, Pattern includeFilePattern) {
JsFlumeCallback callback = new JsFlumeCallback(scanner, includeFilePattern);
NodeTraversal.traverse(compiler, rootNode, callback);
List<SuggestedFix> fixes = callback.getFixes();
fixes.addAll(scanner.processAllMatches(callback.getMatches()));
return fixes;
} | java | public List<SuggestedFix> drive(Scanner scanner, Pattern includeFilePattern) {
JsFlumeCallback callback = new JsFlumeCallback(scanner, includeFilePattern);
NodeTraversal.traverse(compiler, rootNode, callback);
List<SuggestedFix> fixes = callback.getFixes();
fixes.addAll(scanner.processAllMatches(callback.getMatches()));
return fixes;
} | [
"public",
"List",
"<",
"SuggestedFix",
">",
"drive",
"(",
"Scanner",
"scanner",
",",
"Pattern",
"includeFilePattern",
")",
"{",
"JsFlumeCallback",
"callback",
"=",
"new",
"JsFlumeCallback",
"(",
"scanner",
",",
"includeFilePattern",
")",
";",
"NodeTraversal",
".",... | Run a refactoring and return any suggested fixes as a result. | [
"Run",
"a",
"refactoring",
"and",
"return",
"any",
"suggested",
"fixes",
"as",
"a",
"result",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/RefactoringDriver.java#L59-L65 |
brettwooldridge/HikariCP | src/main/java/com/zaxxer/hikari/pool/HikariPool.java | HikariPool.getConnection | public Connection getConnection(final long hardTimeout) throws SQLException
{
suspendResumeLock.acquire();
final long startTime = currentTime();
try {
long timeout = hardTimeout;
do {
PoolEntry poolEntry = connectionBag.borrow(timeout, MILLISECONDS);
if (poolEntry == null) {
break; // We timed out... break and throw exception
}
final long now = currentTime();
if (poolEntry.isMarkedEvicted() || (elapsedMillis(poolEntry.lastAccessed, now) > aliveBypassWindowMs && !isConnectionAlive(poolEntry.connection))) {
closeConnection(poolEntry, poolEntry.isMarkedEvicted() ? EVICTED_CONNECTION_MESSAGE : DEAD_CONNECTION_MESSAGE);
timeout = hardTimeout - elapsedMillis(startTime);
}
else {
metricsTracker.recordBorrowStats(poolEntry, startTime);
return poolEntry.createProxyConnection(leakTaskFactory.schedule(poolEntry), now);
}
} while (timeout > 0L);
metricsTracker.recordBorrowTimeoutStats(startTime);
throw createTimeoutException(startTime);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SQLException(poolName + " - Interrupted during connection acquisition", e);
}
finally {
suspendResumeLock.release();
}
} | java | public Connection getConnection(final long hardTimeout) throws SQLException
{
suspendResumeLock.acquire();
final long startTime = currentTime();
try {
long timeout = hardTimeout;
do {
PoolEntry poolEntry = connectionBag.borrow(timeout, MILLISECONDS);
if (poolEntry == null) {
break; // We timed out... break and throw exception
}
final long now = currentTime();
if (poolEntry.isMarkedEvicted() || (elapsedMillis(poolEntry.lastAccessed, now) > aliveBypassWindowMs && !isConnectionAlive(poolEntry.connection))) {
closeConnection(poolEntry, poolEntry.isMarkedEvicted() ? EVICTED_CONNECTION_MESSAGE : DEAD_CONNECTION_MESSAGE);
timeout = hardTimeout - elapsedMillis(startTime);
}
else {
metricsTracker.recordBorrowStats(poolEntry, startTime);
return poolEntry.createProxyConnection(leakTaskFactory.schedule(poolEntry), now);
}
} while (timeout > 0L);
metricsTracker.recordBorrowTimeoutStats(startTime);
throw createTimeoutException(startTime);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SQLException(poolName + " - Interrupted during connection acquisition", e);
}
finally {
suspendResumeLock.release();
}
} | [
"public",
"Connection",
"getConnection",
"(",
"final",
"long",
"hardTimeout",
")",
"throws",
"SQLException",
"{",
"suspendResumeLock",
".",
"acquire",
"(",
")",
";",
"final",
"long",
"startTime",
"=",
"currentTime",
"(",
")",
";",
"try",
"{",
"long",
"timeout"... | Get a connection from the pool, or timeout after the specified number of milliseconds.
@param hardTimeout the maximum time to wait for a connection from the pool
@return a java.sql.Connection instance
@throws SQLException thrown if a timeout occurs trying to obtain a connection | [
"Get",
"a",
"connection",
"from",
"the",
"pool",
"or",
"timeout",
"after",
"the",
"specified",
"number",
"of",
"milliseconds",
"."
] | train | https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L171-L205 |
shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.ensureLeft | public static String ensureLeft(final String value, final String prefix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.startsWith(prefix) ? value : prefix + value;
}
String _value = value.toLowerCase();
String _prefix = prefix.toLowerCase();
return _value.startsWith(_prefix) ? value : prefix + value;
} | java | public static String ensureLeft(final String value, final String prefix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.startsWith(prefix) ? value : prefix + value;
}
String _value = value.toLowerCase();
String _prefix = prefix.toLowerCase();
return _value.startsWith(_prefix) ? value : prefix + value;
} | [
"public",
"static",
"String",
"ensureLeft",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"prefix",
",",
"final",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
... | Ensures that the value begins with prefix. If it doesn't exist, it's prepended.
@param value input
@param prefix prefix
@param caseSensitive true or false
@return string with prefix if it was not present. | [
"Ensures",
"that",
"the",
"value",
"begins",
"with",
"prefix",
".",
"If",
"it",
"doesn",
"t",
"exist",
"it",
"s",
"prepended",
"."
] | train | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L312-L320 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java | MetricsRecordImpl.setTag | public void setTag(String tagName, String tagValue) {
if (tagValue == null) {
tagValue = "";
}
tagTable.put(tagName, tagValue);
} | java | public void setTag(String tagName, String tagValue) {
if (tagValue == null) {
tagValue = "";
}
tagTable.put(tagName, tagValue);
} | [
"public",
"void",
"setTag",
"(",
"String",
"tagName",
",",
"String",
"tagValue",
")",
"{",
"if",
"(",
"tagValue",
"==",
"null",
")",
"{",
"tagValue",
"=",
"\"\"",
";",
"}",
"tagTable",
".",
"put",
"(",
"tagName",
",",
"tagValue",
")",
";",
"}"
] | Sets the named tag to the specified value.
@param tagName name of the tag
@param tagValue new value of the tag
@throws MetricsException if the tagName conflicts with the configuration | [
"Sets",
"the",
"named",
"tag",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java#L65-L70 |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java | GVRScriptManager.loadScript | @Override
public IScriptFile loadScript(GVRAndroidResource resource, String language) throws IOException, GVRScriptException {
if (getEngine(language) == null) {
mGvrContext.logError("Script language " + language + " unsupported", this);
throw new GVRScriptException(String.format("The language is unknown: %s", language));
}
IScriptFile script = null;
if (language.equals(LANG_JAVASCRIPT)) {
script = new GVRJavascriptScriptFile(mGvrContext, resource.getStream());
}
resource.closeStream();
return script;
} | java | @Override
public IScriptFile loadScript(GVRAndroidResource resource, String language) throws IOException, GVRScriptException {
if (getEngine(language) == null) {
mGvrContext.logError("Script language " + language + " unsupported", this);
throw new GVRScriptException(String.format("The language is unknown: %s", language));
}
IScriptFile script = null;
if (language.equals(LANG_JAVASCRIPT)) {
script = new GVRJavascriptScriptFile(mGvrContext, resource.getStream());
}
resource.closeStream();
return script;
} | [
"@",
"Override",
"public",
"IScriptFile",
"loadScript",
"(",
"GVRAndroidResource",
"resource",
",",
"String",
"language",
")",
"throws",
"IOException",
",",
"GVRScriptException",
"{",
"if",
"(",
"getEngine",
"(",
"language",
")",
"==",
"null",
")",
"{",
"mGvrCon... | Loads a script file using {@link GVRAndroidResource}.
@param resource The resource object.
@param language The language string.
@return A script file object or {@code null} if not found.
@throws IOException if script file cannot be read.
@throws GVRScriptException if script processing error occurs. | [
"Loads",
"a",
"script",
"file",
"using",
"{"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L222-L236 |
JoeKerouac/utils | src/main/java/com/joe/utils/protocol/DatagramUtil.java | DatagramUtil.convert | public static int convert(byte[] data, int start) {
return (Byte.toUnsignedInt(data[start]) << 24) | (Byte.toUnsignedInt(data[start + 1]) << 16)
| (Byte.toUnsignedInt(data[start + 2]) << 8) | Byte.toUnsignedInt(data[start + 3]);
} | java | public static int convert(byte[] data, int start) {
return (Byte.toUnsignedInt(data[start]) << 24) | (Byte.toUnsignedInt(data[start + 1]) << 16)
| (Byte.toUnsignedInt(data[start + 2]) << 8) | Byte.toUnsignedInt(data[start + 3]);
} | [
"public",
"static",
"int",
"convert",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
")",
"{",
"return",
"(",
"Byte",
".",
"toUnsignedInt",
"(",
"data",
"[",
"start",
"]",
")",
"<<",
"24",
")",
"|",
"(",
"Byte",
".",
"toUnsignedInt",
"(",
"dat... | 将四个字节转换为一个int类型的数字
@param data data数据
@param start 四个字节长度开始的位置
@return 四个byte转换为的一个int | [
"将四个字节转换为一个int类型的数字"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/protocol/DatagramUtil.java#L261-L264 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java | SerializedFormBuilder.buildSerializedFormSummaries | public void buildSerializedFormSummaries(XMLNode node, Content serializedTree) {
Content serializedSummariesTree = writer.getSerializedSummariesHeader();
PackageDoc[] packages = configuration.packages;
for (int i = 0; i < packages.length; i++) {
currentPackage = packages[i];
buildChildren(node, serializedSummariesTree);
}
serializedTree.addContent(writer.getSerializedContent(
serializedSummariesTree));
} | java | public void buildSerializedFormSummaries(XMLNode node, Content serializedTree) {
Content serializedSummariesTree = writer.getSerializedSummariesHeader();
PackageDoc[] packages = configuration.packages;
for (int i = 0; i < packages.length; i++) {
currentPackage = packages[i];
buildChildren(node, serializedSummariesTree);
}
serializedTree.addContent(writer.getSerializedContent(
serializedSummariesTree));
} | [
"public",
"void",
"buildSerializedFormSummaries",
"(",
"XMLNode",
"node",
",",
"Content",
"serializedTree",
")",
"{",
"Content",
"serializedSummariesTree",
"=",
"writer",
".",
"getSerializedSummariesHeader",
"(",
")",
";",
"PackageDoc",
"[",
"]",
"packages",
"=",
"c... | Build the serialized form summaries.
@param node the XML element that specifies which components to document
@param serializedTree content tree to which the documentation will be added | [
"Build",
"the",
"serialized",
"form",
"summaries",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L163-L172 |
google/closure-compiler | src/com/google/javascript/jscomp/gwt/client/Es6ClassConverterJsDocHelper.java | Es6ClassConverterJsDocHelper.getConstructorJsDoc | @JsMethod(name = "getConstructorJsDoc", namespace = "jscomp")
public static String getConstructorJsDoc(String jsDoc) {
if (Strings.isNullOrEmpty(jsDoc)) {
return null;
}
Config config =
Config.builder()
.setLanguageMode(LanguageMode.ECMASCRIPT3)
.setStrictMode(Config.StrictMode.SLOPPY)
.setJsDocParsingMode(JsDocParsing.INCLUDE_DESCRIPTIONS_WITH_WHITESPACE)
.build();
JsDocInfoParser parser =
new JsDocInfoParser(
// Stream expects us to remove the leading /**
new JsDocTokenStream(jsDoc.substring(3)),
jsDoc,
0,
null,
config,
ErrorReporter.NULL_INSTANCE);
parser.parse();
JSDocInfo parsed = parser.retrieveAndResetParsedJSDocInfo();
JSDocInfo params = parsed.cloneConstructorDoc();
if (parsed.getParameterNames().isEmpty() && parsed.getSuppressions().isEmpty()) {
return null;
}
JSDocInfoPrinter printer =
new JSDocInfoPrinter(/* useOriginalName= */ true, /* printDesc= */ true);
return printer.print(params).trim();
} | java | @JsMethod(name = "getConstructorJsDoc", namespace = "jscomp")
public static String getConstructorJsDoc(String jsDoc) {
if (Strings.isNullOrEmpty(jsDoc)) {
return null;
}
Config config =
Config.builder()
.setLanguageMode(LanguageMode.ECMASCRIPT3)
.setStrictMode(Config.StrictMode.SLOPPY)
.setJsDocParsingMode(JsDocParsing.INCLUDE_DESCRIPTIONS_WITH_WHITESPACE)
.build();
JsDocInfoParser parser =
new JsDocInfoParser(
// Stream expects us to remove the leading /**
new JsDocTokenStream(jsDoc.substring(3)),
jsDoc,
0,
null,
config,
ErrorReporter.NULL_INSTANCE);
parser.parse();
JSDocInfo parsed = parser.retrieveAndResetParsedJSDocInfo();
JSDocInfo params = parsed.cloneConstructorDoc();
if (parsed.getParameterNames().isEmpty() && parsed.getSuppressions().isEmpty()) {
return null;
}
JSDocInfoPrinter printer =
new JSDocInfoPrinter(/* useOriginalName= */ true, /* printDesc= */ true);
return printer.print(params).trim();
} | [
"@",
"JsMethod",
"(",
"name",
"=",
"\"getConstructorJsDoc\"",
",",
"namespace",
"=",
"\"jscomp\"",
")",
"public",
"static",
"String",
"getConstructorJsDoc",
"(",
"String",
"jsDoc",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"jsDoc",
")",
")",
... | Gets JS Doc that should be moved to a constructor. Used to upgrade ES5 to ES6 classes and
separate class from constructor comments. | [
"Gets",
"JS",
"Doc",
"that",
"should",
"be",
"moved",
"to",
"a",
"constructor",
".",
"Used",
"to",
"upgrade",
"ES5",
"to",
"ES6",
"classes",
"and",
"separate",
"class",
"from",
"constructor",
"comments",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/gwt/client/Es6ClassConverterJsDocHelper.java#L94-L123 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java | ExtensionsInner.beginDisableMonitoring | public void beginDisableMonitoring(String resourceGroupName, String clusterName) {
beginDisableMonitoringWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | java | public void beginDisableMonitoring(String resourceGroupName, String clusterName) {
beginDisableMonitoringWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | [
"public",
"void",
"beginDisableMonitoring",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"beginDisableMonitoringWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
... | Disables the Operations Management Suite (OMS) on the HDInsight cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Disables",
"the",
"Operations",
"Management",
"Suite",
"(",
"OMS",
")",
"on",
"the",
"HDInsight",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java#L434-L436 |
undertow-io/undertow | servlet/src/main/java/io/undertow/servlet/handlers/security/ServletFormAuthenticationMechanism.java | ServletFormAuthenticationMechanism.storeInitialLocation | protected void storeInitialLocation(final HttpServerExchange exchange, byte[] bytes, int contentLength) {
if(!saveOriginalRequest) {
return;
}
final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
HttpSessionImpl httpSession = servletRequestContext.getCurrentServletContext().getSession(exchange, true);
Session session;
if (System.getSecurityManager() == null) {
session = httpSession.getSession();
} else {
session = AccessController.doPrivileged(new HttpSessionImpl.UnwrapSessionAction(httpSession));
}
SessionManager manager = session.getSessionManager();
if (seenSessionManagers.add(manager)) {
manager.registerSessionListener(LISTENER);
}
session.setAttribute(SESSION_KEY, RedirectBuilder.redirect(exchange, exchange.getRelativePath()));
if(bytes == null) {
SavedRequest.trySaveRequest(exchange);
} else {
SavedRequest.trySaveRequest(exchange, bytes, contentLength);
}
} | java | protected void storeInitialLocation(final HttpServerExchange exchange, byte[] bytes, int contentLength) {
if(!saveOriginalRequest) {
return;
}
final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
HttpSessionImpl httpSession = servletRequestContext.getCurrentServletContext().getSession(exchange, true);
Session session;
if (System.getSecurityManager() == null) {
session = httpSession.getSession();
} else {
session = AccessController.doPrivileged(new HttpSessionImpl.UnwrapSessionAction(httpSession));
}
SessionManager manager = session.getSessionManager();
if (seenSessionManagers.add(manager)) {
manager.registerSessionListener(LISTENER);
}
session.setAttribute(SESSION_KEY, RedirectBuilder.redirect(exchange, exchange.getRelativePath()));
if(bytes == null) {
SavedRequest.trySaveRequest(exchange);
} else {
SavedRequest.trySaveRequest(exchange, bytes, contentLength);
}
} | [
"protected",
"void",
"storeInitialLocation",
"(",
"final",
"HttpServerExchange",
"exchange",
",",
"byte",
"[",
"]",
"bytes",
",",
"int",
"contentLength",
")",
"{",
"if",
"(",
"!",
"saveOriginalRequest",
")",
"{",
"return",
";",
"}",
"final",
"ServletRequestConte... | This method doesn't save content of request but instead uses data from parameter.
This should be used in case that data from request was already read and therefore it is not possible to save them.
@param exchange
@param bytes
@param contentLength | [
"This",
"method",
"doesn",
"t",
"save",
"content",
"of",
"request",
"but",
"instead",
"uses",
"data",
"from",
"parameter",
".",
"This",
"should",
"be",
"used",
"in",
"case",
"that",
"data",
"from",
"request",
"was",
"already",
"read",
"and",
"therefore",
"... | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/servlet/src/main/java/io/undertow/servlet/handlers/security/ServletFormAuthenticationMechanism.java#L170-L192 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java | LdapEntity.setRDNAttributes | public void setRDNAttributes(List<Map<String, Object>> rdnAttrList) throws MissingInitPropertyException {
int size = rdnAttrList.size();
// if size = 0, No RDN attributes defined. Same as RDN properties.
if (size > 0) {
iRDNAttrs = new String[size][];
iRDNObjectClass = new String[size][];
if (size == 1) {
Map<String, Object> rdnAttr = rdnAttrList.get(0);
String[] rdns = LdapHelper.getRDNs((String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME));
iRDNAttrs[0] = rdns;
} else {
int i = 0;
for (Map<String, Object> rdnAttr : rdnAttrList) {
String name = (String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME);
String[] rdns = LdapHelper.getRDNs(name);
iRDNAttrs[i] = rdns;
String[] objCls = (String[]) rdnAttr.get(ConfigConstants.CONFIG_PROP_OBJECTCLASS);
if (objCls == null) {
throw new MissingInitPropertyException(WIMMessageKey.MISSING_INI_PROPERTY, Tr.formatMessage(
tc,
WIMMessageKey.MISSING_INI_PROPERTY,
WIMMessageHelper.generateMsgParms(ConfigConstants.CONFIG_PROP_OBJECTCLASS)));
} else {
iRDNObjectClass[i] = objCls;
}
i++;
}
}
}
} | java | public void setRDNAttributes(List<Map<String, Object>> rdnAttrList) throws MissingInitPropertyException {
int size = rdnAttrList.size();
// if size = 0, No RDN attributes defined. Same as RDN properties.
if (size > 0) {
iRDNAttrs = new String[size][];
iRDNObjectClass = new String[size][];
if (size == 1) {
Map<String, Object> rdnAttr = rdnAttrList.get(0);
String[] rdns = LdapHelper.getRDNs((String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME));
iRDNAttrs[0] = rdns;
} else {
int i = 0;
for (Map<String, Object> rdnAttr : rdnAttrList) {
String name = (String) rdnAttr.get(ConfigConstants.CONFIG_PROP_NAME);
String[] rdns = LdapHelper.getRDNs(name);
iRDNAttrs[i] = rdns;
String[] objCls = (String[]) rdnAttr.get(ConfigConstants.CONFIG_PROP_OBJECTCLASS);
if (objCls == null) {
throw new MissingInitPropertyException(WIMMessageKey.MISSING_INI_PROPERTY, Tr.formatMessage(
tc,
WIMMessageKey.MISSING_INI_PROPERTY,
WIMMessageHelper.generateMsgParms(ConfigConstants.CONFIG_PROP_OBJECTCLASS)));
} else {
iRDNObjectClass[i] = objCls;
}
i++;
}
}
}
} | [
"public",
"void",
"setRDNAttributes",
"(",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"rdnAttrList",
")",
"throws",
"MissingInitPropertyException",
"{",
"int",
"size",
"=",
"rdnAttrList",
".",
"size",
"(",
")",
";",
"// if size = 0, No RDN attri... | Sets the RDN attribute types of this member type.
RDN attribute types will be converted to lower case.
@param The RDN attribute types of this member type. | [
"Sets",
"the",
"RDN",
"attribute",
"types",
"of",
"this",
"member",
"type",
".",
"RDN",
"attribute",
"types",
"will",
"be",
"converted",
"to",
"lower",
"case",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapEntity.java#L400-L429 |
phax/ph-web | ph-http/src/main/java/com/helger/http/CacheControlBuilder.java | CacheControlBuilder.setMaxAge | @Nonnull
public CacheControlBuilder setMaxAge (@Nonnull final TimeUnit eTimeUnit, final long nDuration)
{
return setMaxAgeSeconds (eTimeUnit.toSeconds (nDuration));
} | java | @Nonnull
public CacheControlBuilder setMaxAge (@Nonnull final TimeUnit eTimeUnit, final long nDuration)
{
return setMaxAgeSeconds (eTimeUnit.toSeconds (nDuration));
} | [
"@",
"Nonnull",
"public",
"CacheControlBuilder",
"setMaxAge",
"(",
"@",
"Nonnull",
"final",
"TimeUnit",
"eTimeUnit",
",",
"final",
"long",
"nDuration",
")",
"{",
"return",
"setMaxAgeSeconds",
"(",
"eTimeUnit",
".",
"toSeconds",
"(",
"nDuration",
")",
")",
";",
... | Set the maximum age relative to the request time
@param eTimeUnit
{@link TimeUnit} to use
@param nDuration
The duration in the passed unit
@return this | [
"Set",
"the",
"maximum",
"age",
"relative",
"to",
"the",
"request",
"time"
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-http/src/main/java/com/helger/http/CacheControlBuilder.java#L93-L97 |
lastaflute/lasta-di | src/main/java/org/lastaflute/di/util/LdiSrl.java | LdiSrl.substringLastRear | public static String substringLastRear(String str, String... delimiters) {
assertStringNotNull(str);
return doSubstringFirstRear(true, true, false, str, delimiters);
} | java | public static String substringLastRear(String str, String... delimiters) {
assertStringNotNull(str);
return doSubstringFirstRear(true, true, false, str, delimiters);
} | [
"public",
"static",
"String",
"substringLastRear",
"(",
"String",
"str",
",",
"String",
"...",
"delimiters",
")",
"{",
"assertStringNotNull",
"(",
"str",
")",
";",
"return",
"doSubstringFirstRear",
"(",
"true",
",",
"true",
",",
"false",
",",
"str",
",",
"de... | Extract rear sub-string from last-found delimiter.
<pre>
substringLastRear("foo.bar/baz.qux", ".", "/")
returns "qux"
</pre>
@param str The target string. (NotNull)
@param delimiters The array of delimiters. (NotNull)
@return The part of string. (NotNull: if delimiter not found, returns argument-plain string) | [
"Extract",
"rear",
"sub",
"-",
"string",
"from",
"last",
"-",
"found",
"delimiter",
".",
"<pre",
">",
"substringLastRear",
"(",
"foo",
".",
"bar",
"/",
"baz",
".",
"qux",
".",
"/",
")",
"returns",
"qux",
"<",
"/",
"pre",
">"
] | train | https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L717-L720 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductVariationUrl.java | ProductVariationUrl.updateProductVariationLocalizedDeltaPriceUrl | public static MozuUrl updateProductVariationLocalizedDeltaPriceUrl(String currencyCode, String productCode, String responseFields, String variationKey)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/variations/{variationKey}/localizedDeltaPrice/{currencyCode}?responseFields={responseFields}");
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("productCode", productCode);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("variationKey", variationKey);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateProductVariationLocalizedDeltaPriceUrl(String currencyCode, String productCode, String responseFields, String variationKey)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/variations/{variationKey}/localizedDeltaPrice/{currencyCode}?responseFields={responseFields}");
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("productCode", productCode);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("variationKey", variationKey);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateProductVariationLocalizedDeltaPriceUrl",
"(",
"String",
"currencyCode",
",",
"String",
"productCode",
",",
"String",
"responseFields",
",",
"String",
"variationKey",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
... | Get Resource Url for UpdateProductVariationLocalizedDeltaPrice
@param currencyCode The three character ISOÂ currency code, such as USDÂ for US Dollars.
@param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param variationKey System-generated key that represents the attribute values that uniquely identify a specific product variation.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateProductVariationLocalizedDeltaPrice"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductVariationUrl.java#L172-L180 |
momokan/LWJGFont | src/main/java/net/chocolapod/lwjgfont/LWJGFont.java | LWJGFont.drawParagraph | public final void drawParagraph(String[] texts, float dstX, float dstY, float dstZ, float paragraphWidth, ALIGN align) throws IOException {
if (LwjgFontUtil.isEmpty(texts)) {
return;
}
String buff = "";
for (String text: texts) {
if (!LwjgFontUtil.isEmpty(text)) {
buff += "\n";
}
buff += text;
}
drawParagraph(buff, dstX, dstY, dstZ, paragraphWidth, align);
} | java | public final void drawParagraph(String[] texts, float dstX, float dstY, float dstZ, float paragraphWidth, ALIGN align) throws IOException {
if (LwjgFontUtil.isEmpty(texts)) {
return;
}
String buff = "";
for (String text: texts) {
if (!LwjgFontUtil.isEmpty(text)) {
buff += "\n";
}
buff += text;
}
drawParagraph(buff, dstX, dstY, dstZ, paragraphWidth, align);
} | [
"public",
"final",
"void",
"drawParagraph",
"(",
"String",
"[",
"]",
"texts",
",",
"float",
"dstX",
",",
"float",
"dstY",
",",
"float",
"dstZ",
",",
"float",
"paragraphWidth",
",",
"ALIGN",
"align",
")",
"throws",
"IOException",
"{",
"if",
"(",
"LwjgFontUt... | Draws the paragraph given by the specified string, using this font instance's current color.<br>
if the specified string protrudes from paragraphWidth, protruded substring is auto wrapped with the specified align.<br>
Note that the specified destination coordinates is a left point of the rendered string's baseline.
@param texts the array of strings to be drawn.
@param dstX the x coordinate to render the string.
@param dstY the y coordinate to render the string.
@param dstZ the z coordinate to render the string.
@param paragraphWidth the max width to draw the paragraph.
@param align the horizontal align to render the string.
@throws IOException Indicates a failure to read font images as textures. | [
"Draws",
"the",
"paragraph",
"given",
"by",
"the",
"specified",
"string",
"using",
"this",
"font",
"instance",
"s",
"current",
"color",
".",
"<br",
">",
"if",
"the",
"specified",
"string",
"protrudes",
"from",
"paragraphWidth",
"protruded",
"substring",
"is",
... | train | https://github.com/momokan/LWJGFont/blob/f2d6138b73d84a7e2c1271bae25b4c76488d9ec2/src/main/java/net/chocolapod/lwjgfont/LWJGFont.java#L187-L201 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/clean/MakeValidOp.java | MakeValidOp.removeLowerDimension | private void removeLowerDimension(Geometry geometry, List<Geometry> result, int dimension) {
for (int i = 0; i < geometry.getNumGeometries(); i++) {
Geometry g = geometry.getGeometryN(i);
if (g instanceof GeometryCollection) {
removeLowerDimension(g, result, dimension);
} else if (g.getDimension() >= dimension) {
result.add(g);
}
}
} | java | private void removeLowerDimension(Geometry geometry, List<Geometry> result, int dimension) {
for (int i = 0; i < geometry.getNumGeometries(); i++) {
Geometry g = geometry.getGeometryN(i);
if (g instanceof GeometryCollection) {
removeLowerDimension(g, result, dimension);
} else if (g.getDimension() >= dimension) {
result.add(g);
}
}
} | [
"private",
"void",
"removeLowerDimension",
"(",
"Geometry",
"geometry",
",",
"List",
"<",
"Geometry",
">",
"result",
",",
"int",
"dimension",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"geometry",
".",
"getNumGeometries",
"(",
")",
";",
... | Reursively remove geometries with a dimension less than dimension parameter | [
"Reursively",
"remove",
"geometries",
"with",
"a",
"dimension",
"less",
"than",
"dimension",
"parameter"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/clean/MakeValidOp.java#L237-L246 |
agentgt/jirm | jirm-orm/src/main/java/co/jirm/mapper/definition/DefaultNamingStrategy.java | DefaultNamingStrategy.logicalCollectionColumnName | public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
return isNullOrEmpty( columnName ) ?
columnName :
unqualify( propertyName ) + "_" + referencedColumn;
} | java | public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
return isNullOrEmpty( columnName ) ?
columnName :
unqualify( propertyName ) + "_" + referencedColumn;
} | [
"public",
"String",
"logicalCollectionColumnName",
"(",
"String",
"columnName",
",",
"String",
"propertyName",
",",
"String",
"referencedColumn",
")",
"{",
"return",
"isNullOrEmpty",
"(",
"columnName",
")",
"?",
"columnName",
":",
"unqualify",
"(",
"propertyName",
"... | Return the column name if explicit or the concatenation of the property name and the referenced column | [
"Return",
"the",
"column",
"name",
"if",
"explicit",
"or",
"the",
"concatenation",
"of",
"the",
"property",
"name",
"and",
"the",
"referenced",
"column"
] | train | https://github.com/agentgt/jirm/blob/95a2fcdef4121c439053524407af3d4ce8035722/jirm-orm/src/main/java/co/jirm/mapper/definition/DefaultNamingStrategy.java#L134-L138 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPP14Reader.java | MPP14Reader.populateMemberData | private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws FileNotFoundException, IOException, MPXJException
{
m_reader = reader;
m_file = file;
m_eventManager = file.getEventManager();
m_root = root;
//
// Retrieve the high level document properties
//
Props14 props14 = new Props14(new DocumentInputStream(((DocumentEntry) root.getEntry("Props14"))));
//System.out.println(props14);
file.getProjectProperties().setProjectFilePath(props14.getUnicodeString(Props.PROJECT_FILE_PATH));
m_inputStreamFactory = new DocumentInputStreamFactory(props14);
//
// Test for password protection. In the single byte retrieved here:
//
// 0x00 = no password
// 0x01 = protection password has been supplied
// 0x02 = write reservation password has been supplied
// 0x03 = both passwords have been supplied
//
if ((props14.getByte(Props.PASSWORD_FLAG) & 0x01) != 0)
{
// Couldn't figure out how to get the password for MPP14 files so for now we just need to block the reading
throw new MPXJException(MPXJException.PASSWORD_PROTECTED);
}
m_resourceMap = new HashMap<Integer, ProjectCalendar>();
m_projectDir = (DirectoryEntry) root.getEntry(" 114");
m_viewDir = (DirectoryEntry) root.getEntry(" 214");
DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode");
m_outlineCodeVarMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta"))));
m_outlineCodeVarData = new Var2Data(m_outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data"))));
m_outlineCodeFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedMeta"))), 10);
m_outlineCodeFixedData = new FixedData(m_outlineCodeFixedMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedData"))));
m_outlineCodeFixedMeta2 = new FixedMeta(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Fixed2Meta"))), 10);
m_outlineCodeFixedData2 = new FixedData(m_outlineCodeFixedMeta2, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Fixed2Data"))));
m_projectProps = new Props14(m_inputStreamFactory.getInstance(m_projectDir, "Props"));
//MPPUtility.fileDump("c:\\temp\\props.txt", m_projectProps.toString().getBytes());
//FieldMap fm = new FieldMap14(m_file);
//fm.dumpKnownFieldMaps(m_projectProps);
m_fontBases = new HashMap<Integer, FontBase>();
m_taskSubProjects = new HashMap<Integer, SubProject>();
m_parentTasks = new HashMap<Integer, Integer>();
m_taskOrder = new TreeMap<Long, Integer>();
m_nullTaskOrder = new TreeMap<Integer, Integer>();
m_file.getProjectProperties().setMppFileType(Integer.valueOf(14));
m_file.getProjectProperties().setAutoFilter(props14.getBoolean(Props.AUTO_FILTER));
} | java | private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws FileNotFoundException, IOException, MPXJException
{
m_reader = reader;
m_file = file;
m_eventManager = file.getEventManager();
m_root = root;
//
// Retrieve the high level document properties
//
Props14 props14 = new Props14(new DocumentInputStream(((DocumentEntry) root.getEntry("Props14"))));
//System.out.println(props14);
file.getProjectProperties().setProjectFilePath(props14.getUnicodeString(Props.PROJECT_FILE_PATH));
m_inputStreamFactory = new DocumentInputStreamFactory(props14);
//
// Test for password protection. In the single byte retrieved here:
//
// 0x00 = no password
// 0x01 = protection password has been supplied
// 0x02 = write reservation password has been supplied
// 0x03 = both passwords have been supplied
//
if ((props14.getByte(Props.PASSWORD_FLAG) & 0x01) != 0)
{
// Couldn't figure out how to get the password for MPP14 files so for now we just need to block the reading
throw new MPXJException(MPXJException.PASSWORD_PROTECTED);
}
m_resourceMap = new HashMap<Integer, ProjectCalendar>();
m_projectDir = (DirectoryEntry) root.getEntry(" 114");
m_viewDir = (DirectoryEntry) root.getEntry(" 214");
DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode");
m_outlineCodeVarMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta"))));
m_outlineCodeVarData = new Var2Data(m_outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data"))));
m_outlineCodeFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedMeta"))), 10);
m_outlineCodeFixedData = new FixedData(m_outlineCodeFixedMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedData"))));
m_outlineCodeFixedMeta2 = new FixedMeta(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Fixed2Meta"))), 10);
m_outlineCodeFixedData2 = new FixedData(m_outlineCodeFixedMeta2, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Fixed2Data"))));
m_projectProps = new Props14(m_inputStreamFactory.getInstance(m_projectDir, "Props"));
//MPPUtility.fileDump("c:\\temp\\props.txt", m_projectProps.toString().getBytes());
//FieldMap fm = new FieldMap14(m_file);
//fm.dumpKnownFieldMaps(m_projectProps);
m_fontBases = new HashMap<Integer, FontBase>();
m_taskSubProjects = new HashMap<Integer, SubProject>();
m_parentTasks = new HashMap<Integer, Integer>();
m_taskOrder = new TreeMap<Long, Integer>();
m_nullTaskOrder = new TreeMap<Integer, Integer>();
m_file.getProjectProperties().setMppFileType(Integer.valueOf(14));
m_file.getProjectProperties().setAutoFilter(props14.getBoolean(Props.AUTO_FILTER));
} | [
"private",
"void",
"populateMemberData",
"(",
"MPPReader",
"reader",
",",
"ProjectFile",
"file",
",",
"DirectoryEntry",
"root",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
",",
"MPXJException",
"{",
"m_reader",
"=",
"reader",
";",
"m_file",
"=",
"f... | Populate member data used by the rest of the reader.
@param reader parent file reader
@param file parent MPP file
@param root Root of the POI file system. | [
"Populate",
"member",
"data",
"used",
"by",
"the",
"rest",
"of",
"the",
"reader",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L124-L177 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java | SphereUtil.bearingRad | public static double bearingRad(double latS, double lngS, double latE, double lngE) {
final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
final double slatS = sinAndCos(latS, tmp), clatS = tmp.value;
final double slatE = sinAndCos(latE, tmp), clatE = tmp.value;
return atan2(-sin(lngS - lngE) * clatE, clatS * slatE - slatS * clatE * cos(lngS - lngE));
} | java | public static double bearingRad(double latS, double lngS, double latE, double lngE) {
final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
final double slatS = sinAndCos(latS, tmp), clatS = tmp.value;
final double slatE = sinAndCos(latE, tmp), clatE = tmp.value;
return atan2(-sin(lngS - lngE) * clatE, clatS * slatE - slatS * clatE * cos(lngS - lngE));
} | [
"public",
"static",
"double",
"bearingRad",
"(",
"double",
"latS",
",",
"double",
"lngS",
",",
"double",
"latE",
",",
"double",
"lngE",
")",
"{",
"final",
"DoubleWrapper",
"tmp",
"=",
"new",
"DoubleWrapper",
"(",
")",
";",
"// To return cosine",
"final",
"do... | Compute the bearing from start to end.
@param latS Start latitude, in radians
@param lngS Start longitude, in radians
@param latE End latitude, in radians
@param lngE End longitude, in radians
@return Bearing in degree | [
"Compute",
"the",
"bearing",
"from",
"start",
"to",
"end",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L878-L883 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/tools/Model.java | Model.setSize | public void setSize(final int X, final int Y, final int WIDTH, final int HEIGHT) {
bounds.setBounds(X, Y, WIDTH, HEIGHT);
fireStateChanged();
} | java | public void setSize(final int X, final int Y, final int WIDTH, final int HEIGHT) {
bounds.setBounds(X, Y, WIDTH, HEIGHT);
fireStateChanged();
} | [
"public",
"void",
"setSize",
"(",
"final",
"int",
"X",
",",
"final",
"int",
"Y",
",",
"final",
"int",
"WIDTH",
",",
"final",
"int",
"HEIGHT",
")",
"{",
"bounds",
".",
"setBounds",
"(",
"X",
",",
"Y",
",",
"WIDTH",
",",
"HEIGHT",
")",
";",
"fireStat... | Sets the width and height of the gauge
@param X
@param Y
@param WIDTH
@param HEIGHT | [
"Sets",
"the",
"width",
"and",
"height",
"of",
"the",
"gauge"
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/tools/Model.java#L337-L340 |
jklingsporn/vertx-jooq | vertx-jooq-generate/src/main/java/io/github/jklingsporn/vertx/jooq/generate/VertxGenerator.java | VertxGenerator.handleCustomTypeToJson | protected boolean handleCustomTypeToJson(TypedElementDefinition<?> column, String getter, String columnType, String javaMemberName, JavaWriter out) {
return false;
} | java | protected boolean handleCustomTypeToJson(TypedElementDefinition<?> column, String getter, String columnType, String javaMemberName, JavaWriter out) {
return false;
} | [
"protected",
"boolean",
"handleCustomTypeToJson",
"(",
"TypedElementDefinition",
"<",
"?",
">",
"column",
",",
"String",
"getter",
",",
"String",
"columnType",
",",
"String",
"javaMemberName",
",",
"JavaWriter",
"out",
")",
"{",
"return",
"false",
";",
"}"
] | Overwrite this method to handle your custom type. This is needed especially when you have custom converters.
@param column the column definition
@param getter the getter name
@param columnType the type of the column
@param javaMemberName the java member name
@param out the JavaWriter
@return <code>true</code> if the column was handled.
@see #generateToJson(TableDefinition, JavaWriter, org.jooq.codegen.GeneratorStrategy.Mode) | [
"Overwrite",
"this",
"method",
"to",
"handle",
"your",
"custom",
"type",
".",
"This",
"is",
"needed",
"especially",
"when",
"you",
"have",
"custom",
"converters",
"."
] | train | https://github.com/jklingsporn/vertx-jooq/blob/0db00b5e040639c309691dfbc125034fa3346d88/vertx-jooq-generate/src/main/java/io/github/jklingsporn/vertx/jooq/generate/VertxGenerator.java#L72-L74 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/TransactionImpl.java | TransactionImpl.lockAndRegisterReferences | private void lockAndRegisterReferences(ClassDescriptor cld, Object sourceObject, int lockMode, List registeredObjects) throws LockNotGrantedException
{
if (implicitLocking)
{
Iterator i = cld.getObjectReferenceDescriptors(true).iterator();
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
Object refObj = rds.getPersistentField().get(sourceObject);
if (refObj != null)
{
boolean isProxy = ProxyHelper.isProxy(refObj);
RuntimeObject rt = isProxy ? new RuntimeObject(refObj, this, false) : new RuntimeObject(refObj, this);
if (!registrationList.contains(rt.getIdentity()))
{
lockAndRegister(rt, lockMode, registeredObjects);
}
}
}
}
} | java | private void lockAndRegisterReferences(ClassDescriptor cld, Object sourceObject, int lockMode, List registeredObjects) throws LockNotGrantedException
{
if (implicitLocking)
{
Iterator i = cld.getObjectReferenceDescriptors(true).iterator();
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
Object refObj = rds.getPersistentField().get(sourceObject);
if (refObj != null)
{
boolean isProxy = ProxyHelper.isProxy(refObj);
RuntimeObject rt = isProxy ? new RuntimeObject(refObj, this, false) : new RuntimeObject(refObj, this);
if (!registrationList.contains(rt.getIdentity()))
{
lockAndRegister(rt, lockMode, registeredObjects);
}
}
}
}
} | [
"private",
"void",
"lockAndRegisterReferences",
"(",
"ClassDescriptor",
"cld",
",",
"Object",
"sourceObject",
",",
"int",
"lockMode",
",",
"List",
"registeredObjects",
")",
"throws",
"LockNotGrantedException",
"{",
"if",
"(",
"implicitLocking",
")",
"{",
"Iterator",
... | we only use the registrationList map if the object is not a proxy. During the
reference locking, we will materialize objects and they will enter the registered for
lock map. | [
"we",
"only",
"use",
"the",
"registrationList",
"map",
"if",
"the",
"object",
"is",
"not",
"a",
"proxy",
".",
"During",
"the",
"reference",
"locking",
"we",
"will",
"materialize",
"objects",
"and",
"they",
"will",
"enter",
"the",
"registered",
"for",
"lock",... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/TransactionImpl.java#L983-L1003 |
beangle/beangle3 | commons/web/src/main/java/org/beangle/commons/web/util/CookieUtils.java | CookieUtils.getCookieValue | public static String getCookieValue(HttpServletRequest request, String cookieName) {
try {
Cookie cookie = getCookie(request, cookieName);
if (null == cookie) {
return null;
} else {
return URLDecoder.decode(cookie.getValue(), "utf-8");
}
} catch (Exception e) {
return null;
}
} | java | public static String getCookieValue(HttpServletRequest request, String cookieName) {
try {
Cookie cookie = getCookie(request, cookieName);
if (null == cookie) {
return null;
} else {
return URLDecoder.decode(cookie.getValue(), "utf-8");
}
} catch (Exception e) {
return null;
}
} | [
"public",
"static",
"String",
"getCookieValue",
"(",
"HttpServletRequest",
"request",
",",
"String",
"cookieName",
")",
"{",
"try",
"{",
"Cookie",
"cookie",
"=",
"getCookie",
"(",
"request",
",",
"cookieName",
")",
";",
"if",
"(",
"null",
"==",
"cookie",
")"... | 获取cookie中的value<br>
自动负责解码<br>
@param request
@param cookieName
@return null when cannot find the cookie | [
"获取cookie中的value<br",
">",
"自动负责解码<br",
">"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/web/src/main/java/org/beangle/commons/web/util/CookieUtils.java#L61-L72 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.affineSpan | public Matrix4d affineSpan(Vector3d corner, Vector3d xDir, Vector3d yDir, Vector3d zDir) {
double a = m10 * m22, b = m10 * m21, c = m10 * m02, d = m10 * m01;
double e = m11 * m22, f = m11 * m20, g = m11 * m02, h = m11 * m00;
double i = m12 * m21, j = m12 * m20, k = m12 * m01, l = m12 * m00;
double m = m20 * m02, n = m20 * m01, o = m21 * m02, p = m21 * m00;
double q = m22 * m01, r = m22 * m00;
double s = 1.0 / (m00 * m11 - m01 * m10) * m22 + (m02 * m10 - m00 * m12) * m21 + (m01 * m12 - m02 * m11) * m20;
double nm00 = (e - i) * s, nm01 = (o - q) * s, nm02 = (k - g) * s;
double nm10 = (j - a) * s, nm11 = (r - m) * s, nm12 = (c - l) * s;
double nm20 = (b - f) * s, nm21 = (n - p) * s, nm22 = (h - d) * s;
corner.x = -nm00 - nm10 - nm20 + (a * m31 - b * m32 + f * m32 - e * m30 + i * m30 - j * m31) * s;
corner.y = -nm01 - nm11 - nm21 + (m * m31 - n * m32 + p * m32 - o * m30 + q * m30 - r * m31) * s;
corner.z = -nm02 - nm12 - nm22 + (g * m30 - k * m30 + l * m31 - c * m31 + d * m32 - h * m32) * s;
xDir.x = 2.0 * nm00; xDir.y = 2.0 * nm01; xDir.z = 2.0 * nm02;
yDir.x = 2.0 * nm10; yDir.y = 2.0 * nm11; yDir.z = 2.0 * nm12;
zDir.x = 2.0 * nm20; zDir.y = 2.0 * nm21; zDir.z = 2.0 * nm22;
return this;
} | java | public Matrix4d affineSpan(Vector3d corner, Vector3d xDir, Vector3d yDir, Vector3d zDir) {
double a = m10 * m22, b = m10 * m21, c = m10 * m02, d = m10 * m01;
double e = m11 * m22, f = m11 * m20, g = m11 * m02, h = m11 * m00;
double i = m12 * m21, j = m12 * m20, k = m12 * m01, l = m12 * m00;
double m = m20 * m02, n = m20 * m01, o = m21 * m02, p = m21 * m00;
double q = m22 * m01, r = m22 * m00;
double s = 1.0 / (m00 * m11 - m01 * m10) * m22 + (m02 * m10 - m00 * m12) * m21 + (m01 * m12 - m02 * m11) * m20;
double nm00 = (e - i) * s, nm01 = (o - q) * s, nm02 = (k - g) * s;
double nm10 = (j - a) * s, nm11 = (r - m) * s, nm12 = (c - l) * s;
double nm20 = (b - f) * s, nm21 = (n - p) * s, nm22 = (h - d) * s;
corner.x = -nm00 - nm10 - nm20 + (a * m31 - b * m32 + f * m32 - e * m30 + i * m30 - j * m31) * s;
corner.y = -nm01 - nm11 - nm21 + (m * m31 - n * m32 + p * m32 - o * m30 + q * m30 - r * m31) * s;
corner.z = -nm02 - nm12 - nm22 + (g * m30 - k * m30 + l * m31 - c * m31 + d * m32 - h * m32) * s;
xDir.x = 2.0 * nm00; xDir.y = 2.0 * nm01; xDir.z = 2.0 * nm02;
yDir.x = 2.0 * nm10; yDir.y = 2.0 * nm11; yDir.z = 2.0 * nm12;
zDir.x = 2.0 * nm20; zDir.y = 2.0 * nm21; zDir.z = 2.0 * nm22;
return this;
} | [
"public",
"Matrix4d",
"affineSpan",
"(",
"Vector3d",
"corner",
",",
"Vector3d",
"xDir",
",",
"Vector3d",
"yDir",
",",
"Vector3d",
"zDir",
")",
"{",
"double",
"a",
"=",
"m10",
"*",
"m22",
",",
"b",
"=",
"m10",
"*",
"m21",
",",
"c",
"=",
"m10",
"*",
... | Compute the extents of the coordinate system before this {@link #isAffine() affine} transformation was applied
and store the resulting corner coordinates in <code>corner</code> and the span vectors in
<code>xDir</code>, <code>yDir</code> and <code>zDir</code>.
<p>
That means, given the maximum extents of the coordinate system between <code>[-1..+1]</code> in all dimensions,
this method returns one corner and the length and direction of the three base axis vectors in the coordinate
system before this transformation is applied, which transforms into the corner coordinates <code>[-1, +1]</code>.
<p>
This method is equivalent to computing at least three adjacent corners using {@link #frustumCorner(int, Vector3d)}
and subtracting them to obtain the length and direction of the span vectors.
@param corner
will hold one corner of the span (usually the corner {@link Matrix4dc#CORNER_NXNYNZ})
@param xDir
will hold the direction and length of the span along the positive X axis
@param yDir
will hold the direction and length of the span along the positive Y axis
@param zDir
will hold the direction and length of the span along the positive z axis
@return this | [
"Compute",
"the",
"extents",
"of",
"the",
"coordinate",
"system",
"before",
"this",
"{",
"@link",
"#isAffine",
"()",
"affine",
"}",
"transformation",
"was",
"applied",
"and",
"store",
"the",
"resulting",
"corner",
"coordinates",
"in",
"<code",
">",
"corner<",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L15502-L15519 |
paypal/SeLion | server/src/main/java/com/paypal/selion/grid/servlets/GridStatistics.java | GridStatistics.process | protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException {
String acceptHeader = request.getHeader("Accept");
if (acceptHeader != null && ((acceptHeader.contains("*/*")) || (acceptHeader.contains("application/json")))) {
ServletHelper.respondAsJsonWithHttpStatus(response, getGridLoadResponse(), HttpServletResponse.SC_OK);
} else {
response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE,
"The servlet can only respond to application/json or */* Accept headers");
}
} | java | protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException {
String acceptHeader = request.getHeader("Accept");
if (acceptHeader != null && ((acceptHeader.contains("*/*")) || (acceptHeader.contains("application/json")))) {
ServletHelper.respondAsJsonWithHttpStatus(response, getGridLoadResponse(), HttpServletResponse.SC_OK);
} else {
response.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE,
"The servlet can only respond to application/json or */* Accept headers");
}
} | [
"protected",
"void",
"process",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"String",
"acceptHeader",
"=",
"request",
".",
"getHeader",
"(",
"\"Accept\"",
")",
";",
"if",
"(",
"acceptHeader",
"!=... | This method gets a list of {@link BrowserStatistics} and returns over HTTP as a json document
@param request
{@link HttpServletRequest} that represents the servlet request
@param response
{@link HttpServletResponse} that represents the servlet response
@throws IOException | [
"This",
"method",
"gets",
"a",
"list",
"of",
"{",
"@link",
"BrowserStatistics",
"}",
"and",
"returns",
"over",
"HTTP",
"as",
"a",
"json",
"document"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/grid/servlets/GridStatistics.java#L112-L120 |
openbase/jul | extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/LabelProcessor.java | LabelProcessor.addLabel | public static Label.Builder addLabel(final Label.Builder labelBuilder, final Locale locale, final String label) {
return addLabel(labelBuilder, locale.getLanguage(), label);
} | java | public static Label.Builder addLabel(final Label.Builder labelBuilder, final Locale locale, final String label) {
return addLabel(labelBuilder, locale.getLanguage(), label);
} | [
"public",
"static",
"Label",
".",
"Builder",
"addLabel",
"(",
"final",
"Label",
".",
"Builder",
"labelBuilder",
",",
"final",
"Locale",
"locale",
",",
"final",
"String",
"label",
")",
"{",
"return",
"addLabel",
"(",
"labelBuilder",
",",
"locale",
".",
"getLa... | Add a label to a labelBuilder by locale. This is equivalent to calling
{@link #addLabel(Builder, String, String)} but the language code is extracted from the locale
by calling {@link Locale#getLanguage()}.
@param labelBuilder the label builder to be updated
@param locale the locale from which the language code is extracted for which the label is added
@param label the label to be added
@return the updated label builder | [
"Add",
"a",
"label",
"to",
"a",
"labelBuilder",
"by",
"locale",
".",
"This",
"is",
"equivalent",
"to",
"calling",
"{",
"@link",
"#addLabel",
"(",
"Builder",
"String",
"String",
")",
"}",
"but",
"the",
"language",
"code",
"is",
"extracted",
"from",
"the",
... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/LabelProcessor.java#L146-L148 |
teatrove/teatrove | trove/src/main/java/org/teatrove/trove/classfile/Modifiers.java | Modifiers.setInterface | public static int setInterface(int modifier, boolean b) {
if (b) {
return (modifier | (INTERFACE | ABSTRACT)) &
(~FINAL & ~SYNCHRONIZED & ~VOLATILE & ~TRANSIENT & ~NATIVE);
}
else {
return modifier & ~INTERFACE;
}
} | java | public static int setInterface(int modifier, boolean b) {
if (b) {
return (modifier | (INTERFACE | ABSTRACT)) &
(~FINAL & ~SYNCHRONIZED & ~VOLATILE & ~TRANSIENT & ~NATIVE);
}
else {
return modifier & ~INTERFACE;
}
} | [
"public",
"static",
"int",
"setInterface",
"(",
"int",
"modifier",
",",
"boolean",
"b",
")",
"{",
"if",
"(",
"b",
")",
"{",
"return",
"(",
"modifier",
"|",
"(",
"INTERFACE",
"|",
"ABSTRACT",
")",
")",
"&",
"(",
"~",
"FINAL",
"&",
"~",
"SYNCHRONIZED",... | When set as an interface, non-interface settings are cleared and the
modifier is set abstract. | [
"When",
"set",
"as",
"an",
"interface",
"non",
"-",
"interface",
"settings",
"are",
"cleared",
"and",
"the",
"modifier",
"is",
"set",
"abstract",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/Modifiers.java#L147-L155 |
groupon/odo | client/src/main/java/com/groupon/odo/client/PathValueClient.java | PathValueClient.setDefaultCustomResponse | public static boolean setDefaultCustomResponse(String pathValue, String requestType, String customData) {
try {
JSONObject profile = getDefaultProfile();
String profileName = profile.getString("name");
PathValueClient client = new PathValueClient(profileName, false);
return client.setCustomResponse(pathValue, requestType, customData);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | java | public static boolean setDefaultCustomResponse(String pathValue, String requestType, String customData) {
try {
JSONObject profile = getDefaultProfile();
String profileName = profile.getString("name");
PathValueClient client = new PathValueClient(profileName, false);
return client.setCustomResponse(pathValue, requestType, customData);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | [
"public",
"static",
"boolean",
"setDefaultCustomResponse",
"(",
"String",
"pathValue",
",",
"String",
"requestType",
",",
"String",
"customData",
")",
"{",
"try",
"{",
"JSONObject",
"profile",
"=",
"getDefaultProfile",
"(",
")",
";",
"String",
"profileName",
"=",
... | Sets a custom response on an endpoint using default profile and client
@param pathValue path (endpoint) value
@param requestType path request type. "GET", "POST", etc
@param customData custom response data
@return true if success, false otherwise | [
"Sets",
"a",
"custom",
"response",
"on",
"an",
"endpoint",
"using",
"default",
"profile",
"and",
"client"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/PathValueClient.java#L65-L75 |
bignerdranch/expandable-recycler-view | expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java | ExpandableRecyclerAdapter.notifyParentRangeInserted | @UiThread
public void notifyParentRangeInserted(int parentPositionStart, int itemCount) {
int initialFlatParentPosition;
if (parentPositionStart < mParentList.size() - itemCount) {
initialFlatParentPosition = getFlatParentPosition(parentPositionStart);
} else {
initialFlatParentPosition = mFlatItemList.size();
}
int sizeChanged = 0;
int flatParentPosition = initialFlatParentPosition;
int changed;
int parentPositionEnd = parentPositionStart + itemCount;
for (int i = parentPositionStart; i < parentPositionEnd; i++) {
P parent = mParentList.get(i);
changed = addParentWrapper(flatParentPosition, parent);
flatParentPosition += changed;
sizeChanged += changed;
}
notifyItemRangeInserted(initialFlatParentPosition, sizeChanged);
} | java | @UiThread
public void notifyParentRangeInserted(int parentPositionStart, int itemCount) {
int initialFlatParentPosition;
if (parentPositionStart < mParentList.size() - itemCount) {
initialFlatParentPosition = getFlatParentPosition(parentPositionStart);
} else {
initialFlatParentPosition = mFlatItemList.size();
}
int sizeChanged = 0;
int flatParentPosition = initialFlatParentPosition;
int changed;
int parentPositionEnd = parentPositionStart + itemCount;
for (int i = parentPositionStart; i < parentPositionEnd; i++) {
P parent = mParentList.get(i);
changed = addParentWrapper(flatParentPosition, parent);
flatParentPosition += changed;
sizeChanged += changed;
}
notifyItemRangeInserted(initialFlatParentPosition, sizeChanged);
} | [
"@",
"UiThread",
"public",
"void",
"notifyParentRangeInserted",
"(",
"int",
"parentPositionStart",
",",
"int",
"itemCount",
")",
"{",
"int",
"initialFlatParentPosition",
";",
"if",
"(",
"parentPositionStart",
"<",
"mParentList",
".",
"size",
"(",
")",
"-",
"itemCo... | Notify any registered observers that the currently reflected {@code itemCount}
parents starting at {@code parentPositionStart} have been newly inserted.
The parents previously located at {@code parentPositionStart} and beyond
can now be found starting at position {@code parentPositionStart + itemCount}.
<p>
This is a structural change event. Representations of other existing items in the
data set are still considered up to date and will not be rebound, though their positions
may be altered.
@param parentPositionStart Position of the first parent that was inserted, relative
to the list of parents only.
@param itemCount Number of items inserted
@see #notifyParentInserted(int) | [
"Notify",
"any",
"registered",
"observers",
"that",
"the",
"currently",
"reflected",
"{",
"@code",
"itemCount",
"}",
"parents",
"starting",
"at",
"{",
"@code",
"parentPositionStart",
"}",
"have",
"been",
"newly",
"inserted",
".",
"The",
"parents",
"previously",
... | train | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L883-L904 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java | RelationalJMapper.addClasses | private void addClasses(Class<?>[] classes, HashSet<Class<?>> result, String fieldName){
if(classes == null || classes.length==0)
Error.classesAbsent(fieldName, configuredClass);
for (Class<?> classe : classes) result.add(classe);
} | java | private void addClasses(Class<?>[] classes, HashSet<Class<?>> result, String fieldName){
if(classes == null || classes.length==0)
Error.classesAbsent(fieldName, configuredClass);
for (Class<?> classe : classes) result.add(classe);
} | [
"private",
"void",
"addClasses",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
",",
"HashSet",
"<",
"Class",
"<",
"?",
">",
">",
"result",
",",
"String",
"fieldName",
")",
"{",
"if",
"(",
"classes",
"==",
"null",
"||",
"classes",
".",
"length",
... | Adds to the result parameter all classes that aren't present in it
@param classes classes to control
@param result List to enrich
@param fieldName name of file, only for control purpose | [
"Adds",
"to",
"the",
"result",
"parameter",
"all",
"classes",
"that",
"aren",
"t",
"present",
"in",
"it"
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L278-L284 |
janus-project/guava.janusproject.io | guava/src/com/google/common/collect/ImmutableMultiset.java | ImmutableMultiset.of | @SuppressWarnings("unchecked") //
public static <E> ImmutableMultiset<E> of(E e1, E e2) {
return copyOfInternal(e1, e2);
} | java | @SuppressWarnings("unchecked") //
public static <E> ImmutableMultiset<E> of(E e1, E e2) {
return copyOfInternal(e1, e2);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"//",
"public",
"static",
"<",
"E",
">",
"ImmutableMultiset",
"<",
"E",
">",
"of",
"(",
"E",
"e1",
",",
"E",
"e2",
")",
"{",
"return",
"copyOfInternal",
"(",
"e1",
",",
"e2",
")",
";",
"}"
] | Returns an immutable multiset containing the given elements, in order.
@throws NullPointerException if any element is null
@since 6.0 (source-compatible since 2.0) | [
"Returns",
"an",
"immutable",
"multiset",
"containing",
"the",
"given",
"elements",
"in",
"order",
"."
] | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/ImmutableMultiset.java#L83-L86 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.