repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/converter/avro/AvroToAvroCopyableConverter.java | AvroToAvroCopyableConverter.convertSchema | @Override
public CopyableSchema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
"""
Returns a {@link org.apache.gobblin.fork.CopyableSchema} wrapper around the given {@link Schema}.
{@inheritDoc}
@see org.apache.gobblin.converter.Converter#convertSchema(java.lang.Object, org.apache.gobblin.configuration.WorkUnitState)
"""
return new CopyableSchema(inputSchema);
} | java | @Override
public CopyableSchema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
return new CopyableSchema(inputSchema);
} | [
"@",
"Override",
"public",
"CopyableSchema",
"convertSchema",
"(",
"Schema",
"inputSchema",
",",
"WorkUnitState",
"workUnit",
")",
"throws",
"SchemaConversionException",
"{",
"return",
"new",
"CopyableSchema",
"(",
"inputSchema",
")",
";",
"}"
]
| Returns a {@link org.apache.gobblin.fork.CopyableSchema} wrapper around the given {@link Schema}.
{@inheritDoc}
@see org.apache.gobblin.converter.Converter#convertSchema(java.lang.Object, org.apache.gobblin.configuration.WorkUnitState) | [
"Returns",
"a",
"{"
]
| train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/avro/AvroToAvroCopyableConverter.java#L44-L47 |
fabric8io/fabric8-forge | addons/camel-tooling-util/src/main/java/io/fabric8/camel/tooling/util/RouteXml.java | RouteXml.marshal | public void marshal(File file, final List<RouteDefinition> routeDefinitionList) throws Exception {
"""
Loads the given file then updates the route definitions from the given list then stores the file again
"""
marshal(file, new Model2Model() {
@Override
public XmlModel transform(XmlModel model) {
copyRoutesToElement(routeDefinitionList, model.getContextElement());
return model;
}
});
} | java | public void marshal(File file, final List<RouteDefinition> routeDefinitionList) throws Exception {
marshal(file, new Model2Model() {
@Override
public XmlModel transform(XmlModel model) {
copyRoutesToElement(routeDefinitionList, model.getContextElement());
return model;
}
});
} | [
"public",
"void",
"marshal",
"(",
"File",
"file",
",",
"final",
"List",
"<",
"RouteDefinition",
">",
"routeDefinitionList",
")",
"throws",
"Exception",
"{",
"marshal",
"(",
"file",
",",
"new",
"Model2Model",
"(",
")",
"{",
"@",
"Override",
"public",
"XmlModel",
"transform",
"(",
"XmlModel",
"model",
")",
"{",
"copyRoutesToElement",
"(",
"routeDefinitionList",
",",
"model",
".",
"getContextElement",
"(",
")",
")",
";",
"return",
"model",
";",
"}",
"}",
")",
";",
"}"
]
| Loads the given file then updates the route definitions from the given list then stores the file again | [
"Loads",
"the",
"given",
"file",
"then",
"updates",
"the",
"route",
"definitions",
"from",
"the",
"given",
"list",
"then",
"stores",
"the",
"file",
"again"
]
| train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel-tooling-util/src/main/java/io/fabric8/camel/tooling/util/RouteXml.java#L318-L326 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java | ExifGpsWriter.createNewExifNode | private IIOMetadataNode createNewExifNode( IIOMetadata tiffMetadata, IIOMetadata thumbMeta, BufferedImage thumbnail ) {
"""
Private method - creates a copy of the metadata that can be written to
@param tiffMetadata - in metadata
@return new metadata node that can be written to
"""
IIOMetadataNode app1Node = null;
ImageWriter tiffWriter = null;
try {
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("tiff");
while( writers.hasNext() ) {
tiffWriter = writers.next();
if (tiffWriter.getClass().getName().startsWith("com.sun.media")) {
// Break on finding the core provider.
break;
}
}
if (tiffWriter == null) {
System.out.println("Cannot find core TIFF writer!");
System.exit(0);
}
ImageWriteParam writeParam = tiffWriter.getDefaultWriteParam();
writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
writeParam.setCompressionType("EXIF JPEG");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MemoryCacheImageOutputStream app1EXIFOutput = new MemoryCacheImageOutputStream(baos);
tiffWriter.setOutput(app1EXIFOutput);
// escribir
tiffWriter.prepareWriteEmpty(jpegReader.getStreamMetadata(), new ImageTypeSpecifier(image), image.getWidth(),
image.getHeight(), tiffMetadata, null, writeParam);
tiffWriter.endWriteEmpty();
// Flush data into byte stream.
app1EXIFOutput.flush();
// Create APP1 parameter array.
byte[] app1Parameters = new byte[6 + baos.size()];
// Add EXIF APP1 ID bytes.
app1Parameters[0] = (byte) 'E';
app1Parameters[1] = (byte) 'x';
app1Parameters[2] = (byte) 'i';
app1Parameters[3] = (byte) 'f';
app1Parameters[4] = app1Parameters[5] = (byte) 0;
// Append TIFF stream to APP1 parameters.
System.arraycopy(baos.toByteArray(), 0, app1Parameters, 6, baos.size());
// Create the APP1 EXIF node to be added to native JPEG image metadata.
app1Node = new IIOMetadataNode("unknown");
app1Node.setAttribute("MarkerTag", (new Integer(0xE1)).toString());
app1Node.setUserObject(app1Parameters);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (tiffWriter != null)
tiffWriter.dispose();
}
return app1Node;
} | java | private IIOMetadataNode createNewExifNode( IIOMetadata tiffMetadata, IIOMetadata thumbMeta, BufferedImage thumbnail ) {
IIOMetadataNode app1Node = null;
ImageWriter tiffWriter = null;
try {
Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("tiff");
while( writers.hasNext() ) {
tiffWriter = writers.next();
if (tiffWriter.getClass().getName().startsWith("com.sun.media")) {
// Break on finding the core provider.
break;
}
}
if (tiffWriter == null) {
System.out.println("Cannot find core TIFF writer!");
System.exit(0);
}
ImageWriteParam writeParam = tiffWriter.getDefaultWriteParam();
writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
writeParam.setCompressionType("EXIF JPEG");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MemoryCacheImageOutputStream app1EXIFOutput = new MemoryCacheImageOutputStream(baos);
tiffWriter.setOutput(app1EXIFOutput);
// escribir
tiffWriter.prepareWriteEmpty(jpegReader.getStreamMetadata(), new ImageTypeSpecifier(image), image.getWidth(),
image.getHeight(), tiffMetadata, null, writeParam);
tiffWriter.endWriteEmpty();
// Flush data into byte stream.
app1EXIFOutput.flush();
// Create APP1 parameter array.
byte[] app1Parameters = new byte[6 + baos.size()];
// Add EXIF APP1 ID bytes.
app1Parameters[0] = (byte) 'E';
app1Parameters[1] = (byte) 'x';
app1Parameters[2] = (byte) 'i';
app1Parameters[3] = (byte) 'f';
app1Parameters[4] = app1Parameters[5] = (byte) 0;
// Append TIFF stream to APP1 parameters.
System.arraycopy(baos.toByteArray(), 0, app1Parameters, 6, baos.size());
// Create the APP1 EXIF node to be added to native JPEG image metadata.
app1Node = new IIOMetadataNode("unknown");
app1Node.setAttribute("MarkerTag", (new Integer(0xE1)).toString());
app1Node.setUserObject(app1Parameters);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (tiffWriter != null)
tiffWriter.dispose();
}
return app1Node;
} | [
"private",
"IIOMetadataNode",
"createNewExifNode",
"(",
"IIOMetadata",
"tiffMetadata",
",",
"IIOMetadata",
"thumbMeta",
",",
"BufferedImage",
"thumbnail",
")",
"{",
"IIOMetadataNode",
"app1Node",
"=",
"null",
";",
"ImageWriter",
"tiffWriter",
"=",
"null",
";",
"try",
"{",
"Iterator",
"<",
"ImageWriter",
">",
"writers",
"=",
"ImageIO",
".",
"getImageWritersByFormatName",
"(",
"\"tiff\"",
")",
";",
"while",
"(",
"writers",
".",
"hasNext",
"(",
")",
")",
"{",
"tiffWriter",
"=",
"writers",
".",
"next",
"(",
")",
";",
"if",
"(",
"tiffWriter",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"com.sun.media\"",
")",
")",
"{",
"// Break on finding the core provider.",
"break",
";",
"}",
"}",
"if",
"(",
"tiffWriter",
"==",
"null",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Cannot find core TIFF writer!\"",
")",
";",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"ImageWriteParam",
"writeParam",
"=",
"tiffWriter",
".",
"getDefaultWriteParam",
"(",
")",
";",
"writeParam",
".",
"setCompressionMode",
"(",
"ImageWriteParam",
".",
"MODE_EXPLICIT",
")",
";",
"writeParam",
".",
"setCompressionType",
"(",
"\"EXIF JPEG\"",
")",
";",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"MemoryCacheImageOutputStream",
"app1EXIFOutput",
"=",
"new",
"MemoryCacheImageOutputStream",
"(",
"baos",
")",
";",
"tiffWriter",
".",
"setOutput",
"(",
"app1EXIFOutput",
")",
";",
"// escribir",
"tiffWriter",
".",
"prepareWriteEmpty",
"(",
"jpegReader",
".",
"getStreamMetadata",
"(",
")",
",",
"new",
"ImageTypeSpecifier",
"(",
"image",
")",
",",
"image",
".",
"getWidth",
"(",
")",
",",
"image",
".",
"getHeight",
"(",
")",
",",
"tiffMetadata",
",",
"null",
",",
"writeParam",
")",
";",
"tiffWriter",
".",
"endWriteEmpty",
"(",
")",
";",
"// Flush data into byte stream.",
"app1EXIFOutput",
".",
"flush",
"(",
")",
";",
"// Create APP1 parameter array.",
"byte",
"[",
"]",
"app1Parameters",
"=",
"new",
"byte",
"[",
"6",
"+",
"baos",
".",
"size",
"(",
")",
"]",
";",
"// Add EXIF APP1 ID bytes.",
"app1Parameters",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"'",
"'",
";",
"app1Parameters",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"'",
"'",
";",
"app1Parameters",
"[",
"2",
"]",
"=",
"(",
"byte",
")",
"'",
"'",
";",
"app1Parameters",
"[",
"3",
"]",
"=",
"(",
"byte",
")",
"'",
"'",
";",
"app1Parameters",
"[",
"4",
"]",
"=",
"app1Parameters",
"[",
"5",
"]",
"=",
"(",
"byte",
")",
"0",
";",
"// Append TIFF stream to APP1 parameters.",
"System",
".",
"arraycopy",
"(",
"baos",
".",
"toByteArray",
"(",
")",
",",
"0",
",",
"app1Parameters",
",",
"6",
",",
"baos",
".",
"size",
"(",
")",
")",
";",
"// Create the APP1 EXIF node to be added to native JPEG image metadata.",
"app1Node",
"=",
"new",
"IIOMetadataNode",
"(",
"\"unknown\"",
")",
";",
"app1Node",
".",
"setAttribute",
"(",
"\"MarkerTag\"",
",",
"(",
"new",
"Integer",
"(",
"0xE1",
")",
")",
".",
"toString",
"(",
")",
")",
";",
"app1Node",
".",
"setUserObject",
"(",
"app1Parameters",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"tiffWriter",
"!=",
"null",
")",
"tiffWriter",
".",
"dispose",
"(",
")",
";",
"}",
"return",
"app1Node",
";",
"}"
]
| Private method - creates a copy of the metadata that can be written to
@param tiffMetadata - in metadata
@return new metadata node that can be written to | [
"Private",
"method",
"-",
"creates",
"a",
"copy",
"of",
"the",
"metadata",
"that",
"can",
"be",
"written",
"to"
]
| train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/exif/ExifGpsWriter.java#L288-L349 |
dashorst/wicket-stuff-markup-validator | whattf/src/main/java/org/whattf/datatype/AbstractDatatype.java | AbstractDatatype.sameValue | public final boolean sameValue(Object value1, Object value2) {
"""
Implements strict string equality semantics by performing a standard
<code>equals</code> check on the arguments.
@param value1 an object returned by <code>createValue</code>
@param value2 another object returned by <code>createValue</code>
@return <code>true</code> if the values are equal, <code>false</code> otherwise
@see org.relaxng.datatype.Datatype#sameValue(java.lang.Object, java.lang.Object)
"""
if (value1 == null) {
return (value2 == null);
}
return value1.equals(value2);
} | java | public final boolean sameValue(Object value1, Object value2) {
if (value1 == null) {
return (value2 == null);
}
return value1.equals(value2);
} | [
"public",
"final",
"boolean",
"sameValue",
"(",
"Object",
"value1",
",",
"Object",
"value2",
")",
"{",
"if",
"(",
"value1",
"==",
"null",
")",
"{",
"return",
"(",
"value2",
"==",
"null",
")",
";",
"}",
"return",
"value1",
".",
"equals",
"(",
"value2",
")",
";",
"}"
]
| Implements strict string equality semantics by performing a standard
<code>equals</code> check on the arguments.
@param value1 an object returned by <code>createValue</code>
@param value2 another object returned by <code>createValue</code>
@return <code>true</code> if the values are equal, <code>false</code> otherwise
@see org.relaxng.datatype.Datatype#sameValue(java.lang.Object, java.lang.Object) | [
"Implements",
"strict",
"string",
"equality",
"semantics",
"by",
"performing",
"a",
"standard",
"<code",
">",
"equals<",
"/",
"code",
">",
"check",
"on",
"the",
"arguments",
"."
]
| train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/whattf/src/main/java/org/whattf/datatype/AbstractDatatype.java#L111-L116 |
b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.getNumber | public Number getNumber(int index) throws JSONException {
"""
Get the Number value associated with a key.
@param index
The index must be between 0 and length() - 1.
@return The numeric value.
@throws JSONException
if the key is not found or if the value is not a Number
object and cannot be converted to a number.
"""
Object object = this.get(index);
try {
if (object instanceof Number) {
return (Number)object;
}
return JSONObject.stringToNumber(object.toString());
} catch (Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.", e);
}
} | java | public Number getNumber(int index) throws JSONException {
Object object = this.get(index);
try {
if (object instanceof Number) {
return (Number)object;
}
return JSONObject.stringToNumber(object.toString());
} catch (Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.", e);
}
} | [
"public",
"Number",
"getNumber",
"(",
"int",
"index",
")",
"throws",
"JSONException",
"{",
"Object",
"object",
"=",
"this",
".",
"get",
"(",
"index",
")",
";",
"try",
"{",
"if",
"(",
"object",
"instanceof",
"Number",
")",
"{",
"return",
"(",
"Number",
")",
"object",
";",
"}",
"return",
"JSONObject",
".",
"stringToNumber",
"(",
"object",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"JSONException",
"(",
"\"JSONArray[\"",
"+",
"index",
"+",
"\"] is not a number.\"",
",",
"e",
")",
";",
"}",
"}"
]
| Get the Number value associated with a key.
@param index
The index must be between 0 and length() - 1.
@return The numeric value.
@throws JSONException
if the key is not found or if the value is not a Number
object and cannot be converted to a number. | [
"Get",
"the",
"Number",
"value",
"associated",
"with",
"a",
"key",
"."
]
| train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L293-L303 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchAsynchException | public void dispatchAsynchException(ProxyQueue proxyQueue, Exception exception) {
"""
Dispatches the exception to the relevant proxy queue.
@param proxyQueue
@param exception
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dispatchAsynchException",
new Object[] { proxyQueue, exception });
// Create a runnable with the data
AsynchExceptionThread thread = new AsynchExceptionThread(proxyQueue, exception);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dispatchAsynchException");
} | java | public void dispatchAsynchException(ProxyQueue proxyQueue, Exception exception)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dispatchAsynchException",
new Object[] { proxyQueue, exception });
// Create a runnable with the data
AsynchExceptionThread thread = new AsynchExceptionThread(proxyQueue, exception);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dispatchAsynchException");
} | [
"public",
"void",
"dispatchAsynchException",
"(",
"ProxyQueue",
"proxyQueue",
",",
"Exception",
"exception",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"dispatchAsynchException\"",
",",
"new",
"Object",
"[",
"]",
"{",
"proxyQueue",
",",
"exception",
"}",
")",
";",
"// Create a runnable with the data",
"AsynchExceptionThread",
"thread",
"=",
"new",
"AsynchExceptionThread",
"(",
"proxyQueue",
",",
"exception",
")",
";",
"dispatchThread",
"(",
"thread",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"dispatchAsynchException\"",
")",
";",
"}"
]
| Dispatches the exception to the relevant proxy queue.
@param proxyQueue
@param exception | [
"Dispatches",
"the",
"exception",
"to",
"the",
"relevant",
"proxy",
"queue",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L132-L142 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMBlob.java | CMBlob.buildCMFile | public static CMBlob buildCMFile( CMFolder folder, Element xmlEntry )
throws ParseException {
"""
Factory method that builds a CMBlob based on a XML "atom:entry" element
@param xmlEntry
"""
final String name = xmlEntry.getElementsByTagNameNS( "*", "title" ).item( 0 ).getTextContent();
final String id = xmlEntry.getElementsByTagNameNS( "*", "document" ).item( 0 ).getTextContent();
final String updateDate = xmlEntry.getElementsByTagNameNS( "*", "updated" ).item( 0 ).getTextContent();
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'" );
sdf.setLenient( false );
sdf.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
final Date updated = sdf.parse( updateDate );
final Element elementLink = ( Element ) xmlEntry.getElementsByTagNameNS( "*",
"link" ).item( 0 );
final long length = Long.parseLong( elementLink.getAttribute( "length" ) );
final String contentType = elementLink.getAttribute( "type" );
return new CMBlob( folder, id, name, length, updated, contentType );
} | java | public static CMBlob buildCMFile( CMFolder folder, Element xmlEntry )
throws ParseException
{
final String name = xmlEntry.getElementsByTagNameNS( "*", "title" ).item( 0 ).getTextContent();
final String id = xmlEntry.getElementsByTagNameNS( "*", "document" ).item( 0 ).getTextContent();
final String updateDate = xmlEntry.getElementsByTagNameNS( "*", "updated" ).item( 0 ).getTextContent();
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'" );
sdf.setLenient( false );
sdf.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
final Date updated = sdf.parse( updateDate );
final Element elementLink = ( Element ) xmlEntry.getElementsByTagNameNS( "*",
"link" ).item( 0 );
final long length = Long.parseLong( elementLink.getAttribute( "length" ) );
final String contentType = elementLink.getAttribute( "type" );
return new CMBlob( folder, id, name, length, updated, contentType );
} | [
"public",
"static",
"CMBlob",
"buildCMFile",
"(",
"CMFolder",
"folder",
",",
"Element",
"xmlEntry",
")",
"throws",
"ParseException",
"{",
"final",
"String",
"name",
"=",
"xmlEntry",
".",
"getElementsByTagNameNS",
"(",
"\"*\"",
",",
"\"title\"",
")",
".",
"item",
"(",
"0",
")",
".",
"getTextContent",
"(",
")",
";",
"final",
"String",
"id",
"=",
"xmlEntry",
".",
"getElementsByTagNameNS",
"(",
"\"*\"",
",",
"\"document\"",
")",
".",
"item",
"(",
"0",
")",
".",
"getTextContent",
"(",
")",
";",
"final",
"String",
"updateDate",
"=",
"xmlEntry",
".",
"getElementsByTagNameNS",
"(",
"\"*\"",
",",
"\"updated\"",
")",
".",
"item",
"(",
"0",
")",
".",
"getTextContent",
"(",
")",
";",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ss'Z'\"",
")",
";",
"sdf",
".",
"setLenient",
"(",
"false",
")",
";",
"sdf",
".",
"setTimeZone",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"GMT\"",
")",
")",
";",
"final",
"Date",
"updated",
"=",
"sdf",
".",
"parse",
"(",
"updateDate",
")",
";",
"final",
"Element",
"elementLink",
"=",
"(",
"Element",
")",
"xmlEntry",
".",
"getElementsByTagNameNS",
"(",
"\"*\"",
",",
"\"link\"",
")",
".",
"item",
"(",
"0",
")",
";",
"final",
"long",
"length",
"=",
"Long",
".",
"parseLong",
"(",
"elementLink",
".",
"getAttribute",
"(",
"\"length\"",
")",
")",
";",
"final",
"String",
"contentType",
"=",
"elementLink",
".",
"getAttribute",
"(",
"\"type\"",
")",
";",
"return",
"new",
"CMBlob",
"(",
"folder",
",",
"id",
",",
"name",
",",
"length",
",",
"updated",
",",
"contentType",
")",
";",
"}"
]
| Factory method that builds a CMBlob based on a XML "atom:entry" element
@param xmlEntry | [
"Factory",
"method",
"that",
"builds",
"a",
"CMBlob",
"based",
"on",
"a",
"XML",
"atom",
":",
"entry",
"element"
]
| train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMBlob.java#L80-L99 |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java | NamingHelper.getResourceName | public static String getResourceName(String resource, boolean singularize) {
"""
Attempts to infer the name of a resource from a resources's relative URL
@param resource
The Url representation of this object
@param singularize
indicates if the resource name should be singularized or not
@return A name representing this resource or null if one cannot be
inferred
"""
if (StringUtils.hasText(resource)) {
String resourceName = StringUtils.capitalize(resource);
if (singularize) {
resourceName = singularize(resourceName);
}
resourceName = StringUtils.capitalize(cleanNameForJava(resourceName));
return resourceName;
}
return null;
} | java | public static String getResourceName(String resource, boolean singularize) {
if (StringUtils.hasText(resource)) {
String resourceName = StringUtils.capitalize(resource);
if (singularize) {
resourceName = singularize(resourceName);
}
resourceName = StringUtils.capitalize(cleanNameForJava(resourceName));
return resourceName;
}
return null;
} | [
"public",
"static",
"String",
"getResourceName",
"(",
"String",
"resource",
",",
"boolean",
"singularize",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"resource",
")",
")",
"{",
"String",
"resourceName",
"=",
"StringUtils",
".",
"capitalize",
"(",
"resource",
")",
";",
"if",
"(",
"singularize",
")",
"{",
"resourceName",
"=",
"singularize",
"(",
"resourceName",
")",
";",
"}",
"resourceName",
"=",
"StringUtils",
".",
"capitalize",
"(",
"cleanNameForJava",
"(",
"resourceName",
")",
")",
";",
"return",
"resourceName",
";",
"}",
"return",
"null",
";",
"}"
]
| Attempts to infer the name of a resource from a resources's relative URL
@param resource
The Url representation of this object
@param singularize
indicates if the resource name should be singularized or not
@return A name representing this resource or null if one cannot be
inferred | [
"Attempts",
"to",
"infer",
"the",
"name",
"of",
"a",
"resource",
"from",
"a",
"resources",
"s",
"relative",
"URL"
]
| train | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L296-L307 |
apereo/cas | support/cas-server-support-git-service-registry/src/main/java/org/apereo/cas/git/GitRepositoryBuilder.java | GitRepositoryBuilder.credentialProvider | public GitRepositoryBuilder credentialProvider(final String username, final String password) {
"""
Credential provider for repositories that require access.
@param username the username
@param password the password
@return the git repository builder
"""
if (StringUtils.hasText(username)) {
this.credentialsProviders.add(new UsernamePasswordCredentialsProvider(username, password));
}
return this;
} | java | public GitRepositoryBuilder credentialProvider(final String username, final String password) {
if (StringUtils.hasText(username)) {
this.credentialsProviders.add(new UsernamePasswordCredentialsProvider(username, password));
}
return this;
} | [
"public",
"GitRepositoryBuilder",
"credentialProvider",
"(",
"final",
"String",
"username",
",",
"final",
"String",
"password",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"username",
")",
")",
"{",
"this",
".",
"credentialsProviders",
".",
"add",
"(",
"new",
"UsernamePasswordCredentialsProvider",
"(",
"username",
",",
"password",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
]
| Credential provider for repositories that require access.
@param username the username
@param password the password
@return the git repository builder | [
"Credential",
"provider",
"for",
"repositories",
"that",
"require",
"access",
"."
]
| train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-git-service-registry/src/main/java/org/apereo/cas/git/GitRepositoryBuilder.java#L75-L80 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/aromaticity/Aromaticity.java | Aromaticity.electronSum | static int electronSum(final int[] cycle, final int[] contributions, final int[] subset) {
"""
Count the number electrons in the {@code cycle}. The {@code
contributions} array indicates how many π-electrons each atom can
contribute. When the contribution of an atom is less than 0 the sum for
the cycle is always 0.
@param cycle closed walk (last and first vertex the same) of
vertices which form a cycle
@param contributions π-electron contribution from each atom
@return the total sum of π-electrons contributed by the {@code cycle}
"""
int sum = 0;
for (int i = 1; i < cycle.length; i++)
sum += contributions[subset[cycle[i]]];
return sum;
} | java | static int electronSum(final int[] cycle, final int[] contributions, final int[] subset) {
int sum = 0;
for (int i = 1; i < cycle.length; i++)
sum += contributions[subset[cycle[i]]];
return sum;
} | [
"static",
"int",
"electronSum",
"(",
"final",
"int",
"[",
"]",
"cycle",
",",
"final",
"int",
"[",
"]",
"contributions",
",",
"final",
"int",
"[",
"]",
"subset",
")",
"{",
"int",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"cycle",
".",
"length",
";",
"i",
"++",
")",
"sum",
"+=",
"contributions",
"[",
"subset",
"[",
"cycle",
"[",
"i",
"]",
"]",
"]",
";",
"return",
"sum",
";",
"}"
]
| Count the number electrons in the {@code cycle}. The {@code
contributions} array indicates how many π-electrons each atom can
contribute. When the contribution of an atom is less than 0 the sum for
the cycle is always 0.
@param cycle closed walk (last and first vertex the same) of
vertices which form a cycle
@param contributions π-electron contribution from each atom
@return the total sum of π-electrons contributed by the {@code cycle} | [
"Count",
"the",
"number",
"electrons",
"in",
"the",
"{",
"@code",
"cycle",
"}",
".",
"The",
"{",
"@code",
"contributions",
"}",
"array",
"indicates",
"how",
"many",
"π",
"-",
"electrons",
"each",
"atom",
"can",
"contribute",
".",
"When",
"the",
"contribution",
"of",
"an",
"atom",
"is",
"less",
"than",
"0",
"the",
"sum",
"for",
"the",
"cycle",
"is",
"always",
"0",
"."
]
| train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/aromaticity/Aromaticity.java#L284-L289 |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/pod/ServiceRefPod.java | ServiceRefPod.getLocalService | public ServiceRefAmp getLocalService() {
"""
Returns the active service for this pod and path's hash.
The hash of the path selects the pod's node. The active server is the
first server in the node's server list that is up.
"""
ServiceRefAmp serviceRefRoot = _podRoot.getLocalService();
//ServiceRefAmp serviceRefRoot = _podRoot.getClientService();
if (serviceRefRoot == null) {
return null;
}
ServiceRefActive serviceRefLocal = _serviceRefLocal;
if (serviceRefLocal != null) {
ServiceRefAmp serviceRef = serviceRefLocal.getService(serviceRefRoot);
if (serviceRef != null) {
return serviceRef;
}
}
ServiceRefAmp serviceRef = serviceRefRoot.onLookup(_path);
_serviceRefLocal = new ServiceRefActive(serviceRefRoot, serviceRef);
// serviceRef.start();
return serviceRef;
} | java | public ServiceRefAmp getLocalService()
{
ServiceRefAmp serviceRefRoot = _podRoot.getLocalService();
//ServiceRefAmp serviceRefRoot = _podRoot.getClientService();
if (serviceRefRoot == null) {
return null;
}
ServiceRefActive serviceRefLocal = _serviceRefLocal;
if (serviceRefLocal != null) {
ServiceRefAmp serviceRef = serviceRefLocal.getService(serviceRefRoot);
if (serviceRef != null) {
return serviceRef;
}
}
ServiceRefAmp serviceRef = serviceRefRoot.onLookup(_path);
_serviceRefLocal = new ServiceRefActive(serviceRefRoot, serviceRef);
// serviceRef.start();
return serviceRef;
} | [
"public",
"ServiceRefAmp",
"getLocalService",
"(",
")",
"{",
"ServiceRefAmp",
"serviceRefRoot",
"=",
"_podRoot",
".",
"getLocalService",
"(",
")",
";",
"//ServiceRefAmp serviceRefRoot = _podRoot.getClientService();",
"if",
"(",
"serviceRefRoot",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ServiceRefActive",
"serviceRefLocal",
"=",
"_serviceRefLocal",
";",
"if",
"(",
"serviceRefLocal",
"!=",
"null",
")",
"{",
"ServiceRefAmp",
"serviceRef",
"=",
"serviceRefLocal",
".",
"getService",
"(",
"serviceRefRoot",
")",
";",
"if",
"(",
"serviceRef",
"!=",
"null",
")",
"{",
"return",
"serviceRef",
";",
"}",
"}",
"ServiceRefAmp",
"serviceRef",
"=",
"serviceRefRoot",
".",
"onLookup",
"(",
"_path",
")",
";",
"_serviceRefLocal",
"=",
"new",
"ServiceRefActive",
"(",
"serviceRefRoot",
",",
"serviceRef",
")",
";",
"// serviceRef.start();",
"return",
"serviceRef",
";",
"}"
]
| Returns the active service for this pod and path's hash.
The hash of the path selects the pod's node. The active server is the
first server in the node's server list that is up. | [
"Returns",
"the",
"active",
"service",
"for",
"this",
"pod",
"and",
"path",
"s",
"hash",
"."
]
| train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/pod/ServiceRefPod.java#L239-L265 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/parser/properties/RtfProperty.java | RtfProperty.setProperty | private boolean setProperty(String propertyName, int propertyValueNew) {
"""
Set the value of the property identified by the parameter.
@param propertyName The property name to set
@param propertyValueNew The object to set the property value to
@return <code>true</code> for handled or <code>false</code> if <code>propertyName</code> is <code>null</code>
"""
if(propertyName == null) return false;
Object propertyValueOld = getProperty(propertyName);
if(propertyValueOld instanceof Integer) {
int valueOld = ((Integer)propertyValueOld).intValue();
if (valueOld==propertyValueNew) return true;
}
beforeChange(propertyName);
properties.put(propertyName, Integer.valueOf(propertyValueNew));
afterChange(propertyName);
setModified(propertyName, true);
return true;
} | java | private boolean setProperty(String propertyName, int propertyValueNew) {
if(propertyName == null) return false;
Object propertyValueOld = getProperty(propertyName);
if(propertyValueOld instanceof Integer) {
int valueOld = ((Integer)propertyValueOld).intValue();
if (valueOld==propertyValueNew) return true;
}
beforeChange(propertyName);
properties.put(propertyName, Integer.valueOf(propertyValueNew));
afterChange(propertyName);
setModified(propertyName, true);
return true;
} | [
"private",
"boolean",
"setProperty",
"(",
"String",
"propertyName",
",",
"int",
"propertyValueNew",
")",
"{",
"if",
"(",
"propertyName",
"==",
"null",
")",
"return",
"false",
";",
"Object",
"propertyValueOld",
"=",
"getProperty",
"(",
"propertyName",
")",
";",
"if",
"(",
"propertyValueOld",
"instanceof",
"Integer",
")",
"{",
"int",
"valueOld",
"=",
"(",
"(",
"Integer",
")",
"propertyValueOld",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"valueOld",
"==",
"propertyValueNew",
")",
"return",
"true",
";",
"}",
"beforeChange",
"(",
"propertyName",
")",
";",
"properties",
".",
"put",
"(",
"propertyName",
",",
"Integer",
".",
"valueOf",
"(",
"propertyValueNew",
")",
")",
";",
"afterChange",
"(",
"propertyName",
")",
";",
"setModified",
"(",
"propertyName",
",",
"true",
")",
";",
"return",
"true",
";",
"}"
]
| Set the value of the property identified by the parameter.
@param propertyName The property name to set
@param propertyValueNew The object to set the property value to
@return <code>true</code> for handled or <code>false</code> if <code>propertyName</code> is <code>null</code> | [
"Set",
"the",
"value",
"of",
"the",
"property",
"identified",
"by",
"the",
"parameter",
"."
]
| train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/properties/RtfProperty.java#L329-L341 |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix4.java | Matrix4.setToFrustum | public Matrix4 setToFrustum (
double left, double right, double bottom, double top,
double near, double far, IVector3 nearFarNormal) {
"""
Sets this to a perspective projection matrix.
@return a reference to this matrix, for chaining.
"""
double rrl = 1f / (right - left);
double rtb = 1f / (top - bottom);
double rnf = 1f / (near - far);
double n2 = 2f * near;
double s = (far + near) / (near*nearFarNormal.z() - far*nearFarNormal.z());
return set(n2 * rrl, 0f, (right + left) * rrl, 0f,
0f, n2 * rtb, (top + bottom) * rtb, 0f,
s * nearFarNormal.x(), s * nearFarNormal.y(), (far + near) * rnf, n2 * far * rnf,
0f, 0f, -1f, 0f);
} | java | public Matrix4 setToFrustum (
double left, double right, double bottom, double top,
double near, double far, IVector3 nearFarNormal) {
double rrl = 1f / (right - left);
double rtb = 1f / (top - bottom);
double rnf = 1f / (near - far);
double n2 = 2f * near;
double s = (far + near) / (near*nearFarNormal.z() - far*nearFarNormal.z());
return set(n2 * rrl, 0f, (right + left) * rrl, 0f,
0f, n2 * rtb, (top + bottom) * rtb, 0f,
s * nearFarNormal.x(), s * nearFarNormal.y(), (far + near) * rnf, n2 * far * rnf,
0f, 0f, -1f, 0f);
} | [
"public",
"Matrix4",
"setToFrustum",
"(",
"double",
"left",
",",
"double",
"right",
",",
"double",
"bottom",
",",
"double",
"top",
",",
"double",
"near",
",",
"double",
"far",
",",
"IVector3",
"nearFarNormal",
")",
"{",
"double",
"rrl",
"=",
"1f",
"/",
"(",
"right",
"-",
"left",
")",
";",
"double",
"rtb",
"=",
"1f",
"/",
"(",
"top",
"-",
"bottom",
")",
";",
"double",
"rnf",
"=",
"1f",
"/",
"(",
"near",
"-",
"far",
")",
";",
"double",
"n2",
"=",
"2f",
"*",
"near",
";",
"double",
"s",
"=",
"(",
"far",
"+",
"near",
")",
"/",
"(",
"near",
"*",
"nearFarNormal",
".",
"z",
"(",
")",
"-",
"far",
"*",
"nearFarNormal",
".",
"z",
"(",
")",
")",
";",
"return",
"set",
"(",
"n2",
"*",
"rrl",
",",
"0f",
",",
"(",
"right",
"+",
"left",
")",
"*",
"rrl",
",",
"0f",
",",
"0f",
",",
"n2",
"*",
"rtb",
",",
"(",
"top",
"+",
"bottom",
")",
"*",
"rtb",
",",
"0f",
",",
"s",
"*",
"nearFarNormal",
".",
"x",
"(",
")",
",",
"s",
"*",
"nearFarNormal",
".",
"y",
"(",
")",
",",
"(",
"far",
"+",
"near",
")",
"*",
"rnf",
",",
"n2",
"*",
"far",
"*",
"rnf",
",",
"0f",
",",
"0f",
",",
"-",
"1f",
",",
"0f",
")",
";",
"}"
]
| Sets this to a perspective projection matrix.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"perspective",
"projection",
"matrix",
"."
]
| train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L397-L409 |
ButterFaces/ButterFaces | components/src/main/java/org/butterfaces/model/table/json/JsonToModelConverter.java | JsonToModelConverter.convertTableColumnOrdering | public TableColumnOrdering convertTableColumnOrdering(final String tableIdentifier, final String json) {
"""
Converts given json string to {@link TableColumnOrdering} used by {@link TableColumnOrderingModel}.
@param tableIdentifier an application unique table identifier.
@param json string to convert to {@link TableColumnOrdering}.
@return the converted {@link TableColumnOrdering}.
"""
final String[] split = this.splitColumns(json);
final List<Ordering> orderings = new ArrayList<>();
for (String column : split) {
final String[] attribute = this.splitAttributes(column);
final String identifier = attribute[0].split(":")[1];
final String position = attribute[1].split(":")[1];
orderings.add(new Ordering(identifier, Integer.valueOf(position)));
}
Collections.sort(orderings, new Comparator<Ordering>() {
@Override
public int compare(Ordering o1, Ordering o2) {
return o1.getIndex().compareTo(o2.getIndex());
}
});
final List<String> columnIdentifier = new ArrayList<>();
for (Ordering ordering : orderings) {
columnIdentifier.add(ordering.getIdentifier());
}
return new TableColumnOrdering(tableIdentifier, columnIdentifier);
} | java | public TableColumnOrdering convertTableColumnOrdering(final String tableIdentifier, final String json) {
final String[] split = this.splitColumns(json);
final List<Ordering> orderings = new ArrayList<>();
for (String column : split) {
final String[] attribute = this.splitAttributes(column);
final String identifier = attribute[0].split(":")[1];
final String position = attribute[1].split(":")[1];
orderings.add(new Ordering(identifier, Integer.valueOf(position)));
}
Collections.sort(orderings, new Comparator<Ordering>() {
@Override
public int compare(Ordering o1, Ordering o2) {
return o1.getIndex().compareTo(o2.getIndex());
}
});
final List<String> columnIdentifier = new ArrayList<>();
for (Ordering ordering : orderings) {
columnIdentifier.add(ordering.getIdentifier());
}
return new TableColumnOrdering(tableIdentifier, columnIdentifier);
} | [
"public",
"TableColumnOrdering",
"convertTableColumnOrdering",
"(",
"final",
"String",
"tableIdentifier",
",",
"final",
"String",
"json",
")",
"{",
"final",
"String",
"[",
"]",
"split",
"=",
"this",
".",
"splitColumns",
"(",
"json",
")",
";",
"final",
"List",
"<",
"Ordering",
">",
"orderings",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"column",
":",
"split",
")",
"{",
"final",
"String",
"[",
"]",
"attribute",
"=",
"this",
".",
"splitAttributes",
"(",
"column",
")",
";",
"final",
"String",
"identifier",
"=",
"attribute",
"[",
"0",
"]",
".",
"split",
"(",
"\":\"",
")",
"[",
"1",
"]",
";",
"final",
"String",
"position",
"=",
"attribute",
"[",
"1",
"]",
".",
"split",
"(",
"\":\"",
")",
"[",
"1",
"]",
";",
"orderings",
".",
"add",
"(",
"new",
"Ordering",
"(",
"identifier",
",",
"Integer",
".",
"valueOf",
"(",
"position",
")",
")",
")",
";",
"}",
"Collections",
".",
"sort",
"(",
"orderings",
",",
"new",
"Comparator",
"<",
"Ordering",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"Ordering",
"o1",
",",
"Ordering",
"o2",
")",
"{",
"return",
"o1",
".",
"getIndex",
"(",
")",
".",
"compareTo",
"(",
"o2",
".",
"getIndex",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"final",
"List",
"<",
"String",
">",
"columnIdentifier",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Ordering",
"ordering",
":",
"orderings",
")",
"{",
"columnIdentifier",
".",
"add",
"(",
"ordering",
".",
"getIdentifier",
"(",
")",
")",
";",
"}",
"return",
"new",
"TableColumnOrdering",
"(",
"tableIdentifier",
",",
"columnIdentifier",
")",
";",
"}"
]
| Converts given json string to {@link TableColumnOrdering} used by {@link TableColumnOrderingModel}.
@param tableIdentifier an application unique table identifier.
@param json string to convert to {@link TableColumnOrdering}.
@return the converted {@link TableColumnOrdering}. | [
"Converts",
"given",
"json",
"string",
"to",
"{",
"@link",
"TableColumnOrdering",
"}",
"used",
"by",
"{",
"@link",
"TableColumnOrderingModel",
"}",
"."
]
| train | https://github.com/ButterFaces/ButterFaces/blob/e8c2bb340c89dcdbac409fcfc7a2a0e07f2462fc/components/src/main/java/org/butterfaces/model/table/json/JsonToModelConverter.java#L53-L80 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java | AtomCache.getStructureForCathDomain | public Structure getStructureForCathDomain(StructureName structureName, CathDatabase cathInstall) throws IOException, StructureException {
"""
Returns a {@link Structure} corresponding to the CATH identifier supplied in {@code structureName}, using the specified {@link CathDatabase}.
"""
CathDomain cathDomain = cathInstall.getDomainByCathId(structureName.getIdentifier());
Structure s = getStructureForPdbId(cathDomain.getIdentifier());
Structure n = cathDomain.reduce(s);
// add the ligands of the chain...
Chain newChain = n.getPolyChainByPDB(structureName.getChainId());
List<Chain> origChains = s.getNonPolyChainsByPDB(structureName.getChainId());
for ( Chain origChain : origChains) {
List<Group> ligands = origChain.getAtomGroups();
for (Group g : ligands) {
if (!newChain.getAtomGroups().contains(g)) {
newChain.addGroup(g);
}
}
}
return n;
} | java | public Structure getStructureForCathDomain(StructureName structureName, CathDatabase cathInstall) throws IOException, StructureException {
CathDomain cathDomain = cathInstall.getDomainByCathId(structureName.getIdentifier());
Structure s = getStructureForPdbId(cathDomain.getIdentifier());
Structure n = cathDomain.reduce(s);
// add the ligands of the chain...
Chain newChain = n.getPolyChainByPDB(structureName.getChainId());
List<Chain> origChains = s.getNonPolyChainsByPDB(structureName.getChainId());
for ( Chain origChain : origChains) {
List<Group> ligands = origChain.getAtomGroups();
for (Group g : ligands) {
if (!newChain.getAtomGroups().contains(g)) {
newChain.addGroup(g);
}
}
}
return n;
} | [
"public",
"Structure",
"getStructureForCathDomain",
"(",
"StructureName",
"structureName",
",",
"CathDatabase",
"cathInstall",
")",
"throws",
"IOException",
",",
"StructureException",
"{",
"CathDomain",
"cathDomain",
"=",
"cathInstall",
".",
"getDomainByCathId",
"(",
"structureName",
".",
"getIdentifier",
"(",
")",
")",
";",
"Structure",
"s",
"=",
"getStructureForPdbId",
"(",
"cathDomain",
".",
"getIdentifier",
"(",
")",
")",
";",
"Structure",
"n",
"=",
"cathDomain",
".",
"reduce",
"(",
"s",
")",
";",
"// add the ligands of the chain...",
"Chain",
"newChain",
"=",
"n",
".",
"getPolyChainByPDB",
"(",
"structureName",
".",
"getChainId",
"(",
")",
")",
";",
"List",
"<",
"Chain",
">",
"origChains",
"=",
"s",
".",
"getNonPolyChainsByPDB",
"(",
"structureName",
".",
"getChainId",
"(",
")",
")",
";",
"for",
"(",
"Chain",
"origChain",
":",
"origChains",
")",
"{",
"List",
"<",
"Group",
">",
"ligands",
"=",
"origChain",
".",
"getAtomGroups",
"(",
")",
";",
"for",
"(",
"Group",
"g",
":",
"ligands",
")",
"{",
"if",
"(",
"!",
"newChain",
".",
"getAtomGroups",
"(",
")",
".",
"contains",
"(",
"g",
")",
")",
"{",
"newChain",
".",
"addGroup",
"(",
"g",
")",
";",
"}",
"}",
"}",
"return",
"n",
";",
"}"
]
| Returns a {@link Structure} corresponding to the CATH identifier supplied in {@code structureName}, using the specified {@link CathDatabase}. | [
"Returns",
"a",
"{"
]
| train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java#L824-L846 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsFrameDialog.java | CmsFrameDialog.showFrameDialog | public static CmsPopup showFrameDialog(
String title,
String dialogUri,
Map<String, String> parameters,
CloseHandler<PopupPanel> closeHandler) {
"""
Shows an iFrame dialog popup.<p>
@param title the dialog title
@param dialogUri the dialog URI
@param parameters the dialog post parameters
@param closeHandler the dialog close handler
@return the opened popup
"""
CmsPopup popup = new CmsPopup(title);
popup.removePadding();
popup.addStyleName(I_CmsLayoutBundle.INSTANCE.contentEditorCss().contentEditor());
popup.setGlassEnabled(true);
CmsIFrame editorFrame = new CmsIFrame(IFRAME_NAME, "");
popup.add(editorFrame);
final FormElement formElement = CmsDomUtil.generateHiddenForm(dialogUri, Method.post, IFRAME_NAME, parameters);
RootPanel.getBodyElement().appendChild(formElement);
exportDialogFunctions(popup);
popup.addCloseHandler(new CloseHandler<PopupPanel>() {
public void onClose(CloseEvent<PopupPanel> event) {
formElement.removeFromParent();
removeExportedFunctions();
}
});
if (closeHandler != null) {
popup.addCloseHandler(closeHandler);
}
popup.center();
formElement.submit();
return popup;
} | java | public static CmsPopup showFrameDialog(
String title,
String dialogUri,
Map<String, String> parameters,
CloseHandler<PopupPanel> closeHandler) {
CmsPopup popup = new CmsPopup(title);
popup.removePadding();
popup.addStyleName(I_CmsLayoutBundle.INSTANCE.contentEditorCss().contentEditor());
popup.setGlassEnabled(true);
CmsIFrame editorFrame = new CmsIFrame(IFRAME_NAME, "");
popup.add(editorFrame);
final FormElement formElement = CmsDomUtil.generateHiddenForm(dialogUri, Method.post, IFRAME_NAME, parameters);
RootPanel.getBodyElement().appendChild(formElement);
exportDialogFunctions(popup);
popup.addCloseHandler(new CloseHandler<PopupPanel>() {
public void onClose(CloseEvent<PopupPanel> event) {
formElement.removeFromParent();
removeExportedFunctions();
}
});
if (closeHandler != null) {
popup.addCloseHandler(closeHandler);
}
popup.center();
formElement.submit();
return popup;
} | [
"public",
"static",
"CmsPopup",
"showFrameDialog",
"(",
"String",
"title",
",",
"String",
"dialogUri",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"CloseHandler",
"<",
"PopupPanel",
">",
"closeHandler",
")",
"{",
"CmsPopup",
"popup",
"=",
"new",
"CmsPopup",
"(",
"title",
")",
";",
"popup",
".",
"removePadding",
"(",
")",
";",
"popup",
".",
"addStyleName",
"(",
"I_CmsLayoutBundle",
".",
"INSTANCE",
".",
"contentEditorCss",
"(",
")",
".",
"contentEditor",
"(",
")",
")",
";",
"popup",
".",
"setGlassEnabled",
"(",
"true",
")",
";",
"CmsIFrame",
"editorFrame",
"=",
"new",
"CmsIFrame",
"(",
"IFRAME_NAME",
",",
"\"\"",
")",
";",
"popup",
".",
"add",
"(",
"editorFrame",
")",
";",
"final",
"FormElement",
"formElement",
"=",
"CmsDomUtil",
".",
"generateHiddenForm",
"(",
"dialogUri",
",",
"Method",
".",
"post",
",",
"IFRAME_NAME",
",",
"parameters",
")",
";",
"RootPanel",
".",
"getBodyElement",
"(",
")",
".",
"appendChild",
"(",
"formElement",
")",
";",
"exportDialogFunctions",
"(",
"popup",
")",
";",
"popup",
".",
"addCloseHandler",
"(",
"new",
"CloseHandler",
"<",
"PopupPanel",
">",
"(",
")",
"{",
"public",
"void",
"onClose",
"(",
"CloseEvent",
"<",
"PopupPanel",
">",
"event",
")",
"{",
"formElement",
".",
"removeFromParent",
"(",
")",
";",
"removeExportedFunctions",
"(",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"closeHandler",
"!=",
"null",
")",
"{",
"popup",
".",
"addCloseHandler",
"(",
"closeHandler",
")",
";",
"}",
"popup",
".",
"center",
"(",
")",
";",
"formElement",
".",
"submit",
"(",
")",
";",
"return",
"popup",
";",
"}"
]
| Shows an iFrame dialog popup.<p>
@param title the dialog title
@param dialogUri the dialog URI
@param parameters the dialog post parameters
@param closeHandler the dialog close handler
@return the opened popup | [
"Shows",
"an",
"iFrame",
"dialog",
"popup",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsFrameDialog.java#L148-L177 |
jenkinsci/jenkins | core/src/main/java/hudson/console/ConsoleLogFilter.java | ConsoleLogFilter.decorateLogger | public OutputStream decorateLogger(Run build, OutputStream logger) throws IOException, InterruptedException {
"""
Called on the start of each build, giving extensions a chance to intercept
the data that is written to the log.
<p>
Even though this method is not marked 'abstract', this is the method that must be overridden
by extensions.
"""
// this implementation is backward compatibility thunk in case subtypes only override the
// old signature (AbstractBuild,OutputStream)
if (build instanceof AbstractBuild) {
// maybe the plugin implements the old signature.
return decorateLogger((AbstractBuild) build, logger);
} else {
// this ConsoleLogFilter can only decorate AbstractBuild, so just pass through
return logger;
}
} | java | public OutputStream decorateLogger(Run build, OutputStream logger) throws IOException, InterruptedException {
// this implementation is backward compatibility thunk in case subtypes only override the
// old signature (AbstractBuild,OutputStream)
if (build instanceof AbstractBuild) {
// maybe the plugin implements the old signature.
return decorateLogger((AbstractBuild) build, logger);
} else {
// this ConsoleLogFilter can only decorate AbstractBuild, so just pass through
return logger;
}
} | [
"public",
"OutputStream",
"decorateLogger",
"(",
"Run",
"build",
",",
"OutputStream",
"logger",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"// this implementation is backward compatibility thunk in case subtypes only override the",
"// old signature (AbstractBuild,OutputStream)",
"if",
"(",
"build",
"instanceof",
"AbstractBuild",
")",
"{",
"// maybe the plugin implements the old signature.",
"return",
"decorateLogger",
"(",
"(",
"AbstractBuild",
")",
"build",
",",
"logger",
")",
";",
"}",
"else",
"{",
"// this ConsoleLogFilter can only decorate AbstractBuild, so just pass through",
"return",
"logger",
";",
"}",
"}"
]
| Called on the start of each build, giving extensions a chance to intercept
the data that is written to the log.
<p>
Even though this method is not marked 'abstract', this is the method that must be overridden
by extensions. | [
"Called",
"on",
"the",
"start",
"of",
"each",
"build",
"giving",
"extensions",
"a",
"chance",
"to",
"intercept",
"the",
"data",
"that",
"is",
"written",
"to",
"the",
"log",
"."
]
| train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/console/ConsoleLogFilter.java#L83-L94 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java | CertificatesImpl.listAsync | public ServiceFuture<List<Certificate>> listAsync(final CertificateListOptions certificateListOptions, final ListOperationCallback<Certificate> serviceCallback) {
"""
Lists all of the certificates that have been added to the specified account.
@param certificateListOptions Additional parameters for the operation
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(certificateListOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders>> call(String nextPageLink) {
CertificateListNextOptions certificateListNextOptions = null;
if (certificateListOptions != null) {
certificateListNextOptions = new CertificateListNextOptions();
certificateListNextOptions.withClientRequestId(certificateListOptions.clientRequestId());
certificateListNextOptions.withReturnClientRequestId(certificateListOptions.returnClientRequestId());
certificateListNextOptions.withOcpDate(certificateListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, certificateListNextOptions);
}
},
serviceCallback);
} | java | public ServiceFuture<List<Certificate>> listAsync(final CertificateListOptions certificateListOptions, final ListOperationCallback<Certificate> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(certificateListOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders>> call(String nextPageLink) {
CertificateListNextOptions certificateListNextOptions = null;
if (certificateListOptions != null) {
certificateListNextOptions = new CertificateListNextOptions();
certificateListNextOptions.withClientRequestId(certificateListOptions.clientRequestId());
certificateListNextOptions.withReturnClientRequestId(certificateListOptions.returnClientRequestId());
certificateListNextOptions.withOcpDate(certificateListOptions.ocpDate());
}
return listNextSinglePageAsync(nextPageLink, certificateListNextOptions);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"Certificate",
">",
">",
"listAsync",
"(",
"final",
"CertificateListOptions",
"certificateListOptions",
",",
"final",
"ListOperationCallback",
"<",
"Certificate",
">",
"serviceCallback",
")",
"{",
"return",
"AzureServiceFuture",
".",
"fromHeaderPageResponse",
"(",
"listSinglePageAsync",
"(",
"certificateListOptions",
")",
",",
"new",
"Func1",
"<",
"String",
",",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"Certificate",
">",
",",
"CertificateListHeaders",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"Certificate",
">",
",",
"CertificateListHeaders",
">",
">",
"call",
"(",
"String",
"nextPageLink",
")",
"{",
"CertificateListNextOptions",
"certificateListNextOptions",
"=",
"null",
";",
"if",
"(",
"certificateListOptions",
"!=",
"null",
")",
"{",
"certificateListNextOptions",
"=",
"new",
"CertificateListNextOptions",
"(",
")",
";",
"certificateListNextOptions",
".",
"withClientRequestId",
"(",
"certificateListOptions",
".",
"clientRequestId",
"(",
")",
")",
";",
"certificateListNextOptions",
".",
"withReturnClientRequestId",
"(",
"certificateListOptions",
".",
"returnClientRequestId",
"(",
")",
")",
";",
"certificateListNextOptions",
".",
"withOcpDate",
"(",
"certificateListOptions",
".",
"ocpDate",
"(",
")",
")",
";",
"}",
"return",
"listNextSinglePageAsync",
"(",
"nextPageLink",
",",
"certificateListNextOptions",
")",
";",
"}",
"}",
",",
"serviceCallback",
")",
";",
"}"
]
| Lists all of the certificates that have been added to the specified account.
@param certificateListOptions Additional parameters for the operation
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"all",
"of",
"the",
"certificates",
"that",
"have",
"been",
"added",
"to",
"the",
"specified",
"account",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java#L439-L456 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/WidgetUtil.java | WidgetUtil.createFlashObjectDefinition | public static String createFlashObjectDefinition (
String ident, String movie, int width, int height, String flashVars) {
"""
Creates an HTML string that represents the Flash object for the current browser.
This object can be added to the appropriate container using embedFlashObject().
@param flashVars a pre-URLEncoded string containing flash variables, or null.
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16417
"""
return createDefinition(new FlashObject(ident, movie, width, height, flashVars));
} | java | public static String createFlashObjectDefinition (
String ident, String movie, int width, int height, String flashVars)
{
return createDefinition(new FlashObject(ident, movie, width, height, flashVars));
} | [
"public",
"static",
"String",
"createFlashObjectDefinition",
"(",
"String",
"ident",
",",
"String",
"movie",
",",
"int",
"width",
",",
"int",
"height",
",",
"String",
"flashVars",
")",
"{",
"return",
"createDefinition",
"(",
"new",
"FlashObject",
"(",
"ident",
",",
"movie",
",",
"width",
",",
"height",
",",
"flashVars",
")",
")",
";",
"}"
]
| Creates an HTML string that represents the Flash object for the current browser.
This object can be added to the appropriate container using embedFlashObject().
@param flashVars a pre-URLEncoded string containing flash variables, or null.
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16417 | [
"Creates",
"an",
"HTML",
"string",
"that",
"represents",
"the",
"Flash",
"object",
"for",
"the",
"current",
"browser",
".",
"This",
"object",
"can",
"be",
"added",
"to",
"the",
"appropriate",
"container",
"using",
"embedFlashObject",
"()",
"."
]
| train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/WidgetUtil.java#L174-L178 |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/util/BeangleStaticContentLoader.java | BeangleStaticContentLoader.findStaticResource | public void findStaticResource(String path, HttpServletRequest request, HttpServletResponse response)
throws IOException {
"""
Locate a static resource and copy directly to the response, setting the
appropriate caching headers.
"""
processor.process(cleanupPath(path), request, response);
} | java | public void findStaticResource(String path, HttpServletRequest request, HttpServletResponse response)
throws IOException {
processor.process(cleanupPath(path), request, response);
} | [
"public",
"void",
"findStaticResource",
"(",
"String",
"path",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"processor",
".",
"process",
"(",
"cleanupPath",
"(",
"path",
")",
",",
"request",
",",
"response",
")",
";",
"}"
]
| Locate a static resource and copy directly to the response, setting the
appropriate caching headers. | [
"Locate",
"a",
"static",
"resource",
"and",
"copy",
"directly",
"to",
"the",
"response",
"setting",
"the",
"appropriate",
"caching",
"headers",
"."
]
| train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/util/BeangleStaticContentLoader.java#L55-L58 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java | SwingGroovyMethods.putAt | public static void putAt(MutableComboBoxModel self, int index, Object i) {
"""
Allow MutableComboBoxModel to work with subscript operators.<p>
<b>WARNING:</b> this operation does not replace the item at the
specified index, rather it inserts the item at that index, thus
increasing the size of the model by 1.
@param self a MutableComboBoxModel
@param index an index
@param i the item to insert at the given index
@since 1.6.4
"""
self.insertElementAt(i, index);
} | java | public static void putAt(MutableComboBoxModel self, int index, Object i) {
self.insertElementAt(i, index);
} | [
"public",
"static",
"void",
"putAt",
"(",
"MutableComboBoxModel",
"self",
",",
"int",
"index",
",",
"Object",
"i",
")",
"{",
"self",
".",
"insertElementAt",
"(",
"i",
",",
"index",
")",
";",
"}"
]
| Allow MutableComboBoxModel to work with subscript operators.<p>
<b>WARNING:</b> this operation does not replace the item at the
specified index, rather it inserts the item at that index, thus
increasing the size of the model by 1.
@param self a MutableComboBoxModel
@param index an index
@param i the item to insert at the given index
@since 1.6.4 | [
"Allow",
"MutableComboBoxModel",
"to",
"work",
"with",
"subscript",
"operators",
".",
"<p",
">",
"<b",
">",
"WARNING",
":",
"<",
"/",
"b",
">",
"this",
"operation",
"does",
"not",
"replace",
"the",
"item",
"at",
"the",
"specified",
"index",
"rather",
"it",
"inserts",
"the",
"item",
"at",
"that",
"index",
"thus",
"increasing",
"the",
"size",
"of",
"the",
"model",
"by",
"1",
"."
]
| train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L352-L354 |
softindex/datakernel | core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java | ByteBuf.isContentEqual | @Contract(pure = true)
public boolean isContentEqual(@NotNull byte[] array, int offset, int length) {
"""
Checks if provided array is equal to the readable bytes of the {@link #array}.
@param array byte array to be compared with the {@link #array}
@param offset offset value for the provided byte array
@param length amount of the bytes to be compared
@return {@code true} if the byte array is equal to the array, otherwise {@code false}
"""
return Utils.arraysEquals(this.array, head, readRemaining(), array, offset, length);
} | java | @Contract(pure = true)
public boolean isContentEqual(@NotNull byte[] array, int offset, int length) {
return Utils.arraysEquals(this.array, head, readRemaining(), array, offset, length);
} | [
"@",
"Contract",
"(",
"pure",
"=",
"true",
")",
"public",
"boolean",
"isContentEqual",
"(",
"@",
"NotNull",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"Utils",
".",
"arraysEquals",
"(",
"this",
".",
"array",
",",
"head",
",",
"readRemaining",
"(",
")",
",",
"array",
",",
"offset",
",",
"length",
")",
";",
"}"
]
| Checks if provided array is equal to the readable bytes of the {@link #array}.
@param array byte array to be compared with the {@link #array}
@param offset offset value for the provided byte array
@param length amount of the bytes to be compared
@return {@code true} if the byte array is equal to the array, otherwise {@code false} | [
"Checks",
"if",
"provided",
"array",
"is",
"equal",
"to",
"the",
"readable",
"bytes",
"of",
"the",
"{",
"@link",
"#array",
"}",
"."
]
| train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java#L735-L738 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java | ImplicitObjectUtil.loadSharedFlow | public static void loadSharedFlow(ServletRequest request, Map/*<String, SharedFlowController>*/ sharedFlows) {
"""
Load the shared flow into the request.
@param request the request
@param sharedFlows the current shared flows
"""
if(sharedFlows != null)
request.setAttribute(SHARED_FLOW_IMPLICIT_OBJECT_KEY, sharedFlows);
} | java | public static void loadSharedFlow(ServletRequest request, Map/*<String, SharedFlowController>*/ sharedFlows) {
if(sharedFlows != null)
request.setAttribute(SHARED_FLOW_IMPLICIT_OBJECT_KEY, sharedFlows);
} | [
"public",
"static",
"void",
"loadSharedFlow",
"(",
"ServletRequest",
"request",
",",
"Map",
"/*<String, SharedFlowController>*/",
"sharedFlows",
")",
"{",
"if",
"(",
"sharedFlows",
"!=",
"null",
")",
"request",
".",
"setAttribute",
"(",
"SHARED_FLOW_IMPLICIT_OBJECT_KEY",
",",
"sharedFlows",
")",
";",
"}"
]
| Load the shared flow into the request.
@param request the request
@param sharedFlows the current shared flows | [
"Load",
"the",
"shared",
"flow",
"into",
"the",
"request",
"."
]
| train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L136-L139 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/odselement/ContentElement.java | ContentElement.writePostamble | public void writePostamble(final XMLUtil util, final ZipUTF8Writer writer) throws IOException {
"""
Write the postamble into the given writer. Used by the FinalizeFlusher and by standard write method
@param util an XML util
@param writer the destination
@throws IOException if the postamble could not be written
"""
if (this.autofilters != null) this.appendAutofilters(writer, util);
writer.write("</office:spreadsheet>");
writer.write("</office:body>");
writer.write("</office:document-content>");
writer.flush();
writer.closeEntry();
} | java | public void writePostamble(final XMLUtil util, final ZipUTF8Writer writer) throws IOException {
if (this.autofilters != null) this.appendAutofilters(writer, util);
writer.write("</office:spreadsheet>");
writer.write("</office:body>");
writer.write("</office:document-content>");
writer.flush();
writer.closeEntry();
} | [
"public",
"void",
"writePostamble",
"(",
"final",
"XMLUtil",
"util",
",",
"final",
"ZipUTF8Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"autofilters",
"!=",
"null",
")",
"this",
".",
"appendAutofilters",
"(",
"writer",
",",
"util",
")",
";",
"writer",
".",
"write",
"(",
"\"</office:spreadsheet>\"",
")",
";",
"writer",
".",
"write",
"(",
"\"</office:body>\"",
")",
";",
"writer",
".",
"write",
"(",
"\"</office:document-content>\"",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"closeEntry",
"(",
")",
";",
"}"
]
| Write the postamble into the given writer. Used by the FinalizeFlusher and by standard write method
@param util an XML util
@param writer the destination
@throws IOException if the postamble could not be written | [
"Write",
"the",
"postamble",
"into",
"the",
"given",
"writer",
".",
"Used",
"by",
"the",
"FinalizeFlusher",
"and",
"by",
"standard",
"write",
"method"
]
| train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/ContentElement.java#L241-L248 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.setCertificateIssuerAsync | public ServiceFuture<IssuerBundle> setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes, final ServiceCallback<IssuerBundle> serviceCallback) {
"""
Sets the specified certificate issuer.
The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the certificates/setissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param issuerName The name of the issuer.
@param provider The issuer provider.
@param credentials The credentials to be used for the issuer.
@param organizationDetails Details of the organization as provided to the issuer.
@param attributes Attributes of the issuer object.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return ServiceFuture.fromResponse(setCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider, credentials, organizationDetails, attributes), serviceCallback);
} | java | public ServiceFuture<IssuerBundle> setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes, final ServiceCallback<IssuerBundle> serviceCallback) {
return ServiceFuture.fromResponse(setCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider, credentials, organizationDetails, attributes), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"IssuerBundle",
">",
"setCertificateIssuerAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"issuerName",
",",
"String",
"provider",
",",
"IssuerCredentials",
"credentials",
",",
"OrganizationDetails",
"organizationDetails",
",",
"IssuerAttributes",
"attributes",
",",
"final",
"ServiceCallback",
"<",
"IssuerBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"setCertificateIssuerWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"issuerName",
",",
"provider",
",",
"credentials",
",",
"organizationDetails",
",",
"attributes",
")",
",",
"serviceCallback",
")",
";",
"}"
]
| Sets the specified certificate issuer.
The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the certificates/setissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param issuerName The name of the issuer.
@param provider The issuer provider.
@param credentials The credentials to be used for the issuer.
@param organizationDetails Details of the organization as provided to the issuer.
@param attributes Attributes of the issuer object.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Sets",
"the",
"specified",
"certificate",
"issuer",
".",
"The",
"SetCertificateIssuer",
"operation",
"adds",
"or",
"updates",
"the",
"specified",
"certificate",
"issuer",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"setissuers",
"permission",
"."
]
| 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#L6017-L6019 |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java | MavenProjectUtil.getPluginGoalExecution | public static PluginExecution getPluginGoalExecution(MavenProject project, String pluginKey, String goal) throws PluginScenarioException {
"""
Get an execution of a plugin
@param project
@param pluginKey
@param goal
@return the execution object
@throws PluginScenarioException
"""
Plugin plugin = project.getPlugin(pluginKey);
return getPluginGoalExecution(plugin, goal);
} | java | public static PluginExecution getPluginGoalExecution(MavenProject project, String pluginKey, String goal) throws PluginScenarioException {
Plugin plugin = project.getPlugin(pluginKey);
return getPluginGoalExecution(plugin, goal);
} | [
"public",
"static",
"PluginExecution",
"getPluginGoalExecution",
"(",
"MavenProject",
"project",
",",
"String",
"pluginKey",
",",
"String",
"goal",
")",
"throws",
"PluginScenarioException",
"{",
"Plugin",
"plugin",
"=",
"project",
".",
"getPlugin",
"(",
"pluginKey",
")",
";",
"return",
"getPluginGoalExecution",
"(",
"plugin",
",",
"goal",
")",
";",
"}"
]
| Get an execution of a plugin
@param project
@param pluginKey
@param goal
@return the execution object
@throws PluginScenarioException | [
"Get",
"an",
"execution",
"of",
"a",
"plugin"
]
| train | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java#L100-L103 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/ConstructorRef.java | ConstructorRef.create | public static ConstructorRef create(TypeInfo type, Method init) {
"""
Returns a new {@link ConstructorRef} that refers to a constructor on the given type with the
given parameter types.
"""
checkArgument(
init.getName().equals("<init>") && init.getReturnType().equals(Type.VOID_TYPE),
"'%s' is not a valid constructor",
init);
return new AutoValue_ConstructorRef(type, init, ImmutableList.copyOf(init.getArgumentTypes()));
} | java | public static ConstructorRef create(TypeInfo type, Method init) {
checkArgument(
init.getName().equals("<init>") && init.getReturnType().equals(Type.VOID_TYPE),
"'%s' is not a valid constructor",
init);
return new AutoValue_ConstructorRef(type, init, ImmutableList.copyOf(init.getArgumentTypes()));
} | [
"public",
"static",
"ConstructorRef",
"create",
"(",
"TypeInfo",
"type",
",",
"Method",
"init",
")",
"{",
"checkArgument",
"(",
"init",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"<init>\"",
")",
"&&",
"init",
".",
"getReturnType",
"(",
")",
".",
"equals",
"(",
"Type",
".",
"VOID_TYPE",
")",
",",
"\"'%s' is not a valid constructor\"",
",",
"init",
")",
";",
"return",
"new",
"AutoValue_ConstructorRef",
"(",
"type",
",",
"init",
",",
"ImmutableList",
".",
"copyOf",
"(",
"init",
".",
"getArgumentTypes",
"(",
")",
")",
")",
";",
"}"
]
| Returns a new {@link ConstructorRef} that refers to a constructor on the given type with the
given parameter types. | [
"Returns",
"a",
"new",
"{"
]
| train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/ConstructorRef.java#L45-L51 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Consumers.java | Consumers.pipe | public static <E> void pipe(Iterable<E> iterable, OutputIterator<E> outputIterator) {
"""
Consumes an iterable into the output iterator.
@param <E> the iterator element type
@param iterable the iterable that will be consumed
@param outputIterator the iterator that will be filled
"""
dbc.precondition(iterable != null, "cannot call pipe with a null iterable");
new ConsumeIntoOutputIterator<>(outputIterator).apply(iterable.iterator());
} | java | public static <E> void pipe(Iterable<E> iterable, OutputIterator<E> outputIterator) {
dbc.precondition(iterable != null, "cannot call pipe with a null iterable");
new ConsumeIntoOutputIterator<>(outputIterator).apply(iterable.iterator());
} | [
"public",
"static",
"<",
"E",
">",
"void",
"pipe",
"(",
"Iterable",
"<",
"E",
">",
"iterable",
",",
"OutputIterator",
"<",
"E",
">",
"outputIterator",
")",
"{",
"dbc",
".",
"precondition",
"(",
"iterable",
"!=",
"null",
",",
"\"cannot call pipe with a null iterable\"",
")",
";",
"new",
"ConsumeIntoOutputIterator",
"<>",
"(",
"outputIterator",
")",
".",
"apply",
"(",
"iterable",
".",
"iterator",
"(",
")",
")",
";",
"}"
]
| Consumes an iterable into the output iterator.
@param <E> the iterator element type
@param iterable the iterable that will be consumed
@param outputIterator the iterator that will be filled | [
"Consumes",
"an",
"iterable",
"into",
"the",
"output",
"iterator",
"."
]
| train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L322-L325 |
Jasig/uPortal | uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java | PropertiesManager.getPropertyAsLong | public static long getPropertyAsLong(String name)
throws MissingPropertyException, BadPropertyException {
"""
Returns the value of a property for a given name as a <code>long</code>
@param name the name of the requested property
@return value the property's value as a <code>long</code>
@throws MissingPropertyException - if the property is not set
@throws BadPropertyException - if the property cannot be parsed as a long
"""
if (PropertiesManager.props == null) loadProps();
try {
return Long.parseLong(getProperty(name));
} catch (NumberFormatException nfe) {
throw new BadPropertyException(name, getProperty(name), "long");
}
} | java | public static long getPropertyAsLong(String name)
throws MissingPropertyException, BadPropertyException {
if (PropertiesManager.props == null) loadProps();
try {
return Long.parseLong(getProperty(name));
} catch (NumberFormatException nfe) {
throw new BadPropertyException(name, getProperty(name), "long");
}
} | [
"public",
"static",
"long",
"getPropertyAsLong",
"(",
"String",
"name",
")",
"throws",
"MissingPropertyException",
",",
"BadPropertyException",
"{",
"if",
"(",
"PropertiesManager",
".",
"props",
"==",
"null",
")",
"loadProps",
"(",
")",
";",
"try",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"getProperty",
"(",
"name",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"throw",
"new",
"BadPropertyException",
"(",
"name",
",",
"getProperty",
"(",
"name",
")",
",",
"\"long\"",
")",
";",
"}",
"}"
]
| Returns the value of a property for a given name as a <code>long</code>
@param name the name of the requested property
@return value the property's value as a <code>long</code>
@throws MissingPropertyException - if the property is not set
@throws BadPropertyException - if the property cannot be parsed as a long | [
"Returns",
"the",
"value",
"of",
"a",
"property",
"for",
"a",
"given",
"name",
"as",
"a",
"<code",
">",
"long<",
"/",
"code",
">"
]
| train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java#L255-L263 |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.justifyLeft | public static String justifyLeft( String str,
final int width,
char padWithChar ) {
"""
Left justify the contents of the string, ensuring that the supplied string begins at the first character and that the
resulting string is of the desired length. If the supplied string is longer than the desired width, it is truncated to the
specified length. If the supplied string is shorter than the desired width, the padding character is added to the end of
the string one or more times such that the length is that specified. All leading and trailing whitespace is removed.
@param str the string to be left justified; if null, an empty string is used
@param width the desired width of the string; must be positive
@param padWithChar the character to use for padding, if needed
@return the left justified string
@see #setLength(String, int, char)
"""
return justifyLeft(str, width, padWithChar, true);
} | java | public static String justifyLeft( String str,
final int width,
char padWithChar ) {
return justifyLeft(str, width, padWithChar, true);
} | [
"public",
"static",
"String",
"justifyLeft",
"(",
"String",
"str",
",",
"final",
"int",
"width",
",",
"char",
"padWithChar",
")",
"{",
"return",
"justifyLeft",
"(",
"str",
",",
"width",
",",
"padWithChar",
",",
"true",
")",
";",
"}"
]
| Left justify the contents of the string, ensuring that the supplied string begins at the first character and that the
resulting string is of the desired length. If the supplied string is longer than the desired width, it is truncated to the
specified length. If the supplied string is shorter than the desired width, the padding character is added to the end of
the string one or more times such that the length is that specified. All leading and trailing whitespace is removed.
@param str the string to be left justified; if null, an empty string is used
@param width the desired width of the string; must be positive
@param padWithChar the character to use for padding, if needed
@return the left justified string
@see #setLength(String, int, char) | [
"Left",
"justify",
"the",
"contents",
"of",
"the",
"string",
"ensuring",
"that",
"the",
"supplied",
"string",
"begins",
"at",
"the",
"first",
"character",
"and",
"that",
"the",
"resulting",
"string",
"is",
"of",
"the",
"desired",
"length",
".",
"If",
"the",
"supplied",
"string",
"is",
"longer",
"than",
"the",
"desired",
"width",
"it",
"is",
"truncated",
"to",
"the",
"specified",
"length",
".",
"If",
"the",
"supplied",
"string",
"is",
"shorter",
"than",
"the",
"desired",
"width",
"the",
"padding",
"character",
"is",
"added",
"to",
"the",
"end",
"of",
"the",
"string",
"one",
"or",
"more",
"times",
"such",
"that",
"the",
"length",
"is",
"that",
"specified",
".",
"All",
"leading",
"and",
"trailing",
"whitespace",
"is",
"removed",
"."
]
| train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L313-L317 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.getBeansOfTypeForMethodArgument | @SuppressWarnings("WeakerAccess")
@Internal
protected final Collection getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
"""
Obtains all bean definitions for the method at the given index and the argument at the given index
<p>
Warning: this method is used by internal generated code and should not be called by user code.
@param resolutionContext The resolution context
@param context The context
@param injectionPoint The method injection point
@param argument The argument
@return The resolved bean
"""
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) -> {
boolean hasNoGenerics = !argument.getType().isArray() && argument.getTypeVariables().isEmpty();
if (hasNoGenerics) {
return ((DefaultBeanContext) context).getBean(resolutionContext, beanType, qualifier);
} else {
return ((DefaultBeanContext) context).getBeansOfType(resolutionContext, beanType, qualifier);
}
}
);
} | java | @SuppressWarnings("WeakerAccess")
@Internal
protected final Collection getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) -> {
boolean hasNoGenerics = !argument.getType().isArray() && argument.getTypeVariables().isEmpty();
if (hasNoGenerics) {
return ((DefaultBeanContext) context).getBean(resolutionContext, beanType, qualifier);
} else {
return ((DefaultBeanContext) context).getBeansOfType(resolutionContext, beanType, qualifier);
}
}
);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"@",
"Internal",
"protected",
"final",
"Collection",
"getBeansOfTypeForMethodArgument",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"BeanContext",
"context",
",",
"MethodInjectionPoint",
"injectionPoint",
",",
"Argument",
"argument",
")",
"{",
"return",
"resolveBeanWithGenericsFromMethodArgument",
"(",
"resolutionContext",
",",
"injectionPoint",
",",
"argument",
",",
"(",
"beanType",
",",
"qualifier",
")",
"->",
"{",
"boolean",
"hasNoGenerics",
"=",
"!",
"argument",
".",
"getType",
"(",
")",
".",
"isArray",
"(",
")",
"&&",
"argument",
".",
"getTypeVariables",
"(",
")",
".",
"isEmpty",
"(",
")",
";",
"if",
"(",
"hasNoGenerics",
")",
"{",
"return",
"(",
"(",
"DefaultBeanContext",
")",
"context",
")",
".",
"getBean",
"(",
"resolutionContext",
",",
"beanType",
",",
"qualifier",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"DefaultBeanContext",
")",
"context",
")",
".",
"getBeansOfType",
"(",
"resolutionContext",
",",
"beanType",
",",
"qualifier",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Obtains all bean definitions for the method at the given index and the argument at the given index
<p>
Warning: this method is used by internal generated code and should not be called by user code.
@param resolutionContext The resolution context
@param context The context
@param injectionPoint The method injection point
@param argument The argument
@return The resolved bean | [
"Obtains",
"all",
"bean",
"definitions",
"for",
"the",
"method",
"at",
"the",
"given",
"index",
"and",
"the",
"argument",
"at",
"the",
"given",
"index",
"<p",
">",
"Warning",
":",
"this",
"method",
"is",
"used",
"by",
"internal",
"generated",
"code",
"and",
"should",
"not",
"be",
"called",
"by",
"user",
"code",
"."
]
| train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L863-L876 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/schema/WsdlXsdSchema.java | WsdlXsdSchema.inheritNamespaces | @SuppressWarnings("unchecked")
private void inheritNamespaces(SchemaImpl schema, Definition wsdl) {
"""
Adds WSDL level namespaces to schema definition if necessary.
@param schema
@param wsdl
"""
Map<String, String> wsdlNamespaces = wsdl.getNamespaces();
for (Entry<String, String> nsEntry: wsdlNamespaces.entrySet()) {
if (StringUtils.hasText(nsEntry.getKey())) {
if (!schema.getElement().hasAttributeNS(WWW_W3_ORG_2000_XMLNS, nsEntry.getKey())) {
schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns:" + nsEntry.getKey(), nsEntry.getValue());
}
} else { // handle default namespace
if (!schema.getElement().hasAttribute("xmlns")) {
schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns" + nsEntry.getKey(), nsEntry.getValue());
}
}
}
} | java | @SuppressWarnings("unchecked")
private void inheritNamespaces(SchemaImpl schema, Definition wsdl) {
Map<String, String> wsdlNamespaces = wsdl.getNamespaces();
for (Entry<String, String> nsEntry: wsdlNamespaces.entrySet()) {
if (StringUtils.hasText(nsEntry.getKey())) {
if (!schema.getElement().hasAttributeNS(WWW_W3_ORG_2000_XMLNS, nsEntry.getKey())) {
schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns:" + nsEntry.getKey(), nsEntry.getValue());
}
} else { // handle default namespace
if (!schema.getElement().hasAttribute("xmlns")) {
schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns" + nsEntry.getKey(), nsEntry.getValue());
}
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"inheritNamespaces",
"(",
"SchemaImpl",
"schema",
",",
"Definition",
"wsdl",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"wsdlNamespaces",
"=",
"wsdl",
".",
"getNamespaces",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"nsEntry",
":",
"wsdlNamespaces",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"nsEntry",
".",
"getKey",
"(",
")",
")",
")",
"{",
"if",
"(",
"!",
"schema",
".",
"getElement",
"(",
")",
".",
"hasAttributeNS",
"(",
"WWW_W3_ORG_2000_XMLNS",
",",
"nsEntry",
".",
"getKey",
"(",
")",
")",
")",
"{",
"schema",
".",
"getElement",
"(",
")",
".",
"setAttributeNS",
"(",
"WWW_W3_ORG_2000_XMLNS",
",",
"\"xmlns:\"",
"+",
"nsEntry",
".",
"getKey",
"(",
")",
",",
"nsEntry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"// handle default namespace",
"if",
"(",
"!",
"schema",
".",
"getElement",
"(",
")",
".",
"hasAttribute",
"(",
"\"xmlns\"",
")",
")",
"{",
"schema",
".",
"getElement",
"(",
")",
".",
"setAttributeNS",
"(",
"WWW_W3_ORG_2000_XMLNS",
",",
"\"xmlns\"",
"+",
"nsEntry",
".",
"getKey",
"(",
")",
",",
"nsEntry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
]
| Adds WSDL level namespaces to schema definition if necessary.
@param schema
@param wsdl | [
"Adds",
"WSDL",
"level",
"namespaces",
"to",
"schema",
"definition",
"if",
"necessary",
"."
]
| train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/schema/WsdlXsdSchema.java#L161-L176 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric_ca/sdk/HFCAClient.java | HFCAClient.createNewInstance | public static HFCAClient createNewInstance(NetworkConfig.CAInfo caInfo, CryptoSuite cryptoSuite) throws MalformedURLException, InvalidArgumentException {
"""
Create HFCAClient from a NetworkConfig.CAInfo
@param caInfo created from NetworkConfig.getOrganizationInfo("org_name").getCertificateAuthorities()
@param cryptoSuite the specific cryptosuite to use.
@return HFCAClient
@throws MalformedURLException
@throws InvalidArgumentException
"""
if (null == caInfo) {
throw new InvalidArgumentException("The caInfo parameter can not be null.");
}
if (null == cryptoSuite) {
throw new InvalidArgumentException("The cryptoSuite parameter can not be null.");
}
HFCAClient ret = new HFCAClient(caInfo.getCAName(), caInfo.getUrl(), caInfo.getProperties());
ret.setCryptoSuite(cryptoSuite);
return ret;
} | java | public static HFCAClient createNewInstance(NetworkConfig.CAInfo caInfo, CryptoSuite cryptoSuite) throws MalformedURLException, InvalidArgumentException {
if (null == caInfo) {
throw new InvalidArgumentException("The caInfo parameter can not be null.");
}
if (null == cryptoSuite) {
throw new InvalidArgumentException("The cryptoSuite parameter can not be null.");
}
HFCAClient ret = new HFCAClient(caInfo.getCAName(), caInfo.getUrl(), caInfo.getProperties());
ret.setCryptoSuite(cryptoSuite);
return ret;
} | [
"public",
"static",
"HFCAClient",
"createNewInstance",
"(",
"NetworkConfig",
".",
"CAInfo",
"caInfo",
",",
"CryptoSuite",
"cryptoSuite",
")",
"throws",
"MalformedURLException",
",",
"InvalidArgumentException",
"{",
"if",
"(",
"null",
"==",
"caInfo",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"The caInfo parameter can not be null.\"",
")",
";",
"}",
"if",
"(",
"null",
"==",
"cryptoSuite",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"The cryptoSuite parameter can not be null.\"",
")",
";",
"}",
"HFCAClient",
"ret",
"=",
"new",
"HFCAClient",
"(",
"caInfo",
".",
"getCAName",
"(",
")",
",",
"caInfo",
".",
"getUrl",
"(",
")",
",",
"caInfo",
".",
"getProperties",
"(",
")",
")",
";",
"ret",
".",
"setCryptoSuite",
"(",
"cryptoSuite",
")",
";",
"return",
"ret",
";",
"}"
]
| Create HFCAClient from a NetworkConfig.CAInfo
@param caInfo created from NetworkConfig.getOrganizationInfo("org_name").getCertificateAuthorities()
@param cryptoSuite the specific cryptosuite to use.
@return HFCAClient
@throws MalformedURLException
@throws InvalidArgumentException | [
"Create",
"HFCAClient",
"from",
"a",
"NetworkConfig",
".",
"CAInfo"
]
| train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAClient.java#L343-L356 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-displayer/src/main/java/org/xwiki/displayer/internal/DefaultHTMLDisplayerManager.java | DefaultHTMLDisplayerManager.getHTMLDisplayer | @Override
public <T> HTMLDisplayer<T> getHTMLDisplayer(Type targetType, String roleHint) throws HTMLDisplayerException {
"""
{@inheritDoc}
<p>
Example: if the target type is <code>A<B<C>></code> with {@code hint} hint, the following lookups
will be made until a {@link HTMLDisplayer} component is found:
<ul>
<li>Component: <code>HTMLDisplayer<A<B<C>>></code>; Role: {@code hint}
<li>Component: <code>HTMLDisplayer<A<B>></code>; Role: {@code hint}
<li>Component: <code>HTMLDisplayer<A></code>; Role: {@code hint}
<li>Component: {@code HTMLDisplayer}; Role: {@code hint}
<li>Component: {@code HTMLDisplayer}; Role: default
</ul>
"""
try {
HTMLDisplayer<T> component;
ComponentManager componentManager = this.componentManagerProvider.get();
Type type = targetType;
Type displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type);
while (!componentManager.hasComponent(displayerType, roleHint) && type instanceof ParameterizedType) {
type = ((ParameterizedType) type).getRawType();
displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type);
}
if (!componentManager.hasComponent(displayerType, roleHint)) {
displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, Object.class);
}
if (componentManager.hasComponent(displayerType, roleHint)) {
component = componentManager.getInstance(displayerType, roleHint);
} else {
component = componentManager.getInstance(displayerType);
}
return component;
} catch (ComponentLookupException e) {
throw new HTMLDisplayerException("Failed to initialized the HTML displayer for target type [" + targetType
+ "] and role [" + String.valueOf(roleHint) + "]", e);
}
} | java | @Override
public <T> HTMLDisplayer<T> getHTMLDisplayer(Type targetType, String roleHint) throws HTMLDisplayerException
{
try {
HTMLDisplayer<T> component;
ComponentManager componentManager = this.componentManagerProvider.get();
Type type = targetType;
Type displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type);
while (!componentManager.hasComponent(displayerType, roleHint) && type instanceof ParameterizedType) {
type = ((ParameterizedType) type).getRawType();
displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type);
}
if (!componentManager.hasComponent(displayerType, roleHint)) {
displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, Object.class);
}
if (componentManager.hasComponent(displayerType, roleHint)) {
component = componentManager.getInstance(displayerType, roleHint);
} else {
component = componentManager.getInstance(displayerType);
}
return component;
} catch (ComponentLookupException e) {
throw new HTMLDisplayerException("Failed to initialized the HTML displayer for target type [" + targetType
+ "] and role [" + String.valueOf(roleHint) + "]", e);
}
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"HTMLDisplayer",
"<",
"T",
">",
"getHTMLDisplayer",
"(",
"Type",
"targetType",
",",
"String",
"roleHint",
")",
"throws",
"HTMLDisplayerException",
"{",
"try",
"{",
"HTMLDisplayer",
"<",
"T",
">",
"component",
";",
"ComponentManager",
"componentManager",
"=",
"this",
".",
"componentManagerProvider",
".",
"get",
"(",
")",
";",
"Type",
"type",
"=",
"targetType",
";",
"Type",
"displayerType",
"=",
"new",
"DefaultParameterizedType",
"(",
"null",
",",
"HTMLDisplayer",
".",
"class",
",",
"type",
")",
";",
"while",
"(",
"!",
"componentManager",
".",
"hasComponent",
"(",
"displayerType",
",",
"roleHint",
")",
"&&",
"type",
"instanceof",
"ParameterizedType",
")",
"{",
"type",
"=",
"(",
"(",
"ParameterizedType",
")",
"type",
")",
".",
"getRawType",
"(",
")",
";",
"displayerType",
"=",
"new",
"DefaultParameterizedType",
"(",
"null",
",",
"HTMLDisplayer",
".",
"class",
",",
"type",
")",
";",
"}",
"if",
"(",
"!",
"componentManager",
".",
"hasComponent",
"(",
"displayerType",
",",
"roleHint",
")",
")",
"{",
"displayerType",
"=",
"new",
"DefaultParameterizedType",
"(",
"null",
",",
"HTMLDisplayer",
".",
"class",
",",
"Object",
".",
"class",
")",
";",
"}",
"if",
"(",
"componentManager",
".",
"hasComponent",
"(",
"displayerType",
",",
"roleHint",
")",
")",
"{",
"component",
"=",
"componentManager",
".",
"getInstance",
"(",
"displayerType",
",",
"roleHint",
")",
";",
"}",
"else",
"{",
"component",
"=",
"componentManager",
".",
"getInstance",
"(",
"displayerType",
")",
";",
"}",
"return",
"component",
";",
"}",
"catch",
"(",
"ComponentLookupException",
"e",
")",
"{",
"throw",
"new",
"HTMLDisplayerException",
"(",
"\"Failed to initialized the HTML displayer for target type [\"",
"+",
"targetType",
"+",
"\"] and role [\"",
"+",
"String",
".",
"valueOf",
"(",
"roleHint",
")",
"+",
"\"]\"",
",",
"e",
")",
";",
"}",
"}"
]
| {@inheritDoc}
<p>
Example: if the target type is <code>A<B<C>></code> with {@code hint} hint, the following lookups
will be made until a {@link HTMLDisplayer} component is found:
<ul>
<li>Component: <code>HTMLDisplayer<A<B<C>>></code>; Role: {@code hint}
<li>Component: <code>HTMLDisplayer<A<B>></code>; Role: {@code hint}
<li>Component: <code>HTMLDisplayer<A></code>; Role: {@code hint}
<li>Component: {@code HTMLDisplayer}; Role: {@code hint}
<li>Component: {@code HTMLDisplayer}; Role: default
</ul> | [
"{"
]
| train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-displayer/src/main/java/org/xwiki/displayer/internal/DefaultHTMLDisplayerManager.java#L75-L102 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/inventory/message/UpdateInventorySlotsMessage.java | UpdateInventorySlotsMessage.updatePickedItemStack | public static void updatePickedItemStack(ItemStack itemStack, EntityPlayerMP player, int windowId) {
"""
Sends a {@link Packet} to player to update the picked {@link ItemStack}.
@param itemStack the item stack
@param player the player
@param windowId the window id
"""
Packet packet = new Packet(PICKEDITEM, windowId);
packet.draggedItemStack(itemStack);
MalisisCore.network.sendTo(packet, player);
} | java | public static void updatePickedItemStack(ItemStack itemStack, EntityPlayerMP player, int windowId)
{
Packet packet = new Packet(PICKEDITEM, windowId);
packet.draggedItemStack(itemStack);
MalisisCore.network.sendTo(packet, player);
} | [
"public",
"static",
"void",
"updatePickedItemStack",
"(",
"ItemStack",
"itemStack",
",",
"EntityPlayerMP",
"player",
",",
"int",
"windowId",
")",
"{",
"Packet",
"packet",
"=",
"new",
"Packet",
"(",
"PICKEDITEM",
",",
"windowId",
")",
";",
"packet",
".",
"draggedItemStack",
"(",
"itemStack",
")",
";",
"MalisisCore",
".",
"network",
".",
"sendTo",
"(",
"packet",
",",
"player",
")",
";",
"}"
]
| Sends a {@link Packet} to player to update the picked {@link ItemStack}.
@param itemStack the item stack
@param player the player
@param windowId the window id | [
"Sends",
"a",
"{",
"@link",
"Packet",
"}",
"to",
"player",
"to",
"update",
"the",
"picked",
"{",
"@link",
"ItemStack",
"}",
"."
]
| train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/inventory/message/UpdateInventorySlotsMessage.java#L106-L111 |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaReader.java | AstaReader.processCalendar | public void processCalendar(Row calendarRow, Map<Integer, Row> workPatternMap, Map<Integer, List<Row>> workPatternAssignmentMap, Map<Integer, List<Row>> exceptionAssignmentMap, Map<Integer, List<Row>> timeEntryMap, Map<Integer, DayType> exceptionTypeMap) {
"""
Creates a ProjectCalendar instance from the Asta data.
@param calendarRow basic calendar data
@param workPatternMap work pattern map
@param workPatternAssignmentMap work pattern assignment map
@param exceptionAssignmentMap exception assignment map
@param timeEntryMap time entry map
@param exceptionTypeMap exception type map
"""
//
// Create the calendar and add the default working hours
//
ProjectCalendar calendar = m_project.addCalendar();
Integer dominantWorkPatternID = calendarRow.getInteger("DOMINANT_WORK_PATTERN");
calendar.setUniqueID(calendarRow.getInteger("CALENDARID"));
processWorkPattern(calendar, dominantWorkPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
calendar.setName(calendarRow.getString("NAMK"));
//
// Add any additional working weeks
//
List<Row> rows = workPatternAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Integer workPatternID = row.getInteger("WORK_PATTERN");
if (!workPatternID.equals(dominantWorkPatternID))
{
ProjectCalendarWeek week = calendar.addWorkWeek();
week.setDateRange(new DateRange(row.getDate("START_DATE"), row.getDate("END_DATE")));
processWorkPattern(week, workPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
}
}
}
//
// Add exceptions - not sure how exceptions which turn non-working days into working days are handled by Asta - if at all?
//
rows = exceptionAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Date startDate = row.getDate("STARU_DATE");
Date endDate = row.getDate("ENE_DATE");
calendar.addCalendarException(startDate, endDate);
}
}
m_eventManager.fireCalendarReadEvent(calendar);
} | java | public void processCalendar(Row calendarRow, Map<Integer, Row> workPatternMap, Map<Integer, List<Row>> workPatternAssignmentMap, Map<Integer, List<Row>> exceptionAssignmentMap, Map<Integer, List<Row>> timeEntryMap, Map<Integer, DayType> exceptionTypeMap)
{
//
// Create the calendar and add the default working hours
//
ProjectCalendar calendar = m_project.addCalendar();
Integer dominantWorkPatternID = calendarRow.getInteger("DOMINANT_WORK_PATTERN");
calendar.setUniqueID(calendarRow.getInteger("CALENDARID"));
processWorkPattern(calendar, dominantWorkPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
calendar.setName(calendarRow.getString("NAMK"));
//
// Add any additional working weeks
//
List<Row> rows = workPatternAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Integer workPatternID = row.getInteger("WORK_PATTERN");
if (!workPatternID.equals(dominantWorkPatternID))
{
ProjectCalendarWeek week = calendar.addWorkWeek();
week.setDateRange(new DateRange(row.getDate("START_DATE"), row.getDate("END_DATE")));
processWorkPattern(week, workPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
}
}
}
//
// Add exceptions - not sure how exceptions which turn non-working days into working days are handled by Asta - if at all?
//
rows = exceptionAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Date startDate = row.getDate("STARU_DATE");
Date endDate = row.getDate("ENE_DATE");
calendar.addCalendarException(startDate, endDate);
}
}
m_eventManager.fireCalendarReadEvent(calendar);
} | [
"public",
"void",
"processCalendar",
"(",
"Row",
"calendarRow",
",",
"Map",
"<",
"Integer",
",",
"Row",
">",
"workPatternMap",
",",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"workPatternAssignmentMap",
",",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"exceptionAssignmentMap",
",",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"timeEntryMap",
",",
"Map",
"<",
"Integer",
",",
"DayType",
">",
"exceptionTypeMap",
")",
"{",
"//",
"// Create the calendar and add the default working hours",
"//",
"ProjectCalendar",
"calendar",
"=",
"m_project",
".",
"addCalendar",
"(",
")",
";",
"Integer",
"dominantWorkPatternID",
"=",
"calendarRow",
".",
"getInteger",
"(",
"\"DOMINANT_WORK_PATTERN\"",
")",
";",
"calendar",
".",
"setUniqueID",
"(",
"calendarRow",
".",
"getInteger",
"(",
"\"CALENDARID\"",
")",
")",
";",
"processWorkPattern",
"(",
"calendar",
",",
"dominantWorkPatternID",
",",
"workPatternMap",
",",
"timeEntryMap",
",",
"exceptionTypeMap",
")",
";",
"calendar",
".",
"setName",
"(",
"calendarRow",
".",
"getString",
"(",
"\"NAMK\"",
")",
")",
";",
"//",
"// Add any additional working weeks",
"//",
"List",
"<",
"Row",
">",
"rows",
"=",
"workPatternAssignmentMap",
".",
"get",
"(",
"calendar",
".",
"getUniqueID",
"(",
")",
")",
";",
"if",
"(",
"rows",
"!=",
"null",
")",
"{",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"Integer",
"workPatternID",
"=",
"row",
".",
"getInteger",
"(",
"\"WORK_PATTERN\"",
")",
";",
"if",
"(",
"!",
"workPatternID",
".",
"equals",
"(",
"dominantWorkPatternID",
")",
")",
"{",
"ProjectCalendarWeek",
"week",
"=",
"calendar",
".",
"addWorkWeek",
"(",
")",
";",
"week",
".",
"setDateRange",
"(",
"new",
"DateRange",
"(",
"row",
".",
"getDate",
"(",
"\"START_DATE\"",
")",
",",
"row",
".",
"getDate",
"(",
"\"END_DATE\"",
")",
")",
")",
";",
"processWorkPattern",
"(",
"week",
",",
"workPatternID",
",",
"workPatternMap",
",",
"timeEntryMap",
",",
"exceptionTypeMap",
")",
";",
"}",
"}",
"}",
"//",
"// Add exceptions - not sure how exceptions which turn non-working days into working days are handled by Asta - if at all?",
"//",
"rows",
"=",
"exceptionAssignmentMap",
".",
"get",
"(",
"calendar",
".",
"getUniqueID",
"(",
")",
")",
";",
"if",
"(",
"rows",
"!=",
"null",
")",
"{",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"Date",
"startDate",
"=",
"row",
".",
"getDate",
"(",
"\"STARU_DATE\"",
")",
";",
"Date",
"endDate",
"=",
"row",
".",
"getDate",
"(",
"\"ENE_DATE\"",
")",
";",
"calendar",
".",
"addCalendarException",
"(",
"startDate",
",",
"endDate",
")",
";",
"}",
"}",
"m_eventManager",
".",
"fireCalendarReadEvent",
"(",
"calendar",
")",
";",
"}"
]
| Creates a ProjectCalendar instance from the Asta data.
@param calendarRow basic calendar data
@param workPatternMap work pattern map
@param workPatternAssignmentMap work pattern assignment map
@param exceptionAssignmentMap exception assignment map
@param timeEntryMap time entry map
@param exceptionTypeMap exception type map | [
"Creates",
"a",
"ProjectCalendar",
"instance",
"from",
"the",
"Asta",
"data",
"."
]
| train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L1191-L1235 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WValidationErrorsRenderer.java | WValidationErrorsRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
"""
Paints the given {@link WValidationErrors} component.
@param component The {@link WValidationErrors} component to paint.
@param renderContext the RenderContext to paint to.
"""
WValidationErrors errors = (WValidationErrors) component;
XmlStringBuilder xml = renderContext.getWriter();
if (errors.hasErrors()) {
xml.appendTagOpen("ui:validationerrors");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("title", errors.getTitleText());
xml.appendClose();
for (GroupedDiagnositcs nextGroup : errors.getGroupedErrors()) {
// Render each diagnostic message in this group.
for (Diagnostic nextMessage : nextGroup.getDiagnostics()) {
xml.appendTagOpen("ui:error");
WComponent forComponent = nextMessage.getComponent();
if (forComponent != null) {
UIContextHolder.pushContext(nextMessage.getContext());
try {
xml.appendAttribute("for", forComponent.getId());
} finally {
UIContextHolder.popContext();
}
}
xml.appendClose();
// DiagnosticImpl has been extended to support rendering
// of a WComponent as the message.
if (nextMessage instanceof DiagnosticImpl) {
WComponent messageComponent = ((DiagnosticImpl) nextMessage)
.createDiagnosticErrorComponent();
// We add the component to a throw-away container so that it renders with the correct ID.
WContainer container = new WContainer() {
@Override
public String getId() {
return component.getId();
}
};
container.add(messageComponent);
messageComponent.paint(renderContext);
container.remove(messageComponent);
container.reset();
} else {
xml.append(nextMessage.getDescription());
}
xml.appendEndTag("ui:error");
}
}
xml.appendEndTag("ui:validationerrors");
}
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WValidationErrors errors = (WValidationErrors) component;
XmlStringBuilder xml = renderContext.getWriter();
if (errors.hasErrors()) {
xml.appendTagOpen("ui:validationerrors");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("title", errors.getTitleText());
xml.appendClose();
for (GroupedDiagnositcs nextGroup : errors.getGroupedErrors()) {
// Render each diagnostic message in this group.
for (Diagnostic nextMessage : nextGroup.getDiagnostics()) {
xml.appendTagOpen("ui:error");
WComponent forComponent = nextMessage.getComponent();
if (forComponent != null) {
UIContextHolder.pushContext(nextMessage.getContext());
try {
xml.appendAttribute("for", forComponent.getId());
} finally {
UIContextHolder.popContext();
}
}
xml.appendClose();
// DiagnosticImpl has been extended to support rendering
// of a WComponent as the message.
if (nextMessage instanceof DiagnosticImpl) {
WComponent messageComponent = ((DiagnosticImpl) nextMessage)
.createDiagnosticErrorComponent();
// We add the component to a throw-away container so that it renders with the correct ID.
WContainer container = new WContainer() {
@Override
public String getId() {
return component.getId();
}
};
container.add(messageComponent);
messageComponent.paint(renderContext);
container.remove(messageComponent);
container.reset();
} else {
xml.append(nextMessage.getDescription());
}
xml.appendEndTag("ui:error");
}
}
xml.appendEndTag("ui:validationerrors");
}
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WValidationErrors",
"errors",
"=",
"(",
"WValidationErrors",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"if",
"(",
"errors",
".",
"hasErrors",
"(",
")",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:validationerrors\"",
")",
";",
"xml",
".",
"appendAttribute",
"(",
"\"id\"",
",",
"component",
".",
"getId",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"class\"",
",",
"component",
".",
"getHtmlClass",
"(",
")",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"track\"",
",",
"component",
".",
"isTracking",
"(",
")",
",",
"\"true\"",
")",
";",
"xml",
".",
"appendOptionalAttribute",
"(",
"\"title\"",
",",
"errors",
".",
"getTitleText",
"(",
")",
")",
";",
"xml",
".",
"appendClose",
"(",
")",
";",
"for",
"(",
"GroupedDiagnositcs",
"nextGroup",
":",
"errors",
".",
"getGroupedErrors",
"(",
")",
")",
"{",
"// Render each diagnostic message in this group.",
"for",
"(",
"Diagnostic",
"nextMessage",
":",
"nextGroup",
".",
"getDiagnostics",
"(",
")",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:error\"",
")",
";",
"WComponent",
"forComponent",
"=",
"nextMessage",
".",
"getComponent",
"(",
")",
";",
"if",
"(",
"forComponent",
"!=",
"null",
")",
"{",
"UIContextHolder",
".",
"pushContext",
"(",
"nextMessage",
".",
"getContext",
"(",
")",
")",
";",
"try",
"{",
"xml",
".",
"appendAttribute",
"(",
"\"for\"",
",",
"forComponent",
".",
"getId",
"(",
")",
")",
";",
"}",
"finally",
"{",
"UIContextHolder",
".",
"popContext",
"(",
")",
";",
"}",
"}",
"xml",
".",
"appendClose",
"(",
")",
";",
"// DiagnosticImpl has been extended to support rendering",
"// of a WComponent as the message.",
"if",
"(",
"nextMessage",
"instanceof",
"DiagnosticImpl",
")",
"{",
"WComponent",
"messageComponent",
"=",
"(",
"(",
"DiagnosticImpl",
")",
"nextMessage",
")",
".",
"createDiagnosticErrorComponent",
"(",
")",
";",
"// We add the component to a throw-away container so that it renders with the correct ID.",
"WContainer",
"container",
"=",
"new",
"WContainer",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"getId",
"(",
")",
"{",
"return",
"component",
".",
"getId",
"(",
")",
";",
"}",
"}",
";",
"container",
".",
"add",
"(",
"messageComponent",
")",
";",
"messageComponent",
".",
"paint",
"(",
"renderContext",
")",
";",
"container",
".",
"remove",
"(",
"messageComponent",
")",
";",
"container",
".",
"reset",
"(",
")",
";",
"}",
"else",
"{",
"xml",
".",
"append",
"(",
"nextMessage",
".",
"getDescription",
"(",
")",
")",
";",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:error\"",
")",
";",
"}",
"}",
"xml",
".",
"appendEndTag",
"(",
"\"ui:validationerrors\"",
")",
";",
"}",
"}"
]
| Paints the given {@link WValidationErrors} component.
@param component The {@link WValidationErrors} component to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"{",
"@link",
"WValidationErrors",
"}",
"component",
"."
]
| train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WValidationErrorsRenderer.java#L28-L87 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/SecurityUtil.java | SecurityUtil.getUrlMapping | public static String getUrlMapping(String url, Map<String, String> urlMappings) {
"""
Returns the target of a url pattern mapping.
@param url Ant-style url pattern
@param urlMappings Map of url pattern mappings
@return String mapped to pattern, or null if none.
"""
if (urlMappings != null) {
for (String pattern : urlMappings.keySet()) {
if (urlMatcher.match(pattern, url)) {
return urlMappings.get(pattern);
}
}
}
return null;
} | java | public static String getUrlMapping(String url, Map<String, String> urlMappings) {
if (urlMappings != null) {
for (String pattern : urlMappings.keySet()) {
if (urlMatcher.match(pattern, url)) {
return urlMappings.get(pattern);
}
}
}
return null;
} | [
"public",
"static",
"String",
"getUrlMapping",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"String",
">",
"urlMappings",
")",
"{",
"if",
"(",
"urlMappings",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"pattern",
":",
"urlMappings",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"urlMatcher",
".",
"match",
"(",
"pattern",
",",
"url",
")",
")",
"{",
"return",
"urlMappings",
".",
"get",
"(",
"pattern",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
]
| Returns the target of a url pattern mapping.
@param url Ant-style url pattern
@param urlMappings Map of url pattern mappings
@return String mapped to pattern, or null if none. | [
"Returns",
"the",
"target",
"of",
"a",
"url",
"pattern",
"mapping",
"."
]
| train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/SecurityUtil.java#L156-L166 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/RebindConfiguration.java | RebindConfiguration.isTypeSupportedForSerialization | public boolean isTypeSupportedForSerialization( TreeLogger logger, JClassType classType ) {
"""
<p>isTypeSupportedForSerialization</p>
@param logger a {@link com.google.gwt.core.ext.TreeLogger} object.
@param classType a {@link com.google.gwt.core.ext.typeinfo.JClassType} object.
@return a boolean.
"""
return allSupportedSerializationClass.contains( classType )
|| additionalSupportedTypes.isIncluded( logger, classType.getQualifiedSourceName() );
} | java | public boolean isTypeSupportedForSerialization( TreeLogger logger, JClassType classType ) {
return allSupportedSerializationClass.contains( classType )
|| additionalSupportedTypes.isIncluded( logger, classType.getQualifiedSourceName() );
} | [
"public",
"boolean",
"isTypeSupportedForSerialization",
"(",
"TreeLogger",
"logger",
",",
"JClassType",
"classType",
")",
"{",
"return",
"allSupportedSerializationClass",
".",
"contains",
"(",
"classType",
")",
"||",
"additionalSupportedTypes",
".",
"isIncluded",
"(",
"logger",
",",
"classType",
".",
"getQualifiedSourceName",
"(",
")",
")",
";",
"}"
]
| <p>isTypeSupportedForSerialization</p>
@param logger a {@link com.google.gwt.core.ext.TreeLogger} object.
@param classType a {@link com.google.gwt.core.ext.typeinfo.JClassType} object.
@return a boolean. | [
"<p",
">",
"isTypeSupportedForSerialization<",
"/",
"p",
">"
]
| train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/RebindConfiguration.java#L612-L615 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java | DatabasesInner.listByServer | public List<DatabaseInner> listByServer(String resourceGroupName, String serverName, String expand, String filter) {
"""
Returns a list of databases in a server.
@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 expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption.
@param filter An OData filter expression that describes a subset of databases to return.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<DatabaseInner> object if successful.
"""
return listByServerWithServiceResponseAsync(resourceGroupName, serverName, expand, filter).toBlocking().single().body();
} | java | public List<DatabaseInner> listByServer(String resourceGroupName, String serverName, String expand, String filter) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName, expand, filter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"DatabaseInner",
">",
"listByServer",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"expand",
",",
"String",
"filter",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"expand",
",",
"filter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Returns a list of databases in a server.
@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 expand A comma separated list of child objects to expand in the response. Possible properties: serviceTierAdvisors, transparentDataEncryption.
@param filter An OData filter expression that describes a subset of databases to return.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<DatabaseInner> object if successful. | [
"Returns",
"a",
"list",
"of",
"databases",
"in",
"a",
"server",
"."
]
| 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/DatabasesInner.java#L1243-L1245 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseScsr2gebsr_bufferSize | public static int cusparseScsr2gebsr_bufferSize(
cusparseHandle handle,
int dirA,
int m,
int n,
cusparseMatDescr descrA,
Pointer csrSortedValA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
int rowBlockDim,
int colBlockDim,
int[] pBufferSizeInBytes) {
"""
Description: This routine converts a sparse matrix in CSR storage format
to a sparse matrix in general block-CSR storage format.
"""
return checkResult(cusparseScsr2gebsr_bufferSizeNative(handle, dirA, m, n, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, rowBlockDim, colBlockDim, pBufferSizeInBytes));
} | java | public static int cusparseScsr2gebsr_bufferSize(
cusparseHandle handle,
int dirA,
int m,
int n,
cusparseMatDescr descrA,
Pointer csrSortedValA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
int rowBlockDim,
int colBlockDim,
int[] pBufferSizeInBytes)
{
return checkResult(cusparseScsr2gebsr_bufferSizeNative(handle, dirA, m, n, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, rowBlockDim, colBlockDim, pBufferSizeInBytes));
} | [
"public",
"static",
"int",
"cusparseScsr2gebsr_bufferSize",
"(",
"cusparseHandle",
"handle",
",",
"int",
"dirA",
",",
"int",
"m",
",",
"int",
"n",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrSortedValA",
",",
"Pointer",
"csrSortedRowPtrA",
",",
"Pointer",
"csrSortedColIndA",
",",
"int",
"rowBlockDim",
",",
"int",
"colBlockDim",
",",
"int",
"[",
"]",
"pBufferSizeInBytes",
")",
"{",
"return",
"checkResult",
"(",
"cusparseScsr2gebsr_bufferSizeNative",
"(",
"handle",
",",
"dirA",
",",
"m",
",",
"n",
",",
"descrA",
",",
"csrSortedValA",
",",
"csrSortedRowPtrA",
",",
"csrSortedColIndA",
",",
"rowBlockDim",
",",
"colBlockDim",
",",
"pBufferSizeInBytes",
")",
")",
";",
"}"
]
| Description: This routine converts a sparse matrix in CSR storage format
to a sparse matrix in general block-CSR storage format. | [
"Description",
":",
"This",
"routine",
"converts",
"a",
"sparse",
"matrix",
"in",
"CSR",
"storage",
"format",
"to",
"a",
"sparse",
"matrix",
"in",
"general",
"block",
"-",
"CSR",
"storage",
"format",
"."
]
| train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L13199-L13213 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Timestamp.java | Timestamp.ofTimeSecondsAndNanos | public static Timestamp ofTimeSecondsAndNanos(long seconds, int nanos) {
"""
Creates an instance representing the value of {@code seconds} and {@code nanos} since January
1, 1970, 00:00:00 UTC.
@param seconds seconds since January 1, 1970, 00:00:00 UTC. A negative value is the number of
seconds before January 1, 1970, 00:00:00 UTC.
@param nanos the fractional seconds component, in the range 0..999999999.
@throws IllegalArgumentException if the timestamp is outside the representable range
"""
checkArgument(
Timestamps.isValid(seconds, nanos), "timestamp out of range: %s, %s", seconds, nanos);
return new Timestamp(seconds, nanos);
} | java | public static Timestamp ofTimeSecondsAndNanos(long seconds, int nanos) {
checkArgument(
Timestamps.isValid(seconds, nanos), "timestamp out of range: %s, %s", seconds, nanos);
return new Timestamp(seconds, nanos);
} | [
"public",
"static",
"Timestamp",
"ofTimeSecondsAndNanos",
"(",
"long",
"seconds",
",",
"int",
"nanos",
")",
"{",
"checkArgument",
"(",
"Timestamps",
".",
"isValid",
"(",
"seconds",
",",
"nanos",
")",
",",
"\"timestamp out of range: %s, %s\"",
",",
"seconds",
",",
"nanos",
")",
";",
"return",
"new",
"Timestamp",
"(",
"seconds",
",",
"nanos",
")",
";",
"}"
]
| Creates an instance representing the value of {@code seconds} and {@code nanos} since January
1, 1970, 00:00:00 UTC.
@param seconds seconds since January 1, 1970, 00:00:00 UTC. A negative value is the number of
seconds before January 1, 1970, 00:00:00 UTC.
@param nanos the fractional seconds component, in the range 0..999999999.
@throws IllegalArgumentException if the timestamp is outside the representable range | [
"Creates",
"an",
"instance",
"representing",
"the",
"value",
"of",
"{",
"@code",
"seconds",
"}",
"and",
"{",
"@code",
"nanos",
"}",
"since",
"January",
"1",
"1970",
"00",
":",
"00",
":",
"00",
"UTC",
"."
]
| train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Timestamp.java#L78-L82 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/PackageUrl.java | PackageUrl.deletePackageUrl | public static MozuUrl deletePackageUrl(String packageId, String returnId) {
"""
Get Resource Url for DeletePackage
@param packageId Unique identifier of the package for which to retrieve the label.
@param returnId Unique identifier of the return whose items you want to get.
@return String Resource Url
"""
UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/packages/{packageId}");
formatter.formatUrl("packageId", packageId);
formatter.formatUrl("returnId", returnId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deletePackageUrl(String packageId, String returnId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/packages/{packageId}");
formatter.formatUrl("packageId", packageId);
formatter.formatUrl("returnId", returnId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deletePackageUrl",
"(",
"String",
"packageId",
",",
"String",
"returnId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/returns/{returnId}/packages/{packageId}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"packageId\"",
",",
"packageId",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"returnId\"",
",",
"returnId",
")",
";",
"return",
"new",
"MozuUrl",
"(",
"formatter",
".",
"getResourceUrl",
"(",
")",
",",
"MozuUrl",
".",
"UrlLocation",
".",
"TENANT_POD",
")",
";",
"}"
]
| Get Resource Url for DeletePackage
@param packageId Unique identifier of the package for which to retrieve the label.
@param returnId Unique identifier of the return whose items you want to get.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeletePackage"
]
| train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/PackageUrl.java#L84-L90 |
Stratio/deep-spark | deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java | Cells.getDate | public Date getDate(String nameSpace, String cellName) {
"""
Returns the {@code Date} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or null
if this Cells object contains no cell whose name is cellName.
@param nameSpace the name of the owning table
@param cellName the name of the Cell we want to retrieve from this Cells object.
@return the {@code Date} value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null
if this Cells object contains no cell whose name is cellName
"""
return getValue(nameSpace, cellName, Date.class);
} | java | public Date getDate(String nameSpace, String cellName) {
return getValue(nameSpace, cellName, Date.class);
} | [
"public",
"Date",
"getDate",
"(",
"String",
"nameSpace",
",",
"String",
"cellName",
")",
"{",
"return",
"getValue",
"(",
"nameSpace",
",",
"cellName",
",",
"Date",
".",
"class",
")",
";",
"}"
]
| Returns the {@code Date} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or null
if this Cells object contains no cell whose name is cellName.
@param nameSpace the name of the owning table
@param cellName the name of the Cell we want to retrieve from this Cells object.
@return the {@code Date} value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null
if this Cells object contains no cell whose name is cellName | [
"Returns",
"the",
"{",
"@code",
"Date",
"}",
"value",
"of",
"the",
"{",
"@link",
"Cell",
"}",
"(",
"associated",
"to",
"{",
"@code",
"table",
"}",
")",
"whose",
"name",
"iscellName",
"or",
"null",
"if",
"this",
"Cells",
"object",
"contains",
"no",
"cell",
"whose",
"name",
"is",
"cellName",
"."
]
| train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L883-L885 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/color/ColorLab.java | ColorLab.srgbToLab | public static void srgbToLab( float r , float g , float b , float lab[] ) {
"""
Conversion from normalized RGB into LAB. Normalized RGB values have a range of 0:1
"""
ColorXyz.srgbToXyz(r,g,b,lab);
float X = lab[0];
float Y = lab[1];
float Z = lab[2];
float xr = X/Xr_f;
float yr = Y/Yr_f;
float zr = Z/Zr_f;
float fx, fy, fz;
if(xr > epsilon_f) fx = (float)Math.pow(xr, 1.0f/3.0f);
else fx = (kappa_f*xr + 16.0f)/116.0f;
if(yr > epsilon_f) fy = (float)Math.pow(yr, 1.0/3.0f);
else fy = (kappa_f*yr + 16.0f)/116.0f;
if(zr > epsilon_f) fz = (float)Math.pow(zr, 1.0/3.0f);
else fz = (kappa_f*zr + 16.0f)/116.0f;
lab[0] = 116.0f*fy-16.0f;
lab[1] = 500.0f*(fx-fy);
lab[2] = 200.0f*(fy-fz);
} | java | public static void srgbToLab( float r , float g , float b , float lab[] ) {
ColorXyz.srgbToXyz(r,g,b,lab);
float X = lab[0];
float Y = lab[1];
float Z = lab[2];
float xr = X/Xr_f;
float yr = Y/Yr_f;
float zr = Z/Zr_f;
float fx, fy, fz;
if(xr > epsilon_f) fx = (float)Math.pow(xr, 1.0f/3.0f);
else fx = (kappa_f*xr + 16.0f)/116.0f;
if(yr > epsilon_f) fy = (float)Math.pow(yr, 1.0/3.0f);
else fy = (kappa_f*yr + 16.0f)/116.0f;
if(zr > epsilon_f) fz = (float)Math.pow(zr, 1.0/3.0f);
else fz = (kappa_f*zr + 16.0f)/116.0f;
lab[0] = 116.0f*fy-16.0f;
lab[1] = 500.0f*(fx-fy);
lab[2] = 200.0f*(fy-fz);
} | [
"public",
"static",
"void",
"srgbToLab",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"lab",
"[",
"]",
")",
"{",
"ColorXyz",
".",
"srgbToXyz",
"(",
"r",
",",
"g",
",",
"b",
",",
"lab",
")",
";",
"float",
"X",
"=",
"lab",
"[",
"0",
"]",
";",
"float",
"Y",
"=",
"lab",
"[",
"1",
"]",
";",
"float",
"Z",
"=",
"lab",
"[",
"2",
"]",
";",
"float",
"xr",
"=",
"X",
"/",
"Xr_f",
";",
"float",
"yr",
"=",
"Y",
"/",
"Yr_f",
";",
"float",
"zr",
"=",
"Z",
"/",
"Zr_f",
";",
"float",
"fx",
",",
"fy",
",",
"fz",
";",
"if",
"(",
"xr",
">",
"epsilon_f",
")",
"fx",
"=",
"(",
"float",
")",
"Math",
".",
"pow",
"(",
"xr",
",",
"1.0f",
"/",
"3.0f",
")",
";",
"else",
"fx",
"=",
"(",
"kappa_f",
"*",
"xr",
"+",
"16.0f",
")",
"/",
"116.0f",
";",
"if",
"(",
"yr",
">",
"epsilon_f",
")",
"fy",
"=",
"(",
"float",
")",
"Math",
".",
"pow",
"(",
"yr",
",",
"1.0",
"/",
"3.0f",
")",
";",
"else",
"fy",
"=",
"(",
"kappa_f",
"*",
"yr",
"+",
"16.0f",
")",
"/",
"116.0f",
";",
"if",
"(",
"zr",
">",
"epsilon_f",
")",
"fz",
"=",
"(",
"float",
")",
"Math",
".",
"pow",
"(",
"zr",
",",
"1.0",
"/",
"3.0f",
")",
";",
"else",
"fz",
"=",
"(",
"kappa_f",
"*",
"zr",
"+",
"16.0f",
")",
"/",
"116.0f",
";",
"lab",
"[",
"0",
"]",
"=",
"116.0f",
"*",
"fy",
"-",
"16.0f",
";",
"lab",
"[",
"1",
"]",
"=",
"500.0f",
"*",
"(",
"fx",
"-",
"fy",
")",
";",
"lab",
"[",
"2",
"]",
"=",
"200.0f",
"*",
"(",
"fy",
"-",
"fz",
")",
";",
"}"
]
| Conversion from normalized RGB into LAB. Normalized RGB values have a range of 0:1 | [
"Conversion",
"from",
"normalized",
"RGB",
"into",
"LAB",
".",
"Normalized",
"RGB",
"values",
"have",
"a",
"range",
"of",
"0",
":",
"1"
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/color/ColorLab.java#L93-L115 |
Netflix/astyanax | astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftKeyspaceImpl.java | ThriftKeyspaceImpl.toThriftColumnFamilyDefinition | private ThriftColumnFamilyDefinitionImpl toThriftColumnFamilyDefinition(Map<String, Object> options, ColumnFamily columnFamily) {
"""
Convert a Map of options to an internal thrift column family definition
@param options
"""
ThriftColumnFamilyDefinitionImpl def = new ThriftColumnFamilyDefinitionImpl();
Map<String, Object> internalOptions = Maps.newHashMap();
if (options != null)
internalOptions.putAll(options);
internalOptions.put("keyspace", getKeyspaceName());
if (columnFamily != null) {
internalOptions.put("name", columnFamily.getName());
if (!internalOptions.containsKey("comparator_type"))
internalOptions.put("comparator_type", columnFamily.getColumnSerializer().getComparatorType().getTypeName());
if (!internalOptions.containsKey("key_validation_class"))
internalOptions.put("key_validation_class", columnFamily.getKeySerializer().getComparatorType().getTypeName());
if (columnFamily.getDefaultValueSerializer() != null && !internalOptions.containsKey("default_validation_class"))
internalOptions.put("default_validation_class", columnFamily.getDefaultValueSerializer().getComparatorType().getTypeName());
}
def.setFields(internalOptions);
return def;
} | java | private ThriftColumnFamilyDefinitionImpl toThriftColumnFamilyDefinition(Map<String, Object> options, ColumnFamily columnFamily) {
ThriftColumnFamilyDefinitionImpl def = new ThriftColumnFamilyDefinitionImpl();
Map<String, Object> internalOptions = Maps.newHashMap();
if (options != null)
internalOptions.putAll(options);
internalOptions.put("keyspace", getKeyspaceName());
if (columnFamily != null) {
internalOptions.put("name", columnFamily.getName());
if (!internalOptions.containsKey("comparator_type"))
internalOptions.put("comparator_type", columnFamily.getColumnSerializer().getComparatorType().getTypeName());
if (!internalOptions.containsKey("key_validation_class"))
internalOptions.put("key_validation_class", columnFamily.getKeySerializer().getComparatorType().getTypeName());
if (columnFamily.getDefaultValueSerializer() != null && !internalOptions.containsKey("default_validation_class"))
internalOptions.put("default_validation_class", columnFamily.getDefaultValueSerializer().getComparatorType().getTypeName());
}
def.setFields(internalOptions);
return def;
} | [
"private",
"ThriftColumnFamilyDefinitionImpl",
"toThriftColumnFamilyDefinition",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
",",
"ColumnFamily",
"columnFamily",
")",
"{",
"ThriftColumnFamilyDefinitionImpl",
"def",
"=",
"new",
"ThriftColumnFamilyDefinitionImpl",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"internalOptions",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"if",
"(",
"options",
"!=",
"null",
")",
"internalOptions",
".",
"putAll",
"(",
"options",
")",
";",
"internalOptions",
".",
"put",
"(",
"\"keyspace\"",
",",
"getKeyspaceName",
"(",
")",
")",
";",
"if",
"(",
"columnFamily",
"!=",
"null",
")",
"{",
"internalOptions",
".",
"put",
"(",
"\"name\"",
",",
"columnFamily",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"!",
"internalOptions",
".",
"containsKey",
"(",
"\"comparator_type\"",
")",
")",
"internalOptions",
".",
"put",
"(",
"\"comparator_type\"",
",",
"columnFamily",
".",
"getColumnSerializer",
"(",
")",
".",
"getComparatorType",
"(",
")",
".",
"getTypeName",
"(",
")",
")",
";",
"if",
"(",
"!",
"internalOptions",
".",
"containsKey",
"(",
"\"key_validation_class\"",
")",
")",
"internalOptions",
".",
"put",
"(",
"\"key_validation_class\"",
",",
"columnFamily",
".",
"getKeySerializer",
"(",
")",
".",
"getComparatorType",
"(",
")",
".",
"getTypeName",
"(",
")",
")",
";",
"if",
"(",
"columnFamily",
".",
"getDefaultValueSerializer",
"(",
")",
"!=",
"null",
"&&",
"!",
"internalOptions",
".",
"containsKey",
"(",
"\"default_validation_class\"",
")",
")",
"internalOptions",
".",
"put",
"(",
"\"default_validation_class\"",
",",
"columnFamily",
".",
"getDefaultValueSerializer",
"(",
")",
".",
"getComparatorType",
"(",
")",
".",
"getTypeName",
"(",
")",
")",
";",
"}",
"def",
".",
"setFields",
"(",
"internalOptions",
")",
";",
"return",
"def",
";",
"}"
]
| Convert a Map of options to an internal thrift column family definition
@param options | [
"Convert",
"a",
"Map",
"of",
"options",
"to",
"an",
"internal",
"thrift",
"column",
"family",
"definition"
]
| train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftKeyspaceImpl.java#L773-L794 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java | TransliteratorIDParser.parseFilterID | public static SingleID parseFilterID(String id, int[] pos) {
"""
Parse a filter ID, that is, an ID of the general form
"[f1] s1-t1/v1", with the filters optional, and the variants optional.
@param id the id to be parsed
@param pos INPUT-OUTPUT parameter. On input, the position of
the first character to parse. On output, the position after
the last character parsed.
@return a SingleID object or null if the parse fails
"""
int start = pos[0];
Specs specs = parseFilterID(id, pos, true);
if (specs == null) {
pos[0] = start;
return null;
}
// Assemble return results
SingleID single = specsToID(specs, FORWARD);
single.filter = specs.filter;
return single;
} | java | public static SingleID parseFilterID(String id, int[] pos) {
int start = pos[0];
Specs specs = parseFilterID(id, pos, true);
if (specs == null) {
pos[0] = start;
return null;
}
// Assemble return results
SingleID single = specsToID(specs, FORWARD);
single.filter = specs.filter;
return single;
} | [
"public",
"static",
"SingleID",
"parseFilterID",
"(",
"String",
"id",
",",
"int",
"[",
"]",
"pos",
")",
"{",
"int",
"start",
"=",
"pos",
"[",
"0",
"]",
";",
"Specs",
"specs",
"=",
"parseFilterID",
"(",
"id",
",",
"pos",
",",
"true",
")",
";",
"if",
"(",
"specs",
"==",
"null",
")",
"{",
"pos",
"[",
"0",
"]",
"=",
"start",
";",
"return",
"null",
";",
"}",
"// Assemble return results",
"SingleID",
"single",
"=",
"specsToID",
"(",
"specs",
",",
"FORWARD",
")",
";",
"single",
".",
"filter",
"=",
"specs",
".",
"filter",
";",
"return",
"single",
";",
"}"
]
| Parse a filter ID, that is, an ID of the general form
"[f1] s1-t1/v1", with the filters optional, and the variants optional.
@param id the id to be parsed
@param pos INPUT-OUTPUT parameter. On input, the position of
the first character to parse. On output, the position after
the last character parsed.
@return a SingleID object or null if the parse fails | [
"Parse",
"a",
"filter",
"ID",
"that",
"is",
"an",
"ID",
"of",
"the",
"general",
"form",
"[",
"f1",
"]",
"s1",
"-",
"t1",
"/",
"v1",
"with",
"the",
"filters",
"optional",
"and",
"the",
"variants",
"optional",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java#L151-L164 |
jmrozanec/cron-utils | src/main/java/com/cronutils/descriptor/DescriptionStrategyFactory.java | DescriptionStrategyFactory.monthsInstance | public static DescriptionStrategy monthsInstance(final ResourceBundle bundle, final FieldExpression expression) {
"""
Creates description strategy for months.
@param bundle - locale
@param expression - CronFieldExpression
@return - DescriptionStrategy instance, never null
"""
return new NominalDescriptionStrategy(bundle, integer -> Month.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale()), expression);
} | java | public static DescriptionStrategy monthsInstance(final ResourceBundle bundle, final FieldExpression expression) {
return new NominalDescriptionStrategy(bundle, integer -> Month.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale()), expression);
} | [
"public",
"static",
"DescriptionStrategy",
"monthsInstance",
"(",
"final",
"ResourceBundle",
"bundle",
",",
"final",
"FieldExpression",
"expression",
")",
"{",
"return",
"new",
"NominalDescriptionStrategy",
"(",
"bundle",
",",
"integer",
"->",
"Month",
".",
"of",
"(",
"integer",
")",
".",
"getDisplayName",
"(",
"TextStyle",
".",
"FULL",
",",
"bundle",
".",
"getLocale",
"(",
")",
")",
",",
"expression",
")",
";",
"}"
]
| Creates description strategy for months.
@param bundle - locale
@param expression - CronFieldExpression
@return - DescriptionStrategy instance, never null | [
"Creates",
"description",
"strategy",
"for",
"months",
"."
]
| train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/DescriptionStrategyFactory.java#L104-L106 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java | TopicsInner.getByResourceGroup | public TopicInner getByResourceGroup(String resourceGroupName, String topicName) {
"""
Get a topic.
Get properties of a topic.
@param resourceGroupName The name of the resource group within the user's subscription.
@param topicName Name of the topic
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the TopicInner object if successful.
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, topicName).toBlocking().single().body();
} | java | public TopicInner getByResourceGroup(String resourceGroupName, String topicName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, topicName).toBlocking().single().body();
} | [
"public",
"TopicInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"topicName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"topicName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Get a topic.
Get properties of a topic.
@param resourceGroupName The name of the resource group within the user's subscription.
@param topicName Name of the topic
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the TopicInner object if successful. | [
"Get",
"a",
"topic",
".",
"Get",
"properties",
"of",
"a",
"topic",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L130-L132 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java | ComponentsInner.getPurgeStatusAsync | public Observable<ComponentPurgeStatusResponseInner> getPurgeStatusAsync(String resourceGroupName, String resourceName, String purgeId) {
"""
Get status for an ongoing purge operation.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param purgeId In a purge status request, this is the Id of the operation the status of which is returned.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ComponentPurgeStatusResponseInner object
"""
return getPurgeStatusWithServiceResponseAsync(resourceGroupName, resourceName, purgeId).map(new Func1<ServiceResponse<ComponentPurgeStatusResponseInner>, ComponentPurgeStatusResponseInner>() {
@Override
public ComponentPurgeStatusResponseInner call(ServiceResponse<ComponentPurgeStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<ComponentPurgeStatusResponseInner> getPurgeStatusAsync(String resourceGroupName, String resourceName, String purgeId) {
return getPurgeStatusWithServiceResponseAsync(resourceGroupName, resourceName, purgeId).map(new Func1<ServiceResponse<ComponentPurgeStatusResponseInner>, ComponentPurgeStatusResponseInner>() {
@Override
public ComponentPurgeStatusResponseInner call(ServiceResponse<ComponentPurgeStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ComponentPurgeStatusResponseInner",
">",
"getPurgeStatusAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"purgeId",
")",
"{",
"return",
"getPurgeStatusWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"purgeId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ComponentPurgeStatusResponseInner",
">",
",",
"ComponentPurgeStatusResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ComponentPurgeStatusResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"ComponentPurgeStatusResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Get status for an ongoing purge operation.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param purgeId In a purge status request, this is the Id of the operation the status of which is returned.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ComponentPurgeStatusResponseInner object | [
"Get",
"status",
"for",
"an",
"ongoing",
"purge",
"operation",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java#L909-L916 |
mangstadt/biweekly | src/main/java/biweekly/io/TimezoneInfo.java | TimezoneInfo.setTimezone | public void setTimezone(ICalProperty property, TimezoneAssignment timezone) {
"""
Assigns a timezone to a specific property.
@param property the property
@param timezone the timezone or null to format the property according to
the default timezone (see {@link #setDefaultTimezone}).
"""
if (timezone == null) {
TimezoneAssignment existing = propertyTimezones.remove(property);
if (existing != null && existing != defaultTimezone && !propertyTimezones.values().contains(existing)) {
assignments.remove(existing);
}
return;
}
assignments.add(timezone);
propertyTimezones.put(property, timezone);
} | java | public void setTimezone(ICalProperty property, TimezoneAssignment timezone) {
if (timezone == null) {
TimezoneAssignment existing = propertyTimezones.remove(property);
if (existing != null && existing != defaultTimezone && !propertyTimezones.values().contains(existing)) {
assignments.remove(existing);
}
return;
}
assignments.add(timezone);
propertyTimezones.put(property, timezone);
} | [
"public",
"void",
"setTimezone",
"(",
"ICalProperty",
"property",
",",
"TimezoneAssignment",
"timezone",
")",
"{",
"if",
"(",
"timezone",
"==",
"null",
")",
"{",
"TimezoneAssignment",
"existing",
"=",
"propertyTimezones",
".",
"remove",
"(",
"property",
")",
";",
"if",
"(",
"existing",
"!=",
"null",
"&&",
"existing",
"!=",
"defaultTimezone",
"&&",
"!",
"propertyTimezones",
".",
"values",
"(",
")",
".",
"contains",
"(",
"existing",
")",
")",
"{",
"assignments",
".",
"remove",
"(",
"existing",
")",
";",
"}",
"return",
";",
"}",
"assignments",
".",
"add",
"(",
"timezone",
")",
";",
"propertyTimezones",
".",
"put",
"(",
"property",
",",
"timezone",
")",
";",
"}"
]
| Assigns a timezone to a specific property.
@param property the property
@param timezone the timezone or null to format the property according to
the default timezone (see {@link #setDefaultTimezone}). | [
"Assigns",
"a",
"timezone",
"to",
"a",
"specific",
"property",
"."
]
| train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/TimezoneInfo.java#L118-L129 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingPoliciesInner.java | StreamingPoliciesInner.getAsync | public Observable<StreamingPolicyInner> getAsync(String resourceGroupName, String accountName, String streamingPolicyName) {
"""
Get a Streaming Policy.
Get the details of a Streaming Policy in the Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param streamingPolicyName The Streaming Policy name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StreamingPolicyInner object
"""
return getWithServiceResponseAsync(resourceGroupName, accountName, streamingPolicyName).map(new Func1<ServiceResponse<StreamingPolicyInner>, StreamingPolicyInner>() {
@Override
public StreamingPolicyInner call(ServiceResponse<StreamingPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<StreamingPolicyInner> getAsync(String resourceGroupName, String accountName, String streamingPolicyName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, streamingPolicyName).map(new Func1<ServiceResponse<StreamingPolicyInner>, StreamingPolicyInner>() {
@Override
public StreamingPolicyInner call(ServiceResponse<StreamingPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StreamingPolicyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"streamingPolicyName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"streamingPolicyName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"StreamingPolicyInner",
">",
",",
"StreamingPolicyInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"StreamingPolicyInner",
"call",
"(",
"ServiceResponse",
"<",
"StreamingPolicyInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Get a Streaming Policy.
Get the details of a Streaming Policy in the Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param streamingPolicyName The Streaming Policy name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StreamingPolicyInner object | [
"Get",
"a",
"Streaming",
"Policy",
".",
"Get",
"the",
"details",
"of",
"a",
"Streaming",
"Policy",
"in",
"the",
"Media",
"Services",
"account",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingPoliciesInner.java#L394-L401 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.pack | public static void pack(File sourceDir, File targetZip, NameMapper mapper) {
"""
Compresses the given directory and all its sub-directories into a ZIP file.
<p>
The ZIP file must not be a directory and its parent directory must exist.
@param sourceDir
root directory.
@param targetZip
ZIP file that will be created or overwritten.
@param mapper
call-back for renaming the entries.
"""
pack(sourceDir, targetZip, mapper, DEFAULT_COMPRESSION_LEVEL);
} | java | public static void pack(File sourceDir, File targetZip, NameMapper mapper) {
pack(sourceDir, targetZip, mapper, DEFAULT_COMPRESSION_LEVEL);
} | [
"public",
"static",
"void",
"pack",
"(",
"File",
"sourceDir",
",",
"File",
"targetZip",
",",
"NameMapper",
"mapper",
")",
"{",
"pack",
"(",
"sourceDir",
",",
"targetZip",
",",
"mapper",
",",
"DEFAULT_COMPRESSION_LEVEL",
")",
";",
"}"
]
| Compresses the given directory and all its sub-directories into a ZIP file.
<p>
The ZIP file must not be a directory and its parent directory must exist.
@param sourceDir
root directory.
@param targetZip
ZIP file that will be created or overwritten.
@param mapper
call-back for renaming the entries. | [
"Compresses",
"the",
"given",
"directory",
"and",
"all",
"its",
"sub",
"-",
"directories",
"into",
"a",
"ZIP",
"file",
".",
"<p",
">",
"The",
"ZIP",
"file",
"must",
"not",
"be",
"a",
"directory",
"and",
"its",
"parent",
"directory",
"must",
"exist",
"."
]
| train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1585-L1587 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.createOrUpdate | public NetworkWatcherInner createOrUpdate(String resourceGroupName, String networkWatcherName, NetworkWatcherInner parameters) {
"""
Creates or updates a network watcher in the specified resource group.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@param parameters Parameters that define the network watcher resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkWatcherInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body();
} | java | public NetworkWatcherInner createOrUpdate(String resourceGroupName, String networkWatcherName, NetworkWatcherInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body();
} | [
"public",
"NetworkWatcherInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"NetworkWatcherInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkWatcherName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Creates or updates a network watcher in the specified resource group.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@param parameters Parameters that define the network watcher resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkWatcherInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"network",
"watcher",
"in",
"the",
"specified",
"resource",
"group",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L203-L205 |
lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newAgent | public Agent newAgent(QualifiedName id, Collection<Attribute> attributes) {
"""
Creates a new {@link Agent} with provided identifier and attributes
@param id a {@link QualifiedName} for the agent
@param attributes a collection of {@link Attribute} for the agent
@return an object of type {@link Agent}
"""
Agent res = newAgent(id);
setAttributes(res, attributes);
return res;
} | java | public Agent newAgent(QualifiedName id, Collection<Attribute> attributes) {
Agent res = newAgent(id);
setAttributes(res, attributes);
return res;
} | [
"public",
"Agent",
"newAgent",
"(",
"QualifiedName",
"id",
",",
"Collection",
"<",
"Attribute",
">",
"attributes",
")",
"{",
"Agent",
"res",
"=",
"newAgent",
"(",
"id",
")",
";",
"setAttributes",
"(",
"res",
",",
"attributes",
")",
";",
"return",
"res",
";",
"}"
]
| Creates a new {@link Agent} with provided identifier and attributes
@param id a {@link QualifiedName} for the agent
@param attributes a collection of {@link Attribute} for the agent
@return an object of type {@link Agent} | [
"Creates",
"a",
"new",
"{"
]
| train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L447-L451 |
Jasig/uPortal | uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java | AuthorizationImpl.getPermissionsForOwner | @Override
public IPermission[] getPermissionsForOwner(String owner, String activity, String target)
throws AuthorizationException {
"""
Returns the <code>IPermissions</code> owner has granted for the specified activity and
target. Null parameters will be ignored, that is, all <code>IPermissions</code> matching the
non-null parameters are retrieved.
@return org.apereo.portal.security.IPermission[]
@param owner java.lang.String
@param activity java.lang.String
@param target java.lang.String
@exception AuthorizationException indicates authorization information could not be retrieved.
"""
return primRetrievePermissions(owner, null, activity, target);
} | java | @Override
public IPermission[] getPermissionsForOwner(String owner, String activity, String target)
throws AuthorizationException {
return primRetrievePermissions(owner, null, activity, target);
} | [
"@",
"Override",
"public",
"IPermission",
"[",
"]",
"getPermissionsForOwner",
"(",
"String",
"owner",
",",
"String",
"activity",
",",
"String",
"target",
")",
"throws",
"AuthorizationException",
"{",
"return",
"primRetrievePermissions",
"(",
"owner",
",",
"null",
",",
"activity",
",",
"target",
")",
";",
"}"
]
| Returns the <code>IPermissions</code> owner has granted for the specified activity and
target. Null parameters will be ignored, that is, all <code>IPermissions</code> matching the
non-null parameters are retrieved.
@return org.apereo.portal.security.IPermission[]
@param owner java.lang.String
@param activity java.lang.String
@param target java.lang.String
@exception AuthorizationException indicates authorization information could not be retrieved. | [
"Returns",
"the",
"<code",
">",
"IPermissions<",
"/",
"code",
">",
"owner",
"has",
"granted",
"for",
"the",
"specified",
"activity",
"and",
"target",
".",
"Null",
"parameters",
"will",
"be",
"ignored",
"that",
"is",
"all",
"<code",
">",
"IPermissions<",
"/",
"code",
">",
"matching",
"the",
"non",
"-",
"null",
"parameters",
"are",
"retrieved",
"."
]
| train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java#L774-L778 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/SearchFilter.java | SearchFilter.matchList | public void matchList(String ElementName, String[] values, int oper) {
"""
Change the search filter to one that specifies an element to not
match one of a list of values.
The old search filter is deleted.
@param ElementName is the name of the element to be matched
@param values is an array of possible matches
@param oper is the IN or NOT_IN operator to indicate how to matche
"""
// Delete the old search filter
m_filter = null;
// If not NOT_IN, assume IN
// (Since ints are passed by value, it is OK to change it)
if (oper != NOT_IN)
{
oper = IN;
// Create a leaf node for this list and store it as the filter
}
m_filter = new SearchBaseLeaf(ElementName, oper, values);
} | java | public void matchList(String ElementName, String[] values, int oper)
{
// Delete the old search filter
m_filter = null;
// If not NOT_IN, assume IN
// (Since ints are passed by value, it is OK to change it)
if (oper != NOT_IN)
{
oper = IN;
// Create a leaf node for this list and store it as the filter
}
m_filter = new SearchBaseLeaf(ElementName, oper, values);
} | [
"public",
"void",
"matchList",
"(",
"String",
"ElementName",
",",
"String",
"[",
"]",
"values",
",",
"int",
"oper",
")",
"{",
"// Delete the old search filter\r",
"m_filter",
"=",
"null",
";",
"// If not NOT_IN, assume IN\r",
"// (Since ints are passed by value, it is OK to change it)\r",
"if",
"(",
"oper",
"!=",
"NOT_IN",
")",
"{",
"oper",
"=",
"IN",
";",
"// Create a leaf node for this list and store it as the filter\r",
"}",
"m_filter",
"=",
"new",
"SearchBaseLeaf",
"(",
"ElementName",
",",
"oper",
",",
"values",
")",
";",
"}"
]
| Change the search filter to one that specifies an element to not
match one of a list of values.
The old search filter is deleted.
@param ElementName is the name of the element to be matched
@param values is an array of possible matches
@param oper is the IN or NOT_IN operator to indicate how to matche | [
"Change",
"the",
"search",
"filter",
"to",
"one",
"that",
"specifies",
"an",
"element",
"to",
"not",
"match",
"one",
"of",
"a",
"list",
"of",
"values",
".",
"The",
"old",
"search",
"filter",
"is",
"deleted",
"."
]
| train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/SearchFilter.java#L100-L112 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.updatePerRolePermissions | public CompletableFuture<Revision> updatePerRolePermissions(Author author,
String projectName, String repoName,
PerRolePermissions perRolePermissions) {
"""
Updates a {@link PerRolePermissions} of the specified {@code repoName} in the specified
{@code projectName}.
"""
requireNonNull(author, "author");
requireNonNull(projectName, "projectName");
requireNonNull(repoName, "repoName");
requireNonNull(perRolePermissions, "perRolePermissions");
final JsonPointer path = JsonPointer.compile("/repos" + encodeSegment(repoName) +
"/perRolePermissions");
final Change<JsonNode> change =
Change.ofJsonPatch(METADATA_JSON,
new ReplaceOperation(path, Jackson.valueToTree(perRolePermissions))
.toJsonNode());
final String commitSummary = "Update the role permission of the '" + repoName +
"' in the project " + projectName;
return metadataRepo.push(projectName, Project.REPO_DOGMA, author, commitSummary, change);
} | java | public CompletableFuture<Revision> updatePerRolePermissions(Author author,
String projectName, String repoName,
PerRolePermissions perRolePermissions) {
requireNonNull(author, "author");
requireNonNull(projectName, "projectName");
requireNonNull(repoName, "repoName");
requireNonNull(perRolePermissions, "perRolePermissions");
final JsonPointer path = JsonPointer.compile("/repos" + encodeSegment(repoName) +
"/perRolePermissions");
final Change<JsonNode> change =
Change.ofJsonPatch(METADATA_JSON,
new ReplaceOperation(path, Jackson.valueToTree(perRolePermissions))
.toJsonNode());
final String commitSummary = "Update the role permission of the '" + repoName +
"' in the project " + projectName;
return metadataRepo.push(projectName, Project.REPO_DOGMA, author, commitSummary, change);
} | [
"public",
"CompletableFuture",
"<",
"Revision",
">",
"updatePerRolePermissions",
"(",
"Author",
"author",
",",
"String",
"projectName",
",",
"String",
"repoName",
",",
"PerRolePermissions",
"perRolePermissions",
")",
"{",
"requireNonNull",
"(",
"author",
",",
"\"author\"",
")",
";",
"requireNonNull",
"(",
"projectName",
",",
"\"projectName\"",
")",
";",
"requireNonNull",
"(",
"repoName",
",",
"\"repoName\"",
")",
";",
"requireNonNull",
"(",
"perRolePermissions",
",",
"\"perRolePermissions\"",
")",
";",
"final",
"JsonPointer",
"path",
"=",
"JsonPointer",
".",
"compile",
"(",
"\"/repos\"",
"+",
"encodeSegment",
"(",
"repoName",
")",
"+",
"\"/perRolePermissions\"",
")",
";",
"final",
"Change",
"<",
"JsonNode",
">",
"change",
"=",
"Change",
".",
"ofJsonPatch",
"(",
"METADATA_JSON",
",",
"new",
"ReplaceOperation",
"(",
"path",
",",
"Jackson",
".",
"valueToTree",
"(",
"perRolePermissions",
")",
")",
".",
"toJsonNode",
"(",
")",
")",
";",
"final",
"String",
"commitSummary",
"=",
"\"Update the role permission of the '\"",
"+",
"repoName",
"+",
"\"' in the project \"",
"+",
"projectName",
";",
"return",
"metadataRepo",
".",
"push",
"(",
"projectName",
",",
"Project",
".",
"REPO_DOGMA",
",",
"author",
",",
"commitSummary",
",",
"change",
")",
";",
"}"
]
| Updates a {@link PerRolePermissions} of the specified {@code repoName} in the specified
{@code projectName}. | [
"Updates",
"a",
"{"
]
| train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L304-L321 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.createImageRegionsAsync | public Observable<ImageRegionCreateSummary> createImageRegionsAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) {
"""
Create a set of image regions.
This API accepts a batch of image regions, and optionally tags, to update existing images with region information.
There is a limit of 64 entries in the batch.
@param projectId The project id
@param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageRegionCreateSummary object
"""
return createImageRegionsWithServiceResponseAsync(projectId, createImageRegionsOptionalParameter).map(new Func1<ServiceResponse<ImageRegionCreateSummary>, ImageRegionCreateSummary>() {
@Override
public ImageRegionCreateSummary call(ServiceResponse<ImageRegionCreateSummary> response) {
return response.body();
}
});
} | java | public Observable<ImageRegionCreateSummary> createImageRegionsAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) {
return createImageRegionsWithServiceResponseAsync(projectId, createImageRegionsOptionalParameter).map(new Func1<ServiceResponse<ImageRegionCreateSummary>, ImageRegionCreateSummary>() {
@Override
public ImageRegionCreateSummary call(ServiceResponse<ImageRegionCreateSummary> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImageRegionCreateSummary",
">",
"createImageRegionsAsync",
"(",
"UUID",
"projectId",
",",
"CreateImageRegionsOptionalParameter",
"createImageRegionsOptionalParameter",
")",
"{",
"return",
"createImageRegionsWithServiceResponseAsync",
"(",
"projectId",
",",
"createImageRegionsOptionalParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ImageRegionCreateSummary",
">",
",",
"ImageRegionCreateSummary",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ImageRegionCreateSummary",
"call",
"(",
"ServiceResponse",
"<",
"ImageRegionCreateSummary",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Create a set of image regions.
This API accepts a batch of image regions, and optionally tags, to update existing images with region information.
There is a limit of 64 entries in the batch.
@param projectId The project id
@param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageRegionCreateSummary object | [
"Create",
"a",
"set",
"of",
"image",
"regions",
".",
"This",
"API",
"accepts",
"a",
"batch",
"of",
"image",
"regions",
"and",
"optionally",
"tags",
"to",
"update",
"existing",
"images",
"with",
"region",
"information",
".",
"There",
"is",
"a",
"limit",
"of",
"64",
"entries",
"in",
"the",
"batch",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3374-L3381 |
kite-sdk/kite | kite-tools-parent/kite-tools/src/main/java/org/kitesdk/tools/JobClasspathHelper.java | JobClasspathHelper.copyJarToHDFS | private void copyJarToHDFS(FileSystem fs, Path localJarPath, String md5sum, Path remoteJarPath, Path remoteMd5Path)
throws IOException {
"""
@param fs
File system where to upload the jar.
@param localJarPath
The local path where we find the jar.
@param md5sum
The MD5 sum of the local jar.
@param remoteJarPath
The remote path where to upload the jar.
@param remoteMd5Path
The remote path where to create the MD5 file.
@throws IOException
"""
LOG.info("Copying {} to {}", localJarPath.toUri().toASCIIString(), remoteJarPath.toUri().toASCIIString());
fs.copyFromLocalFile(localJarPath, remoteJarPath);
// create the MD5 file for this jar.
createMd5SumFile(fs, md5sum, remoteMd5Path);
// we need to clean the tmp files that are are created by JarFinder after the JVM exits.
if (remoteJarPath.getName().startsWith(JarFinder.TMP_HADOOP)) {
fs.deleteOnExit(remoteJarPath);
}
// same for the MD5 file.
if (remoteMd5Path.getName().startsWith(JarFinder.TMP_HADOOP)) {
fs.deleteOnExit(remoteMd5Path);
}
} | java | private void copyJarToHDFS(FileSystem fs, Path localJarPath, String md5sum, Path remoteJarPath, Path remoteMd5Path)
throws IOException {
LOG.info("Copying {} to {}", localJarPath.toUri().toASCIIString(), remoteJarPath.toUri().toASCIIString());
fs.copyFromLocalFile(localJarPath, remoteJarPath);
// create the MD5 file for this jar.
createMd5SumFile(fs, md5sum, remoteMd5Path);
// we need to clean the tmp files that are are created by JarFinder after the JVM exits.
if (remoteJarPath.getName().startsWith(JarFinder.TMP_HADOOP)) {
fs.deleteOnExit(remoteJarPath);
}
// same for the MD5 file.
if (remoteMd5Path.getName().startsWith(JarFinder.TMP_HADOOP)) {
fs.deleteOnExit(remoteMd5Path);
}
} | [
"private",
"void",
"copyJarToHDFS",
"(",
"FileSystem",
"fs",
",",
"Path",
"localJarPath",
",",
"String",
"md5sum",
",",
"Path",
"remoteJarPath",
",",
"Path",
"remoteMd5Path",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"info",
"(",
"\"Copying {} to {}\"",
",",
"localJarPath",
".",
"toUri",
"(",
")",
".",
"toASCIIString",
"(",
")",
",",
"remoteJarPath",
".",
"toUri",
"(",
")",
".",
"toASCIIString",
"(",
")",
")",
";",
"fs",
".",
"copyFromLocalFile",
"(",
"localJarPath",
",",
"remoteJarPath",
")",
";",
"// create the MD5 file for this jar.",
"createMd5SumFile",
"(",
"fs",
",",
"md5sum",
",",
"remoteMd5Path",
")",
";",
"// we need to clean the tmp files that are are created by JarFinder after the JVM exits.",
"if",
"(",
"remoteJarPath",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"JarFinder",
".",
"TMP_HADOOP",
")",
")",
"{",
"fs",
".",
"deleteOnExit",
"(",
"remoteJarPath",
")",
";",
"}",
"// same for the MD5 file.",
"if",
"(",
"remoteMd5Path",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"JarFinder",
".",
"TMP_HADOOP",
")",
")",
"{",
"fs",
".",
"deleteOnExit",
"(",
"remoteMd5Path",
")",
";",
"}",
"}"
]
| @param fs
File system where to upload the jar.
@param localJarPath
The local path where we find the jar.
@param md5sum
The MD5 sum of the local jar.
@param remoteJarPath
The remote path where to upload the jar.
@param remoteMd5Path
The remote path where to create the MD5 file.
@throws IOException | [
"@param",
"fs",
"File",
"system",
"where",
"to",
"upload",
"the",
"jar",
".",
"@param",
"localJarPath",
"The",
"local",
"path",
"where",
"we",
"find",
"the",
"jar",
".",
"@param",
"md5sum",
"The",
"MD5",
"sum",
"of",
"the",
"local",
"jar",
".",
"@param",
"remoteJarPath",
"The",
"remote",
"path",
"where",
"to",
"upload",
"the",
"jar",
".",
"@param",
"remoteMd5Path",
"The",
"remote",
"path",
"where",
"to",
"create",
"the",
"MD5",
"file",
"."
]
| train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-tools-parent/kite-tools/src/main/java/org/kitesdk/tools/JobClasspathHelper.java#L202-L218 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/layer/vector/GetFeaturesStyleStep.java | GetFeaturesStyleStep.initStyleFilters | private List<StyleFilter> initStyleFilters(List<FeatureStyleInfo> styleDefinitions) throws GeomajasException {
"""
Build list of style filters from style definitions.
@param styleDefinitions
list of style definitions
@return list of style filters
@throws GeomajasException
"""
List<StyleFilter> styleFilters = new ArrayList<StyleFilter>();
if (styleDefinitions == null || styleDefinitions.size() == 0) {
styleFilters.add(new StyleFilterImpl()); // use default.
} else {
for (FeatureStyleInfo styleDef : styleDefinitions) {
StyleFilterImpl styleFilterImpl = null;
String formula = styleDef.getFormula();
if (null != formula && formula.length() > 0) {
styleFilterImpl = new StyleFilterImpl(filterService.parseFilter(formula), styleDef);
} else {
styleFilterImpl = new StyleFilterImpl(Filter.INCLUDE, styleDef);
}
styleFilters.add(styleFilterImpl);
}
}
return styleFilters;
} | java | private List<StyleFilter> initStyleFilters(List<FeatureStyleInfo> styleDefinitions) throws GeomajasException {
List<StyleFilter> styleFilters = new ArrayList<StyleFilter>();
if (styleDefinitions == null || styleDefinitions.size() == 0) {
styleFilters.add(new StyleFilterImpl()); // use default.
} else {
for (FeatureStyleInfo styleDef : styleDefinitions) {
StyleFilterImpl styleFilterImpl = null;
String formula = styleDef.getFormula();
if (null != formula && formula.length() > 0) {
styleFilterImpl = new StyleFilterImpl(filterService.parseFilter(formula), styleDef);
} else {
styleFilterImpl = new StyleFilterImpl(Filter.INCLUDE, styleDef);
}
styleFilters.add(styleFilterImpl);
}
}
return styleFilters;
} | [
"private",
"List",
"<",
"StyleFilter",
">",
"initStyleFilters",
"(",
"List",
"<",
"FeatureStyleInfo",
">",
"styleDefinitions",
")",
"throws",
"GeomajasException",
"{",
"List",
"<",
"StyleFilter",
">",
"styleFilters",
"=",
"new",
"ArrayList",
"<",
"StyleFilter",
">",
"(",
")",
";",
"if",
"(",
"styleDefinitions",
"==",
"null",
"||",
"styleDefinitions",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"styleFilters",
".",
"add",
"(",
"new",
"StyleFilterImpl",
"(",
")",
")",
";",
"// use default.",
"}",
"else",
"{",
"for",
"(",
"FeatureStyleInfo",
"styleDef",
":",
"styleDefinitions",
")",
"{",
"StyleFilterImpl",
"styleFilterImpl",
"=",
"null",
";",
"String",
"formula",
"=",
"styleDef",
".",
"getFormula",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"formula",
"&&",
"formula",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"styleFilterImpl",
"=",
"new",
"StyleFilterImpl",
"(",
"filterService",
".",
"parseFilter",
"(",
"formula",
")",
",",
"styleDef",
")",
";",
"}",
"else",
"{",
"styleFilterImpl",
"=",
"new",
"StyleFilterImpl",
"(",
"Filter",
".",
"INCLUDE",
",",
"styleDef",
")",
";",
"}",
"styleFilters",
".",
"add",
"(",
"styleFilterImpl",
")",
";",
"}",
"}",
"return",
"styleFilters",
";",
"}"
]
| Build list of style filters from style definitions.
@param styleDefinitions
list of style definitions
@return list of style filters
@throws GeomajasException | [
"Build",
"list",
"of",
"style",
"filters",
"from",
"style",
"definitions",
"."
]
| train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/layer/vector/GetFeaturesStyleStep.java#L87-L104 |
gosu-lang/gosu-lang | gosu-process/src/main/java/gw/util/process/ProcessRunner.java | ProcessRunner.withEnvironmentVariable | public ProcessRunner withEnvironmentVariable(String name, String value) {
"""
Adds a name-value pair into this process' environment.
This can be called multiple times in a chain to set multiple
environment variables.
@param name the variable name
@param value the variable value
@return this object for chaining
@see ProcessBuilder
@see System#getenv()
"""
_env.put(name, value);
return this;
} | java | public ProcessRunner withEnvironmentVariable(String name, String value) {
_env.put(name, value);
return this;
} | [
"public",
"ProcessRunner",
"withEnvironmentVariable",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"_env",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
]
| Adds a name-value pair into this process' environment.
This can be called multiple times in a chain to set multiple
environment variables.
@param name the variable name
@param value the variable value
@return this object for chaining
@see ProcessBuilder
@see System#getenv() | [
"Adds",
"a",
"name",
"-",
"value",
"pair",
"into",
"this",
"process",
"environment",
".",
"This",
"can",
"be",
"called",
"multiple",
"times",
"in",
"a",
"chain",
"to",
"set",
"multiple",
"environment",
"variables",
"."
]
| train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-process/src/main/java/gw/util/process/ProcessRunner.java#L273-L276 |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/cache/FileBasedLocalCache.java | FileBasedLocalCache.getLocalFile | public File getLocalFile(URL remoteUri) {
"""
Returns the local File corresponding to the given remote URI.
@param remoteUri the remote URI
@return the corresponding local file
"""
StringBuilder sb = new StringBuilder();
String host = remoteUri.getHost();
String query = remoteUri.getQuery();
String path = remoteUri.getPath();
if (host != null)
{
sb.append(host);
}
if (path != null)
{
sb.append(path);
}
if (query != null)
{
sb.append('?');
sb.append(query);
}
String name;
final int maxLen = 250;
if (sb.length() < maxLen)
{
name = sb.toString();
}
else
{
name = sb.substring(0, maxLen);
}
name = name.replace('?', '$');
name = name.replace('*', '$');
name = name.replace(':', '$');
name = name.replace('<', '$');
name = name.replace('>', '$');
name = name.replace('"', '$');
File f = new File(cacheDir, name);
return f;
} | java | public File getLocalFile(URL remoteUri)
{
StringBuilder sb = new StringBuilder();
String host = remoteUri.getHost();
String query = remoteUri.getQuery();
String path = remoteUri.getPath();
if (host != null)
{
sb.append(host);
}
if (path != null)
{
sb.append(path);
}
if (query != null)
{
sb.append('?');
sb.append(query);
}
String name;
final int maxLen = 250;
if (sb.length() < maxLen)
{
name = sb.toString();
}
else
{
name = sb.substring(0, maxLen);
}
name = name.replace('?', '$');
name = name.replace('*', '$');
name = name.replace(':', '$');
name = name.replace('<', '$');
name = name.replace('>', '$');
name = name.replace('"', '$');
File f = new File(cacheDir, name);
return f;
} | [
"public",
"File",
"getLocalFile",
"(",
"URL",
"remoteUri",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"host",
"=",
"remoteUri",
".",
"getHost",
"(",
")",
";",
"String",
"query",
"=",
"remoteUri",
".",
"getQuery",
"(",
")",
";",
"String",
"path",
"=",
"remoteUri",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"host",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"host",
")",
";",
"}",
"if",
"(",
"path",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"path",
")",
";",
"}",
"if",
"(",
"query",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"sb",
".",
"append",
"(",
"query",
")",
";",
"}",
"String",
"name",
";",
"final",
"int",
"maxLen",
"=",
"250",
";",
"if",
"(",
"sb",
".",
"length",
"(",
")",
"<",
"maxLen",
")",
"{",
"name",
"=",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"name",
"=",
"sb",
".",
"substring",
"(",
"0",
",",
"maxLen",
")",
";",
"}",
"name",
"=",
"name",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"name",
"=",
"name",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"name",
"=",
"name",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"name",
"=",
"name",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"name",
"=",
"name",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"name",
"=",
"name",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"cacheDir",
",",
"name",
")",
";",
"return",
"f",
";",
"}"
]
| Returns the local File corresponding to the given remote URI.
@param remoteUri the remote URI
@return the corresponding local file | [
"Returns",
"the",
"local",
"File",
"corresponding",
"to",
"the",
"given",
"remote",
"URI",
"."
]
| train | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/cache/FileBasedLocalCache.java#L78-L123 |
m-m-m/util | xml/src/main/java/net/sf/mmm/util/xml/base/jaxb/XmlBeanMapper.java | XmlBeanMapper.loadXml | public T loadXml(InputStream inputStream, Object source) {
"""
This method loads the JAXB-bean as XML from the given {@code inputStream}.
@param inputStream is the {@link InputStream} with the XML to parse.
@return the parsed XML converted to the according JAXB-bean.
@param source describes the source of the invalid XML. Typically this will be the filename where the XML was read
from. It is used in in the exception message. This will help to find the problem easier.
"""
try {
Object unmarshalledObject = getOrCreateUnmarshaller().unmarshal(inputStream);
T jaxbBean = this.xmlBeanClass.cast(unmarshalledObject);
validate(jaxbBean);
return jaxbBean;
} catch (JAXBException e) {
throw new XmlInvalidException(e, source);
}
} | java | public T loadXml(InputStream inputStream, Object source) {
try {
Object unmarshalledObject = getOrCreateUnmarshaller().unmarshal(inputStream);
T jaxbBean = this.xmlBeanClass.cast(unmarshalledObject);
validate(jaxbBean);
return jaxbBean;
} catch (JAXBException e) {
throw new XmlInvalidException(e, source);
}
} | [
"public",
"T",
"loadXml",
"(",
"InputStream",
"inputStream",
",",
"Object",
"source",
")",
"{",
"try",
"{",
"Object",
"unmarshalledObject",
"=",
"getOrCreateUnmarshaller",
"(",
")",
".",
"unmarshal",
"(",
"inputStream",
")",
";",
"T",
"jaxbBean",
"=",
"this",
".",
"xmlBeanClass",
".",
"cast",
"(",
"unmarshalledObject",
")",
";",
"validate",
"(",
"jaxbBean",
")",
";",
"return",
"jaxbBean",
";",
"}",
"catch",
"(",
"JAXBException",
"e",
")",
"{",
"throw",
"new",
"XmlInvalidException",
"(",
"e",
",",
"source",
")",
";",
"}",
"}"
]
| This method loads the JAXB-bean as XML from the given {@code inputStream}.
@param inputStream is the {@link InputStream} with the XML to parse.
@return the parsed XML converted to the according JAXB-bean.
@param source describes the source of the invalid XML. Typically this will be the filename where the XML was read
from. It is used in in the exception message. This will help to find the problem easier. | [
"This",
"method",
"loads",
"the",
"JAXB",
"-",
"bean",
"as",
"XML",
"from",
"the",
"given",
"{",
"@code",
"inputStream",
"}",
"."
]
| train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/xml/src/main/java/net/sf/mmm/util/xml/base/jaxb/XmlBeanMapper.java#L232-L242 |
jenkinsci/jenkins | core/src/main/java/hudson/util/FormValidation.java | FormValidation.validateIntegerInRange | public static FormValidation validateIntegerInRange(String value, int lower, int upper) {
"""
Make sure that the given string is an integer in the range specified by the lower and upper bounds (both inclusive)
@param value the value to check
@param lower the lower bound (inclusive)
@param upper the upper bound (inclusive)
@since 2.104
"""
try {
int intValue = Integer.parseInt(value);
if (intValue < lower) {
return error(hudson.model.Messages.Hudson_MustBeAtLeast(lower));
}
if (intValue > upper) {
return error(hudson.model.Messages.Hudson_MustBeAtMost(upper));
}
return ok();
} catch (NumberFormatException e) {
return error(hudson.model.Messages.Hudson_NotANumber());
}
} | java | public static FormValidation validateIntegerInRange(String value, int lower, int upper) {
try {
int intValue = Integer.parseInt(value);
if (intValue < lower) {
return error(hudson.model.Messages.Hudson_MustBeAtLeast(lower));
}
if (intValue > upper) {
return error(hudson.model.Messages.Hudson_MustBeAtMost(upper));
}
return ok();
} catch (NumberFormatException e) {
return error(hudson.model.Messages.Hudson_NotANumber());
}
} | [
"public",
"static",
"FormValidation",
"validateIntegerInRange",
"(",
"String",
"value",
",",
"int",
"lower",
",",
"int",
"upper",
")",
"{",
"try",
"{",
"int",
"intValue",
"=",
"Integer",
".",
"parseInt",
"(",
"value",
")",
";",
"if",
"(",
"intValue",
"<",
"lower",
")",
"{",
"return",
"error",
"(",
"hudson",
".",
"model",
".",
"Messages",
".",
"Hudson_MustBeAtLeast",
"(",
"lower",
")",
")",
";",
"}",
"if",
"(",
"intValue",
">",
"upper",
")",
"{",
"return",
"error",
"(",
"hudson",
".",
"model",
".",
"Messages",
".",
"Hudson_MustBeAtMost",
"(",
"upper",
")",
")",
";",
"}",
"return",
"ok",
"(",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"return",
"error",
"(",
"hudson",
".",
"model",
".",
"Messages",
".",
"Hudson_NotANumber",
"(",
")",
")",
";",
"}",
"}"
]
| Make sure that the given string is an integer in the range specified by the lower and upper bounds (both inclusive)
@param value the value to check
@param lower the lower bound (inclusive)
@param upper the upper bound (inclusive)
@since 2.104 | [
"Make",
"sure",
"that",
"the",
"given",
"string",
"is",
"an",
"integer",
"in",
"the",
"range",
"specified",
"by",
"the",
"lower",
"and",
"upper",
"bounds",
"(",
"both",
"inclusive",
")"
]
| train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/FormValidation.java#L407-L420 |
vdurmont/semver4j | src/main/java/com/vdurmont/semver4j/Requirement.java | Requirement.buildStrict | public static Requirement buildStrict(String requirement) {
"""
Builds a strict requirement (will test that the version is equivalent to the requirement)
@param requirement the version of the requirement
@return the generated requirement
"""
return build(new Semver(requirement, Semver.SemverType.STRICT));
} | java | public static Requirement buildStrict(String requirement) {
return build(new Semver(requirement, Semver.SemverType.STRICT));
} | [
"public",
"static",
"Requirement",
"buildStrict",
"(",
"String",
"requirement",
")",
"{",
"return",
"build",
"(",
"new",
"Semver",
"(",
"requirement",
",",
"Semver",
".",
"SemverType",
".",
"STRICT",
")",
")",
";",
"}"
]
| Builds a strict requirement (will test that the version is equivalent to the requirement)
@param requirement the version of the requirement
@return the generated requirement | [
"Builds",
"a",
"strict",
"requirement",
"(",
"will",
"test",
"that",
"the",
"version",
"is",
"equivalent",
"to",
"the",
"requirement",
")"
]
| train | https://github.com/vdurmont/semver4j/blob/3f0266e4985ac29e9da482e04001ed15fad6c3e2/src/main/java/com/vdurmont/semver4j/Requirement.java#L74-L76 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java | PJsonArray.getJSONArray | public final PJsonArray getJSONArray(final int i) {
"""
Get the element at the index as a json array.
@param i the index of the element to access
"""
JSONArray val = this.array.optJSONArray(i);
final String context = "[" + i + "]";
if (val == null) {
throw new ObjectMissingException(this, context);
}
return new PJsonArray(this, val, context);
} | java | public final PJsonArray getJSONArray(final int i) {
JSONArray val = this.array.optJSONArray(i);
final String context = "[" + i + "]";
if (val == null) {
throw new ObjectMissingException(this, context);
}
return new PJsonArray(this, val, context);
} | [
"public",
"final",
"PJsonArray",
"getJSONArray",
"(",
"final",
"int",
"i",
")",
"{",
"JSONArray",
"val",
"=",
"this",
".",
"array",
".",
"optJSONArray",
"(",
"i",
")",
";",
"final",
"String",
"context",
"=",
"\"[\"",
"+",
"i",
"+",
"\"]\"",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"throw",
"new",
"ObjectMissingException",
"(",
"this",
",",
"context",
")",
";",
"}",
"return",
"new",
"PJsonArray",
"(",
"this",
",",
"val",
",",
"context",
")",
";",
"}"
]
| Get the element at the index as a json array.
@param i the index of the element to access | [
"Get",
"the",
"element",
"at",
"the",
"index",
"as",
"a",
"json",
"array",
"."
]
| train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java#L76-L83 |
gitblit/fathom | fathom-x509/src/main/java/fathom/x509/X509Utils.java | X509Utils.addTrustedCertificate | public static void addTrustedCertificate(String alias, X509Certificate cert, File storeFile, String storePassword) {
"""
Imports a certificate into the trust store.
@param alias
@param cert
@param storeFile
@param storePassword
"""
try {
KeyStore store = openKeyStore(storeFile, storePassword);
store.setCertificateEntry(alias, cert);
saveKeyStore(storeFile, store, storePassword);
} catch (Exception e) {
throw new RuntimeException("Failed to import certificate into trust store " + storeFile, e);
}
} | java | public static void addTrustedCertificate(String alias, X509Certificate cert, File storeFile, String storePassword) {
try {
KeyStore store = openKeyStore(storeFile, storePassword);
store.setCertificateEntry(alias, cert);
saveKeyStore(storeFile, store, storePassword);
} catch (Exception e) {
throw new RuntimeException("Failed to import certificate into trust store " + storeFile, e);
}
} | [
"public",
"static",
"void",
"addTrustedCertificate",
"(",
"String",
"alias",
",",
"X509Certificate",
"cert",
",",
"File",
"storeFile",
",",
"String",
"storePassword",
")",
"{",
"try",
"{",
"KeyStore",
"store",
"=",
"openKeyStore",
"(",
"storeFile",
",",
"storePassword",
")",
";",
"store",
".",
"setCertificateEntry",
"(",
"alias",
",",
"cert",
")",
";",
"saveKeyStore",
"(",
"storeFile",
",",
"store",
",",
"storePassword",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Failed to import certificate into trust store \"",
"+",
"storeFile",
",",
"e",
")",
";",
"}",
"}"
]
| Imports a certificate into the trust store.
@param alias
@param cert
@param storeFile
@param storePassword | [
"Imports",
"a",
"certificate",
"into",
"the",
"trust",
"store",
"."
]
| train | https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-x509/src/main/java/fathom/x509/X509Utils.java#L715-L723 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/IntStream.java | IntStream.flatMap | @NotNull
public IntStream flatMap(@NotNull final IntFunction<? extends IntStream> mapper) {
"""
Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element.
<p>This is an intermediate operation.
<p>Example:
<pre>
mapper: (a) -> [a, a + 5]
stream: [1, 2, 3, 4]
result: [1, 6, 2, 7, 3, 8, 4, 9]
</pre>
@param mapper a non-interfering stateless function to apply to each
element which produces an {@code IntStream} of new values
@return the new stream
@see Stream#flatMap(Function)
"""
return new IntStream(params, new IntFlatMap(iterator, mapper));
} | java | @NotNull
public IntStream flatMap(@NotNull final IntFunction<? extends IntStream> mapper) {
return new IntStream(params, new IntFlatMap(iterator, mapper));
} | [
"@",
"NotNull",
"public",
"IntStream",
"flatMap",
"(",
"@",
"NotNull",
"final",
"IntFunction",
"<",
"?",
"extends",
"IntStream",
">",
"mapper",
")",
"{",
"return",
"new",
"IntStream",
"(",
"params",
",",
"new",
"IntFlatMap",
"(",
"iterator",
",",
"mapper",
")",
")",
";",
"}"
]
| Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element.
<p>This is an intermediate operation.
<p>Example:
<pre>
mapper: (a) -> [a, a + 5]
stream: [1, 2, 3, 4]
result: [1, 6, 2, 7, 3, 8, 4, 9]
</pre>
@param mapper a non-interfering stateless function to apply to each
element which produces an {@code IntStream} of new values
@return the new stream
@see Stream#flatMap(Function) | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"results",
"of",
"replacing",
"each",
"element",
"of",
"this",
"stream",
"with",
"the",
"contents",
"of",
"a",
"mapped",
"stream",
"produced",
"by",
"applying",
"the",
"provided",
"mapping",
"function",
"to",
"each",
"element",
"."
]
| train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L582-L585 |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/tools.java | tools.areEqual | public static boolean areEqual(byte[] array1, byte[] array2) {
"""
Compares two byte arrays element by element
@param array1 first array
@param array2 second array
@return array1 == array2
"""
if (array1.length != array2.length) return false;
for (int i=0; i<array1.length; ++i)
if (array1[i] != array2[i]) return false;
return true;
} | java | public static boolean areEqual(byte[] array1, byte[] array2) {
if (array1.length != array2.length) return false;
for (int i=0; i<array1.length; ++i)
if (array1[i] != array2[i]) return false;
return true;
} | [
"public",
"static",
"boolean",
"areEqual",
"(",
"byte",
"[",
"]",
"array1",
",",
"byte",
"[",
"]",
"array2",
")",
"{",
"if",
"(",
"array1",
".",
"length",
"!=",
"array2",
".",
"length",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array1",
".",
"length",
";",
"++",
"i",
")",
"if",
"(",
"array1",
"[",
"i",
"]",
"!=",
"array2",
"[",
"i",
"]",
")",
"return",
"false",
";",
"return",
"true",
";",
"}"
]
| Compares two byte arrays element by element
@param array1 first array
@param array2 second array
@return array1 == array2 | [
"Compares",
"two",
"byte",
"arrays",
"element",
"by",
"element"
]
| train | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/tools.java#L83-L90 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfPKCS7.java | PdfPKCS7.setExternalDigest | public void setExternalDigest(byte digest[], byte RSAdata[], String digestEncryptionAlgorithm) {
"""
Sets the digest/signature to an external calculated value.
@param digest the digest. This is the actual signature
@param RSAdata the extra data that goes into the data tag in PKCS#7
@param digestEncryptionAlgorithm the encryption algorithm. It may must be <CODE>null</CODE> if the <CODE>digest</CODE>
is also <CODE>null</CODE>. If the <CODE>digest</CODE> is not <CODE>null</CODE>
then it may be "RSA" or "DSA"
"""
externalDigest = digest;
externalRSAdata = RSAdata;
if (digestEncryptionAlgorithm != null) {
if (digestEncryptionAlgorithm.equals("RSA")) {
this.digestEncryptionAlgorithm = ID_RSA;
}
else if (digestEncryptionAlgorithm.equals("DSA")) {
this.digestEncryptionAlgorithm = ID_DSA;
}
else
throw new ExceptionConverter(new NoSuchAlgorithmException("Unknown Key Algorithm "+digestEncryptionAlgorithm));
}
} | java | public void setExternalDigest(byte digest[], byte RSAdata[], String digestEncryptionAlgorithm) {
externalDigest = digest;
externalRSAdata = RSAdata;
if (digestEncryptionAlgorithm != null) {
if (digestEncryptionAlgorithm.equals("RSA")) {
this.digestEncryptionAlgorithm = ID_RSA;
}
else if (digestEncryptionAlgorithm.equals("DSA")) {
this.digestEncryptionAlgorithm = ID_DSA;
}
else
throw new ExceptionConverter(new NoSuchAlgorithmException("Unknown Key Algorithm "+digestEncryptionAlgorithm));
}
} | [
"public",
"void",
"setExternalDigest",
"(",
"byte",
"digest",
"[",
"]",
",",
"byte",
"RSAdata",
"[",
"]",
",",
"String",
"digestEncryptionAlgorithm",
")",
"{",
"externalDigest",
"=",
"digest",
";",
"externalRSAdata",
"=",
"RSAdata",
";",
"if",
"(",
"digestEncryptionAlgorithm",
"!=",
"null",
")",
"{",
"if",
"(",
"digestEncryptionAlgorithm",
".",
"equals",
"(",
"\"RSA\"",
")",
")",
"{",
"this",
".",
"digestEncryptionAlgorithm",
"=",
"ID_RSA",
";",
"}",
"else",
"if",
"(",
"digestEncryptionAlgorithm",
".",
"equals",
"(",
"\"DSA\"",
")",
")",
"{",
"this",
".",
"digestEncryptionAlgorithm",
"=",
"ID_DSA",
";",
"}",
"else",
"throw",
"new",
"ExceptionConverter",
"(",
"new",
"NoSuchAlgorithmException",
"(",
"\"Unknown Key Algorithm \"",
"+",
"digestEncryptionAlgorithm",
")",
")",
";",
"}",
"}"
]
| Sets the digest/signature to an external calculated value.
@param digest the digest. This is the actual signature
@param RSAdata the extra data that goes into the data tag in PKCS#7
@param digestEncryptionAlgorithm the encryption algorithm. It may must be <CODE>null</CODE> if the <CODE>digest</CODE>
is also <CODE>null</CODE>. If the <CODE>digest</CODE> is not <CODE>null</CODE>
then it may be "RSA" or "DSA" | [
"Sets",
"the",
"digest",
"/",
"signature",
"to",
"an",
"external",
"calculated",
"value",
"."
]
| train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java#L1124-L1137 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java | StatementExecutor.executeUpdate | public int executeUpdate() throws SQLException {
"""
Execute update.
@return effected records count
@throws SQLException SQL exception
"""
return executeUpdate(new Updater() {
@Override
public int executeUpdate(final Statement statement, final String sql) throws SQLException {
return statement.executeUpdate(sql);
}
});
} | java | public int executeUpdate() throws SQLException {
return executeUpdate(new Updater() {
@Override
public int executeUpdate(final Statement statement, final String sql) throws SQLException {
return statement.executeUpdate(sql);
}
});
} | [
"public",
"int",
"executeUpdate",
"(",
")",
"throws",
"SQLException",
"{",
"return",
"executeUpdate",
"(",
"new",
"Updater",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"executeUpdate",
"(",
"final",
"Statement",
"statement",
",",
"final",
"String",
"sql",
")",
"throws",
"SQLException",
"{",
"return",
"statement",
".",
"executeUpdate",
"(",
"sql",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Execute update.
@return effected records count
@throws SQLException SQL exception | [
"Execute",
"update",
"."
]
| train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java#L116-L124 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java | PropertiesManagerCore.addValue | public boolean addValue(String geoPackage, String property, String value) {
"""
Add a property value to a specified GeoPackage
@param geoPackage
GeoPackage name
@param property
property name
@param value
value
@return true if added
"""
boolean added = false;
PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap
.get(geoPackage);
if (properties != null) {
added = properties.addValue(property, value);
}
return added;
} | java | public boolean addValue(String geoPackage, String property, String value) {
boolean added = false;
PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap
.get(geoPackage);
if (properties != null) {
added = properties.addValue(property, value);
}
return added;
} | [
"public",
"boolean",
"addValue",
"(",
"String",
"geoPackage",
",",
"String",
"property",
",",
"String",
"value",
")",
"{",
"boolean",
"added",
"=",
"false",
";",
"PropertiesCoreExtension",
"<",
"T",
",",
"?",
",",
"?",
",",
"?",
">",
"properties",
"=",
"propertiesMap",
".",
"get",
"(",
"geoPackage",
")",
";",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"added",
"=",
"properties",
".",
"addValue",
"(",
"property",
",",
"value",
")",
";",
"}",
"return",
"added",
";",
"}"
]
| Add a property value to a specified GeoPackage
@param geoPackage
GeoPackage name
@param property
property name
@param value
value
@return true if added | [
"Add",
"a",
"property",
"value",
"to",
"a",
"specified",
"GeoPackage"
]
| train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java#L416-L424 |
nominanuda/zen-project | zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java | BaseTree.insertChild | public void insertChild(int i, Object t) {
"""
Insert child t at child position i (0..n-1) by shifting children
i+1..n-1 to the right one position. Set parent / indexes properly
but does NOT collapse nil-rooted t's that come in here like addChild.
"""
if (i < 0 || i > getChildCount()) {
throw new IndexOutOfBoundsException(i+" out or range");
}
if (children == null) {
children = createChildrenList();
}
children.add(i, t);
// walk others to increment their child indexes
// set index, parent of this one too
this.freshenParentAndChildIndexes(i);
} | java | public void insertChild(int i, Object t) {
if (i < 0 || i > getChildCount()) {
throw new IndexOutOfBoundsException(i+" out or range");
}
if (children == null) {
children = createChildrenList();
}
children.add(i, t);
// walk others to increment their child indexes
// set index, parent of this one too
this.freshenParentAndChildIndexes(i);
} | [
"public",
"void",
"insertChild",
"(",
"int",
"i",
",",
"Object",
"t",
")",
"{",
"if",
"(",
"i",
"<",
"0",
"||",
"i",
">",
"getChildCount",
"(",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"i",
"+",
"\" out or range\"",
")",
";",
"}",
"if",
"(",
"children",
"==",
"null",
")",
"{",
"children",
"=",
"createChildrenList",
"(",
")",
";",
"}",
"children",
".",
"add",
"(",
"i",
",",
"t",
")",
";",
"// walk others to increment their child indexes",
"// set index, parent of this one too",
"this",
".",
"freshenParentAndChildIndexes",
"(",
"i",
")",
";",
"}"
]
| Insert child t at child position i (0..n-1) by shifting children
i+1..n-1 to the right one position. Set parent / indexes properly
but does NOT collapse nil-rooted t's that come in here like addChild. | [
"Insert",
"child",
"t",
"at",
"child",
"position",
"i",
"(",
"0",
"..",
"n",
"-",
"1",
")",
"by",
"shifting",
"children",
"i",
"+",
"1",
"..",
"n",
"-",
"1",
"to",
"the",
"right",
"one",
"position",
".",
"Set",
"parent",
"/",
"indexes",
"properly",
"but",
"does",
"NOT",
"collapse",
"nil",
"-",
"rooted",
"t",
"s",
"that",
"come",
"in",
"here",
"like",
"addChild",
"."
]
| train | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-webservice/src/main/java/com/nominanuda/urispec/BaseTree.java#L162-L175 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java | DBInitializerHelper.useSequenceForOrderNumber | public static boolean useSequenceForOrderNumber(WorkspaceEntry wsConfig, String dbDialect) throws RepositoryConfigurationException {
"""
Use sequence for order number.
@param wsConfig The workspace configuration.
@return true if the sequence are enable. False otherwise.
"""
try
{
if (wsConfig.getContainer().getParameterValue(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER, JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO).equalsIgnoreCase(JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO))
{
return JDBCWorkspaceDataContainer.useSequenceDefaultValue();
}
else
{
return wsConfig.getContainer().getParameterBoolean(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER);
}
}
catch (RepositoryConfigurationException e)
{
return JDBCWorkspaceDataContainer.useSequenceDefaultValue();
}
} | java | public static boolean useSequenceForOrderNumber(WorkspaceEntry wsConfig, String dbDialect) throws RepositoryConfigurationException
{
try
{
if (wsConfig.getContainer().getParameterValue(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER, JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO).equalsIgnoreCase(JDBCWorkspaceDataContainer.USE_SEQUENCE_AUTO))
{
return JDBCWorkspaceDataContainer.useSequenceDefaultValue();
}
else
{
return wsConfig.getContainer().getParameterBoolean(JDBCWorkspaceDataContainer.USE_SEQUENCE_FOR_ORDER_NUMBER);
}
}
catch (RepositoryConfigurationException e)
{
return JDBCWorkspaceDataContainer.useSequenceDefaultValue();
}
} | [
"public",
"static",
"boolean",
"useSequenceForOrderNumber",
"(",
"WorkspaceEntry",
"wsConfig",
",",
"String",
"dbDialect",
")",
"throws",
"RepositoryConfigurationException",
"{",
"try",
"{",
"if",
"(",
"wsConfig",
".",
"getContainer",
"(",
")",
".",
"getParameterValue",
"(",
"JDBCWorkspaceDataContainer",
".",
"USE_SEQUENCE_FOR_ORDER_NUMBER",
",",
"JDBCWorkspaceDataContainer",
".",
"USE_SEQUENCE_AUTO",
")",
".",
"equalsIgnoreCase",
"(",
"JDBCWorkspaceDataContainer",
".",
"USE_SEQUENCE_AUTO",
")",
")",
"{",
"return",
"JDBCWorkspaceDataContainer",
".",
"useSequenceDefaultValue",
"(",
")",
";",
"}",
"else",
"{",
"return",
"wsConfig",
".",
"getContainer",
"(",
")",
".",
"getParameterBoolean",
"(",
"JDBCWorkspaceDataContainer",
".",
"USE_SEQUENCE_FOR_ORDER_NUMBER",
")",
";",
"}",
"}",
"catch",
"(",
"RepositoryConfigurationException",
"e",
")",
"{",
"return",
"JDBCWorkspaceDataContainer",
".",
"useSequenceDefaultValue",
"(",
")",
";",
"}",
"}"
]
| Use sequence for order number.
@param wsConfig The workspace configuration.
@return true if the sequence are enable. False otherwise. | [
"Use",
"sequence",
"for",
"order",
"number",
"."
]
| train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java#L395-L412 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java | JCRAssert.assertNodeTypeExists | public static void assertNodeTypeExists(final Session session, final String nodeTypeName)
throws RepositoryException {
"""
Asserts that a specific node type is registered in the workspace of the session.
@param session
the session to perform the lookup
@param nodeTypeName
the name of the nodetype that is asserted to exist
@throws RepositoryException
if an error occurs
"""
final NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
assertTrue("NodeType " + nodeTypeName + " does not exist", ntm.hasNodeType(nodeTypeName));
} | java | public static void assertNodeTypeExists(final Session session, final String nodeTypeName)
throws RepositoryException {
final NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
assertTrue("NodeType " + nodeTypeName + " does not exist", ntm.hasNodeType(nodeTypeName));
} | [
"public",
"static",
"void",
"assertNodeTypeExists",
"(",
"final",
"Session",
"session",
",",
"final",
"String",
"nodeTypeName",
")",
"throws",
"RepositoryException",
"{",
"final",
"NodeTypeManager",
"ntm",
"=",
"session",
".",
"getWorkspace",
"(",
")",
".",
"getNodeTypeManager",
"(",
")",
";",
"assertTrue",
"(",
"\"NodeType \"",
"+",
"nodeTypeName",
"+",
"\" does not exist\"",
",",
"ntm",
".",
"hasNodeType",
"(",
"nodeTypeName",
")",
")",
";",
"}"
]
| Asserts that a specific node type is registered in the workspace of the session.
@param session
the session to perform the lookup
@param nodeTypeName
the name of the nodetype that is asserted to exist
@throws RepositoryException
if an error occurs | [
"Asserts",
"that",
"a",
"specific",
"node",
"type",
"is",
"registered",
"in",
"the",
"workspace",
"of",
"the",
"session",
"."
]
| train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java#L206-L211 |
rythmengine/rythmengine | src/main/java/org/rythmengine/utils/S.java | S.isEqual | public static boolean isEqual(Object o1, Object o2) {
"""
Check if two Object is equal after converted into String
@param o1
@param o2
@return true if the specified two object instance are equal after converting to String
"""
return isEqual(str(o1), str(o2));
} | java | public static boolean isEqual(Object o1, Object o2) {
return isEqual(str(o1), str(o2));
} | [
"public",
"static",
"boolean",
"isEqual",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"return",
"isEqual",
"(",
"str",
"(",
"o1",
")",
",",
"str",
"(",
"o2",
")",
")",
";",
"}"
]
| Check if two Object is equal after converted into String
@param o1
@param o2
@return true if the specified two object instance are equal after converting to String | [
"Check",
"if",
"two",
"Object",
"is",
"equal",
"after",
"converted",
"into",
"String"
]
| train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/S.java#L206-L208 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/macro/SarlAccessorsProcessor.java | SarlAccessorsProcessor.applyMinMaxVisibility | @SuppressWarnings("static-method")
protected Visibility applyMinMaxVisibility(Visibility visibility, MutableFieldDeclaration it, TransformationContext context) {
"""
Apply the minimum and maximum visibilities to the given one.
@param visibility the visibility.
@param it the field associated to the accessors to generate.
@param context the transformation context.
@return the given {@code visibility}, or the min/max visibility if the given one is too high.
"""
if (context.findTypeGlobally(Agent.class).isAssignableFrom(it.getDeclaringType())) {
if (visibility.compareTo(Visibility.PROTECTED) > 0) {
return Visibility.PROTECTED;
}
}
return visibility;
} | java | @SuppressWarnings("static-method")
protected Visibility applyMinMaxVisibility(Visibility visibility, MutableFieldDeclaration it, TransformationContext context) {
if (context.findTypeGlobally(Agent.class).isAssignableFrom(it.getDeclaringType())) {
if (visibility.compareTo(Visibility.PROTECTED) > 0) {
return Visibility.PROTECTED;
}
}
return visibility;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Visibility",
"applyMinMaxVisibility",
"(",
"Visibility",
"visibility",
",",
"MutableFieldDeclaration",
"it",
",",
"TransformationContext",
"context",
")",
"{",
"if",
"(",
"context",
".",
"findTypeGlobally",
"(",
"Agent",
".",
"class",
")",
".",
"isAssignableFrom",
"(",
"it",
".",
"getDeclaringType",
"(",
")",
")",
")",
"{",
"if",
"(",
"visibility",
".",
"compareTo",
"(",
"Visibility",
".",
"PROTECTED",
")",
">",
"0",
")",
"{",
"return",
"Visibility",
".",
"PROTECTED",
";",
"}",
"}",
"return",
"visibility",
";",
"}"
]
| Apply the minimum and maximum visibilities to the given one.
@param visibility the visibility.
@param it the field associated to the accessors to generate.
@param context the transformation context.
@return the given {@code visibility}, or the min/max visibility if the given one is too high. | [
"Apply",
"the",
"minimum",
"and",
"maximum",
"visibilities",
"to",
"the",
"given",
"one",
"."
]
| train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/macro/SarlAccessorsProcessor.java#L68-L76 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java | FileHelper.getDirectoryContent | @Nonnull
@ReturnsMutableCopy
public static ICommonsList <File> getDirectoryContent (@Nonnull final File aDirectory,
@Nonnull final FileFilter aFileFilter) {
"""
This is a replacement for <code>File.listFiles(FileFilter)</code> doing
some additional checks on permissions. The order of the returned files is
defined by the underlying {@link File#listFiles(FileFilter)} method.
@param aDirectory
The directory to be listed. May not be <code>null</code>.
@param aFileFilter
The file filter to be used. May not be <code>null</code>.
@return Never <code>null</code>.
"""
ValueEnforcer.notNull (aDirectory, "Directory");
ValueEnforcer.notNull (aFileFilter, "FileFilter");
return _getDirectoryContent (aDirectory, aDirectory.listFiles (aFileFilter));
} | java | @Nonnull
@ReturnsMutableCopy
public static ICommonsList <File> getDirectoryContent (@Nonnull final File aDirectory,
@Nonnull final FileFilter aFileFilter)
{
ValueEnforcer.notNull (aDirectory, "Directory");
ValueEnforcer.notNull (aFileFilter, "FileFilter");
return _getDirectoryContent (aDirectory, aDirectory.listFiles (aFileFilter));
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"ICommonsList",
"<",
"File",
">",
"getDirectoryContent",
"(",
"@",
"Nonnull",
"final",
"File",
"aDirectory",
",",
"@",
"Nonnull",
"final",
"FileFilter",
"aFileFilter",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aDirectory",
",",
"\"Directory\"",
")",
";",
"ValueEnforcer",
".",
"notNull",
"(",
"aFileFilter",
",",
"\"FileFilter\"",
")",
";",
"return",
"_getDirectoryContent",
"(",
"aDirectory",
",",
"aDirectory",
".",
"listFiles",
"(",
"aFileFilter",
")",
")",
";",
"}"
]
| This is a replacement for <code>File.listFiles(FileFilter)</code> doing
some additional checks on permissions. The order of the returned files is
defined by the underlying {@link File#listFiles(FileFilter)} method.
@param aDirectory
The directory to be listed. May not be <code>null</code>.
@param aFileFilter
The file filter to be used. May not be <code>null</code>.
@return Never <code>null</code>. | [
"This",
"is",
"a",
"replacement",
"for",
"<code",
">",
"File",
".",
"listFiles",
"(",
"FileFilter",
")",
"<",
"/",
"code",
">",
"doing",
"some",
"additional",
"checks",
"on",
"permissions",
".",
"The",
"order",
"of",
"the",
"returned",
"files",
"is",
"defined",
"by",
"the",
"underlying",
"{",
"@link",
"File#listFiles",
"(",
"FileFilter",
")",
"}",
"method",
"."
]
| train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java#L732-L741 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper._hasSideEffects | protected Boolean _hasSideEffects(XMemberFeatureCall expression, ISideEffectContext context) {
"""
Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects.
"""
return internalHasOperationSideEffects(expression, context, false);
} | java | protected Boolean _hasSideEffects(XMemberFeatureCall expression, ISideEffectContext context) {
return internalHasOperationSideEffects(expression, context, false);
} | [
"protected",
"Boolean",
"_hasSideEffects",
"(",
"XMemberFeatureCall",
"expression",
",",
"ISideEffectContext",
"context",
")",
"{",
"return",
"internalHasOperationSideEffects",
"(",
"expression",
",",
"context",
",",
"false",
")",
";",
"}"
]
| Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects. | [
"Test",
"if",
"the",
"given",
"expression",
"has",
"side",
"effects",
"."
]
| train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L558-L560 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.isCalendar | public static final Function<String,Boolean> isCalendar(final String pattern, final Locale locale) {
"""
<p>
Checks whether the target {@link String} represents a {@link Calendar} or not.
If it returns true, {@link FnString#toCalendar(String, Locale)} can be called
safely.
</p>
<p>
Pattern format is that of <tt>java.text.SimpleDateFormat</tt>.
</p>
@param pattern the pattern to be used.
@param locale the locale which will be used for parsing month names
@return true if the target {@link String} represents a {@link Calendar},
false otherwise
"""
return new IsCalendar(pattern, locale);
} | java | public static final Function<String,Boolean> isCalendar(final String pattern, final Locale locale) {
return new IsCalendar(pattern, locale);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"Boolean",
">",
"isCalendar",
"(",
"final",
"String",
"pattern",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"new",
"IsCalendar",
"(",
"pattern",
",",
"locale",
")",
";",
"}"
]
| <p>
Checks whether the target {@link String} represents a {@link Calendar} or not.
If it returns true, {@link FnString#toCalendar(String, Locale)} can be called
safely.
</p>
<p>
Pattern format is that of <tt>java.text.SimpleDateFormat</tt>.
</p>
@param pattern the pattern to be used.
@param locale the locale which will be used for parsing month names
@return true if the target {@link String} represents a {@link Calendar},
false otherwise | [
"<p",
">",
"Checks",
"whether",
"the",
"target",
"{",
"@link",
"String",
"}",
"represents",
"a",
"{",
"@link",
"Calendar",
"}",
"or",
"not",
".",
"If",
"it",
"returns",
"true",
"{",
"@link",
"FnString#toCalendar",
"(",
"String",
"Locale",
")",
"}",
"can",
"be",
"called",
"safely",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Pattern",
"format",
"is",
"that",
"of",
"<tt",
">",
"java",
".",
"text",
".",
"SimpleDateFormat<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L1626-L1628 |
ontop/ontop | core/optimization/src/main/java/it/unibz/inf/ontop/iq/executor/join/SelfJoinLikeExecutor.java | SelfJoinLikeExecutor.proposeForGroupingMap | protected PredicateLevelProposal proposeForGroupingMap(
ImmutableMultimap<ImmutableList<VariableOrGroundTerm>, ExtensionalDataNode> groupingMap)
throws AtomUnificationException {
"""
groupingMap groups data nodes that are being joined on the unique constraints
creates proposal to unify redundant nodes
"""
ImmutableCollection<Collection<ExtensionalDataNode>> dataNodeGroups = groupingMap.asMap().values();
try {
/*
* Collection of unifying substitutions
*/
ImmutableSet<ImmutableSubstitution<VariableOrGroundTerm>> unifyingSubstitutions =
dataNodeGroups.stream()
.filter(g -> g.size() > 1)
.map(redundantNodes -> {
try {
return unifyRedundantNodes(redundantNodes);
} catch (AtomUnificationException e) {
throw new AtomUnificationRuntimeException(e);
}
})
.filter(s -> !s.isEmpty())
.collect(ImmutableCollectors.toSet());
/*
* All the nodes that have been at least once dominated (--> could thus be removed).
*
* Not parallellizable
*/
ImmutableSet<ExtensionalDataNode> removableNodes = ImmutableSet.copyOf(dataNodeGroups.stream()
.filter(sameRowDataNodes -> sameRowDataNodes.size() > 1)
.reduce(
new Dominance(),
Dominance::update,
(dom1, dom2) -> {
throw new IllegalStateException("Cannot be run in parallel");
})
.getRemovalNodes());
return new PredicateLevelProposal(unifyingSubstitutions, removableNodes);
/*
* Trick: rethrow the exception
*/
} catch (AtomUnificationRuntimeException e) {
throw e.checkedException;
}
} | java | protected PredicateLevelProposal proposeForGroupingMap(
ImmutableMultimap<ImmutableList<VariableOrGroundTerm>, ExtensionalDataNode> groupingMap)
throws AtomUnificationException {
ImmutableCollection<Collection<ExtensionalDataNode>> dataNodeGroups = groupingMap.asMap().values();
try {
/*
* Collection of unifying substitutions
*/
ImmutableSet<ImmutableSubstitution<VariableOrGroundTerm>> unifyingSubstitutions =
dataNodeGroups.stream()
.filter(g -> g.size() > 1)
.map(redundantNodes -> {
try {
return unifyRedundantNodes(redundantNodes);
} catch (AtomUnificationException e) {
throw new AtomUnificationRuntimeException(e);
}
})
.filter(s -> !s.isEmpty())
.collect(ImmutableCollectors.toSet());
/*
* All the nodes that have been at least once dominated (--> could thus be removed).
*
* Not parallellizable
*/
ImmutableSet<ExtensionalDataNode> removableNodes = ImmutableSet.copyOf(dataNodeGroups.stream()
.filter(sameRowDataNodes -> sameRowDataNodes.size() > 1)
.reduce(
new Dominance(),
Dominance::update,
(dom1, dom2) -> {
throw new IllegalStateException("Cannot be run in parallel");
})
.getRemovalNodes());
return new PredicateLevelProposal(unifyingSubstitutions, removableNodes);
/*
* Trick: rethrow the exception
*/
} catch (AtomUnificationRuntimeException e) {
throw e.checkedException;
}
} | [
"protected",
"PredicateLevelProposal",
"proposeForGroupingMap",
"(",
"ImmutableMultimap",
"<",
"ImmutableList",
"<",
"VariableOrGroundTerm",
">",
",",
"ExtensionalDataNode",
">",
"groupingMap",
")",
"throws",
"AtomUnificationException",
"{",
"ImmutableCollection",
"<",
"Collection",
"<",
"ExtensionalDataNode",
">>",
"dataNodeGroups",
"=",
"groupingMap",
".",
"asMap",
"(",
")",
".",
"values",
"(",
")",
";",
"try",
"{",
"/*\n * Collection of unifying substitutions\n */",
"ImmutableSet",
"<",
"ImmutableSubstitution",
"<",
"VariableOrGroundTerm",
">>",
"unifyingSubstitutions",
"=",
"dataNodeGroups",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"g",
"->",
"g",
".",
"size",
"(",
")",
">",
"1",
")",
".",
"map",
"(",
"redundantNodes",
"->",
"{",
"try",
"{",
"return",
"unifyRedundantNodes",
"(",
"redundantNodes",
")",
";",
"}",
"catch",
"(",
"AtomUnificationException",
"e",
")",
"{",
"throw",
"new",
"AtomUnificationRuntimeException",
"(",
"e",
")",
";",
"}",
"}",
")",
".",
"filter",
"(",
"s",
"->",
"!",
"s",
".",
"isEmpty",
"(",
")",
")",
".",
"collect",
"(",
"ImmutableCollectors",
".",
"toSet",
"(",
")",
")",
";",
"/*\n * All the nodes that have been at least once dominated (--> could thus be removed).\n *\n * Not parallellizable\n */",
"ImmutableSet",
"<",
"ExtensionalDataNode",
">",
"removableNodes",
"=",
"ImmutableSet",
".",
"copyOf",
"(",
"dataNodeGroups",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"sameRowDataNodes",
"->",
"sameRowDataNodes",
".",
"size",
"(",
")",
">",
"1",
")",
".",
"reduce",
"(",
"new",
"Dominance",
"(",
")",
",",
"Dominance",
"::",
"update",
",",
"(",
"dom1",
",",
"dom2",
")",
"->",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot be run in parallel\"",
")",
";",
"}",
")",
".",
"getRemovalNodes",
"(",
")",
")",
";",
"return",
"new",
"PredicateLevelProposal",
"(",
"unifyingSubstitutions",
",",
"removableNodes",
")",
";",
"/*\n * Trick: rethrow the exception\n */",
"}",
"catch",
"(",
"AtomUnificationRuntimeException",
"e",
")",
"{",
"throw",
"e",
".",
"checkedException",
";",
"}",
"}"
]
| groupingMap groups data nodes that are being joined on the unique constraints
creates proposal to unify redundant nodes | [
"groupingMap",
"groups",
"data",
"nodes",
"that",
"are",
"being",
"joined",
"on",
"the",
"unique",
"constraints"
]
| train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/optimization/src/main/java/it/unibz/inf/ontop/iq/executor/join/SelfJoinLikeExecutor.java#L186-L231 |
dnsjava/dnsjava | org/xbill/DNS/Message.java | Message.findRecord | public boolean
findRecord(Record r, int section) {
"""
Determines if the given record is already present in the given section.
@see Record
@see Section
"""
return (sections[section] != null && sections[section].contains(r));
} | java | public boolean
findRecord(Record r, int section) {
return (sections[section] != null && sections[section].contains(r));
} | [
"public",
"boolean",
"findRecord",
"(",
"Record",
"r",
",",
"int",
"section",
")",
"{",
"return",
"(",
"sections",
"[",
"section",
"]",
"!=",
"null",
"&&",
"sections",
"[",
"section",
"]",
".",
"contains",
"(",
"r",
")",
")",
";",
"}"
]
| Determines if the given record is already present in the given section.
@see Record
@see Section | [
"Determines",
"if",
"the",
"given",
"record",
"is",
"already",
"present",
"in",
"the",
"given",
"section",
"."
]
| train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Message.java#L210-L213 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java | OUTRES.relevantSubspace | protected boolean relevantSubspace(long[] subspace, DoubleDBIDList neigh, KernelDensityEstimator kernel) {
"""
Subspace relevance test.
@param subspace Subspace to test
@param neigh Neighbor list
@param kernel Kernel density estimator
@return relevance test result
"""
final double crit = K_S_CRITICAL001 / FastMath.sqrt(neigh.size() - 2);
double[] data = new double[neigh.size()];
Relation<? extends NumberVector> relation = kernel.relation;
for(int dim = BitsUtil.nextSetBit(subspace, 0); dim >= 0; dim = BitsUtil.nextSetBit(subspace, dim + 1)) {
// TODO: can/should we save this copy?
int count = 0;
for(DBIDIter neighbor = neigh.iter(); neighbor.valid(); neighbor.advance()) {
data[count++] = relation.get(neighbor).doubleValue(dim);
}
assert (count == neigh.size());
Arrays.sort(data);
final double min = data[0], norm = data[data.length - 1] - min;
// Kolmogorow-Smirnow-Test against uniform distribution:
boolean flag = false;
for(int j = 1, end = data.length - 1; j < end; j++) {
if(Math.abs(j / (data.length - 2.) - (data[j] - min) / norm) > crit) {
flag = true;
break;
}
}
if(!flag) {
return false;
}
}
return true;
} | java | protected boolean relevantSubspace(long[] subspace, DoubleDBIDList neigh, KernelDensityEstimator kernel) {
final double crit = K_S_CRITICAL001 / FastMath.sqrt(neigh.size() - 2);
double[] data = new double[neigh.size()];
Relation<? extends NumberVector> relation = kernel.relation;
for(int dim = BitsUtil.nextSetBit(subspace, 0); dim >= 0; dim = BitsUtil.nextSetBit(subspace, dim + 1)) {
// TODO: can/should we save this copy?
int count = 0;
for(DBIDIter neighbor = neigh.iter(); neighbor.valid(); neighbor.advance()) {
data[count++] = relation.get(neighbor).doubleValue(dim);
}
assert (count == neigh.size());
Arrays.sort(data);
final double min = data[0], norm = data[data.length - 1] - min;
// Kolmogorow-Smirnow-Test against uniform distribution:
boolean flag = false;
for(int j = 1, end = data.length - 1; j < end; j++) {
if(Math.abs(j / (data.length - 2.) - (data[j] - min) / norm) > crit) {
flag = true;
break;
}
}
if(!flag) {
return false;
}
}
return true;
} | [
"protected",
"boolean",
"relevantSubspace",
"(",
"long",
"[",
"]",
"subspace",
",",
"DoubleDBIDList",
"neigh",
",",
"KernelDensityEstimator",
"kernel",
")",
"{",
"final",
"double",
"crit",
"=",
"K_S_CRITICAL001",
"/",
"FastMath",
".",
"sqrt",
"(",
"neigh",
".",
"size",
"(",
")",
"-",
"2",
")",
";",
"double",
"[",
"]",
"data",
"=",
"new",
"double",
"[",
"neigh",
".",
"size",
"(",
")",
"]",
";",
"Relation",
"<",
"?",
"extends",
"NumberVector",
">",
"relation",
"=",
"kernel",
".",
"relation",
";",
"for",
"(",
"int",
"dim",
"=",
"BitsUtil",
".",
"nextSetBit",
"(",
"subspace",
",",
"0",
")",
";",
"dim",
">=",
"0",
";",
"dim",
"=",
"BitsUtil",
".",
"nextSetBit",
"(",
"subspace",
",",
"dim",
"+",
"1",
")",
")",
"{",
"// TODO: can/should we save this copy?",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"DBIDIter",
"neighbor",
"=",
"neigh",
".",
"iter",
"(",
")",
";",
"neighbor",
".",
"valid",
"(",
")",
";",
"neighbor",
".",
"advance",
"(",
")",
")",
"{",
"data",
"[",
"count",
"++",
"]",
"=",
"relation",
".",
"get",
"(",
"neighbor",
")",
".",
"doubleValue",
"(",
"dim",
")",
";",
"}",
"assert",
"(",
"count",
"==",
"neigh",
".",
"size",
"(",
")",
")",
";",
"Arrays",
".",
"sort",
"(",
"data",
")",
";",
"final",
"double",
"min",
"=",
"data",
"[",
"0",
"]",
",",
"norm",
"=",
"data",
"[",
"data",
".",
"length",
"-",
"1",
"]",
"-",
"min",
";",
"// Kolmogorow-Smirnow-Test against uniform distribution:",
"boolean",
"flag",
"=",
"false",
";",
"for",
"(",
"int",
"j",
"=",
"1",
",",
"end",
"=",
"data",
".",
"length",
"-",
"1",
";",
"j",
"<",
"end",
";",
"j",
"++",
")",
"{",
"if",
"(",
"Math",
".",
"abs",
"(",
"j",
"/",
"(",
"data",
".",
"length",
"-",
"2.",
")",
"-",
"(",
"data",
"[",
"j",
"]",
"-",
"min",
")",
"/",
"norm",
")",
">",
"crit",
")",
"{",
"flag",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"flag",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
]
| Subspace relevance test.
@param subspace Subspace to test
@param neigh Neighbor list
@param kernel Kernel density estimator
@return relevance test result | [
"Subspace",
"relevance",
"test",
"."
]
| train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java#L249-L277 |
groupon/monsoon | history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java | ToXdr.string_index_ | private int string_index_(dictionary_delta dict_delta, MetricValue str) {
"""
Lookup the index for the argument, or if it isn't present, create one.
"""
assert(str.getStrValue() != null);
final BiMap<MetricValue, Integer> dict = from_.getStrvalDict().inverse();
final Integer resolved = dict.get(str);
if (resolved != null) return resolved;
final int allocated = allocate_index_(dict);
dict.put(str, allocated);
// Create new pdd for serialization.
strval_dictionary_delta sdd = new strval_dictionary_delta();
sdd.id = allocated;
sdd.value = str.getStrValue();
// Append new entry to array.
dict_delta.sdd = Stream.concat(Arrays.stream(dict_delta.sdd), Stream.of(sdd))
.toArray(strval_dictionary_delta[]::new);
LOG.log(Level.FINE, "dict_delta.sdd: {0} items (added {1})", new Object[]{dict_delta.sdd.length, quotedString(sdd.value)});
return allocated;
} | java | private int string_index_(dictionary_delta dict_delta, MetricValue str) {
assert(str.getStrValue() != null);
final BiMap<MetricValue, Integer> dict = from_.getStrvalDict().inverse();
final Integer resolved = dict.get(str);
if (resolved != null) return resolved;
final int allocated = allocate_index_(dict);
dict.put(str, allocated);
// Create new pdd for serialization.
strval_dictionary_delta sdd = new strval_dictionary_delta();
sdd.id = allocated;
sdd.value = str.getStrValue();
// Append new entry to array.
dict_delta.sdd = Stream.concat(Arrays.stream(dict_delta.sdd), Stream.of(sdd))
.toArray(strval_dictionary_delta[]::new);
LOG.log(Level.FINE, "dict_delta.sdd: {0} items (added {1})", new Object[]{dict_delta.sdd.length, quotedString(sdd.value)});
return allocated;
} | [
"private",
"int",
"string_index_",
"(",
"dictionary_delta",
"dict_delta",
",",
"MetricValue",
"str",
")",
"{",
"assert",
"(",
"str",
".",
"getStrValue",
"(",
")",
"!=",
"null",
")",
";",
"final",
"BiMap",
"<",
"MetricValue",
",",
"Integer",
">",
"dict",
"=",
"from_",
".",
"getStrvalDict",
"(",
")",
".",
"inverse",
"(",
")",
";",
"final",
"Integer",
"resolved",
"=",
"dict",
".",
"get",
"(",
"str",
")",
";",
"if",
"(",
"resolved",
"!=",
"null",
")",
"return",
"resolved",
";",
"final",
"int",
"allocated",
"=",
"allocate_index_",
"(",
"dict",
")",
";",
"dict",
".",
"put",
"(",
"str",
",",
"allocated",
")",
";",
"// Create new pdd for serialization.",
"strval_dictionary_delta",
"sdd",
"=",
"new",
"strval_dictionary_delta",
"(",
")",
";",
"sdd",
".",
"id",
"=",
"allocated",
";",
"sdd",
".",
"value",
"=",
"str",
".",
"getStrValue",
"(",
")",
";",
"// Append new entry to array.",
"dict_delta",
".",
"sdd",
"=",
"Stream",
".",
"concat",
"(",
"Arrays",
".",
"stream",
"(",
"dict_delta",
".",
"sdd",
")",
",",
"Stream",
".",
"of",
"(",
"sdd",
")",
")",
".",
"toArray",
"(",
"strval_dictionary_delta",
"[",
"]",
"::",
"new",
")",
";",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"dict_delta.sdd: {0} items (added {1})\"",
",",
"new",
"Object",
"[",
"]",
"{",
"dict_delta",
".",
"sdd",
".",
"length",
",",
"quotedString",
"(",
"sdd",
".",
"value",
")",
"}",
")",
";",
"return",
"allocated",
";",
"}"
]
| Lookup the index for the argument, or if it isn't present, create one. | [
"Lookup",
"the",
"index",
"for",
"the",
"argument",
"or",
"if",
"it",
"isn",
"t",
"present",
"create",
"one",
"."
]
| train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/v1/xdr/ToXdr.java#L185-L204 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.getImportedKeysUsingShowCreateTable | public ResultSet getImportedKeysUsingShowCreateTable(String catalog, String table)
throws Exception {
"""
GetImportedKeysUsingShowCreateTable.
@param catalog catalog
@param table table
@return resultset
@throws Exception exception
"""
if (catalog == null || catalog.isEmpty()) {
throw new IllegalArgumentException("catalog");
}
if (table == null || table.isEmpty()) {
throw new IllegalArgumentException("table");
}
ResultSet rs = connection.createStatement().executeQuery("SHOW CREATE TABLE "
+ MariaDbConnection.quoteIdentifier(catalog) + "." + MariaDbConnection
.quoteIdentifier(table));
if (rs.next()) {
String tableDef = rs.getString(2);
return MariaDbDatabaseMetaData.getImportedKeys(tableDef, table, catalog, connection);
}
throw new SQLException("Fail to retrieve table information using SHOW CREATE TABLE");
} | java | public ResultSet getImportedKeysUsingShowCreateTable(String catalog, String table)
throws Exception {
if (catalog == null || catalog.isEmpty()) {
throw new IllegalArgumentException("catalog");
}
if (table == null || table.isEmpty()) {
throw new IllegalArgumentException("table");
}
ResultSet rs = connection.createStatement().executeQuery("SHOW CREATE TABLE "
+ MariaDbConnection.quoteIdentifier(catalog) + "." + MariaDbConnection
.quoteIdentifier(table));
if (rs.next()) {
String tableDef = rs.getString(2);
return MariaDbDatabaseMetaData.getImportedKeys(tableDef, table, catalog, connection);
}
throw new SQLException("Fail to retrieve table information using SHOW CREATE TABLE");
} | [
"public",
"ResultSet",
"getImportedKeysUsingShowCreateTable",
"(",
"String",
"catalog",
",",
"String",
"table",
")",
"throws",
"Exception",
"{",
"if",
"(",
"catalog",
"==",
"null",
"||",
"catalog",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"catalog\"",
")",
";",
"}",
"if",
"(",
"table",
"==",
"null",
"||",
"table",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"table\"",
")",
";",
"}",
"ResultSet",
"rs",
"=",
"connection",
".",
"createStatement",
"(",
")",
".",
"executeQuery",
"(",
"\"SHOW CREATE TABLE \"",
"+",
"MariaDbConnection",
".",
"quoteIdentifier",
"(",
"catalog",
")",
"+",
"\".\"",
"+",
"MariaDbConnection",
".",
"quoteIdentifier",
"(",
"table",
")",
")",
";",
"if",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"String",
"tableDef",
"=",
"rs",
".",
"getString",
"(",
"2",
")",
";",
"return",
"MariaDbDatabaseMetaData",
".",
"getImportedKeys",
"(",
"tableDef",
",",
"table",
",",
"catalog",
",",
"connection",
")",
";",
"}",
"throw",
"new",
"SQLException",
"(",
"\"Fail to retrieve table information using SHOW CREATE TABLE\"",
")",
";",
"}"
]
| GetImportedKeysUsingShowCreateTable.
@param catalog catalog
@param table table
@return resultset
@throws Exception exception | [
"GetImportedKeysUsingShowCreateTable",
"."
]
| train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L940-L959 |
GoSimpleLLC/nbvcxz | src/main/java/me/gosimple/nbvcxz/resources/CharacterCaseUtil.java | CharacterCaseUtil.fractionOfStringUppercase | public static double fractionOfStringUppercase(String input) {
"""
Of the characters in the string that have an uppercase form, how many are uppercased?
@param input Input string.
@return The fraction of uppercased characters, with {@code 0.0d} meaning that all uppercasable characters are in
lowercase and {@code 1.0d} that all of them are in uppercase.
"""
if (input == null)
{
return 0;
}
double upperCasableCharacters = 0;
double upperCount = 0;
for (int i = 0; i < input.length(); i++)
{
char c = input.charAt(i);
char uc = Character.toUpperCase(c);
char lc = Character.toLowerCase(c);
// If both the upper and lowercase version of a character are the same, then the character has
// no distinct uppercase form (e.g., a digit or punctuation). Ignore these.
if (c == uc && c == lc)
{
continue;
}
upperCasableCharacters++;
if (c == uc)
{
upperCount++;
}
}
return upperCasableCharacters == 0 ? 0 : upperCount / upperCasableCharacters;
} | java | public static double fractionOfStringUppercase(String input)
{
if (input == null)
{
return 0;
}
double upperCasableCharacters = 0;
double upperCount = 0;
for (int i = 0; i < input.length(); i++)
{
char c = input.charAt(i);
char uc = Character.toUpperCase(c);
char lc = Character.toLowerCase(c);
// If both the upper and lowercase version of a character are the same, then the character has
// no distinct uppercase form (e.g., a digit or punctuation). Ignore these.
if (c == uc && c == lc)
{
continue;
}
upperCasableCharacters++;
if (c == uc)
{
upperCount++;
}
}
return upperCasableCharacters == 0 ? 0 : upperCount / upperCasableCharacters;
} | [
"public",
"static",
"double",
"fractionOfStringUppercase",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"double",
"upperCasableCharacters",
"=",
"0",
";",
"double",
"upperCount",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"input",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
"input",
".",
"charAt",
"(",
"i",
")",
";",
"char",
"uc",
"=",
"Character",
".",
"toUpperCase",
"(",
"c",
")",
";",
"char",
"lc",
"=",
"Character",
".",
"toLowerCase",
"(",
"c",
")",
";",
"// If both the upper and lowercase version of a character are the same, then the character has",
"// no distinct uppercase form (e.g., a digit or punctuation). Ignore these.",
"if",
"(",
"c",
"==",
"uc",
"&&",
"c",
"==",
"lc",
")",
"{",
"continue",
";",
"}",
"upperCasableCharacters",
"++",
";",
"if",
"(",
"c",
"==",
"uc",
")",
"{",
"upperCount",
"++",
";",
"}",
"}",
"return",
"upperCasableCharacters",
"==",
"0",
"?",
"0",
":",
"upperCount",
"/",
"upperCasableCharacters",
";",
"}"
]
| Of the characters in the string that have an uppercase form, how many are uppercased?
@param input Input string.
@return The fraction of uppercased characters, with {@code 0.0d} meaning that all uppercasable characters are in
lowercase and {@code 1.0d} that all of them are in uppercase. | [
"Of",
"the",
"characters",
"in",
"the",
"string",
"that",
"have",
"an",
"uppercase",
"form",
"how",
"many",
"are",
"uppercased?"
]
| train | https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/resources/CharacterCaseUtil.java#L12-L41 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/repository/core/ext/util/ResultUtils.java | ResultUtils.convertToArray | @SuppressWarnings("PMD.LooseCoupling")
public static Object convertToArray(final Object result, final Class entityType, final boolean projection) {
"""
Convert result object to array.
@param result result object
@param entityType target entity type
@param projection true to apply projection, false otherwise
@return converted result
"""
final Collection res = result instanceof Collection
// no projection because its applied later
? (Collection) result : convertToCollectionImpl(result, ArrayList.class, entityType, false);
final Object array = Array.newInstance(entityType, res.size());
int i = 0;
for (Object obj : res) {
Array.set(array, i++, projection ? applyProjection(obj, entityType) : obj);
}
return array;
} | java | @SuppressWarnings("PMD.LooseCoupling")
public static Object convertToArray(final Object result, final Class entityType, final boolean projection) {
final Collection res = result instanceof Collection
// no projection because its applied later
? (Collection) result : convertToCollectionImpl(result, ArrayList.class, entityType, false);
final Object array = Array.newInstance(entityType, res.size());
int i = 0;
for (Object obj : res) {
Array.set(array, i++, projection ? applyProjection(obj, entityType) : obj);
}
return array;
} | [
"@",
"SuppressWarnings",
"(",
"\"PMD.LooseCoupling\"",
")",
"public",
"static",
"Object",
"convertToArray",
"(",
"final",
"Object",
"result",
",",
"final",
"Class",
"entityType",
",",
"final",
"boolean",
"projection",
")",
"{",
"final",
"Collection",
"res",
"=",
"result",
"instanceof",
"Collection",
"// no projection because its applied later",
"?",
"(",
"Collection",
")",
"result",
":",
"convertToCollectionImpl",
"(",
"result",
",",
"ArrayList",
".",
"class",
",",
"entityType",
",",
"false",
")",
";",
"final",
"Object",
"array",
"=",
"Array",
".",
"newInstance",
"(",
"entityType",
",",
"res",
".",
"size",
"(",
")",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Object",
"obj",
":",
"res",
")",
"{",
"Array",
".",
"set",
"(",
"array",
",",
"i",
"++",
",",
"projection",
"?",
"applyProjection",
"(",
"obj",
",",
"entityType",
")",
":",
"obj",
")",
";",
"}",
"return",
"array",
";",
"}"
]
| Convert result object to array.
@param result result object
@param entityType target entity type
@param projection true to apply projection, false otherwise
@return converted result | [
"Convert",
"result",
"object",
"to",
"array",
"."
]
| train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/core/ext/util/ResultUtils.java#L107-L118 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.equalsAnyIgnoreCase | public static boolean equalsAnyIgnoreCase(final CharSequence string, final CharSequence...searchStrings) {
"""
<p>Compares given <code>string</code> to a CharSequences vararg of <code>searchStrings</code>,
returning {@code true} if the <code>string</code> is equal to any of the <code>searchStrings</code>, ignoring case.</p>
<pre>
StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null) = false
StringUtils.equalsAnyIgnoreCase(null, null, null) = true
StringUtils.equalsAnyIgnoreCase(null, "abc", "def") = false
StringUtils.equalsAnyIgnoreCase("abc", null, "def") = false
StringUtils.equalsAnyIgnoreCase("abc", "abc", "def") = true
StringUtils.equalsAnyIgnoreCase("abc", "ABC", "DEF") = true
</pre>
@param string to compare, may be {@code null}.
@param searchStrings a vararg of strings, may be {@code null}.
@return {@code true} if the string is equal (case-insensitive) to any other element of <code>searchStrings</code>;
{@code false} if <code>searchStrings</code> is null or contains no matches.
@since 3.5
"""
if (ArrayUtils.isNotEmpty(searchStrings)) {
for (final CharSequence next : searchStrings) {
if (equalsIgnoreCase(string, next)) {
return true;
}
}
}
return false;
} | java | public static boolean equalsAnyIgnoreCase(final CharSequence string, final CharSequence...searchStrings) {
if (ArrayUtils.isNotEmpty(searchStrings)) {
for (final CharSequence next : searchStrings) {
if (equalsIgnoreCase(string, next)) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"equalsAnyIgnoreCase",
"(",
"final",
"CharSequence",
"string",
",",
"final",
"CharSequence",
"...",
"searchStrings",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isNotEmpty",
"(",
"searchStrings",
")",
")",
"{",
"for",
"(",
"final",
"CharSequence",
"next",
":",
"searchStrings",
")",
"{",
"if",
"(",
"equalsIgnoreCase",
"(",
"string",
",",
"next",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
]
| <p>Compares given <code>string</code> to a CharSequences vararg of <code>searchStrings</code>,
returning {@code true} if the <code>string</code> is equal to any of the <code>searchStrings</code>, ignoring case.</p>
<pre>
StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null) = false
StringUtils.equalsAnyIgnoreCase(null, null, null) = true
StringUtils.equalsAnyIgnoreCase(null, "abc", "def") = false
StringUtils.equalsAnyIgnoreCase("abc", null, "def") = false
StringUtils.equalsAnyIgnoreCase("abc", "abc", "def") = true
StringUtils.equalsAnyIgnoreCase("abc", "ABC", "DEF") = true
</pre>
@param string to compare, may be {@code null}.
@param searchStrings a vararg of strings, may be {@code null}.
@return {@code true} if the string is equal (case-insensitive) to any other element of <code>searchStrings</code>;
{@code false} if <code>searchStrings</code> is null or contains no matches.
@since 3.5 | [
"<p",
">",
"Compares",
"given",
"<code",
">",
"string<",
"/",
"code",
">",
"to",
"a",
"CharSequences",
"vararg",
"of",
"<code",
">",
"searchStrings<",
"/",
"code",
">",
"returning",
"{",
"@code",
"true",
"}",
"if",
"the",
"<code",
">",
"string<",
"/",
"code",
">",
"is",
"equal",
"to",
"any",
"of",
"the",
"<code",
">",
"searchStrings<",
"/",
"code",
">",
"ignoring",
"case",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L1274-L1283 |
Red5/red5-io | src/main/java/org/red5/io/m4a/impl/M4AReader.java | M4AReader.createPreStreamingTags | private void createPreStreamingTags() {
"""
Tag sequence MetaData, Audio config, remaining audio
Packet prefixes: af 00 ... 06 = Audio extra data (first audio packet) af 01 = Audio frame
Audio extra data(s): af 00 = Prefix 11 90 4f 14 = AAC Main = aottype 0 12 10 = AAC LC = aottype 1 13 90 56 e5 a5 48 00 = HE-AAC SBR =
aottype 2 06 = Suffix
Still not absolutely certain about this order or the bytes - need to verify later
"""
log.debug("Creating pre-streaming tags");
if (audioDecoderBytes != null) {
IoBuffer body = IoBuffer.allocate(audioDecoderBytes.length + 3);
body.put(new byte[] { (byte) 0xaf, (byte) 0 }); //prefix
if (log.isDebugEnabled()) {
log.debug("Audio decoder bytes: {}", HexDump.byteArrayToHexString(audioDecoderBytes));
}
body.put(audioDecoderBytes);
body.put((byte) 0x06); //suffix
ITag tag = new Tag(IoConstants.TYPE_AUDIO, 0, body.position(), null, prevFrameSize);
body.flip();
tag.setBody(body);
//add tag
firstTags.add(tag);
} else {
//default to aac-lc when the esds doesnt contain descripter bytes
log.warn("Audio decoder bytes were not available");
}
} | java | private void createPreStreamingTags() {
log.debug("Creating pre-streaming tags");
if (audioDecoderBytes != null) {
IoBuffer body = IoBuffer.allocate(audioDecoderBytes.length + 3);
body.put(new byte[] { (byte) 0xaf, (byte) 0 }); //prefix
if (log.isDebugEnabled()) {
log.debug("Audio decoder bytes: {}", HexDump.byteArrayToHexString(audioDecoderBytes));
}
body.put(audioDecoderBytes);
body.put((byte) 0x06); //suffix
ITag tag = new Tag(IoConstants.TYPE_AUDIO, 0, body.position(), null, prevFrameSize);
body.flip();
tag.setBody(body);
//add tag
firstTags.add(tag);
} else {
//default to aac-lc when the esds doesnt contain descripter bytes
log.warn("Audio decoder bytes were not available");
}
} | [
"private",
"void",
"createPreStreamingTags",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Creating pre-streaming tags\"",
")",
";",
"if",
"(",
"audioDecoderBytes",
"!=",
"null",
")",
"{",
"IoBuffer",
"body",
"=",
"IoBuffer",
".",
"allocate",
"(",
"audioDecoderBytes",
".",
"length",
"+",
"3",
")",
";",
"body",
".",
"put",
"(",
"new",
"byte",
"[",
"]",
"{",
"(",
"byte",
")",
"0xaf",
",",
"(",
"byte",
")",
"0",
"}",
")",
";",
"//prefix",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Audio decoder bytes: {}\"",
",",
"HexDump",
".",
"byteArrayToHexString",
"(",
"audioDecoderBytes",
")",
")",
";",
"}",
"body",
".",
"put",
"(",
"audioDecoderBytes",
")",
";",
"body",
".",
"put",
"(",
"(",
"byte",
")",
"0x06",
")",
";",
"//suffix",
"ITag",
"tag",
"=",
"new",
"Tag",
"(",
"IoConstants",
".",
"TYPE_AUDIO",
",",
"0",
",",
"body",
".",
"position",
"(",
")",
",",
"null",
",",
"prevFrameSize",
")",
";",
"body",
".",
"flip",
"(",
")",
";",
"tag",
".",
"setBody",
"(",
"body",
")",
";",
"//add tag",
"firstTags",
".",
"add",
"(",
"tag",
")",
";",
"}",
"else",
"{",
"//default to aac-lc when the esds doesnt contain descripter bytes",
"log",
".",
"warn",
"(",
"\"Audio decoder bytes were not available\"",
")",
";",
"}",
"}"
]
| Tag sequence MetaData, Audio config, remaining audio
Packet prefixes: af 00 ... 06 = Audio extra data (first audio packet) af 01 = Audio frame
Audio extra data(s): af 00 = Prefix 11 90 4f 14 = AAC Main = aottype 0 12 10 = AAC LC = aottype 1 13 90 56 e5 a5 48 00 = HE-AAC SBR =
aottype 2 06 = Suffix
Still not absolutely certain about this order or the bytes - need to verify later | [
"Tag",
"sequence",
"MetaData",
"Audio",
"config",
"remaining",
"audio"
]
| train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/m4a/impl/M4AReader.java#L605-L624 |
JM-Lab/utils-java9 | src/main/java/kr/jm/utils/helper/JMJson.java | JMJson.toMapList | public static List<Map<String, Object>> toMapList(
String jsonMapListString) {
"""
To map list list.
@param jsonMapListString the json map list string
@return the list
"""
return withJsonString(jsonMapListString, LIST_MAP_TYPE_REFERENCE);
} | java | public static List<Map<String, Object>> toMapList(
String jsonMapListString) {
return withJsonString(jsonMapListString, LIST_MAP_TYPE_REFERENCE);
} | [
"public",
"static",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"toMapList",
"(",
"String",
"jsonMapListString",
")",
"{",
"return",
"withJsonString",
"(",
"jsonMapListString",
",",
"LIST_MAP_TYPE_REFERENCE",
")",
";",
"}"
]
| To map list list.
@param jsonMapListString the json map list string
@return the list | [
"To",
"map",
"list",
"list",
"."
]
| train | https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L190-L193 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java | TmdbGenres.getGenreMovieList | public ResultList<Genre> getGenreMovieList(String language) throws MovieDbException {
"""
Get the list of movie genres.
@param language
@return
@throws MovieDbException
"""
return getGenreList(language, MethodSub.MOVIE_LIST);
} | java | public ResultList<Genre> getGenreMovieList(String language) throws MovieDbException {
return getGenreList(language, MethodSub.MOVIE_LIST);
} | [
"public",
"ResultList",
"<",
"Genre",
">",
"getGenreMovieList",
"(",
"String",
"language",
")",
"throws",
"MovieDbException",
"{",
"return",
"getGenreList",
"(",
"language",
",",
"MethodSub",
".",
"MOVIE_LIST",
")",
";",
"}"
]
| Get the list of movie genres.
@param language
@return
@throws MovieDbException | [
"Get",
"the",
"list",
"of",
"movie",
"genres",
"."
]
| train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbGenres.java#L62-L64 |
maguro/aunit | junit/src/main/java/com/toolazydogs/aunit/internal/Util.java | Util.validatePublicNoArg | @SuppressWarnings( {
"""
Validate that a method is public, has no arguments.
@param method the method to be tested
@param errors a list to place the errors
""""ThrowableInstanceNeverThrown"})
public static void validatePublicNoArg(Method method, List<Throwable> errors)
{
if (!Modifier.isPublic(method.getModifiers()))
{
errors.add(new Exception("Method " + method.getName() + "() should be public"));
}
if (method.getParameterTypes().length != 0)
{
errors.add(new Exception("Method " + method.getName() + " should have no parameters"));
}
} | java | @SuppressWarnings({"ThrowableInstanceNeverThrown"})
public static void validatePublicNoArg(Method method, List<Throwable> errors)
{
if (!Modifier.isPublic(method.getModifiers()))
{
errors.add(new Exception("Method " + method.getName() + "() should be public"));
}
if (method.getParameterTypes().length != 0)
{
errors.add(new Exception("Method " + method.getName() + " should have no parameters"));
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"ThrowableInstanceNeverThrown\"",
"}",
")",
"public",
"static",
"void",
"validatePublicNoArg",
"(",
"Method",
"method",
",",
"List",
"<",
"Throwable",
">",
"errors",
")",
"{",
"if",
"(",
"!",
"Modifier",
".",
"isPublic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"errors",
".",
"add",
"(",
"new",
"Exception",
"(",
"\"Method \"",
"+",
"method",
".",
"getName",
"(",
")",
"+",
"\"() should be public\"",
")",
")",
";",
"}",
"if",
"(",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"!=",
"0",
")",
"{",
"errors",
".",
"add",
"(",
"new",
"Exception",
"(",
"\"Method \"",
"+",
"method",
".",
"getName",
"(",
")",
"+",
"\" should have no parameters\"",
")",
")",
";",
"}",
"}"
]
| Validate that a method is public, has no arguments.
@param method the method to be tested
@param errors a list to place the errors | [
"Validate",
"that",
"a",
"method",
"is",
"public",
"has",
"no",
"arguments",
"."
]
| train | https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/internal/Util.java#L35-L46 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java | GeoJsonToAssembler.fromTransferObject | public Point fromTransferObject(PointTo input, CrsId crsId) {
"""
Creates a point object starting from a transfer object.
@param input the point transfer object
@param crsId the crs id to use (ignores the crs of the input). If null, uses the crs of the input.
@return the corresponding geometry
@throws IllegalArgumentException If the geometry could not be constructed due to an invalid transfer object
"""
if (input == null) { return null; }
crsId = getCrsId(input, crsId);
isValid(input);
return createPoint(input.getCoordinates(), crsId);
} | java | public Point fromTransferObject(PointTo input, CrsId crsId) {
if (input == null) { return null; }
crsId = getCrsId(input, crsId);
isValid(input);
return createPoint(input.getCoordinates(), crsId);
} | [
"public",
"Point",
"fromTransferObject",
"(",
"PointTo",
"input",
",",
"CrsId",
"crsId",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"crsId",
"=",
"getCrsId",
"(",
"input",
",",
"crsId",
")",
";",
"isValid",
"(",
"input",
")",
";",
"return",
"createPoint",
"(",
"input",
".",
"getCoordinates",
"(",
")",
",",
"crsId",
")",
";",
"}"
]
| Creates a point object starting from a transfer object.
@param input the point transfer object
@param crsId the crs id to use (ignores the crs of the input). If null, uses the crs of the input.
@return the corresponding geometry
@throws IllegalArgumentException If the geometry could not be constructed due to an invalid transfer object | [
"Creates",
"a",
"point",
"object",
"starting",
"from",
"a",
"transfer",
"object",
"."
]
| train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java#L428-L435 |
knowm/XChange | xchange-quadrigacx/src/main/java/org/knowm/xchange/quadrigacx/service/QuadrigaCxAccountService.java | QuadrigaCxAccountService.requestDepositAddress | @Override
public String requestDepositAddress(Currency currency, String... arguments) throws IOException {
"""
This returns the currently set deposit address. It will not generate a new address (ie.
repeated calls will return the same address).
"""
if (currency.equals(Currency.BTC))
return getQuadrigaCxBitcoinDepositAddress().getDepositAddress();
else if (currency.equals(Currency.ETH))
return getQuadrigaCxEtherDepositAddress().getDepositAddress();
else if (currency.equals(Currency.BCH))
return getQuadrigaCxBitcoinCachDepositAddress().getDepositAddress();
else if (currency.equals(Currency.BTG))
return getQuadrigaCxBitcoinGoldDepositAddress().getDepositAddress();
else if (currency.equals(Currency.LTC))
return getQuadrigaCxLitecoinDepositAddress().getDepositAddress();
else throw new IllegalStateException("unsupported ccy " + currency);
} | java | @Override
public String requestDepositAddress(Currency currency, String... arguments) throws IOException {
if (currency.equals(Currency.BTC))
return getQuadrigaCxBitcoinDepositAddress().getDepositAddress();
else if (currency.equals(Currency.ETH))
return getQuadrigaCxEtherDepositAddress().getDepositAddress();
else if (currency.equals(Currency.BCH))
return getQuadrigaCxBitcoinCachDepositAddress().getDepositAddress();
else if (currency.equals(Currency.BTG))
return getQuadrigaCxBitcoinGoldDepositAddress().getDepositAddress();
else if (currency.equals(Currency.LTC))
return getQuadrigaCxLitecoinDepositAddress().getDepositAddress();
else throw new IllegalStateException("unsupported ccy " + currency);
} | [
"@",
"Override",
"public",
"String",
"requestDepositAddress",
"(",
"Currency",
"currency",
",",
"String",
"...",
"arguments",
")",
"throws",
"IOException",
"{",
"if",
"(",
"currency",
".",
"equals",
"(",
"Currency",
".",
"BTC",
")",
")",
"return",
"getQuadrigaCxBitcoinDepositAddress",
"(",
")",
".",
"getDepositAddress",
"(",
")",
";",
"else",
"if",
"(",
"currency",
".",
"equals",
"(",
"Currency",
".",
"ETH",
")",
")",
"return",
"getQuadrigaCxEtherDepositAddress",
"(",
")",
".",
"getDepositAddress",
"(",
")",
";",
"else",
"if",
"(",
"currency",
".",
"equals",
"(",
"Currency",
".",
"BCH",
")",
")",
"return",
"getQuadrigaCxBitcoinCachDepositAddress",
"(",
")",
".",
"getDepositAddress",
"(",
")",
";",
"else",
"if",
"(",
"currency",
".",
"equals",
"(",
"Currency",
".",
"BTG",
")",
")",
"return",
"getQuadrigaCxBitcoinGoldDepositAddress",
"(",
")",
".",
"getDepositAddress",
"(",
")",
";",
"else",
"if",
"(",
"currency",
".",
"equals",
"(",
"Currency",
".",
"LTC",
")",
")",
"return",
"getQuadrigaCxLitecoinDepositAddress",
"(",
")",
".",
"getDepositAddress",
"(",
")",
";",
"else",
"throw",
"new",
"IllegalStateException",
"(",
"\"unsupported ccy \"",
"+",
"currency",
")",
";",
"}"
]
| This returns the currently set deposit address. It will not generate a new address (ie.
repeated calls will return the same address). | [
"This",
"returns",
"the",
"currently",
"set",
"deposit",
"address",
".",
"It",
"will",
"not",
"generate",
"a",
"new",
"address",
"(",
"ie",
".",
"repeated",
"calls",
"will",
"return",
"the",
"same",
"address",
")",
"."
]
| train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-quadrigacx/src/main/java/org/knowm/xchange/quadrigacx/service/QuadrigaCxAccountService.java#L60-L73 |
JodaOrg/joda-time | src/main/java/org/joda/time/Period.java | Period.withSeconds | public Period withSeconds(int seconds) {
"""
Returns a new period with the specified number of seconds.
<p>
This period instance is immutable and unaffected by this method call.
@param seconds the amount of seconds to add, may be negative
@return the new period with the increased seconds
@throws UnsupportedOperationException if the field is not supported
"""
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.SECOND_INDEX, values, seconds);
return new Period(values, getPeriodType());
} | java | public Period withSeconds(int seconds) {
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.SECOND_INDEX, values, seconds);
return new Period(values, getPeriodType());
} | [
"public",
"Period",
"withSeconds",
"(",
"int",
"seconds",
")",
"{",
"int",
"[",
"]",
"values",
"=",
"getValues",
"(",
")",
";",
"// cloned",
"getPeriodType",
"(",
")",
".",
"setIndexedField",
"(",
"this",
",",
"PeriodType",
".",
"SECOND_INDEX",
",",
"values",
",",
"seconds",
")",
";",
"return",
"new",
"Period",
"(",
"values",
",",
"getPeriodType",
"(",
")",
")",
";",
"}"
]
| Returns a new period with the specified number of seconds.
<p>
This period instance is immutable and unaffected by this method call.
@param seconds the amount of seconds to add, may be negative
@return the new period with the increased seconds
@throws UnsupportedOperationException if the field is not supported | [
"Returns",
"a",
"new",
"period",
"with",
"the",
"specified",
"number",
"of",
"seconds",
".",
"<p",
">",
"This",
"period",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
]
| train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L1004-L1008 |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-postgresql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/postgresql/packet/command/PostgreSQLCommandPacketFactory.java | PostgreSQLCommandPacketFactory.newInstance | public static PostgreSQLCommandPacket newInstance(
final PostgreSQLCommandPacketType commandPacketType, final PostgreSQLPacketPayload payload, final int connectionId) throws SQLException {
"""
Create new instance of command packet.
@param commandPacketType command packet type for PostgreSQL
@param payload packet payload for PostgreSQL
@param connectionId connection id
@return command packet for PostgreSQL
@throws SQLException SQL exception
"""
switch (commandPacketType) {
case QUERY:
return new PostgreSQLComQueryPacket(payload);
case PARSE:
return new PostgreSQLComParsePacket(payload);
case BIND:
return new PostgreSQLComBindPacket(payload, connectionId);
case DESCRIBE:
return new PostgreSQLComDescribePacket(payload);
case EXECUTE:
return new PostgreSQLComExecutePacket(payload);
case SYNC:
return new PostgreSQLComSyncPacket(payload);
case TERMINATE:
return new PostgreSQLComTerminationPacket(payload);
default:
return new PostgreSQLUnsupportedCommandPacket(commandPacketType.getValue());
}
} | java | public static PostgreSQLCommandPacket newInstance(
final PostgreSQLCommandPacketType commandPacketType, final PostgreSQLPacketPayload payload, final int connectionId) throws SQLException {
switch (commandPacketType) {
case QUERY:
return new PostgreSQLComQueryPacket(payload);
case PARSE:
return new PostgreSQLComParsePacket(payload);
case BIND:
return new PostgreSQLComBindPacket(payload, connectionId);
case DESCRIBE:
return new PostgreSQLComDescribePacket(payload);
case EXECUTE:
return new PostgreSQLComExecutePacket(payload);
case SYNC:
return new PostgreSQLComSyncPacket(payload);
case TERMINATE:
return new PostgreSQLComTerminationPacket(payload);
default:
return new PostgreSQLUnsupportedCommandPacket(commandPacketType.getValue());
}
} | [
"public",
"static",
"PostgreSQLCommandPacket",
"newInstance",
"(",
"final",
"PostgreSQLCommandPacketType",
"commandPacketType",
",",
"final",
"PostgreSQLPacketPayload",
"payload",
",",
"final",
"int",
"connectionId",
")",
"throws",
"SQLException",
"{",
"switch",
"(",
"commandPacketType",
")",
"{",
"case",
"QUERY",
":",
"return",
"new",
"PostgreSQLComQueryPacket",
"(",
"payload",
")",
";",
"case",
"PARSE",
":",
"return",
"new",
"PostgreSQLComParsePacket",
"(",
"payload",
")",
";",
"case",
"BIND",
":",
"return",
"new",
"PostgreSQLComBindPacket",
"(",
"payload",
",",
"connectionId",
")",
";",
"case",
"DESCRIBE",
":",
"return",
"new",
"PostgreSQLComDescribePacket",
"(",
"payload",
")",
";",
"case",
"EXECUTE",
":",
"return",
"new",
"PostgreSQLComExecutePacket",
"(",
"payload",
")",
";",
"case",
"SYNC",
":",
"return",
"new",
"PostgreSQLComSyncPacket",
"(",
"payload",
")",
";",
"case",
"TERMINATE",
":",
"return",
"new",
"PostgreSQLComTerminationPacket",
"(",
"payload",
")",
";",
"default",
":",
"return",
"new",
"PostgreSQLUnsupportedCommandPacket",
"(",
"commandPacketType",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
]
| Create new instance of command packet.
@param commandPacketType command packet type for PostgreSQL
@param payload packet payload for PostgreSQL
@param connectionId connection id
@return command packet for PostgreSQL
@throws SQLException SQL exception | [
"Create",
"new",
"instance",
"of",
"command",
"packet",
"."
]
| train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-postgresql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/postgresql/packet/command/PostgreSQLCommandPacketFactory.java#L51-L71 |
javalite/activeweb | javalite-async/src/main/java/org/javalite/async/Async.java | Async.sendTextMessage | public void sendTextMessage(String queueName, String text, int deliveryMode, int priority, int timeToLive) {
"""
Sends a {@link TextMessage}.
@param queueName name of queue
@param text body of message
@param deliveryMode delivery mode: {@link javax.jms.DeliveryMode}.
@param priority priority of the message. Correct values are from 0 to 9, with higher number denoting a
higher priority.
@param timeToLive the message's lifetime (in milliseconds, where 0 is to never expire)
"""
checkStarted();
try(Session session = producerConnection.createSession()) {
checkInRange(deliveryMode, 1, 2, "delivery mode");
checkInRange(priority, 0, 9, "priority");
if (timeToLive < 0)
throw new AsyncException("time to live cannot be negative");
Queue queue = (Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName);
if (queue == null)
throw new AsyncException("Failed to find queue: " + queueName);
Message message = session.createTextMessage(text);
MessageProducer p = session.createProducer(queue);
p.send(message, deliveryMode, priority, timeToLive);
} catch (AsyncException e) {
throw e;
} catch (Exception e) {
throw new AsyncException("Failed to send message", e);
}
} | java | public void sendTextMessage(String queueName, String text, int deliveryMode, int priority, int timeToLive) {
checkStarted();
try(Session session = producerConnection.createSession()) {
checkInRange(deliveryMode, 1, 2, "delivery mode");
checkInRange(priority, 0, 9, "priority");
if (timeToLive < 0)
throw new AsyncException("time to live cannot be negative");
Queue queue = (Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName);
if (queue == null)
throw new AsyncException("Failed to find queue: " + queueName);
Message message = session.createTextMessage(text);
MessageProducer p = session.createProducer(queue);
p.send(message, deliveryMode, priority, timeToLive);
} catch (AsyncException e) {
throw e;
} catch (Exception e) {
throw new AsyncException("Failed to send message", e);
}
} | [
"public",
"void",
"sendTextMessage",
"(",
"String",
"queueName",
",",
"String",
"text",
",",
"int",
"deliveryMode",
",",
"int",
"priority",
",",
"int",
"timeToLive",
")",
"{",
"checkStarted",
"(",
")",
";",
"try",
"(",
"Session",
"session",
"=",
"producerConnection",
".",
"createSession",
"(",
")",
")",
"{",
"checkInRange",
"(",
"deliveryMode",
",",
"1",
",",
"2",
",",
"\"delivery mode\"",
")",
";",
"checkInRange",
"(",
"priority",
",",
"0",
",",
"9",
",",
"\"priority\"",
")",
";",
"if",
"(",
"timeToLive",
"<",
"0",
")",
"throw",
"new",
"AsyncException",
"(",
"\"time to live cannot be negative\"",
")",
";",
"Queue",
"queue",
"=",
"(",
"Queue",
")",
"jmsServer",
".",
"lookup",
"(",
"QUEUE_NAMESPACE",
"+",
"queueName",
")",
";",
"if",
"(",
"queue",
"==",
"null",
")",
"throw",
"new",
"AsyncException",
"(",
"\"Failed to find queue: \"",
"+",
"queueName",
")",
";",
"Message",
"message",
"=",
"session",
".",
"createTextMessage",
"(",
"text",
")",
";",
"MessageProducer",
"p",
"=",
"session",
".",
"createProducer",
"(",
"queue",
")",
";",
"p",
".",
"send",
"(",
"message",
",",
"deliveryMode",
",",
"priority",
",",
"timeToLive",
")",
";",
"}",
"catch",
"(",
"AsyncException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AsyncException",
"(",
"\"Failed to send message\"",
",",
"e",
")",
";",
"}",
"}"
]
| Sends a {@link TextMessage}.
@param queueName name of queue
@param text body of message
@param deliveryMode delivery mode: {@link javax.jms.DeliveryMode}.
@param priority priority of the message. Correct values are from 0 to 9, with higher number denoting a
higher priority.
@param timeToLive the message's lifetime (in milliseconds, where 0 is to never expire) | [
"Sends",
"a",
"{",
"@link",
"TextMessage",
"}",
"."
]
| train | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L497-L518 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java | BasicEvaluationCtx.getSubjectAttribute | public EvaluationResult getSubjectAttribute(URI type, URI id,
URI category) {
"""
Returns attribute value(s) from the subject section of the request
that have no issuer.
@param type the type of the attribute value(s) to find
@param id the id of the attribute value(s) to find
@param category the category the attribute value(s) must be in
@return a result containing a bag either empty because no values were
found or containing at least one value, or status associated with an
Indeterminate result
"""
return getSubjectAttribute(type, id, null, category);
} | java | public EvaluationResult getSubjectAttribute(URI type, URI id,
URI category) {
return getSubjectAttribute(type, id, null, category);
} | [
"public",
"EvaluationResult",
"getSubjectAttribute",
"(",
"URI",
"type",
",",
"URI",
"id",
",",
"URI",
"category",
")",
"{",
"return",
"getSubjectAttribute",
"(",
"type",
",",
"id",
",",
"null",
",",
"category",
")",
";",
"}"
]
| Returns attribute value(s) from the subject section of the request
that have no issuer.
@param type the type of the attribute value(s) to find
@param id the id of the attribute value(s) to find
@param category the category the attribute value(s) must be in
@return a result containing a bag either empty because no values were
found or containing at least one value, or status associated with an
Indeterminate result | [
"Returns",
"attribute",
"value",
"(",
"s",
")",
"from",
"the",
"subject",
"section",
"of",
"the",
"request",
"that",
"have",
"no",
"issuer",
"."
]
| train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/security/impl/BasicEvaluationCtx.java#L541-L544 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java | RandomMatrices_DDRM.addUniform | public static void addUniform(DMatrixRMaj A , double min , double max , Random rand ) {
"""
<p>
Adds random values to each element in the matrix from an uniform distribution.<br>
<br>
a<sub>ij</sub> = a<sub>ij</sub> + U(min,max)<br>
</p>
@param A The matrix who is to be randomized. Modified
@param min The minimum value each element can be.
@param max The maximum value each element can be..
@param rand Random number generator used to fill the matrix.
"""
double d[] = A.getData();
int size = A.getNumElements();
double r = max-min;
for( int i = 0; i < size; i++ ) {
d[i] += r*rand.nextDouble()+min;
}
} | java | public static void addUniform(DMatrixRMaj A , double min , double max , Random rand ) {
double d[] = A.getData();
int size = A.getNumElements();
double r = max-min;
for( int i = 0; i < size; i++ ) {
d[i] += r*rand.nextDouble()+min;
}
} | [
"public",
"static",
"void",
"addUniform",
"(",
"DMatrixRMaj",
"A",
",",
"double",
"min",
",",
"double",
"max",
",",
"Random",
"rand",
")",
"{",
"double",
"d",
"[",
"]",
"=",
"A",
".",
"getData",
"(",
")",
";",
"int",
"size",
"=",
"A",
".",
"getNumElements",
"(",
")",
";",
"double",
"r",
"=",
"max",
"-",
"min",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"d",
"[",
"i",
"]",
"+=",
"r",
"*",
"rand",
".",
"nextDouble",
"(",
")",
"+",
"min",
";",
"}",
"}"
]
| <p>
Adds random values to each element in the matrix from an uniform distribution.<br>
<br>
a<sub>ij</sub> = a<sub>ij</sub> + U(min,max)<br>
</p>
@param A The matrix who is to be randomized. Modified
@param min The minimum value each element can be.
@param max The maximum value each element can be..
@param rand Random number generator used to fill the matrix. | [
"<p",
">",
"Adds",
"random",
"values",
"to",
"each",
"element",
"in",
"the",
"matrix",
"from",
"an",
"uniform",
"distribution",
".",
"<br",
">",
"<br",
">",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"+",
"U",
"(",
"min",
"max",
")",
"<br",
">",
"<",
"/",
"p",
">"
]
| train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L304-L313 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.