repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Impetus/Kundera | src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/Neo4JClient.java | Neo4JClient.addEntityFromIndexHits | protected void addEntityFromIndexHits(EntityMetadata m, List<Object> entities, IndexHits<Node> hits)
{
for (Node node : hits)
{
if (node != null)
{
Object entity = getEntityWithAssociationFromNode(m, node);
if (entity != null)
{
entities.add(entity);
}
}
}
} | java | protected void addEntityFromIndexHits(EntityMetadata m, List<Object> entities, IndexHits<Node> hits)
{
for (Node node : hits)
{
if (node != null)
{
Object entity = getEntityWithAssociationFromNode(m, node);
if (entity != null)
{
entities.add(entity);
}
}
}
} | [
"protected",
"void",
"addEntityFromIndexHits",
"(",
"EntityMetadata",
"m",
",",
"List",
"<",
"Object",
">",
"entities",
",",
"IndexHits",
"<",
"Node",
">",
"hits",
")",
"{",
"for",
"(",
"Node",
"node",
":",
"hits",
")",
"{",
"if",
"(",
"node",
"!=",
"n... | Adds the entity from index hits.
@param m
the m
@param entities
the entities
@param hits
the hits | [
"Adds",
"the",
"entity",
"from",
"index",
"hits",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/Neo4JClient.java#L889-L904 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.changedCacheData | protected void changedCacheData (String cache, final Streamable data)
{
// see if we have any observers
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
return;
}
// if so, notify them
list.apply(new ObserverList.ObserverOp<StaleCacheObserver>() {
public boolean apply (StaleCacheObserver observer) {
observer.changedCacheData(data);
return true;
}
});
} | java | protected void changedCacheData (String cache, final Streamable data)
{
// see if we have any observers
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
return;
}
// if so, notify them
list.apply(new ObserverList.ObserverOp<StaleCacheObserver>() {
public boolean apply (StaleCacheObserver observer) {
observer.changedCacheData(data);
return true;
}
});
} | [
"protected",
"void",
"changedCacheData",
"(",
"String",
"cache",
",",
"final",
"Streamable",
"data",
")",
"{",
"// see if we have any observers",
"ObserverList",
"<",
"StaleCacheObserver",
">",
"list",
"=",
"_cacheobs",
".",
"get",
"(",
"cache",
")",
";",
"if",
... | Called when possibly cached data has changed on one of our peer servers. | [
"Called",
"when",
"possibly",
"cached",
"data",
"has",
"changed",
"on",
"one",
"of",
"our",
"peer",
"servers",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1283-L1297 |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/options/KarafDistributionOption.java | KarafDistributionOption.editConfigurationFilePut | public static Option editConfigurationFilePut(String configurationFilePath, String key,
Object value) {
return new KarafDistributionConfigurationFilePutOption(configurationFilePath, key, value);
} | java | public static Option editConfigurationFilePut(String configurationFilePath, String key,
Object value) {
return new KarafDistributionConfigurationFilePutOption(configurationFilePath, key, value);
} | [
"public",
"static",
"Option",
"editConfigurationFilePut",
"(",
"String",
"configurationFilePath",
",",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"KarafDistributionConfigurationFilePutOption",
"(",
"configurationFilePath",
",",
"key",
",",
"valu... | This option allows to configure each configuration file based on the karaf.home location. The
value is "put". Which means it is either replaced or added.
<p>
If you like to extend an option (e.g. make a=b to a=b,c) please make use of the
{@link KarafDistributionConfigurationFileExtendOption}.
@param configurationFilePath
configuration file path
@param key
property key
@param value
property value
@return option | [
"This",
"option",
"allows",
"to",
"configure",
"each",
"configuration",
"file",
"based",
"on",
"the",
"karaf",
".",
"home",
"location",
".",
"The",
"value",
"is",
"put",
".",
"Which",
"means",
"it",
"is",
"either",
"replaced",
"or",
"added",
".",
"<p",
"... | train | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/options/KarafDistributionOption.java#L157-L160 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODInvalidationBuffer.java | HTODInvalidationBuffer.findAndRemoveFromGCBuffer | protected synchronized boolean findAndRemoveFromGCBuffer(long expirationTime, int hashcode, int size) {
EvictionTableEntry evt = null;
int i;
for (i = 0; i < garbageCollectorBuffer.size(); i++) {
evt = (EvictionTableEntry) garbageCollectorBuffer.get(i);
if (evt.expirationTime == expirationTime && evt.hashcode == hashcode && evt.size == size) {
break;
}
}
if (i < garbageCollectorBuffer.size()) {
this.garbageCollectorBuffer.remove(i);
if (evt != null) {
cod.htod.evictionEntryPool.add(evt);
}
return true;
}
return false;
} | java | protected synchronized boolean findAndRemoveFromGCBuffer(long expirationTime, int hashcode, int size) {
EvictionTableEntry evt = null;
int i;
for (i = 0; i < garbageCollectorBuffer.size(); i++) {
evt = (EvictionTableEntry) garbageCollectorBuffer.get(i);
if (evt.expirationTime == expirationTime && evt.hashcode == hashcode && evt.size == size) {
break;
}
}
if (i < garbageCollectorBuffer.size()) {
this.garbageCollectorBuffer.remove(i);
if (evt != null) {
cod.htod.evictionEntryPool.add(evt);
}
return true;
}
return false;
} | [
"protected",
"synchronized",
"boolean",
"findAndRemoveFromGCBuffer",
"(",
"long",
"expirationTime",
",",
"int",
"hashcode",
",",
"int",
"size",
")",
"{",
"EvictionTableEntry",
"evt",
"=",
"null",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"... | Call this method to get and remove the EVT from GC buffer.
@return boolean indicate whether it is found from GC buffer. | [
"Call",
"this",
"method",
"to",
"get",
"and",
"remove",
"the",
"EVT",
"from",
"GC",
"buffer",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODInvalidationBuffer.java#L387-L404 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toDouble | public static Double toDouble(Object o, Double defaultValue) {
if (o instanceof Double) return (Double) o;
double dbl = toDoubleValue(o, true, Double.NaN);
if (Double.isNaN(dbl)) return defaultValue;
return new Double(dbl);
} | java | public static Double toDouble(Object o, Double defaultValue) {
if (o instanceof Double) return (Double) o;
double dbl = toDoubleValue(o, true, Double.NaN);
if (Double.isNaN(dbl)) return defaultValue;
return new Double(dbl);
} | [
"public",
"static",
"Double",
"toDouble",
"(",
"Object",
"o",
",",
"Double",
"defaultValue",
")",
"{",
"if",
"(",
"o",
"instanceof",
"Double",
")",
"return",
"(",
"Double",
")",
"o",
";",
"double",
"dbl",
"=",
"toDoubleValue",
"(",
"o",
",",
"true",
",... | cast a Object to a Double Object (reference Type)
@param o Object to cast
@param defaultValue
@return casted Double Object | [
"cast",
"a",
"Object",
"to",
"a",
"Double",
"Object",
"(",
"reference",
"Type",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L349-L355 |
vakinge/jeesuite-libs | jeesuite-common/src/main/java/com/jeesuite/common/packagescan/InternalScanner.java | InternalScanner.findInPackage | List<String> findInPackage(Test test, String packageName) {
List<String> localClsssOrPkgs = new ArrayList<String>();
packageName = packageName.replace('.', '/');
Enumeration<URL> urls;
try {
urls = classloader.getResources(packageName);
// test for empty
if (!urls.hasMoreElements())
{
log.warn("Unable to find any resources for package '" + packageName + "'");
}
}
catch (IOException ioe) {
log.warn("Could not read package: " + packageName);
return localClsssOrPkgs;
}
return findInPackageWithUrls(test, packageName, urls);
} | java | List<String> findInPackage(Test test, String packageName) {
List<String> localClsssOrPkgs = new ArrayList<String>();
packageName = packageName.replace('.', '/');
Enumeration<URL> urls;
try {
urls = classloader.getResources(packageName);
// test for empty
if (!urls.hasMoreElements())
{
log.warn("Unable to find any resources for package '" + packageName + "'");
}
}
catch (IOException ioe) {
log.warn("Could not read package: " + packageName);
return localClsssOrPkgs;
}
return findInPackageWithUrls(test, packageName, urls);
} | [
"List",
"<",
"String",
">",
"findInPackage",
"(",
"Test",
"test",
",",
"String",
"packageName",
")",
"{",
"List",
"<",
"String",
">",
"localClsssOrPkgs",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"packageName",
"=",
"packageName",
".",
... | Scans for classes starting at the package provided and descending into subpackages.
Each class is offered up to the Test as it is discovered, and if the Test returns
true the class is retained.
@param test an instance of {@link Test} that will be used to filter classes
@param packageName the name of the package from which to start scanning for
classes, e.g. {@code net.sourceforge.stripes}
@return List of packages to export. | [
"Scans",
"for",
"classes",
"starting",
"at",
"the",
"package",
"provided",
"and",
"descending",
"into",
"subpackages",
".",
"Each",
"class",
"is",
"offered",
"up",
"to",
"the",
"Test",
"as",
"it",
"is",
"discovered",
"and",
"if",
"the",
"Test",
"returns",
... | train | https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-common/src/main/java/com/jeesuite/common/packagescan/InternalScanner.java#L63-L83 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/CheckForTheHandler.java | CheckForTheHandler.doSetData | public int doSetData(Object objData, boolean bDisplayOption, int moveMode)
{
if (objData instanceof String)
if (((String)objData).length() > 3) if (((String)objData).substring(0, 4).equalsIgnoreCase("THE "))
{
objData = ((String)objData).substring(4);
}
return super.doSetData(objData, bDisplayOption, moveMode);
} | java | public int doSetData(Object objData, boolean bDisplayOption, int moveMode)
{
if (objData instanceof String)
if (((String)objData).length() > 3) if (((String)objData).substring(0, 4).equalsIgnoreCase("THE "))
{
objData = ((String)objData).substring(4);
}
return super.doSetData(objData, bDisplayOption, moveMode);
} | [
"public",
"int",
"doSetData",
"(",
"Object",
"objData",
",",
"boolean",
"bDisplayOption",
",",
"int",
"moveMode",
")",
"{",
"if",
"(",
"objData",
"instanceof",
"String",
")",
"if",
"(",
"(",
"(",
"String",
")",
"objData",
")",
".",
"length",
"(",
")",
... | Move the physical binary data to this field.
@param objData the raw data to set the basefield to.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay). | [
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CheckForTheHandler.java#L57-L65 |
Impetus/Kundera | src/kundera-spark/spark-core/src/main/java/com/impetus/spark/client/SparkClient.java | SparkClient.appendValue | private void appendValue(StringBuilder builder, Class fieldClazz, Object value)
{
if (fieldClazz != null
&& value != null
&& (fieldClazz.isAssignableFrom(String.class) || fieldClazz.isAssignableFrom(char.class)
|| fieldClazz.isAssignableFrom(Character.class) || value instanceof Enum))
{
if (fieldClazz.isAssignableFrom(String.class))
{
// To allow escape character
value = ((String) value).replaceAll("'", "''");
}
builder.append("'");
if (value instanceof Enum)
{
builder.append(((Enum) value).name());
}
else
{
builder.append(value);
}
builder.append("'");
}
else
{
builder.append(value);
}
} | java | private void appendValue(StringBuilder builder, Class fieldClazz, Object value)
{
if (fieldClazz != null
&& value != null
&& (fieldClazz.isAssignableFrom(String.class) || fieldClazz.isAssignableFrom(char.class)
|| fieldClazz.isAssignableFrom(Character.class) || value instanceof Enum))
{
if (fieldClazz.isAssignableFrom(String.class))
{
// To allow escape character
value = ((String) value).replaceAll("'", "''");
}
builder.append("'");
if (value instanceof Enum)
{
builder.append(((Enum) value).name());
}
else
{
builder.append(value);
}
builder.append("'");
}
else
{
builder.append(value);
}
} | [
"private",
"void",
"appendValue",
"(",
"StringBuilder",
"builder",
",",
"Class",
"fieldClazz",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"fieldClazz",
"!=",
"null",
"&&",
"value",
"!=",
"null",
"&&",
"(",
"fieldClazz",
".",
"isAssignableFrom",
"(",
"Strin... | Append value.
@param builder
the builder
@param fieldClazz
the field clazz
@param value
the value | [
"Append",
"value",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-spark/spark-core/src/main/java/com/impetus/spark/client/SparkClient.java#L138-L170 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseId.java | DatabaseId.of | public static DatabaseId of(String project, String instance, String database) {
return new DatabaseId(new InstanceId(project, instance), database);
} | java | public static DatabaseId of(String project, String instance, String database) {
return new DatabaseId(new InstanceId(project, instance), database);
} | [
"public",
"static",
"DatabaseId",
"of",
"(",
"String",
"project",
",",
"String",
"instance",
",",
"String",
"database",
")",
"{",
"return",
"new",
"DatabaseId",
"(",
"new",
"InstanceId",
"(",
"project",
",",
"instance",
")",
",",
"database",
")",
";",
"}"
... | Creates a {@code DatabaseId} given project, instance and database IDs. | [
"Creates",
"a",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseId.java#L92-L94 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java | InternalTextureLoader.getTexture | private TextureImpl getTexture(InputStream in,
String resourceName,
int target,
int magFilter,
int minFilter, boolean flipped, int[] transparent) throws IOException
{
// create the texture ID for this texture
ByteBuffer textureBuffer;
LoadableImageData imageData = ImageDataFactory.getImageDataFor(resourceName);
textureBuffer = imageData.loadImage(new BufferedInputStream(in), flipped, transparent);
int textureID = createTextureID();
TextureImpl texture = new TextureImpl(resourceName, target, textureID);
// bind this texture
GL.glBindTexture(target, textureID);
int width;
int height;
int texWidth;
int texHeight;
boolean hasAlpha;
width = imageData.getWidth();
height = imageData.getHeight();
hasAlpha = imageData.getDepth() == 32;
texture.setTextureWidth(imageData.getTexWidth());
texture.setTextureHeight(imageData.getTexHeight());
texWidth = texture.getTextureWidth();
texHeight = texture.getTextureHeight();
IntBuffer temp = BufferUtils.createIntBuffer(16);
GL.glGetInteger(SGL.GL_MAX_TEXTURE_SIZE, temp);
int max = temp.get(0);
if ((texWidth > max) || (texHeight > max)) {
throw new IOException("Attempt to allocate a texture to big for the current hardware");
}
int srcPixelFormat = hasAlpha ? SGL.GL_RGBA : SGL.GL_RGB;
int componentCount = hasAlpha ? 4 : 3;
texture.setWidth(width);
texture.setHeight(height);
texture.setAlpha(hasAlpha);
if (holdTextureData) {
texture.setTextureData(srcPixelFormat, componentCount, minFilter, magFilter, textureBuffer);
}
GL.glTexParameteri(target, GL.GL_TEXTURE_MIN_FILTER, minFilter);
GL.glTexParameteri(target, GL.GL_TEXTURE_MAG_FILTER, magFilter);
// produce a texture from the byte buffer
GL.glTexImage2D(target,
0,
dstPixelFormat,
get2Fold(width),
get2Fold(height),
0,
srcPixelFormat,
SGL.GL_UNSIGNED_BYTE,
textureBuffer);
return texture;
} | java | private TextureImpl getTexture(InputStream in,
String resourceName,
int target,
int magFilter,
int minFilter, boolean flipped, int[] transparent) throws IOException
{
// create the texture ID for this texture
ByteBuffer textureBuffer;
LoadableImageData imageData = ImageDataFactory.getImageDataFor(resourceName);
textureBuffer = imageData.loadImage(new BufferedInputStream(in), flipped, transparent);
int textureID = createTextureID();
TextureImpl texture = new TextureImpl(resourceName, target, textureID);
// bind this texture
GL.glBindTexture(target, textureID);
int width;
int height;
int texWidth;
int texHeight;
boolean hasAlpha;
width = imageData.getWidth();
height = imageData.getHeight();
hasAlpha = imageData.getDepth() == 32;
texture.setTextureWidth(imageData.getTexWidth());
texture.setTextureHeight(imageData.getTexHeight());
texWidth = texture.getTextureWidth();
texHeight = texture.getTextureHeight();
IntBuffer temp = BufferUtils.createIntBuffer(16);
GL.glGetInteger(SGL.GL_MAX_TEXTURE_SIZE, temp);
int max = temp.get(0);
if ((texWidth > max) || (texHeight > max)) {
throw new IOException("Attempt to allocate a texture to big for the current hardware");
}
int srcPixelFormat = hasAlpha ? SGL.GL_RGBA : SGL.GL_RGB;
int componentCount = hasAlpha ? 4 : 3;
texture.setWidth(width);
texture.setHeight(height);
texture.setAlpha(hasAlpha);
if (holdTextureData) {
texture.setTextureData(srcPixelFormat, componentCount, minFilter, magFilter, textureBuffer);
}
GL.glTexParameteri(target, GL.GL_TEXTURE_MIN_FILTER, minFilter);
GL.glTexParameteri(target, GL.GL_TEXTURE_MAG_FILTER, magFilter);
// produce a texture from the byte buffer
GL.glTexImage2D(target,
0,
dstPixelFormat,
get2Fold(width),
get2Fold(height),
0,
srcPixelFormat,
SGL.GL_UNSIGNED_BYTE,
textureBuffer);
return texture;
} | [
"private",
"TextureImpl",
"getTexture",
"(",
"InputStream",
"in",
",",
"String",
"resourceName",
",",
"int",
"target",
",",
"int",
"magFilter",
",",
"int",
"minFilter",
",",
"boolean",
"flipped",
",",
"int",
"[",
"]",
"transparent",
")",
"throws",
"IOException... | Get a texture from a image file
@param in The stream from which we can load the image
@param resourceName The name to give this image in the internal cache
@param flipped True if we should flip the image on the y-axis while loading
@param target The texture target we're loading this texture into
@param minFilter The scaling down filter
@param magFilter The scaling up filter
@param transparent The colour to interpret as transparent or null if none
@return The texture loaded
@throws IOException Indicates a failure to load the image | [
"Get",
"a",
"texture",
"from",
"a",
"image",
"file"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java#L282-L349 |
tehuti-io/tehuti | src/main/java/io/tehuti/metrics/Sensor.java | Sensor.add | public synchronized Metric add(String name, String description, MeasurableStat stat, MetricConfig config) {
MetricConfig statConfig = (config == null ? this.config : config);
TehutiMetric metric = new TehutiMetric(this,
Utils.notNull(name),
Utils.notNull(description),
Utils.notNull(stat),
statConfig,
time);
this.registry.registerMetric(metric);
this.metrics.add(metric);
this.stats.add(stat);
this.statConfigs.put(stat, statConfig);
return metric;
} | java | public synchronized Metric add(String name, String description, MeasurableStat stat, MetricConfig config) {
MetricConfig statConfig = (config == null ? this.config : config);
TehutiMetric metric = new TehutiMetric(this,
Utils.notNull(name),
Utils.notNull(description),
Utils.notNull(stat),
statConfig,
time);
this.registry.registerMetric(metric);
this.metrics.add(metric);
this.stats.add(stat);
this.statConfigs.put(stat, statConfig);
return metric;
} | [
"public",
"synchronized",
"Metric",
"add",
"(",
"String",
"name",
",",
"String",
"description",
",",
"MeasurableStat",
"stat",
",",
"MetricConfig",
"config",
")",
"{",
"MetricConfig",
"statConfig",
"=",
"(",
"config",
"==",
"null",
"?",
"this",
".",
"config",
... | Register a metric with this sensor
@param name The name of the metric
@param description A description used when reporting the value
@param stat The statistic to keep
@param config A special configuration for this metric. If null use the sensor default configuration.
@return a {@link Metric} instance representing the registered metric | [
"Register",
"a",
"metric",
"with",
"this",
"sensor"
] | train | https://github.com/tehuti-io/tehuti/blob/c28a2f838eac775660efb270aafd2a464d712948/src/main/java/io/tehuti/metrics/Sensor.java#L204-L217 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/ValidationMatcherLibraryParser.java | ValidationMatcherLibraryParser.parseMatcherDefinitions | private void parseMatcherDefinitions(BeanDefinitionBuilder builder, Element element) {
ManagedMap<String, Object> matchers = new ManagedMap<String, Object>();
for (Element matcher : DomUtils.getChildElementsByTagName(element, "matcher")) {
if (matcher.hasAttribute("ref")) {
matchers.put(matcher.getAttribute("name"), new RuntimeBeanReference(matcher.getAttribute("ref")));
} else {
matchers.put(matcher.getAttribute("name"), BeanDefinitionBuilder.rootBeanDefinition(matcher.getAttribute("class")).getBeanDefinition());
}
}
if (!matchers.isEmpty()) {
builder.addPropertyValue("members", matchers);
}
} | java | private void parseMatcherDefinitions(BeanDefinitionBuilder builder, Element element) {
ManagedMap<String, Object> matchers = new ManagedMap<String, Object>();
for (Element matcher : DomUtils.getChildElementsByTagName(element, "matcher")) {
if (matcher.hasAttribute("ref")) {
matchers.put(matcher.getAttribute("name"), new RuntimeBeanReference(matcher.getAttribute("ref")));
} else {
matchers.put(matcher.getAttribute("name"), BeanDefinitionBuilder.rootBeanDefinition(matcher.getAttribute("class")).getBeanDefinition());
}
}
if (!matchers.isEmpty()) {
builder.addPropertyValue("members", matchers);
}
} | [
"private",
"void",
"parseMatcherDefinitions",
"(",
"BeanDefinitionBuilder",
"builder",
",",
"Element",
"element",
")",
"{",
"ManagedMap",
"<",
"String",
",",
"Object",
">",
"matchers",
"=",
"new",
"ManagedMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",... | Parses all variable definitions and adds those to the bean definition
builder as property value.
@param builder the target bean definition builder.
@param element the source element. | [
"Parses",
"all",
"variable",
"definitions",
"and",
"adds",
"those",
"to",
"the",
"bean",
"definition",
"builder",
"as",
"property",
"value",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/ValidationMatcherLibraryParser.java#L54-L67 |
google/closure-compiler | src/com/google/javascript/jscomp/InlineSimpleMethods.java | InlineSimpleMethods.inlineConstReturn | private void inlineConstReturn(Node parent, Node call, Node returnedValue) {
Node retValue = returnedValue.cloneTree();
parent.replaceChild(call, retValue);
compiler.reportChangeToEnclosingScope(retValue);
} | java | private void inlineConstReturn(Node parent, Node call, Node returnedValue) {
Node retValue = returnedValue.cloneTree();
parent.replaceChild(call, retValue);
compiler.reportChangeToEnclosingScope(retValue);
} | [
"private",
"void",
"inlineConstReturn",
"(",
"Node",
"parent",
",",
"Node",
"call",
",",
"Node",
"returnedValue",
")",
"{",
"Node",
"retValue",
"=",
"returnedValue",
".",
"cloneTree",
"(",
")",
";",
"parent",
".",
"replaceChild",
"(",
"call",
",",
"retValue"... | Replace the provided object and its method call with the tree specified
in returnedValue. Should be called only if the object reference has
no side effects. | [
"Replace",
"the",
"provided",
"object",
"and",
"its",
"method",
"call",
"with",
"the",
"tree",
"specified",
"in",
"returnedValue",
".",
"Should",
"be",
"called",
"only",
"if",
"the",
"object",
"reference",
"has",
"no",
"side",
"effects",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L232-L236 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getInstance | public static BtcFormat getInstance(int scale, int minDecimals, int... groups) {
return getInstance(scale, defaultLocale(), minDecimals, boxAsList(groups));
} | java | public static BtcFormat getInstance(int scale, int minDecimals, int... groups) {
return getInstance(scale, defaultLocale(), minDecimals, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getInstance",
"(",
"int",
"scale",
",",
"int",
"minDecimals",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"scale",
",",
"defaultLocale",
"(",
")",
",",
"minDecimals",
",",
"boxAsList",
"(",
"groups",... | Return a new fixed-denomination formatter with the specified fractional decimal
placing. The first argument specifies the denomination as the size of the
shift from coin-denomination in increasingly-precise decimal places. The returned object will format
and parse values according to the default locale, and will format the fractional part of
numbers with the given minimum number of fractional decimal places. Optionally,
repeating integer arguments can be passed, each indicating the size of an additional
group of fractional decimal places to be used as necessary to avoid rounding, to a
limiting precision of satoshis. | [
"Return",
"a",
"new",
"fixed",
"-",
"denomination",
"formatter",
"with",
"the",
"specified",
"fractional",
"decimal",
"placing",
".",
"The",
"first",
"argument",
"specifies",
"the",
"denomination",
"as",
"the",
"size",
"of",
"the",
"shift",
"from",
"coin",
"-"... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1062-L1064 |
RestComm/jss7 | m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UAManagementImpl.java | M3UAManagementImpl.createAspFactory | public AspFactory createAspFactory(String aspName, String associationName) throws Exception {
return this.createAspFactory(aspName, associationName, false);
} | java | public AspFactory createAspFactory(String aspName, String associationName) throws Exception {
return this.createAspFactory(aspName, associationName, false);
} | [
"public",
"AspFactory",
"createAspFactory",
"(",
"String",
"aspName",
",",
"String",
"associationName",
")",
"throws",
"Exception",
"{",
"return",
"this",
".",
"createAspFactory",
"(",
"aspName",
",",
"associationName",
",",
"false",
")",
";",
"}"
] | Create new {@link AspFactoryImpl} without passing optional aspid and heartbeat is false
@param aspName
@param associationName
@return
@throws Exception | [
"Create",
"new",
"{",
"@link",
"AspFactoryImpl",
"}",
"without",
"passing",
"optional",
"aspid",
"and",
"heartbeat",
"is",
"false"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UAManagementImpl.java#L521-L523 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java | RouteTablesInner.createOrUpdate | public RouteTableInner createOrUpdate(String resourceGroupName, String routeTableName, RouteTableInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).toBlocking().last().body();
} | java | public RouteTableInner createOrUpdate(String resourceGroupName, String routeTableName, RouteTableInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).toBlocking().last().body();
} | [
"public",
"RouteTableInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeTableName",
",",
"RouteTableInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeTableName",
",",
"par... | Create or updates a route table in a specified resource group.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@param parameters Parameters supplied to the create or update route table operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RouteTableInner object if successful. | [
"Create",
"or",
"updates",
"a",
"route",
"table",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java#L444-L446 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ContainerStateMonitor.java | ContainerStateMonitor.awaitStabilityUninterruptibly | void awaitStabilityUninterruptibly(long timeout, TimeUnit timeUnit) throws TimeoutException {
boolean interrupted = false;
try {
long toWait = timeUnit.toMillis(timeout);
long msTimeout = System.currentTimeMillis() + toWait;
while (true) {
if (interrupted) {
toWait = msTimeout - System.currentTimeMillis();
}
try {
if (toWait <= 0 || !monitor.awaitStability(toWait, TimeUnit.MILLISECONDS, failed, problems)) {
throw new TimeoutException();
}
break;
} catch (InterruptedException e) {
interrupted = true;
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
} | java | void awaitStabilityUninterruptibly(long timeout, TimeUnit timeUnit) throws TimeoutException {
boolean interrupted = false;
try {
long toWait = timeUnit.toMillis(timeout);
long msTimeout = System.currentTimeMillis() + toWait;
while (true) {
if (interrupted) {
toWait = msTimeout - System.currentTimeMillis();
}
try {
if (toWait <= 0 || !monitor.awaitStability(toWait, TimeUnit.MILLISECONDS, failed, problems)) {
throw new TimeoutException();
}
break;
} catch (InterruptedException e) {
interrupted = true;
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
} | [
"void",
"awaitStabilityUninterruptibly",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"throws",
"TimeoutException",
"{",
"boolean",
"interrupted",
"=",
"false",
";",
"try",
"{",
"long",
"toWait",
"=",
"timeUnit",
".",
"toMillis",
"(",
"timeout",
")"... | Await service container stability ignoring thread interruption.
@param timeout maximum period to wait for service container stability
@param timeUnit unit in which {@code timeout} is expressed
@throws java.util.concurrent.TimeoutException if service container stability is not reached before the specified timeout | [
"Await",
"service",
"container",
"stability",
"ignoring",
"thread",
"interruption",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ContainerStateMonitor.java#L89-L112 |
arnaudroger/SimpleFlatMapper | sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/JdbcMapperFactory.java | JdbcMapperFactory.getterFactory | public JdbcMapperFactory getterFactory(final GetterFactory<ResultSet, JdbcColumnKey> getterFactory) {
return addGetterFactory(new ContextualGetterFactoryAdapter<ResultSet, JdbcColumnKey>(getterFactory));
} | java | public JdbcMapperFactory getterFactory(final GetterFactory<ResultSet, JdbcColumnKey> getterFactory) {
return addGetterFactory(new ContextualGetterFactoryAdapter<ResultSet, JdbcColumnKey>(getterFactory));
} | [
"public",
"JdbcMapperFactory",
"getterFactory",
"(",
"final",
"GetterFactory",
"<",
"ResultSet",
",",
"JdbcColumnKey",
">",
"getterFactory",
")",
"{",
"return",
"addGetterFactory",
"(",
"new",
"ContextualGetterFactoryAdapter",
"<",
"ResultSet",
",",
"JdbcColumnKey",
">"... | Override the default implementation of the GetterFactory used to get access to value from the ResultSet.
@param getterFactory the getterFactory
@return the current factory | [
"Override",
"the",
"default",
"implementation",
"of",
"the",
"GetterFactory",
"used",
"to",
"get",
"access",
"to",
"value",
"from",
"the",
"ResultSet",
"."
] | train | https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/JdbcMapperFactory.java#L91-L93 |
payneteasy/superfly | superfly-demo/src/main/java/com/payneteasy/superfly/demo/web/utils/CommonsHttpInvokerRequestExecutor.java | CommonsHttpInvokerRequestExecutor.getResponseBody | protected InputStream getResponseBody(HttpInvokerClientConfiguration config, PostMethod postMethod)
throws IOException {
if (isGzipResponse(postMethod)) {
return new GZIPInputStream(postMethod.getResponseBodyAsStream());
}
else {
return postMethod.getResponseBodyAsStream();
}
} | java | protected InputStream getResponseBody(HttpInvokerClientConfiguration config, PostMethod postMethod)
throws IOException {
if (isGzipResponse(postMethod)) {
return new GZIPInputStream(postMethod.getResponseBodyAsStream());
}
else {
return postMethod.getResponseBodyAsStream();
}
} | [
"protected",
"InputStream",
"getResponseBody",
"(",
"HttpInvokerClientConfiguration",
"config",
",",
"PostMethod",
"postMethod",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isGzipResponse",
"(",
"postMethod",
")",
")",
"{",
"return",
"new",
"GZIPInputStream",
"(",
... | Extract the response body from the given executed remote invocation request.
<p>The default implementation simply fetches the PostMethod's response body stream.
If the response is recognized as GZIP response, the InputStream will get wrapped
in a GZIPInputStream.
@param config the HTTP invoker configuration that specifies the target service
@param postMethod the PostMethod to read the response body from
@return an InputStream for the response body
@throws IOException if thrown by I/O methods
@see #isGzipResponse
@see java.util.zip.GZIPInputStream
@see org.apache.commons.httpclient.methods.PostMethod#getResponseBodyAsStream()
@see org.apache.commons.httpclient.methods.PostMethod#getResponseHeader(String) | [
"Extract",
"the",
"response",
"body",
"from",
"the",
"given",
"executed",
"remote",
"invocation",
"request",
".",
"<p",
">",
"The",
"default",
"implementation",
"simply",
"fetches",
"the",
"PostMethod",
"s",
"response",
"body",
"stream",
".",
"If",
"the",
"res... | train | https://github.com/payneteasy/superfly/blob/4cad6d0f8e951a61f3c302c49b13a51d179076f8/superfly-demo/src/main/java/com/payneteasy/superfly/demo/web/utils/CommonsHttpInvokerRequestExecutor.java#L229-L238 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java | CommonsAssert.assertNotEquals | public static <T> void assertNotEquals (@Nullable final T x, @Nullable final T y)
{
assertNotEquals ((String) null, x, y);
} | java | public static <T> void assertNotEquals (@Nullable final T x, @Nullable final T y)
{
assertNotEquals ((String) null, x, y);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"assertNotEquals",
"(",
"@",
"Nullable",
"final",
"T",
"x",
",",
"@",
"Nullable",
"final",
"T",
"y",
")",
"{",
"assertNotEquals",
"(",
"(",
"String",
")",
"null",
",",
"x",
",",
"y",
")",
";",
"}"
] | Like JUnit assertNotEquals but using {@link EqualsHelper}.
@param x
Fist object. May be <code>null</code>
@param y
Second object. May be <code>null</code>. | [
"Like",
"JUnit",
"assertNotEquals",
"but",
"using",
"{",
"@link",
"EqualsHelper",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mock/CommonsAssert.java#L204-L207 |
alkacon/opencms-core | src/org/opencms/ui/apps/git/CmsGitCheckin.java | CmsGitCheckin.checkIn | public int checkIn() {
try {
synchronized (STATIC_LOCK) {
m_logStream = new PrintStream(new FileOutputStream(DEFAULT_LOGFILE_PATH, false));
CmsObject cms = getCmsObject();
if (cms != null) {
return checkInInternal();
} else {
m_logStream.println("No CmsObject given. Did you call init() first?");
return -1;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
return -2;
}
} | java | public int checkIn() {
try {
synchronized (STATIC_LOCK) {
m_logStream = new PrintStream(new FileOutputStream(DEFAULT_LOGFILE_PATH, false));
CmsObject cms = getCmsObject();
if (cms != null) {
return checkInInternal();
} else {
m_logStream.println("No CmsObject given. Did you call init() first?");
return -1;
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
return -2;
}
} | [
"public",
"int",
"checkIn",
"(",
")",
"{",
"try",
"{",
"synchronized",
"(",
"STATIC_LOCK",
")",
"{",
"m_logStream",
"=",
"new",
"PrintStream",
"(",
"new",
"FileOutputStream",
"(",
"DEFAULT_LOGFILE_PATH",
",",
"false",
")",
")",
";",
"CmsObject",
"cms",
"=",
... | Start export and check in of the selected modules.
@return The exit code of the check in procedure (like a script's exit code). | [
"Start",
"export",
"and",
"check",
"in",
"of",
"the",
"selected",
"modules",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L232-L249 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java | ProcessContext.validateAttribute | public void validateAttribute(String attribute) throws CompatibilityException {
try {
super.validateObject(attribute);
} catch (CompatibilityException e) {
throw new CompatibilityException("Unknown attribute: " + attribute, e);
}
} | java | public void validateAttribute(String attribute) throws CompatibilityException {
try {
super.validateObject(attribute);
} catch (CompatibilityException e) {
throw new CompatibilityException("Unknown attribute: " + attribute, e);
}
} | [
"public",
"void",
"validateAttribute",
"(",
"String",
"attribute",
")",
"throws",
"CompatibilityException",
"{",
"try",
"{",
"super",
".",
"validateObject",
"(",
"attribute",
")",
";",
"}",
"catch",
"(",
"CompatibilityException",
"e",
")",
"{",
"throw",
"new",
... | Checks if the given attribute is known, i.e. is contained in the
attribute list.
@param attribute Attribute to be checked.
@throws IllegalArgumentException If the given attribute is not known. | [
"Checks",
"if",
"the",
"given",
"attribute",
"is",
"known",
"i",
".",
"e",
".",
"is",
"contained",
"in",
"the",
"attribute",
"list",
"."
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L886-L892 |
taimos/RESTUtils | src/main/java/de/taimos/restutils/RESTAssert.java | RESTAssert.assertEquals | @SuppressWarnings("null")
public static void assertEquals(final Object one, final Object two, final StatusType status) {
if ((one == null) && (two == null)) {
return;
}
RESTAssert.assertNotNull(one, status);
RESTAssert.assertTrue(one.equals(two), status);
} | java | @SuppressWarnings("null")
public static void assertEquals(final Object one, final Object two, final StatusType status) {
if ((one == null) && (two == null)) {
return;
}
RESTAssert.assertNotNull(one, status);
RESTAssert.assertTrue(one.equals(two), status);
} | [
"@",
"SuppressWarnings",
"(",
"\"null\"",
")",
"public",
"static",
"void",
"assertEquals",
"(",
"final",
"Object",
"one",
",",
"final",
"Object",
"two",
",",
"final",
"StatusType",
"status",
")",
"{",
"if",
"(",
"(",
"one",
"==",
"null",
")",
"&&",
"(",
... | assert that objects are equal.<br>
This means they are both <i>null</i> or <code>one.equals(two)</code> returns <i>true</i>
@param one the first object
@param two the second object
@param status the status code to throw
@throws WebApplicationException with given status code | [
"assert",
"that",
"objects",
"are",
"equal",
".",
"<br",
">",
"This",
"means",
"they",
"are",
"both",
"<i",
">",
"null<",
"/",
"i",
">",
"or",
"<code",
">",
"one",
".",
"equals",
"(",
"two",
")",
"<",
"/",
"code",
">",
"returns",
"<i",
">",
"true... | train | https://github.com/taimos/RESTUtils/blob/bdb1bf9a2eb13ede0eec6f071c10cb2698313501/src/main/java/de/taimos/restutils/RESTAssert.java#L251-L258 |
ical4j/ical4j | src/main/java/net/fortuna/ical4j/data/CalendarParserImpl.java | CalendarParserImpl.skipNewLines | private int skipNewLines(StreamTokenizer tokeniser, Reader in, String token) throws ParserException, IOException {
for (int i = 0;; i++) {
try {
return assertToken(tokeniser, in, StreamTokenizer.TT_WORD);
} catch (ParserException exc) {
//Skip a maximum of 10 newlines, linefeeds etc at the beginning
if (i == IGNORE_BEGINNING_NON_WORD_COUNT) {
throw exc;
}
}
}
} | java | private int skipNewLines(StreamTokenizer tokeniser, Reader in, String token) throws ParserException, IOException {
for (int i = 0;; i++) {
try {
return assertToken(tokeniser, in, StreamTokenizer.TT_WORD);
} catch (ParserException exc) {
//Skip a maximum of 10 newlines, linefeeds etc at the beginning
if (i == IGNORE_BEGINNING_NON_WORD_COUNT) {
throw exc;
}
}
}
} | [
"private",
"int",
"skipNewLines",
"(",
"StreamTokenizer",
"tokeniser",
",",
"Reader",
"in",
",",
"String",
"token",
")",
"throws",
"ParserException",
",",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
";",
"i",
"++",
")",
"{",
"try",
"{",
... | Skip newlines and linefeed at the beginning.
@param tokeniser
@param in
@param token
@return int value of the ttype field of the tokeniser
@throws ParserException
@throws IOException | [
"Skip",
"newlines",
"and",
"linefeed",
"at",
"the",
"beginning",
"."
] | train | https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/data/CalendarParserImpl.java#L542-L553 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.toUpdate | public String toUpdate(Dialect dialect, String ... replacements) {
return dialect.update(metaModelLocal, attributes, replacements);
} | java | public String toUpdate(Dialect dialect, String ... replacements) {
return dialect.update(metaModelLocal, attributes, replacements);
} | [
"public",
"String",
"toUpdate",
"(",
"Dialect",
"dialect",
",",
"String",
"...",
"replacements",
")",
"{",
"return",
"dialect",
".",
"update",
"(",
"metaModelLocal",
",",
"attributes",
",",
"replacements",
")",
";",
"}"
] | Generates UPDATE SQL based on this model with the provided dialect.
Example:
<pre>
String sql = user.toUpdate(new MySQLDialect());
//yields this output:
//UPDATE users SET email = 'mmonroe@yahoo.com', first_name = 'Marilyn', last_name = 'Monroe' WHERE id = 1
</pre>
@param dialect dialect to be used to generate the SQL
@param replacements an array of strings, where odd values are to be replaced in the values of the attributes
and even values are replacements. For instance, your value is "O'Donnel", which contains
a single quote. In order to escape/replace it, you can:
<code>person.toUpdate(dialect, "'", "''")</code>, which will escape a single quote by two
single quotes.
@return UPDATE SQL based on this model. | [
"Generates",
"UPDATE",
"SQL",
"based",
"on",
"this",
"model",
"with",
"the",
"provided",
"dialect",
".",
"Example",
":",
"<pre",
">",
"String",
"sql",
"=",
"user",
".",
"toUpdate",
"(",
"new",
"MySQLDialect",
"()",
")",
";",
"//",
"yields",
"this",
"outp... | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L3074-L3076 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNoParameters | public static void assertNoParameters(final Method method, Class<? extends Annotation> annotation)
{
if (method.getParameterTypes().length != 0)
{
throw annotation == null ? MESSAGES.methodHasToHaveNoParameters(method) : MESSAGES.methodHasToHaveNoParameters2(method, annotation);
}
} | java | public static void assertNoParameters(final Method method, Class<? extends Annotation> annotation)
{
if (method.getParameterTypes().length != 0)
{
throw annotation == null ? MESSAGES.methodHasToHaveNoParameters(method) : MESSAGES.methodHasToHaveNoParameters2(method, annotation);
}
} | [
"public",
"static",
"void",
"assertNoParameters",
"(",
"final",
"Method",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"length",
"!=",
"0",
")",
"{",
... | Asserts method have no parameters.
@param method to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"method",
"have",
"no",
"parameters",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L104-L110 |
fernandospr/javapns-jdk16 | src/main/java/javapns/communication/KeystoreManager.java | KeystoreManager.ensureReusableKeystore | static Object ensureReusableKeystore(AppleServer server, Object keystore) throws KeystoreException {
if (keystore instanceof InputStream) keystore = loadKeystore(server, keystore, false);
return keystore;
} | java | static Object ensureReusableKeystore(AppleServer server, Object keystore) throws KeystoreException {
if (keystore instanceof InputStream) keystore = loadKeystore(server, keystore, false);
return keystore;
} | [
"static",
"Object",
"ensureReusableKeystore",
"(",
"AppleServer",
"server",
",",
"Object",
"keystore",
")",
"throws",
"KeystoreException",
"{",
"if",
"(",
"keystore",
"instanceof",
"InputStream",
")",
"keystore",
"=",
"loadKeystore",
"(",
"server",
",",
"keystore",
... | Make sure that the provided keystore will be reusable.
@param server the server the keystore is intended for
@param keystore a keystore containing your private key and the certificate signed by Apple (File, InputStream, byte[], KeyStore or String for a file path)
@return a reusable keystore
@throws KeystoreException | [
"Make",
"sure",
"that",
"the",
"provided",
"keystore",
"will",
"be",
"reusable",
"."
] | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/communication/KeystoreManager.java#L86-L89 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java | EnvironmentsInner.listAsync | public Observable<Page<EnvironmentInner>> listAsync(final String resourceGroupName, final String labAccountName, final String labName, final String environmentSettingName) {
return listWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName)
.map(new Func1<ServiceResponse<Page<EnvironmentInner>>, Page<EnvironmentInner>>() {
@Override
public Page<EnvironmentInner> call(ServiceResponse<Page<EnvironmentInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<EnvironmentInner>> listAsync(final String resourceGroupName, final String labAccountName, final String labName, final String environmentSettingName) {
return listWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName)
.map(new Func1<ServiceResponse<Page<EnvironmentInner>>, Page<EnvironmentInner>>() {
@Override
public Page<EnvironmentInner> call(ServiceResponse<Page<EnvironmentInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"EnvironmentInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"labAccountName",
",",
"final",
"String",
"labName",
",",
"final",
"String",
"environmentSettingName",
")",
"{... | List environments in a given environment setting.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<EnvironmentInner> object | [
"List",
"environments",
"in",
"a",
"given",
"environment",
"setting",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L181-L189 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/config/impl/YamlConfigurationParser.java | YamlConfigurationParser.getEnvConfig | private <T> T getEnvConfig(Map<String, ?> configs, String key, Class<T> type) {
if(configs.containsKey(key)) {
Object config = configs.get(key);
if(type.isAssignableFrom(config.getClass())) {
return type.cast(config);
}
}
return null;
} | java | private <T> T getEnvConfig(Map<String, ?> configs, String key, Class<T> type) {
if(configs.containsKey(key)) {
Object config = configs.get(key);
if(type.isAssignableFrom(config.getClass())) {
return type.cast(config);
}
}
return null;
} | [
"private",
"<",
"T",
">",
"T",
"getEnvConfig",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"configs",
",",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"configs",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"Object"... | Helper method used to retrieve the value from a given map if it matches the type specified.
@param configs The map to pull from.
@param key The key to pull.
@param type The expected type of the value.
@return | [
"Helper",
"method",
"used",
"to",
"retrieve",
"the",
"value",
"from",
"a",
"given",
"map",
"if",
"it",
"matches",
"the",
"type",
"specified",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/config/impl/YamlConfigurationParser.java#L201-L209 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/source/extractor/utils/Utils.java | Utils.csvToJsonObject | public static JsonObject csvToJsonObject(List<String> bulkRecordHeader, List<String> record, int columnCount) {
ObjectMapper mapper = new ObjectMapper();
Map<String, String> resultInfo = new HashMap<>();
for (int i = 0; i < columnCount; i++) {
resultInfo.put(bulkRecordHeader.get(i), record.get(i));
}
JsonNode json = mapper.valueToTree(resultInfo);
JsonElement element = GSON.fromJson(json.toString(), JsonObject.class);
return element.getAsJsonObject();
} | java | public static JsonObject csvToJsonObject(List<String> bulkRecordHeader, List<String> record, int columnCount) {
ObjectMapper mapper = new ObjectMapper();
Map<String, String> resultInfo = new HashMap<>();
for (int i = 0; i < columnCount; i++) {
resultInfo.put(bulkRecordHeader.get(i), record.get(i));
}
JsonNode json = mapper.valueToTree(resultInfo);
JsonElement element = GSON.fromJson(json.toString(), JsonObject.class);
return element.getAsJsonObject();
} | [
"public",
"static",
"JsonObject",
"csvToJsonObject",
"(",
"List",
"<",
"String",
">",
"bulkRecordHeader",
",",
"List",
"<",
"String",
">",
"record",
",",
"int",
"columnCount",
")",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"Ma... | Convert CSV record(List<Strings>) to JsonObject using header(column Names)
@param header record
@param data record
@param column Count
@return JsonObject | [
"Convert",
"CSV",
"record",
"(",
"List<Strings",
">",
")",
"to",
"JsonObject",
"using",
"header",
"(",
"column",
"Names",
")"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/utils/Utils.java#L240-L250 |
sirensolutions/siren-join | src/main/java/solutions/siren/join/common/Bytes.java | Bytes.writeVInt | public final static void writeVInt(BytesRef dst, int i) {
while ((i & ~0x7F) != 0) {
dst.bytes[dst.offset++] = (byte) ((i & 0x7f) | 0x80);
i >>>= 7;
}
dst.bytes[dst.offset++] = (byte) i;
} | java | public final static void writeVInt(BytesRef dst, int i) {
while ((i & ~0x7F) != 0) {
dst.bytes[dst.offset++] = (byte) ((i & 0x7f) | 0x80);
i >>>= 7;
}
dst.bytes[dst.offset++] = (byte) i;
} | [
"public",
"final",
"static",
"void",
"writeVInt",
"(",
"BytesRef",
"dst",
",",
"int",
"i",
")",
"{",
"while",
"(",
"(",
"i",
"&",
"~",
"0x7F",
")",
"!=",
"0",
")",
"{",
"dst",
".",
"bytes",
"[",
"dst",
".",
"offset",
"++",
"]",
"=",
"(",
"byte"... | Writes an int in a variable-length format.
Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers
will always use all 5 bytes and are therefore better serialized using {@link #writeInt}. | [
"Writes",
"an",
"int",
"in",
"a",
"variable",
"-",
"length",
"format",
".",
"Writes",
"between",
"one",
"and",
"five",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"will",
"always",
"use",
"all",
"5",
"bytes",
... | train | https://github.com/sirensolutions/siren-join/blob/cba1111b209ce6f72ab7750d5488a573a6c77fe5/src/main/java/solutions/siren/join/common/Bytes.java#L72-L78 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/SolrTemplate.java | SolrTemplate.constructQuery | protected SolrQuery constructQuery(SolrDataQuery query, @Nullable Class<?> domainType) {
return lookupQueryParser(query).constructSolrQuery(query, domainType);
} | java | protected SolrQuery constructQuery(SolrDataQuery query, @Nullable Class<?> domainType) {
return lookupQueryParser(query).constructSolrQuery(query, domainType);
} | [
"protected",
"SolrQuery",
"constructQuery",
"(",
"SolrDataQuery",
"query",
",",
"@",
"Nullable",
"Class",
"<",
"?",
">",
"domainType",
")",
"{",
"return",
"lookupQueryParser",
"(",
"query",
")",
".",
"constructSolrQuery",
"(",
"query",
",",
"domainType",
")",
... | Create the native {@link SolrQuery} from a given {@link SolrDataQuery}.
@param query never {@literal null}.
@return never {@literal null}.
@since 2.1.11 | [
"Create",
"the",
"native",
"{",
"@link",
"SolrQuery",
"}",
"from",
"a",
"given",
"{",
"@link",
"SolrDataQuery",
"}",
"."
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/SolrTemplate.java#L529-L531 |
ysc/QuestionAnsweringSystem | deep-qa/src/main/java/org/apdplat/qa/util/TextExtract.java | TextExtract.parse | public static String parse(String _html, boolean _flag) {
flag = _flag;
html = _html;
preProcess();
// System.out.println(html);
return getText();
} | java | public static String parse(String _html, boolean _flag) {
flag = _flag;
html = _html;
preProcess();
// System.out.println(html);
return getText();
} | [
"public",
"static",
"String",
"parse",
"(",
"String",
"_html",
",",
"boolean",
"_flag",
")",
"{",
"flag",
"=",
"_flag",
";",
"html",
"=",
"_html",
";",
"preProcess",
"(",
")",
";",
"//\t\tSystem.out.println(html);\r",
"return",
"getText",
"(",
")",
";",
"}... | 判断传入HTML,若是主题类网页,则抽取正文;否则输出<b>"unkown"</b>。
@param _html 网页HTML字符串
@param _flag true进行主题类判断, 省略此参数则默认为false
@return 网页正文string | [
"判断传入HTML,若是主题类网页,则抽取正文;否则输出<b",
">",
"unkown",
"<",
"/",
"b",
">",
"。"
] | train | https://github.com/ysc/QuestionAnsweringSystem/blob/83f43625f1e0c2f4b72ebca7b0d8282fdf77c997/deep-qa/src/main/java/org/apdplat/qa/util/TextExtract.java#L81-L87 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java | JsMainImpl.getMessagingEngine | public JsMessagingEngine getMessagingEngine(String busName, String engine) {
String thisMethodName = CLASS_NAME
+ ".getMessagingEngine(String, String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { busName, engine });
}
AuditManager auditManager = new AuditManager();
auditManager.setJMSBusName(busName);
auditManager.setJMSMessagingEngine(engine);
Enumeration vEnum = _messagingEngines.elements();
JsMessagingEngine foundMessagingEngine = null;
while (vEnum.hasMoreElements() && foundMessagingEngine == null) {
//Liberty COMMs change
//In Liberty only one Messaging Engine and connection fctory properties
//cannot specify Target name.
//Hence changing the logic to not to compare.
Object o = vEnum.nextElement();
Object c = ((MessagingEngine) o).getRuntime();
foundMessagingEngine = (JsMessagingEngine) c;
break;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return foundMessagingEngine;
} | java | public JsMessagingEngine getMessagingEngine(String busName, String engine) {
String thisMethodName = CLASS_NAME
+ ".getMessagingEngine(String, String)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { busName, engine });
}
AuditManager auditManager = new AuditManager();
auditManager.setJMSBusName(busName);
auditManager.setJMSMessagingEngine(engine);
Enumeration vEnum = _messagingEngines.elements();
JsMessagingEngine foundMessagingEngine = null;
while (vEnum.hasMoreElements() && foundMessagingEngine == null) {
//Liberty COMMs change
//In Liberty only one Messaging Engine and connection fctory properties
//cannot specify Target name.
//Hence changing the logic to not to compare.
Object o = vEnum.nextElement();
Object c = ((MessagingEngine) o).getRuntime();
foundMessagingEngine = (JsMessagingEngine) c;
break;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return foundMessagingEngine;
} | [
"public",
"JsMessagingEngine",
"getMessagingEngine",
"(",
"String",
"busName",
",",
"String",
"engine",
")",
"{",
"String",
"thisMethodName",
"=",
"CLASS_NAME",
"+",
"\".getMessagingEngine(String, String)\"",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
... | Get an instance of a messaging engine
@param busName
@param engine
@return JsMessagingEngine | [
"Get",
"an",
"instance",
"of",
"a",
"messaging",
"engine"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/JsMainImpl.java#L655-L690 |
softindex/datakernel | boot/src/main/java/io/datakernel/service/ServiceGraphModule.java | ServiceGraphModule.removeDependency | public ServiceGraphModule removeDependency(Key<?> key, Key<?> keyDependency) {
removedDependencies.computeIfAbsent(key, key1 -> new HashSet<>()).add(keyDependency);
return this;
} | java | public ServiceGraphModule removeDependency(Key<?> key, Key<?> keyDependency) {
removedDependencies.computeIfAbsent(key, key1 -> new HashSet<>()).add(keyDependency);
return this;
} | [
"public",
"ServiceGraphModule",
"removeDependency",
"(",
"Key",
"<",
"?",
">",
"key",
",",
"Key",
"<",
"?",
">",
"keyDependency",
")",
"{",
"removedDependencies",
".",
"computeIfAbsent",
"(",
"key",
",",
"key1",
"->",
"new",
"HashSet",
"<>",
"(",
")",
")",... | Removes the dependency
@param key key for removing dependency
@param keyDependency key of dependency
@return ServiceGraphModule with change | [
"Removes",
"the",
"dependency"
] | train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/boot/src/main/java/io/datakernel/service/ServiceGraphModule.java#L185-L188 |
glyptodon/guacamole-client | guacamole-common/src/main/java/org/apache/guacamole/websocket/GuacamoleWebSocketTunnelEndpoint.java | GuacamoleWebSocketTunnelEndpoint.closeConnection | private void closeConnection(Session session, int guacamoleStatusCode,
int webSocketCode) {
try {
CloseCode code = CloseReason.CloseCodes.getCloseCode(webSocketCode);
String message = Integer.toString(guacamoleStatusCode);
session.close(new CloseReason(code, message));
}
catch (IOException e) {
logger.debug("Unable to close WebSocket connection.", e);
}
} | java | private void closeConnection(Session session, int guacamoleStatusCode,
int webSocketCode) {
try {
CloseCode code = CloseReason.CloseCodes.getCloseCode(webSocketCode);
String message = Integer.toString(guacamoleStatusCode);
session.close(new CloseReason(code, message));
}
catch (IOException e) {
logger.debug("Unable to close WebSocket connection.", e);
}
} | [
"private",
"void",
"closeConnection",
"(",
"Session",
"session",
",",
"int",
"guacamoleStatusCode",
",",
"int",
"webSocketCode",
")",
"{",
"try",
"{",
"CloseCode",
"code",
"=",
"CloseReason",
".",
"CloseCodes",
".",
"getCloseCode",
"(",
"webSocketCode",
")",
";"... | Sends the numeric Guacaomle Status Code and Web Socket
code and closes the connection.
@param session
The outbound WebSocket connection to close.
@param guacamoleStatusCode
The numeric Guacamole status to send.
@param webSocketCode
The numeric WebSocket status to send. | [
"Sends",
"the",
"numeric",
"Guacaomle",
"Status",
"Code",
"and",
"Web",
"Socket",
"code",
"and",
"closes",
"the",
"connection",
"."
] | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole-common/src/main/java/org/apache/guacamole/websocket/GuacamoleWebSocketTunnelEndpoint.java#L100-L112 |
google/closure-compiler | src/com/google/javascript/jscomp/Tracer.java | Tracer.appendSpaces | @VisibleForTesting
static void appendSpaces(StringBuilder sb, int numSpaces) {
if (numSpaces > 16) {
logger.warning("Tracer.appendSpaces called with large numSpaces");
// Avoid long loop in case some bug in the caller
numSpaces = 16;
}
while (numSpaces >= 5) {
sb.append(" ");
numSpaces -= 5;
}
// We know it's less than 5 now
switch (numSpaces) {
case 1:
sb.append(" ");
break;
case 2:
sb.append(" ");
break;
case 3:
sb.append(" ");
break;
case 4:
sb.append(" ");
break;
}
} | java | @VisibleForTesting
static void appendSpaces(StringBuilder sb, int numSpaces) {
if (numSpaces > 16) {
logger.warning("Tracer.appendSpaces called with large numSpaces");
// Avoid long loop in case some bug in the caller
numSpaces = 16;
}
while (numSpaces >= 5) {
sb.append(" ");
numSpaces -= 5;
}
// We know it's less than 5 now
switch (numSpaces) {
case 1:
sb.append(" ");
break;
case 2:
sb.append(" ");
break;
case 3:
sb.append(" ");
break;
case 4:
sb.append(" ");
break;
}
} | [
"@",
"VisibleForTesting",
"static",
"void",
"appendSpaces",
"(",
"StringBuilder",
"sb",
",",
"int",
"numSpaces",
")",
"{",
"if",
"(",
"numSpaces",
">",
"16",
")",
"{",
"logger",
".",
"warning",
"(",
"\"Tracer.appendSpaces called with large numSpaces\"",
")",
";",
... | Gets a string of spaces of the length specified.
@param sb The string builder to append to.
@param numSpaces The number of spaces in the string. | [
"Gets",
"a",
"string",
"of",
"spaces",
"of",
"the",
"length",
"specified",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Tracer.java#L323-L350 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java | DatabasesInner.renameAsync | public Observable<Void> renameAsync(String resourceGroupName, String serverName, String databaseName, String id) {
return renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> renameAsync(String resourceGroupName, String serverName, String databaseName, String id) {
return renameWithServiceResponseAsync(resourceGroupName, serverName, databaseName, id).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"renameAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"id",
")",
"{",
"return",
"renameWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"server... | Renames a database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database to rename.
@param id The target ID for the resource
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Renames",
"a",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java#L1598-L1605 |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java | SoapClient.setParam | public SoapClient setParam(String name, Object value) {
return setParam(name, value, true);
} | java | public SoapClient setParam(String name, Object value) {
return setParam(name, value, true);
} | [
"public",
"SoapClient",
"setParam",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"return",
"setParam",
"(",
"name",
",",
"value",
",",
"true",
")",
";",
"}"
] | 设置方法参数,使用方法的前缀
@param name 参数名
@param value 参数值,可以是字符串或Map或{@link SOAPElement}
@return this | [
"设置方法参数,使用方法的前缀"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L302-L304 |
jillesvangurp/jsonj | src/main/java/com/github/jsonj/tools/JsonBuilder.java | JsonBuilder.put | public @Nonnull JsonBuilder put(String key, Number n) {
object.put(key, primitive(n));
return this;
} | java | public @Nonnull JsonBuilder put(String key, Number n) {
object.put(key, primitive(n));
return this;
} | [
"public",
"@",
"Nonnull",
"JsonBuilder",
"put",
"(",
"String",
"key",
",",
"Number",
"n",
")",
"{",
"object",
".",
"put",
"(",
"key",
",",
"primitive",
"(",
"n",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a number to the object.
@param key key
@param n value
@return the builder | [
"Add",
"a",
"number",
"to",
"the",
"object",
"."
] | train | https://github.com/jillesvangurp/jsonj/blob/1da0c44c5bdb60c0cd806c48d2da5a8a75bf84af/src/main/java/com/github/jsonj/tools/JsonBuilder.java#L112-L115 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/ObjectCacheUnitImpl.java | ObjectCacheUnitImpl.createEventSource | public EventSource createEventSource(boolean createAsyncEventSource, String cacheName) {
EventSource eventSource = new DCEventSource(cacheName, createAsyncEventSource);
if (tc.isDebugEnabled())
Tr.debug(tc, "Using caller thread context for callback - cacheName= " + cacheName);
return eventSource;
} | java | public EventSource createEventSource(boolean createAsyncEventSource, String cacheName) {
EventSource eventSource = new DCEventSource(cacheName, createAsyncEventSource);
if (tc.isDebugEnabled())
Tr.debug(tc, "Using caller thread context for callback - cacheName= " + cacheName);
return eventSource;
} | [
"public",
"EventSource",
"createEventSource",
"(",
"boolean",
"createAsyncEventSource",
",",
"String",
"cacheName",
")",
"{",
"EventSource",
"eventSource",
"=",
"new",
"DCEventSource",
"(",
"cacheName",
",",
"createAsyncEventSource",
")",
";",
"if",
"(",
"tc",
".",
... | This implements the method in the ServletCacheUnit interface. This method is used to initialize event source for
invalidation listener
@param createAsyncEventSource
boolean true - using async thread context for callback; false - using caller thread for callback
@param cacheName
The cache name
@return EventSourceIntf The event source | [
"This",
"implements",
"the",
"method",
"in",
"the",
"ServletCacheUnit",
"interface",
".",
"This",
"method",
"is",
"used",
"to",
"initialize",
"event",
"source",
"for",
"invalidation",
"listener"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/ObjectCacheUnitImpl.java#L121-L128 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/BooleanField.java | BooleanField.setValue | public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
Boolean bField = Boolean.FALSE;
if (value != 0)
bField = Boolean.TRUE;
int errorCode = this.setData(bField, bDisplayOption, iMoveMode);
return errorCode;
} | java | public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
Boolean bField = Boolean.FALSE;
if (value != 0)
bField = Boolean.TRUE;
int errorCode = this.setData(bField, bDisplayOption, iMoveMode);
return errorCode;
} | [
"public",
"int",
"setValue",
"(",
"double",
"value",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"// Set this field's value",
"Boolean",
"bField",
"=",
"Boolean",
".",
"FALSE",
";",
"if",
"(",
"value",
"!=",
"0",
")",
"bField",
"=",
... | Set the Value of this field as a double.
For a boolean, 0 for false 1 for true.
@param value The value of this field.
@param iDisplayOption If true, display the new field.
@param iMoveMove The move mode.
@return An error code (NORMAL_RETURN for success). | [
"Set",
"the",
"Value",
"of",
"this",
"field",
"as",
"a",
"double",
".",
"For",
"a",
"boolean",
"0",
"for",
"false",
"1",
"for",
"true",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BooleanField.java#L240-L247 |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/base/ModeledDirectoryObjectService.java | ModeledDirectoryObjectService.beforeDelete | protected void beforeDelete(ModeledAuthenticatedUser user,
String identifier) throws GuacamoleException {
// Verify permission to delete objects
if (!hasObjectPermission(user, identifier, ObjectPermission.Type.DELETE))
throw new GuacamoleSecurityException("Permission denied.");
} | java | protected void beforeDelete(ModeledAuthenticatedUser user,
String identifier) throws GuacamoleException {
// Verify permission to delete objects
if (!hasObjectPermission(user, identifier, ObjectPermission.Type.DELETE))
throw new GuacamoleSecurityException("Permission denied.");
} | [
"protected",
"void",
"beforeDelete",
"(",
"ModeledAuthenticatedUser",
"user",
",",
"String",
"identifier",
")",
"throws",
"GuacamoleException",
"{",
"// Verify permission to delete objects",
"if",
"(",
"!",
"hasObjectPermission",
"(",
"user",
",",
"identifier",
",",
"Ob... | Called before any object is deleted through this directory object
service. This function serves as a final point of validation before
the delete operation occurs. In its default implementation,
beforeDelete() performs basic permissions checks.
@param user
The user deleting the existing object.
@param identifier
The identifier of the object being deleted.
@throws GuacamoleException
If the object is invalid, or an error prevents validating the given
object. | [
"Called",
"before",
"any",
"object",
"is",
"deleted",
"through",
"this",
"directory",
"object",
"service",
".",
"This",
"function",
"serves",
"as",
"a",
"final",
"point",
"of",
"validation",
"before",
"the",
"delete",
"operation",
"occurs",
".",
"In",
"its",
... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/base/ModeledDirectoryObjectService.java#L300-L307 |
Esri/spatial-framework-for-hadoop | hive/src/main/java/com/esri/hadoop/hive/GeometryUtils.java | GeometryUtils.setWKID | public static void setWKID(BytesWritable geomref, int wkid){
ByteBuffer bb = ByteBuffer.allocate(4);
bb.putInt(wkid);
System.arraycopy(bb.array(), 0, geomref.getBytes(), 0, SIZE_WKID);
} | java | public static void setWKID(BytesWritable geomref, int wkid){
ByteBuffer bb = ByteBuffer.allocate(4);
bb.putInt(wkid);
System.arraycopy(bb.array(), 0, geomref.getBytes(), 0, SIZE_WKID);
} | [
"public",
"static",
"void",
"setWKID",
"(",
"BytesWritable",
"geomref",
",",
"int",
"wkid",
")",
"{",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"4",
")",
";",
"bb",
".",
"putInt",
"(",
"wkid",
")",
";",
"System",
".",
"arraycopy",
"(... | Sets the WKID (in place) for the given hive geometry bytes
@param geomref reference to hive geometry bytes
@param wkid | [
"Sets",
"the",
"WKID",
"(",
"in",
"place",
")",
"for",
"the",
"given",
"hive",
"geometry",
"bytes"
] | train | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/hive/src/main/java/com/esri/hadoop/hive/GeometryUtils.java#L177-L181 |
nobuoka/android-lib-ZXingCaptureActivity | src/main/java/info/vividcode/android/zxing/CaptureActivityIntents.java | CaptureActivityIntents.setSizeOfScanningRectangleInPx | public static void setSizeOfScanningRectangleInPx(Intent intent, int width, int height) {
intent.putExtra(Intents.Scan.WIDTH, width);
intent.putExtra(Intents.Scan.HEIGHT, height);
} | java | public static void setSizeOfScanningRectangleInPx(Intent intent, int width, int height) {
intent.putExtra(Intents.Scan.WIDTH, width);
intent.putExtra(Intents.Scan.HEIGHT, height);
} | [
"public",
"static",
"void",
"setSizeOfScanningRectangleInPx",
"(",
"Intent",
"intent",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"intent",
".",
"putExtra",
"(",
"Intents",
".",
"Scan",
".",
"WIDTH",
",",
"width",
")",
";",
"intent",
".",
"putExt... | Set optional parameters to specify the width and height of the scanning rectangle in pixels
to {@code Intent}.
@param intent Target intent.
@param width Width of scanning rectangle in pixels.
@param height Height of scanning rectangle in pixels. | [
"Set",
"optional",
"parameters",
"to",
"specify",
"the",
"width",
"and",
"height",
"of",
"the",
"scanning",
"rectangle",
"in",
"pixels",
"to",
"{"
] | train | https://github.com/nobuoka/android-lib-ZXingCaptureActivity/blob/17aaa7cf75520d3f2e03db9796b7e8c1d1f1b1e6/src/main/java/info/vividcode/android/zxing/CaptureActivityIntents.java#L164-L167 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java | Frame.getArgumentSlot | public int getArgumentSlot(int i, int numArguments) {
if (i >= numArguments) {
throw new IllegalArgumentException();
}
return (slotList.size() - numArguments) + i;
} | java | public int getArgumentSlot(int i, int numArguments) {
if (i >= numArguments) {
throw new IllegalArgumentException();
}
return (slotList.size() - numArguments) + i;
} | [
"public",
"int",
"getArgumentSlot",
"(",
"int",
"i",
",",
"int",
"numArguments",
")",
"{",
"if",
"(",
"i",
">=",
"numArguments",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"return",
"(",
"slotList",
".",
"size",
"(",
")",
... | Get the stack slot that will contain given method argument. Assumes that
this frame is at the location (just before) a method invocation
instruction.
@param i
the argument index: 0 for first arg, etc.
@param numArguments
total number of arguments to the called method
@return slot containing the argument value | [
"Get",
"the",
"stack",
"slot",
"that",
"will",
"contain",
"given",
"method",
"argument",
".",
"Assumes",
"that",
"this",
"frame",
"is",
"at",
"the",
"location",
"(",
"just",
"before",
")",
"a",
"method",
"invocation",
"instruction",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L425-L431 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/dv/MinimumPennTemplateAcceptor.java | MinimumPennTemplateAcceptor.toPattern | static String toPattern(String pos1, String rel, String pos2) {
return pos1 + ":" + rel + ":" + pos2;
} | java | static String toPattern(String pos1, String rel, String pos2) {
return pos1 + ":" + rel + ":" + pos2;
} | [
"static",
"String",
"toPattern",
"(",
"String",
"pos1",
",",
"String",
"rel",
",",
"String",
"pos2",
")",
"{",
"return",
"pos1",
"+",
"\":\"",
"+",
"rel",
"+",
"\":\"",
"+",
"pos2",
";",
"}"
] | Returns the pattern string for the provided parts of speech and relation. | [
"Returns",
"the",
"pattern",
"string",
"for",
"the",
"provided",
"parts",
"of",
"speech",
"and",
"relation",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/dv/MinimumPennTemplateAcceptor.java#L210-L212 |
RallyTools/RallyRestToolkitForJava | src/main/java/com/rallydev/rest/request/Request.java | Request.addParam | public void addParam(String name, String value) {
getParams().add(new BasicNameValuePair(name, value));
} | java | public void addParam(String name, String value) {
getParams().add(new BasicNameValuePair(name, value));
} | [
"public",
"void",
"addParam",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"getParams",
"(",
")",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"name",
",",
"value",
")",
")",
";",
"}"
] | Add the specified parameter to this request.
@param name the parameter name
@param value the parameter value | [
"Add",
"the",
"specified",
"parameter",
"to",
"this",
"request",
"."
] | train | https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/request/Request.java#L54-L56 |
UrielCh/ovh-java-sdk | ovh-java-sdk-partners/src/main/java/net/minidev/ovh/api/ApiOvhPartners.java | ApiOvhPartners.register_company_companyId_GET | public OvhCompany register_company_companyId_GET(String companyId) throws IOException {
String qPath = "/partners/register/company/{companyId}";
StringBuilder sb = path(qPath, companyId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCompany.class);
} | java | public OvhCompany register_company_companyId_GET(String companyId) throws IOException {
String qPath = "/partners/register/company/{companyId}";
StringBuilder sb = path(qPath, companyId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCompany.class);
} | [
"public",
"OvhCompany",
"register_company_companyId_GET",
"(",
"String",
"companyId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/partners/register/company/{companyId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"companyId",
")",
... | Get information on a created company
REST: GET /partners/register/company/{companyId}
@param companyId [required] Company's id | [
"Get",
"information",
"on",
"a",
"created",
"company"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-partners/src/main/java/net/minidev/ovh/api/ApiOvhPartners.java#L129-L134 |
poetix/protonpack | src/main/java/com/codepoetics/protonpack/StreamUtils.java | StreamUtils.groupRuns | public static <T extends Comparable<T>> Stream<List<T>> groupRuns(Stream<T> source){
return groupRuns(source, Comparable::compareTo);
} | java | public static <T extends Comparable<T>> Stream<List<T>> groupRuns(Stream<T> source){
return groupRuns(source, Comparable::compareTo);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Stream",
"<",
"List",
"<",
"T",
">",
">",
"groupRuns",
"(",
"Stream",
"<",
"T",
">",
"source",
")",
"{",
"return",
"groupRuns",
"(",
"source",
",",
"Comparable",
"::",
"compa... | Constructs a stream that represents grouped run using the default comparator. This means
that similar elements will get grouped into a list. I.e. given a list of [1,1,2,3,4,4]
you will get a stream of ([1,1], [2], [3], [4, 4])
@param source The input stream
@param <T> The type over which to stream
@return A stream of lists of grouped runs | [
"Constructs",
"a",
"stream",
"that",
"represents",
"grouped",
"run",
"using",
"the",
"default",
"comparator",
".",
"This",
"means",
"that",
"similar",
"elements",
"will",
"get",
"grouped",
"into",
"a",
"list",
".",
"I",
".",
"e",
".",
"given",
"a",
"list",... | train | https://github.com/poetix/protonpack/blob/00c55a05a4779926d02d5f4e6c820560a773f9f1/src/main/java/com/codepoetics/protonpack/StreamUtils.java#L305-L307 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.withDurability | public AsyncMutateInBuilder withDurability(PersistTo persistTo, ReplicateTo replicateTo) {
this.persistTo = persistTo;
this.replicateTo = replicateTo;
return this;
} | java | public AsyncMutateInBuilder withDurability(PersistTo persistTo, ReplicateTo replicateTo) {
this.persistTo = persistTo;
this.replicateTo = replicateTo;
return this;
} | [
"public",
"AsyncMutateInBuilder",
"withDurability",
"(",
"PersistTo",
"persistTo",
",",
"ReplicateTo",
"replicateTo",
")",
"{",
"this",
".",
"persistTo",
"=",
"persistTo",
";",
"this",
".",
"replicateTo",
"=",
"replicateTo",
";",
"return",
"this",
";",
"}"
] | Set both a persistence and a replication durability constraints for the whole mutation.
@param persistTo the persistence durability constraint to observe.
@param replicateTo the replication durability constraint to observe.
@return this builder for chaining. | [
"Set",
"both",
"a",
"persistence",
"and",
"a",
"replication",
"durability",
"constraints",
"for",
"the",
"whole",
"mutation",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L599-L603 |
gresrun/jesque | src/main/java/net/greghaines/jesque/client/AbstractClient.java | AbstractClient.doEnqueue | public static void doEnqueue(final Jedis jedis, final String namespace, final String queue, final String jobJson) {
jedis.sadd(JesqueUtils.createKey(namespace, QUEUES), queue);
jedis.rpush(JesqueUtils.createKey(namespace, QUEUE, queue), jobJson);
} | java | public static void doEnqueue(final Jedis jedis, final String namespace, final String queue, final String jobJson) {
jedis.sadd(JesqueUtils.createKey(namespace, QUEUES), queue);
jedis.rpush(JesqueUtils.createKey(namespace, QUEUE, queue), jobJson);
} | [
"public",
"static",
"void",
"doEnqueue",
"(",
"final",
"Jedis",
"jedis",
",",
"final",
"String",
"namespace",
",",
"final",
"String",
"queue",
",",
"final",
"String",
"jobJson",
")",
"{",
"jedis",
".",
"sadd",
"(",
"JesqueUtils",
".",
"createKey",
"(",
"na... | Helper method that encapsulates the minimum logic for adding a job to a
queue.
@param jedis
the connection to Redis
@param namespace
the Resque namespace
@param queue
the Resque queue name
@param jobJson
the job serialized as JSON | [
"Helper",
"method",
"that",
"encapsulates",
"the",
"minimum",
"logic",
"for",
"adding",
"a",
"job",
"to",
"a",
"queue",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/client/AbstractClient.java#L217-L220 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getDateTimeInstance | static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle, int timeStyle) {
return getDateTimeInstance(cal, dateStyle, timeStyle, ULocale.getDefault(Category.FORMAT));
} | java | static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle, int timeStyle) {
return getDateTimeInstance(cal, dateStyle, timeStyle, ULocale.getDefault(Category.FORMAT));
} | [
"static",
"final",
"public",
"DateFormat",
"getDateTimeInstance",
"(",
"Calendar",
"cal",
",",
"int",
"dateStyle",
",",
"int",
"timeStyle",
")",
"{",
"return",
"getDateTimeInstance",
"(",
"cal",
",",
"dateStyle",
",",
"timeStyle",
",",
"ULocale",
".",
"getDefaul... | Creates a {@link DateFormat} object for the default locale that can be used to format
dates and times in the calendar system specified by <code>cal</code>.
@param cal The calendar system for which a date/time format is desired.
@param dateStyle The type of date format desired. This can be
{@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
etc.
@param timeStyle The type of time format desired. This can be
{@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
etc.
@see DateFormat#getDateTimeInstance | [
"Creates",
"a",
"{",
"@link",
"DateFormat",
"}",
"object",
"for",
"the",
"default",
"locale",
"that",
"can",
"be",
"used",
"to",
"format",
"dates",
"and",
"times",
"in",
"the",
"calendar",
"system",
"specified",
"by",
"<code",
">",
"cal<",
"/",
"code",
"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1937-L1939 |
ksclarke/vertx-pairtree | src/main/java/info/freelibrary/pairtree/s3/S3Client.java | S3Client.createDeleteRequest | public S3ClientRequest createDeleteRequest(final String aBucket, final String aKey,
final Handler<HttpClientResponse> aHandler) {
final HttpClientRequest httpRequest = myHTTPClient.delete(PATH_SEP + aBucket + PATH_SEP + aKey, aHandler);
return new S3ClientRequest("DELETE", aBucket, aKey, httpRequest, myAccessKey, mySecretKey, mySessionToken);
} | java | public S3ClientRequest createDeleteRequest(final String aBucket, final String aKey,
final Handler<HttpClientResponse> aHandler) {
final HttpClientRequest httpRequest = myHTTPClient.delete(PATH_SEP + aBucket + PATH_SEP + aKey, aHandler);
return new S3ClientRequest("DELETE", aBucket, aKey, httpRequest, myAccessKey, mySecretKey, mySessionToken);
} | [
"public",
"S3ClientRequest",
"createDeleteRequest",
"(",
"final",
"String",
"aBucket",
",",
"final",
"String",
"aKey",
",",
"final",
"Handler",
"<",
"HttpClientResponse",
">",
"aHandler",
")",
"{",
"final",
"HttpClientRequest",
"httpRequest",
"=",
"myHTTPClient",
".... | Creates an S3 DELETE request.
<p>
<code>create DELETE -> request Object</code>
</p>
@param aBucket An S3 bucket
@param aKey An S3 key
@param aHandler An S3 handler
@return An S3 client request | [
"Creates",
"an",
"S3",
"DELETE",
"request",
".",
"<p",
">",
"<code",
">",
"create",
"DELETE",
"-",
">",
";",
"request",
"Object<",
"/",
"code",
">",
"<",
"/",
"p",
">"
] | train | https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/s3/S3Client.java#L302-L306 |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.adjacentHash | public static String adjacentHash(String hash, Direction direction, int steps) {
if (steps < 0)
return adjacentHash(hash, direction.opposite(), Math.abs(steps));
else {
String h = hash;
for (int i = 0; i < steps; i++)
h = adjacentHash(h, direction);
return h;
}
} | java | public static String adjacentHash(String hash, Direction direction, int steps) {
if (steps < 0)
return adjacentHash(hash, direction.opposite(), Math.abs(steps));
else {
String h = hash;
for (int i = 0; i < steps; i++)
h = adjacentHash(h, direction);
return h;
}
} | [
"public",
"static",
"String",
"adjacentHash",
"(",
"String",
"hash",
",",
"Direction",
"direction",
",",
"int",
"steps",
")",
"{",
"if",
"(",
"steps",
"<",
"0",
")",
"return",
"adjacentHash",
"(",
"hash",
",",
"direction",
".",
"opposite",
"(",
")",
",",... | Returns the adjacent hash N steps in the given {@link Direction}. A
negative N will use the opposite {@link Direction}.
@param hash
origin hash
@param direction
to desired hash
@param steps
number of hashes distance to desired hash
@return hash at position in direction a number of hashes away (steps) | [
"Returns",
"the",
"adjacent",
"hash",
"N",
"steps",
"in",
"the",
"given",
"{",
"@link",
"Direction",
"}",
".",
"A",
"negative",
"N",
"will",
"use",
"the",
"opposite",
"{",
"@link",
"Direction",
"}",
"."
] | train | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L261-L270 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/util/QueryReportPageController.java | QueryReportPageController.appendQueryPageComments | protected void appendQueryPageComments(RequestContext requestContext, final QueryPage queryPage, ReportPageCommentProcessor processor) {
QueryQuestionCommentDAO queryQuestionCommentDAO = new QueryQuestionCommentDAO();
processor.processComments();
List<QueryQuestionComment> rootComments = processor.getRootComments();
Map<Long, List<QueryQuestionComment>> childComments = queryQuestionCommentDAO.listTreesByQueryPage(queryPage);
QueryUtils.appendQueryPageRootComments(requestContext, queryPage.getId(), rootComments);
QueryUtils.appendQueryPageChildComments(requestContext, childComments);
} | java | protected void appendQueryPageComments(RequestContext requestContext, final QueryPage queryPage, ReportPageCommentProcessor processor) {
QueryQuestionCommentDAO queryQuestionCommentDAO = new QueryQuestionCommentDAO();
processor.processComments();
List<QueryQuestionComment> rootComments = processor.getRootComments();
Map<Long, List<QueryQuestionComment>> childComments = queryQuestionCommentDAO.listTreesByQueryPage(queryPage);
QueryUtils.appendQueryPageRootComments(requestContext, queryPage.getId(), rootComments);
QueryUtils.appendQueryPageChildComments(requestContext, childComments);
} | [
"protected",
"void",
"appendQueryPageComments",
"(",
"RequestContext",
"requestContext",
",",
"final",
"QueryPage",
"queryPage",
",",
"ReportPageCommentProcessor",
"processor",
")",
"{",
"QueryQuestionCommentDAO",
"queryQuestionCommentDAO",
"=",
"new",
"QueryQuestionCommentDAO"... | Appends query page comment to request.
@param requestContext request contract
@param queryPage query page
@param processor comment processor | [
"Appends",
"query",
"page",
"comment",
"to",
"request",
"."
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/util/QueryReportPageController.java#L45-L52 |
davetcc/tcMenu | tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/remote/StreamRemoteConnector.java | StreamRemoteConnector.logByteBuffer | protected void logByteBuffer(String msg, ByteBuffer inBuffer) {
if(!logger.isLoggable(DEBUG)) return;
ByteBuffer bb = inBuffer.duplicate();
byte[] byData = new byte[512];
int len = Math.min(byData.length, bb.remaining());
byte dataByte = bb.get();
int pos = 0;
while(pos < len && dataByte != '~') {
byData[pos] = dataByte;
pos++;
dataByte = bb.get();
}
logger.log(DEBUG, msg + ". Content: " + new String(byData, 0, pos));
} | java | protected void logByteBuffer(String msg, ByteBuffer inBuffer) {
if(!logger.isLoggable(DEBUG)) return;
ByteBuffer bb = inBuffer.duplicate();
byte[] byData = new byte[512];
int len = Math.min(byData.length, bb.remaining());
byte dataByte = bb.get();
int pos = 0;
while(pos < len && dataByte != '~') {
byData[pos] = dataByte;
pos++;
dataByte = bb.get();
}
logger.log(DEBUG, msg + ". Content: " + new String(byData, 0, pos));
} | [
"protected",
"void",
"logByteBuffer",
"(",
"String",
"msg",
",",
"ByteBuffer",
"inBuffer",
")",
"{",
"if",
"(",
"!",
"logger",
".",
"isLoggable",
"(",
"DEBUG",
")",
")",
"return",
";",
"ByteBuffer",
"bb",
"=",
"inBuffer",
".",
"duplicate",
"(",
")",
";",... | Helper method that logs the entire message buffer when at debug logging level.
@param msg the message to print first
@param inBuffer the buffer to be logged | [
"Helper",
"method",
"that",
"logs",
"the",
"entire",
"message",
"buffer",
"when",
"at",
"debug",
"logging",
"level",
"."
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/remote/StreamRemoteConnector.java#L208-L224 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/history/CmsHistoryDialog.java | CmsHistoryDialog.canCompare | private boolean canCompare(CheckBox check1, CheckBox check2) {
return !((check1 == null) || (check2 == null) || (check1.getData() == check2.getData()));
} | java | private boolean canCompare(CheckBox check1, CheckBox check2) {
return !((check1 == null) || (check2 == null) || (check1.getData() == check2.getData()));
} | [
"private",
"boolean",
"canCompare",
"(",
"CheckBox",
"check1",
",",
"CheckBox",
"check2",
")",
"{",
"return",
"!",
"(",
"(",
"check1",
"==",
"null",
")",
"||",
"(",
"check2",
"==",
"null",
")",
"||",
"(",
"check1",
".",
"getData",
"(",
")",
"==",
"ch... | Checks if two different versions are selected, and so can be compared.<p>
@param check1 the first selected check box
@param check2 the second selected check box
@return true if the check boxes correspond to two different versions | [
"Checks",
"if",
"two",
"different",
"versions",
"are",
"selected",
"and",
"so",
"can",
"be",
"compared",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/history/CmsHistoryDialog.java#L432-L435 |
code4everything/util | src/main/java/com/zhazhapan/util/NetUtils.java | NetUtils.addCookie | public static boolean addCookie(Cookie cookie, HttpServletResponse response) {
if (Checker.isNotNull(cookie) && Checker.isNotNull(response)) {
response.addCookie(cookie);
return true;
}
return false;
} | java | public static boolean addCookie(Cookie cookie, HttpServletResponse response) {
if (Checker.isNotNull(cookie) && Checker.isNotNull(response)) {
response.addCookie(cookie);
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"addCookie",
"(",
"Cookie",
"cookie",
",",
"HttpServletResponse",
"response",
")",
"{",
"if",
"(",
"Checker",
".",
"isNotNull",
"(",
"cookie",
")",
"&&",
"Checker",
".",
"isNotNull",
"(",
"response",
")",
")",
"{",
"response",
... | 添加Cookie
@param cookie {@link Cookie}
@param response {@link HttpServletResponse}
@return {@link Boolean}
@since 1.0.8 | [
"添加Cookie"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/NetUtils.java#L572-L578 |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateDereference | private Context translateDereference(WyilFile.Expr.Dereference lval, Expr rval, Context context) {
Expr e = translateDereference(lval, context.getEnvironment());
return context.assume(new Expr.Equal(e, rval));
} | java | private Context translateDereference(WyilFile.Expr.Dereference lval, Expr rval, Context context) {
Expr e = translateDereference(lval, context.getEnvironment());
return context.assume(new Expr.Equal(e, rval));
} | [
"private",
"Context",
"translateDereference",
"(",
"WyilFile",
".",
"Expr",
".",
"Dereference",
"lval",
",",
"Expr",
"rval",
",",
"Context",
"context",
")",
"{",
"Expr",
"e",
"=",
"translateDereference",
"(",
"lval",
",",
"context",
".",
"getEnvironment",
"(",... | Translate an indirect assignment through a reference.
@param lval
The array assignment expression
@param result
The value being assigned to the given array element
@param context
The enclosing context
@return | [
"Translate",
"an",
"indirect",
"assignment",
"through",
"a",
"reference",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L666-L669 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.checkChar | private static int checkChar(final char c, final String signature, int pos) {
if (getChar(signature, pos) == c) {
return pos + 1;
}
throw new IllegalArgumentException(signature + ": '" + c
+ "' expected at index " + pos);
} | java | private static int checkChar(final char c, final String signature, int pos) {
if (getChar(signature, pos) == c) {
return pos + 1;
}
throw new IllegalArgumentException(signature + ": '" + c
+ "' expected at index " + pos);
} | [
"private",
"static",
"int",
"checkChar",
"(",
"final",
"char",
"c",
",",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"if",
"(",
"getChar",
"(",
"signature",
",",
"pos",
")",
"==",
"c",
")",
"{",
"return",
"pos",
"+",
"1",
";",
"}",... | Checks a single character.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first character after the checked part. | [
"Checks",
"a",
"single",
"character",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L988-L994 |
twitter/hraven | hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserHadoop2.java | JobHistoryFileParserHadoop2.iterateAndPreparePuts | private void iterateAndPreparePuts(JSONObject eventDetails, Put p, Hadoop2RecordType recType)
throws JSONException {
Iterator<?> keys = eventDetails.keys();
while (keys.hasNext()) {
String key = (String) keys.next();
processAllTypes(p, recType, eventDetails, key);
}
} | java | private void iterateAndPreparePuts(JSONObject eventDetails, Put p, Hadoop2RecordType recType)
throws JSONException {
Iterator<?> keys = eventDetails.keys();
while (keys.hasNext()) {
String key = (String) keys.next();
processAllTypes(p, recType, eventDetails, key);
}
} | [
"private",
"void",
"iterateAndPreparePuts",
"(",
"JSONObject",
"eventDetails",
",",
"Put",
"p",
",",
"Hadoop2RecordType",
"recType",
")",
"throws",
"JSONException",
"{",
"Iterator",
"<",
"?",
">",
"keys",
"=",
"eventDetails",
".",
"keys",
"(",
")",
";",
"while... | iterate over the event details and prepare puts
@throws JSONException | [
"iterate",
"over",
"the",
"event",
"details",
"and",
"prepare",
"puts"
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserHadoop2.java#L488-L495 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/writer/http/SalesforceRestWriter.java | SalesforceRestWriter.onConnect | @Override
public void onConnect(URI serverHost) throws IOException {
if (!StringUtils.isEmpty(accessToken)) {
return; //No need to be called if accessToken is active.
}
try {
getLog().info("Getting Oauth2 access token.");
OAuthClientRequest request = OAuthClientRequest.tokenLocation(serverHost.toString())
.setGrantType(GrantType.PASSWORD)
.setClientId(clientId)
.setClientSecret(clientSecret)
.setUsername(userId)
.setPassword(password + securityToken).buildQueryMessage();
OAuthClient client = new OAuthClient(new URLConnectionClient());
OAuthJSONAccessTokenResponse response = client.accessToken(request, OAuth.HttpMethod.POST);
accessToken = response.getAccessToken();
setCurServerHost(new URI(response.getParam("instance_url")));
} catch (OAuthProblemException e) {
throw new NonTransientException("Error while authenticating with Oauth2", e);
} catch (OAuthSystemException e) {
throw new RuntimeException("Failed getting access token", e);
} catch (URISyntaxException e) {
throw new RuntimeException("Failed due to invalid instance url", e);
}
} | java | @Override
public void onConnect(URI serverHost) throws IOException {
if (!StringUtils.isEmpty(accessToken)) {
return; //No need to be called if accessToken is active.
}
try {
getLog().info("Getting Oauth2 access token.");
OAuthClientRequest request = OAuthClientRequest.tokenLocation(serverHost.toString())
.setGrantType(GrantType.PASSWORD)
.setClientId(clientId)
.setClientSecret(clientSecret)
.setUsername(userId)
.setPassword(password + securityToken).buildQueryMessage();
OAuthClient client = new OAuthClient(new URLConnectionClient());
OAuthJSONAccessTokenResponse response = client.accessToken(request, OAuth.HttpMethod.POST);
accessToken = response.getAccessToken();
setCurServerHost(new URI(response.getParam("instance_url")));
} catch (OAuthProblemException e) {
throw new NonTransientException("Error while authenticating with Oauth2", e);
} catch (OAuthSystemException e) {
throw new RuntimeException("Failed getting access token", e);
} catch (URISyntaxException e) {
throw new RuntimeException("Failed due to invalid instance url", e);
}
} | [
"@",
"Override",
"public",
"void",
"onConnect",
"(",
"URI",
"serverHost",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"accessToken",
")",
")",
"{",
"return",
";",
"//No need to be called if accessToken is active.",
"}",
... | Retrieve access token, if needed, retrieve instance url, and set server host URL
{@inheritDoc}
@see org.apache.gobblin.writer.http.HttpWriter#onConnect(org.apache.http.HttpHost) | [
"Retrieve",
"access",
"token",
"if",
"needed",
"retrieve",
"instance",
"url",
"and",
"set",
"server",
"host",
"URL",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/writer/http/SalesforceRestWriter.java#L126-L152 |
callstats-io/callstats.java | callstats-java-sample-maven/sample.sdk/src/main/java/io/callstats/sample/sdk/LocalTokenGenerator.java | LocalTokenGenerator.readEcPrivateKey | private PrivateKey readEcPrivateKey(String fileName) throws InvalidKeySpecException, NoSuchAlgorithmException, IOException, NoSuchProviderException
{
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader(new FileReader(fileName));
try {
char[] cbuf = new char[1024];
for (int i=0; i <= 10*1024; i++) {
if (!br.ready())
break;
int len = br.read(cbuf, i*1024, 1024);
sb.append(cbuf, 0, len);
}
if (br.ready()) {
throw new IndexOutOfBoundsException("JWK file larger than 10MB");
}
Type mapType = new TypeToken<Map<String, String>>(){}.getType();
Map<String, String> son = new Gson().fromJson(sb.toString(), mapType);
try {
@SuppressWarnings({ "unchecked", "rawtypes" })
EllipticCurveJsonWebKey jwk = new EllipticCurveJsonWebKey((Map<String, Object>)(Map)son);
Base64Encoder enc = new Base64Encoder();
ByteArrayOutputStream os = new ByteArrayOutputStream();
enc.encode(jwk.getPrivateKey().getEncoded(), 0, jwk.getPrivateKey().getEncoded().length, os);
return jwk.getPrivateKey();
} catch (JoseException e1) {
e1.printStackTrace();
}
return null;
} finally {
br.close();
}
} | java | private PrivateKey readEcPrivateKey(String fileName) throws InvalidKeySpecException, NoSuchAlgorithmException, IOException, NoSuchProviderException
{
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader(new FileReader(fileName));
try {
char[] cbuf = new char[1024];
for (int i=0; i <= 10*1024; i++) {
if (!br.ready())
break;
int len = br.read(cbuf, i*1024, 1024);
sb.append(cbuf, 0, len);
}
if (br.ready()) {
throw new IndexOutOfBoundsException("JWK file larger than 10MB");
}
Type mapType = new TypeToken<Map<String, String>>(){}.getType();
Map<String, String> son = new Gson().fromJson(sb.toString(), mapType);
try {
@SuppressWarnings({ "unchecked", "rawtypes" })
EllipticCurveJsonWebKey jwk = new EllipticCurveJsonWebKey((Map<String, Object>)(Map)son);
Base64Encoder enc = new Base64Encoder();
ByteArrayOutputStream os = new ByteArrayOutputStream();
enc.encode(jwk.getPrivateKey().getEncoded(), 0, jwk.getPrivateKey().getEncoded().length, os);
return jwk.getPrivateKey();
} catch (JoseException e1) {
e1.printStackTrace();
}
return null;
} finally {
br.close();
}
} | [
"private",
"PrivateKey",
"readEcPrivateKey",
"(",
"String",
"fileName",
")",
"throws",
"InvalidKeySpecException",
",",
"NoSuchAlgorithmException",
",",
"IOException",
",",
"NoSuchProviderException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",... | Reads JWK into PrivateKEy instance
@param fileName Path to the JWK file
@return java.security.PrivateKey instance of JWK
@throws InvalidKeySpecException
@throws NoSuchAlgorithmException
@throws IOException
@throws NoSuchProviderException | [
"Reads",
"JWK",
"into",
"PrivateKEy",
"instance"
] | train | https://github.com/callstats-io/callstats.java/blob/04ec34f1490b75952ed90da706d59e311e2b44f1/callstats-java-sample-maven/sample.sdk/src/main/java/io/callstats/sample/sdk/LocalTokenGenerator.java#L182-L213 |
groupon/odo | client/src/main/java/com/groupon/odo/client/Client.java | Client.addServerMapping | public ServerRedirect addServerMapping(String sourceHost, String destinationHost, String hostHeader) {
JSONObject response = null;
ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
params.add(new BasicNameValuePair("srcUrl", sourceHost));
params.add(new BasicNameValuePair("destUrl", destinationHost));
params.add(new BasicNameValuePair("profileIdentifier", this._profileName));
if (hostHeader != null) {
params.add(new BasicNameValuePair("hostHeader", hostHeader));
}
try {
BasicNameValuePair paramArray[] = new BasicNameValuePair[params.size()];
params.toArray(paramArray);
response = new JSONObject(doPost(BASE_SERVER, paramArray));
} catch (Exception e) {
e.printStackTrace();
return null;
}
return getServerRedirectFromJSON(response);
} | java | public ServerRedirect addServerMapping(String sourceHost, String destinationHost, String hostHeader) {
JSONObject response = null;
ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
params.add(new BasicNameValuePair("srcUrl", sourceHost));
params.add(new BasicNameValuePair("destUrl", destinationHost));
params.add(new BasicNameValuePair("profileIdentifier", this._profileName));
if (hostHeader != null) {
params.add(new BasicNameValuePair("hostHeader", hostHeader));
}
try {
BasicNameValuePair paramArray[] = new BasicNameValuePair[params.size()];
params.toArray(paramArray);
response = new JSONObject(doPost(BASE_SERVER, paramArray));
} catch (Exception e) {
e.printStackTrace();
return null;
}
return getServerRedirectFromJSON(response);
} | [
"public",
"ServerRedirect",
"addServerMapping",
"(",
"String",
"sourceHost",
",",
"String",
"destinationHost",
",",
"String",
"hostHeader",
")",
"{",
"JSONObject",
"response",
"=",
"null",
";",
"ArrayList",
"<",
"BasicNameValuePair",
">",
"params",
"=",
"new",
"Ar... | Add a new server mapping to current profile
@param sourceHost source hostname
@param destinationHost destination hostname
@param hostHeader host header
@return ServerRedirect | [
"Add",
"a",
"new",
"server",
"mapping",
"to",
"current",
"profile"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L1011-L1031 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java | UnderFileSystemBlockStore.releaseAccess | public void releaseAccess(long sessionId, long blockId) {
try (LockResource lr = new LockResource(mLock)) {
Key key = new Key(sessionId, blockId);
if (!mBlocks.containsKey(key)) {
LOG.warn("Key (block ID: {}, session ID {}) is not found when releasing the UFS block.",
blockId, sessionId);
}
mBlocks.remove(key);
Set<Long> blockIds = mSessionIdToBlockIds.get(sessionId);
if (blockIds != null) {
blockIds.remove(blockId);
if (blockIds.isEmpty()) {
mSessionIdToBlockIds.remove(sessionId);
}
}
Set<Long> sessionIds = mBlockIdToSessionIds.get(blockId);
if (sessionIds != null) {
sessionIds.remove(sessionId);
if (sessionIds.isEmpty()) {
mBlockIdToSessionIds.remove(blockId);
}
}
}
} | java | public void releaseAccess(long sessionId, long blockId) {
try (LockResource lr = new LockResource(mLock)) {
Key key = new Key(sessionId, blockId);
if (!mBlocks.containsKey(key)) {
LOG.warn("Key (block ID: {}, session ID {}) is not found when releasing the UFS block.",
blockId, sessionId);
}
mBlocks.remove(key);
Set<Long> blockIds = mSessionIdToBlockIds.get(sessionId);
if (blockIds != null) {
blockIds.remove(blockId);
if (blockIds.isEmpty()) {
mSessionIdToBlockIds.remove(sessionId);
}
}
Set<Long> sessionIds = mBlockIdToSessionIds.get(blockId);
if (sessionIds != null) {
sessionIds.remove(sessionId);
if (sessionIds.isEmpty()) {
mBlockIdToSessionIds.remove(blockId);
}
}
}
} | [
"public",
"void",
"releaseAccess",
"(",
"long",
"sessionId",
",",
"long",
"blockId",
")",
"{",
"try",
"(",
"LockResource",
"lr",
"=",
"new",
"LockResource",
"(",
"mLock",
")",
")",
"{",
"Key",
"key",
"=",
"new",
"Key",
"(",
"sessionId",
",",
"blockId",
... | Releases the access token of this block by removing this (sessionId, blockId) pair from the
store.
@param sessionId the session ID
@param blockId the block ID | [
"Releases",
"the",
"access",
"token",
"of",
"this",
"block",
"by",
"removing",
"this",
"(",
"sessionId",
"blockId",
")",
"pair",
"from",
"the",
"store",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java#L165-L188 |
geomajas/geomajas-project-client-gwt | common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java | HtmlBuilder.tdStyle | public static String tdStyle(String style, String... content) {
return tagStyle(Html.Tag.TD, style, content);
} | java | public static String tdStyle(String style, String... content) {
return tagStyle(Html.Tag.TD, style, content);
} | [
"public",
"static",
"String",
"tdStyle",
"(",
"String",
"style",
",",
"String",
"...",
"content",
")",
"{",
"return",
"tagStyle",
"(",
"Html",
".",
"Tag",
".",
"TD",
",",
"style",
",",
"content",
")",
";",
"}"
] | Build a HTML TableData with given CSS style attributes for a string.
Given content does <b>not</b> consists of HTML snippets and
as such is being prepared with {@link HtmlBuilder#htmlEncode(String)}.
@param style style for td element
@param content content string
@return HTML td element as string | [
"Build",
"a",
"HTML",
"TableData",
"with",
"given",
"CSS",
"style",
"attributes",
"for",
"a",
"string",
".",
"Given",
"content",
"does",
"<b",
">",
"not<",
"/",
"b",
">",
"consists",
"of",
"HTML",
"snippets",
"and",
"as",
"such",
"is",
"being",
"prepared... | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L203-L205 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/Script.java | Script.getSigInsertionIndex | public int getSigInsertionIndex(Sha256Hash hash, ECKey signingKey) {
// Iterate over existing signatures, skipping the initial OP_0, the final redeem script
// and any placeholder OP_0 sigs.
List<ScriptChunk> existingChunks = chunks.subList(1, chunks.size() - 1);
ScriptChunk redeemScriptChunk = chunks.get(chunks.size() - 1);
checkNotNull(redeemScriptChunk.data);
Script redeemScript = new Script(redeemScriptChunk.data);
int sigCount = 0;
int myIndex = redeemScript.findKeyInRedeem(signingKey);
for (ScriptChunk chunk : existingChunks) {
if (chunk.opcode == OP_0) {
// OP_0, skip
} else {
checkNotNull(chunk.data);
try {
if (myIndex < redeemScript.findSigInRedeem(chunk.data, hash))
return sigCount;
} catch (SignatureDecodeException e) {
// ignore
}
sigCount++;
}
}
return sigCount;
} | java | public int getSigInsertionIndex(Sha256Hash hash, ECKey signingKey) {
// Iterate over existing signatures, skipping the initial OP_0, the final redeem script
// and any placeholder OP_0 sigs.
List<ScriptChunk> existingChunks = chunks.subList(1, chunks.size() - 1);
ScriptChunk redeemScriptChunk = chunks.get(chunks.size() - 1);
checkNotNull(redeemScriptChunk.data);
Script redeemScript = new Script(redeemScriptChunk.data);
int sigCount = 0;
int myIndex = redeemScript.findKeyInRedeem(signingKey);
for (ScriptChunk chunk : existingChunks) {
if (chunk.opcode == OP_0) {
// OP_0, skip
} else {
checkNotNull(chunk.data);
try {
if (myIndex < redeemScript.findSigInRedeem(chunk.data, hash))
return sigCount;
} catch (SignatureDecodeException e) {
// ignore
}
sigCount++;
}
}
return sigCount;
} | [
"public",
"int",
"getSigInsertionIndex",
"(",
"Sha256Hash",
"hash",
",",
"ECKey",
"signingKey",
")",
"{",
"// Iterate over existing signatures, skipping the initial OP_0, the final redeem script",
"// and any placeholder OP_0 sigs.",
"List",
"<",
"ScriptChunk",
">",
"existingChunks... | Returns the index where a signature by the key should be inserted. Only applicable to
a P2SH scriptSig. | [
"Returns",
"the",
"index",
"where",
"a",
"signature",
"by",
"the",
"key",
"should",
"be",
"inserted",
".",
"Only",
"applicable",
"to",
"a",
"P2SH",
"scriptSig",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L438-L463 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/MethodCompiler.java | MethodCompiler.invokespecial | public void invokespecial(Class<?> cls, String name, Class<?>... parameters) throws IOException
{
invokespecial(El.getMethod(cls, name, parameters));
} | java | public void invokespecial(Class<?> cls, String name, Class<?>... parameters) throws IOException
{
invokespecial(El.getMethod(cls, name, parameters));
} | [
"public",
"void",
"invokespecial",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"...",
"parameters",
")",
"throws",
"IOException",
"{",
"invokespecial",
"(",
"El",
".",
"getMethod",
"(",
"cls",
",",
"name",
",... | Invoke instance method; special handling for superclass, private, and instance initialization method invocations
<p>Stack: ..., objectref, [arg1, [arg2 ...]] => ...
@param cls
@param name
@param parameters
@throws IOException | [
"Invoke",
"instance",
"method",
";",
"special",
"handling",
"for",
"superclass",
"private",
"and",
"instance",
"initialization",
"method",
"invocations",
"<p",
">",
"Stack",
":",
"...",
"objectref",
"[",
"arg1",
"[",
"arg2",
"...",
"]]",
"=",
">",
";",
"..... | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/MethodCompiler.java#L1091-L1094 |
phax/ph-commons | ph-wsclient/src/main/java/com/helger/wsclient/WSHelper.java | WSHelper.enableSoapLogging | public static void enableSoapLogging (final boolean bServerDebug, final boolean bClientDebug)
{
// Server debug mode
String sDebug = Boolean.toString (bServerDebug);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", sDebug);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", sDebug);
// Client debug mode
sDebug = Boolean.toString (bClientDebug);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpTransportPipe.dump", sDebug);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpTransportPipe.dump", sDebug);
// Enlarge dump size
if (bServerDebug || bClientDebug)
{
final String sValue = Integer.toString (2 * CGlobal.BYTES_PER_MEGABYTE);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
}
else
{
SystemProperties.removePropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold");
SystemProperties.removePropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold");
}
} | java | public static void enableSoapLogging (final boolean bServerDebug, final boolean bClientDebug)
{
// Server debug mode
String sDebug = Boolean.toString (bServerDebug);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", sDebug);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", sDebug);
// Client debug mode
sDebug = Boolean.toString (bClientDebug);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpTransportPipe.dump", sDebug);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpTransportPipe.dump", sDebug);
// Enlarge dump size
if (bServerDebug || bClientDebug)
{
final String sValue = Integer.toString (2 * CGlobal.BYTES_PER_MEGABYTE);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
}
else
{
SystemProperties.removePropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold");
SystemProperties.removePropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold");
}
} | [
"public",
"static",
"void",
"enableSoapLogging",
"(",
"final",
"boolean",
"bServerDebug",
",",
"final",
"boolean",
"bClientDebug",
")",
"{",
"// Server debug mode",
"String",
"sDebug",
"=",
"Boolean",
".",
"toString",
"(",
"bServerDebug",
")",
";",
"SystemProperties... | Enable the JAX-WS SOAP debugging. This shows the exchanged SOAP messages in
the log file. By default this logging is disabled.
@param bServerDebug
<code>true</code> to enable server debugging, <code>false</code> to
disable it.
@param bClientDebug
<code>true</code> to enable client debugging, <code>false</code> to
disable it. | [
"Enable",
"the",
"JAX",
"-",
"WS",
"SOAP",
"debugging",
".",
"This",
"shows",
"the",
"exchanged",
"SOAP",
"messages",
"in",
"the",
"log",
"file",
".",
"By",
"default",
"this",
"logging",
"is",
"disabled",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-wsclient/src/main/java/com/helger/wsclient/WSHelper.java#L62-L86 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeDialog.java | DateRangeDialog.show | public static void show(DateRange dateRange, IResponseCallback<DateRange> callback) {
Map<String, Object> args = new HashMap<>();
args.put("dateRange", dateRange);
Window dlg = (Window) PageUtil.createPage(DialogConstants.RESOURCE_PREFIX + "dateRangeDialog.fsp", null, args)
.get(0);
dlg.modal((event) -> {
callback.onComplete((DateRange) dlg.getAttribute("result"));
} | java | public static void show(DateRange dateRange, IResponseCallback<DateRange> callback) {
Map<String, Object> args = new HashMap<>();
args.put("dateRange", dateRange);
Window dlg = (Window) PageUtil.createPage(DialogConstants.RESOURCE_PREFIX + "dateRangeDialog.fsp", null, args)
.get(0);
dlg.modal((event) -> {
callback.onComplete((DateRange) dlg.getAttribute("result"));
} | [
"public",
"static",
"void",
"show",
"(",
"DateRange",
"dateRange",
",",
"IResponseCallback",
"<",
"DateRange",
">",
"callback",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"args",
".",
"put",
... | Displays the date range dialog.
@param dateRange The initial date range.
@param callback Callback for returning a date range reflecting the inputs from the dialog.
This will be null if the input is cancelled or if an unexpected error occurs. | [
"Displays",
"the",
"date",
"range",
"dialog",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeDialog.java#L78-L85 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/underfs/MasterUfsManager.java | MasterUfsManager.setUfsMode | public synchronized void setUfsMode(Supplier<JournalContext> journalContext, AlluxioURI ufsPath,
UfsMode ufsMode) throws InvalidPathException {
LOG.info("Set ufs mode for {} to {}", ufsPath, ufsMode);
String root = ufsPath.getRootPath();
if (!mUfsRoots.contains(root)) {
LOG.warn("No managed ufs for physical ufs path {}", root);
throw new InvalidPathException(String.format("Unknown Ufs path %s", root));
}
mState.applyAndJournal(journalContext, UpdateUfsModeEntry.newBuilder()
.setUfsPath(ufsPath.getRootPath())
.setUfsMode(File.UfsMode.valueOf(ufsMode.name()))
.build());
} | java | public synchronized void setUfsMode(Supplier<JournalContext> journalContext, AlluxioURI ufsPath,
UfsMode ufsMode) throws InvalidPathException {
LOG.info("Set ufs mode for {} to {}", ufsPath, ufsMode);
String root = ufsPath.getRootPath();
if (!mUfsRoots.contains(root)) {
LOG.warn("No managed ufs for physical ufs path {}", root);
throw new InvalidPathException(String.format("Unknown Ufs path %s", root));
}
mState.applyAndJournal(journalContext, UpdateUfsModeEntry.newBuilder()
.setUfsPath(ufsPath.getRootPath())
.setUfsMode(File.UfsMode.valueOf(ufsMode.name()))
.build());
} | [
"public",
"synchronized",
"void",
"setUfsMode",
"(",
"Supplier",
"<",
"JournalContext",
">",
"journalContext",
",",
"AlluxioURI",
"ufsPath",
",",
"UfsMode",
"ufsMode",
")",
"throws",
"InvalidPathException",
"{",
"LOG",
".",
"info",
"(",
"\"Set ufs mode for {} to {}\""... | Set the operation mode the given physical ufs.
@param journalContext the journal context
@param ufsPath the physical ufs path (scheme and authority only)
@param ufsMode the ufs operation mode
@throws InvalidPathException if no managed ufs covers the given path | [
"Set",
"the",
"operation",
"mode",
"the",
"given",
"physical",
"ufs",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/underfs/MasterUfsManager.java#L110-L124 |
matthewhorridge/owlapi-gwt | owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/OWLAPIPreconditions.java | OWLAPIPreconditions.checkNotNull | @Nonnull
public static <T> T
checkNotNull(Optional<T> object, @Nonnull String message) {
if (object == null || !object.isPresent()) {
throw new IllegalArgumentException(message);
}
return verifyNotNull(object.get());
} | java | @Nonnull
public static <T> T
checkNotNull(Optional<T> object, @Nonnull String message) {
if (object == null || !object.isPresent()) {
throw new IllegalArgumentException(message);
}
return verifyNotNull(object.get());
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"Optional",
"<",
"T",
">",
"object",
",",
"@",
"Nonnull",
"String",
"message",
")",
"{",
"if",
"(",
"object",
"==",
"null",
"||",
"!",
"object",
".",
"isPresent",
"(",
")",
... | check for absent and throw IllegalArgumentException if null or absent
@param object
reference to check
@param message
message for the illegal argument exception
@param <T>
reference type
@return the input reference if not null
@throws IllegalArgumentException
if object is null | [
"check",
"for",
"absent",
"and",
"throw",
"IllegalArgumentException",
"if",
"null",
"or",
"absent"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/OWLAPIPreconditions.java#L145-L152 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/UrlValidator.java | UrlValidator.isValid | @Override
public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) {
if (StringUtils.isEmpty(pvalue)) {
return true;
}
if (pvalue.length() > LENGTH_URL) {
// url is to long, but that's handled by size annotation
return true;
}
return org.apache.commons.validator.routines.UrlValidator.getInstance().isValid(pvalue);
} | java | @Override
public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) {
if (StringUtils.isEmpty(pvalue)) {
return true;
}
if (pvalue.length() > LENGTH_URL) {
// url is to long, but that's handled by size annotation
return true;
}
return org.apache.commons.validator.routines.UrlValidator.getInstance().isValid(pvalue);
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"String",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"pvalue",
")",
")",
"{",
"return",
"true",
";",
"}",
... | {@inheritDoc} check if given string is a valid url.
@see javax.validation.ConstraintValidator#isValid(java.lang.Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"string",
"is",
"a",
"valid",
"url",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/UrlValidator.java#L54-L64 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java | URBridge.setConfigEntityMapping | private void setConfigEntityMapping(Map<String, Object> configProps) throws WIMException {
List<String> entityTypes = getSupportedEntityTypes();
String rdnProp;
String type = null;
entityConfigMap = new HashMap<String, String>();
for (int i = 0; i < entityTypes.size(); i++) {
type = entityTypes.get(i);
rdnProp = (getRDNProperties(type) == null) ? null : getRDNProperties(type)[0];
entityConfigMap.put(type, rdnProp);
}
if (entityConfigMap.get(Service.DO_LOGIN_ACCOUNT) == null && entityConfigMap.get(personAccountType) != null)
entityConfigMap.put(Service.DO_LOGIN_ACCOUNT, entityConfigMap.get(personAccountType));
if (tc.isDebugEnabled())
Tr.debug(tc, "setConfigEntityMapping entityConfigMap:" + entityConfigMap);
} | java | private void setConfigEntityMapping(Map<String, Object> configProps) throws WIMException {
List<String> entityTypes = getSupportedEntityTypes();
String rdnProp;
String type = null;
entityConfigMap = new HashMap<String, String>();
for (int i = 0; i < entityTypes.size(); i++) {
type = entityTypes.get(i);
rdnProp = (getRDNProperties(type) == null) ? null : getRDNProperties(type)[0];
entityConfigMap.put(type, rdnProp);
}
if (entityConfigMap.get(Service.DO_LOGIN_ACCOUNT) == null && entityConfigMap.get(personAccountType) != null)
entityConfigMap.put(Service.DO_LOGIN_ACCOUNT, entityConfigMap.get(personAccountType));
if (tc.isDebugEnabled())
Tr.debug(tc, "setConfigEntityMapping entityConfigMap:" + entityConfigMap);
} | [
"private",
"void",
"setConfigEntityMapping",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"configProps",
")",
"throws",
"WIMException",
"{",
"List",
"<",
"String",
">",
"entityTypes",
"=",
"getSupportedEntityTypes",
"(",
")",
";",
"String",
"rdnProp",
";",
"... | Set the mapping of RDN properties for each entity type. A map is created
with the key as the entity type and the value as the RDN property to be used.
This information is taken from the configuration.
@param configProps map containing the configuration information.
@throws WIMException throw when there is not a mapping for a user
or not a mapping for a group. | [
"Set",
"the",
"mapping",
"of",
"RDN",
"properties",
"for",
"each",
"entity",
"type",
".",
"A",
"map",
"is",
"created",
"with",
"the",
"key",
"as",
"the",
"entity",
"type",
"and",
"the",
"value",
"as",
"the",
"RDN",
"property",
"to",
"be",
"used",
".",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/URBridge.java#L345-L360 |
alkacon/opencms-core | src/org/opencms/ade/galleries/CmsPreviewService.java | CmsPreviewService.readFocalPoint | public static CmsPoint readFocalPoint(CmsObject cms, CmsResource resource) throws CmsException {
CmsProperty focalPointProp = cms.readPropertyObject(
resource,
CmsPropertyDefinition.PROPERTY_IMAGE_FOCAL_POINT,
false);
CmsPoint focalPoint = null;
if (!focalPointProp.isNullProperty()) {
String focalPointVal = focalPointProp.getValue();
Matcher matcher = PATTERN_FOCAL_POINT.matcher(focalPointVal);
if (matcher.matches()) {
int fx = Integer.parseInt(matcher.group(1));
int fy = Integer.parseInt(matcher.group(2));
focalPoint = new CmsPoint(fx, fy);
}
}
return focalPoint;
} | java | public static CmsPoint readFocalPoint(CmsObject cms, CmsResource resource) throws CmsException {
CmsProperty focalPointProp = cms.readPropertyObject(
resource,
CmsPropertyDefinition.PROPERTY_IMAGE_FOCAL_POINT,
false);
CmsPoint focalPoint = null;
if (!focalPointProp.isNullProperty()) {
String focalPointVal = focalPointProp.getValue();
Matcher matcher = PATTERN_FOCAL_POINT.matcher(focalPointVal);
if (matcher.matches()) {
int fx = Integer.parseInt(matcher.group(1));
int fy = Integer.parseInt(matcher.group(2));
focalPoint = new CmsPoint(fx, fy);
}
}
return focalPoint;
} | [
"public",
"static",
"CmsPoint",
"readFocalPoint",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"CmsProperty",
"focalPointProp",
"=",
"cms",
".",
"readPropertyObject",
"(",
"resource",
",",
"CmsPropertyDefinition",
".",
... | Reads the focal point from a resource.<p>
@param cms the CMS context to use
@param resource the resource
@return the focal point (or null, if the focal point property is not set or contains an invalid value)
@throws CmsException if something goes wrong | [
"Reads",
"the",
"focal",
"point",
"from",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsPreviewService.java#L180-L198 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java | ManagementEnforcer.getFilteredPolicy | public List<List<String>> getFilteredPolicy(int fieldIndex, String... fieldValues) {
return getFilteredNamedPolicy("p", fieldIndex, fieldValues);
} | java | public List<List<String>> getFilteredPolicy(int fieldIndex, String... fieldValues) {
return getFilteredNamedPolicy("p", fieldIndex, fieldValues);
} | [
"public",
"List",
"<",
"List",
"<",
"String",
">",
">",
"getFilteredPolicy",
"(",
"int",
"fieldIndex",
",",
"String",
"...",
"fieldValues",
")",
"{",
"return",
"getFilteredNamedPolicy",
"(",
"\"p\"",
",",
"fieldIndex",
",",
"fieldValues",
")",
";",
"}"
] | getFilteredPolicy gets all the authorization rules in the policy, field filters can be specified.
@param fieldIndex the policy rule's start index to be matched.
@param fieldValues the field values to be matched, value ""
means not to match this field.
@return the filtered "p" policy rules. | [
"getFilteredPolicy",
"gets",
"all",
"the",
"authorization",
"rules",
"in",
"the",
"policy",
"field",
"filters",
"can",
"be",
"specified",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java#L143-L145 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java | JDBCResultSet.updateDate | public void updateDate(String columnLabel, Date x) throws SQLException {
updateDate(findColumn(columnLabel), x);
} | java | public void updateDate(String columnLabel, Date x) throws SQLException {
updateDate(findColumn(columnLabel), x);
} | [
"public",
"void",
"updateDate",
"(",
"String",
"columnLabel",
",",
"Date",
"x",
")",
"throws",
"SQLException",
"{",
"updateDate",
"(",
"findColumn",
"(",
"columnLabel",
")",
",",
"x",
")",
";",
"}"
] | <!-- start generic documentation -->
Updates the designated column with a <code>java.sql.Date</code> value.
The updater methods are used to update column values in the
current row or the insert row. The updater methods do not
update the underlying database; instead the <code>updateRow</code> or
<code>insertRow</code> methods are called to update the database.
<!-- end generic documentation -->
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB supports this feature. <p>
</div>
<!-- end release-specific documentation -->
@param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column
@param x the new column value
@exception SQLException if a database access error occurs,
the result set concurrency is <code>CONCUR_READ_ONLY</code>
or this method is called on a closed result set
@exception SQLFeatureNotSupportedException if the JDBC driver does not support
this method
@since JDK 1.2 (JDK 1.1.x developers: read the overview for
JDBCResultSet) | [
"<!",
"--",
"start",
"generic",
"documentation",
"--",
">",
"Updates",
"the",
"designated",
"column",
"with",
"a",
"<code",
">",
"java",
".",
"sql",
".",
"Date<",
"/",
"code",
">",
"value",
".",
"The",
"updater",
"methods",
"are",
"used",
"to",
"update",... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L3610-L3612 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/OffsetTime.java | OffsetTime.ofInstant | public static OffsetTime ofInstant(Instant instant, ZoneId zone) {
Jdk8Methods.requireNonNull(instant, "instant");
Jdk8Methods.requireNonNull(zone, "zone");
ZoneRules rules = zone.getRules();
ZoneOffset offset = rules.getOffset(instant);
long secsOfDay = instant.getEpochSecond() % SECONDS_PER_DAY;
secsOfDay = (secsOfDay + offset.getTotalSeconds()) % SECONDS_PER_DAY;
if (secsOfDay < 0) {
secsOfDay += SECONDS_PER_DAY;
}
LocalTime time = LocalTime.ofSecondOfDay(secsOfDay, instant.getNano());
return new OffsetTime(time, offset);
} | java | public static OffsetTime ofInstant(Instant instant, ZoneId zone) {
Jdk8Methods.requireNonNull(instant, "instant");
Jdk8Methods.requireNonNull(zone, "zone");
ZoneRules rules = zone.getRules();
ZoneOffset offset = rules.getOffset(instant);
long secsOfDay = instant.getEpochSecond() % SECONDS_PER_DAY;
secsOfDay = (secsOfDay + offset.getTotalSeconds()) % SECONDS_PER_DAY;
if (secsOfDay < 0) {
secsOfDay += SECONDS_PER_DAY;
}
LocalTime time = LocalTime.ofSecondOfDay(secsOfDay, instant.getNano());
return new OffsetTime(time, offset);
} | [
"public",
"static",
"OffsetTime",
"ofInstant",
"(",
"Instant",
"instant",
",",
"ZoneId",
"zone",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"instant",
",",
"\"instant\"",
")",
";",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"zone",
",",
"\"zone\"",
"... | Obtains an instance of {@code OffsetTime} from an {@code Instant} and zone ID.
<p>
This creates an offset time with the same instant as that specified.
Finding the offset from UTC/Greenwich is simple as there is only one valid
offset for each instant.
<p>
The date component of the instant is dropped during the conversion.
This means that the conversion can never fail due to the instant being
out of the valid range of dates.
@param instant the instant to create the time from, not null
@param zone the time-zone, which may be an offset, not null
@return the offset time, not null | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"OffsetTime",
"}",
"from",
"an",
"{",
"@code",
"Instant",
"}",
"and",
"zone",
"ID",
".",
"<p",
">",
"This",
"creates",
"an",
"offset",
"time",
"with",
"the",
"same",
"instant",
"as",
"that",
"specified",
... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/OffsetTime.java#L228-L240 |
aws/aws-sdk-java | aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/DescribeDeploymentJobResult.java | DescribeDeploymentJobResult.withTags | public DescribeDeploymentJobResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public DescribeDeploymentJobResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"DescribeDeploymentJobResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The list of all tags added to the specified deployment job.
</p>
@param tags
The list of all tags added to the specified deployment job.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"list",
"of",
"all",
"tags",
"added",
"to",
"the",
"specified",
"deployment",
"job",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/DescribeDeploymentJobResult.java#L580-L583 |
joniles/mpxj | src/main/java/net/sf/mpxj/utility/MppCleanUtility.java | MppCleanUtility.compareBytes | private boolean compareBytes(byte[] lhs, byte[] rhs, int rhsOffset)
{
boolean result = true;
for (int loop = 0; loop < lhs.length; loop++)
{
if (lhs[loop] != rhs[rhsOffset + loop])
{
result = false;
break;
}
}
return (result);
} | java | private boolean compareBytes(byte[] lhs, byte[] rhs, int rhsOffset)
{
boolean result = true;
for (int loop = 0; loop < lhs.length; loop++)
{
if (lhs[loop] != rhs[rhsOffset + loop])
{
result = false;
break;
}
}
return (result);
} | [
"private",
"boolean",
"compareBytes",
"(",
"byte",
"[",
"]",
"lhs",
",",
"byte",
"[",
"]",
"rhs",
",",
"int",
"rhsOffset",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"for",
"(",
"int",
"loop",
"=",
"0",
";",
"loop",
"<",
"lhs",
".",
"length",... | Compare an array of bytes with a subsection of a larger array of bytes.
@param lhs small array of bytes
@param rhs large array of bytes
@param rhsOffset offset into larger array of bytes
@return true if a match is found | [
"Compare",
"an",
"array",
"of",
"bytes",
"with",
"a",
"subsection",
"of",
"a",
"larger",
"array",
"of",
"bytes",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/MppCleanUtility.java#L420-L432 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SpringContextHelper.java | SpringContextHelper.getBean | public static <T> T getBean(final String beanName, final Class<T> beanClazz) {
return context.getBean(beanName, beanClazz);
} | java | public static <T> T getBean(final String beanName, final Class<T> beanClazz) {
return context.getBean(beanName, beanClazz);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getBean",
"(",
"final",
"String",
"beanName",
",",
"final",
"Class",
"<",
"T",
">",
"beanClazz",
")",
"{",
"return",
"context",
".",
"getBean",
"(",
"beanName",
",",
"beanClazz",
")",
";",
"}"
] | method to return a certain bean by its class and name.
@param beanName
name of the beand which should be returned from the
application context
@param beanClazz
class of the bean which should be returned from the
application context
@return the requested bean | [
"method",
"to",
"return",
"a",
"certain",
"bean",
"by",
"its",
"class",
"and",
"name",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SpringContextHelper.java#L69-L71 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java | InheritanceTypeChecking.sawOpcode | @Override
public void sawOpcode(int seen) {
boolean processed = false;
Iterator<IfStatement> isi = ifStatements.iterator();
while (isi.hasNext()) {
IfStatement.Action action = isi.next().processOpcode(this, bugReporter, seen);
if (action == IfStatement.Action.REMOVE_ACTION) {
isi.remove();
} else if (action == IfStatement.Action.PROCESSED_ACTION) {
processed = true;
}
}
if (!processed && OpcodeUtils.isALoad(seen)) {
IfStatement is = new IfStatement(this, seen);
ifStatements.add(is);
}
} | java | @Override
public void sawOpcode(int seen) {
boolean processed = false;
Iterator<IfStatement> isi = ifStatements.iterator();
while (isi.hasNext()) {
IfStatement.Action action = isi.next().processOpcode(this, bugReporter, seen);
if (action == IfStatement.Action.REMOVE_ACTION) {
isi.remove();
} else if (action == IfStatement.Action.PROCESSED_ACTION) {
processed = true;
}
}
if (!processed && OpcodeUtils.isALoad(seen)) {
IfStatement is = new IfStatement(this, seen);
ifStatements.add(is);
}
} | [
"@",
"Override",
"public",
"void",
"sawOpcode",
"(",
"int",
"seen",
")",
"{",
"boolean",
"processed",
"=",
"false",
";",
"Iterator",
"<",
"IfStatement",
">",
"isi",
"=",
"ifStatements",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"isi",
".",
"hasNext",... | implements the visitor to find if/else code that checks types using instanceof, and these types are related by inheritance.
@param seen
the opcode of the currently parsed instruction | [
"implements",
"the",
"visitor",
"to",
"find",
"if",
"/",
"else",
"code",
"that",
"checks",
"types",
"using",
"instanceof",
"and",
"these",
"types",
"are",
"related",
"by",
"inheritance",
"."
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java#L90-L107 |
geomajas/geomajas-project-client-gwt | common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java | HtmlBuilder.tableClass | public static String tableClass(String clazz, String... content) {
return tagClass(Html.Tag.TABLE, clazz, content);
} | java | public static String tableClass(String clazz, String... content) {
return tagClass(Html.Tag.TABLE, clazz, content);
} | [
"public",
"static",
"String",
"tableClass",
"(",
"String",
"clazz",
",",
"String",
"...",
"content",
")",
"{",
"return",
"tagClass",
"(",
"Html",
".",
"Tag",
".",
"TABLE",
",",
"clazz",
",",
"content",
")",
";",
"}"
] | Build a HTML Table with given CSS class for a string.
Given content does <b>not</b> consists of HTML snippets and
as such is being prepared with {@link HtmlBuilder#htmlEncode(String)}.
@param clazz class for table element
@param content content string
@return HTML table element as string | [
"Build",
"a",
"HTML",
"Table",
"with",
"given",
"CSS",
"class",
"for",
"a",
"string",
".",
"Given",
"content",
"does",
"<b",
">",
"not<",
"/",
"b",
">",
"consists",
"of",
"HTML",
"snippets",
"and",
"as",
"such",
"is",
"being",
"prepared",
"with",
"{",
... | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L67-L69 |
groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.eachRow | public void eachRow(String sql, List<Object> params, Closure metaClosure, Closure rowClosure) throws SQLException {
eachRow(sql, params, metaClosure, 0, 0, rowClosure);
} | java | public void eachRow(String sql, List<Object> params, Closure metaClosure, Closure rowClosure) throws SQLException {
eachRow(sql, params, metaClosure, 0, 0, rowClosure);
} | [
"public",
"void",
"eachRow",
"(",
"String",
"sql",
",",
"List",
"<",
"Object",
">",
"params",
",",
"Closure",
"metaClosure",
",",
"Closure",
"rowClosure",
")",
"throws",
"SQLException",
"{",
"eachRow",
"(",
"sql",
",",
"params",
",",
"metaClosure",
",",
"0... | Performs the given SQL query calling the given Closure with each row of the result set.
The row will be a <code>GroovyResultSet</code> which is a <code>ResultSet</code>
that supports accessing the fields using property style notation and ordinal index values.
In addition, the <code>metaClosure</code> will be called once passing in the
<code>ResultSetMetaData</code> as argument.
The query may contain placeholder question marks which match the given list of parameters.
<p>
Example usage:
<pre>
def printColNames = { meta ->
(1..meta.columnCount).each {
print meta.getColumnLabel(it).padRight(20)
}
println()
}
def printRow = { row ->
row.toRowResult().values().each{ print it.toString().padRight(20) }
println()
}
sql.eachRow("select * from PERSON where lastname like ?", ['%a%'], printColNames, printRow)
</pre>
<p>
This method supports named and named ordinal parameters.
See the class Javadoc for more details.
<p>
Resource handling is performed automatically where appropriate.
@param sql the sql statement
@param params a list of parameters
@param metaClosure called for meta data (only once after sql execution)
@param rowClosure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs | [
"Performs",
"the",
"given",
"SQL",
"query",
"calling",
"the",
"given",
"Closure",
"with",
"each",
"row",
"of",
"the",
"result",
"set",
".",
"The",
"row",
"will",
"be",
"a",
"<code",
">",
"GroovyResultSet<",
"/",
"code",
">",
"which",
"is",
"a",
"<code",
... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1336-L1338 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java | HttpBuilder.optionsAsync | public CompletableFuture<Object> optionsAsync(final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> options(configuration), getExecutor());
} | java | public CompletableFuture<Object> optionsAsync(final Consumer<HttpConfig> configuration) {
return CompletableFuture.supplyAsync(() -> options(configuration), getExecutor());
} | [
"public",
"CompletableFuture",
"<",
"Object",
">",
"optionsAsync",
"(",
"final",
"Consumer",
"<",
"HttpConfig",
">",
"configuration",
")",
"{",
"return",
"CompletableFuture",
".",
"supplyAsync",
"(",
"(",
")",
"->",
"options",
"(",
"configuration",
")",
",",
"... | Executes an asynchronous OPTIONS request on the configured URI (asynchronous alias to `options(Consumer)`), with additional configuration
provided by the configuration function.
This method is generally used for Java-specific configuration.
[source,java]
----
HttpBuilder http = HttpBuilder.configure(config -> {
config.getRequest().setUri("http://localhost:10101");
});
CompletableFuture<Object> future = http.optionsAsync(config -> {
config.getRequest().getUri().setPath("/foo");
});
Object result = future.get();
----
The `configuration` function allows additional configuration for this request based on the {@link HttpConfig} interface.
@param configuration the additional configuration closure (delegated to {@link HttpConfig})
@return the resulting content wrapped in a {@link CompletableFuture} | [
"Executes",
"an",
"asynchronous",
"OPTIONS",
"request",
"on",
"the",
"configured",
"URI",
"(",
"asynchronous",
"alias",
"to",
"options",
"(",
"Consumer",
")",
")",
"with",
"additional",
"configuration",
"provided",
"by",
"the",
"configuration",
"function",
"."
] | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1928-L1930 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsHistoryDriver.java | CmsHistoryDriver.internalCreateProject | protected CmsHistoryProject internalCreateProject(ResultSet res, List<String> resources) throws SQLException {
String ou = CmsOrganizationalUnit.removeLeadingSeparator(
res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_OU_0")));
CmsUUID publishedById = new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECT_PUBLISHED_BY_0")));
CmsUUID userId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_USER_ID_0")));
return new CmsHistoryProject(
res.getInt(m_sqlManager.readQuery("C_PROJECTS_PUBLISH_TAG_0")),
new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_ID_0"))),
ou + res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_NAME_0")),
res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_DESCRIPTION_0")),
userId,
new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_GROUP_ID_0"))),
new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_MANAGERGROUP_ID_0"))),
res.getLong(m_sqlManager.readQuery("C_PROJECTS_DATE_CREATED_0")),
CmsProject.CmsProjectType.valueOf(res.getInt(m_sqlManager.readQuery("C_PROJECTS_PROJECT_TYPE_0"))),
res.getLong(m_sqlManager.readQuery("C_PROJECT_PUBLISHDATE_0")),
publishedById,
resources);
} | java | protected CmsHistoryProject internalCreateProject(ResultSet res, List<String> resources) throws SQLException {
String ou = CmsOrganizationalUnit.removeLeadingSeparator(
res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_OU_0")));
CmsUUID publishedById = new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECT_PUBLISHED_BY_0")));
CmsUUID userId = new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_USER_ID_0")));
return new CmsHistoryProject(
res.getInt(m_sqlManager.readQuery("C_PROJECTS_PUBLISH_TAG_0")),
new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_ID_0"))),
ou + res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_NAME_0")),
res.getString(m_sqlManager.readQuery("C_PROJECTS_PROJECT_DESCRIPTION_0")),
userId,
new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_GROUP_ID_0"))),
new CmsUUID(res.getString(m_sqlManager.readQuery("C_PROJECTS_MANAGERGROUP_ID_0"))),
res.getLong(m_sqlManager.readQuery("C_PROJECTS_DATE_CREATED_0")),
CmsProject.CmsProjectType.valueOf(res.getInt(m_sqlManager.readQuery("C_PROJECTS_PROJECT_TYPE_0"))),
res.getLong(m_sqlManager.readQuery("C_PROJECT_PUBLISHDATE_0")),
publishedById,
resources);
} | [
"protected",
"CmsHistoryProject",
"internalCreateProject",
"(",
"ResultSet",
"res",
",",
"List",
"<",
"String",
">",
"resources",
")",
"throws",
"SQLException",
"{",
"String",
"ou",
"=",
"CmsOrganizationalUnit",
".",
"removeLeadingSeparator",
"(",
"res",
".",
"getSt... | Creates a historical project from the given result set and resources.<p>
@param res the resource set
@param resources the historical resources
@return the historical project
@throws SQLException if something goes wrong | [
"Creates",
"a",
"historical",
"project",
"from",
"the",
"given",
"result",
"set",
"and",
"resources",
".",
"<p",
">",
"@param",
"res",
"the",
"resource",
"set",
"@param",
"resources",
"the",
"historical",
"resources"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsHistoryDriver.java#L1698-L1717 |
Activiti/Activiti | activiti-bpmn-converter/src/main/java/org/activiti/bpmn/converter/util/BpmnXMLUtil.java | BpmnXMLUtil.addCustomAttributes | public static void addCustomAttributes(XMLStreamReader xtr, BaseElement element, List<ExtensionAttribute>... blackLists) {
for (int i = 0; i < xtr.getAttributeCount(); i++) {
ExtensionAttribute extensionAttribute = new ExtensionAttribute();
extensionAttribute.setName(xtr.getAttributeLocalName(i));
extensionAttribute.setValue(xtr.getAttributeValue(i));
if (StringUtils.isNotEmpty(xtr.getAttributeNamespace(i))) {
extensionAttribute.setNamespace(xtr.getAttributeNamespace(i));
}
if (StringUtils.isNotEmpty(xtr.getAttributePrefix(i))) {
extensionAttribute.setNamespacePrefix(xtr.getAttributePrefix(i));
}
if (!isBlacklisted(extensionAttribute, blackLists)) {
element.addAttribute(extensionAttribute);
}
}
} | java | public static void addCustomAttributes(XMLStreamReader xtr, BaseElement element, List<ExtensionAttribute>... blackLists) {
for (int i = 0; i < xtr.getAttributeCount(); i++) {
ExtensionAttribute extensionAttribute = new ExtensionAttribute();
extensionAttribute.setName(xtr.getAttributeLocalName(i));
extensionAttribute.setValue(xtr.getAttributeValue(i));
if (StringUtils.isNotEmpty(xtr.getAttributeNamespace(i))) {
extensionAttribute.setNamespace(xtr.getAttributeNamespace(i));
}
if (StringUtils.isNotEmpty(xtr.getAttributePrefix(i))) {
extensionAttribute.setNamespacePrefix(xtr.getAttributePrefix(i));
}
if (!isBlacklisted(extensionAttribute, blackLists)) {
element.addAttribute(extensionAttribute);
}
}
} | [
"public",
"static",
"void",
"addCustomAttributes",
"(",
"XMLStreamReader",
"xtr",
",",
"BaseElement",
"element",
",",
"List",
"<",
"ExtensionAttribute",
">",
"...",
"blackLists",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"xtr",
".",
"getAt... | add all attributes from XML to element extensionAttributes (except blackListed).
@param xtr
@param element
@param blackLists | [
"add",
"all",
"attributes",
"from",
"XML",
"to",
"element",
"extensionAttributes",
"(",
"except",
"blackListed",
")",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/converter/util/BpmnXMLUtil.java#L335-L350 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/widget/ScaleConverter.java | ScaleConverter.scaleToString | public static String scaleToString(double scale, int precision, int significantDigits) {
NumberFormat numberFormat = NumberFormat.getFormat("###,###");
if (scale > 0 && scale < 1.0) {
int denominator = round((int) Math.round(1.0 / scale), precision, significantDigits);
return "1 : " + numberFormat.format(denominator);
} else if (scale >= 1.0) {
int nominator = round((int) Math.round(scale), precision, significantDigits);
return numberFormat.format(nominator) + " : 1";
} else {
return ERROR_SCALE;
}
} | java | public static String scaleToString(double scale, int precision, int significantDigits) {
NumberFormat numberFormat = NumberFormat.getFormat("###,###");
if (scale > 0 && scale < 1.0) {
int denominator = round((int) Math.round(1.0 / scale), precision, significantDigits);
return "1 : " + numberFormat.format(denominator);
} else if (scale >= 1.0) {
int nominator = round((int) Math.round(scale), precision, significantDigits);
return numberFormat.format(nominator) + " : 1";
} else {
return ERROR_SCALE;
}
} | [
"public",
"static",
"String",
"scaleToString",
"(",
"double",
"scale",
",",
"int",
"precision",
",",
"int",
"significantDigits",
")",
"{",
"NumberFormat",
"numberFormat",
"=",
"NumberFormat",
".",
"getFormat",
"(",
"\"###,###\"",
")",
";",
"if",
"(",
"scale",
... | Convert a scale to a string representation.
@param scale scale to convert
@param precision precision for the scale, or 0
@param significantDigits maximum number of significant digits
@return string representation for the scale | [
"Convert",
"a",
"scale",
"to",
"a",
"string",
"representation",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/ScaleConverter.java#L37-L48 |
h2oai/h2o-3 | h2o-core/src/main/java/water/api/MetadataHandler.java | MetadataHandler.fetchSchemaMetadata | @SuppressWarnings("unused") // called through reflection by RequestServer
public MetadataV3 fetchSchemaMetadata(int version, MetadataV3 docs) {
if ("void".equals(docs.schemaname)) {
docs.schemas = new SchemaMetadataV3[0];
return docs;
}
docs.schemas = new SchemaMetadataV3[1];
// NOTE: this will throw an exception if the classname isn't found:
Schema schema = Schema.newInstance(docs.schemaname);
// get defaults
try {
Iced impl = (Iced) schema.getImplClass().newInstance();
schema.fillFromImpl(impl);
}
catch (Exception e) {
// ignore if create fails; this can happen for abstract classes
}
SchemaMetadataV3 meta = new SchemaMetadataV3(new SchemaMetadata(schema));
docs.schemas[0] = meta;
return docs;
} | java | @SuppressWarnings("unused") // called through reflection by RequestServer
public MetadataV3 fetchSchemaMetadata(int version, MetadataV3 docs) {
if ("void".equals(docs.schemaname)) {
docs.schemas = new SchemaMetadataV3[0];
return docs;
}
docs.schemas = new SchemaMetadataV3[1];
// NOTE: this will throw an exception if the classname isn't found:
Schema schema = Schema.newInstance(docs.schemaname);
// get defaults
try {
Iced impl = (Iced) schema.getImplClass().newInstance();
schema.fillFromImpl(impl);
}
catch (Exception e) {
// ignore if create fails; this can happen for abstract classes
}
SchemaMetadataV3 meta = new SchemaMetadataV3(new SchemaMetadata(schema));
docs.schemas[0] = meta;
return docs;
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"// called through reflection by RequestServer",
"public",
"MetadataV3",
"fetchSchemaMetadata",
"(",
"int",
"version",
",",
"MetadataV3",
"docs",
")",
"{",
"if",
"(",
"\"void\"",
".",
"equals",
"(",
"docs",
".",
"sche... | Fetch the metadata for a Schema by its simple Schema name (e.g., "DeepLearningParametersV2"). | [
"Fetch",
"the",
"metadata",
"for",
"a",
"Schema",
"by",
"its",
"simple",
"Schema",
"name",
"(",
"e",
".",
"g",
".",
"DeepLearningParametersV2",
")",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/api/MetadataHandler.java#L144-L165 |
google/closure-compiler | src/com/google/javascript/jscomp/ReplaceMessages.java | ReplaceMessages.replaceCallNode | private Node replaceCallNode(JsMessage message, Node callNode)
throws MalformedException {
checkNode(callNode, Token.CALL);
Node getPropNode = callNode.getFirstChild();
checkNode(getPropNode, Token.GETPROP);
Node stringExprNode = getPropNode.getNext();
checkStringExprNode(stringExprNode);
Node objLitNode = stringExprNode.getNext();
// Build the replacement tree.
Iterator<CharSequence> iterator = message.parts().iterator();
return iterator.hasNext()
? constructStringExprNode(iterator, objLitNode, callNode)
: IR.string("");
} | java | private Node replaceCallNode(JsMessage message, Node callNode)
throws MalformedException {
checkNode(callNode, Token.CALL);
Node getPropNode = callNode.getFirstChild();
checkNode(getPropNode, Token.GETPROP);
Node stringExprNode = getPropNode.getNext();
checkStringExprNode(stringExprNode);
Node objLitNode = stringExprNode.getNext();
// Build the replacement tree.
Iterator<CharSequence> iterator = message.parts().iterator();
return iterator.hasNext()
? constructStringExprNode(iterator, objLitNode, callNode)
: IR.string("");
} | [
"private",
"Node",
"replaceCallNode",
"(",
"JsMessage",
"message",
",",
"Node",
"callNode",
")",
"throws",
"MalformedException",
"{",
"checkNode",
"(",
"callNode",
",",
"Token",
".",
"CALL",
")",
";",
"Node",
"getPropNode",
"=",
"callNode",
".",
"getFirstChild",... | Replaces a CALL node with an inlined message value.
<p>
The call tree looks something like:
<pre>
call
|-- getprop
| |-- name 'goog'
| +-- string 'getMsg'
|
|-- string 'Hi {$userName}! Welcome to {$product}.'
+-- objlit
|-- string 'userName'
|-- name 'someUserName'
|-- string 'product'
+-- call
+-- name 'getProductName'
<pre>
<p>
For that example, we'd return:
<pre>
add
|-- string 'Hi '
+-- add
|-- name someUserName
+-- add
|-- string '! Welcome to '
+-- add
|-- call
| +-- name 'getProductName'
+-- string '.'
</pre>
@param message a message
@param callNode the message's original CALL value node
@return a STRING node, or an ADD node that does string concatenation, if
the message has one or more placeholders
@throws MalformedException if the passed node's subtree structure is
not as expected | [
"Replaces",
"a",
"CALL",
"node",
"with",
"an",
"inlined",
"message",
"value",
".",
"<p",
">",
"The",
"call",
"tree",
"looks",
"something",
"like",
":",
"<pre",
">",
"call",
"|",
"--",
"getprop",
"|",
"|",
"--",
"name",
"goog",
"|",
"+",
"--",
"string... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ReplaceMessages.java#L296-L310 |
avarabyeu/restendpoint | src/main/java/com/github/avarabyeu/restendpoint/http/HttpClientRestEndpoint.java | HttpClientRestEndpoint.spliceUrl | final URI spliceUrl(String resource, Map<String, String> parameters) throws RestEndpointIOException {
try {
URIBuilder builder;
if (!Strings.isNullOrEmpty(baseUrl)) {
builder = new URIBuilder(baseUrl);
builder.setPath(builder.getPath() + resource);
} else {
builder = new URIBuilder(resource);
}
for (Entry<String, String> parameter : parameters.entrySet()) {
builder.addParameter(parameter.getKey(), parameter.getValue());
}
return builder.build();
} catch (URISyntaxException e) {
throw new RestEndpointIOException(
"Unable to builder URL with base url '" + baseUrl + "' and resouce '" + resource + "'", e);
}
} | java | final URI spliceUrl(String resource, Map<String, String> parameters) throws RestEndpointIOException {
try {
URIBuilder builder;
if (!Strings.isNullOrEmpty(baseUrl)) {
builder = new URIBuilder(baseUrl);
builder.setPath(builder.getPath() + resource);
} else {
builder = new URIBuilder(resource);
}
for (Entry<String, String> parameter : parameters.entrySet()) {
builder.addParameter(parameter.getKey(), parameter.getValue());
}
return builder.build();
} catch (URISyntaxException e) {
throw new RestEndpointIOException(
"Unable to builder URL with base url '" + baseUrl + "' and resouce '" + resource + "'", e);
}
} | [
"final",
"URI",
"spliceUrl",
"(",
"String",
"resource",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"throws",
"RestEndpointIOException",
"{",
"try",
"{",
"URIBuilder",
"builder",
";",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"("... | Splice base URL and URL of resource
@param resource REST Resource Path
@param parameters Map of query parameters
@return Absolute URL to the REST Resource including server and port
@throws RestEndpointIOException In case of incorrect URL format | [
"Splice",
"base",
"URL",
"and",
"URL",
"of",
"resource"
] | train | https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/http/HttpClientRestEndpoint.java#L468-L485 |
zaproxy/zaproxy | src/org/zaproxy/zap/spider/Spider.java | Spider.addFileSeed | private void addFileSeed(URI baseUri, String fileName, Pattern condition) {
String fullpath = baseUri.getEscapedPath();
if (fullpath == null) {
fullpath = "";
}
String name = baseUri.getEscapedName();
if (name == null) {
name = "";
}
String pathminusfilename = fullpath.substring(0, fullpath.lastIndexOf(name));
if (pathminusfilename.isEmpty()) {
pathminusfilename = "/";
}
if (condition.matcher(pathminusfilename).find()) {
return;
}
String uri = buildUri(baseUri.getScheme(), baseUri.getRawHost(), baseUri.getPort(), pathminusfilename + fileName);
try {
this.seedList.add(new URI(uri, true));
} catch (Exception e) {
log.warn("Error while creating a seed URI for file [" + fileName + "] from [" + baseUri + "] using [" + uri + "]:",
e);
}
} | java | private void addFileSeed(URI baseUri, String fileName, Pattern condition) {
String fullpath = baseUri.getEscapedPath();
if (fullpath == null) {
fullpath = "";
}
String name = baseUri.getEscapedName();
if (name == null) {
name = "";
}
String pathminusfilename = fullpath.substring(0, fullpath.lastIndexOf(name));
if (pathminusfilename.isEmpty()) {
pathminusfilename = "/";
}
if (condition.matcher(pathminusfilename).find()) {
return;
}
String uri = buildUri(baseUri.getScheme(), baseUri.getRawHost(), baseUri.getPort(), pathminusfilename + fileName);
try {
this.seedList.add(new URI(uri, true));
} catch (Exception e) {
log.warn("Error while creating a seed URI for file [" + fileName + "] from [" + baseUri + "] using [" + uri + "]:",
e);
}
} | [
"private",
"void",
"addFileSeed",
"(",
"URI",
"baseUri",
",",
"String",
"fileName",
",",
"Pattern",
"condition",
")",
"{",
"String",
"fullpath",
"=",
"baseUri",
".",
"getEscapedPath",
"(",
")",
";",
"if",
"(",
"fullpath",
"==",
"null",
")",
"{",
"fullpath"... | Adds a file seed using the given base URI, file name and condition.
<p>
The file is added as part of the path, without existing file name. For example, with base URI as
{@code http://example.com/some/path/file.html} and file name as {@code .git/index} it's added the seed
{@code http://example.com/some/path/.git/index}.
<p>
If the given condition matches the base URI's path without the file name, the file seed is not added (this prevents
adding the seed once again).
@param baseUri the base URI to construct the file seed.
@param fileName the name of the file seed.
@param condition the condition to add the file seed. | [
"Adds",
"a",
"file",
"seed",
"using",
"the",
"given",
"base",
"URI",
"file",
"name",
"and",
"condition",
".",
"<p",
">",
"The",
"file",
"is",
"added",
"as",
"part",
"of",
"the",
"path",
"without",
"existing",
"file",
"name",
".",
"For",
"example",
"wit... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/Spider.java#L312-L339 |
guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java | HAConfUtil.isAfter | static boolean isAfter(Date a, Date b) {
return a == null || (b != null && b.after(a));
} | java | static boolean isAfter(Date a, Date b) {
return a == null || (b != null && b.after(a));
} | [
"static",
"boolean",
"isAfter",
"(",
"Date",
"a",
",",
"Date",
"b",
")",
"{",
"return",
"a",
"==",
"null",
"||",
"(",
"b",
"!=",
"null",
"&&",
"b",
".",
"after",
"(",
"a",
")",
")",
";",
"}"
] | Is value of b after value of a.
@return True, if b is after a. Always true, if value of a is null. | [
"Is",
"value",
"of",
"b",
"after",
"value",
"of",
"a",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java#L52-L54 |
aws/aws-sdk-java | aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/AmazonKinesisVideoPutMediaClient.java | AmazonKinesisVideoPutMediaClient.getSslContext | private SslContext getSslContext(URI uri) {
if (!"https".equalsIgnoreCase(uri.getScheme())) {
return null;
}
try {
return SslContextBuilder.forClient().build();
} catch (SSLException e) {
throw new SdkClientException("Could not create SSL context", e);
}
} | java | private SslContext getSslContext(URI uri) {
if (!"https".equalsIgnoreCase(uri.getScheme())) {
return null;
}
try {
return SslContextBuilder.forClient().build();
} catch (SSLException e) {
throw new SdkClientException("Could not create SSL context", e);
}
} | [
"private",
"SslContext",
"getSslContext",
"(",
"URI",
"uri",
")",
"{",
"if",
"(",
"!",
"\"https\"",
".",
"equalsIgnoreCase",
"(",
"uri",
".",
"getScheme",
"(",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",
"SslContextBuilder",
"."... | Create an {@link javax.net.ssl.SSLContext} for the Netty Bootstrap.
@param uri URI of request.
@return Null if not over SSL, otherwise configured {@link javax.net.ssl.SSLContext} to use. | [
"Create",
"an",
"{",
"@link",
"javax",
".",
"net",
".",
"ssl",
".",
"SSLContext",
"}",
"for",
"the",
"Netty",
"Bootstrap",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/AmazonKinesisVideoPutMediaClient.java#L209-L218 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessor.java | ControlAnnotationProcessor.getGenerator | protected CodeGenerator getGenerator()
{
if (_generator == null)
{
//
// Locate the class that wraps the Velocity code generation process
//
AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment();
try
{
_generator = new VelocityGenerator(env);
}
catch (Exception e)
{
throw new CodeGenerationException("Unable to create code generator", e);
}
}
return _generator;
} | java | protected CodeGenerator getGenerator()
{
if (_generator == null)
{
//
// Locate the class that wraps the Velocity code generation process
//
AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment();
try
{
_generator = new VelocityGenerator(env);
}
catch (Exception e)
{
throw new CodeGenerationException("Unable to create code generator", e);
}
}
return _generator;
} | [
"protected",
"CodeGenerator",
"getGenerator",
"(",
")",
"{",
"if",
"(",
"_generator",
"==",
"null",
")",
"{",
"//",
"// Locate the class that wraps the Velocity code generation process",
"//",
"AnnotationProcessorEnvironment",
"env",
"=",
"getAnnotationProcessorEnvironment",
... | Returns the CodeGenerator instance supporting this processor, instantiating a new
generator instance if necessary. | [
"Returns",
"the",
"CodeGenerator",
"instance",
"supporting",
"this",
"processor",
"instantiating",
"a",
"new",
"generator",
"instance",
"if",
"necessary",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/ControlAnnotationProcessor.java#L143-L162 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/yaml/YamlUtil.java | YamlUtil.asType | @SuppressWarnings("unchecked")
public static <T> T asType(YamlNode node, Class<T> type) {
if (node != null && !type.isAssignableFrom(node.getClass())) {
String nodeName = node.nodeName();
throw new YamlException(String.format("Child %s is not a %s, it's actual type is %s", nodeName, type.getSimpleName(),
node.getClass().getSimpleName()));
}
return (T) node;
} | java | @SuppressWarnings("unchecked")
public static <T> T asType(YamlNode node, Class<T> type) {
if (node != null && !type.isAssignableFrom(node.getClass())) {
String nodeName = node.nodeName();
throw new YamlException(String.format("Child %s is not a %s, it's actual type is %s", nodeName, type.getSimpleName(),
node.getClass().getSimpleName()));
}
return (T) node;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"asType",
"(",
"YamlNode",
"node",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
"&&",
"!",
"type",
".",
"isAssignableFrom",
... | Takes a generic {@link YamlNode} instance and returns it casted to
the provided {@code type} if the node is an instance of that type.
@param node The generic node to cast
@return the casted node
@throws YamlException if the provided node is not the expected type | [
"Takes",
"a",
"generic",
"{",
"@link",
"YamlNode",
"}",
"instance",
"and",
"returns",
"it",
"casted",
"to",
"the",
"provided",
"{",
"@code",
"type",
"}",
"if",
"the",
"node",
"is",
"an",
"instance",
"of",
"that",
"type",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/yaml/YamlUtil.java#L94-L102 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.incrementCounter | public int incrementCounter(CmsRequestContext context, String name) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
return m_driverManager.incrementCounter(dbc, name);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_INCREMENT_COUNTER_1, name), e);
return -1; // will never be reached
} finally {
dbc.clear();
}
} | java | public int incrementCounter(CmsRequestContext context, String name) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
return m_driverManager.incrementCounter(dbc, name);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_INCREMENT_COUNTER_1, name), e);
return -1; // will never be reached
} finally {
dbc.clear();
}
} | [
"public",
"int",
"incrementCounter",
"(",
"CmsRequestContext",
"context",
",",
"String",
"name",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"try",
"{",
"return",
"m_driverMan... | Increments a counter and returns its old value.<p>
@param context the request context
@param name the name of the counter
@return the value of the counter before incrementing
@throws CmsException if something goes wrong | [
"Increments",
"a",
"counter",
"and",
"returns",
"its",
"old",
"value",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3388-L3399 |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/dcl/DCLStatement.java | DCLStatement.isDCL | public static boolean isDCL(final TokenType primaryTokenType, final TokenType secondaryTokenType) {
return STATEMENT_PREFIX.contains(primaryTokenType) || (PRIMARY_STATEMENT_PREFIX.contains(primaryTokenType) && SECONDARY_STATEMENT_PREFIX.contains(secondaryTokenType));
} | java | public static boolean isDCL(final TokenType primaryTokenType, final TokenType secondaryTokenType) {
return STATEMENT_PREFIX.contains(primaryTokenType) || (PRIMARY_STATEMENT_PREFIX.contains(primaryTokenType) && SECONDARY_STATEMENT_PREFIX.contains(secondaryTokenType));
} | [
"public",
"static",
"boolean",
"isDCL",
"(",
"final",
"TokenType",
"primaryTokenType",
",",
"final",
"TokenType",
"secondaryTokenType",
")",
"{",
"return",
"STATEMENT_PREFIX",
".",
"contains",
"(",
"primaryTokenType",
")",
"||",
"(",
"PRIMARY_STATEMENT_PREFIX",
".",
... | Is DCL statement.
@param primaryTokenType primary token type
@param secondaryTokenType secondary token type
@return is DCL or not | [
"Is",
"DCL",
"statement",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/dcl/DCLStatement.java#L56-L58 |
JodaOrg/joda-time | src/main/java/org/joda/time/LocalDate.java | LocalDate.toLocalDateTime | public LocalDateTime toLocalDateTime(LocalTime time) {
if (time == null) {
throw new IllegalArgumentException("The time must not be null");
}
if (getChronology() != time.getChronology()) {
throw new IllegalArgumentException("The chronology of the time does not match");
}
long localMillis = getLocalMillis() + time.getLocalMillis();
return new LocalDateTime(localMillis, getChronology());
} | java | public LocalDateTime toLocalDateTime(LocalTime time) {
if (time == null) {
throw new IllegalArgumentException("The time must not be null");
}
if (getChronology() != time.getChronology()) {
throw new IllegalArgumentException("The chronology of the time does not match");
}
long localMillis = getLocalMillis() + time.getLocalMillis();
return new LocalDateTime(localMillis, getChronology());
} | [
"public",
"LocalDateTime",
"toLocalDateTime",
"(",
"LocalTime",
"time",
")",
"{",
"if",
"(",
"time",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The time must not be null\"",
")",
";",
"}",
"if",
"(",
"getChronology",
"(",
")",
... | Converts this object to a LocalDateTime using a LocalTime to fill in
the missing fields.
<p>
The resulting chronology is determined by the chronology of this
LocalDate. The chronology of the time must also match.
If the time is null an exception is thrown.
<p>
This instance is immutable and unaffected by this method call.
@param time the time of day to use, must not be null
@return the LocalDateTime instance
@throws IllegalArgumentException if the time is null
@throws IllegalArgumentException if the chronology of the time does not match
@since 1.5 | [
"Converts",
"this",
"object",
"to",
"a",
"LocalDateTime",
"using",
"a",
"LocalTime",
"to",
"fill",
"in",
"the",
"missing",
"fields",
".",
"<p",
">",
"The",
"resulting",
"chronology",
"is",
"determined",
"by",
"the",
"chronology",
"of",
"this",
"LocalDate",
"... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDate.java#L887-L896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.