repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java | InstanceFailoverGroupsInner.getAsync | public Observable<InstanceFailoverGroupInner> getAsync(String resourceGroupName, String locationName, String failoverGroupName) {
return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<InstanceFailoverGroupInner>, InstanceFailoverGroupInner>() {
@Override
public InstanceFailoverGroupInner call(ServiceResponse<InstanceFailoverGroupInner> response) {
return response.body();
}
});
} | java | public Observable<InstanceFailoverGroupInner> getAsync(String resourceGroupName, String locationName, String failoverGroupName) {
return getWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<InstanceFailoverGroupInner>, InstanceFailoverGroupInner>() {
@Override
public InstanceFailoverGroupInner call(ServiceResponse<InstanceFailoverGroupInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"InstanceFailoverGroupInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"locationName",
",",
"String",
"failoverGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"locationNa... | Gets a failover group.
@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 locationName The name of the region where the resource is located.
@param failoverGroupName The name of the failover group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the InstanceFailoverGroupInner object | [
"Gets",
"a",
"failover",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L149-L156 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/UnitCellBoundingBox.java | UnitCellBoundingBox.getTranslatedBbs | public UnitCellBoundingBox getTranslatedBbs(Vector3d translation) {
UnitCellBoundingBox translatedBbs = new UnitCellBoundingBox(numOperatorsSg, numPolyChainsAu);
for (int i=0; i<numOperatorsSg; i++) {
for (int j = 0;j<numPolyChainsAu; j++) {
translatedBbs.chainBbs[i][j] = new BoundingBox(this.chainBbs[i][j]);
translatedBbs.chainBbs[i][j].translate(translation);
}
translatedBbs.auBbs[i] = new BoundingBox(translatedBbs.chainBbs[i]);
}
return translatedBbs;
} | java | public UnitCellBoundingBox getTranslatedBbs(Vector3d translation) {
UnitCellBoundingBox translatedBbs = new UnitCellBoundingBox(numOperatorsSg, numPolyChainsAu);
for (int i=0; i<numOperatorsSg; i++) {
for (int j = 0;j<numPolyChainsAu; j++) {
translatedBbs.chainBbs[i][j] = new BoundingBox(this.chainBbs[i][j]);
translatedBbs.chainBbs[i][j].translate(translation);
}
translatedBbs.auBbs[i] = new BoundingBox(translatedBbs.chainBbs[i]);
}
return translatedBbs;
} | [
"public",
"UnitCellBoundingBox",
"getTranslatedBbs",
"(",
"Vector3d",
"translation",
")",
"{",
"UnitCellBoundingBox",
"translatedBbs",
"=",
"new",
"UnitCellBoundingBox",
"(",
"numOperatorsSg",
",",
"numPolyChainsAu",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Returns a new BoundingBoxes object containing the same bounds as this
BoundingBoxes object translated by the given translation
@param translation
@return | [
"Returns",
"a",
"new",
"BoundingBoxes",
"object",
"containing",
"the",
"same",
"bounds",
"as",
"this",
"BoundingBoxes",
"object",
"translated",
"by",
"the",
"given",
"translation"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/UnitCellBoundingBox.java#L114-L126 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java | Locale.composeList | private static String[] composeList(MessageFormat format, String[] list) {
if (list.length <= 3) return list;
// Use the given format to compose the first two elements into one
String[] listItems = { list[0], list[1] };
String newItem = format.format(listItems);
// Form a new list one element shorter
String[] newList = new String[list.length-1];
System.arraycopy(list, 2, newList, 1, newList.length-1);
newList[0] = newItem;
// Recurse
return composeList(format, newList);
} | java | private static String[] composeList(MessageFormat format, String[] list) {
if (list.length <= 3) return list;
// Use the given format to compose the first two elements into one
String[] listItems = { list[0], list[1] };
String newItem = format.format(listItems);
// Form a new list one element shorter
String[] newList = new String[list.length-1];
System.arraycopy(list, 2, newList, 1, newList.length-1);
newList[0] = newItem;
// Recurse
return composeList(format, newList);
} | [
"private",
"static",
"String",
"[",
"]",
"composeList",
"(",
"MessageFormat",
"format",
",",
"String",
"[",
"]",
"list",
")",
"{",
"if",
"(",
"list",
".",
"length",
"<=",
"3",
")",
"return",
"list",
";",
"// Use the given format to compose the first two elements... | Given a list of strings, return a list shortened to three elements.
Shorten it by applying the given format to the first two elements
recursively.
@param format a format which takes two arguments
@param list a list of strings
@return if the list is three elements or shorter, the same list;
otherwise, a new list of three elements. | [
"Given",
"a",
"list",
"of",
"strings",
"return",
"a",
"list",
"shortened",
"to",
"three",
"elements",
".",
"Shorten",
"it",
"by",
"applying",
"the",
"given",
"format",
"to",
"the",
"first",
"two",
"elements",
"recursively",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java#L2082-L2096 |
morimekta/providence | providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigParser.java | ProvidenceConfigParser.parseConfig | @Nonnull
<M extends PMessage<M, F>, F extends PField> Pair<M, Set<String>> parseConfig(@Nonnull Path configFile, @Nullable M parent)
throws ProvidenceConfigException {
try {
configFile = canonicalFileLocation(configFile);
} catch (IOException e) {
throw new ProvidenceConfigException(e, "Unable to resolve config file " + configFile)
.setFile(configFile.getFileName()
.toString());
}
Pair<M, Set<String>> result = checkAndParseInternal(configFile, parent);
if (result == null) {
throw new ProvidenceConfigException("No config: " + configFile.toString())
.setFile(configFile.getFileName()
.toString());
}
return result;
} | java | @Nonnull
<M extends PMessage<M, F>, F extends PField> Pair<M, Set<String>> parseConfig(@Nonnull Path configFile, @Nullable M parent)
throws ProvidenceConfigException {
try {
configFile = canonicalFileLocation(configFile);
} catch (IOException e) {
throw new ProvidenceConfigException(e, "Unable to resolve config file " + configFile)
.setFile(configFile.getFileName()
.toString());
}
Pair<M, Set<String>> result = checkAndParseInternal(configFile, parent);
if (result == null) {
throw new ProvidenceConfigException("No config: " + configFile.toString())
.setFile(configFile.getFileName()
.toString());
}
return result;
} | [
"@",
"Nonnull",
"<",
"M",
"extends",
"PMessage",
"<",
"M",
",",
"F",
">",
",",
"F",
"extends",
"PField",
">",
"Pair",
"<",
"M",
",",
"Set",
"<",
"String",
">",
">",
"parseConfig",
"(",
"@",
"Nonnull",
"Path",
"configFile",
",",
"@",
"Nullable",
"M"... | Parse a providence config into a message.
@param configFile The config file to be parsed.
@param parent The parent config message.
@param <M> The config message type.
@param <F> The config field type.
@return Pair of parsed config and set of included file paths.
@throws ProvidenceConfigException If parsing failed. | [
"Parse",
"a",
"providence",
"config",
"into",
"a",
"message",
"."
] | train | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-config/src/main/java/net/morimekta/providence/config/impl/ProvidenceConfigParser.java#L106-L123 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java | XsdAsmInterfaces.checkForSequenceMethod | void checkForSequenceMethod(ClassWriter classWriter, String className) {
Consumer<ClassWriter> sequenceMethodCreator = pendingSequenceMethods.get(className);
if (sequenceMethodCreator != null){
sequenceMethodCreator.accept(classWriter);
}
} | java | void checkForSequenceMethod(ClassWriter classWriter, String className) {
Consumer<ClassWriter> sequenceMethodCreator = pendingSequenceMethods.get(className);
if (sequenceMethodCreator != null){
sequenceMethodCreator.accept(classWriter);
}
} | [
"void",
"checkForSequenceMethod",
"(",
"ClassWriter",
"classWriter",
",",
"String",
"className",
")",
"{",
"Consumer",
"<",
"ClassWriter",
">",
"sequenceMethodCreator",
"=",
"pendingSequenceMethods",
".",
"get",
"(",
"className",
")",
";",
"if",
"(",
"sequenceMethod... | Verifies if there is any postponed sequence method creation in pendingSequenceMethods and performs the method if
it exists.
@param classWriter The {@link ClassWriter} object for the class that contains the postponed sequence method creation.
@param className The name of the class that contains the sequence. | [
"Verifies",
"if",
"there",
"is",
"any",
"postponed",
"sequence",
"method",
"creation",
"in",
"pendingSequenceMethods",
"and",
"performs",
"the",
"method",
"if",
"it",
"exists",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L867-L873 |
carrotsearch/hppc | hppc/src/main/java/com/carrotsearch/hppc/sorting/IndirectSort.java | IndirectSort.topDownMergeSort | private static void topDownMergeSort(int[] src, int[] dst, int fromIndex, int toIndex, IndirectComparator comp) {
if (toIndex - fromIndex <= MIN_LENGTH_FOR_INSERTION_SORT) {
insertionSort(fromIndex, toIndex - fromIndex, dst, comp);
return;
}
final int mid = (fromIndex + toIndex) >>> 1;
topDownMergeSort(dst, src, fromIndex, mid, comp);
topDownMergeSort(dst, src, mid, toIndex, comp);
/*
* Both splits in of src are now sorted.
*/
if (comp.compare(src[mid - 1], src[mid]) <= 0) {
/*
* If the lowest element in upper slice is larger than the highest element in
* the lower slice, simply copy over, the data is fully sorted.
*/
System.arraycopy(src, fromIndex, dst, fromIndex, toIndex - fromIndex);
} else {
/*
* Run a manual merge.
*/
for (int i = fromIndex, j = mid, k = fromIndex; k < toIndex; k++) {
if (j == toIndex || (i < mid && comp.compare(src[i], src[j]) <= 0)) {
dst[k] = src[i++];
} else {
dst[k] = src[j++];
}
}
}
} | java | private static void topDownMergeSort(int[] src, int[] dst, int fromIndex, int toIndex, IndirectComparator comp) {
if (toIndex - fromIndex <= MIN_LENGTH_FOR_INSERTION_SORT) {
insertionSort(fromIndex, toIndex - fromIndex, dst, comp);
return;
}
final int mid = (fromIndex + toIndex) >>> 1;
topDownMergeSort(dst, src, fromIndex, mid, comp);
topDownMergeSort(dst, src, mid, toIndex, comp);
/*
* Both splits in of src are now sorted.
*/
if (comp.compare(src[mid - 1], src[mid]) <= 0) {
/*
* If the lowest element in upper slice is larger than the highest element in
* the lower slice, simply copy over, the data is fully sorted.
*/
System.arraycopy(src, fromIndex, dst, fromIndex, toIndex - fromIndex);
} else {
/*
* Run a manual merge.
*/
for (int i = fromIndex, j = mid, k = fromIndex; k < toIndex; k++) {
if (j == toIndex || (i < mid && comp.compare(src[i], src[j]) <= 0)) {
dst[k] = src[i++];
} else {
dst[k] = src[j++];
}
}
}
} | [
"private",
"static",
"void",
"topDownMergeSort",
"(",
"int",
"[",
"]",
"src",
",",
"int",
"[",
"]",
"dst",
",",
"int",
"fromIndex",
",",
"int",
"toIndex",
",",
"IndirectComparator",
"comp",
")",
"{",
"if",
"(",
"toIndex",
"-",
"fromIndex",
"<=",
"MIN_LEN... | Perform a recursive, descending merge sort.
@param fromIndex
inclusive
@param toIndex
exclusive | [
"Perform",
"a",
"recursive",
"descending",
"merge",
"sort",
"."
] | train | https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/java/com/carrotsearch/hppc/sorting/IndirectSort.java#L70-L101 |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/TriMarkers.java | TriMarkers.getNormalVector | public static Vector3D getNormalVector(Triangle t) throws IllegalArgumentException {
if(Double.isNaN(t.p0.z) || Double.isNaN(t.p1.z) || Double.isNaN(t.p2.z)) {
throw new IllegalArgumentException("Z is required, cannot compute triangle normal of "+t);
}
double dx1 = t.p0.x - t.p1.x;
double dy1 = t.p0.y - t.p1.y;
double dz1 = t.p0.z - t.p1.z;
double dx2 = t.p1.x - t.p2.x;
double dy2 = t.p1.y - t.p2.y;
double dz2 = t.p1.z - t.p2.z;
return Vector3D.create(dy1*dz2 - dz1*dy2, dz1 * dx2 - dx1 * dz2, dx1 * dy2 - dy1 * dx2).normalize();
} | java | public static Vector3D getNormalVector(Triangle t) throws IllegalArgumentException {
if(Double.isNaN(t.p0.z) || Double.isNaN(t.p1.z) || Double.isNaN(t.p2.z)) {
throw new IllegalArgumentException("Z is required, cannot compute triangle normal of "+t);
}
double dx1 = t.p0.x - t.p1.x;
double dy1 = t.p0.y - t.p1.y;
double dz1 = t.p0.z - t.p1.z;
double dx2 = t.p1.x - t.p2.x;
double dy2 = t.p1.y - t.p2.y;
double dz2 = t.p1.z - t.p2.z;
return Vector3D.create(dy1*dz2 - dz1*dy2, dz1 * dx2 - dx1 * dz2, dx1 * dy2 - dy1 * dx2).normalize();
} | [
"public",
"static",
"Vector3D",
"getNormalVector",
"(",
"Triangle",
"t",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"t",
".",
"p0",
".",
"z",
")",
"||",
"Double",
".",
"isNaN",
"(",
"t",
".",
"p1",
".",
"z",... | Get the normal vector to this triangle, of length 1.
@param t input triangle
@return vector normal to the triangle. | [
"Get",
"the",
"normal",
"vector",
"to",
"this",
"triangle",
"of",
"length",
"1",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/TriMarkers.java#L171-L182 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/options/navigation/impl/ConfigurationContextImpl.java | ConfigurationContextImpl.createGlobalContext | @Override
public <G extends GlobalContext<?, ?>> G createGlobalContext(Class<? extends G> globalContextImplType,
final Class<? extends EntityContext<?, ?>> entityContextImplType, Class<? extends PropertyContext<?, ?>> propertyContextImplType) {
// ByteBuddyState#resolveClassLoadingStrategy static method is an Hibernate ORM internal,
// please remove its use here as soon the issue HHH-13014 has been closed.
// url https://hibernate.atlassian.net/browse/HHH-13014.
Class<? extends G> globalContextType = new ByteBuddy()
.subclass( globalContextImplType )
.method( filterEntityMethod() )
.intercept( to( new EntityOrPropertyMethodInterceptor( entityContextImplType, propertyContextImplType ) ) )
.make().load( globalContextImplType.getClassLoader(), resolveClassLoadingStrategy( globalContextImplType ) ).getLoaded();
try {
return globalContextType.getConstructor( ConfigurationContext.class ).newInstance( this );
}
catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw log.cannotCreateGlobalContextProxy( globalContextImplType, e );
}
} | java | @Override
public <G extends GlobalContext<?, ?>> G createGlobalContext(Class<? extends G> globalContextImplType,
final Class<? extends EntityContext<?, ?>> entityContextImplType, Class<? extends PropertyContext<?, ?>> propertyContextImplType) {
// ByteBuddyState#resolveClassLoadingStrategy static method is an Hibernate ORM internal,
// please remove its use here as soon the issue HHH-13014 has been closed.
// url https://hibernate.atlassian.net/browse/HHH-13014.
Class<? extends G> globalContextType = new ByteBuddy()
.subclass( globalContextImplType )
.method( filterEntityMethod() )
.intercept( to( new EntityOrPropertyMethodInterceptor( entityContextImplType, propertyContextImplType ) ) )
.make().load( globalContextImplType.getClassLoader(), resolveClassLoadingStrategy( globalContextImplType ) ).getLoaded();
try {
return globalContextType.getConstructor( ConfigurationContext.class ).newInstance( this );
}
catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw log.cannotCreateGlobalContextProxy( globalContextImplType, e );
}
} | [
"@",
"Override",
"public",
"<",
"G",
"extends",
"GlobalContext",
"<",
"?",
",",
"?",
">",
">",
"G",
"createGlobalContext",
"(",
"Class",
"<",
"?",
"extends",
"G",
">",
"globalContextImplType",
",",
"final",
"Class",
"<",
"?",
"extends",
"EntityContext",
"<... | Creates a new {@link GlobalContext} object based on the given context implementation types. All implementation
types must declare a public or protected constructor with a single parameter, accepting {@link ConfigurationContext}.
<p>
Each context implementation type must provide an implementation of the method(s) declared on the particular
provider-specific context interface. All methods declared on context super interfaces - {@code entity()} and
{@code property()} - are implemented following the dynamic proxy pattern, the implementation types therefore can
be declared abstract, avoiding the need to implement these methods themselves.
<p>
By convention, the implementation types should directly or indirectly extend {@link BaseContext}.
@param globalContextImplType the provider-specific global context implementation type
@param entityContextImplType the provider-specific entity context implementation type
@param propertyContextImplType the provider-specific property context implementation type
@return a new {@link GlobalContext} object based on the given context implementation types | [
"Creates",
"a",
"new",
"{",
"@link",
"GlobalContext",
"}",
"object",
"based",
"on",
"the",
"given",
"context",
"implementation",
"types",
".",
"All",
"implementation",
"types",
"must",
"declare",
"a",
"public",
"or",
"protected",
"constructor",
"with",
"a",
"s... | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/options/navigation/impl/ConfigurationContextImpl.java#L110-L129 |
SixDimensions/Component-Bindings-Provider | impl/src/main/java/com/sixdimensions/wcm/cq/component/bindings/impl/ComponentBindingsProviderCache.java | ComponentBindingsProviderCache.getReferences | public List<ServiceReference> getReferences(String resourceType) {
List<ServiceReference> references = new ArrayList<ServiceReference>();
if (containsKey(resourceType)) {
references.addAll(get(resourceType));
Collections.sort(references, new Comparator<ServiceReference>() {
@Override
public int compare(ServiceReference r0, ServiceReference r1) {
Integer p0 = OsgiUtil.toInteger(
r0.getProperty(ComponentBindingsProvider.PRIORITY),
0);
Integer p1 = OsgiUtil.toInteger(
r1.getProperty(ComponentBindingsProvider.PRIORITY),
0);
return -1 * p0.compareTo(p1);
}
});
}
return references;
} | java | public List<ServiceReference> getReferences(String resourceType) {
List<ServiceReference> references = new ArrayList<ServiceReference>();
if (containsKey(resourceType)) {
references.addAll(get(resourceType));
Collections.sort(references, new Comparator<ServiceReference>() {
@Override
public int compare(ServiceReference r0, ServiceReference r1) {
Integer p0 = OsgiUtil.toInteger(
r0.getProperty(ComponentBindingsProvider.PRIORITY),
0);
Integer p1 = OsgiUtil.toInteger(
r1.getProperty(ComponentBindingsProvider.PRIORITY),
0);
return -1 * p0.compareTo(p1);
}
});
}
return references;
} | [
"public",
"List",
"<",
"ServiceReference",
">",
"getReferences",
"(",
"String",
"resourceType",
")",
"{",
"List",
"<",
"ServiceReference",
">",
"references",
"=",
"new",
"ArrayList",
"<",
"ServiceReference",
">",
"(",
")",
";",
"if",
"(",
"containsKey",
"(",
... | Gets the ComponentBindingProvider references for the specified resource
type.
@param resourceType
the resource type for which to retrieve the references
@return the references for the resource type | [
"Gets",
"the",
"ComponentBindingProvider",
"references",
"for",
"the",
"specified",
"resource",
"type",
"."
] | train | https://github.com/SixDimensions/Component-Bindings-Provider/blob/1d4da2f8c274d32edcd0a2593bec1255b8340b5b/impl/src/main/java/com/sixdimensions/wcm/cq/component/bindings/impl/ComponentBindingsProviderCache.java#L61-L80 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/xml/XmlUtil.java | XmlUtil.printDocument | public static void printDocument(Node _docOrNode, OutputStream _outStream) throws IOException {
if (_docOrNode == null || _outStream == null) {
throw new IOException("Cannot print (on) 'null' object");
}
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer;
try {
transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
transformer.transform(new DOMSource(_docOrNode),
new StreamResult(new OutputStreamWriter(_outStream, "UTF-8")));
} catch (UnsupportedEncodingException | TransformerException _ex) {
throw new IOException("Could not print Document or Node.",_ex);
}
} | java | public static void printDocument(Node _docOrNode, OutputStream _outStream) throws IOException {
if (_docOrNode == null || _outStream == null) {
throw new IOException("Cannot print (on) 'null' object");
}
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer;
try {
transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
transformer.transform(new DOMSource(_docOrNode),
new StreamResult(new OutputStreamWriter(_outStream, "UTF-8")));
} catch (UnsupportedEncodingException | TransformerException _ex) {
throw new IOException("Could not print Document or Node.",_ex);
}
} | [
"public",
"static",
"void",
"printDocument",
"(",
"Node",
"_docOrNode",
",",
"OutputStream",
"_outStream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_docOrNode",
"==",
"null",
"||",
"_outStream",
"==",
"null",
")",
"{",
"throw",
"new",
"IOException",
"(",... | Dump a {@link Document} or {@link Node}-compatible object to the given {@link OutputStream} (e.g. System.out).
@param _docOrNode {@link Document} or {@link Node} object
@param _outStream {@link OutputStream} to print on
@throws IOException on error | [
"Dump",
"a",
"{",
"@link",
"Document",
"}",
"or",
"{",
"@link",
"Node",
"}",
"-",
"compatible",
"object",
"to",
"the",
"given",
"{",
"@link",
"OutputStream",
"}",
"(",
"e",
".",
"g",
".",
"System",
".",
"out",
")",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/xml/XmlUtil.java#L208-L229 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java | RedundentExprEliminator.eleminateSharedPartialPaths | protected void eleminateSharedPartialPaths(ElemTemplateElement psuedoVarRecipient, Vector paths)
{
MultistepExprHolder list = createMultistepExprList(paths);
if(null != list)
{
if(DIAGNOSE_MULTISTEPLIST)
list.diagnose();
boolean isGlobal = (paths == m_absPaths);
// Iterate over the list, starting with the most number of paths,
// trying to find the longest matches first.
int longestStepsCount = list.m_stepCount;
for (int i = longestStepsCount-1; i >= 1; i--)
{
MultistepExprHolder next = list;
while(null != next)
{
if(next.m_stepCount < i)
break;
list = matchAndEliminatePartialPaths(next, list, isGlobal, i, psuedoVarRecipient);
next = next.m_next;
}
}
}
} | java | protected void eleminateSharedPartialPaths(ElemTemplateElement psuedoVarRecipient, Vector paths)
{
MultistepExprHolder list = createMultistepExprList(paths);
if(null != list)
{
if(DIAGNOSE_MULTISTEPLIST)
list.diagnose();
boolean isGlobal = (paths == m_absPaths);
// Iterate over the list, starting with the most number of paths,
// trying to find the longest matches first.
int longestStepsCount = list.m_stepCount;
for (int i = longestStepsCount-1; i >= 1; i--)
{
MultistepExprHolder next = list;
while(null != next)
{
if(next.m_stepCount < i)
break;
list = matchAndEliminatePartialPaths(next, list, isGlobal, i, psuedoVarRecipient);
next = next.m_next;
}
}
}
} | [
"protected",
"void",
"eleminateSharedPartialPaths",
"(",
"ElemTemplateElement",
"psuedoVarRecipient",
",",
"Vector",
"paths",
")",
"{",
"MultistepExprHolder",
"list",
"=",
"createMultistepExprList",
"(",
"paths",
")",
";",
"if",
"(",
"null",
"!=",
"list",
")",
"{",
... | Eliminate the shared partial paths in the expression list.
@param psuedoVarRecipient The recipient of the psuedo vars.
@param paths A vector of paths that hold ExpressionOwner objects,
which must yield LocationPathIterators. | [
"Eliminate",
"the",
"shared",
"partial",
"paths",
"in",
"the",
"expression",
"list",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L152-L177 |
Mangopay/mangopay2-java-sdk | src/main/java/com/mangopay/core/UrlTool.java | UrlTool.getRestUrl | public String getRestUrl(String urlKey, Boolean addClientId, Pagination pagination, Map<String, String> additionalUrlParams) throws UnsupportedEncodingException {
String url;
if (!addClientId) {
url = "/v2.01" + urlKey;
} else {
url = "/v2.01/" + root.getConfig().getClientId() + urlKey;
}
Boolean paramsAdded = false;
if (pagination != null) {
url += "?page=" + pagination.getPage() + "&per_page=" + pagination.getItemsPerPage();
paramsAdded = true;
}
if (additionalUrlParams != null) {
for (Entry<String, String> entry : additionalUrlParams.entrySet()) {
url += paramsAdded ? "&" : "?";
url += entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), "ISO-8859-1");
paramsAdded = true;
}
}
return url;
} | java | public String getRestUrl(String urlKey, Boolean addClientId, Pagination pagination, Map<String, String> additionalUrlParams) throws UnsupportedEncodingException {
String url;
if (!addClientId) {
url = "/v2.01" + urlKey;
} else {
url = "/v2.01/" + root.getConfig().getClientId() + urlKey;
}
Boolean paramsAdded = false;
if (pagination != null) {
url += "?page=" + pagination.getPage() + "&per_page=" + pagination.getItemsPerPage();
paramsAdded = true;
}
if (additionalUrlParams != null) {
for (Entry<String, String> entry : additionalUrlParams.entrySet()) {
url += paramsAdded ? "&" : "?";
url += entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), "ISO-8859-1");
paramsAdded = true;
}
}
return url;
} | [
"public",
"String",
"getRestUrl",
"(",
"String",
"urlKey",
",",
"Boolean",
"addClientId",
",",
"Pagination",
"pagination",
",",
"Map",
"<",
"String",
",",
"String",
">",
"additionalUrlParams",
")",
"throws",
"UnsupportedEncodingException",
"{",
"String",
"url",
";... | Gets REST url.
@param urlKey Url key.
@param addClientId Denotes whether client identifier should be composed into final url.
@param pagination Pagination object.
@param additionalUrlParams Additional parameters.
@return Final REST url.
@throws UnsupportedEncodingException | [
"Gets",
"REST",
"url",
"."
] | train | https://github.com/Mangopay/mangopay2-java-sdk/blob/037cecb44ea62def63b507817fd9961649151157/src/main/java/com/mangopay/core/UrlTool.java#L85-L110 |
carewebframework/carewebframework-vista | org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Version.java | Version.appendVersion | private void appendVersion(StringBuilder sb, long ver) {
if (sb.length() > 0) {
sb.append(".");
}
sb.append(ver);
} | java | private void appendVersion(StringBuilder sb, long ver) {
if (sb.length() > 0) {
sb.append(".");
}
sb.append(ver);
} | [
"private",
"void",
"appendVersion",
"(",
"StringBuilder",
"sb",
",",
"long",
"ver",
")",
"{",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"\".\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"ver",
")",
... | Append version component.
@param sb String builder.
@param ver Version component value. | [
"Append",
"version",
"component",
"."
] | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/Version.java#L109-L115 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/shared/CmsContainerElementData.java | CmsContainerElementData.getFormatedIndividualSettings | public List<CmsAdditionalInfoBean> getFormatedIndividualSettings(String containerId) {
List<CmsAdditionalInfoBean> result = new ArrayList<CmsAdditionalInfoBean>();
CmsFormatterConfig config = getFormatterConfig(containerId);
if ((m_settings != null) && (config != null)) {
for (Entry<String, String> settingEntry : m_settings.entrySet()) {
String settingKey = settingEntry.getKey();
if (config.getSettingConfig().containsKey(settingEntry.getKey())) {
String niceName = config.getSettingConfig().get(settingEntry.getKey()).getNiceName();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(
config.getSettingConfig().get(settingEntry.getKey()).getNiceName())) {
settingKey = niceName;
}
}
result.add(new CmsAdditionalInfoBean(settingKey, settingEntry.getValue(), null));
}
}
return result;
} | java | public List<CmsAdditionalInfoBean> getFormatedIndividualSettings(String containerId) {
List<CmsAdditionalInfoBean> result = new ArrayList<CmsAdditionalInfoBean>();
CmsFormatterConfig config = getFormatterConfig(containerId);
if ((m_settings != null) && (config != null)) {
for (Entry<String, String> settingEntry : m_settings.entrySet()) {
String settingKey = settingEntry.getKey();
if (config.getSettingConfig().containsKey(settingEntry.getKey())) {
String niceName = config.getSettingConfig().get(settingEntry.getKey()).getNiceName();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(
config.getSettingConfig().get(settingEntry.getKey()).getNiceName())) {
settingKey = niceName;
}
}
result.add(new CmsAdditionalInfoBean(settingKey, settingEntry.getValue(), null));
}
}
return result;
} | [
"public",
"List",
"<",
"CmsAdditionalInfoBean",
">",
"getFormatedIndividualSettings",
"(",
"String",
"containerId",
")",
"{",
"List",
"<",
"CmsAdditionalInfoBean",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsAdditionalInfoBean",
">",
"(",
")",
";",
"CmsFormatte... | Returns the individual element settings formated with nice-names to be used as additional-info.<p>
@param containerId the container id
@return the settings list | [
"Returns",
"the",
"individual",
"element",
"settings",
"formated",
"with",
"nice",
"-",
"names",
"to",
"be",
"used",
"as",
"additional",
"-",
"info",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/shared/CmsContainerElementData.java#L144-L162 |
stratosphere/stratosphere | stratosphere-clients/src/main/java/eu/stratosphere/client/web/JobsInfoServlet.java | JobsInfoServlet.getJMConnection | private ExtendedManagementProtocol getJMConnection() throws IOException {
String jmHost = config.getString(ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY, null);
String jmPort = config.getString(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY, null);
return RPC.getProxy(ExtendedManagementProtocol.class,
new InetSocketAddress(jmHost, Integer.parseInt(jmPort)), NetUtils.getSocketFactory());
} | java | private ExtendedManagementProtocol getJMConnection() throws IOException {
String jmHost = config.getString(ConfigConstants.JOB_MANAGER_IPC_ADDRESS_KEY, null);
String jmPort = config.getString(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY, null);
return RPC.getProxy(ExtendedManagementProtocol.class,
new InetSocketAddress(jmHost, Integer.parseInt(jmPort)), NetUtils.getSocketFactory());
} | [
"private",
"ExtendedManagementProtocol",
"getJMConnection",
"(",
")",
"throws",
"IOException",
"{",
"String",
"jmHost",
"=",
"config",
".",
"getString",
"(",
"ConfigConstants",
".",
"JOB_MANAGER_IPC_ADDRESS_KEY",
",",
"null",
")",
";",
"String",
"jmPort",
"=",
"conf... | Sets up a connection to the JobManager.
@return Connection to the JobManager.
@throws IOException | [
"Sets",
"up",
"a",
"connection",
"to",
"the",
"JobManager",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-clients/src/main/java/eu/stratosphere/client/web/JobsInfoServlet.java#L104-L110 |
jenkinsci/jenkins | core/src/main/java/hudson/model/Items.java | Items.whileUpdatingByXml | public static <V,T extends Throwable> V whileUpdatingByXml(Callable<V,T> callable) throws T {
updatingByXml.set(true);
try {
return callable.call();
} finally {
updatingByXml.set(false);
}
} | java | public static <V,T extends Throwable> V whileUpdatingByXml(Callable<V,T> callable) throws T {
updatingByXml.set(true);
try {
return callable.call();
} finally {
updatingByXml.set(false);
}
} | [
"public",
"static",
"<",
"V",
",",
"T",
"extends",
"Throwable",
">",
"V",
"whileUpdatingByXml",
"(",
"Callable",
"<",
"V",
",",
"T",
">",
"callable",
")",
"throws",
"T",
"{",
"updatingByXml",
".",
"set",
"(",
"true",
")",
";",
"try",
"{",
"return",
"... | Runs a block while making {@link #currentlyUpdatingByXml} be temporarily true.
Use this when you are creating or changing an item.
@param <V> a return value type (may be {@link Void})
@param <T> an error type (may be {@link Error})
@param callable a block, typically running {@link #load} or {@link Item#onLoad}
@return whatever {@code callable} returned
@throws T anything {@code callable} throws
@since 1.546 | [
"Runs",
"a",
"block",
"while",
"making",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Items.java#L133-L140 |
meertensinstituut/mtas | src/main/java/mtas/search/spans/util/MtasIgnoreItem.java | MtasIgnoreItem.getMaxEndPosition | public int getMaxEndPosition(int docId, int position) throws IOException {
if (ignoreSpans != null && docId == currentDocId) {
if (position < minimumPosition) {
throw new IOException(
"Unexpected position, should be >= " + minimumPosition + "!");
}
computeFullEndPositionList(position);
if (maxFullEndPosition.containsKey(position)) {
return maxFullEndPosition.get(position);
} else {
return 0;
}
} else {
return 0;
}
} | java | public int getMaxEndPosition(int docId, int position) throws IOException {
if (ignoreSpans != null && docId == currentDocId) {
if (position < minimumPosition) {
throw new IOException(
"Unexpected position, should be >= " + minimumPosition + "!");
}
computeFullEndPositionList(position);
if (maxFullEndPosition.containsKey(position)) {
return maxFullEndPosition.get(position);
} else {
return 0;
}
} else {
return 0;
}
} | [
"public",
"int",
"getMaxEndPosition",
"(",
"int",
"docId",
",",
"int",
"position",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ignoreSpans",
"!=",
"null",
"&&",
"docId",
"==",
"currentDocId",
")",
"{",
"if",
"(",
"position",
"<",
"minimumPosition",
")",
... | Gets the max end position.
@param docId the doc id
@param position the position
@return the max end position
@throws IOException Signals that an I/O exception has occurred. | [
"Gets",
"the",
"max",
"end",
"position",
"."
] | train | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/search/spans/util/MtasIgnoreItem.java#L144-L159 |
bladecoder/blade-ink | src/main/java/com/bladecoder/ink/runtime/CallStack.java | CallStack.getTemporaryVariableWithName | public RTObject getTemporaryVariableWithName(String name, int contextIndex) {
if (contextIndex == -1)
contextIndex = getCurrentElementIndex() + 1;
Element contextElement = getCallStack().get(contextIndex - 1);
RTObject varValue = contextElement.temporaryVariables.get(name);
return varValue;
} | java | public RTObject getTemporaryVariableWithName(String name, int contextIndex) {
if (contextIndex == -1)
contextIndex = getCurrentElementIndex() + 1;
Element contextElement = getCallStack().get(contextIndex - 1);
RTObject varValue = contextElement.temporaryVariables.get(name);
return varValue;
} | [
"public",
"RTObject",
"getTemporaryVariableWithName",
"(",
"String",
"name",
",",
"int",
"contextIndex",
")",
"{",
"if",
"(",
"contextIndex",
"==",
"-",
"1",
")",
"contextIndex",
"=",
"getCurrentElementIndex",
"(",
")",
"+",
"1",
";",
"Element",
"contextElement"... | Get variable value, dereferencing a variable pointer if necessary | [
"Get",
"variable",
"value",
"dereferencing",
"a",
"variable",
"pointer",
"if",
"necessary"
] | train | https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/CallStack.java#L249-L257 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/listener/FallbackEventHandler.java | FallbackEventHandler.handleEventMessage | public String handleEventMessage(String message, Object msgdoc, Map<String,String> metaInfo)
throws EventHandlerException {
String msg;
int code;
if (msgdoc == null) {
msg = "failed to parse XML message";
code = ListenerHelper.RETURN_STATUS_NON_XML;
} else {
String rootNodeName = XmlPath.getRootNodeName((XmlObject)msgdoc);
if (rootNodeName!=null && rootNodeName.equals("ping")) {
msg = XmlPath.evaluate((XmlObject)msgdoc, "ping");
if (msg==null) msg = "ping is successful";
code = ListenerHelper.RETURN_STATUS_SUCCESS;
} else {
msg = "No event handler has been configured for message";
code = ListenerHelper.RETURN_STATUS_NO_HANDLER;
logger.severe(msg + ": " + message);
}
}
StatusMessage statusMessage = new StatusMessage(code, msg);
if (message.trim().startsWith("{")) {
return statusMessage.getJsonString();
}
else {
return statusMessage.getXml();
}
} | java | public String handleEventMessage(String message, Object msgdoc, Map<String,String> metaInfo)
throws EventHandlerException {
String msg;
int code;
if (msgdoc == null) {
msg = "failed to parse XML message";
code = ListenerHelper.RETURN_STATUS_NON_XML;
} else {
String rootNodeName = XmlPath.getRootNodeName((XmlObject)msgdoc);
if (rootNodeName!=null && rootNodeName.equals("ping")) {
msg = XmlPath.evaluate((XmlObject)msgdoc, "ping");
if (msg==null) msg = "ping is successful";
code = ListenerHelper.RETURN_STATUS_SUCCESS;
} else {
msg = "No event handler has been configured for message";
code = ListenerHelper.RETURN_STATUS_NO_HANDLER;
logger.severe(msg + ": " + message);
}
}
StatusMessage statusMessage = new StatusMessage(code, msg);
if (message.trim().startsWith("{")) {
return statusMessage.getJsonString();
}
else {
return statusMessage.getXml();
}
} | [
"public",
"String",
"handleEventMessage",
"(",
"String",
"message",
",",
"Object",
"msgdoc",
",",
"Map",
"<",
"String",
",",
"String",
">",
"metaInfo",
")",
"throws",
"EventHandlerException",
"{",
"String",
"msg",
";",
"int",
"code",
";",
"if",
"(",
"msgdoc"... | The handler creates a standard error response message.
The status code and status message are set in the following
ways:
<ul>
<li>If the message cannot be parsed by the generic XML Bean,
the status code is set to -2 and the status message is
status message "failed to parse XML message"</li>
<li>If there is no matching handler found, but the root element
is "ping", the status code is set to 0 and and the
status message is set to the content of the ping in the
request</li>
<li>Otherwise, the status code is set to -3 and the status message
is set to "No event handler has been configured for message"</li>
</ul>
@param message the request message
@param msgdoc XML Bean parsed from request message, or null if the request
message cannot be parsed by the generic XML bean
@param metaInfo meta information. The method does not use this.
@return the response message | [
"The",
"handler",
"creates",
"a",
"standard",
"error",
"response",
"message",
".",
"The",
"status",
"code",
"and",
"status",
"message",
"are",
"set",
"in",
"the",
"following",
"ways",
":",
"<ul",
">",
"<li",
">",
"If",
"the",
"message",
"cannot",
"be",
"... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/listener/FallbackEventHandler.java#L83-L109 |
ben-manes/caffeine | caffeine/src/main/java/com/github/benmanes/caffeine/cache/CaffeineSpec.java | CaffeineSpec.durationInNanos | static long durationInNanos(long duration, @Nullable TimeUnit unit) {
return (unit == null) ? UNSET_INT : unit.toNanos(duration);
} | java | static long durationInNanos(long duration, @Nullable TimeUnit unit) {
return (unit == null) ? UNSET_INT : unit.toNanos(duration);
} | [
"static",
"long",
"durationInNanos",
"(",
"long",
"duration",
",",
"@",
"Nullable",
"TimeUnit",
"unit",
")",
"{",
"return",
"(",
"unit",
"==",
"null",
")",
"?",
"UNSET_INT",
":",
"unit",
".",
"toNanos",
"(",
"duration",
")",
";",
"}"
] | Converts an expiration duration/unit pair into a single long for hashing and equality. | [
"Converts",
"an",
"expiration",
"duration",
"/",
"unit",
"pair",
"into",
"a",
"single",
"long",
"for",
"hashing",
"and",
"equality",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CaffeineSpec.java#L361-L363 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/ClassCacheUtils.java | ClassCacheUtils.getClassFieldReadMethod | public static Method getClassFieldReadMethod(Class<?> clazz, String fieldName) {
return getClassReadMethods(clazz).get(fieldName);
} | java | public static Method getClassFieldReadMethod(Class<?> clazz, String fieldName) {
return getClassReadMethods(clazz).get(fieldName);
} | [
"public",
"static",
"Method",
"getClassFieldReadMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
")",
"{",
"return",
"getClassReadMethods",
"(",
"clazz",
")",
".",
"get",
"(",
"fieldName",
")",
";",
"}"
] | Return cached class field read method to avoid each time use reflect | [
"Return",
"cached",
"class",
"field",
"read",
"method",
"to",
"avoid",
"each",
"time",
"use",
"reflect"
] | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/ClassCacheUtils.java#L162-L164 |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addFile | public void addFile( final String path, final File source, final int mode, final int dirmode, final Directive directive, final String uname, final String gname, final boolean addParents) throws NoSuchAlgorithmException, IOException {
contents.addFile( path, source, mode, directive, uname, gname, dirmode, addParents);
} | java | public void addFile( final String path, final File source, final int mode, final int dirmode, final Directive directive, final String uname, final String gname, final boolean addParents) throws NoSuchAlgorithmException, IOException {
contents.addFile( path, source, mode, directive, uname, gname, dirmode, addParents);
} | [
"public",
"void",
"addFile",
"(",
"final",
"String",
"path",
",",
"final",
"File",
"source",
",",
"final",
"int",
"mode",
",",
"final",
"int",
"dirmode",
",",
"final",
"Directive",
"directive",
",",
"final",
"String",
"uname",
",",
"final",
"String",
"gnam... | Add the specified file to the repository payload in order.
The required header entries will automatically be generated
to record the directory names and file names, as well as their
digests.
@param path the absolute path at which this file will be installed.
@param source the file content to include in this rpm.
@param mode the mode of the target file in standard three octet notation, or -1 for default.
@param dirmode the mode of the parent directories in standard three octet notation, or -1 for default.
@param directive directive indicating special handling for this file.
@param uname user owner for the given file, or null for default user.
@param gname group owner for the given file, or null for default group.
@param addParents whether to create parent directories for the file, defaults to true for other methods.
@throws NoSuchAlgorithmException the algorithm isn't supported
@throws IOException there was an IO error | [
"Add",
"the",
"specified",
"file",
"to",
"the",
"repository",
"payload",
"in",
"order",
".",
"The",
"required",
"header",
"entries",
"will",
"automatically",
"be",
"generated",
"to",
"record",
"the",
"directory",
"names",
"and",
"file",
"names",
"as",
"well",
... | train | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L942-L944 |
ops4j/org.ops4j.pax.logging | pax-logging-log4j2/src/main/java/org/ops4j/pax/logging/log4j2/internal/PaxLoggingServiceImpl.java | PaxLoggingServiceImpl.setLevelToJavaLogging | private static void setLevelToJavaLogging( final Dictionary<String, ?> configuration )
{
for( Enumeration enum_ = java.util.logging.LogManager.getLogManager().getLoggerNames(); enum_.hasMoreElements();) {
String name = (String) enum_.nextElement();
java.util.logging.Logger.getLogger(name).setLevel( null );
}
for( Enumeration<String> keys = configuration.keys(); keys.hasMoreElements(); )
{
String name = keys.nextElement();
if (name.equals( LOG4J2_ROOT_LOGGER_LEVEL_PROPERTY ))
{
String value = (String) configuration.get( LOG4J2_ROOT_LOGGER_LEVEL_PROPERTY );
setJULLevel( java.util.logging.Logger.getLogger(""), value );
// "global" comes from java.util.logging.Logger.GLOBAL_LOGGER_NAME, but that constant wasn't added until Java 1.6
setJULLevel( java.util.logging.Logger.getLogger("global"), value );
}
if (name.startsWith( LOG4J2_LOGGER_PROPERTY_PREFIX )
&& name.endsWith ( ".name" ))
{
String value = (String) configuration.get( name.replaceFirst("\\.name$", ".level") );
String packageName = (String) configuration.get( name );
java.util.logging.Logger logger = java.util.logging.Logger.getLogger(packageName);
setJULLevel(logger, value);
}
}
} | java | private static void setLevelToJavaLogging( final Dictionary<String, ?> configuration )
{
for( Enumeration enum_ = java.util.logging.LogManager.getLogManager().getLoggerNames(); enum_.hasMoreElements();) {
String name = (String) enum_.nextElement();
java.util.logging.Logger.getLogger(name).setLevel( null );
}
for( Enumeration<String> keys = configuration.keys(); keys.hasMoreElements(); )
{
String name = keys.nextElement();
if (name.equals( LOG4J2_ROOT_LOGGER_LEVEL_PROPERTY ))
{
String value = (String) configuration.get( LOG4J2_ROOT_LOGGER_LEVEL_PROPERTY );
setJULLevel( java.util.logging.Logger.getLogger(""), value );
// "global" comes from java.util.logging.Logger.GLOBAL_LOGGER_NAME, but that constant wasn't added until Java 1.6
setJULLevel( java.util.logging.Logger.getLogger("global"), value );
}
if (name.startsWith( LOG4J2_LOGGER_PROPERTY_PREFIX )
&& name.endsWith ( ".name" ))
{
String value = (String) configuration.get( name.replaceFirst("\\.name$", ".level") );
String packageName = (String) configuration.get( name );
java.util.logging.Logger logger = java.util.logging.Logger.getLogger(packageName);
setJULLevel(logger, value);
}
}
} | [
"private",
"static",
"void",
"setLevelToJavaLogging",
"(",
"final",
"Dictionary",
"<",
"String",
",",
"?",
">",
"configuration",
")",
"{",
"for",
"(",
"Enumeration",
"enum_",
"=",
"java",
".",
"util",
".",
"logging",
".",
"LogManager",
".",
"getLogManager",
... | Configure Java Util Logging according to the provided configuration.
Convert the log4j configuration to JUL config.
It's necessary to do that, because with pax logging, JUL loggers are not replaced.
So we need to configure JUL loggers in order that log messages goes correctly to log Handlers.
@param configuration Properties coming from the configuration. | [
"Configure",
"Java",
"Util",
"Logging",
"according",
"to",
"the",
"provided",
"configuration",
".",
"Convert",
"the",
"log4j",
"configuration",
"to",
"JUL",
"config",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/ops4j/pax/logging/log4j2/internal/PaxLoggingServiceImpl.java#L485-L512 |
apache/groovy | subprojects/groovy-xml/src/main/java/groovy/xml/MarkupBuilder.java | MarkupBuilder.escapeXmlValue | private String escapeXmlValue(String value, boolean isAttrValue) {
if (value == null)
throw new IllegalArgumentException();
return StringGroovyMethods.collectReplacements(value, new ReplacingClosure(isAttrValue, useDoubleQuotes));
} | java | private String escapeXmlValue(String value, boolean isAttrValue) {
if (value == null)
throw new IllegalArgumentException();
return StringGroovyMethods.collectReplacements(value, new ReplacingClosure(isAttrValue, useDoubleQuotes));
} | [
"private",
"String",
"escapeXmlValue",
"(",
"String",
"value",
",",
"boolean",
"isAttrValue",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"return",
"StringGroovyMethods",
".",
"collectReplacements",
... | Escapes a string so that it can be used in XML text successfully.
It replaces the following characters with the corresponding XML
entities:
<ul>
<li>& as &amp;</li>
<li>< as &lt;</li>
<li>> as &gt;</li>
</ul>
If the string is to be added as an attribute value, these
characters are also escaped:
<ul>
<li>' as &apos;</li>
</ul>
@param value The string to escape.
@param isAttrValue <code>true</code> if the string is to be used
as an attribute value, otherwise <code>false</code>.
@return A new string in which all characters that require escaping
have been replaced with the corresponding XML entities. | [
"Escapes",
"a",
"string",
"so",
"that",
"it",
"can",
"be",
"used",
"in",
"XML",
"text",
"successfully",
".",
"It",
"replaces",
"the",
"following",
"characters",
"with",
"the",
"corresponding",
"XML",
"entities",
":",
"<ul",
">",
"<li",
">",
"&",
";",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/MarkupBuilder.java#L390-L394 |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ManagedExecutorServiceImpl.java | ManagedExecutorServiceImpl.getExecutionProperties | final Map<String, String> getExecutionProperties(Object task) {
if (task == null) // NullPointerException is required per the JavaDoc API
throw new NullPointerException(Tr.formatMessage(tc, "CWWKC1111.task.invalid", (Object) null));
Map<String, String> execProps = task instanceof ManagedTask ? ((ManagedTask) task).getExecutionProperties() : null;
if (execProps == null)
execProps = defaultExecutionProperties.get();
else {
execProps = new TreeMap<String, String>(execProps);
String tranProp = execProps.remove(ManagedTask.TRANSACTION);
if (tranProp != null && !ManagedTask.SUSPEND.equals(tranProp)) // USE_TRANSACTION_OF_EXECUTION_THREAD not valid for managed tasks
throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKC1130.xprop.value.invalid", name, ManagedTask.TRANSACTION, tranProp));
if (!execProps.containsKey(WSContextService.DEFAULT_CONTEXT))
execProps.put(WSContextService.DEFAULT_CONTEXT, WSContextService.UNCONFIGURED_CONTEXT_TYPES);
if (!execProps.containsKey(WSContextService.TASK_OWNER))
execProps.put(WSContextService.TASK_OWNER, name.get());
}
return execProps;
} | java | final Map<String, String> getExecutionProperties(Object task) {
if (task == null) // NullPointerException is required per the JavaDoc API
throw new NullPointerException(Tr.formatMessage(tc, "CWWKC1111.task.invalid", (Object) null));
Map<String, String> execProps = task instanceof ManagedTask ? ((ManagedTask) task).getExecutionProperties() : null;
if (execProps == null)
execProps = defaultExecutionProperties.get();
else {
execProps = new TreeMap<String, String>(execProps);
String tranProp = execProps.remove(ManagedTask.TRANSACTION);
if (tranProp != null && !ManagedTask.SUSPEND.equals(tranProp)) // USE_TRANSACTION_OF_EXECUTION_THREAD not valid for managed tasks
throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKC1130.xprop.value.invalid", name, ManagedTask.TRANSACTION, tranProp));
if (!execProps.containsKey(WSContextService.DEFAULT_CONTEXT))
execProps.put(WSContextService.DEFAULT_CONTEXT, WSContextService.UNCONFIGURED_CONTEXT_TYPES);
if (!execProps.containsKey(WSContextService.TASK_OWNER))
execProps.put(WSContextService.TASK_OWNER, name.get());
}
return execProps;
} | [
"final",
"Map",
"<",
"String",
",",
"String",
">",
"getExecutionProperties",
"(",
"Object",
"task",
")",
"{",
"if",
"(",
"task",
"==",
"null",
")",
"// NullPointerException is required per the JavaDoc API",
"throw",
"new",
"NullPointerException",
"(",
"Tr",
".",
"... | Returns execution properties for the task.
@param task the task being submitted for execution.
@return execution properties for the task. | [
"Returns",
"execution",
"properties",
"for",
"the",
"task",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ManagedExecutorServiceImpl.java#L367-L385 |
alkacon/opencms-core | src/org/opencms/repository/CmsRepositoryFilter.java | CmsRepositoryFilter.isPartialMatch | private boolean isPartialMatch(Pattern pattern, String path) {
Matcher matcher = pattern.matcher(path);
if (matcher.matches()) {
return true;
}
if (!path.endsWith("/")) {
matcher = pattern.matcher(path + "/");
return matcher.matches();
}
return false;
// return matcher.hitEnd();
} | java | private boolean isPartialMatch(Pattern pattern, String path) {
Matcher matcher = pattern.matcher(path);
if (matcher.matches()) {
return true;
}
if (!path.endsWith("/")) {
matcher = pattern.matcher(path + "/");
return matcher.matches();
}
return false;
// return matcher.hitEnd();
} | [
"private",
"boolean",
"isPartialMatch",
"(",
"Pattern",
"pattern",
",",
"String",
"path",
")",
"{",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"path",
")",
";",
"if",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"return",
"true",
... | Returns if the given path matches or partially matches the pattern.<p>
For example the regex "/system/modules/" should match the path "/system/".
That's not working with Java 1.4. Starting with Java 1.5 there are possiblities
to do that. Until then you have to configure all parent paths as a regex filter.<p>
@param pattern the pattern to use
@param path the path to test if the pattern matches (partially)
@return true if the path matches (partially) the pattern | [
"Returns",
"if",
"the",
"given",
"path",
"matches",
"or",
"partially",
"matches",
"the",
"pattern",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/repository/CmsRepositoryFilter.java#L174-L188 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.appendShortText | public DateTimeFormatterBuilder appendShortText(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("Field type must not be null");
}
return append0(new TextField(fieldType, true));
} | java | public DateTimeFormatterBuilder appendShortText(DateTimeFieldType fieldType) {
if (fieldType == null) {
throw new IllegalArgumentException("Field type must not be null");
}
return append0(new TextField(fieldType, true));
} | [
"public",
"DateTimeFormatterBuilder",
"appendShortText",
"(",
"DateTimeFieldType",
"fieldType",
")",
"{",
"if",
"(",
"fieldType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Field type must not be null\"",
")",
";",
"}",
"return",
"appe... | Instructs the printer to emit a field value as short text, and the
parser to expect text.
@param fieldType type of field to append
@return this DateTimeFormatterBuilder, for chaining
@throws IllegalArgumentException if field type is null | [
"Instructs",
"the",
"printer",
"to",
"emit",
"a",
"field",
"value",
"as",
"short",
"text",
"and",
"the",
"parser",
"to",
"expect",
"text",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L549-L554 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java | AipImageSearch.productUpdateUrl | public JSONObject productUpdateUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.PRODUCT_UPDATE);
postOperation(request);
return requestServer(request);
} | java | public JSONObject productUpdateUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.PRODUCT_UPDATE);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"productUpdateUrl",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"request",
... | 商品检索—更新接口
**更新图库中图片的摘要和分类信息(具体变量为brief、class_id1/class_id2)**
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
brief 更新的摘要信息,最长256B。样例:{"name":"周杰伦", "id":"666"}
class_id1 更新的商品分类1,支持1-60范围内的整数。
class_id2 更新的商品分类2,支持1-60范围内的整数。
@return JSONObject | [
"商品检索—更新接口",
"**",
"更新图库中图片的摘要和分类信息(具体变量为brief、class_id1",
"/",
"class_id2)",
"**"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java#L893-L904 |
jbundle/jbundle | main/screen/src/main/java/org/jbundle/main/user/screen/UserPasswordChange.java | UserPasswordChange.addToolbars | public ToolScreen addToolbars()
{
ToolScreen screen = new ToolScreen(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.SUBMIT);
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.RESET);
String strDesc = "Create account";
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, null, strDesc, MenuConstants.FORM, MenuConstants.FORM, MenuConstants.FORM + "Tip");
return screen;
} | java | public ToolScreen addToolbars()
{
ToolScreen screen = new ToolScreen(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.SUBMIT);
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.RESET);
String strDesc = "Create account";
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, null, strDesc, MenuConstants.FORM, MenuConstants.FORM, MenuConstants.FORM + "Tip");
return screen;
} | [
"public",
"ToolScreen",
"addToolbars",
"(",
")",
"{",
"ToolScreen",
"screen",
"=",
"new",
"ToolScreen",
"(",
"null",
",",
"this",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"null",
")",
";",
"new",
"SCannedBox",
"(",
"screen",
... | Add the toolbars that belong with this screen.
@return The new toolbar. | [
"Add",
"the",
"toolbars",
"that",
"belong",
"with",
"this",
"screen",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserPasswordChange.java#L78-L86 |
biezhi/webp-io | src/main/java/io/github/biezhi/webp/WebpIO.java | WebpIO.toWEBP | public void toWEBP(String src, String dest) {
toWEBP(new File(src), new File(dest));
} | java | public void toWEBP(String src, String dest) {
toWEBP(new File(src), new File(dest));
} | [
"public",
"void",
"toWEBP",
"(",
"String",
"src",
",",
"String",
"dest",
")",
"{",
"toWEBP",
"(",
"new",
"File",
"(",
"src",
")",
",",
"new",
"File",
"(",
"dest",
")",
")",
";",
"}"
] | Convert normal image to webp file
@param src nomal image path
@param dest webp file path | [
"Convert",
"normal",
"image",
"to",
"webp",
"file"
] | train | https://github.com/biezhi/webp-io/blob/8eefe535087b3abccacff76de2b6e27bb7301bcc/src/main/java/io/github/biezhi/webp/WebpIO.java#L97-L99 |
Cleveroad/AdaptiveTableLayout | library/src/main/java/com/cleveroad/adaptivetablelayout/AdaptiveTableManager.java | AdaptiveTableManager.switchTwoRows | void switchTwoRows(int rowIndex, int rowToIndex) {
checkForInit();
int cellData = mRowHeights[rowToIndex];
mRowHeights[rowToIndex] = mRowHeights[rowIndex];
mRowHeights[rowIndex] = cellData;
} | java | void switchTwoRows(int rowIndex, int rowToIndex) {
checkForInit();
int cellData = mRowHeights[rowToIndex];
mRowHeights[rowToIndex] = mRowHeights[rowIndex];
mRowHeights[rowIndex] = cellData;
} | [
"void",
"switchTwoRows",
"(",
"int",
"rowIndex",
",",
"int",
"rowToIndex",
")",
"{",
"checkForInit",
"(",
")",
";",
"int",
"cellData",
"=",
"mRowHeights",
"[",
"rowToIndex",
"]",
";",
"mRowHeights",
"[",
"rowToIndex",
"]",
"=",
"mRowHeights",
"[",
"rowIndex"... | Switch 2 items in array with rows data
@param rowIndex from row index
@param rowToIndex to row index | [
"Switch",
"2",
"items",
"in",
"array",
"with",
"rows",
"data"
] | train | https://github.com/Cleveroad/AdaptiveTableLayout/blob/188213b35e05e635497b03fe741799782dde7208/library/src/main/java/com/cleveroad/adaptivetablelayout/AdaptiveTableManager.java#L354-L359 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.makeArrayType | public ArrayType makeArrayType(Type t) {
if (t.hasTag(VOID) || t.hasTag(PACKAGE)) {
Assert.error("Type t must not be a VOID or PACKAGE type, " + t.toString());
}
return new ArrayType(t, syms.arrayClass);
} | java | public ArrayType makeArrayType(Type t) {
if (t.hasTag(VOID) || t.hasTag(PACKAGE)) {
Assert.error("Type t must not be a VOID or PACKAGE type, " + t.toString());
}
return new ArrayType(t, syms.arrayClass);
} | [
"public",
"ArrayType",
"makeArrayType",
"(",
"Type",
"t",
")",
"{",
"if",
"(",
"t",
".",
"hasTag",
"(",
"VOID",
")",
"||",
"t",
".",
"hasTag",
"(",
"PACKAGE",
")",
")",
"{",
"Assert",
".",
"error",
"(",
"\"Type t must not be a VOID or PACKAGE type, \"",
"+... | Returns an ArrayType with the component type t
@param t The component type of the ArrayType
@return the ArrayType for the given component | [
"Returns",
"an",
"ArrayType",
"with",
"the",
"component",
"type",
"t"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1832-L1837 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java | TitlePaneMenuButtonPainter.decodeMarkBorder | private Shape decodeMarkBorder(int width, int height) {
double left = width / 2.0 - 4;
double top = height / 2.0 - 4;
path.reset();
path.moveTo(left + 0, top + 0);
path.lineTo(left + 8, top);
path.lineTo(left + 4, top + 6);
path.closePath();
return path;
} | java | private Shape decodeMarkBorder(int width, int height) {
double left = width / 2.0 - 4;
double top = height / 2.0 - 4;
path.reset();
path.moveTo(left + 0, top + 0);
path.lineTo(left + 8, top);
path.lineTo(left + 4, top + 6);
path.closePath();
return path;
} | [
"private",
"Shape",
"decodeMarkBorder",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"double",
"left",
"=",
"width",
"/",
"2.0",
"-",
"4",
";",
"double",
"top",
"=",
"height",
"/",
"2.0",
"-",
"4",
";",
"path",
".",
"reset",
"(",
")",
";",
... | Create the mark border shape.
@param width the width.
@param height the height.
@return the shape of the mark border. | [
"Create",
"the",
"mark",
"border",
"shape",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java#L255-L266 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java | GeoInterface.batchCorrectLocation | public void batchCorrectLocation(GeoData location, String placeId, String woeId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_BATCH_CORRECT_LOCATION);
if (placeId != null) {
parameters.put("place_id", placeId);
}
if (woeId != null) {
parameters.put("woe_id", woeId);
}
parameters.put("lat", Float.toString(location.getLatitude()));
parameters.put("lon", Float.toString(location.getLongitude()));
parameters.put("accuracy", Integer.toString(location.getAccuracy()));
// Note: This method requires an HTTP POST request.
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
// This method has no specific response - It returns an empty sucess response
// if it completes without error.
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void batchCorrectLocation(GeoData location, String placeId, String woeId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_BATCH_CORRECT_LOCATION);
if (placeId != null) {
parameters.put("place_id", placeId);
}
if (woeId != null) {
parameters.put("woe_id", woeId);
}
parameters.put("lat", Float.toString(location.getLatitude()));
parameters.put("lon", Float.toString(location.getLongitude()));
parameters.put("accuracy", Integer.toString(location.getAccuracy()));
// Note: This method requires an HTTP POST request.
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
// This method has no specific response - It returns an empty sucess response
// if it completes without error.
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"batchCorrectLocation",
"(",
"GeoData",
"location",
",",
"String",
"placeId",
",",
"String",
"woeId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
... | Correct the places hierarchy for all the photos for a user at a given latitude, longitude and accuracy.
<p>
Batch corrections are processed in a delayed queue so it may take a few minutes before the changes are reflected in a user's photos.
@param location
The latitude/longitude and accuracy of the photos to be update.
@param placeId
A Flickr Places ID. (While optional, you must pass either a valid Places ID or a WOE ID.)
@param woeId
A Where On Earth (WOE) ID. (While optional, you must pass either a valid Places ID or a WOE ID.)
@throws FlickrException | [
"Correct",
"the",
"places",
"hierarchy",
"for",
"all",
"the",
"photos",
"for",
"a",
"user",
"at",
"a",
"given",
"latitude",
"longitude",
"and",
"accuracy",
".",
"<p",
">"
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L226-L247 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java | GeneratedDOAuth2UserDaoImpl.queryByRoles | public Iterable<DOAuth2User> queryByRoles(java.lang.Object roles) {
return queryByField(null, DOAuth2UserMapper.Field.ROLES.getFieldName(), roles);
} | java | public Iterable<DOAuth2User> queryByRoles(java.lang.Object roles) {
return queryByField(null, DOAuth2UserMapper.Field.ROLES.getFieldName(), roles);
} | [
"public",
"Iterable",
"<",
"DOAuth2User",
">",
"queryByRoles",
"(",
"java",
".",
"lang",
".",
"Object",
"roles",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DOAuth2UserMapper",
".",
"Field",
".",
"ROLES",
".",
"getFieldName",
"(",
")",
",",
"rol... | query-by method for field roles
@param roles the specified attribute
@return an Iterable of DOAuth2Users for the specified roles | [
"query",
"-",
"by",
"method",
"for",
"field",
"roles"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java#L115-L117 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java | DeadCodeEliminator.removeDeadFields | private void removeDeadFields(String clazz, List<BodyDeclaration> declarations) {
Iterator<BodyDeclaration> declarationsIter = declarations.iterator();
while (declarationsIter.hasNext()) {
BodyDeclaration declaration = declarationsIter.next();
if (declaration instanceof FieldDeclaration) {
FieldDeclaration field = (FieldDeclaration) declaration;
Iterator<VariableDeclarationFragment> fragmentsIter = field.getFragments().iterator();
while (fragmentsIter.hasNext()) {
VariableDeclarationFragment fragment = fragmentsIter.next();
// Don't delete any constants because we can't detect their use. Instead,
// these are translated by the TypeDeclarationGenerator as #define directives,
// so the enclosing type can still be deleted if otherwise empty.
VariableElement var = fragment.getVariableElement();
if (var.getConstantValue() == null
&& deadCodeMap.containsField(clazz, ElementUtil.getName(var))) {
fragmentsIter.remove();
}
}
if (field.getFragments().isEmpty()) {
declarationsIter.remove();
}
}
}
} | java | private void removeDeadFields(String clazz, List<BodyDeclaration> declarations) {
Iterator<BodyDeclaration> declarationsIter = declarations.iterator();
while (declarationsIter.hasNext()) {
BodyDeclaration declaration = declarationsIter.next();
if (declaration instanceof FieldDeclaration) {
FieldDeclaration field = (FieldDeclaration) declaration;
Iterator<VariableDeclarationFragment> fragmentsIter = field.getFragments().iterator();
while (fragmentsIter.hasNext()) {
VariableDeclarationFragment fragment = fragmentsIter.next();
// Don't delete any constants because we can't detect their use. Instead,
// these are translated by the TypeDeclarationGenerator as #define directives,
// so the enclosing type can still be deleted if otherwise empty.
VariableElement var = fragment.getVariableElement();
if (var.getConstantValue() == null
&& deadCodeMap.containsField(clazz, ElementUtil.getName(var))) {
fragmentsIter.remove();
}
}
if (field.getFragments().isEmpty()) {
declarationsIter.remove();
}
}
}
} | [
"private",
"void",
"removeDeadFields",
"(",
"String",
"clazz",
",",
"List",
"<",
"BodyDeclaration",
">",
"declarations",
")",
"{",
"Iterator",
"<",
"BodyDeclaration",
">",
"declarationsIter",
"=",
"declarations",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"... | Deletes non-constant dead fields from a type's body declarations list. | [
"Deletes",
"non",
"-",
"constant",
"dead",
"fields",
"from",
"a",
"type",
"s",
"body",
"declarations",
"list",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java#L204-L227 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java | GregorianCalendar.monthLength | private int monthLength(int month) {
int year = internalGet(YEAR);
if (internalGetEra() == BCE) {
year = 1 - year;
}
return monthLength(month, year);
} | java | private int monthLength(int month) {
int year = internalGet(YEAR);
if (internalGetEra() == BCE) {
year = 1 - year;
}
return monthLength(month, year);
} | [
"private",
"int",
"monthLength",
"(",
"int",
"month",
")",
"{",
"int",
"year",
"=",
"internalGet",
"(",
"YEAR",
")",
";",
"if",
"(",
"internalGetEra",
"(",
")",
"==",
"BCE",
")",
"{",
"year",
"=",
"1",
"-",
"year",
";",
"}",
"return",
"monthLength",
... | Returns the length of the specified month in the year provided
by internalGet(YEAR).
@see #isLeapYear(int) | [
"Returns",
"the",
"length",
"of",
"the",
"specified",
"month",
"in",
"the",
"year",
"provided",
"by",
"internalGet",
"(",
"YEAR",
")",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java#L3270-L3276 |
GenesysPureEngage/authentication-client-java | src/main/java/com/genesys/authentication/AuthenticationApi.java | AuthenticationApi.changePassword | public ModelApiResponse changePassword(ChangePasswordOperation request, String authorization) throws AuthenticationApiException {
try {
ApiRequestChangePasswordOperation req = new ApiRequestChangePasswordOperation();
req.data(request);
return authenticationApi.changePassword(req, authorization);
} catch (ApiException e) {
throw new AuthenticationApiException("Error changing password", e);
}
} | java | public ModelApiResponse changePassword(ChangePasswordOperation request, String authorization) throws AuthenticationApiException {
try {
ApiRequestChangePasswordOperation req = new ApiRequestChangePasswordOperation();
req.data(request);
return authenticationApi.changePassword(req, authorization);
} catch (ApiException e) {
throw new AuthenticationApiException("Error changing password", e);
}
} | [
"public",
"ModelApiResponse",
"changePassword",
"(",
"ChangePasswordOperation",
"request",
",",
"String",
"authorization",
")",
"throws",
"AuthenticationApiException",
"{",
"try",
"{",
"ApiRequestChangePasswordOperation",
"req",
"=",
"new",
"ApiRequestChangePasswordOperation",
... | Change password
Change the user's password.
@param request request (required)
@param authorization The OAuth 2 bearer access token you received from [/auth/v3/oauth/token](/reference/authentication/Authentication/index.html#retrieveToken). For example: \"Authorization: bearer a4b5da75-a584-4053-9227-0f0ab23ff06e\" (optional, default to bearer)
@return ModelApiResponse
@throws AuthenticationApiException if the call is unsuccessful. | [
"Change",
"password",
"Change",
"the",
"user'",
";",
"s",
"password",
"."
] | train | https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/authentication/AuthenticationApi.java#L70-L78 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/AjaxSlider.java | AjaxSlider.setAjaxChangeEvent | public void setAjaxChangeEvent(ISliderAjaxEvent ajaxChangeEvent)
{
this.ajaxEvents.put(SliderAjaxEvent.ajaxChangeEvent, ajaxChangeEvent);
setChangeEvent(new SliderAjaxJsScopeUiEvent(this, SliderAjaxEvent.ajaxChangeEvent));
} | java | public void setAjaxChangeEvent(ISliderAjaxEvent ajaxChangeEvent)
{
this.ajaxEvents.put(SliderAjaxEvent.ajaxChangeEvent, ajaxChangeEvent);
setChangeEvent(new SliderAjaxJsScopeUiEvent(this, SliderAjaxEvent.ajaxChangeEvent));
} | [
"public",
"void",
"setAjaxChangeEvent",
"(",
"ISliderAjaxEvent",
"ajaxChangeEvent",
")",
"{",
"this",
".",
"ajaxEvents",
".",
"put",
"(",
"SliderAjaxEvent",
".",
"ajaxChangeEvent",
",",
"ajaxChangeEvent",
")",
";",
"setChangeEvent",
"(",
"new",
"SliderAjaxJsScopeUiEve... | Sets the call-back for the AJAX Change Event.
@param ajaxChangeEvent | [
"Sets",
"the",
"call",
"-",
"back",
"for",
"the",
"AJAX",
"Change",
"Event",
"."
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/AjaxSlider.java#L329-L333 |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/util/TimeUtils.java | TimeUtils.firstDayOfWeekInMonth | public static DayOfWeek firstDayOfWeekInMonth(int year, int month) {
int result = fixedFromGregorian(year, month, 1) % 7;
if (result < 0) {
result += 7;
}
return DAYS_OF_WEEK[result];
} | java | public static DayOfWeek firstDayOfWeekInMonth(int year, int month) {
int result = fixedFromGregorian(year, month, 1) % 7;
if (result < 0) {
result += 7;
}
return DAYS_OF_WEEK[result];
} | [
"public",
"static",
"DayOfWeek",
"firstDayOfWeekInMonth",
"(",
"int",
"year",
",",
"int",
"month",
")",
"{",
"int",
"result",
"=",
"fixedFromGregorian",
"(",
"year",
",",
"month",
",",
"1",
")",
"%",
"7",
";",
"if",
"(",
"result",
"<",
"0",
")",
"{",
... | Gets the day of the week of the first day in the given month.
@param year the year
@param month the month (1-12)
@return the day of the week | [
"Gets",
"the",
"day",
"of",
"the",
"week",
"of",
"the",
"first",
"day",
"in",
"the",
"given",
"month",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/util/TimeUtils.java#L308-L314 |
atteo/classindex | classindex/src/main/java/org/atteo/classindex/ClassIndex.java | ClassIndex.getAnnotated | public static Iterable<Class<?>> getAnnotated(Class<? extends Annotation> annotation) {
return getAnnotated(annotation, Thread.currentThread().getContextClassLoader());
} | java | public static Iterable<Class<?>> getAnnotated(Class<? extends Annotation> annotation) {
return getAnnotated(annotation, Thread.currentThread().getContextClassLoader());
} | [
"public",
"static",
"Iterable",
"<",
"Class",
"<",
"?",
">",
">",
"getAnnotated",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"return",
"getAnnotated",
"(",
"annotation",
",",
"Thread",
".",
"currentThread",
"(",
")",
".",... | Retrieves a list of classes annotated by given annotation.
<p/>
<p>
The annotation must be annotated with {@link IndexAnnotated} for annotated classes
to be indexed at compile-time by {@link org.atteo.classindex.processor.ClassIndexProcessor}.
</p>
@param annotation annotation to search class for
@return list of annotated classes | [
"Retrieves",
"a",
"list",
"of",
"classes",
"annotated",
"by",
"given",
"annotation",
".",
"<p",
"/",
">",
"<p",
">",
"The",
"annotation",
"must",
"be",
"annotated",
"with",
"{",
"@link",
"IndexAnnotated",
"}",
"for",
"annotated",
"classes",
"to",
"be",
"in... | train | https://github.com/atteo/classindex/blob/ad76c6bd8b4e84c594d94e48f466a095ffe2306a/classindex/src/main/java/org/atteo/classindex/ClassIndex.java#L248-L250 |
Azure/azure-sdk-for-java | common/azure-common/src/main/java/com/azure/common/implementation/RestProxy.java | RestProxy.createHttpRequest | @SuppressWarnings("unchecked")
private HttpRequest createHttpRequest(OperationDescription operationDescription, SwaggerMethodParser methodParser, Object[] args) throws IOException {
final HttpRequest request = configRequest(new HttpRequest(methodParser.httpMethod(), operationDescription.url()), methodParser, args);
// Headers from Swagger method arguments always take precedence over inferred headers from body types
for (final String headerName : operationDescription.headers().keySet()) {
request.withHeader(headerName, operationDescription.headers().get(headerName));
}
return request;
} | java | @SuppressWarnings("unchecked")
private HttpRequest createHttpRequest(OperationDescription operationDescription, SwaggerMethodParser methodParser, Object[] args) throws IOException {
final HttpRequest request = configRequest(new HttpRequest(methodParser.httpMethod(), operationDescription.url()), methodParser, args);
// Headers from Swagger method arguments always take precedence over inferred headers from body types
for (final String headerName : operationDescription.headers().keySet()) {
request.withHeader(headerName, operationDescription.headers().get(headerName));
}
return request;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"HttpRequest",
"createHttpRequest",
"(",
"OperationDescription",
"operationDescription",
",",
"SwaggerMethodParser",
"methodParser",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"final... | Create a HttpRequest for the provided Swagger method using the provided arguments.
@param methodParser the Swagger method parser to use
@param args the arguments to use to populate the method's annotation values
@return a HttpRequest
@throws IOException thrown if the body contents cannot be serialized | [
"Create",
"a",
"HttpRequest",
"for",
"the",
"provided",
"Swagger",
"method",
"using",
"the",
"provided",
"arguments",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/RestProxy.java#L210-L220 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java | AppsImpl.updateSettingsAsync | public Observable<OperationStatus> updateSettingsAsync(UUID appId, UpdateSettingsOptionalParameter updateSettingsOptionalParameter) {
return updateSettingsWithServiceResponseAsync(appId, updateSettingsOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> updateSettingsAsync(UUID appId, UpdateSettingsOptionalParameter updateSettingsOptionalParameter) {
return updateSettingsWithServiceResponseAsync(appId, updateSettingsOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"updateSettingsAsync",
"(",
"UUID",
"appId",
",",
"UpdateSettingsOptionalParameter",
"updateSettingsOptionalParameter",
")",
"{",
"return",
"updateSettingsWithServiceResponseAsync",
"(",
"appId",
",",
"updateSettingsOptionalP... | Updates the application settings.
@param appId The application ID.
@param updateSettingsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Updates",
"the",
"application",
"settings",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java#L1335-L1342 |
CodeNarc/CodeNarc | src/main/java/org/codenarc/util/AstUtil.java | AstUtil.isConstant | public static boolean isConstant(Expression expression, Object expected) {
return expression instanceof ConstantExpression && expected.equals(((ConstantExpression) expression).getValue());
} | java | public static boolean isConstant(Expression expression, Object expected) {
return expression instanceof ConstantExpression && expected.equals(((ConstantExpression) expression).getValue());
} | [
"public",
"static",
"boolean",
"isConstant",
"(",
"Expression",
"expression",
",",
"Object",
"expected",
")",
"{",
"return",
"expression",
"instanceof",
"ConstantExpression",
"&&",
"expected",
".",
"equals",
"(",
"(",
"(",
"ConstantExpression",
")",
"expression",
... | Tells you if an expression is the expected constant.
@param expression
any expression
@param expected
the expected int or String
@return
as described | [
"Tells",
"you",
"if",
"an",
"expression",
"is",
"the",
"expected",
"constant",
"."
] | train | https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L156-L158 |
zxing/zxing | core/src/main/java/com/google/zxing/aztec/detector/Detector.java | Detector.getFirstDifferent | private Point getFirstDifferent(Point init, boolean color, int dx, int dy) {
int x = init.getX() + dx;
int y = init.getY() + dy;
while (isValid(x, y) && image.get(x, y) == color) {
x += dx;
y += dy;
}
x -= dx;
y -= dy;
while (isValid(x, y) && image.get(x, y) == color) {
x += dx;
}
x -= dx;
while (isValid(x, y) && image.get(x, y) == color) {
y += dy;
}
y -= dy;
return new Point(x, y);
} | java | private Point getFirstDifferent(Point init, boolean color, int dx, int dy) {
int x = init.getX() + dx;
int y = init.getY() + dy;
while (isValid(x, y) && image.get(x, y) == color) {
x += dx;
y += dy;
}
x -= dx;
y -= dy;
while (isValid(x, y) && image.get(x, y) == color) {
x += dx;
}
x -= dx;
while (isValid(x, y) && image.get(x, y) == color) {
y += dy;
}
y -= dy;
return new Point(x, y);
} | [
"private",
"Point",
"getFirstDifferent",
"(",
"Point",
"init",
",",
"boolean",
"color",
",",
"int",
"dx",
",",
"int",
"dy",
")",
"{",
"int",
"x",
"=",
"init",
".",
"getX",
"(",
")",
"+",
"dx",
";",
"int",
"y",
"=",
"init",
".",
"getY",
"(",
")",
... | Gets the coordinate of the first point with a different color in the given direction | [
"Gets",
"the",
"coordinate",
"of",
"the",
"first",
"point",
"with",
"a",
"different",
"color",
"in",
"the",
"given",
"direction"
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L494-L517 |
jeffreyning/nh-micro | nh-micro-template/src/main/java/com/nh/micro/template/MicroServiceTemplateSupport.java | MicroServiceTemplateSupport.updateInfoServiceInner | public Integer updateInfoServiceInner(String id,Map requestParamMap,String tableName,String cusCondition,String cusSetStr,String modelName) throws Exception{
String tempKeyId=calcuIdKey();
//add 20170829 ninghao
Integer filterViewRet=filterView(tableName,requestParamMap,id,tempKeyId,TYPE_UPDATE_ID);
if(filterViewRet!=null && filterViewRet>0){
return filterViewRet;
}
String tempDbType=calcuDbType();
//add 20170627 ninghao
filterParam(tableName,requestParamMap);
//String id=(String) requestParamMap.get(defaultId);
String condition=tempKeyId+"=?";
if(modelName==null || "".equals(modelName)){
modelName=tableName;
}
Map modelEntryMap=getModelEntryMap(requestParamMap,tableName,modelName,dbName);
List placeList=new ArrayList();
//add 201807 ning
//Map requestParamMap=changeCase4Param(requestParamMap0);
String setStr=createUpdateInStr(requestParamMap,modelEntryMap,placeList);
String nCondition=cusCondition;
String nSetStr=setStr;
//add 201806 ninghao
if(condition!=null && !"".equals(condition)){
nCondition=Cutil.jn(" and ", condition,cusCondition);
}
if(cusSetStr!=null && !"".equals(cusSetStr)){
nSetStr=Cutil.jn(",", setStr,cusSetStr);
}
placeList.add(id);
Integer retStatus=getInnerDao().updateObjByCondition(tableName, nCondition, nSetStr,placeList.toArray());
return retStatus;
} | java | public Integer updateInfoServiceInner(String id,Map requestParamMap,String tableName,String cusCondition,String cusSetStr,String modelName) throws Exception{
String tempKeyId=calcuIdKey();
//add 20170829 ninghao
Integer filterViewRet=filterView(tableName,requestParamMap,id,tempKeyId,TYPE_UPDATE_ID);
if(filterViewRet!=null && filterViewRet>0){
return filterViewRet;
}
String tempDbType=calcuDbType();
//add 20170627 ninghao
filterParam(tableName,requestParamMap);
//String id=(String) requestParamMap.get(defaultId);
String condition=tempKeyId+"=?";
if(modelName==null || "".equals(modelName)){
modelName=tableName;
}
Map modelEntryMap=getModelEntryMap(requestParamMap,tableName,modelName,dbName);
List placeList=new ArrayList();
//add 201807 ning
//Map requestParamMap=changeCase4Param(requestParamMap0);
String setStr=createUpdateInStr(requestParamMap,modelEntryMap,placeList);
String nCondition=cusCondition;
String nSetStr=setStr;
//add 201806 ninghao
if(condition!=null && !"".equals(condition)){
nCondition=Cutil.jn(" and ", condition,cusCondition);
}
if(cusSetStr!=null && !"".equals(cusSetStr)){
nSetStr=Cutil.jn(",", setStr,cusSetStr);
}
placeList.add(id);
Integer retStatus=getInnerDao().updateObjByCondition(tableName, nCondition, nSetStr,placeList.toArray());
return retStatus;
} | [
"public",
"Integer",
"updateInfoServiceInner",
"(",
"String",
"id",
",",
"Map",
"requestParamMap",
",",
"String",
"tableName",
",",
"String",
"cusCondition",
",",
"String",
"cusSetStr",
",",
"String",
"modelName",
")",
"throws",
"Exception",
"{",
"String",
"tempKe... | ������ݼ�¼
@param requestParamMap �ύ����
@param tableName �����
@param cusCondition ���������ַ�
@param cusSetStr ����set�ַ�
@param modelName ����
@return
@throws Exception | [
"������ݼ�¼"
] | train | https://github.com/jeffreyning/nh-micro/blob/f1cb420a092f8ba94317519ede739974decb5617/nh-micro-template/src/main/java/com/nh/micro/template/MicroServiceTemplateSupport.java#L1600-L1638 |
iipc/webarchive-commons | src/main/java/org/archive/io/RecordingOutputStream.java | RecordingOutputStream.tailRecord | private void tailRecord(byte[] b, int off, int len) throws IOException {
if(this.position >= this.buffer.length){
this.ensureDiskStream().write(b, off, len);
this.position += len;
} else {
assert this.buffer != null: "Buffer is null";
int toCopy = (int)Math.min(this.buffer.length - this.position, len);
assert b != null: "Passed buffer is null";
System.arraycopy(b, off, this.buffer, (int)this.position, toCopy);
this.position += toCopy;
// TODO verify these are +1 -1 right
if (toCopy < len) {
tailRecord(b, off + toCopy, len - toCopy);
}
}
} | java | private void tailRecord(byte[] b, int off, int len) throws IOException {
if(this.position >= this.buffer.length){
this.ensureDiskStream().write(b, off, len);
this.position += len;
} else {
assert this.buffer != null: "Buffer is null";
int toCopy = (int)Math.min(this.buffer.length - this.position, len);
assert b != null: "Passed buffer is null";
System.arraycopy(b, off, this.buffer, (int)this.position, toCopy);
this.position += toCopy;
// TODO verify these are +1 -1 right
if (toCopy < len) {
tailRecord(b, off + toCopy, len - toCopy);
}
}
} | [
"private",
"void",
"tailRecord",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"position",
">=",
"this",
".",
"buffer",
".",
"length",
")",
"{",
"this",
".",
"ensureDiskSt... | Record without digesting.
@param b Buffer to record.
@param off Offset into buffer at which to start recording.
@param len Length of buffer to record.
@exception IOException Failed write to backing file. | [
"Record",
"without",
"digesting",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/RecordingOutputStream.java#L388-L403 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java | SerializationUtils.fromJsonString | public static <T> T fromJsonString(String jsonString, Class<T> clazz, ClassLoader classLoader) {
if (jsonString == null) {
return null;
}
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
if (classLoader != null) {
Thread.currentThread().setContextClassLoader(classLoader);
}
try {
ObjectMapper mapper = poolMapper.borrowObject();
if (mapper != null) {
try {
return mapper.readValue(jsonString, clazz);
} finally {
poolMapper.returnObject(mapper);
}
}
throw new DeserializationException("No ObjectMapper instance avaialble!");
} catch (Exception e) {
throw e instanceof DeserializationException ? (DeserializationException) e
: new DeserializationException(e);
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
} | java | public static <T> T fromJsonString(String jsonString, Class<T> clazz, ClassLoader classLoader) {
if (jsonString == null) {
return null;
}
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
if (classLoader != null) {
Thread.currentThread().setContextClassLoader(classLoader);
}
try {
ObjectMapper mapper = poolMapper.borrowObject();
if (mapper != null) {
try {
return mapper.readValue(jsonString, clazz);
} finally {
poolMapper.returnObject(mapper);
}
}
throw new DeserializationException("No ObjectMapper instance avaialble!");
} catch (Exception e) {
throw e instanceof DeserializationException ? (DeserializationException) e
: new DeserializationException(e);
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fromJsonString",
"(",
"String",
"jsonString",
",",
"Class",
"<",
"T",
">",
"clazz",
",",
"ClassLoader",
"classLoader",
")",
"{",
"if",
"(",
"jsonString",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Clas... | Deserialize a JSON string, with custom class loader.
@param jsonString
@param clazz
@return | [
"Deserialize",
"a",
"JSON",
"string",
"with",
"custom",
"class",
"loader",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L657-L681 |
unbescape/unbescape | src/main/java/org/unbescape/json/JsonEscape.java | JsonEscape.escapeJsonMinimal | public static void escapeJsonMinimal(final char[] text, final int offset, final int len, final Writer writer)
throws IOException {
escapeJson(text, offset, len, writer,
JsonEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA,
JsonEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET);
} | java | public static void escapeJsonMinimal(final char[] text, final int offset, final int len, final Writer writer)
throws IOException {
escapeJson(text, offset, len, writer,
JsonEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA,
JsonEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET);
} | [
"public",
"static",
"void",
"escapeJsonMinimal",
"(",
"final",
"char",
"[",
"]",
"text",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"len",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeJson",
"(",
"text",
",",
"offset... | <p>
Perform a JSON level 1 (only basic set) <strong>escape</strong> operation
on a <tt>char[]</tt> input.
</p>
<p>
<em>Level 1</em> means this method will only escape the JSON basic escape set:
</p>
<ul>
<li>The <em>Single Escape Characters</em>:
<tt>\b</tt> (<tt>U+0008</tt>),
<tt>\t</tt> (<tt>U+0009</tt>),
<tt>\n</tt> (<tt>U+000A</tt>),
<tt>\f</tt> (<tt>U+000C</tt>),
<tt>\r</tt> (<tt>U+000D</tt>),
<tt>\"</tt> (<tt>U+0022</tt>),
<tt>\\</tt> (<tt>U+005C</tt>) and
<tt>\/</tt> (<tt>U+002F</tt>).
Note that <tt>\/</tt> is optional, and will only be used when the <tt>/</tt>
symbol appears after <tt><</tt>, as in <tt></</tt>. This is to avoid accidentally
closing <tt><script></tt> tags in HTML.
</li>
<li>
Two ranges of non-displayable, control characters (some of which are already part of the
<em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> (required
by the JSON spec) and <tt>U+007F</tt> to <tt>U+009F</tt> (additional).
</li>
</ul>
<p>
This method calls
{@link #escapeJson(char[], int, int, java.io.Writer, JsonEscapeType, JsonEscapeLevel)}
with the following preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link JsonEscapeType#SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA}</li>
<li><tt>level</tt>:
{@link JsonEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>char[]</tt> to be escaped.
@param offset the position in <tt>text</tt> at which the escape operation should start.
@param len the number of characters in <tt>text</tt> that should be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs | [
"<p",
">",
"Perform",
"a",
"JSON",
"level",
"1",
"(",
"only",
"basic",
"set",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"char",
"[]",
"<",
"/",
"tt",
">",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">"... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/json/JsonEscape.java#L725-L730 |
Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/block/AlluxioBlockStore.java | AlluxioBlockStore.getInStream | public BlockInStream getInStream(long blockId, InStreamOptions options) throws IOException {
return getInStream(blockId, options, ImmutableMap.of());
} | java | public BlockInStream getInStream(long blockId, InStreamOptions options) throws IOException {
return getInStream(blockId, options, ImmutableMap.of());
} | [
"public",
"BlockInStream",
"getInStream",
"(",
"long",
"blockId",
",",
"InStreamOptions",
"options",
")",
"throws",
"IOException",
"{",
"return",
"getInStream",
"(",
"blockId",
",",
"options",
",",
"ImmutableMap",
".",
"of",
"(",
")",
")",
";",
"}"
] | Gets a stream to read the data of a block. This method is primarily responsible for
determining the data source and type of data source. The latest BlockInfo will be fetched
from the master to ensure the locations are up to date.
@param blockId the id of the block to read
@param options the options associated with the read request
@return a stream which reads from the beginning of the block | [
"Gets",
"a",
"stream",
"to",
"read",
"the",
"data",
"of",
"a",
"block",
".",
"This",
"method",
"is",
"primarily",
"responsible",
"for",
"determining",
"the",
"data",
"source",
"and",
"type",
"of",
"data",
"source",
".",
"The",
"latest",
"BlockInfo",
"will"... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/block/AlluxioBlockStore.java#L148-L150 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java | Apptentive.register | public static void register(Application application, ApptentiveConfiguration configuration) {
if (application == null) {
throw new IllegalArgumentException("Application is null");
}
if (configuration == null) {
throw new IllegalArgumentException("Apptentive configuration is null");
}
try {
ApptentiveInternal.createInstance(application, configuration);
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while registering Apptentive SDK");
logException(e);
}
} | java | public static void register(Application application, ApptentiveConfiguration configuration) {
if (application == null) {
throw new IllegalArgumentException("Application is null");
}
if (configuration == null) {
throw new IllegalArgumentException("Apptentive configuration is null");
}
try {
ApptentiveInternal.createInstance(application, configuration);
} catch (Exception e) {
ApptentiveLog.e(e, "Exception while registering Apptentive SDK");
logException(e);
}
} | [
"public",
"static",
"void",
"register",
"(",
"Application",
"application",
",",
"ApptentiveConfiguration",
"configuration",
")",
"{",
"if",
"(",
"application",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Application is null\"",
")",
"... | Must be called from the {@link Application#onCreate()} method in the {@link Application} object defined in your app's manifest.
@param application Application object.
@param configuration Apptentive configuration containing SDK initialization data. | [
"Must",
"be",
"called",
"from",
"the",
"{"
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L119-L134 |
jOOQ/jOOR | jOOR/src/main/java/org/joor/Reflect.java | Reflect.isSimilarSignature | private boolean isSimilarSignature(Method possiblyMatchingMethod, String desiredMethodName, Class<?>[] desiredParamTypes) {
return possiblyMatchingMethod.getName().equals(desiredMethodName) && match(possiblyMatchingMethod.getParameterTypes(), desiredParamTypes);
} | java | private boolean isSimilarSignature(Method possiblyMatchingMethod, String desiredMethodName, Class<?>[] desiredParamTypes) {
return possiblyMatchingMethod.getName().equals(desiredMethodName) && match(possiblyMatchingMethod.getParameterTypes(), desiredParamTypes);
} | [
"private",
"boolean",
"isSimilarSignature",
"(",
"Method",
"possiblyMatchingMethod",
",",
"String",
"desiredMethodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"desiredParamTypes",
")",
"{",
"return",
"possiblyMatchingMethod",
".",
"getName",
"(",
")",
".",
"equal... | Determines if a method has a "similar" signature, especially if wrapping
primitive argument types would result in an exactly matching signature. | [
"Determines",
"if",
"a",
"method",
"has",
"a",
"similar",
"signature",
"especially",
"if",
"wrapping",
"primitive",
"argument",
"types",
"would",
"result",
"in",
"an",
"exactly",
"matching",
"signature",
"."
] | train | https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR/src/main/java/org/joor/Reflect.java#L647-L649 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/MapTileCircuitModel.java | MapTileCircuitModel.updateTile | private void updateTile(Tile tile, Tile neighbor, Circuit circuit)
{
final Iterator<TileRef> iterator = getTiles(circuit).iterator();
while (iterator.hasNext())
{
final TileRef newTile = iterator.next();
if (mapGroup.getGroup(newTile).equals(mapGroup.getGroup(tile)))
{
map.setTile(map.createTile(newTile.getSheet(), newTile.getNumber(), neighbor.getX(), neighbor.getY()));
break;
}
}
} | java | private void updateTile(Tile tile, Tile neighbor, Circuit circuit)
{
final Iterator<TileRef> iterator = getTiles(circuit).iterator();
while (iterator.hasNext())
{
final TileRef newTile = iterator.next();
if (mapGroup.getGroup(newTile).equals(mapGroup.getGroup(tile)))
{
map.setTile(map.createTile(newTile.getSheet(), newTile.getNumber(), neighbor.getX(), neighbor.getY()));
break;
}
}
} | [
"private",
"void",
"updateTile",
"(",
"Tile",
"tile",
",",
"Tile",
"neighbor",
",",
"Circuit",
"circuit",
")",
"{",
"final",
"Iterator",
"<",
"TileRef",
">",
"iterator",
"=",
"getTiles",
"(",
"circuit",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
... | Update tile with new representation.
@param tile The tile placed.
@param neighbor The tile to update.
@param circuit The circuit to set. | [
"Update",
"tile",
"with",
"new",
"representation",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/MapTileCircuitModel.java#L156-L168 |
sriharshachilakapati/WebGL4J | webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java | WebGL10.glBindFramebuffer | public static void glBindFramebuffer(int target, int frameBuffer)
{
checkContextCompatibility();
nglBindFramebuffer(target, WebGLObjectMap.get().toFramebuffer(frameBuffer));
} | java | public static void glBindFramebuffer(int target, int frameBuffer)
{
checkContextCompatibility();
nglBindFramebuffer(target, WebGLObjectMap.get().toFramebuffer(frameBuffer));
} | [
"public",
"static",
"void",
"glBindFramebuffer",
"(",
"int",
"target",
",",
"int",
"frameBuffer",
")",
"{",
"checkContextCompatibility",
"(",
")",
";",
"nglBindFramebuffer",
"(",
"target",
",",
"WebGLObjectMap",
".",
"get",
"(",
")",
".",
"toFramebuffer",
"(",
... | <p>{@code glBindFramebuffer} binds the framebuffer object with name framebuffer to the framebuffer target
specified by target. target must be {@link #GL_FRAMEBUFFER}. If a framebuffer object is bound, it becomes the
target for rendering or readback operations, respectively, until it is deleted or another framebuffer is bound to
the corresponding bind point.</p>
<p>{@link #GL_INVALID_ENUM} is generated if target is not {@link #GL_FRAMEBUFFER}.</p>
<p>{@link #GL_INVALID_OPERATION} is generated if framebuffer is not zero or the name of a framebuffer previously
returned from a call to {@link #glCreateFramebuffer()}.
@param target Specifies the framebuffer target of the binding operation.
@param frameBuffer Specifies the name of the framebuffer object to bind. | [
"<p",
">",
"{",
"@code",
"glBindFramebuffer",
"}",
"binds",
"the",
"framebuffer",
"object",
"with",
"name",
"framebuffer",
"to",
"the",
"framebuffer",
"target",
"specified",
"by",
"target",
".",
"target",
"must",
"be",
"{",
"@link",
"#GL_FRAMEBUFFER",
"}",
"."... | train | https://github.com/sriharshachilakapati/WebGL4J/blob/7daa425300b08b338b50cef2935289849c92d415/webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java#L597-L601 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerDispatcher.java | ConsumerDispatcher.eventPostCommitAdd | protected void eventPostCommitAdd(SIMPMessage msg, TransactionCommon transaction)
throws SIDiscriminatorSyntaxException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "eventPostCommitAdd", new Object[] { msg, transaction });
//if receive allowed, try to hand the message on to any ready consumer points
//at this point it must be in both the IH and CD item/reference streams
internalPut(msg, transaction, null, true, true, true);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "eventPostCommitAdd");
} | java | protected void eventPostCommitAdd(SIMPMessage msg, TransactionCommon transaction)
throws SIDiscriminatorSyntaxException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "eventPostCommitAdd", new Object[] { msg, transaction });
//if receive allowed, try to hand the message on to any ready consumer points
//at this point it must be in both the IH and CD item/reference streams
internalPut(msg, transaction, null, true, true, true);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "eventPostCommitAdd");
} | [
"protected",
"void",
"eventPostCommitAdd",
"(",
"SIMPMessage",
"msg",
",",
"TransactionCommon",
"transaction",
")",
"throws",
"SIDiscriminatorSyntaxException",
",",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc"... | Called when a message receives an eventCommittedAdd from the messageStore. i.e.
a message has been transactionally committed after being put in the messageStore.
@param msg The message which has been committed
@param transaction The transaction used to commit the message
@throws SIStoreException Thrown if there is ANY problem
@see com.ibm.ws.sib.store.AbstractItem#eventCommittedAdd(com.ibm.ws.sib.msgstore.Transaction) | [
"Called",
"when",
"a",
"message",
"receives",
"an",
"eventCommittedAdd",
"from",
"the",
"messageStore",
".",
"i",
".",
"e",
".",
"a",
"message",
"has",
"been",
"transactionally",
"committed",
"after",
"being",
"put",
"in",
"the",
"messageStore",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerDispatcher.java#L2350-L2362 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/InstanceId.java | InstanceId.of | public static InstanceId of(String zone, String instance) {
return new InstanceId(null, zone, instance);
} | java | public static InstanceId of(String zone, String instance) {
return new InstanceId(null, zone, instance);
} | [
"public",
"static",
"InstanceId",
"of",
"(",
"String",
"zone",
",",
"String",
"instance",
")",
"{",
"return",
"new",
"InstanceId",
"(",
"null",
",",
"zone",
",",
"instance",
")",
";",
"}"
] | Returns an instance identity given the zone and instance names. The instance name must be 1-63
characters long and comply with RFC1035. Specifically, the name must match the regular
expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a
lowercase letter, and all following characters must be a dash, lowercase letter, or digit,
except the last character, which cannot be a dash.
@see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a> | [
"Returns",
"an",
"instance",
"identity",
"given",
"the",
"zone",
"and",
"instance",
"names",
".",
"The",
"instance",
"name",
"must",
"be",
"1",
"-",
"63",
"characters",
"long",
"and",
"comply",
"with",
"RFC1035",
".",
"Specifically",
"the",
"name",
"must",
... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/InstanceId.java#L140-L142 |
lucee/Lucee | core/src/main/java/lucee/commons/lang/StringUtil.java | StringUtil.ltrim | public static String ltrim(String str, String defaultValue) {
if (str == null) return defaultValue;
int len = str.length();
int st = 0;
while ((st < len) && (str.charAt(st) <= ' ')) {
st++;
}
return ((st > 0)) ? str.substring(st) : str;
} | java | public static String ltrim(String str, String defaultValue) {
if (str == null) return defaultValue;
int len = str.length();
int st = 0;
while ((st < len) && (str.charAt(st) <= ' ')) {
st++;
}
return ((st > 0)) ? str.substring(st) : str;
} | [
"public",
"static",
"String",
"ltrim",
"(",
"String",
"str",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"defaultValue",
";",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"int",
"st",
"=",
"0",
... | This function returns a string with whitespace stripped from the beginning of str
@param str String to clean
@return cleaned String | [
"This",
"function",
"returns",
"a",
"string",
"with",
"whitespace",
"stripped",
"from",
"the",
"beginning",
"of",
"str"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L483-L492 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/sc/sc_stats.java | sc_stats.get_nitro_response | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
sc_stats[] resources = new sc_stats[1];
sc_response result = (sc_response) service.get_payload_formatter().string_to_resource(sc_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.sc;
return resources;
} | java | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
sc_stats[] resources = new sc_stats[1];
sc_response result = (sc_response) service.get_payload_formatter().string_to_resource(sc_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.sc;
return resources;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"sc_stats",
"[",
"]",
"resources",
"=",
"new",
"sc_stats",
"[",
"1",
"]",
";",
"sc_response",
"result",
"... | <pre>
converts nitro response into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"converts",
"nitro",
"response",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/sc/sc_stats.java#L257-L276 |
finmath/finmath-lib | src/main/java/net/finmath/modelling/productfactory/InterestRateMonteCarloProductFactory.java | InterestRateMonteCarloProductFactory.constructLiborIndex | private static AbstractIndex constructLiborIndex(String forwardCurveName, Schedule schedule) {
if(forwardCurveName != null) {
//determine average fixing offset and period length
double fixingOffset = 0;
double periodLength = 0;
for(int i = 0; i < schedule.getNumberOfPeriods(); i++) {
fixingOffset *= ((double) i) / (i+1);
fixingOffset += (schedule.getPeriodStart(i) - schedule.getFixing(i)) / (i+1);
periodLength *= ((double) i) / (i+1);
periodLength += schedule.getPeriodLength(i) / (i+1);
}
return new LIBORIndex(forwardCurveName, fixingOffset, periodLength);
} else {
return null;
}
} | java | private static AbstractIndex constructLiborIndex(String forwardCurveName, Schedule schedule) {
if(forwardCurveName != null) {
//determine average fixing offset and period length
double fixingOffset = 0;
double periodLength = 0;
for(int i = 0; i < schedule.getNumberOfPeriods(); i++) {
fixingOffset *= ((double) i) / (i+1);
fixingOffset += (schedule.getPeriodStart(i) - schedule.getFixing(i)) / (i+1);
periodLength *= ((double) i) / (i+1);
periodLength += schedule.getPeriodLength(i) / (i+1);
}
return new LIBORIndex(forwardCurveName, fixingOffset, periodLength);
} else {
return null;
}
} | [
"private",
"static",
"AbstractIndex",
"constructLiborIndex",
"(",
"String",
"forwardCurveName",
",",
"Schedule",
"schedule",
")",
"{",
"if",
"(",
"forwardCurveName",
"!=",
"null",
")",
"{",
"//determine average fixing offset and period length",
"double",
"fixingOffset",
"... | Construct a Libor index for a given curve and schedule.
@param forwardCurveName
@param schedule
@return The Libor index or null, if forwardCurveName is null. | [
"Construct",
"a",
"Libor",
"index",
"for",
"a",
"given",
"curve",
"and",
"schedule",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/modelling/productfactory/InterestRateMonteCarloProductFactory.java#L88-L108 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java | CommerceCountryPersistenceImpl.fetchByUUID_G | @Override
public CommerceCountry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | java | @Override
public CommerceCountry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CommerceCountry",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the commerce country where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce country, or <code>null</code> if a matching commerce country could not be found | [
"Returns",
"the",
"commerce",
"country",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"cache",
... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L701-L704 |
restfb/restfb | src/main/java/com/restfb/BaseFacebookClient.java | BaseFacebookClient.urlEncodedValueForParameterName | protected String urlEncodedValueForParameterName(String name, String value) {
// Special handling for access_token -
// '%7C' is the pipe character and will be present in any access_token
// parameter that's already URL-encoded. If we see this combination, don't
// URL-encode. Otherwise, URL-encode as normal.
return ACCESS_TOKEN_PARAM_NAME.equals(name) && value.contains("%7C") ? value : urlEncode(value);
} | java | protected String urlEncodedValueForParameterName(String name, String value) {
// Special handling for access_token -
// '%7C' is the pipe character and will be present in any access_token
// parameter that's already URL-encoded. If we see this combination, don't
// URL-encode. Otherwise, URL-encode as normal.
return ACCESS_TOKEN_PARAM_NAME.equals(name) && value.contains("%7C") ? value : urlEncode(value);
} | [
"protected",
"String",
"urlEncodedValueForParameterName",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"// Special handling for access_token -",
"// '%7C' is the pipe character and will be present in any access_token",
"// parameter that's already URL-encoded. If we see this co... | Gets the URL-encoded version of the given {@code value} for the parameter named {@code name}.
<p>
Includes special-case handling for access token parameters where we check if the token is already URL-encoded - if
so, we don't encode again. All other parameter types are always URL-encoded.
@param name
The name of the parameter whose value should be URL-encoded and returned.
@param value
The value of the parameter which should be URL-encoded and returned.
@return The URL-encoded version of the given {@code value}. | [
"Gets",
"the",
"URL",
"-",
"encoded",
"version",
"of",
"the",
"given",
"{",
"@code",
"value",
"}",
"for",
"the",
"parameter",
"named",
"{",
"@code",
"name",
"}",
".",
"<p",
">",
"Includes",
"special",
"-",
"case",
"handling",
"for",
"access",
"token",
... | train | https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/BaseFacebookClient.java#L106-L112 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_config_diff.java | ns_config_diff.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_config_diff_responses result = (ns_config_diff_responses) service.get_payload_formatter().string_to_resource(ns_config_diff_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_config_diff_response_array);
}
ns_config_diff[] result_ns_config_diff = new ns_config_diff[result.ns_config_diff_response_array.length];
for(int i = 0; i < result.ns_config_diff_response_array.length; i++)
{
result_ns_config_diff[i] = result.ns_config_diff_response_array[i].ns_config_diff[0];
}
return result_ns_config_diff;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_config_diff_responses result = (ns_config_diff_responses) service.get_payload_formatter().string_to_resource(ns_config_diff_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_config_diff_response_array);
}
ns_config_diff[] result_ns_config_diff = new ns_config_diff[result.ns_config_diff_response_array.length];
for(int i = 0; i < result.ns_config_diff_response_array.length; i++)
{
result_ns_config_diff[i] = result.ns_config_diff_response_array[i].ns_config_diff[0];
}
return result_ns_config_diff;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"ns_config_diff_responses",
"result",
"=",
"(",
"ns_config_diff_responses",
")",
"service",
".",
"get_payload_... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_config_diff.java#L227-L244 |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java | StreamUtils.copyReaderToStream | public static void copyReaderToStream( Reader in, OutputStream out, String encoding, boolean close )
throws IOException
{
OutputStreamWriter writer = new OutputStreamWriter( out, encoding );
copyReaderToWriter( in, writer, close );
} | java | public static void copyReaderToStream( Reader in, OutputStream out, String encoding, boolean close )
throws IOException
{
OutputStreamWriter writer = new OutputStreamWriter( out, encoding );
copyReaderToWriter( in, writer, close );
} | [
"public",
"static",
"void",
"copyReaderToStream",
"(",
"Reader",
"in",
",",
"OutputStream",
"out",
",",
"String",
"encoding",
",",
"boolean",
"close",
")",
"throws",
"IOException",
"{",
"OutputStreamWriter",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"out",
... | Copies the content of the Reader to the provided OutputStream using the provided encoding.
@param in The character data to convert.
@param out The OutputStream to send the data to.
@param encoding The character encoding that should be used for the byte stream.
@param close true if the Reader and OutputStream should be closed after the completion.
@throws IOException If an underlying I/O Exception occurs. | [
"Copies",
"the",
"content",
"of",
"the",
"Reader",
"to",
"the",
"provided",
"OutputStream",
"using",
"the",
"provided",
"encoding",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L299-L304 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getCreateUploadSessionRequest | public BoxRequestsFile.CreateUploadSession getCreateUploadSessionRequest(InputStream is, String fileName, long fileSize, String folderId) {
return new BoxRequestsFile.CreateUploadSession(is, fileName, fileSize, folderId, getUploadSessionForNewFileUrl(), mSession);
} | java | public BoxRequestsFile.CreateUploadSession getCreateUploadSessionRequest(InputStream is, String fileName, long fileSize, String folderId) {
return new BoxRequestsFile.CreateUploadSession(is, fileName, fileSize, folderId, getUploadSessionForNewFileUrl(), mSession);
} | [
"public",
"BoxRequestsFile",
".",
"CreateUploadSession",
"getCreateUploadSessionRequest",
"(",
"InputStream",
"is",
",",
"String",
"fileName",
",",
"long",
"fileSize",
",",
"String",
"folderId",
")",
"{",
"return",
"new",
"BoxRequestsFile",
".",
"CreateUploadSession",
... | Gets a request that creates an upload session for uploading a new file
@param is InputStream for the file to be uplaoded
@param fileName the file name for the file to be created/uploaded
@param fileSize the inputStream size (or the origin file size)
@param folderId the folder ID where this file will be uploaded
@return request to create an upload session for uploading a new file | [
"Gets",
"a",
"request",
"that",
"creates",
"an",
"upload",
"session",
"for",
"uploading",
"a",
"new",
"file"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L592-L594 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.registerBlockListener | public String registerBlockListener(BlockListener listener) throws InvalidArgumentException {
if (shutdown) {
throw new InvalidArgumentException(format("Channel %s has been shutdown.", name));
}
if (null == listener) {
throw new InvalidArgumentException("Listener parameter is null.");
}
String handle = new BL(listener).getHandle();
logger.trace(format("Register event BlockEvent listener %s", handle));
return handle;
} | java | public String registerBlockListener(BlockListener listener) throws InvalidArgumentException {
if (shutdown) {
throw new InvalidArgumentException(format("Channel %s has been shutdown.", name));
}
if (null == listener) {
throw new InvalidArgumentException("Listener parameter is null.");
}
String handle = new BL(listener).getHandle();
logger.trace(format("Register event BlockEvent listener %s", handle));
return handle;
} | [
"public",
"String",
"registerBlockListener",
"(",
"BlockListener",
"listener",
")",
"throws",
"InvalidArgumentException",
"{",
"if",
"(",
"shutdown",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"format",
"(",
"\"Channel %s has been shutdown.\"",
",",
"nam... | Register a block listener.
@param listener function with single argument with type {@link BlockEvent}
@return The handle of the registered block listener.
@throws InvalidArgumentException if the channel is shutdown. | [
"Register",
"a",
"block",
"listener",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L5489-L5505 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/ZoneId.java | ZoneId.getDisplayName | public String getDisplayName(TextStyle style, Locale locale) {
return new DateTimeFormatterBuilder().appendZoneText(style).toFormatter(locale).format(new DefaultInterfaceTemporalAccessor() {
@Override
public boolean isSupported(TemporalField field) {
return false;
}
@Override
public long getLong(TemporalField field) {
throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
@SuppressWarnings("unchecked")
@Override
public <R> R query(TemporalQuery<R> query) {
if (query == TemporalQueries.zoneId()) {
return (R) ZoneId.this;
}
return super.query(query);
}
});
} | java | public String getDisplayName(TextStyle style, Locale locale) {
return new DateTimeFormatterBuilder().appendZoneText(style).toFormatter(locale).format(new DefaultInterfaceTemporalAccessor() {
@Override
public boolean isSupported(TemporalField field) {
return false;
}
@Override
public long getLong(TemporalField field) {
throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
@SuppressWarnings("unchecked")
@Override
public <R> R query(TemporalQuery<R> query) {
if (query == TemporalQueries.zoneId()) {
return (R) ZoneId.this;
}
return super.query(query);
}
});
} | [
"public",
"String",
"getDisplayName",
"(",
"TextStyle",
"style",
",",
"Locale",
"locale",
")",
"{",
"return",
"new",
"DateTimeFormatterBuilder",
"(",
")",
".",
"appendZoneText",
"(",
"style",
")",
".",
"toFormatter",
"(",
"locale",
")",
".",
"format",
"(",
"... | Gets the textual representation of the zone, such as 'British Time' or
'+02:00'.
<p>
This returns the textual name used to identify the time-zone ID,
suitable for presentation to the user.
The parameters control the style of the returned text and the locale.
<p>
If no textual mapping is found then the {@link #getId() full ID} is returned.
@param style the length of the text required, not null
@param locale the locale to use, not null
@return the text value of the zone, not null | [
"Gets",
"the",
"textual",
"representation",
"of",
"the",
"zone",
"such",
"as",
"British",
"Time",
"or",
"+",
"02",
":",
"00",
".",
"<p",
">",
"This",
"returns",
"the",
"textual",
"name",
"used",
"to",
"identify",
"the",
"time",
"-",
"zone",
"ID",
"suit... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/ZoneId.java#L474-L493 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java | ClusterJoinManager.sendJoinRequest | public boolean sendJoinRequest(Address toAddress, boolean withCredentials) {
if (toAddress == null) {
toAddress = clusterService.getMasterAddress();
}
JoinRequestOp joinRequest = new JoinRequestOp(node.createJoinRequest(withCredentials));
return nodeEngine.getOperationService().send(joinRequest, toAddress);
} | java | public boolean sendJoinRequest(Address toAddress, boolean withCredentials) {
if (toAddress == null) {
toAddress = clusterService.getMasterAddress();
}
JoinRequestOp joinRequest = new JoinRequestOp(node.createJoinRequest(withCredentials));
return nodeEngine.getOperationService().send(joinRequest, toAddress);
} | [
"public",
"boolean",
"sendJoinRequest",
"(",
"Address",
"toAddress",
",",
"boolean",
"withCredentials",
")",
"{",
"if",
"(",
"toAddress",
"==",
"null",
")",
"{",
"toAddress",
"=",
"clusterService",
".",
"getMasterAddress",
"(",
")",
";",
"}",
"JoinRequestOp",
... | Send join request to {@code toAddress}.
@param toAddress the currently known master address.
@param withCredentials use cluster credentials
@return {@code true} if join request was sent successfully, otherwise {@code false}. | [
"Send",
"join",
"request",
"to",
"{",
"@code",
"toAddress",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java#L446-L452 |
guardtime/ksi-java-sdk | ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java | AbstractApacheHttpClient.createProxyRoutePlanner | private DefaultProxyRoutePlanner createProxyRoutePlanner(HttpSettings settings, HttpAsyncClientBuilder httpClientBuilder) {
HttpHost proxy = new HttpHost(settings.getProxyUrl().getHost(), settings.getProxyUrl().getPort());
if (settings.getProxyUser() != null) {
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
String proxyUser = settings.getProxyUser();
String proxyPassword = settings.getProxyPassword();
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(proxyUser, proxyPassword);
credentialsProvider.setCredentials(new AuthScope(proxy), credentials);
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
return new DefaultProxyRoutePlanner(proxy);
} | java | private DefaultProxyRoutePlanner createProxyRoutePlanner(HttpSettings settings, HttpAsyncClientBuilder httpClientBuilder) {
HttpHost proxy = new HttpHost(settings.getProxyUrl().getHost(), settings.getProxyUrl().getPort());
if (settings.getProxyUser() != null) {
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
String proxyUser = settings.getProxyUser();
String proxyPassword = settings.getProxyPassword();
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(proxyUser, proxyPassword);
credentialsProvider.setCredentials(new AuthScope(proxy), credentials);
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
return new DefaultProxyRoutePlanner(proxy);
} | [
"private",
"DefaultProxyRoutePlanner",
"createProxyRoutePlanner",
"(",
"HttpSettings",
"settings",
",",
"HttpAsyncClientBuilder",
"httpClientBuilder",
")",
"{",
"HttpHost",
"proxy",
"=",
"new",
"HttpHost",
"(",
"settings",
".",
"getProxyUrl",
"(",
")",
".",
"getHost",
... | Creates default proxy route planner.
@param settings
settings to use.
@param httpClientBuilder
http client builder.
@return Instance of {@link DefaultProxyRoutePlanner}. | [
"Creates",
"default",
"proxy",
"route",
"planner",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java#L153-L164 |
aoindustries/aocode-public | src/main/java/com/aoindustries/io/NativeToUnixWriter.java | NativeToUnixWriter.getInstance | public static Writer getInstance(Writer out) {
// Already in Unix format, no conversion necessary
if(UNIX_EOL.equals(EOL)) return out;
// Use FindReplaceWriter
return new FindReplaceWriter(out, EOL, UNIX_EOL);
} | java | public static Writer getInstance(Writer out) {
// Already in Unix format, no conversion necessary
if(UNIX_EOL.equals(EOL)) return out;
// Use FindReplaceWriter
return new FindReplaceWriter(out, EOL, UNIX_EOL);
} | [
"public",
"static",
"Writer",
"getInstance",
"(",
"Writer",
"out",
")",
"{",
"// Already in Unix format, no conversion necessary",
"if",
"(",
"UNIX_EOL",
".",
"equals",
"(",
"EOL",
")",
")",
"return",
"out",
";",
"// Use FindReplaceWriter",
"return",
"new",
"FindRep... | Gets an instance of the Writer that performs the conversion.
The implementation may be optimized for common platforms. | [
"Gets",
"an",
"instance",
"of",
"the",
"Writer",
"that",
"performs",
"the",
"conversion",
".",
"The",
"implementation",
"may",
"be",
"optimized",
"for",
"common",
"platforms",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/NativeToUnixWriter.java#L54-L59 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/DocRootTaglet.java | DocRootTaglet.getTagletOutput | public Content getTagletOutput(Element holder, DocTree tag, TagletWriter writer) {
return writer.getDocRootOutput();
} | java | public Content getTagletOutput(Element holder, DocTree tag, TagletWriter writer) {
return writer.getDocRootOutput();
} | [
"public",
"Content",
"getTagletOutput",
"(",
"Element",
"holder",
",",
"DocTree",
"tag",
",",
"TagletWriter",
"writer",
")",
"{",
"return",
"writer",
".",
"getDocRootOutput",
"(",
")",
";",
"}"
] | Given a <code>Doc</code> object, check if it holds any tags of
this type. If it does, return the string representing the output.
If it does not, return null.
@param holder
@param tag a tag representing the custom tag.
@param writer a {@link TagletWriter} Taglet writer.
@return the string representation of this <code>Tag</code>. | [
"Given",
"a",
"<code",
">",
"Doc<",
"/",
"code",
">",
"object",
"check",
"if",
"it",
"holds",
"any",
"tags",
"of",
"this",
"type",
".",
"If",
"it",
"does",
"return",
"the",
"string",
"representing",
"the",
"output",
".",
"If",
"it",
"does",
"not",
"r... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/DocRootTaglet.java#L68-L70 |
icode/ameba | src/main/java/ameba/message/internal/MessageHelper.java | MessageHelper.getHeaderString | public static String getHeaderString(MultivaluedMap<String, Object> headers, String name) {
return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance());
} | java | public static String getHeaderString(MultivaluedMap<String, Object> headers, String name) {
return HeaderUtils.asHeaderString(headers.get(name), RuntimeDelegate.getInstance());
} | [
"public",
"static",
"String",
"getHeaderString",
"(",
"MultivaluedMap",
"<",
"String",
",",
"Object",
">",
"headers",
",",
"String",
"name",
")",
"{",
"return",
"HeaderUtils",
".",
"asHeaderString",
"(",
"headers",
".",
"get",
"(",
"name",
")",
",",
"Runtime... | <p>getHeaderString.</p>
@param headers a {@link javax.ws.rs.core.MultivaluedMap} object.
@param name a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"<p",
">",
"getHeaderString",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/message/internal/MessageHelper.java#L77-L79 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.extractTimeUnit | private TimeUnit extractTimeUnit(String name, String defaultValue) {
String value = getString(name, defaultValue);
try {
final String[] s = value.split(" ", 2);
return TimeUnit.valueOf(s[1].trim().toUpperCase());
} catch (Exception e) {
throw new PippoRuntimeException("{} must have format '<n> <TimeUnit>' where <TimeUnit> is one of 'MILLISECONDS', 'SECONDS', 'MINUTES', 'HOURS', 'DAYS'", name);
}
} | java | private TimeUnit extractTimeUnit(String name, String defaultValue) {
String value = getString(name, defaultValue);
try {
final String[] s = value.split(" ", 2);
return TimeUnit.valueOf(s[1].trim().toUpperCase());
} catch (Exception e) {
throw new PippoRuntimeException("{} must have format '<n> <TimeUnit>' where <TimeUnit> is one of 'MILLISECONDS', 'SECONDS', 'MINUTES', 'HOURS', 'DAYS'", name);
}
} | [
"private",
"TimeUnit",
"extractTimeUnit",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"defaultValue",
")",
";",
"try",
"{",
"final",
"String",
"[",
"]",
"s",
"=",
"value",
".",
"s... | Extracts the TimeUnit from the name.
@param name
@param defaultValue
@return the extracted TimeUnit | [
"Extracts",
"the",
"TimeUnit",
"from",
"the",
"name",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L985-L993 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.setUsersOrganizationalUnit | public void setUsersOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsUser user)
throws CmsException {
if (!getGroupsOfUser(dbc, user.getName(), false).isEmpty()) {
throw new CmsDbConsistencyException(
Messages.get().container(Messages.ERR_ORGUNIT_MOVE_USER_2, orgUnit.getName(), user.getName()));
}
// move the principal
getUserDriver(dbc).setUsersOrganizationalUnit(dbc, orgUnit, user);
// remove the principal from cache
m_monitor.clearUserCache(user);
if (!dbc.getProjectId().isNullUUID()) {
// user modified event is not needed
return;
}
// fire user modified event
Map<String, Object> eventData = new HashMap<String, Object>();
eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString());
eventData.put(I_CmsEventListener.KEY_OU_NAME, user.getOuFqn());
eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_SET_OU);
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData));
} | java | public void setUsersOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsUser user)
throws CmsException {
if (!getGroupsOfUser(dbc, user.getName(), false).isEmpty()) {
throw new CmsDbConsistencyException(
Messages.get().container(Messages.ERR_ORGUNIT_MOVE_USER_2, orgUnit.getName(), user.getName()));
}
// move the principal
getUserDriver(dbc).setUsersOrganizationalUnit(dbc, orgUnit, user);
// remove the principal from cache
m_monitor.clearUserCache(user);
if (!dbc.getProjectId().isNullUUID()) {
// user modified event is not needed
return;
}
// fire user modified event
Map<String, Object> eventData = new HashMap<String, Object>();
eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString());
eventData.put(I_CmsEventListener.KEY_OU_NAME, user.getOuFqn());
eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_SET_OU);
OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData));
} | [
"public",
"void",
"setUsersOrganizationalUnit",
"(",
"CmsDbContext",
"dbc",
",",
"CmsOrganizationalUnit",
"orgUnit",
",",
"CmsUser",
"user",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"!",
"getGroupsOfUser",
"(",
"dbc",
",",
"user",
".",
"getName",
"(",
")",... | Moves an user to the given organizational unit.<p>
@param dbc the current db context
@param orgUnit the organizational unit to add the resource to
@param user the user that is to be moved to the organizational unit
@throws CmsException if something goes wrong
@see org.opencms.security.CmsOrgUnitManager#setUsersOrganizationalUnit(CmsObject, String, String) | [
"Moves",
"an",
"user",
"to",
"the",
"given",
"organizational",
"unit",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L9038-L9061 |
legsem/legstar-core2 | legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/antlr/RecognizerErrorHandler.java | RecognizerErrorHandler.getErrorMessage | public static String getErrorMessage(
final Logger log,
final BaseRecognizer recognizer,
final RecognitionException e,
final String superMessage,
final String[] tokenNames) {
if (log.isDebugEnabled()) {
List < ? > stack = BaseRecognizer.getRuleInvocationStack(
e, recognizer.getClass().getSuperclass().getName());
String debugMsg = recognizer.getErrorHeader(e)
+ " " + e.getClass().getSimpleName()
+ ": " + superMessage
+ ":";
if (e instanceof NoViableAltException) {
NoViableAltException nvae = (NoViableAltException) e;
debugMsg += " (decision=" + nvae.decisionNumber
+ " state=" + nvae.stateNumber + ")"
+ " decision=<<" + nvae.grammarDecisionDescription + ">>";
} else if (e instanceof UnwantedTokenException) {
UnwantedTokenException ute = (UnwantedTokenException) e;
debugMsg += " (unexpected token=" + toString(ute.getUnexpectedToken(), tokenNames) + ")";
} else if (e instanceof EarlyExitException) {
EarlyExitException eea = (EarlyExitException) e;
debugMsg += " (decision=" + eea.decisionNumber + ")";
}
debugMsg += " ruleStack=" + stack.toString();
log.debug(debugMsg);
}
return makeUserMsg(e, superMessage);
} | java | public static String getErrorMessage(
final Logger log,
final BaseRecognizer recognizer,
final RecognitionException e,
final String superMessage,
final String[] tokenNames) {
if (log.isDebugEnabled()) {
List < ? > stack = BaseRecognizer.getRuleInvocationStack(
e, recognizer.getClass().getSuperclass().getName());
String debugMsg = recognizer.getErrorHeader(e)
+ " " + e.getClass().getSimpleName()
+ ": " + superMessage
+ ":";
if (e instanceof NoViableAltException) {
NoViableAltException nvae = (NoViableAltException) e;
debugMsg += " (decision=" + nvae.decisionNumber
+ " state=" + nvae.stateNumber + ")"
+ " decision=<<" + nvae.grammarDecisionDescription + ">>";
} else if (e instanceof UnwantedTokenException) {
UnwantedTokenException ute = (UnwantedTokenException) e;
debugMsg += " (unexpected token=" + toString(ute.getUnexpectedToken(), tokenNames) + ")";
} else if (e instanceof EarlyExitException) {
EarlyExitException eea = (EarlyExitException) e;
debugMsg += " (decision=" + eea.decisionNumber + ")";
}
debugMsg += " ruleStack=" + stack.toString();
log.debug(debugMsg);
}
return makeUserMsg(e, superMessage);
} | [
"public",
"static",
"String",
"getErrorMessage",
"(",
"final",
"Logger",
"log",
",",
"final",
"BaseRecognizer",
"recognizer",
",",
"final",
"RecognitionException",
"e",
",",
"final",
"String",
"superMessage",
",",
"final",
"String",
"[",
"]",
"tokenNames",
")",
... | Format an error message as expected by ANTLR. It is basically the
same error message that ANTL BaseRecognizer generates with some
additional data.
Also used to log debugging information.
@param log the logger to use at debug time
@param recognizer the lexer or parser who generated the error
@param e the exception that occured
@param superMessage the error message that the super class generated
@param tokenNames list of token names
@return a formatted error message | [
"Format",
"an",
"error",
"message",
"as",
"expected",
"by",
"ANTLR",
".",
"It",
"is",
"basically",
"the",
"same",
"error",
"message",
"that",
"ANTL",
"BaseRecognizer",
"generates",
"with",
"some",
"additional",
"data",
".",
"Also",
"used",
"to",
"log",
"debu... | train | https://github.com/legsem/legstar-core2/blob/f74d25d5b2b21a2ebaaaf2162b3fb7138dca40c6/legstar-cob2xsd/src/main/java/com/legstar/cob2xsd/antlr/RecognizerErrorHandler.java#L51-L82 |
json-path/JsonPath | json-path/src/main/java/com/jayway/jsonpath/Criteria.java | Criteria.and | public Criteria and(String key) {
checkComplete();
return new Criteria(this.criteriaChain, ValueNode.toValueNode(prefixPath(key)));
} | java | public Criteria and(String key) {
checkComplete();
return new Criteria(this.criteriaChain, ValueNode.toValueNode(prefixPath(key)));
} | [
"public",
"Criteria",
"and",
"(",
"String",
"key",
")",
"{",
"checkComplete",
"(",
")",
";",
"return",
"new",
"Criteria",
"(",
"this",
".",
"criteriaChain",
",",
"ValueNode",
".",
"toValueNode",
"(",
"prefixPath",
"(",
"key",
")",
")",
")",
";",
"}"
] | Static factory method to create a Criteria using the provided key
@param key ads new filed to criteria
@return the criteria builder | [
"Static",
"factory",
"method",
"to",
"create",
"a",
"Criteria",
"using",
"the",
"provided",
"key"
] | train | https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/Criteria.java#L109-L112 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contract/config/ConfigurationBuilder.java | ConfigurationBuilder.getConfiguration | public TransportsConfiguration getConfiguration(String configFileLocation) {
TransportsConfiguration transportsConfiguration;
File file = new File(configFileLocation);
if (file.exists()) {
try (Reader in = new InputStreamReader(new FileInputStream(file), StandardCharsets.ISO_8859_1)) {
Yaml yaml = new Yaml(new CustomClassLoaderConstructor
(TransportsConfiguration.class, TransportsConfiguration.class.getClassLoader()));
yaml.setBeanAccess(BeanAccess.FIELD);
transportsConfiguration = yaml.loadAs(in, TransportsConfiguration.class);
} catch (IOException e) {
throw new RuntimeException(
"Error while loading " + configFileLocation + " configuration file", e);
}
} else { // return a default config
LOG.warn("Netty transport configuration file not found in: {} ,hence using default configuration",
configFileLocation);
transportsConfiguration = new TransportsConfiguration();
}
return transportsConfiguration;
} | java | public TransportsConfiguration getConfiguration(String configFileLocation) {
TransportsConfiguration transportsConfiguration;
File file = new File(configFileLocation);
if (file.exists()) {
try (Reader in = new InputStreamReader(new FileInputStream(file), StandardCharsets.ISO_8859_1)) {
Yaml yaml = new Yaml(new CustomClassLoaderConstructor
(TransportsConfiguration.class, TransportsConfiguration.class.getClassLoader()));
yaml.setBeanAccess(BeanAccess.FIELD);
transportsConfiguration = yaml.loadAs(in, TransportsConfiguration.class);
} catch (IOException e) {
throw new RuntimeException(
"Error while loading " + configFileLocation + " configuration file", e);
}
} else { // return a default config
LOG.warn("Netty transport configuration file not found in: {} ,hence using default configuration",
configFileLocation);
transportsConfiguration = new TransportsConfiguration();
}
return transportsConfiguration;
} | [
"public",
"TransportsConfiguration",
"getConfiguration",
"(",
"String",
"configFileLocation",
")",
"{",
"TransportsConfiguration",
"transportsConfiguration",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"configFileLocation",
")",
";",
"if",
"(",
"file",
".",
"exists"... | Get the {@code TransportsConfiguration} represented by a particular configuration file.
@param configFileLocation configuration file location
@return TransportsConfiguration represented by a particular configuration file | [
"Get",
"the",
"{",
"@code",
"TransportsConfiguration",
"}",
"represented",
"by",
"a",
"particular",
"configuration",
"file",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contract/config/ConfigurationBuilder.java#L76-L97 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | DateFormatUtils.formatUTC | public static String formatUTC(final long millis, final String pattern, final Locale locale) {
return format(new Date(millis), pattern, UTC_TIME_ZONE, locale);
} | java | public static String formatUTC(final long millis, final String pattern, final Locale locale) {
return format(new Date(millis), pattern, UTC_TIME_ZONE, locale);
} | [
"public",
"static",
"String",
"formatUTC",
"(",
"final",
"long",
"millis",
",",
"final",
"String",
"pattern",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"format",
"(",
"new",
"Date",
"(",
"millis",
")",
",",
"pattern",
",",
"UTC_TIME_ZONE",
",",... | <p>Formats a date/time into a specific pattern using the UTC time zone.</p>
@param millis the date to format expressed in milliseconds
@param pattern the pattern to use to format the date, not null
@param locale the locale to use, may be <code>null</code>
@return the formatted date | [
"<p",
">",
"Formats",
"a",
"date",
"/",
"time",
"into",
"a",
"specific",
"pattern",
"using",
"the",
"UTC",
"time",
"zone",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java#L240-L242 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java | HttpUtil.getCharset | public static Charset getCharset(HttpMessage message, Charset defaultCharset) {
CharSequence contentTypeValue = message.headers().get(HttpHeaderNames.CONTENT_TYPE);
if (contentTypeValue != null) {
return getCharset(contentTypeValue, defaultCharset);
} else {
return defaultCharset;
}
} | java | public static Charset getCharset(HttpMessage message, Charset defaultCharset) {
CharSequence contentTypeValue = message.headers().get(HttpHeaderNames.CONTENT_TYPE);
if (contentTypeValue != null) {
return getCharset(contentTypeValue, defaultCharset);
} else {
return defaultCharset;
}
} | [
"public",
"static",
"Charset",
"getCharset",
"(",
"HttpMessage",
"message",
",",
"Charset",
"defaultCharset",
")",
"{",
"CharSequence",
"contentTypeValue",
"=",
"message",
".",
"headers",
"(",
")",
".",
"get",
"(",
"HttpHeaderNames",
".",
"CONTENT_TYPE",
")",
";... | Fetch charset from message's Content-Type header.
@param message entity to fetch Content-Type header from
@param defaultCharset result to use in case of empty, incorrect or doesn't contain required part header value
@return the charset from message's Content-Type header or {@code defaultCharset}
if charset is not presented or unparsable | [
"Fetch",
"charset",
"from",
"message",
"s",
"Content",
"-",
"Type",
"header",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java#L371-L378 |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.setObjects | public final void setObjects(Object injectionObject, Object bindingObject)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "setObjects", injectionObject, bindingObject);
this.ivInjectedObject = injectionObject; // d392996.3
this.ivBindingObject = (bindingObject != null) ? bindingObject : injectionObject;
if (ivBindingObject == null) // F54050
{
throw new IllegalArgumentException("expected non-null argument");
}
} | java | public final void setObjects(Object injectionObject, Object bindingObject)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "setObjects", injectionObject, bindingObject);
this.ivInjectedObject = injectionObject; // d392996.3
this.ivBindingObject = (bindingObject != null) ? bindingObject : injectionObject;
if (ivBindingObject == null) // F54050
{
throw new IllegalArgumentException("expected non-null argument");
}
} | [
"public",
"final",
"void",
"setObjects",
"(",
"Object",
"injectionObject",
",",
"Object",
"bindingObject",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
";",
"if",
"(",
"isTraceOn",
"&&",
"tc",
".",
"is... | Sets the objects to use for injection and binding. Usually, these
objects are the same; otherwise, {@link #setObjects(Object, Reference)} should be used instead.
@param injectionObject the object to inject
@param bindingObject the object to bind, or null if injectionObject
should be bound directly | [
"Sets",
"the",
"objects",
"to",
"use",
"for",
"injection",
"and",
"binding",
".",
"Usually",
"these",
"objects",
"are",
"the",
"same",
";",
"otherwise",
"{",
"@link",
"#setObjects",
"(",
"Object",
"Reference",
")",
"}",
"should",
"be",
"used",
"instead",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1257-L1270 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/common/Similarity.java | Similarity.kendallsTau | public static double kendallsTau(Vector a, Vector b) {
return kendallsTau(Vectors.asDouble(a), Vectors.asDouble(b));
} | java | public static double kendallsTau(Vector a, Vector b) {
return kendallsTau(Vectors.asDouble(a), Vectors.asDouble(b));
} | [
"public",
"static",
"double",
"kendallsTau",
"(",
"Vector",
"a",
",",
"Vector",
"b",
")",
"{",
"return",
"kendallsTau",
"(",
"Vectors",
".",
"asDouble",
"(",
"a",
")",
",",
"Vectors",
".",
"asDouble",
"(",
"b",
")",
")",
";",
"}"
] | Computes <a href="http://en.wikipedia.org/wiki/Kendall%27s_tau">Kendall's
tau</a> of the values in the two vectors. This method uses tau-b, which
is suitable for vectors with duplicate values.
@throws IllegalArgumentException when the length of the two vectors are
not the same. | [
"Computes",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Kendall%27s_tau",
">",
"Kendall",
"s",
"tau<",
"/",
"a",
">",
"of",
"the",
"values",
"in",
"the",
"two",
"vectors",
".",
"This",
"method",
"uses"... | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L2055-L2057 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/TransactionWriteRequest.java | TransactionWriteRequest.addConditionCheck | public TransactionWriteRequest addConditionCheck(Object key, DynamoDBTransactionWriteExpression transactionWriteExpression) {
return addConditionCheck(key, transactionWriteExpression, null /* returnValuesOnConditionCheckFailure */);
} | java | public TransactionWriteRequest addConditionCheck(Object key, DynamoDBTransactionWriteExpression transactionWriteExpression) {
return addConditionCheck(key, transactionWriteExpression, null /* returnValuesOnConditionCheckFailure */);
} | [
"public",
"TransactionWriteRequest",
"addConditionCheck",
"(",
"Object",
"key",
",",
"DynamoDBTransactionWriteExpression",
"transactionWriteExpression",
")",
"{",
"return",
"addConditionCheck",
"(",
"key",
",",
"transactionWriteExpression",
",",
"null",
"/* returnValuesOnCondit... | Adds conditionCheck operation (to be executed on the object represented by key) to the list of transaction write operations.
transactionWriteExpression is used to condition check on the object represented by key. | [
"Adds",
"conditionCheck",
"operation",
"(",
"to",
"be",
"executed",
"on",
"the",
"object",
"represented",
"by",
"key",
")",
"to",
"the",
"list",
"of",
"transaction",
"write",
"operations",
".",
"transactionWriteExpression",
"is",
"used",
"to",
"condition",
"chec... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/TransactionWriteRequest.java#L132-L134 |
lestard/advanced-bindings | src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java | MathBindings.multiplyExact | public static LongBinding multiplyExact(final long x, final ObservableLongValue y) {
return createLongBinding(() -> Math.multiplyExact(x, y.get()), y);
} | java | public static LongBinding multiplyExact(final long x, final ObservableLongValue y) {
return createLongBinding(() -> Math.multiplyExact(x, y.get()), y);
} | [
"public",
"static",
"LongBinding",
"multiplyExact",
"(",
"final",
"long",
"x",
",",
"final",
"ObservableLongValue",
"y",
")",
"{",
"return",
"createLongBinding",
"(",
"(",
")",
"->",
"Math",
".",
"multiplyExact",
"(",
"x",
",",
"y",
".",
"get",
"(",
")",
... | Binding for {@link java.lang.Math#multiplyExact(long, long)}
@param x the first value
@param y the second value
@return the result
@throws ArithmeticException if the result overflows a long | [
"Binding",
"for",
"{",
"@link",
"java",
".",
"lang",
".",
"Math#multiplyExact",
"(",
"long",
"long",
")",
"}"
] | train | https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L1035-L1037 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java | base_resource.rename_resource | protected base_response rename_resource(nitro_service service, String newname) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
options option = new options();
option.set_action("rename");
this.set_newname(newname);
base_response response = post_request(service, option);
return response;
} | java | protected base_response rename_resource(nitro_service service, String newname) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
options option = new options();
option.set_action("rename");
this.set_newname(newname);
base_response response = post_request(service, option);
return response;
} | [
"protected",
"base_response",
"rename_resource",
"(",
"nitro_service",
"service",
",",
"String",
"newname",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
"&&",
"!",
"get_object_type",
"(",
")",
".",
"equals",
"(",
"\"l... | Use this method to perform a rename operation on netscaler resource.
@param service nitro_service object.
@param newname new name to be set to the specified resource.
@return status of the operation performed.
@throws Exception Nitro exception is thrown. | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"rename",
"operation",
"on",
"netscaler",
"resource",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L458-L468 |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java | EntityTypeValidator.validateEntityId | static void validateEntityId(EntityType entityType) {
// validate entity name (e.g. illegal characters, length)
String id = entityType.getId();
if (!id.equals(ATTRIBUTE_META_DATA)
&& !id.equals(ENTITY_TYPE_META_DATA)
&& !id.equals(PACKAGE)) {
try {
NameValidator.validateEntityName(entityType.getId());
} catch (MolgenisDataException e) {
throw new MolgenisValidationException(new ConstraintViolation(e.getMessage()));
}
}
} | java | static void validateEntityId(EntityType entityType) {
// validate entity name (e.g. illegal characters, length)
String id = entityType.getId();
if (!id.equals(ATTRIBUTE_META_DATA)
&& !id.equals(ENTITY_TYPE_META_DATA)
&& !id.equals(PACKAGE)) {
try {
NameValidator.validateEntityName(entityType.getId());
} catch (MolgenisDataException e) {
throw new MolgenisValidationException(new ConstraintViolation(e.getMessage()));
}
}
} | [
"static",
"void",
"validateEntityId",
"(",
"EntityType",
"entityType",
")",
"{",
"// validate entity name (e.g. illegal characters, length)",
"String",
"id",
"=",
"entityType",
".",
"getId",
"(",
")",
";",
"if",
"(",
"!",
"id",
".",
"equals",
"(",
"ATTRIBUTE_META_DA... | Validates the entity ID: - Validates that the entity ID does not contain illegal characters and
validates the name length
@param entityType entity meta data
@throws MolgenisValidationException if the entity simple name content is invalid or the fully
qualified name, simple name and package name are not consistent | [
"Validates",
"the",
"entity",
"ID",
":",
"-",
"Validates",
"that",
"the",
"entity",
"ID",
"does",
"not",
"contain",
"illegal",
"characters",
"and",
"validates",
"the",
"name",
"length"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L292-L304 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/SystemUtil.java | SystemUtil.appendSuffixIfMissing | public static String appendSuffixIfMissing(String _str, String _suffix) {
if (_str == null) {
return null;
}
if (!_str.endsWith(_suffix)) {
_str += _suffix;
}
return _str;
} | java | public static String appendSuffixIfMissing(String _str, String _suffix) {
if (_str == null) {
return null;
}
if (!_str.endsWith(_suffix)) {
_str += _suffix;
}
return _str;
} | [
"public",
"static",
"String",
"appendSuffixIfMissing",
"(",
"String",
"_str",
",",
"String",
"_suffix",
")",
"{",
"if",
"(",
"_str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"_str",
".",
"endsWith",
"(",
"_suffix",
")",
")",
... | Append a suffix to the string (e.g. filename) if it doesn't have it already.
@param _str string to check
@param _suffix suffix to append
@return string with suffix or original if no suffix was appended | [
"Append",
"a",
"suffix",
"to",
"the",
"string",
"(",
"e",
".",
"g",
".",
"filename",
")",
"if",
"it",
"doesn",
"t",
"have",
"it",
"already",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/SystemUtil.java#L168-L176 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPaymentPersistenceImpl.java | CommerceOrderPaymentPersistenceImpl.findAll | @Override
public List<CommerceOrderPayment> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceOrderPayment> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceOrderPayment",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce order payments.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderPaymentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce order payments
@param end the upper bound of the range of commerce order payments (not inclusive)
@return the range of commerce order payments | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"order",
"payments",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPaymentPersistenceImpl.java#L1137-L1140 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.validateTrue | public void validateTrue(boolean value, String name) {
validateTrue(value, name, messages.get(Validation.TRUE_KEY.name(), name));
} | java | public void validateTrue(boolean value, String name) {
validateTrue(value, name, messages.get(Validation.TRUE_KEY.name(), name));
} | [
"public",
"void",
"validateTrue",
"(",
"boolean",
"value",
",",
"String",
"name",
")",
"{",
"validateTrue",
"(",
"value",
",",
"name",
",",
"messages",
".",
"get",
"(",
"Validation",
".",
"TRUE_KEY",
".",
"name",
"(",
")",
",",
"name",
")",
")",
";",
... | Validates a given value to be true
@param value The value to check
@param name The name of the field to display the error message | [
"Validates",
"a",
"given",
"value",
"to",
"be",
"true"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L441-L443 |
TheHortonMachine/hortonmachine | apps/src/main/java/org/hortonmachine/nww/utils/NwwUtilities.java | NwwUtilities.getScreenPointsPolygon | public static Geometry getScreenPointsPolygon( WorldWindow wwd, int x1, int y1, int x2, int y2 ) {
View view = wwd.getView();
Position p1 = view.computePositionFromScreenPoint(x1, y1);
Position p2 = view.computePositionFromScreenPoint(x1, y2);
Position p3 = view.computePositionFromScreenPoint(x2, y2);
Position p4 = view.computePositionFromScreenPoint(x2, y1);
Coordinate[] coords = { //
new Coordinate(p1.longitude.degrees, p1.latitude.degrees), //
new Coordinate(p2.longitude.degrees, p2.latitude.degrees), //
new Coordinate(p3.longitude.degrees, p3.latitude.degrees), //
new Coordinate(p4.longitude.degrees, p4.latitude.degrees)//
};
Geometry convexHull = GeometryUtilities.gf().createMultiPoint(coords).convexHull();
return convexHull;
} | java | public static Geometry getScreenPointsPolygon( WorldWindow wwd, int x1, int y1, int x2, int y2 ) {
View view = wwd.getView();
Position p1 = view.computePositionFromScreenPoint(x1, y1);
Position p2 = view.computePositionFromScreenPoint(x1, y2);
Position p3 = view.computePositionFromScreenPoint(x2, y2);
Position p4 = view.computePositionFromScreenPoint(x2, y1);
Coordinate[] coords = { //
new Coordinate(p1.longitude.degrees, p1.latitude.degrees), //
new Coordinate(p2.longitude.degrees, p2.latitude.degrees), //
new Coordinate(p3.longitude.degrees, p3.latitude.degrees), //
new Coordinate(p4.longitude.degrees, p4.latitude.degrees)//
};
Geometry convexHull = GeometryUtilities.gf().createMultiPoint(coords).convexHull();
return convexHull;
} | [
"public",
"static",
"Geometry",
"getScreenPointsPolygon",
"(",
"WorldWindow",
"wwd",
",",
"int",
"x1",
",",
"int",
"y1",
",",
"int",
"x2",
",",
"int",
"y2",
")",
"{",
"View",
"view",
"=",
"wwd",
".",
"getView",
"(",
")",
";",
"Position",
"p1",
"=",
"... | Get the lat/long world geometry from two screen corner coordinates.
@param wwd
the {@link WorldWindow} instance.
@param x1
the first point screen x.
@param y1
the first point screen y.
@param x2
the second point screen x.
@param y2
the second point screen y.
@return the world geomnetry. | [
"Get",
"the",
"lat",
"/",
"long",
"world",
"geometry",
"from",
"two",
"screen",
"corner",
"coordinates",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/nww/utils/NwwUtilities.java#L246-L261 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasRnnUtils.java | KerasRnnUtils.getUnrollRecurrentLayer | public static boolean getUnrollRecurrentLayer(KerasLayerConfiguration conf, Map<String, Object> layerConfig)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
if (!innerConfig.containsKey(conf.getLAYER_FIELD_UNROLL()))
throw new InvalidKerasConfigurationException(
"Keras LSTM layer config missing " + conf.getLAYER_FIELD_UNROLL() + " field");
return (boolean) innerConfig.get(conf.getLAYER_FIELD_UNROLL());
} | java | public static boolean getUnrollRecurrentLayer(KerasLayerConfiguration conf, Map<String, Object> layerConfig)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
if (!innerConfig.containsKey(conf.getLAYER_FIELD_UNROLL()))
throw new InvalidKerasConfigurationException(
"Keras LSTM layer config missing " + conf.getLAYER_FIELD_UNROLL() + " field");
return (boolean) innerConfig.get(conf.getLAYER_FIELD_UNROLL());
} | [
"public",
"static",
"boolean",
"getUnrollRecurrentLayer",
"(",
"KerasLayerConfiguration",
"conf",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"inner... | Get unroll parameter to decide whether to unroll RNN with BPTT or not.
@param conf KerasLayerConfiguration
@param layerConfig dictionary containing Keras layer properties
@return boolean unroll parameter
@throws InvalidKerasConfigurationException Invalid Keras configuration | [
"Get",
"unroll",
"parameter",
"to",
"decide",
"whether",
"to",
"unroll",
"RNN",
"with",
"BPTT",
"or",
"not",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasRnnUtils.java#L41-L48 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiView.java | FactoryMultiView.triangulateNViewCalibrated | public static TriangulateNViewsMetric triangulateNViewCalibrated(@Nullable ConfigTriangulation config ) {
if( config == null )
config = new ConfigTriangulation();
switch ( config.type ) {
case DLT:
return new WrapNViewsTriangulateMetricDLT();
case GEOMETRIC: {
TriangulateNViewsMetric estimator = new WrapNViewsTriangulateMetricDLT();
TriangulateRefineMetricLS refiner = new TriangulateRefineMetricLS(config.optimization.gtol,config.optimization.maxIterations);
return new TriangulateThenRefineMetric(estimator,refiner);
}
}
throw new IllegalArgumentException("Unknown or unsupported type "+config.type);
} | java | public static TriangulateNViewsMetric triangulateNViewCalibrated(@Nullable ConfigTriangulation config ) {
if( config == null )
config = new ConfigTriangulation();
switch ( config.type ) {
case DLT:
return new WrapNViewsTriangulateMetricDLT();
case GEOMETRIC: {
TriangulateNViewsMetric estimator = new WrapNViewsTriangulateMetricDLT();
TriangulateRefineMetricLS refiner = new TriangulateRefineMetricLS(config.optimization.gtol,config.optimization.maxIterations);
return new TriangulateThenRefineMetric(estimator,refiner);
}
}
throw new IllegalArgumentException("Unknown or unsupported type "+config.type);
} | [
"public",
"static",
"TriangulateNViewsMetric",
"triangulateNViewCalibrated",
"(",
"@",
"Nullable",
"ConfigTriangulation",
"config",
")",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"config",
"=",
"new",
"ConfigTriangulation",
"(",
")",
";",
"switch",
"(",
"config... | Triangulate N views using the Discrete Linear Transform (DLT) with a calibrated camera
@see TriangulateMetricLinearDLT
@return Two view triangulation algorithm | [
"Triangulate",
"N",
"views",
"using",
"the",
"Discrete",
"Linear",
"Transform",
"(",
"DLT",
")",
"with",
"a",
"calibrated",
"camera"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiView.java#L585-L601 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/Environment.java | Environment.get | public String get(String environmentVariableName, String defaultValue) {
return environmentVariables().get(environmentVariableName, defaultValue);
} | java | public String get(String environmentVariableName, String defaultValue) {
return environmentVariables().get(environmentVariableName, defaultValue);
} | [
"public",
"String",
"get",
"(",
"String",
"environmentVariableName",
",",
"String",
"defaultValue",
")",
"{",
"return",
"environmentVariables",
"(",
")",
".",
"get",
"(",
"environmentVariableName",
",",
"defaultValue",
")",
";",
"}"
] | Returns the value set for the environment variable identified by the given name. If the environment variable
is not set, then {@code defaultValue} is returned.
@param environmentVariableName {@link String} name of the environment variable.
@param defaultValue the default value to return if the specified environment variable is not set.
@return the value set the environment variable identified by the given name or {@code defaultValue}
if the named environment variable is not set.
@see #environmentVariables() | [
"Returns",
"the",
"value",
"set",
"for",
"the",
"environment",
"variable",
"identified",
"by",
"the",
"given",
"name",
".",
"If",
"the",
"environment",
"variable",
"is",
"not",
"set",
"then",
"{",
"@code",
"defaultValue",
"}",
"is",
"returned",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/Environment.java#L234-L236 |
jfinal/jfinal | src/main/java/com/jfinal/template/expr/ExprParser.java | ExprParser.staticMember | Expr staticMember() {
if (peek().sym != Sym.ID) {
return sharedMethod();
}
int begin = forward;
while (move().sym == Sym.DOT && move().sym == Sym.ID) {
;
}
// ID.ID.ID::
if (peek().sym != Sym.STATIC || tokenList.get(forward - 1).sym != Sym.ID) {
resetForward(begin);
return sharedMethod();
}
String clazz = getClazz(begin);
match(Sym.STATIC);
String memberName = match(Sym.ID).value();
// com.jfinal.kit.Str::isBlank(str)
if (peek().sym == Sym.LPAREN) {
move();
if (peek().sym == Sym.RPAREN) {
move();
return new StaticMethod(clazz, memberName, location);
}
ExprList exprList = exprList();
match(Sym.RPAREN);
return new StaticMethod(clazz, memberName, exprList, location);
}
// com.jfinal.core.Const::JFINAL_VERSION
return new StaticField(clazz, memberName, location);
} | java | Expr staticMember() {
if (peek().sym != Sym.ID) {
return sharedMethod();
}
int begin = forward;
while (move().sym == Sym.DOT && move().sym == Sym.ID) {
;
}
// ID.ID.ID::
if (peek().sym != Sym.STATIC || tokenList.get(forward - 1).sym != Sym.ID) {
resetForward(begin);
return sharedMethod();
}
String clazz = getClazz(begin);
match(Sym.STATIC);
String memberName = match(Sym.ID).value();
// com.jfinal.kit.Str::isBlank(str)
if (peek().sym == Sym.LPAREN) {
move();
if (peek().sym == Sym.RPAREN) {
move();
return new StaticMethod(clazz, memberName, location);
}
ExprList exprList = exprList();
match(Sym.RPAREN);
return new StaticMethod(clazz, memberName, exprList, location);
}
// com.jfinal.core.Const::JFINAL_VERSION
return new StaticField(clazz, memberName, location);
} | [
"Expr",
"staticMember",
"(",
")",
"{",
"if",
"(",
"peek",
"(",
")",
".",
"sym",
"!=",
"Sym",
".",
"ID",
")",
"{",
"return",
"sharedMethod",
"(",
")",
";",
"}",
"int",
"begin",
"=",
"forward",
";",
"while",
"(",
"move",
"(",
")",
".",
"sym",
"==... | staticMember
: ID_list '::' ID
| ID_list '::' ID '(' exprList? ')' | [
"staticMember",
":",
"ID_list",
"::",
"ID",
"|",
"ID_list",
"::",
"ID",
"(",
"exprList?",
")"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/template/expr/ExprParser.java#L303-L337 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.feedForward | public Map<String, INDArray> feedForward(INDArray[] input, boolean train, boolean clearInputs){
setInputs(input);
try {
return ffToLayerActivationsDetached(train, FwdPassType.STANDARD, false, vertices.length - 1,
null, input, inputMaskArrays, labelMaskArrays, clearInputs);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} | java | public Map<String, INDArray> feedForward(INDArray[] input, boolean train, boolean clearInputs){
setInputs(input);
try {
return ffToLayerActivationsDetached(train, FwdPassType.STANDARD, false, vertices.length - 1,
null, input, inputMaskArrays, labelMaskArrays, clearInputs);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} | [
"public",
"Map",
"<",
"String",
",",
"INDArray",
">",
"feedForward",
"(",
"INDArray",
"[",
"]",
"input",
",",
"boolean",
"train",
",",
"boolean",
"clearInputs",
")",
"{",
"setInputs",
"(",
"input",
")",
";",
"try",
"{",
"return",
"ffToLayerActivationsDetache... | Conduct forward pass using an array of inputs. This overload allows the forward pass to be conducted, optionally
(not) clearing the layer input arrays.<br>
Note: this method should NOT be used with clearInputs = true, unless you know what you are doing. Specifically:
when using clearInputs=false, in combination with workspaces, the layer input fields may leak outside of the
workspaces in which they were defined - potentially causing a crash. See <a href="https://deeplearning4j.org/docs/latest/deeplearning4j-config-workspaces">
https://deeplearning4j.org/docs/latest/deeplearning4j-config-workspaces</a>
for more details
@param input An array of ComputationGraph inputs
@param train If true: do forward pass at training time; false: do forward pass at test time
@param clearInputs If true (default for other methods): clear the inputs of all layers after doing forward
pass. False don't clear layer inputs.
@return A map of activations for each layer (not each GraphVertex). Keys = layer name, values = layer activations | [
"Conduct",
"forward",
"pass",
"using",
"an",
"array",
"of",
"inputs",
".",
"This",
"overload",
"allows",
"the",
"forward",
"pass",
"to",
"be",
"conducted",
"optionally",
"(",
"not",
")",
"clearing",
"the",
"layer",
"input",
"arrays",
".",
"<br",
">",
"Note... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L1549-L1558 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeInference.java | TypeInference.inferTemplatedTypesForCall | private boolean inferTemplatedTypesForCall(Node n, FunctionType fnType, FlowScope scope) {
ImmutableList<TemplateType> keys = fnType.getTemplateTypeMap().getTemplateKeys();
if (keys.isEmpty()) {
return false;
}
// Try to infer the template types
Map<TemplateType, JSType> rawInferrence = inferTemplateTypesFromParameters(fnType, n, scope);
Map<TemplateType, JSType> inferred = Maps.newIdentityHashMap();
for (TemplateType key : keys) {
JSType type = rawInferrence.get(key);
if (type == null) {
type = unknownType;
}
inferred.put(key, type);
}
// Try to infer the template types using the type transformations
Map<TemplateType, JSType> typeTransformations =
evaluateTypeTransformations(keys, inferred, scope);
if (typeTransformations != null) {
inferred.putAll(typeTransformations);
}
// Replace all template types. If we couldn't find a replacement, we
// replace it with UNKNOWN.
TemplateTypeReplacer replacer = new TemplateTypeReplacer(registry, inferred);
Node callTarget = n.getFirstChild();
FunctionType replacementFnType = fnType.visit(replacer).toMaybeFunctionType();
checkNotNull(replacementFnType);
callTarget.setJSType(replacementFnType);
n.setJSType(replacementFnType.getReturnType());
return replacer.madeChanges;
} | java | private boolean inferTemplatedTypesForCall(Node n, FunctionType fnType, FlowScope scope) {
ImmutableList<TemplateType> keys = fnType.getTemplateTypeMap().getTemplateKeys();
if (keys.isEmpty()) {
return false;
}
// Try to infer the template types
Map<TemplateType, JSType> rawInferrence = inferTemplateTypesFromParameters(fnType, n, scope);
Map<TemplateType, JSType> inferred = Maps.newIdentityHashMap();
for (TemplateType key : keys) {
JSType type = rawInferrence.get(key);
if (type == null) {
type = unknownType;
}
inferred.put(key, type);
}
// Try to infer the template types using the type transformations
Map<TemplateType, JSType> typeTransformations =
evaluateTypeTransformations(keys, inferred, scope);
if (typeTransformations != null) {
inferred.putAll(typeTransformations);
}
// Replace all template types. If we couldn't find a replacement, we
// replace it with UNKNOWN.
TemplateTypeReplacer replacer = new TemplateTypeReplacer(registry, inferred);
Node callTarget = n.getFirstChild();
FunctionType replacementFnType = fnType.visit(replacer).toMaybeFunctionType();
checkNotNull(replacementFnType);
callTarget.setJSType(replacementFnType);
n.setJSType(replacementFnType.getReturnType());
return replacer.madeChanges;
} | [
"private",
"boolean",
"inferTemplatedTypesForCall",
"(",
"Node",
"n",
",",
"FunctionType",
"fnType",
",",
"FlowScope",
"scope",
")",
"{",
"ImmutableList",
"<",
"TemplateType",
">",
"keys",
"=",
"fnType",
".",
"getTemplateTypeMap",
"(",
")",
".",
"getTemplateKeys",... | For functions that use template types, specialize the function type for the call target based
on the call-site specific arguments. Specifically, this enables inference to set the type of
any function literal parameters based on these inferred types. | [
"For",
"functions",
"that",
"use",
"template",
"types",
"specialize",
"the",
"function",
"type",
"for",
"the",
"call",
"target",
"based",
"on",
"the",
"call",
"-",
"site",
"specific",
"arguments",
".",
"Specifically",
"this",
"enables",
"inference",
"to",
"set... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInference.java#L2040-L2075 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.delegatedAccount_email_responder_PUT | public void delegatedAccount_email_responder_PUT(String email, OvhResponderAccount body) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/responder";
StringBuilder sb = path(qPath, email);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void delegatedAccount_email_responder_PUT(String email, OvhResponderAccount body) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/responder";
StringBuilder sb = path(qPath, email);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"delegatedAccount_email_responder_PUT",
"(",
"String",
"email",
",",
"OvhResponderAccount",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/delegatedAccount/{email}/responder\"",
";",
"StringBuilder",
"sb",
"=",
"path",
... | Alter this object properties
REST: PUT /email/domain/delegatedAccount/{email}/responder
@param body [required] New object properties
@param email [required] Email | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L311-L315 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-logging/xwiki-commons-logging-api/src/main/java/org/xwiki/logging/LogUtils.java | LogUtils.newLogEvent | public static LogEvent newLogEvent(Marker marker, LogLevel level, String message, Object[] argumentArray,
Throwable throwable)
{
return newLogEvent(marker, level, message, argumentArray, throwable, System.currentTimeMillis());
} | java | public static LogEvent newLogEvent(Marker marker, LogLevel level, String message, Object[] argumentArray,
Throwable throwable)
{
return newLogEvent(marker, level, message, argumentArray, throwable, System.currentTimeMillis());
} | [
"public",
"static",
"LogEvent",
"newLogEvent",
"(",
"Marker",
"marker",
",",
"LogLevel",
"level",
",",
"String",
"message",
",",
"Object",
"[",
"]",
"argumentArray",
",",
"Throwable",
"throwable",
")",
"{",
"return",
"newLogEvent",
"(",
"marker",
",",
"level",... | Create and return a new {@link LogEvent} instance based on the passed parameters.
@param marker the log marker
@param level the log level
@param message the log message
@param argumentArray the event arguments to insert in the message
@param throwable the throwable associated to the event
@return the {@link LogEvent} | [
"Create",
"and",
"return",
"a",
"new",
"{",
"@link",
"LogEvent",
"}",
"instance",
"based",
"on",
"the",
"passed",
"parameters",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-logging/xwiki-commons-logging-api/src/main/java/org/xwiki/logging/LogUtils.java#L51-L55 |
jbundle/jbundle | thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java | MKeyArea.doRemove | public void doRemove(FieldTable table, KeyAreaInfo keyArea, BaseBuffer buffer) throws DBException
{
super.doRemove(table, keyArea, buffer);
} | java | public void doRemove(FieldTable table, KeyAreaInfo keyArea, BaseBuffer buffer) throws DBException
{
super.doRemove(table, keyArea, buffer);
} | [
"public",
"void",
"doRemove",
"(",
"FieldTable",
"table",
",",
"KeyAreaInfo",
"keyArea",
",",
"BaseBuffer",
"buffer",
")",
"throws",
"DBException",
"{",
"super",
".",
"doRemove",
"(",
"table",
",",
"keyArea",
",",
"buffer",
")",
";",
"}"
] | Delete the key from this buffer.
@param table The basetable.
@param keyArea The basetable's key area.
@param buffer The buffer to compare.
@exception DBException File exception. | [
"Delete",
"the",
"key",
"from",
"this",
"buffer",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java#L152-L155 |
Azure/azure-sdk-for-java | common/azure-common-auth/src/main/java/com/azure/common/auth/credentials/DelegatedTokenCredentials.java | DelegatedTokenCredentials.generateAuthenticationUrl | public String generateAuthenticationUrl(ResponseMode responseMode, String state) {
return String.format("%s/%s/oauth2/authorize?client_id=%s&response_type=code&redirect_uri=%s&response_mode=%s&state=%s",
environment().activeDirectoryEndpoint(), domain(), clientId(), this.redirectUrl, responseMode.value, state);
} | java | public String generateAuthenticationUrl(ResponseMode responseMode, String state) {
return String.format("%s/%s/oauth2/authorize?client_id=%s&response_type=code&redirect_uri=%s&response_mode=%s&state=%s",
environment().activeDirectoryEndpoint(), domain(), clientId(), this.redirectUrl, responseMode.value, state);
} | [
"public",
"String",
"generateAuthenticationUrl",
"(",
"ResponseMode",
"responseMode",
",",
"String",
"state",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s/%s/oauth2/authorize?client_id=%s&response_type=code&redirect_uri=%s&response_mode=%s&state=%s\"",
",",
"environmen... | Generate the URL to authenticate through OAuth2.
@param responseMode the method that should be used to send the resulting token back to your app
@param state a value included in the request that is also returned in the token response
@return the URL to authenticate through OAuth2 | [
"Generate",
"the",
"URL",
"to",
"authenticate",
"through",
"OAuth2",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common-auth/src/main/java/com/azure/common/auth/credentials/DelegatedTokenCredentials.java#L113-L116 |
scalecube/socketio | src/main/java/io/scalecube/socketio/SocketIOServer.java | SocketIOServer.newInstance | public static SocketIOServer newInstance(int port, SSLContext sslContext) {
SslContext nettySslContext = new JdkSslContext(sslContext, false, ClientAuth.NONE);
return newInstance(port, nettySslContext);
} | java | public static SocketIOServer newInstance(int port, SSLContext sslContext) {
SslContext nettySslContext = new JdkSslContext(sslContext, false, ClientAuth.NONE);
return newInstance(port, nettySslContext);
} | [
"public",
"static",
"SocketIOServer",
"newInstance",
"(",
"int",
"port",
",",
"SSLContext",
"sslContext",
")",
"{",
"SslContext",
"nettySslContext",
"=",
"new",
"JdkSslContext",
"(",
"sslContext",
",",
"false",
",",
"ClientAuth",
".",
"NONE",
")",
";",
"return",... | Creates instance of Socket.IO server with the given secure port. | [
"Creates",
"instance",
"of",
"Socket",
".",
"IO",
"server",
"with",
"the",
"given",
"secure",
"port",
"."
] | train | https://github.com/scalecube/socketio/blob/bad28fe7a132320750173e7cb71ad6d3688fb626/src/main/java/io/scalecube/socketio/SocketIOServer.java#L75-L78 |
SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssueMerger.java | SiblingsIssueMerger.tryMerge | public void tryMerge(Component component, Collection<DefaultIssue> newIssues) {
Collection<SiblingIssue> siblingIssues = siblingsIssuesLoader.loadCandidateSiblingIssuesForMerging(component);
Tracking<DefaultIssue, SiblingIssue> tracking = tracker.track(newIssues, siblingIssues);
Map<DefaultIssue, SiblingIssue> matchedRaws = tracking.getMatchedRaws();
Map<SiblingIssue, DefaultIssue> defaultIssues = siblingsIssuesLoader.loadDefaultIssuesWithChanges(matchedRaws.values());
for (Map.Entry<DefaultIssue, SiblingIssue> e : matchedRaws.entrySet()) {
SiblingIssue issue = e.getValue();
issueLifecycle.mergeConfirmedOrResolvedFromShortLivingBranchOrPr(e.getKey(), defaultIssues.get(issue), issue.getBranchType(), issue.getBranchKey());
}
} | java | public void tryMerge(Component component, Collection<DefaultIssue> newIssues) {
Collection<SiblingIssue> siblingIssues = siblingsIssuesLoader.loadCandidateSiblingIssuesForMerging(component);
Tracking<DefaultIssue, SiblingIssue> tracking = tracker.track(newIssues, siblingIssues);
Map<DefaultIssue, SiblingIssue> matchedRaws = tracking.getMatchedRaws();
Map<SiblingIssue, DefaultIssue> defaultIssues = siblingsIssuesLoader.loadDefaultIssuesWithChanges(matchedRaws.values());
for (Map.Entry<DefaultIssue, SiblingIssue> e : matchedRaws.entrySet()) {
SiblingIssue issue = e.getValue();
issueLifecycle.mergeConfirmedOrResolvedFromShortLivingBranchOrPr(e.getKey(), defaultIssues.get(issue), issue.getBranchType(), issue.getBranchKey());
}
} | [
"public",
"void",
"tryMerge",
"(",
"Component",
"component",
",",
"Collection",
"<",
"DefaultIssue",
">",
"newIssues",
")",
"{",
"Collection",
"<",
"SiblingIssue",
">",
"siblingIssues",
"=",
"siblingsIssuesLoader",
".",
"loadCandidateSiblingIssuesForMerging",
"(",
"co... | Look for all unclosed issues in branches/PR targeting the same long living branch, and run
a light issue tracking to find matches. Then merge issue attributes in the new issues. | [
"Look",
"for",
"all",
"unclosed",
"issues",
"in",
"branches",
"/",
"PR",
"targeting",
"the",
"same",
"long",
"living",
"branch",
"and",
"run",
"a",
"light",
"issue",
"tracking",
"to",
"find",
"matches",
".",
"Then",
"merge",
"issue",
"attributes",
"in",
"t... | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/SiblingsIssueMerger.java#L48-L60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.