repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
groupby/api-java | src/main/java/com/groupbyinc/api/Query.java | Query.getBridgeRefinementsJson | public String getBridgeRefinementsJson(String clientKey, String navigationName) {
RefinementsRequest request = new RefinementsRequest();
request.setOriginalQuery(populateRequest(clientKey));
request.setNavigationName(navigationName);
return requestToJson(request);
} | java | public String getBridgeRefinementsJson(String clientKey, String navigationName) {
RefinementsRequest request = new RefinementsRequest();
request.setOriginalQuery(populateRequest(clientKey));
request.setNavigationName(navigationName);
return requestToJson(request);
} | [
"public",
"String",
"getBridgeRefinementsJson",
"(",
"String",
"clientKey",
",",
"String",
"navigationName",
")",
"{",
"RefinementsRequest",
"request",
"=",
"new",
"RefinementsRequest",
"(",
")",
";",
"request",
".",
"setOriginalQuery",
"(",
"populateRequest",
"(",
... | <code>
Used internally by the bridge object to generate the JSON that is sent to the search service.
</code>
@param clientKey
The client key used to authenticate this request.
@return A JSON representation of this query object. | [
"<code",
">",
"Used",
"internally",
"by",
"the",
"bridge",
"object",
"to",
"generate",
"the",
"JSON",
"that",
"is",
"sent",
"to",
"the",
"search",
"service",
".",
"<",
"/",
"code",
">"
] | train | https://github.com/groupby/api-java/blob/257c4ed0777221e5e4ade3b29b9921300fac4e2e/src/main/java/com/groupbyinc/api/Query.java#L319-L324 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java | FastDateFormat.getDateTimeInstance | public static synchronized FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone,
Locale locale) {
Object key = new Pair(new Integer(dateStyle), new Integer(timeStyle));
if (timeZone != null) {
key = new Pair(key, timeZone);
}
if (locale == null) {
locale = Locale.getDefault();
}
key = new Pair(key, locale);
FastDateFormat format = (FastDateFormat) cDateTimeInstanceCache.get(key);
if (format == null) {
try {
SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateTimeInstance(dateStyle, timeStyle,
locale);
String pattern = formatter.toPattern();
format = getInstance(pattern, timeZone, locale);
cDateTimeInstanceCache.put(key, format);
} catch (ClassCastException ex) {
throw new IllegalArgumentException("No date time pattern for locale: " + locale);
}
}
return format;
} | java | public static synchronized FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone,
Locale locale) {
Object key = new Pair(new Integer(dateStyle), new Integer(timeStyle));
if (timeZone != null) {
key = new Pair(key, timeZone);
}
if (locale == null) {
locale = Locale.getDefault();
}
key = new Pair(key, locale);
FastDateFormat format = (FastDateFormat) cDateTimeInstanceCache.get(key);
if (format == null) {
try {
SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateTimeInstance(dateStyle, timeStyle,
locale);
String pattern = formatter.toPattern();
format = getInstance(pattern, timeZone, locale);
cDateTimeInstanceCache.put(key, format);
} catch (ClassCastException ex) {
throw new IllegalArgumentException("No date time pattern for locale: " + locale);
}
}
return format;
} | [
"public",
"static",
"synchronized",
"FastDateFormat",
"getDateTimeInstance",
"(",
"int",
"dateStyle",
",",
"int",
"timeStyle",
",",
"TimeZone",
"timeZone",
",",
"Locale",
"locale",
")",
"{",
"Object",
"key",
"=",
"new",
"Pair",
"(",
"new",
"Integer",
"(",
"dat... | <p>Gets a date/time formatter instance using the specified style,
time zone and locale.</p>
@param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
@param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
@param timeZone optional time zone, overrides time zone of
formatted date
@param locale optional locale, overrides system locale
@return a localized standard date/time formatter
@throws IllegalArgumentException if the Locale has no date/time
pattern defined | [
"<p",
">",
"Gets",
"a",
"date",
"/",
"time",
"formatter",
"instance",
"using",
"the",
"specified",
"style",
"time",
"zone",
"and",
"locale",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java#L458-L484 |
davidcarboni-archive/httpino | src/main/java/com/github/davidcarboni/httpino/Http.java | Http.getFile | public static Path getFile(HttpServletRequest request)
throws IOException {
Path result = null;
// Set up the objects that do all the heavy lifting
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
try {
// Read the items - this will save the values to temp files
for (FileItem item : upload.parseRequest(request)) {
if (!item.isFormField()) {
result = Files.createTempFile("upload", ".file");
item.write(result.toFile());
}
}
} catch (Exception e) {
// item.write throws a general Exception, so specialise it by wrapping with IOException
throw new IOException("Error processing uploaded file", e);
}
return result;
} | java | public static Path getFile(HttpServletRequest request)
throws IOException {
Path result = null;
// Set up the objects that do all the heavy lifting
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
try {
// Read the items - this will save the values to temp files
for (FileItem item : upload.parseRequest(request)) {
if (!item.isFormField()) {
result = Files.createTempFile("upload", ".file");
item.write(result.toFile());
}
}
} catch (Exception e) {
// item.write throws a general Exception, so specialise it by wrapping with IOException
throw new IOException("Error processing uploaded file", e);
}
return result;
} | [
"public",
"static",
"Path",
"getFile",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"IOException",
"{",
"Path",
"result",
"=",
"null",
";",
"// Set up the objects that do all the heavy lifting",
"DiskFileItemFactory",
"factory",
"=",
"new",
"DiskFileItemFactory",
... | Handles reading an uploaded file.
@param request The http request.
@return A temp file containing the file data.
@throws IOException If an error occurs in processing the file. | [
"Handles",
"reading",
"an",
"uploaded",
"file",
"."
] | train | https://github.com/davidcarboni-archive/httpino/blob/a78c91874e6d9b2e452cf3aa68d4fea804d977ca/src/main/java/com/github/davidcarboni/httpino/Http.java#L385-L407 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectedItemsInner.java | ProtectedItemsInner.createOrUpdateAsync | public Observable<Void> createOrUpdateAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, ProtectedItemResourceInner parameters) {
return createOrUpdateWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> createOrUpdateAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, ProtectedItemResourceInner parameters) {
return createOrUpdateWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"createOrUpdateAsync",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
",",
"String",
"fabricName",
",",
"String",
"containerName",
",",
"String",
"protectedItemName",
",",
"ProtectedItemResourceInner",
"paramete... | Enables backup of an item or to modifies the backup policy information of an already backed up item. This is an asynchronous operation. To know the status of the operation, call the GetItemOperationResult API.
@param vaultName The name of the recovery services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param fabricName Fabric name associated with the backup item.
@param containerName Container name associated with the backup item.
@param protectedItemName Item name to be backed up.
@param parameters resource backed up item
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Enables",
"backup",
"of",
"an",
"item",
"or",
"to",
"modifies",
"the",
"backup",
"policy",
"information",
"of",
"an",
"already",
"backed",
"up",
"item",
".",
"This",
"is",
"an",
"asynchronous",
"operation",
".",
"To",
"know",
"the",
"status",
"of",
"the",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectedItemsInner.java#L330-L337 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java | AbstractOracleQuery.startWith | @WithBridgeMethods(value = OracleQuery.class, castRequired = true)
public <A> C startWith(Predicate cond) {
return addFlag(Position.BEFORE_ORDER, START_WITH, cond);
} | java | @WithBridgeMethods(value = OracleQuery.class, castRequired = true)
public <A> C startWith(Predicate cond) {
return addFlag(Position.BEFORE_ORDER, START_WITH, cond);
} | [
"@",
"WithBridgeMethods",
"(",
"value",
"=",
"OracleQuery",
".",
"class",
",",
"castRequired",
"=",
"true",
")",
"public",
"<",
"A",
">",
"C",
"startWith",
"(",
"Predicate",
"cond",
")",
"{",
"return",
"addFlag",
"(",
"Position",
".",
"BEFORE_ORDER",
",",
... | START WITH specifies the root row(s) of the hierarchy.
@param cond condition
@return the current object | [
"START",
"WITH",
"specifies",
"the",
"root",
"row",
"(",
"s",
")",
"of",
"the",
"hierarchy",
"."
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java#L94-L97 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.findDataPoints | public Cursor<DataPointFound> findDataPoints(Series series, Interval interval, Predicate predicate) {
return findDataPoints(series, interval, predicate, DateTimeZone.getDefault());
} | java | public Cursor<DataPointFound> findDataPoints(Series series, Interval interval, Predicate predicate) {
return findDataPoints(series, interval, predicate, DateTimeZone.getDefault());
} | [
"public",
"Cursor",
"<",
"DataPointFound",
">",
"findDataPoints",
"(",
"Series",
"series",
",",
"Interval",
"interval",
",",
"Predicate",
"predicate",
")",
"{",
"return",
"findDataPoints",
"(",
"series",
",",
"interval",
",",
"predicate",
",",
"DateTimeZone",
".... | Returns a cursor of intervals/datapoints matching a predicate specified by series.
<p>The system default timezone is used for the returned DateTimes.
@param series The series
@param interval An interval of time for the query (start/end datetimes)
@param predicate The predicate for the query.
@return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request.
@see Cursor
@since 1.1.0 | [
"Returns",
"a",
"cursor",
"of",
"intervals",
"/",
"datapoints",
"matching",
"a",
"predicate",
"specified",
"by",
"series",
".",
"<p",
">",
"The",
"system",
"default",
"timezone",
"is",
"used",
"for",
"the",
"returned",
"DateTimes",
"."
] | train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L300-L302 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.addStorageAccountAsync | public Observable<Void> addStorageAccountAsync(String resourceGroupName, String accountName, String storageAccountName, AddStorageAccountParameters parameters) {
return addStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> addStorageAccountAsync(String resourceGroupName, String accountName, String storageAccountName, AddStorageAccountParameters parameters) {
return addStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"addStorageAccountAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"storageAccountName",
",",
"AddStorageAccountParameters",
"parameters",
")",
"{",
"return",
"addStorageAccountWithServiceResp... | Updates the specified Data Lake Analytics account to add an Azure Storage account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account to which to add the Azure Storage account.
@param storageAccountName The name of the Azure Storage account to add
@param parameters The parameters containing the access key and optional suffix for the Azure Storage Account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Updates",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"to",
"add",
"an",
"Azure",
"Storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L506-L513 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java | FlashImpl._saveMessages | private void _saveMessages(FacesContext facesContext)
{
if (isKeepMessages())
{
// get all messages from the FacesContext and store
// them on the renderMap
List<MessageEntry> messageList = null;
Iterator<String> iterClientIds = facesContext.getClientIdsWithMessages();
while (iterClientIds.hasNext())
{
String clientId = (String) iterClientIds.next();
Iterator<FacesMessage> iterMessages = facesContext.getMessages(clientId);
while (iterMessages.hasNext())
{
FacesMessage message = iterMessages.next();
if (messageList == null)
{
messageList = new ArrayList<MessageEntry>();
}
messageList.add(new MessageEntry(clientId, message));
}
}
_getRenderFlashMap(facesContext).put(FLASH_KEEP_MESSAGES_LIST, messageList);
}
else
{
// do not keep messages --> remove messagesList from renderMap
_getRenderFlashMap(facesContext).remove(FLASH_KEEP_MESSAGES_LIST);
}
} | java | private void _saveMessages(FacesContext facesContext)
{
if (isKeepMessages())
{
// get all messages from the FacesContext and store
// them on the renderMap
List<MessageEntry> messageList = null;
Iterator<String> iterClientIds = facesContext.getClientIdsWithMessages();
while (iterClientIds.hasNext())
{
String clientId = (String) iterClientIds.next();
Iterator<FacesMessage> iterMessages = facesContext.getMessages(clientId);
while (iterMessages.hasNext())
{
FacesMessage message = iterMessages.next();
if (messageList == null)
{
messageList = new ArrayList<MessageEntry>();
}
messageList.add(new MessageEntry(clientId, message));
}
}
_getRenderFlashMap(facesContext).put(FLASH_KEEP_MESSAGES_LIST, messageList);
}
else
{
// do not keep messages --> remove messagesList from renderMap
_getRenderFlashMap(facesContext).remove(FLASH_KEEP_MESSAGES_LIST);
}
} | [
"private",
"void",
"_saveMessages",
"(",
"FacesContext",
"facesContext",
")",
"{",
"if",
"(",
"isKeepMessages",
"(",
")",
")",
"{",
"// get all messages from the FacesContext and store",
"// them on the renderMap",
"List",
"<",
"MessageEntry",
">",
"messageList",
"=",
"... | Saves the current FacesMessages as a List on the render FlashMap for the
next request if isKeepMessages() is true. Otherwise it removes any
existing FacesMessages-List from the renderFlashMap.
@param facesContext | [
"Saves",
"the",
"current",
"FacesMessages",
"as",
"a",
"List",
"on",
"the",
"render",
"FlashMap",
"for",
"the",
"next",
"request",
"if",
"isKeepMessages",
"()",
"is",
"true",
".",
"Otherwise",
"it",
"removes",
"any",
"existing",
"FacesMessages",
"-",
"List",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/context/flash/FlashImpl.java#L684-L717 |
lucee/Lucee | core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java | ASMUtil.hasSisterTagAfter | public static boolean hasSisterTagAfter(Tag tag, String nameToFind) {
Body body = (Body) tag.getParent();
List<Statement> stats = body.getStatements();
Iterator<Statement> it = stats.iterator();
Statement other;
boolean isAfter = false;
while (it.hasNext()) {
other = it.next();
if (other instanceof Tag) {
if (isAfter) {
if (((Tag) other).getTagLibTag().getName().equals(nameToFind)) return true;
}
else if (other == tag) isAfter = true;
}
}
return false;
} | java | public static boolean hasSisterTagAfter(Tag tag, String nameToFind) {
Body body = (Body) tag.getParent();
List<Statement> stats = body.getStatements();
Iterator<Statement> it = stats.iterator();
Statement other;
boolean isAfter = false;
while (it.hasNext()) {
other = it.next();
if (other instanceof Tag) {
if (isAfter) {
if (((Tag) other).getTagLibTag().getName().equals(nameToFind)) return true;
}
else if (other == tag) isAfter = true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"hasSisterTagAfter",
"(",
"Tag",
"tag",
",",
"String",
"nameToFind",
")",
"{",
"Body",
"body",
"=",
"(",
"Body",
")",
"tag",
".",
"getParent",
"(",
")",
";",
"List",
"<",
"Statement",
">",
"stats",
"=",
"body",
".",
"getS... | Prueft ob das das angegebene Tag in der gleichen Ebene nach dem angegebenen Tag vorkommt.
@param tag Ausgangspunkt, nach diesem tag darf das angegebene nicht vorkommen.
@param nameToFind Tag Name der nicht vorkommen darf
@return kommt das Tag vor. | [
"Prueft",
"ob",
"das",
"das",
"angegebene",
"Tag",
"in",
"der",
"gleichen",
"Ebene",
"nach",
"dem",
"angegebenen",
"Tag",
"vorkommt",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java#L398-L416 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.createToken | public CompletableFuture<Revision> createToken(Author author, String appId, boolean isAdmin) {
return createToken(author, appId, SECRET_PREFIX + UUID.randomUUID(), isAdmin);
} | java | public CompletableFuture<Revision> createToken(Author author, String appId, boolean isAdmin) {
return createToken(author, appId, SECRET_PREFIX + UUID.randomUUID(), isAdmin);
} | [
"public",
"CompletableFuture",
"<",
"Revision",
">",
"createToken",
"(",
"Author",
"author",
",",
"String",
"appId",
",",
"boolean",
"isAdmin",
")",
"{",
"return",
"createToken",
"(",
"author",
",",
"appId",
",",
"SECRET_PREFIX",
"+",
"UUID",
".",
"randomUUID"... | Creates a new {@link Token} with the specified {@code appId}, {@code isAdmin} and an auto-generated
secret. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L704-L706 |
nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.createOperator | public static NKey createOperator(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.OPERATOR, random);
} | java | public static NKey createOperator(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.OPERATOR, random);
} | [
"public",
"static",
"NKey",
"createOperator",
"(",
"SecureRandom",
"random",
")",
"throws",
"IOException",
",",
"NoSuchProviderException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"createPair",
"(",
"Type",
".",
"OPERATOR",
",",
"random",
")",
";",
"}"
] | Create an Operator NKey from the provided random number generator.
If no random is provided, SecureRandom.getInstance("SHA1PRNG", "SUN") will be used to creat eone.
The new NKey contains the private seed, which should be saved in a secure location.
@param random A secure random provider
@return the new Nkey
@throws IOException if the seed cannot be encoded to a string
@throws NoSuchProviderException if the default secure random cannot be created
@throws NoSuchAlgorithmException if the default secure random cannot be created | [
"Create",
"an",
"Operator",
"NKey",
"from",
"the",
"provided",
"random",
"number",
"generator",
"."
] | train | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L515-L518 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/graph/invariant/Canon.java | Canon.primeProduct | private long primeProduct(int[] ws, long[] ranks, boolean[] hydrogens) {
long prod = 1;
for (int w : ws) {
if (!hydrogens[w]) {
prod *= PRIMES[(int) ranks[w]];
}
}
return prod;
} | java | private long primeProduct(int[] ws, long[] ranks, boolean[] hydrogens) {
long prod = 1;
for (int w : ws) {
if (!hydrogens[w]) {
prod *= PRIMES[(int) ranks[w]];
}
}
return prod;
} | [
"private",
"long",
"primeProduct",
"(",
"int",
"[",
"]",
"ws",
",",
"long",
"[",
"]",
"ranks",
",",
"boolean",
"[",
"]",
"hydrogens",
")",
"{",
"long",
"prod",
"=",
"1",
";",
"for",
"(",
"int",
"w",
":",
"ws",
")",
"{",
"if",
"(",
"!",
"hydroge... | Compute the prime product of the values (ranks) for the given
adjacent neighbors (ws).
@param ws indices (adjacent neighbors)
@param ranks invariant ranks
@return the prime product | [
"Compute",
"the",
"prime",
"product",
"of",
"the",
"values",
"(",
"ranks",
")",
"for",
"the",
"given",
"adjacent",
"neighbors",
"(",
"ws",
")",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/graph/invariant/Canon.java#L294-L302 |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/Translate.java | Translate.translateEdgeIds | public static <OLD, NEW, EV> DataSet<Edge<NEW, EV>> translateEdgeIds(DataSet<Edge<OLD, EV>> edges, TranslateFunction<OLD, NEW> translator) {
return translateEdgeIds(edges, translator, PARALLELISM_DEFAULT);
} | java | public static <OLD, NEW, EV> DataSet<Edge<NEW, EV>> translateEdgeIds(DataSet<Edge<OLD, EV>> edges, TranslateFunction<OLD, NEW> translator) {
return translateEdgeIds(edges, translator, PARALLELISM_DEFAULT);
} | [
"public",
"static",
"<",
"OLD",
",",
"NEW",
",",
"EV",
">",
"DataSet",
"<",
"Edge",
"<",
"NEW",
",",
"EV",
">",
">",
"translateEdgeIds",
"(",
"DataSet",
"<",
"Edge",
"<",
"OLD",
",",
"EV",
">",
">",
"edges",
",",
"TranslateFunction",
"<",
"OLD",
",... | Translate {@link Edge} IDs using the given {@link TranslateFunction}.
@param edges input edges
@param translator implements conversion from {@code OLD} to {@code NEW}
@param <OLD> old edge ID type
@param <NEW> new edge ID type
@param <EV> edge value type
@return translated edges | [
"Translate",
"{",
"@link",
"Edge",
"}",
"IDs",
"using",
"the",
"given",
"{",
"@link",
"TranslateFunction",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/Translate.java#L137-L139 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java | JmxUtils.getMBeanObjectName | public static ObjectName getMBeanObjectName(final ServletContext servletContext, final String resourceType,
final String mBeanPrefix) {
String contextPath = getContextPath(servletContext);
return getJawrConfigMBeanObjectName(contextPath, resourceType, mBeanPrefix);
} | java | public static ObjectName getMBeanObjectName(final ServletContext servletContext, final String resourceType,
final String mBeanPrefix) {
String contextPath = getContextPath(servletContext);
return getJawrConfigMBeanObjectName(contextPath, resourceType, mBeanPrefix);
} | [
"public",
"static",
"ObjectName",
"getMBeanObjectName",
"(",
"final",
"ServletContext",
"servletContext",
",",
"final",
"String",
"resourceType",
",",
"final",
"String",
"mBeanPrefix",
")",
"{",
"String",
"contextPath",
"=",
"getContextPath",
"(",
"servletContext",
")... | Returns the object name for the Jawr configuration Manager MBean
@param servletContext
the servelt context
@param resourceType
the resource type
@param mBeanPrefix
@return the object name for the Jawr configuration Manager MBean | [
"Returns",
"the",
"object",
"name",
"for",
"the",
"Jawr",
"configuration",
"Manager",
"MBean"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java#L166-L171 |
jenetics/jenetics | jenetics.prog/src/main/java/io/jenetics/prog/op/Program.java | Program.check | public static void check(final Tree<? extends Op<?>, ?> program) {
requireNonNull(program);
program.forEach(Program::checkArity);
} | java | public static void check(final Tree<? extends Op<?>, ?> program) {
requireNonNull(program);
program.forEach(Program::checkArity);
} | [
"public",
"static",
"void",
"check",
"(",
"final",
"Tree",
"<",
"?",
"extends",
"Op",
"<",
"?",
">",
",",
"?",
">",
"program",
")",
"{",
"requireNonNull",
"(",
"program",
")",
";",
"program",
".",
"forEach",
"(",
"Program",
"::",
"checkArity",
")",
"... | Validates the given program tree.
@param program the program to validate
@throws NullPointerException if the given {@code program} is {@code null}
@throws IllegalArgumentException if the given operation tree is invalid,
which means there is at least one node where the operation arity
and the node child count differ. | [
"Validates",
"the",
"given",
"program",
"tree",
"."
] | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.prog/src/main/java/io/jenetics/prog/op/Program.java#L207-L210 |
synchronoss/cpo-api | cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java | CassandraCpoAdapter.newOrderBy | @Override
public CpoOrderBy newOrderBy(String attribute, boolean ascending) throws CpoException {
return new BindableCpoOrderBy(attribute, ascending);
} | java | @Override
public CpoOrderBy newOrderBy(String attribute, boolean ascending) throws CpoException {
return new BindableCpoOrderBy(attribute, ascending);
} | [
"@",
"Override",
"public",
"CpoOrderBy",
"newOrderBy",
"(",
"String",
"attribute",
",",
"boolean",
"ascending",
")",
"throws",
"CpoException",
"{",
"return",
"new",
"BindableCpoOrderBy",
"(",
"attribute",
",",
"ascending",
")",
";",
"}"
] | newOrderBy allows you to dynamically change the order of the objects in the resulting collection. This allows you
to apply user input in determining the order of the collection
@param attribute The name of the attribute from the pojo that will be sorted.
@param ascending If true, sort ascending. If false sort descending.
@return A CpoOrderBy object to be passed into retrieveBeans.
@throws CpoException Thrown if there are errors accessing the datasource | [
"newOrderBy",
"allows",
"you",
"to",
"dynamically",
"change",
"the",
"order",
"of",
"the",
"objects",
"in",
"the",
"resulting",
"collection",
".",
"This",
"allows",
"you",
"to",
"apply",
"user",
"input",
"in",
"determining",
"the",
"order",
"of",
"the",
"col... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1045-L1048 |
ixa-ehu/ixa-pipe-tok | src/main/java/eus/ixa/ixa/pipe/tok/RuleBasedTokenizerServer.java | RuleBasedTokenizerServer.getAnnotations | private String getAnnotations(final Properties properties,
final String stringFromClient) throws IOException, JDOMException {
BufferedReader breader;
KAFDocument kaf;
String kafString = null;
String lang = properties.getProperty("language");
String outputFormat = properties.getProperty("outputFormat");
Boolean inputKafRaw = Boolean.valueOf(properties.getProperty("inputkaf"));
Boolean noTok = Boolean.valueOf(properties.getProperty("notok"));
String kafVersion = properties.getProperty("kafversion");
Boolean offsets = Boolean.valueOf(properties.getProperty("offsets"));
if (noTok) {
final BufferedReader noTokReader = new BufferedReader(
new StringReader(stringFromClient));
kaf = new KAFDocument(lang, kafVersion);
final KAFDocument.LinguisticProcessor newLp = kaf.addLinguisticProcessor(
"text", "ixa-pipe-tok-notok-" + lang, version + "-" + commit);
newLp.setBeginTimestamp();
Annotate.tokensToKAF(noTokReader, kaf);
newLp.setEndTimestamp();
kafString = kaf.toString();
noTokReader.close();
} else {
if (inputKafRaw) {
final BufferedReader kafReader = new BufferedReader(
new StringReader(stringFromClient));
kaf = KAFDocument.createFromStream(kafReader);
final String text = kaf.getRawText();
final StringReader stringReader = new StringReader(text);
breader = new BufferedReader(stringReader);
} else {
kaf = new KAFDocument(lang, kafVersion);
breader = new BufferedReader(new StringReader(stringFromClient));
}
final Annotate annotator = new Annotate(breader, properties);
if (outputFormat.equalsIgnoreCase("conll")) {
if (offsets) {
kafString = annotator.tokenizeToCoNLL();
} else {
kafString = annotator.tokenizeToCoNLLOffsets();
}
} else if (outputFormat.equalsIgnoreCase("oneline")) {
kafString = annotator.tokenizeToText();
} else {
final KAFDocument.LinguisticProcessor newLp = kaf
.addLinguisticProcessor("text", "ixa-pipe-tok-" + lang,
version + "-" + commit);
newLp.setBeginTimestamp();
annotator.tokenizeToKAF(kaf);
newLp.setEndTimestamp();
kafString = kaf.toString();
}
breader.close();
}
return kafString;
} | java | private String getAnnotations(final Properties properties,
final String stringFromClient) throws IOException, JDOMException {
BufferedReader breader;
KAFDocument kaf;
String kafString = null;
String lang = properties.getProperty("language");
String outputFormat = properties.getProperty("outputFormat");
Boolean inputKafRaw = Boolean.valueOf(properties.getProperty("inputkaf"));
Boolean noTok = Boolean.valueOf(properties.getProperty("notok"));
String kafVersion = properties.getProperty("kafversion");
Boolean offsets = Boolean.valueOf(properties.getProperty("offsets"));
if (noTok) {
final BufferedReader noTokReader = new BufferedReader(
new StringReader(stringFromClient));
kaf = new KAFDocument(lang, kafVersion);
final KAFDocument.LinguisticProcessor newLp = kaf.addLinguisticProcessor(
"text", "ixa-pipe-tok-notok-" + lang, version + "-" + commit);
newLp.setBeginTimestamp();
Annotate.tokensToKAF(noTokReader, kaf);
newLp.setEndTimestamp();
kafString = kaf.toString();
noTokReader.close();
} else {
if (inputKafRaw) {
final BufferedReader kafReader = new BufferedReader(
new StringReader(stringFromClient));
kaf = KAFDocument.createFromStream(kafReader);
final String text = kaf.getRawText();
final StringReader stringReader = new StringReader(text);
breader = new BufferedReader(stringReader);
} else {
kaf = new KAFDocument(lang, kafVersion);
breader = new BufferedReader(new StringReader(stringFromClient));
}
final Annotate annotator = new Annotate(breader, properties);
if (outputFormat.equalsIgnoreCase("conll")) {
if (offsets) {
kafString = annotator.tokenizeToCoNLL();
} else {
kafString = annotator.tokenizeToCoNLLOffsets();
}
} else if (outputFormat.equalsIgnoreCase("oneline")) {
kafString = annotator.tokenizeToText();
} else {
final KAFDocument.LinguisticProcessor newLp = kaf
.addLinguisticProcessor("text", "ixa-pipe-tok-" + lang,
version + "-" + commit);
newLp.setBeginTimestamp();
annotator.tokenizeToKAF(kaf);
newLp.setEndTimestamp();
kafString = kaf.toString();
}
breader.close();
}
return kafString;
} | [
"private",
"String",
"getAnnotations",
"(",
"final",
"Properties",
"properties",
",",
"final",
"String",
"stringFromClient",
")",
"throws",
"IOException",
",",
"JDOMException",
"{",
"BufferedReader",
"breader",
";",
"KAFDocument",
"kaf",
";",
"String",
"kafString",
... | Get tokens.
@param properties
the options
@param stringFromClient
the original string
@return the tokenized string
@throws IOException
if io problems
@throws JDOMException
if NAF problems | [
"Get",
"tokens",
"."
] | train | https://github.com/ixa-ehu/ixa-pipe-tok/blob/be38651a1267be37764b08acce9ee12a87fb61e7/src/main/java/eus/ixa/ixa/pipe/tok/RuleBasedTokenizerServer.java#L175-L231 |
GCRC/nunaliit | nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java | PathComputer.computeContentDir | static public File computeContentDir(File installDir) {
if( null != installDir ) {
// Command-line package
File contentDir = new File(installDir, "content");
if( contentDir.exists() && contentDir.isDirectory() ) {
return contentDir;
}
// Development environment
File nunaliit2Dir = computeNunaliitDir(installDir);
contentDir = new File(nunaliit2Dir, "nunaliit2-couch-sdk/src/main/content");
if( contentDir.exists() && contentDir.isDirectory() ) {
return contentDir;
}
}
return null;
} | java | static public File computeContentDir(File installDir) {
if( null != installDir ) {
// Command-line package
File contentDir = new File(installDir, "content");
if( contentDir.exists() && contentDir.isDirectory() ) {
return contentDir;
}
// Development environment
File nunaliit2Dir = computeNunaliitDir(installDir);
contentDir = new File(nunaliit2Dir, "nunaliit2-couch-sdk/src/main/content");
if( contentDir.exists() && contentDir.isDirectory() ) {
return contentDir;
}
}
return null;
} | [
"static",
"public",
"File",
"computeContentDir",
"(",
"File",
"installDir",
")",
"{",
"if",
"(",
"null",
"!=",
"installDir",
")",
"{",
"// Command-line package",
"File",
"contentDir",
"=",
"new",
"File",
"(",
"installDir",
",",
"\"content\"",
")",
";",
"if",
... | Finds the "content" directory from the installation location
and returns it. If the command-line tool is packaged and
deployed, then the "content" directory is found at the
root of the installation. If the command-line tool is run
from the development environment, then the "content" directory
is found in the SDK sub-project.
@param installDir Directory where the command-line tool is run from.
@return Directory where content is located or null if not found. | [
"Finds",
"the",
"content",
"directory",
"from",
"the",
"installation",
"location",
"and",
"returns",
"it",
".",
"If",
"the",
"command",
"-",
"line",
"tool",
"is",
"packaged",
"and",
"deployed",
"then",
"the",
"content",
"directory",
"is",
"found",
"at",
"the... | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L145-L162 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/retention/policy/TimeBasedRetentionPolicy.java | TimeBasedRetentionPolicy.parseDuration | private static Duration parseDuration(String periodString) {
DateTime zeroEpoc = new DateTime(0);
return new Duration(zeroEpoc, zeroEpoc.plus(ISOPeriodFormat.standard().parsePeriod(periodString)));
} | java | private static Duration parseDuration(String periodString) {
DateTime zeroEpoc = new DateTime(0);
return new Duration(zeroEpoc, zeroEpoc.plus(ISOPeriodFormat.standard().parsePeriod(periodString)));
} | [
"private",
"static",
"Duration",
"parseDuration",
"(",
"String",
"periodString",
")",
"{",
"DateTime",
"zeroEpoc",
"=",
"new",
"DateTime",
"(",
"0",
")",
";",
"return",
"new",
"Duration",
"(",
"zeroEpoc",
",",
"zeroEpoc",
".",
"plus",
"(",
"ISOPeriodFormat",
... | Since months and years can have arbitrary days, joda time does not allow conversion of a period string containing
months or years to a duration. Hence we calculate the duration using 1970 01:01:00:00:00 UTC as a reference time.
<p>
<code>
(1970 01:01:00:00:00 + P2Y) - 1970 01:01:00:00:00 = Duration for 2 years
</code>
</p>
@param periodString
@return duration for this period. | [
"Since",
"months",
"and",
"years",
"can",
"have",
"arbitrary",
"days",
"joda",
"time",
"does",
"not",
"allow",
"conversion",
"of",
"a",
"period",
"string",
"containing",
"months",
"or",
"years",
"to",
"a",
"duration",
".",
"Hence",
"we",
"calculate",
"the",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/retention/policy/TimeBasedRetentionPolicy.java#L114-L117 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.roundedCornersRyDp | @NonNull
public IconicsDrawable roundedCornersRyDp(@Dimension(unit = DP) int sizeDp) {
return roundedCornersRyPx(Utils.convertDpToPx(mContext, sizeDp));
} | java | @NonNull
public IconicsDrawable roundedCornersRyDp(@Dimension(unit = DP) int sizeDp) {
return roundedCornersRyPx(Utils.convertDpToPx(mContext, sizeDp));
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"roundedCornersRyDp",
"(",
"@",
"Dimension",
"(",
"unit",
"=",
"DP",
")",
"int",
"sizeDp",
")",
"{",
"return",
"roundedCornersRyPx",
"(",
"Utils",
".",
"convertDpToPx",
"(",
"mContext",
",",
"sizeDp",
")",
")",
";... | Set rounded corner from dp
@return The current IconicsDrawable for chaining. | [
"Set",
"rounded",
"corner",
"from",
"dp"
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L945-L948 |
virgo47/javasimon | console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java | GetterFactory.getGetter | @SuppressWarnings("unchecked")
public static Getter getGetter(Class type, String name) {
return getGettersAsMap(type).get(name);
} | java | @SuppressWarnings("unchecked")
public static Getter getGetter(Class type, String name) {
return getGettersAsMap(type).get(name);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Getter",
"getGetter",
"(",
"Class",
"type",
",",
"String",
"name",
")",
"{",
"return",
"getGettersAsMap",
"(",
"type",
")",
".",
"get",
"(",
"name",
")",
";",
"}"
] | Search getter for given class and property name.
@param type Class
@param name Property name
@return Getter or null if not found | [
"Search",
"getter",
"for",
"given",
"class",
"and",
"property",
"name",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/reflect/GetterFactory.java#L112-L115 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeOffsets.java | KeyGroupRangeOffsets.getIntersection | public KeyGroupRangeOffsets getIntersection(KeyGroupRange keyGroupRange) {
Preconditions.checkNotNull(keyGroupRange);
KeyGroupRange intersection = this.keyGroupRange.getIntersection(keyGroupRange);
long[] subOffsets = new long[intersection.getNumberOfKeyGroups()];
if(subOffsets.length > 0) {
System.arraycopy(
offsets,
computeKeyGroupIndex(intersection.getStartKeyGroup()),
subOffsets,
0,
subOffsets.length);
}
return new KeyGroupRangeOffsets(intersection, subOffsets);
} | java | public KeyGroupRangeOffsets getIntersection(KeyGroupRange keyGroupRange) {
Preconditions.checkNotNull(keyGroupRange);
KeyGroupRange intersection = this.keyGroupRange.getIntersection(keyGroupRange);
long[] subOffsets = new long[intersection.getNumberOfKeyGroups()];
if(subOffsets.length > 0) {
System.arraycopy(
offsets,
computeKeyGroupIndex(intersection.getStartKeyGroup()),
subOffsets,
0,
subOffsets.length);
}
return new KeyGroupRangeOffsets(intersection, subOffsets);
} | [
"public",
"KeyGroupRangeOffsets",
"getIntersection",
"(",
"KeyGroupRange",
"keyGroupRange",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"keyGroupRange",
")",
";",
"KeyGroupRange",
"intersection",
"=",
"this",
".",
"keyGroupRange",
".",
"getIntersection",
"(",
... | Returns a key-group range with offsets which is the intersection of the internal key-group range with the given
key-group range.
@param keyGroupRange Key-group range to intersect with the internal key-group range.
@return The key-group range with offsets for the intersection of the internal key-group range with the given
key-group range. | [
"Returns",
"a",
"key",
"-",
"group",
"range",
"with",
"offsets",
"which",
"is",
"the",
"intersection",
"of",
"the",
"internal",
"key",
"-",
"group",
"range",
"with",
"the",
"given",
"key",
"-",
"group",
"range",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeOffsets.java#L115-L128 |
basho/riak-java-client | src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java | AnnotationUtil.getIndexes | public static <T> RiakIndexes getIndexes(RiakIndexes container, T domainObject)
{
return AnnotationHelper.getInstance().getIndexes(container, domainObject);
} | java | public static <T> RiakIndexes getIndexes(RiakIndexes container, T domainObject)
{
return AnnotationHelper.getInstance().getIndexes(container, domainObject);
} | [
"public",
"static",
"<",
"T",
">",
"RiakIndexes",
"getIndexes",
"(",
"RiakIndexes",
"container",
",",
"T",
"domainObject",
")",
"{",
"return",
"AnnotationHelper",
".",
"getInstance",
"(",
")",
".",
"getIndexes",
"(",
"container",
",",
"domainObject",
")",
";",... | Attempts to get all the riak indexes from a domain object by looking for
a {@literal @RiakIndexes} annotated member.
<p>
If no indexes are present, an empty RiakIndexes is returned.</p>
@param <T> the type of the domain object
@param domainObject the domain object
@return a RiakIndexes | [
"Attempts",
"to",
"get",
"all",
"the",
"riak",
"indexes",
"from",
"a",
"domain",
"object",
"by",
"looking",
"for",
"a",
"{",
"@literal",
"@RiakIndexes",
"}",
"annotated",
"member",
".",
"<p",
">",
"If",
"no",
"indexes",
"are",
"present",
"an",
"empty",
"... | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java#L209-L212 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java | MyBatis.newScrollingSingleRowSelectStatement | public PreparedStatement newScrollingSingleRowSelectStatement(DbSession session, String sql) {
int fetchSize = database.getDialect().getScrollSingleRowFetchSize();
return newScrollingSelectStatement(session, sql, fetchSize);
} | java | public PreparedStatement newScrollingSingleRowSelectStatement(DbSession session, String sql) {
int fetchSize = database.getDialect().getScrollSingleRowFetchSize();
return newScrollingSelectStatement(session, sql, fetchSize);
} | [
"public",
"PreparedStatement",
"newScrollingSingleRowSelectStatement",
"(",
"DbSession",
"session",
",",
"String",
"sql",
")",
"{",
"int",
"fetchSize",
"=",
"database",
".",
"getDialect",
"(",
")",
".",
"getScrollSingleRowFetchSize",
"(",
")",
";",
"return",
"newScr... | Create a PreparedStatement for SELECT requests with scrolling of results row by row (only one row
in memory at a time) | [
"Create",
"a",
"PreparedStatement",
"for",
"SELECT",
"requests",
"with",
"scrolling",
"of",
"results",
"row",
"by",
"row",
"(",
"only",
"one",
"row",
"in",
"memory",
"at",
"a",
"time",
")"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java#L321-L324 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/postprocessor/google/closure/ClosureGlobalPostProcessor.java | ClosureGlobalPostProcessor.generateBundleModuleArgs | private void generateBundleModuleArgs(List<String> args, Map<String, JoinableResourceBundle> bundleMap,
Map<String, String> resultBundleMapping, JoinableResourceBundle bundle, List<String> dependencies) {
Set<String> bundleDependencies = getClosureModuleDependencies(bundle, dependencies);
// Generate a module for each bundle variant
Map<String, VariantSet> bundleVariants = bundle.getVariants();
List<Map<String, String>> variants = VariantUtils.getAllVariants(bundleVariants);
// Add default variant
if (variants.isEmpty()) {
variants.add(null);
}
for (Map<String, String> variant : variants) {
String jsFile = VariantUtils.getVariantBundleName(bundle.getId(), variant, false);
String moduleName = VariantUtils.getVariantBundleName(bundle.getName(), variant, false);
resultBundleMapping.put(moduleName, jsFile);
StringBuilder moduleArg = new StringBuilder();
moduleArg.append(moduleName + ":1:");
for (String dep : bundleDependencies) {
// Check module dependencies
checkBundleName(dep, bundleMap);
JoinableResourceBundle dependencyBundle = bundleMap.get(dep);
// Generate a module for each bundle variant
List<String> depVariantKeys = VariantUtils
.getAllVariantKeysFromFixedVariants(dependencyBundle.getVariants(), variant);
for (String depVariantKey : depVariantKeys) {
String depBundleName = VariantUtils.getVariantBundleName(dep, depVariantKey, false);
moduleArg.append(depBundleName);
moduleArg.append(MODULE_DEPENDENCIES_SEPARATOR);
}
}
moduleArg.append(JAWR_ROOT_MODULE_NAME);
addModuleArg(jsFile, moduleName, args, moduleArg);
}
} | java | private void generateBundleModuleArgs(List<String> args, Map<String, JoinableResourceBundle> bundleMap,
Map<String, String> resultBundleMapping, JoinableResourceBundle bundle, List<String> dependencies) {
Set<String> bundleDependencies = getClosureModuleDependencies(bundle, dependencies);
// Generate a module for each bundle variant
Map<String, VariantSet> bundleVariants = bundle.getVariants();
List<Map<String, String>> variants = VariantUtils.getAllVariants(bundleVariants);
// Add default variant
if (variants.isEmpty()) {
variants.add(null);
}
for (Map<String, String> variant : variants) {
String jsFile = VariantUtils.getVariantBundleName(bundle.getId(), variant, false);
String moduleName = VariantUtils.getVariantBundleName(bundle.getName(), variant, false);
resultBundleMapping.put(moduleName, jsFile);
StringBuilder moduleArg = new StringBuilder();
moduleArg.append(moduleName + ":1:");
for (String dep : bundleDependencies) {
// Check module dependencies
checkBundleName(dep, bundleMap);
JoinableResourceBundle dependencyBundle = bundleMap.get(dep);
// Generate a module for each bundle variant
List<String> depVariantKeys = VariantUtils
.getAllVariantKeysFromFixedVariants(dependencyBundle.getVariants(), variant);
for (String depVariantKey : depVariantKeys) {
String depBundleName = VariantUtils.getVariantBundleName(dep, depVariantKey, false);
moduleArg.append(depBundleName);
moduleArg.append(MODULE_DEPENDENCIES_SEPARATOR);
}
}
moduleArg.append(JAWR_ROOT_MODULE_NAME);
addModuleArg(jsFile, moduleName, args, moduleArg);
}
} | [
"private",
"void",
"generateBundleModuleArgs",
"(",
"List",
"<",
"String",
">",
"args",
",",
"Map",
"<",
"String",
",",
"JoinableResourceBundle",
">",
"bundleMap",
",",
"Map",
"<",
"String",
",",
"String",
">",
"resultBundleMapping",
",",
"JoinableResourceBundle",... | Generates the bundle module arguments for the closure compiler
@param args
the current list of arguments
@param bundleMap
the bundle map
@param resultBundleMapping
the result bundle mapping
@param bundle
the current bundle
@param dependencies
the dependencies | [
"Generates",
"the",
"bundle",
"module",
"arguments",
"for",
"the",
"closure",
"compiler"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/postprocessor/google/closure/ClosureGlobalPostProcessor.java#L470-L512 |
Azure/azure-sdk-for-java | resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/DeploymentOperationsInner.java | DeploymentOperationsInner.listByResourceGroupAsync | public Observable<Page<DeploymentOperationInner>> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName, final Integer top) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName, top)
.map(new Func1<ServiceResponse<Page<DeploymentOperationInner>>, Page<DeploymentOperationInner>>() {
@Override
public Page<DeploymentOperationInner> call(ServiceResponse<Page<DeploymentOperationInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<DeploymentOperationInner>> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName, final Integer top) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, deploymentName, top)
.map(new Func1<ServiceResponse<Page<DeploymentOperationInner>>, Page<DeploymentOperationInner>>() {
@Override
public Page<DeploymentOperationInner> call(ServiceResponse<Page<DeploymentOperationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DeploymentOperationInner",
">",
">",
"listByResourceGroupAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"deploymentName",
",",
"final",
"Integer",
"top",
")",
"{",
"return",
"listByResourceGroupW... | Gets all deployments operations for a deployment.
@param resourceGroupName The name of the resource group. The name is case insensitive.
@param deploymentName The name of the deployment with the operation to get.
@param top The number of results to return.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DeploymentOperationInner> object | [
"Gets",
"all",
"deployments",
"operations",
"for",
"a",
"deployment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/DeploymentOperationsInner.java#L336-L344 |
cdk/cdk | base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java | SmilesValencyChecker.isUnsaturated | public boolean isUnsaturated(IBond bond, IAtomContainer atomContainer) throws CDKException {
logger.debug("isBondUnsaturated?: ", bond);
IAtom[] atoms = BondManipulator.getAtomArray(bond);
boolean isUnsaturated = true;
for (int i = 0; i < atoms.length && isUnsaturated; i++) {
isUnsaturated = isUnsaturated && !isSaturated(atoms[i], atomContainer);
}
logger.debug("Bond is unsaturated?: ", isUnsaturated);
return isUnsaturated;
} | java | public boolean isUnsaturated(IBond bond, IAtomContainer atomContainer) throws CDKException {
logger.debug("isBondUnsaturated?: ", bond);
IAtom[] atoms = BondManipulator.getAtomArray(bond);
boolean isUnsaturated = true;
for (int i = 0; i < atoms.length && isUnsaturated; i++) {
isUnsaturated = isUnsaturated && !isSaturated(atoms[i], atomContainer);
}
logger.debug("Bond is unsaturated?: ", isUnsaturated);
return isUnsaturated;
} | [
"public",
"boolean",
"isUnsaturated",
"(",
"IBond",
"bond",
",",
"IAtomContainer",
"atomContainer",
")",
"throws",
"CDKException",
"{",
"logger",
".",
"debug",
"(",
"\"isBondUnsaturated?: \"",
",",
"bond",
")",
";",
"IAtom",
"[",
"]",
"atoms",
"=",
"BondManipula... | Returns whether a bond is unsaturated. A bond is unsaturated if
<b>all</b> Atoms in the bond are unsaturated. | [
"Returns",
"whether",
"a",
"bond",
"is",
"unsaturated",
".",
"A",
"bond",
"is",
"unsaturated",
"if",
"<b",
">",
"all<",
"/",
"b",
">",
"Atoms",
"in",
"the",
"bond",
"are",
"unsaturated",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java#L148-L157 |
amaembo/streamex | src/main/java/one/util/streamex/MoreCollectors.java | MoreCollectors.groupingByEnum | public static <T, K extends Enum<K>, A, D> Collector<T, ?, EnumMap<K, D>> groupingByEnum(Class<K> enumClass,
Function<? super T, K> classifier, Collector<? super T, A, D> downstream) {
return groupingBy(classifier, EnumSet.allOf(enumClass), () -> new EnumMap<>(enumClass), downstream);
} | java | public static <T, K extends Enum<K>, A, D> Collector<T, ?, EnumMap<K, D>> groupingByEnum(Class<K> enumClass,
Function<? super T, K> classifier, Collector<? super T, A, D> downstream) {
return groupingBy(classifier, EnumSet.allOf(enumClass), () -> new EnumMap<>(enumClass), downstream);
} | [
"public",
"static",
"<",
"T",
",",
"K",
"extends",
"Enum",
"<",
"K",
">",
",",
"A",
",",
"D",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"EnumMap",
"<",
"K",
",",
"D",
">",
">",
"groupingByEnum",
"(",
"Class",
"<",
"K",
">",
"enumClass",
",",
... | Returns a {@code Collector} implementing a cascaded "group by" operation
on input elements of type {@code T}, for classification function which
maps input elements to the enum values. The downstream reduction for
repeating keys is performed using the specified downstream
{@code Collector}.
<p>
Unlike the {@link Collectors#groupingBy(Function, Collector)} collector
this collector produces an {@link EnumMap} which contains all possible
keys including keys which were never returned by the classification
function. These keys are mapped to the default collector value which is
equivalent to collecting an empty stream with the same collector.
<p>
This method returns a
<a href="package-summary.html#ShortCircuitReduction">short-circuiting
collector</a> if the downstream collector is short-circuiting. The
collection might stop when for every possible enum key the downstream
collection is known to be finished.
@param <T> the type of the input elements
@param <K> the type of the enum values returned by the classifier
@param <A> the intermediate accumulation type of the downstream collector
@param <D> the result type of the downstream reduction
@param enumClass the class of enum values returned by the classifier
@param classifier a classifier function mapping input elements to enum
values
@param downstream a {@code Collector} implementing the downstream
reduction
@return a {@code Collector} implementing the cascaded group-by operation
@see Collectors#groupingBy(Function, Collector)
@see #groupingBy(Function, Set, Supplier, Collector)
@since 0.3.7 | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"implementing",
"a",
"cascaded",
"group",
"by",
"operation",
"on",
"input",
"elements",
"of",
"type",
"{",
"@code",
"T",
"}",
"for",
"classification",
"function",
"which",
"maps",
"input",
"elements",
"to",
"th... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/MoreCollectors.java#L901-L904 |
aws/aws-sdk-java | aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/model/Configuration.java | Configuration.withProperties | public Configuration withProperties(java.util.Map<String, String> properties) {
setProperties(properties);
return this;
} | java | public Configuration withProperties(java.util.Map<String, String> properties) {
setProperties(properties);
return this;
} | [
"public",
"Configuration",
"withProperties",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"setProperties",
"(",
"properties",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A set of properties specified within a configuration classification.
</p>
@param properties
A set of properties specified within a configuration classification.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"set",
"of",
"properties",
"specified",
"within",
"a",
"configuration",
"classification",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/model/Configuration.java#L210-L213 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/gsi/stores/PEMKeyStore.java | PEMKeyStore.engineStore | @Override
public void engineStore(OutputStream outputStream, char[] chars)
throws IOException, NoSuchAlgorithmException, CertificateException {
for (SecurityObjectWrapper<?> object : this.aliasObjectMap.values()) {
if (object instanceof Storable) {
try {
((Storable) object).store();
} catch (ResourceStoreException e) {
throw new CertificateException(e);
}
}
}
} | java | @Override
public void engineStore(OutputStream outputStream, char[] chars)
throws IOException, NoSuchAlgorithmException, CertificateException {
for (SecurityObjectWrapper<?> object : this.aliasObjectMap.values()) {
if (object instanceof Storable) {
try {
((Storable) object).store();
} catch (ResourceStoreException e) {
throw new CertificateException(e);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"engineStore",
"(",
"OutputStream",
"outputStream",
",",
"char",
"[",
"]",
"chars",
")",
"throws",
"IOException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
"{",
"for",
"(",
"SecurityObjectWrapper",
"<",
"?",
"... | Persist the security material in this keystore. If the object has a path
associated with it, the object will be persisted to that path. Otherwise
it will be stored in the default certificate directory. As a result, the
parameters of this method are ignored.
@param outputStream
This parameter is ignored.
@param chars
This parameter is ignored.
@throws IOException
@throws NoSuchAlgorithmException
@throws CertificateException | [
"Persist",
"the",
"security",
"material",
"in",
"this",
"keystore",
".",
"If",
"the",
"object",
"has",
"a",
"path",
"associated",
"with",
"it",
"the",
"object",
"will",
"be",
"persisted",
"to",
"that",
"path",
".",
"Otherwise",
"it",
"will",
"be",
"stored"... | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/stores/PEMKeyStore.java#L187-L199 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java | AbstractTreeMap.subMap | public SortedMap subMap(Object startKey, Object endKey) {
if (comparator == null) {
if (((Comparable) startKey).compareTo(endKey) <= 0)
return makeSubMap(startKey, endKey);
} else {
if (comparator.compare(startKey, endKey) <= 0)
return makeSubMap(startKey, endKey);
}
throw new IllegalArgumentException();
} | java | public SortedMap subMap(Object startKey, Object endKey) {
if (comparator == null) {
if (((Comparable) startKey).compareTo(endKey) <= 0)
return makeSubMap(startKey, endKey);
} else {
if (comparator.compare(startKey, endKey) <= 0)
return makeSubMap(startKey, endKey);
}
throw new IllegalArgumentException();
} | [
"public",
"SortedMap",
"subMap",
"(",
"Object",
"startKey",
",",
"Object",
"endKey",
")",
"{",
"if",
"(",
"comparator",
"==",
"null",
")",
"{",
"if",
"(",
"(",
"(",
"Comparable",
")",
"startKey",
")",
".",
"compareTo",
"(",
"endKey",
")",
"<=",
"0",
... | Answers a SortedMap of the specified portion of this TreeMap which
contains keys greater or equal to the start key but less than the end
key. The returned SortedMap is backed by this TreeMap so changes to one
are reflected by the other.
@param startKey the start key
@param endKey the end key
@return a submap where the keys are greater or equal to
<code>startKey</code> and less than <code>endKey</code>
@exception ClassCastException
when the start or end key cannot be compared with the keys
in this TreeMap
@exception NullPointerException
when the start or end key is null and the comparator
cannot handle null | [
"Answers",
"a",
"SortedMap",
"of",
"the",
"specified",
"portion",
"of",
"this",
"TreeMap",
"which",
"contains",
"keys",
"greater",
"or",
"equal",
"to",
"the",
"start",
"key",
"but",
"less",
"than",
"the",
"end",
"key",
".",
"The",
"returned",
"SortedMap",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L1103-L1112 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/Box.java | Box.getAbsoluteContainingBlock | public Rectangle getAbsoluteContainingBlock()
{
if (cbox instanceof Viewport) //initial containing block
{
Rectangle ab = cbox.getAbsoluteBounds(); //normally positioned at 0,0; other value for nested viewports (e.g. objects)
Rectangle visible = ((Viewport) cbox).getVisibleRect();
return new Rectangle(ab.x, ab.y, visible.width, visible.height);
}
else //static or relative position
return cbox.getAbsoluteContentBounds();
} | java | public Rectangle getAbsoluteContainingBlock()
{
if (cbox instanceof Viewport) //initial containing block
{
Rectangle ab = cbox.getAbsoluteBounds(); //normally positioned at 0,0; other value for nested viewports (e.g. objects)
Rectangle visible = ((Viewport) cbox).getVisibleRect();
return new Rectangle(ab.x, ab.y, visible.width, visible.height);
}
else //static or relative position
return cbox.getAbsoluteContentBounds();
} | [
"public",
"Rectangle",
"getAbsoluteContainingBlock",
"(",
")",
"{",
"if",
"(",
"cbox",
"instanceof",
"Viewport",
")",
"//initial containing block",
"{",
"Rectangle",
"ab",
"=",
"cbox",
".",
"getAbsoluteBounds",
"(",
")",
";",
"//normally positioned at 0,0; other value f... | Obtains the containing block absolute bounds.
@return the containing block absolute bounds. | [
"Obtains",
"the",
"containing",
"block",
"absolute",
"bounds",
"."
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/Box.java#L538-L548 |
wcm-io/wcm-io-tooling | commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java | ContentPackage.addFile | public void addFile(String path, InputStream inputStream) throws IOException {
addFile(path, inputStream, null);
} | java | public void addFile(String path, InputStream inputStream) throws IOException {
addFile(path, inputStream, null);
} | [
"public",
"void",
"addFile",
"(",
"String",
"path",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"addFile",
"(",
"path",
",",
"inputStream",
",",
"null",
")",
";",
"}"
] | Adds a binary file.
@param path Full content path and file name of file
@param inputStream Input stream with binary dta
@throws IOException I/O exception | [
"Adds",
"a",
"binary",
"file",
"."
] | train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java#L177-L179 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/tree/AccountItemTree.java | AccountItemTree.mergeWithProposedItems | public void mergeWithProposedItems(final List<InvoiceItem> proposedItems) {
build();
for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
tree.flatten(true);
}
for (InvoiceItem item : proposedItems) {
final UUID subscriptionId = getSubscriptionId(item, null);
SubscriptionItemTree tree = subscriptionItemTree.get(subscriptionId);
if (tree == null) {
tree = new SubscriptionItemTree(subscriptionId, targetInvoiceId);
subscriptionItemTree.put(subscriptionId, tree);
}
tree.mergeProposedItem(item);
}
for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
tree.buildForMerge();
}
} | java | public void mergeWithProposedItems(final List<InvoiceItem> proposedItems) {
build();
for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
tree.flatten(true);
}
for (InvoiceItem item : proposedItems) {
final UUID subscriptionId = getSubscriptionId(item, null);
SubscriptionItemTree tree = subscriptionItemTree.get(subscriptionId);
if (tree == null) {
tree = new SubscriptionItemTree(subscriptionId, targetInvoiceId);
subscriptionItemTree.put(subscriptionId, tree);
}
tree.mergeProposedItem(item);
}
for (SubscriptionItemTree tree : subscriptionItemTree.values()) {
tree.buildForMerge();
}
} | [
"public",
"void",
"mergeWithProposedItems",
"(",
"final",
"List",
"<",
"InvoiceItem",
">",
"proposedItems",
")",
"{",
"build",
"(",
")",
";",
"for",
"(",
"SubscriptionItemTree",
"tree",
":",
"subscriptionItemTree",
".",
"values",
"(",
")",
")",
"{",
"tree",
... | Rebuild the new tree by merging current on-disk existing view with new proposed list.
@param proposedItems list of proposed item that should be merged with current existing view | [
"Rebuild",
"the",
"new",
"tree",
"by",
"merging",
"current",
"on",
"-",
"disk",
"existing",
"view",
"with",
"new",
"proposed",
"list",
"."
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/AccountItemTree.java#L154-L174 |
apereo/cas | support/cas-server-support-consent-webflow/src/main/java/org/apereo/cas/web/flow/CheckConsentRequiredAction.java | CheckConsentRequiredAction.determineConsentEvent | protected String determineConsentEvent(final RequestContext requestContext) {
val webService = WebUtils.getService(requestContext);
val service = this.authenticationRequestServiceSelectionStrategies.resolveService(webService);
if (service == null) {
return null;
}
val registeredService = getRegisteredServiceForConsent(requestContext, service);
val authentication = WebUtils.getAuthentication(requestContext);
if (authentication == null) {
return null;
}
return isConsentRequired(service, registeredService, authentication, requestContext);
} | java | protected String determineConsentEvent(final RequestContext requestContext) {
val webService = WebUtils.getService(requestContext);
val service = this.authenticationRequestServiceSelectionStrategies.resolveService(webService);
if (service == null) {
return null;
}
val registeredService = getRegisteredServiceForConsent(requestContext, service);
val authentication = WebUtils.getAuthentication(requestContext);
if (authentication == null) {
return null;
}
return isConsentRequired(service, registeredService, authentication, requestContext);
} | [
"protected",
"String",
"determineConsentEvent",
"(",
"final",
"RequestContext",
"requestContext",
")",
"{",
"val",
"webService",
"=",
"WebUtils",
".",
"getService",
"(",
"requestContext",
")",
";",
"val",
"service",
"=",
"this",
".",
"authenticationRequestServiceSelec... | Determine consent event string.
@param requestContext the request context
@return the string | [
"Determine",
"consent",
"event",
"string",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-consent-webflow/src/main/java/org/apereo/cas/web/flow/CheckConsentRequiredAction.java#L53-L68 |
zafarkhaja/jsemver | src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java | ExpressionParser.parsePartialVersionRange | private CompositeExpression parsePartialVersionRange() {
int major = intOf(consumeNextToken(NUMERIC).lexeme);
if (!tokens.positiveLookahead(DOT)) {
return gte(versionFor(major)).and(lt(versionFor(major + 1)));
}
consumeNextToken(DOT);
int minor = intOf(consumeNextToken(NUMERIC).lexeme);
return gte(versionFor(major, minor)).and(lt(versionFor(major, minor + 1)));
} | java | private CompositeExpression parsePartialVersionRange() {
int major = intOf(consumeNextToken(NUMERIC).lexeme);
if (!tokens.positiveLookahead(DOT)) {
return gte(versionFor(major)).and(lt(versionFor(major + 1)));
}
consumeNextToken(DOT);
int minor = intOf(consumeNextToken(NUMERIC).lexeme);
return gte(versionFor(major, minor)).and(lt(versionFor(major, minor + 1)));
} | [
"private",
"CompositeExpression",
"parsePartialVersionRange",
"(",
")",
"{",
"int",
"major",
"=",
"intOf",
"(",
"consumeNextToken",
"(",
"NUMERIC",
")",
".",
"lexeme",
")",
";",
"if",
"(",
"!",
"tokens",
".",
"positiveLookahead",
"(",
"DOT",
")",
")",
"{",
... | Parses the {@literal <partial-version-range>} non-terminal.
<pre>
{@literal
<partial-version-range> ::= <major> | <major> "." <minor>
}
</pre>
@return the expression AST | [
"Parses",
"the",
"{",
"@literal",
"<partial",
"-",
"version",
"-",
"range",
">",
"}",
"non",
"-",
"terminal",
"."
] | train | https://github.com/zafarkhaja/jsemver/blob/1f4996ea3dab06193c378fd66fd4f8fdc8334cc6/src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java#L389-L397 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_hunting_queue_queueId_PUT | public void billingAccount_ovhPabx_serviceName_hunting_queue_queueId_PUT(String billingAccount, String serviceName, Long queueId, OvhOvhPabxHuntingQueue body) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, queueId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_ovhPabx_serviceName_hunting_queue_queueId_PUT(String billingAccount, String serviceName, Long queueId, OvhOvhPabxHuntingQueue body) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, queueId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_ovhPabx_serviceName_hunting_queue_queueId_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"queueId",
",",
"OvhOvhPabxHuntingQueue",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/t... | Alter this object properties
REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param queueId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6717-L6721 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java | CmsSitemapHoverbar.installOn | public static void installOn(
CmsSitemapController controller,
CmsTreeItem treeItem,
CmsUUID entryId,
String sitePath,
boolean contextmenu) {
CmsSitemapHoverbar hoverbar = new CmsSitemapHoverbar(controller, entryId, sitePath, contextmenu);
installHoverbar(hoverbar, treeItem.getListItemWidget());
} | java | public static void installOn(
CmsSitemapController controller,
CmsTreeItem treeItem,
CmsUUID entryId,
String sitePath,
boolean contextmenu) {
CmsSitemapHoverbar hoverbar = new CmsSitemapHoverbar(controller, entryId, sitePath, contextmenu);
installHoverbar(hoverbar, treeItem.getListItemWidget());
} | [
"public",
"static",
"void",
"installOn",
"(",
"CmsSitemapController",
"controller",
",",
"CmsTreeItem",
"treeItem",
",",
"CmsUUID",
"entryId",
",",
"String",
"sitePath",
",",
"boolean",
"contextmenu",
")",
"{",
"CmsSitemapHoverbar",
"hoverbar",
"=",
"new",
"CmsSitem... | Installs a hover bar for the given item widget.<p>
@param controller the controller
@param treeItem the item to hover
@param entryId the entry id
@param sitePath the entry site path
@param contextmenu flag to control whether the context menu should be shown | [
"Installs",
"a",
"hover",
"bar",
"for",
"the",
"given",
"item",
"widget",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsSitemapHoverbar.java#L213-L222 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java | CareWebUtil.associateCSH | public static void associateCSH(BaseUIComponent component, HelpContext context) {
HelpUtil.associateCSH(component, context, getShell());
} | java | public static void associateCSH(BaseUIComponent component, HelpContext context) {
HelpUtil.associateCSH(component, context, getShell());
} | [
"public",
"static",
"void",
"associateCSH",
"(",
"BaseUIComponent",
"component",
",",
"HelpContext",
"context",
")",
"{",
"HelpUtil",
".",
"associateCSH",
"(",
"component",
",",
"context",
",",
"getShell",
"(",
")",
")",
";",
"}"
] | Associates help context with a component.
@param component The component.
@param context The help context. | [
"Associates",
"help",
"context",
"with",
"a",
"component",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java#L135-L137 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowpolicy_binding.java | appflowpolicy_binding.get | public static appflowpolicy_binding get(nitro_service service, String name) throws Exception{
appflowpolicy_binding obj = new appflowpolicy_binding();
obj.set_name(name);
appflowpolicy_binding response = (appflowpolicy_binding) obj.get_resource(service);
return response;
} | java | public static appflowpolicy_binding get(nitro_service service, String name) throws Exception{
appflowpolicy_binding obj = new appflowpolicy_binding();
obj.set_name(name);
appflowpolicy_binding response = (appflowpolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"appflowpolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"appflowpolicy_binding",
"obj",
"=",
"new",
"appflowpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
... | Use this API to fetch appflowpolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appflowpolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowpolicy_binding.java#L136-L141 |
alkacon/opencms-core | src/org/opencms/jsp/decorator/CmsDecorationDefintion.java | CmsDecorationDefintion.getDecorationMaps | private List<CmsDecorationMap> getDecorationMaps(CmsObject cms, List<CmsResource> decorationListFiles) {
List<CmsDecorationMap> decorationMaps = new ArrayList<CmsDecorationMap>();
Iterator<CmsResource> i = decorationListFiles.iterator();
while (i.hasNext()) {
CmsResource res = i.next();
try {
CmsDecorationMap decMap = (CmsDecorationMap)CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject(
cms,
res.getRootPath());
if (decMap == null) {
decMap = new CmsDecorationMap(cms, res, this);
CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(cms, res.getRootPath(), decMap);
}
decorationMaps.add(decMap);
} catch (CmsException e) {
if (LOG.isErrorEnabled()) {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_DECORATION_DEFINITION_CREATE_MAP_2,
res.getName(),
e));
}
}
}
return decorationMaps;
} | java | private List<CmsDecorationMap> getDecorationMaps(CmsObject cms, List<CmsResource> decorationListFiles) {
List<CmsDecorationMap> decorationMaps = new ArrayList<CmsDecorationMap>();
Iterator<CmsResource> i = decorationListFiles.iterator();
while (i.hasNext()) {
CmsResource res = i.next();
try {
CmsDecorationMap decMap = (CmsDecorationMap)CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject(
cms,
res.getRootPath());
if (decMap == null) {
decMap = new CmsDecorationMap(cms, res, this);
CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(cms, res.getRootPath(), decMap);
}
decorationMaps.add(decMap);
} catch (CmsException e) {
if (LOG.isErrorEnabled()) {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_DECORATION_DEFINITION_CREATE_MAP_2,
res.getName(),
e));
}
}
}
return decorationMaps;
} | [
"private",
"List",
"<",
"CmsDecorationMap",
">",
"getDecorationMaps",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"CmsResource",
">",
"decorationListFiles",
")",
"{",
"List",
"<",
"CmsDecorationMap",
">",
"decorationMaps",
"=",
"new",
"ArrayList",
"<",
"CmsDecorati... | Creates a list of decoration map objects from a given list of decoration files.<p>
@param cms the CmsObject
@param decorationListFiles the list of decoration files
@return list of decoration map objects | [
"Creates",
"a",
"list",
"of",
"decoration",
"map",
"objects",
"from",
"a",
"given",
"list",
"of",
"decoration",
"files",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/decorator/CmsDecorationDefintion.java#L452-L479 |
omadahealth/CircularBarPager | library/src/main/java/com/github/omadahealth/circularbarpager/library/CircularBarPager.java | CircularBarPager.initializeView | private void initializeView(AttributeSet attrs, int defStyleAttr) {
if (attrs != null) {
final TypedArray attributes = mContext.getTheme().obtainStyledAttributes(attrs, R.styleable.CircularViewPager,
defStyleAttr, 0);
boolean enableOnClick = attributes.getBoolean(R.styleable.CircularViewPager_progress_pager_on_click_enabled, false);
isPaddingSet = false;
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.circularbar_view_pager, this);
mCircularBar = (CircularBar) view.findViewById(R.id.circular_bar);
mViewPager = (ViewPager) view.findViewById(R.id.view_pager);
mCirclePageIndicator = (CirclePageIndicator) view.findViewById(R.id.circle_page_indicator);
//Default init
if(mCircularBar != null){
mCircularBar.loadStyledAttributes(attrs, defStyleAttr);
}
if(mViewPager != null){
mViewPager.setPageTransformer(false, new FadeViewPagerTransformer());
}
//If we enable onClick, ie. we can switch between pages with both a swipe and a touch
//Touch just goes to the next page % number of pages
if (enableOnClick) {
final GestureDetectorCompat tapGestureDetector = new GestureDetectorCompat(getContext(), new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
mViewPager.setCurrentItem((mViewPager.getCurrentItem() + 1) % mViewPager.getAdapter().getCount());
return super.onSingleTapConfirmed(e);
}
});
if(mViewPager != null){
mViewPager.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
tapGestureDetector.onTouchEvent(event);
return false;
}
});
}
}
}
} | java | private void initializeView(AttributeSet attrs, int defStyleAttr) {
if (attrs != null) {
final TypedArray attributes = mContext.getTheme().obtainStyledAttributes(attrs, R.styleable.CircularViewPager,
defStyleAttr, 0);
boolean enableOnClick = attributes.getBoolean(R.styleable.CircularViewPager_progress_pager_on_click_enabled, false);
isPaddingSet = false;
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.circularbar_view_pager, this);
mCircularBar = (CircularBar) view.findViewById(R.id.circular_bar);
mViewPager = (ViewPager) view.findViewById(R.id.view_pager);
mCirclePageIndicator = (CirclePageIndicator) view.findViewById(R.id.circle_page_indicator);
//Default init
if(mCircularBar != null){
mCircularBar.loadStyledAttributes(attrs, defStyleAttr);
}
if(mViewPager != null){
mViewPager.setPageTransformer(false, new FadeViewPagerTransformer());
}
//If we enable onClick, ie. we can switch between pages with both a swipe and a touch
//Touch just goes to the next page % number of pages
if (enableOnClick) {
final GestureDetectorCompat tapGestureDetector = new GestureDetectorCompat(getContext(), new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
mViewPager.setCurrentItem((mViewPager.getCurrentItem() + 1) % mViewPager.getAdapter().getCount());
return super.onSingleTapConfirmed(e);
}
});
if(mViewPager != null){
mViewPager.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
tapGestureDetector.onTouchEvent(event);
return false;
}
});
}
}
}
} | [
"private",
"void",
"initializeView",
"(",
"AttributeSet",
"attrs",
",",
"int",
"defStyleAttr",
")",
"{",
"if",
"(",
"attrs",
"!=",
"null",
")",
"{",
"final",
"TypedArray",
"attributes",
"=",
"mContext",
".",
"getTheme",
"(",
")",
".",
"obtainStyledAttributes",... | Init the view by getting the {@link CircularBar},
the {@link android.support.v4.view.ViewPager} and the {@link com.viewpagerindicator.CirclePageIndicator}.
Init also some default values as PageTranformer etc... | [
"Init",
"the",
"view",
"by",
"getting",
"the",
"{"
] | train | https://github.com/omadahealth/CircularBarPager/blob/3a43e8828849da727fd13345e83b8432f7271155/library/src/main/java/com/github/omadahealth/circularbarpager/library/CircularBarPager.java#L102-L148 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photosets/comments/PhotosetsCommentsInterface.java | PhotosetsCommentsInterface.addComment | public String addComment(String photosetId, String commentText) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_ADD_COMMENT);
parameters.put("photoset_id", photosetId);
parameters.put("comment_text", commentText);
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// response:
// <comment id="97777-12492-72057594037942601" />
Element commentElement = response.getPayload();
return commentElement.getAttribute("id");
} | java | public String addComment(String photosetId, String commentText) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_ADD_COMMENT);
parameters.put("photoset_id", photosetId);
parameters.put("comment_text", commentText);
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// response:
// <comment id="97777-12492-72057594037942601" />
Element commentElement = response.getPayload();
return commentElement.getAttribute("id");
} | [
"public",
"String",
"addComment",
"(",
"String",
"photosetId",
",",
"String",
"commentText",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
... | Add a comment to a photoset. This method requires authentication with 'write' permission.
@param photosetId
The id of the photoset to add a comment to.
@param commentText
Text of the comment
@return the comment id
@throws FlickrException | [
"Add",
"a",
"comment",
"to",
"a",
"photoset",
".",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/comments/PhotosetsCommentsInterface.java#L55-L71 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateIntegrationRequest.java | UpdateIntegrationRequest.withRequestParameters | public UpdateIntegrationRequest withRequestParameters(java.util.Map<String, String> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | java | public UpdateIntegrationRequest withRequestParameters(java.util.Map<String, String> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | [
"public",
"UpdateIntegrationRequest",
"withRequestParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestParameters",
")",
"{",
"setRequestParameters",
"(",
"requestParameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A key-value map specifying request parameters that are passed from the method request to the backend. The key is
an integration request parameter name and the associated value is a method request parameter value or static
value that must be enclosed within single quotes and pre-encoded as required by the backend. The method request
parameter value must match the pattern of method.request.{location}.{name} , where {location} is querystring,
path, or header; and {name} must be a valid and unique method request parameter name.
</p>
@param requestParameters
A key-value map specifying request parameters that are passed from the method request to the backend. The
key is an integration request parameter name and the associated value is a method request parameter value
or static value that must be enclosed within single quotes and pre-encoded as required by the backend. The
method request parameter value must match the pattern of method.request.{location}.{name} , where
{location} is querystring, path, or header; and {name} must be a valid and unique method request parameter
name.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"key",
"-",
"value",
"map",
"specifying",
"request",
"parameters",
"that",
"are",
"passed",
"from",
"the",
"method",
"request",
"to",
"the",
"backend",
".",
"The",
"key",
"is",
"an",
"integration",
"request",
"parameter",
"name",
"and",
"th... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateIntegrationRequest.java#L1134-L1137 |
finmath/finmath-lib | src/main/java6/net/finmath/randomnumbers/HaltonSequence.java | HaltonSequence.getHaltonNumberForGivenBase | public static double getHaltonNumberForGivenBase(long index, int base) {
index += 1;
double x = 0.0;
double factor = 1.0 / base;
while(index > 0) {
x += (index % base) * factor;
factor /= base;
index /= base;
}
return x;
} | java | public static double getHaltonNumberForGivenBase(long index, int base) {
index += 1;
double x = 0.0;
double factor = 1.0 / base;
while(index > 0) {
x += (index % base) * factor;
factor /= base;
index /= base;
}
return x;
} | [
"public",
"static",
"double",
"getHaltonNumberForGivenBase",
"(",
"long",
"index",
",",
"int",
"base",
")",
"{",
"index",
"+=",
"1",
";",
"double",
"x",
"=",
"0.0",
";",
"double",
"factor",
"=",
"1.0",
"/",
"base",
";",
"while",
"(",
"index",
">",
"0",... | Return a Halton number, sequence starting at index = 0, base > 1.
@param index The index of the sequence.
@param base The base of the sequence. Has to be greater than one (this is not checked).
@return The Halton number. | [
"Return",
"a",
"Halton",
"number",
"sequence",
"starting",
"at",
"index",
"=",
"0",
"base",
">",
";",
"1",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/randomnumbers/HaltonSequence.java#L66-L78 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java | Segment3dfx.y1Property | @Pure
public DoubleProperty y1Property() {
if (this.p1.y == null) {
this.p1.y = new SimpleDoubleProperty(this, MathFXAttributeNames.Y1);
}
return this.p1.y;
} | java | @Pure
public DoubleProperty y1Property() {
if (this.p1.y == null) {
this.p1.y = new SimpleDoubleProperty(this, MathFXAttributeNames.Y1);
}
return this.p1.y;
} | [
"@",
"Pure",
"public",
"DoubleProperty",
"y1Property",
"(",
")",
"{",
"if",
"(",
"this",
".",
"p1",
".",
"y",
"==",
"null",
")",
"{",
"this",
".",
"p1",
".",
"y",
"=",
"new",
"SimpleDoubleProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"Y1",
... | Replies the property that is the y coordinate of the first segment point.
@return the y1 property. | [
"Replies",
"the",
"property",
"that",
"is",
"the",
"y",
"coordinate",
"of",
"the",
"first",
"segment",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java#L223-L229 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java | PropertiesConfigHelper.getCustomBundlePropertyAsSet | public Set<String> getCustomBundlePropertyAsSet(String bundleName, String key) {
Set<String> propertiesSet = new HashSet<>();
StringTokenizer tk = new StringTokenizer(getCustomBundleProperty(bundleName, key, ""), ",");
while (tk.hasMoreTokens())
propertiesSet.add(tk.nextToken().trim());
return propertiesSet;
} | java | public Set<String> getCustomBundlePropertyAsSet(String bundleName, String key) {
Set<String> propertiesSet = new HashSet<>();
StringTokenizer tk = new StringTokenizer(getCustomBundleProperty(bundleName, key, ""), ",");
while (tk.hasMoreTokens())
propertiesSet.add(tk.nextToken().trim());
return propertiesSet;
} | [
"public",
"Set",
"<",
"String",
">",
"getCustomBundlePropertyAsSet",
"(",
"String",
"bundleName",
",",
"String",
"key",
")",
"{",
"Set",
"<",
"String",
">",
"propertiesSet",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"StringTokenizer",
"tk",
"=",
"new",
"... | Returns as a set, the comma separated values of a property
@param bundleName
the bundle name
@param key
the key of the property
@return a set of the comma separated values of a property | [
"Returns",
"as",
"a",
"set",
"the",
"comma",
"separated",
"values",
"of",
"a",
"property"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java#L198-L204 |
alkacon/opencms-core | src/org/opencms/module/CmsModule.java | CmsModule.addCalculatedModuleResources | public static void addCalculatedModuleResources(
List<CmsResource> result,
final CmsObject cms,
final List<CmsResource> moduleResources,
final List<String> excludeResources)
throws CmsException {
for (CmsResource resource : moduleResources) {
String sitePath = cms.getSitePath(resource);
List<String> excludedSubResources = getExcludedForResource(sitePath, excludeResources);
// check if resources have to be excluded
if (excludedSubResources.isEmpty()) {
// no resource has to be excluded - add the whole resource
// (that is, also all resources in the folder, if the resource is a folder)
result.add(resource);
} else {
// cannot add the complete resource (i.e., including the whole sub-tree)
if (CmsStringUtil.comparePaths(sitePath, excludedSubResources.get(0))) {
// the resource itself is excluded -> do not add it and check the next resource
continue;
}
// try to include sub-resources.
List<CmsResource> subResources = cms.readResources(sitePath, CmsResourceFilter.ALL, false);
addCalculatedModuleResources(result, cms, subResources, excludedSubResources);
}
}
} | java | public static void addCalculatedModuleResources(
List<CmsResource> result,
final CmsObject cms,
final List<CmsResource> moduleResources,
final List<String> excludeResources)
throws CmsException {
for (CmsResource resource : moduleResources) {
String sitePath = cms.getSitePath(resource);
List<String> excludedSubResources = getExcludedForResource(sitePath, excludeResources);
// check if resources have to be excluded
if (excludedSubResources.isEmpty()) {
// no resource has to be excluded - add the whole resource
// (that is, also all resources in the folder, if the resource is a folder)
result.add(resource);
} else {
// cannot add the complete resource (i.e., including the whole sub-tree)
if (CmsStringUtil.comparePaths(sitePath, excludedSubResources.get(0))) {
// the resource itself is excluded -> do not add it and check the next resource
continue;
}
// try to include sub-resources.
List<CmsResource> subResources = cms.readResources(sitePath, CmsResourceFilter.ALL, false);
addCalculatedModuleResources(result, cms, subResources, excludedSubResources);
}
}
} | [
"public",
"static",
"void",
"addCalculatedModuleResources",
"(",
"List",
"<",
"CmsResource",
">",
"result",
",",
"final",
"CmsObject",
"cms",
",",
"final",
"List",
"<",
"CmsResource",
">",
"moduleResources",
",",
"final",
"List",
"<",
"String",
">",
"excludeReso... | Determines the resources that are:
<ul>
<li>accessible with the provided {@link CmsObject},</li>
<li>part of the <code>moduleResources</code> (or in a folder of these resources) and</li>
<li><em>not</em> contained in <code>excludedResources</code> (or a folder of these resources).</li>
</ul>
and adds the to <code>result</code>
@param result the resource list, that gets extended by the calculated resources.
@param cms the {@link CmsObject} used to read resources.
@param moduleResources the resources to include.
@param excludeResources the site paths of the resources to exclude.
@throws CmsException thrown if reading resources fails. | [
"Determines",
"the",
"resources",
"that",
"are",
":",
"<ul",
">",
"<li",
">",
"accessible",
"with",
"the",
"provided",
"{",
"@link",
"CmsObject",
"}",
"<",
"/",
"li",
">",
"<li",
">",
"part",
"of",
"the",
"<code",
">",
"moduleResources<",
"/",
"code",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModule.java#L368-L398 |
janus-project/guava.janusproject.io | guava/src/com/google/common/util/concurrent/AtomicLongMap.java | AtomicLongMap.putIfAbsent | long putIfAbsent(K key, long newValue) {
for (;;) {
AtomicLong atomic = map.get(key);
if (atomic == null) {
atomic = map.putIfAbsent(key, new AtomicLong(newValue));
if (atomic == null) {
return 0L;
}
// atomic is now non-null; fall through
}
long oldValue = atomic.get();
if (oldValue == 0L) {
// don't compareAndSet a zero
if (map.replace(key, atomic, new AtomicLong(newValue))) {
return 0L;
}
// atomic replaced
continue;
}
return oldValue;
}
} | java | long putIfAbsent(K key, long newValue) {
for (;;) {
AtomicLong atomic = map.get(key);
if (atomic == null) {
atomic = map.putIfAbsent(key, new AtomicLong(newValue));
if (atomic == null) {
return 0L;
}
// atomic is now non-null; fall through
}
long oldValue = atomic.get();
if (oldValue == 0L) {
// don't compareAndSet a zero
if (map.replace(key, atomic, new AtomicLong(newValue))) {
return 0L;
}
// atomic replaced
continue;
}
return oldValue;
}
} | [
"long",
"putIfAbsent",
"(",
"K",
"key",
",",
"long",
"newValue",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"AtomicLong",
"atomic",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"atomic",
"==",
"null",
")",
"{",
"atomic",
"=",
"map",
... | If {@code key} is not already associated with a value or if {@code key} is associated with
zero, associate it with {@code newValue}. Returns the previous value associated with
{@code key}, or zero if there was no mapping for {@code key}. | [
"If",
"{"
] | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/util/concurrent/AtomicLongMap.java#L367-L390 |
davidmarquis/fluent-interface-proxy | src/main/java/com/fluentinterface/proxy/internal/BestMatchingConstructor.java | BestMatchingConstructor.typesAreCompatible | private boolean typesAreCompatible(Class<?>[] paramTypes, Class<?>[] constructorParamTypes) {
boolean matches = true;
for (int i = 0; i < paramTypes.length; i++) {
Class<?> paramType = paramTypes[i];
if (paramType != null) {
Class<?> inputParamType = translateFromPrimitive(paramType);
Class<?> constructorParamType = translateFromPrimitive(constructorParamTypes[i]);
if (inputParamType.isArray() && Collection.class.isAssignableFrom(constructorParamType)) {
continue;
}
if (!constructorParamType.isAssignableFrom(inputParamType)) {
matches = false;
break;
}
}
}
return matches;
} | java | private boolean typesAreCompatible(Class<?>[] paramTypes, Class<?>[] constructorParamTypes) {
boolean matches = true;
for (int i = 0; i < paramTypes.length; i++) {
Class<?> paramType = paramTypes[i];
if (paramType != null) {
Class<?> inputParamType = translateFromPrimitive(paramType);
Class<?> constructorParamType = translateFromPrimitive(constructorParamTypes[i]);
if (inputParamType.isArray() && Collection.class.isAssignableFrom(constructorParamType)) {
continue;
}
if (!constructorParamType.isAssignableFrom(inputParamType)) {
matches = false;
break;
}
}
}
return matches;
} | [
"private",
"boolean",
"typesAreCompatible",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"constructorParamTypes",
")",
"{",
"boolean",
"matches",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Checks if a set of types are compatible with the given set of constructor parameter types. If an input type is
null, then it is considered as a wildcard for matching purposes, and always matches.
@param paramTypes A set of input types that are to be matched against constructor parameters.
@param constructorParamTypes The constructor parameters to match against.
@return whether the input types are compatible or not. | [
"Checks",
"if",
"a",
"set",
"of",
"types",
"are",
"compatible",
"with",
"the",
"given",
"set",
"of",
"constructor",
"parameter",
"types",
".",
"If",
"an",
"input",
"type",
"is",
"null",
"then",
"it",
"is",
"considered",
"as",
"a",
"wildcard",
"for",
"mat... | train | https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/proxy/internal/BestMatchingConstructor.java#L112-L132 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/RemoveBrownPtoN_F32.java | RemoveBrownPtoN_F32.setK | public RemoveBrownPtoN_F32 setK( /**/double fx, /**/double fy, /**/double skew, /**/double cx, /**/double cy ) {
this.fx = (float)fx;
this.fy = (float)fy;
this.skew = (float)skew;
this.cx = (float)cx;
this.cy = (float)cy;
// analytic solution to matrix inverse
a11 = (float)(1.0f/fx);
a12 = (float)(-skew/(fx*fy));
a13 = (float)((skew*cy - cx*fy)/(fx*fy));
a22 = (float)(1.0f/fy);
a23 = (float)(-cy/fy);
return this;
} | java | public RemoveBrownPtoN_F32 setK( /**/double fx, /**/double fy, /**/double skew, /**/double cx, /**/double cy ) {
this.fx = (float)fx;
this.fy = (float)fy;
this.skew = (float)skew;
this.cx = (float)cx;
this.cy = (float)cy;
// analytic solution to matrix inverse
a11 = (float)(1.0f/fx);
a12 = (float)(-skew/(fx*fy));
a13 = (float)((skew*cy - cx*fy)/(fx*fy));
a22 = (float)(1.0f/fy);
a23 = (float)(-cy/fy);
return this;
} | [
"public",
"RemoveBrownPtoN_F32",
"setK",
"(",
"/**/",
"double",
"fx",
",",
"/**/",
"double",
"fy",
",",
"/**/",
"double",
"skew",
",",
"/**/",
"double",
"cx",
",",
"/**/",
"double",
"cy",
")",
"{",
"this",
".",
"fx",
"=",
"(",
"float",
")",
"fx",
";"... | Specify camera calibration parameters
@param fx Focal length x-axis in pixels
@param fy Focal length y-axis in pixels
@param skew skew in pixels
@param cx camera center x-axis in pixels
@param cy center center y-axis in pixels | [
"Specify",
"camera",
"calibration",
"parameters"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/RemoveBrownPtoN_F32.java#L69-L85 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputFormat.java | MultipleOutputFormat.getInputFileBasedOutputFileName | protected String getInputFileBasedOutputFileName(JobConf job, String name) {
String infilepath = job.get("map.input.file");
if (infilepath == null) {
// if the map input file does not exists, then return the given name
return name;
}
int numOfTrailingLegsToUse = job.getInt("mapred.outputformat.numOfTrailingLegs", 0);
if (numOfTrailingLegsToUse <= 0) {
return name;
}
Path infile = new Path(infilepath);
Path parent = infile.getParent();
String midName = infile.getName();
Path outPath = new Path(midName);
for (int i = 1; i < numOfTrailingLegsToUse; i++) {
if (parent == null) break;
midName = parent.getName();
if (midName.length() == 0) break;
parent = parent.getParent();
outPath = new Path(midName, outPath);
}
return outPath.toString();
} | java | protected String getInputFileBasedOutputFileName(JobConf job, String name) {
String infilepath = job.get("map.input.file");
if (infilepath == null) {
// if the map input file does not exists, then return the given name
return name;
}
int numOfTrailingLegsToUse = job.getInt("mapred.outputformat.numOfTrailingLegs", 0);
if (numOfTrailingLegsToUse <= 0) {
return name;
}
Path infile = new Path(infilepath);
Path parent = infile.getParent();
String midName = infile.getName();
Path outPath = new Path(midName);
for (int i = 1; i < numOfTrailingLegsToUse; i++) {
if (parent == null) break;
midName = parent.getName();
if (midName.length() == 0) break;
parent = parent.getParent();
outPath = new Path(midName, outPath);
}
return outPath.toString();
} | [
"protected",
"String",
"getInputFileBasedOutputFileName",
"(",
"JobConf",
"job",
",",
"String",
"name",
")",
"{",
"String",
"infilepath",
"=",
"job",
".",
"get",
"(",
"\"map.input.file\"",
")",
";",
"if",
"(",
"infilepath",
"==",
"null",
")",
"{",
"// if the m... | Generate the outfile name based on a given anme and the input file name. If
the map input file does not exists (i.e. this is not for a map only job),
the given name is returned unchanged. If the config value for
"num.of.trailing.legs.to.use" is not set, or set 0 or negative, the given
name is returned unchanged. Otherwise, return a file name consisting of the
N trailing legs of the input file name where N is the config value for
"num.of.trailing.legs.to.use".
@param job
the job config
@param name
the output file name
@return the outfile name based on a given anme and the input file name. | [
"Generate",
"the",
"outfile",
"name",
"based",
"on",
"a",
"given",
"anme",
"and",
"the",
"input",
"file",
"name",
".",
"If",
"the",
"map",
"input",
"file",
"does",
"not",
"exists",
"(",
"i",
".",
"e",
".",
"this",
"is",
"not",
"for",
"a",
"map",
"o... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputFormat.java#L187-L209 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java | TransformerIdentityImpl.notationDecl | public void notationDecl(String name, String publicId, String systemId)
throws SAXException
{
if (null != m_resultDTDHandler)
m_resultDTDHandler.notationDecl(name, publicId, systemId);
} | java | public void notationDecl(String name, String publicId, String systemId)
throws SAXException
{
if (null != m_resultDTDHandler)
m_resultDTDHandler.notationDecl(name, publicId, systemId);
} | [
"public",
"void",
"notationDecl",
"(",
"String",
"name",
",",
"String",
"publicId",
",",
"String",
"systemId",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"null",
"!=",
"m_resultDTDHandler",
")",
"m_resultDTDHandler",
".",
"notationDecl",
"(",
"name",
",",
... | Receive notification of a notation declaration.
<p>By default, do nothing. Application writers may override this
method in a subclass if they wish to keep track of the notations
declared in a document.</p>
@param name The notation name.
@param publicId The notation public identifier, or null if not
available.
@param systemId The notation system identifier.
@throws org.xml.sax.SAXException Any SAX exception, possibly
wrapping another exception.
@see org.xml.sax.DTDHandler#notationDecl
@throws SAXException | [
"Receive",
"notification",
"of",
"a",
"notation",
"declaration",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L826-L831 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.foldLeft | public int foldLeft(int seed, IntBinaryOperator accumulator) {
int[] box = new int[] { seed };
forEachOrdered(t -> box[0] = accumulator.applyAsInt(box[0], t));
return box[0];
} | java | public int foldLeft(int seed, IntBinaryOperator accumulator) {
int[] box = new int[] { seed };
forEachOrdered(t -> box[0] = accumulator.applyAsInt(box[0], t));
return box[0];
} | [
"public",
"int",
"foldLeft",
"(",
"int",
"seed",
",",
"IntBinaryOperator",
"accumulator",
")",
"{",
"int",
"[",
"]",
"box",
"=",
"new",
"int",
"[",
"]",
"{",
"seed",
"}",
";",
"forEachOrdered",
"(",
"t",
"->",
"box",
"[",
"0",
"]",
"=",
"accumulator"... | Folds the elements of this stream using the provided seed object and
accumulation function, going left to right. This is equivalent to:
<pre>
{@code
int result = seed;
for (int element : this stream)
result = accumulator.apply(result, element)
return result;
}
</pre>
<p>
This is a terminal operation.
<p>
This method cannot take all the advantages of parallel streams as it must
process elements strictly left to right. If your accumulator function is
associative, consider using {@link #reduce(int, IntBinaryOperator)}
method.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the same thread.
@param seed the starting value
@param accumulator a
<a href="package-summary.html#NonInterference">non-interfering
</a>, <a href="package-summary.html#Statelessness">stateless</a>
function for incorporating an additional element into a result
@return the result of the folding
@see #reduce(int, IntBinaryOperator)
@see #foldLeft(IntBinaryOperator)
@since 0.4.0 | [
"Folds",
"the",
"elements",
"of",
"this",
"stream",
"using",
"the",
"provided",
"seed",
"object",
"and",
"accumulation",
"function",
"going",
"left",
"to",
"right",
".",
"This",
"is",
"equivalent",
"to",
":"
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L826-L830 |
opentelecoms-org/zrtp-java | src/zorg/ZRTP.java | ZRTP.handleIncomingMessage | public void handleIncomingMessage(byte[] data, int offset, int len) {
synchronized(messageQueue) {
messageQueue.add(new IncomingMessage(data, offset, len));
}
synchronized(lock) {
lock.notifyAll();
}
} | java | public void handleIncomingMessage(byte[] data, int offset, int len) {
synchronized(messageQueue) {
messageQueue.add(new IncomingMessage(data, offset, len));
}
synchronized(lock) {
lock.notifyAll();
}
} | [
"public",
"void",
"handleIncomingMessage",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"synchronized",
"(",
"messageQueue",
")",
"{",
"messageQueue",
".",
"add",
"(",
"new",
"IncomingMessage",
"(",
"data",
",",
"offset... | Handle an incoming ZRTP message. Assumes RTP headers and trailing CRC
have been stripped by caller
@param aMsg
byte array containing the ZRTP message | [
"Handle",
"an",
"incoming",
"ZRTP",
"message",
".",
"Assumes",
"RTP",
"headers",
"and",
"trailing",
"CRC",
"have",
"been",
"stripped",
"by",
"caller"
] | train | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTP.java#L1902-L1909 |
ops4j/org.ops4j.base | ops4j-base-store/src/main/java/org/ops4j/store/StoreFactory.java | StoreFactory.anonymousStore | public static Store<InputStream> anonymousStore()
throws IOException
{
File temp = File.createTempFile( "ops4j-store-anonymous-", "" );
temp.delete();
temp.mkdir();
return new TemporaryStore( temp, true );
} | java | public static Store<InputStream> anonymousStore()
throws IOException
{
File temp = File.createTempFile( "ops4j-store-anonymous-", "" );
temp.delete();
temp.mkdir();
return new TemporaryStore( temp, true );
} | [
"public",
"static",
"Store",
"<",
"InputStream",
">",
"anonymousStore",
"(",
")",
"throws",
"IOException",
"{",
"File",
"temp",
"=",
"File",
".",
"createTempFile",
"(",
"\"ops4j-store-anonymous-\"",
",",
"\"\"",
")",
";",
"temp",
".",
"delete",
"(",
")",
";"... | If the store must be unique, here is it.
@return unique storage
@throws java.io.IOException in case no temp folder has been found. | [
"If",
"the",
"store",
"must",
"be",
"unique",
"here",
"is",
"it",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-store/src/main/java/org/ops4j/store/StoreFactory.java#L97-L104 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckJSDoc.java | CheckJSDoc.validateFunctionJsDoc | private void validateFunctionJsDoc(Node n, JSDocInfo info) {
if (info == null) {
return;
}
if (info.containsFunctionDeclaration() && !info.hasType() && !isJSDocOnFunctionNode(n, info)) {
// This JSDoc should be attached to a FUNCTION node, or an assignment
// with a function as the RHS, etc.
reportMisplaced(
n,
"function",
"This JSDoc is not attached to a function node. " + "Are you missing parentheses?");
}
} | java | private void validateFunctionJsDoc(Node n, JSDocInfo info) {
if (info == null) {
return;
}
if (info.containsFunctionDeclaration() && !info.hasType() && !isJSDocOnFunctionNode(n, info)) {
// This JSDoc should be attached to a FUNCTION node, or an assignment
// with a function as the RHS, etc.
reportMisplaced(
n,
"function",
"This JSDoc is not attached to a function node. " + "Are you missing parentheses?");
}
} | [
"private",
"void",
"validateFunctionJsDoc",
"(",
"Node",
"n",
",",
"JSDocInfo",
"info",
")",
"{",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"info",
".",
"containsFunctionDeclaration",
"(",
")",
"&&",
"!",
"info",
".",
"h... | Checks that JSDoc intended for a function is actually attached to a
function. | [
"Checks",
"that",
"JSDoc",
"intended",
"for",
"a",
"function",
"is",
"actually",
"attached",
"to",
"a",
"function",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckJSDoc.java#L419-L433 |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/result/AbstractCrosstabResultReducer.java | AbstractCrosstabResultReducer.createMasterCrosstab | protected Crosstab<Serializable> createMasterCrosstab(Collection<? extends R> results) {
final R firstResult = results.iterator().next();
final Crosstab<?> firstCrosstab = firstResult.getCrosstab();
final Class<?> valueClass = firstCrosstab.getValueClass();
final CrosstabDimension dimension1 = firstCrosstab.getDimension(0);
final CrosstabDimension dimension2 = firstCrosstab.getDimension(1);
@SuppressWarnings({ "unchecked", "rawtypes" })
final Crosstab<Serializable> masterCrosstab = new Crosstab(valueClass, dimension1, dimension2);
return masterCrosstab;
} | java | protected Crosstab<Serializable> createMasterCrosstab(Collection<? extends R> results) {
final R firstResult = results.iterator().next();
final Crosstab<?> firstCrosstab = firstResult.getCrosstab();
final Class<?> valueClass = firstCrosstab.getValueClass();
final CrosstabDimension dimension1 = firstCrosstab.getDimension(0);
final CrosstabDimension dimension2 = firstCrosstab.getDimension(1);
@SuppressWarnings({ "unchecked", "rawtypes" })
final Crosstab<Serializable> masterCrosstab = new Crosstab(valueClass, dimension1, dimension2);
return masterCrosstab;
} | [
"protected",
"Crosstab",
"<",
"Serializable",
">",
"createMasterCrosstab",
"(",
"Collection",
"<",
"?",
"extends",
"R",
">",
"results",
")",
"{",
"final",
"R",
"firstResult",
"=",
"results",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"final",
... | Builds the master crosstab, including all dimensions and categories that
will be included in the final result.
By default this method will use the first result's crosstab dimensions
and categories, assuming that they are all the same.
Subclasses can override this method to build the other dimensions.
@param results
@return | [
"Builds",
"the",
"master",
"crosstab",
"including",
"all",
"dimensions",
"and",
"categories",
"that",
"will",
"be",
"included",
"in",
"the",
"final",
"result",
"."
] | train | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/result/AbstractCrosstabResultReducer.java#L98-L109 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.isValidPropertyName | static boolean isValidPropertyName(FeatureSet mode, String name) {
if (isValidSimpleName(name)) {
return true;
} else {
return mode.has(Feature.KEYWORDS_AS_PROPERTIES) && TokenStream.isKeyword(name);
}
} | java | static boolean isValidPropertyName(FeatureSet mode, String name) {
if (isValidSimpleName(name)) {
return true;
} else {
return mode.has(Feature.KEYWORDS_AS_PROPERTIES) && TokenStream.isKeyword(name);
}
} | [
"static",
"boolean",
"isValidPropertyName",
"(",
"FeatureSet",
"mode",
",",
"String",
"name",
")",
"{",
"if",
"(",
"isValidSimpleName",
"(",
"name",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"mode",
".",
"has",
"(",
"Feature",
"."... | Determines whether the given name can appear on the right side of the dot operator. Many
properties (like reserved words) cannot, in ES3. | [
"Determines",
"whether",
"the",
"given",
"name",
"can",
"appear",
"on",
"the",
"right",
"side",
"of",
"the",
"dot",
"operator",
".",
"Many",
"properties",
"(",
"like",
"reserved",
"words",
")",
"cannot",
"in",
"ES3",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L4229-L4235 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java | ChannelHelper.writeAll | public static void writeAll(GatheringByteChannel ch, ByteBuffer[] bbs, int offset, int length) throws IOException
{
long all = 0;
for (int ii=0;ii<length;ii++)
{
all += bbs[offset+ii].remaining();
}
int count = 0;
while (all > 0)
{
long rc = ch.write(bbs, offset, length);
if (rc == 0)
{
count++;
}
else
{
all -= rc;
}
if (count > 100)
{
throw new IOException("Couldn't write all.");
}
}
} | java | public static void writeAll(GatheringByteChannel ch, ByteBuffer[] bbs, int offset, int length) throws IOException
{
long all = 0;
for (int ii=0;ii<length;ii++)
{
all += bbs[offset+ii].remaining();
}
int count = 0;
while (all > 0)
{
long rc = ch.write(bbs, offset, length);
if (rc == 0)
{
count++;
}
else
{
all -= rc;
}
if (count > 100)
{
throw new IOException("Couldn't write all.");
}
}
} | [
"public",
"static",
"void",
"writeAll",
"(",
"GatheringByteChannel",
"ch",
",",
"ByteBuffer",
"[",
"]",
"bbs",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"long",
"all",
"=",
"0",
";",
"for",
"(",
"int",
"ii",
"=",
"0... | Attempts to write all remaining data in bbs.
@param ch Target
@param bbs
@param offset
@param length
@throws IOException If couldn't write all. | [
"Attempts",
"to",
"write",
"all",
"remaining",
"data",
"in",
"bbs",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L277-L301 |
kiegroup/drools | kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/DecisionTableFunction.java | DecisionTableFunction.toDecisionRule | private static DTDecisionRule toDecisionRule(EvaluationContext mainCtx, FEEL embeddedFEEL, int index, List<?> rule, int inputSize) {
// TODO should be check indeed block of inputSize n inputs, followed by block of outputs.
DTDecisionRule dr = new DTDecisionRule( index );
for ( int i = 0; i < rule.size(); i++ ) {
Object o = rule.get( i );
if ( i < inputSize ) {
dr.getInputEntry().add( toUnaryTest( mainCtx, o ) );
} else {
FEELEventListener ruleListener = event -> mainCtx.notifyEvt( () -> new FEELEventBase(event.getSeverity(),
Msg.createMessage(Msg.ERROR_COMPILE_EXPR_DT_FUNCTION_RULE_IDX, index+1, event.getMessage()),
event.getSourceException()));
embeddedFEEL.addListener(ruleListener);
CompiledExpression compiledExpression = embeddedFEEL.compile((String) o, embeddedFEEL.newCompilerContext());
dr.getOutputEntry().add( compiledExpression );
embeddedFEEL.removeListener(ruleListener);
}
}
return dr;
} | java | private static DTDecisionRule toDecisionRule(EvaluationContext mainCtx, FEEL embeddedFEEL, int index, List<?> rule, int inputSize) {
// TODO should be check indeed block of inputSize n inputs, followed by block of outputs.
DTDecisionRule dr = new DTDecisionRule( index );
for ( int i = 0; i < rule.size(); i++ ) {
Object o = rule.get( i );
if ( i < inputSize ) {
dr.getInputEntry().add( toUnaryTest( mainCtx, o ) );
} else {
FEELEventListener ruleListener = event -> mainCtx.notifyEvt( () -> new FEELEventBase(event.getSeverity(),
Msg.createMessage(Msg.ERROR_COMPILE_EXPR_DT_FUNCTION_RULE_IDX, index+1, event.getMessage()),
event.getSourceException()));
embeddedFEEL.addListener(ruleListener);
CompiledExpression compiledExpression = embeddedFEEL.compile((String) o, embeddedFEEL.newCompilerContext());
dr.getOutputEntry().add( compiledExpression );
embeddedFEEL.removeListener(ruleListener);
}
}
return dr;
} | [
"private",
"static",
"DTDecisionRule",
"toDecisionRule",
"(",
"EvaluationContext",
"mainCtx",
",",
"FEEL",
"embeddedFEEL",
",",
"int",
"index",
",",
"List",
"<",
"?",
">",
"rule",
",",
"int",
"inputSize",
")",
"{",
"// TODO should be check indeed block of inputSize n ... | Convert row to DTDecisionRule
@param mainCtx the main context is used to identify the hosted FEELEventManager
@param embeddedFEEL a possibly cached embedded FEEL to compile the output expression, error will be reported up to the mainCtx
@param index
@param rule
@param inputSize
@return | [
"Convert",
"row",
"to",
"DTDecisionRule"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/DecisionTableFunction.java#L149-L167 |
gallandarakhneorg/afc | advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java | XMLRoadUtil.writeRoadSegment | public static Element writeRoadSegment(RoadSegment primitive, XMLBuilder builder, XMLResources resources) throws IOException {
if (primitive instanceof RoadPolyline) {
return writeRoadPolyline((RoadPolyline) primitive, builder, resources);
}
throw new IOException("unsupported type of primitive: " + primitive); //$NON-NLS-1$
} | java | public static Element writeRoadSegment(RoadSegment primitive, XMLBuilder builder, XMLResources resources) throws IOException {
if (primitive instanceof RoadPolyline) {
return writeRoadPolyline((RoadPolyline) primitive, builder, resources);
}
throw new IOException("unsupported type of primitive: " + primitive); //$NON-NLS-1$
} | [
"public",
"static",
"Element",
"writeRoadSegment",
"(",
"RoadSegment",
"primitive",
",",
"XMLBuilder",
"builder",
",",
"XMLResources",
"resources",
")",
"throws",
"IOException",
"{",
"if",
"(",
"primitive",
"instanceof",
"RoadPolyline",
")",
"{",
"return",
"writeRoa... | Write the XML description for the given road.
@param primitive is the road to output.
@param builder is the tool to create XML nodes.
@param resources is the tool that permits to gather the resources.
@return the XML node of the map element.
@throws IOException in case of error. | [
"Write",
"the",
"XML",
"description",
"for",
"the",
"given",
"road",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java#L114-L119 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/ReportResourcesImpl.java | ReportResourcesImpl.updatePublishStatus | public ReportPublish updatePublishStatus(long id, ReportPublish reportPublish) throws SmartsheetException{
return this.updateResource("reports/" + id + "/publish", ReportPublish.class, reportPublish);
} | java | public ReportPublish updatePublishStatus(long id, ReportPublish reportPublish) throws SmartsheetException{
return this.updateResource("reports/" + id + "/publish", ReportPublish.class, reportPublish);
} | [
"public",
"ReportPublish",
"updatePublishStatus",
"(",
"long",
"id",
",",
"ReportPublish",
"reportPublish",
")",
"throws",
"SmartsheetException",
"{",
"return",
"this",
".",
"updateResource",
"(",
"\"reports/\"",
"+",
"id",
"+",
"\"/publish\"",
",",
"ReportPublish",
... | Sets the publish status of a report and returns the new status, including the URLs of any
enabled publishing.
It mirrors to the following Smartsheet REST API method: PUT /reports/{id}/publish
Exceptions:
- InvalidRequestException : if there is any problem with the REST API request
- AuthorizationException : if there is any problem with the REST API authorization(access token)
- ResourceNotFoundException : if the resource can not be found
- ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
- SmartsheetRestException : if there is any other REST API related error occurred during the operation
- SmartsheetException : if there is any other error occurred during the operation
@param id the ID of the report
@param publish the ReportPublish object
@return the updated ReportPublish (note that if there is no such resource, this method will
throw ResourceNotFoundException rather than returning null)
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation | [
"Sets",
"the",
"publish",
"status",
"of",
"a",
"report",
"and",
"returns",
"the",
"new",
"status",
"including",
"the",
"URLs",
"of",
"any",
"enabled",
"publishing",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/ReportResourcesImpl.java#L300-L302 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_databaseCreationCapabilities_GET | public ArrayList<OvhCreationDatabaseCapabilities> serviceName_databaseCreationCapabilities_GET(String serviceName) throws IOException {
String qPath = "/hosting/web/{serviceName}/databaseCreationCapabilities";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t7);
} | java | public ArrayList<OvhCreationDatabaseCapabilities> serviceName_databaseCreationCapabilities_GET(String serviceName) throws IOException {
String qPath = "/hosting/web/{serviceName}/databaseCreationCapabilities";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t7);
} | [
"public",
"ArrayList",
"<",
"OvhCreationDatabaseCapabilities",
">",
"serviceName_databaseCreationCapabilities_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/databaseCreationCapabilities\"",
";",
"String... | List available database you can install
REST: GET /hosting/web/{serviceName}/databaseCreationCapabilities
@param serviceName [required] The internal name of your hosting | [
"List",
"available",
"database",
"you",
"can",
"install"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2048-L2053 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.mayBeString | static boolean mayBeString(Node n, boolean useType) {
if (useType) {
JSType type = n.getJSType();
if (type != null) {
if (type.isStringValueType()) {
return true;
} else if (type.isNumberValueType() || type.isBooleanValueType() || type.isNullType()
|| type.isVoidType()) {
return false;
}
}
}
return mayBeString(getKnownValueType(n));
} | java | static boolean mayBeString(Node n, boolean useType) {
if (useType) {
JSType type = n.getJSType();
if (type != null) {
if (type.isStringValueType()) {
return true;
} else if (type.isNumberValueType() || type.isBooleanValueType() || type.isNullType()
|| type.isVoidType()) {
return false;
}
}
}
return mayBeString(getKnownValueType(n));
} | [
"static",
"boolean",
"mayBeString",
"(",
"Node",
"n",
",",
"boolean",
"useType",
")",
"{",
"if",
"(",
"useType",
")",
"{",
"JSType",
"type",
"=",
"n",
".",
"getJSType",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"if",
"(",
"type",
... | Return if the node is possibly a string.
@param n The node.
@param useType If true and the node has a primitive type, return true if that type is string
and false otherwise.
@return Whether the results is possibly a string. | [
"Return",
"if",
"the",
"node",
"is",
"possibly",
"a",
"string",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L2019-L2032 |
zamrokk/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Chain.java | Chain.getMember | public Member getMember(String name) {
if (null == keyValStore) throw new RuntimeException("No key value store was found. You must first call Chain.setKeyValStore");
if (null == memberServices) throw new RuntimeException("No member services was found. You must first call Chain.setMemberServices or Chain.setMemberServicesUrl");
// Try to get the member state from the cache
Member member = (Member) members.get(name);
if (null != member) return member;
// Create the member and try to restore it's state from the key value store (if found).
member = new Member(name, this);
member.restoreState();
return member;
} | java | public Member getMember(String name) {
if (null == keyValStore) throw new RuntimeException("No key value store was found. You must first call Chain.setKeyValStore");
if (null == memberServices) throw new RuntimeException("No member services was found. You must first call Chain.setMemberServices or Chain.setMemberServicesUrl");
// Try to get the member state from the cache
Member member = (Member) members.get(name);
if (null != member) return member;
// Create the member and try to restore it's state from the key value store (if found).
member = new Member(name, this);
member.restoreState();
return member;
} | [
"public",
"Member",
"getMember",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"null",
"==",
"keyValStore",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"No key value store was found. You must first call Chain.setKeyValStore\"",
")",
";",
"if",
"(",
"null",
"==",
... | Get the member with a given name
@param name name of the member
@return member | [
"Get",
"the",
"member",
"with",
"a",
"given",
"name"
] | train | https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/Chain.java#L292-L305 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.onSetBloomFilter | private void onSetBloomFilter(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String bloomFilterFpChance = cfProperties.getProperty(CassandraConstants.BLOOM_FILTER_FP_CHANCE);
if (bloomFilterFpChance != null)
{
try
{
if (builder != null)
{
appendPropertyToBuilder(builder, bloomFilterFpChance, CassandraConstants.BLOOM_FILTER_FP_CHANCE);
}
else
{
cfDef.setBloom_filter_fp_chance(Double.parseDouble(bloomFilterFpChance));
}
}
catch (NumberFormatException nfe)
{
log.error("BLOOM_FILTER_FP_CHANCE should be double type, Caused by: .", nfe);
throw new SchemaGenerationException(nfe);
}
}
} | java | private void onSetBloomFilter(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String bloomFilterFpChance = cfProperties.getProperty(CassandraConstants.BLOOM_FILTER_FP_CHANCE);
if (bloomFilterFpChance != null)
{
try
{
if (builder != null)
{
appendPropertyToBuilder(builder, bloomFilterFpChance, CassandraConstants.BLOOM_FILTER_FP_CHANCE);
}
else
{
cfDef.setBloom_filter_fp_chance(Double.parseDouble(bloomFilterFpChance));
}
}
catch (NumberFormatException nfe)
{
log.error("BLOOM_FILTER_FP_CHANCE should be double type, Caused by: .", nfe);
throw new SchemaGenerationException(nfe);
}
}
} | [
"private",
"void",
"onSetBloomFilter",
"(",
"CfDef",
"cfDef",
",",
"Properties",
"cfProperties",
",",
"StringBuilder",
"builder",
")",
"{",
"String",
"bloomFilterFpChance",
"=",
"cfProperties",
".",
"getProperty",
"(",
"CassandraConstants",
".",
"BLOOM_FILTER_FP_CHANCE"... | On set bloom filter.
@param cfDef
the cf def
@param cfProperties
the cf properties
@param builder
the builder | [
"On",
"set",
"bloom",
"filter",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2436-L2458 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.appendFixedDecimal | public DateTimeFormatterBuilder appendFixedDecimal(
DateTimeFieldType fieldType, int numDigits) {
if (fieldType == null) {
throw new IllegalArgumentException("Field type must not be null");
}
if (numDigits <= 0) {
throw new IllegalArgumentException("Illegal number of digits: " + numDigits);
}
return append0(new FixedNumber(fieldType, numDigits, false));
} | java | public DateTimeFormatterBuilder appendFixedDecimal(
DateTimeFieldType fieldType, int numDigits) {
if (fieldType == null) {
throw new IllegalArgumentException("Field type must not be null");
}
if (numDigits <= 0) {
throw new IllegalArgumentException("Illegal number of digits: " + numDigits);
}
return append0(new FixedNumber(fieldType, numDigits, false));
} | [
"public",
"DateTimeFormatterBuilder",
"appendFixedDecimal",
"(",
"DateTimeFieldType",
"fieldType",
",",
"int",
"numDigits",
")",
"{",
"if",
"(",
"fieldType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Field type must not be null\"",
")",... | Instructs the printer to emit a field value as a fixed-width decimal
number (smaller numbers will be left-padded with zeros), and the parser
to expect an unsigned decimal number with the same fixed width.
@param fieldType type of field to append
@param numDigits the exact number of digits to parse or print, except if
printed value requires more digits
@return this DateTimeFormatterBuilder, for chaining
@throws IllegalArgumentException if field type is null or if <code>numDigits <= 0</code>
@since 1.5 | [
"Instructs",
"the",
"printer",
"to",
"emit",
"a",
"field",
"value",
"as",
"a",
"fixed",
"-",
"width",
"decimal",
"number",
"(",
"smaller",
"numbers",
"will",
"be",
"left",
"-",
"padded",
"with",
"zeros",
")",
"and",
"the",
"parser",
"to",
"expect",
"an",... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L463-L472 |
fuinorg/utils4swing | src/main/java/org/fuin/utils4swing/dialogs/DirectorySelectionPanel.java | DirectorySelectionPanel.getButtonOK | protected final JButton getButtonOK() {
if (buttonOK == null) {
buttonOK = new JButton();
buttonOK.setText("OK");
buttonOK.setPreferredSize(new Dimension(80, 26));
buttonOK.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (destDirSelector != null) {
destDirSelector.ok();
}
}
});
}
return buttonOK;
} | java | protected final JButton getButtonOK() {
if (buttonOK == null) {
buttonOK = new JButton();
buttonOK.setText("OK");
buttonOK.setPreferredSize(new Dimension(80, 26));
buttonOK.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (destDirSelector != null) {
destDirSelector.ok();
}
}
});
}
return buttonOK;
} | [
"protected",
"final",
"JButton",
"getButtonOK",
"(",
")",
"{",
"if",
"(",
"buttonOK",
"==",
"null",
")",
"{",
"buttonOK",
"=",
"new",
"JButton",
"(",
")",
";",
"buttonOK",
".",
"setText",
"(",
"\"OK\"",
")",
";",
"buttonOK",
".",
"setPreferredSize",
"(",... | Returns the 'OK' button for usage as default button.
@return Button. | [
"Returns",
"the",
"OK",
"button",
"for",
"usage",
"as",
"default",
"button",
"."
] | train | https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/dialogs/DirectorySelectionPanel.java#L153-L167 |
EsotericSoftware/yamlbeans | src/com/esotericsoftware/yamlbeans/YamlConfig.java | YamlConfig.setPropertyDefaultType | public void setPropertyDefaultType (Class type, String propertyName, Class defaultType) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null.");
if (defaultType == null) throw new IllegalArgumentException("defaultType cannot be null.");
Property property = Beans.getProperty(type, propertyName, beanProperties, privateFields, this);
if (property == null)
throw new IllegalArgumentException("The class " + type.getName() + " does not have a property named: " + propertyName);
propertyToDefaultType.put(property, defaultType);
} | java | public void setPropertyDefaultType (Class type, String propertyName, Class defaultType) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null.");
if (defaultType == null) throw new IllegalArgumentException("defaultType cannot be null.");
Property property = Beans.getProperty(type, propertyName, beanProperties, privateFields, this);
if (property == null)
throw new IllegalArgumentException("The class " + type.getName() + " does not have a property named: " + propertyName);
propertyToDefaultType.put(property, defaultType);
} | [
"public",
"void",
"setPropertyDefaultType",
"(",
"Class",
"type",
",",
"String",
"propertyName",
",",
"Class",
"defaultType",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"type cannot be null.\"",
")",
";",
"... | Sets the default type of a property. No tag will be output for values of this type. This type will be used if no tag is
found. | [
"Sets",
"the",
"default",
"type",
"of",
"a",
"property",
".",
"No",
"tag",
"will",
"be",
"output",
"for",
"values",
"of",
"this",
"type",
".",
"This",
"type",
"will",
"be",
"used",
"if",
"no",
"tag",
"is",
"found",
"."
] | train | https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlConfig.java#L101-L109 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsync | public static <T1, T2, T3, T4, T5, R> Func5<T1, T2, T3, T4, T5, Observable<R>> toAsync(Func5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> func) {
return toAsync(func, Schedulers.computation());
} | java | public static <T1, T2, T3, T4, T5, R> Func5<T1, T2, T3, T4, T5, Observable<R>> toAsync(Func5<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? extends R> func) {
return toAsync(func, Schedulers.computation());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"R",
">",
"Func5",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"Observable",
"<",
"R",
">",
">",
"toAsync",
"(",
"Func5",
"<",
"?",
"super",
"T1... | Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.png" alt="">
@param <T1> the first parameter type
@param <T2> the second parameter type
@param <T3> the third parameter type
@param <T4> the fourth parameter type
@param <T5> the fifth parameter type
@param <R> the result type
@param func the function to convert
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh229571.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"function",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L421-L423 |
infinispan/infinispan | lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java | ConfigurationParseHelper.parseInt | public static final int parseInt(String value, int defValue, String errorMsgOnParseFailure) {
if (StringHelper.isEmpty(value)) {
return defValue;
} else {
return parseInt(value, errorMsgOnParseFailure);
}
} | java | public static final int parseInt(String value, int defValue, String errorMsgOnParseFailure) {
if (StringHelper.isEmpty(value)) {
return defValue;
} else {
return parseInt(value, errorMsgOnParseFailure);
}
} | [
"public",
"static",
"final",
"int",
"parseInt",
"(",
"String",
"value",
",",
"int",
"defValue",
",",
"String",
"errorMsgOnParseFailure",
")",
"{",
"if",
"(",
"StringHelper",
".",
"isEmpty",
"(",
"value",
")",
")",
"{",
"return",
"defValue",
";",
"}",
"else... | In case value is null or an empty string the defValue is returned
@param value
@param defValue
@param errorMsgOnParseFailure
@return the converted int.
@throws SearchException if value can't be parsed. | [
"In",
"case",
"value",
"is",
"null",
"or",
"an",
"empty",
"string",
"the",
"defValue",
"is",
"returned"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java#L56-L62 |
abel533/Mapper | core/src/main/java/tk/mybatis/mapper/util/OGNL.java | OGNL.notAllNullParameterCheck | public static boolean notAllNullParameterCheck(Object parameter, String fields) {
if (parameter != null) {
try {
Set<EntityColumn> columns = EntityHelper.getColumns(parameter.getClass());
Set<String> fieldSet = new HashSet<String>(Arrays.asList(fields.split(",")));
for (EntityColumn column : columns) {
if (fieldSet.contains(column.getProperty())) {
Object value = column.getEntityField().getValue(parameter);
if (value != null) {
return true;
}
}
}
} catch (Exception e) {
throw new MapperException(SAFE_DELETE_ERROR, e);
}
}
throw new MapperException(SAFE_DELETE_EXCEPTION);
} | java | public static boolean notAllNullParameterCheck(Object parameter, String fields) {
if (parameter != null) {
try {
Set<EntityColumn> columns = EntityHelper.getColumns(parameter.getClass());
Set<String> fieldSet = new HashSet<String>(Arrays.asList(fields.split(",")));
for (EntityColumn column : columns) {
if (fieldSet.contains(column.getProperty())) {
Object value = column.getEntityField().getValue(parameter);
if (value != null) {
return true;
}
}
}
} catch (Exception e) {
throw new MapperException(SAFE_DELETE_ERROR, e);
}
}
throw new MapperException(SAFE_DELETE_EXCEPTION);
} | [
"public",
"static",
"boolean",
"notAllNullParameterCheck",
"(",
"Object",
"parameter",
",",
"String",
"fields",
")",
"{",
"if",
"(",
"parameter",
"!=",
"null",
")",
"{",
"try",
"{",
"Set",
"<",
"EntityColumn",
">",
"columns",
"=",
"EntityHelper",
".",
"getCo... | 检查 paremeter 对象中指定的 fields 是否全是 null,如果是则抛出异常
@param parameter
@param fields
@return | [
"检查",
"paremeter",
"对象中指定的",
"fields",
"是否全是",
"null,如果是则抛出异常"
] | train | https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/util/OGNL.java#L73-L91 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java | ImagePipeline.getEncodedImageDataSourceSupplier | public Supplier<DataSource<CloseableReference<PooledByteBuffer>>>
getEncodedImageDataSourceSupplier(
final ImageRequest imageRequest,
final Object callerContext) {
return new Supplier<DataSource<CloseableReference<PooledByteBuffer>>>() {
@Override
public DataSource<CloseableReference<PooledByteBuffer>> get() {
return fetchEncodedImage(imageRequest, callerContext);
}
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("uri", imageRequest.getSourceUri())
.toString();
}
};
} | java | public Supplier<DataSource<CloseableReference<PooledByteBuffer>>>
getEncodedImageDataSourceSupplier(
final ImageRequest imageRequest,
final Object callerContext) {
return new Supplier<DataSource<CloseableReference<PooledByteBuffer>>>() {
@Override
public DataSource<CloseableReference<PooledByteBuffer>> get() {
return fetchEncodedImage(imageRequest, callerContext);
}
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("uri", imageRequest.getSourceUri())
.toString();
}
};
} | [
"public",
"Supplier",
"<",
"DataSource",
"<",
"CloseableReference",
"<",
"PooledByteBuffer",
">",
">",
">",
"getEncodedImageDataSourceSupplier",
"(",
"final",
"ImageRequest",
"imageRequest",
",",
"final",
"Object",
"callerContext",
")",
"{",
"return",
"new",
"Supplier... | Returns a DataSource supplier that will on get submit the request for execution and return a
DataSource representing the pending results of the task.
@param imageRequest the request to submit (what to execute).
@return a DataSource representing pending results and completion of the request | [
"Returns",
"a",
"DataSource",
"supplier",
"that",
"will",
"on",
"get",
"submit",
"the",
"request",
"for",
"execution",
"and",
"return",
"a",
"DataSource",
"representing",
"the",
"pending",
"results",
"of",
"the",
"task",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java#L169-L186 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WDropdownOptionsExample.java | WDropdownOptionsExample.buildSubordinatePanel | private void buildSubordinatePanel(final WDropdown dropdown, final String value,
final WComponentGroup<SubordinateTarget> group,
final WSubordinateControl control) {
// create the panel.
WPanel panel = new WPanel();
WStyledText subordinateInfo = new WStyledText();
subordinateInfo.setWhitespaceMode(WhitespaceMode.PRESERVE);
subordinateInfo.setText(value + " - Subordinate");
panel.add(subordinateInfo);
// add the panel to the screen and group.
infoPanel.add(panel);
group.addToGroup(panel);
// create the rule
Rule rule = new Rule();
control.addRule(rule);
rule.setCondition(new Equal(dropdown, value));
rule.addActionOnTrue(new ShowInGroup(panel, group));
} | java | private void buildSubordinatePanel(final WDropdown dropdown, final String value,
final WComponentGroup<SubordinateTarget> group,
final WSubordinateControl control) {
// create the panel.
WPanel panel = new WPanel();
WStyledText subordinateInfo = new WStyledText();
subordinateInfo.setWhitespaceMode(WhitespaceMode.PRESERVE);
subordinateInfo.setText(value + " - Subordinate");
panel.add(subordinateInfo);
// add the panel to the screen and group.
infoPanel.add(panel);
group.addToGroup(panel);
// create the rule
Rule rule = new Rule();
control.addRule(rule);
rule.setCondition(new Equal(dropdown, value));
rule.addActionOnTrue(new ShowInGroup(panel, group));
} | [
"private",
"void",
"buildSubordinatePanel",
"(",
"final",
"WDropdown",
"dropdown",
",",
"final",
"String",
"value",
",",
"final",
"WComponentGroup",
"<",
"SubordinateTarget",
">",
"group",
",",
"final",
"WSubordinateControl",
"control",
")",
"{",
"// create the panel.... | Builds a panel for the subordinate control, including the rule for that particular option.
@param dropdown the subordinate trigger.
@param value the dropdown option to be added
@param group the group
@param control the subordinate control | [
"Builds",
"a",
"panel",
"for",
"the",
"subordinate",
"control",
"including",
"the",
"rule",
"for",
"that",
"particular",
"option",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WDropdownOptionsExample.java#L334-L353 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommandExecutionSpec.java | CommandExecutionSpec.assertCommandExistsOnTimeOut | @Then("^in less than '(\\d+?)' seconds, checking each '(\\d+?)' seconds, the command output '(.+?)' contains '(.+?)'( with exit status '(.+?)')?$")
public void assertCommandExistsOnTimeOut(Integer timeout, Integer wait, String command, String search, String foo, Integer exitStatus) throws Exception {
Boolean found = false;
AssertionError ex = null;
command = "set -o pipefail && alias grep='grep --color=never' && " + command;
for (int i = 0; (i <= timeout); i += wait) {
if (found) {
break;
}
commonspec.getLogger().debug("Checking output value");
commonspec.getRemoteSSHConnection().runCommand(command);
commonspec.setCommandResult(commonspec.getRemoteSSHConnection().getResult());
try {
if (exitStatus != null) {
assertThat(commonspec.getRemoteSSHConnection().getExitStatus()).isEqualTo(exitStatus);
}
assertThat(commonspec.getCommandResult()).as("Contains " + search + ".").contains(search);
found = true;
timeout = i;
} catch (AssertionError e) {
commonspec.getLogger().info("Command output don't found yet after " + i + " seconds");
Thread.sleep(wait * 1000);
ex = e;
}
}
if (!found) {
throw (ex);
}
commonspec.getLogger().info("Command output found after " + timeout + " seconds");
} | java | @Then("^in less than '(\\d+?)' seconds, checking each '(\\d+?)' seconds, the command output '(.+?)' contains '(.+?)'( with exit status '(.+?)')?$")
public void assertCommandExistsOnTimeOut(Integer timeout, Integer wait, String command, String search, String foo, Integer exitStatus) throws Exception {
Boolean found = false;
AssertionError ex = null;
command = "set -o pipefail && alias grep='grep --color=never' && " + command;
for (int i = 0; (i <= timeout); i += wait) {
if (found) {
break;
}
commonspec.getLogger().debug("Checking output value");
commonspec.getRemoteSSHConnection().runCommand(command);
commonspec.setCommandResult(commonspec.getRemoteSSHConnection().getResult());
try {
if (exitStatus != null) {
assertThat(commonspec.getRemoteSSHConnection().getExitStatus()).isEqualTo(exitStatus);
}
assertThat(commonspec.getCommandResult()).as("Contains " + search + ".").contains(search);
found = true;
timeout = i;
} catch (AssertionError e) {
commonspec.getLogger().info("Command output don't found yet after " + i + " seconds");
Thread.sleep(wait * 1000);
ex = e;
}
}
if (!found) {
throw (ex);
}
commonspec.getLogger().info("Command output found after " + timeout + " seconds");
} | [
"@",
"Then",
"(",
"\"^in less than '(\\\\d+?)' seconds, checking each '(\\\\d+?)' seconds, the command output '(.+?)' contains '(.+?)'( with exit status '(.+?)')?$\"",
")",
"public",
"void",
"assertCommandExistsOnTimeOut",
"(",
"Integer",
"timeout",
",",
"Integer",
"wait",
",",
"String... | Checks if {@code expectedCount} text is found, whithin a {@code timeout} in the output of command {@code command}
and the exit status is the specified in {@code exitStatus}.
Each negative lookup is followed by a wait of {@code wait} seconds.
@param timeout
@param wait
@param command
@param search
@throws InterruptedException | [
"Checks",
"if",
"{",
"@code",
"expectedCount",
"}",
"text",
"is",
"found",
"whithin",
"a",
"{",
"@code",
"timeout",
"}",
"in",
"the",
"output",
"of",
"command",
"{",
"@code",
"command",
"}",
"and",
"the",
"exit",
"status",
"is",
"the",
"specified",
"in",... | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommandExecutionSpec.java#L151-L180 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java | Path3d.getPathIterator | @Pure
public PathIterator3f getPathIterator(Transform3D transform, double flatness) {
return new Path3f.FlatteningPathIterator3f(getWindingRule(), getPathIterator(transform), flatness, 10);
} | java | @Pure
public PathIterator3f getPathIterator(Transform3D transform, double flatness) {
return new Path3f.FlatteningPathIterator3f(getWindingRule(), getPathIterator(transform), flatness, 10);
} | [
"@",
"Pure",
"public",
"PathIterator3f",
"getPathIterator",
"(",
"Transform3D",
"transform",
",",
"double",
"flatness",
")",
"{",
"return",
"new",
"Path3f",
".",
"FlatteningPathIterator3f",
"(",
"getWindingRule",
"(",
")",
",",
"getPathIterator",
"(",
"transform",
... | Replies an iterator on the path elements.
<p>
Only {@link PathElementType#MOVE_TO},
{@link PathElementType#LINE_TO}, and
{@link PathElementType#CLOSE} types are returned by the iterator.
<p>
The amount of subdivision of the curved segments is controlled by the
flatness parameter, which specifies the maximum distance that any point
on the unflattened transformed curve can deviate from the returned
flattened path segments. Note that a limit on the accuracy of the
flattened path might be silently imposed, causing very small flattening
parameters to be treated as larger values. This limit, if there is one,
is defined by the particular implementation that is used.
<p>
The iterator for this class is not multi-threaded safe.
@param transform is an optional affine Transform3D to be applied to the
coordinates as they are returned in the iteration, or <code>null</code> if
untransformed coordinates are desired.
@param flatness is the maximum distance that the line segments used to approximate
the curved segments are allowed to deviate from any point on the original curve.
@return an iterator on the path elements. | [
"Replies",
"an",
"iterator",
"on",
"the",
"path",
"elements",
".",
"<p",
">",
"Only",
"{",
"@link",
"PathElementType#MOVE_TO",
"}",
"{",
"@link",
"PathElementType#LINE_TO",
"}",
"and",
"{",
"@link",
"PathElementType#CLOSE",
"}",
"types",
"are",
"returned",
"by",... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L1789-L1792 |
threerings/narya | core/src/main/java/com/threerings/io/ObjectOutputStream.java | ObjectOutputStream.writeBareObject | protected void writeBareObject (Object obj, Streamer streamer, boolean useWriter)
throws IOException
{
_current = obj;
_streamer = streamer;
try {
_streamer.writeObject(obj, this, useWriter);
} finally {
_current = null;
_streamer = null;
}
} | java | protected void writeBareObject (Object obj, Streamer streamer, boolean useWriter)
throws IOException
{
_current = obj;
_streamer = streamer;
try {
_streamer.writeObject(obj, this, useWriter);
} finally {
_current = null;
_streamer = null;
}
} | [
"protected",
"void",
"writeBareObject",
"(",
"Object",
"obj",
",",
"Streamer",
"streamer",
",",
"boolean",
"useWriter",
")",
"throws",
"IOException",
"{",
"_current",
"=",
"obj",
";",
"_streamer",
"=",
"streamer",
";",
"try",
"{",
"_streamer",
".",
"writeObjec... | Write a {@link Streamable} instance without associated class metadata. | [
"Write",
"a",
"{"
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/io/ObjectOutputStream.java#L268-L279 |
neo4j/neo4j-java-driver | driver/src/main/java/org/neo4j/driver/GraphDatabase.java | GraphDatabase.routingDriver | public static Driver routingDriver( Iterable<URI> routingUris, AuthToken authToken, Config config )
{
assertRoutingUris( routingUris );
Logger log = createLogger( config );
for ( URI uri : routingUris )
{
try
{
return driver( uri, authToken, config );
}
catch ( ServiceUnavailableException e )
{
log.warn( "Unable to create routing driver for URI: " + uri, e );
}
}
throw new ServiceUnavailableException( "Failed to discover an available server" );
} | java | public static Driver routingDriver( Iterable<URI> routingUris, AuthToken authToken, Config config )
{
assertRoutingUris( routingUris );
Logger log = createLogger( config );
for ( URI uri : routingUris )
{
try
{
return driver( uri, authToken, config );
}
catch ( ServiceUnavailableException e )
{
log.warn( "Unable to create routing driver for URI: " + uri, e );
}
}
throw new ServiceUnavailableException( "Failed to discover an available server" );
} | [
"public",
"static",
"Driver",
"routingDriver",
"(",
"Iterable",
"<",
"URI",
">",
"routingUris",
",",
"AuthToken",
"authToken",
",",
"Config",
"config",
")",
"{",
"assertRoutingUris",
"(",
"routingUris",
")",
";",
"Logger",
"log",
"=",
"createLogger",
"(",
"con... | Try to create a neo4j driver from the <b>first</b> available address.
This is wrapper for the {@link #driver} method that finds the <b>first</b>
server to respond positively.
@param routingUris an {@link Iterable} of server {@link URI}s for Neo4j instances. All given URIs should
have 'neo4j' scheme.
@param authToken authentication to use, see {@link AuthTokens}
@param config user defined configuration
@return a new driver instance | [
"Try",
"to",
"create",
"a",
"neo4j",
"driver",
"from",
"the",
"<b",
">",
"first<",
"/",
"b",
">",
"available",
"address",
".",
"This",
"is",
"wrapper",
"for",
"the",
"{",
"@link",
"#driver",
"}",
"method",
"that",
"finds",
"the",
"<b",
">",
"first<",
... | train | https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/GraphDatabase.java#L150-L168 |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java | Category.of | public static Category of(String description, Setting... settings) {
return new Category(description, Group.of(settings));
} | java | public static Category of(String description, Setting... settings) {
return new Category(description, Group.of(settings));
} | [
"public",
"static",
"Category",
"of",
"(",
"String",
"description",
",",
"Setting",
"...",
"settings",
")",
"{",
"return",
"new",
"Category",
"(",
"description",
",",
"Group",
".",
"of",
"(",
"settings",
")",
")",
";",
"}"
] | Creates a new category from settings, if the settings shouldn't be individually grouped.
@param description Category name, for display in {@link CategoryView}
@param settings {@link Setting} to be shown in the {@link CategoryView}
@return initialized Category object | [
"Creates",
"a",
"new",
"category",
"from",
"settings",
"if",
"the",
"settings",
"shouldn",
"t",
"be",
"individually",
"grouped",
"."
] | train | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/model/Category.java#L92-L94 |
couchbase/java-dcp-client | src/main/java/com/couchbase/client/dcp/util/retry/RetryBuilder.java | RetryBuilder.doOnRetry | public RetryBuilder doOnRetry(Action4<Integer, Throwable, Long, TimeUnit> doOnRetryAction) {
this.doOnRetryAction = doOnRetryAction;
return this;
} | java | public RetryBuilder doOnRetry(Action4<Integer, Throwable, Long, TimeUnit> doOnRetryAction) {
this.doOnRetryAction = doOnRetryAction;
return this;
} | [
"public",
"RetryBuilder",
"doOnRetry",
"(",
"Action4",
"<",
"Integer",
",",
"Throwable",
",",
"Long",
",",
"TimeUnit",
">",
"doOnRetryAction",
")",
"{",
"this",
".",
"doOnRetryAction",
"=",
"doOnRetryAction",
";",
"return",
"this",
";",
"}"
] | Execute some code each time a retry is scheduled (at the moment the retriable exception
is caught, but before the retry delay is applied). Only quick executing code should be
performed, do not block in this action.
<p>
The action receives the retry attempt number (1-n), the exception that caused the retry,
the delay duration and timeunit for the scheduled retry.
@param doOnRetryAction the side-effect action to perform whenever a retry is scheduled.
@see OnRetryAction if you want a shorter signature. | [
"Execute",
"some",
"code",
"each",
"time",
"a",
"retry",
"is",
"scheduled",
"(",
"at",
"the",
"moment",
"the",
"retriable",
"exception",
"is",
"caught",
"but",
"before",
"the",
"retry",
"delay",
"is",
"applied",
")",
".",
"Only",
"quick",
"executing",
"cod... | train | https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/util/retry/RetryBuilder.java#L179-L182 |
openengsb/openengsb | components/ekb/common/src/main/java/org/openengsb/core/ekb/common/EDBConverter.java | EDBConverter.getEntryNameForList | public static String getEntryNameForList(String property, Integer index) {
return String.format("%s.%d", property, index);
} | java | public static String getEntryNameForList(String property, Integer index) {
return String.format("%s.%d", property, index);
} | [
"public",
"static",
"String",
"getEntryNameForList",
"(",
"String",
"property",
",",
"Integer",
"index",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s.%d\"",
",",
"property",
",",
"index",
")",
";",
"}"
] | Returns the entry name for a list element in the EDB format. E.g. the list element for the property "list" with
the index 0 would be "list.0". | [
"Returns",
"the",
"entry",
"name",
"for",
"a",
"list",
"element",
"in",
"the",
"EDB",
"format",
".",
"E",
".",
"g",
".",
"the",
"list",
"element",
"for",
"the",
"property",
"list",
"with",
"the",
"index",
"0",
"would",
"be",
"list",
".",
"0",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/common/src/main/java/org/openengsb/core/ekb/common/EDBConverter.java#L529-L531 |
m-m-m/util | version/src/main/java/net/sf/mmm/util/version/base/AbstractVersionIdentifier.java | AbstractVersionIdentifier.compareToRevision | private int compareToRevision(int currentResult, VersionIdentifier otherVersion) {
return compareToLinear(currentResult, getRevision(), otherVersion.getRevision(), otherVersion);
} | java | private int compareToRevision(int currentResult, VersionIdentifier otherVersion) {
return compareToLinear(currentResult, getRevision(), otherVersion.getRevision(), otherVersion);
} | [
"private",
"int",
"compareToRevision",
"(",
"int",
"currentResult",
",",
"VersionIdentifier",
"otherVersion",
")",
"{",
"return",
"compareToLinear",
"(",
"currentResult",
",",
"getRevision",
"(",
")",
",",
"otherVersion",
".",
"getRevision",
"(",
")",
",",
"otherV... | This method performs the part of {@link #compareTo(VersionIdentifier)} for the {@link #getRevision()
revision}.
@param currentResult is the current result so far.
@param otherVersion is the {@link VersionIdentifier} to compare to.
@return the result of comparison. | [
"This",
"method",
"performs",
"the",
"part",
"of",
"{",
"@link",
"#compareTo",
"(",
"VersionIdentifier",
")",
"}",
"for",
"the",
"{",
"@link",
"#getRevision",
"()",
"revision",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/version/src/main/java/net/sf/mmm/util/version/base/AbstractVersionIdentifier.java#L265-L268 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/LongStream.java | LongStream.mapToDouble | @NotNull
public DoubleStream mapToDouble(@NotNull final LongToDoubleFunction mapper) {
return new DoubleStream(params, new LongMapToDouble(iterator, mapper));
} | java | @NotNull
public DoubleStream mapToDouble(@NotNull final LongToDoubleFunction mapper) {
return new DoubleStream(params, new LongMapToDouble(iterator, mapper));
} | [
"@",
"NotNull",
"public",
"DoubleStream",
"mapToDouble",
"(",
"@",
"NotNull",
"final",
"LongToDoubleFunction",
"mapper",
")",
"{",
"return",
"new",
"DoubleStream",
"(",
"params",
",",
"new",
"LongMapToDouble",
"(",
"iterator",
",",
"mapper",
")",
")",
";",
"}"... | Returns an {@code DoubleStream} consisting of the results of applying the given
function to the elements of this stream.
<p> This is an intermediate operation.
@param mapper the mapper function used to apply to each element
@return the new {@code DoubleStream} | [
"Returns",
"an",
"{",
"@code",
"DoubleStream",
"}",
"consisting",
"of",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"elements",
"of",
"this",
"stream",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L540-L543 |
JadiraOrg/jadira | bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java | BasicBinder.convertTo | public <S, T> T convertTo(ConverterKey<S,T> key, Object object) {
if (object == null) {
return null;
}
Converter<S, T> conv = findConverter(key.getInputClass(), key.getOutputClass(), key.getQualifierAnnotation() == null ? DefaultBinding.class : key.getQualifierAnnotation());
if (conv == null) {
throw new NoConverterFoundException(key);
}
@SuppressWarnings("unchecked")
S myObject = (S)object;
return conv.convert(myObject);
} | java | public <S, T> T convertTo(ConverterKey<S,T> key, Object object) {
if (object == null) {
return null;
}
Converter<S, T> conv = findConverter(key.getInputClass(), key.getOutputClass(), key.getQualifierAnnotation() == null ? DefaultBinding.class : key.getQualifierAnnotation());
if (conv == null) {
throw new NoConverterFoundException(key);
}
@SuppressWarnings("unchecked")
S myObject = (S)object;
return conv.convert(myObject);
} | [
"public",
"<",
"S",
",",
"T",
">",
"T",
"convertTo",
"(",
"ConverterKey",
"<",
"S",
",",
"T",
">",
"key",
",",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Converter",
"<",
"S",
",",
"T... | Convert an object which is an instance of source class to the given target class
@param key The converter key to use
@param object The object to be converted | [
"Convert",
"an",
"object",
"which",
"is",
"an",
"instance",
"of",
"source",
"class",
"to",
"the",
"given",
"target",
"class"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L815-L830 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java | CopySource.setWorkUnitGuid | public static void setWorkUnitGuid(State state, Guid guid) {
state.setProp(WORK_UNIT_GUID, guid.toString());
} | java | public static void setWorkUnitGuid(State state, Guid guid) {
state.setProp(WORK_UNIT_GUID, guid.toString());
} | [
"public",
"static",
"void",
"setWorkUnitGuid",
"(",
"State",
"state",
",",
"Guid",
"guid",
")",
"{",
"state",
".",
"setProp",
"(",
"WORK_UNIT_GUID",
",",
"guid",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Set a unique, replicable guid for this work unit. Used for recovering partially successful work units.
@param state {@link State} where guid should be written.
@param guid A byte array guid. | [
"Set",
"a",
"unique",
"replicable",
"guid",
"for",
"this",
"work",
"unit",
".",
"Used",
"for",
"recovering",
"partially",
"successful",
"work",
"units",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java#L490-L492 |
JakeWharton/NineOldAndroids | library/src/com/nineoldandroids/view/ViewPropertyAnimatorPreHC.java | ViewPropertyAnimatorPreHC.setValue | private void setValue(int propertyConstant, float value) {
//final View.TransformationInfo info = mView.mTransformationInfo;
switch (propertyConstant) {
case TRANSLATION_X:
//info.mTranslationX = value;
mProxy.setTranslationX(value);
break;
case TRANSLATION_Y:
//info.mTranslationY = value;
mProxy.setTranslationY(value);
break;
case ROTATION:
//info.mRotation = value;
mProxy.setRotation(value);
break;
case ROTATION_X:
//info.mRotationX = value;
mProxy.setRotationX(value);
break;
case ROTATION_Y:
//info.mRotationY = value;
mProxy.setRotationY(value);
break;
case SCALE_X:
//info.mScaleX = value;
mProxy.setScaleX(value);
break;
case SCALE_Y:
//info.mScaleY = value;
mProxy.setScaleY(value);
break;
case X:
//info.mTranslationX = value - mView.mLeft;
mProxy.setX(value);
break;
case Y:
//info.mTranslationY = value - mView.mTop;
mProxy.setY(value);
break;
case ALPHA:
//info.mAlpha = value;
mProxy.setAlpha(value);
break;
}
} | java | private void setValue(int propertyConstant, float value) {
//final View.TransformationInfo info = mView.mTransformationInfo;
switch (propertyConstant) {
case TRANSLATION_X:
//info.mTranslationX = value;
mProxy.setTranslationX(value);
break;
case TRANSLATION_Y:
//info.mTranslationY = value;
mProxy.setTranslationY(value);
break;
case ROTATION:
//info.mRotation = value;
mProxy.setRotation(value);
break;
case ROTATION_X:
//info.mRotationX = value;
mProxy.setRotationX(value);
break;
case ROTATION_Y:
//info.mRotationY = value;
mProxy.setRotationY(value);
break;
case SCALE_X:
//info.mScaleX = value;
mProxy.setScaleX(value);
break;
case SCALE_Y:
//info.mScaleY = value;
mProxy.setScaleY(value);
break;
case X:
//info.mTranslationX = value - mView.mLeft;
mProxy.setX(value);
break;
case Y:
//info.mTranslationY = value - mView.mTop;
mProxy.setY(value);
break;
case ALPHA:
//info.mAlpha = value;
mProxy.setAlpha(value);
break;
}
} | [
"private",
"void",
"setValue",
"(",
"int",
"propertyConstant",
",",
"float",
"value",
")",
"{",
"//final View.TransformationInfo info = mView.mTransformationInfo;",
"switch",
"(",
"propertyConstant",
")",
"{",
"case",
"TRANSLATION_X",
":",
"//info.mTranslationX = value;",
"... | This method handles setting the property values directly in the View object's fields.
propertyConstant tells it which property should be set, value is the value to set
the property to.
@param propertyConstant The property to be set
@param value The value to set the property to | [
"This",
"method",
"handles",
"setting",
"the",
"property",
"values",
"directly",
"in",
"the",
"View",
"object",
"s",
"fields",
".",
"propertyConstant",
"tells",
"it",
"which",
"property",
"should",
"be",
"set",
"value",
"is",
"the",
"value",
"to",
"set",
"th... | train | https://github.com/JakeWharton/NineOldAndroids/blob/d582f0ec8e79013e9fa96c07986160b52e662e63/library/src/com/nineoldandroids/view/ViewPropertyAnimatorPreHC.java#L541-L585 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Namespace.java | Namespace.findByQualifier | public static Namespace findByQualifier(EntityManager em, String qualifier) {
SystemAssert.requireArgument(em != null, "EntityManager cannot be null.");
SystemAssert.requireArgument(qualifier != null && !qualifier.isEmpty(), "Namespace qualifier cannot be null or empty.");
TypedQuery<Namespace> query = em.createNamedQuery("Namespace.findByQualifier", Namespace.class);
try {
return query.setParameter("qualifier", qualifier).getSingleResult();
} catch (NoResultException ex) {
return null;
}
} | java | public static Namespace findByQualifier(EntityManager em, String qualifier) {
SystemAssert.requireArgument(em != null, "EntityManager cannot be null.");
SystemAssert.requireArgument(qualifier != null && !qualifier.isEmpty(), "Namespace qualifier cannot be null or empty.");
TypedQuery<Namespace> query = em.createNamedQuery("Namespace.findByQualifier", Namespace.class);
try {
return query.setParameter("qualifier", qualifier).getSingleResult();
} catch (NoResultException ex) {
return null;
}
} | [
"public",
"static",
"Namespace",
"findByQualifier",
"(",
"EntityManager",
"em",
",",
"String",
"qualifier",
")",
"{",
"SystemAssert",
".",
"requireArgument",
"(",
"em",
"!=",
"null",
",",
"\"EntityManager cannot be null.\"",
")",
";",
"SystemAssert",
".",
"requireAr... | Returns a namespace entity using the provided namespace qualifier.
@param em The entity manager. Cannot be null.
@param qualifier The qualifier. Cannot be null or empty.
@return The namespace or null if no corresponding namespace is found. | [
"Returns",
"a",
"namespace",
"entity",
"using",
"the",
"provided",
"namespace",
"qualifier",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Namespace.java#L137-L148 |
Erudika/para | para-client/src/main/java/com/erudika/para/client/ParaClient.java | ParaClient.validationConstraints | public Map<String, Map<String, Map<String, Map<String, ?>>>> validationConstraints(String type) {
return getEntity(invokeGet(Utils.formatMessage("_constraints/{0}", type), null), Map.class);
} | java | public Map<String, Map<String, Map<String, Map<String, ?>>>> validationConstraints(String type) {
return getEntity(invokeGet(Utils.formatMessage("_constraints/{0}", type), null), Map.class);
} | [
"public",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"?",
">",
">",
">",
">",
"validationConstraints",
"(",
"String",
"type",
")",
"{",
"return",
"getEntity",
"(",
"invokeGet",
"(",
"Ut... | Returns the validation constraints map.
@param type a type
@return a map containing all validation constraints for this type. | [
"Returns",
"the",
"validation",
"constraints",
"map",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L1367-L1369 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.data_proContact_proContactId_GET | public OvhProContact data_proContact_proContactId_GET(Long proContactId) throws IOException {
String qPath = "/domain/data/proContact/{proContactId}";
StringBuilder sb = path(qPath, proContactId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhProContact.class);
} | java | public OvhProContact data_proContact_proContactId_GET(Long proContactId) throws IOException {
String qPath = "/domain/data/proContact/{proContactId}";
StringBuilder sb = path(qPath, proContactId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhProContact.class);
} | [
"public",
"OvhProContact",
"data_proContact_proContactId_GET",
"(",
"Long",
"proContactId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/data/proContact/{proContactId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"proContactId",... | Retrieve information about a Pro Contact
REST: GET /domain/data/proContact/{proContactId}
@param proContactId [required] ProContact ID | [
"Retrieve",
"information",
"about",
"a",
"Pro",
"Contact"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L259-L264 |
powermock/powermock | powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java | SuppressCode.suppressMethod | public static synchronized void suppressMethod(Class<?> cls, Class<?>... additionalClasses) {
suppressMethod(cls, false);
for (Class<?> clazz : additionalClasses) {
suppressMethod(clazz, false);
}
} | java | public static synchronized void suppressMethod(Class<?> cls, Class<?>... additionalClasses) {
suppressMethod(cls, false);
for (Class<?> clazz : additionalClasses) {
suppressMethod(clazz, false);
}
} | [
"public",
"static",
"synchronized",
"void",
"suppressMethod",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"Class",
"<",
"?",
">",
"...",
"additionalClasses",
")",
"{",
"suppressMethod",
"(",
"cls",
",",
"false",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">... | Suppress all methods for these classes.
@param cls
The first class whose methods will be suppressed.
@param additionalClasses
Additional classes whose methods will be suppressed. | [
"Suppress",
"all",
"methods",
"for",
"these",
"classes",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java#L156-L161 |
JodaOrg/joda-time | src/main/java/org/joda/time/field/BaseDateTimeField.java | BaseDateTimeField.getAsShortText | public final String getAsShortText(ReadablePartial partial, Locale locale) {
return getAsShortText(partial, partial.get(getType()), locale);
} | java | public final String getAsShortText(ReadablePartial partial, Locale locale) {
return getAsShortText(partial, partial.get(getType()), locale);
} | [
"public",
"final",
"String",
"getAsShortText",
"(",
"ReadablePartial",
"partial",
",",
"Locale",
"locale",
")",
"{",
"return",
"getAsShortText",
"(",
"partial",
",",
"partial",
".",
"get",
"(",
"getType",
"(",
")",
")",
",",
"locale",
")",
";",
"}"
] | Get the human-readable, short text value of this field from a partial instant.
If the specified locale is null, the default locale is used.
<p>
The default implementation calls {@link ReadablePartial#get(DateTimeFieldType)}
and {@link #getAsText(ReadablePartial, int, Locale)}.
@param partial the partial instant to query
@param locale the locale to use for selecting a text symbol, null for default
@return the text value of the field | [
"Get",
"the",
"human",
"-",
"readable",
"short",
"text",
"value",
"of",
"this",
"field",
"from",
"a",
"partial",
"instant",
".",
"If",
"the",
"specified",
"locale",
"is",
"null",
"the",
"default",
"locale",
"is",
"used",
".",
"<p",
">",
"The",
"default",... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/BaseDateTimeField.java#L209-L211 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/RectL.java | RectL.getRotatedX | public static long getRotatedX(final long pX, final long pY,
final double pDegrees, final long pCenterX, final long pCenterY) {
if (pDegrees == 0) { // optimization
return pX;
}
final double radians = pDegrees * Math.PI / 180.;
return getRotatedX(pX, pY, pCenterX, pCenterY, Math.cos(radians), Math.sin(radians));
} | java | public static long getRotatedX(final long pX, final long pY,
final double pDegrees, final long pCenterX, final long pCenterY) {
if (pDegrees == 0) { // optimization
return pX;
}
final double radians = pDegrees * Math.PI / 180.;
return getRotatedX(pX, pY, pCenterX, pCenterY, Math.cos(radians), Math.sin(radians));
} | [
"public",
"static",
"long",
"getRotatedX",
"(",
"final",
"long",
"pX",
",",
"final",
"long",
"pY",
",",
"final",
"double",
"pDegrees",
",",
"final",
"long",
"pCenterX",
",",
"final",
"long",
"pCenterY",
")",
"{",
"if",
"(",
"pDegrees",
"==",
"0",
")",
... | Apply a rotation on a point and get the resulting X
@since 6.0.2 | [
"Apply",
"a",
"rotation",
"on",
"a",
"point",
"and",
"get",
"the",
"resulting",
"X"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/RectL.java#L278-L285 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/ArrayUtil.java | ArrayUtil.indexOf | public static int indexOf(@NonNull final boolean[] array, final boolean value) {
Condition.INSTANCE.ensureNotNull(array, "The array may not be null");
for (int i = 0; i < array.length; i++) {
if (array[i] == value) {
return i;
}
}
return -1;
} | java | public static int indexOf(@NonNull final boolean[] array, final boolean value) {
Condition.INSTANCE.ensureNotNull(array, "The array may not be null");
for (int i = 0; i < array.length; i++) {
if (array[i] == value) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"@",
"NonNull",
"final",
"boolean",
"[",
"]",
"array",
",",
"final",
"boolean",
"value",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"array",
",",
"\"The array may not be null\"",
")",
";",
"f... | Returns the index of the first item of an array, which equals a specific boolean value.
@param array
The array, which should be checked, as a {@link Boolean} array. The array may not be
null
@param value
The value, which should be checked, as a {@link Boolean} value
@return The index of the first item, which equals the given boolean value, as an {@link
Integer} value or -1, if no item of the array equals the value | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"item",
"of",
"an",
"array",
"which",
"equals",
"a",
"specific",
"boolean",
"value",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ArrayUtil.java#L45-L54 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java | AbstractLoader.loadConfigAtAddr | private Observable<Tuple2<LoaderType, BucketConfig>> loadConfigAtAddr(final NetworkAddress node,
final String bucket,
final String username,
final String password) {
return Observable
.just(node)
.flatMap(new Func1<NetworkAddress, Observable<AddNodeResponse>>() {
@Override
public Observable<AddNodeResponse> call(final NetworkAddress address) {
return cluster.send(new AddNodeRequest(address));
}
}).flatMap(new Func1<AddNodeResponse, Observable<AddServiceResponse>>() {
@Override
public Observable<AddServiceResponse> call(final AddNodeResponse response) {
if (!response.status().isSuccess()) {
return Observable.error(new IllegalStateException("Could not add node for config loading."));
}
LOGGER.debug("Successfully added Node {}", response.hostname());
return cluster.<AddServiceResponse>send(
new AddServiceRequest(serviceType, bucket, username, password, port(), response.hostname())
).onErrorResumeNext(new Func1<Throwable, Observable<AddServiceResponse>>() {
@Override
public Observable<AddServiceResponse> call(Throwable throwable) {
LOGGER.debug("Could not add service on {} because of {}, removing it again.",
node, throwable);
return cluster.<RemoveServiceResponse>send(new RemoveServiceRequest(serviceType, bucket, node))
.map(new Func1<RemoveServiceResponse, AddServiceResponse>() {
@Override
public AddServiceResponse call(RemoveServiceResponse removeServiceResponse) {
return new AddServiceResponse(ResponseStatus.FAILURE, response.hostname());
}
});
}
});
}
}).flatMap(new Func1<AddServiceResponse, Observable<String>>() {
@Override
public Observable<String> call(final AddServiceResponse response) {
if (!response.status().isSuccess()) {
return Observable.error(new IllegalStateException("Could not add service for config loading."));
}
LOGGER.debug("Successfully enabled Service {} on Node {}", serviceType, response.hostname());
return discoverConfig(bucket, username, password, response.hostname());
}
})
.map(new Func1<String, Tuple2<LoaderType, BucketConfig>>() {
@Override
public Tuple2<LoaderType, BucketConfig> call(final String rawConfig) {
LOGGER.debug("Got configuration from Service, attempting to parse.");
BucketConfig config = BucketConfigParser.parse(rawConfig, env(), node);
config.username(username);
config.password(password);
return Tuple.create(loaderType, config);
}
});
} | java | private Observable<Tuple2<LoaderType, BucketConfig>> loadConfigAtAddr(final NetworkAddress node,
final String bucket,
final String username,
final String password) {
return Observable
.just(node)
.flatMap(new Func1<NetworkAddress, Observable<AddNodeResponse>>() {
@Override
public Observable<AddNodeResponse> call(final NetworkAddress address) {
return cluster.send(new AddNodeRequest(address));
}
}).flatMap(new Func1<AddNodeResponse, Observable<AddServiceResponse>>() {
@Override
public Observable<AddServiceResponse> call(final AddNodeResponse response) {
if (!response.status().isSuccess()) {
return Observable.error(new IllegalStateException("Could not add node for config loading."));
}
LOGGER.debug("Successfully added Node {}", response.hostname());
return cluster.<AddServiceResponse>send(
new AddServiceRequest(serviceType, bucket, username, password, port(), response.hostname())
).onErrorResumeNext(new Func1<Throwable, Observable<AddServiceResponse>>() {
@Override
public Observable<AddServiceResponse> call(Throwable throwable) {
LOGGER.debug("Could not add service on {} because of {}, removing it again.",
node, throwable);
return cluster.<RemoveServiceResponse>send(new RemoveServiceRequest(serviceType, bucket, node))
.map(new Func1<RemoveServiceResponse, AddServiceResponse>() {
@Override
public AddServiceResponse call(RemoveServiceResponse removeServiceResponse) {
return new AddServiceResponse(ResponseStatus.FAILURE, response.hostname());
}
});
}
});
}
}).flatMap(new Func1<AddServiceResponse, Observable<String>>() {
@Override
public Observable<String> call(final AddServiceResponse response) {
if (!response.status().isSuccess()) {
return Observable.error(new IllegalStateException("Could not add service for config loading."));
}
LOGGER.debug("Successfully enabled Service {} on Node {}", serviceType, response.hostname());
return discoverConfig(bucket, username, password, response.hostname());
}
})
.map(new Func1<String, Tuple2<LoaderType, BucketConfig>>() {
@Override
public Tuple2<LoaderType, BucketConfig> call(final String rawConfig) {
LOGGER.debug("Got configuration from Service, attempting to parse.");
BucketConfig config = BucketConfigParser.parse(rawConfig, env(), node);
config.username(username);
config.password(password);
return Tuple.create(loaderType, config);
}
});
} | [
"private",
"Observable",
"<",
"Tuple2",
"<",
"LoaderType",
",",
"BucketConfig",
">",
">",
"loadConfigAtAddr",
"(",
"final",
"NetworkAddress",
"node",
",",
"final",
"String",
"bucket",
",",
"final",
"String",
"username",
",",
"final",
"String",
"password",
")",
... | Helper method to load a config at a specific {@link InetAddress}.
The common path handled by this abstract implementation includes making sure that the node and service are
usable by the actual implementation. Finally, the raw config string config parsing is handled in this central
place.
@param node the node to grab a config from.
@param bucket the name of the bucket.
@param username the user authorized for bucket access.
@param password the password of the user.
@return a valid {@link BucketConfig} or an errored {@link Observable}. | [
"Helper",
"method",
"to",
"load",
"a",
"config",
"at",
"a",
"specific",
"{",
"@link",
"InetAddress",
"}",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java#L155-L210 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_image.java | xen_image.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_image_responses result = (xen_image_responses) service.get_payload_formatter().string_to_resource(xen_image_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_image_response_array);
}
xen_image[] result_xen_image = new xen_image[result.xen_image_response_array.length];
for(int i = 0; i < result.xen_image_response_array.length; i++)
{
result_xen_image[i] = result.xen_image_response_array[i].xen_image[0];
}
return result_xen_image;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
xen_image_responses result = (xen_image_responses) service.get_payload_formatter().string_to_resource(xen_image_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_image_response_array);
}
xen_image[] result_xen_image = new xen_image[result.xen_image_response_array.length];
for(int i = 0; i < result.xen_image_response_array.length; i++)
{
result_xen_image[i] = result.xen_image_response_array[i].xen_image[0];
}
return result_xen_image;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"xen_image_responses",
"result",
"=",
"(",
"xen_image_responses",
")",
"service",
".",
"get_payload_formatter"... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_image.java#L264-L281 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync | public Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) {
return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>, Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>> call(ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions));
}
});
} | java | public Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>> listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) {
return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>, Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>> call(ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"JobPreparationAndReleaseTaskExecutionInformation",
">",
",",
"JobListPreparationAndReleaseTaskStatusHeaders",
">",
">",
"listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync",
"(",
"final",
"Stri... | Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run.
This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object | [
"Lists",
"the",
"execution",
"status",
"of",
"the",
"Job",
"Preparation",
"and",
"Job",
"Release",
"task",
"for",
"the",
"specified",
"job",
"across",
"the",
"compute",
"nodes",
"where",
"the",
"job",
"has",
"run",
".",
"This",
"API",
"returns",
"the",
"Jo... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3984-L3996 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/util/ClassUtils.java | ClassUtils.instantiateObject | public static Object instantiateObject(String className, Object...args) {
return instantiateObject(className, null, args);
} | java | public static Object instantiateObject(String className, Object...args) {
return instantiateObject(className, null, args);
} | [
"public",
"static",
"Object",
"instantiateObject",
"(",
"String",
"className",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"instantiateObject",
"(",
"className",
",",
"null",
",",
"args",
")",
";",
"}"
] | This method will attempt to create an instance of the specified Class. It uses
a synchronized HashMap to cache the reflection Class lookup. It will execute the default
constructor with the passed in arguments
@param className teh name of the class
@param args arguments to default constructor | [
"This",
"method",
"will",
"attempt",
"to",
"create",
"an",
"instance",
"of",
"the",
"specified",
"Class",
".",
"It",
"uses",
"a",
"synchronized",
"HashMap",
"to",
"cache",
"the",
"reflection",
"Class",
"lookup",
".",
"It",
"will",
"execute",
"the",
"default"... | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/util/ClassUtils.java#L301-L303 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.getByResourceGroupAsync | public Observable<AppServiceEnvironmentResourceInner> getByResourceGroupAsync(String resourceGroupName, String name) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() {
@Override
public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) {
return response.body();
}
});
} | java | public Observable<AppServiceEnvironmentResourceInner> getByResourceGroupAsync(String resourceGroupName, String name) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() {
@Override
public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AppServiceEnvironmentResourceInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
... | Get the properties of an App Service Environment.
Get the properties of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AppServiceEnvironmentResourceInner object | [
"Get",
"the",
"properties",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"the",
"properties",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L622-L629 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/filecache/DistributedCache.java | DistributedCache.makeRelative | public static String makeRelative(URI cache, Configuration conf)
throws IOException {
String host = cache.getHost();
if (host == null) {
host = cache.getScheme();
}
if (host == null) {
URI defaultUri = FileSystem.get(conf).getUri();
host = defaultUri.getHost();
if (host == null) {
host = defaultUri.getScheme();
}
}
String path = host + cache.getPath();
path = path.replace(":/","/"); // remove windows device colon
return path;
} | java | public static String makeRelative(URI cache, Configuration conf)
throws IOException {
String host = cache.getHost();
if (host == null) {
host = cache.getScheme();
}
if (host == null) {
URI defaultUri = FileSystem.get(conf).getUri();
host = defaultUri.getHost();
if (host == null) {
host = defaultUri.getScheme();
}
}
String path = host + cache.getPath();
path = path.replace(":/","/"); // remove windows device colon
return path;
} | [
"public",
"static",
"String",
"makeRelative",
"(",
"URI",
"cache",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"String",
"host",
"=",
"cache",
".",
"getHost",
"(",
")",
";",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"host",
"=",
"... | /*
Returns the relative path of the dir this cache will be localized in
relative path that this cache will be localized in. For
hdfs://hostname:port/absolute_path -- the relative path is
hostname/absolute path -- if it is just /absolute_path -- then the
relative path is hostname of DFS this mapred cluster is running
on/absolute_path | [
"/",
"*",
"Returns",
"the",
"relative",
"path",
"of",
"the",
"dir",
"this",
"cache",
"will",
"be",
"localized",
"in",
"relative",
"path",
"that",
"this",
"cache",
"will",
"be",
"localized",
"in",
".",
"For",
"hdfs",
":",
"//",
"hostname",
":",
"port",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L485-L501 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.