repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src/org/opencms/publish/CmsPublishManager.java | CmsPublishManager.getPublishList | public CmsPublishList getPublishList(
CmsObject cms,
CmsResource directPublishResource,
boolean directPublishSiblings) throws CmsException {
return m_securityManager.fillPublishList(
cms.getRequestContext(),
new CmsPublishList(directPublishResource, directPublishSiblings));
} | java | public CmsPublishList getPublishList(
CmsObject cms,
CmsResource directPublishResource,
boolean directPublishSiblings) throws CmsException {
return m_securityManager.fillPublishList(
cms.getRequestContext(),
new CmsPublishList(directPublishResource, directPublishSiblings));
} | [
"public",
"CmsPublishList",
"getPublishList",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"directPublishResource",
",",
"boolean",
"directPublishSiblings",
")",
"throws",
"CmsException",
"{",
"return",
"m_securityManager",
".",
"fillPublishList",
"(",
"cms",
".",
"getR... | Returns a publish list with all new/changed/deleted resources of the current (offline)
project that actually get published for a direct publish of a single resource.<p>
@param cms the cms request context
@param directPublishResource the resource which will be directly published
@param directPublishSiblings <code>true</code>, if all eventual siblings of the direct
published resource should also get published.
@return a publish list
@throws CmsException if something goes wrong | [
"Returns",
"a",
"publish",
"list",
"with",
"all",
"new",
"/",
"changed",
"/",
"deleted",
"resources",
"of",
"the",
"current",
"(",
"offline",
")",
"project",
"that",
"actually",
"get",
"published",
"for",
"a",
"direct",
"publish",
"of",
"a",
"single",
"res... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishManager.java#L305-L313 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/annotation/AuditAnnotationAttributes.java | AuditAnnotationAttributes.getAction | public String getAction(final Class<?> clazz, final Method method) {
final Annotation[] annotations = clazz.getAnnotations();
return this.getAction(annotations, method);
} | java | public String getAction(final Class<?> clazz, final Method method) {
final Annotation[] annotations = clazz.getAnnotations();
return this.getAction(annotations, method);
} | [
"public",
"String",
"getAction",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"Method",
"method",
")",
"{",
"final",
"Annotation",
"[",
"]",
"annotations",
"=",
"clazz",
".",
"getAnnotations",
"(",
")",
";",
"return",
"this",
".",
"getAct... | Gets the action.
@param clazz
the clazz
@param method
the method
@return the action | [
"Gets",
"the",
"action",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/annotation/AuditAnnotationAttributes.java#L119-L122 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.invokeOptionalSetter | public static void invokeOptionalSetter(Object object, String name, String value) throws Exception
{
String setterName = Strings.getMethodAccessor("set", name);
Class<?> clazz = object.getClass();
Method method = null;
try {
method = findMethod(clazz, setterName);
}
catch(NoSuchMethodException e) {
log.debug("Setter |%s| not found in class |%s| or its super hierarchy.", setterName, clazz);
return;
}
Class<?>[] parameterTypes = method.getParameterTypes();
if(parameterTypes.length != 1) {
log.debug("Setter |%s#%s(%s)| with invalid parameters number.", method.getDeclaringClass(), method.getName(), Strings.join(parameterTypes, ','));
return;
}
invoke(object, method, ConverterRegistry.getConverter().asObject((String)value, parameterTypes[0]));
} | java | public static void invokeOptionalSetter(Object object, String name, String value) throws Exception
{
String setterName = Strings.getMethodAccessor("set", name);
Class<?> clazz = object.getClass();
Method method = null;
try {
method = findMethod(clazz, setterName);
}
catch(NoSuchMethodException e) {
log.debug("Setter |%s| not found in class |%s| or its super hierarchy.", setterName, clazz);
return;
}
Class<?>[] parameterTypes = method.getParameterTypes();
if(parameterTypes.length != 1) {
log.debug("Setter |%s#%s(%s)| with invalid parameters number.", method.getDeclaringClass(), method.getName(), Strings.join(parameterTypes, ','));
return;
}
invoke(object, method, ConverterRegistry.getConverter().asObject((String)value, parameterTypes[0]));
} | [
"public",
"static",
"void",
"invokeOptionalSetter",
"(",
"Object",
"object",
",",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"Exception",
"{",
"String",
"setterName",
"=",
"Strings",
".",
"getMethodAccessor",
"(",
"\"set\"",
",",
"name",
")",
";"... | Variant for {@link #invokeSetter(Object, String, String)} but no exception if setter not found.
@param object object instance,
@param name setter name,
@param value value to set.
@throws Exception if invocation fail for whatever reason including method logic. | [
"Variant",
"for",
"{",
"@link",
"#invokeSetter",
"(",
"Object",
"String",
"String",
")",
"}",
"but",
"no",
"exception",
"if",
"setter",
"not",
"found",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L447-L467 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/event/BreadcrumbBuilder.java | BreadcrumbBuilder.withData | public BreadcrumbBuilder withData(String name, String value) {
if (this.data == null) {
this.data = new HashMap<>();
}
this.data.put(name, value);
return this;
} | java | public BreadcrumbBuilder withData(String name, String value) {
if (this.data == null) {
this.data = new HashMap<>();
}
this.data.put(name, value);
return this;
} | [
"public",
"BreadcrumbBuilder",
"withData",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"this",
".",
"data",
"==",
"null",
")",
"{",
"this",
".",
"data",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"this",
".",
"data",
"... | Adds to the related data for the {@link breadcrumb}.
@param name Name of the data
@param value Value of the data
@return current BreadcrumbBuilder | [
"Adds",
"to",
"the",
"related",
"data",
"for",
"the",
"{",
"@link",
"breadcrumb",
"}",
"."
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/event/BreadcrumbBuilder.java#L94-L101 |
google/closure-compiler | src/com/google/javascript/jscomp/CrossChunkMethodMotion.java | CrossChunkMethodMotion.createUnstubCall | private Node createUnstubCall(Node functionNode, int stubId) {
return astFactory
.createCall(
// We can't look up the type of the stub creating method, because we add its
// definition after type checking.
astFactory.createNameWithUnknownType(UNSTUB_METHOD_NAME),
astFactory.createNumber(stubId),
functionNode)
.useSourceInfoIfMissingFromForTree(functionNode);
} | java | private Node createUnstubCall(Node functionNode, int stubId) {
return astFactory
.createCall(
// We can't look up the type of the stub creating method, because we add its
// definition after type checking.
astFactory.createNameWithUnknownType(UNSTUB_METHOD_NAME),
astFactory.createNumber(stubId),
functionNode)
.useSourceInfoIfMissingFromForTree(functionNode);
} | [
"private",
"Node",
"createUnstubCall",
"(",
"Node",
"functionNode",
",",
"int",
"stubId",
")",
"{",
"return",
"astFactory",
".",
"createCall",
"(",
"// We can't look up the type of the stub creating method, because we add its",
"// definition after type checking.",
"astFactory",
... | Returns a new Node to be used as the stub definition for a method.
@param functionNode actual function definition to be attached. Must be detached now.
@param stubId ID to use for stubbing and unstubbing
@return a Node that looks like <code>JSCompiler_unstubMethod(0, function() {})</code> | [
"Returns",
"a",
"new",
"Node",
"to",
"be",
"used",
"as",
"the",
"stub",
"definition",
"for",
"a",
"method",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CrossChunkMethodMotion.java#L399-L408 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_fax_serviceName_settings_sendFax_POST | public OvhTask billingAccount_fax_serviceName_settings_sendFax_POST(String billingAccount, String serviceName, Date dateSchedule, String pdfUrl, String[] recipients) throws IOException {
String qPath = "/telephony/{billingAccount}/fax/{serviceName}/settings/sendFax";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dateSchedule", dateSchedule);
addBody(o, "pdfUrl", pdfUrl);
addBody(o, "recipients", recipients);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask billingAccount_fax_serviceName_settings_sendFax_POST(String billingAccount, String serviceName, Date dateSchedule, String pdfUrl, String[] recipients) throws IOException {
String qPath = "/telephony/{billingAccount}/fax/{serviceName}/settings/sendFax";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dateSchedule", dateSchedule);
addBody(o, "pdfUrl", pdfUrl);
addBody(o, "recipients", recipients);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"billingAccount_fax_serviceName_settings_sendFax_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Date",
"dateSchedule",
",",
"String",
"pdfUrl",
",",
"String",
"[",
"]",
"recipients",
")",
"throws",
"IOException",
"{",
... | Send a fax
REST: POST /telephony/{billingAccount}/fax/{serviceName}/settings/sendFax
@param recipients [required] List of recipients of your fax
@param pdfUrl [required] Url of the pdf document you want to send
@param dateSchedule [required] If you want to schedule your fax later, you can specify a date
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Send",
"a",
"fax"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4366-L4375 |
jhunters/jprotobuf | src/main/java/com/baidu/bjf/remoting/protobuf/code/ClassCode.java | ClassCode.addField | public void addField(String scope, String type, String name, String defaultValue) {
fields.put(name, new FieldCode(scope, name, type, defaultValue));
} | java | public void addField(String scope, String type, String name, String defaultValue) {
fields.put(name, new FieldCode(scope, name, type, defaultValue));
} | [
"public",
"void",
"addField",
"(",
"String",
"scope",
",",
"String",
"type",
",",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"fields",
".",
"put",
"(",
"name",
",",
"new",
"FieldCode",
"(",
"scope",
",",
"name",
",",
"type",
",",
"defau... | Adds the field.
@param scope the scope
@param type the type
@param name the name
@param defaultValue the default value | [
"Adds",
"the",
"field",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/code/ClassCode.java#L104-L106 |
phax/ph-oton | ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/AbstractWebPageForm.java | AbstractWebPageForm.createCreateToolbar | @Nonnull
@OverrideOnDemand
protected TOOLBAR_TYPE createCreateToolbar (@Nonnull final WPECTYPE aWPEC,
@Nonnull final FORM_TYPE aForm,
@Nullable final DATATYPE aSelectedObject)
{
final Locale aDisplayLocale = aWPEC.getDisplayLocale ();
final TOOLBAR_TYPE aToolbar = createNewCreateToolbar (aWPEC);
aToolbar.addHiddenField (CPageParam.PARAM_ACTION, CPageParam.ACTION_CREATE);
if (aSelectedObject != null)
aToolbar.addHiddenField (CPageParam.PARAM_OBJECT, aSelectedObject.getID ());
aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE);
// Save button
aToolbar.addSubmitButton (getCreateToolbarSubmitButtonText (aDisplayLocale), getCreateToolbarSubmitButtonIcon ());
// Cancel button
aToolbar.addButtonCancel (aDisplayLocale);
// Callback
modifyCreateToolbar (aWPEC, aToolbar);
return aToolbar;
} | java | @Nonnull
@OverrideOnDemand
protected TOOLBAR_TYPE createCreateToolbar (@Nonnull final WPECTYPE aWPEC,
@Nonnull final FORM_TYPE aForm,
@Nullable final DATATYPE aSelectedObject)
{
final Locale aDisplayLocale = aWPEC.getDisplayLocale ();
final TOOLBAR_TYPE aToolbar = createNewCreateToolbar (aWPEC);
aToolbar.addHiddenField (CPageParam.PARAM_ACTION, CPageParam.ACTION_CREATE);
if (aSelectedObject != null)
aToolbar.addHiddenField (CPageParam.PARAM_OBJECT, aSelectedObject.getID ());
aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE);
// Save button
aToolbar.addSubmitButton (getCreateToolbarSubmitButtonText (aDisplayLocale), getCreateToolbarSubmitButtonIcon ());
// Cancel button
aToolbar.addButtonCancel (aDisplayLocale);
// Callback
modifyCreateToolbar (aWPEC, aToolbar);
return aToolbar;
} | [
"@",
"Nonnull",
"@",
"OverrideOnDemand",
"protected",
"TOOLBAR_TYPE",
"createCreateToolbar",
"(",
"@",
"Nonnull",
"final",
"WPECTYPE",
"aWPEC",
",",
"@",
"Nonnull",
"final",
"FORM_TYPE",
"aForm",
",",
"@",
"Nullable",
"final",
"DATATYPE",
"aSelectedObject",
")",
"... | Create toolbar for creating a new object
@param aWPEC
The web page execution context
@param aForm
The handled form. Never <code>null</code>.
@param aSelectedObject
Optional selected object. May be <code>null</code>.
@return Never <code>null</code>. | [
"Create",
"toolbar",
"for",
"creating",
"a",
"new",
"object"
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/AbstractWebPageForm.java#L833-L854 |
jurmous/etcd4j | src/main/java/mousio/etcd4j/EtcdClient.java | EtcdClient.getLeaderStats | public EtcdLeaderStatsResponse getLeaderStats() {
try {
return new EtcdLeaderStatsRequest(this.client, retryHandler).send().get();
} catch (IOException | EtcdException | EtcdAuthenticationException | TimeoutException e) {
return null;
}
} | java | public EtcdLeaderStatsResponse getLeaderStats() {
try {
return new EtcdLeaderStatsRequest(this.client, retryHandler).send().get();
} catch (IOException | EtcdException | EtcdAuthenticationException | TimeoutException e) {
return null;
}
} | [
"public",
"EtcdLeaderStatsResponse",
"getLeaderStats",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"EtcdLeaderStatsRequest",
"(",
"this",
".",
"client",
",",
"retryHandler",
")",
".",
"send",
"(",
")",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"IOExcep... | Get the Leader Statistics of Etcd
@return EtcdLeaderStatsResponse | [
"Get",
"the",
"Leader",
"Statistics",
"of",
"Etcd"
] | train | https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/EtcdClient.java#L158-L164 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java | SparkComputationGraph.doEvaluationMDS | @SuppressWarnings("unchecked")
public <T extends IEvaluation> T[] doEvaluationMDS(JavaRDD<MultiDataSet> data, int evalBatchSize, T... emptyEvaluations) {
return doEvaluationMDS(data, getDefaultEvaluationWorkers(), evalBatchSize, emptyEvaluations);
} | java | @SuppressWarnings("unchecked")
public <T extends IEvaluation> T[] doEvaluationMDS(JavaRDD<MultiDataSet> data, int evalBatchSize, T... emptyEvaluations) {
return doEvaluationMDS(data, getDefaultEvaluationWorkers(), evalBatchSize, emptyEvaluations);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"IEvaluation",
">",
"T",
"[",
"]",
"doEvaluationMDS",
"(",
"JavaRDD",
"<",
"MultiDataSet",
">",
"data",
",",
"int",
"evalBatchSize",
",",
"T",
"...",
"emptyEvaluations",
")",
... | Perform distributed evaluation on a <i>single output</i> ComputationGraph form MultiDataSet objects using Spark.
Can be used to perform multiple evaluations on this single output (for example, {@link Evaluation} and
{@link ROC}) at the same time.
@param data Data to evaluatie
@param evalBatchSize Minibatch size for evaluation
@param emptyEvaluations Evaluations to perform
@return Evaluations | [
"Perform",
"distributed",
"evaluation",
"on",
"a",
"<i",
">",
"single",
"output<",
"/",
"i",
">",
"ComputationGraph",
"form",
"MultiDataSet",
"objects",
"using",
"Spark",
".",
"Can",
"be",
"used",
"to",
"perform",
"multiple",
"evaluations",
"on",
"this",
"sing... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L844-L847 |
mockito/mockito | src/main/java/org/mockito/internal/invocation/TypeSafeMatching.java | TypeSafeMatching.isCompatible | private static boolean isCompatible(ArgumentMatcher<?> argumentMatcher, Object argument) {
if (argument == null)
return true;
Class<?> expectedArgumentType = getArgumentType(argumentMatcher);
return expectedArgumentType.isInstance(argument);
} | java | private static boolean isCompatible(ArgumentMatcher<?> argumentMatcher, Object argument) {
if (argument == null)
return true;
Class<?> expectedArgumentType = getArgumentType(argumentMatcher);
return expectedArgumentType.isInstance(argument);
} | [
"private",
"static",
"boolean",
"isCompatible",
"(",
"ArgumentMatcher",
"<",
"?",
">",
"argumentMatcher",
",",
"Object",
"argument",
")",
"{",
"if",
"(",
"argument",
"==",
"null",
")",
"return",
"true",
";",
"Class",
"<",
"?",
">",
"expectedArgumentType",
"=... | Returns <code>true</code> if the given <b>argument</b> can be passed to
the given <code>argumentMatcher</code> without causing a
{@link ClassCastException}. | [
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"given",
"<b",
">",
"argument<",
"/",
"b",
">",
"can",
"be",
"passed",
"to",
"the",
"given",
"<code",
">",
"argumentMatcher<",
"/",
"code",
">",
"without",
"causing",
"a",
"{"
] | train | https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/invocation/TypeSafeMatching.java#L33-L40 |
lemire/JavaFastPFOR | src/main/java/me/lemire/integercompression/Simple16.java | Simple16.compressblock | public static final int compressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
int numIdx, j, num, bits;
for (numIdx = 0; numIdx < S16_NUMSIZE; numIdx++) {
out[outOffset] = numIdx << S16_BITSSIZE;
num = (S16_NUM[numIdx] < n) ? S16_NUM[numIdx] : n;
for (j = 0, bits = 0; (j < num) && (in[inOffset + j] < SHIFTED_S16_BITS[numIdx][j]);) {
out[outOffset] |= (in[inOffset + j] << bits);
bits += S16_BITS[numIdx][j];
j++;
}
if (j == num) {
return num;
}
}
return -1;
} | java | public static final int compressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
int numIdx, j, num, bits;
for (numIdx = 0; numIdx < S16_NUMSIZE; numIdx++) {
out[outOffset] = numIdx << S16_BITSSIZE;
num = (S16_NUM[numIdx] < n) ? S16_NUM[numIdx] : n;
for (j = 0, bits = 0; (j < num) && (in[inOffset + j] < SHIFTED_S16_BITS[numIdx][j]);) {
out[outOffset] |= (in[inOffset + j] << bits);
bits += S16_BITS[numIdx][j];
j++;
}
if (j == num) {
return num;
}
}
return -1;
} | [
"public",
"static",
"final",
"int",
"compressblock",
"(",
"int",
"[",
"]",
"out",
",",
"int",
"outOffset",
",",
"int",
"[",
"]",
"in",
",",
"int",
"inOffset",
",",
"int",
"n",
")",
"{",
"int",
"numIdx",
",",
"j",
",",
"num",
",",
"bits",
";",
"fo... | Compress an integer array using Simple16
@param out
the compressed output
@param outOffset
the offset of the output in the number of integers
@param in
the integer input array
@param inOffset
the offset of the input in the number of integers
@param n
the number of elements to be compressed
@return the number of compressed integers | [
"Compress",
"an",
"integer",
"array",
"using",
"Simple16"
] | train | https://github.com/lemire/JavaFastPFOR/blob/ffeea61ab2fdb3854da7b0a557f8d22d674477f4/src/main/java/me/lemire/integercompression/Simple16.java#L46-L64 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java | CDKMCS.getSubgraphAtomsMaps | public static List<List<CDKRMap>> getSubgraphAtomsMaps(IAtomContainer sourceGraph, IAtomContainer targetGraph,
boolean shouldMatchBonds) throws CDKException {
List<CDKRMap> list = checkSingleAtomCases(sourceGraph, targetGraph);
if (list == null) {
return makeAtomsMapsOfBondsMaps(CDKMCS.getSubgraphMaps(sourceGraph, targetGraph, shouldMatchBonds),
sourceGraph, targetGraph);
} else {
List<List<CDKRMap>> atomsMap = new ArrayList<List<CDKRMap>>();
atomsMap.add(list);
return atomsMap;
}
} | java | public static List<List<CDKRMap>> getSubgraphAtomsMaps(IAtomContainer sourceGraph, IAtomContainer targetGraph,
boolean shouldMatchBonds) throws CDKException {
List<CDKRMap> list = checkSingleAtomCases(sourceGraph, targetGraph);
if (list == null) {
return makeAtomsMapsOfBondsMaps(CDKMCS.getSubgraphMaps(sourceGraph, targetGraph, shouldMatchBonds),
sourceGraph, targetGraph);
} else {
List<List<CDKRMap>> atomsMap = new ArrayList<List<CDKRMap>>();
atomsMap.add(list);
return atomsMap;
}
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"CDKRMap",
">",
">",
"getSubgraphAtomsMaps",
"(",
"IAtomContainer",
"sourceGraph",
",",
"IAtomContainer",
"targetGraph",
",",
"boolean",
"shouldMatchBonds",
")",
"throws",
"CDKException",
"{",
"List",
"<",
"CDKRMap",
"... | Returns all subgraph 'atom mappings' found for targetGraph in sourceGraph.
This is an ArrayList of ArrayLists of CDKRMap objects.
@param sourceGraph first molecule. Must not be an IQueryAtomContainer.
@param targetGraph second molecule. May be an IQueryAtomContainer.
@param shouldMatchBonds
@return all subgraph atom mappings found projected on sourceGraph. This is atom
List of CDKRMap objects containing Ids of matching atoms.
@throws CDKException | [
"Returns",
"all",
"subgraph",
"atom",
"mappings",
"found",
"for",
"targetGraph",
"in",
"sourceGraph",
".",
"This",
"is",
"an",
"ArrayList",
"of",
"ArrayLists",
"of",
"CDKRMap",
"objects",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java#L304-L315 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutIntegrationRequest.java | PutIntegrationRequest.withRequestTemplates | public PutIntegrationRequest withRequestTemplates(java.util.Map<String, String> requestTemplates) {
setRequestTemplates(requestTemplates);
return this;
} | java | public PutIntegrationRequest withRequestTemplates(java.util.Map<String, String> requestTemplates) {
setRequestTemplates(requestTemplates);
return this;
} | [
"public",
"PutIntegrationRequest",
"withRequestTemplates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestTemplates",
")",
"{",
"setRequestTemplates",
"(",
"requestTemplates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Represents a map of Velocity templates that are applied on the request payload based on the value of the
Content-Type header sent by the client. The content type value is the key in this map, and the template (as a
String) is the value.
</p>
@param requestTemplates
Represents a map of Velocity templates that are applied on the request payload based on the value of the
Content-Type header sent by the client. The content type value is the key in this map, and the template
(as a String) is the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Represents",
"a",
"map",
"of",
"Velocity",
"templates",
"that",
"are",
"applied",
"on",
"the",
"request",
"payload",
"based",
"on",
"the",
"value",
"of",
"the",
"Content",
"-",
"Type",
"header",
"sent",
"by",
"the",
"client",
".",
"The",
"con... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutIntegrationRequest.java#L978-L981 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HiveJdbcConnector.java | HiveJdbcConnector.addHiveSiteDirToClasspath | private static void addHiveSiteDirToClasspath(String hiveSiteDir) {
LOG.info("Adding " + hiveSiteDir + " to CLASSPATH");
File f = new File(hiveSiteDir);
try {
URL u = f.toURI().toURL();
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class<URLClassLoader> urlClass = URLClassLoader.class;
Method method = urlClass.getDeclaredMethod("addURL", new Class[] { URL.class });
method.setAccessible(true);
method.invoke(urlClassLoader, new Object[] { u });
} catch (ReflectiveOperationException | IOException e) {
throw new RuntimeException("Unable to add hive.site.dir to CLASSPATH", e);
}
} | java | private static void addHiveSiteDirToClasspath(String hiveSiteDir) {
LOG.info("Adding " + hiveSiteDir + " to CLASSPATH");
File f = new File(hiveSiteDir);
try {
URL u = f.toURI().toURL();
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class<URLClassLoader> urlClass = URLClassLoader.class;
Method method = urlClass.getDeclaredMethod("addURL", new Class[] { URL.class });
method.setAccessible(true);
method.invoke(urlClassLoader, new Object[] { u });
} catch (ReflectiveOperationException | IOException e) {
throw new RuntimeException("Unable to add hive.site.dir to CLASSPATH", e);
}
} | [
"private",
"static",
"void",
"addHiveSiteDirToClasspath",
"(",
"String",
"hiveSiteDir",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Adding \"",
"+",
"hiveSiteDir",
"+",
"\" to CLASSPATH\"",
")",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"hiveSiteDir",
")",
";",
"... | Helper method to add the directory containing the hive-site.xml file to the classpath
@param hiveSiteDir is the path to to the folder containing the hive-site.xml file | [
"Helper",
"method",
"to",
"add",
"the",
"directory",
"containing",
"the",
"hive",
"-",
"site",
".",
"xml",
"file",
"to",
"the",
"classpath"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HiveJdbcConnector.java#L195-L208 |
eirbjo/jetty-console | jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java | JettyConsoleBootstrapMainClass.startJettyConsole | private void startJettyConsole(ClassLoader cl, String[] arguments, File tempDirectory) {
try {
Class starterClass = cl.loadClass("org.simplericity.jettyconsole.JettyConsoleStarter");
starterClass.getField("jettyWorkDirectory").set(null, tempDirectory);
Method main = starterClass.getMethod("main", arguments.getClass());
main.invoke(null, new Object[] {arguments});
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException | IllegalAccessException | NoSuchFieldException e) {
throw new RuntimeException(e);
}
} | java | private void startJettyConsole(ClassLoader cl, String[] arguments, File tempDirectory) {
try {
Class starterClass = cl.loadClass("org.simplericity.jettyconsole.JettyConsoleStarter");
starterClass.getField("jettyWorkDirectory").set(null, tempDirectory);
Method main = starterClass.getMethod("main", arguments.getClass());
main.invoke(null, new Object[] {arguments});
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException | IllegalAccessException | NoSuchFieldException e) {
throw new RuntimeException(e);
}
} | [
"private",
"void",
"startJettyConsole",
"(",
"ClassLoader",
"cl",
",",
"String",
"[",
"]",
"arguments",
",",
"File",
"tempDirectory",
")",
"{",
"try",
"{",
"Class",
"starterClass",
"=",
"cl",
".",
"loadClass",
"(",
"\"org.simplericity.jettyconsole.JettyConsoleStarte... | Load {@link org.simplericity.jettyconsole.JettyConsoleStarter} and execute its main method.
@param cl The class loader to use for loading {@link JettyConsoleStarter}
@param arguments the arguments to pass to the main method | [
"Load",
"{"
] | train | https://github.com/eirbjo/jetty-console/blob/5bd32ecab12837394dd45fd15c51c3934afcd76b/jetty-console-core/src/main/java/org/simplericity/jettyconsole/JettyConsoleBootstrapMainClass.java#L218-L227 |
aws/aws-sdk-java | aws-java-sdk-rds/src/main/java/com/amazonaws/services/rds/model/RestoreDBInstanceFromS3Request.java | RestoreDBInstanceFromS3Request.getEnableCloudwatchLogsExports | public java.util.List<String> getEnableCloudwatchLogsExports() {
if (enableCloudwatchLogsExports == null) {
enableCloudwatchLogsExports = new com.amazonaws.internal.SdkInternalList<String>();
}
return enableCloudwatchLogsExports;
} | java | public java.util.List<String> getEnableCloudwatchLogsExports() {
if (enableCloudwatchLogsExports == null) {
enableCloudwatchLogsExports = new com.amazonaws.internal.SdkInternalList<String>();
}
return enableCloudwatchLogsExports;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
"getEnableCloudwatchLogsExports",
"(",
")",
"{",
"if",
"(",
"enableCloudwatchLogsExports",
"==",
"null",
")",
"{",
"enableCloudwatchLogsExports",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal"... | <p>
The list of logs that the restored DB instance is to export to CloudWatch Logs. The values in the list depend on
the DB engine being used. For more information, see <a href=
"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch"
>Publishing Database Logs to Amazon CloudWatch Logs</a> in the <i>Amazon RDS User Guide</i>.
</p>
@return The list of logs that the restored DB instance is to export to CloudWatch Logs. The values in the list
depend on the DB engine being used. For more information, see <a href=
"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch"
>Publishing Database Logs to Amazon CloudWatch Logs</a> in the <i>Amazon RDS User Guide</i>. | [
"<p",
">",
"The",
"list",
"of",
"logs",
"that",
"the",
"restored",
"DB",
"instance",
"is",
"to",
"export",
"to",
"CloudWatch",
"Logs",
".",
"The",
"values",
"in",
"the",
"list",
"depend",
"on",
"the",
"DB",
"engine",
"being",
"used",
".",
"For",
"more"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-rds/src/main/java/com/amazonaws/services/rds/model/RestoreDBInstanceFromS3Request.java#L3621-L3626 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.monitor/src/com/ibm/ws/webcontainer/monitor/WebContainerMonitor.java | WebContainerMonitor.initServletStats | public synchronized ServletStats initServletStats(String _app, String _ser) {
String _key = _app + "." + _ser;
ServletStats nStats = this.servletCountByName.get(_key);
if (nStats == null) {
nStats = new ServletStats(_app, _ser);
this.servletCountByName.put(_key, nStats);
}
return nStats;
} | java | public synchronized ServletStats initServletStats(String _app, String _ser) {
String _key = _app + "." + _ser;
ServletStats nStats = this.servletCountByName.get(_key);
if (nStats == null) {
nStats = new ServletStats(_app, _ser);
this.servletCountByName.put(_key, nStats);
}
return nStats;
} | [
"public",
"synchronized",
"ServletStats",
"initServletStats",
"(",
"String",
"_app",
",",
"String",
"_ser",
")",
"{",
"String",
"_key",
"=",
"_app",
"+",
"\".\"",
"+",
"_ser",
";",
"ServletStats",
"nStats",
"=",
"this",
".",
"servletCountByName",
".",
"get",
... | Method : initServletStats()
@param _app = Application Name
@param _ser = Servlet Name
This method will create ServletStats object for current servlet.
This method needs to be synchronised.
This method gets called only at first request. | [
"Method",
":",
"initServletStats",
"()"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.monitor/src/com/ibm/ws/webcontainer/monitor/WebContainerMonitor.java#L89-L97 |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SaslEncryption.java | SaslEncryption.addToChannel | static void addToChannel(
Channel channel,
SaslEncryptionBackend backend,
int maxOutboundBlockSize) {
channel.pipeline()
.addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(backend, maxOutboundBlockSize))
.addFirst("saslDecryption", new DecryptionHandler(backend))
.addFirst("saslFrameDecoder", NettyUtils.createFrameDecoder());
} | java | static void addToChannel(
Channel channel,
SaslEncryptionBackend backend,
int maxOutboundBlockSize) {
channel.pipeline()
.addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(backend, maxOutboundBlockSize))
.addFirst("saslDecryption", new DecryptionHandler(backend))
.addFirst("saslFrameDecoder", NettyUtils.createFrameDecoder());
} | [
"static",
"void",
"addToChannel",
"(",
"Channel",
"channel",
",",
"SaslEncryptionBackend",
"backend",
",",
"int",
"maxOutboundBlockSize",
")",
"{",
"channel",
".",
"pipeline",
"(",
")",
".",
"addFirst",
"(",
"ENCRYPTION_HANDLER_NAME",
",",
"new",
"EncryptionHandler"... | Adds channel handlers that perform encryption / decryption of data using SASL.
@param channel The channel.
@param backend The SASL backend.
@param maxOutboundBlockSize Max size in bytes of outgoing encrypted blocks, to control
memory usage. | [
"Adds",
"channel",
"handlers",
"that",
"perform",
"encryption",
"/",
"decryption",
"of",
"data",
"using",
"SASL",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SaslEncryption.java#L57-L65 |
apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java | SupervisorManager.createAndStartSupervisorInternal | private boolean createAndStartSupervisorInternal(SupervisorSpec spec, boolean persistSpec)
{
String id = spec.getId();
if (supervisors.containsKey(id)) {
return false;
}
if (persistSpec) {
metadataSupervisorManager.insert(id, spec);
}
Supervisor supervisor;
try {
supervisor = spec.createSupervisor();
supervisor.start();
}
catch (Exception e) {
// Supervisor creation or start failed write tombstone only when trying to start a new supervisor
if (persistSpec) {
metadataSupervisorManager.insert(id, new NoopSupervisorSpec(null, spec.getDataSources()));
}
throw new RuntimeException(e);
}
supervisors.put(id, Pair.of(supervisor, spec));
return true;
} | java | private boolean createAndStartSupervisorInternal(SupervisorSpec spec, boolean persistSpec)
{
String id = spec.getId();
if (supervisors.containsKey(id)) {
return false;
}
if (persistSpec) {
metadataSupervisorManager.insert(id, spec);
}
Supervisor supervisor;
try {
supervisor = spec.createSupervisor();
supervisor.start();
}
catch (Exception e) {
// Supervisor creation or start failed write tombstone only when trying to start a new supervisor
if (persistSpec) {
metadataSupervisorManager.insert(id, new NoopSupervisorSpec(null, spec.getDataSources()));
}
throw new RuntimeException(e);
}
supervisors.put(id, Pair.of(supervisor, spec));
return true;
} | [
"private",
"boolean",
"createAndStartSupervisorInternal",
"(",
"SupervisorSpec",
"spec",
",",
"boolean",
"persistSpec",
")",
"{",
"String",
"id",
"=",
"spec",
".",
"getId",
"(",
")",
";",
"if",
"(",
"supervisors",
".",
"containsKey",
"(",
"id",
")",
")",
"{"... | Creates a supervisor from the provided spec and starts it if there is not already a supervisor with that id.
<p/>
Caller should have acquired [lock] before invoking this method to avoid contention with other threads that may be
starting, stopping, suspending and resuming supervisors.
@return true if a new supervisor was created, false if there was already an existing supervisor with this id | [
"Creates",
"a",
"supervisor",
"from",
"the",
"provided",
"spec",
"and",
"starts",
"it",
"if",
"there",
"is",
"not",
"already",
"a",
"supervisor",
"with",
"that",
"id",
".",
"<p",
"/",
">",
"Caller",
"should",
"have",
"acquired",
"[",
"lock",
"]",
"before... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorManager.java#L283-L309 |
threerings/nenya | core/src/main/java/com/threerings/media/MediaOverlay.java | MediaOverlay.propagateDirtyRegions | public void propagateDirtyRegions (ActiveRepaintManager repmgr, JRootPane root)
{
if (_metamgr.needsPaint()) {
// tell the repaint manager about our raw (unmerged) dirty regions so that it can dirty
// only components that are actually impacted
List<Rectangle> dlist = _metamgr.getRegionManager().peekDirtyRegions();
for (int ii = 0, ll = dlist.size(); ii < ll; ii++) {
Rectangle dirty = dlist.get(ii);
repmgr.addDirtyRegion(root, dirty.x - root.getX(), dirty.y - root.getY(),
dirty.width, dirty.height);
}
}
} | java | public void propagateDirtyRegions (ActiveRepaintManager repmgr, JRootPane root)
{
if (_metamgr.needsPaint()) {
// tell the repaint manager about our raw (unmerged) dirty regions so that it can dirty
// only components that are actually impacted
List<Rectangle> dlist = _metamgr.getRegionManager().peekDirtyRegions();
for (int ii = 0, ll = dlist.size(); ii < ll; ii++) {
Rectangle dirty = dlist.get(ii);
repmgr.addDirtyRegion(root, dirty.x - root.getX(), dirty.y - root.getY(),
dirty.width, dirty.height);
}
}
} | [
"public",
"void",
"propagateDirtyRegions",
"(",
"ActiveRepaintManager",
"repmgr",
",",
"JRootPane",
"root",
")",
"{",
"if",
"(",
"_metamgr",
".",
"needsPaint",
"(",
")",
")",
"{",
"// tell the repaint manager about our raw (unmerged) dirty regions so that it can dirty",
"//... | Called by the {@link FrameManager} to propagate our dirty regions to the active repaint
manager so that it can repaint the underlying components just prior to our painting our
media. This will be followed by a call to {@link #paint} after the components have been
repainted. | [
"Called",
"by",
"the",
"{"
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/MediaOverlay.java#L145-L157 |
Netflix/ribbon | ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java | DefaultClientConfigImpl.putDefaultIntegerProperty | protected void putDefaultIntegerProperty(IClientConfigKey propName, Integer defaultValue) {
Integer value = ConfigurationManager.getConfigInstance().getInteger(
getDefaultPropName(propName), defaultValue);
setPropertyInternal(propName, value);
} | java | protected void putDefaultIntegerProperty(IClientConfigKey propName, Integer defaultValue) {
Integer value = ConfigurationManager.getConfigInstance().getInteger(
getDefaultPropName(propName), defaultValue);
setPropertyInternal(propName, value);
} | [
"protected",
"void",
"putDefaultIntegerProperty",
"(",
"IClientConfigKey",
"propName",
",",
"Integer",
"defaultValue",
")",
"{",
"Integer",
"value",
"=",
"ConfigurationManager",
".",
"getConfigInstance",
"(",
")",
".",
"getInteger",
"(",
"getDefaultPropName",
"(",
"pr... | passed as argument is used to put into the properties member variable | [
"passed",
"as",
"argument",
"is",
"used",
"to",
"put",
"into",
"the",
"properties",
"member",
"variable"
] | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java#L560-L564 |
spacecowboy/NoNonsense-FilePicker | library/src/main/java/com/nononsenseapps/filepicker/FilePickerFragment.java | FilePickerFragment.onNewFolder | @Override
public void onNewFolder(@NonNull final String name) {
File folder = new File(mCurrentPath, name);
if (folder.mkdir()) {
refresh(folder);
} else {
Toast.makeText(getActivity(), R.string.nnf_create_folder_error,
Toast.LENGTH_SHORT).show();
}
} | java | @Override
public void onNewFolder(@NonNull final String name) {
File folder = new File(mCurrentPath, name);
if (folder.mkdir()) {
refresh(folder);
} else {
Toast.makeText(getActivity(), R.string.nnf_create_folder_error,
Toast.LENGTH_SHORT).show();
}
} | [
"@",
"Override",
"public",
"void",
"onNewFolder",
"(",
"@",
"NonNull",
"final",
"String",
"name",
")",
"{",
"File",
"folder",
"=",
"new",
"File",
"(",
"mCurrentPath",
",",
"name",
")",
";",
"if",
"(",
"folder",
".",
"mkdir",
"(",
")",
")",
"{",
"refr... | Name is validated to be non-null, non-empty and not containing any
slashes.
@param name The name of the folder the user wishes to create. | [
"Name",
"is",
"validated",
"to",
"be",
"non",
"-",
"null",
"non",
"-",
"empty",
"and",
"not",
"containing",
"any",
"slashes",
"."
] | train | https://github.com/spacecowboy/NoNonsense-FilePicker/blob/396ef7fa5e87791170791f9d94c78f6e42a7679a/library/src/main/java/com/nononsenseapps/filepicker/FilePickerFragment.java#L305-L315 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java | PrepareRequestInterceptor.setupAcceptHeader | private void setupAcceptHeader(String action, Map<String, String> requestHeaders, Map<String, String> requestParameters) {
// validates whether to add headers for accept for serialization
String serializeAcceptFormat = getSerializationResponseFormat();
if (StringUtils.hasText(serializeAcceptFormat)
&& !isDownload(action)
&& !isDownloadPDF(requestParameters)) {
requestHeaders.put(RequestElements.HEADER_PARAM_ACCEPT, ContentTypes.getContentType(serializeAcceptFormat));
}
if(isDownloadPDF(requestParameters)) {
requestHeaders.put(RequestElements.HEADER_PARAM_ACCEPT, ContentTypes.getContentType(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR)));
}
} | java | private void setupAcceptHeader(String action, Map<String, String> requestHeaders, Map<String, String> requestParameters) {
// validates whether to add headers for accept for serialization
String serializeAcceptFormat = getSerializationResponseFormat();
if (StringUtils.hasText(serializeAcceptFormat)
&& !isDownload(action)
&& !isDownloadPDF(requestParameters)) {
requestHeaders.put(RequestElements.HEADER_PARAM_ACCEPT, ContentTypes.getContentType(serializeAcceptFormat));
}
if(isDownloadPDF(requestParameters)) {
requestHeaders.put(RequestElements.HEADER_PARAM_ACCEPT, ContentTypes.getContentType(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR)));
}
} | [
"private",
"void",
"setupAcceptHeader",
"(",
"String",
"action",
",",
"Map",
"<",
"String",
",",
"String",
">",
"requestHeaders",
",",
"Map",
"<",
"String",
",",
"String",
">",
"requestParameters",
")",
"{",
"// validates whether to add headers for accept for serializ... | Setup accept header depends from the semantic of the request
@param action
@param requestHeaders | [
"Setup",
"accept",
"header",
"depends",
"from",
"the",
"semantic",
"of",
"the",
"request"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java#L173-L185 |
gallandarakhneorg/afc | advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/configs/Configs.java | Configs.defineScalar | public static void defineScalar(Map<String, Object> content, String bootiqueVariable, Object value) throws Exception {
final String[] elements = bootiqueVariable.split("\\."); //$NON-NLS-1$
final Map<String, Object> entry = getScalarParent(content, elements);
entry.put(elements[elements.length - 1], value);
} | java | public static void defineScalar(Map<String, Object> content, String bootiqueVariable, Object value) throws Exception {
final String[] elements = bootiqueVariable.split("\\."); //$NON-NLS-1$
final Map<String, Object> entry = getScalarParent(content, elements);
entry.put(elements[elements.length - 1], value);
} | [
"public",
"static",
"void",
"defineScalar",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"content",
",",
"String",
"bootiqueVariable",
",",
"Object",
"value",
")",
"throws",
"Exception",
"{",
"final",
"String",
"[",
"]",
"elements",
"=",
"bootiqueVariable",
... | Add a scalar to a Yaml configuration map.
@param content the Yaml configuration map.
@param bootiqueVariable the name of the bootique variable.
@param value the value.
@throws Exception if a map cannot be created internally. | [
"Add",
"a",
"scalar",
"to",
"a",
"Yaml",
"configuration",
"map",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/configs/Configs.java#L143-L147 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/Step.java | Step.updateText | protected void updateText(PageElement pageElement, String textOrKey, Object... args) throws TechnicalException, FailureException {
updateText(pageElement, textOrKey, null, args);
} | java | protected void updateText(PageElement pageElement, String textOrKey, Object... args) throws TechnicalException, FailureException {
updateText(pageElement, textOrKey, null, args);
} | [
"protected",
"void",
"updateText",
"(",
"PageElement",
"pageElement",
",",
"String",
"textOrKey",
",",
"Object",
"...",
"args",
")",
"throws",
"TechnicalException",
",",
"FailureException",
"{",
"updateText",
"(",
"pageElement",
",",
"textOrKey",
",",
"null",
",",... | Update a html input text with a text.
@param pageElement
Is target element
@param textOrKey
Is the new data (text or text in context (after a save))
@param args
list of arguments to format the found selector with
@throws TechnicalException
is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_ERROR_ON_INPUT} message (with screenshot, no exception)
@throws FailureException
if the scenario encounters a functional error | [
"Update",
"a",
"html",
"input",
"text",
"with",
"a",
"text",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L186-L188 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java | TypeToStringUtils.toStringTypes | public static String toStringTypes(final Type[] types, final Map<String, Type> generics) {
return toStringTypes(types, COMMA_SEPARATOR, generics);
} | java | public static String toStringTypes(final Type[] types, final Map<String, Type> generics) {
return toStringTypes(types, COMMA_SEPARATOR, generics);
} | [
"public",
"static",
"String",
"toStringTypes",
"(",
"final",
"Type",
"[",
"]",
"types",
",",
"final",
"Map",
"<",
"String",
",",
"Type",
">",
"generics",
")",
"{",
"return",
"toStringTypes",
"(",
"types",
",",
"COMMA_SEPARATOR",
",",
"generics",
")",
";",
... | Shortcut for {@link #toStringTypes(Type[], String, Map)} with comma separator (most commonly used).
@param types types to convert to string
@param generics generics (common for all types)
@return string with all types divided by comma
@throws UnknownGenericException when found generic not declared on type (e.g. method generic)
@see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names
@see ru.vyarus.java.generics.resolver.util.map.IgnoreGenericsMap to print Object instead of not known generic
@see EmptyGenericsMap for no-generics case (to avoid creating empty map) | [
"Shortcut",
"for",
"{",
"@link",
"#toStringTypes",
"(",
"Type",
"[]",
"String",
"Map",
")",
"}",
"with",
"comma",
"separator",
"(",
"most",
"commonly",
"used",
")",
"."
] | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java#L130-L132 |
gallandarakhneorg/afc | core/text/src/main/java/org/arakhne/afc/text/TextUtil.java | TextUtil.toUpperCaseWithoutAccent | @Pure
public static String toUpperCaseWithoutAccent(String text, Map<Character, String> map) {
final StringBuilder buffer = new StringBuilder();
for (final char c : text.toCharArray()) {
final String trans = map.get(c);
if (trans != null) {
buffer.append(trans.toUpperCase());
} else {
buffer.append(Character.toUpperCase(c));
}
}
return buffer.toString();
} | java | @Pure
public static String toUpperCaseWithoutAccent(String text, Map<Character, String> map) {
final StringBuilder buffer = new StringBuilder();
for (final char c : text.toCharArray()) {
final String trans = map.get(c);
if (trans != null) {
buffer.append(trans.toUpperCase());
} else {
buffer.append(Character.toUpperCase(c));
}
}
return buffer.toString();
} | [
"@",
"Pure",
"public",
"static",
"String",
"toUpperCaseWithoutAccent",
"(",
"String",
"text",
",",
"Map",
"<",
"Character",
",",
"String",
">",
"map",
")",
"{",
"final",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"fi... | Translate the specified string to upper case and remove the accents.
@param text is the text to scan.
@param map is the translation table from an accentuated character to an
unaccentuated character.
@return the given string without the accents and upper cased | [
"Translate",
"the",
"specified",
"string",
"to",
"upper",
"case",
"and",
"remove",
"the",
"accents",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L1439-L1451 |
SnappyDataInc/snappydata | core/src/main/java/io/snappydata/util/com/clearspring/analytics/stream/membership/BloomCalculations.java | BloomCalculations.getFalsePositiveProbability | public static double getFalsePositiveProbability(int bucketsPerElement, int hashCount) {
// (1 - e^(-k * n / m)) ^ k
return Math.pow(1 - Math.exp(-hashCount * (1 / (double) bucketsPerElement)), hashCount);
} | java | public static double getFalsePositiveProbability(int bucketsPerElement, int hashCount) {
// (1 - e^(-k * n / m)) ^ k
return Math.pow(1 - Math.exp(-hashCount * (1 / (double) bucketsPerElement)), hashCount);
} | [
"public",
"static",
"double",
"getFalsePositiveProbability",
"(",
"int",
"bucketsPerElement",
",",
"int",
"hashCount",
")",
"{",
"// (1 - e^(-k * n / m)) ^ k",
"return",
"Math",
".",
"pow",
"(",
"1",
"-",
"Math",
".",
"exp",
"(",
"-",
"hashCount",
"*",
"(",
"1... | Calculate the probability of a false positive given the specified
number of inserted elements.
@param bucketsPerElement number of inserted elements.
@param hashCount
@return probability of a false positive. | [
"Calculate",
"the",
"probability",
"of",
"a",
"false",
"positive",
"given",
"the",
"specified",
"number",
"of",
"inserted",
"elements",
"."
] | train | https://github.com/SnappyDataInc/snappydata/blob/96fe3e37e9f8d407ab68ef9e394083960acad21d/core/src/main/java/io/snappydata/util/com/clearspring/analytics/stream/membership/BloomCalculations.java#L147-L151 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/algorithm/fmes/Util.java | Util.quickRatio | public static double quickRatio(final String paramFirst, final String paramSecond) {
if (paramFirst == null || paramSecond == null) {
return 1;
}
double matches = 0;
// Use a sparse array to reduce the memory usage
// for unicode characters.
final int x[][] = new int[256][];
for (char c : paramSecond.toCharArray()) {
if (x[c >> 8] == null) {
x[c >> 8] = new int[256];
}
x[c >> 8][c & 0xFF]++;
}
for (char c : paramFirst.toCharArray()) {
final int n = (x[c >> 8] == null) ? 0 : x[c >> 8][c & 0xFF]--;
if (n > 0) {
matches++;
}
}
return 2.0 * matches / (paramFirst.length() + paramSecond.length());
} | java | public static double quickRatio(final String paramFirst, final String paramSecond) {
if (paramFirst == null || paramSecond == null) {
return 1;
}
double matches = 0;
// Use a sparse array to reduce the memory usage
// for unicode characters.
final int x[][] = new int[256][];
for (char c : paramSecond.toCharArray()) {
if (x[c >> 8] == null) {
x[c >> 8] = new int[256];
}
x[c >> 8][c & 0xFF]++;
}
for (char c : paramFirst.toCharArray()) {
final int n = (x[c >> 8] == null) ? 0 : x[c >> 8][c & 0xFF]--;
if (n > 0) {
matches++;
}
}
return 2.0 * matches / (paramFirst.length() + paramSecond.length());
} | [
"public",
"static",
"double",
"quickRatio",
"(",
"final",
"String",
"paramFirst",
",",
"final",
"String",
"paramSecond",
")",
"{",
"if",
"(",
"paramFirst",
"==",
"null",
"||",
"paramSecond",
"==",
"null",
")",
"{",
"return",
"1",
";",
"}",
"double",
"match... | Calculates the similarity of two strings. This is done by comparing the
frequency each character occures in both strings.
@param paramFirst
first string
@param paramSecond
second string
@return similarity of a and b, a value in [0, 1] | [
"Calculates",
"the",
"similarity",
"of",
"two",
"strings",
".",
"This",
"is",
"done",
"by",
"comparing",
"the",
"frequency",
"each",
"character",
"occures",
"in",
"both",
"strings",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/algorithm/fmes/Util.java#L119-L143 |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/util/SearchHelper.java | SearchHelper.setFilter | public void setFilter( final String attributeName, final String value )
{
filter = new FilterSequence( attributeName, value ).toString();
} | java | public void setFilter( final String attributeName, final String value )
{
filter = new FilterSequence( attributeName, value ).toString();
} | [
"public",
"void",
"setFilter",
"(",
"final",
"String",
"attributeName",
",",
"final",
"String",
"value",
")",
"{",
"filter",
"=",
"new",
"FilterSequence",
"(",
"attributeName",
",",
"value",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Set up a standard filter attribute name and value pair.
<table border="1"><caption>Example Values</caption>
<tr><td><b>Attribute</b></td><td><b>Value</b></td></tr>
<tr><td>givenName</td><td>John</td></tr>
</table>
<p><i>Result</i></p>
<code>(givenName=John)</code>
@param attributeName A valid attribute name
@param value A value that, if it exists, will cause the object to be included in result set. | [
"Set",
"up",
"a",
"standard",
"filter",
"attribute",
"name",
"and",
"value",
"pair",
"."
] | train | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/util/SearchHelper.java#L594-L597 |
apache/incubator-shardingsphere | sharding-transaction/sharding-transaction-2pc/sharding-transaction-xa/sharding-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/properties/XAPropertiesFactory.java | XAPropertiesFactory.createXAProperties | public static XAProperties createXAProperties(final DatabaseType databaseType) {
switch (databaseType) {
case H2:
return new H2XAProperties();
case MySQL:
return new MySQLXAProperties();
case PostgreSQL:
return new PostgreSQLXAProperties();
case Oracle:
return new OracleXAProperties();
case SQLServer:
return new SQLServerXAProperties();
default:
throw new UnsupportedOperationException(String.format("Cannot support database type: `%s`", databaseType));
}
} | java | public static XAProperties createXAProperties(final DatabaseType databaseType) {
switch (databaseType) {
case H2:
return new H2XAProperties();
case MySQL:
return new MySQLXAProperties();
case PostgreSQL:
return new PostgreSQLXAProperties();
case Oracle:
return new OracleXAProperties();
case SQLServer:
return new SQLServerXAProperties();
default:
throw new UnsupportedOperationException(String.format("Cannot support database type: `%s`", databaseType));
}
} | [
"public",
"static",
"XAProperties",
"createXAProperties",
"(",
"final",
"DatabaseType",
"databaseType",
")",
"{",
"switch",
"(",
"databaseType",
")",
"{",
"case",
"H2",
":",
"return",
"new",
"H2XAProperties",
"(",
")",
";",
"case",
"MySQL",
":",
"return",
"new... | Create XA properties.
@param databaseType database type
@return XA properties | [
"Create",
"XA",
"properties",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-transaction/sharding-transaction-2pc/sharding-transaction-xa/sharding-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/properties/XAPropertiesFactory.java#L43-L58 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/JoinableResourceBundleImpl.java | JoinableResourceBundleImpl.getAvailableVariant | private String getAvailableVariant(Map<String, String> curVariants) {
String variantKey = null;
if (variants != null) {
Map<String, String> availableVariants = generatorRegistry.getAvailableVariantMap(variants, curVariants);
variantKey = VariantUtils.getVariantKey(availableVariants);
}
return variantKey;
} | java | private String getAvailableVariant(Map<String, String> curVariants) {
String variantKey = null;
if (variants != null) {
Map<String, String> availableVariants = generatorRegistry.getAvailableVariantMap(variants, curVariants);
variantKey = VariantUtils.getVariantKey(availableVariants);
}
return variantKey;
} | [
"private",
"String",
"getAvailableVariant",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"curVariants",
")",
"{",
"String",
"variantKey",
"=",
"null",
";",
"if",
"(",
"variants",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"availa... | Resolves a registered path from a variant key.
@param variantKey
the requested variant key
@return the variant key to use | [
"Resolves",
"a",
"registered",
"path",
"from",
"a",
"variant",
"key",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/JoinableResourceBundleImpl.java#L683-L692 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.isThisDateValid | private boolean isThisDateValid(String dateToValidate, String dateFromat) {
if (dateToValidate == null) {
return false;
}
SimpleDateFormat sdf = new SimpleDateFormat(dateFromat);
sdf.setLenient(false);
try {
//if not valid, it will throw ParseException
Date date = sdf.parse(dateToValidate);
} catch (ParseException e) {
e.printStackTrace();
return false;
}
return true;
} | java | private boolean isThisDateValid(String dateToValidate, String dateFromat) {
if (dateToValidate == null) {
return false;
}
SimpleDateFormat sdf = new SimpleDateFormat(dateFromat);
sdf.setLenient(false);
try {
//if not valid, it will throw ParseException
Date date = sdf.parse(dateToValidate);
} catch (ParseException e) {
e.printStackTrace();
return false;
}
return true;
} | [
"private",
"boolean",
"isThisDateValid",
"(",
"String",
"dateToValidate",
",",
"String",
"dateFromat",
")",
"{",
"if",
"(",
"dateToValidate",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"... | Check is a String is a valid timestamp format
@param dateToValidate
@param dateFromat
@return true/false | [
"Check",
"is",
"a",
"String",
"is",
"a",
"valid",
"timestamp",
"format"
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1526-L1540 |
FINRAOS/DataGenerator | dg-core/src/main/java/org/finra/datagenerator/engine/scxml/SCXMLGapper.java | SCXMLGapper.reproduce | public Frontier reproduce(Map<String, String> decomposition) {
return reproduce(decomposition, new LinkedList<CustomTagExtension>());
} | java | public Frontier reproduce(Map<String, String> decomposition) {
return reproduce(decomposition, new LinkedList<CustomTagExtension>());
} | [
"public",
"Frontier",
"reproduce",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"decomposition",
")",
"{",
"return",
"reproduce",
"(",
"decomposition",
",",
"new",
"LinkedList",
"<",
"CustomTagExtension",
">",
"(",
")",
")",
";",
"}"
] | Produces an SCXMLFrontier by reversing a decomposition; the model text is bundled into the decomposition.
@param decomposition the decomposition, assembled back into a map
@return a rebuilt SCXMLFrontier | [
"Produces",
"an",
"SCXMLFrontier",
"by",
"reversing",
"a",
"decomposition",
";",
"the",
"model",
"text",
"is",
"bundled",
"into",
"the",
"decomposition",
"."
] | train | https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-core/src/main/java/org/finra/datagenerator/engine/scxml/SCXMLGapper.java#L106-L108 |
bohnman/squiggly-java | src/main/java/com/github/bohnman/squiggly/util/SquigglyUtils.java | SquigglyUtils.collectify | public static <K, V> Collection<Map<K, V>> collectify(ObjectMapper mapper, Object source, Class<? extends Collection> targetCollectionType, Class<K> targetKeyType, Class<V> targetValueType) {
MapType mapType = mapper.getTypeFactory().constructMapType(Map.class, targetKeyType, targetValueType);
return collectify(mapper, convertToCollection(source), targetCollectionType, mapType);
} | java | public static <K, V> Collection<Map<K, V>> collectify(ObjectMapper mapper, Object source, Class<? extends Collection> targetCollectionType, Class<K> targetKeyType, Class<V> targetValueType) {
MapType mapType = mapper.getTypeFactory().constructMapType(Map.class, targetKeyType, targetValueType);
return collectify(mapper, convertToCollection(source), targetCollectionType, mapType);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Collection",
"<",
"Map",
"<",
"K",
",",
"V",
">",
">",
"collectify",
"(",
"ObjectMapper",
"mapper",
",",
"Object",
"source",
",",
"Class",
"<",
"?",
"extends",
"Collection",
">",
"targetCollectionType",
",",
... | Convert an object to a collection of maps.
@param mapper the object mapper
@param source the source object
@param targetCollectionType the target collection type
@param targetKeyType the target map key type
@param targetValueType the target map value type
@return collection | [
"Convert",
"an",
"object",
"to",
"a",
"collection",
"of",
"maps",
"."
] | train | https://github.com/bohnman/squiggly-java/blob/ba0c0b924ab718225d1ad180273ee63ea6c4f55a/src/main/java/com/github/bohnman/squiggly/util/SquigglyUtils.java#L75-L78 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java | P2sVpnServerConfigurationsInner.get | public P2SVpnServerConfigurationInner get(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) {
return getWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).toBlocking().single().body();
} | java | public P2SVpnServerConfigurationInner get(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) {
return getWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).toBlocking().single().body();
} | [
"public",
"P2SVpnServerConfigurationInner",
"get",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWanName",
",",
"String",
"p2SVpnServerConfigurationName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualWanName",
",",
"... | Retrieves the details of a P2SVpnServerConfiguration.
@param resourceGroupName The resource group name of the P2SVpnServerConfiguration.
@param virtualWanName The name of the VirtualWan.
@param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the P2SVpnServerConfigurationInner object if successful. | [
"Retrieves",
"the",
"details",
"of",
"a",
"P2SVpnServerConfiguration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L105-L107 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java | VersionsImpl.exportAsync | public Observable<LuisApp> exportAsync(UUID appId, String versionId) {
return exportWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<LuisApp>, LuisApp>() {
@Override
public LuisApp call(ServiceResponse<LuisApp> response) {
return response.body();
}
});
} | java | public Observable<LuisApp> exportAsync(UUID appId, String versionId) {
return exportWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<LuisApp>, LuisApp>() {
@Override
public LuisApp call(ServiceResponse<LuisApp> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LuisApp",
">",
"exportAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
")",
"{",
"return",
"exportWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<... | Exports a LUIS application to JSON format.
@param appId The application ID.
@param versionId The version ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LuisApp object | [
"Exports",
"a",
"LUIS",
"application",
"to",
"JSON",
"format",
"."
] | 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/VersionsImpl.java#L813-L820 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java | GVRFloatAnimation.setKey | public void setKey(int keyIndex, float time, final float[] values)
{
int index = keyIndex * mFloatsPerKey;
Integer valSize = mFloatsPerKey-1;
if (values.length != valSize)
{
throw new IllegalArgumentException("This key needs " + valSize.toString() + " float per value");
}
mKeys[index] = time;
System.arraycopy(values, 0, mKeys, index + 1, values.length);
} | java | public void setKey(int keyIndex, float time, final float[] values)
{
int index = keyIndex * mFloatsPerKey;
Integer valSize = mFloatsPerKey-1;
if (values.length != valSize)
{
throw new IllegalArgumentException("This key needs " + valSize.toString() + " float per value");
}
mKeys[index] = time;
System.arraycopy(values, 0, mKeys, index + 1, values.length);
} | [
"public",
"void",
"setKey",
"(",
"int",
"keyIndex",
",",
"float",
"time",
",",
"final",
"float",
"[",
"]",
"values",
")",
"{",
"int",
"index",
"=",
"keyIndex",
"*",
"mFloatsPerKey",
";",
"Integer",
"valSize",
"=",
"mFloatsPerKey",
"-",
"1",
";",
"if",
... | Set the time and value of the key at the given index
@param keyIndex 0 based index of key
@param time key time in seconds
@param values key values | [
"Set",
"the",
"time",
"and",
"value",
"of",
"the",
"key",
"at",
"the",
"given",
"index"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRFloatAnimation.java#L333-L344 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.addSignedInput | public TransactionInput addSignedInput(TransactionOutPoint prevOut, Script scriptPubKey, ECKey sigKey,
SigHash sigHash, boolean anyoneCanPay) throws ScriptException {
// Verify the API user didn't try to do operations out of order.
checkState(!outputs.isEmpty(), "Attempting to sign tx without outputs.");
TransactionInput input = new TransactionInput(params, this, new byte[] {}, prevOut);
addInput(input);
int inputIndex = inputs.size() - 1;
if (ScriptPattern.isP2PK(scriptPubKey)) {
TransactionSignature signature = calculateSignature(inputIndex, sigKey, scriptPubKey, sigHash,
anyoneCanPay);
input.setScriptSig(ScriptBuilder.createInputScript(signature));
input.setWitness(null);
} else if (ScriptPattern.isP2PKH(scriptPubKey)) {
TransactionSignature signature = calculateSignature(inputIndex, sigKey, scriptPubKey, sigHash,
anyoneCanPay);
input.setScriptSig(ScriptBuilder.createInputScript(signature, sigKey));
input.setWitness(null);
} else if (ScriptPattern.isP2WPKH(scriptPubKey)) {
Script scriptCode = new ScriptBuilder()
.data(ScriptBuilder.createOutputScript(LegacyAddress.fromKey(params, sigKey)).getProgram()).build();
TransactionSignature signature = calculateWitnessSignature(inputIndex, sigKey, scriptCode, input.getValue(),
sigHash, anyoneCanPay);
input.setScriptSig(ScriptBuilder.createEmpty());
input.setWitness(TransactionWitness.redeemP2WPKH(signature, sigKey));
} else {
throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Don't know how to sign for this kind of scriptPubKey: " + scriptPubKey);
}
return input;
} | java | public TransactionInput addSignedInput(TransactionOutPoint prevOut, Script scriptPubKey, ECKey sigKey,
SigHash sigHash, boolean anyoneCanPay) throws ScriptException {
// Verify the API user didn't try to do operations out of order.
checkState(!outputs.isEmpty(), "Attempting to sign tx without outputs.");
TransactionInput input = new TransactionInput(params, this, new byte[] {}, prevOut);
addInput(input);
int inputIndex = inputs.size() - 1;
if (ScriptPattern.isP2PK(scriptPubKey)) {
TransactionSignature signature = calculateSignature(inputIndex, sigKey, scriptPubKey, sigHash,
anyoneCanPay);
input.setScriptSig(ScriptBuilder.createInputScript(signature));
input.setWitness(null);
} else if (ScriptPattern.isP2PKH(scriptPubKey)) {
TransactionSignature signature = calculateSignature(inputIndex, sigKey, scriptPubKey, sigHash,
anyoneCanPay);
input.setScriptSig(ScriptBuilder.createInputScript(signature, sigKey));
input.setWitness(null);
} else if (ScriptPattern.isP2WPKH(scriptPubKey)) {
Script scriptCode = new ScriptBuilder()
.data(ScriptBuilder.createOutputScript(LegacyAddress.fromKey(params, sigKey)).getProgram()).build();
TransactionSignature signature = calculateWitnessSignature(inputIndex, sigKey, scriptCode, input.getValue(),
sigHash, anyoneCanPay);
input.setScriptSig(ScriptBuilder.createEmpty());
input.setWitness(TransactionWitness.redeemP2WPKH(signature, sigKey));
} else {
throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Don't know how to sign for this kind of scriptPubKey: " + scriptPubKey);
}
return input;
} | [
"public",
"TransactionInput",
"addSignedInput",
"(",
"TransactionOutPoint",
"prevOut",
",",
"Script",
"scriptPubKey",
",",
"ECKey",
"sigKey",
",",
"SigHash",
"sigHash",
",",
"boolean",
"anyoneCanPay",
")",
"throws",
"ScriptException",
"{",
"// Verify the API user didn't t... | Adds a new and fully signed input for the given parameters. Note that this method is <b>not</b> thread safe
and requires external synchronization. Please refer to general documentation on Bitcoin scripting and contracts
to understand the values of sigHash and anyoneCanPay: otherwise you can use the other form of this method
that sets them to typical defaults.
@throws ScriptException if the scriptPubKey is not a pay to address or pay to pubkey script. | [
"Adds",
"a",
"new",
"and",
"fully",
"signed",
"input",
"for",
"the",
"given",
"parameters",
".",
"Note",
"that",
"this",
"method",
"is",
"<b",
">",
"not<",
"/",
"b",
">",
"thread",
"safe",
"and",
"requires",
"external",
"synchronization",
".",
"Please",
... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L959-L987 |
Red5/red5-io | src/main/java/org/red5/io/amf/Output.java | Output.writeArbitraryObject | protected void writeArbitraryObject(Object object) {
log.debug("writeObject");
// If we need to serialize class information...
Class<?> objectClass = object.getClass();
if (!objectClass.isAnnotationPresent(Anonymous.class)) {
// Write out start object marker for class name
buf.put(AMF.TYPE_CLASS_OBJECT);
putString(buf, Serializer.getClassName(objectClass));
} else {
// Write out start object marker without class name
buf.put(AMF.TYPE_OBJECT);
}
// Iterate thru fields of an object to build "name-value" map from it
for (Field field : objectClass.getFields()) {
String fieldName = field.getName();
log.debug("Field: {} class: {}", field, objectClass);
// Check if the Field corresponding to the getter/setter pair is transient
if (!serializeField(objectClass, fieldName, field, null)) {
continue;
}
Object value;
try {
// Get field value
value = field.get(object);
} catch (IllegalAccessException err) {
// Swallow on private and protected properties access exception
continue;
}
// Write out prop name
putString(buf, fieldName);
// Write out
Serializer.serialize(this, field, null, object, value);
}
// write out end of object marker
buf.put(AMF.END_OF_OBJECT_SEQUENCE);
} | java | protected void writeArbitraryObject(Object object) {
log.debug("writeObject");
// If we need to serialize class information...
Class<?> objectClass = object.getClass();
if (!objectClass.isAnnotationPresent(Anonymous.class)) {
// Write out start object marker for class name
buf.put(AMF.TYPE_CLASS_OBJECT);
putString(buf, Serializer.getClassName(objectClass));
} else {
// Write out start object marker without class name
buf.put(AMF.TYPE_OBJECT);
}
// Iterate thru fields of an object to build "name-value" map from it
for (Field field : objectClass.getFields()) {
String fieldName = field.getName();
log.debug("Field: {} class: {}", field, objectClass);
// Check if the Field corresponding to the getter/setter pair is transient
if (!serializeField(objectClass, fieldName, field, null)) {
continue;
}
Object value;
try {
// Get field value
value = field.get(object);
} catch (IllegalAccessException err) {
// Swallow on private and protected properties access exception
continue;
}
// Write out prop name
putString(buf, fieldName);
// Write out
Serializer.serialize(this, field, null, object, value);
}
// write out end of object marker
buf.put(AMF.END_OF_OBJECT_SEQUENCE);
} | [
"protected",
"void",
"writeArbitraryObject",
"(",
"Object",
"object",
")",
"{",
"log",
".",
"debug",
"(",
"\"writeObject\"",
")",
";",
"// If we need to serialize class information...",
"Class",
"<",
"?",
">",
"objectClass",
"=",
"object",
".",
"getClass",
"(",
")... | Writes an arbitrary object to the output.
@param object
Object to write | [
"Writes",
"an",
"arbitrary",
"object",
"to",
"the",
"output",
"."
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Output.java#L435-L470 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java | X500Name.asX500Principal | public X500Principal asX500Principal() {
if (x500Principal == null) {
try {
Object[] args = new Object[] {this};
x500Principal =
(X500Principal)principalConstructor.newInstance(args);
} catch (Exception e) {
throw new RuntimeException("Unexpected exception", e);
}
}
return x500Principal;
} | java | public X500Principal asX500Principal() {
if (x500Principal == null) {
try {
Object[] args = new Object[] {this};
x500Principal =
(X500Principal)principalConstructor.newInstance(args);
} catch (Exception e) {
throw new RuntimeException("Unexpected exception", e);
}
}
return x500Principal;
} | [
"public",
"X500Principal",
"asX500Principal",
"(",
")",
"{",
"if",
"(",
"x500Principal",
"==",
"null",
")",
"{",
"try",
"{",
"Object",
"[",
"]",
"args",
"=",
"new",
"Object",
"[",
"]",
"{",
"this",
"}",
";",
"x500Principal",
"=",
"(",
"X500Principal",
... | Get an X500Principal backed by this X500Name.
Note that we are using privileged reflection to access the hidden
package private constructor in X500Principal. | [
"Get",
"an",
"X500Principal",
"backed",
"by",
"this",
"X500Name",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java#L1437-L1448 |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/Coordinate.java | Coordinate.equalsDelta | public boolean equalsDelta(Coordinate coordinate, double delta) {
return null != coordinate &&
(Math.abs(this.x - coordinate.x) < delta && Math.abs(this.y - coordinate.y) < delta);
} | java | public boolean equalsDelta(Coordinate coordinate, double delta) {
return null != coordinate &&
(Math.abs(this.x - coordinate.x) < delta && Math.abs(this.y - coordinate.y) < delta);
} | [
"public",
"boolean",
"equalsDelta",
"(",
"Coordinate",
"coordinate",
",",
"double",
"delta",
")",
"{",
"return",
"null",
"!=",
"coordinate",
"&&",
"(",
"Math",
".",
"abs",
"(",
"this",
".",
"x",
"-",
"coordinate",
".",
"x",
")",
"<",
"delta",
"&&",
"Ma... | Comparison using a tolerance for the equality check.
@param coordinate
coordinate to compare with
@param delta
maximum deviation (along one axis, the actual maximum distance is sqrt(2*delta^2))
@return true | [
"Comparison",
"using",
"a",
"tolerance",
"for",
"the",
"equality",
"check",
"."
] | train | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/Coordinate.java#L115-L118 |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java | MLNumericArray.setImaginary | public void setImaginary(T value, int m, int n)
{
setImaginary( value, getIndex(m,n) );
} | java | public void setImaginary(T value, int m, int n)
{
setImaginary( value, getIndex(m,n) );
} | [
"public",
"void",
"setImaginary",
"(",
"T",
"value",
",",
"int",
"m",
",",
"int",
"n",
")",
"{",
"setImaginary",
"(",
"value",
",",
"getIndex",
"(",
"m",
",",
"n",
")",
")",
";",
"}"
] | Sets single imaginary array element.
@param value - element value
@param m - row index
@param n - column index | [
"Sets",
"single",
"imaginary",
"array",
"element",
"."
] | train | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java#L133-L136 |
sagiegurari/fax4j | src/main/java/org/fax4j/common/LoggerManager.java | LoggerManager.createLogger | private void createLogger(Map<String,String> systemConfiguration)
{
//get class name
String className=systemConfiguration.get(LoggerManager.LOGGER_CLASS_NAME_PROPERTY_KEY);
if((className==null)||(className.length()==0))
{
className=SimpleLogger.class.getName();
}
//create new instance
Logger loggerInstance=(Logger)ReflectionHelper.createInstance(className);
//set default log level as NONE
loggerInstance.setLogLevel(LogLevel.NONE);
//get log level
String logLevelName=systemConfiguration.get(LoggerManager.LOGGER_LOG_LEVEL_PROPERTY_KEY);
//set log level (ignore invalid log level)
if(logLevelName!=null)
{
if(logLevelName.equalsIgnoreCase(LogLevel.ERROR.getName()))
{
loggerInstance.setLogLevel(LogLevel.ERROR);
}
else if(logLevelName.equalsIgnoreCase(LogLevel.INFO.getName()))
{
loggerInstance.setLogLevel(LogLevel.INFO);
}
else if(logLevelName.equalsIgnoreCase(LogLevel.DEBUG.getName()))
{
loggerInstance.setLogLevel(LogLevel.DEBUG);
}
}
//get reference
this.logger=loggerInstance;
} | java | private void createLogger(Map<String,String> systemConfiguration)
{
//get class name
String className=systemConfiguration.get(LoggerManager.LOGGER_CLASS_NAME_PROPERTY_KEY);
if((className==null)||(className.length()==0))
{
className=SimpleLogger.class.getName();
}
//create new instance
Logger loggerInstance=(Logger)ReflectionHelper.createInstance(className);
//set default log level as NONE
loggerInstance.setLogLevel(LogLevel.NONE);
//get log level
String logLevelName=systemConfiguration.get(LoggerManager.LOGGER_LOG_LEVEL_PROPERTY_KEY);
//set log level (ignore invalid log level)
if(logLevelName!=null)
{
if(logLevelName.equalsIgnoreCase(LogLevel.ERROR.getName()))
{
loggerInstance.setLogLevel(LogLevel.ERROR);
}
else if(logLevelName.equalsIgnoreCase(LogLevel.INFO.getName()))
{
loggerInstance.setLogLevel(LogLevel.INFO);
}
else if(logLevelName.equalsIgnoreCase(LogLevel.DEBUG.getName()))
{
loggerInstance.setLogLevel(LogLevel.DEBUG);
}
}
//get reference
this.logger=loggerInstance;
} | [
"private",
"void",
"createLogger",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"systemConfiguration",
")",
"{",
"//get class name",
"String",
"className",
"=",
"systemConfiguration",
".",
"get",
"(",
"LoggerManager",
".",
"LOGGER_CLASS_NAME_PROPERTY_KEY",
")",
";... | This function creates the logger used by the fax4j framework.<br>
The logger must extend org.fax4j.util.Logger and it's class name is defined
by the org.fax4j.logger.class.name property in the fax4j configuration.<br>
The org.fax4j.logger.log.level property is used to set the intial log level of
the logger.
@param systemConfiguration
The system configuration | [
"This",
"function",
"creates",
"the",
"logger",
"used",
"by",
"the",
"fax4j",
"framework",
".",
"<br",
">",
"The",
"logger",
"must",
"extend",
"org",
".",
"fax4j",
".",
"util",
".",
"Logger",
"and",
"it",
"s",
"class",
"name",
"is",
"defined",
"by",
"t... | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/common/LoggerManager.java#L78-L115 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/transferlearning/TransferLearningHelper.java | TransferLearningHelper.featurize | public MultiDataSet featurize(MultiDataSet input) {
if (!isGraph) {
throw new IllegalArgumentException("Cannot use multidatasets with MultiLayerNetworks.");
}
INDArray[] labels = input.getLabels();
INDArray[] features = input.getFeatures();
if (input.getFeaturesMaskArrays() != null) {
throw new IllegalArgumentException("Currently cannot support featurizing datasets with feature masks");
}
INDArray[] featureMasks = null;
INDArray[] labelMasks = input.getLabelsMaskArrays();
INDArray[] featuresNow = new INDArray[graphInputs.size()];
Map<String, INDArray> activationsNow = origGraph.feedForward(features, false);
for (int i = 0; i < graphInputs.size(); i++) {
String anInput = graphInputs.get(i);
if (origGraph.getVertex(anInput).isInputVertex()) {
//was an original input to the graph
int inputIndex = origGraph.getConfiguration().getNetworkInputs().indexOf(anInput);
featuresNow[i] = origGraph.getInput(inputIndex);
} else {
//needs to be grabbed from the internal activations
featuresNow[i] = activationsNow.get(anInput);
}
}
return new MultiDataSet(featuresNow, labels, featureMasks, labelMasks);
} | java | public MultiDataSet featurize(MultiDataSet input) {
if (!isGraph) {
throw new IllegalArgumentException("Cannot use multidatasets with MultiLayerNetworks.");
}
INDArray[] labels = input.getLabels();
INDArray[] features = input.getFeatures();
if (input.getFeaturesMaskArrays() != null) {
throw new IllegalArgumentException("Currently cannot support featurizing datasets with feature masks");
}
INDArray[] featureMasks = null;
INDArray[] labelMasks = input.getLabelsMaskArrays();
INDArray[] featuresNow = new INDArray[graphInputs.size()];
Map<String, INDArray> activationsNow = origGraph.feedForward(features, false);
for (int i = 0; i < graphInputs.size(); i++) {
String anInput = graphInputs.get(i);
if (origGraph.getVertex(anInput).isInputVertex()) {
//was an original input to the graph
int inputIndex = origGraph.getConfiguration().getNetworkInputs().indexOf(anInput);
featuresNow[i] = origGraph.getInput(inputIndex);
} else {
//needs to be grabbed from the internal activations
featuresNow[i] = activationsNow.get(anInput);
}
}
return new MultiDataSet(featuresNow, labels, featureMasks, labelMasks);
} | [
"public",
"MultiDataSet",
"featurize",
"(",
"MultiDataSet",
"input",
")",
"{",
"if",
"(",
"!",
"isGraph",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot use multidatasets with MultiLayerNetworks.\"",
")",
";",
"}",
"INDArray",
"[",
"]",
"labels... | During training frozen vertices/layers can be treated as "featurizing" the input
The forward pass through these frozen layer/vertices can be done in advance and the dataset saved to disk to iterate
quickly on the smaller unfrozen part of the model
Currently does not support datasets with feature masks
@param input multidataset to feed into the computation graph with frozen layer vertices
@return a multidataset with input features that are the outputs of the frozen layer vertices and the original labels. | [
"During",
"training",
"frozen",
"vertices",
"/",
"layers",
"can",
"be",
"treated",
"as",
"featurizing",
"the",
"input",
"The",
"forward",
"pass",
"through",
"these",
"frozen",
"layer",
"/",
"vertices",
"can",
"be",
"done",
"in",
"advance",
"and",
"the",
"dat... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/transferlearning/TransferLearningHelper.java#L322-L349 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java | AddressDivision.isPrefixBlock | protected boolean isPrefixBlock(long divisionValue, long upperValue, int divisionPrefixLen) {
if(divisionPrefixLen == 0) {
return divisionValue == 0 && upperValue == getMaxValue();
}
long ones = ~0L;
long divisionBitMask = ~(ones << getBitCount());
long divisionPrefixMask = ones << (getBitCount() - divisionPrefixLen);
long divisionNonPrefixMask = ~divisionPrefixMask;
return testRange(divisionValue,
upperValue,
upperValue,
divisionPrefixMask & divisionBitMask,
divisionNonPrefixMask);
} | java | protected boolean isPrefixBlock(long divisionValue, long upperValue, int divisionPrefixLen) {
if(divisionPrefixLen == 0) {
return divisionValue == 0 && upperValue == getMaxValue();
}
long ones = ~0L;
long divisionBitMask = ~(ones << getBitCount());
long divisionPrefixMask = ones << (getBitCount() - divisionPrefixLen);
long divisionNonPrefixMask = ~divisionPrefixMask;
return testRange(divisionValue,
upperValue,
upperValue,
divisionPrefixMask & divisionBitMask,
divisionNonPrefixMask);
} | [
"protected",
"boolean",
"isPrefixBlock",
"(",
"long",
"divisionValue",
",",
"long",
"upperValue",
",",
"int",
"divisionPrefixLen",
")",
"{",
"if",
"(",
"divisionPrefixLen",
"==",
"0",
")",
"{",
"return",
"divisionValue",
"==",
"0",
"&&",
"upperValue",
"==",
"g... | Returns whether the division range includes the block of values for its prefix length | [
"Returns",
"whether",
"the",
"division",
"range",
"includes",
"the",
"block",
"of",
"values",
"for",
"its",
"prefix",
"length"
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java#L196-L209 |
h2oai/h2o-3 | h2o-parsers/h2o-parquet-parser/src/main/java/water/parser/parquet/ParquetInt96TimestampConverter.java | ParquetInt96TimestampConverter.getTimestampMillis | public static long getTimestampMillis(Binary timestampBinary) {
if (timestampBinary.length() != BYTES_IN_INT96_TIMESTAMP) {
throw new IllegalArgumentException("Parquet timestamp must be 12 bytes long, actual " + timestampBinary.length());
}
byte[] bytes = timestampBinary.getBytes();
// little endian encoding - bytes are red in inverted order
long timeOfDayNanos = TypeUtils.longFromBytes(bytes[7], bytes[6], bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0]);
int julianDay = TypeUtils.intFromBytes(bytes[11], bytes[10], bytes[9], bytes[8]);
return julianDayToMillis(julianDay) + (timeOfDayNanos / NANOS_PER_MILLISECOND);
} | java | public static long getTimestampMillis(Binary timestampBinary) {
if (timestampBinary.length() != BYTES_IN_INT96_TIMESTAMP) {
throw new IllegalArgumentException("Parquet timestamp must be 12 bytes long, actual " + timestampBinary.length());
}
byte[] bytes = timestampBinary.getBytes();
// little endian encoding - bytes are red in inverted order
long timeOfDayNanos = TypeUtils.longFromBytes(bytes[7], bytes[6], bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0]);
int julianDay = TypeUtils.intFromBytes(bytes[11], bytes[10], bytes[9], bytes[8]);
return julianDayToMillis(julianDay) + (timeOfDayNanos / NANOS_PER_MILLISECOND);
} | [
"public",
"static",
"long",
"getTimestampMillis",
"(",
"Binary",
"timestampBinary",
")",
"{",
"if",
"(",
"timestampBinary",
".",
"length",
"(",
")",
"!=",
"BYTES_IN_INT96_TIMESTAMP",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parquet timestamp must ... | Returns GMT timestamp from binary encoded parquet timestamp (12 bytes - julian date + time of day nanos).
@param timestampBinary INT96 parquet timestamp
@return timestamp in millis, GMT timezone | [
"Returns",
"GMT",
"timestamp",
"from",
"binary",
"encoded",
"parquet",
"timestamp",
"(",
"12",
"bytes",
"-",
"julian",
"date",
"+",
"time",
"of",
"day",
"nanos",
")",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-parsers/h2o-parquet-parser/src/main/java/water/parser/parquet/ParquetInt96TimestampConverter.java#L44-L55 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java | FirewallRulesInner.createOrUpdate | public FirewallRuleInner createOrUpdate(String resourceGroupName, String accountName, String firewallRuleName, CreateOrUpdateFirewallRuleParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName, parameters).toBlocking().single().body();
} | java | public FirewallRuleInner createOrUpdate(String resourceGroupName, String accountName, String firewallRuleName, CreateOrUpdateFirewallRuleParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName, parameters).toBlocking().single().body();
} | [
"public",
"FirewallRuleInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"firewallRuleName",
",",
"CreateOrUpdateFirewallRuleParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
... | Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@param firewallRuleName The name of the firewall rule to create or update.
@param parameters Parameters supplied to create or update the firewall rule.
@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 FirewallRuleInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"specified",
"firewall",
"rule",
".",
"During",
"update",
"the",
"firewall",
"rule",
"with",
"the",
"specified",
"name",
"will",
"be",
"replaced",
"with",
"this",
"new",
"firewall",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java#L228-L230 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java | RoaringBitmap.xorCardinality | public static int xorCardinality(final RoaringBitmap x1, final RoaringBitmap x2) {
return x1.getCardinality() + x2.getCardinality() - 2 * andCardinality(x1, x2);
} | java | public static int xorCardinality(final RoaringBitmap x1, final RoaringBitmap x2) {
return x1.getCardinality() + x2.getCardinality() - 2 * andCardinality(x1, x2);
} | [
"public",
"static",
"int",
"xorCardinality",
"(",
"final",
"RoaringBitmap",
"x1",
",",
"final",
"RoaringBitmap",
"x2",
")",
"{",
"return",
"x1",
".",
"getCardinality",
"(",
")",
"+",
"x2",
".",
"getCardinality",
"(",
")",
"-",
"2",
"*",
"andCardinality",
"... | Cardinality of the bitwise XOR (symmetric difference) operation.
The provided bitmaps are *not* modified. This operation is thread-safe
as long as the provided bitmaps remain unchanged.
@param x1 first bitmap
@param x2 other bitmap
@return cardinality of the symmetric difference | [
"Cardinality",
"of",
"the",
"bitwise",
"XOR",
"(",
"symmetric",
"difference",
")",
"operation",
".",
"The",
"provided",
"bitmaps",
"are",
"*",
"not",
"*",
"modified",
".",
"This",
"operation",
"is",
"thread",
"-",
"safe",
"as",
"long",
"as",
"the",
"provid... | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java#L858-L860 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java | FirewallClient.insertFirewall | @BetaApi
public final Operation insertFirewall(ProjectName project, Firewall firewallResource) {
InsertFirewallHttpRequest request =
InsertFirewallHttpRequest.newBuilder()
.setProject(project == null ? null : project.toString())
.setFirewallResource(firewallResource)
.build();
return insertFirewall(request);
} | java | @BetaApi
public final Operation insertFirewall(ProjectName project, Firewall firewallResource) {
InsertFirewallHttpRequest request =
InsertFirewallHttpRequest.newBuilder()
.setProject(project == null ? null : project.toString())
.setFirewallResource(firewallResource)
.build();
return insertFirewall(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertFirewall",
"(",
"ProjectName",
"project",
",",
"Firewall",
"firewallResource",
")",
"{",
"InsertFirewallHttpRequest",
"request",
"=",
"InsertFirewallHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setProject",
"(... | Creates a firewall rule in the specified project using the data included in the request.
<p>Sample code:
<pre><code>
try (FirewallClient firewallClient = FirewallClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
Firewall firewallResource = Firewall.newBuilder().build();
Operation response = firewallClient.insertFirewall(project, firewallResource);
}
</code></pre>
@param project Project ID for this request.
@param firewallResource Represents a Firewall resource.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"firewall",
"rule",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/FirewallClient.java#L366-L375 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java | LogReader.reportDrop | private void reportDrop(long bytes, Throwable reason)
{
if (monitor != null) {
monitor.corruption(bytes, reason);
}
} | java | private void reportDrop(long bytes, Throwable reason)
{
if (monitor != null) {
monitor.corruption(bytes, reason);
}
} | [
"private",
"void",
"reportDrop",
"(",
"long",
"bytes",
",",
"Throwable",
"reason",
")",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"monitor",
".",
"corruption",
"(",
"bytes",
",",
"reason",
")",
";",
"}",
"}"
] | Reports dropped bytes to the monitor.
The buffer must be updated to remove the dropped bytes prior to invocation. | [
"Reports",
"dropped",
"bytes",
"to",
"the",
"monitor",
".",
"The",
"buffer",
"must",
"be",
"updated",
"to",
"remove",
"the",
"dropped",
"bytes",
"prior",
"to",
"invocation",
"."
] | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java#L348-L353 |
geomajas/geomajas-project-client-gwt | common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/service/ClientConfigurationService.java | ClientConfigurationService.getMapWidgetInfo | public static void getMapWidgetInfo(final String applicationId, final String mapId, final String name,
final WidgetConfigurationCallback callback) {
if (!CONFIG.containsKey(applicationId)) {
if (addCallback(applicationId, new DelayedCallback(mapId, name, callback))) {
configurationLoader.loadClientApplicationInfo(applicationId, SETTER);
}
} else {
execute(applicationId, mapId, name, callback);
}
} | java | public static void getMapWidgetInfo(final String applicationId, final String mapId, final String name,
final WidgetConfigurationCallback callback) {
if (!CONFIG.containsKey(applicationId)) {
if (addCallback(applicationId, new DelayedCallback(mapId, name, callback))) {
configurationLoader.loadClientApplicationInfo(applicationId, SETTER);
}
} else {
execute(applicationId, mapId, name, callback);
}
} | [
"public",
"static",
"void",
"getMapWidgetInfo",
"(",
"final",
"String",
"applicationId",
",",
"final",
"String",
"mapId",
",",
"final",
"String",
"name",
",",
"final",
"WidgetConfigurationCallback",
"callback",
")",
"{",
"if",
"(",
"!",
"CONFIG",
".",
"containsK... | Get the configuration for a specific widget. This method will search within the context of a specific map. This
means that it will find maps, tool-bars and layer trees as well as the widget configurations within a map.
@param applicationId
The application name wherein to search for the widget configuration.
@param mapId
The map wherein to search for the widget configuration.
@param name
The actual widget configuration bean name (can also be a layer tree or a tool-bar).
@param callback
The call-back that is executed when the requested widget configuration is found. This is called
asynchronously. If the widget configuration is not found, null is passed as value! | [
"Get",
"the",
"configuration",
"for",
"a",
"specific",
"widget",
".",
"This",
"method",
"will",
"search",
"within",
"the",
"context",
"of",
"a",
"specific",
"map",
".",
"This",
"means",
"that",
"it",
"will",
"find",
"maps",
"tool",
"-",
"bars",
"and",
"l... | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/service/ClientConfigurationService.java#L134-L143 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java | FacesImpl.findSimilarWithServiceResponseAsync | public Observable<ServiceResponse<List<SimilarFace>>> findSimilarWithServiceResponseAsync(UUID faceId, FindSimilarOptionalParameter findSimilarOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (faceId == null) {
throw new IllegalArgumentException("Parameter faceId is required and cannot be null.");
}
final String faceListId = findSimilarOptionalParameter != null ? findSimilarOptionalParameter.faceListId() : null;
final List<UUID> faceIds = findSimilarOptionalParameter != null ? findSimilarOptionalParameter.faceIds() : null;
final Integer maxNumOfCandidatesReturned = findSimilarOptionalParameter != null ? findSimilarOptionalParameter.maxNumOfCandidatesReturned() : null;
final FindSimilarMatchMode mode = findSimilarOptionalParameter != null ? findSimilarOptionalParameter.mode() : null;
return findSimilarWithServiceResponseAsync(faceId, faceListId, faceIds, maxNumOfCandidatesReturned, mode);
} | java | public Observable<ServiceResponse<List<SimilarFace>>> findSimilarWithServiceResponseAsync(UUID faceId, FindSimilarOptionalParameter findSimilarOptionalParameter) {
if (this.client.azureRegion() == null) {
throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null.");
}
if (faceId == null) {
throw new IllegalArgumentException("Parameter faceId is required and cannot be null.");
}
final String faceListId = findSimilarOptionalParameter != null ? findSimilarOptionalParameter.faceListId() : null;
final List<UUID> faceIds = findSimilarOptionalParameter != null ? findSimilarOptionalParameter.faceIds() : null;
final Integer maxNumOfCandidatesReturned = findSimilarOptionalParameter != null ? findSimilarOptionalParameter.maxNumOfCandidatesReturned() : null;
final FindSimilarMatchMode mode = findSimilarOptionalParameter != null ? findSimilarOptionalParameter.mode() : null;
return findSimilarWithServiceResponseAsync(faceId, faceListId, faceIds, maxNumOfCandidatesReturned, mode);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"List",
"<",
"SimilarFace",
">",
">",
">",
"findSimilarWithServiceResponseAsync",
"(",
"UUID",
"faceId",
",",
"FindSimilarOptionalParameter",
"findSimilarOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client... | Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId.
@param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call
@param findSimilarOptionalParameter 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<SimilarFace> object | [
"Given",
"query",
"face",
"s",
"faceId",
"find",
"the",
"similar",
"-",
"looking",
"faces",
"from",
"a",
"faceId",
"array",
"or",
"a",
"faceListId",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java#L162-L175 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/calib/CalibrationDetectorChessboard2.java | CalibrationDetectorChessboard2.gridChess | public static List<Point2D_F64> gridChess(int numRows, int numCols, double squareWidth)
{
List<Point2D_F64> all = new ArrayList<>();
// convert it into the number of calibration points
numCols = numCols - 1;
numRows = numRows - 1;
// center the grid around the origin. length of a size divided by two
double startX = -((numCols-1)*squareWidth)/2.0;
double startY = -((numRows-1)*squareWidth)/2.0;
for( int i = numRows-1; i >= 0; i-- ) {
double y = startY+i*squareWidth;
for( int j = 0; j < numCols; j++ ) {
double x = startX+j*squareWidth;
all.add( new Point2D_F64(x,y));
}
}
return all;
} | java | public static List<Point2D_F64> gridChess(int numRows, int numCols, double squareWidth)
{
List<Point2D_F64> all = new ArrayList<>();
// convert it into the number of calibration points
numCols = numCols - 1;
numRows = numRows - 1;
// center the grid around the origin. length of a size divided by two
double startX = -((numCols-1)*squareWidth)/2.0;
double startY = -((numRows-1)*squareWidth)/2.0;
for( int i = numRows-1; i >= 0; i-- ) {
double y = startY+i*squareWidth;
for( int j = 0; j < numCols; j++ ) {
double x = startX+j*squareWidth;
all.add( new Point2D_F64(x,y));
}
}
return all;
} | [
"public",
"static",
"List",
"<",
"Point2D_F64",
">",
"gridChess",
"(",
"int",
"numRows",
",",
"int",
"numCols",
",",
"double",
"squareWidth",
")",
"{",
"List",
"<",
"Point2D_F64",
">",
"all",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// convert it int... | This target is composed of a checkered chess board like squares. Each corner of an interior square
touches an adjacent square, but the sides are separated. Only interior square corners provide
calibration points.
@param numRows Number of grid rows in the calibration target
@param numCols Number of grid columns in the calibration target
@param squareWidth How wide each square is. Units are target dependent.
@return Target description | [
"This",
"target",
"is",
"composed",
"of",
"a",
"checkered",
"chess",
"board",
"like",
"squares",
".",
"Each",
"corner",
"of",
"an",
"interior",
"square",
"touches",
"an",
"adjacent",
"square",
"but",
"the",
"sides",
"are",
"separated",
".",
"Only",
"interior... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/calib/CalibrationDetectorChessboard2.java#L143-L164 |
enioka/jqm | jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java | Helpers.initSingleParam | static void initSingleParam(String key, String initValue, DbConn cnx)
{
try
{
cnx.runSelectSingle("globalprm_select_by_key", 2, String.class, key);
return;
}
catch (NoResultException e)
{
GlobalParameter.create(cnx, key, initValue);
}
catch (NonUniqueResultException e)
{
// It exists! Nothing to do...
}
} | java | static void initSingleParam(String key, String initValue, DbConn cnx)
{
try
{
cnx.runSelectSingle("globalprm_select_by_key", 2, String.class, key);
return;
}
catch (NoResultException e)
{
GlobalParameter.create(cnx, key, initValue);
}
catch (NonUniqueResultException e)
{
// It exists! Nothing to do...
}
} | [
"static",
"void",
"initSingleParam",
"(",
"String",
"key",
",",
"String",
"initValue",
",",
"DbConn",
"cnx",
")",
"{",
"try",
"{",
"cnx",
".",
"runSelectSingle",
"(",
"\"globalprm_select_by_key\"",
",",
"2",
",",
"String",
".",
"class",
",",
"key",
")",
";... | Checks if a parameter exists. If it exists, it is left untouched. If it doesn't, it is created. Only works for parameters which key
is unique. Must be called from within an open transaction. | [
"Checks",
"if",
"a",
"parameter",
"exists",
".",
"If",
"it",
"exists",
"it",
"is",
"left",
"untouched",
".",
"If",
"it",
"doesn",
"t",
"it",
"is",
"created",
".",
"Only",
"works",
"for",
"parameters",
"which",
"key",
"is",
"unique",
".",
"Must",
"be",
... | train | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java#L219-L234 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/sftp/SftpFsHelper.java | SftpFsHelper.getSftpChannel | public ChannelSftp getSftpChannel() throws SftpException {
try {
ChannelSftp channelSftp = (ChannelSftp) this.session.openChannel("sftp");
channelSftp.connect();
return channelSftp;
} catch (JSchException e) {
throw new SftpException(0, "Cannot open a channel to SFTP server", e);
}
} | java | public ChannelSftp getSftpChannel() throws SftpException {
try {
ChannelSftp channelSftp = (ChannelSftp) this.session.openChannel("sftp");
channelSftp.connect();
return channelSftp;
} catch (JSchException e) {
throw new SftpException(0, "Cannot open a channel to SFTP server", e);
}
} | [
"public",
"ChannelSftp",
"getSftpChannel",
"(",
")",
"throws",
"SftpException",
"{",
"try",
"{",
"ChannelSftp",
"channelSftp",
"=",
"(",
"ChannelSftp",
")",
"this",
".",
"session",
".",
"openChannel",
"(",
"\"sftp\"",
")",
";",
"channelSftp",
".",
"connect",
"... | Create new channel every time a command needs to be executed. This is required to support execution of multiple
commands in parallel. All created channels are cleaned up when the session is closed.
@return a new {@link ChannelSftp}
@throws SftpException | [
"Create",
"new",
"channel",
"every",
"time",
"a",
"command",
"needs",
"to",
"be",
"executed",
".",
"This",
"is",
"required",
"to",
"support",
"execution",
"of",
"multiple",
"commands",
"in",
"parallel",
".",
"All",
"created",
"channels",
"are",
"cleaned",
"u... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/sftp/SftpFsHelper.java#L98-L107 |
ogaclejapan/SmartTabLayout | utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java | Bundler.putBinder | @TargetApi(18)
public Bundler putBinder(String key, IBinder value) {
bundle.putBinder(key, value);
return this;
} | java | @TargetApi(18)
public Bundler putBinder(String key, IBinder value) {
bundle.putBinder(key, value);
return this;
} | [
"@",
"TargetApi",
"(",
"18",
")",
"public",
"Bundler",
"putBinder",
"(",
"String",
"key",
",",
"IBinder",
"value",
")",
"{",
"bundle",
".",
"putBinder",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts an {@link android.os.IBinder} value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
<p class="note">You should be very careful when using this function. In many
places where Bundles are used (such as inside of Intent objects), the Bundle
can live longer inside of another process than the process that had originally
created it. In that case, the IBinder you supply here will become invalid
when your process goes away, and no longer usable, even if a new process is
created for you later on.</p>
@param key a String, or null
@param value an IBinder object, or null
@return this | [
"Inserts",
"an",
"{",
"@link",
"android",
".",
"os",
".",
"IBinder",
"}",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
... | train | https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L364-L368 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java | NotificationHubsInner.listKeysAsync | public Observable<ResourceListKeysInner> listKeysAsync(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName) {
return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName).map(new Func1<ServiceResponse<ResourceListKeysInner>, ResourceListKeysInner>() {
@Override
public ResourceListKeysInner call(ServiceResponse<ResourceListKeysInner> response) {
return response.body();
}
});
} | java | public Observable<ResourceListKeysInner> listKeysAsync(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName) {
return listKeysWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName).map(new Func1<ServiceResponse<ResourceListKeysInner>, ResourceListKeysInner>() {
@Override
public ResourceListKeysInner call(ServiceResponse<ResourceListKeysInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ResourceListKeysInner",
">",
"listKeysAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
",",
"String",
"notificationHubName",
",",
"String",
"authorizationRuleName",
")",
"{",
"return",
"listKeysWithServiceResponseAsyn... | Gets the Primary and Secondary ConnectionStrings to the NotificationHub.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param notificationHubName The notification hub name.
@param authorizationRuleName The connection string of the NotificationHub for the specified authorizationRule.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ResourceListKeysInner object | [
"Gets",
"the",
"Primary",
"and",
"Secondary",
"ConnectionStrings",
"to",
"the",
"NotificationHub",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L1493-L1500 |
google/closure-templates | java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java | PyExprUtils.genPyNullCheck | public static PyExpr genPyNullCheck(PyExpr expr) {
ImmutableList<PyExpr> exprs = ImmutableList.of(expr, new PyExpr("None", Integer.MAX_VALUE));
// Note: is/is not is Python's identity comparison. It's used for None checks for performance.
String conditionalExpr = genExprWithNewToken(Operator.EQUAL, exprs, "is");
return new PyExpr(conditionalExpr, PyExprUtils.pyPrecedenceForOperator(Operator.EQUAL));
} | java | public static PyExpr genPyNullCheck(PyExpr expr) {
ImmutableList<PyExpr> exprs = ImmutableList.of(expr, new PyExpr("None", Integer.MAX_VALUE));
// Note: is/is not is Python's identity comparison. It's used for None checks for performance.
String conditionalExpr = genExprWithNewToken(Operator.EQUAL, exprs, "is");
return new PyExpr(conditionalExpr, PyExprUtils.pyPrecedenceForOperator(Operator.EQUAL));
} | [
"public",
"static",
"PyExpr",
"genPyNullCheck",
"(",
"PyExpr",
"expr",
")",
"{",
"ImmutableList",
"<",
"PyExpr",
">",
"exprs",
"=",
"ImmutableList",
".",
"of",
"(",
"expr",
",",
"new",
"PyExpr",
"(",
"\"None\"",
",",
"Integer",
".",
"MAX_VALUE",
")",
")",
... | Generates a Python null (None) check expression for the given {@link PyExpr}. | [
"Generates",
"a",
"Python",
"null",
"(",
"None",
")",
"check",
"expression",
"for",
"the",
"given",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java#L137-L142 |
qiujuer/Genius-Android | caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/StatePaintDrawable.java | StatePaintDrawable.updateTintFilter | PorterDuffColorFilter updateTintFilter(PorterDuffColorFilter tintFilter, ColorStateList tint,
PorterDuff.Mode tintMode) {
if (tint == null || tintMode == null) {
return null;
}
final int color = tint.getColorForState(getState(), Color.TRANSPARENT);
if (tintFilter == null) {
return new PorterDuffColorFilter(color, tintMode);
}
//tintFilter.setColor(color);
//tintFilter.setMode(tintMode);
try {
//noinspection unchecked
Class<PorterDuffColorFilter> tClass = (Class<PorterDuffColorFilter>) tintFilter.getClass();
Method method = tClass.getMethod("setColor", Integer.class);
method.invoke(tintFilter, color);
method = tClass.getMethod("setMode", PorterDuff.Mode.class);
method.invoke(tintFilter, tintMode);
return tintFilter;
} catch (Exception e) {
return new PorterDuffColorFilter(color, tintMode);
}
} | java | PorterDuffColorFilter updateTintFilter(PorterDuffColorFilter tintFilter, ColorStateList tint,
PorterDuff.Mode tintMode) {
if (tint == null || tintMode == null) {
return null;
}
final int color = tint.getColorForState(getState(), Color.TRANSPARENT);
if (tintFilter == null) {
return new PorterDuffColorFilter(color, tintMode);
}
//tintFilter.setColor(color);
//tintFilter.setMode(tintMode);
try {
//noinspection unchecked
Class<PorterDuffColorFilter> tClass = (Class<PorterDuffColorFilter>) tintFilter.getClass();
Method method = tClass.getMethod("setColor", Integer.class);
method.invoke(tintFilter, color);
method = tClass.getMethod("setMode", PorterDuff.Mode.class);
method.invoke(tintFilter, tintMode);
return tintFilter;
} catch (Exception e) {
return new PorterDuffColorFilter(color, tintMode);
}
} | [
"PorterDuffColorFilter",
"updateTintFilter",
"(",
"PorterDuffColorFilter",
"tintFilter",
",",
"ColorStateList",
"tint",
",",
"PorterDuff",
".",
"Mode",
"tintMode",
")",
"{",
"if",
"(",
"tint",
"==",
"null",
"||",
"tintMode",
"==",
"null",
")",
"{",
"return",
"nu... | Ensures the tint filter is consistent with the current tint color and
mode. | [
"Ensures",
"the",
"tint",
"filter",
"is",
"consistent",
"with",
"the",
"current",
"tint",
"color",
"and",
"mode",
"."
] | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/StatePaintDrawable.java#L187-L212 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/TraceId.java | TraceId.fromLowerBase16 | public static TraceId fromLowerBase16(CharSequence src, int srcOffset) {
Utils.checkNotNull(src, "src");
return new TraceId(
BigendianEncoding.longFromBase16String(src, srcOffset),
BigendianEncoding.longFromBase16String(src, srcOffset + BigendianEncoding.LONG_BASE16));
} | java | public static TraceId fromLowerBase16(CharSequence src, int srcOffset) {
Utils.checkNotNull(src, "src");
return new TraceId(
BigendianEncoding.longFromBase16String(src, srcOffset),
BigendianEncoding.longFromBase16String(src, srcOffset + BigendianEncoding.LONG_BASE16));
} | [
"public",
"static",
"TraceId",
"fromLowerBase16",
"(",
"CharSequence",
"src",
",",
"int",
"srcOffset",
")",
"{",
"Utils",
".",
"checkNotNull",
"(",
"src",
",",
"\"src\"",
")",
";",
"return",
"new",
"TraceId",
"(",
"BigendianEncoding",
".",
"longFromBase16String"... | Returns a {@code TraceId} built from a lowercase base16 representation.
@param src the lowercase base16 representation.
@param srcOffset the offset in the buffer where the representation of the {@code TraceId}
begins.
@return a {@code TraceId} built from a lowercase base16 representation.
@throws NullPointerException if {@code src} is null.
@throws IllegalArgumentException if not enough characters in the {@code src} from the {@code
srcOffset}.
@since 0.11 | [
"Returns",
"a",
"{",
"@code",
"TraceId",
"}",
"built",
"from",
"a",
"lowercase",
"base16",
"representation",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/TraceId.java#L126-L131 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/geometry/GeometryUtil.java | GeometryUtil.shiftReactionVertical | public static double[] shiftReactionVertical(IReaction reaction, double[] bounds, double[] last, double gap) {
assert bounds.length == 4;
assert last.length == 4;
final double boundsMinX = bounds[0];
final double boundsMinY = bounds[1];
final double boundsMaxX = bounds[2];
final double boundsMaxY = bounds[3];
final double lastMinY = last[1];
final double lastMaxY = last[3];
final double boundsHeight = boundsMaxY - boundsMinY;
final double lastHeight = lastMaxY - lastMinY;
// determine if the reactions are overlapping
if (lastMaxY + gap >= boundsMinY) {
double yShift = boundsHeight + lastHeight + gap;
Vector2d shift = new Vector2d(0, yShift);
List<IAtomContainer> containers = ReactionManipulator.getAllAtomContainers(reaction);
for (IAtomContainer container : containers) {
translate2D(container, shift);
}
return new double[]{boundsMinX, boundsMinY + yShift, boundsMaxX, boundsMaxY + yShift};
} else {
// the reactions were not overlapping
return bounds;
}
} | java | public static double[] shiftReactionVertical(IReaction reaction, double[] bounds, double[] last, double gap) {
assert bounds.length == 4;
assert last.length == 4;
final double boundsMinX = bounds[0];
final double boundsMinY = bounds[1];
final double boundsMaxX = bounds[2];
final double boundsMaxY = bounds[3];
final double lastMinY = last[1];
final double lastMaxY = last[3];
final double boundsHeight = boundsMaxY - boundsMinY;
final double lastHeight = lastMaxY - lastMinY;
// determine if the reactions are overlapping
if (lastMaxY + gap >= boundsMinY) {
double yShift = boundsHeight + lastHeight + gap;
Vector2d shift = new Vector2d(0, yShift);
List<IAtomContainer> containers = ReactionManipulator.getAllAtomContainers(reaction);
for (IAtomContainer container : containers) {
translate2D(container, shift);
}
return new double[]{boundsMinX, boundsMinY + yShift, boundsMaxX, boundsMaxY + yShift};
} else {
// the reactions were not overlapping
return bounds;
}
} | [
"public",
"static",
"double",
"[",
"]",
"shiftReactionVertical",
"(",
"IReaction",
"reaction",
",",
"double",
"[",
"]",
"bounds",
",",
"double",
"[",
"]",
"last",
",",
"double",
"gap",
")",
"{",
"assert",
"bounds",
".",
"length",
"==",
"4",
";",
"assert"... | Shift the containers in a reaction vertically upwards to not overlap with the reference
rectangle. The shift is such that the given gap is realized, but only if the reactions are
actually overlapping. To avoid dependence on Java AWT, rectangles are described by
arrays of double. Each rectangle is specified by {minX, minY, maxX, maxY}.
@param reaction the reaction to shift
@param bounds the bounds of the reaction to shift
@param last the bounds of the last reaction
@return the rectangle of the shifted reaction | [
"Shift",
"the",
"containers",
"in",
"a",
"reaction",
"vertically",
"upwards",
"to",
"not",
"overlap",
"with",
"the",
"reference",
"rectangle",
".",
"The",
"shift",
"is",
"such",
"that",
"the",
"given",
"gap",
"is",
"realized",
"but",
"only",
"if",
"the",
"... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/geometry/GeometryUtil.java#L1716-L1744 |
openbase/jul | extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/BuilderSyncSetup.java | BuilderSyncSetup.unlockWrite | public void unlockWrite(boolean notifyChange) {
logger.debug("order write unlock");
writeLockTimeout.cancel();
writeLock.unlock();
writeLockConsumer = "Unknown";
logger.debug("write unlocked");
if (notifyChange) {
try {
try {
holder.notifyChange();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not inform builder holder about data update!", ex), logger, LogLevel.ERROR);
}
}
} | java | public void unlockWrite(boolean notifyChange) {
logger.debug("order write unlock");
writeLockTimeout.cancel();
writeLock.unlock();
writeLockConsumer = "Unknown";
logger.debug("write unlocked");
if (notifyChange) {
try {
try {
holder.notifyChange();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not inform builder holder about data update!", ex), logger, LogLevel.ERROR);
}
}
} | [
"public",
"void",
"unlockWrite",
"(",
"boolean",
"notifyChange",
")",
"{",
"logger",
".",
"debug",
"(",
"\"order write unlock\"",
")",
";",
"writeLockTimeout",
".",
"cancel",
"(",
")",
";",
"writeLock",
".",
"unlock",
"(",
")",
";",
"writeLockConsumer",
"=",
... | Method unlocks the write lock and notifies the change to the internal data holder.
In case the thread is externally interrupted, no InterruptedException is thrown but instead the interrupted flag is set for the corresponding thread.
Please use the service method Thread.currentThread().isInterrupted() to get informed about any external interruption.
@param notifyChange | [
"Method",
"unlocks",
"the",
"write",
"lock",
"and",
"notifies",
"the",
"change",
"to",
"the",
"internal",
"data",
"holder",
".",
"In",
"case",
"the",
"thread",
"is",
"externally",
"interrupted",
"no",
"InterruptedException",
"is",
"thrown",
"but",
"instead",
"... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/BuilderSyncSetup.java#L185-L202 |
elvishew/xLog | library/src/main/java/com/elvishew/xlog/Logger.java | Logger.formatArgs | private String formatArgs(String format, Object... args) {
if (format != null) {
return String.format(format, args);
} else {
StringBuilder sb = new StringBuilder();
for (int i = 0, N = args.length; i < N; i++) {
if (i != 0) {
sb.append(", ");
}
sb.append(args[i]);
}
return sb.toString();
}
} | java | private String formatArgs(String format, Object... args) {
if (format != null) {
return String.format(format, args);
} else {
StringBuilder sb = new StringBuilder();
for (int i = 0, N = args.length; i < N; i++) {
if (i != 0) {
sb.append(", ");
}
sb.append(args[i]);
}
return sb.toString();
}
} | [
"private",
"String",
"formatArgs",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"format",
"!=",
"null",
")",
"{",
"return",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
";",
"}",
"else",
"{",
"StringBuilder",... | Format a string with arguments.
@param format the format string, null if just to concat the arguments
@param args the arguments
@return the formatted string | [
"Format",
"a",
"string",
"with",
"arguments",
"."
] | train | https://github.com/elvishew/xLog/blob/c6fb95555ce619d3e527f5ba6c45d4d247c5a838/library/src/main/java/com/elvishew/xlog/Logger.java#L609-L622 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java | GVRAssetLoader.loadScene | public void loadScene(final GVRSceneObject model, final GVRResourceVolume volume, final GVRScene scene, final IAssetEvents handler)
{
Threads.spawn(new Runnable()
{
public void run()
{
AssetRequest assetRequest = new AssetRequest(model, volume, scene, handler, true);
String filePath = volume.getFullPath();
String ext = filePath.substring(filePath.length() - 3).toLowerCase();
assetRequest.setImportSettings(GVRImportSettings.getRecommendedSettings());
model.setName(assetRequest.getBaseName());
try
{
if (ext.equals("x3d"))
{
loadX3DModel(assetRequest, model);
}
else
{
loadJassimpModel(assetRequest, model);
}
}
catch (IOException ex)
{
// onModelError is generated in this case
}
}
});
} | java | public void loadScene(final GVRSceneObject model, final GVRResourceVolume volume, final GVRScene scene, final IAssetEvents handler)
{
Threads.spawn(new Runnable()
{
public void run()
{
AssetRequest assetRequest = new AssetRequest(model, volume, scene, handler, true);
String filePath = volume.getFullPath();
String ext = filePath.substring(filePath.length() - 3).toLowerCase();
assetRequest.setImportSettings(GVRImportSettings.getRecommendedSettings());
model.setName(assetRequest.getBaseName());
try
{
if (ext.equals("x3d"))
{
loadX3DModel(assetRequest, model);
}
else
{
loadJassimpModel(assetRequest, model);
}
}
catch (IOException ex)
{
// onModelError is generated in this case
}
}
});
} | [
"public",
"void",
"loadScene",
"(",
"final",
"GVRSceneObject",
"model",
",",
"final",
"GVRResourceVolume",
"volume",
",",
"final",
"GVRScene",
"scene",
",",
"final",
"IAssetEvents",
"handler",
")",
"{",
"Threads",
".",
"spawn",
"(",
"new",
"Runnable",
"(",
")"... | Loads a hierarchy of scene objects {@link GVRSceneObject} from a 3D model
replaces the current scene with it.
<p>
This function loads the model and its textures asynchronously in the background
and will return before the model is loaded.
IAssetEvents are emitted to event listener attached to the context.
@param model
Scene object to become the root of the loaded model.
This scene object will be named with the base filename of the loaded asset.
@param volume
A GVRResourceVolume based on the asset path to load.
This volume will be used as the base for loading textures
and other models contained within the model.
You can subclass GVRResourceVolume to provide custom IO.
@param scene
Scene to be replaced with the model.
@param handler
IAssetEvents handler to process asset loading events
@see #loadModel(GVRSceneObject, GVRResourceVolume, GVRScene) | [
"Loads",
"a",
"hierarchy",
"of",
"scene",
"objects",
"{",
"@link",
"GVRSceneObject",
"}",
"from",
"a",
"3D",
"model",
"replaces",
"the",
"current",
"scene",
"with",
"it",
".",
"<p",
">",
"This",
"function",
"loads",
"the",
"model",
"and",
"its",
"textures"... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java#L1176-L1205 |
Netflix/governator | governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationColumnWriter.java | ConfigurationColumnWriter.build | private ColumnPrinter build(Map<String, Entry> entries)
{
ColumnPrinter printer = new ColumnPrinter();
printer.addColumn("PROPERTY");
printer.addColumn("FIELD");
printer.addColumn("DEFAULT");
printer.addColumn("VALUE");
printer.addColumn("DESCRIPTION");
Map<String, Entry> sortedEntries = Maps.newTreeMap();
sortedEntries.putAll(entries);
for ( Entry entry : sortedEntries.values() )
{
printer.addValue(0, entry.configurationName);
printer.addValue(1, entry.field.getDeclaringClass().getName() + "#" + entry.field.getName());
printer.addValue(2, entry.defaultValue);
printer.addValue(3, entry.has ? entry.value : "");
printer.addValue(4, entry.documentation);
}
return printer;
} | java | private ColumnPrinter build(Map<String, Entry> entries)
{
ColumnPrinter printer = new ColumnPrinter();
printer.addColumn("PROPERTY");
printer.addColumn("FIELD");
printer.addColumn("DEFAULT");
printer.addColumn("VALUE");
printer.addColumn("DESCRIPTION");
Map<String, Entry> sortedEntries = Maps.newTreeMap();
sortedEntries.putAll(entries);
for ( Entry entry : sortedEntries.values() )
{
printer.addValue(0, entry.configurationName);
printer.addValue(1, entry.field.getDeclaringClass().getName() + "#" + entry.field.getName());
printer.addValue(2, entry.defaultValue);
printer.addValue(3, entry.has ? entry.value : "");
printer.addValue(4, entry.documentation);
}
return printer;
} | [
"private",
"ColumnPrinter",
"build",
"(",
"Map",
"<",
"String",
",",
"Entry",
">",
"entries",
")",
"{",
"ColumnPrinter",
"printer",
"=",
"new",
"ColumnPrinter",
"(",
")",
";",
"printer",
".",
"addColumn",
"(",
"\"PROPERTY\"",
")",
";",
"printer",
".",
"add... | Construct a ColumnPrinter using the entries
@param entries
@return | [
"Construct",
"a",
"ColumnPrinter",
"using",
"the",
"entries"
] | train | https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationColumnWriter.java#L82-L104 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/AbstractSecurityController.java | AbstractSecurityController.updateControlledObject | protected void updateControlledObject(Authorizable controlledObject, boolean authorized) {
if( logger.isDebugEnabled() ) {
logger.debug( "setAuthorized( " + authorized + ") on: " + controlledObject );
}
controlledObject.setAuthorized( authorized );
runPostProcessorActions( controlledObject, authorized );
} | java | protected void updateControlledObject(Authorizable controlledObject, boolean authorized) {
if( logger.isDebugEnabled() ) {
logger.debug( "setAuthorized( " + authorized + ") on: " + controlledObject );
}
controlledObject.setAuthorized( authorized );
runPostProcessorActions( controlledObject, authorized );
} | [
"protected",
"void",
"updateControlledObject",
"(",
"Authorizable",
"controlledObject",
",",
"boolean",
"authorized",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"setAuthorized( \"",
"+",
"authorized",
... | Update a controlled object based on the given authorization state.
@param controlledObject Object being controlled
@param authorized state that has been installed on controlledObject | [
"Update",
"a",
"controlled",
"object",
"based",
"on",
"the",
"given",
"authorization",
"state",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/AbstractSecurityController.java#L174-L180 |
aoindustries/aoweb-framework | src/main/java/com/aoindustries/website/framework/TextOnlyLayout.java | TextOnlyLayout.startContentLine | @Override
public void startContentLine(ChainWriter out, WebSiteRequest req, HttpServletResponse resp, int colspan, String align, String width) {
out.print(" <tr>\n"
+ " <td");
if(width!=null && width.length()>0) {
out.append(" style='width:");
out.append(width);
out.append('\'');
}
out.print(" valign='top'");
if(colspan!=1) out.print(" colspan='").print(colspan).print('\'');
if(align!=null && !align.equalsIgnoreCase("left")) out.print(" align='").print(align).print('\'');
out.print('>');
} | java | @Override
public void startContentLine(ChainWriter out, WebSiteRequest req, HttpServletResponse resp, int colspan, String align, String width) {
out.print(" <tr>\n"
+ " <td");
if(width!=null && width.length()>0) {
out.append(" style='width:");
out.append(width);
out.append('\'');
}
out.print(" valign='top'");
if(colspan!=1) out.print(" colspan='").print(colspan).print('\'');
if(align!=null && !align.equalsIgnoreCase("left")) out.print(" align='").print(align).print('\'');
out.print('>');
} | [
"@",
"Override",
"public",
"void",
"startContentLine",
"(",
"ChainWriter",
"out",
",",
"WebSiteRequest",
"req",
",",
"HttpServletResponse",
"resp",
",",
"int",
"colspan",
",",
"String",
"align",
",",
"String",
"width",
")",
"{",
"out",
".",
"print",
"(",
"\"... | Starts one line of content with the initial colspan set to the provided colspan. | [
"Starts",
"one",
"line",
"of",
"content",
"with",
"the",
"initial",
"colspan",
"set",
"to",
"the",
"provided",
"colspan",
"."
] | train | https://github.com/aoindustries/aoweb-framework/blob/8e58af4f5dd898cd2fdb855ffa810a1ca6973ae0/src/main/java/com/aoindustries/website/framework/TextOnlyLayout.java#L383-L396 |
jhunters/jprotobuf | src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java | CodedConstant.getRetRequiredCheck | public static String getRetRequiredCheck(String express, Field field) {
String code = "if (CodedConstant.isNull(" + express + ")) {\n";
code += "throw new UninitializedMessageException(CodedConstant.asList(\"" + field.getName() + "\"))"
+ ClassCode.JAVA_LINE_BREAK;
code += "}\n";
return code;
} | java | public static String getRetRequiredCheck(String express, Field field) {
String code = "if (CodedConstant.isNull(" + express + ")) {\n";
code += "throw new UninitializedMessageException(CodedConstant.asList(\"" + field.getName() + "\"))"
+ ClassCode.JAVA_LINE_BREAK;
code += "}\n";
return code;
} | [
"public",
"static",
"String",
"getRetRequiredCheck",
"(",
"String",
"express",
",",
"Field",
"field",
")",
"{",
"String",
"code",
"=",
"\"if (CodedConstant.isNull(\"",
"+",
"express",
"+",
"\")) {\\n\"",
";",
"code",
"+=",
"\"throw new UninitializedMessageException(Code... | get return required field check java expression.
@param express java expression
@param field java field
@return full java expression | [
"get",
"return",
"required",
"field",
"check",
"java",
"expression",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L494-L501 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfo.java | TEEJBInvocationInfo.tracePostInvokeEnds | public static void tracePostInvokeEnds(EJSDeployedSupport s, EJSWrapperBase wrapper)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
StringBuffer sbuf = new StringBuffer();
sbuf
.append(MthdPostInvokeExit_Type_Str).append(DataDelimiter)
.append(MthdPostInvokeExit_Type).append(DataDelimiter);
writeDeployedSupportInfo(s, sbuf, wrapper, null);
Tr.debug(tc, sbuf.toString());
}
} | java | public static void tracePostInvokeEnds(EJSDeployedSupport s, EJSWrapperBase wrapper)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
StringBuffer sbuf = new StringBuffer();
sbuf
.append(MthdPostInvokeExit_Type_Str).append(DataDelimiter)
.append(MthdPostInvokeExit_Type).append(DataDelimiter);
writeDeployedSupportInfo(s, sbuf, wrapper, null);
Tr.debug(tc, sbuf.toString());
}
} | [
"public",
"static",
"void",
"tracePostInvokeEnds",
"(",
"EJSDeployedSupport",
"s",
",",
"EJSWrapperBase",
"wrapper",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"StringBuffer... | This is called by the EJB container server code to write a
EJB method call postinvoke ends record to the trace log, if enabled. | [
"This",
"is",
"called",
"by",
"the",
"EJB",
"container",
"server",
"code",
"to",
"write",
"a",
"EJB",
"method",
"call",
"postinvoke",
"ends",
"record",
"to",
"the",
"trace",
"log",
"if",
"enabled",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfo.java#L114-L128 |
classgraph/classgraph | src/main/java/io/github/classgraph/ClassInfoList.java | ClassInfoList.exclude | public ClassInfoList exclude(final ClassInfoList other) {
final Set<ClassInfo> reachableClassesDifference = new LinkedHashSet<>(this);
final Set<ClassInfo> directlyRelatedClassesDifference = new LinkedHashSet<>(directlyRelatedClasses);
reachableClassesDifference.removeAll(other);
directlyRelatedClassesDifference.removeAll(other.directlyRelatedClasses);
return new ClassInfoList(reachableClassesDifference, directlyRelatedClassesDifference, sortByName);
} | java | public ClassInfoList exclude(final ClassInfoList other) {
final Set<ClassInfo> reachableClassesDifference = new LinkedHashSet<>(this);
final Set<ClassInfo> directlyRelatedClassesDifference = new LinkedHashSet<>(directlyRelatedClasses);
reachableClassesDifference.removeAll(other);
directlyRelatedClassesDifference.removeAll(other.directlyRelatedClasses);
return new ClassInfoList(reachableClassesDifference, directlyRelatedClassesDifference, sortByName);
} | [
"public",
"ClassInfoList",
"exclude",
"(",
"final",
"ClassInfoList",
"other",
")",
"{",
"final",
"Set",
"<",
"ClassInfo",
">",
"reachableClassesDifference",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
"this",
")",
";",
"final",
"Set",
"<",
"ClassInfo",
">",
"direc... | Find the set difference between this {@link ClassInfoList} and another {@link ClassInfoList}, i.e. (this \
other).
@param other
The other {@link ClassInfoList} to subtract from this one.
@return The set difference of this {@link ClassInfoList} and other, i.e. (this \ other). | [
"Find",
"the",
"set",
"difference",
"between",
"this",
"{",
"@link",
"ClassInfoList",
"}",
"and",
"another",
"{",
"@link",
"ClassInfoList",
"}",
"i",
".",
"e",
".",
"(",
"this",
"\\",
"other",
")",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassInfoList.java#L362-L368 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.doubleBinaryOperator | public static DoubleBinaryOperator doubleBinaryOperator(CheckedDoubleBinaryOperator operator, Consumer<Throwable> handler) {
return (d1, d2) -> {
try {
return operator.applyAsDouble(d1, d2);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static DoubleBinaryOperator doubleBinaryOperator(CheckedDoubleBinaryOperator operator, Consumer<Throwable> handler) {
return (d1, d2) -> {
try {
return operator.applyAsDouble(d1, d2);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"DoubleBinaryOperator",
"doubleBinaryOperator",
"(",
"CheckedDoubleBinaryOperator",
"operator",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"(",
"d1",
",",
"d2",
")",
"->",
"{",
"try",
"{",
"return",
"operator",
"."... | Wrap a {@link CheckedDoubleBinaryOperator} in a {@link DoubleBinaryOperator} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
DoubleStream.of(1.0, 2.0, 3.0).reduce(Unchecked.doubleBinaryOperator(
(d1, d2) -> {
if (d2 < 0.0)
throw new Exception("Only positive numbers allowed");
return d1 + d2;
},
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{",
"@link",
"CheckedDoubleBinaryOperator",
"}",
"in",
"a",
"{",
"@link",
"DoubleBinaryOperator",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"DoubleStream",
... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L643-L654 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java | AbstractVectorModel.nearest | public List<Map.Entry<K, Float>> nearest(Vector vector)
{
return nearest(vector, 10);
} | java | public List<Map.Entry<K, Float>> nearest(Vector vector)
{
return nearest(vector, 10);
} | [
"public",
"List",
"<",
"Map",
".",
"Entry",
"<",
"K",
",",
"Float",
">",
">",
"nearest",
"(",
"Vector",
"vector",
")",
"{",
"return",
"nearest",
"(",
"vector",
",",
"10",
")",
";",
"}"
] | 获取与向量最相似的词语(默认10个)
@param vector 向量
@return 键值对列表, 键是相似词语, 值是相似度, 按相似度降序排列 | [
"获取与向量最相似的词语(默认10个)"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java#L149-L152 |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/TableConnectorUtils.java | TableConnectorUtils.generateRuntimeName | public static String generateRuntimeName(Class<?> clazz, String[] fields) {
String className = clazz.getSimpleName();
if (null == fields) {
return className + "(*)";
} else {
return className + "(" + String.join(", ", fields) + ")";
}
} | java | public static String generateRuntimeName(Class<?> clazz, String[] fields) {
String className = clazz.getSimpleName();
if (null == fields) {
return className + "(*)";
} else {
return className + "(" + String.join(", ", fields) + ")";
}
} | [
"public",
"static",
"String",
"generateRuntimeName",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"[",
"]",
"fields",
")",
"{",
"String",
"className",
"=",
"clazz",
".",
"getSimpleName",
"(",
")",
";",
"if",
"(",
"null",
"==",
"fields",
")",
"{... | Returns the table connector name used for logging and web UI. | [
"Returns",
"the",
"table",
"connector",
"name",
"used",
"for",
"logging",
"and",
"web",
"UI",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/TableConnectorUtils.java#L36-L43 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/DoubleCheckedLocking.java | DoubleCheckedLocking.findFieldDeclaration | @Nullable
private static JCTree findFieldDeclaration(TreePath path, VarSymbol var) {
for (TreePath curr = path; curr != null; curr = curr.getParentPath()) {
Tree leaf = curr.getLeaf();
if (!(leaf instanceof JCClassDecl)) {
continue;
}
for (JCTree tree : ((JCClassDecl) leaf).getMembers()) {
if (Objects.equals(var, ASTHelpers.getSymbol(tree))) {
return tree;
}
}
}
return null;
} | java | @Nullable
private static JCTree findFieldDeclaration(TreePath path, VarSymbol var) {
for (TreePath curr = path; curr != null; curr = curr.getParentPath()) {
Tree leaf = curr.getLeaf();
if (!(leaf instanceof JCClassDecl)) {
continue;
}
for (JCTree tree : ((JCClassDecl) leaf).getMembers()) {
if (Objects.equals(var, ASTHelpers.getSymbol(tree))) {
return tree;
}
}
}
return null;
} | [
"@",
"Nullable",
"private",
"static",
"JCTree",
"findFieldDeclaration",
"(",
"TreePath",
"path",
",",
"VarSymbol",
"var",
")",
"{",
"for",
"(",
"TreePath",
"curr",
"=",
"path",
";",
"curr",
"!=",
"null",
";",
"curr",
"=",
"curr",
".",
"getParentPath",
"(",... | Performs a best-effort search for the AST node of a field declaration.
<p>It will only find fields declared in a lexically enclosing scope of the current location.
Since double-checked locking should always be used on a private field, this should be
reasonably effective. | [
"Performs",
"a",
"best",
"-",
"effort",
"search",
"for",
"the",
"AST",
"node",
"of",
"a",
"field",
"declaration",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/DoubleCheckedLocking.java#L309-L323 |
CenturyLinkCloud/clc-java-sdk | sdk/src/main/java/com/centurylink/cloud/sdk/core/client/SdkClientBuilder.java | SdkClientBuilder.connectionCheckoutTimeout | public SdkClientBuilder connectionCheckoutTimeout(long timeout, TimeUnit unit)
{
this.connectionCheckoutTimeoutMs = (int) TimeUnit.MILLISECONDS.convert(timeout, unit);
return this;
} | java | public SdkClientBuilder connectionCheckoutTimeout(long timeout, TimeUnit unit)
{
this.connectionCheckoutTimeoutMs = (int) TimeUnit.MILLISECONDS.convert(timeout, unit);
return this;
} | [
"public",
"SdkClientBuilder",
"connectionCheckoutTimeout",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"this",
".",
"connectionCheckoutTimeoutMs",
"=",
"(",
"int",
")",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"timeout",
",",
"unit",
... | If connection pooling is enabled, how long will we wait to get a connection?
@param timeout the timeout
@param unit the units the timeout is in
@return this builder | [
"If",
"connection",
"pooling",
"is",
"enabled",
"how",
"long",
"will",
"we",
"wait",
"to",
"get",
"a",
"connection?"
] | train | https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/core/client/SdkClientBuilder.java#L219-L223 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java | BusItinerary.getNearestRoadSegment | @Pure
public RoadSegment getNearestRoadSegment(Point2D<?, ?> point) {
assert point != null;
double distance = Double.MAX_VALUE;
RoadSegment nearestSegment = null;
final Iterator<RoadSegment> iterator = this.roadSegments.roadSegments();
RoadSegment segment;
while (iterator.hasNext()) {
segment = iterator.next();
final double d = segment.distance(point);
if (d < distance) {
distance = d;
nearestSegment = segment;
}
}
return nearestSegment;
} | java | @Pure
public RoadSegment getNearestRoadSegment(Point2D<?, ?> point) {
assert point != null;
double distance = Double.MAX_VALUE;
RoadSegment nearestSegment = null;
final Iterator<RoadSegment> iterator = this.roadSegments.roadSegments();
RoadSegment segment;
while (iterator.hasNext()) {
segment = iterator.next();
final double d = segment.distance(point);
if (d < distance) {
distance = d;
nearestSegment = segment;
}
}
return nearestSegment;
} | [
"@",
"Pure",
"public",
"RoadSegment",
"getNearestRoadSegment",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
")",
"{",
"assert",
"point",
"!=",
"null",
";",
"double",
"distance",
"=",
"Double",
".",
"MAX_VALUE",
";",
"RoadSegment",
"nearestSegment",
"=",... | Replies the nearest road segment from this itinerary to the given point.
@param point the point.
@return the nearest road segment or <code>null</code> if none was found. | [
"Replies",
"the",
"nearest",
"road",
"segment",
"from",
"this",
"itinerary",
"to",
"the",
"given",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1698-L1714 |
advantageous/boon | reflekt/src/main/java/io/advantageous/boon/core/Str.java | Str.sputl | public static String sputl(Object... messages) {
CharBuf buf = CharBuf.create(100);
return sputl(buf, messages).toString();
} | java | public static String sputl(Object... messages) {
CharBuf buf = CharBuf.create(100);
return sputl(buf, messages).toString();
} | [
"public",
"static",
"String",
"sputl",
"(",
"Object",
"...",
"messages",
")",
"{",
"CharBuf",
"buf",
"=",
"CharBuf",
".",
"create",
"(",
"100",
")",
";",
"return",
"sputl",
"(",
"buf",
",",
"messages",
")",
".",
"toString",
"(",
")",
";",
"}"
] | like putl but writes to a string.
@param messages the stuff you want to print out.
@return string | [
"like",
"putl",
"but",
"writes",
"to",
"a",
"string",
"."
] | train | https://github.com/advantageous/boon/blob/12712d376761aa3b33223a9f1716720ddb67cb5e/reflekt/src/main/java/io/advantageous/boon/core/Str.java#L917-L920 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java | AbstractHBCIJob.setParam | public void setParam(String paramName, Integer index, String value) {
String[][] destinations = constraints.get(paramName);
if (destinations == null) {
String msg = HBCIUtils.getLocMsg("EXCMSG_PARAM_NOTNEEDED", new String[]{paramName, getName()});
throw new InvalidUserDataException(msg);
}
if (value == null || value.length() == 0) {
String msg = HBCIUtils.getLocMsg("EXCMSG_PARAM_EMPTY", new String[]{paramName, getName()});
throw new InvalidUserDataException(msg);
}
if (index != null && !indexedConstraints.contains(paramName)) {
String msg = HBCIUtils.getLocMsg("EXCMSG_PARAM_NOTINDEXED", new String[]{paramName, getName()});
throw new InvalidUserDataException(msg);
}
for (String[] valuePair : destinations) {
String lowlevelname = valuePair[0];
if (index != null && indexedConstraints.contains(paramName)) {
lowlevelname = insertIndex(lowlevelname, index);
}
setLowlevelParam(lowlevelname, value);
}
} | java | public void setParam(String paramName, Integer index, String value) {
String[][] destinations = constraints.get(paramName);
if (destinations == null) {
String msg = HBCIUtils.getLocMsg("EXCMSG_PARAM_NOTNEEDED", new String[]{paramName, getName()});
throw new InvalidUserDataException(msg);
}
if (value == null || value.length() == 0) {
String msg = HBCIUtils.getLocMsg("EXCMSG_PARAM_EMPTY", new String[]{paramName, getName()});
throw new InvalidUserDataException(msg);
}
if (index != null && !indexedConstraints.contains(paramName)) {
String msg = HBCIUtils.getLocMsg("EXCMSG_PARAM_NOTINDEXED", new String[]{paramName, getName()});
throw new InvalidUserDataException(msg);
}
for (String[] valuePair : destinations) {
String lowlevelname = valuePair[0];
if (index != null && indexedConstraints.contains(paramName)) {
lowlevelname = insertIndex(lowlevelname, index);
}
setLowlevelParam(lowlevelname, value);
}
} | [
"public",
"void",
"setParam",
"(",
"String",
"paramName",
",",
"Integer",
"index",
",",
"String",
"value",
")",
"{",
"String",
"[",
"]",
"[",
"]",
"destinations",
"=",
"constraints",
".",
"get",
"(",
"paramName",
")",
";",
"if",
"(",
"destinations",
"=="... | <p>Setzen eines Job-Parameters. Für alle Highlevel-Jobs ist in der Package-Beschreibung zum
Package {@link org.kapott.hbci.GV} eine Auflistung aller Jobs und deren Parameter zu finden.
Für alle Lowlevel-Jobs kann eine Liste aller Parameter entweder mit dem Tool
{@link org.kapott.hbci.tools.ShowLowlevelGVs} ermittelt werden.</p>
<p>Bei Verwendung dieser oder einer der anderen <code>setParam()</code>-Methoden werden zusätzlich
einige der Job-Restriktionen (siehe {@link #getJobRestrictions()}) analysiert. Beim Verletzen einer
der überprüften Einschränkungen wird eine Exception mit einer entsprechenden Meldung erzeugt.
Diese Überprüfung findet allerdings nur bei Highlevel-Jobs statt.</p>
@param paramName der Name des zu setzenden Parameters.
@param index Der index oder <code>null</code>, wenn kein Index gewünscht ist
@param value Wert, auf den der Parameter gesetzt werden soll | [
"<p",
">",
"Setzen",
"eines",
"Job",
"-",
"Parameters",
".",
"Für",
"alle",
"Highlevel",
"-",
"Jobs",
"ist",
"in",
"der",
"Package",
"-",
"Beschreibung",
"zum",
"Package",
"{",
"@link",
"org",
".",
"kapott",
".",
"hbci",
".",
"GV",
"}",
"eine",
"Auflis... | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java#L522-L549 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/ExcelUtils.java | ExcelUtils.exportObjects2Excel | public void exportObjects2Excel(List<?> data, List<String> header, OutputStream os)
throws IOException {
try (Workbook workbook = exportExcelBySimpleHandler(data, header, null, true)) {
workbook.write(os);
}
} | java | public void exportObjects2Excel(List<?> data, List<String> header, OutputStream os)
throws IOException {
try (Workbook workbook = exportExcelBySimpleHandler(data, header, null, true)) {
workbook.write(os);
}
} | [
"public",
"void",
"exportObjects2Excel",
"(",
"List",
"<",
"?",
">",
"data",
",",
"List",
"<",
"String",
">",
"header",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"try",
"(",
"Workbook",
"workbook",
"=",
"exportExcelBySimpleHandler",
"(",
... | 无模板、无注解的数据(形如{@code List[?]}、{@code List[List[?]]}、{@code List[Object[]]})导出
@param data 待导出数据
@param header 设置表头信息
@param os 生成的Excel待输出数据流
@throws IOException 异常
@author Crab2Died | [
"无模板、无注解的数据",
"(",
"形如",
"{",
"@code",
"List",
"[",
"?",
"]",
"}",
"、",
"{",
"@code",
"List",
"[",
"List",
"[",
"?",
"]]",
"}",
"、",
"{",
"@code",
"List",
"[",
"Object",
"[]",
"]",
"}",
")",
"导出"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L1323-L1329 |
lightbend/config | config/src/main/java/com/typesafe/config/ConfigFactory.java | ConfigFactory.parseURL | public static Config parseURL(URL url, ConfigParseOptions options) {
return Parseable.newURL(url, options).parse().toConfig();
} | java | public static Config parseURL(URL url, ConfigParseOptions options) {
return Parseable.newURL(url, options).parse().toConfig();
} | [
"public",
"static",
"Config",
"parseURL",
"(",
"URL",
"url",
",",
"ConfigParseOptions",
"options",
")",
"{",
"return",
"Parseable",
".",
"newURL",
"(",
"url",
",",
"options",
")",
".",
"parse",
"(",
")",
".",
"toConfig",
"(",
")",
";",
"}"
] | Parses a URL into a Config instance. Does not call
{@link Config#resolve} or merge the parsed stream with any
other configuration; this method parses a single stream and
does nothing else. It does process "include" statements in
the parsed stream, and may end up doing other IO due to those
statements.
@param url
the url to parse
@param options
parse options to control how the url is interpreted
@return the parsed configuration
@throws ConfigException on IO or parse errors | [
"Parses",
"a",
"URL",
"into",
"a",
"Config",
"instance",
".",
"Does",
"not",
"call",
"{",
"@link",
"Config#resolve",
"}",
"or",
"merge",
"the",
"parsed",
"stream",
"with",
"any",
"other",
"configuration",
";",
"this",
"method",
"parses",
"a",
"single",
"st... | train | https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigFactory.java#L705-L707 |
sarl/sarl | main/externalmaven/io.sarl.maven.sre/src/main/java/io/sarl/maven/sre/AbstractSREMojo.java | AbstractSREMojo.createSREConfiguration | protected Xpp3Dom createSREConfiguration() throws MojoExecutionException, MojoFailureException {
final Xpp3Dom xmlConfiguration = new Xpp3Dom("configuration"); //$NON-NLS-1$
final Xpp3Dom xmlArchive = new Xpp3Dom("archive"); //$NON-NLS-1$
xmlConfiguration.addChild(xmlArchive);
final String mainClass = getMainClass();
if (mainClass.isEmpty()) {
throw new MojoFailureException("the main class of the SRE is missed"); //$NON-NLS-1$
}
final Xpp3Dom xmlManifest = new Xpp3Dom("manifest"); //$NON-NLS-1$
xmlArchive.addChild(xmlManifest);
final Xpp3Dom xmlManifestMainClass = new Xpp3Dom("mainClass"); //$NON-NLS-1$
xmlManifestMainClass.setValue(mainClass);
xmlManifest.addChild(xmlManifestMainClass);
final Xpp3Dom xmlSections = new Xpp3Dom("manifestSections"); //$NON-NLS-1$
xmlArchive.addChild(xmlSections);
final Xpp3Dom xmlSection = new Xpp3Dom("manifestSection"); //$NON-NLS-1$
xmlSections.addChild(xmlSection);
final Xpp3Dom xmlSectionName = new Xpp3Dom("name"); //$NON-NLS-1$
xmlSectionName.setValue(SREConstants.MANIFEST_SECTION_SRE);
xmlSection.addChild(xmlSectionName);
final Xpp3Dom xmlManifestEntries = new Xpp3Dom("manifestEntries"); //$NON-NLS-1$
xmlSection.addChild(xmlManifestEntries);
ManifestUpdater updater = getManifestUpdater();
if (updater == null) {
updater = new ManifestUpdater() {
@Override
public void addSREAttribute(String name, String value) {
assert name != null && !name.isEmpty();
if (value != null && !value.isEmpty()) {
getLog().debug("Adding to SRE manifest: " + name + " = " + value); //$NON-NLS-1$//$NON-NLS-2$
final Xpp3Dom xmlManifestEntry = new Xpp3Dom(name);
xmlManifestEntry.setValue(value);
xmlManifestEntries.addChild(xmlManifestEntry);
}
}
@Override
public void addMainAttribute(String name, String value) {
//
}
};
}
buildManifest(updater, mainClass);
return xmlConfiguration;
} | java | protected Xpp3Dom createSREConfiguration() throws MojoExecutionException, MojoFailureException {
final Xpp3Dom xmlConfiguration = new Xpp3Dom("configuration"); //$NON-NLS-1$
final Xpp3Dom xmlArchive = new Xpp3Dom("archive"); //$NON-NLS-1$
xmlConfiguration.addChild(xmlArchive);
final String mainClass = getMainClass();
if (mainClass.isEmpty()) {
throw new MojoFailureException("the main class of the SRE is missed"); //$NON-NLS-1$
}
final Xpp3Dom xmlManifest = new Xpp3Dom("manifest"); //$NON-NLS-1$
xmlArchive.addChild(xmlManifest);
final Xpp3Dom xmlManifestMainClass = new Xpp3Dom("mainClass"); //$NON-NLS-1$
xmlManifestMainClass.setValue(mainClass);
xmlManifest.addChild(xmlManifestMainClass);
final Xpp3Dom xmlSections = new Xpp3Dom("manifestSections"); //$NON-NLS-1$
xmlArchive.addChild(xmlSections);
final Xpp3Dom xmlSection = new Xpp3Dom("manifestSection"); //$NON-NLS-1$
xmlSections.addChild(xmlSection);
final Xpp3Dom xmlSectionName = new Xpp3Dom("name"); //$NON-NLS-1$
xmlSectionName.setValue(SREConstants.MANIFEST_SECTION_SRE);
xmlSection.addChild(xmlSectionName);
final Xpp3Dom xmlManifestEntries = new Xpp3Dom("manifestEntries"); //$NON-NLS-1$
xmlSection.addChild(xmlManifestEntries);
ManifestUpdater updater = getManifestUpdater();
if (updater == null) {
updater = new ManifestUpdater() {
@Override
public void addSREAttribute(String name, String value) {
assert name != null && !name.isEmpty();
if (value != null && !value.isEmpty()) {
getLog().debug("Adding to SRE manifest: " + name + " = " + value); //$NON-NLS-1$//$NON-NLS-2$
final Xpp3Dom xmlManifestEntry = new Xpp3Dom(name);
xmlManifestEntry.setValue(value);
xmlManifestEntries.addChild(xmlManifestEntry);
}
}
@Override
public void addMainAttribute(String name, String value) {
//
}
};
}
buildManifest(updater, mainClass);
return xmlConfiguration;
} | [
"protected",
"Xpp3Dom",
"createSREConfiguration",
"(",
")",
"throws",
"MojoExecutionException",
",",
"MojoFailureException",
"{",
"final",
"Xpp3Dom",
"xmlConfiguration",
"=",
"new",
"Xpp3Dom",
"(",
"\"configuration\"",
")",
";",
"//$NON-NLS-1$",
"final",
"Xpp3Dom",
"xml... | Create the configuration of the SRE with the maven archive format.
@return the created manifest.
@throws MojoExecutionException if the mojo fails.
@throws MojoFailureException if the generation fails. | [
"Create",
"the",
"configuration",
"of",
"the",
"SRE",
"with",
"the",
"maven",
"archive",
"format",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.sre/src/main/java/io/sarl/maven/sre/AbstractSREMojo.java#L375-L426 |
recruit-mp/android-RMP-Appirater | library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java | RmpAppirater.setAppThisVersionCodeLaunchCount | public static void setAppThisVersionCodeLaunchCount(Context context, long appThisVersionCodeLaunchCount) {
SharedPreferences prefs = getSharedPreferences(context);
SharedPreferences.Editor prefsEditor = prefs.edit();
prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, appThisVersionCodeLaunchCount);
prefsEditor.commit();
} | java | public static void setAppThisVersionCodeLaunchCount(Context context, long appThisVersionCodeLaunchCount) {
SharedPreferences prefs = getSharedPreferences(context);
SharedPreferences.Editor prefsEditor = prefs.edit();
prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, appThisVersionCodeLaunchCount);
prefsEditor.commit();
} | [
"public",
"static",
"void",
"setAppThisVersionCodeLaunchCount",
"(",
"Context",
"context",
",",
"long",
"appThisVersionCodeLaunchCount",
")",
"{",
"SharedPreferences",
"prefs",
"=",
"getSharedPreferences",
"(",
"context",
")",
";",
"SharedPreferences",
".",
"Editor",
"p... | Modify internal value.
<p/>
If you use this method, you might need to have a good understanding of this class code.
@param context Context
@param appThisVersionCodeLaunchCount Launch count of This application current version. | [
"Modify",
"internal",
"value",
".",
"<p",
"/",
">",
"If",
"you",
"use",
"this",
"method",
"you",
"might",
"need",
"to",
"have",
"a",
"good",
"understanding",
"of",
"this",
"class",
"code",
"."
] | train | https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L324-L331 |
apache/incubator-atlas | intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java | AtlasEntityType.addRelationshipAttributeType | void addRelationshipAttributeType(String attributeName, AtlasRelationshipType relationshipType) {
List<AtlasRelationshipType> relationshipTypes = relationshipAttributesType.get(attributeName);
if (relationshipTypes == null) {
relationshipTypes = new ArrayList<>();
relationshipAttributesType.put(attributeName, relationshipTypes);
}
relationshipTypes.add(relationshipType);
} | java | void addRelationshipAttributeType(String attributeName, AtlasRelationshipType relationshipType) {
List<AtlasRelationshipType> relationshipTypes = relationshipAttributesType.get(attributeName);
if (relationshipTypes == null) {
relationshipTypes = new ArrayList<>();
relationshipAttributesType.put(attributeName, relationshipTypes);
}
relationshipTypes.add(relationshipType);
} | [
"void",
"addRelationshipAttributeType",
"(",
"String",
"attributeName",
",",
"AtlasRelationshipType",
"relationshipType",
")",
"{",
"List",
"<",
"AtlasRelationshipType",
">",
"relationshipTypes",
"=",
"relationshipAttributesType",
".",
"get",
"(",
"attributeName",
")",
";... | this method should be called from AtlasRelationshipType.resolveReferencesPhase2() | [
"this",
"method",
"should",
"be",
"called",
"from",
"AtlasRelationshipType",
".",
"resolveReferencesPhase2",
"()"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java#L203-L212 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java | Whitebox.invokeMethod | public static synchronized <T> T invokeMethod(Object instance, String methodToExecute, Object... arguments)
throws Exception {
return WhiteboxImpl.invokeMethod(instance, methodToExecute, arguments);
} | java | public static synchronized <T> T invokeMethod(Object instance, String methodToExecute, Object... arguments)
throws Exception {
return WhiteboxImpl.invokeMethod(instance, methodToExecute, arguments);
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"invokeMethod",
"(",
"Object",
"instance",
",",
"String",
"methodToExecute",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"return",
"WhiteboxImpl",
".",
"invokeMethod",
"(",
"instance... | Invoke a private or inner class method. This might be useful to test
private methods. | [
"Invoke",
"a",
"private",
"or",
"inner",
"class",
"method",
".",
"This",
"might",
"be",
"useful",
"to",
"test",
"private",
"methods",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L399-L402 |
pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.processParentPage | private void processParentPage(PageWrapper parentPage, PageModificationContext context) {
if (context.getDeletedPageKey() != null) {
// We have a deleted page. Remove its pointer from the parent.
parentPage.getPage().update(Collections.singletonList(PageEntry.noValue(context.getDeletedPageKey())));
parentPage.markNeedsFirstKeyUpdate();
} else {
// Update parent page's child pointers for modified pages.
val toUpdate = context.getUpdatedPagePointers().stream()
.map(pp -> new PageEntry(pp.getKey(), serializePointer(pp)))
.collect(Collectors.toList());
parentPage.getPage().update(toUpdate);
}
} | java | private void processParentPage(PageWrapper parentPage, PageModificationContext context) {
if (context.getDeletedPageKey() != null) {
// We have a deleted page. Remove its pointer from the parent.
parentPage.getPage().update(Collections.singletonList(PageEntry.noValue(context.getDeletedPageKey())));
parentPage.markNeedsFirstKeyUpdate();
} else {
// Update parent page's child pointers for modified pages.
val toUpdate = context.getUpdatedPagePointers().stream()
.map(pp -> new PageEntry(pp.getKey(), serializePointer(pp)))
.collect(Collectors.toList());
parentPage.getPage().update(toUpdate);
}
} | [
"private",
"void",
"processParentPage",
"(",
"PageWrapper",
"parentPage",
",",
"PageModificationContext",
"context",
")",
"{",
"if",
"(",
"context",
".",
"getDeletedPageKey",
"(",
")",
"!=",
"null",
")",
"{",
"// We have a deleted page. Remove its pointer from the parent.... | Processes the parent BTreePage after modifying one of its child pages. This involves removing Pointers to deleted
child pages, updating pointers to existing pages and inserting pointers for new pages (results of splits).
@param parentPage The parent page.
@param context Processing Context. | [
"Processes",
"the",
"parent",
"BTreePage",
"after",
"modifying",
"one",
"of",
"its",
"child",
"pages",
".",
"This",
"involves",
"removing",
"Pointers",
"to",
"deleted",
"child",
"pages",
"updating",
"pointers",
"to",
"existing",
"pages",
"and",
"inserting",
"poi... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L563-L575 |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java | ShardConsumer.adjustRunLoopFrequency | protected long adjustRunLoopFrequency(long processingStartTimeNanos, long processingEndTimeNanos)
throws InterruptedException {
long endTimeNanos = processingEndTimeNanos;
if (fetchIntervalMillis != 0) {
long processingTimeNanos = processingEndTimeNanos - processingStartTimeNanos;
long sleepTimeMillis = fetchIntervalMillis - (processingTimeNanos / 1_000_000);
if (sleepTimeMillis > 0) {
Thread.sleep(sleepTimeMillis);
endTimeNanos = System.nanoTime();
shardMetricsReporter.setSleepTimeMillis(sleepTimeMillis);
}
}
return endTimeNanos;
} | java | protected long adjustRunLoopFrequency(long processingStartTimeNanos, long processingEndTimeNanos)
throws InterruptedException {
long endTimeNanos = processingEndTimeNanos;
if (fetchIntervalMillis != 0) {
long processingTimeNanos = processingEndTimeNanos - processingStartTimeNanos;
long sleepTimeMillis = fetchIntervalMillis - (processingTimeNanos / 1_000_000);
if (sleepTimeMillis > 0) {
Thread.sleep(sleepTimeMillis);
endTimeNanos = System.nanoTime();
shardMetricsReporter.setSleepTimeMillis(sleepTimeMillis);
}
}
return endTimeNanos;
} | [
"protected",
"long",
"adjustRunLoopFrequency",
"(",
"long",
"processingStartTimeNanos",
",",
"long",
"processingEndTimeNanos",
")",
"throws",
"InterruptedException",
"{",
"long",
"endTimeNanos",
"=",
"processingEndTimeNanos",
";",
"if",
"(",
"fetchIntervalMillis",
"!=",
"... | Adjusts loop timing to match target frequency if specified.
@param processingStartTimeNanos The start time of the run loop "work"
@param processingEndTimeNanos The end time of the run loop "work"
@return The System.nanoTime() after the sleep (if any)
@throws InterruptedException | [
"Adjusts",
"loop",
"timing",
"to",
"match",
"target",
"frequency",
"if",
"specified",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java#L285-L298 |
bwkimmel/java-util | src/main/java/ca/eandb/util/ClassUtil.java | ClassUtil.getClassDigest | public static void getClassDigest(Class<?> cl, MessageDigest digest) {
DigestOutputStream out = new DigestOutputStream(NullOutputStream.getInstance(), digest);
try {
writeClassToStream(cl, out);
} catch (IOException e) {
e.printStackTrace();
throw new UnexpectedException(e);
}
} | java | public static void getClassDigest(Class<?> cl, MessageDigest digest) {
DigestOutputStream out = new DigestOutputStream(NullOutputStream.getInstance(), digest);
try {
writeClassToStream(cl, out);
} catch (IOException e) {
e.printStackTrace();
throw new UnexpectedException(e);
}
} | [
"public",
"static",
"void",
"getClassDigest",
"(",
"Class",
"<",
"?",
">",
"cl",
",",
"MessageDigest",
"digest",
")",
"{",
"DigestOutputStream",
"out",
"=",
"new",
"DigestOutputStream",
"(",
"NullOutputStream",
".",
"getInstance",
"(",
")",
",",
"digest",
")",... | Computes a digest from a class' bytecode.
@param cl The <code>Class</code> for which to compute the digest.
@param digest The <code>MessageDigest</code> to update. | [
"Computes",
"a",
"digest",
"from",
"a",
"class",
"bytecode",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/ClassUtil.java#L100-L108 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/xml/assembly/GrokHandler.java | GrokHandler.startElement | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
currentText = new StringBuilder();
} | java | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
currentText = new StringBuilder();
} | [
"@",
"Override",
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"attributes",
")",
"throws",
"SAXException",
"{",
"currentText",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"}"
] | Handles the start element event.
@param uri the uri of the element being processed
@param localName the local name of the element being processed
@param qName the qName of the element being processed
@param attributes the attributes of the element being processed
@throws SAXException thrown if there is an exception processing | [
"Handles",
"the",
"start",
"element",
"event",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/assembly/GrokHandler.java#L104-L107 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java | Jsr250Utils.getMethodsWithAnnotation | private static List<Method> getMethodsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotation, Logger log) {
List<Method> annotatedMethods = new ArrayList<Method>();
Method classMethods[] = clazz.getDeclaredMethods();
for(Method classMethod : classMethods) {
if(classMethod.isAnnotationPresent(annotation) && classMethod.getParameterTypes().length == 0) {
if(!containsMethod(classMethod, annotatedMethods)) {
annotatedMethods.add(classMethod);
}
}
}
Collections.sort(annotatedMethods, new Comparator<Method> () {
@Override
public int compare(Method method1, Method method2) {
return method1.getName().compareTo(method2.getName());
}
});
return annotatedMethods;
} | java | private static List<Method> getMethodsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotation, Logger log) {
List<Method> annotatedMethods = new ArrayList<Method>();
Method classMethods[] = clazz.getDeclaredMethods();
for(Method classMethod : classMethods) {
if(classMethod.isAnnotationPresent(annotation) && classMethod.getParameterTypes().length == 0) {
if(!containsMethod(classMethod, annotatedMethods)) {
annotatedMethods.add(classMethod);
}
}
}
Collections.sort(annotatedMethods, new Comparator<Method> () {
@Override
public int compare(Method method1, Method method2) {
return method1.getName().compareTo(method2.getName());
}
});
return annotatedMethods;
} | [
"private",
"static",
"List",
"<",
"Method",
">",
"getMethodsWithAnnotation",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
",",
"Logger",
"log",
")",
"{",
"List",
"<",
"Method",
">",
"annotatedMet... | Locates all methods annotated with a given annotation that are declared directly in the class passed in alphabetical order.
@param clazz
@param annotation
@param log
@return | [
"Locates",
"all",
"methods",
"annotated",
"with",
"a",
"given",
"annotation",
"that",
"are",
"declared",
"directly",
"in",
"the",
"class",
"passed",
"in",
"alphabetical",
"order",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L209-L227 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/ServerPrepareStatementCache.java | ServerPrepareStatementCache.put | public synchronized ServerPrepareResult put(String key, ServerPrepareResult result) {
ServerPrepareResult cachedServerPrepareResult = super.get(key);
//if there is already some cached data (and not been deallocate), return existing cached data
if (cachedServerPrepareResult != null && cachedServerPrepareResult.incrementShareCounter()) {
return cachedServerPrepareResult;
}
//if no cache data, or been deallocate, put new result in cache
result.setAddToCache();
super.put(key, result);
return null;
} | java | public synchronized ServerPrepareResult put(String key, ServerPrepareResult result) {
ServerPrepareResult cachedServerPrepareResult = super.get(key);
//if there is already some cached data (and not been deallocate), return existing cached data
if (cachedServerPrepareResult != null && cachedServerPrepareResult.incrementShareCounter()) {
return cachedServerPrepareResult;
}
//if no cache data, or been deallocate, put new result in cache
result.setAddToCache();
super.put(key, result);
return null;
} | [
"public",
"synchronized",
"ServerPrepareResult",
"put",
"(",
"String",
"key",
",",
"ServerPrepareResult",
"result",
")",
"{",
"ServerPrepareResult",
"cachedServerPrepareResult",
"=",
"super",
".",
"get",
"(",
"key",
")",
";",
"//if there is already some cached data (and n... | Associates the specified value with the specified key in this map. If the map previously
contained a mapping for the key, the existing cached prepared result shared counter will be
incremented.
@param key key
@param result new prepare result.
@return the previous value associated with key if not been deallocate, or null if there was no
mapping for key. | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"this",
"map",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"key",
"the",
"existing",
"cached",
"prepared",
"result",
"shared",
"counter",
... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/ServerPrepareStatementCache.java#L111-L121 |
UrielCh/ovh-java-sdk | ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java | ApiOvhPrice.xdsl_options_line_lineAction_GET | public OvhPrice xdsl_options_line_lineAction_GET(net.minidev.ovh.api.price.xdsl.options.OvhLineEnum lineAction) throws IOException {
String qPath = "/price/xdsl/options/line/{lineAction}";
StringBuilder sb = path(qPath, lineAction);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | java | public OvhPrice xdsl_options_line_lineAction_GET(net.minidev.ovh.api.price.xdsl.options.OvhLineEnum lineAction) throws IOException {
String qPath = "/price/xdsl/options/line/{lineAction}";
StringBuilder sb = path(qPath, lineAction);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | [
"public",
"OvhPrice",
"xdsl_options_line_lineAction_GET",
"(",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"price",
".",
"xdsl",
".",
"options",
".",
"OvhLineEnum",
"lineAction",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/price/xdsl/o... | Get the price of line action
REST: GET /price/xdsl/options/line/{lineAction}
@param lineAction [required] The type of line action | [
"Get",
"the",
"price",
"of",
"line",
"action"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L63-L68 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/FrameworkUtil.java | FrameworkUtil.setAttribute | public static void setAttribute(String key, Object value) {
assertInitialized();
getAppFramework().setAttribute(key, value);
} | java | public static void setAttribute(String key, Object value) {
assertInitialized();
getAppFramework().setAttribute(key, value);
} | [
"public",
"static",
"void",
"setAttribute",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"assertInitialized",
"(",
")",
";",
"getAppFramework",
"(",
")",
".",
"setAttribute",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Stores an arbitrary named attribute in the attribute cache.
@param key Attribute name.
@param value Attribute value. If null, value is removed from cache.
@throws IllegalStateException if AppFramework is not initialized | [
"Stores",
"an",
"arbitrary",
"named",
"attribute",
"in",
"the",
"attribute",
"cache",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/FrameworkUtil.java#L74-L77 |
upwork/java-upwork | src/com/Upwork/api/Routers/Messages.java | Messages.updateRoomSettings | public JSONObject updateRoomSettings(String company, String roomId, String username, HashMap<String, String> params) throws JSONException {
return oClient.put("/messages/v3/" + company + "/rooms/" + roomId + "/users/" + username, params);
} | java | public JSONObject updateRoomSettings(String company, String roomId, String username, HashMap<String, String> params) throws JSONException {
return oClient.put("/messages/v3/" + company + "/rooms/" + roomId + "/users/" + username, params);
} | [
"public",
"JSONObject",
"updateRoomSettings",
"(",
"String",
"company",
",",
"String",
"roomId",
",",
"String",
"username",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"put",
"(",
... | Update a room settings
@param company Company ID
@param roomId Room ID
@param username User ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Update",
"a",
"room",
"settings"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L140-L142 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.ortho2D | public Matrix4f ortho2D(float left, float right, float bottom, float top) {
return ortho2D(left, right, bottom, top, thisOrNew());
} | java | public Matrix4f ortho2D(float left, float right, float bottom, float top) {
return ortho2D(left, right, bottom, top, thisOrNew());
} | [
"public",
"Matrix4f",
"ortho2D",
"(",
"float",
"left",
",",
"float",
"right",
",",
"float",
"bottom",
",",
"float",
"top",
")",
"{",
"return",
"ortho2D",
"(",
"left",
",",
"right",
",",
"bottom",
",",
"top",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
... | Apply an orthographic projection transformation for a right-handed coordinate system to this matrix.
<p>
This method is equivalent to calling {@link #ortho(float, float, float, float, float, float) ortho()} with
<code>zNear=-1</code> and <code>zFar=+1</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to an orthographic projection without post-multiplying it,
use {@link #setOrtho2D(float, float, float, float) setOrtho2D()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #ortho(float, float, float, float, float, float)
@see #setOrtho2D(float, float, float, float)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@return a matrix holding the result | [
"Apply",
"an",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"to",
"this",
"matrix",
".",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
"{",
"@link",
"#ortho",
"(",
"float",
"f... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7866-L7868 |
marklogic/marklogic-contentpump | mapreduce/src/main/java/com/marklogic/mapreduce/utilities/InternalUtilities.java | InternalUtilities.getUriWithOutputDir | public static String getUriWithOutputDir(DocumentURI key, String outputDir){
String uri = key.getUri();
if (outputDir != null && !outputDir.isEmpty()) {
uri = outputDir.endsWith("/") || uri.startsWith("/") ?
outputDir + uri : outputDir + '/' + uri;
key.setUri(uri);
key.validate();
}
return uri;
} | java | public static String getUriWithOutputDir(DocumentURI key, String outputDir){
String uri = key.getUri();
if (outputDir != null && !outputDir.isEmpty()) {
uri = outputDir.endsWith("/") || uri.startsWith("/") ?
outputDir + uri : outputDir + '/' + uri;
key.setUri(uri);
key.validate();
}
return uri;
} | [
"public",
"static",
"String",
"getUriWithOutputDir",
"(",
"DocumentURI",
"key",
",",
"String",
"outputDir",
")",
"{",
"String",
"uri",
"=",
"key",
".",
"getUri",
"(",
")",
";",
"if",
"(",
"outputDir",
"!=",
"null",
"&&",
"!",
"outputDir",
".",
"isEmpty",
... | If outputDir is available and valid, modify DocumentURI, and return uri
in string
@param key
@param outputDir
@return URI | [
"If",
"outputDir",
"is",
"available",
"and",
"valid",
"modify",
"DocumentURI",
"and",
"return",
"uri",
"in",
"string"
] | train | https://github.com/marklogic/marklogic-contentpump/blob/4c41e4a953301f81a4c655efb2a847603dee8afc/mapreduce/src/main/java/com/marklogic/mapreduce/utilities/InternalUtilities.java#L424-L433 |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.httpRequest | protected Object httpRequest(ApiAction action, HttpRequestMethod method, Map<String, Object> data) throws IOException {
String url = this.apiUrl + "/" + action.toString().toLowerCase();
Type type = new TypeToken<Map<String, Object>>() {}.getType();
String json = GSON.toJson(data, type);
Map<String, String> params = buildPayload(json);
Object response = httpClient.executeHttpRequest(url, method, params, handler, customHeaders);
recordRateLimitInfo(action, method, response);
return response;
} | java | protected Object httpRequest(ApiAction action, HttpRequestMethod method, Map<String, Object> data) throws IOException {
String url = this.apiUrl + "/" + action.toString().toLowerCase();
Type type = new TypeToken<Map<String, Object>>() {}.getType();
String json = GSON.toJson(data, type);
Map<String, String> params = buildPayload(json);
Object response = httpClient.executeHttpRequest(url, method, params, handler, customHeaders);
recordRateLimitInfo(action, method, response);
return response;
} | [
"protected",
"Object",
"httpRequest",
"(",
"ApiAction",
"action",
",",
"HttpRequestMethod",
"method",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"throws",
"IOException",
"{",
"String",
"url",
"=",
"this",
".",
"apiUrl",
"+",
"\"/\"",
"+",
... | Make Http request to Sailthru API for given resource with given method and data
@param action
@param method
@param data parameter data
@return Object
@throws IOException | [
"Make",
"Http",
"request",
"to",
"Sailthru",
"API",
"for",
"given",
"resource",
"with",
"given",
"method",
"and",
"data"
] | train | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L153-L161 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java | StructureTools.addGroupsToStructure | public static void addGroupsToStructure(Structure s, Collection<Group> groups, int model, boolean clone) {
Chain chainGuess = null;
for(Group g : groups) {
chainGuess = addGroupToStructure(s, g, model, chainGuess, clone);
}
} | java | public static void addGroupsToStructure(Structure s, Collection<Group> groups, int model, boolean clone) {
Chain chainGuess = null;
for(Group g : groups) {
chainGuess = addGroupToStructure(s, g, model, chainGuess, clone);
}
} | [
"public",
"static",
"void",
"addGroupsToStructure",
"(",
"Structure",
"s",
",",
"Collection",
"<",
"Group",
">",
"groups",
",",
"int",
"model",
",",
"boolean",
"clone",
")",
"{",
"Chain",
"chainGuess",
"=",
"null",
";",
"for",
"(",
"Group",
"g",
":",
"gr... | Add a list of groups to a new structure. Chains will be automatically
created in the new structure as needed.
@param s structure to receive the group
@param g group to add
@param clone Indicates whether the input groups should be cloned before
being added to the new chain | [
"Add",
"a",
"list",
"of",
"groups",
"to",
"a",
"new",
"structure",
".",
"Chains",
"will",
"be",
"automatically",
"created",
"in",
"the",
"new",
"structure",
"as",
"needed",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java#L587-L592 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/optimization/AbstractStochasticCachingDiffFunction.java | AbstractStochasticCachingDiffFunction.getHdotVFiniteDifference | private void getHdotVFiniteDifference(double[] x, double[] v, double[] curDerivative){
double h = finiteDifferenceStepSize;
double hInv = 1/h; // this avoids dividing too much since it's a bit more expensive than multiplying
if (gradPerturbed == null) {
gradPerturbed = new double[x.length];
System.out.println("Setting approximate gradient.");
}
if (xPerturbed == null){
xPerturbed = new double[x.length];
System.out.println("Setting perturbed.");
}
if (HdotV == null) {
HdotV = new double[x.length];
System.out.println("Setting H dot V.");
}
// This adds h*v to x ---> x = x + h*v
for( int i = 0;i<x.length;i++){
xPerturbed[i] = x[i] + h*v[i];
}
double prevValue = value;
recalculatePrevBatch = true;
calculateStochastic(xPerturbed,null,thisBatch); // Call the calculate function without updating the batch
// System.arraycopy(derivative, 0, gradPerturbed, 0, gradPerturbed.length);
// This comes up with the approximate difference, and renormalizes it on h.
for( int i = 0;i<x.length;i++){
double tmp = (derivative[i]-curDerivative[i]);
HdotV[i] = hInv*(tmp);
}
//Make sure the original derivative is in place
System.arraycopy(curDerivative,0,derivative,0,derivative.length);
value = prevValue;
hasNewVals = false;
recalculatePrevBatch = false;
returnPreviousValues = false;
} | java | private void getHdotVFiniteDifference(double[] x, double[] v, double[] curDerivative){
double h = finiteDifferenceStepSize;
double hInv = 1/h; // this avoids dividing too much since it's a bit more expensive than multiplying
if (gradPerturbed == null) {
gradPerturbed = new double[x.length];
System.out.println("Setting approximate gradient.");
}
if (xPerturbed == null){
xPerturbed = new double[x.length];
System.out.println("Setting perturbed.");
}
if (HdotV == null) {
HdotV = new double[x.length];
System.out.println("Setting H dot V.");
}
// This adds h*v to x ---> x = x + h*v
for( int i = 0;i<x.length;i++){
xPerturbed[i] = x[i] + h*v[i];
}
double prevValue = value;
recalculatePrevBatch = true;
calculateStochastic(xPerturbed,null,thisBatch); // Call the calculate function without updating the batch
// System.arraycopy(derivative, 0, gradPerturbed, 0, gradPerturbed.length);
// This comes up with the approximate difference, and renormalizes it on h.
for( int i = 0;i<x.length;i++){
double tmp = (derivative[i]-curDerivative[i]);
HdotV[i] = hInv*(tmp);
}
//Make sure the original derivative is in place
System.arraycopy(curDerivative,0,derivative,0,derivative.length);
value = prevValue;
hasNewVals = false;
recalculatePrevBatch = false;
returnPreviousValues = false;
} | [
"private",
"void",
"getHdotVFiniteDifference",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"v",
",",
"double",
"[",
"]",
"curDerivative",
")",
"{",
"double",
"h",
"=",
"finiteDifferenceStepSize",
";",
"double",
"hInv",
"=",
"1",
"/",
"h",
";",... | Calculate the Hessian vector product with a vector v of the current function based on a finite difference approximation.
This is done using the approximation:
H.v ~ ( Grad( x + h * v ) - Grad( x ) ) / h
Note that this method will not be exact, and the value of h should be choosen to be small enough to avoid truncation error
due to neglecting second order taylor series terms, and big enough to avoid numerical error which is almost gaurenteed
since the operation involves subtracting similar values and dividing by a small number. In general a step size of
h = 1e-4 has proved to provide accurate enough calculations.
@param x the point at which the hessian should be calculated
@param v the vector for the vector product ... thus the function will return H(x) . v
@param curDerivative the derivative at x. Note this must have been calculated using the same batchSize | [
"Calculate",
"the",
"Hessian",
"vector",
"product",
"with",
"a",
"vector",
"v",
"of",
"the",
"current",
"function",
"based",
"on",
"a",
"finite",
"difference",
"approximation",
".",
"This",
"is",
"done",
"using",
"the",
"approximation",
":"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/optimization/AbstractStochasticCachingDiffFunction.java#L422-L470 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.