repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.containsAnyEntry | public static boolean containsAnyEntry(File zip, String[] names) {
ZipFile zf = null;
try {
zf = new ZipFile(zip);
for (int i = 0; i < names.length; i++) {
if (zf.getEntry(names[i]) != null) {
return true;
}
}
return false;
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
finally {
closeQuietly(zf);
}
} | java | public static boolean containsAnyEntry(File zip, String[] names) {
ZipFile zf = null;
try {
zf = new ZipFile(zip);
for (int i = 0; i < names.length; i++) {
if (zf.getEntry(names[i]) != null) {
return true;
}
}
return false;
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
finally {
closeQuietly(zf);
}
} | [
"public",
"static",
"boolean",
"containsAnyEntry",
"(",
"File",
"zip",
",",
"String",
"[",
"]",
"names",
")",
"{",
"ZipFile",
"zf",
"=",
"null",
";",
"try",
"{",
"zf",
"=",
"new",
"ZipFile",
"(",
"zip",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | Checks if the ZIP file contains any of the given entries.
@param zip
ZIP file.
@param names
entry names.
@return <code>true</code> if the ZIP file contains any of the given
entries. | [
"Checks",
"if",
"the",
"ZIP",
"file",
"contains",
"any",
"of",
"the",
"given",
"entries",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L155-L172 |
roboconf/roboconf-platform | core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java | AgentProperties.updatedField | private static String updatedField( Properties props, String fieldName ) {
String property = props.getProperty( fieldName );
if( property != null )
property = property.replace( "\\:", ":" );
return property;
} | java | private static String updatedField( Properties props, String fieldName ) {
String property = props.getProperty( fieldName );
if( property != null )
property = property.replace( "\\:", ":" );
return property;
} | [
"private",
"static",
"String",
"updatedField",
"(",
"Properties",
"props",
",",
"String",
"fieldName",
")",
"{",
"String",
"property",
"=",
"props",
".",
"getProperty",
"(",
"fieldName",
")",
";",
"if",
"(",
"property",
"!=",
"null",
")",
"property",
"=",
... | Gets a property and updates it to prevent escaped characters.
@param props the IAAS properties.
@param fieldName the name of the field to read.
@return an updated string | [
"Gets",
"a",
"property",
"and",
"updates",
"it",
"to",
"prevent",
"escaped",
"characters",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java#L213-L220 |
OpenBEL/openbel-framework | org.openbel.framework.api/src/main/java/org/openbel/framework/api/DefaultOrthologize.java | DefaultOrthologize.inferOrthologs | private static Pair<Map<Integer, TermParameter>, Map<Integer, TermParameter>> inferOrthologs(
Kam kam, KAMStore kAMStore, SpeciesDialect dialect,
EdgeFilter inferf, Set<KamNode> species,
Map<KamNode, KamNode> ortho) {
final List<org.openbel.framework.common.model.Namespace> spl = dialect
.getSpeciesNamespaces();
final Set<String> rlocs = constrainedHashSet(spl.size());
for (final org.openbel.framework.common.model.Namespace n : spl) {
rlocs.add(n.getResourceLocation());
}
Map<Integer, TermParameter> ntp = sizedHashMap(species.size());
Map<Integer, TermParameter> etp = sizedHashMap(species.size());
for (final KamNode snode : species) {
if (snode != null) {
// XXX term parameter looked up 2x; may impact perf/determinism
// TODO redesign orthologousNodes / inferOrthologs
TermParameter p = findParameter(kam, kAMStore, snode, rlocs);
// recurse incoming connections from species node
recurseConnections(kam, snode, p, inferf, REVERSE, ortho, ntp, etp);
// recurse outgoing connections from species node
recurseConnections(kam, snode, p, inferf, FORWARD, ortho, ntp, etp);
}
}
return new Pair<Map<Integer, TermParameter>, Map<Integer, TermParameter>>(
ntp, etp);
} | java | private static Pair<Map<Integer, TermParameter>, Map<Integer, TermParameter>> inferOrthologs(
Kam kam, KAMStore kAMStore, SpeciesDialect dialect,
EdgeFilter inferf, Set<KamNode> species,
Map<KamNode, KamNode> ortho) {
final List<org.openbel.framework.common.model.Namespace> spl = dialect
.getSpeciesNamespaces();
final Set<String> rlocs = constrainedHashSet(spl.size());
for (final org.openbel.framework.common.model.Namespace n : spl) {
rlocs.add(n.getResourceLocation());
}
Map<Integer, TermParameter> ntp = sizedHashMap(species.size());
Map<Integer, TermParameter> etp = sizedHashMap(species.size());
for (final KamNode snode : species) {
if (snode != null) {
// XXX term parameter looked up 2x; may impact perf/determinism
// TODO redesign orthologousNodes / inferOrthologs
TermParameter p = findParameter(kam, kAMStore, snode, rlocs);
// recurse incoming connections from species node
recurseConnections(kam, snode, p, inferf, REVERSE, ortho, ntp, etp);
// recurse outgoing connections from species node
recurseConnections(kam, snode, p, inferf, FORWARD, ortho, ntp, etp);
}
}
return new Pair<Map<Integer, TermParameter>, Map<Integer, TermParameter>>(
ntp, etp);
} | [
"private",
"static",
"Pair",
"<",
"Map",
"<",
"Integer",
",",
"TermParameter",
">",
",",
"Map",
"<",
"Integer",
",",
"TermParameter",
">",
">",
"inferOrthologs",
"(",
"Kam",
"kam",
",",
"KAMStore",
"kAMStore",
",",
"SpeciesDialect",
"dialect",
",",
"EdgeFilt... | Infers orthologous {@link KamEdge edges} downstream and upstream from
all {@link KamNode species replacement nodes}.
@param kam {@link Kam}
@param inferf {@link EdgeFilter}
@param species {@link Set} of {@link Integer} species replacement node
ids | [
"Infers",
"orthologous",
"{",
"@link",
"KamEdge",
"edges",
"}",
"downstream",
"and",
"upstream",
"from",
"all",
"{",
"@link",
"KamNode",
"species",
"replacement",
"nodes",
"}",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.api/src/main/java/org/openbel/framework/api/DefaultOrthologize.java#L227-L256 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Point.java | Point.setXY | public void setXY(double x, double y) {
_touch();
if (m_attributes == null)
_setToDefault();
m_attributes[0] = x;
m_attributes[1] = y;
} | java | public void setXY(double x, double y) {
_touch();
if (m_attributes == null)
_setToDefault();
m_attributes[0] = x;
m_attributes[1] = y;
} | [
"public",
"void",
"setXY",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"_touch",
"(",
")",
";",
"if",
"(",
"m_attributes",
"==",
"null",
")",
"_setToDefault",
"(",
")",
";",
"m_attributes",
"[",
"0",
"]",
"=",
"x",
";",
"m_attributes",
"[",
"... | Set the X and Y coordinate of the point.
@param x
X coordinate of the point.
@param y
Y coordinate of the point. | [
"Set",
"the",
"X",
"and",
"Y",
"coordinate",
"of",
"the",
"point",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Point.java#L572-L580 |
FINRAOS/JTAF-ExtWebDriver | src/main/java/org/finra/jtaf/ewd/widget/element/Element.java | Element.waitForCommand | protected void waitForCommand(ITimerCallback callback, long timeout) throws WidgetTimeoutException {
WaitForConditionTimer t = new WaitForConditionTimer(getByLocator(), callback);
t.waitUntil(timeout);
} | java | protected void waitForCommand(ITimerCallback callback, long timeout) throws WidgetTimeoutException {
WaitForConditionTimer t = new WaitForConditionTimer(getByLocator(), callback);
t.waitUntil(timeout);
} | [
"protected",
"void",
"waitForCommand",
"(",
"ITimerCallback",
"callback",
",",
"long",
"timeout",
")",
"throws",
"WidgetTimeoutException",
"{",
"WaitForConditionTimer",
"t",
"=",
"new",
"WaitForConditionTimer",
"(",
"getByLocator",
"(",
")",
",",
"callback",
")",
";... | wait for timeout amount of time
@param callback
@param timeout
@throws WidgetTimeoutException | [
"wait",
"for",
"timeout",
"amount",
"of",
"time"
] | train | https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/widget/element/Element.java#L797-L800 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/SliceInput.java | SliceInput.readBytes | public void readBytes(OutputStream out, int length)
throws IOException
{
slice.getBytes(position, out, length);
position += length;
} | java | public void readBytes(OutputStream out, int length)
throws IOException
{
slice.getBytes(position, out, length);
position += length;
} | [
"public",
"void",
"readBytes",
"(",
"OutputStream",
"out",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"slice",
".",
"getBytes",
"(",
"position",
",",
"out",
",",
"length",
")",
";",
"position",
"+=",
"length",
";",
"}"
] | Transfers this buffer's data to the specified stream starting at the
current {@code position}.
@param length the number of bytes to transfer
@throws IndexOutOfBoundsException if {@code length} is greater than {@code this.available()}
@throws java.io.IOException if the specified stream threw an exception during I/O | [
"Transfers",
"this",
"buffer",
"s",
"data",
"to",
"the",
"specified",
"stream",
"starting",
"at",
"the",
"current",
"{",
"@code",
"position",
"}",
"."
] | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/SliceInput.java#L365-L370 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubDataPropertyOfAxiomImpl_CustomFieldSerializer.java | OWLSubDataPropertyOfAxiomImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLSubDataPropertyOfAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLSubDataPropertyOfAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLSubDataPropertyOfAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubDataPropertyOfAxiomImpl_CustomFieldSerializer.java#L97-L100 |
kiegroup/droolsjbpm-knowledge | kie-internal/src/main/java/org/kie/internal/runtime/manager/deploy/DeploymentDescriptorIO.java | DeploymentDescriptorIO.toXml | public static String toXml(DeploymentDescriptor descriptor) {
try {
Marshaller marshaller = getContext().createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "http://www.jboss.org/jbpm deployment-descriptor.xsd");
marshaller.setSchema(schema);
StringWriter stringWriter = new StringWriter();
// clone the object and cleanup transients
DeploymentDescriptor clone = ((DeploymentDescriptorImpl) descriptor).clearClone();
marshaller.marshal(clone, stringWriter);
String output = stringWriter.toString();
return output;
} catch (Exception e) {
throw new RuntimeException("Unable to generate xml from deployment descriptor", e);
}
} | java | public static String toXml(DeploymentDescriptor descriptor) {
try {
Marshaller marshaller = getContext().createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "http://www.jboss.org/jbpm deployment-descriptor.xsd");
marshaller.setSchema(schema);
StringWriter stringWriter = new StringWriter();
// clone the object and cleanup transients
DeploymentDescriptor clone = ((DeploymentDescriptorImpl) descriptor).clearClone();
marshaller.marshal(clone, stringWriter);
String output = stringWriter.toString();
return output;
} catch (Exception e) {
throw new RuntimeException("Unable to generate xml from deployment descriptor", e);
}
} | [
"public",
"static",
"String",
"toXml",
"(",
"DeploymentDescriptor",
"descriptor",
")",
"{",
"try",
"{",
"Marshaller",
"marshaller",
"=",
"getContext",
"(",
")",
".",
"createMarshaller",
"(",
")",
";",
"marshaller",
".",
"setProperty",
"(",
"Marshaller",
".",
"... | Serializes descriptor instance to XML
@param descriptor descriptor to be serialized
@return xml representation of descriptor as string | [
"Serializes",
"descriptor",
"instance",
"to",
"XML"
] | train | https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/runtime/manager/deploy/DeploymentDescriptorIO.java#L68-L87 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Float> getAt(float[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | java | @SuppressWarnings("unchecked")
public static List<Float> getAt(float[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Float",
">",
"getAt",
"(",
"float",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
... | Support the subscript operator with a collection for a float array
@param array a float array
@param indices a collection of indices for the items to retrieve
@return list of the floats at the given indices
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"float",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14003-L14006 |
strator-dev/greenpepper | greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/phpDriver/PHPDriverHelper.java | PHPDriverHelper.copyFile | public static File copyFile(InputStream is, boolean deleteOnExit) throws IOException {
File f = File.createTempFile("php", ".php");
if (deleteOnExit) {
f.deleteOnExit();
}
FileWriter fw = new FileWriter(f);
copyFile(new BufferedReader(new InputStreamReader(is)), new BufferedWriter(fw));
is.close();
fw.close();
return f;
} | java | public static File copyFile(InputStream is, boolean deleteOnExit) throws IOException {
File f = File.createTempFile("php", ".php");
if (deleteOnExit) {
f.deleteOnExit();
}
FileWriter fw = new FileWriter(f);
copyFile(new BufferedReader(new InputStreamReader(is)), new BufferedWriter(fw));
is.close();
fw.close();
return f;
} | [
"public",
"static",
"File",
"copyFile",
"(",
"InputStream",
"is",
",",
"boolean",
"deleteOnExit",
")",
"throws",
"IOException",
"{",
"File",
"f",
"=",
"File",
".",
"createTempFile",
"(",
"\"php\"",
",",
"\".php\"",
")",
";",
"if",
"(",
"deleteOnExit",
")",
... | <p>copyFile.</p>
@param is a {@link java.io.InputStream} object.
@param deleteOnExit a boolean.
@return a {@link java.io.File} object.
@throws java.io.IOException if any. | [
"<p",
">",
"copyFile",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/phpDriver/PHPDriverHelper.java#L143-L153 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/LookasideCacheFileSystem.java | LookasideCacheFileSystem.evictCache | public void evictCache(Path hdfsPath, Path localPath, long size)
throws IOException {
boolean done = cacheFs.delete(localPath, false);
if (!done) {
if (LOG.isDebugEnabled()) {
LOG.debug("Evict for path: " + hdfsPath +
" local path " + localPath + " unsuccessful.");
}
}
} | java | public void evictCache(Path hdfsPath, Path localPath, long size)
throws IOException {
boolean done = cacheFs.delete(localPath, false);
if (!done) {
if (LOG.isDebugEnabled()) {
LOG.debug("Evict for path: " + hdfsPath +
" local path " + localPath + " unsuccessful.");
}
}
} | [
"public",
"void",
"evictCache",
"(",
"Path",
"hdfsPath",
",",
"Path",
"localPath",
",",
"long",
"size",
")",
"throws",
"IOException",
"{",
"boolean",
"done",
"=",
"cacheFs",
".",
"delete",
"(",
"localPath",
",",
"false",
")",
";",
"if",
"(",
"!",
"done",... | Evicts a file from the cache. If the cache is exceeding capacity,
then the cache calls this method to indicate that it is evicting
a file from the cache. This is part of the Eviction Interface. | [
"Evicts",
"a",
"file",
"from",
"the",
"cache",
".",
"If",
"the",
"cache",
"is",
"exceeding",
"capacity",
"then",
"the",
"cache",
"calls",
"this",
"method",
"to",
"indicate",
"that",
"it",
"is",
"evicting",
"a",
"file",
"from",
"the",
"cache",
".",
"This"... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/LookasideCacheFileSystem.java#L203-L212 |
casmi/casmi | src/main/java/casmi/graphics/element/Arc.java | Arc.setCenterColor | public void setCenterColor(ColorSet colorSet) {
if (this.centerColor == null) {
this.centerColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.centerColor = RGBColor.color(colorSet);
} | java | public void setCenterColor(ColorSet colorSet) {
if (this.centerColor == null) {
this.centerColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.centerColor = RGBColor.color(colorSet);
} | [
"public",
"void",
"setCenterColor",
"(",
"ColorSet",
"colorSet",
")",
"{",
"if",
"(",
"this",
".",
"centerColor",
"==",
"null",
")",
"{",
"this",
".",
"centerColor",
"=",
"new",
"RGBColor",
"(",
"0.0",
",",
"0.0",
",",
"0.0",
")",
";",
"}",
"setGradati... | Sets the colorSet of the center of this Arc.
@param colorSet The colorSet of the center of the Arc. | [
"Sets",
"the",
"colorSet",
"of",
"the",
"center",
"of",
"this",
"Arc",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Arc.java#L423-L429 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/IOUtil.java | IOUtil.copy | public static void copy(Reader r, Writer w, boolean close) throws IOException {
char[] buf = new char[DEFAULT_BUFFER_SIZE];
int len;
try {
while ((len = r.read(buf)) != -1) {
w.write(buf, 0, len);
}
} finally {
if (close) {
closeQuietly(r);
closeQuietly(w);
}
}
} | java | public static void copy(Reader r, Writer w, boolean close) throws IOException {
char[] buf = new char[DEFAULT_BUFFER_SIZE];
int len;
try {
while ((len = r.read(buf)) != -1) {
w.write(buf, 0, len);
}
} finally {
if (close) {
closeQuietly(r);
closeQuietly(w);
}
}
} | [
"public",
"static",
"void",
"copy",
"(",
"Reader",
"r",
",",
"Writer",
"w",
",",
"boolean",
"close",
")",
"throws",
"IOException",
"{",
"char",
"[",
"]",
"buf",
"=",
"new",
"char",
"[",
"DEFAULT_BUFFER_SIZE",
"]",
";",
"int",
"len",
";",
"try",
"{",
... | Copies all text from the given reader to the given writer.
@param r
the reader.
@param w
the writer.
@param close
<code>true</code> if both reader and writer are closed afterwards, <code>false</code> otherwise.
@throws IOException
if an I/O error occurs. | [
"Copies",
"all",
"text",
"from",
"the",
"given",
"reader",
"to",
"the",
"given",
"writer",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/IOUtil.java#L144-L157 |
Metatavu/edelphi | rest/src/main/java/fi/metatavu/edelphi/permissions/PermissionController.java | PermissionController.getPanelRole | private UserRole getPanelRole(User user, Panel panel) {
if (panel != null) {
PanelUserDAO panelUserDAO = new PanelUserDAO();
PanelUser panelUser = panelUserDAO.findByPanelAndUserAndStamp(panel, user, panel.getCurrentStamp());
return panelUser == null ? getEveryoneRole() : panelUser.getRole();
}
return getEveryoneRole();
} | java | private UserRole getPanelRole(User user, Panel panel) {
if (panel != null) {
PanelUserDAO panelUserDAO = new PanelUserDAO();
PanelUser panelUser = panelUserDAO.findByPanelAndUserAndStamp(panel, user, panel.getCurrentStamp());
return panelUser == null ? getEveryoneRole() : panelUser.getRole();
}
return getEveryoneRole();
} | [
"private",
"UserRole",
"getPanelRole",
"(",
"User",
"user",
",",
"Panel",
"panel",
")",
"{",
"if",
"(",
"panel",
"!=",
"null",
")",
"{",
"PanelUserDAO",
"panelUserDAO",
"=",
"new",
"PanelUserDAO",
"(",
")",
";",
"PanelUser",
"panelUser",
"=",
"panelUserDAO",... | Returns user's panel role
@param user user
@param panel panel
@return user's panel role | [
"Returns",
"user",
"s",
"panel",
"role"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/rest/src/main/java/fi/metatavu/edelphi/permissions/PermissionController.java#L122-L130 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/data/GraphLoader.java | GraphLoader.loadWeightedEdgeListFile | public static Graph<String, Double> loadWeightedEdgeListFile(String path, int numVertices, String delim,
boolean directed, String... ignoreLinesStartingWith) throws IOException {
return loadWeightedEdgeListFile(path, numVertices, delim, directed, true, ignoreLinesStartingWith);
} | java | public static Graph<String, Double> loadWeightedEdgeListFile(String path, int numVertices, String delim,
boolean directed, String... ignoreLinesStartingWith) throws IOException {
return loadWeightedEdgeListFile(path, numVertices, delim, directed, true, ignoreLinesStartingWith);
} | [
"public",
"static",
"Graph",
"<",
"String",
",",
"Double",
">",
"loadWeightedEdgeListFile",
"(",
"String",
"path",
",",
"int",
"numVertices",
",",
"String",
"delim",
",",
"boolean",
"directed",
",",
"String",
"...",
"ignoreLinesStartingWith",
")",
"throws",
"IOE... | Method for loading a weighted graph from an edge list file, where each edge (inc. weight) is represented by a
single line. Graph may be directed or undirected<br>
This method assumes that edges are of the format: {@code fromIndex<delim>toIndex<delim>edgeWeight} where {@code <delim>}
is the delimiter.
<b>Note</b>: this method calls {@link #loadWeightedEdgeListFile(String, int, String, boolean, boolean, String...)} with allowMultipleEdges = true.
@param path Path to the edge list file
@param numVertices The number of vertices in the graph
@param delim The delimiter used in the file (typically: "," or " " etc)
@param directed whether the edges should be treated as directed (true) or undirected (false)
@param ignoreLinesStartingWith Starting characters for comment lines. May be null. For example: "//" or "#"
@return The graph
@throws IOException | [
"Method",
"for",
"loading",
"a",
"weighted",
"graph",
"from",
"an",
"edge",
"list",
"file",
"where",
"each",
"edge",
"(",
"inc",
".",
"weight",
")",
"is",
"represented",
"by",
"a",
"single",
"line",
".",
"Graph",
"may",
"be",
"directed",
"or",
"undirecte... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/data/GraphLoader.java#L97-L100 |
GerdHolz/TOVAL | src/de/invation/code/toval/os/WindowsRegistry.java | WindowsRegistry.keyParts | private static Object[] keyParts(String fullKeyName) throws RegistryException {
int x = fullKeyName.indexOf(REG_PATH_SEPARATOR);
String hiveName = x >= 0 ? fullKeyName.substring(0, x) : fullKeyName;
String keyName = x >= 0 ? fullKeyName.substring(x + 1) : "";
if (Hive.getHive(hiveName) == null) {
throw new RegistryException("Unknown registry hive: " + hiveName, null);
}
Integer hiveKey = Hive.getHive(hiveName).getId();
return new Object[]{hiveKey, toByteArray(keyName)};
} | java | private static Object[] keyParts(String fullKeyName) throws RegistryException {
int x = fullKeyName.indexOf(REG_PATH_SEPARATOR);
String hiveName = x >= 0 ? fullKeyName.substring(0, x) : fullKeyName;
String keyName = x >= 0 ? fullKeyName.substring(x + 1) : "";
if (Hive.getHive(hiveName) == null) {
throw new RegistryException("Unknown registry hive: " + hiveName, null);
}
Integer hiveKey = Hive.getHive(hiveName).getId();
return new Object[]{hiveKey, toByteArray(keyName)};
} | [
"private",
"static",
"Object",
"[",
"]",
"keyParts",
"(",
"String",
"fullKeyName",
")",
"throws",
"RegistryException",
"{",
"int",
"x",
"=",
"fullKeyName",
".",
"indexOf",
"(",
"REG_PATH_SEPARATOR",
")",
";",
"String",
"hiveName",
"=",
"x",
">=",
"0",
"?",
... | Splits a path such as HKEY_LOCAL_MACHINE\Software\Microsoft into a pair
of values used by the underlying API: An integer hive constant and a byte
array of the key path within that hive.
@param fullKeyName Key name to split in its single keys.
@return Array with the hive key as first element and a following byte
array for each key name as second element. | [
"Splits",
"a",
"path",
"such",
"as",
"HKEY_LOCAL_MACHINE",
"\\",
"Software",
"\\",
"Microsoft",
"into",
"a",
"pair",
"of",
"values",
"used",
"by",
"the",
"underlying",
"API",
":",
"An",
"integer",
"hive",
"constant",
"and",
"a",
"byte",
"array",
"of",
"the... | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/WindowsRegistry.java#L208-L217 |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/event/AbstractEventStream.java | AbstractEventStream.clearListeners | protected void clearListeners(int code, String phrase) {
listeners.forEach(listener -> listener.eventStreamClosed(code, phrase));
// Clear out the listeners
listeners.clear();
} | java | protected void clearListeners(int code, String phrase) {
listeners.forEach(listener -> listener.eventStreamClosed(code, phrase));
// Clear out the listeners
listeners.clear();
} | [
"protected",
"void",
"clearListeners",
"(",
"int",
"code",
",",
"String",
"phrase",
")",
"{",
"listeners",
".",
"forEach",
"(",
"listener",
"->",
"listener",
".",
"eventStreamClosed",
"(",
"code",
",",
"phrase",
")",
")",
";",
"// Clear out the listeners",
"li... | Removes all listeners.
@param code an integer code to represent the reason for closing
@param phrase a String representation of code | [
"Removes",
"all",
"listeners",
"."
] | train | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/event/AbstractEventStream.java#L74-L79 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/CategoricalResults.java | CategoricalResults.setProb | public void setProb(int cat, double prob)
{
if(cat > probabilities.length)
throw new IndexOutOfBoundsException("There are only " + probabilities.length + " posibilties, " + cat + " is invalid");
else if(prob < 0 || Double.isInfinite(prob) || Double.isNaN(prob))
throw new ArithmeticException("Only zero and positive values are valid, not " + prob);
probabilities[cat] = prob;
} | java | public void setProb(int cat, double prob)
{
if(cat > probabilities.length)
throw new IndexOutOfBoundsException("There are only " + probabilities.length + " posibilties, " + cat + " is invalid");
else if(prob < 0 || Double.isInfinite(prob) || Double.isNaN(prob))
throw new ArithmeticException("Only zero and positive values are valid, not " + prob);
probabilities[cat] = prob;
} | [
"public",
"void",
"setProb",
"(",
"int",
"cat",
",",
"double",
"prob",
")",
"{",
"if",
"(",
"cat",
">",
"probabilities",
".",
"length",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"There are only \"",
"+",
"probabilities",
".",
"length",
"+",
"\... | Sets the probability that a sample belongs to a given category.
@param cat the category
@param prob the value to set, may be greater then one.
@throws IndexOutOfBoundsException if a non existent category is specified
@throws ArithmeticException if the value set is negative or not a number | [
"Sets",
"the",
"probability",
"that",
"a",
"sample",
"belongs",
"to",
"a",
"given",
"category",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/CategoricalResults.java#L56-L63 |
gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java | SynchronisationService.waitAndAssertForExpectedCondition | public void waitAndAssertForExpectedCondition(ExpectedCondition<?> condition, int timeout) {
if (!waitForExpectedCondition(condition, timeout)) {
fail(String.format("Element does not meet condition %1$s", condition.toString()));
}
} | java | public void waitAndAssertForExpectedCondition(ExpectedCondition<?> condition, int timeout) {
if (!waitForExpectedCondition(condition, timeout)) {
fail(String.format("Element does not meet condition %1$s", condition.toString()));
}
} | [
"public",
"void",
"waitAndAssertForExpectedCondition",
"(",
"ExpectedCondition",
"<",
"?",
">",
"condition",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"!",
"waitForExpectedCondition",
"(",
"condition",
",",
"timeout",
")",
")",
"{",
"fail",
"(",
"String",
".... | Waits until the expectations are met and throws an assert if not
@param condition The conditions the element should meet
@param timeout The timeout to wait | [
"Waits",
"until",
"the",
"expectations",
"are",
"met",
"and",
"throws",
"an",
"assert",
"if",
"not"
] | train | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java#L64-L68 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java | CassandraDataHandlerBase.getFieldValueViaCQL | private Object getFieldValueViaCQL(Object thriftColumnValue, Attribute attribute)
{
PropertyAccessor<?> accessor = PropertyAccessorFactory.getPropertyAccessor((Field) attribute.getJavaMember());
Object objValue;
try
{
if (CassandraDataTranslator.isCassandraDataTypeClass(((AbstractAttribute) attribute).getBindableJavaType()))
{
objValue = CassandraDataTranslator.decompose(((AbstractAttribute) attribute).getBindableJavaType(),
thriftColumnValue, true);
return objValue;
}
else
{
objValue = accessor.fromBytes(((AbstractAttribute) attribute).getBindableJavaType(),
(byte[]) thriftColumnValue);
return objValue;
}
}
catch (PropertyAccessException pae)
{
log.warn("Error while setting field{} value via CQL, Caused by: .", attribute.getName(), pae);
}
return null;
} | java | private Object getFieldValueViaCQL(Object thriftColumnValue, Attribute attribute)
{
PropertyAccessor<?> accessor = PropertyAccessorFactory.getPropertyAccessor((Field) attribute.getJavaMember());
Object objValue;
try
{
if (CassandraDataTranslator.isCassandraDataTypeClass(((AbstractAttribute) attribute).getBindableJavaType()))
{
objValue = CassandraDataTranslator.decompose(((AbstractAttribute) attribute).getBindableJavaType(),
thriftColumnValue, true);
return objValue;
}
else
{
objValue = accessor.fromBytes(((AbstractAttribute) attribute).getBindableJavaType(),
(byte[]) thriftColumnValue);
return objValue;
}
}
catch (PropertyAccessException pae)
{
log.warn("Error while setting field{} value via CQL, Caused by: .", attribute.getName(), pae);
}
return null;
} | [
"private",
"Object",
"getFieldValueViaCQL",
"(",
"Object",
"thriftColumnValue",
",",
"Attribute",
"attribute",
")",
"{",
"PropertyAccessor",
"<",
"?",
">",
"accessor",
"=",
"PropertyAccessorFactory",
".",
"getPropertyAccessor",
"(",
"(",
"Field",
")",
"attribute",
"... | Gets the field value via cql.
@param thriftColumnValue
the thrift column value
@param attribute
the attribute
@return the field value via cql | [
"Gets",
"the",
"field",
"value",
"via",
"cql",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java#L1828-L1852 |
alkacon/opencms-core | src/org/opencms/cmis/CmsCmisUtil.java | CmsCmisUtil.ensureLock | public static boolean ensureLock(CmsObject cms, CmsResource resource) throws CmsException {
CmsLock lock = cms.getLock(resource);
if (lock.isOwnedBy(cms.getRequestContext().getCurrentUser())) {
return false;
}
cms.lockResourceTemporary(resource);
return true;
} | java | public static boolean ensureLock(CmsObject cms, CmsResource resource) throws CmsException {
CmsLock lock = cms.getLock(resource);
if (lock.isOwnedBy(cms.getRequestContext().getCurrentUser())) {
return false;
}
cms.lockResourceTemporary(resource);
return true;
} | [
"public",
"static",
"boolean",
"ensureLock",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"CmsLock",
"lock",
"=",
"cms",
".",
"getLock",
"(",
"resource",
")",
";",
"if",
"(",
"lock",
".",
"isOwnedBy",
"(",
"c... | Tries to lock a resource and throws an exception if it can't be locked.<p>
Returns true only if the resource wasn't already locked before.<p>
@param cms the CMS context
@param resource the resource to lock
@return true if the resource wasn't already locked
@throws CmsException if something goes wrong | [
"Tries",
"to",
"lock",
"a",
"resource",
"and",
"throws",
"an",
"exception",
"if",
"it",
"can",
"t",
"be",
"locked",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisUtil.java#L434-L442 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java | MPEGAudioFrameHeader.findSampleRate | private int findSampleRate(int sampleIndex, int version)
{
int ind = -1;
switch (version)
{
case MPEG_V_1:
ind = 0;
break;
case MPEG_V_2:
ind = 1;
break;
case MPEG_V_25:
ind = 2;
}
if ((ind != -1) && (sampleIndex >= 0) && (sampleIndex <= 3))
{
return sampleTable[sampleIndex][ind];
}
return -1;
} | java | private int findSampleRate(int sampleIndex, int version)
{
int ind = -1;
switch (version)
{
case MPEG_V_1:
ind = 0;
break;
case MPEG_V_2:
ind = 1;
break;
case MPEG_V_25:
ind = 2;
}
if ((ind != -1) && (sampleIndex >= 0) && (sampleIndex <= 3))
{
return sampleTable[sampleIndex][ind];
}
return -1;
} | [
"private",
"int",
"findSampleRate",
"(",
"int",
"sampleIndex",
",",
"int",
"version",
")",
"{",
"int",
"ind",
"=",
"-",
"1",
";",
"switch",
"(",
"version",
")",
"{",
"case",
"MPEG_V_1",
":",
"ind",
"=",
"0",
";",
"break",
";",
"case",
"MPEG_V_2",
":"... | Based on the sample rate index found in the header, attempt to lookup
and set the sample rate from the table.
@param sampleIndex the sample rate index read from the header | [
"Based",
"on",
"the",
"sample",
"rate",
"index",
"found",
"in",
"the",
"header",
"attempt",
"to",
"lookup",
"and",
"set",
"the",
"sample",
"rate",
"from",
"the",
"table",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MPEGAudioFrameHeader.java#L295-L316 |
appium/java-client | src/main/java/io/appium/java_client/screenrecording/ScreenRecordingUploadOptions.java | ScreenRecordingUploadOptions.withAuthCredentials | public ScreenRecordingUploadOptions withAuthCredentials(String user, String pass) {
this.user = checkNotNull(user);
this.pass = checkNotNull(pass);
return this;
} | java | public ScreenRecordingUploadOptions withAuthCredentials(String user, String pass) {
this.user = checkNotNull(user);
this.pass = checkNotNull(pass);
return this;
} | [
"public",
"ScreenRecordingUploadOptions",
"withAuthCredentials",
"(",
"String",
"user",
",",
"String",
"pass",
")",
"{",
"this",
".",
"user",
"=",
"checkNotNull",
"(",
"user",
")",
";",
"this",
".",
"pass",
"=",
"checkNotNull",
"(",
"pass",
")",
";",
"return... | Sets the credentials for remote ftp/http authentication (if needed).
This option only has an effect if remotePath is provided.
@param user The name of the user for the remote authentication.
@param pass The password for the remote authentication.
@return self instance for chaining. | [
"Sets",
"the",
"credentials",
"for",
"remote",
"ftp",
"/",
"http",
"authentication",
"(",
"if",
"needed",
")",
".",
"This",
"option",
"only",
"has",
"an",
"effect",
"if",
"remotePath",
"is",
"provided",
"."
] | train | https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/screenrecording/ScreenRecordingUploadOptions.java#L55-L59 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java | Stoichiometry.setStrategy | public void setStrategy(StringOverflowStrategy strategy) {
if(strategy==StringOverflowStrategy.CUSTOM) {
throw new IllegalArgumentException("Set this strategy by providing a function of the type Function<List<SubunitCluster>,String>.");
}
if(this.strategy != strategy) {
this.strategy = strategy;
if(orderedClusters.size()>alphabet.length())
doResetAlphas();
}
} | java | public void setStrategy(StringOverflowStrategy strategy) {
if(strategy==StringOverflowStrategy.CUSTOM) {
throw new IllegalArgumentException("Set this strategy by providing a function of the type Function<List<SubunitCluster>,String>.");
}
if(this.strategy != strategy) {
this.strategy = strategy;
if(orderedClusters.size()>alphabet.length())
doResetAlphas();
}
} | [
"public",
"void",
"setStrategy",
"(",
"StringOverflowStrategy",
"strategy",
")",
"{",
"if",
"(",
"strategy",
"==",
"StringOverflowStrategy",
".",
"CUSTOM",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Set this strategy by providing a function of the type Fu... | Change string representation of a stoichiometry in case number of clusters exceeds number of letters in the alphabet.
This action may invalidate alphas already assigned to the clusters.
@param strategy
{@link StringOverflowStrategy} used in this stoichiometry
to construct human-readable representation in case number
of clusters exceeds number of letters in the alphabet. | [
"Change",
"string",
"representation",
"of",
"a",
"stoichiometry",
"in",
"case",
"number",
"of",
"clusters",
"exceeds",
"number",
"of",
"letters",
"in",
"the",
"alphabet",
".",
"This",
"action",
"may",
"invalidate",
"alphas",
"already",
"assigned",
"to",
"the",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java#L285-L295 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/MapView.java | MapView.setTileProvider | public void setTileProvider(final MapTileProviderBase base){
this.mTileProvider.detach();
mTileProvider.clearTileCache();
this.mTileProvider=base;
mTileProvider.getTileRequestCompleteHandlers().add(mTileRequestCompleteHandler);
updateTileSizeForDensity(mTileProvider.getTileSource());
this.mMapOverlay = new TilesOverlay(mTileProvider, this.getContext(), horizontalMapRepetitionEnabled, verticalMapRepetitionEnabled);
mOverlayManager.setTilesOverlay(mMapOverlay);
invalidate();
} | java | public void setTileProvider(final MapTileProviderBase base){
this.mTileProvider.detach();
mTileProvider.clearTileCache();
this.mTileProvider=base;
mTileProvider.getTileRequestCompleteHandlers().add(mTileRequestCompleteHandler);
updateTileSizeForDensity(mTileProvider.getTileSource());
this.mMapOverlay = new TilesOverlay(mTileProvider, this.getContext(), horizontalMapRepetitionEnabled, verticalMapRepetitionEnabled);
mOverlayManager.setTilesOverlay(mMapOverlay);
invalidate();
} | [
"public",
"void",
"setTileProvider",
"(",
"final",
"MapTileProviderBase",
"base",
")",
"{",
"this",
".",
"mTileProvider",
".",
"detach",
"(",
")",
";",
"mTileProvider",
".",
"clearTileCache",
"(",
")",
";",
"this",
".",
"mTileProvider",
"=",
"base",
";",
"mT... | enables you to programmatically set the tile provider (zip, assets, sqlite, etc)
@since 4.4
@param base
@see MapTileProviderBasic | [
"enables",
"you",
"to",
"programmatically",
"set",
"the",
"tile",
"provider",
"(",
"zip",
"assets",
"sqlite",
"etc",
")"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/MapView.java#L1768-L1779 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.methodInvocation | public static Matcher<ExpressionTree> methodInvocation(
final Matcher<ExpressionTree> methodSelectMatcher) {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
if (!(expressionTree instanceof MethodInvocationTree)) {
return false;
}
MethodInvocationTree tree = (MethodInvocationTree) expressionTree;
return methodSelectMatcher.matches(tree.getMethodSelect(), state);
}
};
} | java | public static Matcher<ExpressionTree> methodInvocation(
final Matcher<ExpressionTree> methodSelectMatcher) {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
if (!(expressionTree instanceof MethodInvocationTree)) {
return false;
}
MethodInvocationTree tree = (MethodInvocationTree) expressionTree;
return methodSelectMatcher.matches(tree.getMethodSelect(), state);
}
};
} | [
"public",
"static",
"Matcher",
"<",
"ExpressionTree",
">",
"methodInvocation",
"(",
"final",
"Matcher",
"<",
"ExpressionTree",
">",
"methodSelectMatcher",
")",
"{",
"return",
"new",
"Matcher",
"<",
"ExpressionTree",
">",
"(",
")",
"{",
"@",
"Override",
"public",... | Matches an AST node if it is a method invocation and the method select matches {@code
methodSelectMatcher}. Ignores any arguments. | [
"Matches",
"an",
"AST",
"node",
"if",
"it",
"is",
"a",
"method",
"invocation",
"and",
"the",
"method",
"select",
"matches",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L374-L386 |
gs2io/gs2-java-sdk-core | src/main/java/io/gs2/AbstractGs2Client.java | AbstractGs2Client.createHttpPut | protected HttpPut createHttpPut(String url, IGs2Credential credential, String service, String module, String function, String body) {
Long timestamp = System.currentTimeMillis()/1000;
url = StringUtils.replace(url, "{service}", service);
url = StringUtils.replace(url, "{region}", region.getName());
HttpPut put = new HttpPut(url);
put.setHeader("Content-Type", "application/json");
credential.authorized(put, service, module, function, timestamp);
put.setEntity(new StringEntity(body, "UTF-8"));
return put;
} | java | protected HttpPut createHttpPut(String url, IGs2Credential credential, String service, String module, String function, String body) {
Long timestamp = System.currentTimeMillis()/1000;
url = StringUtils.replace(url, "{service}", service);
url = StringUtils.replace(url, "{region}", region.getName());
HttpPut put = new HttpPut(url);
put.setHeader("Content-Type", "application/json");
credential.authorized(put, service, module, function, timestamp);
put.setEntity(new StringEntity(body, "UTF-8"));
return put;
} | [
"protected",
"HttpPut",
"createHttpPut",
"(",
"String",
"url",
",",
"IGs2Credential",
"credential",
",",
"String",
"service",
",",
"String",
"module",
",",
"String",
"function",
",",
"String",
"body",
")",
"{",
"Long",
"timestamp",
"=",
"System",
".",
"current... | POSTリクエストを生成
@param url アクセス先URL
@param credential 認証情報
@param service アクセス先サービス
@param module アクセス先モジュール
@param function アクセス先ファンクション
@param body リクエストボディ
@return リクエストオブジェクト | [
"POSTリクエストを生成"
] | train | https://github.com/gs2io/gs2-java-sdk-core/blob/fe66ee4e374664b101b07c41221a3b32c844127d/src/main/java/io/gs2/AbstractGs2Client.java#L137-L146 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ListAttributeDefinition.java | ListAttributeDefinition.parseAndSetParameter | @Deprecated
public void parseAndSetParameter(String value, ModelNode operation, XMLStreamReader reader) throws XMLStreamException {
//we use manual parsing here, and not #getParser().. to preserve backward compatibility.
if (value != null) {
for (String element : value.split(",")) {
parseAndAddParameterElement(element.trim(), operation, reader);
}
}
} | java | @Deprecated
public void parseAndSetParameter(String value, ModelNode operation, XMLStreamReader reader) throws XMLStreamException {
//we use manual parsing here, and not #getParser().. to preserve backward compatibility.
if (value != null) {
for (String element : value.split(",")) {
parseAndAddParameterElement(element.trim(), operation, reader);
}
}
} | [
"@",
"Deprecated",
"public",
"void",
"parseAndSetParameter",
"(",
"String",
"value",
",",
"ModelNode",
"operation",
",",
"XMLStreamReader",
"reader",
")",
"throws",
"XMLStreamException",
"{",
"//we use manual parsing here, and not #getParser().. to preserve backward compatibility... | Parses whole value as list attribute
@deprecated in favour of using {@link AttributeParser attribute parser}
@param value String with "," separated string elements
@param operation operation to with this list elements are added
@param reader xml reader from where reading is be done
@throws XMLStreamException if {@code value} is not valid | [
"Parses",
"whole",
"value",
"as",
"list",
"attribute"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ListAttributeDefinition.java#L240-L248 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/RSA.java | RSA.encryptStr | @Deprecated
public String encryptStr(String data, KeyType keyType) {
return encryptBcd(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | java | @Deprecated
public String encryptStr(String data, KeyType keyType) {
return encryptBcd(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | [
"@",
"Deprecated",
"public",
"String",
"encryptStr",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"encryptBcd",
"(",
"data",
",",
"keyType",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 分组加密
@param data 数据
@param keyType 密钥类型
@return 加密后的密文
@throws CryptoException 加密异常
@deprecated 请使用 {@link #encryptBcd(String, KeyType)} | [
"分组加密"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/RSA.java#L127-L130 |
alrocar/POIProxy | es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/LRUVectorTileCache.java | LRUVectorTileCache.put | public synchronized Object put(final String key, final Object value) {
try {
if (maxCacheSize == 0) {
return null;
}
// if the key isn't in the cache and the cache is full...
if (!super.containsKey(key) && !list.isEmpty()
&& list.size() + 1 > maxCacheSize) {
final Object deadKey = list.removeLast();
super.remove(deadKey);
}
updateKey(key);
} catch (Exception e) {
log.log(Level.SEVERE, "put", e);
}
return super.put(key, value);
} | java | public synchronized Object put(final String key, final Object value) {
try {
if (maxCacheSize == 0) {
return null;
}
// if the key isn't in the cache and the cache is full...
if (!super.containsKey(key) && !list.isEmpty()
&& list.size() + 1 > maxCacheSize) {
final Object deadKey = list.removeLast();
super.remove(deadKey);
}
updateKey(key);
} catch (Exception e) {
log.log(Level.SEVERE, "put", e);
}
return super.put(key, value);
} | [
"public",
"synchronized",
"Object",
"put",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"try",
"{",
"if",
"(",
"maxCacheSize",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"// if the key isn't in the cache and the cache is full..... | Adds an Object to the cache. If the cache is full, removes the last | [
"Adds",
"an",
"Object",
"to",
"the",
"cache",
".",
"If",
"the",
"cache",
"is",
"full",
"removes",
"the",
"last"
] | train | https://github.com/alrocar/POIProxy/blob/e1dabe738a862478b2580e90d5fc4209a2997868/es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/LRUVectorTileCache.java#L82-L100 |
code4craft/webmagic | webmagic-core/src/main/java/us/codecraft/webmagic/Site.java | Site.addCookie | public Site addCookie(String domain, String name, String value) {
if (!cookies.containsKey(domain)){
cookies.put(domain,new HashMap<String, String>());
}
cookies.get(domain).put(name, value);
return this;
} | java | public Site addCookie(String domain, String name, String value) {
if (!cookies.containsKey(domain)){
cookies.put(domain,new HashMap<String, String>());
}
cookies.get(domain).put(name, value);
return this;
} | [
"public",
"Site",
"addCookie",
"(",
"String",
"domain",
",",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"!",
"cookies",
".",
"containsKey",
"(",
"domain",
")",
")",
"{",
"cookies",
".",
"put",
"(",
"domain",
",",
"new",
"HashMap",
... | Add a cookie with specific domain.
@param domain domain
@param name name
@param value value
@return this | [
"Add",
"a",
"cookie",
"with",
"specific",
"domain",
"."
] | train | https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Site.java#L79-L85 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java | BigRational.valueOf | public static BigRational valueOf(BigDecimal numerator, BigDecimal denominator) {
return valueOf(numerator).divide(valueOf(denominator));
} | java | public static BigRational valueOf(BigDecimal numerator, BigDecimal denominator) {
return valueOf(numerator).divide(valueOf(denominator));
} | [
"public",
"static",
"BigRational",
"valueOf",
"(",
"BigDecimal",
"numerator",
",",
"BigDecimal",
"denominator",
")",
"{",
"return",
"valueOf",
"(",
"numerator",
")",
".",
"divide",
"(",
"valueOf",
"(",
"denominator",
")",
")",
";",
"}"
] | Creates a rational number of the specified numerator/denominator BigDecimal values.
@param numerator the numerator {@link BigDecimal} value
@param denominator the denominator {@link BigDecimal} value (0 not allowed)
@return the rational number
@throws ArithmeticException if the denominator is 0 (division by zero) | [
"Creates",
"a",
"rational",
"number",
"of",
"the",
"specified",
"numerator",
"/",
"denominator",
"BigDecimal",
"values",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java#L999-L1001 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/util/IOHelper.java | IOHelper.httpGet | public static InputStream httpGet(final String httpurl, final Map<String, String>... requestProperties) throws IOException {
HttpURLConnection connection = (HttpURLConnection) new URL(httpurl).openConnection();
for (Map<String, String> props : requestProperties) {
addRequestProperties(props, connection);
}
return connection.getInputStream();
} | java | public static InputStream httpGet(final String httpurl, final Map<String, String>... requestProperties) throws IOException {
HttpURLConnection connection = (HttpURLConnection) new URL(httpurl).openConnection();
for (Map<String, String> props : requestProperties) {
addRequestProperties(props, connection);
}
return connection.getInputStream();
} | [
"public",
"static",
"InputStream",
"httpGet",
"(",
"final",
"String",
"httpurl",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"...",
"requestProperties",
")",
"throws",
"IOException",
"{",
"HttpURLConnection",
"connection",
"=",
"(",
"HttpURLConnection"... | Simple http get imlementation. Supports HTTP Basic authentication via request properties. You
may want to use {@link #createBasicAuthenticationProperty} to add authentication.
@param httpurl
get url
@param requestProperties
optional http header fields (key->value)
@return input stream of response
@throws IOException | [
"Simple",
"http",
"get",
"imlementation",
".",
"Supports",
"HTTP",
"Basic",
"authentication",
"via",
"request",
"properties",
".",
"You",
"may",
"want",
"to",
"use",
"{",
"@link",
"#createBasicAuthenticationProperty",
"}",
"to",
"add",
"authentication",
"."
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/util/IOHelper.java#L97-L103 |
moparisthebest/beehive | beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlChecker.java | JdbcControlChecker.check | public void check(Declaration decl, AnnotationProcessorEnvironment env) {
_locale = Locale.getDefault();
if (decl instanceof TypeDeclaration) {
//
// Check method annotations
//
Collection<? extends MethodDeclaration> methods = ((TypeDeclaration) decl).getMethods();
for (MethodDeclaration method : methods) {
checkSQL(method, env);
}
} else if (decl instanceof FieldDeclaration) {
//
// NOOP
//
} else {
//
// NOOP
//
}
} | java | public void check(Declaration decl, AnnotationProcessorEnvironment env) {
_locale = Locale.getDefault();
if (decl instanceof TypeDeclaration) {
//
// Check method annotations
//
Collection<? extends MethodDeclaration> methods = ((TypeDeclaration) decl).getMethods();
for (MethodDeclaration method : methods) {
checkSQL(method, env);
}
} else if (decl instanceof FieldDeclaration) {
//
// NOOP
//
} else {
//
// NOOP
//
}
} | [
"public",
"void",
"check",
"(",
"Declaration",
"decl",
",",
"AnnotationProcessorEnvironment",
"env",
")",
"{",
"_locale",
"=",
"Locale",
".",
"getDefault",
"(",
")",
";",
"if",
"(",
"decl",
"instanceof",
"TypeDeclaration",
")",
"{",
"//",
"// Check method annota... | Invoked by the control build-time infrastructure to process a declaration of
a control extension (ie, an interface annotated with @ControlExtension), or
a field instance of a control type. | [
"Invoked",
"by",
"the",
"control",
"build",
"-",
"time",
"infrastructure",
"to",
"process",
"a",
"declaration",
"of",
"a",
"control",
"extension",
"(",
"ie",
"an",
"interface",
"annotated",
"with"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlChecker.java#L57-L82 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/knopflerfish/service/log/LogUtil.java | LogUtil.toLevel | static public int toLevel(String level, int def) {
if (level.equalsIgnoreCase("INFO")) {
return LogService.LOG_INFO;
} else if (level.equalsIgnoreCase("DEBUG")) {
return LogService.LOG_DEBUG;
} else if (level.equalsIgnoreCase("WARNING")) {
return LogService.LOG_WARNING;
} else if (level.equalsIgnoreCase("ERROR")) {
return LogService.LOG_ERROR;
} else if (level.equalsIgnoreCase("DEFAULT")) {
return 0;
}
return def;
} | java | static public int toLevel(String level, int def) {
if (level.equalsIgnoreCase("INFO")) {
return LogService.LOG_INFO;
} else if (level.equalsIgnoreCase("DEBUG")) {
return LogService.LOG_DEBUG;
} else if (level.equalsIgnoreCase("WARNING")) {
return LogService.LOG_WARNING;
} else if (level.equalsIgnoreCase("ERROR")) {
return LogService.LOG_ERROR;
} else if (level.equalsIgnoreCase("DEFAULT")) {
return 0;
}
return def;
} | [
"static",
"public",
"int",
"toLevel",
"(",
"String",
"level",
",",
"int",
"def",
")",
"{",
"if",
"(",
"level",
".",
"equalsIgnoreCase",
"(",
"\"INFO\"",
")",
")",
"{",
"return",
"LogService",
".",
"LOG_INFO",
";",
"}",
"else",
"if",
"(",
"level",
".",
... | * Converts a string representing a log severity level to an int. * *
@param level
The string to convert. *
@param def
Default value to use if the string is not * recognized as a
log level. *
@return the log level, or the default value if the string can * not be
recognized. | [
"*",
"Converts",
"a",
"string",
"representing",
"a",
"log",
"severity",
"level",
"to",
"an",
"int",
".",
"*",
"*"
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/knopflerfish/service/log/LogUtil.java#L107-L120 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java | ImagePipeline.prefetchToDiskCache | public DataSource<Void> prefetchToDiskCache(
ImageRequest imageRequest,
Object callerContext) {
return prefetchToDiskCache(imageRequest, callerContext, Priority.MEDIUM);
} | java | public DataSource<Void> prefetchToDiskCache(
ImageRequest imageRequest,
Object callerContext) {
return prefetchToDiskCache(imageRequest, callerContext, Priority.MEDIUM);
} | [
"public",
"DataSource",
"<",
"Void",
">",
"prefetchToDiskCache",
"(",
"ImageRequest",
"imageRequest",
",",
"Object",
"callerContext",
")",
"{",
"return",
"prefetchToDiskCache",
"(",
"imageRequest",
",",
"callerContext",
",",
"Priority",
".",
"MEDIUM",
")",
";",
"}... | Submits a request for prefetching to the disk cache with a default priority.
<p> Beware that if your network fetcher doesn't support priorities prefetch requests may slow
down images which are immediately required on screen.
@param imageRequest the request to submit
@return a DataSource that can safely be ignored. | [
"Submits",
"a",
"request",
"for",
"prefetching",
"to",
"the",
"disk",
"cache",
"with",
"a",
"default",
"priority",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java#L387-L391 |
stevespringett/Alpine | alpine/src/main/java/alpine/resources/Pagination.java | Pagination.parseIntegerFromParam | private Integer parseIntegerFromParam(final String value, final int defaultValue) {
try {
return Integer.valueOf(value);
} catch (NumberFormatException | NullPointerException e) {
return defaultValue;
}
} | java | private Integer parseIntegerFromParam(final String value, final int defaultValue) {
try {
return Integer.valueOf(value);
} catch (NumberFormatException | NullPointerException e) {
return defaultValue;
}
} | [
"private",
"Integer",
"parseIntegerFromParam",
"(",
"final",
"String",
"value",
",",
"final",
"int",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"valueOf",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"|",
"NullPointe... | Parses a parameter to an Integer, defaulting to 0 upon any errors encountered.
@param value the value to parse
@param defaultValue the default value to use
@return an Integer | [
"Parses",
"a",
"parameter",
"to",
"an",
"Integer",
"defaulting",
"to",
"0",
"upon",
"any",
"errors",
"encountered",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/resources/Pagination.java#L121-L127 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java | Tuple12.setFields | public void setFields(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11) {
this.f0 = value0;
this.f1 = value1;
this.f2 = value2;
this.f3 = value3;
this.f4 = value4;
this.f5 = value5;
this.f6 = value6;
this.f7 = value7;
this.f8 = value8;
this.f9 = value9;
this.f10 = value10;
this.f11 = value11;
} | java | public void setFields(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11) {
this.f0 = value0;
this.f1 = value1;
this.f2 = value2;
this.f3 = value3;
this.f4 = value4;
this.f5 = value5;
this.f6 = value6;
this.f7 = value7;
this.f8 = value8;
this.f9 = value9;
this.f10 = value10;
this.f11 = value11;
} | [
"public",
"void",
"setFields",
"(",
"T0",
"value0",
",",
"T1",
"value1",
",",
"T2",
"value2",
",",
"T3",
"value3",
",",
"T4",
"value4",
",",
"T5",
"value5",
",",
"T6",
"value6",
",",
"T7",
"value7",
",",
"T8",
"value8",
",",
"T9",
"value9",
",",
"T... | Sets new values to all fields of the tuple.
@param value0 The value for field 0
@param value1 The value for field 1
@param value2 The value for field 2
@param value3 The value for field 3
@param value4 The value for field 4
@param value5 The value for field 5
@param value6 The value for field 6
@param value7 The value for field 7
@param value8 The value for field 8
@param value9 The value for field 9
@param value10 The value for field 10
@param value11 The value for field 11 | [
"Sets",
"new",
"values",
"to",
"all",
"fields",
"of",
"the",
"tuple",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java#L210-L223 |
jenkinsci/jenkins | core/src/main/java/jenkins/security/UpdateSiteWarningsMonitor.java | UpdateSiteWarningsMonitor.doForward | @RequirePOST
public HttpResponse doForward(@QueryParameter String fix, @QueryParameter String configure) {
if (fix != null) {
return HttpResponses.redirectViaContextPath("pluginManager");
}
if (configure != null) {
return HttpResponses.redirectViaContextPath("configureSecurity");
}
// shouldn't happen
return HttpResponses.redirectViaContextPath("/");
} | java | @RequirePOST
public HttpResponse doForward(@QueryParameter String fix, @QueryParameter String configure) {
if (fix != null) {
return HttpResponses.redirectViaContextPath("pluginManager");
}
if (configure != null) {
return HttpResponses.redirectViaContextPath("configureSecurity");
}
// shouldn't happen
return HttpResponses.redirectViaContextPath("/");
} | [
"@",
"RequirePOST",
"public",
"HttpResponse",
"doForward",
"(",
"@",
"QueryParameter",
"String",
"fix",
",",
"@",
"QueryParameter",
"String",
"configure",
")",
"{",
"if",
"(",
"fix",
"!=",
"null",
")",
"{",
"return",
"HttpResponses",
".",
"redirectViaContextPath... | Redirects the user to the plugin manager or security configuration | [
"Redirects",
"the",
"user",
"to",
"the",
"plugin",
"manager",
"or",
"security",
"configuration"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/UpdateSiteWarningsMonitor.java#L139-L150 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficaction.java | vpntrafficaction.get | public static vpntrafficaction get(nitro_service service, String name) throws Exception{
vpntrafficaction obj = new vpntrafficaction();
obj.set_name(name);
vpntrafficaction response = (vpntrafficaction) obj.get_resource(service);
return response;
} | java | public static vpntrafficaction get(nitro_service service, String name) throws Exception{
vpntrafficaction obj = new vpntrafficaction();
obj.set_name(name);
vpntrafficaction response = (vpntrafficaction) obj.get_resource(service);
return response;
} | [
"public",
"static",
"vpntrafficaction",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"vpntrafficaction",
"obj",
"=",
"new",
"vpntrafficaction",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"... | Use this API to fetch vpntrafficaction resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpntrafficaction",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficaction.java#L450-L455 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.getPropertiesFromComputeNodeAsync | public Observable<Void> getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath) {
return getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).map(new Func1<ServiceResponseWithHeaders<Void, FileGetPropertiesFromComputeNodeHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, FileGetPropertiesFromComputeNodeHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> getPropertiesFromComputeNodeAsync(String poolId, String nodeId, String filePath) {
return getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).map(new Func1<ServiceResponseWithHeaders<Void, FileGetPropertiesFromComputeNodeHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, FileGetPropertiesFromComputeNodeHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"getPropertiesFromComputeNodeAsync",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"filePath",
")",
"{",
"return",
"getPropertiesFromComputeNodeWithServiceResponseAsync",
"(",
"poolId",
",",
"nodeId",
",",
"... | Gets the properties of the specified compute node file.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node that contains the file.
@param filePath The path to the compute node file that you want to get the properties of.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"compute",
"node",
"file",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L1393-L1400 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java | ReadSecondaryHandler.addFieldSeqPair | public MoveOnValidHandler addFieldSeqPair(int iDestFieldSeq, int iSourceFieldSeq, boolean bMoveToDependent, boolean bMoveBackOnChange, Converter convCheckMark, Converter convBackconvCheckMark)
{ // BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es
return this.addFieldPair(this.getOwner().getRecord().getField(iDestFieldSeq), m_record.getField(iSourceFieldSeq),
bMoveToDependent, bMoveBackOnChange, convCheckMark, convBackconvCheckMark);
} | java | public MoveOnValidHandler addFieldSeqPair(int iDestFieldSeq, int iSourceFieldSeq, boolean bMoveToDependent, boolean bMoveBackOnChange, Converter convCheckMark, Converter convBackconvCheckMark)
{ // BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es
return this.addFieldPair(this.getOwner().getRecord().getField(iDestFieldSeq), m_record.getField(iSourceFieldSeq),
bMoveToDependent, bMoveBackOnChange, convCheckMark, convBackconvCheckMark);
} | [
"public",
"MoveOnValidHandler",
"addFieldSeqPair",
"(",
"int",
"iDestFieldSeq",
",",
"int",
"iSourceFieldSeq",
",",
"boolean",
"bMoveToDependent",
",",
"boolean",
"bMoveBackOnChange",
",",
"Converter",
"convCheckMark",
",",
"Converter",
"convBackconvCheckMark",
")",
"{",
... | Add the set of fields that will move on a valid record.
@param iDestFieldSeq The destination field.
@param iSourceFieldSeq The source field.
@param bMoveToDependent If true adds a MoveOnValidHandler to the secondary record.
@param bMoveBackOnChange If true, adds a CopyFieldHandler to the destination field (moves to the source).
@param convCheckMark Check mark to check before moving.
@param convBackconvCheckMark Check mark to check before moving back. | [
"Add",
"the",
"set",
"of",
"fields",
"that",
"will",
"move",
"on",
"a",
"valid",
"record",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java#L264-L268 |
menacher/java-game-server | jetserver/src/main/java/org/menacheri/jetserver/handlers/netty/LoginHandler.java | LoginHandler.loginUdp | protected void loginUdp(PlayerSession playerSession, ChannelBuffer buffer)
{
InetSocketAddress remoteAdress = NettyUtils.readSocketAddress(buffer);
if(null != remoteAdress)
{
udpSessionRegistry.putSession(remoteAdress, playerSession);
}
} | java | protected void loginUdp(PlayerSession playerSession, ChannelBuffer buffer)
{
InetSocketAddress remoteAdress = NettyUtils.readSocketAddress(buffer);
if(null != remoteAdress)
{
udpSessionRegistry.putSession(remoteAdress, playerSession);
}
} | [
"protected",
"void",
"loginUdp",
"(",
"PlayerSession",
"playerSession",
",",
"ChannelBuffer",
"buffer",
")",
"{",
"InetSocketAddress",
"remoteAdress",
"=",
"NettyUtils",
".",
"readSocketAddress",
"(",
"buffer",
")",
";",
"if",
"(",
"null",
"!=",
"remoteAdress",
")... | This method adds the player session to the
{@link SessionRegistryService}. The key being the remote udp address of
the client and the session being the value.
@param playerSession
@param buffer
Used to read the remote address of the client which is
attempting to connect via udp. | [
"This",
"method",
"adds",
"the",
"player",
"session",
"to",
"the",
"{",
"@link",
"SessionRegistryService",
"}",
".",
"The",
"key",
"being",
"the",
"remote",
"udp",
"address",
"of",
"the",
"client",
"and",
"the",
"session",
"being",
"the",
"value",
"."
] | train | https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetserver/src/main/java/org/menacheri/jetserver/handlers/netty/LoginHandler.java#L264-L271 |
spring-projects/spring-social | spring-social-web/src/main/java/org/springframework/social/connect/web/ConnectController.java | ConnectController.oauth1Callback | @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="oauth_token")
public RedirectView oauth1Callback(@PathVariable String providerId, NativeWebRequest request) {
try {
OAuth1ConnectionFactory<?> connectionFactory = (OAuth1ConnectionFactory<?>) connectionFactoryLocator.getConnectionFactory(providerId);
Connection<?> connection = connectSupport.completeConnection(connectionFactory, request);
addConnection(connection, connectionFactory, request);
} catch (Exception e) {
sessionStrategy.setAttribute(request, PROVIDER_ERROR_ATTRIBUTE, e);
logger.warn("Exception while handling OAuth1 callback (" + e.getMessage() + "). Redirecting to " + providerId +" connection status page.");
}
return connectionStatusRedirect(providerId, request);
} | java | @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="oauth_token")
public RedirectView oauth1Callback(@PathVariable String providerId, NativeWebRequest request) {
try {
OAuth1ConnectionFactory<?> connectionFactory = (OAuth1ConnectionFactory<?>) connectionFactoryLocator.getConnectionFactory(providerId);
Connection<?> connection = connectSupport.completeConnection(connectionFactory, request);
addConnection(connection, connectionFactory, request);
} catch (Exception e) {
sessionStrategy.setAttribute(request, PROVIDER_ERROR_ATTRIBUTE, e);
logger.warn("Exception while handling OAuth1 callback (" + e.getMessage() + "). Redirecting to " + providerId +" connection status page.");
}
return connectionStatusRedirect(providerId, request);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/{providerId}\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
",",
"params",
"=",
"\"oauth_token\"",
")",
"public",
"RedirectView",
"oauth1Callback",
"(",
"@",
"PathVariable",
"String",
"providerId",
",",
"NativeWe... | Process the authorization callback from an OAuth 1 service provider.
Called after the user authorizes the connection, generally done by having he or she click "Allow" in their web browser at the provider's site.
On authorization verification, connects the user's local account to the account they hold at the service provider
Removes the request token from the session since it is no longer valid after the connection is established.
@param providerId the provider ID to connect to
@param request the request
@return a RedirectView to the connection status page | [
"Process",
"the",
"authorization",
"callback",
"from",
"an",
"OAuth",
"1",
"service",
"provider",
".",
"Called",
"after",
"the",
"user",
"authorizes",
"the",
"connection",
"generally",
"done",
"by",
"having",
"he",
"or",
"she",
"click",
"Allow",
"in",
"their",... | train | https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-web/src/main/java/org/springframework/social/connect/web/ConnectController.java#L266-L277 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java | ImagesInner.createOrUpdateAsync | public Observable<ImageInner> createOrUpdateAsync(String resourceGroupName, String imageName, ImageInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1<ServiceResponse<ImageInner>, ImageInner>() {
@Override
public ImageInner call(ServiceResponse<ImageInner> response) {
return response.body();
}
});
} | java | public Observable<ImageInner> createOrUpdateAsync(String resourceGroupName, String imageName, ImageInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1<ServiceResponse<ImageInner>, ImageInner>() {
@Override
public ImageInner call(ServiceResponse<ImageInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImageInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"imageName",
",",
"ImageInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"imageName"... | Create or update an image.
@param resourceGroupName The name of the resource group.
@param imageName The name of the image.
@param parameters Parameters supplied to the Create Image operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"or",
"update",
"an",
"image",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java#L143-L150 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java | MetricContext.contextAwareTimer | public ContextAwareTimer contextAwareTimer(String name, long windowSize, TimeUnit unit) {
ContextAwareMetricFactoryArgs.SlidingTimeWindowArgs args = new ContextAwareMetricFactoryArgs.SlidingTimeWindowArgs(
this.innerMetricContext.getMetricContext().get(), name, windowSize, unit);
return this.innerMetricContext.getOrCreate(ContextAwareMetricFactory.DEFAULT_CONTEXT_AWARE_TIMER_FACTORY, args);
} | java | public ContextAwareTimer contextAwareTimer(String name, long windowSize, TimeUnit unit) {
ContextAwareMetricFactoryArgs.SlidingTimeWindowArgs args = new ContextAwareMetricFactoryArgs.SlidingTimeWindowArgs(
this.innerMetricContext.getMetricContext().get(), name, windowSize, unit);
return this.innerMetricContext.getOrCreate(ContextAwareMetricFactory.DEFAULT_CONTEXT_AWARE_TIMER_FACTORY, args);
} | [
"public",
"ContextAwareTimer",
"contextAwareTimer",
"(",
"String",
"name",
",",
"long",
"windowSize",
",",
"TimeUnit",
"unit",
")",
"{",
"ContextAwareMetricFactoryArgs",
".",
"SlidingTimeWindowArgs",
"args",
"=",
"new",
"ContextAwareMetricFactoryArgs",
".",
"SlidingTimeWi... | Get a {@link ContextAwareTimer} with a given name and a customized {@link com.codahale.metrics.SlidingTimeWindowReservoir}
@param name name of the {@link ContextAwareTimer}
@param windowSize normally the duration of the time window
@param unit the unit of time
@return the {@link ContextAwareTimer} with the given name | [
"Get",
"a",
"{",
"@link",
"ContextAwareTimer",
"}",
"with",
"a",
"given",
"name",
"and",
"a",
"customized",
"{",
"@link",
"com",
".",
"codahale",
".",
"metrics",
".",
"SlidingTimeWindowReservoir",
"}"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java#L503-L507 |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyPairFactory.java | KeyPairFactory.newKeyPair | public static KeyPair newKeyPair(final String algorithm, final int keySize)
throws NoSuchAlgorithmException, NoSuchProviderException
{
final KeyPairGenerator generator = newKeyPairGenerator(algorithm, keySize);
return generator.generateKeyPair();
} | java | public static KeyPair newKeyPair(final String algorithm, final int keySize)
throws NoSuchAlgorithmException, NoSuchProviderException
{
final KeyPairGenerator generator = newKeyPairGenerator(algorithm, keySize);
return generator.generateKeyPair();
} | [
"public",
"static",
"KeyPair",
"newKeyPair",
"(",
"final",
"String",
"algorithm",
",",
"final",
"int",
"keySize",
")",
"throws",
"NoSuchAlgorithmException",
",",
"NoSuchProviderException",
"{",
"final",
"KeyPairGenerator",
"generator",
"=",
"newKeyPairGenerator",
"(",
... | Factory method for creating a new {@link KeyPair} from the given parameters.
@param algorithm
the algorithm
@param keySize
the key size
@return the new {@link KeyPair} from the given parameters
@throws NoSuchAlgorithmException
is thrown if no Provider supports a KeyPairGeneratorSpi implementation for the
specified algorithm
@throws NoSuchProviderException
is thrown if the specified provider is not registered in the security provider
list | [
"Factory",
"method",
"for",
"creating",
"a",
"new",
"{",
"@link",
"KeyPair",
"}",
"from",
"the",
"given",
"parameters",
"."
] | train | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyPairFactory.java#L112-L117 |
watchrabbit/rabbit-commons | src/main/java/com/watchrabbit/commons/async/FutureContext.java | FutureContext.register | public static <T> void register(Future<T> future, Consumer<T> consumer, long timeout, TimeUnit timeUnit) {
LOGGER.debug("Registering new future {} and consumer {} with timeout {} {}", future, consumer, timeout, timeUnit);
getFutureContext().add(future, consumer, timeout, timeUnit);
} | java | public static <T> void register(Future<T> future, Consumer<T> consumer, long timeout, TimeUnit timeUnit) {
LOGGER.debug("Registering new future {} and consumer {} with timeout {} {}", future, consumer, timeout, timeUnit);
getFutureContext().add(future, consumer, timeout, timeUnit);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"register",
"(",
"Future",
"<",
"T",
">",
"future",
",",
"Consumer",
"<",
"T",
">",
"consumer",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Registering new futu... | Adds new {@code Future} and {@code Consumer} to the context of this
thread. To resolve this future and invoke the result consumer use method
{@link resolve()} Use this method to specify maximum {@code timeout} used
when obtaining object from {@code future}
@param <T> type of {@code future} and {@code consumer}
@param future {@code future} that returns argument of type {@code <T>}
used by {@code consumer}
@param consumer {@code consumer} of object obtained from {@code future}
@param timeout the maximum time to wait
@param timeUnit the time unit of the {@code timeout} argument | [
"Adds",
"new",
"{",
"@code",
"Future",
"}",
"and",
"{",
"@code",
"Consumer",
"}",
"to",
"the",
"context",
"of",
"this",
"thread",
".",
"To",
"resolve",
"this",
"future",
"and",
"invoke",
"the",
"result",
"consumer",
"use",
"method",
"{",
"@link",
"resolv... | train | https://github.com/watchrabbit/rabbit-commons/blob/b11c9f804b5ab70b9264635c34a02f5029bd2a5d/src/main/java/com/watchrabbit/commons/async/FutureContext.java#L78-L81 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/objects/Message.java | Message.setPremiumSMS | public void setPremiumSMS(Object shortcode, Object keyword, Object tariff, Object mid) {
final Map<String, Object> premiumSMSConfig = new LinkedHashMap<String, Object>(4);
premiumSMSConfig.put("shortcode", shortcode);
premiumSMSConfig.put("keyword", keyword);
premiumSMSConfig.put("tariff", tariff);
premiumSMSConfig.put("mid", mid);
this.typeDetails = premiumSMSConfig;
this.type = MsgType.premium;
} | java | public void setPremiumSMS(Object shortcode, Object keyword, Object tariff, Object mid) {
final Map<String, Object> premiumSMSConfig = new LinkedHashMap<String, Object>(4);
premiumSMSConfig.put("shortcode", shortcode);
premiumSMSConfig.put("keyword", keyword);
premiumSMSConfig.put("tariff", tariff);
premiumSMSConfig.put("mid", mid);
this.typeDetails = premiumSMSConfig;
this.type = MsgType.premium;
} | [
"public",
"void",
"setPremiumSMS",
"(",
"Object",
"shortcode",
",",
"Object",
"keyword",
",",
"Object",
"tariff",
",",
"Object",
"mid",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"premiumSMSConfig",
"=",
"new",
"LinkedHashMap",
"<",
"String... | Setup premium SMS type
@param shortcode
@param keyword
@param tariff
@param mid | [
"Setup",
"premium",
"SMS",
"type"
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/objects/Message.java#L298-L306 |
google/truth | core/src/main/java/com/google/common/truth/Correspondence.java | Correspondence.formattingDiffsUsing | public Correspondence<A, E> formattingDiffsUsing(DiffFormatter<? super A, ? super E> formatter) {
return new FormattingDiffs<>(this, formatter);
} | java | public Correspondence<A, E> formattingDiffsUsing(DiffFormatter<? super A, ? super E> formatter) {
return new FormattingDiffs<>(this, formatter);
} | [
"public",
"Correspondence",
"<",
"A",
",",
"E",
">",
"formattingDiffsUsing",
"(",
"DiffFormatter",
"<",
"?",
"super",
"A",
",",
"?",
"super",
"E",
">",
"formatter",
")",
"{",
"return",
"new",
"FormattingDiffs",
"<>",
"(",
"this",
",",
"formatter",
")",
"... | Returns a new correspondence which is like this one, except that the given formatter may be
used to format the difference between a pair of elements that do not correspond.
<p>Note that, if you the data you are asserting about contains null actual or expected values,
the formatter may be invoked with a null argument. If this causes it to throw a {@link
NullPointerException}, that will be taken to indicate that the values cannot be diffed. (See
{@link Correspondence#formatDiff} for more detail on how exceptions are handled.) If you think
null values are likely, it is slightly cleaner to have the formatter return null in that case
instead of throwing.
<p>Example:
<pre>{@code
class MyRecordTestHelper {
static final Correspondence<MyRecord, MyRecord> EQUIVALENCE =
Correspondence.from(MyRecordTestHelper::recordsEquivalent, "is equivalent to")
.formattingDiffsUsing(MyRecordTestHelper::formatRecordDiff);
static boolean recordsEquivalent(@Nullable MyRecord actual, @Nullable MyRecord expected) {
// code to check whether records should be considered equivalent for testing purposes
}
static String formatRecordDiff(@Nullable MyRecord actual, @Nullable MyRecord expected) {
// code to format the diff between the records
}
}
}</pre> | [
"Returns",
"a",
"new",
"correspondence",
"which",
"is",
"like",
"this",
"one",
"except",
"that",
"the",
"given",
"formatter",
"may",
"be",
"used",
"to",
"format",
"the",
"difference",
"between",
"a",
"pair",
"of",
"elements",
"that",
"do",
"not",
"correspond... | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Correspondence.java#L350-L352 |
GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java | MaterialPathAnimator.detectOutOfScopeElement | protected void detectOutOfScopeElement(Element element, Functions.Func callback) {
if (scrollHelper.isInViewPort(element)) {
callback.call();
} else {
scrollHelper.setOffsetPosition(OffsetPosition.MIDDLE);
scrollHelper.setCompleteCallback(() -> callback.call());
scrollHelper.scrollTo(element);
}
} | java | protected void detectOutOfScopeElement(Element element, Functions.Func callback) {
if (scrollHelper.isInViewPort(element)) {
callback.call();
} else {
scrollHelper.setOffsetPosition(OffsetPosition.MIDDLE);
scrollHelper.setCompleteCallback(() -> callback.call());
scrollHelper.scrollTo(element);
}
} | [
"protected",
"void",
"detectOutOfScopeElement",
"(",
"Element",
"element",
",",
"Functions",
".",
"Func",
"callback",
")",
"{",
"if",
"(",
"scrollHelper",
".",
"isInViewPort",
"(",
"element",
")",
")",
"{",
"callback",
".",
"call",
"(",
")",
";",
"}",
"els... | Will detect if the target / source element is out of scope in the viewport.
If it is then we will call {@link ScrollHelper#scrollTo(double)} with default offset position
of {@link OffsetPosition#MIDDLE}. | [
"Will",
"detect",
"if",
"the",
"target",
"/",
"source",
"element",
"is",
"out",
"of",
"scope",
"in",
"the",
"viewport",
".",
"If",
"it",
"is",
"then",
"we",
"will",
"call",
"{"
] | train | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L185-L193 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/util/IntegerMap.java | IntegerMap.put | @SuppressWarnings("unchecked")
public V put(Integer key, V value) {
int k = checkKey(key);
int index = Arrays.binarySearch(keyIndices, k);
if (index >= 0) {
V old = (V)(values[index]);
values[index] = value;
return old;
}
else {
int newIndex = 0 - (index + 1);
Object[] newValues = Arrays.copyOf(values, values.length + 1);
int[] newIndices = Arrays.copyOf(keyIndices, values.length + 1);
// shift the elements down to make room for the new value
for (int i = newIndex; i < values.length; ++i) {
newValues[i+1] = values[i];
newIndices[i+1] = keyIndices[i];
}
// insert the new value
newValues[newIndex] = value;
newIndices[newIndex] = k;
// switch the arrays with the lengthed versions
values = newValues;
keyIndices = newIndices;
return null;
}
} | java | @SuppressWarnings("unchecked")
public V put(Integer key, V value) {
int k = checkKey(key);
int index = Arrays.binarySearch(keyIndices, k);
if (index >= 0) {
V old = (V)(values[index]);
values[index] = value;
return old;
}
else {
int newIndex = 0 - (index + 1);
Object[] newValues = Arrays.copyOf(values, values.length + 1);
int[] newIndices = Arrays.copyOf(keyIndices, values.length + 1);
// shift the elements down to make room for the new value
for (int i = newIndex; i < values.length; ++i) {
newValues[i+1] = values[i];
newIndices[i+1] = keyIndices[i];
}
// insert the new value
newValues[newIndex] = value;
newIndices[newIndex] = k;
// switch the arrays with the lengthed versions
values = newValues;
keyIndices = newIndices;
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"V",
"put",
"(",
"Integer",
"key",
",",
"V",
"value",
")",
"{",
"int",
"k",
"=",
"checkKey",
"(",
"key",
")",
";",
"int",
"index",
"=",
"Arrays",
".",
"binarySearch",
"(",
"keyIndices",
",",... | Adds the mapping from the provided key to the value.
@param key
@param value
@throws NullPointerException if the key is {@code null}
@throws IllegalArgumentException if the key is not an instance of {@link
Integer} | [
"Adds",
"the",
"mapping",
"from",
"the",
"provided",
"key",
"to",
"the",
"value",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/IntegerMap.java#L247-L279 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierValue.java | TypeQualifierValue.getValue | @SuppressWarnings("rawtypes")
public static @Nonnull
TypeQualifierValue<?> getValue(ClassDescriptor desc, @CheckForNull Object value) {
DualKeyHashMap<ClassDescriptor, Object, TypeQualifierValue<?>> map = instance.get().typeQualifierMap;
TypeQualifierValue<?> result = map.get(desc, value);
if (result != null) {
return result;
}
result = new TypeQualifierValue(desc, value);
map.put(desc, value, result);
instance.get().allKnownTypeQualifiers.add(result);
return result;
} | java | @SuppressWarnings("rawtypes")
public static @Nonnull
TypeQualifierValue<?> getValue(ClassDescriptor desc, @CheckForNull Object value) {
DualKeyHashMap<ClassDescriptor, Object, TypeQualifierValue<?>> map = instance.get().typeQualifierMap;
TypeQualifierValue<?> result = map.get(desc, value);
if (result != null) {
return result;
}
result = new TypeQualifierValue(desc, value);
map.put(desc, value, result);
instance.get().allKnownTypeQualifiers.add(result);
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"@",
"Nonnull",
"TypeQualifierValue",
"<",
"?",
">",
"getValue",
"(",
"ClassDescriptor",
"desc",
",",
"@",
"CheckForNull",
"Object",
"value",
")",
"{",
"DualKeyHashMap",
"<",
"ClassDescriptor",... | Given a ClassDescriptor/value pair, return the interned
TypeQualifierValue representing that pair.
@param desc
a ClassDescriptor denoting a type qualifier annotation
@param value
a value
@return an interned TypeQualifierValue object | [
"Given",
"a",
"ClassDescriptor",
"/",
"value",
"pair",
"return",
"the",
"interned",
"TypeQualifierValue",
"representing",
"that",
"pair",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierValue.java#L288-L300 |
alkacon/opencms-core | src/org/opencms/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.readOptionalInt | private int readOptionalInt(JSONObject json, String key) {
try {
String str = json.getString(key);
return Integer.valueOf(str).intValue();
} catch (NumberFormatException | JSONException e) {
LOG.debug("Reading optional JSON int failed. Default to provided default value.", e);
}
return 0;
} | java | private int readOptionalInt(JSONObject json, String key) {
try {
String str = json.getString(key);
return Integer.valueOf(str).intValue();
} catch (NumberFormatException | JSONException e) {
LOG.debug("Reading optional JSON int failed. Default to provided default value.", e);
}
return 0;
} | [
"private",
"int",
"readOptionalInt",
"(",
"JSONObject",
"json",
",",
"String",
"key",
")",
"{",
"try",
"{",
"String",
"str",
"=",
"json",
".",
"getString",
"(",
"key",
")",
";",
"return",
"Integer",
".",
"valueOf",
"(",
"str",
")",
".",
"intValue",
"("... | Read an optional int value (stored as string) form a JSON Object.
@param json the JSON object to read from.
@param key the key for the int value in the provided JSON object.
@return the int or 0 if reading the int fails. | [
"Read",
"an",
"optional",
"int",
"value",
"(",
"stored",
"as",
"string",
")",
"form",
"a",
"JSON",
"Object",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L350-L359 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.getNodeListByXPath | public static NodeList getNodeListByXPath(String expression, Object source) {
return (NodeList) getByXPath(expression, source, XPathConstants.NODESET);
} | java | public static NodeList getNodeListByXPath(String expression, Object source) {
return (NodeList) getByXPath(expression, source, XPathConstants.NODESET);
} | [
"public",
"static",
"NodeList",
"getNodeListByXPath",
"(",
"String",
"expression",
",",
"Object",
"source",
")",
"{",
"return",
"(",
"NodeList",
")",
"getByXPath",
"(",
"expression",
",",
"source",
",",
"XPathConstants",
".",
"NODESET",
")",
";",
"}"
] | 通过XPath方式读取XML的NodeList<br>
Xpath相关文章:https://www.ibm.com/developerworks/cn/xml/x-javaxpathapi.html
@param expression XPath表达式
@param source 资源,可以是Docunent、Node节点等
@return NodeList
@since 4.0.9 | [
"通过XPath方式读取XML的NodeList<br",
">",
"Xpath相关文章:https",
":",
"//",
"www",
".",
"ibm",
".",
"com",
"/",
"developerworks",
"/",
"cn",
"/",
"xml",
"/",
"x",
"-",
"javaxpathapi",
".",
"html"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L585-L587 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.listFromTaskNextWithServiceResponseAsync | public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> listFromTaskNextWithServiceResponseAsync(final String nextPageLink, final FileListFromTaskNextOptions fileListFromTaskNextOptions) {
return listFromTaskNextSinglePageAsync(nextPageLink, fileListFromTaskNextOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, fileListFromTaskNextOptions));
}
});
} | java | public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> listFromTaskNextWithServiceResponseAsync(final String nextPageLink, final FileListFromTaskNextOptions fileListFromTaskNextOptions) {
return listFromTaskNextSinglePageAsync(nextPageLink, fileListFromTaskNextOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, fileListFromTaskNextOptions));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"NodeFile",
">",
",",
"FileListFromTaskHeaders",
">",
">",
"listFromTaskNextWithServiceResponseAsync",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"FileListFromTaskNextOptions",
"fileList... | Lists the files in a task's directory on its compute node.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param fileListFromTaskNextOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<NodeFile> object | [
"Lists",
"the",
"files",
"in",
"a",
"task",
"s",
"directory",
"on",
"its",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2401-L2413 |
esigate/esigate | esigate-core/src/main/java/org/esigate/events/EventManager.java | EventManager.register | public void register(EventDefinition eventDefinition, IEventListener listener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
register(listenersPost, eventDefinition, listener, true);
} else {
register(listeners, eventDefinition, listener, false);
}
} | java | public void register(EventDefinition eventDefinition, IEventListener listener) {
if (eventDefinition.getType() == EventDefinition.TYPE_POST) {
register(listenersPost, eventDefinition, listener, true);
} else {
register(listeners, eventDefinition, listener, false);
}
} | [
"public",
"void",
"register",
"(",
"EventDefinition",
"eventDefinition",
",",
"IEventListener",
"listener",
")",
"{",
"if",
"(",
"eventDefinition",
".",
"getType",
"(",
")",
"==",
"EventDefinition",
".",
"TYPE_POST",
")",
"{",
"register",
"(",
"listenersPost",
"... | Start listening to an event.
@param eventDefinition
@param listener | [
"Start",
"listening",
"to",
"an",
"event",
"."
] | train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/events/EventManager.java#L127-L133 |
Erudika/para | para-server/src/main/java/com/erudika/para/security/SimpleUserService.java | SimpleUserService.loadUserByUsername | public UserDetails loadUserByUsername(String ident) {
User user = new User();
// check if the cookie has an appid prefix
// and load user from the corresponding app
if (StringUtils.contains(ident, "/")) {
String[] parts = ident.split("/");
user.setAppid(parts[0]);
ident = parts[1];
}
user.setIdentifier(ident);
user = loadUser(user);
if (user == null) {
throw new UsernameNotFoundException(ident);
}
return new AuthenticatedUserDetails(user);
} | java | public UserDetails loadUserByUsername(String ident) {
User user = new User();
// check if the cookie has an appid prefix
// and load user from the corresponding app
if (StringUtils.contains(ident, "/")) {
String[] parts = ident.split("/");
user.setAppid(parts[0]);
ident = parts[1];
}
user.setIdentifier(ident);
user = loadUser(user);
if (user == null) {
throw new UsernameNotFoundException(ident);
}
return new AuthenticatedUserDetails(user);
} | [
"public",
"UserDetails",
"loadUserByUsername",
"(",
"String",
"ident",
")",
"{",
"User",
"user",
"=",
"new",
"User",
"(",
")",
";",
"// check if the cookie has an appid prefix",
"// and load user from the corresponding app",
"if",
"(",
"StringUtils",
".",
"contains",
"(... | Loads a user from the data store.
@param ident the user identifier
@return a user object or null if user is not found | [
"Loads",
"a",
"user",
"from",
"the",
"data",
"store",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/SimpleUserService.java#L44-L61 |
Waikato/moa | moa/src/main/java/com/yahoo/labs/samoa/instances/Instances.java | Instances.insertAttributeAt | public void insertAttributeAt(Attribute attribute, int position) {
if (this.instanceInformation == null) {
this.instanceInformation = new InstanceInformation();
}
this.instanceInformation.insertAttributeAt(attribute, position);
for (int i = 0; i < numInstances(); i++) {
instance(i).setDataset(null);
instance(i).insertAttributeAt(i);
instance(i).setDataset(this);
}
} | java | public void insertAttributeAt(Attribute attribute, int position) {
if (this.instanceInformation == null) {
this.instanceInformation = new InstanceInformation();
}
this.instanceInformation.insertAttributeAt(attribute, position);
for (int i = 0; i < numInstances(); i++) {
instance(i).setDataset(null);
instance(i).insertAttributeAt(i);
instance(i).setDataset(this);
}
} | [
"public",
"void",
"insertAttributeAt",
"(",
"Attribute",
"attribute",
",",
"int",
"position",
")",
"{",
"if",
"(",
"this",
".",
"instanceInformation",
"==",
"null",
")",
"{",
"this",
".",
"instanceInformation",
"=",
"new",
"InstanceInformation",
"(",
")",
";",... | Insert attribute at.
@param attribute the attribute
@param position the position | [
"Insert",
"attribute",
"at",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/Instances.java#L295-L305 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.getSqSegDist | private static double getSqSegDist(Point point, Point p1, Point p2) {
double horizontal = p1.longitude();
double vertical = p1.latitude();
double diffHorizontal = p2.longitude() - horizontal;
double diffVertical = p2.latitude() - vertical;
if (diffHorizontal != 0 || diffVertical != 0) {
double total = ((point.longitude() - horizontal) * diffHorizontal + (point.latitude()
- vertical) * diffVertical) / (diffHorizontal * diffHorizontal + diffVertical
* diffVertical);
if (total > 1) {
horizontal = p2.longitude();
vertical = p2.latitude();
} else if (total > 0) {
horizontal += diffHorizontal * total;
vertical += diffVertical * total;
}
}
diffHorizontal = point.longitude() - horizontal;
diffVertical = point.latitude() - vertical;
return diffHorizontal * diffHorizontal + diffVertical * diffVertical;
} | java | private static double getSqSegDist(Point point, Point p1, Point p2) {
double horizontal = p1.longitude();
double vertical = p1.latitude();
double diffHorizontal = p2.longitude() - horizontal;
double diffVertical = p2.latitude() - vertical;
if (diffHorizontal != 0 || diffVertical != 0) {
double total = ((point.longitude() - horizontal) * diffHorizontal + (point.latitude()
- vertical) * diffVertical) / (diffHorizontal * diffHorizontal + diffVertical
* diffVertical);
if (total > 1) {
horizontal = p2.longitude();
vertical = p2.latitude();
} else if (total > 0) {
horizontal += diffHorizontal * total;
vertical += diffVertical * total;
}
}
diffHorizontal = point.longitude() - horizontal;
diffVertical = point.latitude() - vertical;
return diffHorizontal * diffHorizontal + diffVertical * diffVertical;
} | [
"private",
"static",
"double",
"getSqSegDist",
"(",
"Point",
"point",
",",
"Point",
"p1",
",",
"Point",
"p2",
")",
"{",
"double",
"horizontal",
"=",
"p1",
".",
"longitude",
"(",
")",
";",
"double",
"vertical",
"=",
"p1",
".",
"latitude",
"(",
")",
";",... | Square distance from a point to a segment.
@param point {@link Point} whose distance from segment needs to be determined
@param p1,p2 points defining the segment
@return square of the distance between first input point and segment defined by
other two input points | [
"Square",
"distance",
"from",
"a",
"point",
"to",
"a",
"segment",
"."
] | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L223-L247 |
Faylixe/googlecodejam-client | src/main/java/fr/faylixe/googlecodejam/client/CodeJamSession.java | CodeJamSession.buildFilename | public String buildFilename(final ProblemInput input, final int attempt) {
final StringBuilder builder = new StringBuilder();
final Problem problem = input.getProblem();
final ContestInfo info = problem.getParent();
final int index = info.getProblems().indexOf(problem);
final char letter = (char) ((int) 'A' + index);
builder.append(letter)
.append(FILENAME_SEPARATOR)
.append(input.getName())
.append(FILENAME_SEPARATOR);
if (attempt == -1) {
builder.append(PRACTICE);
}
else {
builder.append(attempt);
}
builder.append(INPUT_EXTENSION);
return builder.toString();
} | java | public String buildFilename(final ProblemInput input, final int attempt) {
final StringBuilder builder = new StringBuilder();
final Problem problem = input.getProblem();
final ContestInfo info = problem.getParent();
final int index = info.getProblems().indexOf(problem);
final char letter = (char) ((int) 'A' + index);
builder.append(letter)
.append(FILENAME_SEPARATOR)
.append(input.getName())
.append(FILENAME_SEPARATOR);
if (attempt == -1) {
builder.append(PRACTICE);
}
else {
builder.append(attempt);
}
builder.append(INPUT_EXTENSION);
return builder.toString();
} | [
"public",
"String",
"buildFilename",
"(",
"final",
"ProblemInput",
"input",
",",
"final",
"int",
"attempt",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"Problem",
"problem",
"=",
"input",
".",
"getProblem... | <p>Builds and returns a valid file name
for the given problem <tt>input</tt>.</p>
@param input Input to retrieve file name from.
@param attempt Attempt number.
@return Built file name. | [
"<p",
">",
"Builds",
"and",
"returns",
"a",
"valid",
"file",
"name",
"for",
"the",
"given",
"problem",
"<tt",
">",
"input<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Faylixe/googlecodejam-client/blob/84a5fed4e049dca48994dc3f70213976aaff4bd3/src/main/java/fr/faylixe/googlecodejam/client/CodeJamSession.java#L233-L251 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculator.java | VariantAggregatedStatsCalculator.parseStats | protected void parseStats(Variant variant, StudyEntry file, int numAllele, String reference, String[] alternateAlleles, Map<String, String> info) {
VariantStats vs = new VariantStats();
Map<String, String> stats = new LinkedHashMap<>();
for (Map.Entry<String, String> entry : info.entrySet()) {
String infoTag = entry.getKey();
String infoValue = entry.getValue();
if (statsTags.contains(infoTag)) {
stats.put(infoTag, infoValue);
}
}
calculate(variant, file, numAllele, reference, alternateAlleles, stats, vs);
file.setStats(StudyEntry.DEFAULT_COHORT, vs);
} | java | protected void parseStats(Variant variant, StudyEntry file, int numAllele, String reference, String[] alternateAlleles, Map<String, String> info) {
VariantStats vs = new VariantStats();
Map<String, String> stats = new LinkedHashMap<>();
for (Map.Entry<String, String> entry : info.entrySet()) {
String infoTag = entry.getKey();
String infoValue = entry.getValue();
if (statsTags.contains(infoTag)) {
stats.put(infoTag, infoValue);
}
}
calculate(variant, file, numAllele, reference, alternateAlleles, stats, vs);
file.setStats(StudyEntry.DEFAULT_COHORT, vs);
} | [
"protected",
"void",
"parseStats",
"(",
"Variant",
"variant",
",",
"StudyEntry",
"file",
",",
"int",
"numAllele",
",",
"String",
"reference",
",",
"String",
"[",
"]",
"alternateAlleles",
",",
"Map",
"<",
"String",
",",
"String",
">",
"info",
")",
"{",
"Var... | Looks for tags contained in statsTags and calculates stats parsing them.
@param variant
@param file
@param numAllele
@param reference
@param alternateAlleles
@param info | [
"Looks",
"for",
"tags",
"contained",
"in",
"statsTags",
"and",
"calculates",
"stats",
"parsing",
"them",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculator.java#L132-L148 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.parser/src/main/java/de/tudarmstadt/ukp/wikipedia/parser/selectiveaccess/SelectiveAccessHandler.java | SelectiveAccessHandler.setSectionHandling | public void setSectionHandling( Map<String, EnumMap<SIT, EnumMap<CIT, Boolean>>> sectionHandling ) {
this.sectionHandling = sectionHandling;
} | java | public void setSectionHandling( Map<String, EnumMap<SIT, EnumMap<CIT, Boolean>>> sectionHandling ) {
this.sectionHandling = sectionHandling;
} | [
"public",
"void",
"setSectionHandling",
"(",
"Map",
"<",
"String",
",",
"EnumMap",
"<",
"SIT",
",",
"EnumMap",
"<",
"CIT",
",",
"Boolean",
">",
">",
">",
"sectionHandling",
")",
"{",
"this",
".",
"sectionHandling",
"=",
"sectionHandling",
";",
"}"
] | Be sure to set the Default Section Handling to avoid errors... | [
"Be",
"sure",
"to",
"set",
"the",
"Default",
"Section",
"Handling",
"to",
"avoid",
"errors",
"..."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.parser/src/main/java/de/tudarmstadt/ukp/wikipedia/parser/selectiveaccess/SelectiveAccessHandler.java#L120-L122 |
lucee/Lucee | core/src/main/java/lucee/transformer/util/Hash.java | Hash.getHashText | public static String getHashText(String plainText, String algorithm) throws NoSuchAlgorithmException {
MessageDigest mdAlgorithm = MessageDigest.getInstance(algorithm);
mdAlgorithm.update(plainText.getBytes());
byte[] digest = mdAlgorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < digest.length; i++) {
plainText = Integer.toHexString(0xFF & digest[i]);
if (plainText.length() < 2) {
plainText = "0" + plainText;
}
hexString.append(plainText);
}
return hexString.toString();
} | java | public static String getHashText(String plainText, String algorithm) throws NoSuchAlgorithmException {
MessageDigest mdAlgorithm = MessageDigest.getInstance(algorithm);
mdAlgorithm.update(plainText.getBytes());
byte[] digest = mdAlgorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < digest.length; i++) {
plainText = Integer.toHexString(0xFF & digest[i]);
if (plainText.length() < 2) {
plainText = "0" + plainText;
}
hexString.append(plainText);
}
return hexString.toString();
} | [
"public",
"static",
"String",
"getHashText",
"(",
"String",
"plainText",
",",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"MessageDigest",
"mdAlgorithm",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"algorithm",
")",
";",
"mdAlgorithm",
... | Method getHashText.
@param plainText
@param algorithm The algorithm to use like MD2, MD5, SHA-1, etc.
@return String
@throws NoSuchAlgorithmException | [
"Method",
"getHashText",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/util/Hash.java#L68-L87 |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcSessionFactory.java | CmsUgcSessionFactory.createSession | private CmsUgcSession createSession(CmsObject cms, CmsUgcConfiguration config) throws CmsUgcException {
if (getQueue(config).waitForSlot()) {
try {
return new CmsUgcSession(m_adminCms, cms, config);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new CmsUgcException(e);
}
} else {
String message = Messages.get().container(Messages.ERR_WAIT_QUEUE_EXCEEDED_0).key(
cms.getRequestContext().getLocale());
throw new CmsUgcException(CmsUgcConstants.ErrorCode.errMaxQueueLengthExceeded, message);
}
} | java | private CmsUgcSession createSession(CmsObject cms, CmsUgcConfiguration config) throws CmsUgcException {
if (getQueue(config).waitForSlot()) {
try {
return new CmsUgcSession(m_adminCms, cms, config);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new CmsUgcException(e);
}
} else {
String message = Messages.get().container(Messages.ERR_WAIT_QUEUE_EXCEEDED_0).key(
cms.getRequestContext().getLocale());
throw new CmsUgcException(CmsUgcConstants.ErrorCode.errMaxQueueLengthExceeded, message);
}
} | [
"private",
"CmsUgcSession",
"createSession",
"(",
"CmsObject",
"cms",
",",
"CmsUgcConfiguration",
"config",
")",
"throws",
"CmsUgcException",
"{",
"if",
"(",
"getQueue",
"(",
"config",
")",
".",
"waitForSlot",
"(",
")",
")",
"{",
"try",
"{",
"return",
"new",
... | Creates a new editing session.<p>
@param cms the cms context
@param config the configuration
@return the form session
@throws CmsUgcException if the session creation fails | [
"Creates",
"a",
"new",
"editing",
"session",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSessionFactory.java#L187-L201 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java | ImagePipeline.fetchDecodedImage | public DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(
ImageRequest imageRequest,
Object callerContext) {
return fetchDecodedImage(imageRequest, callerContext, ImageRequest.RequestLevel.FULL_FETCH);
} | java | public DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(
ImageRequest imageRequest,
Object callerContext) {
return fetchDecodedImage(imageRequest, callerContext, ImageRequest.RequestLevel.FULL_FETCH);
} | [
"public",
"DataSource",
"<",
"CloseableReference",
"<",
"CloseableImage",
">",
">",
"fetchDecodedImage",
"(",
"ImageRequest",
"imageRequest",
",",
"Object",
"callerContext",
")",
"{",
"return",
"fetchDecodedImage",
"(",
"imageRequest",
",",
"callerContext",
",",
"Imag... | Submits a request for execution and returns a DataSource representing the pending decoded
image(s).
<p>The returned DataSource must be closed once the client has finished with it.
@param imageRequest the request to submit
@param callerContext the caller context for image request
@return a DataSource representing the pending decoded image(s) | [
"Submits",
"a",
"request",
"for",
"execution",
"and",
"returns",
"a",
"DataSource",
"representing",
"the",
"pending",
"decoded",
"image",
"(",
"s",
")",
".",
"<p",
">",
"The",
"returned",
"DataSource",
"must",
"be",
"closed",
"once",
"the",
"client",
"has",
... | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java#L213-L217 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/AbstractDatabase.java | AbstractDatabase.addDocumentChangeListener | @NonNull
public ListenerToken addDocumentChangeListener(
@NonNull String id,
@NonNull DocumentChangeListener listener) {
return addDocumentChangeListener(id, null, listener);
} | java | @NonNull
public ListenerToken addDocumentChangeListener(
@NonNull String id,
@NonNull DocumentChangeListener listener) {
return addDocumentChangeListener(id, null, listener);
} | [
"@",
"NonNull",
"public",
"ListenerToken",
"addDocumentChangeListener",
"(",
"@",
"NonNull",
"String",
"id",
",",
"@",
"NonNull",
"DocumentChangeListener",
"listener",
")",
"{",
"return",
"addDocumentChangeListener",
"(",
"id",
",",
"null",
",",
"listener",
")",
"... | Add the given DocumentChangeListener to the specified document. | [
"Add",
"the",
"given",
"DocumentChangeListener",
"to",
"the",
"specified",
"document",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/AbstractDatabase.java#L654-L659 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newReadOnlyException | public static ReadOnlyException newReadOnlyException(Throwable cause, String message, Object... args) {
return new ReadOnlyException(format(message, args), cause);
} | java | public static ReadOnlyException newReadOnlyException(Throwable cause, String message, Object... args) {
return new ReadOnlyException(format(message, args), cause);
} | [
"public",
"static",
"ReadOnlyException",
"newReadOnlyException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"ReadOnlyException",
"(",
"format",
"(",
"message",
",",
"args",
")",
",",
"cause",
"... | Constructs and initializes a new {@link ReadOnlyException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link ReadOnlyException} was thrown.
@param message {@link String} describing the {@link ReadOnlyException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link ReadOnlyException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.util.ReadOnlyException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"ReadOnlyException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L859-L861 |
apache/groovy | subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java | DateUtilExtensions.upto | public static void upto(Date self, Date to, Closure closure) {
if (self.compareTo(to) <= 0) {
for (Date i = (Date) self.clone(); i.compareTo(to) <= 0; i = next(i)) {
closure.call(i);
}
} else
throw new GroovyRuntimeException("The argument (" + to +
") to upto() cannot be earlier than the value (" + self + ") it's called on.");
} | java | public static void upto(Date self, Date to, Closure closure) {
if (self.compareTo(to) <= 0) {
for (Date i = (Date) self.clone(); i.compareTo(to) <= 0; i = next(i)) {
closure.call(i);
}
} else
throw new GroovyRuntimeException("The argument (" + to +
") to upto() cannot be earlier than the value (" + self + ") it's called on.");
} | [
"public",
"static",
"void",
"upto",
"(",
"Date",
"self",
",",
"Date",
"to",
",",
"Closure",
"closure",
")",
"{",
"if",
"(",
"self",
".",
"compareTo",
"(",
"to",
")",
"<=",
"0",
")",
"{",
"for",
"(",
"Date",
"i",
"=",
"(",
"Date",
")",
"self",
"... | Iterates from this date up to the given date, inclusive,
incrementing by one day each time.
@param self a Date
@param to another Date to go up to
@param closure the closure to call
@since 2.2 | [
"Iterates",
"from",
"this",
"date",
"up",
"to",
"the",
"given",
"date",
"inclusive",
"incrementing",
"by",
"one",
"day",
"each",
"time",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L709-L717 |
Azure/azure-sdk-for-java | cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java | AccountsInner.updateAsync | public Observable<CognitiveServicesAccountInner> updateAsync(String resourceGroupName, String accountName) {
return updateWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<CognitiveServicesAccountInner>, CognitiveServicesAccountInner>() {
@Override
public CognitiveServicesAccountInner call(ServiceResponse<CognitiveServicesAccountInner> response) {
return response.body();
}
});
} | java | public Observable<CognitiveServicesAccountInner> updateAsync(String resourceGroupName, String accountName) {
return updateWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<CognitiveServicesAccountInner>, CognitiveServicesAccountInner>() {
@Override
public CognitiveServicesAccountInner call(ServiceResponse<CognitiveServicesAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CognitiveServicesAccountInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",
".",
"map",
"(",
... | Updates a Cognitive Services account.
@param resourceGroupName The name of the resource group within the user's subscription.
@param accountName The name of Cognitive Services account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CognitiveServicesAccountInner object | [
"Updates",
"a",
"Cognitive",
"Services",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java#L255-L262 |
jayantk/jklol | src/com/jayantkrish/jklol/tensor/SparseTensor.java | SparseTensor.relabelDimensions | @Override
public SparseTensor relabelDimensions(int[] newDimensions) {
Preconditions.checkArgument(newDimensions.length == numDimensions());
if (Ordering.natural().isOrdered(Ints.asList(newDimensions))) {
// If the new dimension labels are in sorted order, then we
// don't have to re-sort the outcome and value arrays. This is a big
// efficiency win if it happens. Note that keyNums and values
// are (treated as) immutable, and hence we don't need to copy them.
return new SparseTensor(newDimensions, getDimensionSizes(), keyNums, values);
}
int[] sortedDims = ArrayUtils.copyOf(newDimensions, newDimensions.length);
Arrays.sort(sortedDims);
// Figure out the mapping from the new, sorted dimension indices
// to
// the current indices of the outcome table.
Map<Integer, Integer> currentDimInds = Maps.newHashMap();
for (int i = 0; i < newDimensions.length; i++) {
currentDimInds.put(newDimensions[i], i);
}
int[] sortedSizes = new int[newDimensions.length];
long[] sortedIndexOffsets = new long[newDimensions.length];
int[] newOrder = new int[sortedDims.length];
int[] dimensionSizes = getDimensionSizes();
long curIndexOffset = 1;
for (int i = sortedDims.length - 1; i >= 0; i--) {
newOrder[currentDimInds.get(sortedDims[i])] = i;
sortedSizes[i] = dimensionSizes[currentDimInds.get(sortedDims[i])];
sortedIndexOffsets[i] = curIndexOffset;
curIndexOffset *= sortedSizes[i];
}
double[] resultValues = ArrayUtils.copyOf(values, values.length);
// Map each key of this into a key of the relabeled tensor.
long[] resultKeyInts = transformKeyNums(keyNums, indexOffsets, sortedIndexOffsets, newOrder);
ArrayUtils.sortKeyValuePairs(resultKeyInts, resultValues, 0, values.length);
return new SparseTensor(sortedDims, sortedSizes, resultKeyInts, resultValues);
} | java | @Override
public SparseTensor relabelDimensions(int[] newDimensions) {
Preconditions.checkArgument(newDimensions.length == numDimensions());
if (Ordering.natural().isOrdered(Ints.asList(newDimensions))) {
// If the new dimension labels are in sorted order, then we
// don't have to re-sort the outcome and value arrays. This is a big
// efficiency win if it happens. Note that keyNums and values
// are (treated as) immutable, and hence we don't need to copy them.
return new SparseTensor(newDimensions, getDimensionSizes(), keyNums, values);
}
int[] sortedDims = ArrayUtils.copyOf(newDimensions, newDimensions.length);
Arrays.sort(sortedDims);
// Figure out the mapping from the new, sorted dimension indices
// to
// the current indices of the outcome table.
Map<Integer, Integer> currentDimInds = Maps.newHashMap();
for (int i = 0; i < newDimensions.length; i++) {
currentDimInds.put(newDimensions[i], i);
}
int[] sortedSizes = new int[newDimensions.length];
long[] sortedIndexOffsets = new long[newDimensions.length];
int[] newOrder = new int[sortedDims.length];
int[] dimensionSizes = getDimensionSizes();
long curIndexOffset = 1;
for (int i = sortedDims.length - 1; i >= 0; i--) {
newOrder[currentDimInds.get(sortedDims[i])] = i;
sortedSizes[i] = dimensionSizes[currentDimInds.get(sortedDims[i])];
sortedIndexOffsets[i] = curIndexOffset;
curIndexOffset *= sortedSizes[i];
}
double[] resultValues = ArrayUtils.copyOf(values, values.length);
// Map each key of this into a key of the relabeled tensor.
long[] resultKeyInts = transformKeyNums(keyNums, indexOffsets, sortedIndexOffsets, newOrder);
ArrayUtils.sortKeyValuePairs(resultKeyInts, resultValues, 0, values.length);
return new SparseTensor(sortedDims, sortedSizes, resultKeyInts, resultValues);
} | [
"@",
"Override",
"public",
"SparseTensor",
"relabelDimensions",
"(",
"int",
"[",
"]",
"newDimensions",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"newDimensions",
".",
"length",
"==",
"numDimensions",
"(",
")",
")",
";",
"if",
"(",
"Ordering",
".",
... | Relabels the dimension numbers of {@code this} and returns the
result. {@code newDimensions.length} must equal
{@code this.getDimensionNumbers().length}. The {@code ith} entry
in {@code this.getDimensionNumbers()} is relabeled as
{@code newDimensions[i]} in the result.
@param newDimensions
@return | [
"Relabels",
"the",
"dimension",
"numbers",
"of",
"{",
"@code",
"this",
"}",
"and",
"returns",
"the",
"result",
".",
"{",
"@code",
"newDimensions",
".",
"length",
"}",
"must",
"equal",
"{",
"@code",
"this",
".",
"getDimensionNumbers",
"()",
".",
"length",
"... | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/tensor/SparseTensor.java#L1045-L1085 |
xwiki/xwiki-rendering | xwiki-rendering-macros/xwiki-rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/macro/toc/TocTreeBuilder.java | TocTreeBuilder.createChildListBlock | private ListBLock createChildListBlock(boolean numbered, Block parentBlock)
{
ListBLock childListBlock =
numbered ? new NumberedListBlock(Collections.emptyList()) : new BulletedListBlock(Collections.emptyList());
if (parentBlock != null) {
parentBlock.addChild(childListBlock);
}
return childListBlock;
} | java | private ListBLock createChildListBlock(boolean numbered, Block parentBlock)
{
ListBLock childListBlock =
numbered ? new NumberedListBlock(Collections.emptyList()) : new BulletedListBlock(Collections.emptyList());
if (parentBlock != null) {
parentBlock.addChild(childListBlock);
}
return childListBlock;
} | [
"private",
"ListBLock",
"createChildListBlock",
"(",
"boolean",
"numbered",
",",
"Block",
"parentBlock",
")",
"{",
"ListBLock",
"childListBlock",
"=",
"numbered",
"?",
"new",
"NumberedListBlock",
"(",
"Collections",
".",
"emptyList",
"(",
")",
")",
":",
"new",
"... | Create a new ListBlock and add it in the provided parent block.
@param numbered indicate if the list has to be numbered or with bullets
@param parentBlock the block where to add the new list block.
@return the new list block. | [
"Create",
"a",
"new",
"ListBlock",
"and",
"add",
"it",
"in",
"the",
"provided",
"parent",
"block",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-macros/xwiki-rendering-macro-toc/src/main/java/org/xwiki/rendering/internal/macro/toc/TocTreeBuilder.java#L205-L215 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/channel/AbstractChannel.java | AbstractChannel.initSslSocketFactory | private SSLSocketFactory initSslSocketFactory(KeyManager[] kms, TrustManager[] tms)
throws InitializationException {
SSLContext ctx = null;
String verify = System.getProperty(VERIFY_PEER_CERT_PROPERTY);
// If VERIFY_PEER_PROPERTY is set to false, we don't want verification
// of the other sides certificate
if (verify != null && verify.equals("false")) {
tms = getTrustAllKeystore();
} else if (verify == null || verify != null && verify.equals("true")) {
// use the given tms
} else {
throw new InitializationException("Bad value for "
+ VERIFY_PEER_CERT_PROPERTY + " property. Expected: true|false");
}
if (!isBasicAuth() && kms == null) {
throw new InitializationException("certificate-based auth needs a KeyManager");
}
try {
ctx = SSLContext.getInstance("TLS");
ctx.init(kms, tms, new SecureRandom());
} catch (Exception e) {
/* catch all */
IfmapJLog.error("Could not initialize SSLSocketFactory ["
+ e.getMessage() + "]");
throw new InitializationException(e);
}
return ctx.getSocketFactory();
} | java | private SSLSocketFactory initSslSocketFactory(KeyManager[] kms, TrustManager[] tms)
throws InitializationException {
SSLContext ctx = null;
String verify = System.getProperty(VERIFY_PEER_CERT_PROPERTY);
// If VERIFY_PEER_PROPERTY is set to false, we don't want verification
// of the other sides certificate
if (verify != null && verify.equals("false")) {
tms = getTrustAllKeystore();
} else if (verify == null || verify != null && verify.equals("true")) {
// use the given tms
} else {
throw new InitializationException("Bad value for "
+ VERIFY_PEER_CERT_PROPERTY + " property. Expected: true|false");
}
if (!isBasicAuth() && kms == null) {
throw new InitializationException("certificate-based auth needs a KeyManager");
}
try {
ctx = SSLContext.getInstance("TLS");
ctx.init(kms, tms, new SecureRandom());
} catch (Exception e) {
/* catch all */
IfmapJLog.error("Could not initialize SSLSocketFactory ["
+ e.getMessage() + "]");
throw new InitializationException(e);
}
return ctx.getSocketFactory();
} | [
"private",
"SSLSocketFactory",
"initSslSocketFactory",
"(",
"KeyManager",
"[",
"]",
"kms",
",",
"TrustManager",
"[",
"]",
"tms",
")",
"throws",
"InitializationException",
"{",
"SSLContext",
"ctx",
"=",
"null",
";",
"String",
"verify",
"=",
"System",
".",
"getPro... | get a {@link SSLSocketFactory} based on the {@link KeyManager} and
{@link TrustManager} objects we got.
@throws InitializationException | [
"get",
"a",
"{",
"@link",
"SSLSocketFactory",
"}",
"based",
"on",
"the",
"{",
"@link",
"KeyManager",
"}",
"and",
"{",
"@link",
"TrustManager",
"}",
"objects",
"we",
"got",
"."
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/channel/AbstractChannel.java#L326-L360 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/property/GeoPackageJavaProperties.java | GeoPackageJavaProperties.getColorProperty | public static Color getColorProperty(String base, String property) {
return getColorProperty(base, property, true);
} | java | public static Color getColorProperty(String base, String property) {
return getColorProperty(base, property, true);
} | [
"public",
"static",
"Color",
"getColorProperty",
"(",
"String",
"base",
",",
"String",
"property",
")",
"{",
"return",
"getColorProperty",
"(",
"base",
",",
"property",
",",
"true",
")",
";",
"}"
] | Get a required color property by base property and property name
@param base
base property
@param property
property
@return property value | [
"Get",
"a",
"required",
"color",
"property",
"by",
"base",
"property",
"and",
"property",
"name"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/property/GeoPackageJavaProperties.java#L319-L321 |
MTDdk/jawn | jawn-server/src/main/java/net/javapla/jawn/server/JawnFilter.java | JawnFilter.createServletRequest | private final static HttpServletRequest createServletRequest(final HttpServletRequest req, final String translatedPath) {
return new HttpServletRequestWrapper(req){
@Override
public String getServletPath() {
return translatedPath;
}
};
} | java | private final static HttpServletRequest createServletRequest(final HttpServletRequest req, final String translatedPath) {
return new HttpServletRequestWrapper(req){
@Override
public String getServletPath() {
return translatedPath;
}
};
} | [
"private",
"final",
"static",
"HttpServletRequest",
"createServletRequest",
"(",
"final",
"HttpServletRequest",
"req",
",",
"final",
"String",
"translatedPath",
")",
"{",
"return",
"new",
"HttpServletRequestWrapper",
"(",
"req",
")",
"{",
"@",
"Override",
"public",
... | Creates a new HttpServletRequest object.
Useful, as we cannot modify an existing ServletRequest.
Used when resources needs to have the {controller} stripped from the servletPath.
@author MTD | [
"Creates",
"a",
"new",
"HttpServletRequest",
"object",
".",
"Useful",
"as",
"we",
"cannot",
"modify",
"an",
"existing",
"ServletRequest",
".",
"Used",
"when",
"resources",
"needs",
"to",
"have",
"the",
"{",
"controller",
"}",
"stripped",
"from",
"the",
"servle... | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-server/src/main/java/net/javapla/jawn/server/JawnFilter.java#L135-L142 |
joniles/mpxj | src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java | FastTrackData.matchPattern | private final boolean matchPattern(byte[][] patterns, int bufferIndex)
{
boolean match = false;
for (byte[] pattern : patterns)
{
int index = 0;
match = true;
for (byte b : pattern)
{
if (b != m_buffer[bufferIndex + index])
{
match = false;
break;
}
++index;
}
if (match)
{
break;
}
}
return match;
} | java | private final boolean matchPattern(byte[][] patterns, int bufferIndex)
{
boolean match = false;
for (byte[] pattern : patterns)
{
int index = 0;
match = true;
for (byte b : pattern)
{
if (b != m_buffer[bufferIndex + index])
{
match = false;
break;
}
++index;
}
if (match)
{
break;
}
}
return match;
} | [
"private",
"final",
"boolean",
"matchPattern",
"(",
"byte",
"[",
"]",
"[",
"]",
"patterns",
",",
"int",
"bufferIndex",
")",
"{",
"boolean",
"match",
"=",
"false",
";",
"for",
"(",
"byte",
"[",
"]",
"pattern",
":",
"patterns",
")",
"{",
"int",
"index",
... | Locate a feature in the file by match a byte pattern.
@param patterns patterns to match
@param bufferIndex start index
@return true if the bytes at the position match a pattern | [
"Locate",
"a",
"feature",
"in",
"the",
"file",
"by",
"match",
"a",
"byte",
"pattern",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L275-L297 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java | InputSanityCheck.checkReshape | public static <T extends ImageGray<T>> T checkReshape(T target , ImageGray testImage , Class<T> targetType )
{
if( target == null ) {
return GeneralizedImageOps.createSingleBand(targetType, testImage.width, testImage.height);
} else if( target.width != testImage.width || target.height != testImage.height ) {
target.reshape(testImage.width,testImage.height);
}
return target;
} | java | public static <T extends ImageGray<T>> T checkReshape(T target , ImageGray testImage , Class<T> targetType )
{
if( target == null ) {
return GeneralizedImageOps.createSingleBand(targetType, testImage.width, testImage.height);
} else if( target.width != testImage.width || target.height != testImage.height ) {
target.reshape(testImage.width,testImage.height);
}
return target;
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"T",
"checkReshape",
"(",
"T",
"target",
",",
"ImageGray",
"testImage",
",",
"Class",
"<",
"T",
">",
"targetType",
")",
"{",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"retur... | Checks to see if the target image is null or if it is a different size than
the test image. If it is null then a new image is returned, otherwise
target is reshaped and returned.
@param target
@param testImage
@param targetType
@param <T>
@return | [
"Checks",
"to",
"see",
"if",
"the",
"target",
"image",
"is",
"null",
"or",
"if",
"it",
"is",
"a",
"different",
"size",
"than",
"the",
"test",
"image",
".",
"If",
"it",
"is",
"null",
"then",
"a",
"new",
"image",
"is",
"returned",
"otherwise",
"target",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java#L44-L52 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java | ByteArrayUtil.writeLong | public static int writeLong(byte[] array, int offset, long v) {
array[offset + 0] = (byte) (v >>> 56);
array[offset + 1] = (byte) (v >>> 48);
array[offset + 2] = (byte) (v >>> 40);
array[offset + 3] = (byte) (v >>> 32);
array[offset + 4] = (byte) (v >>> 24);
array[offset + 5] = (byte) (v >>> 16);
array[offset + 6] = (byte) (v >>> 8);
array[offset + 7] = (byte) (v >>> 0);
return SIZE_LONG;
} | java | public static int writeLong(byte[] array, int offset, long v) {
array[offset + 0] = (byte) (v >>> 56);
array[offset + 1] = (byte) (v >>> 48);
array[offset + 2] = (byte) (v >>> 40);
array[offset + 3] = (byte) (v >>> 32);
array[offset + 4] = (byte) (v >>> 24);
array[offset + 5] = (byte) (v >>> 16);
array[offset + 6] = (byte) (v >>> 8);
array[offset + 7] = (byte) (v >>> 0);
return SIZE_LONG;
} | [
"public",
"static",
"int",
"writeLong",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"long",
"v",
")",
"{",
"array",
"[",
"offset",
"+",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"v",
">>>",
"56",
")",
";",
"array",
"[",
"offset",
"+"... | Write a long to the byte array at the given offset.
@param array Array to write to
@param offset Offset to write to
@param v data
@return number of bytes written | [
"Write",
"a",
"long",
"to",
"the",
"byte",
"array",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java#L136-L146 |
markushi/android-ui | src/main/java/at/markushi/ui/RevealColorView.java | RevealColorView.calculateScale | private float calculateScale(int x, int y) {
final float centerX = getWidth() / 2f;
final float centerY = getHeight() / 2f;
final float maxDistance = (float) Math.sqrt(centerX * centerX + centerY * centerY);
final float deltaX = centerX - x;
final float deltaY = centerY - y;
final float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
final float scale = 0.5f + (distance / maxDistance) * 0.5f;
return scale;
} | java | private float calculateScale(int x, int y) {
final float centerX = getWidth() / 2f;
final float centerY = getHeight() / 2f;
final float maxDistance = (float) Math.sqrt(centerX * centerX + centerY * centerY);
final float deltaX = centerX - x;
final float deltaY = centerY - y;
final float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
final float scale = 0.5f + (distance / maxDistance) * 0.5f;
return scale;
} | [
"private",
"float",
"calculateScale",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"final",
"float",
"centerX",
"=",
"getWidth",
"(",
")",
"/",
"2f",
";",
"final",
"float",
"centerY",
"=",
"getHeight",
"(",
")",
"/",
"2f",
";",
"final",
"float",
"maxD... | calculates the required scale of the ink-view to fill the whole view
@param x circle center x
@param y circle center y
@return | [
"calculates",
"the",
"required",
"scale",
"of",
"the",
"ink",
"-",
"view",
"to",
"fill",
"the",
"whole",
"view"
] | train | https://github.com/markushi/android-ui/blob/a589fad7b74ace063c2b0e90741d43225b200a18/src/main/java/at/markushi/ui/RevealColorView.java#L207-L217 |
aaberg/sql2o | core/src/main/java/org/sql2o/Query.java | Query.addToBatch | public Query addToBatch(){
try {
buildPreparedStatement(false).addBatch();
if (this.maxBatchRecords > 0){
if(++this.currentBatchRecords % this.maxBatchRecords == 0) {
this.executeBatch();
}
}
} catch (SQLException e) {
throw new Sql2oException("Error while adding statement to batch", e);
}
return this;
} | java | public Query addToBatch(){
try {
buildPreparedStatement(false).addBatch();
if (this.maxBatchRecords > 0){
if(++this.currentBatchRecords % this.maxBatchRecords == 0) {
this.executeBatch();
}
}
} catch (SQLException e) {
throw new Sql2oException("Error while adding statement to batch", e);
}
return this;
} | [
"public",
"Query",
"addToBatch",
"(",
")",
"{",
"try",
"{",
"buildPreparedStatement",
"(",
"false",
")",
".",
"addBatch",
"(",
")",
";",
"if",
"(",
"this",
".",
"maxBatchRecords",
">",
"0",
")",
"{",
"if",
"(",
"++",
"this",
".",
"currentBatchRecords",
... | Adds a set of parameters to this <code>Query</code>
object's batch of commands. <br/>
If maxBatchRecords is more than 0, executeBatch is called upon adding that many
commands to the batch. <br/>
The current number of batched commands is accessible via the <code>getCurrentBatchRecords()</code>
method. | [
"Adds",
"a",
"set",
"of",
"parameters",
"to",
"this",
"<code",
">",
"Query<",
"/",
"code",
">",
"object",
"s",
"batch",
"of",
"commands",
".",
"<br",
"/",
">"
] | train | https://github.com/aaberg/sql2o/blob/01d3490a6d2440cf60f973d23508ac4ed57a8e20/core/src/main/java/org/sql2o/Query.java#L805-L818 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/stereo/ExampleStereoTwoViewsOneCamera.java | ExampleStereoTwoViewsOneCamera.rectifyImages | public static <T extends ImageBase<T>>
void rectifyImages(T distortedLeft,
T distortedRight,
Se3_F64 leftToRight,
CameraPinholeBrown intrinsicLeft,
CameraPinholeBrown intrinsicRight,
T rectifiedLeft,
T rectifiedRight,
GrayU8 rectifiedMask,
DMatrixRMaj rectifiedK,
DMatrixRMaj rectifiedR) {
RectifyCalibrated rectifyAlg = RectifyImageOps.createCalibrated();
// original camera calibration matrices
DMatrixRMaj K1 = PerspectiveOps.pinholeToMatrix(intrinsicLeft, (DMatrixRMaj)null);
DMatrixRMaj K2 = PerspectiveOps.pinholeToMatrix(intrinsicRight, (DMatrixRMaj)null);
rectifyAlg.process(K1, new Se3_F64(), K2, leftToRight);
// rectification matrix for each image
DMatrixRMaj rect1 = rectifyAlg.getRect1();
DMatrixRMaj rect2 = rectifyAlg.getRect2();
rectifiedR.set(rectifyAlg.getRectifiedRotation());
// New calibration matrix,
rectifiedK.set(rectifyAlg.getCalibrationMatrix());
// Adjust the rectification to make the view area more useful
RectifyImageOps.fullViewLeft(intrinsicLeft, rect1, rect2, rectifiedK);
// undistorted and rectify images
FMatrixRMaj rect1_F32 = new FMatrixRMaj(3,3);
FMatrixRMaj rect2_F32 = new FMatrixRMaj(3,3);
ConvertMatrixData.convert(rect1, rect1_F32);
ConvertMatrixData.convert(rect2, rect2_F32);
// Extending the image prevents a harsh edge reducing false matches at the image border
// SKIP is another option, possibly a tinny bit faster, but has a harsh edge which will need to be filtered
ImageDistort<T,T> distortLeft =
RectifyImageOps.rectifyImage(intrinsicLeft, rect1_F32, BorderType.EXTENDED, distortedLeft.getImageType());
ImageDistort<T,T> distortRight =
RectifyImageOps.rectifyImage(intrinsicRight, rect2_F32, BorderType.EXTENDED, distortedRight.getImageType());
distortLeft.apply(distortedLeft, rectifiedLeft,rectifiedMask);
distortRight.apply(distortedRight, rectifiedRight);
} | java | public static <T extends ImageBase<T>>
void rectifyImages(T distortedLeft,
T distortedRight,
Se3_F64 leftToRight,
CameraPinholeBrown intrinsicLeft,
CameraPinholeBrown intrinsicRight,
T rectifiedLeft,
T rectifiedRight,
GrayU8 rectifiedMask,
DMatrixRMaj rectifiedK,
DMatrixRMaj rectifiedR) {
RectifyCalibrated rectifyAlg = RectifyImageOps.createCalibrated();
// original camera calibration matrices
DMatrixRMaj K1 = PerspectiveOps.pinholeToMatrix(intrinsicLeft, (DMatrixRMaj)null);
DMatrixRMaj K2 = PerspectiveOps.pinholeToMatrix(intrinsicRight, (DMatrixRMaj)null);
rectifyAlg.process(K1, new Se3_F64(), K2, leftToRight);
// rectification matrix for each image
DMatrixRMaj rect1 = rectifyAlg.getRect1();
DMatrixRMaj rect2 = rectifyAlg.getRect2();
rectifiedR.set(rectifyAlg.getRectifiedRotation());
// New calibration matrix,
rectifiedK.set(rectifyAlg.getCalibrationMatrix());
// Adjust the rectification to make the view area more useful
RectifyImageOps.fullViewLeft(intrinsicLeft, rect1, rect2, rectifiedK);
// undistorted and rectify images
FMatrixRMaj rect1_F32 = new FMatrixRMaj(3,3);
FMatrixRMaj rect2_F32 = new FMatrixRMaj(3,3);
ConvertMatrixData.convert(rect1, rect1_F32);
ConvertMatrixData.convert(rect2, rect2_F32);
// Extending the image prevents a harsh edge reducing false matches at the image border
// SKIP is another option, possibly a tinny bit faster, but has a harsh edge which will need to be filtered
ImageDistort<T,T> distortLeft =
RectifyImageOps.rectifyImage(intrinsicLeft, rect1_F32, BorderType.EXTENDED, distortedLeft.getImageType());
ImageDistort<T,T> distortRight =
RectifyImageOps.rectifyImage(intrinsicRight, rect2_F32, BorderType.EXTENDED, distortedRight.getImageType());
distortLeft.apply(distortedLeft, rectifiedLeft,rectifiedMask);
distortRight.apply(distortedRight, rectifiedRight);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageBase",
"<",
"T",
">",
">",
"void",
"rectifyImages",
"(",
"T",
"distortedLeft",
",",
"T",
"distortedRight",
",",
"Se3_F64",
"leftToRight",
",",
"CameraPinholeBrown",
"intrinsicLeft",
",",
"CameraPinholeBrown",
"intrins... | Remove lens distortion and rectify stereo images
@param distortedLeft Input distorted image from left camera.
@param distortedRight Input distorted image from right camera.
@param leftToRight Camera motion from left to right
@param intrinsicLeft Intrinsic camera parameters
@param rectifiedLeft Output rectified image for left camera.
@param rectifiedRight Output rectified image for right camera.
@param rectifiedMask Mask that indicates invalid pixels in rectified image. 1 = valid, 0 = invalid
@param rectifiedK Output camera calibration matrix for rectified camera | [
"Remove",
"lens",
"distortion",
"and",
"rectify",
"stereo",
"images"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/stereo/ExampleStereoTwoViewsOneCamera.java#L205-L250 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/shared/core/types/Color.java | Color.toBrowserRGBA | public static final String toBrowserRGBA(final int r, final int g, final int b, final double a)
{
return "rgba(" + fixRGB(r) + "," + fixRGB(g) + "," + fixRGB(g) + "," + fixAlpha(a) + ")";
} | java | public static final String toBrowserRGBA(final int r, final int g, final int b, final double a)
{
return "rgba(" + fixRGB(r) + "," + fixRGB(g) + "," + fixRGB(g) + "," + fixAlpha(a) + ")";
} | [
"public",
"static",
"final",
"String",
"toBrowserRGBA",
"(",
"final",
"int",
"r",
",",
"final",
"int",
"g",
",",
"final",
"int",
"b",
",",
"final",
"double",
"a",
")",
"{",
"return",
"\"rgba(\"",
"+",
"fixRGB",
"(",
"r",
")",
"+",
"\",\"",
"+",
"fixR... | Converts RGBA values to a browser-compliance rgba format.
@param r int between 0 and 255
@param g int between 0 and 255
@param b int between 0 and 255
@param b double between 0 and 1
@return String e.g. "rgba(12,34,255,0.5)" | [
"Converts",
"RGBA",
"values",
"to",
"a",
"browser",
"-",
"compliance",
"rgba",
"format",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/shared/core/types/Color.java#L206-L209 |
denisneuling/apitrary.jar | apitrary-orm/apitrary-orm-core/src/main/java/com/apitrary/orm/core/ApitraryDaoSupport.java | ApitraryDaoSupport.findById | @SuppressWarnings("unchecked")
public <T> T findById(String id, Class<T> entity) {
if (entity == null) {
throw new ApitraryOrmException("Cannot access null entity");
}
if (id == null || id.isEmpty()) {
return null;
}
log.debug("Searching " + entity.getName() + " " + id);
GetRequest request = new GetRequest();
request.setEntity(resolveApitraryEntity(entity));
request.setId(id);
GetResponse response = resolveApitraryClient().send(request);
T result = (T) new GetResponseUnmarshaller(this).unMarshall(response, entity);
if (result != null) {
List<Field> fields = ClassUtil.getAnnotatedFields(entity, Id.class);
if (fields.isEmpty() || fields.size() > 1) {
throw new ApitraryOrmIdException("Illegal amount of annotated id properties of class " + entity.getClass().getName());
} else {
ClassUtil.setSilent(result, fields.get(0).getName(), id);
}
}
return result;
} | java | @SuppressWarnings("unchecked")
public <T> T findById(String id, Class<T> entity) {
if (entity == null) {
throw new ApitraryOrmException("Cannot access null entity");
}
if (id == null || id.isEmpty()) {
return null;
}
log.debug("Searching " + entity.getName() + " " + id);
GetRequest request = new GetRequest();
request.setEntity(resolveApitraryEntity(entity));
request.setId(id);
GetResponse response = resolveApitraryClient().send(request);
T result = (T) new GetResponseUnmarshaller(this).unMarshall(response, entity);
if (result != null) {
List<Field> fields = ClassUtil.getAnnotatedFields(entity, Id.class);
if (fields.isEmpty() || fields.size() > 1) {
throw new ApitraryOrmIdException("Illegal amount of annotated id properties of class " + entity.getClass().getName());
} else {
ClassUtil.setSilent(result, fields.get(0).getName(), id);
}
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"findById",
"(",
"String",
"id",
",",
"Class",
"<",
"T",
">",
"entity",
")",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"throw",
"new",
"ApitraryOrmException",
"("... | <p>
findById.
</p>
@param id
a {@link java.lang.String} object.
@param entity
a {@link java.lang.Class} object.
@param <T>
a T object.
@return a T object. | [
"<p",
">",
"findById",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-orm/apitrary-orm-core/src/main/java/com/apitrary/orm/core/ApitraryDaoSupport.java#L225-L252 |
alkacon/opencms-core | src/org/opencms/ade/detailpage/CmsDetailPageInfo.java | CmsDetailPageInfo.copyAsInherited | public CmsDetailPageInfo copyAsInherited() {
CmsDetailPageInfo result = new CmsDetailPageInfo(m_id, m_uri, m_type, m_iconClasses);
result.m_inherited = true;
return result;
} | java | public CmsDetailPageInfo copyAsInherited() {
CmsDetailPageInfo result = new CmsDetailPageInfo(m_id, m_uri, m_type, m_iconClasses);
result.m_inherited = true;
return result;
} | [
"public",
"CmsDetailPageInfo",
"copyAsInherited",
"(",
")",
"{",
"CmsDetailPageInfo",
"result",
"=",
"new",
"CmsDetailPageInfo",
"(",
"m_id",
",",
"m_uri",
",",
"m_type",
",",
"m_iconClasses",
")",
";",
"result",
".",
"m_inherited",
"=",
"true",
";",
"return",
... | Creates a copy of this entry, but sets the 'inherited' flag to true in the copy.<p>
@return the copy of this entry | [
"Creates",
"a",
"copy",
"of",
"this",
"entry",
"but",
"sets",
"the",
"inherited",
"flag",
"to",
"true",
"in",
"the",
"copy",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/detailpage/CmsDetailPageInfo.java#L104-L109 |
JetBrains/xodus | openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java | EnvironmentConfig.setSetting | @Override
public EnvironmentConfig setSetting(@NotNull final String key, @NotNull final Object value) {
return (EnvironmentConfig) super.setSetting(key, value);
} | java | @Override
public EnvironmentConfig setSetting(@NotNull final String key, @NotNull final Object value) {
return (EnvironmentConfig) super.setSetting(key, value);
} | [
"@",
"Override",
"public",
"EnvironmentConfig",
"setSetting",
"(",
"@",
"NotNull",
"final",
"String",
"key",
",",
"@",
"NotNull",
"final",
"Object",
"value",
")",
"{",
"return",
"(",
"EnvironmentConfig",
")",
"super",
".",
"setSetting",
"(",
"key",
",",
"val... | Sets the value of the setting with the specified key.
@param key name of the setting
@param value the setting value
@return this {@code EnvironmentConfig} instance | [
"Sets",
"the",
"value",
"of",
"the",
"setting",
"with",
"the",
"specified",
"key",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java#L674-L677 |
dlemmermann/CalendarFX | CalendarFXRecurrence/src/main/java/com/google/ical/iter/Util.java | Util.countInPeriod | static int countInPeriod(Weekday dow, Weekday dow0, int nDays) {
// Two cases
// (1a) dow >= dow0: count === (nDays - (dow - dow0)) / 7
// (1b) dow < dow0: count === (nDays - (7 - dow0 - dow)) / 7
if (dow.javaDayNum >= dow0.javaDayNum) {
return 1 + ((nDays - (dow.javaDayNum - dow0.javaDayNum) - 1) / 7);
} else {
return 1 + ((nDays - (7 - (dow0.javaDayNum - dow.javaDayNum)) - 1) / 7);
}
} | java | static int countInPeriod(Weekday dow, Weekday dow0, int nDays) {
// Two cases
// (1a) dow >= dow0: count === (nDays - (dow - dow0)) / 7
// (1b) dow < dow0: count === (nDays - (7 - dow0 - dow)) / 7
if (dow.javaDayNum >= dow0.javaDayNum) {
return 1 + ((nDays - (dow.javaDayNum - dow0.javaDayNum) - 1) / 7);
} else {
return 1 + ((nDays - (7 - (dow0.javaDayNum - dow.javaDayNum)) - 1) / 7);
}
} | [
"static",
"int",
"countInPeriod",
"(",
"Weekday",
"dow",
",",
"Weekday",
"dow0",
",",
"int",
"nDays",
")",
"{",
"// Two cases",
"// (1a) dow >= dow0: count === (nDays - (dow - dow0)) / 7",
"// (1b) dow < dow0: count === (nDays - (7 - dow0 - dow)) / 7",
"if",
"(",
"dow",
... | the number of occurences of dow in a period nDays long where the first day
of the period has day of week dow0. | [
"the",
"number",
"of",
"occurences",
"of",
"dow",
"in",
"a",
"period",
"nDays",
"long",
"where",
"the",
"first",
"day",
"of",
"the",
"period",
"has",
"day",
"of",
"week",
"dow0",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/iter/Util.java#L135-L144 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/expressions/Expressions.java | Expressions.isGreaterThan | public static IsGreaterThan isGreaterThan(ComparableExpression<Number> left, ComparableExpression<Number> right) {
return new IsGreaterThan(left, right);
} | java | public static IsGreaterThan isGreaterThan(ComparableExpression<Number> left, ComparableExpression<Number> right) {
return new IsGreaterThan(left, right);
} | [
"public",
"static",
"IsGreaterThan",
"isGreaterThan",
"(",
"ComparableExpression",
"<",
"Number",
">",
"left",
",",
"ComparableExpression",
"<",
"Number",
">",
"right",
")",
"{",
"return",
"new",
"IsGreaterThan",
"(",
"left",
",",
"right",
")",
";",
"}"
] | Creates an IsGreaterThan expression from the given expressions.
@param left The left expression.
@param right The right expression.
@return A new IsGreaterThan binary expression. | [
"Creates",
"an",
"IsGreaterThan",
"expression",
"from",
"the",
"given",
"expressions",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L241-L243 |
aws/aws-sdk-java | aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/Branch.java | Branch.withEnvironmentVariables | public Branch withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
setEnvironmentVariables(environmentVariables);
return this;
} | java | public Branch withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
setEnvironmentVariables(environmentVariables);
return this;
} | [
"public",
"Branch",
"withEnvironmentVariables",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"environmentVariables",
")",
"{",
"setEnvironmentVariables",
"(",
"environmentVariables",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Environment Variables specific to a branch, part of an Amplify App.
</p>
@param environmentVariables
Environment Variables specific to a branch, part of an Amplify App.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Environment",
"Variables",
"specific",
"to",
"a",
"branch",
"part",
"of",
"an",
"Amplify",
"App",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/Branch.java#L599-L602 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java | UserResourcesImpl.addProfileImage | public User addProfileImage(long userId, String file, String fileType) throws SmartsheetException, FileNotFoundException {
return attachProfileImage("users/" + userId + "/profileimage", file, fileType);
} | java | public User addProfileImage(long userId, String file, String fileType) throws SmartsheetException, FileNotFoundException {
return attachProfileImage("users/" + userId + "/profileimage", file, fileType);
} | [
"public",
"User",
"addProfileImage",
"(",
"long",
"userId",
",",
"String",
"file",
",",
"String",
"fileType",
")",
"throws",
"SmartsheetException",
",",
"FileNotFoundException",
"{",
"return",
"attachProfileImage",
"(",
"\"users/\"",
"+",
"userId",
"+",
"\"/profilei... | Uploads a profile image for the specified user.
@param userId id of the user
@param file path to the image file
@param fileType content type of the image file
@return user
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException f there is any other error during the operation | [
"Uploads",
"a",
"profile",
"image",
"for",
"the",
"specified",
"user",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java#L383-L385 |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcSession.java | CmsUgcSession.getValues | public Map<String, String> getValues() throws CmsException {
CmsFile file = m_cms.readFile(m_editResource);
CmsXmlContent content = unmarshalXmlContent(file);
Locale locale = m_cms.getRequestContext().getLocale();
if (!content.hasLocale(locale)) {
content.addLocale(m_cms, locale);
}
return getContentValues(content, locale);
} | java | public Map<String, String> getValues() throws CmsException {
CmsFile file = m_cms.readFile(m_editResource);
CmsXmlContent content = unmarshalXmlContent(file);
Locale locale = m_cms.getRequestContext().getLocale();
if (!content.hasLocale(locale)) {
content.addLocale(m_cms, locale);
}
return getContentValues(content, locale);
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getValues",
"(",
")",
"throws",
"CmsException",
"{",
"CmsFile",
"file",
"=",
"m_cms",
".",
"readFile",
"(",
"m_editResource",
")",
";",
"CmsXmlContent",
"content",
"=",
"unmarshalXmlContent",
"(",
"file",
... | Returns the content values.<p>
@return the content values
@throws CmsException if reading the content fails | [
"Returns",
"the",
"content",
"values",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L424-L433 |
Impetus/Kundera | src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQuery.java | CouchDBQuery.recursivelyPopulateEntities | @Override
protected List recursivelyPopulateEntities(EntityMetadata m, Client client)
{
List<EnhanceEntity> ls = populateEntities(m, client);
return setRelationEntities(ls, client, m);
} | java | @Override
protected List recursivelyPopulateEntities(EntityMetadata m, Client client)
{
List<EnhanceEntity> ls = populateEntities(m, client);
return setRelationEntities(ls, client, m);
} | [
"@",
"Override",
"protected",
"List",
"recursivelyPopulateEntities",
"(",
"EntityMetadata",
"m",
",",
"Client",
"client",
")",
"{",
"List",
"<",
"EnhanceEntity",
">",
"ls",
"=",
"populateEntities",
"(",
"m",
",",
"client",
")",
";",
"return",
"setRelationEntitie... | Recursively populate entity.
@param m
the m
@param client
the client
@return the list | [
"Recursively",
"populate",
"entity",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQuery.java#L127-L132 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/ArrayListIterate.java | ArrayListIterate.forEach | public static <T> void forEach(ArrayList<T> list, int from, int to, Procedure<? super T> procedure)
{
ListIterate.rangeCheck(from, to, list.size());
if (ArrayListIterate.isOptimizableArrayList(list, to - from + 1))
{
T[] elements = ArrayListIterate.getInternalArray(list);
InternalArrayIterate.forEachWithoutChecks(elements, from, to, procedure);
}
else
{
RandomAccessListIterate.forEach(list, from, to, procedure);
}
} | java | public static <T> void forEach(ArrayList<T> list, int from, int to, Procedure<? super T> procedure)
{
ListIterate.rangeCheck(from, to, list.size());
if (ArrayListIterate.isOptimizableArrayList(list, to - from + 1))
{
T[] elements = ArrayListIterate.getInternalArray(list);
InternalArrayIterate.forEachWithoutChecks(elements, from, to, procedure);
}
else
{
RandomAccessListIterate.forEach(list, from, to, procedure);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"forEach",
"(",
"ArrayList",
"<",
"T",
">",
"list",
",",
"int",
"from",
",",
"int",
"to",
",",
"Procedure",
"<",
"?",
"super",
"T",
">",
"procedure",
")",
"{",
"ListIterate",
".",
"rangeCheck",
"(",
"from",
... | Iterates over the section of the list covered by the specified indexes. The indexes are both inclusive. If the
from is less than the to, the list is iterated in forward order. If the from is greater than the to, then the
list is iterated in the reverse order.
<p>
<pre>e.g.
ArrayList<People> people = new ArrayList<People>(FastList.newListWith(ted, mary, bob, sally));
ArrayListIterate.forEach(people, 0, 1, new Procedure<Person>()
{
public void value(Person person)
{
LOGGER.info(person.getName());
}
});
</pre>
<p>
This code would output ted and mary's names. | [
"Iterates",
"over",
"the",
"section",
"of",
"the",
"list",
"covered",
"by",
"the",
"specified",
"indexes",
".",
"The",
"indexes",
"are",
"both",
"inclusive",
".",
"If",
"the",
"from",
"is",
"less",
"than",
"the",
"to",
"the",
"list",
"is",
"iterated",
"i... | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ArrayListIterate.java#L809-L822 |
banq/jdonframework | src/main/java/com/jdon/controller/WebAppUtil.java | WebAppUtil.callService | public static Object callService(String serviceName, String methodName, Object[] methodParams, HttpServletRequest request) throws Exception {
Debug.logVerbose("[JdonFramework] call the method: " + methodName + " for the service: " + serviceName, module);
Object result = null;
try {
MethodMetaArgs methodMetaArgs = AppUtil.createDirectMethod(methodName, methodParams);
ServiceFacade serviceFacade = new ServiceFacade();
ServletContext sc = request.getSession().getServletContext();
Service service = serviceFacade.getService(new ServletContextWrapper(sc));
RequestWrapper requestW = RequestWrapperFactory.create(request);
result = service.execute(serviceName, methodMetaArgs, requestW);
} catch (Exception ex) {
Debug.logError("[JdonFramework] serviceAction Error: " + ex, module);
throw new Exception(" serviceAction Error:" + ex);
}
return result;
} | java | public static Object callService(String serviceName, String methodName, Object[] methodParams, HttpServletRequest request) throws Exception {
Debug.logVerbose("[JdonFramework] call the method: " + methodName + " for the service: " + serviceName, module);
Object result = null;
try {
MethodMetaArgs methodMetaArgs = AppUtil.createDirectMethod(methodName, methodParams);
ServiceFacade serviceFacade = new ServiceFacade();
ServletContext sc = request.getSession().getServletContext();
Service service = serviceFacade.getService(new ServletContextWrapper(sc));
RequestWrapper requestW = RequestWrapperFactory.create(request);
result = service.execute(serviceName, methodMetaArgs, requestW);
} catch (Exception ex) {
Debug.logError("[JdonFramework] serviceAction Error: " + ex, module);
throw new Exception(" serviceAction Error:" + ex);
}
return result;
} | [
"public",
"static",
"Object",
"callService",
"(",
"String",
"serviceName",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"methodParams",
",",
"HttpServletRequest",
"request",
")",
"throws",
"Exception",
"{",
"Debug",
".",
"logVerbose",
"(",
"\"[JdonFramewo... | Command pattern for service invoke sample: browser url:
/aaa.do?method=xxxxx
xxxxx is the service's method, such as:
public interface TestService{ void xxxxx(EventModel em); }
@see com.jdon.strutsutil.ServiceMethodAction
@param serviceName
the service name in jdonframework.xml
@param methodName
the method name
@param request
@param model
the method parameter must be packed in a ModelIF object. if no
method parameter, set it to null;
@return return the service dealing result
@throws Exception | [
"Command",
"pattern",
"for",
"service",
"invoke",
"sample",
":",
"browser",
"url",
":",
"/",
"aaa",
".",
"do?method",
"=",
"xxxxx"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/controller/WebAppUtil.java#L185-L201 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java | ManagedInstancesInner.beginCreateOrUpdateAsync | public Observable<ManagedInstanceInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<ManagedInstanceInner>, ManagedInstanceInner>() {
@Override
public ManagedInstanceInner call(ServiceResponse<ManagedInstanceInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedInstanceInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<ManagedInstanceInner>, ManagedInstanceInner>() {
@Override
public ManagedInstanceInner call(ServiceResponse<ManagedInstanceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedInstanceInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"ManagedInstanceInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"... | Creates or updates a managed instance.
@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 managedInstanceName The name of the managed instance.
@param parameters The requested managed instance resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ManagedInstanceInner object | [
"Creates",
"or",
"updates",
"a",
"managed",
"instance",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java#L538-L545 |
maxirosson/jdroid-android | jdroid-android-core/src/main/java/com/jdroid/android/domain/GeoLocation.java | GeoLocation.calculateDistance | public double calculateDistance(double srcLat, double srcLong, double destLat, double destLong) {
float[] results = new float[1];
Location.distanceBetween(srcLat, srcLong, destLat, destLong, results);
return results[0] / 1000;
} | java | public double calculateDistance(double srcLat, double srcLong, double destLat, double destLong) {
float[] results = new float[1];
Location.distanceBetween(srcLat, srcLong, destLat, destLong, results);
return results[0] / 1000;
} | [
"public",
"double",
"calculateDistance",
"(",
"double",
"srcLat",
",",
"double",
"srcLong",
",",
"double",
"destLat",
",",
"double",
"destLong",
")",
"{",
"float",
"[",
"]",
"results",
"=",
"new",
"float",
"[",
"1",
"]",
";",
"Location",
".",
"distanceBetw... | /*
@return: Distance in kilometers between this src location and the specified destination | [
"/",
"*"
] | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/domain/GeoLocation.java#L64-L68 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/util/BridgeMethodResolver.java | BridgeMethodResolver.isVisibilityBridgeMethodPair | public static boolean isVisibilityBridgeMethodPair(Method bridgeMethod, Method bridgedMethod) {
if (bridgeMethod == bridgedMethod) {
return true;
}
return (Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes()) &&
bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType()));
} | java | public static boolean isVisibilityBridgeMethodPair(Method bridgeMethod, Method bridgedMethod) {
if (bridgeMethod == bridgedMethod) {
return true;
}
return (Arrays.equals(bridgeMethod.getParameterTypes(), bridgedMethod.getParameterTypes()) &&
bridgeMethod.getReturnType().equals(bridgedMethod.getReturnType()));
} | [
"public",
"static",
"boolean",
"isVisibilityBridgeMethodPair",
"(",
"Method",
"bridgeMethod",
",",
"Method",
"bridgedMethod",
")",
"{",
"if",
"(",
"bridgeMethod",
"==",
"bridgedMethod",
")",
"{",
"return",
"true",
";",
"}",
"return",
"(",
"Arrays",
".",
"equals"... | Compare the signatures of the bridge method and the method which it bridges. If
the parameter and return types are the same, it is a 'visibility' bridge method
introduced in Java 6 to fix http://bugs.sun.com/view_bug.do?bug_id=6342411.
See also http://stas-blogspot.blogspot.com/2010/03/java-bridge-methods-explained.html
@return whether signatures match as described | [
"Compare",
"the",
"signatures",
"of",
"the",
"bridge",
"method",
"and",
"the",
"method",
"which",
"it",
"bridges",
".",
"If",
"the",
"parameter",
"and",
"return",
"types",
"are",
"the",
"same",
"it",
"is",
"a",
"visibility",
"bridge",
"method",
"introduced",... | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/util/BridgeMethodResolver.java#L209-L215 |
banq/jdonframework | JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/HessianToJdonRequestProcessor.java | HessianToJdonRequestProcessor.writeException | protected void writeException(final AbstractHessianOutput out, Exception ex)
throws IOException {
OutputStream os = new ByteArrayOutputStream();
ex.printStackTrace(new PrintStream(os));
out.writeFault(ex.getClass().toString(), os.toString(), null);
} | java | protected void writeException(final AbstractHessianOutput out, Exception ex)
throws IOException {
OutputStream os = new ByteArrayOutputStream();
ex.printStackTrace(new PrintStream(os));
out.writeFault(ex.getClass().toString(), os.toString(), null);
} | [
"protected",
"void",
"writeException",
"(",
"final",
"AbstractHessianOutput",
"out",
",",
"Exception",
"ex",
")",
"throws",
"IOException",
"{",
"OutputStream",
"os",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ex",
".",
"printStackTrace",
"(",
"new",
"P... | Writes Exception information to Hessian Output.
@param out
Hessian Output
@param ex
Exception
@throws java.io.IOException
If i/o error occur | [
"Writes",
"Exception",
"information",
"to",
"Hessian",
"Output",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/HessianToJdonRequestProcessor.java#L205-L210 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/BigendianEncoding.java | BigendianEncoding.longToByteArray | static void longToByteArray(long value, byte[] dest, int destOffset) {
Utils.checkArgument(dest.length >= destOffset + LONG_BYTES, "array too small");
dest[destOffset + 7] = (byte) (value & 0xFFL);
dest[destOffset + 6] = (byte) (value >> 8 & 0xFFL);
dest[destOffset + 5] = (byte) (value >> 16 & 0xFFL);
dest[destOffset + 4] = (byte) (value >> 24 & 0xFFL);
dest[destOffset + 3] = (byte) (value >> 32 & 0xFFL);
dest[destOffset + 2] = (byte) (value >> 40 & 0xFFL);
dest[destOffset + 1] = (byte) (value >> 48 & 0xFFL);
dest[destOffset] = (byte) (value >> 56 & 0xFFL);
} | java | static void longToByteArray(long value, byte[] dest, int destOffset) {
Utils.checkArgument(dest.length >= destOffset + LONG_BYTES, "array too small");
dest[destOffset + 7] = (byte) (value & 0xFFL);
dest[destOffset + 6] = (byte) (value >> 8 & 0xFFL);
dest[destOffset + 5] = (byte) (value >> 16 & 0xFFL);
dest[destOffset + 4] = (byte) (value >> 24 & 0xFFL);
dest[destOffset + 3] = (byte) (value >> 32 & 0xFFL);
dest[destOffset + 2] = (byte) (value >> 40 & 0xFFL);
dest[destOffset + 1] = (byte) (value >> 48 & 0xFFL);
dest[destOffset] = (byte) (value >> 56 & 0xFFL);
} | [
"static",
"void",
"longToByteArray",
"(",
"long",
"value",
",",
"byte",
"[",
"]",
"dest",
",",
"int",
"destOffset",
")",
"{",
"Utils",
".",
"checkArgument",
"(",
"dest",
".",
"length",
">=",
"destOffset",
"+",
"LONG_BYTES",
",",
"\"array too small\"",
")",
... | Stores the big-endian representation of {@code value} in the {@code dest} starting from the
{@code destOffset}.
@param value the value to be converted.
@param dest the destination byte array.
@param destOffset the starting offset in the destination byte array. | [
"Stores",
"the",
"big",
"-",
"endian",
"representation",
"of",
"{",
"@code",
"value",
"}",
"in",
"the",
"{",
"@code",
"dest",
"}",
"starting",
"from",
"the",
"{",
"@code",
"destOffset",
"}",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/BigendianEncoding.java#L79-L89 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.indexOfDifference | public static int indexOfDifference(final CharSequence cs1, final CharSequence cs2) {
if (cs1 == cs2) {
return INDEX_NOT_FOUND;
}
if (cs1 == null || cs2 == null) {
return 0;
}
int i;
for (i = 0; i < cs1.length() && i < cs2.length(); ++i) {
if (cs1.charAt(i) != cs2.charAt(i)) {
break;
}
}
if (i < cs2.length() || i < cs1.length()) {
return i;
}
return INDEX_NOT_FOUND;
} | java | public static int indexOfDifference(final CharSequence cs1, final CharSequence cs2) {
if (cs1 == cs2) {
return INDEX_NOT_FOUND;
}
if (cs1 == null || cs2 == null) {
return 0;
}
int i;
for (i = 0; i < cs1.length() && i < cs2.length(); ++i) {
if (cs1.charAt(i) != cs2.charAt(i)) {
break;
}
}
if (i < cs2.length() || i < cs1.length()) {
return i;
}
return INDEX_NOT_FOUND;
} | [
"public",
"static",
"int",
"indexOfDifference",
"(",
"final",
"CharSequence",
"cs1",
",",
"final",
"CharSequence",
"cs2",
")",
"{",
"if",
"(",
"cs1",
"==",
"cs2",
")",
"{",
"return",
"INDEX_NOT_FOUND",
";",
"}",
"if",
"(",
"cs1",
"==",
"null",
"||",
"cs2... | <p>Compares two CharSequences, and returns the index at which the
CharSequences begin to differ.</p>
<p>For example,
{@code indexOfDifference("i am a machine", "i am a robot") -> 7}</p>
<pre>
StringUtils.indexOfDifference(null, null) = -1
StringUtils.indexOfDifference("", "") = -1
StringUtils.indexOfDifference("", "abc") = 0
StringUtils.indexOfDifference("abc", "") = 0
StringUtils.indexOfDifference("abc", "abc") = -1
StringUtils.indexOfDifference("ab", "abxyz") = 2
StringUtils.indexOfDifference("abcde", "abxyz") = 2
StringUtils.indexOfDifference("abcde", "xyz") = 0
</pre>
@param cs1 the first CharSequence, may be null
@param cs2 the second CharSequence, may be null
@return the index where cs1 and cs2 begin to differ; -1 if they are equal
@since 2.0
@since 3.0 Changed signature from indexOfDifference(String, String) to
indexOfDifference(CharSequence, CharSequence) | [
"<p",
">",
"Compares",
"two",
"CharSequences",
"and",
"returns",
"the",
"index",
"at",
"which",
"the",
"CharSequences",
"begin",
"to",
"differ",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L7846-L7863 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java | SwingBindingFactory.createBoundShuttleList | public Binding createBoundShuttleList( String selectionFormProperty, Object selectableItems, String renderedProperty ) {
return createBoundShuttleList(selectionFormProperty, new ValueHolder(selectableItems), renderedProperty);
} | java | public Binding createBoundShuttleList( String selectionFormProperty, Object selectableItems, String renderedProperty ) {
return createBoundShuttleList(selectionFormProperty, new ValueHolder(selectableItems), renderedProperty);
} | [
"public",
"Binding",
"createBoundShuttleList",
"(",
"String",
"selectionFormProperty",
",",
"Object",
"selectableItems",
",",
"String",
"renderedProperty",
")",
"{",
"return",
"createBoundShuttleList",
"(",
"selectionFormProperty",
",",
"new",
"ValueHolder",
"(",
"selecta... | Binds the values specified in the collection contained within
<code>selectableItems</code> (which will be wrapped in a
{@link ValueHolder} to a {@link ShuttleList}, with any user selection
being placed in the form property referred to by
<code>selectionFormProperty</code>. Each item in the list will be
rendered by looking up a property on the item by the name contained in
<code>renderedProperty</code>, retrieving the value of the property,
and rendering that value in the UI.
<p>
Note that the selection in the bound list will track any changes to the
<code>selectionFormProperty</code>. This is especially useful to
preselect items in the list - if <code>selectionFormProperty</code> is
not empty when the list is bound, then its content will be used for the
initial selection.
@param selectionFormProperty form property to hold user's selection. This
property must be a <code>Collection</code> or array type.
@param selectableItems Collection or array containing the items with
which to populate the selectable list (this object will be wrapped
in a ValueHolder).
@param renderedProperty the property to be queried for each item in the
list, the result of which will be used to render that item in the
UI. May be null, in which case the selectable items will be
rendered as strings.
@return constructed {@link Binding}. Note that the bound control is of
type {@link ShuttleList}. Access this component to set specific
display properties. | [
"Binds",
"the",
"values",
"specified",
"in",
"the",
"collection",
"contained",
"within",
"<code",
">",
"selectableItems<",
"/",
"code",
">",
"(",
"which",
"will",
"be",
"wrapped",
"in",
"a",
"{",
"@link",
"ValueHolder",
"}",
"to",
"a",
"{",
"@link",
"Shutt... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBindingFactory.java#L387-L389 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.