repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
jembi/openhim-mediator-engine-java | src/main/java/org/openhim/mediator/engine/RoutingTable.java | RoutingTable.addRoute | public void addRoute(String path, Class<? extends Actor> actorClass) throws RouteAlreadyMappedException {
addRoute(new Route(path, false), actorClass);
} | java | public void addRoute(String path, Class<? extends Actor> actorClass) throws RouteAlreadyMappedException {
addRoute(new Route(path, false), actorClass);
} | [
"public",
"void",
"addRoute",
"(",
"String",
"path",
",",
"Class",
"<",
"?",
"extends",
"Actor",
">",
"actorClass",
")",
"throws",
"RouteAlreadyMappedException",
"{",
"addRoute",
"(",
"new",
"Route",
"(",
"path",
",",
"false",
")",
",",
"actorClass",
")",
... | Add an exact path to the routing table.
@throws RouteAlreadyMappedException | [
"Add",
"an",
"exact",
"path",
"to",
"the",
"routing",
"table",
"."
] | train | https://github.com/jembi/openhim-mediator-engine-java/blob/02adc0da4302cbde26cc9a5c1ce91ec6277e4f68/src/main/java/org/openhim/mediator/engine/RoutingTable.java#L61-L63 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java | CmsDefaultXmlContentHandler.safeParseBoolean | private boolean safeParseBoolean(String text, boolean defaultValue) {
if (text == null) {
return defaultValue;
}
try {
return Boolean.parseBoolean(text);
} catch (Throwable t) {
return defaultValue;
}
} | java | private boolean safeParseBoolean(String text, boolean defaultValue) {
if (text == null) {
return defaultValue;
}
try {
return Boolean.parseBoolean(text);
} catch (Throwable t) {
return defaultValue;
}
} | [
"private",
"boolean",
"safeParseBoolean",
"(",
"String",
"text",
",",
"boolean",
"defaultValue",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"try",
"{",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"text",
")"... | Parses a boolean from a string and returns a default value if the string couldn't be parsed.<p>
@param text the text from which to get the boolean value
@param defaultValue the value to return if parsing fails
@return the parsed boolean | [
"Parses",
"a",
"boolean",
"from",
"a",
"string",
"and",
"returns",
"a",
"default",
"value",
"if",
"the",
"string",
"couldn",
"t",
"be",
"parsed",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L4365-L4375 |
alexa/alexa-skills-kit-sdk-for-java | ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java | ResponseBuilder.addVideoAppLaunchDirective | public ResponseBuilder addVideoAppLaunchDirective(String source, String title, String subtitle) {
Metadata metadata = Metadata.builder()
.withSubtitle(subtitle)
.withTitle(title)
.build();
VideoItem videoItem = VideoItem.builder()
.withSource(source)
.withMetadata(metadata)
.build();
LaunchDirective videoDirective = LaunchDirective.builder()
.withVideoItem(videoItem)
.build();
this.shouldEndSession = null;
return addDirective(videoDirective);
} | java | public ResponseBuilder addVideoAppLaunchDirective(String source, String title, String subtitle) {
Metadata metadata = Metadata.builder()
.withSubtitle(subtitle)
.withTitle(title)
.build();
VideoItem videoItem = VideoItem.builder()
.withSource(source)
.withMetadata(metadata)
.build();
LaunchDirective videoDirective = LaunchDirective.builder()
.withVideoItem(videoItem)
.build();
this.shouldEndSession = null;
return addDirective(videoDirective);
} | [
"public",
"ResponseBuilder",
"addVideoAppLaunchDirective",
"(",
"String",
"source",
",",
"String",
"title",
",",
"String",
"subtitle",
")",
"{",
"Metadata",
"metadata",
"=",
"Metadata",
".",
"builder",
"(",
")",
".",
"withSubtitle",
"(",
"subtitle",
")",
".",
... | Adds a VideoApp {@link LaunchDirective} to the response to play a video.
@param source location of video content at a remote HTTPS location
@param title title that can be displayed on VideoApp
@param subtitle subtitle that can be displayed on VideoApp
@return response builder | [
"Adds",
"a",
"VideoApp",
"{",
"@link",
"LaunchDirective",
"}",
"to",
"the",
"response",
"to",
"play",
"a",
"video",
"."
] | train | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java#L236-L252 |
medined/d4m | src/main/java/com/codebits/d4m/TableManager.java | TableManager.addSplitsForSha1 | public void addSplitsForSha1() {
Validate.notNull(tableOperations, "tableOperations must not be null");
String hexadecimal = "123456789abcde";
SortedSet<Text> edgeSplits = new TreeSet<>();
SortedSet<Text> textSplits = new TreeSet<>();
Collection<Text> existingEdgeSplits = null;
Collection<Text> existingTextSplits = null;
try {
existingEdgeSplits = tableOperations.listSplits(getEdgeTable());
existingTextSplits = tableOperations.listSplits(getTextTable());
} catch (TableNotFoundException | AccumuloSecurityException | AccumuloException e) {
throw new D4MException("Error reading splits.", e);
}
for (byte b : hexadecimal.getBytes(charset)) {
Text splitPoint = new Text(new byte[]{b});
if (not(existingEdgeSplits.contains(splitPoint))) {
edgeSplits.add(splitPoint);
}
if (not(existingTextSplits.contains(splitPoint))) {
textSplits.add(splitPoint);
}
}
addSplits(getEdgeTable(), edgeSplits);
addSplits(getTextTable(), textSplits);
} | java | public void addSplitsForSha1() {
Validate.notNull(tableOperations, "tableOperations must not be null");
String hexadecimal = "123456789abcde";
SortedSet<Text> edgeSplits = new TreeSet<>();
SortedSet<Text> textSplits = new TreeSet<>();
Collection<Text> existingEdgeSplits = null;
Collection<Text> existingTextSplits = null;
try {
existingEdgeSplits = tableOperations.listSplits(getEdgeTable());
existingTextSplits = tableOperations.listSplits(getTextTable());
} catch (TableNotFoundException | AccumuloSecurityException | AccumuloException e) {
throw new D4MException("Error reading splits.", e);
}
for (byte b : hexadecimal.getBytes(charset)) {
Text splitPoint = new Text(new byte[]{b});
if (not(existingEdgeSplits.contains(splitPoint))) {
edgeSplits.add(splitPoint);
}
if (not(existingTextSplits.contains(splitPoint))) {
textSplits.add(splitPoint);
}
}
addSplits(getEdgeTable(), edgeSplits);
addSplits(getTextTable(), textSplits);
} | [
"public",
"void",
"addSplitsForSha1",
"(",
")",
"{",
"Validate",
".",
"notNull",
"(",
"tableOperations",
",",
"\"tableOperations must not be null\"",
")",
";",
"String",
"hexadecimal",
"=",
"\"123456789abcde\"",
";",
"SortedSet",
"<",
"Text",
">",
"edgeSplits",
"=",... | Pre-split the Tedge and TedgeText tables.
Helpful when sha1 is used as row value. | [
"Pre",
"-",
"split",
"the",
"Tedge",
"and",
"TedgeText",
"tables",
"."
] | train | https://github.com/medined/d4m/blob/b61100609fba6961f6c903fcf96b687122c5bf05/src/main/java/com/codebits/d4m/TableManager.java#L171-L198 |
lookfirst/WePay-Java-SDK | src/main/java/com/lookfirst/wepay/WePayApi.java | WePayApi.getToken | public Token getToken(String code, String redirectUrl) throws IOException, WePayException {
TokenRequest request = new TokenRequest();
request.setClientId(key.getClientId());
request.setClientSecret(key.getClientSecret());
request.setRedirectUri(redirectUrl);
request.setCode(code);
return execute(null, request);
} | java | public Token getToken(String code, String redirectUrl) throws IOException, WePayException {
TokenRequest request = new TokenRequest();
request.setClientId(key.getClientId());
request.setClientSecret(key.getClientSecret());
request.setRedirectUri(redirectUrl);
request.setCode(code);
return execute(null, request);
} | [
"public",
"Token",
"getToken",
"(",
"String",
"code",
",",
"String",
"redirectUrl",
")",
"throws",
"IOException",
",",
"WePayException",
"{",
"TokenRequest",
"request",
"=",
"new",
"TokenRequest",
"(",
")",
";",
"request",
".",
"setClientId",
"(",
"key",
".",
... | Exchange a temporary access code for a (semi-)permanent access token
@param code 'code' field from query string passed to your redirect_uri page
@param redirectUrl Where user went after logging in at WePay (must match value from getAuthorizationUri)
@return json {"user_id":"123456","access_token":"1337h4x0rzabcd12345","token_type":"BEARER"} | [
"Exchange",
"a",
"temporary",
"access",
"code",
"for",
"a",
"(",
"semi",
"-",
")",
"permanent",
"access",
"token"
] | train | https://github.com/lookfirst/WePay-Java-SDK/blob/3c0a47d6fa051d531c8fdbbfd54a0ef2891aa8f0/src/main/java/com/lookfirst/wepay/WePayApi.java#L199-L208 |
OpenBEL/openbel-framework | org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Record.java | Record.readToEntry | public final void readToEntry(byte[] buffer, T t) {
if (buffer == null) {
throw new InvalidArgument("buffer", buffer);
} else if (t == null) {
throw new InvalidArgument("cannot read a null entry");
} else if (buffer.length != recordSize) {
final String fmt = "invalid buffer (%d bytes, expected %d)";
final String msg = format(fmt, buffer.length, recordSize);
throw new InvalidArgument(msg);
}
readTo(buffer, t);
} | java | public final void readToEntry(byte[] buffer, T t) {
if (buffer == null) {
throw new InvalidArgument("buffer", buffer);
} else if (t == null) {
throw new InvalidArgument("cannot read a null entry");
} else if (buffer.length != recordSize) {
final String fmt = "invalid buffer (%d bytes, expected %d)";
final String msg = format(fmt, buffer.length, recordSize);
throw new InvalidArgument(msg);
}
readTo(buffer, t);
} | [
"public",
"final",
"void",
"readToEntry",
"(",
"byte",
"[",
"]",
"buffer",
",",
"T",
"t",
")",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidArgument",
"(",
"\"buffer\"",
",",
"buffer",
")",
";",
"}",
"else",
"if",
"(",
... | Reads {@code <T>} to the provided {@code buffer}.
@param buffer {@code byte[]}; of size {@link #getRecordSize()}
@param t {@code <T>}
@throws InvalidArgument Thrown if either argument is null or if
{@code buffer} is invalid | [
"Reads",
"{",
"@code",
"<T",
">",
"}",
"to",
"the",
"provided",
"{",
"@code",
"buffer",
"}",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Record.java#L263-L274 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListAccountRelPersistenceImpl.java | CommercePriceListAccountRelPersistenceImpl.removeByUUID_G | @Override
public CommercePriceListAccountRel removeByUUID_G(String uuid, long groupId)
throws NoSuchPriceListAccountRelException {
CommercePriceListAccountRel commercePriceListAccountRel = findByUUID_G(uuid,
groupId);
return remove(commercePriceListAccountRel);
} | java | @Override
public CommercePriceListAccountRel removeByUUID_G(String uuid, long groupId)
throws NoSuchPriceListAccountRelException {
CommercePriceListAccountRel commercePriceListAccountRel = findByUUID_G(uuid,
groupId);
return remove(commercePriceListAccountRel);
} | [
"@",
"Override",
"public",
"CommercePriceListAccountRel",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchPriceListAccountRelException",
"{",
"CommercePriceListAccountRel",
"commercePriceListAccountRel",
"=",
"findByUUID_G",
"(",
"uuid",... | Removes the commerce price list account rel where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the commerce price list account rel that was removed | [
"Removes",
"the",
"commerce",
"price",
"list",
"account",
"rel",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListAccountRelPersistenceImpl.java#L824-L831 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java | SparseCpuLevel1.isamin | @Override
protected int isamin(long N, INDArray X, int incX) {
return (int) cblas_isamin((int) N, (FloatPointer) X.data().addressPointer(), incX);
} | java | @Override
protected int isamin(long N, INDArray X, int incX) {
return (int) cblas_isamin((int) N, (FloatPointer) X.data().addressPointer(), incX);
} | [
"@",
"Override",
"protected",
"int",
"isamin",
"(",
"long",
"N",
",",
"INDArray",
"X",
",",
"int",
"incX",
")",
"{",
"return",
"(",
"int",
")",
"cblas_isamin",
"(",
"(",
"int",
")",
"N",
",",
"(",
"FloatPointer",
")",
"X",
".",
"data",
"(",
")",
... | Find the index of the element with minimum absolute value
@param N The number of elements in vector X
@param X a vector
@param incX The increment of X
@return the index of the element with minimum absolute value | [
"Find",
"the",
"index",
"of",
"the",
"element",
"with",
"minimum",
"absolute",
"value"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java#L163-L166 |
webmetrics/browsermob-proxy | src/main/java/org/xbill/DNS/DNSInput.java | DNSInput.readByteArray | public void
readByteArray(byte [] b, int off, int len) throws WireParseException {
require(len);
System.arraycopy(array, pos, b, off, len);
pos += len;
} | java | public void
readByteArray(byte [] b, int off, int len) throws WireParseException {
require(len);
System.arraycopy(array, pos, b, off, len);
pos += len;
} | [
"public",
"void",
"readByteArray",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"WireParseException",
"{",
"require",
"(",
"len",
")",
";",
"System",
".",
"arraycopy",
"(",
"array",
",",
"pos",
",",
"b",
",",
"off"... | Reads a byte array of a specified length from the stream into an existing
array.
@param b The array to read into.
@param off The offset of the array to start copying data into.
@param len The number of bytes to copy.
@throws WireParseException The end of the stream was reached. | [
"Reads",
"a",
"byte",
"array",
"of",
"a",
"specified",
"length",
"from",
"the",
"stream",
"into",
"an",
"existing",
"array",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/xbill/DNS/DNSInput.java#L168-L173 |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.toLowerCase | public AsciiString toLowerCase() {
boolean lowercased = true;
int i, j;
final int len = length() + arrayOffset();
for (i = arrayOffset(); i < len; ++i) {
byte b = value[i];
if (b >= 'A' && b <= 'Z') {
lowercased = false;
break;
}
}
// Check if this string does not contain any uppercase characters.
if (lowercased) {
return this;
}
final byte[] newValue = PlatformDependent.allocateUninitializedArray(length());
for (i = 0, j = arrayOffset(); i < newValue.length; ++i, ++j) {
newValue[i] = toLowerCase(value[j]);
}
return new AsciiString(newValue, false);
} | java | public AsciiString toLowerCase() {
boolean lowercased = true;
int i, j;
final int len = length() + arrayOffset();
for (i = arrayOffset(); i < len; ++i) {
byte b = value[i];
if (b >= 'A' && b <= 'Z') {
lowercased = false;
break;
}
}
// Check if this string does not contain any uppercase characters.
if (lowercased) {
return this;
}
final byte[] newValue = PlatformDependent.allocateUninitializedArray(length());
for (i = 0, j = arrayOffset(); i < newValue.length; ++i, ++j) {
newValue[i] = toLowerCase(value[j]);
}
return new AsciiString(newValue, false);
} | [
"public",
"AsciiString",
"toLowerCase",
"(",
")",
"{",
"boolean",
"lowercased",
"=",
"true",
";",
"int",
"i",
",",
"j",
";",
"final",
"int",
"len",
"=",
"length",
"(",
")",
"+",
"arrayOffset",
"(",
")",
";",
"for",
"(",
"i",
"=",
"arrayOffset",
"(",
... | Converts the characters in this string to lowercase, using the default Locale.
@return a new string containing the lowercase characters equivalent to the characters in this string. | [
"Converts",
"the",
"characters",
"in",
"this",
"string",
"to",
"lowercase",
"using",
"the",
"default",
"Locale",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L928-L951 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/Environment.java | Environment.doHead | public void doHead(String url, HttpResponse response, Map<String, Object> headers) {
response.setRequest(url);
httpClient.head(url, response, headers);
} | java | public void doHead(String url, HttpResponse response, Map<String, Object> headers) {
response.setRequest(url);
httpClient.head(url, response, headers);
} | [
"public",
"void",
"doHead",
"(",
"String",
"url",
",",
"HttpResponse",
"response",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
")",
"{",
"response",
".",
"setRequest",
"(",
"url",
")",
";",
"httpClient",
".",
"head",
"(",
"url",
",",
"res... | HEADs content from URL.
@param url url to get from.
@param response response to store url and response value in.
@param headers http headers to add. | [
"HEADs",
"content",
"from",
"URL",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L416-L419 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java | Uris.isNormalized | public static boolean isNormalized(final URI uri, final boolean strict) {
return !Strings.isNullOrEmpty(uri.getScheme()) &&
Objects.equal(Uris.getRawUserInfo(uri), uri.getRawUserInfo()) &&
!Strings.isNullOrEmpty(uri.getHost()) &&
hasPort(uri) &&
Objects.equal(Uris.getRawPath(uri, strict), uri.getRawPath()) &&
Objects.equal(Uris.getRawQuery(uri, strict), uri.getRawQuery()) &&
Objects.equal(Uris.getRawFragment(uri, strict), uri.getRawFragment());
} | java | public static boolean isNormalized(final URI uri, final boolean strict) {
return !Strings.isNullOrEmpty(uri.getScheme()) &&
Objects.equal(Uris.getRawUserInfo(uri), uri.getRawUserInfo()) &&
!Strings.isNullOrEmpty(uri.getHost()) &&
hasPort(uri) &&
Objects.equal(Uris.getRawPath(uri, strict), uri.getRawPath()) &&
Objects.equal(Uris.getRawQuery(uri, strict), uri.getRawQuery()) &&
Objects.equal(Uris.getRawFragment(uri, strict), uri.getRawFragment());
} | [
"public",
"static",
"boolean",
"isNormalized",
"(",
"final",
"URI",
"uri",
",",
"final",
"boolean",
"strict",
")",
"{",
"return",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"uri",
".",
"getScheme",
"(",
")",
")",
"&&",
"Objects",
".",
"equal",
"(",
"Uris... | Returns whether or not the given URI is normalized according to our rules.
@param uri the uri to check normalization status
@param strict whether or not to do strict escaping
@return true if the given uri is already normalized | [
"Returns",
"whether",
"or",
"not",
"the",
"given",
"URI",
"is",
"normalized",
"according",
"to",
"our",
"rules",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L453-L461 |
Azure/azure-sdk-for-java | privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java | PrivateZonesInner.listByResourceGroupAsync | public Observable<Page<PrivateZoneInner>> listByResourceGroupAsync(final String resourceGroupName, final Integer top) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, top)
.map(new Func1<ServiceResponse<Page<PrivateZoneInner>>, Page<PrivateZoneInner>>() {
@Override
public Page<PrivateZoneInner> call(ServiceResponse<Page<PrivateZoneInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<PrivateZoneInner>> listByResourceGroupAsync(final String resourceGroupName, final Integer top) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, top)
.map(new Func1<ServiceResponse<Page<PrivateZoneInner>>, Page<PrivateZoneInner>>() {
@Override
public Page<PrivateZoneInner> call(ServiceResponse<Page<PrivateZoneInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"PrivateZoneInner",
">",
">",
"listByResourceGroupAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"Integer",
"top",
")",
"{",
"return",
"listByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Lists the Private DNS zones within a resource group.
@param resourceGroupName The name of the resource group.
@param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<PrivateZoneInner> object | [
"Lists",
"the",
"Private",
"DNS",
"zones",
"within",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java#L1582-L1590 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java | Feature.setIntegerAttribute | public void setIntegerAttribute(String name, Integer value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof IntegerAttribute)) {
throw new IllegalStateException("Cannot set integer value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((IntegerAttribute) attribute).setValue(value);
} | java | public void setIntegerAttribute(String name, Integer value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof IntegerAttribute)) {
throw new IllegalStateException("Cannot set integer value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((IntegerAttribute) attribute).setValue(value);
} | [
"public",
"void",
"setIntegerAttribute",
"(",
"String",
"name",
",",
"Integer",
"value",
")",
"{",
"Attribute",
"attribute",
"=",
"getAttributes",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"!",
"(",
"attribute",
"instanceof",
"IntegerAttribute"... | Set attribute value of given type.
@param name attribute name
@param value attribute value | [
"Set",
"attribute",
"value",
"of",
"given",
"type",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java#L305-L312 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/rights/GranteeManager.java | GranteeManager.addRole | public Grantee addRole(HsqlName name) {
if (map.containsKey(name.name)) {
throw Error.error(ErrorCode.X_28503, name.name);
}
Grantee g = new Grantee(name, this);
g.isRole = true;
map.put(name.name, g);
roleMap.add(name.name, g);
return g;
} | java | public Grantee addRole(HsqlName name) {
if (map.containsKey(name.name)) {
throw Error.error(ErrorCode.X_28503, name.name);
}
Grantee g = new Grantee(name, this);
g.isRole = true;
map.put(name.name, g);
roleMap.add(name.name, g);
return g;
} | [
"public",
"Grantee",
"addRole",
"(",
"HsqlName",
"name",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"name",
".",
"name",
")",
")",
"{",
"throw",
"Error",
".",
"error",
"(",
"ErrorCode",
".",
"X_28503",
",",
"name",
".",
"name",
")",
";",
... | Creates a new Role object under management of this object. <p>
A set of constraints regarding user creation is imposed: <p>
<OL>
<LI>Can't create a role with name same as any right.
<LI>If this object's collection already contains an element whose
name attribute equals the name argument, then
a GRANTEE_ALREADY_EXISTS or ROLE_ALREADY_EXISTS Trace
is thrown.
(This will catch attempts to create Reserved grantee names).
</OL> | [
"Creates",
"a",
"new",
"Role",
"object",
"under",
"management",
"of",
"this",
"object",
".",
"<p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rights/GranteeManager.java#L513-L527 |
SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/qualitygate/QualityGateFinder.java | QualityGateFinder.getQualityGate | public Optional<QualityGateData> getQualityGate(DbSession dbSession, OrganizationDto organization, ComponentDto component) {
Optional<QualityGateData> res = dbClient.projectQgateAssociationDao().selectQGateIdByComponentId(dbSession, component.getId())
.map(qualityGateId -> dbClient.qualityGateDao().selectById(dbSession, qualityGateId))
.map(qualityGateDto -> new QualityGateData(qualityGateDto, false));
if (res.isPresent()) {
return res;
}
return ofNullable(dbClient.qualityGateDao().selectByOrganizationAndUuid(dbSession, organization, organization.getDefaultQualityGateUuid()))
.map(qualityGateDto -> new QualityGateData(qualityGateDto, true));
} | java | public Optional<QualityGateData> getQualityGate(DbSession dbSession, OrganizationDto organization, ComponentDto component) {
Optional<QualityGateData> res = dbClient.projectQgateAssociationDao().selectQGateIdByComponentId(dbSession, component.getId())
.map(qualityGateId -> dbClient.qualityGateDao().selectById(dbSession, qualityGateId))
.map(qualityGateDto -> new QualityGateData(qualityGateDto, false));
if (res.isPresent()) {
return res;
}
return ofNullable(dbClient.qualityGateDao().selectByOrganizationAndUuid(dbSession, organization, organization.getDefaultQualityGateUuid()))
.map(qualityGateDto -> new QualityGateData(qualityGateDto, true));
} | [
"public",
"Optional",
"<",
"QualityGateData",
">",
"getQualityGate",
"(",
"DbSession",
"dbSession",
",",
"OrganizationDto",
"organization",
",",
"ComponentDto",
"component",
")",
"{",
"Optional",
"<",
"QualityGateData",
">",
"res",
"=",
"dbClient",
".",
"projectQgat... | Return effective quality gate of a project.
It will first try to get the quality gate explicitly defined on a project, if none it will try to return default quality gate of the organization | [
"Return",
"effective",
"quality",
"gate",
"of",
"a",
"project",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/qualitygate/QualityGateFinder.java#L48-L57 |
windup/windup | rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/ast/TypeInterestFactory.java | TypeInterestFactory.registerInterest | public static void registerInterest(String sourceKey, String regex, String rewritePattern, TypeReferenceLocation... locations)
{
patternsBySource.put(sourceKey, new PatternAndLocation(locations, regex, rewritePattern));
} | java | public static void registerInterest(String sourceKey, String regex, String rewritePattern, TypeReferenceLocation... locations)
{
patternsBySource.put(sourceKey, new PatternAndLocation(locations, regex, rewritePattern));
} | [
"public",
"static",
"void",
"registerInterest",
"(",
"String",
"sourceKey",
",",
"String",
"regex",
",",
"String",
"rewritePattern",
",",
"TypeReferenceLocation",
"...",
"locations",
")",
"{",
"patternsBySource",
".",
"put",
"(",
"sourceKey",
",",
"new",
"PatternA... | Register a regex pattern to filter interest in certain Java types.
@param sourceKey Identifier of who gave the pattern to us (so that we can update it).
This can be any arbitrary string. | [
"Register",
"a",
"regex",
"pattern",
"to",
"filter",
"interest",
"in",
"certain",
"Java",
"types",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/ast/TypeInterestFactory.java#L98-L101 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java | SecStrucCalc.calc_H | @SuppressWarnings("unused")
private static Atom calc_H(Atom C, Atom N, Atom CA)
throws StructureException {
Atom nc = Calc.subtract(N,C);
Atom nca = Calc.subtract(N,CA);
Atom u_nc = Calc.unitVector(nc) ;
Atom u_nca = Calc.unitVector(nca);
Atom added = Calc.add(u_nc,u_nca);
Atom U = Calc.unitVector(added);
// according to Creighton distance N-H is 1.03 +/- 0.02A
Atom H = Calc.add(N,U);
H.setName("H");
// this atom does not have a pdbserial number ...
return H;
} | java | @SuppressWarnings("unused")
private static Atom calc_H(Atom C, Atom N, Atom CA)
throws StructureException {
Atom nc = Calc.subtract(N,C);
Atom nca = Calc.subtract(N,CA);
Atom u_nc = Calc.unitVector(nc) ;
Atom u_nca = Calc.unitVector(nca);
Atom added = Calc.add(u_nc,u_nca);
Atom U = Calc.unitVector(added);
// according to Creighton distance N-H is 1.03 +/- 0.02A
Atom H = Calc.add(N,U);
H.setName("H");
// this atom does not have a pdbserial number ...
return H;
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"static",
"Atom",
"calc_H",
"(",
"Atom",
"C",
",",
"Atom",
"N",
",",
"Atom",
"CA",
")",
"throws",
"StructureException",
"{",
"Atom",
"nc",
"=",
"Calc",
".",
"subtract",
"(",
"N",
",",
"C",
")"... | Use unit vectors NC and NCalpha Add them. Calc unit vector and
substract it from N.
C coordinates are from amino acid i-1
N, CA atoms from amino acid i
@link http://openbioinformatics.blogspot.com/
2009/08/how-to-calculate-h-atoms-for-nitrogens.html | [
"Use",
"unit",
"vectors",
"NC",
"and",
"NCalpha",
"Add",
"them",
".",
"Calc",
"unit",
"vector",
"and",
"substract",
"it",
"from",
"N",
".",
"C",
"coordinates",
"are",
"from",
"amino",
"acid",
"i",
"-",
"1",
"N",
"CA",
"atoms",
"from",
"amino",
"acid",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java#L1011-L1032 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTimeoutWarningRenderer.java | WTimeoutWarningRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTimeoutWarning warning = (WTimeoutWarning) component;
XmlStringBuilder xml = renderContext.getWriter();
final int timoutPeriod = warning.getTimeoutPeriod();
if (timoutPeriod > 0) {
xml.appendTagOpen("ui:session");
xml.appendAttribute("timeout", String.valueOf(timoutPeriod));
int warningPeriod = warning.getWarningPeriod();
xml.appendOptionalAttribute("warn", warningPeriod > 0, warningPeriod);
xml.appendEnd();
}
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTimeoutWarning warning = (WTimeoutWarning) component;
XmlStringBuilder xml = renderContext.getWriter();
final int timoutPeriod = warning.getTimeoutPeriod();
if (timoutPeriod > 0) {
xml.appendTagOpen("ui:session");
xml.appendAttribute("timeout", String.valueOf(timoutPeriod));
int warningPeriod = warning.getWarningPeriod();
xml.appendOptionalAttribute("warn", warningPeriod > 0, warningPeriod);
xml.appendEnd();
}
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WTimeoutWarning",
"warning",
"=",
"(",
"WTimeoutWarning",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
... | Paints the given WTimeoutWarning if the component's timeout period is greater than 0.
@param component the WTimeoutWarning to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WTimeoutWarning",
"if",
"the",
"component",
"s",
"timeout",
"period",
"is",
"greater",
"than",
"0",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTimeoutWarningRenderer.java#L22-L36 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java | RuleBasedBreakIterator.checkOffset | protected static final void checkOffset(int offset, CharacterIterator text) {
if (offset < text.getBeginIndex() || offset > text.getEndIndex()) {
throw new IllegalArgumentException("offset out of bounds");
}
} | java | protected static final void checkOffset(int offset, CharacterIterator text) {
if (offset < text.getBeginIndex() || offset > text.getEndIndex()) {
throw new IllegalArgumentException("offset out of bounds");
}
} | [
"protected",
"static",
"final",
"void",
"checkOffset",
"(",
"int",
"offset",
",",
"CharacterIterator",
"text",
")",
"{",
"if",
"(",
"offset",
"<",
"text",
".",
"getBeginIndex",
"(",
")",
"||",
"offset",
">",
"text",
".",
"getEndIndex",
"(",
")",
")",
"{"... | Throw IllegalArgumentException unless begin <= offset < end. | [
"Throw",
"IllegalArgumentException",
"unless",
"begin",
"<",
";",
"=",
"offset",
"<",
";",
"end",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedBreakIterator.java#L893-L897 |
mbrade/prefixedproperties | pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java | PrefixedPropertiesPersister.loadFromYAML | public void loadFromYAML(final Properties props, final InputStream is) throws IOException {
try {
((PrefixedProperties) props).loadFromYAML(is);
} catch (final NoSuchMethodError err) {
throw new IOException(
"Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage());
}
} | java | public void loadFromYAML(final Properties props, final InputStream is) throws IOException {
try {
((PrefixedProperties) props).loadFromYAML(is);
} catch (final NoSuchMethodError err) {
throw new IOException(
"Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage());
}
} | [
"public",
"void",
"loadFromYAML",
"(",
"final",
"Properties",
"props",
",",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"try",
"{",
"(",
"(",
"PrefixedProperties",
")",
"props",
")",
".",
"loadFromYAML",
"(",
"is",
")",
";",
"}",
"catc... | Loads from json.
@param props
the props
@param is
the is
@throws IOException
Signals that an I/O exception has occurred. | [
"Loads",
"from",
"json",
"."
] | train | https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java#L90-L97 |
netty/netty | example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java | HttpUploadClient.formget | private static List<Entry<String, String>> formget(
Bootstrap bootstrap, String host, int port, String get, URI uriSimple) throws Exception {
// XXX /formget
// No use of HttpPostRequestEncoder since not a POST
Channel channel = bootstrap.connect(host, port).sync().channel();
// Prepare the HTTP request.
QueryStringEncoder encoder = new QueryStringEncoder(get);
// add Form attribute
encoder.addParam("getform", "GET");
encoder.addParam("info", "first value");
encoder.addParam("secondinfo", "secondvalue ���&");
// not the big one since it is not compatible with GET size
// encoder.addParam("thirdinfo", textArea);
encoder.addParam("thirdinfo", "third value\r\ntest second line\r\n\r\nnew line\r\n");
encoder.addParam("Send", "Send");
URI uriGet = new URI(encoder.toString());
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uriGet.toASCIIString());
HttpHeaders headers = request.headers();
headers.set(HttpHeaderNames.HOST, host);
headers.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
headers.set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP + "," + HttpHeaderValues.DEFLATE);
headers.set(HttpHeaderNames.ACCEPT_CHARSET, "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
headers.set(HttpHeaderNames.ACCEPT_LANGUAGE, "fr");
headers.set(HttpHeaderNames.REFERER, uriSimple.toString());
headers.set(HttpHeaderNames.USER_AGENT, "Netty Simple Http Client side");
headers.set(HttpHeaderNames.ACCEPT, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
//connection will not close but needed
// headers.set("Connection","keep-alive");
// headers.set("Keep-Alive","300");
headers.set(
HttpHeaderNames.COOKIE, ClientCookieEncoder.STRICT.encode(
new DefaultCookie("my-cookie", "foo"),
new DefaultCookie("another-cookie", "bar"))
);
// send request
channel.writeAndFlush(request);
// Wait for the server to close the connection.
channel.closeFuture().sync();
// convert headers to list
return headers.entries();
} | java | private static List<Entry<String, String>> formget(
Bootstrap bootstrap, String host, int port, String get, URI uriSimple) throws Exception {
// XXX /formget
// No use of HttpPostRequestEncoder since not a POST
Channel channel = bootstrap.connect(host, port).sync().channel();
// Prepare the HTTP request.
QueryStringEncoder encoder = new QueryStringEncoder(get);
// add Form attribute
encoder.addParam("getform", "GET");
encoder.addParam("info", "first value");
encoder.addParam("secondinfo", "secondvalue ���&");
// not the big one since it is not compatible with GET size
// encoder.addParam("thirdinfo", textArea);
encoder.addParam("thirdinfo", "third value\r\ntest second line\r\n\r\nnew line\r\n");
encoder.addParam("Send", "Send");
URI uriGet = new URI(encoder.toString());
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uriGet.toASCIIString());
HttpHeaders headers = request.headers();
headers.set(HttpHeaderNames.HOST, host);
headers.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
headers.set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP + "," + HttpHeaderValues.DEFLATE);
headers.set(HttpHeaderNames.ACCEPT_CHARSET, "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
headers.set(HttpHeaderNames.ACCEPT_LANGUAGE, "fr");
headers.set(HttpHeaderNames.REFERER, uriSimple.toString());
headers.set(HttpHeaderNames.USER_AGENT, "Netty Simple Http Client side");
headers.set(HttpHeaderNames.ACCEPT, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
//connection will not close but needed
// headers.set("Connection","keep-alive");
// headers.set("Keep-Alive","300");
headers.set(
HttpHeaderNames.COOKIE, ClientCookieEncoder.STRICT.encode(
new DefaultCookie("my-cookie", "foo"),
new DefaultCookie("another-cookie", "bar"))
);
// send request
channel.writeAndFlush(request);
// Wait for the server to close the connection.
channel.closeFuture().sync();
// convert headers to list
return headers.entries();
} | [
"private",
"static",
"List",
"<",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"formget",
"(",
"Bootstrap",
"bootstrap",
",",
"String",
"host",
",",
"int",
"port",
",",
"String",
"get",
",",
"URI",
"uriSimple",
")",
"throws",
"Exception",
"{",
"// XX... | Standard usage of HTTP API in Netty without file Upload (get is not able to achieve File upload
due to limitation on request size).
@return the list of headers that will be used in every example after | [
"Standard",
"usage",
"of",
"HTTP",
"API",
"in",
"Netty",
"without",
"file",
"Upload",
"(",
"get",
"is",
"not",
"able",
"to",
"achieve",
"File",
"upload",
"due",
"to",
"limitation",
"on",
"request",
"size",
")",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java#L149-L197 |
codelibs/jcifs | src/main/java/jcifs/smb1/Config.java | Config.getInetAddress | public static InetAddress getInetAddress( String key, InetAddress def ) {
String addr = prp.getProperty( key );
if( addr != null ) {
try {
def = InetAddress.getByName( addr );
} catch( UnknownHostException uhe ) {
if( log.level > 0 ) {
log.println( addr );
uhe.printStackTrace( log );
}
}
}
return def;
} | java | public static InetAddress getInetAddress( String key, InetAddress def ) {
String addr = prp.getProperty( key );
if( addr != null ) {
try {
def = InetAddress.getByName( addr );
} catch( UnknownHostException uhe ) {
if( log.level > 0 ) {
log.println( addr );
uhe.printStackTrace( log );
}
}
}
return def;
} | [
"public",
"static",
"InetAddress",
"getInetAddress",
"(",
"String",
"key",
",",
"InetAddress",
"def",
")",
"{",
"String",
"addr",
"=",
"prp",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"addr",
"!=",
"null",
")",
"{",
"try",
"{",
"def",
"=",
... | Retrieve an <code>InetAddress</code>. If the address is not
an IP address and cannot be resolved <code>null</code> will
be returned. | [
"Retrieve",
"an",
"<code",
">",
"InetAddress<",
"/",
"code",
">",
".",
"If",
"the",
"address",
"is",
"not",
"an",
"IP",
"address",
"and",
"cannot",
"be",
"resolved",
"<code",
">",
"null<",
"/",
"code",
">",
"will",
"be",
"returned",
"."
] | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/Config.java#L278-L291 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/ApplicationMetadata.java | ApplicationMetadata.addEntityMetadata | public void addEntityMetadata(String persistenceUnit, Class<?> clazz, EntityMetadata entityMetadata)
{
Metamodel metamodel = getMetamodelMap().get(persistenceUnit);
Map<String, EntityMetadata> entityClassToMetadataMap = ((MetamodelImpl) metamodel).getEntityMetadataMap();
if (entityClassToMetadataMap == null || entityClassToMetadataMap.isEmpty())
{
entityClassToMetadataMap.put(clazz.getName(), entityMetadata);
}
else
{
if (logger.isDebugEnabled())
logger.debug("Entity meta model already exists for persistence unit " + persistenceUnit + " and class "
+ clazz + ". Noting needs to be done");
}
} | java | public void addEntityMetadata(String persistenceUnit, Class<?> clazz, EntityMetadata entityMetadata)
{
Metamodel metamodel = getMetamodelMap().get(persistenceUnit);
Map<String, EntityMetadata> entityClassToMetadataMap = ((MetamodelImpl) metamodel).getEntityMetadataMap();
if (entityClassToMetadataMap == null || entityClassToMetadataMap.isEmpty())
{
entityClassToMetadataMap.put(clazz.getName(), entityMetadata);
}
else
{
if (logger.isDebugEnabled())
logger.debug("Entity meta model already exists for persistence unit " + persistenceUnit + " and class "
+ clazz + ". Noting needs to be done");
}
} | [
"public",
"void",
"addEntityMetadata",
"(",
"String",
"persistenceUnit",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"EntityMetadata",
"entityMetadata",
")",
"{",
"Metamodel",
"metamodel",
"=",
"getMetamodelMap",
"(",
")",
".",
"get",
"(",
"persistenceUnit",
")",... | Adds the entity metadata.
@param persistenceUnit
the persistence unit
@param clazz
the clazz
@param entityMetadata
the entity metadata | [
"Adds",
"the",
"entity",
"metadata",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/ApplicationMetadata.java#L75-L89 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java | JournalReader.readJournalEntry | protected ConsumerJournalEntry readJournalEntry(XMLEventReader reader)
throws JournalException, XMLStreamException {
StartElement startTag = getJournalEntryStartTag(reader);
String methodName =
getRequiredAttributeValue(startTag, QNAME_ATTR_METHOD);
JournalEntryContext context =
new ContextXmlReader().readContext(reader);
ConsumerJournalEntry cje =
new ConsumerJournalEntry(methodName, context);
readArguments(reader, cje);
return cje;
} | java | protected ConsumerJournalEntry readJournalEntry(XMLEventReader reader)
throws JournalException, XMLStreamException {
StartElement startTag = getJournalEntryStartTag(reader);
String methodName =
getRequiredAttributeValue(startTag, QNAME_ATTR_METHOD);
JournalEntryContext context =
new ContextXmlReader().readContext(reader);
ConsumerJournalEntry cje =
new ConsumerJournalEntry(methodName, context);
readArguments(reader, cje);
return cje;
} | [
"protected",
"ConsumerJournalEntry",
"readJournalEntry",
"(",
"XMLEventReader",
"reader",
")",
"throws",
"JournalException",
",",
"XMLStreamException",
"{",
"StartElement",
"startTag",
"=",
"getJournalEntryStartTag",
"(",
"reader",
")",
";",
"String",
"methodName",
"=",
... | Read a JournalEntry from the journal, to produce a
<code>ConsumerJournalEntry</code> instance. Concrete sub-classes should
insure that the XMLEventReader is positioned at the beginning of a
JournalEntry before calling this method. | [
"Read",
"a",
"JournalEntry",
"from",
"the",
"journal",
"to",
"produce",
"a",
"<code",
">",
"ConsumerJournalEntry<",
"/",
"code",
">",
"instance",
".",
"Concrete",
"sub",
"-",
"classes",
"should",
"insure",
"that",
"the",
"XMLEventReader",
"is",
"positioned",
"... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java#L199-L213 |
Netflix/governator | governator-core/src/main/java/com/netflix/governator/internal/PreDestroyMonitor.java | PreDestroyMonitor.addScopeBindings | public void addScopeBindings(Map<Class<? extends Annotation>, Scope> bindings) {
if (scopeCleaner.isRunning()) {
scopeBindings.putAll(bindings);
}
} | java | public void addScopeBindings(Map<Class<? extends Annotation>, Scope> bindings) {
if (scopeCleaner.isRunning()) {
scopeBindings.putAll(bindings);
}
} | [
"public",
"void",
"addScopeBindings",
"(",
"Map",
"<",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
",",
"Scope",
">",
"bindings",
")",
"{",
"if",
"(",
"scopeCleaner",
".",
"isRunning",
"(",
")",
")",
"{",
"scopeBindings",
".",
"putAll",
"(",
"bindin... | allows late-binding of scopes to PreDestroyMonitor, useful if more than one
Injector contributes scope bindings
@param bindings additional annotation-to-scope bindings to add | [
"allows",
"late",
"-",
"binding",
"of",
"scopes",
"to",
"PreDestroyMonitor",
"useful",
"if",
"more",
"than",
"one",
"Injector",
"contributes",
"scope",
"bindings"
] | train | https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/internal/PreDestroyMonitor.java#L181-L185 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java | EvaluationCalibration.getReliabilityDiagram | public ReliabilityDiagram getReliabilityDiagram(int classIdx) {
INDArray totalCountBins = rDiagBinTotalCount.getColumn(classIdx);
INDArray countPositiveBins = rDiagBinPosCount.getColumn(classIdx);
double[] meanPredictionBins = rDiagBinSumPredictions.getColumn(classIdx).castTo(DataType.DOUBLE)
.div(totalCountBins.castTo(DataType.DOUBLE)).data().asDouble();
double[] fracPositives = countPositiveBins.castTo(DataType.DOUBLE).div(totalCountBins.castTo(DataType.DOUBLE)).data().asDouble();
if (excludeEmptyBins) {
val condition = new MatchCondition(totalCountBins, Conditions.equals(0));
int numZeroBins = Nd4j.getExecutioner().exec(condition).getInt(0);
if (numZeroBins != 0) {
double[] mpb = meanPredictionBins;
double[] fp = fracPositives;
// FIXME: int cast
meanPredictionBins = new double[(int) (totalCountBins.length() - numZeroBins)];
fracPositives = new double[meanPredictionBins.length];
int j = 0;
for (int i = 0; i < mpb.length; i++) {
if (totalCountBins.getDouble(i) != 0) {
meanPredictionBins[j] = mpb[i];
fracPositives[j] = fp[i];
j++;
}
}
}
}
String title = "Reliability Diagram: Class " + classIdx;
return new ReliabilityDiagram(title, meanPredictionBins, fracPositives);
} | java | public ReliabilityDiagram getReliabilityDiagram(int classIdx) {
INDArray totalCountBins = rDiagBinTotalCount.getColumn(classIdx);
INDArray countPositiveBins = rDiagBinPosCount.getColumn(classIdx);
double[] meanPredictionBins = rDiagBinSumPredictions.getColumn(classIdx).castTo(DataType.DOUBLE)
.div(totalCountBins.castTo(DataType.DOUBLE)).data().asDouble();
double[] fracPositives = countPositiveBins.castTo(DataType.DOUBLE).div(totalCountBins.castTo(DataType.DOUBLE)).data().asDouble();
if (excludeEmptyBins) {
val condition = new MatchCondition(totalCountBins, Conditions.equals(0));
int numZeroBins = Nd4j.getExecutioner().exec(condition).getInt(0);
if (numZeroBins != 0) {
double[] mpb = meanPredictionBins;
double[] fp = fracPositives;
// FIXME: int cast
meanPredictionBins = new double[(int) (totalCountBins.length() - numZeroBins)];
fracPositives = new double[meanPredictionBins.length];
int j = 0;
for (int i = 0; i < mpb.length; i++) {
if (totalCountBins.getDouble(i) != 0) {
meanPredictionBins[j] = mpb[i];
fracPositives[j] = fp[i];
j++;
}
}
}
}
String title = "Reliability Diagram: Class " + classIdx;
return new ReliabilityDiagram(title, meanPredictionBins, fracPositives);
} | [
"public",
"ReliabilityDiagram",
"getReliabilityDiagram",
"(",
"int",
"classIdx",
")",
"{",
"INDArray",
"totalCountBins",
"=",
"rDiagBinTotalCount",
".",
"getColumn",
"(",
"classIdx",
")",
";",
"INDArray",
"countPositiveBins",
"=",
"rDiagBinPosCount",
".",
"getColumn",
... | Get the reliability diagram for the specified class
@param classIdx Index of the class to get the reliability diagram for | [
"Get",
"the",
"reliability",
"diagram",
"for",
"the",
"specified",
"class"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java#L371-L403 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ProxySelectorImpl.java | ProxySelectorImpl.isNonProxyHost | private boolean isNonProxyHost(String host, String nonProxyHosts) {
if (host == null || nonProxyHosts == null) {
return false;
}
// construct pattern
StringBuilder patternBuilder = new StringBuilder();
for (int i = 0; i < nonProxyHosts.length(); i++) {
char c = nonProxyHosts.charAt(i);
switch (c) {
case '.':
patternBuilder.append("\\.");
break;
case '*':
patternBuilder.append(".*");
break;
default:
patternBuilder.append(c);
}
}
// check whether the host is the nonProxyHosts.
String pattern = patternBuilder.toString();
return host.matches(pattern);
} | java | private boolean isNonProxyHost(String host, String nonProxyHosts) {
if (host == null || nonProxyHosts == null) {
return false;
}
// construct pattern
StringBuilder patternBuilder = new StringBuilder();
for (int i = 0; i < nonProxyHosts.length(); i++) {
char c = nonProxyHosts.charAt(i);
switch (c) {
case '.':
patternBuilder.append("\\.");
break;
case '*':
patternBuilder.append(".*");
break;
default:
patternBuilder.append(c);
}
}
// check whether the host is the nonProxyHosts.
String pattern = patternBuilder.toString();
return host.matches(pattern);
} | [
"private",
"boolean",
"isNonProxyHost",
"(",
"String",
"host",
",",
"String",
"nonProxyHosts",
")",
"{",
"if",
"(",
"host",
"==",
"null",
"||",
"nonProxyHosts",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"// construct pattern",
"StringBuilder",
"patt... | Returns true if the {@code nonProxyHosts} system property pattern exists
and matches {@code host}. | [
"Returns",
"true",
"if",
"the",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ProxySelectorImpl.java#L119-L142 |
real-logic/simple-binary-encoding | sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java | XmlSchemaParser.handleWarning | public static void handleWarning(final Node node, final String msg)
{
final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY);
if (handler == null)
{
throw new IllegalStateException("WARNING: " + formatLocationInfo(node) + msg);
}
else
{
handler.warning(formatLocationInfo(node) + msg);
}
} | java | public static void handleWarning(final Node node, final String msg)
{
final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY);
if (handler == null)
{
throw new IllegalStateException("WARNING: " + formatLocationInfo(node) + msg);
}
else
{
handler.warning(formatLocationInfo(node) + msg);
}
} | [
"public",
"static",
"void",
"handleWarning",
"(",
"final",
"Node",
"node",
",",
"final",
"String",
"msg",
")",
"{",
"final",
"ErrorHandler",
"handler",
"=",
"(",
"ErrorHandler",
")",
"node",
".",
"getOwnerDocument",
"(",
")",
".",
"getUserData",
"(",
"ERROR_... | Handle a warning condition as a consequence of parsing.
@param node as the context for the warning.
@param msg associated with the warning. | [
"Handle",
"a",
"warning",
"condition",
"as",
"a",
"consequence",
"of",
"parsing",
"."
] | train | https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L258-L270 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/util/TextUtils.java | TextUtils.endsWith | public static boolean endsWith(final boolean caseSensitive, final CharSequence text, final char[] suffix) {
return endsWith(caseSensitive, text, 0, text.length(), suffix, 0, suffix.length);
} | java | public static boolean endsWith(final boolean caseSensitive, final CharSequence text, final char[] suffix) {
return endsWith(caseSensitive, text, 0, text.length(), suffix, 0, suffix.length);
} | [
"public",
"static",
"boolean",
"endsWith",
"(",
"final",
"boolean",
"caseSensitive",
",",
"final",
"CharSequence",
"text",
",",
"final",
"char",
"[",
"]",
"suffix",
")",
"{",
"return",
"endsWith",
"(",
"caseSensitive",
",",
"text",
",",
"0",
",",
"text",
"... | <p>
Checks whether a text ends with a specified suffix.
</p>
@param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way.
@param text the text to be checked for suffixes.
@param suffix the suffix to be searched.
@return whether the text ends with the suffix or not. | [
"<p",
">",
"Checks",
"whether",
"a",
"text",
"ends",
"with",
"a",
"specified",
"suffix",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/TextUtils.java#L708-L710 |
codelibs/jcifs | src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java | NtlmPasswordAuthentication.getUserSessionKey | void getUserSessionKey(byte[] challenge, byte[] dest, int offset) throws SmbException {
if (hashesExternal) return;
try {
MD4 md4 = new MD4();
md4.update(password.getBytes(SmbConstants.UNI_ENCODING));
switch (LM_COMPATIBILITY) {
case 0:
case 1:
case 2:
md4.update(md4.digest());
md4.digest(dest, offset, 16);
break;
case 3:
case 4:
case 5:
if( clientChallenge == null ) {
clientChallenge = new byte[8];
RANDOM.nextBytes( clientChallenge );
}
HMACT64 hmac = new HMACT64(md4.digest());
hmac.update(username.toUpperCase().getBytes(
SmbConstants.UNI_ENCODING));
hmac.update(domain.toUpperCase().getBytes(
SmbConstants.UNI_ENCODING));
byte[] ntlmv2Hash = hmac.digest();
hmac = new HMACT64(ntlmv2Hash);
hmac.update(challenge);
hmac.update(clientChallenge);
HMACT64 userKey = new HMACT64(ntlmv2Hash);
userKey.update(hmac.digest());
userKey.digest(dest, offset, 16);
break;
default:
md4.update(md4.digest());
md4.digest(dest, offset, 16);
break;
}
} catch (Exception e) {
throw new SmbException("", e);
}
} | java | void getUserSessionKey(byte[] challenge, byte[] dest, int offset) throws SmbException {
if (hashesExternal) return;
try {
MD4 md4 = new MD4();
md4.update(password.getBytes(SmbConstants.UNI_ENCODING));
switch (LM_COMPATIBILITY) {
case 0:
case 1:
case 2:
md4.update(md4.digest());
md4.digest(dest, offset, 16);
break;
case 3:
case 4:
case 5:
if( clientChallenge == null ) {
clientChallenge = new byte[8];
RANDOM.nextBytes( clientChallenge );
}
HMACT64 hmac = new HMACT64(md4.digest());
hmac.update(username.toUpperCase().getBytes(
SmbConstants.UNI_ENCODING));
hmac.update(domain.toUpperCase().getBytes(
SmbConstants.UNI_ENCODING));
byte[] ntlmv2Hash = hmac.digest();
hmac = new HMACT64(ntlmv2Hash);
hmac.update(challenge);
hmac.update(clientChallenge);
HMACT64 userKey = new HMACT64(ntlmv2Hash);
userKey.update(hmac.digest());
userKey.digest(dest, offset, 16);
break;
default:
md4.update(md4.digest());
md4.digest(dest, offset, 16);
break;
}
} catch (Exception e) {
throw new SmbException("", e);
}
} | [
"void",
"getUserSessionKey",
"(",
"byte",
"[",
"]",
"challenge",
",",
"byte",
"[",
"]",
"dest",
",",
"int",
"offset",
")",
"throws",
"SmbException",
"{",
"if",
"(",
"hashesExternal",
")",
"return",
";",
"try",
"{",
"MD4",
"md4",
"=",
"new",
"MD4",
"(",... | Calculates the effective user session key.
@param challenge The server challenge.
@param dest The destination array in which the user session key will be
placed.
@param offset The offset in the destination array at which the
session key will start. | [
"Calculates",
"the",
"effective",
"user",
"session",
"key",
"."
] | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/NtlmPasswordAuthentication.java#L515-L556 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F1.compose | public <X1, X2, X3> F3<X1, X2, X3, R>
compose(final Func3<? super X1, ? super X2, ? super X3, ? extends P1> before) {
final F1<P1, R> me = this;
return new F3<X1, X2, X3, R>() {
@Override
public R apply(X1 x1, X2 x2, X3 x3) {
return me.apply(before.apply(x1, x2, x3));
}
};
} | java | public <X1, X2, X3> F3<X1, X2, X3, R>
compose(final Func3<? super X1, ? super X2, ? super X3, ? extends P1> before) {
final F1<P1, R> me = this;
return new F3<X1, X2, X3, R>() {
@Override
public R apply(X1 x1, X2 x2, X3 x3) {
return me.apply(before.apply(x1, x2, x3));
}
};
} | [
"public",
"<",
"X1",
",",
"X2",
",",
"X3",
">",
"F3",
"<",
"X1",
",",
"X2",
",",
"X3",
",",
"R",
">",
"compose",
"(",
"final",
"Func3",
"<",
"?",
"super",
"X1",
",",
"?",
"super",
"X2",
",",
"?",
"super",
"X3",
",",
"?",
"extends",
"P1",
">... | Returns an {@code F3<X1, X2, X3, R>>} function by composing the specified
{@code Func3<X1, X2, X3, P1>} function with this function applied last
@param <X1>
the type of first param the new function applied to
@param <X2>
the type of second param the new function applied to
@param <X3>
the type of third param the new function applied to
@param before
the function to be applied first when applying the return function
@return an new function such that f(x1, x2, x3) == apply(f1(x1, x2, x3)) | [
"Returns",
"an",
"{",
"@code",
"F3<",
";",
"X1",
"X2",
"X3",
"R>",
";",
">",
"}",
"function",
"by",
"composing",
"the",
"specified",
"{",
"@code",
"Func3<X1",
"X2",
"X3",
"P1>",
";",
"}",
"function",
"with",
"this",
"function",
"applied",
"last"
... | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L701-L710 |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcConfigurationReader.java | CmsUgcConfigurationReader.getLongValue | private Optional<Long> getLongValue(String path) {
String stringValue = getStringValue(path);
if (stringValue == null) {
return Optional.absent();
} else {
try {
return Optional.<Long> of(Long.valueOf(stringValue.trim()));
} catch (NumberFormatException e) {
throw new NumberFormatException("Could not read a number from " + path + " ,value= " + stringValue);
}
}
} | java | private Optional<Long> getLongValue(String path) {
String stringValue = getStringValue(path);
if (stringValue == null) {
return Optional.absent();
} else {
try {
return Optional.<Long> of(Long.valueOf(stringValue.trim()));
} catch (NumberFormatException e) {
throw new NumberFormatException("Could not read a number from " + path + " ,value= " + stringValue);
}
}
} | [
"private",
"Optional",
"<",
"Long",
">",
"getLongValue",
"(",
"String",
"path",
")",
"{",
"String",
"stringValue",
"=",
"getStringValue",
"(",
"path",
")",
";",
"if",
"(",
"stringValue",
"==",
"null",
")",
"{",
"return",
"Optional",
".",
"absent",
"(",
"... | Parses an optional long value.<p>
@param path the xpath of the content element
@return the optional long value in that field | [
"Parses",
"an",
"optional",
"long",
"value",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcConfigurationReader.java#L193-L205 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.notNull | public static <T> T notNull (final T aValue, final String sName)
{
if (isEnabled ())
if (aValue == null)
throw new NullPointerException ("The value of '" + sName + "' may not be null!");
return aValue;
} | java | public static <T> T notNull (final T aValue, final String sName)
{
if (isEnabled ())
if (aValue == null)
throw new NullPointerException ("The value of '" + sName + "' may not be null!");
return aValue;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"notNull",
"(",
"final",
"T",
"aValue",
",",
"final",
"String",
"sName",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"if",
"(",
"aValue",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"... | Check that the passed value is not <code>null</code>.
@param <T>
Type to be checked and returned
@param aValue
The value to check.
@param sName
The name of the value (e.g. the parameter name)
@return The passed value.
@throws NullPointerException
if the passed value is <code>null</code>. | [
"Check",
"that",
"the",
"passed",
"value",
"is",
"not",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L273-L279 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/SafeDatasetCommit.java | SafeDatasetCommit.setTaskFailureException | public static void setTaskFailureException(Collection<? extends WorkUnitState> taskStates, Throwable t) {
for (WorkUnitState taskState : taskStates) {
((TaskState) taskState).setTaskFailureException(t);
}
} | java | public static void setTaskFailureException(Collection<? extends WorkUnitState> taskStates, Throwable t) {
for (WorkUnitState taskState : taskStates) {
((TaskState) taskState).setTaskFailureException(t);
}
} | [
"public",
"static",
"void",
"setTaskFailureException",
"(",
"Collection",
"<",
"?",
"extends",
"WorkUnitState",
">",
"taskStates",
",",
"Throwable",
"t",
")",
"{",
"for",
"(",
"WorkUnitState",
"taskState",
":",
"taskStates",
")",
"{",
"(",
"(",
"TaskState",
")... | Sets the {@link ConfigurationKeys#TASK_FAILURE_EXCEPTION_KEY} for each given {@link TaskState} to the given
{@link Throwable}.
Make this method public as this exception catching routine can be reusable in other occasions as well. | [
"Sets",
"the",
"{",
"@link",
"ConfigurationKeys#TASK_FAILURE_EXCEPTION_KEY",
"}",
"for",
"each",
"given",
"{",
"@link",
"TaskState",
"}",
"to",
"the",
"given",
"{",
"@link",
"Throwable",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/SafeDatasetCommit.java#L427-L431 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/AgentPoolsInner.java | AgentPoolsInner.beginCreateOrUpdateAsync | public Observable<AgentPoolInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedClusterName, String agentPoolName, AgentPoolInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedClusterName, agentPoolName, parameters).map(new Func1<ServiceResponse<AgentPoolInner>, AgentPoolInner>() {
@Override
public AgentPoolInner call(ServiceResponse<AgentPoolInner> response) {
return response.body();
}
});
} | java | public Observable<AgentPoolInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedClusterName, String agentPoolName, AgentPoolInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedClusterName, agentPoolName, parameters).map(new Func1<ServiceResponse<AgentPoolInner>, AgentPoolInner>() {
@Override
public AgentPoolInner call(ServiceResponse<AgentPoolInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AgentPoolInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedClusterName",
",",
"String",
"agentPoolName",
",",
"AgentPoolInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceR... | Creates or updates an agent pool.
Creates or updates an agent pool in the specified managed cluster.
@param resourceGroupName The name of the resource group.
@param managedClusterName The name of the managed cluster resource.
@param agentPoolName The name of the agent pool.
@param parameters Parameters supplied to the Create or Update an agent pool operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AgentPoolInner object | [
"Creates",
"or",
"updates",
"an",
"agent",
"pool",
".",
"Creates",
"or",
"updates",
"an",
"agent",
"pool",
"in",
"the",
"specified",
"managed",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/AgentPoolsInner.java#L445-L452 |
rapid7/conqueso-client-java | src/main/java/com/rapid7/conqueso/client/ConquesoClient.java | ConquesoClient.getRoleInstances | public ImmutableList<InstanceInfo> getRoleInstances(String roleName) {
return getRoleInstancesWithMetadataImpl(roleName, Collections.<String, String>emptyMap());
} | java | public ImmutableList<InstanceInfo> getRoleInstances(String roleName) {
return getRoleInstancesWithMetadataImpl(roleName, Collections.<String, String>emptyMap());
} | [
"public",
"ImmutableList",
"<",
"InstanceInfo",
">",
"getRoleInstances",
"(",
"String",
"roleName",
")",
"{",
"return",
"getRoleInstancesWithMetadataImpl",
"(",
"roleName",
",",
"Collections",
".",
"<",
"String",
",",
"String",
">",
"emptyMap",
"(",
")",
")",
";... | Retrieve information about instances of a particular role from the Conqueso Server.
@param roleName the role to retrieve
@return the information about the instances of the given role
@throws ConquesoCommunicationException if there's an error communicating with the Conqueso Server. | [
"Retrieve",
"information",
"about",
"instances",
"of",
"a",
"particular",
"role",
"from",
"the",
"Conqueso",
"Server",
"."
] | train | https://github.com/rapid7/conqueso-client-java/blob/fa4a7a6dbf67e5afe6b4f68cbc97b1929af864e2/src/main/java/com/rapid7/conqueso/client/ConquesoClient.java#L512-L514 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java | SpiderService.linkColumnName | public static String linkColumnName(FieldDefinition linkDef, String objID) {
assert linkDef.isLinkField();
StringBuilder buffer = new StringBuilder();
buffer.append("~");
buffer.append(linkDef.getName());
buffer.append("/");
buffer.append(objID);
return buffer.toString();
} | java | public static String linkColumnName(FieldDefinition linkDef, String objID) {
assert linkDef.isLinkField();
StringBuilder buffer = new StringBuilder();
buffer.append("~");
buffer.append(linkDef.getName());
buffer.append("/");
buffer.append(objID);
return buffer.toString();
} | [
"public",
"static",
"String",
"linkColumnName",
"(",
"FieldDefinition",
"linkDef",
",",
"String",
"objID",
")",
"{",
"assert",
"linkDef",
".",
"isLinkField",
"(",
")",
";",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buffer",
".",
... | Return the column name used to store the given value for the given link. The column
name uses the format:
<pre>
~{link name}/{object ID}
</pre>
This method should be used for unsharded links or link values to that refer to an
object whose shard number is 0.
@param linkDef {@link FieldDefinition} of a link.
@param objID ID of an object referenced by the link.
@return Column name that is used to store a value for the given link and
object ID.
@see #shardedLinkTermRowKey(FieldDefinition, String, int) | [
"Return",
"the",
"column",
"name",
"used",
"to",
"store",
"the",
"given",
"value",
"for",
"the",
"given",
"link",
".",
"The",
"column",
"name",
"uses",
"the",
"format",
":",
"<pre",
">",
"~",
"{",
"link",
"name",
"}",
"/",
"{",
"object",
"ID",
"}",
... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java#L282-L290 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/segmentation/ExampleSegmentColor.java | ExampleSegmentColor.showSelectedColor | public static void showSelectedColor( String name , BufferedImage image , float hue , float saturation ) {
Planar<GrayF32> input = ConvertBufferedImage.convertFromPlanar(image,null,true,GrayF32.class);
Planar<GrayF32> hsv = input.createSameShape();
// Convert into HSV
ColorHsv.rgbToHsv(input,hsv);
// Euclidean distance squared threshold for deciding which pixels are members of the selected set
float maxDist2 = 0.4f*0.4f;
// Extract hue and saturation bands which are independent of intensity
GrayF32 H = hsv.getBand(0);
GrayF32 S = hsv.getBand(1);
// Adjust the relative importance of Hue and Saturation.
// Hue has a range of 0 to 2*PI and Saturation from 0 to 1.
float adjustUnits = (float)(Math.PI/2.0);
// step through each pixel and mark how close it is to the selected color
BufferedImage output = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
for( int y = 0; y < hsv.height; y++ ) {
for( int x = 0; x < hsv.width; x++ ) {
// Hue is an angle in radians, so simple subtraction doesn't work
float dh = UtilAngle.dist(H.unsafe_get(x,y),hue);
float ds = (S.unsafe_get(x,y)-saturation)*adjustUnits;
// this distance measure is a bit naive, but good enough for to demonstrate the concept
float dist2 = dh*dh + ds*ds;
if( dist2 <= maxDist2 ) {
output.setRGB(x,y,image.getRGB(x,y));
}
}
}
ShowImages.showWindow(output,"Showing "+name);
} | java | public static void showSelectedColor( String name , BufferedImage image , float hue , float saturation ) {
Planar<GrayF32> input = ConvertBufferedImage.convertFromPlanar(image,null,true,GrayF32.class);
Planar<GrayF32> hsv = input.createSameShape();
// Convert into HSV
ColorHsv.rgbToHsv(input,hsv);
// Euclidean distance squared threshold for deciding which pixels are members of the selected set
float maxDist2 = 0.4f*0.4f;
// Extract hue and saturation bands which are independent of intensity
GrayF32 H = hsv.getBand(0);
GrayF32 S = hsv.getBand(1);
// Adjust the relative importance of Hue and Saturation.
// Hue has a range of 0 to 2*PI and Saturation from 0 to 1.
float adjustUnits = (float)(Math.PI/2.0);
// step through each pixel and mark how close it is to the selected color
BufferedImage output = new BufferedImage(input.width,input.height,BufferedImage.TYPE_INT_RGB);
for( int y = 0; y < hsv.height; y++ ) {
for( int x = 0; x < hsv.width; x++ ) {
// Hue is an angle in radians, so simple subtraction doesn't work
float dh = UtilAngle.dist(H.unsafe_get(x,y),hue);
float ds = (S.unsafe_get(x,y)-saturation)*adjustUnits;
// this distance measure is a bit naive, but good enough for to demonstrate the concept
float dist2 = dh*dh + ds*ds;
if( dist2 <= maxDist2 ) {
output.setRGB(x,y,image.getRGB(x,y));
}
}
}
ShowImages.showWindow(output,"Showing "+name);
} | [
"public",
"static",
"void",
"showSelectedColor",
"(",
"String",
"name",
",",
"BufferedImage",
"image",
",",
"float",
"hue",
",",
"float",
"saturation",
")",
"{",
"Planar",
"<",
"GrayF32",
">",
"input",
"=",
"ConvertBufferedImage",
".",
"convertFromPlanar",
"(",
... | Selectively displays only pixels which have a similar hue and saturation values to what is provided.
This is intended to be a simple example of color based segmentation. Color based segmentation can be done
in RGB color, but is more problematic due to it not being intensity invariant. More robust techniques
can use Gaussian models instead of a uniform distribution, as is done below. | [
"Selectively",
"displays",
"only",
"pixels",
"which",
"have",
"a",
"similar",
"hue",
"and",
"saturation",
"values",
"to",
"what",
"is",
"provided",
".",
"This",
"is",
"intended",
"to",
"be",
"a",
"simple",
"example",
"of",
"color",
"based",
"segmentation",
"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/segmentation/ExampleSegmentColor.java#L71-L106 |
threerings/nenya | core/src/main/java/com/threerings/media/sprite/FadableImageSprite.java | FadableImageSprite.moveAndFadeIn | public void moveAndFadeIn (Path path, long pathDuration, float fadePortion)
{
move(path);
setAlpha(0.0f);
_fadeInDuration = (long)(pathDuration * fadePortion);
} | java | public void moveAndFadeIn (Path path, long pathDuration, float fadePortion)
{
move(path);
setAlpha(0.0f);
_fadeInDuration = (long)(pathDuration * fadePortion);
} | [
"public",
"void",
"moveAndFadeIn",
"(",
"Path",
"path",
",",
"long",
"pathDuration",
",",
"float",
"fadePortion",
")",
"{",
"move",
"(",
"path",
")",
";",
"setAlpha",
"(",
"0.0f",
")",
";",
"_fadeInDuration",
"=",
"(",
"long",
")",
"(",
"pathDuration",
"... | Puts this sprite on the specified path and fades it in over the specified duration.
@param path the path to move along
@param fadePortion the portion of time to spend fading in, from 0.0f (no time) to 1.0f (the
entire time) | [
"Puts",
"this",
"sprite",
"on",
"the",
"specified",
"path",
"and",
"fades",
"it",
"in",
"over",
"the",
"specified",
"duration",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/FadableImageSprite.java#L89-L96 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/demo/SimpleBrowser.java | SimpleBrowser.initComponents | private void initComponents(URL baseurl)
{
documentScroll = new javax.swing.JScrollPane();
//Create the browser canvas
browserCanvas = new BrowserCanvas(docroot, decoder, new java.awt.Dimension(1000, 600), baseurl);
//A simple mouse listener that displays the coordinates clicked
browserCanvas.addMouseListener(new MouseListener() {
public void mouseClicked(MouseEvent e)
{
System.out.println("Click: " + e.getX() + ":" + e.getY());
}
public void mousePressed(MouseEvent e) { }
public void mouseReleased(MouseEvent e) { }
public void mouseEntered(MouseEvent e) { }
public void mouseExited(MouseEvent e) { }
});
getContentPane().setLayout(new java.awt.GridLayout(1, 0));
setTitle("CSSBox Browser");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
documentScroll.setViewportView(browserCanvas);
getContentPane().add(documentScroll);
pack();
} | java | private void initComponents(URL baseurl)
{
documentScroll = new javax.swing.JScrollPane();
//Create the browser canvas
browserCanvas = new BrowserCanvas(docroot, decoder, new java.awt.Dimension(1000, 600), baseurl);
//A simple mouse listener that displays the coordinates clicked
browserCanvas.addMouseListener(new MouseListener() {
public void mouseClicked(MouseEvent e)
{
System.out.println("Click: " + e.getX() + ":" + e.getY());
}
public void mousePressed(MouseEvent e) { }
public void mouseReleased(MouseEvent e) { }
public void mouseEntered(MouseEvent e) { }
public void mouseExited(MouseEvent e) { }
});
getContentPane().setLayout(new java.awt.GridLayout(1, 0));
setTitle("CSSBox Browser");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
documentScroll.setViewportView(browserCanvas);
getContentPane().add(documentScroll);
pack();
} | [
"private",
"void",
"initComponents",
"(",
"URL",
"baseurl",
")",
"{",
"documentScroll",
"=",
"new",
"javax",
".",
"swing",
".",
"JScrollPane",
"(",
")",
";",
"//Create the browser canvas",
"browserCanvas",
"=",
"new",
"BrowserCanvas",
"(",
"docroot",
",",
"decod... | Creates and initializes the GUI components
@param baseurl The base URL of the document used for completing the relative paths | [
"Creates",
"and",
"initializes",
"the",
"GUI",
"components"
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/demo/SimpleBrowser.java#L78-L109 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/NumberChineseFormater.java | NumberChineseFormater.toChinese | private static String toChinese(int amountPart, boolean isUseTraditional) {
// if (amountPart < 0 || amountPart > 10000) {
// throw new IllegalArgumentException("Number must 0 < num < 10000!");
// }
String[] numArray = isUseTraditional ? traditionalDigits : simpleDigits;
String[] units = isUseTraditional ? traditionalUnits : simpleUnits;
int temp = amountPart;
String chineseStr = "";
boolean lastIsZero = true; // 在从低位往高位循环时,记录上一位数字是不是 0
for (int i = 0; temp > 0; i++) {
if (temp == 0) {
// 高位已无数据
break;
}
int digit = temp % 10;
if (digit == 0) { // 取到的数字为 0
if (false == lastIsZero) {
// 前一个数字不是 0,则在当前汉字串前加“零”字;
chineseStr = "零" + chineseStr;
}
lastIsZero = true;
} else { // 取到的数字不是 0
chineseStr = numArray[digit] + units[i] + chineseStr;
lastIsZero = false;
}
temp = temp / 10;
}
return chineseStr;
} | java | private static String toChinese(int amountPart, boolean isUseTraditional) {
// if (amountPart < 0 || amountPart > 10000) {
// throw new IllegalArgumentException("Number must 0 < num < 10000!");
// }
String[] numArray = isUseTraditional ? traditionalDigits : simpleDigits;
String[] units = isUseTraditional ? traditionalUnits : simpleUnits;
int temp = amountPart;
String chineseStr = "";
boolean lastIsZero = true; // 在从低位往高位循环时,记录上一位数字是不是 0
for (int i = 0; temp > 0; i++) {
if (temp == 0) {
// 高位已无数据
break;
}
int digit = temp % 10;
if (digit == 0) { // 取到的数字为 0
if (false == lastIsZero) {
// 前一个数字不是 0,则在当前汉字串前加“零”字;
chineseStr = "零" + chineseStr;
}
lastIsZero = true;
} else { // 取到的数字不是 0
chineseStr = numArray[digit] + units[i] + chineseStr;
lastIsZero = false;
}
temp = temp / 10;
}
return chineseStr;
} | [
"private",
"static",
"String",
"toChinese",
"(",
"int",
"amountPart",
",",
"boolean",
"isUseTraditional",
")",
"{",
"//\t\tif (amountPart < 0 || amountPart > 10000) {",
"//\t\t\tthrow new IllegalArgumentException(\"Number must 0 < num < 10000!\");",
"//\t\t}",
"String",
"[",
"]",
... | 把一个 0~9999 之间的整数转换为汉字的字符串,如果是 0 则返回 ""
@param amountPart 数字部分
@param isUseTraditional 是否使用繁体单位
@return 转换后的汉字 | [
"把一个",
"0~9999",
"之间的整数转换为汉字的字符串,如果是",
"0",
"则返回"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/NumberChineseFormater.java#L140-L171 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.tryMergeBlock | public static boolean tryMergeBlock(Node block, boolean alwaysMerge) {
checkState(block.isBlock());
Node parent = block.getParent();
boolean canMerge = alwaysMerge || canMergeBlock(block);
// Try to remove the block if its parent is a block/script or if its
// parent is label and it has exactly one child.
if (isStatementBlock(parent) && canMerge) {
Node previous = block;
while (block.hasChildren()) {
Node child = block.removeFirstChild();
parent.addChildAfter(child, previous);
previous = child;
}
parent.removeChild(block);
return true;
} else {
return false;
}
} | java | public static boolean tryMergeBlock(Node block, boolean alwaysMerge) {
checkState(block.isBlock());
Node parent = block.getParent();
boolean canMerge = alwaysMerge || canMergeBlock(block);
// Try to remove the block if its parent is a block/script or if its
// parent is label and it has exactly one child.
if (isStatementBlock(parent) && canMerge) {
Node previous = block;
while (block.hasChildren()) {
Node child = block.removeFirstChild();
parent.addChildAfter(child, previous);
previous = child;
}
parent.removeChild(block);
return true;
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"tryMergeBlock",
"(",
"Node",
"block",
",",
"boolean",
"alwaysMerge",
")",
"{",
"checkState",
"(",
"block",
".",
"isBlock",
"(",
")",
")",
";",
"Node",
"parent",
"=",
"block",
".",
"getParent",
"(",
")",
";",
"boolean",
"ca... | Merge a block with its parent block.
@return Whether the block was removed. | [
"Merge",
"a",
"block",
"with",
"its",
"parent",
"block",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L2920-L2938 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/threading/Deadline.java | Deadline.getTimeoutLeft | public Timeout getTimeoutLeft()
{
final long left = getTimeLeft();
if (left != 0)
return new Timeout(left, TimeUnit.MILLISECONDS);
else
return Timeout.ZERO;
} | java | public Timeout getTimeoutLeft()
{
final long left = getTimeLeft();
if (left != 0)
return new Timeout(left, TimeUnit.MILLISECONDS);
else
return Timeout.ZERO;
} | [
"public",
"Timeout",
"getTimeoutLeft",
"(",
")",
"{",
"final",
"long",
"left",
"=",
"getTimeLeft",
"(",
")",
";",
"if",
"(",
"left",
"!=",
"0",
")",
"return",
"new",
"Timeout",
"(",
"left",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"else",
"retur... | Determines the amount of time leftuntil the deadline and returns it as a timeout
@return a timeout representing the amount of time remaining until this deadline expires | [
"Determines",
"the",
"amount",
"of",
"time",
"leftuntil",
"the",
"deadline",
"and",
"returns",
"it",
"as",
"a",
"timeout"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/threading/Deadline.java#L120-L128 |
kenyee/android-ddp-client | src/com/keysolutions/ddpclient/android/MeteorAuthCommands.java | MeteorAuthCommands.forgotPassword | public void forgotPassword(String email)
{
if (email == null) {
return;
}
Object[] methodArgs = new Object[1];
Map<String,Object> options = new HashMap<>();
methodArgs[0] = options;
options.put("email", email);
getDDP().call("forgotPassword", methodArgs, new DDPListener() {
@Override
public void onResult(Map<String, Object> jsonFields) {
handleLoginResult(jsonFields);
}
});
} | java | public void forgotPassword(String email)
{
if (email == null) {
return;
}
Object[] methodArgs = new Object[1];
Map<String,Object> options = new HashMap<>();
methodArgs[0] = options;
options.put("email", email);
getDDP().call("forgotPassword", methodArgs, new DDPListener() {
@Override
public void onResult(Map<String, Object> jsonFields) {
handleLoginResult(jsonFields);
}
});
} | [
"public",
"void",
"forgotPassword",
"(",
"String",
"email",
")",
"{",
"if",
"(",
"email",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Object",
"[",
"]",
"methodArgs",
"=",
"new",
"Object",
"[",
"1",
"]",
";",
"Map",
"<",
"String",
",",
"Object",
"... | Sends password reset mail to specified email address
@param email email address of user | [
"Sends",
"password",
"reset",
"mail",
"to",
"specified",
"email",
"address"
] | train | https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/MeteorAuthCommands.java#L108-L123 |
kaazing/gateway | service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java | HttpProxyServiceHandler.processHopByHopHeaders | private static boolean processHopByHopHeaders(HttpSession src, HttpSession dest) {
Set<String> hopByHopHeaders = getHopByHopHeaders(src);
boolean upgrade = src.getReadHeader(HEADER_UPGRADE) != null;
if (upgrade) {
hopByHopHeaders.remove(HEADER_UPGRADE);
}
// Add source session headers to destination session
for (Map.Entry<String, List<String>> e : src.getReadHeaders().entrySet()) {
String name = e.getKey();
for (String value : e.getValue()) {
if (!hopByHopHeaders.contains(name)) {
dest.addWriteHeader(name, value);
}
}
}
return upgrade;
} | java | private static boolean processHopByHopHeaders(HttpSession src, HttpSession dest) {
Set<String> hopByHopHeaders = getHopByHopHeaders(src);
boolean upgrade = src.getReadHeader(HEADER_UPGRADE) != null;
if (upgrade) {
hopByHopHeaders.remove(HEADER_UPGRADE);
}
// Add source session headers to destination session
for (Map.Entry<String, List<String>> e : src.getReadHeaders().entrySet()) {
String name = e.getKey();
for (String value : e.getValue()) {
if (!hopByHopHeaders.contains(name)) {
dest.addWriteHeader(name, value);
}
}
}
return upgrade;
} | [
"private",
"static",
"boolean",
"processHopByHopHeaders",
"(",
"HttpSession",
"src",
",",
"HttpSession",
"dest",
")",
"{",
"Set",
"<",
"String",
">",
"hopByHopHeaders",
"=",
"getHopByHopHeaders",
"(",
"src",
")",
";",
"boolean",
"upgrade",
"=",
"src",
".",
"ge... | /*
Write all (except hop-by-hop) headers from source session to destination session.
If the header is an upgrade one, let the Upgrade header go through as this service supports upgrade | [
"/",
"*",
"Write",
"all",
"(",
"except",
"hop",
"-",
"by",
"-",
"hop",
")",
"headers",
"from",
"source",
"session",
"to",
"destination",
"session",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java#L444-L462 |
OpenBEL/openbel-framework | org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/cache/DefaultCacheableResourceService.java | DefaultCacheableResourceService.hashCompare | private HashState hashCompare(String location, File resource)
throws ResourceDownloadError {
String tmpPath = getSystemConfiguration().getCacheDirectory()
.getAbsolutePath();
String remoteHashLocation = location + SHA256_EXTENSION;
String tempHashPath = asPath(
ResourceType.TMP_FILE.getResourceFolderName(),
encodeLocation(location),
CacheLookupService.DEFAULT_RESOURCE_FILE_NAME
+ SHA256_EXTENSION);
// download resource hash
File remoteHashFile = null;
try {
remoteHashFile = resolveResource(remoteHashLocation, tmpPath,
tempHashPath);
} catch (ResourceDownloadError e) {
return HashState.MISSING_REMOTE_HASH;
}
String absPath = resource.getAbsolutePath();
File localHashFile = new File(absPath + SHA256_EXTENSION);
if (!localHashFile.exists() || !localHashFile.canRead()) {
localHashFile = createLocalHash(resource, location);
}
// compare hash files
try {
if (areHashFilesEqual(localHashFile, remoteHashFile, location)) {
// hashes are equal, so cached resource is the latest
// return cached resource
return HashState.HASH_MATCH;
}
// hashes are not equal
return HashState.HASH_MISMATCH;
} finally {
// delete the downloaded temporary hash
if (!remoteHashFile.delete()) {
remoteHashFile.deleteOnExit();
}
}
} | java | private HashState hashCompare(String location, File resource)
throws ResourceDownloadError {
String tmpPath = getSystemConfiguration().getCacheDirectory()
.getAbsolutePath();
String remoteHashLocation = location + SHA256_EXTENSION;
String tempHashPath = asPath(
ResourceType.TMP_FILE.getResourceFolderName(),
encodeLocation(location),
CacheLookupService.DEFAULT_RESOURCE_FILE_NAME
+ SHA256_EXTENSION);
// download resource hash
File remoteHashFile = null;
try {
remoteHashFile = resolveResource(remoteHashLocation, tmpPath,
tempHashPath);
} catch (ResourceDownloadError e) {
return HashState.MISSING_REMOTE_HASH;
}
String absPath = resource.getAbsolutePath();
File localHashFile = new File(absPath + SHA256_EXTENSION);
if (!localHashFile.exists() || !localHashFile.canRead()) {
localHashFile = createLocalHash(resource, location);
}
// compare hash files
try {
if (areHashFilesEqual(localHashFile, remoteHashFile, location)) {
// hashes are equal, so cached resource is the latest
// return cached resource
return HashState.HASH_MATCH;
}
// hashes are not equal
return HashState.HASH_MISMATCH;
} finally {
// delete the downloaded temporary hash
if (!remoteHashFile.delete()) {
remoteHashFile.deleteOnExit();
}
}
} | [
"private",
"HashState",
"hashCompare",
"(",
"String",
"location",
",",
"File",
"resource",
")",
"throws",
"ResourceDownloadError",
"{",
"String",
"tmpPath",
"=",
"getSystemConfiguration",
"(",
")",
".",
"getCacheDirectory",
"(",
")",
".",
"getAbsolutePath",
"(",
"... | Compare hashes of the remote resource to the local resource. The
comparison can result in the following:
<ul>
<li>If the resource's remote hash does not exist then return
{@link HashState#MISSING_REMOTE_HASH}.</li>
<li>If the resource's remote hash matches the local resource's hash then
return {@link HashState#HASH_MATCH}</li>
<li>If the resource's remote hash does not match the local resource's
hash then return {@link HashState#HASH_MISMATCH}.</li>
</ul>
@param location {@link String}, the remote resource location
@param resource {@link File}, the resource's local copy in the cache
@return {@link HashState} the state of the hash comparison which is
useful for deciding how to deal further with the resource
@throws IOException Thrown if there was an IO error in handling hash
files | [
"Compare",
"hashes",
"of",
"the",
"remote",
"resource",
"to",
"the",
"local",
"resource",
".",
"The",
"comparison",
"can",
"result",
"in",
"the",
"following",
":",
"<ul",
">",
"<li",
">",
"If",
"the",
"resource",
"s",
"remote",
"hash",
"does",
"not",
"ex... | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/cache/DefaultCacheableResourceService.java#L140-L185 |
AzureAD/azure-activedirectory-library-for-java | src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/HttpClientHelper.java | HttpClientHelper.processResponse | public static JSONObject processResponse(int responseCode, String errorCode, String errorMsg) throws JSONException {
JSONObject response = new JSONObject();
response.put("responseCode", responseCode);
response.put("errorCode", errorCode);
response.put("errorMsg", errorMsg);
return response;
} | java | public static JSONObject processResponse(int responseCode, String errorCode, String errorMsg) throws JSONException {
JSONObject response = new JSONObject();
response.put("responseCode", responseCode);
response.put("errorCode", errorCode);
response.put("errorMsg", errorMsg);
return response;
} | [
"public",
"static",
"JSONObject",
"processResponse",
"(",
"int",
"responseCode",
",",
"String",
"errorCode",
",",
"String",
"errorMsg",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"response",
"=",
"new",
"JSONObject",
"(",
")",
";",
"response",
".",
"put"... | for bad response, whose responseCode is not 200 level
@param responseCode
@param errorCode
@param errorMsg
@return
@throws JSONException | [
"for",
"bad",
"response",
"whose",
"responseCode",
"is",
"not",
"200",
"level"
] | train | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/HttpClientHelper.java#L115-L122 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java | MsgDestEncodingUtilsImpl.getMessageRepresentationFromDest | public final byte[] getMessageRepresentationFromDest(JmsDestination dest, EncodingLevel encodingLevel) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMessageRepresentationFromDest", new Object[]{dest, encodingLevel});
boolean isTopic = false;
byte[] encodedDest = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream(); // initial size of 32 is probably OK
if (dest == null) {
// Error case.
JMSException e = (JMSException)JmsErrorUtils.newThrowable(JMSException.class,
"INTERNAL_INVALID_VALUE_CWSIA0361",
new Object[] {"null", "JmsDestination"}, tc);
FFDCFilter.processException(e,"MsgDestEncodingUtilsImpl","getMessageRepresentationFromDest#1", this);
throw e;
}
// If the JmsDestination is a Topic, note it for later use
if (dest instanceof Topic) {
isTopic = true;
}
// This variable is used to obtain a list of all the destination's properties,
// giving us a copy which is safe for us to mess around with.
Map<String,Object> destProps = ((JmsDestinationImpl)dest).getCopyOfProperties();
// Now fiddle around with our copy of the properties, so we get the set we need to encode
manipulateProperties(destProps, isTopic, encodingLevel);
// Encode the basic stuff - Queue/Topic, DeliveryMode, Priority & TTL
encodeBasicProperties(baos, isTopic, destProps);
// Encode the rest of the properties
encodeOtherProperties(baos, destProps);
// Extract the byte array to return
encodedDest = baos.toByteArray();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMessageRepresentationFromDest", encodedDest);
return encodedDest;
} | java | public final byte[] getMessageRepresentationFromDest(JmsDestination dest, EncodingLevel encodingLevel) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMessageRepresentationFromDest", new Object[]{dest, encodingLevel});
boolean isTopic = false;
byte[] encodedDest = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream(); // initial size of 32 is probably OK
if (dest == null) {
// Error case.
JMSException e = (JMSException)JmsErrorUtils.newThrowable(JMSException.class,
"INTERNAL_INVALID_VALUE_CWSIA0361",
new Object[] {"null", "JmsDestination"}, tc);
FFDCFilter.processException(e,"MsgDestEncodingUtilsImpl","getMessageRepresentationFromDest#1", this);
throw e;
}
// If the JmsDestination is a Topic, note it for later use
if (dest instanceof Topic) {
isTopic = true;
}
// This variable is used to obtain a list of all the destination's properties,
// giving us a copy which is safe for us to mess around with.
Map<String,Object> destProps = ((JmsDestinationImpl)dest).getCopyOfProperties();
// Now fiddle around with our copy of the properties, so we get the set we need to encode
manipulateProperties(destProps, isTopic, encodingLevel);
// Encode the basic stuff - Queue/Topic, DeliveryMode, Priority & TTL
encodeBasicProperties(baos, isTopic, destProps);
// Encode the rest of the properties
encodeOtherProperties(baos, destProps);
// Extract the byte array to return
encodedDest = baos.toByteArray();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMessageRepresentationFromDest", encodedDest);
return encodedDest;
} | [
"public",
"final",
"byte",
"[",
"]",
"getMessageRepresentationFromDest",
"(",
"JmsDestination",
"dest",
",",
"EncodingLevel",
"encodingLevel",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"... | /*
@see com.ibm.ws.sib.api.jms.MessageDestEncodingUtils#getMessageRepresentationFromDest(com.ibm.websphere.sib.api.jms.JmsDestination)
Returns the efficient byte[] representation of the parameter destination
that can be stored in the message for transmission. The boolean parameter
indicates whether a full (normal dest) or partial (reply dest) encoding
should be carried out.
@throws JMSException if
dest is null - generates FFDC
getShortPropertyValue throws it - FFDCs already generated.
an UnsupportedEncodingException is generated - generates FFDC. | [
"/",
"*",
"@see",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"api",
".",
"jms",
".",
"MessageDestEncodingUtils#getMessageRepresentationFromDest",
"(",
"com",
".",
"ibm",
".",
"websphere",
".",
"sib",
".",
"api",
".",
"jms",
".",
"JmsDestination",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L183-L223 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java | QueryImpl.setHint | @Override
public Query setHint(String hintName, Object value)
{
hints.put(hintName, value);
return this;
} | java | @Override
public Query setHint(String hintName, Object value)
{
hints.put(hintName, value);
return this;
} | [
"@",
"Override",
"public",
"Query",
"setHint",
"(",
"String",
"hintName",
",",
"Object",
"value",
")",
"{",
"hints",
".",
"put",
"(",
"hintName",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Sets hint name and value into hints map and returns instance of
{@link Query}.
@param hintName
the hint name
@param value
the value
@return the query | [
"Sets",
"hint",
"name",
"and",
"value",
"into",
"hints",
"map",
"and",
"returns",
"instance",
"of",
"{",
"@link",
"Query",
"}",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java#L805-L810 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java | InstanceHelpers.hasChildWithThisName | public static boolean hasChildWithThisName( AbstractApplication application, Instance parentInstance, String nameToSearch ) {
boolean hasAlreadyAChildWithThisName = false;
Collection<Instance> list = parentInstance == null ? application.getRootInstances() : parentInstance.getChildren();
for( Iterator<Instance> it = list.iterator(); it.hasNext() && ! hasAlreadyAChildWithThisName; ) {
hasAlreadyAChildWithThisName = Objects.equals( nameToSearch, it.next().getName());
}
return hasAlreadyAChildWithThisName;
} | java | public static boolean hasChildWithThisName( AbstractApplication application, Instance parentInstance, String nameToSearch ) {
boolean hasAlreadyAChildWithThisName = false;
Collection<Instance> list = parentInstance == null ? application.getRootInstances() : parentInstance.getChildren();
for( Iterator<Instance> it = list.iterator(); it.hasNext() && ! hasAlreadyAChildWithThisName; ) {
hasAlreadyAChildWithThisName = Objects.equals( nameToSearch, it.next().getName());
}
return hasAlreadyAChildWithThisName;
} | [
"public",
"static",
"boolean",
"hasChildWithThisName",
"(",
"AbstractApplication",
"application",
",",
"Instance",
"parentInstance",
",",
"String",
"nameToSearch",
")",
"{",
"boolean",
"hasAlreadyAChildWithThisName",
"=",
"false",
";",
"Collection",
"<",
"Instance",
">"... | Determines whether an instance name is not already used by a sibling instance.
@param application the application (not null)
@param parentInstance the parent instance (can be null to indicate a root instance)
@param nameToSearch the name to search
@return true if a child instance of <code>parentInstance</code> has the same name, false otherwise | [
"Determines",
"whether",
"an",
"instance",
"name",
"is",
"not",
"already",
"used",
"by",
"a",
"sibling",
"instance",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L467-L476 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/transformer/AbstractObservableTransformerSink.java | AbstractObservableTransformerSink.onTransformationSinkErrorOccurred | protected void onTransformationSinkErrorOccurred(Exception exception) {
for (TransformerSinkEventListener listener : transformerSinkEventListeners)
fireErrorEvent(listener, new TransformerSinkErrorEvent(this, exception));
}
/**
* (Re)-fires a preconstructed event.
* @param event The event to fire
*/
protected void onTransformationSinkErrorOccurred(TransformerSinkErrorEvent event) {
for (TransformerSinkEventListener listener : transformerSinkEventListeners)
fireErrorEvent(listener, event);
}
/**
* Fires the given event on the given listener.
* @param listener The listener to fire the event to.
* @param event The event to fire.
*/
private void fireErrorEvent(TransformerSinkEventListener listener, TransformerSinkErrorEvent event) {
try {
listener.ErrorOccurred(event);
}
catch (RuntimeException e) {
// Log this somehow
System.err.println("Exception thrown while trying to invoke event listener, removing bed behaved listener.");
e.printStackTrace();
removeTransformerSinkEventListener(listener);
}
}
} | java | protected void onTransformationSinkErrorOccurred(Exception exception) {
for (TransformerSinkEventListener listener : transformerSinkEventListeners)
fireErrorEvent(listener, new TransformerSinkErrorEvent(this, exception));
}
/**
* (Re)-fires a preconstructed event.
* @param event The event to fire
*/
protected void onTransformationSinkErrorOccurred(TransformerSinkErrorEvent event) {
for (TransformerSinkEventListener listener : transformerSinkEventListeners)
fireErrorEvent(listener, event);
}
/**
* Fires the given event on the given listener.
* @param listener The listener to fire the event to.
* @param event The event to fire.
*/
private void fireErrorEvent(TransformerSinkEventListener listener, TransformerSinkErrorEvent event) {
try {
listener.ErrorOccurred(event);
}
catch (RuntimeException e) {
// Log this somehow
System.err.println("Exception thrown while trying to invoke event listener, removing bed behaved listener.");
e.printStackTrace();
removeTransformerSinkEventListener(listener);
}
}
} | [
"protected",
"void",
"onTransformationSinkErrorOccurred",
"(",
"Exception",
"exception",
")",
"{",
"for",
"(",
"TransformerSinkEventListener",
"listener",
":",
"transformerSinkEventListeners",
")",
"fireErrorEvent",
"(",
"listener",
",",
"new",
"TransformerSinkErrorEvent",
... | Called when an exception occurred. Fires the ErrorOccured event.
@param exception The exception that was thrown by the TransformationSink. | [
"Called",
"when",
"an",
"exception",
"occurred",
".",
"Fires",
"the",
"ErrorOccured",
"event",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/transformer/AbstractObservableTransformerSink.java#L68-L102 |
lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.escapeJS | public static String escapeJS(String str, char quotesUsed) {
return escapeJS(str, quotesUsed, (CharsetEncoder) null);
} | java | public static String escapeJS(String str, char quotesUsed) {
return escapeJS(str, quotesUsed, (CharsetEncoder) null);
} | [
"public",
"static",
"String",
"escapeJS",
"(",
"String",
"str",
",",
"char",
"quotesUsed",
")",
"{",
"return",
"escapeJS",
"(",
"str",
",",
"quotesUsed",
",",
"(",
"CharsetEncoder",
")",
"null",
")",
";",
"}"
] | escapes JS sensitive characters
@param str String to escape
@return escapes String | [
"escapes",
"JS",
"sensitive",
"characters"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L153-L155 |
jmeter-maven-plugin/jmeter-maven-plugin | src/main/java/com/lazerycode/jmeter/properties/PropertiesFile.java | PropertiesFile.warnUserOfPossibleErrors | private void warnUserOfPossibleErrors(String newKey, Properties baseProperties) {
for (String key : baseProperties.stringPropertyNames()) {
if (!key.equals(newKey) && key.equalsIgnoreCase(newKey)) {
LOGGER.warn("You have set a property called '{}' which is very similar to '{}'!",
newKey, key);
}
}
} | java | private void warnUserOfPossibleErrors(String newKey, Properties baseProperties) {
for (String key : baseProperties.stringPropertyNames()) {
if (!key.equals(newKey) && key.equalsIgnoreCase(newKey)) {
LOGGER.warn("You have set a property called '{}' which is very similar to '{}'!",
newKey, key);
}
}
} | [
"private",
"void",
"warnUserOfPossibleErrors",
"(",
"String",
"newKey",
",",
"Properties",
"baseProperties",
")",
"{",
"for",
"(",
"String",
"key",
":",
"baseProperties",
".",
"stringPropertyNames",
"(",
")",
")",
"{",
"if",
"(",
"!",
"key",
".",
"equals",
"... | Print a warning out to the user to highlight potential typos in the properties they have set.
@param newKey Property Value
@param baseProperties Properties | [
"Print",
"a",
"warning",
"out",
"to",
"the",
"user",
"to",
"highlight",
"potential",
"typos",
"in",
"the",
"properties",
"they",
"have",
"set",
"."
] | train | https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/properties/PropertiesFile.java#L136-L143 |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getDouble | public double getDouble(String name, double defaultValue) {
String valueString = getTrimmed(name);
if (valueString == null)
return defaultValue;
return Double.parseDouble(valueString);
} | java | public double getDouble(String name, double defaultValue) {
String valueString = getTrimmed(name);
if (valueString == null)
return defaultValue;
return Double.parseDouble(valueString);
} | [
"public",
"double",
"getDouble",
"(",
"String",
"name",
",",
"double",
"defaultValue",
")",
"{",
"String",
"valueString",
"=",
"getTrimmed",
"(",
"name",
")",
";",
"if",
"(",
"valueString",
"==",
"null",
")",
"return",
"defaultValue",
";",
"return",
"Double"... | Get the value of the <code>name</code> property as a <code>double</code>.
If no such property exists, the provided default value is returned,
or if the specified value is not a valid <code>double</code>,
then an error is thrown.
@param name property name.
@param defaultValue default value.
@throws NumberFormatException when the value is invalid
@return property value as a <code>double</code>,
or <code>defaultValue</code>. | [
"Get",
"the",
"value",
"of",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"a",
"<code",
">",
"double<",
"/",
"code",
">",
".",
"If",
"no",
"such",
"property",
"exists",
"the",
"provided",
"default",
"value",
"is",
"returned",
"or",... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1507-L1512 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ForwardRule.java | ForwardRule.newInstance | public static ForwardRule newInstance(String contentType, String transletName, String method, Boolean defaultResponse)
throws IllegalRuleException {
if (transletName == null) {
throw new IllegalRuleException("The 'forward' element requires a 'translet' attribute");
}
MethodType requestMethod = null;
if (method != null) {
requestMethod = MethodType.resolve(method);
if (requestMethod == null) {
throw new IllegalRuleException("No request method type for '" + method + "'");
}
}
ForwardRule fr = new ForwardRule();
fr.setContentType(contentType);
fr.setTransletName(transletName);
fr.setRequestMethod(requestMethod);
fr.setDefaultResponse(defaultResponse);
return fr;
} | java | public static ForwardRule newInstance(String contentType, String transletName, String method, Boolean defaultResponse)
throws IllegalRuleException {
if (transletName == null) {
throw new IllegalRuleException("The 'forward' element requires a 'translet' attribute");
}
MethodType requestMethod = null;
if (method != null) {
requestMethod = MethodType.resolve(method);
if (requestMethod == null) {
throw new IllegalRuleException("No request method type for '" + method + "'");
}
}
ForwardRule fr = new ForwardRule();
fr.setContentType(contentType);
fr.setTransletName(transletName);
fr.setRequestMethod(requestMethod);
fr.setDefaultResponse(defaultResponse);
return fr;
} | [
"public",
"static",
"ForwardRule",
"newInstance",
"(",
"String",
"contentType",
",",
"String",
"transletName",
",",
"String",
"method",
",",
"Boolean",
"defaultResponse",
")",
"throws",
"IllegalRuleException",
"{",
"if",
"(",
"transletName",
"==",
"null",
")",
"{"... | Returns a new instance of ForwardRule.
@param contentType the content type
@param transletName the translet name
@param method the request method
@param defaultResponse whether the default response
@return an instance of ForwardRule
@throws IllegalRuleException if an illegal rule is found | [
"Returns",
"a",
"new",
"instance",
"of",
"ForwardRule",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ForwardRule.java#L153-L173 |
dbracewell/mango | src/main/java/com/davidbracewell/conversion/CollectionConverter.java | CollectionConverter.COLLECTION | public static Function<Object, Collection<?>> COLLECTION(final Class<? extends Collection> collectionType) {
return as(new CollectionConverterImpl<>(collectionType, null));
} | java | public static Function<Object, Collection<?>> COLLECTION(final Class<? extends Collection> collectionType) {
return as(new CollectionConverterImpl<>(collectionType, null));
} | [
"public",
"static",
"Function",
"<",
"Object",
",",
"Collection",
"<",
"?",
">",
">",
"COLLECTION",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Collection",
">",
"collectionType",
")",
"{",
"return",
"as",
"(",
"new",
"CollectionConverterImpl",
"<>",
"(",
... | Converts an object to a collection
@param collectionType the collection type
@return the conversion function | [
"Converts",
"an",
"object",
"to",
"a",
"collection"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/conversion/CollectionConverter.java#L87-L89 |
alkacon/opencms-core | src/org/opencms/db/CmsLoginManager.java | CmsLoginManager.addInvalidLogin | protected void addInvalidLogin(String userName, String remoteAddress) {
if (m_maxBadAttempts < 0) {
// invalid login storage is disabled
return;
}
String key = createStorageKey(userName, remoteAddress);
// look up the user in the storage
CmsUserData userData = m_storage.get(key);
if (userData != null) {
// user data already contained in storage
userData.increaseInvalidLoginCount();
} else {
// create an new data object for this user
userData = new CmsUserData();
m_storage.put(key, userData);
}
} | java | protected void addInvalidLogin(String userName, String remoteAddress) {
if (m_maxBadAttempts < 0) {
// invalid login storage is disabled
return;
}
String key = createStorageKey(userName, remoteAddress);
// look up the user in the storage
CmsUserData userData = m_storage.get(key);
if (userData != null) {
// user data already contained in storage
userData.increaseInvalidLoginCount();
} else {
// create an new data object for this user
userData = new CmsUserData();
m_storage.put(key, userData);
}
} | [
"protected",
"void",
"addInvalidLogin",
"(",
"String",
"userName",
",",
"String",
"remoteAddress",
")",
"{",
"if",
"(",
"m_maxBadAttempts",
"<",
"0",
")",
"{",
"// invalid login storage is disabled",
"return",
";",
"}",
"String",
"key",
"=",
"createStorageKey",
"(... | Adds an invalid attempt to login for the given user / IP to the storage.<p>
In case the configured threshold is reached, the user is disabled for the configured time.<p>
@param userName the name of the user
@param remoteAddress the remore address (IP) from which the login attempt was made | [
"Adds",
"an",
"invalid",
"attempt",
"to",
"login",
"for",
"the",
"given",
"user",
"/",
"IP",
"to",
"the",
"storage",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L717-L735 |
Falydoor/limesurvey-rc | src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java | LimesurveyRC.updateResponse | public JsonElement updateResponse(int surveyId, int responseId, Map<String, String> responseData) throws LimesurveyRCException {
LsApiBody.LsApiParams params = getParamsWithKey(surveyId);
responseData.put("id", String.valueOf(responseId));
params.setResponseData(responseData);
return callRC(new LsApiBody("update_response", params));
} | java | public JsonElement updateResponse(int surveyId, int responseId, Map<String, String> responseData) throws LimesurveyRCException {
LsApiBody.LsApiParams params = getParamsWithKey(surveyId);
responseData.put("id", String.valueOf(responseId));
params.setResponseData(responseData);
return callRC(new LsApiBody("update_response", params));
} | [
"public",
"JsonElement",
"updateResponse",
"(",
"int",
"surveyId",
",",
"int",
"responseId",
",",
"Map",
"<",
"String",
",",
"String",
">",
"responseData",
")",
"throws",
"LimesurveyRCException",
"{",
"LsApiBody",
".",
"LsApiParams",
"params",
"=",
"getParamsWithK... | Update a response.
@param surveyId the survey id of the survey you want to update the response
@param responseId the response id of the response you want to update
@param responseData the response data that contains the fields you want to update
@return the json element
@throws LimesurveyRCException the limesurvey rc exception | [
"Update",
"a",
"response",
"."
] | train | https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L188-L194 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java | ServerSentEvents.fromPublisher | public static HttpResponse fromPublisher(Publisher<? extends ServerSentEvent> contentPublisher) {
return fromPublisher(defaultHttpHeaders, contentPublisher, HttpHeaders.EMPTY_HEADERS);
} | java | public static HttpResponse fromPublisher(Publisher<? extends ServerSentEvent> contentPublisher) {
return fromPublisher(defaultHttpHeaders, contentPublisher, HttpHeaders.EMPTY_HEADERS);
} | [
"public",
"static",
"HttpResponse",
"fromPublisher",
"(",
"Publisher",
"<",
"?",
"extends",
"ServerSentEvent",
">",
"contentPublisher",
")",
"{",
"return",
"fromPublisher",
"(",
"defaultHttpHeaders",
",",
"contentPublisher",
",",
"HttpHeaders",
".",
"EMPTY_HEADERS",
"... | Creates a new Server-Sent Events stream from the specified {@link Publisher}.
@param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents | [
"Creates",
"a",
"new",
"Server",
"-",
"Sent",
"Events",
"stream",
"from",
"the",
"specified",
"{",
"@link",
"Publisher",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java#L87-L89 |
kubernetes-client/java | examples/src/main/java/io/kubernetes/client/examples/ExpandedExample.java | ExpandedExample.printLog | public static void printLog(String namespace, String podName) throws ApiException {
// https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/CoreV1Api.md#readNamespacedPodLog
String readNamespacedPodLog =
COREV1_API.readNamespacedPodLog(
podName,
namespace,
null,
Boolean.FALSE,
Integer.MAX_VALUE,
null,
Boolean.FALSE,
Integer.MAX_VALUE,
40,
Boolean.FALSE);
System.out.println(readNamespacedPodLog);
} | java | public static void printLog(String namespace, String podName) throws ApiException {
// https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/CoreV1Api.md#readNamespacedPodLog
String readNamespacedPodLog =
COREV1_API.readNamespacedPodLog(
podName,
namespace,
null,
Boolean.FALSE,
Integer.MAX_VALUE,
null,
Boolean.FALSE,
Integer.MAX_VALUE,
40,
Boolean.FALSE);
System.out.println(readNamespacedPodLog);
} | [
"public",
"static",
"void",
"printLog",
"(",
"String",
"namespace",
",",
"String",
"podName",
")",
"throws",
"ApiException",
"{",
"// https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/CoreV1Api.md#readNamespacedPodLog",
"String",
"readNamespacedPodLog",
"=",
"... | Print out the Log for specific Pods
@param namespace
@param podName
@throws ApiException | [
"Print",
"out",
"the",
"Log",
"for",
"specific",
"Pods"
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/examples/src/main/java/io/kubernetes/client/examples/ExpandedExample.java#L255-L270 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.injectBeanField | @SuppressWarnings("unused")
@Internal
protected final void injectBeanField(BeanResolutionContext resolutionContext, DefaultBeanContext context, int index, Object bean) {
FieldInjectionPoint fieldInjectionPoint = fieldInjectionPoints.get(index);
boolean isInject = fieldInjectionPoint.getAnnotationMetadata().hasDeclaredAnnotation(Inject.class);
try {
Object value;
if (isInject) {
value = getBeanForField(resolutionContext, context, fieldInjectionPoint);
} else {
value = getValueForField(resolutionContext, context, index);
}
if (value != null) {
//noinspection unchecked
fieldInjectionPoint.set(bean, value);
}
} catch (Throwable e) {
if (e instanceof BeanContextException) {
throw (BeanContextException) e;
} else {
throw new DependencyInjectionException(resolutionContext, fieldInjectionPoint, "Error setting field value: " + e.getMessage(), e);
}
}
} | java | @SuppressWarnings("unused")
@Internal
protected final void injectBeanField(BeanResolutionContext resolutionContext, DefaultBeanContext context, int index, Object bean) {
FieldInjectionPoint fieldInjectionPoint = fieldInjectionPoints.get(index);
boolean isInject = fieldInjectionPoint.getAnnotationMetadata().hasDeclaredAnnotation(Inject.class);
try {
Object value;
if (isInject) {
value = getBeanForField(resolutionContext, context, fieldInjectionPoint);
} else {
value = getValueForField(resolutionContext, context, index);
}
if (value != null) {
//noinspection unchecked
fieldInjectionPoint.set(bean, value);
}
} catch (Throwable e) {
if (e instanceof BeanContextException) {
throw (BeanContextException) e;
} else {
throw new DependencyInjectionException(resolutionContext, fieldInjectionPoint, "Error setting field value: " + e.getMessage(), e);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"@",
"Internal",
"protected",
"final",
"void",
"injectBeanField",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"DefaultBeanContext",
"context",
",",
"int",
"index",
",",
"Object",
"bean",
")",
"{",
"FieldIn... | Injects the value of a field of a bean that requires reflection.
@param resolutionContext The resolution context
@param context The bean context
@param index The index of the field
@param bean The bean being injected | [
"Injects",
"the",
"value",
"of",
"a",
"field",
"of",
"a",
"bean",
"that",
"requires",
"reflection",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L706-L729 |
metamx/java-util | src/main/java/com/metamx/common/lifecycle/Lifecycle.java | Lifecycle.addHandler | public void addHandler(Handler handler, Stage stage)
{
synchronized (handlers) {
if (started.get()) {
throw new ISE("Cannot add a handler after the Lifecycle has started, it doesn't work that way.");
}
handlers.get(stage).add(handler);
}
} | java | public void addHandler(Handler handler, Stage stage)
{
synchronized (handlers) {
if (started.get()) {
throw new ISE("Cannot add a handler after the Lifecycle has started, it doesn't work that way.");
}
handlers.get(stage).add(handler);
}
} | [
"public",
"void",
"addHandler",
"(",
"Handler",
"handler",
",",
"Stage",
"stage",
")",
"{",
"synchronized",
"(",
"handlers",
")",
"{",
"if",
"(",
"started",
".",
"get",
"(",
")",
")",
"{",
"throw",
"new",
"ISE",
"(",
"\"Cannot add a handler after the Lifecyc... | Adds a handler to the Lifecycle. If the lifecycle has already been started, it throws an {@link ISE}
@param handler The hander to add to the lifecycle
@param stage The stage to add the lifecycle at
@throws ISE indicates that the lifecycle has already been started and thus cannot be added to | [
"Adds",
"a",
"handler",
"to",
"the",
"Lifecycle",
".",
"If",
"the",
"lifecycle",
"has",
"already",
"been",
"started",
"it",
"throws",
"an",
"{",
"@link",
"ISE",
"}"
] | train | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/lifecycle/Lifecycle.java#L150-L158 |
andrehertwig/admintool | admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/contoller/ATSecDBAbctractController.java | ATSecDBAbctractController.handleException | protected <E extends Throwable, V extends ATSecDBValidator> Set<ATError> handleException(E e, Log logger, V validator,
String key, String suffix, String defaultMessagePrefix) {
return handleException(e, logger, validator, key, suffix, defaultMessagePrefix, new Object[] {});
} | java | protected <E extends Throwable, V extends ATSecDBValidator> Set<ATError> handleException(E e, Log logger, V validator,
String key, String suffix, String defaultMessagePrefix) {
return handleException(e, logger, validator, key, suffix, defaultMessagePrefix, new Object[] {});
} | [
"protected",
"<",
"E",
"extends",
"Throwable",
",",
"V",
"extends",
"ATSecDBValidator",
">",
"Set",
"<",
"ATError",
">",
"handleException",
"(",
"E",
"e",
",",
"Log",
"logger",
",",
"V",
"validator",
",",
"String",
"key",
",",
"String",
"suffix",
",",
"S... | logging the error and creates {@link ATError} list output
@param e
@param logger
@param validator
@param key
@param suffix
@param defaultMessagePrefix
@return | [
"logging",
"the",
"error",
"and",
"creates",
"{",
"@link",
"ATError",
"}",
"list",
"output"
] | train | https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/contoller/ATSecDBAbctractController.java#L52-L55 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java | GenericLogicDiscoverer.findOperationsConsumingAll | @Override
public Map<URI, MatchResult> findOperationsConsumingAll(Set<URI> inputTypes) {
return findOperationsConsumingAll(inputTypes, LogicConceptMatchType.Plugin);
} | java | @Override
public Map<URI, MatchResult> findOperationsConsumingAll(Set<URI> inputTypes) {
return findOperationsConsumingAll(inputTypes, LogicConceptMatchType.Plugin);
} | [
"@",
"Override",
"public",
"Map",
"<",
"URI",
",",
"MatchResult",
">",
"findOperationsConsumingAll",
"(",
"Set",
"<",
"URI",
">",
"inputTypes",
")",
"{",
"return",
"findOperationsConsumingAll",
"(",
"inputTypes",
",",
"LogicConceptMatchType",
".",
"Plugin",
")",
... | Discover registered operations that consume all the types of input provided. That is, all those that have as input
the types provided. All the input types should be matched to different inputs.
@param inputTypes the types of input to be consumed
@return a Set containing all the matching operations. If there are no solutions, the Set should be empty, not null. | [
"Discover",
"registered",
"operations",
"that",
"consume",
"all",
"the",
"types",
"of",
"input",
"provided",
".",
"That",
"is",
"all",
"those",
"that",
"have",
"as",
"input",
"the",
"types",
"provided",
".",
"All",
"the",
"input",
"types",
"should",
"be",
... | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/impl/GenericLogicDiscoverer.java#L248-L251 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.setOrthoSymmetricLH | public Matrix4x3d setOrthoSymmetricLH(double width, double height, double zNear, double zFar) {
return setOrthoSymmetricLH(width, height, zNear, zFar, false);
} | java | public Matrix4x3d setOrthoSymmetricLH(double width, double height, double zNear, double zFar) {
return setOrthoSymmetricLH(width, height, zNear, zFar, false);
} | [
"public",
"Matrix4x3d",
"setOrthoSymmetricLH",
"(",
"double",
"width",
",",
"double",
"height",
",",
"double",
"zNear",
",",
"double",
"zFar",
")",
"{",
"return",
"setOrthoSymmetricLH",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"false",
")... | Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code>.
<p>
This method is equivalent to calling {@link #setOrthoLH(double, double, double, double, double, double) setOrthoLH()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
In order to apply the symmetric orthographic projection to an already existing transformation,
use {@link #orthoSymmetricLH(double, double, double, double) orthoSymmetricLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoSymmetricLH(double, double, double, double)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L7503-L7505 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java | DateIntervalFormat.getInstance | public static final DateIntervalFormat getInstance(String skeleton,
ULocale locale,
DateIntervalInfo dtitvinf)
{
// clone. If it is frozen, clone returns itself, otherwise, clone
// returns a copy.
dtitvinf = (DateIntervalInfo)dtitvinf.clone();
DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale);
return new DateIntervalFormat(skeleton, dtitvinf, new SimpleDateFormat(generator.getBestPattern(skeleton), locale));
} | java | public static final DateIntervalFormat getInstance(String skeleton,
ULocale locale,
DateIntervalInfo dtitvinf)
{
// clone. If it is frozen, clone returns itself, otherwise, clone
// returns a copy.
dtitvinf = (DateIntervalInfo)dtitvinf.clone();
DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale);
return new DateIntervalFormat(skeleton, dtitvinf, new SimpleDateFormat(generator.getBestPattern(skeleton), locale));
} | [
"public",
"static",
"final",
"DateIntervalFormat",
"getInstance",
"(",
"String",
"skeleton",
",",
"ULocale",
"locale",
",",
"DateIntervalInfo",
"dtitvinf",
")",
"{",
"// clone. If it is frozen, clone returns itself, otherwise, clone",
"// returns a copy.",
"dtitvinf",
"=",
"(... | Construct a DateIntervalFormat from skeleton
a DateIntervalInfo, and the given locale.
<P>
In this factory method, user provides its own date interval pattern
information, instead of using those pre-defined data in resource file.
This factory method is for powerful users who want to provide their own
interval patterns.
<P>
There are pre-defined skeleton in DateFormat,
such as MONTH_DAY, YEAR_MONTH_WEEKDAY_DAY etc.
Those skeletons have pre-defined interval patterns in resource files.
Users are encouraged to use them.
For example:
DateIntervalFormat.getInstance(DateFormat.MONTH_DAY, false, loc,itvinf);
the DateIntervalInfo provides the interval patterns.
User are encouraged to set default interval pattern in DateIntervalInfo
as well, if they want to set other interval patterns ( instead of
reading the interval patterns from resource files).
When the corresponding interval pattern for a largest calendar different
field is not found ( if user not set it ), interval format fallback to
the default interval pattern.
If user does not provide default interval pattern, it fallback to
"{date0} - {date1}"
@param skeleton the skeleton on which interval format based.
@param locale the given locale
@param dtitvinf the DateIntervalInfo object to be adopted.
@return a date time interval formatter. | [
"Construct",
"a",
"DateIntervalFormat",
"from",
"skeleton",
"a",
"DateIntervalInfo",
"and",
"the",
"given",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L554-L563 |
google/error-prone | core/src/main/java/com/google/errorprone/refaster/ULabeledStatement.java | ULabeledStatement.inlineLabel | @Nullable
static Name inlineLabel(@Nullable CharSequence label, Inliner inliner) {
return (label == null)
? null
: inliner.asName(inliner.getOptionalBinding(new Key(label)).or(label));
} | java | @Nullable
static Name inlineLabel(@Nullable CharSequence label, Inliner inliner) {
return (label == null)
? null
: inliner.asName(inliner.getOptionalBinding(new Key(label)).or(label));
} | [
"@",
"Nullable",
"static",
"Name",
"inlineLabel",
"(",
"@",
"Nullable",
"CharSequence",
"label",
",",
"Inliner",
"inliner",
")",
"{",
"return",
"(",
"label",
"==",
"null",
")",
"?",
"null",
":",
"inliner",
".",
"asName",
"(",
"inliner",
".",
"getOptionalBi... | Returns either the {@code Name} bound to the specified label, or a {@code Name} representing
the original label if none is already bound. | [
"Returns",
"either",
"the",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/refaster/ULabeledStatement.java#L47-L52 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/MultiMap.java | MultiMap.getOrCreate | public D getOrCreate(E el, P pseudo)
{
D ret;
if (pseudo == null)
{
ret = mainMap.get(el);
if (ret == null)
{
ret = createDataInstance();
mainMap.put(el, ret);
}
}
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
{
map = new HashMap<P, D>();
pseudoMaps.put(el, map);
}
ret = map.get(pseudo);
if (ret == null)
{
ret = createDataInstance();
map.put(pseudo, ret);
}
}
return ret;
} | java | public D getOrCreate(E el, P pseudo)
{
D ret;
if (pseudo == null)
{
ret = mainMap.get(el);
if (ret == null)
{
ret = createDataInstance();
mainMap.put(el, ret);
}
}
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
{
map = new HashMap<P, D>();
pseudoMaps.put(el, map);
}
ret = map.get(pseudo);
if (ret == null)
{
ret = createDataInstance();
map.put(pseudo, ret);
}
}
return ret;
} | [
"public",
"D",
"getOrCreate",
"(",
"E",
"el",
",",
"P",
"pseudo",
")",
"{",
"D",
"ret",
";",
"if",
"(",
"pseudo",
"==",
"null",
")",
"{",
"ret",
"=",
"mainMap",
".",
"get",
"(",
"el",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"ret",... | Gets the data or creates an empty list if it does not exist yet.
@param el the element
@param pseudo a pseudo-element or null, if no pseudo-element is required
@return the stored data | [
"Gets",
"the",
"data",
"or",
"creates",
"an",
"empty",
"list",
"if",
"it",
"does",
"not",
"exist",
"yet",
"."
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/MultiMap.java#L96-L124 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper._hasSideEffects | protected Boolean _hasSideEffects(XCollectionLiteral expression, ISideEffectContext context) {
context.open();
for (final XExpression ex : expression.getElements()) {
if (hasSideEffects(ex, context)) {
return true;
}
}
context.close();
return false;
} | java | protected Boolean _hasSideEffects(XCollectionLiteral expression, ISideEffectContext context) {
context.open();
for (final XExpression ex : expression.getElements()) {
if (hasSideEffects(ex, context)) {
return true;
}
}
context.close();
return false;
} | [
"protected",
"Boolean",
"_hasSideEffects",
"(",
"XCollectionLiteral",
"expression",
",",
"ISideEffectContext",
"context",
")",
"{",
"context",
".",
"open",
"(",
")",
";",
"for",
"(",
"final",
"XExpression",
"ex",
":",
"expression",
".",
"getElements",
"(",
")",
... | Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects. | [
"Test",
"if",
"the",
"given",
"expression",
"has",
"side",
"effects",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L464-L473 |
Netflix/netflix-graph | src/main/java/com/netflix/nfgraph/build/NFBuildGraph.java | NFBuildGraph.addConnection | public void addConnection(String connectionModel, String nodeType, int fromOrdinal, String viaPropertyName, int toOrdinal) {
NFBuildGraphNode fromNode = nodeCache.getNode(nodeType, fromOrdinal);
NFPropertySpec propertySpec = getPropertySpec(nodeType, viaPropertyName);
int connectionModelIndex = modelHolder.getModelIndex(connectionModel);
NFBuildGraphNode toNode = nodeCache.getNode(propertySpec.getToNodeType(), toOrdinal);
addConnection(fromNode, propertySpec, connectionModelIndex, toNode);
} | java | public void addConnection(String connectionModel, String nodeType, int fromOrdinal, String viaPropertyName, int toOrdinal) {
NFBuildGraphNode fromNode = nodeCache.getNode(nodeType, fromOrdinal);
NFPropertySpec propertySpec = getPropertySpec(nodeType, viaPropertyName);
int connectionModelIndex = modelHolder.getModelIndex(connectionModel);
NFBuildGraphNode toNode = nodeCache.getNode(propertySpec.getToNodeType(), toOrdinal);
addConnection(fromNode, propertySpec, connectionModelIndex, toNode);
} | [
"public",
"void",
"addConnection",
"(",
"String",
"connectionModel",
",",
"String",
"nodeType",
",",
"int",
"fromOrdinal",
",",
"String",
"viaPropertyName",
",",
"int",
"toOrdinal",
")",
"{",
"NFBuildGraphNode",
"fromNode",
"=",
"nodeCache",
".",
"getNode",
"(",
... | Add a connection to this graph. The connection will be in the given connection model. The connection will be from the node identified by the given
<code>nodeType</code> and <code>fromOrdinal</code>. The connection will be via the specified <code>viaProperty</code> in the {@link NFNodeSpec} for
the given <code>nodeType</code>. The connection will be to the node identified by the given <code>toOrdinal</code>. The type of the to node is implied
by the <code>viaProperty</code>. | [
"Add",
"a",
"connection",
"to",
"this",
"graph",
".",
"The",
"connection",
"will",
"be",
"in",
"the",
"given",
"connection",
"model",
".",
"The",
"connection",
"will",
"be",
"from",
"the",
"node",
"identified",
"by",
"the",
"given",
"<code",
">",
"nodeType... | train | https://github.com/Netflix/netflix-graph/blob/ee129252a08a9f51dd296d6fca2f0b28b7be284e/src/main/java/com/netflix/nfgraph/build/NFBuildGraph.java#L88-L95 |
stapler/stapler | core/src/main/java/org/kohsuke/stapler/RequestImpl.java | RequestImpl.getPropertyType | private TypePair getPropertyType(Object bean, String name) throws IllegalAccessException, InvocationTargetException {
try {
PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(bean, name);
if(propDescriptor!=null) {
Method m = propDescriptor.getWriteMethod();
if(m!=null)
return new TypePair(m.getGenericParameterTypes()[0], m.getParameterTypes()[0]);
}
} catch (NoSuchMethodException e) {
// no such property
}
// try a field
try {
return new TypePair(bean.getClass().getField(name));
} catch (NoSuchFieldException e) {
// no such field
}
return null;
} | java | private TypePair getPropertyType(Object bean, String name) throws IllegalAccessException, InvocationTargetException {
try {
PropertyDescriptor propDescriptor = PropertyUtils.getPropertyDescriptor(bean, name);
if(propDescriptor!=null) {
Method m = propDescriptor.getWriteMethod();
if(m!=null)
return new TypePair(m.getGenericParameterTypes()[0], m.getParameterTypes()[0]);
}
} catch (NoSuchMethodException e) {
// no such property
}
// try a field
try {
return new TypePair(bean.getClass().getField(name));
} catch (NoSuchFieldException e) {
// no such field
}
return null;
} | [
"private",
"TypePair",
"getPropertyType",
"(",
"Object",
"bean",
",",
"String",
"name",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"try",
"{",
"PropertyDescriptor",
"propDescriptor",
"=",
"PropertyUtils",
".",
"getPropertyDescriptor",
... | Gets the type of the field/property designate by the given name. | [
"Gets",
"the",
"type",
"of",
"the",
"field",
"/",
"property",
"designate",
"by",
"the",
"given",
"name",
"."
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/RequestImpl.java#L888-L908 |
opengeospatial/teamengine | teamengine-spi/src/main/java/com/occamlab/te/spi/jaxrs/ErrorResponseBuilder.java | ErrorResponseBuilder.buildErrorResponse | public Response buildErrorResponse(int statusCode, String msg) {
ResponseBuilder rspBuilder = Response.status(statusCode);
rspBuilder.type("application/xhtml+xml; charset=UTF-8");
rspBuilder.entity(createErrorEntityAsString(statusCode, msg));
return rspBuilder.build();
} | java | public Response buildErrorResponse(int statusCode, String msg) {
ResponseBuilder rspBuilder = Response.status(statusCode);
rspBuilder.type("application/xhtml+xml; charset=UTF-8");
rspBuilder.entity(createErrorEntityAsString(statusCode, msg));
return rspBuilder.build();
} | [
"public",
"Response",
"buildErrorResponse",
"(",
"int",
"statusCode",
",",
"String",
"msg",
")",
"{",
"ResponseBuilder",
"rspBuilder",
"=",
"Response",
".",
"status",
"(",
"statusCode",
")",
";",
"rspBuilder",
".",
"type",
"(",
"\"application/xhtml+xml; charset=UTF-... | Builds a response message that indicates some kind of error has occurred.
The error message is included as the content of the xhtml:body/xhtml:p
element.
@param statusCode
The relevant HTTP error code (4xx, 5xx).
@param msg
A brief description of the error condition.
@return A <code>Response</code> instance containing an XHTML entity. | [
"Builds",
"a",
"response",
"message",
"that",
"indicates",
"some",
"kind",
"of",
"error",
"has",
"occurred",
".",
"The",
"error",
"message",
"is",
"included",
"as",
"the",
"content",
"of",
"the",
"xhtml",
":",
"body",
"/",
"xhtml",
":",
"p",
"element",
"... | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-spi/src/main/java/com/occamlab/te/spi/jaxrs/ErrorResponseBuilder.java#L26-L31 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.getBlockingLockedResources | public List<CmsResource> getBlockingLockedResources(CmsResource resource) throws CmsException {
if (resource.isFolder()) {
CmsLockFilter blockingFilter = CmsLockFilter.FILTER_ALL;
blockingFilter = blockingFilter.filterNotLockableByUser(getRequestContext().getCurrentUser());
return getLockedResources(resource, blockingFilter);
}
return Collections.<CmsResource> emptyList();
} | java | public List<CmsResource> getBlockingLockedResources(CmsResource resource) throws CmsException {
if (resource.isFolder()) {
CmsLockFilter blockingFilter = CmsLockFilter.FILTER_ALL;
blockingFilter = blockingFilter.filterNotLockableByUser(getRequestContext().getCurrentUser());
return getLockedResources(resource, blockingFilter);
}
return Collections.<CmsResource> emptyList();
} | [
"public",
"List",
"<",
"CmsResource",
">",
"getBlockingLockedResources",
"(",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"resource",
".",
"isFolder",
"(",
")",
")",
"{",
"CmsLockFilter",
"blockingFilter",
"=",
"CmsLockFilter",
".",
... | Returns a list of child resources to the given resource that can not be locked by the current user.<p>
@param resource the resource
@return a list of child resources to the given resource that can not be locked by the current user
@throws CmsException if something goes wrong reading the resources | [
"Returns",
"a",
"list",
"of",
"child",
"resources",
"to",
"the",
"given",
"resource",
"that",
"can",
"not",
"be",
"locked",
"by",
"the",
"current",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1344-L1352 |
amzn/ion-java | src/com/amazon/ion/util/IonTextUtils.java | IonTextUtils.printJsonCodePoint | public static void printJsonCodePoint(Appendable out, int codePoint)
throws IOException
{
// JSON only allows double-quote strings.
printCodePoint(out, codePoint, EscapeMode.JSON);
} | java | public static void printJsonCodePoint(Appendable out, int codePoint)
throws IOException
{
// JSON only allows double-quote strings.
printCodePoint(out, codePoint, EscapeMode.JSON);
} | [
"public",
"static",
"void",
"printJsonCodePoint",
"(",
"Appendable",
"out",
",",
"int",
"codePoint",
")",
"throws",
"IOException",
"{",
"// JSON only allows double-quote strings.",
"printCodePoint",
"(",
"out",
",",
"codePoint",
",",
"EscapeMode",
".",
"JSON",
")",
... | Prints a single Unicode code point for use in an ASCII-safe JSON string.
@param out the stream to receive the data.
@param codePoint a Unicode code point. | [
"Prints",
"a",
"single",
"Unicode",
"code",
"point",
"for",
"use",
"in",
"an",
"ASCII",
"-",
"safe",
"JSON",
"string",
"."
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonTextUtils.java#L224-L229 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/SerializationUtils.java | SerializationUtils.serializeAndEncodeObject | public static byte[] serializeAndEncodeObject(final CipherExecutor cipher,
final Serializable object) {
return serializeAndEncodeObject(cipher, object, ArrayUtils.EMPTY_OBJECT_ARRAY);
} | java | public static byte[] serializeAndEncodeObject(final CipherExecutor cipher,
final Serializable object) {
return serializeAndEncodeObject(cipher, object, ArrayUtils.EMPTY_OBJECT_ARRAY);
} | [
"public",
"static",
"byte",
"[",
"]",
"serializeAndEncodeObject",
"(",
"final",
"CipherExecutor",
"cipher",
",",
"final",
"Serializable",
"object",
")",
"{",
"return",
"serializeAndEncodeObject",
"(",
"cipher",
",",
"object",
",",
"ArrayUtils",
".",
"EMPTY_OBJECT_AR... | Serialize and encode object byte [ ].
@param cipher the cipher
@param object the object
@return the byte [] | [
"Serialize",
"and",
"encode",
"object",
"byte",
"[",
"]",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/SerializationUtils.java#L116-L119 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java | JobExecutionsInner.beginCreate | public JobExecutionInner beginCreate(String resourceGroupName, String serverName, String jobAgentName, String jobName) {
return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body();
} | java | public JobExecutionInner beginCreate(String resourceGroupName, String serverName, String jobAgentName, String jobName) {
return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body();
} | [
"public",
"JobExecutionInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"String",
"jobName",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
... | Starts an elastic job execution.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the JobExecutionInner object if successful. | [
"Starts",
"an",
"elastic",
"job",
"execution",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L604-L606 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.pathsFiles | public static List<File> pathsFiles(final String paths, final Predicate<File> predicate) {
final List<File> files = new ArrayList<File>();
for (final String filePathAndName : paths.split(File.pathSeparator)) {
final File file = new File(filePathAndName);
if (file.isDirectory()) {
try (final Stream<Path> stream = Files.walk(file.toPath(), Integer.MAX_VALUE)) {
stream.map(f -> f.toFile()).filter(predicate).forEach(files::add);
} catch (final IOException ex) {
throw new RuntimeException("Error walking path: " + file, ex);
}
} else {
if (predicate.test(file)) {
files.add(file);
}
}
}
return files;
} | java | public static List<File> pathsFiles(final String paths, final Predicate<File> predicate) {
final List<File> files = new ArrayList<File>();
for (final String filePathAndName : paths.split(File.pathSeparator)) {
final File file = new File(filePathAndName);
if (file.isDirectory()) {
try (final Stream<Path> stream = Files.walk(file.toPath(), Integer.MAX_VALUE)) {
stream.map(f -> f.toFile()).filter(predicate).forEach(files::add);
} catch (final IOException ex) {
throw new RuntimeException("Error walking path: " + file, ex);
}
} else {
if (predicate.test(file)) {
files.add(file);
}
}
}
return files;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"pathsFiles",
"(",
"final",
"String",
"paths",
",",
"final",
"Predicate",
"<",
"File",
">",
"predicate",
")",
"{",
"final",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",... | Returns a list of files from all given paths.
@param paths
Paths to search (Paths separated by {@link File#pathSeparator}.
@param predicate
Condition for files to return.
@return List of files in the given paths. | [
"Returns",
"a",
"list",
"of",
"files",
"from",
"all",
"given",
"paths",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1705-L1722 |
twilio/twilio-java | src/main/java/com/twilio/rest/monitor/v1/AlertReader.java | AlertReader.previousPage | @Override
public Page<Alert> previousPage(final Page<Alert> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.MONITOR.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | java | @Override
public Page<Alert> previousPage(final Page<Alert> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.MONITOR.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | [
"@",
"Override",
"public",
"Page",
"<",
"Alert",
">",
"previousPage",
"(",
"final",
"Page",
"<",
"Alert",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
",",
... | 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/monitor/v1/AlertReader.java#L147-L158 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java | MSPDIReader.readDay | private void readDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day, boolean readExceptionsFromDays)
{
BigInteger dayType = day.getDayType();
if (dayType != null)
{
if (dayType.intValue() == 0)
{
if (readExceptionsFromDays)
{
readExceptionDay(calendar, day);
}
}
else
{
readNormalDay(calendar, day);
}
}
} | java | private void readDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day, boolean readExceptionsFromDays)
{
BigInteger dayType = day.getDayType();
if (dayType != null)
{
if (dayType.intValue() == 0)
{
if (readExceptionsFromDays)
{
readExceptionDay(calendar, day);
}
}
else
{
readNormalDay(calendar, day);
}
}
} | [
"private",
"void",
"readDay",
"(",
"ProjectCalendar",
"calendar",
",",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
"day",
",",
"boolean",
"readExceptionsFromDays",
")",
"{",
"BigInteger",
"dayType",
"=",
"day",
".",
"getDayType... | This method extracts data for a single day from an MSPDI file.
@param calendar Calendar data
@param day Day data
@param readExceptionsFromDays read exceptions form day definitions | [
"This",
"method",
"extracts",
"data",
"for",
"a",
"single",
"day",
"from",
"an",
"MSPDI",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L491-L508 |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getMinutesDifference | public static long getMinutesDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(diffTime);
return diffInMinutes;
} | java | public static long getMinutesDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(diffTime);
return diffInMinutes;
} | [
"public",
"static",
"long",
"getMinutesDifference",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"startTime",
"=",
"startDate",
".",
"getTime",
"(",
")",
";",
"long",
"endTime",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
... | Gets the minutes difference.
@param startDate the start date
@param endDate the end date
@return the minutes difference | [
"Gets",
"the",
"minutes",
"difference",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L486-L492 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java | MavenModelScannerPlugin.createMavenPomDescriptor | protected MavenPomDescriptor createMavenPomDescriptor(Model model, Scanner scanner) {
ScannerContext context = scanner.getContext();
MavenPomDescriptor pomDescriptor = context.peek(MavenPomDescriptor.class);
if (model instanceof EffectiveModel) {
context.getStore().addDescriptorType(pomDescriptor, EffectiveDescriptor.class);
}
pomDescriptor.setName(model.getName());
pomDescriptor.setGroupId(model.getGroupId());
pomDescriptor.setArtifactId(model.getArtifactId());
pomDescriptor.setPackaging(model.getPackaging());
pomDescriptor.setVersion(model.getVersion());
pomDescriptor.setUrl(model.getUrl());
Coordinates artifactCoordinates = new ModelCoordinates(model);
MavenArtifactDescriptor artifact = getArtifactResolver(context).resolve(artifactCoordinates, context);
pomDescriptor.getDescribes().add(artifact);
return pomDescriptor;
} | java | protected MavenPomDescriptor createMavenPomDescriptor(Model model, Scanner scanner) {
ScannerContext context = scanner.getContext();
MavenPomDescriptor pomDescriptor = context.peek(MavenPomDescriptor.class);
if (model instanceof EffectiveModel) {
context.getStore().addDescriptorType(pomDescriptor, EffectiveDescriptor.class);
}
pomDescriptor.setName(model.getName());
pomDescriptor.setGroupId(model.getGroupId());
pomDescriptor.setArtifactId(model.getArtifactId());
pomDescriptor.setPackaging(model.getPackaging());
pomDescriptor.setVersion(model.getVersion());
pomDescriptor.setUrl(model.getUrl());
Coordinates artifactCoordinates = new ModelCoordinates(model);
MavenArtifactDescriptor artifact = getArtifactResolver(context).resolve(artifactCoordinates, context);
pomDescriptor.getDescribes().add(artifact);
return pomDescriptor;
} | [
"protected",
"MavenPomDescriptor",
"createMavenPomDescriptor",
"(",
"Model",
"model",
",",
"Scanner",
"scanner",
")",
"{",
"ScannerContext",
"context",
"=",
"scanner",
".",
"getContext",
"(",
")",
";",
"MavenPomDescriptor",
"pomDescriptor",
"=",
"context",
".",
"pee... | Create the descriptor and set base information.
@param model
The model.
@param scanner
The scanner.
@return The descriptor. | [
"Create",
"the",
"descriptor",
"and",
"set",
"base",
"information",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L146-L162 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.findByAccessToken | public DConnection findByAccessToken(java.lang.String accessToken) {
return queryUniqueByField(null, DConnectionMapper.Field.ACCESSTOKEN.getFieldName(), accessToken);
} | java | public DConnection findByAccessToken(java.lang.String accessToken) {
return queryUniqueByField(null, DConnectionMapper.Field.ACCESSTOKEN.getFieldName(), accessToken);
} | [
"public",
"DConnection",
"findByAccessToken",
"(",
"java",
".",
"lang",
".",
"String",
"accessToken",
")",
"{",
"return",
"queryUniqueByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"ACCESSTOKEN",
".",
"getFieldName",
"(",
")",
",",
"accessTo... | find-by method for unique field accessToken
@param accessToken the unique attribute
@return the unique DConnection for the specified accessToken | [
"find",
"-",
"by",
"method",
"for",
"unique",
"field",
"accessToken"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L43-L45 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/io/StreamUtils.java | StreamUtils.byteBufferToOutputStream | public static void byteBufferToOutputStream(ByteBuffer in, OutputStream out)
throws IOException {
final int BUF_SIZE = 8192;
if (in.hasArray()) {
out.write(in.array(), in.arrayOffset() + in.position(), in.remaining());
} else {
final byte[] b = new byte[Math.min(in.remaining(), BUF_SIZE)];
while (in.remaining() > 0) {
int bytesToRead = Math.min(in.remaining(), BUF_SIZE);
in.get(b, 0, bytesToRead);
out.write(b, 0, bytesToRead);
}
}
} | java | public static void byteBufferToOutputStream(ByteBuffer in, OutputStream out)
throws IOException {
final int BUF_SIZE = 8192;
if (in.hasArray()) {
out.write(in.array(), in.arrayOffset() + in.position(), in.remaining());
} else {
final byte[] b = new byte[Math.min(in.remaining(), BUF_SIZE)];
while (in.remaining() > 0) {
int bytesToRead = Math.min(in.remaining(), BUF_SIZE);
in.get(b, 0, bytesToRead);
out.write(b, 0, bytesToRead);
}
}
} | [
"public",
"static",
"void",
"byteBufferToOutputStream",
"(",
"ByteBuffer",
"in",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"final",
"int",
"BUF_SIZE",
"=",
"8192",
";",
"if",
"(",
"in",
".",
"hasArray",
"(",
")",
")",
"{",
"out",
".",
... | Reads the full contents of a ByteBuffer and writes them to an OutputStream. The ByteBuffer is
consumed by this operation; eg in.remaining() will be 0 after it completes successfully.
@param in ByteBuffer to write into the OutputStream
@param out Destination stream
@throws IOException If there is an error writing into the OutputStream | [
"Reads",
"the",
"full",
"contents",
"of",
"a",
"ByteBuffer",
"and",
"writes",
"them",
"to",
"an",
"OutputStream",
".",
"The",
"ByteBuffer",
"is",
"consumed",
"by",
"this",
"operation",
";",
"eg",
"in",
".",
"remaining",
"()",
"will",
"be",
"0",
"after",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/io/StreamUtils.java#L223-L238 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java | AbstractModbusMaster.maskWriteRegister | public boolean maskWriteRegister(int unitId, int ref, int andMask, int orMask) throws ModbusException {
checkTransaction();
if (maskWriteRegisterRequest == null) {
maskWriteRegisterRequest = new MaskWriteRegisterRequest();
}
maskWriteRegisterRequest.setUnitID(unitId);
maskWriteRegisterRequest.setReference(ref);
maskWriteRegisterRequest.setAndMask(andMask);
maskWriteRegisterRequest.setOrMask(orMask);
transaction.setRequest(maskWriteRegisterRequest);
transaction.execute();
MaskWriteRegisterResponse response = (MaskWriteRegisterResponse) getAndCheckResponse();
return response.getReference() == maskWriteRegisterRequest.getReference() &&
response.getAndMask() == maskWriteRegisterRequest.getAndMask() &&
response.getOrMask() == maskWriteRegisterRequest.getOrMask();
} | java | public boolean maskWriteRegister(int unitId, int ref, int andMask, int orMask) throws ModbusException {
checkTransaction();
if (maskWriteRegisterRequest == null) {
maskWriteRegisterRequest = new MaskWriteRegisterRequest();
}
maskWriteRegisterRequest.setUnitID(unitId);
maskWriteRegisterRequest.setReference(ref);
maskWriteRegisterRequest.setAndMask(andMask);
maskWriteRegisterRequest.setOrMask(orMask);
transaction.setRequest(maskWriteRegisterRequest);
transaction.execute();
MaskWriteRegisterResponse response = (MaskWriteRegisterResponse) getAndCheckResponse();
return response.getReference() == maskWriteRegisterRequest.getReference() &&
response.getAndMask() == maskWriteRegisterRequest.getAndMask() &&
response.getOrMask() == maskWriteRegisterRequest.getOrMask();
} | [
"public",
"boolean",
"maskWriteRegister",
"(",
"int",
"unitId",
",",
"int",
"ref",
",",
"int",
"andMask",
",",
"int",
"orMask",
")",
"throws",
"ModbusException",
"{",
"checkTransaction",
"(",
")",
";",
"if",
"(",
"maskWriteRegisterRequest",
"==",
"null",
")",
... | Mask write a single register to the slave.
@param unitId the slave unit id.
@param ref the offset of the register to start writing to.
@param andMask AND mask.
@param orMask OR mask.
@return true if success, i.e. response data equals to request data, false otherwise.
@throws ModbusException if an I/O error, a slave exception or
a transaction error occurs. | [
"Mask",
"write",
"a",
"single",
"register",
"to",
"the",
"slave",
"."
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java#L306-L322 |
knowm/XChart | xchart/src/main/java/org/knowm/xchart/QuickChart.java | QuickChart.getChart | public static XYChart getChart(
String chartTitle,
String xTitle,
String yTitle,
String seriesName,
double[] xData,
double[] yData) {
double[][] yData2d = {yData};
if (seriesName == null) {
return getChart(chartTitle, xTitle, yTitle, null, xData, yData2d);
} else {
return getChart(chartTitle, xTitle, yTitle, new String[] {seriesName}, xData, yData2d);
}
} | java | public static XYChart getChart(
String chartTitle,
String xTitle,
String yTitle,
String seriesName,
double[] xData,
double[] yData) {
double[][] yData2d = {yData};
if (seriesName == null) {
return getChart(chartTitle, xTitle, yTitle, null, xData, yData2d);
} else {
return getChart(chartTitle, xTitle, yTitle, new String[] {seriesName}, xData, yData2d);
}
} | [
"public",
"static",
"XYChart",
"getChart",
"(",
"String",
"chartTitle",
",",
"String",
"xTitle",
",",
"String",
"yTitle",
",",
"String",
"seriesName",
",",
"double",
"[",
"]",
"xData",
",",
"double",
"[",
"]",
"yData",
")",
"{",
"double",
"[",
"]",
"[",
... | Creates a Chart with default style
@param chartTitle the Chart title
@param xTitle The X-Axis title
@param yTitle The Y-Axis title
@param seriesName The name of the series
@param xData An array containing the X-Axis data
@param yData An array containing Y-Axis data
@return a Chart Object | [
"Creates",
"a",
"Chart",
"with",
"default",
"style"
] | train | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/QuickChart.java#L30-L44 |
js-lib-com/commons | src/main/java/js/io/FilesInputStream.java | FilesInputStream.getMeta | public <T> T getMeta(String key, Class<T> type, T defaultValue) {
String value = manifest.getMainAttributes().getValue(key);
return value == null ? defaultValue : ConverterRegistry.getConverter().asObject(value, type);
} | java | public <T> T getMeta(String key, Class<T> type, T defaultValue) {
String value = manifest.getMainAttributes().getValue(key);
return value == null ? defaultValue : ConverterRegistry.getConverter().asObject(value, type);
} | [
"public",
"<",
"T",
">",
"T",
"getMeta",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"getValue",
"(",
"key",
")",
";",
"... | Get files archive meta data converted to requested type or default value if meta data key is missing.
@param key meta data key,
@param type type to convert meta data value to,
@param defaultValue default value returned if key not found.
@param <T> meta data type.
@return meta data value converted to type or default value. | [
"Get",
"files",
"archive",
"meta",
"data",
"converted",
"to",
"requested",
"type",
"or",
"default",
"value",
"if",
"meta",
"data",
"key",
"is",
"missing",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesInputStream.java#L200-L203 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/eigen/Eigen.java | Eigen.symmetricGeneralizedEigenvalues | public static INDArray symmetricGeneralizedEigenvalues(INDArray A, boolean calculateVectors) {
INDArray eigenvalues = Nd4j.create(A.rows());
Nd4j.getBlasWrapper().syev('V', 'L', (calculateVectors ? A : A.dup()), eigenvalues);
return eigenvalues;
} | java | public static INDArray symmetricGeneralizedEigenvalues(INDArray A, boolean calculateVectors) {
INDArray eigenvalues = Nd4j.create(A.rows());
Nd4j.getBlasWrapper().syev('V', 'L', (calculateVectors ? A : A.dup()), eigenvalues);
return eigenvalues;
} | [
"public",
"static",
"INDArray",
"symmetricGeneralizedEigenvalues",
"(",
"INDArray",
"A",
",",
"boolean",
"calculateVectors",
")",
"{",
"INDArray",
"eigenvalues",
"=",
"Nd4j",
".",
"create",
"(",
"A",
".",
"rows",
"(",
")",
")",
";",
"Nd4j",
".",
"getBlasWrappe... | Compute generalized eigenvalues of the problem A x = L x.
Matrix A is modified in the process, holding eigenvectors as columns after execution.
@param A symmetric Matrix A. After execution, A will contain the eigenvectors as columns
@param calculateVectors if false, it will not modify A and calculate eigenvectors
@return a vector of eigenvalues L. | [
"Compute",
"generalized",
"eigenvalues",
"of",
"the",
"problem",
"A",
"x",
"=",
"L",
"x",
".",
"Matrix",
"A",
"is",
"modified",
"in",
"the",
"process",
"holding",
"eigenvectors",
"as",
"columns",
"after",
"execution",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/eigen/Eigen.java#L55-L59 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java | PyGenerator._generate | protected void _generate(SarlCapacity capacity, IExtraLanguageGeneratorContext context) {
final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(capacity);
final PyAppendable appendable = createAppendable(jvmType, context);
final List<? extends JvmTypeReference> superTypes;
if (!capacity.getExtends().isEmpty()) {
superTypes = capacity.getExtends();
} else {
superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Capacity.class, capacity));
}
if (generateTypeDeclaration(
this.qualifiedNameProvider.getFullyQualifiedName(capacity).toString(),
capacity.getName(), true, superTypes,
getTypeBuilder().getDocumentation(capacity),
true,
capacity.getMembers(), appendable, context, null)) {
final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(capacity);
writeFile(name, appendable, context);
}
} | java | protected void _generate(SarlCapacity capacity, IExtraLanguageGeneratorContext context) {
final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(capacity);
final PyAppendable appendable = createAppendable(jvmType, context);
final List<? extends JvmTypeReference> superTypes;
if (!capacity.getExtends().isEmpty()) {
superTypes = capacity.getExtends();
} else {
superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Capacity.class, capacity));
}
if (generateTypeDeclaration(
this.qualifiedNameProvider.getFullyQualifiedName(capacity).toString(),
capacity.getName(), true, superTypes,
getTypeBuilder().getDocumentation(capacity),
true,
capacity.getMembers(), appendable, context, null)) {
final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(capacity);
writeFile(name, appendable, context);
}
} | [
"protected",
"void",
"_generate",
"(",
"SarlCapacity",
"capacity",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"final",
"JvmDeclaredType",
"jvmType",
"=",
"getJvmModelAssociations",
"(",
")",
".",
"getInferredType",
"(",
"capacity",
")",
";",
"final",
... | Generate the given object.
@param capacity the capacity.
@param context the context. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L825-L843 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java | WebhookCluster.buildWebhook | public WebhookCluster buildWebhook(long id, String token)
{
this.webhooks.add(newBuilder(id, token).build());
return this;
} | java | public WebhookCluster buildWebhook(long id, String token)
{
this.webhooks.add(newBuilder(id, token).build());
return this;
} | [
"public",
"WebhookCluster",
"buildWebhook",
"(",
"long",
"id",
",",
"String",
"token",
")",
"{",
"this",
".",
"webhooks",
".",
"add",
"(",
"newBuilder",
"(",
"id",
",",
"token",
")",
".",
"build",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] | Creates new {@link net.dv8tion.jda.webhook.WebhookClient WebhookClients} and adds them
to this cluster.
<br>The {@link net.dv8tion.jda.webhook.WebhookClientBuilder WebhookClientBuilders}
will be supplied with the default settings of this cluster.
@param id
The id for the webhook
@param token
The token for the webhook
@throws java.lang.IllegalArgumentException
If the provided webhooks token is {@code null} or contains whitespace
@return The current WebhookCluster for chaining convenience
@see #newBuilder(long, String) | [
"Creates",
"new",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"webhook",
".",
"WebhookClient",
"WebhookClients",
"}",
"and",
"adds",
"them",
"to",
"this",
"cluster",
".",
"<br",
">",
"The",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
"."... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java#L303-L307 |
alkacon/opencms-core | src/org/opencms/util/CmsRequestUtil.java | CmsRequestUtil.readMultipartFileItems | public static List<FileItem> readMultipartFileItems(HttpServletRequest request) {
return readMultipartFileItems(request, OpenCms.getSystemInfo().getPackagesRfsPath());
} | java | public static List<FileItem> readMultipartFileItems(HttpServletRequest request) {
return readMultipartFileItems(request, OpenCms.getSystemInfo().getPackagesRfsPath());
} | [
"public",
"static",
"List",
"<",
"FileItem",
">",
"readMultipartFileItems",
"(",
"HttpServletRequest",
"request",
")",
"{",
"return",
"readMultipartFileItems",
"(",
"request",
",",
"OpenCms",
".",
"getSystemInfo",
"(",
")",
".",
"getPackagesRfsPath",
"(",
")",
")"... | Parses a request of the form <code>multipart/form-data</code>.
The result list will contain items of type <code>{@link FileItem}</code>.
If the request is not of type <code>multipart/form-data</code>, then <code>null</code> is returned.<p>
@param request the HTTP servlet request to parse
@return the list of <code>{@link FileItem}</code> extracted from the multipart request,
or <code>null</code> if the request was not of type <code>multipart/form-data</code> | [
"Parses",
"a",
"request",
"of",
"the",
"form",
"<code",
">",
"multipart",
"/",
"form",
"-",
"data<",
"/",
"code",
">",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L746-L749 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/robust/Se3FromEssentialGenerator.java | Se3FromEssentialGenerator.generate | @Override
public boolean generate(List<AssociatedPair> dataSet, Se3_F64 model ) {
if( !computeEssential.process(dataSet,E) )
return false;
// extract the possible motions
decomposeE.decompose(E);
selectBest.select(decomposeE.getSolutions(),dataSet,model);
return true;
} | java | @Override
public boolean generate(List<AssociatedPair> dataSet, Se3_F64 model ) {
if( !computeEssential.process(dataSet,E) )
return false;
// extract the possible motions
decomposeE.decompose(E);
selectBest.select(decomposeE.getSolutions(),dataSet,model);
return true;
} | [
"@",
"Override",
"public",
"boolean",
"generate",
"(",
"List",
"<",
"AssociatedPair",
">",
"dataSet",
",",
"Se3_F64",
"model",
")",
"{",
"if",
"(",
"!",
"computeEssential",
".",
"process",
"(",
"dataSet",
",",
"E",
")",
")",
"return",
"false",
";",
"// e... | Computes the camera motion from the set of observations. The motion is from the first
into the second camera frame.
@param dataSet Associated pairs in normalized camera coordinates.
@param model The best pose according to the positive depth constraint. | [
"Computes",
"the",
"camera",
"motion",
"from",
"the",
"set",
"of",
"observations",
".",
"The",
"motion",
"is",
"from",
"the",
"first",
"into",
"the",
"second",
"camera",
"frame",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/robust/Se3FromEssentialGenerator.java#L69-L79 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_http_farm_farmId_GET | public OvhBackendHttp serviceName_http_farm_farmId_GET(String serviceName, Long farmId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/farm/{farmId}";
StringBuilder sb = path(qPath, serviceName, farmId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackendHttp.class);
} | java | public OvhBackendHttp serviceName_http_farm_farmId_GET(String serviceName, Long farmId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/farm/{farmId}";
StringBuilder sb = path(qPath, serviceName, farmId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackendHttp.class);
} | [
"public",
"OvhBackendHttp",
"serviceName_http_farm_farmId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"farmId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/http/farm/{farmId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
... | Get this object properties
REST: GET /ipLoadbalancing/{serviceName}/http/farm/{farmId}
@param serviceName [required] The internal name of your IP load balancing
@param farmId [required] Id of your farm | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L364-L369 |
VueGWT/vue-gwt | core/src/main/java/com/axellience/vuegwt/core/client/vnode/builder/VNodeBuilder.java | VNodeBuilder.el | public <T extends IsVueComponent> VNode el(VueJsConstructor<T> vueJsConstructor,
Object... children) {
return el(vueJsConstructor, null, children);
} | java | public <T extends IsVueComponent> VNode el(VueJsConstructor<T> vueJsConstructor,
Object... children) {
return el(vueJsConstructor, null, children);
} | [
"public",
"<",
"T",
"extends",
"IsVueComponent",
">",
"VNode",
"el",
"(",
"VueJsConstructor",
"<",
"T",
">",
"vueJsConstructor",
",",
"Object",
"...",
"children",
")",
"{",
"return",
"el",
"(",
"vueJsConstructor",
",",
"null",
",",
"children",
")",
";",
"}... | Create a VNode with the {@link IsVueComponent} of the given {@link VueJsConstructor}
@param vueJsConstructor {@link VueJsConstructor} for the Component we want
@param children Children
@param <T> The type of the {@link IsVueComponent}
@return a new VNode of this Component | [
"Create",
"a",
"VNode",
"with",
"the",
"{",
"@link",
"IsVueComponent",
"}",
"of",
"the",
"given",
"{",
"@link",
"VueJsConstructor",
"}"
] | train | https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/vnode/builder/VNodeBuilder.java#L87-L90 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/CleaneLingStyleSolver.java | CleaneLingStyleSolver.addWatch | protected void addWatch(final int lit, final int blit, final boolean binary, final CLClause clause) {
watches(lit).push(new CLWatch(blit, binary, clause));
} | java | protected void addWatch(final int lit, final int blit, final boolean binary, final CLClause clause) {
watches(lit).push(new CLWatch(blit, binary, clause));
} | [
"protected",
"void",
"addWatch",
"(",
"final",
"int",
"lit",
",",
"final",
"int",
"blit",
",",
"final",
"boolean",
"binary",
",",
"final",
"CLClause",
"clause",
")",
"{",
"watches",
"(",
"lit",
")",
".",
"push",
"(",
"new",
"CLWatch",
"(",
"blit",
",",... | Adds a new watcher for a given literal.
@param lit the literal
@param blit the blocking literal
@param binary indicates whether it is a binary clause or not
@param clause the watched clause | [
"Adds",
"a",
"new",
"watcher",
"for",
"a",
"given",
"literal",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingStyleSolver.java#L353-L355 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.ipxeScript_name_GET | public OvhIpxe ipxeScript_name_GET(String name) throws IOException {
String qPath = "/me/ipxeScript/{name}";
StringBuilder sb = path(qPath, name);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhIpxe.class);
} | java | public OvhIpxe ipxeScript_name_GET(String name) throws IOException {
String qPath = "/me/ipxeScript/{name}";
StringBuilder sb = path(qPath, name);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhIpxe.class);
} | [
"public",
"OvhIpxe",
"ipxeScript_name_GET",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/ipxeScript/{name}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"name",
")",
";",
"String",
"resp",
"=",
"exe... | Get this object properties
REST: GET /me/ipxeScript/{name}
@param name [required] Name of this script | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L937-L942 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/IoFilterManager.java | IoFilterManager.resolveInstallationErrorsOnCluster_Task | public Task resolveInstallationErrorsOnCluster_Task(String filterId, ClusterComputeResource cluster) throws NotFound, RuntimeFault, RemoteException {
return new Task(getServerConnection(), getVimService().resolveInstallationErrorsOnCluster_Task(getMOR(), filterId, cluster.getMOR()));
} | java | public Task resolveInstallationErrorsOnCluster_Task(String filterId, ClusterComputeResource cluster) throws NotFound, RuntimeFault, RemoteException {
return new Task(getServerConnection(), getVimService().resolveInstallationErrorsOnCluster_Task(getMOR(), filterId, cluster.getMOR()));
} | [
"public",
"Task",
"resolveInstallationErrorsOnCluster_Task",
"(",
"String",
"filterId",
",",
"ClusterComputeResource",
"cluster",
")",
"throws",
"NotFound",
",",
"RuntimeFault",
",",
"RemoteException",
"{",
"return",
"new",
"Task",
"(",
"getServerConnection",
"(",
")",
... | Resolve the errors occured during an installation/uninstallation/upgrade operation of an IO Filter on a cluster.
Depending on the nature of the installation failure, vCenter will take the appropriate actions to resolve it. For
example, retry or resume installation.
@param filterId
- ID of the filter.
@param cluster
- The compute resource to install the IO Filter on. "compRes" must be a cluster.
@return - This method returns a Task object with which to monitor the operation. The task is set to success if
all the errors related to the filter are resolved on the cluster. If the task fails, first check error to
see the error. If the error indicates that issues persist on the cluster, use QueryIoFilterIssues to get
the detailed errors on the hosts in the cluster. The dynamic privilege check will ensure that the
appropriate privileges must be acquired for all the hosts in the cluster based on the remediation
actions. For example, Host.Config.Maintenance privilege and Host.Config.Patch privileges must be required
for upgrading a VIB.
@throws RuntimeFault
- Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example,
a communication error.
@throws NotFound
@throws RemoteException | [
"Resolve",
"the",
"errors",
"occured",
"during",
"an",
"installation",
"/",
"uninstallation",
"/",
"upgrade",
"operation",
"of",
"an",
"IO",
"Filter",
"on",
"a",
"cluster",
".",
"Depending",
"on",
"the",
"nature",
"of",
"the",
"installation",
"failure",
"vCent... | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/IoFilterManager.java#L151-L153 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java | JSONHelpers.getJSONColor | public static int getJSONColor(final JSONObject json, String elementName, int defColor) {
try {
return getJSONColor(json, elementName);
} catch (JSONException e) {
return defColor;
}
} | java | public static int getJSONColor(final JSONObject json, String elementName, int defColor) {
try {
return getJSONColor(json, elementName);
} catch (JSONException e) {
return defColor;
}
} | [
"public",
"static",
"int",
"getJSONColor",
"(",
"final",
"JSONObject",
"json",
",",
"String",
"elementName",
",",
"int",
"defColor",
")",
"{",
"try",
"{",
"return",
"getJSONColor",
"(",
"json",
",",
"elementName",
")",
";",
"}",
"catch",
"(",
"JSONException"... | Attempts to get a color formatted as an integer with ARGB ordering. If the specified field
doesn't exist, returns {@code defColor}.
@param json {@link JSONObject} to get the color from
@param elementName Name of the color element
@param defColor Color to return if the element doesn't exist
@return An ARGB formatted integer | [
"Attempts",
"to",
"get",
"a",
"color",
"formatted",
"as",
"an",
"integer",
"with",
"ARGB",
"ordering",
".",
"If",
"the",
"specified",
"field",
"doesn",
"t",
"exist",
"returns",
"{",
"@code",
"defColor",
"}",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L1648-L1654 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/JSMinPostProcessor.java | JSMinPostProcessor.byteArrayToString | private StringBuffer byteArrayToString(Charset charset, byte[] minified) throws IOException {
// Write the data into a string
ReadableByteChannel chan = Channels.newChannel(new ByteArrayInputStream(minified));
Reader rd = Channels.newReader(chan, charset.newDecoder(), -1);
StringWriter writer = new StringWriter();
IOUtils.copy(rd, writer, true);
return writer.getBuffer();
} | java | private StringBuffer byteArrayToString(Charset charset, byte[] minified) throws IOException {
// Write the data into a string
ReadableByteChannel chan = Channels.newChannel(new ByteArrayInputStream(minified));
Reader rd = Channels.newReader(chan, charset.newDecoder(), -1);
StringWriter writer = new StringWriter();
IOUtils.copy(rd, writer, true);
return writer.getBuffer();
} | [
"private",
"StringBuffer",
"byteArrayToString",
"(",
"Charset",
"charset",
",",
"byte",
"[",
"]",
"minified",
")",
"throws",
"IOException",
"{",
"// Write the data into a string",
"ReadableByteChannel",
"chan",
"=",
"Channels",
".",
"newChannel",
"(",
"new",
"ByteArra... | Convert a byte array to a String buffer taking into account the charset
@param charset
the charset
@param minified
the byte array
@return the string buffer
@throws IOException
if an IO exception occurs | [
"Convert",
"a",
"byte",
"array",
"to",
"a",
"String",
"buffer",
"taking",
"into",
"account",
"the",
"charset"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/JSMinPostProcessor.java#L123-L130 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/ImageAnchorCell.java | ImageAnchorCell.renderDataCellContents | protected void renderDataCellContents(AbstractRenderAppender appender, String jspFragmentOutput) {
assert DECORATOR != null;
assert appender != null;
assert _imageAnchorCellModel != null;
String script = null;
/* render any JavaScript needed to support framework features */
if (_imageState.id != null) {
HttpServletRequest request = JspUtil.getRequest(getJspContext());
script = renderNameAndId(request, _imageState, null);
}
/* render any JavaScript needed to support framework features */
if (_anchorState.id != null) {
HttpServletRequest request = JspUtil.getRequest(getJspContext());
String anchorScript = renderNameAndId(request, _anchorState, null);
if(anchorScript != null)
script = (script != null ? script += anchorScript : anchorScript);
}
_imageAnchorCellModel.setJavascript(script);
DECORATOR.decorate(getJspContext(), appender, _imageAnchorCellModel);
} | java | protected void renderDataCellContents(AbstractRenderAppender appender, String jspFragmentOutput) {
assert DECORATOR != null;
assert appender != null;
assert _imageAnchorCellModel != null;
String script = null;
/* render any JavaScript needed to support framework features */
if (_imageState.id != null) {
HttpServletRequest request = JspUtil.getRequest(getJspContext());
script = renderNameAndId(request, _imageState, null);
}
/* render any JavaScript needed to support framework features */
if (_anchorState.id != null) {
HttpServletRequest request = JspUtil.getRequest(getJspContext());
String anchorScript = renderNameAndId(request, _anchorState, null);
if(anchorScript != null)
script = (script != null ? script += anchorScript : anchorScript);
}
_imageAnchorCellModel.setJavascript(script);
DECORATOR.decorate(getJspContext(), appender, _imageAnchorCellModel);
} | [
"protected",
"void",
"renderDataCellContents",
"(",
"AbstractRenderAppender",
"appender",
",",
"String",
"jspFragmentOutput",
")",
"{",
"assert",
"DECORATOR",
"!=",
"null",
";",
"assert",
"appender",
"!=",
"null",
";",
"assert",
"_imageAnchorCellModel",
"!=",
"null",
... | Render the contents of the HTML anchor and image. This method calls to an
{@link org.apache.beehive.netui.databinding.datagrid.api.rendering.CellDecorator} associated with this tag.
The result of renderingi is appended to the <code>appender</code>
@param appender the {@link AbstractRenderAppender} to which output should be rendered
@param jspFragmentOutput the result of having evaluated this tag's {@link javax.servlet.jsp.tagext.JspFragment} | [
"Render",
"the",
"contents",
"of",
"the",
"HTML",
"anchor",
"and",
"image",
".",
"This",
"method",
"calls",
"to",
"an",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/ImageAnchorCell.java#L669-L692 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.