repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.getCacheKey | private String getCacheKey(String[] keys, CmsDbContext dbc) {
if (!dbc.getProjectId().isNullUUID()) {
return "";
}
StringBuffer b = new StringBuffer(64);
int len = keys.length;
if (len > 0) {
for (int i = 0; i < len; i++) {
b.append(keys[i]);
b.append('_');
}
}
if (dbc.currentProject().isOnlineProject()) {
b.append("+");
} else {
b.append("-");
}
return b.toString();
} | java | private String getCacheKey(String[] keys, CmsDbContext dbc) {
if (!dbc.getProjectId().isNullUUID()) {
return "";
}
StringBuffer b = new StringBuffer(64);
int len = keys.length;
if (len > 0) {
for (int i = 0; i < len; i++) {
b.append(keys[i]);
b.append('_');
}
}
if (dbc.currentProject().isOnlineProject()) {
b.append("+");
} else {
b.append("-");
}
return b.toString();
} | [
"private",
"String",
"getCacheKey",
"(",
"String",
"[",
"]",
"keys",
",",
"CmsDbContext",
"dbc",
")",
"{",
"if",
"(",
"!",
"dbc",
".",
"getProjectId",
"(",
")",
".",
"isNullUUID",
"(",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuffer",
"b",
"... | Return a cache key build from the provided information.<p>
@param keys an array of keys to generate the cache key from
@param dbc the database context for which to generate the key
@return String a cache key build from the provided information | [
"Return",
"a",
"cache",
"key",
"build",
"from",
"the",
"provided",
"information",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L11185-L11204 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/validator/AbstractExtraLanguageValidator.java | AbstractExtraLanguageValidator.createTypeConverterInstance | @SuppressWarnings("static-method")
protected ExtraLanguageTypeConverter createTypeConverterInstance(
IExtraLanguageConversionInitializer initializer,
IExtraLanguageGeneratorContext context) {
return new ExtraLanguageTypeConverter(initializer, context);
} | java | @SuppressWarnings("static-method")
protected ExtraLanguageTypeConverter createTypeConverterInstance(
IExtraLanguageConversionInitializer initializer,
IExtraLanguageGeneratorContext context) {
return new ExtraLanguageTypeConverter(initializer, context);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"ExtraLanguageTypeConverter",
"createTypeConverterInstance",
"(",
"IExtraLanguageConversionInitializer",
"initializer",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"return",
"new",
"ExtraLanguage... | Create the instance of the type converter.
@param initializer the converter initializer.
@param context the generation context.
@return the type converter. | [
"Create",
"the",
"instance",
"of",
"the",
"type",
"converter",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/validator/AbstractExtraLanguageValidator.java#L350-L355 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Elvis.java | Elvis.operate | public static boolean operate(PageContext pc, double scope, Collection.Key[] varNames) {
return _operate(pc, scope, varNames, 0);
} | java | public static boolean operate(PageContext pc, double scope, Collection.Key[] varNames) {
return _operate(pc, scope, varNames, 0);
} | [
"public",
"static",
"boolean",
"operate",
"(",
"PageContext",
"pc",
",",
"double",
"scope",
",",
"Collection",
".",
"Key",
"[",
"]",
"varNames",
")",
"{",
"return",
"_operate",
"(",
"pc",
",",
"scope",
",",
"varNames",
",",
"0",
")",
";",
"}"
] | called by the Elvis operator from generated bytecode
@param pc
@param scope
@param varNames
@return | [
"called",
"by",
"the",
"Elvis",
"operator",
"from",
"generated",
"bytecode"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Elvis.java#L39-L41 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java | SeaGlassInternalFrameTitlePane.postClosingEvent | protected void postClosingEvent(JInternalFrame frame) {
InternalFrameEvent e = new InternalFrameEvent(frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
// Try posting event, unless there's a SecurityManager.
if (JInternalFrame.class.getClassLoader() == null) {
try {
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
return;
} catch (SecurityException se) {
// Use dispatchEvent instead.
}
}
frame.dispatchEvent(e);
} | java | protected void postClosingEvent(JInternalFrame frame) {
InternalFrameEvent e = new InternalFrameEvent(frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
// Try posting event, unless there's a SecurityManager.
if (JInternalFrame.class.getClassLoader() == null) {
try {
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
return;
} catch (SecurityException se) {
// Use dispatchEvent instead.
}
}
frame.dispatchEvent(e);
} | [
"protected",
"void",
"postClosingEvent",
"(",
"JInternalFrame",
"frame",
")",
"{",
"InternalFrameEvent",
"e",
"=",
"new",
"InternalFrameEvent",
"(",
"frame",
",",
"InternalFrameEvent",
".",
"INTERNAL_FRAME_CLOSING",
")",
";",
"// Try posting event, unless there's a Security... | Post a WINDOW_CLOSING-like event to the frame, so that it can be treated
like a regular Frame.
@param frame the internal frame to be closed. | [
"Post",
"a",
"WINDOW_CLOSING",
"-",
"like",
"event",
"to",
"the",
"frame",
"so",
"that",
"it",
"can",
"be",
"treated",
"like",
"a",
"regular",
"Frame",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassInternalFrameTitlePane.java#L644-L660 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/bolt/hdfs/HdfsOutputSwitcher.java | HdfsOutputSwitcher.appendLine | public void appendLine(String target, long nowTime) throws IOException
{
if (this.nextSwitchTime <= nowTime)
{
switchWriter(nowTime);
}
this.currentWriter.appendLine(target);
} | java | public void appendLine(String target, long nowTime) throws IOException
{
if (this.nextSwitchTime <= nowTime)
{
switchWriter(nowTime);
}
this.currentWriter.appendLine(target);
} | [
"public",
"void",
"appendLine",
"(",
"String",
"target",
",",
"long",
"nowTime",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"nextSwitchTime",
"<=",
"nowTime",
")",
"{",
"switchWriter",
"(",
"nowTime",
")",
";",
"}",
"this",
".",
"currentWri... | メッセージをHDFSに出力し、改行する。
@param target 出力行
@param nowTime 出力時刻
@throws IOException 入出力エラー発生時 | [
"メッセージをHDFSに出力し、改行する。"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/hdfs/HdfsOutputSwitcher.java#L153-L161 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/spelling/SpellingCheckRule.java | SpellingCheckRule.ignoreWord | protected boolean ignoreWord(String word) throws IOException {
if (!considerIgnoreWords) {
return false;
}
if (word.endsWith(".") && !wordsToBeIgnored.contains(word)) {
return isIgnoredNoCase(word.substring(0, word.length()-1)); // e.g. word at end of sentence
}
return isIgnoredNoCase(word);
} | java | protected boolean ignoreWord(String word) throws IOException {
if (!considerIgnoreWords) {
return false;
}
if (word.endsWith(".") && !wordsToBeIgnored.contains(word)) {
return isIgnoredNoCase(word.substring(0, word.length()-1)); // e.g. word at end of sentence
}
return isIgnoredNoCase(word);
} | [
"protected",
"boolean",
"ignoreWord",
"(",
"String",
"word",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"considerIgnoreWords",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"word",
".",
"endsWith",
"(",
"\".\"",
")",
"&&",
"!",
"wordsToBeIgnore... | Returns true iff the word should be ignored by the spell checker.
If possible, use {@link #ignoreToken(AnalyzedTokenReadings[], int)} instead. | [
"Returns",
"true",
"iff",
"the",
"word",
"should",
"be",
"ignored",
"by",
"the",
"spell",
"checker",
".",
"If",
"possible",
"use",
"{"
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/SpellingCheckRule.java#L270-L278 |
pravega/pravega | common/src/main/java/io/pravega/common/concurrent/Futures.java | Futures.futureWithTimeout | public static <T> CompletableFuture<T> futureWithTimeout(Duration timeout, ScheduledExecutorService executorService) {
return futureWithTimeout(timeout, null, executorService);
} | java | public static <T> CompletableFuture<T> futureWithTimeout(Duration timeout, ScheduledExecutorService executorService) {
return futureWithTimeout(timeout, null, executorService);
} | [
"public",
"static",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"futureWithTimeout",
"(",
"Duration",
"timeout",
",",
"ScheduledExecutorService",
"executorService",
")",
"{",
"return",
"futureWithTimeout",
"(",
"timeout",
",",
"null",
",",
"executorService",
... | Creates a new CompletableFuture that will timeout after the given amount of time.
@param timeout The timeout for the future.
@param executorService An ExecutorService that will be used to invoke the timeout on.
@param <T> The Type argument for the CompletableFuture to create.
@return A CompletableFuture with a timeout. | [
"Creates",
"a",
"new",
"CompletableFuture",
"that",
"will",
"timeout",
"after",
"the",
"given",
"amount",
"of",
"time",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Futures.java#L470-L472 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.getDisplayName | public final static String getDisplayName(String ID) {
return getDisplayName(ID, ULocale.getDefault(Category.DISPLAY));
} | java | public final static String getDisplayName(String ID) {
return getDisplayName(ID, ULocale.getDefault(Category.DISPLAY));
} | [
"public",
"final",
"static",
"String",
"getDisplayName",
"(",
"String",
"ID",
")",
"{",
"return",
"getDisplayName",
"(",
"ID",
",",
"ULocale",
".",
"getDefault",
"(",
"Category",
".",
"DISPLAY",
")",
")",
";",
"}"
] | Returns a name for this transliterator that is appropriate for
display to the user in the default <code>DISPLAY</code> locale. See {@link
#getDisplayName(String,Locale)} for details.
@see android.icu.util.ULocale.Category#DISPLAY | [
"Returns",
"a",
"name",
"for",
"this",
"transliterator",
"that",
"is",
"appropriate",
"for",
"display",
"to",
"the",
"user",
"in",
"the",
"default",
"<code",
">",
"DISPLAY<",
"/",
"code",
">",
"locale",
".",
"See",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1151-L1153 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPDefinitionOptionRelUtil.java | CPDefinitionOptionRelUtil.findByUUID_G | public static CPDefinitionOptionRel findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.product.exception.NoSuchCPDefinitionOptionRelException {
return getPersistence().findByUUID_G(uuid, groupId);
} | java | public static CPDefinitionOptionRel findByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.product.exception.NoSuchCPDefinitionOptionRelException {
return getPersistence().findByUUID_G(uuid, groupId);
} | [
"public",
"static",
"CPDefinitionOptionRel",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"com",
".",
"liferay",
".",
"commerce",
".",
"product",
".",
"exception",
".",
"NoSuchCPDefinitionOptionRelException",
"{",
"return",
"getPersi... | Returns the cp definition option rel where uuid = ? and groupId = ? or throws a {@link NoSuchCPDefinitionOptionRelException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching cp definition option rel
@throws NoSuchCPDefinitionOptionRelException if a matching cp definition option rel could not be found | [
"Returns",
"the",
"cp",
"definition",
"option",
"rel",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPDefinitionOptionRelException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPDefinitionOptionRelUtil.java#L283-L286 |
mojohaus/jaxb2-maven-plugin | src/main/java/org/codehaus/mojo/jaxb2/shared/version/DependsFileParser.java | DependsFileParser.getVersionMap | public static SortedMap<String, String> getVersionMap(final URL anURL) {
// Check sanity
Validate.notNull(anURL, "anURL");
final SortedMap<String, String> toReturn = new TreeMap<String, String>();
try {
final BufferedReader in = new BufferedReader(new InputStreamReader(anURL.openStream()));
String aLine = null;
while ((aLine = in.readLine()) != null) {
final String trimmedLine = aLine.trim();
if (trimmedLine.contains(GENERATION_PREFIX)) {
toReturn.put(BUILDTIME_KEY, aLine.substring(GENERATION_PREFIX.length()));
} else if ("".equals(trimmedLine) || trimmedLine.startsWith("#")) {
// Empty lines and comments should be ignored.
continue;
} else if (trimmedLine.contains("=")) {
// Stash this for later use.
StringTokenizer tok = new StringTokenizer(trimmedLine, KEY_VALUE_SEPARATOR, false);
Validate.isTrue(tok.countTokens() == 2, "Found incorrect dependency.properties line ["
+ aLine + "]");
final String key = tok.nextToken().trim();
final String value = tok.nextToken().trim();
toReturn.put(key, value);
}
}
} catch (IOException e) {
throw new IllegalStateException("Could not parse dependency properties '" + anURL.toString() + "'", e);
}
// All done.
return toReturn;
} | java | public static SortedMap<String, String> getVersionMap(final URL anURL) {
// Check sanity
Validate.notNull(anURL, "anURL");
final SortedMap<String, String> toReturn = new TreeMap<String, String>();
try {
final BufferedReader in = new BufferedReader(new InputStreamReader(anURL.openStream()));
String aLine = null;
while ((aLine = in.readLine()) != null) {
final String trimmedLine = aLine.trim();
if (trimmedLine.contains(GENERATION_PREFIX)) {
toReturn.put(BUILDTIME_KEY, aLine.substring(GENERATION_PREFIX.length()));
} else if ("".equals(trimmedLine) || trimmedLine.startsWith("#")) {
// Empty lines and comments should be ignored.
continue;
} else if (trimmedLine.contains("=")) {
// Stash this for later use.
StringTokenizer tok = new StringTokenizer(trimmedLine, KEY_VALUE_SEPARATOR, false);
Validate.isTrue(tok.countTokens() == 2, "Found incorrect dependency.properties line ["
+ aLine + "]");
final String key = tok.nextToken().trim();
final String value = tok.nextToken().trim();
toReturn.put(key, value);
}
}
} catch (IOException e) {
throw new IllegalStateException("Could not parse dependency properties '" + anURL.toString() + "'", e);
}
// All done.
return toReturn;
} | [
"public",
"static",
"SortedMap",
"<",
"String",
",",
"String",
">",
"getVersionMap",
"(",
"final",
"URL",
"anURL",
")",
"{",
"// Check sanity",
"Validate",
".",
"notNull",
"(",
"anURL",
",",
"\"anURL\"",
")",
";",
"final",
"SortedMap",
"<",
"String",
",",
... | Extracts all build-time dependency information from a dependencies.properties file
embedded in this plugin's JAR.
@param anURL The non-empty URL to a dependencies.properties file.
@return A SortedMap holding all entries in the dependencies.properties file, plus its build
time which is found under the {@code buildtime} key.
@throws java.lang.IllegalStateException if no artifact in the current Thread's context ClassLoader
contained the supplied artifactNamePart. | [
"Extracts",
"all",
"build",
"-",
"time",
"dependency",
"information",
"from",
"a",
"dependencies",
".",
"properties",
"file",
"embedded",
"in",
"this",
"plugin",
"s",
"JAR",
"."
] | train | https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/version/DependsFileParser.java#L147-L186 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/NetworkConfig.java | NetworkConfig.setPort | public NetworkConfig setPort(int port) {
if (port < 0 || port > PORT_MAX) {
throw new IllegalArgumentException("Port out of range: " + port + ". Allowed range [0,65535]");
}
this.port = port;
return this;
} | java | public NetworkConfig setPort(int port) {
if (port < 0 || port > PORT_MAX) {
throw new IllegalArgumentException("Port out of range: " + port + ". Allowed range [0,65535]");
}
this.port = port;
return this;
} | [
"public",
"NetworkConfig",
"setPort",
"(",
"int",
"port",
")",
"{",
"if",
"(",
"port",
"<",
"0",
"||",
"port",
">",
"PORT_MAX",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Port out of range: \"",
"+",
"port",
"+",
"\". Allowed range [0,65535]\"... | Sets the port the Hazelcast member will try to bind on.
A valid port value is between 0 and 65535.
A port number of 0 will let the system pick up an ephemeral port.
@param port the port the Hazelcast member will try to bind on
@return NetworkConfig the updated NetworkConfig
@see #getPort()
@see #setPortAutoIncrement(boolean) for more information | [
"Sets",
"the",
"port",
"the",
"Hazelcast",
"member",
"will",
"try",
"to",
"bind",
"on",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/NetworkConfig.java#L99-L105 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/Tesseract1.java | Tesseract1.doOCR | @Override
public String doOCR(File inputFile, Rectangle rect) throws TesseractException {
try {
File imageFile = ImageIOHelper.getImageFile(inputFile);
String imageFileFormat = ImageIOHelper.getImageFileFormat(imageFile);
Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName(imageFileFormat);
if (!readers.hasNext()) {
throw new RuntimeException(ImageIOHelper.JAI_IMAGE_READER_MESSAGE);
}
ImageReader reader = readers.next();
StringBuilder result = new StringBuilder();
try (ImageInputStream iis = ImageIO.createImageInputStream(imageFile);) {
reader.setInput(iis);
int imageTotal = reader.getNumImages(true);
init();
setTessVariables();
for (int i = 0; i < imageTotal; i++) {
IIOImage oimage = reader.readAll(i, reader.getDefaultReadParam());
result.append(doOCR(oimage, inputFile.getPath(), rect, i + 1));
}
if (renderedFormat == RenderedFormat.HOCR) {
result.insert(0, htmlBeginTag).append(htmlEndTag);
}
} finally {
// delete temporary TIFF image for PDF
if (imageFile != null && imageFile.exists() && imageFile != inputFile && imageFile.getName().startsWith("multipage") && imageFile.getName().endsWith(ImageIOHelper.TIFF_EXT)) {
imageFile.delete();
}
reader.dispose();
dispose();
}
return result.toString();
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new TesseractException(e);
}
} | java | @Override
public String doOCR(File inputFile, Rectangle rect) throws TesseractException {
try {
File imageFile = ImageIOHelper.getImageFile(inputFile);
String imageFileFormat = ImageIOHelper.getImageFileFormat(imageFile);
Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName(imageFileFormat);
if (!readers.hasNext()) {
throw new RuntimeException(ImageIOHelper.JAI_IMAGE_READER_MESSAGE);
}
ImageReader reader = readers.next();
StringBuilder result = new StringBuilder();
try (ImageInputStream iis = ImageIO.createImageInputStream(imageFile);) {
reader.setInput(iis);
int imageTotal = reader.getNumImages(true);
init();
setTessVariables();
for (int i = 0; i < imageTotal; i++) {
IIOImage oimage = reader.readAll(i, reader.getDefaultReadParam());
result.append(doOCR(oimage, inputFile.getPath(), rect, i + 1));
}
if (renderedFormat == RenderedFormat.HOCR) {
result.insert(0, htmlBeginTag).append(htmlEndTag);
}
} finally {
// delete temporary TIFF image for PDF
if (imageFile != null && imageFile.exists() && imageFile != inputFile && imageFile.getName().startsWith("multipage") && imageFile.getName().endsWith(ImageIOHelper.TIFF_EXT)) {
imageFile.delete();
}
reader.dispose();
dispose();
}
return result.toString();
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new TesseractException(e);
}
} | [
"@",
"Override",
"public",
"String",
"doOCR",
"(",
"File",
"inputFile",
",",
"Rectangle",
"rect",
")",
"throws",
"TesseractException",
"{",
"try",
"{",
"File",
"imageFile",
"=",
"ImageIOHelper",
".",
"getImageFile",
"(",
"inputFile",
")",
";",
"String",
"image... | Performs OCR operation.
@param inputFile an image file
@param rect the bounding rectangle defines the region of the image to be
recognized. A rectangle of zero dimension or <code>null</code> indicates
the whole image.
@return the recognized text
@throws TesseractException | [
"Performs",
"OCR",
"operation",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/Tesseract1.java#L189-L229 |
elki-project/elki | elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/APRIORI.java | APRIORI.initializeSearchItemset | private boolean initializeSearchItemset(BitVector bv, int[] scratchi, int[] iters) {
for(int i = 0; i < scratchi.length; i++) {
iters[i] = (i == 0) ? bv.iter() : bv.iterAdvance(iters[i - 1]);
if(iters[i] < 0) {
return false;
}
scratchi[i] = bv.iterDim(iters[i]);
}
return true;
} | java | private boolean initializeSearchItemset(BitVector bv, int[] scratchi, int[] iters) {
for(int i = 0; i < scratchi.length; i++) {
iters[i] = (i == 0) ? bv.iter() : bv.iterAdvance(iters[i - 1]);
if(iters[i] < 0) {
return false;
}
scratchi[i] = bv.iterDim(iters[i]);
}
return true;
} | [
"private",
"boolean",
"initializeSearchItemset",
"(",
"BitVector",
"bv",
",",
"int",
"[",
"]",
"scratchi",
",",
"int",
"[",
"]",
"iters",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"scratchi",
".",
"length",
";",
"i",
"++",
")",
"{"... | Initialize the scratch itemset.
@param bv Bit vector data source
@param scratchi Scratch itemset
@param iters Iterator array
@return {@code true} if the itemset had minimum length | [
"Initialize",
"the",
"scratch",
"itemset",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/APRIORI.java#L500-L509 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java | NotificationsApi.subscribeWithHttpInfo | public ApiResponse<Void> subscribeWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = subscribeValidateBeforeCall(null, null);
return apiClient.execute(call);
} | java | public ApiResponse<Void> subscribeWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = subscribeValidateBeforeCall(null, null);
return apiClient.execute(call);
} | [
"public",
"ApiResponse",
"<",
"Void",
">",
"subscribeWithHttpInfo",
"(",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"subscribeValidateBeforeCall",
"(",
"null",
",",
"null",
")",
";",
"return",
"apiClien... | CometD subscribe to channel
CometD handshake, see https://docs.cometd.org/current/reference/#_bayeux_meta_subscribe Current channels: <b>/statistics/v3/service</b> - information about service state <b>/statistics/v3/updates</b> - statistics updates
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"CometD",
"subscribe",
"to",
"channel",
"CometD",
"handshake",
"see",
"https",
":",
"//",
"docs",
".",
"cometd",
".",
"org",
"/",
"current",
"/",
"reference",
"/",
"#_bayeux_meta_subscribe",
"Current",
"channels",
":",
"<",
";",
"b>",
";",
"/",
"statisti... | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java#L673-L676 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java | Group.foundGroupFormat | boolean foundGroupFormat(Map<String,?> map, String pkgFormat) {
if (map.containsKey(pkgFormat)) {
configuration.message.error("doclet.Same_package_name_used", pkgFormat);
return true;
}
return false;
} | java | boolean foundGroupFormat(Map<String,?> map, String pkgFormat) {
if (map.containsKey(pkgFormat)) {
configuration.message.error("doclet.Same_package_name_used", pkgFormat);
return true;
}
return false;
} | [
"boolean",
"foundGroupFormat",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"map",
",",
"String",
"pkgFormat",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"pkgFormat",
")",
")",
"{",
"configuration",
".",
"message",
".",
"error",
"(",
"\"doclet.Sam... | Search if the given map has given the package format.
@param map Map to be searched.
@param pkgFormat The pacakge format to search.
@return true if package name format found in the map, else false. | [
"Search",
"if",
"the",
"given",
"map",
"has",
"given",
"the",
"package",
"format",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java#L157-L163 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java | AbstractXbaseSemanticSequencer.sequence_XForLoopExpression | protected void sequence_XForLoopExpression(ISerializationContext context, XForLoopExpression semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__DECLARED_PARAM) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__DECLARED_PARAM));
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__FOR_EXPRESSION) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__FOR_EXPRESSION));
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__EACH_EXPRESSION) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__EACH_EXPRESSION));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getXForLoopExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_0_0_3_0(), semanticObject.getDeclaredParam());
feeder.accept(grammarAccess.getXForLoopExpressionAccess().getForExpressionXExpressionParserRuleCall_1_0(), semanticObject.getForExpression());
feeder.accept(grammarAccess.getXForLoopExpressionAccess().getEachExpressionXExpressionParserRuleCall_3_0(), semanticObject.getEachExpression());
feeder.finish();
} | java | protected void sequence_XForLoopExpression(ISerializationContext context, XForLoopExpression semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__DECLARED_PARAM) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__DECLARED_PARAM));
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__FOR_EXPRESSION) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__FOR_EXPRESSION));
if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__EACH_EXPRESSION) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XFOR_LOOP_EXPRESSION__EACH_EXPRESSION));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getXForLoopExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_0_0_3_0(), semanticObject.getDeclaredParam());
feeder.accept(grammarAccess.getXForLoopExpressionAccess().getForExpressionXExpressionParserRuleCall_1_0(), semanticObject.getForExpression());
feeder.accept(grammarAccess.getXForLoopExpressionAccess().getEachExpressionXExpressionParserRuleCall_3_0(), semanticObject.getEachExpression());
feeder.finish();
} | [
"protected",
"void",
"sequence_XForLoopExpression",
"(",
"ISerializationContext",
"context",
",",
"XForLoopExpression",
"semanticObject",
")",
"{",
"if",
"(",
"errorAcceptor",
"!=",
"null",
")",
"{",
"if",
"(",
"transientValues",
".",
"isValueTransient",
"(",
"semanti... | Contexts:
XExpression returns XForLoopExpression
XAssignment returns XForLoopExpression
XAssignment.XBinaryOperation_1_1_0_0_0 returns XForLoopExpression
XOrExpression returns XForLoopExpression
XOrExpression.XBinaryOperation_1_0_0_0 returns XForLoopExpression
XAndExpression returns XForLoopExpression
XAndExpression.XBinaryOperation_1_0_0_0 returns XForLoopExpression
XEqualityExpression returns XForLoopExpression
XEqualityExpression.XBinaryOperation_1_0_0_0 returns XForLoopExpression
XRelationalExpression returns XForLoopExpression
XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XForLoopExpression
XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XForLoopExpression
XOtherOperatorExpression returns XForLoopExpression
XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XForLoopExpression
XAdditiveExpression returns XForLoopExpression
XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XForLoopExpression
XMultiplicativeExpression returns XForLoopExpression
XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XForLoopExpression
XUnaryOperation returns XForLoopExpression
XCastedExpression returns XForLoopExpression
XCastedExpression.XCastedExpression_1_0_0_0 returns XForLoopExpression
XPostfixOperation returns XForLoopExpression
XPostfixOperation.XPostfixOperation_1_0_0 returns XForLoopExpression
XMemberFeatureCall returns XForLoopExpression
XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XForLoopExpression
XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XForLoopExpression
XPrimaryExpression returns XForLoopExpression
XParenthesizedExpression returns XForLoopExpression
XForLoopExpression returns XForLoopExpression
XExpressionOrVarDeclaration returns XForLoopExpression
Constraint:
(declaredParam=JvmFormalParameter forExpression=XExpression eachExpression=XExpression) | [
"Contexts",
":",
"XExpression",
"returns",
"XForLoopExpression",
"XAssignment",
"returns",
"XForLoopExpression",
"XAssignment",
".",
"XBinaryOperation_1_1_0_0_0",
"returns",
"XForLoopExpression",
"XOrExpression",
"returns",
"XForLoopExpression",
"XOrExpression",
".",
"XBinaryOper... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java#L953-L967 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/sas/SasUtils.java | SasUtils.createReader | public static BufferedReader createReader(File file) throws IOException {
InputStream is = new FileInputStream(file);
if (file.getName().toLowerCase().endsWith(".gz"))
is = new GZIPInputStream(is);
return new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
} | java | public static BufferedReader createReader(File file) throws IOException {
InputStream is = new FileInputStream(file);
if (file.getName().toLowerCase().endsWith(".gz"))
is = new GZIPInputStream(is);
return new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
} | [
"public",
"static",
"BufferedReader",
"createReader",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"if",
"(",
"file",
".",
"getName",
"(",
")",
".",
"toLowerCase",
"(",
"... | Creates a reader from the given file. Support GZIP compressed files.
@param file file to read
@return reader | [
"Creates",
"a",
"reader",
"from",
"the",
"given",
"file",
".",
"Support",
"GZIP",
"compressed",
"files",
"."
] | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/sas/SasUtils.java#L38-L43 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/MultiPolygon.java | MultiPolygon.fromPolygons | public static MultiPolygon fromPolygons(@NonNull List<Polygon> polygons) {
List<List<List<Point>>> coordinates = new ArrayList<>(polygons.size());
for (Polygon polygon : polygons) {
coordinates.add(polygon.coordinates());
}
return new MultiPolygon(TYPE, null, coordinates);
} | java | public static MultiPolygon fromPolygons(@NonNull List<Polygon> polygons) {
List<List<List<Point>>> coordinates = new ArrayList<>(polygons.size());
for (Polygon polygon : polygons) {
coordinates.add(polygon.coordinates());
}
return new MultiPolygon(TYPE, null, coordinates);
} | [
"public",
"static",
"MultiPolygon",
"fromPolygons",
"(",
"@",
"NonNull",
"List",
"<",
"Polygon",
">",
"polygons",
")",
"{",
"List",
"<",
"List",
"<",
"List",
"<",
"Point",
">>>",
"coordinates",
"=",
"new",
"ArrayList",
"<>",
"(",
"polygons",
".",
"size",
... | Create a new instance of this class by defining a list of {@link Polygon} objects and passing
that list in as a parameter in this method. The Polygons should comply with the GeoJson
specifications described in the documentation.
@param polygons a list of Polygons which make up this MultiPolygon
@return a new instance of this class defined by the values passed inside this static factory
method
@since 3.0.0 | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"defining",
"a",
"list",
"of",
"{",
"@link",
"Polygon",
"}",
"objects",
"and",
"passing",
"that",
"list",
"in",
"as",
"a",
"parameter",
"in",
"this",
"method",
".",
"The",
"Polygons",
"should... | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/MultiPolygon.java#L109-L115 |
UrielCh/ovh-java-sdk | ovh-java-sdk-service/src/main/java/net/minidev/ovh/api/ApiOvhService.java | ApiOvhService.serviceId_renew_POST | public OvhRenewOrder serviceId_renew_POST(String serviceId, Boolean dryRun, String duration, Long[] services) throws IOException {
String qPath = "/service/{serviceId}/renew";
StringBuilder sb = path(qPath, serviceId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dryRun", dryRun);
addBody(o, "duration", duration);
addBody(o, "services", services);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRenewOrder.class);
} | java | public OvhRenewOrder serviceId_renew_POST(String serviceId, Boolean dryRun, String duration, Long[] services) throws IOException {
String qPath = "/service/{serviceId}/renew";
StringBuilder sb = path(qPath, serviceId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dryRun", dryRun);
addBody(o, "duration", duration);
addBody(o, "services", services);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRenewOrder.class);
} | [
"public",
"OvhRenewOrder",
"serviceId_renew_POST",
"(",
"String",
"serviceId",
",",
"Boolean",
"dryRun",
",",
"String",
"duration",
",",
"Long",
"[",
"]",
"services",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/service/{serviceId}/renew\"",
";",
... | Create a renew order
REST: POST /service/{serviceId}/renew
@param serviceId [required] Service Id
@param dryRun [required] Indicates if renew order is generated
@param duration [required] Renew duration
@param services [required] List of services to renew
API beta | [
"Create",
"a",
"renew",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-service/src/main/java/net/minidev/ovh/api/ApiOvhService.java#L111-L120 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java | ServerAdvisorsInner.createOrUpdateAsync | public Observable<AdvisorInner> createOrUpdateAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteValue) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteValue).map(new Func1<ServiceResponse<AdvisorInner>, AdvisorInner>() {
@Override
public AdvisorInner call(ServiceResponse<AdvisorInner> response) {
return response.body();
}
});
} | java | public Observable<AdvisorInner> createOrUpdateAsync(String resourceGroupName, String serverName, String advisorName, AutoExecuteStatus autoExecuteValue) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, advisorName, autoExecuteValue).map(new Func1<ServiceResponse<AdvisorInner>, AdvisorInner>() {
@Override
public AdvisorInner call(ServiceResponse<AdvisorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AdvisorInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"advisorName",
",",
"AutoExecuteStatus",
"autoExecuteValue",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync"... | Creates or updates a server advisor.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param advisorName The name of the Server Advisor.
@param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default'
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AdvisorInner object | [
"Creates",
"or",
"updates",
"a",
"server",
"advisor",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java#L398-L405 |
kuujo/vertigo | util/src/main/java/net/kuujo/vertigo/io/FileSender.java | FileSender.sendFile | public FileSender sendFile(String filePath, final Handler<AsyncResult<Void>> doneHandler) {
final File file = new File(filePath);
output.vertx().fileSystem().exists(file.getAbsolutePath(), new Handler<AsyncResult<Boolean>>() {
@Override
public void handle(AsyncResult<Boolean> result) {
if (result.failed()) {
new DefaultFutureResult<Void>(result.cause()).setHandler(doneHandler);
} else if (!result.result()) {
new DefaultFutureResult<Void>(new IOException("File not found.")).setHandler(doneHandler);
} else {
output.group("file", file.getName(), new Handler<OutputGroup>() {
@Override
public void handle(final OutputGroup group) {
output.vertx().fileSystem().open(file.getAbsolutePath(), new Handler<AsyncResult<AsyncFile>>() {
@Override
public void handle(AsyncResult<AsyncFile> result) {
if (result.failed()) {
new DefaultFutureResult<Void>(result.cause()).setHandler(doneHandler);
} else {
doSendFile(result.result(), group, doneHandler);
}
}
});
}
});
}
}
});
return this;
} | java | public FileSender sendFile(String filePath, final Handler<AsyncResult<Void>> doneHandler) {
final File file = new File(filePath);
output.vertx().fileSystem().exists(file.getAbsolutePath(), new Handler<AsyncResult<Boolean>>() {
@Override
public void handle(AsyncResult<Boolean> result) {
if (result.failed()) {
new DefaultFutureResult<Void>(result.cause()).setHandler(doneHandler);
} else if (!result.result()) {
new DefaultFutureResult<Void>(new IOException("File not found.")).setHandler(doneHandler);
} else {
output.group("file", file.getName(), new Handler<OutputGroup>() {
@Override
public void handle(final OutputGroup group) {
output.vertx().fileSystem().open(file.getAbsolutePath(), new Handler<AsyncResult<AsyncFile>>() {
@Override
public void handle(AsyncResult<AsyncFile> result) {
if (result.failed()) {
new DefaultFutureResult<Void>(result.cause()).setHandler(doneHandler);
} else {
doSendFile(result.result(), group, doneHandler);
}
}
});
}
});
}
}
});
return this;
} | [
"public",
"FileSender",
"sendFile",
"(",
"String",
"filePath",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"Void",
">",
">",
"doneHandler",
")",
"{",
"final",
"File",
"file",
"=",
"new",
"File",
"(",
"filePath",
")",
";",
"output",
".",
"vertx",
"(... | Sends a file on the output port.
@param filePath The path to the file to send.
@param doneHandler An asynchronous handler to be called once the file has been sent.
@return The file sender. | [
"Sends",
"a",
"file",
"on",
"the",
"output",
"port",
"."
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/util/src/main/java/net/kuujo/vertigo/io/FileSender.java#L92-L121 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java | ContextRuleAssistant.putSetting | public void putSetting(String name, String value) throws IllegalRuleException {
if (StringUtils.isEmpty(name)) {
throw new IllegalRuleException("Default setting name can not be null");
}
DefaultSettingType settingType = DefaultSettingType.resolve(name);
if (settingType == null) {
throw new IllegalRuleException("No such default setting name as '" + name + "'");
}
settings.put(settingType, value);
} | java | public void putSetting(String name, String value) throws IllegalRuleException {
if (StringUtils.isEmpty(name)) {
throw new IllegalRuleException("Default setting name can not be null");
}
DefaultSettingType settingType = DefaultSettingType.resolve(name);
if (settingType == null) {
throw new IllegalRuleException("No such default setting name as '" + name + "'");
}
settings.put(settingType, value);
} | [
"public",
"void",
"putSetting",
"(",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"IllegalRuleException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"IllegalRuleException",
"(",
"\"Default setting name ... | Puts the setting value.
@param name the name
@param value the value
@throws IllegalRuleException if an unknown setting name is found | [
"Puts",
"the",
"setting",
"value",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/assistant/ContextRuleAssistant.java#L199-L208 |
qiniu/java-sdk | src/main/java/com/qiniu/cdn/CdnManager.java | CdnManager.refreshUrlsAndDirs | public CdnResult.RefreshResult refreshUrlsAndDirs(String[] urls, String[] dirs) throws QiniuException {
//check params
if (urls != null && urls.length > MAX_API_REFRESH_URL_COUNT) {
throw new QiniuException(new Exception("url count exceeds the max refresh limit per request"));
}
if (dirs != null && dirs.length > MAX_API_REFRESH_DIR_COUNT) {
throw new QiniuException(new Exception("dir count exceeds the max refresh limit per request"));
}
HashMap<String, String[]> req = new HashMap<>();
if (urls != null) {
req.put("urls", urls);
}
if (dirs != null) {
req.put("dirs", dirs);
}
byte[] body = Json.encode(req).getBytes(Constants.UTF_8);
String url = server + "/v2/tune/refresh";
StringMap headers = auth.authorizationV2(url, "POST", body, Client.JsonMime);
Response response = client.post(url, body, headers, Client.JsonMime);
return response.jsonToObject(CdnResult.RefreshResult.class);
} | java | public CdnResult.RefreshResult refreshUrlsAndDirs(String[] urls, String[] dirs) throws QiniuException {
//check params
if (urls != null && urls.length > MAX_API_REFRESH_URL_COUNT) {
throw new QiniuException(new Exception("url count exceeds the max refresh limit per request"));
}
if (dirs != null && dirs.length > MAX_API_REFRESH_DIR_COUNT) {
throw new QiniuException(new Exception("dir count exceeds the max refresh limit per request"));
}
HashMap<String, String[]> req = new HashMap<>();
if (urls != null) {
req.put("urls", urls);
}
if (dirs != null) {
req.put("dirs", dirs);
}
byte[] body = Json.encode(req).getBytes(Constants.UTF_8);
String url = server + "/v2/tune/refresh";
StringMap headers = auth.authorizationV2(url, "POST", body, Client.JsonMime);
Response response = client.post(url, body, headers, Client.JsonMime);
return response.jsonToObject(CdnResult.RefreshResult.class);
} | [
"public",
"CdnResult",
".",
"RefreshResult",
"refreshUrlsAndDirs",
"(",
"String",
"[",
"]",
"urls",
",",
"String",
"[",
"]",
"dirs",
")",
"throws",
"QiniuException",
"{",
"//check params",
"if",
"(",
"urls",
"!=",
"null",
"&&",
"urls",
".",
"length",
">",
... | 刷新文件外链和目录,外链每次不超过100个,目录每次不超过10个
刷新目录需要额外开通权限,可以联系七牛技术支持处理
参考文档:<a href="http://developer.qiniu.com/fusion/api/cache-refresh">缓存刷新</a>
@param urls 待刷新文件外链列表
@param dirs 待刷新目录列表
@return 刷新请求的回复 | [
"刷新文件外链和目录,外链每次不超过100个,目录每次不超过10个",
"刷新目录需要额外开通权限,可以联系七牛技术支持处理",
"参考文档:<a",
"href",
"=",
"http",
":",
"//",
"developer",
".",
"qiniu",
".",
"com",
"/",
"fusion",
"/",
"api",
"/",
"cache",
"-",
"refresh",
">",
"缓存刷新<",
"/",
"a",
">"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/cdn/CdnManager.java#L94-L115 |
twitter/scalding | scalding-parquet-scrooge/src/main/java/com/twitter/scalding/parquet/scrooge/ScroogeReadSupport.java | ScroogeReadSupport.prepareForRead | @Override
public RecordMaterializer<T> prepareForRead(Configuration configuration,
Map<String, String> keyValueMetaData, MessageType fileSchema,
ReadSupport.ReadContext readContext) {
ThriftMetaData thriftMetaData = ThriftMetaData.fromExtraMetaData(keyValueMetaData);
try {
if (thriftClass == null) {
thriftClass = getThriftClass(keyValueMetaData, configuration);
}
ThriftType.StructType descriptor = null;
if (thriftMetaData != null) {
descriptor = thriftMetaData.getDescriptor();
} else {
ScroogeStructConverter schemaConverter = new ScroogeStructConverter();
descriptor = schemaConverter.convert(thriftClass);
}
ThriftRecordConverter<T> converter = new ScroogeRecordConverter<T>(
thriftClass,
readContext.getRequestedSchema(),
descriptor);
return converter;
} catch (Exception t) {
throw new RuntimeException("Unable to create Thrift Converter for Thrift metadata " + thriftMetaData, t);
}
} | java | @Override
public RecordMaterializer<T> prepareForRead(Configuration configuration,
Map<String, String> keyValueMetaData, MessageType fileSchema,
ReadSupport.ReadContext readContext) {
ThriftMetaData thriftMetaData = ThriftMetaData.fromExtraMetaData(keyValueMetaData);
try {
if (thriftClass == null) {
thriftClass = getThriftClass(keyValueMetaData, configuration);
}
ThriftType.StructType descriptor = null;
if (thriftMetaData != null) {
descriptor = thriftMetaData.getDescriptor();
} else {
ScroogeStructConverter schemaConverter = new ScroogeStructConverter();
descriptor = schemaConverter.convert(thriftClass);
}
ThriftRecordConverter<T> converter = new ScroogeRecordConverter<T>(
thriftClass,
readContext.getRequestedSchema(),
descriptor);
return converter;
} catch (Exception t) {
throw new RuntimeException("Unable to create Thrift Converter for Thrift metadata " + thriftMetaData, t);
}
} | [
"@",
"Override",
"public",
"RecordMaterializer",
"<",
"T",
">",
"prepareForRead",
"(",
"Configuration",
"configuration",
",",
"Map",
"<",
"String",
",",
"String",
">",
"keyValueMetaData",
",",
"MessageType",
"fileSchema",
",",
"ReadSupport",
".",
"ReadContext",
"r... | Overriding to fall back to get descriptor from the {@link #thriftClass} if thrift metadata is
not present
@return | [
"Overriding",
"to",
"fall",
"back",
"to",
"get",
"descriptor",
"from",
"the",
"{",
"@link",
"#thriftClass",
"}",
"if",
"thrift",
"metadata",
"is",
"not",
"present"
] | train | https://github.com/twitter/scalding/blob/428b5507279655676e507d52c669c3cbc7812dc0/scalding-parquet-scrooge/src/main/java/com/twitter/scalding/parquet/scrooge/ScroogeReadSupport.java#L196-L222 |
apereo/cas | core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/BaseTicketCatalogConfigurer.java | BaseTicketCatalogConfigurer.buildTicketDefinition | protected TicketDefinition buildTicketDefinition(final TicketCatalog plan, final String prefix, final Class impl) {
if (plan.contains(prefix)) {
return plan.find(prefix);
}
return new DefaultTicketDefinition(impl, prefix, Ordered.LOWEST_PRECEDENCE);
} | java | protected TicketDefinition buildTicketDefinition(final TicketCatalog plan, final String prefix, final Class impl) {
if (plan.contains(prefix)) {
return plan.find(prefix);
}
return new DefaultTicketDefinition(impl, prefix, Ordered.LOWEST_PRECEDENCE);
} | [
"protected",
"TicketDefinition",
"buildTicketDefinition",
"(",
"final",
"TicketCatalog",
"plan",
",",
"final",
"String",
"prefix",
",",
"final",
"Class",
"impl",
")",
"{",
"if",
"(",
"plan",
".",
"contains",
"(",
"prefix",
")",
")",
"{",
"return",
"plan",
".... | Build ticket definition ticket.
@param plan the plan
@param prefix the prefix
@param impl the
@return the ticket definition | [
"Build",
"ticket",
"definition",
"ticket",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/BaseTicketCatalogConfigurer.java#L36-L41 |
Jasig/uPortal | uPortal-groups/uPortal-groups-pags/src/main/java/org/apereo/portal/groups/pags/dao/PagsService.java | PagsService.getPagsDefinitionByName | public IPersonAttributesGroupDefinition getPagsDefinitionByName(IPerson person, String name) {
IPersonAttributesGroupDefinition rslt = getPagsGroupDefByName(name);
if (rslt == null) {
// Better to produce exception? I'm thinking not, but open-minded.
return null;
}
if (!hasPermission(
person,
IPermission.VIEW_GROUP_ACTIVITY,
rslt.getCompositeEntityIdentifierForGroup().getKey())) {
throw new RuntimeAuthorizationException(person, IPermission.VIEW_GROUP_ACTIVITY, name);
}
logger.debug("Returning PAGS definition '{}' for user '{}'", rslt, person.getUserName());
return rslt;
} | java | public IPersonAttributesGroupDefinition getPagsDefinitionByName(IPerson person, String name) {
IPersonAttributesGroupDefinition rslt = getPagsGroupDefByName(name);
if (rslt == null) {
// Better to produce exception? I'm thinking not, but open-minded.
return null;
}
if (!hasPermission(
person,
IPermission.VIEW_GROUP_ACTIVITY,
rslt.getCompositeEntityIdentifierForGroup().getKey())) {
throw new RuntimeAuthorizationException(person, IPermission.VIEW_GROUP_ACTIVITY, name);
}
logger.debug("Returning PAGS definition '{}' for user '{}'", rslt, person.getUserName());
return rslt;
} | [
"public",
"IPersonAttributesGroupDefinition",
"getPagsDefinitionByName",
"(",
"IPerson",
"person",
",",
"String",
"name",
")",
"{",
"IPersonAttributesGroupDefinition",
"rslt",
"=",
"getPagsGroupDefByName",
"(",
"name",
")",
";",
"if",
"(",
"rslt",
"==",
"null",
")",
... | Returns the specified definitions, provided (1) it exists and (2) the user may view it.
@param person
@return | [
"Returns",
"the",
"specified",
"definitions",
"provided",
"(",
"1",
")",
"it",
"exists",
"and",
"(",
"2",
")",
"the",
"user",
"may",
"view",
"it",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-pags/src/main/java/org/apereo/portal/groups/pags/dao/PagsService.java#L88-L102 |
a-schild/jave2 | jave-core/src/main/java/ws/schild/jave/ScreenExtractor.java | ScreenExtractor.render | public void render(MultimediaObject multimediaObject, int width, int height, int seconds, File target, int quality)
throws EncoderException {
File inputFile = multimediaObject.getFile();
target = target.getAbsoluteFile();
target.getParentFile().mkdirs();
try
{
if (!inputFile.canRead())
{
LOG.debug("Failed to open input file");
throw new SecurityException();
}
} catch (SecurityException e)
{
LOG.debug("Access denied checking destination folder" + e);
}
MultimediaInfo multimediaInfo = multimediaObject.getInfo();
int duration = (int) (multimediaInfo.getDuration() * .001);
numberOfScreens = seconds <= duration ? 1 : 0;
FFMPEGExecutor ffmpeg = this.locator.createExecutor();
ffmpeg.addArgument("-i");
ffmpeg.addArgument(inputFile.getAbsolutePath());
ffmpeg.addArgument("-f");
ffmpeg.addArgument("image2");
ffmpeg.addArgument("-vframes");
ffmpeg.addArgument("1");
ffmpeg.addArgument("-ss");
ffmpeg.addArgument(String.valueOf(seconds));
ffmpeg.addArgument("-s");
ffmpeg.addArgument(String.format("%sx%s", String.valueOf(width), String.valueOf(height)));
ffmpeg.addArgument("-qscale");
ffmpeg.addArgument(String.valueOf(quality));
ffmpeg.addArgument(target.getAbsolutePath());
try
{
ffmpeg.execute();
} catch (IOException e)
{
throw new EncoderException(e);
}
try
{
RBufferedReader reader = new RBufferedReader(
new InputStreamReader(ffmpeg.getErrorStream()));
int step = 0;
int lineNR = 0;
String line;
while ((line = reader.readLine()) != null)
{
lineNR++;
LOG.debug("Input Line (" + lineNR + "): " + line);
// TODO: Implement additional input stream parsing
}
} catch (IOException e)
{
throw new EncoderException(e);
} finally
{
ffmpeg.destroy();
}
} | java | public void render(MultimediaObject multimediaObject, int width, int height, int seconds, File target, int quality)
throws EncoderException {
File inputFile = multimediaObject.getFile();
target = target.getAbsoluteFile();
target.getParentFile().mkdirs();
try
{
if (!inputFile.canRead())
{
LOG.debug("Failed to open input file");
throw new SecurityException();
}
} catch (SecurityException e)
{
LOG.debug("Access denied checking destination folder" + e);
}
MultimediaInfo multimediaInfo = multimediaObject.getInfo();
int duration = (int) (multimediaInfo.getDuration() * .001);
numberOfScreens = seconds <= duration ? 1 : 0;
FFMPEGExecutor ffmpeg = this.locator.createExecutor();
ffmpeg.addArgument("-i");
ffmpeg.addArgument(inputFile.getAbsolutePath());
ffmpeg.addArgument("-f");
ffmpeg.addArgument("image2");
ffmpeg.addArgument("-vframes");
ffmpeg.addArgument("1");
ffmpeg.addArgument("-ss");
ffmpeg.addArgument(String.valueOf(seconds));
ffmpeg.addArgument("-s");
ffmpeg.addArgument(String.format("%sx%s", String.valueOf(width), String.valueOf(height)));
ffmpeg.addArgument("-qscale");
ffmpeg.addArgument(String.valueOf(quality));
ffmpeg.addArgument(target.getAbsolutePath());
try
{
ffmpeg.execute();
} catch (IOException e)
{
throw new EncoderException(e);
}
try
{
RBufferedReader reader = new RBufferedReader(
new InputStreamReader(ffmpeg.getErrorStream()));
int step = 0;
int lineNR = 0;
String line;
while ((line = reader.readLine()) != null)
{
lineNR++;
LOG.debug("Input Line (" + lineNR + "): " + line);
// TODO: Implement additional input stream parsing
}
} catch (IOException e)
{
throw new EncoderException(e);
} finally
{
ffmpeg.destroy();
}
} | [
"public",
"void",
"render",
"(",
"MultimediaObject",
"multimediaObject",
",",
"int",
"width",
",",
"int",
"height",
",",
"int",
"seconds",
",",
"File",
"target",
",",
"int",
"quality",
")",
"throws",
"EncoderException",
"{",
"File",
"inputFile",
"=",
"multimed... | Generate a single screenshot from source video.
@param multimediaObject Source MultimediaObject @see MultimediaObject
@param width Output width
@param height Output height
@param seconds Interval in seconds between screens
@param target Destination of output image
@param quality The range is between 1-31 with 31 being the worst quality
@throws InputFormatException If the source multimedia file cannot be
decoded.
@throws EncoderException If a problems occurs during the encoding
process. | [
"Generate",
"a",
"single",
"screenshot",
"from",
"source",
"video",
"."
] | train | https://github.com/a-schild/jave2/blob/1e7d6a1ca7c27cc63570f1aabb5c84ee124f3e26/jave-core/src/main/java/ws/schild/jave/ScreenExtractor.java#L147-L211 |
ralscha/extclassgenerator | src/main/java/ch/rasc/extclassgenerator/ModelGenerator.java | ModelGenerator.generateJavascript | public static String generateJavascript(ModelBean model, OutputFormat format,
boolean debug) {
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(format);
outputConfig.setDebug(debug);
return generateJavascript(model, outputConfig);
} | java | public static String generateJavascript(ModelBean model, OutputFormat format,
boolean debug) {
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(format);
outputConfig.setDebug(debug);
return generateJavascript(model, outputConfig);
} | [
"public",
"static",
"String",
"generateJavascript",
"(",
"ModelBean",
"model",
",",
"OutputFormat",
"format",
",",
"boolean",
"debug",
")",
"{",
"OutputConfig",
"outputConfig",
"=",
"new",
"OutputConfig",
"(",
")",
";",
"outputConfig",
".",
"setOutputFormat",
"(",... | Creates JS code based on the provided {@link ModelBean} in the specified
{@link OutputFormat}. Code can be generated in pretty or compressed format. The
generated code is cached unless debug is true. A second call to this method with
the same model name and format will return the code from the cache.
@param model generate code based on this {@link ModelBean}
@param format specifies which code (ExtJS or Touch) the generator should create
@param debug if true the generator creates the output in pretty format, false the
output is compressed
@return the generated model object (JS code) | [
"Creates",
"JS",
"code",
"based",
"on",
"the",
"provided",
"{",
"@link",
"ModelBean",
"}",
"in",
"the",
"specified",
"{",
"@link",
"OutputFormat",
"}",
".",
"Code",
"can",
"be",
"generated",
"in",
"pretty",
"or",
"compressed",
"format",
".",
"The",
"genera... | train | https://github.com/ralscha/extclassgenerator/blob/6f106cf5ca83ef004225a3512e2291dfd028cf07/src/main/java/ch/rasc/extclassgenerator/ModelGenerator.java#L279-L285 |
icode/ameba | src/main/java/ameba/i18n/Messages.java | Messages.getResourceBundle | public static ResourceBundle getResourceBundle(String bundleName, Locale locale) {
ResourceBundle bundle = null;
boolean isDev = false;
if (Ameba.getApp() != null) {
isDev = Ameba.getApp().getMode().isDev();
BUNDLE_CONTROL.noCache = isDev;
}
if (!isDev) {
bundle = RESOURCE_BUNDLES.get(bundleName, locale);
}
if (bundle == null) {
try {
bundle = ResourceBundle.getBundle(
bundleName,
locale,
ClassUtils.getContextClassLoader(),
BUNDLE_CONTROL
);
} catch (MissingResourceException e) {
// no op
}
}
if (bundle != null && !isDev) {
RESOURCE_BUNDLES.put(bundleName, locale, bundle);
}
return bundle;
} | java | public static ResourceBundle getResourceBundle(String bundleName, Locale locale) {
ResourceBundle bundle = null;
boolean isDev = false;
if (Ameba.getApp() != null) {
isDev = Ameba.getApp().getMode().isDev();
BUNDLE_CONTROL.noCache = isDev;
}
if (!isDev) {
bundle = RESOURCE_BUNDLES.get(bundleName, locale);
}
if (bundle == null) {
try {
bundle = ResourceBundle.getBundle(
bundleName,
locale,
ClassUtils.getContextClassLoader(),
BUNDLE_CONTROL
);
} catch (MissingResourceException e) {
// no op
}
}
if (bundle != null && !isDev) {
RESOURCE_BUNDLES.put(bundleName, locale, bundle);
}
return bundle;
} | [
"public",
"static",
"ResourceBundle",
"getResourceBundle",
"(",
"String",
"bundleName",
",",
"Locale",
"locale",
")",
"{",
"ResourceBundle",
"bundle",
"=",
"null",
";",
"boolean",
"isDev",
"=",
"false",
";",
"if",
"(",
"Ameba",
".",
"getApp",
"(",
")",
"!=",... | <p>getResourceBundle.</p>
@param bundleName a {@link java.lang.String} object.
@param locale a {@link java.util.Locale} object.
@return a {@link java.util.ResourceBundle} object. | [
"<p",
">",
"getResourceBundle",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/i18n/Messages.java#L102-L131 |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java | DocBookUtilities.processConditions | public static void processConditions(final String condition, final Document doc, final String defaultCondition) {
processConditions(condition, doc, defaultCondition, true);
} | java | public static void processConditions(final String condition, final Document doc, final String defaultCondition) {
processConditions(condition, doc, defaultCondition, true);
} | [
"public",
"static",
"void",
"processConditions",
"(",
"final",
"String",
"condition",
",",
"final",
"Document",
"doc",
",",
"final",
"String",
"defaultCondition",
")",
"{",
"processConditions",
"(",
"condition",
",",
"doc",
",",
"defaultCondition",
",",
"true",
... | Check the XML Document and it's children for condition
statements. If any are found then check if the condition
matches the passed condition string. If they don't match
then remove the nodes.
@param condition The condition regex to be tested against.
@param doc The Document to check for conditional statements.
@param defaultCondition The default condition to allow a default block when processing conditions. | [
"Check",
"the",
"XML",
"Document",
"and",
"it",
"s",
"children",
"for",
"condition",
"statements",
".",
"If",
"any",
"are",
"found",
"then",
"check",
"if",
"the",
"condition",
"matches",
"the",
"passed",
"condition",
"string",
".",
"If",
"they",
"don",
"t"... | train | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/DocBookUtilities.java#L3196-L3198 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/DefaultBeanContext.java | DefaultBeanContext.findConcreteCandidate | @SuppressWarnings("unchecked")
private <T> Optional<BeanDefinition<T>> findConcreteCandidate(
Class<T> beanType,
Qualifier<T> qualifier,
boolean throwNonUnique,
boolean includeProvided) {
return (Optional) beanConcreteCandidateCache.computeIfAbsent(new BeanKey(beanType, qualifier), beanKey ->
(Optional) findConcreteCandidateNoCache(beanType, qualifier, throwNonUnique, includeProvided, true)
);
} | java | @SuppressWarnings("unchecked")
private <T> Optional<BeanDefinition<T>> findConcreteCandidate(
Class<T> beanType,
Qualifier<T> qualifier,
boolean throwNonUnique,
boolean includeProvided) {
return (Optional) beanConcreteCandidateCache.computeIfAbsent(new BeanKey(beanType, qualifier), beanKey ->
(Optional) findConcreteCandidateNoCache(beanType, qualifier, throwNonUnique, includeProvided, true)
);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"Optional",
"<",
"BeanDefinition",
"<",
"T",
">",
">",
"findConcreteCandidate",
"(",
"Class",
"<",
"T",
">",
"beanType",
",",
"Qualifier",
"<",
"T",
">",
"qualifier",
",",
"boole... | Find a concrete candidate for the given qualifier.
@param beanType The bean type
@param qualifier The qualifier
@param throwNonUnique Whether to throw an exception if the bean is not found
@param includeProvided Whether to include provided resolution
@param <T> The bean generic type
@return The concrete bean definition candidate | [
"Find",
"a",
"concrete",
"candidate",
"for",
"the",
"given",
"qualifier",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L2043-L2052 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/client/ApiClient.java | ApiClient.handleResponse | public <T> T handleResponse(Response response, Type returnType) throws ApiException {
if (response.isSuccessful()) {
if (returnType == null || response.code() == 204) {
// returning null if the returnType is not defined,
// or the status code is 204 (No Content)
return null;
} else {
return deserialize(response, returnType);
}
} else {
String respBody = null;
if (response.body() != null) {
try {
respBody = response.body().string();
} catch (IOException e) {
throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
}
}
throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody);
}
} | java | public <T> T handleResponse(Response response, Type returnType) throws ApiException {
if (response.isSuccessful()) {
if (returnType == null || response.code() == 204) {
// returning null if the returnType is not defined,
// or the status code is 204 (No Content)
return null;
} else {
return deserialize(response, returnType);
}
} else {
String respBody = null;
if (response.body() != null) {
try {
respBody = response.body().string();
} catch (IOException e) {
throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
}
}
throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody);
}
} | [
"public",
"<",
"T",
">",
"T",
"handleResponse",
"(",
"Response",
"response",
",",
"Type",
"returnType",
")",
"throws",
"ApiException",
"{",
"if",
"(",
"response",
".",
"isSuccessful",
"(",
")",
")",
"{",
"if",
"(",
"returnType",
"==",
"null",
"||",
"resp... | Handle the given response, return the deserialized object when the response is successful.
@param <T> Type
@param response Response
@param returnType Return type
@throws ApiException If the response has a unsuccessful status code or
fail to deserialize the response body
@return Type | [
"Handle",
"the",
"given",
"response",
"return",
"the",
"deserialized",
"object",
"when",
"the",
"response",
"is",
"successful",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/client/ApiClient.java#L1029-L1049 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java | OSMTablesFactory.createWayTagTable | public static PreparedStatement createWayTagTable(Connection connection, String wayTagTableName, String tagTableName) throws SQLException {
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(wayTagTableName);
sb.append("(ID_WAY BIGINT, ID_TAG BIGINT, VALUE VARCHAR);");
stmt.execute(sb.toString());
}
//We return the preparedstatement of the way tag table
StringBuilder insert = new StringBuilder("INSERT INTO ");
insert.append(wayTagTableName);
insert.append("VALUES ( ?, ");
insert.append("(SELECT ID_TAG FROM ").append(tagTableName).append(" WHERE TAG_KEY = ? LIMIT 1)");
insert.append(", ?);");
return connection.prepareStatement(insert.toString());
} | java | public static PreparedStatement createWayTagTable(Connection connection, String wayTagTableName, String tagTableName) throws SQLException {
try (Statement stmt = connection.createStatement()) {
StringBuilder sb = new StringBuilder("CREATE TABLE ");
sb.append(wayTagTableName);
sb.append("(ID_WAY BIGINT, ID_TAG BIGINT, VALUE VARCHAR);");
stmt.execute(sb.toString());
}
//We return the preparedstatement of the way tag table
StringBuilder insert = new StringBuilder("INSERT INTO ");
insert.append(wayTagTableName);
insert.append("VALUES ( ?, ");
insert.append("(SELECT ID_TAG FROM ").append(tagTableName).append(" WHERE TAG_KEY = ? LIMIT 1)");
insert.append(", ?);");
return connection.prepareStatement(insert.toString());
} | [
"public",
"static",
"PreparedStatement",
"createWayTagTable",
"(",
"Connection",
"connection",
",",
"String",
"wayTagTableName",
",",
"String",
"tagTableName",
")",
"throws",
"SQLException",
"{",
"try",
"(",
"Statement",
"stmt",
"=",
"connection",
".",
"createStatemen... | Create a table to store the way tags.
@param connection
@param wayTagTableName
@param tagTableName
@return
@throws SQLException | [
"Create",
"a",
"table",
"to",
"store",
"the",
"way",
"tags",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/osm/OSMTablesFactory.java#L181-L195 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java | ExpressRoutePortsInner.getByResourceGroupAsync | public Observable<ExpressRoutePortInner> getByResourceGroupAsync(String resourceGroupName, String expressRoutePortName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, expressRoutePortName).map(new Func1<ServiceResponse<ExpressRoutePortInner>, ExpressRoutePortInner>() {
@Override
public ExpressRoutePortInner call(ServiceResponse<ExpressRoutePortInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRoutePortInner> getByResourceGroupAsync(String resourceGroupName, String expressRoutePortName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, expressRoutePortName).map(new Func1<ServiceResponse<ExpressRoutePortInner>, ExpressRoutePortInner>() {
@Override
public ExpressRoutePortInner call(ServiceResponse<ExpressRoutePortInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRoutePortInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRoutePortName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRoutePortNam... | Retrieves the requested ExpressRoutePort resource.
@param resourceGroupName The name of the resource group.
@param expressRoutePortName The name of ExpressRoutePort.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRoutePortInner object | [
"Retrieves",
"the",
"requested",
"ExpressRoutePort",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java#L302-L309 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/logging/OutputHandler.java | OutputHandler.colorChannel | public void colorChannel(String channel, Color color){
if(this.channelColors == null){
this.channelColors = new HashMap<String,Color>();
}
this.channelColors.put(channel.toLowerCase(),color);
} | java | public void colorChannel(String channel, Color color){
if(this.channelColors == null){
this.channelColors = new HashMap<String,Color>();
}
this.channelColors.put(channel.toLowerCase(),color);
} | [
"public",
"void",
"colorChannel",
"(",
"String",
"channel",
",",
"Color",
"color",
")",
"{",
"if",
"(",
"this",
".",
"channelColors",
"==",
"null",
")",
"{",
"this",
".",
"channelColors",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Color",
">",
"(",
")... | Color the tag for a particular channel this color
@param channel The channel to color
@param color The color to use | [
"Color",
"the",
"tag",
"for",
"a",
"particular",
"channel",
"this",
"color"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/logging/OutputHandler.java#L81-L86 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java | TraceNLS.getFormattedMessage | public static String getFormattedMessage(Class<?> caller, String bundleName, String key, Object[] args, String defaultString) {
return TraceNLSResolver.getInstance().getMessage(caller, null, bundleName, key, args, defaultString, true, null, false);
} | java | public static String getFormattedMessage(Class<?> caller, String bundleName, String key, Object[] args, String defaultString) {
return TraceNLSResolver.getInstance().getMessage(caller, null, bundleName, key, args, defaultString, true, null, false);
} | [
"public",
"static",
"String",
"getFormattedMessage",
"(",
"Class",
"<",
"?",
">",
"caller",
",",
"String",
"bundleName",
",",
"String",
"key",
",",
"Object",
"[",
"]",
"args",
",",
"String",
"defaultString",
")",
"{",
"return",
"TraceNLSResolver",
".",
"getI... | Return the message obtained by looking up the localized text
corresponding to the specified key in the specified ResourceBundle and
formatting the resultant text using the specified substitution arguments.
<p>
The message is formatted using the java.text.MessageFormat class.
Substitution parameters are handled according to the rules of that class.
Most noteably, that class does special formatting for native java Date and
Number objects.
<p>
If an error occurs in obtaining the localized text corresponding to this
key, then the defaultString is used as the message text. If all else fails,
this class will provide one of the default English messages to indicate
what occurred.
<p>
@param caller
Class object calling this method
@param bundleName
the fully qualified name of the ResourceBundle. Must not be
null.
@param key
the key to use in the ResourceBundle lookup. Must not be null.
@param args
substitution parameters that are inserted into the message
text. Null is tolerated
@param defaultString
text to use if the localized text cannot be found. Must not be
null.
<p>
@return a non-null message that is localized and formatted as
appropriate. | [
"Return",
"the",
"message",
"obtained",
"by",
"looking",
"up",
"the",
"localized",
"text",
"corresponding",
"to",
"the",
"specified",
"key",
"in",
"the",
"specified",
"ResourceBundle",
"and",
"formatting",
"the",
"resultant",
"text",
"using",
"the",
"specified",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java#L342-L344 |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java | PlaybackService.registerListener | public static void registerListener(Context context, PlaybackListener listener) {
IntentFilter filter = new IntentFilter();
filter.addAction(PlaybackListener.ACTION_ON_TRACK_PLAYED);
filter.addAction(PlaybackListener.ACTION_ON_PLAYER_PAUSED);
filter.addAction(PlaybackListener.ACTION_ON_SEEK_COMPLETE);
filter.addAction(PlaybackListener.ACTION_ON_PLAYER_DESTROYED);
filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_STARTED);
filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_ENDED);
filter.addAction(PlaybackListener.ACTION_ON_PROGRESS_CHANGED);
LocalBroadcastManager.getInstance(context.getApplicationContext())
.registerReceiver(listener, filter);
} | java | public static void registerListener(Context context, PlaybackListener listener) {
IntentFilter filter = new IntentFilter();
filter.addAction(PlaybackListener.ACTION_ON_TRACK_PLAYED);
filter.addAction(PlaybackListener.ACTION_ON_PLAYER_PAUSED);
filter.addAction(PlaybackListener.ACTION_ON_SEEK_COMPLETE);
filter.addAction(PlaybackListener.ACTION_ON_PLAYER_DESTROYED);
filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_STARTED);
filter.addAction(PlaybackListener.ACTION_ON_BUFFERING_ENDED);
filter.addAction(PlaybackListener.ACTION_ON_PROGRESS_CHANGED);
LocalBroadcastManager.getInstance(context.getApplicationContext())
.registerReceiver(listener, filter);
} | [
"public",
"static",
"void",
"registerListener",
"(",
"Context",
"context",
",",
"PlaybackListener",
"listener",
")",
"{",
"IntentFilter",
"filter",
"=",
"new",
"IntentFilter",
"(",
")",
";",
"filter",
".",
"addAction",
"(",
"PlaybackListener",
".",
"ACTION_ON_TRAC... | Register a listener to catch player event.
@param context context used to register the listener.
@param listener listener to register. | [
"Register",
"a",
"listener",
"to",
"catch",
"player",
"event",
"."
] | train | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L368-L380 |
icode/ameba | src/main/java/ameba/db/ebean/support/ModelResourceStructure.java | ModelResourceStructure.processTransactionError | protected <T> T processTransactionError(Transaction t, TxCallable<T> callable, TxCallable<T> process) throws Exception {
try {
return callable.call(t);
} catch (Exception e) {
return processCheckRowCountError(t, e, e, process);
}
} | java | protected <T> T processTransactionError(Transaction t, TxCallable<T> callable, TxCallable<T> process) throws Exception {
try {
return callable.call(t);
} catch (Exception e) {
return processCheckRowCountError(t, e, e, process);
}
} | [
"protected",
"<",
"T",
">",
"T",
"processTransactionError",
"(",
"Transaction",
"t",
",",
"TxCallable",
"<",
"T",
">",
"callable",
",",
"TxCallable",
"<",
"T",
">",
"process",
")",
"throws",
"Exception",
"{",
"try",
"{",
"return",
"callable",
".",
"call",
... | <p>processTransactionError.</p>
@param t Transaction
@param callable a {@link ameba.db.ebean.support.ModelResourceStructure.TxCallable} object.
@param process a {@link ameba.db.ebean.support.ModelResourceStructure.TxCallable} object.
@param <T> model
@return model
@throws java.lang.Exception if any. | [
"<p",
">",
"processTransactionError",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L1056-L1062 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.substr_count | public static int substr_count(final String string, final String substring) {
if(substring.length()==1) {
return substr_count(string, substring.charAt(0));
}
int count = 0;
int idx = 0;
while ((idx = string.indexOf(substring, idx)) != -1) {
++idx;
++count;
}
return count;
} | java | public static int substr_count(final String string, final String substring) {
if(substring.length()==1) {
return substr_count(string, substring.charAt(0));
}
int count = 0;
int idx = 0;
while ((idx = string.indexOf(substring, idx)) != -1) {
++idx;
++count;
}
return count;
} | [
"public",
"static",
"int",
"substr_count",
"(",
"final",
"String",
"string",
",",
"final",
"String",
"substring",
")",
"{",
"if",
"(",
"substring",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"return",
"substr_count",
"(",
"string",
",",
"substring",
"... | Count the number of substring occurrences.
@param string
@param substring
@return | [
"Count",
"the",
"number",
"of",
"substring",
"occurrences",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L62-L76 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsResourceTable.java | CmsResourceTable.fillTable | public void fillTable(CmsObject cms, List<CmsResource> resources, boolean clearFilter, boolean sort) {
Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
m_container.removeAllItems();
if (clearFilter) {
m_container.removeAllContainerFilters();
}
for (CmsResource resource : resources) {
fillItem(cms, resource, wpLocale);
}
if (sort) {
m_fileTable.sort();
}
clearSelection();
} | java | public void fillTable(CmsObject cms, List<CmsResource> resources, boolean clearFilter, boolean sort) {
Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
m_container.removeAllItems();
if (clearFilter) {
m_container.removeAllContainerFilters();
}
for (CmsResource resource : resources) {
fillItem(cms, resource, wpLocale);
}
if (sort) {
m_fileTable.sort();
}
clearSelection();
} | [
"public",
"void",
"fillTable",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"CmsResource",
">",
"resources",
",",
"boolean",
"clearFilter",
",",
"boolean",
"sort",
")",
"{",
"Locale",
"wpLocale",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getW... | Fills the resource table.<p>
@param cms the current CMS context
@param resources the resources which should be displayed in the table
@param clearFilter <code>true</code> to clear the search filter
@param sort <code>true</code> to sort the table entries | [
"Fills",
"the",
"resource",
"table",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsResourceTable.java#L596-L610 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/declarative/utils/DeclarativePipelineUtils.java | DeclarativePipelineUtils.getBuildInfo | public static BuildInfo getBuildInfo(FilePath ws, Run build, String customBuildName, String customBuildNumber) throws IOException, InterruptedException {
String jobBuildNumber = BuildUniqueIdentifierHelper.getBuildNumber(build);
String buildInfoId = createBuildInfoId(build, customBuildName, customBuildNumber);
BuildDataFile buildDataFile = readBuildDataFile(ws, jobBuildNumber, BuildInfoStep.STEP_NAME, buildInfoId);
if (buildDataFile == null) {
BuildInfo buildInfo = new BuildInfo(build);
if (StringUtils.isNotBlank(customBuildName)) {
buildInfo.setName(customBuildName);
}
if (StringUtils.isNotBlank(customBuildNumber)) {
buildInfo.setNumber(customBuildNumber);
}
return buildInfo;
}
return Utils.mapper().treeToValue(buildDataFile.get(BuildInfoStep.STEP_NAME), BuildInfo.class);
} | java | public static BuildInfo getBuildInfo(FilePath ws, Run build, String customBuildName, String customBuildNumber) throws IOException, InterruptedException {
String jobBuildNumber = BuildUniqueIdentifierHelper.getBuildNumber(build);
String buildInfoId = createBuildInfoId(build, customBuildName, customBuildNumber);
BuildDataFile buildDataFile = readBuildDataFile(ws, jobBuildNumber, BuildInfoStep.STEP_NAME, buildInfoId);
if (buildDataFile == null) {
BuildInfo buildInfo = new BuildInfo(build);
if (StringUtils.isNotBlank(customBuildName)) {
buildInfo.setName(customBuildName);
}
if (StringUtils.isNotBlank(customBuildNumber)) {
buildInfo.setNumber(customBuildNumber);
}
return buildInfo;
}
return Utils.mapper().treeToValue(buildDataFile.get(BuildInfoStep.STEP_NAME), BuildInfo.class);
} | [
"public",
"static",
"BuildInfo",
"getBuildInfo",
"(",
"FilePath",
"ws",
",",
"Run",
"build",
",",
"String",
"customBuildName",
",",
"String",
"customBuildNumber",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"String",
"jobBuildNumber",
"=",
"Build... | Get build info as defined in previous rtBuildInfo{...} scope.
@param ws - Step's workspace.
@param build - Step's build.
@param customBuildName - Step's custom build name if exist.
@param customBuildNumber - Step's custom build number if exist.
@return build info object as defined in previous rtBuildInfo{...} scope or a new build info. | [
"Get",
"build",
"info",
"as",
"defined",
"in",
"previous",
"rtBuildInfo",
"{",
"...",
"}",
"scope",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/declarative/utils/DeclarativePipelineUtils.java#L115-L131 |
Sciss/abc4j | abc/src/main/java/abc/ui/swing/JScoreComponent.java | JScoreComponent.setTune | public void setTune(Tune tune){
m_jTune = new JTune(tune,
new Point(0, 0),
getTemplate());
m_jTune.setColor(getForeground());
m_selectedItems = null;
m_dimension.setSize(m_jTune.getWidth(), m_jTune.getHeight());
setPreferredSize(m_dimension);
setSize(m_dimension);
m_isBufferedImageOutdated=true;
repaint();
} | java | public void setTune(Tune tune){
m_jTune = new JTune(tune,
new Point(0, 0),
getTemplate());
m_jTune.setColor(getForeground());
m_selectedItems = null;
m_dimension.setSize(m_jTune.getWidth(), m_jTune.getHeight());
setPreferredSize(m_dimension);
setSize(m_dimension);
m_isBufferedImageOutdated=true;
repaint();
} | [
"public",
"void",
"setTune",
"(",
"Tune",
"tune",
")",
"{",
"m_jTune",
"=",
"new",
"JTune",
"(",
"tune",
",",
"new",
"Point",
"(",
"0",
",",
"0",
")",
",",
"getTemplate",
"(",
")",
")",
";",
"m_jTune",
".",
"setColor",
"(",
"getForeground",
"(",
")... | Sets the tune to be renderered.
@param tune The tune to be displayed. | [
"Sets",
"the",
"tune",
"to",
"be",
"renderered",
"."
] | train | https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreComponent.java#L251-L263 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java | TriggersInner.listByDataBoxEdgeDeviceAsync | public Observable<Page<TriggerInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<TriggerInner>>, Page<TriggerInner>>() {
@Override
public Page<TriggerInner> call(ServiceResponse<Page<TriggerInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<TriggerInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) {
return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName)
.map(new Func1<ServiceResponse<Page<TriggerInner>>, Page<TriggerInner>>() {
@Override
public Page<TriggerInner> call(ServiceResponse<Page<TriggerInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"TriggerInner",
">",
">",
"listByDataBoxEdgeDeviceAsync",
"(",
"final",
"String",
"deviceName",
",",
"final",
"String",
"resourceGroupName",
")",
"{",
"return",
"listByDataBoxEdgeDeviceWithServiceResponseAsync",
"(",
"deviceName",... | Lists all the triggers configured in the device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<TriggerInner> object | [
"Lists",
"all",
"the",
"triggers",
"configured",
"in",
"the",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java#L143-L151 |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/Job.java | Job.futureCall | public <T> FutureValue<T> futureCall(Job0<T> jobInstance, JobSetting... settings) {
return futureCallUnchecked(settings, jobInstance);
} | java | public <T> FutureValue<T> futureCall(Job0<T> jobInstance, JobSetting... settings) {
return futureCallUnchecked(settings, jobInstance);
} | [
"public",
"<",
"T",
">",
"FutureValue",
"<",
"T",
">",
"futureCall",
"(",
"Job0",
"<",
"T",
">",
"jobInstance",
",",
"JobSetting",
"...",
"settings",
")",
"{",
"return",
"futureCallUnchecked",
"(",
"settings",
",",
"jobInstance",
")",
";",
"}"
] | Invoke this method from within the {@code run} method of a <b>generator
job</b> in order to specify a job node in the generated child job graph.
This version of the method is for child jobs that take zero arguments.
@param <T> The return type of the child job being specified
@param jobInstance A user-written job object
@param settings Optional one or more {@code JobSetting}
@return a {@code FutureValue} representing an empty value slot that will be
filled by the output of {@code jobInstance} when it finalizes. This
may be passed in to further invocations of {@code futureCall()} in
order to specify a data dependency. | [
"Invoke",
"this",
"method",
"from",
"within",
"the",
"{",
"@code",
"run",
"}",
"method",
"of",
"a",
"<b",
">",
"generator",
"job<",
"/",
"b",
">",
"in",
"order",
"to",
"specify",
"a",
"job",
"node",
"in",
"the",
"generated",
"child",
"job",
"graph",
... | train | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/Job.java#L199-L201 |
landawn/AbacusUtil | src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java | PoolablePreparedStatement.setNCharacterStream | @Override
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
internalStmt.setNCharacterStream(parameterIndex, value);
} | java | @Override
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
internalStmt.setNCharacterStream(parameterIndex, value);
} | [
"@",
"Override",
"public",
"void",
"setNCharacterStream",
"(",
"int",
"parameterIndex",
",",
"Reader",
"value",
")",
"throws",
"SQLException",
"{",
"internalStmt",
".",
"setNCharacterStream",
"(",
"parameterIndex",
",",
"value",
")",
";",
"}"
] | Method setNCharacterStream.
@param parameterIndex
@param value
@throws SQLException
@see java.sql.PreparedStatement#setNCharacterStream(int, Reader) | [
"Method",
"setNCharacterStream",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L790-L793 |
aws/aws-sdk-java | aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java | Utils.findShapeModelByC2jNameIfExists | public static ShapeModel findShapeModelByC2jNameIfExists(IntermediateModel intermediateModel, String shapeC2jName) {
for (ShapeModel shape : intermediateModel.getShapes().values()) {
if (shape.getC2jName().equals(shapeC2jName)) {
return shape;
}
}
return null;
} | java | public static ShapeModel findShapeModelByC2jNameIfExists(IntermediateModel intermediateModel, String shapeC2jName) {
for (ShapeModel shape : intermediateModel.getShapes().values()) {
if (shape.getC2jName().equals(shapeC2jName)) {
return shape;
}
}
return null;
} | [
"public",
"static",
"ShapeModel",
"findShapeModelByC2jNameIfExists",
"(",
"IntermediateModel",
"intermediateModel",
",",
"String",
"shapeC2jName",
")",
"{",
"for",
"(",
"ShapeModel",
"shape",
":",
"intermediateModel",
".",
"getShapes",
"(",
")",
".",
"values",
"(",
... | Search for intermediate shape model by its c2j name.
@return ShapeModel or null if the shape doesn't exist (if it's primitive or container type for example) | [
"Search",
"for",
"intermediate",
"shape",
"model",
"by",
"its",
"c2j",
"name",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java#L281-L288 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java | BigIntegerExtensions.operator_multiply | @Inline(value="$1.multiply($2)")
@Pure
public static BigInteger operator_multiply(BigInteger a, BigInteger b) {
return a.multiply(b);
} | java | @Inline(value="$1.multiply($2)")
@Pure
public static BigInteger operator_multiply(BigInteger a, BigInteger b) {
return a.multiply(b);
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"$1.multiply($2)\"",
")",
"@",
"Pure",
"public",
"static",
"BigInteger",
"operator_multiply",
"(",
"BigInteger",
"a",
",",
"BigInteger",
"b",
")",
"{",
"return",
"a",
".",
"multiply",
"(",
"b",
")",
";",
"}"
] | The binary <code>times</code> operator.
@param a
a BigInteger. May not be <code>null</code>.
@param b
a BigInteger. May not be <code>null</code>.
@return <code>a.multiply(b)</code>
@throws NullPointerException
if {@code a} or {@code b} is <code>null</code>. | [
"The",
"binary",
"<code",
">",
"times<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java#L99-L103 |
jhy/jsoup | src/main/java/org/jsoup/nodes/Element.java | Element.insertChildren | public Element insertChildren(int index, Node... children) {
Validate.notNull(children, "Children collection to be inserted must not be null.");
int currentSize = childNodeSize();
if (index < 0) index += currentSize +1; // roll around
Validate.isTrue(index >= 0 && index <= currentSize, "Insert position out of bounds.");
addChildren(index, children);
return this;
} | java | public Element insertChildren(int index, Node... children) {
Validate.notNull(children, "Children collection to be inserted must not be null.");
int currentSize = childNodeSize();
if (index < 0) index += currentSize +1; // roll around
Validate.isTrue(index >= 0 && index <= currentSize, "Insert position out of bounds.");
addChildren(index, children);
return this;
} | [
"public",
"Element",
"insertChildren",
"(",
"int",
"index",
",",
"Node",
"...",
"children",
")",
"{",
"Validate",
".",
"notNull",
"(",
"children",
",",
"\"Children collection to be inserted must not be null.\"",
")",
";",
"int",
"currentSize",
"=",
"childNodeSize",
... | Inserts the given child nodes into this element at the specified index. Current nodes will be shifted to the
right. The inserted nodes will be moved from their current parent. To prevent moving, copy the nodes first.
@param index 0-based index to insert children at. Specify {@code 0} to insert at the start, {@code -1} at the
end
@param children child nodes to insert
@return this element, for chaining. | [
"Inserts",
"the",
"given",
"child",
"nodes",
"into",
"this",
"element",
"at",
"the",
"specified",
"index",
".",
"Current",
"nodes",
"will",
"be",
"shifted",
"to",
"the",
"right",
".",
"The",
"inserted",
"nodes",
"will",
"be",
"moved",
"from",
"their",
"cur... | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L477-L485 |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java | CalendarCodeGenerator.buildTimeZoneExemplarCities | private void buildTimeZoneExemplarCities(MethodSpec.Builder method, TimeZoneData data) {
CodeBlock.Builder code = CodeBlock.builder();
code.beginControlFlow("this.exemplarCities = new $T<$T, $T>() {", HashMap.class, String.class, String.class);
for (TimeZoneInfo info : data.timeZoneInfo) {
code.addStatement("put($S, $S)", info.zone, info.exemplarCity);
}
code.endControlFlow("}");
method.addCode(code.build());
} | java | private void buildTimeZoneExemplarCities(MethodSpec.Builder method, TimeZoneData data) {
CodeBlock.Builder code = CodeBlock.builder();
code.beginControlFlow("this.exemplarCities = new $T<$T, $T>() {", HashMap.class, String.class, String.class);
for (TimeZoneInfo info : data.timeZoneInfo) {
code.addStatement("put($S, $S)", info.zone, info.exemplarCity);
}
code.endControlFlow("}");
method.addCode(code.build());
} | [
"private",
"void",
"buildTimeZoneExemplarCities",
"(",
"MethodSpec",
".",
"Builder",
"method",
",",
"TimeZoneData",
"data",
")",
"{",
"CodeBlock",
".",
"Builder",
"code",
"=",
"CodeBlock",
".",
"builder",
"(",
")",
";",
"code",
".",
"beginControlFlow",
"(",
"\... | Mapping locale identifiers to their localized exemplar cities. | [
"Mapping",
"locale",
"identifiers",
"to",
"their",
"localized",
"exemplar",
"cities",
"."
] | train | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L581-L589 |
elki-project/elki | addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java | XSplitter.removeFromMBR | private void removeFromMBR(List<Heap<DoubleIntPair>> pqUB, List<Heap<DoubleIntPair>> pqLB, int index, ModifiableHyperBoundingBox mbr) {
boolean change = false;
DoubleIntPair pqPair;
for(int d = 0; d < mbr.getDimensionality(); d++) {
// remove all relevant upper bound entries belonging to the first set
pqPair = pqUB.get(d).peek();
while(pqPair.second <= index) {
change = true;
pqUB.get(d).poll();
pqPair = pqUB.get(d).peek();
}
if(change) { // there probably was a change, as an entry has been removed
mbr.setMax(d, pqPair.first);
}
change = false;
// remove all relevant lower bound entries belonging to the first set
pqPair = pqLB.get(d).peek();
while(pqPair.second <= index) {
change = true;
pqLB.get(d).poll();
pqPair = pqLB.get(d).peek();
}
if(change) { // there probably was a change, as an entry has been removed
mbr.setMin(d, pqPair.first);
}
change = false;
}
} | java | private void removeFromMBR(List<Heap<DoubleIntPair>> pqUB, List<Heap<DoubleIntPair>> pqLB, int index, ModifiableHyperBoundingBox mbr) {
boolean change = false;
DoubleIntPair pqPair;
for(int d = 0; d < mbr.getDimensionality(); d++) {
// remove all relevant upper bound entries belonging to the first set
pqPair = pqUB.get(d).peek();
while(pqPair.second <= index) {
change = true;
pqUB.get(d).poll();
pqPair = pqUB.get(d).peek();
}
if(change) { // there probably was a change, as an entry has been removed
mbr.setMax(d, pqPair.first);
}
change = false;
// remove all relevant lower bound entries belonging to the first set
pqPair = pqLB.get(d).peek();
while(pqPair.second <= index) {
change = true;
pqLB.get(d).poll();
pqPair = pqLB.get(d).peek();
}
if(change) { // there probably was a change, as an entry has been removed
mbr.setMin(d, pqPair.first);
}
change = false;
}
} | [
"private",
"void",
"removeFromMBR",
"(",
"List",
"<",
"Heap",
"<",
"DoubleIntPair",
">",
">",
"pqUB",
",",
"List",
"<",
"Heap",
"<",
"DoubleIntPair",
">",
">",
"pqLB",
",",
"int",
"index",
",",
"ModifiableHyperBoundingBox",
"mbr",
")",
"{",
"boolean",
"cha... | Update operation for maintaining the second entry distribution. Removes the
entries associated with indices <code>≤ index</code> from the
dimensions' lower and upper bound priority queues (<code>pqLB</code> and
<code>pqUB</code>). Whenever this causes a change in a dimension's lower or
upper bound, <code>mbr</code> is updated accordingly.
@param pqUB One priority queue for each dimension. They are sorted by upper
bound in descending order and consist of entry indices for the
entries belonging to <code>mbr</code> (and possibly others, which
may first have to be removed).
@param pqLB One priority queue for each dimension. They are sorted by lower
bound in ascending order and consist of entry indices for the
entries belonging to <code>mbr</code> (and possibly others, which
may first have to be removed).
@param index All indices <code>≤ index</code> must no longer be part of
<code>mbr</code>.
@param mbr The MBR to be adapted to a smaller entry list. | [
"Update",
"operation",
"for",
"maintaining",
"the",
"second",
"entry",
"distribution",
".",
"Removes",
"the",
"entries",
"associated",
"with",
"indices",
"<code",
">",
"&le",
";",
"index<",
"/",
"code",
">",
"from",
"the",
"dimensions",
"lower",
"and",
"upper"... | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/xtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/xtree/util/XSplitter.java#L227-L254 |
nightcode/yaranga | core/src/org/nightcode/common/base/Hexs.java | Hexs.fromByteArray | public String fromByteArray(byte[] bytes) {
java.util.Objects.requireNonNull(bytes, "bytes");
return fromByteArray(bytes, 0, bytes.length);
} | java | public String fromByteArray(byte[] bytes) {
java.util.Objects.requireNonNull(bytes, "bytes");
return fromByteArray(bytes, 0, bytes.length);
} | [
"public",
"String",
"fromByteArray",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"java",
".",
"util",
".",
"Objects",
".",
"requireNonNull",
"(",
"bytes",
",",
"\"bytes\"",
")",
";",
"return",
"fromByteArray",
"(",
"bytes",
",",
"0",
",",
"bytes",
".",
"... | Returns a hexadecimal string representation of each bytes of {@code bytes}.
@param bytes a bytes to convert
@return a hexadecimal string representation of each bytes of {@code bytes} | [
"Returns",
"a",
"hexadecimal",
"string",
"representation",
"of",
"each",
"bytes",
"of",
"{",
"@code",
"bytes",
"}",
"."
] | train | https://github.com/nightcode/yaranga/blob/f02cf8d8bcd365b6b1d55638938631a00e9ee808/core/src/org/nightcode/common/base/Hexs.java#L64-L67 |
liyiorg/weixin-popular | src/main/java/weixin/popular/client/LocalHttpClient.java | LocalHttpClient.executeXmlResult | public static <T> T executeXmlResult(HttpUriRequest request,Class<T> clazz,String sign_type,String key){
return execute(request,XmlResponseHandler.createResponseHandler(clazz,sign_type,key));
} | java | public static <T> T executeXmlResult(HttpUriRequest request,Class<T> clazz,String sign_type,String key){
return execute(request,XmlResponseHandler.createResponseHandler(clazz,sign_type,key));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"executeXmlResult",
"(",
"HttpUriRequest",
"request",
",",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"sign_type",
",",
"String",
"key",
")",
"{",
"return",
"execute",
"(",
"request",
",",
"XmlResponseHandler",
... | 数据返回自动XML对象解析
@param request request
@param clazz clazz
@param sign_type 数据返回验证签名类型
@param key 数据返回验证签名key
@param <T> T
@return result
@since 2.8.5 | [
"数据返回自动XML对象解析"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/client/LocalHttpClient.java#L180-L182 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/connectionmanager/pool/capacity/CapacityFactory.java | CapacityFactory.loadDecrementer | private static CapacityDecrementer loadDecrementer(Extension decrementer, ClassLoaderPlugin classLoaderPlugin)
{
Object result = loadExtension(decrementer, classLoaderPlugin);
if (result != null && result instanceof CapacityDecrementer)
{
return (CapacityDecrementer)result;
}
log.debugf("%s wasn't a CapacityDecrementer", decrementer.getClassName());
return null;
} | java | private static CapacityDecrementer loadDecrementer(Extension decrementer, ClassLoaderPlugin classLoaderPlugin)
{
Object result = loadExtension(decrementer, classLoaderPlugin);
if (result != null && result instanceof CapacityDecrementer)
{
return (CapacityDecrementer)result;
}
log.debugf("%s wasn't a CapacityDecrementer", decrementer.getClassName());
return null;
} | [
"private",
"static",
"CapacityDecrementer",
"loadDecrementer",
"(",
"Extension",
"decrementer",
",",
"ClassLoaderPlugin",
"classLoaderPlugin",
")",
"{",
"Object",
"result",
"=",
"loadExtension",
"(",
"decrementer",
",",
"classLoaderPlugin",
")",
";",
"if",
"(",
"resul... | Load the decrementer
@param decrementer The incrementer metadata to load as class instance
@param classLoaderPlugin class loader plugin to use to load class
@return The decrementer | [
"Load",
"the",
"decrementer"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/capacity/CapacityFactory.java#L169-L181 |
ironjacamar/ironjacamar | common/src/main/java/org/ironjacamar/common/metadata/ds/DsParser.java | DsParser.storeSecurity | protected void storeSecurity(DsSecurity s, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(XML.ELEMENT_SECURITY);
if (s.getUserName() != null)
{
writer.writeStartElement(XML.ELEMENT_USER_NAME);
writer.writeCharacters(s.getValue(XML.ELEMENT_USER_NAME, s.getUserName()));
writer.writeEndElement();
writer.writeStartElement(XML.ELEMENT_PASSWORD);
writer.writeCharacters(s.getValue(XML.ELEMENT_PASSWORD, s.getPassword()));
writer.writeEndElement();
}
else if (s.getSecurityDomain() != null)
{
writer.writeStartElement(XML.ELEMENT_SECURITY_DOMAIN);
writer.writeCharacters(s.getValue(XML.ELEMENT_SECURITY_DOMAIN, s.getSecurityDomain()));
writer.writeEndElement();
}
if (s.getReauthPlugin() != null)
{
storeExtension(s.getReauthPlugin(), writer, XML.ELEMENT_REAUTH_PLUGIN);
}
writer.writeEndElement();
} | java | protected void storeSecurity(DsSecurity s, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(XML.ELEMENT_SECURITY);
if (s.getUserName() != null)
{
writer.writeStartElement(XML.ELEMENT_USER_NAME);
writer.writeCharacters(s.getValue(XML.ELEMENT_USER_NAME, s.getUserName()));
writer.writeEndElement();
writer.writeStartElement(XML.ELEMENT_PASSWORD);
writer.writeCharacters(s.getValue(XML.ELEMENT_PASSWORD, s.getPassword()));
writer.writeEndElement();
}
else if (s.getSecurityDomain() != null)
{
writer.writeStartElement(XML.ELEMENT_SECURITY_DOMAIN);
writer.writeCharacters(s.getValue(XML.ELEMENT_SECURITY_DOMAIN, s.getSecurityDomain()));
writer.writeEndElement();
}
if (s.getReauthPlugin() != null)
{
storeExtension(s.getReauthPlugin(), writer, XML.ELEMENT_REAUTH_PLUGIN);
}
writer.writeEndElement();
} | [
"protected",
"void",
"storeSecurity",
"(",
"DsSecurity",
"s",
",",
"XMLStreamWriter",
"writer",
")",
"throws",
"Exception",
"{",
"writer",
".",
"writeStartElement",
"(",
"XML",
".",
"ELEMENT_SECURITY",
")",
";",
"if",
"(",
"s",
".",
"getUserName",
"(",
")",
... | Store security
@param s The security
@param writer The writer
@exception Exception Thrown if an error occurs | [
"Store",
"security"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/ds/DsParser.java#L1928-L1955 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.updateAsync | public Observable<Void> updateAsync(String jobId, JobUpdateParameter jobUpdateParameter) {
return updateWithServiceResponseAsync(jobId, jobUpdateParameter).map(new Func1<ServiceResponseWithHeaders<Void, JobUpdateHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobUpdateHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> updateAsync(String jobId, JobUpdateParameter jobUpdateParameter) {
return updateWithServiceResponseAsync(jobId, jobUpdateParameter).map(new Func1<ServiceResponseWithHeaders<Void, JobUpdateHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobUpdateHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"updateAsync",
"(",
"String",
"jobId",
",",
"JobUpdateParameter",
"jobUpdateParameter",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"jobId",
",",
"jobUpdateParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"... | Updates the properties of the specified job.
This fully replaces all the updatable properties of the job. For example, if the job has constraints associated with it and if constraints is not specified with this request, then the Batch service will remove the existing constraints.
@param jobId The ID of the job whose properties you want to update.
@param jobUpdateParameter The parameters for the request.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Updates",
"the",
"properties",
"of",
"the",
"specified",
"job",
".",
"This",
"fully",
"replaces",
"all",
"the",
"updatable",
"properties",
"of",
"the",
"job",
".",
"For",
"example",
"if",
"the",
"job",
"has",
"constraints",
"associated",
"with",
"it",
"and"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L1098-L1105 |
btrplace/scheduler | json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java | NetworkConverter.switchesFromJSON | public void switchesFromJSON(Network net, JSONArray a) throws JSONConverterException {
for (Object o : a) {
net.newSwitch(requiredInt((JSONObject) o, "id"), readCapacity((JSONObject) o));
}
} | java | public void switchesFromJSON(Network net, JSONArray a) throws JSONConverterException {
for (Object o : a) {
net.newSwitch(requiredInt((JSONObject) o, "id"), readCapacity((JSONObject) o));
}
} | [
"public",
"void",
"switchesFromJSON",
"(",
"Network",
"net",
",",
"JSONArray",
"a",
")",
"throws",
"JSONConverterException",
"{",
"for",
"(",
"Object",
"o",
":",
"a",
")",
"{",
"net",
".",
"newSwitch",
"(",
"requiredInt",
"(",
"(",
"JSONObject",
")",
"o",
... | Convert a JSON array of switches to a Java List of switches.
@param net the network to populate
@param a the json array | [
"Convert",
"a",
"JSON",
"array",
"of",
"switches",
"to",
"a",
"Java",
"List",
"of",
"switches",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/view/network/NetworkConverter.java#L242-L246 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/HpelSystemStream.java | HpelSystemStream.redirectStreams | public static void redirectStreams() {
try {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
HpelSystemStream newErr = new HpelSystemStream("SystemErr");
System.setErr(newErr);
HpelSystemStream newOut = new HpelSystemStream("SystemOut");
System.setOut(newOut);
return null;
}
});
} catch (Throwable t) {
throw new RuntimeException("Unable to replace System streams", t);
}
reset() ;
} | java | public static void redirectStreams() {
try {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
HpelSystemStream newErr = new HpelSystemStream("SystemErr");
System.setErr(newErr);
HpelSystemStream newOut = new HpelSystemStream("SystemOut");
System.setOut(newOut);
return null;
}
});
} catch (Throwable t) {
throw new RuntimeException("Unable to replace System streams", t);
}
reset() ;
} | [
"public",
"static",
"void",
"redirectStreams",
"(",
")",
"{",
"try",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Object",
">",
"(",
")",
"{",
"public",
"Object",
"run",
"(",
")",
"{",
"HpelSystemStream",
"newErr",
"=",... | This method redirects the System.* stream to the repository.
It will print header if a implementation of logHeader is provided | [
"This",
"method",
"redirects",
"the",
"System",
".",
"*",
"stream",
"to",
"the",
"repository",
".",
"It",
"will",
"print",
"header",
"if",
"a",
"implementation",
"of",
"logHeader",
"is",
"provided"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/HpelSystemStream.java#L1019-L1035 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/deduplicate/DeduplicateFunctionHelper.java | DeduplicateFunctionHelper.processFirstRow | static void processFirstRow(BaseRow currentRow, ValueState<Boolean> state, Collector<BaseRow> out)
throws Exception {
// Check message should be accumulate
Preconditions.checkArgument(BaseRowUtil.isAccumulateMsg(currentRow));
// ignore record with timestamp bigger than preRow
if (state.value() != null) {
return;
}
state.update(true);
out.collect(currentRow);
} | java | static void processFirstRow(BaseRow currentRow, ValueState<Boolean> state, Collector<BaseRow> out)
throws Exception {
// Check message should be accumulate
Preconditions.checkArgument(BaseRowUtil.isAccumulateMsg(currentRow));
// ignore record with timestamp bigger than preRow
if (state.value() != null) {
return;
}
state.update(true);
out.collect(currentRow);
} | [
"static",
"void",
"processFirstRow",
"(",
"BaseRow",
"currentRow",
",",
"ValueState",
"<",
"Boolean",
">",
"state",
",",
"Collector",
"<",
"BaseRow",
">",
"out",
")",
"throws",
"Exception",
"{",
"// Check message should be accumulate",
"Preconditions",
".",
"checkAr... | Processes element to deduplicate on keys, sends current element if it is first row.
@param currentRow latest row received by deduplicate function
@param state state of function
@param out underlying collector
@throws Exception | [
"Processes",
"element",
"to",
"deduplicate",
"on",
"keys",
"sends",
"current",
"element",
"if",
"it",
"is",
"first",
"row",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/deduplicate/DeduplicateFunctionHelper.java#L66-L76 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/MessageBirdClient.java | MessageBirdClient.sendFlashMessage | public MessageResponse sendFlashMessage(final String originator, final String body, final List<BigInteger> recipients) throws UnauthorizedException, GeneralException {
final Message message = new Message(originator, body, recipients);
message.setType(MsgType.flash);
return messageBirdService.sendPayLoad(MESSAGESPATH, message, MessageResponse.class);
} | java | public MessageResponse sendFlashMessage(final String originator, final String body, final List<BigInteger> recipients) throws UnauthorizedException, GeneralException {
final Message message = new Message(originator, body, recipients);
message.setType(MsgType.flash);
return messageBirdService.sendPayLoad(MESSAGESPATH, message, MessageResponse.class);
} | [
"public",
"MessageResponse",
"sendFlashMessage",
"(",
"final",
"String",
"originator",
",",
"final",
"String",
"body",
",",
"final",
"List",
"<",
"BigInteger",
">",
"recipients",
")",
"throws",
"UnauthorizedException",
",",
"GeneralException",
"{",
"final",
"Message... | Convenient function to send a simple flash message to a list of recipients
@param originator Originator of the message, this will get truncated to 11 chars
@param body Body of the message
@param recipients List of recipients
@return MessageResponse
@throws UnauthorizedException if client is unauthorized
@throws GeneralException general exception | [
"Convenient",
"function",
"to",
"send",
"a",
"simple",
"flash",
"message",
"to",
"a",
"list",
"of",
"recipients"
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L185-L189 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/util/PdfGsUtilities.java | PdfGsUtilities.mergePdf | public static void mergePdf(File[] inputPdfFiles, File outputPdfFile) {
//get Ghostscript instance
Ghostscript gs = Ghostscript.getInstance();
//prepare Ghostscript interpreter parameters
//refer to Ghostscript documentation for parameter usage
//gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf in1.pdf in2.pdf in3.pdf
List<String> gsArgs = new ArrayList<String>();
gsArgs.add("-gs");
gsArgs.add("-dNOPAUSE");
gsArgs.add("-dQUIET");
gsArgs.add("-dBATCH");
gsArgs.add("-sDEVICE=pdfwrite");
gsArgs.add("-sOutputFile=" + outputPdfFile.getPath());
for (File inputPdfFile : inputPdfFiles) {
gsArgs.add(inputPdfFile.getPath());
}
//execute and exit interpreter
try {
synchronized (gs) {
gs.initialize(gsArgs.toArray(new String[0]));
gs.exit();
}
} catch (UnsatisfiedLinkError e) {
logger.error(e.getMessage());
throw new RuntimeException(getMessage(e.getMessage()));
} catch (NoClassDefFoundError e) {
logger.error(e.getMessage());
throw new RuntimeException(getMessage(e.getMessage()));
} catch (GhostscriptException e) {
logger.error(e.getMessage());
throw new RuntimeException(e.getMessage());
} finally {
//delete interpreter instance (safer)
try {
Ghostscript.deleteInstance();
} catch (GhostscriptException e) {
//nothing
}
}
} | java | public static void mergePdf(File[] inputPdfFiles, File outputPdfFile) {
//get Ghostscript instance
Ghostscript gs = Ghostscript.getInstance();
//prepare Ghostscript interpreter parameters
//refer to Ghostscript documentation for parameter usage
//gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf in1.pdf in2.pdf in3.pdf
List<String> gsArgs = new ArrayList<String>();
gsArgs.add("-gs");
gsArgs.add("-dNOPAUSE");
gsArgs.add("-dQUIET");
gsArgs.add("-dBATCH");
gsArgs.add("-sDEVICE=pdfwrite");
gsArgs.add("-sOutputFile=" + outputPdfFile.getPath());
for (File inputPdfFile : inputPdfFiles) {
gsArgs.add(inputPdfFile.getPath());
}
//execute and exit interpreter
try {
synchronized (gs) {
gs.initialize(gsArgs.toArray(new String[0]));
gs.exit();
}
} catch (UnsatisfiedLinkError e) {
logger.error(e.getMessage());
throw new RuntimeException(getMessage(e.getMessage()));
} catch (NoClassDefFoundError e) {
logger.error(e.getMessage());
throw new RuntimeException(getMessage(e.getMessage()));
} catch (GhostscriptException e) {
logger.error(e.getMessage());
throw new RuntimeException(e.getMessage());
} finally {
//delete interpreter instance (safer)
try {
Ghostscript.deleteInstance();
} catch (GhostscriptException e) {
//nothing
}
}
} | [
"public",
"static",
"void",
"mergePdf",
"(",
"File",
"[",
"]",
"inputPdfFiles",
",",
"File",
"outputPdfFile",
")",
"{",
"//get Ghostscript instance\r",
"Ghostscript",
"gs",
"=",
"Ghostscript",
".",
"getInstance",
"(",
")",
";",
"//prepare Ghostscript interpreter param... | Merges PDF files.
@param inputPdfFiles array of input files
@param outputPdfFile output file | [
"Merges",
"PDF",
"files",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/PdfGsUtilities.java#L269-L311 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/RichClientFramework.java | RichClientFramework.getOutboundConnectionProperties | @Override
public Map getOutboundConnectionProperties(Object ep)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getOutboundConnectionProperties", ep);
Map properties = null;
if (ep instanceof CFEndPoint)
{
OutboundChannelDefinition[] channelDefinitions = (OutboundChannelDefinition[]) ((CFEndPoint) ep).getOutboundChannelDefs().toArray();
if (channelDefinitions.length < 1)
throw new SIErrorException(nls.getFormattedMessage("OUTCONNTRACKER_INTERNAL_SICJ0064", null, "OUTCONNTRACKER_INTERNAL_SICJ0064"));
properties = channelDefinitions[0].getOutboundChannelProperties();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getOutboundConnectionProperties", properties);
return properties;
} | java | @Override
public Map getOutboundConnectionProperties(Object ep)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getOutboundConnectionProperties", ep);
Map properties = null;
if (ep instanceof CFEndPoint)
{
OutboundChannelDefinition[] channelDefinitions = (OutboundChannelDefinition[]) ((CFEndPoint) ep).getOutboundChannelDefs().toArray();
if (channelDefinitions.length < 1)
throw new SIErrorException(nls.getFormattedMessage("OUTCONNTRACKER_INTERNAL_SICJ0064", null, "OUTCONNTRACKER_INTERNAL_SICJ0064"));
properties = channelDefinitions[0].getOutboundChannelProperties();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getOutboundConnectionProperties", properties);
return properties;
} | [
"@",
"Override",
"public",
"Map",
"getOutboundConnectionProperties",
"(",
"Object",
"ep",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
... | This method will retrieve the property bag on the outbound chain that will be used by the
specified end point. This method is only valid for CFEndPoints.
@param ep The CFEndPoint
@see com.ibm.ws.sib.jfapchannel.framework.Framework#getOutboundConnectionProperties(java.lang.Object) | [
"This",
"method",
"will",
"retrieve",
"the",
"property",
"bag",
"on",
"the",
"outbound",
"chain",
"that",
"will",
"be",
"used",
"by",
"the",
"specified",
"end",
"point",
".",
"This",
"method",
"is",
"only",
"valid",
"for",
"CFEndPoints",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/richclient/framework/impl/RichClientFramework.java#L154-L172 |
elibom/jogger | src/main/java/com/elibom/jogger/middleware/router/RouterMiddleware.java | RouterMiddleware.matchesPath | private boolean matchesPath(String routePath, String pathToMatch) {
routePath = routePath.replaceAll(Path.VAR_REGEXP, Path.VAR_REPLACE);
return pathToMatch.matches("(?i)" + routePath);
} | java | private boolean matchesPath(String routePath, String pathToMatch) {
routePath = routePath.replaceAll(Path.VAR_REGEXP, Path.VAR_REPLACE);
return pathToMatch.matches("(?i)" + routePath);
} | [
"private",
"boolean",
"matchesPath",
"(",
"String",
"routePath",
",",
"String",
"pathToMatch",
")",
"{",
"routePath",
"=",
"routePath",
".",
"replaceAll",
"(",
"Path",
".",
"VAR_REGEXP",
",",
"Path",
".",
"VAR_REPLACE",
")",
";",
"return",
"pathToMatch",
".",
... | Helper method. Tells if the the HTTP path matches the route path.
@param routePath the path defined for the route.
@param pathToMatch the path from the HTTP request.
@return true if the path matches, false otherwise. | [
"Helper",
"method",
".",
"Tells",
"if",
"the",
"the",
"HTTP",
"path",
"matches",
"the",
"route",
"path",
"."
] | train | https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/middleware/router/RouterMiddleware.java#L145-L148 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java | ImageLoader.loadImageSync | public Bitmap loadImageSync(String uri, DisplayImageOptions options) {
return loadImageSync(uri, null, options);
} | java | public Bitmap loadImageSync(String uri, DisplayImageOptions options) {
return loadImageSync(uri, null, options);
} | [
"public",
"Bitmap",
"loadImageSync",
"(",
"String",
"uri",
",",
"DisplayImageOptions",
"options",
")",
"{",
"return",
"loadImageSync",
"(",
"uri",
",",
"null",
",",
"options",
")",
";",
"}"
] | Loads and decodes image synchronously.<br />
<b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call
@param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png")
@param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image
decoding and scaling. If <b>null</b> - default display image options
{@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions) from
configuration} will be used.
@return Result image Bitmap. Can be <b>null</b> if image loading/decoding was failed or cancelled.
@throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before | [
"Loads",
"and",
"decodes",
"image",
"synchronously",
".",
"<br",
"/",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"{",
"@link",
"#init",
"(",
"ImageLoaderConfiguration",
")",
"}",
"method",
"must",
"be",
"called",
"before",
"this",
"method",
"call"
... | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L558-L560 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/ObjectWritable.java | ObjectWritable.readObject | public static Object readObject(DataInput in, Configuration conf)
throws IOException {
return readObject(in, null, conf);
} | java | public static Object readObject(DataInput in, Configuration conf)
throws IOException {
return readObject(in, null, conf);
} | [
"public",
"static",
"Object",
"readObject",
"(",
"DataInput",
"in",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"return",
"readObject",
"(",
"in",
",",
"null",
",",
"conf",
")",
";",
"}"
] | Read a {@link Writable}, {@link String}, primitive type, or an array of
the preceding. | [
"Read",
"a",
"{"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/ObjectWritable.java#L239-L242 |
SimiaCryptus/utilities | java-util/src/main/java/com/simiacryptus/util/binary/BitOutputStream.java | BitOutputStream.writeVarLong | public void writeVarLong(final long value) throws IOException {
final int bitLength = new Bits(value).bitLength;
int type = Arrays.binarySearch(varLongDepths, bitLength);
if (type < 0) {
type = -type - 1;
}
this.write(new Bits(type, 2));
this.write(new Bits(value, varLongDepths[type]));
} | java | public void writeVarLong(final long value) throws IOException {
final int bitLength = new Bits(value).bitLength;
int type = Arrays.binarySearch(varLongDepths, bitLength);
if (type < 0) {
type = -type - 1;
}
this.write(new Bits(type, 2));
this.write(new Bits(value, varLongDepths[type]));
} | [
"public",
"void",
"writeVarLong",
"(",
"final",
"long",
"value",
")",
"throws",
"IOException",
"{",
"final",
"int",
"bitLength",
"=",
"new",
"Bits",
"(",
"value",
")",
".",
"bitLength",
";",
"int",
"type",
"=",
"Arrays",
".",
"binarySearch",
"(",
"varLongD... | Write var long.
@param value the value
@throws IOException the io exception | [
"Write",
"var",
"long",
"."
] | train | https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/BitOutputStream.java#L200-L208 |
EdwardRaff/JSAT | JSAT/src/jsat/io/DataWriter.java | DataWriter.writePoint | public void writePoint(double weight, DataPoint dp, double label) throws IOException
{
ByteArrayOutputStream baos = local_baos.get();
pointToBytes(weight, dp, label, baos);
if(baos.size() >= LOCAL_BUFFER_SIZE)//We've got a big chunk of data, lets dump it
synchronized(out)
{
baos.writeTo(out);
baos.reset();
}
} | java | public void writePoint(double weight, DataPoint dp, double label) throws IOException
{
ByteArrayOutputStream baos = local_baos.get();
pointToBytes(weight, dp, label, baos);
if(baos.size() >= LOCAL_BUFFER_SIZE)//We've got a big chunk of data, lets dump it
synchronized(out)
{
baos.writeTo(out);
baos.reset();
}
} | [
"public",
"void",
"writePoint",
"(",
"double",
"weight",
",",
"DataPoint",
"dp",
",",
"double",
"label",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"local_baos",
".",
"get",
"(",
")",
";",
"pointToBytes",
"(",
"weight",
",",
"dp... | Write out the given data point to the output stream
@param weight weight of the given data point to write out
@param dp the data point to write to the file
@param label The associated label for this dataum. If {@link #type} is a
{@link DataSetType#SIMPLE} set, this value will be ignored. If
{@link DataSetType#CLASSIFICATION}, the value will be assumed to be an
integer class label.
@throws java.io.IOException | [
"Write",
"out",
"the",
"given",
"data",
"point",
"to",
"the",
"output",
"stream"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/DataWriter.java#L114-L124 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/config/ServerConfig.java | ServerConfig.setParameters | public ServerConfig setParameters(Map<String, String> parameters) {
if (this.parameters == null) {
this.parameters = new ConcurrentHashMap<String, String>();
this.parameters.putAll(parameters);
}
return this;
} | java | public ServerConfig setParameters(Map<String, String> parameters) {
if (this.parameters == null) {
this.parameters = new ConcurrentHashMap<String, String>();
this.parameters.putAll(parameters);
}
return this;
} | [
"public",
"ServerConfig",
"setParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"if",
"(",
"this",
".",
"parameters",
"==",
"null",
")",
"{",
"this",
".",
"parameters",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
... | Sets parameters.
@param parameters the parameters
@return the parameters | [
"Sets",
"parameters",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/ServerConfig.java#L613-L619 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java | AbstractIndexWriter.addDescription | protected void addDescription(ClassDoc cd, Content dlTree, SearchIndexItem si) {
Content link = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.INDEX, cd).strong(true));
si.setContainingPackage(utils.getPackageName(cd.containingPackage()));
si.setLabel(cd.typeName());
si.setCategory(getResource("doclet.Types").toString());
Content dt = HtmlTree.DT(link);
dt.addContent(" - ");
addClassInfo(cd, dt);
dlTree.addContent(dt);
Content dd = new HtmlTree(HtmlTag.DD);
addComment(cd, dd);
dlTree.addContent(dd);
} | java | protected void addDescription(ClassDoc cd, Content dlTree, SearchIndexItem si) {
Content link = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.INDEX, cd).strong(true));
si.setContainingPackage(utils.getPackageName(cd.containingPackage()));
si.setLabel(cd.typeName());
si.setCategory(getResource("doclet.Types").toString());
Content dt = HtmlTree.DT(link);
dt.addContent(" - ");
addClassInfo(cd, dt);
dlTree.addContent(dt);
Content dd = new HtmlTree(HtmlTag.DD);
addComment(cd, dd);
dlTree.addContent(dd);
} | [
"protected",
"void",
"addDescription",
"(",
"ClassDoc",
"cd",
",",
"Content",
"dlTree",
",",
"SearchIndexItem",
"si",
")",
"{",
"Content",
"link",
"=",
"getLink",
"(",
"new",
"LinkInfoImpl",
"(",
"configuration",
",",
"LinkInfoImpl",
".",
"Kind",
".",
"INDEX",... | Add one line summary comment for the class.
@param cd the class being documented
@param dlTree the content tree to which the description will be added | [
"Add",
"one",
"line",
"summary",
"comment",
"for",
"the",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java#L207-L220 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/PropertiesAdapter.java | PropertiesAdapter.defaultIfNotSet | protected <T> T defaultIfNotSet(String propertyName, T defaultValue, Class<T> type) {
return (isSet(propertyName) ? convert(propertyName, type) : defaultValue);
} | java | protected <T> T defaultIfNotSet(String propertyName, T defaultValue, Class<T> type) {
return (isSet(propertyName) ? convert(propertyName, type) : defaultValue);
} | [
"protected",
"<",
"T",
">",
"T",
"defaultIfNotSet",
"(",
"String",
"propertyName",
",",
"T",
"defaultValue",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"(",
"isSet",
"(",
"propertyName",
")",
"?",
"convert",
"(",
"propertyName",
",",
"type"... | Defaults of the value for the named property if the property does not exist.
@param <T> {@link Class} type of the return value.
@param propertyName the name of the property to get.
@param defaultValue the default value to return if the named property does not exist.
@param type the desired {@link Class} type of the named property value.
@return the value of the named property as a instance of the specified {@link Class} type
or return the default value if the named property does not exist.
@see java.lang.Class
@see #isSet(String)
@see #convert(String, Class) | [
"Defaults",
"of",
"the",
"value",
"for",
"the",
"named",
"property",
"if",
"the",
"property",
"does",
"not",
"exist",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/PropertiesAdapter.java#L170-L172 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java | Apptentive.showMessageCenter | public static void showMessageCenter(Context context, Map<String, Object> customData) {
showMessageCenter(context, null, customData);
} | java | public static void showMessageCenter(Context context, Map<String, Object> customData) {
showMessageCenter(context, null, customData);
} | [
"public",
"static",
"void",
"showMessageCenter",
"(",
"Context",
"context",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"customData",
")",
"{",
"showMessageCenter",
"(",
"context",
",",
"null",
",",
"customData",
")",
";",
"}"
] | Opens the Apptentive Message Center UI Activity, and allows custom data to be sent with the
next message the user sends. If the user sends multiple messages, this data will only be sent
with the first message sent after this method is invoked. Additional invocations of this method
with custom data will repeat this process. If Message Center is closed without a message being
sent, the custom data is cleared. This task is performed asynchronously. Message Center
configuration may not have been downloaded yet when this is called. If you would like to know
whether this method was able to launch Message Center, use
{@link Apptentive#showMessageCenter(Context, BooleanCallback, Map)}.
@param context The context from which to launch the Message Center. This should be an
Activity, except in rare cases where you don't have access to one, in which
case Apptentive Message Center will launch in a new task.
@param customData A Map of String keys to Object values. Objects may be Strings, Numbers, or Booleans.
If any message is sent by the Person, this data is sent with it, and then
cleared. If no message is sent, this data is discarded. | [
"Opens",
"the",
"Apptentive",
"Message",
"Center",
"UI",
"Activity",
"and",
"allows",
"custom",
"data",
"to",
"be",
"sent",
"with",
"the",
"next",
"message",
"the",
"user",
"sends",
".",
"If",
"the",
"user",
"sends",
"multiple",
"messages",
"this",
"data",
... | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L931-L933 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/PointReducer.java | PointReducer.douglasPeuckerReduction | private static void douglasPeuckerReduction(ArrayList<GeoPoint> shape, boolean[] marked, double tolerance, int firstIdx, int lastIdx)
{
if (lastIdx <= firstIdx + 1) {
// overlapping indexes, just return
return;
}
// loop over the points between the first and last points
// and find the point that is the farthest away
double maxDistance = 0.0;
int indexFarthest = 0;
GeoPoint firstPoint = shape.get(firstIdx);
GeoPoint lastPoint = shape.get(lastIdx);
for (int idx = firstIdx + 1; idx < lastIdx; idx++) {
GeoPoint point = shape.get(idx);
double distance = orthogonalDistance(point, firstPoint, lastPoint);
// keep the point with the greatest distance
if (distance > maxDistance) {
maxDistance = distance;
indexFarthest = idx;
}
}
if (maxDistance > tolerance) {
//The farthest point is outside the tolerance: it is marked and the algorithm continues.
marked[indexFarthest] = true;
// reduce the shape between the starting point to newly found point
douglasPeuckerReduction(shape, marked, tolerance, firstIdx, indexFarthest);
// reduce the shape between the newly found point and the finishing point
douglasPeuckerReduction(shape, marked, tolerance, indexFarthest, lastIdx);
}
//else: the farthest point is within the tolerance, the whole segment is discarded.
} | java | private static void douglasPeuckerReduction(ArrayList<GeoPoint> shape, boolean[] marked, double tolerance, int firstIdx, int lastIdx)
{
if (lastIdx <= firstIdx + 1) {
// overlapping indexes, just return
return;
}
// loop over the points between the first and last points
// and find the point that is the farthest away
double maxDistance = 0.0;
int indexFarthest = 0;
GeoPoint firstPoint = shape.get(firstIdx);
GeoPoint lastPoint = shape.get(lastIdx);
for (int idx = firstIdx + 1; idx < lastIdx; idx++) {
GeoPoint point = shape.get(idx);
double distance = orthogonalDistance(point, firstPoint, lastPoint);
// keep the point with the greatest distance
if (distance > maxDistance) {
maxDistance = distance;
indexFarthest = idx;
}
}
if (maxDistance > tolerance) {
//The farthest point is outside the tolerance: it is marked and the algorithm continues.
marked[indexFarthest] = true;
// reduce the shape between the starting point to newly found point
douglasPeuckerReduction(shape, marked, tolerance, firstIdx, indexFarthest);
// reduce the shape between the newly found point and the finishing point
douglasPeuckerReduction(shape, marked, tolerance, indexFarthest, lastIdx);
}
//else: the farthest point is within the tolerance, the whole segment is discarded.
} | [
"private",
"static",
"void",
"douglasPeuckerReduction",
"(",
"ArrayList",
"<",
"GeoPoint",
">",
"shape",
",",
"boolean",
"[",
"]",
"marked",
",",
"double",
"tolerance",
",",
"int",
"firstIdx",
",",
"int",
"lastIdx",
")",
"{",
"if",
"(",
"lastIdx",
"<=",
"f... | Reduce the points in shape between the specified first and last
index. Mark the points to keep in marked[]
@param shape The original shape
@param marked The points to keep (marked as true)
@param tolerance The tolerance to determine if a point is kept
@param firstIdx The index in original shape's point of
the starting point for this line segment
@param lastIdx The index in original shape's point of
the ending point for this line segment | [
"Reduce",
"the",
"points",
"in",
"shape",
"between",
"the",
"specified",
"first",
"and",
"last",
"index",
".",
"Mark",
"the",
"points",
"to",
"keep",
"in",
"marked",
"[]"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/PointReducer.java#L84-L123 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/fastzipfilereader/ZipFileSliceReader.java | ZipFileSliceReader.getInt | static int getInt(final byte[] arr, final long off) throws IOException {
final int ioff = (int) off;
if (ioff < 0 || ioff > arr.length - 4) {
throw new IndexOutOfBoundsException();
}
return ((arr[ioff + 3] & 0xff) << 24) //
| ((arr[ioff + 2] & 0xff) << 16) //
| ((arr[ioff + 1] & 0xff) << 8) //
| (arr[ioff] & 0xff);
} | java | static int getInt(final byte[] arr, final long off) throws IOException {
final int ioff = (int) off;
if (ioff < 0 || ioff > arr.length - 4) {
throw new IndexOutOfBoundsException();
}
return ((arr[ioff + 3] & 0xff) << 24) //
| ((arr[ioff + 2] & 0xff) << 16) //
| ((arr[ioff + 1] & 0xff) << 8) //
| (arr[ioff] & 0xff);
} | [
"static",
"int",
"getInt",
"(",
"final",
"byte",
"[",
"]",
"arr",
",",
"final",
"long",
"off",
")",
"throws",
"IOException",
"{",
"final",
"int",
"ioff",
"=",
"(",
"int",
")",
"off",
";",
"if",
"(",
"ioff",
"<",
"0",
"||",
"ioff",
">",
"arr",
"."... | Get an int from a byte array.
@param arr
the byte array
@param off
the offset to start reading from
@return the int
@throws IOException
if an I/O exception occurs. | [
"Get",
"an",
"int",
"from",
"a",
"byte",
"array",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/fastzipfilereader/ZipFileSliceReader.java#L194-L203 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java | AnnotationUtils.hasStereotype | protected boolean hasStereotype(Element element, String... stereotypes) {
return hasStereotype(element, Arrays.asList(stereotypes));
} | java | protected boolean hasStereotype(Element element, String... stereotypes) {
return hasStereotype(element, Arrays.asList(stereotypes));
} | [
"protected",
"boolean",
"hasStereotype",
"(",
"Element",
"element",
",",
"String",
"...",
"stereotypes",
")",
"{",
"return",
"hasStereotype",
"(",
"element",
",",
"Arrays",
".",
"asList",
"(",
"stereotypes",
")",
")",
";",
"}"
] | Return whether the given element is annotated with the given annotation stereotypes.
@param element The element
@param stereotypes The stereotypes
@return True if it is | [
"Return",
"whether",
"the",
"given",
"element",
"is",
"annotated",
"with",
"the",
"given",
"annotation",
"stereotypes",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java#L151-L153 |
tipsy/javalin | src/main/java/io/javalin/Javalin.java | Javalin.addHandler | public Javalin addHandler(@NotNull HandlerType httpMethod, @NotNull String path, @NotNull Handler handler) {
return addHandler(httpMethod, path, handler, new HashSet<>()); // no roles set for this route (open to everyone with default access manager)
} | java | public Javalin addHandler(@NotNull HandlerType httpMethod, @NotNull String path, @NotNull Handler handler) {
return addHandler(httpMethod, path, handler, new HashSet<>()); // no roles set for this route (open to everyone with default access manager)
} | [
"public",
"Javalin",
"addHandler",
"(",
"@",
"NotNull",
"HandlerType",
"httpMethod",
",",
"@",
"NotNull",
"String",
"path",
",",
"@",
"NotNull",
"Handler",
"handler",
")",
"{",
"return",
"addHandler",
"(",
"httpMethod",
",",
"path",
",",
"handler",
",",
"new... | Adds a request handler for the specified handlerType and path to the instance.
This is the method that all the verb-methods (get/post/put/etc) call.
@see <a href="https://javalin.io/documentation#handlers">Handlers in docs</a> | [
"Adds",
"a",
"request",
"handler",
"for",
"the",
"specified",
"handlerType",
"and",
"path",
"to",
"the",
"instance",
".",
"This",
"is",
"the",
"method",
"that",
"all",
"the",
"verb",
"-",
"methods",
"(",
"get",
"/",
"post",
"/",
"put",
"/",
"etc",
")",... | train | https://github.com/tipsy/javalin/blob/68b2f7592f237db1c2b597e645697eb75fdaee53/src/main/java/io/javalin/Javalin.java#L280-L282 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java | FindBugs.handleBugCategories | public static Set<String> handleBugCategories(String categories) {
// Parse list of bug categories
Set<String> categorySet = new HashSet<>();
StringTokenizer tok = new StringTokenizer(categories, ",");
while (tok.hasMoreTokens()) {
categorySet.add(tok.nextToken());
}
return categorySet;
} | java | public static Set<String> handleBugCategories(String categories) {
// Parse list of bug categories
Set<String> categorySet = new HashSet<>();
StringTokenizer tok = new StringTokenizer(categories, ",");
while (tok.hasMoreTokens()) {
categorySet.add(tok.nextToken());
}
return categorySet;
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"handleBugCategories",
"(",
"String",
"categories",
")",
"{",
"// Parse list of bug categories",
"Set",
"<",
"String",
">",
"categorySet",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"StringTokenizer",
"tok",
"=",
... | Process -bugCategories option.
@param categories
comma-separated list of bug categories
@return Set of categories to be used | [
"Process",
"-",
"bugCategories",
"option",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L305-L314 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java | WDataTableRenderer.paintRowSelectionElement | private void paintRowSelectionElement(final WDataTable table, final XmlStringBuilder xml) {
boolean multiple = table.getSelectMode() == SelectMode.MULTIPLE;
xml.appendTagOpen("ui:rowselection");
xml.appendOptionalAttribute("multiple", multiple, "true");
if (multiple) {
switch (table.getSelectAllMode()) {
case CONTROL:
xml.appendAttribute("selectAll", "control");
break;
case TEXT:
xml.appendAttribute("selectAll", "text");
break;
case NONE:
break;
default:
throw new SystemException("Unknown select-all mode: " + table.
getSelectAllMode());
}
}
xml.appendOptionalAttribute("groupName", table.getSelectGroup());
xml.appendEnd();
} | java | private void paintRowSelectionElement(final WDataTable table, final XmlStringBuilder xml) {
boolean multiple = table.getSelectMode() == SelectMode.MULTIPLE;
xml.appendTagOpen("ui:rowselection");
xml.appendOptionalAttribute("multiple", multiple, "true");
if (multiple) {
switch (table.getSelectAllMode()) {
case CONTROL:
xml.appendAttribute("selectAll", "control");
break;
case TEXT:
xml.appendAttribute("selectAll", "text");
break;
case NONE:
break;
default:
throw new SystemException("Unknown select-all mode: " + table.
getSelectAllMode());
}
}
xml.appendOptionalAttribute("groupName", table.getSelectGroup());
xml.appendEnd();
} | [
"private",
"void",
"paintRowSelectionElement",
"(",
"final",
"WDataTable",
"table",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"boolean",
"multiple",
"=",
"table",
".",
"getSelectMode",
"(",
")",
"==",
"SelectMode",
".",
"MULTIPLE",
";",
"xml",
".",
"a... | Paint the rowSelection aspects of the WDataTable.
@param table the WDataTable being rendered
@param xml the string builder in use | [
"Paint",
"the",
"rowSelection",
"aspects",
"of",
"the",
"WDataTable",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java#L159-L183 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbWrapper.java | RocksDbWrapper.openReadOnly | public static RocksDbWrapper openReadOnly(File directory) throws RocksDbException, IOException {
RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(directory, true);
rocksDbWrapper.init();
return rocksDbWrapper;
} | java | public static RocksDbWrapper openReadOnly(File directory) throws RocksDbException, IOException {
RocksDbWrapper rocksDbWrapper = new RocksDbWrapper(directory, true);
rocksDbWrapper.init();
return rocksDbWrapper;
} | [
"public",
"static",
"RocksDbWrapper",
"openReadOnly",
"(",
"File",
"directory",
")",
"throws",
"RocksDbException",
",",
"IOException",
"{",
"RocksDbWrapper",
"rocksDbWrapper",
"=",
"new",
"RocksDbWrapper",
"(",
"directory",
",",
"true",
")",
";",
"rocksDbWrapper",
"... | Open a {@link RocksDB} with default options in read-only mode.
@param directory
existing {@link RocksDB} data directory
@return
@throws RocksDBException
@throws IOException | [
"Open",
"a",
"{",
"@link",
"RocksDB",
"}",
"with",
"default",
"options",
"in",
"read",
"-",
"only",
"mode",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbWrapper.java#L53-L57 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/core/fs/Path.java | Path.hasWindowsDrive | private boolean hasWindowsDrive(String path, boolean slashed) {
if (!OperatingSystem.isWindows()) {
return false;
}
final int start = slashed ? 1 : 0;
return path.length() >= start + 2
&& (slashed ? path.charAt(0) == '/' : true)
&& path.charAt(start + 1) == ':'
&& ((path.charAt(start) >= 'A' && path.charAt(start) <= 'Z') || (path.charAt(start) >= 'a' && path
.charAt(start) <= 'z'));
} | java | private boolean hasWindowsDrive(String path, boolean slashed) {
if (!OperatingSystem.isWindows()) {
return false;
}
final int start = slashed ? 1 : 0;
return path.length() >= start + 2
&& (slashed ? path.charAt(0) == '/' : true)
&& path.charAt(start + 1) == ':'
&& ((path.charAt(start) >= 'A' && path.charAt(start) <= 'Z') || (path.charAt(start) >= 'a' && path
.charAt(start) <= 'z'));
} | [
"private",
"boolean",
"hasWindowsDrive",
"(",
"String",
"path",
",",
"boolean",
"slashed",
")",
"{",
"if",
"(",
"!",
"OperatingSystem",
".",
"isWindows",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"int",
"start",
"=",
"slashed",
"?",
"1",
... | Checks if the provided path string contains a windows drive letter.
@param path
the path to check
@param slashed
<code>true</code> to indicate the first character of the string is a slash, <code>false</code> otherwise
@return <code>true</code> if the path string contains a windows drive letter, <code>false</code> otherwise | [
"Checks",
"if",
"the",
"provided",
"path",
"string",
"contains",
"a",
"windows",
"drive",
"letter",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/core/fs/Path.java#L264-L274 |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java | EvaluatorManagerFactory.getNewEvaluatorManagerInstance | private EvaluatorManager getNewEvaluatorManagerInstance(final String id, final EvaluatorDescriptor desc) {
LOG.log(Level.FINEST, "Creating Evaluator Manager for Evaluator ID {0}", id);
final Injector child = this.injector.forkInjector();
try {
child.bindVolatileParameter(EvaluatorManager.EvaluatorIdentifier.class, id);
child.bindVolatileParameter(EvaluatorManager.EvaluatorDescriptorName.class, desc);
} catch (final BindException e) {
throw new RuntimeException("Unable to bind evaluator identifier and name.", e);
}
final EvaluatorManager result;
try {
result = child.getInstance(EvaluatorManager.class);
} catch (final InjectionException e) {
throw new RuntimeException("Unable to instantiate a new EvaluatorManager for Evaluator ID: " + id, e);
}
return result;
} | java | private EvaluatorManager getNewEvaluatorManagerInstance(final String id, final EvaluatorDescriptor desc) {
LOG.log(Level.FINEST, "Creating Evaluator Manager for Evaluator ID {0}", id);
final Injector child = this.injector.forkInjector();
try {
child.bindVolatileParameter(EvaluatorManager.EvaluatorIdentifier.class, id);
child.bindVolatileParameter(EvaluatorManager.EvaluatorDescriptorName.class, desc);
} catch (final BindException e) {
throw new RuntimeException("Unable to bind evaluator identifier and name.", e);
}
final EvaluatorManager result;
try {
result = child.getInstance(EvaluatorManager.class);
} catch (final InjectionException e) {
throw new RuntimeException("Unable to instantiate a new EvaluatorManager for Evaluator ID: " + id, e);
}
return result;
} | [
"private",
"EvaluatorManager",
"getNewEvaluatorManagerInstance",
"(",
"final",
"String",
"id",
",",
"final",
"EvaluatorDescriptor",
"desc",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Creating Evaluator Manager for Evaluator ID {0}\"",
",",
"id",
... | Helper method to create a new EvaluatorManager instance.
@param id identifier of the Evaluator
@param desc NodeDescriptor on which the Evaluator executes.
@return a new EvaluatorManager instance. | [
"Helper",
"method",
"to",
"create",
"a",
"new",
"EvaluatorManager",
"instance",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java#L100-L118 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java | ChunkAnnotationUtils.annotateChunkTokens | public static void annotateChunkTokens(CoreMap chunk, Class tokenChunkKey, Class tokenLabelKey)
{
List<CoreLabel> chunkTokens = chunk.get(CoreAnnotations.TokensAnnotation.class);
if (tokenLabelKey != null) {
String text = chunk.get(CoreAnnotations.TextAnnotation.class);
for (CoreLabel t: chunkTokens) {
t.set(tokenLabelKey, text);
}
}
if (tokenChunkKey != null) {
for (CoreLabel t: chunkTokens) {
t.set(tokenChunkKey, chunk);
}
}
} | java | public static void annotateChunkTokens(CoreMap chunk, Class tokenChunkKey, Class tokenLabelKey)
{
List<CoreLabel> chunkTokens = chunk.get(CoreAnnotations.TokensAnnotation.class);
if (tokenLabelKey != null) {
String text = chunk.get(CoreAnnotations.TextAnnotation.class);
for (CoreLabel t: chunkTokens) {
t.set(tokenLabelKey, text);
}
}
if (tokenChunkKey != null) {
for (CoreLabel t: chunkTokens) {
t.set(tokenChunkKey, chunk);
}
}
} | [
"public",
"static",
"void",
"annotateChunkTokens",
"(",
"CoreMap",
"chunk",
",",
"Class",
"tokenChunkKey",
",",
"Class",
"tokenLabelKey",
")",
"{",
"List",
"<",
"CoreLabel",
">",
"chunkTokens",
"=",
"chunk",
".",
"get",
"(",
"CoreAnnotations",
".",
"TokensAnnota... | Annotates tokens in chunk
@param chunk - CoreMap representing chunk (should have TextAnnotation and TokensAnnotation)
@param tokenChunkKey - If not null, each token is annotated with the chunk using this key
@param tokenLabelKey - If not null, each token is annotated with the text associated with the chunk using this key | [
"Annotates",
"tokens",
"in",
"chunk"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L583-L597 |
lazy-koala/java-toolkit | fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/copier/ValueFactory.java | ValueFactory.createValueArray | static Object createValueArray(Field targetField,Class<?> targetFieldType,Object targetObject,Object originValue){
if(originValue == null){
return null;
}
//获取数组实际容纳的的类型
Class<?> proxyType = targetFieldType.getComponentType();
Object[] originArray = (Object[]) originValue;
if(originArray.length == 0){
return null;
}
Object[] targetArray = (Object[]) Array.newInstance(proxyType, originArray.length);
for (int i = 0 ; i < originArray.length ; i ++) {
targetArray[i] = ValueCast.createValueCore(targetField,proxyType,targetObject,originArray[i]);
}
return targetArray;
} | java | static Object createValueArray(Field targetField,Class<?> targetFieldType,Object targetObject,Object originValue){
if(originValue == null){
return null;
}
//获取数组实际容纳的的类型
Class<?> proxyType = targetFieldType.getComponentType();
Object[] originArray = (Object[]) originValue;
if(originArray.length == 0){
return null;
}
Object[] targetArray = (Object[]) Array.newInstance(proxyType, originArray.length);
for (int i = 0 ; i < originArray.length ; i ++) {
targetArray[i] = ValueCast.createValueCore(targetField,proxyType,targetObject,originArray[i]);
}
return targetArray;
} | [
"static",
"Object",
"createValueArray",
"(",
"Field",
"targetField",
",",
"Class",
"<",
"?",
">",
"targetFieldType",
",",
"Object",
"targetObject",
",",
"Object",
"originValue",
")",
"{",
"if",
"(",
"originValue",
"==",
"null",
")",
"{",
"return",
"null",
";... | 处理类型是数组类型
<p>Function: createValueArray</p>
<p>Description: </p>
@author acexy@thankjava.com
@date 2015-1-27 下午4:30:29
@version 1.0
@param targetFieldType
@param targetObject
@param originValue
@return | [
"处理类型是数组类型",
"<p",
">",
"Function",
":",
"createValueArray<",
"/",
"p",
">",
"<p",
">",
"Description",
":",
"<",
"/",
"p",
">"
] | train | https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/copier/ValueFactory.java#L27-L42 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/model/labels/Label.java | Label.getKey | public static String getKey(String category, String name)
{
if(category != null && name != null)
return category+":"+name;
return null;
} | java | public static String getKey(String category, String name)
{
if(category != null && name != null)
return category+":"+name;
return null;
} | [
"public",
"static",
"String",
"getKey",
"(",
"String",
"category",
",",
"String",
"name",
")",
"{",
"if",
"(",
"category",
"!=",
"null",
"&&",
"name",
"!=",
"null",
")",
"return",
"category",
"+",
"\":\"",
"+",
"name",
";",
"return",
"null",
";",
"}"
] | Sets the key of the label from the name and category.
@param category The category of the label
@param name The name of the label
@return The key in the format "category:name" | [
"Sets",
"the",
"key",
"of",
"the",
"label",
"from",
"the",
"name",
"and",
"category",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/model/labels/Label.java#L123-L128 |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.hashContains | public static boolean hashContains(String hash, double lat, double lon) {
LatLong centre = decodeHash(hash);
return Math.abs(centre.getLat() - lat) <= heightDegrees(hash.length()) / 2
&& Math.abs(to180(centre.getLon() - lon)) <= widthDegrees(hash.length()) / 2;
} | java | public static boolean hashContains(String hash, double lat, double lon) {
LatLong centre = decodeHash(hash);
return Math.abs(centre.getLat() - lat) <= heightDegrees(hash.length()) / 2
&& Math.abs(to180(centre.getLon() - lon)) <= widthDegrees(hash.length()) / 2;
} | [
"public",
"static",
"boolean",
"hashContains",
"(",
"String",
"hash",
",",
"double",
"lat",
",",
"double",
"lon",
")",
"{",
"LatLong",
"centre",
"=",
"decodeHash",
"(",
"hash",
")",
";",
"return",
"Math",
".",
"abs",
"(",
"centre",
".",
"getLat",
"(",
... | Returns true if and only if the bounding box corresponding to the hash
contains the given lat and long.
@param hash
hash to test containment in
@param lat
latitude
@param lon
longitude
@return true if and only if the hash contains the given lat and long | [
"Returns",
"true",
"if",
"and",
"only",
"if",
"the",
"bounding",
"box",
"corresponding",
"to",
"the",
"hash",
"contains",
"the",
"given",
"lat",
"and",
"long",
"."
] | train | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L533-L537 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/RelationalPathBase.java | RelationalPathBase.ne | @Override
public BooleanExpression ne(Expression<? super T> right) {
if (right instanceof RelationalPath) {
return primaryKeyOperation(Ops.NE, primaryKey, ((RelationalPath) right).getPrimaryKey());
} else {
return super.ne(right);
}
} | java | @Override
public BooleanExpression ne(Expression<? super T> right) {
if (right instanceof RelationalPath) {
return primaryKeyOperation(Ops.NE, primaryKey, ((RelationalPath) right).getPrimaryKey());
} else {
return super.ne(right);
}
} | [
"@",
"Override",
"public",
"BooleanExpression",
"ne",
"(",
"Expression",
"<",
"?",
"super",
"T",
">",
"right",
")",
"{",
"if",
"(",
"right",
"instanceof",
"RelationalPath",
")",
"{",
"return",
"primaryKeyOperation",
"(",
"Ops",
".",
"NE",
",",
"primaryKey",
... | Compares the two relational paths using primary key columns
@param right rhs of the comparison
@return this != right | [
"Compares",
"the",
"two",
"relational",
"paths",
"using",
"primary",
"key",
"columns"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/RelationalPathBase.java#L186-L193 |
dita-ot/dita-ot | src/main/java/org/dita/dost/module/DebugAndFilterModule.java | DebugAndFilterModule.isOutFile | private static boolean isOutFile(final File filePathName, final File inputMap) {
final File relativePath = FileUtils.getRelativePath(inputMap.getAbsoluteFile(), filePathName.getAbsoluteFile());
return !(relativePath.getPath().length() == 0 || !relativePath.getPath().startsWith(".."));
} | java | private static boolean isOutFile(final File filePathName, final File inputMap) {
final File relativePath = FileUtils.getRelativePath(inputMap.getAbsoluteFile(), filePathName.getAbsoluteFile());
return !(relativePath.getPath().length() == 0 || !relativePath.getPath().startsWith(".."));
} | [
"private",
"static",
"boolean",
"isOutFile",
"(",
"final",
"File",
"filePathName",
",",
"final",
"File",
"inputMap",
")",
"{",
"final",
"File",
"relativePath",
"=",
"FileUtils",
".",
"getRelativePath",
"(",
"inputMap",
".",
"getAbsoluteFile",
"(",
")",
",",
"f... | Check if path falls outside start document directory
@param filePathName absolute path to test
@param inputMap absolute input map path
@return {@code true} if outside start directory, otherwise {@code false} | [
"Check",
"if",
"path",
"falls",
"outside",
"start",
"document",
"directory"
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/DebugAndFilterModule.java#L547-L550 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.startEnvironment | public void startEnvironment(String userName, String environmentId) {
startEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().last().body();
} | java | public void startEnvironment(String userName, String environmentId) {
startEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().last().body();
} | [
"public",
"void",
"startEnvironment",
"(",
"String",
"userName",
",",
"String",
"environmentId",
")",
"{",
"startEnvironmentWithServiceResponseAsync",
"(",
"userName",
",",
"environmentId",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(... | Starts an environment by starting all resources inside the environment. This operation can take a while to complete.
@param userName The name of the user.
@param environmentId The resourceId of the environment
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Starts",
"an",
"environment",
"by",
"starting",
"all",
"resources",
"inside",
"the",
"environment",
".",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L1082-L1084 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.getUserList | public UserListResult getUserList(int start, int count)
throws APIConnectionException, APIRequestException {
return _userClient.getUserList(start, count);
} | java | public UserListResult getUserList(int start, int count)
throws APIConnectionException, APIRequestException {
return _userClient.getUserList(start, count);
} | [
"public",
"UserListResult",
"getUserList",
"(",
"int",
"start",
",",
"int",
"count",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_userClient",
".",
"getUserList",
"(",
"start",
",",
"count",
")",
";",
"}"
] | Get user list
@param start The start index of the list
@param count The number that how many you want to get from list
@return User info list
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"user",
"list"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L203-L206 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/HistoryDTO.java | HistoryDTO.transformToDto | public static List<HistoryDTO> transformToDto(List<History> list) {
if (list == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
List<HistoryDTO> result = new ArrayList<HistoryDTO>();
for (History history : list) {
result.add(transformToDto(history));
}
return result;
} | java | public static List<HistoryDTO> transformToDto(List<History> list) {
if (list == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
List<HistoryDTO> result = new ArrayList<HistoryDTO>();
for (History history : list) {
result.add(transformToDto(history));
}
return result;
} | [
"public",
"static",
"List",
"<",
"HistoryDTO",
">",
"transformToDto",
"(",
"List",
"<",
"History",
">",
"list",
")",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"\"Null entity object cannot be converted to Dto ob... | Converts a list of history entities to DTOs.
@param list The list of entities.
@return The list of DTOs.
@throws WebApplicationException If an error occurs. | [
"Converts",
"a",
"list",
"of",
"history",
"entities",
"to",
"DTOs",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/HistoryDTO.java#L101-L112 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201808/activityservice/GetActiveActivities.java | GetActiveActivities.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
ActivityServiceInterface activityService =
adManagerServices.get(session, ActivityServiceInterface.class);
// Create a statement to select activities.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", ActivityStatus.ACTIVE.toString());
// Retrieve a small amount of activities at a time, paging through
// until all activities have been retrieved.
int totalResultSetSize = 0;
do {
ActivityPage page =
activityService.getActivitiesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each activity.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Activity activity : page.getResults()) {
System.out.printf(
"%d) Activity with ID %d, name '%s', and type '%s' was found.%n",
i++,
activity.getId(),
activity.getName(),
activity.getType()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
ActivityServiceInterface activityService =
adManagerServices.get(session, ActivityServiceInterface.class);
// Create a statement to select activities.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", ActivityStatus.ACTIVE.toString());
// Retrieve a small amount of activities at a time, paging through
// until all activities have been retrieved.
int totalResultSetSize = 0;
do {
ActivityPage page =
activityService.getActivitiesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each activity.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Activity activity : page.getResults()) {
System.out.printf(
"%d) Activity with ID %d, name '%s', and type '%s' was found.%n",
i++,
activity.getId(),
activity.getName(),
activity.getType()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"ActivityServiceInterface",
"activityService",
"=",
"adManagerServices",
".",
"get",
"(",
"session",
",",
... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/activityservice/GetActiveActivities.java#L52-L90 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java | PublicanPODocBookBuilder.processPOTopicBugLink | protected void processPOTopicBugLink(final POBuildData buildData, final SpecTopic specTopic,
final Map<String, TranslationDetails> translations) throws BuildProcessingException {
try {
final DocBookXMLPreProcessor preProcessor = buildData.getXMLPreProcessor();
final String bugLinkUrl = preProcessor.getBugLinkUrl(buildData, specTopic);
processPOBugLinks(buildData, preProcessor, bugLinkUrl, translations);
} catch (BugLinkException e) {
throw new BuildProcessingException(e);
} catch (Exception e) {
throw new BuildProcessingException("Failed to insert Bug Links into the DOM Document", e);
}
} | java | protected void processPOTopicBugLink(final POBuildData buildData, final SpecTopic specTopic,
final Map<String, TranslationDetails> translations) throws BuildProcessingException {
try {
final DocBookXMLPreProcessor preProcessor = buildData.getXMLPreProcessor();
final String bugLinkUrl = preProcessor.getBugLinkUrl(buildData, specTopic);
processPOBugLinks(buildData, preProcessor, bugLinkUrl, translations);
} catch (BugLinkException e) {
throw new BuildProcessingException(e);
} catch (Exception e) {
throw new BuildProcessingException("Failed to insert Bug Links into the DOM Document", e);
}
} | [
"protected",
"void",
"processPOTopicBugLink",
"(",
"final",
"POBuildData",
"buildData",
",",
"final",
"SpecTopic",
"specTopic",
",",
"final",
"Map",
"<",
"String",
",",
"TranslationDetails",
">",
"translations",
")",
"throws",
"BuildProcessingException",
"{",
"try",
... | Add any bug link strings for a specific topic.
@param buildData Information and data structures for the build.
@param specTopic The spec topic to create any bug link translation strings for.
@param translations The mapping of original strings to translation strings, that will be used to build the po/pot files.
@throws BuildProcessingException Thrown if the bug links cannot be created. | [
"Add",
"any",
"bug",
"link",
"strings",
"for",
"a",
"specific",
"topic",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1250-L1262 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/MilestonesApi.java | MilestonesApi.getGroupMilestone | public Milestone getGroupMilestone(Object groupIdOrPath, Integer milestoneId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"groups", getGroupIdOrPath(groupIdOrPath), "milestones", milestoneId);
return (response.readEntity(Milestone.class));
} | java | public Milestone getGroupMilestone(Object groupIdOrPath, Integer milestoneId) throws GitLabApiException {
Response response = get(Response.Status.OK, getDefaultPerPageParam(),
"groups", getGroupIdOrPath(groupIdOrPath), "milestones", milestoneId);
return (response.readEntity(Milestone.class));
} | [
"public",
"Milestone",
"getGroupMilestone",
"(",
"Object",
"groupIdOrPath",
",",
"Integer",
"milestoneId",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"getDefaultPerPageParam",
"(",
... | Get the specified group milestone.
@param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance
@param milestoneId the ID of the milestone tp get
@return a Milestone instance for the specified IDs
@throws GitLabApiException if any exception occurs | [
"Get",
"the",
"specified",
"group",
"milestone",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/MilestonesApi.java#L131-L135 |
jenetics/jenetics | jenetics/src/main/java/io/jenetics/Phenotype.java | Phenotype.newInstance | @Deprecated
public Phenotype<G, C> newInstance(final Genotype<G> genotype) {
return of(genotype, _generation, _function, _scaler);
} | java | @Deprecated
public Phenotype<G, C> newInstance(final Genotype<G> genotype) {
return of(genotype, _generation, _function, _scaler);
} | [
"@",
"Deprecated",
"public",
"Phenotype",
"<",
"G",
",",
"C",
">",
"newInstance",
"(",
"final",
"Genotype",
"<",
"G",
">",
"genotype",
")",
"{",
"return",
"of",
"(",
"genotype",
",",
"_generation",
",",
"_function",
",",
"_scaler",
")",
";",
"}"
] | Create a new {@code Phenotype} with a different {@code Genotype} but the
same {@code generation}, fitness {@code function} and fitness
{@code scaler}.
@since 3.1
@param genotype the new genotype
@return a new {@code phenotype} with replaced {@code genotype}
@throws NullPointerException if the given {@code genotype} is {@code null}.
@deprecated Will be removed without replacement. Is not used. | [
"Create",
"a",
"new",
"{",
"@code",
"Phenotype",
"}",
"with",
"a",
"different",
"{",
"@code",
"Genotype",
"}",
"but",
"the",
"same",
"{",
"@code",
"generation",
"}",
"fitness",
"{",
"@code",
"function",
"}",
"and",
"fitness",
"{",
"@code",
"scaler",
"}",... | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/Phenotype.java#L308-L311 |
mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/RangeSelectorHelper.java | RangeSelectorHelper.onLongClick | public boolean onLongClick(int index, boolean selectItem) {
if (mLastLongPressIndex == null) {
// we only consider long presses on not selected items
if (mFastAdapter.getAdapterItem(index).isSelectable()) {
mLastLongPressIndex = index;
// we select this item as well
if (selectItem)
mFastAdapter.select(index);
if (mActionModeHelper != null)
mActionModeHelper.checkActionMode(null); // works with null as well, as the ActionMode is active for sure!
return true;
}
} else if (mLastLongPressIndex != index) {
// select all items in the range between the two long clicks
selectRange(mLastLongPressIndex, index, true);
// reset the index
mLastLongPressIndex = null;
}
return false;
} | java | public boolean onLongClick(int index, boolean selectItem) {
if (mLastLongPressIndex == null) {
// we only consider long presses on not selected items
if (mFastAdapter.getAdapterItem(index).isSelectable()) {
mLastLongPressIndex = index;
// we select this item as well
if (selectItem)
mFastAdapter.select(index);
if (mActionModeHelper != null)
mActionModeHelper.checkActionMode(null); // works with null as well, as the ActionMode is active for sure!
return true;
}
} else if (mLastLongPressIndex != index) {
// select all items in the range between the two long clicks
selectRange(mLastLongPressIndex, index, true);
// reset the index
mLastLongPressIndex = null;
}
return false;
} | [
"public",
"boolean",
"onLongClick",
"(",
"int",
"index",
",",
"boolean",
"selectItem",
")",
"{",
"if",
"(",
"mLastLongPressIndex",
"==",
"null",
")",
"{",
"// we only consider long presses on not selected items",
"if",
"(",
"mFastAdapter",
".",
"getAdapterItem",
"(",
... | will take care to save the long pressed index
or to select all items in the range between the current long pressed item and the last long pressed item
@param index the index of the long pressed item
@param selectItem true, if the item at the index should be selected, false if this was already done outside of this helper or is not desired
@return true, if the long press was handled | [
"will",
"take",
"care",
"to",
"save",
"the",
"long",
"pressed",
"index",
"or",
"to",
"select",
"all",
"items",
"in",
"the",
"range",
"between",
"the",
"current",
"long",
"pressed",
"item",
"and",
"the",
"last",
"long",
"pressed",
"item"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/RangeSelectorHelper.java#L95-L114 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/http/handler/ProxyHandler.java | ProxyHandler.sendForbid | protected void sendForbid(HttpRequest request, HttpResponse response, URI uri) throws IOException
{
response.sendError(HttpResponse.__403_Forbidden, "Forbidden for Proxy");
} | java | protected void sendForbid(HttpRequest request, HttpResponse response, URI uri) throws IOException
{
response.sendError(HttpResponse.__403_Forbidden, "Forbidden for Proxy");
} | [
"protected",
"void",
"sendForbid",
"(",
"HttpRequest",
"request",
",",
"HttpResponse",
"response",
",",
"URI",
"uri",
")",
"throws",
"IOException",
"{",
"response",
".",
"sendError",
"(",
"HttpResponse",
".",
"__403_Forbidden",
",",
"\"Forbidden for Proxy\"",
")",
... | Send Forbidden. Method called to send forbidden response. Default implementation calls
sendError(403) | [
"Send",
"Forbidden",
".",
"Method",
"called",
"to",
"send",
"forbidden",
"response",
".",
"Default",
"implementation",
"calls",
"sendError",
"(",
"403",
")"
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/handler/ProxyHandler.java#L616-L619 |
google/closure-templates | java/src/com/google/template/soy/internal/i18n/BidiFormatter.java | BidiFormatter.unicodeWrap | public String unicodeWrap(@Nullable Dir dir, String str, boolean isHtml) {
BidiWrappingText wrappingText = unicodeWrappingText(dir, str, isHtml);
return wrappingText.beforeText() + str + wrappingText.afterText();
} | java | public String unicodeWrap(@Nullable Dir dir, String str, boolean isHtml) {
BidiWrappingText wrappingText = unicodeWrappingText(dir, str, isHtml);
return wrappingText.beforeText() + str + wrappingText.afterText();
} | [
"public",
"String",
"unicodeWrap",
"(",
"@",
"Nullable",
"Dir",
"dir",
",",
"String",
"str",
",",
"boolean",
"isHtml",
")",
"{",
"BidiWrappingText",
"wrappingText",
"=",
"unicodeWrappingText",
"(",
"dir",
",",
"str",
",",
"isHtml",
")",
";",
"return",
"wrapp... | Formats a string of given directionality for use in plain-text output of the context
directionality, so an opposite-directionality string is neither garbled nor garbles its
surroundings. As opposed to {@link #spanWrap}, this makes use of Unicode bidi formatting
characters. In HTML, its *only* valid use is inside of elements that do not allow markup, e.g.
the 'option' and 'title' elements.
<p>The algorithm: In case the given directionality doesn't match the context directionality,
wraps the string with Unicode bidi formatting characters: RLE+{@code str}+PDF for RTL text, or
LRE+{@code str}+PDF for LTR text.
<p>Directionally isolates the string so that it does not garble its surroundings. Currently,
this is done by "resetting" the directionality after the string by appending a trailing Unicode
bidi mark matching the context directionality (LRM or RLM) when either the overall
directionality or the exit directionality of the string is opposite to that of the context.
Note that as opposed to the overall directionality, the entry and exit directionalities are
determined from the string itself.
<p>Does *not* do HTML-escaping regardless of the value of {@code isHtml}.
@param dir {@code str}'s directionality. If null, i.e. unknown, it is estimated.
@param str The input string
@param isHtml Whether {@code str} is HTML / HTML-escaped
@return Input string after applying the above processing. | [
"Formats",
"a",
"string",
"of",
"given",
"directionality",
"for",
"use",
"in",
"plain",
"-",
"text",
"output",
"of",
"the",
"context",
"directionality",
"so",
"an",
"opposite",
"-",
"directionality",
"string",
"is",
"neither",
"garbled",
"nor",
"garbles",
"its... | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/i18n/BidiFormatter.java#L181-L184 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java | BaseDataPublisher.publishMultiTaskData | private void publishMultiTaskData(WorkUnitState state, int branchId, Set<Path> writerOutputPathsMoved)
throws IOException {
publishData(state, branchId, false, writerOutputPathsMoved);
addLineageInfo(state, branchId);
} | java | private void publishMultiTaskData(WorkUnitState state, int branchId, Set<Path> writerOutputPathsMoved)
throws IOException {
publishData(state, branchId, false, writerOutputPathsMoved);
addLineageInfo(state, branchId);
} | [
"private",
"void",
"publishMultiTaskData",
"(",
"WorkUnitState",
"state",
",",
"int",
"branchId",
",",
"Set",
"<",
"Path",
">",
"writerOutputPathsMoved",
")",
"throws",
"IOException",
"{",
"publishData",
"(",
"state",
",",
"branchId",
",",
"false",
",",
"writerO... | This method publishes task output data for the given {@link WorkUnitState}, but if there are output data of
other tasks in the same folder, it may also publish those data. | [
"This",
"method",
"publishes",
"task",
"output",
"data",
"for",
"the",
"given",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/publisher/BaseDataPublisher.java#L380-L384 |
wisdom-framework/wisdom-jdbc | wisdom-jpa-manager/src/main/java/org/wisdom/framework/transaction/impl/XidFactoryImpl.java | XidFactoryImpl.createBranch | public Xid createBranch(Xid globalId, int branch) {
byte[] branchId = baseId.clone();
branchId[0] = (byte) branch;
branchId[1] = (byte) (branch >>> 8);
branchId[2] = (byte) (branch >>> 16);
branchId[3] = (byte) (branch >>> 24);
insertLong(start, branchId, 4);
return new XidImpl(globalId, branchId);
} | java | public Xid createBranch(Xid globalId, int branch) {
byte[] branchId = baseId.clone();
branchId[0] = (byte) branch;
branchId[1] = (byte) (branch >>> 8);
branchId[2] = (byte) (branch >>> 16);
branchId[3] = (byte) (branch >>> 24);
insertLong(start, branchId, 4);
return new XidImpl(globalId, branchId);
} | [
"public",
"Xid",
"createBranch",
"(",
"Xid",
"globalId",
",",
"int",
"branch",
")",
"{",
"byte",
"[",
"]",
"branchId",
"=",
"baseId",
".",
"clone",
"(",
")",
";",
"branchId",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"branch",
";",
"branchId",
"[",
"1"... | Create a branch Xid.
@param globalId the global Xid
@param branch the branch number
@return the new Xid. | [
"Create",
"a",
"branch",
"Xid",
"."
] | train | https://github.com/wisdom-framework/wisdom-jdbc/blob/931f5acf0b2bcb0a8f3b683d60d326caafd09a72/wisdom-jpa-manager/src/main/java/org/wisdom/framework/transaction/impl/XidFactoryImpl.java#L70-L78 |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.getRoleContainerForUser | public static IndexedContainer getRoleContainerForUser(CmsObject cms, CmsUser user, String captionPropertyName) {
IndexedContainer result = new IndexedContainer();
result.addContainerProperty(captionPropertyName, String.class, "");
try {
List<CmsRole> roles = OpenCms.getRoleManager().getRoles(cms, user.getOuFqn(), false);
CmsRole.applySystemRoleOrder(roles);
for (CmsRole role : roles) {
Item item = result.addItem(role);
item.getItemProperty(captionPropertyName).setValue(role.getDisplayName(cms, A_CmsUI.get().getLocale()));
}
} catch (CmsException e) {
LOG.error("Unabel to read roles for user", e);
}
return result;
} | java | public static IndexedContainer getRoleContainerForUser(CmsObject cms, CmsUser user, String captionPropertyName) {
IndexedContainer result = new IndexedContainer();
result.addContainerProperty(captionPropertyName, String.class, "");
try {
List<CmsRole> roles = OpenCms.getRoleManager().getRoles(cms, user.getOuFqn(), false);
CmsRole.applySystemRoleOrder(roles);
for (CmsRole role : roles) {
Item item = result.addItem(role);
item.getItemProperty(captionPropertyName).setValue(role.getDisplayName(cms, A_CmsUI.get().getLocale()));
}
} catch (CmsException e) {
LOG.error("Unabel to read roles for user", e);
}
return result;
} | [
"public",
"static",
"IndexedContainer",
"getRoleContainerForUser",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
",",
"String",
"captionPropertyName",
")",
"{",
"IndexedContainer",
"result",
"=",
"new",
"IndexedContainer",
"(",
")",
";",
"result",
".",
"addContai... | Returns the roles available for a given user.<p>
@param cms CmsObject
@param user to get available roles for
@param captionPropertyName name of caption property
@return indexed container | [
"Returns",
"the",
"roles",
"available",
"for",
"a",
"given",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L873-L888 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sharedprefs/transform/AbstractNumberPrefsTransform.java | AbstractNumberPrefsTransform.generateWriteProperty | @Override
public void generateWriteProperty(Builder methodBuilder, String editorName, TypeName beanClass, String beanName, PrefsProperty property) {
if (beanClass!=null)
{
methodBuilder.addCode("if ($L!=null) ", getter(beanName, beanClass, property));
methodBuilder.addCode("$L.putString($S,$L.$L() );", editorName, property.getPreferenceKey(), getter(beanName, beanClass, property), METHOD_CONVERSION);
methodBuilder.addCode(" else ");
methodBuilder.addCode("$L.putString($S, null);", editorName, property.getPreferenceKey());
} else {
methodBuilder.addCode("if ($L!=null) ", beanName);
methodBuilder.addCode("$L.putString($S,$L.$L());", editorName, property.getPreferenceKey(), beanName, METHOD_CONVERSION);
methodBuilder.addCode(" else ");
methodBuilder.addCode("$L.remove($S);", editorName, property.getPreferenceKey());
}
} | java | @Override
public void generateWriteProperty(Builder methodBuilder, String editorName, TypeName beanClass, String beanName, PrefsProperty property) {
if (beanClass!=null)
{
methodBuilder.addCode("if ($L!=null) ", getter(beanName, beanClass, property));
methodBuilder.addCode("$L.putString($S,$L.$L() );", editorName, property.getPreferenceKey(), getter(beanName, beanClass, property), METHOD_CONVERSION);
methodBuilder.addCode(" else ");
methodBuilder.addCode("$L.putString($S, null);", editorName, property.getPreferenceKey());
} else {
methodBuilder.addCode("if ($L!=null) ", beanName);
methodBuilder.addCode("$L.putString($S,$L.$L());", editorName, property.getPreferenceKey(), beanName, METHOD_CONVERSION);
methodBuilder.addCode(" else ");
methodBuilder.addCode("$L.remove($S);", editorName, property.getPreferenceKey());
}
} | [
"@",
"Override",
"public",
"void",
"generateWriteProperty",
"(",
"Builder",
"methodBuilder",
",",
"String",
"editorName",
",",
"TypeName",
"beanClass",
",",
"String",
"beanName",
",",
"PrefsProperty",
"property",
")",
"{",
"if",
"(",
"beanClass",
"!=",
"null",
"... | /* (non-Javadoc)
@see com.abubusoft.kripton.processor.sharedprefs.transform.PrefsTransform#generateWriteProperty(com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.sharedprefs.model.PrefsProperty) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sharedprefs/transform/AbstractNumberPrefsTransform.java#L99-L115 |
aws/aws-sdk-java | aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/CreateIdentityPoolRequest.java | CreateIdentityPoolRequest.withSupportedLoginProviders | public CreateIdentityPoolRequest withSupportedLoginProviders(java.util.Map<String, String> supportedLoginProviders) {
setSupportedLoginProviders(supportedLoginProviders);
return this;
} | java | public CreateIdentityPoolRequest withSupportedLoginProviders(java.util.Map<String, String> supportedLoginProviders) {
setSupportedLoginProviders(supportedLoginProviders);
return this;
} | [
"public",
"CreateIdentityPoolRequest",
"withSupportedLoginProviders",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"supportedLoginProviders",
")",
"{",
"setSupportedLoginProviders",
"(",
"supportedLoginProviders",
")",
";",
"return",
"this",
... | <p>
Optional key:value pairs mapping provider names to provider app IDs.
</p>
@param supportedLoginProviders
Optional key:value pairs mapping provider names to provider app IDs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Optional",
"key",
":",
"value",
"pairs",
"mapping",
"provider",
"names",
"to",
"provider",
"app",
"IDs",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/CreateIdentityPoolRequest.java#L213-L216 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.