repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/DataFrames.java | DataFrames.std | public static Column std(DataRowsFacade dataFrame, String columnName) {
return functions.sqrt(var(dataFrame, columnName));
} | java | public static Column std(DataRowsFacade dataFrame, String columnName) {
return functions.sqrt(var(dataFrame, columnName));
} | [
"public",
"static",
"Column",
"std",
"(",
"DataRowsFacade",
"dataFrame",
",",
"String",
"columnName",
")",
"{",
"return",
"functions",
".",
"sqrt",
"(",
"var",
"(",
"dataFrame",
",",
"columnName",
")",
")",
";",
"}"
] | Standard deviation for a column
@param dataFrame the dataframe to
get the column from
@param columnName the name of the column to get the standard
deviation for
@return the column that represents the standard deviation | [
"Standard",
"deviation",
"for",
"a",
"column"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/DataFrames.java#L74-L76 |
rainerhahnekamp/sneakythrow | src/main/java/com/rainerhahnekamp/sneakythrow/Sneaky.java | Sneaky.sneak | public static <T, E extends Exception> T sneak(SneakySupplier<T, E> supplier) {
return sneaked(supplier).get();
} | java | public static <T, E extends Exception> T sneak(SneakySupplier<T, E> supplier) {
return sneaked(supplier).get();
} | [
"public",
"static",
"<",
"T",
",",
"E",
"extends",
"Exception",
">",
"T",
"sneak",
"(",
"SneakySupplier",
"<",
"T",
",",
"E",
">",
"supplier",
")",
"{",
"return",
"sneaked",
"(",
"supplier",
")",
".",
"get",
"(",
")",
";",
"}"
] | returns a value from a lambda (Supplier) that can potentially throw an exception.
@param supplier Supplier that can throw an exception
@param <T> type of supplier's return value
@return a Supplier as defined in java.util.function | [
"returns",
"a",
"value",
"from",
"a",
"lambda",
"(",
"Supplier",
")",
"that",
"can",
"potentially",
"throw",
"an",
"exception",
"."
] | train | https://github.com/rainerhahnekamp/sneakythrow/blob/789eb3c8df4287742f88548f1569654ff2b38390/src/main/java/com/rainerhahnekamp/sneakythrow/Sneaky.java#L83-L85 |
OpenLiberty/open-liberty | dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java | LifecycleCallbackHelper.doPostConstruct | public void doPostConstruct(Object instance, List<LifecycleCallback> postConstructs) throws InjectionException {
doPostConstruct(instance.getClass(), postConstructs, instance);
} | java | public void doPostConstruct(Object instance, List<LifecycleCallback> postConstructs) throws InjectionException {
doPostConstruct(instance.getClass(), postConstructs, instance);
} | [
"public",
"void",
"doPostConstruct",
"(",
"Object",
"instance",
",",
"List",
"<",
"LifecycleCallback",
">",
"postConstructs",
")",
"throws",
"InjectionException",
"{",
"doPostConstruct",
"(",
"instance",
".",
"getClass",
"(",
")",
",",
"postConstructs",
",",
"inst... | Processes the PostConstruct callback method for the login callback handler class
@param instance the instance object of the login callback handler class
@param postConstructs a list of PostConstruct metadata in the application client module
@throws InjectionException | [
"Processes",
"the",
"PostConstruct",
"callback",
"method",
"for",
"the",
"login",
"callback",
"handler",
"class"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L60-L62 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java | ParseUtils.missingRequired | public static XMLStreamException missingRequired(final XMLExtendedStreamReader reader, final Set<?> required) {
Set<String> set = new HashSet<>();
for (Object o : required) {
String toString = o.toString();
set.add(toString);
}
return wrapMissingRequiredAttribute(ControllerLogger.ROOT_LOGGER.missingRequiredAttributes(asStringList(required),
reader.getLocation()),
reader,
set);
} | java | public static XMLStreamException missingRequired(final XMLExtendedStreamReader reader, final Set<?> required) {
Set<String> set = new HashSet<>();
for (Object o : required) {
String toString = o.toString();
set.add(toString);
}
return wrapMissingRequiredAttribute(ControllerLogger.ROOT_LOGGER.missingRequiredAttributes(asStringList(required),
reader.getLocation()),
reader,
set);
} | [
"public",
"static",
"XMLStreamException",
"missingRequired",
"(",
"final",
"XMLExtendedStreamReader",
"reader",
",",
"final",
"Set",
"<",
"?",
">",
"required",
")",
"{",
"Set",
"<",
"String",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"... | Get an exception reporting a missing, required XML attribute.
@param reader the stream reader
@param required a set of enums whose toString method returns the
attribute name
@return the exception | [
"Get",
"an",
"exception",
"reporting",
"a",
"missing",
"required",
"XML",
"attribute",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java#L206-L216 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java | CommsByteBuffer.getXid | public synchronized Xid getXid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getXid");
checkReleased();
int formatId = getInt();
int glidLength = getInt();
byte[] globalTransactionId = get(glidLength);
int blqfLength = getInt();
byte[] branchQualifier = get(blqfLength);
XidProxy xidProxy = new XidProxy(formatId, globalTransactionId, branchQualifier);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getXid", xidProxy);
return xidProxy;
} | java | public synchronized Xid getXid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getXid");
checkReleased();
int formatId = getInt();
int glidLength = getInt();
byte[] globalTransactionId = get(glidLength);
int blqfLength = getInt();
byte[] branchQualifier = get(blqfLength);
XidProxy xidProxy = new XidProxy(formatId, globalTransactionId, branchQualifier);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getXid", xidProxy);
return xidProxy;
} | [
"public",
"synchronized",
"Xid",
"getXid",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"getXid\"",
")",
";",
"checkReleased",
... | Reads an Xid from the current position in the buffer.
@return Returns an Xid | [
"Reads",
"an",
"Xid",
"from",
"the",
"current",
"position",
"in",
"the",
"buffer",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L917-L933 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java | CommerceWarehouseItemPersistenceImpl.countByCPI_CPIU | @Override
public int countByCPI_CPIU(long CProductId, String CPInstanceUuid) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_CPI_CPIU;
Object[] finderArgs = new Object[] { CProductId, CPInstanceUuid };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEWAREHOUSEITEM_WHERE);
query.append(_FINDER_COLUMN_CPI_CPIU_CPRODUCTID_2);
boolean bindCPInstanceUuid = false;
if (CPInstanceUuid == null) {
query.append(_FINDER_COLUMN_CPI_CPIU_CPINSTANCEUUID_1);
}
else if (CPInstanceUuid.equals("")) {
query.append(_FINDER_COLUMN_CPI_CPIU_CPINSTANCEUUID_3);
}
else {
bindCPInstanceUuid = true;
query.append(_FINDER_COLUMN_CPI_CPIU_CPINSTANCEUUID_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CProductId);
if (bindCPInstanceUuid) {
qPos.add(CPInstanceUuid);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByCPI_CPIU(long CProductId, String CPInstanceUuid) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_CPI_CPIU;
Object[] finderArgs = new Object[] { CProductId, CPInstanceUuid };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEWAREHOUSEITEM_WHERE);
query.append(_FINDER_COLUMN_CPI_CPIU_CPRODUCTID_2);
boolean bindCPInstanceUuid = false;
if (CPInstanceUuid == null) {
query.append(_FINDER_COLUMN_CPI_CPIU_CPINSTANCEUUID_1);
}
else if (CPInstanceUuid.equals("")) {
query.append(_FINDER_COLUMN_CPI_CPIU_CPINSTANCEUUID_3);
}
else {
bindCPInstanceUuid = true;
query.append(_FINDER_COLUMN_CPI_CPIU_CPINSTANCEUUID_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CProductId);
if (bindCPInstanceUuid) {
qPos.add(CPInstanceUuid);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByCPI_CPIU",
"(",
"long",
"CProductId",
",",
"String",
"CPInstanceUuid",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_COUNT_BY_CPI_CPIU",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object",
"[",
"]",
"{... | Returns the number of commerce warehouse items where CProductId = ? and CPInstanceUuid = ?.
@param CProductId the c product ID
@param CPInstanceUuid the cp instance uuid
@return the number of matching commerce warehouse items | [
"Returns",
"the",
"number",
"of",
"commerce",
"warehouse",
"items",
"where",
"CProductId",
"=",
"?",
";",
"and",
"CPInstanceUuid",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java#L1409-L1470 |
petergeneric/stdlib | guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/auth/oauth2/OAuth2SessionRef.java | OAuth2SessionRef.getAuthFlowStartEndpoint | public URI getAuthFlowStartEndpoint(final String returnTo, final String scope)
{
final String oauthServiceRoot = (oauthServiceRedirectEndpoint != null) ?
oauthServiceRedirectEndpoint :
oauthServiceEndpoint;
final String endpoint = oauthServiceRoot + "/oauth2/authorize";
UriBuilder builder = UriBuilder.fromUri(endpoint);
builder.replaceQueryParam("response_type", "code");
builder.replaceQueryParam("client_id", clientId);
builder.replaceQueryParam("redirect_uri", getOwnCallbackUri());
if (scope != null)
builder.replaceQueryParam("scope", scope);
if (returnTo != null)
builder.replaceQueryParam("state", encodeState(callbackNonce + " " + returnTo));
return builder.build();
} | java | public URI getAuthFlowStartEndpoint(final String returnTo, final String scope)
{
final String oauthServiceRoot = (oauthServiceRedirectEndpoint != null) ?
oauthServiceRedirectEndpoint :
oauthServiceEndpoint;
final String endpoint = oauthServiceRoot + "/oauth2/authorize";
UriBuilder builder = UriBuilder.fromUri(endpoint);
builder.replaceQueryParam("response_type", "code");
builder.replaceQueryParam("client_id", clientId);
builder.replaceQueryParam("redirect_uri", getOwnCallbackUri());
if (scope != null)
builder.replaceQueryParam("scope", scope);
if (returnTo != null)
builder.replaceQueryParam("state", encodeState(callbackNonce + " " + returnTo));
return builder.build();
} | [
"public",
"URI",
"getAuthFlowStartEndpoint",
"(",
"final",
"String",
"returnTo",
",",
"final",
"String",
"scope",
")",
"{",
"final",
"String",
"oauthServiceRoot",
"=",
"(",
"oauthServiceRedirectEndpoint",
"!=",
"null",
")",
"?",
"oauthServiceRedirectEndpoint",
":",
... | Get the endpoint to redirect a client to in order to start an OAuth2 Authorisation Flow
@param returnTo
The URI to redirect the user back to once the authorisation flow completes successfully. If not specified then the user
will be directed to the root of this webapp.
@return | [
"Get",
"the",
"endpoint",
"to",
"redirect",
"a",
"client",
"to",
"in",
"order",
"to",
"start",
"an",
"OAuth2",
"Authorisation",
"Flow"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/auth/oauth2/OAuth2SessionRef.java#L140-L159 |
samskivert/samskivert | src/main/java/com/samskivert/servlet/util/RequestUtils.java | RequestUtils.getServletURL | public static String getServletURL (HttpServletRequest req, String path)
{
StringBuffer buf = req.getRequestURL();
String sname = req.getServletPath();
buf.delete(buf.length() - sname.length(), buf.length());
if (!path.startsWith("/")) {
buf.append("/");
}
buf.append(path);
return buf.toString();
} | java | public static String getServletURL (HttpServletRequest req, String path)
{
StringBuffer buf = req.getRequestURL();
String sname = req.getServletPath();
buf.delete(buf.length() - sname.length(), buf.length());
if (!path.startsWith("/")) {
buf.append("/");
}
buf.append(path);
return buf.toString();
} | [
"public",
"static",
"String",
"getServletURL",
"(",
"HttpServletRequest",
"req",
",",
"String",
"path",
")",
"{",
"StringBuffer",
"buf",
"=",
"req",
".",
"getRequestURL",
"(",
")",
";",
"String",
"sname",
"=",
"req",
".",
"getServletPath",
"(",
")",
";",
"... | Prepends the server, port and servlet context path to the supplied
path, resulting in a fully-formed URL for requesting a servlet. | [
"Prepends",
"the",
"server",
"port",
"and",
"servlet",
"context",
"path",
"to",
"the",
"supplied",
"path",
"resulting",
"in",
"a",
"fully",
"-",
"formed",
"URL",
"for",
"requesting",
"a",
"servlet",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/RequestUtils.java#L75-L85 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java | StringSupport.getRootStackTrace | public static String getRootStackTrace(Throwable t, int depth) {
while(t.getCause() != null) {
t = t.getCause();
}
return getStackTrace(t, depth, null);
} | java | public static String getRootStackTrace(Throwable t, int depth) {
while(t.getCause() != null) {
t = t.getCause();
}
return getStackTrace(t, depth, null);
} | [
"public",
"static",
"String",
"getRootStackTrace",
"(",
"Throwable",
"t",
",",
"int",
"depth",
")",
"{",
"while",
"(",
"t",
".",
"getCause",
"(",
")",
"!=",
"null",
")",
"{",
"t",
"=",
"t",
".",
"getCause",
"(",
")",
";",
"}",
"return",
"getStackTrac... | Retrieves stack trace from throwable.
@param t
@param depth
@return | [
"Retrieves",
"stack",
"trace",
"from",
"throwable",
"."
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L960-L966 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseDoubleObj | @Nullable
public static Double parseDoubleObj (@Nullable final String sStr, @Nullable final Double aDefault)
{
final double dValue = parseDouble (sStr, Double.NaN);
return Double.isNaN (dValue) ? aDefault : Double.valueOf (dValue);
} | java | @Nullable
public static Double parseDoubleObj (@Nullable final String sStr, @Nullable final Double aDefault)
{
final double dValue = parseDouble (sStr, Double.NaN);
return Double.isNaN (dValue) ? aDefault : Double.valueOf (dValue);
} | [
"@",
"Nullable",
"public",
"static",
"Double",
"parseDoubleObj",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"Double",
"aDefault",
")",
"{",
"final",
"double",
"dValue",
"=",
"parseDouble",
"(",
"sStr",
",",
"Double",
".",... | Parse the given {@link String} as {@link Double}. Note: both the locale
independent form of a double can be parsed here (e.g. 4.523) as well as a
localized form using the comma as the decimal separator (e.g. the German
4,523).
@param sStr
The string to parse. May be <code>null</code>.
@param aDefault
The default value to be returned if the parsed string cannot be
converted to a double. May be <code>null</code>.
@return <code>aDefault</code> if the object does not represent a valid
value. | [
"Parse",
"the",
"given",
"{",
"@link",
"String",
"}",
"as",
"{",
"@link",
"Double",
"}",
".",
"Note",
":",
"both",
"the",
"locale",
"independent",
"form",
"of",
"a",
"double",
"can",
"be",
"parsed",
"here",
"(",
"e",
".",
"g",
".",
"4",
".",
"523",... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L567-L572 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.effortRecords | public Collection<Effort> effortRecords(EffortFilter filter) {
return get(Effort.class, (filter != null) ? filter : new EffortFilter());
} | java | public Collection<Effort> effortRecords(EffortFilter filter) {
return get(Effort.class, (filter != null) ? filter : new EffortFilter());
} | [
"public",
"Collection",
"<",
"Effort",
">",
"effortRecords",
"(",
"EffortFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"Effort",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"EffortFilter",
"(",
")",
")",
";",
"}... | Get effort records filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter. | [
"Get",
"effort",
"records",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"in",
"filter",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L88-L90 |
trellis-ldp-archive/trellis-http | src/main/java/org/trellisldp/http/impl/MementoResource.java | MementoResource.getMementoLinks | public static Stream<Link> getMementoLinks(final String identifier, final List<VersionRange> mementos) {
return concat(getTimeMap(identifier, mementos.stream()), mementos.stream().map(mementoToLink(identifier)));
} | java | public static Stream<Link> getMementoLinks(final String identifier, final List<VersionRange> mementos) {
return concat(getTimeMap(identifier, mementos.stream()), mementos.stream().map(mementoToLink(identifier)));
} | [
"public",
"static",
"Stream",
"<",
"Link",
">",
"getMementoLinks",
"(",
"final",
"String",
"identifier",
",",
"final",
"List",
"<",
"VersionRange",
">",
"mementos",
")",
"{",
"return",
"concat",
"(",
"getTimeMap",
"(",
"identifier",
",",
"mementos",
".",
"st... | Retrieve all of the Memento-related link headers given a stream of VersionRange objects
@param identifier the public identifier for the resource
@param mementos a stream of memento values
@return a stream of link headers | [
"Retrieve",
"all",
"of",
"the",
"Memento",
"-",
"related",
"link",
"headers",
"given",
"a",
"stream",
"of",
"VersionRange",
"objects"
] | train | https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/MementoResource.java#L185-L187 |
alkacon/opencms-core | src/org/opencms/security/CmsPersistentLoginTokenHandler.java | CmsPersistentLoginTokenHandler.removeExpiredTokens | public void removeExpiredTokens(CmsUser user, long now) {
List<String> toRemove = Lists.newArrayList();
for (Map.Entry<String, Object> entry : user.getAdditionalInfo().entrySet()) {
String key = entry.getKey();
if (key.startsWith(KEY_PREFIX)) {
try {
long expiry = Long.parseLong((String)entry.getValue());
if (expiry < now) {
toRemove.add(key);
}
} catch (NumberFormatException e) {
toRemove.add(key);
}
}
}
LOG.info("Removing " + toRemove.size() + " expired tokens for user " + user.getName());
for (String removeKey : toRemove) {
user.getAdditionalInfo().remove(removeKey);
}
} | java | public void removeExpiredTokens(CmsUser user, long now) {
List<String> toRemove = Lists.newArrayList();
for (Map.Entry<String, Object> entry : user.getAdditionalInfo().entrySet()) {
String key = entry.getKey();
if (key.startsWith(KEY_PREFIX)) {
try {
long expiry = Long.parseLong((String)entry.getValue());
if (expiry < now) {
toRemove.add(key);
}
} catch (NumberFormatException e) {
toRemove.add(key);
}
}
}
LOG.info("Removing " + toRemove.size() + " expired tokens for user " + user.getName());
for (String removeKey : toRemove) {
user.getAdditionalInfo().remove(removeKey);
}
} | [
"public",
"void",
"removeExpiredTokens",
"(",
"CmsUser",
"user",
",",
"long",
"now",
")",
"{",
"List",
"<",
"String",
">",
"toRemove",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",... | Removes expired tokens from the user's additional infos.<p>
This method does not write the user back to the database.
@param user the user for which to remove the additional infos
@param now the current time | [
"Removes",
"expired",
"tokens",
"from",
"the",
"user",
"s",
"additional",
"infos",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsPersistentLoginTokenHandler.java#L271-L291 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MultiMEProxyHandler.java | MultiMEProxyHandler.initialiseNonPersistent | public void initialiseNonPersistent(MessageProcessor messageProcessor,
SIMPTransactionManager txManager)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initialiseNonPersistent", messageProcessor);
//Release 1 has no Link Bundle IDs for this Neighbour
// Cache the reference to the message processor
_messageProcessor = messageProcessor;
// Create the ObjectPool that will be used to store the
// subscriptionMessages. Creating with an intial length of
// 2, but this could be made a settable parameter for performance
_subscriptionMessagePool = new ObjectPool("SubscriptionMessages", NUM_MESSAGES);
// Create a new object to contain all the Neighbours
_neighbours = new Neighbours(this, _messageProcessor.getMessagingEngineBus());
// Create a new LockManager instance
_lockManager = new LockManager();
// Assign the transaction manager
_transactionManager = txManager;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseNonPersistent");
} | java | public void initialiseNonPersistent(MessageProcessor messageProcessor,
SIMPTransactionManager txManager)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initialiseNonPersistent", messageProcessor);
//Release 1 has no Link Bundle IDs for this Neighbour
// Cache the reference to the message processor
_messageProcessor = messageProcessor;
// Create the ObjectPool that will be used to store the
// subscriptionMessages. Creating with an intial length of
// 2, but this could be made a settable parameter for performance
_subscriptionMessagePool = new ObjectPool("SubscriptionMessages", NUM_MESSAGES);
// Create a new object to contain all the Neighbours
_neighbours = new Neighbours(this, _messageProcessor.getMessagingEngineBus());
// Create a new LockManager instance
_lockManager = new LockManager();
// Assign the transaction manager
_transactionManager = txManager;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseNonPersistent");
} | [
"public",
"void",
"initialiseNonPersistent",
"(",
"MessageProcessor",
"messageProcessor",
",",
"SIMPTransactionManager",
"txManager",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibT... | Called to recover Neighbours from the MessageStore.
@param messageProcessor The message processor instance
@param txManager The transaction manager instance to create Local transactions
under. | [
"Called",
"to",
"recover",
"Neighbours",
"from",
"the",
"MessageStore",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/MultiMEProxyHandler.java#L140-L167 |
zk1931/jzab | src/main/java/com/github/zk1931/jzab/PersistentState.java | PersistentState.setLastSeenConfig | void setLastSeenConfig(ClusterConfiguration conf) throws IOException {
String version = conf.getVersion().toSimpleString();
File file = new File(rootDir, String.format("cluster_config.%s", version));
FileUtils.writePropertiesToFile(conf.toProperties(), file);
// Since the new config file gets created, we need to fsync the directory.
fsyncDirectory();
} | java | void setLastSeenConfig(ClusterConfiguration conf) throws IOException {
String version = conf.getVersion().toSimpleString();
File file = new File(rootDir, String.format("cluster_config.%s", version));
FileUtils.writePropertiesToFile(conf.toProperties(), file);
// Since the new config file gets created, we need to fsync the directory.
fsyncDirectory();
} | [
"void",
"setLastSeenConfig",
"(",
"ClusterConfiguration",
"conf",
")",
"throws",
"IOException",
"{",
"String",
"version",
"=",
"conf",
".",
"getVersion",
"(",
")",
".",
"toSimpleString",
"(",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"rootDir",
",",... | Updates the last seen configuration.
@param conf the updated configuration.
@throws IOException in case of IO failure. | [
"Updates",
"the",
"last",
"seen",
"configuration",
"."
] | train | https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L253-L259 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java | ImagePipeline.fetchEncodedImage | public DataSource<CloseableReference<PooledByteBuffer>> fetchEncodedImage(
ImageRequest imageRequest,
Object callerContext) {
return fetchEncodedImage(imageRequest, callerContext, null);
} | java | public DataSource<CloseableReference<PooledByteBuffer>> fetchEncodedImage(
ImageRequest imageRequest,
Object callerContext) {
return fetchEncodedImage(imageRequest, callerContext, null);
} | [
"public",
"DataSource",
"<",
"CloseableReference",
"<",
"PooledByteBuffer",
">",
">",
"fetchEncodedImage",
"(",
"ImageRequest",
"imageRequest",
",",
"Object",
"callerContext",
")",
"{",
"return",
"fetchEncodedImage",
"(",
"imageRequest",
",",
"callerContext",
",",
"nu... | Submits a request for execution and returns a DataSource representing the pending encoded
image(s).
<p> The ResizeOptions in the imageRequest will be ignored for this fetch
<p>The returned DataSource must be closed once the client has finished with it.
@param imageRequest the request to submit
@return a DataSource representing the pending encoded image(s) | [
"Submits",
"a",
"request",
"for",
"execution",
"and",
"returns",
"a",
"DataSource",
"representing",
"the",
"pending",
"encoded",
"image",
"(",
"s",
")",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java#L296-L300 |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionManagerException.java | SessionManagerException.fromThrowable | public static SessionManagerException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionManagerException && Objects.equals(message, cause.getMessage()))
? (SessionManagerException) cause
: new SessionManagerException(message, cause);
} | java | public static SessionManagerException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionManagerException && Objects.equals(message, cause.getMessage()))
? (SessionManagerException) cause
: new SessionManagerException(message, cause);
} | [
"public",
"static",
"SessionManagerException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionManagerException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getM... | Converts a Throwable to a SessionManagerException with the specified detail message. If the
Throwable is a SessionManagerException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionManagerException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionManagerException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionManagerException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionManagerException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"t... | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionManagerException.java#L62-L66 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java | ComponentFactory.newImage | public static Image newImage(final String id, final IResource imageResource)
{
final Image image = new Image(id, imageResource);
image.setOutputMarkupId(true);
return image;
} | java | public static Image newImage(final String id, final IResource imageResource)
{
final Image image = new Image(id, imageResource);
image.setOutputMarkupId(true);
return image;
} | [
"public",
"static",
"Image",
"newImage",
"(",
"final",
"String",
"id",
",",
"final",
"IResource",
"imageResource",
")",
"{",
"final",
"Image",
"image",
"=",
"new",
"Image",
"(",
"id",
",",
"imageResource",
")",
";",
"image",
".",
"setOutputMarkupId",
"(",
... | Factory method for create a new {@link Image}.
@param id
the id
@param imageResource
the IResource object
@return the new {@link Image}. | [
"Factory",
"method",
"for",
"create",
"a",
"new",
"{",
"@link",
"Image",
"}",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java#L389-L394 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.identity | public static DMatrixRMaj identity(int numRows , int numCols )
{
DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols);
int small = numRows < numCols ? numRows : numCols;
for( int i = 0; i < small; i++ ) {
ret.set(i,i,1.0);
}
return ret;
} | java | public static DMatrixRMaj identity(int numRows , int numCols )
{
DMatrixRMaj ret = new DMatrixRMaj(numRows,numCols);
int small = numRows < numCols ? numRows : numCols;
for( int i = 0; i < small; i++ ) {
ret.set(i,i,1.0);
}
return ret;
} | [
"public",
"static",
"DMatrixRMaj",
"identity",
"(",
"int",
"numRows",
",",
"int",
"numCols",
")",
"{",
"DMatrixRMaj",
"ret",
"=",
"new",
"DMatrixRMaj",
"(",
"numRows",
",",
"numCols",
")",
";",
"int",
"small",
"=",
"numRows",
"<",
"numCols",
"?",
"numRows"... | Creates a rectangular matrix which is zero except along the diagonals.
@param numRows Number of rows in the matrix.
@param numCols NUmber of columns in the matrix.
@return A matrix with diagonal elements equal to one. | [
"Creates",
"a",
"rectangular",
"matrix",
"which",
"is",
"zero",
"except",
"along",
"the",
"diagonals",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L987-L998 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java | ImageIOGreyScale.createImageOutputStream | public static ImageOutputStream createImageOutputStream(Object output) throws IOException {
if (output == null) {
throw new IllegalArgumentException("output == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageOutputStreamSpi.class, true);
} catch (IllegalArgumentException e) {
return null;
}
boolean usecache = getUseCache() && hasCachePermission();
while (iter.hasNext()) {
ImageOutputStreamSpi spi = (ImageOutputStreamSpi) iter.next();
if (spi.getOutputClass().isInstance(output)) {
try {
return spi.createOutputStreamInstance(output, usecache, getCacheDirectory());
} catch (IOException e) {
throw new IIOException("Can't create cache file!", e);
}
}
}
return null;
} | java | public static ImageOutputStream createImageOutputStream(Object output) throws IOException {
if (output == null) {
throw new IllegalArgumentException("output == null!");
}
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageOutputStreamSpi.class, true);
} catch (IllegalArgumentException e) {
return null;
}
boolean usecache = getUseCache() && hasCachePermission();
while (iter.hasNext()) {
ImageOutputStreamSpi spi = (ImageOutputStreamSpi) iter.next();
if (spi.getOutputClass().isInstance(output)) {
try {
return spi.createOutputStreamInstance(output, usecache, getCacheDirectory());
} catch (IOException e) {
throw new IIOException("Can't create cache file!", e);
}
}
}
return null;
} | [
"public",
"static",
"ImageOutputStream",
"createImageOutputStream",
"(",
"Object",
"output",
")",
"throws",
"IOException",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"output == null!\"",
")",
";",
"}",
"Ite... | Returns an <code>ImageOutputStream</code> that will send its output to the given <code>Object</code>.
The set of <code>ImageOutputStreamSpi</code>s registered with the <code>IIORegistry</code> class is
queried and the first one that is able to send output from the supplied object is used to create the
returned <code>ImageOutputStream</code>. If no suitable <code>ImageOutputStreamSpi</code> exists,
<code>null</code> is returned.
<p>
The current cache settings from <code>getUseCache</code>and <code>getCacheDirectory</code> will be used
to control caching.
@param output
an <code>Object</code> to be used as an output destination, such as a <code>File</code>,
writable <code>RandomAccessFile</code>, or <code>OutputStream</code>.
@return an <code>ImageOutputStream</code>, or <code>null</code>.
@exception IllegalArgumentException
if <code>output</code> is <code>null</code>.
@exception IOException
if a cache file is needed but cannot be created.
@see javax.imageio.spi.ImageOutputStreamSpi | [
"Returns",
"an",
"<code",
">",
"ImageOutputStream<",
"/",
"code",
">",
"that",
"will",
"send",
"its",
"output",
"to",
"the",
"given",
"<code",
">",
"Object<",
"/",
"code",
">",
".",
"The",
"set",
"of",
"<code",
">",
"ImageOutputStreamSpi<",
"/",
"code",
... | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L351-L378 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.marketplace_getListings | public T marketplace_getListings(Collection<Long> listingIds, Collection<Integer> userIds)
throws FacebookException, IOException {
ArrayList<Pair<String, CharSequence>> params =
new ArrayList<Pair<String, CharSequence>>(FacebookMethod.MARKETPLACE_GET_LISTINGS.numParams());
if (null != listingIds && !listingIds.isEmpty()) {
params.add(new Pair<String, CharSequence>("listing_ids", delimit(listingIds)));
}
if (null != userIds && !userIds.isEmpty()) {
params.add(new Pair<String, CharSequence>("uids", delimit(userIds)));
}
assert !params.isEmpty() : "Either listingIds or userIds should be provided";
return this.callMethod(FacebookMethod.MARKETPLACE_GET_LISTINGS, params);
} | java | public T marketplace_getListings(Collection<Long> listingIds, Collection<Integer> userIds)
throws FacebookException, IOException {
ArrayList<Pair<String, CharSequence>> params =
new ArrayList<Pair<String, CharSequence>>(FacebookMethod.MARKETPLACE_GET_LISTINGS.numParams());
if (null != listingIds && !listingIds.isEmpty()) {
params.add(new Pair<String, CharSequence>("listing_ids", delimit(listingIds)));
}
if (null != userIds && !userIds.isEmpty()) {
params.add(new Pair<String, CharSequence>("uids", delimit(userIds)));
}
assert !params.isEmpty() : "Either listingIds or userIds should be provided";
return this.callMethod(FacebookMethod.MARKETPLACE_GET_LISTINGS, params);
} | [
"public",
"T",
"marketplace_getListings",
"(",
"Collection",
"<",
"Long",
">",
"listingIds",
",",
"Collection",
"<",
"Integer",
">",
"userIds",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"ArrayList",
"<",
"Pair",
"<",
"String",
",",
"CharSequen... | Fetch marketplace listings, filtered by listing IDs and/or the posting users' IDs.
@param listingIds listing identifiers (required if uids is null/empty)
@param userIds posting user identifiers (required if listingIds is null/empty)
@return a T of marketplace listings
@see <a href="http://wiki.developers.facebook.com/index.php/Marketplace.getListings">
Developers Wiki: marketplace.getListings</a> | [
"Fetch",
"marketplace",
"listings",
"filtered",
"by",
"listing",
"IDs",
"and",
"/",
"or",
"the",
"posting",
"users",
"IDs",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2024-L2038 |
apereo/cas | support/cas-server-support-trusted-mfa/src/main/java/org/apereo/cas/trusted/web/flow/fingerprint/CookieDeviceFingerprintComponentExtractor.java | CookieDeviceFingerprintComponentExtractor.createDeviceFingerPrintCookie | protected void createDeviceFingerPrintCookie(final RequestContext context, final HttpServletRequest request, final String cookieValue) {
val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context);
cookieGenerator.addCookie(request, response, cookieValue);
} | java | protected void createDeviceFingerPrintCookie(final RequestContext context, final HttpServletRequest request, final String cookieValue) {
val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context);
cookieGenerator.addCookie(request, response, cookieValue);
} | [
"protected",
"void",
"createDeviceFingerPrintCookie",
"(",
"final",
"RequestContext",
"context",
",",
"final",
"HttpServletRequest",
"request",
",",
"final",
"String",
"cookieValue",
")",
"{",
"val",
"response",
"=",
"WebUtils",
".",
"getHttpServletResponseFromExternalWeb... | Create device finger print cookie.
@param context the context
@param request the request
@param cookieValue the cookie value | [
"Create",
"device",
"finger",
"print",
"cookie",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-trusted-mfa/src/main/java/org/apereo/cas/trusted/web/flow/fingerprint/CookieDeviceFingerprintComponentExtractor.java#L52-L55 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendPing | public static void sendPing(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendInternal(pooledData, WebSocketFrameType.PING, wsChannel, callback, null, -1);
} | java | public static void sendPing(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendInternal(pooledData, WebSocketFrameType.PING, wsChannel, callback, null, -1);
} | [
"public",
"static",
"void",
"sendPing",
"(",
"final",
"PooledByteBuffer",
"pooledData",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"Void",
">",
"callback",
")",
"{",
"sendInternal",
"(",
"pooledData",
",",
"WebSocketFrameT... | Sends a complete ping message, invoking the callback when complete
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel
@param callback The callback to invoke on completion | [
"Sends",
"a",
"complete",
"ping",
"message",
"invoking",
"the",
"callback",
"when",
"complete",
"Automatically",
"frees",
"the",
"pooled",
"byte",
"buffer",
"when",
"done",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L328-L330 |
romannurik/muzei | muzei-api/src/main/java/com/google/android/apps/muzei/api/MuzeiArtSource.java | MuzeiArtSource.publishArtwork | protected final void publishArtwork(@NonNull Artwork artwork) {
artwork.setComponentName(new ComponentName(this, getClass()));
mCurrentState.setCurrentArtwork(artwork);
mServiceHandler.removeCallbacks(mPublishStateRunnable);
mServiceHandler.post(mPublishStateRunnable);
} | java | protected final void publishArtwork(@NonNull Artwork artwork) {
artwork.setComponentName(new ComponentName(this, getClass()));
mCurrentState.setCurrentArtwork(artwork);
mServiceHandler.removeCallbacks(mPublishStateRunnable);
mServiceHandler.post(mPublishStateRunnable);
} | [
"protected",
"final",
"void",
"publishArtwork",
"(",
"@",
"NonNull",
"Artwork",
"artwork",
")",
"{",
"artwork",
".",
"setComponentName",
"(",
"new",
"ComponentName",
"(",
"this",
",",
"getClass",
"(",
")",
")",
")",
";",
"mCurrentState",
".",
"setCurrentArtwor... | Publishes the provided {@link Artwork} object. This will be sent to all current subscribers
and to all future subscribers, until a new artwork is published.
@param artwork the artwork to publish. | [
"Publishes",
"the",
"provided",
"{",
"@link",
"Artwork",
"}",
"object",
".",
"This",
"will",
"be",
"sent",
"to",
"all",
"current",
"subscribers",
"and",
"to",
"all",
"future",
"subscribers",
"until",
"a",
"new",
"artwork",
"is",
"published",
"."
] | train | https://github.com/romannurik/muzei/blob/d00777a5fc59f34471be338c814ea85ddcbde304/muzei-api/src/main/java/com/google/android/apps/muzei/api/MuzeiArtSource.java#L489-L494 |
talenguyen/PrettySharedPreferences | prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java | PrettySharedPreferences.getBooleanEditor | protected BooleanEditor getBooleanEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new BooleanEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof BooleanEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (BooleanEditor) typeEditor;
} | java | protected BooleanEditor getBooleanEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new BooleanEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof BooleanEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (BooleanEditor) typeEditor;
} | [
"protected",
"BooleanEditor",
"getBooleanEditor",
"(",
"String",
"key",
")",
"{",
"TypeEditor",
"typeEditor",
"=",
"TYPE_EDITOR_MAP",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"typeEditor",
"==",
"null",
")",
"{",
"typeEditor",
"=",
"new",
"BooleanEditor",
... | Call to get a {@link com.tale.prettysharedpreferences.BooleanEditor} object for the specific
key. <code>NOTE:</code> There is a unique {@link com.tale.prettysharedpreferences.TypeEditor}
object for a unique key.
@param key The name of the preference.
@return {@link com.tale.prettysharedpreferences.BooleanEditor} object to be store or retrieve
a {@link java.lang.Boolean} value. | [
"Call",
"to",
"get",
"a",
"{"
] | train | https://github.com/talenguyen/PrettySharedPreferences/blob/b97edf86c8fa65be2165f2cd790545c78c971c22/prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java#L71-L81 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/utils/RegularUtils.java | RegularUtils.isMatched | public static boolean isMatched(String pattern, String reg) {
Pattern compile = Pattern.compile(reg);
return compile.matcher(pattern).matches();
} | java | public static boolean isMatched(String pattern, String reg) {
Pattern compile = Pattern.compile(reg);
return compile.matcher(pattern).matches();
} | [
"public",
"static",
"boolean",
"isMatched",
"(",
"String",
"pattern",
",",
"String",
"reg",
")",
"{",
"Pattern",
"compile",
"=",
"Pattern",
".",
"compile",
"(",
"reg",
")",
";",
"return",
"compile",
".",
"matcher",
"(",
"pattern",
")",
".",
"matches",
"(... | <p>判断内容是否匹配</p>
author : Crab2Died
date : 2017年06月02日 15:46:25
@param pattern 匹配目标内容
@param reg 正则表达式
@return 返回boolean | [
"<p",
">",
"判断内容是否匹配<",
"/",
"p",
">",
"author",
":",
"Crab2Died",
"date",
":",
"2017年06月02日",
"15",
":",
"46",
":",
"25"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/utils/RegularUtils.java#L53-L56 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/DependencyTable.java | DependencyTable.needsRebuild | public boolean needsRebuild(final CCTask task, final TargetInfo target, final int dependencyDepth) {
// look at any files where the compositeLastModified
// is not known, but the includes are known
//
boolean mustRebuild = false;
final CompilerConfiguration compiler = (CompilerConfiguration) target.getConfiguration();
final String includePathIdentifier = compiler.getIncludePathIdentifier();
final File[] sources = target.getSources();
final DependencyInfo[] dependInfos = new DependencyInfo[sources.length];
final long outputLastModified = target.getOutput().lastModified();
//
// try to solve problem using existing dependency info
// (not parsing any new files)
//
DependencyInfo[] stack = new DependencyInfo[50];
boolean rebuildOnStackExhaustion = true;
if (dependencyDepth >= 0) {
if (dependencyDepth < 50) {
stack = new DependencyInfo[dependencyDepth];
}
rebuildOnStackExhaustion = false;
}
final TimestampChecker checker = new TimestampChecker(outputLastModified, rebuildOnStackExhaustion);
for (int i = 0; i < sources.length && !mustRebuild; i++) {
final File source = sources[i];
final String relative = CUtil.getRelativePath(this.baseDirPath, source);
DependencyInfo dependInfo = getDependencyInfo(relative, includePathIdentifier);
if (dependInfo == null) {
task.log("Parsing " + relative, Project.MSG_VERBOSE);
dependInfo = parseIncludes(task, compiler, source);
}
walkDependencies(task, dependInfo, compiler, stack, checker);
mustRebuild = checker.getMustRebuild();
}
return mustRebuild;
} | java | public boolean needsRebuild(final CCTask task, final TargetInfo target, final int dependencyDepth) {
// look at any files where the compositeLastModified
// is not known, but the includes are known
//
boolean mustRebuild = false;
final CompilerConfiguration compiler = (CompilerConfiguration) target.getConfiguration();
final String includePathIdentifier = compiler.getIncludePathIdentifier();
final File[] sources = target.getSources();
final DependencyInfo[] dependInfos = new DependencyInfo[sources.length];
final long outputLastModified = target.getOutput().lastModified();
//
// try to solve problem using existing dependency info
// (not parsing any new files)
//
DependencyInfo[] stack = new DependencyInfo[50];
boolean rebuildOnStackExhaustion = true;
if (dependencyDepth >= 0) {
if (dependencyDepth < 50) {
stack = new DependencyInfo[dependencyDepth];
}
rebuildOnStackExhaustion = false;
}
final TimestampChecker checker = new TimestampChecker(outputLastModified, rebuildOnStackExhaustion);
for (int i = 0; i < sources.length && !mustRebuild; i++) {
final File source = sources[i];
final String relative = CUtil.getRelativePath(this.baseDirPath, source);
DependencyInfo dependInfo = getDependencyInfo(relative, includePathIdentifier);
if (dependInfo == null) {
task.log("Parsing " + relative, Project.MSG_VERBOSE);
dependInfo = parseIncludes(task, compiler, source);
}
walkDependencies(task, dependInfo, compiler, stack, checker);
mustRebuild = checker.getMustRebuild();
}
return mustRebuild;
} | [
"public",
"boolean",
"needsRebuild",
"(",
"final",
"CCTask",
"task",
",",
"final",
"TargetInfo",
"target",
",",
"final",
"int",
"dependencyDepth",
")",
"{",
"// look at any files where the compositeLastModified",
"// is not known, but the includes are known",
"//",
"boolean",... | Determines if the specified target needs to be rebuilt.
This task may result in substantial IO as files are parsed to determine
their dependencies | [
"Determines",
"if",
"the",
"specified",
"target",
"needs",
"to",
"be",
"rebuilt",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/DependencyTable.java#L405-L440 |
taskadapter/redmine-java-api | src/main/java/com/taskadapter/redmineapi/internal/Transport.java | Transport.deleteObject | public <T extends Identifiable> void deleteObject(Class<T> classs, String id)
throws RedmineException {
final URI uri = getURIConfigurator().getObjectURI(classs, id);
final HttpDelete http = new HttpDelete(uri);
send(http);
} | java | public <T extends Identifiable> void deleteObject(Class<T> classs, String id)
throws RedmineException {
final URI uri = getURIConfigurator().getObjectURI(classs, id);
final HttpDelete http = new HttpDelete(uri);
send(http);
} | [
"public",
"<",
"T",
"extends",
"Identifiable",
">",
"void",
"deleteObject",
"(",
"Class",
"<",
"T",
">",
"classs",
",",
"String",
"id",
")",
"throws",
"RedmineException",
"{",
"final",
"URI",
"uri",
"=",
"getURIConfigurator",
"(",
")",
".",
"getObjectURI",
... | Deletes an object.
@param classs
object class.
@param id
object id.
@throws RedmineException
if something goes wrong. | [
"Deletes",
"an",
"object",
"."
] | train | https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/internal/Transport.java#L328-L333 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/RequestResponse.java | RequestResponse.getResponseValue | public <T> T getResponseValue(String path, Class<T> clazz) {
return JacksonUtils.getValue(responseJson, path, clazz);
} | java | public <T> T getResponseValue(String path, Class<T> clazz) {
return JacksonUtils.getValue(responseJson, path, clazz);
} | [
"public",
"<",
"T",
">",
"T",
"getResponseValue",
"(",
"String",
"path",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"JacksonUtils",
".",
"getValue",
"(",
"responseJson",
",",
"path",
",",
"clazz",
")",
";",
"}"
] | Get a response value from the JSON tree using dPath expression.
@param path
@param clazz
@return | [
"Get",
"a",
"response",
"value",
"from",
"the",
"JSON",
"tree",
"using",
"dPath",
"expression",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/RequestResponse.java#L345-L347 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/view/AutoResizeTextView.java | AutoResizeTextView.setLineSpacing | @Override
public void setLineSpacing(float add, float mult) {
super.setLineSpacing(add, mult);
mSpacingMult = mult;
mSpacingAdd = add;
} | java | @Override
public void setLineSpacing(float add, float mult) {
super.setLineSpacing(add, mult);
mSpacingMult = mult;
mSpacingAdd = add;
} | [
"@",
"Override",
"public",
"void",
"setLineSpacing",
"(",
"float",
"add",
",",
"float",
"mult",
")",
"{",
"super",
".",
"setLineSpacing",
"(",
"add",
",",
"mult",
")",
";",
"mSpacingMult",
"=",
"mult",
";",
"mSpacingAdd",
"=",
"add",
";",
"}"
] | Override the set line spacing to update our internal reference values | [
"Override",
"the",
"set",
"line",
"spacing",
"to",
"update",
"our",
"internal",
"reference",
"values"
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/view/AutoResizeTextView.java#L134-L139 |
mnlipp/jgrapes | org.jgrapes.http/src/org/jgrapes/http/HttpServer.java | HttpServer.onAccepted | @Handler(channels = NetworkChannel.class)
public void onAccepted(Accepted event, IOSubchannel netChannel) {
new WebAppMsgChannel(event, netChannel);
} | java | @Handler(channels = NetworkChannel.class)
public void onAccepted(Accepted event, IOSubchannel netChannel) {
new WebAppMsgChannel(event, netChannel);
} | [
"@",
"Handler",
"(",
"channels",
"=",
"NetworkChannel",
".",
"class",
")",
"public",
"void",
"onAccepted",
"(",
"Accepted",
"event",
",",
"IOSubchannel",
"netChannel",
")",
"{",
"new",
"WebAppMsgChannel",
"(",
"event",
",",
"netChannel",
")",
";",
"}"
] | Creates a new downstream connection as {@link LinkedIOSubchannel}
of the network connection, a {@link HttpRequestDecoder} and a
{@link HttpResponseEncoder}.
@param event
the accepted event | [
"Creates",
"a",
"new",
"downstream",
"connection",
"as",
"{",
"@link",
"LinkedIOSubchannel",
"}",
"of",
"the",
"network",
"connection",
"a",
"{",
"@link",
"HttpRequestDecoder",
"}",
"and",
"a",
"{",
"@link",
"HttpResponseEncoder",
"}",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/HttpServer.java#L237-L240 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | ProcessDefinitionManager.cascadeDeleteProcessInstancesForProcessDefinition | protected void cascadeDeleteProcessInstancesForProcessDefinition(String processDefinitionId, boolean skipCustomListeners, boolean skipIoMappings) {
getProcessInstanceManager()
.deleteProcessInstancesByProcessDefinition(processDefinitionId, "deleted process definition", true, skipCustomListeners, skipIoMappings);
} | java | protected void cascadeDeleteProcessInstancesForProcessDefinition(String processDefinitionId, boolean skipCustomListeners, boolean skipIoMappings) {
getProcessInstanceManager()
.deleteProcessInstancesByProcessDefinition(processDefinitionId, "deleted process definition", true, skipCustomListeners, skipIoMappings);
} | [
"protected",
"void",
"cascadeDeleteProcessInstancesForProcessDefinition",
"(",
"String",
"processDefinitionId",
",",
"boolean",
"skipCustomListeners",
",",
"boolean",
"skipIoMappings",
")",
"{",
"getProcessInstanceManager",
"(",
")",
".",
"deleteProcessInstancesByProcessDefinitio... | Cascades the deletion of the process definition to the process instances.
Skips the custom listeners if the flag was set to true.
@param processDefinitionId the process definition id
@param skipCustomListeners true if the custom listeners should be skipped at process instance deletion
@param skipIoMappings specifies whether input/output mappings for tasks should be invoked | [
"Cascades",
"the",
"deletion",
"of",
"the",
"process",
"definition",
"to",
"the",
"process",
"instances",
".",
"Skips",
"the",
"custom",
"listeners",
"if",
"the",
"flag",
"was",
"set",
"to",
"true",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java#L238-L241 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.findByIndex | @Deprecated
public <T> List<T> findByIndex(String selectorJson, Class<T> classOfT) {
return findByIndex(selectorJson, classOfT, new FindByIndexOptions());
} | java | @Deprecated
public <T> List<T> findByIndex(String selectorJson, Class<T> classOfT) {
return findByIndex(selectorJson, classOfT, new FindByIndexOptions());
} | [
"@",
"Deprecated",
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"findByIndex",
"(",
"String",
"selectorJson",
",",
"Class",
"<",
"T",
">",
"classOfT",
")",
"{",
"return",
"findByIndex",
"(",
"selectorJson",
",",
"classOfT",
",",
"new",
"FindByIndexOptio... | Find documents using an index
@param selectorJson String representation of a JSON object describing criteria used to
select documents. For example:
{@code "{ \"selector\": {<your data here>} }"}.
@param classOfT The class of Java objects to be returned
@param <T> the type of the Java object to be returned
@return List of classOfT objects
@see #findByIndex(String, Class, FindByIndexOptions)
@see <a
href="https://console.bluemix.net/docs/services/Cloudant/api/cloudant_query.html#selector-syntax"
target="_blank">selector syntax</a>
@deprecated Use {@link #query(String, Class)} instead | [
"Find",
"documents",
"using",
"an",
"index"
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L419-L422 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java | GeneratedDUserDaoImpl.queryByUpdatedBy | public Iterable<DUser> queryByUpdatedBy(java.lang.String updatedBy) {
return queryByField(null, DUserMapper.Field.UPDATEDBY.getFieldName(), updatedBy);
} | java | public Iterable<DUser> queryByUpdatedBy(java.lang.String updatedBy) {
return queryByField(null, DUserMapper.Field.UPDATEDBY.getFieldName(), updatedBy);
} | [
"public",
"Iterable",
"<",
"DUser",
">",
"queryByUpdatedBy",
"(",
"java",
".",
"lang",
".",
"String",
"updatedBy",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DUserMapper",
".",
"Field",
".",
"UPDATEDBY",
".",
"getFieldName",
"(",
")",
",",
"upd... | query-by method for field updatedBy
@param updatedBy the specified attribute
@return an Iterable of DUsers for the specified updatedBy | [
"query",
"-",
"by",
"method",
"for",
"field",
"updatedBy"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L259-L261 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java | ContentSpecProcessor.processAssignedWriter | protected void processAssignedWriter(final TagProvider tagProvider, final ITopicNode topicNode, final TopicWrapper topic) {
LOG.debug("Processing assigned writer");
// See if a new tag collection needs to be created
if (topic.getTags() == null) {
topic.setTags(tagProvider.newTagCollection());
}
// Set the assigned writer (Tag Table)
final TagWrapper writerTag = tagProvider.getTagByName(topicNode.getAssignedWriter(true));
// Save a new assigned writer
topic.getTags().addNewItem(writerTag);
// Some providers need the collection to be set to set flags for saving
topic.setTags(topic.getTags());
} | java | protected void processAssignedWriter(final TagProvider tagProvider, final ITopicNode topicNode, final TopicWrapper topic) {
LOG.debug("Processing assigned writer");
// See if a new tag collection needs to be created
if (topic.getTags() == null) {
topic.setTags(tagProvider.newTagCollection());
}
// Set the assigned writer (Tag Table)
final TagWrapper writerTag = tagProvider.getTagByName(topicNode.getAssignedWriter(true));
// Save a new assigned writer
topic.getTags().addNewItem(writerTag);
// Some providers need the collection to be set to set flags for saving
topic.setTags(topic.getTags());
} | [
"protected",
"void",
"processAssignedWriter",
"(",
"final",
"TagProvider",
"tagProvider",
",",
"final",
"ITopicNode",
"topicNode",
",",
"final",
"TopicWrapper",
"topic",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Processing assigned writer\"",
")",
";",
"// See if a new t... | Processes a Spec Topic and adds the assigned writer for the topic it represents.
@param tagProvider
@param topicNode The topic node object that contains the assigned writer.
@param topic The topic entity to be updated.
@return True if anything in the topic entity was changed, otherwise false. | [
"Processes",
"a",
"Spec",
"Topic",
"and",
"adds",
"the",
"assigned",
"writer",
"for",
"the",
"topic",
"it",
"represents",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L936-L950 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionType.java | ConnectionType.setVCConnectionType | public static void setVCConnectionType(VirtualConnection vc, ConnectionType connType) {
if (vc == null || connType == null) {
return;
}
Map<Object, Object> map = vc.getStateMap();
// Internal connections are both inbound and outbound (they're connections
// to ourselves)
// so while we prevent setting Outbound ConnTypes for inbound connections
// and vice versa,
// we don't prevent internal types from being set as either.
if (vc instanceof InboundVirtualConnection && ConnectionType.isOutbound(connType.type)) {
throw new IllegalStateException("Cannot set outbound ConnectionType on inbound VirtualConnection");
} else if (vc instanceof OutboundVirtualConnection && ConnectionType.isInbound(connType.type)) {
throw new IllegalStateException("Cannot set inbound ConnectionType on outbound VirtualConnection");
}
map.put(CONNECTION_TYPE_VC_KEY, connType);
} | java | public static void setVCConnectionType(VirtualConnection vc, ConnectionType connType) {
if (vc == null || connType == null) {
return;
}
Map<Object, Object> map = vc.getStateMap();
// Internal connections are both inbound and outbound (they're connections
// to ourselves)
// so while we prevent setting Outbound ConnTypes for inbound connections
// and vice versa,
// we don't prevent internal types from being set as either.
if (vc instanceof InboundVirtualConnection && ConnectionType.isOutbound(connType.type)) {
throw new IllegalStateException("Cannot set outbound ConnectionType on inbound VirtualConnection");
} else if (vc instanceof OutboundVirtualConnection && ConnectionType.isInbound(connType.type)) {
throw new IllegalStateException("Cannot set inbound ConnectionType on outbound VirtualConnection");
}
map.put(CONNECTION_TYPE_VC_KEY, connType);
} | [
"public",
"static",
"void",
"setVCConnectionType",
"(",
"VirtualConnection",
"vc",
",",
"ConnectionType",
"connType",
")",
"{",
"if",
"(",
"vc",
"==",
"null",
"||",
"connType",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Map",
"<",
"Object",
",",
"Object"... | Set the connection type on the virtual connection. This will overlay
any preset value.
@param vc
VirtualConnection containing simple state for this connection
@param connType
ConnectionType for the VirtualConnection | [
"Set",
"the",
"connection",
"type",
"on",
"the",
"virtual",
"connection",
".",
"This",
"will",
"overlay",
"any",
"preset",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionType.java#L50-L69 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.div | public static BigDecimal div(BigDecimal v1, BigDecimal v2, int scale, RoundingMode roundingMode) {
Assert.notNull(v2, "Divisor must be not null !");
if (null == v1) {
return BigDecimal.ZERO;
}
if (scale < 0) {
scale = -scale;
}
return v1.divide(v2, scale, roundingMode);
} | java | public static BigDecimal div(BigDecimal v1, BigDecimal v2, int scale, RoundingMode roundingMode) {
Assert.notNull(v2, "Divisor must be not null !");
if (null == v1) {
return BigDecimal.ZERO;
}
if (scale < 0) {
scale = -scale;
}
return v1.divide(v2, scale, roundingMode);
} | [
"public",
"static",
"BigDecimal",
"div",
"(",
"BigDecimal",
"v1",
",",
"BigDecimal",
"v2",
",",
"int",
"scale",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"Assert",
".",
"notNull",
"(",
"v2",
",",
"\"Divisor must be not null !\"",
")",
";",
"if",
"(",
"n... | 提供(相对)精确的除法运算,当发生除不尽的情况时,由scale指定精确度
@param v1 被除数
@param v2 除数
@param scale 精确度,如果为负值,取绝对值
@param roundingMode 保留小数的模式 {@link RoundingMode}
@return 两个参数的商
@since 3.0.9 | [
"提供",
"(",
"相对",
")",
"精确的除法运算",
"当发生除不尽的情况时",
"由scale指定精确度"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L741-L750 |
ModeShape/modeshape | web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/contents/Contents.java | Contents.exportXML | public void exportXML(String name, boolean skipBinary, boolean noRecurse) {
console.jcrService().export(repository, workspace(), path(), name, true, true, new AsyncCallback<Object>() {
@Override
public void onFailure(Throwable caught) {
SC.say(caught.getMessage());
}
@Override
public void onSuccess(Object result) {
SC.say("Complete");
}
});
} | java | public void exportXML(String name, boolean skipBinary, boolean noRecurse) {
console.jcrService().export(repository, workspace(), path(), name, true, true, new AsyncCallback<Object>() {
@Override
public void onFailure(Throwable caught) {
SC.say(caught.getMessage());
}
@Override
public void onSuccess(Object result) {
SC.say("Complete");
}
});
} | [
"public",
"void",
"exportXML",
"(",
"String",
"name",
",",
"boolean",
"skipBinary",
",",
"boolean",
"noRecurse",
")",
"{",
"console",
".",
"jcrService",
"(",
")",
".",
"export",
"(",
"repository",
",",
"workspace",
"(",
")",
",",
"path",
"(",
")",
",",
... | Exports contents to the given file.
@param name the name of the file.
@param skipBinary
@param noRecurse | [
"Exports",
"contents",
"to",
"the",
"given",
"file",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/contents/Contents.java#L349-L361 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.TABLE | public static HtmlTree TABLE(HtmlStyle styleClass, int border, int cellPadding,
int cellSpacing, String summary, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
htmltree.addAttr(HtmlAttr.CELLPADDING, Integer.toString(cellPadding));
htmltree.addAttr(HtmlAttr.CELLSPACING, Integer.toString(cellSpacing));
htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
return htmltree;
} | java | public static HtmlTree TABLE(HtmlStyle styleClass, int border, int cellPadding,
int cellSpacing, String summary, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
htmltree.addAttr(HtmlAttr.CELLPADDING, Integer.toString(cellPadding));
htmltree.addAttr(HtmlAttr.CELLSPACING, Integer.toString(cellSpacing));
htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"TABLE",
"(",
"HtmlStyle",
"styleClass",
",",
"int",
"border",
",",
"int",
"cellPadding",
",",
"int",
"cellSpacing",
",",
"String",
"summary",
",",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"... | Generates a Table tag with style class, border, cell padding,
cellspacing and summary attributes and some content.
@param styleClass style of the table
@param border border for the table
@param cellPadding cell padding for the table
@param cellSpacing cell spacing for the table
@param summary summary for the table
@param body content for the table
@return an HtmlTree object for the TABLE tag | [
"Generates",
"a",
"Table",
"tag",
"with",
"style",
"class",
"border",
"cell",
"padding",
"cellspacing",
"and",
"summary",
"attributes",
"and",
"some",
"content",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L638-L648 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/annotation/AnnotationValue.java | AnnotationValue.getRequiredValue | public @Nonnull final <T> T getRequiredValue(String member, Class<T> type) {
return get(member, ConversionContext.of(type)).orElseThrow(() -> new IllegalStateException("No value available for annotation member @" + annotationName + "[" + member + "] of type: " + type));
} | java | public @Nonnull final <T> T getRequiredValue(String member, Class<T> type) {
return get(member, ConversionContext.of(type)).orElseThrow(() -> new IllegalStateException("No value available for annotation member @" + annotationName + "[" + member + "] of type: " + type));
} | [
"public",
"@",
"Nonnull",
"final",
"<",
"T",
">",
"T",
"getRequiredValue",
"(",
"String",
"member",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"get",
"(",
"member",
",",
"ConversionContext",
".",
"of",
"(",
"type",
")",
")",
".",
"orEls... | Get the value of the {@code value} member of the annotation.
@param member The member
@param type The type
@param <T> The type
@throws IllegalStateException If no member is available that conforms to the given name and type
@return The result | [
"Get",
"the",
"value",
"of",
"the",
"{",
"@code",
"value",
"}",
"member",
"of",
"the",
"annotation",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/annotation/AnnotationValue.java#L223-L225 |
mnlipp/jgrapes | org.jgrapes.io/src/org/jgrapes/net/TcpConnector.java | TcpConnector.onOpenConnection | @Handler
public void onOpenConnection(OpenTcpConnection event) {
try {
SocketChannel socketChannel = SocketChannel.open(event.address());
channels.add(new TcpChannelImpl(socketChannel));
} catch (ConnectException e) {
fire(new ConnectError(event, "Connection refused.", e));
} catch (IOException e) {
fire(new ConnectError(event, "Failed to open TCP connection.", e));
}
} | java | @Handler
public void onOpenConnection(OpenTcpConnection event) {
try {
SocketChannel socketChannel = SocketChannel.open(event.address());
channels.add(new TcpChannelImpl(socketChannel));
} catch (ConnectException e) {
fire(new ConnectError(event, "Connection refused.", e));
} catch (IOException e) {
fire(new ConnectError(event, "Failed to open TCP connection.", e));
}
} | [
"@",
"Handler",
"public",
"void",
"onOpenConnection",
"(",
"OpenTcpConnection",
"event",
")",
"{",
"try",
"{",
"SocketChannel",
"socketChannel",
"=",
"SocketChannel",
".",
"open",
"(",
"event",
".",
"address",
"(",
")",
")",
";",
"channels",
".",
"add",
"(",... | Opens a connection to the end point specified in the event.
@param event the event | [
"Opens",
"a",
"connection",
"to",
"the",
"end",
"point",
"specified",
"in",
"the",
"event",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/net/TcpConnector.java#L85-L95 |
abel533/EasyXls | src/main/java/com/github/abel533/easyxls/EasyXls.java | EasyXls.list2Xls | public static boolean list2Xls(ExcelConfig config, List<?> list, String filePath, String fileName) throws Exception {
return XlsUtil.list2Xls(config, list, filePath, fileName);
} | java | public static boolean list2Xls(ExcelConfig config, List<?> list, String filePath, String fileName) throws Exception {
return XlsUtil.list2Xls(config, list, filePath, fileName);
} | [
"public",
"static",
"boolean",
"list2Xls",
"(",
"ExcelConfig",
"config",
",",
"List",
"<",
"?",
">",
"list",
",",
"String",
"filePath",
",",
"String",
"fileName",
")",
"throws",
"Exception",
"{",
"return",
"XlsUtil",
".",
"list2Xls",
"(",
"config",
",",
"l... | 导出list对象到excel
@param config 配置
@param list 导出的list
@param filePath 保存xls路径
@param fileName 保存xls文件名
@return 处理结果,true成功,false失败
@throws Exception | [
"导出list对象到excel"
] | train | https://github.com/abel533/EasyXls/blob/f73be23745c2180d7c0b8f0a510e72e61cc37d5d/src/main/java/com/github/abel533/easyxls/EasyXls.java#L96-L98 |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java | FineUploaderBasic.addParams | @Nonnull
public FineUploaderBasic addParams (@Nullable final Map <String, String> aParams)
{
m_aRequestParams.addAll (aParams);
return this;
} | java | @Nonnull
public FineUploaderBasic addParams (@Nullable final Map <String, String> aParams)
{
m_aRequestParams.addAll (aParams);
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploaderBasic",
"addParams",
"(",
"@",
"Nullable",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"aParams",
")",
"{",
"m_aRequestParams",
".",
"addAll",
"(",
"aParams",
")",
";",
"return",
"this",
";",
"}"
] | These parameters are sent with the request to the endpoint specified in the
action option.
@param aParams
New parameters to be added.
@return this | [
"These",
"parameters",
"are",
"sent",
"with",
"the",
"request",
"to",
"the",
"endpoint",
"specified",
"in",
"the",
"action",
"option",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java#L182-L187 |
unbescape/unbescape | src/main/java/org/unbescape/xml/XmlEscape.java | XmlEscape.unescapeXml | public static void unescapeXml(final String text, final Writer writer)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (text == null) {
return;
}
if (text.indexOf('&') < 0) {
// Fail fast, avoid more complex (and less JIT-table) method to execute if not needed
writer.write(text);
return;
}
// The chosen symbols (1.0 or 1.1) don't really matter, as both contain the same CERs
XmlEscapeUtil.unescape(new InternalStringReader(text), writer, XmlEscapeSymbols.XML11_SYMBOLS);
} | java | public static void unescapeXml(final String text, final Writer writer)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (text == null) {
return;
}
if (text.indexOf('&') < 0) {
// Fail fast, avoid more complex (and less JIT-table) method to execute if not needed
writer.write(text);
return;
}
// The chosen symbols (1.0 or 1.1) don't really matter, as both contain the same CERs
XmlEscapeUtil.unescape(new InternalStringReader(text), writer, XmlEscapeSymbols.XML11_SYMBOLS);
} | [
"public",
"static",
"void",
"unescapeXml",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'writer' can... | <p>
Perform an XML <strong>unescape</strong> operation on a <tt>String</tt> input,
writing results to a <tt>Writer</tt>.
</p>
<p>
No additional configuration arguments are required. Unescape operations
will always perform <em>complete</em> XML 1.0/1.1 unescape of CERs, decimal
and hexadecimal references.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"an",
"XML",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L2348-L2366 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.expectMatch | public void expectMatch(String name, String anotherName) {
expectMatch(name, anotherName, messages.get(Validation.MATCH_KEY.name(), name, anotherName));
} | java | public void expectMatch(String name, String anotherName) {
expectMatch(name, anotherName, messages.get(Validation.MATCH_KEY.name(), name, anotherName));
} | [
"public",
"void",
"expectMatch",
"(",
"String",
"name",
",",
"String",
"anotherName",
")",
"{",
"expectMatch",
"(",
"name",
",",
"anotherName",
",",
"messages",
".",
"get",
"(",
"Validation",
".",
"MATCH_KEY",
".",
"name",
"(",
")",
",",
"name",
",",
"an... | Validates to fields to (case-insensitive) match
@param name The field to check
@param anotherName The field to check against | [
"Validates",
"to",
"fields",
"to",
"(",
"case",
"-",
"insensitive",
")",
"match"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L197-L199 |
mozilla/rhino | toolsrc/org/mozilla/javascript/tools/debugger/Main.java | Main.mainEmbedded | public static Main mainEmbedded(ContextFactory factory,
Scriptable scope,
String title) {
return mainEmbeddedImpl(factory, scope, title);
} | java | public static Main mainEmbedded(ContextFactory factory,
Scriptable scope,
String title) {
return mainEmbeddedImpl(factory, scope, title);
} | [
"public",
"static",
"Main",
"mainEmbedded",
"(",
"ContextFactory",
"factory",
",",
"Scriptable",
"scope",
",",
"String",
"title",
")",
"{",
"return",
"mainEmbeddedImpl",
"(",
"factory",
",",
"scope",
",",
"title",
")",
";",
"}"
] | Entry point for embedded applications. This method attaches
to the given {@link ContextFactory} with the given scope. No
I/O redirection is performed as with {@link #main(String[])}. | [
"Entry",
"point",
"for",
"embedded",
"applications",
".",
"This",
"method",
"attaches",
"to",
"the",
"given",
"{"
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/debugger/Main.java#L251-L255 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionComputer.java | MapTileCollisionComputer.computeCollision | private CollisionResult computeCollision(CollisionCategory category, double ox, double oy, double x, double y)
{
final Tile tile = map.getTileAt(getPositionToSide(ox, x), getPositionToSide(oy, y));
if (tile != null)
{
final TileCollision tileCollision = tile.getFeature(TileCollision.class);
if (containsCollisionFormula(tileCollision, category))
{
final Double cx = getCollisionX(category, tileCollision, x, y);
final Double cy = getCollisionY(category, tileCollision, x, y);
// CHECKSTYLE IGNORE LINE: NestedIfDepth
if (cx != null || cy != null)
{
return new CollisionResult(cx, cy, tile);
}
}
}
return null;
} | java | private CollisionResult computeCollision(CollisionCategory category, double ox, double oy, double x, double y)
{
final Tile tile = map.getTileAt(getPositionToSide(ox, x), getPositionToSide(oy, y));
if (tile != null)
{
final TileCollision tileCollision = tile.getFeature(TileCollision.class);
if (containsCollisionFormula(tileCollision, category))
{
final Double cx = getCollisionX(category, tileCollision, x, y);
final Double cy = getCollisionY(category, tileCollision, x, y);
// CHECKSTYLE IGNORE LINE: NestedIfDepth
if (cx != null || cy != null)
{
return new CollisionResult(cx, cy, tile);
}
}
}
return null;
} | [
"private",
"CollisionResult",
"computeCollision",
"(",
"CollisionCategory",
"category",
",",
"double",
"ox",
",",
"double",
"oy",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"final",
"Tile",
"tile",
"=",
"map",
".",
"getTileAt",
"(",
"getPositionToSide",... | Compute the collision from current location.
@param category The collision category.
@param ox The current horizontal location.
@param oy The current vertical location.
@param x The current horizontal location.
@param y The current vertical location.
@return The computed collision result, <code>null</code> if none. | [
"Compute",
"the",
"collision",
"from",
"current",
"location",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionComputer.java#L271-L289 |
Dynatrace/OneAgent-SDK-for-Java | samples/webrequest/src/main/java/com/dynatrace/oneagent/sdk/samples/webrequest/FakedWebserver.java | FakedWebserver.serve | private void serve(HttpRequest request, HttpResponse response) {
String url = request.getUri();
System.out.println("[Server] serve " + url);
IncomingWebRequestTracer incomingWebrequestTracer = oneAgentSDK.traceIncomingWebRequest(webAppInfo, url, request.getMethod());
// add request header, parameter and remote address before start:
for (Entry<String, List<String>> headerField : request.getHeaders().entrySet()) {
for (String value : headerField.getValue()) {
incomingWebrequestTracer.addRequestHeader(headerField.getKey(), value);
}
}
for (Entry<String, List<String>> parameter : request.getParameters().entrySet()) {
for (String value : parameter.getValue()) {
incomingWebrequestTracer.addParameter(parameter.getKey(), value);
}
}
incomingWebrequestTracer.setRemoteAddress(request.getRemoteIpAddress());
incomingWebrequestTracer.start();
try {
response.setContent("Hello world!".getBytes());
response.setStatusCode(200);
incomingWebrequestTracer.setStatusCode(200);
} catch (Exception e) {
// we assume, container is sending http 500 in case of exception is thrown while serving an request:
incomingWebrequestTracer.error(e);
e.printStackTrace();
throw new RuntimeException(e);
} finally {
incomingWebrequestTracer.end();
}
} | java | private void serve(HttpRequest request, HttpResponse response) {
String url = request.getUri();
System.out.println("[Server] serve " + url);
IncomingWebRequestTracer incomingWebrequestTracer = oneAgentSDK.traceIncomingWebRequest(webAppInfo, url, request.getMethod());
// add request header, parameter and remote address before start:
for (Entry<String, List<String>> headerField : request.getHeaders().entrySet()) {
for (String value : headerField.getValue()) {
incomingWebrequestTracer.addRequestHeader(headerField.getKey(), value);
}
}
for (Entry<String, List<String>> parameter : request.getParameters().entrySet()) {
for (String value : parameter.getValue()) {
incomingWebrequestTracer.addParameter(parameter.getKey(), value);
}
}
incomingWebrequestTracer.setRemoteAddress(request.getRemoteIpAddress());
incomingWebrequestTracer.start();
try {
response.setContent("Hello world!".getBytes());
response.setStatusCode(200);
incomingWebrequestTracer.setStatusCode(200);
} catch (Exception e) {
// we assume, container is sending http 500 in case of exception is thrown while serving an request:
incomingWebrequestTracer.error(e);
e.printStackTrace();
throw new RuntimeException(e);
} finally {
incomingWebrequestTracer.end();
}
} | [
"private",
"void",
"serve",
"(",
"HttpRequest",
"request",
",",
"HttpResponse",
"response",
")",
"{",
"String",
"url",
"=",
"request",
".",
"getUri",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"[Server] serve \"",
"+",
"url",
")",
";",
"... | faked http request handling. shows usage of OneAgent SDK's incoming webrequest API | [
"faked",
"http",
"request",
"handling",
".",
"shows",
"usage",
"of",
"OneAgent",
"SDK",
"s",
"incoming",
"webrequest",
"API"
] | train | https://github.com/Dynatrace/OneAgent-SDK-for-Java/blob/a554cd971179faf8e598dd93df342a603d39e734/samples/webrequest/src/main/java/com/dynatrace/oneagent/sdk/samples/webrequest/FakedWebserver.java#L110-L141 |
mgm-tp/jfunk | jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java | MathRandom.getLong | public long getLong(final long min, final long max) {
return min(min, max) + getLong(abs(max - min));
} | java | public long getLong(final long min, final long max) {
return min(min, max) + getLong(abs(max - min));
} | [
"public",
"long",
"getLong",
"(",
"final",
"long",
"min",
",",
"final",
"long",
"max",
")",
"{",
"return",
"min",
"(",
"min",
",",
"max",
")",
"+",
"getLong",
"(",
"abs",
"(",
"max",
"-",
"min",
")",
")",
";",
"}"
] | Returns a random integer number in the range of [min, max].
@param min
minimum value for generated number
@param max
maximum value for generated number | [
"Returns",
"a",
"random",
"integer",
"number",
"in",
"the",
"range",
"of",
"[",
"min",
"max",
"]",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java#L141-L143 |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/internal/ExternalSessionKey.java | ExternalSessionKey.fromResponseBody | public static ExternalSessionKey fromResponseBody(String responseBody) throws NewSessionException {
if (responseBody != null && responseBody.startsWith("OK,")) {
return new ExternalSessionKey(responseBody.replace("OK,", ""));
}
throw new NewSessionException("The server returned an error : "+responseBody);
} | java | public static ExternalSessionKey fromResponseBody(String responseBody) throws NewSessionException {
if (responseBody != null && responseBody.startsWith("OK,")) {
return new ExternalSessionKey(responseBody.replace("OK,", ""));
}
throw new NewSessionException("The server returned an error : "+responseBody);
} | [
"public",
"static",
"ExternalSessionKey",
"fromResponseBody",
"(",
"String",
"responseBody",
")",
"throws",
"NewSessionException",
"{",
"if",
"(",
"responseBody",
"!=",
"null",
"&&",
"responseBody",
".",
"startsWith",
"(",
"\"OK,\"",
")",
")",
"{",
"return",
"new"... | extract the external key from the server response for a selenium1 new session request.
@param responseBody the response from the server
@return the ExternalKey if it was present in the server's response.
@throws NewSessionException in case the server didn't send back a success result. | [
"extract",
"the",
"external",
"key",
"from",
"the",
"server",
"response",
"for",
"a",
"selenium1",
"new",
"session",
"request",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/ExternalSessionKey.java#L130-L135 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/BranchingReaderSource.java | BranchingReaderSource.startBranch | public void startBranch(TextBuffer tb, int startOffset,
boolean convertLFs)
{
mBranchBuffer = tb;
mBranchStartOffset = startOffset;
mConvertLFs = convertLFs;
mGotCR = false;
} | java | public void startBranch(TextBuffer tb, int startOffset,
boolean convertLFs)
{
mBranchBuffer = tb;
mBranchStartOffset = startOffset;
mConvertLFs = convertLFs;
mGotCR = false;
} | [
"public",
"void",
"startBranch",
"(",
"TextBuffer",
"tb",
",",
"int",
"startOffset",
",",
"boolean",
"convertLFs",
")",
"{",
"mBranchBuffer",
"=",
"tb",
";",
"mBranchStartOffset",
"=",
"startOffset",
";",
"mConvertLFs",
"=",
"convertLFs",
";",
"mGotCR",
"=",
"... | /*
////////////////////////////////////////////////
Branching methods; used mostly to make a copy
of parsed internal subsets.
//////////////////////////////////////////////// | [
"/",
"*",
"////////////////////////////////////////////////",
"Branching",
"methods",
";",
"used",
"mostly",
"to",
"make",
"a",
"copy",
"of",
"parsed",
"internal",
"subsets",
".",
"////////////////////////////////////////////////"
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/BranchingReaderSource.java#L85-L92 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java | XmlStringTools.appendClosingTag | public static StringBuffer appendClosingTag(StringBuffer buffer, String tag)
{
StringBuffer _buffer = initStringBufferIfNecessary(buffer);
return doAppendClosingTag(_buffer, tag);
} | java | public static StringBuffer appendClosingTag(StringBuffer buffer, String tag)
{
StringBuffer _buffer = initStringBufferIfNecessary(buffer);
return doAppendClosingTag(_buffer, tag);
} | [
"public",
"static",
"StringBuffer",
"appendClosingTag",
"(",
"StringBuffer",
"buffer",
",",
"String",
"tag",
")",
"{",
"StringBuffer",
"_buffer",
"=",
"initStringBufferIfNecessary",
"(",
"buffer",
")",
";",
"return",
"doAppendClosingTag",
"(",
"_buffer",
",",
"tag",... | Add a closing tag to a StringBuffer.
If the buffer is null, a new one is created.
@param buffer
StringBuffer to fill
@param tag
the tag to close
@return the buffer | [
"Add",
"a",
"closing",
"tag",
"to",
"a",
"StringBuffer",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L318-L322 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/datatypes/SyntaxDE.java | SyntaxDE.initData | private void initData(String x, int minsize, int maxsize) {
content = null;
setContent(x, minsize, maxsize);
} | java | private void initData(String x, int minsize, int maxsize) {
content = null;
setContent(x, minsize, maxsize);
} | [
"private",
"void",
"initData",
"(",
"String",
"x",
",",
"int",
"minsize",
",",
"int",
"maxsize",
")",
"{",
"content",
"=",
"null",
";",
"setContent",
"(",
"x",
",",
"minsize",
",",
"maxsize",
")",
";",
"}"
] | < @internal @brief contains the value of the DE in human readable format | [
"<"
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/datatypes/SyntaxDE.java#L158-L161 |
sniffy/sniffy | sniffy-core/src/main/java/io/sniffy/LegacySpy.java | LegacySpy.expectAtLeast | @Deprecated
public C expectAtLeast(int allowedStatements, Query query) {
return expect(SqlQueries.minQueries(allowedStatements).type(adapter(query)));
} | java | @Deprecated
public C expectAtLeast(int allowedStatements, Query query) {
return expect(SqlQueries.minQueries(allowedStatements).type(adapter(query)));
} | [
"@",
"Deprecated",
"public",
"C",
"expectAtLeast",
"(",
"int",
"allowedStatements",
",",
"Query",
"query",
")",
"{",
"return",
"expect",
"(",
"SqlQueries",
".",
"minQueries",
"(",
"allowedStatements",
")",
".",
"type",
"(",
"adapter",
"(",
"query",
")",
")",... | Alias for {@link #expectBetween(int, int, Threads, Query)} with arguments {@code allowedStatements}, {@link Integer#MAX_VALUE}, {@link Threads#CURRENT}, {@code queryType}
@since 2.2 | [
"Alias",
"for",
"{"
] | train | https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L512-L515 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java | MP3FileID3Controller.setFrameData | public void setFrameData(String id, byte[] data)
{
if (allow(ID3V2))
{
id3v2.updateFrameData(id, data);
}
} | java | public void setFrameData(String id, byte[] data)
{
if (allow(ID3V2))
{
id3v2.updateFrameData(id, data);
}
} | [
"public",
"void",
"setFrameData",
"(",
"String",
"id",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"allow",
"(",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"updateFrameData",
"(",
"id",
",",
"data",
")",
";",
"}",
"}"
] | Set the data of the frame specified by the id (id3v2 only). The id
should be one of the static strings specified in ID3v2Frames class.
@param id the id of the frame to set the data for
@param data the data to set | [
"Set",
"the",
"data",
"of",
"the",
"frame",
"specified",
"by",
"the",
"id",
"(",
"id3v2",
"only",
")",
".",
"The",
"id",
"should",
"be",
"one",
"of",
"the",
"static",
"strings",
"specified",
"in",
"ID3v2Frames",
"class",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L379-L385 |
jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java | FhirContext.getResourceDefinition | public RuntimeResourceDefinition getResourceDefinition(String theResourceName) throws DataFormatException {
validateInitialized();
Validate.notBlank(theResourceName, "theResourceName must not be blank");
String resourceName = theResourceName.toLowerCase();
RuntimeResourceDefinition retVal = myNameToResourceDefinition.get(resourceName);
if (retVal == null) {
Class<? extends IBaseResource> clazz = myNameToResourceType.get(resourceName.toLowerCase());
if (clazz == null) {
// ***********************************************************************
// Multiple spots in HAPI FHIR and Smile CDR depend on DataFormatException
// being thrown by this method, don't change that.
// ***********************************************************************
throw new DataFormatException(createUnknownResourceNameError(theResourceName, myVersion.getVersion()));
}
if (IBaseResource.class.isAssignableFrom(clazz)) {
retVal = scanResourceType(clazz);
}
}
return retVal;
} | java | public RuntimeResourceDefinition getResourceDefinition(String theResourceName) throws DataFormatException {
validateInitialized();
Validate.notBlank(theResourceName, "theResourceName must not be blank");
String resourceName = theResourceName.toLowerCase();
RuntimeResourceDefinition retVal = myNameToResourceDefinition.get(resourceName);
if (retVal == null) {
Class<? extends IBaseResource> clazz = myNameToResourceType.get(resourceName.toLowerCase());
if (clazz == null) {
// ***********************************************************************
// Multiple spots in HAPI FHIR and Smile CDR depend on DataFormatException
// being thrown by this method, don't change that.
// ***********************************************************************
throw new DataFormatException(createUnknownResourceNameError(theResourceName, myVersion.getVersion()));
}
if (IBaseResource.class.isAssignableFrom(clazz)) {
retVal = scanResourceType(clazz);
}
}
return retVal;
} | [
"public",
"RuntimeResourceDefinition",
"getResourceDefinition",
"(",
"String",
"theResourceName",
")",
"throws",
"DataFormatException",
"{",
"validateInitialized",
"(",
")",
";",
"Validate",
".",
"notBlank",
"(",
"theResourceName",
",",
"\"theResourceName must not be blank\""... | Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed
for extending the core library.
<p>
Note that this method is case insensitive!
</p>
@throws DataFormatException If the resource name is not known | [
"Returns",
"the",
"scanned",
"runtime",
"model",
"for",
"the",
"given",
"type",
".",
"This",
"is",
"an",
"advanced",
"feature",
"which",
"is",
"generally",
"only",
"needed",
"for",
"extending",
"the",
"core",
"library",
".",
"<p",
">",
"Note",
"that",
"thi... | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java#L445-L467 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java | JMapperCache.getMapper | public static <D,S> IJMapper<D, S> getMapper(final Class<D> destination,final Class<S> source,final ChooseConfig chooseConfig) {
return getMapper(destination,source,chooseConfig,undefinedXML());
} | java | public static <D,S> IJMapper<D, S> getMapper(final Class<D> destination,final Class<S> source,final ChooseConfig chooseConfig) {
return getMapper(destination,source,chooseConfig,undefinedXML());
} | [
"public",
"static",
"<",
"D",
",",
"S",
">",
"IJMapper",
"<",
"D",
",",
"S",
">",
"getMapper",
"(",
"final",
"Class",
"<",
"D",
">",
"destination",
",",
"final",
"Class",
"<",
"S",
">",
"source",
",",
"final",
"ChooseConfig",
"chooseConfig",
")",
"{"... | Returns an instance of JMapper from cache if exists, in alternative a new instance.
<br>The configuration evaluated is the one received in input.
@param destination the Destination Class
@param source the Source Class
@param chooseConfig the configuration to load
@param <D> Destination class
@param <S> Source Class
@return the mapper instance | [
"Returns",
"an",
"instance",
"of",
"JMapper",
"from",
"cache",
"if",
"exists",
"in",
"alternative",
"a",
"new",
"instance",
".",
"<br",
">",
"The",
"configuration",
"evaluated",
"is",
"the",
"one",
"received",
"in",
"input",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java#L73-L75 |
leancloud/java-sdk-all | android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/pay/GetProductDetailsApi.java | GetProductDetailsApi.onConnect | @Override
public void onConnect(int rst, HuaweiApiClient client) {
HMSAgentLog.d("onConnect:" + rst);
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onProductDetailResult(rst, null);
return;
}
// 调用HMS-SDK getOrderDetail 接口
PendingResult<ProductDetailResult> checkPayResult = HuaweiPay.HuaweiPayApi.getProductDetails(client, productDetailReq);
checkPayResult.setResultCallback(new ResultCallback<ProductDetailResult>() {
@Override
public void onResult(ProductDetailResult result) {
if (result == null) {
HMSAgentLog.e("result is null");
onProductDetailResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
return;
}
Status status = result.getStatus();
if (status == null) {
HMSAgentLog.e("status is null");
onProductDetailResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
return;
}
int rstCode = status.getStatusCode();
HMSAgentLog.d("status=" + status);
// 需要重试的错误码,并且可以重试
if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
|| rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
retryTimes--;
connect();
} else {
onProductDetailResult(rstCode, result);
}
}
});
} | java | @Override
public void onConnect(int rst, HuaweiApiClient client) {
HMSAgentLog.d("onConnect:" + rst);
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onProductDetailResult(rst, null);
return;
}
// 调用HMS-SDK getOrderDetail 接口
PendingResult<ProductDetailResult> checkPayResult = HuaweiPay.HuaweiPayApi.getProductDetails(client, productDetailReq);
checkPayResult.setResultCallback(new ResultCallback<ProductDetailResult>() {
@Override
public void onResult(ProductDetailResult result) {
if (result == null) {
HMSAgentLog.e("result is null");
onProductDetailResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
return;
}
Status status = result.getStatus();
if (status == null) {
HMSAgentLog.e("status is null");
onProductDetailResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
return;
}
int rstCode = status.getStatusCode();
HMSAgentLog.d("status=" + status);
// 需要重试的错误码,并且可以重试
if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
|| rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
retryTimes--;
connect();
} else {
onProductDetailResult(rstCode, result);
}
}
});
} | [
"@",
"Override",
"public",
"void",
"onConnect",
"(",
"int",
"rst",
",",
"HuaweiApiClient",
"client",
")",
"{",
"HMSAgentLog",
".",
"d",
"(",
"\"onConnect:\"",
"+",
"rst",
")",
";",
"if",
"(",
"client",
"==",
"null",
"||",
"!",
"ApiClientMgr",
".",
"INST"... | Huawei Api Client 连接回调
@param rst 结果码
@param client HuaweiApiClient 实例 | [
"Huawei",
"Api",
"Client",
"连接回调"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/pay/GetProductDetailsApi.java#L52-L94 |
virgo47/javasimon | core/src/main/java/org/javasimon/utils/SystemDebugCallback.java | SystemDebugCallback.onManagerWarning | @Override
public void onManagerWarning(String warning, Exception cause) {
if (warning != null) {
System.err.println(DEBUG_PREFIX + "Simon warning: " + warning);
}
if (cause != null) {
System.err.print(DEBUG_PREFIX);
cause.printStackTrace();
}
} | java | @Override
public void onManagerWarning(String warning, Exception cause) {
if (warning != null) {
System.err.println(DEBUG_PREFIX + "Simon warning: " + warning);
}
if (cause != null) {
System.err.print(DEBUG_PREFIX);
cause.printStackTrace();
}
} | [
"@",
"Override",
"public",
"void",
"onManagerWarning",
"(",
"String",
"warning",
",",
"Exception",
"cause",
")",
"{",
"if",
"(",
"warning",
"!=",
"null",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"DEBUG_PREFIX",
"+",
"\"Simon warning: \"",
"+",
... | Warning and stack trace are print out to the error output. Either cause or warning
(or both) should be provided otherwise the method does nothing.
<p/>
{@inheritDoc} | [
"Warning",
"and",
"stack",
"trace",
"are",
"print",
"out",
"to",
"the",
"error",
"output",
".",
"Either",
"cause",
"or",
"warning",
"(",
"or",
"both",
")",
"should",
"be",
"provided",
"otherwise",
"the",
"method",
"does",
"nothing",
".",
"<p",
"/",
">",
... | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SystemDebugCallback.java#L79-L88 |
cdapio/tigon | tigon-flow/src/main/java/co/cask/tigon/internal/app/SchemaFinder.java | SchemaFinder.checkSchema | public static boolean checkSchema(Set<Schema> output, Set<Schema> input) {
return findSchema(output, input) != null;
} | java | public static boolean checkSchema(Set<Schema> output, Set<Schema> input) {
return findSchema(output, input) != null;
} | [
"public",
"static",
"boolean",
"checkSchema",
"(",
"Set",
"<",
"Schema",
">",
"output",
",",
"Set",
"<",
"Schema",
">",
"input",
")",
"{",
"return",
"findSchema",
"(",
"output",
",",
"input",
")",
"!=",
"null",
";",
"}"
] | Given two schema's checks if there exists compatibility or equality.
@param output Set of output {@link Schema}.
@param input Set of input {@link Schema}.
@return true if and only if they are equal or compatible with constraints | [
"Given",
"two",
"schema",
"s",
"checks",
"if",
"there",
"exists",
"compatibility",
"or",
"equality",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/SchemaFinder.java#L37-L39 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/Pattern.java | Pattern.sequence | public static Pattern sequence(Pattern pattern1, Pattern pattern2)
{
if (pattern1 == null || pattern2 == null)
{
throw new IllegalArgumentException("Neither pattern can be null");
}
return new SequencePattern(pattern1, pattern2);
} | java | public static Pattern sequence(Pattern pattern1, Pattern pattern2)
{
if (pattern1 == null || pattern2 == null)
{
throw new IllegalArgumentException("Neither pattern can be null");
}
return new SequencePattern(pattern1, pattern2);
} | [
"public",
"static",
"Pattern",
"sequence",
"(",
"Pattern",
"pattern1",
",",
"Pattern",
"pattern2",
")",
"{",
"if",
"(",
"pattern1",
"==",
"null",
"||",
"pattern2",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Neither pattern can be... | A pattern which matches <code>pattern1</code> followed by <code>pattern2</code>.
@param pattern1
@param pattern2
@return | [
"A",
"pattern",
"which",
"matches",
"<code",
">",
"pattern1<",
"/",
"code",
">",
"followed",
"by",
"<code",
">",
"pattern2<",
"/",
"code",
">",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/Pattern.java#L178-L185 |
trellis-ldp-archive/trellis-constraint-rules | src/main/java/org/trellisldp/constraint/LdpConstraints.java | LdpConstraints.hasMembershipProps | private static Boolean hasMembershipProps(final Map<IRI, Long> data) {
return data.containsKey(LDP.membershipResource) &&
data.getOrDefault(LDP.hasMemberRelation, 0L) + data.getOrDefault(LDP.isMemberOfRelation, 0L) == 1L;
} | java | private static Boolean hasMembershipProps(final Map<IRI, Long> data) {
return data.containsKey(LDP.membershipResource) &&
data.getOrDefault(LDP.hasMemberRelation, 0L) + data.getOrDefault(LDP.isMemberOfRelation, 0L) == 1L;
} | [
"private",
"static",
"Boolean",
"hasMembershipProps",
"(",
"final",
"Map",
"<",
"IRI",
",",
"Long",
">",
"data",
")",
"{",
"return",
"data",
".",
"containsKey",
"(",
"LDP",
".",
"membershipResource",
")",
"&&",
"data",
".",
"getOrDefault",
"(",
"LDP",
".",... | Verify that ldp:membershipResource and one of ldp:hasMemberRelation or ldp:isMemberOfRelation is present | [
"Verify",
"that",
"ldp",
":",
"membershipResource",
"and",
"one",
"of",
"ldp",
":",
"hasMemberRelation",
"or",
"ldp",
":",
"isMemberOfRelation",
"is",
"present"
] | train | https://github.com/trellis-ldp-archive/trellis-constraint-rules/blob/e038f421da71a42591a69565575300f848271503/src/main/java/org/trellisldp/constraint/LdpConstraints.java#L117-L120 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale3x.java | RawScale3x.computeE3 | private static int computeE3(int a, int b, int d, int e, int g, int h)
{
if (d == b && e != g || d == h && e != a)
{
return d;
}
return e;
} | java | private static int computeE3(int a, int b, int d, int e, int g, int h)
{
if (d == b && e != g || d == h && e != a)
{
return d;
}
return e;
} | [
"private",
"static",
"int",
"computeE3",
"(",
"int",
"a",
",",
"int",
"b",
",",
"int",
"d",
",",
"int",
"e",
",",
"int",
"g",
",",
"int",
"h",
")",
"{",
"if",
"(",
"d",
"==",
"b",
"&&",
"e",
"!=",
"g",
"||",
"d",
"==",
"h",
"&&",
"e",
"!=... | Compute E3 pixel.
@param a The a value.
@param b The b value.
@param d The d value.
@param e The e value.
@param g The g value.
@param h The h value.
@return The computed value. | [
"Compute",
"E3",
"pixel",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/filter/RawScale3x.java#L93-L100 |
apache/groovy | src/main/groovy/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.registerBeanFactory | public void registerBeanFactory(String theName, String groupName, final Class beanClass) {
getProxyBuilder().registerFactory(theName, new AbstractFactory() {
public Object newInstance(FactoryBuilderSupport builder, Object name, Object value,
Map properties) throws InstantiationException, IllegalAccessException {
if (checkValueIsTypeNotString(value, name, beanClass)) {
return value;
} else {
return beanClass.newInstance();
}
}
});
getRegistrationGroup(groupName).add(theName);
} | java | public void registerBeanFactory(String theName, String groupName, final Class beanClass) {
getProxyBuilder().registerFactory(theName, new AbstractFactory() {
public Object newInstance(FactoryBuilderSupport builder, Object name, Object value,
Map properties) throws InstantiationException, IllegalAccessException {
if (checkValueIsTypeNotString(value, name, beanClass)) {
return value;
} else {
return beanClass.newInstance();
}
}
});
getRegistrationGroup(groupName).add(theName);
} | [
"public",
"void",
"registerBeanFactory",
"(",
"String",
"theName",
",",
"String",
"groupName",
",",
"final",
"Class",
"beanClass",
")",
"{",
"getProxyBuilder",
"(",
")",
".",
"registerFactory",
"(",
"theName",
",",
"new",
"AbstractFactory",
"(",
")",
"{",
"pub... | Registers a factory for a JavaBean.<br>
The JavaBean class should have a no-args constructor.
@param theName name of the node
@param groupName thr group to register this node in
@param beanClass the factory to handle the name | [
"Registers",
"a",
"factory",
"for",
"a",
"JavaBean",
".",
"<br",
">",
"The",
"JavaBean",
"class",
"should",
"have",
"a",
"no",
"-",
"args",
"constructor",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L659-L671 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java | JingleManager.isServiceEnabled | public static boolean isServiceEnabled(XMPPConnection connection, Jid userID) throws XMPPException, SmackException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, Jingle.NAMESPACE);
} | java | public static boolean isServiceEnabled(XMPPConnection connection, Jid userID) throws XMPPException, SmackException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, Jingle.NAMESPACE);
} | [
"public",
"static",
"boolean",
"isServiceEnabled",
"(",
"XMPPConnection",
"connection",
",",
"Jid",
"userID",
")",
"throws",
"XMPPException",
",",
"SmackException",
",",
"InterruptedException",
"{",
"return",
"ServiceDiscoveryManager",
".",
"getInstanceFor",
"(",
"conne... | Returns true if the specified user handles Jingle messages.
@param connection the connection to use to perform the service discovery
@param userID the user to check. A fully qualified xmpp ID, e.g.
jdoe@example.com
@return a boolean indicating whether the specified user handles Jingle
messages
@throws SmackException if there was no response from the server.
@throws XMPPException
@throws InterruptedException | [
"Returns",
"true",
"if",
"the",
"specified",
"user",
"handles",
"Jingle",
"messages",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java#L309-L311 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java | GeometryFactory.createMultiLineString | public MultiLineString createMultiLineString(LineString[] lineStrings) {
if (lineStrings == null) {
return new MultiLineString(srid, precision);
}
LineString[] clones = new LineString[lineStrings.length];
for (int i = 0; i < lineStrings.length; i++) {
clones[i] = (LineString) lineStrings[i].clone();
}
return new MultiLineString(srid, precision, clones);
} | java | public MultiLineString createMultiLineString(LineString[] lineStrings) {
if (lineStrings == null) {
return new MultiLineString(srid, precision);
}
LineString[] clones = new LineString[lineStrings.length];
for (int i = 0; i < lineStrings.length; i++) {
clones[i] = (LineString) lineStrings[i].clone();
}
return new MultiLineString(srid, precision, clones);
} | [
"public",
"MultiLineString",
"createMultiLineString",
"(",
"LineString",
"[",
"]",
"lineStrings",
")",
"{",
"if",
"(",
"lineStrings",
"==",
"null",
")",
"{",
"return",
"new",
"MultiLineString",
"(",
"srid",
",",
"precision",
")",
";",
"}",
"LineString",
"[",
... | Create a new {@link MultiLineString}, given an array of LineStrings.
@param lineStrings
An array of {@link LineString} objects.
@return Returns a {@link MultiLineString} object. | [
"Create",
"a",
"new",
"{",
"@link",
"MultiLineString",
"}",
"given",
"an",
"array",
"of",
"LineStrings",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java#L108-L117 |
spacecowboy/NoNonsense-FilePicker | sample/src/main/java/com/nononsenseapps/filepicker/sample/dropbox/DropboxFilePickerFragment.java | DropboxFilePickerFragment.onLoadFinished | @Override
public void onLoadFinished(Loader<SortedList<Metadata>> loader, SortedList<Metadata> data) {
progressBar.setVisibility(View.INVISIBLE);
recyclerView.setVisibility(View.VISIBLE);
super.onLoadFinished(loader, data);
} | java | @Override
public void onLoadFinished(Loader<SortedList<Metadata>> loader, SortedList<Metadata> data) {
progressBar.setVisibility(View.INVISIBLE);
recyclerView.setVisibility(View.VISIBLE);
super.onLoadFinished(loader, data);
} | [
"@",
"Override",
"public",
"void",
"onLoadFinished",
"(",
"Loader",
"<",
"SortedList",
"<",
"Metadata",
">",
">",
"loader",
",",
"SortedList",
"<",
"Metadata",
">",
"data",
")",
"{",
"progressBar",
".",
"setVisibility",
"(",
"View",
".",
"INVISIBLE",
")",
... | Once loading has finished, show the list and hide the progress bar. | [
"Once",
"loading",
"has",
"finished",
"show",
"the",
"list",
"and",
"hide",
"the",
"progress",
"bar",
"."
] | train | https://github.com/spacecowboy/NoNonsense-FilePicker/blob/396ef7fa5e87791170791f9d94c78f6e42a7679a/sample/src/main/java/com/nononsenseapps/filepicker/sample/dropbox/DropboxFilePickerFragment.java#L80-L85 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java | WebSiteManagementClientImpl.listGeoRegionsAsync | public Observable<Page<GeoRegionInner>> listGeoRegionsAsync(final SkuName sku, final Boolean linuxWorkersEnabled) {
return listGeoRegionsWithServiceResponseAsync(sku, linuxWorkersEnabled)
.map(new Func1<ServiceResponse<Page<GeoRegionInner>>, Page<GeoRegionInner>>() {
@Override
public Page<GeoRegionInner> call(ServiceResponse<Page<GeoRegionInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<GeoRegionInner>> listGeoRegionsAsync(final SkuName sku, final Boolean linuxWorkersEnabled) {
return listGeoRegionsWithServiceResponseAsync(sku, linuxWorkersEnabled)
.map(new Func1<ServiceResponse<Page<GeoRegionInner>>, Page<GeoRegionInner>>() {
@Override
public Page<GeoRegionInner> call(ServiceResponse<Page<GeoRegionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"GeoRegionInner",
">",
">",
"listGeoRegionsAsync",
"(",
"final",
"SkuName",
"sku",
",",
"final",
"Boolean",
"linuxWorkersEnabled",
")",
"{",
"return",
"listGeoRegionsWithServiceResponseAsync",
"(",
"sku",
",",
"linuxWorkersEna... | Get a list of available geographical regions.
Get a list of available geographical regions.
@param sku Name of SKU used to filter the regions. Possible values include: 'Free', 'Shared', 'Basic', 'Standard', 'Premium', 'Dynamic', 'Isolated', 'PremiumV2'
@param linuxWorkersEnabled Specify <code>true</code> if you want to filter to only regions that support Linux workers.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<GeoRegionInner> object | [
"Get",
"a",
"list",
"of",
"available",
"geographical",
"regions",
".",
"Get",
"a",
"list",
"of",
"available",
"geographical",
"regions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L1570-L1578 |
davidcarboni/cryptolite-java | src/main/java/com/github/davidcarboni/cryptolite/Password.java | Password.verify | public static boolean verify(String password, String hash) {
boolean result = false;
if (StringUtils.isNotBlank(hash) && password != null) {
// Get the salt and hash from the input string:
byte[] bytes = ByteArray.fromBase64(hash);
// Check the size of the value to ensure it's at least as long as
// the salt:
if (bytes.length >= Generate.SALT_BYTES) {
// Extract the salt and password hash:
String salt = getSalt(bytes);
byte[] existingHash = getHash(bytes);
// Hash the password with the same salt in order to get the same
// result:
byte[] comparisonHash = hash(password, salt);
// See whether they match:
result = Arrays.equals(existingHash, comparisonHash);
}
}
return result;
} | java | public static boolean verify(String password, String hash) {
boolean result = false;
if (StringUtils.isNotBlank(hash) && password != null) {
// Get the salt and hash from the input string:
byte[] bytes = ByteArray.fromBase64(hash);
// Check the size of the value to ensure it's at least as long as
// the salt:
if (bytes.length >= Generate.SALT_BYTES) {
// Extract the salt and password hash:
String salt = getSalt(bytes);
byte[] existingHash = getHash(bytes);
// Hash the password with the same salt in order to get the same
// result:
byte[] comparisonHash = hash(password, salt);
// See whether they match:
result = Arrays.equals(existingHash, comparisonHash);
}
}
return result;
} | [
"public",
"static",
"boolean",
"verify",
"(",
"String",
"password",
",",
"String",
"hash",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"hash",
")",
"&&",
"password",
"!=",
"null",
")",
"{",
"// Get ... | Verifies the given plaintext password against a value that
{@link #hash(String)} produced.
@param password A plaintext password. If this is null, false will be returned.
@param hash A value previously produced by {@link #hash(String)}. If this
is empty or shorter than expected, false will be returned.
@return If the password hashes to the same value as that contained in the
hash parameter, true. | [
"Verifies",
"the",
"given",
"plaintext",
"password",
"against",
"a",
"value",
"that",
"{",
"@link",
"#hash",
"(",
"String",
")",
"}",
"produced",
"."
] | train | https://github.com/davidcarboni/cryptolite-java/blob/e67954181a04ffc9beb1d9abca1421195fcf9764/src/main/java/com/github/davidcarboni/cryptolite/Password.java#L81-L107 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/TypeVariableUtils.java | TypeVariableUtils.trackRootVariables | public static Map<Class<?>, LinkedHashMap<String, Type>> trackRootVariables(final Class type) {
return trackRootVariables(type, null);
} | java | public static Map<Class<?>, LinkedHashMap<String, Type>> trackRootVariables(final Class type) {
return trackRootVariables(type, null);
} | [
"public",
"static",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"LinkedHashMap",
"<",
"String",
",",
"Type",
">",
">",
"trackRootVariables",
"(",
"final",
"Class",
"type",
")",
"{",
"return",
"trackRootVariables",
"(",
"type",
",",
"null",
")",
";",
"}"
] | Shortcut for {@link #trackRootVariables(Class, List)} to simplify usage without ignore classes.
@param type class to analyze
@return resolved generics for all types in class hierarchy with root variables preserved | [
"Shortcut",
"for",
"{",
"@link",
"#trackRootVariables",
"(",
"Class",
"List",
")",
"}",
"to",
"simplify",
"usage",
"without",
"ignore",
"classes",
"."
] | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeVariableUtils.java#L77-L79 |
hypercube1024/firefly | firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java | ScriptUtils.readScript | public static String readScript(LineNumberReader lineNumberReader, String commentPrefix, String separator)
throws IOException {
String currentStatement = lineNumberReader.readLine();
StringBuilder scriptBuilder = new StringBuilder();
while (currentStatement != null) {
if (commentPrefix != null && !currentStatement.startsWith(commentPrefix)) {
if (scriptBuilder.length() > 0) {
scriptBuilder.append('\n');
}
scriptBuilder.append(currentStatement);
}
currentStatement = lineNumberReader.readLine();
}
appendSeparatorToScriptIfNecessary(scriptBuilder, separator);
return scriptBuilder.toString();
} | java | public static String readScript(LineNumberReader lineNumberReader, String commentPrefix, String separator)
throws IOException {
String currentStatement = lineNumberReader.readLine();
StringBuilder scriptBuilder = new StringBuilder();
while (currentStatement != null) {
if (commentPrefix != null && !currentStatement.startsWith(commentPrefix)) {
if (scriptBuilder.length() > 0) {
scriptBuilder.append('\n');
}
scriptBuilder.append(currentStatement);
}
currentStatement = lineNumberReader.readLine();
}
appendSeparatorToScriptIfNecessary(scriptBuilder, separator);
return scriptBuilder.toString();
} | [
"public",
"static",
"String",
"readScript",
"(",
"LineNumberReader",
"lineNumberReader",
",",
"String",
"commentPrefix",
",",
"String",
"separator",
")",
"throws",
"IOException",
"{",
"String",
"currentStatement",
"=",
"lineNumberReader",
".",
"readLine",
"(",
")",
... | Read a script from the provided {@code LineNumberReader}, using the
supplied comment prefix and statement separator, and build a
{@code String} containing the lines.
<p>
Lines <em>beginning</em> with the comment prefix are excluded from the
results; however, line comments anywhere else — for example, within
a statement — will be included in the results.
@param lineNumberReader the {@code LineNumberReader} containing the script to be
processed
@param commentPrefix the prefix that identifies comments in the SQL script —
typically "--"
@param separator the statement separator in the SQL script — typically
";"
@return a {@code String} containing the script lines
@throws IOException in case of I/O errors | [
"Read",
"a",
"script",
"from",
"the",
"provided",
"{",
"@code",
"LineNumberReader",
"}",
"using",
"the",
"supplied",
"comment",
"prefix",
"and",
"statement",
"separator",
"and",
"build",
"a",
"{",
"@code",
"String",
"}",
"containing",
"the",
"lines",
".",
"<... | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java#L295-L311 |
apache/groovy | subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovydoc.java | Groovydoc.setPackagenames | public void setPackagenames(String packages) {
StringTokenizer tok = new StringTokenizer(packages, ",");
while (tok.hasMoreTokens()) {
String packageName = tok.nextToken();
packageNames.add(packageName);
}
} | java | public void setPackagenames(String packages) {
StringTokenizer tok = new StringTokenizer(packages, ",");
while (tok.hasMoreTokens()) {
String packageName = tok.nextToken();
packageNames.add(packageName);
}
} | [
"public",
"void",
"setPackagenames",
"(",
"String",
"packages",
")",
"{",
"StringTokenizer",
"tok",
"=",
"new",
"StringTokenizer",
"(",
"packages",
",",
"\",\"",
")",
";",
"while",
"(",
"tok",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"String",
"packageName"... | Set the package names to be processed.
@param packages a comma separated list of packages specs
(may be wildcarded). | [
"Set",
"the",
"package",
"names",
"to",
"be",
"processed",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovydoc.java#L183-L189 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/segment/SegmentServiceImpl.java | SegmentServiceImpl.readMetaContinuation | private boolean readMetaContinuation(ReadStream is, int crc)
throws IOException
{
long value = BitsUtil.readLong(is);
crc = Crc32Caucho.generate(crc, value);
int crcFile = BitsUtil.readInt(is);
if (crcFile != crc) {
log.fine("meta-segment crc mismatch");
return false;
}
long address = value & ~0xffff;
int length = (int) ((value & 0xffff) << 16);
if (length != _segmentMeta[0].size()) {
throw new IllegalStateException();
}
SegmentExtent extent = new SegmentExtent(0, address, length);
_metaExtents.add(extent);
_metaAddress = address;
_metaOffset = address;
_metaTail = address + length;
// false continues to the next segment
return false;
} | java | private boolean readMetaContinuation(ReadStream is, int crc)
throws IOException
{
long value = BitsUtil.readLong(is);
crc = Crc32Caucho.generate(crc, value);
int crcFile = BitsUtil.readInt(is);
if (crcFile != crc) {
log.fine("meta-segment crc mismatch");
return false;
}
long address = value & ~0xffff;
int length = (int) ((value & 0xffff) << 16);
if (length != _segmentMeta[0].size()) {
throw new IllegalStateException();
}
SegmentExtent extent = new SegmentExtent(0, address, length);
_metaExtents.add(extent);
_metaAddress = address;
_metaOffset = address;
_metaTail = address + length;
// false continues to the next segment
return false;
} | [
"private",
"boolean",
"readMetaContinuation",
"(",
"ReadStream",
"is",
",",
"int",
"crc",
")",
"throws",
"IOException",
"{",
"long",
"value",
"=",
"BitsUtil",
".",
"readLong",
"(",
"is",
")",
";",
"crc",
"=",
"Crc32Caucho",
".",
"generate",
"(",
"crc",
","... | Continuation segment for the metadata.
Additional segments when the table/segment metadata doesn't fit. | [
"Continuation",
"segment",
"for",
"the",
"metadata",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/segment/SegmentServiceImpl.java#L853-L884 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/AbstractConnectionAdapter.java | AbstractConnectionAdapter.getConnection | public final Connection getConnection(final String dataSourceName) throws SQLException {
return getConnections(ConnectionMode.MEMORY_STRICTLY, dataSourceName, 1).get(0);
} | java | public final Connection getConnection(final String dataSourceName) throws SQLException {
return getConnections(ConnectionMode.MEMORY_STRICTLY, dataSourceName, 1).get(0);
} | [
"public",
"final",
"Connection",
"getConnection",
"(",
"final",
"String",
"dataSourceName",
")",
"throws",
"SQLException",
"{",
"return",
"getConnections",
"(",
"ConnectionMode",
".",
"MEMORY_STRICTLY",
",",
"dataSourceName",
",",
"1",
")",
".",
"get",
"(",
"0",
... | Get database connection.
@param dataSourceName data source name
@return database connection
@throws SQLException SQL exception | [
"Get",
"database",
"connection",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/AbstractConnectionAdapter.java#L95-L97 |
mapbox/mapbox-navigation-android | libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMap.java | NavigationMapboxMap.saveStateWith | public void saveStateWith(String key, Bundle outState) {
settings.updateCurrentPadding(mapPaddingAdjustor.retrieveCurrentPadding());
settings.updateShouldUseDefaultPadding(mapPaddingAdjustor.isUsingDefault());
settings.updateCameraTrackingMode(mapCamera.getCameraTrackingMode());
settings.updateLocationFpsEnabled(locationFpsDelegate.isEnabled());
NavigationMapboxMapInstanceState instanceState = new NavigationMapboxMapInstanceState(settings);
outState.putParcelable(key, instanceState);
} | java | public void saveStateWith(String key, Bundle outState) {
settings.updateCurrentPadding(mapPaddingAdjustor.retrieveCurrentPadding());
settings.updateShouldUseDefaultPadding(mapPaddingAdjustor.isUsingDefault());
settings.updateCameraTrackingMode(mapCamera.getCameraTrackingMode());
settings.updateLocationFpsEnabled(locationFpsDelegate.isEnabled());
NavigationMapboxMapInstanceState instanceState = new NavigationMapboxMapInstanceState(settings);
outState.putParcelable(key, instanceState);
} | [
"public",
"void",
"saveStateWith",
"(",
"String",
"key",
",",
"Bundle",
"outState",
")",
"{",
"settings",
".",
"updateCurrentPadding",
"(",
"mapPaddingAdjustor",
".",
"retrieveCurrentPadding",
"(",
")",
")",
";",
"settings",
".",
"updateShouldUseDefaultPadding",
"("... | Can be used to store the current state of the map in
{@link android.support.v4.app.FragmentActivity#onSaveInstanceState(Bundle, PersistableBundle)}.
<p>
This method uses {@link NavigationMapboxMapInstanceState}, stored with the provided key. This key
can also later be used to extract the {@link NavigationMapboxMapInstanceState}.
@param key used to store the state
@param outState to store state variables | [
"Can",
"be",
"used",
"to",
"store",
"the",
"current",
"state",
"of",
"the",
"map",
"in",
"{",
"@link",
"android",
".",
"support",
".",
"v4",
".",
"app",
".",
"FragmentActivity#onSaveInstanceState",
"(",
"Bundle",
"PersistableBundle",
")",
"}",
".",
"<p",
"... | train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/map/NavigationMapboxMap.java#L295-L302 |
dbracewell/mango | src/main/java/com/davidbracewell/conversion/Val.java | Val.asMap | public <K, V> Map<K, V> asMap(@NonNull Class<?> mapClass, @NonNull Class<K> keyClass, @NonNull Class<V> valueClass) {
return convert(toConvert, mapClass, keyClass, valueClass);
} | java | public <K, V> Map<K, V> asMap(@NonNull Class<?> mapClass, @NonNull Class<K> keyClass, @NonNull Class<V> valueClass) {
return convert(toConvert, mapClass, keyClass, valueClass);
} | [
"public",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"asMap",
"(",
"@",
"NonNull",
"Class",
"<",
"?",
">",
"mapClass",
",",
"@",
"NonNull",
"Class",
"<",
"K",
">",
"keyClass",
",",
"@",
"NonNull",
"Class",
"<",
"V",
">",
"valueCla... | Converts the object to a map
@param <K> the type parameter
@param <V> the type parameter
@param mapClass The map class
@param keyClass The key class
@param valueClass The value class
@return the object as a map | [
"Converts",
"the",
"object",
"to",
"a",
"map"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/conversion/Val.java#L130-L132 |
networknt/light-4j | config/src/main/java/com/networknt/config/CentralizedManagement.java | CentralizedManagement.convertMapToObj | private static Object convertMapToObj(Map<String, Object> map, Class clazz) {
ObjectMapper mapper = new ObjectMapper();
Object obj = mapper.convertValue(map, clazz);
return obj;
} | java | private static Object convertMapToObj(Map<String, Object> map, Class clazz) {
ObjectMapper mapper = new ObjectMapper();
Object obj = mapper.convertValue(map, clazz);
return obj;
} | [
"private",
"static",
"Object",
"convertMapToObj",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"Class",
"clazz",
")",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"Object",
"obj",
"=",
"mapper",
".",
"convertValue... | Method used to convert map to object based on the reference class provided | [
"Method",
"used",
"to",
"convert",
"map",
"to",
"object",
"based",
"on",
"the",
"reference",
"class",
"provided"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/config/src/main/java/com/networknt/config/CentralizedManagement.java#L81-L85 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java | BooleanExpressionParser.evaluateExpressionStack | private static String evaluateExpressionStack(final Deque<String> operators, final Deque<String> values) {
while (!operators.isEmpty()) {
values.push(getBooleanResultAsString(operators.pop(), values.pop(), values.pop()));
}
return replaceIntegerStringByBooleanRepresentation(values.pop());
} | java | private static String evaluateExpressionStack(final Deque<String> operators, final Deque<String> values) {
while (!operators.isEmpty()) {
values.push(getBooleanResultAsString(operators.pop(), values.pop(), values.pop()));
}
return replaceIntegerStringByBooleanRepresentation(values.pop());
} | [
"private",
"static",
"String",
"evaluateExpressionStack",
"(",
"final",
"Deque",
"<",
"String",
">",
"operators",
",",
"final",
"Deque",
"<",
"String",
">",
"values",
")",
"{",
"while",
"(",
"!",
"operators",
".",
"isEmpty",
"(",
")",
")",
"{",
"values",
... | This method takes stacks of operators and values and evaluates possible expressions
This is done by popping one operator and two values, applying the operator to the values and pushing the result back onto the value stack
@param operators Operators to apply
@param values Values
@return The final result popped of the values stack | [
"This",
"method",
"takes",
"stacks",
"of",
"operators",
"and",
"values",
"and",
"evaluates",
"possible",
"expressions",
"This",
"is",
"done",
"by",
"popping",
"one",
"operator",
"and",
"two",
"values",
"applying",
"the",
"operator",
"to",
"the",
"values",
"and... | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L147-L152 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/ManagementResources.java | ManagementResources.reinstateUser | @PUT
@Path("/reinstateuser")
@Produces(MediaType.APPLICATION_JSON)
@Description("Reinstates a suspended user.")
public Response reinstateUser(@Context HttpServletRequest req,
@FormParam("username") String userName,
@FormParam("subsystem") SubSystem subSystem) {
if (userName == null || userName.isEmpty()) {
throw new IllegalArgumentException("User name cannot be null or empty.");
}
if (subSystem == null) {
throw new IllegalArgumentException("Subsystem cannot be null.");
}
validatePrivilegedUser(req);
PrincipalUser user = userService.findUserByUsername(userName);
if (user == null) {
throw new WebApplicationException("User does not exist.", Status.BAD_REQUEST);
}
managementService.reinstateUser(user, subSystem);
return Response.status(Status.OK).build();
} | java | @PUT
@Path("/reinstateuser")
@Produces(MediaType.APPLICATION_JSON)
@Description("Reinstates a suspended user.")
public Response reinstateUser(@Context HttpServletRequest req,
@FormParam("username") String userName,
@FormParam("subsystem") SubSystem subSystem) {
if (userName == null || userName.isEmpty()) {
throw new IllegalArgumentException("User name cannot be null or empty.");
}
if (subSystem == null) {
throw new IllegalArgumentException("Subsystem cannot be null.");
}
validatePrivilegedUser(req);
PrincipalUser user = userService.findUserByUsername(userName);
if (user == null) {
throw new WebApplicationException("User does not exist.", Status.BAD_REQUEST);
}
managementService.reinstateUser(user, subSystem);
return Response.status(Status.OK).build();
} | [
"@",
"PUT",
"@",
"Path",
"(",
"\"/reinstateuser\"",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Description",
"(",
"\"Reinstates a suspended user.\"",
")",
"public",
"Response",
"reinstateUser",
"(",
"@",
"Context",
"HttpServletReques... | Reinstates the specified sub system to the user.
@param req The HTTP request.
@param userName The user whom the sub system to be reinstated. Cannot be null or empty.
@param subSystem The subsystem to be reinstated. Cannot be null.
@return Response object indicating whether the operation was successful or not.
@throws IllegalArgumentException Throws IllegalArgument exception when the input is not valid.
@throws WebApplicationException Throws this exception if the user does not exist or the user is not authorized to carry out this operation. | [
"Reinstates",
"the",
"specified",
"sub",
"system",
"to",
"the",
"user",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/ManagementResources.java#L155-L177 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.referencesThis | static boolean referencesThis(Node n) {
if (n.isFunction()) {
return referencesThis(NodeUtil.getFunctionParameters(n))
|| referencesThis(NodeUtil.getFunctionBody(n));
} else {
return has(n, Node::isThis, MATCH_ANYTHING_BUT_NON_ARROW_FUNCTION);
}
} | java | static boolean referencesThis(Node n) {
if (n.isFunction()) {
return referencesThis(NodeUtil.getFunctionParameters(n))
|| referencesThis(NodeUtil.getFunctionBody(n));
} else {
return has(n, Node::isThis, MATCH_ANYTHING_BUT_NON_ARROW_FUNCTION);
}
} | [
"static",
"boolean",
"referencesThis",
"(",
"Node",
"n",
")",
"{",
"if",
"(",
"n",
".",
"isFunction",
"(",
")",
")",
"{",
"return",
"referencesThis",
"(",
"NodeUtil",
".",
"getFunctionParameters",
"(",
"n",
")",
")",
"||",
"referencesThis",
"(",
"NodeUtil"... | Returns true if the shallow scope contains references to 'this' keyword | [
"Returns",
"true",
"if",
"the",
"shallow",
"scope",
"contains",
"references",
"to",
"this",
"keyword"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L2344-L2351 |
Azure/azure-sdk-for-java | marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java | MarketplaceAgreementsInner.getAgreementAsync | public Observable<AgreementTermsInner> getAgreementAsync(String publisherId, String offerId, String planId) {
return getAgreementWithServiceResponseAsync(publisherId, offerId, planId).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() {
@Override
public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) {
return response.body();
}
});
} | java | public Observable<AgreementTermsInner> getAgreementAsync(String publisherId, String offerId, String planId) {
return getAgreementWithServiceResponseAsync(publisherId, offerId, planId).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() {
@Override
public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AgreementTermsInner",
">",
"getAgreementAsync",
"(",
"String",
"publisherId",
",",
"String",
"offerId",
",",
"String",
"planId",
")",
"{",
"return",
"getAgreementWithServiceResponseAsync",
"(",
"publisherId",
",",
"offerId",
",",
"planId"... | Get marketplace agreement.
@param publisherId Publisher identifier string of image being deployed.
@param offerId Offer identifier string of image being deployed.
@param planId Plan identifier string of image being deployed.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AgreementTermsInner object | [
"Get",
"marketplace",
"agreement",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java#L508-L515 |
linkedin/dexmaker | dexmaker/src/main/java/com/android/dx/stock/ProxyBuilder.java | ProxyBuilder.setInvocationHandler | public static void setInvocationHandler(Object instance, InvocationHandler handler) {
try {
Field handlerField = instance.getClass().getDeclaredField(FIELD_NAME_HANDLER);
handlerField.setAccessible(true);
handlerField.set(instance, handler);
} catch (NoSuchFieldException e) {
throw new IllegalArgumentException("Not a valid proxy instance", e);
} catch (IllegalAccessException e) {
// Should not be thrown, we just set the field to accessible.
throw new AssertionError(e);
}
} | java | public static void setInvocationHandler(Object instance, InvocationHandler handler) {
try {
Field handlerField = instance.getClass().getDeclaredField(FIELD_NAME_HANDLER);
handlerField.setAccessible(true);
handlerField.set(instance, handler);
} catch (NoSuchFieldException e) {
throw new IllegalArgumentException("Not a valid proxy instance", e);
} catch (IllegalAccessException e) {
// Should not be thrown, we just set the field to accessible.
throw new AssertionError(e);
}
} | [
"public",
"static",
"void",
"setInvocationHandler",
"(",
"Object",
"instance",
",",
"InvocationHandler",
"handler",
")",
"{",
"try",
"{",
"Field",
"handlerField",
"=",
"instance",
".",
"getClass",
"(",
")",
".",
"getDeclaredField",
"(",
"FIELD_NAME_HANDLER",
")",
... | Sets the proxy's {@link InvocationHandler}.
<p>
If you create a proxy with {@link #build()}, the proxy will already have a handler set,
provided that you configured one with {@link #handler(InvocationHandler)}.
<p>
If you generate a proxy class with {@link #buildProxyClass()}, instances of the proxy class
will not automatically have a handler set, and it is necessary to use this method with each
instance.
@throws IllegalArgumentException if the object supplied is not a proxy created by this class. | [
"Sets",
"the",
"proxy",
"s",
"{",
"@link",
"InvocationHandler",
"}",
".",
"<p",
">",
"If",
"you",
"create",
"a",
"proxy",
"with",
"{",
"@link",
"#build",
"()",
"}",
"the",
"proxy",
"will",
"already",
"have",
"a",
"handler",
"set",
"provided",
"that",
"... | train | https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/stock/ProxyBuilder.java#L419-L430 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFile.java | BoxFile.createMetadata | public Metadata createMetadata(String typeName, Metadata metadata) {
String scope = Metadata.scopeBasedOnType(typeName);
return this.createMetadata(typeName, scope, metadata);
} | java | public Metadata createMetadata(String typeName, Metadata metadata) {
String scope = Metadata.scopeBasedOnType(typeName);
return this.createMetadata(typeName, scope, metadata);
} | [
"public",
"Metadata",
"createMetadata",
"(",
"String",
"typeName",
",",
"Metadata",
"metadata",
")",
"{",
"String",
"scope",
"=",
"Metadata",
".",
"scopeBasedOnType",
"(",
"typeName",
")",
";",
"return",
"this",
".",
"createMetadata",
"(",
"typeName",
",",
"sc... | Creates metadata on this file in the specified template type.
@param typeName the metadata template type name.
@param metadata the new metadata values.
@return the metadata returned from the server. | [
"Creates",
"metadata",
"on",
"this",
"file",
"in",
"the",
"specified",
"template",
"type",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L1019-L1022 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.escapeUnprintable | public static <T extends Appendable> boolean escapeUnprintable(T result, int c) {
try {
if (isUnprintable(c)) {
result.append('\\');
if ((c & ~0xFFFF) != 0) {
result.append('U');
result.append(DIGITS[0xF&(c>>28)]);
result.append(DIGITS[0xF&(c>>24)]);
result.append(DIGITS[0xF&(c>>20)]);
result.append(DIGITS[0xF&(c>>16)]);
} else {
result.append('u');
}
result.append(DIGITS[0xF&(c>>12)]);
result.append(DIGITS[0xF&(c>>8)]);
result.append(DIGITS[0xF&(c>>4)]);
result.append(DIGITS[0xF&c]);
return true;
}
return false;
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
}
} | java | public static <T extends Appendable> boolean escapeUnprintable(T result, int c) {
try {
if (isUnprintable(c)) {
result.append('\\');
if ((c & ~0xFFFF) != 0) {
result.append('U');
result.append(DIGITS[0xF&(c>>28)]);
result.append(DIGITS[0xF&(c>>24)]);
result.append(DIGITS[0xF&(c>>20)]);
result.append(DIGITS[0xF&(c>>16)]);
} else {
result.append('u');
}
result.append(DIGITS[0xF&(c>>12)]);
result.append(DIGITS[0xF&(c>>8)]);
result.append(DIGITS[0xF&(c>>4)]);
result.append(DIGITS[0xF&c]);
return true;
}
return false;
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Appendable",
">",
"boolean",
"escapeUnprintable",
"(",
"T",
"result",
",",
"int",
"c",
")",
"{",
"try",
"{",
"if",
"(",
"isUnprintable",
"(",
"c",
")",
")",
"{",
"result",
".",
"append",
"(",
"'",
"'",
")",
... | Escape unprintable characters using <backslash>uxxxx notation
for U+0000 to U+FFFF and <backslash>Uxxxxxxxx for U+10000 and
above. If the character is printable ASCII, then do nothing
and return FALSE. Otherwise, append the escaped notation and
return TRUE. | [
"Escape",
"unprintable",
"characters",
"using",
"<backslash",
">",
"uxxxx",
"notation",
"for",
"U",
"+",
"0000",
"to",
"U",
"+",
"FFFF",
"and",
"<backslash",
">",
"Uxxxxxxxx",
"for",
"U",
"+",
"10000",
"and",
"above",
".",
"If",
"the",
"character",
"is",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1488-L1511 |
menacher/java-game-server | jetserver/src/main/java/org/menacheri/jetserver/util/NettyUtils.java | NettyUtils.readSocketAddress | public static InetSocketAddress readSocketAddress(ChannelBuffer buffer)
{
String remoteHost = NettyUtils.readString(buffer);
int remotePort = 0;
if (buffer.readableBytes() >= 4)
{
remotePort = buffer.readInt();
}
else
{
return null;
}
InetSocketAddress remoteAddress = null;
if (null != remoteHost)
{
remoteAddress = new InetSocketAddress(remoteHost, remotePort);
}
return remoteAddress;
} | java | public static InetSocketAddress readSocketAddress(ChannelBuffer buffer)
{
String remoteHost = NettyUtils.readString(buffer);
int remotePort = 0;
if (buffer.readableBytes() >= 4)
{
remotePort = buffer.readInt();
}
else
{
return null;
}
InetSocketAddress remoteAddress = null;
if (null != remoteHost)
{
remoteAddress = new InetSocketAddress(remoteHost, remotePort);
}
return remoteAddress;
} | [
"public",
"static",
"InetSocketAddress",
"readSocketAddress",
"(",
"ChannelBuffer",
"buffer",
")",
"{",
"String",
"remoteHost",
"=",
"NettyUtils",
".",
"readString",
"(",
"buffer",
")",
";",
"int",
"remotePort",
"=",
"0",
";",
"if",
"(",
"buffer",
".",
"readab... | Read a socket address from a buffer. The socket address will be provided
as two strings containing host and port.
@param buffer
The buffer containing the host and port as string.
@return The InetSocketAddress object created from host and port or null
in case the strings are not there. | [
"Read",
"a",
"socket",
"address",
"from",
"a",
"buffer",
".",
"The",
"socket",
"address",
"will",
"be",
"provided",
"as",
"two",
"strings",
"containing",
"host",
"and",
"port",
"."
] | train | https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetserver/src/main/java/org/menacheri/jetserver/util/NettyUtils.java#L384-L402 |
nikhaldi/android-view-selector | src/main/java/com/nikhaldimann/viewselector/ViewSelectorAssertions.java | ViewSelectorAssertions.assertThatSelection | public static ViewSelectionAssert assertThatSelection(String selector, Activity activity) {
return assertThat(selection(selector, activity));
} | java | public static ViewSelectionAssert assertThatSelection(String selector, Activity activity) {
return assertThat(selection(selector, activity));
} | [
"public",
"static",
"ViewSelectionAssert",
"assertThatSelection",
"(",
"String",
"selector",
",",
"Activity",
"activity",
")",
"{",
"return",
"assertThat",
"(",
"selection",
"(",
"selector",
",",
"activity",
")",
")",
";",
"}"
] | Fluent assertion entry point for a selection of views from the given activity
based on the given selector. It may be helpful to statically import this rather
than {@link #assertThat(ViewSelection)} to avoid conflicts with other statically
imported {@code assertThat()} methods. | [
"Fluent",
"assertion",
"entry",
"point",
"for",
"a",
"selection",
"of",
"views",
"from",
"the",
"given",
"activity",
"based",
"on",
"the",
"given",
"selector",
".",
"It",
"may",
"be",
"helpful",
"to",
"statically",
"import",
"this",
"rather",
"than",
"{"
] | train | https://github.com/nikhaldi/android-view-selector/blob/d3e4bf05f6111d116c6b0c1a8c51396e8bfae9b5/src/main/java/com/nikhaldimann/viewselector/ViewSelectorAssertions.java#L53-L55 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/ZipUtils.java | ZipUtils.unzip | private static void unzip(final ZipFile zip, final File patchDir) throws IOException {
final Enumeration<? extends ZipEntry> entries = zip.entries();
while(entries.hasMoreElements()) {
final ZipEntry entry = entries.nextElement();
final String name = entry.getName();
final File current = new File(patchDir, name);
if(entry.isDirectory()) {
continue;
} else {
if(! current.getParentFile().exists()) {
current.getParentFile().mkdirs();
}
try (final InputStream eis = zip.getInputStream(entry)){
Files.copy(eis, current.toPath());
//copy(eis, current);
}
}
}
} | java | private static void unzip(final ZipFile zip, final File patchDir) throws IOException {
final Enumeration<? extends ZipEntry> entries = zip.entries();
while(entries.hasMoreElements()) {
final ZipEntry entry = entries.nextElement();
final String name = entry.getName();
final File current = new File(patchDir, name);
if(entry.isDirectory()) {
continue;
} else {
if(! current.getParentFile().exists()) {
current.getParentFile().mkdirs();
}
try (final InputStream eis = zip.getInputStream(entry)){
Files.copy(eis, current.toPath());
//copy(eis, current);
}
}
}
} | [
"private",
"static",
"void",
"unzip",
"(",
"final",
"ZipFile",
"zip",
",",
"final",
"File",
"patchDir",
")",
"throws",
"IOException",
"{",
"final",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"entries",
"=",
"zip",
".",
"entries",
"(",
")",
";",
... | unpack...
@param zip the zip
@param patchDir the patch dir
@throws IOException | [
"unpack",
"..."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/ZipUtils.java#L113-L131 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java | ST_RemoveRepeatedPoints.removeDuplicateCoordinates | public static Polygon removeDuplicateCoordinates(Polygon polygon, double tolerance) throws SQLException {
Coordinate[] shellCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getExteriorRing().getCoordinates(),tolerance,true);
LinearRing shell = FACTORY.createLinearRing(shellCoords);
ArrayList<LinearRing> holes = new ArrayList<LinearRing>();
for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
Coordinate[] holeCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getInteriorRingN(i).getCoordinates(), tolerance, true);
if (holeCoords.length < 4) {
throw new SQLException("Not enough coordinates to build a new LinearRing.\n Please adjust the tolerance");
}
holes.add(FACTORY.createLinearRing(holeCoords));
}
return FACTORY.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
} | java | public static Polygon removeDuplicateCoordinates(Polygon polygon, double tolerance) throws SQLException {
Coordinate[] shellCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getExteriorRing().getCoordinates(),tolerance,true);
LinearRing shell = FACTORY.createLinearRing(shellCoords);
ArrayList<LinearRing> holes = new ArrayList<LinearRing>();
for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
Coordinate[] holeCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getInteriorRingN(i).getCoordinates(), tolerance, true);
if (holeCoords.length < 4) {
throw new SQLException("Not enough coordinates to build a new LinearRing.\n Please adjust the tolerance");
}
holes.add(FACTORY.createLinearRing(holeCoords));
}
return FACTORY.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
} | [
"public",
"static",
"Polygon",
"removeDuplicateCoordinates",
"(",
"Polygon",
"polygon",
",",
"double",
"tolerance",
")",
"throws",
"SQLException",
"{",
"Coordinate",
"[",
"]",
"shellCoords",
"=",
"CoordinateUtils",
".",
"removeRepeatedCoordinates",
"(",
"polygon",
"."... | Removes duplicated coordinates within a Polygon.
@param polygon the input polygon
@param tolerance to delete the coordinates
@return
@throws java.sql.SQLException | [
"Removes",
"duplicated",
"coordinates",
"within",
"a",
"Polygon",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java#L157-L169 |
wcm-io/wcm-io-handler | commons/src/main/java/io/wcm/handler/commons/dom/HtmlElement.java | HtmlElement.setData | public final T setData(String attributeName, String value) {
setAttribute(ATTRIBUTE_DATA_PREFIX + attributeName, value);
return (T)this;
} | java | public final T setData(String attributeName, String value) {
setAttribute(ATTRIBUTE_DATA_PREFIX + attributeName, value);
return (T)this;
} | [
"public",
"final",
"T",
"setData",
"(",
"String",
"attributeName",
",",
"String",
"value",
")",
"{",
"setAttribute",
"(",
"ATTRIBUTE_DATA_PREFIX",
"+",
"attributeName",
",",
"value",
")",
";",
"return",
"(",
"T",
")",
"this",
";",
"}"
] | Custom Html5 "data-*" attribute.
@param attributeName Name of HTML5 data attribute (without the 'data-' prefix).
@param value Value of attribute
@return Self reference | [
"Custom",
"Html5",
"data",
"-",
"*",
"attribute",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/commons/src/main/java/io/wcm/handler/commons/dom/HtmlElement.java#L246-L249 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/PeerGroup.java | PeerGroup.connectTo | @Nullable
public Peer connectTo(InetSocketAddress address) {
lock.lock();
try {
PeerAddress peerAddress = new PeerAddress(params, address);
backoffMap.put(peerAddress, new ExponentialBackoff(peerBackoffParams));
return connectTo(peerAddress, true, vConnectTimeoutMillis);
} finally {
lock.unlock();
}
} | java | @Nullable
public Peer connectTo(InetSocketAddress address) {
lock.lock();
try {
PeerAddress peerAddress = new PeerAddress(params, address);
backoffMap.put(peerAddress, new ExponentialBackoff(peerBackoffParams));
return connectTo(peerAddress, true, vConnectTimeoutMillis);
} finally {
lock.unlock();
}
} | [
"@",
"Nullable",
"public",
"Peer",
"connectTo",
"(",
"InetSocketAddress",
"address",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"PeerAddress",
"peerAddress",
"=",
"new",
"PeerAddress",
"(",
"params",
",",
"address",
")",
";",
"backoffMap",
"... | Connect to a peer by creating a channel to the destination address. This should not be
used normally - let the PeerGroup manage connections through {@link #start()}
@param address destination IP and port.
@return The newly created Peer object or null if the peer could not be connected.
Use {@link Peer#getConnectionOpenFuture()} if you
want a future which completes when the connection is open. | [
"Connect",
"to",
"a",
"peer",
"by",
"creating",
"a",
"channel",
"to",
"the",
"destination",
"address",
".",
"This",
"should",
"not",
"be",
"used",
"normally",
"-",
"let",
"the",
"PeerGroup",
"manage",
"connections",
"through",
"{",
"@link",
"#start",
"()",
... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/PeerGroup.java#L1307-L1317 |
apache/incubator-atlas | notification/src/main/java/org/apache/atlas/hook/AtlasHook.java | AtlasHook.notifyEntities | public static void notifyEntities(List<HookNotification.HookNotificationMessage> messages, int maxRetries) {
notifyEntitiesInternal(messages, maxRetries, notificationInterface, logFailedMessages, failedMessagesLogger);
} | java | public static void notifyEntities(List<HookNotification.HookNotificationMessage> messages, int maxRetries) {
notifyEntitiesInternal(messages, maxRetries, notificationInterface, logFailedMessages, failedMessagesLogger);
} | [
"public",
"static",
"void",
"notifyEntities",
"(",
"List",
"<",
"HookNotification",
".",
"HookNotificationMessage",
">",
"messages",
",",
"int",
"maxRetries",
")",
"{",
"notifyEntitiesInternal",
"(",
"messages",
",",
"maxRetries",
",",
"notificationInterface",
",",
... | Notify atlas of the entity through message. The entity can be a
complex entity with reference to other entities.
De-duping of entities is done on server side depending on the
unique attribute on the entities.
@param messages hook notification messages
@param maxRetries maximum number of retries while sending message to messaging system | [
"Notify",
"atlas",
"of",
"the",
"entity",
"through",
"message",
".",
"The",
"entity",
"can",
"be",
"a",
"complex",
"entity",
"with",
"reference",
"to",
"other",
"entities",
".",
"De",
"-",
"duping",
"of",
"entities",
"is",
"done",
"on",
"server",
"side",
... | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java#L117-L119 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java | UtilFile.getFilesByExtensionRecursive | private static void getFilesByExtensionRecursive(Collection<File> filesList, File path, String extension)
{
Optional.ofNullable(path.listFiles()).ifPresent(files -> Arrays.asList(files).forEach(content ->
{
if (content.isDirectory())
{
getFilesByExtensionRecursive(filesList, content, extension);
}
if (content.isFile() && extension.equals(getExtension(content)))
{
filesList.add(content);
}
}));
} | java | private static void getFilesByExtensionRecursive(Collection<File> filesList, File path, String extension)
{
Optional.ofNullable(path.listFiles()).ifPresent(files -> Arrays.asList(files).forEach(content ->
{
if (content.isDirectory())
{
getFilesByExtensionRecursive(filesList, content, extension);
}
if (content.isFile() && extension.equals(getExtension(content)))
{
filesList.add(content);
}
}));
} | [
"private",
"static",
"void",
"getFilesByExtensionRecursive",
"(",
"Collection",
"<",
"File",
">",
"filesList",
",",
"File",
"path",
",",
"String",
"extension",
")",
"{",
"Optional",
".",
"ofNullable",
"(",
"path",
".",
"listFiles",
"(",
")",
")",
".",
"ifPre... | Get all files existing in the path considering the extension.
@param filesList The files list.
@param path The path to check.
@param extension The extension (without dot; eg: png). | [
"Get",
"all",
"files",
"existing",
"in",
"the",
"path",
"considering",
"the",
"extension",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java#L252-L265 |
j-a-w-r/jawr | jawr-core/src/main/java/net/jawr/web/util/ReflectionUtils.java | ReflectionUtils.methodEquals | public static boolean methodEquals( Method method, Method other){
if ((method.getDeclaringClass().equals( other.getDeclaringClass()))
&& (method.getName().equals( other.getName()))) {
if (!method.getReturnType().equals(other.getReturnType()))
return false;
Class<?>[] params1 = method.getParameterTypes();
Class<?>[] params2 = other.getParameterTypes();
if (params1.length == params2.length) {
for (int i = 0; i < params1.length; i++) {
if (params1[i] != params2[i])
return false;
}
return true;
}
}
return false;
} | java | public static boolean methodEquals( Method method, Method other){
if ((method.getDeclaringClass().equals( other.getDeclaringClass()))
&& (method.getName().equals( other.getName()))) {
if (!method.getReturnType().equals(other.getReturnType()))
return false;
Class<?>[] params1 = method.getParameterTypes();
Class<?>[] params2 = other.getParameterTypes();
if (params1.length == params2.length) {
for (int i = 0; i < params1.length; i++) {
if (params1[i] != params2[i])
return false;
}
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"methodEquals",
"(",
"Method",
"method",
",",
"Method",
"other",
")",
"{",
"if",
"(",
"(",
"method",
".",
"getDeclaringClass",
"(",
")",
".",
"equals",
"(",
"other",
".",
"getDeclaringClass",
"(",
")",
")",
")",
"&&",
"(",
... | Checks if the 2 methods are equals.
@param method the first method
@param other the second method
@return true if the 2 methods are equals | [
"Checks",
"if",
"the",
"2",
"methods",
"are",
"equals",
"."
] | train | https://github.com/j-a-w-r/jawr/blob/1fa7cd46ebcd36908bd90b298ca316fa5b0c1b0d/jawr-core/src/main/java/net/jawr/web/util/ReflectionUtils.java#L50-L68 |
wigforss/Ka-Commons-Reflection | src/main/java/org/kasource/commons/reflection/util/MethodUtils.java | MethodUtils.getMethod | public static Method getMethod(Class<?> target, MethodFilter methodFilter) {
Set<Method> methods = getMethods(target, methodFilter);
if (!methods.isEmpty()) {
return methods.iterator().next();
}
return null;
} | java | public static Method getMethod(Class<?> target, MethodFilter methodFilter) {
Set<Method> methods = getMethods(target, methodFilter);
if (!methods.isEmpty()) {
return methods.iterator().next();
}
return null;
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"target",
",",
"MethodFilter",
"methodFilter",
")",
"{",
"Set",
"<",
"Method",
">",
"methods",
"=",
"getMethods",
"(",
"target",
",",
"methodFilter",
")",
";",
"if",
"(",
"!",
"metho... | Returns the method declared by the target class and any of its super classes, which matches the supplied
methodFilter, if method is found null is returned. If more than one method is found the
first in the resulting set iterator is returned.
@param methodFilter
The method filter to apply.
@return method that match the methodFilter or null if no such method was found. | [
"Returns",
"the",
"method",
"declared",
"by",
"the",
"target",
"class",
"and",
"any",
"of",
"its",
"super",
"classes",
"which",
"matches",
"the",
"supplied",
"methodFilter",
"if",
"method",
"is",
"found",
"null",
"is",
"returned",
".",
"If",
"more",
"than",
... | train | https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/MethodUtils.java#L130-L136 |
gpein/jcache-jee7 | src/main/java/io/github/gpein/jcache/configuration/CacheConfiguration.java | CacheConfiguration.newMutable | public static <K, V> Configuration newMutable(TimeUnit expiryTimeUnit, long expiryDurationAmount) {
return new MutableConfiguration<K, V>().setExpiryPolicyFactory(factoryOf(new Duration(expiryTimeUnit, expiryDurationAmount)));
} | java | public static <K, V> Configuration newMutable(TimeUnit expiryTimeUnit, long expiryDurationAmount) {
return new MutableConfiguration<K, V>().setExpiryPolicyFactory(factoryOf(new Duration(expiryTimeUnit, expiryDurationAmount)));
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Configuration",
"newMutable",
"(",
"TimeUnit",
"expiryTimeUnit",
",",
"long",
"expiryDurationAmount",
")",
"{",
"return",
"new",
"MutableConfiguration",
"<",
"K",
",",
"V",
">",
"(",
")",
".",
"setExpiryPolicyFacto... | Build a new mutable javax.cache.configuration.Configuration with an expiry policy
@param expiryTimeUnit time unit
@param expiryDurationAmount amount of time to wait before global cache expiration
@param <K> Key type
@param <V> Value type
@return a new cache configuration instance | [
"Build",
"a",
"new",
"mutable",
"javax",
".",
"cache",
".",
"configuration",
".",
"Configuration",
"with",
"an",
"expiry",
"policy"
] | train | https://github.com/gpein/jcache-jee7/blob/492dd3bb6423cdfb064e7005952a7b79fe4cd7aa/src/main/java/io/github/gpein/jcache/configuration/CacheConfiguration.java#L38-L40 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_configureVpn_POST | public OvhTask serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_configureVpn_POST(String serviceName, Long datacenterId, String preSharedKey, String remoteEndpointInternalIp, String remoteEndpointPublicIp, String remoteVraNetwork, String remoteZvmInternalIp) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/configureVpn";
StringBuilder sb = path(qPath, serviceName, datacenterId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "preSharedKey", preSharedKey);
addBody(o, "remoteEndpointInternalIp", remoteEndpointInternalIp);
addBody(o, "remoteEndpointPublicIp", remoteEndpointPublicIp);
addBody(o, "remoteVraNetwork", remoteVraNetwork);
addBody(o, "remoteZvmInternalIp", remoteZvmInternalIp);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_configureVpn_POST(String serviceName, Long datacenterId, String preSharedKey, String remoteEndpointInternalIp, String remoteEndpointPublicIp, String remoteVraNetwork, String remoteZvmInternalIp) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/configureVpn";
StringBuilder sb = path(qPath, serviceName, datacenterId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "preSharedKey", preSharedKey);
addBody(o, "remoteEndpointInternalIp", remoteEndpointInternalIp);
addBody(o, "remoteEndpointPublicIp", remoteEndpointPublicIp);
addBody(o, "remoteVraNetwork", remoteVraNetwork);
addBody(o, "remoteZvmInternalIp", remoteZvmInternalIp);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_configureVpn_POST",
"(",
"String",
"serviceName",
",",
"Long",
"datacenterId",
",",
"String",
"preSharedKey",
",",
"String",
"remoteEndpointInternalIp",
",",
"String",
"remoteEndpointPublicIp",
... | Configure vpn between your OVH Private Cloud and your onsite infrastructure
REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/configureVpn
@param remoteEndpointPublicIp [required] Your onsite endpoint public IP for the secured replication data tunnel
@param remoteVraNetwork [required] Internal zerto subnet of your onsite infrastructure (ip/cidr)
@param remoteZvmInternalIp [required] Internal ZVM ip of your onsite infrastructure
@param remoteEndpointInternalIp [required] Your onsite endpoint internal IP for the secured replication data tunnel
@param preSharedKey [required] Pre-Shared Key to secure data transfer between both sites
@param serviceName [required] Domain of the service
@param datacenterId [required]
API beta | [
"Configure",
"vpn",
"between",
"your",
"OVH",
"Private",
"Cloud",
"and",
"your",
"onsite",
"infrastructure"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1856-L1867 |
acromusashi/acromusashi-stream-ml | src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java | LofCalculator.calculateLof | protected static double calculateLof(LofPoint basePoint, LofDataSet dataSet)
{
int countedData = 0;
double totalAmount = 0.0d;
for (String targetDataId : basePoint.getkDistanceNeighbor())
{
LofPoint targetPoint = dataSet.getDataMap().get(targetDataId);
totalAmount = totalAmount + (targetPoint.getLrd() / basePoint.getLrd());
countedData++;
}
if (countedData == 0)
{
return totalAmount;
}
return totalAmount / (countedData);
} | java | protected static double calculateLof(LofPoint basePoint, LofDataSet dataSet)
{
int countedData = 0;
double totalAmount = 0.0d;
for (String targetDataId : basePoint.getkDistanceNeighbor())
{
LofPoint targetPoint = dataSet.getDataMap().get(targetDataId);
totalAmount = totalAmount + (targetPoint.getLrd() / basePoint.getLrd());
countedData++;
}
if (countedData == 0)
{
return totalAmount;
}
return totalAmount / (countedData);
} | [
"protected",
"static",
"double",
"calculateLof",
"(",
"LofPoint",
"basePoint",
",",
"LofDataSet",
"dataSet",
")",
"{",
"int",
"countedData",
"=",
"0",
";",
"double",
"totalAmount",
"=",
"0.0d",
";",
"for",
"(",
"String",
"targetDataId",
":",
"basePoint",
".",
... | basePointの局所外れ係数(Local outlier factor)を算出する。
@param basePoint 算出元対象点
@param dataSet 全体データ
@return 局所外れ係数 | [
"basePointの局所外れ係数",
"(",
"Local",
"outlier",
"factor",
")",
"を算出する。"
] | train | https://github.com/acromusashi/acromusashi-stream-ml/blob/26d6799a917cacda68e21d506c75cfeb17d832a6/src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java#L415-L433 |
twitter/cloudhopper-commons | ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java | DataCoding.createCharacterEncodingGroup | static public DataCoding createCharacterEncodingGroup(byte characterEncoding) throws IllegalArgumentException {
// bits 3 thru 0 of the encoding represent 16 languages
// make sure the top bits 7 thru 4 are not set
if ((characterEncoding & 0xF0) != 0) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only 16 possible for char encoding group");
}
return new DataCoding(characterEncoding, Group.CHARACTER_ENCODING, characterEncoding, MESSAGE_CLASS_0, false);
} | java | static public DataCoding createCharacterEncodingGroup(byte characterEncoding) throws IllegalArgumentException {
// bits 3 thru 0 of the encoding represent 16 languages
// make sure the top bits 7 thru 4 are not set
if ((characterEncoding & 0xF0) != 0) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only 16 possible for char encoding group");
}
return new DataCoding(characterEncoding, Group.CHARACTER_ENCODING, characterEncoding, MESSAGE_CLASS_0, false);
} | [
"static",
"public",
"DataCoding",
"createCharacterEncodingGroup",
"(",
"byte",
"characterEncoding",
")",
"throws",
"IllegalArgumentException",
"{",
"// bits 3 thru 0 of the encoding represent 16 languages",
"// make sure the top bits 7 thru 4 are not set",
"if",
"(",
"(",
"characterE... | Creates a "Character Encoding" group data coding scheme where 16 different
languages are supported. This method validates the range and
sets the message class to 0 and compression flags to false.
@param characterEncoding The different possible character encodings
@return A new immutable DataCoding instance representing this data coding scheme
@throws IllegalArgumentException Thrown if the range is not supported. | [
"Creates",
"a",
"Character",
"Encoding",
"group",
"data",
"coding",
"scheme",
"where",
"16",
"different",
"languages",
"are",
"supported",
".",
"This",
"method",
"validates",
"the",
"range",
"and",
"sets",
"the",
"message",
"class",
"to",
"0",
"and",
"compress... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java#L202-L209 |
crowmagnumb/s6-util | src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java | AbstractMultipartUtility.addFilePart | public void addFilePart(final String fieldName, final URL urlToUploadFile)
throws IOException
{
//
// Maybe try and extract a filename from the last part of the url?
// Or have the user pass it in?
// Or just leave it blank as I have already done?
//
addFilePart(fieldName,
urlToUploadFile.openStream(),
null,
URLConnection.guessContentTypeFromName(urlToUploadFile.toString()));
} | java | public void addFilePart(final String fieldName, final URL urlToUploadFile)
throws IOException
{
//
// Maybe try and extract a filename from the last part of the url?
// Or have the user pass it in?
// Or just leave it blank as I have already done?
//
addFilePart(fieldName,
urlToUploadFile.openStream(),
null,
URLConnection.guessContentTypeFromName(urlToUploadFile.toString()));
} | [
"public",
"void",
"addFilePart",
"(",
"final",
"String",
"fieldName",
",",
"final",
"URL",
"urlToUploadFile",
")",
"throws",
"IOException",
"{",
"//",
"// Maybe try and extract a filename from the last part of the url?",
"// Or have the user pass it in?",
"// Or just leave it bla... | Adds a upload file section to the request by url stream
@param fieldName name attribute in <input type="file" name="..." />
@param urlToUploadFile url to add as a stream
@throws IOException if problems | [
"Adds",
"a",
"upload",
"file",
"section",
"to",
"the",
"request",
"by",
"url",
"stream"
] | train | https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java#L83-L95 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/quality/AbstractKMeansQualityMeasure.java | AbstractKMeansQualityMeasure.numberOfFreeParameters | public static int numberOfFreeParameters(Relation<? extends NumberVector> relation, Clustering<? extends MeanModel> clustering) {
// number of clusters
int m = clustering.getAllClusters().size(); // num_ctrs
// dimensionality of data points
int dim = RelationUtil.dimensionality(relation); // num_dims
// number of free parameters
return (m - 1) + m * dim + m;
} | java | public static int numberOfFreeParameters(Relation<? extends NumberVector> relation, Clustering<? extends MeanModel> clustering) {
// number of clusters
int m = clustering.getAllClusters().size(); // num_ctrs
// dimensionality of data points
int dim = RelationUtil.dimensionality(relation); // num_dims
// number of free parameters
return (m - 1) + m * dim + m;
} | [
"public",
"static",
"int",
"numberOfFreeParameters",
"(",
"Relation",
"<",
"?",
"extends",
"NumberVector",
">",
"relation",
",",
"Clustering",
"<",
"?",
"extends",
"MeanModel",
">",
"clustering",
")",
"{",
"// number of clusters",
"int",
"m",
"=",
"clustering",
... | Compute the number of free parameters.
@param relation Data relation (for dimensionality)
@param clustering Set of clusters
@return Number of free parameters | [
"Compute",
"the",
"number",
"of",
"free",
"parameters",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/quality/AbstractKMeansQualityMeasure.java#L181-L190 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.