repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src/org/opencms/loader/CmsResourceManager.java | CmsResourceManager.loadResource | public void loadResource(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException, CmsException {
res.setContentType(getMimeType(resource.getName(), cms.getRequestContext().getEncoding()));
I_CmsResourceLoader loader = getLoader(resource);
loader.load(cms, resource, req, res);
} | java | public void loadResource(CmsObject cms, CmsResource resource, HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException, CmsException {
res.setContentType(getMimeType(resource.getName(), cms.getRequestContext().getEncoding()));
I_CmsResourceLoader loader = getLoader(resource);
loader.load(cms, resource, req, res);
} | [
"public",
"void",
"loadResource",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"throws",
"ServletException",
",",
"IOException",
",",
"CmsException",
"{",
"res",
".",
"setContentTy... | Loads the requested resource and writes the contents to the response stream.<p>
@param req the current HTTP request
@param res the current HTTP response
@param cms the current OpenCms user context
@param resource the requested resource
@throws ServletException if something goes wrong
@throws IOException if something goes wrong
@throws CmsException if something goes wrong | [
"Loads",
"the",
"requested",
"resource",
"and",
"writes",
"the",
"contents",
"to",
"the",
"response",
"stream",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsResourceManager.java#L1189-L1195 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.getCacheKey | private String getCacheKey(String prefix, boolean flag, CmsUUID projectId, String resource) {
StringBuffer b = new StringBuffer(64);
if (prefix != null) {
b.append(prefix);
b.append(flag ? '+' : '-');
}
b.append(CmsProject.isOnlineProject(projectId) ? '+' : '-');
return b.append(resource).toString();
} | java | private String getCacheKey(String prefix, boolean flag, CmsUUID projectId, String resource) {
StringBuffer b = new StringBuffer(64);
if (prefix != null) {
b.append(prefix);
b.append(flag ? '+' : '-');
}
b.append(CmsProject.isOnlineProject(projectId) ? '+' : '-');
return b.append(resource).toString();
} | [
"private",
"String",
"getCacheKey",
"(",
"String",
"prefix",
",",
"boolean",
"flag",
",",
"CmsUUID",
"projectId",
",",
"String",
"resource",
")",
"{",
"StringBuffer",
"b",
"=",
"new",
"StringBuffer",
"(",
"64",
")",
";",
"if",
"(",
"prefix",
"!=",
"null",
... | Return a cache key build from the provided information.<p>
@param prefix a prefix for the key
@param flag a boolean flag for the key (only used if prefix is not null)
@param projectId the project for which to generate the key
@param resource the resource for which to generate the key
@return String a cache key build from the provided information | [
"Return",
"a",
"cache",
"key",
"build",
"from",
"the",
"provided",
"information",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L11166-L11175 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmonbindings_binding.java | lbmonbindings_binding.get | public static lbmonbindings_binding get(nitro_service service, String monitorname) throws Exception{
lbmonbindings_binding obj = new lbmonbindings_binding();
obj.set_monitorname(monitorname);
lbmonbindings_binding response = (lbmonbindings_binding) obj.get_resource(service);
return response;
} | java | public static lbmonbindings_binding get(nitro_service service, String monitorname) throws Exception{
lbmonbindings_binding obj = new lbmonbindings_binding();
obj.set_monitorname(monitorname);
lbmonbindings_binding response = (lbmonbindings_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"lbmonbindings_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"monitorname",
")",
"throws",
"Exception",
"{",
"lbmonbindings_binding",
"obj",
"=",
"new",
"lbmonbindings_binding",
"(",
")",
";",
"obj",
".",
"set_monitorname",
"("... | Use this API to fetch lbmonbindings_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"lbmonbindings_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmonbindings_binding.java#L114-L119 |
att/AAF | cadi/core/src/main/java/com/att/cadi/Symm.java | Symm.exec | private synchronized void exec(AESExec exec) throws IOException {
if(aes == null) {
try {
byte[] bytes = new byte[AES.AES_KEY_SIZE/8];
int offset = (Math.abs(codeset[0])+47)%(codeset.length-bytes.length);
for(int i=0;i<bytes.length;++i) {
bytes[i] = (byte)codeset[i+offset];
}
aes = new AES(bytes,0,bytes.length);
} catch (Exception e) {
throw new IOException(e);
}
}
exec.exec(aes);
} | java | private synchronized void exec(AESExec exec) throws IOException {
if(aes == null) {
try {
byte[] bytes = new byte[AES.AES_KEY_SIZE/8];
int offset = (Math.abs(codeset[0])+47)%(codeset.length-bytes.length);
for(int i=0;i<bytes.length;++i) {
bytes[i] = (byte)codeset[i+offset];
}
aes = new AES(bytes,0,bytes.length);
} catch (Exception e) {
throw new IOException(e);
}
}
exec.exec(aes);
} | [
"private",
"synchronized",
"void",
"exec",
"(",
"AESExec",
"exec",
")",
"throws",
"IOException",
"{",
"if",
"(",
"aes",
"==",
"null",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"AES",
".",
"AES_KEY_SIZE",
"/",
"8",
"]",... | /*
Note: AES Encryption is NOT thread-safe. Must surround entire use with synchronized | [
"/",
"*",
"Note",
":",
"AES",
"Encryption",
"is",
"NOT",
"thread",
"-",
"safe",
".",
"Must",
"surround",
"entire",
"use",
"with",
"synchronized"
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L190-L204 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/operators/LatchedObserver.java | LatchedObserver.createIndexed | public static <T> LatchedObserver<T> createIndexed(Action2<? super T, ? super Integer> onNext, Action1<? super Throwable> onError) {
return createIndexed(onNext, onError, new CountDownLatch(1));
} | java | public static <T> LatchedObserver<T> createIndexed(Action2<? super T, ? super Integer> onNext, Action1<? super Throwable> onError) {
return createIndexed(onNext, onError, new CountDownLatch(1));
} | [
"public",
"static",
"<",
"T",
">",
"LatchedObserver",
"<",
"T",
">",
"createIndexed",
"(",
"Action2",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"Integer",
">",
"onNext",
",",
"Action1",
"<",
"?",
"super",
"Throwable",
">",
"onError",
")",
"{",
"return... | Create a LatchedObserver with the given indexed callback function(s). | [
"Create",
"a",
"LatchedObserver",
"with",
"the",
"given",
"indexed",
"callback",
"function",
"(",
"s",
")",
"."
] | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/operators/LatchedObserver.java#L172-L174 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageRequest.java | MessageRequest.withEndpoints | public MessageRequest withEndpoints(java.util.Map<String, EndpointSendConfiguration> endpoints) {
setEndpoints(endpoints);
return this;
} | java | public MessageRequest withEndpoints(java.util.Map<String, EndpointSendConfiguration> endpoints) {
setEndpoints(endpoints);
return this;
} | [
"public",
"MessageRequest",
"withEndpoints",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"EndpointSendConfiguration",
">",
"endpoints",
")",
"{",
"setEndpoints",
"(",
"endpoints",
")",
";",
"return",
"this",
";",
"}"
] | A map of key-value pairs, where each key is an endpoint ID and each value is an EndpointSendConfiguration object.
Within an EndpointSendConfiguration object, you can tailor the message for an endpoint by specifying message
overrides or substitutions.
@param endpoints
A map of key-value pairs, where each key is an endpoint ID and each value is an EndpointSendConfiguration
object. Within an EndpointSendConfiguration object, you can tailor the message for an endpoint by
specifying message overrides or substitutions.
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"map",
"of",
"key",
"-",
"value",
"pairs",
"where",
"each",
"key",
"is",
"an",
"endpoint",
"ID",
"and",
"each",
"value",
"is",
"an",
"EndpointSendConfiguration",
"object",
".",
"Within",
"an",
"EndpointSendConfiguration",
"object",
"you",
"can",
"tailor",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageRequest.java#L213-L216 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/DiSH.java | DiSH.sortClusters | private List<Cluster<SubspaceModel>> sortClusters(Relation<V> relation, Object2ObjectMap<long[], List<ArrayModifiableDBIDs>> clustersMap) {
final int db_dim = RelationUtil.dimensionality(relation);
// int num = 1;
List<Cluster<SubspaceModel>> clusters = new ArrayList<>();
for(long[] pv : clustersMap.keySet()) {
List<ArrayModifiableDBIDs> parallelClusters = clustersMap.get(pv);
for(int i = 0; i < parallelClusters.size(); i++) {
ArrayModifiableDBIDs c = parallelClusters.get(i);
Cluster<SubspaceModel> cluster = new Cluster<>(c);
cluster.setModel(new SubspaceModel(new Subspace(pv), Centroid.make(relation, c).getArrayRef()));
String subspace = BitsUtil.toStringLow(cluster.getModel().getSubspace().getDimensions(), db_dim);
cluster.setName(parallelClusters.size() > 1 ? ("Cluster_" + subspace + "_" + i) : ("Cluster_" + subspace));
clusters.add(cluster);
}
}
// sort the clusters w.r.t. lambda
Comparator<Cluster<SubspaceModel>> comparator = new Comparator<Cluster<SubspaceModel>>() {
@Override
public int compare(Cluster<SubspaceModel> c1, Cluster<SubspaceModel> c2) {
return c2.getModel().getSubspace().dimensionality() - c1.getModel().getSubspace().dimensionality();
}
};
Collections.sort(clusters, comparator);
return clusters;
} | java | private List<Cluster<SubspaceModel>> sortClusters(Relation<V> relation, Object2ObjectMap<long[], List<ArrayModifiableDBIDs>> clustersMap) {
final int db_dim = RelationUtil.dimensionality(relation);
// int num = 1;
List<Cluster<SubspaceModel>> clusters = new ArrayList<>();
for(long[] pv : clustersMap.keySet()) {
List<ArrayModifiableDBIDs> parallelClusters = clustersMap.get(pv);
for(int i = 0; i < parallelClusters.size(); i++) {
ArrayModifiableDBIDs c = parallelClusters.get(i);
Cluster<SubspaceModel> cluster = new Cluster<>(c);
cluster.setModel(new SubspaceModel(new Subspace(pv), Centroid.make(relation, c).getArrayRef()));
String subspace = BitsUtil.toStringLow(cluster.getModel().getSubspace().getDimensions(), db_dim);
cluster.setName(parallelClusters.size() > 1 ? ("Cluster_" + subspace + "_" + i) : ("Cluster_" + subspace));
clusters.add(cluster);
}
}
// sort the clusters w.r.t. lambda
Comparator<Cluster<SubspaceModel>> comparator = new Comparator<Cluster<SubspaceModel>>() {
@Override
public int compare(Cluster<SubspaceModel> c1, Cluster<SubspaceModel> c2) {
return c2.getModel().getSubspace().dimensionality() - c1.getModel().getSubspace().dimensionality();
}
};
Collections.sort(clusters, comparator);
return clusters;
} | [
"private",
"List",
"<",
"Cluster",
"<",
"SubspaceModel",
">",
">",
"sortClusters",
"(",
"Relation",
"<",
"V",
">",
"relation",
",",
"Object2ObjectMap",
"<",
"long",
"[",
"]",
",",
"List",
"<",
"ArrayModifiableDBIDs",
">",
">",
"clustersMap",
")",
"{",
"fin... | Returns a sorted list of the clusters w.r.t. the subspace dimensionality in
descending order.
@param relation the database storing the objects
@param clustersMap the mapping of bits sets to clusters
@return a sorted list of the clusters | [
"Returns",
"a",
"sorted",
"list",
"of",
"the",
"clusters",
"w",
".",
"r",
".",
"t",
".",
"the",
"subspace",
"dimensionality",
"in",
"descending",
"order",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/DiSH.java#L334-L359 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeQueryParam | public static String encodeQueryParam(String queryParam, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(queryParam, encoding, HierarchicalUriComponents.Type.QUERY_PARAM);
} | java | public static String encodeQueryParam(String queryParam, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(queryParam, encoding, HierarchicalUriComponents.Type.QUERY_PARAM);
} | [
"public",
"static",
"String",
"encodeQueryParam",
"(",
"String",
"queryParam",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"queryParam",
",",
"encoding",
",",
"Hier... | Encodes the given URI query parameter with the given encoding.
@param queryParam the query parameter to be encoded
@param encoding the character encoding to encode to
@return the encoded query parameter
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"query",
"parameter",
"with",
"the",
"given",
"encoding",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L307-L309 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java | Normalization.minMaxColumns | public static List<Row> minMaxColumns(DataRowsFacade data, List<String> columns) {
String[] arr = new String[columns.size()];
for (int i = 0; i < arr.length; i++)
arr[i] = columns.get(i);
return minMaxColumns(data, arr);
} | java | public static List<Row> minMaxColumns(DataRowsFacade data, List<String> columns) {
String[] arr = new String[columns.size()];
for (int i = 0; i < arr.length; i++)
arr[i] = columns.get(i);
return minMaxColumns(data, arr);
} | [
"public",
"static",
"List",
"<",
"Row",
">",
"minMaxColumns",
"(",
"DataRowsFacade",
"data",
",",
"List",
"<",
"String",
">",
"columns",
")",
"{",
"String",
"[",
"]",
"arr",
"=",
"new",
"String",
"[",
"columns",
".",
"size",
"(",
")",
"]",
";",
"for"... | Returns the min and max of the given columns
@param data the data to get the max for
@param columns the columns to get the
@return | [
"Returns",
"the",
"min",
"and",
"max",
"of",
"the",
"given",
"columns"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java#L199-L204 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listEntitiesWithServiceResponseAsync | public Observable<ServiceResponse<List<EntityExtractor>>> listEntitiesWithServiceResponseAsync(UUID appId, String versionId, ListEntitiesOptionalParameter listEntitiesOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final Integer skip = listEntitiesOptionalParameter != null ? listEntitiesOptionalParameter.skip() : null;
final Integer take = listEntitiesOptionalParameter != null ? listEntitiesOptionalParameter.take() : null;
return listEntitiesWithServiceResponseAsync(appId, versionId, skip, take);
} | java | public Observable<ServiceResponse<List<EntityExtractor>>> listEntitiesWithServiceResponseAsync(UUID appId, String versionId, ListEntitiesOptionalParameter listEntitiesOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final Integer skip = listEntitiesOptionalParameter != null ? listEntitiesOptionalParameter.skip() : null;
final Integer take = listEntitiesOptionalParameter != null ? listEntitiesOptionalParameter.take() : null;
return listEntitiesWithServiceResponseAsync(appId, versionId, skip, take);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"List",
"<",
"EntityExtractor",
">",
">",
">",
"listEntitiesWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListEntitiesOptionalParameter",
"listEntitiesOptionalParameter",
")",
"{",
... | Gets information about the entity models.
@param appId The application ID.
@param versionId The version ID.
@param listEntitiesOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<EntityExtractor> object | [
"Gets",
"information",
"about",
"the",
"entity",
"models",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1148-L1162 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/generator/InvoiceDateUtils.java | InvoiceDateUtils.calculateProrationBetweenDates | private static BigDecimal calculateProrationBetweenDates(final LocalDate startDate, final LocalDate endDate, final LocalDate previousBillingCycleDate, final LocalDate nextBillingCycleDate) {
final int daysBetween = Days.daysBetween(previousBillingCycleDate, nextBillingCycleDate).getDays();
return calculateProrationBetweenDates(startDate, endDate, daysBetween);
} | java | private static BigDecimal calculateProrationBetweenDates(final LocalDate startDate, final LocalDate endDate, final LocalDate previousBillingCycleDate, final LocalDate nextBillingCycleDate) {
final int daysBetween = Days.daysBetween(previousBillingCycleDate, nextBillingCycleDate).getDays();
return calculateProrationBetweenDates(startDate, endDate, daysBetween);
} | [
"private",
"static",
"BigDecimal",
"calculateProrationBetweenDates",
"(",
"final",
"LocalDate",
"startDate",
",",
"final",
"LocalDate",
"endDate",
",",
"final",
"LocalDate",
"previousBillingCycleDate",
",",
"final",
"LocalDate",
"nextBillingCycleDate",
")",
"{",
"final",
... | Called internally to calculate proration or when we recalculate approximate repair amount
@param startDate start date of the prorated interval
@param endDate end date of the prorated interval
@param previousBillingCycleDate start date of the period
@param nextBillingCycleDate end date of the period | [
"Called",
"internally",
"to",
"calculate",
"proration",
"or",
"when",
"we",
"recalculate",
"approximate",
"repair",
"amount"
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/generator/InvoiceDateUtils.java#L73-L76 |
lets-blade/blade | src/main/java/com/blade/Blade.java | Blade.enableCors | public Blade enableCors(boolean enableCors, CorsConfiger corsConfig) {
this.environment.set(ENV_KEY_CORS_ENABLE, enableCors);
if (enableCors) {
this.corsMiddleware = new CorsMiddleware(corsConfig);
}
return this;
} | java | public Blade enableCors(boolean enableCors, CorsConfiger corsConfig) {
this.environment.set(ENV_KEY_CORS_ENABLE, enableCors);
if (enableCors) {
this.corsMiddleware = new CorsMiddleware(corsConfig);
}
return this;
} | [
"public",
"Blade",
"enableCors",
"(",
"boolean",
"enableCors",
",",
"CorsConfiger",
"corsConfig",
")",
"{",
"this",
".",
"environment",
".",
"set",
"(",
"ENV_KEY_CORS_ENABLE",
",",
"enableCors",
")",
";",
"if",
"(",
"enableCors",
")",
"{",
"this",
".",
"cors... | Set whether to config cors
@param enableCors enable cors
@param corsConfig config cors
@return blade | [
"Set",
"whether",
"to",
"config",
"cors"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Blade.java#L540-L546 |
jenkinsci/jenkins | core/src/main/java/jenkins/model/NodeListener.java | NodeListener.fireOnUpdated | public static void fireOnUpdated(@Nonnull Node oldOne, @Nonnull Node newOne) {
for (NodeListener nl: all()) {
try {
nl.onUpdated(oldOne, newOne);
} catch (Throwable ex) {
LOGGER.log(Level.WARNING, "Listener invocation failed", ex);
}
}
} | java | public static void fireOnUpdated(@Nonnull Node oldOne, @Nonnull Node newOne) {
for (NodeListener nl: all()) {
try {
nl.onUpdated(oldOne, newOne);
} catch (Throwable ex) {
LOGGER.log(Level.WARNING, "Listener invocation failed", ex);
}
}
} | [
"public",
"static",
"void",
"fireOnUpdated",
"(",
"@",
"Nonnull",
"Node",
"oldOne",
",",
"@",
"Nonnull",
"Node",
"newOne",
")",
"{",
"for",
"(",
"NodeListener",
"nl",
":",
"all",
"(",
")",
")",
"{",
"try",
"{",
"nl",
".",
"onUpdated",
"(",
"oldOne",
... | Inform listeners that node is being updated.
@param oldOne Old configuration.
@param newOne New Configuration. | [
"Inform",
"listeners",
"that",
"node",
"is",
"being",
"updated",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/NodeListener.java#L81-L89 |
yidongnan/grpc-spring-boot-starter | grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/inject/GrpcClientBeanPostProcessor.java | GrpcClientBeanPostProcessor.processInjectionPoint | protected <T> T processInjectionPoint(final Member injectionTarget, final Class<T> injectionType,
final GrpcClient annotation) {
final List<ClientInterceptor> interceptors = interceptorsFromAnnotation(annotation);
final String name = annotation.value();
final Channel channel;
try {
channel = getChannelFactory().createChannel(name, interceptors);
if (channel == null) {
throw new IllegalStateException("Channel factory created a null channel for " + name);
}
} catch (final RuntimeException e) {
throw new IllegalStateException("Failed to create channel: " + name, e);
}
final T value = valueForMember(name, injectionTarget, injectionType, channel);
if (value == null) {
throw new IllegalStateException(
"Injection value is null unexpectedly for " + name + " at " + injectionTarget);
}
return value;
} | java | protected <T> T processInjectionPoint(final Member injectionTarget, final Class<T> injectionType,
final GrpcClient annotation) {
final List<ClientInterceptor> interceptors = interceptorsFromAnnotation(annotation);
final String name = annotation.value();
final Channel channel;
try {
channel = getChannelFactory().createChannel(name, interceptors);
if (channel == null) {
throw new IllegalStateException("Channel factory created a null channel for " + name);
}
} catch (final RuntimeException e) {
throw new IllegalStateException("Failed to create channel: " + name, e);
}
final T value = valueForMember(name, injectionTarget, injectionType, channel);
if (value == null) {
throw new IllegalStateException(
"Injection value is null unexpectedly for " + name + " at " + injectionTarget);
}
return value;
} | [
"protected",
"<",
"T",
">",
"T",
"processInjectionPoint",
"(",
"final",
"Member",
"injectionTarget",
",",
"final",
"Class",
"<",
"T",
">",
"injectionType",
",",
"final",
"GrpcClient",
"annotation",
")",
"{",
"final",
"List",
"<",
"ClientInterceptor",
">",
"int... | Processes the given injection point and computes the appropriate value for the injection.
@param <T> The type of the value to be injected.
@param injectionTarget The target of the injection.
@param injectionType The class that will be used to compute injection.
@param annotation The annotation on the target with the metadata for the injection.
@return The value to be injected for the given injection point. | [
"Processes",
"the",
"given",
"injection",
"point",
"and",
"computes",
"the",
"appropriate",
"value",
"for",
"the",
"injection",
"."
] | train | https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/inject/GrpcClientBeanPostProcessor.java#L107-L127 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.getField | public MethodHandle getField(MethodHandles.Lookup lookup, String name) throws NoSuchFieldException, IllegalAccessException {
return invoke(lookup.findGetter(type().parameterType(0), name, type().returnType()));
} | java | public MethodHandle getField(MethodHandles.Lookup lookup, String name) throws NoSuchFieldException, IllegalAccessException {
return invoke(lookup.findGetter(type().parameterType(0), name, type().returnType()));
} | [
"public",
"MethodHandle",
"getField",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"String",
"name",
")",
"throws",
"NoSuchFieldException",
",",
"IllegalAccessException",
"{",
"return",
"invoke",
"(",
"lookup",
".",
"findGetter",
"(",
"type",
"(",
")",
".... | Apply the chain of transforms and bind them to an object field retrieval specified
using the end signature plus the given class and name. The field must
match the end signature's return value and the end signature must take
the target class or a subclass as its only argument.
If the final handle's type does not exactly match the initial type for
this Binder, an additional cast will be attempted.
@param lookup the MethodHandles.Lookup to use to look up the field
@param name the field's name
@return the full handle chain, bound to the given field access
@throws java.lang.NoSuchFieldException if the field does not exist
@throws java.lang.IllegalAccessException if the field is not accessible
@throws java.lang.NoSuchFieldException if the field does not exist
@throws java.lang.IllegalAccessException if the field is not accessible | [
"Apply",
"the",
"chain",
"of",
"transforms",
"and",
"bind",
"them",
"to",
"an",
"object",
"field",
"retrieval",
"specified",
"using",
"the",
"end",
"signature",
"plus",
"the",
"given",
"class",
"and",
"name",
".",
"The",
"field",
"must",
"match",
"the",
"e... | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1387-L1389 |
OpenVidu/openvidu | openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java | KurentoSessionManager.createSession | public void createSession(Session sessionNotActive, KurentoClientSessionInfo kcSessionInfo)
throws OpenViduException {
String sessionId = kcSessionInfo.getRoomName();
KurentoSession session = (KurentoSession) sessions.get(sessionId);
if (session != null) {
throw new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE,
"Session '" + sessionId + "' already exists");
}
this.kurentoClient = kcProvider.getKurentoClient(kcSessionInfo);
session = new KurentoSession(sessionNotActive, kurentoClient, kurentoSessionEventsHandler,
kurentoEndpointConfig, kcProvider.destroyWhenUnused());
KurentoSession oldSession = (KurentoSession) sessions.putIfAbsent(sessionId, session);
if (oldSession != null) {
log.warn("Session '{}' has just been created by another thread", sessionId);
return;
}
String kcName = "[NAME NOT AVAILABLE]";
if (kurentoClient.getServerManager() != null) {
kcName = kurentoClient.getServerManager().getName();
}
log.warn("No session '{}' exists yet. Created one using KurentoClient '{}'.", sessionId, kcName);
sessionEventsHandler.onSessionCreated(session);
} | java | public void createSession(Session sessionNotActive, KurentoClientSessionInfo kcSessionInfo)
throws OpenViduException {
String sessionId = kcSessionInfo.getRoomName();
KurentoSession session = (KurentoSession) sessions.get(sessionId);
if (session != null) {
throw new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE,
"Session '" + sessionId + "' already exists");
}
this.kurentoClient = kcProvider.getKurentoClient(kcSessionInfo);
session = new KurentoSession(sessionNotActive, kurentoClient, kurentoSessionEventsHandler,
kurentoEndpointConfig, kcProvider.destroyWhenUnused());
KurentoSession oldSession = (KurentoSession) sessions.putIfAbsent(sessionId, session);
if (oldSession != null) {
log.warn("Session '{}' has just been created by another thread", sessionId);
return;
}
String kcName = "[NAME NOT AVAILABLE]";
if (kurentoClient.getServerManager() != null) {
kcName = kurentoClient.getServerManager().getName();
}
log.warn("No session '{}' exists yet. Created one using KurentoClient '{}'.", sessionId, kcName);
sessionEventsHandler.onSessionCreated(session);
} | [
"public",
"void",
"createSession",
"(",
"Session",
"sessionNotActive",
",",
"KurentoClientSessionInfo",
"kcSessionInfo",
")",
"throws",
"OpenViduException",
"{",
"String",
"sessionId",
"=",
"kcSessionInfo",
".",
"getRoomName",
"(",
")",
";",
"KurentoSession",
"session",... | Creates a session if it doesn't already exist. The session's id will be
indicated by the session info bean.
@param kcSessionInfo bean that will be passed to the
{@link KurentoClientProvider} in order to obtain the
{@link KurentoClient} that will be used by the room
@throws OpenViduException in case of error while creating the session | [
"Creates",
"a",
"session",
"if",
"it",
"doesn",
"t",
"already",
"exist",
".",
"The",
"session",
"s",
"id",
"will",
"be",
"indicated",
"by",
"the",
"session",
"info",
"bean",
"."
] | train | https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoSessionManager.java#L503-L527 |
SundeepK/CompactCalendarView | library/src/main/java/com/github/sundeepk/compactcalendarview/CompactCalendarView.java | CompactCalendarView.setLocale | public void setLocale(TimeZone timeZone, Locale locale){
compactCalendarController.setLocale(timeZone, locale);
invalidate();
} | java | public void setLocale(TimeZone timeZone, Locale locale){
compactCalendarController.setLocale(timeZone, locale);
invalidate();
} | [
"public",
"void",
"setLocale",
"(",
"TimeZone",
"timeZone",
",",
"Locale",
"locale",
")",
"{",
"compactCalendarController",
".",
"setLocale",
"(",
"timeZone",
",",
"locale",
")",
";",
"invalidate",
"(",
")",
";",
"}"
] | /*
Use a custom locale for compact calendar and reinitialise the view. | [
"/",
"*",
"Use",
"a",
"custom",
"locale",
"for",
"compact",
"calendar",
"and",
"reinitialise",
"the",
"view",
"."
] | train | https://github.com/SundeepK/CompactCalendarView/blob/e74e0eeb913744bdcaea6e9df53268441f9dbf8d/library/src/main/java/com/github/sundeepk/compactcalendarview/CompactCalendarView.java#L109-L112 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java | DoublesSketch.putMemory | public void putMemory(final WritableMemory dstMem, final boolean compact) {
if (isDirect() && (isCompact() == compact)) {
final Memory srcMem = getMemory();
srcMem.copyTo(0, dstMem, 0, getStorageBytes());
} else {
final byte[] byteArr = toByteArray(compact);
final int arrLen = byteArr.length;
final long memCap = dstMem.getCapacity();
if (memCap < arrLen) {
throw new SketchesArgumentException(
"Destination Memory not large enough: " + memCap + " < " + arrLen);
}
dstMem.putByteArray(0, byteArr, 0, arrLen);
}
} | java | public void putMemory(final WritableMemory dstMem, final boolean compact) {
if (isDirect() && (isCompact() == compact)) {
final Memory srcMem = getMemory();
srcMem.copyTo(0, dstMem, 0, getStorageBytes());
} else {
final byte[] byteArr = toByteArray(compact);
final int arrLen = byteArr.length;
final long memCap = dstMem.getCapacity();
if (memCap < arrLen) {
throw new SketchesArgumentException(
"Destination Memory not large enough: " + memCap + " < " + arrLen);
}
dstMem.putByteArray(0, byteArr, 0, arrLen);
}
} | [
"public",
"void",
"putMemory",
"(",
"final",
"WritableMemory",
"dstMem",
",",
"final",
"boolean",
"compact",
")",
"{",
"if",
"(",
"isDirect",
"(",
")",
"&&",
"(",
"isCompact",
"(",
")",
"==",
"compact",
")",
")",
"{",
"final",
"Memory",
"srcMem",
"=",
... | Puts the current sketch into the given Memory if there is sufficient space, otherwise,
throws an error.
@param dstMem the given memory.
@param compact if true, compacts and sorts the base buffer, which optimizes merge
performance at the cost of slightly increased serialization time. | [
"Puts",
"the",
"current",
"sketch",
"into",
"the",
"given",
"Memory",
"if",
"there",
"is",
"sufficient",
"space",
"otherwise",
"throws",
"an",
"error",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L693-L707 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_http_frontend_frontendId_GET | public OvhFrontendHttp serviceName_http_frontend_frontendId_GET(String serviceName, Long frontendId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/frontend/{frontendId}";
StringBuilder sb = path(qPath, serviceName, frontendId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhFrontendHttp.class);
} | java | public OvhFrontendHttp serviceName_http_frontend_frontendId_GET(String serviceName, Long frontendId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/frontend/{frontendId}";
StringBuilder sb = path(qPath, serviceName, frontendId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhFrontendHttp.class);
} | [
"public",
"OvhFrontendHttp",
"serviceName_http_frontend_frontendId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"frontendId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/http/frontend/{frontendId}\"",
";",
"StringBuilder",
"s... | Get this object properties
REST: GET /ipLoadbalancing/{serviceName}/http/frontend/{frontendId}
@param serviceName [required] The internal name of your IP load balancing
@param frontendId [required] Id of your frontend | [
"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#L323-L328 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java | XLogPDescriptor.checkRingLink | private boolean checkRingLink(IRingSet ringSet, IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
if (ringSet.contains(atom)) {
return true;
}
for (IAtom neighbour : neighbours) {
if (ringSet.contains(neighbour)) {
return true;
}
}
return false;
} | java | private boolean checkRingLink(IRingSet ringSet, IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
if (ringSet.contains(atom)) {
return true;
}
for (IAtom neighbour : neighbours) {
if (ringSet.contains(neighbour)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"checkRingLink",
"(",
"IRingSet",
"ringSet",
",",
"IAtomContainer",
"ac",
",",
"IAtom",
"atom",
")",
"{",
"List",
"<",
"IAtom",
">",
"neighbours",
"=",
"ac",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
"if",
"(",
"ringSet",
"... | Check if atom or neighbour atom is part of a ring
@param ac Description of the Parameter
@param atom Description of the Parameter
@return The hydrogenCount value | [
"Check",
"if",
"atom",
"or",
"neighbour",
"atom",
"is",
"part",
"of",
"a",
"ring"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L993-L1004 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/DriverManager.java | DriverManager.openFile | public static void openFile(Connection connection, String fileName, String tableName) throws SQLException {
String ext = fileName.substring(fileName.lastIndexOf('.') + 1,fileName.length());
final boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData());
for(DriverDef driverDef : DRIVERS) {
if(driverDef.getFileExt().equalsIgnoreCase(ext)) {
try (Statement st = connection.createStatement()) {
st.execute(String.format("CREATE TABLE %s COMMENT %s ENGINE %s WITH %s",
TableLocation.parse(tableName, isH2).toString(isH2),StringUtils.quoteStringSQL(fileName),
StringUtils.quoteJavaString(driverDef.getClassName()),StringUtils.quoteJavaString(fileName)));
}
return;
}
}
throw new SQLException("No driver is available to open the "+ext+" file format");
} | java | public static void openFile(Connection connection, String fileName, String tableName) throws SQLException {
String ext = fileName.substring(fileName.lastIndexOf('.') + 1,fileName.length());
final boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData());
for(DriverDef driverDef : DRIVERS) {
if(driverDef.getFileExt().equalsIgnoreCase(ext)) {
try (Statement st = connection.createStatement()) {
st.execute(String.format("CREATE TABLE %s COMMENT %s ENGINE %s WITH %s",
TableLocation.parse(tableName, isH2).toString(isH2),StringUtils.quoteStringSQL(fileName),
StringUtils.quoteJavaString(driverDef.getClassName()),StringUtils.quoteJavaString(fileName)));
}
return;
}
}
throw new SQLException("No driver is available to open the "+ext+" file format");
} | [
"public",
"static",
"void",
"openFile",
"(",
"Connection",
"connection",
",",
"String",
"fileName",
",",
"String",
"tableName",
")",
"throws",
"SQLException",
"{",
"String",
"ext",
"=",
"fileName",
".",
"substring",
"(",
"fileName",
".",
"lastIndexOf",
"(",
"'... | Create a new table
@param connection Active connection, do not close this connection.
@param fileName File path to write, if exists it may be replaced
@param tableName [[catalog.]schema.]table reference | [
"Create",
"a",
"new",
"table"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/DriverManager.java#L89-L103 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java | StringUtil.indexOfIgnoreCase | public static int indexOfIgnoreCase(String pString, int pChar, int pPos) {
if ((pString == null)) {
return -1;
}
// Get first char
char lower = Character.toLowerCase((char) pChar);
char upper = Character.toUpperCase((char) pChar);
int indexLower;
int indexUpper;
// Test for char
indexLower = pString.indexOf(lower, pPos);
indexUpper = pString.indexOf(upper, pPos);
if (indexLower < 0) {
/* if (indexUpper < 0)
return -1; // First char not found
else */
return indexUpper;// Only upper
}
else if (indexUpper < 0) {
return indexLower;// Only lower
}
else {
// Both found, select first occurence
return (indexLower < indexUpper)
? indexLower
: indexUpper;
}
} | java | public static int indexOfIgnoreCase(String pString, int pChar, int pPos) {
if ((pString == null)) {
return -1;
}
// Get first char
char lower = Character.toLowerCase((char) pChar);
char upper = Character.toUpperCase((char) pChar);
int indexLower;
int indexUpper;
// Test for char
indexLower = pString.indexOf(lower, pPos);
indexUpper = pString.indexOf(upper, pPos);
if (indexLower < 0) {
/* if (indexUpper < 0)
return -1; // First char not found
else */
return indexUpper;// Only upper
}
else if (indexUpper < 0) {
return indexLower;// Only lower
}
else {
// Both found, select first occurence
return (indexLower < indexUpper)
? indexLower
: indexUpper;
}
} | [
"public",
"static",
"int",
"indexOfIgnoreCase",
"(",
"String",
"pString",
",",
"int",
"pChar",
",",
"int",
"pPos",
")",
"{",
"if",
"(",
"(",
"pString",
"==",
"null",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"// Get first char\r",
"char",
"lower",
"... | Returns the index within this string of the first occurrence of the
specified character, starting at the specified index.
@param pString The string to test
@param pChar The character to look for
@param pPos The first index to test
@return if the string argument occurs as a substring within this object,
then the index of the first character of the first such substring is
returned; if it does not occur as a substring, -1 is returned.
@see String#indexOf(int,int) | [
"Returns",
"the",
"index",
"within",
"this",
"string",
"of",
"the",
"first",
"occurrence",
"of",
"the",
"specified",
"character",
"starting",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java#L465-L496 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesInner.java | RestorableDroppedDatabasesInner.listByServerAsync | public Observable<List<RestorableDroppedDatabaseInner>> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<RestorableDroppedDatabaseInner>>, List<RestorableDroppedDatabaseInner>>() {
@Override
public List<RestorableDroppedDatabaseInner> call(ServiceResponse<List<RestorableDroppedDatabaseInner>> response) {
return response.body();
}
});
} | java | public Observable<List<RestorableDroppedDatabaseInner>> listByServerAsync(String resourceGroupName, String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<RestorableDroppedDatabaseInner>>, List<RestorableDroppedDatabaseInner>>() {
@Override
public List<RestorableDroppedDatabaseInner> call(ServiceResponse<List<RestorableDroppedDatabaseInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"RestorableDroppedDatabaseInner",
">",
">",
"listByServerAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverNa... | Gets a list of deleted databases that can be restored.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<RestorableDroppedDatabaseInner> object | [
"Gets",
"a",
"list",
"of",
"deleted",
"databases",
"that",
"can",
"be",
"restored",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RestorableDroppedDatabasesInner.java#L193-L200 |
openbase/jul | exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java | ExceptionPrinter.printHistory | public static <T extends Throwable> void printHistory(final T th, final Logger logger, final LogLevel level) {
printHistory(th, new LogPrinter(logger, level));
} | java | public static <T extends Throwable> void printHistory(final T th, final Logger logger, final LogLevel level) {
printHistory(th, new LogPrinter(logger, level));
} | [
"public",
"static",
"<",
"T",
"extends",
"Throwable",
">",
"void",
"printHistory",
"(",
"final",
"T",
"th",
",",
"final",
"Logger",
"logger",
",",
"final",
"LogLevel",
"level",
")",
"{",
"printHistory",
"(",
"th",
",",
"new",
"LogPrinter",
"(",
"logger",
... | Print Exception messages without stack trace in non debug mode. Method prints recursive all messages of the given exception stack to get a history overview of the causes. In verbose mode (app
-v) the stacktrace is printed in the end of history.
@param <T> Exception type
@param logger the logger used as message printer.
@param th exception stack to print.
@param level the logging level used for the print. | [
"Print",
"Exception",
"messages",
"without",
"stack",
"trace",
"in",
"non",
"debug",
"mode",
".",
"Method",
"prints",
"recursive",
"all",
"messages",
"of",
"the",
"given",
"exception",
"stack",
"to",
"get",
"a",
"history",
"overview",
"of",
"the",
"causes",
... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java#L120-L122 |
menacher/java-game-server | jetclient/src/main/java/org/menacheri/jetclient/util/NettyUtils.java | NettyUtils.readObject | public static Object readObject(ChannelBuffer buffer, int length)
{
ChannelBuffer objBuffer = buffer.readSlice(length);
Object obj;
try
{
obj = OBJECT_DECODER.decode(objBuffer);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
return obj;
} | java | public static Object readObject(ChannelBuffer buffer, int length)
{
ChannelBuffer objBuffer = buffer.readSlice(length);
Object obj;
try
{
obj = OBJECT_DECODER.decode(objBuffer);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
return obj;
} | [
"public",
"static",
"Object",
"readObject",
"(",
"ChannelBuffer",
"buffer",
",",
"int",
"length",
")",
"{",
"ChannelBuffer",
"objBuffer",
"=",
"buffer",
".",
"readSlice",
"(",
"length",
")",
";",
"Object",
"obj",
";",
"try",
"{",
"obj",
"=",
"OBJECT_DECODER"... | Read an object from a channel buffer with the specified length. It sets
the reader index of the buffer to current reader index + 2(length bytes)
+ actual length.
@param buffer
The Netty buffer containing the Object.
@param length
The number of bytes in the Object.
@return Returns the read object. | [
"Read",
"an",
"object",
"from",
"a",
"channel",
"buffer",
"with",
"the",
"specified",
"length",
".",
"It",
"sets",
"the",
"reader",
"index",
"of",
"the",
"buffer",
"to",
"current",
"reader",
"index",
"+",
"2",
"(",
"length",
"bytes",
")",
"+",
"actual",
... | train | https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetclient/src/main/java/org/menacheri/jetclient/util/NettyUtils.java#L353-L366 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java | EscapedFunctions2.sqlsecond | public static void sqlsecond(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
singleArgumentFunctionCall(buf, "extract(second from ", "second", parsedArgs);
} | java | public static void sqlsecond(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
singleArgumentFunctionCall(buf, "extract(second from ", "second", parsedArgs);
} | [
"public",
"static",
"void",
"sqlsecond",
"(",
"StringBuilder",
"buf",
",",
"List",
"<",
"?",
"extends",
"CharSequence",
">",
"parsedArgs",
")",
"throws",
"SQLException",
"{",
"singleArgumentFunctionCall",
"(",
"buf",
",",
"\"extract(second from \"",
",",
"\"second\"... | second translation
@param buf The buffer to append into
@param parsedArgs arguments
@throws SQLException if something wrong happens | [
"second",
"translation"
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L464-L466 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java | RemotePDPProvider.getDomain | @Override
public Structure getDomain(String pdpDomainName, AtomCache cache) throws IOException, StructureException {
return cache.getStructure(getPDPDomain(pdpDomainName));
} | java | @Override
public Structure getDomain(String pdpDomainName, AtomCache cache) throws IOException, StructureException {
return cache.getStructure(getPDPDomain(pdpDomainName));
} | [
"@",
"Override",
"public",
"Structure",
"getDomain",
"(",
"String",
"pdpDomainName",
",",
"AtomCache",
"cache",
")",
"throws",
"IOException",
",",
"StructureException",
"{",
"return",
"cache",
".",
"getStructure",
"(",
"getPDPDomain",
"(",
"pdpDomainName",
")",
")... | Get the structure for a particular PDP domain
@param pdpDomainName PDP identifier, e.g. "PDP:4HHBAa"
@param cache AtomCache, responsible for fetching and storing the coordinates
@return Structure representing the PDP domain
@throws IOException if the server cannot be reached
@throws StructureException For errors parsing the structure | [
"Get",
"the",
"structure",
"for",
"a",
"particular",
"PDP",
"domain"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java#L162-L165 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.codePointBefore | public static final int codePointBefore(CharSequence seq, int index) {
char c2 = seq.charAt(--index);
if (isLowSurrogate(c2)) {
if (index > 0) {
char c1 = seq.charAt(--index);
if (isHighSurrogate(c1)) {
return toCodePoint(c1, c2);
}
}
}
return c2;
} | java | public static final int codePointBefore(CharSequence seq, int index) {
char c2 = seq.charAt(--index);
if (isLowSurrogate(c2)) {
if (index > 0) {
char c1 = seq.charAt(--index);
if (isHighSurrogate(c1)) {
return toCodePoint(c1, c2);
}
}
}
return c2;
} | [
"public",
"static",
"final",
"int",
"codePointBefore",
"(",
"CharSequence",
"seq",
",",
"int",
"index",
")",
"{",
"char",
"c2",
"=",
"seq",
".",
"charAt",
"(",
"--",
"index",
")",
";",
"if",
"(",
"isLowSurrogate",
"(",
"c2",
")",
")",
"{",
"if",
"(",... | Same as {@link Character#codePointBefore(CharSequence, int)}.
Return the code point before index.
This examines only the characters at index-1 and index-2.
@param seq the characters to check
@param index the index after the last or only char forming the code point
@return the code point before the index | [
"Same",
"as",
"{",
"@link",
"Character#codePointBefore",
"(",
"CharSequence",
"int",
")",
"}",
".",
"Return",
"the",
"code",
"point",
"before",
"index",
".",
"This",
"examines",
"only",
"the",
"characters",
"at",
"index",
"-",
"1",
"and",
"index",
"-",
"2"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L5392-L5403 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.groupByField | public static <T> List<List<T>> groupByField(Collection<T> collection, final String fieldName) {
return group(collection, new Hash<T>() {
private List<Object> fieldNameList = new ArrayList<>();
@Override
public int hash(T t) {
if (null == t || false == BeanUtil.isBean(t.getClass())) {
// 非Bean放在同一子分组中
return 0;
}
final Object value = ReflectUtil.getFieldValue(t, fieldName);
int hash = fieldNameList.indexOf(value);
if (hash < 0) {
fieldNameList.add(value);
return fieldNameList.size() - 1;
} else {
return hash;
}
}
});
} | java | public static <T> List<List<T>> groupByField(Collection<T> collection, final String fieldName) {
return group(collection, new Hash<T>() {
private List<Object> fieldNameList = new ArrayList<>();
@Override
public int hash(T t) {
if (null == t || false == BeanUtil.isBean(t.getClass())) {
// 非Bean放在同一子分组中
return 0;
}
final Object value = ReflectUtil.getFieldValue(t, fieldName);
int hash = fieldNameList.indexOf(value);
if (hash < 0) {
fieldNameList.add(value);
return fieldNameList.size() - 1;
} else {
return hash;
}
}
});
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"List",
"<",
"T",
">",
">",
"groupByField",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"final",
"String",
"fieldName",
")",
"{",
"return",
"group",
"(",
"collection",
",",
"new",
"Hash",
"<",
... | 根据元素的指定字段名分组,非Bean都放在第一个分组中
@param <T> 元素类型
@param collection 集合
@param fieldName 元素Bean中的字段名,非Bean都放在第一个分组中
@return 分组列表 | [
"根据元素的指定字段名分组,非Bean都放在第一个分组中"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2330-L2350 |
FitLayout/classify | src/main/java/org/fit/layout/classify/VisualClassifier.java | VisualClassifier.classifyTree | public void classifyTree(Area root, FeatureExtractor features)
{
if (classifier != null)
{
System.out.print("tree visual classification...");
testRoot = root;
this.features = features;
//create a new empty set with the same header as the training set
testset = new Instances(trainset, 0);
//create an empty mapping
mapping = new HashMap<Area, Instance>();
//fill the set with the data
recursivelyExtractAreaData(testRoot);
System.out.println("done");
}
} | java | public void classifyTree(Area root, FeatureExtractor features)
{
if (classifier != null)
{
System.out.print("tree visual classification...");
testRoot = root;
this.features = features;
//create a new empty set with the same header as the training set
testset = new Instances(trainset, 0);
//create an empty mapping
mapping = new HashMap<Area, Instance>();
//fill the set with the data
recursivelyExtractAreaData(testRoot);
System.out.println("done");
}
} | [
"public",
"void",
"classifyTree",
"(",
"Area",
"root",
",",
"FeatureExtractor",
"features",
")",
"{",
"if",
"(",
"classifier",
"!=",
"null",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"tree visual classification...\"",
")",
";",
"testRoot",
"=",
"r... | Classifies the areas in an area tree.
@param root the root node of the area tree | [
"Classifies",
"the",
"areas",
"in",
"an",
"area",
"tree",
"."
] | train | https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/VisualClassifier.java#L56-L71 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newApplicationException | public static ApplicationException newApplicationException(Throwable cause, String message, Object... args) {
return new ApplicationException(format(message, args), cause);
} | java | public static ApplicationException newApplicationException(Throwable cause, String message, Object... args) {
return new ApplicationException(format(message, args), cause);
} | [
"public",
"static",
"ApplicationException",
"newApplicationException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"ApplicationException",
"(",
"format",
"(",
"message",
",",
"args",
")",
",",
"ca... | Constructs and initializes a new {@link ApplicationException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link ApplicationException} was thrown.
@param message {@link String} describing the {@link ApplicationException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link ApplicationException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.util.ApplicationException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"ApplicationException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Obj... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L775-L777 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/ByteArrayUtil.java | ByteArrayUtil.putShortBE | public static void putShortBE(final byte[] array, final int offset, final short value) {
array[offset + 1] = (byte) (value );
array[offset ] = (byte) (value >>> 8);
} | java | public static void putShortBE(final byte[] array, final int offset, final short value) {
array[offset + 1] = (byte) (value );
array[offset ] = (byte) (value >>> 8);
} | [
"public",
"static",
"void",
"putShortBE",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"int",
"offset",
",",
"final",
"short",
"value",
")",
"{",
"array",
"[",
"offset",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
")",
";",
"array... | Put the source <i>short</i> into the destination byte array starting at the given offset
in big endian order.
There is no bounds checking.
@param array destination byte array
@param offset destination offset
@param value source <i>short</i> | [
"Put",
"the",
"source",
"<i",
">",
"short<",
"/",
"i",
">",
"into",
"the",
"destination",
"byte",
"array",
"starting",
"at",
"the",
"given",
"offset",
"in",
"big",
"endian",
"order",
".",
"There",
"is",
"no",
"bounds",
"checking",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/ByteArrayUtil.java#L52-L55 |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/similarityfunction/kernel/KernelMatrix.java | KernelMatrix.getSimilarity | public double getSimilarity(DBIDRef id1, DBIDRef id2) {
return kernel[idmap.getOffset(id1)][idmap.getOffset(id2)];
} | java | public double getSimilarity(DBIDRef id1, DBIDRef id2) {
return kernel[idmap.getOffset(id1)][idmap.getOffset(id2)];
} | [
"public",
"double",
"getSimilarity",
"(",
"DBIDRef",
"id1",
",",
"DBIDRef",
"id2",
")",
"{",
"return",
"kernel",
"[",
"idmap",
".",
"getOffset",
"(",
"id1",
")",
"]",
"[",
"idmap",
".",
"getOffset",
"(",
"id2",
")",
"]",
";",
"}"
] | Get the kernel similarity for the given objects.
@param id1 First object
@param id2 Second object
@return Similarity. | [
"Get",
"the",
"kernel",
"similarity",
"for",
"the",
"given",
"objects",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/similarityfunction/kernel/KernelMatrix.java#L272-L274 |
jmeetsma/Iglu-Common | src/main/java/org/ijsberg/iglu/caching/module/StandardCache.java | StandardCache.createCache | public static <K, V> Cache<K, V> createCache(String cacheName, int ttl, long cleanupInterval/*, Application application, Layer layer*/) {
StandardCache cache = new StandardCache(ttl, cleanupInterval);
cache.setProperties(new Properties());
cache.start();
return cache;
} | java | public static <K, V> Cache<K, V> createCache(String cacheName, int ttl, long cleanupInterval/*, Application application, Layer layer*/) {
StandardCache cache = new StandardCache(ttl, cleanupInterval);
cache.setProperties(new Properties());
cache.start();
return cache;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Cache",
"<",
"K",
",",
"V",
">",
"createCache",
"(",
"String",
"cacheName",
",",
"int",
"ttl",
",",
"long",
"cleanupInterval",
"/*, Application application, Layer layer*/",
")",
"{",
"StandardCache",
"cache",
"=",
... | Retrieves a cache from the current layer or creates it.
Only a root request will be able to embed the constructed cache in the
application.
@param cacheName cache service ID
@param ttl time to live in seconds
@param cleanupInterval cleanup interval in seconds
@return | [
"Retrieves",
"a",
"cache",
"from",
"the",
"current",
"layer",
"or",
"creates",
"it",
".",
"Only",
"a",
"root",
"request",
"will",
"be",
"able",
"to",
"embed",
"the",
"constructed",
"cache",
"in",
"the",
"application",
"."
] | train | https://github.com/jmeetsma/Iglu-Common/blob/0fb0885775b576209ff1b5a0f67e3c25a99a6420/src/main/java/org/ijsberg/iglu/caching/module/StandardCache.java#L418-L423 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java | CommonsOJBLockManager.createIsolationLevel | public OJBLock createIsolationLevel(Object resourceId, Object isolationId, LoggerFacade logger)
{
OJBLock result = null;
switch(((Integer) isolationId).intValue())
{
case LockManager.IL_READ_UNCOMMITTED:
result = new ReadUncommittedLock(resourceId, logger);
break;
case LockManager.IL_READ_COMMITTED:
result = new ReadCommitedLock(resourceId, logger);
break;
case LockManager.IL_REPEATABLE_READ:
result = new RepeadableReadsLock(resourceId, logger);
break;
case LockManager.IL_SERIALIZABLE:
result = new SerializeableLock(resourceId, logger);
break;
case LockManager.IL_OPTIMISTIC:
throw new LockRuntimeException("Optimistic locking must be handled on top of this class");
default:
throw new LockRuntimeException("Unknown lock isolation level specified");
}
return result;
} | java | public OJBLock createIsolationLevel(Object resourceId, Object isolationId, LoggerFacade logger)
{
OJBLock result = null;
switch(((Integer) isolationId).intValue())
{
case LockManager.IL_READ_UNCOMMITTED:
result = new ReadUncommittedLock(resourceId, logger);
break;
case LockManager.IL_READ_COMMITTED:
result = new ReadCommitedLock(resourceId, logger);
break;
case LockManager.IL_REPEATABLE_READ:
result = new RepeadableReadsLock(resourceId, logger);
break;
case LockManager.IL_SERIALIZABLE:
result = new SerializeableLock(resourceId, logger);
break;
case LockManager.IL_OPTIMISTIC:
throw new LockRuntimeException("Optimistic locking must be handled on top of this class");
default:
throw new LockRuntimeException("Unknown lock isolation level specified");
}
return result;
} | [
"public",
"OJBLock",
"createIsolationLevel",
"(",
"Object",
"resourceId",
",",
"Object",
"isolationId",
",",
"LoggerFacade",
"logger",
")",
"{",
"OJBLock",
"result",
"=",
"null",
";",
"switch",
"(",
"(",
"(",
"Integer",
")",
"isolationId",
")",
".",
"intValue"... | Creates {@link org.apache.commons.transaction.locking.GenericLock} based
{@link org.apache.commons.transaction.locking.MultiLevelLock2} instances
dependend on the specified isolation identity object. | [
"Creates",
"{"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/locking/CommonsOJBLockManager.java#L193-L216 |
mockito/mockito | src/main/java/org/mockito/ArgumentMatchers.java | ArgumentMatchers.refEq | public static <T> T refEq(T value, String... excludeFields) {
reportMatcher(new ReflectionEquals(value, excludeFields));
return null;
} | java | public static <T> T refEq(T value, String... excludeFields) {
reportMatcher(new ReflectionEquals(value, excludeFields));
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"refEq",
"(",
"T",
"value",
",",
"String",
"...",
"excludeFields",
")",
"{",
"reportMatcher",
"(",
"new",
"ReflectionEquals",
"(",
"value",
",",
"excludeFields",
")",
")",
";",
"return",
"null",
";",
"}"
] | Object argument that is reflection-equal to the given value with support for excluding
selected fields from a class.
<p>
This matcher can be used when equals() is not implemented on compared objects.
Matcher uses java reflection API to compare fields of wanted and actual object.
</p>
<p>
Works similarly to <code>EqualsBuilder.reflectionEquals(this, other, excludeFields)</code> from
apache commons library.
<p>
<b>Warning</b> The equality check is shallow!
</p>
<p>
See examples in javadoc for {@link ArgumentMatchers} class
</p>
@param value the given value.
@param excludeFields fields to exclude, if field does not exist it is ignored.
@return <code>null</code>. | [
"Object",
"argument",
"that",
"is",
"reflection",
"-",
"equal",
"to",
"the",
"given",
"value",
"with",
"support",
"for",
"excluding",
"selected",
"fields",
"from",
"a",
"class",
"."
] | train | https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/ArgumentMatchers.java#L937-L940 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelopeSolver.java | TrajectoryEnvelopeSolver.createEnvelopes | public HashMap<Integer,ArrayList<TrajectoryEnvelope>> createEnvelopes(int firstRobotID, Trajectory ... trajectories) {
//Default footprint, 2.7 (w) x 6.6 (l)
Coordinate frontLeft = new Coordinate(5.3, 1.35);
Coordinate frontRight = new Coordinate(5.3, -1.35);
Coordinate backRight = new Coordinate(-1.3, -1.35);
Coordinate backLeft = new Coordinate(-1.3, 1.35);
Coordinate[] footprint = new Coordinate[] {frontLeft,frontRight,backLeft,backRight};
long durationFirstParking = 3000;
long durationLastParking = 3000;
return createEnvelopes(firstRobotID, durationFirstParking, durationLastParking, footprint, trajectories);
} | java | public HashMap<Integer,ArrayList<TrajectoryEnvelope>> createEnvelopes(int firstRobotID, Trajectory ... trajectories) {
//Default footprint, 2.7 (w) x 6.6 (l)
Coordinate frontLeft = new Coordinate(5.3, 1.35);
Coordinate frontRight = new Coordinate(5.3, -1.35);
Coordinate backRight = new Coordinate(-1.3, -1.35);
Coordinate backLeft = new Coordinate(-1.3, 1.35);
Coordinate[] footprint = new Coordinate[] {frontLeft,frontRight,backLeft,backRight};
long durationFirstParking = 3000;
long durationLastParking = 3000;
return createEnvelopes(firstRobotID, durationFirstParking, durationLastParking, footprint, trajectories);
} | [
"public",
"HashMap",
"<",
"Integer",
",",
"ArrayList",
"<",
"TrajectoryEnvelope",
">",
">",
"createEnvelopes",
"(",
"int",
"firstRobotID",
",",
"Trajectory",
"...",
"trajectories",
")",
"{",
"//Default footprint, 2.7 (w) x 6.6 (l)",
"Coordinate",
"frontLeft",
"=",
"ne... | Create a trajectory envelope for each given {@link Trajectory}. Robot IDs are assigned starting from the given
integer. This method creates three envelopes for each {@link Trajectory}:
the main {@link TrajectoryEnvelope} covering the path; one {@link TrajectoryEnvelope} for the starting position
of the robot; and one one {@link TrajectoryEnvelope} for the final parking position of the robot. The three envelopes
are constrained with {@link AllenIntervalConstraint.Type#Meets} constraints. The two parking envelopes have a duration of 3000 ms each.
A default footprint of size 2.7 (w) x 6.6 (l) is used.
@param firstRobotID The starting robot ID.
@param trajectories The {@link Trajectory}s over which to create the {@link TrajectoryEnvelope}s.
@return A mapping between robot IDs and the newly created sets of {@link TrajectoryEnvelope}s. | [
"Create",
"a",
"trajectory",
"envelope",
"for",
"each",
"given",
"{"
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelopeSolver.java#L362-L372 |
qiniu/java-sdk | src/main/java/com/qiniu/cdn/CdnManager.java | CdnManager.getCdnLogList | public CdnResult.LogListResult getCdnLogList(String[] domains, String logDate) throws QiniuException {
HashMap<String, String> req = new HashMap<>();
req.put("domains", StringUtils.join(domains, ";"));
req.put("day", logDate);
byte[] body = Json.encode(req).getBytes(Constants.UTF_8);
String url = server + "/v2/tune/log/list";
StringMap headers = auth.authorizationV2(url, "POST", body, Client.JsonMime);
Response response = client.post(url, body, headers, Client.JsonMime);
return response.jsonToObject(CdnResult.LogListResult.class);
} | java | public CdnResult.LogListResult getCdnLogList(String[] domains, String logDate) throws QiniuException {
HashMap<String, String> req = new HashMap<>();
req.put("domains", StringUtils.join(domains, ";"));
req.put("day", logDate);
byte[] body = Json.encode(req).getBytes(Constants.UTF_8);
String url = server + "/v2/tune/log/list";
StringMap headers = auth.authorizationV2(url, "POST", body, Client.JsonMime);
Response response = client.post(url, body, headers, Client.JsonMime);
return response.jsonToObject(CdnResult.LogListResult.class);
} | [
"public",
"CdnResult",
".",
"LogListResult",
"getCdnLogList",
"(",
"String",
"[",
"]",
"domains",
",",
"String",
"logDate",
")",
"throws",
"QiniuException",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"req",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";... | 获取CDN域名访问日志的下载链接,具体下载操作请自行根据链接下载
参考文档:<a href="http://developer.qiniu.com/fusion/api/download-the-log">日志下载</a>
@param domains 待获取日志下载信息的域名列表
@param logDate 待获取日志的具体日期,格式为:2017-02-18
@return 获取日志下载链接的回复 | [
"获取CDN域名访问日志的下载链接,具体下载操作请自行根据链接下载",
"参考文档:<a",
"href",
"=",
"http",
":",
"//",
"developer",
".",
"qiniu",
".",
"com",
"/",
"fusion",
"/",
"api",
"/",
"download",
"-",
"the",
"-",
"log",
">",
"日志下载<",
"/",
"a",
">"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/cdn/CdnManager.java#L195-L205 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java | BigtableClusterUtilities.getClusterSize | @Deprecated
public int getClusterSize(String clusterId, String zoneId) {
Cluster cluster = getCluster(clusterId, zoneId);
String message = String.format("Cluster %s/%s was not found.", clusterId, zoneId);
Preconditions.checkNotNull(cluster, message);
return cluster.getServeNodes();
} | java | @Deprecated
public int getClusterSize(String clusterId, String zoneId) {
Cluster cluster = getCluster(clusterId, zoneId);
String message = String.format("Cluster %s/%s was not found.", clusterId, zoneId);
Preconditions.checkNotNull(cluster, message);
return cluster.getServeNodes();
} | [
"@",
"Deprecated",
"public",
"int",
"getClusterSize",
"(",
"String",
"clusterId",
",",
"String",
"zoneId",
")",
"{",
"Cluster",
"cluster",
"=",
"getCluster",
"(",
"clusterId",
",",
"zoneId",
")",
";",
"String",
"message",
"=",
"String",
".",
"format",
"(",
... | Gets the serve node count of the cluster.
@param clusterId
@param zoneId
@return the {@link Cluster#getServeNodes()} of the clusterId.
@deprecated Use {@link #getCluster(String, String)} or {@link #getSingleCluster()} and then
call {@link Cluster#getServeNodes()}. | [
"Gets",
"the",
"serve",
"node",
"count",
"of",
"the",
"cluster",
"."
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableClusterUtilities.java#L167-L173 |
jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/local/LocalMessageTransport.java | LocalMessageTransport.sendMessageRequest | public BaseMessage sendMessageRequest(BaseMessage messageOut)
{
TrxMessageHeader trxMessageHeader = (TrxMessageHeader)messageOut.getMessageHeader();
String strTrxID = (String)trxMessageHeader.get(TrxMessageHeader.LOG_TRX_ID);
try {
// Create a fake Incoming message with this message's external data
String strMessageCode = (String)trxMessageHeader.get(LocalMessageTransport.LOCAL_PROCESSOR);
TrxMessageHeader trxMessageHeaderIn = new TrxMessageHeader(null, null);
trxMessageHeaderIn.put(TrxMessageHeader.MESSAGE_CODE, strMessageCode);
BaseMessage messageIn = new TreeMessage(trxMessageHeaderIn, null);
new ExternalMapTrxMessageIn(messageIn, messageOut.getExternalMessage().getRawData());
// And fake send it by calling this:
BaseMessage messageReply = this.processIncomingMessage(messageIn, null);
this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.SENT, null, null);
this.setupReplyMessage(messageReply, null, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_OUT);
int iErrorCode = this.convertToExternal(messageReply, null);
if (iErrorCode != DBConstants.NORMAL_RETURN)
{
String strMessageDescription = this.getTask().getLastError(iErrorCode);
if ((strMessageDescription == null) || (strMessageDescription.length() == 0))
strMessageDescription = "Error converting to external format";
messageReply = BaseMessageProcessor.processErrorMessage(this, messageOut, strMessageDescription);
}
return messageReply;
} catch (Throwable ex) {
ex.printStackTrace();
String strError = "Error in processing or replying to a message";
Utility.getLogger().warning(strError);
this.logMessage(strTrxID, null, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.ERROR, strError, null);
return BaseMessageProcessor.processErrorMessage(this, messageOut, strError);
}
} | java | public BaseMessage sendMessageRequest(BaseMessage messageOut)
{
TrxMessageHeader trxMessageHeader = (TrxMessageHeader)messageOut.getMessageHeader();
String strTrxID = (String)trxMessageHeader.get(TrxMessageHeader.LOG_TRX_ID);
try {
// Create a fake Incoming message with this message's external data
String strMessageCode = (String)trxMessageHeader.get(LocalMessageTransport.LOCAL_PROCESSOR);
TrxMessageHeader trxMessageHeaderIn = new TrxMessageHeader(null, null);
trxMessageHeaderIn.put(TrxMessageHeader.MESSAGE_CODE, strMessageCode);
BaseMessage messageIn = new TreeMessage(trxMessageHeaderIn, null);
new ExternalMapTrxMessageIn(messageIn, messageOut.getExternalMessage().getRawData());
// And fake send it by calling this:
BaseMessage messageReply = this.processIncomingMessage(messageIn, null);
this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.SENT, null, null);
this.setupReplyMessage(messageReply, null, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_OUT);
int iErrorCode = this.convertToExternal(messageReply, null);
if (iErrorCode != DBConstants.NORMAL_RETURN)
{
String strMessageDescription = this.getTask().getLastError(iErrorCode);
if ((strMessageDescription == null) || (strMessageDescription.length() == 0))
strMessageDescription = "Error converting to external format";
messageReply = BaseMessageProcessor.processErrorMessage(this, messageOut, strMessageDescription);
}
return messageReply;
} catch (Throwable ex) {
ex.printStackTrace();
String strError = "Error in processing or replying to a message";
Utility.getLogger().warning(strError);
this.logMessage(strTrxID, null, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.ERROR, strError, null);
return BaseMessageProcessor.processErrorMessage(this, messageOut, strError);
}
} | [
"public",
"BaseMessage",
"sendMessageRequest",
"(",
"BaseMessage",
"messageOut",
")",
"{",
"TrxMessageHeader",
"trxMessageHeader",
"=",
"(",
"TrxMessageHeader",
")",
"messageOut",
".",
"getMessageHeader",
"(",
")",
";",
"String",
"strTrxID",
"=",
"(",
"String",
")",... | Send the message and (optionally) get the reply.
@param messageOut The message to send to be processed.
@return The reply message (or null if none). | [
"Send",
"the",
"message",
"and",
"(",
"optionally",
")",
"get",
"the",
"reply",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/local/LocalMessageTransport.java#L95-L129 |
networknt/light-4j | client/src/main/java/com/networknt/client/ssl/APINameChecker.java | APINameChecker.verifyAndThrow | public static void verifyAndThrow(final Set<String> nameSet, final X509Certificate cert) throws CertificateException{
if (!verify(nameSet, cert)) {
throw new CertificateException("No name matching " + nameSet + " found");
}
} | java | public static void verifyAndThrow(final Set<String> nameSet, final X509Certificate cert) throws CertificateException{
if (!verify(nameSet, cert)) {
throw new CertificateException("No name matching " + nameSet + " found");
}
} | [
"public",
"static",
"void",
"verifyAndThrow",
"(",
"final",
"Set",
"<",
"String",
">",
"nameSet",
",",
"final",
"X509Certificate",
"cert",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"!",
"verify",
"(",
"nameSet",
",",
"cert",
")",
")",
"{",
"th... | Perform server identify check using given names and throw CertificateException if the check fails.
@param nameSet - a set of names from the config file
@param cert - the server certificate
@throws CertificateException - throws CertificateException if none of the name in the nameSet matches the names in the cert | [
"Perform",
"server",
"identify",
"check",
"using",
"given",
"names",
"and",
"throw",
"CertificateException",
"if",
"the",
"check",
"fails",
"."
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/ssl/APINameChecker.java#L41-L45 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/MCWrapper.java | MCWrapper.enlistRRSXAResource | final XAResource enlistRRSXAResource(int recoveryId, int branchCoupling) throws Exception {
RRSXAResourceFactory xaFactory = (RRSXAResourceFactory) pm.connectorSvc.rrsXAResFactorySvcRef.getService();
// Make sure that the bundle is active.
if (xaFactory == null) {
throw new IllegalStateException("Native service for RRS transactional support is not active or available. Resource enlistment is rejected.");
}
XAResource xaResource = null;
UOWCurrent currentUOW = (UOWCurrent) pm.connectorSvc.transactionManager;
UOWCoordinator uowCoord = currentUOW.getUOWCoord();
// Enlist XA resource.
if (uowCoord.isGlobal()) {
// Enlist a 2 phase XA resource in the global transaction.
xaResource = xaFactory.getTwoPhaseXAResource(uowCoord.getXid());
pm.connectorSvc.transactionManager.enlist(uowCoord, xaResource, recoveryId, branchCoupling);
} else {
// Enlist a one phase XA resource in the local transaction. If enlisting for
// cleanup, notify the factory that the resource has been enlisted for cleanup
// with the transaction manager.
xaResource = xaFactory.getOnePhaseXAResource(uowCoord);
LocalTransactionCoordinator ltCoord = (LocalTransactionCoordinator) uowCoord;
if (ltCoord.isContainerResolved()) {
ltCoord.enlist((OnePhaseXAResource) xaResource);
} else {
ltCoord.enlistForCleanup((OnePhaseXAResource) xaResource);
}
// Enlist with the native transaction manager (factory).
xaFactory.enlist(uowCoord, xaResource);
}
return xaResource;
} | java | final XAResource enlistRRSXAResource(int recoveryId, int branchCoupling) throws Exception {
RRSXAResourceFactory xaFactory = (RRSXAResourceFactory) pm.connectorSvc.rrsXAResFactorySvcRef.getService();
// Make sure that the bundle is active.
if (xaFactory == null) {
throw new IllegalStateException("Native service for RRS transactional support is not active or available. Resource enlistment is rejected.");
}
XAResource xaResource = null;
UOWCurrent currentUOW = (UOWCurrent) pm.connectorSvc.transactionManager;
UOWCoordinator uowCoord = currentUOW.getUOWCoord();
// Enlist XA resource.
if (uowCoord.isGlobal()) {
// Enlist a 2 phase XA resource in the global transaction.
xaResource = xaFactory.getTwoPhaseXAResource(uowCoord.getXid());
pm.connectorSvc.transactionManager.enlist(uowCoord, xaResource, recoveryId, branchCoupling);
} else {
// Enlist a one phase XA resource in the local transaction. If enlisting for
// cleanup, notify the factory that the resource has been enlisted for cleanup
// with the transaction manager.
xaResource = xaFactory.getOnePhaseXAResource(uowCoord);
LocalTransactionCoordinator ltCoord = (LocalTransactionCoordinator) uowCoord;
if (ltCoord.isContainerResolved()) {
ltCoord.enlist((OnePhaseXAResource) xaResource);
} else {
ltCoord.enlistForCleanup((OnePhaseXAResource) xaResource);
}
// Enlist with the native transaction manager (factory).
xaFactory.enlist(uowCoord, xaResource);
}
return xaResource;
} | [
"final",
"XAResource",
"enlistRRSXAResource",
"(",
"int",
"recoveryId",
",",
"int",
"branchCoupling",
")",
"throws",
"Exception",
"{",
"RRSXAResourceFactory",
"xaFactory",
"=",
"(",
"RRSXAResourceFactory",
")",
"pm",
".",
"connectorSvc",
".",
"rrsXAResFactorySvcRef",
... | Enlists a RRS XA resource with the transaction manager.
@param recoveryId The recovery id representing the registration of the resource with
the transaction manager.
@param branchCoupling The resource's branch coupling support indicator.
@return The XA resource enlisted with the transaction manager.
@throws Exception if an error occurred during the enlistment process. | [
"Enlists",
"a",
"RRS",
"XA",
"resource",
"with",
"the",
"transaction",
"manager",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/MCWrapper.java#L474-L508 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.createEntityRoleWithServiceResponseAsync | public Observable<ServiceResponse<UUID>> createEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, CreateEntityRoleOptionalParameter createEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
final String name = createEntityRoleOptionalParameter != null ? createEntityRoleOptionalParameter.name() : null;
return createEntityRoleWithServiceResponseAsync(appId, versionId, entityId, name);
} | java | public Observable<ServiceResponse<UUID>> createEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, CreateEntityRoleOptionalParameter createEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
final String name = createEntityRoleOptionalParameter != null ? createEntityRoleOptionalParameter.name() : null;
return createEntityRoleWithServiceResponseAsync(appId, versionId, entityId, name);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"UUID",
">",
">",
"createEntityRoleWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"CreateEntityRoleOptionalParameter",
"createEntityRoleOptionalParameter",
")",
... | Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity model ID.
@param createEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object | [
"Create",
"an",
"entity",
"role",
"for",
"an",
"entity",
"in",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L7800-L7816 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/Timing.java | Timing.report | public long report(String str, PrintWriter writer) {
long elapsed = this.report();
writer.println(str + " Time elapsed: " + (elapsed) + " ms");
return elapsed;
} | java | public long report(String str, PrintWriter writer) {
long elapsed = this.report();
writer.println(str + " Time elapsed: " + (elapsed) + " ms");
return elapsed;
} | [
"public",
"long",
"report",
"(",
"String",
"str",
",",
"PrintWriter",
"writer",
")",
"{",
"long",
"elapsed",
"=",
"this",
".",
"report",
"(",
")",
";",
"writer",
".",
"println",
"(",
"str",
"+",
"\" Time elapsed: \"",
"+",
"(",
"elapsed",
")",
"+",
"\"... | Print elapsed time (without stopping timer).
@param str Additional prefix string to be printed
@param writer PrintWriter on which to write output
@return Number of milliseconds elapsed | [
"Print",
"elapsed",
"time",
"(",
"without",
"stopping",
"timer",
")",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Timing.java#L89-L93 |
alkacon/opencms-core | src/org/opencms/cache/CmsVfsMemoryObjectCache.java | CmsVfsMemoryObjectCache.loadVfsObject | public Object loadVfsObject(CmsObject cms, String rootPath, Transformer function) {
Object result = getCachedObject(cms, rootPath);
if (result == null) {
result = function.transform(rootPath);
putCachedObject(cms, rootPath, result);
}
return result;
} | java | public Object loadVfsObject(CmsObject cms, String rootPath, Transformer function) {
Object result = getCachedObject(cms, rootPath);
if (result == null) {
result = function.transform(rootPath);
putCachedObject(cms, rootPath, result);
}
return result;
} | [
"public",
"Object",
"loadVfsObject",
"(",
"CmsObject",
"cms",
",",
"String",
"rootPath",
",",
"Transformer",
"function",
")",
"{",
"Object",
"result",
"=",
"getCachedObject",
"(",
"cms",
",",
"rootPath",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{... | Uses a transformer for loading an object from a path if it has not already been cached, and then caches it.<p>
@param cms the CMS context
@param rootPath the root path from which the object should be loaded
@param function the function which should load the object from VFS if it isn't already cached
@return the loaded object | [
"Uses",
"a",
"transformer",
"for",
"loading",
"an",
"object",
"from",
"a",
"path",
"if",
"it",
"has",
"not",
"already",
"been",
"cached",
"and",
"then",
"caches",
"it",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsMemoryObjectCache.java#L105-L113 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsShowResourceTable.java | CmsShowResourceTable.getPrincipal | private CmsPrincipal getPrincipal(CmsObject cms, DialogType type, CmsUUID id) throws CmsException {
if (type.equals(DialogType.Group)) {
return cms.readGroup(id);
}
if (type.equals(DialogType.User)) {
return cms.readUser(id);
}
return null;
} | java | private CmsPrincipal getPrincipal(CmsObject cms, DialogType type, CmsUUID id) throws CmsException {
if (type.equals(DialogType.Group)) {
return cms.readGroup(id);
}
if (type.equals(DialogType.User)) {
return cms.readUser(id);
}
return null;
} | [
"private",
"CmsPrincipal",
"getPrincipal",
"(",
"CmsObject",
"cms",
",",
"DialogType",
"type",
",",
"CmsUUID",
"id",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"type",
".",
"equals",
"(",
"DialogType",
".",
"Group",
")",
")",
"{",
"return",
"cms",
".",... | Get principal from id.<p>
@param cms CmsObject
@param type user or group
@param id id of principal
@return Principal
@throws CmsException exception | [
"Get",
"principal",
"from",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsShowResourceTable.java#L299-L308 |
ebourgeois/common-java | src/main/java/ca/jeb/common/infra/JReflectionUtils.java | JReflectionUtils.getMethodByName | public static Method getMethodByName(Class<?> clazz, String name)
{
final List<Method> methods = JReflectionUtils.getAllMethods(new ArrayList<Method>(), clazz);
for (Method method : methods)
{
if (method.getName().equals(name))
{
return method;
}
}
return null;
} | java | public static Method getMethodByName(Class<?> clazz, String name)
{
final List<Method> methods = JReflectionUtils.getAllMethods(new ArrayList<Method>(), clazz);
for (Method method : methods)
{
if (method.getName().equals(name))
{
return method;
}
}
return null;
} | [
"public",
"static",
"Method",
"getMethodByName",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"name",
")",
"{",
"final",
"List",
"<",
"Method",
">",
"methods",
"=",
"JReflectionUtils",
".",
"getAllMethods",
"(",
"new",
"ArrayList",
"<",
"Method",
"... | Retrieve a Method object with the provided <i>name</i> on the class, <i>clazz</i>.
@param clazz
@param name
@return Method | [
"Retrieve",
"a",
"Method",
"object",
"with",
"the",
"provided",
"<i",
">",
"name<",
"/",
"i",
">",
"on",
"the",
"class",
"<i",
">",
"clazz<",
"/",
"i",
">",
"."
] | train | https://github.com/ebourgeois/common-java/blob/8ba7e05b1228aad1ec2949b5707ac4b5e8889f92/src/main/java/ca/jeb/common/infra/JReflectionUtils.java#L193-L205 |
otto-de/edison-microservice | edison-mongo/src/main/java/de/otto/edison/mongo/AbstractMongoRepository.java | AbstractMongoRepository.byId | protected Document byId(final K key) {
if (key != null) {
return new Document(ID, key.toString());
} else {
throw new NullPointerException("Key must not be null");
}
} | java | protected Document byId(final K key) {
if (key != null) {
return new Document(ID, key.toString());
} else {
throw new NullPointerException("Key must not be null");
}
} | [
"protected",
"Document",
"byId",
"(",
"final",
"K",
"key",
")",
"{",
"if",
"(",
"key",
"!=",
"null",
")",
"{",
"return",
"new",
"Document",
"(",
"ID",
",",
"key",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"NullPointerEx... | Returns a query that is selecting documents by ID.
@param key the document's key
@return query Document | [
"Returns",
"a",
"query",
"that",
"is",
"selecting",
"documents",
"by",
"ID",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-mongo/src/main/java/de/otto/edison/mongo/AbstractMongoRepository.java#L323-L329 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/ObjectPool.java | ObjectPool.getInstance | public synchronized Object getInstance()
{
// Check if the pool is empty.
if (freeStack.isEmpty())
{
// Create a new object if so.
try
{
return objectType.newInstance();
}
catch (InstantiationException ex){}
catch (IllegalAccessException ex){}
// Throw unchecked exception for error in pool configuration.
throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_EXCEPTION_CREATING_POOL, null)); //"exception creating new instance for pool");
}
else
{
// Remove object from end of free pool.
Object result = freeStack.remove(freeStack.size() - 1);
return result;
}
} | java | public synchronized Object getInstance()
{
// Check if the pool is empty.
if (freeStack.isEmpty())
{
// Create a new object if so.
try
{
return objectType.newInstance();
}
catch (InstantiationException ex){}
catch (IllegalAccessException ex){}
// Throw unchecked exception for error in pool configuration.
throw new RuntimeException(XMLMessages.createXMLMessage(XMLErrorResources.ER_EXCEPTION_CREATING_POOL, null)); //"exception creating new instance for pool");
}
else
{
// Remove object from end of free pool.
Object result = freeStack.remove(freeStack.size() - 1);
return result;
}
} | [
"public",
"synchronized",
"Object",
"getInstance",
"(",
")",
"{",
"// Check if the pool is empty.",
"if",
"(",
"freeStack",
".",
"isEmpty",
"(",
")",
")",
"{",
"// Create a new object if so.",
"try",
"{",
"return",
"objectType",
".",
"newInstance",
"(",
")",
";",
... | Get an instance of the given object in this pool
@return An instance of the given object | [
"Get",
"an",
"instance",
"of",
"the",
"given",
"object",
"in",
"this",
"pool"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/ObjectPool.java#L126-L152 |
keenon/loglinear | src/main/java/com/github/keenon/loglinear/model/ConcatVectorNamespace.java | ConcatVectorNamespace.ensureSparseFeature | public int ensureSparseFeature(String featureName, String index) {
ensureFeature(featureName);
ObjectIntMap<String> sparseIndex = sparseFeatureIndex.get(featureName);
IntObjectMap<String> reverseSparseIndex = reverseSparseFeatureIndex.get(featureName);
if (sparseIndex == null || reverseSparseIndex == null) {
synchronized (sparseFeatureIndex) {
sparseIndex = sparseFeatureIndex.get(featureName);
reverseSparseIndex = reverseSparseFeatureIndex.get(featureName);
if (sparseIndex == null || reverseSparseIndex == null) {
sparseIndex = new ObjectIntHashMap<>();
reverseSparseIndex = new IntObjectHashMap<>();
sparseFeatureIndex.put(featureName, sparseIndex);
reverseSparseFeatureIndex.put(featureName, reverseSparseIndex);
}
}
}
Integer rtn = sparseIndex.getOrDefault(index, -1);
if (rtn == -1) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (sparseIndex) {
rtn = sparseIndex.getOrDefault(index, -1);
if (rtn == -1) {
rtn = sparseIndex.size();
reverseSparseIndex.put(rtn, index);
sparseIndex.put(index, rtn);
}
}
}
return rtn;
} | java | public int ensureSparseFeature(String featureName, String index) {
ensureFeature(featureName);
ObjectIntMap<String> sparseIndex = sparseFeatureIndex.get(featureName);
IntObjectMap<String> reverseSparseIndex = reverseSparseFeatureIndex.get(featureName);
if (sparseIndex == null || reverseSparseIndex == null) {
synchronized (sparseFeatureIndex) {
sparseIndex = sparseFeatureIndex.get(featureName);
reverseSparseIndex = reverseSparseFeatureIndex.get(featureName);
if (sparseIndex == null || reverseSparseIndex == null) {
sparseIndex = new ObjectIntHashMap<>();
reverseSparseIndex = new IntObjectHashMap<>();
sparseFeatureIndex.put(featureName, sparseIndex);
reverseSparseFeatureIndex.put(featureName, reverseSparseIndex);
}
}
}
Integer rtn = sparseIndex.getOrDefault(index, -1);
if (rtn == -1) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (sparseIndex) {
rtn = sparseIndex.getOrDefault(index, -1);
if (rtn == -1) {
rtn = sparseIndex.size();
reverseSparseIndex.put(rtn, index);
sparseIndex.put(index, rtn);
}
}
}
return rtn;
} | [
"public",
"int",
"ensureSparseFeature",
"(",
"String",
"featureName",
",",
"String",
"index",
")",
"{",
"ensureFeature",
"(",
"featureName",
")",
";",
"ObjectIntMap",
"<",
"String",
">",
"sparseIndex",
"=",
"sparseFeatureIndex",
".",
"get",
"(",
"featureName",
"... | An optimization, this lets clients inform the ConcatVectorNamespace of how many sparse feature components to
expect, again so that we can avoid resizing ConcatVectors.
@param featureName the feature to use in our index
@param index the sparse value to ensure is available | [
"An",
"optimization",
"this",
"lets",
"clients",
"inform",
"the",
"ConcatVectorNamespace",
"of",
"how",
"many",
"sparse",
"feature",
"components",
"to",
"expect",
"again",
"so",
"that",
"we",
"can",
"avoid",
"resizing",
"ConcatVectors",
"."
] | train | https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/ConcatVectorNamespace.java#L85-L114 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.getPropertiesFromComputeNode | public void getPropertiesFromComputeNode(String poolId, String nodeId, String filePath) {
getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).toBlocking().single().body();
} | java | public void getPropertiesFromComputeNode(String poolId, String nodeId, String filePath) {
getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).toBlocking().single().body();
} | [
"public",
"void",
"getPropertiesFromComputeNode",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"filePath",
")",
"{",
"getPropertiesFromComputeNodeWithServiceResponseAsync",
"(",
"poolId",
",",
"nodeId",
",",
"filePath",
")",
".",
"toBlocking",
"(",... | Gets the properties of the specified compute node file.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node that contains the file.
@param filePath The path to the compute node file that you want to get the properties of.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"compute",
"node",
"file",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L1366-L1368 |
jbundle/jbundle | main/db/src/main/java/org/jbundle/main/user/db/SetupNewUserHandler.java | SetupNewUserHandler.doRecordChange | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
if (iChangeType == DBConstants.AFTER_ADD_TYPE)
{
UserInfo userTemplate = this.getUserTemplate();
if (userTemplate != null)
{
Record userInfo = this.getOwner();
Object bookmark = userInfo.getLastModified(DBConstants.BOOKMARK_HANDLE);
RecordOwner recordOwner = this.getOwner().findRecordOwner();
UserRegistration userRegistration = new UserRegistration(recordOwner);
UserRegistration newUserRegistration = new UserRegistration(recordOwner);
userRegistration.addListener(new SubFileFilter(userTemplate));
try {
while (userRegistration.hasNext())
{
userRegistration.next();
newUserRegistration.addNew();
newUserRegistration.moveFields(userRegistration, null, bDisplayOption, DBConstants.INIT_MOVE, true, false, false, false);
newUserRegistration.getField(UserRegistration.ID).initField(bDisplayOption);
newUserRegistration.getField(UserRegistration.USER_ID).setData(bookmark);
newUserRegistration.add();
}
} catch (DBException e) {
e.printStackTrace();
}
}
}
return super.doRecordChange(field, iChangeType, bDisplayOption);
} | java | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{
if (iChangeType == DBConstants.AFTER_ADD_TYPE)
{
UserInfo userTemplate = this.getUserTemplate();
if (userTemplate != null)
{
Record userInfo = this.getOwner();
Object bookmark = userInfo.getLastModified(DBConstants.BOOKMARK_HANDLE);
RecordOwner recordOwner = this.getOwner().findRecordOwner();
UserRegistration userRegistration = new UserRegistration(recordOwner);
UserRegistration newUserRegistration = new UserRegistration(recordOwner);
userRegistration.addListener(new SubFileFilter(userTemplate));
try {
while (userRegistration.hasNext())
{
userRegistration.next();
newUserRegistration.addNew();
newUserRegistration.moveFields(userRegistration, null, bDisplayOption, DBConstants.INIT_MOVE, true, false, false, false);
newUserRegistration.getField(UserRegistration.ID).initField(bDisplayOption);
newUserRegistration.getField(UserRegistration.USER_ID).setData(bookmark);
newUserRegistration.add();
}
} catch (DBException e) {
e.printStackTrace();
}
}
}
return super.doRecordChange(field, iChangeType, bDisplayOption);
} | [
"public",
"int",
"doRecordChange",
"(",
"FieldInfo",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"{",
"if",
"(",
"iChangeType",
"==",
"DBConstants",
".",
"AFTER_ADD_TYPE",
")",
"{",
"UserInfo",
"userTemplate",
"=",
"this",
".",
"... | Called when a change is the record status is about to happen/has happened.
@param field If this file change is due to a field, this is the field.
@param iChangeType The type of change that occurred.
@param bDisplayOption If true, display any changes.
@return an error code.
ADD_TYPE - Before a write.
UPDATE_TYPE - Before an update.
DELETE_TYPE - Before a delete.
AFTER_UPDATE_TYPE - After a write or update.
LOCK_TYPE - Before a lock.
SELECT_TYPE - After a select.
DESELECT_TYPE - After a deselect.
MOVE_NEXT_TYPE - After a move.
AFTER_REQUERY_TYPE - Record opened.
SELECT_EOF_TYPE - EOF Hit. | [
"Called",
"when",
"a",
"change",
"is",
"the",
"record",
"status",
"is",
"about",
"to",
"happen",
"/",
"has",
"happened",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/user/db/SetupNewUserHandler.java#L98-L127 |
JCTools/JCTools | jctools-experimental/src/main/java/org/jctools/queues/MpscRelaxedArrayQueue.java | MpscRelaxedArrayQueue.validateSlowProducerOverClaim | private void validateSlowProducerOverClaim(final int activeCycleIndex, final long producerCycleClaim)
{
//the cycle claim is now ok?
final long producerPosition = producerPositionFromClaim(
producerCycleClaim,
positionWithinCycleMask,
cycleIdBitShift,
cycleLengthLog2);
if (isFull(producerPosition))
{
//a definitive fail could be declared only if the claim is trying to overwrite something not consumed yet:
//isFull is not considering the real occupation of the slot
final long consumerPosition = lvConsumerPosition();
final long effectiveProducerLimit = consumerPosition + (this.cycleLength * 2);
if (producerPosition >= effectiveProducerLimit)
{
throw new IllegalStateException(
"The producer has fallen behind: please enlarge the capacity or reduce the number of producers! \n" +
" producerPosition=" + producerPosition + "\n" +
" consumerPosition=" + consumerPosition + "\n" +
" activeCycleIndex=" + activeCycleIndex + "\n" +
" cycleId=" + producerClaimCycleId(producerCycleClaim, cycleIdBitShift) + "\n" +
" positionOnCycle=" + positionWithinCycle(producerCycleClaim, positionWithinCycleMask));
}
//the slot is not occupied: we can write into it
}
//the claim now is ok: consumers have gone forward enough
} | java | private void validateSlowProducerOverClaim(final int activeCycleIndex, final long producerCycleClaim)
{
//the cycle claim is now ok?
final long producerPosition = producerPositionFromClaim(
producerCycleClaim,
positionWithinCycleMask,
cycleIdBitShift,
cycleLengthLog2);
if (isFull(producerPosition))
{
//a definitive fail could be declared only if the claim is trying to overwrite something not consumed yet:
//isFull is not considering the real occupation of the slot
final long consumerPosition = lvConsumerPosition();
final long effectiveProducerLimit = consumerPosition + (this.cycleLength * 2);
if (producerPosition >= effectiveProducerLimit)
{
throw new IllegalStateException(
"The producer has fallen behind: please enlarge the capacity or reduce the number of producers! \n" +
" producerPosition=" + producerPosition + "\n" +
" consumerPosition=" + consumerPosition + "\n" +
" activeCycleIndex=" + activeCycleIndex + "\n" +
" cycleId=" + producerClaimCycleId(producerCycleClaim, cycleIdBitShift) + "\n" +
" positionOnCycle=" + positionWithinCycle(producerCycleClaim, positionWithinCycleMask));
}
//the slot is not occupied: we can write into it
}
//the claim now is ok: consumers have gone forward enough
} | [
"private",
"void",
"validateSlowProducerOverClaim",
"(",
"final",
"int",
"activeCycleIndex",
",",
"final",
"long",
"producerCycleClaim",
")",
"{",
"//the cycle claim is now ok?",
"final",
"long",
"producerPosition",
"=",
"producerPositionFromClaim",
"(",
"producerCycleClaim",... | Validates a slow producer over-claim throwing {@link IllegalStateException} if the offer on it can't continue. | [
"Validates",
"a",
"slow",
"producer",
"over",
"-",
"claim",
"throwing",
"{"
] | train | https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-experimental/src/main/java/org/jctools/queues/MpscRelaxedArrayQueue.java#L438-L465 |
undertow-io/undertow | servlet/src/main/java/io/undertow/servlet/api/DeploymentInfo.java | DeploymentInfo.addFirstAuthenticationMechanism | public DeploymentInfo addFirstAuthenticationMechanism(final String name, final AuthenticationMechanism mechanism) {
authenticationMechanisms.put(name, new ImmediateAuthenticationMechanismFactory(mechanism));
if(loginConfig == null) {
loginConfig = new LoginConfig(null);
}
loginConfig.addFirstAuthMethod(new AuthMethodConfig(name));
return this;
} | java | public DeploymentInfo addFirstAuthenticationMechanism(final String name, final AuthenticationMechanism mechanism) {
authenticationMechanisms.put(name, new ImmediateAuthenticationMechanismFactory(mechanism));
if(loginConfig == null) {
loginConfig = new LoginConfig(null);
}
loginConfig.addFirstAuthMethod(new AuthMethodConfig(name));
return this;
} | [
"public",
"DeploymentInfo",
"addFirstAuthenticationMechanism",
"(",
"final",
"String",
"name",
",",
"final",
"AuthenticationMechanism",
"mechanism",
")",
"{",
"authenticationMechanisms",
".",
"put",
"(",
"name",
",",
"new",
"ImmediateAuthenticationMechanismFactory",
"(",
... | Adds an authentication mechanism directly to the deployment. This mechanism will be first in the list.
In general you should just use {@link #addAuthenticationMechanism(String, io.undertow.security.api.AuthenticationMechanismFactory)}
and allow the user to configure the methods they want by name.
This method is essentially a convenience method, if is the same as registering a factory under the provided name that returns
and authentication mechanism, and then adding it to the login config list.
If you want your mechanism to be the only one in the deployment you should first invoke {@link #clearLoginMethods()}.
@param name The authentication mechanism name
@param mechanism The mechanism
@return this deployment info | [
"Adds",
"an",
"authentication",
"mechanism",
"directly",
"to",
"the",
"deployment",
".",
"This",
"mechanism",
"will",
"be",
"first",
"in",
"the",
"list",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/servlet/src/main/java/io/undertow/servlet/api/DeploymentInfo.java#L1007-L1014 |
Alluxio/alluxio | core/base/src/main/java/alluxio/util/io/PathUtils.java | PathUtils.normalizePath | public static String normalizePath(String path, String separator) {
return path.endsWith(separator) ? path : path + separator;
} | java | public static String normalizePath(String path, String separator) {
return path.endsWith(separator) ? path : path + separator;
} | [
"public",
"static",
"String",
"normalizePath",
"(",
"String",
"path",
",",
"String",
"separator",
")",
"{",
"return",
"path",
".",
"endsWith",
"(",
"separator",
")",
"?",
"path",
":",
"path",
"+",
"separator",
";",
"}"
] | Adds a trailing separator if it does not exist in path.
@param path the file name
@param separator trailing separator to add
@return updated path with trailing separator | [
"Adds",
"a",
"trailing",
"separator",
"if",
"it",
"does",
"not",
"exist",
"in",
"path",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/io/PathUtils.java#L288-L290 |
line/armeria | saml/src/main/java/com/linecorp/armeria/server/saml/HttpRedirectBindingUtil.java | HttpRedirectBindingUtil.validateSignature | private static void validateSignature(Credential validationCredential,
SamlParameters parameters,
String messageParamName) {
requireNonNull(validationCredential, "validationCredential");
requireNonNull(parameters, "parameters");
requireNonNull(messageParamName, "messageParamName");
final String signature = parameters.getFirstValue(SIGNATURE);
final String sigAlg = parameters.getFirstValue(SIGNATURE_ALGORITHM);
// The order is one of the followings:
// - SAMLRequest={value}&RelayState={value}=SigAlg={value}
// - SAMLResponse={value}&RelayState={value}=SigAlg={value}
final QueryStringEncoder encoder = new QueryStringEncoder("");
encoder.addParam(messageParamName, parameters.getFirstValue(messageParamName));
final String relayState = parameters.getFirstValueOrNull(RELAY_STATE);
if (relayState != null) {
encoder.addParam(RELAY_STATE, relayState);
}
encoder.addParam(SIGNATURE_ALGORITHM, sigAlg);
final byte[] input = encoder.toString().substring(1).getBytes(StandardCharsets.UTF_8);
try {
final byte[] decodedSignature = Base64.getMimeDecoder().decode(signature);
if (!XMLSigningUtil.verifyWithURI(validationCredential, sigAlg, decodedSignature, input)) {
throw new SamlException("failed to validate a signature");
}
} catch (IllegalArgumentException e) {
throw new SamlException("failed to decode a base64 signature string", e);
} catch (SecurityException e) {
throw new SamlException("failed to validate a signature", e);
}
} | java | private static void validateSignature(Credential validationCredential,
SamlParameters parameters,
String messageParamName) {
requireNonNull(validationCredential, "validationCredential");
requireNonNull(parameters, "parameters");
requireNonNull(messageParamName, "messageParamName");
final String signature = parameters.getFirstValue(SIGNATURE);
final String sigAlg = parameters.getFirstValue(SIGNATURE_ALGORITHM);
// The order is one of the followings:
// - SAMLRequest={value}&RelayState={value}=SigAlg={value}
// - SAMLResponse={value}&RelayState={value}=SigAlg={value}
final QueryStringEncoder encoder = new QueryStringEncoder("");
encoder.addParam(messageParamName, parameters.getFirstValue(messageParamName));
final String relayState = parameters.getFirstValueOrNull(RELAY_STATE);
if (relayState != null) {
encoder.addParam(RELAY_STATE, relayState);
}
encoder.addParam(SIGNATURE_ALGORITHM, sigAlg);
final byte[] input = encoder.toString().substring(1).getBytes(StandardCharsets.UTF_8);
try {
final byte[] decodedSignature = Base64.getMimeDecoder().decode(signature);
if (!XMLSigningUtil.verifyWithURI(validationCredential, sigAlg, decodedSignature, input)) {
throw new SamlException("failed to validate a signature");
}
} catch (IllegalArgumentException e) {
throw new SamlException("failed to decode a base64 signature string", e);
} catch (SecurityException e) {
throw new SamlException("failed to validate a signature", e);
}
} | [
"private",
"static",
"void",
"validateSignature",
"(",
"Credential",
"validationCredential",
",",
"SamlParameters",
"parameters",
",",
"String",
"messageParamName",
")",
"{",
"requireNonNull",
"(",
"validationCredential",
",",
"\"validationCredential\"",
")",
";",
"requir... | Validates a signature in the specified {@link AggregatedHttpMessage}. | [
"Validates",
"a",
"signature",
"in",
"the",
"specified",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/saml/src/main/java/com/linecorp/armeria/server/saml/HttpRedirectBindingUtil.java#L132-L166 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.createDeployKey | public GitlabSSHKey createDeployKey(Integer targetProjectId, String title, String key) throws IOException {
return createDeployKey(targetProjectId, title, key, false);
} | java | public GitlabSSHKey createDeployKey(Integer targetProjectId, String title, String key) throws IOException {
return createDeployKey(targetProjectId, title, key, false);
} | [
"public",
"GitlabSSHKey",
"createDeployKey",
"(",
"Integer",
"targetProjectId",
",",
"String",
"title",
",",
"String",
"key",
")",
"throws",
"IOException",
"{",
"return",
"createDeployKey",
"(",
"targetProjectId",
",",
"title",
",",
"key",
",",
"false",
")",
";"... | Create a new deploy key for the project
@param targetProjectId The id of the Gitlab project
@param title The title of the ssh key
@param key The public key
@return The new GitlabSSHKey
@throws IOException on gitlab api call error | [
"Create",
"a",
"new",
"deploy",
"key",
"for",
"the",
"project"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3167-L3169 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java | OutputsInner.createOrReplace | public OutputInner createOrReplace(String resourceGroupName, String jobName, String outputName, OutputInner output, String ifMatch, String ifNoneMatch) {
return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, outputName, output, ifMatch, ifNoneMatch).toBlocking().single().body();
} | java | public OutputInner createOrReplace(String resourceGroupName, String jobName, String outputName, OutputInner output, String ifMatch, String ifNoneMatch) {
return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, outputName, output, ifMatch, ifNoneMatch).toBlocking().single().body();
} | [
"public",
"OutputInner",
"createOrReplace",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"String",
"outputName",
",",
"OutputInner",
"output",
",",
"String",
"ifMatch",
",",
"String",
"ifNoneMatch",
")",
"{",
"return",
"createOrReplaceWithService... | Creates an output or replaces an already existing output under an existing streaming job.
@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 jobName The name of the streaming job.
@param outputName The name of the output.
@param output The definition of the output that will be used to create a new output or replace the existing one under the streaming job.
@param ifMatch The ETag of the output. Omit this value to always overwrite the current output. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes.
@param ifNoneMatch Set to '*' to allow a new output to be created, but to prevent updating an existing output. Other values will result in a 412 Pre-condition Failed response.
@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 OutputInner object if successful. | [
"Creates",
"an",
"output",
"or",
"replaces",
"an",
"already",
"existing",
"output",
"under",
"an",
"existing",
"streaming",
"job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java#L214-L216 |
overturetool/overture | ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java | CharOperation.trim | final static public char[] trim(char[] chars)
{
if (chars == null)
{
return null;
}
int start = 0, length = chars.length, end = length - 1;
while (start < length && chars[start] == ' ')
{
start++;
}
while (end > start && chars[end] == ' ')
{
end--;
}
if (start != 0 || end != length - 1)
{
return subarray(chars, start, end + 1);
}
return chars;
} | java | final static public char[] trim(char[] chars)
{
if (chars == null)
{
return null;
}
int start = 0, length = chars.length, end = length - 1;
while (start < length && chars[start] == ' ')
{
start++;
}
while (end > start && chars[end] == ' ')
{
end--;
}
if (start != 0 || end != length - 1)
{
return subarray(chars, start, end + 1);
}
return chars;
} | [
"final",
"static",
"public",
"char",
"[",
"]",
"trim",
"(",
"char",
"[",
"]",
"chars",
")",
"{",
"if",
"(",
"chars",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"start",
"=",
"0",
",",
"length",
"=",
"chars",
".",
"length",
",",
... | Answers a new array removing leading and trailing spaces (' '). Answers the given array if there is no space
characters to remove. <br>
<br>
For example:
<ol>
<li>
<pre>
chars = { ' ', 'a' , 'b', ' ', ' ' }
result => { 'a' , 'b' }
</pre>
</li>
<li>
<pre>
array = { 'A', 'b' }
result => { 'A' , 'b' }
</pre>
</li>
</ol>
@param chars
the given array
@return a new array removing leading and trailing spaces (' ') | [
"Answers",
"a",
"new",
"array",
"removing",
"leading",
"and",
"trailing",
"spaces",
"(",
")",
".",
"Answers",
"the",
"given",
"array",
"if",
"there",
"is",
"no",
"space",
"characters",
"to",
"remove",
".",
"<br",
">",
"<br",
">",
"For",
"example",
":",
... | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java#L3994-L4016 |
liferay/com-liferay-commerce | commerce-product-type-virtual-service/src/main/java/com/liferay/commerce/product/type/virtual/service/persistence/impl/CPDefinitionVirtualSettingPersistenceImpl.java | CPDefinitionVirtualSettingPersistenceImpl.findAll | @Override
public List<CPDefinitionVirtualSetting> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPDefinitionVirtualSetting> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionVirtualSetting",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the cp definition virtual settings.
@return the cp definition virtual settings | [
"Returns",
"all",
"the",
"cp",
"definition",
"virtual",
"settings",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-service/src/main/java/com/liferay/commerce/product/type/virtual/service/persistence/impl/CPDefinitionVirtualSettingPersistenceImpl.java#L2386-L2389 |
alkacon/opencms-core | src/org/opencms/widgets/A_CmsHtmlWidget.java | A_CmsHtmlWidget.buildOpenCmsButtonRow | protected String buildOpenCmsButtonRow(int segment, I_CmsWidgetDialog widgetDialog) {
StringBuffer result = new StringBuffer(256);
if (segment == CmsWorkplace.HTML_START) {
// generate line and start row HTML
result.append(widgetDialog.buttonBarHorizontalLine());
result.append(widgetDialog.buttonBar(CmsWorkplace.HTML_START));
result.append(widgetDialog.buttonBarStartTab(0, 0));
} else {
// close button row and generate end line
result.append(widgetDialog.buttonBar(CmsWorkplace.HTML_END));
result.append(widgetDialog.buttonBarHorizontalLine());
}
return result.toString();
} | java | protected String buildOpenCmsButtonRow(int segment, I_CmsWidgetDialog widgetDialog) {
StringBuffer result = new StringBuffer(256);
if (segment == CmsWorkplace.HTML_START) {
// generate line and start row HTML
result.append(widgetDialog.buttonBarHorizontalLine());
result.append(widgetDialog.buttonBar(CmsWorkplace.HTML_START));
result.append(widgetDialog.buttonBarStartTab(0, 0));
} else {
// close button row and generate end line
result.append(widgetDialog.buttonBar(CmsWorkplace.HTML_END));
result.append(widgetDialog.buttonBarHorizontalLine());
}
return result.toString();
} | [
"protected",
"String",
"buildOpenCmsButtonRow",
"(",
"int",
"segment",
",",
"I_CmsWidgetDialog",
"widgetDialog",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"256",
")",
";",
"if",
"(",
"segment",
"==",
"CmsWorkplace",
".",
"HTML_START",
... | Returns the start or end HTML for the OpenCms specific button row.<p>
Use this method to generate the start and end html for the button row.<p>
Overwrite the method if the integrated editor needs a specific layout for the button row start or end html.<p>
@param segment the HTML segment (START / END)
@param widgetDialog the dialog where the widget is used on
@return the html String for the OpenCms specific button row | [
"Returns",
"the",
"start",
"or",
"end",
"HTML",
"for",
"the",
"OpenCms",
"specific",
"button",
"row",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/A_CmsHtmlWidget.java#L215-L231 |
motown-io/motown | chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java | DomainService.getEvseByIdentifier | private Evse getEvseByIdentifier(ChargingStationType chargingStationType, int identifier) {
for (Evse evse:chargingStationType.getEvses()) {
if(identifier == evse.getIdentifier()) {
return evse;
}
}
return null;
} | java | private Evse getEvseByIdentifier(ChargingStationType chargingStationType, int identifier) {
for (Evse evse:chargingStationType.getEvses()) {
if(identifier == evse.getIdentifier()) {
return evse;
}
}
return null;
} | [
"private",
"Evse",
"getEvseByIdentifier",
"(",
"ChargingStationType",
"chargingStationType",
",",
"int",
"identifier",
")",
"{",
"for",
"(",
"Evse",
"evse",
":",
"chargingStationType",
".",
"getEvses",
"(",
")",
")",
"{",
"if",
"(",
"identifier",
"==",
"evse",
... | Gets a Evse by identifier.
@param chargingStationType charging station type.
@param identifier evse identifier.
@return evse or null if not found. | [
"Gets",
"a",
"Evse",
"by",
"identifier",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L445-L452 |
alkacon/opencms-core | src/org/opencms/widgets/CmsPrincipalWidget.java | CmsPrincipalWidget.getButtonJs | public String getButtonJs(String id, String form) {
StringBuffer buttonJs = new StringBuffer(8);
buttonJs.append("javascript:openPrincipalWin('");
buttonJs.append(OpenCms.getSystemInfo().getOpenCmsContext());
buttonJs.append("/system/workplace/commons/principal_selection.jsp");
buttonJs.append("','" + form + "', '");
buttonJs.append(id);
buttonJs.append("', document, '");
if (m_flags != null) {
buttonJs.append(m_flags);
} else {
buttonJs.append("null");
}
buttonJs.append("'");
buttonJs.append(");");
return buttonJs.toString();
} | java | public String getButtonJs(String id, String form) {
StringBuffer buttonJs = new StringBuffer(8);
buttonJs.append("javascript:openPrincipalWin('");
buttonJs.append(OpenCms.getSystemInfo().getOpenCmsContext());
buttonJs.append("/system/workplace/commons/principal_selection.jsp");
buttonJs.append("','" + form + "', '");
buttonJs.append(id);
buttonJs.append("', document, '");
if (m_flags != null) {
buttonJs.append(m_flags);
} else {
buttonJs.append("null");
}
buttonJs.append("'");
buttonJs.append(");");
return buttonJs.toString();
} | [
"public",
"String",
"getButtonJs",
"(",
"String",
"id",
",",
"String",
"form",
")",
"{",
"StringBuffer",
"buttonJs",
"=",
"new",
"StringBuffer",
"(",
"8",
")",
";",
"buttonJs",
".",
"append",
"(",
"\"javascript:openPrincipalWin('\"",
")",
";",
"buttonJs",
".",... | Returns the needed java script for the search button.<p>
@param id the id of the widget to generate the search button for
@param form the id of the form where to which the widget belongs
@return javascript code | [
"Returns",
"the",
"needed",
"java",
"script",
"for",
"the",
"search",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsPrincipalWidget.java#L94-L111 |
voldemort/voldemort | src/java/voldemort/server/scheduler/slop/SlopPusherJob.java | SlopPusherJob.isSlopDead | protected boolean isSlopDead(Cluster cluster, Set<String> storeNames, Slop slop) {
// destination node , no longer exists
if(!cluster.getNodeIds().contains(slop.getNodeId())) {
return true;
}
// destination store, no longer exists
if(!storeNames.contains(slop.getStoreName())) {
return true;
}
// else. slop is alive
return false;
} | java | protected boolean isSlopDead(Cluster cluster, Set<String> storeNames, Slop slop) {
// destination node , no longer exists
if(!cluster.getNodeIds().contains(slop.getNodeId())) {
return true;
}
// destination store, no longer exists
if(!storeNames.contains(slop.getStoreName())) {
return true;
}
// else. slop is alive
return false;
} | [
"protected",
"boolean",
"isSlopDead",
"(",
"Cluster",
"cluster",
",",
"Set",
"<",
"String",
">",
"storeNames",
",",
"Slop",
"slop",
")",
"{",
"// destination node , no longer exists",
"if",
"(",
"!",
"cluster",
".",
"getNodeIds",
"(",
")",
".",
"contains",
"("... | A slop is dead if the destination node or the store does not exist
anymore on the cluster.
@param slop
@return | [
"A",
"slop",
"is",
"dead",
"if",
"the",
"destination",
"node",
"or",
"the",
"store",
"does",
"not",
"exist",
"anymore",
"on",
"the",
"cluster",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/scheduler/slop/SlopPusherJob.java#L52-L65 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java | ClassFinder.complete | private void complete(Symbol sym) throws CompletionFailure {
if (sym.kind == TYP) {
try {
ClassSymbol c = (ClassSymbol) sym;
dependencies.push(c, CompletionCause.CLASS_READER);
annotate.blockAnnotations();
c.members_field = new Scope.ErrorScope(c); // make sure it's always defined
completeOwners(c.owner);
completeEnclosing(c);
fillIn(c);
} finally {
annotate.unblockAnnotationsNoFlush();
dependencies.pop();
}
} else if (sym.kind == PCK) {
PackageSymbol p = (PackageSymbol)sym;
try {
fillIn(p);
} catch (IOException ex) {
throw new CompletionFailure(sym, ex.getLocalizedMessage()).initCause(ex);
}
}
if (!reader.filling)
annotate.flush(); // finish attaching annotations
} | java | private void complete(Symbol sym) throws CompletionFailure {
if (sym.kind == TYP) {
try {
ClassSymbol c = (ClassSymbol) sym;
dependencies.push(c, CompletionCause.CLASS_READER);
annotate.blockAnnotations();
c.members_field = new Scope.ErrorScope(c); // make sure it's always defined
completeOwners(c.owner);
completeEnclosing(c);
fillIn(c);
} finally {
annotate.unblockAnnotationsNoFlush();
dependencies.pop();
}
} else if (sym.kind == PCK) {
PackageSymbol p = (PackageSymbol)sym;
try {
fillIn(p);
} catch (IOException ex) {
throw new CompletionFailure(sym, ex.getLocalizedMessage()).initCause(ex);
}
}
if (!reader.filling)
annotate.flush(); // finish attaching annotations
} | [
"private",
"void",
"complete",
"(",
"Symbol",
"sym",
")",
"throws",
"CompletionFailure",
"{",
"if",
"(",
"sym",
".",
"kind",
"==",
"TYP",
")",
"{",
"try",
"{",
"ClassSymbol",
"c",
"=",
"(",
"ClassSymbol",
")",
"sym",
";",
"dependencies",
".",
"push",
"... | Completion for classes to be loaded. Before a class is loaded
we make sure its enclosing class (if any) is loaded. | [
"Completion",
"for",
"classes",
"to",
"be",
"loaded",
".",
"Before",
"a",
"class",
"is",
"loaded",
"we",
"make",
"sure",
"its",
"enclosing",
"class",
"(",
"if",
"any",
")",
"is",
"loaded",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L276-L300 |
liferay/com-liferay-commerce | commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceRegionUtil.java | CommerceRegionUtil.findByUUID_G | public static CommerceRegion findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.exception.NoSuchRegionException {
return getPersistence().findByUUID_G(uuid, groupId);
} | java | public static CommerceRegion findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.exception.NoSuchRegionException {
return getPersistence().findByUUID_G(uuid, groupId);
} | [
"public",
"static",
"CommerceRegion",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"com",
".",
"liferay",
".",
"commerce",
".",
"exception",
".",
"NoSuchRegionException",
"{",
"return",
"getPersistence",
"(",
")",
".",
"findByUUI... | Returns the commerce region where uuid = ? and groupId = ? or throws a {@link NoSuchRegionException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce region
@throws NoSuchRegionException if a matching commerce region could not be found | [
"Returns",
"the",
"commerce",
"region",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchRegionException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceRegionUtil.java#L279-L282 |
antlrjavaparser/antlr-java-parser | src/main/java/com/github/antlrjavaparser/ASTHelper.java | ASTHelper.createFieldDeclaration | public static FieldDeclaration createFieldDeclaration(int modifiers, Type type, VariableDeclarator variable) {
List<VariableDeclarator> variables = new ArrayList<VariableDeclarator>();
variables.add(variable);
FieldDeclaration ret = new FieldDeclaration(modifiers, type, variables);
return ret;
} | java | public static FieldDeclaration createFieldDeclaration(int modifiers, Type type, VariableDeclarator variable) {
List<VariableDeclarator> variables = new ArrayList<VariableDeclarator>();
variables.add(variable);
FieldDeclaration ret = new FieldDeclaration(modifiers, type, variables);
return ret;
} | [
"public",
"static",
"FieldDeclaration",
"createFieldDeclaration",
"(",
"int",
"modifiers",
",",
"Type",
"type",
",",
"VariableDeclarator",
"variable",
")",
"{",
"List",
"<",
"VariableDeclarator",
">",
"variables",
"=",
"new",
"ArrayList",
"<",
"VariableDeclarator",
... | Creates a {@link FieldDeclaration}.
@param modifiers
modifiers
@param type
type
@param variable
variable declarator
@return instance of {@link FieldDeclaration} | [
"Creates",
"a",
"{",
"@link",
"FieldDeclaration",
"}",
"."
] | train | https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/ASTHelper.java#L118-L123 |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/LRUCache.java | LRUCache.putIfDifferent | public V putIfDifferent( final K key, final V value ) {
synchronized ( _map ) {
final ManagedItem<V> item = _map.get( key );
if ( item == null || item._value == null || !item._value.equals( value ) ) {
return put( key, value );
} else {
return item._value;
}
}
} | java | public V putIfDifferent( final K key, final V value ) {
synchronized ( _map ) {
final ManagedItem<V> item = _map.get( key );
if ( item == null || item._value == null || !item._value.equals( value ) ) {
return put( key, value );
} else {
return item._value;
}
}
} | [
"public",
"V",
"putIfDifferent",
"(",
"final",
"K",
"key",
",",
"final",
"V",
"value",
")",
"{",
"synchronized",
"(",
"_map",
")",
"{",
"final",
"ManagedItem",
"<",
"V",
">",
"item",
"=",
"_map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"item",... | If the specified key is not already associated with a value or if it's
associated with a different value, associate it with the given value.
This is equivalent to
<pre>
<code> if (map.get(key) == null || !map.get(key).equals(value))
return map.put(key, value);
else
return map.get(key);
</code>
</pre>
except that the action is performed atomically.
@param key
the key to associate the value with.
@param value
the value to associate with the provided key.
@return the previous value associated with the specified key, or null if
there was no mapping for the key | [
"If",
"the",
"specified",
"key",
"is",
"not",
"already",
"associated",
"with",
"a",
"value",
"or",
"if",
"it",
"s",
"associated",
"with",
"a",
"different",
"value",
"associate",
"it",
"with",
"the",
"given",
"value",
".",
"This",
"is",
"equivalent",
"to"
] | train | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LRUCache.java#L123-L132 |
diirt/util | src/main/java/org/epics/util/stats/Ranges.java | Ranges.overlap | public static double overlap(Range range, Range otherRange) {
double minOverlap = Math.max(range.getMinimum().doubleValue(), otherRange.getMinimum().doubleValue());
double maxOverlap = Math.min(range.getMaximum().doubleValue(), otherRange.getMaximum().doubleValue());
double overlapWidth = maxOverlap - minOverlap;
double rangeWidth = range.getMaximum().doubleValue() - range.getMinimum().doubleValue();
double fraction = Math.max(0.0, overlapWidth / rangeWidth);
return fraction;
} | java | public static double overlap(Range range, Range otherRange) {
double minOverlap = Math.max(range.getMinimum().doubleValue(), otherRange.getMinimum().doubleValue());
double maxOverlap = Math.min(range.getMaximum().doubleValue(), otherRange.getMaximum().doubleValue());
double overlapWidth = maxOverlap - minOverlap;
double rangeWidth = range.getMaximum().doubleValue() - range.getMinimum().doubleValue();
double fraction = Math.max(0.0, overlapWidth / rangeWidth);
return fraction;
} | [
"public",
"static",
"double",
"overlap",
"(",
"Range",
"range",
",",
"Range",
"otherRange",
")",
"{",
"double",
"minOverlap",
"=",
"Math",
".",
"max",
"(",
"range",
".",
"getMinimum",
"(",
")",
".",
"doubleValue",
"(",
")",
",",
"otherRange",
".",
"getMi... | Percentage, from 0 to 1, of the first range that is contained by
the second range.
@param range the range to be contained by the second
@param otherRange the range that has to contain the first
@return from 0 (if there is no intersection) to 1 (if the ranges are the same) | [
"Percentage",
"from",
"0",
"to",
"1",
"of",
"the",
"first",
"range",
"that",
"is",
"contained",
"by",
"the",
"second",
"range",
"."
] | train | https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/stats/Ranges.java#L166-L173 |
drewnoakes/metadata-extractor | Source/com/drew/tools/FileUtil.java | FileUtil.saveBytes | public static void saveBytes(@NotNull File file, @NotNull byte[] bytes) throws IOException
{
FileOutputStream stream = null;
try {
stream = new FileOutputStream(file);
stream.write(bytes);
} finally {
if (stream != null) {
stream.close();
}
}
} | java | public static void saveBytes(@NotNull File file, @NotNull byte[] bytes) throws IOException
{
FileOutputStream stream = null;
try {
stream = new FileOutputStream(file);
stream.write(bytes);
} finally {
if (stream != null) {
stream.close();
}
}
} | [
"public",
"static",
"void",
"saveBytes",
"(",
"@",
"NotNull",
"File",
"file",
",",
"@",
"NotNull",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"stream",
"=",
"null",
";",
"try",
"{",
"stream",
"=",
"new",
"FileOutputSt... | Saves the contents of a <code>byte[]</code> to the specified {@link File}. | [
"Saves",
"the",
"contents",
"of",
"a",
"<code",
">",
"byte",
"[]",
"<",
"/",
"code",
">",
"to",
"the",
"specified",
"{"
] | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/tools/FileUtil.java#L41-L52 |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/Regex.java | Regex.createNFA | public static NFA<Integer> createNFA(Scope<NFAState<Integer>> scope, String expression)
{
return createNFA(scope, expression, 1);
} | java | public static NFA<Integer> createNFA(Scope<NFAState<Integer>> scope, String expression)
{
return createNFA(scope, expression, 1);
} | [
"public",
"static",
"NFA",
"<",
"Integer",
">",
"createNFA",
"(",
"Scope",
"<",
"NFAState",
"<",
"Integer",
">",
">",
"scope",
",",
"String",
"expression",
")",
"{",
"return",
"createNFA",
"(",
"scope",
",",
"expression",
",",
"1",
")",
";",
"}"
] | Creates an NFA from regular expression
@param scope
@param expression
@return | [
"Creates",
"an",
"NFA",
"from",
"regular",
"expression"
] | train | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/Regex.java#L1093-L1096 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java | DeployerResolverOverriderConverter.overrideDeploymentProperties | private void overrideDeploymentProperties(T overrider, Class overriderClass) {
if (!overriderClass.getSimpleName().equals(ArtifactoryMaven3NativeConfigurator.class.getSimpleName())) {
try {
Field deploymentPropertiesField = overriderClass.getDeclaredField("deploymentProperties");
deploymentPropertiesField.setAccessible(true);
Object deploymentProperties = deploymentPropertiesField.get(overrider);
if (deploymentProperties == null) {
Field matrixParamsField = overriderClass.getDeclaredField("matrixParams");
matrixParamsField.setAccessible(true);
Object matrixParams = matrixParamsField.get(overrider);
if (matrixParams != null) {
deploymentPropertiesField.set(overrider, matrixParams);
}
}
} catch (NoSuchFieldException | IllegalAccessException e) {
converterErrors.add(getConversionErrorMessage(overrider, e));
}
}
} | java | private void overrideDeploymentProperties(T overrider, Class overriderClass) {
if (!overriderClass.getSimpleName().equals(ArtifactoryMaven3NativeConfigurator.class.getSimpleName())) {
try {
Field deploymentPropertiesField = overriderClass.getDeclaredField("deploymentProperties");
deploymentPropertiesField.setAccessible(true);
Object deploymentProperties = deploymentPropertiesField.get(overrider);
if (deploymentProperties == null) {
Field matrixParamsField = overriderClass.getDeclaredField("matrixParams");
matrixParamsField.setAccessible(true);
Object matrixParams = matrixParamsField.get(overrider);
if (matrixParams != null) {
deploymentPropertiesField.set(overrider, matrixParams);
}
}
} catch (NoSuchFieldException | IllegalAccessException e) {
converterErrors.add(getConversionErrorMessage(overrider, e));
}
}
} | [
"private",
"void",
"overrideDeploymentProperties",
"(",
"T",
"overrider",
",",
"Class",
"overriderClass",
")",
"{",
"if",
"(",
"!",
"overriderClass",
".",
"getSimpleName",
"(",
")",
".",
"equals",
"(",
"ArtifactoryMaven3NativeConfigurator",
".",
"class",
".",
"get... | Convert the String matrixParams parameter to String deploymentProperties
This convertion comes after a name change (matrixParams -> deploymentProperties) | [
"Convert",
"the",
"String",
"matrixParams",
"parameter",
"to",
"String",
"deploymentProperties",
"This",
"convertion",
"comes",
"after",
"a",
"name",
"change",
"(",
"matrixParams",
"-",
">",
"deploymentProperties",
")"
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/converters/DeployerResolverOverriderConverter.java#L206-L225 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/logging/messages/consumer/ConsumerLogMessages.java | ConsumerLogMessages.logError | public static void logError(final Logger logger, final Error e)
{
logger.logError(Level.ERROR, "Unexpected Error", e);
} | java | public static void logError(final Logger logger, final Error e)
{
logger.logError(Level.ERROR, "Unexpected Error", e);
} | [
"public",
"static",
"void",
"logError",
"(",
"final",
"Logger",
"logger",
",",
"final",
"Error",
"e",
")",
"{",
"logger",
".",
"logError",
"(",
"Level",
".",
"ERROR",
",",
"\"Unexpected Error\"",
",",
"e",
")",
";",
"}"
] | Logs an error.
@param logger
reference to the logger
@param e
reference to the error | [
"Logs",
"an",
"error",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/logging/messages/consumer/ConsumerLogMessages.java#L54-L57 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java | ASTClassFactory.getConstructor | public ASTConstructor getConstructor(Constructor constructor, boolean isEnum, boolean isInnerClass) {
ASTAccessModifier modifier = ASTAccessModifier.getModifier(constructor.getModifiers());
Annotation[][] parameterAnnotations = constructor.getParameterAnnotations();
if(constructor.getDeclaringClass().getEnclosingClass() != null && !Modifier.isStatic(constructor.getDeclaringClass().getModifiers())){
// An inner class constructor contains a hidden non-annotated prameter
Annotation[][] paddedParameterAnnotations = new Annotation[parameterAnnotations.length + 1][];
paddedParameterAnnotations[0] = new Annotation[0];
System.arraycopy(parameterAnnotations, 0, paddedParameterAnnotations, 1, parameterAnnotations.length);
parameterAnnotations = paddedParameterAnnotations;
}
ImmutableList<ASTParameter> constructorParameters = getParameters(constructor.getParameterTypes(), constructor.getGenericParameterTypes(), parameterAnnotations);
if(isEnum) {
constructorParameters = constructorParameters.subList(2, constructorParameters.size());
}
if(isInnerClass){
constructorParameters = constructorParameters.subList(1, constructorParameters.size());
}
ImmutableSet<ASTType> throwsTypes = getTypes(constructor.getExceptionTypes());
return new ASTClassConstructor(getAnnotations(constructor), constructor, constructorParameters, modifier, throwsTypes);
} | java | public ASTConstructor getConstructor(Constructor constructor, boolean isEnum, boolean isInnerClass) {
ASTAccessModifier modifier = ASTAccessModifier.getModifier(constructor.getModifiers());
Annotation[][] parameterAnnotations = constructor.getParameterAnnotations();
if(constructor.getDeclaringClass().getEnclosingClass() != null && !Modifier.isStatic(constructor.getDeclaringClass().getModifiers())){
// An inner class constructor contains a hidden non-annotated prameter
Annotation[][] paddedParameterAnnotations = new Annotation[parameterAnnotations.length + 1][];
paddedParameterAnnotations[0] = new Annotation[0];
System.arraycopy(parameterAnnotations, 0, paddedParameterAnnotations, 1, parameterAnnotations.length);
parameterAnnotations = paddedParameterAnnotations;
}
ImmutableList<ASTParameter> constructorParameters = getParameters(constructor.getParameterTypes(), constructor.getGenericParameterTypes(), parameterAnnotations);
if(isEnum) {
constructorParameters = constructorParameters.subList(2, constructorParameters.size());
}
if(isInnerClass){
constructorParameters = constructorParameters.subList(1, constructorParameters.size());
}
ImmutableSet<ASTType> throwsTypes = getTypes(constructor.getExceptionTypes());
return new ASTClassConstructor(getAnnotations(constructor), constructor, constructorParameters, modifier, throwsTypes);
} | [
"public",
"ASTConstructor",
"getConstructor",
"(",
"Constructor",
"constructor",
",",
"boolean",
"isEnum",
",",
"boolean",
"isInnerClass",
")",
"{",
"ASTAccessModifier",
"modifier",
"=",
"ASTAccessModifier",
".",
"getModifier",
"(",
"constructor",
".",
"getModifiers",
... | Build an AST Constructor from the given constructor
@param constructor
@return AST Constructor | [
"Build",
"an",
"AST",
"Constructor",
"from",
"the",
"given",
"constructor"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java#L248-L273 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNotPrimitiveType | public static void assertNotPrimitiveType(final Field field, Class<? extends Annotation> annotation)
{
if (field.getType().isPrimitive())
{
throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation);
}
} | java | public static void assertNotPrimitiveType(final Field field, Class<? extends Annotation> annotation)
{
if (field.getType().isPrimitive())
{
throw annotation == null ? MESSAGES.fieldCannotBeOfPrimitiveOrVoidType(field) : MESSAGES.fieldCannotBeOfPrimitiveOrVoidType2(field, annotation);
}
} | [
"public",
"static",
"void",
"assertNotPrimitiveType",
"(",
"final",
"Field",
"field",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"field",
".",
"getType",
"(",
")",
".",
"isPrimitive",
"(",
")",
")",
"{",
"thr... | Asserts field is not of primitive type.
@param method to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"field",
"is",
"not",
"of",
"primitive",
"type",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L80-L86 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AGNES.java | AGNES.shrinkActiveSet | protected static int shrinkActiveSet(DBIDArrayIter ix, PointerHierarchyRepresentationBuilder builder, int end, int x) {
if(x == end - 1) { // Can truncate active set.
while(builder.isLinked(ix.seek(--end - 1))) {
// Everything happens in while condition already.
}
}
return end;
} | java | protected static int shrinkActiveSet(DBIDArrayIter ix, PointerHierarchyRepresentationBuilder builder, int end, int x) {
if(x == end - 1) { // Can truncate active set.
while(builder.isLinked(ix.seek(--end - 1))) {
// Everything happens in while condition already.
}
}
return end;
} | [
"protected",
"static",
"int",
"shrinkActiveSet",
"(",
"DBIDArrayIter",
"ix",
",",
"PointerHierarchyRepresentationBuilder",
"builder",
",",
"int",
"end",
",",
"int",
"x",
")",
"{",
"if",
"(",
"x",
"==",
"end",
"-",
"1",
")",
"{",
"// Can truncate active set.",
... | Shrink the active set: if the last x objects are all merged, we can reduce
the working size accordingly.
@param ix Object iterator
@param builder Builder to detect merged status
@param end Current active set size
@param x Last merged object
@return New active set size | [
"Shrink",
"the",
"active",
"set",
":",
"if",
"the",
"last",
"x",
"objects",
"are",
"all",
"merged",
"we",
"can",
"reduce",
"the",
"working",
"size",
"accordingly",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/AGNES.java#L177-L184 |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServerBootCmdFactory.java | ManagedServerBootCmdFactory.resolveDirectoryGrouping | private static DirectoryGrouping resolveDirectoryGrouping(final ModelNode model, final ExpressionResolver expressionResolver) {
try {
return DirectoryGrouping.forName(HostResourceDefinition.DIRECTORY_GROUPING.resolveModelAttribute(expressionResolver, model).asString());
} catch (OperationFailedException e) {
throw new IllegalStateException(e);
}
} | java | private static DirectoryGrouping resolveDirectoryGrouping(final ModelNode model, final ExpressionResolver expressionResolver) {
try {
return DirectoryGrouping.forName(HostResourceDefinition.DIRECTORY_GROUPING.resolveModelAttribute(expressionResolver, model).asString());
} catch (OperationFailedException e) {
throw new IllegalStateException(e);
}
} | [
"private",
"static",
"DirectoryGrouping",
"resolveDirectoryGrouping",
"(",
"final",
"ModelNode",
"model",
",",
"final",
"ExpressionResolver",
"expressionResolver",
")",
"{",
"try",
"{",
"return",
"DirectoryGrouping",
".",
"forName",
"(",
"HostResourceDefinition",
".",
"... | Returns the value of found in the model.
@param model the model that contains the key and value.
@param expressionResolver the expression resolver to use to resolve expressions
@return the directory grouping found in the model.
@throws IllegalArgumentException if the {@link org.jboss.as.controller.descriptions.ModelDescriptionConstants#DIRECTORY_GROUPING directory grouping}
was not found in the model. | [
"Returns",
"the",
"value",
"of",
"found",
"in",
"the",
"model",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServerBootCmdFactory.java#L238-L244 |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.setDnsNegativeCachePolicy | public static void setDnsNegativeCachePolicy(int negativeCacheSeconds) {
try {
InetAddressCacheUtil.setDnsNegativeCachePolicy(negativeCacheSeconds);
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to setDnsNegativeCachePolicy, cause: " + e.toString(), e);
}
} | java | public static void setDnsNegativeCachePolicy(int negativeCacheSeconds) {
try {
InetAddressCacheUtil.setDnsNegativeCachePolicy(negativeCacheSeconds);
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to setDnsNegativeCachePolicy, cause: " + e.toString(), e);
}
} | [
"public",
"static",
"void",
"setDnsNegativeCachePolicy",
"(",
"int",
"negativeCacheSeconds",
")",
"{",
"try",
"{",
"InetAddressCacheUtil",
".",
"setDnsNegativeCachePolicy",
"(",
"negativeCacheSeconds",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw"... | Set JVM DNS negative cache policy
@param negativeCacheSeconds set default dns cache time. Special input case:
<ul>
<li> {@code -1} means never expired.(In effect, all negative value)</li>
<li> {@code 0} never cached.</li>
</ul>
@throws DnsCacheManipulatorException Operation fail
@since 1.3.0 | [
"Set",
"JVM",
"DNS",
"negative",
"cache",
"policy"
] | train | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L286-L292 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java | SVGUtil.svgLine | public static Element svgLine(Document document, double x1, double y1, double x2, double y2) {
Element line = SVGUtil.svgElement(document, SVGConstants.SVG_LINE_TAG);
SVGUtil.setAtt(line, SVGConstants.SVG_X1_ATTRIBUTE, x1);
SVGUtil.setAtt(line, SVGConstants.SVG_Y1_ATTRIBUTE, y1);
SVGUtil.setAtt(line, SVGConstants.SVG_X2_ATTRIBUTE, x2);
SVGUtil.setAtt(line, SVGConstants.SVG_Y2_ATTRIBUTE, y2);
return line;
} | java | public static Element svgLine(Document document, double x1, double y1, double x2, double y2) {
Element line = SVGUtil.svgElement(document, SVGConstants.SVG_LINE_TAG);
SVGUtil.setAtt(line, SVGConstants.SVG_X1_ATTRIBUTE, x1);
SVGUtil.setAtt(line, SVGConstants.SVG_Y1_ATTRIBUTE, y1);
SVGUtil.setAtt(line, SVGConstants.SVG_X2_ATTRIBUTE, x2);
SVGUtil.setAtt(line, SVGConstants.SVG_Y2_ATTRIBUTE, y2);
return line;
} | [
"public",
"static",
"Element",
"svgLine",
"(",
"Document",
"document",
",",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
")",
"{",
"Element",
"line",
"=",
"SVGUtil",
".",
"svgElement",
"(",
"document",
",",
"SVGConstants",... | Create a SVG line element. Do not confuse this with path elements.
@param document document to create in (factory)
@param x1 first point x
@param y1 first point y
@param x2 second point x
@param y2 second point y
@return new element | [
"Create",
"a",
"SVG",
"line",
"element",
".",
"Do",
"not",
"confuse",
"this",
"with",
"path",
"elements",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L464-L471 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java | AbstractTriangle3F.getGroundHeight | public double getGroundHeight(Point2D point, CoordinateSystem3D system) {
return getGroundHeight(point.getX(), point.getY(), system);
} | java | public double getGroundHeight(Point2D point, CoordinateSystem3D system) {
return getGroundHeight(point.getX(), point.getY(), system);
} | [
"public",
"double",
"getGroundHeight",
"(",
"Point2D",
"point",
",",
"CoordinateSystem3D",
"system",
")",
"{",
"return",
"getGroundHeight",
"(",
"point",
".",
"getX",
"(",
")",
",",
"point",
".",
"getY",
"(",
")",
",",
"system",
")",
";",
"}"
] | Replies the height of the projection on the triangle that is representing a ground.
<p>
Assuming that the triangle is representing a face of a terrain/ground,
this function compute the height of the ground just below the given position.
The input of this function is the coordinate of a point on the horizontal plane.
@param point is the point to project on the triangle.
@param system is the coordinate system to use for determining the up coordinate.
@return the height of the face at the given coordinate. | [
"Replies",
"the",
"height",
"of",
"the",
"projection",
"on",
"the",
"triangle",
"that",
"is",
"representing",
"a",
"ground",
".",
"<p",
">",
"Assuming",
"that",
"the",
"triangle",
"is",
"representing",
"a",
"face",
"of",
"a",
"terrain",
"/",
"ground",
"thi... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractTriangle3F.java#L2187-L2189 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.checkFormalTypeParameters | private static int checkFormalTypeParameters(final String signature, int pos) {
// FormalTypeParameters:
// < FormalTypeParameter+ >
pos = checkChar('<', signature, pos);
pos = checkFormalTypeParameter(signature, pos);
while (getChar(signature, pos) != '>') {
pos = checkFormalTypeParameter(signature, pos);
}
return pos + 1;
} | java | private static int checkFormalTypeParameters(final String signature, int pos) {
// FormalTypeParameters:
// < FormalTypeParameter+ >
pos = checkChar('<', signature, pos);
pos = checkFormalTypeParameter(signature, pos);
while (getChar(signature, pos) != '>') {
pos = checkFormalTypeParameter(signature, pos);
}
return pos + 1;
} | [
"private",
"static",
"int",
"checkFormalTypeParameters",
"(",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"// FormalTypeParameters:",
"// < FormalTypeParameter+ >",
"pos",
"=",
"checkChar",
"(",
"'",
"'",
",",
"signature",
",",
"pos",
")",
";",
... | Checks the formal type parameters of a class or method signature.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first character after the checked part. | [
"Checks",
"the",
"formal",
"type",
"parameters",
"of",
"a",
"class",
"or",
"method",
"signature",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L775-L785 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_payWithRegisteredPaymentMean_POST | public void order_orderId_payWithRegisteredPaymentMean_POST(Long orderId, OvhReusablePaymentMeanEnum paymentMean, Long paymentMeanId) throws IOException {
String qPath = "/me/order/{orderId}/payWithRegisteredPaymentMean";
StringBuilder sb = path(qPath, orderId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "paymentMean", paymentMean);
addBody(o, "paymentMeanId", paymentMeanId);
exec(qPath, "POST", sb.toString(), o);
} | java | public void order_orderId_payWithRegisteredPaymentMean_POST(Long orderId, OvhReusablePaymentMeanEnum paymentMean, Long paymentMeanId) throws IOException {
String qPath = "/me/order/{orderId}/payWithRegisteredPaymentMean";
StringBuilder sb = path(qPath, orderId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "paymentMean", paymentMean);
addBody(o, "paymentMeanId", paymentMeanId);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"order_orderId_payWithRegisteredPaymentMean_POST",
"(",
"Long",
"orderId",
",",
"OvhReusablePaymentMeanEnum",
"paymentMean",
",",
"Long",
"paymentMeanId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/payWithRegisteredPaymen... | Pay with an already registered payment mean
REST: POST /me/order/{orderId}/payWithRegisteredPaymentMean
@param paymentMean [required] The registered payment mean you want to use
@param paymentMeanId [required] Id of registered payment mean, mandatory for bankAccount, creditCard and paypal
@param orderId [required] | [
"Pay",
"with",
"an",
"already",
"registered",
"payment",
"mean"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1912-L1919 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/internal/JsonPolicyWriter.java | JsonPolicyWriter.writeJsonArray | private void writeJsonArray(String arrayName, List<String> values)
throws JsonGenerationException, IOException {
writeJsonArrayStart(arrayName);
for (String value : values)
generator.writeString(value);
writeJsonArrayEnd();
} | java | private void writeJsonArray(String arrayName, List<String> values)
throws JsonGenerationException, IOException {
writeJsonArrayStart(arrayName);
for (String value : values)
generator.writeString(value);
writeJsonArrayEnd();
} | [
"private",
"void",
"writeJsonArray",
"(",
"String",
"arrayName",
",",
"List",
"<",
"String",
">",
"values",
")",
"throws",
"JsonGenerationException",
",",
"IOException",
"{",
"writeJsonArrayStart",
"(",
"arrayName",
")",
";",
"for",
"(",
"String",
"value",
":",
... | Writes an array along with its values to the JSONGenerator.
@param arrayName
name of the JSON array.
@param values
values of the JSON array. | [
"Writes",
"an",
"array",
"along",
"with",
"its",
"values",
"to",
"the",
"JSONGenerator",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/internal/JsonPolicyWriter.java#L353-L359 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/ProtoUtils.java | ProtoUtils.createProto | static SoyExpression createProto(
ProtoInitNode node,
Function<ExprNode, SoyExpression> compilerFunction,
Supplier<? extends ExpressionDetacher> detacher,
TemplateVariableManager varManager) {
return new ProtoInitGenerator(node, compilerFunction, detacher, varManager).generate();
} | java | static SoyExpression createProto(
ProtoInitNode node,
Function<ExprNode, SoyExpression> compilerFunction,
Supplier<? extends ExpressionDetacher> detacher,
TemplateVariableManager varManager) {
return new ProtoInitGenerator(node, compilerFunction, detacher, varManager).generate();
} | [
"static",
"SoyExpression",
"createProto",
"(",
"ProtoInitNode",
"node",
",",
"Function",
"<",
"ExprNode",
",",
"SoyExpression",
">",
"compilerFunction",
",",
"Supplier",
"<",
"?",
"extends",
"ExpressionDetacher",
">",
"detacher",
",",
"TemplateVariableManager",
"varMa... | Returns a {@link SoyExpression} for initializing a new proto.
@param node The proto initialization node
@param args Args for the proto initialization call
@param varManager Local variables manager | [
"Returns",
"a",
"{",
"@link",
"SoyExpression",
"}",
"for",
"initializing",
"a",
"new",
"proto",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ProtoUtils.java#L553-L559 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/TokenCachingStrategy.java | TokenCachingStrategy.putExpirationDate | public static void putExpirationDate(Bundle bundle, Date value) {
Validate.notNull(bundle, "bundle");
Validate.notNull(value, "value");
putDate(bundle, EXPIRATION_DATE_KEY, value);
} | java | public static void putExpirationDate(Bundle bundle, Date value) {
Validate.notNull(bundle, "bundle");
Validate.notNull(value, "value");
putDate(bundle, EXPIRATION_DATE_KEY, value);
} | [
"public",
"static",
"void",
"putExpirationDate",
"(",
"Bundle",
"bundle",
",",
"Date",
"value",
")",
"{",
"Validate",
".",
"notNull",
"(",
"bundle",
",",
"\"bundle\"",
")",
";",
"Validate",
".",
"notNull",
"(",
"value",
",",
"\"value\"",
")",
";",
"putDate... | Puts the expiration date into a Bundle.
@param bundle
A Bundle in which the expiration date should be stored.
@param value
The Date representing the expiration date.
@throws NullPointerException if the passed in Bundle or date value are null | [
"Puts",
"the",
"expiration",
"date",
"into",
"a",
"Bundle",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/TokenCachingStrategy.java#L200-L204 |
cchantep/acolyte | jdbc-driver/src/main/java/acolyte/jdbc/PreparedStatement.java | PreparedStatement.setObject | public void setObject(final int parameterIndex,
final Object x) throws SQLException {
if (x == null) {
if ("true".equals(connection.getProperties().
get("acolyte.parameter.untypedNull"))) {
// Fallback to String-VARCHAR
setObject(parameterIndex, null, Types.VARCHAR);
return;
} // end of if
throw new SQLException("Cannot set parameter from null object");
} // end of if
// ---
final String className = normalizeClassName(x.getClass());
if (!Defaults.jdbcTypeClasses.containsKey(className)) {
throw new SQLFeatureNotSupportedException("Unsupported parameter type: " + className);
} // end of if
// ---
final int sqlType = Defaults.jdbcTypeClasses.get(className);
setObject(parameterIndex, x, sqlType);
} | java | public void setObject(final int parameterIndex,
final Object x) throws SQLException {
if (x == null) {
if ("true".equals(connection.getProperties().
get("acolyte.parameter.untypedNull"))) {
// Fallback to String-VARCHAR
setObject(parameterIndex, null, Types.VARCHAR);
return;
} // end of if
throw new SQLException("Cannot set parameter from null object");
} // end of if
// ---
final String className = normalizeClassName(x.getClass());
if (!Defaults.jdbcTypeClasses.containsKey(className)) {
throw new SQLFeatureNotSupportedException("Unsupported parameter type: " + className);
} // end of if
// ---
final int sqlType = Defaults.jdbcTypeClasses.get(className);
setObject(parameterIndex, x, sqlType);
} | [
"public",
"void",
"setObject",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"Object",
"x",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"x",
"==",
"null",
")",
"{",
"if",
"(",
"\"true\"",
".",
"equals",
"(",
"connection",
".",
"getProperties",
... | {@inheritDoc}
Cannot be used with null parameter |x|.
@see #setObject(int,Object,int) | [
"{"
] | train | https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-driver/src/main/java/acolyte/jdbc/PreparedStatement.java#L501-L530 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java | WebUtilities.isAncestor | public static boolean isAncestor(final WComponent component1, final WComponent component2) {
for (WComponent parent = component2.getParent(); parent != null; parent = parent.getParent()) {
if (parent == component1) {
return true;
}
}
return false;
} | java | public static boolean isAncestor(final WComponent component1, final WComponent component2) {
for (WComponent parent = component2.getParent(); parent != null; parent = parent.getParent()) {
if (parent == component1) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isAncestor",
"(",
"final",
"WComponent",
"component1",
",",
"final",
"WComponent",
"component2",
")",
"{",
"for",
"(",
"WComponent",
"parent",
"=",
"component2",
".",
"getParent",
"(",
")",
";",
"parent",
"!=",
"null",
";",
"p... | Indicates whether a component is an ancestor of another.
@param component1 a possible ancestor.
@param component2 the component to check.
@return true if <code>component1</code> is an ancestor of <code>component2</code>, false otherwise. | [
"Indicates",
"whether",
"a",
"component",
"is",
"an",
"ancestor",
"of",
"another",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java#L574-L582 |
threerings/nenya | core/src/main/java/com/threerings/media/image/ImageManager.java | ImageManager.getPreparedImage | public BufferedImage getPreparedImage (String rset, String path)
{
return getPreparedImage(rset, path, null);
} | java | public BufferedImage getPreparedImage (String rset, String path)
{
return getPreparedImage(rset, path, null);
} | [
"public",
"BufferedImage",
"getPreparedImage",
"(",
"String",
"rset",
",",
"String",
"path",
")",
"{",
"return",
"getPreparedImage",
"(",
"rset",
",",
"path",
",",
"null",
")",
";",
"}"
] | Loads (and caches) the specified image from the resource manager, obtaining the image from
the supplied resource set.
<p> Additionally the image is optimized for display in the current graphics
configuration. Consider using {@link #getMirage(ImageKey)} instead of prepared images as
they (some day) will automatically use volatile images to increase performance. | [
"Loads",
"(",
"and",
"caches",
")",
"the",
"specified",
"image",
"from",
"the",
"resource",
"manager",
"obtaining",
"the",
"image",
"from",
"the",
"supplied",
"resource",
"set",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L230-L233 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/result/impl/DefaultAsyncSearchQueryResult.java | DefaultAsyncSearchQueryResult.fromHttp412 | @Deprecated
public static AsyncSearchQueryResult fromHttp412() {
//dummy default values
SearchStatus status = new DefaultSearchStatus(1L, 1L, 0L);
SearchMetrics metrics = new DefaultSearchMetrics(0L, 0L, 0d);
return new DefaultAsyncSearchQueryResult(
status,
Observable.<SearchQueryRow>error(new FtsConsistencyTimeoutException()),
Observable.<FacetResult>empty(),
Observable.just(metrics)
);
} | java | @Deprecated
public static AsyncSearchQueryResult fromHttp412() {
//dummy default values
SearchStatus status = new DefaultSearchStatus(1L, 1L, 0L);
SearchMetrics metrics = new DefaultSearchMetrics(0L, 0L, 0d);
return new DefaultAsyncSearchQueryResult(
status,
Observable.<SearchQueryRow>error(new FtsConsistencyTimeoutException()),
Observable.<FacetResult>empty(),
Observable.just(metrics)
);
} | [
"@",
"Deprecated",
"public",
"static",
"AsyncSearchQueryResult",
"fromHttp412",
"(",
")",
"{",
"//dummy default values",
"SearchStatus",
"status",
"=",
"new",
"DefaultSearchStatus",
"(",
"1L",
",",
"1L",
",",
"0L",
")",
";",
"SearchMetrics",
"metrics",
"=",
"new",... | A utility method to convert an HTTP 412 response from the search service into a proper
{@link AsyncSearchQueryResult}. HTTP 412 indicates the request couldn't be satisfied with given
consistency before the timeout expired. This is translated to a {@link FtsConsistencyTimeoutException}.
@return an {@link AsyncSearchQueryResult} that will emit a {@link FtsConsistencyTimeoutException} when calling
its {@link AsyncSearchQueryResult#hits() hits()} method.
@deprecated FTS is still in BETA so the response format is likely to change in a future version, and be
unified with the HTTP 200 response format. | [
"A",
"utility",
"method",
"to",
"convert",
"an",
"HTTP",
"412",
"response",
"from",
"the",
"search",
"service",
"into",
"a",
"proper",
"{",
"@link",
"AsyncSearchQueryResult",
"}",
".",
"HTTP",
"412",
"indicates",
"the",
"request",
"couldn",
"t",
"be",
"satis... | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/result/impl/DefaultAsyncSearchQueryResult.java#L287-L300 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java | DrizzlePreparedStatement.setBlob | public void setBlob(final int parameterIndex, final InputStream inputStream) throws SQLException {
if(inputStream == null) {
setNull(parameterIndex, Types.BLOB);
return;
}
try {
if(getProtocol().supportsPBMS()) {
setParameter(parameterIndex,
new BlobStreamingParameter(inputStream, getProtocol().getHost(), "9090", getProtocol().getDatabase()));
} else {
setParameter(parameterIndex, new BufferedStreamParameter(inputStream));
}
} catch (IOException e) {
throw SQLExceptionMapper.getSQLException("Could not read stream");
}
} | java | public void setBlob(final int parameterIndex, final InputStream inputStream) throws SQLException {
if(inputStream == null) {
setNull(parameterIndex, Types.BLOB);
return;
}
try {
if(getProtocol().supportsPBMS()) {
setParameter(parameterIndex,
new BlobStreamingParameter(inputStream, getProtocol().getHost(), "9090", getProtocol().getDatabase()));
} else {
setParameter(parameterIndex, new BufferedStreamParameter(inputStream));
}
} catch (IOException e) {
throw SQLExceptionMapper.getSQLException("Could not read stream");
}
} | [
"public",
"void",
"setBlob",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"InputStream",
"inputStream",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"inputStream",
"==",
"null",
")",
"{",
"setNull",
"(",
"parameterIndex",
",",
"Types",
".",
"BLOB",
... | Sets the designated parameter to a <code>InputStream</code> object. This method differs from the
<code>setBinaryStream (int, InputStream)</code> method because it informs the driver that the parameter value
should be sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, the
driver may have to do extra work to determine whether the parameter data should be sent to the server as a
<code>LONGVARBINARY</code> or a <code>BLOB</code>
<p/>
<P><B>Note:</B> Consult your JDBC driver documentation to determine if it might be more efficient to use a
version of <code>setBlob</code> which takes a length parameter.
@param parameterIndex index of the first parameter is 1, the second is 2, ...
@param inputStream An object that contains the data to set the parameter value to.
@throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement;
if a database access error occurs; this method is called on a closed
<code>PreparedStatement</code> or if parameterIndex does not correspond to a
parameter marker in the SQL statement,
@throws java.sql.SQLFeatureNotSupportedException
if the JDBC driver does not support this method
@since 1.6 | [
"Sets",
"the",
"designated",
"parameter",
"to",
"a",
"<code",
">",
"InputStream<",
"/",
"code",
">",
"object",
".",
"This",
"method",
"differs",
"from",
"the",
"<code",
">",
"setBinaryStream",
"(",
"int",
"InputStream",
")",
"<",
"/",
"code",
">",
"method"... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L1007-L1026 |
tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/DeviceClass.java | DeviceClass.export_device | protected void export_device(final DeviceImpl dev, final String name) throws DevFailed {
Util.out4.println("DeviceClass::export_device() arrived");
Util.out4.println("name = " + name);
//
// For server started without db usage (Mostly the database server). In
// this case,
// it is necessary to create our own CORBA object id and to bind it into
// the
// OOC Boot Manager for access through a stringified object reference
// constructed using the corbaloc style
//
final byte[] oid = name.getBytes();
final Util tg = Util.instance();
try {
final org.omg.PortableServer.POA r_poa = tg.get_poa();
r_poa.activate_object_with_id(oid, dev);
} catch (final Exception ex) {
final StringBuffer o = new StringBuffer("Can't activate device for device ");
o.append(dev.get_name());
Except.throw_exception("API_CantBindDevice", o.toString(),
"DeviceClass.export_device()");
}
//
// Get the object id and store it
//
final ORB orb = tg.get_orb();
dev._this(orb);
dev.set_obj_id(oid);
tg.registerDeviceForJacorb(name);
//
// Mark the device as exported
//
dev.set_exported_flag(true);
Util.out4.println("Leaving DeviceClass::export_device method()");
} | java | protected void export_device(final DeviceImpl dev, final String name) throws DevFailed {
Util.out4.println("DeviceClass::export_device() arrived");
Util.out4.println("name = " + name);
//
// For server started without db usage (Mostly the database server). In
// this case,
// it is necessary to create our own CORBA object id and to bind it into
// the
// OOC Boot Manager for access through a stringified object reference
// constructed using the corbaloc style
//
final byte[] oid = name.getBytes();
final Util tg = Util.instance();
try {
final org.omg.PortableServer.POA r_poa = tg.get_poa();
r_poa.activate_object_with_id(oid, dev);
} catch (final Exception ex) {
final StringBuffer o = new StringBuffer("Can't activate device for device ");
o.append(dev.get_name());
Except.throw_exception("API_CantBindDevice", o.toString(),
"DeviceClass.export_device()");
}
//
// Get the object id and store it
//
final ORB orb = tg.get_orb();
dev._this(orb);
dev.set_obj_id(oid);
tg.registerDeviceForJacorb(name);
//
// Mark the device as exported
//
dev.set_exported_flag(true);
Util.out4.println("Leaving DeviceClass::export_device method()");
} | [
"protected",
"void",
"export_device",
"(",
"final",
"DeviceImpl",
"dev",
",",
"final",
"String",
"name",
")",
"throws",
"DevFailed",
"{",
"Util",
".",
"out4",
".",
"println",
"(",
"\"DeviceClass::export_device() arrived\"",
")",
";",
"Util",
".",
"out4",
".",
... | Export a device.
<p>
This method activate the CORBA object associated with the servant dev. It
is used for device where a CORBALOC string is used to connect with. This
method is mainly used for the Tango database server.
@param dev The device to be exported
@param name The device CORBALOC name
@throws DevFailed If the command sent to the database failed. Click <a
href="../../tango_basic/idl_html/Tango.html#DevFailed"
>here</a> to read <b>DevFailed</b> exception specification | [
"Export",
"a",
"device",
".",
"<p",
">",
"This",
"method",
"activate",
"the",
"CORBA",
"object",
"associated",
"with",
"the",
"servant",
"dev",
".",
"It",
"is",
"used",
"for",
"device",
"where",
"a",
"CORBALOC",
"string",
"is",
"used",
"to",
"connect",
"... | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/DeviceClass.java#L277-L319 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java | JsHdrsImpl.getForwardRoutingPath | public final List<SIDestinationAddress> getForwardRoutingPath() {
List<String> fNames = (List<String>) getHdr2().getField(JsHdr2Access.FORWARDROUTINGPATH_DESTINATIONNAME);
List<byte[]> fMEs = (List<byte[]>) getHdr2().getField(JsHdr2Access.FORWARDROUTINGPATH_MEID);
byte[] fLos = (byte[]) getHdr2().getField(JsHdr2Access.FORWARDROUTINGPATHLOCALONLY);
List<String> fBuses = (List<String>) getHdr2().getField(JsHdr2Access.FORWARDROUTINGPATH_BUSNAME);
return new RoutingPathList(fNames, fLos, fMEs, fBuses);
} | java | public final List<SIDestinationAddress> getForwardRoutingPath() {
List<String> fNames = (List<String>) getHdr2().getField(JsHdr2Access.FORWARDROUTINGPATH_DESTINATIONNAME);
List<byte[]> fMEs = (List<byte[]>) getHdr2().getField(JsHdr2Access.FORWARDROUTINGPATH_MEID);
byte[] fLos = (byte[]) getHdr2().getField(JsHdr2Access.FORWARDROUTINGPATHLOCALONLY);
List<String> fBuses = (List<String>) getHdr2().getField(JsHdr2Access.FORWARDROUTINGPATH_BUSNAME);
return new RoutingPathList(fNames, fLos, fMEs, fBuses);
} | [
"public",
"final",
"List",
"<",
"SIDestinationAddress",
">",
"getForwardRoutingPath",
"(",
")",
"{",
"List",
"<",
"String",
">",
"fNames",
"=",
"(",
"List",
"<",
"String",
">",
")",
"getHdr2",
"(",
")",
".",
"getField",
"(",
"JsHdr2Access",
".",
"FORWARDRO... | /*
Get the contents of the ForwardRoutingPath field from the message header.
The List returned is a copy of the header field, so no updates to it
affect the Message header itself.
Javadoc description supplied by SIBusMessage interface. | [
"/",
"*",
"Get",
"the",
"contents",
"of",
"the",
"ForwardRoutingPath",
"field",
"from",
"the",
"message",
"header",
".",
"The",
"List",
"returned",
"is",
"a",
"copy",
"of",
"the",
"header",
"field",
"so",
"no",
"updates",
"to",
"it",
"affect",
"the",
"Me... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java#L418-L424 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java | Window.removeListener | public void removeListener(WindowListener<K,R,P> listener) {
this.listeners.remove(new UnwrappedWeakReference<WindowListener<K,R,P>>(listener));
} | java | public void removeListener(WindowListener<K,R,P> listener) {
this.listeners.remove(new UnwrappedWeakReference<WindowListener<K,R,P>>(listener));
} | [
"public",
"void",
"removeListener",
"(",
"WindowListener",
"<",
"K",
",",
"R",
",",
"P",
">",
"listener",
")",
"{",
"this",
".",
"listeners",
".",
"remove",
"(",
"new",
"UnwrappedWeakReference",
"<",
"WindowListener",
"<",
"K",
",",
"R",
",",
"P",
">",
... | Removes a WindowListener if it is present.
@param listener The listener to remove | [
"Removes",
"a",
"WindowListener",
"if",
"it",
"is",
"present",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L214-L216 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.getServerFarmSkus | public Object getServerFarmSkus(String resourceGroupName, String name) {
return getServerFarmSkusWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public Object getServerFarmSkus(String resourceGroupName, String name) {
return getServerFarmSkusWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"Object",
"getServerFarmSkus",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"getServerFarmSkusWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
"... | Gets all selectable sku's for a given App Service Plan.
Gets all selectable sku's for a given App Service Plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of App Service Plan
@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 Object object if successful. | [
"Gets",
"all",
"selectable",
"sku",
"s",
"for",
"a",
"given",
"App",
"Service",
"Plan",
".",
"Gets",
"all",
"selectable",
"sku",
"s",
"for",
"a",
"given",
"App",
"Service",
"Plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L2639-L2641 |
stagemonitor/stagemonitor | stagemonitor-core/src/main/java/org/stagemonitor/core/StagemonitorCoreConfigurationSourceInitializer.java | StagemonitorCoreConfigurationSourceInitializer.addRemotePropertiesConfigurationSources | private void addRemotePropertiesConfigurationSources(ConfigurationRegistry configuration, CorePlugin corePlugin) {
final List<URL> configurationUrls = corePlugin.getRemotePropertiesConfigUrls();
if (corePlugin.isDeactivateStagemonitorIfRemotePropertyServerIsDown()) {
assertRemotePropertiesServerIsAvailable(configurationUrls.get(0));
}
logger.debug("Loading RemotePropertiesConfigurationSources with: configurationUrls = " + configurationUrls);
final HttpClient sharedHttpClient = new HttpClient();
for (URL configUrl : configurationUrls) {
final RemotePropertiesConfigurationSource source = new RemotePropertiesConfigurationSource(
sharedHttpClient,
configUrl);
configuration.addConfigurationSourceAfter(source, SimpleSource.class);
}
configuration.reloadAllConfigurationOptions();
} | java | private void addRemotePropertiesConfigurationSources(ConfigurationRegistry configuration, CorePlugin corePlugin) {
final List<URL> configurationUrls = corePlugin.getRemotePropertiesConfigUrls();
if (corePlugin.isDeactivateStagemonitorIfRemotePropertyServerIsDown()) {
assertRemotePropertiesServerIsAvailable(configurationUrls.get(0));
}
logger.debug("Loading RemotePropertiesConfigurationSources with: configurationUrls = " + configurationUrls);
final HttpClient sharedHttpClient = new HttpClient();
for (URL configUrl : configurationUrls) {
final RemotePropertiesConfigurationSource source = new RemotePropertiesConfigurationSource(
sharedHttpClient,
configUrl);
configuration.addConfigurationSourceAfter(source, SimpleSource.class);
}
configuration.reloadAllConfigurationOptions();
} | [
"private",
"void",
"addRemotePropertiesConfigurationSources",
"(",
"ConfigurationRegistry",
"configuration",
",",
"CorePlugin",
"corePlugin",
")",
"{",
"final",
"List",
"<",
"URL",
">",
"configurationUrls",
"=",
"corePlugin",
".",
"getRemotePropertiesConfigUrls",
"(",
")"... | Creates and registers a RemotePropertiesConfigurationSource for each configuration url | [
"Creates",
"and",
"registers",
"a",
"RemotePropertiesConfigurationSource",
"for",
"each",
"configuration",
"url"
] | train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-core/src/main/java/org/stagemonitor/core/StagemonitorCoreConfigurationSourceInitializer.java#L79-L95 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/JsonUtils.java | JsonUtils.fromJson | public static <T> T fromJson(String json, Class<T> clazz) {
Objects.requireNonNull(json, Required.JSON.toString());
Objects.requireNonNull(clazz, Required.CLASS.toString());
T object = null;
try {
object = mapper.readValue(json, clazz);
} catch (IOException e) {
LOG.error("Failed to convert json to object class", e);
}
return object;
} | java | public static <T> T fromJson(String json, Class<T> clazz) {
Objects.requireNonNull(json, Required.JSON.toString());
Objects.requireNonNull(clazz, Required.CLASS.toString());
T object = null;
try {
object = mapper.readValue(json, clazz);
} catch (IOException e) {
LOG.error("Failed to convert json to object class", e);
}
return object;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fromJson",
"(",
"String",
"json",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"json",
",",
"Required",
".",
"JSON",
".",
"toString",
"(",
")",
")",
";",
"Objects",
... | Converts a given Json string to given Class
@param json The json string to convert
@param clazz The Class to convert to
@param <T> JavaDoc wants this, just ignore it
@return The converted class or null if conversion fails | [
"Converts",
"a",
"given",
"Json",
"string",
"to",
"given",
"Class"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/JsonUtils.java#L98-L110 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Request.java | Request.newPostOpenGraphActionRequest | public static Request newPostOpenGraphActionRequest(Session session, OpenGraphAction openGraphAction,
Callback callback) {
if (openGraphAction == null) {
throw new FacebookException("openGraphAction cannot be null");
}
if (Utility.isNullOrEmpty(openGraphAction.getType())) {
throw new FacebookException("openGraphAction must have non-null 'type' property");
}
String path = String.format(MY_ACTION_FORMAT, openGraphAction.getType());
return newPostRequest(session, path, openGraphAction, callback);
} | java | public static Request newPostOpenGraphActionRequest(Session session, OpenGraphAction openGraphAction,
Callback callback) {
if (openGraphAction == null) {
throw new FacebookException("openGraphAction cannot be null");
}
if (Utility.isNullOrEmpty(openGraphAction.getType())) {
throw new FacebookException("openGraphAction must have non-null 'type' property");
}
String path = String.format(MY_ACTION_FORMAT, openGraphAction.getType());
return newPostRequest(session, path, openGraphAction, callback);
} | [
"public",
"static",
"Request",
"newPostOpenGraphActionRequest",
"(",
"Session",
"session",
",",
"OpenGraphAction",
"openGraphAction",
",",
"Callback",
"callback",
")",
"{",
"if",
"(",
"openGraphAction",
"==",
"null",
")",
"{",
"throw",
"new",
"FacebookException",
"(... | Creates a new Request configured to publish an Open Graph action.
@param session
the Session to use, or null; if non-null, the session must be in an opened state
@param openGraphAction
the Open Graph object to create; must not be null, and must have a non-empty 'type'
@param callback
a callback that will be called when the request is completed to handle success or error conditions
@return a Request that is ready to execute | [
"Creates",
"a",
"new",
"Request",
"configured",
"to",
"publish",
"an",
"Open",
"Graph",
"action",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L742-L753 |
apereo/cas | support/cas-server-support-saml-mdui-core/src/main/java/org/apereo/cas/support/saml/mdui/MetadataUIUtils.java | MetadataUIUtils.locateMetadataUserInterfaceForEntityId | public static SamlMetadataUIInfo locateMetadataUserInterfaceForEntityId(final MetadataResolverAdapter metadataAdapter,
final String entityId, final RegisteredService registeredService, final HttpServletRequest requestContext) {
val entityDescriptor = metadataAdapter.getEntityDescriptorForEntityId(entityId);
return locateMetadataUserInterfaceForEntityId(entityDescriptor, entityId, registeredService, requestContext);
} | java | public static SamlMetadataUIInfo locateMetadataUserInterfaceForEntityId(final MetadataResolverAdapter metadataAdapter,
final String entityId, final RegisteredService registeredService, final HttpServletRequest requestContext) {
val entityDescriptor = metadataAdapter.getEntityDescriptorForEntityId(entityId);
return locateMetadataUserInterfaceForEntityId(entityDescriptor, entityId, registeredService, requestContext);
} | [
"public",
"static",
"SamlMetadataUIInfo",
"locateMetadataUserInterfaceForEntityId",
"(",
"final",
"MetadataResolverAdapter",
"metadataAdapter",
",",
"final",
"String",
"entityId",
",",
"final",
"RegisteredService",
"registeredService",
",",
"final",
"HttpServletRequest",
"reque... | Locate MDUI for entity id simple metadata ui info.
@param metadataAdapter the metadata adapter
@param entityId the entity id
@param registeredService the registered service
@param requestContext the request context
@return the simple metadata ui info | [
"Locate",
"MDUI",
"for",
"entity",
"id",
"simple",
"metadata",
"ui",
"info",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-mdui-core/src/main/java/org/apereo/cas/support/saml/mdui/MetadataUIUtils.java#L66-L70 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DirectCompactDoublesSketch.java | DirectCompactDoublesSketch.checkDirectMemCapacity | static void checkDirectMemCapacity(final int k, final long n, final long memCapBytes) {
final int reqBufBytes = getCompactStorageBytes(k, n);
if (memCapBytes < reqBufBytes) {
throw new SketchesArgumentException("Possible corruption: Memory capacity too small: "
+ memCapBytes + " < " + reqBufBytes);
}
} | java | static void checkDirectMemCapacity(final int k, final long n, final long memCapBytes) {
final int reqBufBytes = getCompactStorageBytes(k, n);
if (memCapBytes < reqBufBytes) {
throw new SketchesArgumentException("Possible corruption: Memory capacity too small: "
+ memCapBytes + " < " + reqBufBytes);
}
} | [
"static",
"void",
"checkDirectMemCapacity",
"(",
"final",
"int",
"k",
",",
"final",
"long",
"n",
",",
"final",
"long",
"memCapBytes",
")",
"{",
"final",
"int",
"reqBufBytes",
"=",
"getCompactStorageBytes",
"(",
"k",
",",
"n",
")",
";",
"if",
"(",
"memCapBy... | Checks the validity of the direct memory capacity assuming n, k.
@param k the given value of k
@param n the given value of n
@param memCapBytes the current memory capacity in bytes | [
"Checks",
"the",
"validity",
"of",
"the",
"direct",
"memory",
"capacity",
"assuming",
"n",
"k",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DirectCompactDoublesSketch.java#L218-L225 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/publickey/SshKeyPairGenerator.java | SshKeyPairGenerator.generateKeyPair | public static SshKeyPair generateKeyPair(String algorithm, int bits)
throws IOException, SshException {
if (!SSH2_RSA.equalsIgnoreCase(algorithm)
&& !SSH2_DSA.equalsIgnoreCase(algorithm)) {
throw new IOException(algorithm
+ " is not a supported key algorithm!");
}
SshKeyPair pair = new SshKeyPair();
if (SSH2_RSA.equalsIgnoreCase(algorithm)) {
pair = ComponentManager.getInstance().generateRsaKeyPair(bits);
} else {
pair = ComponentManager.getInstance().generateDsaKeyPair(bits);
}
return pair;
} | java | public static SshKeyPair generateKeyPair(String algorithm, int bits)
throws IOException, SshException {
if (!SSH2_RSA.equalsIgnoreCase(algorithm)
&& !SSH2_DSA.equalsIgnoreCase(algorithm)) {
throw new IOException(algorithm
+ " is not a supported key algorithm!");
}
SshKeyPair pair = new SshKeyPair();
if (SSH2_RSA.equalsIgnoreCase(algorithm)) {
pair = ComponentManager.getInstance().generateRsaKeyPair(bits);
} else {
pair = ComponentManager.getInstance().generateDsaKeyPair(bits);
}
return pair;
} | [
"public",
"static",
"SshKeyPair",
"generateKeyPair",
"(",
"String",
"algorithm",
",",
"int",
"bits",
")",
"throws",
"IOException",
",",
"SshException",
"{",
"if",
"(",
"!",
"SSH2_RSA",
".",
"equalsIgnoreCase",
"(",
"algorithm",
")",
"&&",
"!",
"SSH2_DSA",
".",... | Generates a new key pair.
@param algorithm
@param bits
@return SshKeyPair
@throws IOException | [
"Generates",
"a",
"new",
"key",
"pair",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/publickey/SshKeyPairGenerator.java#L83-L101 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.