repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.resolveOperator | Symbol resolveOperator(DiagnosticPosition pos, JCTree.Tag optag,
Env<AttrContext> env, List<Type> argtypes) {
MethodResolutionContext prevResolutionContext = currentResolutionContext;
try {
currentResolutionContext = new MethodResolutionContext();
Name name = treeinfo.operatorName(optag);
return lookupMethod(env, pos, syms.predefClass, currentResolutionContext,
new BasicLookupHelper(name, syms.predefClass.type, argtypes, null, BOX) {
@Override
Symbol doLookup(Env<AttrContext> env, MethodResolutionPhase phase) {
return findMethod(env, site, name, argtypes, typeargtypes,
phase.isBoxingRequired(),
phase.isVarargsRequired(), true);
}
@Override
Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
return accessMethod(sym, pos, env.enclClass.sym.type, name,
false, argtypes, null);
}
});
} finally {
currentResolutionContext = prevResolutionContext;
}
} | java | Symbol resolveOperator(DiagnosticPosition pos, JCTree.Tag optag,
Env<AttrContext> env, List<Type> argtypes) {
MethodResolutionContext prevResolutionContext = currentResolutionContext;
try {
currentResolutionContext = new MethodResolutionContext();
Name name = treeinfo.operatorName(optag);
return lookupMethod(env, pos, syms.predefClass, currentResolutionContext,
new BasicLookupHelper(name, syms.predefClass.type, argtypes, null, BOX) {
@Override
Symbol doLookup(Env<AttrContext> env, MethodResolutionPhase phase) {
return findMethod(env, site, name, argtypes, typeargtypes,
phase.isBoxingRequired(),
phase.isVarargsRequired(), true);
}
@Override
Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
return accessMethod(sym, pos, env.enclClass.sym.type, name,
false, argtypes, null);
}
});
} finally {
currentResolutionContext = prevResolutionContext;
}
} | [
"Symbol",
"resolveOperator",
"(",
"DiagnosticPosition",
"pos",
",",
"JCTree",
".",
"Tag",
"optag",
",",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"List",
"<",
"Type",
">",
"argtypes",
")",
"{",
"MethodResolutionContext",
"prevResolutionContext",
"=",
"currentR... | Resolve operator.
@param pos The position to use for error reporting.
@param optag The tag of the operation tree.
@param env The environment current at the operation.
@param argtypes The types of the operands. | [
"Resolve",
"operator",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L2679-L2702 |
openengsb/openengsb | components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/LengthOperation.java | LengthOperation.getLengthOfObject | private Object getLengthOfObject(Object object, String functionName) throws TransformationOperationException {
try {
Method method = object.getClass().getMethod(functionName);
return method.invoke(object);
} catch (NoSuchMethodException e) {
StringBuilder builder = new StringBuilder();
builder.append("The type of the given field for the length step doesn't support ");
builder.append(functionName).append(" method. So 0 will be used as standard value.");
throw new TransformationOperationException(builder.toString(), e);
} catch (IllegalArgumentException e) {
throw new TransformationOperationException("Can't get length of the source field", e);
} catch (IllegalAccessException e) {
throw new TransformationOperationException("Can't get length of the source field", e);
} catch (InvocationTargetException e) {
throw new TransformationOperationException("Can't get length of the source field", e);
}
} | java | private Object getLengthOfObject(Object object, String functionName) throws TransformationOperationException {
try {
Method method = object.getClass().getMethod(functionName);
return method.invoke(object);
} catch (NoSuchMethodException e) {
StringBuilder builder = new StringBuilder();
builder.append("The type of the given field for the length step doesn't support ");
builder.append(functionName).append(" method. So 0 will be used as standard value.");
throw new TransformationOperationException(builder.toString(), e);
} catch (IllegalArgumentException e) {
throw new TransformationOperationException("Can't get length of the source field", e);
} catch (IllegalAccessException e) {
throw new TransformationOperationException("Can't get length of the source field", e);
} catch (InvocationTargetException e) {
throw new TransformationOperationException("Can't get length of the source field", e);
}
} | [
"private",
"Object",
"getLengthOfObject",
"(",
"Object",
"object",
",",
"String",
"functionName",
")",
"throws",
"TransformationOperationException",
"{",
"try",
"{",
"Method",
"method",
"=",
"object",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"functionName... | Returns the length of the given object got through the method of the given function name | [
"Returns",
"the",
"length",
"of",
"the",
"given",
"object",
"got",
"through",
"the",
"method",
"of",
"the",
"given",
"function",
"name"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/LengthOperation.java#L69-L85 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java | CommerceDiscountPersistenceImpl.findAll | @Override
public List<CommerceDiscount> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceDiscount> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscount",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce discounts.
<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 CommerceDiscountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce discounts
@param end the upper bound of the range of commerce discounts (not inclusive)
@return the range of commerce discounts | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"discounts",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java#L5171-L5174 |
dottydingo/hyperion | core/src/main/java/com/dottydingo/hyperion/core/endpoint/pipeline/phase/UpdatePhase.java | UpdatePhase.processLegacyRequest | protected void processLegacyRequest(HyperionContext hyperionContext)
{
EndpointRequest request = hyperionContext.getEndpointRequest();
EndpointResponse response = hyperionContext.getEndpointResponse();
ApiVersionPlugin<ApiObject<Serializable>,PersistentObject<Serializable>,Serializable> apiVersionPlugin = hyperionContext.getVersionPlugin();
EntityPlugin plugin = hyperionContext.getEntityPlugin();
PersistenceContext persistenceContext = buildPersistenceContext(hyperionContext);
Set<String> fieldSet = persistenceContext.getRequestedFields();
if(fieldSet != null)
fieldSet.add("id");
RequestContext<ApiObject<Serializable>> requestContext = null;
try
{
requestContext = marshaller.unmarshallWithContext(request.getInputStream(), apiVersionPlugin.getApiClass());
}
catch (MarshallingException e)
{
throw new BadRequestException(messageSource.getErrorMessage(ERROR_READING_REQUEST, hyperionContext.getLocale(),
e.getMessage()),e);
}
ApiObject clientObject = requestContext.getRequestObject();
List<Serializable> ids = convertIds(hyperionContext, plugin);
if(ids.size() != 1)
throw new BadRequestException(messageSource.getErrorMessage(ERROR_SINGLE_ID_REQUIRED,hyperionContext.getLocale()));
persistenceContext.setProvidedFields(requestContext.getProvidedFields());
ApiObject saved = (ApiObject) plugin.getPersistenceOperations().updateItems(
Collections.singletonList(clientObject),
persistenceContext).get(0);
processChangeEvents(hyperionContext,persistenceContext);
response.setResponseCode(200);
hyperionContext.setResult(saved);
} | java | protected void processLegacyRequest(HyperionContext hyperionContext)
{
EndpointRequest request = hyperionContext.getEndpointRequest();
EndpointResponse response = hyperionContext.getEndpointResponse();
ApiVersionPlugin<ApiObject<Serializable>,PersistentObject<Serializable>,Serializable> apiVersionPlugin = hyperionContext.getVersionPlugin();
EntityPlugin plugin = hyperionContext.getEntityPlugin();
PersistenceContext persistenceContext = buildPersistenceContext(hyperionContext);
Set<String> fieldSet = persistenceContext.getRequestedFields();
if(fieldSet != null)
fieldSet.add("id");
RequestContext<ApiObject<Serializable>> requestContext = null;
try
{
requestContext = marshaller.unmarshallWithContext(request.getInputStream(), apiVersionPlugin.getApiClass());
}
catch (MarshallingException e)
{
throw new BadRequestException(messageSource.getErrorMessage(ERROR_READING_REQUEST, hyperionContext.getLocale(),
e.getMessage()),e);
}
ApiObject clientObject = requestContext.getRequestObject();
List<Serializable> ids = convertIds(hyperionContext, plugin);
if(ids.size() != 1)
throw new BadRequestException(messageSource.getErrorMessage(ERROR_SINGLE_ID_REQUIRED,hyperionContext.getLocale()));
persistenceContext.setProvidedFields(requestContext.getProvidedFields());
ApiObject saved = (ApiObject) plugin.getPersistenceOperations().updateItems(
Collections.singletonList(clientObject),
persistenceContext).get(0);
processChangeEvents(hyperionContext,persistenceContext);
response.setResponseCode(200);
hyperionContext.setResult(saved);
} | [
"protected",
"void",
"processLegacyRequest",
"(",
"HyperionContext",
"hyperionContext",
")",
"{",
"EndpointRequest",
"request",
"=",
"hyperionContext",
".",
"getEndpointRequest",
"(",
")",
";",
"EndpointResponse",
"response",
"=",
"hyperionContext",
".",
"getEndpointRespo... | Process a legacy V1 request (single item)
@param hyperionContext The context | [
"Process",
"a",
"legacy",
"V1",
"request",
"(",
"single",
"item",
")"
] | train | https://github.com/dottydingo/hyperion/blob/c4d119c90024a88c0335d7d318e9ccdb70149764/core/src/main/java/com/dottydingo/hyperion/core/endpoint/pipeline/phase/UpdatePhase.java#L48-L88 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeCRI.java | TreeCRI.preRequest | public void preRequest(RequestInterceptorContext ctxt, InterceptorChain chain) throws InterceptorException
{
HttpServletRequest request = ctxt.getRequest();
String cmd = parseCommand(request.getRequestURI());
render(request, ctxt.getResponse(), ctxt.getServletContext(), cmd);
chain.continueChain();
} | java | public void preRequest(RequestInterceptorContext ctxt, InterceptorChain chain) throws InterceptorException
{
HttpServletRequest request = ctxt.getRequest();
String cmd = parseCommand(request.getRequestURI());
render(request, ctxt.getResponse(), ctxt.getServletContext(), cmd);
chain.continueChain();
} | [
"public",
"void",
"preRequest",
"(",
"RequestInterceptorContext",
"ctxt",
",",
"InterceptorChain",
"chain",
")",
"throws",
"InterceptorException",
"{",
"HttpServletRequest",
"request",
"=",
"ctxt",
".",
"getRequest",
"(",
")",
";",
"String",
"cmd",
"=",
"parseComman... | Implementation of the {@link RequestInterceptor#preRequest(org.apache.beehive.netui.pageflow.interceptor.request.RequestInterceptorContext, org.apache.beehive.netui.pageflow.interceptor.InterceptorChain)}
method for using this class as part of a request interceptor chain.
@param ctxt the interceptor's context object
@param chain the interceptor chain
@throws InterceptorException any exception thrown during processing | [
"Implementation",
"of",
"the",
"{",
"@link",
"RequestInterceptor#preRequest",
"(",
"org",
".",
"apache",
".",
"beehive",
".",
"netui",
".",
"pageflow",
".",
"interceptor",
".",
"request",
".",
"RequestInterceptorContext",
"org",
".",
"apache",
".",
"beehive",
".... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeCRI.java#L89-L97 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/Assert.java | Assert.isFalse | public static void isFalse(Boolean condition, Supplier<String> message) {
if (isNotFalse(condition)) {
throw new IllegalArgumentException(message.get());
}
} | java | public static void isFalse(Boolean condition, Supplier<String> message) {
if (isNotFalse(condition)) {
throw new IllegalArgumentException(message.get());
}
} | [
"public",
"static",
"void",
"isFalse",
"(",
"Boolean",
"condition",
",",
"Supplier",
"<",
"String",
">",
"message",
")",
"{",
"if",
"(",
"isNotFalse",
"(",
"condition",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
".",
"get",
... | Asserts that the condition is {@literal false}.
The assertion holds if and only if the value is equal to {@literal false}.
@param condition {@link Boolean} value being evaluated.
@param message {@link Supplier} containing the message used in the {@link IllegalArgumentException} thrown
if the assertion fails.
@throws java.lang.IllegalArgumentException if the value is not {@literal false}.
@see java.lang.Boolean#FALSE | [
"Asserts",
"that",
"the",
"condition",
"is",
"{",
"@literal",
"false",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L649-L653 |
brettwooldridge/SansOrm | src/main/java/com/zaxxer/sansorm/OrmElf.java | OrmElf.resultSetToObject | public static <T> T resultSetToObject(ResultSet resultSet, T target, Set<String> ignoredColumns) throws SQLException
{
return OrmReader.resultSetToObject(resultSet, target, ignoredColumns);
} | java | public static <T> T resultSetToObject(ResultSet resultSet, T target, Set<String> ignoredColumns) throws SQLException
{
return OrmReader.resultSetToObject(resultSet, target, ignoredColumns);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"resultSetToObject",
"(",
"ResultSet",
"resultSet",
",",
"T",
"target",
",",
"Set",
"<",
"String",
">",
"ignoredColumns",
")",
"throws",
"SQLException",
"{",
"return",
"OrmReader",
".",
"resultSetToObject",
"(",
"resultS... | Get an object from the specified ResultSet. ResultSet.next() is <i>NOT</i> called,
this should be done by the caller. <b>The ResultSet is not closed as a result of this
method.</b>
@param resultSet a {@link ResultSet}
@param target the target object to set values on
@param ignoredColumns the columns in the result set to ignore. Case as in name element or property name.
@param <T> the class template
@return the populated object
@throws SQLException if a {@link SQLException} occurs | [
"Get",
"an",
"object",
"from",
"the",
"specified",
"ResultSet",
".",
"ResultSet",
".",
"next",
"()",
"is",
"<i",
">",
"NOT<",
"/",
"i",
">",
"called",
"this",
"should",
"be",
"done",
"by",
"the",
"caller",
".",
"<b",
">",
"The",
"ResultSet",
"is",
"n... | train | https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L185-L188 |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/SqlClient.java | SqlClient.openCli | private void openCli(SessionContext context, Executor executor) {
CliClient cli = null;
try {
cli = new CliClient(context, executor);
// interactive CLI mode
if (options.getUpdateStatement() == null) {
cli.open();
}
// execute single update statement
else {
final boolean success = cli.submitUpdate(options.getUpdateStatement());
if (!success) {
throw new SqlClientException("Could not submit given SQL update statement to cluster.");
}
}
} finally {
if (cli != null) {
cli.close();
}
}
} | java | private void openCli(SessionContext context, Executor executor) {
CliClient cli = null;
try {
cli = new CliClient(context, executor);
// interactive CLI mode
if (options.getUpdateStatement() == null) {
cli.open();
}
// execute single update statement
else {
final boolean success = cli.submitUpdate(options.getUpdateStatement());
if (!success) {
throw new SqlClientException("Could not submit given SQL update statement to cluster.");
}
}
} finally {
if (cli != null) {
cli.close();
}
}
} | [
"private",
"void",
"openCli",
"(",
"SessionContext",
"context",
",",
"Executor",
"executor",
")",
"{",
"CliClient",
"cli",
"=",
"null",
";",
"try",
"{",
"cli",
"=",
"new",
"CliClient",
"(",
"context",
",",
"executor",
")",
";",
"// interactive CLI mode",
"if... | Opens the CLI client for executing SQL statements.
@param context session context
@param executor executor | [
"Opens",
"the",
"CLI",
"client",
"for",
"executing",
"SQL",
"statements",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/SqlClient.java#L117-L137 |
google/error-prone | check_api/src/main/java/com/google/errorprone/JavacErrorDescriptionListener.java | JavacErrorDescriptionListener.shouldSkipImportTreeFix | private static boolean shouldSkipImportTreeFix(DiagnosticPosition position, Fix f) {
if (position.getTree() != null && position.getTree().getKind() != Kind.IMPORT) {
return false;
}
return !f.getImportsToAdd().isEmpty() || !f.getImportsToRemove().isEmpty();
} | java | private static boolean shouldSkipImportTreeFix(DiagnosticPosition position, Fix f) {
if (position.getTree() != null && position.getTree().getKind() != Kind.IMPORT) {
return false;
}
return !f.getImportsToAdd().isEmpty() || !f.getImportsToRemove().isEmpty();
} | [
"private",
"static",
"boolean",
"shouldSkipImportTreeFix",
"(",
"DiagnosticPosition",
"position",
",",
"Fix",
"f",
")",
"{",
"if",
"(",
"position",
".",
"getTree",
"(",
")",
"!=",
"null",
"&&",
"position",
".",
"getTree",
"(",
")",
".",
"getKind",
"(",
")"... | be fixed if they were specified via SuggestedFix.replace, for example. | [
"be",
"fixed",
"if",
"they",
"were",
"specified",
"via",
"SuggestedFix",
".",
"replace",
"for",
"example",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/JavacErrorDescriptionListener.java#L119-L125 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java | AbstractLog.note | public void note(DiagnosticPosition pos, String key, Object ... args) {
note(pos, diags.noteKey(key, args));
} | java | public void note(DiagnosticPosition pos, String key, Object ... args) {
note(pos, diags.noteKey(key, args));
} | [
"public",
"void",
"note",
"(",
"DiagnosticPosition",
"pos",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"note",
"(",
"pos",
",",
"diags",
".",
"noteKey",
"(",
"key",
",",
"args",
")",
")",
";",
"}"
] | Provide a non-fatal notification, unless suppressed by the -nowarn option.
@param key The key for the localized notification message.
@param args Fields of the notification message. | [
"Provide",
"a",
"non",
"-",
"fatal",
"notification",
"unless",
"suppressed",
"by",
"the",
"-",
"nowarn",
"option",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java#L340-L342 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM1Utils.java | HELM1Utils.setCanonicalHELMSecondSection | private static String setCanonicalHELMSecondSection(Map<String, String> convertsortedIdstoIds, List<ConnectionNotation> connectionNotations) throws HELM1ConverterException {
StringBuilder notation = new StringBuilder();
for (ConnectionNotation connectionNotation : connectionNotations) {
/* canonicalize connection */
/* change the id's of the polymers to the sorted ids */
List<String> connections = new ArrayList<String>();
String source = connectionNotation.getSourceId().getId();
String target = connectionNotation.getTargetId().getId();
/* pairs will be not shown */
if (!(connectionNotation.toHELM().equals(""))) {
connections.add(convertConnection(connectionNotation.toHELM(), source, target, convertsortedIdstoIds));
connections.add(convertConnection(connectionNotation.toReverseHELM(), source, target, convertsortedIdstoIds));
Collections.sort(connections);
notation.append(connections.get(0) + "|");
}
}
if (notation.length() > 1) {
notation.setLength(notation.length() - 1);
}
return notation.toString();
} | java | private static String setCanonicalHELMSecondSection(Map<String, String> convertsortedIdstoIds, List<ConnectionNotation> connectionNotations) throws HELM1ConverterException {
StringBuilder notation = new StringBuilder();
for (ConnectionNotation connectionNotation : connectionNotations) {
/* canonicalize connection */
/* change the id's of the polymers to the sorted ids */
List<String> connections = new ArrayList<String>();
String source = connectionNotation.getSourceId().getId();
String target = connectionNotation.getTargetId().getId();
/* pairs will be not shown */
if (!(connectionNotation.toHELM().equals(""))) {
connections.add(convertConnection(connectionNotation.toHELM(), source, target, convertsortedIdstoIds));
connections.add(convertConnection(connectionNotation.toReverseHELM(), source, target, convertsortedIdstoIds));
Collections.sort(connections);
notation.append(connections.get(0) + "|");
}
}
if (notation.length() > 1) {
notation.setLength(notation.length() - 1);
}
return notation.toString();
} | [
"private",
"static",
"String",
"setCanonicalHELMSecondSection",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"convertsortedIdstoIds",
",",
"List",
"<",
"ConnectionNotation",
">",
"connectionNotations",
")",
"throws",
"HELM1ConverterException",
"{",
"StringBuilder",
"n... | method to generate a canonical HELM 1 connection section
@param convertsortedIdstoIds Map of old ids with the equivalent new ids
@return second section of HELM
@throws HELM1ConverterException | [
"method",
"to",
"generate",
"a",
"canonical",
"HELM",
"1",
"connection",
"section"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM1Utils.java#L299-L320 |
jbundle/jbundle | base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java | BaseHttpTask.initTask | public void initTask(App application, Map<String, Object> properties)
{
Utility.getLogger().warning("error: initTask() can never be called for a Servlet");
new Exception().printStackTrace();
} | java | public void initTask(App application, Map<String, Object> properties)
{
Utility.getLogger().warning("error: initTask() can never be called for a Servlet");
new Exception().printStackTrace();
} | [
"public",
"void",
"initTask",
"(",
"App",
"application",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"Utility",
".",
"getLogger",
"(",
")",
".",
"warning",
"(",
"\"error: initTask() can never be called for a Servlet\"",
")",
";",
"new"... | If this task object was created from a class name, call init(xxx) for the task.
You may want to put logic in here that checks to make sure this object was not already inited.
Typically, you init a Task object and pass it to the job scheduler. The job scheduler
will check to see if this task is owned by an application... if not, initTask() is called. | [
"If",
"this",
"task",
"object",
"was",
"created",
"from",
"a",
"class",
"name",
"call",
"init",
"(",
"xxx",
")",
"for",
"the",
"task",
".",
"You",
"may",
"want",
"to",
"put",
"logic",
"in",
"here",
"that",
"checks",
"to",
"make",
"sure",
"this",
"obj... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L475-L479 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ResourceBundle.java | ResourceBundle.getBundle | public static ResourceBundle getBundle(String baseName,
Locale targetLocale, ClassLoader loader,
ResourceBundle.Control control) {
boolean expired = false;
String bundleName = control.toBundleName(baseName, targetLocale);
Object cacheKey = loader != null ? loader : "null";
Hashtable<String, ResourceBundle> loaderCache = getLoaderCache(cacheKey);
ResourceBundle result = loaderCache.get(bundleName);
if (result != null) {
long time = control.getTimeToLive(baseName, targetLocale);
if (time == 0 || time == Control.TTL_NO_EXPIRATION_CONTROL
|| time + result.lastLoadTime < System.currentTimeMillis()) {
if (MISSING == result) {
throw new MissingResourceException(null, bundleName + '_'
+ targetLocale, EMPTY_STRING);
}
return result;
}
expired = true;
}
// try to load
ResourceBundle ret = processGetBundle(baseName, targetLocale, loader,
control, expired, result);
if (ret != null) {
loaderCache.put(bundleName, ret);
ret.lastLoadTime = System.currentTimeMillis();
return ret;
}
loaderCache.put(bundleName, MISSING);
throw new MissingResourceException(null, bundleName + '_' + targetLocale, EMPTY_STRING);
} | java | public static ResourceBundle getBundle(String baseName,
Locale targetLocale, ClassLoader loader,
ResourceBundle.Control control) {
boolean expired = false;
String bundleName = control.toBundleName(baseName, targetLocale);
Object cacheKey = loader != null ? loader : "null";
Hashtable<String, ResourceBundle> loaderCache = getLoaderCache(cacheKey);
ResourceBundle result = loaderCache.get(bundleName);
if (result != null) {
long time = control.getTimeToLive(baseName, targetLocale);
if (time == 0 || time == Control.TTL_NO_EXPIRATION_CONTROL
|| time + result.lastLoadTime < System.currentTimeMillis()) {
if (MISSING == result) {
throw new MissingResourceException(null, bundleName + '_'
+ targetLocale, EMPTY_STRING);
}
return result;
}
expired = true;
}
// try to load
ResourceBundle ret = processGetBundle(baseName, targetLocale, loader,
control, expired, result);
if (ret != null) {
loaderCache.put(bundleName, ret);
ret.lastLoadTime = System.currentTimeMillis();
return ret;
}
loaderCache.put(bundleName, MISSING);
throw new MissingResourceException(null, bundleName + '_' + targetLocale, EMPTY_STRING);
} | [
"public",
"static",
"ResourceBundle",
"getBundle",
"(",
"String",
"baseName",
",",
"Locale",
"targetLocale",
",",
"ClassLoader",
"loader",
",",
"ResourceBundle",
".",
"Control",
"control",
")",
"{",
"boolean",
"expired",
"=",
"false",
";",
"String",
"bundleName",
... | Finds the named resource bundle for the specified base name and control.
@param baseName
the base name of a resource bundle
@param targetLocale
the target locale of the resource bundle
@param loader
the class loader to load resource
@param control
the control that control the access sequence
@return the named resource bundle
@since 1.6 | [
"Finds",
"the",
"named",
"resource",
"bundle",
"for",
"the",
"specified",
"base",
"name",
"and",
"control",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ResourceBundle.java#L297-L328 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionVertex.java | ExecutionVertex.insertInputGate | void insertInputGate(final int pos, final ExecutionGate inputGate) {
if (this.inputGates[pos] != null) {
throw new IllegalStateException("Input gate at position " + pos + " is not null");
}
this.inputGates[pos] = inputGate;
} | java | void insertInputGate(final int pos, final ExecutionGate inputGate) {
if (this.inputGates[pos] != null) {
throw new IllegalStateException("Input gate at position " + pos + " is not null");
}
this.inputGates[pos] = inputGate;
} | [
"void",
"insertInputGate",
"(",
"final",
"int",
"pos",
",",
"final",
"ExecutionGate",
"inputGate",
")",
"{",
"if",
"(",
"this",
".",
"inputGates",
"[",
"pos",
"]",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Input gate at position ... | Inserts the input gate at the given position.
@param pos
the position to insert the input gate
@param outputGate
the input gate to be inserted | [
"Inserts",
"the",
"input",
"gate",
"at",
"the",
"given",
"position",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionVertex.java#L268-L275 |
petergeneric/stdlib | util/carbon-client/src/main/java/com/peterphi/carbon/type/mutable/CarbonSource.java | CarbonSource.setInOutPoint | public void setInOutPoint(long in, long out)
{
// Remove in/out point (we're replacing it)
removeInOutPoint();
// Build a new InOutPoints element
Element filter = buildInOutElement(in, out);
element.addContent(filter);
} | java | public void setInOutPoint(long in, long out)
{
// Remove in/out point (we're replacing it)
removeInOutPoint();
// Build a new InOutPoints element
Element filter = buildInOutElement(in, out);
element.addContent(filter);
} | [
"public",
"void",
"setInOutPoint",
"(",
"long",
"in",
",",
"long",
"out",
")",
"{",
"// Remove in/out point (we're replacing it)",
"removeInOutPoint",
"(",
")",
";",
"// Build a new InOutPoints element",
"Element",
"filter",
"=",
"buildInOutElement",
"(",
"in",
",",
"... | Set the in/out frame points (expressed in timebase of 1/27,000,000)
@param in
@param out | [
"Set",
"the",
"in",
"/",
"out",
"frame",
"points",
"(",
"expressed",
"in",
"timebase",
"of",
"1",
"/",
"27",
"000",
"000",
")"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/util/carbon-client/src/main/java/com/peterphi/carbon/type/mutable/CarbonSource.java#L70-L79 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/VsanUpgradeSystem.java | VsanUpgradeSystem.performVsanUpgradePreflightCheck | public VsanUpgradeSystemPreflightCheckResult performVsanUpgradePreflightCheck(ClusterComputeResource cluster, Boolean downgradeFormat) throws RuntimeFault, VsanFault, RemoteException {
return getVimService().performVsanUpgradePreflightCheck(getMOR(), cluster.getMOR(), downgradeFormat);
} | java | public VsanUpgradeSystemPreflightCheckResult performVsanUpgradePreflightCheck(ClusterComputeResource cluster, Boolean downgradeFormat) throws RuntimeFault, VsanFault, RemoteException {
return getVimService().performVsanUpgradePreflightCheck(getMOR(), cluster.getMOR(), downgradeFormat);
} | [
"public",
"VsanUpgradeSystemPreflightCheckResult",
"performVsanUpgradePreflightCheck",
"(",
"ClusterComputeResource",
"cluster",
",",
"Boolean",
"downgradeFormat",
")",
"throws",
"RuntimeFault",
",",
"VsanFault",
",",
"RemoteException",
"{",
"return",
"getVimService",
"(",
")... | Perform an upgrade pre-flight check on a cluster.
@param cluster The cluster for which to perform the check.
@param downgradeFormat Intend to perform a on-disk format downgrade instead of upgrade. Adds additional checks.
@return Pre-flight check result.
@throws RuntimeFault
@throws VsanFault
@throws RemoteException | [
"Perform",
"an",
"upgrade",
"pre",
"-",
"flight",
"check",
"on",
"a",
"cluster",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/VsanUpgradeSystem.java#L194-L196 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/validation/SARLValidator.java | SARLValidator.reportCastWarnings | protected void reportCastWarnings(JvmTypeReference concreteSyntax, LightweightTypeReference toType, LightweightTypeReference fromType) {
if (!isIgnored(OBSOLETE_CAST) && toType.isAssignableFrom(fromType)) {
addIssue(MessageFormat.format(Messages.SARLValidator_96, fromType.getHumanReadableName(),
toType.getHumanReadableName()), concreteSyntax, OBSOLETE_CAST);
}
} | java | protected void reportCastWarnings(JvmTypeReference concreteSyntax, LightweightTypeReference toType, LightweightTypeReference fromType) {
if (!isIgnored(OBSOLETE_CAST) && toType.isAssignableFrom(fromType)) {
addIssue(MessageFormat.format(Messages.SARLValidator_96, fromType.getHumanReadableName(),
toType.getHumanReadableName()), concreteSyntax, OBSOLETE_CAST);
}
} | [
"protected",
"void",
"reportCastWarnings",
"(",
"JvmTypeReference",
"concreteSyntax",
",",
"LightweightTypeReference",
"toType",
",",
"LightweightTypeReference",
"fromType",
")",
"{",
"if",
"(",
"!",
"isIgnored",
"(",
"OBSOLETE_CAST",
")",
"&&",
"toType",
".",
"isAssi... | Report the warnings associated to the casted expressions.
@param concreteSyntax the type specified into the casted expression.
@param toType the type specified into the casted expression.
@param fromType the type of the source expression. | [
"Report",
"the",
"warnings",
"associated",
"to",
"the",
"casted",
"expressions",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/validation/SARLValidator.java#L3036-L3041 |
HubSpot/jinjava | src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java | JinjavaInterpreter.resolveObject | public Object resolveObject(String variable, int lineNumber, int startPosition) {
if (StringUtils.isBlank(variable)) {
return "";
}
if (WhitespaceUtils.isQuoted(variable)) {
return WhitespaceUtils.unquote(variable);
} else {
Object val = retraceVariable(variable, lineNumber, startPosition);
if (val == null) {
return variable;
}
return val;
}
} | java | public Object resolveObject(String variable, int lineNumber, int startPosition) {
if (StringUtils.isBlank(variable)) {
return "";
}
if (WhitespaceUtils.isQuoted(variable)) {
return WhitespaceUtils.unquote(variable);
} else {
Object val = retraceVariable(variable, lineNumber, startPosition);
if (val == null) {
return variable;
}
return val;
}
} | [
"public",
"Object",
"resolveObject",
"(",
"String",
"variable",
",",
"int",
"lineNumber",
",",
"int",
"startPosition",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"variable",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"WhitespaceUti... | Resolve a variable into an object value. If given a string literal (e.g. 'foo' or "foo"), this method returns the literal unquoted. If the variable is undefined in the context, this method returns the given variable string.
@param variable
name of variable in context
@param lineNumber
current line number, for error reporting
@param startPosition
current line position, for error reporting
@return resolved value for variable | [
"Resolve",
"a",
"variable",
"into",
"an",
"object",
"value",
".",
"If",
"given",
"a",
"string",
"literal",
"(",
"e",
".",
"g",
".",
"foo",
"or",
"foo",
")",
"this",
"method",
"returns",
"the",
"literal",
"unquoted",
".",
"If",
"the",
"variable",
"is",
... | train | https://github.com/HubSpot/jinjava/blob/ce570935630f49c666170d2330b0b9ba4eddb955/src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java#L359-L372 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgVertex2D.java | DwgVertex2D.readDwgVertex2DV15 | public void readDwgVertex2DV15(int[] data, int offset) throws Exception {
//System.out.println("readDwgVertex2D executing ...");
int bitPos = offset;
bitPos = readObjectHeaderV15(data, bitPos);
Vector v = DwgUtil.getRawChar(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int flags = ((Integer)v.get(1)).intValue();
this.flags = flags;
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double x = ((Double)v.get(1)).doubleValue();
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double y = ((Double)v.get(1)).doubleValue();
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double z = ((Double)v.get(1)).doubleValue();
double[] coord = new double[]{x, y, z};
point = new double[]{x, y, z};
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double sw = ((Double)v.get(1)).doubleValue();
double ew = 0.0;
if (sw<0.0) {
ew = Math.abs(sw);
sw = ew;
} else {
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
ew = ((Double)v.get(1)).doubleValue();
}
initWidth = sw;
endWidth = ew;
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double bulge = ((Double)v.get(1)).doubleValue();
this.bulge = bulge;
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double tandir = ((Double)v.get(1)).doubleValue();
tangentDir = tandir;
bitPos = readObjectTailV15(data, bitPos);
} | java | public void readDwgVertex2DV15(int[] data, int offset) throws Exception {
//System.out.println("readDwgVertex2D executing ...");
int bitPos = offset;
bitPos = readObjectHeaderV15(data, bitPos);
Vector v = DwgUtil.getRawChar(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
int flags = ((Integer)v.get(1)).intValue();
this.flags = flags;
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double x = ((Double)v.get(1)).doubleValue();
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double y = ((Double)v.get(1)).doubleValue();
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double z = ((Double)v.get(1)).doubleValue();
double[] coord = new double[]{x, y, z};
point = new double[]{x, y, z};
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double sw = ((Double)v.get(1)).doubleValue();
double ew = 0.0;
if (sw<0.0) {
ew = Math.abs(sw);
sw = ew;
} else {
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
ew = ((Double)v.get(1)).doubleValue();
}
initWidth = sw;
endWidth = ew;
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double bulge = ((Double)v.get(1)).doubleValue();
this.bulge = bulge;
v = DwgUtil.getBitDouble(data, bitPos);
bitPos = ((Integer)v.get(0)).intValue();
double tandir = ((Double)v.get(1)).doubleValue();
tangentDir = tandir;
bitPos = readObjectTailV15(data, bitPos);
} | [
"public",
"void",
"readDwgVertex2DV15",
"(",
"int",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"throws",
"Exception",
"{",
"//System.out.println(\"readDwgVertex2D executing ...\");",
"int",
"bitPos",
"=",
"offset",
";",
"bitPos",
"=",
"readObjectHeaderV15",
"(",
"... | Read a Vertex2D in the DWG format Version 15
@param data Array of unsigned bytes obtained from the DWG binary file
@param offset The current bit offset where the value begins
@throws Exception If an unexpected bit value is found in the DWG file. Occurs
when we are looking for LwPolylines. | [
"Read",
"a",
"Vertex2D",
"in",
"the",
"DWG",
"format",
"Version",
"15"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgVertex2D.java#L47-L89 |
google/closure-templates | java/src/com/google/template/soy/base/SourceLocation.java | SourceLocation.extend | public SourceLocation extend(SourceLocation other) {
checkState(
filePath.equals(other.filePath),
"Mismatched files paths: %s and %s",
filePath,
other.filePath);
return new SourceLocation(filePath, begin, other.end);
} | java | public SourceLocation extend(SourceLocation other) {
checkState(
filePath.equals(other.filePath),
"Mismatched files paths: %s and %s",
filePath,
other.filePath);
return new SourceLocation(filePath, begin, other.end);
} | [
"public",
"SourceLocation",
"extend",
"(",
"SourceLocation",
"other",
")",
"{",
"checkState",
"(",
"filePath",
".",
"equals",
"(",
"other",
".",
"filePath",
")",
",",
"\"Mismatched files paths: %s and %s\"",
",",
"filePath",
",",
"other",
".",
"filePath",
")",
"... | Returns a new SourceLocation that starts where this SourceLocation starts and ends where {@code
other} ends. | [
"Returns",
"a",
"new",
"SourceLocation",
"that",
"starts",
"where",
"this",
"SourceLocation",
"starts",
"and",
"ends",
"where",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/base/SourceLocation.java#L187-L194 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLocalizationPersistenceImpl.java | CPDefinitionLocalizationPersistenceImpl.fetchByCPDefinitionId_LanguageId | @Override
public CPDefinitionLocalization fetchByCPDefinitionId_LanguageId(
long CPDefinitionId, String languageId) {
return fetchByCPDefinitionId_LanguageId(CPDefinitionId, languageId, true);
} | java | @Override
public CPDefinitionLocalization fetchByCPDefinitionId_LanguageId(
long CPDefinitionId, String languageId) {
return fetchByCPDefinitionId_LanguageId(CPDefinitionId, languageId, true);
} | [
"@",
"Override",
"public",
"CPDefinitionLocalization",
"fetchByCPDefinitionId_LanguageId",
"(",
"long",
"CPDefinitionId",
",",
"String",
"languageId",
")",
"{",
"return",
"fetchByCPDefinitionId_LanguageId",
"(",
"CPDefinitionId",
",",
"languageId",
",",
"true",
")",
";",
... | Returns the cp definition localization where CPDefinitionId = ? and languageId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param CPDefinitionId the cp definition ID
@param languageId the language ID
@return the matching cp definition localization, or <code>null</code> if a matching cp definition localization could not be found | [
"Returns",
"the",
"cp",
"definition",
"localization",
"where",
"CPDefinitionId",
"=",
"?",
";",
"and",
"languageId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"t... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLocalizationPersistenceImpl.java#L676-L680 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java | SimpleClientHttpRequestFactory.openConnection | protected HttpURLConnection openConnection(URL url, Proxy proxy) throws IOException {
URLConnection urlConnection = (proxy != null ? url.openConnection(proxy) : url.openConnection());
Assert.isInstanceOf(HttpURLConnection.class, urlConnection);
return (HttpURLConnection) urlConnection;
} | java | protected HttpURLConnection openConnection(URL url, Proxy proxy) throws IOException {
URLConnection urlConnection = (proxy != null ? url.openConnection(proxy) : url.openConnection());
Assert.isInstanceOf(HttpURLConnection.class, urlConnection);
return (HttpURLConnection) urlConnection;
} | [
"protected",
"HttpURLConnection",
"openConnection",
"(",
"URL",
"url",
",",
"Proxy",
"proxy",
")",
"throws",
"IOException",
"{",
"URLConnection",
"urlConnection",
"=",
"(",
"proxy",
"!=",
"null",
"?",
"url",
".",
"openConnection",
"(",
"proxy",
")",
":",
"url"... | Opens and returns a connection to the given URL.
<p>The default implementation uses the given {@linkplain #setProxy(java.net.Proxy) proxy} -
if any - to open a connection.
@param url the URL to open a connection to
@param proxy the proxy to use, may be {@code null}
@return the opened connection
@throws IOException in case of I/O errors | [
"Opens",
"and",
"returns",
"a",
"connection",
"to",
"the",
"given",
"URL",
".",
"<p",
">",
"The",
"default",
"implementation",
"uses",
"the",
"given",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java#L165-L169 |
liferay/com-liferay-commerce | commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java | CommerceAccountPersistenceImpl.findAll | @Override
public List<CommerceAccount> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceAccount> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAccount",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce accounts.
<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 CommerceAccountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce accounts
@param end the upper bound of the range of commerce accounts (not inclusive)
@return the range of commerce accounts | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"accounts",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java#L2760-L2763 |
xqbase/util | util/src/main/java/com/xqbase/util/Numbers.java | Numbers.parseLong | public static long parseLong(String s, long l) {
if (s == null) {
return l;
}
try {
return Long.parseLong(s.trim());
} catch (NumberFormatException e) {
return l;
}
} | java | public static long parseLong(String s, long l) {
if (s == null) {
return l;
}
try {
return Long.parseLong(s.trim());
} catch (NumberFormatException e) {
return l;
}
} | [
"public",
"static",
"long",
"parseLong",
"(",
"String",
"s",
",",
"long",
"l",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"l",
";",
"}",
"try",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"s",
".",
"trim",
"(",
")",
")",
";",... | Parse a <b>long</b> with a given default value <b>l</b>
@return default value if null or not parsable | [
"Parse",
"a",
"<b",
">",
"long<",
"/",
"b",
">",
"with",
"a",
"given",
"default",
"value",
"<b",
">",
"l<",
"/",
"b",
">"
] | train | https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Numbers.java#L74-L83 |
GII/broccoli | broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java | OWLValueObject.buildAsResultFromObject | public static OWLValueObject buildAsResultFromObject(OWLModel model, Object object) throws NotYetImplementedException, OWLTranslationException {
if (ObjectOWLSTranslator.isJenaBean(object)) {
try {
return new OWLValueObject(
model,
OWLURIClass.from(object),
model.createResult(new URI(ObjectOWLSTranslator.beanToJenaResource(model, object).getURI())));
} catch (URISyntaxException ex) {
throw new OWLTranslationException("translating to Jena: " + object.toString(), ex);
}
}
throw new NotYetImplementedException("fail to build new " + OWLValueObject.class.toString()
+ " from a non JenaBeans compliant object: " + object.toString());
} | java | public static OWLValueObject buildAsResultFromObject(OWLModel model, Object object) throws NotYetImplementedException, OWLTranslationException {
if (ObjectOWLSTranslator.isJenaBean(object)) {
try {
return new OWLValueObject(
model,
OWLURIClass.from(object),
model.createResult(new URI(ObjectOWLSTranslator.beanToJenaResource(model, object).getURI())));
} catch (URISyntaxException ex) {
throw new OWLTranslationException("translating to Jena: " + object.toString(), ex);
}
}
throw new NotYetImplementedException("fail to build new " + OWLValueObject.class.toString()
+ " from a non JenaBeans compliant object: " + object.toString());
} | [
"public",
"static",
"OWLValueObject",
"buildAsResultFromObject",
"(",
"OWLModel",
"model",
",",
"Object",
"object",
")",
"throws",
"NotYetImplementedException",
",",
"OWLTranslationException",
"{",
"if",
"(",
"ObjectOWLSTranslator",
".",
"isJenaBean",
"(",
"object",
")"... | Builds an instance
@param model
@param object
@return
@throws NotYetImplementedException
@throws OWLTranslationException | [
"Builds",
"an",
"instance"
] | train | https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java#L174-L187 |
lucee/Lucee | core/src/main/java/lucee/commons/io/IOUtil.java | IOUtil._getReader | private static Reader _getReader(InputStream is, Charset charset) throws IOException {
if (charset == null) charset = SystemUtil.getCharset();
return new BufferedReader(new InputStreamReader(is, charset));
} | java | private static Reader _getReader(InputStream is, Charset charset) throws IOException {
if (charset == null) charset = SystemUtil.getCharset();
return new BufferedReader(new InputStreamReader(is, charset));
} | [
"private",
"static",
"Reader",
"_getReader",
"(",
"InputStream",
"is",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"charset",
"==",
"null",
")",
"charset",
"=",
"SystemUtil",
".",
"getCharset",
"(",
")",
";",
"return",
"new",
"... | returns a Reader for the given InputStream
@param is
@param charset
@return Reader
@throws IOException | [
"returns",
"a",
"Reader",
"for",
"the",
"given",
"InputStream"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/IOUtil.java#L667-L670 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java | IDNA.convertIDNToUnicode | @Deprecated
public static StringBuffer convertIDNToUnicode(UCharacterIterator src, int options)
throws StringPrepParseException{
return convertIDNToUnicode(src.getText(), options);
} | java | @Deprecated
public static StringBuffer convertIDNToUnicode(UCharacterIterator src, int options)
throws StringPrepParseException{
return convertIDNToUnicode(src.getText(), options);
} | [
"@",
"Deprecated",
"public",
"static",
"StringBuffer",
"convertIDNToUnicode",
"(",
"UCharacterIterator",
"src",
",",
"int",
"options",
")",
"throws",
"StringPrepParseException",
"{",
"return",
"convertIDNToUnicode",
"(",
"src",
".",
"getText",
"(",
")",
",",
"option... | IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC.
This operation is done on complete domain names, e.g: "www.example.com".
<b>Note:</b> IDNA RFC specifies that a conformant application should divide a domain name
into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each,
and then convert. This function does not offer that level of granularity. The options once
set will apply to all labels in the domain name
@param src The input string as UCharacterIterator to be processed
@param options A bit set of options:
- IDNA.DEFAULT Use default options, i.e., do not process unassigned code points
and do not use STD3 ASCII rules
If unassigned code points are found the operation fails with
ParseException.
- IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations
If this option is set, the unassigned code points are in the input
are treated as normal Unicode code points.
- IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions
If this option is set and the input does not satisfy STD3 rules,
the operation will fail with ParseException
@return StringBuffer the converted String
@deprecated ICU 55 Use UTS 46 instead via {@link #getUTS46Instance(int)}.
@hide original deprecated declaration | [
"IDNA2003",
":",
"Convenience",
"function",
"that",
"implements",
"the",
"IDNToUnicode",
"operation",
"as",
"defined",
"in",
"the",
"IDNA",
"RFC",
".",
"This",
"operation",
"is",
"done",
"on",
"complete",
"domain",
"names",
"e",
".",
"g",
":",
"www",
".",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java#L780-L784 |
threerings/narya | core/src/main/java/com/threerings/crowd/client/LocationDirector.java | LocationDirector.didMoveTo | public void didMoveTo (int placeId, PlaceConfig config)
{
if (_moveListener != null) {
_moveListener.requestCompleted(config);
_moveListener = null;
}
// keep track of our previous place id
_previousPlaceId = _placeId;
// clear out our last request time
_lastRequestTime = 0;
// do some cleaning up in case we were previously in a place
didLeavePlace();
// make a note that we're now mostly in the new location
_placeId = placeId;
// start up a new place controller to manage the new place
try {
_controller = createController(config);
if (_controller == null) {
log.warning("Place config returned null controller", "config", config);
return;
}
_controller.init(_ctx, config);
// subscribe to our new place object to complete the move
subscribeToPlace();
} catch (Exception e) {
log.warning("Failed to create place controller", "config", config, e);
handleFailure(_placeId, LocationCodes.E_INTERNAL_ERROR);
}
} | java | public void didMoveTo (int placeId, PlaceConfig config)
{
if (_moveListener != null) {
_moveListener.requestCompleted(config);
_moveListener = null;
}
// keep track of our previous place id
_previousPlaceId = _placeId;
// clear out our last request time
_lastRequestTime = 0;
// do some cleaning up in case we were previously in a place
didLeavePlace();
// make a note that we're now mostly in the new location
_placeId = placeId;
// start up a new place controller to manage the new place
try {
_controller = createController(config);
if (_controller == null) {
log.warning("Place config returned null controller", "config", config);
return;
}
_controller.init(_ctx, config);
// subscribe to our new place object to complete the move
subscribeToPlace();
} catch (Exception e) {
log.warning("Failed to create place controller", "config", config, e);
handleFailure(_placeId, LocationCodes.E_INTERNAL_ERROR);
}
} | [
"public",
"void",
"didMoveTo",
"(",
"int",
"placeId",
",",
"PlaceConfig",
"config",
")",
"{",
"if",
"(",
"_moveListener",
"!=",
"null",
")",
"{",
"_moveListener",
".",
"requestCompleted",
"(",
"config",
")",
";",
"_moveListener",
"=",
"null",
";",
"}",
"//... | This can be called by cooperating directors that need to coopt the moving process to extend
it in some way or other. In such situations, they will be responsible for receiving the
successful move response and they should let the location director know that the move has
been effected.
@param placeId the place oid of our new location.
@param config the configuration information for the new place. | [
"This",
"can",
"be",
"called",
"by",
"cooperating",
"directors",
"that",
"need",
"to",
"coopt",
"the",
"moving",
"process",
"to",
"extend",
"it",
"in",
"some",
"way",
"or",
"other",
".",
"In",
"such",
"situations",
"they",
"will",
"be",
"responsible",
"for... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/client/LocationDirector.java#L282-L317 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java | AttributeDefinition.addCapabilityRequirements | public void addCapabilityRequirements(OperationContext context, Resource resource, ModelNode attributeValue) {
@SuppressWarnings("deprecation")
CapabilityReferenceRecorder refRecorder = getReferenceRecorder();
if (refRecorder != null) {
// We can't process expressions
if (attributeValue.getType() != ModelType.EXPRESSION) {
ModelNode value = attributeValue.isDefined() ? attributeValue : (defaultValue != null) ? defaultValue : new ModelNode();
refRecorder.addCapabilityRequirements(context, resource, name, value.isDefined() ? value.asString() : null);
}
}
} | java | public void addCapabilityRequirements(OperationContext context, Resource resource, ModelNode attributeValue) {
@SuppressWarnings("deprecation")
CapabilityReferenceRecorder refRecorder = getReferenceRecorder();
if (refRecorder != null) {
// We can't process expressions
if (attributeValue.getType() != ModelType.EXPRESSION) {
ModelNode value = attributeValue.isDefined() ? attributeValue : (defaultValue != null) ? defaultValue : new ModelNode();
refRecorder.addCapabilityRequirements(context, resource, name, value.isDefined() ? value.asString() : null);
}
}
} | [
"public",
"void",
"addCapabilityRequirements",
"(",
"OperationContext",
"context",
",",
"Resource",
"resource",
",",
"ModelNode",
"attributeValue",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"CapabilityReferenceRecorder",
"refRecorder",
"=",
"getRefer... | Based on the given attribute value, add capability requirements. If this definition
is for an attribute whose value is or contains a reference to the name of some capability,
this method should record the addition of a requirement for the capability.
<p>
This is a no-op in this base class. Subclasses that support attribute types that can represent
capability references should override this method.
@param context the operation context
@param resource
@param attributeValue the value of the attribute described by this object | [
"Based",
"on",
"the",
"given",
"attribute",
"value",
"add",
"capability",
"requirements",
".",
"If",
"this",
"definition",
"is",
"for",
"an",
"attribute",
"whose",
"value",
"is",
"or",
"contains",
"a",
"reference",
"to",
"the",
"name",
"of",
"some",
"capabil... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L1059-L1069 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java | PnPLepetitEPnP.process | public void process( List<Point3D_F64> worldPts , List<Point2D_F64> observed , Se3_F64 solutionModel )
{
if( worldPts.size() < 4 )
throw new IllegalArgumentException("Must provide at least 4 points");
if( worldPts.size() != observed.size() )
throw new IllegalArgumentException("Must have the same number of observations and world points");
// select world control points using the points statistics
selectWorldControlPoints(worldPts, controlWorldPts);
// compute barycentric coordinates for the world control points
computeBarycentricCoordinates(controlWorldPts, alphas, worldPts );
// create the linear system whose null space will contain the camera control points
constructM(observed, alphas, M);
// the camera points are a linear combination of these null points
extractNullPoints(M);
// compute the full constraint matrix, the others are extracted from this
if( numControl == 4 ) {
L_full.reshape(6, 10);
y.reshape(6,1);
UtilLepetitEPnP.constraintMatrix6x10(L_full,y,controlWorldPts,nullPts);
// compute 4 solutions using the null points
estimateCase1(solutions.get(0));
estimateCase2(solutions.get(1));
estimateCase3(solutions.get(2));
// results are bad in general, so skip unless needed
// always considering this case seems to hurt runtime speed a little bit
if( worldPts.size() == 4 )
estimateCase4(solutions.get(3));
} else {
L_full.reshape(3, 6);
y.reshape(3,1);
UtilLepetitEPnP.constraintMatrix3x6(L_full, y, controlWorldPts, nullPts);
estimateCase1(solutions.get(0));
estimateCase2(solutions.get(1));
if( worldPts.size() == 3 )
estimateCase3_planar(solutions.get(2));
}
computeResultFromBest(solutionModel);
} | java | public void process( List<Point3D_F64> worldPts , List<Point2D_F64> observed , Se3_F64 solutionModel )
{
if( worldPts.size() < 4 )
throw new IllegalArgumentException("Must provide at least 4 points");
if( worldPts.size() != observed.size() )
throw new IllegalArgumentException("Must have the same number of observations and world points");
// select world control points using the points statistics
selectWorldControlPoints(worldPts, controlWorldPts);
// compute barycentric coordinates for the world control points
computeBarycentricCoordinates(controlWorldPts, alphas, worldPts );
// create the linear system whose null space will contain the camera control points
constructM(observed, alphas, M);
// the camera points are a linear combination of these null points
extractNullPoints(M);
// compute the full constraint matrix, the others are extracted from this
if( numControl == 4 ) {
L_full.reshape(6, 10);
y.reshape(6,1);
UtilLepetitEPnP.constraintMatrix6x10(L_full,y,controlWorldPts,nullPts);
// compute 4 solutions using the null points
estimateCase1(solutions.get(0));
estimateCase2(solutions.get(1));
estimateCase3(solutions.get(2));
// results are bad in general, so skip unless needed
// always considering this case seems to hurt runtime speed a little bit
if( worldPts.size() == 4 )
estimateCase4(solutions.get(3));
} else {
L_full.reshape(3, 6);
y.reshape(3,1);
UtilLepetitEPnP.constraintMatrix3x6(L_full, y, controlWorldPts, nullPts);
estimateCase1(solutions.get(0));
estimateCase2(solutions.get(1));
if( worldPts.size() == 3 )
estimateCase3_planar(solutions.get(2));
}
computeResultFromBest(solutionModel);
} | [
"public",
"void",
"process",
"(",
"List",
"<",
"Point3D_F64",
">",
"worldPts",
",",
"List",
"<",
"Point2D_F64",
">",
"observed",
",",
"Se3_F64",
"solutionModel",
")",
"{",
"if",
"(",
"worldPts",
".",
"size",
"(",
")",
"<",
"4",
")",
"throw",
"new",
"Il... | Compute camera motion given a set of features with observations and 3D locations
@param worldPts Known location of features in 3D world coordinates
@param observed Observed location of features in normalized camera coordinates
@param solutionModel Output: Storage for the found solution. | [
"Compute",
"camera",
"motion",
"given",
"a",
"set",
"of",
"features",
"with",
"observations",
"and",
"3D",
"locations"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPLepetitEPnP.java#L210-L252 |
mozilla/rhino | src/org/mozilla/javascript/UintMap.java | UintMap.put | public void put(int key, int value) {
if (key < 0) Kit.codeBug();
int index = ensureIndex(key, true);
if (ivaluesShift == 0) {
int N = 1 << power;
// keys.length can be N * 2 after clear which set ivaluesShift to 0
if (keys.length != N * 2) {
int[] tmp = new int[N * 2];
System.arraycopy(keys, 0, tmp, 0, N);
keys = tmp;
}
ivaluesShift = N;
}
keys[ivaluesShift + index] = value;
} | java | public void put(int key, int value) {
if (key < 0) Kit.codeBug();
int index = ensureIndex(key, true);
if (ivaluesShift == 0) {
int N = 1 << power;
// keys.length can be N * 2 after clear which set ivaluesShift to 0
if (keys.length != N * 2) {
int[] tmp = new int[N * 2];
System.arraycopy(keys, 0, tmp, 0, N);
keys = tmp;
}
ivaluesShift = N;
}
keys[ivaluesShift + index] = value;
} | [
"public",
"void",
"put",
"(",
"int",
"key",
",",
"int",
"value",
")",
"{",
"if",
"(",
"key",
"<",
"0",
")",
"Kit",
".",
"codeBug",
"(",
")",
";",
"int",
"index",
"=",
"ensureIndex",
"(",
"key",
",",
"true",
")",
";",
"if",
"(",
"ivaluesShift",
... | Set int value of the key.
If key does not exist, also set its object value to null. | [
"Set",
"int",
"value",
"of",
"the",
"key",
".",
"If",
"key",
"does",
"not",
"exist",
"also",
"set",
"its",
"object",
"value",
"to",
"null",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/UintMap.java#L126-L140 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/core/request/SofaRequest.java | SofaRequest.addRequestProp | public void addRequestProp(String key, Object value) {
if (key == null || value == null) {
return;
}
if (requestProps == null) {
requestProps = new HashMap<String, Object>(16);
}
requestProps.put(key, value);
} | java | public void addRequestProp(String key, Object value) {
if (key == null || value == null) {
return;
}
if (requestProps == null) {
requestProps = new HashMap<String, Object>(16);
}
requestProps.put(key, value);
} | [
"public",
"void",
"addRequestProp",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
"||",
"value",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"requestProps",
"==",
"null",
")",
"{",
"requestProps",
... | Add request prop.
@param key the key
@param value the value | [
"Add",
"request",
"prop",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/core/request/SofaRequest.java#L65-L73 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.posInfIf | public static Expression posInfIf(Expression expression1, Expression expression2) {
return x("POSINFIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression posInfIf(Expression expression1, Expression expression2) {
return x("POSINFIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"posInfIf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"POSINFIF(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
... | Returned expression results in PosInf if expression1 = expression2, otherwise returns expression1.
Returns MISSING or NULL if either input is MISSING or NULL. | [
"Returned",
"expression",
"results",
"in",
"PosInf",
"if",
"expression1",
"=",
"expression2",
"otherwise",
"returns",
"expression1",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"either",
"input",
"is",
"MISSING",
"or",
"NULL",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L140-L142 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java | XmlStringTools.appendCdataSection | public static StringBuffer appendCdataSection(StringBuffer buffer, String cdataContent)
{
StringBuffer _buffer = initStringBufferIfNecessary(buffer);
return doAppendCdataSection(_buffer, cdataContent);
} | java | public static StringBuffer appendCdataSection(StringBuffer buffer, String cdataContent)
{
StringBuffer _buffer = initStringBufferIfNecessary(buffer);
return doAppendCdataSection(_buffer, cdataContent);
} | [
"public",
"static",
"StringBuffer",
"appendCdataSection",
"(",
"StringBuffer",
"buffer",
",",
"String",
"cdataContent",
")",
"{",
"StringBuffer",
"_buffer",
"=",
"initStringBufferIfNecessary",
"(",
"buffer",
")",
";",
"return",
"doAppendCdataSection",
"(",
"_buffer",
... | Add a cdata section to a StringBuffer.
If the buffer is null, a new one is created.
@param buffer
StringBuffer to fill
@param cdataContent
the cdata content
@return the buffer | [
"Add",
"a",
"cdata",
"section",
"to",
"a",
"StringBuffer",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L301-L305 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java | AbstractOptionsForSelect.withOptionalOutgoingPayload | public T withOptionalOutgoingPayload(Optional<Map<String, ByteBuffer>> outgoingPayload) {
getOptions().setOutgoingPayLoad(outgoingPayload);
return getThis();
} | java | public T withOptionalOutgoingPayload(Optional<Map<String, ByteBuffer>> outgoingPayload) {
getOptions().setOutgoingPayLoad(outgoingPayload);
return getThis();
} | [
"public",
"T",
"withOptionalOutgoingPayload",
"(",
"Optional",
"<",
"Map",
"<",
"String",
",",
"ByteBuffer",
">",
">",
"outgoingPayload",
")",
"{",
"getOptions",
"(",
")",
".",
"setOutgoingPayLoad",
"(",
"outgoingPayload",
")",
";",
"return",
"getThis",
"(",
"... | Set the given outgoing payload map on the generated statement IF NOT NULL | [
"Set",
"the",
"given",
"outgoing",
"payload",
"map",
"on",
"the",
"generated",
"statement",
"IF",
"NOT",
"NULL"
] | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java#L111-L114 |
datastax/java-driver | query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java | SchemaBuilder.alterMaterializedView | @NonNull
public static AlterMaterializedViewStart alterMaterializedView(
@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier viewName) {
return new DefaultAlterMaterializedView(keyspace, viewName);
} | java | @NonNull
public static AlterMaterializedViewStart alterMaterializedView(
@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier viewName) {
return new DefaultAlterMaterializedView(keyspace, viewName);
} | [
"@",
"NonNull",
"public",
"static",
"AlterMaterializedViewStart",
"alterMaterializedView",
"(",
"@",
"Nullable",
"CqlIdentifier",
"keyspace",
",",
"@",
"NonNull",
"CqlIdentifier",
"viewName",
")",
"{",
"return",
"new",
"DefaultAlterMaterializedView",
"(",
"keyspace",
",... | Starts an ALTER MATERIALIZED VIEW query with the given view name for the given keyspace name. | [
"Starts",
"an",
"ALTER",
"MATERIALIZED",
"VIEW",
"query",
"with",
"the",
"given",
"view",
"name",
"for",
"the",
"given",
"keyspace",
"name",
"."
] | train | https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java#L259-L263 |
Netflix/Nicobar | nicobar-core/src/main/java/com/netflix/nicobar/core/module/GraphUtils.java | GraphUtils.addIncomingEdges | public static <N> void addIncomingEdges(DirectedGraph<N, DefaultEdge> graph, N target, Set<N> sources) {
if (!graph.containsVertex(target)) {
graph.addVertex(target);
}
for (N source : sources) {
if (!graph.containsVertex(source)) {
graph.addVertex(source);
}
graph.addEdge(source, target);
}
} | java | public static <N> void addIncomingEdges(DirectedGraph<N, DefaultEdge> graph, N target, Set<N> sources) {
if (!graph.containsVertex(target)) {
graph.addVertex(target);
}
for (N source : sources) {
if (!graph.containsVertex(source)) {
graph.addVertex(source);
}
graph.addEdge(source, target);
}
} | [
"public",
"static",
"<",
"N",
">",
"void",
"addIncomingEdges",
"(",
"DirectedGraph",
"<",
"N",
",",
"DefaultEdge",
">",
"graph",
",",
"N",
"target",
",",
"Set",
"<",
"N",
">",
"sources",
")",
"{",
"if",
"(",
"!",
"graph",
".",
"containsVertex",
"(",
... | Add dependents on the give target vertex. Whether duplicates are created is dependent
on the underlying {@link DirectedGraph} implementation.
@param graph graph to be mutated
@param target target vertex for the new edges
@param sources source vertices for the new edges | [
"Add",
"dependents",
"on",
"the",
"give",
"target",
"vertex",
".",
"Whether",
"duplicates",
"are",
"created",
"is",
"dependent",
"on",
"the",
"underlying",
"{"
] | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/module/GraphUtils.java#L112-L122 |
stapler/stapler | jelly/src/main/java/org/kohsuke/stapler/jelly/ResourceBundle.java | ResourceBundle.getFormatStringWithoutDefaulting | public String getFormatStringWithoutDefaulting(Locale locale, String key) {
for (String s : toStrings(locale)) {
String msg = get(s).getProperty(key);
if(msg!=null && msg.length()>0)
return msg;
}
return null;
} | java | public String getFormatStringWithoutDefaulting(Locale locale, String key) {
for (String s : toStrings(locale)) {
String msg = get(s).getProperty(key);
if(msg!=null && msg.length()>0)
return msg;
}
return null;
} | [
"public",
"String",
"getFormatStringWithoutDefaulting",
"(",
"Locale",
"locale",
",",
"String",
"key",
")",
"{",
"for",
"(",
"String",
"s",
":",
"toStrings",
"(",
"locale",
")",
")",
"{",
"String",
"msg",
"=",
"get",
"(",
"s",
")",
".",
"getProperty",
"(... | Works like {@link #getFormatString(Locale, String)} except there's no
searching up the delegation chain. | [
"Works",
"like",
"{"
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/jelly/src/main/java/org/kohsuke/stapler/jelly/ResourceBundle.java#L107-L114 |
datacleaner/DataCleaner | desktop/api/src/main/java/org/datacleaner/widgets/properties/FormPanel.java | FormPanel.addFormEntry | public void addFormEntry(final JLabel mainLabel, final JLabel minorLabel, final JComponent component) {
add(mainLabel, new GridBagConstraints(0, _rowCounter, 1, 1, 0d, 0d, GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH, INSETS, 0, 0));
if (minorLabel != null) {
add(minorLabel, new GridBagConstraints(0, _rowCounter + 1, 1, 1, 0d, 1d, GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH, INSETS, 0, 0));
}
add(component, new GridBagConstraints(1, _rowCounter, 1, 2, 1d, 1d, GridBagConstraints.NORTHEAST,
GridBagConstraints.BOTH, INSETS, 0, 0));
// each property spans two "rows"
_rowCounter = _rowCounter + 2;
} | java | public void addFormEntry(final JLabel mainLabel, final JLabel minorLabel, final JComponent component) {
add(mainLabel, new GridBagConstraints(0, _rowCounter, 1, 1, 0d, 0d, GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH, INSETS, 0, 0));
if (minorLabel != null) {
add(minorLabel, new GridBagConstraints(0, _rowCounter + 1, 1, 1, 0d, 1d, GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH, INSETS, 0, 0));
}
add(component, new GridBagConstraints(1, _rowCounter, 1, 2, 1d, 1d, GridBagConstraints.NORTHEAST,
GridBagConstraints.BOTH, INSETS, 0, 0));
// each property spans two "rows"
_rowCounter = _rowCounter + 2;
} | [
"public",
"void",
"addFormEntry",
"(",
"final",
"JLabel",
"mainLabel",
",",
"final",
"JLabel",
"minorLabel",
",",
"final",
"JComponent",
"component",
")",
"{",
"add",
"(",
"mainLabel",
",",
"new",
"GridBagConstraints",
"(",
"0",
",",
"_rowCounter",
",",
"1",
... | Adds a form entry to the panel
@param mainLabel
@param minorLabel
@param component | [
"Adds",
"a",
"form",
"entry",
"to",
"the",
"panel"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/properties/FormPanel.java#L100-L114 |
jsurfer/JsonSurfer | jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java | JsonSurfer.collectAll | public Collection<Object> collectAll(String json, String... paths) {
return collectAll(json, compile(paths));
} | java | public Collection<Object> collectAll(String json, String... paths) {
return collectAll(json, compile(paths));
} | [
"public",
"Collection",
"<",
"Object",
">",
"collectAll",
"(",
"String",
"json",
",",
"String",
"...",
"paths",
")",
"{",
"return",
"collectAll",
"(",
"json",
",",
"compile",
"(",
"paths",
")",
")",
";",
"}"
] | Collect all matched value into a collection
@param json Json string
@param paths JsonPath
@return collection | [
"Collect",
"all",
"matched",
"value",
"into",
"a",
"collection"
] | train | https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L261-L263 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java | SightResourcesImpl.setPublishStatus | public SightPublish setPublishStatus(long sightId, SightPublish sightPublish) throws SmartsheetException {
Util.throwIfNull(sightPublish);
return this.updateResource("sights/" + sightId + "/publish", SightPublish.class, sightPublish);
} | java | public SightPublish setPublishStatus(long sightId, SightPublish sightPublish) throws SmartsheetException {
Util.throwIfNull(sightPublish);
return this.updateResource("sights/" + sightId + "/publish", SightPublish.class, sightPublish);
} | [
"public",
"SightPublish",
"setPublishStatus",
"(",
"long",
"sightId",
",",
"SightPublish",
"sightPublish",
")",
"throws",
"SmartsheetException",
"{",
"Util",
".",
"throwIfNull",
"(",
"sightPublish",
")",
";",
"return",
"this",
".",
"updateResource",
"(",
"\"sights/\... | Sets the publish status of a Sight and returns the new status, including the URLs of any enabled publishing.
It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/publish
@param sightId the Id of the Sight
@param sightPublish the SightPublish object containing publish status
@return the Sight's publish status.
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation | [
"Sets",
"the",
"publish",
"status",
"of",
"a",
"Sight",
"and",
"returns",
"the",
"new",
"status",
"including",
"the",
"URLs",
"of",
"any",
"enabled",
"publishing",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java#L240-L243 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/DateChangedHandler.java | DateChangedHandler.doRecordChange | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Write/Update a record
switch (iChangeType)
{
case DBConstants.FIELD_CHANGED_TYPE:
if (!onFieldChange)
break;
case DBConstants.REFRESH_TYPE:
case DBConstants.ADD_TYPE:
case DBConstants.UPDATE_TYPE:
DateTimeField thisField = m_field;
if (thisField == null)
if (mainFilesFieldName != null)
thisField = (DateTimeField)this.getOwner().getField(mainFilesFieldName);
boolean[] rgbEnabled = thisField.setEnableListeners(false);
thisField.setValue(DateTimeField.currentTime(), bDisplayOption, DBConstants.SCREEN_MOVE); // File written or updated, set the update date
thisField.setEnableListeners(rgbEnabled);
break;
}
return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record
} | java | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Write/Update a record
switch (iChangeType)
{
case DBConstants.FIELD_CHANGED_TYPE:
if (!onFieldChange)
break;
case DBConstants.REFRESH_TYPE:
case DBConstants.ADD_TYPE:
case DBConstants.UPDATE_TYPE:
DateTimeField thisField = m_field;
if (thisField == null)
if (mainFilesFieldName != null)
thisField = (DateTimeField)this.getOwner().getField(mainFilesFieldName);
boolean[] rgbEnabled = thisField.setEnableListeners(false);
thisField.setValue(DateTimeField.currentTime(), bDisplayOption, DBConstants.SCREEN_MOVE); // File written or updated, set the update date
thisField.setEnableListeners(rgbEnabled);
break;
}
return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record
} | [
"public",
"int",
"doRecordChange",
"(",
"FieldInfo",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"{",
"// Write/Update a record",
"switch",
"(",
"iChangeType",
")",
"{",
"case",
"DBConstants",
".",
"FIELD_CHANGED_TYPE",
":",
"if",
"(... | Called when a change is the record status is about to happen/has happened.
This method sets the field to the current time on an add or update.
@param field If this file change is due to a field, this is the field.
@param iChangeType The type of change that occurred.
@param bDisplayOption If true, display any changes.
@return an error code. | [
"Called",
"when",
"a",
"change",
"is",
"the",
"record",
"status",
"is",
"about",
"to",
"happen",
"/",
"has",
"happened",
".",
"This",
"method",
"sets",
"the",
"field",
"to",
"the",
"current",
"time",
"on",
"an",
"add",
"or",
"update",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/DateChangedHandler.java#L97-L117 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/collection/ArrayUtils.java | ArrayUtils.boundsCheck | public static void boundsCheck(int capacity, int index, int length) {
if (capacity < 0 || index < 0 || length < 0 || (index > (capacity - length))) {
throw new IndexOutOfBoundsException(String.format("index=%d, length=%d, capacity=%d", index, length, capacity));
}
} | java | public static void boundsCheck(int capacity, int index, int length) {
if (capacity < 0 || index < 0 || length < 0 || (index > (capacity - length))) {
throw new IndexOutOfBoundsException(String.format("index=%d, length=%d, capacity=%d", index, length, capacity));
}
} | [
"public",
"static",
"void",
"boundsCheck",
"(",
"int",
"capacity",
",",
"int",
"index",
",",
"int",
"length",
")",
"{",
"if",
"(",
"capacity",
"<",
"0",
"||",
"index",
"<",
"0",
"||",
"length",
"<",
"0",
"||",
"(",
"index",
">",
"(",
"capacity",
"-... | Bounds check when copying to/from a buffer
@param capacity capacity of the buffer
@param index index of copying will start from/to
@param length length of the buffer that will be read/writen | [
"Bounds",
"check",
"when",
"copying",
"to",
"/",
"from",
"a",
"buffer"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/collection/ArrayUtils.java#L184-L188 |
ontop/ontop | client/protege/src/main/java/it/unibz/inf/ontop/protege/gui/action/WrappedAction.java | WrappedAction.getKeyForActionMap | private Object getKeyForActionMap(JComponent component, KeyStroke keyStroke) {
for (int i = 0; i < 3; i++) {
InputMap inputMap = component.getInputMap(i);
if (inputMap != null) {
Object key = inputMap.get(keyStroke);
if (key != null) {
return key;
}
}
}
return null;
} | java | private Object getKeyForActionMap(JComponent component, KeyStroke keyStroke) {
for (int i = 0; i < 3; i++) {
InputMap inputMap = component.getInputMap(i);
if (inputMap != null) {
Object key = inputMap.get(keyStroke);
if (key != null) {
return key;
}
}
}
return null;
} | [
"private",
"Object",
"getKeyForActionMap",
"(",
"JComponent",
"component",
",",
"KeyStroke",
"keyStroke",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
")",
"{",
"InputMap",
"inputMap",
"=",
"component",
".",
"getInputMa... | /*
Search the 3 InputMaps to find the KeyStroke binding.
1. WHEN_IN_FOCUSED_WINDOW,
2. WHEN_FOCUSED,
3. WHEN_ANCESTOR_OF_FOCUSED_COMPONENT | [
"/",
"*",
"Search",
"the",
"3",
"InputMaps",
"to",
"find",
"the",
"KeyStroke",
"binding",
".",
"1",
".",
"WHEN_IN_FOCUSED_WINDOW",
"2",
".",
"WHEN_FOCUSED",
"3",
".",
"WHEN_ANCESTOR_OF_FOCUSED_COMPONENT"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/client/protege/src/main/java/it/unibz/inf/ontop/protege/gui/action/WrappedAction.java#L74-L85 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.copyData | public static int copyData(InputStream in, OutputStream out, int limit, int bufSize) throws IOException {
if (bufSize < 1) {
throw new IllegalArgumentException("Invalid buffer size: " + bufSize);
}
byte[] buf = new byte[bufSize];
int total = 0;
while (limit < 0 || total < limit) {
int maxRead = ((limit < 0) ? buf.length : Math.min(limit - total, buf.length));
int count = in.read(buf, 0, maxRead);
if (count < 1) {
break;
}
out.write(buf, 0, count);
total += count;
}
return total;
} | java | public static int copyData(InputStream in, OutputStream out, int limit, int bufSize) throws IOException {
if (bufSize < 1) {
throw new IllegalArgumentException("Invalid buffer size: " + bufSize);
}
byte[] buf = new byte[bufSize];
int total = 0;
while (limit < 0 || total < limit) {
int maxRead = ((limit < 0) ? buf.length : Math.min(limit - total, buf.length));
int count = in.read(buf, 0, maxRead);
if (count < 1) {
break;
}
out.write(buf, 0, count);
total += count;
}
return total;
} | [
"public",
"static",
"int",
"copyData",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
",",
"int",
"limit",
",",
"int",
"bufSize",
")",
"throws",
"IOException",
"{",
"if",
"(",
"bufSize",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Copies up to {@code limit} bytes of data from {@code in} to {@code out}.
<p>
May copy less than {@code limit} bytes if {@code in} does not have that much data available.
</p> <p>
Allocates a temporary memory buffer of {@code bufSize} bytes for this.
</p>
@param in
input stream to copy data from.
@param out
output stream to copy data to.
@param limit
maximum number of bytes to copy ({@code -1} to copy all bytes).
@param bufSize
size of the buffer to allocate (larger buffer may speed up the process).
@return The number of bytes actually copied.
@throws IOException
if one is thrown by either {@code in} or {@code out}. | [
"Copies",
"up",
"to",
"{",
"@code",
"limit",
"}",
"bytes",
"of",
"data",
"from",
"{",
"@code",
"in",
"}",
"to",
"{",
"@code",
"out",
"}",
".",
"<p",
">",
"May",
"copy",
"less",
"than",
"{",
"@code",
"limit",
"}",
"bytes",
"if",
"{",
"@code",
"in"... | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L599-L617 |
umano/AndroidSlidingUpPanel | library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java | ViewDragHelper.dispatchViewReleased | private void dispatchViewReleased(float xvel, float yvel) {
mReleaseInProgress = true;
mCallback.onViewReleased(mCapturedView, xvel, yvel);
mReleaseInProgress = false;
if (mDragState == STATE_DRAGGING) {
// onViewReleased didn't call a method that would have changed this. Go idle.
setDragState(STATE_IDLE);
}
} | java | private void dispatchViewReleased(float xvel, float yvel) {
mReleaseInProgress = true;
mCallback.onViewReleased(mCapturedView, xvel, yvel);
mReleaseInProgress = false;
if (mDragState == STATE_DRAGGING) {
// onViewReleased didn't call a method that would have changed this. Go idle.
setDragState(STATE_IDLE);
}
} | [
"private",
"void",
"dispatchViewReleased",
"(",
"float",
"xvel",
",",
"float",
"yvel",
")",
"{",
"mReleaseInProgress",
"=",
"true",
";",
"mCallback",
".",
"onViewReleased",
"(",
"mCapturedView",
",",
"xvel",
",",
"yvel",
")",
";",
"mReleaseInProgress",
"=",
"f... | Like all callback events this must happen on the UI thread, but release
involves some extra semantics. During a release (mReleaseInProgress)
is the only time it is valid to call {@link #settleCapturedViewAt(int, int)}
or {@link #flingCapturedView(int, int, int, int)}. | [
"Like",
"all",
"callback",
"events",
"this",
"must",
"happen",
"on",
"the",
"UI",
"thread",
"but",
"release",
"involves",
"some",
"extra",
"semantics",
".",
"During",
"a",
"release",
"(",
"mReleaseInProgress",
")",
"is",
"the",
"only",
"time",
"it",
"is",
... | train | https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L799-L808 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasType.java | AliasType.transformKey | private String transformKey(String key, String src, String tgt) {
StringBuilder sb = new StringBuilder();
String[] srcTokens = src.split(WILDCARD_DELIM_REGEX);
String[] tgtTokens = tgt.split(WILDCARD_DELIM_REGEX);
int len = Math.max(srcTokens.length, tgtTokens.length);
int pos = 0;
int start = 0;
for (int i = 0; i <= len; i++) {
String srcx = i >= srcTokens.length ? "" : srcTokens[i];
String tgtx = i >= tgtTokens.length ? "" : tgtTokens[i];
pos = i == len ? key.length() : pos;
if ("*".equals(srcx) || "?".equals(srcx)) {
start = pos;
} else {
pos = key.indexOf(srcx, pos);
if (pos > start) {
sb.append(key.substring(start, pos));
}
start = pos += srcx.length();
sb.append(tgtx);
}
}
return sb.toString();
} | java | private String transformKey(String key, String src, String tgt) {
StringBuilder sb = new StringBuilder();
String[] srcTokens = src.split(WILDCARD_DELIM_REGEX);
String[] tgtTokens = tgt.split(WILDCARD_DELIM_REGEX);
int len = Math.max(srcTokens.length, tgtTokens.length);
int pos = 0;
int start = 0;
for (int i = 0; i <= len; i++) {
String srcx = i >= srcTokens.length ? "" : srcTokens[i];
String tgtx = i >= tgtTokens.length ? "" : tgtTokens[i];
pos = i == len ? key.length() : pos;
if ("*".equals(srcx) || "?".equals(srcx)) {
start = pos;
} else {
pos = key.indexOf(srcx, pos);
if (pos > start) {
sb.append(key.substring(start, pos));
}
start = pos += srcx.length();
sb.append(tgtx);
}
}
return sb.toString();
} | [
"private",
"String",
"transformKey",
"(",
"String",
"key",
",",
"String",
"src",
",",
"String",
"tgt",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"[",
"]",
"srcTokens",
"=",
"src",
".",
"split",
"(",
"WILDCARD_... | Uses the source and target wildcard masks to transform an input key.
@param key The input key.
@param src The source wildcard mask.
@param tgt The target wildcard mask.
@return The transformed key. | [
"Uses",
"the",
"source",
"and",
"target",
"wildcard",
"masks",
"to",
"transform",
"an",
"input",
"key",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasType.java#L117-L146 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java | AgentSession.setStatus | public void setStatus(Presence.Mode presenceMode, int maxChats, String status)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
if (presenceMode == null) {
presenceMode = Presence.Mode.available;
}
this.presenceMode = presenceMode;
this.maxChats = maxChats;
Presence presence = new Presence(Presence.Type.available);
presence.setMode(presenceMode);
presence.setTo(this.getWorkgroupJID());
if (status != null) {
presence.setStatus(status);
}
// Send information about max chats and current chats as a packet extension.
StandardExtensionElement.Builder builder = StandardExtensionElement.builder(AgentStatus.ELEMENT_NAME,
AgentStatus.NAMESPACE);
builder.addElement("max_chats", Integer.toString(maxChats));
presence.addExtension(builder.build());
presence.addExtension(new MetaData(this.metaData));
StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(
new StanzaTypeFilter(Presence.class),
FromMatchesFilter.create(workgroupJID)), presence);
collector.nextResultOrThrow();
} | java | public void setStatus(Presence.Mode presenceMode, int maxChats, String status)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
if (!online) {
throw new IllegalStateException("Cannot set status when the agent is not online.");
}
if (presenceMode == null) {
presenceMode = Presence.Mode.available;
}
this.presenceMode = presenceMode;
this.maxChats = maxChats;
Presence presence = new Presence(Presence.Type.available);
presence.setMode(presenceMode);
presence.setTo(this.getWorkgroupJID());
if (status != null) {
presence.setStatus(status);
}
// Send information about max chats and current chats as a packet extension.
StandardExtensionElement.Builder builder = StandardExtensionElement.builder(AgentStatus.ELEMENT_NAME,
AgentStatus.NAMESPACE);
builder.addElement("max_chats", Integer.toString(maxChats));
presence.addExtension(builder.build());
presence.addExtension(new MetaData(this.metaData));
StanzaCollector collector = this.connection.createStanzaCollectorAndSend(new AndFilter(
new StanzaTypeFilter(Presence.class),
FromMatchesFilter.create(workgroupJID)), presence);
collector.nextResultOrThrow();
} | [
"public",
"void",
"setStatus",
"(",
"Presence",
".",
"Mode",
"presenceMode",
",",
"int",
"maxChats",
",",
"String",
"status",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"if",
"(",
... | Sets the agent's current status with the workgroup. The presence mode affects how offers
are routed to the agent. The possible presence modes with their meanings are as follows:<ul>
<li>Presence.Mode.AVAILABLE -- (Default) the agent is available for more chats
(equivalent to Presence.Mode.CHAT).
<li>Presence.Mode.DO_NOT_DISTURB -- the agent is busy and should not be disturbed.
However, special case, or extreme urgency chats may still be offered to the agent.
<li>Presence.Mode.AWAY -- the agent is not available and should not
have a chat routed to them (equivalent to Presence.Mode.EXTENDED_AWAY).</ul>
The max chats value is the maximum number of chats the agent is willing to have routed to
them at once. Some servers may be configured to only accept max chat values in a certain
range; for example, between two and five. In that case, the maxChats value the agent sends
may be adjusted by the server to a value within that range.
@param presenceMode the presence mode of the agent.
@param maxChats the maximum number of chats the agent is willing to accept.
@param status sets the status message of the presence update.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
@throws IllegalStateException if the agent is not online with the workgroup. | [
"Sets",
"the",
"agent",
"s",
"current",
"status",
"with",
"the",
"workgroup",
".",
"The",
"presence",
"mode",
"affects",
"how",
"offers",
"are",
"routed",
"to",
"the",
"agent",
".",
"The",
"possible",
"presence",
"modes",
"with",
"their",
"meanings",
"are",
... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L418-L450 |
haifengl/smile | math/src/main/java/smile/math/Math.java | Math.KullbackLeiblerDivergence | public static double KullbackLeiblerDivergence(SparseArray x, double[] y) {
if (x.isEmpty()) {
throw new IllegalArgumentException("List x is empty.");
}
Iterator<SparseArray.Entry> iter = x.iterator();
boolean intersection = false;
double kl = 0.0;
while (iter.hasNext()) {
SparseArray.Entry b = iter.next();
int i = b.i;
if (y[i] > 0) {
intersection = true;
kl += b.x * Math.log(b.x / y[i]);
}
}
if (intersection) {
return kl;
} else {
return Double.POSITIVE_INFINITY;
}
} | java | public static double KullbackLeiblerDivergence(SparseArray x, double[] y) {
if (x.isEmpty()) {
throw new IllegalArgumentException("List x is empty.");
}
Iterator<SparseArray.Entry> iter = x.iterator();
boolean intersection = false;
double kl = 0.0;
while (iter.hasNext()) {
SparseArray.Entry b = iter.next();
int i = b.i;
if (y[i] > 0) {
intersection = true;
kl += b.x * Math.log(b.x / y[i]);
}
}
if (intersection) {
return kl;
} else {
return Double.POSITIVE_INFINITY;
}
} | [
"public",
"static",
"double",
"KullbackLeiblerDivergence",
"(",
"SparseArray",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"x",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"List x is empty.\"",
")",
";",... | Kullback-Leibler divergence. The Kullback-Leibler divergence (also
information divergence, information gain, relative entropy, or KLIC)
is a non-symmetric measure of the difference between two probability
distributions P and Q. KL measures the expected number of extra bits
required to code samples from P when using a code based on Q, rather
than using a code based on P. Typically P represents the "true"
distribution of data, observations, or a precise calculated theoretical
distribution. The measure Q typically represents a theory, model,
description, or approximation of P.
<p>
Although it is often intuited as a distance metric, the KL divergence is
not a true metric - for example, the KL from P to Q is not necessarily
the same as the KL from Q to P. | [
"Kullback",
"-",
"Leibler",
"divergence",
".",
"The",
"Kullback",
"-",
"Leibler",
"divergence",
"(",
"also",
"information",
"divergence",
"information",
"gain",
"relative",
"entropy",
"or",
"KLIC",
")",
"is",
"a",
"non",
"-",
"symmetric",
"measure",
"of",
"the... | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L2361-L2384 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRulePersistenceImpl.java | CPRulePersistenceImpl.findByGroupId | @Override
public List<CPRule> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPRule> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPRule",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the cp rules where groupId = ?.
@param groupId the group ID
@return the matching cp rules | [
"Returns",
"all",
"the",
"cp",
"rules",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRulePersistenceImpl.java#L122-L125 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java | HtmlWriter.getResource | public Content getResource(String key, Object o0, Object o1) {
return configuration.getResource(key, o0, o1);
} | java | public Content getResource(String key, Object o0, Object o1) {
return configuration.getResource(key, o0, o1);
} | [
"public",
"Content",
"getResource",
"(",
"String",
"key",
",",
"Object",
"o0",
",",
"Object",
"o1",
")",
"{",
"return",
"configuration",
".",
"getResource",
"(",
"key",
",",
"o0",
",",
"o1",
")",
";",
"}"
] | Get the configuration string as a content.
@param key the key to look for in the configuration file
@param o1 string or content argument added to configuration text
@param o2 string or content argument added to configuration text
@return a content tree for the text | [
"Get",
"the",
"configuration",
"string",
"as",
"a",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java#L277-L279 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.orthoLH | public Matrix4f orthoLH(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne, Matrix4f dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.setOrthoLH(left, right, bottom, top, zNear, zFar, zZeroToOne);
return orthoLHGeneric(left, right, bottom, top, zNear, zFar, zZeroToOne, dest);
} | java | public Matrix4f orthoLH(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne, Matrix4f dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.setOrthoLH(left, right, bottom, top, zNear, zFar, zZeroToOne);
return orthoLHGeneric(left, right, bottom, top, zNear, zFar, zZeroToOne, dest);
} | [
"public",
"Matrix4f",
"orthoLH",
"(",
"float",
"left",
",",
"float",
"right",
",",
"float",
"bottom",
",",
"float",
"top",
",",
"float",
"zNear",
",",
"float",
"zFar",
",",
"boolean",
"zZeroToOne",
",",
"Matrix4f",
"dest",
")",
"{",
"if",
"(",
"(",
"pr... | Apply an orthographic projection transformation for a left-handed coordiante system
using the given NDC z range to this matrix and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to an orthographic projection without post-multiplying it,
use {@link #setOrthoLH(float, float, float, float, float, float, boolean) setOrthoLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #setOrthoLH(float, float, float, float, float, float, boolean)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@param dest
will hold the result
@return dest | [
"Apply",
"an",
"orthographic",
"projection",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordiante",
"system",
"using",
"the",
"given",
"NDC",
"z",
"range",
"to",
"this",
"matrix",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7016-L7020 |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/AbstractCommandBuilder.java | AbstractCommandBuilder.normalizePath | protected Path normalizePath(final Path parent, final String path) {
return parent.resolve(path).toAbsolutePath().normalize();
} | java | protected Path normalizePath(final Path parent, final String path) {
return parent.resolve(path).toAbsolutePath().normalize();
} | [
"protected",
"Path",
"normalizePath",
"(",
"final",
"Path",
"parent",
",",
"final",
"String",
"path",
")",
"{",
"return",
"parent",
".",
"resolve",
"(",
"path",
")",
".",
"toAbsolutePath",
"(",
")",
".",
"normalize",
"(",
")",
";",
"}"
] | Resolves the path relative to the parent and normalizes it.
@param parent the parent path
@param path the path
@return the normalized path | [
"Resolves",
"the",
"path",
"relative",
"to",
"the",
"parent",
"and",
"normalizes",
"it",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/AbstractCommandBuilder.java#L564-L566 |
casmi/casmi | src/main/java/casmi/util/FileUtil.java | FileUtil.searchFilePath | public static String searchFilePath(String fileName) {
java.io.File dir = new java.io.File(System.getProperty("user.dir"));
return recursiveSearch(dir, fileName);
} | java | public static String searchFilePath(String fileName) {
java.io.File dir = new java.io.File(System.getProperty("user.dir"));
return recursiveSearch(dir, fileName);
} | [
"public",
"static",
"String",
"searchFilePath",
"(",
"String",
"fileName",
")",
"{",
"java",
".",
"io",
".",
"File",
"dir",
"=",
"new",
"java",
".",
"io",
".",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"user.dir\"",
")",
")",
";",
"return",
"re... | Search an absolute file path from current working directory recursively.
@param fileName file name to search.
@return an absolute file path. | [
"Search",
"an",
"absolute",
"file",
"path",
"from",
"current",
"working",
"directory",
"recursively",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/util/FileUtil.java#L189-L192 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java | SpiderTransaction.addShardStart | public void addShardStart(TableDefinition tableDef, int shardNumber, Date startDate) {
assert tableDef.isSharded() && shardNumber > 0;
addColumn(SpiderService.termsStoreName(tableDef),
SHARDS_ROW_KEY,
Integer.toString(shardNumber),
Utils.toBytes(Long.toString(startDate.getTime())));
} | java | public void addShardStart(TableDefinition tableDef, int shardNumber, Date startDate) {
assert tableDef.isSharded() && shardNumber > 0;
addColumn(SpiderService.termsStoreName(tableDef),
SHARDS_ROW_KEY,
Integer.toString(shardNumber),
Utils.toBytes(Long.toString(startDate.getTime())));
} | [
"public",
"void",
"addShardStart",
"(",
"TableDefinition",
"tableDef",
",",
"int",
"shardNumber",
",",
"Date",
"startDate",
")",
"{",
"assert",
"tableDef",
".",
"isSharded",
"(",
")",
"&&",
"shardNumber",
">",
"0",
";",
"addColumn",
"(",
"SpiderService",
".",
... | Add a column to the "_shards" row for the given shard number and date, indicating
that this shard is being used. The "_shards" row lives in the table's Terms store
and uses the format:
<pre>
_shards = {{shard 1}:{date 1}, {shard 1}:{date 2}, ...}
</pre>
Dates are stored as {@link Date#getTime()} values, converted to strings via
{@link Long#toString()}.
@param tableDef {@link TableDefinition} of a sharded table.
@param shardNumber Number of a new shard (must be > 0).
@param startDate Date that marks the beginning of object timestamp values that
reside in the shard. | [
"Add",
"a",
"column",
"to",
"the",
"_shards",
"row",
"for",
"the",
"given",
"shard",
"number",
"and",
"date",
"indicating",
"that",
"this",
"shard",
"is",
"being",
"used",
".",
"The",
"_shards",
"row",
"lives",
"in",
"the",
"table",
"s",
"Terms",
"store"... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L307-L313 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.updateClob | public void updateClob(String columnName, java.sql.Clob c) throws SQLException {
try {
rsetImpl.updateClob(columnName, c);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateClob", "4123", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void updateClob(String columnName, java.sql.Clob c) throws SQLException {
try {
rsetImpl.updateClob(columnName, c);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateClob", "4123", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"updateClob",
"(",
"String",
"columnName",
",",
"java",
".",
"sql",
".",
"Clob",
"c",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"rsetImpl",
".",
"updateClob",
"(",
"columnName",
",",
"c",
")",
";",
"}",
"catch",
"(",
"SQLException... | <p>Updates the designated column with a java.sql.Clob value. The updater methods
are used to update column values in the current row or the insert row. The updater
methods do not update the underlying database; instead the updateRow or insertRow
methods are called to update the database.
@param columnName the name of the column
@param c the new column value
@exception SQLException If a database access error occurs | [
"<p",
">",
"Updates",
"the",
"designated",
"column",
"with",
"a",
"java",
".",
"sql",
".",
"Clob",
"value",
".",
"The",
"updater",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
"the",
"insert",
"row",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L4686-L4696 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java | EventSubscriptions.invokeCallbacks | public void invokeCallbacks(String eventName, T eventData) {
String name = eventName;
while (!StringUtils.isEmpty(name)) {
Iterable<IGenericEvent<T>> subscribers = getSubscribers(name);
if (subscribers != null) {
for (IGenericEvent<T> subscriber : subscribers) {
try {
if (log.isDebugEnabled()) {
log.debug(String.format("Firing local Event[name=%s,data=%s]", eventName, eventData));
}
subscriber.eventCallback(eventName, eventData);
} catch (Throwable e) {
log.error("Error during local event callback.", e);
}
}
}
name = stripLevel(name);
}
} | java | public void invokeCallbacks(String eventName, T eventData) {
String name = eventName;
while (!StringUtils.isEmpty(name)) {
Iterable<IGenericEvent<T>> subscribers = getSubscribers(name);
if (subscribers != null) {
for (IGenericEvent<T> subscriber : subscribers) {
try {
if (log.isDebugEnabled()) {
log.debug(String.format("Firing local Event[name=%s,data=%s]", eventName, eventData));
}
subscriber.eventCallback(eventName, eventData);
} catch (Throwable e) {
log.error("Error during local event callback.", e);
}
}
}
name = stripLevel(name);
}
} | [
"public",
"void",
"invokeCallbacks",
"(",
"String",
"eventName",
",",
"T",
"eventData",
")",
"{",
"String",
"name",
"=",
"eventName",
";",
"while",
"(",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"name",
")",
")",
"{",
"Iterable",
"<",
"IGenericEvent",
"<",
... | Invokes callbacks on all subscribers of this and parent events.
@param eventName Name of the event.
@param eventData The associated event data. | [
"Invokes",
"callbacks",
"on",
"all",
"subscribers",
"of",
"this",
"and",
"parent",
"events",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventSubscriptions.java#L150-L171 |
palaima/DebugDrawer | debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java | UIUtils.getThemeAttributeDimensionSize | public static int getThemeAttributeDimensionSize(Context context, int attr) {
TypedArray a = null;
try {
a = context.getTheme().obtainStyledAttributes(new int[]{attr});
return a.getDimensionPixelSize(0, 0);
} finally {
if (a != null) {
a.recycle();
}
}
} | java | public static int getThemeAttributeDimensionSize(Context context, int attr) {
TypedArray a = null;
try {
a = context.getTheme().obtainStyledAttributes(new int[]{attr});
return a.getDimensionPixelSize(0, 0);
} finally {
if (a != null) {
a.recycle();
}
}
} | [
"public",
"static",
"int",
"getThemeAttributeDimensionSize",
"(",
"Context",
"context",
",",
"int",
"attr",
")",
"{",
"TypedArray",
"a",
"=",
"null",
";",
"try",
"{",
"a",
"=",
"context",
".",
"getTheme",
"(",
")",
".",
"obtainStyledAttributes",
"(",
"new",
... | Returns the size in pixels of an attribute dimension
@param context the context to get the resources from
@param attr is the attribute dimension we want to know the size from
@return the size in pixels of an attribute dimension | [
"Returns",
"the",
"size",
"in",
"pixels",
"of",
"an",
"attribute",
"dimension"
] | train | https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java#L123-L133 |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java | AtsdPropertyExtractor.getAsInt | public int getAsInt(final String name, final int defaultValue) {
return AtsdUtil.getPropertyIntValue(fullName(name), clientProperties, defaultValue);
} | java | public int getAsInt(final String name, final int defaultValue) {
return AtsdUtil.getPropertyIntValue(fullName(name), clientProperties, defaultValue);
} | [
"public",
"int",
"getAsInt",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"defaultValue",
")",
"{",
"return",
"AtsdUtil",
".",
"getPropertyIntValue",
"(",
"fullName",
"(",
"name",
")",
",",
"clientProperties",
",",
"defaultValue",
")",
";",
"}"
] | Get property by name as int value
@param name name of property without the prefix.
@param defaultValue default value for case when the property is not set.
@return property's value. | [
"Get",
"property",
"by",
"name",
"as",
"int",
"value"
] | train | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/AtsdPropertyExtractor.java#L34-L36 |
micronaut-projects/micronaut-core | http-server-netty/src/main/java/io/micronaut/http/server/netty/websocket/NettyServerWebSocketUpgradeHandler.java | NettyServerWebSocketUpgradeHandler.getWebSocketURL | protected String getWebSocketURL(ChannelHandlerContext ctx, HttpRequest req) {
boolean isSecure = ctx.pipeline().get(SslHandler.class) != null;
return (isSecure ? SCHEME_SECURE_WEBSOCKET : SCHEME_WEBSOCKET) + req.getHeaders().get(HttpHeaderNames.HOST) + req.getUri() ;
} | java | protected String getWebSocketURL(ChannelHandlerContext ctx, HttpRequest req) {
boolean isSecure = ctx.pipeline().get(SslHandler.class) != null;
return (isSecure ? SCHEME_SECURE_WEBSOCKET : SCHEME_WEBSOCKET) + req.getHeaders().get(HttpHeaderNames.HOST) + req.getUri() ;
} | [
"protected",
"String",
"getWebSocketURL",
"(",
"ChannelHandlerContext",
"ctx",
",",
"HttpRequest",
"req",
")",
"{",
"boolean",
"isSecure",
"=",
"ctx",
".",
"pipeline",
"(",
")",
".",
"get",
"(",
"SslHandler",
".",
"class",
")",
"!=",
"null",
";",
"return",
... | Obtains the web socket URL.
@param ctx The context
@param req The request
@return The socket URL | [
"Obtains",
"the",
"web",
"socket",
"URL",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http-server-netty/src/main/java/io/micronaut/http/server/netty/websocket/NettyServerWebSocketUpgradeHandler.java#L266-L269 |
Jasig/uPortal | uPortal-groups/uPortal-groups-filesystem/src/main/java/org/apereo/portal/groups/filesystem/FileSystemGroupStore.java | FileSystemGroupStore.find | @Override
public IEntityGroup find(String key) throws GroupsException {
if (log.isDebugEnabled()) {
log.debug(DEBUG_CLASS_NAME + ".find(): group key: " + key);
}
String path = getFilePathFromKey(key);
File f = new File(path);
GroupHolder groupHolder = cacheGet(key);
if (groupHolder == null || (groupHolder.getLastModified() != f.lastModified())) {
if (log.isDebugEnabled()) {
log.debug(
DEBUG_CLASS_NAME
+ ".find(): retrieving group from file system for "
+ path);
}
if (!f.exists()) {
if (log.isDebugEnabled()) {
log.debug(DEBUG_CLASS_NAME + ".find(): file does not exist: " + path);
}
return null;
}
IEntityGroup group = newInstance(f);
groupHolder = new GroupHolder(group, f.lastModified());
cachePut(key, groupHolder);
}
return groupHolder.getGroup();
} | java | @Override
public IEntityGroup find(String key) throws GroupsException {
if (log.isDebugEnabled()) {
log.debug(DEBUG_CLASS_NAME + ".find(): group key: " + key);
}
String path = getFilePathFromKey(key);
File f = new File(path);
GroupHolder groupHolder = cacheGet(key);
if (groupHolder == null || (groupHolder.getLastModified() != f.lastModified())) {
if (log.isDebugEnabled()) {
log.debug(
DEBUG_CLASS_NAME
+ ".find(): retrieving group from file system for "
+ path);
}
if (!f.exists()) {
if (log.isDebugEnabled()) {
log.debug(DEBUG_CLASS_NAME + ".find(): file does not exist: " + path);
}
return null;
}
IEntityGroup group = newInstance(f);
groupHolder = new GroupHolder(group, f.lastModified());
cachePut(key, groupHolder);
}
return groupHolder.getGroup();
} | [
"@",
"Override",
"public",
"IEntityGroup",
"find",
"(",
"String",
"key",
")",
"throws",
"GroupsException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"DEBUG_CLASS_NAME",
"+",
"\".find(): group key: \"",
"+",
"... | Returns an instance of the <code>IEntityGroup</code> from the data store.
@return org.apereo.portal.groups.IEntityGroup
@param key java.lang.String | [
"Returns",
"an",
"instance",
"of",
"the",
"<code",
">",
"IEntityGroup<",
"/",
"code",
">",
"from",
"the",
"data",
"store",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-filesystem/src/main/java/org/apereo/portal/groups/filesystem/FileSystemGroupStore.java#L240-L271 |
jriecken/gae-java-mini-profiler | src/main/java/ca/jimr/gae/profiler/resources/MiniProfilerResourceLoader.java | MiniProfilerResourceLoader.getResource | public String getResource(String resource, Map<String, String> replacements)
{
String result = cache.get(resource);
if (result == null)
{
try
{
InputStream is = MiniProfilerResourceLoader.class.getResourceAsStream(resource);
try
{
result = new Scanner(is).useDelimiter("\\A").next();
} finally
{
is.close();
}
if (replacements != null)
{
for (Map.Entry<String, String> e : replacements.entrySet())
{
result = result.replace(e.getKey(), e.getValue());
}
}
cache.putIfAbsent(resource, result);
} catch (Exception e)
{
result = null;
}
}
return result;
} | java | public String getResource(String resource, Map<String, String> replacements)
{
String result = cache.get(resource);
if (result == null)
{
try
{
InputStream is = MiniProfilerResourceLoader.class.getResourceAsStream(resource);
try
{
result = new Scanner(is).useDelimiter("\\A").next();
} finally
{
is.close();
}
if (replacements != null)
{
for (Map.Entry<String, String> e : replacements.entrySet())
{
result = result.replace(e.getKey(), e.getValue());
}
}
cache.putIfAbsent(resource, result);
} catch (Exception e)
{
result = null;
}
}
return result;
} | [
"public",
"String",
"getResource",
"(",
"String",
"resource",
",",
"Map",
"<",
"String",
",",
"String",
">",
"replacements",
")",
"{",
"String",
"result",
"=",
"cache",
".",
"get",
"(",
"resource",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",... | Get the specified resource (if it exists) and perform the specified string
replacements on it.
@param resource
The name of the resource to load.
@param replacements
The map of string replacements to do.
@return The text of the resource, or {@code null} if it could not be
loaded. | [
"Get",
"the",
"specified",
"resource",
"(",
"if",
"it",
"exists",
")",
"and",
"perform",
"the",
"specified",
"string",
"replacements",
"on",
"it",
"."
] | train | https://github.com/jriecken/gae-java-mini-profiler/blob/184e3d2470104e066919960d6fbfe0cdc05921d5/src/main/java/ca/jimr/gae/profiler/resources/MiniProfilerResourceLoader.java#L52-L83 |
jmxtrans/jmxtrans | jmxtrans-output/jmxtrans-output-logback/src/main/java/com/googlecode/jmxtrans/model/output/NagiosWriter.java | NagiosWriter.valueCheck | protected boolean valueCheck(double value, String simpleRange) {
if (simpleRange.isEmpty()) {
return false;
}
if (simpleRange.endsWith(":")) {
return value < Double.parseDouble(simpleRange.replace(":", ""));
}
if (simpleRange.startsWith("~:")) {
return value > Double.parseDouble(simpleRange.replace("~:", ""));
}
if (simpleRange.startsWith("@")) {
String[] values = simpleRange.replace("@", "").split(":");
return value >= Double.parseDouble(values[0]) && value <= Double.parseDouble(values[1]);
}
if (simpleRange.matches("^-{0,1}[0-9]+:-{0,1}[0-9]+$")) {
String[] values = simpleRange.split(":");
return value < Double.parseDouble(values[0]) || value > Double.parseDouble(values[1]);
}
return simpleRange.matches("^-{0,1}[0-9]+$") && (0 > value || value > Double.parseDouble(simpleRange));
} | java | protected boolean valueCheck(double value, String simpleRange) {
if (simpleRange.isEmpty()) {
return false;
}
if (simpleRange.endsWith(":")) {
return value < Double.parseDouble(simpleRange.replace(":", ""));
}
if (simpleRange.startsWith("~:")) {
return value > Double.parseDouble(simpleRange.replace("~:", ""));
}
if (simpleRange.startsWith("@")) {
String[] values = simpleRange.replace("@", "").split(":");
return value >= Double.parseDouble(values[0]) && value <= Double.parseDouble(values[1]);
}
if (simpleRange.matches("^-{0,1}[0-9]+:-{0,1}[0-9]+$")) {
String[] values = simpleRange.split(":");
return value < Double.parseDouble(values[0]) || value > Double.parseDouble(values[1]);
}
return simpleRange.matches("^-{0,1}[0-9]+$") && (0 > value || value > Double.parseDouble(simpleRange));
} | [
"protected",
"boolean",
"valueCheck",
"(",
"double",
"value",
",",
"String",
"simpleRange",
")",
"{",
"if",
"(",
"simpleRange",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"simpleRange",
".",
"endsWith",
"(",
"\":\"",
")",... | Check if a value is inside of a range defined in the thresholds.
This check is based on Nagios range definition.
http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT | [
"Check",
"if",
"a",
"value",
"is",
"inside",
"of",
"a",
"range",
"defined",
"in",
"the",
"thresholds",
".",
"This",
"check",
"is",
"based",
"on",
"Nagios",
"range",
"definition",
".",
"http",
":",
"//",
"nagiosplug",
".",
"sourceforge",
".",
"net",
"/",
... | train | https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-output/jmxtrans-output-logback/src/main/java/com/googlecode/jmxtrans/model/output/NagiosWriter.java#L275-L301 |
JodaOrg/joda-time | src/main/java/org/joda/time/convert/ReadablePeriodConverter.java | ReadablePeriodConverter.setInto | public void setInto(ReadWritablePeriod duration, Object object, Chronology chrono) {
duration.setPeriod((ReadablePeriod) object);
} | java | public void setInto(ReadWritablePeriod duration, Object object, Chronology chrono) {
duration.setPeriod((ReadablePeriod) object);
} | [
"public",
"void",
"setInto",
"(",
"ReadWritablePeriod",
"duration",
",",
"Object",
"object",
",",
"Chronology",
"chrono",
")",
"{",
"duration",
".",
"setPeriod",
"(",
"(",
"ReadablePeriod",
")",
"object",
")",
";",
"}"
] | Extracts duration values from an object of this converter's type, and
sets them into the given ReadWritablePeriod.
@param duration duration to get modified
@param object the object to convert, must not be null
@param chrono the chronology to use
@throws NullPointerException if the duration or object is null
@throws ClassCastException if the object is an invalid type
@throws IllegalArgumentException if the object is invalid | [
"Extracts",
"duration",
"values",
"from",
"an",
"object",
"of",
"this",
"converter",
"s",
"type",
"and",
"sets",
"them",
"into",
"the",
"given",
"ReadWritablePeriod",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/convert/ReadablePeriodConverter.java#L57-L59 |
Netflix/Hystrix | hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java | HystrixPropertiesFactory.getThreadPoolProperties | public static HystrixThreadPoolProperties getThreadPoolProperties(HystrixThreadPoolKey key, HystrixThreadPoolProperties.Setter builder) {
HystrixPropertiesStrategy hystrixPropertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy();
String cacheKey = hystrixPropertiesStrategy.getThreadPoolPropertiesCacheKey(key, builder);
if (cacheKey != null) {
HystrixThreadPoolProperties properties = threadPoolProperties.get(cacheKey);
if (properties != null) {
return properties;
} else {
if (builder == null) {
builder = HystrixThreadPoolProperties.Setter();
}
// create new instance
properties = hystrixPropertiesStrategy.getThreadPoolProperties(key, builder);
// cache and return
HystrixThreadPoolProperties existing = threadPoolProperties.putIfAbsent(cacheKey, properties);
if (existing == null) {
return properties;
} else {
return existing;
}
}
} else {
// no cacheKey so we generate it with caching
return hystrixPropertiesStrategy.getThreadPoolProperties(key, builder);
}
} | java | public static HystrixThreadPoolProperties getThreadPoolProperties(HystrixThreadPoolKey key, HystrixThreadPoolProperties.Setter builder) {
HystrixPropertiesStrategy hystrixPropertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy();
String cacheKey = hystrixPropertiesStrategy.getThreadPoolPropertiesCacheKey(key, builder);
if (cacheKey != null) {
HystrixThreadPoolProperties properties = threadPoolProperties.get(cacheKey);
if (properties != null) {
return properties;
} else {
if (builder == null) {
builder = HystrixThreadPoolProperties.Setter();
}
// create new instance
properties = hystrixPropertiesStrategy.getThreadPoolProperties(key, builder);
// cache and return
HystrixThreadPoolProperties existing = threadPoolProperties.putIfAbsent(cacheKey, properties);
if (existing == null) {
return properties;
} else {
return existing;
}
}
} else {
// no cacheKey so we generate it with caching
return hystrixPropertiesStrategy.getThreadPoolProperties(key, builder);
}
} | [
"public",
"static",
"HystrixThreadPoolProperties",
"getThreadPoolProperties",
"(",
"HystrixThreadPoolKey",
"key",
",",
"HystrixThreadPoolProperties",
".",
"Setter",
"builder",
")",
"{",
"HystrixPropertiesStrategy",
"hystrixPropertiesStrategy",
"=",
"HystrixPlugins",
".",
"getIn... | Get an instance of {@link HystrixThreadPoolProperties} with the given factory {@link HystrixPropertiesStrategy} implementation for each {@link HystrixThreadPool} instance.
@param key
Pass-thru to {@link HystrixPropertiesStrategy#getThreadPoolProperties} implementation.
@param builder
Pass-thru to {@link HystrixPropertiesStrategy#getThreadPoolProperties} implementation.
@return {@link HystrixThreadPoolProperties} instance | [
"Get",
"an",
"instance",
"of",
"{",
"@link",
"HystrixThreadPoolProperties",
"}",
"with",
"the",
"given",
"factory",
"{",
"@link",
"HystrixPropertiesStrategy",
"}",
"implementation",
"for",
"each",
"{",
"@link",
"HystrixThreadPool",
"}",
"instance",
"."
] | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java#L100-L125 |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/traverson/Traverson.java | Traverson.startWith | public Traverson startWith(final String uriTemplate, final Map<String, Object> vars) {
return startWith(fromTemplate(uriTemplate).expand(vars));
} | java | public Traverson startWith(final String uriTemplate, final Map<String, Object> vars) {
return startWith(fromTemplate(uriTemplate).expand(vars));
} | [
"public",
"Traverson",
"startWith",
"(",
"final",
"String",
"uriTemplate",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"vars",
")",
"{",
"return",
"startWith",
"(",
"fromTemplate",
"(",
"uriTemplate",
")",
".",
"expand",
"(",
"vars",
")",
")",
... | Start traversal at the application/hal+json resource idenfied by {@code uri}.
@param uriTemplate the {@code URI} of the initial HAL resource.
@param vars uri-template variables used to build links.
@return Traverson initialized with the {@link HalRepresentation} identified by {@code uri}. | [
"Start",
"traversal",
"at",
"the",
"application",
"/",
"hal",
"+",
"json",
"resource",
"idenfied",
"by",
"{",
"@code",
"uri",
"}",
"."
] | train | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/traverson/Traverson.java#L272-L274 |
apache/groovy | subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java | DateUtilExtensions.minus | public static java.sql.Date minus(java.sql.Date self, int days) {
return new java.sql.Date(minus((Date) self, days).getTime());
} | java | public static java.sql.Date minus(java.sql.Date self, int days) {
return new java.sql.Date(minus((Date) self, days).getTime());
} | [
"public",
"static",
"java",
".",
"sql",
".",
"Date",
"minus",
"(",
"java",
".",
"sql",
".",
"Date",
"self",
",",
"int",
"days",
")",
"{",
"return",
"new",
"java",
".",
"sql",
".",
"Date",
"(",
"minus",
"(",
"(",
"Date",
")",
"self",
",",
"days",
... | Subtract a number of days from this date and returns the new date.
@param self a java.sql.Date
@param days the number of days to subtract
@return the new date
@since 1.0 | [
"Subtract",
"a",
"number",
"of",
"days",
"from",
"this",
"date",
"and",
"returns",
"the",
"new",
"date",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L432-L434 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.addTemplate | public void addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f) {
checkWriter();
checkNoPattern(template);
PdfName name = writer.addDirectTemplateSimple(template, null);
PageResources prs = getPageResources();
name = prs.addXObject(name, template.getIndirectReference());
content.append("q ");
content.append(a).append(' ');
content.append(b).append(' ');
content.append(c).append(' ');
content.append(d).append(' ');
content.append(e).append(' ');
content.append(f).append(" cm ");
content.append(name.getBytes()).append(" Do Q").append_i(separator);
} | java | public void addTemplate(PdfTemplate template, float a, float b, float c, float d, float e, float f) {
checkWriter();
checkNoPattern(template);
PdfName name = writer.addDirectTemplateSimple(template, null);
PageResources prs = getPageResources();
name = prs.addXObject(name, template.getIndirectReference());
content.append("q ");
content.append(a).append(' ');
content.append(b).append(' ');
content.append(c).append(' ');
content.append(d).append(' ');
content.append(e).append(' ');
content.append(f).append(" cm ");
content.append(name.getBytes()).append(" Do Q").append_i(separator);
} | [
"public",
"void",
"addTemplate",
"(",
"PdfTemplate",
"template",
",",
"float",
"a",
",",
"float",
"b",
",",
"float",
"c",
",",
"float",
"d",
",",
"float",
"e",
",",
"float",
"f",
")",
"{",
"checkWriter",
"(",
")",
";",
"checkNoPattern",
"(",
"template"... | Adds a template to this content.
@param template the template
@param a an element of the transformation matrix
@param b an element of the transformation matrix
@param c an element of the transformation matrix
@param d an element of the transformation matrix
@param e an element of the transformation matrix
@param f an element of the transformation matrix | [
"Adds",
"a",
"template",
"to",
"this",
"content",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2049-L2063 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/TrainsImpl.java | TrainsImpl.trainVersionAsync | public Observable<EnqueueTrainingResponse> trainVersionAsync(UUID appId, String versionId) {
return trainVersionWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<EnqueueTrainingResponse>, EnqueueTrainingResponse>() {
@Override
public EnqueueTrainingResponse call(ServiceResponse<EnqueueTrainingResponse> response) {
return response.body();
}
});
} | java | public Observable<EnqueueTrainingResponse> trainVersionAsync(UUID appId, String versionId) {
return trainVersionWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<EnqueueTrainingResponse>, EnqueueTrainingResponse>() {
@Override
public EnqueueTrainingResponse call(ServiceResponse<EnqueueTrainingResponse> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EnqueueTrainingResponse",
">",
"trainVersionAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
")",
"{",
"return",
"trainVersionWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
")",
".",
"map",
"(",
"new",
"Func1",
"<... | Sends a training request for a version of a specified LUIS app. This POST request initiates a request asynchronously. To determine whether the training request is successful, submit a GET request to get training status. Note: The application version is not fully trained unless all the models (intents and entities) are trained successfully or are up to date. To verify training success, get the training status at least once after training is complete.
@param appId The application ID.
@param versionId The version ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EnqueueTrainingResponse object | [
"Sends",
"a",
"training",
"request",
"for",
"a",
"version",
"of",
"a",
"specified",
"LUIS",
"app",
".",
"This",
"POST",
"request",
"initiates",
"a",
"request",
"asynchronously",
".",
"To",
"determine",
"whether",
"the",
"training",
"request",
"is",
"successful... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/TrainsImpl.java#L105-L112 |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.setString | @PublicEvolving
public void setString(ConfigOption<String> key, String value) {
setValueInternal(key.key(), value);
} | java | @PublicEvolving
public void setString(ConfigOption<String> key, String value) {
setValueInternal(key.key(), value);
} | [
"@",
"PublicEvolving",
"public",
"void",
"setString",
"(",
"ConfigOption",
"<",
"String",
">",
"key",
",",
"String",
"value",
")",
"{",
"setValueInternal",
"(",
"key",
".",
"key",
"(",
")",
",",
"value",
")",
";",
"}"
] | Adds the given value to the configuration object.
The main key of the config option will be used to map the value.
@param key
the option specifying the key to be added
@param value
the value of the key/value pair to be added | [
"Adds",
"the",
"given",
"value",
"to",
"the",
"configuration",
"object",
".",
"The",
"main",
"key",
"of",
"the",
"config",
"option",
"will",
"be",
"used",
"to",
"map",
"the",
"value",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L190-L193 |
google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/SpanSet.java | SpanSet.hasSpansIntersecting | public boolean hasSpansIntersecting(int start, int end) {
for (int i = 0; i < numberOfSpans; i++) {
// equal test is valid since both intervals are not empty by construction
if (spanStarts[i] >= end || spanEnds[i] <= start) continue;
return true;
}
return false;
} | java | public boolean hasSpansIntersecting(int start, int end) {
for (int i = 0; i < numberOfSpans; i++) {
// equal test is valid since both intervals are not empty by construction
if (spanStarts[i] >= end || spanEnds[i] <= start) continue;
return true;
}
return false;
} | [
"public",
"boolean",
"hasSpansIntersecting",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfSpans",
";",
"i",
"++",
")",
"{",
"// equal test is valid since both intervals are not empty by construction",
... | Returns true if there are spans intersecting the given interval.
@param end must be strictly greater than start | [
"Returns",
"true",
"if",
"there",
"are",
"spans",
"intersecting",
"the",
"given",
"interval",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/SpanSet.java#L80-L87 |
voldemort/voldemort | src/java/voldemort/server/storage/prunejob/VersionedPutPruneJob.java | VersionedPutPruneJob.pruneNonReplicaEntries | public static List<Versioned<byte[]>> pruneNonReplicaEntries(List<Versioned<byte[]>> vals,
List<Integer> keyReplicas,
MutableBoolean didPrune) {
List<Versioned<byte[]>> prunedVals = new ArrayList<Versioned<byte[]>>(vals.size());
for(Versioned<byte[]> val: vals) {
VectorClock clock = (VectorClock) val.getVersion();
List<ClockEntry> clockEntries = new ArrayList<ClockEntry>();
for(ClockEntry clockEntry: clock.getEntries()) {
if(keyReplicas.contains((int) clockEntry.getNodeId())) {
clockEntries.add(clockEntry);
} else {
didPrune.setValue(true);
}
}
prunedVals.add(new Versioned<byte[]>(val.getValue(),
new VectorClock(clockEntries, clock.getTimestamp())));
}
return prunedVals;
} | java | public static List<Versioned<byte[]>> pruneNonReplicaEntries(List<Versioned<byte[]>> vals,
List<Integer> keyReplicas,
MutableBoolean didPrune) {
List<Versioned<byte[]>> prunedVals = new ArrayList<Versioned<byte[]>>(vals.size());
for(Versioned<byte[]> val: vals) {
VectorClock clock = (VectorClock) val.getVersion();
List<ClockEntry> clockEntries = new ArrayList<ClockEntry>();
for(ClockEntry clockEntry: clock.getEntries()) {
if(keyReplicas.contains((int) clockEntry.getNodeId())) {
clockEntries.add(clockEntry);
} else {
didPrune.setValue(true);
}
}
prunedVals.add(new Versioned<byte[]>(val.getValue(),
new VectorClock(clockEntries, clock.getTimestamp())));
}
return prunedVals;
} | [
"public",
"static",
"List",
"<",
"Versioned",
"<",
"byte",
"[",
"]",
">",
">",
"pruneNonReplicaEntries",
"(",
"List",
"<",
"Versioned",
"<",
"byte",
"[",
"]",
">",
">",
"vals",
",",
"List",
"<",
"Integer",
">",
"keyReplicas",
",",
"MutableBoolean",
"didP... | Remove all non replica clock entries from the list of versioned values
provided
@param vals list of versioned values to prune replicas from
@param keyReplicas list of current replicas for the given key
@param didPrune flag to mark if we did actually prune something
@return pruned list | [
"Remove",
"all",
"non",
"replica",
"clock",
"entries",
"from",
"the",
"list",
"of",
"versioned",
"values",
"provided"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/storage/prunejob/VersionedPutPruneJob.java#L181-L199 |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/ClassUtils.java | ClassUtils.getInstance | public static <T> T getInstance(Class<T> clazz, Class<?>[] paramTypes, Object[] params) {
Assert.isTrue(CollectionUtil.safeSizeOf(paramTypes) == CollectionUtil.safeSizeOf(params));
try {
Constructor<T> constructor = clazz.getConstructor(paramTypes);
ReflectUtil.allowAccess(constructor);
return constructor.newInstance(params);
} catch (Exception e) {
throw new ReflectException("获取类实例异常,可能是没有默认无参构造器", e);
}
} | java | public static <T> T getInstance(Class<T> clazz, Class<?>[] paramTypes, Object[] params) {
Assert.isTrue(CollectionUtil.safeSizeOf(paramTypes) == CollectionUtil.safeSizeOf(params));
try {
Constructor<T> constructor = clazz.getConstructor(paramTypes);
ReflectUtil.allowAccess(constructor);
return constructor.newInstance(params);
} catch (Exception e) {
throw new ReflectException("获取类实例异常,可能是没有默认无参构造器", e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getInstance",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"CollectionUtil",
".",
"saf... | 获取class的实例
@param clazz class
@param paramTypes 构造器参数类型
@param params 参数
@param <T> class类型
@return Class实例 | [
"获取class的实例"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/ClassUtils.java#L153-L162 |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java | MetadataProviderImpl.createTypeMetadata | private TypeMetadata createTypeMetadata(AnnotatedType annotatedType) {
Class<?> currentClass = annotatedType.getAnnotatedElement();
Collection<AnnotatedMethod> annotatedMethods = this.annotatedMethods.get(currentClass);
if (annotatedMethods == null) {
throw new XOException("XO unit does not declare '" + currentClass.getName() + "'.");
}
Collection<MethodMetadata<?, ?>> methodMetadataOfType = getMethodMetadataOfType(annotatedType, annotatedMethods);
TypeMetadata metadata;
List<TypeMetadata> superTypes = getSuperTypeMetadata(annotatedType);
if (isEntityType(annotatedType)) {
metadata = createEntityTypeMetadata(annotatedType, superTypes, methodMetadataOfType);
} else if (isRelationType(annotatedType)) {
metadata = createRelationTypeMetadata(annotatedType, superTypes, methodMetadataOfType);
} else if (annotatedType.isAnnotationPresent(Repository.class)) {
metadata = createRepositoryTypeMetadata(annotatedType, superTypes, methodMetadataOfType);
} else {
IndexedPropertyMethodMetadata indexedProperty = getIndexedPropertyMethodMetadata(methodMetadataOfType);
metadata = new SimpleTypeMetadata(annotatedType, superTypes, methodMetadataOfType, indexedProperty);
}
return metadata;
} | java | private TypeMetadata createTypeMetadata(AnnotatedType annotatedType) {
Class<?> currentClass = annotatedType.getAnnotatedElement();
Collection<AnnotatedMethod> annotatedMethods = this.annotatedMethods.get(currentClass);
if (annotatedMethods == null) {
throw new XOException("XO unit does not declare '" + currentClass.getName() + "'.");
}
Collection<MethodMetadata<?, ?>> methodMetadataOfType = getMethodMetadataOfType(annotatedType, annotatedMethods);
TypeMetadata metadata;
List<TypeMetadata> superTypes = getSuperTypeMetadata(annotatedType);
if (isEntityType(annotatedType)) {
metadata = createEntityTypeMetadata(annotatedType, superTypes, methodMetadataOfType);
} else if (isRelationType(annotatedType)) {
metadata = createRelationTypeMetadata(annotatedType, superTypes, methodMetadataOfType);
} else if (annotatedType.isAnnotationPresent(Repository.class)) {
metadata = createRepositoryTypeMetadata(annotatedType, superTypes, methodMetadataOfType);
} else {
IndexedPropertyMethodMetadata indexedProperty = getIndexedPropertyMethodMetadata(methodMetadataOfType);
metadata = new SimpleTypeMetadata(annotatedType, superTypes, methodMetadataOfType, indexedProperty);
}
return metadata;
} | [
"private",
"TypeMetadata",
"createTypeMetadata",
"(",
"AnnotatedType",
"annotatedType",
")",
"{",
"Class",
"<",
"?",
">",
"currentClass",
"=",
"annotatedType",
".",
"getAnnotatedElement",
"(",
")",
";",
"Collection",
"<",
"AnnotatedMethod",
">",
"annotatedMethods",
... | Create the {@link TypeMetadata} for the given {@link AnnotatedType}.
@param annotatedType
The {@link AnnotatedType}.
@return The corresponding metadata. | [
"Create",
"the",
"{",
"@link",
"TypeMetadata",
"}",
"for",
"the",
"given",
"{",
"@link",
"AnnotatedType",
"}",
"."
] | train | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java#L187-L207 |
sarxos/webcam-capture | webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java | Webcam.getImageBytes | public ByteBuffer getImageBytes() {
if (!isReady()) {
return null;
}
assert driver != null;
assert device != null;
long t1 = 0;
long t2 = 0;
// some devices can support direct image buffers, and for those call
// processor task, and for those which does not support direct image
// buffers, just convert image to RGB byte array
if (device instanceof BufferAccess) {
t1 = System.currentTimeMillis();
try {
return new WebcamGetBufferTask(driver, device).getBuffer();
} finally {
t2 = System.currentTimeMillis();
if (device instanceof WebcamDevice.FPSSource) {
fps = ((WebcamDevice.FPSSource) device).getFPS();
} else {
fps = (4 * fps + 1000 / (t2 - t1 + 1)) / 5;
}
}
} else {
throw new IllegalStateException(String.format("Driver %s does not support buffer access", driver.getClass().getName()));
}
} | java | public ByteBuffer getImageBytes() {
if (!isReady()) {
return null;
}
assert driver != null;
assert device != null;
long t1 = 0;
long t2 = 0;
// some devices can support direct image buffers, and for those call
// processor task, and for those which does not support direct image
// buffers, just convert image to RGB byte array
if (device instanceof BufferAccess) {
t1 = System.currentTimeMillis();
try {
return new WebcamGetBufferTask(driver, device).getBuffer();
} finally {
t2 = System.currentTimeMillis();
if (device instanceof WebcamDevice.FPSSource) {
fps = ((WebcamDevice.FPSSource) device).getFPS();
} else {
fps = (4 * fps + 1000 / (t2 - t1 + 1)) / 5;
}
}
} else {
throw new IllegalStateException(String.format("Driver %s does not support buffer access", driver.getClass().getName()));
}
} | [
"public",
"ByteBuffer",
"getImageBytes",
"(",
")",
"{",
"if",
"(",
"!",
"isReady",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"assert",
"driver",
"!=",
"null",
";",
"assert",
"device",
"!=",
"null",
";",
"long",
"t1",
"=",
"0",
";",
"long",
"t... | Get RAW image ByteBuffer. It will always return buffer with 3 x 1 bytes per each pixel, where
RGB components are on (0, 1, 2) and color space is sRGB.<br>
<br>
<b>IMPORTANT!</b><br>
Some drivers can return direct ByteBuffer, so there is no guarantee that underlying bytes
will not be released in next read image operation. Therefore, to avoid potential bugs you
should convert this ByteBuffer to bytes array before you fetch next image.
@return Byte buffer | [
"Get",
"RAW",
"image",
"ByteBuffer",
".",
"It",
"will",
"always",
"return",
"buffer",
"with",
"3",
"x",
"1",
"bytes",
"per",
"each",
"pixel",
"where",
"RGB",
"components",
"are",
"on",
"(",
"0",
"1",
"2",
")",
"and",
"color",
"space",
"is",
"sRGB",
"... | train | https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java#L711-L742 |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/ProviderRest.java | ProviderRest.createProvider | @POST
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response createProvider(@Context HttpHeaders hh,@Context UriInfo uriInfo, String payload)
throws IOException, JAXBException {
logger.debug("StartOf createProvider - REQUEST Insert /providers");
ProviderHelper providerRestService = getProviderHelper();
String location;
try {
location = providerRestService.createProvider(
hh, uriInfo.getAbsolutePath().toString(), payload);
} catch (HelperException e) {
logger.info("createProvider exception", e);
return buildResponse(e);
}
logger.debug("EndOf createProvider");
return buildResponsePOST(
HttpStatus.CREATED,
printMessage(HttpStatus.CREATED,
"The createProvider has been stored successfully in the SLA Repository Database"),
location);
} | java | @POST
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_XML)
public Response createProvider(@Context HttpHeaders hh,@Context UriInfo uriInfo, String payload)
throws IOException, JAXBException {
logger.debug("StartOf createProvider - REQUEST Insert /providers");
ProviderHelper providerRestService = getProviderHelper();
String location;
try {
location = providerRestService.createProvider(
hh, uriInfo.getAbsolutePath().toString(), payload);
} catch (HelperException e) {
logger.info("createProvider exception", e);
return buildResponse(e);
}
logger.debug("EndOf createProvider");
return buildResponsePOST(
HttpStatus.CREATED,
printMessage(HttpStatus.CREATED,
"The createProvider has been stored successfully in the SLA Repository Database"),
location);
} | [
"@",
"POST",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_XML",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_XML",
")",
"public",
"Response",
"createProvider",
"(",
"@",
"Context",
"HttpHeaders",
"hh",
",",
"@",
"Context",
"UriInfo",
"uriI... | Creates a new provider
<pre>
POST /providers
Request:
POST /providers HTTP/1.1
Accept: application/xml
Response:
{@code
<provider>
<uuid>fc993580-03fe-41eb-8a21-a56709f9370f</uuid>
<name>provider-3</name>
</provider>
}
</pre>
Example: <li>curl -H "Content-type: application/xml" -X POST -d
@provider.xml localhost:8080/sla-service/providers/</li>
@return XML information with the different details of the provider | [
"Creates",
"a",
"new",
"provider"
] | train | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/ProviderRest.java#L201-L224 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsXmlGroupContainer.java | CmsXmlGroupContainer.saveGroupContainer | protected void saveGroupContainer(CmsObject cms, Element parent, CmsGroupContainerBean groupContainer)
throws CmsException {
parent.clearContent();
Element groupContainerElem = parent.addElement(XmlNode.GroupContainers.name());
groupContainerElem.addElement(XmlNode.Title.name()).addCDATA(groupContainer.getTitle());
groupContainerElem.addElement(XmlNode.Description.name()).addCDATA(groupContainer.getDescription());
for (String type : groupContainer.getTypes()) {
groupContainerElem.addElement(XmlNode.Type.name()).addCDATA(type);
}
// the elements
for (CmsContainerElementBean element : groupContainer.getElements()) {
CmsResource res = cms.readResource(element.getId(), CmsResourceFilter.IGNORE_EXPIRATION);
if (OpenCms.getResourceManager().getResourceType(res.getTypeId()).getTypeName().equals(
CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME)) {
LOG.warn(Messages.get().container(Messages.LOG_WARN_ELEMENT_GROUP_INSIDE_ELEMENT_GROUP_0));
continue;
}
Element elemElement = groupContainerElem.addElement(XmlNode.Element.name());
// the element
Element uriElem = elemElement.addElement(XmlNode.Uri.name());
fillResource(cms, uriElem, res);
// the properties
Map<String, String> properties = element.getIndividualSettings();
Map<String, CmsXmlContentProperty> propertiesConf = OpenCms.getADEManager().getElementSettings(cms, res);
CmsXmlContentPropertyHelper.saveProperties(cms, elemElement, properties, propertiesConf);
}
} | java | protected void saveGroupContainer(CmsObject cms, Element parent, CmsGroupContainerBean groupContainer)
throws CmsException {
parent.clearContent();
Element groupContainerElem = parent.addElement(XmlNode.GroupContainers.name());
groupContainerElem.addElement(XmlNode.Title.name()).addCDATA(groupContainer.getTitle());
groupContainerElem.addElement(XmlNode.Description.name()).addCDATA(groupContainer.getDescription());
for (String type : groupContainer.getTypes()) {
groupContainerElem.addElement(XmlNode.Type.name()).addCDATA(type);
}
// the elements
for (CmsContainerElementBean element : groupContainer.getElements()) {
CmsResource res = cms.readResource(element.getId(), CmsResourceFilter.IGNORE_EXPIRATION);
if (OpenCms.getResourceManager().getResourceType(res.getTypeId()).getTypeName().equals(
CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME)) {
LOG.warn(Messages.get().container(Messages.LOG_WARN_ELEMENT_GROUP_INSIDE_ELEMENT_GROUP_0));
continue;
}
Element elemElement = groupContainerElem.addElement(XmlNode.Element.name());
// the element
Element uriElem = elemElement.addElement(XmlNode.Uri.name());
fillResource(cms, uriElem, res);
// the properties
Map<String, String> properties = element.getIndividualSettings();
Map<String, CmsXmlContentProperty> propertiesConf = OpenCms.getADEManager().getElementSettings(cms, res);
CmsXmlContentPropertyHelper.saveProperties(cms, elemElement, properties, propertiesConf);
}
} | [
"protected",
"void",
"saveGroupContainer",
"(",
"CmsObject",
"cms",
",",
"Element",
"parent",
",",
"CmsGroupContainerBean",
"groupContainer",
")",
"throws",
"CmsException",
"{",
"parent",
".",
"clearContent",
"(",
")",
";",
"Element",
"groupContainerElem",
"=",
"par... | Adds the given container page to the given element.<p>
@param cms the current CMS object
@param parent the element to add it
@param groupContainer the container page to add
@throws CmsException if something goes wrong | [
"Adds",
"the",
"given",
"container",
"page",
"to",
"the",
"given",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlGroupContainer.java#L410-L443 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/LookupManagerImpl.java | LookupManagerImpl.addNotificationHandler | @Override
public void addNotificationHandler(String serviceName, NotificationHandler handler) throws ServiceException {
if(! isStarted){
ServiceDirectoryError error = new ServiceDirectoryError(ErrorCode.SERVICE_DIRECTORY_MANAGER_FACTORY_CLOSED);
throw new ServiceException(error);
}
if(handler == null || serviceName == null || serviceName.isEmpty()){
throw new IllegalArgumentException();
}
ModelService service = getLookupService().getModelService(serviceName);
if(service == null){
ServiceDirectoryError error = new ServiceDirectoryError(ErrorCode.SERVICE_NOT_EXIST);
throw new ServiceException(error);
}
getLookupService().addNotificationHandler(serviceName, handler);
} | java | @Override
public void addNotificationHandler(String serviceName, NotificationHandler handler) throws ServiceException {
if(! isStarted){
ServiceDirectoryError error = new ServiceDirectoryError(ErrorCode.SERVICE_DIRECTORY_MANAGER_FACTORY_CLOSED);
throw new ServiceException(error);
}
if(handler == null || serviceName == null || serviceName.isEmpty()){
throw new IllegalArgumentException();
}
ModelService service = getLookupService().getModelService(serviceName);
if(service == null){
ServiceDirectoryError error = new ServiceDirectoryError(ErrorCode.SERVICE_NOT_EXIST);
throw new ServiceException(error);
}
getLookupService().addNotificationHandler(serviceName, handler);
} | [
"@",
"Override",
"public",
"void",
"addNotificationHandler",
"(",
"String",
"serviceName",
",",
"NotificationHandler",
"handler",
")",
"throws",
"ServiceException",
"{",
"if",
"(",
"!",
"isStarted",
")",
"{",
"ServiceDirectoryError",
"error",
"=",
"new",
"ServiceDir... | Add a NotificationHandler to the Service.
This method can check the duplicate NotificationHandler for the serviceName, if the NotificationHandler
already exists in the serviceName, do nothing.
Throw IllegalArgumentException if serviceName or handler is null.
@param serviceName
the service name.
@param handler
the NotificationHandler for the service. | [
"Add",
"a",
"NotificationHandler",
"to",
"the",
"Service",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/LookupManagerImpl.java#L419-L437 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/convert/LongConverter.java | LongConverter.toLongWithDefault | public static long toLongWithDefault(Object value, long defaultValue) {
Long result = toNullableLong(value);
return result != null ? (long) result : defaultValue;
} | java | public static long toLongWithDefault(Object value, long defaultValue) {
Long result = toNullableLong(value);
return result != null ? (long) result : defaultValue;
} | [
"public",
"static",
"long",
"toLongWithDefault",
"(",
"Object",
"value",
",",
"long",
"defaultValue",
")",
"{",
"Long",
"result",
"=",
"toNullableLong",
"(",
"value",
")",
";",
"return",
"result",
"!=",
"null",
"?",
"(",
"long",
")",
"result",
":",
"defaul... | Converts value into integer or returns default when conversion is not
possible.
@param value the value to convert.
@param defaultValue the default value.
@return long value or default when conversion is not supported
@see LongConverter#toNullableLong(Object) | [
"Converts",
"value",
"into",
"integer",
"or",
"returns",
"default",
"when",
"conversion",
"is",
"not",
"possible",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/convert/LongConverter.java#L90-L93 |
Impetus/Kundera | src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java | OracleNoSQLClient.createRow | private Row createRow(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders)
{
String schema = entityMetadata.getSchema(); // Irrelevant for this
// datastore
String table = entityMetadata.getTableName();
MetamodelImpl metamodel = (MetamodelImpl) KunderaMetadataManager.getMetamodel(kunderaMetadata,
entityMetadata.getPersistenceUnit());
Table schemaTable = null;
try
{
schemaTable = tableAPI.getTable(table);
if (schemaTable == null)
{
log.error("No table found for " + table);
throw new KunderaException("No table found for " + table);
}
}
catch (FaultException ex)
{
log.error("Error while getting table " + table + ". Caused By: ", ex);
throw new KunderaException("Error while getting table " + table + ". Caused By: ", ex);
}
Row row = schemaTable.createRow();
if (log.isDebugEnabled())
{
log.debug("Persisting data into " + schema + "." + table + " for " + id);
}
EntityType entityType = metamodel.entity(entityMetadata.getEntityClazz());
Set<Attribute> attributes = entityType.getAttributes();
// process entity attributes.
process(entity, metamodel, row, attributes, schemaTable, entityMetadata);
// on relational attributes.
onRelationalAttributes(rlHolders, row, schemaTable);
// add discriminator column(if present)
addDiscriminatorColumn(row, entityType, schemaTable);
return row;
} | java | private Row createRow(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders)
{
String schema = entityMetadata.getSchema(); // Irrelevant for this
// datastore
String table = entityMetadata.getTableName();
MetamodelImpl metamodel = (MetamodelImpl) KunderaMetadataManager.getMetamodel(kunderaMetadata,
entityMetadata.getPersistenceUnit());
Table schemaTable = null;
try
{
schemaTable = tableAPI.getTable(table);
if (schemaTable == null)
{
log.error("No table found for " + table);
throw new KunderaException("No table found for " + table);
}
}
catch (FaultException ex)
{
log.error("Error while getting table " + table + ". Caused By: ", ex);
throw new KunderaException("Error while getting table " + table + ". Caused By: ", ex);
}
Row row = schemaTable.createRow();
if (log.isDebugEnabled())
{
log.debug("Persisting data into " + schema + "." + table + " for " + id);
}
EntityType entityType = metamodel.entity(entityMetadata.getEntityClazz());
Set<Attribute> attributes = entityType.getAttributes();
// process entity attributes.
process(entity, metamodel, row, attributes, schemaTable, entityMetadata);
// on relational attributes.
onRelationalAttributes(rlHolders, row, schemaTable);
// add discriminator column(if present)
addDiscriminatorColumn(row, entityType, schemaTable);
return row;
} | [
"private",
"Row",
"createRow",
"(",
"EntityMetadata",
"entityMetadata",
",",
"Object",
"entity",
",",
"Object",
"id",
",",
"List",
"<",
"RelationHolder",
">",
"rlHolders",
")",
"{",
"String",
"schema",
"=",
"entityMetadata",
".",
"getSchema",
"(",
")",
";",
... | Creates the row.
@param entityMetadata
the entity metadata
@param entity
the entity
@param id
the id
@param rlHolders
the rl holders
@return the row | [
"Creates",
"the",
"row",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java#L1513-L1558 |
Patreon/patreon-java | src/main/java/com/patreon/PatreonAPI.java | PatreonAPI.addFieldsParam | private URIBuilder addFieldsParam(URIBuilder builder, Class<? extends BaseResource> type, Collection<? extends Field> fields) {
List<String> fieldNames = new ArrayList<>();
for (Field f : fields) {
fieldNames.add(f.getPropertyName());
}
String typeStr = BaseResource.getType(type);
builder.addParameter("fields[" + typeStr + "]", String.join(",", fieldNames));
return builder;
} | java | private URIBuilder addFieldsParam(URIBuilder builder, Class<? extends BaseResource> type, Collection<? extends Field> fields) {
List<String> fieldNames = new ArrayList<>();
for (Field f : fields) {
fieldNames.add(f.getPropertyName());
}
String typeStr = BaseResource.getType(type);
builder.addParameter("fields[" + typeStr + "]", String.join(",", fieldNames));
return builder;
} | [
"private",
"URIBuilder",
"addFieldsParam",
"(",
"URIBuilder",
"builder",
",",
"Class",
"<",
"?",
"extends",
"BaseResource",
">",
"type",
",",
"Collection",
"<",
"?",
"extends",
"Field",
">",
"fields",
")",
"{",
"List",
"<",
"String",
">",
"fieldNames",
"=",
... | Add fields[type]=fieldName,fieldName,fieldName as a query parameter to the request represented by builder
@param builder A URIBuilder building a request to the API
@param type A BaseResource annotated with {@link com.github.jasminb.jsonapi.annotations.Type}
@param fields A list of fields to include. Only fields in this list will be retrieved in the query
@return builder | [
"Add",
"fields",
"[",
"type",
"]",
"=",
"fieldName",
"fieldName",
"fieldName",
"as",
"a",
"query",
"parameter",
"to",
"the",
"request",
"represented",
"by",
"builder"
] | train | https://github.com/Patreon/patreon-java/blob/669104b3389f19635ffab75c593db9c022334092/src/main/java/com/patreon/PatreonAPI.java#L211-L220 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/DefaultExceptionResolver.java | DefaultExceptionResolver.createThrowable | private Throwable createThrowable(String typeName, String message) throws IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException {
Class<? extends Throwable> clazz = resolveThrowableClass(typeName);
Constructor<? extends Throwable> defaultCtr = getDefaultConstructor(clazz);
Constructor<? extends Throwable> messageCtr = getMessageConstructor(clazz);
if (message != null && messageCtr != null) {
return messageCtr.newInstance(message);
} else if (message != null && defaultCtr != null) {
logger.warn("Unable to invoke message constructor for {}, fallback to default", clazz.getName());
return defaultCtr.newInstance();
} else if (message == null && defaultCtr != null) {
return defaultCtr.newInstance();
} else if (message == null && messageCtr != null) {
logger.warn("Passing null message to message constructor for {}", clazz.getName());
return messageCtr.newInstance((String) null);
} else {
logger.error("Unable to find message or default constructor for {} have {}", clazz.getName(), clazz.getDeclaredConstructors());
return null;
}
} | java | private Throwable createThrowable(String typeName, String message) throws IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException {
Class<? extends Throwable> clazz = resolveThrowableClass(typeName);
Constructor<? extends Throwable> defaultCtr = getDefaultConstructor(clazz);
Constructor<? extends Throwable> messageCtr = getMessageConstructor(clazz);
if (message != null && messageCtr != null) {
return messageCtr.newInstance(message);
} else if (message != null && defaultCtr != null) {
logger.warn("Unable to invoke message constructor for {}, fallback to default", clazz.getName());
return defaultCtr.newInstance();
} else if (message == null && defaultCtr != null) {
return defaultCtr.newInstance();
} else if (message == null && messageCtr != null) {
logger.warn("Passing null message to message constructor for {}", clazz.getName());
return messageCtr.newInstance((String) null);
} else {
logger.error("Unable to find message or default constructor for {} have {}", clazz.getName(), clazz.getDeclaredConstructors());
return null;
}
} | [
"private",
"Throwable",
"createThrowable",
"(",
"String",
"typeName",
",",
"String",
"message",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"InstantiationException",
",",
"ClassNotFoundException",
"{",
"Class",
"<",
"?",
"extends",
"T... | Attempts to create an {@link Throwable} of the given type with the given message. For this method to create a
{@link Throwable} it must have either a default (no-args) constructor or a constructor that takes a {@code String}
as the message name. null is returned if a {@link Throwable} can't be created.
@param typeName the java type name (class name)
@param message the message
@return the throwable
@throws InvocationTargetException
@throws IllegalAccessException
@throws InstantiationException
@throws IllegalArgumentException | [
"Attempts",
"to",
"create",
"an",
"{",
"@link",
"Throwable",
"}",
"of",
"the",
"given",
"type",
"with",
"the",
"given",
"message",
".",
"For",
"this",
"method",
"to",
"create",
"a",
"{",
"@link",
"Throwable",
"}",
"it",
"must",
"have",
"either",
"a",
"... | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/DefaultExceptionResolver.java#L69-L89 |
KyoriPowered/text | api/src/main/java/net/kyori/text/TranslatableComponent.java | TranslatableComponent.of | public static TranslatableComponent of(final @NonNull String key, final @Nullable TextColor color) {
return builder(key)
.color(color)
.build();
} | java | public static TranslatableComponent of(final @NonNull String key, final @Nullable TextColor color) {
return builder(key)
.color(color)
.build();
} | [
"public",
"static",
"TranslatableComponent",
"of",
"(",
"final",
"@",
"NonNull",
"String",
"key",
",",
"final",
"@",
"Nullable",
"TextColor",
"color",
")",
"{",
"return",
"builder",
"(",
"key",
")",
".",
"color",
"(",
"color",
")",
".",
"build",
"(",
")"... | Creates a translatable component with a translation key.
@param key the translation key
@param color the color
@return the translatable component | [
"Creates",
"a",
"translatable",
"component",
"with",
"a",
"translation",
"key",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TranslatableComponent.java#L93-L97 |
epam/parso | src/main/java/com/epam/parso/impl/CSVDataWriterImpl.java | CSVDataWriterImpl.writeRowsArray | @Override
public void writeRowsArray(List<Column> columns, Object[][] rows) throws IOException {
for (Object[] currentRow : rows) {
if (currentRow != null) {
writeRow(columns, currentRow);
} else {
break;
}
}
} | java | @Override
public void writeRowsArray(List<Column> columns, Object[][] rows) throws IOException {
for (Object[] currentRow : rows) {
if (currentRow != null) {
writeRow(columns, currentRow);
} else {
break;
}
}
} | [
"@",
"Override",
"public",
"void",
"writeRowsArray",
"(",
"List",
"<",
"Column",
">",
"columns",
",",
"Object",
"[",
"]",
"[",
"]",
"rows",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Object",
"[",
"]",
"currentRow",
":",
"rows",
")",
"{",
"if",
... | The method to export a parsed sas7bdat file (stored as an object of the {@link SasFileReaderImpl} class)
using {@link CSVDataWriterImpl#writer}.
@param columns the {@link Column} class variables list that stores columns description from the sas7bdat file.
@param rows the Objects arrays array that stores data from the sas7bdat file.
@throws java.io.IOException appears if the output into writer is impossible. | [
"The",
"method",
"to",
"export",
"a",
"parsed",
"sas7bdat",
"file",
"(",
"stored",
"as",
"an",
"object",
"of",
"the",
"{",
"@link",
"SasFileReaderImpl",
"}",
"class",
")",
"using",
"{",
"@link",
"CSVDataWriterImpl#writer",
"}",
"."
] | train | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/CSVDataWriterImpl.java#L121-L130 |
whizzosoftware/WZWave | src/main/java/com/whizzosoftware/wzwave/commandclass/CommandClass.java | CommandClass.createSendDataFrame | static protected DataFrame createSendDataFrame(String name, byte nodeId, byte[] data, boolean isResponseExpected) {
return new SendData(name, nodeId, data, (byte)(SendData.TRANSMIT_OPTION_ACK | SendData.TRANSMIT_OPTION_AUTO_ROUTE), isResponseExpected);
} | java | static protected DataFrame createSendDataFrame(String name, byte nodeId, byte[] data, boolean isResponseExpected) {
return new SendData(name, nodeId, data, (byte)(SendData.TRANSMIT_OPTION_ACK | SendData.TRANSMIT_OPTION_AUTO_ROUTE), isResponseExpected);
} | [
"static",
"protected",
"DataFrame",
"createSendDataFrame",
"(",
"String",
"name",
",",
"byte",
"nodeId",
",",
"byte",
"[",
"]",
"data",
",",
"boolean",
"isResponseExpected",
")",
"{",
"return",
"new",
"SendData",
"(",
"name",
",",
"nodeId",
",",
"data",
",",... | Convenience method for creating SendData frames
@param name the name for logging purposes
@param nodeId the destination node ID
@param data the data portion of the SendData frame
@param isResponseExpected indicates whether sending this data frame should require a response
@return a DataFrame instance | [
"Convenience",
"method",
"for",
"creating",
"SendData",
"frames"
] | train | https://github.com/whizzosoftware/WZWave/blob/b9dfec6b55515226edf9d772a89933b336397501/src/main/java/com/whizzosoftware/wzwave/commandclass/CommandClass.java#L136-L138 |
logic-ng/LogicNG | src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java | FormulaStringRepresentation.binaryOperator | protected String binaryOperator(final BinaryOperator operator, final String opString) {
final String leftString = operator.type().precedence() < operator.left().type().precedence()
? this.toString(operator.left()) : this.bracket(operator.left());
final String rightString = operator.type().precedence() < operator.right().type().precedence()
? this.toString(operator.right()) : this.bracket(operator.right());
return String.format("%s%s%s", leftString, opString, rightString);
} | java | protected String binaryOperator(final BinaryOperator operator, final String opString) {
final String leftString = operator.type().precedence() < operator.left().type().precedence()
? this.toString(operator.left()) : this.bracket(operator.left());
final String rightString = operator.type().precedence() < operator.right().type().precedence()
? this.toString(operator.right()) : this.bracket(operator.right());
return String.format("%s%s%s", leftString, opString, rightString);
} | [
"protected",
"String",
"binaryOperator",
"(",
"final",
"BinaryOperator",
"operator",
",",
"final",
"String",
"opString",
")",
"{",
"final",
"String",
"leftString",
"=",
"operator",
".",
"type",
"(",
")",
".",
"precedence",
"(",
")",
"<",
"operator",
".",
"le... | Returns the string representation of a binary operator.
@param operator the binary operator
@param opString the operator string
@return the string representation | [
"Returns",
"the",
"string",
"representation",
"of",
"a",
"binary",
"operator",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java#L98-L104 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRAnimationChannel.java | GVRAnimationChannel.animate | public void animate(float animationTime, Matrix4f mat)
{
mRotInterpolator.animate(animationTime, mRotKey);
mPosInterpolator.animate(animationTime, mPosKey);
mSclInterpolator.animate(animationTime, mScaleKey);
mat.translationRotateScale(mPosKey[0], mPosKey[1], mPosKey[2], mRotKey[0], mRotKey[1], mRotKey[2], mRotKey[3], mScaleKey[0], mScaleKey[1], mScaleKey[2]);
} | java | public void animate(float animationTime, Matrix4f mat)
{
mRotInterpolator.animate(animationTime, mRotKey);
mPosInterpolator.animate(animationTime, mPosKey);
mSclInterpolator.animate(animationTime, mScaleKey);
mat.translationRotateScale(mPosKey[0], mPosKey[1], mPosKey[2], mRotKey[0], mRotKey[1], mRotKey[2], mRotKey[3], mScaleKey[0], mScaleKey[1], mScaleKey[2]);
} | [
"public",
"void",
"animate",
"(",
"float",
"animationTime",
",",
"Matrix4f",
"mat",
")",
"{",
"mRotInterpolator",
".",
"animate",
"(",
"animationTime",
",",
"mRotKey",
")",
";",
"mPosInterpolator",
".",
"animate",
"(",
"animationTime",
",",
"mPosKey",
")",
";"... | Obtains the transform for a specific time in animation.
@param animationTime The time in animation.
@return The transform. | [
"Obtains",
"the",
"transform",
"for",
"a",
"specific",
"time",
"in",
"animation",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRAnimationChannel.java#L291-L298 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamFilenameHelper.java | DatastreamFilenameHelper.getFilenameFromLabel | private final String getFilenameFromLabel(Context context, String pid, String dsid, Date asOfDateTime, String MIMETYPE) throws Exception {
// can't get datastream label directly from datastream as this is an API-M call
// instead get list of datastream defs, as these contain labels
DOReader reader = m_doManager.getReader(false, context, pid);
Datastream ds = reader.GetDatastream(dsid, asOfDateTime);
return (ds == null) ? "" : ds.DSLabel;
} | java | private final String getFilenameFromLabel(Context context, String pid, String dsid, Date asOfDateTime, String MIMETYPE) throws Exception {
// can't get datastream label directly from datastream as this is an API-M call
// instead get list of datastream defs, as these contain labels
DOReader reader = m_doManager.getReader(false, context, pid);
Datastream ds = reader.GetDatastream(dsid, asOfDateTime);
return (ds == null) ? "" : ds.DSLabel;
} | [
"private",
"final",
"String",
"getFilenameFromLabel",
"(",
"Context",
"context",
",",
"String",
"pid",
",",
"String",
"dsid",
",",
"Date",
"asOfDateTime",
",",
"String",
"MIMETYPE",
")",
"throws",
"Exception",
"{",
"// can't get datastream label directly from datastream... | Get filename based on datastream label
@param context
@param pid
@param dsid
@param asOfDateTime
@param MIMETYPE
@return
@throws Exception | [
"Get",
"filename",
"based",
"on",
"datastream",
"label"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamFilenameHelper.java#L344-L352 |
buschmais/jqa-core-framework | rule/src/main/java/com/buschmais/jqassistant/core/rule/api/executor/RuleSetExecutor.java | RuleSetExecutor.executeGroup | private void executeGroup(RuleSet ruleSet, Group group, Severity parentSeverity) throws RuleException {
if (!executedGroups.contains(group)) {
ruleVisitor.beforeGroup(group, getEffectiveSeverity(group, parentSeverity, parentSeverity));
for (Map.Entry<String, Severity> conceptEntry : group.getConcepts().entrySet()) {
applyConcepts(ruleSet, conceptEntry.getKey(), parentSeverity, conceptEntry.getValue());
}
for (Map.Entry<String, Severity> groupEntry : group.getGroups().entrySet()) {
executeGroups(ruleSet, groupEntry.getKey(), parentSeverity, groupEntry.getValue());
}
Map<String, Severity> constraints = group.getConstraints();
for (Map.Entry<String, Severity> constraintEntry : constraints.entrySet()) {
validateConstraints(ruleSet, constraintEntry.getKey(), parentSeverity, constraintEntry.getValue());
}
ruleVisitor.afterGroup(group);
executedGroups.add(group);
}
} | java | private void executeGroup(RuleSet ruleSet, Group group, Severity parentSeverity) throws RuleException {
if (!executedGroups.contains(group)) {
ruleVisitor.beforeGroup(group, getEffectiveSeverity(group, parentSeverity, parentSeverity));
for (Map.Entry<String, Severity> conceptEntry : group.getConcepts().entrySet()) {
applyConcepts(ruleSet, conceptEntry.getKey(), parentSeverity, conceptEntry.getValue());
}
for (Map.Entry<String, Severity> groupEntry : group.getGroups().entrySet()) {
executeGroups(ruleSet, groupEntry.getKey(), parentSeverity, groupEntry.getValue());
}
Map<String, Severity> constraints = group.getConstraints();
for (Map.Entry<String, Severity> constraintEntry : constraints.entrySet()) {
validateConstraints(ruleSet, constraintEntry.getKey(), parentSeverity, constraintEntry.getValue());
}
ruleVisitor.afterGroup(group);
executedGroups.add(group);
}
} | [
"private",
"void",
"executeGroup",
"(",
"RuleSet",
"ruleSet",
",",
"Group",
"group",
",",
"Severity",
"parentSeverity",
")",
"throws",
"RuleException",
"{",
"if",
"(",
"!",
"executedGroups",
".",
"contains",
"(",
"group",
")",
")",
"{",
"ruleVisitor",
".",
"... | Executes the given group.
@param ruleSet
The rule set.
@param group
The group.
@param parentSeverity
The severity. | [
"Executes",
"the",
"given",
"group",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/api/executor/RuleSetExecutor.java#L70-L86 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/geom/Polygon.java | Polygon.addPoint | public void addPoint(double x, double y)
{
if (npoints >= xpoints.length)
{
final int newLength = npoints * 2;
xpoints = Arrays.copyOf(xpoints, newLength);
ypoints = Arrays.copyOf(ypoints, newLength);
}
xpoints[npoints] = x;
ypoints[npoints] = y;
npoints++;
updateBounds();
} | java | public void addPoint(double x, double y)
{
if (npoints >= xpoints.length)
{
final int newLength = npoints * 2;
xpoints = Arrays.copyOf(xpoints, newLength);
ypoints = Arrays.copyOf(ypoints, newLength);
}
xpoints[npoints] = x;
ypoints[npoints] = y;
npoints++;
updateBounds();
} | [
"public",
"void",
"addPoint",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"if",
"(",
"npoints",
">=",
"xpoints",
".",
"length",
")",
"{",
"final",
"int",
"newLength",
"=",
"npoints",
"*",
"2",
";",
"xpoints",
"=",
"Arrays",
".",
"copyOf",
"(",
... | Add a point to the polygon.
@param x The horizontal location.
@param y The vertical location. | [
"Add",
"a",
"point",
"to",
"the",
"polygon",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/geom/Polygon.java#L57-L69 |
lucee/Lucee | core/src/main/java/lucee/transformer/cfml/tag/CFMLTransformer.java | CFMLTransformer.comment | private static void comment(SourceCode cfml, boolean removeSpace) throws TemplateException {
if (!removeSpace) {
comment(cfml);
}
else {
cfml.removeSpace();
if (comment(cfml)) cfml.removeSpace();
}
} | java | private static void comment(SourceCode cfml, boolean removeSpace) throws TemplateException {
if (!removeSpace) {
comment(cfml);
}
else {
cfml.removeSpace();
if (comment(cfml)) cfml.removeSpace();
}
} | [
"private",
"static",
"void",
"comment",
"(",
"SourceCode",
"cfml",
",",
"boolean",
"removeSpace",
")",
"throws",
"TemplateException",
"{",
"if",
"(",
"!",
"removeSpace",
")",
"{",
"comment",
"(",
"cfml",
")",
";",
"}",
"else",
"{",
"cfml",
".",
"removeSpac... | Liest einen Kommentar ein, Kommentare werden nicht in die CFXD uebertragen sondern verworfen.
Komentare koennen auch Kommentare enthalten. <br />
EBNF:<br />
<code>"<!---" {?-"--->"} "--->";</code>
@throws TemplateException | [
"Liest",
"einen",
"Kommentar",
"ein",
"Kommentare",
"werden",
"nicht",
"in",
"die",
"CFXD",
"uebertragen",
"sondern",
"verworfen",
".",
"Komentare",
"koennen",
"auch",
"Kommentare",
"enthalten",
".",
"<br",
"/",
">",
"EBNF",
":",
"<br",
"/",
">",
"<code",
">... | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/tag/CFMLTransformer.java#L396-L405 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.encryptBase64 | public String encryptBase64(String data, KeyType keyType) {
return Base64.encode(encrypt(data, keyType));
} | java | public String encryptBase64(String data, KeyType keyType) {
return Base64.encode(encrypt(data, keyType));
} | [
"public",
"String",
"encryptBase64",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"Base64",
".",
"encode",
"(",
"encrypt",
"(",
"data",
",",
"keyType",
")",
")",
";",
"}"
] | 编码为Base64字符串,使用UTF-8编码
@param data 被加密的字符串
@param keyType 私钥或公钥 {@link KeyType}
@return Base64字符串
@since 4.0.1 | [
"编码为Base64字符串,使用UTF",
"-",
"8编码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L137-L139 |
tiesebarrell/process-assertions | process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java | ProcessAssert.assertProcessEndedAndInEndEvents | public static void assertProcessEndedAndInEndEvents(final String processInstanceId, final String... endEventIds) {
Validate.notNull(processInstanceId);
Validate.notNull(endEventIds);
apiCallback.debug(LogMessage.PROCESS_11, processInstanceId, AssertUtils.arrayToString(endEventIds));
try {
getEndEventAssertable().processEndedAndInEndEvents(processInstanceId, endEventIds);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_PROCESS_4, processInstanceId, AssertUtils.arrayToString(endEventIds));
}
} | java | public static void assertProcessEndedAndInEndEvents(final String processInstanceId, final String... endEventIds) {
Validate.notNull(processInstanceId);
Validate.notNull(endEventIds);
apiCallback.debug(LogMessage.PROCESS_11, processInstanceId, AssertUtils.arrayToString(endEventIds));
try {
getEndEventAssertable().processEndedAndInEndEvents(processInstanceId, endEventIds);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_PROCESS_4, processInstanceId, AssertUtils.arrayToString(endEventIds));
}
} | [
"public",
"static",
"void",
"assertProcessEndedAndInEndEvents",
"(",
"final",
"String",
"processInstanceId",
",",
"final",
"String",
"...",
"endEventIds",
")",
"{",
"Validate",
".",
"notNull",
"(",
"processInstanceId",
")",
";",
"Validate",
".",
"notNull",
"(",
"e... | Asserts the process instance with the provided id is ended and has reached <strong>all</strong> end events with
the provided ids.
<p>
<strong>Note:</strong> this assertion assumes the process has one or more end events and that all of them have
been reached (in other words, the exact set of provided end event ids is checked against). The order of the end
events is not taken into consideration.
@param processInstanceId
the process instance's id to check for. May not be <code>null</code>
@param endEventIds
the end events' ids to check for. May not be <code>null</code> | [
"Asserts",
"the",
"process",
"instance",
"with",
"the",
"provided",
"id",
"is",
"ended",
"and",
"has",
"reached",
"<strong",
">",
"all<",
"/",
"strong",
">",
"end",
"events",
"with",
"the",
"provided",
"ids",
"."
] | train | https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java#L210-L220 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.arrayInsertAll | public <T> AsyncMutateInBuilder arrayInsertAll(String path, Collection<T> values) {
if (StringUtil.isNullOrEmpty(path)) {
throw new IllegalArgumentException("Path must not be empty for arrayInsert");
}
this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_INSERT, path, new MultiValue<T>(values)));
return this;
} | java | public <T> AsyncMutateInBuilder arrayInsertAll(String path, Collection<T> values) {
if (StringUtil.isNullOrEmpty(path)) {
throw new IllegalArgumentException("Path must not be empty for arrayInsert");
}
this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_INSERT, path, new MultiValue<T>(values)));
return this;
} | [
"public",
"<",
"T",
">",
"AsyncMutateInBuilder",
"arrayInsertAll",
"(",
"String",
"path",
",",
"Collection",
"<",
"T",
">",
"values",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isNullOrEmpty",
"(",
"path",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExcepti... | Insert multiple values at once in an existing array at a specified position (denoted in the
path, eg. "sub.array[2]"), inserting all values in the collection's iteration order at the given
position and shifting existing values beyond the position by the number of elements in the collection.
Each item in the collection is inserted as an individual element of the array, but a bit of overhead
is saved compared to individual {@link #arrayInsert(String, Object)} by grouping mutations in a single packet.
For example given an array [ A, B, C ], inserting the values X and Y at position 1 yields [ A, B, X, Y, C ]
and not [ A, B, [ X, Y ], C ].
@param path the path of the array.
@param values the values to insert at the specified position of the array, each value becoming an entry at or
after the insert position.
@param <T> the type of data in the collection (must be JSON serializable). | [
"Insert",
"multiple",
"values",
"at",
"once",
"in",
"an",
"existing",
"array",
"at",
"a",
"specified",
"position",
"(",
"denoted",
"in",
"the",
"path",
"eg",
".",
"sub",
".",
"array",
"[",
"2",
"]",
")",
"inserting",
"all",
"values",
"in",
"the",
"coll... | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L1115-L1121 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java | AsyncLoggerSet.setCommittedTxId | public void setCommittedTxId(long txid, boolean force) {
for (AsyncLogger logger : loggers) {
logger.setCommittedTxId(txid, force);
}
} | java | public void setCommittedTxId(long txid, boolean force) {
for (AsyncLogger logger : loggers) {
logger.setCommittedTxId(txid, force);
}
} | [
"public",
"void",
"setCommittedTxId",
"(",
"long",
"txid",
",",
"boolean",
"force",
")",
"{",
"for",
"(",
"AsyncLogger",
"logger",
":",
"loggers",
")",
"{",
"logger",
".",
"setCommittedTxId",
"(",
"txid",
",",
"force",
")",
";",
"}",
"}"
] | Set the highest successfully committed txid seen by the writer.
This should be called after a successful write to a quorum, and is used
for extra sanity checks against the protocol. See HDFS-3863. | [
"Set",
"the",
"highest",
"successfully",
"committed",
"txid",
"seen",
"by",
"the",
"writer",
".",
"This",
"should",
"be",
"called",
"after",
"a",
"successful",
"write",
"to",
"a",
"quorum",
"and",
"is",
"used",
"for",
"extra",
"sanity",
"checks",
"against",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java#L81-L85 |
strator-dev/greenpepper | greenpepper/greenpepper-server/src/main/java/com/greenpepper/server/GreenPepperServerServiceImpl.java | GreenPepperServerServiceImpl.getAllSpecificationRepositories | public List<Repository> getAllSpecificationRepositories() throws GreenPepperServerException {
try {
sessionService.startSession();
List<Repository> repositories = repositoryDao.getAllRepositories(ContentType.TEST);
log.debug("Retrieved All Specification Repositories number: " + repositories.size());
return repositories;
} catch (Exception ex) {
throw handleException(RETRIEVE_SUTS, ex);
} finally {
sessionService.closeSession();
}
} | java | public List<Repository> getAllSpecificationRepositories() throws GreenPepperServerException {
try {
sessionService.startSession();
List<Repository> repositories = repositoryDao.getAllRepositories(ContentType.TEST);
log.debug("Retrieved All Specification Repositories number: " + repositories.size());
return repositories;
} catch (Exception ex) {
throw handleException(RETRIEVE_SUTS, ex);
} finally {
sessionService.closeSession();
}
} | [
"public",
"List",
"<",
"Repository",
">",
"getAllSpecificationRepositories",
"(",
")",
"throws",
"GreenPepperServerException",
"{",
"try",
"{",
"sessionService",
".",
"startSession",
"(",
")",
";",
"List",
"<",
"Repository",
">",
"repositories",
"=",
"repositoryDao"... | <p>getAllSpecificationRepositories.</p>
@inheritDoc NO NEEDS TO SECURE THIS
@return a {@link java.util.List} object.
@throws com.greenpepper.server.GreenPepperServerException if any. | [
"<p",
">",
"getAllSpecificationRepositories",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-server/src/main/java/com/greenpepper/server/GreenPepperServerServiceImpl.java#L454-L467 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/RaftSessionManager.java | RaftSessionManager.resetConnections | public void resetConnections(MemberId leader, Collection<MemberId> servers) {
selectorManager.resetAll(leader, servers);
} | java | public void resetConnections(MemberId leader, Collection<MemberId> servers) {
selectorManager.resetAll(leader, servers);
} | [
"public",
"void",
"resetConnections",
"(",
"MemberId",
"leader",
",",
"Collection",
"<",
"MemberId",
">",
"servers",
")",
"{",
"selectorManager",
".",
"resetAll",
"(",
"leader",
",",
"servers",
")",
";",
"}"
] | Resets the session manager's cluster information.
@param leader The leader address.
@param servers The collection of servers. | [
"Resets",
"the",
"session",
"manager",
"s",
"cluster",
"information",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/RaftSessionManager.java#L131-L133 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzleResultSet.java | DrizzleResultSet.updateNClob | public void updateNClob(final String columnLabel, final java.sql.NClob nClob) throws SQLException {
throw SQLExceptionMapper.getFeatureNotSupportedException("Updates are not supported");
} | java | public void updateNClob(final String columnLabel, final java.sql.NClob nClob) throws SQLException {
throw SQLExceptionMapper.getFeatureNotSupportedException("Updates are not supported");
} | [
"public",
"void",
"updateNClob",
"(",
"final",
"String",
"columnLabel",
",",
"final",
"java",
".",
"sql",
".",
"NClob",
"nClob",
")",
"throws",
"SQLException",
"{",
"throw",
"SQLExceptionMapper",
".",
"getFeatureNotSupportedException",
"(",
"\"Updates are not supporte... | Updates the designated column with a <code>java.sql.NClob</code> value. The updater methods are used to update
column values in the current row or the insert row. The updater methods do not update the underlying database;
instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database.
@param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not
specified, then the label is the name of the column
@param nClob the value for the column to be updated
@throws java.sql.SQLException if the columnLabel is not valid; if the driver does not support national character
sets; if the driver can detect that a data conversion error could occur; this
method is called on a closed result set; if a database access error occurs or the
result set concurrency is <code>CONCUR_READ_ONLY</code>
@throws java.sql.SQLFeatureNotSupportedException
if the JDBC driver does not support this method
@since 1.6 | [
"Updates",
"the",
"designated",
"column",
"with",
"a",
"<code",
">",
"java",
".",
"sql",
".",
"NClob<",
"/",
"code",
">",
"value",
".",
"The",
"updater",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleResultSet.java#L2563-L2565 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java | StructureTools.getAllAtomArray | public static final Atom[] getAllAtomArray(Structure s, int model) {
List<Atom> atoms = new ArrayList<Atom>();
AtomIterator iter = new AtomIterator(s,model);
while (iter.hasNext()) {
Atom a = iter.next();
atoms.add(a);
}
return atoms.toArray(new Atom[atoms.size()]);
} | java | public static final Atom[] getAllAtomArray(Structure s, int model) {
List<Atom> atoms = new ArrayList<Atom>();
AtomIterator iter = new AtomIterator(s,model);
while (iter.hasNext()) {
Atom a = iter.next();
atoms.add(a);
}
return atoms.toArray(new Atom[atoms.size()]);
} | [
"public",
"static",
"final",
"Atom",
"[",
"]",
"getAllAtomArray",
"(",
"Structure",
"s",
",",
"int",
"model",
")",
"{",
"List",
"<",
"Atom",
">",
"atoms",
"=",
"new",
"ArrayList",
"<",
"Atom",
">",
"(",
")",
";",
"AtomIterator",
"iter",
"=",
"new",
"... | Convert all atoms of the structure (specified model) into an Atom array
@param s
input structure
@return all atom array | [
"Convert",
"all",
"atoms",
"of",
"the",
"structure",
"(",
"specified",
"model",
")",
"into",
"an",
"Atom",
"array"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java#L377-L387 |
zmarko/sss | src/main/java/rs/in/zivanovic/sss/SasUtils.java | SasUtils.encodeToBinary | public static byte[] encodeToBinary(SecretShare share) {
if (share.getN() < 0 || share.getN() > 255) {
throw new IllegalArgumentException("Invalid share number, must be between 0 and 255");
}
byte[] shareData = share.getShare().toByteArray();
byte[] primeData = share.getPrime().toByteArray();
byte n = new Integer(share.getN()).byteValue();
int len = 9 + SIGNATURE.length + shareData.length + primeData.length;
ByteBuffer bb = ByteBuffer.allocate(len);
bb.put(SIGNATURE);
bb.put(n);
bb.putInt(shareData.length);
bb.put(shareData);
bb.putInt(primeData.length);
bb.put(primeData);
assert bb.position() == bb.capacity();
assert bb.hasArray();
return bb.array();
} | java | public static byte[] encodeToBinary(SecretShare share) {
if (share.getN() < 0 || share.getN() > 255) {
throw new IllegalArgumentException("Invalid share number, must be between 0 and 255");
}
byte[] shareData = share.getShare().toByteArray();
byte[] primeData = share.getPrime().toByteArray();
byte n = new Integer(share.getN()).byteValue();
int len = 9 + SIGNATURE.length + shareData.length + primeData.length;
ByteBuffer bb = ByteBuffer.allocate(len);
bb.put(SIGNATURE);
bb.put(n);
bb.putInt(shareData.length);
bb.put(shareData);
bb.putInt(primeData.length);
bb.put(primeData);
assert bb.position() == bb.capacity();
assert bb.hasArray();
return bb.array();
} | [
"public",
"static",
"byte",
"[",
"]",
"encodeToBinary",
"(",
"SecretShare",
"share",
")",
"{",
"if",
"(",
"share",
".",
"getN",
"(",
")",
"<",
"0",
"||",
"share",
".",
"getN",
"(",
")",
">",
"255",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Serialize secret share to binary message format. The message consists of the following fields:
<ul>
<li>header (ASCII string "SS")</li>
<li>single byte indicating the ordinal number of this specific share in the series</li>
<li>single integer (four bytes) indicating the length of the share data</li>
<li>variable number of bytes (see previous item) representing share data</li>
<li>single integer (four bytes) indicating the length of the prime data</li>
<li>variable number of bytes (see previous item) representing prime data</li>
</ul>
@param share secret share to serialize
@return byte array representing serialized secret share | [
"Serialize",
"secret",
"share",
"to",
"binary",
"message",
"format",
".",
"The",
"message",
"consists",
"of",
"the",
"following",
"fields",
":",
"<ul",
">",
"<li",
">",
"header",
"(",
"ASCII",
"string",
"SS",
")",
"<",
"/",
"li",
">",
"<li",
">",
"sing... | train | https://github.com/zmarko/sss/blob/a41d9d39ca9a4ca1a2719c441c88e209ffc511f5/src/main/java/rs/in/zivanovic/sss/SasUtils.java#L150-L173 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.