repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.findResult | public static Object findResult(Object self, Object defaultResult, Closure closure) {
Object result = findResult(self, closure);
if (result == null) return defaultResult;
return result;
} | java | public static Object findResult(Object self, Object defaultResult, Closure closure) {
Object result = findResult(self, closure);
if (result == null) return defaultResult;
return result;
} | [
"public",
"static",
"Object",
"findResult",
"(",
"Object",
"self",
",",
"Object",
"defaultResult",
",",
"Closure",
"closure",
")",
"{",
"Object",
"result",
"=",
"findResult",
"(",
"self",
",",
"closure",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
... | Treats the object as iterable, iterating through the values it represents and returns the first non-null result obtained from calling the closure, otherwise returns the defaultResult.
@param self an Object with an iterator returning its values
@param defaultResult an Object that should be returned if all closure results are null
@param closure a closure that returns a non-null value when processing should stop
@return the first non-null result of the closure, otherwise the default value
@since 1.7.5 | [
"Treats",
"the",
"object",
"as",
"iterable",
"iterating",
"through",
"the",
"values",
"it",
"represents",
"and",
"returns",
"the",
"first",
"non",
"-",
"null",
"result",
"obtained",
"from",
"calling",
"the",
"closure",
"otherwise",
"returns",
"the",
"defaultResu... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3845-L3849 |
lucee/Lucee | core/src/main/java/lucee/commons/collection/LinkedHashMapPro.java | LinkedHashMapPro.addEntry | @Override
void addEntry(int hash, K key, V value, int bucketIndex) {
super.addEntry(hash, key, value, bucketIndex);
// Remove eldest entry if instructed
Entry<K, V> eldest = header.after;
if (removeEldestEntry(eldest)) {
removeEntryForKey(eldest.key);
}
} | java | @Override
void addEntry(int hash, K key, V value, int bucketIndex) {
super.addEntry(hash, key, value, bucketIndex);
// Remove eldest entry if instructed
Entry<K, V> eldest = header.after;
if (removeEldestEntry(eldest)) {
removeEntryForKey(eldest.key);
}
} | [
"@",
"Override",
"void",
"addEntry",
"(",
"int",
"hash",
",",
"K",
"key",
",",
"V",
"value",
",",
"int",
"bucketIndex",
")",
"{",
"super",
".",
"addEntry",
"(",
"hash",
",",
"key",
",",
"value",
",",
"bucketIndex",
")",
";",
"// Remove eldest entry if in... | This override alters behavior of superclass put method. It causes newly allocated entry to get
inserted at the end of the linked list and removes the eldest entry if appropriate. | [
"This",
"override",
"alters",
"behavior",
"of",
"superclass",
"put",
"method",
".",
"It",
"causes",
"newly",
"allocated",
"entry",
"to",
"get",
"inserted",
"at",
"the",
"end",
"of",
"the",
"linked",
"list",
"and",
"removes",
"the",
"eldest",
"entry",
"if",
... | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/collection/LinkedHashMapPro.java#L353-L362 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java | CustomerAccountUrl.changePasswordUrl | public static MozuUrl changePasswordUrl(Integer accountId, Boolean unlockAccount, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/Change-Password?unlockAccount={unlockAccount}&userId={userId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("unlockAccount", unlockAccount);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl changePasswordUrl(Integer accountId, Boolean unlockAccount, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/Change-Password?unlockAccount={unlockAccount}&userId={userId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("unlockAccount", unlockAccount);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"changePasswordUrl",
"(",
"Integer",
"accountId",
",",
"Boolean",
"unlockAccount",
",",
"String",
"userId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/accounts/{accountId}/Change-Password?... | Get Resource Url for ChangePassword
@param accountId Unique identifier of the customer account.
@param unlockAccount Specifies whether to unlock the specified customer account.
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"ChangePassword"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java#L95-L102 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.notEquals | @Throws(IllegalEqualException.class)
public static boolean notEquals(final boolean expected, final boolean check, @Nonnull final String message) {
if (expected == check) {
throw new IllegalEqualException(message, check);
}
return check;
} | java | @Throws(IllegalEqualException.class)
public static boolean notEquals(final boolean expected, final boolean check, @Nonnull final String message) {
if (expected == check) {
throw new IllegalEqualException(message, check);
}
return check;
} | [
"@",
"Throws",
"(",
"IllegalEqualException",
".",
"class",
")",
"public",
"static",
"boolean",
"notEquals",
"(",
"final",
"boolean",
"expected",
",",
"final",
"boolean",
"check",
",",
"@",
"Nonnull",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"expect... | Ensures that a passed boolean is not equal to another boolean. The comparison is made using
<code>expected == check</code>.
@param expected
Expected value
@param check
boolean to be checked
@param message
an error message describing why the booleans must equal (will be passed to
{@code IllegalEqualException})
@return the passed boolean argument {@code check}
@throws IllegalEqualException
if both argument values are not equal | [
"Ensures",
"that",
"a",
"passed",
"boolean",
"is",
"not",
"equal",
"to",
"another",
"boolean",
".",
"The",
"comparison",
"is",
"made",
"using",
"<code",
">",
"expected",
"==",
"check<",
"/",
"code",
">",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L2272-L2279 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.findOne | public static <E> E findOne(Iterable<E> iterable, Predicate<E> predicate) {
dbc.precondition(iterable != null, "cannot findOne with a null iterable");
final Iterator<E> filtered = new FilteringIterator<E>(iterable.iterator(), predicate);
return new OneElement<E>().apply(filtered);
} | java | public static <E> E findOne(Iterable<E> iterable, Predicate<E> predicate) {
dbc.precondition(iterable != null, "cannot findOne with a null iterable");
final Iterator<E> filtered = new FilteringIterator<E>(iterable.iterator(), predicate);
return new OneElement<E>().apply(filtered);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"findOne",
"(",
"Iterable",
"<",
"E",
">",
"iterable",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"dbc",
".",
"precondition",
"(",
"iterable",
"!=",
"null",
",",
"\"cannot findOne with a null iterable\"",
... | Searches the only matching element returning it.
@param <E> the element type parameter
@param iterable the iterable to be searched
@param predicate the predicate to be applied to each element
@throws IllegalStateException if more than one element is found
@throws IllegalArgumentException if no element matches
@return the found element | [
"Searches",
"the",
"only",
"matching",
"element",
"returning",
"it",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L525-L529 |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.getWholeDnsCache | public static DnsCache getWholeDnsCache() {
try {
return InetAddressCacheUtil.listInetAddressCache();
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to getWholeDnsCache, cause: " + e.toString(), e);
}
} | java | public static DnsCache getWholeDnsCache() {
try {
return InetAddressCacheUtil.listInetAddressCache();
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to getWholeDnsCache, cause: " + e.toString(), e);
}
} | [
"public",
"static",
"DnsCache",
"getWholeDnsCache",
"(",
")",
"{",
"try",
"{",
"return",
"InetAddressCacheUtil",
".",
"listInetAddressCache",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DnsCacheManipulatorException",
"(",
"\"Fa... | Get whole dns cache info.
@return dns cache entries
@throws DnsCacheManipulatorException Operation fail
@since 1.2.0 | [
"Get",
"whole",
"dns",
"cache",
"info",
"."
] | train | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L177-L183 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optIntArray | @Nullable
public static int[] optIntArray(@Nullable Bundle bundle, @Nullable String key) {
return optIntArray(bundle, key, new int[0]);
} | java | @Nullable
public static int[] optIntArray(@Nullable Bundle bundle, @Nullable String key) {
return optIntArray(bundle, key, new int[0]);
} | [
"@",
"Nullable",
"public",
"static",
"int",
"[",
"]",
"optIntArray",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optIntArray",
"(",
"bundle",
",",
"key",
",",
"new",
"int",
"[",
"0",
"]",
")",
... | Returns a optional int array value. In other words, returns the value mapped by key if it exists and is a int array.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return null.
@param key a key for the value.
@return a int array value if exists, null otherwise.
@see android.os.Bundle#getIntArray(String) | [
"Returns",
"a",
"optional",
"int",
"array",
"value",
".",
"In",
"other",
"words",
"returns",
"the",
"value",
"mapped",
"by",
"key",
"if",
"it",
"exists",
"and",
"is",
"a",
"int",
"array",
".",
"The",
"bundle",
"argument",
"is",
"allowed",
"to",
"be",
"... | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L569-L572 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java | ImageIOHelper.createTiffFiles | public static List<File> createTiffFiles(List<IIOImage> imageList, int index) throws IOException {
return createTiffFiles(imageList, index, 0, 0);
} | java | public static List<File> createTiffFiles(List<IIOImage> imageList, int index) throws IOException {
return createTiffFiles(imageList, index, 0, 0);
} | [
"public",
"static",
"List",
"<",
"File",
">",
"createTiffFiles",
"(",
"List",
"<",
"IIOImage",
">",
"imageList",
",",
"int",
"index",
")",
"throws",
"IOException",
"{",
"return",
"createTiffFiles",
"(",
"imageList",
",",
"index",
",",
"0",
",",
"0",
")",
... | Creates a list of TIFF image files from a list of <code>IIOImage</code>
objects.
@param imageList a list of <code>IIOImage</code> objects
@param index an index of the page; -1 means all pages
@return a list of TIFF image files
@throws IOException | [
"Creates",
"a",
"list",
"of",
"TIFF",
"image",
"files",
"from",
"a",
"list",
"of",
"<code",
">",
"IIOImage<",
"/",
"code",
">",
"objects",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java#L162-L164 |
rythmengine/rythmengine | src/main/java/org/rythmengine/toString/ToStringStyle.java | ToStringStyle.appendIdentityHashCode | protected void appendIdentityHashCode(StringBuilder buffer, Object object) {
if (this.isUseIdentityHashCode() && object != null) {
register(object);
buffer.append('@');
buffer.append(Integer.toHexString(System.identityHashCode(object)));
}
} | java | protected void appendIdentityHashCode(StringBuilder buffer, Object object) {
if (this.isUseIdentityHashCode() && object != null) {
register(object);
buffer.append('@');
buffer.append(Integer.toHexString(System.identityHashCode(object)));
}
} | [
"protected",
"void",
"appendIdentityHashCode",
"(",
"StringBuilder",
"buffer",
",",
"Object",
"object",
")",
"{",
"if",
"(",
"this",
".",
"isUseIdentityHashCode",
"(",
")",
"&&",
"object",
"!=",
"null",
")",
"{",
"register",
"(",
"object",
")",
";",
"buffer"... | <p>Append the {@link System#identityHashCode(Object)}.</p>
@param buffer the <code>StringBuilder</code> to populate
@param object the <code>Object</code> whose id to output | [
"<p",
">",
"Append",
"the",
"{",
"@link",
"System#identityHashCode",
"(",
"Object",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/toString/ToStringStyle.java#L1465-L1471 |
gaixie/jibu-core | src/main/java/org/gaixie/jibu/mail/JavaMailSender.java | JavaMailSender.send | public void send(String recipients, String subj, String text) {
final String usr = JibuConfig.getProperty("mail.username");
final String pwd = JibuConfig.getProperty("mail.password");
Session session =
Session.getDefaultInstance(JibuConfig.getProperties(),
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(usr,pwd);
}
});
try {
Message msg = new MimeMessage(session);
msg.addRecipients(Message.RecipientType.TO,
InternetAddress.parse(recipients));
msg.setSubject(subj);
msg.setText(text);
Transport.send(msg);
} catch (MessagingException e) {
throw new RuntimeException(e);
}
} | java | public void send(String recipients, String subj, String text) {
final String usr = JibuConfig.getProperty("mail.username");
final String pwd = JibuConfig.getProperty("mail.password");
Session session =
Session.getDefaultInstance(JibuConfig.getProperties(),
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(usr,pwd);
}
});
try {
Message msg = new MimeMessage(session);
msg.addRecipients(Message.RecipientType.TO,
InternetAddress.parse(recipients));
msg.setSubject(subj);
msg.setText(text);
Transport.send(msg);
} catch (MessagingException e) {
throw new RuntimeException(e);
}
} | [
"public",
"void",
"send",
"(",
"String",
"recipients",
",",
"String",
"subj",
",",
"String",
"text",
")",
"{",
"final",
"String",
"usr",
"=",
"JibuConfig",
".",
"getProperty",
"(",
"\"mail.username\"",
")",
";",
"final",
"String",
"pwd",
"=",
"JibuConfig",
... | 通过 javax.mail 发送邮件。
@param recipients 接收方邮件地址,多个邮件地址以逗号分隔。
@param subj 邮件标题。
@param text 邮件正文。 | [
"通过",
"javax",
".",
"mail",
"发送邮件。"
] | train | https://github.com/gaixie/jibu-core/blob/d5462f2883321c82d898c8752b7e5eba4b7dc184/src/main/java/org/gaixie/jibu/mail/JavaMailSender.java#L43-L63 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spy1st | public static <T1, T2> BiConsumer<T1, T2> spy1st(BiConsumer<T1, T2> consumer, Box<T1> param1) {
return spy(consumer, param1, Box.<T2>empty());
} | java | public static <T1, T2> BiConsumer<T1, T2> spy1st(BiConsumer<T1, T2> consumer, Box<T1> param1) {
return spy(consumer, param1, Box.<T2>empty());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"spy1st",
"(",
"BiConsumer",
"<",
"T1",
",",
"T2",
">",
"consumer",
",",
"Box",
"<",
"T1",
">",
"param1",
")",
"{",
"return",
"spy",
"(",
"consumer",
",",
"pa... | Proxies a binary consumer spying for first parameter.
@param <T1> the consumer first parameter type
@param <T2> the consumer second parameter type
@param consumer the consumer that will be spied
@param param1 a box that will be containing the first spied parameter
@return the proxied consumer | [
"Proxies",
"a",
"binary",
"consumer",
"spying",
"for",
"first",
"parameter",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L362-L364 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java | HBaseDataHandler.onFindKeyOnly | private FilterList onFindKeyOnly(FilterList filterList, boolean isFindKeyOnly)
{
if (isFindKeyOnly)
{
if (filterList == null)
{
filterList = new FilterList();
}
filterList.addFilter(new KeyOnlyFilter());
}
return filterList;
} | java | private FilterList onFindKeyOnly(FilterList filterList, boolean isFindKeyOnly)
{
if (isFindKeyOnly)
{
if (filterList == null)
{
filterList = new FilterList();
}
filterList.addFilter(new KeyOnlyFilter());
}
return filterList;
} | [
"private",
"FilterList",
"onFindKeyOnly",
"(",
"FilterList",
"filterList",
",",
"boolean",
"isFindKeyOnly",
")",
"{",
"if",
"(",
"isFindKeyOnly",
")",
"{",
"if",
"(",
"filterList",
"==",
"null",
")",
"{",
"filterList",
"=",
"new",
"FilterList",
"(",
")",
";"... | On find key only.
@param filterList
the filter list
@param isFindKeyOnly
the is find key only
@return the filter list | [
"On",
"find",
"key",
"only",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java#L184-L195 |
BeholderTAF/beholder-selenium | src/main/java/br/ufmg/dcc/saotome/beholder/selenium/ui/SeleniumComponent.java | SeleniumComponent.setElement | public final void setElement(final WebElement element) {
if (element == null) {
throw new IllegalArgumentException(String.format(ErrorMessages.ERROR_TEMPLATE_VARIABLE_NULL,"element"));
}
this.element = element;
validateElementTag();
validateAttributes();
} | java | public final void setElement(final WebElement element) {
if (element == null) {
throw new IllegalArgumentException(String.format(ErrorMessages.ERROR_TEMPLATE_VARIABLE_NULL,"element"));
}
this.element = element;
validateElementTag();
validateAttributes();
} | [
"public",
"final",
"void",
"setElement",
"(",
"final",
"WebElement",
"element",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"ErrorMessages",
".",
"ERROR_TEMPLATE_VARIABLE_... | The Selenium-Webdriver element that represents the component HTML of the
simulated page.
@param element WebElement object | [
"The",
"Selenium",
"-",
"Webdriver",
"element",
"that",
"represents",
"the",
"component",
"HTML",
"of",
"the",
"simulated",
"page",
"."
] | train | https://github.com/BeholderTAF/beholder-selenium/blob/8dc999e74a9c3f5c09e4e68ea0ef5634cdb760ee/src/main/java/br/ufmg/dcc/saotome/beholder/selenium/ui/SeleniumComponent.java#L107-L117 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/FolderResourcesImpl.java | FolderResourcesImpl.getFolder | public Folder getFolder(long folderId, EnumSet<SourceInclusion> includes) throws SmartsheetException {
String path = "folders/" + folderId;
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
path += QueryUtil.generateUrl(null, parameters);
return this.getResource(path, Folder.class);
} | java | public Folder getFolder(long folderId, EnumSet<SourceInclusion> includes) throws SmartsheetException {
String path = "folders/" + folderId;
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
path += QueryUtil.generateUrl(null, parameters);
return this.getResource(path, Folder.class);
} | [
"public",
"Folder",
"getFolder",
"(",
"long",
"folderId",
",",
"EnumSet",
"<",
"SourceInclusion",
">",
"includes",
")",
"throws",
"SmartsheetException",
"{",
"String",
"path",
"=",
"\"folders/\"",
"+",
"folderId",
";",
"HashMap",
"<",
"String",
",",
"Object",
... | Get a folder.
It mirrors to the following Smartsheet REST API method: GET /folder/{id}
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 folderId the folder id
@param includes the include parameters
@return the folder (note that if there is no such resource, this method will throw ResourceNotFoundException
rather than returning null)
@throws SmartsheetException the smartsheet exception | [
"Get",
"a",
"folder",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/FolderResourcesImpl.java#L77-L84 |
cryptomator/cryptofs | src/main/java/org/cryptomator/cryptofs/ConflictResolver.java | ConflictResolver.resolveDirectoryConflictTrivially | private boolean resolveDirectoryConflictTrivially(Path canonicalPath, Path conflictingPath) throws IOException {
if (!Files.exists(canonicalPath)) {
Files.move(conflictingPath, canonicalPath, StandardCopyOption.ATOMIC_MOVE);
return true;
} else if (hasSameDirFileContent(conflictingPath, canonicalPath)) {
// there must not be two directories pointing to the same dirId.
LOG.info("Removing conflicting directory file {} (identical to {})", conflictingPath, canonicalPath);
Files.deleteIfExists(conflictingPath);
return true;
} else {
return false;
}
} | java | private boolean resolveDirectoryConflictTrivially(Path canonicalPath, Path conflictingPath) throws IOException {
if (!Files.exists(canonicalPath)) {
Files.move(conflictingPath, canonicalPath, StandardCopyOption.ATOMIC_MOVE);
return true;
} else if (hasSameDirFileContent(conflictingPath, canonicalPath)) {
// there must not be two directories pointing to the same dirId.
LOG.info("Removing conflicting directory file {} (identical to {})", conflictingPath, canonicalPath);
Files.deleteIfExists(conflictingPath);
return true;
} else {
return false;
}
} | [
"private",
"boolean",
"resolveDirectoryConflictTrivially",
"(",
"Path",
"canonicalPath",
",",
"Path",
"conflictingPath",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"Files",
".",
"exists",
"(",
"canonicalPath",
")",
")",
"{",
"Files",
".",
"move",
"(",
... | Tries to resolve a conflicting directory file without renaming the file. If successful, only the file with the canonical path will exist afterwards.
@param canonicalPath The path to the original (conflict-free) directory file (must not exist).
@param conflictingPath The path to the potentially conflicting file (known to exist).
@return <code>true</code> if the conflict has been resolved.
@throws IOException | [
"Tries",
"to",
"resolve",
"a",
"conflicting",
"directory",
"file",
"without",
"renaming",
"the",
"file",
".",
"If",
"successful",
"only",
"the",
"file",
"with",
"the",
"canonical",
"path",
"will",
"exist",
"afterwards",
"."
] | train | https://github.com/cryptomator/cryptofs/blob/67fc1a4950dd1c150cd2e2c75bcabbeb7c9ac82e/src/main/java/org/cryptomator/cryptofs/ConflictResolver.java#L140-L152 |
Alluxio/alluxio | job/server/src/main/java/alluxio/job/migrate/MigrateDefinition.java | MigrateDefinition.computeTargetPath | private static String computeTargetPath(String path, String source, String destination)
throws Exception {
String relativePath = PathUtils.subtractPaths(path, source);
return PathUtils.concatPath(destination, relativePath);
} | java | private static String computeTargetPath(String path, String source, String destination)
throws Exception {
String relativePath = PathUtils.subtractPaths(path, source);
return PathUtils.concatPath(destination, relativePath);
} | [
"private",
"static",
"String",
"computeTargetPath",
"(",
"String",
"path",
",",
"String",
"source",
",",
"String",
"destination",
")",
"throws",
"Exception",
"{",
"String",
"relativePath",
"=",
"PathUtils",
".",
"subtractPaths",
"(",
"path",
",",
"source",
")",
... | Computes the path that the given path should end up at when source is migrated to destination.
@param path a path to migrate which must be a descendent path of the source path,
e.g. /src/file
@param source the base source path being migrated, e.g. /src
@param destination the path to migrate to, e.g. /dst/src
@return the path which file should be migrated to, e.g. /dst/src/file | [
"Computes",
"the",
"path",
"that",
"the",
"given",
"path",
"should",
"end",
"up",
"at",
"when",
"source",
"is",
"migrated",
"to",
"destination",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/job/migrate/MigrateDefinition.java#L218-L222 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java | TransitionManager.beginDelayedTransition | public static void beginDelayedTransition(final @NonNull ViewGroup sceneRoot, @Nullable Transition transition) {
if (!sPendingTransitions.contains(sceneRoot) && ViewUtils.isLaidOut(sceneRoot, true)) {
if (Transition.DBG) {
Log.d(LOG_TAG, "beginDelayedTransition: root, transition = " +
sceneRoot + ", " + transition);
}
sPendingTransitions.add(sceneRoot);
if (transition == null) {
transition = sDefaultTransition;
}
final Transition transitionClone = transition.clone();
sceneChangeSetup(sceneRoot, transitionClone);
Scene.setCurrentScene(sceneRoot, null);
sceneChangeRunTransition(sceneRoot, transitionClone);
}
} | java | public static void beginDelayedTransition(final @NonNull ViewGroup sceneRoot, @Nullable Transition transition) {
if (!sPendingTransitions.contains(sceneRoot) && ViewUtils.isLaidOut(sceneRoot, true)) {
if (Transition.DBG) {
Log.d(LOG_TAG, "beginDelayedTransition: root, transition = " +
sceneRoot + ", " + transition);
}
sPendingTransitions.add(sceneRoot);
if (transition == null) {
transition = sDefaultTransition;
}
final Transition transitionClone = transition.clone();
sceneChangeSetup(sceneRoot, transitionClone);
Scene.setCurrentScene(sceneRoot, null);
sceneChangeRunTransition(sceneRoot, transitionClone);
}
} | [
"public",
"static",
"void",
"beginDelayedTransition",
"(",
"final",
"@",
"NonNull",
"ViewGroup",
"sceneRoot",
",",
"@",
"Nullable",
"Transition",
"transition",
")",
"{",
"if",
"(",
"!",
"sPendingTransitions",
".",
"contains",
"(",
"sceneRoot",
")",
"&&",
"ViewUt... | Convenience method to animate to a new scene defined by all changes within
the given scene root between calling this method and the next rendering frame.
Calling this method causes TransitionManager to capture current values in the
scene root and then post a request to run a transition on the next frame.
At that time, the new values in the scene root will be captured and changes
will be animated. There is no need to create a Scene; it is implied by
changes which take place between calling this method and the next frame when
the transition begins.
<p/>
<p>Calling this method several times before the next frame (for example, if
unrelated code also wants to make dynamic changes and run a transition on
the same scene root), only the first call will trigger capturing values
and exiting the current scene. Subsequent calls to the method with the
same scene root during the same frame will be ignored.</p>
<p/>
<p>Passing in <code>null</code> for the transition parameter will
cause the TransitionManager to use its default transition.</p>
@param sceneRoot The root of the View hierarchy to run the transition on.
@param transition The transition to use for this change. A
value of null causes the TransitionManager to use the default transition. | [
"Convenience",
"method",
"to",
"animate",
"to",
"a",
"new",
"scene",
"defined",
"by",
"all",
"changes",
"within",
"the",
"given",
"scene",
"root",
"between",
"calling",
"this",
"method",
"and",
"the",
"next",
"rendering",
"frame",
".",
"Calling",
"this",
"me... | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java#L431-L446 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java | BinaryHashBucketArea.insertToBucket | boolean insertToBucket(int hashCode, int pointer, boolean spillingAllowed, boolean sizeAddAndCheckResize) throws IOException {
final int posHashCode = findBucket(hashCode);
// get the bucket for the given hash code
final int bucketArrayPos = posHashCode >> table.bucketsPerSegmentBits;
final int bucketInSegmentPos = (posHashCode & table.bucketsPerSegmentMask) << BUCKET_SIZE_BITS;
final MemorySegment bucket = this.buckets[bucketArrayPos];
return insertToBucket(bucket, bucketInSegmentPos, hashCode, pointer, spillingAllowed, sizeAddAndCheckResize);
} | java | boolean insertToBucket(int hashCode, int pointer, boolean spillingAllowed, boolean sizeAddAndCheckResize) throws IOException {
final int posHashCode = findBucket(hashCode);
// get the bucket for the given hash code
final int bucketArrayPos = posHashCode >> table.bucketsPerSegmentBits;
final int bucketInSegmentPos = (posHashCode & table.bucketsPerSegmentMask) << BUCKET_SIZE_BITS;
final MemorySegment bucket = this.buckets[bucketArrayPos];
return insertToBucket(bucket, bucketInSegmentPos, hashCode, pointer, spillingAllowed, sizeAddAndCheckResize);
} | [
"boolean",
"insertToBucket",
"(",
"int",
"hashCode",
",",
"int",
"pointer",
",",
"boolean",
"spillingAllowed",
",",
"boolean",
"sizeAddAndCheckResize",
")",
"throws",
"IOException",
"{",
"final",
"int",
"posHashCode",
"=",
"findBucket",
"(",
"hashCode",
")",
";",
... | Insert into bucket by hashCode and pointer.
@return return false when spill own partition. | [
"Insert",
"into",
"bucket",
"by",
"hashCode",
"and",
"pointer",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java#L436-L443 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.rectangularPrismSurfaceArea | public static double rectangularPrismSurfaceArea(final double length, final double height, final double width) {
return ((2 * length * height) + (2 * length * width) + (2 * height * width));
} | java | public static double rectangularPrismSurfaceArea(final double length, final double height, final double width) {
return ((2 * length * height) + (2 * length * width) + (2 * height * width));
} | [
"public",
"static",
"double",
"rectangularPrismSurfaceArea",
"(",
"final",
"double",
"length",
",",
"final",
"double",
"height",
",",
"final",
"double",
"width",
")",
"{",
"return",
"(",
"(",
"2",
"*",
"length",
"*",
"height",
")",
"+",
"(",
"2",
"*",
"l... | Calculates the surface area of a rectangular prism;
@param length a double value indicating the length of the rectangular prism (x axis).
@param height a double value indicating the height of the rectangular prism (y axis).
@param width a double value indicating the width of the rectangular prism (z axis).
@return the surface area of a rectangular prism given the length, height and width of the sides. | [
"Calculates",
"the",
"surface",
"area",
"of",
"a",
"rectangular",
"prism",
";"
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L364-L366 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java | NodeSet.insertNode | public void insertNode(Node n, int pos)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
insertElementAt(n, pos);
} | java | public void insertNode(Node n, int pos)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
insertElementAt(n, pos);
} | [
"public",
"void",
"insertNode",
"(",
"Node",
"n",
",",
"int",
"pos",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESET_NOT_MUTABLE",
",",
... | Insert a node at a given position.
@param n Node to be added
@param pos Offset at which the node is to be inserted,
with 0 being the first position.
@throws RuntimeException thrown if this NodeSet is not of
a mutable type. | [
"Insert",
"a",
"node",
"at",
"a",
"given",
"position",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L397-L404 |
apache/groovy | src/main/java/org/codehaus/groovy/ast/CompileUnit.java | CompileUnit.addClassNodeToCompile | public void addClassNodeToCompile(ClassNode node, SourceUnit location) {
String nodeName = node.getName();
classesToCompile.put(nodeName, node);
classNameToSource.put(nodeName, location);
} | java | public void addClassNodeToCompile(ClassNode node, SourceUnit location) {
String nodeName = node.getName();
classesToCompile.put(nodeName, node);
classNameToSource.put(nodeName, location);
} | [
"public",
"void",
"addClassNodeToCompile",
"(",
"ClassNode",
"node",
",",
"SourceUnit",
"location",
")",
"{",
"String",
"nodeName",
"=",
"node",
".",
"getName",
"(",
")",
";",
"classesToCompile",
".",
"put",
"(",
"nodeName",
",",
"node",
")",
";",
"className... | this method actually does not compile a class. It's only
a marker that this type has to be compiled by the CompilationUnit
at the end of a parse step no node should be be left. | [
"this",
"method",
"actually",
"does",
"not",
"compile",
"a",
"class",
".",
"It",
"s",
"only",
"a",
"marker",
"that",
"this",
"type",
"has",
"to",
"be",
"compiled",
"by",
"the",
"CompilationUnit",
"at",
"the",
"end",
"of",
"a",
"parse",
"step",
"no",
"n... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/CompileUnit.java#L168-L172 |
SG-O/miIO | src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java | Vacuum.setTimerEnabled | public boolean setTimerEnabled(VacuumTimer timer) throws CommandExecutionException {
if (timer == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_PARAMETERS);
JSONArray payload = new JSONArray();
payload.put(timer.getID());
payload.put(timer.getOnOff());
return sendOk("upd_timer", payload);
} | java | public boolean setTimerEnabled(VacuumTimer timer) throws CommandExecutionException {
if (timer == null) throw new CommandExecutionException(CommandExecutionException.Error.INVALID_PARAMETERS);
JSONArray payload = new JSONArray();
payload.put(timer.getID());
payload.put(timer.getOnOff());
return sendOk("upd_timer", payload);
} | [
"public",
"boolean",
"setTimerEnabled",
"(",
"VacuumTimer",
"timer",
")",
"throws",
"CommandExecutionException",
"{",
"if",
"(",
"timer",
"==",
"null",
")",
"throw",
"new",
"CommandExecutionException",
"(",
"CommandExecutionException",
".",
"Error",
".",
"INVALID_PARA... | Enable or disable a scheduled cleanup.
@param timer The timer to update.
@return True if the command was received successfully.
@throws CommandExecutionException When there has been a error during the communication or the response was invalid. | [
"Enable",
"or",
"disable",
"a",
"scheduled",
"cleanup",
"."
] | train | https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java#L221-L227 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java | FileLocator.matchFileInNamedPath | public static File matchFileInNamedPath(String regex, Collection<String> pathNameList) {
if (regex == null || pathNameList == null || pathNameList.size() == 0)
return null;
for (String currentPath : pathNameList) {
if (currentPath == null || currentPath.length() == 0)
continue;
File result = matchFile(new File(currentPath), regex);
if (result != null)
return result;
}
return null;
} | java | public static File matchFileInNamedPath(String regex, Collection<String> pathNameList) {
if (regex == null || pathNameList == null || pathNameList.size() == 0)
return null;
for (String currentPath : pathNameList) {
if (currentPath == null || currentPath.length() == 0)
continue;
File result = matchFile(new File(currentPath), regex);
if (result != null)
return result;
}
return null;
} | [
"public",
"static",
"File",
"matchFileInNamedPath",
"(",
"String",
"regex",
",",
"Collection",
"<",
"String",
">",
"pathNameList",
")",
"{",
"if",
"(",
"regex",
"==",
"null",
"||",
"pathNameList",
"==",
"null",
"||",
"pathNameList",
".",
"size",
"(",
")",
... | Look for given file in any of the specified directories, return the first
one found.
@param name
The name of the file to find
@param pathNameList
The collection of directories to check
@return The File object if the file is found;
null if the pathList is null or empty, or file is not found.
@throws SecurityException
If a security manager exists and its <code>{@link java.lang.SecurityManager#checkRead(java.lang.String)}</code> method denies read access to the file. | [
"Look",
"for",
"given",
"file",
"in",
"any",
"of",
"the",
"specified",
"directories",
"return",
"the",
"first",
"one",
"found",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java#L148-L162 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/cglib3_2_0/proxy/BridgeMethodResolver.java | BridgeMethodResolver.resolveAll | public Map/*<Signature, Signature>*/resolveAll() {
Map resolved = new HashMap();
for (Iterator entryIter = declToBridge.entrySet().iterator(); entryIter.hasNext(); ) {
Map.Entry entry = (Map.Entry)entryIter.next();
Class owner = (Class)entry.getKey();
Set bridges = (Set)entry.getValue();
try {
new ClassReader(owner.getName())
.accept(new BridgedFinder(bridges, resolved),
ClassReader.SKIP_FRAMES | ClassReader.SKIP_DEBUG);
} catch(IOException ignored) {}
}
return resolved;
} | java | public Map/*<Signature, Signature>*/resolveAll() {
Map resolved = new HashMap();
for (Iterator entryIter = declToBridge.entrySet().iterator(); entryIter.hasNext(); ) {
Map.Entry entry = (Map.Entry)entryIter.next();
Class owner = (Class)entry.getKey();
Set bridges = (Set)entry.getValue();
try {
new ClassReader(owner.getName())
.accept(new BridgedFinder(bridges, resolved),
ClassReader.SKIP_FRAMES | ClassReader.SKIP_DEBUG);
} catch(IOException ignored) {}
}
return resolved;
} | [
"public",
"Map",
"/*<Signature, Signature>*/",
"resolveAll",
"(",
")",
"{",
"Map",
"resolved",
"=",
"new",
"HashMap",
"(",
")",
";",
"for",
"(",
"Iterator",
"entryIter",
"=",
"declToBridge",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"entry... | Finds all bridge methods that are being called with invokespecial &
returns them. | [
"Finds",
"all",
"bridge",
"methods",
"that",
"are",
"being",
"called",
"with",
"invokespecial",
"&",
"returns",
"them",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/cglib3_2_0/proxy/BridgeMethodResolver.java#L50-L63 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/FileUtils.java | FileUtils.copyFile | public static void copyFile(File dest, File source) throws IOException {
InputStream input = null;
try {
input = new FileInputStream(source);
createFile(dest, input);
} finally {
Utils.tryToClose(input);
}
} | java | public static void copyFile(File dest, File source) throws IOException {
InputStream input = null;
try {
input = new FileInputStream(source);
createFile(dest, input);
} finally {
Utils.tryToClose(input);
}
} | [
"public",
"static",
"void",
"copyFile",
"(",
"File",
"dest",
",",
"File",
"source",
")",
"throws",
"IOException",
"{",
"InputStream",
"input",
"=",
"null",
";",
"try",
"{",
"input",
"=",
"new",
"FileInputStream",
"(",
"source",
")",
";",
"createFile",
"(",... | Copy from one file to the other
@param dest
@param source
@throws IOException | [
"Copy",
"from",
"one",
"file",
"to",
"the",
"other"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/FileUtils.java#L80-L88 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/chrono/CopticChronology.java | CopticChronology.dateYearDay | @Override
public CopticDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | java | @Override
public CopticDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | [
"@",
"Override",
"public",
"CopticDate",
"dateYearDay",
"(",
"Era",
"era",
",",
"int",
"yearOfEra",
",",
"int",
"dayOfYear",
")",
"{",
"return",
"dateYearDay",
"(",
"prolepticYear",
"(",
"era",
",",
"yearOfEra",
")",
",",
"dayOfYear",
")",
";",
"}"
] | Obtains a local date in Coptic calendar system from the
era, year-of-era and day-of-year fields.
@param era the Coptic era, not null
@param yearOfEra the year-of-era
@param dayOfYear the day-of-year
@return the Coptic local date, not null
@throws DateTimeException if unable to create the date
@throws ClassCastException if the {@code era} is not a {@code CopticEra} | [
"Obtains",
"a",
"local",
"date",
"in",
"Coptic",
"calendar",
"system",
"from",
"the",
"era",
"year",
"-",
"of",
"-",
"era",
"and",
"day",
"-",
"of",
"-",
"year",
"fields",
"."
] | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/CopticChronology.java#L183-L186 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.registerServiceInstance | public void registerServiceInstance(ProvidedServiceInstance instance, final RegistrationCallback cb, Object context){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.RegisterServiceInstance);
RegisterServiceInstanceProtocol p = new RegisterServiceInstanceProtocol(instance);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
cb.call(result, error, ctx);
}
};
connection.submitCallbackRequest(header, p, pcb, context);
} | java | public void registerServiceInstance(ProvidedServiceInstance instance, final RegistrationCallback cb, Object context){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.RegisterServiceInstance);
RegisterServiceInstanceProtocol p = new RegisterServiceInstanceProtocol(instance);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
cb.call(result, error, ctx);
}
};
connection.submitCallbackRequest(header, p, pcb, context);
} | [
"public",
"void",
"registerServiceInstance",
"(",
"ProvidedServiceInstance",
"instance",
",",
"final",
"RegistrationCallback",
"cb",
",",
"Object",
"context",
")",
"{",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
"(",
")",
";",
"header",
".",
"setType"... | Register ServiceInstance with Callback.
@param instance
the ProvidedServiceInstance.
@param cb
the callback.
@param context
the context Object. | [
"Register",
"ServiceInstance",
"with",
"Callback",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L370-L389 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/Gtin8Validator.java | Gtin8Validator.isValid | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString = Objects.toString(pvalue, null);
if (StringUtils.isEmpty(valueAsString)) {
return true;
}
if (!StringUtils.isNumeric(valueAsString)) {
// EAN8 must be numeric, but that's handled by digits annotation
return true;
}
if (valueAsString.length() != GTIN8_LENGTH) {
// EAN8 size is wrong, but that's handled by size annotation
return true;
}
// calculate and check checksum (GTIN8/EAN8)
return CHECK_GTIN8.isValid(valueAsString);
} | java | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString = Objects.toString(pvalue, null);
if (StringUtils.isEmpty(valueAsString)) {
return true;
}
if (!StringUtils.isNumeric(valueAsString)) {
// EAN8 must be numeric, but that's handled by digits annotation
return true;
}
if (valueAsString.length() != GTIN8_LENGTH) {
// EAN8 size is wrong, but that's handled by size annotation
return true;
}
// calculate and check checksum (GTIN8/EAN8)
return CHECK_GTIN8.isValid(valueAsString);
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"Object",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"final",
"String",
"valueAsString",
"=",
"Objects",
".",
"toString",
"(",
"pvalue",
",",
"null",
")",
... | {@inheritDoc} check if given string is a valid gtin.
@see javax.validation.ConstraintValidator#isValid(java.lang.Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"string",
"is",
"a",
"valid",
"gtin",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/Gtin8Validator.java#L61-L77 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java | MSPDIReader.readCalendar | private void readCalendar(Project.Calendars.Calendar calendar, HashMap<BigInteger, ProjectCalendar> map, List<Pair<ProjectCalendar, BigInteger>> baseCalendars)
{
ProjectCalendar bc = m_projectFile.addCalendar();
bc.setUniqueID(NumberHelper.getInteger(calendar.getUID()));
bc.setName(calendar.getName());
BigInteger baseCalendarID = calendar.getBaseCalendarUID();
if (baseCalendarID != null)
{
baseCalendars.add(new Pair<ProjectCalendar, BigInteger>(bc, baseCalendarID));
}
readExceptions(calendar, bc);
boolean readExceptionsFromDays = bc.getCalendarExceptions().isEmpty();
Project.Calendars.Calendar.WeekDays days = calendar.getWeekDays();
if (days != null)
{
for (Project.Calendars.Calendar.WeekDays.WeekDay weekDay : days.getWeekDay())
{
readDay(bc, weekDay, readExceptionsFromDays);
}
}
else
{
bc.setWorkingDay(Day.SUNDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.MONDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.TUESDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.THURSDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.FRIDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.SATURDAY, DayType.DEFAULT);
}
readWorkWeeks(calendar, bc);
map.put(calendar.getUID(), bc);
m_eventManager.fireCalendarReadEvent(bc);
} | java | private void readCalendar(Project.Calendars.Calendar calendar, HashMap<BigInteger, ProjectCalendar> map, List<Pair<ProjectCalendar, BigInteger>> baseCalendars)
{
ProjectCalendar bc = m_projectFile.addCalendar();
bc.setUniqueID(NumberHelper.getInteger(calendar.getUID()));
bc.setName(calendar.getName());
BigInteger baseCalendarID = calendar.getBaseCalendarUID();
if (baseCalendarID != null)
{
baseCalendars.add(new Pair<ProjectCalendar, BigInteger>(bc, baseCalendarID));
}
readExceptions(calendar, bc);
boolean readExceptionsFromDays = bc.getCalendarExceptions().isEmpty();
Project.Calendars.Calendar.WeekDays days = calendar.getWeekDays();
if (days != null)
{
for (Project.Calendars.Calendar.WeekDays.WeekDay weekDay : days.getWeekDay())
{
readDay(bc, weekDay, readExceptionsFromDays);
}
}
else
{
bc.setWorkingDay(Day.SUNDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.MONDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.TUESDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.THURSDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.FRIDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.SATURDAY, DayType.DEFAULT);
}
readWorkWeeks(calendar, bc);
map.put(calendar.getUID(), bc);
m_eventManager.fireCalendarReadEvent(bc);
} | [
"private",
"void",
"readCalendar",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"calendar",
",",
"HashMap",
"<",
"BigInteger",
",",
"ProjectCalendar",
">",
"map",
",",
"List",
"<",
"Pair",
"<",
"ProjectCalendar",
",",
"BigInteger",
">",
">",
"baseCalenda... | This method extracts data for a single calendar from an MSPDI file.
@param calendar Calendar data
@param map Map of calendar UIDs to names
@param baseCalendars list of base calendars | [
"This",
"method",
"extracts",
"data",
"for",
"a",
"single",
"calendar",
"from",
"an",
"MSPDI",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L444-L482 |
jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsProvider.java | AbstractJaxRsProvider.getRequest | public Builder getRequest(final RequestTypeEnum requestType, final RestOperationTypeEnum restOperation, final String theResourceName) {
return new JaxRsRequest.Builder(this, requestType, restOperation, myUriInfo.getRequestUri().toString(), theResourceName);
} | java | public Builder getRequest(final RequestTypeEnum requestType, final RestOperationTypeEnum restOperation, final String theResourceName) {
return new JaxRsRequest.Builder(this, requestType, restOperation, myUriInfo.getRequestUri().toString(), theResourceName);
} | [
"public",
"Builder",
"getRequest",
"(",
"final",
"RequestTypeEnum",
"requestType",
",",
"final",
"RestOperationTypeEnum",
"restOperation",
",",
"final",
"String",
"theResourceName",
")",
"{",
"return",
"new",
"JaxRsRequest",
".",
"Builder",
"(",
"this",
",",
"reques... | Return the requestbuilder for the server
@param requestType
the type of the request
@param restOperation
the rest operation type
@param theResourceName
the resource name
@return the requestbuilder | [
"Return",
"the",
"requestbuilder",
"for",
"the",
"server"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsProvider.java#L207-L209 |
playn/playn | core/src/playn/core/Keyboard.java | Keyboard.isKey | public static Function<Event, KeyEvent> isKey (final Key key) {
return new Function<Event, KeyEvent>() {
public KeyEvent apply (Event event) {
return isKey(key, event);
}
};
} | java | public static Function<Event, KeyEvent> isKey (final Key key) {
return new Function<Event, KeyEvent>() {
public KeyEvent apply (Event event) {
return isKey(key, event);
}
};
} | [
"public",
"static",
"Function",
"<",
"Event",
",",
"KeyEvent",
">",
"isKey",
"(",
"final",
"Key",
"key",
")",
"{",
"return",
"new",
"Function",
"<",
"Event",
",",
"KeyEvent",
">",
"(",
")",
"{",
"public",
"KeyEvent",
"apply",
"(",
"Event",
"event",
")"... | Returns a collector function for key events for {@code key}. Use it to obtain only events for
a particular key like so:
<pre>{@code
Input.keyboardEvents.collect(Keyboard.isKey(Key.X)).connect(event -> {
// handle the 'x' key being pressed or released
});
}</pre> | [
"Returns",
"a",
"collector",
"function",
"for",
"key",
"events",
"for",
"{",
"@code",
"key",
"}",
".",
"Use",
"it",
"to",
"obtain",
"only",
"events",
"for",
"a",
"particular",
"key",
"like",
"so",
":"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Keyboard.java#L159-L165 |
spotify/async-google-pubsub-client | src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java | Pubsub.getSubscription | public PubsubFuture<Subscription> getSubscription(final String canonicalSubscriptionName) {
validateCanonicalSubscription(canonicalSubscriptionName);
return get("get subscription", canonicalSubscriptionName, readJson(Subscription.class));
} | java | public PubsubFuture<Subscription> getSubscription(final String canonicalSubscriptionName) {
validateCanonicalSubscription(canonicalSubscriptionName);
return get("get subscription", canonicalSubscriptionName, readJson(Subscription.class));
} | [
"public",
"PubsubFuture",
"<",
"Subscription",
">",
"getSubscription",
"(",
"final",
"String",
"canonicalSubscriptionName",
")",
"{",
"validateCanonicalSubscription",
"(",
"canonicalSubscriptionName",
")",
";",
"return",
"get",
"(",
"\"get subscription\"",
",",
"canonical... | Get a Pub/Sub subscription.
@param canonicalSubscriptionName The canonical (including project) name of the subscription to get.
@return A future that is completed when this request is completed. The future will be completed with {@code null}
if the response is 404. | [
"Get",
"a",
"Pub",
"/",
"Sub",
"subscription",
"."
] | train | https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L443-L446 |
RestExpress/PluginExpress | logging/src/main/java/org/restexpress/plugin/logging/LoggingMessageObserver.java | LoggingMessageObserver.createCompleteMessage | protected String createCompleteMessage(Request request, Response response, Timer timer)
{
StringBuilder sb = new StringBuilder(request.getEffectiveHttpMethod().toString());
sb.append(" ");
sb.append(request.getUrl());
if (timer != null)
{
sb.append(" responded with ");
sb.append(response.getResponseStatus().toString());
sb.append(" in ");
sb.append(timer.toString());
}
else
{
sb.append(" responded with ");
sb.append(response.getResponseStatus().toString());
sb.append(" (no timer found)");
}
return sb.toString();
} | java | protected String createCompleteMessage(Request request, Response response, Timer timer)
{
StringBuilder sb = new StringBuilder(request.getEffectiveHttpMethod().toString());
sb.append(" ");
sb.append(request.getUrl());
if (timer != null)
{
sb.append(" responded with ");
sb.append(response.getResponseStatus().toString());
sb.append(" in ");
sb.append(timer.toString());
}
else
{
sb.append(" responded with ");
sb.append(response.getResponseStatus().toString());
sb.append(" (no timer found)");
}
return sb.toString();
} | [
"protected",
"String",
"createCompleteMessage",
"(",
"Request",
"request",
",",
"Response",
"response",
",",
"Timer",
"timer",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"request",
".",
"getEffectiveHttpMethod",
"(",
")",
".",
"toString",
... | Create the message to be logged when a request is completed successfully.
Sub-classes can override.
@param request
@param response
@param timer
@return a string message. | [
"Create",
"the",
"message",
"to",
"be",
"logged",
"when",
"a",
"request",
"is",
"completed",
"successfully",
".",
"Sub",
"-",
"classes",
"can",
"override",
"."
] | train | https://github.com/RestExpress/PluginExpress/blob/aeb13907c23bf31ef2b2b17ae4c0ca4a6f5bee69/logging/src/main/java/org/restexpress/plugin/logging/LoggingMessageObserver.java#L88-L109 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_tcp_frontend_POST | public OvhFrontendTcp serviceName_tcp_frontend_POST(String serviceName, String[] allowedSource, String[] dedicatedIpfo, Long defaultFarmId, Long defaultSslId, Boolean disabled, String displayName, String port, Boolean ssl, String zone) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/frontend";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "allowedSource", allowedSource);
addBody(o, "dedicatedIpfo", dedicatedIpfo);
addBody(o, "defaultFarmId", defaultFarmId);
addBody(o, "defaultSslId", defaultSslId);
addBody(o, "disabled", disabled);
addBody(o, "displayName", displayName);
addBody(o, "port", port);
addBody(o, "ssl", ssl);
addBody(o, "zone", zone);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhFrontendTcp.class);
} | java | public OvhFrontendTcp serviceName_tcp_frontend_POST(String serviceName, String[] allowedSource, String[] dedicatedIpfo, Long defaultFarmId, Long defaultSslId, Boolean disabled, String displayName, String port, Boolean ssl, String zone) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/frontend";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "allowedSource", allowedSource);
addBody(o, "dedicatedIpfo", dedicatedIpfo);
addBody(o, "defaultFarmId", defaultFarmId);
addBody(o, "defaultSslId", defaultSslId);
addBody(o, "disabled", disabled);
addBody(o, "displayName", displayName);
addBody(o, "port", port);
addBody(o, "ssl", ssl);
addBody(o, "zone", zone);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhFrontendTcp.class);
} | [
"public",
"OvhFrontendTcp",
"serviceName_tcp_frontend_POST",
"(",
"String",
"serviceName",
",",
"String",
"[",
"]",
"allowedSource",
",",
"String",
"[",
"]",
"dedicatedIpfo",
",",
"Long",
"defaultFarmId",
",",
"Long",
"defaultSslId",
",",
"Boolean",
"disabled",
",",... | Add a new TCP frontend on your IP Load Balancing
REST: POST /ipLoadbalancing/{serviceName}/tcp/frontend
@param port [required] Port(s) attached to your frontend. Supports single port (numerical value), range (2 dash-delimited increasing ports) and comma-separated list of 'single port' and/or 'range'. Each port must be in the [1;49151] range.
@param disabled [required] Disable your frontend. Default: 'false'
@param defaultFarmId [required] Default TCP Farm of your frontend
@param displayName [required] Human readable name for your frontend, this field is for you
@param dedicatedIpfo [required] Only attach frontend on these ip. No restriction if null
@param ssl [required] SSL deciphering. Default: 'false'
@param zone [required] Zone of your frontend. Use "all" for all owned zone.
@param allowedSource [required] Restrict IP Load Balancing access to these ip block. No restriction if null
@param defaultSslId [required] Default ssl served to your customer
@param serviceName [required] The internal name of your IP load balancing | [
"Add",
"a",
"new",
"TCP",
"frontend",
"on",
"your",
"IP",
"Load",
"Balancing"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1500-L1515 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java | DockerUtils.getParentId | public static String getParentId(String digest, String host) throws IOException {
DockerClient dockerClient = null;
try {
dockerClient = getDockerClient(host);
return dockerClient.inspectImageCmd(digest).exec().getParent();
} finally {
closeQuietly(dockerClient);
}
} | java | public static String getParentId(String digest, String host) throws IOException {
DockerClient dockerClient = null;
try {
dockerClient = getDockerClient(host);
return dockerClient.inspectImageCmd(digest).exec().getParent();
} finally {
closeQuietly(dockerClient);
}
} | [
"public",
"static",
"String",
"getParentId",
"(",
"String",
"digest",
",",
"String",
"host",
")",
"throws",
"IOException",
"{",
"DockerClient",
"dockerClient",
"=",
"null",
";",
"try",
"{",
"dockerClient",
"=",
"getDockerClient",
"(",
"host",
")",
";",
"return... | Get parent digest of an image.
@param digest
@param host
@return | [
"Get",
"parent",
"digest",
"of",
"an",
"image",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L95-L103 |
protostuff/protostuff | protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java | XmlIOUtil.mergeFrom | public static <T> void mergeFrom(XMLStreamReader parser, T message, Schema<T> schema)
throws IOException, XMLStreamException, XmlInputException
{
// final String simpleName = schema.messageName();
if (parser.nextTag() != START_ELEMENT ||
!schema.messageName().equals(parser.getLocalName()))
{
throw new XmlInputException("Expected token START_ELEMENT: " + schema.messageName());
}
if (parser.nextTag() == END_ELEMENT)
{
// if(!simpleName.equals(parser.getLocalName()))
// throw new XmlInputException("Expecting token END_ELEMENT: " + simpleName);
// empty message;
return;
}
schema.mergeFrom(new XmlInput(parser), message);
// if(!simpleName.equals(parser.getLocalName()))
// throw new XmlInputException("Expecting token END_ELEMENT: " + simpleName);
} | java | public static <T> void mergeFrom(XMLStreamReader parser, T message, Schema<T> schema)
throws IOException, XMLStreamException, XmlInputException
{
// final String simpleName = schema.messageName();
if (parser.nextTag() != START_ELEMENT ||
!schema.messageName().equals(parser.getLocalName()))
{
throw new XmlInputException("Expected token START_ELEMENT: " + schema.messageName());
}
if (parser.nextTag() == END_ELEMENT)
{
// if(!simpleName.equals(parser.getLocalName()))
// throw new XmlInputException("Expecting token END_ELEMENT: " + simpleName);
// empty message;
return;
}
schema.mergeFrom(new XmlInput(parser), message);
// if(!simpleName.equals(parser.getLocalName()))
// throw new XmlInputException("Expecting token END_ELEMENT: " + simpleName);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"mergeFrom",
"(",
"XMLStreamReader",
"parser",
",",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
")",
"throws",
"IOException",
",",
"XMLStreamException",
",",
"XmlInputException",
"{",
"// final String simple... | Merges the {@code message} from the {@link XMLStreamReader} using the given {@code schema}. | [
"Merges",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L297-L321 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ComponentUtils.java | _ComponentUtils.idsAreEqual | private static boolean idsAreEqual(String id, UIComponent cmp)
{
if (id.equals(cmp.getId()))
{
return true;
}
return false;
} | java | private static boolean idsAreEqual(String id, UIComponent cmp)
{
if (id.equals(cmp.getId()))
{
return true;
}
return false;
} | [
"private",
"static",
"boolean",
"idsAreEqual",
"(",
"String",
"id",
",",
"UIComponent",
"cmp",
")",
"{",
"if",
"(",
"id",
".",
"equals",
"(",
"cmp",
".",
"getId",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | /*
Return true if the specified component matches the provided id. This needs some quirks to handle components whose
id value gets dynamically "tweaked", eg a UIData component whose id gets the current row index appended to it. | [
"/",
"*",
"Return",
"true",
"if",
"the",
"specified",
"component",
"matches",
"the",
"provided",
"id",
".",
"This",
"needs",
"some",
"quirks",
"to",
"handle",
"components",
"whose",
"id",
"value",
"gets",
"dynamically",
"tweaked",
"eg",
"a",
"UIData",
"compo... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ComponentUtils.java#L258-L266 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.addEquals | public static void addEquals( DMatrix2 a , DMatrix2 b ) {
a.a1 += b.a1;
a.a2 += b.a2;
} | java | public static void addEquals( DMatrix2 a , DMatrix2 b ) {
a.a1 += b.a1;
a.a2 += b.a2;
} | [
"public",
"static",
"void",
"addEquals",
"(",
"DMatrix2",
"a",
",",
"DMatrix2",
"b",
")",
"{",
"a",
".",
"a1",
"+=",
"b",
".",
"a1",
";",
"a",
".",
"a2",
"+=",
"b",
".",
"a2",
";",
"}"
] | <p>Performs the following operation:<br>
<br>
a = a + b <br>
a<sub>i</sub> = a<sub>i</sub> + b<sub>i</sub> <br>
</p>
@param a A Vector. Modified.
@param b A Vector. Not modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"a",
"=",
"a",
"+",
"b",
"<br",
">",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"+",
"b<sub",
">",
"i<",
"/",
"sub",
">",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L101-L104 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java | CacheListUtil.set | public static Single<Boolean> set(String cacheKey, int index, Object value) {
return set(CacheService.CACHE_CONFIG_BEAN, cacheKey, index, value);
} | java | public static Single<Boolean> set(String cacheKey, int index, Object value) {
return set(CacheService.CACHE_CONFIG_BEAN, cacheKey, index, value);
} | [
"public",
"static",
"Single",
"<",
"Boolean",
">",
"set",
"(",
"String",
"cacheKey",
",",
"int",
"index",
",",
"Object",
"value",
")",
"{",
"return",
"set",
"(",
"CacheService",
".",
"CACHE_CONFIG_BEAN",
",",
"cacheKey",
",",
"index",
",",
"value",
")",
... | update the value of the specified index
@param cacheKey the key for the cached list.
@param index the index of the element you want to update.
@param value the new value for the element.
@return true on success, false on failure. | [
"update",
"the",
"value",
"of",
"the",
"specified",
"index"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java#L186-L188 |
logic-ng/LogicNG | src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java | BDDKernel.exists | public int exists(final int r, final int var) {
final int res;
if (var < 2)
return r;
varset2vartable(var);
initRef();
res = quantRec(r, Operand.OR, var << 3);
return res;
} | java | public int exists(final int r, final int var) {
final int res;
if (var < 2)
return r;
varset2vartable(var);
initRef();
res = quantRec(r, Operand.OR, var << 3);
return res;
} | [
"public",
"int",
"exists",
"(",
"final",
"int",
"r",
",",
"final",
"int",
"var",
")",
"{",
"final",
"int",
"res",
";",
"if",
"(",
"var",
"<",
"2",
")",
"return",
"r",
";",
"varset2vartable",
"(",
"var",
")",
";",
"initRef",
"(",
")",
";",
"res",
... | Existential quantifier elimination for the variables in {@code var}.
@param r the BDD root node
@param var the variables to eliminate
@return the BDD with the eliminated variables | [
"Existential",
"quantifier",
"elimination",
"for",
"the",
"variables",
"in",
"{"
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/jbuddy/BDDKernel.java#L741-L749 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/SwingUtil.java | SwingUtil.fitRectInRect | public static Point fitRectInRect (Rectangle rect, Rectangle bounds)
{
// Guarantee that the right and bottom edges will be contained and do our best for the top
// and left edges.
return new Point(Math.min(bounds.x + bounds.width - rect.width,
Math.max(rect.x, bounds.x)),
Math.min(bounds.y + bounds.height - rect.height,
Math.max(rect.y, bounds.y)));
} | java | public static Point fitRectInRect (Rectangle rect, Rectangle bounds)
{
// Guarantee that the right and bottom edges will be contained and do our best for the top
// and left edges.
return new Point(Math.min(bounds.x + bounds.width - rect.width,
Math.max(rect.x, bounds.x)),
Math.min(bounds.y + bounds.height - rect.height,
Math.max(rect.y, bounds.y)));
} | [
"public",
"static",
"Point",
"fitRectInRect",
"(",
"Rectangle",
"rect",
",",
"Rectangle",
"bounds",
")",
"{",
"// Guarantee that the right and bottom edges will be contained and do our best for the top",
"// and left edges.",
"return",
"new",
"Point",
"(",
"Math",
".",
"min",... | Returns the most reasonable position for the specified rectangle to be placed at so as to
maximize its containment by the specified bounding rectangle while still placing it as near
its original coordinates as possible.
@param rect the rectangle to be positioned.
@param bounds the containing rectangle. | [
"Returns",
"the",
"most",
"reasonable",
"position",
"for",
"the",
"specified",
"rectangle",
"to",
"be",
"placed",
"at",
"so",
"as",
"to",
"maximize",
"its",
"containment",
"by",
"the",
"specified",
"bounding",
"rectangle",
"while",
"still",
"placing",
"it",
"a... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/SwingUtil.java#L149-L157 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.startFuture | public static <T> Observable<T> startFuture(Func0<? extends Future<? extends T>> functionAsync,
Scheduler scheduler) {
return OperatorStartFuture.startFuture(functionAsync, scheduler);
} | java | public static <T> Observable<T> startFuture(Func0<? extends Future<? extends T>> functionAsync,
Scheduler scheduler) {
return OperatorStartFuture.startFuture(functionAsync, scheduler);
} | [
"public",
"static",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"startFuture",
"(",
"Func0",
"<",
"?",
"extends",
"Future",
"<",
"?",
"extends",
"T",
">",
">",
"functionAsync",
",",
"Scheduler",
"scheduler",
")",
"{",
"return",
"OperatorStartFuture",
".",
... | Invokes the asynchronous function immediately, surfacing the result through an Observable and waits on
the specified Scheduler.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/startFuture.s.png" alt="">
@param <T> the result type
@param functionAsync the asynchronous function to run
@param scheduler the Scheduler where the completion of the Future is awaited
@return an Observable that surfaces the result of the future
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-startfuture">RxJava Wiki: startFuture()</a> | [
"Invokes",
"the",
"asynchronous",
"function",
"immediately",
"surfacing",
"the",
"result",
"through",
"an",
"Observable",
"and",
"waits",
"on",
"the",
"specified",
"Scheduler",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1781-L1784 |
craftercms/commons | utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java | HttpUtils.getCookie | public static Cookie getCookie(String name, HttpServletRequest request) {
Cookie[] cookies = request.getCookies();
if (ArrayUtils.isNotEmpty(cookies)) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals(name)) {
return cookie;
}
}
}
return null;
} | java | public static Cookie getCookie(String name, HttpServletRequest request) {
Cookie[] cookies = request.getCookies();
if (ArrayUtils.isNotEmpty(cookies)) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals(name)) {
return cookie;
}
}
}
return null;
} | [
"public",
"static",
"Cookie",
"getCookie",
"(",
"String",
"name",
",",
"HttpServletRequest",
"request",
")",
"{",
"Cookie",
"[",
"]",
"cookies",
"=",
"request",
".",
"getCookies",
"(",
")",
";",
"if",
"(",
"ArrayUtils",
".",
"isNotEmpty",
"(",
"cookies",
"... | Returns the cookie with the given name for the given request
@param name the name of the cookie
@param request the request where to extract the request from
@return the cookie object, or null if not found | [
"Returns",
"the",
"cookie",
"with",
"the",
"given",
"name",
"for",
"the",
"given",
"request"
] | train | https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/http/HttpUtils.java#L148-L159 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.telephony_billingAccount_portability_POST | public OvhOrder telephony_billingAccount_portability_POST(String billingAccount, String building, String callNumber, String city, String contactName, String contactNumber, OvhCountriesAvailable country, Date desireDate, Boolean displayUniversalDirectory, String door, Boolean executeAsSoonAsPossible, Boolean fiabilisation, String firstName, Double floor, String lineToRedirectAliasTo, String listNumbers, String mobilePhone, String name, OvhOfferType offer, String rio, String siret, OvhSocialReason socialReason, OvhSpecialNumberCategoryEnum specialNumberCategory, Double stair, String streetName, Double streetNumber, String streetNumberExtra, String streetType, OvhNumberType type, String zip) throws IOException {
String qPath = "/order/telephony/{billingAccount}/portability";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "building", building);
addBody(o, "callNumber", callNumber);
addBody(o, "city", city);
addBody(o, "contactName", contactName);
addBody(o, "contactNumber", contactNumber);
addBody(o, "country", country);
addBody(o, "desireDate", desireDate);
addBody(o, "displayUniversalDirectory", displayUniversalDirectory);
addBody(o, "door", door);
addBody(o, "executeAsSoonAsPossible", executeAsSoonAsPossible);
addBody(o, "fiabilisation", fiabilisation);
addBody(o, "firstName", firstName);
addBody(o, "floor", floor);
addBody(o, "lineToRedirectAliasTo", lineToRedirectAliasTo);
addBody(o, "listNumbers", listNumbers);
addBody(o, "mobilePhone", mobilePhone);
addBody(o, "name", name);
addBody(o, "offer", offer);
addBody(o, "rio", rio);
addBody(o, "siret", siret);
addBody(o, "socialReason", socialReason);
addBody(o, "specialNumberCategory", specialNumberCategory);
addBody(o, "stair", stair);
addBody(o, "streetName", streetName);
addBody(o, "streetNumber", streetNumber);
addBody(o, "streetNumberExtra", streetNumberExtra);
addBody(o, "streetType", streetType);
addBody(o, "type", type);
addBody(o, "zip", zip);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder telephony_billingAccount_portability_POST(String billingAccount, String building, String callNumber, String city, String contactName, String contactNumber, OvhCountriesAvailable country, Date desireDate, Boolean displayUniversalDirectory, String door, Boolean executeAsSoonAsPossible, Boolean fiabilisation, String firstName, Double floor, String lineToRedirectAliasTo, String listNumbers, String mobilePhone, String name, OvhOfferType offer, String rio, String siret, OvhSocialReason socialReason, OvhSpecialNumberCategoryEnum specialNumberCategory, Double stair, String streetName, Double streetNumber, String streetNumberExtra, String streetType, OvhNumberType type, String zip) throws IOException {
String qPath = "/order/telephony/{billingAccount}/portability";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "building", building);
addBody(o, "callNumber", callNumber);
addBody(o, "city", city);
addBody(o, "contactName", contactName);
addBody(o, "contactNumber", contactNumber);
addBody(o, "country", country);
addBody(o, "desireDate", desireDate);
addBody(o, "displayUniversalDirectory", displayUniversalDirectory);
addBody(o, "door", door);
addBody(o, "executeAsSoonAsPossible", executeAsSoonAsPossible);
addBody(o, "fiabilisation", fiabilisation);
addBody(o, "firstName", firstName);
addBody(o, "floor", floor);
addBody(o, "lineToRedirectAliasTo", lineToRedirectAliasTo);
addBody(o, "listNumbers", listNumbers);
addBody(o, "mobilePhone", mobilePhone);
addBody(o, "name", name);
addBody(o, "offer", offer);
addBody(o, "rio", rio);
addBody(o, "siret", siret);
addBody(o, "socialReason", socialReason);
addBody(o, "specialNumberCategory", specialNumberCategory);
addBody(o, "stair", stair);
addBody(o, "streetName", streetName);
addBody(o, "streetNumber", streetNumber);
addBody(o, "streetNumberExtra", streetNumberExtra);
addBody(o, "streetType", streetType);
addBody(o, "type", type);
addBody(o, "zip", zip);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"telephony_billingAccount_portability_POST",
"(",
"String",
"billingAccount",
",",
"String",
"building",
",",
"String",
"callNumber",
",",
"String",
"city",
",",
"String",
"contactName",
",",
"String",
"contactNumber",
",",
"OvhCountriesAvailable",
... | Create order
REST: POST /order/telephony/{billingAccount}/portability
@param desireDate [required] The date you want for portability execution. Overridden if flag executeAsSoonAsPossible is set
@param type [required] The type of number : landline or special
@param callNumber [required] The number you want to port
@param streetName [required] Address street name
@param firstName [required] Your firstname
@param listNumbers [required] Extra numbers to be ported, a comma separated list of numbers
@param socialReason [required] Your social reason
@param name [required] Your name
@param country [required] Country of number
@param stair [required] Address stair
@param zip [required] Address zip code
@param streetNumberExtra [required] Address street number extra : bis, ter, ...
@param contactNumber [required] Your contact phone number
@param lineToRedirectAliasTo [required] Redirect ported numbers to the specific line
@param rio [required] RIO of the number for individual offer
@param mobilePhone [required] Mobile phone to use to text portability status
@param building [required] Address building
@param streetNumber [required] Address street number
@param executeAsSoonAsPossible [required] Ask to port the number as soon as possible
@param displayUniversalDirectory [required] Publish informations on directory ? (Yellow Pages, 118XXX, ...)
@param floor [required] Address floor
@param specialNumberCategory [required] The special number category (needed if type is special)
@param siret [required] If you port under your society, the SIRET number
@param fiabilisation [required] Ask for a fiabilisation or not (FR only)
@param streetType [required] Address street type
@param contactName [required] Your contact name
@param door [required] Address door
@param offer [required] The offer : individual or company
@param city [required] Address city
@param billingAccount [required] The name of your billingAccount | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6526-L6561 |
wcm-io-caravan/caravan-hal | docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java | GenerateHalDocsJsonMojo.buildJsonSchemaRefModel | private String buildJsonSchemaRefModel(String jsonSchemaRef, Class<?> modelClass) {
if (StringUtils.isNotEmpty(jsonSchemaRef)) {
return jsonSchemaRef;
}
if (modelClass != void.class) {
return project.getDependencyArtifacts().stream()
.filter(artifact -> StringUtils.equals("jar", artifact.getType()))
.map(artifact -> buildJsonSchemaRefForModel(modelClass, artifact.getFile()))
.filter(StringUtils::isNotEmpty)
.findFirst()
.orElse(null);
}
return null;
} | java | private String buildJsonSchemaRefModel(String jsonSchemaRef, Class<?> modelClass) {
if (StringUtils.isNotEmpty(jsonSchemaRef)) {
return jsonSchemaRef;
}
if (modelClass != void.class) {
return project.getDependencyArtifacts().stream()
.filter(artifact -> StringUtils.equals("jar", artifact.getType()))
.map(artifact -> buildJsonSchemaRefForModel(modelClass, artifact.getFile()))
.filter(StringUtils::isNotEmpty)
.findFirst()
.orElse(null);
}
return null;
} | [
"private",
"String",
"buildJsonSchemaRefModel",
"(",
"String",
"jsonSchemaRef",
",",
"Class",
"<",
"?",
">",
"modelClass",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"jsonSchemaRef",
")",
")",
"{",
"return",
"jsonSchemaRef",
";",
"}",
"if",
... | If a json schema ref is given, this is returned unchanged.
Otherwise: Scans all project's dependencies for one with manifest with Caravan-HalDocs-DomainPath bundle header.
If the dependencies JAR files contains a matching JSON schema file generated by this plugin, build a
URL to reference this schema.
@param modelClass Model class
@return JSON schema reference URL, or null if none found | [
"If",
"a",
"json",
"schema",
"ref",
"is",
"given",
"this",
"is",
"returned",
"unchanged",
".",
"Otherwise",
":",
"Scans",
"all",
"project",
"s",
"dependencies",
"for",
"one",
"with",
"manifest",
"with",
"Caravan",
"-",
"HalDocs",
"-",
"DomainPath",
"bundle",... | train | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java#L245-L258 |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/DiscoveredBdas.java | DiscoveredBdas.addDiscoveredBda | public void addDiscoveredBda(ArchiveType moduleType, WebSphereBeanDeploymentArchive bda) throws CDIException {
webSphereCDIDeployment.addBeanDeploymentArchive(bda);
Set<WebSphereBeanDeploymentArchive> bdaSet = bdasByType.get(moduleType);
if (bdaSet != null) {
bdaSet.add(bda);
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Ignore this type: {0}, as CDI does not need to add this in the addDiscoveredBda ", moduleType);
}
}
String path = bda.getArchive().getPath();
if (moduleType == ArchiveType.SHARED_LIB || moduleType == ArchiveType.EAR_LIB) {
libraryPaths.add(path);
} else if (moduleType == ArchiveType.RAR_MODULE || moduleType == ArchiveType.EJB_MODULE) {
modulePaths.add(path);
}
} | java | public void addDiscoveredBda(ArchiveType moduleType, WebSphereBeanDeploymentArchive bda) throws CDIException {
webSphereCDIDeployment.addBeanDeploymentArchive(bda);
Set<WebSphereBeanDeploymentArchive> bdaSet = bdasByType.get(moduleType);
if (bdaSet != null) {
bdaSet.add(bda);
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Ignore this type: {0}, as CDI does not need to add this in the addDiscoveredBda ", moduleType);
}
}
String path = bda.getArchive().getPath();
if (moduleType == ArchiveType.SHARED_LIB || moduleType == ArchiveType.EAR_LIB) {
libraryPaths.add(path);
} else if (moduleType == ArchiveType.RAR_MODULE || moduleType == ArchiveType.EJB_MODULE) {
modulePaths.add(path);
}
} | [
"public",
"void",
"addDiscoveredBda",
"(",
"ArchiveType",
"moduleType",
",",
"WebSphereBeanDeploymentArchive",
"bda",
")",
"throws",
"CDIException",
"{",
"webSphereCDIDeployment",
".",
"addBeanDeploymentArchive",
"(",
"bda",
")",
";",
"Set",
"<",
"WebSphereBeanDeploymentA... | Registers a newly discovered BDA and adds it to the deployment
@param moduleType the module type
@param bda the new BDA
@throws CDIException | [
"Registers",
"a",
"newly",
"discovered",
"BDA",
"and",
"adds",
"it",
"to",
"the",
"deployment"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.weld/src/com/ibm/ws/cdi/impl/DiscoveredBdas.java#L90-L107 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Searches.java | Searches.findFirst | public static <E> E findFirst(Iterator<E> iterator, Predicate<E> predicate) {
final Iterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
return new FirstElement<E>().apply(filtered);
} | java | public static <E> E findFirst(Iterator<E> iterator, Predicate<E> predicate) {
final Iterator<E> filtered = new FilteringIterator<E>(iterator, predicate);
return new FirstElement<E>().apply(filtered);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"findFirst",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
",",
"Predicate",
"<",
"E",
">",
"predicate",
")",
"{",
"final",
"Iterator",
"<",
"E",
">",
"filtered",
"=",
"new",
"FilteringIterator",
"<",
"E",
">",
"... | Searches the first matching element returning it.
@param <E> the element type parameter
@param iterator the iterator to be searched
@param predicate the predicate to be applied to each element
@throws IllegalArgumentException if no element matches
@return the found element | [
"Searches",
"the",
"first",
"matching",
"element",
"returning",
"it",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Searches.java#L420-L423 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/java/Java.java | Java.emitCommentIndentNOnly | private static String emitCommentIndentNOnly(PrintWriter fp, String text, int indent) {
synchronized (lock) {
return (emitCommentIndentNOnly(fp, text, indent, true));
}
} | java | private static String emitCommentIndentNOnly(PrintWriter fp, String text, int indent) {
synchronized (lock) {
return (emitCommentIndentNOnly(fp, text, indent, true));
}
} | [
"private",
"static",
"String",
"emitCommentIndentNOnly",
"(",
"PrintWriter",
"fp",
",",
"String",
"text",
",",
"int",
"indent",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"return",
"(",
"emitCommentIndentNOnly",
"(",
"fp",
",",
"text",
",",
"indent",
"... | Write a comment indent only.
@param fp
@param text
@param indent
@return | [
"Write",
"a",
"comment",
"indent",
"only",
"."
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/java/Java.java#L140-L144 |
jmeter-maven-plugin/jmeter-maven-plugin | src/main/java/com/lazerycode/jmeter/configuration/ArtifactHelpers.java | ArtifactHelpers.isArtifactIsOlderThanArtifact | public static boolean isArtifactIsOlderThanArtifact(Artifact artifact, Artifact comparisonArtifact) throws InvalidVersionSpecificationException {
GenericVersionScheme genericVersionScheme = new GenericVersionScheme();
Version firstArtifactVersion = genericVersionScheme.parseVersion(artifact.getVersion());
Version secondArtifactVersion = genericVersionScheme.parseVersion(comparisonArtifact.getVersion());
return firstArtifactVersion.compareTo(secondArtifactVersion) < 0;
} | java | public static boolean isArtifactIsOlderThanArtifact(Artifact artifact, Artifact comparisonArtifact) throws InvalidVersionSpecificationException {
GenericVersionScheme genericVersionScheme = new GenericVersionScheme();
Version firstArtifactVersion = genericVersionScheme.parseVersion(artifact.getVersion());
Version secondArtifactVersion = genericVersionScheme.parseVersion(comparisonArtifact.getVersion());
return firstArtifactVersion.compareTo(secondArtifactVersion) < 0;
} | [
"public",
"static",
"boolean",
"isArtifactIsOlderThanArtifact",
"(",
"Artifact",
"artifact",
",",
"Artifact",
"comparisonArtifact",
")",
"throws",
"InvalidVersionSpecificationException",
"{",
"GenericVersionScheme",
"genericVersionScheme",
"=",
"new",
"GenericVersionScheme",
"(... | Check to see if a specified artifact is the same version, or a newer version that the comparative artifact
@param artifact An artifact
@param comparisonArtifact another Artifact to compare with.
@return true if artifact is the same or a higher version. False if the artifact is a lower version
@throws MojoExecutionException Unable to get artifact versions | [
"Check",
"to",
"see",
"if",
"a",
"specified",
"artifact",
"is",
"the",
"same",
"version",
"or",
"a",
"newer",
"version",
"that",
"the",
"comparative",
"artifact"
] | train | https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/configuration/ArtifactHelpers.java#L165-L172 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/ProjectedCentroid.java | ProjectedCentroid.put | @Override
public void put(double[] val, double weight) {
assert (val.length == elements.length);
if(weight == 0) {
return; // Skip zero weights.
}
final double nwsum = weight + wsum;
for(int i = BitsUtil.nextSetBit(dims, 0); i >= 0; i = BitsUtil.nextSetBit(dims, i + 1)) {
final double delta = val[i] - elements[i];
final double rval = delta * weight / nwsum;
elements[i] += rval;
}
wsum = nwsum;
} | java | @Override
public void put(double[] val, double weight) {
assert (val.length == elements.length);
if(weight == 0) {
return; // Skip zero weights.
}
final double nwsum = weight + wsum;
for(int i = BitsUtil.nextSetBit(dims, 0); i >= 0; i = BitsUtil.nextSetBit(dims, i + 1)) {
final double delta = val[i] - elements[i];
final double rval = delta * weight / nwsum;
elements[i] += rval;
}
wsum = nwsum;
} | [
"@",
"Override",
"public",
"void",
"put",
"(",
"double",
"[",
"]",
"val",
",",
"double",
"weight",
")",
"{",
"assert",
"(",
"val",
".",
"length",
"==",
"elements",
".",
"length",
")",
";",
"if",
"(",
"weight",
"==",
"0",
")",
"{",
"return",
";",
... | Add data with a given weight.
@param val data
@param weight weight | [
"Add",
"data",
"with",
"a",
"given",
"weight",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/ProjectedCentroid.java#L80-L93 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/animation/transformation/ChainedTransformation.java | ChainedTransformation.doTransform | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void doTransform(ITransformable transformable, float comp)
{
if (listTransformations.size() == 0)
return;
if (reversed)
elapsedTimeCurrentLoop = Math.max(0, duration - elapsedTimeCurrentLoop);
for (Transformation transformation : listTransformations)
{
transformation.transform(transformable, elapsedTimeCurrentLoop);
elapsedTimeCurrentLoop -= transformation.totalDuration();
}
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void doTransform(ITransformable transformable, float comp)
{
if (listTransformations.size() == 0)
return;
if (reversed)
elapsedTimeCurrentLoop = Math.max(0, duration - elapsedTimeCurrentLoop);
for (Transformation transformation : listTransformations)
{
transformation.transform(transformable, elapsedTimeCurrentLoop);
elapsedTimeCurrentLoop -= transformation.totalDuration();
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"@",
"Override",
"protected",
"void",
"doTransform",
"(",
"ITransformable",
"transformable",
",",
"float",
"comp",
")",
"{",
"if",
"(",
"listTransformations",
".",
"size",
"(",
... | Calculates the transformation.
@param transformable the transformable
@param comp the comp | [
"Calculates",
"the",
"transformation",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/ChainedTransformation.java#L83-L97 |
OpenLiberty/open-liberty | dev/wlp-mavenRepoTasks/src/com/ibm/ws/wlp/mavenFeatures/utils/Utils.java | Utils.getFileName | public static String getFileName(MavenCoordinates artifact, Constants.ArtifactType type) {
return artifact.getArtifactId() + "-" + artifact.getVersion() + type.getMavenFileExtension();
} | java | public static String getFileName(MavenCoordinates artifact, Constants.ArtifactType type) {
return artifact.getArtifactId() + "-" + artifact.getVersion() + type.getMavenFileExtension();
} | [
"public",
"static",
"String",
"getFileName",
"(",
"MavenCoordinates",
"artifact",
",",
"Constants",
".",
"ArtifactType",
"type",
")",
"{",
"return",
"artifact",
".",
"getArtifactId",
"(",
")",
"+",
"\"-\"",
"+",
"artifact",
".",
"getVersion",
"(",
")",
"+",
... | Gets the expected file name for a Maven artifact, based on its Maven
coordinates.
@param artifact
the MavenArtifact whose file name you want
@param type
the type of artifact
@return the file name including extension | [
"Gets",
"the",
"expected",
"file",
"name",
"for",
"a",
"Maven",
"artifact",
"based",
"on",
"its",
"Maven",
"coordinates",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp-mavenRepoTasks/src/com/ibm/ws/wlp/mavenFeatures/utils/Utils.java#L46-L48 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java | TypeQualifierApplications.constructTypeQualifierAnnotation | public static void constructTypeQualifierAnnotation(Set<TypeQualifierAnnotation> set, AnnotationValue v) {
assert set != null;
TypeQualifierAnnotation tqa = constructTypeQualifierAnnotation(v);
set.add(tqa);
} | java | public static void constructTypeQualifierAnnotation(Set<TypeQualifierAnnotation> set, AnnotationValue v) {
assert set != null;
TypeQualifierAnnotation tqa = constructTypeQualifierAnnotation(v);
set.add(tqa);
} | [
"public",
"static",
"void",
"constructTypeQualifierAnnotation",
"(",
"Set",
"<",
"TypeQualifierAnnotation",
">",
"set",
",",
"AnnotationValue",
"v",
")",
"{",
"assert",
"set",
"!=",
"null",
";",
"TypeQualifierAnnotation",
"tqa",
"=",
"constructTypeQualifierAnnotation",
... | Resolve a raw AnnotationValue into a TypeQualifierAnnotation, storing
result in given Set.
@param set
Set of resolved TypeQualifierAnnotations
@param v
a raw AnnotationValue | [
"Resolve",
"a",
"raw",
"AnnotationValue",
"into",
"a",
"TypeQualifierAnnotation",
"storing",
"result",
"in",
"given",
"Set",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java#L270-L274 |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.indexOf | public int indexOf(char ch, int start) {
if (ch > MAX_CHAR_VALUE) {
return INDEX_NOT_FOUND;
}
if (start < 0) {
start = 0;
}
final byte chAsByte = c2b0(ch);
final int len = offset + length;
for (int i = start + offset; i < len; ++i) {
if (value[i] == chAsByte) {
return i - offset;
}
}
return INDEX_NOT_FOUND;
} | java | public int indexOf(char ch, int start) {
if (ch > MAX_CHAR_VALUE) {
return INDEX_NOT_FOUND;
}
if (start < 0) {
start = 0;
}
final byte chAsByte = c2b0(ch);
final int len = offset + length;
for (int i = start + offset; i < len; ++i) {
if (value[i] == chAsByte) {
return i - offset;
}
}
return INDEX_NOT_FOUND;
} | [
"public",
"int",
"indexOf",
"(",
"char",
"ch",
",",
"int",
"start",
")",
"{",
"if",
"(",
"ch",
">",
"MAX_CHAR_VALUE",
")",
"{",
"return",
"INDEX_NOT_FOUND",
";",
"}",
"if",
"(",
"start",
"<",
"0",
")",
"{",
"start",
"=",
"0",
";",
"}",
"final",
"... | Searches in this string for the index of the specified char {@code ch}.
The search for the char starts at the specified offset {@code start} and moves towards the end of this string.
@param ch the char to find.
@param start the starting offset.
@return the index of the first occurrence of the specified char {@code ch} in this string,
-1 if found no occurrence. | [
"Searches",
"in",
"this",
"string",
"for",
"the",
"index",
"of",
"the",
"specified",
"char",
"{",
"@code",
"ch",
"}",
".",
"The",
"search",
"for",
"the",
"char",
"starts",
"at",
"the",
"specified",
"offset",
"{",
"@code",
"start",
"}",
"and",
"moves",
... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L715-L732 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java | GitFlowGraphMonitor.checkFileLevelRelativeToRoot | private boolean checkFileLevelRelativeToRoot(Path filePath, int depth) {
if (filePath == null) {
return false;
}
Path path = filePath;
for (int i = 0; i < depth - 1; i++) {
path = path.getParent();
}
if (!path.getName().equals(folderName)) {
return false;
}
return true;
} | java | private boolean checkFileLevelRelativeToRoot(Path filePath, int depth) {
if (filePath == null) {
return false;
}
Path path = filePath;
for (int i = 0; i < depth - 1; i++) {
path = path.getParent();
}
if (!path.getName().equals(folderName)) {
return false;
}
return true;
} | [
"private",
"boolean",
"checkFileLevelRelativeToRoot",
"(",
"Path",
"filePath",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"filePath",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"Path",
"path",
"=",
"filePath",
";",
"for",
"(",
"int",
"i",
"=",
... | Helper to check if a file has proper hierarchy.
@param filePath path of the node/edge file
@param depth expected depth of the file
@return true if the file conforms to the expected hierarchy | [
"Helper",
"to",
"check",
"if",
"a",
"file",
"has",
"proper",
"hierarchy",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java#L293-L305 |
apereo/cas | support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/SamlRegisteredServiceServiceProviderMetadataFacade.java | SamlRegisteredServiceServiceProviderMetadataFacade.get | public static Optional<SamlRegisteredServiceServiceProviderMetadataFacade> get(final SamlRegisteredServiceCachingMetadataResolver resolver,
final SamlRegisteredService registeredService,
final String entityID) {
return get(resolver, registeredService, entityID, new CriteriaSet());
} | java | public static Optional<SamlRegisteredServiceServiceProviderMetadataFacade> get(final SamlRegisteredServiceCachingMetadataResolver resolver,
final SamlRegisteredService registeredService,
final String entityID) {
return get(resolver, registeredService, entityID, new CriteriaSet());
} | [
"public",
"static",
"Optional",
"<",
"SamlRegisteredServiceServiceProviderMetadataFacade",
">",
"get",
"(",
"final",
"SamlRegisteredServiceCachingMetadataResolver",
"resolver",
",",
"final",
"SamlRegisteredService",
"registeredService",
",",
"final",
"String",
"entityID",
")",
... | Adapt saml metadata and parse. Acts as a facade.
@param resolver the resolver
@param registeredService the service
@param entityID the entity id
@return the saml metadata adaptor | [
"Adapt",
"saml",
"metadata",
"and",
"parse",
".",
"Acts",
"as",
"a",
"facade",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/SamlRegisteredServiceServiceProviderMetadataFacade.java#L65-L69 |
apereo/cas | support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java | DelegatedClientAuthenticationAction.buildProviderConfiguration | protected Optional<ProviderLoginPageConfiguration> buildProviderConfiguration(final IndirectClient client, final WebContext webContext,
final WebApplicationService service) {
val name = client.getName();
val matcher = PAC4J_CLIENT_SUFFIX_PATTERN.matcher(client.getClass().getSimpleName());
val type = matcher.replaceAll(StringUtils.EMPTY).toLowerCase();
val uriBuilder = UriComponentsBuilder
.fromUriString(DelegatedClientNavigationController.ENDPOINT_REDIRECT)
.queryParam(Pac4jConstants.DEFAULT_CLIENT_NAME_PARAMETER, name);
if (service != null) {
val sourceParam = service.getSource();
val serviceParam = service.getOriginalUrl();
if (StringUtils.isNotBlank(sourceParam) && StringUtils.isNotBlank(serviceParam)) {
uriBuilder.queryParam(sourceParam, serviceParam);
}
}
val methodParam = webContext.getRequestParameter(CasProtocolConstants.PARAMETER_METHOD);
if (StringUtils.isNotBlank(methodParam)) {
uriBuilder.queryParam(CasProtocolConstants.PARAMETER_METHOD, methodParam);
}
val localeParam = webContext.getRequestParameter(this.localeParamName);
if (StringUtils.isNotBlank(localeParam)) {
uriBuilder.queryParam(this.localeParamName, localeParam);
}
val themeParam = webContext.getRequestParameter(this.themeParamName);
if (StringUtils.isNotBlank(themeParam)) {
uriBuilder.queryParam(this.themeParamName, themeParam);
}
val redirectUrl = uriBuilder.toUriString();
val autoRedirect = (Boolean) client.getCustomProperties().getOrDefault(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_AUTO_REDIRECT, Boolean.FALSE);
val p = new ProviderLoginPageConfiguration(name, redirectUrl, type, getCssClass(name), autoRedirect);
return Optional.of(p);
} | java | protected Optional<ProviderLoginPageConfiguration> buildProviderConfiguration(final IndirectClient client, final WebContext webContext,
final WebApplicationService service) {
val name = client.getName();
val matcher = PAC4J_CLIENT_SUFFIX_PATTERN.matcher(client.getClass().getSimpleName());
val type = matcher.replaceAll(StringUtils.EMPTY).toLowerCase();
val uriBuilder = UriComponentsBuilder
.fromUriString(DelegatedClientNavigationController.ENDPOINT_REDIRECT)
.queryParam(Pac4jConstants.DEFAULT_CLIENT_NAME_PARAMETER, name);
if (service != null) {
val sourceParam = service.getSource();
val serviceParam = service.getOriginalUrl();
if (StringUtils.isNotBlank(sourceParam) && StringUtils.isNotBlank(serviceParam)) {
uriBuilder.queryParam(sourceParam, serviceParam);
}
}
val methodParam = webContext.getRequestParameter(CasProtocolConstants.PARAMETER_METHOD);
if (StringUtils.isNotBlank(methodParam)) {
uriBuilder.queryParam(CasProtocolConstants.PARAMETER_METHOD, methodParam);
}
val localeParam = webContext.getRequestParameter(this.localeParamName);
if (StringUtils.isNotBlank(localeParam)) {
uriBuilder.queryParam(this.localeParamName, localeParam);
}
val themeParam = webContext.getRequestParameter(this.themeParamName);
if (StringUtils.isNotBlank(themeParam)) {
uriBuilder.queryParam(this.themeParamName, themeParam);
}
val redirectUrl = uriBuilder.toUriString();
val autoRedirect = (Boolean) client.getCustomProperties().getOrDefault(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_AUTO_REDIRECT, Boolean.FALSE);
val p = new ProviderLoginPageConfiguration(name, redirectUrl, type, getCssClass(name), autoRedirect);
return Optional.of(p);
} | [
"protected",
"Optional",
"<",
"ProviderLoginPageConfiguration",
">",
"buildProviderConfiguration",
"(",
"final",
"IndirectClient",
"client",
",",
"final",
"WebContext",
"webContext",
",",
"final",
"WebApplicationService",
"service",
")",
"{",
"val",
"name",
"=",
"client... | Build provider configuration optional.
@param client the client
@param webContext the web context
@param service the service
@return the optional | [
"Build",
"provider",
"configuration",
"optional",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java#L348-L381 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_boot_GET | public ArrayList<Long> serviceName_boot_GET(String serviceName, OvhBootTypeEnum bootType) throws IOException {
String qPath = "/dedicated/server/{serviceName}/boot";
StringBuilder sb = path(qPath, serviceName);
query(sb, "bootType", bootType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public ArrayList<Long> serviceName_boot_GET(String serviceName, OvhBootTypeEnum bootType) throws IOException {
String qPath = "/dedicated/server/{serviceName}/boot";
StringBuilder sb = path(qPath, serviceName);
query(sb, "bootType", bootType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_boot_GET",
"(",
"String",
"serviceName",
",",
"OvhBootTypeEnum",
"bootType",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/boot\"",
";",
"StringBuilder",
"sb",
"=",
"... | Server compatibles netboots
REST: GET /dedicated/server/{serviceName}/boot
@param bootType [required] Filter the value of bootType property (=)
@param serviceName [required] The internal name of your dedicated server | [
"Server",
"compatibles",
"netboots"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1784-L1790 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java | PartitionLevelWatermarker.onPartitionProcessBegin | @Override
public void onPartitionProcessBegin(Partition partition, long partitionProcessTime, long partitionUpdateTime) {
Preconditions.checkNotNull(partition);
Preconditions.checkNotNull(partition.getTable());
if (!this.expectedHighWatermarks.hasPartitionWatermarks(tableKey(partition.getTable()))) {
throw new IllegalStateException(String.format(
"onPartitionProcessBegin called before onTableProcessBegin for table: %s, partitions: %s",
tableKey(partition.getTable()), partitionKey(partition)));
}
// Remove dropped partitions
Collection<String> droppedPartitions =
Collections2.transform(AbstractAvroToOrcConverter.getDropPartitionsDDLInfo(partition),
new Function<Map<String, String>, String>() {
@Override
public String apply(Map<String, String> input) {
return PARTITION_VALUES_JOINER.join(input.values());
}
});
this.expectedHighWatermarks.removePartitionWatermarks(tableKey(partition.getTable()), droppedPartitions);
this.expectedHighWatermarks.addPartitionWatermark(tableKey(partition.getTable()), partitionKey(partition),
partitionUpdateTime);
} | java | @Override
public void onPartitionProcessBegin(Partition partition, long partitionProcessTime, long partitionUpdateTime) {
Preconditions.checkNotNull(partition);
Preconditions.checkNotNull(partition.getTable());
if (!this.expectedHighWatermarks.hasPartitionWatermarks(tableKey(partition.getTable()))) {
throw new IllegalStateException(String.format(
"onPartitionProcessBegin called before onTableProcessBegin for table: %s, partitions: %s",
tableKey(partition.getTable()), partitionKey(partition)));
}
// Remove dropped partitions
Collection<String> droppedPartitions =
Collections2.transform(AbstractAvroToOrcConverter.getDropPartitionsDDLInfo(partition),
new Function<Map<String, String>, String>() {
@Override
public String apply(Map<String, String> input) {
return PARTITION_VALUES_JOINER.join(input.values());
}
});
this.expectedHighWatermarks.removePartitionWatermarks(tableKey(partition.getTable()), droppedPartitions);
this.expectedHighWatermarks.addPartitionWatermark(tableKey(partition.getTable()), partitionKey(partition),
partitionUpdateTime);
} | [
"@",
"Override",
"public",
"void",
"onPartitionProcessBegin",
"(",
"Partition",
"partition",
",",
"long",
"partitionProcessTime",
",",
"long",
"partitionUpdateTime",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"partition",
")",
";",
"Preconditions",
".",
"c... | Adds an expected high watermark for this {@link Partition}. Also removes any watermarks for partitions being replaced.
Replace partitions are read using partition parameter {@link AbstractAvroToOrcConverter#REPLACED_PARTITIONS_HIVE_METASTORE_KEY}.
Uses the <code>partitionUpdateTime</code> as the high watermark for this <code>partition</code>
{@inheritDoc}
@see org.apache.gobblin.data.management.conversion.hive.watermarker.HiveSourceWatermarker#onPartitionProcessBegin(org.apache.hadoop.hive.ql.metadata.Partition, long, long) | [
"Adds",
"an",
"expected",
"high",
"watermark",
"for",
"this",
"{",
"@link",
"Partition",
"}",
".",
"Also",
"removes",
"any",
"watermarks",
"for",
"partitions",
"being",
"replaced",
".",
"Replace",
"partitions",
"are",
"read",
"using",
"partition",
"parameter",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java#L229-L254 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.NTFLambert_NTFLambdaPhi | @SuppressWarnings({"checkstyle:parametername", "checkstyle:localfinalvariablename"})
private static Point2d NTFLambert_NTFLambdaPhi(double x, double y, double n, double c, double Xs, double Ys) {
// Several constants from the IGN specifications
//Longitude in radians of Paris (2°20'14.025" E) from Greenwich
final double lambda_0 = 0.;
// Extended Lambert II (x,y) -> graphical coordinate NTF (lambda_ntf,phi_ntf)
// ALG0004
final double R = Math.hypot(x - Xs, y - Ys);
final double g = Math.atan((x - Xs) / (Ys - y));
final double lamdda_ntf = lambda_0 + (g / n);
final double L = -(1 / n) * Math.log(Math.abs(R / c));
final double phi0 = 2 * Math.atan(Math.exp(L)) - (Math.PI / 2.0);
double phiprec = phi0;
double phii = compute1(phiprec, L);
while (Math.abs(phii - phiprec) >= EPSILON) {
phiprec = phii;
phii = compute1(phiprec, L);
}
final double phi_ntf = phii;
return new Point2d(lamdda_ntf, phi_ntf);
} | java | @SuppressWarnings({"checkstyle:parametername", "checkstyle:localfinalvariablename"})
private static Point2d NTFLambert_NTFLambdaPhi(double x, double y, double n, double c, double Xs, double Ys) {
// Several constants from the IGN specifications
//Longitude in radians of Paris (2°20'14.025" E) from Greenwich
final double lambda_0 = 0.;
// Extended Lambert II (x,y) -> graphical coordinate NTF (lambda_ntf,phi_ntf)
// ALG0004
final double R = Math.hypot(x - Xs, y - Ys);
final double g = Math.atan((x - Xs) / (Ys - y));
final double lamdda_ntf = lambda_0 + (g / n);
final double L = -(1 / n) * Math.log(Math.abs(R / c));
final double phi0 = 2 * Math.atan(Math.exp(L)) - (Math.PI / 2.0);
double phiprec = phi0;
double phii = compute1(phiprec, L);
while (Math.abs(phii - phiprec) >= EPSILON) {
phiprec = phii;
phii = compute1(phiprec, L);
}
final double phi_ntf = phii;
return new Point2d(lamdda_ntf, phi_ntf);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:parametername\"",
",",
"\"checkstyle:localfinalvariablename\"",
"}",
")",
"private",
"static",
"Point2d",
"NTFLambert_NTFLambdaPhi",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"n",
",",
"double",
"c",
",",... | This function convert extended France NTF Lambert coordinate to Angular NTF coordinate.
@param x is the coordinate in extended France NTF Lambert
@param y is the coordinate in extended France NTF Lambert
@param n is the exponential of the Lambert projection.
@param c is the constant of projection.
@param Xs is the x coordinate of the origine of the Lambert projection.
@param Ys is the y coordinate of the origine of the Lambert projection.
@return lambda and phi in NTF. | [
"This",
"function",
"convert",
"extended",
"France",
"NTF",
"Lambert",
"coordinate",
"to",
"Angular",
"NTF",
"coordinate",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L941-L965 |
att/AAF | authz/authz-cass/src/main/java/com/att/dao/aaf/cass/ApprovalDAO.java | ApprovalDAO.wasModified | @Override
protected void wasModified(AuthzTrans trans, CRUD modified, Data data, String ... override) {
boolean memo = override.length>0 && override[0]!=null;
boolean subject = override.length>1 && override[1]!=null;
HistoryDAO.Data hd = HistoryDAO.newInitedData();
hd.user = trans.user();
hd.action = modified.name();
hd.target = TABLE;
hd.subject = subject?override[1]:data.user + "|" + data.approver;
hd.memo = memo
? String.format("%s by %s", override[0], hd.user)
: (modified.name() + "d approval for " + data.user);
// Detail?
// Reconstruct?
if(historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
} | java | @Override
protected void wasModified(AuthzTrans trans, CRUD modified, Data data, String ... override) {
boolean memo = override.length>0 && override[0]!=null;
boolean subject = override.length>1 && override[1]!=null;
HistoryDAO.Data hd = HistoryDAO.newInitedData();
hd.user = trans.user();
hd.action = modified.name();
hd.target = TABLE;
hd.subject = subject?override[1]:data.user + "|" + data.approver;
hd.memo = memo
? String.format("%s by %s", override[0], hd.user)
: (modified.name() + "d approval for " + data.user);
// Detail?
// Reconstruct?
if(historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
} | [
"@",
"Override",
"protected",
"void",
"wasModified",
"(",
"AuthzTrans",
"trans",
",",
"CRUD",
"modified",
",",
"Data",
"data",
",",
"String",
"...",
"override",
")",
"{",
"boolean",
"memo",
"=",
"override",
".",
"length",
">",
"0",
"&&",
"override",
"[",
... | Log Modification statements to History
@param modified which CRUD action was done
@param data entity data that needs a log entry
@param overrideMessage if this is specified, we use it rather than crafting a history message based on data | [
"Log",
"Modification",
"statements",
"to",
"History"
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cass/ApprovalDAO.java#L166-L184 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/EntityGroupImpl.java | EntityGroupImpl.addChild | @Override
public void addChild(IGroupMember gm) throws GroupsException {
try {
checkProspectiveMember(gm);
} catch (GroupsException ge) {
throw new GroupsException("Could not add IGroupMember", ge);
}
if (!this.contains(gm)) {
String cacheKey = gm.getEntityIdentifier().getKey();
if (getRemovedMembers().containsKey(cacheKey)) {
getRemovedMembers().remove(cacheKey);
} else {
getAddedMembers().put(cacheKey, gm);
}
}
primAddMember(gm);
} | java | @Override
public void addChild(IGroupMember gm) throws GroupsException {
try {
checkProspectiveMember(gm);
} catch (GroupsException ge) {
throw new GroupsException("Could not add IGroupMember", ge);
}
if (!this.contains(gm)) {
String cacheKey = gm.getEntityIdentifier().getKey();
if (getRemovedMembers().containsKey(cacheKey)) {
getRemovedMembers().remove(cacheKey);
} else {
getAddedMembers().put(cacheKey, gm);
}
}
primAddMember(gm);
} | [
"@",
"Override",
"public",
"void",
"addChild",
"(",
"IGroupMember",
"gm",
")",
"throws",
"GroupsException",
"{",
"try",
"{",
"checkProspectiveMember",
"(",
"gm",
")",
";",
"}",
"catch",
"(",
"GroupsException",
"ge",
")",
"{",
"throw",
"new",
"GroupsException",... | Adds <code>IGroupMember</code> gm to our member <code>Map</code> and conversely, adds <code>
this</code> to gm's group <code>Map</code>, after checking that the addition does not violate
group rules. Remember that we have added it so we can update the database if necessary.
@param gm org.apereo.portal.groups.IGroupMember | [
"Adds",
"<code",
">",
"IGroupMember<",
"/",
"code",
">",
"gm",
"to",
"our",
"member",
"<code",
">",
"Map<",
"/",
"code",
">",
"and",
"conversely",
"adds",
"<code",
">",
"this<",
"/",
"code",
">",
"to",
"gm",
"s",
"group",
"<code",
">",
"Map<",
"/",
... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/EntityGroupImpl.java#L90-L109 |
Red5/red5-server-common | src/main/java/org/red5/server/stream/RecordingListener.java | RecordingListener.getRecordFile | public static File getRecordFile(IScope scope, String name) {
// get stream filename generator
IStreamFilenameGenerator generator = (IStreamFilenameGenerator) ScopeUtils.getScopeService(scope, IStreamFilenameGenerator.class, DefaultStreamFilenameGenerator.class);
// generate filename
String fileName = generator.generateFilename(scope, name, ".flv", GenerationType.RECORD);
File file = null;
if (generator.resolvesToAbsolutePath()) {
file = new File(fileName);
} else {
Resource resource = scope.getContext().getResource(fileName);
if (resource.exists()) {
try {
file = resource.getFile();
log.debug("File exists: {} writable: {}", file.exists(), file.canWrite());
} catch (IOException ioe) {
log.error("File error: {}", ioe);
}
} else {
String appScopeName = ScopeUtils.findApplication(scope).getName();
file = new File(String.format("%s/webapps/%s/%s", System.getProperty("red5.root"), appScopeName, fileName));
}
}
return file;
} | java | public static File getRecordFile(IScope scope, String name) {
// get stream filename generator
IStreamFilenameGenerator generator = (IStreamFilenameGenerator) ScopeUtils.getScopeService(scope, IStreamFilenameGenerator.class, DefaultStreamFilenameGenerator.class);
// generate filename
String fileName = generator.generateFilename(scope, name, ".flv", GenerationType.RECORD);
File file = null;
if (generator.resolvesToAbsolutePath()) {
file = new File(fileName);
} else {
Resource resource = scope.getContext().getResource(fileName);
if (resource.exists()) {
try {
file = resource.getFile();
log.debug("File exists: {} writable: {}", file.exists(), file.canWrite());
} catch (IOException ioe) {
log.error("File error: {}", ioe);
}
} else {
String appScopeName = ScopeUtils.findApplication(scope).getName();
file = new File(String.format("%s/webapps/%s/%s", System.getProperty("red5.root"), appScopeName, fileName));
}
}
return file;
} | [
"public",
"static",
"File",
"getRecordFile",
"(",
"IScope",
"scope",
",",
"String",
"name",
")",
"{",
"// get stream filename generator\r",
"IStreamFilenameGenerator",
"generator",
"=",
"(",
"IStreamFilenameGenerator",
")",
"ScopeUtils",
".",
"getScopeService",
"(",
"sc... | Get the file we'd be recording to based on scope and given name.
@param scope
scope
@param name
name
@return file | [
"Get",
"the",
"file",
"we",
"d",
"be",
"recording",
"to",
"based",
"on",
"scope",
"and",
"given",
"name",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/RecordingListener.java#L110-L133 |
azkaban/azkaban | az-core/src/main/java/azkaban/utils/PropsUtils.java | PropsUtils.loadPropsInDirs | public static Props loadPropsInDirs(final List<File> dirs, final String... suffixes) {
final Props props = new Props();
for (final File dir : dirs) {
props.putLocal(loadPropsInDir(dir, suffixes));
}
return props;
} | java | public static Props loadPropsInDirs(final List<File> dirs, final String... suffixes) {
final Props props = new Props();
for (final File dir : dirs) {
props.putLocal(loadPropsInDir(dir, suffixes));
}
return props;
} | [
"public",
"static",
"Props",
"loadPropsInDirs",
"(",
"final",
"List",
"<",
"File",
">",
"dirs",
",",
"final",
"String",
"...",
"suffixes",
")",
"{",
"final",
"Props",
"props",
"=",
"new",
"Props",
"(",
")",
";",
"for",
"(",
"final",
"File",
"dir",
":",... | Load job schedules from the given directories
@param dirs The directories to check for properties
@param suffixes The suffixes to load
@return The properties | [
"Load",
"job",
"schedules",
"from",
"the",
"given",
"directories"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/PropsUtils.java#L160-L166 |
ironjacamar/ironjacamar | web/src/main/java/org/ironjacamar/web/SecurityActions.java | SecurityActions.setSystemProperty | static void setSystemProperty(final String name, final String value)
{
AccessController.doPrivileged(new PrivilegedAction<Boolean>()
{
public Boolean run()
{
System.setProperty(name, value);
return Boolean.TRUE;
}
});
} | java | static void setSystemProperty(final String name, final String value)
{
AccessController.doPrivileged(new PrivilegedAction<Boolean>()
{
public Boolean run()
{
System.setProperty(name, value);
return Boolean.TRUE;
}
});
} | [
"static",
"void",
"setSystemProperty",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Boolean",
">",
"(",
")",
"{",
"public",
"Boolean",
"run",
"(",
")... | Set a system property
@param name The property name
@param value The property value | [
"Set",
"a",
"system",
"property"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/web/src/main/java/org/ironjacamar/web/SecurityActions.java#L100-L110 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.getConsumerDisclosureDefault | public ConsumerDisclosure getConsumerDisclosureDefault(String accountId, String envelopeId, String recipientId) throws ApiException {
return getConsumerDisclosureDefault(accountId, envelopeId, recipientId, null);
} | java | public ConsumerDisclosure getConsumerDisclosureDefault(String accountId, String envelopeId, String recipientId) throws ApiException {
return getConsumerDisclosureDefault(accountId, envelopeId, recipientId, null);
} | [
"public",
"ConsumerDisclosure",
"getConsumerDisclosureDefault",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
",",
"String",
"recipientId",
")",
"throws",
"ApiException",
"{",
"return",
"getConsumerDisclosureDefault",
"(",
"accountId",
",",
"envelopeId",
",",
... | Gets the Electronic Record and Signature Disclosure associated with the account.
Retrieves the Electronic Record and Signature Disclosure, with html formatting, associated with the account. You can use an optional query string to set the language for the disclosure.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@param recipientId The ID of the recipient being accessed. (required)
@return ConsumerDisclosure | [
"Gets",
"the",
"Electronic",
"Record",
"and",
"Signature",
"Disclosure",
"associated",
"with",
"the",
"account",
".",
"Retrieves",
"the",
"Electronic",
"Record",
"and",
"Signature",
"Disclosure",
"with",
"html",
"formatting",
"associated",
"with",
"the",
"account",
... | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L2062-L2064 |
spockframework/spock | spock-core/src/main/java/spock/mock/MockingApi.java | MockingApi.Mock | @Beta
public <T> T Mock(Map<String, Object> options, Closure interactions) {
invalidMockCreation();
return null;
} | java | @Beta
public <T> T Mock(Map<String, Object> options, Closure interactions) {
invalidMockCreation();
return null;
} | [
"@",
"Beta",
"public",
"<",
"T",
">",
"T",
"Mock",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
",",
"Closure",
"interactions",
")",
"{",
"invalidMockCreation",
"(",
")",
";",
"return",
"null",
";",
"}"
] | Creates a mock with the specified options and interactions whose type and name are inferred
from the left-hand side of the enclosing assignment.
Example:
<pre>
// type is Person.class, name is "myPerson", returns hard-coded value for {@code name}, expects one call to {@code sing()}
Person person = Mock(name: "myPerson") {
name << "Fred"
1 * sing()
}
</pre>
@param options optional options for creating the mock
@param interactions a description of the mock's interactions
@return a mock with the specified options and interactions whose type and name are inferred
from the left-hand side of the enclosing assignment | [
"Creates",
"a",
"mock",
"with",
"the",
"specified",
"options",
"and",
"interactions",
"whose",
"type",
"and",
"name",
"are",
"inferred",
"from",
"the",
"left",
"-",
"hand",
"side",
"of",
"the",
"enclosing",
"assignment",
"."
] | train | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/MockingApi.java#L278-L282 |
apereo/cas | support/cas-server-support-saml-mdui-core/src/main/java/org/apereo/cas/support/saml/mdui/AbstractMetadataResolverAdapter.java | AbstractMetadataResolverAdapter.getResourceInputStream | protected InputStream getResourceInputStream(final Resource resource, final String entityId) throws IOException {
LOGGER.debug("Locating metadata resource from input stream.");
if (!resource.exists() || !resource.isReadable()) {
throw new FileNotFoundException("Resource does not exist or is unreadable");
}
return resource.getInputStream();
} | java | protected InputStream getResourceInputStream(final Resource resource, final String entityId) throws IOException {
LOGGER.debug("Locating metadata resource from input stream.");
if (!resource.exists() || !resource.isReadable()) {
throw new FileNotFoundException("Resource does not exist or is unreadable");
}
return resource.getInputStream();
} | [
"protected",
"InputStream",
"getResourceInputStream",
"(",
"final",
"Resource",
"resource",
",",
"final",
"String",
"entityId",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Locating metadata resource from input stream.\"",
")",
";",
"if",
"(",
"!... | Retrieve the remote source's input stream to parse data.
@param resource the resource
@param entityId the entity id
@return the input stream
@throws IOException if stream cannot be read | [
"Retrieve",
"the",
"remote",
"source",
"s",
"input",
"stream",
"to",
"parse",
"data",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-mdui-core/src/main/java/org/apereo/cas/support/saml/mdui/AbstractMetadataResolverAdapter.java#L81-L87 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java | CouchDatabaseBase.getAttachment | public InputStream getAttachment(String docId, String attachmentName, String revId) {
final URI uri = new DatabaseURIHelper(dbUri).attachmentUri(docId, revId, attachmentName);
return getAttachment(uri);
} | java | public InputStream getAttachment(String docId, String attachmentName, String revId) {
final URI uri = new DatabaseURIHelper(dbUri).attachmentUri(docId, revId, attachmentName);
return getAttachment(uri);
} | [
"public",
"InputStream",
"getAttachment",
"(",
"String",
"docId",
",",
"String",
"attachmentName",
",",
"String",
"revId",
")",
"{",
"final",
"URI",
"uri",
"=",
"new",
"DatabaseURIHelper",
"(",
"dbUri",
")",
".",
"attachmentUri",
"(",
"docId",
",",
"revId",
... | Reads an attachment from the database.
The stream must be closed after usage, otherwise http connection leaks will occur.
@param docId the document id
@param attachmentName the attachment name
@param revId the document revision id or {@code null}
@return the attachment in the form of an {@code InputStream}. | [
"Reads",
"an",
"attachment",
"from",
"the",
"database",
"."
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java#L310-L313 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardAtomGenerator.java | StandardAtomGenerator.positionSubscript | TextOutline positionSubscript(TextOutline label, TextOutline subscript) {
final Rectangle2D hydrogenBounds = label.getBounds();
final Rectangle2D hydrogenCountBounds = subscript.getBounds();
subscript = subscript.translate((hydrogenBounds.getMaxX() + padding) - hydrogenCountBounds.getMinX(),
(hydrogenBounds.getMaxY() + (hydrogenCountBounds.getHeight() / 2)) - hydrogenCountBounds.getMaxY());
return subscript;
} | java | TextOutline positionSubscript(TextOutline label, TextOutline subscript) {
final Rectangle2D hydrogenBounds = label.getBounds();
final Rectangle2D hydrogenCountBounds = subscript.getBounds();
subscript = subscript.translate((hydrogenBounds.getMaxX() + padding) - hydrogenCountBounds.getMinX(),
(hydrogenBounds.getMaxY() + (hydrogenCountBounds.getHeight() / 2)) - hydrogenCountBounds.getMaxY());
return subscript;
} | [
"TextOutline",
"positionSubscript",
"(",
"TextOutline",
"label",
",",
"TextOutline",
"subscript",
")",
"{",
"final",
"Rectangle2D",
"hydrogenBounds",
"=",
"label",
".",
"getBounds",
"(",
")",
";",
"final",
"Rectangle2D",
"hydrogenCountBounds",
"=",
"subscript",
".",... | Positions an outline in the subscript position relative to another 'primary' label.
@param label a label outline
@param subscript the label outline to position as subscript
@return positioned subscript outline | [
"Positions",
"an",
"outline",
"in",
"the",
"subscript",
"position",
"relative",
"to",
"another",
"primary",
"label",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardAtomGenerator.java#L443-L449 |
joniles/mpxj | src/main/java/net/sf/mpxj/common/DateHelper.java | DateHelper.addDays | public static Date addDays(Date date, int days)
{
Calendar cal = popCalendar(date);
cal.add(Calendar.DAY_OF_YEAR, days);
Date result = cal.getTime();
pushCalendar(cal);
return result;
} | java | public static Date addDays(Date date, int days)
{
Calendar cal = popCalendar(date);
cal.add(Calendar.DAY_OF_YEAR, days);
Date result = cal.getTime();
pushCalendar(cal);
return result;
} | [
"public",
"static",
"Date",
"addDays",
"(",
"Date",
"date",
",",
"int",
"days",
")",
"{",
"Calendar",
"cal",
"=",
"popCalendar",
"(",
"date",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"DAY_OF_YEAR",
",",
"days",
")",
";",
"Date",
"result",
"... | Add a number of days to the supplied date.
@param date start date
@param days number of days to add
@return new date | [
"Add",
"a",
"number",
"of",
"days",
"to",
"the",
"supplied",
"date",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L441-L448 |
wildfly-extras/wildfly-camel | common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java | IllegalStateAssertion.assertFalse | public static Boolean assertFalse(Boolean value, String message) {
if (Boolean.valueOf(value))
throw new IllegalStateException(message);
return value;
} | java | public static Boolean assertFalse(Boolean value, String message) {
if (Boolean.valueOf(value))
throw new IllegalStateException(message);
return value;
} | [
"public",
"static",
"Boolean",
"assertFalse",
"(",
"Boolean",
"value",
",",
"String",
"message",
")",
"{",
"if",
"(",
"Boolean",
".",
"valueOf",
"(",
"value",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"message",
")",
";",
"return",
"value",
"... | Throws an IllegalStateException when the given value is not false. | [
"Throws",
"an",
"IllegalStateException",
"when",
"the",
"given",
"value",
"is",
"not",
"false",
"."
] | train | https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java#L67-L71 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java | ByteConverter.float4 | public static void float4(byte[] target, int idx, float value) {
int4(target, idx, Float.floatToRawIntBits(value));
} | java | public static void float4(byte[] target, int idx, float value) {
int4(target, idx, Float.floatToRawIntBits(value));
} | [
"public",
"static",
"void",
"float4",
"(",
"byte",
"[",
"]",
"target",
",",
"int",
"idx",
",",
"float",
"value",
")",
"{",
"int4",
"(",
"target",
",",
"idx",
",",
"Float",
".",
"floatToRawIntBits",
"(",
"value",
")",
")",
";",
"}"
] | Encodes a int value to the byte array.
@param target The byte array to encode to.
@param idx The starting index in the byte array.
@param value The value to encode. | [
"Encodes",
"a",
"int",
"value",
"to",
"the",
"byte",
"array",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java#L164-L166 |
MenoData/Time4J | base/src/main/java/net/time4j/range/SpanOfWeekdays.java | SpanOfWeekdays.between | public static SpanOfWeekdays between(
Weekday start,
Weekday end
) {
if (start == null || end == null) {
throw new NullPointerException("Missing day of week.");
}
return new SpanOfWeekdays(start, end);
} | java | public static SpanOfWeekdays between(
Weekday start,
Weekday end
) {
if (start == null || end == null) {
throw new NullPointerException("Missing day of week.");
}
return new SpanOfWeekdays(start, end);
} | [
"public",
"static",
"SpanOfWeekdays",
"between",
"(",
"Weekday",
"start",
",",
"Weekday",
"end",
")",
"{",
"if",
"(",
"start",
"==",
"null",
"||",
"end",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Missing day of week.\"",
")",
";... | /*[deutsch]
<p>Erzeugt eine neue Spanne von Wochentagen. </p>
<p>Es ist möglich, denselben Wochentag für Start und Ende zu wählen. In diesem
Fall besteht die Spanne aus genau einem Wochentag. </p>
@param start the starting weekday
@param end the ending weekday (inclusive)
@return new span of weekdays | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Erzeugt",
"eine",
"neue",
"Spanne",
"von",
"Wochentagen",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/SpanOfWeekdays.java#L216-L227 |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/utils/RestfulApiClient.java | RestfulApiClient.completeRequest | private static HttpEntityEnclosingRequestBase completeRequest(
final HttpEntityEnclosingRequestBase request,
final List<Pair<String, String>> params) throws UnsupportedEncodingException {
if (request != null) {
if (null != params && !params.isEmpty()) {
final List<NameValuePair> formParams = params.stream()
.map(pair -> new BasicNameValuePair(pair.getFirst(), pair.getSecond()))
.collect(Collectors.toList());
final HttpEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8");
request.setEntity(entity);
}
}
return request;
} | java | private static HttpEntityEnclosingRequestBase completeRequest(
final HttpEntityEnclosingRequestBase request,
final List<Pair<String, String>> params) throws UnsupportedEncodingException {
if (request != null) {
if (null != params && !params.isEmpty()) {
final List<NameValuePair> formParams = params.stream()
.map(pair -> new BasicNameValuePair(pair.getFirst(), pair.getSecond()))
.collect(Collectors.toList());
final HttpEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8");
request.setEntity(entity);
}
}
return request;
} | [
"private",
"static",
"HttpEntityEnclosingRequestBase",
"completeRequest",
"(",
"final",
"HttpEntityEnclosingRequestBase",
"request",
",",
"final",
"List",
"<",
"Pair",
"<",
"String",
",",
"String",
">",
">",
"params",
")",
"throws",
"UnsupportedEncodingException",
"{",
... | helper function to fill the request with header entries and posting body . | [
"helper",
"function",
"to",
"fill",
"the",
"request",
"with",
"header",
"entries",
"and",
"posting",
"body",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/utils/RestfulApiClient.java#L86-L99 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java | UfsJournalFile.decodeCheckpointFile | @Nullable
static UfsJournalFile decodeCheckpointFile(UfsJournal journal, String filename) {
URI location = URIUtils.appendPathOrDie(journal.getCheckpointDir(), filename);
try {
String[] parts = filename.split("-");
// There can be temporary files in logs directory. Skip them.
if (parts.length != 2) {
return null;
}
long start = Long.decode(parts[0]);
long end = Long.decode(parts[1]);
Preconditions.checkState(start == 0);
return UfsJournalFile.createCheckpointFile(location, end);
} catch (IllegalStateException e) {
LOG.error("Illegal journal file {}.", location);
throw e;
} catch (NumberFormatException e) {
// There can be temporary files (e.g. created for rename).
return null;
}
} | java | @Nullable
static UfsJournalFile decodeCheckpointFile(UfsJournal journal, String filename) {
URI location = URIUtils.appendPathOrDie(journal.getCheckpointDir(), filename);
try {
String[] parts = filename.split("-");
// There can be temporary files in logs directory. Skip them.
if (parts.length != 2) {
return null;
}
long start = Long.decode(parts[0]);
long end = Long.decode(parts[1]);
Preconditions.checkState(start == 0);
return UfsJournalFile.createCheckpointFile(location, end);
} catch (IllegalStateException e) {
LOG.error("Illegal journal file {}.", location);
throw e;
} catch (NumberFormatException e) {
// There can be temporary files (e.g. created for rename).
return null;
}
} | [
"@",
"Nullable",
"static",
"UfsJournalFile",
"decodeCheckpointFile",
"(",
"UfsJournal",
"journal",
",",
"String",
"filename",
")",
"{",
"URI",
"location",
"=",
"URIUtils",
".",
"appendPathOrDie",
"(",
"journal",
".",
"getCheckpointDir",
"(",
")",
",",
"filename",
... | Decodes a checkpoint file name into a {@link UfsJournalFile}.
@param journal the UFS journal instance
@param filename the filename
@return the instance of {@link UfsJournalFile}, null if the file invalid | [
"Decodes",
"a",
"checkpoint",
"file",
"name",
"into",
"a",
"{",
"@link",
"UfsJournalFile",
"}",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java#L179-L201 |
roboconf/roboconf-platform | miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java | AbstractStructuredRenderer.saveImage | private void saveImage( final Component comp, DiagramType type, AbstractRoboconfTransformer transformer, StringBuilder sb )
throws IOException {
String baseName = comp.getName() + "_" + type; //$NON-NLS-1$
String relativePath = "png/" + baseName + ".png"; //$NON-NLS-1$ //$NON-NLS-2$
if( this.options.containsKey( DocConstants.OPTION_GEN_IMAGES_ONCE ))
relativePath = "../" + relativePath;
File pngFile = new File( this.outputDirectory, relativePath ).getCanonicalFile();
if( ! pngFile.exists()) {
Utils.createDirectory( pngFile.getParentFile());
GraphUtils.writeGraph(
pngFile,
comp,
transformer.getConfiguredLayout(),
transformer.getGraph(),
transformer.getEdgeShapeTransformer(),
this.options );
}
sb.append( renderImage( comp.getName(), type, relativePath ));
} | java | private void saveImage( final Component comp, DiagramType type, AbstractRoboconfTransformer transformer, StringBuilder sb )
throws IOException {
String baseName = comp.getName() + "_" + type; //$NON-NLS-1$
String relativePath = "png/" + baseName + ".png"; //$NON-NLS-1$ //$NON-NLS-2$
if( this.options.containsKey( DocConstants.OPTION_GEN_IMAGES_ONCE ))
relativePath = "../" + relativePath;
File pngFile = new File( this.outputDirectory, relativePath ).getCanonicalFile();
if( ! pngFile.exists()) {
Utils.createDirectory( pngFile.getParentFile());
GraphUtils.writeGraph(
pngFile,
comp,
transformer.getConfiguredLayout(),
transformer.getGraph(),
transformer.getEdgeShapeTransformer(),
this.options );
}
sb.append( renderImage( comp.getName(), type, relativePath ));
} | [
"private",
"void",
"saveImage",
"(",
"final",
"Component",
"comp",
",",
"DiagramType",
"type",
",",
"AbstractRoboconfTransformer",
"transformer",
",",
"StringBuilder",
"sb",
")",
"throws",
"IOException",
"{",
"String",
"baseName",
"=",
"comp",
".",
"getName",
"(",... | Generates and saves an image.
@param comp the component to highlight in the image
@param type the kind of relation to show in the diagram
@param transformer a transformer for the graph generation
@param sb the string builder to append the link to the generated image
@throws IOException if something went wrong | [
"Generates",
"and",
"saves",
"an",
"image",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-doc-generator/src/main/java/net/roboconf/doc/generator/internal/AbstractStructuredRenderer.java#L576-L598 |
kiswanij/jk-util | src/main/java/com/jk/util/validation/builtin/ValidationBundle.java | ValidationBundle.getMessage | public static String getMessage(final Class class1, final String string, final int port) {
return JKMessage.get(string, port);
} | java | public static String getMessage(final Class class1, final String string, final int port) {
return JKMessage.get(string, port);
} | [
"public",
"static",
"String",
"getMessage",
"(",
"final",
"Class",
"class1",
",",
"final",
"String",
"string",
",",
"final",
"int",
"port",
")",
"{",
"return",
"JKMessage",
".",
"get",
"(",
"string",
",",
"port",
")",
";",
"}"
] | Gets the message.
@param class1 the class 1
@param string the string
@param port the port
@return the message | [
"Gets",
"the",
"message",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/validation/builtin/ValidationBundle.java#L37-L39 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java | JsonUtil.putCharacterList | public static void putCharacterList(Writer writer, List<Character> values) throws IOException {
if (values == null) {
writer.write("null");
} else {
startArray(writer);
for (int i = 0; i < values.size(); i++) {
put(writer, values.get(i));
if (i != values.size() - 1) {
addSeparator(writer);
}
}
endArray(writer);
}
} | java | public static void putCharacterList(Writer writer, List<Character> values) throws IOException {
if (values == null) {
writer.write("null");
} else {
startArray(writer);
for (int i = 0; i < values.size(); i++) {
put(writer, values.get(i));
if (i != values.size() - 1) {
addSeparator(writer);
}
}
endArray(writer);
}
} | [
"public",
"static",
"void",
"putCharacterList",
"(",
"Writer",
"writer",
",",
"List",
"<",
"Character",
">",
"values",
")",
"throws",
"IOException",
"{",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"\"null\"",
")",
";",
"}",... | Writes the given value with the given writer, sanitizing with {@link #sanitize(String)} as a valid JSON-formatted data.
@param writer
@param values
@throws IOException
@author vvakame | [
"Writes",
"the",
"given",
"value",
"with",
"the",
"given",
"writer",
"sanitizing",
"with",
"{"
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L212-L225 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShadowMap.java | GVRShadowMap.setOrthoShadowMatrix | void setOrthoShadowMatrix(Matrix4f modelMtx, GVRLight light)
{
GVROrthogonalCamera camera = (GVROrthogonalCamera) getCamera();
if (camera == null)
{
return;
}
float w = camera.getRightClippingDistance() - camera.getLeftClippingDistance();
float h = camera.getTopClippingDistance() - camera.getBottomClippingDistance();
float near = camera.getNearClippingDistance();
float far = camera.getFarClippingDistance();
modelMtx.invert();
modelMtx.get(mTempMtx);
camera.setViewMatrix(mTempMtx);
mShadowMatrix.setOrthoSymmetric(w, h, near, far);
mShadowMatrix.mul(modelMtx);
sBiasMatrix.mul(mShadowMatrix, mShadowMatrix);
mShadowMatrix.getColumn(0, mTemp);
light.setVec4("sm0", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
mShadowMatrix.getColumn(1, mTemp);
light.setVec4("sm1", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
mShadowMatrix.getColumn(2, mTemp);
light.setVec4("sm2", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
mShadowMatrix.getColumn(3, mTemp);
light.setVec4("sm3", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
} | java | void setOrthoShadowMatrix(Matrix4f modelMtx, GVRLight light)
{
GVROrthogonalCamera camera = (GVROrthogonalCamera) getCamera();
if (camera == null)
{
return;
}
float w = camera.getRightClippingDistance() - camera.getLeftClippingDistance();
float h = camera.getTopClippingDistance() - camera.getBottomClippingDistance();
float near = camera.getNearClippingDistance();
float far = camera.getFarClippingDistance();
modelMtx.invert();
modelMtx.get(mTempMtx);
camera.setViewMatrix(mTempMtx);
mShadowMatrix.setOrthoSymmetric(w, h, near, far);
mShadowMatrix.mul(modelMtx);
sBiasMatrix.mul(mShadowMatrix, mShadowMatrix);
mShadowMatrix.getColumn(0, mTemp);
light.setVec4("sm0", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
mShadowMatrix.getColumn(1, mTemp);
light.setVec4("sm1", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
mShadowMatrix.getColumn(2, mTemp);
light.setVec4("sm2", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
mShadowMatrix.getColumn(3, mTemp);
light.setVec4("sm3", mTemp.x, mTemp.y, mTemp.z, mTemp.w);
} | [
"void",
"setOrthoShadowMatrix",
"(",
"Matrix4f",
"modelMtx",
",",
"GVRLight",
"light",
")",
"{",
"GVROrthogonalCamera",
"camera",
"=",
"(",
"GVROrthogonalCamera",
")",
"getCamera",
"(",
")",
";",
"if",
"(",
"camera",
"==",
"null",
")",
"{",
"return",
";",
"}... | Sets the direct light shadow matrix for the light from the input model/view
matrix and the shadow camera projection matrix.
@param modelMtx light model transform (to world coordinates)
@param light direct light component to update | [
"Sets",
"the",
"direct",
"light",
"shadow",
"matrix",
"for",
"the",
"light",
"from",
"the",
"input",
"model",
"/",
"view",
"matrix",
"and",
"the",
"shadow",
"camera",
"projection",
"matrix",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShadowMap.java#L171-L198 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/config/ssl/yoko/SocketFactory.java | SocketFactory.createSSLSocket | private Socket createSSLSocket(String host, int port, final String clientSSLConfigName) throws IOException {
final SSLSocketFactory factory = getSocketFactory(clientSSLConfigName);
SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
socket.setSoTimeout(60 * 1000);
// get a set of cipher suites appropriate for this connections requirements.
// We request this for each connection, since the outgoing IOR's requirements may be different from
// our server listener requirements.
String[] iorSuites;
try {
iorSuites = (String[]) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
return sslConfig.getCipherSuites(clientSSLConfigName, factory.getSupportedCipherSuites());
}
});
} catch (PrivilegedActionException pae) {
throw new IOException("Could not configure client socket", pae.getCause());
}
socket.setEnabledCipherSuites(iorSuites);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.debug(tc, "Created SSL socket to " + host + ":" + port);
Tr.debug(tc, " cipher suites:");
for (int i = 0; i < iorSuites.length; i++) {
Tr.debug(tc, " " + iorSuites[i]);
}
socket.addHandshakeCompletedListener(new HandshakeCompletedListener() {
@Override
public void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent) {
Certificate[] certs = handshakeCompletedEvent.getLocalCertificates();
if (certs != null) {
Tr.debug(tc, "handshake returned local certs count: " + certs.length);
for (int i = 0; i < certs.length; i++) {
Certificate cert = certs[i];
Tr.debug(tc, "cert: " + cert.toString());
}
} else {
Tr.debug(tc, "handshake returned no local certs");
}
}
});
}
return socket;
} | java | private Socket createSSLSocket(String host, int port, final String clientSSLConfigName) throws IOException {
final SSLSocketFactory factory = getSocketFactory(clientSSLConfigName);
SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
socket.setSoTimeout(60 * 1000);
// get a set of cipher suites appropriate for this connections requirements.
// We request this for each connection, since the outgoing IOR's requirements may be different from
// our server listener requirements.
String[] iorSuites;
try {
iorSuites = (String[]) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
return sslConfig.getCipherSuites(clientSSLConfigName, factory.getSupportedCipherSuites());
}
});
} catch (PrivilegedActionException pae) {
throw new IOException("Could not configure client socket", pae.getCause());
}
socket.setEnabledCipherSuites(iorSuites);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.debug(tc, "Created SSL socket to " + host + ":" + port);
Tr.debug(tc, " cipher suites:");
for (int i = 0; i < iorSuites.length; i++) {
Tr.debug(tc, " " + iorSuites[i]);
}
socket.addHandshakeCompletedListener(new HandshakeCompletedListener() {
@Override
public void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent) {
Certificate[] certs = handshakeCompletedEvent.getLocalCertificates();
if (certs != null) {
Tr.debug(tc, "handshake returned local certs count: " + certs.length);
for (int i = 0; i < certs.length; i++) {
Certificate cert = certs[i];
Tr.debug(tc, "cert: " + cert.toString());
}
} else {
Tr.debug(tc, "handshake returned no local certs");
}
}
});
}
return socket;
} | [
"private",
"Socket",
"createSSLSocket",
"(",
"String",
"host",
",",
"int",
"port",
",",
"final",
"String",
"clientSSLConfigName",
")",
"throws",
"IOException",
"{",
"final",
"SSLSocketFactory",
"factory",
"=",
"getSocketFactory",
"(",
"clientSSLConfigName",
")",
";"... | Create an SSL client socket using the IOR-encoded
security characteristics.
Setting want/need client auth on a client socket has no effect so all we can do is use the right host, port, ciphers
@param host The target host name.
@param port The target connection port.
@param clientSSLConfigName name of the sslConfig used for cipher suite selection
@return An appropriately configured client SSLSocket.
@exception IOException if ssl socket can't be obtained and configured. | [
"Create",
"an",
"SSL",
"client",
"socket",
"using",
"the",
"IOR",
"-",
"encoded",
"security",
"characteristics",
".",
"Setting",
"want",
"/",
"need",
"client",
"auth",
"on",
"a",
"client",
"socket",
"has",
"no",
"effect",
"so",
"all",
"we",
"can",
"do",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/config/ssl/yoko/SocketFactory.java#L410-L456 |
JosePaumard/streams-utils | src/main/java/org/paumard/streams/StreamsUtils.java | StreamsUtils.shiftingWindowAveragingInt | public static DoubleStream shiftingWindowAveragingInt(IntStream intStream, int rollingFactor) {
Objects.requireNonNull(intStream);
RollingOfIntSpliterator ofIntSpliterator = RollingOfIntSpliterator.of(intStream.spliterator(), rollingFactor);
return StreamSupport.stream(ofIntSpliterator, intStream.isParallel())
.onClose(intStream::close)
.mapToDouble(subStream -> subStream.average().getAsDouble());
} | java | public static DoubleStream shiftingWindowAveragingInt(IntStream intStream, int rollingFactor) {
Objects.requireNonNull(intStream);
RollingOfIntSpliterator ofIntSpliterator = RollingOfIntSpliterator.of(intStream.spliterator(), rollingFactor);
return StreamSupport.stream(ofIntSpliterator, intStream.isParallel())
.onClose(intStream::close)
.mapToDouble(subStream -> subStream.average().getAsDouble());
} | [
"public",
"static",
"DoubleStream",
"shiftingWindowAveragingInt",
"(",
"IntStream",
"intStream",
",",
"int",
"rollingFactor",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"intStream",
")",
";",
"RollingOfIntSpliterator",
"ofIntSpliterator",
"=",
"RollingOfIntSpliterat... | <p>Generates a stream that is computed from a provided int stream by first rolling it in the same
way as the <code>roll()</code> method does. The average is then computed on each substream, to
form the final double stream. No boxing / unboxing is conducted in the process.
<p>The resulting stream has the same number of elements as the provided stream,
minus the size of the window width, to preserve consistency of each collection. </p>
<p>A <code>NullPointerException</code> will be thrown if the provided stream is null.</p>
@param intStream the processed stream
@param rollingFactor the size of the window to apply the collector on
@return a stream in which each value is the collection of the provided stream | [
"<p",
">",
"Generates",
"a",
"stream",
"that",
"is",
"computed",
"from",
"a",
"provided",
"int",
"stream",
"by",
"first",
"rolling",
"it",
"in",
"the",
"same",
"way",
"as",
"the",
"<code",
">",
"roll",
"()",
"<",
"/",
"code",
">",
"method",
"does",
"... | train | https://github.com/JosePaumard/streams-utils/blob/56152574af0aca44c5f679761202a8f90984ab73/src/main/java/org/paumard/streams/StreamsUtils.java#L580-L587 |
MorphiaOrg/morphia | morphia/src/main/java/dev/morphia/utils/Assert.java | Assert.parametersNotNull | public static void parametersNotNull(final String names, final Object... objects) {
String msgPrefix = "At least one of the parameters";
if (objects != null) {
if (objects.length == 1) {
msgPrefix = "Parameter";
}
for (final Object object : objects) {
if (object == null) {
raiseError(String.format("%s '%s' is null.", msgPrefix, names));
}
}
}
} | java | public static void parametersNotNull(final String names, final Object... objects) {
String msgPrefix = "At least one of the parameters";
if (objects != null) {
if (objects.length == 1) {
msgPrefix = "Parameter";
}
for (final Object object : objects) {
if (object == null) {
raiseError(String.format("%s '%s' is null.", msgPrefix, names));
}
}
}
} | [
"public",
"static",
"void",
"parametersNotNull",
"(",
"final",
"String",
"names",
",",
"final",
"Object",
"...",
"objects",
")",
"{",
"String",
"msgPrefix",
"=",
"\"At least one of the parameters\"",
";",
"if",
"(",
"objects",
"!=",
"null",
")",
"{",
"if",
"("... | Validates that all the parameters are not null
@param names a comma separated String of parameter names
@param objects the proposed parameter values | [
"Validates",
"that",
"all",
"the",
"parameters",
"are",
"not",
"null"
] | train | https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/Assert.java#L27-L41 |
h2oai/h2o-3 | h2o-algos/src/main/java/hex/word2vec/Word2VecModel.java | Word2VecModel.cosineSimilarity | private float cosineSimilarity(float[] target, int pos, float[] vecs) {
float dotProd = 0, tsqr = 0, csqr = 0;
for(int i = 0; i < target.length; i++) {
dotProd += target[i] * vecs[pos + i];
tsqr += Math.pow(target[i], 2);
csqr += Math.pow(vecs[pos + i], 2);
}
return (float) (dotProd / (Math.sqrt(tsqr) * Math.sqrt(csqr)));
} | java | private float cosineSimilarity(float[] target, int pos, float[] vecs) {
float dotProd = 0, tsqr = 0, csqr = 0;
for(int i = 0; i < target.length; i++) {
dotProd += target[i] * vecs[pos + i];
tsqr += Math.pow(target[i], 2);
csqr += Math.pow(vecs[pos + i], 2);
}
return (float) (dotProd / (Math.sqrt(tsqr) * Math.sqrt(csqr)));
} | [
"private",
"float",
"cosineSimilarity",
"(",
"float",
"[",
"]",
"target",
",",
"int",
"pos",
",",
"float",
"[",
"]",
"vecs",
")",
"{",
"float",
"dotProd",
"=",
"0",
",",
"tsqr",
"=",
"0",
",",
"csqr",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
... | Basic calculation of cosine similarity
@param target - a word vector
@param pos - position in vecs
@param vecs - learned word vectors
@return cosine similarity between the two word vectors | [
"Basic",
"calculation",
"of",
"cosine",
"similarity"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/word2vec/Word2VecModel.java#L252-L260 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.forAllMemberTagTokens | public void forAllMemberTagTokens(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
forAllMemberTagTokens(template, attributes, FOR_FIELD);
}
else if (getCurrentMethod() != null) {
forAllMemberTagTokens(template, attributes, FOR_METHOD);
}
} | java | public void forAllMemberTagTokens(String template, Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
forAllMemberTagTokens(template, attributes, FOR_FIELD);
}
else if (getCurrentMethod() != null) {
forAllMemberTagTokens(template, attributes, FOR_METHOD);
}
} | [
"public",
"void",
"forAllMemberTagTokens",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"forAllMemberTagTokens",
"(",
"template",
",",
"attribute... | Iterates over all tokens in current member tag with the name tagName and evaluates the body for every token.
@param template The body of the block tag
@param attributes The attributes of the template tag
@exception XDocletException If an error occurs
@doc.tag type="block"
@doc.param name="tagName" optional="false" description="The tag name."
@doc.param name="delimiter" description="delimiter for the StringTokenizer. consult javadoc for
java.util.StringTokenizer default is ','"
@doc.param name="skip" description="how many tokens to skip on start" | [
"Iterates",
"over",
"all",
"tokens",
"in",
"current",
"member",
"tag",
"with",
"the",
"name",
"tagName",
"and",
"evaluates",
"the",
"body",
"for",
"every",
"token",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L261-L269 |
skyscreamer/JSONassert | src/main/java/org/skyscreamer/jsonassert/comparator/JSONCompareUtil.java | JSONCompareUtil.findUniqueKey | public static String findUniqueKey(JSONArray expected) throws JSONException {
// Find a unique key for the object (id, name, whatever)
JSONObject o = (JSONObject) expected.get(0); // There's at least one at this point
for (String candidate : getKeys(o)) {
if (isUsableAsUniqueKey(candidate, expected)) return candidate;
}
// No usable unique key :-(
return null;
} | java | public static String findUniqueKey(JSONArray expected) throws JSONException {
// Find a unique key for the object (id, name, whatever)
JSONObject o = (JSONObject) expected.get(0); // There's at least one at this point
for (String candidate : getKeys(o)) {
if (isUsableAsUniqueKey(candidate, expected)) return candidate;
}
// No usable unique key :-(
return null;
} | [
"public",
"static",
"String",
"findUniqueKey",
"(",
"JSONArray",
"expected",
")",
"throws",
"JSONException",
"{",
"// Find a unique key for the object (id, name, whatever)",
"JSONObject",
"o",
"=",
"(",
"JSONObject",
")",
"expected",
".",
"get",
"(",
"0",
")",
";",
... | Searches for the unique key of the {@code expected} JSON array.
@param expected the array to find the unique key of
@return the unique key if there's any, otherwise null
@throws JSONException JSON parsing error | [
"Searches",
"for",
"the",
"unique",
"key",
"of",
"the",
"{",
"@code",
"expected",
"}",
"JSON",
"array",
"."
] | train | https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/comparator/JSONCompareUtil.java#L66-L74 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_game_ipOnGame_PUT | public void ip_game_ipOnGame_PUT(String ip, String ipOnGame, OvhGameMitigation body) throws IOException {
String qPath = "/ip/{ip}/game/{ipOnGame}";
StringBuilder sb = path(qPath, ip, ipOnGame);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void ip_game_ipOnGame_PUT(String ip, String ipOnGame, OvhGameMitigation body) throws IOException {
String qPath = "/ip/{ip}/game/{ipOnGame}";
StringBuilder sb = path(qPath, ip, ipOnGame);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"ip_game_ipOnGame_PUT",
"(",
"String",
"ip",
",",
"String",
"ipOnGame",
",",
"OvhGameMitigation",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/game/{ipOnGame}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qP... | Alter this object properties
REST: PUT /ip/{ip}/game/{ipOnGame}
@param body [required] New object properties
@param ip [required]
@param ipOnGame [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L406-L410 |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.initialize | public static Responder initialize(String[] args) throws ResponderConfigException {
readVersionProperties();
LOGGER.info("Starting Argo Responder daemon process. Version " + ARGO_VERSION);
ResponderConfiguration config = parseCommandLine(args);
if (config == null) {
LOGGER.error( "Invalid Responder Configuration. Terminating Responder process.");
return null;
}
Responder responder = new Responder(config);
// load up the handler classes specified in the configuration parameters
try {
responder.loadHandlerPlugins(config.getProbeHandlerConfigs());
} catch (ProbeHandlerConfigException e) {
throw new ResponderConfigException("Error loading handler plugins: ", e);
}
// load up the transport classes specified in the configuration parameters
responder.loadTransportPlugins(config.getTransportConfigs());
LOGGER.info("Responder registering shutdown hook.");
ResponderShutdown hook = new ResponderShutdown(responder);
Runtime.getRuntime().addShutdownHook(hook);
// This needs to be sent to stdout as there is no way to force the logging
// of this via the LOGGER
System.out.println("Argo " + ARGO_VERSION + " :: " + "Responder started [" + responder._runtimeId + "] :: Responding as [" + (config.isHTTPSConfigured() ? "Secure HTTPS" : "Non-secure HTTP") + "]");
return responder;
} | java | public static Responder initialize(String[] args) throws ResponderConfigException {
readVersionProperties();
LOGGER.info("Starting Argo Responder daemon process. Version " + ARGO_VERSION);
ResponderConfiguration config = parseCommandLine(args);
if (config == null) {
LOGGER.error( "Invalid Responder Configuration. Terminating Responder process.");
return null;
}
Responder responder = new Responder(config);
// load up the handler classes specified in the configuration parameters
try {
responder.loadHandlerPlugins(config.getProbeHandlerConfigs());
} catch (ProbeHandlerConfigException e) {
throw new ResponderConfigException("Error loading handler plugins: ", e);
}
// load up the transport classes specified in the configuration parameters
responder.loadTransportPlugins(config.getTransportConfigs());
LOGGER.info("Responder registering shutdown hook.");
ResponderShutdown hook = new ResponderShutdown(responder);
Runtime.getRuntime().addShutdownHook(hook);
// This needs to be sent to stdout as there is no way to force the logging
// of this via the LOGGER
System.out.println("Argo " + ARGO_VERSION + " :: " + "Responder started [" + responder._runtimeId + "] :: Responding as [" + (config.isHTTPSConfigured() ? "Secure HTTPS" : "Non-secure HTTP") + "]");
return responder;
} | [
"public",
"static",
"Responder",
"initialize",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"ResponderConfigException",
"{",
"readVersionProperties",
"(",
")",
";",
"LOGGER",
".",
"info",
"(",
"\"Starting Argo Responder daemon process. Version \"",
"+",
"ARGO_VERSION... | Create a new Responder given the command line arguments.
@param args - command line arguments
@return the new Responder instance or null if something wonky happened
@throws ResponderConfigException if bad things happen with the
configuration files and the content of the files. For example if
the classnames for the probe handlers are bad (usually a type or
classpath issue) | [
"Create",
"a",
"new",
"Responder",
"given",
"the",
"command",
"line",
"arguments",
"."
] | train | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L510-L543 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsAccountsApp.java | CmsAccountsApp.createUserTable | protected I_CmsFilterableTable createUserTable(
String ou,
CmsUUID groupID,
I_CmsOuTreeType type,
boolean showAll,
CmsAccountsApp cmsAccountsApp) {
return new CmsUserTable(ou, groupID, type, showAll, cmsAccountsApp);
} | java | protected I_CmsFilterableTable createUserTable(
String ou,
CmsUUID groupID,
I_CmsOuTreeType type,
boolean showAll,
CmsAccountsApp cmsAccountsApp) {
return new CmsUserTable(ou, groupID, type, showAll, cmsAccountsApp);
} | [
"protected",
"I_CmsFilterableTable",
"createUserTable",
"(",
"String",
"ou",
",",
"CmsUUID",
"groupID",
",",
"I_CmsOuTreeType",
"type",
",",
"boolean",
"showAll",
",",
"CmsAccountsApp",
"cmsAccountsApp",
")",
"{",
"return",
"new",
"CmsUserTable",
"(",
"ou",
",",
"... | Creates user table for a specific group or role.<p>
@param ou the OU path
@param groupID the group id
@param type the tree type
@param showAll true if all users should be shown
@param cmsAccountsApp the app instance
@return the user table | [
"Creates",
"user",
"table",
"for",
"a",
"specific",
"group",
"or",
"role",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsAccountsApp.java#L807-L815 |
gresrun/jesque | src/main/java/net/greghaines/jesque/worker/MapBasedJobFactory.java | MapBasedJobFactory.checkJobType | protected void checkJobType(final String jobName, final Class<?> jobType) {
if (jobName == null) {
throw new IllegalArgumentException("jobName must not be null");
}
if (jobType == null) {
throw new IllegalArgumentException("jobType must not be null");
}
if (!(Runnable.class.isAssignableFrom(jobType))
&& !(Callable.class.isAssignableFrom(jobType))) {
throw new IllegalArgumentException(
"jobType must implement either Runnable or Callable: " + jobType);
}
} | java | protected void checkJobType(final String jobName, final Class<?> jobType) {
if (jobName == null) {
throw new IllegalArgumentException("jobName must not be null");
}
if (jobType == null) {
throw new IllegalArgumentException("jobType must not be null");
}
if (!(Runnable.class.isAssignableFrom(jobType))
&& !(Callable.class.isAssignableFrom(jobType))) {
throw new IllegalArgumentException(
"jobType must implement either Runnable or Callable: " + jobType);
}
} | [
"protected",
"void",
"checkJobType",
"(",
"final",
"String",
"jobName",
",",
"final",
"Class",
"<",
"?",
">",
"jobType",
")",
"{",
"if",
"(",
"jobName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"jobName must not be null\"",
")... | Determine if a job name and job type are valid.
@param jobName the name of the job
@param jobType the class of the job
@throws IllegalArgumentException if the name or type are invalid | [
"Determine",
"if",
"a",
"job",
"name",
"and",
"job",
"type",
"are",
"valid",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/worker/MapBasedJobFactory.java#L128-L140 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.saveAttachment | public com.cloudant.client.api.model.Response saveAttachment(InputStream in, String name,
String contentType) {
Response couchDbResponse = db.saveAttachment(in, name, contentType);
com.cloudant.client.api.model.Response response = new com.cloudant.client.api.model
.Response(couchDbResponse);
return response;
} | java | public com.cloudant.client.api.model.Response saveAttachment(InputStream in, String name,
String contentType) {
Response couchDbResponse = db.saveAttachment(in, name, contentType);
com.cloudant.client.api.model.Response response = new com.cloudant.client.api.model
.Response(couchDbResponse);
return response;
} | [
"public",
"com",
".",
"cloudant",
".",
"client",
".",
"api",
".",
"model",
".",
"Response",
"saveAttachment",
"(",
"InputStream",
"in",
",",
"String",
"name",
",",
"String",
"contentType",
")",
"{",
"Response",
"couchDbResponse",
"=",
"db",
".",
"saveAttachm... | Creates an attachment from the specified InputStream and a new document with a generated
document ID.
<P>Example usage:</P>
<pre>
{@code
byte[] bytesToDB = "binary data".getBytes();
ByteArrayInputStream bytesIn = new ByteArrayInputStream(bytesToDB);
Response response = db.saveAttachment(bytesIn, "foo.txt", "text/plain");
}
</pre>
<p>To retrieve an attachment, see {@link #find(Class, String, Params)}</p>
@param in The {@link InputStream} providing the binary data.
@param name The attachment name.
@param contentType The attachment "Content-Type".
@return {@link com.cloudant.client.api.model.Response}
@see <a
href="https://console.bluemix.net/docs/services/Cloudant/api/attachments.html#attachments"
target="_blank">Attachments</a> | [
"Creates",
"an",
"attachment",
"from",
"the",
"specified",
"InputStream",
"and",
"a",
"new",
"document",
"with",
"a",
"generated",
"document",
"ID",
".",
"<P",
">",
"Example",
"usage",
":",
"<",
"/",
"P",
">",
"<pre",
">",
"{",
"@code",
"byte",
"[]",
"... | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L1243-L1249 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java | DocBookBuilder.buildTranslatedBook | public HashMap<String, byte[]> buildTranslatedBook(final ContentSpec contentSpec, final String requester,
final DocBookBuildingOptions buildingOptions,
final ZanataDetails zanataDetails) throws BuilderCreationException, BuildProcessingException {
return buildTranslatedBook(contentSpec, requester, buildingOptions, new HashMap<String, byte[]>(), zanataDetails);
} | java | public HashMap<String, byte[]> buildTranslatedBook(final ContentSpec contentSpec, final String requester,
final DocBookBuildingOptions buildingOptions,
final ZanataDetails zanataDetails) throws BuilderCreationException, BuildProcessingException {
return buildTranslatedBook(contentSpec, requester, buildingOptions, new HashMap<String, byte[]>(), zanataDetails);
} | [
"public",
"HashMap",
"<",
"String",
",",
"byte",
"[",
"]",
">",
"buildTranslatedBook",
"(",
"final",
"ContentSpec",
"contentSpec",
",",
"final",
"String",
"requester",
",",
"final",
"DocBookBuildingOptions",
"buildingOptions",
",",
"final",
"ZanataDetails",
"zanataD... | Builds a DocBook Formatted Book using a Content Specification to define the structure and contents of the book.
@param contentSpec The content specification to build from.
@param requester The user who requested the build.
@param buildingOptions The options to be used when building.
@param zanataDetails The Zanata server details to be used when populating links
@return Returns a mapping of file names/locations to files. This HashMap can be used to build a ZIP archive.
@throws BuilderCreationException Thrown if the builder is unable to start due to incorrect passed variables.
@throws BuildProcessingException Any build issue that should not occur under normal circumstances. Ie a Template can't be
converted to a DOM Document. | [
"Builds",
"a",
"DocBook",
"Formatted",
"Book",
"using",
"a",
"Content",
"Specification",
"to",
"define",
"the",
"structure",
"and",
"contents",
"of",
"the",
"book",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L404-L408 |
italiangrid/voms-api-java | src/main/java/org/italiangrid/voms/store/impl/DefaultVOMSTrustStore.java | DefaultVOMSTrustStore.loadCertificatesFromDirectory | private void loadCertificatesFromDirectory(File directory) {
directorySanityChecks(directory);
synchronized (listenerLock) {
listener.notifyCertficateLookupEvent(directory.getAbsolutePath());
}
File[] certFiles = directory.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(CERTIFICATE_FILENAME_SUFFIX);
}
});
for (File f : certFiles)
loadCertificateFromFile(f);
} | java | private void loadCertificatesFromDirectory(File directory) {
directorySanityChecks(directory);
synchronized (listenerLock) {
listener.notifyCertficateLookupEvent(directory.getAbsolutePath());
}
File[] certFiles = directory.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(CERTIFICATE_FILENAME_SUFFIX);
}
});
for (File f : certFiles)
loadCertificateFromFile(f);
} | [
"private",
"void",
"loadCertificatesFromDirectory",
"(",
"File",
"directory",
")",
"{",
"directorySanityChecks",
"(",
"directory",
")",
";",
"synchronized",
"(",
"listenerLock",
")",
"{",
"listener",
".",
"notifyCertficateLookupEvent",
"(",
"directory",
".",
"getAbsol... | Loads all the certificates in the local directory. Only files with the
extension matching the {@link #CERTIFICATE_FILENAME_PATTERN} are
considered.
@param directory | [
"Loads",
"all",
"the",
"certificates",
"in",
"the",
"local",
"directory",
".",
"Only",
"files",
"with",
"the",
"extension",
"matching",
"the",
"{",
"@link",
"#CERTIFICATE_FILENAME_PATTERN",
"}",
"are",
"considered",
"."
] | train | https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/store/impl/DefaultVOMSTrustStore.java#L220-L239 |
sjamesr/jfreesane | src/main/java/au/com/southsky/jfreesane/SaneSession.java | SaneSession.withRemoteSane | public static SaneSession withRemoteSane(InetAddress saneAddress, int port) throws IOException {
return withRemoteSane(saneAddress, port, 0, TimeUnit.MILLISECONDS, 0, TimeUnit.MILLISECONDS);
} | java | public static SaneSession withRemoteSane(InetAddress saneAddress, int port) throws IOException {
return withRemoteSane(saneAddress, port, 0, TimeUnit.MILLISECONDS, 0, TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"SaneSession",
"withRemoteSane",
"(",
"InetAddress",
"saneAddress",
",",
"int",
"port",
")",
"throws",
"IOException",
"{",
"return",
"withRemoteSane",
"(",
"saneAddress",
",",
"port",
",",
"0",
",",
"TimeUnit",
".",
"MILLISECONDS",
",",
"0",
... | Establishes a connection to the SANE daemon running on the given host on the given port with no
connection timeout. | [
"Establishes",
"a",
"connection",
"to",
"the",
"SANE",
"daemon",
"running",
"on",
"the",
"given",
"host",
"on",
"the",
"given",
"port",
"with",
"no",
"connection",
"timeout",
"."
] | train | https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L86-L88 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java | BlockDataHandler.setData | public static <T> void setData(String identifier, IBlockAccess world, BlockPos pos, T data)
{
setData(identifier, world, pos, data, false);
} | java | public static <T> void setData(String identifier, IBlockAccess world, BlockPos pos, T data)
{
setData(identifier, world, pos, data, false);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"setData",
"(",
"String",
"identifier",
",",
"IBlockAccess",
"world",
",",
"BlockPos",
"pos",
",",
"T",
"data",
")",
"{",
"setData",
"(",
"identifier",
",",
"world",
",",
"pos",
",",
"data",
",",
"false",
")",... | Sets the custom data to be stored at the {@link BlockPos} for the specified identifier.
@param <T> the generic type
@param identifier the identifier
@param world the world
@param pos the pos
@param data the data | [
"Sets",
"the",
"custom",
"data",
"to",
"be",
"stored",
"at",
"the",
"{",
"@link",
"BlockPos",
"}",
"for",
"the",
"specified",
"identifier",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/blockdata/BlockDataHandler.java#L305-L308 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.rotateLocal | public Matrix4x3f rotateLocal(float ang, float x, float y, float z) {
return rotateLocal(ang, x, y, z, this);
} | java | public Matrix4x3f rotateLocal(float ang, float x, float y, float z) {
return rotateLocal(ang, x, y, z, this);
} | [
"public",
"Matrix4x3f",
"rotateLocal",
"(",
"float",
"ang",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"return",
"rotateLocal",
"(",
"ang",
",",
"x",
",",
"y",
",",
"z",
",",
"this",
")",
";",
"}"
] | Pre-multiply a rotation to this matrix by rotating the given amount of radians
about the specified <code>(x, y, z)</code> axis.
<p>
The axis described by the three components needs to be a unit vector.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>R * M</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the
rotation will be applied last!
<p>
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use {@link #rotation(float, float, float, float) rotation()}.
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a>
@see #rotation(float, float, float, float)
@param ang
the angle in radians
@param x
the x component of the axis
@param y
the y component of the axis
@param z
the z component of the axis
@return this | [
"Pre",
"-",
"multiply",
"a",
"rotation",
"to",
"this",
"matrix",
"by",
"rotating",
"the",
"given",
"amount",
"of",
"radians",
"about",
"the",
"specified",
"<code",
">",
"(",
"x",
"y",
"z",
")",
"<",
"/",
"code",
">",
"axis",
".",
"<p",
">",
"The",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L4214-L4216 |
UrielCh/ovh-java-sdk | ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java | ApiOvhHorizonView.serviceName_domainTrust_domainTrustId_addDomainUserOnComposer_POST | public OvhTask serviceName_domainTrust_domainTrustId_addDomainUserOnComposer_POST(String serviceName, Long domainTrustId, String domain, String password, String username) throws IOException {
String qPath = "/horizonView/{serviceName}/domainTrust/{domainTrustId}/addDomainUserOnComposer";
StringBuilder sb = path(qPath, serviceName, domainTrustId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "password", password);
addBody(o, "username", username);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_domainTrust_domainTrustId_addDomainUserOnComposer_POST(String serviceName, Long domainTrustId, String domain, String password, String username) throws IOException {
String qPath = "/horizonView/{serviceName}/domainTrust/{domainTrustId}/addDomainUserOnComposer";
StringBuilder sb = path(qPath, serviceName, domainTrustId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
addBody(o, "password", password);
addBody(o, "username", username);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_domainTrust_domainTrustId_addDomainUserOnComposer_POST",
"(",
"String",
"serviceName",
",",
"Long",
"domainTrustId",
",",
"String",
"domain",
",",
"String",
"password",
",",
"String",
"username",
")",
"throws",
"IOException",
"{",
"String... | Add a domain user to add your desktop in your Active Directory
REST: POST /horizonView/{serviceName}/domainTrust/{domainTrustId}/addDomainUserOnComposer
@param password [required] Password of the user
@param domain [required] Name of your Domain (example : domain.local)
@param username [required] Name of the User who is going to add the Desktop in your Active Directory
@param serviceName [required] Domain of the service
@param domainTrustId [required] Domain trust id | [
"Add",
"a",
"domain",
"user",
"to",
"add",
"your",
"desktop",
"in",
"your",
"Active",
"Directory"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L314-L323 |
mbrade/prefixedproperties | pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java | PrefixedPropertiesPersister.loadFromJson | public void loadFromJson(final Properties props, final InputStream is) throws IOException {
try {
((PrefixedProperties) props).loadFromJSON(is);
} catch (final NoSuchMethodError err) {
throw new IOException(
"Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage());
}
} | java | public void loadFromJson(final Properties props, final InputStream is) throws IOException {
try {
((PrefixedProperties) props).loadFromJSON(is);
} catch (final NoSuchMethodError err) {
throw new IOException(
"Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage());
}
} | [
"public",
"void",
"loadFromJson",
"(",
"final",
"Properties",
"props",
",",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"try",
"{",
"(",
"(",
"PrefixedProperties",
")",
"props",
")",
".",
"loadFromJSON",
"(",
"is",
")",
";",
"}",
"catc... | Loads from json.
@param props
the props
@param is
the is
@throws IOException
Signals that an I/O exception has occurred. | [
"Loads",
"from",
"json",
"."
] | train | https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java#L53-L60 |
amaembo/streamex | src/main/java/one/util/streamex/DoubleStreamEx.java | DoubleStreamEx.mapLast | public DoubleStreamEx mapLast(DoubleUnaryOperator mapper) {
return delegate(new PairSpliterator.PSOfDouble((a, b) -> a, mapper, spliterator(),
PairSpliterator.MODE_MAP_LAST));
} | java | public DoubleStreamEx mapLast(DoubleUnaryOperator mapper) {
return delegate(new PairSpliterator.PSOfDouble((a, b) -> a, mapper, spliterator(),
PairSpliterator.MODE_MAP_LAST));
} | [
"public",
"DoubleStreamEx",
"mapLast",
"(",
"DoubleUnaryOperator",
"mapper",
")",
"{",
"return",
"delegate",
"(",
"new",
"PairSpliterator",
".",
"PSOfDouble",
"(",
"(",
"a",
",",
"b",
")",
"->",
"a",
",",
"mapper",
",",
"spliterator",
"(",
")",
",",
"PairS... | Returns a stream where the last element is the replaced with the result
of applying the given function while the other elements are left intact.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
<p>
The mapper function is called at most once. It could be not called at all
if the stream is empty or there is short-circuiting operation downstream.
@param mapper a
<a href="package-summary.html#NonInterference">non-interfering
</a>, <a href="package-summary.html#Statelessness">stateless</a>
function to apply to the last element
@return the new stream
@since 0.4.1 | [
"Returns",
"a",
"stream",
"where",
"the",
"last",
"element",
"is",
"the",
"replaced",
"with",
"the",
"result",
"of",
"applying",
"the",
"given",
"function",
"while",
"the",
"other",
"elements",
"are",
"left",
"intact",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L190-L193 |
lessthanoptimal/ddogleg | src/org/ddogleg/solver/PolynomialOps.java | PolynomialOps.cubicRealRoot | public static double cubicRealRoot( double c0 , double c1 , double c2 , double c3 ) {
// convert it into this format: r + q*x + p*x^2 + x^3 = 0
double p = c2/c3;
double q = c1/c3;
double r = c0/c3;
// reduce by substitution x = y - p/3 which results in y^3 + a*y + b = 0
double a = (3*q - p*p)/3.0;
double b = (2*p*p*p - 9*p*q + 27*r)/27.0;
double left = -b/2.0;
double right = Math.sqrt(b*b/4.0 + a*a*a/27.0);
double inner1 = left+right;
double inner2 = left-right;
double A,B;
if( inner1 < 0 )
A = -Math.pow(-inner1,1.0/3.0);
else
A = Math.pow(inner1,1.0/3.0);
if( inner2 < 0 )
B = -Math.pow(-inner2,1.0/3.0);
else
B = Math.pow(inner2,1.0/3.0);
return (A + B) - p/3.0;
} | java | public static double cubicRealRoot( double c0 , double c1 , double c2 , double c3 ) {
// convert it into this format: r + q*x + p*x^2 + x^3 = 0
double p = c2/c3;
double q = c1/c3;
double r = c0/c3;
// reduce by substitution x = y - p/3 which results in y^3 + a*y + b = 0
double a = (3*q - p*p)/3.0;
double b = (2*p*p*p - 9*p*q + 27*r)/27.0;
double left = -b/2.0;
double right = Math.sqrt(b*b/4.0 + a*a*a/27.0);
double inner1 = left+right;
double inner2 = left-right;
double A,B;
if( inner1 < 0 )
A = -Math.pow(-inner1,1.0/3.0);
else
A = Math.pow(inner1,1.0/3.0);
if( inner2 < 0 )
B = -Math.pow(-inner2,1.0/3.0);
else
B = Math.pow(inner2,1.0/3.0);
return (A + B) - p/3.0;
} | [
"public",
"static",
"double",
"cubicRealRoot",
"(",
"double",
"c0",
",",
"double",
"c1",
",",
"double",
"c2",
",",
"double",
"c3",
")",
"{",
"// convert it into this format: r + q*x + p*x^2 + x^3 = 0",
"double",
"p",
"=",
"c2",
"/",
"c3",
";",
"double",
"q",
... | Returns a real root to the cubic polynomial: 0 = c0 + c1*x + c2*x^2 + c3*c^3. There can be other
real roots.
WARNING: This technique is much less stable than using one of the RootFinder algorithms
@param c0 Polynomial coefficient for power 0
@param c1 Polynomial coefficient for power 1
@param c2 Polynomial coefficient for power 2
@param c3 Polynomial coefficient for power 3
@return A real root of the polynomial | [
"Returns",
"a",
"real",
"root",
"to",
"the",
"cubic",
"polynomial",
":",
"0",
"=",
"c0",
"+",
"c1",
"*",
"x",
"+",
"c2",
"*",
"x^2",
"+",
"c3",
"*",
"c^3",
".",
"There",
"can",
"be",
"other",
"real",
"roots",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/PolynomialOps.java#L255-L285 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.