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 |
|---|---|---|---|---|---|---|---|---|---|---|
CODAIT/stocator | src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java | COSAPIClient.isJobSuccessful | private boolean isJobSuccessful(String objectKey) {
LOG.trace("isJobSuccessful: for {}", objectKey);
if (mCachedSparkJobsStatus.containsKey(objectKey)) {
LOG.trace("isJobSuccessful: {} found cached", objectKey);
return mCachedSparkJobsStatus.get(objectKey).booleanValue();
}
String key = getRealKey(objectKey);
Path p = new Path(key, HADOOP_SUCCESS);
ObjectMetadata statusMetadata = getObjectMetadata(p.toString());
Boolean isJobOK = Boolean.FALSE;
if (statusMetadata != null) {
isJobOK = Boolean.TRUE;
}
LOG.debug("isJobSuccessful: not cached {}. Status is {}", objectKey, isJobOK);
mCachedSparkJobsStatus.put(objectKey, isJobOK);
return isJobOK.booleanValue();
} | java | private boolean isJobSuccessful(String objectKey) {
LOG.trace("isJobSuccessful: for {}", objectKey);
if (mCachedSparkJobsStatus.containsKey(objectKey)) {
LOG.trace("isJobSuccessful: {} found cached", objectKey);
return mCachedSparkJobsStatus.get(objectKey).booleanValue();
}
String key = getRealKey(objectKey);
Path p = new Path(key, HADOOP_SUCCESS);
ObjectMetadata statusMetadata = getObjectMetadata(p.toString());
Boolean isJobOK = Boolean.FALSE;
if (statusMetadata != null) {
isJobOK = Boolean.TRUE;
}
LOG.debug("isJobSuccessful: not cached {}. Status is {}", objectKey, isJobOK);
mCachedSparkJobsStatus.put(objectKey, isJobOK);
return isJobOK.booleanValue();
} | [
"private",
"boolean",
"isJobSuccessful",
"(",
"String",
"objectKey",
")",
"{",
"LOG",
".",
"trace",
"(",
"\"isJobSuccessful: for {}\"",
",",
"objectKey",
")",
";",
"if",
"(",
"mCachedSparkJobsStatus",
".",
"containsKey",
"(",
"objectKey",
")",
")",
"{",
"LOG",
... | Checks if container/object contains container/object/_SUCCESS If so, this
object was created by successful Hadoop job
@param objectKey
@return boolean if job is successful | [
"Checks",
"if",
"container",
"/",
"object",
"contains",
"container",
"/",
"object",
"/",
"_SUCCESS",
"If",
"so",
"this",
"object",
"was",
"created",
"by",
"successful",
"Hadoop",
"job"
] | train | https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java#L1058-L1074 |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java | Component.addParameter | public void addParameter(String key, Object value) {
if (key != null) {
Map<String, Object> params = getParameters();
if (value == null) params.remove(key);
else params.put(key, value);
}
} | java | public void addParameter(String key, Object value) {
if (key != null) {
Map<String, Object> params = getParameters();
if (value == null) params.remove(key);
else params.put(key, value);
}
} | [
"public",
"void",
"addParameter",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"key",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"getParameters",
"(",
")",
";",
"if",
"(",
"value",
"==",
"... | Adds the given key and value to this component's own parameter.
<p/>
If the provided key is <tt>null</tt> nothing happens. If the provided value is <tt>null</tt>
any existing parameter with the given key name is removed.
@param key
the key of the new parameter to add.
@param value
the value assoicated with the key. | [
"Adds",
"the",
"given",
"key",
"and",
"value",
"to",
"this",
"component",
"s",
"own",
"parameter",
".",
"<p",
"/",
">",
"If",
"the",
"provided",
"key",
"is",
"<tt",
">",
"null<",
"/",
"tt",
">",
"nothing",
"happens",
".",
"If",
"the",
"provided",
"va... | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java#L414-L420 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/clientlibs/processor/ProcessingVisitor.java | ProcessingVisitor.alreadyProcessed | @Override
protected void alreadyProcessed(ClientlibRef ref, VisitorMode mode, ClientlibResourceFolder folder) {
if (mode == EMBEDDED) {
LOG.warn("Trying to embed already embedded / dependency {} again at {}", ref, folder);
}
} | java | @Override
protected void alreadyProcessed(ClientlibRef ref, VisitorMode mode, ClientlibResourceFolder folder) {
if (mode == EMBEDDED) {
LOG.warn("Trying to embed already embedded / dependency {} again at {}", ref, folder);
}
} | [
"@",
"Override",
"protected",
"void",
"alreadyProcessed",
"(",
"ClientlibRef",
"ref",
",",
"VisitorMode",
"mode",
",",
"ClientlibResourceFolder",
"folder",
")",
"{",
"if",
"(",
"mode",
"==",
"EMBEDDED",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Trying to embed alrea... | Warns about everything that should be embedded, but is already processed, and not in this | [
"Warns",
"about",
"everything",
"that",
"should",
"be",
"embedded",
"but",
"is",
"already",
"processed",
"and",
"not",
"in",
"this"
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/processor/ProcessingVisitor.java#L87-L92 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java | WPartialDateField.getYear | public Integer getYear() {
String dateValue = getValue();
if (dateValue != null && dateValue.length() >= YEAR_END) {
return parseDateComponent(dateValue.substring(YEAR_START, YEAR_END), getPaddingChar());
} else {
return null;
}
} | java | public Integer getYear() {
String dateValue = getValue();
if (dateValue != null && dateValue.length() >= YEAR_END) {
return parseDateComponent(dateValue.substring(YEAR_START, YEAR_END), getPaddingChar());
} else {
return null;
}
} | [
"public",
"Integer",
"getYear",
"(",
")",
"{",
"String",
"dateValue",
"=",
"getValue",
"(",
")",
";",
"if",
"(",
"dateValue",
"!=",
"null",
"&&",
"dateValue",
".",
"length",
"(",
")",
">=",
"YEAR_END",
")",
"{",
"return",
"parseDateComponent",
"(",
"date... | Returns the year value.
@return the year, or null if unspecified. | [
"Returns",
"the",
"year",
"value",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java#L527-L535 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/model/SQLiteDatabaseSchema.java | SQLiteDatabaseSchema.checkName | private void checkName(Set<SQLProperty> listEntity, SQLProperty p) {
for (SQLProperty item : listEntity) {
AssertKripton.assertTrueOrInvalidPropertyName(item.columnName.equals(p.columnName), item, p);
}
} | java | private void checkName(Set<SQLProperty> listEntity, SQLProperty p) {
for (SQLProperty item : listEntity) {
AssertKripton.assertTrueOrInvalidPropertyName(item.columnName.equals(p.columnName), item, p);
}
} | [
"private",
"void",
"checkName",
"(",
"Set",
"<",
"SQLProperty",
">",
"listEntity",
",",
"SQLProperty",
"p",
")",
"{",
"for",
"(",
"SQLProperty",
"item",
":",
"listEntity",
")",
"{",
"AssertKripton",
".",
"assertTrueOrInvalidPropertyName",
"(",
"item",
".",
"co... | property in different class, but same name, must have same column name.
@param listEntity
the list entity
@param p
the p | [
"property",
"in",
"different",
"class",
"but",
"same",
"name",
"must",
"have",
"same",
"column",
"name",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/model/SQLiteDatabaseSchema.java#L384-L389 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java | HashtableOnDisk.writeEntry | private void writeEntry(HashtableEntry entry)
throws IOException, EOFException, FileManagerException, ClassNotFoundException {
long index = getHtindex(entry.index, entry.tableid);
if (index == 0) { // first one in this bucket
updateEntry(entry); // write to disk
writeHashIndex(entry.index, entry.location, entry.tableid); // update index
} else if (index == entry.location) { // replacing first entry
updateEntry(entry);
writeHashIndex(entry.index, entry.location, entry.tableid); // update index
} else { //
//
// If the entry has a "previous" pointer, then it was read earlier
// from disk. Otherwise, it is a brand new entry. If it is a brand
// entry, we write it to disk and chain at the front of the bucket.
// If "previous" is not zero, we check to see if reallocation is
// needed (location == 0). If not, we simply update on disk and we're
// done. If reallocation is needed we update on disk to do the allocation
// and call updatePointer to chain into the bucket.
//
if (entry.previous == 0) {
entry.next = index;
updateEntry(entry);
writeHashIndex(entry.index, entry.location, entry.tableid); // update index
} else {
if (entry.location == 0) { // allocation needed?
updateEntry(entry); // do allocation
updatePointer(entry.previous, entry.location); // chain in
} else {
updateEntry(entry); // no allocation, just update fields
}
}
}
} | java | private void writeEntry(HashtableEntry entry)
throws IOException, EOFException, FileManagerException, ClassNotFoundException {
long index = getHtindex(entry.index, entry.tableid);
if (index == 0) { // first one in this bucket
updateEntry(entry); // write to disk
writeHashIndex(entry.index, entry.location, entry.tableid); // update index
} else if (index == entry.location) { // replacing first entry
updateEntry(entry);
writeHashIndex(entry.index, entry.location, entry.tableid); // update index
} else { //
//
// If the entry has a "previous" pointer, then it was read earlier
// from disk. Otherwise, it is a brand new entry. If it is a brand
// entry, we write it to disk and chain at the front of the bucket.
// If "previous" is not zero, we check to see if reallocation is
// needed (location == 0). If not, we simply update on disk and we're
// done. If reallocation is needed we update on disk to do the allocation
// and call updatePointer to chain into the bucket.
//
if (entry.previous == 0) {
entry.next = index;
updateEntry(entry);
writeHashIndex(entry.index, entry.location, entry.tableid); // update index
} else {
if (entry.location == 0) { // allocation needed?
updateEntry(entry); // do allocation
updatePointer(entry.previous, entry.location); // chain in
} else {
updateEntry(entry); // no allocation, just update fields
}
}
}
} | [
"private",
"void",
"writeEntry",
"(",
"HashtableEntry",
"entry",
")",
"throws",
"IOException",
",",
"EOFException",
",",
"FileManagerException",
",",
"ClassNotFoundException",
"{",
"long",
"index",
"=",
"getHtindex",
"(",
"entry",
".",
"index",
",",
"entry",
".",
... | ************************************************************************
Common code to insert an entry into the hashtable.
*********************************************************************** | [
"************************************************************************",
"Common",
"code",
"to",
"insert",
"an",
"entry",
"into",
"the",
"hashtable",
".",
"***********************************************************************"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L1712-L1747 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/cache/TypeContainer.java | TypeContainer.asType | public StampedValue asType(final Type type) {
StampedValue cachedValue = null;
//looping around a list is probably quicker than having a map since there are probably only one or two different
//types in use at any one time
for (StampedValue value : typeCache) {
if (value.getType().equals(type)) {
cachedValue = value;
break;
}
}
if (cachedValue == null) {
StampedValue newValue = new StampedValue(type, this, config);
typeCache.add(newValue);
cachedValue = newValue;
}
return cachedValue;
} | java | public StampedValue asType(final Type type) {
StampedValue cachedValue = null;
//looping around a list is probably quicker than having a map since there are probably only one or two different
//types in use at any one time
for (StampedValue value : typeCache) {
if (value.getType().equals(type)) {
cachedValue = value;
break;
}
}
if (cachedValue == null) {
StampedValue newValue = new StampedValue(type, this, config);
typeCache.add(newValue);
cachedValue = newValue;
}
return cachedValue;
} | [
"public",
"StampedValue",
"asType",
"(",
"final",
"Type",
"type",
")",
"{",
"StampedValue",
"cachedValue",
"=",
"null",
";",
"//looping around a list is probably quicker than having a map since there are probably only one or two different",
"//types in use at any one time",
"for",
... | Check if a StampedValue already exists for the type, if it does, return it,
otherwise create a new one and add it
@param type
@return | [
"Check",
"if",
"a",
"StampedValue",
"already",
"exists",
"for",
"the",
"type",
"if",
"it",
"does",
"return",
"it",
"otherwise",
"create",
"a",
"new",
"one",
"and",
"add",
"it"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/archaius/cache/TypeContainer.java#L74-L93 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/report/ReportBreakScreen.java | ReportBreakScreen.printData | public boolean printData(PrintWriter out, int iPrintOptions)
{
this.setLastBreak(this.isBreak());
if (!this.isLastBreak())
return false;
if ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) != HtmlConstants.FOOTING_SCREEN)
this.setLastBreak(false); // For footers only
boolean bInputFound = super.printData(out, iPrintOptions);
return bInputFound;
} | java | public boolean printData(PrintWriter out, int iPrintOptions)
{
this.setLastBreak(this.isBreak());
if (!this.isLastBreak())
return false;
if ((iPrintOptions & HtmlConstants.FOOTING_SCREEN) != HtmlConstants.FOOTING_SCREEN)
this.setLastBreak(false); // For footers only
boolean bInputFound = super.printData(out, iPrintOptions);
return bInputFound;
} | [
"public",
"boolean",
"printData",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"this",
".",
"setLastBreak",
"(",
"this",
".",
"isBreak",
"(",
")",
")",
";",
"if",
"(",
"!",
"this",
".",
"isLastBreak",
"(",
")",
")",
"return",
"fals... | Print this field's data in XML format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception. | [
"Print",
"this",
"field",
"s",
"data",
"in",
"XML",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/report/ReportBreakScreen.java#L93-L104 |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/expressions/ExpressionResolver.java | ExpressionResolver.resolveGroupWindow | public LogicalWindow resolveGroupWindow(GroupWindow window) {
Expression alias = window.getAlias();
if (!(alias instanceof UnresolvedReferenceExpression)) {
throw new ValidationException("Alias of group window should be an UnresolvedFieldReference");
}
final String windowName = ((UnresolvedReferenceExpression) alias).getName();
List<Expression> resolvedTimeFieldExpression =
prepareExpressions(Collections.singletonList(window.getTimeField()));
if (resolvedTimeFieldExpression.size() != 1) {
throw new ValidationException("Group Window only supports a single time field column.");
}
PlannerExpression timeField = resolvedTimeFieldExpression.get(0).accept(bridgeConverter);
//TODO replace with LocalReferenceExpression
WindowReference resolvedAlias = new WindowReference(windowName, new Some<>(timeField.resultType()));
if (window instanceof TumbleWithSizeOnTimeWithAlias) {
TumbleWithSizeOnTimeWithAlias tw = (TumbleWithSizeOnTimeWithAlias) window;
return new TumblingGroupWindow(
resolvedAlias,
timeField,
resolveFieldsInSingleExpression(tw.getSize()).accept(bridgeConverter));
} else if (window instanceof SlideWithSizeAndSlideOnTimeWithAlias) {
SlideWithSizeAndSlideOnTimeWithAlias sw = (SlideWithSizeAndSlideOnTimeWithAlias) window;
return new SlidingGroupWindow(
resolvedAlias,
timeField,
resolveFieldsInSingleExpression(sw.getSize()).accept(bridgeConverter),
resolveFieldsInSingleExpression(sw.getSlide()).accept(bridgeConverter));
} else if (window instanceof SessionWithGapOnTimeWithAlias) {
SessionWithGapOnTimeWithAlias sw = (SessionWithGapOnTimeWithAlias) window;
return new SessionGroupWindow(
resolvedAlias,
timeField,
resolveFieldsInSingleExpression(sw.getGap()).accept(bridgeConverter));
} else {
throw new TableException("Unknown window type");
}
} | java | public LogicalWindow resolveGroupWindow(GroupWindow window) {
Expression alias = window.getAlias();
if (!(alias instanceof UnresolvedReferenceExpression)) {
throw new ValidationException("Alias of group window should be an UnresolvedFieldReference");
}
final String windowName = ((UnresolvedReferenceExpression) alias).getName();
List<Expression> resolvedTimeFieldExpression =
prepareExpressions(Collections.singletonList(window.getTimeField()));
if (resolvedTimeFieldExpression.size() != 1) {
throw new ValidationException("Group Window only supports a single time field column.");
}
PlannerExpression timeField = resolvedTimeFieldExpression.get(0).accept(bridgeConverter);
//TODO replace with LocalReferenceExpression
WindowReference resolvedAlias = new WindowReference(windowName, new Some<>(timeField.resultType()));
if (window instanceof TumbleWithSizeOnTimeWithAlias) {
TumbleWithSizeOnTimeWithAlias tw = (TumbleWithSizeOnTimeWithAlias) window;
return new TumblingGroupWindow(
resolvedAlias,
timeField,
resolveFieldsInSingleExpression(tw.getSize()).accept(bridgeConverter));
} else if (window instanceof SlideWithSizeAndSlideOnTimeWithAlias) {
SlideWithSizeAndSlideOnTimeWithAlias sw = (SlideWithSizeAndSlideOnTimeWithAlias) window;
return new SlidingGroupWindow(
resolvedAlias,
timeField,
resolveFieldsInSingleExpression(sw.getSize()).accept(bridgeConverter),
resolveFieldsInSingleExpression(sw.getSlide()).accept(bridgeConverter));
} else if (window instanceof SessionWithGapOnTimeWithAlias) {
SessionWithGapOnTimeWithAlias sw = (SessionWithGapOnTimeWithAlias) window;
return new SessionGroupWindow(
resolvedAlias,
timeField,
resolveFieldsInSingleExpression(sw.getGap()).accept(bridgeConverter));
} else {
throw new TableException("Unknown window type");
}
} | [
"public",
"LogicalWindow",
"resolveGroupWindow",
"(",
"GroupWindow",
"window",
")",
"{",
"Expression",
"alias",
"=",
"window",
".",
"getAlias",
"(",
")",
";",
"if",
"(",
"!",
"(",
"alias",
"instanceof",
"UnresolvedReferenceExpression",
")",
")",
"{",
"throw",
... | Converts an API class to a logical window for planning with expressions already resolved.
@param window window to resolve
@return logical window with expressions resolved | [
"Converts",
"an",
"API",
"class",
"to",
"a",
"logical",
"window",
"for",
"planning",
"with",
"expressions",
"already",
"resolved",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/expressions/ExpressionResolver.java#L156-L196 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/bond/Bond.java | Bond.getAccruedInterest | public double getAccruedInterest(double time, AnalyticModel model) {
LocalDate date= FloatingpointDate.getDateFromFloatingPointDate(schedule.getReferenceDate(), time);
return getAccruedInterest(date, model);
} | java | public double getAccruedInterest(double time, AnalyticModel model) {
LocalDate date= FloatingpointDate.getDateFromFloatingPointDate(schedule.getReferenceDate(), time);
return getAccruedInterest(date, model);
} | [
"public",
"double",
"getAccruedInterest",
"(",
"double",
"time",
",",
"AnalyticModel",
"model",
")",
"{",
"LocalDate",
"date",
"=",
"FloatingpointDate",
".",
"getDateFromFloatingPointDate",
"(",
"schedule",
".",
"getReferenceDate",
"(",
")",
",",
"time",
")",
";",... | Returns the accrued interest of the bond for a given time.
@param time The time of interest as double.
@param model The model under which the product is valued.
@return The accrued interest. | [
"Returns",
"the",
"accrued",
"interest",
"of",
"the",
"bond",
"for",
"a",
"given",
"time",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L324-L327 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.loadClass | @SuppressWarnings("unchecked")
public static <T> Class<T> loadClass(String fullyQualifiedClassName, boolean initialize, ClassLoader classLoader) {
try {
return (Class<T>) Class.forName(fullyQualifiedClassName, initialize, classLoader);
}
catch (ClassNotFoundException | NoClassDefFoundError cause) {
throw new TypeNotFoundException(String.format("Class [%s] was not found", fullyQualifiedClassName), cause);
}
} | java | @SuppressWarnings("unchecked")
public static <T> Class<T> loadClass(String fullyQualifiedClassName, boolean initialize, ClassLoader classLoader) {
try {
return (Class<T>) Class.forName(fullyQualifiedClassName, initialize, classLoader);
}
catch (ClassNotFoundException | NoClassDefFoundError cause) {
throw new TypeNotFoundException(String.format("Class [%s] was not found", fullyQualifiedClassName), cause);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"loadClass",
"(",
"String",
"fullyQualifiedClassName",
",",
"boolean",
"initialize",
",",
"ClassLoader",
"classLoader",
")",
"{",
"try",
"{",
"return... | Loads the Class object for the specified, fully qualified class name using the provided ClassLoader and the option
to initialize the class (calling any static initializers) once loaded.
@param <T> {@link Class} type of T.
@param fullyQualifiedClassName a String indicating the fully qualified class name of the Class to load.
@param initialize a boolean value indicating whether to initialize the class after loading.
@param classLoader the ClassLoader used to load the class.
@return a Class object for the specified, fully-qualified class name.
@throws TypeNotFoundException if the Class identified by the fully qualified class name could not be found.
@see java.lang.Class#forName(String, boolean, ClassLoader) | [
"Loads",
"the",
"Class",
"object",
"for",
"the",
"specified",
"fully",
"qualified",
"class",
"name",
"using",
"the",
"provided",
"ClassLoader",
"and",
"the",
"option",
"to",
"initialize",
"the",
"class",
"(",
"calling",
"any",
"static",
"initializers",
")",
"o... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L757-L766 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java | ModuleSummaryBuilder.buildModuleDoc | public void buildModuleDoc(XMLNode node, Content contentTree) throws DocletException {
contentTree = moduleWriter.getModuleHeader(mdle.getQualifiedName().toString());
buildChildren(node, contentTree);
moduleWriter.addModuleFooter(contentTree);
moduleWriter.printDocument(contentTree);
utils.copyDirectory(mdle, DocPaths.moduleSummary(mdle));
} | java | public void buildModuleDoc(XMLNode node, Content contentTree) throws DocletException {
contentTree = moduleWriter.getModuleHeader(mdle.getQualifiedName().toString());
buildChildren(node, contentTree);
moduleWriter.addModuleFooter(contentTree);
moduleWriter.printDocument(contentTree);
utils.copyDirectory(mdle, DocPaths.moduleSummary(mdle));
} | [
"public",
"void",
"buildModuleDoc",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"throws",
"DocletException",
"{",
"contentTree",
"=",
"moduleWriter",
".",
"getModuleHeader",
"(",
"mdle",
".",
"getQualifiedName",
"(",
")",
".",
"toString",
"(",
")... | Build the module documentation.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation | [
"Build",
"the",
"module",
"documentation",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java#L133-L139 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java | AbstractElementVisitor6.visitModule | @Override
public R visitModule(ModuleElement e, P p) {
// Use implementation from interface default method
return ElementVisitor.super.visitModule(e, p);
} | java | @Override
public R visitModule(ModuleElement e, P p) {
// Use implementation from interface default method
return ElementVisitor.super.visitModule(e, p);
} | [
"@",
"Override",
"public",
"R",
"visitModule",
"(",
"ModuleElement",
"e",
",",
"P",
"p",
")",
"{",
"// Use implementation from interface default method",
"return",
"ElementVisitor",
".",
"super",
".",
"visitModule",
"(",
"e",
",",
"p",
")",
";",
"}"
] | {@inheritDoc}
@implSpec Visits a {@code ModuleElement} by calling {@code
visitUnknown}.
@param e {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code visitUnknown}
@since 9
@spec JPMS | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java#L141-L145 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_ssl_certkey.java | mps_ssl_certkey.add | public static mps_ssl_certkey add(nitro_service client, mps_ssl_certkey resource) throws Exception
{
resource.validate("add");
return ((mps_ssl_certkey[]) resource.perform_operation(client, "add"))[0];
} | java | public static mps_ssl_certkey add(nitro_service client, mps_ssl_certkey resource) throws Exception
{
resource.validate("add");
return ((mps_ssl_certkey[]) resource.perform_operation(client, "add"))[0];
} | [
"public",
"static",
"mps_ssl_certkey",
"add",
"(",
"nitro_service",
"client",
",",
"mps_ssl_certkey",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"add\"",
")",
";",
"return",
"(",
"(",
"mps_ssl_certkey",
"[",
"]",
")",
"res... | <pre>
Use this operation to install certificate on Management Service.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"install",
"certificate",
"on",
"Management",
"Service",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_ssl_certkey.java#L301-L305 |
pryzach/midao | midao-jdbc-dbcp-1-4/src/main/java/org/midao/jdbc/core/pool/MjdbcPoolBinder.java | MjdbcPoolBinder.createDataSource | public static DataSource createDataSource(String url, String userName, String password) throws SQLException {
assertNotNull(url);
assertNotNull(userName);
assertNotNull(password);
BasicDataSource ds = new BasicDataSource();
ds.setUrl(url);
ds.setUsername(userName);
ds.setPassword(password);
return ds;
} | java | public static DataSource createDataSource(String url, String userName, String password) throws SQLException {
assertNotNull(url);
assertNotNull(userName);
assertNotNull(password);
BasicDataSource ds = new BasicDataSource();
ds.setUrl(url);
ds.setUsername(userName);
ds.setPassword(password);
return ds;
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"String",
"url",
",",
"String",
"userName",
",",
"String",
"password",
")",
"throws",
"SQLException",
"{",
"assertNotNull",
"(",
"url",
")",
";",
"assertNotNull",
"(",
"userName",
")",
";",
"assertNotNul... | Returns new Pooled {@link DataSource} implementation
<p/>
In case this function won't work - use {@link #createDataSource(java.util.Properties)}
@param url Database connection url
@param userName Database user name
@param password Database user password
@return new Pooled {@link DataSource} implementation
@throws SQLException | [
"Returns",
"new",
"Pooled",
"{",
"@link",
"DataSource",
"}",
"implementation",
"<p",
"/",
">",
"In",
"case",
"this",
"function",
"won",
"t",
"work",
"-",
"use",
"{",
"@link",
"#createDataSource",
"(",
"java",
".",
"util",
".",
"Properties",
")",
"}"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-dbcp-1-4/src/main/java/org/midao/jdbc/core/pool/MjdbcPoolBinder.java#L78-L89 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/io/Files.java | Files.readFileToString | public static String readFileToString(File file, Charset charset) throws IOException {
InputStream in = null;
try {
in = new FileInputStream(file);
StringBuilderWriter sw = new StringBuilderWriter();
if (null == charset) IOs.copy(new InputStreamReader(in), sw);
else IOs.copy(new InputStreamReader(in, charset.name()), sw);
return sw.toString();
} finally {
IOs.close(in);
}
} | java | public static String readFileToString(File file, Charset charset) throws IOException {
InputStream in = null;
try {
in = new FileInputStream(file);
StringBuilderWriter sw = new StringBuilderWriter();
if (null == charset) IOs.copy(new InputStreamReader(in), sw);
else IOs.copy(new InputStreamReader(in, charset.name()), sw);
return sw.toString();
} finally {
IOs.close(in);
}
} | [
"public",
"static",
"String",
"readFileToString",
"(",
"File",
"file",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"StringBuilder... | Reads the contents of a file into a String.
The file is always closed. | [
"Reads",
"the",
"contents",
"of",
"a",
"file",
"into",
"a",
"String",
".",
"The",
"file",
"is",
"always",
"closed",
"."
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/io/Files.java#L57-L70 |
graphhopper/map-matching | matching-web/src/main/java/com/graphhopper/matching/cli/MeasurementCommand.java | MeasurementCommand.printLocationIndexMatchQuery | private void printLocationIndexMatchQuery(final LocationIndexTree idx) {
final double latDelta = bbox.maxLat - bbox.minLat;
final double lonDelta = bbox.maxLon - bbox.minLon;
final Random rand = new Random(seed);
MiniPerfTest miniPerf = new MiniPerfTest() {
@Override
public int doCalc(boolean warmup, int run) {
double lat = rand.nextDouble() * latDelta + bbox.minLat;
double lon = rand.nextDouble() * lonDelta + bbox.minLon;
return idx.findNClosest(lat, lon, EdgeFilter.ALL_EDGES, rand.nextDouble() * 500).size();
}
}.setIterations(count).start();
print("location_index_match", miniPerf);
} | java | private void printLocationIndexMatchQuery(final LocationIndexTree idx) {
final double latDelta = bbox.maxLat - bbox.minLat;
final double lonDelta = bbox.maxLon - bbox.minLon;
final Random rand = new Random(seed);
MiniPerfTest miniPerf = new MiniPerfTest() {
@Override
public int doCalc(boolean warmup, int run) {
double lat = rand.nextDouble() * latDelta + bbox.minLat;
double lon = rand.nextDouble() * lonDelta + bbox.minLon;
return idx.findNClosest(lat, lon, EdgeFilter.ALL_EDGES, rand.nextDouble() * 500).size();
}
}.setIterations(count).start();
print("location_index_match", miniPerf);
} | [
"private",
"void",
"printLocationIndexMatchQuery",
"(",
"final",
"LocationIndexTree",
"idx",
")",
"{",
"final",
"double",
"latDelta",
"=",
"bbox",
".",
"maxLat",
"-",
"bbox",
".",
"minLat",
";",
"final",
"double",
"lonDelta",
"=",
"bbox",
".",
"maxLon",
"-",
... | Test the performance of finding candidate points for the index (which is run for every GPX
entry). | [
"Test",
"the",
"performance",
"of",
"finding",
"candidate",
"points",
"for",
"the",
"index",
"(",
"which",
"is",
"run",
"for",
"every",
"GPX",
"entry",
")",
"."
] | train | https://github.com/graphhopper/map-matching/blob/32cd83f14cb990c2be83c8781f22dfb59e0dbeb4/matching-web/src/main/java/com/graphhopper/matching/cli/MeasurementCommand.java#L145-L158 |
sirensolutions/siren-join | src/main/java/solutions/siren/join/common/Bytes.java | Bytes.readBytesRef | public final static void readBytesRef(BytesRef src, BytesRef dst) {
int length = Bytes.readVInt(src);
if (length == 0) {
dst.offset = dst.length = 0;
return;
}
if (dst.bytes.length < length) {
dst.bytes = new byte[length];
}
System.arraycopy(src.bytes, src.offset, dst.bytes, 0, length);
src.offset += length;
dst.offset = 0;
dst.length = length;
} | java | public final static void readBytesRef(BytesRef src, BytesRef dst) {
int length = Bytes.readVInt(src);
if (length == 0) {
dst.offset = dst.length = 0;
return;
}
if (dst.bytes.length < length) {
dst.bytes = new byte[length];
}
System.arraycopy(src.bytes, src.offset, dst.bytes, 0, length);
src.offset += length;
dst.offset = 0;
dst.length = length;
} | [
"public",
"final",
"static",
"void",
"readBytesRef",
"(",
"BytesRef",
"src",
",",
"BytesRef",
"dst",
")",
"{",
"int",
"length",
"=",
"Bytes",
".",
"readVInt",
"(",
"src",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"dst",
".",
"offset",
"=",
... | Decodes a {@link BytesRef} from another {@link BytesRef}.
@see Bytes#writeBytesRef(BytesRef, BytesRef) | [
"Decodes",
"a",
"{"
] | train | https://github.com/sirensolutions/siren-join/blob/cba1111b209ce6f72ab7750d5488a573a6c77fe5/src/main/java/solutions/siren/join/common/Bytes.java#L148-L165 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.trimEnd | @Nullable
@CheckReturnValue
public static String trimEnd (@Nullable final String sSrc, @Nullable final String sTail)
{
return endsWith (sSrc, sTail) ? sSrc.substring (0, sSrc.length () - sTail.length ()) : sSrc;
} | java | @Nullable
@CheckReturnValue
public static String trimEnd (@Nullable final String sSrc, @Nullable final String sTail)
{
return endsWith (sSrc, sTail) ? sSrc.substring (0, sSrc.length () - sTail.length ()) : sSrc;
} | [
"@",
"Nullable",
"@",
"CheckReturnValue",
"public",
"static",
"String",
"trimEnd",
"(",
"@",
"Nullable",
"final",
"String",
"sSrc",
",",
"@",
"Nullable",
"final",
"String",
"sTail",
")",
"{",
"return",
"endsWith",
"(",
"sSrc",
",",
"sTail",
")",
"?",
"sSrc... | Trim the passed tail from the source value. If the source value does not end
with the passed tail, nothing happens.
@param sSrc
The input source string
@param sTail
The string to be trimmed of the end
@return The trimmed string, or the original input string, if the tail was not
found
@see #trimStart(String, String)
@see #trimStartAndEnd(String, String)
@see #trimStartAndEnd(String, String, String) | [
"Trim",
"the",
"passed",
"tail",
"from",
"the",
"source",
"value",
".",
"If",
"the",
"source",
"value",
"does",
"not",
"end",
"with",
"the",
"passed",
"tail",
"nothing",
"happens",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3376-L3381 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/DirectoryScannerActor.java | DirectoryScannerActor.internalActorOf | private <T> T internalActorOf(final Class<T> protocol, final Address address) {
final Actor actor = directory.actorOf(address);
try {
if (actor != null) {
return stage().actorAs(actor, protocol);
} else {
logger().log("Actor with address: " + address + " not found; protocol is: " + protocol.getName());
}
} catch (Exception e) {
logger().log("Error providing protocol: " + protocol.getName() + " for actor with address: " + address, e);
}
return null;
} | java | private <T> T internalActorOf(final Class<T> protocol, final Address address) {
final Actor actor = directory.actorOf(address);
try {
if (actor != null) {
return stage().actorAs(actor, protocol);
} else {
logger().log("Actor with address: " + address + " not found; protocol is: " + protocol.getName());
}
} catch (Exception e) {
logger().log("Error providing protocol: " + protocol.getName() + " for actor with address: " + address, e);
}
return null;
} | [
"private",
"<",
"T",
">",
"T",
"internalActorOf",
"(",
"final",
"Class",
"<",
"T",
">",
"protocol",
",",
"final",
"Address",
"address",
")",
"{",
"final",
"Actor",
"actor",
"=",
"directory",
".",
"actorOf",
"(",
"address",
")",
";",
"try",
"{",
"if",
... | Answer the actor as the {@code protocol} or {@code null}.
@param protocol the {@code Class<T>} of the protocol that the actor must support
@param address the {@code Address} of the actor to find
@param T the protocol type
@return T | [
"Answer",
"the",
"actor",
"as",
"the",
"{"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/DirectoryScannerActor.java#L46-L59 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java | DatabasesInner.exportAsync | public Observable<ImportExportResponseInner> exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) {
return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<ImportExportResponseInner>, ImportExportResponseInner>() {
@Override
public ImportExportResponseInner call(ServiceResponse<ImportExportResponseInner> response) {
return response.body();
}
});
} | java | public Observable<ImportExportResponseInner> exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) {
return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<ImportExportResponseInner>, ImportExportResponseInner>() {
@Override
public ImportExportResponseInner call(ServiceResponse<ImportExportResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImportExportResponseInner",
">",
"exportAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"ExportRequest",
"parameters",
")",
"{",
"return",
"exportWithServiceResponseAsync",
"(",
"... | Exports a database to a bacpac.
@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 databaseName The name of the database to be exported.
@param parameters The required parameters for exporting a database.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Exports",
"a",
"database",
"to",
"a",
"bacpac",
"."
] | 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/DatabasesInner.java#L2127-L2134 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/MapELResolver.java | MapELResolver.getValue | @Override
public Object getValue(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException("context is null");
}
Object result = null;
if (isResolvable(base)) {
result = ((Map<?, ?>) base).get(property);
context.setPropertyResolved(true);
}
return result;
} | java | @Override
public Object getValue(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException("context is null");
}
Object result = null;
if (isResolvable(base)) {
result = ((Map<?, ?>) base).get(property);
context.setPropertyResolved(true);
}
return result;
} | [
"@",
"Override",
"public",
"Object",
"getValue",
"(",
"ELContext",
"context",
",",
"Object",
"base",
",",
"Object",
"property",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"context is null\"",
")",
"... | If the base object is a map, returns the value associated with the given key, as specified by
the property argument. If the key was not found, null is returned. If the base is a Map, the
propertyResolved property of the ELContext object must be set to true by this resolver,
before returning. If this property is not true after this method is called, the caller should
ignore the return value. Just as in java.util.Map.get(Object), just because null is returned
doesn't mean there is no mapping for the key; it's also possible that the Map explicitly maps
the key to null.
@param context
The context of this evaluation.
@param base
The map to analyze. Only bases of type Map are handled by this resolver.
@param property
The key to return the acceptable type for. Ignored by this resolver.
@return If the propertyResolved property of ELContext was set to true, then the value
associated with the given key or null if the key was not found. Otherwise, undefined.
@throws ClassCastException
if the key is of an inappropriate type for this map (optionally thrown by the
underlying Map).
@throws NullPointerException
if context is null, or if the key is null and this map does not permit null keys
(the latter is optionally thrown by the underlying Map).
@throws ELException
if an exception was thrown while performing the property or variable resolution.
The thrown exception must be included as the cause property of this exception, if
available. | [
"If",
"the",
"base",
"object",
"is",
"a",
"map",
"returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"specified",
"by",
"the",
"property",
"argument",
".",
"If",
"the",
"key",
"was",
"not",
"found",
"null",
"is",
"returned",
"."... | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/MapELResolver.java#L189-L200 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/ts/BaseChineseDictionary.java | BaseChineseDictionary.load | static boolean load(Map<String, String> storage, boolean reverse, String... pathArray)
{
StringDictionary dictionary = new StringDictionary("=");
for (String path : pathArray)
{
if (!dictionary.load(path)) return false;
}
if (reverse) dictionary = dictionary.reverse();
Set<Map.Entry<String, String>> entrySet = dictionary.entrySet();
for (Map.Entry<String, String> entry : entrySet)
{
storage.put(entry.getKey(), entry.getValue());
}
return true;
} | java | static boolean load(Map<String, String> storage, boolean reverse, String... pathArray)
{
StringDictionary dictionary = new StringDictionary("=");
for (String path : pathArray)
{
if (!dictionary.load(path)) return false;
}
if (reverse) dictionary = dictionary.reverse();
Set<Map.Entry<String, String>> entrySet = dictionary.entrySet();
for (Map.Entry<String, String> entry : entrySet)
{
storage.put(entry.getKey(), entry.getValue());
}
return true;
} | [
"static",
"boolean",
"load",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"storage",
",",
"boolean",
"reverse",
",",
"String",
"...",
"pathArray",
")",
"{",
"StringDictionary",
"dictionary",
"=",
"new",
"StringDictionary",
"(",
"\"=\"",
")",
";",
"for",
... | 读取词典
@param storage 储存空间
@param reverse 是否翻转键值对
@param pathArray 路径
@return 是否加载成功 | [
"读取词典"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/ts/BaseChineseDictionary.java#L75-L90 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase/src/main/java/com/impetus/client/hbase/HBaseClient.java | HBaseClient.getBatchSize | private void getBatchSize(String persistenceUnit, Map<String, Object> puProperties)
{
String batch_Size = puProperties != null ? (String) puProperties.get(PersistenceProperties.KUNDERA_BATCH_SIZE)
: null;
if (batch_Size != null)
{
setBatchSize(Integer.valueOf(batch_Size));
}
else
{
PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata,
persistenceUnit);
setBatchSize(puMetadata.getBatchSize());
}
} | java | private void getBatchSize(String persistenceUnit, Map<String, Object> puProperties)
{
String batch_Size = puProperties != null ? (String) puProperties.get(PersistenceProperties.KUNDERA_BATCH_SIZE)
: null;
if (batch_Size != null)
{
setBatchSize(Integer.valueOf(batch_Size));
}
else
{
PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata,
persistenceUnit);
setBatchSize(puMetadata.getBatchSize());
}
} | [
"private",
"void",
"getBatchSize",
"(",
"String",
"persistenceUnit",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"puProperties",
")",
"{",
"String",
"batch_Size",
"=",
"puProperties",
"!=",
"null",
"?",
"(",
"String",
")",
"puProperties",
".",
"get",
"(",... | Gets the batch size.
@param persistenceUnit
the persistence unit
@param puProperties
the pu properties
@return the batch size | [
"Gets",
"the",
"batch",
"size",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase/src/main/java/com/impetus/client/hbase/HBaseClient.java#L921-L935 |
spring-projects/spring-social | spring-social-config/src/main/java/org/springframework/social/config/support/ProviderConfigurationSupport.java | ProviderConfigurationSupport.getConnectionFactoryBeanDefinition | protected BeanDefinition getConnectionFactoryBeanDefinition(String appId, String appSecret, Map<String, Object> allAttributes) {
return BeanDefinitionBuilder.genericBeanDefinition(connectionFactoryClass).addConstructorArgValue(appId).addConstructorArgValue(appSecret).getBeanDefinition();
} | java | protected BeanDefinition getConnectionFactoryBeanDefinition(String appId, String appSecret, Map<String, Object> allAttributes) {
return BeanDefinitionBuilder.genericBeanDefinition(connectionFactoryClass).addConstructorArgValue(appId).addConstructorArgValue(appSecret).getBeanDefinition();
} | [
"protected",
"BeanDefinition",
"getConnectionFactoryBeanDefinition",
"(",
"String",
"appId",
",",
"String",
"appSecret",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"allAttributes",
")",
"{",
"return",
"BeanDefinitionBuilder",
".",
"genericBeanDefinition",
"(",
"co... | Creates a BeanDefinition for a provider connection factory.
Although most providers will not need to override this method, it does allow for overriding to address any provider-specific needs.
@param appId The application's App ID
@param appSecret The application's App Secret
@param allAttributes All attributes available on the configuration element. Useful for provider-specific configuration.
@return a BeanDefinition for the provider's connection factory bean. | [
"Creates",
"a",
"BeanDefinition",
"for",
"a",
"provider",
"connection",
"factory",
".",
"Although",
"most",
"providers",
"will",
"not",
"need",
"to",
"override",
"this",
"method",
"it",
"does",
"allow",
"for",
"overriding",
"to",
"address",
"any",
"provider",
... | train | https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-config/src/main/java/org/springframework/social/config/support/ProviderConfigurationSupport.java#L71-L73 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java | SpiderTransaction.addFieldReferences | public void addFieldReferences(TableDefinition tableDef, Collection<String> fieldNames) {
for (String fieldName : fieldNames) {
addColumn(SpiderService.termsStoreName(tableDef), FIELD_REGISTRY_ROW_KEY, fieldName);
}
} | java | public void addFieldReferences(TableDefinition tableDef, Collection<String> fieldNames) {
for (String fieldName : fieldNames) {
addColumn(SpiderService.termsStoreName(tableDef), FIELD_REGISTRY_ROW_KEY, fieldName);
}
} | [
"public",
"void",
"addFieldReferences",
"(",
"TableDefinition",
"tableDef",
",",
"Collection",
"<",
"String",
">",
"fieldNames",
")",
"{",
"for",
"(",
"String",
"fieldName",
":",
"fieldNames",
")",
"{",
"addColumn",
"(",
"SpiderService",
".",
"termsStoreName",
"... | Add a column to the "_fields" row belonging to the given table for the given scalar
field names. This row serves as a registry of scalar fields actually used by objects
in the table. Field references go in the Terms table using the format:
<pre>
_fields = {{field 1}:null, {field 2}:null, ...}
</pre>
@param tableDef Table that owns referenced fields.
@param fieldNames Scalar field names that received an update in the current
transaction. | [
"Add",
"a",
"column",
"to",
"the",
"_fields",
"row",
"belonging",
"to",
"the",
"given",
"table",
"for",
"the",
"given",
"scalar",
"field",
"names",
".",
"This",
"row",
"serves",
"as",
"a",
"registry",
"of",
"scalar",
"fields",
"actually",
"used",
"by",
"... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L239-L243 |
openengsb/openengsb | api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java | TransformationDescription.mapField | public void mapField(String sourceField, String targetField, Map<String, String> mapping) {
TransformationStep step = new TransformationStep();
step.setTargetField(targetField);
step.setSourceFields(sourceField);
step.setOperationParams(mapping);
step.setOperationName("map");
steps.add(step);
} | java | public void mapField(String sourceField, String targetField, Map<String, String> mapping) {
TransformationStep step = new TransformationStep();
step.setTargetField(targetField);
step.setSourceFields(sourceField);
step.setOperationParams(mapping);
step.setOperationName("map");
steps.add(step);
} | [
"public",
"void",
"mapField",
"(",
"String",
"sourceField",
",",
"String",
"targetField",
",",
"Map",
"<",
"String",
",",
"String",
">",
"mapping",
")",
"{",
"TransformationStep",
"step",
"=",
"new",
"TransformationStep",
"(",
")",
";",
"step",
".",
"setTarg... | Adds a map transformation step to the transformation description. The value of the source field is mapped based
on the mapping to another value which is forwarded to the target field. The values in the models need to be
working with the values of the mapping (e.g. assigning 'hello' to Integer field will not work). | [
"Adds",
"a",
"map",
"transformation",
"step",
"to",
"the",
"transformation",
"description",
".",
"The",
"value",
"of",
"the",
"source",
"field",
"is",
"mapped",
"based",
"on",
"the",
"mapping",
"to",
"another",
"value",
"which",
"is",
"forwarded",
"to",
"the... | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java#L125-L132 |
infinispan/infinispan | core/src/main/java/org/infinispan/expiration/impl/ExpirationManagerImpl.java | ExpirationManagerImpl.deleteFromStoresAndNotify | private void deleteFromStoresAndNotify(K key, V value, Metadata metadata) {
deleteFromStores(key);
CompletionStages.join(cacheNotifier.notifyCacheEntryExpired(key, value, metadata, null));
} | java | private void deleteFromStoresAndNotify(K key, V value, Metadata metadata) {
deleteFromStores(key);
CompletionStages.join(cacheNotifier.notifyCacheEntryExpired(key, value, metadata, null));
} | [
"private",
"void",
"deleteFromStoresAndNotify",
"(",
"K",
"key",
",",
"V",
"value",
",",
"Metadata",
"metadata",
")",
"{",
"deleteFromStores",
"(",
"key",
")",
";",
"CompletionStages",
".",
"join",
"(",
"cacheNotifier",
".",
"notifyCacheEntryExpired",
"(",
"key"... | Deletes the key from the store as well as notifies the cache listeners of the expiration of the given key,
value, metadata combination.
<p>
This method must be invoked while holding data container lock for the given key to ensure events are ordered
properly.
@param key
@param value
@param metadata | [
"Deletes",
"the",
"key",
"from",
"the",
"store",
"as",
"well",
"as",
"notifies",
"the",
"cache",
"listeners",
"of",
"the",
"expiration",
"of",
"the",
"given",
"key",
"value",
"metadata",
"combination",
".",
"<p",
">",
"This",
"method",
"must",
"be",
"invok... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/expiration/impl/ExpirationManagerImpl.java#L205-L208 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/SmartsheetFactory.java | SmartsheetFactory.createDefaultGovAccountClient | public static Smartsheet createDefaultGovAccountClient() {
String accessToken = System.getenv("SMARTSHEET_ACCESS_TOKEN");
SmartsheetImpl smartsheet = new SmartsheetImpl(GOV_BASE_URI, accessToken);
return smartsheet;
} | java | public static Smartsheet createDefaultGovAccountClient() {
String accessToken = System.getenv("SMARTSHEET_ACCESS_TOKEN");
SmartsheetImpl smartsheet = new SmartsheetImpl(GOV_BASE_URI, accessToken);
return smartsheet;
} | [
"public",
"static",
"Smartsheet",
"createDefaultGovAccountClient",
"(",
")",
"{",
"String",
"accessToken",
"=",
"System",
".",
"getenv",
"(",
"\"SMARTSHEET_ACCESS_TOKEN\"",
")",
";",
"SmartsheetImpl",
"smartsheet",
"=",
"new",
"SmartsheetImpl",
"(",
"GOV_BASE_URI",
",... | <p>Creates a Smartsheet client with default parameters using the Smartsheetgov URI.
SMARTSHEET_ACCESS_TOKEN must be set in the environment.</p>
@return the Smartsheet client | [
"<p",
">",
"Creates",
"a",
"Smartsheet",
"client",
"with",
"default",
"parameters",
"using",
"the",
"Smartsheetgov",
"URI",
".",
"SMARTSHEET_ACCESS_TOKEN",
"must",
"be",
"set",
"in",
"the",
"environment",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/SmartsheetFactory.java#L71-L75 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/model/Item.java | Item.setTitle | public final void setTitle(@NonNull final Context context, @StringRes final int resourceId) {
Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
setTitle(context.getText(resourceId));
} | java | public final void setTitle(@NonNull final Context context, @StringRes final int resourceId) {
Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
setTitle(context.getText(resourceId));
} | [
"public",
"final",
"void",
"setTitle",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"StringRes",
"final",
"int",
"resourceId",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"context",
",",
"\"The context may not be null\"",
... | Sets the title of the item.
@param context
The context, which should be used, as an instance of the class {@link Context}. The
context may not be null
@param resourceId
The resource id of the title, which should be set, as an {@link Integer} value. The
resource id must correspond to a valid string resource | [
"Sets",
"the",
"title",
"of",
"the",
"item",
"."
] | train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/model/Item.java#L146-L149 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Request.java | Request.generateStory | public Story generateStory(Map<String, Object> attributes) {
Story result = getInstance().createNew(Story.class, this);
getInstance().create().addAttributes(result, attributes);
result.save();
return result;
} | java | public Story generateStory(Map<String, Object> attributes) {
Story result = getInstance().createNew(Story.class, this);
getInstance().create().addAttributes(result, attributes);
result.save();
return result;
} | [
"public",
"Story",
"generateStory",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"Story",
"result",
"=",
"getInstance",
"(",
")",
".",
"createNew",
"(",
"Story",
".",
"class",
",",
"this",
")",
";",
"getInstance",
"(",
")",
".... | Creates a Story from this Request.
@param attributes additional attributes for the Story.
@return A Story in the VersionOne system related to this Issue. | [
"Creates",
"a",
"Story",
"from",
"this",
"Request",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Request.java#L217-L222 |
dbflute-session/mailflute | src/main/java/org/dbflute/mail/Postcard.java | Postcard.pushUlterior | public void pushUlterior(String key, Object value) {
assertArgumentNotNull("key", key);
assertArgumentNotNull("value", value);
if (pushedUlteriorMap == null) {
pushedUlteriorMap = new LinkedHashMap<String, Object>(4);
}
pushedUlteriorMap.put(key, value);
} | java | public void pushUlterior(String key, Object value) {
assertArgumentNotNull("key", key);
assertArgumentNotNull("value", value);
if (pushedUlteriorMap == null) {
pushedUlteriorMap = new LinkedHashMap<String, Object>(4);
}
pushedUlteriorMap.put(key, value);
} | [
"public",
"void",
"pushUlterior",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"assertArgumentNotNull",
"(",
"\"key\"",
",",
"key",
")",
";",
"assertArgumentNotNull",
"(",
"\"value\"",
",",
"value",
")",
";",
"if",
"(",
"pushedUlteriorMap",
"==",
... | basically unused in mailflute, this is for extension by application | [
"basically",
"unused",
"in",
"mailflute",
"this",
"is",
"for",
"extension",
"by",
"application"
] | train | https://github.com/dbflute-session/mailflute/blob/e41da4984131b09d55060e247fa4831682bc40a9/src/main/java/org/dbflute/mail/Postcard.java#L351-L358 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/jms/JmsSession.java | JmsSession.closeContext | public void closeContext()
throws EFapsException
{
if (isLogedIn()) {
try {
if (!Context.isTMNoTransaction()) {
if (Context.isTMActive()) {
Context.commit();
} else {
Context.rollback();
}
}
} catch (final SecurityException e) {
throw new EFapsException("SecurityException", e);
} catch (final IllegalStateException e) {
throw new EFapsException("IllegalStateException", e);
}
}
} | java | public void closeContext()
throws EFapsException
{
if (isLogedIn()) {
try {
if (!Context.isTMNoTransaction()) {
if (Context.isTMActive()) {
Context.commit();
} else {
Context.rollback();
}
}
} catch (final SecurityException e) {
throw new EFapsException("SecurityException", e);
} catch (final IllegalStateException e) {
throw new EFapsException("IllegalStateException", e);
}
}
} | [
"public",
"void",
"closeContext",
"(",
")",
"throws",
"EFapsException",
"{",
"if",
"(",
"isLogedIn",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"Context",
".",
"isTMNoTransaction",
"(",
")",
")",
"{",
"if",
"(",
"Context",
".",
"isTMActive",
"(",
... | Method that closes the opened Context {@link #openContext()}, by
committing or rollback it.
@throws EFapsException on error
@see #detach() | [
"Method",
"that",
"closes",
"the",
"opened",
"Context",
"{",
"@link",
"#openContext",
"()",
"}",
"by",
"committing",
"or",
"rollback",
"it",
".",
"@throws",
"EFapsException",
"on",
"error"
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/jms/JmsSession.java#L159-L177 |
banq/jdonframework | src/main/java/com/jdon/util/jdom/XMLFilterBase.java | XMLFilterBase.startElement | public void startElement (String uri, String localName)
throws SAXException
{
startElement(uri, localName, "", EMPTY_ATTS);
} | java | public void startElement (String uri, String localName)
throws SAXException
{
startElement(uri, localName, "", EMPTY_ATTS);
} | [
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"throws",
"SAXException",
"{",
"startElement",
"(",
"uri",
",",
"localName",
",",
"\"\"",
",",
"EMPTY_ATTS",
")",
";",
"}"
] | Start a new element without a qname or attributes.
<p>This method will provide a default empty attribute
list and an empty string for the qualified name. It invokes
{@link #startElement(String, String, String, Attributes)}
directly.</p>
@param uri The element's Namespace URI.
@param localName The element's local name.
@exception org.xml.sax.SAXException If a filter
further down the chain raises an exception.
@see org.xml.sax.ContentHandler#startElement | [
"Start",
"a",
"new",
"element",
"without",
"a",
"qname",
"or",
"attributes",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/jdom/XMLFilterBase.java#L168-L172 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.rotateAround | public Matrix4x3d rotateAround(Quaterniondc quat, double ox, double oy, double oz) {
return rotateAround(quat, ox, oy, oz, this);
} | java | public Matrix4x3d rotateAround(Quaterniondc quat, double ox, double oy, double oz) {
return rotateAround(quat, ox, oy, oz, this);
} | [
"public",
"Matrix4x3d",
"rotateAround",
"(",
"Quaterniondc",
"quat",
",",
"double",
"ox",
",",
"double",
"oy",
",",
"double",
"oz",
")",
"{",
"return",
"rotateAround",
"(",
"quat",
",",
"ox",
",",
"oy",
",",
"oz",
",",
"this",
")",
";",
"}"
] | Apply the rotation transformation of the given {@link Quaterniondc} to this matrix while using <code>(ox, oy, oz)</code> as the rotation origin.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>Q</code> the rotation matrix obtained from the given quaternion,
then the new matrix will be <code>M * Q</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * Q * v</code>,
the quaternion rotation will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, oz).rotate(quat).translate(-ox, -oy, -oz)</code>
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion">http://en.wikipedia.org</a>
@param quat
the {@link Quaterniondc}
@param ox
the x coordinate of the rotation origin
@param oy
the y coordinate of the rotation origin
@param oz
the z coordinate of the rotation origin
@return a matrix holding the result | [
"Apply",
"the",
"rotation",
"transformation",
"of",
"the",
"given",
"{",
"@link",
"Quaterniondc",
"}",
"to",
"this",
"matrix",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
"oz",
")",
"<",
"/",
"code",
">",
"as",
"the",
"rotation",
"origin",
".",
"<... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L3348-L3350 |
lets-blade/blade | src/main/java/com/blade/kit/EncryptKit.java | EncryptKit.hmacSHA512 | public static String hmacSHA512(String data, String key) {
return hmacSHA512(data.getBytes(), key.getBytes());
} | java | public static String hmacSHA512(String data, String key) {
return hmacSHA512(data.getBytes(), key.getBytes());
} | [
"public",
"static",
"String",
"hmacSHA512",
"(",
"String",
"data",
",",
"String",
"key",
")",
"{",
"return",
"hmacSHA512",
"(",
"data",
".",
"getBytes",
"(",
")",
",",
"key",
".",
"getBytes",
"(",
")",
")",
";",
"}"
] | HmacSHA512加密
@param data 明文字符串
@param key 秘钥
@return 16进制密文 | [
"HmacSHA512加密"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/EncryptKit.java#L393-L395 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java | Node.modifySubscriptionsAsOwner | public PubSub modifySubscriptionsAsOwner(List<Subscription> changedSubs)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub pubSub = createPubsubPacket(Type.set,
new SubscriptionsExtension(SubscriptionsNamespace.owner, getId(), changedSubs));
return sendPubsubPacket(pubSub);
} | java | public PubSub modifySubscriptionsAsOwner(List<Subscription> changedSubs)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
PubSub pubSub = createPubsubPacket(Type.set,
new SubscriptionsExtension(SubscriptionsNamespace.owner, getId(), changedSubs));
return sendPubsubPacket(pubSub);
} | [
"public",
"PubSub",
"modifySubscriptionsAsOwner",
"(",
"List",
"<",
"Subscription",
">",
"changedSubs",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"PubSub",
"pubSub",
"=",
"createPubsubP... | Modify the subscriptions for this PubSub node as owner.
<p>
Note that the subscriptions are _not_ checked against the existing subscriptions
since these are not cached (and indeed could change asynchronously)
</p>
@param changedSubs subscriptions that have changed
@return <code>null</code> or a PubSub stanza with additional information on success.
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException
@see <a href="https://xmpp.org/extensions/xep-0060.html#owner-subscriptions-modify">XEP-60 § 8.8.2 Modify Subscriptions</a>
@since 4.3 | [
"Modify",
"the",
"subscriptions",
"for",
"this",
"PubSub",
"node",
"as",
"owner",
".",
"<p",
">",
"Note",
"that",
"the",
"subscriptions",
"are",
"_not_",
"checked",
"against",
"the",
"existing",
"subscriptions",
"since",
"these",
"are",
"not",
"cached",
"(",
... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L240-L246 |
xebia/Xebium | src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java | SeleniumDriverFixture.saveScreenshotAfterInFolder | public void saveScreenshotAfterInFolder(String policy, String baseDir) throws IOException {
screenCapture.setScreenshotBaseDir(removeAnchorTag(baseDir));
saveScreenshotAfter(policy);
} | java | public void saveScreenshotAfterInFolder(String policy, String baseDir) throws IOException {
screenCapture.setScreenshotBaseDir(removeAnchorTag(baseDir));
saveScreenshotAfter(policy);
} | [
"public",
"void",
"saveScreenshotAfterInFolder",
"(",
"String",
"policy",
",",
"String",
"baseDir",
")",
"throws",
"IOException",
"{",
"screenCapture",
".",
"setScreenshotBaseDir",
"(",
"removeAnchorTag",
"(",
"baseDir",
")",
")",
";",
"saveScreenshotAfter",
"(",
"p... | <p><code>
| save screenshot after | <i>failure</i> | in folder | <i>http://files/testResults/screenshots/${PAGE_NAME} |
| save screenshot after | <i>error</i> |
</code></p> | [
"<p",
">",
"<code",
">",
"|",
"save",
"screenshot",
"after",
"|",
"<i",
">",
"failure<",
"/",
"i",
">",
"|",
"in",
"folder",
"|",
"<i",
">",
"http",
":",
"//",
"files",
"/",
"testResults",
"/",
"screenshots",
"/",
"$",
"{",
"PAGE_NAME",
"}",
"|",
... | train | https://github.com/xebia/Xebium/blob/594f6d9e65622acdbd03dba0700b17645981da1f/src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java#L341-L344 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/source/extractor/utils/Utils.java | Utils.getLongWithCurrentDate | public static long getLongWithCurrentDate(String value, String timezone) {
if (Strings.isNullOrEmpty(value)) {
return 0;
}
DateTime time = getCurrentTime(timezone);
DateTimeFormatter dtFormatter = DateTimeFormat.forPattern(CURRENT_DATE_FORMAT).withZone(time.getZone());
if (value.toUpperCase().startsWith(CURRENT_DAY)) {
return Long
.parseLong(dtFormatter.print(time.minusDays(Integer.parseInt(value.substring(CURRENT_DAY.length() + 1)))));
}
if (value.toUpperCase().startsWith(CURRENT_HOUR)) {
return Long
.parseLong(dtFormatter.print(time.minusHours(Integer.parseInt(value.substring(CURRENT_HOUR.length() + 1)))));
}
return Long.parseLong(value);
} | java | public static long getLongWithCurrentDate(String value, String timezone) {
if (Strings.isNullOrEmpty(value)) {
return 0;
}
DateTime time = getCurrentTime(timezone);
DateTimeFormatter dtFormatter = DateTimeFormat.forPattern(CURRENT_DATE_FORMAT).withZone(time.getZone());
if (value.toUpperCase().startsWith(CURRENT_DAY)) {
return Long
.parseLong(dtFormatter.print(time.minusDays(Integer.parseInt(value.substring(CURRENT_DAY.length() + 1)))));
}
if (value.toUpperCase().startsWith(CURRENT_HOUR)) {
return Long
.parseLong(dtFormatter.print(time.minusHours(Integer.parseInt(value.substring(CURRENT_HOUR.length() + 1)))));
}
return Long.parseLong(value);
} | [
"public",
"static",
"long",
"getLongWithCurrentDate",
"(",
"String",
"value",
",",
"String",
"timezone",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"value",
")",
")",
"{",
"return",
"0",
";",
"}",
"DateTime",
"time",
"=",
"getCurrentTime",
... | Helper method for getting a value containing CURRENTDAY-1 or CURRENTHOUR-1 in the form yyyyMMddHHmmss
@param value
@param timezone
@return | [
"Helper",
"method",
"for",
"getting",
"a",
"value",
"containing",
"CURRENTDAY",
"-",
"1",
"or",
"CURRENTHOUR",
"-",
"1",
"in",
"the",
"form",
"yyyyMMddHHmmss"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/utils/Utils.java#L283-L299 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/base64/Base64.java | Base64.safeDecodeAsString | @Nullable
public static String safeDecodeAsString (@Nullable final String sEncoded, @Nonnull final Charset aCharset)
{
ValueEnforcer.notNull (aCharset, "Charset");
if (sEncoded != null)
try
{
final byte [] aDecoded = decode (sEncoded, DONT_GUNZIP);
return new String (aDecoded, aCharset);
}
catch (final IOException ex)
{
// Fall through
}
return null;
} | java | @Nullable
public static String safeDecodeAsString (@Nullable final String sEncoded, @Nonnull final Charset aCharset)
{
ValueEnforcer.notNull (aCharset, "Charset");
if (sEncoded != null)
try
{
final byte [] aDecoded = decode (sEncoded, DONT_GUNZIP);
return new String (aDecoded, aCharset);
}
catch (final IOException ex)
{
// Fall through
}
return null;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"safeDecodeAsString",
"(",
"@",
"Nullable",
"final",
"String",
"sEncoded",
",",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aCharset",
",",
"\"Charset\"",
")",
... | Decode the string and convert it back to a string.
@param sEncoded
The encoded string.
@param aCharset
The character set to be used.
@return <code>null</code> if decoding failed. | [
"Decode",
"the",
"string",
"and",
"convert",
"it",
"back",
"to",
"a",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L2664-L2679 |
facebookarchive/nifty | nifty-ssl/src/main/java/com/facebook/nifty/ssl/PollingMultiFileWatcher.java | PollingMultiFileWatcher.computeFileHash | private static String computeFileHash(File file, MessageDigest md) throws IOException {
md.reset();
return BaseEncoding.base16().encode(md.digest(Files.toByteArray(file)));
} | java | private static String computeFileHash(File file, MessageDigest md) throws IOException {
md.reset();
return BaseEncoding.base16().encode(md.digest(Files.toByteArray(file)));
} | [
"private",
"static",
"String",
"computeFileHash",
"(",
"File",
"file",
",",
"MessageDigest",
"md",
")",
"throws",
"IOException",
"{",
"md",
".",
"reset",
"(",
")",
";",
"return",
"BaseEncoding",
".",
"base16",
"(",
")",
".",
"encode",
"(",
"md",
".",
"di... | Computes a hash of the given file's contents using the provided MessageDigest.
@param file the file.
@param md the message digest.
@return the hash of the file contents.
@throws IOException if the file contents cannot be read. | [
"Computes",
"a",
"hash",
"of",
"the",
"given",
"file",
"s",
"contents",
"using",
"the",
"provided",
"MessageDigest",
"."
] | train | https://github.com/facebookarchive/nifty/blob/ccacff7f0a723abe0b9ed399bcc3bc85784e7396/nifty-ssl/src/main/java/com/facebook/nifty/ssl/PollingMultiFileWatcher.java#L234-L237 |
rometools/rome | rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedAtomHandler.java | FileBasedAtomHandler.postMedia | @Override
public Entry postMedia(final AtomRequest areq, final Entry entry) throws AtomException {
// get incoming slug from HTTP header
final String slug = areq.getHeader("Slug");
if (LOG.isDebugEnabled()) {
LOG.debug("postMedia - title: " + entry.getTitle() + " slug:" + slug);
}
try {
final File tempFile = null;
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0];
final String collection = pathInfo[1];
final FileBasedCollection col = service.findCollectionByHandle(handle, collection);
try {
col.addMediaEntry(entry, slug, areq.getInputStream());
} catch (final Exception e) {
e.printStackTrace();
final String msg = "ERROR reading posted file";
LOG.error(msg, e);
throw new AtomException(msg, e);
} finally {
if (tempFile != null) {
tempFile.delete();
}
}
} catch (final Exception re) {
throw new AtomException("ERROR: posting media");
}
return entry;
} | java | @Override
public Entry postMedia(final AtomRequest areq, final Entry entry) throws AtomException {
// get incoming slug from HTTP header
final String slug = areq.getHeader("Slug");
if (LOG.isDebugEnabled()) {
LOG.debug("postMedia - title: " + entry.getTitle() + " slug:" + slug);
}
try {
final File tempFile = null;
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0];
final String collection = pathInfo[1];
final FileBasedCollection col = service.findCollectionByHandle(handle, collection);
try {
col.addMediaEntry(entry, slug, areq.getInputStream());
} catch (final Exception e) {
e.printStackTrace();
final String msg = "ERROR reading posted file";
LOG.error(msg, e);
throw new AtomException(msg, e);
} finally {
if (tempFile != null) {
tempFile.delete();
}
}
} catch (final Exception re) {
throw new AtomException("ERROR: posting media");
}
return entry;
} | [
"@",
"Override",
"public",
"Entry",
"postMedia",
"(",
"final",
"AtomRequest",
"areq",
",",
"final",
"Entry",
"entry",
")",
"throws",
"AtomException",
"{",
"// get incoming slug from HTTP header",
"final",
"String",
"slug",
"=",
"areq",
".",
"getHeader",
"(",
"\"Sl... | Store media data in collection specified by pathInfo, create an Atom media-link entry to
store metadata for the new media file and return that entry to the caller.
@param areq Details of HTTP request
@param entry New entry initialzied with only title and content type
@return Location URL of new media entry | [
"Store",
"media",
"data",
"in",
"collection",
"specified",
"by",
"pathInfo",
"create",
"an",
"Atom",
"media",
"-",
"link",
"entry",
"to",
"store",
"metadata",
"for",
"the",
"new",
"media",
"file",
"and",
"return",
"that",
"entry",
"to",
"the",
"caller",
".... | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedAtomHandler.java#L274-L308 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/Path.java | Path.curveTo | public void curveTo(float x, float y, float cx1, float cy1, float cx2, float cy2) {
curveTo(x,y,cx1,cy1,cx2,cy2,10);
} | java | public void curveTo(float x, float y, float cx1, float cy1, float cx2, float cy2) {
curveTo(x,y,cx1,cy1,cx2,cy2,10);
} | [
"public",
"void",
"curveTo",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"cx1",
",",
"float",
"cy1",
",",
"float",
"cx2",
",",
"float",
"cy2",
")",
"{",
"curveTo",
"(",
"x",
",",
"y",
",",
"cx1",
",",
"cy1",
",",
"cx2",
",",
"cy2",
",",... | Add a curve to the specified location (using the default segments 10)
@param x The destination x coordinate
@param y The destination y coordiante
@param cx1 The x coordiante of the first control point
@param cy1 The y coordiante of the first control point
@param cx2 The x coordinate of the second control point
@param cy2 The y coordinate of the second control point | [
"Add",
"a",
"curve",
"to",
"the",
"specified",
"location",
"(",
"using",
"the",
"default",
"segments",
"10",
")"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Path.java#L84-L86 |
mijecu25/dsa | src/main/java/com/mijecu25/dsa/algorithms/search/linear/LinearSearch.java | LinearSearch.searchLast | public static int searchLast(float[] floatArray, float value, int occurrence) {
if(occurrence <= 0 || occurrence > floatArray.length) {
throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
+ "the array length: " + occurrence);
}
int valuesSeen = 0;
for(int i = floatArray.length-1; i >=0; i--) {
if(floatArray[i] == value) {
valuesSeen++;
if(valuesSeen == occurrence) {
return i;
}
}
}
return -1;
} | java | public static int searchLast(float[] floatArray, float value, int occurrence) {
if(occurrence <= 0 || occurrence > floatArray.length) {
throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
+ "the array length: " + occurrence);
}
int valuesSeen = 0;
for(int i = floatArray.length-1; i >=0; i--) {
if(floatArray[i] == value) {
valuesSeen++;
if(valuesSeen == occurrence) {
return i;
}
}
}
return -1;
} | [
"public",
"static",
"int",
"searchLast",
"(",
"float",
"[",
"]",
"floatArray",
",",
"float",
"value",
",",
"int",
"occurrence",
")",
"{",
"if",
"(",
"occurrence",
"<=",
"0",
"||",
"occurrence",
">",
"floatArray",
".",
"length",
")",
"{",
"throw",
"new",
... | Search for the value in the float array and return the index of the first occurrence from the
end of the array.
@param floatArray array that we are searching in.
@param value value that is being searched in the array.
@param occurrence number of times we have seen the value before returning the index.
@return the index where the value is found in the array, else -1. | [
"Search",
"for",
"the",
"value",
"in",
"the",
"float",
"array",
"and",
"return",
"the",
"index",
"of",
"the",
"first",
"occurrence",
"from",
"the",
"end",
"of",
"the",
"array",
"."
] | train | https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/linear/LinearSearch.java#L1680-L1699 |
google/closure-templates | java/src/com/google/template/soy/soytree/SoyTreeUtils.java | SoyTreeUtils.getNodeAsHtmlTagNode | public static HtmlTagNode getNodeAsHtmlTagNode(SoyNode node, boolean openTag) {
SoyNode.Kind tagKind =
openTag ? SoyNode.Kind.HTML_OPEN_TAG_NODE : SoyNode.Kind.HTML_CLOSE_TAG_NODE;
if (node.getKind() == tagKind) {
return (HtmlTagNode) node;
}
// In a msg tag it will be a placeholder, wrapping a MsgHtmlTagNode wrapping the HtmlTagNode.
if (node.getKind() == Kind.MSG_PLACEHOLDER_NODE) {
MsgPlaceholderNode placeholderNode = (MsgPlaceholderNode) node;
if (placeholderNode.numChildren() == 1
&& placeholderNode.getChild(0).getKind() == Kind.MSG_HTML_TAG_NODE) {
MsgHtmlTagNode msgHtmlTagNode = (MsgHtmlTagNode) placeholderNode.getChild(0);
if (msgHtmlTagNode.numChildren() == 1 && msgHtmlTagNode.getChild(0).getKind() == tagKind) {
return (HtmlTagNode) msgHtmlTagNode.getChild(0);
}
}
}
return null;
} | java | public static HtmlTagNode getNodeAsHtmlTagNode(SoyNode node, boolean openTag) {
SoyNode.Kind tagKind =
openTag ? SoyNode.Kind.HTML_OPEN_TAG_NODE : SoyNode.Kind.HTML_CLOSE_TAG_NODE;
if (node.getKind() == tagKind) {
return (HtmlTagNode) node;
}
// In a msg tag it will be a placeholder, wrapping a MsgHtmlTagNode wrapping the HtmlTagNode.
if (node.getKind() == Kind.MSG_PLACEHOLDER_NODE) {
MsgPlaceholderNode placeholderNode = (MsgPlaceholderNode) node;
if (placeholderNode.numChildren() == 1
&& placeholderNode.getChild(0).getKind() == Kind.MSG_HTML_TAG_NODE) {
MsgHtmlTagNode msgHtmlTagNode = (MsgHtmlTagNode) placeholderNode.getChild(0);
if (msgHtmlTagNode.numChildren() == 1 && msgHtmlTagNode.getChild(0).getKind() == tagKind) {
return (HtmlTagNode) msgHtmlTagNode.getChild(0);
}
}
}
return null;
} | [
"public",
"static",
"HtmlTagNode",
"getNodeAsHtmlTagNode",
"(",
"SoyNode",
"node",
",",
"boolean",
"openTag",
")",
"{",
"SoyNode",
".",
"Kind",
"tagKind",
"=",
"openTag",
"?",
"SoyNode",
".",
"Kind",
".",
"HTML_OPEN_TAG_NODE",
":",
"SoyNode",
".",
"Kind",
".",... | Returns the node as an HTML tag node, if one can be extracted from it (e.g. wrapped in a
MsgPlaceholderNode). Otherwise, returns null. | [
"Returns",
"the",
"node",
"as",
"an",
"HTML",
"tag",
"node",
"if",
"one",
"can",
"be",
"extracted",
"from",
"it",
"(",
"e",
".",
"g",
".",
"wrapped",
"in",
"a",
"MsgPlaceholderNode",
")",
".",
"Otherwise",
"returns",
"null",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/SoyTreeUtils.java#L423-L441 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java | Util.getUrlValueFromRow | private static URL getUrlValueFromRow(QuerySolution resultRow, String variableName) {
// Check the input and exit immediately if null
if (resultRow == null) {
return null;
}
URL result = null;
Resource res = resultRow.getResource(variableName);
// Ignore and track services that are blank nodes
if (res.isAnon()) {
log.warn("Blank node found and ignored " + res.toString());
} else if (res.isURIResource()) {
try {
result = new URL(res.getURI());
} catch (MalformedURLException e) {
log.error("Malformed URL for node", e);
} catch (ClassCastException e) {
log.error("The node is not a URI", e);
}
}
return result;
} | java | private static URL getUrlValueFromRow(QuerySolution resultRow, String variableName) {
// Check the input and exit immediately if null
if (resultRow == null) {
return null;
}
URL result = null;
Resource res = resultRow.getResource(variableName);
// Ignore and track services that are blank nodes
if (res.isAnon()) {
log.warn("Blank node found and ignored " + res.toString());
} else if (res.isURIResource()) {
try {
result = new URL(res.getURI());
} catch (MalformedURLException e) {
log.error("Malformed URL for node", e);
} catch (ClassCastException e) {
log.error("The node is not a URI", e);
}
}
return result;
} | [
"private",
"static",
"URL",
"getUrlValueFromRow",
"(",
"QuerySolution",
"resultRow",
",",
"String",
"variableName",
")",
"{",
"// Check the input and exit immediately if null",
"if",
"(",
"resultRow",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"URL",
"resul... | Given a query result from a SPARQL query, obtain the given variable value
as a URL
@param resultRow the result from a SPARQL query
@param variableName the name of the variable to obtain
@return the value or null if it could not be obtained | [
"Given",
"a",
"query",
"result",
"from",
"a",
"SPARQL",
"query",
"obtain",
"the",
"given",
"variable",
"value",
"as",
"a",
"URL"
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L131-L154 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java | CommonMpJwtFat.buildAppUrl | public String buildAppUrl(LibertyServer theServer, String root, String app) throws Exception {
return SecurityFatHttpUtils.getServerUrlBase(theServer) + root + "/rest/" + app + "/" + MpJwtFatConstants.MPJWT_GENERIC_APP_NAME;
} | java | public String buildAppUrl(LibertyServer theServer, String root, String app) throws Exception {
return SecurityFatHttpUtils.getServerUrlBase(theServer) + root + "/rest/" + app + "/" + MpJwtFatConstants.MPJWT_GENERIC_APP_NAME;
} | [
"public",
"String",
"buildAppUrl",
"(",
"LibertyServer",
"theServer",
",",
"String",
"root",
",",
"String",
"app",
")",
"throws",
"Exception",
"{",
"return",
"SecurityFatHttpUtils",
".",
"getServerUrlBase",
"(",
"theServer",
")",
"+",
"root",
"+",
"\"/rest/\"",
... | Build the http app url
@param theServer - The server where the app is running (used to get the port)
@param root - the root context of the app
@param app - the specific app to run
@return - returns the full url to invoke
@throws Exception | [
"Build",
"the",
"http",
"app",
"url"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L129-L133 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/clause/UpdateForClause.java | UpdateForClause.forIn | public static UpdateForClause forIn(String variable, String path) {
UpdateForClause clause = new UpdateForClause();
return clause.in(variable, path);
} | java | public static UpdateForClause forIn(String variable, String path) {
UpdateForClause clause = new UpdateForClause();
return clause.in(variable, path);
} | [
"public",
"static",
"UpdateForClause",
"forIn",
"(",
"String",
"variable",
",",
"String",
"path",
")",
"{",
"UpdateForClause",
"clause",
"=",
"new",
"UpdateForClause",
"(",
")",
";",
"return",
"clause",
".",
"in",
"(",
"variable",
",",
"path",
")",
";",
"}... | Creates an updateFor clause that starts with <code>FOR variable IN path</code>.
@param variable the first variable in the clause.
@param path the first path in the clause, an IN path.
@return the clause, for chaining. See {@link #when(Expression)} and {@link #end()} to complete the clause. | [
"Creates",
"an",
"updateFor",
"clause",
"that",
"starts",
"with",
"<code",
">",
"FOR",
"variable",
"IN",
"path<",
"/",
"code",
">",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/clause/UpdateForClause.java#L47-L50 |
real-logic/simple-binary-encoding | sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/Generators.java | Generators.forEachField | public static void forEachField(final List<Token> tokens, final BiConsumer<Token, Token> consumer)
{
for (int i = 0, size = tokens.size(); i < size;)
{
final Token fieldToken = tokens.get(i);
if (fieldToken.signal() == Signal.BEGIN_FIELD)
{
final Token typeToken = tokens.get(i + 1);
consumer.accept(fieldToken, typeToken);
i += fieldToken.componentTokenCount();
}
else
{
++i;
}
}
} | java | public static void forEachField(final List<Token> tokens, final BiConsumer<Token, Token> consumer)
{
for (int i = 0, size = tokens.size(); i < size;)
{
final Token fieldToken = tokens.get(i);
if (fieldToken.signal() == Signal.BEGIN_FIELD)
{
final Token typeToken = tokens.get(i + 1);
consumer.accept(fieldToken, typeToken);
i += fieldToken.componentTokenCount();
}
else
{
++i;
}
}
} | [
"public",
"static",
"void",
"forEachField",
"(",
"final",
"List",
"<",
"Token",
">",
"tokens",
",",
"final",
"BiConsumer",
"<",
"Token",
",",
"Token",
">",
"consumer",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"size",
"=",
"tokens",
".",
"size... | For each field found in a list of field {@link Token}s take the field token and following type token to
a {@link BiConsumer}.
@param tokens to be iterated over.
@param consumer to for the field and encoding token pair. | [
"For",
"each",
"field",
"found",
"in",
"a",
"list",
"of",
"field",
"{",
"@link",
"Token",
"}",
"s",
"take",
"the",
"field",
"token",
"and",
"following",
"type",
"token",
"to",
"a",
"{",
"@link",
"BiConsumer",
"}",
"."
] | train | https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/Generators.java#L33-L49 |
google/gson | gson/src/main/java/com/google/gson/internal/bind/util/ISO8601Utils.java | ISO8601Utils.checkOffset | private static boolean checkOffset(String value, int offset, char expected) {
return (offset < value.length()) && (value.charAt(offset) == expected);
} | java | private static boolean checkOffset(String value, int offset, char expected) {
return (offset < value.length()) && (value.charAt(offset) == expected);
} | [
"private",
"static",
"boolean",
"checkOffset",
"(",
"String",
"value",
",",
"int",
"offset",
",",
"char",
"expected",
")",
"{",
"return",
"(",
"offset",
"<",
"value",
".",
"length",
"(",
")",
")",
"&&",
"(",
"value",
".",
"charAt",
"(",
"offset",
")",
... | Check if the expected character exist at the given offset in the value.
@param value the string to check at the specified offset
@param offset the offset to look for the expected character
@param expected the expected character
@return true if the expected character exist at the given offset | [
"Check",
"if",
"the",
"expected",
"character",
"exist",
"at",
"the",
"given",
"offset",
"in",
"the",
"value",
"."
] | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/internal/bind/util/ISO8601Utils.java#L287-L289 |
Jasig/uPortal | uPortal-groups/uPortal-groups-filesystem/src/main/java/org/apereo/portal/groups/filesystem/FileSystemGroupStore.java | FileSystemGroupStore.fileContains | private boolean fileContains(File file, IGroupMember member) throws GroupsException {
Collection ids = null;
try {
ids = member.isGroup() ? getGroupIdsFromFile(file) : getEntityIdsFromFile(file);
} catch (Exception ex) {
throw new GroupsException("Error retrieving ids from file", ex);
}
return ids.contains(member.getKey());
} | java | private boolean fileContains(File file, IGroupMember member) throws GroupsException {
Collection ids = null;
try {
ids = member.isGroup() ? getGroupIdsFromFile(file) : getEntityIdsFromFile(file);
} catch (Exception ex) {
throw new GroupsException("Error retrieving ids from file", ex);
}
return ids.contains(member.getKey());
} | [
"private",
"boolean",
"fileContains",
"(",
"File",
"file",
",",
"IGroupMember",
"member",
")",
"throws",
"GroupsException",
"{",
"Collection",
"ids",
"=",
"null",
";",
"try",
"{",
"ids",
"=",
"member",
".",
"isGroup",
"(",
")",
"?",
"getGroupIdsFromFile",
"(... | Answers if <code>file</code> contains <code>member</code>.
@param file
@param member
@return boolean | [
"Answers",
"if",
"<code",
">",
"file<",
"/",
"code",
">",
"contains",
"<code",
">",
"member<",
"/",
"code",
">",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-filesystem/src/main/java/org/apereo/portal/groups/filesystem/FileSystemGroupStore.java#L866-L874 |
ben-manes/caffeine | caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/ConcurrentHashMapV7.java | ConcurrentHashMapV7.put | @Override
@SuppressWarnings("unchecked")
public V put(K key, V value) {
Segment<K,V> s;
if (value == null) {
throw new NullPointerException();
}
int hash = hash(key);
int j = (hash >>> segmentShift) & segmentMask;
if ((s = (Segment<K,V>)UNSAFE.getObject // nonvolatile; recheck
(segments, (j << SSHIFT) + SBASE)) == null) {
s = ensureSegment(j);
}
return s.put(key, hash, value, false);
} | java | @Override
@SuppressWarnings("unchecked")
public V put(K key, V value) {
Segment<K,V> s;
if (value == null) {
throw new NullPointerException();
}
int hash = hash(key);
int j = (hash >>> segmentShift) & segmentMask;
if ((s = (Segment<K,V>)UNSAFE.getObject // nonvolatile; recheck
(segments, (j << SSHIFT) + SBASE)) == null) {
s = ensureSegment(j);
}
return s.put(key, hash, value, false);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"V",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"Segment",
"<",
"K",
",",
"V",
">",
"s",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"Nu... | Maps the specified key to the specified value in this table.
Neither the key nor the value can be null.
<p> The value can be retrieved by calling the <tt>get</tt> method
with a key that is equal to the original key.
@param key key with which the specified value is to be associated
@param value value to be associated with the specified key
@return the previous value associated with <tt>key</tt>, or
<tt>null</tt> if there was no mapping for <tt>key</tt>
@throws NullPointerException if the specified key or value is null | [
"Maps",
"the",
"specified",
"key",
"to",
"the",
"specified",
"value",
"in",
"this",
"table",
".",
"Neither",
"the",
"key",
"nor",
"the",
"value",
"can",
"be",
"null",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/ConcurrentHashMapV7.java#L1182-L1196 |
lightblueseas/email-tails | src/main/java/de/alpharogroup/email/messages/EmailMessage.java | EmailMessage.setSubject | @Override
public void setSubject(final String subject, final String charset) throws MessagingException
{
super.setSubject(subject, charset);
} | java | @Override
public void setSubject(final String subject, final String charset) throws MessagingException
{
super.setSubject(subject, charset);
} | [
"@",
"Override",
"public",
"void",
"setSubject",
"(",
"final",
"String",
"subject",
",",
"final",
"String",
"charset",
")",
"throws",
"MessagingException",
"{",
"super",
".",
"setSubject",
"(",
"subject",
",",
"charset",
")",
";",
"}"
] | Sets the subject.
@param subject
the subject
@param charset
the charset
@throws MessagingException
is thrown if the underlying implementation does not support modification of
existing values
@see javax.mail.internet.MimeMessage#setSubject(java.lang.String, java.lang.String) | [
"Sets",
"the",
"subject",
"."
] | train | https://github.com/lightblueseas/email-tails/blob/7be6fee3548e61e697cc8e64e90603cb1f505be2/src/main/java/de/alpharogroup/email/messages/EmailMessage.java#L369-L373 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/VersionMessage.java | VersionMessage.appendToSubVer | public void appendToSubVer(String name, String version, @Nullable String comments) {
checkSubVerComponent(name);
checkSubVerComponent(version);
if (comments != null) {
checkSubVerComponent(comments);
subVer = subVer.concat(String.format(Locale.US, "%s:%s(%s)/", name, version, comments));
} else {
subVer = subVer.concat(String.format(Locale.US, "%s:%s/", name, version));
}
} | java | public void appendToSubVer(String name, String version, @Nullable String comments) {
checkSubVerComponent(name);
checkSubVerComponent(version);
if (comments != null) {
checkSubVerComponent(comments);
subVer = subVer.concat(String.format(Locale.US, "%s:%s(%s)/", name, version, comments));
} else {
subVer = subVer.concat(String.format(Locale.US, "%s:%s/", name, version));
}
} | [
"public",
"void",
"appendToSubVer",
"(",
"String",
"name",
",",
"String",
"version",
",",
"@",
"Nullable",
"String",
"comments",
")",
"{",
"checkSubVerComponent",
"(",
"name",
")",
";",
"checkSubVerComponent",
"(",
"version",
")",
";",
"if",
"(",
"comments",
... | <p>Appends the given user-agent information to the subVer field. The subVer is composed of a series of
name:version pairs separated by slashes in the form of a path. For example a typical subVer field for bitcoinj
users might look like "/bitcoinj:0.13/MultiBit:1.2/" where libraries come further to the left.</p>
<p>There can be as many components as you feel a need for, and the version string can be anything, but it is
recommended to use A.B.C where A = major, B = minor and C = revision for software releases, and dates for
auto-generated source repository snapshots. A valid subVer begins and ends with a slash, therefore name
and version are not allowed to contain such characters.</p>
<p>Anything put in the "comments" field will appear in brackets and may be used for platform info, or anything
else. For example, calling {@code appendToSubVer("MultiBit", "1.0", "Windows")} will result in a subVer being
set of "/bitcoinj:1.0/MultiBit:1.0(Windows)/". Therefore the / ( and ) characters are reserved in all these
components. If you don't want to add a comment (recommended), pass null.</p>
<p>See <a href="https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki">BIP 14</a> for more information.</p>
@param comments Optional (can be null) platform or other node specific information.
@throws IllegalArgumentException if name, version or comments contains invalid characters. | [
"<p",
">",
"Appends",
"the",
"given",
"user",
"-",
"agent",
"information",
"to",
"the",
"subVer",
"field",
".",
"The",
"subVer",
"is",
"composed",
"of",
"a",
"series",
"of",
"name",
":",
"version",
"pairs",
"separated",
"by",
"slashes",
"in",
"the",
"for... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/VersionMessage.java#L253-L262 |
bullhorn/sdk-rest | src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java | StandardBullhornData.handleFastFindForEntities | protected FastFindListWrapper handleFastFindForEntities(String query, FastFindParams params) {
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForFastFind(query, params);
String url = restUrlFactory.assembleFastFindUrl(params);
String jsonString = this.performGetRequest(url, String.class, uriVariables);
return restJsonConverter.jsonToEntityDoNotUnwrapRoot(jsonString, FastFindListWrapper.class);
} | java | protected FastFindListWrapper handleFastFindForEntities(String query, FastFindParams params) {
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForFastFind(query, params);
String url = restUrlFactory.assembleFastFindUrl(params);
String jsonString = this.performGetRequest(url, String.class, uriVariables);
return restJsonConverter.jsonToEntityDoNotUnwrapRoot(jsonString, FastFindListWrapper.class);
} | [
"protected",
"FastFindListWrapper",
"handleFastFindForEntities",
"(",
"String",
"query",
",",
"FastFindParams",
"params",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"uriVariables",
"=",
"restUriVariablesFactory",
".",
"getUriVariablesForFastFind",
"(",
"query",... | Makes the "fast find" api call
<p>
HTTP Method: GET
@param query fast find query string
@param params optional FastFindParams .
@return a ListWrapper containing the records plus some additional information | [
"Makes",
"the",
"fast",
"find",
"api",
"call",
"<p",
">",
"HTTP",
"Method",
":",
"GET"
] | train | https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L1104-L1112 |
tractionsoftware/gwt-traction | src/main/java/com/tractionsoftware/gwt/user/client/util/DomUtils.java | DomUtils.setEnabled | public static void setEnabled(Element element, boolean enabled) {
element.setPropertyBoolean("disabled", !enabled);
setStyleName(element, "disabled", !enabled);
} | java | public static void setEnabled(Element element, boolean enabled) {
element.setPropertyBoolean("disabled", !enabled);
setStyleName(element, "disabled", !enabled);
} | [
"public",
"static",
"void",
"setEnabled",
"(",
"Element",
"element",
",",
"boolean",
"enabled",
")",
"{",
"element",
".",
"setPropertyBoolean",
"(",
"\"disabled\"",
",",
"!",
"enabled",
")",
";",
"setStyleName",
"(",
"element",
",",
"\"disabled\"",
",",
"!",
... | It's enough to just set the disabled attribute on the
element, but we want to also add a "disabled" class so that we can
style it.
At some point we'll just be able to use .button:disabled,
but that doesn't work in IE8- | [
"It",
"s",
"enough",
"to",
"just",
"set",
"the",
"disabled",
"attribute",
"on",
"the",
"element",
"but",
"we",
"want",
"to",
"also",
"add",
"a",
"disabled",
"class",
"so",
"that",
"we",
"can",
"style",
"it",
"."
] | train | https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/DomUtils.java#L45-L48 |
brutusin/commons | src/main/java/org/brutusin/commons/utils/Miscellaneous.java | Miscellaneous.writeStringToFile | public static void writeStringToFile(File file, String data, String charset) throws IOException {
FileOutputStream fos = openOutputStream(file, false);
fos.write(data.getBytes(charset));
fos.close();
} | java | public static void writeStringToFile(File file, String data, String charset) throws IOException {
FileOutputStream fos = openOutputStream(file, false);
fos.write(data.getBytes(charset));
fos.close();
} | [
"public",
"static",
"void",
"writeStringToFile",
"(",
"File",
"file",
",",
"String",
"data",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fos",
"=",
"openOutputStream",
"(",
"file",
",",
"false",
")",
";",
"fos",
".",
"wr... | Writes a String to a file creating the file if it does not exist.
@param file the file to write
@param data the content to write to the file
@param charset the encoding to use, {@code null} means platform default
@throws IOException in case of an I/O error | [
"Writes",
"a",
"String",
"to",
"a",
"file",
"creating",
"the",
"file",
"if",
"it",
"does",
"not",
"exist",
"."
] | train | https://github.com/brutusin/commons/blob/70685df2b2456d0bf1e6a4754d72c87bba4949df/src/main/java/org/brutusin/commons/utils/Miscellaneous.java#L305-L309 |
bmwcarit/joynr | java/jeeintegration/src/main/java/io/joynr/jeeintegration/messaging/JeeMessagingEndpoint.java | JeeMessagingEndpoint.postMessageWithoutContentType | @POST
@Consumes({ MediaType.APPLICATION_OCTET_STREAM })
@Path("/{ccid: [A-Z,a-z,0-9,_,\\-,\\.]+}/messageWithoutContentType")
public Response postMessageWithoutContentType(@PathParam("ccid") String ccid,
byte[] serializedMessage,
@Context UriInfo uriInfo) throws IOException {
return postMessage(ccid, serializedMessage, uriInfo);
} | java | @POST
@Consumes({ MediaType.APPLICATION_OCTET_STREAM })
@Path("/{ccid: [A-Z,a-z,0-9,_,\\-,\\.]+}/messageWithoutContentType")
public Response postMessageWithoutContentType(@PathParam("ccid") String ccid,
byte[] serializedMessage,
@Context UriInfo uriInfo) throws IOException {
return postMessage(ccid, serializedMessage, uriInfo);
} | [
"@",
"POST",
"@",
"Consumes",
"(",
"{",
"MediaType",
".",
"APPLICATION_OCTET_STREAM",
"}",
")",
"@",
"Path",
"(",
"\"/{ccid: [A-Z,a-z,0-9,_,\\\\-,\\\\.]+}/messageWithoutContentType\"",
")",
"public",
"Response",
"postMessageWithoutContentType",
"(",
"@",
"PathParam",
"(",... | Receives a message for the given channel ID, parses the binary content as SMRF, and forwards to
{@link #postMessage(String, byte[], UriInfo)}.
@param ccid
the channel id.
@param serializedMessage
a serialized SMRF message to be send.
@param uriInfo
the URI Information for the request being processed.
@return Response the endpoint where the status of the message can be queried.
@throws IOException
in case of IO error occurred. | [
"Receives",
"a",
"message",
"for",
"the",
"given",
"channel",
"ID",
"parses",
"the",
"binary",
"content",
"as",
"SMRF",
"and",
"forwards",
"to",
"{",
"@link",
"#postMessage",
"(",
"String",
"byte",
"[]",
"UriInfo",
")",
"}",
"."
] | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/jeeintegration/src/main/java/io/joynr/jeeintegration/messaging/JeeMessagingEndpoint.java#L98-L105 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.createReviews | public List<String> createReviews(String teamName, String urlContentType, List<CreateReviewBodyItem> createReviewBody, CreateReviewsOptionalParameter createReviewsOptionalParameter) {
return createReviewsWithServiceResponseAsync(teamName, urlContentType, createReviewBody, createReviewsOptionalParameter).toBlocking().single().body();
} | java | public List<String> createReviews(String teamName, String urlContentType, List<CreateReviewBodyItem> createReviewBody, CreateReviewsOptionalParameter createReviewsOptionalParameter) {
return createReviewsWithServiceResponseAsync(teamName, urlContentType, createReviewBody, createReviewsOptionalParameter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"String",
">",
"createReviews",
"(",
"String",
"teamName",
",",
"String",
"urlContentType",
",",
"List",
"<",
"CreateReviewBodyItem",
">",
"createReviewBody",
",",
"CreateReviewsOptionalParameter",
"createReviewsOptionalParameter",
")",
"{",
"retu... | The reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint.
<h3>CallBack Schemas </h3>
<h4>Review Completion CallBack Sample</h4>
<p>
{<br/>
"ReviewId": "<Review Id>",<br/>
"ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
"ModifiedBy": "<Name of the Reviewer>",<br/>
"CallBackType": "Review",<br/>
"ContentId": "<The ContentId that was specified input>",<br/>
"Metadata": {<br/>
"adultscore": "0.xxx",<br/>
"a": "False",<br/>
"racyscore": "0.xxx",<br/>
"r": "True"<br/>
},<br/>
"ReviewerResultTags": {<br/>
"a": "False",<br/>
"r": "True"<br/>
}<br/>
}<br/>
</p>.
@param teamName Your team name.
@param urlContentType The content type.
@param createReviewBody Body for create reviews API
@param createReviewsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<String> object if successful. | [
"The",
"reviews",
"created",
"would",
"show",
"up",
"for",
"Reviewers",
"on",
"your",
"team",
".",
"As",
"Reviewers",
"complete",
"reviewing",
"results",
"of",
"the",
"Review",
"would",
"be",
"POSTED",
"(",
"i",
".",
"e",
".",
"HTTP",
"POST",
")",
"on",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L333-L335 |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java | SoapClient.setMethod | public SoapClient setMethod(QName name, Map<String, Object> params, boolean useMethodPrefix) {
setMethod(name);
final String prefix = name.getPrefix();
final SOAPBodyElement methodEle = this.methodEle;
for (Entry<String, Object> entry : MapUtil.wrap(params)) {
setParam(methodEle, entry.getKey(), entry.getValue(), prefix);
}
return this;
} | java | public SoapClient setMethod(QName name, Map<String, Object> params, boolean useMethodPrefix) {
setMethod(name);
final String prefix = name.getPrefix();
final SOAPBodyElement methodEle = this.methodEle;
for (Entry<String, Object> entry : MapUtil.wrap(params)) {
setParam(methodEle, entry.getKey(), entry.getValue(), prefix);
}
return this;
} | [
"public",
"SoapClient",
"setMethod",
"(",
"QName",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
",",
"boolean",
"useMethodPrefix",
")",
"{",
"setMethod",
"(",
"name",
")",
";",
"final",
"String",
"prefix",
"=",
"name",
".",
"getPrefix",... | 设置请求方法
@param name 方法名及其命名空间
@param params 参数
@param useMethodPrefix 是否使用方法的命名空间前缀
@return this | [
"设置请求方法"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L236-L245 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/util/LightWeightLinkedSet.java | LightWeightLinkedSet.addElem | protected boolean addElem(final T element) {
// validate element
if (element == null) {
throw new IllegalArgumentException("Null element is not supported.");
}
// find hashCode & index
final int hashCode = element.hashCode();
final int index = getIndex(hashCode);
// return false if already present
if (containsElem(index, element, hashCode)) {
return false;
}
modification++;
size++;
// update bucket linked list
DoubleLinkedElement<T> le = new DoubleLinkedElement<T>(element, hashCode);
le.next = entries[index];
entries[index] = le;
// insert to the end of the all-element linked list
le.after = null;
le.before = tail;
if (tail != null) {
tail.after = le;
}
tail = le;
if (head == null) {
head = le;
}
return true;
} | java | protected boolean addElem(final T element) {
// validate element
if (element == null) {
throw new IllegalArgumentException("Null element is not supported.");
}
// find hashCode & index
final int hashCode = element.hashCode();
final int index = getIndex(hashCode);
// return false if already present
if (containsElem(index, element, hashCode)) {
return false;
}
modification++;
size++;
// update bucket linked list
DoubleLinkedElement<T> le = new DoubleLinkedElement<T>(element, hashCode);
le.next = entries[index];
entries[index] = le;
// insert to the end of the all-element linked list
le.after = null;
le.before = tail;
if (tail != null) {
tail.after = le;
}
tail = le;
if (head == null) {
head = le;
}
return true;
} | [
"protected",
"boolean",
"addElem",
"(",
"final",
"T",
"element",
")",
"{",
"// validate element",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null element is not supported.\"",
")",
";",
"}",
"// find hashCode & ... | Add given element to the hash table
@return true if the element was not present in the table, false otherwise | [
"Add",
"given",
"element",
"to",
"the",
"hash",
"table"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/LightWeightLinkedSet.java#L82-L114 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/internal/JsonPolicyWriter.java | JsonPolicyWriter.writePolicyToString | public String writePolicyToString(Policy policy) {
if(!isNotNull(policy))
throw new IllegalArgumentException("Policy cannot be null");
try {
return jsonStringOf(policy);
} catch (Exception e) {
String message = "Unable to serialize policy to JSON string: "
+ e.getMessage();
throw new IllegalArgumentException(message, e);
} finally {
try { writer.close(); } catch (Exception e) { }
}
} | java | public String writePolicyToString(Policy policy) {
if(!isNotNull(policy))
throw new IllegalArgumentException("Policy cannot be null");
try {
return jsonStringOf(policy);
} catch (Exception e) {
String message = "Unable to serialize policy to JSON string: "
+ e.getMessage();
throw new IllegalArgumentException(message, e);
} finally {
try { writer.close(); } catch (Exception e) { }
}
} | [
"public",
"String",
"writePolicyToString",
"(",
"Policy",
"policy",
")",
"{",
"if",
"(",
"!",
"isNotNull",
"(",
"policy",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Policy cannot be null\"",
")",
";",
"try",
"{",
"return",
"jsonStringOf",
"(",... | Converts the specified AWS policy object to a JSON string, suitable for
passing to an AWS service.
@param policy
The AWS policy object to convert to a JSON string.
@return The JSON string representation of the specified policy object.
@throws IllegalArgumentException
If the specified policy is null or invalid and cannot be
serialized to a JSON string. | [
"Converts",
"the",
"specified",
"AWS",
"policy",
"object",
"to",
"a",
"JSON",
"string",
"suitable",
"for",
"passing",
"to",
"an",
"AWS",
"service",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/internal/JsonPolicyWriter.java#L83-L97 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.jpa/src/com/ibm/ws/ejbcontainer/jpa/injection/factory/HybridJPAObjectFactory.java | HybridJPAObjectFactory.checkSFSBAccess | @Override
protected boolean checkSFSBAccess( JPAJndiLookupInfo info, boolean isSFSB )
throws InjectionException
{
ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "checkSFSBAccess: " + info + ", " + (cmd == null ? null : cmd.getJ2EEName()));
if ( cmd instanceof BeanMetaData )
{
BeanMetaData bmd = (BeanMetaData)cmd;
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "stateful session bean");
isSFSB = bmd.isStatefulSessionBean();
String refName = info.getReferenceName();
if ( isSFSB && !bmd.ivPersistenceRefNames.contains( refName ) ) // F743-30682
{
Tr.error(tc, "PERSISTENCE_REF_DEPENDENCY_NOT_DECLARED_CNTR0315E",
bmd.j2eeName.getComponent(),
bmd.j2eeName.getModule(),
bmd.j2eeName.getApplication(),
refName);
String msg = Tr.formatMessage(tc, "PERSISTENCE_REF_DEPENDENCY_NOT_DECLARED_CNTR0315E",
bmd.j2eeName.getComponent(),
bmd.j2eeName.getModule(),
bmd.j2eeName.getApplication(),
refName);
throw new InjectionException(msg);
}
}
else
{
// even though the resource ref may have been defined in a stateful bean, the lookup
// was not within the context of a stateful bean. if this is a lookup of an ExPC, it
// should not be allowed (super will verify).
isSFSB = false;
}
boolean result = super.checkSFSBAccess( info, isSFSB ); // F743-30682
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "checkSFSBAccess: " + result);
return result;
} | java | @Override
protected boolean checkSFSBAccess( JPAJndiLookupInfo info, boolean isSFSB )
throws InjectionException
{
ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "checkSFSBAccess: " + info + ", " + (cmd == null ? null : cmd.getJ2EEName()));
if ( cmd instanceof BeanMetaData )
{
BeanMetaData bmd = (BeanMetaData)cmd;
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "stateful session bean");
isSFSB = bmd.isStatefulSessionBean();
String refName = info.getReferenceName();
if ( isSFSB && !bmd.ivPersistenceRefNames.contains( refName ) ) // F743-30682
{
Tr.error(tc, "PERSISTENCE_REF_DEPENDENCY_NOT_DECLARED_CNTR0315E",
bmd.j2eeName.getComponent(),
bmd.j2eeName.getModule(),
bmd.j2eeName.getApplication(),
refName);
String msg = Tr.formatMessage(tc, "PERSISTENCE_REF_DEPENDENCY_NOT_DECLARED_CNTR0315E",
bmd.j2eeName.getComponent(),
bmd.j2eeName.getModule(),
bmd.j2eeName.getApplication(),
refName);
throw new InjectionException(msg);
}
}
else
{
// even though the resource ref may have been defined in a stateful bean, the lookup
// was not within the context of a stateful bean. if this is a lookup of an ExPC, it
// should not be allowed (super will verify).
isSFSB = false;
}
boolean result = super.checkSFSBAccess( info, isSFSB ); // F743-30682
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "checkSFSBAccess: " + result);
return result;
} | [
"@",
"Override",
"protected",
"boolean",
"checkSFSBAccess",
"(",
"JPAJndiLookupInfo",
"info",
",",
"boolean",
"isSFSB",
")",
"throws",
"InjectionException",
"{",
"ComponentMetaData",
"cmd",
"=",
"ComponentMetaDataAccessorImpl",
".",
"getComponentMetaDataAccessor",
"(",
")... | Checks access to the specified JPA reference and returns true if the
current call to {@link #getObjectInstance} is in the context of a
Stateful Session bean. <p>
By default, this method will return what is stored in the info object as
passed by the isSFSB parameter, which will be the correct answer for EJB
modules and WAR modules that do not contain EJBs. <p>
This method is overridden here to support the EJBs in War module scenario.
In this scenario, the type of EJB using a persistence context cannot
be determined until the time of injection or lookup. At that time,
the EJB type may be determined from the CMD on the thread.
@param info the information associated with the current object creation
@return true if the object is being created in a Stateful bean context
@throws InjectionException if an invalid access is detected | [
"Checks",
"access",
"to",
"the",
"specified",
"JPA",
"reference",
"and",
"returns",
"true",
"if",
"the",
"current",
"call",
"to",
"{",
"@link",
"#getObjectInstance",
"}",
"is",
"in",
"the",
"context",
"of",
"a",
"Stateful",
"Session",
"bean",
".",
"<p",
">... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.jpa/src/com/ibm/ws/ejbcontainer/jpa/injection/factory/HybridJPAObjectFactory.java#L65-L112 |
stapler/stapler | core/example/src/example/BookStore.java | BookStore.doHello | public void doHello( StaplerRequest request, StaplerResponse response ) throws IOException, ServletException {
System.out.println("Hello operation");
request.setAttribute("systemTime",new Long(System.currentTimeMillis()));
// it can generate the response by itself, just like
// servlets can do so. Or you can redirect the client.
// Basically, you can do anything that a servlet can do.
// the following code shows how you can forward it to
// another object. It's almost like a relative URL where '.'
// corresponds to 'this' object.
response.forward(this,"helloJSP",request);
} | java | public void doHello( StaplerRequest request, StaplerResponse response ) throws IOException, ServletException {
System.out.println("Hello operation");
request.setAttribute("systemTime",new Long(System.currentTimeMillis()));
// it can generate the response by itself, just like
// servlets can do so. Or you can redirect the client.
// Basically, you can do anything that a servlet can do.
// the following code shows how you can forward it to
// another object. It's almost like a relative URL where '.'
// corresponds to 'this' object.
response.forward(this,"helloJSP",request);
} | [
"public",
"void",
"doHello",
"(",
"StaplerRequest",
"request",
",",
"StaplerResponse",
"response",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Hello operation\"",
")",
";",
"request",
".",
"setAttribute... | Define an action method that handles requests to "/hello"
(and below, like "/hello/foo/bar")
<p>
Action methods are useful to perform some operations in Java. | [
"Define",
"an",
"action",
"method",
"that",
"handles",
"requests",
"to",
"/",
"hello",
"(",
"and",
"below",
"like",
"/",
"hello",
"/",
"foo",
"/",
"bar",
")"
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/example/src/example/BookStore.java#L64-L76 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/SQLExecuteCallbackFactory.java | SQLExecuteCallbackFactory.getPreparedSQLExecuteCallback | public static SQLExecuteCallback<Boolean> getPreparedSQLExecuteCallback(final DatabaseType databaseType, final boolean isExceptionThrown) {
return new SQLExecuteCallback<Boolean>(databaseType, isExceptionThrown) {
@Override
protected Boolean executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException {
return ((PreparedStatement) statement).execute();
}
};
} | java | public static SQLExecuteCallback<Boolean> getPreparedSQLExecuteCallback(final DatabaseType databaseType, final boolean isExceptionThrown) {
return new SQLExecuteCallback<Boolean>(databaseType, isExceptionThrown) {
@Override
protected Boolean executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException {
return ((PreparedStatement) statement).execute();
}
};
} | [
"public",
"static",
"SQLExecuteCallback",
"<",
"Boolean",
">",
"getPreparedSQLExecuteCallback",
"(",
"final",
"DatabaseType",
"databaseType",
",",
"final",
"boolean",
"isExceptionThrown",
")",
"{",
"return",
"new",
"SQLExecuteCallback",
"<",
"Boolean",
">",
"(",
"data... | Get execute callback.
@param databaseType database type
@param isExceptionThrown is exception thrown
@return execute callback | [
"Get",
"execute",
"callback",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/SQLExecuteCallbackFactory.java#L60-L68 |
openbase/jul | communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java | AbstractRemoteClient.activate | @Override
public void activate() throws InterruptedException, CouldNotPerformException {
synchronized (maintainerLock) {
// Duplicated activation filter.
if (isActive()) {
return;
}
try {
verifyMaintainability();
validateInitialization();
setConnectionState(CONNECTING);
remoteServerWatchDog.activate();
listenerWatchDog.activate();
} catch (CouldNotPerformException ex) {
throw new InvalidStateException("Could not activate remote service!", ex);
}
}
} | java | @Override
public void activate() throws InterruptedException, CouldNotPerformException {
synchronized (maintainerLock) {
// Duplicated activation filter.
if (isActive()) {
return;
}
try {
verifyMaintainability();
validateInitialization();
setConnectionState(CONNECTING);
remoteServerWatchDog.activate();
listenerWatchDog.activate();
} catch (CouldNotPerformException ex) {
throw new InvalidStateException("Could not activate remote service!", ex);
}
}
} | [
"@",
"Override",
"public",
"void",
"activate",
"(",
")",
"throws",
"InterruptedException",
",",
"CouldNotPerformException",
"{",
"synchronized",
"(",
"maintainerLock",
")",
"{",
"// Duplicated activation filter.",
"if",
"(",
"isActive",
"(",
")",
")",
"{",
"return",... | {@inheritDoc}
@throws InterruptedException {@inheritDoc}
@throws CouldNotPerformException {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L376-L395 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.updateAccount | public Account updateAccount(final String accountCode, final Account account) {
return doPUT(Account.ACCOUNT_RESOURCE + "/" + accountCode, account, Account.class);
} | java | public Account updateAccount(final String accountCode, final Account account) {
return doPUT(Account.ACCOUNT_RESOURCE + "/" + accountCode, account, Account.class);
} | [
"public",
"Account",
"updateAccount",
"(",
"final",
"String",
"accountCode",
",",
"final",
"Account",
"account",
")",
"{",
"return",
"doPUT",
"(",
"Account",
".",
"ACCOUNT_RESOURCE",
"+",
"\"/\"",
"+",
"accountCode",
",",
"account",
",",
"Account",
".",
"class... | Update Account
<p>
Updates an existing account.
@param accountCode recurly account id
@param account account object
@return the updated account object on success, null otherwise | [
"Update",
"Account",
"<p",
">",
"Updates",
"an",
"existing",
"account",
"."
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L325-L327 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java | AbstractTagLibrary.addValidator | protected final void addValidator(String name, String validatorId)
{
_factories.put(name, new ValidatorHandlerFactory(validatorId));
} | java | protected final void addValidator(String name, String validatorId)
{
_factories.put(name, new ValidatorHandlerFactory(validatorId));
} | [
"protected",
"final",
"void",
"addValidator",
"(",
"String",
"name",
",",
"String",
"validatorId",
")",
"{",
"_factories",
".",
"put",
"(",
"name",
",",
"new",
"ValidatorHandlerFactory",
"(",
"validatorId",
")",
")",
";",
"}"
] | Add a ValidateHandler for the specified validatorId
@see javax.faces.view.facelets.ValidatorHandler
@see javax.faces.application.Application#createValidator(java.lang.String)
@param name
name to use, "foo" would be <my:foo />
@param validatorId
id to pass to Application instance | [
"Add",
"a",
"ValidateHandler",
"for",
"the",
"specified",
"validatorId"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L230-L233 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/DomXmlMessageValidator.java | DomXmlMessageValidator.doNamespaceQualifiedAttributeValidation | private void doNamespaceQualifiedAttributeValidation(Node receivedElement, Node receivedAttribute, Node sourceElement, Node sourceAttribute) {
String receivedValue = receivedAttribute.getNodeValue();
String sourceValue = sourceAttribute.getNodeValue();
if (receivedValue.contains(":") && sourceValue.contains(":")) {
// value has namespace prefix set, do special QName validation
String receivedPrefix = receivedValue.substring(0, receivedValue.indexOf(':'));
String sourcePrefix = sourceValue.substring(0, sourceValue.indexOf(':'));
Map<String, String> receivedNamespaces = XMLUtils.lookupNamespaces(receivedAttribute.getOwnerDocument());
receivedNamespaces.putAll(XMLUtils.lookupNamespaces(receivedElement));
if (receivedNamespaces.containsKey(receivedPrefix)) {
Map<String, String> sourceNamespaces = XMLUtils.lookupNamespaces(sourceAttribute.getOwnerDocument());
sourceNamespaces.putAll(XMLUtils.lookupNamespaces(sourceElement));
if (sourceNamespaces.containsKey(sourcePrefix)) {
Assert.isTrue(sourceNamespaces.get(sourcePrefix).equals(receivedNamespaces.get(receivedPrefix)),
ValidationUtils.buildValueMismatchErrorMessage("Values not equal for attribute value namespace '"
+ receivedValue + "'", sourceNamespaces.get(sourcePrefix), receivedNamespaces.get(receivedPrefix)));
// remove namespace prefixes as they must not form equality
receivedValue = receivedValue.substring((receivedPrefix + ":").length());
sourceValue = sourceValue.substring((sourcePrefix + ":").length());
} else {
throw new ValidationException("Received attribute value '" + receivedAttribute.getLocalName() + "' describes namespace qualified attribute value," +
" control value '" + sourceValue + "' does not");
}
}
}
Assert.isTrue(receivedValue.equals(sourceValue),
ValidationUtils.buildValueMismatchErrorMessage("Values not equal for attribute '"
+ receivedAttribute.getLocalName() + "'", sourceValue, receivedValue));
} | java | private void doNamespaceQualifiedAttributeValidation(Node receivedElement, Node receivedAttribute, Node sourceElement, Node sourceAttribute) {
String receivedValue = receivedAttribute.getNodeValue();
String sourceValue = sourceAttribute.getNodeValue();
if (receivedValue.contains(":") && sourceValue.contains(":")) {
// value has namespace prefix set, do special QName validation
String receivedPrefix = receivedValue.substring(0, receivedValue.indexOf(':'));
String sourcePrefix = sourceValue.substring(0, sourceValue.indexOf(':'));
Map<String, String> receivedNamespaces = XMLUtils.lookupNamespaces(receivedAttribute.getOwnerDocument());
receivedNamespaces.putAll(XMLUtils.lookupNamespaces(receivedElement));
if (receivedNamespaces.containsKey(receivedPrefix)) {
Map<String, String> sourceNamespaces = XMLUtils.lookupNamespaces(sourceAttribute.getOwnerDocument());
sourceNamespaces.putAll(XMLUtils.lookupNamespaces(sourceElement));
if (sourceNamespaces.containsKey(sourcePrefix)) {
Assert.isTrue(sourceNamespaces.get(sourcePrefix).equals(receivedNamespaces.get(receivedPrefix)),
ValidationUtils.buildValueMismatchErrorMessage("Values not equal for attribute value namespace '"
+ receivedValue + "'", sourceNamespaces.get(sourcePrefix), receivedNamespaces.get(receivedPrefix)));
// remove namespace prefixes as they must not form equality
receivedValue = receivedValue.substring((receivedPrefix + ":").length());
sourceValue = sourceValue.substring((sourcePrefix + ":").length());
} else {
throw new ValidationException("Received attribute value '" + receivedAttribute.getLocalName() + "' describes namespace qualified attribute value," +
" control value '" + sourceValue + "' does not");
}
}
}
Assert.isTrue(receivedValue.equals(sourceValue),
ValidationUtils.buildValueMismatchErrorMessage("Values not equal for attribute '"
+ receivedAttribute.getLocalName() + "'", sourceValue, receivedValue));
} | [
"private",
"void",
"doNamespaceQualifiedAttributeValidation",
"(",
"Node",
"receivedElement",
",",
"Node",
"receivedAttribute",
",",
"Node",
"sourceElement",
",",
"Node",
"sourceAttribute",
")",
"{",
"String",
"receivedValue",
"=",
"receivedAttribute",
".",
"getNodeValue"... | Perform validation on namespace qualified attribute values if present. This includes the validation of namespace presence
and equality.
@param receivedElement
@param receivedAttribute
@param sourceElement
@param sourceAttribute | [
"Perform",
"validation",
"on",
"namespace",
"qualified",
"attribute",
"values",
"if",
"present",
".",
"This",
"includes",
"the",
"validation",
"of",
"namespace",
"presence",
"and",
"equality",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/DomXmlMessageValidator.java#L634-L668 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/query/HiveAvroORCQueryGenerator.java | HiveAvroORCQueryGenerator.generateDropTableDDL | public static String generateDropTableDDL(String dbName, String tableName) {
return String.format("DROP TABLE IF EXISTS `%s`.`%s`", dbName, tableName);
} | java | public static String generateDropTableDDL(String dbName, String tableName) {
return String.format("DROP TABLE IF EXISTS `%s`.`%s`", dbName, tableName);
} | [
"public",
"static",
"String",
"generateDropTableDDL",
"(",
"String",
"dbName",
",",
"String",
"tableName",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"DROP TABLE IF EXISTS `%s`.`%s`\"",
",",
"dbName",
",",
"tableName",
")",
";",
"}"
] | *
Generate DDL query to drop a Hive table.
@param dbName Hive database name.
@param tableName Hive table name.
@return Command to drop the table. | [
"*",
"Generate",
"DDL",
"query",
"to",
"drop",
"a",
"Hive",
"table",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/query/HiveAvroORCQueryGenerator.java#L384-L386 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java | ReferenceCountedOpenSslContext.toBIO | static long toBIO(ByteBufAllocator allocator, X509Certificate... certChain) throws Exception {
if (certChain == null) {
return 0;
}
if (certChain.length == 0) {
throw new IllegalArgumentException("certChain can't be empty");
}
PemEncoded pem = PemX509Certificate.toPEM(allocator, true, certChain);
try {
return toBIO(allocator, pem.retain());
} finally {
pem.release();
}
} | java | static long toBIO(ByteBufAllocator allocator, X509Certificate... certChain) throws Exception {
if (certChain == null) {
return 0;
}
if (certChain.length == 0) {
throw new IllegalArgumentException("certChain can't be empty");
}
PemEncoded pem = PemX509Certificate.toPEM(allocator, true, certChain);
try {
return toBIO(allocator, pem.retain());
} finally {
pem.release();
}
} | [
"static",
"long",
"toBIO",
"(",
"ByteBufAllocator",
"allocator",
",",
"X509Certificate",
"...",
"certChain",
")",
"throws",
"Exception",
"{",
"if",
"(",
"certChain",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"certChain",
".",
"length",
"=... | Return the pointer to a <a href="https://www.openssl.org/docs/crypto/BIO_get_mem_ptr.html">in-memory BIO</a>
or {@code 0} if the {@code certChain} is {@code null}. The BIO contains the content of the {@code certChain}. | [
"Return",
"the",
"pointer",
"to",
"a",
"<a",
"href",
"=",
"https",
":",
"//",
"www",
".",
"openssl",
".",
"org",
"/",
"docs",
"/",
"crypto",
"/",
"BIO_get_mem_ptr",
".",
"html",
">",
"in",
"-",
"memory",
"BIO<",
"/",
"a",
">",
"or",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java#L833-L848 |
codelibs/jcifs | src/main/java/jcifs/smb1/Config.java | Config.getInetAddressArray | public static InetAddress[] getInetAddressArray( String key, String delim, InetAddress[] def ) {
String p = getProperty( key );
if( p != null ) {
StringTokenizer tok = new StringTokenizer( p, delim );
int len = tok.countTokens();
InetAddress[] arr = new InetAddress[len];
for( int i = 0; i < len; i++ ) {
String addr = tok.nextToken();
try {
arr[i] = InetAddress.getByName( addr );
} catch( UnknownHostException uhe ) {
if( log.level > 0 ) {
log.println( addr );
uhe.printStackTrace( log );
}
return def;
}
}
return arr;
}
return def;
} | java | public static InetAddress[] getInetAddressArray( String key, String delim, InetAddress[] def ) {
String p = getProperty( key );
if( p != null ) {
StringTokenizer tok = new StringTokenizer( p, delim );
int len = tok.countTokens();
InetAddress[] arr = new InetAddress[len];
for( int i = 0; i < len; i++ ) {
String addr = tok.nextToken();
try {
arr[i] = InetAddress.getByName( addr );
} catch( UnknownHostException uhe ) {
if( log.level > 0 ) {
log.println( addr );
uhe.printStackTrace( log );
}
return def;
}
}
return arr;
}
return def;
} | [
"public",
"static",
"InetAddress",
"[",
"]",
"getInetAddressArray",
"(",
"String",
"key",
",",
"String",
"delim",
",",
"InetAddress",
"[",
"]",
"def",
")",
"{",
"String",
"p",
"=",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"p",
"!=",
"null",
")",... | Retrieve an array of <tt>InetAddress</tt> created from a property
value containting a <tt>delim</tt> separated list of hostnames and/or
ipaddresses. | [
"Retrieve",
"an",
"array",
"of",
"<tt",
">",
"InetAddress<",
"/",
"tt",
">",
"created",
"from",
"a",
"property",
"value",
"containting",
"a",
"<tt",
">",
"delim<",
"/",
"tt",
">",
"separated",
"list",
"of",
"hostnames",
"and",
"/",
"or",
"ipaddresses",
"... | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/Config.java#L327-L348 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/Base64.java | Base64.decode4to3 | private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset )
{
// Example: Dk==
if( source[ srcOffset + 2] == EQUALS_SIGN )
{
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
destination[ destOffset ] = (byte)( outBuff >>> 16 );
return 1;
}
// Example: DkL=
else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
{
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
| ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
destination[ destOffset ] = (byte)( outBuff >>> 16 );
destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
return 2;
}
// Example: DkLE
else
{
try{
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
// | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
| ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
| ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
destination[ destOffset ] = (byte)( outBuff >> 16 );
destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
destination[ destOffset + 2 ] = (byte)( outBuff );
return 3;
}catch( Exception e){
LoggerFactory.getDefaultLogger().error(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
LoggerFactory.getDefaultLogger().error(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
LoggerFactory.getDefaultLogger().error(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
LoggerFactory.getDefaultLogger().error(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
return -1;
} // end catch
}
} | java | private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset )
{
// Example: Dk==
if( source[ srcOffset + 2] == EQUALS_SIGN )
{
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
destination[ destOffset ] = (byte)( outBuff >>> 16 );
return 1;
}
// Example: DkL=
else if( source[ srcOffset + 3 ] == EQUALS_SIGN )
{
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
| ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 );
destination[ destOffset ] = (byte)( outBuff >>> 16 );
destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 );
return 2;
}
// Example: DkLE
else
{
try{
// Two ways to do the same thing. Don't know which way I like best.
//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
// | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 )
| ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
| ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6)
| ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) );
destination[ destOffset ] = (byte)( outBuff >> 16 );
destination[ destOffset + 1 ] = (byte)( outBuff >> 8 );
destination[ destOffset + 2 ] = (byte)( outBuff );
return 3;
}catch( Exception e){
LoggerFactory.getDefaultLogger().error(""+source[srcOffset]+ ": " + ( DECODABET[ source[ srcOffset ] ] ) );
LoggerFactory.getDefaultLogger().error(""+source[srcOffset+1]+ ": " + ( DECODABET[ source[ srcOffset + 1 ] ] ) );
LoggerFactory.getDefaultLogger().error(""+source[srcOffset+2]+ ": " + ( DECODABET[ source[ srcOffset + 2 ] ] ) );
LoggerFactory.getDefaultLogger().error(""+source[srcOffset+3]+ ": " + ( DECODABET[ source[ srcOffset + 3 ] ] ) );
return -1;
} // end catch
}
} | [
"private",
"static",
"int",
"decode4to3",
"(",
"byte",
"[",
"]",
"source",
",",
"int",
"srcOffset",
",",
"byte",
"[",
"]",
"destination",
",",
"int",
"destOffset",
")",
"{",
"// Example: Dk==\r",
"if",
"(",
"source",
"[",
"srcOffset",
"+",
"2",
"]",
"=="... | Decodes four bytes from array <var>source</var>
and writes the resulting bytes (up to three of them)
to <var>destination</var>.
The source and destination arrays can be manipulated
anywhere along their length by specifying
<var>srcOffset</var> and <var>destOffset</var>.
This method does not check to make sure your arrays
are large enough to accomodate <var>srcOffset</var> + 4 for
the <var>source</var> array or <var>destOffset</var> + 3 for
the <var>destination</var> array.
This method returns the actual number of bytes that
were converted from the Base64 encoding.
@param source the array to convert
@param srcOffset the index where conversion begins
@param destination the array to hold the conversion
@param destOffset the index where output will be put
@return the number of decoded bytes converted
@since 1.3 | [
"Decodes",
"four",
"bytes",
"from",
"array",
"<var",
">",
"source<",
"/",
"var",
">",
"and",
"writes",
"the",
"resulting",
"bytes",
"(",
"up",
"to",
"three",
"of",
"them",
")",
"to",
"<var",
">",
"destination<",
"/",
"var",
">",
".",
"The",
"source",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/Base64.java#L623-L682 |
keenlabs/KeenClient-Java | core/src/main/java/io/keen/client/java/KeenClient.java | KeenClient.addEvent | public void addEvent(KeenProject project, String eventCollection, Map<String, Object> event,
Map<String, Object> keenProperties, KeenCallback callback) {
if (!isActive) {
handleLibraryInactive(callback);
return;
}
if (project == null && defaultProject == null) {
handleFailure(null,
project,
eventCollection,
event,
keenProperties,
new IllegalStateException("No project specified, but no default project found"));
return;
}
KeenProject useProject = (project == null ? defaultProject : project);
try {
// Build the event.
Map<String, Object> newEvent =
validateAndBuildEvent(useProject, eventCollection, event, keenProperties);
// Publish the event.
publish(useProject, eventCollection, newEvent);
handleSuccess(callback, project, eventCollection, event, keenProperties);
} catch (Exception e) {
handleFailure(callback, project, eventCollection, event, keenProperties, e);
}
} | java | public void addEvent(KeenProject project, String eventCollection, Map<String, Object> event,
Map<String, Object> keenProperties, KeenCallback callback) {
if (!isActive) {
handleLibraryInactive(callback);
return;
}
if (project == null && defaultProject == null) {
handleFailure(null,
project,
eventCollection,
event,
keenProperties,
new IllegalStateException("No project specified, but no default project found"));
return;
}
KeenProject useProject = (project == null ? defaultProject : project);
try {
// Build the event.
Map<String, Object> newEvent =
validateAndBuildEvent(useProject, eventCollection, event, keenProperties);
// Publish the event.
publish(useProject, eventCollection, newEvent);
handleSuccess(callback, project, eventCollection, event, keenProperties);
} catch (Exception e) {
handleFailure(callback, project, eventCollection, event, keenProperties, e);
}
} | [
"public",
"void",
"addEvent",
"(",
"KeenProject",
"project",
",",
"String",
"eventCollection",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"event",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"keenProperties",
",",
"KeenCallback",
"callback",
")",
"{",... | Synchronously adds an event to the specified collection. This method will immediately
publish the event to the Keen server in the current thread.
@param project The project in which to publish the event. If a default project has been set
on the client, this parameter may be null, in which case the default project
will be used.
@param eventCollection The name of the collection in which to publish the event.
@param event A Map that consists of key/value pairs. Keen naming conventions apply (see
docs). Nested Maps and lists are acceptable (and encouraged!).
@param keenProperties A Map that consists of key/value pairs to override default properties.
ex: "timestamp" -> Calendar.getInstance()
@param callback An optional callback to receive notification of success or failure. | [
"Synchronously",
"adds",
"an",
"event",
"to",
"the",
"specified",
"collection",
".",
"This",
"method",
"will",
"immediately",
"publish",
"the",
"event",
"to",
"the",
"Keen",
"server",
"in",
"the",
"current",
"thread",
"."
] | train | https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/KeenClient.java#L146-L176 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/GeomFactory3ifx.java | GeomFactory3ifx.newPoint | @SuppressWarnings("static-method")
public Point3ifx newPoint(IntegerProperty x, IntegerProperty y, IntegerProperty z) {
return new Point3ifx(x, y, z);
} | java | @SuppressWarnings("static-method")
public Point3ifx newPoint(IntegerProperty x, IntegerProperty y, IntegerProperty z) {
return new Point3ifx(x, y, z);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"Point3ifx",
"newPoint",
"(",
"IntegerProperty",
"x",
",",
"IntegerProperty",
"y",
",",
"IntegerProperty",
"z",
")",
"{",
"return",
"new",
"Point3ifx",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
... | Create a point with properties.
@param x the x property.
@param y the y property.
@param z the z property.
@return the vector. | [
"Create",
"a",
"point",
"with",
"properties",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/GeomFactory3ifx.java#L106-L109 |
jbundle/jbundle | thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageReceiverFilterList.java | MessageReceiverFilterList.removeMessageFilter | public boolean removeMessageFilter(Integer intFilterID, boolean bFreeFilter)
{
BaseMessageFilter filter = (BaseMessageFilter)m_mapFilters.remove(intFilterID);
if (filter == null)
{
System.out.println("Error: BaseMessageReceiver.removeMessageFilter");
return false;
}
filter.setMessageReceiver(null, null); // Make sure free doesn't try to remove filter again.
if (bFreeFilter)
filter.free();
return true; // Success.
} | java | public boolean removeMessageFilter(Integer intFilterID, boolean bFreeFilter)
{
BaseMessageFilter filter = (BaseMessageFilter)m_mapFilters.remove(intFilterID);
if (filter == null)
{
System.out.println("Error: BaseMessageReceiver.removeMessageFilter");
return false;
}
filter.setMessageReceiver(null, null); // Make sure free doesn't try to remove filter again.
if (bFreeFilter)
filter.free();
return true; // Success.
} | [
"public",
"boolean",
"removeMessageFilter",
"(",
"Integer",
"intFilterID",
",",
"boolean",
"bFreeFilter",
")",
"{",
"BaseMessageFilter",
"filter",
"=",
"(",
"BaseMessageFilter",
")",
"m_mapFilters",
".",
"remove",
"(",
"intFilterID",
")",
";",
"if",
"(",
"filter",... | Remove this message filter from this queue.
Note: This will remove a filter that equals this filter, accounting for a copy
passed from a remote client.
@param messageFilter The message filter to remove.
@param bFreeFilter If true, free this filter.
@return True if successful. | [
"Remove",
"this",
"message",
"filter",
"from",
"this",
"queue",
".",
"Note",
":",
"This",
"will",
"remove",
"a",
"filter",
"that",
"equals",
"this",
"filter",
"accounting",
"for",
"a",
"copy",
"passed",
"from",
"a",
"remote",
"client",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageReceiverFilterList.java#L158-L170 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java | ConcurrentLinkedHashMap.tryToRetire | boolean tryToRetire(Node<K, V> node, WeightedValue<V> expect) {
if (expect.isAlive()) {
final WeightedValue<V> retired = new WeightedValue<V>(expect.value, -expect.weight);
return node.compareAndSet(expect, retired);
}
return false;
} | java | boolean tryToRetire(Node<K, V> node, WeightedValue<V> expect) {
if (expect.isAlive()) {
final WeightedValue<V> retired = new WeightedValue<V>(expect.value, -expect.weight);
return node.compareAndSet(expect, retired);
}
return false;
} | [
"boolean",
"tryToRetire",
"(",
"Node",
"<",
"K",
",",
"V",
">",
"node",
",",
"WeightedValue",
"<",
"V",
">",
"expect",
")",
"{",
"if",
"(",
"expect",
".",
"isAlive",
"(",
")",
")",
"{",
"final",
"WeightedValue",
"<",
"V",
">",
"retired",
"=",
"new"... | Attempts to transition the node from the <tt>alive</tt> state to the
<tt>retired</tt> state.
@param node the entry in the page replacement policy
@param expect the expected weighted value
@return if successful | [
"Attempts",
"to",
"transition",
"the",
"node",
"from",
"the",
"<tt",
">",
"alive<",
"/",
"tt",
">",
"state",
"to",
"the",
"<tt",
">",
"retired<",
"/",
"tt",
">",
"state",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java#L484-L490 |
morfologik/morfologik-stemming | morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSAUtils.java | FSAUtils.toDot | public static void toDot(Writer w, FSA fsa, int node) throws IOException {
w.write("digraph Automaton {\n");
w.write(" rankdir = LR;\n");
final BitSet visited = new BitSet();
w.write(" stop [shape=doublecircle,label=\"\"];\n");
w.write(" initial [shape=plaintext,label=\"\"];\n");
w.write(" initial -> " + node + "\n\n");
visitNode(w, 0, fsa, node, visited);
w.write("}\n");
} | java | public static void toDot(Writer w, FSA fsa, int node) throws IOException {
w.write("digraph Automaton {\n");
w.write(" rankdir = LR;\n");
final BitSet visited = new BitSet();
w.write(" stop [shape=doublecircle,label=\"\"];\n");
w.write(" initial [shape=plaintext,label=\"\"];\n");
w.write(" initial -> " + node + "\n\n");
visitNode(w, 0, fsa, node, visited);
w.write("}\n");
} | [
"public",
"static",
"void",
"toDot",
"(",
"Writer",
"w",
",",
"FSA",
"fsa",
",",
"int",
"node",
")",
"throws",
"IOException",
"{",
"w",
".",
"write",
"(",
"\"digraph Automaton {\\n\"",
")",
";",
"w",
".",
"write",
"(",
"\" rankdir = LR;\\n\"",
")",
";",
... | Saves the right-language reachable from a given FSA node, formatted as an
input for the graphviz package (expressed in the <code>dot</code>
language), to the given writer.
@param w The writer to write dot language description of the automaton.
@param fsa The automaton to visualize.
@param node Starting node (subgraph will be visualized unless it's the automaton's root node).
@throws IOException Rethrown if an I/O exception occurs. | [
"Saves",
"the",
"right",
"-",
"language",
"reachable",
"from",
"a",
"given",
"FSA",
"node",
"formatted",
"as",
"an",
"input",
"for",
"the",
"graphviz",
"package",
"(",
"expressed",
"in",
"the",
"<code",
">",
"dot<",
"/",
"code",
">",
"language",
")",
"to... | train | https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSAUtils.java#L62-L74 |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpResponse.java | HttpResponse.writeBody | public long writeBody(OutputStream out, boolean isCloseOut, StreamProgress streamProgress) {
if (null == out) {
throw new NullPointerException("[out] is null!");
}
try {
return IoUtil.copyByNIO(bodyStream(), out, IoUtil.DEFAULT_BUFFER_SIZE, streamProgress);
} finally {
IoUtil.close(this);
if (isCloseOut) {
IoUtil.close(out);
}
}
} | java | public long writeBody(OutputStream out, boolean isCloseOut, StreamProgress streamProgress) {
if (null == out) {
throw new NullPointerException("[out] is null!");
}
try {
return IoUtil.copyByNIO(bodyStream(), out, IoUtil.DEFAULT_BUFFER_SIZE, streamProgress);
} finally {
IoUtil.close(this);
if (isCloseOut) {
IoUtil.close(out);
}
}
} | [
"public",
"long",
"writeBody",
"(",
"OutputStream",
"out",
",",
"boolean",
"isCloseOut",
",",
"StreamProgress",
"streamProgress",
")",
"{",
"if",
"(",
"null",
"==",
"out",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"[out] is null!\"",
")",
";",
"... | 将响应内容写出到{@link OutputStream}<br>
异步模式下直接读取Http流写出,同步模式下将存储在内存中的响应内容写出<br>
写出后会关闭Http流(异步模式)
@param out 写出的流
@param isCloseOut 是否关闭输出流
@param streamProgress 进度显示接口,通过实现此接口显示下载进度
@return 写出bytes数
@since 3.3.2 | [
"将响应内容写出到",
"{",
"@link",
"OutputStream",
"}",
"<br",
">",
"异步模式下直接读取Http流写出,同步模式下将存储在内存中的响应内容写出<br",
">",
"写出后会关闭Http流(异步模式)"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpResponse.java#L235-L247 |
playn/playn | html/src/playn/html/HtmlInput.java | HtmlInput.getRelativeX | static float getRelativeX (NativeEvent e, Element target) {
return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
} | java | static float getRelativeX (NativeEvent e, Element target) {
return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
} | [
"static",
"float",
"getRelativeX",
"(",
"NativeEvent",
"e",
",",
"Element",
"target",
")",
"{",
"return",
"(",
"e",
".",
"getClientX",
"(",
")",
"-",
"target",
".",
"getAbsoluteLeft",
"(",
")",
"+",
"target",
".",
"getScrollLeft",
"(",
")",
"+",
"target"... | Gets the event's x-position relative to a given element.
@param e native event
@param target the element whose coordinate system is to be used
@return the relative x-position | [
"Gets",
"the",
"event",
"s",
"x",
"-",
"position",
"relative",
"to",
"a",
"given",
"element",
"."
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/html/HtmlInput.java#L311-L314 |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/iter/Generators.java | Generators.serialMinuteGenerator | static Generator serialMinuteGenerator(final int interval, final DateValue dtStart) {
final TimeValue dtStartTime = TimeUtils.timeOf(dtStart);
return new Generator() {
int minute = dtStartTime.minute() - interval;
int hour = dtStartTime.hour();
int day = dtStart.day();
int month = dtStart.month();
int year = dtStart.year();
@Override
boolean generate(DTBuilder builder) {
int nminute;
if (hour != builder.hour || day != builder.day || month != builder.month || year != builder.year) {
int minutesBetween = (daysBetween(builder, year, month, day) * 24 + builder.hour - hour) * 60 - minute;
nminute = ((interval - (minutesBetween % interval)) % interval);
if (nminute > 59) {
/*
* Don't update day so that the difference calculation
* above is correct when this function is reentered with
* a different day.
*/
return false;
}
hour = builder.hour;
day = builder.day;
month = builder.month;
year = builder.year;
} else {
nminute = minute + interval;
if (nminute > 59) {
return false;
}
}
minute = builder.minute = nminute;
return true;
}
@Override
public String toString() {
return "serialMinuteGenerator:" + interval;
}
};
} | java | static Generator serialMinuteGenerator(final int interval, final DateValue dtStart) {
final TimeValue dtStartTime = TimeUtils.timeOf(dtStart);
return new Generator() {
int minute = dtStartTime.minute() - interval;
int hour = dtStartTime.hour();
int day = dtStart.day();
int month = dtStart.month();
int year = dtStart.year();
@Override
boolean generate(DTBuilder builder) {
int nminute;
if (hour != builder.hour || day != builder.day || month != builder.month || year != builder.year) {
int minutesBetween = (daysBetween(builder, year, month, day) * 24 + builder.hour - hour) * 60 - minute;
nminute = ((interval - (minutesBetween % interval)) % interval);
if (nminute > 59) {
/*
* Don't update day so that the difference calculation
* above is correct when this function is reentered with
* a different day.
*/
return false;
}
hour = builder.hour;
day = builder.day;
month = builder.month;
year = builder.year;
} else {
nminute = minute + interval;
if (nminute > 59) {
return false;
}
}
minute = builder.minute = nminute;
return true;
}
@Override
public String toString() {
return "serialMinuteGenerator:" + interval;
}
};
} | [
"static",
"Generator",
"serialMinuteGenerator",
"(",
"final",
"int",
"interval",
",",
"final",
"DateValue",
"dtStart",
")",
"{",
"final",
"TimeValue",
"dtStartTime",
"=",
"TimeUtils",
".",
"timeOf",
"(",
"dtStart",
")",
";",
"return",
"new",
"Generator",
"(",
... | Constructs a generator that generates minutes in the given date's hour
successively counting from the first minute passed in.
@param interval number of minutes to advance each step
@param dtStart the date
@return the minute in dtStart the first time called and interval + last
return value on subsequent calls | [
"Constructs",
"a",
"generator",
"that",
"generates",
"minutes",
"in",
"the",
"given",
"date",
"s",
"hour",
"successively",
"counting",
"from",
"the",
"first",
"minute",
"passed",
"in",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/Generators.java#L296-L338 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardAtomGenerator.java | StandardAtomGenerator.generateSymbol | AtomSymbol generateSymbol(IAtomContainer container, IAtom atom, HydrogenPosition position, RendererModel model) {
if (atom instanceof IPseudoAtom) {
IPseudoAtom pAtom = (IPseudoAtom) atom;
if (pAtom.getAttachPointNum() <= 0) {
if (pAtom.getLabel().equals("*")) {
int mass = unboxSafely(pAtom.getMassNumber(), 0);
int charge = unboxSafely(pAtom.getFormalCharge(), 0);
int hcnt = unboxSafely(pAtom.getImplicitHydrogenCount(), 0);
int nrad = container.getConnectedSingleElectronsCount(atom);
if (mass != 0 || charge != 0 || hcnt != 0) {
return generatePeriodicSymbol(0, hcnt,
mass, charge,
nrad, position);
}
}
return generatePseudoSymbol(accessPseudoLabel(pAtom, "?"), position);
}
else
return null; // attach point drawn in bond generator
} else {
int number = unboxSafely(atom.getAtomicNumber(), Elements.ofString(atom.getSymbol()).number());
// unset the mass if it's the major isotope (could be an option)
Integer mass = atom.getMassNumber();
if (number != 0 &&
mass != null &&
model != null &&
model.get(StandardGenerator.OmitMajorIsotopes.class) &&
isMajorIsotope(number, mass)) {
mass = null;
}
return generatePeriodicSymbol(number, unboxSafely(atom.getImplicitHydrogenCount(), 0),
unboxSafely(mass, -1), unboxSafely(atom.getFormalCharge(), 0),
container.getConnectedSingleElectronsCount(atom), position);
}
} | java | AtomSymbol generateSymbol(IAtomContainer container, IAtom atom, HydrogenPosition position, RendererModel model) {
if (atom instanceof IPseudoAtom) {
IPseudoAtom pAtom = (IPseudoAtom) atom;
if (pAtom.getAttachPointNum() <= 0) {
if (pAtom.getLabel().equals("*")) {
int mass = unboxSafely(pAtom.getMassNumber(), 0);
int charge = unboxSafely(pAtom.getFormalCharge(), 0);
int hcnt = unboxSafely(pAtom.getImplicitHydrogenCount(), 0);
int nrad = container.getConnectedSingleElectronsCount(atom);
if (mass != 0 || charge != 0 || hcnt != 0) {
return generatePeriodicSymbol(0, hcnt,
mass, charge,
nrad, position);
}
}
return generatePseudoSymbol(accessPseudoLabel(pAtom, "?"), position);
}
else
return null; // attach point drawn in bond generator
} else {
int number = unboxSafely(atom.getAtomicNumber(), Elements.ofString(atom.getSymbol()).number());
// unset the mass if it's the major isotope (could be an option)
Integer mass = atom.getMassNumber();
if (number != 0 &&
mass != null &&
model != null &&
model.get(StandardGenerator.OmitMajorIsotopes.class) &&
isMajorIsotope(number, mass)) {
mass = null;
}
return generatePeriodicSymbol(number, unboxSafely(atom.getImplicitHydrogenCount(), 0),
unboxSafely(mass, -1), unboxSafely(atom.getFormalCharge(), 0),
container.getConnectedSingleElectronsCount(atom), position);
}
} | [
"AtomSymbol",
"generateSymbol",
"(",
"IAtomContainer",
"container",
",",
"IAtom",
"atom",
",",
"HydrogenPosition",
"position",
",",
"RendererModel",
"model",
")",
"{",
"if",
"(",
"atom",
"instanceof",
"IPseudoAtom",
")",
"{",
"IPseudoAtom",
"pAtom",
"=",
"(",
"I... | Generate the displayed atom symbol for an atom in given structure with the specified hydrogen
position.
@param container structure to which the atom belongs
@param atom the atom to generate the symbol for
@param position the hydrogen position
@param model additional rendering options
@return atom symbol | [
"Generate",
"the",
"displayed",
"atom",
"symbol",
"for",
"an",
"atom",
"in",
"given",
"structure",
"with",
"the",
"specified",
"hydrogen",
"position",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardAtomGenerator.java#L118-L154 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.abortMultipartUpload | public void abortMultipartUpload(String bucketName, String key, String uploadId) {
this.abortMultipartUpload(new AbortMultipartUploadRequest(bucketName, key, uploadId));
} | java | public void abortMultipartUpload(String bucketName, String key, String uploadId) {
this.abortMultipartUpload(new AbortMultipartUploadRequest(bucketName, key, uploadId));
} | [
"public",
"void",
"abortMultipartUpload",
"(",
"String",
"bucketName",
",",
"String",
"key",
",",
"String",
"uploadId",
")",
"{",
"this",
".",
"abortMultipartUpload",
"(",
"new",
"AbortMultipartUploadRequest",
"(",
"bucketName",
",",
"key",
",",
"uploadId",
")",
... | Aborts a multipart upload. After a multipart upload is aborted, no
additional parts can be uploaded using that upload ID. The storage
consumed by any previously uploaded parts will be freed. However, if any
part uploads are currently in progress, those part uploads may or may not
succeed. As a result, it may be necessary to abort a given multipart
upload multiple times in order to completely free all storage consumed by
all parts.
@param bucketName The name of the bucket containing the multipart upload to abort.
@param key The key of the multipart upload to abort.
@param uploadId The ID of the multipart upload to abort. | [
"Aborts",
"a",
"multipart",
"upload",
".",
"After",
"a",
"multipart",
"upload",
"is",
"aborted",
"no",
"additional",
"parts",
"can",
"be",
"uploaded",
"using",
"that",
"upload",
"ID",
".",
"The",
"storage",
"consumed",
"by",
"any",
"previously",
"uploaded",
... | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1312-L1314 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/CmsContainerpageService.java | CmsContainerpageService.getNoEditReason | private String getNoEditReason(CmsObject cms, CmsResource containerPage) throws CmsException {
return new CmsResourceUtil(cms, containerPage).getNoEditReason(
OpenCms.getWorkplaceManager().getWorkplaceLocale(cms));
} | java | private String getNoEditReason(CmsObject cms, CmsResource containerPage) throws CmsException {
return new CmsResourceUtil(cms, containerPage).getNoEditReason(
OpenCms.getWorkplaceManager().getWorkplaceLocale(cms));
} | [
"private",
"String",
"getNoEditReason",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"containerPage",
")",
"throws",
"CmsException",
"{",
"return",
"new",
"CmsResourceUtil",
"(",
"cms",
",",
"containerPage",
")",
".",
"getNoEditReason",
"(",
"OpenCms",
".",
"getWo... | Returns the no-edit reason for the given resource.<p>
@param cms the current cms object
@param containerPage the resource
@return the no-edit reason, empty if editing is allowed
@throws CmsException is something goes wrong | [
"Returns",
"the",
"no",
"-",
"edit",
"reason",
"for",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsContainerpageService.java#L2591-L2595 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.addVideoFrameUrlAsync | public Observable<Void> addVideoFrameUrlAsync(String teamName, String reviewId, String contentType, List<VideoFrameBodyItem> videoFrameBody, AddVideoFrameUrlOptionalParameter addVideoFrameUrlOptionalParameter) {
return addVideoFrameUrlWithServiceResponseAsync(teamName, reviewId, contentType, videoFrameBody, addVideoFrameUrlOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> addVideoFrameUrlAsync(String teamName, String reviewId, String contentType, List<VideoFrameBodyItem> videoFrameBody, AddVideoFrameUrlOptionalParameter addVideoFrameUrlOptionalParameter) {
return addVideoFrameUrlWithServiceResponseAsync(teamName, reviewId, contentType, videoFrameBody, addVideoFrameUrlOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"addVideoFrameUrlAsync",
"(",
"String",
"teamName",
",",
"String",
"reviewId",
",",
"String",
"contentType",
",",
"List",
"<",
"VideoFrameBodyItem",
">",
"videoFrameBody",
",",
"AddVideoFrameUrlOptionalParameter",
"addVideoFrame... | Use this method to add frames for a video review.Timescale: This parameter is a factor which is used to convert the timestamp on a frame into milliseconds. Timescale is provided in the output of the Content Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is Ticks/Second.
@param teamName Your team name.
@param reviewId Id of the review.
@param contentType The content type.
@param videoFrameBody Body for add video frames API
@param addVideoFrameUrlOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Use",
"this",
"method",
"to",
"add",
"frames",
"for",
"a",
"video",
"review",
".",
"Timescale",
":",
"This",
"parameter",
"is",
"a",
"factor",
"which",
"is",
"used",
"to",
"convert",
"the",
"timestamp",
"on",
"a",
"frame",
"into",
"milliseconds",
".",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L2212-L2219 |
lingochamp/okdownload | okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationHelper.java | FileDownloadNotificationHelper.showProgress | public void showProgress(final int id, final int sofar, final int total) {
final T notification = get(id);
if (notification == null) {
return;
}
notification.updateStatus(FileDownloadStatus.progress);
notification.update(sofar, total);
} | java | public void showProgress(final int id, final int sofar, final int total) {
final T notification = get(id);
if (notification == null) {
return;
}
notification.updateStatus(FileDownloadStatus.progress);
notification.update(sofar, total);
} | [
"public",
"void",
"showProgress",
"(",
"final",
"int",
"id",
",",
"final",
"int",
"sofar",
",",
"final",
"int",
"total",
")",
"{",
"final",
"T",
"notification",
"=",
"get",
"(",
"id",
")",
";",
"if",
"(",
"notification",
"==",
"null",
")",
"{",
"retu... | Show the notification with the exact progress.
@param id The download id.
@param sofar The downloaded bytes so far.
@param total The total bytes of this task. | [
"Show",
"the",
"notification",
"with",
"the",
"exact",
"progress",
"."
] | train | https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload-filedownloader/src/main/java/com/liulishuo/filedownloader/notification/FileDownloadNotificationHelper.java#L79-L88 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/lang/ExcelDateUtils.java | ExcelDateUtils.convertExcelNumber | public static double convertExcelNumber(final Date value, final boolean startDate1904) {
ArgUtils.notNull(value, "value");
/*
* Excelの時間の表現に直す。
* ・Excelの日付の形式の場合小数部が時間を示すため、24時間分のミリ秒を考慮する。
*/
long utcDay = value.getTime();
BigDecimal numValue = new BigDecimal(utcDay);
numValue = numValue.divide(new BigDecimal(SECONDS_IN_DAYS * 1000), 17, BigDecimal.ROUND_HALF_UP);
if(startDate1904) {
// 1904年始まりの場合
numValue = numValue.subtract(new BigDecimal(OFFSET_DAYS_1904));
} else {
// 1900年始まりの場合
numValue = numValue.subtract(new BigDecimal(OFFSET_DAYS_1900));
if(numValue.compareTo(new BigDecimal(NON_LEAP_DAY - 1)) >= 0) {
numValue = numValue.add(new BigDecimal(1));
}
}
return numValue.doubleValue();
} | java | public static double convertExcelNumber(final Date value, final boolean startDate1904) {
ArgUtils.notNull(value, "value");
/*
* Excelの時間の表現に直す。
* ・Excelの日付の形式の場合小数部が時間を示すため、24時間分のミリ秒を考慮する。
*/
long utcDay = value.getTime();
BigDecimal numValue = new BigDecimal(utcDay);
numValue = numValue.divide(new BigDecimal(SECONDS_IN_DAYS * 1000), 17, BigDecimal.ROUND_HALF_UP);
if(startDate1904) {
// 1904年始まりの場合
numValue = numValue.subtract(new BigDecimal(OFFSET_DAYS_1904));
} else {
// 1900年始まりの場合
numValue = numValue.subtract(new BigDecimal(OFFSET_DAYS_1900));
if(numValue.compareTo(new BigDecimal(NON_LEAP_DAY - 1)) >= 0) {
numValue = numValue.add(new BigDecimal(1));
}
}
return numValue.doubleValue();
} | [
"public",
"static",
"double",
"convertExcelNumber",
"(",
"final",
"Date",
"value",
",",
"final",
"boolean",
"startDate1904",
")",
"{",
"ArgUtils",
".",
"notNull",
"(",
"value",
",",
"\"value\"",
")",
";",
"/*\r\n * Excelの時間の表現に直す。\r\n * ・Excelの日付の形式の場合小数... | Javaの{@link Date}型をExcelの内部表現の数値に変換する。
<p>小数の桁数に関する注意事項。</p>
<ul>
<li>このメソッドは少数は第16位まで保証し、小数第17位は四捨五入して計算します。</li>
<li>Excelの1秒は、UTC上では1/(60x60x24x1000)=0.0000000115741=1.15741e-008であるので、小数13位までの精度が必要。</li>
<li>Excelは秒までだが、Javaはミリ秒まで存在するので、さらに3桁多い、16桁までの精度が必要になる。</li>
</ul>
<p>1900年始まりの場合は以下の注意が必要。</p>
<ul>
<li>UTC上は1900年2月29日は存在しないため、{@literal 60.0}への変換はできません。</li>
</ul>
@param value 変換対象のJava表現上の日時。タイムゾーンを排除した(GMT-00:00)日時。
@param startDate1904 基準日が1904年始まりかどうか。
@return Excel表現上に変換した数値。
@throws IllegalArgumentException {@literal value == nulll.} | [
"Javaの",
"{",
"@link",
"Date",
"}",
"型をExcelの内部表現の数値に変換する。",
"<p",
">",
"小数の桁数に関する注意事項。<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"このメソッドは少数は第16位まで保証し、小数第17位は四捨五入して計算します。<",
"/",
"li",
">",
"<li",
">",
"Excelの1秒は、UTC上では1",
"/",
"(",
"60x60x24x1000",
")",
"=",
... | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/lang/ExcelDateUtils.java#L141-L169 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/util/SignalUtil.java | SignalUtil.formatMessage | static String formatMessage(String fmt, Object[] args) {
MessageFormat formatter = new MessageFormat(fmt);
Format[] formats = formatter.getFormatsByArgumentIndex();
StringBuffer msg = new StringBuffer();
formatter.format(args, msg, null);
if (args.length > formats.length) {
// We have extra arguements that were not included in the format string.
// Append them to the result
for (int i = formats.length; i < args.length; i++) {
msg.append(i == formats.length ? ": " : ", ") //$NON-NLS-1$ //$NON-NLS-2$
.append(args[i].toString());
}
}
return msg.toString();
} | java | static String formatMessage(String fmt, Object[] args) {
MessageFormat formatter = new MessageFormat(fmt);
Format[] formats = formatter.getFormatsByArgumentIndex();
StringBuffer msg = new StringBuffer();
formatter.format(args, msg, null);
if (args.length > formats.length) {
// We have extra arguements that were not included in the format string.
// Append them to the result
for (int i = formats.length; i < args.length; i++) {
msg.append(i == formats.length ? ": " : ", ") //$NON-NLS-1$ //$NON-NLS-2$
.append(args[i].toString());
}
}
return msg.toString();
} | [
"static",
"String",
"formatMessage",
"(",
"String",
"fmt",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"MessageFormat",
"formatter",
"=",
"new",
"MessageFormat",
"(",
"fmt",
")",
";",
"Format",
"[",
"]",
"formats",
"=",
"formatter",
".",
"getFormatsByArgument... | Formats the specified string using the specified arguments. If the argument array contains
more elements than the format string can accommodate, then the additional arguments are
appended to the end of the formatted string.
@param fmt
the format string
@param args
the argument array for the replaceable parameters in the format string
@return the formatted string | [
"Formats",
"the",
"specified",
"string",
"using",
"the",
"specified",
"arguments",
".",
"If",
"the",
"argument",
"array",
"contains",
"more",
"elements",
"than",
"the",
"format",
"string",
"can",
"accommodate",
"then",
"the",
"additional",
"arguments",
"are",
"a... | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/SignalUtil.java#L61-L75 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/ShardingDataSourceFactory.java | ShardingDataSourceFactory.createDataSource | public static DataSource createDataSource(
final Map<String, DataSource> dataSourceMap, final ShardingRuleConfiguration shardingRuleConfig, final Properties props) throws SQLException {
return new ShardingDataSource(dataSourceMap, new ShardingRule(shardingRuleConfig, dataSourceMap.keySet()), props);
} | java | public static DataSource createDataSource(
final Map<String, DataSource> dataSourceMap, final ShardingRuleConfiguration shardingRuleConfig, final Properties props) throws SQLException {
return new ShardingDataSource(dataSourceMap, new ShardingRule(shardingRuleConfig, dataSourceMap.keySet()), props);
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"final",
"Map",
"<",
"String",
",",
"DataSource",
">",
"dataSourceMap",
",",
"final",
"ShardingRuleConfiguration",
"shardingRuleConfig",
",",
"final",
"Properties",
"props",
")",
"throws",
"SQLException",
"{",... | Create sharding data source.
@param dataSourceMap data source map
@param shardingRuleConfig rule configuration for databases and tables sharding
@param props properties for data source
@return sharding data source
@throws SQLException SQL exception | [
"Create",
"sharding",
"data",
"source",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/ShardingDataSourceFactory.java#L48-L51 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java | BpmnParse.parseAsynchronousContinuation | protected void parseAsynchronousContinuation(Element element, ActivityImpl activity) {
boolean isAsyncBefore = isAsyncBefore(element);
boolean isAsyncAfter = isAsyncAfter(element);
boolean exclusive = isExclusive(element);
// set properties on activity
activity.setAsyncBefore(isAsyncBefore, exclusive);
activity.setAsyncAfter(isAsyncAfter, exclusive);
} | java | protected void parseAsynchronousContinuation(Element element, ActivityImpl activity) {
boolean isAsyncBefore = isAsyncBefore(element);
boolean isAsyncAfter = isAsyncAfter(element);
boolean exclusive = isExclusive(element);
// set properties on activity
activity.setAsyncBefore(isAsyncBefore, exclusive);
activity.setAsyncAfter(isAsyncAfter, exclusive);
} | [
"protected",
"void",
"parseAsynchronousContinuation",
"(",
"Element",
"element",
",",
"ActivityImpl",
"activity",
")",
"{",
"boolean",
"isAsyncBefore",
"=",
"isAsyncBefore",
"(",
"element",
")",
";",
"boolean",
"isAsyncAfter",
"=",
"isAsyncAfter",
"(",
"element",
")... | Parse async continuation of the given element and create async jobs for the activity.
@param element with async characteristics
@param activity | [
"Parse",
"async",
"continuation",
"of",
"the",
"given",
"element",
"and",
"create",
"async",
"jobs",
"for",
"the",
"activity",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L2253-L2262 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java | UtilMath.getDistance | public static double getDistance(Localizable a, Localizable b)
{
Check.notNull(a);
Check.notNull(b);
final double x = b.getX() - a.getX();
final double y = b.getY() - a.getY();
return StrictMath.sqrt(x * x + y * y);
} | java | public static double getDistance(Localizable a, Localizable b)
{
Check.notNull(a);
Check.notNull(b);
final double x = b.getX() - a.getX();
final double y = b.getY() - a.getY();
return StrictMath.sqrt(x * x + y * y);
} | [
"public",
"static",
"double",
"getDistance",
"(",
"Localizable",
"a",
",",
"Localizable",
"b",
")",
"{",
"Check",
".",
"notNull",
"(",
"a",
")",
";",
"Check",
".",
"notNull",
"(",
"b",
")",
";",
"final",
"double",
"x",
"=",
"b",
".",
"getX",
"(",
"... | Get distance of two points.
@param a The first localizable (must not be <code>null</code>).
@param b The second localizable (must not be <code>null</code>).
@return The distance between them.
@throws LionEngineException If invalid argument. | [
"Get",
"distance",
"of",
"two",
"points",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilMath.java#L192-L201 |
BradleyWood/Software-Quality-Test-Framework | sqtf-core/src/main/java/org/sqtf/assertions/Assert.java | Assert.assertEquals | public static void assertEquals(Object expected, Object actual) {
assertEquals(expected, actual, "Expected value " + expected + " but got " + actual);
} | java | public static void assertEquals(Object expected, Object actual) {
assertEquals(expected, actual, "Expected value " + expected + " but got " + actual);
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"Object",
"expected",
",",
"Object",
"actual",
")",
"{",
"assertEquals",
"(",
"expected",
",",
"actual",
",",
"\"Expected value \"",
"+",
"expected",
"+",
"\" but got \"",
"+",
"actual",
")",
";",
"}"
] | Asserts that the two objects are equal. If they are not
the test will fail
@param expected The expected value
@param actual The actual value | [
"Asserts",
"that",
"the",
"two",
"objects",
"are",
"equal",
".",
"If",
"they",
"are",
"not",
"the",
"test",
"will",
"fail"
] | train | https://github.com/BradleyWood/Software-Quality-Test-Framework/blob/010dea3bfc8e025a4304ab9ef4a213c1adcb1aa0/sqtf-core/src/main/java/org/sqtf/assertions/Assert.java#L74-L76 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java | ICUService.getDisplayNames | public SortedMap<String, String> getDisplayNames(ULocale locale) {
return getDisplayNames(locale, null, null);
} | java | public SortedMap<String, String> getDisplayNames(ULocale locale) {
return getDisplayNames(locale, null, null);
} | [
"public",
"SortedMap",
"<",
"String",
",",
"String",
">",
"getDisplayNames",
"(",
"ULocale",
"locale",
")",
"{",
"return",
"getDisplayNames",
"(",
"locale",
",",
"null",
",",
"null",
")",
";",
"}"
] | Convenience override of getDisplayNames(ULocale, Comparator, String) that
uses null for the comparator, and null for the matchID. | [
"Convenience",
"override",
"of",
"getDisplayNames",
"(",
"ULocale",
"Comparator",
"String",
")",
"that",
"uses",
"null",
"for",
"the",
"comparator",
"and",
"null",
"for",
"the",
"matchID",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L652-L654 |
henkexbg/gallery-api | src/main/java/com/github/henkexbg/gallery/controller/GalleryController.java | GalleryController.returnResource | private ResponseEntity<InputStreamResource> returnResource(WebRequest request, GalleryFile galleryFile) throws IOException {
LOG.debug("Entering returnResource()");
if (request.checkNotModified(galleryFile.getActualFile().lastModified())) {
return null;
}
File file = galleryFile.getActualFile();
String contentType = galleryFile.getContentType();
String rangeHeader = request.getHeader(HttpHeaders.RANGE);
long[] ranges = getRangesFromHeader(rangeHeader);
long startPosition = ranges[0];
long fileTotalSize = file.length();
long endPosition = ranges[1] != 0 ? ranges[1] : fileTotalSize - 1;
long contentLength = endPosition - startPosition + 1;
LOG.debug("contentLength: {}, file length: {}", contentLength, fileTotalSize);
LOG.debug("Returning resource {} as inputstream. Start position: {}", file.getCanonicalPath(), startPosition);
InputStream boundedInputStream = new BoundedInputStream(new FileInputStream(file), endPosition + 1);
InputStream is = new BufferedInputStream(boundedInputStream, 65536);
InputStreamResource inputStreamResource = new InputStreamResource(is);
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentLength(contentLength);
responseHeaders.setContentType(MediaType.valueOf(contentType));
responseHeaders.add(HttpHeaders.ACCEPT_RANGES, "bytes");
if (StringUtils.isNotBlank(rangeHeader)) {
is.skip(startPosition);
String contentRangeResponseHeader = "bytes " + startPosition + "-" + endPosition + "/" + fileTotalSize;
responseHeaders.add(HttpHeaders.CONTENT_RANGE, contentRangeResponseHeader);
LOG.debug("{} was not null but {}. Adding header {} to response: {}", HttpHeaders.RANGE, rangeHeader,
HttpHeaders.CONTENT_RANGE, contentRangeResponseHeader);
}
HttpStatus status = (startPosition == 0 && contentLength == fileTotalSize) ? HttpStatus.OK : HttpStatus.PARTIAL_CONTENT;
LOG.debug("Returning {}. Status: {}, content-type: {}, {}: {}, contentLength: {}", file, status, contentType,
HttpHeaders.CONTENT_RANGE, responseHeaders.get(HttpHeaders.CONTENT_RANGE), contentLength);
return new ResponseEntity<InputStreamResource>(inputStreamResource, responseHeaders, status);
} | java | private ResponseEntity<InputStreamResource> returnResource(WebRequest request, GalleryFile galleryFile) throws IOException {
LOG.debug("Entering returnResource()");
if (request.checkNotModified(galleryFile.getActualFile().lastModified())) {
return null;
}
File file = galleryFile.getActualFile();
String contentType = galleryFile.getContentType();
String rangeHeader = request.getHeader(HttpHeaders.RANGE);
long[] ranges = getRangesFromHeader(rangeHeader);
long startPosition = ranges[0];
long fileTotalSize = file.length();
long endPosition = ranges[1] != 0 ? ranges[1] : fileTotalSize - 1;
long contentLength = endPosition - startPosition + 1;
LOG.debug("contentLength: {}, file length: {}", contentLength, fileTotalSize);
LOG.debug("Returning resource {} as inputstream. Start position: {}", file.getCanonicalPath(), startPosition);
InputStream boundedInputStream = new BoundedInputStream(new FileInputStream(file), endPosition + 1);
InputStream is = new BufferedInputStream(boundedInputStream, 65536);
InputStreamResource inputStreamResource = new InputStreamResource(is);
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentLength(contentLength);
responseHeaders.setContentType(MediaType.valueOf(contentType));
responseHeaders.add(HttpHeaders.ACCEPT_RANGES, "bytes");
if (StringUtils.isNotBlank(rangeHeader)) {
is.skip(startPosition);
String contentRangeResponseHeader = "bytes " + startPosition + "-" + endPosition + "/" + fileTotalSize;
responseHeaders.add(HttpHeaders.CONTENT_RANGE, contentRangeResponseHeader);
LOG.debug("{} was not null but {}. Adding header {} to response: {}", HttpHeaders.RANGE, rangeHeader,
HttpHeaders.CONTENT_RANGE, contentRangeResponseHeader);
}
HttpStatus status = (startPosition == 0 && contentLength == fileTotalSize) ? HttpStatus.OK : HttpStatus.PARTIAL_CONTENT;
LOG.debug("Returning {}. Status: {}, content-type: {}, {}: {}, contentLength: {}", file, status, contentType,
HttpHeaders.CONTENT_RANGE, responseHeaders.get(HttpHeaders.CONTENT_RANGE), contentLength);
return new ResponseEntity<InputStreamResource>(inputStreamResource, responseHeaders, status);
} | [
"private",
"ResponseEntity",
"<",
"InputStreamResource",
">",
"returnResource",
"(",
"WebRequest",
"request",
",",
"GalleryFile",
"galleryFile",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"debug",
"(",
"\"Entering returnResource()\"",
")",
";",
"if",
"(",
"reque... | Method used to return the binary of a gallery file (
{@link GalleryFile#getActualFile()} ). This method handles 304 redirects
(if file has not changed) and range headers if requested by browser. The
range parts is particularly important for videos. The correct response
status is set depending on the circumstances.
<p>
NOTE: the range logic should NOT be considered a complete implementation
- it's a bare minimum for making requests for byte ranges work.
@param request
Request
@param galleryFile
Gallery file
@return The binary of the gallery file, or a 304 redirect, or a part of
the file.
@throws IOException
If there is an issue accessing the binary file. | [
"Method",
"used",
"to",
"return",
"the",
"binary",
"of",
"a",
"gallery",
"file",
"(",
"{",
"@link",
"GalleryFile#getActualFile",
"()",
"}",
")",
".",
"This",
"method",
"handles",
"304",
"redirects",
"(",
"if",
"file",
"has",
"not",
"changed",
")",
"and",
... | train | https://github.com/henkexbg/gallery-api/blob/530e68c225b5e8fc3b608d670b34bd539a5b0a71/src/main/java/com/github/henkexbg/gallery/controller/GalleryController.java#L323-L358 |
qiniu/java-sdk | src/main/java/com/qiniu/common/AutoRegion.java | AutoRegion.queryRegionInfo | public RegionInfo queryRegionInfo(String accessKey, String bucket) throws QiniuException {
RegionIndex index = new RegionIndex(accessKey, bucket);
RegionInfo info = regions.get(index);
if (info == null) {
UCRet ret = getRegionJson(index);
try {
info = RegionInfo.buildFromUcRet(ret);
} catch (Exception e) {
e.printStackTrace();
}
if (info != null) {
regions.put(index, info);
}
}
return info;
} | java | public RegionInfo queryRegionInfo(String accessKey, String bucket) throws QiniuException {
RegionIndex index = new RegionIndex(accessKey, bucket);
RegionInfo info = regions.get(index);
if (info == null) {
UCRet ret = getRegionJson(index);
try {
info = RegionInfo.buildFromUcRet(ret);
} catch (Exception e) {
e.printStackTrace();
}
if (info != null) {
regions.put(index, info);
}
}
return info;
} | [
"public",
"RegionInfo",
"queryRegionInfo",
"(",
"String",
"accessKey",
",",
"String",
"bucket",
")",
"throws",
"QiniuException",
"{",
"RegionIndex",
"index",
"=",
"new",
"RegionIndex",
"(",
"accessKey",
",",
"bucket",
")",
";",
"RegionInfo",
"info",
"=",
"region... | 首先从缓存读取Region信息,如果没有则发送请求从接口查询
@param accessKey 账号 accessKey
@param bucket 空间名
@return 机房域名信息 | [
"首先从缓存读取Region信息,如果没有则发送请求从接口查询"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/common/AutoRegion.java#L78-L94 |
allure-framework/allure-java | allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java | AllureLifecycle.startPrepareFixture | public void startPrepareFixture(final String containerUuid, final String uuid, final FixtureResult result) {
storage.getContainer(containerUuid).ifPresent(container -> {
synchronized (storage) {
container.getBefores().add(result);
}
});
notifier.beforeFixtureStart(result);
startFixture(uuid, result);
notifier.afterFixtureStart(result);
} | java | public void startPrepareFixture(final String containerUuid, final String uuid, final FixtureResult result) {
storage.getContainer(containerUuid).ifPresent(container -> {
synchronized (storage) {
container.getBefores().add(result);
}
});
notifier.beforeFixtureStart(result);
startFixture(uuid, result);
notifier.afterFixtureStart(result);
} | [
"public",
"void",
"startPrepareFixture",
"(",
"final",
"String",
"containerUuid",
",",
"final",
"String",
"uuid",
",",
"final",
"FixtureResult",
"result",
")",
"{",
"storage",
".",
"getContainer",
"(",
"containerUuid",
")",
".",
"ifPresent",
"(",
"container",
"-... | Start a new prepare fixture with given parent.
@param containerUuid the uuid of parent container.
@param uuid the fixture uuid.
@param result the fixture. | [
"Start",
"a",
"new",
"prepare",
"fixture",
"with",
"given",
"parent",
"."
] | train | https://github.com/allure-framework/allure-java/blob/64015ca2b789aa6f7b19c793f1512e2f11d0174e/allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java#L183-L192 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java | DatePickerSettings.setDateRangeLimits | public boolean setDateRangeLimits(LocalDate firstAllowedDate, LocalDate lastAllowedDate) {
if (!hasParent()) {
throw new RuntimeException("DatePickerSettings.setDateRangeLimits(), "
+ "A date range limit can only be set after constructing the parent "
+ "DatePicker or the parent independent CalendarPanel. (The parent component "
+ "should be constructed using the DatePickerSettings instance where the "
+ "date range limits will be applied. The previous sentence is probably "
+ "simpler than it sounds.)");
}
if (firstAllowedDate == null && lastAllowedDate == null) {
return setVetoPolicy(null);
}
return setVetoPolicy(new DateVetoPolicyMinimumMaximumDate(
firstAllowedDate, lastAllowedDate));
} | java | public boolean setDateRangeLimits(LocalDate firstAllowedDate, LocalDate lastAllowedDate) {
if (!hasParent()) {
throw new RuntimeException("DatePickerSettings.setDateRangeLimits(), "
+ "A date range limit can only be set after constructing the parent "
+ "DatePicker or the parent independent CalendarPanel. (The parent component "
+ "should be constructed using the DatePickerSettings instance where the "
+ "date range limits will be applied. The previous sentence is probably "
+ "simpler than it sounds.)");
}
if (firstAllowedDate == null && lastAllowedDate == null) {
return setVetoPolicy(null);
}
return setVetoPolicy(new DateVetoPolicyMinimumMaximumDate(
firstAllowedDate, lastAllowedDate));
} | [
"public",
"boolean",
"setDateRangeLimits",
"(",
"LocalDate",
"firstAllowedDate",
",",
"LocalDate",
"lastAllowedDate",
")",
"{",
"if",
"(",
"!",
"hasParent",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"DatePickerSettings.setDateRangeLimits(), \"",
"... | setDateRangeLimits, This is a convenience function, for setting a DateVetoPolicy that will
limit the allowed dates in the parent object to a specified minimum and maximum date value.
Calling this function will always replace any existing DateVetoPolicy.
If you only want to limit one side of the date range, then you can pass in "null" for the
other date variable. If you pass in null for both values, then the current veto policy will
be cleared.
Important Note: The DatePicker or independent CalendarPanel associated with this settings
instance is known as the "parent component". This function can only be called after the
parent component is constructed with this settings instance. If this is called before the
parent is constructed, then an exception will be thrown. For more details, see:
"DatePickerSettings.setVetoPolicy()".
Return value: It's possible to set a veto policy that vetoes the currently selected date.
This function returns true if the selected date is allowed by the new veto policy and the
other current settings, or false if the selected date is vetoed or disallowed. Setting a new
veto policy does not modify the selected date. Is up to the programmer to resolve any
potential conflict between a new veto policy, and the currently selected date. | [
"setDateRangeLimits",
"This",
"is",
"a",
"convenience",
"function",
"for",
"setting",
"a",
"DateVetoPolicy",
"that",
"will",
"limit",
"the",
"allowed",
"dates",
"in",
"the",
"parent",
"object",
"to",
"a",
"specified",
"minimum",
"and",
"maximum",
"date",
"value"... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DatePickerSettings.java#L1404-L1418 |
graknlabs/grakn | server/src/graql/reasoner/cache/SemanticCache.java | SemanticCache.propagateAnswersToQuery | private boolean propagateAnswersToQuery(ReasonerAtomicQuery target, CacheEntry<ReasonerAtomicQuery, SE> childMatch, boolean inferred){
ReasonerAtomicQuery child = childMatch.query();
boolean[] newAnswersFound = {false};
boolean childGround = child.isGround();
getParents(target)
.forEach(parent -> {
boolean parentDbComplete = isDBComplete(keyToQuery(parent));
if (parentDbComplete || childGround){
boolean parentComplete = isComplete(keyToQuery(parent));
CacheEntry<ReasonerAtomicQuery, SE> parentMatch = getEntry(keyToQuery(parent));
boolean newAnswers = propagateAnswers(parentMatch, childMatch, inferred || parentComplete);
newAnswersFound[0] = newAnswers;
if (parentDbComplete || newAnswers) ackDBCompleteness(target);
if (parentComplete) ackCompleteness(target);
}
});
return newAnswersFound[0];
} | java | private boolean propagateAnswersToQuery(ReasonerAtomicQuery target, CacheEntry<ReasonerAtomicQuery, SE> childMatch, boolean inferred){
ReasonerAtomicQuery child = childMatch.query();
boolean[] newAnswersFound = {false};
boolean childGround = child.isGround();
getParents(target)
.forEach(parent -> {
boolean parentDbComplete = isDBComplete(keyToQuery(parent));
if (parentDbComplete || childGround){
boolean parentComplete = isComplete(keyToQuery(parent));
CacheEntry<ReasonerAtomicQuery, SE> parentMatch = getEntry(keyToQuery(parent));
boolean newAnswers = propagateAnswers(parentMatch, childMatch, inferred || parentComplete);
newAnswersFound[0] = newAnswers;
if (parentDbComplete || newAnswers) ackDBCompleteness(target);
if (parentComplete) ackCompleteness(target);
}
});
return newAnswersFound[0];
} | [
"private",
"boolean",
"propagateAnswersToQuery",
"(",
"ReasonerAtomicQuery",
"target",
",",
"CacheEntry",
"<",
"ReasonerAtomicQuery",
",",
"SE",
">",
"childMatch",
",",
"boolean",
"inferred",
")",
"{",
"ReasonerAtomicQuery",
"child",
"=",
"childMatch",
".",
"query",
... | NB: uses getEntry
NB: target and childMatch.query() are in general not the same hence explicit arguments
@param target query we want propagate the answers to
@param childMatch entry to which we want to propagate answers
@param inferred true if inferred answers should be propagated | [
"NB",
":",
"uses",
"getEntry",
"NB",
":",
"target",
"and",
"childMatch",
".",
"query",
"()",
"are",
"in",
"general",
"not",
"the",
"same",
"hence",
"explicit",
"arguments"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/cache/SemanticCache.java#L205-L222 |
daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderAdapter.java | SliderAdapter.onEnd | @Override
public void onEnd(boolean result, BaseSliderView target) {
if(target.isErrorDisappear() == false || result == true){
return;
}
for (BaseSliderView slider: mImageContents){
if(slider.equals(target)){
removeSlider(target);
break;
}
}
} | java | @Override
public void onEnd(boolean result, BaseSliderView target) {
if(target.isErrorDisappear() == false || result == true){
return;
}
for (BaseSliderView slider: mImageContents){
if(slider.equals(target)){
removeSlider(target);
break;
}
}
} | [
"@",
"Override",
"public",
"void",
"onEnd",
"(",
"boolean",
"result",
",",
"BaseSliderView",
"target",
")",
"{",
"if",
"(",
"target",
".",
"isErrorDisappear",
"(",
")",
"==",
"false",
"||",
"result",
"==",
"true",
")",
"{",
"return",
";",
"}",
"for",
"... | When image download error, then remove.
@param result
@param target | [
"When",
"image",
"download",
"error",
"then",
"remove",
"."
] | train | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderAdapter.java#L96-L107 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java | StorageAccountsInner.listAccountSASAsync | public Observable<ListAccountSasResponseInner> listAccountSASAsync(String resourceGroupName, String accountName, AccountSasParameters parameters) {
return listAccountSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<ListAccountSasResponseInner>, ListAccountSasResponseInner>() {
@Override
public ListAccountSasResponseInner call(ServiceResponse<ListAccountSasResponseInner> response) {
return response.body();
}
});
} | java | public Observable<ListAccountSasResponseInner> listAccountSASAsync(String resourceGroupName, String accountName, AccountSasParameters parameters) {
return listAccountSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<ListAccountSasResponseInner>, ListAccountSasResponseInner>() {
@Override
public ListAccountSasResponseInner call(ServiceResponse<ListAccountSasResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ListAccountSasResponseInner",
">",
"listAccountSASAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"AccountSasParameters",
"parameters",
")",
"{",
"return",
"listAccountSASWithServiceResponseAsync",
"(",
"resourceGro... | List SAS credentials of a storage account.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param parameters The parameters to provide to list SAS credentials for the storage account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ListAccountSasResponseInner object | [
"List",
"SAS",
"credentials",
"of",
"a",
"storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L1042-L1049 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.