repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallApi | public static ApiBean unmarshallApi(Map<String, Object> source) {
if (source == null) {
return null;
}
ApiBean bean = new ApiBean();
bean.setId(asString(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setNumPublished(asInt(source.get("numPublished")));
postMarshall(bean);
return bean;
} | java | public static ApiBean unmarshallApi(Map<String, Object> source) {
if (source == null) {
return null;
}
ApiBean bean = new ApiBean();
bean.setId(asString(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setNumPublished(asInt(source.get("numPublished")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"ApiBean",
"unmarshallApi",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ApiBean",
"bean",
"=",
"new",
"ApiBean",
"(",
")",
";",
"bean... | Unmarshals the given map source into a bean.
@param source the source
@return the API | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L906-L919 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java | BufferPoolMgr.pinNew | Buffer pinNew(String fileName, PageFormatter fmtr) {
// Only the txs acquiring to append the block on the same file will be blocked
synchronized (prepareAnchor(fileName)) {
// Choose Unpinned Buffer
int lastReplacedBuff = this.lastReplacedBuff;
int currBlk = (lastReplacedBuff + 1) % bufferPool.length;
while (currBlk != lastReplacedBuff) {
Buffer buff = bufferPool[currBlk];
// Get the lock of buffer if it is free
if (buff.getExternalLock().tryLock()) {
try {
if (!buff.isPinned()) {
this.lastReplacedBuff = currBlk;
// Swap
BlockId oldBlk = buff.block();
if (oldBlk != null)
blockMap.remove(oldBlk);
buff.assignToNew(fileName, fmtr);
blockMap.put(buff.block(), buff);
if (!buff.isPinned())
numAvailable.decrementAndGet();
// Pin this buffer
buff.pin();
return buff;
}
} finally {
// Release the lock of buffer
buff.getExternalLock().unlock();
}
}
currBlk = (currBlk + 1) % bufferPool.length;
}
return null;
}
} | java | Buffer pinNew(String fileName, PageFormatter fmtr) {
// Only the txs acquiring to append the block on the same file will be blocked
synchronized (prepareAnchor(fileName)) {
// Choose Unpinned Buffer
int lastReplacedBuff = this.lastReplacedBuff;
int currBlk = (lastReplacedBuff + 1) % bufferPool.length;
while (currBlk != lastReplacedBuff) {
Buffer buff = bufferPool[currBlk];
// Get the lock of buffer if it is free
if (buff.getExternalLock().tryLock()) {
try {
if (!buff.isPinned()) {
this.lastReplacedBuff = currBlk;
// Swap
BlockId oldBlk = buff.block();
if (oldBlk != null)
blockMap.remove(oldBlk);
buff.assignToNew(fileName, fmtr);
blockMap.put(buff.block(), buff);
if (!buff.isPinned())
numAvailable.decrementAndGet();
// Pin this buffer
buff.pin();
return buff;
}
} finally {
// Release the lock of buffer
buff.getExternalLock().unlock();
}
}
currBlk = (currBlk + 1) % bufferPool.length;
}
return null;
}
} | [
"Buffer",
"pinNew",
"(",
"String",
"fileName",
",",
"PageFormatter",
"fmtr",
")",
"{",
"// Only the txs acquiring to append the block on the same file will be blocked\r",
"synchronized",
"(",
"prepareAnchor",
"(",
"fileName",
")",
")",
"{",
"// Choose Unpinned Buffer\r",
"int... | Allocates a new block in the specified file, and pins a buffer to it.
Returns null (without allocating the block) if there are no available
buffers.
@param fileName
the name of the file
@param fmtr
a pageformatter object, used to format the new block
@return the pinned buffer | [
"Allocates",
"a",
"new",
"block",
"in",
"the",
"specified",
"file",
"and",
"pins",
"a",
"buffer",
"to",
"it",
".",
"Returns",
"null",
"(",
"without",
"allocating",
"the",
"block",
")",
"if",
"there",
"are",
"no",
"available",
"buffers",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/BufferPoolMgr.java#L191-L229 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpEndpointImpl.java | HttpEndpointImpl.modified | @Modified
protected void modified(Map<String, Object> config) {
boolean endpointEnabled = MetatypeUtils.parseBoolean(HttpServiceConstants.ENPOINT_FPID_ALIAS,
HttpServiceConstants.ENABLED,
config.get(HttpServiceConstants.ENABLED),
true);
onError = (OnError) config.get(OnErrorUtil.CFG_KEY_ON_ERROR);
// Find and resolve host names.
host = ((String) config.get("host")).toLowerCase(Locale.ENGLISH);
String cfgDefaultHost = ((String) config.get(HttpServiceConstants.DEFAULT_HOSTNAME)).toLowerCase(Locale.ENGLISH);
resolvedHostName = resolveHostName(host, cfgDefaultHost);
if (resolvedHostName == null) {
if (HttpServiceConstants.WILDCARD.equals(host)) {
// On some platforms, or if the networking stack is disabled:
// getNetworkInterfaces will not be able to return a useful value.
// If the wildcard is specified (without a fully qualified value for
// the defaultHostName), we have to be able to fall back to localhost
// without throwing an error.
resolvedHostName = HttpServiceConstants.LOCALHOST;
} else {
// If the host name was configured to something other than the wildcard, and
// that host name value can not be resolved back to a NIC on this machine,
// issue an error message. The endpoint will not be started until the
// configuration is corrected (the bind would have failed, anyway..)
// Z changes to support VIPARANGE and DVIPA. yeah, me neither.
// endpointEnabled = false;
// Tr.error(tc, "unresolveableHost", host, name);
// if (onError == OnError.FAIL) {
// shutdownFramework();
// }
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "unresolved hostname right now: " + host + "setting resolvedHostName to this host for VIPA");
}
resolvedHostName = host;
}
}
//Find and resolve the protocolVersion if has been defined.
protocolVersion = (String) config.get("protocolVersion");
httpPort = MetatypeUtils.parseInteger(HttpServiceConstants.ENPOINT_FPID_ALIAS, "httpPort",
config.get("httpPort"),
-1);
httpsPort = MetatypeUtils.parseInteger(HttpServiceConstants.ENPOINT_FPID_ALIAS, "httpsPort",
config.get("httpsPort"),
-1);
String id = (String) config.get("id");
Object cid = config.get("component.id");
// Notification Topics for chain start/stop
topicString = HttpServiceConstants.TOPIC_PFX + id + "/" + cid;
if (httpPort < 0 && httpsPort < 0) {
endpointEnabled = false;
Tr.warning(tc, "missingPorts.endpointDisabled", id);
}
// Store the configuration
endpointConfig = config;
processHttpChainWork(endpointEnabled, false);
} | java | @Modified
protected void modified(Map<String, Object> config) {
boolean endpointEnabled = MetatypeUtils.parseBoolean(HttpServiceConstants.ENPOINT_FPID_ALIAS,
HttpServiceConstants.ENABLED,
config.get(HttpServiceConstants.ENABLED),
true);
onError = (OnError) config.get(OnErrorUtil.CFG_KEY_ON_ERROR);
// Find and resolve host names.
host = ((String) config.get("host")).toLowerCase(Locale.ENGLISH);
String cfgDefaultHost = ((String) config.get(HttpServiceConstants.DEFAULT_HOSTNAME)).toLowerCase(Locale.ENGLISH);
resolvedHostName = resolveHostName(host, cfgDefaultHost);
if (resolvedHostName == null) {
if (HttpServiceConstants.WILDCARD.equals(host)) {
// On some platforms, or if the networking stack is disabled:
// getNetworkInterfaces will not be able to return a useful value.
// If the wildcard is specified (without a fully qualified value for
// the defaultHostName), we have to be able to fall back to localhost
// without throwing an error.
resolvedHostName = HttpServiceConstants.LOCALHOST;
} else {
// If the host name was configured to something other than the wildcard, and
// that host name value can not be resolved back to a NIC on this machine,
// issue an error message. The endpoint will not be started until the
// configuration is corrected (the bind would have failed, anyway..)
// Z changes to support VIPARANGE and DVIPA. yeah, me neither.
// endpointEnabled = false;
// Tr.error(tc, "unresolveableHost", host, name);
// if (onError == OnError.FAIL) {
// shutdownFramework();
// }
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "unresolved hostname right now: " + host + "setting resolvedHostName to this host for VIPA");
}
resolvedHostName = host;
}
}
//Find and resolve the protocolVersion if has been defined.
protocolVersion = (String) config.get("protocolVersion");
httpPort = MetatypeUtils.parseInteger(HttpServiceConstants.ENPOINT_FPID_ALIAS, "httpPort",
config.get("httpPort"),
-1);
httpsPort = MetatypeUtils.parseInteger(HttpServiceConstants.ENPOINT_FPID_ALIAS, "httpsPort",
config.get("httpsPort"),
-1);
String id = (String) config.get("id");
Object cid = config.get("component.id");
// Notification Topics for chain start/stop
topicString = HttpServiceConstants.TOPIC_PFX + id + "/" + cid;
if (httpPort < 0 && httpsPort < 0) {
endpointEnabled = false;
Tr.warning(tc, "missingPorts.endpointDisabled", id);
}
// Store the configuration
endpointConfig = config;
processHttpChainWork(endpointEnabled, false);
} | [
"@",
"Modified",
"protected",
"void",
"modified",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"config",
")",
"{",
"boolean",
"endpointEnabled",
"=",
"MetatypeUtils",
".",
"parseBoolean",
"(",
"HttpServiceConstants",
".",
"ENPOINT_FPID_ALIAS",
",",
"HttpServiceC... | Process new configuration: call updateChains to push out
new configuration.
@param config | [
"Process",
"new",
"configuration",
":",
"call",
"updateChains",
"to",
"push",
"out",
"new",
"configuration",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpEndpointImpl.java#L270-L336 |
ironjacamar/ironjacamar | sjc/src/main/java/org/ironjacamar/sjc/SecurityActions.java | SecurityActions.setSystemProperty | static void setSystemProperty(final String name, final String value)
{
AccessController.doPrivileged(new PrivilegedAction<Object>()
{
public Object run()
{
System.setProperty(name, value);
return null;
}
});
} | java | static void setSystemProperty(final String name, final String value)
{
AccessController.doPrivileged(new PrivilegedAction<Object>()
{
public Object run()
{
System.setProperty(name, value);
return null;
}
});
} | [
"static",
"void",
"setSystemProperty",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Object",
">",
"(",
")",
"{",
"public",
"Object",
"run",
"(",
")",... | Set a system property
@param name The property name
@param value The property value | [
"Set",
"a",
"system",
"property"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/SecurityActions.java#L110-L120 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TableHeaderRendererPainter.java | TableHeaderRendererPainter.getTableHeaderInteriorPaint | public Paint getTableHeaderInteriorPaint(Shape s, CommonControlState type, boolean isSorted) {
return getCommonInteriorPaint(s, type);
// FourColors colors = getTableHeaderColors(type, isSorted);
// return createVerticalGradient(s, colors);
} | java | public Paint getTableHeaderInteriorPaint(Shape s, CommonControlState type, boolean isSorted) {
return getCommonInteriorPaint(s, type);
// FourColors colors = getTableHeaderColors(type, isSorted);
// return createVerticalGradient(s, colors);
} | [
"public",
"Paint",
"getTableHeaderInteriorPaint",
"(",
"Shape",
"s",
",",
"CommonControlState",
"type",
",",
"boolean",
"isSorted",
")",
"{",
"return",
"getCommonInteriorPaint",
"(",
"s",
",",
"type",
")",
";",
"// FourColors colors = getTableHeaderColors(type, isS... | DOCUMENT ME!
@param s DOCUMENT ME!
@param type DOCUMENT ME!
@param isSorted DOCUMENT ME!
@return DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TableHeaderRendererPainter.java#L159-L163 |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/ImportSet.java | ImportSet.addMunged | public void addMunged (Class<?> clazz, String... replace)
{
String name = clazz.getName();
for (int ii = 0; ii < replace.length; ii += 2) {
name = name.replace(replace[ii], replace[ii+1]);
}
_imports.add(name);
} | java | public void addMunged (Class<?> clazz, String... replace)
{
String name = clazz.getName();
for (int ii = 0; ii < replace.length; ii += 2) {
name = name.replace(replace[ii], replace[ii+1]);
}
_imports.add(name);
} | [
"public",
"void",
"addMunged",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"...",
"replace",
")",
"{",
"String",
"name",
"=",
"clazz",
".",
"getName",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"replace",
".",
"len... | Adds a class' name to the imports but first performs the given list of search/replaces as
described above.
@param clazz the class whose name is munged and added
@param replace array of pairs to search/replace on the name before adding | [
"Adds",
"a",
"class",
"name",
"to",
"the",
"imports",
"but",
"first",
"performs",
"the",
"given",
"list",
"of",
"search",
"/",
"replaces",
"as",
"described",
"above",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/ImportSet.java#L91-L98 |
google/truth | core/src/main/java/com/google/common/truth/MathUtil.java | MathUtil.notEqualWithinTolerance | public static boolean notEqualWithinTolerance(double left, double right, double tolerance) {
if (Doubles.isFinite(left) && Doubles.isFinite(right)) {
return Math.abs(left - right) > Math.abs(tolerance);
} else {
return false;
}
} | java | public static boolean notEqualWithinTolerance(double left, double right, double tolerance) {
if (Doubles.isFinite(left) && Doubles.isFinite(right)) {
return Math.abs(left - right) > Math.abs(tolerance);
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"notEqualWithinTolerance",
"(",
"double",
"left",
",",
"double",
"right",
",",
"double",
"tolerance",
")",
"{",
"if",
"(",
"Doubles",
".",
"isFinite",
"(",
"left",
")",
"&&",
"Doubles",
".",
"isFinite",
"(",
"right",
")",
")"... | Returns true iff {@code left} and {@code right} are finite values not within {@code tolerance}
of each other. Note that both this method and {@link #equalWithinTolerance} returns false if
either {@code left} or {@code right} is infinite or NaN. | [
"Returns",
"true",
"iff",
"{"
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/MathUtil.java#L48-L54 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java | FastHashMap.putAll | public void putAll(Map<? extends K, ? extends V> map) {
for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) {
addEntry(e.getKey(), e.getValue());
}
} | java | public void putAll(Map<? extends K, ? extends V> map) {
for (Map.Entry<? extends K, ? extends V> e : map.entrySet()) {
addEntry(e.getKey(), e.getValue());
}
} | [
"public",
"void",
"putAll",
"(",
"Map",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"map",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"e",
":",
"map",
".",
"entrySet",
"(",
... | Copies all of the mappings from the specified map to this {@link FastMap}.
@param map the mappings to be stored in this map.
@throws NullPointerException the specified map is <code>null</code>, or
the specified map contains <code>null</code> keys. | [
"Copies",
"all",
"of",
"the",
"mappings",
"from",
"the",
"specified",
"map",
"to",
"this",
"{",
"@link",
"FastMap",
"}",
"."
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java#L243-L247 |
kyoken74/gwt-angular-site | gwt-angular-examples/Promise/src/main/java/com/asayama/gwt/angular/site/examples/client/service/GreetingService.java | GreetingService.getSalutation | public Promise<String> getSalutation() {
final Deferred<String> d = q.defer();
Timer timer = new Timer() {
@Override
public void run() {
d.progress(new TimerProgress("Loaded salutation", this));
d.resolve("Hello");
}
};
d.progress(new TimerProgress("Loading salutation...", timer));
timer.schedule(1000);
return d.promise();
} | java | public Promise<String> getSalutation() {
final Deferred<String> d = q.defer();
Timer timer = new Timer() {
@Override
public void run() {
d.progress(new TimerProgress("Loaded salutation", this));
d.resolve("Hello");
}
};
d.progress(new TimerProgress("Loading salutation...", timer));
timer.schedule(1000);
return d.promise();
} | [
"public",
"Promise",
"<",
"String",
">",
"getSalutation",
"(",
")",
"{",
"final",
"Deferred",
"<",
"String",
">",
"d",
"=",
"q",
".",
"defer",
"(",
")",
";",
"Timer",
"timer",
"=",
"new",
"Timer",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"... | Returns a promise of salutation by simulating an asynchronous call with a time-out. | [
"Returns",
"a",
"promise",
"of",
"salutation",
"by",
"simulating",
"an",
"asynchronous",
"call",
"with",
"a",
"time",
"-",
"out",
"."
] | train | https://github.com/kyoken74/gwt-angular-site/blob/12134f4910abe41145d0020e886620605eb03749/gwt-angular-examples/Promise/src/main/java/com/asayama/gwt/angular/site/examples/client/service/GreetingService.java#L34-L47 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/geom/GeoPackageGeometryData.java | GeoPackageGeometryData.readEnvelope | private GeometryEnvelope readEnvelope(int envelopeIndicator,
ByteReader reader) {
GeometryEnvelope envelope = null;
if (envelopeIndicator > 0) {
// Read x and y values and create envelope
double minX = reader.readDouble();
double maxX = reader.readDouble();
double minY = reader.readDouble();
double maxY = reader.readDouble();
boolean hasZ = false;
Double minZ = null;
Double maxZ = null;
boolean hasM = false;
Double minM = null;
Double maxM = null;
// Read z values
if (envelopeIndicator == 2 || envelopeIndicator == 4) {
hasZ = true;
minZ = reader.readDouble();
maxZ = reader.readDouble();
}
// Read m values
if (envelopeIndicator == 3 || envelopeIndicator == 4) {
hasM = true;
minM = reader.readDouble();
maxM = reader.readDouble();
}
envelope = new GeometryEnvelope(hasZ, hasM);
envelope.setMinX(minX);
envelope.setMaxX(maxX);
envelope.setMinY(minY);
envelope.setMaxY(maxY);
if (hasZ) {
envelope.setMinZ(minZ);
envelope.setMaxZ(maxZ);
}
if (hasM) {
envelope.setMinM(minM);
envelope.setMaxM(maxM);
}
}
return envelope;
} | java | private GeometryEnvelope readEnvelope(int envelopeIndicator,
ByteReader reader) {
GeometryEnvelope envelope = null;
if (envelopeIndicator > 0) {
// Read x and y values and create envelope
double minX = reader.readDouble();
double maxX = reader.readDouble();
double minY = reader.readDouble();
double maxY = reader.readDouble();
boolean hasZ = false;
Double minZ = null;
Double maxZ = null;
boolean hasM = false;
Double minM = null;
Double maxM = null;
// Read z values
if (envelopeIndicator == 2 || envelopeIndicator == 4) {
hasZ = true;
minZ = reader.readDouble();
maxZ = reader.readDouble();
}
// Read m values
if (envelopeIndicator == 3 || envelopeIndicator == 4) {
hasM = true;
minM = reader.readDouble();
maxM = reader.readDouble();
}
envelope = new GeometryEnvelope(hasZ, hasM);
envelope.setMinX(minX);
envelope.setMaxX(maxX);
envelope.setMinY(minY);
envelope.setMaxY(maxY);
if (hasZ) {
envelope.setMinZ(minZ);
envelope.setMaxZ(maxZ);
}
if (hasM) {
envelope.setMinM(minM);
envelope.setMaxM(maxM);
}
}
return envelope;
} | [
"private",
"GeometryEnvelope",
"readEnvelope",
"(",
"int",
"envelopeIndicator",
",",
"ByteReader",
"reader",
")",
"{",
"GeometryEnvelope",
"envelope",
"=",
"null",
";",
"if",
"(",
"envelopeIndicator",
">",
"0",
")",
"{",
"// Read x and y values and create envelope",
"... | Read the envelope based upon the indicator value
@param envelopeIndicator
envelope indicator
@param reader
byte reader
@return geometry envelope | [
"Read",
"the",
"envelope",
"based",
"upon",
"the",
"indicator",
"value"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/geom/GeoPackageGeometryData.java#L279-L333 |
Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/util/ManifestUtil.java | ManifestUtil.getConectorName | public static String getConectorName(String pathManifest) throws InitializationException {
String connectionName = "";
try {
Document document = getDocument(pathManifest);
Object result = getResult(document, "//ConnectorName/text()");
connectionName = ((NodeList) result).item(0).getNodeValue();
} catch (SAXException | XPathExpressionException | IOException | ParserConfigurationException e) {
String msg = "Impossible to read DataStoreName in Manifest with the connector configuration."
+ e.getCause();
LOGGER.error(msg);
throw new InitializationException(msg, e);
}
return connectionName;
} | java | public static String getConectorName(String pathManifest) throws InitializationException {
String connectionName = "";
try {
Document document = getDocument(pathManifest);
Object result = getResult(document, "//ConnectorName/text()");
connectionName = ((NodeList) result).item(0).getNodeValue();
} catch (SAXException | XPathExpressionException | IOException | ParserConfigurationException e) {
String msg = "Impossible to read DataStoreName in Manifest with the connector configuration."
+ e.getCause();
LOGGER.error(msg);
throw new InitializationException(msg, e);
}
return connectionName;
} | [
"public",
"static",
"String",
"getConectorName",
"(",
"String",
"pathManifest",
")",
"throws",
"InitializationException",
"{",
"String",
"connectionName",
"=",
"\"\"",
";",
"try",
"{",
"Document",
"document",
"=",
"getDocument",
"(",
"pathManifest",
")",
";",
"Obj... | Recovered the ConecrtorName form Manifest.
@param pathManifest the manifest path.
@return the ConectionName.
@throws InitializationException if an error happens while XML is reading. | [
"Recovered",
"the",
"ConecrtorName",
"form",
"Manifest",
"."
] | train | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/util/ManifestUtil.java#L86-L103 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java | JDBC4CallableStatement.getTime | @Override
public Time getTime(String parameterName, Calendar cal) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public Time getTime(String parameterName, Calendar cal) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"Time",
"getTime",
"(",
"String",
"parameterName",
",",
"Calendar",
"cal",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
")",
";",
"}"
] | Retrieves the value of a JDBC TIME parameter as a java.sql.Time object, using the given Calendar object to construct the time. | [
"Retrieves",
"the",
"value",
"of",
"a",
"JDBC",
"TIME",
"parameter",
"as",
"a",
"java",
".",
"sql",
".",
"Time",
"object",
"using",
"the",
"given",
"Calendar",
"object",
"to",
"construct",
"the",
"time",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L463-L468 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java | MetaClassRegistryImpl.setMetaClass | private void setMetaClass(Class theClass, MetaClass oldMc, MetaClass newMc) {
final ClassInfo info = ClassInfo.getClassInfo(theClass);
MetaClass mc = null;
info.lock();
try {
mc = info.getStrongMetaClass();
info.setStrongMetaClass(newMc);
} finally {
info.unlock();
}
if ((oldMc == null && mc != newMc) || (oldMc != null && mc != newMc && mc != oldMc)) {
fireConstantMetaClassUpdate(null, theClass, mc, newMc);
}
} | java | private void setMetaClass(Class theClass, MetaClass oldMc, MetaClass newMc) {
final ClassInfo info = ClassInfo.getClassInfo(theClass);
MetaClass mc = null;
info.lock();
try {
mc = info.getStrongMetaClass();
info.setStrongMetaClass(newMc);
} finally {
info.unlock();
}
if ((oldMc == null && mc != newMc) || (oldMc != null && mc != newMc && mc != oldMc)) {
fireConstantMetaClassUpdate(null, theClass, mc, newMc);
}
} | [
"private",
"void",
"setMetaClass",
"(",
"Class",
"theClass",
",",
"MetaClass",
"oldMc",
",",
"MetaClass",
"newMc",
")",
"{",
"final",
"ClassInfo",
"info",
"=",
"ClassInfo",
".",
"getClassInfo",
"(",
"theClass",
")",
";",
"MetaClass",
"mc",
"=",
"null",
";",
... | if oldMc is null, newMc will replace whatever meta class was used before.
if oldMc is not null, then newMc will be used only if he stored mc is
the same as oldMc | [
"if",
"oldMc",
"is",
"null",
"newMc",
"will",
"replace",
"whatever",
"meta",
"class",
"was",
"used",
"before",
".",
"if",
"oldMc",
"is",
"not",
"null",
"then",
"newMc",
"will",
"be",
"used",
"only",
"if",
"he",
"stored",
"mc",
"is",
"the",
"same",
"as"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java#L283-L297 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/WriteExcelUtils.java | WriteExcelUtils.writeWorkBook | public static <T> Workbook writeWorkBook(Workbook workbook, List<T> beans) {
return WriteExcelUtils.writeWorkBook(workbook, beans, null);
} | java | public static <T> Workbook writeWorkBook(Workbook workbook, List<T> beans) {
return WriteExcelUtils.writeWorkBook(workbook, beans, null);
} | [
"public",
"static",
"<",
"T",
">",
"Workbook",
"writeWorkBook",
"(",
"Workbook",
"workbook",
",",
"List",
"<",
"T",
">",
"beans",
")",
"{",
"return",
"WriteExcelUtils",
".",
"writeWorkBook",
"(",
"workbook",
",",
"beans",
",",
"null",
")",
";",
"}"
] | 将Beans写入WorkBook中,默认以bean中的所有属性作为标题且写入第0行,0-based
@param workbook 指定工作簿
@param beans 指定写入的Beans(或者泛型为Map)
@return 返回传入的WorkBook | [
"将Beans写入WorkBook中",
"默认以bean中的所有属性作为标题且写入第0行,0",
"-",
"based"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/WriteExcelUtils.java#L353-L355 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/RandomCompat.java | RandomCompat.ints | @NotNull
public IntStream ints(long streamSize, final int randomNumberOrigin, final int randomNumberBound) {
if (streamSize < 0L) throw new IllegalArgumentException();
if (streamSize == 0L) {
return IntStream.empty();
}
return ints(randomNumberOrigin, randomNumberBound).limit(streamSize);
} | java | @NotNull
public IntStream ints(long streamSize, final int randomNumberOrigin, final int randomNumberBound) {
if (streamSize < 0L) throw new IllegalArgumentException();
if (streamSize == 0L) {
return IntStream.empty();
}
return ints(randomNumberOrigin, randomNumberBound).limit(streamSize);
} | [
"@",
"NotNull",
"public",
"IntStream",
"ints",
"(",
"long",
"streamSize",
",",
"final",
"int",
"randomNumberOrigin",
",",
"final",
"int",
"randomNumberBound",
")",
"{",
"if",
"(",
"streamSize",
"<",
"0L",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"... | Returns a stream producing the given {@code streamSize} number
of pseudorandom {@code int} values, each conforming to the given
origin (inclusive) and bound (exclusive).
@param streamSize the number of values to generate
@param randomNumberOrigin the origin (inclusive) of each random value
@param randomNumberBound the bound (exclusive) if each random value
@return a stream of pseudorandom {@code int} values,
each with the given origin (inclusive) and bound (exclusive)
@throws IllegalArgumentException if {@code streamSize} is
less than zero, or {@code randomNumberOrigin} is
greater than or equal to {@code randomNumberBound} | [
"Returns",
"a",
"stream",
"producing",
"the",
"given",
"{",
"@code",
"streamSize",
"}",
"number",
"of",
"pseudorandom",
"{",
"@code",
"int",
"}",
"values",
"each",
"conforming",
"to",
"the",
"given",
"origin",
"(",
"inclusive",
")",
"and",
"bound",
"(",
"e... | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/RandomCompat.java#L190-L197 |
Harium/keel | src/main/java/com/harium/keel/catalano/core/DoublePoint.java | DoublePoint.Subtract | public DoublePoint Subtract(DoublePoint point1, DoublePoint point2) {
DoublePoint result = new DoublePoint(point1);
result.Subtract(point2);
return result;
} | java | public DoublePoint Subtract(DoublePoint point1, DoublePoint point2) {
DoublePoint result = new DoublePoint(point1);
result.Subtract(point2);
return result;
} | [
"public",
"DoublePoint",
"Subtract",
"(",
"DoublePoint",
"point1",
",",
"DoublePoint",
"point2",
")",
"{",
"DoublePoint",
"result",
"=",
"new",
"DoublePoint",
"(",
"point1",
")",
";",
"result",
".",
"Subtract",
"(",
"point2",
")",
";",
"return",
"result",
";... | Subtract values of two points.
@param point1 DoublePoint.
@param point2 DoublePoint.
@return A new DoublePoint with the subtraction operation. | [
"Subtract",
"values",
"of",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/DoublePoint.java#L172-L176 |
EdwardRaff/JSAT | JSAT/src/jsat/parameters/Parameter.java | Parameter.toParameterMap | public static Map<String, Parameter> toParameterMap(List<Parameter> params)
{
Map<String, Parameter> map = new HashMap<String, Parameter>(params.size());
for(Parameter param : params)
{
if(map.put(param.getASCIIName(), param) != null)
throw new RuntimeException("Name collision, two parameters use the name '" + param.getASCIIName() + "'");
if(!param.getName().equals(param.getASCIIName()))//Dont put it in again
if(map.put(param.getName(), param) != null)
throw new RuntimeException("Name collision, two parameters use the name '" + param.getName() + "'");
}
return map;
} | java | public static Map<String, Parameter> toParameterMap(List<Parameter> params)
{
Map<String, Parameter> map = new HashMap<String, Parameter>(params.size());
for(Parameter param : params)
{
if(map.put(param.getASCIIName(), param) != null)
throw new RuntimeException("Name collision, two parameters use the name '" + param.getASCIIName() + "'");
if(!param.getName().equals(param.getASCIIName()))//Dont put it in again
if(map.put(param.getName(), param) != null)
throw new RuntimeException("Name collision, two parameters use the name '" + param.getName() + "'");
}
return map;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Parameter",
">",
"toParameterMap",
"(",
"List",
"<",
"Parameter",
">",
"params",
")",
"{",
"Map",
"<",
"String",
",",
"Parameter",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Parameter",
">",
... | Creates a map of all possible parameter names to their corresponding object. No two parameters may have the same name.
@param params the list of parameters to create a map for
@return a map of string names to their parameters
@throws RuntimeException if two parameters have the same name | [
"Creates",
"a",
"map",
"of",
"all",
"possible",
"parameter",
"names",
"to",
"their",
"corresponding",
"object",
".",
"No",
"two",
"parameters",
"may",
"have",
"the",
"same",
"name",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/parameters/Parameter.java#L172-L184 |
authlete/authlete-java-common | src/main/java/com/authlete/common/dto/TokenRequest.java | TokenRequest.setParameters | public TokenRequest setParameters(Map<String, String[]> parameters)
{
return setParameters(URLCoder.formUrlEncode(parameters));
} | java | public TokenRequest setParameters(Map<String, String[]> parameters)
{
return setParameters(URLCoder.formUrlEncode(parameters));
} | [
"public",
"TokenRequest",
"setParameters",
"(",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"parameters",
")",
"{",
"return",
"setParameters",
"(",
"URLCoder",
".",
"formUrlEncode",
"(",
"parameters",
")",
")",
";",
"}"
] | Set the value of {@code parameters} which are the request
parameters that the OAuth 2.0 token endpoint of the service
implementation received from the client application.
<p>
This method converts the given map into a string in {@code
x-www-form-urlencoded} and passes it to {@link
#setParameters(String)} method.
</p>
@param parameters
Request parameters.
@return
{@code this} object.
@since 1.24 | [
"Set",
"the",
"value",
"of",
"{",
"@code",
"parameters",
"}",
"which",
"are",
"the",
"request",
"parameters",
"that",
"the",
"OAuth",
"2",
".",
"0",
"token",
"endpoint",
"of",
"the",
"service",
"implementation",
"received",
"from",
"the",
"client",
"applicat... | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/dto/TokenRequest.java#L192-L195 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.validateRegexpOf | protected static ValidationBuilder validateRegexpOf(String attributeName, String pattern) {
return ModelDelegate.validateRegexpOf(modelClass(), attributeName, pattern);
} | java | protected static ValidationBuilder validateRegexpOf(String attributeName, String pattern) {
return ModelDelegate.validateRegexpOf(modelClass(), attributeName, pattern);
} | [
"protected",
"static",
"ValidationBuilder",
"validateRegexpOf",
"(",
"String",
"attributeName",
",",
"String",
"pattern",
")",
"{",
"return",
"ModelDelegate",
".",
"validateRegexpOf",
"(",
"modelClass",
"(",
")",
",",
"attributeName",
",",
"pattern",
")",
";",
"}"... | Validates an attribite format with a ree hand regular expression.
@param attributeName attribute to validate.
@param pattern regexp pattern which must match the value. | [
"Validates",
"an",
"attribite",
"format",
"with",
"a",
"ree",
"hand",
"regular",
"expression",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L2007-L2009 |
livetribe/livetribe-slp | osgi/bundle/src/main/java/org/livetribe/slp/osgi/ByServicePropertiesServiceTracker.java | ByServicePropertiesServiceTracker.removedService | @Override
public void removedService(ServiceReference reference, Object service)
{
LOGGER.entering(CLASS_NAME, "removedService", new Object[]{reference, service});
context.ungetService(reference);
ServiceInfo serviceInfo = (ServiceInfo)service;
serviceAgent.deregister(serviceInfo.getServiceURL(), serviceInfo.getLanguage());
LOGGER.exiting(CLASS_NAME, "removedService");
} | java | @Override
public void removedService(ServiceReference reference, Object service)
{
LOGGER.entering(CLASS_NAME, "removedService", new Object[]{reference, service});
context.ungetService(reference);
ServiceInfo serviceInfo = (ServiceInfo)service;
serviceAgent.deregister(serviceInfo.getServiceURL(), serviceInfo.getLanguage());
LOGGER.exiting(CLASS_NAME, "removedService");
} | [
"@",
"Override",
"public",
"void",
"removedService",
"(",
"ServiceReference",
"reference",
",",
"Object",
"service",
")",
"{",
"LOGGER",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"removedService\"",
",",
"new",
"Object",
"[",
"]",
"{",
"reference",
",",
"serv... | Deregister the instance of {@link ServiceInfo} from the {@link ServiceAgent},
effectively unregistering the SLP service URL.
@param reference The reference to the OSGi service that implicitly registered the SLP service URL.
@param service The instance of {@link ServiceInfo} to deregister.
@see org.osgi.util.tracker.ServiceTracker#removedService(ServiceReference, Object)
@see org.livetribe.slp.sa.ServiceAgent#deregister(org.livetribe.slp.ServiceURL, String) | [
"Deregister",
"the",
"instance",
"of",
"{",
"@link",
"ServiceInfo",
"}",
"from",
"the",
"{",
"@link",
"ServiceAgent",
"}",
"effectively",
"unregistering",
"the",
"SLP",
"service",
"URL",
"."
] | train | https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/osgi/bundle/src/main/java/org/livetribe/slp/osgi/ByServicePropertiesServiceTracker.java#L204-L216 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java | Widget.addChild | protected boolean addChild(Widget child, int index, boolean preventLayout) {
return addChild(child, child.getSceneObject(), index, preventLayout);
} | java | protected boolean addChild(Widget child, int index, boolean preventLayout) {
return addChild(child, child.getSceneObject(), index, preventLayout);
} | [
"protected",
"boolean",
"addChild",
"(",
"Widget",
"child",
",",
"int",
"index",
",",
"boolean",
"preventLayout",
")",
"{",
"return",
"addChild",
"(",
"child",
",",
"child",
".",
"getSceneObject",
"(",
")",
",",
"index",
",",
"preventLayout",
")",
";",
"}"... | Add another {@link Widget} as a child of this one. Overload to intercept all child adds.
@param child
The {@code Widget} to add as a child.
@param index
Position at which to add the child. Pass -1 to add at end.
@param preventLayout
The {@code Widget} whether to call layout().
@return {@code True} if {@code child} was added; {@code false} if
{@code child} was previously added to this instance. | [
"Add",
"another",
"{",
"@link",
"Widget",
"}",
"as",
"a",
"child",
"of",
"this",
"one",
".",
"Overload",
"to",
"intercept",
"all",
"child",
"adds",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L2919-L2921 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.handleResponseError | private void handleResponseError(String method, URI uri, Response response)
{
if(throwExceptions
&& response.getStatus() != 200
&& response.getStatus() != 201
&& response.getStatus() != 204)
{
ErrorResponse error = null;
if(response.hasEntity())
error = response.readEntity(ERROR);
throw new ErrorResponseException(method, response.getStatus(),
response.getStatusInfo().getReasonPhrase(), error);
}
} | java | private void handleResponseError(String method, URI uri, Response response)
{
if(throwExceptions
&& response.getStatus() != 200
&& response.getStatus() != 201
&& response.getStatus() != 204)
{
ErrorResponse error = null;
if(response.hasEntity())
error = response.readEntity(ERROR);
throw new ErrorResponseException(method, response.getStatus(),
response.getStatusInfo().getReasonPhrase(), error);
}
} | [
"private",
"void",
"handleResponseError",
"(",
"String",
"method",
",",
"URI",
"uri",
",",
"Response",
"response",
")",
"{",
"if",
"(",
"throwExceptions",
"&&",
"response",
".",
"getStatus",
"(",
")",
"!=",
"200",
"&&",
"response",
".",
"getStatus",
"(",
"... | Handle HTTP error responses if {@link #throwExceptions() throwExceptions} returns <CODE>true</CODE>.
@param method The HTTP method type
@param uri The URI used for the HTTP call
@param response The HTTP call response | [
"Handle",
"HTTP",
"error",
"responses",
"if",
"{"
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L622-L635 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/cellprocessor/constraint/Strlen.java | Strlen.execute | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
final String stringValue = value.toString();
final int length = stringValue.length();
if( !requiredLengths.contains(length) ) {
throw new SuperCsvConstraintViolationException(String.format("the length (%d) of value '%s' not any of the required lengths",
length, stringValue), context, this);
}
return next.execute(value, context);
} | java | public Object execute(final Object value, final CsvContext context) {
validateInputNotNull(value, context);
final String stringValue = value.toString();
final int length = stringValue.length();
if( !requiredLengths.contains(length) ) {
throw new SuperCsvConstraintViolationException(String.format("the length (%d) of value '%s' not any of the required lengths",
length, stringValue), context, this);
}
return next.execute(value, context);
} | [
"public",
"Object",
"execute",
"(",
"final",
"Object",
"value",
",",
"final",
"CsvContext",
"context",
")",
"{",
"validateInputNotNull",
"(",
"value",
",",
"context",
")",
";",
"final",
"String",
"stringValue",
"=",
"value",
".",
"toString",
"(",
")",
";",
... | {@inheritDoc}
@throws SuperCsvCellProcessorException
if value is null
@throws SuperCsvConstraintViolationException
if the length of value isn't one of the required lengths | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/Strlen.java#L137-L148 |
JOML-CI/JOML | src/org/joml/Matrix3f.java | Matrix3f.scaling | public Matrix3f scaling(float x, float y, float z) {
MemUtil.INSTANCE.zero(this);
m00 = x;
m11 = y;
m22 = z;
return this;
} | java | public Matrix3f scaling(float x, float y, float z) {
MemUtil.INSTANCE.zero(this);
m00 = x;
m11 = y;
m22 = z;
return this;
} | [
"public",
"Matrix3f",
"scaling",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"zero",
"(",
"this",
")",
";",
"m00",
"=",
"x",
";",
"m11",
"=",
"y",
";",
"m22",
"=",
"z",
";",
"return",
"thi... | Set this matrix to be a simple scale matrix.
@param x
the scale in x
@param y
the scale in y
@param z
the scale in z
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"simple",
"scale",
"matrix",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L1325-L1331 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/NGAExtensions.java | NGAExtensions.deleteTileScaling | public static void deleteTileScaling(GeoPackageCore geoPackage, String table) {
TileScalingDao tileScalingDao = geoPackage.getTileScalingDao();
ExtensionsDao extensionsDao = geoPackage.getExtensionsDao();
try {
if (tileScalingDao.isTableExists()) {
tileScalingDao.deleteById(table);
}
if (extensionsDao.isTableExists()) {
extensionsDao.deleteByExtension(
TileTableScaling.EXTENSION_NAME, table);
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to delete Tile Scaling. GeoPackage: "
+ geoPackage.getName() + ", Table: " + table, e);
}
} | java | public static void deleteTileScaling(GeoPackageCore geoPackage, String table) {
TileScalingDao tileScalingDao = geoPackage.getTileScalingDao();
ExtensionsDao extensionsDao = geoPackage.getExtensionsDao();
try {
if (tileScalingDao.isTableExists()) {
tileScalingDao.deleteById(table);
}
if (extensionsDao.isTableExists()) {
extensionsDao.deleteByExtension(
TileTableScaling.EXTENSION_NAME, table);
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to delete Tile Scaling. GeoPackage: "
+ geoPackage.getName() + ", Table: " + table, e);
}
} | [
"public",
"static",
"void",
"deleteTileScaling",
"(",
"GeoPackageCore",
"geoPackage",
",",
"String",
"table",
")",
"{",
"TileScalingDao",
"tileScalingDao",
"=",
"geoPackage",
".",
"getTileScalingDao",
"(",
")",
";",
"ExtensionsDao",
"extensionsDao",
"=",
"geoPackage",... | Delete the Tile Scaling extensions for the table
@param geoPackage
GeoPackage
@param table
table name
@since 2.0.2 | [
"Delete",
"the",
"Tile",
"Scaling",
"extensions",
"for",
"the",
"table"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/NGAExtensions.java#L195-L213 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java | DirectoryHelper.renameFile | public static void renameFile(File srcFile, File dstFile) throws IOException
{
// Rename the srcFile file to the new one. Unfortunately, the renameTo()
// method does not work reliably under some JVMs. Therefore, if the
// rename fails, we manually rename by copying the srcFile file to the new one
if (!srcFile.renameTo(dstFile))
{
InputStream in = null;
OutputStream out = null;
try
{
in = new FileInputStream(srcFile);
out = new FileOutputStream(dstFile);
transfer(in, out);
}
catch (IOException ioe)
{
IOException newExc = new IOException("Cannot rename " + srcFile + " to " + dstFile);
newExc.initCause(ioe);
throw newExc;
}
finally
{
if (in != null)
{
in.close();
}
if (out != null)
{
out.close();
}
}
// delete the srcFile file.
srcFile.delete();
}
} | java | public static void renameFile(File srcFile, File dstFile) throws IOException
{
// Rename the srcFile file to the new one. Unfortunately, the renameTo()
// method does not work reliably under some JVMs. Therefore, if the
// rename fails, we manually rename by copying the srcFile file to the new one
if (!srcFile.renameTo(dstFile))
{
InputStream in = null;
OutputStream out = null;
try
{
in = new FileInputStream(srcFile);
out = new FileOutputStream(dstFile);
transfer(in, out);
}
catch (IOException ioe)
{
IOException newExc = new IOException("Cannot rename " + srcFile + " to " + dstFile);
newExc.initCause(ioe);
throw newExc;
}
finally
{
if (in != null)
{
in.close();
}
if (out != null)
{
out.close();
}
}
// delete the srcFile file.
srcFile.delete();
}
} | [
"public",
"static",
"void",
"renameFile",
"(",
"File",
"srcFile",
",",
"File",
"dstFile",
")",
"throws",
"IOException",
"{",
"// Rename the srcFile file to the new one. Unfortunately, the renameTo()\r",
"// method does not work reliably under some JVMs. Therefore, if the\r",
"// ren... | Rename file. If file can't be renamed in standard way the coping
data will be used instead.
@param srcFile
source file
@param dstFile
destination file
@throws IOException
if any exception occurred | [
"Rename",
"file",
".",
"If",
"file",
"can",
"t",
"be",
"renamed",
"in",
"standard",
"way",
"the",
"coping",
"data",
"will",
"be",
"used",
"instead",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java#L408-L446 |
Netflix/zeno | src/main/java/com/netflix/zeno/diff/history/DiffHistoryTracker.java | DiffHistoryTracker.addState | public void addState() {
DiffHistoryDataState nextState = new DiffHistoryDataState(stateEngine, typeDiffInstructions);
if(currentDataState != null)
newHistoricalState(currentDataState, nextState);
currentDataState = nextState;
} | java | public void addState() {
DiffHistoryDataState nextState = new DiffHistoryDataState(stateEngine, typeDiffInstructions);
if(currentDataState != null)
newHistoricalState(currentDataState, nextState);
currentDataState = nextState;
} | [
"public",
"void",
"addState",
"(",
")",
"{",
"DiffHistoryDataState",
"nextState",
"=",
"new",
"DiffHistoryDataState",
"(",
"stateEngine",
",",
"typeDiffInstructions",
")",
";",
"if",
"(",
"currentDataState",
"!=",
"null",
")",
"newHistoricalState",
"(",
"currentData... | Call this method after new data has been loaded by the FastBlobStateEngine. This will add a historical record
of the differences between the previous state and this new state. | [
"Call",
"this",
"method",
"after",
"new",
"data",
"has",
"been",
"loaded",
"by",
"the",
"FastBlobStateEngine",
".",
"This",
"will",
"add",
"a",
"historical",
"record",
"of",
"the",
"differences",
"between",
"the",
"previous",
"state",
"and",
"this",
"new",
"... | train | https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/diff/history/DiffHistoryTracker.java#L76-L83 |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java | MyStringUtils.regexFindFirst | public static String regexFindFirst(String pattern, String str) {
return regexFindFirst(Pattern.compile(pattern), str, 1);
} | java | public static String regexFindFirst(String pattern, String str) {
return regexFindFirst(Pattern.compile(pattern), str, 1);
} | [
"public",
"static",
"String",
"regexFindFirst",
"(",
"String",
"pattern",
",",
"String",
"str",
")",
"{",
"return",
"regexFindFirst",
"(",
"Pattern",
".",
"compile",
"(",
"pattern",
")",
",",
"str",
",",
"1",
")",
";",
"}"
] | Gets the first group of a regex
@param pattern Pattern
@param str String to find
@return the matching group | [
"Gets",
"the",
"first",
"group",
"of",
"a",
"regex"
] | train | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L490-L492 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/cache/disc/impl/BaseDiskCache.java | BaseDiskCache.getFile | protected File getFile(String imageUri) {
String fileName = fileNameGenerator.generate(imageUri);
File dir = cacheDir;
if (!cacheDir.exists() && !cacheDir.mkdirs()) {
if (reserveCacheDir != null && (reserveCacheDir.exists() || reserveCacheDir.mkdirs())) {
dir = reserveCacheDir;
}
}
return new File(dir, fileName);
} | java | protected File getFile(String imageUri) {
String fileName = fileNameGenerator.generate(imageUri);
File dir = cacheDir;
if (!cacheDir.exists() && !cacheDir.mkdirs()) {
if (reserveCacheDir != null && (reserveCacheDir.exists() || reserveCacheDir.mkdirs())) {
dir = reserveCacheDir;
}
}
return new File(dir, fileName);
} | [
"protected",
"File",
"getFile",
"(",
"String",
"imageUri",
")",
"{",
"String",
"fileName",
"=",
"fileNameGenerator",
".",
"generate",
"(",
"imageUri",
")",
";",
"File",
"dir",
"=",
"cacheDir",
";",
"if",
"(",
"!",
"cacheDir",
".",
"exists",
"(",
")",
"&&... | Returns file object (not null) for incoming image URI. File object can reference to non-existing file. | [
"Returns",
"file",
"object",
"(",
"not",
"null",
")",
"for",
"incoming",
"image",
"URI",
".",
"File",
"object",
"can",
"reference",
"to",
"non",
"-",
"existing",
"file",
"."
] | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/cache/disc/impl/BaseDiskCache.java#L166-L175 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsTouch.java | CmsTouch.hardTouch | private static void hardTouch(CmsObject cms, CmsResource resource) throws CmsException {
CmsFile file = cms.readFile(resource);
file.setContents(file.getContents());
cms.writeFile(file);
} | java | private static void hardTouch(CmsObject cms, CmsResource resource) throws CmsException {
CmsFile file = cms.readFile(resource);
file.setContents(file.getContents());
cms.writeFile(file);
} | [
"private",
"static",
"void",
"hardTouch",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"CmsFile",
"file",
"=",
"cms",
".",
"readFile",
"(",
"resource",
")",
";",
"file",
".",
"setContents",
"(",
"file",
".",
... | Rewrites the content of the given file.<p>
@param resource the resource to rewrite the content for
@throws CmsException if something goes wrong | [
"Rewrites",
"the",
"content",
"of",
"the",
"given",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsTouch.java#L160-L165 |
davetcc/tcMenu | tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java | MainWindowController.buildGrid | private int buildGrid(SubMenuItem subMenu, int inset, int gridPosition) {
// inset is the amount of offset to apply to the left, to make the tree look realistic
// gridPosition is the row in the grid we populating.
// while there are more menuitems in the current level
for (MenuItem item : menuTree.getMenuItems(subMenu)) {
if (item.hasChildren()) {
//
// for submenus, we make single label and call back on ourselves with the next level down
//
Label itemLbl = new Label("SubMenu " + item.getName());
itemLbl.setPadding(new Insets(12, 10, 12, inset));
itemLbl.setStyle("-fx-font-weight: bold; -fx-font-size: 120%;");
itemGrid.add(itemLbl, 0, gridPosition++, 2, 1);
gridPosition = buildGrid(MenuItemHelper.asSubMenu(item), inset + 10, gridPosition);
} else {
//
// otherwise for child items we create the controls that display the value and allow
// editing.
//
Label itemLbl = new Label(item.getName());
itemLbl.setPadding(new Insets(3, 10, 3, inset));
itemGrid.add(itemLbl, 0, gridPosition);
itemGrid.add(createUiControlForItem(item), 1, gridPosition);
renderItemValue(item);
gridPosition++;
}
}
return gridPosition;
} | java | private int buildGrid(SubMenuItem subMenu, int inset, int gridPosition) {
// inset is the amount of offset to apply to the left, to make the tree look realistic
// gridPosition is the row in the grid we populating.
// while there are more menuitems in the current level
for (MenuItem item : menuTree.getMenuItems(subMenu)) {
if (item.hasChildren()) {
//
// for submenus, we make single label and call back on ourselves with the next level down
//
Label itemLbl = new Label("SubMenu " + item.getName());
itemLbl.setPadding(new Insets(12, 10, 12, inset));
itemLbl.setStyle("-fx-font-weight: bold; -fx-font-size: 120%;");
itemGrid.add(itemLbl, 0, gridPosition++, 2, 1);
gridPosition = buildGrid(MenuItemHelper.asSubMenu(item), inset + 10, gridPosition);
} else {
//
// otherwise for child items we create the controls that display the value and allow
// editing.
//
Label itemLbl = new Label(item.getName());
itemLbl.setPadding(new Insets(3, 10, 3, inset));
itemGrid.add(itemLbl, 0, gridPosition);
itemGrid.add(createUiControlForItem(item), 1, gridPosition);
renderItemValue(item);
gridPosition++;
}
}
return gridPosition;
} | [
"private",
"int",
"buildGrid",
"(",
"SubMenuItem",
"subMenu",
",",
"int",
"inset",
",",
"int",
"gridPosition",
")",
"{",
"// inset is the amount of offset to apply to the left, to make the tree look realistic",
"// gridPosition is the row in the grid we populating.",
"// while there ... | Here we go through all the menu items and populate a GridPane with controls to display and edit each item.
We start at ROOT and through every item in all submenus. This is a recursive function that is repeatedly
called on sub menu's until we've finished all items. | [
"Here",
"we",
"go",
"through",
"all",
"the",
"menu",
"items",
"and",
"populate",
"a",
"GridPane",
"with",
"controls",
"to",
"display",
"and",
"edit",
"each",
"item",
".",
"We",
"start",
"at",
"ROOT",
"and",
"through",
"every",
"item",
"in",
"all",
"subme... | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java#L188-L219 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Triangle2dfx.java | Triangle2dfx.ccwProperty | @Pure
public ReadOnlyBooleanProperty ccwProperty() {
if (this.ccw == null) {
this.ccw = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.CCW);
this.ccw.bind(Bindings.createBooleanBinding(() ->
Triangle2afp.isCCW(
getX1(), getY1(), getX2(), getY2(),
getX3(), getY3()),
x1Property(), y1Property(),
x2Property(), y2Property(),
x3Property(), y3Property()));
}
return this.ccw.getReadOnlyProperty();
} | java | @Pure
public ReadOnlyBooleanProperty ccwProperty() {
if (this.ccw == null) {
this.ccw = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.CCW);
this.ccw.bind(Bindings.createBooleanBinding(() ->
Triangle2afp.isCCW(
getX1(), getY1(), getX2(), getY2(),
getX3(), getY3()),
x1Property(), y1Property(),
x2Property(), y2Property(),
x3Property(), y3Property()));
}
return this.ccw.getReadOnlyProperty();
} | [
"@",
"Pure",
"public",
"ReadOnlyBooleanProperty",
"ccwProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"ccw",
"==",
"null",
")",
"{",
"this",
".",
"ccw",
"=",
"new",
"ReadOnlyBooleanWrapper",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"CCW",
")",
";",... | Replies the property that indictes if the triangle's points are defined in a counter-clockwise order.
@return the ccw property. | [
"Replies",
"the",
"property",
"that",
"indictes",
"if",
"the",
"triangle",
"s",
"points",
"are",
"defined",
"in",
"a",
"counter",
"-",
"clockwise",
"order",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Triangle2dfx.java#L305-L318 |
dnsjava/dnsjava | update.java | update.parseRR | Record
parseRR(Tokenizer st, int classValue, long TTLValue)
throws IOException
{
Name name = st.getName(zone);
long ttl;
int type;
Record record;
String s = st.getString();
try {
ttl = TTL.parseTTL(s);
s = st.getString();
}
catch (NumberFormatException e) {
ttl = TTLValue;
}
if (DClass.value(s) >= 0) {
classValue = DClass.value(s);
s = st.getString();
}
if ((type = Type.value(s)) < 0)
throw new IOException("Invalid type: " + s);
record = Record.fromString(name, type, classValue, ttl, st, zone);
if (record != null)
return (record);
else
throw new IOException("Parse error");
} | java | Record
parseRR(Tokenizer st, int classValue, long TTLValue)
throws IOException
{
Name name = st.getName(zone);
long ttl;
int type;
Record record;
String s = st.getString();
try {
ttl = TTL.parseTTL(s);
s = st.getString();
}
catch (NumberFormatException e) {
ttl = TTLValue;
}
if (DClass.value(s) >= 0) {
classValue = DClass.value(s);
s = st.getString();
}
if ((type = Type.value(s)) < 0)
throw new IOException("Invalid type: " + s);
record = Record.fromString(name, type, classValue, ttl, st, zone);
if (record != null)
return (record);
else
throw new IOException("Parse error");
} | [
"Record",
"parseRR",
"(",
"Tokenizer",
"st",
",",
"int",
"classValue",
",",
"long",
"TTLValue",
")",
"throws",
"IOException",
"{",
"Name",
"name",
"=",
"st",
".",
"getName",
"(",
"zone",
")",
";",
"long",
"ttl",
";",
"int",
"type",
";",
"Record",
"reco... | /*
<name> [ttl] [class] <type> <data>
Ignore the class, if present. | [
"/",
"*",
"<name",
">",
"[",
"ttl",
"]",
"[",
"class",
"]",
"<type",
">",
"<data",
">",
"Ignore",
"the",
"class",
"if",
"present",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/update.java#L282-L314 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRPhysicsLoader.java | GVRPhysicsLoader.loadPhysicsFile | public static void loadPhysicsFile(GVRContext gvrContext, String fileName, GVRScene scene) throws IOException
{
loadPhysicsFile(gvrContext, fileName, false, scene);
} | java | public static void loadPhysicsFile(GVRContext gvrContext, String fileName, GVRScene scene) throws IOException
{
loadPhysicsFile(gvrContext, fileName, false, scene);
} | [
"public",
"static",
"void",
"loadPhysicsFile",
"(",
"GVRContext",
"gvrContext",
",",
"String",
"fileName",
",",
"GVRScene",
"scene",
")",
"throws",
"IOException",
"{",
"loadPhysicsFile",
"(",
"gvrContext",
",",
"fileName",
",",
"false",
",",
"scene",
")",
";",
... | Loads a physics settings file.
@param gvrContext The context of the app.
@param fileName Physics settings file name.
@param scene The scene containing the objects to attach physics components. | [
"Loads",
"a",
"physics",
"settings",
"file",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRPhysicsLoader.java#L49-L52 |
openbase/jul | communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableRemote.java | AbstractConfigurableRemote.applyConfigUpdate | @Override
public CONFIG applyConfigUpdate(final CONFIG config) throws CouldNotPerformException, InterruptedException {
synchronized (CONFIG_LOCK) {
try {
this.config = config;
configObservable.notifyObservers(config);
// detect scope change if instance is already active and reinit if needed.
try {
if (isActive() && !currentScope.equals(detectScope(config))) {
currentScope = detectScope();
reinit(currentScope);
}
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not verify scope changes!", ex);
}
try {
notifyConfigUpdate(config);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify config update!", ex), logger);
}
return this.config;
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not apply config update!", ex);
}
}
} | java | @Override
public CONFIG applyConfigUpdate(final CONFIG config) throws CouldNotPerformException, InterruptedException {
synchronized (CONFIG_LOCK) {
try {
this.config = config;
configObservable.notifyObservers(config);
// detect scope change if instance is already active and reinit if needed.
try {
if (isActive() && !currentScope.equals(detectScope(config))) {
currentScope = detectScope();
reinit(currentScope);
}
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not verify scope changes!", ex);
}
try {
notifyConfigUpdate(config);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify config update!", ex), logger);
}
return this.config;
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not apply config update!", ex);
}
}
} | [
"@",
"Override",
"public",
"CONFIG",
"applyConfigUpdate",
"(",
"final",
"CONFIG",
"config",
")",
"throws",
"CouldNotPerformException",
",",
"InterruptedException",
"{",
"synchronized",
"(",
"CONFIG_LOCK",
")",
"{",
"try",
"{",
"this",
".",
"config",
"=",
"config",... | {@inheritDoc}
@param config {@inheritDoc}
@return {@inheritDoc}
@throws CouldNotPerformException {@inheritDoc}
@throws InterruptedException {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableRemote.java#L106-L133 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java | ViewUtils.showKeyboard | public static void showKeyboard(Context context, View field){
try {
field.requestFocus();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(field, InputMethodManager.SHOW_IMPLICIT);
} catch (Exception ex) {
Log.e("Caffeine", "Error occurred trying to show the keyboard. Exception=" + ex);
}
} | java | public static void showKeyboard(Context context, View field){
try {
field.requestFocus();
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(field, InputMethodManager.SHOW_IMPLICIT);
} catch (Exception ex) {
Log.e("Caffeine", "Error occurred trying to show the keyboard. Exception=" + ex);
}
} | [
"public",
"static",
"void",
"showKeyboard",
"(",
"Context",
"context",
",",
"View",
"field",
")",
"{",
"try",
"{",
"field",
".",
"requestFocus",
"(",
")",
";",
"InputMethodManager",
"imm",
"=",
"(",
"InputMethodManager",
")",
"context",
".",
"getSystemService"... | Show the pop-up keyboard
@param context Activity/Context.
@param field field that requests focus. | [
"Show",
"the",
"pop",
"-",
"up",
"keyboard"
] | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L156-L164 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfLayer.java | PdfLayer.setCreatorInfo | public void setCreatorInfo(String creator, String subtype) {
PdfDictionary usage = getUsage();
PdfDictionary dic = new PdfDictionary();
dic.put(PdfName.CREATOR, new PdfString(creator, PdfObject.TEXT_UNICODE));
dic.put(PdfName.SUBTYPE, new PdfName(subtype));
usage.put(PdfName.CREATORINFO, dic);
} | java | public void setCreatorInfo(String creator, String subtype) {
PdfDictionary usage = getUsage();
PdfDictionary dic = new PdfDictionary();
dic.put(PdfName.CREATOR, new PdfString(creator, PdfObject.TEXT_UNICODE));
dic.put(PdfName.SUBTYPE, new PdfName(subtype));
usage.put(PdfName.CREATORINFO, dic);
} | [
"public",
"void",
"setCreatorInfo",
"(",
"String",
"creator",
",",
"String",
"subtype",
")",
"{",
"PdfDictionary",
"usage",
"=",
"getUsage",
"(",
")",
";",
"PdfDictionary",
"dic",
"=",
"new",
"PdfDictionary",
"(",
")",
";",
"dic",
".",
"put",
"(",
"PdfName... | Used by the creating application to store application-specific
data associated with this optional content group.
@param creator a text string specifying the application that created the group
@param subtype a string defining the type of content controlled by the group. Suggested
values include but are not limited to <B>Artwork</B>, for graphic-design or publishing
applications, and <B>Technical</B>, for technical designs such as building plans or
schematics | [
"Used",
"by",
"the",
"creating",
"application",
"to",
"store",
"application",
"-",
"specific",
"data",
"associated",
"with",
"this",
"optional",
"content",
"group",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfLayer.java#L206-L212 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.virtualNumbers_number_GET | public OvhVirtualNumberGenericService virtualNumbers_number_GET(String number) throws IOException {
String qPath = "/sms/virtualNumbers/{number}";
StringBuilder sb = path(qPath, number);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhVirtualNumberGenericService.class);
} | java | public OvhVirtualNumberGenericService virtualNumbers_number_GET(String number) throws IOException {
String qPath = "/sms/virtualNumbers/{number}";
StringBuilder sb = path(qPath, number);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhVirtualNumberGenericService.class);
} | [
"public",
"OvhVirtualNumberGenericService",
"virtualNumbers_number_GET",
"(",
"String",
"number",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/virtualNumbers/{number}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"number",
")",
... | Get this object properties
REST: GET /sms/virtualNumbers/{number}
@param number [required] Your virtual number | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1773-L1778 |
KostyaSha/yet-another-docker-plugin | yet-another-docker-its/src/main/java/com/github/kostyasha/it/rule/DockerRule.java | DockerRule.runFreshJenkinsContainer | public String runFreshJenkinsContainer(DockerImagePullStrategy pullStrategy, boolean forceRefresh)
throws IOException, SettingsBuildingException, InterruptedException {
LOG.debug("Entering run fresh jenkins container.");
pullImage(pullStrategy, JENKINS_DEFAULT.getDockerImageName());
// labels attached to container allows cleanup container if it wasn't removed
final Map<String, String> labels = new HashMap<>();
labels.put("test.displayName", description.getDisplayName());
LOG.debug("Removing existed container before");
try {
final List<Container> containers = getDockerCli().listContainersCmd().withShowAll(true).exec();
for (Container c : containers) {
if (c.getLabels().equals(labels)) { // equals? container labels vs image labels?
LOG.debug("Removing {}, for labels: '{}'", c, labels);
getDockerCli().removeContainerCmd(c.getId())
.withForce(true)
.exec();
break;
}
}
} catch (NotFoundException ex) {
LOG.debug("Container wasn't found, that's ok");
}
LOG.debug("Recreating data container without data-image doesn't make sense, so reuse boolean.");
String dataContainerId = getDataContainerId(forceRefresh);
final String id = getDockerCli().createContainerCmd(JENKINS_DEFAULT.getDockerImageName())
.withEnv(CONTAINER_JAVA_OPTS)
.withExposedPorts(new ExposedPort(JENKINS_DEFAULT.tcpPort))
.withPortSpecs(String.format("%d/tcp", JENKINS_DEFAULT.tcpPort))
.withHostConfig(HostConfig.newHostConfig()
.withPortBindings(PortBinding.parse("0.0.0.0:48000:48000"))
.withVolumesFrom(new VolumesFrom(dataContainerId))
.withPublishAllPorts(true))
.withLabels(labels)
// .withPortBindings(PortBinding.parse("0.0.0.0:48000:48000"), PortBinding.parse("0.0.0.0:50000:50000"))
.exec()
.getId();
provisioned.add(id);
LOG.debug("Starting container");
getDockerCli().startContainerCmd(id).exec();
return id;
} | java | public String runFreshJenkinsContainer(DockerImagePullStrategy pullStrategy, boolean forceRefresh)
throws IOException, SettingsBuildingException, InterruptedException {
LOG.debug("Entering run fresh jenkins container.");
pullImage(pullStrategy, JENKINS_DEFAULT.getDockerImageName());
// labels attached to container allows cleanup container if it wasn't removed
final Map<String, String> labels = new HashMap<>();
labels.put("test.displayName", description.getDisplayName());
LOG.debug("Removing existed container before");
try {
final List<Container> containers = getDockerCli().listContainersCmd().withShowAll(true).exec();
for (Container c : containers) {
if (c.getLabels().equals(labels)) { // equals? container labels vs image labels?
LOG.debug("Removing {}, for labels: '{}'", c, labels);
getDockerCli().removeContainerCmd(c.getId())
.withForce(true)
.exec();
break;
}
}
} catch (NotFoundException ex) {
LOG.debug("Container wasn't found, that's ok");
}
LOG.debug("Recreating data container without data-image doesn't make sense, so reuse boolean.");
String dataContainerId = getDataContainerId(forceRefresh);
final String id = getDockerCli().createContainerCmd(JENKINS_DEFAULT.getDockerImageName())
.withEnv(CONTAINER_JAVA_OPTS)
.withExposedPorts(new ExposedPort(JENKINS_DEFAULT.tcpPort))
.withPortSpecs(String.format("%d/tcp", JENKINS_DEFAULT.tcpPort))
.withHostConfig(HostConfig.newHostConfig()
.withPortBindings(PortBinding.parse("0.0.0.0:48000:48000"))
.withVolumesFrom(new VolumesFrom(dataContainerId))
.withPublishAllPorts(true))
.withLabels(labels)
// .withPortBindings(PortBinding.parse("0.0.0.0:48000:48000"), PortBinding.parse("0.0.0.0:50000:50000"))
.exec()
.getId();
provisioned.add(id);
LOG.debug("Starting container");
getDockerCli().startContainerCmd(id).exec();
return id;
} | [
"public",
"String",
"runFreshJenkinsContainer",
"(",
"DockerImagePullStrategy",
"pullStrategy",
",",
"boolean",
"forceRefresh",
")",
"throws",
"IOException",
",",
"SettingsBuildingException",
",",
"InterruptedException",
"{",
"LOG",
".",
"debug",
"(",
"\"Entering run fresh ... | Run, record and remove after test container with jenkins.
@param forceRefresh enforce data container and data image refresh | [
"Run",
"record",
"and",
"remove",
"after",
"test",
"container",
"with",
"jenkins",
"."
] | train | https://github.com/KostyaSha/yet-another-docker-plugin/blob/40b12e39ff94c3834cff7e028c3dd01c88e87d77/yet-another-docker-its/src/main/java/com/github/kostyasha/it/rule/DockerRule.java#L444-L488 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.readSummary | public Result<Summary> readSummary(Series series, Interval interval) {
checkNotNull(series);
checkNotNull(interval);
DateTimeZone timezone = interval.getStart().getChronology().getZone();
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/summary/", API_VERSION, urlencode(series.getKey())));
addIntervalToURI(builder, interval);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, timezone: %s", series.getKey(), interval.toString(), timezone.toString());
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString());
Result<Summary> result = execute(request, Summary.class);
return result;
} | java | public Result<Summary> readSummary(Series series, Interval interval) {
checkNotNull(series);
checkNotNull(interval);
DateTimeZone timezone = interval.getStart().getChronology().getZone();
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/summary/", API_VERSION, urlencode(series.getKey())));
addIntervalToURI(builder, interval);
addTimeZoneToURI(builder, timezone);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, interval: %s, timezone: %s", series.getKey(), interval.toString(), timezone.toString());
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString());
Result<Summary> result = execute(request, Summary.class);
return result;
} | [
"public",
"Result",
"<",
"Summary",
">",
"readSummary",
"(",
"Series",
"series",
",",
"Interval",
"interval",
")",
"{",
"checkNotNull",
"(",
"series",
")",
";",
"checkNotNull",
"(",
"interval",
")",
";",
"DateTimeZone",
"timezone",
"=",
"interval",
".",
"get... | Reads summary statistics for a series for the specified interval.
@param series The series to read from
@param interval The interval of data to summarize
@return A set of statistics for an interval of data
@see SingleValue
@since 1.1.0 | [
"Reads",
"summary",
"statistics",
"for",
"a",
"series",
"for",
"the",
"specified",
"interval",
"."
] | train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L575-L594 |
osglworks/java-tool | src/main/java/org/osgl/util/E.java | E.invalidConfiguration | public static ConfigurationException invalidConfiguration(Throwable cause, String message, Object... args) {
throw new ConfigurationException(cause, message, args);
} | java | public static ConfigurationException invalidConfiguration(Throwable cause, String message, Object... args) {
throw new ConfigurationException(cause, message, args);
} | [
"public",
"static",
"ConfigurationException",
"invalidConfiguration",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"throw",
"new",
"ConfigurationException",
"(",
"cause",
",",
"message",
",",
"args",
")",
";",
"}"
... | Throws out a {@link ConfigurationException} with cause and message specified.
@param cause
the cause of the configuration error.
@param message
the error message format pattern.
@param args
the error message format arguments. | [
"Throws",
"out",
"a",
"{"
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L299-L301 |
SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java | MoreCollectors.unorderedIndex | public static <K, E> Collector<E, ImmutableSetMultimap.Builder<K, E>, ImmutableSetMultimap<K, E>> unorderedIndex(Function<? super E, K> keyFunction) {
return unorderedIndex(keyFunction, Function.identity());
} | java | public static <K, E> Collector<E, ImmutableSetMultimap.Builder<K, E>, ImmutableSetMultimap<K, E>> unorderedIndex(Function<? super E, K> keyFunction) {
return unorderedIndex(keyFunction, Function.identity());
} | [
"public",
"static",
"<",
"K",
",",
"E",
">",
"Collector",
"<",
"E",
",",
"ImmutableSetMultimap",
".",
"Builder",
"<",
"K",
",",
"E",
">",
",",
"ImmutableSetMultimap",
"<",
"K",
",",
"E",
">",
">",
"unorderedIndex",
"(",
"Function",
"<",
"?",
"super",
... | Creates an {@link com.google.common.collect.ImmutableSetMultimap} from the stream where the values are the values
in the stream and the keys are the result of the provided {@link Function keyFunction} applied to each value in the
stream.
<p>
Neither {@link Function keyFunction} nor {@link Function valueFunction} can return {@code null}, otherwise a
{@link NullPointerException} will be thrown.
</p>
@throws NullPointerException if {@code keyFunction} or {@code valueFunction} is {@code null}.
@throws NullPointerException if result of {@code keyFunction} or {@code valueFunction} is {@code null}. | [
"Creates",
"an",
"{",
"@link",
"com",
".",
"google",
".",
"common",
".",
"collect",
".",
"ImmutableSetMultimap",
"}",
"from",
"the",
"stream",
"where",
"the",
"values",
"are",
"the",
"values",
"in",
"the",
"stream",
"and",
"the",
"keys",
"are",
"the",
"r... | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java#L369-L371 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.createOrUpdateAsync | public Observable<AppServiceEnvironmentResourceInner> createOrUpdateAsync(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() {
@Override
public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) {
return response.body();
}
});
} | java | public Observable<AppServiceEnvironmentResourceInner> createOrUpdateAsync(String resourceGroupName, String name, AppServiceEnvironmentResourceInner hostingEnvironmentEnvelope) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, hostingEnvironmentEnvelope).map(new Func1<ServiceResponse<AppServiceEnvironmentResourceInner>, AppServiceEnvironmentResourceInner>() {
@Override
public AppServiceEnvironmentResourceInner call(ServiceResponse<AppServiceEnvironmentResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AppServiceEnvironmentResourceInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"AppServiceEnvironmentResourceInner",
"hostingEnvironmentEnvelope",
")",
"{",
"return",
"createOrUpdateWithServiceRespons... | Create or update an App Service Environment.
Create or update an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param hostingEnvironmentEnvelope Configuration details of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"or",
"update",
"an",
"App",
"Service",
"Environment",
".",
"Create",
"or",
"update",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L715-L722 |
michel-kraemer/citeproc-java | citeproc-java/src/main/java/de/undercouch/citeproc/CSL.java | CSL.setConvertLinks | public void setConvertLinks(boolean convert) {
try {
runner.callMethod("setConvertLinks", engine, convert);
} catch (ScriptRunnerException e) {
throw new IllegalArgumentException("Could not set option", e);
}
} | java | public void setConvertLinks(boolean convert) {
try {
runner.callMethod("setConvertLinks", engine, convert);
} catch (ScriptRunnerException e) {
throw new IllegalArgumentException("Could not set option", e);
}
} | [
"public",
"void",
"setConvertLinks",
"(",
"boolean",
"convert",
")",
"{",
"try",
"{",
"runner",
".",
"callMethod",
"(",
"\"setConvertLinks\"",
",",
"engine",
",",
"convert",
")",
";",
"}",
"catch",
"(",
"ScriptRunnerException",
"e",
")",
"{",
"throw",
"new",... | Specifies if the processor should convert URLs and DOIs in the output
to links. How links are created depends on the output format that has
been set with {@link #setOutputFormat(String)}
@param convert true if URLs and DOIs should be converted to links | [
"Specifies",
"if",
"the",
"processor",
"should",
"convert",
"URLs",
"and",
"DOIs",
"in",
"the",
"output",
"to",
"links",
".",
"How",
"links",
"are",
"created",
"depends",
"on",
"the",
"output",
"format",
"that",
"has",
"been",
"set",
"with",
"{"
] | train | https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/CSL.java#L579-L585 |
kkopacz/agiso-tempel | bundles/tempel-core/src/main/java/org/agiso/tempel/core/DefaultTemplateExecutor.java | DefaultTemplateExecutor.processParam | private Object processParam(TemplateParam<?, ?, ?> param, Map<String, Object> params, Template<?> template) {
Object value = fetchParamValue(param, params, param.getFetcher());
value = convertParamValue(value, param.getType(), param.getConverter());
validateParamValue(value, param.getValidator());
return value;
} | java | private Object processParam(TemplateParam<?, ?, ?> param, Map<String, Object> params, Template<?> template) {
Object value = fetchParamValue(param, params, param.getFetcher());
value = convertParamValue(value, param.getType(), param.getConverter());
validateParamValue(value, param.getValidator());
return value;
} | [
"private",
"Object",
"processParam",
"(",
"TemplateParam",
"<",
"?",
",",
"?",
",",
"?",
">",
"param",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
",",
"Template",
"<",
"?",
">",
"template",
")",
"{",
"Object",
"value",
"=",
"fetchParamVal... | Przetwarzanie warości parametru (pobieranie, konwersja i walidacja)
@param param
@param params
@param template
@return | [
"Przetwarzanie",
"warości",
"parametru",
"(",
"pobieranie",
"konwersja",
"i",
"walidacja",
")"
] | train | https://github.com/kkopacz/agiso-tempel/blob/ff7a96153153b6bc07212d776816b87d9538f6fa/bundles/tempel-core/src/main/java/org/agiso/tempel/core/DefaultTemplateExecutor.java#L384-L389 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/buffer/MappeableRunContainer.java | MappeableRunContainer.canPrependValueLength | private boolean canPrependValueLength(int value, int index) {
if (index < this.nbrruns) {
int nextValue = toIntUnsigned(getValue(index));
if (nextValue == value + 1) {
return true;
}
}
return false;
} | java | private boolean canPrependValueLength(int value, int index) {
if (index < this.nbrruns) {
int nextValue = toIntUnsigned(getValue(index));
if (nextValue == value + 1) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"canPrependValueLength",
"(",
"int",
"value",
",",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"this",
".",
"nbrruns",
")",
"{",
"int",
"nextValue",
"=",
"toIntUnsigned",
"(",
"getValue",
"(",
"index",
")",
")",
";",
"if",
... | To check if a value length can be prepended with a given value | [
"To",
"check",
"if",
"a",
"value",
"length",
"can",
"be",
"prepended",
"with",
"a",
"given",
"value"
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/MappeableRunContainer.java#L676-L684 |
dnsjava/dnsjava | org/xbill/DNS/Record.java | Record.newRecord | public static Record
newRecord(Name name, int type, int dclass, long ttl, int length, byte [] data) {
if (!name.isAbsolute())
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
TTL.check(ttl);
DNSInput in;
if (data != null)
in = new DNSInput(data);
else
in = null;
try {
return newRecord(name, type, dclass, ttl, length, in);
}
catch (IOException e) {
return null;
}
} | java | public static Record
newRecord(Name name, int type, int dclass, long ttl, int length, byte [] data) {
if (!name.isAbsolute())
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
TTL.check(ttl);
DNSInput in;
if (data != null)
in = new DNSInput(data);
else
in = null;
try {
return newRecord(name, type, dclass, ttl, length, in);
}
catch (IOException e) {
return null;
}
} | [
"public",
"static",
"Record",
"newRecord",
"(",
"Name",
"name",
",",
"int",
"type",
",",
"int",
"dclass",
",",
"long",
"ttl",
",",
"int",
"length",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"!",
"name",
".",
"isAbsolute",
"(",
")",
")",
... | Creates a new record, with the given parameters.
@param name The owner name of the record.
@param type The record's type.
@param dclass The record's class.
@param ttl The record's time to live.
@param length The length of the record's data.
@param data The rdata of the record, in uncompressed DNS wire format. Only
the first length bytes are used. | [
"Creates",
"a",
"new",
"record",
"with",
"the",
"given",
"parameters",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Record.java#L107-L126 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.onHttpServerUpgrade | public void onHttpServerUpgrade(Http2Settings settings) throws Http2Exception {
if (!connection().isServer()) {
throw connectionError(PROTOCOL_ERROR, "Server-side HTTP upgrade requested for a client");
}
if (!prefaceSent()) {
// If the preface was not sent yet it most likely means the handler was not added to the pipeline before
// calling this method.
throw connectionError(INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent");
}
if (decoder.prefaceReceived()) {
throw connectionError(PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received");
}
// Apply the settings but no ACK is necessary.
encoder.remoteSettings(settings);
// Create a stream in the half-closed state.
connection().remote().createStream(HTTP_UPGRADE_STREAM_ID, true);
} | java | public void onHttpServerUpgrade(Http2Settings settings) throws Http2Exception {
if (!connection().isServer()) {
throw connectionError(PROTOCOL_ERROR, "Server-side HTTP upgrade requested for a client");
}
if (!prefaceSent()) {
// If the preface was not sent yet it most likely means the handler was not added to the pipeline before
// calling this method.
throw connectionError(INTERNAL_ERROR, "HTTP upgrade must occur after preface was sent");
}
if (decoder.prefaceReceived()) {
throw connectionError(PROTOCOL_ERROR, "HTTP upgrade must occur before HTTP/2 preface is received");
}
// Apply the settings but no ACK is necessary.
encoder.remoteSettings(settings);
// Create a stream in the half-closed state.
connection().remote().createStream(HTTP_UPGRADE_STREAM_ID, true);
} | [
"public",
"void",
"onHttpServerUpgrade",
"(",
"Http2Settings",
"settings",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"!",
"connection",
"(",
")",
".",
"isServer",
"(",
")",
")",
"{",
"throw",
"connectionError",
"(",
"PROTOCOL_ERROR",
",",
"\"Server-side H... | Handles the server-side (cleartext) upgrade from HTTP to HTTP/2.
@param settings the settings for the remote endpoint. | [
"Handles",
"the",
"server",
"-",
"side",
"(",
"cleartext",
")",
"upgrade",
"from",
"HTTP",
"to",
"HTTP",
"/",
"2",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L164-L182 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/Money.java | Money.ofMinor | public static Money ofMinor(CurrencyUnit currency, long amountMinor, int factionDigits) {
if(factionDigits < 0) {
throw new IllegalArgumentException("The factionDigits cannot be negative");
}
return of(BigDecimal.valueOf(amountMinor, factionDigits), currency);
} | java | public static Money ofMinor(CurrencyUnit currency, long amountMinor, int factionDigits) {
if(factionDigits < 0) {
throw new IllegalArgumentException("The factionDigits cannot be negative");
}
return of(BigDecimal.valueOf(amountMinor, factionDigits), currency);
} | [
"public",
"static",
"Money",
"ofMinor",
"(",
"CurrencyUnit",
"currency",
",",
"long",
"amountMinor",
",",
"int",
"factionDigits",
")",
"{",
"if",
"(",
"factionDigits",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The factionDigits cannot... | Obtains an instance of {@code Money} from an amount in minor units.
For example, {@code ofMinor(USD, 1234, 2)} creates the instance {@code USD 12.34}.
@param currency the currency, not null
@param amountMinor the amount of money in the minor division of the currency
@param factionDigits number of digits
@return the monetary amount from minor units
@see CurrencyUnit#getDefaultFractionDigits()
@see Money#ofMinor(CurrencyUnit, long, int)
@throws NullPointerException when the currency is null
@throws IllegalArgumentException when the factionDigits is negative
@since 1.0.1 | [
"Obtains",
"an",
"instance",
"of",
"{"
] | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/Money.java#L829-L834 |
VoltDB/voltdb | src/frontend/org/voltdb/client/ClientImpl.java | ClientImpl.callProcedureWithClientTimeout | public ClientResponse callProcedureWithClientTimeout(
int batchTimeout,
boolean allPartition,
String procName,
long clientTimeout,
TimeUnit unit,
Object... parameters)
throws IOException, NoConnectionsException, ProcCallException
{
long handle = m_handle.getAndIncrement();
ProcedureInvocation invocation
= new ProcedureInvocation(handle, batchTimeout, allPartition, procName, parameters);
long nanos = unit.toNanos(clientTimeout);
return internalSyncCallProcedure(nanos, invocation);
} | java | public ClientResponse callProcedureWithClientTimeout(
int batchTimeout,
boolean allPartition,
String procName,
long clientTimeout,
TimeUnit unit,
Object... parameters)
throws IOException, NoConnectionsException, ProcCallException
{
long handle = m_handle.getAndIncrement();
ProcedureInvocation invocation
= new ProcedureInvocation(handle, batchTimeout, allPartition, procName, parameters);
long nanos = unit.toNanos(clientTimeout);
return internalSyncCallProcedure(nanos, invocation);
} | [
"public",
"ClientResponse",
"callProcedureWithClientTimeout",
"(",
"int",
"batchTimeout",
",",
"boolean",
"allPartition",
",",
"String",
"procName",
",",
"long",
"clientTimeout",
",",
"TimeUnit",
"unit",
",",
"Object",
"...",
"parameters",
")",
"throws",
"IOException"... | Synchronously invoke a procedure call blocking until a result is available.
@param batchTimeout procedure invocation batch timeout.
@param allPartition whether this is an all-partition invocation
@param procName class name (not qualified by package) of the procedure to execute.
@param clientTimeout timeout for the procedure
@param unit TimeUnit of procedure timeout
@param parameters vararg list of procedure's parameter values.
@return ClientResponse for execution.
@throws org.voltdb.client.ProcCallException
@throws NoConnectionsException | [
"Synchronously",
"invoke",
"a",
"procedure",
"call",
"blocking",
"until",
"a",
"result",
"is",
"available",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientImpl.java#L311-L325 |
zaproxy/zaproxy | src/org/parosproxy/paros/extension/manualrequest/http/impl/HttpPanelSender.java | HttpPanelSender.notifyPersistentConnectionListener | private boolean notifyPersistentConnectionListener(HttpMessage httpMessage, Socket inSocket, ZapGetMethod method) {
boolean keepSocketOpen = false;
PersistentConnectionListener listener = null;
synchronized (persistentConnectionListener) {
for (int i = 0; i < persistentConnectionListener.size(); i++) {
listener = persistentConnectionListener.get(i);
try {
if (listener.onHandshakeResponse(httpMessage, inSocket, method)) {
// inform as long as one listener wishes to overtake the connection
keepSocketOpen = true;
break;
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
}
return keepSocketOpen;
} | java | private boolean notifyPersistentConnectionListener(HttpMessage httpMessage, Socket inSocket, ZapGetMethod method) {
boolean keepSocketOpen = false;
PersistentConnectionListener listener = null;
synchronized (persistentConnectionListener) {
for (int i = 0; i < persistentConnectionListener.size(); i++) {
listener = persistentConnectionListener.get(i);
try {
if (listener.onHandshakeResponse(httpMessage, inSocket, method)) {
// inform as long as one listener wishes to overtake the connection
keepSocketOpen = true;
break;
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
}
return keepSocketOpen;
} | [
"private",
"boolean",
"notifyPersistentConnectionListener",
"(",
"HttpMessage",
"httpMessage",
",",
"Socket",
"inSocket",
",",
"ZapGetMethod",
"method",
")",
"{",
"boolean",
"keepSocketOpen",
"=",
"false",
";",
"PersistentConnectionListener",
"listener",
"=",
"null",
";... | Go thru each listener and offer him to take over the connection. The
first observer that returns true gets exclusive rights.
@param httpMessage Contains HTTP request & response.
@param inSocket Encapsulates the TCP connection to the browser.
@param method Provides more power to process response.
@return Boolean to indicate if socket should be kept open. | [
"Go",
"thru",
"each",
"listener",
"and",
"offer",
"him",
"to",
"take",
"over",
"the",
"connection",
".",
"The",
"first",
"observer",
"that",
"returns",
"true",
"gets",
"exclusive",
"rights",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/extension/manualrequest/http/impl/HttpPanelSender.java#L172-L191 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java | DiagnosticsInner.getHostingEnvironmentDetectorResponseAsync | public Observable<DetectorResponseInner> getHostingEnvironmentDetectorResponseAsync(String resourceGroupName, String name, String detectorName) {
return getHostingEnvironmentDetectorResponseWithServiceResponseAsync(resourceGroupName, name, detectorName).map(new Func1<ServiceResponse<DetectorResponseInner>, DetectorResponseInner>() {
@Override
public DetectorResponseInner call(ServiceResponse<DetectorResponseInner> response) {
return response.body();
}
});
} | java | public Observable<DetectorResponseInner> getHostingEnvironmentDetectorResponseAsync(String resourceGroupName, String name, String detectorName) {
return getHostingEnvironmentDetectorResponseWithServiceResponseAsync(resourceGroupName, name, detectorName).map(new Func1<ServiceResponse<DetectorResponseInner>, DetectorResponseInner>() {
@Override
public DetectorResponseInner call(ServiceResponse<DetectorResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DetectorResponseInner",
">",
"getHostingEnvironmentDetectorResponseAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"detectorName",
")",
"{",
"return",
"getHostingEnvironmentDetectorResponseWithServiceResponseAsync",
... | Get Hosting Environment Detector Response.
Get Hosting Environment Detector Response.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name App Service Environment Name
@param detectorName Detector Resource Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DetectorResponseInner object | [
"Get",
"Hosting",
"Environment",
"Detector",
"Response",
".",
"Get",
"Hosting",
"Environment",
"Detector",
"Response",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java#L365-L372 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/util/ClassPathUtil.java | ClassPathUtil.findCodeBaseInClassPath | public static String findCodeBaseInClassPath(Pattern codeBaseNamePattern, String classPath) {
if (classPath == null) {
return null;
}
StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
while (tok.hasMoreTokens()) {
String t = tok.nextToken();
File f = new File(t);
Matcher m = codeBaseNamePattern.matcher(f.getName());
if (m.matches()) {
return t;
}
}
return null;
} | java | public static String findCodeBaseInClassPath(Pattern codeBaseNamePattern, String classPath) {
if (classPath == null) {
return null;
}
StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
while (tok.hasMoreTokens()) {
String t = tok.nextToken();
File f = new File(t);
Matcher m = codeBaseNamePattern.matcher(f.getName());
if (m.matches()) {
return t;
}
}
return null;
} | [
"public",
"static",
"String",
"findCodeBaseInClassPath",
"(",
"Pattern",
"codeBaseNamePattern",
",",
"String",
"classPath",
")",
"{",
"if",
"(",
"classPath",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringTokenizer",
"tok",
"=",
"new",
"StringTokeniz... | Try to find a codebase matching the given pattern in the given class path
string.
@param codeBaseNamePattern
pattern describing a codebase (e.g., compiled from the regex
"findbugs\\.jar$")
@param classPath
a classpath
@return full path of named codebase, or null if the codebase couldn't be
found | [
"Try",
"to",
"find",
"a",
"codebase",
"matching",
"the",
"given",
"pattern",
"in",
"the",
"given",
"class",
"path",
"string",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/util/ClassPathUtil.java#L75-L91 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.beginPatchAsync | public Observable<DatabaseAccountInner> beginPatchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) {
return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseAccountInner> beginPatchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) {
return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseAccountInner",
">",
"beginPatchAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"DatabaseAccountPatchParameters",
"updateParameters",
")",
"{",
"return",
"beginPatchWithServiceResponseAsync",
"(",
"resourceGr... | Patches the properties of an existing Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param updateParameters The tags parameter to patch for the current database account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseAccountInner object | [
"Patches",
"the",
"properties",
"of",
"an",
"existing",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L378-L385 |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java | DataStoreUtil.makeDoubleStorage | public static WritableDoubleDataStore makeDoubleStorage(DBIDs ids, int hints) {
return DataStoreFactory.FACTORY.makeDoubleStorage(ids, hints);
} | java | public static WritableDoubleDataStore makeDoubleStorage(DBIDs ids, int hints) {
return DataStoreFactory.FACTORY.makeDoubleStorage(ids, hints);
} | [
"public",
"static",
"WritableDoubleDataStore",
"makeDoubleStorage",
"(",
"DBIDs",
"ids",
",",
"int",
"hints",
")",
"{",
"return",
"DataStoreFactory",
".",
"FACTORY",
".",
"makeDoubleStorage",
"(",
"ids",
",",
"hints",
")",
";",
"}"
] | Make a new storage, to associate the given ids with an object of class
dataclass.
@param ids DBIDs to store data for
@param hints Hints for the storage manager
@return new data store | [
"Make",
"a",
"new",
"storage",
"to",
"associate",
"the",
"given",
"ids",
"with",
"an",
"object",
"of",
"class",
"dataclass",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java#L87-L89 |
twilio/twilio-java | src/main/java/com/twilio/http/Request.java | Request.addQueryDateTimeRange | public void addQueryDateTimeRange(final String name, final Range<DateTime> range) {
if (range.hasLowerBound()) {
String value = range.lowerEndpoint().toString(QUERY_STRING_DATE_TIME_FORMAT);
addQueryParam(name + ">", value);
}
if (range.hasUpperBound()) {
String value = range.upperEndpoint().toString(QUERY_STRING_DATE_TIME_FORMAT);
addQueryParam(name + "<", value);
}
} | java | public void addQueryDateTimeRange(final String name, final Range<DateTime> range) {
if (range.hasLowerBound()) {
String value = range.lowerEndpoint().toString(QUERY_STRING_DATE_TIME_FORMAT);
addQueryParam(name + ">", value);
}
if (range.hasUpperBound()) {
String value = range.upperEndpoint().toString(QUERY_STRING_DATE_TIME_FORMAT);
addQueryParam(name + "<", value);
}
} | [
"public",
"void",
"addQueryDateTimeRange",
"(",
"final",
"String",
"name",
",",
"final",
"Range",
"<",
"DateTime",
">",
"range",
")",
"{",
"if",
"(",
"range",
".",
"hasLowerBound",
"(",
")",
")",
"{",
"String",
"value",
"=",
"range",
".",
"lowerEndpoint",
... | Add query parameters for date ranges.
@param name name of query parameter
@param range date range | [
"Add",
"query",
"parameters",
"for",
"date",
"ranges",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/http/Request.java#L171-L181 |
wonderpush/wonderpush-android-sdk | sdk/src/main/java/com/wonderpush/sdk/WonderPushRestClient.java | WonderPushRestClient.postEventually | protected static void postEventually(String resource, RequestParams params) {
final Request request = new Request(WonderPushConfiguration.getUserId(), HttpMethod.POST, resource, params, null);
WonderPushRequestVault.getDefaultVault().put(request, 0);
} | java | protected static void postEventually(String resource, RequestParams params) {
final Request request = new Request(WonderPushConfiguration.getUserId(), HttpMethod.POST, resource, params, null);
WonderPushRequestVault.getDefaultVault().put(request, 0);
} | [
"protected",
"static",
"void",
"postEventually",
"(",
"String",
"resource",
",",
"RequestParams",
"params",
")",
"{",
"final",
"Request",
"request",
"=",
"new",
"Request",
"(",
"WonderPushConfiguration",
".",
"getUserId",
"(",
")",
",",
"HttpMethod",
".",
"POST"... | A POST request that is guaranteed to be executed when a network connection
is present, surviving application reboot. The responseHandler will be
called only if the network is present when the request is first run.
@param resource
The resource path, starting with /
@param params
AsyncHttpClient request parameters | [
"A",
"POST",
"request",
"that",
"is",
"guaranteed",
"to",
"be",
"executed",
"when",
"a",
"network",
"connection",
"is",
"present",
"surviving",
"application",
"reboot",
".",
"The",
"responseHandler",
"will",
"be",
"called",
"only",
"if",
"the",
"network",
"is"... | train | https://github.com/wonderpush/wonderpush-android-sdk/blob/ba0a1568f705cdd6206639bfab1e5cf529084b59/sdk/src/main/java/com/wonderpush/sdk/WonderPushRestClient.java#L115-L118 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/platform/InstalledApplicationsUrl.java | InstalledApplicationsUrl.getApplicationUrl | public static MozuUrl getApplicationUrl(String appId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/applications/{appId}?responseFields={responseFields}");
formatter.formatUrl("appId", appId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getApplicationUrl(String appId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/applications/{appId}?responseFields={responseFields}");
formatter.formatUrl("appId", appId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getApplicationUrl",
"(",
"String",
"appId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/applications/{appId}?responseFields={responseFields}\"",
")",
";",
"formatte... | Get Resource Url for GetApplication
@param appId appId parameter description DOCUMENT_HERE
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetApplication"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/InstalledApplicationsUrl.java#L22-L28 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java | MemoryMapArchiveBase.startsWith | private boolean startsWith(ArchivePath fullPath, ArchivePath startingPath) {
final String context = fullPath.get();
final String startingContext = startingPath.get();
return context.startsWith(startingContext);
} | java | private boolean startsWith(ArchivePath fullPath, ArchivePath startingPath) {
final String context = fullPath.get();
final String startingContext = startingPath.get();
return context.startsWith(startingContext);
} | [
"private",
"boolean",
"startsWith",
"(",
"ArchivePath",
"fullPath",
",",
"ArchivePath",
"startingPath",
")",
"{",
"final",
"String",
"context",
"=",
"fullPath",
".",
"get",
"(",
")",
";",
"final",
"String",
"startingContext",
"=",
"startingPath",
".",
"get",
"... | Check to see if one path starts with another
@param fullPath
@param startingPath
@return | [
"Check",
"to",
"see",
"if",
"one",
"path",
"starts",
"with",
"another"
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java#L449-L454 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_instance_instanceId_vnc_POST | public OvhInstanceVnc project_serviceName_instance_instanceId_vnc_POST(String serviceName, String instanceId) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/vnc";
StringBuilder sb = path(qPath, serviceName, instanceId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhInstanceVnc.class);
} | java | public OvhInstanceVnc project_serviceName_instance_instanceId_vnc_POST(String serviceName, String instanceId) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/vnc";
StringBuilder sb = path(qPath, serviceName, instanceId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhInstanceVnc.class);
} | [
"public",
"OvhInstanceVnc",
"project_serviceName_instance_instanceId_vnc_POST",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/instance/{instanceId}/vnc\"",
";",
"StringBuilder"... | Get VNC access to your instance
REST: POST /cloud/project/{serviceName}/instance/{instanceId}/vnc
@param instanceId [required] Instance id
@param serviceName [required] Project id | [
"Get",
"VNC",
"access",
"to",
"your",
"instance"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1987-L1992 |
lotaris/rox-client-junit | src/main/java/com/lotaris/rox/client/junit/AbstractRoxListener.java | AbstractRoxListener.getCategory | protected String getCategory(RoxableTestClass classAnnotation, RoxableTest methodAnnotation) {
if (methodAnnotation != null && methodAnnotation.category() != null && !methodAnnotation.category().isEmpty()) {
return methodAnnotation.category();
}
else if (classAnnotation != null && classAnnotation.category() != null && !classAnnotation.category().isEmpty()) {
return classAnnotation.category();
}
else if (configuration.getCategory() != null && !configuration.getCategory().isEmpty()) {
return configuration.getCategory();
}
else if (category != null) {
return category;
}
else {
return DEFAULT_CATEGORY;
}
} | java | protected String getCategory(RoxableTestClass classAnnotation, RoxableTest methodAnnotation) {
if (methodAnnotation != null && methodAnnotation.category() != null && !methodAnnotation.category().isEmpty()) {
return methodAnnotation.category();
}
else if (classAnnotation != null && classAnnotation.category() != null && !classAnnotation.category().isEmpty()) {
return classAnnotation.category();
}
else if (configuration.getCategory() != null && !configuration.getCategory().isEmpty()) {
return configuration.getCategory();
}
else if (category != null) {
return category;
}
else {
return DEFAULT_CATEGORY;
}
} | [
"protected",
"String",
"getCategory",
"(",
"RoxableTestClass",
"classAnnotation",
",",
"RoxableTest",
"methodAnnotation",
")",
"{",
"if",
"(",
"methodAnnotation",
"!=",
"null",
"&&",
"methodAnnotation",
".",
"category",
"(",
")",
"!=",
"null",
"&&",
"!",
"methodAn... | Retrieve the category to apply to the test
@param classAnnotation The roxable class annotation to get the override category
@param methodAnnotation The roxable annotation to get the override category
@return The category found | [
"Retrieve",
"the",
"category",
"to",
"apply",
"to",
"the",
"test"
] | train | https://github.com/lotaris/rox-client-junit/blob/1bc5fd99feb1a4467788128c9486737ad8e47bb8/src/main/java/com/lotaris/rox/client/junit/AbstractRoxListener.java#L202-L218 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/evaluation/EvaluationTools.java | EvaluationTools.rocChartToHtml | public static String rocChartToHtml(ROCMultiClass rocMultiClass, List<String> classNames) {
int n = rocMultiClass.getNumClasses();
List<Component> components = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
RocCurve roc = rocMultiClass.getRocCurve(i);
String headerText = "Class " + i;
if (classNames != null && classNames.size() > i) {
headerText += " (" + classNames.get(i) + ")";
}
headerText += " vs. All";;
Component headerDivPad = new ComponentDiv(HEADER_DIV_PAD_STYLE);
components.add(headerDivPad);
Component headerDivLeft = new ComponentDiv(HEADER_DIV_TEXT_PAD_STYLE);
Component headerDiv = new ComponentDiv(HEADER_DIV_STYLE, new ComponentText(headerText, HEADER_TEXT_STYLE));
Component c = getRocFromPoints(ROC_TITLE, roc, rocMultiClass.getCountActualPositive(i),
rocMultiClass.getCountActualNegative(i), rocMultiClass.calculateAUC(i),
rocMultiClass.calculateAUCPR(i));
Component c2 = getPRCharts(PR_TITLE, PR_THRESHOLD_TITLE, rocMultiClass.getPrecisionRecallCurve(i));
components.add(headerDivLeft);
components.add(headerDiv);
components.add(c);
components.add(c2);
}
return StaticPageUtil.renderHTML(components);
} | java | public static String rocChartToHtml(ROCMultiClass rocMultiClass, List<String> classNames) {
int n = rocMultiClass.getNumClasses();
List<Component> components = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
RocCurve roc = rocMultiClass.getRocCurve(i);
String headerText = "Class " + i;
if (classNames != null && classNames.size() > i) {
headerText += " (" + classNames.get(i) + ")";
}
headerText += " vs. All";;
Component headerDivPad = new ComponentDiv(HEADER_DIV_PAD_STYLE);
components.add(headerDivPad);
Component headerDivLeft = new ComponentDiv(HEADER_DIV_TEXT_PAD_STYLE);
Component headerDiv = new ComponentDiv(HEADER_DIV_STYLE, new ComponentText(headerText, HEADER_TEXT_STYLE));
Component c = getRocFromPoints(ROC_TITLE, roc, rocMultiClass.getCountActualPositive(i),
rocMultiClass.getCountActualNegative(i), rocMultiClass.calculateAUC(i),
rocMultiClass.calculateAUCPR(i));
Component c2 = getPRCharts(PR_TITLE, PR_THRESHOLD_TITLE, rocMultiClass.getPrecisionRecallCurve(i));
components.add(headerDivLeft);
components.add(headerDiv);
components.add(c);
components.add(c2);
}
return StaticPageUtil.renderHTML(components);
} | [
"public",
"static",
"String",
"rocChartToHtml",
"(",
"ROCMultiClass",
"rocMultiClass",
",",
"List",
"<",
"String",
">",
"classNames",
")",
"{",
"int",
"n",
"=",
"rocMultiClass",
".",
"getNumClasses",
"(",
")",
";",
"List",
"<",
"Component",
">",
"components",
... | Given a {@link ROCMultiClass} instance and (optionally) names for each class, render the ROC chart to a stand-alone
HTML file (returned as a String)
@param rocMultiClass ROC to render
@param classNames Names of the classes. May be null | [
"Given",
"a",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/evaluation/EvaluationTools.java#L166-L195 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterEncoder.java | CharacterEncoder.encodeBuffer | public void encodeBuffer(byte aBuffer[], OutputStream aStream)
throws IOException {
ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer);
encodeBuffer(inStream, aStream);
} | java | public void encodeBuffer(byte aBuffer[], OutputStream aStream)
throws IOException {
ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer);
encodeBuffer(inStream, aStream);
} | [
"public",
"void",
"encodeBuffer",
"(",
"byte",
"aBuffer",
"[",
"]",
",",
"OutputStream",
"aStream",
")",
"throws",
"IOException",
"{",
"ByteArrayInputStream",
"inStream",
"=",
"new",
"ByteArrayInputStream",
"(",
"aBuffer",
")",
";",
"encodeBuffer",
"(",
"inStream"... | Encode the buffer in <i>aBuffer</i> and write the encoded
result to the OutputStream <i>aStream</i>. | [
"Encode",
"the",
"buffer",
"in",
"<i",
">",
"aBuffer<",
"/",
"i",
">",
"and",
"write",
"the",
"encoded",
"result",
"to",
"the",
"OutputStream",
"<i",
">",
"aStream<",
"/",
"i",
">",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterEncoder.java#L309-L313 |
jhy/jsoup | src/main/java/org/jsoup/nodes/Entities.java | Entities.canEncode | private static boolean canEncode(final CoreCharset charset, final char c, final CharsetEncoder fallback) {
// todo add more charset tests if impacted by Android's bad perf in canEncode
switch (charset) {
case ascii:
return c < 0x80;
case utf:
return true; // real is:!(Character.isLowSurrogate(c) || Character.isHighSurrogate(c)); - but already check above
default:
return fallback.canEncode(c);
}
} | java | private static boolean canEncode(final CoreCharset charset, final char c, final CharsetEncoder fallback) {
// todo add more charset tests if impacted by Android's bad perf in canEncode
switch (charset) {
case ascii:
return c < 0x80;
case utf:
return true; // real is:!(Character.isLowSurrogate(c) || Character.isHighSurrogate(c)); - but already check above
default:
return fallback.canEncode(c);
}
} | [
"private",
"static",
"boolean",
"canEncode",
"(",
"final",
"CoreCharset",
"charset",
",",
"final",
"char",
"c",
",",
"final",
"CharsetEncoder",
"fallback",
")",
"{",
"// todo add more charset tests if impacted by Android's bad perf in canEncode",
"switch",
"(",
"charset",
... | /*
Provides a fast-path for Encoder.canEncode, which drastically improves performance on Android post JellyBean.
After KitKat, the implementation of canEncode degrades to the point of being useless. For non ASCII or UTF,
performance may be bad. We can add more encoders for common character sets that are impacted by performance
issues on Android if required.
Benchmarks: *
OLD toHtml() impl v New (fastpath) in millis
Wiki: 1895, 16
CNN: 6378, 55
Alterslash: 3013, 28
Jsoup: 167, 2 | [
"/",
"*",
"Provides",
"a",
"fast",
"-",
"path",
"for",
"Encoder",
".",
"canEncode",
"which",
"drastically",
"improves",
"performance",
"on",
"Android",
"post",
"JellyBean",
".",
"After",
"KitKat",
"the",
"implementation",
"of",
"canEncode",
"degrades",
"to",
"... | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Entities.java#L290-L300 |
hsiafan/requests | src/main/java/net/dongliu/requests/body/Part.java | Part.param | @Deprecated
public static Part<String> param(String name, String value) {
return text(name, value);
} | java | @Deprecated
public static Part<String> param(String name, String value) {
return text(name, value);
} | [
"@",
"Deprecated",
"public",
"static",
"Part",
"<",
"String",
">",
"param",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"return",
"text",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Create a (name, value) text multi-part field.
This return a part equivalent to <input type="text" /> field in multi part form.
@deprecated use {@link #text(String, String)} instead. | [
"Create",
"a",
"(",
"name",
"value",
")",
"text",
"multi",
"-",
"part",
"field",
".",
"This",
"return",
"a",
"part",
"equivalent",
"to",
"<",
";",
"input",
"type",
"=",
"text",
"/",
">",
";",
"field",
"in",
"multi",
"part",
"form",
"."
] | train | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/body/Part.java#L157-L160 |
landawn/AbacusUtil | src/com/landawn/abacus/util/FileSystemUtil.java | FileSystemUtil.freeSpaceOS | long freeSpaceOS(final String path, final int os, final boolean kb, final long timeout) throws IOException {
if (path == null) {
throw new IllegalArgumentException("Path must not be null");
}
switch (os) {
case WINDOWS:
return kb ? freeSpaceWindows(path, timeout) / 1024 : freeSpaceWindows(path, timeout);
case UNIX:
return freeSpaceUnix(path, kb, false, timeout);
case POSIX_UNIX:
return freeSpaceUnix(path, kb, true, timeout);
case OTHER:
throw new IllegalStateException("Unsupported operating system");
default:
throw new IllegalStateException("Exception caught when determining operating system");
}
} | java | long freeSpaceOS(final String path, final int os, final boolean kb, final long timeout) throws IOException {
if (path == null) {
throw new IllegalArgumentException("Path must not be null");
}
switch (os) {
case WINDOWS:
return kb ? freeSpaceWindows(path, timeout) / 1024 : freeSpaceWindows(path, timeout);
case UNIX:
return freeSpaceUnix(path, kb, false, timeout);
case POSIX_UNIX:
return freeSpaceUnix(path, kb, true, timeout);
case OTHER:
throw new IllegalStateException("Unsupported operating system");
default:
throw new IllegalStateException("Exception caught when determining operating system");
}
} | [
"long",
"freeSpaceOS",
"(",
"final",
"String",
"path",
",",
"final",
"int",
"os",
",",
"final",
"boolean",
"kb",
",",
"final",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgume... | Returns the free space on a drive or volume in a cross-platform manner.
Note that some OS's are NOT currently supported, including OS/390.
<pre>
FileSystemUtils.freeSpace("C:"); // Windows
FileSystemUtils.freeSpace("/volume"); // *nix
</pre>
The free space is calculated via the command line.
It uses 'dir /-c' on Windows and 'df' on *nix.
@param path the path to get free space for, not null, not empty on Unix
@param os the operating system code
@param kb whether to normalize to kilobytes
@param timeout The timeout amount in milliseconds or no timeout if the value
is zero or less
@return the amount of free drive space on the drive or volume
@throws IllegalArgumentException if the path is invalid
@throws IllegalStateException if an error occurred in initialisation
@throws IOException if an error occurs when finding the free space | [
"Returns",
"the",
"free",
"space",
"on",
"a",
"drive",
"or",
"volume",
"in",
"a",
"cross",
"-",
"platform",
"manner",
".",
"Note",
"that",
"some",
"OS",
"s",
"are",
"NOT",
"currently",
"supported",
"including",
"OS",
"/",
"390",
".",
"<pre",
">",
"File... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/FileSystemUtil.java#L220-L236 |
KayLerch/alexa-skills-kit-tellask-java | src/main/java/io/klerch/alexa/tellask/model/wrapper/AlexaRequestStreamHandler.java | AlexaRequestStreamHandler.handleRequest | @Override
public void handleRequest(final InputStream input, final OutputStream output, final Context context) throws IOException {
byte[] serializedSpeechletRequest = IOUtils.toByteArray(input);
final AlexaSpeechlet speechlet = AlexaSpeechletFactory.createSpeechletFromRequest(serializedSpeechletRequest, getSpeechlet(), getUtteranceReader());
final SpeechletRequestHandler handler = getRequestStreamHandler();
try {
byte[] outputBytes = handler.handleSpeechletCall(speechlet, serializedSpeechletRequest);
output.write(outputBytes);
} catch (SpeechletRequestHandlerException | SpeechletException e) {
// wrap actual exception in expected IOException
throw new IOException(e);
}
} | java | @Override
public void handleRequest(final InputStream input, final OutputStream output, final Context context) throws IOException {
byte[] serializedSpeechletRequest = IOUtils.toByteArray(input);
final AlexaSpeechlet speechlet = AlexaSpeechletFactory.createSpeechletFromRequest(serializedSpeechletRequest, getSpeechlet(), getUtteranceReader());
final SpeechletRequestHandler handler = getRequestStreamHandler();
try {
byte[] outputBytes = handler.handleSpeechletCall(speechlet, serializedSpeechletRequest);
output.write(outputBytes);
} catch (SpeechletRequestHandlerException | SpeechletException e) {
// wrap actual exception in expected IOException
throw new IOException(e);
}
} | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"InputStream",
"input",
",",
"final",
"OutputStream",
"output",
",",
"final",
"Context",
"context",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"serializedSpeechletRequest",
"=",
"IOUtils",... | The handler method is called on a Lambda execution.
@param input the input stream containing the Lambda request payload
@param output the output stream containing the Lambda response payload
@param context a context for a Lambda execution.
@throws IOException exception is thrown on invalid request payload or on a provided speechlet
handler having no public constructor taking a String containing the locale | [
"The",
"handler",
"method",
"is",
"called",
"on",
"a",
"Lambda",
"execution",
"."
] | train | https://github.com/KayLerch/alexa-skills-kit-tellask-java/blob/2c19028e775c2512dd4649d12962c0b48bf7f2bc/src/main/java/io/klerch/alexa/tellask/model/wrapper/AlexaRequestStreamHandler.java#L82-L94 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java | P2sVpnServerConfigurationsInner.beginDelete | public void beginDelete(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWanName",
",",
"String",
"p2SVpnServerConfigurationName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualWanName",
",",
"p2SVpnServerConfigurat... | Deletes a P2SVpnServerConfiguration.
@param resourceGroupName The resource group name of the P2SVpnServerConfiguration.
@param virtualWanName The name of the VirtualWan.
@param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"a",
"P2SVpnServerConfiguration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L450-L452 |
rundeck/rundeck | core/src/main/java/com/dtolabs/utils/Mapper.java | Mapper.makeMap | public static Map makeMap(Mapper mapper, Collection c) {
return makeMap(mapper, c.iterator(), false);
} | java | public static Map makeMap(Mapper mapper, Collection c) {
return makeMap(mapper, c.iterator(), false);
} | [
"public",
"static",
"Map",
"makeMap",
"(",
"Mapper",
"mapper",
",",
"Collection",
"c",
")",
"{",
"return",
"makeMap",
"(",
"mapper",
",",
"c",
".",
"iterator",
"(",
")",
",",
"false",
")",
";",
"}"
] | Create a new Map by using the collection objects as keys, and the mapping result as values. Discard keys which
return null values from the mapper.
@param mapper a Mapper to map the values
@param c Collection of items
@return a new Map with values mapped | [
"Create",
"a",
"new",
"Map",
"by",
"using",
"the",
"collection",
"objects",
"as",
"keys",
"and",
"the",
"mapping",
"result",
"as",
"values",
".",
"Discard",
"keys",
"which",
"return",
"null",
"values",
"from",
"the",
"mapper",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L519-L521 |
unbescape/unbescape | src/main/java/org/unbescape/html/HtmlEscape.java | HtmlEscape.escapeHtml4Xml | public static void escapeHtml4Xml(final Reader reader, final Writer writer)
throws IOException {
escapeHtml(reader, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL,
HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | java | public static void escapeHtml4Xml(final Reader reader, final Writer writer)
throws IOException {
escapeHtml(reader, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL,
HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | [
"public",
"static",
"void",
"escapeHtml4Xml",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeHtml",
"(",
"reader",
",",
"writer",
",",
"HtmlEscapeType",
".",
"HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL",
... | <p>
Perform an HTML 4 level 1 (XML-style) <strong>escape</strong> operation on a <tt>Reader</tt> input,
writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 1</em> means this method will only escape the five markup-significant characters:
<tt><</tt>, <tt>></tt>, <tt>&</tt>, <tt>"</tt> and <tt>'</tt>. It is called
<em>XML-style</em> in order to link it with JSP's <tt>escapeXml</tt> attribute in JSTL's
<tt><c:out ... /></tt> tags.
</p>
<p>
Note this method may <strong>not</strong> produce the same results as {@link #escapeHtml5Xml(Reader, Writer)} because
it will escape the apostrophe as <tt>&#39;</tt>, whereas in HTML5 there is a specific NCR for
such character (<tt>&apos;</tt>).
</p>
<p>
This method calls {@link #escapeHtml(Reader, Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following
preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link org.unbescape.html.HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li>
<li><tt>level</tt>:
{@link org.unbescape.html.HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"an",
"HTML",
"4",
"level",
"1",
"(",
"XML",
"-",
"style",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">"... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L771-L775 |
atomix/atomix | utils/src/main/java/io/atomix/utils/serializer/SerializerBuilder.java | SerializerBuilder.addSerializer | public SerializerBuilder addSerializer(com.esotericsoftware.kryo.Serializer serializer, Class<?>... types) {
namespaceBuilder.register(serializer, types);
return this;
} | java | public SerializerBuilder addSerializer(com.esotericsoftware.kryo.Serializer serializer, Class<?>... types) {
namespaceBuilder.register(serializer, types);
return this;
} | [
"public",
"SerializerBuilder",
"addSerializer",
"(",
"com",
".",
"esotericsoftware",
".",
"kryo",
".",
"Serializer",
"serializer",
",",
"Class",
"<",
"?",
">",
"...",
"types",
")",
"{",
"namespaceBuilder",
".",
"register",
"(",
"serializer",
",",
"types",
")",... | Adds a serializer to the builder.
@param serializer the serializer to add
@param types the serializable types
@return the serializer builder | [
"Adds",
"a",
"serializer",
"to",
"the",
"builder",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/utils/src/main/java/io/atomix/utils/serializer/SerializerBuilder.java#L117-L120 |
code4everything/util | src/main/java/com/zhazhapan/util/Checker.java | Checker.replace | public static String replace(String string, char oldChar, char newChar) {
return checkNull(string).replace(oldChar, newChar);
} | java | public static String replace(String string, char oldChar, char newChar) {
return checkNull(string).replace(oldChar, newChar);
} | [
"public",
"static",
"String",
"replace",
"(",
"String",
"string",
",",
"char",
"oldChar",
",",
"char",
"newChar",
")",
"{",
"return",
"checkNull",
"(",
"string",
")",
".",
"replace",
"(",
"oldChar",
",",
"newChar",
")",
";",
"}"
] | 替换字符之前检查字符串是否为空
@param string 需要检测的字符串
@param oldChar 需要替换的字符
@param newChar 新的字符
@return {@link String} | [
"替换字符之前检查字符串是否为空"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L821-L823 |
jhalterman/failsafe | src/main/java/net/jodah/failsafe/CircuitBreaker.java | CircuitBreaker.withSuccessThreshold | public CircuitBreaker<R> withSuccessThreshold(int successThreshold) {
Assert.isTrue(successThreshold >= 1, "successThreshold must be greater than or equal to 1");
return withSuccessThreshold(successThreshold, successThreshold);
} | java | public CircuitBreaker<R> withSuccessThreshold(int successThreshold) {
Assert.isTrue(successThreshold >= 1, "successThreshold must be greater than or equal to 1");
return withSuccessThreshold(successThreshold, successThreshold);
} | [
"public",
"CircuitBreaker",
"<",
"R",
">",
"withSuccessThreshold",
"(",
"int",
"successThreshold",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"successThreshold",
">=",
"1",
",",
"\"successThreshold must be greater than or equal to 1\"",
")",
";",
"return",
"withSuccessThre... | Sets the number of successive successful executions that must occur when in a half-open state in order to close the
circuit, else the circuit is re-opened when a failure occurs.
@throws IllegalArgumentException if {@code successThreshold} < 1 | [
"Sets",
"the",
"number",
"of",
"successive",
"successful",
"executions",
"that",
"must",
"occur",
"when",
"in",
"a",
"half",
"-",
"open",
"state",
"in",
"order",
"to",
"close",
"the",
"circuit",
"else",
"the",
"circuit",
"is",
"re",
"-",
"opened",
"when",
... | train | https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/CircuitBreaker.java#L328-L331 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeEnum | @Pure
public static <T extends Enum<T>> T getAttributeEnum(Node document, Class<T> type, boolean caseSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeEnumWithDefault(document, type, caseSensitive, null, path);
} | java | @Pure
public static <T extends Enum<T>> T getAttributeEnum(Node document, Class<T> type, boolean caseSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeEnumWithDefault(document, type, caseSensitive, null, path);
} | [
"@",
"Pure",
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"getAttributeEnum",
"(",
"Node",
"document",
",",
"Class",
"<",
"T",
">",
"type",
",",
"boolean",
"caseSensitive",
",",
"String",
"...",
"path",
")",
"{",
"assert",
... | Read an enumeration value.
@param <T> is the type of the enumeration.
@param document is the XML document to explore.
@param type is the type of the enumeration.
@param caseSensitive indicates of the {@code path}'s components are case sensitive.
@param path is the list of and ended by the attribute's name.
@return the value of the enumeration or <code>null</code> if none. | [
"Read",
"an",
"enumeration",
"value",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L651-L655 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java | GoogleDriveUtils.exportSpreadsheet | public static DownloadResponse exportSpreadsheet(Drive drive, String fileId) throws IOException {
try (InputStream inputStream = drive.files().export(fileId, "text/csv").executeAsInputStream()) {
CSVRenderer csvRenderer = new CSVRenderer(inputStream, "google-spreadsheet", true);
return new DownloadResponse(TEXT_HTML, csvRenderer.renderHtmlTable().getBytes("UTF-8"));
}
} | java | public static DownloadResponse exportSpreadsheet(Drive drive, String fileId) throws IOException {
try (InputStream inputStream = drive.files().export(fileId, "text/csv").executeAsInputStream()) {
CSVRenderer csvRenderer = new CSVRenderer(inputStream, "google-spreadsheet", true);
return new DownloadResponse(TEXT_HTML, csvRenderer.renderHtmlTable().getBytes("UTF-8"));
}
} | [
"public",
"static",
"DownloadResponse",
"exportSpreadsheet",
"(",
"Drive",
"drive",
",",
"String",
"fileId",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"inputStream",
"=",
"drive",
".",
"files",
"(",
")",
".",
"export",
"(",
"fileId",
",",
... | Exports a spreadsheet in HTML format
@param drive drive client
@param fileId file id for file to be exported
@return Spreadsheet in HTML format
@throws IOException thrown when exporting fails unexpectedly | [
"Exports",
"a",
"spreadsheet",
"in",
"HTML",
"format"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java#L304-L309 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.klDivergence | public static <E> double klDivergence(Counter<E> from, Counter<E> to) {
double result = 0.0;
double tot = (from.totalCount());
double tot2 = (to.totalCount());
// System.out.println("tot is " + tot + " tot2 is " + tot2);
for (E key : from.keySet()) {
double num = (from.getCount(key));
if (num == 0) {
continue;
}
num /= tot;
double num2 = (to.getCount(key));
num2 /= tot2;
// System.out.println("num is " + num + " num2 is " + num2);
double logFract = Math.log(num / num2);
if (logFract == Double.NEGATIVE_INFINITY) {
return Double.NEGATIVE_INFINITY; // can't recover
}
result += num * (logFract / LOG_E_2); // express it in log base 2
}
return result;
} | java | public static <E> double klDivergence(Counter<E> from, Counter<E> to) {
double result = 0.0;
double tot = (from.totalCount());
double tot2 = (to.totalCount());
// System.out.println("tot is " + tot + " tot2 is " + tot2);
for (E key : from.keySet()) {
double num = (from.getCount(key));
if (num == 0) {
continue;
}
num /= tot;
double num2 = (to.getCount(key));
num2 /= tot2;
// System.out.println("num is " + num + " num2 is " + num2);
double logFract = Math.log(num / num2);
if (logFract == Double.NEGATIVE_INFINITY) {
return Double.NEGATIVE_INFINITY; // can't recover
}
result += num * (logFract / LOG_E_2); // express it in log base 2
}
return result;
} | [
"public",
"static",
"<",
"E",
">",
"double",
"klDivergence",
"(",
"Counter",
"<",
"E",
">",
"from",
",",
"Counter",
"<",
"E",
">",
"to",
")",
"{",
"double",
"result",
"=",
"0.0",
";",
"double",
"tot",
"=",
"(",
"from",
".",
"totalCount",
"(",
")",
... | Calculates the KL divergence between the two counters. That is, it
calculates KL(from || to). This method internally uses normalized counts
(so they sum to one), but the value returned is meaningless if any of the
counts are negative. In other words, how well can c1 be represented by c2.
if there is some value in c1 that gets zero prob in c2, then return
positive infinity.
@return The KL divergence between the distributions | [
"Calculates",
"the",
"KL",
"divergence",
"between",
"the",
"two",
"counters",
".",
"That",
"is",
"it",
"calculates",
"KL",
"(",
"from",
"||",
"to",
")",
".",
"This",
"method",
"internally",
"uses",
"normalized",
"counts",
"(",
"so",
"they",
"sum",
"to",
... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1205-L1226 |
amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.toMap | public <K, V> Map<K, V> toMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valMapper) {
Map<K, V> map = isParallel() ? new ConcurrentHashMap<>() : new HashMap<>();
return toMapThrowing(keyMapper, valMapper, map);
} | java | public <K, V> Map<K, V> toMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valMapper) {
Map<K, V> map = isParallel() ? new ConcurrentHashMap<>() : new HashMap<>();
return toMapThrowing(keyMapper, valMapper, map);
} | [
"public",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"toMap",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"keyMapper",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"V",
">",
"valMapper"... | Returns a {@link Map} whose keys and values are the result of applying
the provided mapping functions to the input elements.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
<p>
Returned {@code Map} is guaranteed to be modifiable.
<p>
For parallel stream the concurrent {@code Map} is created.
@param <K> the output type of the key mapping function
@param <V> the output type of the value mapping function
@param keyMapper a mapping function to produce keys
@param valMapper a mapping function to produce values
@return a {@code Map} whose keys and values are the result of applying
mapping functions to the input elements
@throws IllegalStateException if duplicate mapped key is found (according
to {@link Object#equals(Object)})
@see Collectors#toMap(Function, Function)
@see Collectors#toConcurrentMap(Function, Function)
@see #toMap(Function) | [
"Returns",
"a",
"{",
"@link",
"Map",
"}",
"whose",
"keys",
"and",
"values",
"are",
"the",
"result",
"of",
"applying",
"the",
"provided",
"mapping",
"functions",
"to",
"the",
"input",
"elements",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L961-L964 |
pwall567/jsonutil | src/main/java/net/pwall/json/JSONObject.java | JSONObject.putValue | public JSONObject putValue(String key, int value) {
put(key, JSONInteger.valueOf(value));
return this;
} | java | public JSONObject putValue(String key, int value) {
put(key, JSONInteger.valueOf(value));
return this;
} | [
"public",
"JSONObject",
"putValue",
"(",
"String",
"key",
",",
"int",
"value",
")",
"{",
"put",
"(",
"key",
",",
"JSONInteger",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a {@link JSONInteger} representing the supplied {@code int} to the
{@code JSONObject}.
@param key the key to use when storing the value
@param value the value
@return {@code this} (for chaining)
@throws NullPointerException if key is {@code null} | [
"Add",
"a",
"{",
"@link",
"JSONInteger",
"}",
"representing",
"the",
"supplied",
"{",
"@code",
"int",
"}",
"to",
"the",
"{",
"@code",
"JSONObject",
"}",
"."
] | train | https://github.com/pwall567/jsonutil/blob/dd5960b9b0bcc9acfe6c52b884fffd9ee5f422fe/src/main/java/net/pwall/json/JSONObject.java#L117-L120 |
googlearchive/firebase-simple-login-java | src/main/java/com/firebase/simplelogin/SimpleLogin.java | SimpleLogin.removeUser | public void removeUser(String email, String password, final SimpleLoginCompletionHandler handler) {
final SimpleLoginAuthenticatedHandler authHandler = new SimpleLoginAuthenticatedHandler() {
public void authenticated(FirebaseSimpleLoginError error, FirebaseSimpleLoginUser user) {
handler.completed(error, false);
}
};
if (!Validation.isValidEmail(email)) {
handleInvalidEmail(authHandler);
}
else if (!Validation.isValidPassword(password)) {
handleInvalidPassword(authHandler);
}
else {
HashMap<String, String> data = new HashMap<String, String>();
data.put("email", email);
data.put("password", password);
makeRequest(Constants.FIREBASE_AUTH_REMOVEUSER_PATH, data, new RequestHandler() {
public void handle(FirebaseSimpleLoginError error, JSONObject data) {
if(error != null) {
handler.completed(error, false);
}
else {
try {
JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null;
if(errorDetails != null) {
handler.completed(FirebaseSimpleLoginError.errorFromResponse(errorDetails), false);
}
else {
handler.completed(null, true);
}
}
catch (JSONException e) {
e.printStackTrace();
FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
handler.completed(theError, false);
}
}
}
});
}
} | java | public void removeUser(String email, String password, final SimpleLoginCompletionHandler handler) {
final SimpleLoginAuthenticatedHandler authHandler = new SimpleLoginAuthenticatedHandler() {
public void authenticated(FirebaseSimpleLoginError error, FirebaseSimpleLoginUser user) {
handler.completed(error, false);
}
};
if (!Validation.isValidEmail(email)) {
handleInvalidEmail(authHandler);
}
else if (!Validation.isValidPassword(password)) {
handleInvalidPassword(authHandler);
}
else {
HashMap<String, String> data = new HashMap<String, String>();
data.put("email", email);
data.put("password", password);
makeRequest(Constants.FIREBASE_AUTH_REMOVEUSER_PATH, data, new RequestHandler() {
public void handle(FirebaseSimpleLoginError error, JSONObject data) {
if(error != null) {
handler.completed(error, false);
}
else {
try {
JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null;
if(errorDetails != null) {
handler.completed(FirebaseSimpleLoginError.errorFromResponse(errorDetails), false);
}
else {
handler.completed(null, true);
}
}
catch (JSONException e) {
e.printStackTrace();
FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
handler.completed(theError, false);
}
}
}
});
}
} | [
"public",
"void",
"removeUser",
"(",
"String",
"email",
",",
"String",
"password",
",",
"final",
"SimpleLoginCompletionHandler",
"handler",
")",
"{",
"final",
"SimpleLoginAuthenticatedHandler",
"authHandler",
"=",
"new",
"SimpleLoginAuthenticatedHandler",
"(",
")",
"{",... | Remove a Firebase "email/password" user.
@param email Email address for user.
@param password Password for user.
@param handler Handler for asynchronous events. | [
"Remove",
"a",
"Firebase",
"email",
"/",
"password",
"user",
"."
] | train | https://github.com/googlearchive/firebase-simple-login-java/blob/40498ad173b5fa69c869ba0d29cec187271fda13/src/main/java/com/firebase/simplelogin/SimpleLogin.java#L460-L502 |
tvesalainen/util | util/src/main/java/org/vesalainen/util/concurrent/RingbufferSupport.java | RingbufferSupport.getBuffers | public ByteBuffer[] getBuffers(int start, int len)
{
if (len == 0)
{
return ar0;
}
if (len > capacity)
{
throw new IllegalArgumentException("len="+len+" > capacity="+capacity);
}
int s = start % capacity;
int e = (start+len) % capacity;
return getBuffersForSpan(s, e);
} | java | public ByteBuffer[] getBuffers(int start, int len)
{
if (len == 0)
{
return ar0;
}
if (len > capacity)
{
throw new IllegalArgumentException("len="+len+" > capacity="+capacity);
}
int s = start % capacity;
int e = (start+len) % capacity;
return getBuffersForSpan(s, e);
} | [
"public",
"ByteBuffer",
"[",
"]",
"getBuffers",
"(",
"int",
"start",
",",
"int",
"len",
")",
"{",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"ar0",
";",
"}",
"if",
"(",
"len",
">",
"capacity",
")",
"{",
"throw",
"new",
"IllegalArgumentException... | Returns array of buffers that contains ringbuffers content in array of
ByteBuffers ready for scattering read of gathering write
@param start
@param len
@return
@see java.nio.channels.ScatteringByteChannel
@see java.nio.channels.GatheringByteChannel | [
"Returns",
"array",
"of",
"buffers",
"that",
"contains",
"ringbuffers",
"content",
"in",
"array",
"of",
"ByteBuffers",
"ready",
"for",
"scattering",
"read",
"of",
"gathering",
"write"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/RingbufferSupport.java#L59-L72 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java | CmsDefaultXmlContentHandler.createSearchFieldMapping | private I_CmsSearchFieldMapping createSearchFieldMapping(
CmsXmlContentDefinition contentDefinition,
Element element,
Locale locale)
throws CmsXmlException {
I_CmsSearchFieldMapping fieldMapping = null;
String typeAsString = element.attributeValue(APPINFO_ATTR_TYPE);
CmsSearchFieldMappingType type = CmsSearchFieldMappingType.valueOf(typeAsString);
switch (type.getMode()) {
case 0: // content
case 3: // item
// localized
String param = locale.toString() + "|" + element.getStringValue();
fieldMapping = new CmsSearchFieldMapping(type, param);
break;
case 1: // property
case 2: // property-search
case 5: // attribute
// not localized
fieldMapping = new CmsSearchFieldMapping(type, element.getStringValue());
break;
case 4: // dynamic
String mappingClass = element.attributeValue(APPINFO_ATTR_CLASS);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(mappingClass)) {
try {
fieldMapping = (I_CmsSearchFieldMapping)Class.forName(mappingClass).newInstance();
fieldMapping.setType(CmsSearchFieldMappingType.DYNAMIC);
fieldMapping.setParam(element.getStringValue());
} catch (Exception e) {
throw new CmsXmlException(
Messages.get().container(
Messages.ERR_XML_SCHEMA_MAPPING_CLASS_NOT_EXIST_3,
mappingClass,
contentDefinition.getTypeName(),
contentDefinition.getSchemaLocation()));
}
}
break;
default:
// NOOP
}
if (fieldMapping != null) {
fieldMapping.setDefaultValue(element.attributeValue(APPINFO_ATTR_DEFAULT));
}
return fieldMapping;
} | java | private I_CmsSearchFieldMapping createSearchFieldMapping(
CmsXmlContentDefinition contentDefinition,
Element element,
Locale locale)
throws CmsXmlException {
I_CmsSearchFieldMapping fieldMapping = null;
String typeAsString = element.attributeValue(APPINFO_ATTR_TYPE);
CmsSearchFieldMappingType type = CmsSearchFieldMappingType.valueOf(typeAsString);
switch (type.getMode()) {
case 0: // content
case 3: // item
// localized
String param = locale.toString() + "|" + element.getStringValue();
fieldMapping = new CmsSearchFieldMapping(type, param);
break;
case 1: // property
case 2: // property-search
case 5: // attribute
// not localized
fieldMapping = new CmsSearchFieldMapping(type, element.getStringValue());
break;
case 4: // dynamic
String mappingClass = element.attributeValue(APPINFO_ATTR_CLASS);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(mappingClass)) {
try {
fieldMapping = (I_CmsSearchFieldMapping)Class.forName(mappingClass).newInstance();
fieldMapping.setType(CmsSearchFieldMappingType.DYNAMIC);
fieldMapping.setParam(element.getStringValue());
} catch (Exception e) {
throw new CmsXmlException(
Messages.get().container(
Messages.ERR_XML_SCHEMA_MAPPING_CLASS_NOT_EXIST_3,
mappingClass,
contentDefinition.getTypeName(),
contentDefinition.getSchemaLocation()));
}
}
break;
default:
// NOOP
}
if (fieldMapping != null) {
fieldMapping.setDefaultValue(element.attributeValue(APPINFO_ATTR_DEFAULT));
}
return fieldMapping;
} | [
"private",
"I_CmsSearchFieldMapping",
"createSearchFieldMapping",
"(",
"CmsXmlContentDefinition",
"contentDefinition",
",",
"Element",
"element",
",",
"Locale",
"locale",
")",
"throws",
"CmsXmlException",
"{",
"I_CmsSearchFieldMapping",
"fieldMapping",
"=",
"null",
";",
"St... | Creates a search field mapping for the given mapping element and the locale.<p>
@param contentDefinition the content definition
@param element the mapping element configured in the schema
@param locale the locale
@return the created search field mapping
@throws CmsXmlException if the dynamic field class could not be found | [
"Creates",
"a",
"search",
"field",
"mapping",
"for",
"the",
"given",
"mapping",
"element",
"and",
"the",
"locale",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L3923-L3970 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/infrastructure/RestrictionValidator.java | RestrictionValidator.validatePattern | public static void validatePattern(String pattern, String string){
if (!string.replaceAll(pattern, "").equals(string)){
throw new RestrictionViolationException("Violation of pattern restriction, the string doesn't math the acceptable pattern, which is " + pattern);
}
} | java | public static void validatePattern(String pattern, String string){
if (!string.replaceAll(pattern, "").equals(string)){
throw new RestrictionViolationException("Violation of pattern restriction, the string doesn't math the acceptable pattern, which is " + pattern);
}
} | [
"public",
"static",
"void",
"validatePattern",
"(",
"String",
"pattern",
",",
"String",
"string",
")",
"{",
"if",
"(",
"!",
"string",
".",
"replaceAll",
"(",
"pattern",
",",
"\"\"",
")",
".",
"equals",
"(",
"string",
")",
")",
"{",
"throw",
"new",
"Res... | Validates if the received {@code string} matches the pattern.
@param pattern The restriction pattern.
@param string The {@link String} that should match the restriction pattern. | [
"Validates",
"if",
"the",
"received",
"{"
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/infrastructure/RestrictionValidator.java#L159-L163 |
hawkular/hawkular-apm | api/src/main/java/org/hawkular/apm/api/utils/PropertyUtil.java | PropertyUtil.getPropertyAsInteger | public static Integer getPropertyAsInteger(String name, Integer def) {
String value = getProperty(name);
if (value != null) {
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
LOG.log(Level.WARNING, "Failed to convert property value '" + value + "' to integer", e);
}
}
return def;
} | java | public static Integer getPropertyAsInteger(String name, Integer def) {
String value = getProperty(name);
if (value != null) {
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
LOG.log(Level.WARNING, "Failed to convert property value '" + value + "' to integer", e);
}
}
return def;
} | [
"public",
"static",
"Integer",
"getPropertyAsInteger",
"(",
"String",
"name",
",",
"Integer",
"def",
")",
"{",
"String",
"value",
"=",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"Integer",
".",... | This method returns the property as an integer value.
@param name The property name
@param def The optional default value
@return The property as an integer, or null if not found | [
"This",
"method",
"returns",
"the",
"property",
"as",
"an",
"integer",
"value",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/utils/PropertyUtil.java#L286-L296 |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ConfigurationAdminImpl.java | ConfigurationAdminImpl.createFactoryConfiguration | @Override
public ExtendedConfiguration createFactoryConfiguration(String factoryPid, String location) throws IOException {
this.caFactory.checkConfigurationPermission();
ExtendedConfiguration config = caFactory.getConfigurationStore().createFactoryConfiguration(factoryPid, location);
return config;
} | java | @Override
public ExtendedConfiguration createFactoryConfiguration(String factoryPid, String location) throws IOException {
this.caFactory.checkConfigurationPermission();
ExtendedConfiguration config = caFactory.getConfigurationStore().createFactoryConfiguration(factoryPid, location);
return config;
} | [
"@",
"Override",
"public",
"ExtendedConfiguration",
"createFactoryConfiguration",
"(",
"String",
"factoryPid",
",",
"String",
"location",
")",
"throws",
"IOException",
"{",
"this",
".",
"caFactory",
".",
"checkConfigurationPermission",
"(",
")",
";",
"ExtendedConfigurat... | /*
@see
org.osgi.service.cm.ConfigurationAdmin#createFactoryConfiguration(java.
lang.String, java.lang.String)
In this call, create Configuration objects bound to the specified location,
instead of the location
of the calling bundle.
@param factoryPid
@param location | [
"/",
"*",
"@see",
"org",
".",
"osgi",
".",
"service",
".",
"cm",
".",
"ConfigurationAdmin#createFactoryConfiguration",
"(",
"java",
".",
"lang",
".",
"String",
"java",
".",
"lang",
".",
"String",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ConfigurationAdminImpl.java#L84-L89 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java | CPDefinitionSpecificationOptionValuePersistenceImpl.removeByC_COC | @Override
public void removeByC_COC(long CPDefinitionId, long CPOptionCategoryId) {
for (CPDefinitionSpecificationOptionValue cpDefinitionSpecificationOptionValue : findByC_COC(
CPDefinitionId, CPOptionCategoryId, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null)) {
remove(cpDefinitionSpecificationOptionValue);
}
} | java | @Override
public void removeByC_COC(long CPDefinitionId, long CPOptionCategoryId) {
for (CPDefinitionSpecificationOptionValue cpDefinitionSpecificationOptionValue : findByC_COC(
CPDefinitionId, CPOptionCategoryId, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null)) {
remove(cpDefinitionSpecificationOptionValue);
}
} | [
"@",
"Override",
"public",
"void",
"removeByC_COC",
"(",
"long",
"CPDefinitionId",
",",
"long",
"CPOptionCategoryId",
")",
"{",
"for",
"(",
"CPDefinitionSpecificationOptionValue",
"cpDefinitionSpecificationOptionValue",
":",
"findByC_COC",
"(",
"CPDefinitionId",
",",
"CPO... | Removes all the cp definition specification option values where CPDefinitionId = ? and CPOptionCategoryId = ? from the database.
@param CPDefinitionId the cp definition ID
@param CPOptionCategoryId the cp option category ID | [
"Removes",
"all",
"the",
"cp",
"definition",
"specification",
"option",
"values",
"where",
"CPDefinitionId",
"=",
"?",
";",
"and",
"CPOptionCategoryId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java#L4134-L4141 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/DialogFactory.java | DialogFactory.getDetailsAsHTML | private String getDetailsAsHTML(String title, Level level, Throwable e) {
if (e != null) {
// convert the stacktrace into a more pleasent bit of HTML
StringBuffer html = new StringBuffer("<html>");
html.append("<h2>" + escapeXml(title) + "</h2>");
html.append("<HR size='1' noshade>");
html.append("<div></div>");
html.append("<b>Message:</b>");
html.append("<pre>");
html.append(" " + escapeXml(e.toString()));
html.append("</pre>");
html.append("<b>Level:</b>");
html.append("<pre>");
html.append(" " + level);
html.append("</pre>");
html.append("<b>Stack Trace:</b>");
html.append("<pre>");
for (StackTraceElement el : e.getStackTrace()) {
html.append(" " + el.toString().replace("<init>", "<init>") + "\n");
}
if (e.getCause() != null) {
html.append("</pre>");
html.append("<b>Cause:</b>");
html.append("<pre>");
html.append(e.getCause().getMessage());
html.append("</pre><pre>");
for (StackTraceElement el : e.getCause().getStackTrace()) {
html.append(" " + el.toString().replace("<init>", "<init>") + "\n");
}
}
html.append("</pre></html>");
return html.toString();
} else {
return null;
}
} | java | private String getDetailsAsHTML(String title, Level level, Throwable e) {
if (e != null) {
// convert the stacktrace into a more pleasent bit of HTML
StringBuffer html = new StringBuffer("<html>");
html.append("<h2>" + escapeXml(title) + "</h2>");
html.append("<HR size='1' noshade>");
html.append("<div></div>");
html.append("<b>Message:</b>");
html.append("<pre>");
html.append(" " + escapeXml(e.toString()));
html.append("</pre>");
html.append("<b>Level:</b>");
html.append("<pre>");
html.append(" " + level);
html.append("</pre>");
html.append("<b>Stack Trace:</b>");
html.append("<pre>");
for (StackTraceElement el : e.getStackTrace()) {
html.append(" " + el.toString().replace("<init>", "<init>") + "\n");
}
if (e.getCause() != null) {
html.append("</pre>");
html.append("<b>Cause:</b>");
html.append("<pre>");
html.append(e.getCause().getMessage());
html.append("</pre><pre>");
for (StackTraceElement el : e.getCause().getStackTrace()) {
html.append(" " + el.toString().replace("<init>", "<init>") + "\n");
}
}
html.append("</pre></html>");
return html.toString();
} else {
return null;
}
} | [
"private",
"String",
"getDetailsAsHTML",
"(",
"String",
"title",
",",
"Level",
"level",
",",
"Throwable",
"e",
")",
"{",
"if",
"(",
"e",
"!=",
"null",
")",
"{",
"// convert the stacktrace into a more pleasent bit of HTML",
"StringBuffer",
"html",
"=",
"new",
"Stri... | Creates and returns HTML representing the details of this incident info. This method is only called if
the details needs to be generated: ie: the detailed error message property of the incident info is
null. | [
"Creates",
"and",
"returns",
"HTML",
"representing",
"the",
"details",
"of",
"this",
"incident",
"info",
".",
"This",
"method",
"is",
"only",
"called",
"if",
"the",
"details",
"needs",
"to",
"be",
"generated",
":",
"ie",
":",
"the",
"detailed",
"error",
"m... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/DialogFactory.java#L108-L143 |
alexvasilkov/AndroidCommons | library/src/main/java/com/alexvasilkov/android/commons/ui/KeyboardHelper.java | KeyboardHelper.hideSoftKeyboard | public static void hideSoftKeyboard(@NonNull Context context, @Nullable View focusedView) {
if (focusedView == null) {
return;
}
final InputMethodManager manager = (InputMethodManager)
context.getSystemService(Context.INPUT_METHOD_SERVICE);
manager.hideSoftInputFromWindow(focusedView.getWindowToken(), 0);
focusedView.clearFocus();
} | java | public static void hideSoftKeyboard(@NonNull Context context, @Nullable View focusedView) {
if (focusedView == null) {
return;
}
final InputMethodManager manager = (InputMethodManager)
context.getSystemService(Context.INPUT_METHOD_SERVICE);
manager.hideSoftInputFromWindow(focusedView.getWindowToken(), 0);
focusedView.clearFocus();
} | [
"public",
"static",
"void",
"hideSoftKeyboard",
"(",
"@",
"NonNull",
"Context",
"context",
",",
"@",
"Nullable",
"View",
"focusedView",
")",
"{",
"if",
"(",
"focusedView",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"InputMethodManager",
"manager",
... | Uses given views to hide soft keyboard and to clear current focus.
@param context Context
@param focusedView Currently focused view | [
"Uses",
"given",
"views",
"to",
"hide",
"soft",
"keyboard",
"and",
"to",
"clear",
"current",
"focus",
"."
] | train | https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/ui/KeyboardHelper.java#L34-L44 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRule.java | NFRule.extractSubstitution | private NFSubstitution extractSubstitution(NFRuleSet owner,
NFRule predecessor) {
NFSubstitution result;
int subStart;
int subEnd;
// search the rule's rule text for the first two characters of
// a substitution token
subStart = indexOfAnyRulePrefix(ruleText);
// if we didn't find one, create a null substitution positioned
// at the end of the rule text
if (subStart == -1) {
return null;
}
// special-case the ">>>" token, since searching for the > at the
// end will actually find the > in the middle
if (ruleText.startsWith(">>>", subStart)) {
subEnd = subStart + 2;
}
else {
// otherwise the substitution token ends with the same character
// it began with
char c = ruleText.charAt(subStart);
subEnd = ruleText.indexOf(c, subStart + 1);
// special case for '<%foo<<'
if (c == '<' && subEnd != -1 && subEnd < ruleText.length() - 1 && ruleText.charAt(subEnd+1) == c) {
// ordinals use "=#,##0==%abbrev=" as their rule. Notice that the '==' in the middle
// occurs because of the juxtaposition of two different rules. The check for '<' is a hack
// to get around this. Having the duplicate at the front would cause problems with
// rules like "<<%" to format, say, percents...
++subEnd;
}
}
// if we don't find the end of the token (i.e., if we're on a single,
// unmatched token character), create a null substitution positioned
// at the end of the rule
if (subEnd == -1) {
return null;
}
// if we get here, we have a real substitution token (or at least
// some text bounded by substitution token characters). Use
// makeSubstitution() to create the right kind of substitution
result = NFSubstitution.makeSubstitution(subStart, this, predecessor, owner,
this.formatter, ruleText.substring(subStart, subEnd + 1));
// remove the substitution from the rule text
ruleText = ruleText.substring(0, subStart) + ruleText.substring(subEnd + 1);
return result;
} | java | private NFSubstitution extractSubstitution(NFRuleSet owner,
NFRule predecessor) {
NFSubstitution result;
int subStart;
int subEnd;
// search the rule's rule text for the first two characters of
// a substitution token
subStart = indexOfAnyRulePrefix(ruleText);
// if we didn't find one, create a null substitution positioned
// at the end of the rule text
if (subStart == -1) {
return null;
}
// special-case the ">>>" token, since searching for the > at the
// end will actually find the > in the middle
if (ruleText.startsWith(">>>", subStart)) {
subEnd = subStart + 2;
}
else {
// otherwise the substitution token ends with the same character
// it began with
char c = ruleText.charAt(subStart);
subEnd = ruleText.indexOf(c, subStart + 1);
// special case for '<%foo<<'
if (c == '<' && subEnd != -1 && subEnd < ruleText.length() - 1 && ruleText.charAt(subEnd+1) == c) {
// ordinals use "=#,##0==%abbrev=" as their rule. Notice that the '==' in the middle
// occurs because of the juxtaposition of two different rules. The check for '<' is a hack
// to get around this. Having the duplicate at the front would cause problems with
// rules like "<<%" to format, say, percents...
++subEnd;
}
}
// if we don't find the end of the token (i.e., if we're on a single,
// unmatched token character), create a null substitution positioned
// at the end of the rule
if (subEnd == -1) {
return null;
}
// if we get here, we have a real substitution token (or at least
// some text bounded by substitution token characters). Use
// makeSubstitution() to create the right kind of substitution
result = NFSubstitution.makeSubstitution(subStart, this, predecessor, owner,
this.formatter, ruleText.substring(subStart, subEnd + 1));
// remove the substitution from the rule text
ruleText = ruleText.substring(0, subStart) + ruleText.substring(subEnd + 1);
return result;
} | [
"private",
"NFSubstitution",
"extractSubstitution",
"(",
"NFRuleSet",
"owner",
",",
"NFRule",
"predecessor",
")",
"{",
"NFSubstitution",
"result",
";",
"int",
"subStart",
";",
"int",
"subEnd",
";",
"// search the rule's rule text for the first two characters of",
"// a subs... | Searches the rule's rule text for the first substitution token,
creates a substitution based on it, and removes the token from
the rule's rule text.
@param owner The rule set containing this rule
@param predecessor The rule preceding this one in the rule set's
rule list
@return The newly-created substitution. This is never null; if
the rule text doesn't contain any substitution tokens, this will
be a NullSubstitution. | [
"Searches",
"the",
"rule",
"s",
"rule",
"text",
"for",
"the",
"first",
"substitution",
"token",
"creates",
"a",
"substitution",
"based",
"on",
"it",
"and",
"removes",
"the",
"token",
"from",
"the",
"rule",
"s",
"rule",
"text",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRule.java#L464-L516 |
MenoData/Time4J | base/src/main/java/net/time4j/range/DateInterval.java | DateInterval.streamDaily | public Stream<PlainDate> streamDaily() {
if (this.isEmpty()) {
return Stream.empty();
}
DateInterval interval = this.toCanonical();
PlainDate start = interval.getStartAsCalendarDate();
PlainDate end = interval.getEndAsCalendarDate();
if ((start == null) || (end == null)) {
throw new IllegalStateException("Streaming is not supported for infinite intervals.");
}
return StreamSupport.stream(new DailySpliterator(start, end), false);
} | java | public Stream<PlainDate> streamDaily() {
if (this.isEmpty()) {
return Stream.empty();
}
DateInterval interval = this.toCanonical();
PlainDate start = interval.getStartAsCalendarDate();
PlainDate end = interval.getEndAsCalendarDate();
if ((start == null) || (end == null)) {
throw new IllegalStateException("Streaming is not supported for infinite intervals.");
}
return StreamSupport.stream(new DailySpliterator(start, end), false);
} | [
"public",
"Stream",
"<",
"PlainDate",
">",
"streamDaily",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Stream",
".",
"empty",
"(",
")",
";",
"}",
"DateInterval",
"interval",
"=",
"this",
".",
"toCanonical",
"(",
")... | /*[deutsch]
<p>Erzeugt einen {@code Stream}, der über jedes Kalenderdatum der kanonischen Form
dieses Intervalls geht. </p>
@return daily stream
@throws IllegalStateException if this interval is infinite or if there is no canonical form
@see #toCanonical()
@see #streamDaily(PlainDate, PlainDate)
@since 4.18 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Erzeugt",
"einen",
"{",
"@code",
"Stream",
"}",
"der",
"ü",
";",
"ber",
"jedes",
"Kalenderdatum",
"der",
"kanonischen",
"Form",
"dieses",
"Intervalls",
"geht",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/DateInterval.java#L797-L813 |
jhalterman/failsafe | src/main/java/net/jodah/failsafe/FailsafeExecutor.java | FailsafeExecutor.runAsync | public CompletableFuture<Void> runAsync(CheckedRunnable runnable) {
return callAsync(execution -> Functions.promiseOf(runnable, execution), false);
} | java | public CompletableFuture<Void> runAsync(CheckedRunnable runnable) {
return callAsync(execution -> Functions.promiseOf(runnable, execution), false);
} | [
"public",
"CompletableFuture",
"<",
"Void",
">",
"runAsync",
"(",
"CheckedRunnable",
"runnable",
")",
"{",
"return",
"callAsync",
"(",
"execution",
"->",
"Functions",
".",
"promiseOf",
"(",
"runnable",
",",
"execution",
")",
",",
"false",
")",
";",
"}"
] | Executes the {@code runnable} asynchronously until successful or until the configured policies are exceeded.
<p>
If a configured circuit breaker is open, the resulting future is completed with {@link
CircuitBreakerOpenException}.
@throws NullPointerException if the {@code runnable} is null
@throws RejectedExecutionException if the {@code runnable} cannot be scheduled for execution | [
"Executes",
"the",
"{",
"@code",
"runnable",
"}",
"asynchronously",
"until",
"successful",
"or",
"until",
"the",
"configured",
"policies",
"are",
"exceeded",
".",
"<p",
">",
"If",
"a",
"configured",
"circuit",
"breaker",
"is",
"open",
"the",
"resulting",
"futu... | train | https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/FailsafeExecutor.java#L241-L243 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/libs/modules/HMModel.java | HMModel.dumpRaster | public void dumpRaster( GridCoverage2D raster, String source ) throws Exception {
if (raster == null || source == null)
return;
OmsRasterWriter writer = new OmsRasterWriter();
writer.pm = pm;
writer.inRaster = raster;
writer.file = source;
writer.process();
} | java | public void dumpRaster( GridCoverage2D raster, String source ) throws Exception {
if (raster == null || source == null)
return;
OmsRasterWriter writer = new OmsRasterWriter();
writer.pm = pm;
writer.inRaster = raster;
writer.file = source;
writer.process();
} | [
"public",
"void",
"dumpRaster",
"(",
"GridCoverage2D",
"raster",
",",
"String",
"source",
")",
"throws",
"Exception",
"{",
"if",
"(",
"raster",
"==",
"null",
"||",
"source",
"==",
"null",
")",
"return",
";",
"OmsRasterWriter",
"writer",
"=",
"new",
"OmsRaste... | Fast default writing of raster to source.
<p>Mind that if either raster or source are <code>null</code>, the method will
return without warning.</p>
@param raster the {@link GridCoverage2D} to write.
@param source the source to which to write to.
@throws Exception | [
"Fast",
"default",
"writing",
"of",
"raster",
"to",
"source",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/HMModel.java#L321-L329 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java | QrCodePositionPatternDetector.checkPositionPatternAppearance | boolean checkPositionPatternAppearance( Polygon2D_F64 square , float grayThreshold ) {
return( checkLine(square,grayThreshold,0) || checkLine(square,grayThreshold,1));
} | java | boolean checkPositionPatternAppearance( Polygon2D_F64 square , float grayThreshold ) {
return( checkLine(square,grayThreshold,0) || checkLine(square,grayThreshold,1));
} | [
"boolean",
"checkPositionPatternAppearance",
"(",
"Polygon2D_F64",
"square",
",",
"float",
"grayThreshold",
")",
"{",
"return",
"(",
"checkLine",
"(",
"square",
",",
"grayThreshold",
",",
"0",
")",
"||",
"checkLine",
"(",
"square",
",",
"grayThreshold",
",",
"1"... | Determines if the found polygon looks like a position pattern. A horizontal and vertical line are sampled.
At each sample point it is marked if it is above or below the binary threshold for this square. Location
of sample points is found by "removing" perspective distortion.
@param square Position pattern square. | [
"Determines",
"if",
"the",
"found",
"polygon",
"looks",
"like",
"a",
"position",
"pattern",
".",
"A",
"horizontal",
"and",
"vertical",
"line",
"are",
"sampled",
".",
"At",
"each",
"sample",
"point",
"it",
"is",
"marked",
"if",
"it",
"is",
"above",
"or",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java#L331-L333 |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java | CurrencyHelper.parseCurrencyFormat | @Nullable
public static BigDecimal parseCurrencyFormat (@Nullable final ECurrency eCurrency,
@Nullable final String sTextValue,
@Nullable final BigDecimal aDefault)
{
final PerCurrencySettings aPCS = getSettings (eCurrency);
final DecimalFormat aCurrencyFormat = aPCS.getCurrencyFormat ();
// Adopt the decimal separator
final String sRealTextValue;
// In Java 9 onwards, this the separators may be null (e.g. for AED)
if (aPCS.getDecimalSeparator () != null && aPCS.getGroupingSeparator () != null)
sRealTextValue = _getTextValueForDecimalSeparator (sTextValue,
aPCS.getDecimalSeparator (),
aPCS.getGroupingSeparator ());
else
sRealTextValue = sTextValue;
return parseCurrency (sRealTextValue, aCurrencyFormat, aDefault, aPCS.getRoundingMode ());
} | java | @Nullable
public static BigDecimal parseCurrencyFormat (@Nullable final ECurrency eCurrency,
@Nullable final String sTextValue,
@Nullable final BigDecimal aDefault)
{
final PerCurrencySettings aPCS = getSettings (eCurrency);
final DecimalFormat aCurrencyFormat = aPCS.getCurrencyFormat ();
// Adopt the decimal separator
final String sRealTextValue;
// In Java 9 onwards, this the separators may be null (e.g. for AED)
if (aPCS.getDecimalSeparator () != null && aPCS.getGroupingSeparator () != null)
sRealTextValue = _getTextValueForDecimalSeparator (sTextValue,
aPCS.getDecimalSeparator (),
aPCS.getGroupingSeparator ());
else
sRealTextValue = sTextValue;
return parseCurrency (sRealTextValue, aCurrencyFormat, aDefault, aPCS.getRoundingMode ());
} | [
"@",
"Nullable",
"public",
"static",
"BigDecimal",
"parseCurrencyFormat",
"(",
"@",
"Nullable",
"final",
"ECurrency",
"eCurrency",
",",
"@",
"Nullable",
"final",
"String",
"sTextValue",
",",
"@",
"Nullable",
"final",
"BigDecimal",
"aDefault",
")",
"{",
"final",
... | Try to parse a string value formatted by the {@link NumberFormat} object
returned from {@link #getCurrencyFormat(ECurrency)}. E.g.
<code>€ 5,00</code>
@param eCurrency
The currency it is about. If <code>null</code> is provided
{@link #DEFAULT_CURRENCY} is used instead.
@param sTextValue
The string value. It will be trimmed, and the decimal separator will
be adopted.
@param aDefault
The default value to be used in case parsing fails. May be
<code>null</code>.
@return The {@link BigDecimal} value matching the string value or the
passed default value. | [
"Try",
"to",
"parse",
"a",
"string",
"value",
"formatted",
"by",
"the",
"{",
"@link",
"NumberFormat",
"}",
"object",
"returned",
"from",
"{",
"@link",
"#getCurrencyFormat",
"(",
"ECurrency",
")",
"}",
".",
"E",
".",
"g",
".",
"<code",
">",
"&euro",
";",
... | train | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L466-L484 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/TypeParameterSubstitutor.java | TypeParameterSubstitutor.visitTypeArgument | protected LightweightTypeReference visitTypeArgument(LightweightTypeReference reference, Visiting visiting) {
return visitTypeArgument(reference, visiting, false);
} | java | protected LightweightTypeReference visitTypeArgument(LightweightTypeReference reference, Visiting visiting) {
return visitTypeArgument(reference, visiting, false);
} | [
"protected",
"LightweightTypeReference",
"visitTypeArgument",
"(",
"LightweightTypeReference",
"reference",
",",
"Visiting",
"visiting",
")",
"{",
"return",
"visitTypeArgument",
"(",
"reference",
",",
"visiting",
",",
"false",
")",
";",
"}"
] | This is equivalent to {@code visitTypeArgument(reference, visiting, false)}.
@see #visitTypeArgument(LightweightTypeReference, Object, boolean) | [
"This",
"is",
"equivalent",
"to",
"{",
"@code",
"visitTypeArgument",
"(",
"reference",
"visiting",
"false",
")",
"}",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/TypeParameterSubstitutor.java#L95-L97 |
OpenTSDB/opentsdb | src/tree/TreeBuilder.java | TreeBuilder.processParsedValue | private void processParsedValue(final String parsed_value) {
if (rule.getCompiledRegex() == null &&
(rule.getSeparator() == null || rule.getSeparator().isEmpty())) {
// we don't have a regex and we don't need to separate, so just use the
// name of the timseries
setCurrentName(parsed_value, parsed_value);
} else if (rule.getCompiledRegex() != null) {
// we have a regex rule, so deal with it
processRegexRule(parsed_value);
} else if (rule.getSeparator() != null && !rule.getSeparator().isEmpty()) {
// we have a split rule, so deal with it
processSplit(parsed_value);
} else {
throw new IllegalStateException("Unable to find a processor for rule: " +
rule);
}
} | java | private void processParsedValue(final String parsed_value) {
if (rule.getCompiledRegex() == null &&
(rule.getSeparator() == null || rule.getSeparator().isEmpty())) {
// we don't have a regex and we don't need to separate, so just use the
// name of the timseries
setCurrentName(parsed_value, parsed_value);
} else if (rule.getCompiledRegex() != null) {
// we have a regex rule, so deal with it
processRegexRule(parsed_value);
} else if (rule.getSeparator() != null && !rule.getSeparator().isEmpty()) {
// we have a split rule, so deal with it
processSplit(parsed_value);
} else {
throw new IllegalStateException("Unable to find a processor for rule: " +
rule);
}
} | [
"private",
"void",
"processParsedValue",
"(",
"final",
"String",
"parsed_value",
")",
"{",
"if",
"(",
"rule",
".",
"getCompiledRegex",
"(",
")",
"==",
"null",
"&&",
"(",
"rule",
".",
"getSeparator",
"(",
")",
"==",
"null",
"||",
"rule",
".",
"getSeparator"... | Routes the parsed value to the proper processing method for altering the
display name depending on the current rule. This can route to the regex
handler or the split processor. Or if neither splits or regex are specified
for the rule, the parsed value is set as the branch name.
@param parsed_value The value parsed from the calling parser method
@throws IllegalStateException if a valid processor couldn't be found. This
should never happen but you never know. | [
"Routes",
"the",
"parsed",
"value",
"to",
"the",
"proper",
"processing",
"method",
"for",
"altering",
"the",
"display",
"name",
"depending",
"on",
"the",
"current",
"rule",
".",
"This",
"can",
"route",
"to",
"the",
"regex",
"handler",
"or",
"the",
"split",
... | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/TreeBuilder.java#L932-L948 |
elki-project/elki | elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/DatabaseEventManager.java | DatabaseEventManager.fireResultAdded | public void fireResultAdded(Result r, Result parent) {
for(int i = resultListenerList.size(); --i >= 0;) {
resultListenerList.get(i).resultAdded(r, parent);
}
} | java | public void fireResultAdded(Result r, Result parent) {
for(int i = resultListenerList.size(); --i >= 0;) {
resultListenerList.get(i).resultAdded(r, parent);
}
} | [
"public",
"void",
"fireResultAdded",
"(",
"Result",
"r",
",",
"Result",
"parent",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"resultListenerList",
".",
"size",
"(",
")",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"resultListenerList",
".",
"get",
"(",
"i"... | Informs all registered <code>ResultListener</code> that a new result was
added.
@param r New child result added
@param parent Parent result that was added to | [
"Informs",
"all",
"registered",
"<code",
">",
"ResultListener<",
"/",
"code",
">",
"that",
"a",
"new",
"result",
"was",
"added",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/DatabaseEventManager.java#L312-L316 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftsInner.java | RunbookDraftsInner.getAsync | public Observable<RunbookDraftInner> getAsync(String resourceGroupName, String automationAccountName, String runbookName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName).map(new Func1<ServiceResponse<RunbookDraftInner>, RunbookDraftInner>() {
@Override
public RunbookDraftInner call(ServiceResponse<RunbookDraftInner> response) {
return response.body();
}
});
} | java | public Observable<RunbookDraftInner> getAsync(String resourceGroupName, String automationAccountName, String runbookName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName).map(new Func1<ServiceResponse<RunbookDraftInner>, RunbookDraftInner>() {
@Override
public RunbookDraftInner call(ServiceResponse<RunbookDraftInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RunbookDraftInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"runbookName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccoun... | Retrieve the runbook draft identified by runbook name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param runbookName The runbook name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RunbookDraftInner object | [
"Retrieve",
"the",
"runbook",
"draft",
"identified",
"by",
"runbook",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftsInner.java#L400-L407 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java | JoinPoint.timeout | public synchronized void timeout(long millis, Runnable callback) {
if (isUnblocked()) return;
Task<Void,NoException> task = new Task.Cpu<Void,NoException>("JoinPoint timeout", Task.PRIORITY_RATHER_LOW) {
@Override
public Void run() {
synchronized (JoinPoint.this) {
if (isUnblocked()) return null;
if (callback != null)
try { callback.run(); }
catch (Throwable t) {
LCCore.getApplication().getDefaultLogger().error("Error in callback of JoinPoint timeout", t);
}
unblock();
return null;
}
}
};
task.executeIn(millis);
if (isUnblocked()) return;
task.start();
} | java | public synchronized void timeout(long millis, Runnable callback) {
if (isUnblocked()) return;
Task<Void,NoException> task = new Task.Cpu<Void,NoException>("JoinPoint timeout", Task.PRIORITY_RATHER_LOW) {
@Override
public Void run() {
synchronized (JoinPoint.this) {
if (isUnblocked()) return null;
if (callback != null)
try { callback.run(); }
catch (Throwable t) {
LCCore.getApplication().getDefaultLogger().error("Error in callback of JoinPoint timeout", t);
}
unblock();
return null;
}
}
};
task.executeIn(millis);
if (isUnblocked()) return;
task.start();
} | [
"public",
"synchronized",
"void",
"timeout",
"(",
"long",
"millis",
",",
"Runnable",
"callback",
")",
"{",
"if",
"(",
"isUnblocked",
"(",
")",
")",
"return",
";",
"Task",
"<",
"Void",
",",
"NoException",
">",
"task",
"=",
"new",
"Task",
".",
"Cpu",
"<"... | Should be used only for debugging purpose, as a JoinPoint is supposed to always become unblocked.<br/>
This method will wait for the given milliseconds, if at this time the JoinPoint is already unblocked,
nothing is done, else we force it to become unblocked, and the given callback is called if any. | [
"Should",
"be",
"used",
"only",
"for",
"debugging",
"purpose",
"as",
"a",
"JoinPoint",
"is",
"supposed",
"to",
"always",
"become",
"unblocked",
".",
"<br",
"/",
">",
"This",
"method",
"will",
"wait",
"for",
"the",
"given",
"milliseconds",
"if",
"at",
"this... | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java#L143-L163 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/rng/deallocator/NativeRandomDeallocator.java | NativeRandomDeallocator.trackStatePointer | public void trackStatePointer(NativePack random) {
if (random.getStatePointer() != null) {
GarbageStateReference reference = new GarbageStateReference(random, queue);
referenceMap.put(random.getStatePointer().address(), reference);
}
} | java | public void trackStatePointer(NativePack random) {
if (random.getStatePointer() != null) {
GarbageStateReference reference = new GarbageStateReference(random, queue);
referenceMap.put(random.getStatePointer().address(), reference);
}
} | [
"public",
"void",
"trackStatePointer",
"(",
"NativePack",
"random",
")",
"{",
"if",
"(",
"random",
".",
"getStatePointer",
"(",
")",
"!=",
"null",
")",
"{",
"GarbageStateReference",
"reference",
"=",
"new",
"GarbageStateReference",
"(",
"random",
",",
"queue",
... | This method is used internally from NativeRandom deallocators
This method doesn't accept Random interface implementations intentionally.
@param random | [
"This",
"method",
"is",
"used",
"internally",
"from",
"NativeRandom",
"deallocators",
"This",
"method",
"doesn",
"t",
"accept",
"Random",
"interface",
"implementations",
"intentionally",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/rng/deallocator/NativeRandomDeallocator.java#L65-L70 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/dc/TransferThreadManager.java | TransferThreadManager.activeConnect | public void activeConnect(HostPort hp, int connections) {
for (int i = 0; i < connections; i++) {
SocketBox sbox = new ManagedSocketBox();
logger.debug("adding new empty socketBox to the socket pool");
socketPool.add(sbox);
logger.debug(
"connecting active socket "
+ i
+ "; total cached sockets = "
+ socketPool.count());
Task task =
new GridFTPActiveConnectTask(
hp,
localControlChannel,
sbox,
gSession);
runTask(task);
}
} | java | public void activeConnect(HostPort hp, int connections) {
for (int i = 0; i < connections; i++) {
SocketBox sbox = new ManagedSocketBox();
logger.debug("adding new empty socketBox to the socket pool");
socketPool.add(sbox);
logger.debug(
"connecting active socket "
+ i
+ "; total cached sockets = "
+ socketPool.count());
Task task =
new GridFTPActiveConnectTask(
hp,
localControlChannel,
sbox,
gSession);
runTask(task);
}
} | [
"public",
"void",
"activeConnect",
"(",
"HostPort",
"hp",
",",
"int",
"connections",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"connections",
";",
"i",
"++",
")",
"{",
"SocketBox",
"sbox",
"=",
"new",
"ManagedSocketBox",
"(",
")",
";... | Act as the active side. Connect to the server and
store the newly connected sockets in the socketPool. | [
"Act",
"as",
"the",
"active",
"side",
".",
"Connect",
"to",
"the",
"server",
"and",
"store",
"the",
"newly",
"connected",
"sockets",
"in",
"the",
"socketPool",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/dc/TransferThreadManager.java#L59-L81 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.