repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/MetatagsRecord.java | MetatagsRecord.setMetatags | public void setMetatags(Map<String, String> metatags, String key) {
if (metatags != null) {
TSDBEntity.validateTags(metatags);
_metatags.clear();
_metatags.putAll(metatags);
_key = key;
}
} | java | public void setMetatags(Map<String, String> metatags, String key) {
if (metatags != null) {
TSDBEntity.validateTags(metatags);
_metatags.clear();
_metatags.putAll(metatags);
_key = key;
}
} | [
"public",
"void",
"setMetatags",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"metatags",
",",
"String",
"key",
")",
"{",
"if",
"(",
"metatags",
"!=",
"null",
")",
"{",
"TSDBEntity",
".",
"validateTags",
"(",
"metatags",
")",
";",
"_metatags",
".",
"... | Replaces the metatags for a metric. Metatags cannot use any of the reserved tag names.
@param metatags A key-value pairs of metatags. Cannot be null or empty.
@param key A unique identifier to be used while indexing this metatags into a schema db. | [
"Replaces",
"the",
"metatags",
"for",
"a",
"metric",
".",
"Metatags",
"cannot",
"use",
"any",
"of",
"the",
"reserved",
"tag",
"names",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/MetatagsRecord.java#L97-L104 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java | JsApiMessageImpl.getMQMDSetPropertiesMap | final JsMsgMap getMQMDSetPropertiesMap() {
if (mqMdSetPropertiesMap == null) {
// There will not usually be any set MQMD properties, so the JMF choice defaults to
// to empty (and will definitely be empty if the message has arrived from a
// pre-v7 WAS). This is different from the other maps which default to empty lists.
if (getHdr2().getChoiceField(JsHdr2Access.MQMDPROPERTIES) == JsHdr2Access.IS_MQMDPROPERTIES_MAP) {
List<String> keys = (List<String>) getHdr2().getField(JsHdr2Access.MQMDPROPERTIES_MAP_NAME);
List<Object> values = (List<Object>) getHdr2().getField(JsHdr2Access.MQMDPROPERTIES_MAP_VALUE);
mqMdSetPropertiesMap = new JsMsgMap(keys, values);
}
else {
mqMdSetPropertiesMap = new JsMsgMap(null, null);
}
}
return mqMdSetPropertiesMap;
} | java | final JsMsgMap getMQMDSetPropertiesMap() {
if (mqMdSetPropertiesMap == null) {
// There will not usually be any set MQMD properties, so the JMF choice defaults to
// to empty (and will definitely be empty if the message has arrived from a
// pre-v7 WAS). This is different from the other maps which default to empty lists.
if (getHdr2().getChoiceField(JsHdr2Access.MQMDPROPERTIES) == JsHdr2Access.IS_MQMDPROPERTIES_MAP) {
List<String> keys = (List<String>) getHdr2().getField(JsHdr2Access.MQMDPROPERTIES_MAP_NAME);
List<Object> values = (List<Object>) getHdr2().getField(JsHdr2Access.MQMDPROPERTIES_MAP_VALUE);
mqMdSetPropertiesMap = new JsMsgMap(keys, values);
}
else {
mqMdSetPropertiesMap = new JsMsgMap(null, null);
}
}
return mqMdSetPropertiesMap;
} | [
"final",
"JsMsgMap",
"getMQMDSetPropertiesMap",
"(",
")",
"{",
"if",
"(",
"mqMdSetPropertiesMap",
"==",
"null",
")",
"{",
"// There will not usually be any set MQMD properties, so the JMF choice defaults to",
"// to empty (and will definitely be empty if the message has arrived from a",
... | Helper method used by the main Message Property methods to obtain any
JMS_IBM_MQMD_ Properties explicitly set, in the form of a map.
<p>
The method has package level visibility as it is used by JsJmsMessageImpl
and JsSdoMessageimpl.
@return A JsMsgMap containing the Message Property name-value pairs. | [
"Helper",
"method",
"used",
"by",
"the",
"main",
"Message",
"Property",
"methods",
"to",
"obtain",
"any",
"JMS_IBM_MQMD_",
"Properties",
"explicitly",
"set",
"in",
"the",
"form",
"of",
"a",
"map",
".",
"<p",
">",
"The",
"method",
"has",
"package",
"level",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L932-L947 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/store/BaseHashMap.java | BaseHashMap.getAccessCountCeiling | public int getAccessCountCeiling(int count, int margin) {
return ArrayCounter.rank(accessTable, hashIndex.newNodePointer, count,
accessMin + 1, accessCount, margin);
} | java | public int getAccessCountCeiling(int count, int margin) {
return ArrayCounter.rank(accessTable, hashIndex.newNodePointer, count,
accessMin + 1, accessCount, margin);
} | [
"public",
"int",
"getAccessCountCeiling",
"(",
"int",
"count",
",",
"int",
"margin",
")",
"{",
"return",
"ArrayCounter",
".",
"rank",
"(",
"accessTable",
",",
"hashIndex",
".",
"newNodePointer",
",",
"count",
",",
"accessMin",
"+",
"1",
",",
"accessCount",
"... | Return the max accessCount value for count elements with the lowest
access count. Always return at least accessMin + 1 | [
"Return",
"the",
"max",
"accessCount",
"value",
"for",
"count",
"elements",
"with",
"the",
"lowest",
"access",
"count",
".",
"Always",
"return",
"at",
"least",
"accessMin",
"+",
"1"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/store/BaseHashMap.java#L1098-L1101 |
aliyun/fc-java-sdk | src/main/java/com/aliyuncs/fc/client/DefaultFcClient.java | DefaultFcClient.concatQueryString | public String concatQueryString(Map<String, String> parameters)
throws UnsupportedEncodingException {
if (null == parameters) {
return null;
}
StringBuilder urlBuilder = new StringBuilder("");
for (Map.Entry<String, String> entry : parameters.entrySet()) {
String key = entry.getKey();
String val = entry.getValue();
urlBuilder.append(encode(key));
if (val != null) {
urlBuilder.append("=").append(encode(val));
}
urlBuilder.append("&");
}
int strIndex = urlBuilder.length();
if (parameters.size() > 0) {
urlBuilder.deleteCharAt(strIndex - 1);
}
return urlBuilder.toString();
} | java | public String concatQueryString(Map<String, String> parameters)
throws UnsupportedEncodingException {
if (null == parameters) {
return null;
}
StringBuilder urlBuilder = new StringBuilder("");
for (Map.Entry<String, String> entry : parameters.entrySet()) {
String key = entry.getKey();
String val = entry.getValue();
urlBuilder.append(encode(key));
if (val != null) {
urlBuilder.append("=").append(encode(val));
}
urlBuilder.append("&");
}
int strIndex = urlBuilder.length();
if (parameters.size() > 0) {
urlBuilder.deleteCharAt(strIndex - 1);
}
return urlBuilder.toString();
} | [
"public",
"String",
"concatQueryString",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"throws",
"UnsupportedEncodingException",
"{",
"if",
"(",
"null",
"==",
"parameters",
")",
"{",
"return",
"null",
";",
"}",
"StringBuilder",
"urlBuilder",
... | concate query string parameters (e.g. name=foo)
@param parameters query parameters
@return concatenated query string
@throws UnsupportedEncodingException exceptions | [
"concate",
"query",
"string",
"parameters",
"(",
"e",
".",
"g",
".",
"name",
"=",
"foo",
")"
] | train | https://github.com/aliyun/fc-java-sdk/blob/45ee0cbff93d4ea7eaa87fc08fd18ac176df2dfe/src/main/java/com/aliyuncs/fc/client/DefaultFcClient.java#L90-L113 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java | WebSiteManagementClientImpl.validateMove | public void validateMove(String resourceGroupName, CsmMoveResourceEnvelope moveResourceEnvelope) {
validateMoveWithServiceResponseAsync(resourceGroupName, moveResourceEnvelope).toBlocking().single().body();
} | java | public void validateMove(String resourceGroupName, CsmMoveResourceEnvelope moveResourceEnvelope) {
validateMoveWithServiceResponseAsync(resourceGroupName, moveResourceEnvelope).toBlocking().single().body();
} | [
"public",
"void",
"validateMove",
"(",
"String",
"resourceGroupName",
",",
"CsmMoveResourceEnvelope",
"moveResourceEnvelope",
")",
"{",
"validateMoveWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"moveResourceEnvelope",
")",
".",
"toBlocking",
"(",
")",
".",
"s... | Validate whether a resource can be moved.
Validate whether a resource can be moved.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param moveResourceEnvelope Object that represents the resource to move.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Validate",
"whether",
"a",
"resource",
"can",
"be",
"moved",
".",
"Validate",
"whether",
"a",
"resource",
"can",
"be",
"moved",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L2330-L2332 |
javalite/activejdbc | javalite-common/src/main/java/org/javalite/common/Util.java | Util.saveTo | public static void saveTo(String path, byte[] content) {
InputStream is = null;
try {
is = new ByteArrayInputStream(content);
saveTo(path, is);
} finally {
closeQuietly(is);
}
} | java | public static void saveTo(String path, byte[] content) {
InputStream is = null;
try {
is = new ByteArrayInputStream(content);
saveTo(path, is);
} finally {
closeQuietly(is);
}
} | [
"public",
"static",
"void",
"saveTo",
"(",
"String",
"path",
",",
"byte",
"[",
"]",
"content",
")",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"content",
")",
";",
"saveTo",
"(",
"path",
",",
... | Saves content of byte array to file.
@param path path to file - can be absolute or relative to current.
@param content bytes to save. | [
"Saves",
"content",
"of",
"byte",
"array",
"to",
"file",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L456-L464 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java | MPD9AbstractReader.processOutlineCodeField | protected void processOutlineCodeField(Integer entityID, Row row)
{
processField(row, "OC_FIELD_ID", entityID, row.getString("OC_NAME"));
} | java | protected void processOutlineCodeField(Integer entityID, Row row)
{
processField(row, "OC_FIELD_ID", entityID, row.getString("OC_NAME"));
} | [
"protected",
"void",
"processOutlineCodeField",
"(",
"Integer",
"entityID",
",",
"Row",
"row",
")",
"{",
"processField",
"(",
"row",
",",
"\"OC_FIELD_ID\"",
",",
"entityID",
",",
"row",
".",
"getString",
"(",
"\"OC_NAME\"",
")",
")",
";",
"}"
] | Read a single outline code field extended attribute.
@param entityID parent entity
@param row field data | [
"Read",
"a",
"single",
"outline",
"code",
"field",
"extended",
"attribute",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L703-L706 |
lessthanoptimal/BoofCV | applications/src/main/java/boofcv/app/calib/ImageSelectorAndSaver.java | ImageSelectorAndSaver.process | public synchronized void process(GrayF32 image, List<Point2D_F64> sides) {
if( sides.size() != 4 )
throw new IllegalArgumentException("Expected 4 sidesCollision");
updateScore(image,sides);
if( currentScore < bestScore ) {
bestScore = currentScore;
if( bestImage == null ) {
bestImage = new BufferedImage(image.getWidth(), image.getHeight(),BufferedImage.TYPE_INT_RGB);
}
ConvertBufferedImage.convertTo(image,bestImage);
}
} | java | public synchronized void process(GrayF32 image, List<Point2D_F64> sides) {
if( sides.size() != 4 )
throw new IllegalArgumentException("Expected 4 sidesCollision");
updateScore(image,sides);
if( currentScore < bestScore ) {
bestScore = currentScore;
if( bestImage == null ) {
bestImage = new BufferedImage(image.getWidth(), image.getHeight(),BufferedImage.TYPE_INT_RGB);
}
ConvertBufferedImage.convertTo(image,bestImage);
}
} | [
"public",
"synchronized",
"void",
"process",
"(",
"GrayF32",
"image",
",",
"List",
"<",
"Point2D_F64",
">",
"sides",
")",
"{",
"if",
"(",
"sides",
".",
"size",
"(",
")",
"!=",
"4",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expected 4 sidesColl... | Computes the sharpness score for the current image, if better than the current best image it's then saved.
@param image Gray scale input image for detector
@param sides Location of 4 corners on fiducial | [
"Computes",
"the",
"sharpness",
"score",
"for",
"the",
"current",
"image",
"if",
"better",
"than",
"the",
"current",
"best",
"image",
"it",
"s",
"then",
"saved",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/applications/src/main/java/boofcv/app/calib/ImageSelectorAndSaver.java#L125-L138 |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Emitter.java | Emitter.addLinkRef | public void addLinkRef(final String key, final LinkRef linkRef)
{
this.linkRefs.put(key.toLowerCase(), linkRef);
} | java | public void addLinkRef(final String key, final LinkRef linkRef)
{
this.linkRefs.put(key.toLowerCase(), linkRef);
} | [
"public",
"void",
"addLinkRef",
"(",
"final",
"String",
"key",
",",
"final",
"LinkRef",
"linkRef",
")",
"{",
"this",
".",
"linkRefs",
".",
"put",
"(",
"key",
".",
"toLowerCase",
"(",
")",
",",
"linkRef",
")",
";",
"}"
] | Adds a LinkRef to this set of LinkRefs.
@param key
The key/id.
@param linkRef
The LinkRef. | [
"Adds",
"a",
"LinkRef",
"to",
"this",
"set",
"of",
"LinkRefs",
"."
] | train | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Emitter.java#L50-L53 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java | NodeImpl.setName | static void setName(NodeImpl node, String name) {
int prefixSeparator = name.lastIndexOf(":");
if (prefixSeparator != -1) {
String prefix = name.substring(0, prefixSeparator);
String localName = name.substring(prefixSeparator + 1);
if (!DocumentImpl.isXMLIdentifier(prefix) || !DocumentImpl.isXMLIdentifier(localName)) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name);
}
} else if (!DocumentImpl.isXMLIdentifier(name)) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name);
}
switch (node.getNodeType()) {
case ATTRIBUTE_NODE:
AttrImpl attr = (AttrImpl) node;
attr.namespaceAware = false;
attr.localName = name;
break;
case ELEMENT_NODE:
ElementImpl element = (ElementImpl) node;
element.namespaceAware = false;
element.localName = name;
break;
default:
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"Cannot rename nodes of type " + node.getNodeType());
}
} | java | static void setName(NodeImpl node, String name) {
int prefixSeparator = name.lastIndexOf(":");
if (prefixSeparator != -1) {
String prefix = name.substring(0, prefixSeparator);
String localName = name.substring(prefixSeparator + 1);
if (!DocumentImpl.isXMLIdentifier(prefix) || !DocumentImpl.isXMLIdentifier(localName)) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name);
}
} else if (!DocumentImpl.isXMLIdentifier(name)) {
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, name);
}
switch (node.getNodeType()) {
case ATTRIBUTE_NODE:
AttrImpl attr = (AttrImpl) node;
attr.namespaceAware = false;
attr.localName = name;
break;
case ELEMENT_NODE:
ElementImpl element = (ElementImpl) node;
element.namespaceAware = false;
element.localName = name;
break;
default:
throw new DOMException(DOMException.NOT_SUPPORTED_ERR,
"Cannot rename nodes of type " + node.getNodeType());
}
} | [
"static",
"void",
"setName",
"(",
"NodeImpl",
"node",
",",
"String",
"name",
")",
"{",
"int",
"prefixSeparator",
"=",
"name",
".",
"lastIndexOf",
"(",
"\":\"",
")",
";",
"if",
"(",
"prefixSeparator",
"!=",
"-",
"1",
")",
"{",
"String",
"prefix",
"=",
"... | Sets {@code node} to be not namespace-aware and assigns its name.
@param node an element or attribute node. | [
"Sets",
"{",
"@code",
"node",
"}",
"to",
"be",
"not",
"namespace",
"-",
"aware",
"and",
"assigns",
"its",
"name",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java#L279-L308 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java | AbstractHeaderFile.openChannel | protected void openChannel(boolean readHeader) throws FileLockException, IOException {
logger.debug("[OFile.openChannel] Opening channel for file: " + osFile);
accessFile = new RandomAccessFile(osFile, (mode == AccessMode.READ_ONLY) ? "r" : "rw");
accessFile.seek(0);
channel = accessFile.getChannel();
lock();
if (mode == AccessMode.READ_ONLY) {
headerBuffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, HEADER_SIZE);
} else {
headerBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, HEADER_SIZE);
}
if (readHeader) {
readHeader();
}
} | java | protected void openChannel(boolean readHeader) throws FileLockException, IOException {
logger.debug("[OFile.openChannel] Opening channel for file: " + osFile);
accessFile = new RandomAccessFile(osFile, (mode == AccessMode.READ_ONLY) ? "r" : "rw");
accessFile.seek(0);
channel = accessFile.getChannel();
lock();
if (mode == AccessMode.READ_ONLY) {
headerBuffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, HEADER_SIZE);
} else {
headerBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, HEADER_SIZE);
}
if (readHeader) {
readHeader();
}
} | [
"protected",
"void",
"openChannel",
"(",
"boolean",
"readHeader",
")",
"throws",
"FileLockException",
",",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"[OFile.openChannel] Opening channel for file: \"",
"+",
"osFile",
")",
";",
"accessFile",
"=",
"new",
"Random... | opens the {@link RandomAccessFile} and the corresponding {@link FileChannel}. Optionally reads the header.
@param should
the header be read
@throws IOException | [
"opens",
"the",
"{",
"@link",
"RandomAccessFile",
"}",
"and",
"the",
"corresponding",
"{",
"@link",
"FileChannel",
"}",
".",
"Optionally",
"reads",
"the",
"header",
"."
] | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L211-L225 |
infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/locking/AbstractLockingInterceptor.java | AbstractLockingInterceptor.nonTxLockAndInvokeNext | protected final Object nonTxLockAndInvokeNext(InvocationContext ctx, VisitableCommand command,
LockPromise lockPromise, InvocationFinallyAction finallyFunction) {
return lockPromise.toInvocationStage().andHandle(ctx, command, (rCtx, rCommand, rv, throwable) -> {
if (throwable != null) {
lockManager.unlockAll(rCtx);
throw throwable;
} else {
return invokeNextAndFinally(rCtx, rCommand, finallyFunction);
}
});
} | java | protected final Object nonTxLockAndInvokeNext(InvocationContext ctx, VisitableCommand command,
LockPromise lockPromise, InvocationFinallyAction finallyFunction) {
return lockPromise.toInvocationStage().andHandle(ctx, command, (rCtx, rCommand, rv, throwable) -> {
if (throwable != null) {
lockManager.unlockAll(rCtx);
throw throwable;
} else {
return invokeNextAndFinally(rCtx, rCommand, finallyFunction);
}
});
} | [
"protected",
"final",
"Object",
"nonTxLockAndInvokeNext",
"(",
"InvocationContext",
"ctx",
",",
"VisitableCommand",
"command",
",",
"LockPromise",
"lockPromise",
",",
"InvocationFinallyAction",
"finallyFunction",
")",
"{",
"return",
"lockPromise",
".",
"toInvocationStage",
... | Locks and invoke the next interceptor for non-transactional commands. | [
"Locks",
"and",
"invoke",
"the",
"next",
"interceptor",
"for",
"non",
"-",
"transactional",
"commands",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/locking/AbstractLockingInterceptor.java#L292-L302 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/LoadingWorkObject.java | LoadingWorkObject.addTypeBindError | public void addTypeBindError(final TypeBindException bindException, final Cell cell, final String fieldName, final String label) {
addTypeBindError(bindException, CellPosition.of(cell), fieldName, label);
} | java | public void addTypeBindError(final TypeBindException bindException, final Cell cell, final String fieldName, final String label) {
addTypeBindError(bindException, CellPosition.of(cell), fieldName, label);
} | [
"public",
"void",
"addTypeBindError",
"(",
"final",
"TypeBindException",
"bindException",
",",
"final",
"Cell",
"cell",
",",
"final",
"String",
"fieldName",
",",
"final",
"String",
"label",
")",
"{",
"addTypeBindError",
"(",
"bindException",
",",
"CellPosition",
"... | 型変換エラーを追加します。
@param bindException 型変換エラー
@param cell マッピング元となったセル
@param fieldName マッピング先のフィールド名
@param label ラベル。省略する場合は、nullを指定します。 | [
"型変換エラーを追加します。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/LoadingWorkObject.java#L57-L59 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java | WriteFileExtensions.write2File | public static void write2File(final String inputFile, final String outputFile)
throws FileNotFoundException, IOException
{
try (FileInputStream fis = new FileInputStream(inputFile);
FileOutputStream fos = new FileOutputStream(outputFile);
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos);)
{
StreamExtensions.writeInputStreamToOutputStream(bis, bos);
}
} | java | public static void write2File(final String inputFile, final String outputFile)
throws FileNotFoundException, IOException
{
try (FileInputStream fis = new FileInputStream(inputFile);
FileOutputStream fos = new FileOutputStream(outputFile);
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos);)
{
StreamExtensions.writeInputStreamToOutputStream(bis, bos);
}
} | [
"public",
"static",
"void",
"write2File",
"(",
"final",
"String",
"inputFile",
",",
"final",
"String",
"outputFile",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"inputFi... | The Method write2File(String, String) copys a file from one filename to another.
@param inputFile
The Name from the File to read and copy.
@param outputFile
The Name from the File to write into.
@throws FileNotFoundException
is thrown if an attempt to open the file denoted by a specified pathname has
failed.
@throws IOException
Signals that an I/O exception has occurred. | [
"The",
"Method",
"write2File",
"(",
"String",
"String",
")",
"copys",
"a",
"file",
"from",
"one",
"filename",
"to",
"another",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L230-L240 |
twitter/chill | chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java | ConfiguredInstantiator.setSerialized | public static void setSerialized(Config conf, KryoInstantiator ki)
throws ConfigurationException {
setSerialized(conf, KryoInstantiator.class, ki);
} | java | public static void setSerialized(Config conf, KryoInstantiator ki)
throws ConfigurationException {
setSerialized(conf, KryoInstantiator.class, ki);
} | [
"public",
"static",
"void",
"setSerialized",
"(",
"Config",
"conf",
",",
"KryoInstantiator",
"ki",
")",
"throws",
"ConfigurationException",
"{",
"setSerialized",
"(",
"conf",
",",
"KryoInstantiator",
".",
"class",
",",
"ki",
")",
";",
"}"
] | Use the default KryoInstantiator to serialize the KryoInstantiator ki
same as: setSerialized(conf, KryoInstantiator.class, ki) | [
"Use",
"the",
"default",
"KryoInstantiator",
"to",
"serialize",
"the",
"KryoInstantiator",
"ki",
"same",
"as",
":",
"setSerialized",
"(",
"conf",
"KryoInstantiator",
".",
"class",
"ki",
")"
] | train | https://github.com/twitter/chill/blob/0919984ec3aeb320ff522911c726425e9f18ea41/chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java#L120-L123 |
jayantk/jklol | src/com/jayantkrish/jklol/models/TableFactor.java | TableFactor.logPointDistribution | public static TableFactor logPointDistribution(VariableNumMap vars, Assignment assignment) {
DenseTensorBuilder builder = new DenseTensorBuilder(vars.getVariableNumsArray(),
vars.getVariableSizes(), Double.NEGATIVE_INFINITY);
builder.put(vars.assignmentToIntArray(assignment), 0.0);
return new TableFactor(vars, new LogSpaceTensorAdapter(builder.build()));
} | java | public static TableFactor logPointDistribution(VariableNumMap vars, Assignment assignment) {
DenseTensorBuilder builder = new DenseTensorBuilder(vars.getVariableNumsArray(),
vars.getVariableSizes(), Double.NEGATIVE_INFINITY);
builder.put(vars.assignmentToIntArray(assignment), 0.0);
return new TableFactor(vars, new LogSpaceTensorAdapter(builder.build()));
} | [
"public",
"static",
"TableFactor",
"logPointDistribution",
"(",
"VariableNumMap",
"vars",
",",
"Assignment",
"assignment",
")",
"{",
"DenseTensorBuilder",
"builder",
"=",
"new",
"DenseTensorBuilder",
"(",
"vars",
".",
"getVariableNumsArray",
"(",
")",
",",
"vars",
"... | Gets a {@code TableFactor} over {@code vars} which assigns unit weight to
{@code assignment} and 0 to all other assignments. Requires
{@code assignment} to contain all of {@code vars}. The weights in the
returned factor are represented in logspace.
@param vars
@param assignment
@return | [
"Gets",
"a",
"{",
"@code",
"TableFactor",
"}",
"over",
"{",
"@code",
"vars",
"}",
"which",
"assigns",
"unit",
"weight",
"to",
"{",
"@code",
"assignment",
"}",
"and",
"0",
"to",
"all",
"other",
"assignments",
".",
"Requires",
"{",
"@code",
"assignment",
"... | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/TableFactor.java#L93-L98 |
auth0/java-jwt | lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java | Algorithm.ECDSA512 | public static Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey) throws IllegalArgumentException {
return ECDSA512(ECDSAAlgorithm.providerForKeys(publicKey, privateKey));
} | java | public static Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey) throws IllegalArgumentException {
return ECDSA512(ECDSAAlgorithm.providerForKeys(publicKey, privateKey));
} | [
"public",
"static",
"Algorithm",
"ECDSA512",
"(",
"ECPublicKey",
"publicKey",
",",
"ECPrivateKey",
"privateKey",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"ECDSA512",
"(",
"ECDSAAlgorithm",
".",
"providerForKeys",
"(",
"publicKey",
",",
"privateKey",
"... | Creates a new Algorithm instance using SHA512withECDSA. Tokens specify this as "ES512".
@param publicKey the key to use in the verify instance.
@param privateKey the key to use in the signing instance.
@return a valid ECDSA512 Algorithm.
@throws IllegalArgumentException if the provided Key is null. | [
"Creates",
"a",
"new",
"Algorithm",
"instance",
"using",
"SHA512withECDSA",
".",
"Tokens",
"specify",
"this",
"as",
"ES512",
"."
] | train | https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java#L296-L298 |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.getJSONArray | public LazyArray getJSONArray(String key) throws LazyException{
LazyNode token=getFieldToken(key);
if(token.type!=LazyNode.ARRAY)throw new LazyException("Requested value is not an array",token);
LazyArray arr=new LazyArray(token);
arr.parent=this;
return arr;
} | java | public LazyArray getJSONArray(String key) throws LazyException{
LazyNode token=getFieldToken(key);
if(token.type!=LazyNode.ARRAY)throw new LazyException("Requested value is not an array",token);
LazyArray arr=new LazyArray(token);
arr.parent=this;
return arr;
} | [
"public",
"LazyArray",
"getJSONArray",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
".",
"type",
"!=",
"LazyNode",
".",
"ARRAY",
")",
"throw",
"new",
"LazyEx... | Returns the JSON array stored in this object for the given key.
@param key the name of the field on this object
@return an array value
@throws LazyException if the value for the given key was not an array. | [
"Returns",
"the",
"JSON",
"array",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L610-L616 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java | PTable.removePTableOwner | public synchronized int removePTableOwner(ThinPhysicalTableOwner pTableOwner, boolean bFreeIfEmpty)
{
if (pTableOwner != null)
{
m_setPTableOwners.remove(pTableOwner);
pTableOwner.setPTable(null);
}
if (m_setPTableOwners.size() == 0)
if (bFreeIfEmpty)
{
this.free();
return 0;
}
m_lTimeLastUsed = System.currentTimeMillis();
return m_setPTableOwners.size();
} | java | public synchronized int removePTableOwner(ThinPhysicalTableOwner pTableOwner, boolean bFreeIfEmpty)
{
if (pTableOwner != null)
{
m_setPTableOwners.remove(pTableOwner);
pTableOwner.setPTable(null);
}
if (m_setPTableOwners.size() == 0)
if (bFreeIfEmpty)
{
this.free();
return 0;
}
m_lTimeLastUsed = System.currentTimeMillis();
return m_setPTableOwners.size();
} | [
"public",
"synchronized",
"int",
"removePTableOwner",
"(",
"ThinPhysicalTableOwner",
"pTableOwner",
",",
"boolean",
"bFreeIfEmpty",
")",
"{",
"if",
"(",
"pTableOwner",
"!=",
"null",
")",
"{",
"m_setPTableOwners",
".",
"remove",
"(",
"pTableOwner",
")",
";",
"pTabl... | Free this table if it is no longer being used.
@param pTableOwner The table owner to remove. | [
"Free",
"this",
"table",
"if",
"it",
"is",
"no",
"longer",
"being",
"used",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java#L148-L163 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getResourceUrl | public static URL getResourceUrl(String resource, Class<?> baseClass) {
return ResourceUtil.getResource(resource, baseClass);
} | java | public static URL getResourceUrl(String resource, Class<?> baseClass) {
return ResourceUtil.getResource(resource, baseClass);
} | [
"public",
"static",
"URL",
"getResourceUrl",
"(",
"String",
"resource",
",",
"Class",
"<",
"?",
">",
"baseClass",
")",
"{",
"return",
"ResourceUtil",
".",
"getResource",
"(",
"resource",
",",
"baseClass",
")",
";",
"}"
] | 获得资源相对路径对应的URL
@param resource 资源相对路径
@param baseClass 基准Class,获得的相对路径相对于此Class所在路径,如果为{@code null}则相对ClassPath
@return {@link URL}
@see ResourceUtil#getResource(String, Class) | [
"获得资源相对路径对应的URL"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L510-L512 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java | OrdersInner.createOrUpdateAsync | public Observable<OrderInner> createOrUpdateAsync(String deviceName, String resourceGroupName, OrderInner order) {
return createOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, order).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | java | public Observable<OrderInner> createOrUpdateAsync(String deviceName, String resourceGroupName, OrderInner order) {
return createOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, order).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OrderInner",
">",
"createOrUpdateAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"OrderInner",
"order",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
... | Creates or updates an order.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param order The order to be created or updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"an",
"order",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java#L342-L349 |
overturetool/overture | core/interpreter/src/main/java/org/overture/interpreter/utilities/type/AllValuesCollector.java | AllValuesCollector.generateNumbers | protected ValueList generateNumbers(int min, int max, Context ctxt)
throws ValueException
{
ValueList list = new ValueList();
for (int i = min; i < max + 1; i++)
{
list.add(NumericValue.valueOf(i, ctxt));
}
return list;
} | java | protected ValueList generateNumbers(int min, int max, Context ctxt)
throws ValueException
{
ValueList list = new ValueList();
for (int i = min; i < max + 1; i++)
{
list.add(NumericValue.valueOf(i, ctxt));
}
return list;
} | [
"protected",
"ValueList",
"generateNumbers",
"(",
"int",
"min",
",",
"int",
"max",
",",
"Context",
"ctxt",
")",
"throws",
"ValueException",
"{",
"ValueList",
"list",
"=",
"new",
"ValueList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"min",
";",
"i",
... | Generator method for numeric type bindings.
@param min
the minimum number
@param max
the maximum number
@param ctxt
current context
@return the newly generated list of values between min and max, including.
@throws ValueException | [
"Generator",
"method",
"for",
"numeric",
"type",
"bindings",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/utilities/type/AllValuesCollector.java#L118-L128 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/SweepHullDelaunay2D.java | SweepHullDelaunay2D.leftOf | boolean leftOf(double[] a, double[] b, double[] d) {
final double bax = b[0] - a[0], bay = b[1] - a[1];
final double dax = d[0] - a[0], day = d[1] - a[1];
final double cross = bax * day - bay * dax;
return cross > 1e-10 * Math.max(Math.max(bax, bay), Math.max(dax, day));
} | java | boolean leftOf(double[] a, double[] b, double[] d) {
final double bax = b[0] - a[0], bay = b[1] - a[1];
final double dax = d[0] - a[0], day = d[1] - a[1];
final double cross = bax * day - bay * dax;
return cross > 1e-10 * Math.max(Math.max(bax, bay), Math.max(dax, day));
} | [
"boolean",
"leftOf",
"(",
"double",
"[",
"]",
"a",
",",
"double",
"[",
"]",
"b",
",",
"double",
"[",
"]",
"d",
")",
"{",
"final",
"double",
"bax",
"=",
"b",
"[",
"0",
"]",
"-",
"a",
"[",
"0",
"]",
",",
"bay",
"=",
"b",
"[",
"1",
"]",
"-",... | Test if the double[] AD is right of AB.
@param a Starting point
@param b Reference point
@param d Test point
@return true when on the left side | [
"Test",
"if",
"the",
"double",
"[]",
"AD",
"is",
"right",
"of",
"AB",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/SweepHullDelaunay2D.java#L706-L711 |
jbundle/jbundle | base/remote/src/main/java/org/jbundle/base/remote/lock/ClientLockManager.java | ClientLockManager.lockThisRecord | public int lockThisRecord(Task objSession, String strDatabaseName, String strRecordName, Object bookmark, String strUserName, int iLockType)
throws DBException
{
SessionInfo sessionInfo = this.getLockSessionInfo(objSession, strUserName);
try {
return this.getRemoteLockSession(sessionInfo).lockThisRecord(strDatabaseName, strRecordName, bookmark, sessionInfo, iLockType);
} catch (RemoteException ex) {
throw DatabaseException.toDatabaseException(ex);
}
} | java | public int lockThisRecord(Task objSession, String strDatabaseName, String strRecordName, Object bookmark, String strUserName, int iLockType)
throws DBException
{
SessionInfo sessionInfo = this.getLockSessionInfo(objSession, strUserName);
try {
return this.getRemoteLockSession(sessionInfo).lockThisRecord(strDatabaseName, strRecordName, bookmark, sessionInfo, iLockType);
} catch (RemoteException ex) {
throw DatabaseException.toDatabaseException(ex);
}
} | [
"public",
"int",
"lockThisRecord",
"(",
"Task",
"objSession",
",",
"String",
"strDatabaseName",
",",
"String",
"strRecordName",
",",
"Object",
"bookmark",
",",
"String",
"strUserName",
",",
"int",
"iLockType",
")",
"throws",
"DBException",
"{",
"SessionInfo",
"ses... | Lock this bookmark in this record for this session.
@param strRecordName The record to create the lock in.
@param bookmark The bookmark to lock.
@param objSession The session that wants the lock.
@param strUser The name of the user that wants the lock.
@param iLockType The type of lock (wait or error lock).
@return null if successful, the name of the user locking if not. | [
"Lock",
"this",
"bookmark",
"in",
"this",
"record",
"for",
"this",
"session",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/ClientLockManager.java#L73-L82 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java | MessageUtils.buildMessage | static String buildMessage(BeanResolutionContext resolutionContext, FieldInjectionPoint fieldInjectionPoint, String message, boolean circular) {
StringBuilder builder = new StringBuilder("Failed to inject value for field [");
String ls = System.getProperty("line.separator");
builder
.append(fieldInjectionPoint.getName()).append("] of class: ")
.append(fieldInjectionPoint.getDeclaringBean().getName())
.append(ls)
.append(ls);
if (message != null) {
builder.append("Message: ").append(message).append(ls);
}
appendPath(resolutionContext, circular, builder, ls);
return builder.toString();
} | java | static String buildMessage(BeanResolutionContext resolutionContext, FieldInjectionPoint fieldInjectionPoint, String message, boolean circular) {
StringBuilder builder = new StringBuilder("Failed to inject value for field [");
String ls = System.getProperty("line.separator");
builder
.append(fieldInjectionPoint.getName()).append("] of class: ")
.append(fieldInjectionPoint.getDeclaringBean().getName())
.append(ls)
.append(ls);
if (message != null) {
builder.append("Message: ").append(message).append(ls);
}
appendPath(resolutionContext, circular, builder, ls);
return builder.toString();
} | [
"static",
"String",
"buildMessage",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"FieldInjectionPoint",
"fieldInjectionPoint",
",",
"String",
"message",
",",
"boolean",
"circular",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"\"Fai... | Builds an appropriate error message.
@param resolutionContext The resolution context
@param fieldInjectionPoint The injection point
@param message The message
@param circular Is the path circular
@return The message | [
"Builds",
"an",
"appropriate",
"error",
"message",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java#L104-L118 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java | JacksonUtils.asDate | public static Date asDate(JsonNode node, String dateTimeFormat) {
return node != null ? ValueUtils.convertDate(node, dateTimeFormat) : null;
} | java | public static Date asDate(JsonNode node, String dateTimeFormat) {
return node != null ? ValueUtils.convertDate(node, dateTimeFormat) : null;
} | [
"public",
"static",
"Date",
"asDate",
"(",
"JsonNode",
"node",
",",
"String",
"dateTimeFormat",
")",
"{",
"return",
"node",
"!=",
"null",
"?",
"ValueUtils",
".",
"convertDate",
"(",
"node",
",",
"dateTimeFormat",
")",
":",
"null",
";",
"}"
] | Extract value from a {@link JsonNode} as a date. If the extracted value is string, parse it
as {@link Date} using the specified date-time format.
@param node
@param dateTimeFormat
@return
@since 0.6.3.3 | [
"Extract",
"value",
"from",
"a",
"{",
"@link",
"JsonNode",
"}",
"as",
"a",
"date",
".",
"If",
"the",
"extracted",
"value",
"is",
"string",
"parse",
"it",
"as",
"{",
"@link",
"Date",
"}",
"using",
"the",
"specified",
"date",
"-",
"time",
"format",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L204-L206 |
deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.shardMessageHandler | protected void shardMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming messages here are supposed to be unicast messages.
*/
// TODO: implement fragmentation handler here PROBABLY. Or forbid messages > MTU?
//log.info("shardMessageHandler message request incoming...");
byte[] data = new byte[length];
buffer.getBytes(offset, data);
VoidMessage message = VoidMessage.fromBytes(data);
if (message.getMessageType() == 7) {
// if that's vector request message - it's special case, we don't send it to other shards yet
//log.info("Shortcut for vector request");
messages.add(message);
} else {
// and send it away to other Shards
publicationForShards.offer(buffer, offset, length);
}
} | java | protected void shardMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming messages here are supposed to be unicast messages.
*/
// TODO: implement fragmentation handler here PROBABLY. Or forbid messages > MTU?
//log.info("shardMessageHandler message request incoming...");
byte[] data = new byte[length];
buffer.getBytes(offset, data);
VoidMessage message = VoidMessage.fromBytes(data);
if (message.getMessageType() == 7) {
// if that's vector request message - it's special case, we don't send it to other shards yet
//log.info("Shortcut for vector request");
messages.add(message);
} else {
// and send it away to other Shards
publicationForShards.offer(buffer, offset, length);
}
} | [
"protected",
"void",
"shardMessageHandler",
"(",
"DirectBuffer",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Header",
"header",
")",
"{",
"/**\n * All incoming messages here are supposed to be unicast messages.\n */",
"// TODO: implement fragmentat... | This message handler is responsible for receiving messages on Shard side
@param buffer
@param offset
@param length
@param header | [
"This",
"message",
"handler",
"is",
"responsible",
"for",
"receiving",
"messages",
"on",
"Shard",
"side"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L220-L238 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SessionUtil.java | SessionUtil.issueSession | static public LoginOutput issueSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException
{
return tokenRequest(loginInput, TokenRequestType.ISSUE);
} | java | static public LoginOutput issueSession(LoginInput loginInput)
throws SFException, SnowflakeSQLException
{
return tokenRequest(loginInput, TokenRequestType.ISSUE);
} | [
"static",
"public",
"LoginOutput",
"issueSession",
"(",
"LoginInput",
"loginInput",
")",
"throws",
"SFException",
",",
"SnowflakeSQLException",
"{",
"return",
"tokenRequest",
"(",
"loginInput",
",",
"TokenRequestType",
".",
"ISSUE",
")",
";",
"}"
] | Issue a session
@param loginInput login information
@return login output
@throws SFException if unexpected uri information
@throws SnowflakeSQLException if failed to renew the session | [
"Issue",
"a",
"session"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L913-L917 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/application/AbstractApplication.java | AbstractApplication.preloadAndLaunch | protected static void preloadAndLaunch(final Class<? extends Application> appClass, final Class<? extends Preloader> preloaderClass, final String... args) {
LauncherImpl.launchApplication(appClass, preloaderClass, args);
} | java | protected static void preloadAndLaunch(final Class<? extends Application> appClass, final Class<? extends Preloader> preloaderClass, final String... args) {
LauncherImpl.launchApplication(appClass, preloaderClass, args);
} | [
"protected",
"static",
"void",
"preloadAndLaunch",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Application",
">",
"appClass",
",",
"final",
"Class",
"<",
"?",
"extends",
"Preloader",
">",
"preloaderClass",
",",
"final",
"String",
"...",
"args",
")",
"{",
"L... | Launch the given JavaFX Application with given preloader.
@param appClass the JavaFX application class to launch
@param preloaderClass the preloader class used as splash screen with progress
@param args arguments passed to java command line | [
"Launch",
"the",
"given",
"JavaFX",
"Application",
"with",
"given",
"preloader",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/application/AbstractApplication.java#L124-L126 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/MessagesApi.java | MessagesApi.getLastNormalizedMessages | public NormalizedMessagesEnvelope getLastNormalizedMessages(Integer count, String sdids, String fieldPresence) throws ApiException {
ApiResponse<NormalizedMessagesEnvelope> resp = getLastNormalizedMessagesWithHttpInfo(count, sdids, fieldPresence);
return resp.getData();
} | java | public NormalizedMessagesEnvelope getLastNormalizedMessages(Integer count, String sdids, String fieldPresence) throws ApiException {
ApiResponse<NormalizedMessagesEnvelope> resp = getLastNormalizedMessagesWithHttpInfo(count, sdids, fieldPresence);
return resp.getData();
} | [
"public",
"NormalizedMessagesEnvelope",
"getLastNormalizedMessages",
"(",
"Integer",
"count",
",",
"String",
"sdids",
",",
"String",
"fieldPresence",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"NormalizedMessagesEnvelope",
">",
"resp",
"=",
"getLastNormalized... | Get Last Normalized Message
Get last messages normalized.
@param count Number of items to return per query. (optional)
@param sdids Comma separated list of source device IDs (minimum: 1). (optional)
@param fieldPresence String representing a field from the specified device ID. (optional)
@return NormalizedMessagesEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"Last",
"Normalized",
"Message",
"Get",
"last",
"messages",
"normalized",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/MessagesApi.java#L429-L432 |
aequologica/geppaequo | geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java | MethodUtils.getAccessibleMethod | public static Method getAccessibleMethod(
Class<?> clazz,
String methodName,
Class<?> parameterType) {
Class<?>[] parameterTypes = {parameterType};
return getAccessibleMethod(clazz, methodName, parameterTypes);
} | java | public static Method getAccessibleMethod(
Class<?> clazz,
String methodName,
Class<?> parameterType) {
Class<?>[] parameterTypes = {parameterType};
return getAccessibleMethod(clazz, methodName, parameterTypes);
} | [
"public",
"static",
"Method",
"getAccessibleMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"parameterType",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
"=",
"{",
"parameterType",
... | <p>Return an accessible method (that is, one that can be invoked via
reflection) with given name and a single parameter. If no such method
can be found, return <code>null</code>.
Basically, a convenience wrapper that constructs a <code>Class</code>
array for you.</p>
@param clazz get method from this class
@param methodName get method with this name
@param parameterType taking this type of parameter
@return The accessible method | [
"<p",
">",
"Return",
"an",
"accessible",
"method",
"(",
"that",
"is",
"one",
"that",
"can",
"be",
"invoked",
"via",
"reflection",
")",
"with",
"given",
"name",
"and",
"a",
"single",
"parameter",
".",
"If",
"no",
"such",
"method",
"can",
"be",
"found",
... | train | https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L705-L712 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/argparser/ArgumentDefinition.java | ArgumentDefinition.getEnumOptions | private static <T extends Enum<T>> String getEnumOptions(final Class<T> clazz) {
// We assume that clazz is guaranteed to be a Class<? extends Enum>, thus
// getEnumConstants() won't ever return a null.
final T[] enumConstants = clazz.getEnumConstants();
if (enumConstants.length == 0) {
throw new CommandLineException(String.format("Bad argument enum type '%s' with no options", clazz.getName()));
}
if (CommandLineParser.ClpEnum.class.isAssignableFrom(clazz)) {
return Stream.of(enumConstants)
.map(c -> String.format("%s (%s)", c.name(), ((CommandLineParser.ClpEnum) c).getHelpDoc()))
.collect(Collectors.joining("\n"));
} else {
return Stream.of(enumConstants)
.map(T::name)
.collect(Collectors.joining(", ", OPTION_DOC_PREFIX, OPTION_DOC_SUFFIX));
}
} | java | private static <T extends Enum<T>> String getEnumOptions(final Class<T> clazz) {
// We assume that clazz is guaranteed to be a Class<? extends Enum>, thus
// getEnumConstants() won't ever return a null.
final T[] enumConstants = clazz.getEnumConstants();
if (enumConstants.length == 0) {
throw new CommandLineException(String.format("Bad argument enum type '%s' with no options", clazz.getName()));
}
if (CommandLineParser.ClpEnum.class.isAssignableFrom(clazz)) {
return Stream.of(enumConstants)
.map(c -> String.format("%s (%s)", c.name(), ((CommandLineParser.ClpEnum) c).getHelpDoc()))
.collect(Collectors.joining("\n"));
} else {
return Stream.of(enumConstants)
.map(T::name)
.collect(Collectors.joining(", ", OPTION_DOC_PREFIX, OPTION_DOC_SUFFIX));
}
} | [
"private",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"String",
"getEnumOptions",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"// We assume that clazz is guaranteed to be a Class<? extends Enum>, thus",
"// getEnumConstants() won't ever return... | Composes the help string on the possible options an {@link Enum} typed argument can take.
@param clazz target enum class. Assumed no to be {@code null}.
@param <T> enum class type.
@throws CommandLineException if {@code <T>} has no constants.
@return never {@code null}. | [
"Composes",
"the",
"help",
"string",
"on",
"the",
"possible",
"options",
"an",
"{",
"@link",
"Enum",
"}",
"typed",
"argument",
"can",
"take",
"."
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/argparser/ArgumentDefinition.java#L308-L325 |
Red5/red5-io | src/main/java/org/red5/io/mp3/impl/MP3Stream.java | MP3Stream.skipStream | private static void skipStream(InputStream in, long count) throws IOException {
long size = count;
long skipped = 0;
while (size > 0 && skipped >= 0) {
skipped = in.skip(size);
if (skipped != -1) {
size -= skipped;
}
}
} | java | private static void skipStream(InputStream in, long count) throws IOException {
long size = count;
long skipped = 0;
while (size > 0 && skipped >= 0) {
skipped = in.skip(size);
if (skipped != -1) {
size -= skipped;
}
}
} | [
"private",
"static",
"void",
"skipStream",
"(",
"InputStream",
"in",
",",
"long",
"count",
")",
"throws",
"IOException",
"{",
"long",
"size",
"=",
"count",
";",
"long",
"skipped",
"=",
"0",
";",
"while",
"(",
"size",
">",
"0",
"&&",
"skipped",
">=",
"0... | Skips the given number of bytes from the specified input stream.
@param in
the input stream
@param count
the number of bytes to skip
@throws IOException
if an IO error occurs | [
"Skips",
"the",
"given",
"number",
"of",
"bytes",
"from",
"the",
"specified",
"input",
"stream",
"."
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L240-L249 |
jenkinsci/jenkins | core/src/main/java/jenkins/security/UserDetailsCache.java | UserDetailsCache.getCached | @CheckForNull
public UserDetails getCached(String idOrFullName) throws UsernameNotFoundException {
Boolean exists = existenceCache.getIfPresent(idOrFullName);
if (exists != null && !exists) {
throw new UserMayOrMayNotExistException(String.format("\"%s\" does not exist", idOrFullName));
} else {
return detailsCache.getIfPresent(idOrFullName);
}
} | java | @CheckForNull
public UserDetails getCached(String idOrFullName) throws UsernameNotFoundException {
Boolean exists = existenceCache.getIfPresent(idOrFullName);
if (exists != null && !exists) {
throw new UserMayOrMayNotExistException(String.format("\"%s\" does not exist", idOrFullName));
} else {
return detailsCache.getIfPresent(idOrFullName);
}
} | [
"@",
"CheckForNull",
"public",
"UserDetails",
"getCached",
"(",
"String",
"idOrFullName",
")",
"throws",
"UsernameNotFoundException",
"{",
"Boolean",
"exists",
"=",
"existenceCache",
".",
"getIfPresent",
"(",
"idOrFullName",
")",
";",
"if",
"(",
"exists",
"!=",
"n... | Gets the cached UserDetails for the given username.
Similar to {@link #loadUserByUsername(String)} except it doesn't perform the actual lookup if there is a cache miss.
@param idOrFullName the username
@return {@code null} if the cache doesn't contain any data for the key or the user details cached for the key.
@throws UsernameNotFoundException if a previous lookup resulted in the same | [
"Gets",
"the",
"cached",
"UserDetails",
"for",
"the",
"given",
"username",
".",
"Similar",
"to",
"{",
"@link",
"#loadUserByUsername",
"(",
"String",
")",
"}",
"except",
"it",
"doesn",
"t",
"perform",
"the",
"actual",
"lookup",
"if",
"there",
"is",
"a",
"ca... | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/UserDetailsCache.java#L98-L106 |
cdk/cdk | storage/io/src/main/java/org/openscience/cdk/io/cml/CMLResolver.java | CMLResolver.resolveEntity | @Override
public InputSource resolveEntity(String publicId, String systemId) {
logger.debug("CMLResolver: resolving ", publicId, ", ", systemId);
systemId = systemId.toLowerCase();
if ((systemId.indexOf("cml-1999-05-15.dtd") != -1) || (systemId.indexOf("cml.dtd") != -1)
|| (systemId.indexOf("cml1_0.dtd") != -1)) {
logger.info("File has CML 1.0 DTD");
return getCMLType("cml1_0.dtd");
} else if ((systemId.indexOf("cml-2001-04-06.dtd") != -1) || (systemId.indexOf("cml1_0_1.dtd") != -1)
|| (systemId.indexOf("cml_1_0_1.dtd") != -1)) {
logger.info("File has CML 1.0.1 DTD");
return getCMLType("cml1_0_1.dtd");
} else {
logger.warn("Could not resolve systemID: ", systemId);
return null;
}
} | java | @Override
public InputSource resolveEntity(String publicId, String systemId) {
logger.debug("CMLResolver: resolving ", publicId, ", ", systemId);
systemId = systemId.toLowerCase();
if ((systemId.indexOf("cml-1999-05-15.dtd") != -1) || (systemId.indexOf("cml.dtd") != -1)
|| (systemId.indexOf("cml1_0.dtd") != -1)) {
logger.info("File has CML 1.0 DTD");
return getCMLType("cml1_0.dtd");
} else if ((systemId.indexOf("cml-2001-04-06.dtd") != -1) || (systemId.indexOf("cml1_0_1.dtd") != -1)
|| (systemId.indexOf("cml_1_0_1.dtd") != -1)) {
logger.info("File has CML 1.0.1 DTD");
return getCMLType("cml1_0_1.dtd");
} else {
logger.warn("Could not resolve systemID: ", systemId);
return null;
}
} | [
"@",
"Override",
"public",
"InputSource",
"resolveEntity",
"(",
"String",
"publicId",
",",
"String",
"systemId",
")",
"{",
"logger",
".",
"debug",
"(",
"\"CMLResolver: resolving \"",
",",
"publicId",
",",
"\", \"",
",",
"systemId",
")",
";",
"systemId",
"=",
"... | Resolves SYSTEM and PUBLIC identifiers for CML DTDs.
@param publicId the PUBLIC identifier of the DTD (unused)
@param systemId the SYSTEM identifier of the DTD
@return the CML DTD as an InputSource or null if id's unresolvable | [
"Resolves",
"SYSTEM",
"and",
"PUBLIC",
"identifiers",
"for",
"CML",
"DTDs",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLResolver.java#L69-L85 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java | BigIntegerExtensions.operator_minus | @Inline(value="$1.subtract($2)")
@Pure
public static BigInteger operator_minus(BigInteger a, BigInteger b) {
return a.subtract(b);
} | java | @Inline(value="$1.subtract($2)")
@Pure
public static BigInteger operator_minus(BigInteger a, BigInteger b) {
return a.subtract(b);
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"$1.subtract($2)\"",
")",
"@",
"Pure",
"public",
"static",
"BigInteger",
"operator_minus",
"(",
"BigInteger",
"a",
",",
"BigInteger",
"b",
")",
"{",
"return",
"a",
".",
"subtract",
"(",
"b",
")",
";",
"}"
] | The binary <code>minus</code> operator.
@param a
a BigInteger. May not be <code>null</code>.
@param b
a BigInteger. May not be <code>null</code>.
@return <code>a.subtract(b)</code>
@throws NullPointerException
if {@code a} or {@code b} is <code>null</code>. | [
"The",
"binary",
"<code",
">",
"minus<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java#L65-L69 |
elki-project/elki | elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTree.java | MkAppTree.adjustApproximatedKNNDistances | private void adjustApproximatedKNNDistances(MkAppEntry entry, Map<DBID, KNNList> knnLists) {
MkAppTreeNode<O> node = getNode(entry);
if(node.isLeaf()) {
for(int i = 0; i < node.getNumEntries(); i++) {
MkAppLeafEntry leafEntry = (MkAppLeafEntry) node.getEntry(i);
// approximateKnnDistances(leafEntry,
// getKNNList(leafEntry.getRoutingObjectID(), knnLists));
PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(leafEntry.getDBID(), knnLists));
leafEntry.setKnnDistanceApproximation(approx);
}
}
else {
for(int i = 0; i < node.getNumEntries(); i++) {
MkAppEntry dirEntry = node.getEntry(i);
adjustApproximatedKNNDistances(dirEntry, knnLists);
}
}
// PolynomialApproximation approx1 = node.knnDistanceApproximation();
ArrayModifiableDBIDs ids = DBIDUtil.newArray();
leafEntryIDs(node, ids);
PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(ids, knnLists));
entry.setKnnDistanceApproximation(approx);
} | java | private void adjustApproximatedKNNDistances(MkAppEntry entry, Map<DBID, KNNList> knnLists) {
MkAppTreeNode<O> node = getNode(entry);
if(node.isLeaf()) {
for(int i = 0; i < node.getNumEntries(); i++) {
MkAppLeafEntry leafEntry = (MkAppLeafEntry) node.getEntry(i);
// approximateKnnDistances(leafEntry,
// getKNNList(leafEntry.getRoutingObjectID(), knnLists));
PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(leafEntry.getDBID(), knnLists));
leafEntry.setKnnDistanceApproximation(approx);
}
}
else {
for(int i = 0; i < node.getNumEntries(); i++) {
MkAppEntry dirEntry = node.getEntry(i);
adjustApproximatedKNNDistances(dirEntry, knnLists);
}
}
// PolynomialApproximation approx1 = node.knnDistanceApproximation();
ArrayModifiableDBIDs ids = DBIDUtil.newArray();
leafEntryIDs(node, ids);
PolynomialApproximation approx = approximateKnnDistances(getMeanKNNList(ids, knnLists));
entry.setKnnDistanceApproximation(approx);
} | [
"private",
"void",
"adjustApproximatedKNNDistances",
"(",
"MkAppEntry",
"entry",
",",
"Map",
"<",
"DBID",
",",
"KNNList",
">",
"knnLists",
")",
"{",
"MkAppTreeNode",
"<",
"O",
">",
"node",
"=",
"getNode",
"(",
"entry",
")",
";",
"if",
"(",
"node",
".",
"... | Adjusts the knn distance in the subtree of the specified root entry.
@param entry the root entry of the current subtree
@param knnLists a map of knn lists for each leaf entry | [
"Adjusts",
"the",
"knn",
"distance",
"in",
"the",
"subtree",
"of",
"the",
"specified",
"root",
"entry",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTree.java#L271-L295 |
iipc/webarchive-commons | src/main/java/org/archive/util/FileUtils.java | FileUtils.copyFile | public static boolean copyFile(final File src, final File dest)
throws FileNotFoundException, IOException {
return copyFile(src, dest, -1, true);
} | java | public static boolean copyFile(final File src, final File dest)
throws FileNotFoundException, IOException {
return copyFile(src, dest, -1, true);
} | [
"public",
"static",
"boolean",
"copyFile",
"(",
"final",
"File",
"src",
",",
"final",
"File",
"dest",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"return",
"copyFile",
"(",
"src",
",",
"dest",
",",
"-",
"1",
",",
"true",
")",
";",
"}... | Copy the src file to the destination. Deletes any preexisting
file at destination.
@param src
@param dest
@return True if the extent was greater than actual bytes copied.
@throws FileNotFoundException
@throws IOException | [
"Copy",
"the",
"src",
"file",
"to",
"the",
"destination",
".",
"Deletes",
"any",
"preexisting",
"file",
"at",
"destination",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/FileUtils.java#L71-L74 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java | AccountsInner.checkNameAvailability | public NameAvailabilityInformationInner checkNameAvailability(String location, CheckNameAvailabilityParameters parameters) {
return checkNameAvailabilityWithServiceResponseAsync(location, parameters).toBlocking().single().body();
} | java | public NameAvailabilityInformationInner checkNameAvailability(String location, CheckNameAvailabilityParameters parameters) {
return checkNameAvailabilityWithServiceResponseAsync(location, parameters).toBlocking().single().body();
} | [
"public",
"NameAvailabilityInformationInner",
"checkNameAvailability",
"(",
"String",
"location",
",",
"CheckNameAvailabilityParameters",
"parameters",
")",
"{",
"return",
"checkNameAvailabilityWithServiceResponseAsync",
"(",
"location",
",",
"parameters",
")",
".",
"toBlocking... | Checks whether the specified account name is available or taken.
@param location The resource location without whitespace.
@param parameters Parameters supplied to check the Data Lake Analytics account name availability.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NameAvailabilityInformationInner object if successful. | [
"Checks",
"whether",
"the",
"specified",
"account",
"name",
"is",
"available",
"or",
"taken",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java#L1363-L1365 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_services_GET | public ArrayList<OvhServiceInformation> packName_services_GET(String packName) throws IOException {
String qPath = "/pack/xdsl/{packName}/services";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<OvhServiceInformation> packName_services_GET(String packName) throws IOException {
String qPath = "/pack/xdsl/{packName}/services";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"OvhServiceInformation",
">",
"packName_services_GET",
"(",
"String",
"packName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/services\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
... | Informations about the services included in the pack
REST: GET /pack/xdsl/{packName}/services
@param packName [required] The internal name of your pack | [
"Informations",
"about",
"the",
"services",
"included",
"in",
"the",
"pack"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L133-L138 |
lastaflute/lasta-thymeleaf | src/main/java/org/lastaflute/thymeleaf/expression/ClassificationExpressionObject.java | ClassificationExpressionObject.nameOf | public Classification nameOf(String classificationName, String name) {
return findClassificationMeta((String) classificationName, () -> {
return "nameOf('" + classificationName + "', '" + name + "')";
}).nameOf(name);
} | java | public Classification nameOf(String classificationName, String name) {
return findClassificationMeta((String) classificationName, () -> {
return "nameOf('" + classificationName + "', '" + name + "')";
}).nameOf(name);
} | [
"public",
"Classification",
"nameOf",
"(",
"String",
"classificationName",
",",
"String",
"name",
")",
"{",
"return",
"findClassificationMeta",
"(",
"(",
"String",
")",
"classificationName",
",",
"(",
")",
"->",
"{",
"return",
"\"nameOf('\"",
"+",
"classificationN... | Get classification by name.
@param classificationName The name of classification. (NotNull)
@param name The name of classification to find. (NotNull)
@return The found instance of classification for the code. (NotNull: if not found, throws exception) | [
"Get",
"classification",
"by",
"name",
"."
] | train | https://github.com/lastaflute/lasta-thymeleaf/blob/d340a6e7eeddfcc9177052958c383fecd4a7fefa/src/main/java/org/lastaflute/thymeleaf/expression/ClassificationExpressionObject.java#L225-L229 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java | SPSMMappingFilter.getRelatedIndex | private int getRelatedIndex(List<INode> source, List<INode> target, char relation) {
int srcIndex = sourceIndex.get(source.get(0).getLevel() - 1);
int tgtIndex = targetIndex.get(target.get(0).getLevel() - 1);
int returnIndex = -1;
INode sourceNode = source.get(srcIndex);
//find the first one who is related in the same level
for (int i = tgtIndex + 1; i < target.size(); i++) {
INode targetNode = target.get(i);
if (isRelated(sourceNode, targetNode, relation)) {
setStrongestMapping(sourceNode, targetNode);
return i;
}
}
//there was no correspondence between siblings in source and target lists
//try to clean the mapping elements
computeStrongestMappingForSource(source.get(srcIndex));
return returnIndex;
} | java | private int getRelatedIndex(List<INode> source, List<INode> target, char relation) {
int srcIndex = sourceIndex.get(source.get(0).getLevel() - 1);
int tgtIndex = targetIndex.get(target.get(0).getLevel() - 1);
int returnIndex = -1;
INode sourceNode = source.get(srcIndex);
//find the first one who is related in the same level
for (int i = tgtIndex + 1; i < target.size(); i++) {
INode targetNode = target.get(i);
if (isRelated(sourceNode, targetNode, relation)) {
setStrongestMapping(sourceNode, targetNode);
return i;
}
}
//there was no correspondence between siblings in source and target lists
//try to clean the mapping elements
computeStrongestMappingForSource(source.get(srcIndex));
return returnIndex;
} | [
"private",
"int",
"getRelatedIndex",
"(",
"List",
"<",
"INode",
">",
"source",
",",
"List",
"<",
"INode",
">",
"target",
",",
"char",
"relation",
")",
"{",
"int",
"srcIndex",
"=",
"sourceIndex",
".",
"get",
"(",
"source",
".",
"get",
"(",
"0",
")",
"... | Looks for the related index for the source list at the position sourceIndex
in the target list beginning at the targetIndex position for the defined relation.
@param source source list of siblings.
@param target target list of siblings.
@param relation relation
@return the index of the related element in target, or -1 if there is no relate element. | [
"Looks",
"for",
"the",
"related",
"index",
"for",
"the",
"source",
"list",
"at",
"the",
"position",
"sourceIndex",
"in",
"the",
"target",
"list",
"beginning",
"at",
"the",
"targetIndex",
"position",
"for",
"the",
"defined",
"relation",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L218-L240 |
aboutsip/pkts | pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java | SipParser.expectHCOLONStreamFriendly | public static int expectHCOLONStreamFriendly(final Buffer buffer) throws SipParseException {
try {
int consumed = consumeWS(buffer);
if (buffer.hasReadableBytes()) {
expect(buffer, COLON);
} else {
// normally the expect(buffer, COLON) would have thrown
// an IndexOutOfBoundsException but let's signal that as
// -1
return -1;
}
++consumed;
consumed += consumeSWSAfterHColon(buffer);
return consumed;
} catch (final IOException e) {
throw new SipParseException(buffer.getReaderIndex(), UNABLE_TO_READ_FROM_STREAM, e);
}
} | java | public static int expectHCOLONStreamFriendly(final Buffer buffer) throws SipParseException {
try {
int consumed = consumeWS(buffer);
if (buffer.hasReadableBytes()) {
expect(buffer, COLON);
} else {
// normally the expect(buffer, COLON) would have thrown
// an IndexOutOfBoundsException but let's signal that as
// -1
return -1;
}
++consumed;
consumed += consumeSWSAfterHColon(buffer);
return consumed;
} catch (final IOException e) {
throw new SipParseException(buffer.getReaderIndex(), UNABLE_TO_READ_FROM_STREAM, e);
}
} | [
"public",
"static",
"int",
"expectHCOLONStreamFriendly",
"(",
"final",
"Buffer",
"buffer",
")",
"throws",
"SipParseException",
"{",
"try",
"{",
"int",
"consumed",
"=",
"consumeWS",
"(",
"buffer",
")",
";",
"if",
"(",
"buffer",
".",
"hasReadableBytes",
"(",
")"... | A problem with stream based protocols is that you don't have everything
available right away so e.g. when expecting HCOLON you may consume white spaces
but then you run out of bytes because you haven't received them yet
so therefore the expect(buffer, COLON) will blow up for the wrong reasons.
It may very well be that the next byte on the wire is indeed a ':' and as
such you should rather signal that you didn't have enough bytes to do your
job. This one does that.
Note, still some issues with this one though. Let's say the header
we are trying to parse is "X-Hello : whatever" and we have
only received "X-Hello :" so far. So first off we consume "X-Hello"
then call this method, which will consume " :" but ideally we also
want to consume the white space after the colon. I.e., when we
go off and consume the value of this header we will end up with
white space which normally should have been consumed by this method.
Hence, whenever dealing with streams you will run into this issue
and will have to keep extra state around to solve it. See the
{@link SipMessageStreamBuilder} for how it is dealing with this.
@param buffer
@return
@throws SipParseException | [
"A",
"problem",
"with",
"stream",
"based",
"protocols",
"is",
"that",
"you",
"don",
"t",
"have",
"everything",
"available",
"right",
"away",
"so",
"e",
".",
"g",
".",
"when",
"expecting",
"HCOLON",
"you",
"may",
"consume",
"white",
"spaces",
"but",
"then",... | train | https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java#L618-L635 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java | DiscreteFourierTransformOps.shiftZeroFrequency | public static void shiftZeroFrequency(InterleavedF32 transform, boolean forward ) {
int hw = transform.width/2;
int hh = transform.height/2;
if( transform.width%2 == 0 && transform.height%2 == 0 ) {
// if both sides are even then a simple transform can be done
for( int y = 0; y < hh; y++ ) {
for( int x = 0; x < hw; x++ ) {
float ra = transform.getBand(x,y,0);
float ia = transform.getBand(x,y,1);
float rb = transform.getBand(x+hw,y+hh,0);
float ib = transform.getBand(x+hw,y+hh,1);
transform.setBand(x,y,0,rb);
transform.setBand(x,y,1,ib);
transform.setBand(x+hw,y+hh,0,ra);
transform.setBand(x+hw,y+hh,1,ia);
ra = transform.getBand(x+hw,y,0);
ia = transform.getBand(x+hw,y,1);
rb = transform.getBand(x,y+hh,0);
ib = transform.getBand(x,y+hh,1);
transform.setBand(x+hw,y,0,rb);
transform.setBand(x+hw,y,1,ib);
transform.setBand(x,y+hh,0,ra);
transform.setBand(x,y+hh,1,ia);
}
}
} else {
// with odd images, the easiest way to do it is by copying the regions
int w = transform.width;
int h = transform.height;
int hw1 = hw + w%2;
int hh1 = hh + h%2;
if( forward ) {
InterleavedF32 storageTL = new InterleavedF32(hw1,hh1,2);
storageTL.setTo(transform.subimage(0, 0, hw1, hh1, null));
InterleavedF32 storageTR = new InterleavedF32(hw,hh1,2);
storageTR.setTo(transform.subimage(hw1, 0, w, hh1, null));
transform.subimage(0,0,hw,hh, null).setTo(transform.subimage(hw1,hh1,w,h, null));
transform.subimage(hw,0,w, hh, null).setTo(transform.subimage(0,hh1,hw1,h, null));
transform.subimage(hw,hh,w,h, null).setTo(storageTL);
transform.subimage(0,hh,hw,h, null).setTo(storageTR);
} else {
InterleavedF32 storageBL = new InterleavedF32(hw,hh1,2);
storageBL.setTo(transform.subimage(0, hh, hw, h, null));
InterleavedF32 storageBR = new InterleavedF32(hw1,hh1,2);
storageBR.setTo(transform.subimage(hw, hh, w, h, null));
transform.subimage(hw1,hh1,w,h, null).setTo(transform.subimage(0,0,hw,hh, null));
transform.subimage(0,hh1,hw1,h, null).setTo(transform.subimage(hw,0,w, hh, null));
transform.subimage(hw1,0,w,hh1, null).setTo(storageBL);
transform.subimage(0,0,hw1,hh1, null).setTo(storageBR);
}
}
} | java | public static void shiftZeroFrequency(InterleavedF32 transform, boolean forward ) {
int hw = transform.width/2;
int hh = transform.height/2;
if( transform.width%2 == 0 && transform.height%2 == 0 ) {
// if both sides are even then a simple transform can be done
for( int y = 0; y < hh; y++ ) {
for( int x = 0; x < hw; x++ ) {
float ra = transform.getBand(x,y,0);
float ia = transform.getBand(x,y,1);
float rb = transform.getBand(x+hw,y+hh,0);
float ib = transform.getBand(x+hw,y+hh,1);
transform.setBand(x,y,0,rb);
transform.setBand(x,y,1,ib);
transform.setBand(x+hw,y+hh,0,ra);
transform.setBand(x+hw,y+hh,1,ia);
ra = transform.getBand(x+hw,y,0);
ia = transform.getBand(x+hw,y,1);
rb = transform.getBand(x,y+hh,0);
ib = transform.getBand(x,y+hh,1);
transform.setBand(x+hw,y,0,rb);
transform.setBand(x+hw,y,1,ib);
transform.setBand(x,y+hh,0,ra);
transform.setBand(x,y+hh,1,ia);
}
}
} else {
// with odd images, the easiest way to do it is by copying the regions
int w = transform.width;
int h = transform.height;
int hw1 = hw + w%2;
int hh1 = hh + h%2;
if( forward ) {
InterleavedF32 storageTL = new InterleavedF32(hw1,hh1,2);
storageTL.setTo(transform.subimage(0, 0, hw1, hh1, null));
InterleavedF32 storageTR = new InterleavedF32(hw,hh1,2);
storageTR.setTo(transform.subimage(hw1, 0, w, hh1, null));
transform.subimage(0,0,hw,hh, null).setTo(transform.subimage(hw1,hh1,w,h, null));
transform.subimage(hw,0,w, hh, null).setTo(transform.subimage(0,hh1,hw1,h, null));
transform.subimage(hw,hh,w,h, null).setTo(storageTL);
transform.subimage(0,hh,hw,h, null).setTo(storageTR);
} else {
InterleavedF32 storageBL = new InterleavedF32(hw,hh1,2);
storageBL.setTo(transform.subimage(0, hh, hw, h, null));
InterleavedF32 storageBR = new InterleavedF32(hw1,hh1,2);
storageBR.setTo(transform.subimage(hw, hh, w, h, null));
transform.subimage(hw1,hh1,w,h, null).setTo(transform.subimage(0,0,hw,hh, null));
transform.subimage(0,hh1,hw1,h, null).setTo(transform.subimage(hw,0,w, hh, null));
transform.subimage(hw1,0,w,hh1, null).setTo(storageBL);
transform.subimage(0,0,hw1,hh1, null).setTo(storageBR);
}
}
} | [
"public",
"static",
"void",
"shiftZeroFrequency",
"(",
"InterleavedF32",
"transform",
",",
"boolean",
"forward",
")",
"{",
"int",
"hw",
"=",
"transform",
".",
"width",
"/",
"2",
";",
"int",
"hh",
"=",
"transform",
".",
"height",
"/",
"2",
";",
"if",
"(",... | Moves the zero-frequency component into the image center (width/2,height/2). This function can
be called to undo the transform.
@param transform the DFT which is to be shifted.
@param forward If true then it does the shift in the forward direction. If false then it undoes the transforms. | [
"Moves",
"the",
"zero",
"-",
"frequency",
"component",
"into",
"the",
"image",
"center",
"(",
"width",
"/",
"2",
"height",
"/",
"2",
")",
".",
"This",
"function",
"can",
"be",
"called",
"to",
"undo",
"the",
"transform",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java#L111-L176 |
liyiorg/weixin-popular | src/main/java/weixin/popular/util/MapUtil.java | MapUtil.mapJoin | public static String mapJoin(Map<String, String> map,boolean keyLower,boolean valueUrlencode){
StringBuilder stringBuilder = new StringBuilder();
for(String key :map.keySet()){
if(map.get(key)!=null&&!"".equals(map.get(key))){
try {
String temp = (key.endsWith("_")&&key.length()>1)?key.substring(0,key.length()-1):key;
stringBuilder.append(keyLower?temp.toLowerCase():temp)
.append("=")
.append(valueUrlencode?URLEncoder.encode(map.get(key),"utf-8").replace("+", "%20"):map.get(key))
.append("&");
} catch (UnsupportedEncodingException e) {
logger.error("", e);
}
}
}
if(stringBuilder.length()>0){
stringBuilder.deleteCharAt(stringBuilder.length()-1);
}
return stringBuilder.toString();
} | java | public static String mapJoin(Map<String, String> map,boolean keyLower,boolean valueUrlencode){
StringBuilder stringBuilder = new StringBuilder();
for(String key :map.keySet()){
if(map.get(key)!=null&&!"".equals(map.get(key))){
try {
String temp = (key.endsWith("_")&&key.length()>1)?key.substring(0,key.length()-1):key;
stringBuilder.append(keyLower?temp.toLowerCase():temp)
.append("=")
.append(valueUrlencode?URLEncoder.encode(map.get(key),"utf-8").replace("+", "%20"):map.get(key))
.append("&");
} catch (UnsupportedEncodingException e) {
logger.error("", e);
}
}
}
if(stringBuilder.length()>0){
stringBuilder.deleteCharAt(stringBuilder.length()-1);
}
return stringBuilder.toString();
} | [
"public",
"static",
"String",
"mapJoin",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"boolean",
"keyLower",
",",
"boolean",
"valueUrlencode",
")",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
... | url 参数串连
@param map map
@param keyLower keyLower
@param valueUrlencode valueUrlencode
@return string | [
"url",
"参数串连"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/MapUtil.java#L90-L109 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/PeerGroup.java | PeerGroup.setUserAgent | public void setUserAgent(String name, String version, @Nullable String comments) {
//TODO Check that height is needed here (it wasnt, but it should be, no?)
int height = chain == null ? 0 : chain.getBestChainHeight();
VersionMessage ver = new VersionMessage(params, height);
ver.relayTxesBeforeFilter = false;
updateVersionMessageRelayTxesBeforeFilter(ver);
ver.appendToSubVer(name, version, comments);
setVersionMessage(ver);
} | java | public void setUserAgent(String name, String version, @Nullable String comments) {
//TODO Check that height is needed here (it wasnt, but it should be, no?)
int height = chain == null ? 0 : chain.getBestChainHeight();
VersionMessage ver = new VersionMessage(params, height);
ver.relayTxesBeforeFilter = false;
updateVersionMessageRelayTxesBeforeFilter(ver);
ver.appendToSubVer(name, version, comments);
setVersionMessage(ver);
} | [
"public",
"void",
"setUserAgent",
"(",
"String",
"name",
",",
"String",
"version",
",",
"@",
"Nullable",
"String",
"comments",
")",
"{",
"//TODO Check that height is needed here (it wasnt, but it should be, no?)",
"int",
"height",
"=",
"chain",
"==",
"null",
"?",
"0",... | Sets information that identifies this software to remote nodes. This is a convenience wrapper for creating
a new {@link VersionMessage}, calling {@link VersionMessage#appendToSubVer(String, String, String)} on it,
and then calling {@link PeerGroup#setVersionMessage(VersionMessage)} on the result of that. See the docs for
{@link VersionMessage#appendToSubVer(String, String, String)} for information on what the fields should contain. | [
"Sets",
"information",
"that",
"identifies",
"this",
"software",
"to",
"remote",
"nodes",
".",
"This",
"is",
"a",
"convenience",
"wrapper",
"for",
"creating",
"a",
"new",
"{"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/PeerGroup.java#L594-L602 |
auth0/Lock.Android | lib/src/main/java/com/auth0/android/lock/views/PasswordlessRequestCodeFormView.java | PasswordlessRequestCodeFormView.onCountryCodeSelected | @SuppressWarnings("unused")
public void onCountryCodeSelected(String isoCode, String dialCode) {
Country selectedCountry = new Country(isoCode, dialCode);
countryCodeSelector.setSelectedCountry(selectedCountry);
} | java | @SuppressWarnings("unused")
public void onCountryCodeSelected(String isoCode, String dialCode) {
Country selectedCountry = new Country(isoCode, dialCode);
countryCodeSelector.setSelectedCountry(selectedCountry);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"void",
"onCountryCodeSelected",
"(",
"String",
"isoCode",
",",
"String",
"dialCode",
")",
"{",
"Country",
"selectedCountry",
"=",
"new",
"Country",
"(",
"isoCode",
",",
"dialCode",
")",
";",
"countryCod... | Notifies the form that a new country code was selected by the user.
@param isoCode the selected country iso code (2 chars).
@param dialCode the dial code for this country | [
"Notifies",
"the",
"form",
"that",
"a",
"new",
"country",
"code",
"was",
"selected",
"by",
"the",
"user",
"."
] | train | https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/PasswordlessRequestCodeFormView.java#L142-L146 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerImpl.java | LayerImpl.generateCacheKey | protected String generateCacheKey(HttpServletRequest request, Map<String, ICacheKeyGenerator> cacheKeyGenerators) throws IOException {
String cacheKey = null;
if (cacheKeyGenerators != null) {
// First, decompose any composite cache key generators into their
// constituent cache key generators so that we can combine them
// more effectively. Use TreeMap to get predictable ordering of
// keys.
Map<String, ICacheKeyGenerator> gens = new TreeMap<String, ICacheKeyGenerator>();
for (ICacheKeyGenerator gen : cacheKeyGenerators.values()) {
List<ICacheKeyGenerator> constituentGens = gen.getCacheKeyGenerators(request);
addCacheKeyGenerators(gens,
constituentGens == null ?
Arrays.asList(new ICacheKeyGenerator[]{gen}) :
constituentGens);
}
cacheKey = KeyGenUtil.generateKey(
request,
gens.values());
}
return cacheKey;
} | java | protected String generateCacheKey(HttpServletRequest request, Map<String, ICacheKeyGenerator> cacheKeyGenerators) throws IOException {
String cacheKey = null;
if (cacheKeyGenerators != null) {
// First, decompose any composite cache key generators into their
// constituent cache key generators so that we can combine them
// more effectively. Use TreeMap to get predictable ordering of
// keys.
Map<String, ICacheKeyGenerator> gens = new TreeMap<String, ICacheKeyGenerator>();
for (ICacheKeyGenerator gen : cacheKeyGenerators.values()) {
List<ICacheKeyGenerator> constituentGens = gen.getCacheKeyGenerators(request);
addCacheKeyGenerators(gens,
constituentGens == null ?
Arrays.asList(new ICacheKeyGenerator[]{gen}) :
constituentGens);
}
cacheKey = KeyGenUtil.generateKey(
request,
gens.values());
}
return cacheKey;
} | [
"protected",
"String",
"generateCacheKey",
"(",
"HttpServletRequest",
"request",
",",
"Map",
"<",
"String",
",",
"ICacheKeyGenerator",
">",
"cacheKeyGenerators",
")",
"throws",
"IOException",
"{",
"String",
"cacheKey",
"=",
"null",
";",
"if",
"(",
"cacheKeyGenerator... | Generates a cache key for the layer.
@param request
the request object
@param cacheKeyGenerators
map of cache key generator class names to instance objects
@return the cache key
@throws IOException | [
"Generates",
"a",
"cache",
"key",
"for",
"the",
"layer",
"."
] | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerImpl.java#L654-L674 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/ParameterizedDynamicFunctionSymbol.java | ParameterizedDynamicFunctionSymbol.assignSuperDfs | private void assignSuperDfs( IDynamicFunctionSymbol dfsDelegate, IGosuClass owner )
{
IDynamicFunctionSymbol rawSuperDfs = dfsDelegate.getSuperDfs();
if( rawSuperDfs instanceof DynamicFunctionSymbol )
{
while( rawSuperDfs.getBackingDfs() instanceof DynamicFunctionSymbol && rawSuperDfs.getBackingDfs() != rawSuperDfs )
{
rawSuperDfs = rawSuperDfs.getBackingDfs();
}
IType ownersType = rawSuperDfs.getDeclaringTypeInfo().getOwnersType();
if( !IGosuClass.ProxyUtil.isProxy( ownersType ) )
{
IType superOwner = TypeLord.findParameterizedType( owner, ownersType );
if( superOwner == null )
{
superOwner = ownersType;
}
setSuperDfs( ((DynamicFunctionSymbol)rawSuperDfs).getParameterizedVersion( (IGosuClass)superOwner ) );
}
}
} | java | private void assignSuperDfs( IDynamicFunctionSymbol dfsDelegate, IGosuClass owner )
{
IDynamicFunctionSymbol rawSuperDfs = dfsDelegate.getSuperDfs();
if( rawSuperDfs instanceof DynamicFunctionSymbol )
{
while( rawSuperDfs.getBackingDfs() instanceof DynamicFunctionSymbol && rawSuperDfs.getBackingDfs() != rawSuperDfs )
{
rawSuperDfs = rawSuperDfs.getBackingDfs();
}
IType ownersType = rawSuperDfs.getDeclaringTypeInfo().getOwnersType();
if( !IGosuClass.ProxyUtil.isProxy( ownersType ) )
{
IType superOwner = TypeLord.findParameterizedType( owner, ownersType );
if( superOwner == null )
{
superOwner = ownersType;
}
setSuperDfs( ((DynamicFunctionSymbol)rawSuperDfs).getParameterizedVersion( (IGosuClass)superOwner ) );
}
}
} | [
"private",
"void",
"assignSuperDfs",
"(",
"IDynamicFunctionSymbol",
"dfsDelegate",
",",
"IGosuClass",
"owner",
")",
"{",
"IDynamicFunctionSymbol",
"rawSuperDfs",
"=",
"dfsDelegate",
".",
"getSuperDfs",
"(",
")",
";",
"if",
"(",
"rawSuperDfs",
"instanceof",
"DynamicFun... | Assign the super dfs in terms of the deriving class's type parameters | [
"Assign",
"the",
"super",
"dfs",
"in",
"terms",
"of",
"the",
"deriving",
"class",
"s",
"type",
"parameters"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParameterizedDynamicFunctionSymbol.java#L41-L61 |
apiman/apiman | gateway/engine/jdbc/src/main/java/io/apiman/gateway/engine/jdbc/CachingJdbcRegistry.java | CachingJdbcRegistry.getApi | protected Api getApi(String orgId, String apiId, String version) throws SQLException {
String apiIdx = getApiId(orgId, apiId, version);
Api api;
synchronized (mutex) {
api = apiCache.get(apiIdx);
}
if (api == null) {
api = super.getApiInternal(orgId, apiId, version);
synchronized (mutex) {
if (api != null) {
apiCache.put(apiIdx, api);
}
}
}
return api;
} | java | protected Api getApi(String orgId, String apiId, String version) throws SQLException {
String apiIdx = getApiId(orgId, apiId, version);
Api api;
synchronized (mutex) {
api = apiCache.get(apiIdx);
}
if (api == null) {
api = super.getApiInternal(orgId, apiId, version);
synchronized (mutex) {
if (api != null) {
apiCache.put(apiIdx, api);
}
}
}
return api;
} | [
"protected",
"Api",
"getApi",
"(",
"String",
"orgId",
",",
"String",
"apiId",
",",
"String",
"version",
")",
"throws",
"SQLException",
"{",
"String",
"apiIdx",
"=",
"getApiId",
"(",
"orgId",
",",
"apiId",
",",
"version",
")",
";",
"Api",
"api",
";",
"syn... | Gets the api either from the cache or from ES.
@param orgId
@param apiId
@param version | [
"Gets",
"the",
"api",
"either",
"from",
"the",
"cache",
"or",
"from",
"ES",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/jdbc/src/main/java/io/apiman/gateway/engine/jdbc/CachingJdbcRegistry.java#L128-L145 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/jvmti/FrameCache.java | FrameCache.add | public static void add(Throwable throwable, Frame[] frames) {
Map<Throwable, Frame[]> weakMap = cache.get();
weakMap.put(throwable, frames);
} | java | public static void add(Throwable throwable, Frame[] frames) {
Map<Throwable, Frame[]> weakMap = cache.get();
weakMap.put(throwable, frames);
} | [
"public",
"static",
"void",
"add",
"(",
"Throwable",
"throwable",
",",
"Frame",
"[",
"]",
"frames",
")",
"{",
"Map",
"<",
"Throwable",
",",
"Frame",
"[",
"]",
">",
"weakMap",
"=",
"cache",
".",
"get",
"(",
")",
";",
"weakMap",
".",
"put",
"(",
"thr... | Store the per-frame local variable information for the last exception thrown on this thread.
@param throwable Throwable that the provided {@link Frame}s represent.
@param frames Array of {@link Frame}s to store | [
"Store",
"the",
"per",
"-",
"frame",
"local",
"variable",
"information",
"for",
"the",
"last",
"exception",
"thrown",
"on",
"this",
"thread",
"."
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/jvmti/FrameCache.java#L33-L36 |
JadiraOrg/jadira | bindings/src/main/java/org/jadira/bindings/core/utils/reflection/ClassUtils.java | ClassUtils.getClass | public static Class<?> getClass(ClassLoader classLoader, String className) {
try {
final Class<?> clazz;
if (PRIMITIVE_MAPPING.containsKey(className)) {
String qualifiedName = "[" + PRIMITIVE_MAPPING.get(className);
clazz = Class.forName(qualifiedName, true, classLoader).getComponentType();
} else {
clazz = Class.forName(determineQualifiedName(className), true, classLoader);
}
return clazz;
} catch (ClassNotFoundException ex) {
int lastSeparatorIndex = className.lastIndexOf(PACKAGE_SEPARATOR_CHARACTER);
if (lastSeparatorIndex != -1) {
return getClass(classLoader, className.substring(0, lastSeparatorIndex) + INNER_CLASS_SEPARATOR_CHAR
+ className.substring(lastSeparatorIndex + 1));
}
throw new IllegalArgumentException("Unable to unmarshall String to Class: " + className);
}
} | java | public static Class<?> getClass(ClassLoader classLoader, String className) {
try {
final Class<?> clazz;
if (PRIMITIVE_MAPPING.containsKey(className)) {
String qualifiedName = "[" + PRIMITIVE_MAPPING.get(className);
clazz = Class.forName(qualifiedName, true, classLoader).getComponentType();
} else {
clazz = Class.forName(determineQualifiedName(className), true, classLoader);
}
return clazz;
} catch (ClassNotFoundException ex) {
int lastSeparatorIndex = className.lastIndexOf(PACKAGE_SEPARATOR_CHARACTER);
if (lastSeparatorIndex != -1) {
return getClass(classLoader, className.substring(0, lastSeparatorIndex) + INNER_CLASS_SEPARATOR_CHAR
+ className.substring(lastSeparatorIndex + 1));
}
throw new IllegalArgumentException("Unable to unmarshall String to Class: " + className);
}
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getClass",
"(",
"ClassLoader",
"classLoader",
",",
"String",
"className",
")",
"{",
"try",
"{",
"final",
"Class",
"<",
"?",
">",
"clazz",
";",
"if",
"(",
"PRIMITIVE_MAPPING",
".",
"containsKey",
"(",
"className"... | Attempt to load the class matching the given qualified name
@param classLoader Classloader to use
@param className The classname to use
@throws IllegalArgumentException If the class cannot be loaded
@return The {@link Class} representing the given class | [
"Attempt",
"to",
"load",
"the",
"class",
"matching",
"the",
"given",
"qualified",
"name"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/utils/reflection/ClassUtils.java#L67-L90 |
jayantk/jklol | src/com/jayantkrish/jklol/models/TableFactor.java | TableFactor.logUnity | public static TableFactor logUnity(VariableNumMap vars) {
TableFactorBuilder builder = new TableFactorBuilder(vars, SparseTensorBuilder.getFactory());
return builder.buildSparseInLogSpace();
} | java | public static TableFactor logUnity(VariableNumMap vars) {
TableFactorBuilder builder = new TableFactorBuilder(vars, SparseTensorBuilder.getFactory());
return builder.buildSparseInLogSpace();
} | [
"public",
"static",
"TableFactor",
"logUnity",
"(",
"VariableNumMap",
"vars",
")",
"{",
"TableFactorBuilder",
"builder",
"=",
"new",
"TableFactorBuilder",
"(",
"vars",
",",
"SparseTensorBuilder",
".",
"getFactory",
"(",
")",
")",
";",
"return",
"builder",
".",
"... | Gets a {@code TableFactor} over {@code vars} which assigns weight 1 to all
assignments. The weights are represented in log space.
@param vars
@return | [
"Gets",
"a",
"{",
"@code",
"TableFactor",
"}",
"over",
"{",
"@code",
"vars",
"}",
"which",
"assigns",
"weight",
"1",
"to",
"all",
"assignments",
".",
"The",
"weights",
"are",
"represented",
"in",
"log",
"space",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/TableFactor.java#L119-L122 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/classes/commonslang/reflect/ConstructorUtils.java | ConstructorUtils.invokeConstructor | public static <T> T invokeConstructor(final Class<T> cls, Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
InstantiationException {
args = ArrayUtils.nullToEmpty(args);
parameterTypes = ArrayUtils.nullToEmpty(parameterTypes);
final Constructor<T> ctor = getMatchingAccessibleConstructor(cls, parameterTypes);
if (ctor == null) {
throw new NoSuchMethodException(
"No such accessible constructor on object: " + cls.getName());
}
if (ctor.isVarArgs()) {
final Class<?>[] methodParameterTypes = ctor.getParameterTypes();
args = MethodUtils.getVarArgs(args, methodParameterTypes);
}
return ctor.newInstance(args);
} | java | public static <T> T invokeConstructor(final Class<T> cls, Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
InstantiationException {
args = ArrayUtils.nullToEmpty(args);
parameterTypes = ArrayUtils.nullToEmpty(parameterTypes);
final Constructor<T> ctor = getMatchingAccessibleConstructor(cls, parameterTypes);
if (ctor == null) {
throw new NoSuchMethodException(
"No such accessible constructor on object: " + cls.getName());
}
if (ctor.isVarArgs()) {
final Class<?>[] methodParameterTypes = ctor.getParameterTypes();
args = MethodUtils.getVarArgs(args, methodParameterTypes);
}
return ctor.newInstance(args);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"invokeConstructor",
"(",
"final",
"Class",
"<",
"T",
">",
"cls",
",",
"Object",
"[",
"]",
"args",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAcces... | <p>Returns a new instance of the specified class choosing the right constructor
from the list of parameter types.</p>
<p>This locates and calls a constructor.
The constructor signature must match the parameter types by assignment compatibility.</p>
@param <T> the type to be constructed
@param cls the class to be constructed, not {@code null}
@param args the array of arguments, {@code null} treated as empty
@param parameterTypes the array of parameter types, {@code null} treated as empty
@return new instance of {@code cls}, not {@code null}
@throws NullPointerException if {@code cls} is {@code null}
@throws NoSuchMethodException if a matching constructor cannot be found
@throws IllegalAccessException if invocation is not permitted by security
@throws InvocationTargetException if an error occurs on invocation
@throws InstantiationException if an error occurs on instantiation
@see Constructor#newInstance | [
"<p",
">",
"Returns",
"a",
"new",
"instance",
"of",
"the",
"specified",
"class",
"choosing",
"the",
"right",
"constructor",
"from",
"the",
"list",
"of",
"parameter",
"types",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/classes/commonslang/reflect/ConstructorUtils.java#L100-L115 |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthValueMatcher.java | DayOfMonthValueMatcher.match | public boolean match(int value, int month, boolean isLeapYear) {
return (super.match(value) // 在约定日范围内的某一天
//匹配器中用户定义了最后一天(32表示最后一天)
|| (value > 27 && match(32) && isLastDayOfMonth(value, month, isLeapYear)));
} | java | public boolean match(int value, int month, boolean isLeapYear) {
return (super.match(value) // 在约定日范围内的某一天
//匹配器中用户定义了最后一天(32表示最后一天)
|| (value > 27 && match(32) && isLastDayOfMonth(value, month, isLeapYear)));
} | [
"public",
"boolean",
"match",
"(",
"int",
"value",
",",
"int",
"month",
",",
"boolean",
"isLeapYear",
")",
"{",
"return",
"(",
"super",
".",
"match",
"(",
"value",
")",
"// 在约定日范围内的某一天\r",
"//匹配器中用户定义了最后一天(32表示最后一天)\r",
"||",
"(",
"value",
">",
"27",
"&&",
... | 给定的日期是否匹配当前匹配器
@param value 被检查的值,此处为日
@param month 实际的月份
@param isLeapYear 是否闰年
@return 是否匹配 | [
"给定的日期是否匹配当前匹配器"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthValueMatcher.java#L33-L37 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/io/StreamBootstrapper.java | StreamBootstrapper.getInstance | public static StreamBootstrapper getInstance(String pubId, SystemId sysId, InputStream in)
{
return new StreamBootstrapper(pubId, sysId, in);
} | java | public static StreamBootstrapper getInstance(String pubId, SystemId sysId, InputStream in)
{
return new StreamBootstrapper(pubId, sysId, in);
} | [
"public",
"static",
"StreamBootstrapper",
"getInstance",
"(",
"String",
"pubId",
",",
"SystemId",
"sysId",
",",
"InputStream",
"in",
")",
"{",
"return",
"new",
"StreamBootstrapper",
"(",
"pubId",
",",
"sysId",
",",
"in",
")",
";",
"}"
] | Factory method used when the underlying data provider is an
actual stream. | [
"Factory",
"method",
"used",
"when",
"the",
"underlying",
"data",
"provider",
"is",
"an",
"actual",
"stream",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/StreamBootstrapper.java#L136-L139 |
f2prateek/rx-preferences | rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java | RxSharedPreferences.getInteger | @CheckResult @NonNull
public Preference<Integer> getInteger(@NonNull String key) {
return getInteger(key, DEFAULT_INTEGER);
} | java | @CheckResult @NonNull
public Preference<Integer> getInteger(@NonNull String key) {
return getInteger(key, DEFAULT_INTEGER);
} | [
"@",
"CheckResult",
"@",
"NonNull",
"public",
"Preference",
"<",
"Integer",
">",
"getInteger",
"(",
"@",
"NonNull",
"String",
"key",
")",
"{",
"return",
"getInteger",
"(",
"key",
",",
"DEFAULT_INTEGER",
")",
";",
"}"
] | Create an integer preference for {@code key}. Default is {@code 0}. | [
"Create",
"an",
"integer",
"preference",
"for",
"{"
] | train | https://github.com/f2prateek/rx-preferences/blob/e338b4e6cee9c0c7b850be86ab41ed7b39a3637e/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java#L100-L103 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipPhone.java | SipPhone.createSipCall | public SipCall createSipCall() {
initErrorInfo();
SipCall call = new SipCall(this, myAddress);
callList.add(call);
return call;
} | java | public SipCall createSipCall() {
initErrorInfo();
SipCall call = new SipCall(this, myAddress);
callList.add(call);
return call;
} | [
"public",
"SipCall",
"createSipCall",
"(",
")",
"{",
"initErrorInfo",
"(",
")",
";",
"SipCall",
"call",
"=",
"new",
"SipCall",
"(",
"this",
",",
"myAddress",
")",
";",
"callList",
".",
"add",
"(",
"call",
")",
";",
"return",
"call",
";",
"}"
] | This method is used to create a SipCall object for handling one leg of a call. That is, it
represents an outgoing call leg or an incoming call leg. In a telephone call, there are two
call legs. The outgoing call leg is the connection from the phone making the call to the
telephone network. The incoming call leg is a connection from the telephone network to the
phone being called. For a SIP call, the outbound leg is the user agent originating the call and
the inbound leg is the user agent receiving the call. The test program can use this method to
create a SipCall object for handling an incoming call leg or an outgoing call leg. Currently,
only one SipCall object is supported per SipPhone. In future, when more than one SipCall per
SipPhone is supported, this method can be called multiple times to create multiple call legs on
the same SipPhone object.
@return A SipCall object unless an error is encountered. | [
"This",
"method",
"is",
"used",
"to",
"create",
"a",
"SipCall",
"object",
"for",
"handling",
"one",
"leg",
"of",
"a",
"call",
".",
"That",
"is",
"it",
"represents",
"an",
"outgoing",
"call",
"leg",
"or",
"an",
"incoming",
"call",
"leg",
".",
"In",
"a",... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipPhone.java#L725-L733 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/BranchUrlBuilder.java | BranchUrlBuilder.addParameters | @SuppressWarnings("unchecked")
public T addParameters(String key, Object value) {
try {
if (this.params_ == null) {
this.params_ = new JSONObject();
}
this.params_.put(key, value);
} catch (JSONException ignore) {
}
return (T) this;
} | java | @SuppressWarnings("unchecked")
public T addParameters(String key, Object value) {
try {
if (this.params_ == null) {
this.params_ = new JSONObject();
}
this.params_.put(key, value);
} catch (JSONException ignore) {
}
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"addParameters",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"params_",
"==",
"null",
")",
"{",
"this",
".",
"params_",
"=",
"new",
"JSON... | <p>Adds the the given key value pair to the parameters associated with this link.</p>
@param key A {@link String} with value of key for the parameter
@param value A {@link Object} with value of value for the parameter
@return This Builder object to allow for chaining of calls to set methods. | [
"<p",
">",
"Adds",
"the",
"the",
"given",
"key",
"value",
"pair",
"to",
"the",
"parameters",
"associated",
"with",
"this",
"link",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/BranchUrlBuilder.java#L97-L108 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java | CNDStreamWriter.listToString | private String listToString(String[] list, String quote, String beforeString, String afterString)
{
StringBuilder result = new StringBuilder();
if (list != null && list.length > 0)
{
result.append(beforeString);
result.append(quote + list[0] + quote);
for (int i = 1; i < list.length; i++)
{
result.append(", " + quote + list[i] + quote);
}
result.append(afterString);
}
return result.toString();
} | java | private String listToString(String[] list, String quote, String beforeString, String afterString)
{
StringBuilder result = new StringBuilder();
if (list != null && list.length > 0)
{
result.append(beforeString);
result.append(quote + list[0] + quote);
for (int i = 1; i < list.length; i++)
{
result.append(", " + quote + list[i] + quote);
}
result.append(afterString);
}
return result.toString();
} | [
"private",
"String",
"listToString",
"(",
"String",
"[",
"]",
"list",
",",
"String",
"quote",
",",
"String",
"beforeString",
",",
"String",
"afterString",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"list",
"... | Converts String[] to String using given notation:
"beforeString+quote+element+quote+', '+quote+element...+quote+afterString"
@param list
Array to print
@param quote
Quote string for each element of array
@param beforeString
starting string
@param afterString
ending string
@return | [
"Converts",
"String",
"[]",
"to",
"String",
"using",
"given",
"notation",
":",
"beforeString",
"+",
"quote",
"+",
"element",
"+",
"quote",
"+",
"+",
"quote",
"+",
"element",
"...",
"+",
"quote",
"+",
"afterString"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java#L408-L424 |
openbase/jul | exception/src/main/java/org/openbase/jul/exception/MultiException.java | MultiException.checkAndThrow | public static void checkAndThrow(final Callable<String> messageProvider, final ExceptionStack exceptionStack) throws MultiException {
if (exceptionStack == null || exceptionStack.isEmpty()) {
return;
}
String message;
try {
message = messageProvider.call();
} catch (Exception ex) {
message = "?";
ExceptionPrinter.printHistory(new NotAvailableException("MultiException", "Message", ex), LOGGER);
}
throw new MultiException(message, exceptionStack);
} | java | public static void checkAndThrow(final Callable<String> messageProvider, final ExceptionStack exceptionStack) throws MultiException {
if (exceptionStack == null || exceptionStack.isEmpty()) {
return;
}
String message;
try {
message = messageProvider.call();
} catch (Exception ex) {
message = "?";
ExceptionPrinter.printHistory(new NotAvailableException("MultiException", "Message", ex), LOGGER);
}
throw new MultiException(message, exceptionStack);
} | [
"public",
"static",
"void",
"checkAndThrow",
"(",
"final",
"Callable",
"<",
"String",
">",
"messageProvider",
",",
"final",
"ExceptionStack",
"exceptionStack",
")",
"throws",
"MultiException",
"{",
"if",
"(",
"exceptionStack",
"==",
"null",
"||",
"exceptionStack",
... | Method throws an exception if the given {@code exceptionStack} contains any exceptions, otherwise this method has no effect.
<p>
Note: The message provider is only used in case the {@code MultiException} is generated, which means any operations within the call body are only performed in case of an exception.
@param messageProvider the message provider is used to deliver the {@code MultiException} headline message in case the {@code exceptionStack} contains any exceptions.
@param exceptionStack the stack to check.
@throws MultiException is thrown if the {@code exceptionStack} contains any exceptions. | [
"Method",
"throws",
"an",
"exception",
"if",
"the",
"given",
"{",
"@code",
"exceptionStack",
"}",
"contains",
"any",
"exceptions",
"otherwise",
"this",
"method",
"has",
"no",
"effect",
".",
"<p",
">",
"Note",
":",
"The",
"message",
"provider",
"is",
"only",
... | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/MultiException.java#L70-L83 |
datasalt/pangool | core/src/main/java/org/apache/avro/mapreduce/lib/output/AvroOutputFormat.java | AvroOutputFormat.setDeflateLevel | public static void setDeflateLevel(Job job, int level) {
FileOutputFormat.setCompressOutput(job, true);
job.getConfiguration().setInt(DEFLATE_LEVEL_KEY, level);
} | java | public static void setDeflateLevel(Job job, int level) {
FileOutputFormat.setCompressOutput(job, true);
job.getConfiguration().setInt(DEFLATE_LEVEL_KEY, level);
} | [
"public",
"static",
"void",
"setDeflateLevel",
"(",
"Job",
"job",
",",
"int",
"level",
")",
"{",
"FileOutputFormat",
".",
"setCompressOutput",
"(",
"job",
",",
"true",
")",
";",
"job",
".",
"getConfiguration",
"(",
")",
".",
"setInt",
"(",
"DEFLATE_LEVEL_KEY... | Enable output compression using the deflate codec and specify its level. | [
"Enable",
"output",
"compression",
"using",
"the",
"deflate",
"codec",
"and",
"specify",
"its",
"level",
"."
] | train | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/org/apache/avro/mapreduce/lib/output/AvroOutputFormat.java#L66-L69 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.doNormal | private ZealotKhala doNormal(String prefix, String field, Object value, String suffix, boolean match) {
if (match) {
SqlInfoBuilder.newInstace(this.source.setPrefix(prefix)).buildNormalSql(field, value, suffix);
this.source.resetPrefix();
}
return this;
} | java | private ZealotKhala doNormal(String prefix, String field, Object value, String suffix, boolean match) {
if (match) {
SqlInfoBuilder.newInstace(this.source.setPrefix(prefix)).buildNormalSql(field, value, suffix);
this.source.resetPrefix();
}
return this;
} | [
"private",
"ZealotKhala",
"doNormal",
"(",
"String",
"prefix",
",",
"String",
"field",
",",
"Object",
"value",
",",
"String",
"suffix",
",",
"boolean",
"match",
")",
"{",
"if",
"(",
"match",
")",
"{",
"SqlInfoBuilder",
".",
"newInstace",
"(",
"this",
".",
... | 执行生成等值查询SQL片段的方法.
@param prefix 前缀
@param field 数据库字段
@param value 值
@param suffix 后缀
@param match 是否匹配
@return ZealotKhala实例的当前实例 | [
"执行生成等值查询SQL片段的方法",
"."
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L375-L381 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java | SnowflakeAzureClient.buildAzureStorageEndpointURI | private static URI buildAzureStorageEndpointURI(String storageEndPoint, String storageAccount)
throws URISyntaxException
{
URI storageEndpoint = new URI(
"https", storageAccount + "." + storageEndPoint + "/",
null, null);
return storageEndpoint;
} | java | private static URI buildAzureStorageEndpointURI(String storageEndPoint, String storageAccount)
throws URISyntaxException
{
URI storageEndpoint = new URI(
"https", storageAccount + "." + storageEndPoint + "/",
null, null);
return storageEndpoint;
} | [
"private",
"static",
"URI",
"buildAzureStorageEndpointURI",
"(",
"String",
"storageEndPoint",
",",
"String",
"storageAccount",
")",
"throws",
"URISyntaxException",
"{",
"URI",
"storageEndpoint",
"=",
"new",
"URI",
"(",
"\"https\"",
",",
"storageAccount",
"+",
"\".\"",... | /*
Builds a URI to a Azure Storage account endpoint
@param storageEndPoint the storage endpoint name
@param storageAccount the storage account name | [
"/",
"*",
"Builds",
"a",
"URI",
"to",
"a",
"Azure",
"Storage",
"account",
"endpoint"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/SnowflakeAzureClient.java#L771-L779 |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/expression/AliasExpressionParser.java | AliasExpressionParser.parseTableAlias | public Optional<String> parseTableAlias(final SQLStatement sqlStatement, final boolean setTableToken, final String tableName) {
if (lexerEngine.skipIfEqual(DefaultKeyword.AS)) {
return parseWithAs(sqlStatement, setTableToken, tableName);
}
if (lexerEngine.equalAny(getDefaultAvailableKeywordsForTableAlias()) || lexerEngine.equalAny(getCustomizedAvailableKeywordsForTableAlias())) {
return parseAlias(sqlStatement, setTableToken, tableName);
}
return Optional.absent();
} | java | public Optional<String> parseTableAlias(final SQLStatement sqlStatement, final boolean setTableToken, final String tableName) {
if (lexerEngine.skipIfEqual(DefaultKeyword.AS)) {
return parseWithAs(sqlStatement, setTableToken, tableName);
}
if (lexerEngine.equalAny(getDefaultAvailableKeywordsForTableAlias()) || lexerEngine.equalAny(getCustomizedAvailableKeywordsForTableAlias())) {
return parseAlias(sqlStatement, setTableToken, tableName);
}
return Optional.absent();
} | [
"public",
"Optional",
"<",
"String",
">",
"parseTableAlias",
"(",
"final",
"SQLStatement",
"sqlStatement",
",",
"final",
"boolean",
"setTableToken",
",",
"final",
"String",
"tableName",
")",
"{",
"if",
"(",
"lexerEngine",
".",
"skipIfEqual",
"(",
"DefaultKeyword",... | Parse alias for table.
@param sqlStatement SQL statement
@param setTableToken is add table token
@param tableName table name
@return alias for table | [
"Parse",
"alias",
"for",
"table",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/expression/AliasExpressionParser.java#L103-L111 |
junit-team/junit4 | src/main/java/org/junit/Assert.java | Assert.assertNotEquals | public static void assertNotEquals(String message, long unexpected, long actual) {
if (unexpected == actual) {
failEquals(message, Long.valueOf(actual));
}
} | java | public static void assertNotEquals(String message, long unexpected, long actual) {
if (unexpected == actual) {
failEquals(message, Long.valueOf(actual));
}
} | [
"public",
"static",
"void",
"assertNotEquals",
"(",
"String",
"message",
",",
"long",
"unexpected",
",",
"long",
"actual",
")",
"{",
"if",
"(",
"unexpected",
"==",
"actual",
")",
"{",
"failEquals",
"(",
"message",
",",
"Long",
".",
"valueOf",
"(",
"actual"... | Asserts that two longs are <b>not</b> equals. If they are, an
{@link AssertionError} is thrown with the given message.
@param message the identifying message for the {@link AssertionError} (<code>null</code>
okay)
@param unexpected unexpected value to check
@param actual the value to check against <code>unexpected</code> | [
"Asserts",
"that",
"two",
"longs",
"are",
"<b",
">",
"not<",
"/",
"b",
">",
"equals",
".",
"If",
"they",
"are",
"an",
"{",
"@link",
"AssertionError",
"}",
"is",
"thrown",
"with",
"the",
"given",
"message",
"."
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/Assert.java#L199-L203 |
knowm/Sundial | src/main/java/org/quartz/core/RAMJobStore.java | RAMJobStore.storeJobAndTrigger | @Override
public void storeJobAndTrigger(JobDetail newJob, OperableTrigger newTrigger)
throws JobPersistenceException {
storeJob(newJob, false);
storeTrigger(newTrigger, false);
} | java | @Override
public void storeJobAndTrigger(JobDetail newJob, OperableTrigger newTrigger)
throws JobPersistenceException {
storeJob(newJob, false);
storeTrigger(newTrigger, false);
} | [
"@",
"Override",
"public",
"void",
"storeJobAndTrigger",
"(",
"JobDetail",
"newJob",
",",
"OperableTrigger",
"newTrigger",
")",
"throws",
"JobPersistenceException",
"{",
"storeJob",
"(",
"newJob",
",",
"false",
")",
";",
"storeTrigger",
"(",
"newTrigger",
",",
"fa... | Store the given <code>{@link org.quartz.jobs.JobDetail}</code> and <code>
{@link org.quartz.triggers.Trigger}</code>.
@param newJob The <code>JobDetail</code> to be stored.
@param newTrigger The <code>Trigger</code> to be stored.
@throws ObjectAlreadyExistsException if a <code>Job</code> with the same name/group already
exists. | [
"Store",
"the",
"given",
"<code",
">",
"{",
"@link",
"org",
".",
"quartz",
".",
"jobs",
".",
"JobDetail",
"}",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"{",
"@link",
"org",
".",
"quartz",
".",
"triggers",
".",
"Trigger",
"}",
"<",
"/",
"code",
... | train | https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/quartz/core/RAMJobStore.java#L124-L130 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.getNonNegativeDoubleList | public List<Double> getNonNegativeDoubleList(final String param) {
return getList(param, new StringToDouble(),
new IsNonNegative<Double>(), "non-negative double");
} | java | public List<Double> getNonNegativeDoubleList(final String param) {
return getList(param, new StringToDouble(),
new IsNonNegative<Double>(), "non-negative double");
} | [
"public",
"List",
"<",
"Double",
">",
"getNonNegativeDoubleList",
"(",
"final",
"String",
"param",
")",
"{",
"return",
"getList",
"(",
"param",
",",
"new",
"StringToDouble",
"(",
")",
",",
"new",
"IsNonNegative",
"<",
"Double",
">",
"(",
")",
",",
"\"non-n... | Gets a parameter whose value is a (possibly empty) list of non-negative doubles. | [
"Gets",
"a",
"parameter",
"whose",
"value",
"is",
"a",
"(",
"possibly",
"empty",
")",
"list",
"of",
"non",
"-",
"negative",
"doubles",
"."
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L717-L720 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/InitialReportWorker.java | InitialReportWorker.processReport | static void processReport(FSNamesystem namesystem, Collection<Block> toRetry,
BlockListAsLongs newReport, DatanodeDescriptor node,
ExecutorService initialBlockReportExecutor) throws IOException {
// spawn one thread for blocksPerShardBR blocks
int numShards = Math
.min(
namesystem.parallelProcessingThreads,
((newReport.getNumberOfBlocks()
+ namesystem.parallelBRblocksPerShard - 1) / namesystem.parallelBRblocksPerShard));
List<Future<List<Block>>> workers = new ArrayList<Future<List<Block>>>(
numShards);
// submit tasks for execution
for (int i = 0; i < numShards; i++) {
workers.add(initialBlockReportExecutor.submit(new InitialReportWorker(
newReport, i, numShards, node, namesystem.getNameNode()
.shouldRetryAbsentBlocks(), namesystem)));
}
// get results and add to retry list if need
try {
for (Future<List<Block>> worker : workers) {
if (namesystem.getNameNode().shouldRetryAbsentBlocks()) {
toRetry.addAll(worker.get());
} else {
worker.get();
}
}
} catch (ExecutionException e) {
LOG.warn("Parallel report failed", e);
throw new IOException(e);
} catch (InterruptedException e) {
throw new IOException("Interruption", e);
}
} | java | static void processReport(FSNamesystem namesystem, Collection<Block> toRetry,
BlockListAsLongs newReport, DatanodeDescriptor node,
ExecutorService initialBlockReportExecutor) throws IOException {
// spawn one thread for blocksPerShardBR blocks
int numShards = Math
.min(
namesystem.parallelProcessingThreads,
((newReport.getNumberOfBlocks()
+ namesystem.parallelBRblocksPerShard - 1) / namesystem.parallelBRblocksPerShard));
List<Future<List<Block>>> workers = new ArrayList<Future<List<Block>>>(
numShards);
// submit tasks for execution
for (int i = 0; i < numShards; i++) {
workers.add(initialBlockReportExecutor.submit(new InitialReportWorker(
newReport, i, numShards, node, namesystem.getNameNode()
.shouldRetryAbsentBlocks(), namesystem)));
}
// get results and add to retry list if need
try {
for (Future<List<Block>> worker : workers) {
if (namesystem.getNameNode().shouldRetryAbsentBlocks()) {
toRetry.addAll(worker.get());
} else {
worker.get();
}
}
} catch (ExecutionException e) {
LOG.warn("Parallel report failed", e);
throw new IOException(e);
} catch (InterruptedException e) {
throw new IOException("Interruption", e);
}
} | [
"static",
"void",
"processReport",
"(",
"FSNamesystem",
"namesystem",
",",
"Collection",
"<",
"Block",
">",
"toRetry",
",",
"BlockListAsLongs",
"newReport",
",",
"DatanodeDescriptor",
"node",
",",
"ExecutorService",
"initialBlockReportExecutor",
")",
"throws",
"IOExcept... | Processes a single initial block reports, by spawning multiple threads to
handle insertion to the blocks map. Each thread stores the inserted blocks
in a local list, and at the end, the list are concatenated for a single
datanode descriptor. | [
"Processes",
"a",
"single",
"initial",
"block",
"reports",
"by",
"spawning",
"multiple",
"threads",
"to",
"handle",
"insertion",
"to",
"the",
"blocks",
"map",
".",
"Each",
"thread",
"stores",
"the",
"inserted",
"blocks",
"in",
"a",
"local",
"list",
"and",
"a... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/InitialReportWorker.java#L207-L241 |
alexcojocaru/elasticsearch-maven-plugin | src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/client/Monitor.java | Monitor.isClusterRunning | public static boolean isClusterRunning(String clusterName, int instanceCount, int httpPort)
{
Log log = Mockito.mock(Log.class);
try (ElasticsearchClient client = new ElasticsearchClient.Builder()
.withLog(log)
.withHostname("localhost")
.withPort(httpPort)
.withSocketTimeout(5000)
.build())
{
return isClusterRunning(clusterName, instanceCount, client);
}
} | java | public static boolean isClusterRunning(String clusterName, int instanceCount, int httpPort)
{
Log log = Mockito.mock(Log.class);
try (ElasticsearchClient client = new ElasticsearchClient.Builder()
.withLog(log)
.withHostname("localhost")
.withPort(httpPort)
.withSocketTimeout(5000)
.build())
{
return isClusterRunning(clusterName, instanceCount, client);
}
} | [
"public",
"static",
"boolean",
"isClusterRunning",
"(",
"String",
"clusterName",
",",
"int",
"instanceCount",
",",
"int",
"httpPort",
")",
"{",
"Log",
"log",
"=",
"Mockito",
".",
"mock",
"(",
"Log",
".",
"class",
")",
";",
"try",
"(",
"ElasticsearchClient",
... | Verify that the cluster name and the number of nodes in the cluster,
as reported by the ES node, is as expected.
@param clusterName the ES cluster name
@param instanceCount the number of ES nodes in the cluster
@param httpPort the HTTP port to connect to ES
@return true if the cluster is running, false otherwise | [
"Verify",
"that",
"the",
"cluster",
"name",
"and",
"the",
"number",
"of",
"nodes",
"in",
"the",
"cluster",
"as",
"reported",
"by",
"the",
"ES",
"node",
"is",
"as",
"expected",
"."
] | train | https://github.com/alexcojocaru/elasticsearch-maven-plugin/blob/c283053cf99dc6b6d411b58629364b6aae62b7f8/src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/client/Monitor.java#L176-L189 |
CloudSlang/score | worker/worker-execution/score-worker-execution-impl/src/main/java/io/cloudslang/worker/execution/services/ExecutionServiceImpl.java | ExecutionServiceImpl.handlePausedFlowAfterStep | private boolean handlePausedFlowAfterStep(Execution execution) throws InterruptedException {
String branchId = execution.getSystemContext().getBranchId();
PauseReason reason = null;
ExecutionSummary execSummary = pauseService.readPausedExecution(execution.getExecutionId(), branchId);
if (execSummary != null && execSummary.getStatus().equals(ExecutionStatus.PENDING_PAUSE)) {
reason = execSummary.getPauseReason();
}
if (reason != null) { // need to pause the execution
pauseFlow(reason, execution);
return true;
}
return false;
} | java | private boolean handlePausedFlowAfterStep(Execution execution) throws InterruptedException {
String branchId = execution.getSystemContext().getBranchId();
PauseReason reason = null;
ExecutionSummary execSummary = pauseService.readPausedExecution(execution.getExecutionId(), branchId);
if (execSummary != null && execSummary.getStatus().equals(ExecutionStatus.PENDING_PAUSE)) {
reason = execSummary.getPauseReason();
}
if (reason != null) { // need to pause the execution
pauseFlow(reason, execution);
return true;
}
return false;
} | [
"private",
"boolean",
"handlePausedFlowAfterStep",
"(",
"Execution",
"execution",
")",
"throws",
"InterruptedException",
"{",
"String",
"branchId",
"=",
"execution",
".",
"getSystemContext",
"(",
")",
".",
"getBranchId",
"(",
")",
";",
"PauseReason",
"reason",
"=",
... | no need to check if paused - because this is called after the step, when the Pause flag exists in the context | [
"no",
"need",
"to",
"check",
"if",
"paused",
"-",
"because",
"this",
"is",
"called",
"after",
"the",
"step",
"when",
"the",
"Pause",
"flag",
"exists",
"in",
"the",
"context"
] | train | https://github.com/CloudSlang/score/blob/796134e917843f4d95a90f7740d69dc5257a1a0e/worker/worker-execution/score-worker-execution-impl/src/main/java/io/cloudslang/worker/execution/services/ExecutionServiceImpl.java#L281-L293 |
threerings/nenya | core/src/main/java/com/threerings/cast/CharacterManager.java | CharacterManager.resolveActionSequence | public void resolveActionSequence (CharacterDescriptor desc, String action)
{
try {
if (getActionFrames(desc, action) == null) {
log.warning("Failed to resolve action sequence " +
"[desc=" + desc + ", action=" + action + "].");
}
} catch (NoSuchComponentException nsce) {
log.warning("Failed to resolve action sequence " +
"[nsce=" + nsce + "].");
}
} | java | public void resolveActionSequence (CharacterDescriptor desc, String action)
{
try {
if (getActionFrames(desc, action) == null) {
log.warning("Failed to resolve action sequence " +
"[desc=" + desc + ", action=" + action + "].");
}
} catch (NoSuchComponentException nsce) {
log.warning("Failed to resolve action sequence " +
"[nsce=" + nsce + "].");
}
} | [
"public",
"void",
"resolveActionSequence",
"(",
"CharacterDescriptor",
"desc",
",",
"String",
"action",
")",
"{",
"try",
"{",
"if",
"(",
"getActionFrames",
"(",
"desc",
",",
"action",
")",
"==",
"null",
")",
"{",
"log",
".",
"warning",
"(",
"\"Failed to reso... | Informs the character manager that the action sequence for the
given character descriptor is likely to be needed in the near
future and so any efforts that can be made to load it into the
action sequence cache in advance should be undertaken.
<p> This will eventually be revamped to spiffily load action
sequences in the background. | [
"Informs",
"the",
"character",
"manager",
"that",
"the",
"action",
"sequence",
"for",
"the",
"given",
"character",
"descriptor",
"is",
"likely",
"to",
"be",
"needed",
"in",
"the",
"near",
"future",
"and",
"so",
"any",
"efforts",
"that",
"can",
"be",
"made",
... | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterManager.java#L203-L215 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/cache/CmsFlexCacheClearDialog.java | CmsFlexCacheClearDialog.actionPurgeJspRepository | public void actionPurgeJspRepository() throws JspException {
OpenCms.fireCmsEvent(
new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, Collections.<String, Object> emptyMap()));
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR,
Collections.<String, Object> singletonMap("action", new Integer(CmsFlexCache.CLEAR_ENTRIES))));
setAction(CmsDialog.ACTION_CANCEL);
actionCloseDialog();
} | java | public void actionPurgeJspRepository() throws JspException {
OpenCms.fireCmsEvent(
new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, Collections.<String, Object> emptyMap()));
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR,
Collections.<String, Object> singletonMap("action", new Integer(CmsFlexCache.CLEAR_ENTRIES))));
setAction(CmsDialog.ACTION_CANCEL);
actionCloseDialog();
} | [
"public",
"void",
"actionPurgeJspRepository",
"(",
")",
"throws",
"JspException",
"{",
"OpenCms",
".",
"fireCmsEvent",
"(",
"new",
"CmsEvent",
"(",
"I_CmsEventListener",
".",
"EVENT_FLEX_PURGE_JSP_REPOSITORY",
",",
"Collections",
".",
"<",
"String",
",",
"Object",
"... | Purges the jsp repository.<p>
@throws JspException if something goes wrong | [
"Purges",
"the",
"jsp",
"repository",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/cache/CmsFlexCacheClearDialog.java#L163-L174 |
zaproxy/zaproxy | src/org/zaproxy/zap/view/StandardFieldsDialog.java | StandardFieldsDialog.addComboField | public <E> void addComboField(String fieldLabel, ComboBoxModel<E> comboBoxModel, boolean editable) {
validateNotTabbed();
JComboBox<E> field = new JComboBox<>(comboBoxModel);
field.setEditable(editable);
this.addField(fieldLabel, field, field, 0.0D);
} | java | public <E> void addComboField(String fieldLabel, ComboBoxModel<E> comboBoxModel, boolean editable) {
validateNotTabbed();
JComboBox<E> field = new JComboBox<>(comboBoxModel);
field.setEditable(editable);
this.addField(fieldLabel, field, field, 0.0D);
} | [
"public",
"<",
"E",
">",
"void",
"addComboField",
"(",
"String",
"fieldLabel",
",",
"ComboBoxModel",
"<",
"E",
">",
"comboBoxModel",
",",
"boolean",
"editable",
")",
"{",
"validateNotTabbed",
"(",
")",
";",
"JComboBox",
"<",
"E",
">",
"field",
"=",
"new",
... | Adds a combo box field, possibly editable, with the given label and model.
<p>
Control of selection state (i.e. set/get selected item) is done through the combo box model.
@param <E> the type of the elements of the combo box model.
@param fieldLabel the name of the label of the combo box field.
@param comboBoxModel the model to set into the combo box.
@param editable {@code true} if the combo box should be editable, {@code false} otherwise.
@throws IllegalArgumentException if any of the following conditions is true:
<ul>
<li>the dialogue has tabs;</li>
<li>a field with the given label already exists.</li>
</ul>
@since 2.6.0
@see #addComboField(String, ComboBoxModel)
@see #addComboField(int, String, ComboBoxModel, boolean)
@see #setComboBoxModel(String, ComboBoxModel) | [
"Adds",
"a",
"combo",
"box",
"field",
"possibly",
"editable",
"with",
"the",
"given",
"label",
"and",
"model",
".",
"<p",
">",
"Control",
"of",
"selection",
"state",
"(",
"i",
".",
"e",
".",
"set",
"/",
"get",
"selected",
"item",
")",
"is",
"done",
"... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/StandardFieldsDialog.java#L879-L884 |
iipc/webarchive-commons | src/main/java/org/archive/url/UsableURIFactory.java | UsableURIFactory.fixupAuthority | private String fixupAuthority(String uriAuthority, String charset) throws URIException {
// Lowercase the host part of the uriAuthority; don't destroy any
// userinfo capitalizations. Make sure no illegal characters in
// domainlabel substring of the uri authority.
if (uriAuthority != null) {
// Get rid of any trailing escaped spaces:
// http://www.archive.org%20. Rare but happens.
// TODO: reevaluate: do IE or firefox do such mid-URI space-removal?
// if not, we shouldn't either.
while(uriAuthority.endsWith(ESCAPED_SPACE)) {
uriAuthority = uriAuthority.substring(0,uriAuthority.length()-3);
}
// lowercase & IDN-punycode only the domain portion
int atIndex = uriAuthority.indexOf(COMMERCIAL_AT);
int portColonIndex = uriAuthority.indexOf(COLON,(atIndex<0)?0:atIndex);
if(atIndex<0 && portColonIndex<0) {
// most common case: neither userinfo nor port
return fixupDomainlabel(uriAuthority);
} else if (atIndex<0 && portColonIndex>-1) {
// next most common: port but no userinfo
String domain = fixupDomainlabel(uriAuthority.substring(0,portColonIndex));
String port = uriAuthority.substring(portColonIndex);
return domain + port;
} else if (atIndex>-1 && portColonIndex<0) {
// uncommon: userinfo, no port
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1));
return userinfo + domain;
} else {
// uncommon: userinfo, port
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1,portColonIndex));
String port = uriAuthority.substring(portColonIndex);
return userinfo + domain + port;
}
}
return uriAuthority;
} | java | private String fixupAuthority(String uriAuthority, String charset) throws URIException {
// Lowercase the host part of the uriAuthority; don't destroy any
// userinfo capitalizations. Make sure no illegal characters in
// domainlabel substring of the uri authority.
if (uriAuthority != null) {
// Get rid of any trailing escaped spaces:
// http://www.archive.org%20. Rare but happens.
// TODO: reevaluate: do IE or firefox do such mid-URI space-removal?
// if not, we shouldn't either.
while(uriAuthority.endsWith(ESCAPED_SPACE)) {
uriAuthority = uriAuthority.substring(0,uriAuthority.length()-3);
}
// lowercase & IDN-punycode only the domain portion
int atIndex = uriAuthority.indexOf(COMMERCIAL_AT);
int portColonIndex = uriAuthority.indexOf(COLON,(atIndex<0)?0:atIndex);
if(atIndex<0 && portColonIndex<0) {
// most common case: neither userinfo nor port
return fixupDomainlabel(uriAuthority);
} else if (atIndex<0 && portColonIndex>-1) {
// next most common: port but no userinfo
String domain = fixupDomainlabel(uriAuthority.substring(0,portColonIndex));
String port = uriAuthority.substring(portColonIndex);
return domain + port;
} else if (atIndex>-1 && portColonIndex<0) {
// uncommon: userinfo, no port
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1));
return userinfo + domain;
} else {
// uncommon: userinfo, port
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1,portColonIndex));
String port = uriAuthority.substring(portColonIndex);
return userinfo + domain + port;
}
}
return uriAuthority;
} | [
"private",
"String",
"fixupAuthority",
"(",
"String",
"uriAuthority",
",",
"String",
"charset",
")",
"throws",
"URIException",
"{",
"// Lowercase the host part of the uriAuthority; don't destroy any",
"// userinfo capitalizations. Make sure no illegal characters in",
"// domainlabel s... | Fixup 'authority' portion of URI, by removing any stray
encoded spaces, lowercasing any domain names, and applying
IDN-punycoding to Unicode domains.
@param uriAuthority the authority string to fix
@return fixed version
@throws URIException | [
"Fixup",
"authority",
"portion",
"of",
"URI",
"by",
"removing",
"any",
"stray",
"encoded",
"spaces",
"lowercasing",
"any",
"domain",
"names",
"and",
"applying",
"IDN",
"-",
"punycoding",
"to",
"Unicode",
"domains",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURIFactory.java#L545-L583 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ListTemplateBuilder.java | ListTemplateBuilder.addQuickReply | public ListTemplateBuilder addQuickReply(String title, String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | java | public ListTemplateBuilder addQuickReply(String title, String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | [
"public",
"ListTemplateBuilder",
"addQuickReply",
"(",
"String",
"title",
",",
"String",
"payload",
")",
"{",
"this",
".",
"messageBuilder",
".",
"addQuickReply",
"(",
"title",
",",
"payload",
")",
";",
"return",
"this",
";",
"}"
] | Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a> | [
"Adds",
"a",
"{",
"@link",
"QuickReply",
"}",
"to",
"the",
"current",
"object",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ListTemplateBuilder.java#L127-L130 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/querycache/subscriber/operation/PublisherCreateOperation.java | PublisherCreateOperation.readAndResetAccumulator | private Future<Object> readAndResetAccumulator(String mapName, String cacheId, Integer partitionId) {
Operation operation = new ReadAndResetAccumulatorOperation(mapName, cacheId);
OperationService operationService = getNodeEngine().getOperationService();
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
} | java | private Future<Object> readAndResetAccumulator(String mapName, String cacheId, Integer partitionId) {
Operation operation = new ReadAndResetAccumulatorOperation(mapName, cacheId);
OperationService operationService = getNodeEngine().getOperationService();
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
} | [
"private",
"Future",
"<",
"Object",
">",
"readAndResetAccumulator",
"(",
"String",
"mapName",
",",
"String",
"cacheId",
",",
"Integer",
"partitionId",
")",
"{",
"Operation",
"operation",
"=",
"new",
"ReadAndResetAccumulatorOperation",
"(",
"mapName",
",",
"cacheId",... | Read and reset the accumulator of query cache inside the given partition. | [
"Read",
"and",
"reset",
"the",
"accumulator",
"of",
"query",
"cache",
"inside",
"the",
"given",
"partition",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/querycache/subscriber/operation/PublisherCreateOperation.java#L229-L233 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/Parser.java | Parser.isDigitAt | public static boolean isDigitAt(String s, int pos) {
return pos > 0 && pos < s.length() && Character.isDigit(s.charAt(pos));
} | java | public static boolean isDigitAt(String s, int pos) {
return pos > 0 && pos < s.length() && Character.isDigit(s.charAt(pos));
} | [
"public",
"static",
"boolean",
"isDigitAt",
"(",
"String",
"s",
",",
"int",
"pos",
")",
"{",
"return",
"pos",
">",
"0",
"&&",
"pos",
"<",
"s",
".",
"length",
"(",
")",
"&&",
"Character",
".",
"isDigit",
"(",
"s",
".",
"charAt",
"(",
"pos",
")",
"... | Returns true if a given string {@code s} has digit at position {@code pos}.
@param s input string
@param pos position (0-based)
@return true if input string s has digit at position pos | [
"Returns",
"true",
"if",
"a",
"given",
"string",
"{"
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Parser.java#L756-L758 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/related/dublin/DublinCoreMetadata.java | DublinCoreMetadata.getValue | public static Object getValue(UserCoreRow<?, ?> row, DublinCoreType type) {
UserColumn column = getColumn(row, type);
Object value = row.getValue(column.getIndex());
return value;
} | java | public static Object getValue(UserCoreRow<?, ?> row, DublinCoreType type) {
UserColumn column = getColumn(row, type);
Object value = row.getValue(column.getIndex());
return value;
} | [
"public",
"static",
"Object",
"getValue",
"(",
"UserCoreRow",
"<",
"?",
",",
"?",
">",
"row",
",",
"DublinCoreType",
"type",
")",
"{",
"UserColumn",
"column",
"=",
"getColumn",
"(",
"row",
",",
"type",
")",
";",
"Object",
"value",
"=",
"row",
".",
"get... | Get the value from the row for the Dublin Core Type term
@param row
user row
@param type
Dublin Core Type
@return value | [
"Get",
"the",
"value",
"from",
"the",
"row",
"for",
"the",
"Dublin",
"Core",
"Type",
"term"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/dublin/DublinCoreMetadata.java#L108-L115 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.unescapeUriPathSegment | public static void unescapeUriPathSegment(final String text, final Writer writer, final String encoding)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
UriEscapeUtil.unescape(new InternalStringReader(text), writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding);
} | java | public static void unescapeUriPathSegment(final String text, final Writer writer, final String encoding)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
UriEscapeUtil.unescape(new InternalStringReader(text), writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding);
} | [
"public",
"static",
"void",
"unescapeUriPathSegment",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
",",
"final",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"throw",
"new",
"Illeg... | <p>
Perform am URI path segment <strong>unescape</strong> operation
on a <tt>String</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input,
even for those characters that do not need to be percent-encoded in this context (unreserved characters
can be percent-encoded even if/when this is not required, though it is not generally considered a
good practice).
</p>
<p>
This method will use specified <tt>encoding</tt> in order to determine the characters specified in the
percent-encoded byte sequences.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@param encoding the encoding to be used for unescaping.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"am",
"URI",
"path",
"segment",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
"."... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1911-L1924 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/modelimport/elephas/ElephasModelImport.java | ElephasModelImport.importElephasModelAndWeights | public static SparkComputationGraph importElephasModelAndWeights(JavaSparkContext sparkContext,
String modelHdf5Filename)
throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
ComputationGraph model = KerasModelImport.importKerasModelAndWeights(modelHdf5Filename, true);
Map<String, Object> distributedProperties = distributedTrainingMap(modelHdf5Filename);
TrainingMaster tm = getTrainingMaster(distributedProperties);
return new SparkComputationGraph(sparkContext, model, tm);
} | java | public static SparkComputationGraph importElephasModelAndWeights(JavaSparkContext sparkContext,
String modelHdf5Filename)
throws IOException, UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
ComputationGraph model = KerasModelImport.importKerasModelAndWeights(modelHdf5Filename, true);
Map<String, Object> distributedProperties = distributedTrainingMap(modelHdf5Filename);
TrainingMaster tm = getTrainingMaster(distributedProperties);
return new SparkComputationGraph(sparkContext, model, tm);
} | [
"public",
"static",
"SparkComputationGraph",
"importElephasModelAndWeights",
"(",
"JavaSparkContext",
"sparkContext",
",",
"String",
"modelHdf5Filename",
")",
"throws",
"IOException",
",",
"UnsupportedKerasConfigurationException",
",",
"InvalidKerasConfigurationException",
"{",
"... | Load Elephas model stored using model.save(...) in case that the underlying Keras
model is a functional `Model` instance, which corresponds to a DL4J SparkComputationGraph.
@param sparkContext Java SparkContext
@param modelHdf5Filename Path to HDF5 archive storing Elephas Model
@return SparkComputationGraph Spark computation graph
@throws IOException IO exception
@throws InvalidKerasConfigurationException Invalid Keras config
@throws UnsupportedKerasConfigurationException Unsupported Keras config
@see SparkComputationGraph | [
"Load",
"Elephas",
"model",
"stored",
"using",
"model",
".",
"save",
"(",
"...",
")",
"in",
"case",
"that",
"the",
"underlying",
"Keras",
"model",
"is",
"a",
"functional",
"Model",
"instance",
"which",
"corresponds",
"to",
"a",
"DL4J",
"SparkComputationGraph",... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/modelimport/elephas/ElephasModelImport.java#L68-L77 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Multiset.java | Multiset.computeIfPresent | public <E extends Exception> int computeIfPresent(T e, Try.BiFunction<? super T, Integer, Integer, E> remappingFunction) throws E {
N.checkArgNotNull(remappingFunction);
final int oldValue = get(e);
if (oldValue == 0) {
return oldValue;
}
final int newValue = remappingFunction.apply(e, oldValue);
if (newValue > 0) {
set(e, newValue);
} else {
remove(e);
}
return newValue;
} | java | public <E extends Exception> int computeIfPresent(T e, Try.BiFunction<? super T, Integer, Integer, E> remappingFunction) throws E {
N.checkArgNotNull(remappingFunction);
final int oldValue = get(e);
if (oldValue == 0) {
return oldValue;
}
final int newValue = remappingFunction.apply(e, oldValue);
if (newValue > 0) {
set(e, newValue);
} else {
remove(e);
}
return newValue;
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"int",
"computeIfPresent",
"(",
"T",
"e",
",",
"Try",
".",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"Integer",
",",
"Integer",
",",
"E",
">",
"remappingFunction",
")",
"throws",
"E",
"{",
"N",
".",
"... | The implementation is equivalent to performing the following steps for this Multiset:
<pre>
final int oldValue = get(e);
if (oldValue == 0) {
return oldValue;
}
final int newValue = remappingFunction.apply(e, oldValue);
if (newValue > 0) {
set(e, newValue);
} else {
remove(e);
}
return newValue;
</pre>
@param e
@param remappingFunction
@return | [
"The",
"implementation",
"is",
"equivalent",
"to",
"performing",
"the",
"following",
"steps",
"for",
"this",
"Multiset",
":"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multiset.java#L1282-L1300 |
termsuite/termsuite-core | src/main/java/fr/univnantes/termsuite/uima/readers/AbstractTermSuiteCollectionReader.java | AbstractTermSuiteCollectionReader.getFileFilter | protected FilenameFilter getFileFilter() {
// accepts all files in default implementation
return new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return true;
}
};
} | java | protected FilenameFilter getFileFilter() {
// accepts all files in default implementation
return new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return true;
}
};
} | [
"protected",
"FilenameFilter",
"getFileFilter",
"(",
")",
"{",
"// accepts all files in default implementation",
"return",
"new",
"FilenameFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"dir",
",",
"String",
"name",
")",
"{",
... | The {@link FilenameFilter} for selecting input files to read.
@return | [
"The",
"{"
] | train | https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/uima/readers/AbstractTermSuiteCollectionReader.java#L232-L241 |
astrapi69/jaulp-wicket | jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java | WicketUrlExtensions.absoluteUrlFor | public static <C extends Page> String absoluteUrlFor(final Class<C> page,
final boolean withServerPort)
{
return absoluteUrlFor(page, null, withServerPort);
} | java | public static <C extends Page> String absoluteUrlFor(final Class<C> page,
final boolean withServerPort)
{
return absoluteUrlFor(page, null, withServerPort);
} | [
"public",
"static",
"<",
"C",
"extends",
"Page",
">",
"String",
"absoluteUrlFor",
"(",
"final",
"Class",
"<",
"C",
">",
"page",
",",
"final",
"boolean",
"withServerPort",
")",
"{",
"return",
"absoluteUrlFor",
"(",
"page",
",",
"null",
",",
"withServerPort",
... | Returns the absolute url for the given page and optionally with the server port.
@param <C>
the generic type
@param page
the page
@param withServerPort
the with server port
@return the string | [
"Returns",
"the",
"absolute",
"url",
"for",
"the",
"given",
"page",
"and",
"optionally",
"with",
"the",
"server",
"port",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L57-L61 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.fromGeometry | public static Feature fromGeometry(@Nullable Geometry geometry) {
return new Feature(TYPE, null, null, geometry, new JsonObject());
} | java | public static Feature fromGeometry(@Nullable Geometry geometry) {
return new Feature(TYPE, null, null, geometry, new JsonObject());
} | [
"public",
"static",
"Feature",
"fromGeometry",
"(",
"@",
"Nullable",
"Geometry",
"geometry",
")",
"{",
"return",
"new",
"Feature",
"(",
"TYPE",
",",
"null",
",",
"null",
",",
"geometry",
",",
"new",
"JsonObject",
"(",
")",
")",
";",
"}"
] | Create a new instance of this class by giving the feature a {@link Geometry}.
@param geometry a single geometry which makes up this feature object
@return a new instance of this class defined by the values passed inside this static factory
method
@since 1.0.0 | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"giving",
"the",
"feature",
"a",
"{",
"@link",
"Geometry",
"}",
"."
] | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L102-L104 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/data/update/NvdCveUpdater.java | NvdCveUpdater.retrieveLastModifiedDates | @SuppressFBWarnings(justification = "This is only called from within a synchronized method", value = {"IS2_INCONSISTENT_SYNC"})
private Map<String, Long> retrieveLastModifiedDates(int startYear, int endYear)
throws MalformedURLException, DownloadFailedException {
final Set<String> urls = new HashSet<>();
final String baseUrl = settings.getString(Settings.KEYS.CVE_BASE_JSON);
for (int i = startYear; i <= endYear; i++) {
final String url = String.format(baseUrl, i);
urls.add(url);
}
urls.add(settings.getString(Settings.KEYS.CVE_MODIFIED_JSON));
final Map<String, Future<Long>> timestampFutures = new HashMap<>();
urls.forEach((url) -> {
final TimestampRetriever timestampRetriever = new TimestampRetriever(url, settings);
final Future<Long> future = downloadExecutorService.submit(timestampRetriever);
timestampFutures.put(url, future);
} | java | @SuppressFBWarnings(justification = "This is only called from within a synchronized method", value = {"IS2_INCONSISTENT_SYNC"})
private Map<String, Long> retrieveLastModifiedDates(int startYear, int endYear)
throws MalformedURLException, DownloadFailedException {
final Set<String> urls = new HashSet<>();
final String baseUrl = settings.getString(Settings.KEYS.CVE_BASE_JSON);
for (int i = startYear; i <= endYear; i++) {
final String url = String.format(baseUrl, i);
urls.add(url);
}
urls.add(settings.getString(Settings.KEYS.CVE_MODIFIED_JSON));
final Map<String, Future<Long>> timestampFutures = new HashMap<>();
urls.forEach((url) -> {
final TimestampRetriever timestampRetriever = new TimestampRetriever(url, settings);
final Future<Long> future = downloadExecutorService.submit(timestampRetriever);
timestampFutures.put(url, future);
} | [
"@",
"SuppressFBWarnings",
"(",
"justification",
"=",
"\"This is only called from within a synchronized method\"",
",",
"value",
"=",
"{",
"\"IS2_INCONSISTENT_SYNC\"",
"}",
")",
"private",
"Map",
"<",
"String",
",",
"Long",
">",
"retrieveLastModifiedDates",
"(",
"int",
... | Retrieves the timestamps from the NVD CVE by checking the last modified
date.
@param startYear the first year whose item to check for the timestamp
@param endYear the last year whose item to check for the timestamp
@return the timestamps from the currently published NVD CVE downloads
page
@throws MalformedURLException thrown if the URL for the NVD CVE data is
incorrect.
@throws DownloadFailedException thrown if there is an error retrieving
the time stamps from the NVD CVE | [
"Retrieves",
"the",
"timestamps",
"from",
"the",
"NVD",
"CVE",
"by",
"checking",
"the",
"last",
"modified",
"date",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/update/NvdCveUpdater.java#L451-L468 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsEditModelPageMenuEntry.java | CmsEditModelPageMenuEntry.editModelPage | public static void editModelPage(final String resourcePath, boolean isModelGroup) {
if (CmsSitemapView.getInstance().getController().getData().isShowModelEditConfirm()) {
I_CmsConfirmDialogHandler handler = new I_CmsConfirmDialogHandler() {
public void onClose() {
// noop
}
public void onOk() {
openEditor(resourcePath);
}
};
String dialogTitle;
String dialogContent;
if (isModelGroup) {
dialogTitle = Messages.get().key(Messages.GUI_EDIT_MODEL_GROUPS_CONFIRM_TITLE_0);
dialogContent = Messages.get().key(Messages.GUI_EDIT_MODEL_GROUP_CONFIRM_CONTENT_0);
} else {
dialogTitle = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_CONFIRM_TITLE_0);
dialogContent = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_CONFIRM_CONTENT_0);
}
String buttonText = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_OK_0);
CmsConfirmDialog dialog = new CmsConfirmDialog(dialogTitle, dialogContent);
dialog.getOkButton().setText(buttonText);
dialog.setHandler(handler);
dialog.center();
} else {
openEditor(resourcePath);
}
} | java | public static void editModelPage(final String resourcePath, boolean isModelGroup) {
if (CmsSitemapView.getInstance().getController().getData().isShowModelEditConfirm()) {
I_CmsConfirmDialogHandler handler = new I_CmsConfirmDialogHandler() {
public void onClose() {
// noop
}
public void onOk() {
openEditor(resourcePath);
}
};
String dialogTitle;
String dialogContent;
if (isModelGroup) {
dialogTitle = Messages.get().key(Messages.GUI_EDIT_MODEL_GROUPS_CONFIRM_TITLE_0);
dialogContent = Messages.get().key(Messages.GUI_EDIT_MODEL_GROUP_CONFIRM_CONTENT_0);
} else {
dialogTitle = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_CONFIRM_TITLE_0);
dialogContent = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_CONFIRM_CONTENT_0);
}
String buttonText = Messages.get().key(Messages.GUI_EDIT_MODELPAGE_OK_0);
CmsConfirmDialog dialog = new CmsConfirmDialog(dialogTitle, dialogContent);
dialog.getOkButton().setText(buttonText);
dialog.setHandler(handler);
dialog.center();
} else {
openEditor(resourcePath);
}
} | [
"public",
"static",
"void",
"editModelPage",
"(",
"final",
"String",
"resourcePath",
",",
"boolean",
"isModelGroup",
")",
"{",
"if",
"(",
"CmsSitemapView",
".",
"getInstance",
"(",
")",
".",
"getController",
"(",
")",
".",
"getData",
"(",
")",
".",
"isShowMo... | Opens the editor for a model page menu entry.<p>
@param resourcePath the resource path of the model page
@param isModelGroup if the given entry is a model group page | [
"Opens",
"the",
"editor",
"for",
"a",
"model",
"page",
"menu",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsEditModelPageMenuEntry.java#L80-L113 |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java | QueryUpdateOnSubscribe.close | private void close(State state) {
// ensure close happens once only to avoid race conditions
if (state.closed.compareAndSet(false, true)) {
Util.closeQuietly(state.ps);
if (isCommit() || isRollback())
Util.closeQuietly(state.con);
else
Util.closeQuietlyIfAutoCommit(state.con);
}
} | java | private void close(State state) {
// ensure close happens once only to avoid race conditions
if (state.closed.compareAndSet(false, true)) {
Util.closeQuietly(state.ps);
if (isCommit() || isRollback())
Util.closeQuietly(state.con);
else
Util.closeQuietlyIfAutoCommit(state.con);
}
} | [
"private",
"void",
"close",
"(",
"State",
"state",
")",
"{",
"// ensure close happens once only to avoid race conditions",
"if",
"(",
"state",
".",
"closed",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"Util",
".",
"closeQuietly",
"(",
"state... | Cancels a running PreparedStatement, closing it and the current
Connection but only if auto commit mode. | [
"Cancels",
"a",
"running",
"PreparedStatement",
"closing",
"it",
"and",
"the",
"current",
"Connection",
"but",
"only",
"if",
"auto",
"commit",
"mode",
"."
] | train | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java#L318-L327 |
groupe-sii/ogham | ogham-core/src/main/java/fr/sii/ogham/html/inliner/impl/jsoup/ImageInlineUtils.java | ImageInlineUtils.isInlineModeAllowed | public static boolean isInlineModeAllowed(Element img, InlineMode mode) {
// if already inlined => reject (do not inline twice)
if (!img.attr(INLINED_ATTR).isEmpty()) {
return false;
}
// if inline mode defined but not the wanted mode => reject
if (!img.attr(INLINE_MODE_ATTR).isEmpty() && !img.attr(INLINE_MODE_ATTR).equals(mode.mode())) {
return false;
}
// if inline mode defined and matches the wanted mode => allow
// if no inline mode defined => allow (any mode allowed)
return true;
} | java | public static boolean isInlineModeAllowed(Element img, InlineMode mode) {
// if already inlined => reject (do not inline twice)
if (!img.attr(INLINED_ATTR).isEmpty()) {
return false;
}
// if inline mode defined but not the wanted mode => reject
if (!img.attr(INLINE_MODE_ATTR).isEmpty() && !img.attr(INLINE_MODE_ATTR).equals(mode.mode())) {
return false;
}
// if inline mode defined and matches the wanted mode => allow
// if no inline mode defined => allow (any mode allowed)
return true;
} | [
"public",
"static",
"boolean",
"isInlineModeAllowed",
"(",
"Element",
"img",
",",
"InlineMode",
"mode",
")",
"{",
"// if already inlined => reject (do not inline twice)",
"if",
"(",
"!",
"img",
".",
"attr",
"(",
"INLINED_ATTR",
")",
".",
"isEmpty",
"(",
")",
")",
... | Checks if inlining mode is allowed on the provided element.
@param img
the image element to check if the actual inlining mode is
allowed
@param mode
the actual mode
@return true if this mode is allowed, false otherwise | [
"Checks",
"if",
"inlining",
"mode",
"is",
"allowed",
"on",
"the",
"provided",
"element",
"."
] | train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/html/inliner/impl/jsoup/ImageInlineUtils.java#L31-L43 |
Frostman/dropbox4j | src/main/java/ru/frostman/dropbox/api/DropboxClient.java | DropboxClient.getMetadata | public Entry getMetadata(String path, String hash) {
return getMetadata(path, FILE_LIMIT, hash, true);
} | java | public Entry getMetadata(String path, String hash) {
return getMetadata(path, FILE_LIMIT, hash, true);
} | [
"public",
"Entry",
"getMetadata",
"(",
"String",
"path",
",",
"String",
"hash",
")",
"{",
"return",
"getMetadata",
"(",
"path",
",",
"FILE_LIMIT",
",",
"hash",
",",
"true",
")",
";",
"}"
] | Returns metadata information about specified resource with
checking for its hash. If nothing changes (hash isn't changed)
then 304 will returns.
@param path to file or directory
@param hash to check smth changed
@return metadata of specified resource
@see Entry | [
"Returns",
"metadata",
"information",
"about",
"specified",
"resource",
"with",
"checking",
"for",
"its",
"hash",
".",
"If",
"nothing",
"changes",
"(",
"hash",
"isn",
"t",
"changed",
")",
"then",
"304",
"will",
"returns",
"."
] | train | https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L133-L135 |
eurekaclinical/eurekaclinical-common | src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java | EurekaClinicalClient.doPostCreate | protected URI doPostCreate(String path, Object o, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
requestBuilder = ensurePostCreateJsonHeaders(headers, requestBuilder, true, false);
ClientResponse response = requestBuilder.post(ClientResponse.class, o);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED);
try {
return response.getLocation();
} finally {
response.close();
}
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | java | protected URI doPostCreate(String path, Object o, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
requestBuilder = ensurePostCreateJsonHeaders(headers, requestBuilder, true, false);
ClientResponse response = requestBuilder.post(ClientResponse.class, o);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED);
try {
return response.getLocation();
} finally {
response.close();
}
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | [
"protected",
"URI",
"doPostCreate",
"(",
"String",
"path",
",",
"Object",
"o",
",",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"ClientException",
"{",
"this",
".",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"W... | Creates a resource specified as a JSON object.
@param path the the API to call.
@param o the object that will be converted to JSON for sending. Must
either be a Java bean or be recognized by the object mapper.
@param headers If no Content Type header is provided, this method adds a
Content Type header for JSON.
@return the URI representing the created resource, for use in subsequent
operations on the resource.
@throws ClientException if a status code other than 200 (OK) and 201
(Created) is returned. | [
"Creates",
"a",
"resource",
"specified",
"as",
"a",
"JSON",
"object",
"."
] | train | https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L754-L771 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/Rectangle.java | Rectangle.setBounds | public void setBounds(float x, float y, float width, float height) {
setX(x);
setY(y);
setSize(width, height);
} | java | public void setBounds(float x, float y, float width, float height) {
setX(x);
setY(y);
setSize(width, height);
} | [
"public",
"void",
"setBounds",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"width",
",",
"float",
"height",
")",
"{",
"setX",
"(",
"x",
")",
";",
"setY",
"(",
"y",
")",
";",
"setSize",
"(",
"width",
",",
"height",
")",
";",
"}"
] | Set the bounds of this rectangle
@param x The x coordinate of this rectangle
@param y The y coordinate of this rectangle
@param width The width to set in this rectangle
@param height The height to set in this rectangle | [
"Set",
"the",
"bounds",
"of",
"this",
"rectangle"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Rectangle.java#L75-L79 |
palaima/DebugDrawer | debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java | UIUtils.setBackground | @SuppressLint("NewApi")
public static void setBackground(View v, Drawable d) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
v.setBackgroundDrawable(d);
} else {
v.setBackground(d);
}
} | java | @SuppressLint("NewApi")
public static void setBackground(View v, Drawable d) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
v.setBackgroundDrawable(d);
} else {
v.setBackground(d);
}
} | [
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"public",
"static",
"void",
"setBackground",
"(",
"View",
"v",
",",
"Drawable",
"d",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"JELLY_BEAN",
")",
"{... | helper method to set the background depending on the android version
@param v
@param d | [
"helper",
"method",
"to",
"set",
"the",
"background",
"depending",
"on",
"the",
"android",
"version"
] | train | https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer/src/main/java/io/palaima/debugdrawer/util/UIUtils.java#L38-L45 |
heneke/thymeleaf-extras-togglz | src/main/java/com/github/heneke/thymeleaf/togglz/processor/AbstractFeatureAttrProcessor.java | AbstractFeatureAttrProcessor.determineFeatureState | protected boolean determineFeatureState(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, boolean defaultState) {
final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(context.getConfiguration());
final IStandardExpression expression = expressionParser.parseExpression(context, attributeValue);
final Object value = expression.execute(context);
if (value != null) {
return isFeatureActive(value.toString());
}
else {
return defaultState;
}
} | java | protected boolean determineFeatureState(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, boolean defaultState) {
final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(context.getConfiguration());
final IStandardExpression expression = expressionParser.parseExpression(context, attributeValue);
final Object value = expression.execute(context);
if (value != null) {
return isFeatureActive(value.toString());
}
else {
return defaultState;
}
} | [
"protected",
"boolean",
"determineFeatureState",
"(",
"final",
"ITemplateContext",
"context",
",",
"final",
"IProcessableElementTag",
"tag",
",",
"final",
"AttributeName",
"attributeName",
",",
"final",
"String",
"attributeValue",
",",
"boolean",
"defaultState",
")",
"{... | Determines the feature state
@param context the template context
@param tag the tag
@param attributeName the attribute name
@param attributeValue the attribute value
@param defaultState the default state if the expression evaluates to null
@return the feature state | [
"Determines",
"the",
"feature",
"state"
] | train | https://github.com/heneke/thymeleaf-extras-togglz/blob/768984cd373c7220c35557799e79ddbc5d7f9cf2/src/main/java/com/github/heneke/thymeleaf/togglz/processor/AbstractFeatureAttrProcessor.java#L53-L63 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectHasValueImpl_CustomFieldSerializer.java | OWLObjectHasValueImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectHasValueImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectHasValueImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLObjectHasValueImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectHasValueImpl_CustomFieldSerializer.java#L93-L96 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/ScreenshotTaker.java | ScreenshotTaker.takeScreenshot | public void takeScreenshot(final String name, final int quality) {
View decorView = getScreenshotView();
if(decorView == null)
return;
initScreenShotSaver();
ScreenshotRunnable runnable = new ScreenshotRunnable(decorView, name, quality);
synchronized (screenshotMutex) {
Activity activity = activityUtils.getCurrentActivity(false);
if(activity != null)
activity.runOnUiThread(runnable);
else
instrumentation.runOnMainSync(runnable);
try {
screenshotMutex.wait(TIMEOUT_SCREENSHOT_MUTEX);
} catch (InterruptedException ignored) {
}
}
} | java | public void takeScreenshot(final String name, final int quality) {
View decorView = getScreenshotView();
if(decorView == null)
return;
initScreenShotSaver();
ScreenshotRunnable runnable = new ScreenshotRunnable(decorView, name, quality);
synchronized (screenshotMutex) {
Activity activity = activityUtils.getCurrentActivity(false);
if(activity != null)
activity.runOnUiThread(runnable);
else
instrumentation.runOnMainSync(runnable);
try {
screenshotMutex.wait(TIMEOUT_SCREENSHOT_MUTEX);
} catch (InterruptedException ignored) {
}
}
} | [
"public",
"void",
"takeScreenshot",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"quality",
")",
"{",
"View",
"decorView",
"=",
"getScreenshotView",
"(",
")",
";",
"if",
"(",
"decorView",
"==",
"null",
")",
"return",
";",
"initScreenShotSaver",
"(",
... | Takes a screenshot and saves it in the {@link Config} objects save path.
Requires write permission (android.permission.WRITE_EXTERNAL_STORAGE) in AndroidManifest.xml of the application under test.
@param name the name to give the screenshot image
@param quality the compression rate. From 0 (compress for lowest size) to 100 (compress for maximum quality). | [
"Takes",
"a",
"screenshot",
"and",
"saves",
"it",
"in",
"the",
"{",
"@link",
"Config",
"}",
"objects",
"save",
"path",
".",
"Requires",
"write",
"permission",
"(",
"android",
".",
"permission",
".",
"WRITE_EXTERNAL_STORAGE",
")",
"in",
"AndroidManifest",
".",
... | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/ScreenshotTaker.java#L76-L96 |
playn/playn | java-base/src/playn/java/JavaInput.java | JavaInput.postKey | public void postKey (long time, Key key, boolean pressed, char typedCh, int modFlags) {
kevQueue.add(key == null ?
new Keyboard.TypedEvent(modFlags, time, typedCh) :
new Keyboard.KeyEvent(modFlags, time, key, pressed));
} | java | public void postKey (long time, Key key, boolean pressed, char typedCh, int modFlags) {
kevQueue.add(key == null ?
new Keyboard.TypedEvent(modFlags, time, typedCh) :
new Keyboard.KeyEvent(modFlags, time, key, pressed));
} | [
"public",
"void",
"postKey",
"(",
"long",
"time",
",",
"Key",
"key",
",",
"boolean",
"pressed",
",",
"char",
"typedCh",
",",
"int",
"modFlags",
")",
"{",
"kevQueue",
".",
"add",
"(",
"key",
"==",
"null",
"?",
"new",
"Keyboard",
".",
"TypedEvent",
"(",
... | Posts a key event received from elsewhere (i.e. a native UI component). This is useful for
applications that are using GL in Canvas mode and sharing keyboard focus with other (non-GL)
components. The event will be queued and dispatched on the next frame, after GL keyboard
events.
@param time the time (in millis since epoch) at which the event was generated, or 0 if N/A.
@param key the key that was pressed or released, or null for a char typed event
@param pressed whether the key was pressed or released, ignored if key is null
@param typedCh the character that was typed, ignored if key is not null
@param modFlags modifier key state flags (generated by {@link #modifierFlags}) | [
"Posts",
"a",
"key",
"event",
"received",
"from",
"elsewhere",
"(",
"i",
".",
"e",
".",
"a",
"native",
"UI",
"component",
")",
".",
"This",
"is",
"useful",
"for",
"applications",
"that",
"are",
"using",
"GL",
"in",
"Canvas",
"mode",
"and",
"sharing",
"... | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaInput.java#L55-L59 |
GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java | MaterialPathAnimator.reverseAnimate | public static void reverseAnimate(Widget source, Widget target, Functions.Func reverseCallback) {
reverseAnimate(source.getElement(), target.getElement(), reverseCallback);
} | java | public static void reverseAnimate(Widget source, Widget target, Functions.Func reverseCallback) {
reverseAnimate(source.getElement(), target.getElement(), reverseCallback);
} | [
"public",
"static",
"void",
"reverseAnimate",
"(",
"Widget",
"source",
",",
"Widget",
"target",
",",
"Functions",
".",
"Func",
"reverseCallback",
")",
"{",
"reverseAnimate",
"(",
"source",
".",
"getElement",
"(",
")",
",",
"target",
".",
"getElement",
"(",
"... | Helper method to reverse animate the source element to target element with reverse callback.
@param source Source widget to apply the Path Animator
@param target Target widget to apply the Path Animator
@param reverseCallback The reverse callback method to be called when the path animator is applied | [
"Helper",
"method",
"to",
"reverse",
"animate",
"the",
"source",
"element",
"to",
"target",
"element",
"with",
"reverse",
"callback",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L234-L236 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsMappingProvider.java | SiftsMappingProvider.getSiftsMapping | public static List<SiftsEntity> getSiftsMapping(String pdbId) throws IOException{
// grab files from here:
AtomCache cache = new AtomCache();
String path = cache.getCachePath();
pdbId = pdbId.toLowerCase();
String dirHash = pdbId.substring(1,3);
File siftsDir = new File(path , "SIFTS");
if ( ! siftsDir.exists()) {
logger.info("Creating directory {}", siftsDir.toString());
siftsDir.mkdir();
}
File hashDir = new File(siftsDir, dirHash);
if ( ! hashDir.exists()){
logger.info("Creating directory {}", hashDir.toString());
hashDir.mkdir();
}
File dest = new File( hashDir, pdbId + ".sifts.xml.gz");
logger.debug("testing SIFTS file " + dest.getAbsolutePath());
if ( ! dest.exists()){
String u = String.format(fileLoc,pdbId);
URL url = new URL(u);
logger.debug("Downloading SIFTS file {} to {}",url,dest);
FileDownloadUtils.downloadFile(url, dest);
}
InputStreamProvider prov = new InputStreamProvider();
InputStream is = prov.getInputStream(dest);
SiftsXMLParser parser = new SiftsXMLParser();
parser.parseXmlFile(is);
//System.out.println(parser.getEntities());
return parser.getEntities();
} | java | public static List<SiftsEntity> getSiftsMapping(String pdbId) throws IOException{
// grab files from here:
AtomCache cache = new AtomCache();
String path = cache.getCachePath();
pdbId = pdbId.toLowerCase();
String dirHash = pdbId.substring(1,3);
File siftsDir = new File(path , "SIFTS");
if ( ! siftsDir.exists()) {
logger.info("Creating directory {}", siftsDir.toString());
siftsDir.mkdir();
}
File hashDir = new File(siftsDir, dirHash);
if ( ! hashDir.exists()){
logger.info("Creating directory {}", hashDir.toString());
hashDir.mkdir();
}
File dest = new File( hashDir, pdbId + ".sifts.xml.gz");
logger.debug("testing SIFTS file " + dest.getAbsolutePath());
if ( ! dest.exists()){
String u = String.format(fileLoc,pdbId);
URL url = new URL(u);
logger.debug("Downloading SIFTS file {} to {}",url,dest);
FileDownloadUtils.downloadFile(url, dest);
}
InputStreamProvider prov = new InputStreamProvider();
InputStream is = prov.getInputStream(dest);
SiftsXMLParser parser = new SiftsXMLParser();
parser.parseXmlFile(is);
//System.out.println(parser.getEntities());
return parser.getEntities();
} | [
"public",
"static",
"List",
"<",
"SiftsEntity",
">",
"getSiftsMapping",
"(",
"String",
"pdbId",
")",
"throws",
"IOException",
"{",
"// grab files from here:",
"AtomCache",
"cache",
"=",
"new",
"AtomCache",
"(",
")",
";",
"String",
"path",
"=",
"cache",
".",
"g... | Return the SIFTS mappings by getting the info from individual SIFTS xml files at URL {@value EBI_SIFTS_FILE_LOCATION}
@param pdbId the pdb identifier
@return
@throws IOException if problems downloading or parsing the file | [
"Return",
"the",
"SIFTS",
"mappings",
"by",
"getting",
"the",
"info",
"from",
"individual",
"SIFTS",
"xml",
"files",
"at",
"URL",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsMappingProvider.java#L58-L104 |
codegist/crest | core/src/main/java/org/codegist/crest/CRestBuilder.java | CRestBuilder.bindAnnotationHandler | public <A extends Annotation> CRestBuilder bindAnnotationHandler(Class<? extends AnnotationHandler<A>> handler, Class<A> annotationCls, Map<String, Object> config){
annotationHandlerBuilder.register(handler, new Class[]{annotationCls}, config);
return this;
} | java | public <A extends Annotation> CRestBuilder bindAnnotationHandler(Class<? extends AnnotationHandler<A>> handler, Class<A> annotationCls, Map<String, Object> config){
annotationHandlerBuilder.register(handler, new Class[]{annotationCls}, config);
return this;
} | [
"public",
"<",
"A",
"extends",
"Annotation",
">",
"CRestBuilder",
"bindAnnotationHandler",
"(",
"Class",
"<",
"?",
"extends",
"AnnotationHandler",
"<",
"A",
">",
">",
"handler",
",",
"Class",
"<",
"A",
">",
"annotationCls",
",",
"Map",
"<",
"String",
",",
... | <p>Binds an annotation handler for the given annotation.</p>
<p>Can be used to tell <b>CRest</b> how to handle user-defined annotation used in interfaces.</p>
@param handler The user-defined annotation handler
@param annotationCls The user-defined annotation
@param config State that will be passed to the annotation handler along with the CRestConfig object if the handler has declared a single argument constructor with CRestConfig parameter type
@param <A> Used-defined annotation type
@return current builder
@see org.codegist.crest.CRestConfig | [
"<p",
">",
"Binds",
"an",
"annotation",
"handler",
"for",
"the",
"given",
"annotation",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Can",
"be",
"used",
"to",
"tell",
"<b",
">",
"CRest<",
"/",
"b",
">",
"how",
"to",
"handle",
"user",
"-",
"defined",
"annot... | train | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L495-L498 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.