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
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
ktoso/janbanery | janbanery-core/src/main/java/pl/project13/janbanery/core/rest/AsyncHttpClientRestClient.java | AsyncHttpClientRestClient.doGet | @Override
@SuppressWarnings("unchecked")
public <T> T doGet(String url, Type returnType) throws ServerCommunicationException {
"""
Delegate to {@link AsyncHttpClientRestClient#doGet(String)} and also use {@link Gson} to parse the returned json
into the requested object
@param url url to call
@param returnType taskType to parse the returned json into
@param <T> the return taskType, should match returnType
@return the KanbaneryResource created by parsing the retrieved json
@throws ServerCommunicationException if the response body could not be fetched
"""
RestClientResponse response = doGet(url);
String responseBody = response.getResponseBody();
return (T) gson.fromJson(responseBody, returnType);
} | java | @Override
@SuppressWarnings("unchecked")
public <T> T doGet(String url, Type returnType) throws ServerCommunicationException {
RestClientResponse response = doGet(url);
String responseBody = response.getResponseBody();
return (T) gson.fromJson(responseBody, returnType);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"doGet",
"(",
"String",
"url",
",",
"Type",
"returnType",
")",
"throws",
"ServerCommunicationException",
"{",
"RestClientResponse",
"response",
"=",
"doGet",
"(",
"url",
")",
";",
"String",
"responseBody",
"=",
"response",
".",
"getResponseBody",
"(",
")",
";",
"return",
"(",
"T",
")",
"gson",
".",
"fromJson",
"(",
"responseBody",
",",
"returnType",
")",
";",
"}"
] | Delegate to {@link AsyncHttpClientRestClient#doGet(String)} and also use {@link Gson} to parse the returned json
into the requested object
@param url url to call
@param returnType taskType to parse the returned json into
@param <T> the return taskType, should match returnType
@return the KanbaneryResource created by parsing the retrieved json
@throws ServerCommunicationException if the response body could not be fetched | [
"Delegate",
"to",
"{",
"@link",
"AsyncHttpClientRestClient#doGet",
"(",
"String",
")",
"}",
"and",
"also",
"use",
"{",
"@link",
"Gson",
"}",
"to",
"parse",
"the",
"returned",
"json",
"into",
"the",
"requested",
"object"
] | train | https://github.com/ktoso/janbanery/blob/cd77b774814c7fbb2a0c9c55d4c3f7e76affa636/janbanery-core/src/main/java/pl/project13/janbanery/core/rest/AsyncHttpClientRestClient.java#L134-L141 |
jglobus/JGlobus | axis/src/main/java/org/globus/axis/transport/HTTPUtils.java | HTTPUtils.setCloseConnection | public static void setCloseConnection(Stub stub, boolean close) {
"""
Sets on option on the stub to close the connection
after receiving the reply (connection will not
be reused).
@param stub The stub to set the property on
@param close If true, connection close will be requested. Otherwise
connection close will not be requested.
"""
Hashtable headers = getRequestHeaders(stub);
if (close) {
headers.put(HTTPConstants.HEADER_CONNECTION,
HTTPConstants.HEADER_CONNECTION_CLOSE);
} else {
headers.remove(HTTPConstants.HEADER_CONNECTION);
}
} | java | public static void setCloseConnection(Stub stub, boolean close) {
Hashtable headers = getRequestHeaders(stub);
if (close) {
headers.put(HTTPConstants.HEADER_CONNECTION,
HTTPConstants.HEADER_CONNECTION_CLOSE);
} else {
headers.remove(HTTPConstants.HEADER_CONNECTION);
}
} | [
"public",
"static",
"void",
"setCloseConnection",
"(",
"Stub",
"stub",
",",
"boolean",
"close",
")",
"{",
"Hashtable",
"headers",
"=",
"getRequestHeaders",
"(",
"stub",
")",
";",
"if",
"(",
"close",
")",
"{",
"headers",
".",
"put",
"(",
"HTTPConstants",
".",
"HEADER_CONNECTION",
",",
"HTTPConstants",
".",
"HEADER_CONNECTION_CLOSE",
")",
";",
"}",
"else",
"{",
"headers",
".",
"remove",
"(",
"HTTPConstants",
".",
"HEADER_CONNECTION",
")",
";",
"}",
"}"
] | Sets on option on the stub to close the connection
after receiving the reply (connection will not
be reused).
@param stub The stub to set the property on
@param close If true, connection close will be requested. Otherwise
connection close will not be requested. | [
"Sets",
"on",
"option",
"on",
"the",
"stub",
"to",
"close",
"the",
"connection",
"after",
"receiving",
"the",
"reply",
"(",
"connection",
"will",
"not",
"be",
"reused",
")",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/axis/src/main/java/org/globus/axis/transport/HTTPUtils.java#L51-L59 |
lecho/hellocharts-android | hellocharts-library/src/lecho/lib/hellocharts/renderer/BubbleChartRenderer.java | BubbleChartRenderer.processBubble | private float processBubble(BubbleValue bubbleValue, PointF point) {
"""
Calculate bubble radius and center x and y coordinates. Center x and x will be stored in point parameter, radius
will be returned as float value.
"""
final float rawX = computator.computeRawX(bubbleValue.getX());
final float rawY = computator.computeRawY(bubbleValue.getY());
float radius = (float) Math.sqrt(Math.abs(bubbleValue.getZ()) / Math.PI);
float rawRadius;
if (isBubbleScaledByX) {
radius *= bubbleScaleX;
rawRadius = computator.computeRawDistanceX(radius);
} else {
radius *= bubbleScaleY;
rawRadius = computator.computeRawDistanceY(radius);
}
if (rawRadius < minRawRadius + touchAdditional) {
rawRadius = minRawRadius + touchAdditional;
}
bubbleCenter.set(rawX, rawY);
if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
bubbleRect.set(rawX - rawRadius, rawY - rawRadius, rawX + rawRadius, rawY + rawRadius);
}
return rawRadius;
} | java | private float processBubble(BubbleValue bubbleValue, PointF point) {
final float rawX = computator.computeRawX(bubbleValue.getX());
final float rawY = computator.computeRawY(bubbleValue.getY());
float radius = (float) Math.sqrt(Math.abs(bubbleValue.getZ()) / Math.PI);
float rawRadius;
if (isBubbleScaledByX) {
radius *= bubbleScaleX;
rawRadius = computator.computeRawDistanceX(radius);
} else {
radius *= bubbleScaleY;
rawRadius = computator.computeRawDistanceY(radius);
}
if (rawRadius < minRawRadius + touchAdditional) {
rawRadius = minRawRadius + touchAdditional;
}
bubbleCenter.set(rawX, rawY);
if (ValueShape.SQUARE.equals(bubbleValue.getShape())) {
bubbleRect.set(rawX - rawRadius, rawY - rawRadius, rawX + rawRadius, rawY + rawRadius);
}
return rawRadius;
} | [
"private",
"float",
"processBubble",
"(",
"BubbleValue",
"bubbleValue",
",",
"PointF",
"point",
")",
"{",
"final",
"float",
"rawX",
"=",
"computator",
".",
"computeRawX",
"(",
"bubbleValue",
".",
"getX",
"(",
")",
")",
";",
"final",
"float",
"rawY",
"=",
"computator",
".",
"computeRawY",
"(",
"bubbleValue",
".",
"getY",
"(",
")",
")",
";",
"float",
"radius",
"=",
"(",
"float",
")",
"Math",
".",
"sqrt",
"(",
"Math",
".",
"abs",
"(",
"bubbleValue",
".",
"getZ",
"(",
")",
")",
"/",
"Math",
".",
"PI",
")",
";",
"float",
"rawRadius",
";",
"if",
"(",
"isBubbleScaledByX",
")",
"{",
"radius",
"*=",
"bubbleScaleX",
";",
"rawRadius",
"=",
"computator",
".",
"computeRawDistanceX",
"(",
"radius",
")",
";",
"}",
"else",
"{",
"radius",
"*=",
"bubbleScaleY",
";",
"rawRadius",
"=",
"computator",
".",
"computeRawDistanceY",
"(",
"radius",
")",
";",
"}",
"if",
"(",
"rawRadius",
"<",
"minRawRadius",
"+",
"touchAdditional",
")",
"{",
"rawRadius",
"=",
"minRawRadius",
"+",
"touchAdditional",
";",
"}",
"bubbleCenter",
".",
"set",
"(",
"rawX",
",",
"rawY",
")",
";",
"if",
"(",
"ValueShape",
".",
"SQUARE",
".",
"equals",
"(",
"bubbleValue",
".",
"getShape",
"(",
")",
")",
")",
"{",
"bubbleRect",
".",
"set",
"(",
"rawX",
"-",
"rawRadius",
",",
"rawY",
"-",
"rawRadius",
",",
"rawX",
"+",
"rawRadius",
",",
"rawY",
"+",
"rawRadius",
")",
";",
"}",
"return",
"rawRadius",
";",
"}"
] | Calculate bubble radius and center x and y coordinates. Center x and x will be stored in point parameter, radius
will be returned as float value. | [
"Calculate",
"bubble",
"radius",
"and",
"center",
"x",
"and",
"y",
"coordinates",
".",
"Center",
"x",
"and",
"x",
"will",
"be",
"stored",
"in",
"point",
"parameter",
"radius",
"will",
"be",
"returned",
"as",
"float",
"value",
"."
] | train | https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/renderer/BubbleChartRenderer.java#L240-L262 |
ops4j/org.ops4j.pax.swissbox | pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java | BndUtils.parseInstructions | public static Properties parseInstructions( final String query )
throws MalformedURLException {
"""
Parses bnd instructions out of an url query string.
@param query query part of an url.
@return parsed instructions as properties
@throws java.net.MalformedURLException if provided path does not comply to syntax.
"""
final Properties instructions = new Properties();
if( query != null )
{
try
{
// just ignore for the moment and try out if we have valid properties separated by "&"
final String segments[] = query.split( "&" );
for( String segment : segments )
{
// do not parse empty strings
if( segment.trim().length() > 0 )
{
final Matcher matcher = INSTRUCTIONS_PATTERN.matcher( segment );
if( matcher.matches() )
{
String key = matcher.group( 1 );
String val = matcher.group( 2 );
instructions.setProperty(
verifyKey(key),
val != null ? URLDecoder.decode( val, "UTF-8" ) : ""
);
}
else
{
throw new MalformedURLException( "Invalid syntax for instruction [" + segment
+ "]. Take a look at http://www.aqute.biz/Code/Bnd."
);
}
}
}
}
catch( UnsupportedEncodingException e )
{
// thrown by URLDecoder but it should never happen
throwAsMalformedURLException( "Could not retrieve the instructions from [" + query + "]", e );
}
}
return instructions;
} | java | public static Properties parseInstructions( final String query )
throws MalformedURLException
{
final Properties instructions = new Properties();
if( query != null )
{
try
{
// just ignore for the moment and try out if we have valid properties separated by "&"
final String segments[] = query.split( "&" );
for( String segment : segments )
{
// do not parse empty strings
if( segment.trim().length() > 0 )
{
final Matcher matcher = INSTRUCTIONS_PATTERN.matcher( segment );
if( matcher.matches() )
{
String key = matcher.group( 1 );
String val = matcher.group( 2 );
instructions.setProperty(
verifyKey(key),
val != null ? URLDecoder.decode( val, "UTF-8" ) : ""
);
}
else
{
throw new MalformedURLException( "Invalid syntax for instruction [" + segment
+ "]. Take a look at http://www.aqute.biz/Code/Bnd."
);
}
}
}
}
catch( UnsupportedEncodingException e )
{
// thrown by URLDecoder but it should never happen
throwAsMalformedURLException( "Could not retrieve the instructions from [" + query + "]", e );
}
}
return instructions;
} | [
"public",
"static",
"Properties",
"parseInstructions",
"(",
"final",
"String",
"query",
")",
"throws",
"MalformedURLException",
"{",
"final",
"Properties",
"instructions",
"=",
"new",
"Properties",
"(",
")",
";",
"if",
"(",
"query",
"!=",
"null",
")",
"{",
"try",
"{",
"// just ignore for the moment and try out if we have valid properties separated by \"&\"",
"final",
"String",
"segments",
"[",
"]",
"=",
"query",
".",
"split",
"(",
"\"&\"",
")",
";",
"for",
"(",
"String",
"segment",
":",
"segments",
")",
"{",
"// do not parse empty strings",
"if",
"(",
"segment",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"final",
"Matcher",
"matcher",
"=",
"INSTRUCTIONS_PATTERN",
".",
"matcher",
"(",
"segment",
")",
";",
"if",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"String",
"key",
"=",
"matcher",
".",
"group",
"(",
"1",
")",
";",
"String",
"val",
"=",
"matcher",
".",
"group",
"(",
"2",
")",
";",
"instructions",
".",
"setProperty",
"(",
"verifyKey",
"(",
"key",
")",
",",
"val",
"!=",
"null",
"?",
"URLDecoder",
".",
"decode",
"(",
"val",
",",
"\"UTF-8\"",
")",
":",
"\"\"",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"MalformedURLException",
"(",
"\"Invalid syntax for instruction [\"",
"+",
"segment",
"+",
"\"]. Take a look at http://www.aqute.biz/Code/Bnd.\"",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"// thrown by URLDecoder but it should never happen",
"throwAsMalformedURLException",
"(",
"\"Could not retrieve the instructions from [\"",
"+",
"query",
"+",
"\"]\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"instructions",
";",
"}"
] | Parses bnd instructions out of an url query string.
@param query query part of an url.
@return parsed instructions as properties
@throws java.net.MalformedURLException if provided path does not comply to syntax. | [
"Parses",
"bnd",
"instructions",
"out",
"of",
"an",
"url",
"query",
"string",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.swissbox/blob/00b0ee16cdbe8017984a4d7ba808b10d985c5b5c/pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java#L275-L316 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.setCMYKColorFill | public void setCMYKColorFill(int cyan, int magenta, int yellow, int black) {
"""
Changes the current color for filling paths (device dependent colors!).
<P>
Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space),
and sets the color to use for filling paths.</P>
<P>
This method is described in the 'Portable Document Format Reference Manual version 1.3'
section 8.5.2.1 (page 331).</P>
<P>
Following the PDF manual, each operand must be a number between 0 (no ink) and
1 (maximum ink). This method however accepts only integers between 0x00 and 0xFF.</P>
@param cyan the intensity of cyan
@param magenta the intensity of magenta
@param yellow the intensity of yellow
@param black the intensity of black
"""
content.append((float)(cyan & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(magenta & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(yellow & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(black & 0xFF) / 0xFF);
content.append(" k").append_i(separator);
} | java | public void setCMYKColorFill(int cyan, int magenta, int yellow, int black) {
content.append((float)(cyan & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(magenta & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(yellow & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(black & 0xFF) / 0xFF);
content.append(" k").append_i(separator);
} | [
"public",
"void",
"setCMYKColorFill",
"(",
"int",
"cyan",
",",
"int",
"magenta",
",",
"int",
"yellow",
",",
"int",
"black",
")",
"{",
"content",
".",
"append",
"(",
"(",
"float",
")",
"(",
"cyan",
"&",
"0xFF",
")",
"/",
"0xFF",
")",
";",
"content",
".",
"append",
"(",
"'",
"'",
")",
";",
"content",
".",
"append",
"(",
"(",
"float",
")",
"(",
"magenta",
"&",
"0xFF",
")",
"/",
"0xFF",
")",
";",
"content",
".",
"append",
"(",
"'",
"'",
")",
";",
"content",
".",
"append",
"(",
"(",
"float",
")",
"(",
"yellow",
"&",
"0xFF",
")",
"/",
"0xFF",
")",
";",
"content",
".",
"append",
"(",
"'",
"'",
")",
";",
"content",
".",
"append",
"(",
"(",
"float",
")",
"(",
"black",
"&",
"0xFF",
")",
"/",
"0xFF",
")",
";",
"content",
".",
"append",
"(",
"\" k\"",
")",
".",
"append_i",
"(",
"separator",
")",
";",
"}"
] | Changes the current color for filling paths (device dependent colors!).
<P>
Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space),
and sets the color to use for filling paths.</P>
<P>
This method is described in the 'Portable Document Format Reference Manual version 1.3'
section 8.5.2.1 (page 331).</P>
<P>
Following the PDF manual, each operand must be a number between 0 (no ink) and
1 (maximum ink). This method however accepts only integers between 0x00 and 0xFF.</P>
@param cyan the intensity of cyan
@param magenta the intensity of magenta
@param yellow the intensity of yellow
@param black the intensity of black | [
"Changes",
"the",
"current",
"color",
"for",
"filling",
"paths",
"(",
"device",
"dependent",
"colors!",
")",
".",
"<P",
">",
"Sets",
"the",
"color",
"space",
"to",
"<B",
">",
"DeviceCMYK<",
"/",
"B",
">",
"(",
"or",
"the",
"<B",
">",
"DefaultCMYK<",
"/",
"B",
">",
"color",
"space",
")",
"and",
"sets",
"the",
"color",
"to",
"use",
"for",
"filling",
"paths",
".",
"<",
"/",
"P",
">",
"<P",
">",
"This",
"method",
"is",
"described",
"in",
"the",
"Portable",
"Document",
"Format",
"Reference",
"Manual",
"version",
"1",
".",
"3",
"section",
"8",
".",
"5",
".",
"2",
".",
"1",
"(",
"page",
"331",
")",
".",
"<",
"/",
"P",
">",
"<P",
">",
"Following",
"the",
"PDF",
"manual",
"each",
"operand",
"must",
"be",
"a",
"number",
"between",
"0",
"(",
"no",
"ink",
")",
"and",
"1",
"(",
"maximum",
"ink",
")",
".",
"This",
"method",
"however",
"accepts",
"only",
"integers",
"between",
"0x00",
"and",
"0xFF",
".",
"<",
"/",
"P",
">"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2108-L2117 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createStrictMock | public static <T> T createStrictMock(Class<T> type, ConstructorArgs constructorArgs, Method... methods) {
"""
Creates a strict mock object that supports mocking of final and native
methods and invokes a specific constructor.
@param <T> the type of the mock object
@param type the type of the mock object
@param constructorArgs The constructor arguments that will be used to invoke a
special constructor.
@param methods optionally what methods to mock
@return the mock object.
"""
return doMock(type, false, new StrictMockStrategy(), constructorArgs, methods);
} | java | public static <T> T createStrictMock(Class<T> type, ConstructorArgs constructorArgs, Method... methods) {
return doMock(type, false, new StrictMockStrategy(), constructorArgs, methods);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createStrictMock",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"ConstructorArgs",
"constructorArgs",
",",
"Method",
"...",
"methods",
")",
"{",
"return",
"doMock",
"(",
"type",
",",
"false",
",",
"new",
"StrictMockStrategy",
"(",
")",
",",
"constructorArgs",
",",
"methods",
")",
";",
"}"
] | Creates a strict mock object that supports mocking of final and native
methods and invokes a specific constructor.
@param <T> the type of the mock object
@param type the type of the mock object
@param constructorArgs The constructor arguments that will be used to invoke a
special constructor.
@param methods optionally what methods to mock
@return the mock object. | [
"Creates",
"a",
"strict",
"mock",
"object",
"that",
"supports",
"mocking",
"of",
"final",
"and",
"native",
"methods",
"and",
"invokes",
"a",
"specific",
"constructor",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L190-L192 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java | PageInBrowserStats.getAverageDOMLoadTime | public double getAverageDOMLoadTime(final String intervalName, final TimeUnit unit) {
"""
Returns the average DOM load time for given interval and {@link TimeUnit}.
@param intervalName name of the interval
@param unit {@link TimeUnit}
@return average DOM load time
"""
return unit.transformMillis(totalDomLoadTime.getValueAsLong(intervalName)) / numberOfLoads.getValueAsDouble(intervalName);
} | java | public double getAverageDOMLoadTime(final String intervalName, final TimeUnit unit) {
return unit.transformMillis(totalDomLoadTime.getValueAsLong(intervalName)) / numberOfLoads.getValueAsDouble(intervalName);
} | [
"public",
"double",
"getAverageDOMLoadTime",
"(",
"final",
"String",
"intervalName",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"return",
"unit",
".",
"transformMillis",
"(",
"totalDomLoadTime",
".",
"getValueAsLong",
"(",
"intervalName",
")",
")",
"/",
"numberOfLoads",
".",
"getValueAsDouble",
"(",
"intervalName",
")",
";",
"}"
] | Returns the average DOM load time for given interval and {@link TimeUnit}.
@param intervalName name of the interval
@param unit {@link TimeUnit}
@return average DOM load time | [
"Returns",
"the",
"average",
"DOM",
"load",
"time",
"for",
"given",
"interval",
"and",
"{",
"@link",
"TimeUnit",
"}",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L210-L212 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicAtomGenerator.java | BasicAtomGenerator.invisibleCarbon | protected boolean invisibleCarbon(IAtom atom, IAtomContainer atomContainer, RendererModel model) {
"""
Checks an atom to see if it is an 'invisible carbon' - that is, it is:
a) a carbon atom and b) this carbon should not be shown.
@param atom the atom to check
@param atomContainer the atom container the atom is part of
@param model the renderer model
@return true if this atom should not be shown
"""
return isCarbon(atom) && !showCarbon(atom, atomContainer, model);
} | java | protected boolean invisibleCarbon(IAtom atom, IAtomContainer atomContainer, RendererModel model) {
return isCarbon(atom) && !showCarbon(atom, atomContainer, model);
} | [
"protected",
"boolean",
"invisibleCarbon",
"(",
"IAtom",
"atom",
",",
"IAtomContainer",
"atomContainer",
",",
"RendererModel",
"model",
")",
"{",
"return",
"isCarbon",
"(",
"atom",
")",
"&&",
"!",
"showCarbon",
"(",
"atom",
",",
"atomContainer",
",",
"model",
")",
";",
"}"
] | Checks an atom to see if it is an 'invisible carbon' - that is, it is:
a) a carbon atom and b) this carbon should not be shown.
@param atom the atom to check
@param atomContainer the atom container the atom is part of
@param model the renderer model
@return true if this atom should not be shown | [
"Checks",
"an",
"atom",
"to",
"see",
"if",
"it",
"is",
"an",
"invisible",
"carbon",
"-",
"that",
"is",
"it",
"is",
":",
"a",
")",
"a",
"carbon",
"atom",
"and",
"b",
")",
"this",
"carbon",
"should",
"not",
"be",
"shown",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicAtomGenerator.java#L275-L277 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_statistics_raid_unit_GET | public OvhRtmRaid serviceName_statistics_raid_unit_GET(String serviceName, String unit) throws IOException {
"""
Get this object properties
REST: GET /dedicated/server/{serviceName}/statistics/raid/{unit}
@param serviceName [required] The internal name of your dedicated server
@param unit [required] Raid unit
"""
String qPath = "/dedicated/server/{serviceName}/statistics/raid/{unit}";
StringBuilder sb = path(qPath, serviceName, unit);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRtmRaid.class);
} | java | public OvhRtmRaid serviceName_statistics_raid_unit_GET(String serviceName, String unit) throws IOException {
String qPath = "/dedicated/server/{serviceName}/statistics/raid/{unit}";
StringBuilder sb = path(qPath, serviceName, unit);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRtmRaid.class);
} | [
"public",
"OvhRtmRaid",
"serviceName_statistics_raid_unit_GET",
"(",
"String",
"serviceName",
",",
"String",
"unit",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/statistics/raid/{unit}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"unit",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhRtmRaid",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /dedicated/server/{serviceName}/statistics/raid/{unit}
@param serviceName [required] The internal name of your dedicated server
@param unit [required] Raid unit | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1460-L1465 |
mgormley/optimize | src/main/java/edu/jhu/hlt/optimize/LBFGS_port.java | LBFGS_port.QUARD_MINIMIZER | private static double QUARD_MINIMIZER(double qm, double u, double fu, double du, double v, double fv) {
"""
Find a minimizer of an interpolated quadratic function.
@param qm The minimizer of the interpolated quadratic.
@param u The value of one point, u.
@param fu The value of f(u).
@param du The value of f'(u).
@param v The value of another point, v.
@param fv The value of f(v).
"""
double a, d, gamma, theta, p, q, r, s;
a = (v) - (u);
(qm) = (u) + (du) / (((fu) - (fv)) / a + (du)) / 2 * a;
return qm;
} | java | private static double QUARD_MINIMIZER(double qm, double u, double fu, double du, double v, double fv) {
double a, d, gamma, theta, p, q, r, s;
a = (v) - (u);
(qm) = (u) + (du) / (((fu) - (fv)) / a + (du)) / 2 * a;
return qm;
} | [
"private",
"static",
"double",
"QUARD_MINIMIZER",
"(",
"double",
"qm",
",",
"double",
"u",
",",
"double",
"fu",
",",
"double",
"du",
",",
"double",
"v",
",",
"double",
"fv",
")",
"{",
"double",
"a",
",",
"d",
",",
"gamma",
",",
"theta",
",",
"p",
",",
"q",
",",
"r",
",",
"s",
";",
"a",
"=",
"(",
"v",
")",
"-",
"(",
"u",
")",
";",
"(",
"qm",
")",
"=",
"(",
"u",
")",
"+",
"(",
"du",
")",
"/",
"(",
"(",
"(",
"fu",
")",
"-",
"(",
"fv",
")",
")",
"/",
"a",
"+",
"(",
"du",
")",
")",
"/",
"2",
"*",
"a",
";",
"return",
"qm",
";",
"}"
] | Find a minimizer of an interpolated quadratic function.
@param qm The minimizer of the interpolated quadratic.
@param u The value of one point, u.
@param fu The value of f(u).
@param du The value of f'(u).
@param v The value of another point, v.
@param fv The value of f(v). | [
"Find",
"a",
"minimizer",
"of",
"an",
"interpolated",
"quadratic",
"function",
"."
] | train | https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/LBFGS_port.java#L1851-L1856 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.createIntrinsic | public static CameraPinholeBrown createIntrinsic(int width, int height, double hfov) {
"""
Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics.
The focal length is assumed to be the same for x and y.
@param width Image width
@param height Image height
@param hfov Horizontal FOV in degrees
@return guess camera parameters
"""
CameraPinholeBrown intrinsic = new CameraPinholeBrown();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.cx = width / 2;
intrinsic.cy = height / 2;
intrinsic.fx = intrinsic.cx / Math.tan(UtilAngle.degreeToRadian(hfov/2.0));
intrinsic.fy = intrinsic.fx;
return intrinsic;
} | java | public static CameraPinholeBrown createIntrinsic(int width, int height, double hfov) {
CameraPinholeBrown intrinsic = new CameraPinholeBrown();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.cx = width / 2;
intrinsic.cy = height / 2;
intrinsic.fx = intrinsic.cx / Math.tan(UtilAngle.degreeToRadian(hfov/2.0));
intrinsic.fy = intrinsic.fx;
return intrinsic;
} | [
"public",
"static",
"CameraPinholeBrown",
"createIntrinsic",
"(",
"int",
"width",
",",
"int",
"height",
",",
"double",
"hfov",
")",
"{",
"CameraPinholeBrown",
"intrinsic",
"=",
"new",
"CameraPinholeBrown",
"(",
")",
";",
"intrinsic",
".",
"width",
"=",
"width",
";",
"intrinsic",
".",
"height",
"=",
"height",
";",
"intrinsic",
".",
"cx",
"=",
"width",
"/",
"2",
";",
"intrinsic",
".",
"cy",
"=",
"height",
"/",
"2",
";",
"intrinsic",
".",
"fx",
"=",
"intrinsic",
".",
"cx",
"/",
"Math",
".",
"tan",
"(",
"UtilAngle",
".",
"degreeToRadian",
"(",
"hfov",
"/",
"2.0",
")",
")",
";",
"intrinsic",
".",
"fy",
"=",
"intrinsic",
".",
"fx",
";",
"return",
"intrinsic",
";",
"}"
] | Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics.
The focal length is assumed to be the same for x and y.
@param width Image width
@param height Image height
@param hfov Horizontal FOV in degrees
@return guess camera parameters | [
"Creates",
"a",
"set",
"of",
"intrinsic",
"parameters",
"without",
"distortion",
"for",
"a",
"camera",
"with",
"the",
"specified",
"characteristics",
".",
"The",
"focal",
"length",
"is",
"assumed",
"to",
"be",
"the",
"same",
"for",
"x",
"and",
"y",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L118-L128 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.fundamentalToEssential | public static DMatrixRMaj fundamentalToEssential( DMatrixRMaj F , DMatrixRMaj K , @Nullable DMatrixRMaj outputE ) {
"""
Given the calibration matrix, convert the fundamental matrix into an essential matrix. E = K'*F*k. The
singular values of the resulting E matrix are forced to be [1,1,0]
@param F (Input) Fundamental matrix. 3x3
@param K (Input) Calibration matrix (3x3)
@param outputE (Output) Found essential matrix
@return Essential matrix
"""
if( outputE == null )
outputE = new DMatrixRMaj(3,3);
PerspectiveOps.multTranA(K,F,K,outputE);
// this is unlikely to be a perfect essential matrix. reduce the error by enforcing essential constraints
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(true,true,false);
svd.decompose(outputE);
DMatrixRMaj U = svd.getU(null,false);
DMatrixRMaj W = svd.getW(null);
DMatrixRMaj V = svd.getV(null,false);
// settings value of singular values to be [1,1,0]. The first two singular values just need to be equal
// for it to be an essential matrix
SingularOps_DDRM.descendingOrder(U,false,W,V,false);
W.set(0,0,1);
W.set(1,1,1);
W.set(2,2,0);
PerspectiveOps.multTranC(U,W,V,outputE);
return outputE;
} | java | public static DMatrixRMaj fundamentalToEssential( DMatrixRMaj F , DMatrixRMaj K , @Nullable DMatrixRMaj outputE ) {
if( outputE == null )
outputE = new DMatrixRMaj(3,3);
PerspectiveOps.multTranA(K,F,K,outputE);
// this is unlikely to be a perfect essential matrix. reduce the error by enforcing essential constraints
SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(true,true,false);
svd.decompose(outputE);
DMatrixRMaj U = svd.getU(null,false);
DMatrixRMaj W = svd.getW(null);
DMatrixRMaj V = svd.getV(null,false);
// settings value of singular values to be [1,1,0]. The first two singular values just need to be equal
// for it to be an essential matrix
SingularOps_DDRM.descendingOrder(U,false,W,V,false);
W.set(0,0,1);
W.set(1,1,1);
W.set(2,2,0);
PerspectiveOps.multTranC(U,W,V,outputE);
return outputE;
} | [
"public",
"static",
"DMatrixRMaj",
"fundamentalToEssential",
"(",
"DMatrixRMaj",
"F",
",",
"DMatrixRMaj",
"K",
",",
"@",
"Nullable",
"DMatrixRMaj",
"outputE",
")",
"{",
"if",
"(",
"outputE",
"==",
"null",
")",
"outputE",
"=",
"new",
"DMatrixRMaj",
"(",
"3",
",",
"3",
")",
";",
"PerspectiveOps",
".",
"multTranA",
"(",
"K",
",",
"F",
",",
"K",
",",
"outputE",
")",
";",
"// this is unlikely to be a perfect essential matrix. reduce the error by enforcing essential constraints",
"SingularValueDecomposition_F64",
"<",
"DMatrixRMaj",
">",
"svd",
"=",
"DecompositionFactory_DDRM",
".",
"svd",
"(",
"true",
",",
"true",
",",
"false",
")",
";",
"svd",
".",
"decompose",
"(",
"outputE",
")",
";",
"DMatrixRMaj",
"U",
"=",
"svd",
".",
"getU",
"(",
"null",
",",
"false",
")",
";",
"DMatrixRMaj",
"W",
"=",
"svd",
".",
"getW",
"(",
"null",
")",
";",
"DMatrixRMaj",
"V",
"=",
"svd",
".",
"getV",
"(",
"null",
",",
"false",
")",
";",
"// settings value of singular values to be [1,1,0]. The first two singular values just need to be equal",
"// for it to be an essential matrix",
"SingularOps_DDRM",
".",
"descendingOrder",
"(",
"U",
",",
"false",
",",
"W",
",",
"V",
",",
"false",
")",
";",
"W",
".",
"set",
"(",
"0",
",",
"0",
",",
"1",
")",
";",
"W",
".",
"set",
"(",
"1",
",",
"1",
",",
"1",
")",
";",
"W",
".",
"set",
"(",
"2",
",",
"2",
",",
"0",
")",
";",
"PerspectiveOps",
".",
"multTranC",
"(",
"U",
",",
"W",
",",
"V",
",",
"outputE",
")",
";",
"return",
"outputE",
";",
"}"
] | Given the calibration matrix, convert the fundamental matrix into an essential matrix. E = K'*F*k. The
singular values of the resulting E matrix are forced to be [1,1,0]
@param F (Input) Fundamental matrix. 3x3
@param K (Input) Calibration matrix (3x3)
@param outputE (Output) Found essential matrix
@return Essential matrix | [
"Given",
"the",
"calibration",
"matrix",
"convert",
"the",
"fundamental",
"matrix",
"into",
"an",
"essential",
"matrix",
".",
"E",
"=",
"K",
"*",
"F",
"*",
"k",
".",
"The",
"singular",
"values",
"of",
"the",
"resulting",
"E",
"matrix",
"are",
"forced",
"to",
"be",
"[",
"1",
"1",
"0",
"]"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L946-L970 |
tango-controls/JTango | server/src/main/java/org/tango/logging/LoggingManager.java | LoggingManager.addFileAppender | public void addFileAppender(final String fileName, final String deviceName) throws DevFailed {
"""
Add an file appender for a device
@param fileName
@param deviceName
@throws DevFailed
"""
if (rootLoggerBack != null) {
logger.debug("add file appender of {} in {}", deviceName, fileName);
final String deviceNameLower = deviceName.toLowerCase(Locale.ENGLISH);
final File f = new File(fileName);
if (!f.exists()) {
try {
f.createNewFile();
} catch (final IOException e) {
throw DevFailedUtils.newDevFailed(ExceptionMessages.CANNOT_OPEN_FILE, "impossible to open file "
+ fileName);
}
}
if (!f.canWrite()) {
throw DevFailedUtils.newDevFailed(ExceptionMessages.CANNOT_OPEN_FILE, "impossible to open file " + fileName);
}
// debug level by default
// setLoggingLevel(deviceName, LoggingLevel.DEBUG.toInt());
System.out.println("create file " + f);
final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
final FileAppender rfAppender = new FileAppender(deviceNameLower);
fileAppenders.put(deviceNameLower, rfAppender);
rfAppender.setName("FILE-" + deviceNameLower);
rfAppender.setLevel(rootLoggingLevel);
// rfAppender.setContext(appender.getContext());
rfAppender.setFile(fileName);
rfAppender.setAppend(true);
rfAppender.setContext(loggerContext);
final FixedWindowRollingPolicy rollingPolicy = new FixedWindowRollingPolicy();
// rolling policies need to know their parent
// it's one of the rare cases, where a sub-component knows about its parent
rollingPolicy.setParent(rfAppender);
rollingPolicy.setContext(loggerContext);
rollingPolicy.setFileNamePattern(fileName + "%i");
rollingPolicy.setMaxIndex(1);
rollingPolicy.setMaxIndex(3);
rollingPolicy.start();
final SizeBasedTriggeringPolicy<ILoggingEvent> triggeringPolicy = new SizeBasedTriggeringPolicy<ILoggingEvent>();
triggeringPolicy.setMaxFileSize(FileSize.valueOf("5 mb"));
triggeringPolicy.setContext(loggerContext);
triggeringPolicy.start();
final PatternLayoutEncoder encoder = new PatternLayoutEncoder();
encoder.setContext(loggerContext);
encoder.setPattern("%-5level %d %X{deviceName} - %thread | %logger{25}.%M:%L - %msg%n");
encoder.start();
rfAppender.setEncoder(encoder);
rfAppender.setRollingPolicy(rollingPolicy);
rfAppender.setTriggeringPolicy(triggeringPolicy);
rfAppender.start();
rootLoggerBack.addAppender(rfAppender);
rfAppender.start();
// OPTIONAL: print logback internal status messages
// StatusPrinter.print(loggerContext);
}
} | java | public void addFileAppender(final String fileName, final String deviceName) throws DevFailed {
if (rootLoggerBack != null) {
logger.debug("add file appender of {} in {}", deviceName, fileName);
final String deviceNameLower = deviceName.toLowerCase(Locale.ENGLISH);
final File f = new File(fileName);
if (!f.exists()) {
try {
f.createNewFile();
} catch (final IOException e) {
throw DevFailedUtils.newDevFailed(ExceptionMessages.CANNOT_OPEN_FILE, "impossible to open file "
+ fileName);
}
}
if (!f.canWrite()) {
throw DevFailedUtils.newDevFailed(ExceptionMessages.CANNOT_OPEN_FILE, "impossible to open file " + fileName);
}
// debug level by default
// setLoggingLevel(deviceName, LoggingLevel.DEBUG.toInt());
System.out.println("create file " + f);
final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
final FileAppender rfAppender = new FileAppender(deviceNameLower);
fileAppenders.put(deviceNameLower, rfAppender);
rfAppender.setName("FILE-" + deviceNameLower);
rfAppender.setLevel(rootLoggingLevel);
// rfAppender.setContext(appender.getContext());
rfAppender.setFile(fileName);
rfAppender.setAppend(true);
rfAppender.setContext(loggerContext);
final FixedWindowRollingPolicy rollingPolicy = new FixedWindowRollingPolicy();
// rolling policies need to know their parent
// it's one of the rare cases, where a sub-component knows about its parent
rollingPolicy.setParent(rfAppender);
rollingPolicy.setContext(loggerContext);
rollingPolicy.setFileNamePattern(fileName + "%i");
rollingPolicy.setMaxIndex(1);
rollingPolicy.setMaxIndex(3);
rollingPolicy.start();
final SizeBasedTriggeringPolicy<ILoggingEvent> triggeringPolicy = new SizeBasedTriggeringPolicy<ILoggingEvent>();
triggeringPolicy.setMaxFileSize(FileSize.valueOf("5 mb"));
triggeringPolicy.setContext(loggerContext);
triggeringPolicy.start();
final PatternLayoutEncoder encoder = new PatternLayoutEncoder();
encoder.setContext(loggerContext);
encoder.setPattern("%-5level %d %X{deviceName} - %thread | %logger{25}.%M:%L - %msg%n");
encoder.start();
rfAppender.setEncoder(encoder);
rfAppender.setRollingPolicy(rollingPolicy);
rfAppender.setTriggeringPolicy(triggeringPolicy);
rfAppender.start();
rootLoggerBack.addAppender(rfAppender);
rfAppender.start();
// OPTIONAL: print logback internal status messages
// StatusPrinter.print(loggerContext);
}
} | [
"public",
"void",
"addFileAppender",
"(",
"final",
"String",
"fileName",
",",
"final",
"String",
"deviceName",
")",
"throws",
"DevFailed",
"{",
"if",
"(",
"rootLoggerBack",
"!=",
"null",
")",
"{",
"logger",
".",
"debug",
"(",
"\"add file appender of {} in {}\"",
",",
"deviceName",
",",
"fileName",
")",
";",
"final",
"String",
"deviceNameLower",
"=",
"deviceName",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"final",
"File",
"f",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"if",
"(",
"!",
"f",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"f",
".",
"createNewFile",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"ExceptionMessages",
".",
"CANNOT_OPEN_FILE",
",",
"\"impossible to open file \"",
"+",
"fileName",
")",
";",
"}",
"}",
"if",
"(",
"!",
"f",
".",
"canWrite",
"(",
")",
")",
"{",
"throw",
"DevFailedUtils",
".",
"newDevFailed",
"(",
"ExceptionMessages",
".",
"CANNOT_OPEN_FILE",
",",
"\"impossible to open file \"",
"+",
"fileName",
")",
";",
"}",
"// debug level by default",
"// setLoggingLevel(deviceName, LoggingLevel.DEBUG.toInt());",
"System",
".",
"out",
".",
"println",
"(",
"\"create file \"",
"+",
"f",
")",
";",
"final",
"LoggerContext",
"loggerContext",
"=",
"(",
"LoggerContext",
")",
"LoggerFactory",
".",
"getILoggerFactory",
"(",
")",
";",
"final",
"FileAppender",
"rfAppender",
"=",
"new",
"FileAppender",
"(",
"deviceNameLower",
")",
";",
"fileAppenders",
".",
"put",
"(",
"deviceNameLower",
",",
"rfAppender",
")",
";",
"rfAppender",
".",
"setName",
"(",
"\"FILE-\"",
"+",
"deviceNameLower",
")",
";",
"rfAppender",
".",
"setLevel",
"(",
"rootLoggingLevel",
")",
";",
"// rfAppender.setContext(appender.getContext());",
"rfAppender",
".",
"setFile",
"(",
"fileName",
")",
";",
"rfAppender",
".",
"setAppend",
"(",
"true",
")",
";",
"rfAppender",
".",
"setContext",
"(",
"loggerContext",
")",
";",
"final",
"FixedWindowRollingPolicy",
"rollingPolicy",
"=",
"new",
"FixedWindowRollingPolicy",
"(",
")",
";",
"// rolling policies need to know their parent",
"// it's one of the rare cases, where a sub-component knows about its parent",
"rollingPolicy",
".",
"setParent",
"(",
"rfAppender",
")",
";",
"rollingPolicy",
".",
"setContext",
"(",
"loggerContext",
")",
";",
"rollingPolicy",
".",
"setFileNamePattern",
"(",
"fileName",
"+",
"\"%i\"",
")",
";",
"rollingPolicy",
".",
"setMaxIndex",
"(",
"1",
")",
";",
"rollingPolicy",
".",
"setMaxIndex",
"(",
"3",
")",
";",
"rollingPolicy",
".",
"start",
"(",
")",
";",
"final",
"SizeBasedTriggeringPolicy",
"<",
"ILoggingEvent",
">",
"triggeringPolicy",
"=",
"new",
"SizeBasedTriggeringPolicy",
"<",
"ILoggingEvent",
">",
"(",
")",
";",
"triggeringPolicy",
".",
"setMaxFileSize",
"(",
"FileSize",
".",
"valueOf",
"(",
"\"5 mb\"",
")",
")",
";",
"triggeringPolicy",
".",
"setContext",
"(",
"loggerContext",
")",
";",
"triggeringPolicy",
".",
"start",
"(",
")",
";",
"final",
"PatternLayoutEncoder",
"encoder",
"=",
"new",
"PatternLayoutEncoder",
"(",
")",
";",
"encoder",
".",
"setContext",
"(",
"loggerContext",
")",
";",
"encoder",
".",
"setPattern",
"(",
"\"%-5level %d %X{deviceName} - %thread | %logger{25}.%M:%L - %msg%n\"",
")",
";",
"encoder",
".",
"start",
"(",
")",
";",
"rfAppender",
".",
"setEncoder",
"(",
"encoder",
")",
";",
"rfAppender",
".",
"setRollingPolicy",
"(",
"rollingPolicy",
")",
";",
"rfAppender",
".",
"setTriggeringPolicy",
"(",
"triggeringPolicy",
")",
";",
"rfAppender",
".",
"start",
"(",
")",
";",
"rootLoggerBack",
".",
"addAppender",
"(",
"rfAppender",
")",
";",
"rfAppender",
".",
"start",
"(",
")",
";",
"// OPTIONAL: print logback internal status messages",
"// StatusPrinter.print(loggerContext);",
"}",
"}"
] | Add an file appender for a device
@param fileName
@param deviceName
@throws DevFailed | [
"Add",
"an",
"file",
"appender",
"for",
"a",
"device"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/logging/LoggingManager.java#L197-L257 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java | CloudStorageFileSystemProvider.newFileChannel | @Override
public FileChannel newFileChannel(
Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
"""
Open a file for reading OR writing. The {@link FileChannel} that is returned will only allow
reads or writes depending on the {@link OpenOption}s that are specified. If any of the
following have been specified, the {@link FileChannel} will be write-only: {@link
StandardOpenOption#CREATE}
<ul>
<li>{@link StandardOpenOption#CREATE}
<li>{@link StandardOpenOption#CREATE_NEW}
<li>{@link StandardOpenOption#WRITE}
<li>{@link StandardOpenOption#TRUNCATE_EXISTING}
</ul>
In all other cases the {@link FileChannel} will be read-only.
@param path The path to the file to open or create
@param options The options specifying how the file should be opened, and whether the {@link
FileChannel} should be read-only or write-only.
@param attrs (not supported, the values will be ignored)
@throws IOException
"""
checkNotNull(path);
initStorage();
CloudStorageUtil.checkNotNullArray(attrs);
if (options.contains(StandardOpenOption.CREATE_NEW)) {
Files.createFile(path, attrs);
} else if (options.contains(StandardOpenOption.CREATE) && !Files.exists(path)) {
Files.createFile(path, attrs);
}
if (options.contains(StandardOpenOption.WRITE)
|| options.contains(StandardOpenOption.CREATE)
|| options.contains(StandardOpenOption.CREATE_NEW)
|| options.contains(StandardOpenOption.TRUNCATE_EXISTING)) {
return new CloudStorageWriteFileChannel(newWriteChannel(path, options));
} else {
return new CloudStorageReadFileChannel(newReadChannel(path, options));
}
} | java | @Override
public FileChannel newFileChannel(
Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
checkNotNull(path);
initStorage();
CloudStorageUtil.checkNotNullArray(attrs);
if (options.contains(StandardOpenOption.CREATE_NEW)) {
Files.createFile(path, attrs);
} else if (options.contains(StandardOpenOption.CREATE) && !Files.exists(path)) {
Files.createFile(path, attrs);
}
if (options.contains(StandardOpenOption.WRITE)
|| options.contains(StandardOpenOption.CREATE)
|| options.contains(StandardOpenOption.CREATE_NEW)
|| options.contains(StandardOpenOption.TRUNCATE_EXISTING)) {
return new CloudStorageWriteFileChannel(newWriteChannel(path, options));
} else {
return new CloudStorageReadFileChannel(newReadChannel(path, options));
}
} | [
"@",
"Override",
"public",
"FileChannel",
"newFileChannel",
"(",
"Path",
"path",
",",
"Set",
"<",
"?",
"extends",
"OpenOption",
">",
"options",
",",
"FileAttribute",
"<",
"?",
">",
"...",
"attrs",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"path",
")",
";",
"initStorage",
"(",
")",
";",
"CloudStorageUtil",
".",
"checkNotNullArray",
"(",
"attrs",
")",
";",
"if",
"(",
"options",
".",
"contains",
"(",
"StandardOpenOption",
".",
"CREATE_NEW",
")",
")",
"{",
"Files",
".",
"createFile",
"(",
"path",
",",
"attrs",
")",
";",
"}",
"else",
"if",
"(",
"options",
".",
"contains",
"(",
"StandardOpenOption",
".",
"CREATE",
")",
"&&",
"!",
"Files",
".",
"exists",
"(",
"path",
")",
")",
"{",
"Files",
".",
"createFile",
"(",
"path",
",",
"attrs",
")",
";",
"}",
"if",
"(",
"options",
".",
"contains",
"(",
"StandardOpenOption",
".",
"WRITE",
")",
"||",
"options",
".",
"contains",
"(",
"StandardOpenOption",
".",
"CREATE",
")",
"||",
"options",
".",
"contains",
"(",
"StandardOpenOption",
".",
"CREATE_NEW",
")",
"||",
"options",
".",
"contains",
"(",
"StandardOpenOption",
".",
"TRUNCATE_EXISTING",
")",
")",
"{",
"return",
"new",
"CloudStorageWriteFileChannel",
"(",
"newWriteChannel",
"(",
"path",
",",
"options",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"CloudStorageReadFileChannel",
"(",
"newReadChannel",
"(",
"path",
",",
"options",
")",
")",
";",
"}",
"}"
] | Open a file for reading OR writing. The {@link FileChannel} that is returned will only allow
reads or writes depending on the {@link OpenOption}s that are specified. If any of the
following have been specified, the {@link FileChannel} will be write-only: {@link
StandardOpenOption#CREATE}
<ul>
<li>{@link StandardOpenOption#CREATE}
<li>{@link StandardOpenOption#CREATE_NEW}
<li>{@link StandardOpenOption#WRITE}
<li>{@link StandardOpenOption#TRUNCATE_EXISTING}
</ul>
In all other cases the {@link FileChannel} will be read-only.
@param path The path to the file to open or create
@param options The options specifying how the file should be opened, and whether the {@link
FileChannel} should be read-only or write-only.
@param attrs (not supported, the values will be ignored)
@throws IOException | [
"Open",
"a",
"file",
"for",
"reading",
"OR",
"writing",
".",
"The",
"{",
"@link",
"FileChannel",
"}",
"that",
"is",
"returned",
"will",
"only",
"allow",
"reads",
"or",
"writes",
"depending",
"on",
"the",
"{",
"@link",
"OpenOption",
"}",
"s",
"that",
"are",
"specified",
".",
"If",
"any",
"of",
"the",
"following",
"have",
"been",
"specified",
"the",
"{",
"@link",
"FileChannel",
"}",
"will",
"be",
"write",
"-",
"only",
":",
"{",
"@link",
"StandardOpenOption#CREATE",
"}"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java#L330-L349 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.loadStringToFileListMultimap | public static ImmutableListMultimap<String, File> loadStringToFileListMultimap(
final CharSource source) throws IOException {
"""
Reads an {@link ImmutableListMultimap} from a {@link CharSource}, where each line is a
key, a tab character ("\t"), and a value. Blank lines and lines beginning with "#" are ignored.
"""
return loadMultimap(source, Functions.<String>identity(), FileFunction.INSTANCE,
IsCommentLine.INSTANCE);
} | java | public static ImmutableListMultimap<String, File> loadStringToFileListMultimap(
final CharSource source) throws IOException {
return loadMultimap(source, Functions.<String>identity(), FileFunction.INSTANCE,
IsCommentLine.INSTANCE);
} | [
"public",
"static",
"ImmutableListMultimap",
"<",
"String",
",",
"File",
">",
"loadStringToFileListMultimap",
"(",
"final",
"CharSource",
"source",
")",
"throws",
"IOException",
"{",
"return",
"loadMultimap",
"(",
"source",
",",
"Functions",
".",
"<",
"String",
">",
"identity",
"(",
")",
",",
"FileFunction",
".",
"INSTANCE",
",",
"IsCommentLine",
".",
"INSTANCE",
")",
";",
"}"
] | Reads an {@link ImmutableListMultimap} from a {@link CharSource}, where each line is a
key, a tab character ("\t"), and a value. Blank lines and lines beginning with "#" are ignored. | [
"Reads",
"an",
"{"
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L292-L296 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsRenderer.java | CmsRenderer.renderDescription | private void renderDescription(CmsTabInfo tabInfo, Panel descriptionParent) {
"""
Renders the tab description in a given panel.<p>
@param tabInfo the tab info object
@param descriptionParent the panel in which to render the tab description
"""
if (tabInfo.getDescription() != null) {
HTML descriptionLabel = new HTML();
descriptionLabel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().tabDescription());
if (!tabInfo.getDescription().startsWith("<div")) {
// add default styling in case of simple HTML
descriptionLabel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().tabDescriptionPanel());
}
descriptionLabel.setHTML(tabInfo.getDescription());
descriptionParent.add(descriptionLabel);
}
} | java | private void renderDescription(CmsTabInfo tabInfo, Panel descriptionParent) {
if (tabInfo.getDescription() != null) {
HTML descriptionLabel = new HTML();
descriptionLabel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().tabDescription());
if (!tabInfo.getDescription().startsWith("<div")) {
// add default styling in case of simple HTML
descriptionLabel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().tabDescriptionPanel());
}
descriptionLabel.setHTML(tabInfo.getDescription());
descriptionParent.add(descriptionLabel);
}
} | [
"private",
"void",
"renderDescription",
"(",
"CmsTabInfo",
"tabInfo",
",",
"Panel",
"descriptionParent",
")",
"{",
"if",
"(",
"tabInfo",
".",
"getDescription",
"(",
")",
"!=",
"null",
")",
"{",
"HTML",
"descriptionLabel",
"=",
"new",
"HTML",
"(",
")",
";",
"descriptionLabel",
".",
"addStyleName",
"(",
"I_CmsLayoutBundle",
".",
"INSTANCE",
".",
"form",
"(",
")",
".",
"tabDescription",
"(",
")",
")",
";",
"if",
"(",
"!",
"tabInfo",
".",
"getDescription",
"(",
")",
".",
"startsWith",
"(",
"\"<div\"",
")",
")",
"{",
"// add default styling in case of simple HTML\r",
"descriptionLabel",
".",
"addStyleName",
"(",
"I_CmsLayoutBundle",
".",
"INSTANCE",
".",
"form",
"(",
")",
".",
"tabDescriptionPanel",
"(",
")",
")",
";",
"}",
"descriptionLabel",
".",
"setHTML",
"(",
"tabInfo",
".",
"getDescription",
"(",
")",
")",
";",
"descriptionParent",
".",
"add",
"(",
"descriptionLabel",
")",
";",
"}",
"}"
] | Renders the tab description in a given panel.<p>
@param tabInfo the tab info object
@param descriptionParent the panel in which to render the tab description | [
"Renders",
"the",
"tab",
"description",
"in",
"a",
"given",
"panel",
".",
"<p",
">",
"@param",
"tabInfo",
"the",
"tab",
"info",
"object"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsRenderer.java#L899-L911 |
validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.pushCharArray | private void pushCharArray(String ename, char[] ch, int start, int length)
throws SAXException {
"""
Push a new internal input source.
<p>
This method is useful for expanding an internal entity, or for unreading
a string of characters. It creates a new readBuffer containing the
characters in the array, instead of characters converted from an input
byte stream.
@param ch
The char array to push.
@see #pushString
@see #pushURL
@see #readBuffer
@see #sourceType
@see #pushInput
"""
// Push the existing status
pushInput(ename);
if ((ename != null) && doReport) {
dataBufferFlush();
handler.startInternalEntity(ename);
}
sourceType = INPUT_INTERNAL;
readBuffer = ch;
readBufferPos = start;
readBufferLength = length;
readBufferOverflow = -1;
} | java | private void pushCharArray(String ename, char[] ch, int start, int length)
throws SAXException {
// Push the existing status
pushInput(ename);
if ((ename != null) && doReport) {
dataBufferFlush();
handler.startInternalEntity(ename);
}
sourceType = INPUT_INTERNAL;
readBuffer = ch;
readBufferPos = start;
readBufferLength = length;
readBufferOverflow = -1;
} | [
"private",
"void",
"pushCharArray",
"(",
"String",
"ename",
",",
"char",
"[",
"]",
"ch",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"SAXException",
"{",
"// Push the existing status",
"pushInput",
"(",
"ename",
")",
";",
"if",
"(",
"(",
"ename",
"!=",
"null",
")",
"&&",
"doReport",
")",
"{",
"dataBufferFlush",
"(",
")",
";",
"handler",
".",
"startInternalEntity",
"(",
"ename",
")",
";",
"}",
"sourceType",
"=",
"INPUT_INTERNAL",
";",
"readBuffer",
"=",
"ch",
";",
"readBufferPos",
"=",
"start",
";",
"readBufferLength",
"=",
"length",
";",
"readBufferOverflow",
"=",
"-",
"1",
";",
"}"
] | Push a new internal input source.
<p>
This method is useful for expanding an internal entity, or for unreading
a string of characters. It creates a new readBuffer containing the
characters in the array, instead of characters converted from an input
byte stream.
@param ch
The char array to push.
@see #pushString
@see #pushURL
@see #readBuffer
@see #sourceType
@see #pushInput | [
"Push",
"a",
"new",
"internal",
"input",
"source",
".",
"<p",
">",
"This",
"method",
"is",
"useful",
"for",
"expanding",
"an",
"internal",
"entity",
"or",
"for",
"unreading",
"a",
"string",
"of",
"characters",
".",
"It",
"creates",
"a",
"new",
"readBuffer",
"containing",
"the",
"characters",
"in",
"the",
"array",
"instead",
"of",
"characters",
"converted",
"from",
"an",
"input",
"byte",
"stream",
"."
] | train | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L4152-L4165 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java | ScriptRequestState.getTagIdMapping | private void getTagIdMapping(String tagId, String value, AbstractRenderAppender results) {
"""
This method will write out a tagId map entry for when there
isn't a ScriptContainer defined.
@param tagId the tagId value
@param value the "real" value of the written out
@param results the JavaScript that will be output
"""
if ((_javaScriptFeatures & CoreScriptFeature.ALLOCATE_LEGACY.value) == 0) {
_javaScriptFeatures |= CoreScriptFeature.ALLOCATE_LEGACY.value;
String s = getString("singleIdMappingTable", new Object[]{tagId, value});
String meths = writeNetuiNameFunctions(null, true, false, false);
if (meths != null)
s += meths;
writeScriptBlock(_req, results, s);
}
else {
String s = getString("idMappingEntry", new Object[]{tagId, value});
writeScriptBlock(_req, results, s);
}
} | java | private void getTagIdMapping(String tagId, String value, AbstractRenderAppender results)
{
if ((_javaScriptFeatures & CoreScriptFeature.ALLOCATE_LEGACY.value) == 0) {
_javaScriptFeatures |= CoreScriptFeature.ALLOCATE_LEGACY.value;
String s = getString("singleIdMappingTable", new Object[]{tagId, value});
String meths = writeNetuiNameFunctions(null, true, false, false);
if (meths != null)
s += meths;
writeScriptBlock(_req, results, s);
}
else {
String s = getString("idMappingEntry", new Object[]{tagId, value});
writeScriptBlock(_req, results, s);
}
} | [
"private",
"void",
"getTagIdMapping",
"(",
"String",
"tagId",
",",
"String",
"value",
",",
"AbstractRenderAppender",
"results",
")",
"{",
"if",
"(",
"(",
"_javaScriptFeatures",
"&",
"CoreScriptFeature",
".",
"ALLOCATE_LEGACY",
".",
"value",
")",
"==",
"0",
")",
"{",
"_javaScriptFeatures",
"|=",
"CoreScriptFeature",
".",
"ALLOCATE_LEGACY",
".",
"value",
";",
"String",
"s",
"=",
"getString",
"(",
"\"singleIdMappingTable\"",
",",
"new",
"Object",
"[",
"]",
"{",
"tagId",
",",
"value",
"}",
")",
";",
"String",
"meths",
"=",
"writeNetuiNameFunctions",
"(",
"null",
",",
"true",
",",
"false",
",",
"false",
")",
";",
"if",
"(",
"meths",
"!=",
"null",
")",
"s",
"+=",
"meths",
";",
"writeScriptBlock",
"(",
"_req",
",",
"results",
",",
"s",
")",
";",
"}",
"else",
"{",
"String",
"s",
"=",
"getString",
"(",
"\"idMappingEntry\"",
",",
"new",
"Object",
"[",
"]",
"{",
"tagId",
",",
"value",
"}",
")",
";",
"writeScriptBlock",
"(",
"_req",
",",
"results",
",",
"s",
")",
";",
"}",
"}"
] | This method will write out a tagId map entry for when there
isn't a ScriptContainer defined.
@param tagId the tagId value
@param value the "real" value of the written out
@param results the JavaScript that will be output | [
"This",
"method",
"will",
"write",
"out",
"a",
"tagId",
"map",
"entry",
"for",
"when",
"there",
"isn",
"t",
"a",
"ScriptContainer",
"defined",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java#L333-L347 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java | AttributeConstraintRule.validatePattern | private boolean validatePattern(Object validationObject, Annotation annotate) {
"""
Checks whether the given string is a valid pattern or not
@param validationObject
@param annotate
@return
"""
if (checkNullObject(validationObject))
{
return true;
}
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(((Pattern) annotate).regexp(),
((Pattern) annotate).flags().length);
Matcher matcherPattern = pattern.matcher((String) validationObject);
if (!matcherPattern.matches())
{
throwValidationException(((Pattern) annotate).message());
}
return true;
} | java | private boolean validatePattern(Object validationObject, Annotation annotate)
{
if (checkNullObject(validationObject))
{
return true;
}
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(((Pattern) annotate).regexp(),
((Pattern) annotate).flags().length);
Matcher matcherPattern = pattern.matcher((String) validationObject);
if (!matcherPattern.matches())
{
throwValidationException(((Pattern) annotate).message());
}
return true;
} | [
"private",
"boolean",
"validatePattern",
"(",
"Object",
"validationObject",
",",
"Annotation",
"annotate",
")",
"{",
"if",
"(",
"checkNullObject",
"(",
"validationObject",
")",
")",
"{",
"return",
"true",
";",
"}",
"java",
".",
"util",
".",
"regex",
".",
"Pattern",
"pattern",
"=",
"java",
".",
"util",
".",
"regex",
".",
"Pattern",
".",
"compile",
"(",
"(",
"(",
"Pattern",
")",
"annotate",
")",
".",
"regexp",
"(",
")",
",",
"(",
"(",
"Pattern",
")",
"annotate",
")",
".",
"flags",
"(",
")",
".",
"length",
")",
";",
"Matcher",
"matcherPattern",
"=",
"pattern",
".",
"matcher",
"(",
"(",
"String",
")",
"validationObject",
")",
";",
"if",
"(",
"!",
"matcherPattern",
".",
"matches",
"(",
")",
")",
"{",
"throwValidationException",
"(",
"(",
"(",
"Pattern",
")",
"annotate",
")",
".",
"message",
"(",
")",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Checks whether the given string is a valid pattern or not
@param validationObject
@param annotate
@return | [
"Checks",
"whether",
"the",
"given",
"string",
"is",
"a",
"valid",
"pattern",
"or",
"not"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java#L247-L264 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModulePreviewApiKeys.java | ModulePreviewApiKeys.fetchOne | public CMAPreviewApiKey fetchOne(String spaceId, String keyId) {
"""
Fetch only one preview api key.
<p>
This method will override the configuration specified through
{@link CMAClient.Builder#setSpaceId(String)} and will ignore
{@link CMAClient.Builder#setEnvironmentId(String)}.
@param spaceId the id of the space this is valid on.
@param keyId the id of the key itself.
@return one preview api key.
@throws IllegalArgumentException if spaceId is null.
@throws IllegalArgumentException if keyId is null.
"""
assertNotNull(spaceId, "entry");
assertNotNull(keyId, "keyId");
return service.fetchOne(spaceId, keyId).blockingFirst();
} | java | public CMAPreviewApiKey fetchOne(String spaceId, String keyId) {
assertNotNull(spaceId, "entry");
assertNotNull(keyId, "keyId");
return service.fetchOne(spaceId, keyId).blockingFirst();
} | [
"public",
"CMAPreviewApiKey",
"fetchOne",
"(",
"String",
"spaceId",
",",
"String",
"keyId",
")",
"{",
"assertNotNull",
"(",
"spaceId",
",",
"\"entry\"",
")",
";",
"assertNotNull",
"(",
"keyId",
",",
"\"keyId\"",
")",
";",
"return",
"service",
".",
"fetchOne",
"(",
"spaceId",
",",
"keyId",
")",
".",
"blockingFirst",
"(",
")",
";",
"}"
] | Fetch only one preview api key.
<p>
This method will override the configuration specified through
{@link CMAClient.Builder#setSpaceId(String)} and will ignore
{@link CMAClient.Builder#setEnvironmentId(String)}.
@param spaceId the id of the space this is valid on.
@param keyId the id of the key itself.
@return one preview api key.
@throws IllegalArgumentException if spaceId is null.
@throws IllegalArgumentException if keyId is null. | [
"Fetch",
"only",
"one",
"preview",
"api",
"key",
".",
"<p",
">",
"This",
"method",
"will",
"override",
"the",
"configuration",
"specified",
"through",
"{",
"@link",
"CMAClient",
".",
"Builder#setSpaceId",
"(",
"String",
")",
"}",
"and",
"will",
"ignore",
"{",
"@link",
"CMAClient",
".",
"Builder#setEnvironmentId",
"(",
"String",
")",
"}",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModulePreviewApiKeys.java#L119-L124 |
roboconf/roboconf-platform | core/roboconf-dm-rest-services/src/main/java/net/roboconf/dm/rest/services/internal/resources/impl/DebugResource.java | DebugResource.createDiagnostic | Diagnostic createDiagnostic( Instance instance ) {
"""
Creates a diagnostic for an instance.
@param instance a non-null instance
@return a non-null diagnostic
"""
Diagnostic result = new Diagnostic( InstanceHelpers.computeInstancePath( instance ));
for( Map.Entry<String,Boolean> entry : ComponentHelpers.findComponentDependenciesFor( instance.getComponent()).entrySet()) {
String facetOrComponentName = entry.getKey();
Collection<Import> imports = instance.getImports().get( facetOrComponentName );
boolean resolved = imports != null && ! imports.isEmpty();
boolean optional = entry.getValue();
result.getDependenciesInformation().add( new DependencyInformation( facetOrComponentName, optional, resolved ));
}
return result;
} | java | Diagnostic createDiagnostic( Instance instance ) {
Diagnostic result = new Diagnostic( InstanceHelpers.computeInstancePath( instance ));
for( Map.Entry<String,Boolean> entry : ComponentHelpers.findComponentDependenciesFor( instance.getComponent()).entrySet()) {
String facetOrComponentName = entry.getKey();
Collection<Import> imports = instance.getImports().get( facetOrComponentName );
boolean resolved = imports != null && ! imports.isEmpty();
boolean optional = entry.getValue();
result.getDependenciesInformation().add( new DependencyInformation( facetOrComponentName, optional, resolved ));
}
return result;
} | [
"Diagnostic",
"createDiagnostic",
"(",
"Instance",
"instance",
")",
"{",
"Diagnostic",
"result",
"=",
"new",
"Diagnostic",
"(",
"InstanceHelpers",
".",
"computeInstancePath",
"(",
"instance",
")",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Boolean",
">",
"entry",
":",
"ComponentHelpers",
".",
"findComponentDependenciesFor",
"(",
"instance",
".",
"getComponent",
"(",
")",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"facetOrComponentName",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"Collection",
"<",
"Import",
">",
"imports",
"=",
"instance",
".",
"getImports",
"(",
")",
".",
"get",
"(",
"facetOrComponentName",
")",
";",
"boolean",
"resolved",
"=",
"imports",
"!=",
"null",
"&&",
"!",
"imports",
".",
"isEmpty",
"(",
")",
";",
"boolean",
"optional",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"result",
".",
"getDependenciesInformation",
"(",
")",
".",
"add",
"(",
"new",
"DependencyInformation",
"(",
"facetOrComponentName",
",",
"optional",
",",
"resolved",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Creates a diagnostic for an instance.
@param instance a non-null instance
@return a non-null diagnostic | [
"Creates",
"a",
"diagnostic",
"for",
"an",
"instance",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-rest-services/src/main/java/net/roboconf/dm/rest/services/internal/resources/impl/DebugResource.java#L184-L198 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/connectionmanager/ConnectionManagerFactory.java | ConnectionManagerFactory.createConnectionManager | public static ConnectionManager createConnectionManager(TransactionSupportEnum tse,
ManagedConnectionFactory mcf,
CachedConnectionManager ccm,
ConnectionManagerConfiguration cmc,
TransactionIntegration ti) {
"""
Create a connection manager
@param tse The transaction support level
@param mcf The managed connection factory
@param ccm The cached connection manager
@param cmc The connection manager configuration
@param ti The transaction integration
@return The connection manager
"""
if (tse == TransactionSupportEnum.NoTransaction)
{
return new NoTransactionConnectionManager(mcf, ccm, cmc);
}
else if (tse == TransactionSupportEnum.LocalTransaction)
{
return new LocalTransactionConnectionManager(mcf, ccm, cmc, ti);
}
else
{
return new XATransactionConnectionManager(mcf, ccm, cmc, ti);
}
} | java | public static ConnectionManager createConnectionManager(TransactionSupportEnum tse,
ManagedConnectionFactory mcf,
CachedConnectionManager ccm,
ConnectionManagerConfiguration cmc,
TransactionIntegration ti)
{
if (tse == TransactionSupportEnum.NoTransaction)
{
return new NoTransactionConnectionManager(mcf, ccm, cmc);
}
else if (tse == TransactionSupportEnum.LocalTransaction)
{
return new LocalTransactionConnectionManager(mcf, ccm, cmc, ti);
}
else
{
return new XATransactionConnectionManager(mcf, ccm, cmc, ti);
}
} | [
"public",
"static",
"ConnectionManager",
"createConnectionManager",
"(",
"TransactionSupportEnum",
"tse",
",",
"ManagedConnectionFactory",
"mcf",
",",
"CachedConnectionManager",
"ccm",
",",
"ConnectionManagerConfiguration",
"cmc",
",",
"TransactionIntegration",
"ti",
")",
"{",
"if",
"(",
"tse",
"==",
"TransactionSupportEnum",
".",
"NoTransaction",
")",
"{",
"return",
"new",
"NoTransactionConnectionManager",
"(",
"mcf",
",",
"ccm",
",",
"cmc",
")",
";",
"}",
"else",
"if",
"(",
"tse",
"==",
"TransactionSupportEnum",
".",
"LocalTransaction",
")",
"{",
"return",
"new",
"LocalTransactionConnectionManager",
"(",
"mcf",
",",
"ccm",
",",
"cmc",
",",
"ti",
")",
";",
"}",
"else",
"{",
"return",
"new",
"XATransactionConnectionManager",
"(",
"mcf",
",",
"ccm",
",",
"cmc",
",",
"ti",
")",
";",
"}",
"}"
] | Create a connection manager
@param tse The transaction support level
@param mcf The managed connection factory
@param ccm The cached connection manager
@param cmc The connection manager configuration
@param ti The transaction integration
@return The connection manager | [
"Create",
"a",
"connection",
"manager"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/ConnectionManagerFactory.java#L53-L71 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hllmap/CouponTraverseMap.java | CouponTraverseMap.findKey | @Override
int findKey(final byte[] key) {
"""
Returns entryIndex if the given key is found. If not found, returns one's complement entryIndex
of an empty slot for insertion, which may be over a deleted key.
@param key the given key
@return the entryIndex
"""
final long[] hash = MurmurHash3.hash(key, SEED);
int entryIndex = getIndex(hash[0], tableEntries_);
int firstDeletedIndex = -1;
final int loopIndex = entryIndex;
do {
if (isBitClear(stateArr_, entryIndex)) {
return firstDeletedIndex == -1 ? ~entryIndex : ~firstDeletedIndex; // found empty or deleted
}
if (couponsArr_[entryIndex * maxCouponsPerKey_] == 0) { //found deleted
if (firstDeletedIndex == -1) { firstDeletedIndex = entryIndex; }
} else if (Map.arraysEqual(keysArr_, entryIndex * keySizeBytes_, key, 0, keySizeBytes_)) {
return entryIndex; // found key
}
entryIndex = (entryIndex + getStride(hash[1], tableEntries_)) % tableEntries_;
} while (entryIndex != loopIndex);
throw new SketchesArgumentException("Key not found and no empty slots!");
} | java | @Override
int findKey(final byte[] key) {
final long[] hash = MurmurHash3.hash(key, SEED);
int entryIndex = getIndex(hash[0], tableEntries_);
int firstDeletedIndex = -1;
final int loopIndex = entryIndex;
do {
if (isBitClear(stateArr_, entryIndex)) {
return firstDeletedIndex == -1 ? ~entryIndex : ~firstDeletedIndex; // found empty or deleted
}
if (couponsArr_[entryIndex * maxCouponsPerKey_] == 0) { //found deleted
if (firstDeletedIndex == -1) { firstDeletedIndex = entryIndex; }
} else if (Map.arraysEqual(keysArr_, entryIndex * keySizeBytes_, key, 0, keySizeBytes_)) {
return entryIndex; // found key
}
entryIndex = (entryIndex + getStride(hash[1], tableEntries_)) % tableEntries_;
} while (entryIndex != loopIndex);
throw new SketchesArgumentException("Key not found and no empty slots!");
} | [
"@",
"Override",
"int",
"findKey",
"(",
"final",
"byte",
"[",
"]",
"key",
")",
"{",
"final",
"long",
"[",
"]",
"hash",
"=",
"MurmurHash3",
".",
"hash",
"(",
"key",
",",
"SEED",
")",
";",
"int",
"entryIndex",
"=",
"getIndex",
"(",
"hash",
"[",
"0",
"]",
",",
"tableEntries_",
")",
";",
"int",
"firstDeletedIndex",
"=",
"-",
"1",
";",
"final",
"int",
"loopIndex",
"=",
"entryIndex",
";",
"do",
"{",
"if",
"(",
"isBitClear",
"(",
"stateArr_",
",",
"entryIndex",
")",
")",
"{",
"return",
"firstDeletedIndex",
"==",
"-",
"1",
"?",
"~",
"entryIndex",
":",
"~",
"firstDeletedIndex",
";",
"// found empty or deleted",
"}",
"if",
"(",
"couponsArr_",
"[",
"entryIndex",
"*",
"maxCouponsPerKey_",
"]",
"==",
"0",
")",
"{",
"//found deleted",
"if",
"(",
"firstDeletedIndex",
"==",
"-",
"1",
")",
"{",
"firstDeletedIndex",
"=",
"entryIndex",
";",
"}",
"}",
"else",
"if",
"(",
"Map",
".",
"arraysEqual",
"(",
"keysArr_",
",",
"entryIndex",
"*",
"keySizeBytes_",
",",
"key",
",",
"0",
",",
"keySizeBytes_",
")",
")",
"{",
"return",
"entryIndex",
";",
"// found key",
"}",
"entryIndex",
"=",
"(",
"entryIndex",
"+",
"getStride",
"(",
"hash",
"[",
"1",
"]",
",",
"tableEntries_",
")",
")",
"%",
"tableEntries_",
";",
"}",
"while",
"(",
"entryIndex",
"!=",
"loopIndex",
")",
";",
"throw",
"new",
"SketchesArgumentException",
"(",
"\"Key not found and no empty slots!\"",
")",
";",
"}"
] | Returns entryIndex if the given key is found. If not found, returns one's complement entryIndex
of an empty slot for insertion, which may be over a deleted key.
@param key the given key
@return the entryIndex | [
"Returns",
"entryIndex",
"if",
"the",
"given",
"key",
"is",
"found",
".",
"If",
"not",
"found",
"returns",
"one",
"s",
"complement",
"entryIndex",
"of",
"an",
"empty",
"slot",
"for",
"insertion",
"which",
"may",
"be",
"over",
"a",
"deleted",
"key",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/CouponTraverseMap.java#L113-L131 |
dropwizard/dropwizard | dropwizard-jersey/src/main/java/io/dropwizard/jersey/filter/RequestIdFilter.java | RequestIdFilter.generateRandomUuid | private static UUID generateRandomUuid() {
"""
Generate a random UUID v4 that will perform reasonably when used by
multiple threads under load.
@see <a href="https://github.com/Netflix/netflix-commons/blob/v0.3.0/netflix-commons-util/src/main/java/com/netflix/util/concurrent/ConcurrentUUIDFactory.java">ConcurrentUUIDFactory</a>
@return random UUID
"""
final Random rnd = ThreadLocalRandom.current();
long mostSig = rnd.nextLong();
long leastSig = rnd.nextLong();
// Identify this as a version 4 UUID, that is one based on a random value.
mostSig &= 0xffffffffffff0fffL;
mostSig |= 0x0000000000004000L;
// Set the variant identifier as specified for version 4 UUID values. The two
// high order bits of the lower word are required to be one and zero, respectively.
leastSig &= 0x3fffffffffffffffL;
leastSig |= 0x8000000000000000L;
return new UUID(mostSig, leastSig);
} | java | private static UUID generateRandomUuid() {
final Random rnd = ThreadLocalRandom.current();
long mostSig = rnd.nextLong();
long leastSig = rnd.nextLong();
// Identify this as a version 4 UUID, that is one based on a random value.
mostSig &= 0xffffffffffff0fffL;
mostSig |= 0x0000000000004000L;
// Set the variant identifier as specified for version 4 UUID values. The two
// high order bits of the lower word are required to be one and zero, respectively.
leastSig &= 0x3fffffffffffffffL;
leastSig |= 0x8000000000000000L;
return new UUID(mostSig, leastSig);
} | [
"private",
"static",
"UUID",
"generateRandomUuid",
"(",
")",
"{",
"final",
"Random",
"rnd",
"=",
"ThreadLocalRandom",
".",
"current",
"(",
")",
";",
"long",
"mostSig",
"=",
"rnd",
".",
"nextLong",
"(",
")",
";",
"long",
"leastSig",
"=",
"rnd",
".",
"nextLong",
"(",
")",
";",
"// Identify this as a version 4 UUID, that is one based on a random value.",
"mostSig",
"&=",
"0xffffffffffff0fff",
"",
"L",
";",
"mostSig",
"|=",
"0x0000000000004000",
"",
"L",
";",
"// Set the variant identifier as specified for version 4 UUID values. The two",
"// high order bits of the lower word are required to be one and zero, respectively.",
"leastSig",
"&=",
"0x3fffffffffffffff",
"",
"L",
";",
"leastSig",
"|=",
"0x8000000000000000",
"",
"L",
";",
"return",
"new",
"UUID",
"(",
"mostSig",
",",
"leastSig",
")",
";",
"}"
] | Generate a random UUID v4 that will perform reasonably when used by
multiple threads under load.
@see <a href="https://github.com/Netflix/netflix-commons/blob/v0.3.0/netflix-commons-util/src/main/java/com/netflix/util/concurrent/ConcurrentUUIDFactory.java">ConcurrentUUIDFactory</a>
@return random UUID | [
"Generate",
"a",
"random",
"UUID",
"v4",
"that",
"will",
"perform",
"reasonably",
"when",
"used",
"by",
"multiple",
"threads",
"under",
"load",
"."
] | train | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jersey/src/main/java/io/dropwizard/jersey/filter/RequestIdFilter.java#L59-L74 |
keenlabs/KeenClient-Java | core/src/main/java/io/keen/client/java/KeenClient.java | KeenClient.addEventAsync | public void addEventAsync(String eventCollection, Map<String, Object> event) {
"""
Adds an event to the default project with default Keen properties and no callbacks.
@see #addEvent(KeenProject, String, java.util.Map, java.util.Map, KeenCallback)
@param eventCollection The name of the collection in which to publish the event.
@param event A Map that consists of key/value pairs. Keen naming conventions apply (see
docs). Nested Maps and lists are acceptable (and encouraged!).
"""
addEventAsync(eventCollection, event, null);
} | java | public void addEventAsync(String eventCollection, Map<String, Object> event) {
addEventAsync(eventCollection, event, null);
} | [
"public",
"void",
"addEventAsync",
"(",
"String",
"eventCollection",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"event",
")",
"{",
"addEventAsync",
"(",
"eventCollection",
",",
"event",
",",
"null",
")",
";",
"}"
] | Adds an event to the default project with default Keen properties and no callbacks.
@see #addEvent(KeenProject, String, java.util.Map, java.util.Map, KeenCallback)
@param eventCollection The name of the collection in which to publish the event.
@param event A Map that consists of key/value pairs. Keen naming conventions apply (see
docs). Nested Maps and lists are acceptable (and encouraged!). | [
"Adds",
"an",
"event",
"to",
"the",
"default",
"project",
"with",
"default",
"Keen",
"properties",
"and",
"no",
"callbacks",
"."
] | train | https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/KeenClient.java#L186-L188 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/model/LineSegment.java | LineSegment.pointAlongLineSegment | public Point pointAlongLineSegment(double distance) {
"""
Computes a Point along the line segment with a given distance to the start Point.
@param distance distance from start point
@return point at given distance from start point
"""
if (start.x == end.x) {
// we have a vertical line
if (start.y > end.y) {
return new Point(end.x, end.y + distance);
} else {
return new Point(start.x, start.y + distance);
}
} else {
double slope = (end.y - start.y) / (end.x - start.x);
double dx = Math.sqrt((distance * distance) / (1 + (slope * slope)));
if (end.x < start.x) {
dx *= -1;
}
return new Point(start.x + dx, start.y + slope * dx);
}
} | java | public Point pointAlongLineSegment(double distance) {
if (start.x == end.x) {
// we have a vertical line
if (start.y > end.y) {
return new Point(end.x, end.y + distance);
} else {
return new Point(start.x, start.y + distance);
}
} else {
double slope = (end.y - start.y) / (end.x - start.x);
double dx = Math.sqrt((distance * distance) / (1 + (slope * slope)));
if (end.x < start.x) {
dx *= -1;
}
return new Point(start.x + dx, start.y + slope * dx);
}
} | [
"public",
"Point",
"pointAlongLineSegment",
"(",
"double",
"distance",
")",
"{",
"if",
"(",
"start",
".",
"x",
"==",
"end",
".",
"x",
")",
"{",
"// we have a vertical line",
"if",
"(",
"start",
".",
"y",
">",
"end",
".",
"y",
")",
"{",
"return",
"new",
"Point",
"(",
"end",
".",
"x",
",",
"end",
".",
"y",
"+",
"distance",
")",
";",
"}",
"else",
"{",
"return",
"new",
"Point",
"(",
"start",
".",
"x",
",",
"start",
".",
"y",
"+",
"distance",
")",
";",
"}",
"}",
"else",
"{",
"double",
"slope",
"=",
"(",
"end",
".",
"y",
"-",
"start",
".",
"y",
")",
"/",
"(",
"end",
".",
"x",
"-",
"start",
".",
"x",
")",
";",
"double",
"dx",
"=",
"Math",
".",
"sqrt",
"(",
"(",
"distance",
"*",
"distance",
")",
"/",
"(",
"1",
"+",
"(",
"slope",
"*",
"slope",
")",
")",
")",
";",
"if",
"(",
"end",
".",
"x",
"<",
"start",
".",
"x",
")",
"{",
"dx",
"*=",
"-",
"1",
";",
"}",
"return",
"new",
"Point",
"(",
"start",
".",
"x",
"+",
"dx",
",",
"start",
".",
"y",
"+",
"slope",
"*",
"dx",
")",
";",
"}",
"}"
] | Computes a Point along the line segment with a given distance to the start Point.
@param distance distance from start point
@return point at given distance from start point | [
"Computes",
"a",
"Point",
"along",
"the",
"line",
"segment",
"with",
"a",
"given",
"distance",
"to",
"the",
"start",
"Point",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/LineSegment.java#L197-L213 |
aws/aws-sdk-java | aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java | EntityFilter.setTags | public void setTags(java.util.Collection<java.util.Map<String, String>> tags) {
"""
<p>
A map of entity tags attached to the affected entity.
</p>
@param tags
A map of entity tags attached to the affected entity.
"""
if (tags == null) {
this.tags = null;
return;
}
this.tags = new java.util.ArrayList<java.util.Map<String, String>>(tags);
} | java | public void setTags(java.util.Collection<java.util.Map<String, String>> tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new java.util.ArrayList<java.util.Map<String, String>>(tags);
} | [
"public",
"void",
"setTags",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
">",
"tags",
")",
"{",
"if",
"(",
"tags",
"==",
"null",
")",
"{",
"this",
".",
"tags",
"=",
"null",
";",
"return",
";",
"}",
"this",
".",
"tags",
"=",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
">",
"(",
"tags",
")",
";",
"}"
] | <p>
A map of entity tags attached to the affected entity.
</p>
@param tags
A map of entity tags attached to the affected entity. | [
"<p",
">",
"A",
"map",
"of",
"entity",
"tags",
"attached",
"to",
"the",
"affected",
"entity",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java#L378-L385 |
twilio/twilio-java | src/main/java/com/twilio/rest/messaging/v1/service/ShortCodeReader.java | ShortCodeReader.previousPage | @Override
public Page<ShortCode> previousPage(final Page<ShortCode> page,
final TwilioRestClient client) {
"""
Retrieve the previous page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Previous Page
"""
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.MESSAGING.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | java | @Override
public Page<ShortCode> previousPage(final Page<ShortCode> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.MESSAGING.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | [
"@",
"Override",
"public",
"Page",
"<",
"ShortCode",
">",
"previousPage",
"(",
"final",
"Page",
"<",
"ShortCode",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
",",
"page",
".",
"getPreviousPageUrl",
"(",
"Domains",
".",
"MESSAGING",
".",
"toString",
"(",
")",
",",
"client",
".",
"getRegion",
"(",
")",
")",
")",
";",
"return",
"pageForRequest",
"(",
"client",
",",
"request",
")",
";",
"}"
] | Retrieve the previous page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Previous Page | [
"Retrieve",
"the",
"previous",
"page",
"from",
"the",
"Twilio",
"API",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/messaging/v1/service/ShortCodeReader.java#L114-L125 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/LoadBalancerNetworkInterfacesInner.java | LoadBalancerNetworkInterfacesInner.listAsync | public Observable<Page<NetworkInterfaceInner>> listAsync(final String resourceGroupName, final String loadBalancerName) {
"""
Gets associated load balancer network interfaces.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<NetworkInterfaceInner> object
"""
return listWithServiceResponseAsync(resourceGroupName, loadBalancerName)
.map(new Func1<ServiceResponse<Page<NetworkInterfaceInner>>, Page<NetworkInterfaceInner>>() {
@Override
public Page<NetworkInterfaceInner> call(ServiceResponse<Page<NetworkInterfaceInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<NetworkInterfaceInner>> listAsync(final String resourceGroupName, final String loadBalancerName) {
return listWithServiceResponseAsync(resourceGroupName, loadBalancerName)
.map(new Func1<ServiceResponse<Page<NetworkInterfaceInner>>, Page<NetworkInterfaceInner>>() {
@Override
public Page<NetworkInterfaceInner> call(ServiceResponse<Page<NetworkInterfaceInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"NetworkInterfaceInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"loadBalancerName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"loadBalancerName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"NetworkInterfaceInner",
">",
">",
",",
"Page",
"<",
"NetworkInterfaceInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"NetworkInterfaceInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"NetworkInterfaceInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets associated load balancer network interfaces.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<NetworkInterfaceInner> object | [
"Gets",
"associated",
"load",
"balancer",
"network",
"interfaces",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/LoadBalancerNetworkInterfacesInner.java#L118-L126 |
mongodb/stitch-android-sdk | core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java | DataSynchronizer.desyncDocumentsFromRemote | @CheckReturnValue
LocalSyncWriteModelContainer desyncDocumentsFromRemote(
final NamespaceSynchronizationConfig nsConfig,
final BsonValue... documentIds) {
"""
Requests that a document be no longer be synchronized by the given _id. Any uncommitted writes
will be lost.
@param nsConfig the namespace synchronization config of the namespace where the document
lives.
@param documentIds the _ids of the documents.
"""
this.waitUntilInitialized();
final MongoNamespace namespace = nsConfig.getNamespace();
final Lock lock = this.syncConfig.getNamespaceConfig(namespace).getLock().writeLock();
lock.lock();
final DeleteManyModel<CoreDocumentSynchronizationConfig> configsToDelete;
try {
ongoingOperationsGroup.enter();
configsToDelete = syncConfig.removeSynchronizedDocuments(namespace, documentIds);
} finally {
lock.unlock();
ongoingOperationsGroup.exit();
}
LocalSyncWriteModelContainer container = null;
if (configsToDelete != null) {
container = newWriteModelContainer(nsConfig);
container.addDocIDs(documentIds);
container.addLocalWrite(new DeleteManyModel<>(
new BsonDocument("_id",
new BsonDocument("$in", new BsonArray(Arrays.asList(documentIds))))
));
container.addConfigWrite(configsToDelete);
}
return container;
} | java | @CheckReturnValue
LocalSyncWriteModelContainer desyncDocumentsFromRemote(
final NamespaceSynchronizationConfig nsConfig,
final BsonValue... documentIds) {
this.waitUntilInitialized();
final MongoNamespace namespace = nsConfig.getNamespace();
final Lock lock = this.syncConfig.getNamespaceConfig(namespace).getLock().writeLock();
lock.lock();
final DeleteManyModel<CoreDocumentSynchronizationConfig> configsToDelete;
try {
ongoingOperationsGroup.enter();
configsToDelete = syncConfig.removeSynchronizedDocuments(namespace, documentIds);
} finally {
lock.unlock();
ongoingOperationsGroup.exit();
}
LocalSyncWriteModelContainer container = null;
if (configsToDelete != null) {
container = newWriteModelContainer(nsConfig);
container.addDocIDs(documentIds);
container.addLocalWrite(new DeleteManyModel<>(
new BsonDocument("_id",
new BsonDocument("$in", new BsonArray(Arrays.asList(documentIds))))
));
container.addConfigWrite(configsToDelete);
}
return container;
} | [
"@",
"CheckReturnValue",
"LocalSyncWriteModelContainer",
"desyncDocumentsFromRemote",
"(",
"final",
"NamespaceSynchronizationConfig",
"nsConfig",
",",
"final",
"BsonValue",
"...",
"documentIds",
")",
"{",
"this",
".",
"waitUntilInitialized",
"(",
")",
";",
"final",
"MongoNamespace",
"namespace",
"=",
"nsConfig",
".",
"getNamespace",
"(",
")",
";",
"final",
"Lock",
"lock",
"=",
"this",
".",
"syncConfig",
".",
"getNamespaceConfig",
"(",
"namespace",
")",
".",
"getLock",
"(",
")",
".",
"writeLock",
"(",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"final",
"DeleteManyModel",
"<",
"CoreDocumentSynchronizationConfig",
">",
"configsToDelete",
";",
"try",
"{",
"ongoingOperationsGroup",
".",
"enter",
"(",
")",
";",
"configsToDelete",
"=",
"syncConfig",
".",
"removeSynchronizedDocuments",
"(",
"namespace",
",",
"documentIds",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"ongoingOperationsGroup",
".",
"exit",
"(",
")",
";",
"}",
"LocalSyncWriteModelContainer",
"container",
"=",
"null",
";",
"if",
"(",
"configsToDelete",
"!=",
"null",
")",
"{",
"container",
"=",
"newWriteModelContainer",
"(",
"nsConfig",
")",
";",
"container",
".",
"addDocIDs",
"(",
"documentIds",
")",
";",
"container",
".",
"addLocalWrite",
"(",
"new",
"DeleteManyModel",
"<>",
"(",
"new",
"BsonDocument",
"(",
"\"_id\"",
",",
"new",
"BsonDocument",
"(",
"\"$in\"",
",",
"new",
"BsonArray",
"(",
"Arrays",
".",
"asList",
"(",
"documentIds",
")",
")",
")",
")",
")",
")",
";",
"container",
".",
"addConfigWrite",
"(",
"configsToDelete",
")",
";",
"}",
"return",
"container",
";",
"}"
] | Requests that a document be no longer be synchronized by the given _id. Any uncommitted writes
will be lost.
@param nsConfig the namespace synchronization config of the namespace where the document
lives.
@param documentIds the _ids of the documents. | [
"Requests",
"that",
"a",
"document",
"be",
"no",
"longer",
"be",
"synchronized",
"by",
"the",
"given",
"_id",
".",
"Any",
"uncommitted",
"writes",
"will",
"be",
"lost",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java#L2040-L2069 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/DataDecoder.java | DataDecoder.decodeSingleNullable | public static byte[] decodeSingleNullable(byte[] src, int prefixPadding, int suffixPadding)
throws CorruptEncodingException {
"""
Decodes the given byte array which was encoded by {@link
DataEncoder#encodeSingleNullable}. Always returns a new byte array
instance.
@param prefixPadding amount of extra bytes to skip from start of encoded byte array
@param suffixPadding amount of extra bytes to skip at end of encoded byte array
"""
try {
byte b = src[prefixPadding];
if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
return null;
}
int length = src.length - suffixPadding - 1 - prefixPadding;
if (length == 0) {
return EMPTY_BYTE_ARRAY;
}
byte[] value = new byte[length];
System.arraycopy(src, 1 + prefixPadding, value, 0, length);
return value;
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | java | public static byte[] decodeSingleNullable(byte[] src, int prefixPadding, int suffixPadding)
throws CorruptEncodingException
{
try {
byte b = src[prefixPadding];
if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
return null;
}
int length = src.length - suffixPadding - 1 - prefixPadding;
if (length == 0) {
return EMPTY_BYTE_ARRAY;
}
byte[] value = new byte[length];
System.arraycopy(src, 1 + prefixPadding, value, 0, length);
return value;
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"decodeSingleNullable",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"prefixPadding",
",",
"int",
"suffixPadding",
")",
"throws",
"CorruptEncodingException",
"{",
"try",
"{",
"byte",
"b",
"=",
"src",
"[",
"prefixPadding",
"]",
";",
"if",
"(",
"b",
"==",
"NULL_BYTE_HIGH",
"||",
"b",
"==",
"NULL_BYTE_LOW",
")",
"{",
"return",
"null",
";",
"}",
"int",
"length",
"=",
"src",
".",
"length",
"-",
"suffixPadding",
"-",
"1",
"-",
"prefixPadding",
";",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY_BYTE_ARRAY",
";",
"}",
"byte",
"[",
"]",
"value",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"src",
",",
"1",
"+",
"prefixPadding",
",",
"value",
",",
"0",
",",
"length",
")",
";",
"return",
"value",
";",
"}",
"catch",
"(",
"IndexOutOfBoundsException",
"e",
")",
"{",
"throw",
"new",
"CorruptEncodingException",
"(",
"null",
",",
"e",
")",
";",
"}",
"}"
] | Decodes the given byte array which was encoded by {@link
DataEncoder#encodeSingleNullable}. Always returns a new byte array
instance.
@param prefixPadding amount of extra bytes to skip from start of encoded byte array
@param suffixPadding amount of extra bytes to skip at end of encoded byte array | [
"Decodes",
"the",
"given",
"byte",
"array",
"which",
"was",
"encoded",
"by",
"{",
"@link",
"DataEncoder#encodeSingleNullable",
"}",
".",
"Always",
"returns",
"a",
"new",
"byte",
"array",
"instance",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L703-L721 |
jblas-project/jblas | src/main/java/org/jblas/util/SanityChecks.java | SanityChecks.checkEigenvalues | public static void checkEigenvalues() {
"""
Compute eigenvalues. This is a routine not in ATLAS, but in the original
LAPACK.
"""
DoubleMatrix A = new DoubleMatrix(new double[][]{
{3.0, 2.0, 0.0},
{2.0, 3.0, 2.0},
{0.0, 2.0, 3.0}
});
DoubleMatrix E = new DoubleMatrix(3, 1);
NativeBlas.dsyev('N', 'U', 3, A.data, 0, 3, E.data, 0);
check("checking existence of dsyev...", true);
} | java | public static void checkEigenvalues() {
DoubleMatrix A = new DoubleMatrix(new double[][]{
{3.0, 2.0, 0.0},
{2.0, 3.0, 2.0},
{0.0, 2.0, 3.0}
});
DoubleMatrix E = new DoubleMatrix(3, 1);
NativeBlas.dsyev('N', 'U', 3, A.data, 0, 3, E.data, 0);
check("checking existence of dsyev...", true);
} | [
"public",
"static",
"void",
"checkEigenvalues",
"(",
")",
"{",
"DoubleMatrix",
"A",
"=",
"new",
"DoubleMatrix",
"(",
"new",
"double",
"[",
"]",
"[",
"]",
"{",
"{",
"3.0",
",",
"2.0",
",",
"0.0",
"}",
",",
"{",
"2.0",
",",
"3.0",
",",
"2.0",
"}",
",",
"{",
"0.0",
",",
"2.0",
",",
"3.0",
"}",
"}",
")",
";",
"DoubleMatrix",
"E",
"=",
"new",
"DoubleMatrix",
"(",
"3",
",",
"1",
")",
";",
"NativeBlas",
".",
"dsyev",
"(",
"'",
"'",
",",
"'",
"'",
",",
"3",
",",
"A",
".",
"data",
",",
"0",
",",
"3",
",",
"E",
".",
"data",
",",
"0",
")",
";",
"check",
"(",
"\"checking existence of dsyev...\"",
",",
"true",
")",
";",
"}"
] | Compute eigenvalues. This is a routine not in ATLAS, but in the original
LAPACK. | [
"Compute",
"eigenvalues",
".",
"This",
"is",
"a",
"routine",
"not",
"in",
"ATLAS",
"but",
"in",
"the",
"original",
"LAPACK",
"."
] | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/SanityChecks.java#L115-L126 |
VoltDB/voltdb | src/frontend/org/voltcore/agreement/AgreementSeeker.java | AgreementSeeker.amongDeadHsids | public static Predicate<Map.Entry<Long, Boolean>> amongDeadHsids(final Set<Long> hsids) {
"""
returns a map entry predicate that tests whether or not the given
map entry describes a dead site
@param hsids pre-failure mesh hsids
@return
"""
return new Predicate<Map.Entry<Long,Boolean>>() {
@Override
public boolean apply(Entry<Long, Boolean> e) {
return hsids.contains(e.getKey()) && e.getValue();
}
};
} | java | public static Predicate<Map.Entry<Long, Boolean>> amongDeadHsids(final Set<Long> hsids) {
return new Predicate<Map.Entry<Long,Boolean>>() {
@Override
public boolean apply(Entry<Long, Boolean> e) {
return hsids.contains(e.getKey()) && e.getValue();
}
};
} | [
"public",
"static",
"Predicate",
"<",
"Map",
".",
"Entry",
"<",
"Long",
",",
"Boolean",
">",
">",
"amongDeadHsids",
"(",
"final",
"Set",
"<",
"Long",
">",
"hsids",
")",
"{",
"return",
"new",
"Predicate",
"<",
"Map",
".",
"Entry",
"<",
"Long",
",",
"Boolean",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"Entry",
"<",
"Long",
",",
"Boolean",
">",
"e",
")",
"{",
"return",
"hsids",
".",
"contains",
"(",
"e",
".",
"getKey",
"(",
")",
")",
"&&",
"e",
".",
"getValue",
"(",
")",
";",
"}",
"}",
";",
"}"
] | returns a map entry predicate that tests whether or not the given
map entry describes a dead site
@param hsids pre-failure mesh hsids
@return | [
"returns",
"a",
"map",
"entry",
"predicate",
"that",
"tests",
"whether",
"or",
"not",
"the",
"given",
"map",
"entry",
"describes",
"a",
"dead",
"site"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L153-L160 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusHub | @Pure
public BusHub getBusHub(String name, Comparator<String> nameComparator) {
"""
Replies the bus hub with the specified name.
@param name is the desired name
@param nameComparator is used to compare the names.
@return a bus hub or <code>null</code>
"""
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusHub busHub : this.validBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
for (final BusHub busHub : this.invalidBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
return null;
} | java | @Pure
public BusHub getBusHub(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusHub busHub : this.validBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
for (final BusHub busHub : this.invalidBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
return null;
} | [
"@",
"Pure",
"public",
"BusHub",
"getBusHub",
"(",
"String",
"name",
",",
"Comparator",
"<",
"String",
">",
"nameComparator",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Comparator",
"<",
"String",
">",
"cmp",
"=",
"nameComparator",
"==",
"null",
"?",
"BusNetworkUtilities",
".",
"NAME_COMPARATOR",
":",
"nameComparator",
";",
"for",
"(",
"final",
"BusHub",
"busHub",
":",
"this",
".",
"validBusHubs",
")",
"{",
"if",
"(",
"cmp",
".",
"compare",
"(",
"name",
",",
"busHub",
".",
"getName",
"(",
")",
")",
"==",
"0",
")",
"{",
"return",
"busHub",
";",
"}",
"}",
"for",
"(",
"final",
"BusHub",
"busHub",
":",
"this",
".",
"invalidBusHubs",
")",
"{",
"if",
"(",
"cmp",
".",
"compare",
"(",
"name",
",",
"busHub",
".",
"getName",
"(",
")",
")",
"==",
"0",
")",
"{",
"return",
"busHub",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Replies the bus hub with the specified name.
@param name is the desired name
@param nameComparator is used to compare the names.
@return a bus hub or <code>null</code> | [
"Replies",
"the",
"bus",
"hub",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1288-L1305 |
lkwg82/enforcer-rules | src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java | AbstractVersionEnforcer.enforceVersion | public void enforceVersion( Log log, String variableName, String requiredVersionRange, ArtifactVersion actualVersion )
throws EnforcerRuleException {
"""
Compares the specified version to see if it is allowed by the defined version range.
@param log the log
@param variableName name of variable to use in messages (Example: "Maven" or "Java" etc).
@param requiredVersionRange range of allowed versions.
@param actualVersion the version to be checked.
@throws EnforcerRuleException the enforcer rule exception
"""
if ( StringUtils.isEmpty( requiredVersionRange ) )
{
throw new EnforcerRuleException( variableName + " version can't be empty." );
}
else
{
VersionRange vr;
String msg = "Detected " + variableName + " Version: " + actualVersion;
// short circuit check if the strings are exactly equal
if ( actualVersion.toString().equals( requiredVersionRange ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
try
{
vr = VersionRange.createFromVersionSpec( requiredVersionRange );
if ( containsVersion( vr, actualVersion ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
String message = getMessage();
if ( StringUtils.isEmpty( message ) )
{
message = msg + " is not in the allowed range " + vr + ".";
}
throw new EnforcerRuleException( message );
}
}
catch ( InvalidVersionSpecificationException e )
{
throw new EnforcerRuleException( "The requested " + variableName + " version "
+ requiredVersionRange + " is invalid.", e );
}
}
}
} | java | public void enforceVersion( Log log, String variableName, String requiredVersionRange, ArtifactVersion actualVersion )
throws EnforcerRuleException
{
if ( StringUtils.isEmpty( requiredVersionRange ) )
{
throw new EnforcerRuleException( variableName + " version can't be empty." );
}
else
{
VersionRange vr;
String msg = "Detected " + variableName + " Version: " + actualVersion;
// short circuit check if the strings are exactly equal
if ( actualVersion.toString().equals( requiredVersionRange ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
try
{
vr = VersionRange.createFromVersionSpec( requiredVersionRange );
if ( containsVersion( vr, actualVersion ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
String message = getMessage();
if ( StringUtils.isEmpty( message ) )
{
message = msg + " is not in the allowed range " + vr + ".";
}
throw new EnforcerRuleException( message );
}
}
catch ( InvalidVersionSpecificationException e )
{
throw new EnforcerRuleException( "The requested " + variableName + " version "
+ requiredVersionRange + " is invalid.", e );
}
}
}
} | [
"public",
"void",
"enforceVersion",
"(",
"Log",
"log",
",",
"String",
"variableName",
",",
"String",
"requiredVersionRange",
",",
"ArtifactVersion",
"actualVersion",
")",
"throws",
"EnforcerRuleException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"requiredVersionRange",
")",
")",
"{",
"throw",
"new",
"EnforcerRuleException",
"(",
"variableName",
"+",
"\" version can't be empty.\"",
")",
";",
"}",
"else",
"{",
"VersionRange",
"vr",
";",
"String",
"msg",
"=",
"\"Detected \"",
"+",
"variableName",
"+",
"\" Version: \"",
"+",
"actualVersion",
";",
"// short circuit check if the strings are exactly equal",
"if",
"(",
"actualVersion",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"requiredVersionRange",
")",
")",
"{",
"log",
".",
"debug",
"(",
"msg",
"+",
"\" is allowed in the range \"",
"+",
"requiredVersionRange",
"+",
"\".\"",
")",
";",
"}",
"else",
"{",
"try",
"{",
"vr",
"=",
"VersionRange",
".",
"createFromVersionSpec",
"(",
"requiredVersionRange",
")",
";",
"if",
"(",
"containsVersion",
"(",
"vr",
",",
"actualVersion",
")",
")",
"{",
"log",
".",
"debug",
"(",
"msg",
"+",
"\" is allowed in the range \"",
"+",
"requiredVersionRange",
"+",
"\".\"",
")",
";",
"}",
"else",
"{",
"String",
"message",
"=",
"getMessage",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"message",
")",
")",
"{",
"message",
"=",
"msg",
"+",
"\" is not in the allowed range \"",
"+",
"vr",
"+",
"\".\"",
";",
"}",
"throw",
"new",
"EnforcerRuleException",
"(",
"message",
")",
";",
"}",
"}",
"catch",
"(",
"InvalidVersionSpecificationException",
"e",
")",
"{",
"throw",
"new",
"EnforcerRuleException",
"(",
"\"The requested \"",
"+",
"variableName",
"+",
"\" version \"",
"+",
"requiredVersionRange",
"+",
"\" is invalid.\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}"
] | Compares the specified version to see if it is allowed by the defined version range.
@param log the log
@param variableName name of variable to use in messages (Example: "Maven" or "Java" etc).
@param requiredVersionRange range of allowed versions.
@param actualVersion the version to be checked.
@throws EnforcerRuleException the enforcer rule exception | [
"Compares",
"the",
"specified",
"version",
"to",
"see",
"if",
"it",
"is",
"allowed",
"by",
"the",
"defined",
"version",
"range",
"."
] | train | https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java#L69-L116 |
bazaarvoice/ostrich | core/src/main/java/com/bazaarvoice/ostrich/discovery/ConfiguredFixedHostDiscoverySource.java | ConfiguredFixedHostDiscoverySource.serialize | @SuppressWarnings("UnusedParameters")
protected String serialize(String serviceName, String id, Payload payload) {
"""
Subclasses may override this to customize the persistent format of the payload.
"""
return String.valueOf(payload);
} | java | @SuppressWarnings("UnusedParameters")
protected String serialize(String serviceName, String id, Payload payload) {
return String.valueOf(payload);
} | [
"@",
"SuppressWarnings",
"(",
"\"UnusedParameters\"",
")",
"protected",
"String",
"serialize",
"(",
"String",
"serviceName",
",",
"String",
"id",
",",
"Payload",
"payload",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"payload",
")",
";",
"}"
] | Subclasses may override this to customize the persistent format of the payload. | [
"Subclasses",
"may",
"override",
"this",
"to",
"customize",
"the",
"persistent",
"format",
"of",
"the",
"payload",
"."
] | train | https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/discovery/ConfiguredFixedHostDiscoverySource.java#L64-L67 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java | ClassBuilder.buildMemberSummary | public void buildMemberSummary(XMLNode node, Content classContentTree) throws Exception {
"""
Build the member summary contents of the page.
@param node the XML element that specifies which components to document
@param classContentTree the content tree to which the documentation will be added
"""
Content memberSummaryTree = writer.getMemberTreeHeader();
configuration.getBuilderFactory().
getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
classContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
} | java | public void buildMemberSummary(XMLNode node, Content classContentTree) throws Exception {
Content memberSummaryTree = writer.getMemberTreeHeader();
configuration.getBuilderFactory().
getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
classContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
} | [
"public",
"void",
"buildMemberSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"classContentTree",
")",
"throws",
"Exception",
"{",
"Content",
"memberSummaryTree",
"=",
"writer",
".",
"getMemberTreeHeader",
"(",
")",
";",
"configuration",
".",
"getBuilderFactory",
"(",
")",
".",
"getMemberSummaryBuilder",
"(",
"writer",
")",
".",
"buildChildren",
"(",
"node",
",",
"memberSummaryTree",
")",
";",
"classContentTree",
".",
"addContent",
"(",
"writer",
".",
"getMemberSummaryTree",
"(",
"memberSummaryTree",
")",
")",
";",
"}"
] | Build the member summary contents of the page.
@param node the XML element that specifies which components to document
@param classContentTree the content tree to which the documentation will be added | [
"Build",
"the",
"member",
"summary",
"contents",
"of",
"the",
"page",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java#L339-L344 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/gen/StorableGenerator.java | StorableGenerator.requirePkInitialized | private void requirePkInitialized(CodeBuilder b, String methodName) {
"""
Generates code that verifies that all primary keys are initialized.
@param b builder that will invoke generated method
@param methodName name to give to generated method
"""
// Add code to call method which we are about to define.
b.loadThis();
b.invokeVirtual(methodName, null, null);
// Now define new method, discarding original builder object.
b = new CodeBuilder(mClassFile.addMethod(Modifiers.PROTECTED, methodName, null, null));
b.loadThis();
b.invokeVirtual(IS_REQUIRED_PK_INITIALIZED_METHOD_NAME, TypeDesc.BOOLEAN, null);
Label pkInitialized = b.createLabel();
b.ifZeroComparisonBranch(pkInitialized, "!=");
CodeBuilderUtil.throwException
(b, IllegalStateException.class, "Primary key not fully specified");
pkInitialized.setLocation();
b.returnVoid();
} | java | private void requirePkInitialized(CodeBuilder b, String methodName) {
// Add code to call method which we are about to define.
b.loadThis();
b.invokeVirtual(methodName, null, null);
// Now define new method, discarding original builder object.
b = new CodeBuilder(mClassFile.addMethod(Modifiers.PROTECTED, methodName, null, null));
b.loadThis();
b.invokeVirtual(IS_REQUIRED_PK_INITIALIZED_METHOD_NAME, TypeDesc.BOOLEAN, null);
Label pkInitialized = b.createLabel();
b.ifZeroComparisonBranch(pkInitialized, "!=");
CodeBuilderUtil.throwException
(b, IllegalStateException.class, "Primary key not fully specified");
pkInitialized.setLocation();
b.returnVoid();
} | [
"private",
"void",
"requirePkInitialized",
"(",
"CodeBuilder",
"b",
",",
"String",
"methodName",
")",
"{",
"// Add code to call method which we are about to define.\r",
"b",
".",
"loadThis",
"(",
")",
";",
"b",
".",
"invokeVirtual",
"(",
"methodName",
",",
"null",
",",
"null",
")",
";",
"// Now define new method, discarding original builder object.\r",
"b",
"=",
"new",
"CodeBuilder",
"(",
"mClassFile",
".",
"addMethod",
"(",
"Modifiers",
".",
"PROTECTED",
",",
"methodName",
",",
"null",
",",
"null",
")",
")",
";",
"b",
".",
"loadThis",
"(",
")",
";",
"b",
".",
"invokeVirtual",
"(",
"IS_REQUIRED_PK_INITIALIZED_METHOD_NAME",
",",
"TypeDesc",
".",
"BOOLEAN",
",",
"null",
")",
";",
"Label",
"pkInitialized",
"=",
"b",
".",
"createLabel",
"(",
")",
";",
"b",
".",
"ifZeroComparisonBranch",
"(",
"pkInitialized",
",",
"\"!=\"",
")",
";",
"CodeBuilderUtil",
".",
"throwException",
"(",
"b",
",",
"IllegalStateException",
".",
"class",
",",
"\"Primary key not fully specified\"",
")",
";",
"pkInitialized",
".",
"setLocation",
"(",
")",
";",
"b",
".",
"returnVoid",
"(",
")",
";",
"}"
] | Generates code that verifies that all primary keys are initialized.
@param b builder that will invoke generated method
@param methodName name to give to generated method | [
"Generates",
"code",
"that",
"verifies",
"that",
"all",
"primary",
"keys",
"are",
"initialized",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java#L2577-L2592 |
stevespringett/CPE-Parser | src/main/java/us/springett/parsers/cpe/Cpe.java | Cpe.compareAttributes | protected static boolean compareAttributes(Part left, Part right) {
"""
This does not follow the spec precisely because ANY compared to NA is
classified as undefined by the spec; however, in this implementation ANY
will match NA and return true.
This will compare the left value to the right value and return true if
the left matches the right. Note that it is possible that the right would
not match the left value.
@param left the left value to compare
@param right the right value to compare
@return <code>true</code> if the left value matches the right value;
otherwise <code>false</code>
"""
if (left == right) {
return true;
} else if (left == Part.ANY) {
return true;
}
return false;
} | java | protected static boolean compareAttributes(Part left, Part right) {
if (left == right) {
return true;
} else if (left == Part.ANY) {
return true;
}
return false;
} | [
"protected",
"static",
"boolean",
"compareAttributes",
"(",
"Part",
"left",
",",
"Part",
"right",
")",
"{",
"if",
"(",
"left",
"==",
"right",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"left",
"==",
"Part",
".",
"ANY",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | This does not follow the spec precisely because ANY compared to NA is
classified as undefined by the spec; however, in this implementation ANY
will match NA and return true.
This will compare the left value to the right value and return true if
the left matches the right. Note that it is possible that the right would
not match the left value.
@param left the left value to compare
@param right the right value to compare
@return <code>true</code> if the left value matches the right value;
otherwise <code>false</code> | [
"This",
"does",
"not",
"follow",
"the",
"spec",
"precisely",
"because",
"ANY",
"compared",
"to",
"NA",
"is",
"classified",
"as",
"undefined",
"by",
"the",
"spec",
";",
"however",
"in",
"this",
"implementation",
"ANY",
"will",
"match",
"NA",
"and",
"return",
"true",
"."
] | train | https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/Cpe.java#L584-L591 |
KyoriPowered/text | api/src/main/java/net/kyori/text/event/ClickEvent.java | ClickEvent.runCommand | public static @NonNull ClickEvent runCommand(final @NonNull String command) {
"""
Creates a click event that runs a command.
@param command the command to run
@return a click event
"""
return new ClickEvent(Action.RUN_COMMAND, command);
} | java | public static @NonNull ClickEvent runCommand(final @NonNull String command) {
return new ClickEvent(Action.RUN_COMMAND, command);
} | [
"public",
"static",
"@",
"NonNull",
"ClickEvent",
"runCommand",
"(",
"final",
"@",
"NonNull",
"String",
"command",
")",
"{",
"return",
"new",
"ClickEvent",
"(",
"Action",
".",
"RUN_COMMAND",
",",
"command",
")",
";",
"}"
] | Creates a click event that runs a command.
@param command the command to run
@return a click event | [
"Creates",
"a",
"click",
"event",
"that",
"runs",
"a",
"command",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/event/ClickEvent.java#L76-L78 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkWhile | private Environment checkWhile(Stmt.While stmt, Environment environment, EnclosingScope scope) {
"""
Type check a <code>whiley</code> statement.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return
@throws ResolveError
If a named type within this statement cannot be resolved within
the enclosing project.
"""
// Type loop invariant(s).
checkConditions(stmt.getInvariant(), true, environment);
// Type condition assuming its true to represent inside a loop
// iteration.
// Important if condition contains a type test, as we'll know it holds.
Environment trueEnvironment = checkCondition(stmt.getCondition(), true, environment);
// Type condition assuming its false to represent the terminated loop.
// Important if condition contains a type test, as we'll know it doesn't
// hold.
Environment falseEnvironment = checkCondition(stmt.getCondition(), false, environment);
// Type loop body using true environment
checkBlock(stmt.getBody(), trueEnvironment, scope);
// Determine and update modified variables
Tuple<Decl.Variable> modified = FlowTypeUtils.determineModifiedVariables(stmt.getBody());
stmt.setModified(stmt.getHeap().allocate(modified));
// Return false environment to represent flow after loop.
return falseEnvironment;
} | java | private Environment checkWhile(Stmt.While stmt, Environment environment, EnclosingScope scope) {
// Type loop invariant(s).
checkConditions(stmt.getInvariant(), true, environment);
// Type condition assuming its true to represent inside a loop
// iteration.
// Important if condition contains a type test, as we'll know it holds.
Environment trueEnvironment = checkCondition(stmt.getCondition(), true, environment);
// Type condition assuming its false to represent the terminated loop.
// Important if condition contains a type test, as we'll know it doesn't
// hold.
Environment falseEnvironment = checkCondition(stmt.getCondition(), false, environment);
// Type loop body using true environment
checkBlock(stmt.getBody(), trueEnvironment, scope);
// Determine and update modified variables
Tuple<Decl.Variable> modified = FlowTypeUtils.determineModifiedVariables(stmt.getBody());
stmt.setModified(stmt.getHeap().allocate(modified));
// Return false environment to represent flow after loop.
return falseEnvironment;
} | [
"private",
"Environment",
"checkWhile",
"(",
"Stmt",
".",
"While",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"// Type loop invariant(s).",
"checkConditions",
"(",
"stmt",
".",
"getInvariant",
"(",
")",
",",
"true",
",",
"environment",
")",
";",
"// Type condition assuming its true to represent inside a loop",
"// iteration.",
"// Important if condition contains a type test, as we'll know it holds.",
"Environment",
"trueEnvironment",
"=",
"checkCondition",
"(",
"stmt",
".",
"getCondition",
"(",
")",
",",
"true",
",",
"environment",
")",
";",
"// Type condition assuming its false to represent the terminated loop.",
"// Important if condition contains a type test, as we'll know it doesn't",
"// hold.",
"Environment",
"falseEnvironment",
"=",
"checkCondition",
"(",
"stmt",
".",
"getCondition",
"(",
")",
",",
"false",
",",
"environment",
")",
";",
"// Type loop body using true environment",
"checkBlock",
"(",
"stmt",
".",
"getBody",
"(",
")",
",",
"trueEnvironment",
",",
"scope",
")",
";",
"// Determine and update modified variables",
"Tuple",
"<",
"Decl",
".",
"Variable",
">",
"modified",
"=",
"FlowTypeUtils",
".",
"determineModifiedVariables",
"(",
"stmt",
".",
"getBody",
"(",
")",
")",
";",
"stmt",
".",
"setModified",
"(",
"stmt",
".",
"getHeap",
"(",
")",
".",
"allocate",
"(",
"modified",
")",
")",
";",
"// Return false environment to represent flow after loop.",
"return",
"falseEnvironment",
";",
"}"
] | Type check a <code>whiley</code> statement.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return
@throws ResolveError
If a named type within this statement cannot be resolved within
the enclosing project. | [
"Type",
"check",
"a",
"<code",
">",
"whiley<",
"/",
"code",
">",
"statement",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L757-L775 |
Jasig/uPortal | uPortal-web/src/main/java/org/apereo/portal/url/PortalUrlProviderImpl.java | PortalUrlProviderImpl.verifyPortletWindowId | protected String verifyPortletWindowId(
HttpServletRequest request, IPortletWindowId portletWindowId) {
"""
Verify the requested portlet window corresponds to a node in the user's layout and return the
corresponding layout node id
"""
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
final IPortletWindow portletWindow =
this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
final IPortletWindowId delegationParentWindowId = portletWindow.getDelegationParentId();
if (delegationParentWindowId != null) {
return verifyPortletWindowId(request, delegationParentWindowId);
}
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
final String channelSubscribeId = portletEntity.getLayoutNodeId();
final IUserLayoutNodeDescription node = userLayoutManager.getNode(channelSubscribeId);
if (node == null) {
throw new IllegalArgumentException(
"No layout node exists for id "
+ channelSubscribeId
+ " of window "
+ portletWindowId);
}
return node.getId();
} | java | protected String verifyPortletWindowId(
HttpServletRequest request, IPortletWindowId portletWindowId) {
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
final IPortletWindow portletWindow =
this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
final IPortletWindowId delegationParentWindowId = portletWindow.getDelegationParentId();
if (delegationParentWindowId != null) {
return verifyPortletWindowId(request, delegationParentWindowId);
}
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
final String channelSubscribeId = portletEntity.getLayoutNodeId();
final IUserLayoutNodeDescription node = userLayoutManager.getNode(channelSubscribeId);
if (node == null) {
throw new IllegalArgumentException(
"No layout node exists for id "
+ channelSubscribeId
+ " of window "
+ portletWindowId);
}
return node.getId();
} | [
"protected",
"String",
"verifyPortletWindowId",
"(",
"HttpServletRequest",
"request",
",",
"IPortletWindowId",
"portletWindowId",
")",
"{",
"final",
"IUserInstance",
"userInstance",
"=",
"this",
".",
"userInstanceManager",
".",
"getUserInstance",
"(",
"request",
")",
";",
"final",
"IUserPreferencesManager",
"preferencesManager",
"=",
"userInstance",
".",
"getPreferencesManager",
"(",
")",
";",
"final",
"IUserLayoutManager",
"userLayoutManager",
"=",
"preferencesManager",
".",
"getUserLayoutManager",
"(",
")",
";",
"final",
"IPortletWindow",
"portletWindow",
"=",
"this",
".",
"portletWindowRegistry",
".",
"getPortletWindow",
"(",
"request",
",",
"portletWindowId",
")",
";",
"final",
"IPortletWindowId",
"delegationParentWindowId",
"=",
"portletWindow",
".",
"getDelegationParentId",
"(",
")",
";",
"if",
"(",
"delegationParentWindowId",
"!=",
"null",
")",
"{",
"return",
"verifyPortletWindowId",
"(",
"request",
",",
"delegationParentWindowId",
")",
";",
"}",
"final",
"IPortletEntity",
"portletEntity",
"=",
"portletWindow",
".",
"getPortletEntity",
"(",
")",
";",
"final",
"String",
"channelSubscribeId",
"=",
"portletEntity",
".",
"getLayoutNodeId",
"(",
")",
";",
"final",
"IUserLayoutNodeDescription",
"node",
"=",
"userLayoutManager",
".",
"getNode",
"(",
"channelSubscribeId",
")",
";",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No layout node exists for id \"",
"+",
"channelSubscribeId",
"+",
"\" of window \"",
"+",
"portletWindowId",
")",
";",
"}",
"return",
"node",
".",
"getId",
"(",
")",
";",
"}"
] | Verify the requested portlet window corresponds to a node in the user's layout and return the
corresponding layout node id | [
"Verify",
"the",
"requested",
"portlet",
"window",
"corresponds",
"to",
"a",
"node",
"in",
"the",
"user",
"s",
"layout",
"and",
"return",
"the",
"corresponding",
"layout",
"node",
"id"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-web/src/main/java/org/apereo/portal/url/PortalUrlProviderImpl.java#L216-L241 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/ModifyRawHelper.java | ModifyRawHelper.extractWhereConditions | static String extractWhereConditions(boolean updateMode, SQLiteModelMethod method) {
"""
Extract where conditions.
@param updateMode
the update mode
@param method
the method
@return the string
"""
final One<String> whereCondition = new One<String>("");
final One<Boolean> found = new One<Boolean>(null);
JQLChecker.getInstance().replaceVariableStatements(method, method.jql.value, new JQLReplaceVariableStatementListenerImpl() {
@Override
public String onWhere(String statement) {
if (found.value0 == null) {
whereCondition.value0 = statement;
found.value0 = true;
}
return null;
}
});
return StringUtils.ifNotEmptyAppend(whereCondition.value0, " ");
} | java | static String extractWhereConditions(boolean updateMode, SQLiteModelMethod method) {
final One<String> whereCondition = new One<String>("");
final One<Boolean> found = new One<Boolean>(null);
JQLChecker.getInstance().replaceVariableStatements(method, method.jql.value, new JQLReplaceVariableStatementListenerImpl() {
@Override
public String onWhere(String statement) {
if (found.value0 == null) {
whereCondition.value0 = statement;
found.value0 = true;
}
return null;
}
});
return StringUtils.ifNotEmptyAppend(whereCondition.value0, " ");
} | [
"static",
"String",
"extractWhereConditions",
"(",
"boolean",
"updateMode",
",",
"SQLiteModelMethod",
"method",
")",
"{",
"final",
"One",
"<",
"String",
">",
"whereCondition",
"=",
"new",
"One",
"<",
"String",
">",
"(",
"\"\"",
")",
";",
"final",
"One",
"<",
"Boolean",
">",
"found",
"=",
"new",
"One",
"<",
"Boolean",
">",
"(",
"null",
")",
";",
"JQLChecker",
".",
"getInstance",
"(",
")",
".",
"replaceVariableStatements",
"(",
"method",
",",
"method",
".",
"jql",
".",
"value",
",",
"new",
"JQLReplaceVariableStatementListenerImpl",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"onWhere",
"(",
"String",
"statement",
")",
"{",
"if",
"(",
"found",
".",
"value0",
"==",
"null",
")",
"{",
"whereCondition",
".",
"value0",
"=",
"statement",
";",
"found",
".",
"value0",
"=",
"true",
";",
"}",
"return",
"null",
";",
"}",
"}",
")",
";",
"return",
"StringUtils",
".",
"ifNotEmptyAppend",
"(",
"whereCondition",
".",
"value0",
",",
"\" \"",
")",
";",
"}"
] | Extract where conditions.
@param updateMode
the update mode
@param method
the method
@return the string | [
"Extract",
"where",
"conditions",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/ModifyRawHelper.java#L388-L405 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.deviceList | public static DeviceListResult deviceList(String accessToken, DeviceList deviceList) {
"""
Wi-Fi设备管理-查询设备
可通过指定分页或具体门店ID的方式,查询当前MP账号下指定门店连网成功的设备信息。一次最多能查询20个门店的设备信息。
@param accessToken accessToken
@param deviceList deviceList
@return DeviceListResult
"""
return deviceList(accessToken, JsonUtil.toJSONString(deviceList));
} | java | public static DeviceListResult deviceList(String accessToken, DeviceList deviceList) {
return deviceList(accessToken, JsonUtil.toJSONString(deviceList));
} | [
"public",
"static",
"DeviceListResult",
"deviceList",
"(",
"String",
"accessToken",
",",
"DeviceList",
"deviceList",
")",
"{",
"return",
"deviceList",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"deviceList",
")",
")",
";",
"}"
] | Wi-Fi设备管理-查询设备
可通过指定分页或具体门店ID的方式,查询当前MP账号下指定门店连网成功的设备信息。一次最多能查询20个门店的设备信息。
@param accessToken accessToken
@param deviceList deviceList
@return DeviceListResult | [
"Wi",
"-",
"Fi设备管理",
"-",
"查询设备",
"可通过指定分页或具体门店ID的方式,查询当前MP账号下指定门店连网成功的设备信息。一次最多能查询20个门店的设备信息。"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L379-L381 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java | ASegment.getNextMatch | protected IWord[] getNextMatch(char[] chars, int index) {
"""
match the next CJK word in the dictionary
@param chars
@param index
@return IWord[]
"""
ArrayList<IWord> mList = new ArrayList<IWord>(8);
//StringBuilder isb = new StringBuilder();
isb.clear();
char c = chars[index];
isb.append(c);
String temp = isb.toString();
if ( dic.match(ILexicon.CJK_WORD, temp) ) {
mList.add(dic.get(ILexicon.CJK_WORD, temp));
}
String _key = null;
for ( int j = 1;
j < config.MAX_LENGTH && ((j+index) < chars.length); j++ ) {
isb.append(chars[j+index]);
_key = isb.toString();
if ( dic.match(ILexicon.CJK_WORD, _key) ) {
mList.add(dic.get(ILexicon.CJK_WORD, _key));
}
}
/*
* if match no words from the current position
* to idx+Config.MAX_LENGTH, just return the Word with
* a value of temp as a unrecognited word.
*/
if ( mList.isEmpty() ) {
mList.add(new Word(temp, ILexicon.UNMATCH_CJK_WORD));
}
/* for ( int j = 0; j < mList.size(); j++ ) {
System.out.println(mList.get(j));
}*/
IWord[] words = new IWord[mList.size()];
mList.toArray(words);
mList.clear();
return words;
} | java | protected IWord[] getNextMatch(char[] chars, int index)
{
ArrayList<IWord> mList = new ArrayList<IWord>(8);
//StringBuilder isb = new StringBuilder();
isb.clear();
char c = chars[index];
isb.append(c);
String temp = isb.toString();
if ( dic.match(ILexicon.CJK_WORD, temp) ) {
mList.add(dic.get(ILexicon.CJK_WORD, temp));
}
String _key = null;
for ( int j = 1;
j < config.MAX_LENGTH && ((j+index) < chars.length); j++ ) {
isb.append(chars[j+index]);
_key = isb.toString();
if ( dic.match(ILexicon.CJK_WORD, _key) ) {
mList.add(dic.get(ILexicon.CJK_WORD, _key));
}
}
/*
* if match no words from the current position
* to idx+Config.MAX_LENGTH, just return the Word with
* a value of temp as a unrecognited word.
*/
if ( mList.isEmpty() ) {
mList.add(new Word(temp, ILexicon.UNMATCH_CJK_WORD));
}
/* for ( int j = 0; j < mList.size(); j++ ) {
System.out.println(mList.get(j));
}*/
IWord[] words = new IWord[mList.size()];
mList.toArray(words);
mList.clear();
return words;
} | [
"protected",
"IWord",
"[",
"]",
"getNextMatch",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"index",
")",
"{",
"ArrayList",
"<",
"IWord",
">",
"mList",
"=",
"new",
"ArrayList",
"<",
"IWord",
">",
"(",
"8",
")",
";",
"//StringBuilder isb = new StringBuilder();",
"isb",
".",
"clear",
"(",
")",
";",
"char",
"c",
"=",
"chars",
"[",
"index",
"]",
";",
"isb",
".",
"append",
"(",
"c",
")",
";",
"String",
"temp",
"=",
"isb",
".",
"toString",
"(",
")",
";",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"temp",
")",
")",
"{",
"mList",
".",
"add",
"(",
"dic",
".",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"temp",
")",
")",
";",
"}",
"String",
"_key",
"=",
"null",
";",
"for",
"(",
"int",
"j",
"=",
"1",
";",
"j",
"<",
"config",
".",
"MAX_LENGTH",
"&&",
"(",
"(",
"j",
"+",
"index",
")",
"<",
"chars",
".",
"length",
")",
";",
"j",
"++",
")",
"{",
"isb",
".",
"append",
"(",
"chars",
"[",
"j",
"+",
"index",
"]",
")",
";",
"_key",
"=",
"isb",
".",
"toString",
"(",
")",
";",
"if",
"(",
"dic",
".",
"match",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"_key",
")",
")",
"{",
"mList",
".",
"add",
"(",
"dic",
".",
"get",
"(",
"ILexicon",
".",
"CJK_WORD",
",",
"_key",
")",
")",
";",
"}",
"}",
"/*\n * if match no words from the current position \n * to idx+Config.MAX_LENGTH, just return the Word with\n * a value of temp as a unrecognited word. \n */",
"if",
"(",
"mList",
".",
"isEmpty",
"(",
")",
")",
"{",
"mList",
".",
"add",
"(",
"new",
"Word",
"(",
"temp",
",",
"ILexicon",
".",
"UNMATCH_CJK_WORD",
")",
")",
";",
"}",
"/* for ( int j = 0; j < mList.size(); j++ ) {\n System.out.println(mList.get(j));\n }*/",
"IWord",
"[",
"]",
"words",
"=",
"new",
"IWord",
"[",
"mList",
".",
"size",
"(",
")",
"]",
";",
"mList",
".",
"toArray",
"(",
"words",
")",
";",
"mList",
".",
"clear",
"(",
")",
";",
"return",
"words",
";",
"}"
] | match the next CJK word in the dictionary
@param chars
@param index
@return IWord[] | [
"match",
"the",
"next",
"CJK",
"word",
"in",
"the",
"dictionary"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java#L882-L923 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | HadoopUtils.setWriterDirOctalPermissions | public static void setWriterDirOctalPermissions(State state, int numBranches, int branchId, String octalPermissions) {
"""
Given a {@link String} in octal notation, set a key, value pair in the given {@link State} for the writer to
use when creating directories. This method should be used in conjunction with {@link #deserializeWriterDirPermissions(State, int, int)}.
"""
state.setProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_DIR_PERMISSIONS, numBranches, branchId),
octalPermissions);
} | java | public static void setWriterDirOctalPermissions(State state, int numBranches, int branchId, String octalPermissions) {
state.setProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_DIR_PERMISSIONS, numBranches, branchId),
octalPermissions);
} | [
"public",
"static",
"void",
"setWriterDirOctalPermissions",
"(",
"State",
"state",
",",
"int",
"numBranches",
",",
"int",
"branchId",
",",
"String",
"octalPermissions",
")",
"{",
"state",
".",
"setProp",
"(",
"ForkOperatorUtils",
".",
"getPropertyNameForBranch",
"(",
"ConfigurationKeys",
".",
"WRITER_DIR_PERMISSIONS",
",",
"numBranches",
",",
"branchId",
")",
",",
"octalPermissions",
")",
";",
"}"
] | Given a {@link String} in octal notation, set a key, value pair in the given {@link State} for the writer to
use when creating directories. This method should be used in conjunction with {@link #deserializeWriterDirPermissions(State, int, int)}. | [
"Given",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L876-L880 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java | TextFormatter.appendSize | public static void appendSize(StringBuilder buf, long size) {
"""
Appends the human-readable representation of the specified byte-unit {@code size} to the specified
{@link StringBuffer}.
"""
if (size >= 104857600) { // >= 100 MiB
buf.append(size / 1048576).append("MiB(").append(size).append("B)");
} else if (size >= 102400) { // >= 100 KiB
buf.append(size / 1024).append("KiB(").append(size).append("B)");
} else {
buf.append(size).append('B');
}
} | java | public static void appendSize(StringBuilder buf, long size) {
if (size >= 104857600) { // >= 100 MiB
buf.append(size / 1048576).append("MiB(").append(size).append("B)");
} else if (size >= 102400) { // >= 100 KiB
buf.append(size / 1024).append("KiB(").append(size).append("B)");
} else {
buf.append(size).append('B');
}
} | [
"public",
"static",
"void",
"appendSize",
"(",
"StringBuilder",
"buf",
",",
"long",
"size",
")",
"{",
"if",
"(",
"size",
">=",
"104857600",
")",
"{",
"// >= 100 MiB",
"buf",
".",
"append",
"(",
"size",
"/",
"1048576",
")",
".",
"append",
"(",
"\"MiB(\"",
")",
".",
"append",
"(",
"size",
")",
".",
"append",
"(",
"\"B)\"",
")",
";",
"}",
"else",
"if",
"(",
"size",
">=",
"102400",
")",
"{",
"// >= 100 KiB",
"buf",
".",
"append",
"(",
"size",
"/",
"1024",
")",
".",
"append",
"(",
"\"KiB(\"",
")",
".",
"append",
"(",
"size",
")",
".",
"append",
"(",
"\"B)\"",
")",
";",
"}",
"else",
"{",
"buf",
".",
"append",
"(",
"size",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"}"
] | Appends the human-readable representation of the specified byte-unit {@code size} to the specified
{@link StringBuffer}. | [
"Appends",
"the",
"human",
"-",
"readable",
"representation",
"of",
"the",
"specified",
"byte",
"-",
"unit",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java#L36-L44 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | ExceptionUtils.printRootCauseStackTrace | @GwtIncompatible("incompatible method")
public static void printRootCauseStackTrace(final Throwable throwable, final PrintStream stream) {
"""
<p>Prints a compact stack trace for the root cause of a throwable.</p>
<p>The compact stack trace starts with the root cause and prints
stack frames up to the place where it was caught and wrapped.
Then it prints the wrapped exception and continues with stack frames
until the wrapper exception is caught and wrapped again, etc.</p>
<p>The output of this method is consistent across JDK versions.
Note that this is the opposite order to the JDK1.4 display.</p>
<p>The method is equivalent to <code>printStackTrace</code> for throwables
that don't have nested causes.</p>
@param throwable the throwable to output, may be null
@param stream the stream to output to, may not be null
@throws IllegalArgumentException if the stream is <code>null</code>
@since 2.0
"""
if (throwable == null) {
return;
}
Validate.isTrue(stream != null, "The PrintStream must not be null");
final String trace[] = getRootCauseStackTrace(throwable);
for (final String element : trace) {
stream.println(element);
}
stream.flush();
} | java | @GwtIncompatible("incompatible method")
public static void printRootCauseStackTrace(final Throwable throwable, final PrintStream stream) {
if (throwable == null) {
return;
}
Validate.isTrue(stream != null, "The PrintStream must not be null");
final String trace[] = getRootCauseStackTrace(throwable);
for (final String element : trace) {
stream.println(element);
}
stream.flush();
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"void",
"printRootCauseStackTrace",
"(",
"final",
"Throwable",
"throwable",
",",
"final",
"PrintStream",
"stream",
")",
"{",
"if",
"(",
"throwable",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Validate",
".",
"isTrue",
"(",
"stream",
"!=",
"null",
",",
"\"The PrintStream must not be null\"",
")",
";",
"final",
"String",
"trace",
"[",
"]",
"=",
"getRootCauseStackTrace",
"(",
"throwable",
")",
";",
"for",
"(",
"final",
"String",
"element",
":",
"trace",
")",
"{",
"stream",
".",
"println",
"(",
"element",
")",
";",
"}",
"stream",
".",
"flush",
"(",
")",
";",
"}"
] | <p>Prints a compact stack trace for the root cause of a throwable.</p>
<p>The compact stack trace starts with the root cause and prints
stack frames up to the place where it was caught and wrapped.
Then it prints the wrapped exception and continues with stack frames
until the wrapper exception is caught and wrapped again, etc.</p>
<p>The output of this method is consistent across JDK versions.
Note that this is the opposite order to the JDK1.4 display.</p>
<p>The method is equivalent to <code>printStackTrace</code> for throwables
that don't have nested causes.</p>
@param throwable the throwable to output, may be null
@param stream the stream to output to, may not be null
@throws IllegalArgumentException if the stream is <code>null</code>
@since 2.0 | [
"<p",
">",
"Prints",
"a",
"compact",
"stack",
"trace",
"for",
"the",
"root",
"cause",
"of",
"a",
"throwable",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java#L471-L482 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_zone_name_terminate_POST | public void serviceName_zone_name_terminate_POST(String serviceName, String name) throws IOException {
"""
Terminate your service zone option
REST: POST /ipLoadbalancing/{serviceName}/zone/{name}/terminate
@param serviceName [required] The internal name of your IP load balancing
@param name [required] Name of your zone
"""
String qPath = "/ipLoadbalancing/{serviceName}/zone/{name}/terminate";
StringBuilder sb = path(qPath, serviceName, name);
exec(qPath, "POST", sb.toString(), null);
} | java | public void serviceName_zone_name_terminate_POST(String serviceName, String name) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/zone/{name}/terminate";
StringBuilder sb = path(qPath, serviceName, name);
exec(qPath, "POST", sb.toString(), null);
} | [
"public",
"void",
"serviceName_zone_name_terminate_POST",
"(",
"String",
"serviceName",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/zone/{name}/terminate\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"name",
")",
";",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"}"
] | Terminate your service zone option
REST: POST /ipLoadbalancing/{serviceName}/zone/{name}/terminate
@param serviceName [required] The internal name of your IP load balancing
@param name [required] Name of your zone | [
"Terminate",
"your",
"service",
"zone",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1790-L1794 |
rundeck/rundeck | core/src/main/java/com/dtolabs/utils/Mapper.java | Mapper.beanMap | public static Collection beanMap(final String property, Iterator i, boolean includeNull) {
"""
Map dynamically using a bean property name.
@param property the name of a bean property
@param i an iterator of objects
@param includeNull true to include null results in the response
@return collection
@throws ClassCastException if there is an error invoking the method on any object.
"""
return map(beanMapper(property), i, includeNull);
} | java | public static Collection beanMap(final String property, Iterator i, boolean includeNull) {
return map(beanMapper(property), i, includeNull);
} | [
"public",
"static",
"Collection",
"beanMap",
"(",
"final",
"String",
"property",
",",
"Iterator",
"i",
",",
"boolean",
"includeNull",
")",
"{",
"return",
"map",
"(",
"beanMapper",
"(",
"property",
")",
",",
"i",
",",
"includeNull",
")",
";",
"}"
] | Map dynamically using a bean property name.
@param property the name of a bean property
@param i an iterator of objects
@param includeNull true to include null results in the response
@return collection
@throws ClassCastException if there is an error invoking the method on any object. | [
"Map",
"dynamically",
"using",
"a",
"bean",
"property",
"name",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L732-L734 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/WorkspacesApi.java | WorkspacesApi.listWorkspaceFilePages | public PageImages listWorkspaceFilePages(String accountId, String workspaceId, String folderId, String fileId, WorkspacesApi.ListWorkspaceFilePagesOptions options) throws ApiException {
"""
List File Pages
Retrieves a workspace file as rasterized pages.
@param accountId The external account number (int) or account ID Guid. (required)
@param workspaceId Specifies the workspace ID GUID. (required)
@param folderId The ID of the folder being accessed. (required)
@param fileId Specifies the room file ID GUID. (required)
@param options for modifying the method behavior.
@return PageImages
@throws ApiException if fails to make API call
"""
Object localVarPostBody = "{}";
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling listWorkspaceFilePages");
}
// verify the required parameter 'workspaceId' is set
if (workspaceId == null) {
throw new ApiException(400, "Missing the required parameter 'workspaceId' when calling listWorkspaceFilePages");
}
// verify the required parameter 'folderId' is set
if (folderId == null) {
throw new ApiException(400, "Missing the required parameter 'folderId' when calling listWorkspaceFilePages");
}
// verify the required parameter 'fileId' is set
if (fileId == null) {
throw new ApiException(400, "Missing the required parameter 'fileId' when calling listWorkspaceFilePages");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/workspaces/{workspaceId}/folders/{folderId}/files/{fileId}/pages".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()))
.replaceAll("\\{" + "workspaceId" + "\\}", apiClient.escapeString(workspaceId.toString()))
.replaceAll("\\{" + "folderId" + "\\}", apiClient.escapeString(folderId.toString()))
.replaceAll("\\{" + "fileId" + "\\}", apiClient.escapeString(fileId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", options.count));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "dpi", options.dpi));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "max_height", options.maxHeight));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "max_width", options.maxWidth));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<PageImages> localVarReturnType = new GenericType<PageImages>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | java | public PageImages listWorkspaceFilePages(String accountId, String workspaceId, String folderId, String fileId, WorkspacesApi.ListWorkspaceFilePagesOptions options) throws ApiException {
Object localVarPostBody = "{}";
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling listWorkspaceFilePages");
}
// verify the required parameter 'workspaceId' is set
if (workspaceId == null) {
throw new ApiException(400, "Missing the required parameter 'workspaceId' when calling listWorkspaceFilePages");
}
// verify the required parameter 'folderId' is set
if (folderId == null) {
throw new ApiException(400, "Missing the required parameter 'folderId' when calling listWorkspaceFilePages");
}
// verify the required parameter 'fileId' is set
if (fileId == null) {
throw new ApiException(400, "Missing the required parameter 'fileId' when calling listWorkspaceFilePages");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/workspaces/{workspaceId}/folders/{folderId}/files/{fileId}/pages".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()))
.replaceAll("\\{" + "workspaceId" + "\\}", apiClient.escapeString(workspaceId.toString()))
.replaceAll("\\{" + "folderId" + "\\}", apiClient.escapeString(folderId.toString()))
.replaceAll("\\{" + "fileId" + "\\}", apiClient.escapeString(fileId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", options.count));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "dpi", options.dpi));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "max_height", options.maxHeight));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "max_width", options.maxWidth));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<PageImages> localVarReturnType = new GenericType<PageImages>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | [
"public",
"PageImages",
"listWorkspaceFilePages",
"(",
"String",
"accountId",
",",
"String",
"workspaceId",
",",
"String",
"folderId",
",",
"String",
"fileId",
",",
"WorkspacesApi",
".",
"ListWorkspaceFilePagesOptions",
"options",
")",
"throws",
"ApiException",
"{",
"Object",
"localVarPostBody",
"=",
"\"{}\"",
";",
"// verify the required parameter 'accountId' is set",
"if",
"(",
"accountId",
"==",
"null",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"400",
",",
"\"Missing the required parameter 'accountId' when calling listWorkspaceFilePages\"",
")",
";",
"}",
"// verify the required parameter 'workspaceId' is set",
"if",
"(",
"workspaceId",
"==",
"null",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"400",
",",
"\"Missing the required parameter 'workspaceId' when calling listWorkspaceFilePages\"",
")",
";",
"}",
"// verify the required parameter 'folderId' is set",
"if",
"(",
"folderId",
"==",
"null",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"400",
",",
"\"Missing the required parameter 'folderId' when calling listWorkspaceFilePages\"",
")",
";",
"}",
"// verify the required parameter 'fileId' is set",
"if",
"(",
"fileId",
"==",
"null",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"400",
",",
"\"Missing the required parameter 'fileId' when calling listWorkspaceFilePages\"",
")",
";",
"}",
"// create path and map variables",
"String",
"localVarPath",
"=",
"\"/v2/accounts/{accountId}/workspaces/{workspaceId}/folders/{folderId}/files/{fileId}/pages\"",
".",
"replaceAll",
"(",
"\"\\\\{format\\\\}\"",
",",
"\"json\"",
")",
".",
"replaceAll",
"(",
"\"\\\\{\"",
"+",
"\"accountId\"",
"+",
"\"\\\\}\"",
",",
"apiClient",
".",
"escapeString",
"(",
"accountId",
".",
"toString",
"(",
")",
")",
")",
".",
"replaceAll",
"(",
"\"\\\\{\"",
"+",
"\"workspaceId\"",
"+",
"\"\\\\}\"",
",",
"apiClient",
".",
"escapeString",
"(",
"workspaceId",
".",
"toString",
"(",
")",
")",
")",
".",
"replaceAll",
"(",
"\"\\\\{\"",
"+",
"\"folderId\"",
"+",
"\"\\\\}\"",
",",
"apiClient",
".",
"escapeString",
"(",
"folderId",
".",
"toString",
"(",
")",
")",
")",
".",
"replaceAll",
"(",
"\"\\\\{\"",
"+",
"\"fileId\"",
"+",
"\"\\\\}\"",
",",
"apiClient",
".",
"escapeString",
"(",
"fileId",
".",
"toString",
"(",
")",
")",
")",
";",
"// query params",
"java",
".",
"util",
".",
"List",
"<",
"Pair",
">",
"localVarQueryParams",
"=",
"new",
"java",
".",
"util",
".",
"ArrayList",
"<",
"Pair",
">",
"(",
")",
";",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"localVarHeaderParams",
"=",
"new",
"java",
".",
"util",
".",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Object",
">",
"localVarFormParams",
"=",
"new",
"java",
".",
"util",
".",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"if",
"(",
"options",
"!=",
"null",
")",
"{",
"localVarQueryParams",
".",
"addAll",
"(",
"apiClient",
".",
"parameterToPairs",
"(",
"\"\"",
",",
"\"count\"",
",",
"options",
".",
"count",
")",
")",
";",
"localVarQueryParams",
".",
"addAll",
"(",
"apiClient",
".",
"parameterToPairs",
"(",
"\"\"",
",",
"\"dpi\"",
",",
"options",
".",
"dpi",
")",
")",
";",
"localVarQueryParams",
".",
"addAll",
"(",
"apiClient",
".",
"parameterToPairs",
"(",
"\"\"",
",",
"\"max_height\"",
",",
"options",
".",
"maxHeight",
")",
")",
";",
"localVarQueryParams",
".",
"addAll",
"(",
"apiClient",
".",
"parameterToPairs",
"(",
"\"\"",
",",
"\"max_width\"",
",",
"options",
".",
"maxWidth",
")",
")",
";",
"localVarQueryParams",
".",
"addAll",
"(",
"apiClient",
".",
"parameterToPairs",
"(",
"\"\"",
",",
"\"start_position\"",
",",
"options",
".",
"startPosition",
")",
")",
";",
"}",
"final",
"String",
"[",
"]",
"localVarAccepts",
"=",
"{",
"\"application/json\"",
"}",
";",
"final",
"String",
"localVarAccept",
"=",
"apiClient",
".",
"selectHeaderAccept",
"(",
"localVarAccepts",
")",
";",
"final",
"String",
"[",
"]",
"localVarContentTypes",
"=",
"{",
"}",
";",
"final",
"String",
"localVarContentType",
"=",
"apiClient",
".",
"selectHeaderContentType",
"(",
"localVarContentTypes",
")",
";",
"String",
"[",
"]",
"localVarAuthNames",
"=",
"new",
"String",
"[",
"]",
"{",
"\"docusignAccessCode\"",
"}",
";",
"//{ };",
"GenericType",
"<",
"PageImages",
">",
"localVarReturnType",
"=",
"new",
"GenericType",
"<",
"PageImages",
">",
"(",
")",
"{",
"}",
";",
"return",
"apiClient",
".",
"invokeAPI",
"(",
"localVarPath",
",",
"\"GET\"",
",",
"localVarQueryParams",
",",
"localVarPostBody",
",",
"localVarHeaderParams",
",",
"localVarFormParams",
",",
"localVarAccept",
",",
"localVarContentType",
",",
"localVarAuthNames",
",",
"localVarReturnType",
")",
";",
"}"
] | List File Pages
Retrieves a workspace file as rasterized pages.
@param accountId The external account number (int) or account ID Guid. (required)
@param workspaceId Specifies the workspace ID GUID. (required)
@param folderId The ID of the folder being accessed. (required)
@param fileId Specifies the room file ID GUID. (required)
@param options for modifying the method behavior.
@return PageImages
@throws ApiException if fails to make API call | [
"List",
"File",
"Pages",
"Retrieves",
"a",
"workspace",
"file",
"as",
"rasterized",
"pages",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/WorkspacesApi.java#L492-L550 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java | SlotManager.removeSlotRequestFromSlot | private void removeSlotRequestFromSlot(SlotID slotId, AllocationID allocationId) {
"""
Removes a pending slot request identified by the given allocation id from a slot identified
by the given slot id.
@param slotId identifying the slot
@param allocationId identifying the presumable assigned pending slot request
"""
TaskManagerSlot taskManagerSlot = slots.get(slotId);
if (null != taskManagerSlot) {
if (taskManagerSlot.getState() == TaskManagerSlot.State.PENDING && Objects.equals(allocationId, taskManagerSlot.getAssignedSlotRequest().getAllocationId())) {
TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.get(taskManagerSlot.getInstanceId());
if (taskManagerRegistration == null) {
throw new IllegalStateException("Trying to remove slot request from slot for which there is no TaskManager " + taskManagerSlot.getInstanceId() + " is registered.");
}
// clear the pending slot request
taskManagerSlot.clearPendingSlotRequest();
updateSlotState(taskManagerSlot, taskManagerRegistration, null, null);
} else {
LOG.debug("Ignore slot request removal for slot {}.", slotId);
}
} else {
LOG.debug("There was no slot with {} registered. Probably this slot has been already freed.", slotId);
}
} | java | private void removeSlotRequestFromSlot(SlotID slotId, AllocationID allocationId) {
TaskManagerSlot taskManagerSlot = slots.get(slotId);
if (null != taskManagerSlot) {
if (taskManagerSlot.getState() == TaskManagerSlot.State.PENDING && Objects.equals(allocationId, taskManagerSlot.getAssignedSlotRequest().getAllocationId())) {
TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.get(taskManagerSlot.getInstanceId());
if (taskManagerRegistration == null) {
throw new IllegalStateException("Trying to remove slot request from slot for which there is no TaskManager " + taskManagerSlot.getInstanceId() + " is registered.");
}
// clear the pending slot request
taskManagerSlot.clearPendingSlotRequest();
updateSlotState(taskManagerSlot, taskManagerRegistration, null, null);
} else {
LOG.debug("Ignore slot request removal for slot {}.", slotId);
}
} else {
LOG.debug("There was no slot with {} registered. Probably this slot has been already freed.", slotId);
}
} | [
"private",
"void",
"removeSlotRequestFromSlot",
"(",
"SlotID",
"slotId",
",",
"AllocationID",
"allocationId",
")",
"{",
"TaskManagerSlot",
"taskManagerSlot",
"=",
"slots",
".",
"get",
"(",
"slotId",
")",
";",
"if",
"(",
"null",
"!=",
"taskManagerSlot",
")",
"{",
"if",
"(",
"taskManagerSlot",
".",
"getState",
"(",
")",
"==",
"TaskManagerSlot",
".",
"State",
".",
"PENDING",
"&&",
"Objects",
".",
"equals",
"(",
"allocationId",
",",
"taskManagerSlot",
".",
"getAssignedSlotRequest",
"(",
")",
".",
"getAllocationId",
"(",
")",
")",
")",
"{",
"TaskManagerRegistration",
"taskManagerRegistration",
"=",
"taskManagerRegistrations",
".",
"get",
"(",
"taskManagerSlot",
".",
"getInstanceId",
"(",
")",
")",
";",
"if",
"(",
"taskManagerRegistration",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Trying to remove slot request from slot for which there is no TaskManager \"",
"+",
"taskManagerSlot",
".",
"getInstanceId",
"(",
")",
"+",
"\" is registered.\"",
")",
";",
"}",
"// clear the pending slot request",
"taskManagerSlot",
".",
"clearPendingSlotRequest",
"(",
")",
";",
"updateSlotState",
"(",
"taskManagerSlot",
",",
"taskManagerRegistration",
",",
"null",
",",
"null",
")",
";",
"}",
"else",
"{",
"LOG",
".",
"debug",
"(",
"\"Ignore slot request removal for slot {}.\"",
",",
"slotId",
")",
";",
"}",
"}",
"else",
"{",
"LOG",
".",
"debug",
"(",
"\"There was no slot with {} registered. Probably this slot has been already freed.\"",
",",
"slotId",
")",
";",
"}",
"}"
] | Removes a pending slot request identified by the given allocation id from a slot identified
by the given slot id.
@param slotId identifying the slot
@param allocationId identifying the presumable assigned pending slot request | [
"Removes",
"a",
"pending",
"slot",
"request",
"identified",
"by",
"the",
"given",
"allocation",
"id",
"from",
"a",
"slot",
"identified",
"by",
"the",
"given",
"slot",
"id",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L917-L939 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_output_graylog_stream_streamId_rule_POST | public OvhOperation serviceName_output_graylog_stream_streamId_rule_POST(String serviceName, String streamId, String field, Boolean isInverted, OvhStreamRuleOperatorEnum operator, String value) throws IOException {
"""
Register a new rule on specified graylog stream
REST: POST /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/rule
@param serviceName [required] Service name
@param streamId [required] Stream ID
@param value [required] Field value
@param field [required] Field name
@param operator [required] Field operator
@param isInverted [required] Invert condition
"""
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/rule";
StringBuilder sb = path(qPath, serviceName, streamId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "field", field);
addBody(o, "isInverted", isInverted);
addBody(o, "operator", operator);
addBody(o, "value", value);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | java | public OvhOperation serviceName_output_graylog_stream_streamId_rule_POST(String serviceName, String streamId, String field, Boolean isInverted, OvhStreamRuleOperatorEnum operator, String value) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/rule";
StringBuilder sb = path(qPath, serviceName, streamId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "field", field);
addBody(o, "isInverted", isInverted);
addBody(o, "operator", operator);
addBody(o, "value", value);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOperation.class);
} | [
"public",
"OvhOperation",
"serviceName_output_graylog_stream_streamId_rule_POST",
"(",
"String",
"serviceName",
",",
"String",
"streamId",
",",
"String",
"field",
",",
"Boolean",
"isInverted",
",",
"OvhStreamRuleOperatorEnum",
"operator",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/rule\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"streamId",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"field\"",
",",
"field",
")",
";",
"addBody",
"(",
"o",
",",
"\"isInverted\"",
",",
"isInverted",
")",
";",
"addBody",
"(",
"o",
",",
"\"operator\"",
",",
"operator",
")",
";",
"addBody",
"(",
"o",
",",
"\"value\"",
",",
"value",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOperation",
".",
"class",
")",
";",
"}"
] | Register a new rule on specified graylog stream
REST: POST /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/rule
@param serviceName [required] Service name
@param streamId [required] Stream ID
@param value [required] Field value
@param field [required] Field name
@param operator [required] Field operator
@param isInverted [required] Invert condition | [
"Register",
"a",
"new",
"rule",
"on",
"specified",
"graylog",
"stream"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1563-L1573 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java | PactDslJsonArray.arrayMinMaxLike | public static PactDslJsonArray arrayMinMaxLike(int minSize, int maxSize, PactDslJsonRootValue value) {
"""
Root level array with minimum and maximum size where each item must match the provided matcher
@param minSize minimum size
@param maxSize maximum size
"""
return arrayMinMaxLike(minSize, maxSize, minSize, value);
} | java | public static PactDslJsonArray arrayMinMaxLike(int minSize, int maxSize, PactDslJsonRootValue value) {
return arrayMinMaxLike(minSize, maxSize, minSize, value);
} | [
"public",
"static",
"PactDslJsonArray",
"arrayMinMaxLike",
"(",
"int",
"minSize",
",",
"int",
"maxSize",
",",
"PactDslJsonRootValue",
"value",
")",
"{",
"return",
"arrayMinMaxLike",
"(",
"minSize",
",",
"maxSize",
",",
"minSize",
",",
"value",
")",
";",
"}"
] | Root level array with minimum and maximum size where each item must match the provided matcher
@param minSize minimum size
@param maxSize maximum size | [
"Root",
"level",
"array",
"with",
"minimum",
"and",
"maximum",
"size",
"where",
"each",
"item",
"must",
"match",
"the",
"provided",
"matcher"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L897-L899 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java | FirewallRulesInner.listByServerAsync | public Observable<Page<FirewallRuleInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
"""
Gets a list of firewall rules.
@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.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FirewallRuleInner> object
"""
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() {
@Override
public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<FirewallRuleInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() {
@Override
public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"FirewallRuleInner",
">",
">",
"listByServerAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"FirewallRuleInner",
">",
">",
",",
"Page",
"<",
"FirewallRuleInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"FirewallRuleInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"FirewallRuleInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a list of firewall rules.
@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.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FirewallRuleInner> object | [
"Gets",
"a",
"list",
"of",
"firewall",
"rules",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java#L428-L436 |
apache/groovy | src/main/java/org/codehaus/groovy/vmplugin/v5/PluginDefaultGroovyMethods.java | PluginDefaultGroovyMethods.putAt | public static void putAt(StringBuilder self, IntRange range, Object value) {
"""
Support the range subscript operator for StringBuilder.
Index values are treated as characters within the builder.
@param self a StringBuilder
@param range a Range
@param value the object that's toString() will be inserted
"""
RangeInfo info = subListBorders(self.length(), range);
self.replace(info.from, info.to, value.toString());
} | java | public static void putAt(StringBuilder self, IntRange range, Object value) {
RangeInfo info = subListBorders(self.length(), range);
self.replace(info.from, info.to, value.toString());
} | [
"public",
"static",
"void",
"putAt",
"(",
"StringBuilder",
"self",
",",
"IntRange",
"range",
",",
"Object",
"value",
")",
"{",
"RangeInfo",
"info",
"=",
"subListBorders",
"(",
"self",
".",
"length",
"(",
")",
",",
"range",
")",
";",
"self",
".",
"replace",
"(",
"info",
".",
"from",
",",
"info",
".",
"to",
",",
"value",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Support the range subscript operator for StringBuilder.
Index values are treated as characters within the builder.
@param self a StringBuilder
@param range a Range
@param value the object that's toString() will be inserted | [
"Support",
"the",
"range",
"subscript",
"operator",
"for",
"StringBuilder",
".",
"Index",
"values",
"are",
"treated",
"as",
"characters",
"within",
"the",
"builder",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v5/PluginDefaultGroovyMethods.java#L118-L121 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/inline/InlineMediaSource.java | InlineMediaSource.getInlineAsset | private Asset getInlineAsset(Resource ntResourceResource, Media media, String fileName) {
"""
Get implementation of inline media item
@param ntResourceResource nt:resource node
@param media Media metadata
@param fileName File name
@return Inline media item instance
"""
return new InlineAsset(ntResourceResource, media, fileName, adaptable);
} | java | private Asset getInlineAsset(Resource ntResourceResource, Media media, String fileName) {
return new InlineAsset(ntResourceResource, media, fileName, adaptable);
} | [
"private",
"Asset",
"getInlineAsset",
"(",
"Resource",
"ntResourceResource",
",",
"Media",
"media",
",",
"String",
"fileName",
")",
"{",
"return",
"new",
"InlineAsset",
"(",
"ntResourceResource",
",",
"media",
",",
"fileName",
",",
"adaptable",
")",
";",
"}"
] | Get implementation of inline media item
@param ntResourceResource nt:resource node
@param media Media metadata
@param fileName File name
@return Inline media item instance | [
"Get",
"implementation",
"of",
"inline",
"media",
"item"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineMediaSource.java#L170-L172 |
jamesdbloom/mockserver | mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java | HttpResponse.withHeader | public HttpResponse withHeader(String name, String... values) {
"""
Add a header to return as a Header object, if a header with
the same name already exists this will NOT be modified but
two headers will exist
@param name the header name
@param values the header values
"""
this.headers.withEntry(name, values);
return this;
} | java | public HttpResponse withHeader(String name, String... values) {
this.headers.withEntry(name, values);
return this;
} | [
"public",
"HttpResponse",
"withHeader",
"(",
"String",
"name",
",",
"String",
"...",
"values",
")",
"{",
"this",
".",
"headers",
".",
"withEntry",
"(",
"name",
",",
"values",
")",
";",
"return",
"this",
";",
"}"
] | Add a header to return as a Header object, if a header with
the same name already exists this will NOT be modified but
two headers will exist
@param name the header name
@param values the header values | [
"Add",
"a",
"header",
"to",
"return",
"as",
"a",
"Header",
"object",
"if",
"a",
"header",
"with",
"the",
"same",
"name",
"already",
"exists",
"this",
"will",
"NOT",
"be",
"modified",
"but",
"two",
"headers",
"will",
"exist"
] | train | https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java#L222-L225 |
WhereIsMyTransport/TransportApiSdk.Java | transportapisdk/src/main/java/transportapisdk/TransportApiClient.java | TransportApiClient.getAgenciesNearby | public TransportApiResult<List<Agency>> getAgenciesNearby(AgencyQueryOptions options, double latitude, double longitude, int radiusInMeters) {
"""
Gets a list of agencies nearby ordered by distance from the point specified.
@param options Options to limit the results by. Default: AgencyQueryOptions.defaultQueryOptions()
@param latitude Latitude in decimal degrees.
@param longitude Longitude in decimal degrees.
@param radiusInMeters Radius in meters to filter results by.
@return A list of agencies nearby the specified point.
"""
if (options == null)
{
options = AgencyQueryOptions.defaultQueryOptions();
}
if (radiusInMeters < 0)
{
throw new IllegalArgumentException("Invalid limit. Valid values are positive numbers only.");
}
return TransportApiClientCalls.getAgencies(tokenComponent, settings, options, new Point(longitude, latitude), radiusInMeters, null);
} | java | public TransportApiResult<List<Agency>> getAgenciesNearby(AgencyQueryOptions options, double latitude, double longitude, int radiusInMeters)
{
if (options == null)
{
options = AgencyQueryOptions.defaultQueryOptions();
}
if (radiusInMeters < 0)
{
throw new IllegalArgumentException("Invalid limit. Valid values are positive numbers only.");
}
return TransportApiClientCalls.getAgencies(tokenComponent, settings, options, new Point(longitude, latitude), radiusInMeters, null);
} | [
"public",
"TransportApiResult",
"<",
"List",
"<",
"Agency",
">",
">",
"getAgenciesNearby",
"(",
"AgencyQueryOptions",
"options",
",",
"double",
"latitude",
",",
"double",
"longitude",
",",
"int",
"radiusInMeters",
")",
"{",
"if",
"(",
"options",
"==",
"null",
")",
"{",
"options",
"=",
"AgencyQueryOptions",
".",
"defaultQueryOptions",
"(",
")",
";",
"}",
"if",
"(",
"radiusInMeters",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid limit. Valid values are positive numbers only.\"",
")",
";",
"}",
"return",
"TransportApiClientCalls",
".",
"getAgencies",
"(",
"tokenComponent",
",",
"settings",
",",
"options",
",",
"new",
"Point",
"(",
"longitude",
",",
"latitude",
")",
",",
"radiusInMeters",
",",
"null",
")",
";",
"}"
] | Gets a list of agencies nearby ordered by distance from the point specified.
@param options Options to limit the results by. Default: AgencyQueryOptions.defaultQueryOptions()
@param latitude Latitude in decimal degrees.
@param longitude Longitude in decimal degrees.
@param radiusInMeters Radius in meters to filter results by.
@return A list of agencies nearby the specified point. | [
"Gets",
"a",
"list",
"of",
"agencies",
"nearby",
"ordered",
"by",
"distance",
"from",
"the",
"point",
"specified",
"."
] | train | https://github.com/WhereIsMyTransport/TransportApiSdk.Java/blob/f4ade7046c8dadfcb2976ee354f85f67a6e930a2/transportapisdk/src/main/java/transportapisdk/TransportApiClient.java#L109-L122 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/util/ParameterMapper.java | ParameterMapper.requestParamaterToObject | public static <T> T requestParamaterToObject(NativeWebRequest req, Class<T> c) {
"""
Request paramater to object t.
@param <T> the type parameter
@param req the req
@param c the c
@return the t
"""
return requestParamaterToObject((HttpServletRequest) req.getNativeRequest(), c, "UTF-8");
} | java | public static <T> T requestParamaterToObject(NativeWebRequest req, Class<T> c) {
return requestParamaterToObject((HttpServletRequest) req.getNativeRequest(), c, "UTF-8");
} | [
"public",
"static",
"<",
"T",
">",
"T",
"requestParamaterToObject",
"(",
"NativeWebRequest",
"req",
",",
"Class",
"<",
"T",
">",
"c",
")",
"{",
"return",
"requestParamaterToObject",
"(",
"(",
"HttpServletRequest",
")",
"req",
".",
"getNativeRequest",
"(",
")",
",",
"c",
",",
"\"UTF-8\"",
")",
";",
"}"
] | Request paramater to object t.
@param <T> the type parameter
@param req the req
@param c the c
@return the t | [
"Request",
"paramater",
"to",
"object",
"t",
"."
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ParameterMapper.java#L37-L39 |
medallia/Word2VecJava | src/main/java/com/medallia/word2vec/util/IO.java | IO.copyAndCloseBoth | public static int copyAndCloseBoth(Reader input, Writer output) throws IOException {
"""
Copy input to output and close both the input and output streams before returning
"""
try {
return copyAndCloseOutput(input, output);
} finally {
input.close();
}
} | java | public static int copyAndCloseBoth(Reader input, Writer output) throws IOException {
try {
return copyAndCloseOutput(input, output);
} finally {
input.close();
}
} | [
"public",
"static",
"int",
"copyAndCloseBoth",
"(",
"Reader",
"input",
",",
"Writer",
"output",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"copyAndCloseOutput",
"(",
"input",
",",
"output",
")",
";",
"}",
"finally",
"{",
"input",
".",
"close",
"(",
")",
";",
"}",
"}"
] | Copy input to output and close both the input and output streams before returning | [
"Copy",
"input",
"to",
"output",
"and",
"close",
"both",
"the",
"input",
"and",
"output",
"streams",
"before",
"returning"
] | train | https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/IO.java#L105-L111 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/storage/StorageFacade.java | StorageFacade.registerProvider | public static void registerProvider( String providerName, Class<? extends StorageProvider> providerClass ) {
"""
Register a new {@link StorageProvider}
@param providerName The name to use with the provider
@param providerClass The provider class
"""
if ( PROVIDERS.containsKey( providerName ) ) {
throw new IllegalArgumentException( "A provider already exists with the name " + providerName );
}
PROVIDERS.put( providerName, providerClass );
LOGGER.debug( "Registering new provider: {}", providerClass.getSimpleName() );
} | java | public static void registerProvider( String providerName, Class<? extends StorageProvider> providerClass )
{
if ( PROVIDERS.containsKey( providerName ) ) {
throw new IllegalArgumentException( "A provider already exists with the name " + providerName );
}
PROVIDERS.put( providerName, providerClass );
LOGGER.debug( "Registering new provider: {}", providerClass.getSimpleName() );
} | [
"public",
"static",
"void",
"registerProvider",
"(",
"String",
"providerName",
",",
"Class",
"<",
"?",
"extends",
"StorageProvider",
">",
"providerClass",
")",
"{",
"if",
"(",
"PROVIDERS",
".",
"containsKey",
"(",
"providerName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A provider already exists with the name \"",
"+",
"providerName",
")",
";",
"}",
"PROVIDERS",
".",
"put",
"(",
"providerName",
",",
"providerClass",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Registering new provider: {}\"",
",",
"providerClass",
".",
"getSimpleName",
"(",
")",
")",
";",
"}"
] | Register a new {@link StorageProvider}
@param providerName The name to use with the provider
@param providerClass The provider class | [
"Register",
"a",
"new",
"{",
"@link",
"StorageProvider",
"}"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/storage/StorageFacade.java#L63-L70 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/Matrix.java | Matrix.increment | public void increment(int i, int j, double value) {
"""
Alters the current matrix at index <i>(i,j)</i> to be equal to
<i>A<sub>i,j</sub> = A<sub>i,j</sub> + value</i>
@param i the row, starting from 0
@param j the column, starting from 0
@param value the value to add to the matrix coordinate
"""
if(Double.isNaN(value) || Double.isInfinite(value))
throw new ArithmeticException("Can not add a value " + value);
set(i, j, get(i, j)+value);
} | java | public void increment(int i, int j, double value)
{
if(Double.isNaN(value) || Double.isInfinite(value))
throw new ArithmeticException("Can not add a value " + value);
set(i, j, get(i, j)+value);
} | [
"public",
"void",
"increment",
"(",
"int",
"i",
",",
"int",
"j",
",",
"double",
"value",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"value",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"value",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"Can not add a value \"",
"+",
"value",
")",
";",
"set",
"(",
"i",
",",
"j",
",",
"get",
"(",
"i",
",",
"j",
")",
"+",
"value",
")",
";",
"}"
] | Alters the current matrix at index <i>(i,j)</i> to be equal to
<i>A<sub>i,j</sub> = A<sub>i,j</sub> + value</i>
@param i the row, starting from 0
@param j the column, starting from 0
@param value the value to add to the matrix coordinate | [
"Alters",
"the",
"current",
"matrix",
"at",
"index",
"<i",
">",
"(",
"i",
"j",
")",
"<",
"/",
"i",
">",
"to",
"be",
"equal",
"to",
"<i",
">",
"A<sub",
">",
"i",
"j<",
"/",
"sub",
">",
"=",
"A<sub",
">",
"i",
"j<",
"/",
"sub",
">",
"+",
"value<",
"/",
"i",
">"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L549-L554 |
apache/incubator-druid | server/src/main/java/org/apache/druid/initialization/Initialization.java | Initialization.getExtensionFilesToLoad | public static File[] getExtensionFilesToLoad(ExtensionsConfig config) {
"""
Find all the extension files that should be loaded by druid.
<p/>
If user explicitly specifies druid.extensions.loadList, then it will look for those extensions under root
extensions directory. If one of them is not found, druid will fail loudly.
<p/>
If user doesn't specify druid.extension.toLoad (or its value is empty), druid will load all the extensions
under the root extensions directory.
@param config ExtensionsConfig configured by druid.extensions.xxx
@return an array of druid extension files that will be loaded by druid process
"""
final File rootExtensionsDir = new File(config.getDirectory());
if (rootExtensionsDir.exists() && !rootExtensionsDir.isDirectory()) {
throw new ISE("Root extensions directory [%s] is not a directory!?", rootExtensionsDir);
}
File[] extensionsToLoad;
final LinkedHashSet<String> toLoad = config.getLoadList();
if (toLoad == null) {
extensionsToLoad = rootExtensionsDir.listFiles();
} else {
int i = 0;
extensionsToLoad = new File[toLoad.size()];
for (final String extensionName : toLoad) {
File extensionDir = new File(extensionName);
if (!extensionDir.isAbsolute()) {
extensionDir = new File(rootExtensionsDir, extensionName);
}
if (!extensionDir.isDirectory()) {
throw new ISE(
"Extension [%s] specified in \"druid.extensions.loadList\" didn't exist!?",
extensionDir.getAbsolutePath()
);
}
extensionsToLoad[i++] = extensionDir;
}
}
return extensionsToLoad == null ? new File[]{} : extensionsToLoad;
} | java | public static File[] getExtensionFilesToLoad(ExtensionsConfig config)
{
final File rootExtensionsDir = new File(config.getDirectory());
if (rootExtensionsDir.exists() && !rootExtensionsDir.isDirectory()) {
throw new ISE("Root extensions directory [%s] is not a directory!?", rootExtensionsDir);
}
File[] extensionsToLoad;
final LinkedHashSet<String> toLoad = config.getLoadList();
if (toLoad == null) {
extensionsToLoad = rootExtensionsDir.listFiles();
} else {
int i = 0;
extensionsToLoad = new File[toLoad.size()];
for (final String extensionName : toLoad) {
File extensionDir = new File(extensionName);
if (!extensionDir.isAbsolute()) {
extensionDir = new File(rootExtensionsDir, extensionName);
}
if (!extensionDir.isDirectory()) {
throw new ISE(
"Extension [%s] specified in \"druid.extensions.loadList\" didn't exist!?",
extensionDir.getAbsolutePath()
);
}
extensionsToLoad[i++] = extensionDir;
}
}
return extensionsToLoad == null ? new File[]{} : extensionsToLoad;
} | [
"public",
"static",
"File",
"[",
"]",
"getExtensionFilesToLoad",
"(",
"ExtensionsConfig",
"config",
")",
"{",
"final",
"File",
"rootExtensionsDir",
"=",
"new",
"File",
"(",
"config",
".",
"getDirectory",
"(",
")",
")",
";",
"if",
"(",
"rootExtensionsDir",
".",
"exists",
"(",
")",
"&&",
"!",
"rootExtensionsDir",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"ISE",
"(",
"\"Root extensions directory [%s] is not a directory!?\"",
",",
"rootExtensionsDir",
")",
";",
"}",
"File",
"[",
"]",
"extensionsToLoad",
";",
"final",
"LinkedHashSet",
"<",
"String",
">",
"toLoad",
"=",
"config",
".",
"getLoadList",
"(",
")",
";",
"if",
"(",
"toLoad",
"==",
"null",
")",
"{",
"extensionsToLoad",
"=",
"rootExtensionsDir",
".",
"listFiles",
"(",
")",
";",
"}",
"else",
"{",
"int",
"i",
"=",
"0",
";",
"extensionsToLoad",
"=",
"new",
"File",
"[",
"toLoad",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"final",
"String",
"extensionName",
":",
"toLoad",
")",
"{",
"File",
"extensionDir",
"=",
"new",
"File",
"(",
"extensionName",
")",
";",
"if",
"(",
"!",
"extensionDir",
".",
"isAbsolute",
"(",
")",
")",
"{",
"extensionDir",
"=",
"new",
"File",
"(",
"rootExtensionsDir",
",",
"extensionName",
")",
";",
"}",
"if",
"(",
"!",
"extensionDir",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"ISE",
"(",
"\"Extension [%s] specified in \\\"druid.extensions.loadList\\\" didn't exist!?\"",
",",
"extensionDir",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"extensionsToLoad",
"[",
"i",
"++",
"]",
"=",
"extensionDir",
";",
"}",
"}",
"return",
"extensionsToLoad",
"==",
"null",
"?",
"new",
"File",
"[",
"]",
"{",
"}",
":",
"extensionsToLoad",
";",
"}"
] | Find all the extension files that should be loaded by druid.
<p/>
If user explicitly specifies druid.extensions.loadList, then it will look for those extensions under root
extensions directory. If one of them is not found, druid will fail loudly.
<p/>
If user doesn't specify druid.extension.toLoad (or its value is empty), druid will load all the extensions
under the root extensions directory.
@param config ExtensionsConfig configured by druid.extensions.xxx
@return an array of druid extension files that will be loaded by druid process | [
"Find",
"all",
"the",
"extension",
"files",
"that",
"should",
"be",
"loaded",
"by",
"druid",
".",
"<p",
"/",
">",
"If",
"user",
"explicitly",
"specifies",
"druid",
".",
"extensions",
".",
"loadList",
"then",
"it",
"will",
"look",
"for",
"those",
"extensions",
"under",
"root",
"extensions",
"directory",
".",
"If",
"one",
"of",
"them",
"is",
"not",
"found",
"druid",
"will",
"fail",
"loudly",
".",
"<p",
"/",
">",
"If",
"user",
"doesn",
"t",
"specify",
"druid",
".",
"extension",
".",
"toLoad",
"(",
"or",
"its",
"value",
"is",
"empty",
")",
"druid",
"will",
"load",
"all",
"the",
"extensions",
"under",
"the",
"root",
"extensions",
"directory",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/initialization/Initialization.java#L225-L254 |
samskivert/pythagoras | src/main/java/pythagoras/d/Frustum.java | Frustum.setToFrustum | public Frustum setToFrustum (
double left, double right, double bottom, double top, double near, double far) {
"""
Sets this frustum to one pointing in the Z- direction with the specified parameters
determining its size and shape (see the OpenGL documentation for <code>glFrustum</code>).
@return a reference to this frustum, for chaining.
"""
return setToProjection(left, right, bottom, top, near, far, Vector3.UNIT_Z, false, false);
} | java | public Frustum setToFrustum (
double left, double right, double bottom, double top, double near, double far) {
return setToProjection(left, right, bottom, top, near, far, Vector3.UNIT_Z, false, false);
} | [
"public",
"Frustum",
"setToFrustum",
"(",
"double",
"left",
",",
"double",
"right",
",",
"double",
"bottom",
",",
"double",
"top",
",",
"double",
"near",
",",
"double",
"far",
")",
"{",
"return",
"setToProjection",
"(",
"left",
",",
"right",
",",
"bottom",
",",
"top",
",",
"near",
",",
"far",
",",
"Vector3",
".",
"UNIT_Z",
",",
"false",
",",
"false",
")",
";",
"}"
] | Sets this frustum to one pointing in the Z- direction with the specified parameters
determining its size and shape (see the OpenGL documentation for <code>glFrustum</code>).
@return a reference to this frustum, for chaining. | [
"Sets",
"this",
"frustum",
"to",
"one",
"pointing",
"in",
"the",
"Z",
"-",
"direction",
"with",
"the",
"specified",
"parameters",
"determining",
"its",
"size",
"and",
"shape",
"(",
"see",
"the",
"OpenGL",
"documentation",
"for",
"<code",
">",
"glFrustum<",
"/",
"code",
">",
")",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Frustum.java#L66-L69 |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLog.java | JdkLog.logIfEnabled | private void logIfEnabled(Level level, Throwable throwable, String format, Object[] arguments) {
"""
打印对应等级的日志
@param level 等级
@param throwable 异常对象
@param format 消息模板
@param arguments 参数
"""
this.logIfEnabled(FQCN_SELF, level, throwable, format, arguments);
} | java | private void logIfEnabled(Level level, Throwable throwable, String format, Object[] arguments){
this.logIfEnabled(FQCN_SELF, level, throwable, format, arguments);
} | [
"private",
"void",
"logIfEnabled",
"(",
"Level",
"level",
",",
"Throwable",
"throwable",
",",
"String",
"format",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"this",
".",
"logIfEnabled",
"(",
"FQCN_SELF",
",",
"level",
",",
"throwable",
",",
"format",
",",
"arguments",
")",
";",
"}"
] | 打印对应等级的日志
@param level 等级
@param throwable 异常对象
@param format 消息模板
@param arguments 参数 | [
"打印对应等级的日志"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLog.java#L167-L169 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/cdn/CdnClient.java | CdnClient.setRequestAuth | public SetRequestAuthResponse setRequestAuth(SetRequestAuthRequest request) {
"""
Set the request authentication.
@param request The request containing all of the options related to the update request.
@return Result of the setHTTPSAcceleration operation returned by the service.
"""
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest =
createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
internalRequest.addParameter("requestAuth", "");
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, SetRequestAuthResponse.class);
} | java | public SetRequestAuthResponse setRequestAuth(SetRequestAuthRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest =
createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
internalRequest.addParameter("requestAuth", "");
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, SetRequestAuthResponse.class);
} | [
"public",
"SetRequestAuthResponse",
"setRequestAuth",
"(",
"SetRequestAuthRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"request",
",",
"HttpMethodName",
".",
"PUT",
",",
"DOMAIN",
",",
"request",
".",
"getDomain",
"(",
")",
",",
"\"config\"",
")",
";",
"internalRequest",
".",
"addParameter",
"(",
"\"requestAuth\"",
",",
"\"\"",
")",
";",
"this",
".",
"attachRequestToBody",
"(",
"request",
",",
"internalRequest",
")",
";",
"return",
"invokeHttpClient",
"(",
"internalRequest",
",",
"SetRequestAuthResponse",
".",
"class",
")",
";",
"}"
] | Set the request authentication.
@param request The request containing all of the options related to the update request.
@return Result of the setHTTPSAcceleration operation returned by the service. | [
"Set",
"the",
"request",
"authentication",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L494-L501 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java | KeyUtil.readX509Certificate | public static Certificate readX509Certificate(InputStream in, char[] password, String alias) {
"""
读取X.509 Certification文件<br>
Certification为证书文件<br>
see: http://snowolf.iteye.com/blog/391931
@param in {@link InputStream} 如果想从文件读取.cer文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取
@param password 密码
@param alias 别名
@return {@link KeyStore}
@since 4.4.1
"""
return readCertificate(X509, in, password, alias);
} | java | public static Certificate readX509Certificate(InputStream in, char[] password, String alias) {
return readCertificate(X509, in, password, alias);
} | [
"public",
"static",
"Certificate",
"readX509Certificate",
"(",
"InputStream",
"in",
",",
"char",
"[",
"]",
"password",
",",
"String",
"alias",
")",
"{",
"return",
"readCertificate",
"(",
"X509",
",",
"in",
",",
"password",
",",
"alias",
")",
";",
"}"
] | 读取X.509 Certification文件<br>
Certification为证书文件<br>
see: http://snowolf.iteye.com/blog/391931
@param in {@link InputStream} 如果想从文件读取.cer文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取
@param password 密码
@param alias 别名
@return {@link KeyStore}
@since 4.4.1 | [
"读取X",
".",
"509",
"Certification文件<br",
">",
"Certification为证书文件<br",
">",
"see",
":",
"http",
":",
"//",
"snowolf",
".",
"iteye",
".",
"com",
"/",
"blog",
"/",
"391931"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L629-L631 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java | HttpRequest.handleRedirect | public boolean handleRedirect(int statusCode, HttpHeaders responseHeaders) {
"""
Sets up this request object to handle the necessary redirect if redirects are turned on, it is
a redirect status code and the header has a location.
<p>When the status code is {@code 303} the method on the request is changed to a GET as per the
RFC2616 specification. On a redirect, it also removes the {@code "Authorization"} and all
{@code "If-*"} request headers.
<p>Upgrade warning: When handling a status code of 303, {@link #handleRedirect(int,
HttpHeaders)} now correctly removes any content from the body of the new request, as GET
requests should not have content. It did not do this in prior version 1.16.
@return whether the redirect was successful
@since 1.11
"""
String redirectLocation = responseHeaders.getLocation();
if (getFollowRedirects()
&& HttpStatusCodes.isRedirect(statusCode)
&& redirectLocation != null) {
// resolve the redirect location relative to the current location
setUrl(new GenericUrl(url.toURL(redirectLocation)));
// on 303 change method to GET
if (statusCode == HttpStatusCodes.STATUS_CODE_SEE_OTHER) {
setRequestMethod(HttpMethods.GET);
// GET requests do not support non-zero content length
setContent(null);
}
// remove Authorization and If-* headers
headers.setAuthorization((String) null);
headers.setIfMatch((String) null);
headers.setIfNoneMatch((String) null);
headers.setIfModifiedSince((String) null);
headers.setIfUnmodifiedSince((String) null);
headers.setIfRange((String) null);
return true;
}
return false;
} | java | public boolean handleRedirect(int statusCode, HttpHeaders responseHeaders) {
String redirectLocation = responseHeaders.getLocation();
if (getFollowRedirects()
&& HttpStatusCodes.isRedirect(statusCode)
&& redirectLocation != null) {
// resolve the redirect location relative to the current location
setUrl(new GenericUrl(url.toURL(redirectLocation)));
// on 303 change method to GET
if (statusCode == HttpStatusCodes.STATUS_CODE_SEE_OTHER) {
setRequestMethod(HttpMethods.GET);
// GET requests do not support non-zero content length
setContent(null);
}
// remove Authorization and If-* headers
headers.setAuthorization((String) null);
headers.setIfMatch((String) null);
headers.setIfNoneMatch((String) null);
headers.setIfModifiedSince((String) null);
headers.setIfUnmodifiedSince((String) null);
headers.setIfRange((String) null);
return true;
}
return false;
} | [
"public",
"boolean",
"handleRedirect",
"(",
"int",
"statusCode",
",",
"HttpHeaders",
"responseHeaders",
")",
"{",
"String",
"redirectLocation",
"=",
"responseHeaders",
".",
"getLocation",
"(",
")",
";",
"if",
"(",
"getFollowRedirects",
"(",
")",
"&&",
"HttpStatusCodes",
".",
"isRedirect",
"(",
"statusCode",
")",
"&&",
"redirectLocation",
"!=",
"null",
")",
"{",
"// resolve the redirect location relative to the current location",
"setUrl",
"(",
"new",
"GenericUrl",
"(",
"url",
".",
"toURL",
"(",
"redirectLocation",
")",
")",
")",
";",
"// on 303 change method to GET",
"if",
"(",
"statusCode",
"==",
"HttpStatusCodes",
".",
"STATUS_CODE_SEE_OTHER",
")",
"{",
"setRequestMethod",
"(",
"HttpMethods",
".",
"GET",
")",
";",
"// GET requests do not support non-zero content length",
"setContent",
"(",
"null",
")",
";",
"}",
"// remove Authorization and If-* headers",
"headers",
".",
"setAuthorization",
"(",
"(",
"String",
")",
"null",
")",
";",
"headers",
".",
"setIfMatch",
"(",
"(",
"String",
")",
"null",
")",
";",
"headers",
".",
"setIfNoneMatch",
"(",
"(",
"String",
")",
"null",
")",
";",
"headers",
".",
"setIfModifiedSince",
"(",
"(",
"String",
")",
"null",
")",
";",
"headers",
".",
"setIfUnmodifiedSince",
"(",
"(",
"String",
")",
"null",
")",
";",
"headers",
".",
"setIfRange",
"(",
"(",
"String",
")",
"null",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Sets up this request object to handle the necessary redirect if redirects are turned on, it is
a redirect status code and the header has a location.
<p>When the status code is {@code 303} the method on the request is changed to a GET as per the
RFC2616 specification. On a redirect, it also removes the {@code "Authorization"} and all
{@code "If-*"} request headers.
<p>Upgrade warning: When handling a status code of 303, {@link #handleRedirect(int,
HttpHeaders)} now correctly removes any content from the body of the new request, as GET
requests should not have content. It did not do this in prior version 1.16.
@return whether the redirect was successful
@since 1.11 | [
"Sets",
"up",
"this",
"request",
"object",
"to",
"handle",
"the",
"necessary",
"redirect",
"if",
"redirects",
"are",
"turned",
"on",
"it",
"is",
"a",
"redirect",
"status",
"code",
"and",
"the",
"header",
"has",
"a",
"location",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java#L1153-L1176 |
JadiraOrg/jadira | bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java | BasicBinder.findBinding | public <S, T> Binding<S, T> findBinding(Class<S> source, Class<T> target) {
"""
Resolve a Binding with the given source and target class.
A binding unifies a marshaller and an unmarshaller and both must be available to resolve a binding.
The source class is considered the owning class of the binding. The source can be marshalled
into the target class. Similarly, the target can be unmarshalled to produce an instance of the source type.
@param source The source (owning) class
@param target The target (foreign) class
"""
return findBinding(new ConverterKey<S,T>(source, target, DefaultBinding.class));
} | java | public <S, T> Binding<S, T> findBinding(Class<S> source, Class<T> target) {
return findBinding(new ConverterKey<S,T>(source, target, DefaultBinding.class));
} | [
"public",
"<",
"S",
",",
"T",
">",
"Binding",
"<",
"S",
",",
"T",
">",
"findBinding",
"(",
"Class",
"<",
"S",
">",
"source",
",",
"Class",
"<",
"T",
">",
"target",
")",
"{",
"return",
"findBinding",
"(",
"new",
"ConverterKey",
"<",
"S",
",",
"T",
">",
"(",
"source",
",",
"target",
",",
"DefaultBinding",
".",
"class",
")",
")",
";",
"}"
] | Resolve a Binding with the given source and target class.
A binding unifies a marshaller and an unmarshaller and both must be available to resolve a binding.
The source class is considered the owning class of the binding. The source can be marshalled
into the target class. Similarly, the target can be unmarshalled to produce an instance of the source type.
@param source The source (owning) class
@param target The target (foreign) class | [
"Resolve",
"a",
"Binding",
"with",
"the",
"given",
"source",
"and",
"target",
"class",
".",
"A",
"binding",
"unifies",
"a",
"marshaller",
"and",
"an",
"unmarshaller",
"and",
"both",
"must",
"be",
"available",
"to",
"resolve",
"a",
"binding",
"."
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L847-L849 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/CMSOption.java | CMSOption.getValue | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
"""
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
"""
/*
* Calculate value of the swap at exercise date on each path (beware of perfect forsight - all rates are simulationTime=exerciseDate)
*/
RandomVariable valueFixLeg = new RandomVariableFromDoubleArray(fixingDates[fixingDates.length-1], 0.0);
RandomVariable valueFloatLeg = new RandomVariableFromDoubleArray(paymentDates[paymentDates.length-1], -1.0);
// Calculate the value of the swap by working backward through all periods
for(int period=fixingDates.length-1; period>=0; period--)
{
double fixingDate = fixingDates[period];
double paymentDate = paymentDates[period];
double periodLength = periodLengths != null ? periodLengths[period] : paymentDate - fixingDate;
// Get random variables - note that this is the rate at simulation time = exerciseDate
RandomVariable libor = model.getLIBOR(exerciseDate, fixingDate, paymentDate);
// Add payment received at end of period
RandomVariable payoff = new RandomVariableFromDoubleArray(paymentDate, 1.0 * periodLength);
valueFixLeg = valueFixLeg.add(payoff);
// Discount back to beginning of period
valueFloatLeg = valueFloatLeg.discount(libor, periodLength);
valueFixLeg = valueFixLeg.discount(libor, periodLength);
}
valueFloatLeg = valueFloatLeg.add(1.0);
RandomVariable parSwapRate = valueFloatLeg.div(valueFixLeg);
RandomVariable payoffUnit = new RandomVariableFromDoubleArray(paymentDates[0], periodLengths[0]);
payoffUnit = payoffUnit.discount(model.getLIBOR(exerciseDate, fixingDates[0], paymentDates[0]),paymentDates[0]-fixingDates[0]);
RandomVariable value = parSwapRate.sub(strike).floor(0.0).mult(payoffUnit);
// If the exercise date is not the first periods start date, then discount back to the exercise date (calculate the forward starting swap)
if(fixingDates[0] != exerciseDate) {
RandomVariable libor = model.getLIBOR(exerciseDate, exerciseDate, fixingDates[0]);
double periodLength = fixingDates[0] - exerciseDate;
// Discount back to beginning of period
value = value.discount(libor, periodLength);
}
/*
* Calculate value
*/
RandomVariable numeraire = model.getNumeraire(exerciseDate);
RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(model.getTimeIndex(exerciseDate));
value = value.div(numeraire).mult(monteCarloProbabilities);
RandomVariable numeraireAtZero = model.getNumeraire(evaluationTime);
RandomVariable monteCarloProbabilitiesAtZero = model.getMonteCarloWeights(evaluationTime);
value = value.mult(numeraireAtZero).div(monteCarloProbabilitiesAtZero);
return value;
} | java | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
/*
* Calculate value of the swap at exercise date on each path (beware of perfect forsight - all rates are simulationTime=exerciseDate)
*/
RandomVariable valueFixLeg = new RandomVariableFromDoubleArray(fixingDates[fixingDates.length-1], 0.0);
RandomVariable valueFloatLeg = new RandomVariableFromDoubleArray(paymentDates[paymentDates.length-1], -1.0);
// Calculate the value of the swap by working backward through all periods
for(int period=fixingDates.length-1; period>=0; period--)
{
double fixingDate = fixingDates[period];
double paymentDate = paymentDates[period];
double periodLength = periodLengths != null ? periodLengths[period] : paymentDate - fixingDate;
// Get random variables - note that this is the rate at simulation time = exerciseDate
RandomVariable libor = model.getLIBOR(exerciseDate, fixingDate, paymentDate);
// Add payment received at end of period
RandomVariable payoff = new RandomVariableFromDoubleArray(paymentDate, 1.0 * periodLength);
valueFixLeg = valueFixLeg.add(payoff);
// Discount back to beginning of period
valueFloatLeg = valueFloatLeg.discount(libor, periodLength);
valueFixLeg = valueFixLeg.discount(libor, periodLength);
}
valueFloatLeg = valueFloatLeg.add(1.0);
RandomVariable parSwapRate = valueFloatLeg.div(valueFixLeg);
RandomVariable payoffUnit = new RandomVariableFromDoubleArray(paymentDates[0], periodLengths[0]);
payoffUnit = payoffUnit.discount(model.getLIBOR(exerciseDate, fixingDates[0], paymentDates[0]),paymentDates[0]-fixingDates[0]);
RandomVariable value = parSwapRate.sub(strike).floor(0.0).mult(payoffUnit);
// If the exercise date is not the first periods start date, then discount back to the exercise date (calculate the forward starting swap)
if(fixingDates[0] != exerciseDate) {
RandomVariable libor = model.getLIBOR(exerciseDate, exerciseDate, fixingDates[0]);
double periodLength = fixingDates[0] - exerciseDate;
// Discount back to beginning of period
value = value.discount(libor, periodLength);
}
/*
* Calculate value
*/
RandomVariable numeraire = model.getNumeraire(exerciseDate);
RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(model.getTimeIndex(exerciseDate));
value = value.div(numeraire).mult(monteCarloProbabilities);
RandomVariable numeraireAtZero = model.getNumeraire(evaluationTime);
RandomVariable monteCarloProbabilitiesAtZero = model.getMonteCarloWeights(evaluationTime);
value = value.mult(numeraireAtZero).div(monteCarloProbabilitiesAtZero);
return value;
} | [
"@",
"Override",
"public",
"RandomVariable",
"getValue",
"(",
"double",
"evaluationTime",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
")",
"throws",
"CalculationException",
"{",
"/*\n\t\t * Calculate value of the swap at exercise date on each path (beware of perfect forsight - all rates are simulationTime=exerciseDate)\n\t\t */",
"RandomVariable",
"valueFixLeg",
"=",
"new",
"RandomVariableFromDoubleArray",
"(",
"fixingDates",
"[",
"fixingDates",
".",
"length",
"-",
"1",
"]",
",",
"0.0",
")",
";",
"RandomVariable",
"valueFloatLeg",
"=",
"new",
"RandomVariableFromDoubleArray",
"(",
"paymentDates",
"[",
"paymentDates",
".",
"length",
"-",
"1",
"]",
",",
"-",
"1.0",
")",
";",
"// Calculate the value of the swap by working backward through all periods",
"for",
"(",
"int",
"period",
"=",
"fixingDates",
".",
"length",
"-",
"1",
";",
"period",
">=",
"0",
";",
"period",
"--",
")",
"{",
"double",
"fixingDate",
"=",
"fixingDates",
"[",
"period",
"]",
";",
"double",
"paymentDate",
"=",
"paymentDates",
"[",
"period",
"]",
";",
"double",
"periodLength",
"=",
"periodLengths",
"!=",
"null",
"?",
"periodLengths",
"[",
"period",
"]",
":",
"paymentDate",
"-",
"fixingDate",
";",
"// Get random variables - note that this is the rate at simulation time = exerciseDate",
"RandomVariable",
"libor",
"=",
"model",
".",
"getLIBOR",
"(",
"exerciseDate",
",",
"fixingDate",
",",
"paymentDate",
")",
";",
"// Add payment received at end of period",
"RandomVariable",
"payoff",
"=",
"new",
"RandomVariableFromDoubleArray",
"(",
"paymentDate",
",",
"1.0",
"*",
"periodLength",
")",
";",
"valueFixLeg",
"=",
"valueFixLeg",
".",
"add",
"(",
"payoff",
")",
";",
"// Discount back to beginning of period",
"valueFloatLeg",
"=",
"valueFloatLeg",
".",
"discount",
"(",
"libor",
",",
"periodLength",
")",
";",
"valueFixLeg",
"=",
"valueFixLeg",
".",
"discount",
"(",
"libor",
",",
"periodLength",
")",
";",
"}",
"valueFloatLeg",
"=",
"valueFloatLeg",
".",
"add",
"(",
"1.0",
")",
";",
"RandomVariable",
"parSwapRate",
"=",
"valueFloatLeg",
".",
"div",
"(",
"valueFixLeg",
")",
";",
"RandomVariable",
"payoffUnit",
"=",
"new",
"RandomVariableFromDoubleArray",
"(",
"paymentDates",
"[",
"0",
"]",
",",
"periodLengths",
"[",
"0",
"]",
")",
";",
"payoffUnit",
"=",
"payoffUnit",
".",
"discount",
"(",
"model",
".",
"getLIBOR",
"(",
"exerciseDate",
",",
"fixingDates",
"[",
"0",
"]",
",",
"paymentDates",
"[",
"0",
"]",
")",
",",
"paymentDates",
"[",
"0",
"]",
"-",
"fixingDates",
"[",
"0",
"]",
")",
";",
"RandomVariable",
"value",
"=",
"parSwapRate",
".",
"sub",
"(",
"strike",
")",
".",
"floor",
"(",
"0.0",
")",
".",
"mult",
"(",
"payoffUnit",
")",
";",
"// If the exercise date is not the first periods start date, then discount back to the exercise date (calculate the forward starting swap)",
"if",
"(",
"fixingDates",
"[",
"0",
"]",
"!=",
"exerciseDate",
")",
"{",
"RandomVariable",
"libor",
"=",
"model",
".",
"getLIBOR",
"(",
"exerciseDate",
",",
"exerciseDate",
",",
"fixingDates",
"[",
"0",
"]",
")",
";",
"double",
"periodLength",
"=",
"fixingDates",
"[",
"0",
"]",
"-",
"exerciseDate",
";",
"// Discount back to beginning of period",
"value",
"=",
"value",
".",
"discount",
"(",
"libor",
",",
"periodLength",
")",
";",
"}",
"/*\n\t\t * Calculate value\n\t\t */",
"RandomVariable",
"numeraire",
"=",
"model",
".",
"getNumeraire",
"(",
"exerciseDate",
")",
";",
"RandomVariable",
"monteCarloProbabilities",
"=",
"model",
".",
"getMonteCarloWeights",
"(",
"model",
".",
"getTimeIndex",
"(",
"exerciseDate",
")",
")",
";",
"value",
"=",
"value",
".",
"div",
"(",
"numeraire",
")",
".",
"mult",
"(",
"monteCarloProbabilities",
")",
";",
"RandomVariable",
"numeraireAtZero",
"=",
"model",
".",
"getNumeraire",
"(",
"evaluationTime",
")",
";",
"RandomVariable",
"monteCarloProbabilitiesAtZero",
"=",
"model",
".",
"getMonteCarloWeights",
"(",
"evaluationTime",
")",
";",
"value",
"=",
"value",
".",
"mult",
"(",
"numeraireAtZero",
")",
".",
"div",
"(",
"monteCarloProbabilitiesAtZero",
")",
";",
"return",
"value",
";",
"}"
] | This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"This",
"method",
"returns",
"the",
"value",
"random",
"variable",
"of",
"the",
"product",
"within",
"the",
"specified",
"model",
"evaluated",
"at",
"a",
"given",
"evalutationTime",
".",
"Note",
":",
"For",
"a",
"lattice",
"this",
"is",
"often",
"the",
"value",
"conditional",
"to",
"evalutationTime",
"for",
"a",
"Monte",
"-",
"Carlo",
"simulation",
"this",
"is",
"the",
"(",
"sum",
"of",
")",
"value",
"discounted",
"to",
"evaluation",
"time",
".",
"Cashflows",
"prior",
"evaluationTime",
"are",
"not",
"considered",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/CMSOption.java#L65-L122 |
google/closure-templates | java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java | PyExprUtils.convertMapToOrderedDict | public static PyExpr convertMapToOrderedDict(Map<PyExpr, PyExpr> dict) {
"""
Convert a java Map to valid PyExpr as dict.
@param dict A Map to be converted to PyExpr as a dictionary, both key and value should be
PyExpr.
"""
List<String> values = new ArrayList<>();
for (Map.Entry<PyExpr, PyExpr> entry : dict.entrySet()) {
values.add("(" + entry.getKey().getText() + ", " + entry.getValue().getText() + ")");
}
Joiner joiner = Joiner.on(", ");
return new PyExpr("collections.OrderedDict([" + joiner.join(values) + "])", Integer.MAX_VALUE);
} | java | public static PyExpr convertMapToOrderedDict(Map<PyExpr, PyExpr> dict) {
List<String> values = new ArrayList<>();
for (Map.Entry<PyExpr, PyExpr> entry : dict.entrySet()) {
values.add("(" + entry.getKey().getText() + ", " + entry.getValue().getText() + ")");
}
Joiner joiner = Joiner.on(", ");
return new PyExpr("collections.OrderedDict([" + joiner.join(values) + "])", Integer.MAX_VALUE);
} | [
"public",
"static",
"PyExpr",
"convertMapToOrderedDict",
"(",
"Map",
"<",
"PyExpr",
",",
"PyExpr",
">",
"dict",
")",
"{",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"PyExpr",
",",
"PyExpr",
">",
"entry",
":",
"dict",
".",
"entrySet",
"(",
")",
")",
"{",
"values",
".",
"add",
"(",
"\"(\"",
"+",
"entry",
".",
"getKey",
"(",
")",
".",
"getText",
"(",
")",
"+",
"\", \"",
"+",
"entry",
".",
"getValue",
"(",
")",
".",
"getText",
"(",
")",
"+",
"\")\"",
")",
";",
"}",
"Joiner",
"joiner",
"=",
"Joiner",
".",
"on",
"(",
"\", \"",
")",
";",
"return",
"new",
"PyExpr",
"(",
"\"collections.OrderedDict([\"",
"+",
"joiner",
".",
"join",
"(",
"values",
")",
"+",
"\"])\"",
",",
"Integer",
".",
"MAX_VALUE",
")",
";",
"}"
] | Convert a java Map to valid PyExpr as dict.
@param dict A Map to be converted to PyExpr as a dictionary, both key and value should be
PyExpr. | [
"Convert",
"a",
"java",
"Map",
"to",
"valid",
"PyExpr",
"as",
"dict",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java#L222-L231 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Image.java | Image.scalePercent | public void scalePercent(float percentX, float percentY) {
"""
Scale the width and height of an image to a certain percentage.
@param percentX
the scaling percentage of the width
@param percentY
the scaling percentage of the height
"""
plainWidth = (getWidth() * percentX) / 100f;
plainHeight = (getHeight() * percentY) / 100f;
float[] matrix = matrix();
scaledWidth = matrix[DX] - matrix[CX];
scaledHeight = matrix[DY] - matrix[CY];
setWidthPercentage(0);
} | java | public void scalePercent(float percentX, float percentY) {
plainWidth = (getWidth() * percentX) / 100f;
plainHeight = (getHeight() * percentY) / 100f;
float[] matrix = matrix();
scaledWidth = matrix[DX] - matrix[CX];
scaledHeight = matrix[DY] - matrix[CY];
setWidthPercentage(0);
} | [
"public",
"void",
"scalePercent",
"(",
"float",
"percentX",
",",
"float",
"percentY",
")",
"{",
"plainWidth",
"=",
"(",
"getWidth",
"(",
")",
"*",
"percentX",
")",
"/",
"100f",
";",
"plainHeight",
"=",
"(",
"getHeight",
"(",
")",
"*",
"percentY",
")",
"/",
"100f",
";",
"float",
"[",
"]",
"matrix",
"=",
"matrix",
"(",
")",
";",
"scaledWidth",
"=",
"matrix",
"[",
"DX",
"]",
"-",
"matrix",
"[",
"CX",
"]",
";",
"scaledHeight",
"=",
"matrix",
"[",
"DY",
"]",
"-",
"matrix",
"[",
"CY",
"]",
";",
"setWidthPercentage",
"(",
"0",
")",
";",
"}"
] | Scale the width and height of an image to a certain percentage.
@param percentX
the scaling percentage of the width
@param percentY
the scaling percentage of the height | [
"Scale",
"the",
"width",
"and",
"height",
"of",
"an",
"image",
"to",
"a",
"certain",
"percentage",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Image.java#L1296-L1303 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryRunner.java | QueryRunner.runPartitionScanQueryOnPartitionChunk | public ResultSegment runPartitionScanQueryOnPartitionChunk(Query query, int partitionId, int tableIndex, int fetchSize) {
"""
Runs a query on a chunk of a single partition. The chunk is defined by the offset {@code tableIndex}
and the soft limit {@code fetchSize}.
@param query the query
@param partitionId the partition which is queried
@param tableIndex the index at which to start querying
@param fetchSize the soft limit for the number of items to be queried
@return the queried entries along with the next {@code tableIndex} to resume querying
"""
MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName());
Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId));
QueryableEntriesSegment entries = partitionScanExecutor
.execute(query.getMapName(), predicate, partitionId, tableIndex, fetchSize);
ResultProcessor processor = resultProcessorRegistry.get(query.getResultType());
Result result = processor.populateResult(query, Long.MAX_VALUE, entries.getEntries(),
singletonPartitionIdSet(partitionCount, partitionId));
return new ResultSegment(result, entries.getNextTableIndexToReadFrom());
} | java | public ResultSegment runPartitionScanQueryOnPartitionChunk(Query query, int partitionId, int tableIndex, int fetchSize) {
MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName());
Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId));
QueryableEntriesSegment entries = partitionScanExecutor
.execute(query.getMapName(), predicate, partitionId, tableIndex, fetchSize);
ResultProcessor processor = resultProcessorRegistry.get(query.getResultType());
Result result = processor.populateResult(query, Long.MAX_VALUE, entries.getEntries(),
singletonPartitionIdSet(partitionCount, partitionId));
return new ResultSegment(result, entries.getNextTableIndexToReadFrom());
} | [
"public",
"ResultSegment",
"runPartitionScanQueryOnPartitionChunk",
"(",
"Query",
"query",
",",
"int",
"partitionId",
",",
"int",
"tableIndex",
",",
"int",
"fetchSize",
")",
"{",
"MapContainer",
"mapContainer",
"=",
"mapServiceContext",
".",
"getMapContainer",
"(",
"query",
".",
"getMapName",
"(",
")",
")",
";",
"Predicate",
"predicate",
"=",
"queryOptimizer",
".",
"optimize",
"(",
"query",
".",
"getPredicate",
"(",
")",
",",
"mapContainer",
".",
"getIndexes",
"(",
"partitionId",
")",
")",
";",
"QueryableEntriesSegment",
"entries",
"=",
"partitionScanExecutor",
".",
"execute",
"(",
"query",
".",
"getMapName",
"(",
")",
",",
"predicate",
",",
"partitionId",
",",
"tableIndex",
",",
"fetchSize",
")",
";",
"ResultProcessor",
"processor",
"=",
"resultProcessorRegistry",
".",
"get",
"(",
"query",
".",
"getResultType",
"(",
")",
")",
";",
"Result",
"result",
"=",
"processor",
".",
"populateResult",
"(",
"query",
",",
"Long",
".",
"MAX_VALUE",
",",
"entries",
".",
"getEntries",
"(",
")",
",",
"singletonPartitionIdSet",
"(",
"partitionCount",
",",
"partitionId",
")",
")",
";",
"return",
"new",
"ResultSegment",
"(",
"result",
",",
"entries",
".",
"getNextTableIndexToReadFrom",
"(",
")",
")",
";",
"}"
] | Runs a query on a chunk of a single partition. The chunk is defined by the offset {@code tableIndex}
and the soft limit {@code fetchSize}.
@param query the query
@param partitionId the partition which is queried
@param tableIndex the index at which to start querying
@param fetchSize the soft limit for the number of items to be queried
@return the queried entries along with the next {@code tableIndex} to resume querying | [
"Runs",
"a",
"query",
"on",
"a",
"chunk",
"of",
"a",
"single",
"partition",
".",
"The",
"chunk",
"is",
"defined",
"by",
"the",
"offset",
"{",
"@code",
"tableIndex",
"}",
"and",
"the",
"soft",
"limit",
"{",
"@code",
"fetchSize",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryRunner.java#L88-L99 |
threerings/nenya | core/src/main/java/com/threerings/media/tile/Tile.java | Tile.paint | public void paint (Graphics2D gfx, int x, int y) {
"""
Render the tile image at the specified position in the given
graphics context.
"""
_mirage.paint(gfx, x, y);
} | java | public void paint (Graphics2D gfx, int x, int y)
{
_mirage.paint(gfx, x, y);
} | [
"public",
"void",
"paint",
"(",
"Graphics2D",
"gfx",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"_mirage",
".",
"paint",
"(",
"gfx",
",",
"x",
",",
"y",
")",
";",
"}"
] | Render the tile image at the specified position in the given
graphics context. | [
"Render",
"the",
"tile",
"image",
"at",
"the",
"specified",
"position",
"in",
"the",
"given",
"graphics",
"context",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/Tile.java#L119-L122 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionPartitionsInner.java | CollectionPartitionsInner.listMetricsAsync | public Observable<List<PartitionMetricInner>> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) {
"""
Retrieves the metrics determined by the given filter for the given collection, split by partition.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param databaseRid Cosmos DB database rid.
@param collectionRid Cosmos DB collection rid.
@param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<PartitionMetricInner> object
"""
return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1<ServiceResponse<List<PartitionMetricInner>>, List<PartitionMetricInner>>() {
@Override
public List<PartitionMetricInner> call(ServiceResponse<List<PartitionMetricInner>> response) {
return response.body();
}
});
} | java | public Observable<List<PartitionMetricInner>> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) {
return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1<ServiceResponse<List<PartitionMetricInner>>, List<PartitionMetricInner>>() {
@Override
public List<PartitionMetricInner> call(ServiceResponse<List<PartitionMetricInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"PartitionMetricInner",
">",
">",
"listMetricsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"databaseRid",
",",
"String",
"collectionRid",
",",
"String",
"filter",
")",
"{",
"return",
"listMetricsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"databaseRid",
",",
"collectionRid",
",",
"filter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"List",
"<",
"PartitionMetricInner",
">",
">",
",",
"List",
"<",
"PartitionMetricInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"PartitionMetricInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"List",
"<",
"PartitionMetricInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Retrieves the metrics determined by the given filter for the given collection, split by partition.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param databaseRid Cosmos DB database rid.
@param collectionRid Cosmos DB collection rid.
@param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<PartitionMetricInner> object | [
"Retrieves",
"the",
"metrics",
"determined",
"by",
"the",
"given",
"filter",
"for",
"the",
"given",
"collection",
"split",
"by",
"partition",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionPartitionsInner.java#L109-L116 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java | GVRPose.getLocalRotation | public void getLocalRotation(int boneindex, Quaternionf q) {
"""
Gets the local rotation for a bone given its index.
@param boneindex zero based index of bone whose rotation is wanted.
@return local rotation for the designated bone as a quaternion.
@see #setLocalRotation
@see #setWorldRotations
@see #setWorldMatrix
@see GVRSkeleton#setBoneAxis
"""
Bone bone = mBones[boneindex];
if ((bone.Changed & (WORLD_POS | WORLD_ROT)) != 0)
{
calcLocal(bone, mSkeleton.getParentBoneIndex(boneindex));
}
bone.LocalMatrix.getUnnormalizedRotation(q);
q.normalize();
} | java | public void getLocalRotation(int boneindex, Quaternionf q)
{
Bone bone = mBones[boneindex];
if ((bone.Changed & (WORLD_POS | WORLD_ROT)) != 0)
{
calcLocal(bone, mSkeleton.getParentBoneIndex(boneindex));
}
bone.LocalMatrix.getUnnormalizedRotation(q);
q.normalize();
} | [
"public",
"void",
"getLocalRotation",
"(",
"int",
"boneindex",
",",
"Quaternionf",
"q",
")",
"{",
"Bone",
"bone",
"=",
"mBones",
"[",
"boneindex",
"]",
";",
"if",
"(",
"(",
"bone",
".",
"Changed",
"&",
"(",
"WORLD_POS",
"|",
"WORLD_ROT",
")",
")",
"!=",
"0",
")",
"{",
"calcLocal",
"(",
"bone",
",",
"mSkeleton",
".",
"getParentBoneIndex",
"(",
"boneindex",
")",
")",
";",
"}",
"bone",
".",
"LocalMatrix",
".",
"getUnnormalizedRotation",
"(",
"q",
")",
";",
"q",
".",
"normalize",
"(",
")",
";",
"}"
] | Gets the local rotation for a bone given its index.
@param boneindex zero based index of bone whose rotation is wanted.
@return local rotation for the designated bone as a quaternion.
@see #setLocalRotation
@see #setWorldRotations
@see #setWorldMatrix
@see GVRSkeleton#setBoneAxis | [
"Gets",
"the",
"local",
"rotation",
"for",
"a",
"bone",
"given",
"its",
"index",
".",
"@param",
"boneindex",
"zero",
"based",
"index",
"of",
"bone",
"whose",
"rotation",
"is",
"wanted",
".",
"@return",
"local",
"rotation",
"for",
"the",
"designated",
"bone",
"as",
"a",
"quaternion",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L588-L598 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/process/Morphology.java | Morphology.stemStatic | public static WordTag stemStatic(String word, String tag) {
"""
Return a new WordTag which has the lemma as the value of word().
The default is to lowercase non-proper-nouns, unless options have
been set.
"""
initStaticLexer();
return new WordTag(lemmatize(word, tag, staticLexer, staticLexer.option(1)), tag);
} | java | public static WordTag stemStatic(String word, String tag) {
initStaticLexer();
return new WordTag(lemmatize(word, tag, staticLexer, staticLexer.option(1)), tag);
} | [
"public",
"static",
"WordTag",
"stemStatic",
"(",
"String",
"word",
",",
"String",
"tag",
")",
"{",
"initStaticLexer",
"(",
")",
";",
"return",
"new",
"WordTag",
"(",
"lemmatize",
"(",
"word",
",",
"tag",
",",
"staticLexer",
",",
"staticLexer",
".",
"option",
"(",
"1",
")",
")",
",",
"tag",
")",
";",
"}"
] | Return a new WordTag which has the lemma as the value of word().
The default is to lowercase non-proper-nouns, unless options have
been set. | [
"Return",
"a",
"new",
"WordTag",
"which",
"has",
"the",
"lemma",
"as",
"the",
"value",
"of",
"word",
"()",
".",
"The",
"default",
"is",
"to",
"lowercase",
"non",
"-",
"proper",
"-",
"nouns",
"unless",
"options",
"have",
"been",
"set",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/process/Morphology.java#L178-L181 |
Erudika/para | para-client/src/main/java/com/erudika/para/client/ParaClient.java | ParaClient.stripAndTrim | public String stripAndTrim(String str) {
"""
Strips all symbols, punctuation, whitespace and control chars from a string.
@param str a dirty string
@return a clean string
"""
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("string", str);
return getEntity(invokeGet("utils/nosymbols", params), String.class);
} | java | public String stripAndTrim(String str) {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("string", str);
return getEntity(invokeGet("utils/nosymbols", params), String.class);
} | [
"public",
"String",
"stripAndTrim",
"(",
"String",
"str",
")",
"{",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"MultivaluedHashMap",
"<>",
"(",
")",
";",
"params",
".",
"putSingle",
"(",
"\"string\"",
",",
"str",
")",
";",
"return",
"getEntity",
"(",
"invokeGet",
"(",
"\"utils/nosymbols\"",
",",
"params",
")",
",",
"String",
".",
"class",
")",
";",
"}"
] | Strips all symbols, punctuation, whitespace and control chars from a string.
@param str a dirty string
@return a clean string | [
"Strips",
"all",
"symbols",
"punctuation",
"whitespace",
"and",
"control",
"chars",
"from",
"a",
"string",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L1221-L1225 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/validation/SchemaFactory.java | SchemaFactory.setFeature | public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
"""
Set the value of a feature flag.
<p>
Feature can be used to control the way a {@link SchemaFactory}
parses schemas, although {@link SchemaFactory}s are not required
to recognize any specific feature names.</p>
<p>The feature name is any fully-qualified URI. It is
possible for a {@link SchemaFactory} to expose a feature value but
to be unable to change the current value.</p>
<p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature.
When the feature is:</p>
<ul>
<li>
<code>true</code>: the implementation will limit XML processing to conform to implementation limits.
Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
If XML processing is limited for security reasons, it will be reported via a call to the registered
{@link ErrorHandler#fatalError(org.xml.sax.SAXParseException)}.
See {@link #setErrorHandler(ErrorHandler errorHandler)}.
</li>
<li>
<code>false</code>: the implementation will processing XML according to the XML specifications without
regard to possible implementation limits.
</li>
</ul>
@param name The feature name, which is a non-null fully-qualified URI.
@param value The requested value of the feature (true or false).
@exception org.xml.sax.SAXNotRecognizedException If the feature
value can't be assigned or retrieved.
@exception org.xml.sax.SAXNotSupportedException When the
{@link SchemaFactory} recognizes the feature name but
cannot set the requested value.
@exception NullPointerException
if the name parameter is null.
@see #getFeature(String)
"""
if (name == null) {
throw new NullPointerException("name == null");
}
throw new SAXNotRecognizedException(name);
} | java | public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
if (name == null) {
throw new NullPointerException("name == null");
}
throw new SAXNotRecognizedException(name);
} | [
"public",
"void",
"setFeature",
"(",
"String",
"name",
",",
"boolean",
"value",
")",
"throws",
"SAXNotRecognizedException",
",",
"SAXNotSupportedException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name == null\"",
")",
";",
"}",
"throw",
"new",
"SAXNotRecognizedException",
"(",
"name",
")",
";",
"}"
] | Set the value of a feature flag.
<p>
Feature can be used to control the way a {@link SchemaFactory}
parses schemas, although {@link SchemaFactory}s are not required
to recognize any specific feature names.</p>
<p>The feature name is any fully-qualified URI. It is
possible for a {@link SchemaFactory} to expose a feature value but
to be unable to change the current value.</p>
<p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature.
When the feature is:</p>
<ul>
<li>
<code>true</code>: the implementation will limit XML processing to conform to implementation limits.
Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
If XML processing is limited for security reasons, it will be reported via a call to the registered
{@link ErrorHandler#fatalError(org.xml.sax.SAXParseException)}.
See {@link #setErrorHandler(ErrorHandler errorHandler)}.
</li>
<li>
<code>false</code>: the implementation will processing XML according to the XML specifications without
regard to possible implementation limits.
</li>
</ul>
@param name The feature name, which is a non-null fully-qualified URI.
@param value The requested value of the feature (true or false).
@exception org.xml.sax.SAXNotRecognizedException If the feature
value can't be assigned or retrieved.
@exception org.xml.sax.SAXNotSupportedException When the
{@link SchemaFactory} recognizes the feature name but
cannot set the requested value.
@exception NullPointerException
if the name parameter is null.
@see #getFeature(String) | [
"Set",
"the",
"value",
"of",
"a",
"feature",
"flag",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/validation/SchemaFactory.java#L316-L321 |
MTDdk/jawn | jawn-server/src/main/java/net/javapla/jawn/server/CookieHelper.java | CookieHelper.setHttpOnlyReflect | static void setHttpOnlyReflect(net.javapla.jawn.core.http.Cookie awCookie, javax.servlet.http.Cookie servletCookie) {
"""
Need to call this by reflection for backwards compatibility with Servlet 2.5
"""
try {
servletCookie.getClass().getMethod("setHttpOnly", boolean.class).invoke(servletCookie, awCookie.isHttpOnly());
} catch (Exception e) {
// Cookie.logger.warn("You are trying to set HttpOnly on a cookie, but it appears you are running on Servlet version before 3.0.");
}
} | java | static void setHttpOnlyReflect(net.javapla.jawn.core.http.Cookie awCookie, javax.servlet.http.Cookie servletCookie){
try {
servletCookie.getClass().getMethod("setHttpOnly", boolean.class).invoke(servletCookie, awCookie.isHttpOnly());
} catch (Exception e) {
// Cookie.logger.warn("You are trying to set HttpOnly on a cookie, but it appears you are running on Servlet version before 3.0.");
}
} | [
"static",
"void",
"setHttpOnlyReflect",
"(",
"net",
".",
"javapla",
".",
"jawn",
".",
"core",
".",
"http",
".",
"Cookie",
"awCookie",
",",
"javax",
".",
"servlet",
".",
"http",
".",
"Cookie",
"servletCookie",
")",
"{",
"try",
"{",
"servletCookie",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"setHttpOnly\"",
",",
"boolean",
".",
"class",
")",
".",
"invoke",
"(",
"servletCookie",
",",
"awCookie",
".",
"isHttpOnly",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Cookie.logger.warn(\"You are trying to set HttpOnly on a cookie, but it appears you are running on Servlet version before 3.0.\");",
"}",
"}"
] | Need to call this by reflection for backwards compatibility with Servlet 2.5 | [
"Need",
"to",
"call",
"this",
"by",
"reflection",
"for",
"backwards",
"compatibility",
"with",
"Servlet",
"2",
".",
"5"
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-server/src/main/java/net/javapla/jawn/server/CookieHelper.java#L44-L50 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/AABBUtils.java | AABBUtils.getCollisionBoundingBoxes | public static AxisAlignedBB[] getCollisionBoundingBoxes(World world, Block block, BlockPos pos) {
"""
Gets the collision {@link AxisAlignedBB} for the {@link Block} as the {@link BlockPos} coordinates.
@param world the world
@param block the block
@param pos the pos
@return the collision bounding boxes
"""
return getCollisionBoundingBoxes(world, new MBlockState(pos, block), false);
} | java | public static AxisAlignedBB[] getCollisionBoundingBoxes(World world, Block block, BlockPos pos)
{
return getCollisionBoundingBoxes(world, new MBlockState(pos, block), false);
} | [
"public",
"static",
"AxisAlignedBB",
"[",
"]",
"getCollisionBoundingBoxes",
"(",
"World",
"world",
",",
"Block",
"block",
",",
"BlockPos",
"pos",
")",
"{",
"return",
"getCollisionBoundingBoxes",
"(",
"world",
",",
"new",
"MBlockState",
"(",
"pos",
",",
"block",
")",
",",
"false",
")",
";",
"}"
] | Gets the collision {@link AxisAlignedBB} for the {@link Block} as the {@link BlockPos} coordinates.
@param world the world
@param block the block
@param pos the pos
@return the collision bounding boxes | [
"Gets",
"the",
"collision",
"{",
"@link",
"AxisAlignedBB",
"}",
"for",
"the",
"{",
"@link",
"Block",
"}",
"as",
"the",
"{",
"@link",
"BlockPos",
"}",
"coordinates",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/AABBUtils.java#L405-L408 |
javagl/Common | src/main/java/de/javagl/common/beans/PropertyChangeListeners.java | PropertyChangeListeners.addDeepLogger | public static void addDeepLogger(Object object, Level level) {
"""
Attaches a deep property change listener to the given object, that
generates logging information about the property change events,
and prints them as log messages.
@param object The object
@param level The log level
"""
addDeepLogger(object, m -> logger.log(level, m));
} | java | public static void addDeepLogger(Object object, Level level)
{
addDeepLogger(object, m -> logger.log(level, m));
} | [
"public",
"static",
"void",
"addDeepLogger",
"(",
"Object",
"object",
",",
"Level",
"level",
")",
"{",
"addDeepLogger",
"(",
"object",
",",
"m",
"->",
"logger",
".",
"log",
"(",
"level",
",",
"m",
")",
")",
";",
"}"
] | Attaches a deep property change listener to the given object, that
generates logging information about the property change events,
and prints them as log messages.
@param object The object
@param level The log level | [
"Attaches",
"a",
"deep",
"property",
"change",
"listener",
"to",
"the",
"given",
"object",
"that",
"generates",
"logging",
"information",
"about",
"the",
"property",
"change",
"events",
"and",
"prints",
"them",
"as",
"log",
"messages",
"."
] | train | https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/PropertyChangeListeners.java#L71-L74 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RegistriesInner.java | RegistriesInner.scheduleRunAsync | public Observable<RunInner> scheduleRunAsync(String resourceGroupName, String registryName, RunRequest runRequest) {
"""
Schedules a new run based on the request parameters and add it to the run queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runRequest The parameters of a run that needs to scheduled.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return scheduleRunWithServiceResponseAsync(resourceGroupName, registryName, runRequest).map(new Func1<ServiceResponse<RunInner>, RunInner>() {
@Override
public RunInner call(ServiceResponse<RunInner> response) {
return response.body();
}
});
} | java | public Observable<RunInner> scheduleRunAsync(String resourceGroupName, String registryName, RunRequest runRequest) {
return scheduleRunWithServiceResponseAsync(resourceGroupName, registryName, runRequest).map(new Func1<ServiceResponse<RunInner>, RunInner>() {
@Override
public RunInner call(ServiceResponse<RunInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RunInner",
">",
"scheduleRunAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"RunRequest",
"runRequest",
")",
"{",
"return",
"scheduleRunWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"runRequest",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"RunInner",
">",
",",
"RunInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"RunInner",
"call",
"(",
"ServiceResponse",
"<",
"RunInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Schedules a new run based on the request parameters and add it to the run queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runRequest The parameters of a run that needs to scheduled.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Schedules",
"a",
"new",
"run",
"based",
"on",
"the",
"request",
"parameters",
"and",
"add",
"it",
"to",
"the",
"run",
"queue",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RegistriesInner.java#L1754-L1761 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java | LiveEventsInner.createAsync | public Observable<LiveEventInner> createAsync(String resourceGroupName, String accountName, String liveEventName, LiveEventInner parameters, Boolean autoStart) {
"""
Create Live Event.
Creates a Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@param parameters Live Event properties needed for creation.
@param autoStart The flag indicates if auto start the Live Event.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return createWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, parameters, autoStart).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() {
@Override
public LiveEventInner call(ServiceResponse<LiveEventInner> response) {
return response.body();
}
});
} | java | public Observable<LiveEventInner> createAsync(String resourceGroupName, String accountName, String liveEventName, LiveEventInner parameters, Boolean autoStart) {
return createWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, parameters, autoStart).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() {
@Override
public LiveEventInner call(ServiceResponse<LiveEventInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LiveEventInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"liveEventName",
",",
"LiveEventInner",
"parameters",
",",
"Boolean",
"autoStart",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"liveEventName",
",",
"parameters",
",",
"autoStart",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"LiveEventInner",
">",
",",
"LiveEventInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"LiveEventInner",
"call",
"(",
"ServiceResponse",
"<",
"LiveEventInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Create Live Event.
Creates a Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@param parameters Live Event properties needed for creation.
@param autoStart The flag indicates if auto start the Live Event.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"Live",
"Event",
".",
"Creates",
"a",
"Live",
"Event",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L490-L497 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactory.java | DetectorFactory.getReportedBugPatterns | public Set<BugPattern> getReportedBugPatterns() {
"""
Get set of all BugPatterns this detector reports. An empty set means that
we don't know what kind of bug patterns might be reported.
"""
Set<BugPattern> result = new TreeSet<>();
StringTokenizer tok = new StringTokenizer(reports, ",");
while (tok.hasMoreTokens()) {
String type = tok.nextToken();
BugPattern bugPattern = DetectorFactoryCollection.instance().lookupBugPattern(type);
if (bugPattern != null) {
result.add(bugPattern);
}
}
return result;
} | java | public Set<BugPattern> getReportedBugPatterns() {
Set<BugPattern> result = new TreeSet<>();
StringTokenizer tok = new StringTokenizer(reports, ",");
while (tok.hasMoreTokens()) {
String type = tok.nextToken();
BugPattern bugPattern = DetectorFactoryCollection.instance().lookupBugPattern(type);
if (bugPattern != null) {
result.add(bugPattern);
}
}
return result;
} | [
"public",
"Set",
"<",
"BugPattern",
">",
"getReportedBugPatterns",
"(",
")",
"{",
"Set",
"<",
"BugPattern",
">",
"result",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"StringTokenizer",
"tok",
"=",
"new",
"StringTokenizer",
"(",
"reports",
",",
"\",\"",
")",
";",
"while",
"(",
"tok",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"String",
"type",
"=",
"tok",
".",
"nextToken",
"(",
")",
";",
"BugPattern",
"bugPattern",
"=",
"DetectorFactoryCollection",
".",
"instance",
"(",
")",
".",
"lookupBugPattern",
"(",
"type",
")",
";",
"if",
"(",
"bugPattern",
"!=",
"null",
")",
"{",
"result",
".",
"add",
"(",
"bugPattern",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Get set of all BugPatterns this detector reports. An empty set means that
we don't know what kind of bug patterns might be reported. | [
"Get",
"set",
"of",
"all",
"BugPatterns",
"this",
"detector",
"reports",
".",
"An",
"empty",
"set",
"means",
"that",
"we",
"don",
"t",
"know",
"what",
"kind",
"of",
"bug",
"patterns",
"might",
"be",
"reported",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactory.java#L345-L356 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.reportSyntaxError | private void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) {
"""
Report a syntax error using the given DiagnosticPosition object and
arguments, unless one was already reported at the same position.
"""
int pos = diagPos.getPreferredPosition();
if (pos > S.errPos() || pos == Position.NOPOS) {
if (token.kind == EOF) {
error(diagPos, "premature.eof");
} else {
error(diagPos, key, args);
}
}
S.errPos(pos);
if (token.pos == errorPos)
nextToken(); // guarantee progress
errorPos = token.pos;
} | java | private void reportSyntaxError(JCDiagnostic.DiagnosticPosition diagPos, String key, Object... args) {
int pos = diagPos.getPreferredPosition();
if (pos > S.errPos() || pos == Position.NOPOS) {
if (token.kind == EOF) {
error(diagPos, "premature.eof");
} else {
error(diagPos, key, args);
}
}
S.errPos(pos);
if (token.pos == errorPos)
nextToken(); // guarantee progress
errorPos = token.pos;
} | [
"private",
"void",
"reportSyntaxError",
"(",
"JCDiagnostic",
".",
"DiagnosticPosition",
"diagPos",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"int",
"pos",
"=",
"diagPos",
".",
"getPreferredPosition",
"(",
")",
";",
"if",
"(",
"pos",
">",
"S",
".",
"errPos",
"(",
")",
"||",
"pos",
"==",
"Position",
".",
"NOPOS",
")",
"{",
"if",
"(",
"token",
".",
"kind",
"==",
"EOF",
")",
"{",
"error",
"(",
"diagPos",
",",
"\"premature.eof\"",
")",
";",
"}",
"else",
"{",
"error",
"(",
"diagPos",
",",
"key",
",",
"args",
")",
";",
"}",
"}",
"S",
".",
"errPos",
"(",
"pos",
")",
";",
"if",
"(",
"token",
".",
"pos",
"==",
"errorPos",
")",
"nextToken",
"(",
")",
";",
"// guarantee progress",
"errorPos",
"=",
"token",
".",
"pos",
";",
"}"
] | Report a syntax error using the given DiagnosticPosition object and
arguments, unless one was already reported at the same position. | [
"Report",
"a",
"syntax",
"error",
"using",
"the",
"given",
"DiagnosticPosition",
"object",
"and",
"arguments",
"unless",
"one",
"was",
"already",
"reported",
"at",
"the",
"same",
"position",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/parser/JavacParser.java#L469-L482 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/TotalOrderPartitioner.java | TotalOrderPartitioner.buildTrie | private TrieNode buildTrie(BinaryComparable[] splits, int lower,
int upper, byte[] prefix, int maxDepth) {
"""
Given a sorted set of cut points, build a trie that will find the correct
partition quickly.
@param splits the list of cut points
@param lower the lower bound of partitions 0..numPartitions-1
@param upper the upper bound of partitions 0..numPartitions-1
@param prefix the prefix that we have already checked against
@param maxDepth the maximum depth we will build a trie for
@return the trie node that will divide the splits correctly
"""
final int depth = prefix.length;
if (depth >= maxDepth || lower == upper) {
return new LeafTrieNode(depth, splits, lower, upper);
}
InnerTrieNode result = new InnerTrieNode(depth);
byte[] trial = Arrays.copyOf(prefix, prefix.length + 1);
// append an extra byte on to the prefix
int currentBound = lower;
for(int ch = 0; ch < 255; ++ch) {
trial[depth] = (byte) (ch + 1);
lower = currentBound;
while (currentBound < upper) {
if (splits[currentBound].compareTo(trial, 0, trial.length) >= 0) {
break;
}
currentBound += 1;
}
trial[depth] = (byte) ch;
result.child[0xFF & ch] = buildTrie(splits, lower, currentBound, trial,
maxDepth);
}
// pick up the rest
trial[depth] = 127;
result.child[255] = buildTrie(splits, currentBound, upper, trial,
maxDepth);
return result;
} | java | private TrieNode buildTrie(BinaryComparable[] splits, int lower,
int upper, byte[] prefix, int maxDepth) {
final int depth = prefix.length;
if (depth >= maxDepth || lower == upper) {
return new LeafTrieNode(depth, splits, lower, upper);
}
InnerTrieNode result = new InnerTrieNode(depth);
byte[] trial = Arrays.copyOf(prefix, prefix.length + 1);
// append an extra byte on to the prefix
int currentBound = lower;
for(int ch = 0; ch < 255; ++ch) {
trial[depth] = (byte) (ch + 1);
lower = currentBound;
while (currentBound < upper) {
if (splits[currentBound].compareTo(trial, 0, trial.length) >= 0) {
break;
}
currentBound += 1;
}
trial[depth] = (byte) ch;
result.child[0xFF & ch] = buildTrie(splits, lower, currentBound, trial,
maxDepth);
}
// pick up the rest
trial[depth] = 127;
result.child[255] = buildTrie(splits, currentBound, upper, trial,
maxDepth);
return result;
} | [
"private",
"TrieNode",
"buildTrie",
"(",
"BinaryComparable",
"[",
"]",
"splits",
",",
"int",
"lower",
",",
"int",
"upper",
",",
"byte",
"[",
"]",
"prefix",
",",
"int",
"maxDepth",
")",
"{",
"final",
"int",
"depth",
"=",
"prefix",
".",
"length",
";",
"if",
"(",
"depth",
">=",
"maxDepth",
"||",
"lower",
"==",
"upper",
")",
"{",
"return",
"new",
"LeafTrieNode",
"(",
"depth",
",",
"splits",
",",
"lower",
",",
"upper",
")",
";",
"}",
"InnerTrieNode",
"result",
"=",
"new",
"InnerTrieNode",
"(",
"depth",
")",
";",
"byte",
"[",
"]",
"trial",
"=",
"Arrays",
".",
"copyOf",
"(",
"prefix",
",",
"prefix",
".",
"length",
"+",
"1",
")",
";",
"// append an extra byte on to the prefix",
"int",
"currentBound",
"=",
"lower",
";",
"for",
"(",
"int",
"ch",
"=",
"0",
";",
"ch",
"<",
"255",
";",
"++",
"ch",
")",
"{",
"trial",
"[",
"depth",
"]",
"=",
"(",
"byte",
")",
"(",
"ch",
"+",
"1",
")",
";",
"lower",
"=",
"currentBound",
";",
"while",
"(",
"currentBound",
"<",
"upper",
")",
"{",
"if",
"(",
"splits",
"[",
"currentBound",
"]",
".",
"compareTo",
"(",
"trial",
",",
"0",
",",
"trial",
".",
"length",
")",
">=",
"0",
")",
"{",
"break",
";",
"}",
"currentBound",
"+=",
"1",
";",
"}",
"trial",
"[",
"depth",
"]",
"=",
"(",
"byte",
")",
"ch",
";",
"result",
".",
"child",
"[",
"0xFF",
"&",
"ch",
"]",
"=",
"buildTrie",
"(",
"splits",
",",
"lower",
",",
"currentBound",
",",
"trial",
",",
"maxDepth",
")",
";",
"}",
"// pick up the rest",
"trial",
"[",
"depth",
"]",
"=",
"127",
";",
"result",
".",
"child",
"[",
"255",
"]",
"=",
"buildTrie",
"(",
"splits",
",",
"currentBound",
",",
"upper",
",",
"trial",
",",
"maxDepth",
")",
";",
"return",
"result",
";",
"}"
] | Given a sorted set of cut points, build a trie that will find the correct
partition quickly.
@param splits the list of cut points
@param lower the lower bound of partitions 0..numPartitions-1
@param upper the upper bound of partitions 0..numPartitions-1
@param prefix the prefix that we have already checked against
@param maxDepth the maximum depth we will build a trie for
@return the trie node that will divide the splits correctly | [
"Given",
"a",
"sorted",
"set",
"of",
"cut",
"points",
"build",
"a",
"trie",
"that",
"will",
"find",
"the",
"correct",
"partition",
"quickly",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/TotalOrderPartitioner.java#L235-L263 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java | CommerceNotificationAttachmentPersistenceImpl.findAll | @Override
public List<CommerceNotificationAttachment> findAll(int start, int end) {
"""
Returns a range of all the commerce notification attachments.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationAttachmentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce notification attachments
@param end the upper bound of the range of commerce notification attachments (not inclusive)
@return the range of commerce notification attachments
"""
return findAll(start, end, null);
} | java | @Override
public List<CommerceNotificationAttachment> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationAttachment",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce notification attachments.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationAttachmentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce notification attachments
@param end the upper bound of the range of commerce notification attachments (not inclusive)
@return the range of commerce notification attachments | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"notification",
"attachments",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L2729-L2732 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java | CPDefinitionPersistenceImpl.findByGroupId | @Override
public List<CPDefinition> findByGroupId(long groupId, int start, int end) {
"""
Returns a range of all the cp definitions where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of cp definitions
@param end the upper bound of the range of cp definitions (not inclusive)
@return the range of matching cp definitions
"""
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CPDefinition> findByGroupId(long groupId, int start, int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinition",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp definitions where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of cp definitions
@param end the upper bound of the range of cp definitions (not inclusive)
@return the range of matching cp definitions | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definitions",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L1524-L1527 |
wcm-io/wcm-io-wcm | commons/src/main/java/io/wcm/wcm/commons/util/Template.java | Template.forPage | public static TemplatePathInfo forPage(@NotNull Page page, @NotNull TemplatePathInfo @NotNull... templates) {
"""
Lookup template for given page.
@param page Page
@param templates Templates
@return The {@link TemplatePathInfo} instance or null for unknown template paths
"""
if (page == null || templates == null) {
return null;
}
String templatePath = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class);
return forTemplatePath(templatePath, templates);
} | java | public static TemplatePathInfo forPage(@NotNull Page page, @NotNull TemplatePathInfo @NotNull... templates) {
if (page == null || templates == null) {
return null;
}
String templatePath = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class);
return forTemplatePath(templatePath, templates);
} | [
"public",
"static",
"TemplatePathInfo",
"forPage",
"(",
"@",
"NotNull",
"Page",
"page",
",",
"@",
"NotNull",
"TemplatePathInfo",
"@",
"NotNull",
".",
".",
".",
"templates",
")",
"{",
"if",
"(",
"page",
"==",
"null",
"||",
"templates",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"templatePath",
"=",
"page",
".",
"getProperties",
"(",
")",
".",
"get",
"(",
"NameConstants",
".",
"PN_TEMPLATE",
",",
"String",
".",
"class",
")",
";",
"return",
"forTemplatePath",
"(",
"templatePath",
",",
"templates",
")",
";",
"}"
] | Lookup template for given page.
@param page Page
@param templates Templates
@return The {@link TemplatePathInfo} instance or null for unknown template paths | [
"Lookup",
"template",
"for",
"given",
"page",
"."
] | train | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/util/Template.java#L158-L164 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java | JBBPOut.Short | public JBBPOut Short(final String str, final JBBPBitOrder bitOrder) throws IOException {
"""
Write codes of chars as 16 bit values into the stream.
@param str the string which chars will be written, must not be null
@param bitOrder the bit outOrder
@return the DSL session
@throws IOException it will be thrown for transport errors
@since 1.1
"""
assertNotEnded();
if (this.processCommands) {
final boolean msb0 = bitOrder == JBBPBitOrder.MSB0;
for (int i = 0; i < str.length(); i++) {
short value = (short) str.charAt(i);
if (msb0) {
value = (short) JBBPFieldShort.reverseBits(value);
}
_writeShort(value);
}
}
return this;
} | java | public JBBPOut Short(final String str, final JBBPBitOrder bitOrder) throws IOException {
assertNotEnded();
if (this.processCommands) {
final boolean msb0 = bitOrder == JBBPBitOrder.MSB0;
for (int i = 0; i < str.length(); i++) {
short value = (short) str.charAt(i);
if (msb0) {
value = (short) JBBPFieldShort.reverseBits(value);
}
_writeShort(value);
}
}
return this;
} | [
"public",
"JBBPOut",
"Short",
"(",
"final",
"String",
"str",
",",
"final",
"JBBPBitOrder",
"bitOrder",
")",
"throws",
"IOException",
"{",
"assertNotEnded",
"(",
")",
";",
"if",
"(",
"this",
".",
"processCommands",
")",
"{",
"final",
"boolean",
"msb0",
"=",
"bitOrder",
"==",
"JBBPBitOrder",
".",
"MSB0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"short",
"value",
"=",
"(",
"short",
")",
"str",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"msb0",
")",
"{",
"value",
"=",
"(",
"short",
")",
"JBBPFieldShort",
".",
"reverseBits",
"(",
"value",
")",
";",
"}",
"_writeShort",
"(",
"value",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Write codes of chars as 16 bit values into the stream.
@param str the string which chars will be written, must not be null
@param bitOrder the bit outOrder
@return the DSL session
@throws IOException it will be thrown for transport errors
@since 1.1 | [
"Write",
"codes",
"of",
"chars",
"as",
"16",
"bit",
"values",
"into",
"the",
"stream",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L686-L699 |
ltearno/hexa.tools | hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java | hqlParser.inList | public final hqlParser.inList_return inList() throws RecognitionException {
"""
hql.g:486:1: inList : compoundExpr -> ^( IN_LIST[\"inList\"] compoundExpr ) ;
"""
hqlParser.inList_return retval = new hqlParser.inList_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope compoundExpr180 =null;
RewriteRuleSubtreeStream stream_compoundExpr=new RewriteRuleSubtreeStream(adaptor,"rule compoundExpr");
try {
// hql.g:487:2: ( compoundExpr -> ^( IN_LIST[\"inList\"] compoundExpr ) )
// hql.g:487:4: compoundExpr
{
pushFollow(FOLLOW_compoundExpr_in_inList2244);
compoundExpr180=compoundExpr();
state._fsp--;
stream_compoundExpr.add(compoundExpr180.getTree());
// AST REWRITE
// elements: compoundExpr
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 488:2: -> ^( IN_LIST[\"inList\"] compoundExpr )
{
// hql.g:488:5: ^( IN_LIST[\"inList\"] compoundExpr )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(IN_LIST, "inList"), root_1);
adaptor.addChild(root_1, stream_compoundExpr.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} | java | public final hqlParser.inList_return inList() throws RecognitionException {
hqlParser.inList_return retval = new hqlParser.inList_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope compoundExpr180 =null;
RewriteRuleSubtreeStream stream_compoundExpr=new RewriteRuleSubtreeStream(adaptor,"rule compoundExpr");
try {
// hql.g:487:2: ( compoundExpr -> ^( IN_LIST[\"inList\"] compoundExpr ) )
// hql.g:487:4: compoundExpr
{
pushFollow(FOLLOW_compoundExpr_in_inList2244);
compoundExpr180=compoundExpr();
state._fsp--;
stream_compoundExpr.add(compoundExpr180.getTree());
// AST REWRITE
// elements: compoundExpr
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 488:2: -> ^( IN_LIST[\"inList\"] compoundExpr )
{
// hql.g:488:5: ^( IN_LIST[\"inList\"] compoundExpr )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(IN_LIST, "inList"), root_1);
adaptor.addChild(root_1, stream_compoundExpr.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} | [
"public",
"final",
"hqlParser",
".",
"inList_return",
"inList",
"(",
")",
"throws",
"RecognitionException",
"{",
"hqlParser",
".",
"inList_return",
"retval",
"=",
"new",
"hqlParser",
".",
"inList_return",
"(",
")",
";",
"retval",
".",
"start",
"=",
"input",
".",
"LT",
"(",
"1",
")",
";",
"CommonTree",
"root_0",
"=",
"null",
";",
"ParserRuleReturnScope",
"compoundExpr180",
"=",
"null",
";",
"RewriteRuleSubtreeStream",
"stream_compoundExpr",
"=",
"new",
"RewriteRuleSubtreeStream",
"(",
"adaptor",
",",
"\"rule compoundExpr\"",
")",
";",
"try",
"{",
"// hql.g:487:2: ( compoundExpr -> ^( IN_LIST[\\\"inList\\\"] compoundExpr ) )",
"// hql.g:487:4: compoundExpr",
"{",
"pushFollow",
"(",
"FOLLOW_compoundExpr_in_inList2244",
")",
";",
"compoundExpr180",
"=",
"compoundExpr",
"(",
")",
";",
"state",
".",
"_fsp",
"--",
";",
"stream_compoundExpr",
".",
"add",
"(",
"compoundExpr180",
".",
"getTree",
"(",
")",
")",
";",
"// AST REWRITE",
"// elements: compoundExpr",
"// token labels:",
"// rule labels: retval",
"// token list labels:",
"// rule list labels:",
"// wildcard labels:",
"retval",
".",
"tree",
"=",
"root_0",
";",
"RewriteRuleSubtreeStream",
"stream_retval",
"=",
"new",
"RewriteRuleSubtreeStream",
"(",
"adaptor",
",",
"\"rule retval\"",
",",
"retval",
"!=",
"null",
"?",
"retval",
".",
"getTree",
"(",
")",
":",
"null",
")",
";",
"root_0",
"=",
"(",
"CommonTree",
")",
"adaptor",
".",
"nil",
"(",
")",
";",
"// 488:2: -> ^( IN_LIST[\\\"inList\\\"] compoundExpr )",
"{",
"// hql.g:488:5: ^( IN_LIST[\\\"inList\\\"] compoundExpr )",
"{",
"CommonTree",
"root_1",
"=",
"(",
"CommonTree",
")",
"adaptor",
".",
"nil",
"(",
")",
";",
"root_1",
"=",
"(",
"CommonTree",
")",
"adaptor",
".",
"becomeRoot",
"(",
"adaptor",
".",
"create",
"(",
"IN_LIST",
",",
"\"inList\"",
")",
",",
"root_1",
")",
";",
"adaptor",
".",
"addChild",
"(",
"root_1",
",",
"stream_compoundExpr",
".",
"nextTree",
"(",
")",
")",
";",
"adaptor",
".",
"addChild",
"(",
"root_0",
",",
"root_1",
")",
";",
"}",
"}",
"retval",
".",
"tree",
"=",
"root_0",
";",
"}",
"retval",
".",
"stop",
"=",
"input",
".",
"LT",
"(",
"-",
"1",
")",
";",
"retval",
".",
"tree",
"=",
"(",
"CommonTree",
")",
"adaptor",
".",
"rulePostProcessing",
"(",
"root_0",
")",
";",
"adaptor",
".",
"setTokenBoundaries",
"(",
"retval",
".",
"tree",
",",
"retval",
".",
"start",
",",
"retval",
".",
"stop",
")",
";",
"}",
"catch",
"(",
"RecognitionException",
"re",
")",
"{",
"reportError",
"(",
"re",
")",
";",
"recover",
"(",
"input",
",",
"re",
")",
";",
"retval",
".",
"tree",
"=",
"(",
"CommonTree",
")",
"adaptor",
".",
"errorNode",
"(",
"input",
",",
"retval",
".",
"start",
",",
"input",
".",
"LT",
"(",
"-",
"1",
")",
",",
"re",
")",
";",
"}",
"finally",
"{",
"// do for sure before leaving",
"}",
"return",
"retval",
";",
"}"
] | hql.g:486:1: inList : compoundExpr -> ^( IN_LIST[\"inList\"] compoundExpr ) ; | [
"hql",
".",
"g",
":",
"486",
":",
"1",
":",
"inList",
":",
"compoundExpr",
"-",
">",
"^",
"(",
"IN_LIST",
"[",
"\\",
"inList",
"\\",
"]",
"compoundExpr",
")",
";"
] | train | https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java#L5941-L6003 |
shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.ensureRight | public static String ensureRight(final String value, final String suffix, boolean caseSensitive) {
"""
Ensures that the value ends with suffix. If it doesn't, it's appended.
@param value The input String
@param suffix The substr to be ensured to be right
@param caseSensitive Use case (in-)sensitive matching for determining if value already ends with suffix
@return The string which is guarenteed to start with substr
"""
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return endsWith(value, suffix, caseSensitive) ? value : append(value, suffix);
} | java | public static String ensureRight(final String value, final String suffix, boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return endsWith(value, suffix, caseSensitive) ? value : append(value, suffix);
} | [
"public",
"static",
"String",
"ensureRight",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"suffix",
",",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
"endsWith",
"(",
"value",
",",
"suffix",
",",
"caseSensitive",
")",
"?",
"value",
":",
"append",
"(",
"value",
",",
"suffix",
")",
";",
"}"
] | Ensures that the value ends with suffix. If it doesn't, it's appended.
@param value The input String
@param suffix The substr to be ensured to be right
@param caseSensitive Use case (in-)sensitive matching for determining if value already ends with suffix
@return The string which is guarenteed to start with substr | [
"Ensures",
"that",
"the",
"value",
"ends",
"with",
"suffix",
".",
"If",
"it",
"doesn",
"t",
"it",
"s",
"appended",
"."
] | train | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L403-L406 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java | AbstractProperty.encodeFromRaw | public VALUETO encodeFromRaw(Object o, Optional<CassandraOptions> cassandraOptions) {
"""
Encode given java raw object to CQL-compatible value using Achilles codec system and a CassandraOptions
containing a runtime SchemaNameProvider. Use the
<br/>
<br/>
<pre class="code"><code class="java">
CassandraOptions.withSchemaNameProvider(SchemaNameProvider provider)
</code></pre>
<br/>
static method to build such a CassandraOptions instance
@param o
@param cassandraOptions
@return
"""
if (o == null) return null;
return encodeFromRawInternal(o, cassandraOptions);
} | java | public VALUETO encodeFromRaw(Object o, Optional<CassandraOptions> cassandraOptions) {
if (o == null) return null;
return encodeFromRawInternal(o, cassandraOptions);
} | [
"public",
"VALUETO",
"encodeFromRaw",
"(",
"Object",
"o",
",",
"Optional",
"<",
"CassandraOptions",
">",
"cassandraOptions",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"return",
"null",
";",
"return",
"encodeFromRawInternal",
"(",
"o",
",",
"cassandraOptions",
")",
";",
"}"
] | Encode given java raw object to CQL-compatible value using Achilles codec system and a CassandraOptions
containing a runtime SchemaNameProvider. Use the
<br/>
<br/>
<pre class="code"><code class="java">
CassandraOptions.withSchemaNameProvider(SchemaNameProvider provider)
</code></pre>
<br/>
static method to build such a CassandraOptions instance
@param o
@param cassandraOptions
@return | [
"Encode",
"given",
"java",
"raw",
"object",
"to",
"CQL",
"-",
"compatible",
"value",
"using",
"Achilles",
"codec",
"system",
"and",
"a",
"CassandraOptions",
"containing",
"a",
"runtime",
"SchemaNameProvider",
".",
"Use",
"the",
"<br",
"/",
">",
"<br",
"/",
">",
"<pre",
"class",
"=",
"code",
">",
"<code",
"class",
"=",
"java",
">",
"CassandraOptions",
".",
"withSchemaNameProvider",
"(",
"SchemaNameProvider",
"provider",
")",
"<",
"/",
"code",
">",
"<",
"/",
"pre",
">",
"<br",
"/",
">",
"static",
"method",
"to",
"build",
"such",
"a",
"CassandraOptions",
"instance"
] | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java#L118-L121 |
zaproxy/zaproxy | src/org/parosproxy/paros/core/scanner/AbstractPlugin.java | AbstractPlugin.matchBodyPattern | protected boolean matchBodyPattern(HttpMessage msg, Pattern pattern, StringBuilder sb) {
"""
Check if the given pattern can be found in the msg body. If the supplied
StringBuilder is not null, append the result to the StringBuilder.
@param msg the message that will be checked
@param pattern the pattern that will be used
@param sb where the regex match should be appended
@return true if the pattern can be found.
""" // ZAP: Changed the type of the parameter "sb" to StringBuilder.
Matcher matcher = pattern.matcher(msg.getResponseBody().toString());
boolean result = matcher.find();
if (result) {
if (sb != null) {
sb.append(matcher.group());
}
}
return result;
} | java | protected boolean matchBodyPattern(HttpMessage msg, Pattern pattern, StringBuilder sb) { // ZAP: Changed the type of the parameter "sb" to StringBuilder.
Matcher matcher = pattern.matcher(msg.getResponseBody().toString());
boolean result = matcher.find();
if (result) {
if (sb != null) {
sb.append(matcher.group());
}
}
return result;
} | [
"protected",
"boolean",
"matchBodyPattern",
"(",
"HttpMessage",
"msg",
",",
"Pattern",
"pattern",
",",
"StringBuilder",
"sb",
")",
"{",
"// ZAP: Changed the type of the parameter \"sb\" to StringBuilder.\r",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"msg",
".",
"getResponseBody",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"boolean",
"result",
"=",
"matcher",
".",
"find",
"(",
")",
";",
"if",
"(",
"result",
")",
"{",
"if",
"(",
"sb",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"matcher",
".",
"group",
"(",
")",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Check if the given pattern can be found in the msg body. If the supplied
StringBuilder is not null, append the result to the StringBuilder.
@param msg the message that will be checked
@param pattern the pattern that will be used
@param sb where the regex match should be appended
@return true if the pattern can be found. | [
"Check",
"if",
"the",
"given",
"pattern",
"can",
"be",
"found",
"in",
"the",
"msg",
"body",
".",
"If",
"the",
"supplied",
"StringBuilder",
"is",
"not",
"null",
"append",
"the",
"result",
"to",
"the",
"StringBuilder",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/AbstractPlugin.java#L730-L739 |
mnlipp/jgrapes | org.jgrapes.http/src/org/jgrapes/http/ResponseCreationSupport.java | ResponseCreationSupport.uriFromPath | public static URI uriFromPath(String path) throws IllegalArgumentException {
"""
Create a {@link URI} from a path. This is similar to calling
`new URI(null, null, path, null)` with the {@link URISyntaxException}
converted to a {@link IllegalArgumentException}.
@param path the path
@return the uri
@throws IllegalArgumentException if the string violates
RFC 2396
"""
try {
return new URI(null, null, path, null);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
} | java | public static URI uriFromPath(String path) throws IllegalArgumentException {
try {
return new URI(null, null, path, null);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
} | [
"public",
"static",
"URI",
"uriFromPath",
"(",
"String",
"path",
")",
"throws",
"IllegalArgumentException",
"{",
"try",
"{",
"return",
"new",
"URI",
"(",
"null",
",",
"null",
",",
"path",
",",
"null",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"e",
")",
";",
"}",
"}"
] | Create a {@link URI} from a path. This is similar to calling
`new URI(null, null, path, null)` with the {@link URISyntaxException}
converted to a {@link IllegalArgumentException}.
@param path the path
@return the uri
@throws IllegalArgumentException if the string violates
RFC 2396 | [
"Create",
"a",
"{",
"@link",
"URI",
"}",
"from",
"a",
"path",
".",
"This",
"is",
"similar",
"to",
"calling",
"new",
"URI",
"(",
"null",
"null",
"path",
"null",
")",
"with",
"the",
"{",
"@link",
"URISyntaxException",
"}",
"converted",
"to",
"a",
"{",
"@link",
"IllegalArgumentException",
"}",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/ResponseCreationSupport.java#L311-L317 |
motown-io/motown | operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java | ChargingStationEventListener.updateAuthorizationList | private void updateAuthorizationList(final ChargingStation chargingStation, final Set<LocalAuthorization> updatedLocalAuthorizations) {
"""
Updates the local representation of the charging station authorization list.
Tokens in the updatedIdentificationTokens will be removed from the local operator api list.
@param chargingStation the chargingstation.
@param updatedLocalAuthorizations the updated tokens.
"""
Set<LocalAuthorization> authorizationList = chargingStation.getLocalAuths();
Iterables.removeIf(authorizationList, new Predicate<LocalAuthorization>() {
@Override
public boolean apply(@Nullable LocalAuthorization identifyingToken) {
return updatedLocalAuthorizations != null && updatedLocalAuthorizations.contains(identifyingToken);
}
});
authorizationList.addAll(updatedLocalAuthorizations);
} | java | private void updateAuthorizationList(final ChargingStation chargingStation, final Set<LocalAuthorization> updatedLocalAuthorizations) {
Set<LocalAuthorization> authorizationList = chargingStation.getLocalAuths();
Iterables.removeIf(authorizationList, new Predicate<LocalAuthorization>() {
@Override
public boolean apply(@Nullable LocalAuthorization identifyingToken) {
return updatedLocalAuthorizations != null && updatedLocalAuthorizations.contains(identifyingToken);
}
});
authorizationList.addAll(updatedLocalAuthorizations);
} | [
"private",
"void",
"updateAuthorizationList",
"(",
"final",
"ChargingStation",
"chargingStation",
",",
"final",
"Set",
"<",
"LocalAuthorization",
">",
"updatedLocalAuthorizations",
")",
"{",
"Set",
"<",
"LocalAuthorization",
">",
"authorizationList",
"=",
"chargingStation",
".",
"getLocalAuths",
"(",
")",
";",
"Iterables",
".",
"removeIf",
"(",
"authorizationList",
",",
"new",
"Predicate",
"<",
"LocalAuthorization",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"@",
"Nullable",
"LocalAuthorization",
"identifyingToken",
")",
"{",
"return",
"updatedLocalAuthorizations",
"!=",
"null",
"&&",
"updatedLocalAuthorizations",
".",
"contains",
"(",
"identifyingToken",
")",
";",
"}",
"}",
")",
";",
"authorizationList",
".",
"addAll",
"(",
"updatedLocalAuthorizations",
")",
";",
"}"
] | Updates the local representation of the charging station authorization list.
Tokens in the updatedIdentificationTokens will be removed from the local operator api list.
@param chargingStation the chargingstation.
@param updatedLocalAuthorizations the updated tokens. | [
"Updates",
"the",
"local",
"representation",
"of",
"the",
"charging",
"station",
"authorization",
"list",
".",
"Tokens",
"in",
"the",
"updatedIdentificationTokens",
"will",
"be",
"removed",
"from",
"the",
"local",
"operator",
"api",
"list",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L285-L295 |
kiuwan/java-api-client | src/main/java/com/kiuwan/client/KiuwanRestApiClient.java | KiuwanRestApiClient.initializeConnection | private void initializeConnection(String user, String password, String restApiBaseUrl, String proxyHost, Integer proxyPort, Proxy.Type proxyType, String proxyUser, String proxyPassword) {
"""
Initializes the connection.
@param user The user name in Kiuwan.
@param password The password in Kiuwan.
@param restApiBaseUrl Base URL for REST-API.
@param proxyHost Proxy hostname or address.
@param proxyPort Port of the proxy.
@param proxyType Type of the proxy: HTTP/SOCKS/DIRECT.
@param proxyUser User name to authenticate with the proxy.
@param proxyPassword Password to authenticate with the proxy.
"""
connection = ClientHelper.createClient(proxyHost, proxyPort, proxyType, proxyUser, proxyPassword).register(HttpAuthenticationFeature.basic(user, password)).target(restApiBaseUrl);
} | java | private void initializeConnection(String user, String password, String restApiBaseUrl, String proxyHost, Integer proxyPort, Proxy.Type proxyType, String proxyUser, String proxyPassword) {
connection = ClientHelper.createClient(proxyHost, proxyPort, proxyType, proxyUser, proxyPassword).register(HttpAuthenticationFeature.basic(user, password)).target(restApiBaseUrl);
} | [
"private",
"void",
"initializeConnection",
"(",
"String",
"user",
",",
"String",
"password",
",",
"String",
"restApiBaseUrl",
",",
"String",
"proxyHost",
",",
"Integer",
"proxyPort",
",",
"Proxy",
".",
"Type",
"proxyType",
",",
"String",
"proxyUser",
",",
"String",
"proxyPassword",
")",
"{",
"connection",
"=",
"ClientHelper",
".",
"createClient",
"(",
"proxyHost",
",",
"proxyPort",
",",
"proxyType",
",",
"proxyUser",
",",
"proxyPassword",
")",
".",
"register",
"(",
"HttpAuthenticationFeature",
".",
"basic",
"(",
"user",
",",
"password",
")",
")",
".",
"target",
"(",
"restApiBaseUrl",
")",
";",
"}"
] | Initializes the connection.
@param user The user name in Kiuwan.
@param password The password in Kiuwan.
@param restApiBaseUrl Base URL for REST-API.
@param proxyHost Proxy hostname or address.
@param proxyPort Port of the proxy.
@param proxyType Type of the proxy: HTTP/SOCKS/DIRECT.
@param proxyUser User name to authenticate with the proxy.
@param proxyPassword Password to authenticate with the proxy. | [
"Initializes",
"the",
"connection",
"."
] | train | https://github.com/kiuwan/java-api-client/blob/5cda6a6ed9f37a03f9418a1846d349f6d59e14f7/src/main/java/com/kiuwan/client/KiuwanRestApiClient.java#L1103-L1105 |
betfair/cougar | cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IdlToDSMojo.java | IdlToDSMojo.readNamespaceAttr | private String readNamespaceAttr(Document doc) {
"""
Retrieve 'namespace' attr of interface definition or null if not found
"""
// lazy loading is mostly pointless but it keeps things together
if (namespaceExpr == null) {
namespaceExpr = initNamespaceAttrExpression();
}
String s;
try {
s = namespaceExpr.evaluate(doc);
} catch (XPathExpressionException e) {
throw new PluginException("Error evaluating namespace XPath expression: " + e, e);
}
// xpath returns an empty string if not found, null is cleaner for callers
return (s == null || s.length() == 0) ? null : s;
} | java | private String readNamespaceAttr(Document doc) {
// lazy loading is mostly pointless but it keeps things together
if (namespaceExpr == null) {
namespaceExpr = initNamespaceAttrExpression();
}
String s;
try {
s = namespaceExpr.evaluate(doc);
} catch (XPathExpressionException e) {
throw new PluginException("Error evaluating namespace XPath expression: " + e, e);
}
// xpath returns an empty string if not found, null is cleaner for callers
return (s == null || s.length() == 0) ? null : s;
} | [
"private",
"String",
"readNamespaceAttr",
"(",
"Document",
"doc",
")",
"{",
"// lazy loading is mostly pointless but it keeps things together",
"if",
"(",
"namespaceExpr",
"==",
"null",
")",
"{",
"namespaceExpr",
"=",
"initNamespaceAttrExpression",
"(",
")",
";",
"}",
"String",
"s",
";",
"try",
"{",
"s",
"=",
"namespaceExpr",
".",
"evaluate",
"(",
"doc",
")",
";",
"}",
"catch",
"(",
"XPathExpressionException",
"e",
")",
"{",
"throw",
"new",
"PluginException",
"(",
"\"Error evaluating namespace XPath expression: \"",
"+",
"e",
",",
"e",
")",
";",
"}",
"// xpath returns an empty string if not found, null is cleaner for callers",
"return",
"(",
"s",
"==",
"null",
"||",
"s",
".",
"length",
"(",
")",
"==",
"0",
")",
"?",
"null",
":",
"s",
";",
"}"
] | Retrieve 'namespace' attr of interface definition or null if not found | [
"Retrieve",
"namespace",
"attr",
"of",
"interface",
"definition",
"or",
"null",
"if",
"not",
"found"
] | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-codegen-plugin/src/main/java/com/betfair/cougar/codegen/IdlToDSMojo.java#L653-L668 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.