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 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataHelper.java | InterceptorMetaDataHelper.validateLifeCycleSignature | public static void validateLifeCycleSignature(InterceptorMethodKind kind, String lifeCycle, Method m, boolean ejbClass, J2EEName name)
throws EJBConfigurationException
{
// Validate method signature except for the parameter types,
// which is done by this method.
validateLifeCycleSignatureExceptParameters(kind, lifeCycle, m, ejbClass, name); // d450431
// Now verify method parameter types.
Class<?>[] parmTypes = m.getParameterTypes();
if (ejbClass)
{
// This is EJB class, so interceptor should have no parameters.
if (parmTypes.length != 0)
{
// CNTR0231E: "{0}" interceptor method "{1}" signature is incorrect.
String method = m.toGenericString();
Tr.error(tc, "INVALID_LIFECYCLE_SIGNATURE_CNTR0231E", new Object[] { method, lifeCycle });
throw new EJBConfigurationException(lifeCycle + " interceptor \"" + method
+ "\" must have zero parameters.");
}
}
else
{
// This is an interceptor class, so InvocationContext is a required parameter
// for the interceptor method.
if ((parmTypes.length == 1) && (parmTypes[0].equals(InvocationContext.class)))
{
// Has correct signature of 1 parameter of type InvocationContext
}
else
{
// CNTR0232E: The {0} method does not have the required
// method signature for a {1} method of a interceptor class.
String method = m.toGenericString();
Tr.error(tc, "INVALID_LIFECYCLE_SIGNATURE_CNTR0232E", new Object[] { method, lifeCycle });
throw new EJBConfigurationException("CNTR0232E: The \"" + method
+ "\" method does not have the required method signature for a \""
+ lifeCycle + "\" method of a interceptor class.");
}
}
} | java | public static void validateLifeCycleSignature(InterceptorMethodKind kind, String lifeCycle, Method m, boolean ejbClass, J2EEName name)
throws EJBConfigurationException
{
// Validate method signature except for the parameter types,
// which is done by this method.
validateLifeCycleSignatureExceptParameters(kind, lifeCycle, m, ejbClass, name); // d450431
// Now verify method parameter types.
Class<?>[] parmTypes = m.getParameterTypes();
if (ejbClass)
{
// This is EJB class, so interceptor should have no parameters.
if (parmTypes.length != 0)
{
// CNTR0231E: "{0}" interceptor method "{1}" signature is incorrect.
String method = m.toGenericString();
Tr.error(tc, "INVALID_LIFECYCLE_SIGNATURE_CNTR0231E", new Object[] { method, lifeCycle });
throw new EJBConfigurationException(lifeCycle + " interceptor \"" + method
+ "\" must have zero parameters.");
}
}
else
{
// This is an interceptor class, so InvocationContext is a required parameter
// for the interceptor method.
if ((parmTypes.length == 1) && (parmTypes[0].equals(InvocationContext.class)))
{
// Has correct signature of 1 parameter of type InvocationContext
}
else
{
// CNTR0232E: The {0} method does not have the required
// method signature for a {1} method of a interceptor class.
String method = m.toGenericString();
Tr.error(tc, "INVALID_LIFECYCLE_SIGNATURE_CNTR0232E", new Object[] { method, lifeCycle });
throw new EJBConfigurationException("CNTR0232E: The \"" + method
+ "\" method does not have the required method signature for a \""
+ lifeCycle + "\" method of a interceptor class.");
}
}
} | [
"public",
"static",
"void",
"validateLifeCycleSignature",
"(",
"InterceptorMethodKind",
"kind",
",",
"String",
"lifeCycle",
",",
"Method",
"m",
",",
"boolean",
"ejbClass",
",",
"J2EEName",
"name",
")",
"throws",
"EJBConfigurationException",
"{",
"// Validate method sign... | Verify that a specified life cycle event interceptor method has correct
method modifiers, parameter types, return type, and exception types for
the throws clause. Note, if parameter types is known to be valid,
then use the {@link #validateLifeCycleSignatureExceptParameters(String, Method)
method of this class to skip parameter type validation.
@param lifeCycle is a string that identifies the type of life cycle event callback.
@param m is the java reflection Method object for the life cycle interceptor method.
@param ejbClass must be boolean true if the m is a method of the EJB class.
If m is a method of an interceptor or a super class of the EJB class,
then boolean false must be specified.
@throws EJBConfigurationException is thrown if any configuration error is detected. | [
"Verify",
"that",
"a",
"specified",
"life",
"cycle",
"event",
"interceptor",
"method",
"has",
"correct",
"method",
"modifiers",
"parameter",
"types",
"return",
"type",
"and",
"exception",
"types",
"for",
"the",
"throws",
"clause",
".",
"Note",
"if",
"parameter",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataHelper.java#L787-L827 |
joniles/mpxj | src/main/java/net/sf/mpxj/utility/TimephasedUtility.java | TimephasedUtility.getRangeCost | private Double getRangeCost(ProjectCalendar projectCalendar, TimescaleUnits rangeUnits, DateRange range, List<TimephasedCost> assignments, int startIndex)
{
Double result;
switch (rangeUnits)
{
case MINUTES:
case HOURS:
{
result = getRangeCostSubDay(projectCalendar, rangeUnits, range, assignments, startIndex);
break;
}
default:
{
result = getRangeCostWholeDay(projectCalendar, rangeUnits, range, assignments, startIndex);
break;
}
}
return result;
} | java | private Double getRangeCost(ProjectCalendar projectCalendar, TimescaleUnits rangeUnits, DateRange range, List<TimephasedCost> assignments, int startIndex)
{
Double result;
switch (rangeUnits)
{
case MINUTES:
case HOURS:
{
result = getRangeCostSubDay(projectCalendar, rangeUnits, range, assignments, startIndex);
break;
}
default:
{
result = getRangeCostWholeDay(projectCalendar, rangeUnits, range, assignments, startIndex);
break;
}
}
return result;
} | [
"private",
"Double",
"getRangeCost",
"(",
"ProjectCalendar",
"projectCalendar",
",",
"TimescaleUnits",
"rangeUnits",
",",
"DateRange",
"range",
",",
"List",
"<",
"TimephasedCost",
">",
"assignments",
",",
"int",
"startIndex",
")",
"{",
"Double",
"result",
";",
"sw... | For a given date range, determine the cost, based on the
timephased resource assignment data.
@param projectCalendar calendar used for the resource assignment calendar
@param rangeUnits timescale units
@param range target date range
@param assignments timephased resource assignments
@param startIndex index at which to start searching through the timephased resource assignments
@return work duration | [
"For",
"a",
"given",
"date",
"range",
"determine",
"the",
"cost",
"based",
"on",
"the",
"timephased",
"resource",
"assignment",
"data",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/TimephasedUtility.java#L396-L417 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/Parameterized.java | Parameterized.setParameters | protected final void setParameters(Map<String, String> parameters) {
if (parameters == null) {
m_parameters.clear();
}
else {
m_parameters.clear();
Parameter p;
for (String key:parameters.keySet()) {
p = new Parameter(key);
p.setValue(parameters.get(key));
m_parameters.put(key, p);
}
}
} | java | protected final void setParameters(Map<String, String> parameters) {
if (parameters == null) {
m_parameters.clear();
}
else {
m_parameters.clear();
Parameter p;
for (String key:parameters.keySet()) {
p = new Parameter(key);
p.setValue(parameters.get(key));
m_parameters.put(key, p);
}
}
} | [
"protected",
"final",
"void",
"setParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"if",
"(",
"parameters",
"==",
"null",
")",
"{",
"m_parameters",
".",
"clear",
"(",
")",
";",
"}",
"else",
"{",
"m_parameters",
".",
"... | Sets the parameters with name-value pairs from the supplied Map. This is
protected because it is intended to only be called by subclasses where
super(Map m) is not possible to call at the start of the constructor.
Server.java:Server(URL) is an example of this.
@param parameters
The map from which to derive the name-value pairs. | [
"Sets",
"the",
"parameters",
"with",
"name",
"-",
"value",
"pairs",
"from",
"the",
"supplied",
"Map",
".",
"This",
"is",
"protected",
"because",
"it",
"is",
"intended",
"to",
"only",
"be",
"called",
"by",
"subclasses",
"where",
"super",
"(",
"Map",
"m",
... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/Parameterized.java#L62-L75 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java | EJSHome.createRemoteBusinessObject | public Object createRemoteBusinessObject(String interfaceName, boolean useSupporting)
throws RemoteException,
CreateException,
ClassNotFoundException,
EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "createRemoteBusinessObject: " + interfaceName); // d367572.7
int interfaceIndex;
if (useSupporting)
{
interfaceIndex = beanMetaData.getSupportingRemoteBusinessInterfaceIndex(interfaceName);
}
else
{
interfaceIndex = beanMetaData.getRemoteBusinessInterfaceIndex(interfaceName);
if (interfaceIndex == -1)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "createRemoteBusinessObject : IllegalStateException : " +
"Requested business interface not found : " +
interfaceName);
throw new IllegalStateException("Requested business interface not found : " + interfaceName);
}
}
Object result = createRemoteBusinessObject(interfaceIndex, null);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc,
"createRemoteBusinessObject returning: " + Util.identity(result)); // d367572.7
return result;
} | java | public Object createRemoteBusinessObject(String interfaceName, boolean useSupporting)
throws RemoteException,
CreateException,
ClassNotFoundException,
EJBConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "createRemoteBusinessObject: " + interfaceName); // d367572.7
int interfaceIndex;
if (useSupporting)
{
interfaceIndex = beanMetaData.getSupportingRemoteBusinessInterfaceIndex(interfaceName);
}
else
{
interfaceIndex = beanMetaData.getRemoteBusinessInterfaceIndex(interfaceName);
if (interfaceIndex == -1)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "createRemoteBusinessObject : IllegalStateException : " +
"Requested business interface not found : " +
interfaceName);
throw new IllegalStateException("Requested business interface not found : " + interfaceName);
}
}
Object result = createRemoteBusinessObject(interfaceIndex, null);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc,
"createRemoteBusinessObject returning: " + Util.identity(result)); // d367572.7
return result;
} | [
"public",
"Object",
"createRemoteBusinessObject",
"(",
"String",
"interfaceName",
",",
"boolean",
"useSupporting",
")",
"throws",
"RemoteException",
",",
"CreateException",
",",
"ClassNotFoundException",
",",
"EJBConfigurationException",
"{",
"final",
"boolean",
"isTraceOn"... | Returns an Object (wrapper) representing the specified EJB 3.0
Business Remote Interface, managed by this home. <p>
This method provides a Business Object (wrapper) factory capability,
for use during business interface injection or lookup. It is
called directly for Stateless Session beans, or through the
basic wrapper for Stateful Session beans. <p>
For Stateless Session beans, a 'singleton' (per home) wrapper instance
is returned, since all Stateless Session beans are interchangeable.
Since no customer code is invoked, no pre or postInvoke calls are
required. <p>
For Stateful Session beans, a new instance of a Stateful Session bean
is created, and the corresponding new wrapper instance is returned.
Since a new instance will be constructed, this method must be wrapped
with pre and postInvoke calls. <p>
@param interfaceName One of the remote business interfaces for this
session bean
@param useSupporting whether or not to try to match the passed in interface
to a known sublcass (ejb-link / beanName situation)
@return The business object (wrapper) corresponding to the given
business interface.
@throws RemoteException
@throws CreateException
@throws ClassNotFoundException
@throws EJBConfigurationException | [
"Returns",
"an",
"Object",
"(",
"wrapper",
")",
"representing",
"the",
"specified",
"EJB",
"3",
".",
"0",
"Business",
"Remote",
"Interface",
"managed",
"by",
"this",
"home",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java#L1611-L1650 |
micronaut-projects/micronaut-core | tracing/src/main/java/io/micronaut/tracing/instrument/http/AbstractOpenTracingFilter.java | AbstractOpenTracingFilter.setErrorTags | protected void setErrorTags(Span span, Throwable error) {
if (error != null) {
String message = error.getMessage();
if (message == null) {
message = error.getClass().getSimpleName();
}
span.setTag(TAG_ERROR, message);
}
} | java | protected void setErrorTags(Span span, Throwable error) {
if (error != null) {
String message = error.getMessage();
if (message == null) {
message = error.getClass().getSimpleName();
}
span.setTag(TAG_ERROR, message);
}
} | [
"protected",
"void",
"setErrorTags",
"(",
"Span",
"span",
",",
"Throwable",
"error",
")",
"{",
"if",
"(",
"error",
"!=",
"null",
")",
"{",
"String",
"message",
"=",
"error",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"message",
"==",
"null",
")",
"... | Sets the error tags to use on the span.
@param span The span
@param error The error | [
"Sets",
"the",
"error",
"tags",
"to",
"use",
"on",
"the",
"span",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/tracing/src/main/java/io/micronaut/tracing/instrument/http/AbstractOpenTracingFilter.java#L80-L88 |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Capacities.java | Capacities.createSkillDelegatorIfPossible | @Pure
public static <C extends Capacity> C createSkillDelegatorIfPossible(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller)
throws ClassCastException {
try {
return Capacities.createSkillDelegator(originalSkill, capacity, capacityCaller);
} catch (Exception e) {
return capacity.cast(originalSkill);
}
} | java | @Pure
public static <C extends Capacity> C createSkillDelegatorIfPossible(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller)
throws ClassCastException {
try {
return Capacities.createSkillDelegator(originalSkill, capacity, capacityCaller);
} catch (Exception e) {
return capacity.cast(originalSkill);
}
} | [
"@",
"Pure",
"public",
"static",
"<",
"C",
"extends",
"Capacity",
">",
"C",
"createSkillDelegatorIfPossible",
"(",
"Skill",
"originalSkill",
",",
"Class",
"<",
"C",
">",
"capacity",
",",
"AgentTrait",
"capacityCaller",
")",
"throws",
"ClassCastException",
"{",
"... | Create a delegator for the given skill when it is possible.
<p>The delegator is wrapping the original skill in order to set the value of the caller
that will be replied by {@link #getCaller()}. The associated caller is given as argument.
<p>The delegator is an instance of an specific inner type, sub-type of {@link Capacity.ContextAwareCapacityWrapper},
which is declared in the given {@code capacity}.
<p>This functions assumes that the name of the definition type is the same as {@link Capacity.ContextAwareCapacityWrapper},
and this definition extends the delegator definition of the first super type of the {@code capacity}, and implements
all the super types of the {@code capacity}. The expected constructor for this inner type has the same
signature as the one of {@link Capacity.ContextAwareCapacityWrapper}.
If the delegator instance cannot be created due to to inner type not found, invalid constructor signature,
run-time exception when creating the instance, this function replies the original skill.
<p>The function {@link #createSkillDelegator(Skill, Class, AgentTrait)} is a similar function than this
function, except that it fails when the delegator instance cannot be created.
@param <C> the type of the capacity.
@param originalSkill the skill to delegate to after ensure the capacity caller is correctly set.
@param capacity the capacity that contains the definition of the delegator.
@param capacityCaller the caller of the capacity functions.
@return the delegator, or the original skill.
@throws ClassCastException if the skill is not implementing the capacity.
@see #createSkillDelegator(Skill, Class, AgentTrait) | [
"Create",
"a",
"delegator",
"for",
"the",
"given",
"skill",
"when",
"it",
"is",
"possible",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Capacities.java#L122-L130 |
aehrc/ontology-core | ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java | RF2Importer.loadModuleDependencies | protected IModuleDependencyRefset loadModuleDependencies(RF2Input input) throws ImportException {
Set<InputStream> iss = new HashSet<>();
InputType inputType = input.getInputType();
for(String md : input.getModuleDependenciesRefsetFiles()) {
try {
iss.add(input.getInputStream(md));
} catch (NullPointerException | IOException e) {
final String message = StructuredLog.ModuleLoadFailure.error(log, inputType, md, e);
throw new ImportException(message, e);
}
}
IModuleDependencyRefset res = RefsetImporter.importModuleDependencyRefset(iss);
return res;
} | java | protected IModuleDependencyRefset loadModuleDependencies(RF2Input input) throws ImportException {
Set<InputStream> iss = new HashSet<>();
InputType inputType = input.getInputType();
for(String md : input.getModuleDependenciesRefsetFiles()) {
try {
iss.add(input.getInputStream(md));
} catch (NullPointerException | IOException e) {
final String message = StructuredLog.ModuleLoadFailure.error(log, inputType, md, e);
throw new ImportException(message, e);
}
}
IModuleDependencyRefset res = RefsetImporter.importModuleDependencyRefset(iss);
return res;
} | [
"protected",
"IModuleDependencyRefset",
"loadModuleDependencies",
"(",
"RF2Input",
"input",
")",
"throws",
"ImportException",
"{",
"Set",
"<",
"InputStream",
">",
"iss",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"InputType",
"inputType",
"=",
"input",
".",
"ge... | Loads all the module dependency information from all RF2 inputs into a single {@link IModuleDependencyRefset}.
@return
@throws ImportException | [
"Loads",
"all",
"the",
"module",
"dependency",
"information",
"from",
"all",
"RF2",
"inputs",
"into",
"a",
"single",
"{",
"@link",
"IModuleDependencyRefset",
"}",
"."
] | train | https://github.com/aehrc/ontology-core/blob/446aa691119f2bbcb8d184566084b8da7a07a44e/ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java#L138-L152 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getUntilFirstExcl | @Nullable
public static String getUntilFirstExcl (@Nullable final String sStr, @Nullable final String sSearch)
{
return _getUntilFirst (sStr, sSearch, false);
} | java | @Nullable
public static String getUntilFirstExcl (@Nullable final String sStr, @Nullable final String sSearch)
{
return _getUntilFirst (sStr, sSearch, false);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getUntilFirstExcl",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
")",
"{",
"return",
"_getUntilFirst",
"(",
"sStr",
",",
"sSearch",
",",
"false",
")",
";"... | Get everything from the string up to and excluding the first passed string.
@param sStr
The source string. May be <code>null</code>.
@param sSearch
The string to search. May be <code>null</code>.
@return <code>null</code> if the passed string does not contain the search
string. If the search string is empty, the empty string is returned. | [
"Get",
"everything",
"from",
"the",
"string",
"up",
"to",
"and",
"excluding",
"the",
"first",
"passed",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4818-L4822 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java | StringUtils.requireNotNullNorEmpty | public static <CS extends CharSequence> CS requireNotNullNorEmpty(CS cs, String message) {
if (isNullOrEmpty(cs)) {
throw new IllegalArgumentException(message);
}
return cs;
} | java | public static <CS extends CharSequence> CS requireNotNullNorEmpty(CS cs, String message) {
if (isNullOrEmpty(cs)) {
throw new IllegalArgumentException(message);
}
return cs;
} | [
"public",
"static",
"<",
"CS",
"extends",
"CharSequence",
">",
"CS",
"requireNotNullNorEmpty",
"(",
"CS",
"cs",
",",
"String",
"message",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"cs",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"messag... | Require a {@link CharSequence} to be neither null, nor empty.
@param cs CharSequence
@param message error message
@param <CS> CharSequence type
@return cs | [
"Require",
"a",
"{",
"@link",
"CharSequence",
"}",
"to",
"be",
"neither",
"null",
"nor",
"empty",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java#L449-L454 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java | CategoryGraph.getPathLengthInNodes | public int getPathLengthInNodes(Category node1, Category node2) throws WikiApiException {
int retValue = getPathLengthInEdges(node1, node2);
if (retValue == 0) {
return 0;
}
else if (retValue > 0) {
return (--retValue);
}
else if (retValue == -1) {
return -1;
}
else {
throw new WikiApiException("Unknown return value.");
}
} | java | public int getPathLengthInNodes(Category node1, Category node2) throws WikiApiException {
int retValue = getPathLengthInEdges(node1, node2);
if (retValue == 0) {
return 0;
}
else if (retValue > 0) {
return (--retValue);
}
else if (retValue == -1) {
return -1;
}
else {
throw new WikiApiException("Unknown return value.");
}
} | [
"public",
"int",
"getPathLengthInNodes",
"(",
"Category",
"node1",
",",
"Category",
"node2",
")",
"throws",
"WikiApiException",
"{",
"int",
"retValue",
"=",
"getPathLengthInEdges",
"(",
"node1",
",",
"node2",
")",
";",
"if",
"(",
"retValue",
"==",
"0",
")",
... | Gets the path length between two category nodes - measured in "nodes".
@param node1 The first node.
@param node2 The second node.
@return The number of nodes of the path between node1 and node2. 0, if the nodes are identical or neighbors. -1, if no path exists. | [
"Gets",
"the",
"path",
"length",
"between",
"two",
"category",
"nodes",
"-",
"measured",
"in",
"nodes",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java#L779-L795 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/AbstractJcrExporter.java | AbstractJcrExporter.exportView | public void exportView( Node node,
OutputStream os,
boolean skipBinary,
boolean noRecurse ) throws IOException, RepositoryException {
try {
exportView(node, new StreamingContentHandler(os, UNEXPORTABLE_NAMESPACES), skipBinary, noRecurse);
os.flush();
} catch (SAXException se) {
throw new RepositoryException(se);
}
} | java | public void exportView( Node node,
OutputStream os,
boolean skipBinary,
boolean noRecurse ) throws IOException, RepositoryException {
try {
exportView(node, new StreamingContentHandler(os, UNEXPORTABLE_NAMESPACES), skipBinary, noRecurse);
os.flush();
} catch (SAXException se) {
throw new RepositoryException(se);
}
} | [
"public",
"void",
"exportView",
"(",
"Node",
"node",
",",
"OutputStream",
"os",
",",
"boolean",
"skipBinary",
",",
"boolean",
"noRecurse",
")",
"throws",
"IOException",
",",
"RepositoryException",
"{",
"try",
"{",
"exportView",
"(",
"node",
",",
"new",
"Stream... | Exports <code>node</code> (or the subtree rooted at <code>node</code>) into an XML document that is written to
<code>os</code>.
@param node the node which should be exported. If <code>noRecursion</code> was set to <code>false</code> in the
constructor, the entire subtree rooted at <code>node</code> will be exported.
@param os the {@link OutputStream} to which the XML document will be written
@param skipBinary if <code>true</code>, indicates that binary properties should not be exported
@param noRecurse if<code>true</code>, indicates that only the given node should be exported, otherwise a recursive export
and not any of its child nodes.
@throws RepositoryException if an exception occurs accessing the content repository, generating the XML document, or
writing it to the output stream <code>os</code>.
@throws IOException if there is a problem writing to the supplied stream | [
"Exports",
"<code",
">",
"node<",
"/",
"code",
">",
"(",
"or",
"the",
"subtree",
"rooted",
"at",
"<code",
">",
"node<",
"/",
"code",
">",
")",
"into",
"an",
"XML",
"document",
"that",
"is",
"written",
"to",
"<code",
">",
"os<",
"/",
"code",
">",
".... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/AbstractJcrExporter.java#L195-L205 |
GoogleCloudPlatform/bigdata-interop | bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryConfiguration.java | BigQueryConfiguration.getTemporaryPathRoot | public static String getTemporaryPathRoot(Configuration conf, @Nullable JobID jobId)
throws IOException {
// Try using the temporary gcs path.
String pathRoot = conf.get(BigQueryConfiguration.TEMP_GCS_PATH_KEY);
if (Strings.isNullOrEmpty(pathRoot)) {
checkNotNull(jobId, "jobId is required if '%s' is not set", TEMP_GCS_PATH_KEY);
logger.atInfo().log(
"Fetching key '%s' since '%s' isn't set explicitly.", GCS_BUCKET_KEY, TEMP_GCS_PATH_KEY);
String gcsBucket = conf.get(GCS_BUCKET_KEY);
if (Strings.isNullOrEmpty(gcsBucket)) {
throw new IOException("Must supply a value for configuration setting: " + GCS_BUCKET_KEY);
}
pathRoot = String.format("gs://%s/hadoop/tmp/bigquery/%s", gcsBucket, jobId);
}
logger.atInfo().log("Using working path: '%s'", pathRoot);
Path workingPath = new Path(pathRoot);
FileSystem fs = workingPath.getFileSystem(conf);
Preconditions.checkState(
fs instanceof GoogleHadoopFileSystemBase,
"Export FS must derive from GoogleHadoopFileSystemBase.");
return pathRoot;
} | java | public static String getTemporaryPathRoot(Configuration conf, @Nullable JobID jobId)
throws IOException {
// Try using the temporary gcs path.
String pathRoot = conf.get(BigQueryConfiguration.TEMP_GCS_PATH_KEY);
if (Strings.isNullOrEmpty(pathRoot)) {
checkNotNull(jobId, "jobId is required if '%s' is not set", TEMP_GCS_PATH_KEY);
logger.atInfo().log(
"Fetching key '%s' since '%s' isn't set explicitly.", GCS_BUCKET_KEY, TEMP_GCS_PATH_KEY);
String gcsBucket = conf.get(GCS_BUCKET_KEY);
if (Strings.isNullOrEmpty(gcsBucket)) {
throw new IOException("Must supply a value for configuration setting: " + GCS_BUCKET_KEY);
}
pathRoot = String.format("gs://%s/hadoop/tmp/bigquery/%s", gcsBucket, jobId);
}
logger.atInfo().log("Using working path: '%s'", pathRoot);
Path workingPath = new Path(pathRoot);
FileSystem fs = workingPath.getFileSystem(conf);
Preconditions.checkState(
fs instanceof GoogleHadoopFileSystemBase,
"Export FS must derive from GoogleHadoopFileSystemBase.");
return pathRoot;
} | [
"public",
"static",
"String",
"getTemporaryPathRoot",
"(",
"Configuration",
"conf",
",",
"@",
"Nullable",
"JobID",
"jobId",
")",
"throws",
"IOException",
"{",
"// Try using the temporary gcs path.",
"String",
"pathRoot",
"=",
"conf",
".",
"get",
"(",
"BigQueryConfigur... | Resolves to provided {@link #TEMP_GCS_PATH_KEY} or fallbacks to a temporary path based on
{@link #GCS_BUCKET_KEY} and {@code jobId}.
@param conf the configuration to fetch the keys from.
@param jobId the ID of the job requesting a working path. Optional (could be {@code null}) if
{@link #TEMP_GCS_PATH_KEY} is provided.
@return the temporary directory path.
@throws IOException if the file system of the derived working path isn't a derivative of
GoogleHadoopFileSystemBase. | [
"Resolves",
"to",
"provided",
"{",
"@link",
"#TEMP_GCS_PATH_KEY",
"}",
"or",
"fallbacks",
"to",
"a",
"temporary",
"path",
"based",
"on",
"{",
"@link",
"#GCS_BUCKET_KEY",
"}",
"and",
"{",
"@code",
"jobId",
"}",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryConfiguration.java#L310-L336 |
centic9/commons-dost | src/main/java/org/dstadler/commons/date/DateParser.java | DateParser.computeTimeAgoString | public static String computeTimeAgoString(long ts, String suffix) {
long now = System.currentTimeMillis();
checkArgument(ts <= now, "Cannot handle timestamp in the future" +
", now: " + now + "/" + new Date(now) +
", ts: " + ts + "/" + new Date(ts));
long diff = now - ts;
return timeToReadable(diff, suffix);
} | java | public static String computeTimeAgoString(long ts, String suffix) {
long now = System.currentTimeMillis();
checkArgument(ts <= now, "Cannot handle timestamp in the future" +
", now: " + now + "/" + new Date(now) +
", ts: " + ts + "/" + new Date(ts));
long diff = now - ts;
return timeToReadable(diff, suffix);
} | [
"public",
"static",
"String",
"computeTimeAgoString",
"(",
"long",
"ts",
",",
"String",
"suffix",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"checkArgument",
"(",
"ts",
"<=",
"now",
",",
"\"Cannot handle timestamp in the fut... | Takes the time in milliseconds since the epoch and
converts it into a string of "x days/hours/minutes/seconds"
compared to the current time.
@param ts The timestamp in milliseconds since the epoch
@param suffix Some text that is appended only if there is a time-difference, i.e.
it is not appended when the time is now.
@return A readable string with a short description of how long ago the ts was. | [
"Takes",
"the",
"time",
"in",
"milliseconds",
"since",
"the",
"epoch",
"and",
"converts",
"it",
"into",
"a",
"string",
"of",
"x",
"days",
"/",
"hours",
"/",
"minutes",
"/",
"seconds",
"compared",
"to",
"the",
"current",
"time",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/date/DateParser.java#L168-L177 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java | ClassPath.newInstance | public static <T> T newInstance(Class<?> aClass, Class<?> parameterType,Object initarg)
throws SetupException
{
Class<?>[] paramTypes = {parameterType};
Object[] initArgs = {initarg};
return newInstance(aClass,paramTypes,initArgs);
} | java | public static <T> T newInstance(Class<?> aClass, Class<?> parameterType,Object initarg)
throws SetupException
{
Class<?>[] paramTypes = {parameterType};
Object[] initArgs = {initarg};
return newInstance(aClass,paramTypes,initArgs);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"Class",
"<",
"?",
">",
"parameterType",
",",
"Object",
"initarg",
")",
"throws",
"SetupException",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
... | Use a constructor of the a class to create an instance
@param aClass the class object
@param parameterType the parameter type for the constructor
@param initarg the initial constructor argument
@param <T> the class type
@return the new created object
@throws SetupException when an setup error occurs | [
"Use",
"a",
"constructor",
"of",
"the",
"a",
"class",
"to",
"create",
"an",
"instance"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java#L165-L172 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/SampleableConcurrentHashMap.java | SampleableConcurrentHashMap.fetchEntries | public int fetchEntries(int tableIndex, int size, List<Map.Entry<K, V>> entries) {
final long now = Clock.currentTimeMillis();
final Segment<K, V> segment = segments[0];
final HashEntry<K, V>[] currentTable = segment.table;
int nextTableIndex;
if (tableIndex >= 0 && tableIndex < segment.table.length) {
nextTableIndex = tableIndex;
} else {
nextTableIndex = currentTable.length - 1;
}
int counter = 0;
while (nextTableIndex >= 0 && counter < size) {
HashEntry<K, V> nextEntry = currentTable[nextTableIndex--];
while (nextEntry != null) {
if (nextEntry.key() != null) {
final V value = nextEntry.value();
if (isValidForFetching(value, now)) {
K key = nextEntry.key();
entries.add(new AbstractMap.SimpleEntry<K, V>(key, value));
counter++;
}
}
nextEntry = nextEntry.next;
}
}
return nextTableIndex;
} | java | public int fetchEntries(int tableIndex, int size, List<Map.Entry<K, V>> entries) {
final long now = Clock.currentTimeMillis();
final Segment<K, V> segment = segments[0];
final HashEntry<K, V>[] currentTable = segment.table;
int nextTableIndex;
if (tableIndex >= 0 && tableIndex < segment.table.length) {
nextTableIndex = tableIndex;
} else {
nextTableIndex = currentTable.length - 1;
}
int counter = 0;
while (nextTableIndex >= 0 && counter < size) {
HashEntry<K, V> nextEntry = currentTable[nextTableIndex--];
while (nextEntry != null) {
if (nextEntry.key() != null) {
final V value = nextEntry.value();
if (isValidForFetching(value, now)) {
K key = nextEntry.key();
entries.add(new AbstractMap.SimpleEntry<K, V>(key, value));
counter++;
}
}
nextEntry = nextEntry.next;
}
}
return nextTableIndex;
} | [
"public",
"int",
"fetchEntries",
"(",
"int",
"tableIndex",
",",
"int",
"size",
",",
"List",
"<",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"entries",
")",
"{",
"final",
"long",
"now",
"=",
"Clock",
".",
"currentTimeMillis",
"(",
")",
";",
... | Fetches entries from given <code>tableIndex</code> as <code>size</code>
and puts them into <code>entries</code> list.
@param tableIndex Index (checkpoint) for starting point of fetch operation
@param size Count of how many entries will be fetched
@param entries List that fetched entries will be put into
@return the next index (checkpoint) for later fetches | [
"Fetches",
"entries",
"from",
"given",
"<code",
">",
"tableIndex<",
"/",
"code",
">",
"as",
"<code",
">",
"size<",
"/",
"code",
">",
"and",
"puts",
"them",
"into",
"<code",
">",
"entries<",
"/",
"code",
">",
"list",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/SampleableConcurrentHashMap.java#L102-L128 |
liferay/com-liferay-commerce | commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java | CommerceCurrencyPersistenceImpl.removeByG_P | @Override
public void removeByG_P(long groupId, boolean primary) {
for (CommerceCurrency commerceCurrency : findByG_P(groupId, primary,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceCurrency);
}
} | java | @Override
public void removeByG_P(long groupId, boolean primary) {
for (CommerceCurrency commerceCurrency : findByG_P(groupId, primary,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceCurrency);
}
} | [
"@",
"Override",
"public",
"void",
"removeByG_P",
"(",
"long",
"groupId",
",",
"boolean",
"primary",
")",
"{",
"for",
"(",
"CommerceCurrency",
"commerceCurrency",
":",
"findByG_P",
"(",
"groupId",
",",
"primary",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUt... | Removes all the commerce currencies where groupId = ? and primary = ? from the database.
@param groupId the group ID
@param primary the primary | [
"Removes",
"all",
"the",
"commerce",
"currencies",
"where",
"groupId",
"=",
"?",
";",
"and",
"primary",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L2719-L2725 |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/parser/ArgumentsAdapter.java | ArgumentsAdapter.isKwarg | private boolean isKwarg(Map<String, Object> arg) {
Object kwarg = arg.get(KWARG_KEY);
return kwarg != null
&& kwarg instanceof Boolean
&& ((Boolean) kwarg);
} | java | private boolean isKwarg(Map<String, Object> arg) {
Object kwarg = arg.get(KWARG_KEY);
return kwarg != null
&& kwarg instanceof Boolean
&& ((Boolean) kwarg);
} | [
"private",
"boolean",
"isKwarg",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"arg",
")",
"{",
"Object",
"kwarg",
"=",
"arg",
".",
"get",
"(",
"KWARG_KEY",
")",
";",
"return",
"kwarg",
"!=",
"null",
"&&",
"kwarg",
"instanceof",
"Boolean",
"&&",
"(",
... | Checks whether an object argument is kwarg.
Object argument is kwarg if it contains __kwarg__ property set to true.
@param arg object argument to be tested
@return true if object argument is kwarg | [
"Checks",
"whether",
"an",
"object",
"argument",
"is",
"kwarg",
".",
"Object",
"argument",
"is",
"kwarg",
"if",
"it",
"contains",
"__kwarg__",
"property",
"set",
"to",
"true",
"."
] | train | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/parser/ArgumentsAdapter.java#L77-L82 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPP9CalendarFactory.java | MPP9CalendarFactory.processCalendarExceptions | @Override protected void processCalendarExceptions(byte[] data, ProjectCalendar cal)
{
//
// Handle any exceptions
//
int exceptionCount = MPPUtility.getShort(data, 0);
if (exceptionCount != 0)
{
int index;
int offset;
ProjectCalendarException exception;
long duration;
int periodCount;
Date start;
for (index = 0; index < exceptionCount; index++)
{
offset = 4 + (60 * 7) + (index * 64);
Date fromDate = MPPUtility.getDate(data, offset);
Date toDate = MPPUtility.getDate(data, offset + 2);
exception = cal.addCalendarException(fromDate, toDate);
periodCount = MPPUtility.getShort(data, offset + 6);
if (periodCount != 0)
{
for (int exceptionPeriodIndex = 0; exceptionPeriodIndex < periodCount; exceptionPeriodIndex++)
{
start = MPPUtility.getTime(data, offset + 12 + (exceptionPeriodIndex * 2));
duration = MPPUtility.getDuration(data, offset + 24 + (exceptionPeriodIndex * 4));
exception.addRange(new DateRange(start, new Date(start.getTime() + duration)));
}
}
}
}
} | java | @Override protected void processCalendarExceptions(byte[] data, ProjectCalendar cal)
{
//
// Handle any exceptions
//
int exceptionCount = MPPUtility.getShort(data, 0);
if (exceptionCount != 0)
{
int index;
int offset;
ProjectCalendarException exception;
long duration;
int periodCount;
Date start;
for (index = 0; index < exceptionCount; index++)
{
offset = 4 + (60 * 7) + (index * 64);
Date fromDate = MPPUtility.getDate(data, offset);
Date toDate = MPPUtility.getDate(data, offset + 2);
exception = cal.addCalendarException(fromDate, toDate);
periodCount = MPPUtility.getShort(data, offset + 6);
if (periodCount != 0)
{
for (int exceptionPeriodIndex = 0; exceptionPeriodIndex < periodCount; exceptionPeriodIndex++)
{
start = MPPUtility.getTime(data, offset + 12 + (exceptionPeriodIndex * 2));
duration = MPPUtility.getDuration(data, offset + 24 + (exceptionPeriodIndex * 4));
exception.addRange(new DateRange(start, new Date(start.getTime() + duration)));
}
}
}
}
} | [
"@",
"Override",
"protected",
"void",
"processCalendarExceptions",
"(",
"byte",
"[",
"]",
"data",
",",
"ProjectCalendar",
"cal",
")",
"{",
"//",
"// Handle any exceptions",
"//",
"int",
"exceptionCount",
"=",
"MPPUtility",
".",
"getShort",
"(",
"data",
",",
"0",... | This method extracts any exceptions associated with a calendar.
@param data calendar data block
@param cal calendar instance | [
"This",
"method",
"extracts",
"any",
"exceptions",
"associated",
"with",
"a",
"calendar",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP9CalendarFactory.java#L115-L151 |
pwall567/jsonutil | src/main/java/net/pwall/json/JSON.java | JSON.appendJSON | public static void appendJSON(Appendable a, JSONValue value) throws IOException {
if (value == null)
a.append("null");
else
value.appendJSON(a);
} | java | public static void appendJSON(Appendable a, JSONValue value) throws IOException {
if (value == null)
a.append("null");
else
value.appendJSON(a);
} | [
"public",
"static",
"void",
"appendJSON",
"(",
"Appendable",
"a",
",",
"JSONValue",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"a",
".",
"append",
"(",
"\"null\"",
")",
";",
"else",
"value",
".",
"appendJSON",
"(",... | Convenience method to append the JSON string for a value to an {@link Appendable}, for
cases where the value may be {@code null}.
@param a the {@link Appendable}
@param value the {@link JSONValue}
@throws IOException if thrown by the {@link Appendable} | [
"Convenience",
"method",
"to",
"append",
"the",
"JSON",
"string",
"for",
"a",
"value",
"to",
"an",
"{",
"@link",
"Appendable",
"}",
"for",
"cases",
"where",
"the",
"value",
"may",
"be",
"{",
"@code",
"null",
"}",
"."
] | train | https://github.com/pwall567/jsonutil/blob/dd5960b9b0bcc9acfe6c52b884fffd9ee5f422fe/src/main/java/net/pwall/json/JSON.java#L738-L743 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getDeleteVersionRequest | public BoxRequestsFile.DeleteFileVersion getDeleteVersionRequest(String id, String versionId) {
BoxRequestsFile.DeleteFileVersion request = new BoxRequestsFile.DeleteFileVersion(versionId, getDeleteFileVersionUrl(id, versionId), mSession);
return request;
} | java | public BoxRequestsFile.DeleteFileVersion getDeleteVersionRequest(String id, String versionId) {
BoxRequestsFile.DeleteFileVersion request = new BoxRequestsFile.DeleteFileVersion(versionId, getDeleteFileVersionUrl(id, versionId), mSession);
return request;
} | [
"public",
"BoxRequestsFile",
".",
"DeleteFileVersion",
"getDeleteVersionRequest",
"(",
"String",
"id",
",",
"String",
"versionId",
")",
"{",
"BoxRequestsFile",
".",
"DeleteFileVersion",
"request",
"=",
"new",
"BoxRequestsFile",
".",
"DeleteFileVersion",
"(",
"versionId"... | Gets a request that deletes a version of a file
@param id id of the file to delete a version of
@param versionId id of the file version to delete
@return request to delete a file version | [
"Gets",
"a",
"request",
"that",
"deletes",
"a",
"version",
"of",
"a",
"file"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L533-L536 |
knightliao/disconf | disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java | StringUtil.endsWithChar | public static boolean endsWithChar(String str, char ch) {
if (StringUtils.isEmpty(str)) {
return false;
}
return str.charAt(str.length() - 1) == ch;
} | java | public static boolean endsWithChar(String str, char ch) {
if (StringUtils.isEmpty(str)) {
return false;
}
return str.charAt(str.length() - 1) == ch;
} | [
"public",
"static",
"boolean",
"endsWithChar",
"(",
"String",
"str",
",",
"char",
"ch",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"str",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"str",
".",
"charAt",
"(",
"str",
".",
"leng... | 判断字符串<code>str</code>是否以字符<code>ch</code>结尾
@param str 要比较的字符串
@param ch 结尾字符
@return 如果字符串<code>str</code>是否以字符<code>ch</code>结尾,则返回<code>true</code> | [
"判断字符串<code",
">",
"str<",
"/",
"code",
">",
"是否以字符<code",
">",
"ch<",
"/",
"code",
">",
"结尾"
] | train | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java#L526-L532 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/XMLProperties.java | XMLProperties.createInstance | private Object createInstance(Class pClass, Object pParam) {
Object value;
try {
// Create param and argument arrays
Class[] param = { pParam.getClass() };
Object[] arg = { pParam };
// Get constructor
Constructor constructor = pClass.getDeclaredConstructor(param);
// Invoke and create instance
value = constructor.newInstance(arg);
} catch (Exception e) {
return null;
}
return value;
} | java | private Object createInstance(Class pClass, Object pParam) {
Object value;
try {
// Create param and argument arrays
Class[] param = { pParam.getClass() };
Object[] arg = { pParam };
// Get constructor
Constructor constructor = pClass.getDeclaredConstructor(param);
// Invoke and create instance
value = constructor.newInstance(arg);
} catch (Exception e) {
return null;
}
return value;
} | [
"private",
"Object",
"createInstance",
"(",
"Class",
"pClass",
",",
"Object",
"pParam",
")",
"{",
"Object",
"value",
";",
"try",
"{",
"// Create param and argument arrays\r",
"Class",
"[",
"]",
"param",
"=",
"{",
"pParam",
".",
"getClass",
"(",
")",
"}",
";"... | Creates an object from the given class' single argument constructor.
@return The object created from the constructor.
If the constructor could not be invoked for any reason, null is
returned. | [
"Creates",
"an",
"object",
"from",
"the",
"given",
"class",
"single",
"argument",
"constructor",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/XMLProperties.java#L413-L431 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/purandare/PurandareFirstOrder.java | PurandareFirstOrder.getTermContexts | private Matrix getTermContexts(int termIndex, BitSet termFeatures)
throws IOException {
// Reprocess the corpus in binary format to generate the set of context
// with the appropriate feature vectors
DataInputStream corpusReader = new DataInputStream(
new BufferedInputStream(new FileInputStream(compressedDocuments)));
int documents = documentCounter.get();
// Use the number of times the term occurred in the corpus to determine
// how many rows (contexts) in the matrix.
SparseMatrix contextsForCurTerm = new YaleSparseMatrix(
termCounts.get(termIndex).get(), termToIndex.size());
int contextsSeen = 0;
for (int d = 0; d < documents; ++d) {
final int docId = d;
int tokensInDoc = corpusReader.readInt();
int unfilteredTokens = corpusReader.readInt();
// Read in the document
int[] doc = new int[tokensInDoc];
for (int i = 0; i < tokensInDoc; ++i)
doc[i] = corpusReader.readInt();
int contextsInDoc =
processIntDocument(termIndex, doc, contextsForCurTerm,
contextsSeen, termFeatures);
contextsSeen += contextsInDoc;
}
corpusReader.close();
// If the term is to be processed using fewer than all of its contexts,
// then randomly select the maximum allowable contexts from the matrix
if (maxContextsPerWord < Integer.MAX_VALUE &&
contextsForCurTerm.rows() > maxContextsPerWord) {
BitSet randomContexts = Statistics.randomDistribution(
maxContextsPerWord, contextsForCurTerm.rows());
contextsForCurTerm =
new SparseRowMaskedMatrix(contextsForCurTerm, randomContexts);
}
return contextsForCurTerm;
} | java | private Matrix getTermContexts(int termIndex, BitSet termFeatures)
throws IOException {
// Reprocess the corpus in binary format to generate the set of context
// with the appropriate feature vectors
DataInputStream corpusReader = new DataInputStream(
new BufferedInputStream(new FileInputStream(compressedDocuments)));
int documents = documentCounter.get();
// Use the number of times the term occurred in the corpus to determine
// how many rows (contexts) in the matrix.
SparseMatrix contextsForCurTerm = new YaleSparseMatrix(
termCounts.get(termIndex).get(), termToIndex.size());
int contextsSeen = 0;
for (int d = 0; d < documents; ++d) {
final int docId = d;
int tokensInDoc = corpusReader.readInt();
int unfilteredTokens = corpusReader.readInt();
// Read in the document
int[] doc = new int[tokensInDoc];
for (int i = 0; i < tokensInDoc; ++i)
doc[i] = corpusReader.readInt();
int contextsInDoc =
processIntDocument(termIndex, doc, contextsForCurTerm,
contextsSeen, termFeatures);
contextsSeen += contextsInDoc;
}
corpusReader.close();
// If the term is to be processed using fewer than all of its contexts,
// then randomly select the maximum allowable contexts from the matrix
if (maxContextsPerWord < Integer.MAX_VALUE &&
contextsForCurTerm.rows() > maxContextsPerWord) {
BitSet randomContexts = Statistics.randomDistribution(
maxContextsPerWord, contextsForCurTerm.rows());
contextsForCurTerm =
new SparseRowMaskedMatrix(contextsForCurTerm, randomContexts);
}
return contextsForCurTerm;
} | [
"private",
"Matrix",
"getTermContexts",
"(",
"int",
"termIndex",
",",
"BitSet",
"termFeatures",
")",
"throws",
"IOException",
"{",
"// Reprocess the corpus in binary format to generate the set of context",
"// with the appropriate feature vectors",
"DataInputStream",
"corpusReader",
... | For the specified term, reprocesses the entire corpus using the term's
features to construct a matrix of all the contexts in which the term
appears. If the term occurs in more contexts than is allowed in the
{@link #maxContextsPerWord}, the random subset of the contexts is
returned.
@param termIndex the index of the term for which the context matrix
should be generated
@param termFeatures the set of term indices that are valid features when
in the context of {@code termIndex}.
@return a {@code Matrix} where each row is a different context for the
term in the corpus | [
"For",
"the",
"specified",
"term",
"reprocesses",
"the",
"entire",
"corpus",
"using",
"the",
"term",
"s",
"features",
"to",
"construct",
"a",
"matrix",
"of",
"all",
"the",
"contexts",
"in",
"which",
"the",
"term",
"appears",
".",
"If",
"the",
"term",
"occu... | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/purandare/PurandareFirstOrder.java#L529-L570 |
mozilla/rhino | src/org/mozilla/javascript/ScriptRuntime.java | ScriptRuntime.setObjectElem | @Deprecated
public static Object setObjectElem(Object obj, Object elem, Object value,
Context cx)
{
return setObjectElem(obj, elem, value, cx, getTopCallScope(cx));
} | java | @Deprecated
public static Object setObjectElem(Object obj, Object elem, Object value,
Context cx)
{
return setObjectElem(obj, elem, value, cx, getTopCallScope(cx));
} | [
"@",
"Deprecated",
"public",
"static",
"Object",
"setObjectElem",
"(",
"Object",
"obj",
",",
"Object",
"elem",
",",
"Object",
"value",
",",
"Context",
"cx",
")",
"{",
"return",
"setObjectElem",
"(",
"obj",
",",
"elem",
",",
"value",
",",
"cx",
",",
"getT... | Call obj.[[Put]](id, value)
@deprecated Use {@link #setObjectElem(Object, Object, Object, Context, Scriptable)} instead | [
"Call",
"obj",
".",
"[[",
"Put",
"]]",
"(",
"id",
"value",
")"
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1674-L1679 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java | Utils.writePropertiesFile | public static void writePropertiesFile( Properties properties, File file ) throws IOException {
OutputStream out = null;
try {
out = new FileOutputStream( file );
properties.store( out, "" );
} finally {
closeQuietly( out );
}
} | java | public static void writePropertiesFile( Properties properties, File file ) throws IOException {
OutputStream out = null;
try {
out = new FileOutputStream( file );
properties.store( out, "" );
} finally {
closeQuietly( out );
}
} | [
"public",
"static",
"void",
"writePropertiesFile",
"(",
"Properties",
"properties",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"OutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"pr... | Writes Java properties into a file.
@param properties non-null properties
@param file a properties file
@throws IOException if writing failed | [
"Writes",
"Java",
"properties",
"into",
"a",
"file",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L601-L611 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readProjectView | public List<CmsResource> readProjectView(CmsDbContext dbc, CmsUUID projectId, CmsResourceState state)
throws CmsException {
List<CmsResource> resources;
if (state.isNew() || state.isChanged() || state.isDeleted()) {
// get all resources form the database that match the selected state
resources = getVfsDriver(dbc).readResources(dbc, projectId, state, CmsDriverManager.READMODE_MATCHSTATE);
} else {
// get all resources form the database that are somehow changed (i.e. not unchanged)
resources = getVfsDriver(
dbc).readResources(dbc, projectId, CmsResource.STATE_UNCHANGED, CmsDriverManager.READMODE_UNMATCHSTATE);
}
// filter the permissions
List<CmsResource> result = filterPermissions(dbc, resources, CmsResourceFilter.ALL);
// sort the result
Collections.sort(result);
// set the full resource names
return updateContextDates(dbc, result);
} | java | public List<CmsResource> readProjectView(CmsDbContext dbc, CmsUUID projectId, CmsResourceState state)
throws CmsException {
List<CmsResource> resources;
if (state.isNew() || state.isChanged() || state.isDeleted()) {
// get all resources form the database that match the selected state
resources = getVfsDriver(dbc).readResources(dbc, projectId, state, CmsDriverManager.READMODE_MATCHSTATE);
} else {
// get all resources form the database that are somehow changed (i.e. not unchanged)
resources = getVfsDriver(
dbc).readResources(dbc, projectId, CmsResource.STATE_UNCHANGED, CmsDriverManager.READMODE_UNMATCHSTATE);
}
// filter the permissions
List<CmsResource> result = filterPermissions(dbc, resources, CmsResourceFilter.ALL);
// sort the result
Collections.sort(result);
// set the full resource names
return updateContextDates(dbc, result);
} | [
"public",
"List",
"<",
"CmsResource",
">",
"readProjectView",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"projectId",
",",
"CmsResourceState",
"state",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsResource",
">",
"resources",
";",
"if",
"(",
"state",
... | Reads all resources of a project that match a given state from the VFS.<p>
Possible values for the <code>state</code> parameter are:<br>
<ul>
<li><code>{@link CmsResource#STATE_CHANGED}</code>: Read all "changed" resources in the project</li>
<li><code>{@link CmsResource#STATE_NEW}</code>: Read all "new" resources in the project</li>
<li><code>{@link CmsResource#STATE_DELETED}</code>: Read all "deleted" resources in the project</li>
<li><code>{@link CmsResource#STATE_KEEP}</code>: Read all resources either "changed", "new" or "deleted" in the project</li>
</ul><p>
@param dbc the current database context
@param projectId the id of the project to read the file resources for
@param state the resource state to match
@return a list of <code>{@link CmsResource}</code> objects matching the filter criteria
@throws CmsException if something goes wrong
@see CmsObject#readProjectView(CmsUUID, CmsResourceState) | [
"Reads",
"all",
"resources",
"of",
"a",
"project",
"that",
"match",
"a",
"given",
"state",
"from",
"the",
"VFS",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7329-L7348 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.listSnapshots | public ListSnapshotsResponse listSnapshots(ListSnapshotsRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX);
if (!Strings.isNullOrEmpty(request.getMarker())) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (!Strings.isNullOrEmpty(request.getVolumeId())) {
internalRequest.addParameter("volumeId", request.getVolumeId());
}
return invokeHttpClient(internalRequest, ListSnapshotsResponse.class);
} | java | public ListSnapshotsResponse listSnapshots(ListSnapshotsRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX);
if (!Strings.isNullOrEmpty(request.getMarker())) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (!Strings.isNullOrEmpty(request.getVolumeId())) {
internalRequest.addParameter("volumeId", request.getVolumeId());
}
return invokeHttpClient(internalRequest, ListSnapshotsResponse.class);
} | [
"public",
"ListSnapshotsResponse",
"listSnapshots",
"(",
"ListSnapshotsRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"this",
".",
"createRequest",
"(",
"request",... | Listing snapshots owned by the authenticated user.
@param request The request containing all options for listing snapshot.
@return The response contains a list of snapshots owned by the user. | [
"Listing",
"snapshots",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1425-L1438 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createPartialMockAndInvokeDefaultConstructor | public static <T> T createPartialMockAndInvokeDefaultConstructor(Class<T> type, String... methodNames)
throws Exception {
return createMock(type, new ConstructorArgs(Whitebox.getConstructor(type)),
Whitebox.getMethods(type, methodNames));
} | java | public static <T> T createPartialMockAndInvokeDefaultConstructor(Class<T> type, String... methodNames)
throws Exception {
return createMock(type, new ConstructorArgs(Whitebox.getConstructor(type)),
Whitebox.getMethods(type, methodNames));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createPartialMockAndInvokeDefaultConstructor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"...",
"methodNames",
")",
"throws",
"Exception",
"{",
"return",
"createMock",
"(",
"type",
",",
"new",
"ConstructorArgs",... | A utility method that may be used to mock several methods in an easy way
(by just passing in the method names of the method you wish to mock). The
mock object created will support mocking of final methods and invokes the
default constructor (even if it's private).
@param <T> the type of the mock object
@param type the type of the mock object
@param methodNames The names of the methods that should be mocked. If
{@code null}, then this method will have the same effect
as just calling {@link #createMock(Class, Method...)} with the
second parameter as {@code new Method[0]} (i.e. all
methods in that class will be mocked).
@return the mock object. | [
"A",
"utility",
"method",
"that",
"may",
"be",
"used",
"to",
"mock",
"several",
"methods",
"in",
"an",
"easy",
"way",
"(",
"by",
"just",
"passing",
"in",
"the",
"method",
"names",
"of",
"the",
"method",
"you",
"wish",
"to",
"mock",
")",
".",
"The",
"... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L838-L842 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/PCARunner.java | PCARunner.processQueryResult | public PCAResult processQueryResult(DoubleDBIDList results, Relation<? extends NumberVector> database) {
return processCovarMatrix(covarianceMatrixBuilder.processQueryResults(results, database));
} | java | public PCAResult processQueryResult(DoubleDBIDList results, Relation<? extends NumberVector> database) {
return processCovarMatrix(covarianceMatrixBuilder.processQueryResults(results, database));
} | [
"public",
"PCAResult",
"processQueryResult",
"(",
"DoubleDBIDList",
"results",
",",
"Relation",
"<",
"?",
"extends",
"NumberVector",
">",
"database",
")",
"{",
"return",
"processCovarMatrix",
"(",
"covarianceMatrixBuilder",
".",
"processQueryResults",
"(",
"results",
... | Run PCA on a QueryResult Collection.
@param results a collection of QueryResults
@param database the database used
@return PCA result | [
"Run",
"PCA",
"on",
"a",
"QueryResult",
"Collection",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/PCARunner.java#L84-L86 |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributeCollection.java | DBaseFileAttributeCollection.fireAttributeChangedEvent | protected void fireAttributeChangedEvent(String name, AttributeValue oldValue, AttributeValue currentValue) {
if (this.listeners != null && isEventFirable()) {
final AttributeChangeEvent event = new AttributeChangeEvent(
//source
this,
//type
Type.VALUE_UPDATE,
//old name
name,
//old value
oldValue,
//current name
name,
//current value
currentValue);
for (final AttributeChangeListener listener : this.listeners) {
listener.onAttributeChangeEvent(event);
}
}
} | java | protected void fireAttributeChangedEvent(String name, AttributeValue oldValue, AttributeValue currentValue) {
if (this.listeners != null && isEventFirable()) {
final AttributeChangeEvent event = new AttributeChangeEvent(
//source
this,
//type
Type.VALUE_UPDATE,
//old name
name,
//old value
oldValue,
//current name
name,
//current value
currentValue);
for (final AttributeChangeListener listener : this.listeners) {
listener.onAttributeChangeEvent(event);
}
}
} | [
"protected",
"void",
"fireAttributeChangedEvent",
"(",
"String",
"name",
",",
"AttributeValue",
"oldValue",
",",
"AttributeValue",
"currentValue",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"!=",
"null",
"&&",
"isEventFirable",
"(",
")",
")",
"{",
"final",
... | Fire the attribute change event.
@param name is the name of the attribute for which the event occured.
@param oldValue is the previous value of the attribute
@param currentValue is the current value of the attribute | [
"Fire",
"the",
"attribute",
"change",
"event",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributeCollection.java#L887-L906 |
WASdev/tool.accelerate.core | liberty-starter-application/src/main/java/com/ibm/liberty/starter/StarterUtil.java | StarterUtil.populateFilesList | public static void populateFilesList(File dir, List<File> filesListInDir) {
File[] files = dir.listFiles();
for(File file : files){
if(file.isFile()){
filesListInDir.add(file);
}else{
populateFilesList(file, filesListInDir);
}
}
} | java | public static void populateFilesList(File dir, List<File> filesListInDir) {
File[] files = dir.listFiles();
for(File file : files){
if(file.isFile()){
filesListInDir.add(file);
}else{
populateFilesList(file, filesListInDir);
}
}
} | [
"public",
"static",
"void",
"populateFilesList",
"(",
"File",
"dir",
",",
"List",
"<",
"File",
">",
"filesListInDir",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"dir",
".",
"listFiles",
"(",
")",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{"... | Generate the list of files in the directory and all of its sub-directories (recursive)
@param dir - The directory
@param filesListInDir - List to store the files | [
"Generate",
"the",
"list",
"of",
"files",
"in",
"the",
"directory",
"and",
"all",
"of",
"its",
"sub",
"-",
"directories",
"(",
"recursive",
")"
] | train | https://github.com/WASdev/tool.accelerate.core/blob/6511da654a69a25a76573eb76eefff349d9c4d80/liberty-starter-application/src/main/java/com/ibm/liberty/starter/StarterUtil.java#L74-L83 |
mguymon/naether | src/main/java/com/tobedevoured/naether/PathClassLoader.java | PathClassLoader.execStaticMethod | public Object execStaticMethod( String className, String methodName, List params ) throws ClassLoaderException {
return execStaticMethod( className, methodName, params, null );
} | java | public Object execStaticMethod( String className, String methodName, List params ) throws ClassLoaderException {
return execStaticMethod( className, methodName, params, null );
} | [
"public",
"Object",
"execStaticMethod",
"(",
"String",
"className",
",",
"String",
"methodName",
",",
"List",
"params",
")",
"throws",
"ClassLoaderException",
"{",
"return",
"execStaticMethod",
"(",
"className",
",",
"methodName",
",",
"params",
",",
"null",
")",
... | Helper for executing static methods on a Class
@param className String fully qualified class
@param methodName String method name
@param params List of method parameters
@return Object result
@throws ClassLoaderException exception | [
"Helper",
"for",
"executing",
"static",
"methods",
"on",
"a",
"Class"
] | train | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/java/com/tobedevoured/naether/PathClassLoader.java#L220-L222 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java | PathBuilder.get | @SuppressWarnings("unchecked")
public <A extends Number & Comparable<?>> NumberPath<A> get(NumberPath<A> path) {
NumberPath<A> newPath = getNumber(toString(path), (Class<A>) path.getType());
return addMetadataOf(newPath, path);
} | java | @SuppressWarnings("unchecked")
public <A extends Number & Comparable<?>> NumberPath<A> get(NumberPath<A> path) {
NumberPath<A> newPath = getNumber(toString(path), (Class<A>) path.getType());
return addMetadataOf(newPath, path);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"A",
"extends",
"Number",
"&",
"Comparable",
"<",
"?",
">",
">",
"NumberPath",
"<",
"A",
">",
"get",
"(",
"NumberPath",
"<",
"A",
">",
"path",
")",
"{",
"NumberPath",
"<",
"A",
">",
"... | Create a new Number typed path
@param <A>
@param path existing path
@return property path | [
"Create",
"a",
"new",
"Number",
"typed",
"path"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java#L398-L402 |
segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/QueueFile.java | QueueFile.writeHeader | private void writeHeader(int fileLength, int elementCount, int firstPosition, int lastPosition)
throws IOException {
writeInt(buffer, 0, fileLength);
writeInt(buffer, 4, elementCount);
writeInt(buffer, 8, firstPosition);
writeInt(buffer, 12, lastPosition);
raf.seek(0);
raf.write(buffer);
} | java | private void writeHeader(int fileLength, int elementCount, int firstPosition, int lastPosition)
throws IOException {
writeInt(buffer, 0, fileLength);
writeInt(buffer, 4, elementCount);
writeInt(buffer, 8, firstPosition);
writeInt(buffer, 12, lastPosition);
raf.seek(0);
raf.write(buffer);
} | [
"private",
"void",
"writeHeader",
"(",
"int",
"fileLength",
",",
"int",
"elementCount",
",",
"int",
"firstPosition",
",",
"int",
"lastPosition",
")",
"throws",
"IOException",
"{",
"writeInt",
"(",
"buffer",
",",
"0",
",",
"fileLength",
")",
";",
"writeInt",
... | Writes header atomically. The arguments contain the updated values. The class member fields
should not have changed yet. This only updates the state in the file. It's up to the caller to
update the class member variables *after* this call succeeds. Assumes segment writes are atomic
in the underlying file system. | [
"Writes",
"header",
"atomically",
".",
"The",
"arguments",
"contain",
"the",
"updated",
"values",
".",
"The",
"class",
"member",
"fields",
"should",
"not",
"have",
"changed",
"yet",
".",
"This",
"only",
"updates",
"the",
"state",
"in",
"the",
"file",
".",
... | train | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/QueueFile.java#L177-L185 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/ThreadContext.java | ThreadContext.setInboundConnectionInfo | public void setInboundConnectionInfo(Map<String, Object> connectionInfo) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setInboundConnectionInfo");
this.inboundConnectionInfo = connectionInfo;
} | java | public void setInboundConnectionInfo(Map<String, Object> connectionInfo) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "setInboundConnectionInfo");
this.inboundConnectionInfo = connectionInfo;
} | [
"public",
"void",
"setInboundConnectionInfo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"connectionInfo",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
... | Set the inbound connection info on this context to the input value.
@param connectionInfo | [
"Set",
"the",
"inbound",
"connection",
"info",
"on",
"this",
"context",
"to",
"the",
"input",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/ThreadContext.java#L180-L184 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.validateSql | public void validateSql(String sql, CancellationSignal cancellationSignal) {
getThreadSession().prepare(sql,
getThreadDefaultConnectionFlags(/* readOnly =*/ true), cancellationSignal, null);
} | java | public void validateSql(String sql, CancellationSignal cancellationSignal) {
getThreadSession().prepare(sql,
getThreadDefaultConnectionFlags(/* readOnly =*/ true), cancellationSignal, null);
} | [
"public",
"void",
"validateSql",
"(",
"String",
"sql",
",",
"CancellationSignal",
"cancellationSignal",
")",
"{",
"getThreadSession",
"(",
")",
".",
"prepare",
"(",
"sql",
",",
"getThreadDefaultConnectionFlags",
"(",
"/* readOnly =*/",
"true",
")",
",",
"cancellatio... | Verifies that a SQL SELECT statement is valid by compiling it.
If the SQL statement is not valid, this method will throw a {@link SQLiteException}.
@param sql SQL to be validated
@param cancellationSignal A signal to cancel the operation in progress, or null if none.
If the operation is canceled, then {@link OperationCanceledException} will be thrown
when the query is executed.
@throws SQLiteException if {@code sql} is invalid | [
"Verifies",
"that",
"a",
"SQL",
"SELECT",
"statement",
"is",
"valid",
"by",
"compiling",
"it",
".",
"If",
"the",
"SQL",
"statement",
"is",
"not",
"valid",
"this",
"method",
"will",
"throw",
"a",
"{",
"@link",
"SQLiteException",
"}",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L1700-L1703 |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java | AbstractInstanceManager.getInstance | private <T> T getInstance(DatastoreType datastoreType, TransactionalCache.Mode cacheMode) {
DatastoreId id = getDatastoreId(datastoreType);
Object instance = cache.get(id, cacheMode);
if (instance == null) {
DynamicType<?> types = getTypes(datastoreType);
instance = newInstance(id, datastoreType, types, cacheMode);
if (TransactionalCache.Mode.READ.equals(cacheMode)) {
instanceListenerService.postLoad(instance);
}
}
return (T) instance;
} | java | private <T> T getInstance(DatastoreType datastoreType, TransactionalCache.Mode cacheMode) {
DatastoreId id = getDatastoreId(datastoreType);
Object instance = cache.get(id, cacheMode);
if (instance == null) {
DynamicType<?> types = getTypes(datastoreType);
instance = newInstance(id, datastoreType, types, cacheMode);
if (TransactionalCache.Mode.READ.equals(cacheMode)) {
instanceListenerService.postLoad(instance);
}
}
return (T) instance;
} | [
"private",
"<",
"T",
">",
"T",
"getInstance",
"(",
"DatastoreType",
"datastoreType",
",",
"TransactionalCache",
".",
"Mode",
"cacheMode",
")",
"{",
"DatastoreId",
"id",
"=",
"getDatastoreId",
"(",
"datastoreType",
")",
";",
"Object",
"instance",
"=",
"cache",
... | Return the proxy instance which corresponds to the given datastore type.
@param datastoreType
The datastore type.
@param <T>
The instance type.
@return The instance. | [
"Return",
"the",
"proxy",
"instance",
"which",
"corresponds",
"to",
"the",
"given",
"datastore",
"type",
"."
] | train | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java#L89-L100 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java | CoronaTaskLauncher.launchTask | public void launchTask(Task task, String trackerName, InetAddress addr) {
CoronaSessionInfo info = new CoronaSessionInfo(
coronaJT.getSessionId(), coronaJT.getJobTrackerAddress(),
coronaJT.getSecondaryTrackerAddress());
LaunchTaskAction action = new LaunchTaskAction(task, info);
String description = "LaunchTaskAction " + action.getTask().getTaskID();
ActionToSend actionToSend =
new ActionToSend(trackerName, addr, action, description);
LOG.info("Queueing " + description + " to worker " +
trackerName + "(" + addr.host + ":" + addr.port + ")");
allWorkQueues.enqueueAction(actionToSend);
} | java | public void launchTask(Task task, String trackerName, InetAddress addr) {
CoronaSessionInfo info = new CoronaSessionInfo(
coronaJT.getSessionId(), coronaJT.getJobTrackerAddress(),
coronaJT.getSecondaryTrackerAddress());
LaunchTaskAction action = new LaunchTaskAction(task, info);
String description = "LaunchTaskAction " + action.getTask().getTaskID();
ActionToSend actionToSend =
new ActionToSend(trackerName, addr, action, description);
LOG.info("Queueing " + description + " to worker " +
trackerName + "(" + addr.host + ":" + addr.port + ")");
allWorkQueues.enqueueAction(actionToSend);
} | [
"public",
"void",
"launchTask",
"(",
"Task",
"task",
",",
"String",
"trackerName",
",",
"InetAddress",
"addr",
")",
"{",
"CoronaSessionInfo",
"info",
"=",
"new",
"CoronaSessionInfo",
"(",
"coronaJT",
".",
"getSessionId",
"(",
")",
",",
"coronaJT",
".",
"getJob... | Enqueue a launch task action.
@param task The task to launch.
@param trackerName The name of the tracker to send the task to.
@param addr The address of the tracker to send the task to. | [
"Enqueue",
"a",
"launch",
"task",
"action",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaTaskLauncher.java#L154-L165 |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java | UserManager.areUserIDAndPasswordValid | public boolean areUserIDAndPasswordValid (@Nullable final String sUserID, @Nullable final String sPlainTextPassword)
{
// No password is not allowed
if (sPlainTextPassword == null)
return false;
// Is there such a user?
final IUser aUser = getOfID (sUserID);
if (aUser == null)
return false;
// Now compare the hashes
final String sPasswordHashAlgorithm = aUser.getPasswordHash ().getAlgorithmName ();
final IPasswordSalt aSalt = aUser.getPasswordHash ().getSalt ();
final PasswordHash aPasswordHash = GlobalPasswordSettings.createUserPasswordHash (sPasswordHashAlgorithm,
aSalt,
sPlainTextPassword);
return aUser.getPasswordHash ().equals (aPasswordHash);
} | java | public boolean areUserIDAndPasswordValid (@Nullable final String sUserID, @Nullable final String sPlainTextPassword)
{
// No password is not allowed
if (sPlainTextPassword == null)
return false;
// Is there such a user?
final IUser aUser = getOfID (sUserID);
if (aUser == null)
return false;
// Now compare the hashes
final String sPasswordHashAlgorithm = aUser.getPasswordHash ().getAlgorithmName ();
final IPasswordSalt aSalt = aUser.getPasswordHash ().getSalt ();
final PasswordHash aPasswordHash = GlobalPasswordSettings.createUserPasswordHash (sPasswordHashAlgorithm,
aSalt,
sPlainTextPassword);
return aUser.getPasswordHash ().equals (aPasswordHash);
} | [
"public",
"boolean",
"areUserIDAndPasswordValid",
"(",
"@",
"Nullable",
"final",
"String",
"sUserID",
",",
"@",
"Nullable",
"final",
"String",
"sPlainTextPassword",
")",
"{",
"// No password is not allowed",
"if",
"(",
"sPlainTextPassword",
"==",
"null",
")",
"return"... | Check if the passed combination of user ID and password matches.
@param sUserID
The ID of the user
@param sPlainTextPassword
The plan text password to validate.
@return <code>true</code> if the password hash matches the stored hash for
the specified user, <code>false</code> otherwise. | [
"Check",
"if",
"the",
"passed",
"combination",
"of",
"user",
"ID",
"and",
"password",
"matches",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/user/UserManager.java#L749-L767 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRelPersistenceImpl.java | CommerceDiscountRelPersistenceImpl.findByCN_CPK | @Override
public List<CommerceDiscountRel> findByCN_CPK(long classNameId,
long classPK, int start, int end) {
return findByCN_CPK(classNameId, classPK, start, end, null);
} | java | @Override
public List<CommerceDiscountRel> findByCN_CPK(long classNameId,
long classPK, int start, int end) {
return findByCN_CPK(classNameId, classPK, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountRel",
">",
"findByCN_CPK",
"(",
"long",
"classNameId",
",",
"long",
"classPK",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCN_CPK",
"(",
"classNameId",
",",
"classPK",
",",
"star... | Returns a range of all the commerce discount rels where classNameId = ? and classPK = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceDiscountRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param classNameId the class name ID
@param classPK the class pk
@param start the lower bound of the range of commerce discount rels
@param end the upper bound of the range of commerce discount rels (not inclusive)
@return the range of matching commerce discount rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"discount",
"rels",
"where",
"classNameId",
"=",
"?",
";",
"and",
"classPK",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountRelPersistenceImpl.java#L1225-L1229 |
apache/incubator-gobblin | gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStore.java | SimpleHadoopFilesystemConfigStore.getOwnConfig | @Override
public Config getOwnConfig(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException {
Preconditions.checkNotNull(configKey, "configKey cannot be null!");
Preconditions.checkArgument(!Strings.isNullOrEmpty(version), "version cannot be null or empty!");
Path datasetDir = getDatasetDirForKey(configKey, version);
Path mainConfFile = new Path(datasetDir, MAIN_CONF_FILE_NAME);
try {
if (!this.fs.exists(mainConfFile)) {
return ConfigFactory.empty();
}
FileStatus configFileStatus = this.fs.getFileStatus(mainConfFile);
if (!configFileStatus.isDirectory()) {
try (InputStream mainConfInputStream = this.fs.open(configFileStatus.getPath())) {
return ConfigFactory.parseReader(new InputStreamReader(mainConfInputStream, Charsets.UTF_8));
}
}
return ConfigFactory.empty();
} catch (IOException e) {
throw new RuntimeException(String.format("Error while getting config for configKey: \"%s\"", configKey), e);
}
} | java | @Override
public Config getOwnConfig(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException {
Preconditions.checkNotNull(configKey, "configKey cannot be null!");
Preconditions.checkArgument(!Strings.isNullOrEmpty(version), "version cannot be null or empty!");
Path datasetDir = getDatasetDirForKey(configKey, version);
Path mainConfFile = new Path(datasetDir, MAIN_CONF_FILE_NAME);
try {
if (!this.fs.exists(mainConfFile)) {
return ConfigFactory.empty();
}
FileStatus configFileStatus = this.fs.getFileStatus(mainConfFile);
if (!configFileStatus.isDirectory()) {
try (InputStream mainConfInputStream = this.fs.open(configFileStatus.getPath())) {
return ConfigFactory.parseReader(new InputStreamReader(mainConfInputStream, Charsets.UTF_8));
}
}
return ConfigFactory.empty();
} catch (IOException e) {
throw new RuntimeException(String.format("Error while getting config for configKey: \"%s\"", configKey), e);
}
} | [
"@",
"Override",
"public",
"Config",
"getOwnConfig",
"(",
"ConfigKeyPath",
"configKey",
",",
"String",
"version",
")",
"throws",
"VersionDoesNotExistException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"configKey",
",",
"\"configKey cannot be null!\"",
")",
";",
... | Retrieves the {@link Config} for the given {@link ConfigKeyPath} by reading the {@link #MAIN_CONF_FILE_NAME}
associated with the dataset specified by the given {@link ConfigKeyPath}. If the {@link Path} described by the
{@link ConfigKeyPath} does not exist then an empty {@link Config} is returned.
@param configKey the config key path whose properties are needed.
@param version the configuration version in the configuration store.
@return a {@link Config} for the given configKey.
@throws VersionDoesNotExistException if the version specified cannot be found in the {@link ConfigStore}. | [
"Retrieves",
"the",
"{",
"@link",
"Config",
"}",
"for",
"the",
"given",
"{",
"@link",
"ConfigKeyPath",
"}",
"by",
"reading",
"the",
"{",
"@link",
"#MAIN_CONF_FILE_NAME",
"}",
"associated",
"with",
"the",
"dataset",
"specified",
"by",
"the",
"given",
"{",
"@l... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStore.java#L345-L368 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java | DefaultInstalledExtensionRepository.addInstalledExtension | private void addInstalledExtension(DefaultInstalledExtension installedExtension, String namespace)
{
addCachedExtension(installedExtension);
boolean isValid = installedExtension.isValid(namespace);
// Register the extension in the installed extensions for the provided namespace
addInstalledFeatureToCache(installedExtension.getId(), namespace, installedExtension, isValid);
// Add virtual extensions
for (ExtensionId feature : installedExtension.getExtensionFeatures()) {
addInstalledFeatureToCache(feature, namespace, installedExtension, isValid);
}
if (this.updateBackwardDependencies) {
// Recalculate backward dependencies index
updateMissingBackwardDependencies();
}
} | java | private void addInstalledExtension(DefaultInstalledExtension installedExtension, String namespace)
{
addCachedExtension(installedExtension);
boolean isValid = installedExtension.isValid(namespace);
// Register the extension in the installed extensions for the provided namespace
addInstalledFeatureToCache(installedExtension.getId(), namespace, installedExtension, isValid);
// Add virtual extensions
for (ExtensionId feature : installedExtension.getExtensionFeatures()) {
addInstalledFeatureToCache(feature, namespace, installedExtension, isValid);
}
if (this.updateBackwardDependencies) {
// Recalculate backward dependencies index
updateMissingBackwardDependencies();
}
} | [
"private",
"void",
"addInstalledExtension",
"(",
"DefaultInstalledExtension",
"installedExtension",
",",
"String",
"namespace",
")",
"{",
"addCachedExtension",
"(",
"installedExtension",
")",
";",
"boolean",
"isValid",
"=",
"installedExtension",
".",
"isValid",
"(",
"na... | Register a newly installed extension in backward dependencies map.
@param installedExtension the installed extension to register
@param namespace the namespace | [
"Register",
"a",
"newly",
"installed",
"extension",
"in",
"backward",
"dependencies",
"map",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java#L551-L569 |
Netflix/astyanax | astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/OneStepDistributedRowLock.java | OneStepDistributedRowLock.fillReleaseMutation | public void fillReleaseMutation(MutationBatch m, boolean excludeCurrentLock) {
// Add the deletes to the end of the mutation
ColumnListMutation<C> row = m.withRow(columnFamily, key);
for (C c : locksToDelete) {
row.deleteColumn(c);
}
if (!excludeCurrentLock && lockColumn != null)
row.deleteColumn(lockColumn);
locksToDelete.clear();
lockColumn = null;
} | java | public void fillReleaseMutation(MutationBatch m, boolean excludeCurrentLock) {
// Add the deletes to the end of the mutation
ColumnListMutation<C> row = m.withRow(columnFamily, key);
for (C c : locksToDelete) {
row.deleteColumn(c);
}
if (!excludeCurrentLock && lockColumn != null)
row.deleteColumn(lockColumn);
locksToDelete.clear();
lockColumn = null;
} | [
"public",
"void",
"fillReleaseMutation",
"(",
"MutationBatch",
"m",
",",
"boolean",
"excludeCurrentLock",
")",
"{",
"// Add the deletes to the end of the mutation",
"ColumnListMutation",
"<",
"C",
">",
"row",
"=",
"m",
".",
"withRow",
"(",
"columnFamily",
",",
"key",
... | Fill a mutation that will release the locks. This may be used from a
separate recipe to release multiple locks.
@param m | [
"Fill",
"a",
"mutation",
"that",
"will",
"release",
"the",
"locks",
".",
"This",
"may",
"be",
"used",
"from",
"a",
"separate",
"recipe",
"to",
"release",
"multiple",
"locks",
"."
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/OneStepDistributedRowLock.java#L441-L451 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseTypeDeclaration | public Decl.Type parseTypeDeclaration(Tuple<Modifier> modifiers) {
int start = index;
EnclosingScope scope = new EnclosingScope();
//
match(Identifier); // type
// Parse type name
Identifier name = parseIdentifier();
// Parse templare variables
Tuple<Template.Variable> template = parseOptionalTemplate(scope);
match(Is);
// Parse the type pattern
Decl.Variable var = parseOptionalParameter(scope);
addFieldAliases(var, scope);
Tuple<Expr> invariant = parseInvariant(scope, Where);
int end = index;
matchEndLine();
return annotateSourceLocation(new Decl.Type(modifiers, name, template, var, invariant), start);
} | java | public Decl.Type parseTypeDeclaration(Tuple<Modifier> modifiers) {
int start = index;
EnclosingScope scope = new EnclosingScope();
//
match(Identifier); // type
// Parse type name
Identifier name = parseIdentifier();
// Parse templare variables
Tuple<Template.Variable> template = parseOptionalTemplate(scope);
match(Is);
// Parse the type pattern
Decl.Variable var = parseOptionalParameter(scope);
addFieldAliases(var, scope);
Tuple<Expr> invariant = parseInvariant(scope, Where);
int end = index;
matchEndLine();
return annotateSourceLocation(new Decl.Type(modifiers, name, template, var, invariant), start);
} | [
"public",
"Decl",
".",
"Type",
"parseTypeDeclaration",
"(",
"Tuple",
"<",
"Modifier",
">",
"modifiers",
")",
"{",
"int",
"start",
"=",
"index",
";",
"EnclosingScope",
"scope",
"=",
"new",
"EnclosingScope",
"(",
")",
";",
"//",
"match",
"(",
"Identifier",
"... | Parse a type declaration in a Whiley source file, which has the form:
<pre>
"type" Identifier "is" TypePattern ("where" Expr)*
</pre>
Here, the type pattern specifies a type which may additionally be adorned
with variable names. The "where" clause is optional and is often referred
to as the type's "constraint". Variables defined within the type pattern
may be used within this constraint expressions. A simple example to
illustrate is:
<pre>
type nat is (int x) where x >= 0
</pre>
Here, we are defining a <i>constrained type</i> called <code>nat</code>
which represents the set of natural numbers (i.e the non-negative
integers). Type declarations may also have modifiers, such as
<code>public</code> and <code>private</code>.
@see wyil.lang.WyilFile.Type
@param modifiers
--- The list of modifiers for this declaration (which were
already parsed before this method was called). | [
"Parse",
"a",
"type",
"declaration",
"in",
"a",
"Whiley",
"source",
"file",
"which",
"has",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L466-L483 |
b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optNumber | public Number optNumber(int index, Number defaultValue) {
Object val = this.opt(index);
if (JSONObject.NULL.equals(val)) {
return defaultValue;
}
if (val instanceof Number){
return (Number) val;
}
if (val instanceof String) {
try {
return JSONObject.stringToNumber((String) val);
} catch (Exception e) {
return defaultValue;
}
}
return defaultValue;
} | java | public Number optNumber(int index, Number defaultValue) {
Object val = this.opt(index);
if (JSONObject.NULL.equals(val)) {
return defaultValue;
}
if (val instanceof Number){
return (Number) val;
}
if (val instanceof String) {
try {
return JSONObject.stringToNumber((String) val);
} catch (Exception e) {
return defaultValue;
}
}
return defaultValue;
} | [
"public",
"Number",
"optNumber",
"(",
"int",
"index",
",",
"Number",
"defaultValue",
")",
"{",
"Object",
"val",
"=",
"this",
".",
"opt",
"(",
"index",
")",
";",
"if",
"(",
"JSONObject",
".",
"NULL",
".",
"equals",
"(",
"val",
")",
")",
"{",
"return",... | Get an optional {@link Number} value associated with a key, or the default if there
is no such key or if the value is not a number. If the value is a string,
an attempt will be made to evaluate it as a number ({@link BigDecimal}). This method
would be used in cases where type coercion of the number value is unwanted.
@param index
The index must be between 0 and length() - 1.
@param defaultValue
The default.
@return An object which is the value. | [
"Get",
"an",
"optional",
"{",
"@link",
"Number",
"}",
"value",
"associated",
"with",
"a",
"key",
"or",
"the",
"default",
"if",
"there",
"is",
"no",
"such",
"key",
"or",
"if",
"the",
"value",
"is",
"not",
"a",
"number",
".",
"If",
"the",
"value",
"is"... | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L818-L835 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java | ApiOvhEmailpro.service_domain_domainName_GET | public OvhDomain service_domain_domainName_GET(String service, String domainName) throws IOException {
String qPath = "/email/pro/{service}/domain/{domainName}";
StringBuilder sb = path(qPath, service, domainName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDomain.class);
} | java | public OvhDomain service_domain_domainName_GET(String service, String domainName) throws IOException {
String qPath = "/email/pro/{service}/domain/{domainName}";
StringBuilder sb = path(qPath, service, domainName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDomain.class);
} | [
"public",
"OvhDomain",
"service_domain_domainName_GET",
"(",
"String",
"service",
",",
"String",
"domainName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/pro/{service}/domain/{domainName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath... | Get this object properties
REST: GET /email/pro/{service}/domain/{domainName}
@param service [required] The internal name of your pro organization
@param domainName [required] Domain name
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L857-L862 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/lang/Utils.java | Utils.equalsAnyIgnoreCase | public static boolean equalsAnyIgnoreCase(final String str, final String[] list) {
if(str == null) {
return false;
}
if(list == null || list.length == 0) {
return false;
}
for(String item : list) {
if(str.equalsIgnoreCase(item)) {
return true;
}
}
return false;
} | java | public static boolean equalsAnyIgnoreCase(final String str, final String[] list) {
if(str == null) {
return false;
}
if(list == null || list.length == 0) {
return false;
}
for(String item : list) {
if(str.equalsIgnoreCase(item)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"equalsAnyIgnoreCase",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"[",
"]",
"list",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"list",
"==",
"null",
"||",
"li... | 大文字・小文字を無視して、何れかの文字と等しいか。
<pre>
Utils.equalsAnyIgnoreCase("abc", null) = false
Utils.equalsAnyIgnoreCase("abc", new String[]{}) = false
Utils.equalsAnyIgnoreCase(null, new String[]{"abc"}) = false
Utils.equalsAnyIgnoreCase("", new String[]{""}) = true
</pre>
@param str
@param list
@return | [
"大文字・小文字を無視して、何れかの文字と等しいか。",
"<pre",
">",
"Utils",
".",
"equalsAnyIgnoreCase",
"(",
"abc",
"null",
")",
"=",
"false",
"Utils",
".",
"equalsAnyIgnoreCase",
"(",
"abc",
"new",
"String",
"[]",
"{}",
")",
"=",
"false",
"Utils",
".",
"equalsAnyIgnoreCase",
"(",
"nu... | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/lang/Utils.java#L212-L230 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/helper/BaseAdsServiceClientFactoryHelper.java | BaseAdsServiceClientFactoryHelper.createServiceDescriptor | @Override
public D createServiceDescriptor(Class<?> interfaceClass, String version) {
return adsServiceDescriptorFactory.create(interfaceClass, version);
} | java | @Override
public D createServiceDescriptor(Class<?> interfaceClass, String version) {
return adsServiceDescriptorFactory.create(interfaceClass, version);
} | [
"@",
"Override",
"public",
"D",
"createServiceDescriptor",
"(",
"Class",
"<",
"?",
">",
"interfaceClass",
",",
"String",
"version",
")",
"{",
"return",
"adsServiceDescriptorFactory",
".",
"create",
"(",
"interfaceClass",
",",
"version",
")",
";",
"}"
] | Creates an {@link AdsServiceDescriptor} for a specified service.
@param interfaceClass the ads service that we want a descriptor for
@param version the version of the service
@return a descriptor of the requested service | [
"Creates",
"an",
"{",
"@link",
"AdsServiceDescriptor",
"}",
"for",
"a",
"specified",
"service",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/helper/BaseAdsServiceClientFactoryHelper.java#L96-L99 |
GenesysPureEngage/authentication-client-java | src/main/java/com/genesys/authentication/AuthenticationApi.java | AuthenticationApi.getUserInfoOpenid | public OpenIdUserInfo getUserInfoOpenid(String authorization) throws AuthenticationApiException {
try {
return authenticationApi.getInfo(authorization);
} catch (ApiException e) {
throw new AuthenticationApiException("Error getting openid userinfo", e);
}
} | java | public OpenIdUserInfo getUserInfoOpenid(String authorization) throws AuthenticationApiException {
try {
return authenticationApi.getInfo(authorization);
} catch (ApiException e) {
throw new AuthenticationApiException("Error getting openid userinfo", e);
}
} | [
"public",
"OpenIdUserInfo",
"getUserInfoOpenid",
"(",
"String",
"authorization",
")",
"throws",
"AuthenticationApiException",
"{",
"try",
"{",
"return",
"authenticationApi",
".",
"getInfo",
"(",
"authorization",
")",
";",
"}",
"catch",
"(",
"ApiException",
"e",
")",... | Get OpenID user information by access token
Get information about a user by their OAuth 2 access token.
@param authorization The OAuth 2 bearer access token you received from [/auth/v3/oauth/token](/reference/authentication/Authentication/index.html#retrieveToken). For example: \"Authorization: bearer a4b5da75-a584-4053-9227-0f0ab23ff06e\" (required)
@return OpenIdUserInfo
@throws AuthenticationApiException if the call is unsuccessful. | [
"Get",
"OpenID",
"user",
"information",
"by",
"access",
"token",
"Get",
"information",
"about",
"a",
"user",
"by",
"their",
"OAuth",
"2",
"access",
"token",
"."
] | train | https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/authentication/AuthenticationApi.java#L119-L125 |
Erudika/para | para-client/src/main/java/com/erudika/para/client/ParaClient.java | ParaClient.readAll | public <P extends ParaObject> List<P> readAll(List<String> keys) {
if (keys == null || keys.isEmpty()) {
return Collections.emptyList();
}
final int size = this.chunkSize;
return IntStream.range(0, getNumChunks(keys, size))
.mapToObj(i -> (List<String>) partitionList(keys, i, size))
.map(chunk -> {
MultivaluedMap<String, String> ids = new MultivaluedHashMap<>();
ids.put("ids", chunk);
return invokeGet("_batch", ids);
})
.map(response -> (List<P>) this.getEntity(response, List.class))
.map(entity -> (List<P>) getItemsFromList(entity))
.flatMap(List::stream)
.collect(Collectors.toList());
} | java | public <P extends ParaObject> List<P> readAll(List<String> keys) {
if (keys == null || keys.isEmpty()) {
return Collections.emptyList();
}
final int size = this.chunkSize;
return IntStream.range(0, getNumChunks(keys, size))
.mapToObj(i -> (List<String>) partitionList(keys, i, size))
.map(chunk -> {
MultivaluedMap<String, String> ids = new MultivaluedHashMap<>();
ids.put("ids", chunk);
return invokeGet("_batch", ids);
})
.map(response -> (List<P>) this.getEntity(response, List.class))
.map(entity -> (List<P>) getItemsFromList(entity))
.flatMap(List::stream)
.collect(Collectors.toList());
} | [
"public",
"<",
"P",
"extends",
"ParaObject",
">",
"List",
"<",
"P",
">",
"readAll",
"(",
"List",
"<",
"String",
">",
"keys",
")",
"{",
"if",
"(",
"keys",
"==",
"null",
"||",
"keys",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
... | Retrieves multiple objects from the data store.
@param <P> the type of object
@param keys a list of object ids
@return a list of objects | [
"Retrieves",
"multiple",
"objects",
"from",
"the",
"data",
"store",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L576-L592 |
wigforss/Ka-Web | servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java | SystemPropertiesSetter.loadConfiguration | private SystemProperties loadConfiguration(String propertiesConfig, ServletContext context) throws IllegalStateException{
InputStream inStream = null;
try {
inStream = getStreamForLocation(propertiesConfig, context);
JAXBContext jaxb = JAXBContext.newInstance(SystemProperties.class.getPackage().getName());
return (SystemProperties) jaxb.createUnmarshaller().unmarshal(inStream);
} catch (FileNotFoundException e) {
throw new IllegalStateException("Could not find configuration file: " + propertiesConfig, e);
} catch (JAXBException e) {
throw new IllegalStateException("Error while reading file: " + propertiesConfig, e);
} finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} | java | private SystemProperties loadConfiguration(String propertiesConfig, ServletContext context) throws IllegalStateException{
InputStream inStream = null;
try {
inStream = getStreamForLocation(propertiesConfig, context);
JAXBContext jaxb = JAXBContext.newInstance(SystemProperties.class.getPackage().getName());
return (SystemProperties) jaxb.createUnmarshaller().unmarshal(inStream);
} catch (FileNotFoundException e) {
throw new IllegalStateException("Could not find configuration file: " + propertiesConfig, e);
} catch (JAXBException e) {
throw new IllegalStateException("Error while reading file: " + propertiesConfig, e);
} finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} | [
"private",
"SystemProperties",
"loadConfiguration",
"(",
"String",
"propertiesConfig",
",",
"ServletContext",
"context",
")",
"throws",
"IllegalStateException",
"{",
"InputStream",
"inStream",
"=",
"null",
";",
"try",
"{",
"inStream",
"=",
"getStreamForLocation",
"(",
... | Loads and returns the configuration.
@param propertiesConfig Location of the configuration XML file.
@param context Servlet Context to read configuration from.
@return the configuration object.
@throws IllegalStateException If configuration could not be read due to missing file or invalid XML content in
the configuration file. | [
"Loads",
"and",
"returns",
"the",
"configuration",
"."
] | train | https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java#L110-L130 |
GoSimpleLLC/nbvcxz | src/main/java/me/gosimple/nbvcxz/Nbvcxz.java | Nbvcxz.createBruteForceMatch | private static Match createBruteForceMatch(final String password, final Configuration configuration, final int index)
{
return new BruteForceMatch(password.charAt(index), configuration, index);
} | java | private static Match createBruteForceMatch(final String password, final Configuration configuration, final int index)
{
return new BruteForceMatch(password.charAt(index), configuration, index);
} | [
"private",
"static",
"Match",
"createBruteForceMatch",
"(",
"final",
"String",
"password",
",",
"final",
"Configuration",
"configuration",
",",
"final",
"int",
"index",
")",
"{",
"return",
"new",
"BruteForceMatch",
"(",
"password",
".",
"charAt",
"(",
"index",
"... | Creates a brute force match for a portion of the password.
@param password the password to create brute match for
@param configuration the configuration
@param index the index of the password part that needs a {@code BruteForceMatch}
@return a {@code Match} object | [
"Creates",
"a",
"brute",
"force",
"match",
"for",
"a",
"portion",
"of",
"the",
"password",
"."
] | train | https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/Nbvcxz.java#L54-L57 |
Netflix/zuul | zuul-core/src/main/java/com/netflix/netty/common/HttpRequestReadTimeoutHandler.java | HttpRequestReadTimeoutHandler.addLast | public static void addLast(ChannelPipeline pipeline, long timeout, TimeUnit unit, BasicCounter httpRequestReadTimeoutCounter)
{
HttpRequestReadTimeoutHandler handler = new HttpRequestReadTimeoutHandler(timeout, unit, httpRequestReadTimeoutCounter);
pipeline.addLast(HANDLER_NAME, handler);
} | java | public static void addLast(ChannelPipeline pipeline, long timeout, TimeUnit unit, BasicCounter httpRequestReadTimeoutCounter)
{
HttpRequestReadTimeoutHandler handler = new HttpRequestReadTimeoutHandler(timeout, unit, httpRequestReadTimeoutCounter);
pipeline.addLast(HANDLER_NAME, handler);
} | [
"public",
"static",
"void",
"addLast",
"(",
"ChannelPipeline",
"pipeline",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
",",
"BasicCounter",
"httpRequestReadTimeoutCounter",
")",
"{",
"HttpRequestReadTimeoutHandler",
"handler",
"=",
"new",
"HttpRequestReadTimeoutHandl... | Factory which ensures that this handler is added to the pipeline using the
correct name.
@param timeout
@param unit | [
"Factory",
"which",
"ensures",
"that",
"this",
"handler",
"is",
"added",
"to",
"the",
"pipeline",
"using",
"the",
"correct",
"name",
"."
] | train | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/netty/common/HttpRequestReadTimeoutHandler.java#L63-L67 |
hmsonline/storm-cassandra | src/main/java/com/hmsonline/storm/cassandra/bolt/mapper/DelimitedColumnsMapper.java | DelimitedColumnsMapper.mapToValues | @Override
public List<Values> mapToValues(String rowKey, Map<String, String> columns, Tuple input) {
List<Values> values = new ArrayList<Values>();
String delimVal = columns.get(this.columnKeyField);
if (delimVal != null) {
String[] vals = delimVal.split(this.delimiter);
for (String val : vals) {
if (this.isDrpc) {
values.add(new Values(input.getValue(0), rowKey, val));
} else {
values.add(new Values(rowKey, val));
}
}
}
return values;
} | java | @Override
public List<Values> mapToValues(String rowKey, Map<String, String> columns, Tuple input) {
List<Values> values = new ArrayList<Values>();
String delimVal = columns.get(this.columnKeyField);
if (delimVal != null) {
String[] vals = delimVal.split(this.delimiter);
for (String val : vals) {
if (this.isDrpc) {
values.add(new Values(input.getValue(0), rowKey, val));
} else {
values.add(new Values(rowKey, val));
}
}
}
return values;
} | [
"@",
"Override",
"public",
"List",
"<",
"Values",
">",
"mapToValues",
"(",
"String",
"rowKey",
",",
"Map",
"<",
"String",
",",
"String",
">",
"columns",
",",
"Tuple",
"input",
")",
"{",
"List",
"<",
"Values",
">",
"values",
"=",
"new",
"ArrayList",
"<"... | Given a set of columns, maps to values to emit.
@param columns
@return | [
"Given",
"a",
"set",
"of",
"columns",
"maps",
"to",
"values",
"to",
"emit",
"."
] | train | https://github.com/hmsonline/storm-cassandra/blob/94303fad18f4692224187867144921904e35b001/src/main/java/com/hmsonline/storm/cassandra/bolt/mapper/DelimitedColumnsMapper.java#L110-L125 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/SnippetsApi.java | SnippetsApi.createSnippet | public Snippet createSnippet(String title, String fileName, String content) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("title", title, true)
.withParam("file_name", fileName, true)
.withParam("content", content, true);
Response response = post(Response.Status.CREATED, formData, "snippets");
return (response.readEntity(Snippet.class));
} | java | public Snippet createSnippet(String title, String fileName, String content) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("title", title, true)
.withParam("file_name", fileName, true)
.withParam("content", content, true);
Response response = post(Response.Status.CREATED, formData, "snippets");
return (response.readEntity(Snippet.class));
} | [
"public",
"Snippet",
"createSnippet",
"(",
"String",
"title",
",",
"String",
"fileName",
",",
"String",
"content",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"title\"",
"... | Create a new Snippet.
@param title the title of the snippet
@param fileName the file name of the snippet
@param content the content of the snippet
@return the created Snippet
@throws GitLabApiException if any exception occurs | [
"Create",
"a",
"new",
"Snippet",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/SnippetsApi.java#L169-L176 |
matthewhorridge/binaryowl | src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java | BinaryOWLMetadata.setByteArrayAttribute | public void setByteArrayAttribute(String name, byte [] value) {
byte [] copy = new byte[value.length];
System.arraycopy(value, 0, copy, 0, value.length);
setValue(byteArrayAttributes, name, ByteBuffer.wrap(copy));
} | java | public void setByteArrayAttribute(String name, byte [] value) {
byte [] copy = new byte[value.length];
System.arraycopy(value, 0, copy, 0, value.length);
setValue(byteArrayAttributes, name, ByteBuffer.wrap(copy));
} | [
"public",
"void",
"setByteArrayAttribute",
"(",
"String",
"name",
",",
"byte",
"[",
"]",
"value",
")",
"{",
"byte",
"[",
"]",
"copy",
"=",
"new",
"byte",
"[",
"value",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"value",
",",
"0",
",",
... | Sets the byte [] value for the specified attribute name. This parameter will be copied so that modifications
to the passed in parameter are not reflected in the storage of the parameter in this metadata object.
@param name The name of the attribute. Not null.
@param value The value of the attribute to set.
@throws NullPointerException if the name parameter is null or if the value parameter is null. | [
"Sets",
"the",
"byte",
"[]",
"value",
"for",
"the",
"specified",
"attribute",
"name",
".",
"This",
"parameter",
"will",
"be",
"copied",
"so",
"that",
"modifications",
"to",
"the",
"passed",
"in",
"parameter",
"are",
"not",
"reflected",
"in",
"the",
"storage"... | train | https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L412-L416 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java | ApplicationActivityEvent.addApplicationStarterParticipant | public void addApplicationStarterParticipant(String userId, String altUserId, String userName, String networkId)
{
addActiveParticipant(
userId,
altUserId,
userName,
true,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.ApplicationLauncher()),
networkId);
} | java | public void addApplicationStarterParticipant(String userId, String altUserId, String userName, String networkId)
{
addActiveParticipant(
userId,
altUserId,
userName,
true,
Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.ApplicationLauncher()),
networkId);
} | [
"public",
"void",
"addApplicationStarterParticipant",
"(",
"String",
"userId",
",",
"String",
"altUserId",
",",
"String",
"userName",
",",
"String",
"networkId",
")",
"{",
"addActiveParticipant",
"(",
"userId",
",",
"altUserId",
",",
"userName",
",",
"true",
",",
... | Add an Application Starter Active Participant to this message
@param userId The Active Participant's User ID
@param altUserId The Active Participant's Alternate UserID
@param userName The Active Participant's UserName
@param networkId The Active Participant's Network Access Point ID | [
"Add",
"an",
"Application",
"Starter",
"Active",
"Participant",
"to",
"this",
"message"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java#L73-L82 |
dihedron/dihedron-commons | src/main/java/org/dihedron/core/url/URLFactory.java | URLFactory.makeURL | public static URL makeURL(String specification) throws MalformedURLException {
logger.trace("retrieving URL for specification: '{}'", specification);
if(specification.startsWith("classpath:")) {
logger.trace("URL is of type 'classpath'");
return new URL(null, specification, new ClassPathURLStreamHandler());
}
logger.trace("URL is of normal type");
return new URL(specification);
} | java | public static URL makeURL(String specification) throws MalformedURLException {
logger.trace("retrieving URL for specification: '{}'", specification);
if(specification.startsWith("classpath:")) {
logger.trace("URL is of type 'classpath'");
return new URL(null, specification, new ClassPathURLStreamHandler());
}
logger.trace("URL is of normal type");
return new URL(specification);
} | [
"public",
"static",
"URL",
"makeURL",
"(",
"String",
"specification",
")",
"throws",
"MalformedURLException",
"{",
"logger",
".",
"trace",
"(",
"\"retrieving URL for specification: '{}'\"",
",",
"specification",
")",
";",
"if",
"(",
"specification",
".",
"startsWith",... | Returns an URL object for the given URL specification.
@param specification
the URL specification.
@return
an URL object; if the URL is of "classpath://" type, it will return an URL
whose connection will be opened by a specialised stream handler.
@throws MalformedURLException | [
"Returns",
"an",
"URL",
"object",
"for",
"the",
"given",
"URL",
"specification",
"."
] | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/url/URLFactory.java#L40-L48 |
Bedework/bw-util | bw-util-timezones/src/main/java/org/bedework/util/timezones/DateTimeUtil.java | DateTimeUtil.isoDateTime | public static String isoDateTime(final Date val, final TimeZone tz) {
synchronized (isoDateTimeTZFormat) {
isoDateTimeTZFormat.setTimeZone(tz);
return isoDateTimeTZFormat.format(val);
}
} | java | public static String isoDateTime(final Date val, final TimeZone tz) {
synchronized (isoDateTimeTZFormat) {
isoDateTimeTZFormat.setTimeZone(tz);
return isoDateTimeTZFormat.format(val);
}
} | [
"public",
"static",
"String",
"isoDateTime",
"(",
"final",
"Date",
"val",
",",
"final",
"TimeZone",
"tz",
")",
"{",
"synchronized",
"(",
"isoDateTimeTZFormat",
")",
"{",
"isoDateTimeTZFormat",
".",
"setTimeZone",
"(",
"tz",
")",
";",
"return",
"isoDateTimeTZForm... | Turn Date into "yyyyMMddTHHmmss" for a given timezone
@param val date
@param tz TimeZone
@return String "yyyyMMddTHHmmss" | [
"Turn",
"Date",
"into",
"yyyyMMddTHHmmss",
"for",
"a",
"given",
"timezone"
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-timezones/src/main/java/org/bedework/util/timezones/DateTimeUtil.java#L188-L193 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java | UfsJournalFile.decodeLogFile | @Nullable
static UfsJournalFile decodeLogFile(UfsJournal journal, String filename) {
URI location = URIUtils.appendPathOrDie(journal.getLogDir(), filename);
try {
String[] parts = filename.split("-");
// There can be temporary files in logs directory. Skip them.
if (parts.length != 2) {
return null;
}
long start = Long.decode(parts[0]);
long end = Long.decode(parts[1]);
return UfsJournalFile.createLogFile(location, start, end);
} catch (IllegalStateException e) {
LOG.error("Illegal journal file {}.", location);
throw e;
} catch (NumberFormatException e) {
// There can be temporary files (e.g. created for rename).
return null;
}
} | java | @Nullable
static UfsJournalFile decodeLogFile(UfsJournal journal, String filename) {
URI location = URIUtils.appendPathOrDie(journal.getLogDir(), filename);
try {
String[] parts = filename.split("-");
// There can be temporary files in logs directory. Skip them.
if (parts.length != 2) {
return null;
}
long start = Long.decode(parts[0]);
long end = Long.decode(parts[1]);
return UfsJournalFile.createLogFile(location, start, end);
} catch (IllegalStateException e) {
LOG.error("Illegal journal file {}.", location);
throw e;
} catch (NumberFormatException e) {
// There can be temporary files (e.g. created for rename).
return null;
}
} | [
"@",
"Nullable",
"static",
"UfsJournalFile",
"decodeLogFile",
"(",
"UfsJournal",
"journal",
",",
"String",
"filename",
")",
"{",
"URI",
"location",
"=",
"URIUtils",
".",
"appendPathOrDie",
"(",
"journal",
".",
"getLogDir",
"(",
")",
",",
"filename",
")",
";",
... | Decodes a checkpoint or a log file name into a {@link UfsJournalFile}.
@param journal the UFS journal instance
@param filename the filename
@return the instance of {@link UfsJournalFile}, null if the file invalid | [
"Decodes",
"a",
"checkpoint",
"or",
"a",
"log",
"file",
"name",
"into",
"a",
"{",
"@link",
"UfsJournalFile",
"}",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java#L150-L170 |
geomajas/geomajas-project-client-gwt2 | plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/message/MessageBox.java | MessageBox.showYesNoMessageBox | public static MessageBox showYesNoMessageBox(String title, String question, Callback<Boolean, Void> onFinished) {
MessageBox box = new MessageBox(title, question, onFinished);
box.setMessageStyleType(MessageStyleType.HELP);
box.setMessageBoxType(MessageBoxType.YESNO);
box.center();
return box;
} | java | public static MessageBox showYesNoMessageBox(String title, String question, Callback<Boolean, Void> onFinished) {
MessageBox box = new MessageBox(title, question, onFinished);
box.setMessageStyleType(MessageStyleType.HELP);
box.setMessageBoxType(MessageBoxType.YESNO);
box.center();
return box;
} | [
"public",
"static",
"MessageBox",
"showYesNoMessageBox",
"(",
"String",
"title",
",",
"String",
"question",
",",
"Callback",
"<",
"Boolean",
",",
"Void",
">",
"onFinished",
")",
"{",
"MessageBox",
"box",
"=",
"new",
"MessageBox",
"(",
"title",
",",
"question",... | This will show a MessageBox expecting an answer.
<p>
onFinished.onSuccess will be called with true for yes, and false for no.
<p>
if the dialogbox is closed with the closebutton instead of a button, onFinished.onFailure will be called.
@param title
@param question
@param onFinished
@return | [
"This",
"will",
"show",
"a",
"MessageBox",
"expecting",
"an",
"answer",
".",
"<p",
">",
"onFinished",
".",
"onSuccess",
"will",
"be",
"called",
"with",
"true",
"for",
"yes",
"and",
"false",
"for",
"no",
".",
"<p",
">",
"if",
"the",
"dialogbox",
"is",
"... | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/example-jar/src/main/java/org/geomajas/gwt2/plugin/corewidget/example/client/sample/message/MessageBox.java#L310-L316 |
haifengl/smile | core/src/main/java/smile/association/TotalSupportTree.java | TotalSupportTree.getFrequentItemsets | private long getFrequentItemsets(PrintStream out, List<ItemSet> list) {
long n = 0;
if (root.children != null) {
for (int i = 0; i < root.children.length; i++) {
Node child = root.children[i];
if (child != null && child.support >= minSupport) {
int[] itemset = {child.id};
n += getFrequentItemsets(out, list, itemset, i, child);
}
}
}
return n;
} | java | private long getFrequentItemsets(PrintStream out, List<ItemSet> list) {
long n = 0;
if (root.children != null) {
for (int i = 0; i < root.children.length; i++) {
Node child = root.children[i];
if (child != null && child.support >= minSupport) {
int[] itemset = {child.id};
n += getFrequentItemsets(out, list, itemset, i, child);
}
}
}
return n;
} | [
"private",
"long",
"getFrequentItemsets",
"(",
"PrintStream",
"out",
",",
"List",
"<",
"ItemSet",
">",
"list",
")",
"{",
"long",
"n",
"=",
"0",
";",
"if",
"(",
"root",
".",
"children",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Returns the set of frequent item sets.
@param out a print stream for output of frequent item sets.
@param list a container to store frequent item sets on output.
@return the number of discovered frequent item sets | [
"Returns",
"the",
"set",
"of",
"frequent",
"item",
"sets",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/TotalSupportTree.java#L192-L205 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/qe/IndexedQueryExecutor.java | IndexedQueryExecutor.compareWithNullHigh | static int compareWithNullHigh(Object a, Object b) {
return a == null ? (b == null ? 0 : -1) : (b == null ? 1 : ((Comparable) a).compareTo(b));
} | java | static int compareWithNullHigh(Object a, Object b) {
return a == null ? (b == null ? 0 : -1) : (b == null ? 1 : ((Comparable) a).compareTo(b));
} | [
"static",
"int",
"compareWithNullHigh",
"(",
"Object",
"a",
",",
"Object",
"b",
")",
"{",
"return",
"a",
"==",
"null",
"?",
"(",
"b",
"==",
"null",
"?",
"0",
":",
"-",
"1",
")",
":",
"(",
"b",
"==",
"null",
"?",
"1",
":",
"(",
"(",
"Comparable"... | Compares two objects which are assumed to be Comparable. If one value is
null, it is treated as being higher. This consistent with all other
property value comparisons in carbonado. | [
"Compares",
"two",
"objects",
"which",
"are",
"assumed",
"to",
"be",
"Comparable",
".",
"If",
"one",
"value",
"is",
"null",
"it",
"is",
"treated",
"as",
"being",
"higher",
".",
"This",
"consistent",
"with",
"all",
"other",
"property",
"value",
"comparisons",... | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/qe/IndexedQueryExecutor.java#L49-L51 |
pip-services3-java/pip-services3-components-java | src/org/pipservices3/components/connect/MemoryDiscovery.java | MemoryDiscovery.resolveOne | public ConnectionParams resolveOne(String correlationId, String key) {
ConnectionParams connection = null;
synchronized (_lock) {
for (DiscoveryItem item : _items) {
if (item.key == key && item.connection != null) {
connection = item.connection;
break;
}
}
}
return connection;
} | java | public ConnectionParams resolveOne(String correlationId, String key) {
ConnectionParams connection = null;
synchronized (_lock) {
for (DiscoveryItem item : _items) {
if (item.key == key && item.connection != null) {
connection = item.connection;
break;
}
}
}
return connection;
} | [
"public",
"ConnectionParams",
"resolveOne",
"(",
"String",
"correlationId",
",",
"String",
"key",
")",
"{",
"ConnectionParams",
"connection",
"=",
"null",
";",
"synchronized",
"(",
"_lock",
")",
"{",
"for",
"(",
"DiscoveryItem",
"item",
":",
"_items",
")",
"{"... | Resolves a single connection parameters by its key.
@param correlationId (optional) transaction id to trace execution through
call chain.
@param key a key to uniquely identify the connection.
@return receives found connection. | [
"Resolves",
"a",
"single",
"connection",
"parameters",
"by",
"its",
"key",
"."
] | train | https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/connect/MemoryDiscovery.java#L114-L127 |
soi-toolkit/soi-toolkit-mule | commons/components/studio-components/src/main/java/org/soitoolkit/commons/studio/components/logger/LoggerModule.java | LoggerModule.logInfo | @Processor
public Object logInfo(
@Optional @FriendlyName("Log Message") String message,
@Optional String integrationScenario,
@Optional String messageType,
@Optional String contractId,
@Optional String correlationId,
@Optional @FriendlyName("Extra Info") Map<String, String> extraInfo) {
return doLog(LogLevelType.INFO, message, integrationScenario, contractId, correlationId, extraInfo);
} | java | @Processor
public Object logInfo(
@Optional @FriendlyName("Log Message") String message,
@Optional String integrationScenario,
@Optional String messageType,
@Optional String contractId,
@Optional String correlationId,
@Optional @FriendlyName("Extra Info") Map<String, String> extraInfo) {
return doLog(LogLevelType.INFO, message, integrationScenario, contractId, correlationId, extraInfo);
} | [
"@",
"Processor",
"public",
"Object",
"logInfo",
"(",
"@",
"Optional",
"@",
"FriendlyName",
"(",
"\"Log Message\"",
")",
"String",
"message",
",",
"@",
"Optional",
"String",
"integrationScenario",
",",
"@",
"Optional",
"String",
"messageType",
",",
"@",
"Optiona... | Log processor for level INFO
{@sample.xml ../../../doc/soitoolkit-connector.xml.sample soitoolkit:log-info}
@param message Log-message to be processed
@param integrationScenario Optional name of the integration scenario or business process
@param messageType Optional name of the message type, e.g. a XML Schema namespace for a XML payload
@param contractId Optional name of the contract in use
@param correlationId Optional correlation identity of the message
@param extraInfo Optional extra info
@return The incoming payload | [
"Log",
"processor",
"for",
"level",
"INFO"
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/studio-components/src/main/java/org/soitoolkit/commons/studio/components/logger/LoggerModule.java#L202-L212 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerSegmentUrl.java | CustomerSegmentUrl.removeSegmentAccountUrl | public static MozuUrl removeSegmentAccountUrl(Integer accountId, Integer id)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/segments/{id}/accounts/{accountId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("id", id);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl removeSegmentAccountUrl(Integer accountId, Integer id)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/segments/{id}/accounts/{accountId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("id", id);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"removeSegmentAccountUrl",
"(",
"Integer",
"accountId",
",",
"Integer",
"id",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/segments/{id}/accounts/{accountId}\"",
")",
";",
"formatter",
"."... | Get Resource Url for RemoveSegmentAccount
@param accountId Unique identifier of the customer account.
@param id Unique identifier of the customer segment to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"RemoveSegmentAccount"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerSegmentUrl.java#L106-L112 |
agmip/agmip-common-functions | src/main/java/org/agmip/functions/PTSaxton2006.java | PTSaxton2006.getSLSAT | public static String getSLSAT(String[] soilParas) {
if (soilParas != null && soilParas.length >= 3) {
return divide(calcSaturatedMoisture(soilParas[0], soilParas[1], soilParas[2]), "100", 3);
} else {
return null;
}
} | java | public static String getSLSAT(String[] soilParas) {
if (soilParas != null && soilParas.length >= 3) {
return divide(calcSaturatedMoisture(soilParas[0], soilParas[1], soilParas[2]), "100", 3);
} else {
return null;
}
} | [
"public",
"static",
"String",
"getSLSAT",
"(",
"String",
"[",
"]",
"soilParas",
")",
"{",
"if",
"(",
"soilParas",
"!=",
"null",
"&&",
"soilParas",
".",
"length",
">=",
"3",
")",
"{",
"return",
"divide",
"(",
"calcSaturatedMoisture",
"(",
"soilParas",
"[",
... | For calculating SLSAT
@param soilParas should include 1. Sand weight percentage by layer
([0,100]%), 2. Clay weight percentage by layer ([0,100]%), 3. Organic
matter weight percentage by layer ([0,100]%), (= SLOC * 1.72)
@return Soil water, saturated, fraction | [
"For",
"calculating",
"SLSAT"
] | train | https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L63-L69 |
getsentry/sentry-java | sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java | SentryAppender.extractExceptionQueue | protected Deque<SentryException> extractExceptionQueue(ILoggingEvent iLoggingEvent) {
IThrowableProxy throwableProxy = iLoggingEvent.getThrowableProxy();
Deque<SentryException> exceptions = new ArrayDeque<>();
Set<IThrowableProxy> circularityDetector = new HashSet<>();
StackTraceElement[] enclosingStackTrace = new StackTraceElement[0];
//Stack the exceptions to send them in the reverse order
while (throwableProxy != null) {
if (!circularityDetector.add(throwableProxy)) {
addWarn("Exiting a circular exception!");
break;
}
StackTraceElement[] stackTraceElements = toStackTraceElements(throwableProxy);
StackTraceInterface stackTrace = new StackTraceInterface(stackTraceElements, enclosingStackTrace);
exceptions.push(createSentryExceptionFrom(throwableProxy, stackTrace));
enclosingStackTrace = stackTraceElements;
throwableProxy = throwableProxy.getCause();
}
return exceptions;
} | java | protected Deque<SentryException> extractExceptionQueue(ILoggingEvent iLoggingEvent) {
IThrowableProxy throwableProxy = iLoggingEvent.getThrowableProxy();
Deque<SentryException> exceptions = new ArrayDeque<>();
Set<IThrowableProxy> circularityDetector = new HashSet<>();
StackTraceElement[] enclosingStackTrace = new StackTraceElement[0];
//Stack the exceptions to send them in the reverse order
while (throwableProxy != null) {
if (!circularityDetector.add(throwableProxy)) {
addWarn("Exiting a circular exception!");
break;
}
StackTraceElement[] stackTraceElements = toStackTraceElements(throwableProxy);
StackTraceInterface stackTrace = new StackTraceInterface(stackTraceElements, enclosingStackTrace);
exceptions.push(createSentryExceptionFrom(throwableProxy, stackTrace));
enclosingStackTrace = stackTraceElements;
throwableProxy = throwableProxy.getCause();
}
return exceptions;
} | [
"protected",
"Deque",
"<",
"SentryException",
">",
"extractExceptionQueue",
"(",
"ILoggingEvent",
"iLoggingEvent",
")",
"{",
"IThrowableProxy",
"throwableProxy",
"=",
"iLoggingEvent",
".",
"getThrowableProxy",
"(",
")",
";",
"Deque",
"<",
"SentryException",
">",
"exce... | Creates a sequence of {@link SentryException}s given a particular {@link ILoggingEvent}.
@param iLoggingEvent Information detailing a particular logging event
@return A {@link Deque} of {@link SentryException}s detailing the exception chain | [
"Creates",
"a",
"sequence",
"of",
"{",
"@link",
"SentryException",
"}",
"s",
"given",
"a",
"particular",
"{",
"@link",
"ILoggingEvent",
"}",
"."
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java#L172-L193 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java | FileSystemShellUtils.getIntArg | public static int getIntArg(CommandLine cl, Option option, int defaultValue) {
int arg = defaultValue;
if (cl.hasOption(option.getLongOpt())) {
String argOption = cl.getOptionValue(option.getLongOpt());
arg = Integer.parseInt(argOption);
}
return arg;
} | java | public static int getIntArg(CommandLine cl, Option option, int defaultValue) {
int arg = defaultValue;
if (cl.hasOption(option.getLongOpt())) {
String argOption = cl.getOptionValue(option.getLongOpt());
arg = Integer.parseInt(argOption);
}
return arg;
} | [
"public",
"static",
"int",
"getIntArg",
"(",
"CommandLine",
"cl",
",",
"Option",
"option",
",",
"int",
"defaultValue",
")",
"{",
"int",
"arg",
"=",
"defaultValue",
";",
"if",
"(",
"cl",
".",
"hasOption",
"(",
"option",
".",
"getLongOpt",
"(",
")",
")",
... | Gets the value of an option from the command line.
@param cl command line object
@param option the option to check for in the command line
@param defaultValue default value for the option
@return argument from command line or default if not present | [
"Gets",
"the",
"value",
"of",
"an",
"option",
"from",
"the",
"command",
"line",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java#L231-L238 |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/resource/Import.java | Import.serialize | public JSONObject serialize(Map<String, Object> out) {
JSONObject json = new JSONObject();
json.put("device_id", deviceId);
json.put("project_id", projectId);
out.put("device_id", deviceId);
out.put("project_id", projectId);
JSONArray sourcesArr = new JSONArray();
List<String> sourceNames = new ArrayList<String>(store.keySet());
Collections.sort(sourceNames);
for (String k : sourceNames) {
JSONObject temp = new JSONObject();
temp.put("name", k);
JSONArray dataArr = new JSONArray();
for (DataPoint d : store.get(k)) {
dataArr.put(d.toJson());
}
temp.put("data", dataArr);
sourcesArr.put(temp);
}
json.put("sources", sourcesArr);
out.put("sources", sourcesArr);
return json;
} | java | public JSONObject serialize(Map<String, Object> out) {
JSONObject json = new JSONObject();
json.put("device_id", deviceId);
json.put("project_id", projectId);
out.put("device_id", deviceId);
out.put("project_id", projectId);
JSONArray sourcesArr = new JSONArray();
List<String> sourceNames = new ArrayList<String>(store.keySet());
Collections.sort(sourceNames);
for (String k : sourceNames) {
JSONObject temp = new JSONObject();
temp.put("name", k);
JSONArray dataArr = new JSONArray();
for (DataPoint d : store.get(k)) {
dataArr.put(d.toJson());
}
temp.put("data", dataArr);
sourcesArr.put(temp);
}
json.put("sources", sourcesArr);
out.put("sources", sourcesArr);
return json;
} | [
"public",
"JSONObject",
"serialize",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"out",
")",
"{",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
")",
";",
"json",
".",
"put",
"(",
"\"device_id\"",
",",
"deviceId",
")",
";",
"json",
".",
"put",... | Custom serialization method for this object to JSON.
@param out In-out parameter that maps JSON keys to their values.
@return A JSONObject representing this object. | [
"Custom",
"serialization",
"method",
"for",
"this",
"object",
"to",
"JSON",
"."
] | train | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/Import.java#L162-L184 |
Polidea/RxAndroidBle | rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java | ValueInterpreter.getStringValue | public static String getStringValue(@NonNull byte[] value, @IntRange(from = 0) int offset) {
if (offset > value.length) {
RxBleLog.w("Passed offset that exceeds the length of the byte array - returning null");
return null;
}
byte[] strBytes = new byte[value.length - offset];
for (int i = 0; i != (value.length - offset); ++i) {
strBytes[i] = value[offset + i];
}
return new String(strBytes);
} | java | public static String getStringValue(@NonNull byte[] value, @IntRange(from = 0) int offset) {
if (offset > value.length) {
RxBleLog.w("Passed offset that exceeds the length of the byte array - returning null");
return null;
}
byte[] strBytes = new byte[value.length - offset];
for (int i = 0; i != (value.length - offset); ++i) {
strBytes[i] = value[offset + i];
}
return new String(strBytes);
} | [
"public",
"static",
"String",
"getStringValue",
"(",
"@",
"NonNull",
"byte",
"[",
"]",
"value",
",",
"@",
"IntRange",
"(",
"from",
"=",
"0",
")",
"int",
"offset",
")",
"{",
"if",
"(",
"offset",
">",
"value",
".",
"length",
")",
"{",
"RxBleLog",
".",
... | Return the string value interpreted from the passed byte array.
@param offset Offset at which the string value can be found.
@return The value at a given offset | [
"Return",
"the",
"string",
"value",
"interpreted",
"from",
"the",
"passed",
"byte",
"array",
"."
] | train | https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java#L163-L173 |
to2mbn/JMCCC | jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONObject.java | JSONObject.optBigDecimal | public BigDecimal optBigDecimal(String key, BigDecimal defaultValue) {
try {
return this.getBigDecimal(key);
} catch (Exception e) {
return defaultValue;
}
} | java | public BigDecimal optBigDecimal(String key, BigDecimal defaultValue) {
try {
return this.getBigDecimal(key);
} catch (Exception e) {
return defaultValue;
}
} | [
"public",
"BigDecimal",
"optBigDecimal",
"(",
"String",
"key",
",",
"BigDecimal",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"this",
".",
"getBigDecimal",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"defaultValue",
"... | Get an optional BigDecimal associated with a key, or the defaultValue if
there is no such key or if its value is not a number. If the value is a
string, an attempt will be made to evaluate it as a number.
@param key A key string.
@param defaultValue The default.
@return An object which is the value. | [
"Get",
"an",
"optional",
"BigDecimal",
"associated",
"with",
"a",
"key",
"or",
"the",
"defaultValue",
"if",
"there",
"is",
"no",
"such",
"key",
"or",
"if",
"its",
"value",
"is",
"not",
"a",
"number",
".",
"If",
"the",
"value",
"is",
"a",
"string",
"an"... | train | https://github.com/to2mbn/JMCCC/blob/17e5b1b56ff18255cfd60976dca1a24598946647/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONObject.java#L863-L869 |
mojohaus/webstart | webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/SignConfig.java | SignConfig.createSignRequest | public JarSignerRequest createSignRequest( File jarToSign, File signedJar )
throws MojoExecutionException
{
JarSignerSignRequest request = new JarSignerSignRequest();
request.setAlias( getAlias() );
request.setKeystore( getKeystore() );
request.setSigfile( getSigfile() );
request.setStoretype( getStoretype() );
request.setWorkingDirectory( workDirectory );
request.setMaxMemory( getMaxMemory() );
request.setVerbose( isVerbose() );
request.setArchive( jarToSign );
request.setSignedjar( signedJar );
request.setTsaLocation( getTsaLocation() );
request.setProviderArg( getProviderArg() );
request.setProviderClass( getProviderClass() );
// Special handling for passwords through the Maven Security Dispatcher
request.setKeypass( decrypt( keypass ) );
request.setStorepass( decrypt( storepass ) );
if ( !arguments.isEmpty() )
{
request.setArguments( arguments.toArray( new String[arguments.size()] ) );
}
return request;
} | java | public JarSignerRequest createSignRequest( File jarToSign, File signedJar )
throws MojoExecutionException
{
JarSignerSignRequest request = new JarSignerSignRequest();
request.setAlias( getAlias() );
request.setKeystore( getKeystore() );
request.setSigfile( getSigfile() );
request.setStoretype( getStoretype() );
request.setWorkingDirectory( workDirectory );
request.setMaxMemory( getMaxMemory() );
request.setVerbose( isVerbose() );
request.setArchive( jarToSign );
request.setSignedjar( signedJar );
request.setTsaLocation( getTsaLocation() );
request.setProviderArg( getProviderArg() );
request.setProviderClass( getProviderClass() );
// Special handling for passwords through the Maven Security Dispatcher
request.setKeypass( decrypt( keypass ) );
request.setStorepass( decrypt( storepass ) );
if ( !arguments.isEmpty() )
{
request.setArguments( arguments.toArray( new String[arguments.size()] ) );
}
return request;
} | [
"public",
"JarSignerRequest",
"createSignRequest",
"(",
"File",
"jarToSign",
",",
"File",
"signedJar",
")",
"throws",
"MojoExecutionException",
"{",
"JarSignerSignRequest",
"request",
"=",
"new",
"JarSignerSignRequest",
"(",
")",
";",
"request",
".",
"setAlias",
"(",
... | Creates a jarsigner request to do a sign operation.
@param jarToSign the location of the jar to sign
@param signedJar the optional location of the signed jar to produce (if not set, will use the original location)
@return the jarsigner request
@throws MojoExecutionException if something wrong occurs | [
"Creates",
"a",
"jarsigner",
"request",
"to",
"do",
"a",
"sign",
"operation",
"."
] | train | https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/SignConfig.java#L318-L345 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.getStr | public static String getStr(Map<?, ?> map, Object key) {
return get(map, key, String.class);
} | java | public static String getStr(Map<?, ?> map, Object key) {
return get(map, key, String.class);
} | [
"public",
"static",
"String",
"getStr",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"Object",
"key",
")",
"{",
"return",
"get",
"(",
"map",
",",
"key",
",",
"String",
".",
"class",
")",
";",
"}"
] | 获取Map指定key的值,并转换为字符串
@param map Map
@param key 键
@return 值
@since 4.0.6 | [
"获取Map指定key的值,并转换为字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L756-L758 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.removeGroup | private Group removeGroup(Session session, Group group, boolean broadcast) throws Exception
{
if (group == null)
{
throw new OrganizationServiceException("Can not remove group, since it is null");
}
Node groupNode = utils.getGroupNode(session, group);
// need to minus one because of child "jos:memberships" node
long childrenCount = ((ExtendedNode)groupNode).getNodesLazily(1).getSize() - 1;
if (childrenCount > 0)
{
throw new OrganizationServiceException("Can not remove group till children exist");
}
if (broadcast)
{
preDelete(group);
}
removeMemberships(groupNode, broadcast);
groupNode.remove();
session.save();
removeFromCache(group.getId());
removeAllRelatedFromCache(group.getId());
if (broadcast)
{
postDelete(group);
}
return group;
} | java | private Group removeGroup(Session session, Group group, boolean broadcast) throws Exception
{
if (group == null)
{
throw new OrganizationServiceException("Can not remove group, since it is null");
}
Node groupNode = utils.getGroupNode(session, group);
// need to minus one because of child "jos:memberships" node
long childrenCount = ((ExtendedNode)groupNode).getNodesLazily(1).getSize() - 1;
if (childrenCount > 0)
{
throw new OrganizationServiceException("Can not remove group till children exist");
}
if (broadcast)
{
preDelete(group);
}
removeMemberships(groupNode, broadcast);
groupNode.remove();
session.save();
removeFromCache(group.getId());
removeAllRelatedFromCache(group.getId());
if (broadcast)
{
postDelete(group);
}
return group;
} | [
"private",
"Group",
"removeGroup",
"(",
"Session",
"session",
",",
"Group",
"group",
",",
"boolean",
"broadcast",
")",
"throws",
"Exception",
"{",
"if",
"(",
"group",
"==",
"null",
")",
"{",
"throw",
"new",
"OrganizationServiceException",
"(",
"\"Can not remove ... | Removes group and all related membership entities. Throws exception if children exist. | [
"Removes",
"group",
"and",
"all",
"related",
"membership",
"entities",
".",
"Throws",
"exception",
"if",
"children",
"exist",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L358-L393 |
landawn/AbacusUtil | src/com/landawn/abacus/util/StringUtil.java | StringUtil.replaceAll | public static String replaceAll(final String str, final String target, final String replacement) {
return replaceAll(str, 0, target, replacement);
} | java | public static String replaceAll(final String str, final String target, final String replacement) {
return replaceAll(str, 0, target, replacement);
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"target",
",",
"final",
"String",
"replacement",
")",
"{",
"return",
"replaceAll",
"(",
"str",
",",
"0",
",",
"target",
",",
"replacement",
")",
";",
"}"
] | <p>
Replaces all occurrences of a String within another String.
</p>
<p>
A {@code null} reference passed to this method is a no-op.
</p>
<pre>
N.replaceAll(null, *, *) = null
N.replaceAll("", *, *) = ""
N.replaceAll("any", null, *) = "any"
N.replaceAll("any", *, null) = "any"
N.replaceAll("any", "", *) = "any"
N.replaceAll("aba", "a", null) = "aba"
N.replaceAll("aba", "a", "") = "b"
N.replaceAll("aba", "a", "z") = "zbz"
</pre>
@see #replaceAll(String text, String searchString, String replacement,
int max)
@param str
text to search and replace in, may be null
@param target
the String to search for, may be null
@param replacement
the String to replace it with, may be null
@return the text with any replacements processed, {@code null} if null
String input | [
"<p",
">",
"Replaces",
"all",
"occurrences",
"of",
"a",
"String",
"within",
"another",
"String",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L985-L987 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ssl_certkey_policy.java | ns_ssl_certkey_policy.do_poll | public static ns_ssl_certkey_policy do_poll(nitro_service client, ns_ssl_certkey_policy resource) throws Exception
{
return ((ns_ssl_certkey_policy[]) resource.perform_operation(client, "do_poll"))[0];
} | java | public static ns_ssl_certkey_policy do_poll(nitro_service client, ns_ssl_certkey_policy resource) throws Exception
{
return ((ns_ssl_certkey_policy[]) resource.perform_operation(client, "do_poll"))[0];
} | [
"public",
"static",
"ns_ssl_certkey_policy",
"do_poll",
"(",
"nitro_service",
"client",
",",
"ns_ssl_certkey_policy",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"ns_ssl_certkey_policy",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
... | <pre>
Use this operation to poll all SSL certificates from all NetScalers and update the database.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"poll",
"all",
"SSL",
"certificates",
"from",
"all",
"NetScalers",
"and",
"update",
"the",
"database",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ssl_certkey_policy.java#L106-L109 |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/Normal.java | Normal.logPdf | public static double logPdf(double x, double mu, double sigma)
{
return -0.5*log(2*PI) - log(sigma) + -pow(x-mu,2)/(2*sigma*sigma);
} | java | public static double logPdf(double x, double mu, double sigma)
{
return -0.5*log(2*PI) - log(sigma) + -pow(x-mu,2)/(2*sigma*sigma);
} | [
"public",
"static",
"double",
"logPdf",
"(",
"double",
"x",
",",
"double",
"mu",
",",
"double",
"sigma",
")",
"{",
"return",
"-",
"0.5",
"*",
"log",
"(",
"2",
"*",
"PI",
")",
"-",
"log",
"(",
"sigma",
")",
"+",
"-",
"pow",
"(",
"x",
"-",
"mu",
... | Computes the log probability of a given value
@param x the value to the get log(pdf) of
@param mu the mean of the distribution
@param sigma the standard deviation of the distribution
@return the log probability | [
"Computes",
"the",
"log",
"probability",
"of",
"a",
"given",
"value"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/Normal.java#L152-L155 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java | DatabaseURIHelper.attachmentUri | public URI attachmentUri(String documentId, String revId, String attachmentId) {
return this.documentId(documentId).revId(revId).attachmentId(attachmentId).build();
} | java | public URI attachmentUri(String documentId, String revId, String attachmentId) {
return this.documentId(documentId).revId(revId).attachmentId(attachmentId).build();
} | [
"public",
"URI",
"attachmentUri",
"(",
"String",
"documentId",
",",
"String",
"revId",
",",
"String",
"attachmentId",
")",
"{",
"return",
"this",
".",
"documentId",
"(",
"documentId",
")",
".",
"revId",
"(",
"revId",
")",
".",
"attachmentId",
"(",
"attachmen... | Returns URI for Attachment having {@code attachmentId} for {@code documentId}
and {@code revId}. | [
"Returns",
"URI",
"for",
"Attachment",
"having",
"{"
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java#L156-L158 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.isFalse | public static void isFalse(boolean expression, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (expression) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
} | java | public static void isFalse(boolean expression, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (expression) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
} | [
"public",
"static",
"void",
"isFalse",
"(",
"boolean",
"expression",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"expression",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"... | 断言是否为假,如果为 {@code true} 抛出 {@code IllegalArgumentException} 异常<br>
<pre class="code">
Assert.isFalse(i < 0, "The value must be greater than zero");
</pre>
@param expression 波尔值
@param errorMsgTemplate 错误抛出异常附带的消息模板,变量用{}代替
@param params 参数列表
@throws IllegalArgumentException if expression is {@code false} | [
"断言是否为假,如果为",
"{",
"@code",
"true",
"}",
"抛出",
"{",
"@code",
"IllegalArgumentException",
"}",
"异常<br",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L63-L67 |
aws/aws-sdk-java | aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/UpdateAppRequest.java | UpdateAppRequest.withEnvironmentVariables | public UpdateAppRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
setEnvironmentVariables(environmentVariables);
return this;
} | java | public UpdateAppRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
setEnvironmentVariables(environmentVariables);
return this;
} | [
"public",
"UpdateAppRequest",
"withEnvironmentVariables",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"environmentVariables",
")",
"{",
"setEnvironmentVariables",
"(",
"environmentVariables",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Environment Variables for an Amplify App.
</p>
@param environmentVariables
Environment Variables for an Amplify App.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Environment",
"Variables",
"for",
"an",
"Amplify",
"App",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/UpdateAppRequest.java#L352-L355 |
Talend/tesb-rt-se | examples/cxf/jaxrs-attachments/service/src/main/java/service/attachment/MultipartsServiceImpl.java | MultipartsServiceImpl.duplicateMultipartBody | private MultipartBody duplicateMultipartBody(MultipartBody body) {
// It is possible to access individual parts by the Content-Id values
// This MultipartBody is expected to contain 3 parts,
// "book1", "book2" and "image".
// These individual parts have their Content-Type set to
// application/xml, application/json and application/octet-stream
// MultipartBody will use the Content-Type value of the individual
// part to read its data in a type safe way by delegating to a matching
// JAX-RS MessageBodyReader provider
Book jaxbBook = body.getAttachmentObject("book1", Book.class);
Book jsonBook = body.getAttachmentObject("book2", Book.class);
// Accessing individual attachment part, its DataHandler will be
// used to access the underlying input stream, the type-safe access
// is also possible
Attachment imageAtt = body.getAttachment("image");
if ("JAXB".equals(jaxbBook.getName()) && 1L == jaxbBook.getId()
&& "JSON".equals(jsonBook.getName()) && 2L == jsonBook.getId()
&& imageAtt != null) {
return createMultipartBody(jaxbBook, jsonBook, imageAtt.getDataHandler());
}
throw new RuntimeException("Received Book attachment is corrupted");
} | java | private MultipartBody duplicateMultipartBody(MultipartBody body) {
// It is possible to access individual parts by the Content-Id values
// This MultipartBody is expected to contain 3 parts,
// "book1", "book2" and "image".
// These individual parts have their Content-Type set to
// application/xml, application/json and application/octet-stream
// MultipartBody will use the Content-Type value of the individual
// part to read its data in a type safe way by delegating to a matching
// JAX-RS MessageBodyReader provider
Book jaxbBook = body.getAttachmentObject("book1", Book.class);
Book jsonBook = body.getAttachmentObject("book2", Book.class);
// Accessing individual attachment part, its DataHandler will be
// used to access the underlying input stream, the type-safe access
// is also possible
Attachment imageAtt = body.getAttachment("image");
if ("JAXB".equals(jaxbBook.getName()) && 1L == jaxbBook.getId()
&& "JSON".equals(jsonBook.getName()) && 2L == jsonBook.getId()
&& imageAtt != null) {
return createMultipartBody(jaxbBook, jsonBook, imageAtt.getDataHandler());
}
throw new RuntimeException("Received Book attachment is corrupted");
} | [
"private",
"MultipartBody",
"duplicateMultipartBody",
"(",
"MultipartBody",
"body",
")",
"{",
"// It is possible to access individual parts by the Content-Id values",
"// This MultipartBody is expected to contain 3 parts, ",
"// \"book1\", \"book2\" and \"image\". ",
"// These individual parts... | Verifies the MultipartBody by reading the individual parts
and copying them to a new MultipartBody instance which
will be written out in the multipart/mixed format.
@param body the incoming MultipartBody
@return new MultipartBody | [
"Verifies",
"the",
"MultipartBody",
"by",
"reading",
"the",
"individual",
"parts",
"and",
"copying",
"them",
"to",
"a",
"new",
"MultipartBody",
"instance",
"which",
"will",
"be",
"written",
"out",
"in",
"the",
"multipart",
"/",
"mixed",
"format",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/examples/cxf/jaxrs-attachments/service/src/main/java/service/attachment/MultipartsServiceImpl.java#L38-L66 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldTable.java | FieldTable.setHandle | public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
if (this.doSetHandle(bookmark, iHandleType))
return this.getRecord();
else
return null;
} | java | public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
if (this.doSetHandle(bookmark, iHandleType))
return this.getRecord();
else
return null;
} | [
"public",
"FieldList",
"setHandle",
"(",
"Object",
"bookmark",
",",
"int",
"iHandleType",
")",
"throws",
"DBException",
"{",
"if",
"(",
"this",
".",
"doSetHandle",
"(",
"bookmark",
",",
"iHandleType",
")",
")",
"return",
"this",
".",
"getRecord",
"(",
")",
... | Reposition to this record Using this bookmark.
@param Object bookmark Bookmark.
@param int iHandleType Type of handle (see getHandle).
@exception FILE_NOT_OPEN.
@return record if found/null - record not found. | [
"Reposition",
"to",
"this",
"record",
"Using",
"this",
"bookmark",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldTable.java#L477-L483 |
alkacon/opencms-core | src/org/opencms/gwt/CmsVfsService.java | CmsVfsService.renameResourceInternal | public String renameResourceInternal(CmsUUID structureId, String newName) throws CmsException {
newName = newName.trim();
CmsObject rootCms = OpenCms.initCmsObject(getCmsObject());
rootCms.getRequestContext().setSiteRoot("");
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(rootCms);
try {
CmsResource.checkResourceName(newName);
} catch (CmsIllegalArgumentException e) {
return e.getLocalizedMessage(locale);
}
CmsResource resource = rootCms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
String oldPath = resource.getRootPath();
String parentPath = CmsResource.getParentFolder(oldPath);
String newPath = CmsStringUtil.joinPaths(parentPath, newName);
try {
ensureLock(resource);
rootCms.moveResource(oldPath, newPath);
resource = rootCms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
} catch (CmsException e) {
return e.getLocalizedMessage(OpenCms.getWorkplaceManager().getWorkplaceLocale(rootCms));
}
tryUnlock(resource);
return null;
} | java | public String renameResourceInternal(CmsUUID structureId, String newName) throws CmsException {
newName = newName.trim();
CmsObject rootCms = OpenCms.initCmsObject(getCmsObject());
rootCms.getRequestContext().setSiteRoot("");
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(rootCms);
try {
CmsResource.checkResourceName(newName);
} catch (CmsIllegalArgumentException e) {
return e.getLocalizedMessage(locale);
}
CmsResource resource = rootCms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
String oldPath = resource.getRootPath();
String parentPath = CmsResource.getParentFolder(oldPath);
String newPath = CmsStringUtil.joinPaths(parentPath, newName);
try {
ensureLock(resource);
rootCms.moveResource(oldPath, newPath);
resource = rootCms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
} catch (CmsException e) {
return e.getLocalizedMessage(OpenCms.getWorkplaceManager().getWorkplaceLocale(rootCms));
}
tryUnlock(resource);
return null;
} | [
"public",
"String",
"renameResourceInternal",
"(",
"CmsUUID",
"structureId",
",",
"String",
"newName",
")",
"throws",
"CmsException",
"{",
"newName",
"=",
"newName",
".",
"trim",
"(",
")",
";",
"CmsObject",
"rootCms",
"=",
"OpenCms",
".",
"initCmsObject",
"(",
... | Internal implementation for renaming a resource.<p>
@param structureId the structure id of the resource to rename
@param newName the new resource name
@return either null if the rename was successful, or an error message
@throws CmsException if something goes wrong | [
"Internal",
"implementation",
"for",
"renaming",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsVfsService.java#L996-L1020 |
upwork/java-upwork | src/com/Upwork/api/Routers/Activities/Team.java | Team.addActivity | public JSONObject addActivity(String company, String team, HashMap<String, String> params) throws JSONException {
return oClient.post("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks", params);
} | java | public JSONObject addActivity(String company, String team, HashMap<String, String> params) throws JSONException {
return oClient.post("/otask/v1/tasks/companies/" + company + "/teams/" + team + "/tasks", params);
} | [
"public",
"JSONObject",
"addActivity",
"(",
"String",
"company",
",",
"String",
"team",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/otask/v1/tasks/companies/\"",
"+"... | Create an oTask/Activity record within a team
@param company Company ID
@param team Team ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Create",
"an",
"oTask",
"/",
"Activity",
"record",
"within",
"a",
"team"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Activities/Team.java#L97-L99 |
Netflix/eureka | eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java | AwsAsgUtil.isASGEnabled | public boolean isASGEnabled(InstanceInfo instanceInfo) {
CacheKey cacheKey = new CacheKey(getAccountId(instanceInfo, accountId), instanceInfo.getASGName());
Boolean result = asgCache.getIfPresent(cacheKey);
if (result != null) {
return result;
} else {
if (!serverConfig.shouldUseAwsAsgApi()) {
// Disabled, cached values (if any) are still being returned if the caller makes
// a decision to call the disabled client during some sort of transitioning
// period, but no new values will be fetched while disabled.
logger.info(("'{}' is not cached at the moment and won't be fetched because querying AWS ASGs "
+ "has been disabled via the config, returning the fallback value."),
cacheKey);
return true;
}
logger.info("Cache value for asg {} does not exist yet, async refreshing.", cacheKey.asgName);
// Only do an async refresh if it does not yet exist. Do this to refrain from calling aws api too much
asgCache.refresh(cacheKey);
return true;
}
} | java | public boolean isASGEnabled(InstanceInfo instanceInfo) {
CacheKey cacheKey = new CacheKey(getAccountId(instanceInfo, accountId), instanceInfo.getASGName());
Boolean result = asgCache.getIfPresent(cacheKey);
if (result != null) {
return result;
} else {
if (!serverConfig.shouldUseAwsAsgApi()) {
// Disabled, cached values (if any) are still being returned if the caller makes
// a decision to call the disabled client during some sort of transitioning
// period, but no new values will be fetched while disabled.
logger.info(("'{}' is not cached at the moment and won't be fetched because querying AWS ASGs "
+ "has been disabled via the config, returning the fallback value."),
cacheKey);
return true;
}
logger.info("Cache value for asg {} does not exist yet, async refreshing.", cacheKey.asgName);
// Only do an async refresh if it does not yet exist. Do this to refrain from calling aws api too much
asgCache.refresh(cacheKey);
return true;
}
} | [
"public",
"boolean",
"isASGEnabled",
"(",
"InstanceInfo",
"instanceInfo",
")",
"{",
"CacheKey",
"cacheKey",
"=",
"new",
"CacheKey",
"(",
"getAccountId",
"(",
"instanceInfo",
",",
"accountId",
")",
",",
"instanceInfo",
".",
"getASGName",
"(",
")",
")",
";",
"Bo... | Return the status of the ASG whether is enabled or disabled for service.
The value is picked up from the cache except the very first time.
@param instanceInfo the instanceInfo for the lookup
@return true if enabled, false otherwise | [
"Return",
"the",
"status",
"of",
"the",
"ASG",
"whether",
"is",
"enabled",
"or",
"disabled",
"for",
"service",
".",
"The",
"value",
"is",
"picked",
"up",
"from",
"the",
"cache",
"except",
"the",
"very",
"first",
"time",
"."
] | train | https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java#L162-L185 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.editGroupBadge | public GitlabBadge editGroupBadge(Integer groupId, Integer badgeId, String linkUrl, String imageUrl) throws IOException {
String tailUrl = GitlabGroup.URL + "/" + groupId + GitlabBadge.URL
+ "/" + badgeId;
GitlabHTTPRequestor requestor = retrieve().method(PUT);
requestor.with("link_url", linkUrl)
.with("image_url", imageUrl);
return requestor.to(tailUrl, GitlabBadge.class);
} | java | public GitlabBadge editGroupBadge(Integer groupId, Integer badgeId, String linkUrl, String imageUrl) throws IOException {
String tailUrl = GitlabGroup.URL + "/" + groupId + GitlabBadge.URL
+ "/" + badgeId;
GitlabHTTPRequestor requestor = retrieve().method(PUT);
requestor.with("link_url", linkUrl)
.with("image_url", imageUrl);
return requestor.to(tailUrl, GitlabBadge.class);
} | [
"public",
"GitlabBadge",
"editGroupBadge",
"(",
"Integer",
"groupId",
",",
"Integer",
"badgeId",
",",
"String",
"linkUrl",
",",
"String",
"imageUrl",
")",
"throws",
"IOException",
"{",
"String",
"tailUrl",
"=",
"GitlabGroup",
".",
"URL",
"+",
"\"/\"",
"+",
"gr... | Edit group badge
@param groupId The id of the group for which the badge should be edited
@param badgeId The id of the badge that should be edited
@param linkUrl The URL that the badge should link to
@param imageUrl The URL to the badge image
@return The updated badge
@throws IOException on GitLab API call error | [
"Edit",
"group",
"badge"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2729-L2736 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/StringUtilities.java | StringUtilities.getOccurrenceCount | public static int getOccurrenceCount(String expr, String str)
{
int ret = 0;
Pattern p = Pattern.compile(expr);
Matcher m = p.matcher(str);
while(m.find())
++ret;
return ret;
} | java | public static int getOccurrenceCount(String expr, String str)
{
int ret = 0;
Pattern p = Pattern.compile(expr);
Matcher m = p.matcher(str);
while(m.find())
++ret;
return ret;
} | [
"public",
"static",
"int",
"getOccurrenceCount",
"(",
"String",
"expr",
",",
"String",
"str",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"expr",
")",
";",
"Matcher",
"m",
"=",
"p",
".",
"matcher",
"(",... | Returns the number of occurrences of the substring in the given string.
@param expr The string to look for occurrences of
@param str The string to search
@return The number of occurences | [
"Returns",
"the",
"number",
"of",
"occurrences",
"of",
"the",
"substring",
"in",
"the",
"given",
"string",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/StringUtilities.java#L301-L309 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/label/LabeledEnumLabelPanel.java | LabeledEnumLabelPanel.newEnumLabel | @SuppressWarnings({ "rawtypes", "unchecked" })
protected EnumLabel newEnumLabel(final String id, final IModel<T> model)
{
final IModel viewableLabelModel = new PropertyModel(model.getObject(), this.getId());
return ComponentFactory.newEnumLabel(id, viewableLabelModel);
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
protected EnumLabel newEnumLabel(final String id, final IModel<T> model)
{
final IModel viewableLabelModel = new PropertyModel(model.getObject(), this.getId());
return ComponentFactory.newEnumLabel(id, viewableLabelModel);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"protected",
"EnumLabel",
"newEnumLabel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"T",
">",
"model",
")",
"{",
"final",
"IModel",
"viewableLabelModel",
"=",
... | Factory method for create a new {@link EnumLabel}. This method is invoked in the constructor
from the derived classes and can be overridden so users can provide their own version of a
new {@link EnumLabel}.
@param id
the id
@param model
the model of the label
@return the new {@link EnumLabel}. | [
"Factory",
"method",
"for",
"create",
"a",
"new",
"{",
"@link",
"EnumLabel",
"}",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"t... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/label/LabeledEnumLabelPanel.java#L80-L85 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformersImpl.java | TransformersImpl.transformAddress | protected static PathAddress transformAddress(final PathAddress original, final TransformationTarget target) {
final List<PathAddressTransformer> transformers = target.getPathTransformation(original);
final Iterator<PathAddressTransformer> transformations = transformers.iterator();
final PathAddressTransformer.BuilderImpl builder = new PathAddressTransformer.BuilderImpl(transformations, original);
return builder.start();
} | java | protected static PathAddress transformAddress(final PathAddress original, final TransformationTarget target) {
final List<PathAddressTransformer> transformers = target.getPathTransformation(original);
final Iterator<PathAddressTransformer> transformations = transformers.iterator();
final PathAddressTransformer.BuilderImpl builder = new PathAddressTransformer.BuilderImpl(transformations, original);
return builder.start();
} | [
"protected",
"static",
"PathAddress",
"transformAddress",
"(",
"final",
"PathAddress",
"original",
",",
"final",
"TransformationTarget",
"target",
")",
"{",
"final",
"List",
"<",
"PathAddressTransformer",
">",
"transformers",
"=",
"target",
".",
"getPathTransformation",... | Transform a path address.
@param original the path address to be transformed
@param target the transformation target
@return the transformed path address | [
"Transform",
"a",
"path",
"address",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersImpl.java#L159-L164 |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/astro/JulianDay.java | JulianDay.ofMeanSolarTime | public static JulianDay ofMeanSolarTime(Moment moment) {
return new JulianDay(getValue(moment, TimeScale.UT), TimeScale.UT);
} | java | public static JulianDay ofMeanSolarTime(Moment moment) {
return new JulianDay(getValue(moment, TimeScale.UT), TimeScale.UT);
} | [
"public",
"static",
"JulianDay",
"ofMeanSolarTime",
"(",
"Moment",
"moment",
")",
"{",
"return",
"new",
"JulianDay",
"(",
"getValue",
"(",
"moment",
",",
"TimeScale",
".",
"UT",
")",
",",
"TimeScale",
".",
"UT",
")",
";",
"}"
] | /*[deutsch]
<p>Erzeugt einen julianischen Tag auf der Zeitskala {@link TimeScale#UT},
also bezogen auf die mittlere Sonnenzeit. </p>
<p>Die Umrechnung in die <em>ephemeris time</em> erfordert eine delta-T-Korrektur. </p>
@param moment corresponding moment
@return JulianDay
@throws IllegalArgumentException if the Julian day of moment is not in supported range | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Erzeugt",
"einen",
"julianischen",
"Tag",
"auf",
"der",
"Zeitskala",
"{",
"@link",
"TimeScale#UT",
"}",
"also",
"bezogen",
"auf",
"die",
"mittlere",
"Sonnenzeit",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/astro/JulianDay.java#L278-L282 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java | SocketBindingJBossASClient.setStandardSocketBindingInterface | public void setStandardSocketBindingInterface(String socketBindingName, String interfaceName) throws Exception {
setStandardSocketBindingInterfaceExpression(socketBindingName, null, interfaceName);
} | java | public void setStandardSocketBindingInterface(String socketBindingName, String interfaceName) throws Exception {
setStandardSocketBindingInterfaceExpression(socketBindingName, null, interfaceName);
} | [
"public",
"void",
"setStandardSocketBindingInterface",
"(",
"String",
"socketBindingName",
",",
"String",
"interfaceName",
")",
"throws",
"Exception",
"{",
"setStandardSocketBindingInterfaceExpression",
"(",
"socketBindingName",
",",
"null",
",",
"interfaceName",
")",
";",
... | Sets the interface name for the named standard socket binding.
@param socketBindingName the name of the standard socket binding whose interface is to be set
@param interfaceName the new interface name
@throws Exception any error | [
"Sets",
"the",
"interface",
"name",
"for",
"the",
"named",
"standard",
"socket",
"binding",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java#L279-L281 |
centic9/commons-dost | src/main/java/org/dstadler/commons/net/UrlUtils.java | UrlUtils.retrieveDataPost | public static String retrieveDataPost(String sUrl, String encoding, String postRequestBody, String contentType, int timeout, SSLSocketFactory sslFactory) throws IOException {
return retrieveStringInternalPost(sUrl, encoding, postRequestBody, contentType, timeout, sslFactory);
} | java | public static String retrieveDataPost(String sUrl, String encoding, String postRequestBody, String contentType, int timeout, SSLSocketFactory sslFactory) throws IOException {
return retrieveStringInternalPost(sUrl, encoding, postRequestBody, contentType, timeout, sslFactory);
} | [
"public",
"static",
"String",
"retrieveDataPost",
"(",
"String",
"sUrl",
",",
"String",
"encoding",
",",
"String",
"postRequestBody",
",",
"String",
"contentType",
",",
"int",
"timeout",
",",
"SSLSocketFactory",
"sslFactory",
")",
"throws",
"IOException",
"{",
"re... | Download data from an URL with a POST request, if necessary converting from a character encoding.
@param sUrl The full URL used to download the content.
@param encoding An encoding, e.g. UTF-8, ISO-8859-15. Can be null.
@param postRequestBody the body of the POST request, e.g. request parameters; must not be null
@param contentType the content-type of the POST request; may be null
@param timeout The timeout in milliseconds that is used for both connection timeout and read timeout.
@param sslFactory The SSLFactory to use for the connection, this allows to support custom SSL certificates
@return The response from the HTTP POST call.
@throws IOException If accessing the resource fails. | [
"Download",
"data",
"from",
"an",
"URL",
"with",
"a",
"POST",
"request",
"if",
"necessary",
"converting",
"from",
"a",
"character",
"encoding",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/net/UrlUtils.java#L204-L206 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Transformation2D.java | Transformation2D.initializeFromRectIsotropic | void initializeFromRectIsotropic(Envelope2D src, Envelope2D dest) {
if (src.isEmpty() || dest.isEmpty() || 0 == src.getWidth()
|| 0 == src.getHeight())
setZero();
else {
yx = 0;
xy = 0;
xx = dest.getWidth() / src.getWidth();
yy = dest.getHeight() / src.getHeight();
if (xx > yy)
xx = yy;
else
yy = xx;
Point2D destCenter = dest.getCenter();
Point2D srcCenter = src.getCenter();
xd = destCenter.x - srcCenter.x * xx;
yd = destCenter.y - srcCenter.y * yy;
}
} | java | void initializeFromRectIsotropic(Envelope2D src, Envelope2D dest) {
if (src.isEmpty() || dest.isEmpty() || 0 == src.getWidth()
|| 0 == src.getHeight())
setZero();
else {
yx = 0;
xy = 0;
xx = dest.getWidth() / src.getWidth();
yy = dest.getHeight() / src.getHeight();
if (xx > yy)
xx = yy;
else
yy = xx;
Point2D destCenter = dest.getCenter();
Point2D srcCenter = src.getCenter();
xd = destCenter.x - srcCenter.x * xx;
yd = destCenter.y - srcCenter.y * yy;
}
} | [
"void",
"initializeFromRectIsotropic",
"(",
"Envelope2D",
"src",
",",
"Envelope2D",
"dest",
")",
"{",
"if",
"(",
"src",
".",
"isEmpty",
"(",
")",
"||",
"dest",
".",
"isEmpty",
"(",
")",
"||",
"0",
"==",
"src",
".",
"getWidth",
"(",
")",
"||",
"0",
"=... | Initializes an orhtonormal transformation from the Src and Dest
rectangles.
The result transformation proportionally fits the Src into the Dest. The
center of the Src will be in the center of the Dest. | [
"Initializes",
"an",
"orhtonormal",
"transformation",
"from",
"the",
"Src",
"and",
"Dest",
"rectangles",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L341-L361 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_phonebooks_bookKey_phonebookContact_POST | public Long serviceName_phonebooks_bookKey_phonebookContact_POST(String serviceName, String bookKey, String group, String homeMobile, String homePhone, String name, String surname, String workMobile, String workPhone) throws IOException {
String qPath = "/sms/{serviceName}/phonebooks/{bookKey}/phonebookContact";
StringBuilder sb = path(qPath, serviceName, bookKey);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "group", group);
addBody(o, "homeMobile", homeMobile);
addBody(o, "homePhone", homePhone);
addBody(o, "name", name);
addBody(o, "surname", surname);
addBody(o, "workMobile", workMobile);
addBody(o, "workPhone", workPhone);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, Long.class);
} | java | public Long serviceName_phonebooks_bookKey_phonebookContact_POST(String serviceName, String bookKey, String group, String homeMobile, String homePhone, String name, String surname, String workMobile, String workPhone) throws IOException {
String qPath = "/sms/{serviceName}/phonebooks/{bookKey}/phonebookContact";
StringBuilder sb = path(qPath, serviceName, bookKey);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "group", group);
addBody(o, "homeMobile", homeMobile);
addBody(o, "homePhone", homePhone);
addBody(o, "name", name);
addBody(o, "surname", surname);
addBody(o, "workMobile", workMobile);
addBody(o, "workPhone", workPhone);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, Long.class);
} | [
"public",
"Long",
"serviceName_phonebooks_bookKey_phonebookContact_POST",
"(",
"String",
"serviceName",
",",
"String",
"bookKey",
",",
"String",
"group",
",",
"String",
"homeMobile",
",",
"String",
"homePhone",
",",
"String",
"name",
",",
"String",
"surname",
",",
"... | Create a phonebook contact. Return identifier of the phonebook contact.
REST: POST /sms/{serviceName}/phonebooks/{bookKey}/phonebookContact
@param homeMobile [required] Home mobile phone number of the contact
@param surname [required] Contact surname
@param homePhone [required] Home landline phone number of the contact
@param name [required] Name of the contact
@param group [required] Group name of the phonebook
@param workMobile [required] Mobile phone office number of the contact
@param workPhone [required] Landline phone office number of the contact
@param serviceName [required] The internal name of your SMS offer
@param bookKey [required] Identifier of the phonebook | [
"Create",
"a",
"phonebook",
"contact",
".",
"Return",
"identifier",
"of",
"the",
"phonebook",
"contact",
"."
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1192-L1205 |
pac4j/pac4j | pac4j-oauth/src/main/java/org/pac4j/oauth/profile/definition/OAuthProfileDefinition.java | OAuthProfileDefinition.raiseProfileExtractionJsonError | protected void raiseProfileExtractionJsonError(String body, String missingNode) {
logger.error("Unable to extract user profile as no JSON node '{}' was found in body: {}", missingNode, body);
throw new TechnicalException("No JSON node '" + missingNode + "' to extract user profile from");
} | java | protected void raiseProfileExtractionJsonError(String body, String missingNode) {
logger.error("Unable to extract user profile as no JSON node '{}' was found in body: {}", missingNode, body);
throw new TechnicalException("No JSON node '" + missingNode + "' to extract user profile from");
} | [
"protected",
"void",
"raiseProfileExtractionJsonError",
"(",
"String",
"body",
",",
"String",
"missingNode",
")",
"{",
"logger",
".",
"error",
"(",
"\"Unable to extract user profile as no JSON node '{}' was found in body: {}\"",
",",
"missingNode",
",",
"body",
")",
";",
... | Throws a {@link TechnicalException} to indicate that user profile extraction has failed.
@param body the request body that the user profile should be have been extracted from
@param missingNode the name of a JSON node that was found missing. may be omitted | [
"Throws",
"a",
"{",
"@link",
"TechnicalException",
"}",
"to",
"indicate",
"that",
"user",
"profile",
"extraction",
"has",
"failed",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-oauth/src/main/java/org/pac4j/oauth/profile/definition/OAuthProfileDefinition.java#L61-L64 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java | ViewUtils.hideView | public static void hideView(View parentView, int id) {
if (parentView != null) {
View view = parentView.findViewById(id);
if (view != null) {
view.setVisibility(View.GONE);
} else {
Log.e("Caffeine", "View does not exist. Could not hide it.");
}
}
} | java | public static void hideView(View parentView, int id) {
if (parentView != null) {
View view = parentView.findViewById(id);
if (view != null) {
view.setVisibility(View.GONE);
} else {
Log.e("Caffeine", "View does not exist. Could not hide it.");
}
}
} | [
"public",
"static",
"void",
"hideView",
"(",
"View",
"parentView",
",",
"int",
"id",
")",
"{",
"if",
"(",
"parentView",
"!=",
"null",
")",
"{",
"View",
"view",
"=",
"parentView",
".",
"findViewById",
"(",
"id",
")",
";",
"if",
"(",
"view",
"!=",
"nul... | Sets visibility of the given view to <code>View.GONE</code>.
@param parentView The View used to call findViewId() on.
@param id R.id.xxxx value for the view to hide "expected textView to throw a ClassCastException" + textView. | [
"Sets",
"visibility",
"of",
"the",
"given",
"view",
"to",
"<code",
">",
"View",
".",
"GONE<",
"/",
"code",
">",
"."
] | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L249-L258 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/crs/ST_SetSRID.java | ST_SetSRID.setSRID | public static Geometry setSRID(Geometry geometry, Integer srid) throws IllegalArgumentException {
if (geometry == null) {
return null;
}
if (srid == null) {
throw new IllegalArgumentException("The SRID code cannot be null.");
}
Geometry geom = geometry.copy();
geom.setSRID(srid);
return geom;
} | java | public static Geometry setSRID(Geometry geometry, Integer srid) throws IllegalArgumentException {
if (geometry == null) {
return null;
}
if (srid == null) {
throw new IllegalArgumentException("The SRID code cannot be null.");
}
Geometry geom = geometry.copy();
geom.setSRID(srid);
return geom;
} | [
"public",
"static",
"Geometry",
"setSRID",
"(",
"Geometry",
"geometry",
",",
"Integer",
"srid",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"srid",
"==",
"null",
")",... | Set a new SRID to the geometry
@param geometry
@param srid
@return
@throws IllegalArgumentException | [
"Set",
"a",
"new",
"SRID",
"to",
"the",
"geometry"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/crs/ST_SetSRID.java#L51-L61 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AnchorCell.java | AnchorCell.renderDataCellContents | protected void renderDataCellContents(AbstractRenderAppender appender, String jspFragmentOutput) {
/* render any JavaScript needed to support framework features */
if (_anchorState.id != null) {
HttpServletRequest request = JspUtil.getRequest(getJspContext());
String script = renderNameAndId(request, _anchorState, null);
_anchorCellModel.setJavascript(script);
}
DECORATOR.decorate(getJspContext(), appender, _anchorCellModel);
} | java | protected void renderDataCellContents(AbstractRenderAppender appender, String jspFragmentOutput) {
/* render any JavaScript needed to support framework features */
if (_anchorState.id != null) {
HttpServletRequest request = JspUtil.getRequest(getJspContext());
String script = renderNameAndId(request, _anchorState, null);
_anchorCellModel.setJavascript(script);
}
DECORATOR.decorate(getJspContext(), appender, _anchorCellModel);
} | [
"protected",
"void",
"renderDataCellContents",
"(",
"AbstractRenderAppender",
"appender",
",",
"String",
"jspFragmentOutput",
")",
"{",
"/* render any JavaScript needed to support framework features */",
"if",
"(",
"_anchorState",
".",
"id",
"!=",
"null",
")",
"{",
"HttpSer... | Render the contents of the HTML anchor. This method calls to an
{@link org.apache.beehive.netui.databinding.datagrid.api.rendering.CellDecorator} associated with this tag.
The result of renderingi is appended to the <code>appender</code>
@param appender the {@link AbstractRenderAppender} to which output should be rendered
@param jspFragmentOutput the result of having evaluated this tag's {@link javax.servlet.jsp.tagext.JspFragment} | [
"Render",
"the",
"contents",
"of",
"the",
"HTML",
"anchor",
".",
"This",
"method",
"calls",
"to",
"an",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AnchorCell.java#L612-L622 |
alkacon/opencms-core | src/org/opencms/search/documents/CmsDocumentPdf.java | CmsDocumentPdf.extractContent | public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsIndexException, CmsException {
logContentExtraction(resource, index);
CmsFile file = readFile(cms, resource);
try {
return CmsExtractorPdf.getExtractor().extractText(file.getContents());
} catch (Exception e) {
if (e.getClass().getSimpleName().equals("EncryptedDocumentException")) {
throw new CmsIndexException(
Messages.get().container(Messages.ERR_DECRYPTING_RESOURCE_1, resource.getRootPath()),
e);
}
if (e instanceof InvalidPasswordException) {
// default password "" was wrong.
throw new CmsIndexException(
Messages.get().container(Messages.ERR_PWD_PROTECTED_1, resource.getRootPath()),
e);
}
throw new CmsIndexException(
Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()),
e);
}
} | java | public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsIndexException, CmsException {
logContentExtraction(resource, index);
CmsFile file = readFile(cms, resource);
try {
return CmsExtractorPdf.getExtractor().extractText(file.getContents());
} catch (Exception e) {
if (e.getClass().getSimpleName().equals("EncryptedDocumentException")) {
throw new CmsIndexException(
Messages.get().container(Messages.ERR_DECRYPTING_RESOURCE_1, resource.getRootPath()),
e);
}
if (e instanceof InvalidPasswordException) {
// default password "" was wrong.
throw new CmsIndexException(
Messages.get().container(Messages.ERR_PWD_PROTECTED_1, resource.getRootPath()),
e);
}
throw new CmsIndexException(
Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()),
e);
}
} | [
"public",
"I_CmsExtractionResult",
"extractContent",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"I_CmsSearchIndex",
"index",
")",
"throws",
"CmsIndexException",
",",
"CmsException",
"{",
"logContentExtraction",
"(",
"resource",
",",
"index",
")",
";... | Returns the raw text content of a given vfs resource containing Adobe PDF data.<p>
@see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex) | [
"Returns",
"the",
"raw",
"text",
"content",
"of",
"a",
"given",
"vfs",
"resource",
"containing",
"Adobe",
"PDF",
"data",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentPdf.java#L64-L87 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.