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 |
|---|---|---|---|---|---|---|---|---|---|---|
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java | ScopedRequestImpl.addParameter | public void addParameter( String name, String value )
{
if ( _additionalParameters == null )
{
_additionalParameters = new HashMap();
}
_additionalParameters.put( name, value );
} | java | public void addParameter( String name, String value )
{
if ( _additionalParameters == null )
{
_additionalParameters = new HashMap();
}
_additionalParameters.put( name, value );
} | [
"public",
"void",
"addParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"_additionalParameters",
"==",
"null",
")",
"{",
"_additionalParameters",
"=",
"new",
"HashMap",
"(",
")",
";",
"}",
"_additionalParameters",
".",
"put",
"(... | Add a parameter to the request.
@param name the parameter name.
@param value the parameter value. | [
"Add",
"a",
"parameter",
"to",
"the",
"request",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/internal/ScopedRequestImpl.java#L184-L192 |
zxing/zxing | core/src/main/java/com/google/zxing/datamatrix/DataMatrixReader.java | DataMatrixReader.extractPureBits | private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException {
int[] leftTopBlack = image.getTopLeftOnBit();
int[] rightBottomBlack = image.getBottomRightOnBit();
if (leftTopBlack == null || rightBottomBlack == null) {
throw NotFoundException.getNotFoundInstance();
}
int moduleSize = moduleSize(leftTopBlack, image);
int top = leftTopBlack[1];
int bottom = rightBottomBlack[1];
int left = leftTopBlack[0];
int right = rightBottomBlack[0];
int matrixWidth = (right - left + 1) / moduleSize;
int matrixHeight = (bottom - top + 1) / moduleSize;
if (matrixWidth <= 0 || matrixHeight <= 0) {
throw NotFoundException.getNotFoundInstance();
}
// Push in the "border" by half the module width so that we start
// sampling in the middle of the module. Just in case the image is a
// little off, this will help recover.
int nudge = moduleSize / 2;
top += nudge;
left += nudge;
// Now just read off the bits
BitMatrix bits = new BitMatrix(matrixWidth, matrixHeight);
for (int y = 0; y < matrixHeight; y++) {
int iOffset = top + y * moduleSize;
for (int x = 0; x < matrixWidth; x++) {
if (image.get(left + x * moduleSize, iOffset)) {
bits.set(x, y);
}
}
}
return bits;
} | java | private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException {
int[] leftTopBlack = image.getTopLeftOnBit();
int[] rightBottomBlack = image.getBottomRightOnBit();
if (leftTopBlack == null || rightBottomBlack == null) {
throw NotFoundException.getNotFoundInstance();
}
int moduleSize = moduleSize(leftTopBlack, image);
int top = leftTopBlack[1];
int bottom = rightBottomBlack[1];
int left = leftTopBlack[0];
int right = rightBottomBlack[0];
int matrixWidth = (right - left + 1) / moduleSize;
int matrixHeight = (bottom - top + 1) / moduleSize;
if (matrixWidth <= 0 || matrixHeight <= 0) {
throw NotFoundException.getNotFoundInstance();
}
// Push in the "border" by half the module width so that we start
// sampling in the middle of the module. Just in case the image is a
// little off, this will help recover.
int nudge = moduleSize / 2;
top += nudge;
left += nudge;
// Now just read off the bits
BitMatrix bits = new BitMatrix(matrixWidth, matrixHeight);
for (int y = 0; y < matrixHeight; y++) {
int iOffset = top + y * moduleSize;
for (int x = 0; x < matrixWidth; x++) {
if (image.get(left + x * moduleSize, iOffset)) {
bits.set(x, y);
}
}
}
return bits;
} | [
"private",
"static",
"BitMatrix",
"extractPureBits",
"(",
"BitMatrix",
"image",
")",
"throws",
"NotFoundException",
"{",
"int",
"[",
"]",
"leftTopBlack",
"=",
"image",
".",
"getTopLeftOnBit",
"(",
")",
";",
"int",
"[",
"]",
"rightBottomBlack",
"=",
"image",
".... | This method detects a code in a "pure" image -- that is, pure monochrome image
which contains only an unrotated, unskewed, image of a code, with some white border
around it. This is a specialized method that works exceptionally fast in this special
case. | [
"This",
"method",
"detects",
"a",
"code",
"in",
"a",
"pure",
"image",
"--",
"that",
"is",
"pure",
"monochrome",
"image",
"which",
"contains",
"only",
"an",
"unrotated",
"unskewed",
"image",
"of",
"a",
"code",
"with",
"some",
"white",
"border",
"around",
"i... | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/DataMatrixReader.java#L100-L139 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java | SerializedFormBuilder.buildSerializableMethods | public void buildSerializableMethods(XMLNode node, Content classContentTree) throws DocletException {
Content serializableMethodTree = methodWriter.getSerializableMethodsHeader();
SortedSet<ExecutableElement> members = utils.serializationMethods(currentTypeElement);
if (!members.isEmpty()) {
for (ExecutableElement member : members) {
currentMember = member;
Content methodsContentTree = methodWriter.getMethodsContentHeader(
currentMember == members.last());
buildChildren(node, methodsContentTree);
serializableMethodTree.addContent(methodsContentTree);
}
}
if (!utils.serializationMethods(currentTypeElement).isEmpty()) {
classContentTree.addContent(methodWriter.getSerializableMethods(
configuration.getText("doclet.Serialized_Form_methods"),
serializableMethodTree));
if (utils.isSerializable(currentTypeElement) && !utils.isExternalizable(currentTypeElement)) {
if (utils.serializationMethods(currentTypeElement).isEmpty()) {
Content noCustomizationMsg = methodWriter.getNoCustomizationMsg(
configuration.getText("doclet.Serializable_no_customization"));
classContentTree.addContent(methodWriter.getSerializableMethods(
configuration.getText("doclet.Serialized_Form_methods"),
noCustomizationMsg));
}
}
}
} | java | public void buildSerializableMethods(XMLNode node, Content classContentTree) throws DocletException {
Content serializableMethodTree = methodWriter.getSerializableMethodsHeader();
SortedSet<ExecutableElement> members = utils.serializationMethods(currentTypeElement);
if (!members.isEmpty()) {
for (ExecutableElement member : members) {
currentMember = member;
Content methodsContentTree = methodWriter.getMethodsContentHeader(
currentMember == members.last());
buildChildren(node, methodsContentTree);
serializableMethodTree.addContent(methodsContentTree);
}
}
if (!utils.serializationMethods(currentTypeElement).isEmpty()) {
classContentTree.addContent(methodWriter.getSerializableMethods(
configuration.getText("doclet.Serialized_Form_methods"),
serializableMethodTree));
if (utils.isSerializable(currentTypeElement) && !utils.isExternalizable(currentTypeElement)) {
if (utils.serializationMethods(currentTypeElement).isEmpty()) {
Content noCustomizationMsg = methodWriter.getNoCustomizationMsg(
configuration.getText("doclet.Serializable_no_customization"));
classContentTree.addContent(methodWriter.getSerializableMethods(
configuration.getText("doclet.Serialized_Form_methods"),
noCustomizationMsg));
}
}
}
} | [
"public",
"void",
"buildSerializableMethods",
"(",
"XMLNode",
"node",
",",
"Content",
"classContentTree",
")",
"throws",
"DocletException",
"{",
"Content",
"serializableMethodTree",
"=",
"methodWriter",
".",
"getSerializableMethodsHeader",
"(",
")",
";",
"SortedSet",
"<... | Build the summaries for the methods that belong to the given
class.
@param node the XML element that specifies which components to document
@param classContentTree content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation | [
"Build",
"the",
"summaries",
"for",
"the",
"methods",
"that",
"belong",
"to",
"the",
"given",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L288-L314 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.fatalf | public void fatalf(String format, Object param1) {
if (isEnabled(Level.FATAL)) {
doLogf(Level.FATAL, FQCN, format, new Object[] { param1 }, null);
}
} | java | public void fatalf(String format, Object param1) {
if (isEnabled(Level.FATAL)) {
doLogf(Level.FATAL, FQCN, format, new Object[] { param1 }, null);
}
} | [
"public",
"void",
"fatalf",
"(",
"String",
"format",
",",
"Object",
"param1",
")",
"{",
"if",
"(",
"isEnabled",
"(",
"Level",
".",
"FATAL",
")",
")",
"{",
"doLogf",
"(",
"Level",
".",
"FATAL",
",",
"FQCN",
",",
"format",
",",
"new",
"Object",
"[",
... | Issue a formatted log message with a level of FATAL.
@param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
@param param1 the sole parameter | [
"Issue",
"a",
"formatted",
"log",
"message",
"with",
"a",
"level",
"of",
"FATAL",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1947-L1951 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java | FastDatePrinter.applyRules | private <B extends Appendable> B applyRules(final Calendar calendar, final B buf) {
try {
for (final Rule rule : mRules) {
rule.appendTo(buf, calendar);
}
} catch (final IOException ioe) {
ExceptionUtils.rethrow(ioe);
}
return buf;
} | java | private <B extends Appendable> B applyRules(final Calendar calendar, final B buf) {
try {
for (final Rule rule : mRules) {
rule.appendTo(buf, calendar);
}
} catch (final IOException ioe) {
ExceptionUtils.rethrow(ioe);
}
return buf;
} | [
"private",
"<",
"B",
"extends",
"Appendable",
">",
"B",
"applyRules",
"(",
"final",
"Calendar",
"calendar",
",",
"final",
"B",
"buf",
")",
"{",
"try",
"{",
"for",
"(",
"final",
"Rule",
"rule",
":",
"mRules",
")",
"{",
"rule",
".",
"appendTo",
"(",
"b... | <p>Performs the formatting by applying the rules to the
specified calendar.</p>
@param calendar the calendar to format
@param buf the buffer to format into
@param <B> the Appendable class type, usually StringBuilder or StringBuffer.
@return the specified string buffer | [
"<p",
">",
"Performs",
"the",
"formatting",
"by",
"applying",
"the",
"rules",
"to",
"the",
"specified",
"calendar",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java#L573-L582 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.reportInternalError | protected void reportInternalError(String message, Object... parameters) {
getLogger().error(message, parameters);
if (getReportInternalProblemsAsIssues()) {
final org.eclipse.emf.common.util.URI uri = null;
final Issue.IssueImpl issue = new Issue.IssueImpl();
issue.setCode(INTERNAL_ERROR_CODE);
issue.setMessage(message);
issue.setUriToProblem(uri);
issue.setSeverity(Severity.ERROR);
notifiesIssueMessageListeners(issue, uri, message);
}
} | java | protected void reportInternalError(String message, Object... parameters) {
getLogger().error(message, parameters);
if (getReportInternalProblemsAsIssues()) {
final org.eclipse.emf.common.util.URI uri = null;
final Issue.IssueImpl issue = new Issue.IssueImpl();
issue.setCode(INTERNAL_ERROR_CODE);
issue.setMessage(message);
issue.setUriToProblem(uri);
issue.setSeverity(Severity.ERROR);
notifiesIssueMessageListeners(issue, uri, message);
}
} | [
"protected",
"void",
"reportInternalError",
"(",
"String",
"message",
",",
"Object",
"...",
"parameters",
")",
"{",
"getLogger",
"(",
")",
".",
"error",
"(",
"message",
",",
"parameters",
")",
";",
"if",
"(",
"getReportInternalProblemsAsIssues",
"(",
")",
")",... | Reports the given error message.
@param message the warning message.
@param parameters the values of the parameters that must be dynamically replaced within the message text.
@since 0.8 | [
"Reports",
"the",
"given",
"error",
"message",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1513-L1524 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/Session.java | Session.grantResource | public void grantResource(ResourceRequestInfo req, ResourceGrant grant) {
if (deleted) {
throw new RuntimeException("Session: " +
sessionId + " has been deleted");
}
removePendingRequest(req);
idToGrant.put(req.getId(), grant);
addGrantedRequest(req);
// Handle the first wait metrics
synchronized (typeToFirstWait) {
if (!typeToFirstWait.containsKey(req.getType())) {
throw new IllegalStateException(
"Impossible to get a grant prior to requesting a resource.");
}
Long firstWait = typeToFirstWait.get(req.getType());
if (firstWait == null) {
firstWait = new Long(ClusterManager.clock.getTime() - startTime);
typeToFirstWait.put(req.getType(), firstWait);
}
}
} | java | public void grantResource(ResourceRequestInfo req, ResourceGrant grant) {
if (deleted) {
throw new RuntimeException("Session: " +
sessionId + " has been deleted");
}
removePendingRequest(req);
idToGrant.put(req.getId(), grant);
addGrantedRequest(req);
// Handle the first wait metrics
synchronized (typeToFirstWait) {
if (!typeToFirstWait.containsKey(req.getType())) {
throw new IllegalStateException(
"Impossible to get a grant prior to requesting a resource.");
}
Long firstWait = typeToFirstWait.get(req.getType());
if (firstWait == null) {
firstWait = new Long(ClusterManager.clock.getTime() - startTime);
typeToFirstWait.put(req.getType(), firstWait);
}
}
} | [
"public",
"void",
"grantResource",
"(",
"ResourceRequestInfo",
"req",
",",
"ResourceGrant",
"grant",
")",
"{",
"if",
"(",
"deleted",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Session: \"",
"+",
"sessionId",
"+",
"\" has been deleted\"",
")",
";",
"}"... | Grant a resource to a session to satisfy a request. Update the finalized
first resource type times if not already set
@param req the request being satisfied
@param grant the grant satisfying the request | [
"Grant",
"a",
"resource",
"to",
"a",
"session",
"to",
"satisfy",
"a",
"request",
".",
"Update",
"the",
"finalized",
"first",
"resource",
"type",
"times",
"if",
"not",
"already",
"set"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Session.java#L1004-L1026 |
dkpro/dkpro-argumentation | dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java | JCasUtil2.hasNo | public static <T extends TOP> boolean hasNo(final Class<T> type, final JCas aJCas)
{
return !hasAny(type, aJCas);
} | java | public static <T extends TOP> boolean hasNo(final Class<T> type, final JCas aJCas)
{
return !hasAny(type, aJCas);
} | [
"public",
"static",
"<",
"T",
"extends",
"TOP",
">",
"boolean",
"hasNo",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"JCas",
"aJCas",
")",
"{",
"return",
"!",
"hasAny",
"(",
"type",
",",
"aJCas",
")",
";",
"}"
] | Returns whether there is no feature structure of the given type
@param type the type
@param aJCas the JCas
@return whether there is no feature structure of the given type | [
"Returns",
"whether",
"there",
"is",
"no",
"feature",
"structure",
"of",
"the",
"given",
"type"
] | train | https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java#L78-L81 |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java | ParseSupport.parseInputSourceWithFilter | private Document parseInputSourceWithFilter(InputSource s, XMLFilter f) throws JspException {
try {
XMLReader xr = XmlUtil.newXMLReader(entityResolver);
// (note that we overwrite the filter's parent. this seems
// to be expected usage. we could cache and reset the old
// parent, but you can't setParent(null), so this wouldn't
// be perfect.)
f.setParent(xr);
TransformerHandler th = XmlUtil.newTransformerHandler();
Document o = XmlUtil.newEmptyDocument();
th.setResult(new DOMResult(o));
f.setContentHandler(th);
f.parse(s);
return o;
} catch (IOException e) {
throw new JspException(e);
} catch (SAXException e) {
throw new JspException(e);
} catch (TransformerConfigurationException e) {
throw new JspException(e);
} catch (ParserConfigurationException e) {
throw new JspException(e);
}
} | java | private Document parseInputSourceWithFilter(InputSource s, XMLFilter f) throws JspException {
try {
XMLReader xr = XmlUtil.newXMLReader(entityResolver);
// (note that we overwrite the filter's parent. this seems
// to be expected usage. we could cache and reset the old
// parent, but you can't setParent(null), so this wouldn't
// be perfect.)
f.setParent(xr);
TransformerHandler th = XmlUtil.newTransformerHandler();
Document o = XmlUtil.newEmptyDocument();
th.setResult(new DOMResult(o));
f.setContentHandler(th);
f.parse(s);
return o;
} catch (IOException e) {
throw new JspException(e);
} catch (SAXException e) {
throw new JspException(e);
} catch (TransformerConfigurationException e) {
throw new JspException(e);
} catch (ParserConfigurationException e) {
throw new JspException(e);
}
} | [
"private",
"Document",
"parseInputSourceWithFilter",
"(",
"InputSource",
"s",
",",
"XMLFilter",
"f",
")",
"throws",
"JspException",
"{",
"try",
"{",
"XMLReader",
"xr",
"=",
"XmlUtil",
".",
"newXMLReader",
"(",
"entityResolver",
")",
";",
"// (note that we overwrit... | Parses the given InputSource after, applying the given XMLFilter. | [
"Parses",
"the",
"given",
"InputSource",
"after",
"applying",
"the",
"given",
"XMLFilter",
"."
] | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java#L142-L167 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/GroupsPoolsApi.java | GroupsPoolsApi.getGroups | public GroupSearch getGroups(int page, int perPage) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.pools.getGroups");
if (page > 0) {
params.put("page", Integer.toString(page));
}
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
return jinx.flickrGet(params, GroupSearch.class);
} | java | public GroupSearch getGroups(int page, int perPage) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.pools.getGroups");
if (page > 0) {
params.put("page", Integer.toString(page));
}
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
return jinx.flickrGet(params, GroupSearch.class);
} | [
"public",
"GroupSearch",
"getGroups",
"(",
"int",
"page",
",",
"int",
"perPage",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"method\"",... | Returns a list of groups to which you can add photos.
<br>
This method requires authentication with 'read' permission.
@param page The page of results to return. If this argument is less than 1, it defaults to 1.
@param perPage Number of groups to return per page. If this argument is less than 1, it defaults to 400. The maximum allowed value is 400.
@return object with the groups to which you can add photos.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.groups.pools.getGroups.html">flickr.groups.pools.getGroups</a> | [
"Returns",
"a",
"list",
"of",
"groups",
"to",
"which",
"you",
"can",
"add",
"photos",
".",
"<br",
">",
"This",
"method",
"requires",
"authentication",
"with",
"read",
"permission",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GroupsPoolsApi.java#L99-L109 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java | FindingReplacing.setBetn | public S setBetn(int leftIndex, int rightIndex) {
return set(Indexer.of(delegate.get()).between(leftIndex, rightIndex));
} | java | public S setBetn(int leftIndex, int rightIndex) {
return set(Indexer.of(delegate.get()).between(leftIndex, rightIndex));
} | [
"public",
"S",
"setBetn",
"(",
"int",
"leftIndex",
",",
"int",
"rightIndex",
")",
"{",
"return",
"set",
"(",
"Indexer",
".",
"of",
"(",
"delegate",
".",
"get",
"(",
")",
")",
".",
"between",
"(",
"leftIndex",
",",
"rightIndex",
")",
")",
";",
"}"
] | Sets the substring in given left index and right index as the delegate string
@param leftIndex
@param rightIndex
@return | [
"Sets",
"the",
"substring",
"in",
"given",
"left",
"index",
"and",
"right",
"index",
"as",
"the",
"delegate",
"string"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java#L314-L316 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java | HashtableOnDisk.put | public synchronized HashtableEntry put(Object key, Object value, int len, long expirationTime, long validatorExpirationTime,
byte[] serializedKey, byte[] serializedCacheValue, int valueHashcode, boolean isAliasId) // LI4337-17
throws IOException,
EOFException,
FileManagerException,
ClassNotFoundException,
HashtableOnDiskException {
if (key == null)
return null;
//if ( value == null ) return 0; // comment this line to allow the value=NULL
return mapPut(key, value, len, expirationTime, validatorExpirationTime, serializedKey, serializedCacheValue, valueHashcode, isAliasId); // LI4337-17
} | java | public synchronized HashtableEntry put(Object key, Object value, int len, long expirationTime, long validatorExpirationTime,
byte[] serializedKey, byte[] serializedCacheValue, int valueHashcode, boolean isAliasId) // LI4337-17
throws IOException,
EOFException,
FileManagerException,
ClassNotFoundException,
HashtableOnDiskException {
if (key == null)
return null;
//if ( value == null ) return 0; // comment this line to allow the value=NULL
return mapPut(key, value, len, expirationTime, validatorExpirationTime, serializedKey, serializedCacheValue, valueHashcode, isAliasId); // LI4337-17
} | [
"public",
"synchronized",
"HashtableEntry",
"put",
"(",
"Object",
"key",
",",
"Object",
"value",
",",
"int",
"len",
",",
"long",
"expirationTime",
",",
"long",
"validatorExpirationTime",
",",
"byte",
"[",
"]",
"serializedKey",
",",
"byte",
"[",
"]",
"serialize... | ************************************************************************
Associates the object with the key and stores it. If an object already
exists for this key it is replaced and the previous object discard. The
object is assumed to have been "manually" serialized by the caller and will
be written up to length "len", directly on disk with no further
serialization.
@param key The key for the object to store.
@param value The object to store (might be serialized cache entry)
@param len The maximum number of bytes from "value" to write to disk.
@param expirationTime The expiration time of this object
@param serializedKey the serialized key
@param serializedCacheValue the serialized cache value (value in cache entry)
@param isAliasId boolean to indicate alias id
@return HashTableEntry of old entry if exists. Return null if the key is null or the entry does not exist
@exception FileManagerException The underlying file manager has a problem.
@exception ClassNotFoundException Some key in the hash bucket cannot be
deserialized while searching to see if the object already exists. The
underlying file is likely corrupted.
@exception IOException The underlying file has a problem and is likely
corrupt.
@exception EOFxception We were asked to seek beyond the end of the file.
The file is likely corrupt.
@exception HashtableOnDiskException The hashtable header is readable but invalid.
One or more of the following is true: the magic string is invalid, the header
pointers are null, the header pointers do not point to a recognizable hashtable.
*********************************************************************** | [
"************************************************************************",
"Associates",
"the",
"object",
"with",
"the",
"key",
"and",
"stores",
"it",
".",
"If",
"an",
"object",
"already",
"exists",
"for",
"this",
"key",
"it",
"is",
"replaced",
"and",
"the",
"previou... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L885-L897 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/fdt/FdtSketch.java | FdtSketch.getResult | public List<Group> getResult(final int[] priKeyIndices, final int limit, final int numStdDev,
final char sep) {
final PostProcessor proc = new PostProcessor(this, new Group(), sep);
return proc.getGroupList(priKeyIndices, numStdDev, limit);
} | java | public List<Group> getResult(final int[] priKeyIndices, final int limit, final int numStdDev,
final char sep) {
final PostProcessor proc = new PostProcessor(this, new Group(), sep);
return proc.getGroupList(priKeyIndices, numStdDev, limit);
} | [
"public",
"List",
"<",
"Group",
">",
"getResult",
"(",
"final",
"int",
"[",
"]",
"priKeyIndices",
",",
"final",
"int",
"limit",
",",
"final",
"int",
"numStdDev",
",",
"final",
"char",
"sep",
")",
"{",
"final",
"PostProcessor",
"proc",
"=",
"new",
"PostPr... | Returns an ordered List of Groups of the most frequent distinct population of subset tuples
represented by the count of entries of each group.
@param priKeyIndices these indices define the dimensions used for the Primary Keys.
@param limit the maximum number of groups to return. If this value is ≤ 0, all
groups will be returned.
@param numStdDev the number of standard deviations for the upper and lower error bounds,
this value is an integer and must be one of 1, 2, or 3.
<a href="{@docRoot}/resources/dictionary.html#numStdDev">See Number of Standard Deviations</a>
@param sep the separator character
@return an ordered List of Groups of the most frequent distinct population of subset tuples
represented by the count of entries of each group. | [
"Returns",
"an",
"ordered",
"List",
"of",
"Groups",
"of",
"the",
"most",
"frequent",
"distinct",
"population",
"of",
"subset",
"tuples",
"represented",
"by",
"the",
"count",
"of",
"entries",
"of",
"each",
"group",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/FdtSketch.java#L89-L93 |
OpenLiberty/open-liberty | dev/com.ibm.ws.couchdb/src/com/ibm/ws/couchdb/internal/Utils.java | Utils.getMessage | @Trivial
public static final String getMessage(String key, Object... params) {
return Tr.formatMessage(tc, key, params);
} | java | @Trivial
public static final String getMessage(String key, Object... params) {
return Tr.formatMessage(tc, key, params);
} | [
"@",
"Trivial",
"public",
"static",
"final",
"String",
"getMessage",
"(",
"String",
"key",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"key",
",",
"params",
")",
";",
"}"
] | Gets an NLS message.
@param key the message key
@param params the message parameters
@return formatted message | [
"Gets",
"an",
"NLS",
"message",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.couchdb/src/com/ibm/ws/couchdb/internal/Utils.java#L33-L36 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/report/config/ConfigOptionBuilder.java | ConfigOptionBuilder.setCommandLineOptionWithoutArgument | public ConfigOptionBuilder setCommandLineOptionWithoutArgument( CommandLineOption commandLineOption, Object value ) {
co.setCommandLineOption( commandLineOption );
co.setValue( value );
return this;
} | java | public ConfigOptionBuilder setCommandLineOptionWithoutArgument( CommandLineOption commandLineOption, Object value ) {
co.setCommandLineOption( commandLineOption );
co.setValue( value );
return this;
} | [
"public",
"ConfigOptionBuilder",
"setCommandLineOptionWithoutArgument",
"(",
"CommandLineOption",
"commandLineOption",
",",
"Object",
"value",
")",
"{",
"co",
".",
"setCommandLineOption",
"(",
"commandLineOption",
")",
";",
"co",
".",
"setValue",
"(",
"value",
")",
";... | if you don't have an argument, choose the value that is going to be inserted into the map instead
@param commandLineOption specification of the command line options
@param value the value that is going to be inserted into the map instead of the argument | [
"if",
"you",
"don",
"t",
"have",
"an",
"argument",
"choose",
"the",
"value",
"that",
"is",
"going",
"to",
"be",
"inserted",
"into",
"the",
"map",
"instead"
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/report/config/ConfigOptionBuilder.java#L41-L45 |
apereo/cas | support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSaml20ObjectBuilder.java | AbstractSaml20ObjectBuilder.getNameID | public NameID getNameID(final String nameIdFormat, final String nameIdValue) {
val nameId = newSamlObject(NameID.class);
nameId.setFormat(nameIdFormat);
nameId.setValue(nameIdValue);
return nameId;
} | java | public NameID getNameID(final String nameIdFormat, final String nameIdValue) {
val nameId = newSamlObject(NameID.class);
nameId.setFormat(nameIdFormat);
nameId.setValue(nameIdValue);
return nameId;
} | [
"public",
"NameID",
"getNameID",
"(",
"final",
"String",
"nameIdFormat",
",",
"final",
"String",
"nameIdValue",
")",
"{",
"val",
"nameId",
"=",
"newSamlObject",
"(",
"NameID",
".",
"class",
")",
";",
"nameId",
".",
"setFormat",
"(",
"nameIdFormat",
")",
";",... | Gets name id.
@param nameIdFormat the name id format
@param nameIdValue the name id value
@return the name iD | [
"Gets",
"name",
"id",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSaml20ObjectBuilder.java#L95-L100 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.forEachFuture | public static <T> FutureTask<Void> forEachFuture(
Observable<? extends T> source,
Action1<? super T> onNext,
Scheduler scheduler) {
FutureTask<Void> task = OperatorForEachFuture.forEachFuture(source, onNext);
final Worker inner = scheduler.createWorker();
inner.schedule(Functionals.fromRunnable(task, inner));
return task;
} | java | public static <T> FutureTask<Void> forEachFuture(
Observable<? extends T> source,
Action1<? super T> onNext,
Scheduler scheduler) {
FutureTask<Void> task = OperatorForEachFuture.forEachFuture(source, onNext);
final Worker inner = scheduler.createWorker();
inner.schedule(Functionals.fromRunnable(task, inner));
return task;
} | [
"public",
"static",
"<",
"T",
">",
"FutureTask",
"<",
"Void",
">",
"forEachFuture",
"(",
"Observable",
"<",
"?",
"extends",
"T",
">",
"source",
",",
"Action1",
"<",
"?",
"super",
"T",
">",
"onNext",
",",
"Scheduler",
"scheduler",
")",
"{",
"FutureTask",
... | Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion
or error through a Future, scheduled on the given scheduler.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/forEachFuture.s.png" alt="">
@param <T> the source value type
@param source the source Observable
@param onNext the action to call with each emitted element
@param scheduler the Scheduler where the task will await the termination of the for-each
@return the Future representing the entire for-each operation
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-foreachfuture">RxJava Wiki: forEachFuture()</a> | [
"Subscribes",
"to",
"the",
"given",
"source",
"and",
"calls",
"the",
"callback",
"for",
"each",
"emitted",
"item",
"and",
"surfaces",
"the",
"completion",
"or",
"error",
"through",
"a",
"Future",
"scheduled",
"on",
"the",
"given",
"scheduler",
".",
"<p",
">"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1910-L1918 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/resources/HostsResource.java | HostsResource.jobDelete | @DELETE
@Path("/{host}/jobs/{job}")
@Produces(APPLICATION_JSON)
@Timed
@ExceptionMetered
public JobUndeployResponse jobDelete(@PathParam("host") final String host,
@PathParam("job") final JobId jobId,
@QueryParam("token") @DefaultValue("") final String token) {
if (!jobId.isFullyQualified()) {
throw badRequest(new JobUndeployResponse(INVALID_ID, host, jobId));
}
try {
model.undeployJob(host, jobId, token);
return new JobUndeployResponse(OK, host, jobId);
} catch (HostNotFoundException e) {
throw notFound(new JobUndeployResponse(HOST_NOT_FOUND, host, jobId));
} catch (JobNotDeployedException e) {
throw notFound(new JobUndeployResponse(JOB_NOT_FOUND, host, jobId));
} catch (TokenVerificationException e) {
throw forbidden(new JobUndeployResponse(FORBIDDEN, host, jobId));
}
} | java | @DELETE
@Path("/{host}/jobs/{job}")
@Produces(APPLICATION_JSON)
@Timed
@ExceptionMetered
public JobUndeployResponse jobDelete(@PathParam("host") final String host,
@PathParam("job") final JobId jobId,
@QueryParam("token") @DefaultValue("") final String token) {
if (!jobId.isFullyQualified()) {
throw badRequest(new JobUndeployResponse(INVALID_ID, host, jobId));
}
try {
model.undeployJob(host, jobId, token);
return new JobUndeployResponse(OK, host, jobId);
} catch (HostNotFoundException e) {
throw notFound(new JobUndeployResponse(HOST_NOT_FOUND, host, jobId));
} catch (JobNotDeployedException e) {
throw notFound(new JobUndeployResponse(JOB_NOT_FOUND, host, jobId));
} catch (TokenVerificationException e) {
throw forbidden(new JobUndeployResponse(FORBIDDEN, host, jobId));
}
} | [
"@",
"DELETE",
"@",
"Path",
"(",
"\"/{host}/jobs/{job}\"",
")",
"@",
"Produces",
"(",
"APPLICATION_JSON",
")",
"@",
"Timed",
"@",
"ExceptionMetered",
"public",
"JobUndeployResponse",
"jobDelete",
"(",
"@",
"PathParam",
"(",
"\"host\"",
")",
"final",
"String",
"h... | Causes the job identified by its {@link JobId} to be undeployed from the specified host.
This call will fail if the host is not found or the job is not deployed on the host.
@param host The host to undeploy from.
@param jobId The job to undeploy.
@param token The authorization token.
@return The response. | [
"Causes",
"the",
"job",
"identified",
"by",
"its",
"{",
"@link",
"JobId",
"}",
"to",
"be",
"undeployed",
"from",
"the",
"specified",
"host",
".",
"This",
"call",
"will",
"fail",
"if",
"the",
"host",
"is",
"not",
"found",
"or",
"the",
"job",
"is",
"not"... | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/resources/HostsResource.java#L289-L310 |
sebastiangraf/perfidix | src/main/java/org/perfidix/Benchmark.java | Benchmark.getBenchmarkElements | private List<BenchmarkElement> getBenchmarkElements(
final Map<Class<?>, Object> paramObjs)
throws PerfidixMethodCheckException {
final List<BenchmarkElement> elems = new ArrayList<BenchmarkElement>();
final List<BenchmarkMethod> meths = getBenchmarkMethods();
for (final BenchmarkMethod meth : meths) {
final Method dataProv = meth.getDataProvider();
// Test if benchmark is parameterized. If not..
if (dataProv == null) {
// ...simple execute the benchrun on the base of the runs set...
int numberOfRuns = BenchmarkMethod
.getNumberOfAnnotatedRuns(meth.getMethodToBench());
if (numberOfRuns == Bench.NONE_RUN) {
numberOfRuns = conf.getRuns();
}
// ...and adding this number of
// elements to the set to be evaluated.
for (int i = 0; i < numberOfRuns; i++) {
elems.add(new BenchmarkElement(meth));
}
}// If the method is parameterized...
else {
// ..get the parameters
final Object[][] dataProvider = getDataProviderContent(
dataProv, paramObjs.get(meth.getMethodToBench()
.getDeclaringClass()));
for (final Object[] parameterSet : dataProvider) {
elems.add(new BenchmarkElement(meth, parameterSet));
}
// TODO continue over here
}
}
return elems;
} | java | private List<BenchmarkElement> getBenchmarkElements(
final Map<Class<?>, Object> paramObjs)
throws PerfidixMethodCheckException {
final List<BenchmarkElement> elems = new ArrayList<BenchmarkElement>();
final List<BenchmarkMethod> meths = getBenchmarkMethods();
for (final BenchmarkMethod meth : meths) {
final Method dataProv = meth.getDataProvider();
// Test if benchmark is parameterized. If not..
if (dataProv == null) {
// ...simple execute the benchrun on the base of the runs set...
int numberOfRuns = BenchmarkMethod
.getNumberOfAnnotatedRuns(meth.getMethodToBench());
if (numberOfRuns == Bench.NONE_RUN) {
numberOfRuns = conf.getRuns();
}
// ...and adding this number of
// elements to the set to be evaluated.
for (int i = 0; i < numberOfRuns; i++) {
elems.add(new BenchmarkElement(meth));
}
}// If the method is parameterized...
else {
// ..get the parameters
final Object[][] dataProvider = getDataProviderContent(
dataProv, paramObjs.get(meth.getMethodToBench()
.getDeclaringClass()));
for (final Object[] parameterSet : dataProvider) {
elems.add(new BenchmarkElement(meth, parameterSet));
}
// TODO continue over here
}
}
return elems;
} | [
"private",
"List",
"<",
"BenchmarkElement",
">",
"getBenchmarkElements",
"(",
"final",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"Object",
">",
"paramObjs",
")",
"throws",
"PerfidixMethodCheckException",
"{",
"final",
"List",
"<",
"BenchmarkElement",
">",
"elems"... | Getting all benchmarkable objects out of the registered classes with the
annotated number of runs.
@param paramObjs
a set with all existing objects for getting data from the
dataproviders
@return a Set with {@link BenchmarkMethod}
@throws PerfidixMethodCheckException | [
"Getting",
"all",
"benchmarkable",
"objects",
"out",
"of",
"the",
"registered",
"classes",
"with",
"the",
"annotated",
"number",
"of",
"runs",
"."
] | train | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/Benchmark.java#L431-L470 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.addDelegateInstanceMethod | public static MethodNode addDelegateInstanceMethod(ClassNode classNode, Expression delegate, MethodNode declaredMethod, AnnotationNode markerAnnotation, boolean thisAsFirstArgument, Map<String, ClassNode> genericsPlaceholders, boolean noNullCheck) {
Parameter[] parameterTypes = thisAsFirstArgument ? getRemainingParameterTypes(declaredMethod.getParameters()) : declaredMethod.getParameters();
String methodName = declaredMethod.getName();
if (classNode.hasDeclaredMethod(methodName, copyParameters(parameterTypes, genericsPlaceholders))) {
return null;
}
ClassNode returnType = declaredMethod.getReturnType();
String propertyName = !returnType.isPrimaryClassNode() ? GrailsNameUtils.getPropertyForGetter(methodName, returnType.getTypeClass()) : GrailsNameUtils.getPropertyForGetter(methodName);
if (propertyName != null && parameterTypes.length == 0 && classNode.hasProperty(propertyName)) {
return null;
}
propertyName = GrailsNameUtils.getPropertyForSetter(methodName);
if (propertyName != null && parameterTypes.length == 1 && classNode.hasProperty(propertyName)) {
return null;
}
BlockStatement methodBody = new BlockStatement();
ArgumentListExpression arguments = createArgumentListFromParameters(parameterTypes, thisAsFirstArgument, genericsPlaceholders);
returnType = replaceGenericsPlaceholders(returnType, genericsPlaceholders);
MethodCallExpression methodCallExpression = new MethodCallExpression(delegate, methodName, arguments);
methodCallExpression.setMethodTarget(declaredMethod);
if(!noNullCheck) {
ThrowStatement missingMethodException = createMissingMethodThrowable(classNode, declaredMethod);
VariableExpression apiVar = addApiVariableDeclaration(delegate, declaredMethod, methodBody);
IfStatement ifStatement = createIfElseStatementForApiMethodCall(methodCallExpression, apiVar, missingMethodException);
methodBody.addStatement(ifStatement);
} else {
methodBody.addStatement(new ExpressionStatement(methodCallExpression));
}
MethodNode methodNode = new MethodNode(methodName,
Modifier.PUBLIC, returnType, copyParameters(parameterTypes, genericsPlaceholders),
GrailsArtefactClassInjector.EMPTY_CLASS_ARRAY, methodBody);
copyAnnotations(declaredMethod, methodNode);
if(shouldAddMarkerAnnotation(markerAnnotation, methodNode)) {
methodNode.addAnnotation(markerAnnotation);
}
classNode.addMethod(methodNode);
return methodNode;
} | java | public static MethodNode addDelegateInstanceMethod(ClassNode classNode, Expression delegate, MethodNode declaredMethod, AnnotationNode markerAnnotation, boolean thisAsFirstArgument, Map<String, ClassNode> genericsPlaceholders, boolean noNullCheck) {
Parameter[] parameterTypes = thisAsFirstArgument ? getRemainingParameterTypes(declaredMethod.getParameters()) : declaredMethod.getParameters();
String methodName = declaredMethod.getName();
if (classNode.hasDeclaredMethod(methodName, copyParameters(parameterTypes, genericsPlaceholders))) {
return null;
}
ClassNode returnType = declaredMethod.getReturnType();
String propertyName = !returnType.isPrimaryClassNode() ? GrailsNameUtils.getPropertyForGetter(methodName, returnType.getTypeClass()) : GrailsNameUtils.getPropertyForGetter(methodName);
if (propertyName != null && parameterTypes.length == 0 && classNode.hasProperty(propertyName)) {
return null;
}
propertyName = GrailsNameUtils.getPropertyForSetter(methodName);
if (propertyName != null && parameterTypes.length == 1 && classNode.hasProperty(propertyName)) {
return null;
}
BlockStatement methodBody = new BlockStatement();
ArgumentListExpression arguments = createArgumentListFromParameters(parameterTypes, thisAsFirstArgument, genericsPlaceholders);
returnType = replaceGenericsPlaceholders(returnType, genericsPlaceholders);
MethodCallExpression methodCallExpression = new MethodCallExpression(delegate, methodName, arguments);
methodCallExpression.setMethodTarget(declaredMethod);
if(!noNullCheck) {
ThrowStatement missingMethodException = createMissingMethodThrowable(classNode, declaredMethod);
VariableExpression apiVar = addApiVariableDeclaration(delegate, declaredMethod, methodBody);
IfStatement ifStatement = createIfElseStatementForApiMethodCall(methodCallExpression, apiVar, missingMethodException);
methodBody.addStatement(ifStatement);
} else {
methodBody.addStatement(new ExpressionStatement(methodCallExpression));
}
MethodNode methodNode = new MethodNode(methodName,
Modifier.PUBLIC, returnType, copyParameters(parameterTypes, genericsPlaceholders),
GrailsArtefactClassInjector.EMPTY_CLASS_ARRAY, methodBody);
copyAnnotations(declaredMethod, methodNode);
if(shouldAddMarkerAnnotation(markerAnnotation, methodNode)) {
methodNode.addAnnotation(markerAnnotation);
}
classNode.addMethod(methodNode);
return methodNode;
} | [
"public",
"static",
"MethodNode",
"addDelegateInstanceMethod",
"(",
"ClassNode",
"classNode",
",",
"Expression",
"delegate",
",",
"MethodNode",
"declaredMethod",
",",
"AnnotationNode",
"markerAnnotation",
",",
"boolean",
"thisAsFirstArgument",
",",
"Map",
"<",
"String",
... | Adds a delegate method to the target class node where the first argument
is to the delegate method is 'this'. In other words a method such as
foo(Object instance, String bar) would be added with a signature of foo(String)
and 'this' is passed to the delegate instance
@param classNode The class node
@param delegate The expression that looks up the delegate
@param declaredMethod The declared method
@param thisAsFirstArgument Whether 'this' should be passed as the first argument to the method
@return The added method node or null if it couldn't be added | [
"Adds",
"a",
"delegate",
"method",
"to",
"the",
"target",
"class",
"node",
"where",
"the",
"first",
"argument",
"is",
"to",
"the",
"delegate",
"method",
"is",
"this",
".",
"In",
"other",
"words",
"a",
"method",
"such",
"as",
"foo",
"(",
"Object",
"instan... | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L252-L295 |
rzwitserloot/lombok | src/core/lombok/eclipse/EclipseNode.java | EclipseNode.addWarning | public void addWarning(String message, int sourceStart, int sourceEnd) {
ast.addProblem(ast.new ParseProblem(true, message, sourceStart, sourceEnd));
} | java | public void addWarning(String message, int sourceStart, int sourceEnd) {
ast.addProblem(ast.new ParseProblem(true, message, sourceStart, sourceEnd));
} | [
"public",
"void",
"addWarning",
"(",
"String",
"message",
",",
"int",
"sourceStart",
",",
"int",
"sourceEnd",
")",
"{",
"ast",
".",
"addProblem",
"(",
"ast",
".",
"new",
"ParseProblem",
"(",
"true",
",",
"message",
",",
"sourceStart",
",",
"sourceEnd",
")"... | Generate a compiler warning that shows the wavy underline from-to the stated character positions. | [
"Generate",
"a",
"compiler",
"warning",
"that",
"shows",
"the",
"wavy",
"underline",
"from",
"-",
"to",
"the",
"stated",
"character",
"positions",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/EclipseNode.java#L183-L185 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ReflectionUtils.java | ReflectionUtils.hasSuperClass | public static boolean hasSuperClass(Class<?> clazz, Class<?> superClazz) {
if (clazz == null || superClazz == null || clazz == superClazz) {
return false;
}
if (clazz.isInterface()) {
return superClazz.isAssignableFrom(clazz);
}
Class<?> parent = clazz.getSuperclass();
while (parent != null) {
if (parent == superClazz) {
return true;
}
parent = parent.getSuperclass();
}
return false;
} | java | public static boolean hasSuperClass(Class<?> clazz, Class<?> superClazz) {
if (clazz == null || superClazz == null || clazz == superClazz) {
return false;
}
if (clazz.isInterface()) {
return superClazz.isAssignableFrom(clazz);
}
Class<?> parent = clazz.getSuperclass();
while (parent != null) {
if (parent == superClazz) {
return true;
}
parent = parent.getSuperclass();
}
return false;
} | [
"public",
"static",
"boolean",
"hasSuperClass",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"superClazz",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
"||",
"superClazz",
"==",
"null",
"||",
"clazz",
"==",
"superClazz",
")",
"{",
... | Tells if a class is a sub-class of a super-class.
Note:
<ul>
<li>Sub-class against super-class: this method returns {@code true}.</li>
<li>Sub-interface against super-interface: this method returns
{@code true}.</li>
<li>Class against interface: this method returns {@code false}.</li>
</ul>
@param clazz
class to check
@param superClazz
the super-class to check
@return {@code true} if {@code superClazz} is indeed the super-class of
{@code clazz} | [
"Tells",
"if",
"a",
"class",
"is",
"a",
"sub",
"-",
"class",
"of",
"a",
"super",
"-",
"class",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ReflectionUtils.java#L111-L128 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java | GenericEncodingStrategy.getLobFromLocator | private void getLobFromLocator(CodeAssembler a, StorablePropertyInfo info) {
if (!info.isLob()) {
throw new IllegalArgumentException();
}
TypeDesc type = info.getStorageType();
String name;
if (Blob.class.isAssignableFrom(type.toClass())) {
name = "getBlob";
} else if (Clob.class.isAssignableFrom(type.toClass())) {
name = "getClob";
} else {
throw new IllegalArgumentException();
}
a.invokeInterface(TypeDesc.forClass(RawSupport.class), name,
type, new TypeDesc[] {TypeDesc.forClass(Storable.class),
TypeDesc.STRING, TypeDesc.LONG});
} | java | private void getLobFromLocator(CodeAssembler a, StorablePropertyInfo info) {
if (!info.isLob()) {
throw new IllegalArgumentException();
}
TypeDesc type = info.getStorageType();
String name;
if (Blob.class.isAssignableFrom(type.toClass())) {
name = "getBlob";
} else if (Clob.class.isAssignableFrom(type.toClass())) {
name = "getClob";
} else {
throw new IllegalArgumentException();
}
a.invokeInterface(TypeDesc.forClass(RawSupport.class), name,
type, new TypeDesc[] {TypeDesc.forClass(Storable.class),
TypeDesc.STRING, TypeDesc.LONG});
} | [
"private",
"void",
"getLobFromLocator",
"(",
"CodeAssembler",
"a",
",",
"StorablePropertyInfo",
"info",
")",
"{",
"if",
"(",
"!",
"info",
".",
"isLob",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"TypeDesc",
"type",
... | Generates code to get a Lob from a locator from RawSupport. RawSupport
instance, Storable instance, property name and long locator must be on
the stack. Result is a Lob on the stack, which may be null. | [
"Generates",
"code",
"to",
"get",
"a",
"Lob",
"from",
"a",
"locator",
"from",
"RawSupport",
".",
"RawSupport",
"instance",
"Storable",
"instance",
"property",
"name",
"and",
"long",
"locator",
"must",
"be",
"on",
"the",
"stack",
".",
"Result",
"is",
"a",
"... | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java#L1808-L1826 |
kaazing/java.client | ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java | WrappedByteBuffer.expandAt | WrappedByteBuffer expandAt(int i, int expectedRemaining) {
if ((i + expectedRemaining) <= _buf.limit()) {
return this;
} else {
if ((i + expectedRemaining) <= _buf.capacity()) {
_buf.limit(i + expectedRemaining);
} else {
// reallocate the underlying byte buffer and keep the original buffer
// intact. The resetting of the position is required because, one
// could be in the middle of a read of an existing buffer, when they
// decide to over write only few bytes but still keep the remaining
// part of the buffer unchanged.
int newCapacity = _buf.capacity()
+ ((expectedRemaining > INITIAL_CAPACITY) ? expectedRemaining : INITIAL_CAPACITY);
java.nio.ByteBuffer newBuffer = java.nio.ByteBuffer.allocate(newCapacity);
_buf.flip();
newBuffer.put(_buf);
_buf = newBuffer;
}
}
return this;
} | java | WrappedByteBuffer expandAt(int i, int expectedRemaining) {
if ((i + expectedRemaining) <= _buf.limit()) {
return this;
} else {
if ((i + expectedRemaining) <= _buf.capacity()) {
_buf.limit(i + expectedRemaining);
} else {
// reallocate the underlying byte buffer and keep the original buffer
// intact. The resetting of the position is required because, one
// could be in the middle of a read of an existing buffer, when they
// decide to over write only few bytes but still keep the remaining
// part of the buffer unchanged.
int newCapacity = _buf.capacity()
+ ((expectedRemaining > INITIAL_CAPACITY) ? expectedRemaining : INITIAL_CAPACITY);
java.nio.ByteBuffer newBuffer = java.nio.ByteBuffer.allocate(newCapacity);
_buf.flip();
newBuffer.put(_buf);
_buf = newBuffer;
}
}
return this;
} | [
"WrappedByteBuffer",
"expandAt",
"(",
"int",
"i",
",",
"int",
"expectedRemaining",
")",
"{",
"if",
"(",
"(",
"i",
"+",
"expectedRemaining",
")",
"<=",
"_buf",
".",
"limit",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"else",
"{",
"if",
"(",
"(",
... | Expands the buffer to support the expected number of remaining bytes at the specified index.
@param index the index
@param expectedRemaining the expected number of remaining bytes
@return the buffer | [
"Expands",
"the",
"buffer",
"to",
"support",
"the",
"expected",
"number",
"of",
"remaining",
"bytes",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L1185-L1207 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/asm/SimpleClassWriter.java | SimpleClassWriter.getCommonSuperClass | @Override
protected String getCommonSuperClass(final String type1, final String type2) {
Validate.notNull(type1);
Validate.notNull(type2);
infoRepo.getInformation(type1);
LinkedHashSet<String> type1Hierarchy = flattenHierarchy(type1);
LinkedHashSet<String> type2Hierarchy = flattenHierarchy(type2);
for (String testType1 : type1Hierarchy) {
for (String testType2 : type2Hierarchy) {
if (testType1.equals(testType2)) {
return testType1;
}
}
}
return "java/lang/Object"; // is this correct behaviour? shouldn't both type1 and type2 ultimately contain Object?
} | java | @Override
protected String getCommonSuperClass(final String type1, final String type2) {
Validate.notNull(type1);
Validate.notNull(type2);
infoRepo.getInformation(type1);
LinkedHashSet<String> type1Hierarchy = flattenHierarchy(type1);
LinkedHashSet<String> type2Hierarchy = flattenHierarchy(type2);
for (String testType1 : type1Hierarchy) {
for (String testType2 : type2Hierarchy) {
if (testType1.equals(testType2)) {
return testType1;
}
}
}
return "java/lang/Object"; // is this correct behaviour? shouldn't both type1 and type2 ultimately contain Object?
} | [
"@",
"Override",
"protected",
"String",
"getCommonSuperClass",
"(",
"final",
"String",
"type1",
",",
"final",
"String",
"type2",
")",
"{",
"Validate",
".",
"notNull",
"(",
"type1",
")",
";",
"Validate",
".",
"notNull",
"(",
"type2",
")",
";",
"infoRepo",
"... | Derives common super class from the super name mapping passed in to the constructor.
@param type1 the internal name of a class.
@param type2 the internal name of another class.
@return the internal name of the common super class of the two given classes
@throws NullPointerException if any argument is {@code null} | [
"Derives",
"common",
"super",
"class",
"from",
"the",
"super",
"name",
"mapping",
"passed",
"in",
"to",
"the",
"constructor",
"."
] | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/asm/SimpleClassWriter.java#L69-L87 |
tango-controls/JTango | server/src/main/java/org/tango/server/properties/AttributePropertiesManager.java | AttributePropertiesManager.getAttributePropertyFromDB | public String getAttributePropertyFromDB(final String attributeName, final String propertyName) throws DevFailed {
xlogger.entry(propertyName);
String[] result = new String[] {};
final Map<String, String[]> prop = DatabaseFactory.getDatabase().getAttributeProperties(deviceName,
attributeName);
if (prop.get(propertyName) != null) {
// get value
result = prop.get(propertyName);
logger.debug(attributeName + " property {} is {}", propertyName, Arrays.toString(result));
}
xlogger.exit();
String single = "";
if (result.length == 1 && !result[0].isEmpty()) {
single = result[0];
}
return single;
} | java | public String getAttributePropertyFromDB(final String attributeName, final String propertyName) throws DevFailed {
xlogger.entry(propertyName);
String[] result = new String[] {};
final Map<String, String[]> prop = DatabaseFactory.getDatabase().getAttributeProperties(deviceName,
attributeName);
if (prop.get(propertyName) != null) {
// get value
result = prop.get(propertyName);
logger.debug(attributeName + " property {} is {}", propertyName, Arrays.toString(result));
}
xlogger.exit();
String single = "";
if (result.length == 1 && !result[0].isEmpty()) {
single = result[0];
}
return single;
} | [
"public",
"String",
"getAttributePropertyFromDB",
"(",
"final",
"String",
"attributeName",
",",
"final",
"String",
"propertyName",
")",
"throws",
"DevFailed",
"{",
"xlogger",
".",
"entry",
"(",
"propertyName",
")",
";",
"String",
"[",
"]",
"result",
"=",
"new",
... | Get an attribute property from tango db
@param attributeName
@param propertyName
@return The property
@throws DevFailed | [
"Get",
"an",
"attribute",
"property",
"from",
"tango",
"db"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/properties/AttributePropertiesManager.java#L108-L124 |
vincentk/joptimizer | src/main/java/com/joptimizer/util/Utils.java | Utils.calculateScaledResidual | public static double calculateScaledResidual(double[][] A, double[][] X, double[][] B){
DoubleMatrix2D AMatrix = DoubleFactory2D.dense.make(A);
DoubleMatrix2D XMatrix = DoubleFactory2D.dense.make(X);
DoubleMatrix2D BMatrix = DoubleFactory2D.dense.make(B);
return calculateScaledResidual(AMatrix, XMatrix, BMatrix);
} | java | public static double calculateScaledResidual(double[][] A, double[][] X, double[][] B){
DoubleMatrix2D AMatrix = DoubleFactory2D.dense.make(A);
DoubleMatrix2D XMatrix = DoubleFactory2D.dense.make(X);
DoubleMatrix2D BMatrix = DoubleFactory2D.dense.make(B);
return calculateScaledResidual(AMatrix, XMatrix, BMatrix);
} | [
"public",
"static",
"double",
"calculateScaledResidual",
"(",
"double",
"[",
"]",
"[",
"]",
"A",
",",
"double",
"[",
"]",
"[",
"]",
"X",
",",
"double",
"[",
"]",
"[",
"]",
"B",
")",
"{",
"DoubleMatrix2D",
"AMatrix",
"=",
"DoubleFactory2D",
".",
"dense"... | Calculate the scaled residual
<br> ||Ax-b||_oo/( ||A||_oo . ||x||_oo + ||b||_oo ), with
<br> ||x||_oo = max(||x[i]||) | [
"Calculate",
"the",
"scaled",
"residual",
"<br",
">",
"||Ax",
"-",
"b||_oo",
"/",
"(",
"||A||_oo",
".",
"||x||_oo",
"+",
"||b||_oo",
")",
"with",
"<br",
">",
"||x||_oo",
"=",
"max",
"(",
"||x",
"[",
"i",
"]",
"||",
")"
] | train | https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/util/Utils.java#L134-L139 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java | Collections.copy | public static <T> void copy(List<? super T> dest, List<? extends T> src) {
int srcSize = src.size();
if (srcSize > dest.size())
throw new IndexOutOfBoundsException("Source does not fit in dest");
if (srcSize < COPY_THRESHOLD ||
(src instanceof RandomAccess && dest instanceof RandomAccess)) {
for (int i=0; i<srcSize; i++)
dest.set(i, src.get(i));
} else {
ListIterator<? super T> di=dest.listIterator();
ListIterator<? extends T> si=src.listIterator();
for (int i=0; i<srcSize; i++) {
di.next();
di.set(si.next());
}
}
} | java | public static <T> void copy(List<? super T> dest, List<? extends T> src) {
int srcSize = src.size();
if (srcSize > dest.size())
throw new IndexOutOfBoundsException("Source does not fit in dest");
if (srcSize < COPY_THRESHOLD ||
(src instanceof RandomAccess && dest instanceof RandomAccess)) {
for (int i=0; i<srcSize; i++)
dest.set(i, src.get(i));
} else {
ListIterator<? super T> di=dest.listIterator();
ListIterator<? extends T> si=src.listIterator();
for (int i=0; i<srcSize; i++) {
di.next();
di.set(si.next());
}
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"copy",
"(",
"List",
"<",
"?",
"super",
"T",
">",
"dest",
",",
"List",
"<",
"?",
"extends",
"T",
">",
"src",
")",
"{",
"int",
"srcSize",
"=",
"src",
".",
"size",
"(",
")",
";",
"if",
"(",
"srcSize",
... | Copies all of the elements from one list into another. After the
operation, the index of each copied element in the destination list
will be identical to its index in the source list. The destination
list must be at least as long as the source list. If it is longer, the
remaining elements in the destination list are unaffected. <p>
This method runs in linear time.
@param <T> the class of the objects in the lists
@param dest The destination list.
@param src The source list.
@throws IndexOutOfBoundsException if the destination list is too small
to contain the entire source List.
@throws UnsupportedOperationException if the destination list's
list-iterator does not support the <tt>set</tt> operation. | [
"Copies",
"all",
"of",
"the",
"elements",
"from",
"one",
"list",
"into",
"another",
".",
"After",
"the",
"operation",
"the",
"index",
"of",
"each",
"copied",
"element",
"in",
"the",
"destination",
"list",
"will",
"be",
"identical",
"to",
"its",
"index",
"i... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Collections.java#L585-L602 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java | BaseXmlImporter.reloadChangesInfoAfterUC | protected void reloadChangesInfoAfterUC(ImportNodeData currentNodeInfo, String identifier)
throws PathNotFoundException, IllegalPathException, RepositoryException
{
reloadChangesInfoAfterUC(getParent(), currentNodeInfo, identifier);
} | java | protected void reloadChangesInfoAfterUC(ImportNodeData currentNodeInfo, String identifier)
throws PathNotFoundException, IllegalPathException, RepositoryException
{
reloadChangesInfoAfterUC(getParent(), currentNodeInfo, identifier);
} | [
"protected",
"void",
"reloadChangesInfoAfterUC",
"(",
"ImportNodeData",
"currentNodeInfo",
",",
"String",
"identifier",
")",
"throws",
"PathNotFoundException",
",",
"IllegalPathException",
",",
"RepositoryException",
"{",
"reloadChangesInfoAfterUC",
"(",
"getParent",
"(",
"... | Reload path information after uuid collision
@param currentNodeInfo
@param identifier
@throws PathNotFoundException
@throws IllegalPathException
@throws RepositoryException | [
"Reload",
"path",
"information",
"after",
"uuid",
"collision"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java#L443-L447 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/othersys/LinkExamples.java | LinkExamples.addLink | private void addLink(final WSubMenu subMenu, final WLink link) {
subMenu.add(new WMenuItem(new WDecoratedLabel(link)));
} | java | private void addLink(final WSubMenu subMenu, final WLink link) {
subMenu.add(new WMenuItem(new WDecoratedLabel(link)));
} | [
"private",
"void",
"addLink",
"(",
"final",
"WSubMenu",
"subMenu",
",",
"final",
"WLink",
"link",
")",
"{",
"subMenu",
".",
"add",
"(",
"new",
"WMenuItem",
"(",
"new",
"WDecoratedLabel",
"(",
"link",
")",
")",
")",
";",
"}"
] | Adds a WLink to a sub-menu.
@param subMenu the sub-menu to add the link to
@param link the link to add. | [
"Adds",
"a",
"WLink",
"to",
"a",
"sub",
"-",
"menu",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/othersys/LinkExamples.java#L62-L64 |
wigforss/Ka-Commons-Reflection | src/main/java/org/kasource/commons/util/StringUtils.java | StringUtils.replaceVariables | public static String replaceVariables(String input, Map<String, Object> variables, boolean systemOverrideMode) {
Matcher matcher = VARIABLE_PATTERN.matcher(input);
String result = input;
while(matcher.find()) {
String variableName = matcher.group();
variableName = variableName.substring(2, variableName.length()-1);
Object variable = resolveVariable(variableName, variables, systemOverrideMode);
if(variable != null) {
result = result.replaceFirst(VARIABLE_PATTERN.pattern(), variable.toString().replace("\\", "\\\\"));
}
}
return result;
} | java | public static String replaceVariables(String input, Map<String, Object> variables, boolean systemOverrideMode) {
Matcher matcher = VARIABLE_PATTERN.matcher(input);
String result = input;
while(matcher.find()) {
String variableName = matcher.group();
variableName = variableName.substring(2, variableName.length()-1);
Object variable = resolveVariable(variableName, variables, systemOverrideMode);
if(variable != null) {
result = result.replaceFirst(VARIABLE_PATTERN.pattern(), variable.toString().replace("\\", "\\\\"));
}
}
return result;
} | [
"public",
"static",
"String",
"replaceVariables",
"(",
"String",
"input",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"variables",
",",
"boolean",
"systemOverrideMode",
")",
"{",
"Matcher",
"matcher",
"=",
"VARIABLE_PATTERN",
".",
"matcher",
"(",
"input",
"... | Returns a string where maven-style variables ${variableName} are replaced with variables from
the variable map, system variable or environment variables.
<p>
Will resolve variable values differently depending on the systemOverrideMode flag, where true = override and false = fall back.
See the list below in which order variable values are resolved.
<p>
<b>systemOverrideMode = true</b>
<p>
1. Find variable value in system properties<br>
2. Find variable value in environment variables<br>
3. Find variable value in the variables map<br>
<p>
<b>systemOverrideMode = true</b>
<p>
1. Find variable value in the variables map<br>
2. Find variable value in system properties<br>
3. Find variable value in environment variables<br>
@param input The text to perform variable substitution upon
@param variables Map of variable values
@param systemOverrideMode true system variables will override what's in the variables map
@return the input with the variables found replaced with it's values. | [
"Returns",
"a",
"string",
"where",
"maven",
"-",
"style",
"variables",
"$",
"{",
"variableName",
"}",
"are",
"replaced",
"with",
"variables",
"from",
"the",
"variable",
"map",
"system",
"variable",
"or",
"environment",
"variables",
".",
"<p",
">",
"Will",
"r... | train | https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/util/StringUtils.java#L45-L57 |
pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.locatePage | private CompletableFuture<PageWrapper> locatePage(Function<BTreePage, PagePointer> getChildPointer, Predicate<PageWrapper> found,
PageCollection pageCollection, TimeoutTimer timer) {
AtomicReference<PagePointer> pagePointer = new AtomicReference<>(new PagePointer(null, this.state.get().rootPageOffset, this.state.get().rootPageLength));
CompletableFuture<PageWrapper> result = new CompletableFuture<>();
AtomicReference<PageWrapper> parentPage = new AtomicReference<>(null);
Futures.loop(
() -> !result.isDone(),
() -> fetchPage(pagePointer.get(), parentPage.get(), pageCollection, timer.getRemaining())
.thenAccept(page -> {
if (found.test(page)) {
// We are done.
result.complete(page);
} else {
PagePointer childPointer = getChildPointer.apply(page.getPage());
pagePointer.set(childPointer);
parentPage.set(page);
}
}),
this.executor)
.exceptionally(ex -> {
result.completeExceptionally(ex);
return null;
});
return result;
} | java | private CompletableFuture<PageWrapper> locatePage(Function<BTreePage, PagePointer> getChildPointer, Predicate<PageWrapper> found,
PageCollection pageCollection, TimeoutTimer timer) {
AtomicReference<PagePointer> pagePointer = new AtomicReference<>(new PagePointer(null, this.state.get().rootPageOffset, this.state.get().rootPageLength));
CompletableFuture<PageWrapper> result = new CompletableFuture<>();
AtomicReference<PageWrapper> parentPage = new AtomicReference<>(null);
Futures.loop(
() -> !result.isDone(),
() -> fetchPage(pagePointer.get(), parentPage.get(), pageCollection, timer.getRemaining())
.thenAccept(page -> {
if (found.test(page)) {
// We are done.
result.complete(page);
} else {
PagePointer childPointer = getChildPointer.apply(page.getPage());
pagePointer.set(childPointer);
parentPage.set(page);
}
}),
this.executor)
.exceptionally(ex -> {
result.completeExceptionally(ex);
return null;
});
return result;
} | [
"private",
"CompletableFuture",
"<",
"PageWrapper",
">",
"locatePage",
"(",
"Function",
"<",
"BTreePage",
",",
"PagePointer",
">",
"getChildPointer",
",",
"Predicate",
"<",
"PageWrapper",
">",
"found",
",",
"PageCollection",
"pageCollection",
",",
"TimeoutTimer",
"t... | Locates the BTreePage according to the given criteria.
@param getChildPointer A Function that, when applied to a BTreePage, will return a PagePointer which can be used
to load up the next page.
@param found A Predicate that, when applied to a PageWrapper, will indicate if this is the sought page.
@param pageCollection A PageCollection to query for already loaded pages, as well as to store newly loaded ones.
@param timer Timer for the operation.
@return A CompletableFuture with a PageWrapper for the sought page. | [
"Locates",
"the",
"BTreePage",
"according",
"to",
"the",
"given",
"criteria",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L614-L639 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java | JAXBAnnotationsHelper.setName | private static boolean setName(String ns, String name, Schema property) {
boolean apply = false;
final String cleanName = StringUtils.trimToNull(name);
final String useName;
if (!isEmpty(cleanName) && !cleanName.equals(((SchemaImpl) property).getName())) {
useName = cleanName;
apply = true;
} else {
useName = null;
}
final String cleanNS = StringUtils.trimToNull(ns);
final String useNS;
if (!isEmpty(cleanNS)) {
useNS = cleanNS;
apply = true;
} else {
useNS = null;
}
// Set everything or nothing
if (apply) {
getXml(property).name(useName).namespace(useNS);
}
return apply;
} | java | private static boolean setName(String ns, String name, Schema property) {
boolean apply = false;
final String cleanName = StringUtils.trimToNull(name);
final String useName;
if (!isEmpty(cleanName) && !cleanName.equals(((SchemaImpl) property).getName())) {
useName = cleanName;
apply = true;
} else {
useName = null;
}
final String cleanNS = StringUtils.trimToNull(ns);
final String useNS;
if (!isEmpty(cleanNS)) {
useNS = cleanNS;
apply = true;
} else {
useNS = null;
}
// Set everything or nothing
if (apply) {
getXml(property).name(useName).namespace(useNS);
}
return apply;
} | [
"private",
"static",
"boolean",
"setName",
"(",
"String",
"ns",
",",
"String",
"name",
",",
"Schema",
"property",
")",
"{",
"boolean",
"apply",
"=",
"false",
";",
"final",
"String",
"cleanName",
"=",
"StringUtils",
".",
"trimToNull",
"(",
"name",
")",
";",... | Puts name space and name for XML node or attribute.
@param ns name space
@param name name
@param property property instance to be updated
@return <code>true</code> if name space and name have been set | [
"Puts",
"name",
"space",
"and",
"name",
"for",
"XML",
"node",
"or",
"attribute",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/jackson/JAXBAnnotationsHelper.java#L105-L128 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java | AjaxHelper.setCurrentOperationDetails | public static void setCurrentOperationDetails(final AjaxOperation operation, final ComponentWithContext trigger) {
if (operation == null) {
THREAD_LOCAL_OPERATION.remove();
} else {
THREAD_LOCAL_OPERATION.set(operation);
}
if (trigger == null) {
THREAD_LOCAL_COMPONENT_WITH_CONTEXT.remove();
} else {
THREAD_LOCAL_COMPONENT_WITH_CONTEXT.set(trigger);
}
} | java | public static void setCurrentOperationDetails(final AjaxOperation operation, final ComponentWithContext trigger) {
if (operation == null) {
THREAD_LOCAL_OPERATION.remove();
} else {
THREAD_LOCAL_OPERATION.set(operation);
}
if (trigger == null) {
THREAD_LOCAL_COMPONENT_WITH_CONTEXT.remove();
} else {
THREAD_LOCAL_COMPONENT_WITH_CONTEXT.set(trigger);
}
} | [
"public",
"static",
"void",
"setCurrentOperationDetails",
"(",
"final",
"AjaxOperation",
"operation",
",",
"final",
"ComponentWithContext",
"trigger",
")",
"{",
"if",
"(",
"operation",
"==",
"null",
")",
"{",
"THREAD_LOCAL_OPERATION",
".",
"remove",
"(",
")",
";",... | Sets the current AJAX operation details.
@param operation the current AJAX operation.
@param trigger the current AJAX operation trigger and its context. | [
"Sets",
"the",
"current",
"AJAX",
"operation",
"details",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java#L57-L69 |
abel533/Mapper | core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java | SqlHelper.logicDeleteColumnEqualsValue | public static String logicDeleteColumnEqualsValue(Class<?> entityClass, boolean isDeleted) {
EntityColumn logicDeleteColumn = SqlHelper.getLogicDeleteColumn(entityClass);
if (logicDeleteColumn != null) {
return logicDeleteColumnEqualsValue(logicDeleteColumn, isDeleted);
}
return "";
} | java | public static String logicDeleteColumnEqualsValue(Class<?> entityClass, boolean isDeleted) {
EntityColumn logicDeleteColumn = SqlHelper.getLogicDeleteColumn(entityClass);
if (logicDeleteColumn != null) {
return logicDeleteColumnEqualsValue(logicDeleteColumn, isDeleted);
}
return "";
} | [
"public",
"static",
"String",
"logicDeleteColumnEqualsValue",
"(",
"Class",
"<",
"?",
">",
"entityClass",
",",
"boolean",
"isDeleted",
")",
"{",
"EntityColumn",
"logicDeleteColumn",
"=",
"SqlHelper",
".",
"getLogicDeleteColumn",
"(",
"entityClass",
")",
";",
"if",
... | 返回格式: column = value
<br>
默认isDeletedValue = 1 notDeletedValue = 0
<br>
则返回is_deleted = 1 或 is_deleted = 0
<br>
若没有逻辑删除注解,则返回空字符串
@param entityClass
@param isDeleted true 已经逻辑删除 false 未逻辑删除 | [
"返回格式",
":",
"column",
"=",
"value",
"<br",
">",
"默认isDeletedValue",
"=",
"1",
"notDeletedValue",
"=",
"0",
"<br",
">",
"则返回is_deleted",
"=",
"1",
"或",
"is_deleted",
"=",
"0",
"<br",
">",
"若没有逻辑删除注解,则返回空字符串"
] | train | https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java#L740-L748 |
brianwhu/xillium | data/src/main/java/org/xillium/data/persistence/ObjectMappedQuery.java | ObjectMappedQuery.getObject | public T getObject(Connection conn, DataObject object) throws Exception {
return executeSelect(conn, object, new ResultSetMapper<SingleObjectCollector<T>>(new SingleObjectCollector<T>())).value;
} | java | public T getObject(Connection conn, DataObject object) throws Exception {
return executeSelect(conn, object, new ResultSetMapper<SingleObjectCollector<T>>(new SingleObjectCollector<T>())).value;
} | [
"public",
"T",
"getObject",
"(",
"Connection",
"conn",
",",
"DataObject",
"object",
")",
"throws",
"Exception",
"{",
"return",
"executeSelect",
"(",
"conn",
",",
"object",
",",
"new",
"ResultSetMapper",
"<",
"SingleObjectCollector",
"<",
"T",
">",
">",
"(",
... | Executes the query and returns the first row of the results as a single object. | [
"Executes",
"the",
"query",
"and",
"returns",
"the",
"first",
"row",
"of",
"the",
"results",
"as",
"a",
"single",
"object",
"."
] | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/persistence/ObjectMappedQuery.java#L135-L137 |
openengsb/openengsb | components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EDBModelObject.java | EDBModelObject.getModelDescription | public ModelDescription getModelDescription() {
String modelType = object.getString(EDBConstants.MODEL_TYPE);
String version = object.getString(EDBConstants.MODEL_TYPE_VERSION);
return new ModelDescription(modelType, version);
} | java | public ModelDescription getModelDescription() {
String modelType = object.getString(EDBConstants.MODEL_TYPE);
String version = object.getString(EDBConstants.MODEL_TYPE_VERSION);
return new ModelDescription(modelType, version);
} | [
"public",
"ModelDescription",
"getModelDescription",
"(",
")",
"{",
"String",
"modelType",
"=",
"object",
".",
"getString",
"(",
"EDBConstants",
".",
"MODEL_TYPE",
")",
";",
"String",
"version",
"=",
"object",
".",
"getString",
"(",
"EDBConstants",
".",
"MODEL_T... | Returns the model description for the model class of the EDBModelObject | [
"Returns",
"the",
"model",
"description",
"for",
"the",
"model",
"class",
"of",
"the",
"EDBModelObject"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EDBModelObject.java#L46-L50 |
rundeck/rundeck | core/src/main/java/com/dtolabs/utils/Mapper.java | Mapper.zip | public static Map zip(List keys, List values, boolean includeNull) {
Iterator k = keys.iterator();
Iterator v = values.iterator();
HashMap hm = new HashMap();
while (k.hasNext() && v.hasNext()) {
Object o = k.next();
Object p = v.next();
if (includeNull || o != null && p != null) {
hm.put(o, p);
}
}
return hm;
} | java | public static Map zip(List keys, List values, boolean includeNull) {
Iterator k = keys.iterator();
Iterator v = values.iterator();
HashMap hm = new HashMap();
while (k.hasNext() && v.hasNext()) {
Object o = k.next();
Object p = v.next();
if (includeNull || o != null && p != null) {
hm.put(o, p);
}
}
return hm;
} | [
"public",
"static",
"Map",
"zip",
"(",
"List",
"keys",
",",
"List",
"values",
",",
"boolean",
"includeNull",
")",
"{",
"Iterator",
"k",
"=",
"keys",
".",
"iterator",
"(",
")",
";",
"Iterator",
"v",
"=",
"values",
".",
"iterator",
"(",
")",
";",
"Hash... | Creates a map where the object at index N from the first List is the key for the object at index N of the second
List. If either List is shorter than the other, the resulting Map will have only as many keys as are in the
smallest of the two Lists. <br> If includeNull is true, both keys and values of null are allowed. Note that if
more than one key is null, previous entries will be overwritten.
@param keys List of keys
@param values List of values
@param includeNull allow null values and keys
@return map | [
"Creates",
"a",
"map",
"where",
"the",
"object",
"at",
"index",
"N",
"from",
"the",
"first",
"List",
"is",
"the",
"key",
"for",
"the",
"object",
"at",
"index",
"N",
"of",
"the",
"second",
"List",
".",
"If",
"either",
"List",
"is",
"shorter",
"than",
... | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L181-L193 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java | NonBlockingCharArrayWriter.getAsString | @Nonnull
public String getAsString (@Nonnegative final int nLength)
{
ValueEnforcer.isBetweenInclusive (nLength, "Length", 0, m_nCount);
return new String (m_aBuf, 0, nLength);
} | java | @Nonnull
public String getAsString (@Nonnegative final int nLength)
{
ValueEnforcer.isBetweenInclusive (nLength, "Length", 0, m_nCount);
return new String (m_aBuf, 0, nLength);
} | [
"@",
"Nonnull",
"public",
"String",
"getAsString",
"(",
"@",
"Nonnegative",
"final",
"int",
"nLength",
")",
"{",
"ValueEnforcer",
".",
"isBetweenInclusive",
"(",
"nLength",
",",
"\"Length\"",
",",
"0",
",",
"m_nCount",
")",
";",
"return",
"new",
"String",
"(... | Converts input data to a string.
@param nLength
The number of characters to convert. Must be ≤ than
{@link #getSize()}.
@return the string. | [
"Converts",
"input",
"data",
"to",
"a",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java#L350-L355 |
inferred/FreeBuilder | src/main/java/org/inferred/freebuilder/processor/source/QualifiedName.java | QualifiedName.enclosingType | public QualifiedName enclosingType() {
checkState(!isTopLevel(), "Cannot return enclosing type of top-level type");
return new QualifiedName(packageName, simpleNames.subList(0, simpleNames.size() - 1));
} | java | public QualifiedName enclosingType() {
checkState(!isTopLevel(), "Cannot return enclosing type of top-level type");
return new QualifiedName(packageName, simpleNames.subList(0, simpleNames.size() - 1));
} | [
"public",
"QualifiedName",
"enclosingType",
"(",
")",
"{",
"checkState",
"(",
"!",
"isTopLevel",
"(",
")",
",",
"\"Cannot return enclosing type of top-level type\"",
")",
";",
"return",
"new",
"QualifiedName",
"(",
"packageName",
",",
"simpleNames",
".",
"subList",
... | Returns the {@link QualifiedName} of the type enclosing this one.
@throws IllegalStateException if {@link #isTopLevel()} returns true | [
"Returns",
"the",
"{",
"@link",
"QualifiedName",
"}",
"of",
"the",
"type",
"enclosing",
"this",
"one",
"."
] | train | https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/QualifiedName.java#L130-L133 |
Samsung/GearVRf | GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/arcore/ARCoreSession.java | ARCoreSession.onHostAnchor | @Override
synchronized protected void onHostAnchor(GVRAnchor anchor, CloudAnchorCallback cb) {
Anchor newAnchor = mSession.hostCloudAnchor(((ARCoreAnchor) anchor).getAnchorAR());
pendingAnchors.put(newAnchor, cb);
} | java | @Override
synchronized protected void onHostAnchor(GVRAnchor anchor, CloudAnchorCallback cb) {
Anchor newAnchor = mSession.hostCloudAnchor(((ARCoreAnchor) anchor).getAnchorAR());
pendingAnchors.put(newAnchor, cb);
} | [
"@",
"Override",
"synchronized",
"protected",
"void",
"onHostAnchor",
"(",
"GVRAnchor",
"anchor",
",",
"CloudAnchorCallback",
"cb",
")",
"{",
"Anchor",
"newAnchor",
"=",
"mSession",
".",
"hostCloudAnchor",
"(",
"(",
"(",
"ARCoreAnchor",
")",
"anchor",
")",
".",
... | This method hosts an anchor. The {@code listener} will be invoked when the results are
available. | [
"This",
"method",
"hosts",
"an",
"anchor",
".",
"The",
"{"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/MixedReality/src/main/java/org/gearvrf/mixedreality/arcore/ARCoreSession.java#L443-L447 |
LableOrg/java-uniqueid | uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java | ResourceClaim.relinquishResource | private void relinquishResource(ZooKeeper zookeeper, String poolNode, int resource) {
logger.debug("Relinquishing claimed resource {}.", resource);
try {
zookeeper.delete(poolNode + "/" + Integer.toString(resource), -1);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (KeeperException e) {
logger.error("Failed to remove resource claim node {}/{}", poolNode, resource);
}
} | java | private void relinquishResource(ZooKeeper zookeeper, String poolNode, int resource) {
logger.debug("Relinquishing claimed resource {}.", resource);
try {
zookeeper.delete(poolNode + "/" + Integer.toString(resource), -1);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (KeeperException e) {
logger.error("Failed to remove resource claim node {}/{}", poolNode, resource);
}
} | [
"private",
"void",
"relinquishResource",
"(",
"ZooKeeper",
"zookeeper",
",",
"String",
"poolNode",
",",
"int",
"resource",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Relinquishing claimed resource {}.\"",
",",
"resource",
")",
";",
"try",
"{",
"zookeeper",
".",
"... | Relinquish a claimed resource.
@param zookeeper ZooKeeper connection to use.
@param poolNode Path to the znode representing the resource pool.
@param resource The resource. | [
"Relinquish",
"a",
"claimed",
"resource",
"."
] | train | https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java#L388-L397 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java | SDNN.relu | public SDVariable relu(String name, SDVariable x, double cutoff) {
validateFloatingPoint("ReLU", x);
SDVariable result = f().relu(x, cutoff);
return updateVariableNameAndReference(result, name);
} | java | public SDVariable relu(String name, SDVariable x, double cutoff) {
validateFloatingPoint("ReLU", x);
SDVariable result = f().relu(x, cutoff);
return updateVariableNameAndReference(result, name);
} | [
"public",
"SDVariable",
"relu",
"(",
"String",
"name",
",",
"SDVariable",
"x",
",",
"double",
"cutoff",
")",
"{",
"validateFloatingPoint",
"(",
"\"ReLU\"",
",",
"x",
")",
";",
"SDVariable",
"result",
"=",
"f",
"(",
")",
".",
"relu",
"(",
"x",
",",
"cut... | Element-wise rectified linear function with specified cutoff:<br>
out[i] = in[i] if in[i] >= cutoff
out[i] = 0 otherwise
@param name Output variable name
@param x Input variable
@param cutoff Cutoff value. Usually 0
@return Output variable | [
"Element",
"-",
"wise",
"rectified",
"linear",
"function",
"with",
"specified",
"cutoff",
":",
"<br",
">",
"out",
"[",
"i",
"]",
"=",
"in",
"[",
"i",
"]",
"if",
"in",
"[",
"i",
"]",
">",
"=",
"cutoff",
"out",
"[",
"i",
"]",
"=",
"0",
"otherwise"
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L421-L425 |
crowmagnumb/s6-util | src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java | AbstractMultipartUtility.addHeaderField | public void addHeaderField(final String name, final String value)
{
writer.append(name + ": " + value).append(LINE_FEED);
writer.flush();
} | java | public void addHeaderField(final String name, final String value)
{
writer.append(name + ": " + value).append(LINE_FEED);
writer.flush();
} | [
"public",
"void",
"addHeaderField",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"writer",
".",
"append",
"(",
"name",
"+",
"\": \"",
"+",
"value",
")",
".",
"append",
"(",
"LINE_FEED",
")",
";",
"writer",
".",
"flush",
"(... | Adds a header field to the request.
@param name - name of the header field
@param value - value of the header field | [
"Adds",
"a",
"header",
"field",
"to",
"the",
"request",
"."
] | train | https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java#L134-L138 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusTaskStatusHandler.java | FileStatusTaskStatusHandler.taskStatus | private void taskStatus(RESTRequest request, RESTResponse response) {
String taskID = RESTHelper.getRequiredParam(request, APIConstants.PARAM_TASK_ID);
String taskStatusJson = getMultipleRoutingHelper().getStatus(taskID);
OutputHelper.writeJsonOutput(response, taskStatusJson);
} | java | private void taskStatus(RESTRequest request, RESTResponse response) {
String taskID = RESTHelper.getRequiredParam(request, APIConstants.PARAM_TASK_ID);
String taskStatusJson = getMultipleRoutingHelper().getStatus(taskID);
OutputHelper.writeJsonOutput(response, taskStatusJson);
} | [
"private",
"void",
"taskStatus",
"(",
"RESTRequest",
"request",
",",
"RESTResponse",
"response",
")",
"{",
"String",
"taskID",
"=",
"RESTHelper",
".",
"getRequiredParam",
"(",
"request",
",",
"APIConstants",
".",
"PARAM_TASK_ID",
")",
";",
"String",
"taskStatusJso... | Returns a JSON string with the status of that task (pending, successful, failed, etc), and the URL for hosts.
{ "taskStatus" : "completed", "propertiesURL" : "url" , "hostsURL" : "url" } | [
"Returns",
"a",
"JSON",
"string",
"with",
"the",
"status",
"of",
"that",
"task",
"(",
"pending",
"successful",
"failed",
"etc",
")",
"and",
"the",
"URL",
"for",
"hosts",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusTaskStatusHandler.java#L120-L125 |
jfoenixadmin/JFoenix | jfoenix/src/main/java/com/jfoenix/svg/SVGGlyph.java | SVGGlyph.setSize | public void setSize(double width, double height) {
this.setMinSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE);
this.setPrefSize(width, height);
this.setMaxSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE);
} | java | public void setSize(double width, double height) {
this.setMinSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE);
this.setPrefSize(width, height);
this.setMaxSize(StackPane.USE_PREF_SIZE, StackPane.USE_PREF_SIZE);
} | [
"public",
"void",
"setSize",
"(",
"double",
"width",
",",
"double",
"height",
")",
"{",
"this",
".",
"setMinSize",
"(",
"StackPane",
".",
"USE_PREF_SIZE",
",",
"StackPane",
".",
"USE_PREF_SIZE",
")",
";",
"this",
".",
"setPrefSize",
"(",
"width",
",",
"hei... | resize the svg to a certain width and height
@param width
@param height | [
"resize",
"the",
"svg",
"to",
"a",
"certain",
"width",
"and",
"height"
] | train | https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/svg/SVGGlyph.java#L145-L149 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java | ManagedClustersInner.resetServicePrincipalProfile | public void resetServicePrincipalProfile(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) {
resetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body();
} | java | public void resetServicePrincipalProfile(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) {
resetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body();
} | [
"public",
"void",
"resetServicePrincipalProfile",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"ManagedClusterServicePrincipalProfile",
"parameters",
")",
"{",
"resetServicePrincipalProfileWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resou... | Reset Service Principal Profile of a managed cluster.
Update the service principal Profile for a managed cluster.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the managed cluster resource.
@param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster.
@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 | [
"Reset",
"Service",
"Principal",
"Profile",
"of",
"a",
"managed",
"cluster",
".",
"Update",
"the",
"service",
"principal",
"Profile",
"for",
"a",
"managed",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L1501-L1503 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendText | public static <T> void sendText(final ByteBuffer message, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) {
sendInternal(message, WebSocketFrameType.TEXT, wsChannel, callback, context, -1);
} | java | public static <T> void sendText(final ByteBuffer message, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) {
sendInternal(message, WebSocketFrameType.TEXT, wsChannel, callback, context, -1);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"sendText",
"(",
"final",
"ByteBuffer",
"message",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"T",
">",
"callback",
",",
"T",
"context",
")",
"{",
"sendInternal",
"(",
"me... | Sends a complete text message, invoking the callback when complete
@param message The text to send
@param wsChannel The web socket channel
@param callback The callback to invoke on completion
@param context The context object that will be passed to the callback on completion | [
"Sends",
"a",
"complete",
"text",
"message",
"invoking",
"the",
"callback",
"when",
"complete"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L111-L113 |
xcesco/kripton | kripton/src/main/java/com/abubusoft/kripton/xml/XMLParser.java | XMLParser.readQuotedId | private String readQuotedId(boolean returnText) throws IOException, KriptonRuntimeException {
int quote = peekCharacter();
char[] delimiter;
if (quote == '"') {
delimiter = DOUBLE_QUOTE;
} else if (quote == '\'') {
delimiter = SINGLE_QUOTE;
} else {
throw new KriptonRuntimeException("Expected a quoted string", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
}
position++;
return readUntil(delimiter, returnText);
} | java | private String readQuotedId(boolean returnText) throws IOException, KriptonRuntimeException {
int quote = peekCharacter();
char[] delimiter;
if (quote == '"') {
delimiter = DOUBLE_QUOTE;
} else if (quote == '\'') {
delimiter = SINGLE_QUOTE;
} else {
throw new KriptonRuntimeException("Expected a quoted string", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
}
position++;
return readUntil(delimiter, returnText);
} | [
"private",
"String",
"readQuotedId",
"(",
"boolean",
"returnText",
")",
"throws",
"IOException",
",",
"KriptonRuntimeException",
"{",
"int",
"quote",
"=",
"peekCharacter",
"(",
")",
";",
"char",
"[",
"]",
"delimiter",
";",
"if",
"(",
"quote",
"==",
"'",
"'",... | Reads a quoted string, performing no entity escaping of the contents.
@param returnText the return text
@return the string
@throws IOException Signals that an I/O exception has occurred.
@throws KriptonRuntimeException the kripton runtime exception | [
"Reads",
"a",
"quoted",
"string",
"performing",
"no",
"entity",
"escaping",
"of",
"the",
"contents",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLParser.java#L833-L845 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java | ResourcesInner.listByResourceGroupAsync | public Observable<Page<GenericResourceInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, expand, top)
.map(new Func1<ServiceResponse<Page<GenericResourceInner>>, Page<GenericResourceInner>>() {
@Override
public Page<GenericResourceInner> call(ServiceResponse<Page<GenericResourceInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<GenericResourceInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter, final String expand, final Integer top) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, expand, top)
.map(new Func1<ServiceResponse<Page<GenericResourceInner>>, Page<GenericResourceInner>>() {
@Override
public Page<GenericResourceInner> call(ServiceResponse<Page<GenericResourceInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"GenericResourceInner",
">",
">",
"listByResourceGroupAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"filter",
",",
"final",
"String",
"expand",
",",
"final",
"Integer",
"top",
")",
"{",
"re... | Get all the resources for a resource group.
@param resourceGroupName The resource group with the resources to get.
@param filter The filter to apply on the operation.
@param expand The $expand query parameter
@param top The number of results to return. If null is passed, returns all resources.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<GenericResourceInner> object | [
"Get",
"all",
"the",
"resources",
"for",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L333-L341 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.find | public <T> T find(Query query, RsHandler<T> rsh) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.find(conn, query, rsh);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | java | public <T> T find(Query query, RsHandler<T> rsh) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.find(conn, query, rsh);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | [
"public",
"<",
"T",
">",
"T",
"find",
"(",
"Query",
"query",
",",
"RsHandler",
"<",
"T",
">",
"rsh",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"this",
".",
"getConnection",
"(",
")",
";",
"... | 查询<br>
Query为查询所需数据的一个实体类,此对象中可以定义返回字段、查询条件,查询的表、分页等信息
@param <T> 需要处理成的结果对象类型
@param query {@link Query}对象,此对象中可以定义返回字段、查询条件,查询的表、分页等信息
@param rsh 结果集处理对象
@return 结果对象
@throws SQLException SQL执行异常
@since 4.0.0 | [
"查询<br",
">",
"Query为查询所需数据的一个实体类,此对象中可以定义返回字段、查询条件,查询的表、分页等信息"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L455-L465 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionCategoryConfig.java | CollisionCategoryConfig.imports | public static Collection<CollisionCategory> imports(Xml root)
{
Check.notNull(root);
final Collection<Xml> childrenCategory = root.getChildren(NODE_CATEGORY);
final Collection<CollisionCategory> categories = new ArrayList<>(childrenCategory.size());
for (final Xml node : childrenCategory)
{
final Collection<Xml> childrenGroup = node.getChildren(TileGroupsConfig.NODE_GROUP);
final Collection<CollisionGroup> groups = new ArrayList<>(childrenGroup.size());
for (final Xml group : childrenGroup)
{
final String name = group.getText();
groups.add(new CollisionGroup(name, new ArrayList<CollisionFormula>(0)));
}
final String name = node.readString(ATT_NAME);
final Axis axis = Axis.valueOf(node.readString(ATT_AXIS));
final int x = node.readInteger(ATT_X);
final int y = node.readInteger(ATT_Y);
final boolean glue = node.readBoolean(true, ATT_GLUE);
final CollisionCategory category = new CollisionCategory(name, axis, x, y, glue, groups);
categories.add(category);
}
return categories;
} | java | public static Collection<CollisionCategory> imports(Xml root)
{
Check.notNull(root);
final Collection<Xml> childrenCategory = root.getChildren(NODE_CATEGORY);
final Collection<CollisionCategory> categories = new ArrayList<>(childrenCategory.size());
for (final Xml node : childrenCategory)
{
final Collection<Xml> childrenGroup = node.getChildren(TileGroupsConfig.NODE_GROUP);
final Collection<CollisionGroup> groups = new ArrayList<>(childrenGroup.size());
for (final Xml group : childrenGroup)
{
final String name = group.getText();
groups.add(new CollisionGroup(name, new ArrayList<CollisionFormula>(0)));
}
final String name = node.readString(ATT_NAME);
final Axis axis = Axis.valueOf(node.readString(ATT_AXIS));
final int x = node.readInteger(ATT_X);
final int y = node.readInteger(ATT_Y);
final boolean glue = node.readBoolean(true, ATT_GLUE);
final CollisionCategory category = new CollisionCategory(name, axis, x, y, glue, groups);
categories.add(category);
}
return categories;
} | [
"public",
"static",
"Collection",
"<",
"CollisionCategory",
">",
"imports",
"(",
"Xml",
"root",
")",
"{",
"Check",
".",
"notNull",
"(",
"root",
")",
";",
"final",
"Collection",
"<",
"Xml",
">",
"childrenCategory",
"=",
"root",
".",
"getChildren",
"(",
"NOD... | Create the collision category data from node (should only be used to display names, as real content is
<code>null</code>, mainly UI specific to not have dependency on {@link MapTileCollision}).
@param root The node root reference (must not be <code>null</code>).
@return The collisions category data.
@throws LionEngineException If unable to read node. | [
"Create",
"the",
"collision",
"category",
"data",
"from",
"node",
"(",
"should",
"only",
"be",
"used",
"to",
"display",
"names",
"as",
"real",
"content",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"mainly",
"UI",
"specific",
"to",
"not",
"have",
"dep... | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionCategoryConfig.java#L63-L92 |
cloudendpoints/endpoints-management-java | endpoints-control/src/main/java/com/google/api/control/model/Distributions.java | Distributions.addSample | public static Distribution addSample(double value, Distribution distribution) {
Builder builder = distribution.toBuilder();
switch (distribution.getBucketOptionCase()) {
case EXPLICIT_BUCKETS:
updateStatistics(value, builder);
updateExplicitBuckets(value, builder);
return builder.build();
case EXPONENTIAL_BUCKETS:
updateStatistics(value, builder);
updateExponentialBuckets(value, builder);
return builder.build();
case LINEAR_BUCKETS:
updateStatistics(value, builder);
updateLinearBuckets(value, builder);
return builder.build();
default:
throw new IllegalArgumentException(MSG_UNKNOWN_BUCKET_OPTION_TYPE);
}
} | java | public static Distribution addSample(double value, Distribution distribution) {
Builder builder = distribution.toBuilder();
switch (distribution.getBucketOptionCase()) {
case EXPLICIT_BUCKETS:
updateStatistics(value, builder);
updateExplicitBuckets(value, builder);
return builder.build();
case EXPONENTIAL_BUCKETS:
updateStatistics(value, builder);
updateExponentialBuckets(value, builder);
return builder.build();
case LINEAR_BUCKETS:
updateStatistics(value, builder);
updateLinearBuckets(value, builder);
return builder.build();
default:
throw new IllegalArgumentException(MSG_UNKNOWN_BUCKET_OPTION_TYPE);
}
} | [
"public",
"static",
"Distribution",
"addSample",
"(",
"double",
"value",
",",
"Distribution",
"distribution",
")",
"{",
"Builder",
"builder",
"=",
"distribution",
".",
"toBuilder",
"(",
")",
";",
"switch",
"(",
"distribution",
".",
"getBucketOptionCase",
"(",
")... | Updates as new distribution that contains value added to an existing one.
@param value the sample value
@param distribution a {@code Distribution}
@return the updated distribution | [
"Updates",
"as",
"new",
"distribution",
"that",
"contains",
"value",
"added",
"to",
"an",
"existing",
"one",
"."
] | train | https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/model/Distributions.java#L135-L153 |
logic-ng/LogicNG | src/main/java/org/logicng/backbones/BackboneGeneration.java | BackboneGeneration.computeNegative | public static Backbone computeNegative(final Formula formula, final Collection<Variable> variables) {
return compute(formula, variables, BackboneType.ONLY_NEGATIVE);
} | java | public static Backbone computeNegative(final Formula formula, final Collection<Variable> variables) {
return compute(formula, variables, BackboneType.ONLY_NEGATIVE);
} | [
"public",
"static",
"Backbone",
"computeNegative",
"(",
"final",
"Formula",
"formula",
",",
"final",
"Collection",
"<",
"Variable",
">",
"variables",
")",
"{",
"return",
"compute",
"(",
"formula",
",",
"variables",
",",
"BackboneType",
".",
"ONLY_NEGATIVE",
")",... | Computes the negative backbone variables for a given formula w.r.t. a collection of variables.
@param formula the given formula
@param variables the given collection of relevant variables for the backbone computation
@return the negative backbone or {@code null} if the formula is UNSAT | [
"Computes",
"the",
"negative",
"backbone",
"variables",
"for",
"a",
"given",
"formula",
"w",
".",
"r",
".",
"t",
".",
"a",
"collection",
"of",
"variables",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/BackboneGeneration.java#L221-L223 |
google/closure-compiler | src/com/google/javascript/jscomp/type/ChainableReverseAbstractInterpreter.java | ChainableReverseAbstractInterpreter.declareNameInScope | @CheckReturnValue
protected FlowScope declareNameInScope(FlowScope scope, Node node, JSType type) {
switch (node.getToken()) {
case NAME:
return scope.inferSlotType(node.getString(), type);
case GETPROP:
String qualifiedName = node.getQualifiedName();
checkNotNull(qualifiedName);
JSType origType = node.getJSType();
origType = origType == null ? getNativeType(UNKNOWN_TYPE) : origType;
return scope.inferQualifiedSlot(node, qualifiedName, origType, type, false);
case THIS:
// "this" references aren't currently modeled in the CFG.
return scope;
default:
throw new IllegalArgumentException("Node cannot be refined. \n" +
node.toStringTree());
}
} | java | @CheckReturnValue
protected FlowScope declareNameInScope(FlowScope scope, Node node, JSType type) {
switch (node.getToken()) {
case NAME:
return scope.inferSlotType(node.getString(), type);
case GETPROP:
String qualifiedName = node.getQualifiedName();
checkNotNull(qualifiedName);
JSType origType = node.getJSType();
origType = origType == null ? getNativeType(UNKNOWN_TYPE) : origType;
return scope.inferQualifiedSlot(node, qualifiedName, origType, type, false);
case THIS:
// "this" references aren't currently modeled in the CFG.
return scope;
default:
throw new IllegalArgumentException("Node cannot be refined. \n" +
node.toStringTree());
}
} | [
"@",
"CheckReturnValue",
"protected",
"FlowScope",
"declareNameInScope",
"(",
"FlowScope",
"scope",
",",
"Node",
"node",
",",
"JSType",
"type",
")",
"{",
"switch",
"(",
"node",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"NAME",
":",
"return",
"scope",
".... | Declares a refined type in {@code scope} for the name represented by {@code node}. It must be
possible to refine the type of the given node in the given scope, as determined by {@link
#getTypeIfRefinable}. Returns an updated flow scope, which may be different from the passed-in
scope if any changes occur. | [
"Declares",
"a",
"refined",
"type",
"in",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/type/ChainableReverseAbstractInterpreter.java#L161-L183 |
motown-io/motown | samples/authentication/src/main/java/io/motown/sample/authentication/rest/TokenUtils.java | TokenUtils.computeSignature | public static String computeSignature(UserDetails userDetails, long expires) {
MessageDigest digest;
try {
digest = MessageDigest.getInstance(MESSAGE_DIGEST_ALGORITHM);
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("No " + MESSAGE_DIGEST_ALGORITHM + " algorithm available!", e);
}
String signature = userDetails.getUsername() + TOKEN_SEPARATOR + expires + TOKEN_SEPARATOR + userDetails.getPassword() + TOKEN_SEPARATOR + TokenUtils.MAGIC_KEY;
return new String(Hex.encode(digest.digest(signature.getBytes(Charsets.UTF_8))));
} | java | public static String computeSignature(UserDetails userDetails, long expires) {
MessageDigest digest;
try {
digest = MessageDigest.getInstance(MESSAGE_DIGEST_ALGORITHM);
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("No " + MESSAGE_DIGEST_ALGORITHM + " algorithm available!", e);
}
String signature = userDetails.getUsername() + TOKEN_SEPARATOR + expires + TOKEN_SEPARATOR + userDetails.getPassword() + TOKEN_SEPARATOR + TokenUtils.MAGIC_KEY;
return new String(Hex.encode(digest.digest(signature.getBytes(Charsets.UTF_8))));
} | [
"public",
"static",
"String",
"computeSignature",
"(",
"UserDetails",
"userDetails",
",",
"long",
"expires",
")",
"{",
"MessageDigest",
"digest",
";",
"try",
"{",
"digest",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"MESSAGE_DIGEST_ALGORITHM",
")",
";",
"}",
... | Computes a signature for {@code UserDetails} and expiration time.
@param userDetails user details.
@param expires expiration time.
@return signature. | [
"Computes",
"a",
"signature",
"for",
"{",
"@code",
"UserDetails",
"}",
"and",
"expiration",
"time",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/samples/authentication/src/main/java/io/motown/sample/authentication/rest/TokenUtils.java#L67-L78 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/PooledService.java | PooledService.unsubscribeAndRetry | private void unsubscribeAndRetry(final Subscription subscription, final CouchbaseRequest request) {
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
RetryHelper.retryOrCancel(env, request, responseBuffer);
} | java | private void unsubscribeAndRetry(final Subscription subscription, final CouchbaseRequest request) {
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
RetryHelper.retryOrCancel(env, request, responseBuffer);
} | [
"private",
"void",
"unsubscribeAndRetry",
"(",
"final",
"Subscription",
"subscription",
",",
"final",
"CouchbaseRequest",
"request",
")",
"{",
"if",
"(",
"subscription",
"!=",
"null",
"&&",
"!",
"subscription",
".",
"isUnsubscribed",
"(",
")",
")",
"{",
"subscri... | Helper method to unsubscribe from the subscription and send the request into retry. | [
"Helper",
"method",
"to",
"unsubscribe",
"from",
"the",
"subscription",
"and",
"send",
"the",
"request",
"into",
"retry",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/PooledService.java#L397-L402 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.checkIdentifier | private static int checkIdentifier(final String signature, int pos) {
if (!Character.isJavaIdentifierStart(getChar(signature, pos))) {
throw new IllegalArgumentException(signature
+ ": identifier expected at index " + pos);
}
++pos;
while (Character.isJavaIdentifierPart(getChar(signature, pos))) {
++pos;
}
return pos;
} | java | private static int checkIdentifier(final String signature, int pos) {
if (!Character.isJavaIdentifierStart(getChar(signature, pos))) {
throw new IllegalArgumentException(signature
+ ": identifier expected at index " + pos);
}
++pos;
while (Character.isJavaIdentifierPart(getChar(signature, pos))) {
++pos;
}
return pos;
} | [
"private",
"static",
"int",
"checkIdentifier",
"(",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"if",
"(",
"!",
"Character",
".",
"isJavaIdentifierStart",
"(",
"getChar",
"(",
"signature",
",",
"pos",
")",
")",
")",
"{",
"throw",
"new",
... | Checks an identifier.
@param signature
a string containing the signature that must be checked.
@param pos
index of first character to be checked.
@return the index of the first character after the checked part. | [
"Checks",
"an",
"identifier",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L967-L977 |
Omertron/api-thetvdb | src/main/java/com/omertron/thetvdbapi/tools/DOMHelper.java | DOMHelper.getEventDocFromUrl | public static synchronized Document getEventDocFromUrl(String url) throws TvDbException {
Document doc = null;
String webPage = getValidWebpage(url);
// If the webpage returned is null or empty, quit
if(StringUtils.isBlank(webPage)){
return null;
}
try (InputStream in = new ByteArrayInputStream(webPage.getBytes(CHARSET))) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(in);
doc.getDocumentElement().normalize();
} catch (UnsupportedEncodingException ex) {
throw new TvDbException(ApiExceptionType.INVALID_URL, "Unable to encode URL", url, ex);
} catch (ParserConfigurationException | SAXException | IOException error) {
throw new TvDbException(ApiExceptionType.MAPPING_FAILED, ERROR_UNABLE_TO_PARSE, url, error);
}
return doc;
} | java | public static synchronized Document getEventDocFromUrl(String url) throws TvDbException {
Document doc = null;
String webPage = getValidWebpage(url);
// If the webpage returned is null or empty, quit
if(StringUtils.isBlank(webPage)){
return null;
}
try (InputStream in = new ByteArrayInputStream(webPage.getBytes(CHARSET))) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(in);
doc.getDocumentElement().normalize();
} catch (UnsupportedEncodingException ex) {
throw new TvDbException(ApiExceptionType.INVALID_URL, "Unable to encode URL", url, ex);
} catch (ParserConfigurationException | SAXException | IOException error) {
throw new TvDbException(ApiExceptionType.MAPPING_FAILED, ERROR_UNABLE_TO_PARSE, url, error);
}
return doc;
} | [
"public",
"static",
"synchronized",
"Document",
"getEventDocFromUrl",
"(",
"String",
"url",
")",
"throws",
"TvDbException",
"{",
"Document",
"doc",
"=",
"null",
";",
"String",
"webPage",
"=",
"getValidWebpage",
"(",
"url",
")",
";",
"// If the webpage returned is nu... | Get a DOM document from the supplied URL
@param url
@return
@throws com.omertron.thetvdbapi.TvDbException | [
"Get",
"a",
"DOM",
"document",
"from",
"the",
"supplied",
"URL"
] | train | https://github.com/Omertron/api-thetvdb/blob/2ff9f9580e76043f19d2fc3234d87e16a95fa485/src/main/java/com/omertron/thetvdbapi/tools/DOMHelper.java#L118-L140 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ReflectionUtils.java | ReflectionUtils.getMethod | public static Method getMethod(String methodName, Class<?> clazz, Class<?>... parameterTypes) {
if (clazz == null) {
return null;
}
Method m = getDeclaredMethod(methodName, clazz, parameterTypes);
if (m == null) {
List<Class<?>> interfacesAndSuperClasses = new LinkedList<>();
interfacesAndSuperClasses.add(clazz.getSuperclass());
for (Class<?> cl : clazz.getInterfaces()) {
interfacesAndSuperClasses.add(cl);
}
for (Class<?> cl : interfacesAndSuperClasses) {
m = getMethod(methodName, cl, parameterTypes);
if (m != null) {
return m;
}
}
return null;
} else {
return m;
}
} | java | public static Method getMethod(String methodName, Class<?> clazz, Class<?>... parameterTypes) {
if (clazz == null) {
return null;
}
Method m = getDeclaredMethod(methodName, clazz, parameterTypes);
if (m == null) {
List<Class<?>> interfacesAndSuperClasses = new LinkedList<>();
interfacesAndSuperClasses.add(clazz.getSuperclass());
for (Class<?> cl : clazz.getInterfaces()) {
interfacesAndSuperClasses.add(cl);
}
for (Class<?> cl : interfacesAndSuperClasses) {
m = getMethod(methodName, cl, parameterTypes);
if (m != null) {
return m;
}
}
return null;
} else {
return m;
}
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Met... | Get a class' method by name. Return {@code null} if no such method found.
<p>
This method can get private and protected methods.
</p>
<p>
This method can get methods from super classes/interfaces.
</p>
@param methodName
@param clazz
@param parameterTypes
@return
@since 0.9.1.4 | [
"Get",
"a",
"class",
"method",
"by",
"name",
".",
"Return",
"{",
"@code",
"null",
"}",
"if",
"no",
"such",
"method",
"found",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ReflectionUtils.java#L70-L91 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/apple/PropertyListSerialization.java | PropertyListSerialization.serializeInteger | private static void serializeInteger(final Number integer, final ContentHandler handler) throws SAXException {
serializeElement("integer", String.valueOf(integer.longValue()), handler);
} | java | private static void serializeInteger(final Number integer, final ContentHandler handler) throws SAXException {
serializeElement("integer", String.valueOf(integer.longValue()), handler);
} | [
"private",
"static",
"void",
"serializeInteger",
"(",
"final",
"Number",
"integer",
",",
"final",
"ContentHandler",
"handler",
")",
"throws",
"SAXException",
"{",
"serializeElement",
"(",
"\"integer\"",
",",
"String",
".",
"valueOf",
"(",
"integer",
".",
"longValu... | Serialize a Number as an integer element.
@param integer
number to serialize.
@param handler
destination of serialization events.
@throws SAXException
if exception during serialization. | [
"Serialize",
"a",
"Number",
"as",
"an",
"integer",
"element",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/PropertyListSerialization.java#L131-L133 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/db/ResultSetUtility.java | ResultSetUtility.columnLabelOrName | public String columnLabelOrName(ResultSetMetaData rsmd, int col) throws SQLException{
String columnName = rsmd.getColumnLabel(col);
if (null == columnName || 0 == columnName.length()) {
columnName = rsmd.getColumnName(col);
}
return columnName;
} | java | public String columnLabelOrName(ResultSetMetaData rsmd, int col) throws SQLException{
String columnName = rsmd.getColumnLabel(col);
if (null == columnName || 0 == columnName.length()) {
columnName = rsmd.getColumnName(col);
}
return columnName;
} | [
"public",
"String",
"columnLabelOrName",
"(",
"ResultSetMetaData",
"rsmd",
",",
"int",
"col",
")",
"throws",
"SQLException",
"{",
"String",
"columnName",
"=",
"rsmd",
".",
"getColumnLabel",
"(",
"col",
")",
";",
"if",
"(",
"null",
"==",
"columnName",
"||",
"... | Get the label or name of a column
@param rsmd
@param col
@return label or name of the column
@throws SQLException | [
"Get",
"the",
"label",
"or",
"name",
"of",
"a",
"column"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/ResultSetUtility.java#L309-L315 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java | BucketImpl.insertByKey | public Element insertByKey(Object key, Object object)
{
Element element = new Element(this, key, object);
add(element);
return element;
} | java | public Element insertByKey(Object key, Object object)
{
Element element = new Element(this, key, object);
add(element);
return element;
} | [
"public",
"Element",
"insertByKey",
"(",
"Object",
"key",
",",
"Object",
"object",
")",
"{",
"Element",
"element",
"=",
"new",
"Element",
"(",
"this",
",",
"key",
",",
"object",
")",
";",
"add",
"(",
"element",
")",
";",
"return",
"element",
";",
"}"
] | Insert the specified object into the bucket and associate it with
the specified key. Returns the Element which holds the newly-
inserted object.
@param key key of the object element to be inserted.
@param object the object to be inserted for the specified key.
@return the Element holding the target object just inserted. | [
"Insert",
"the",
"specified",
"object",
"into",
"the",
"bucket",
"and",
"associate",
"it",
"with",
"the",
"specified",
"key",
".",
"Returns",
"the",
"Element",
"which",
"holds",
"the",
"newly",
"-",
"inserted",
"object",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/util/cache/BucketImpl.java#L105-L110 |
landawn/AbacusUtil | src/com/landawn/abacus/util/StringUtil.java | StringUtil.validSurrogatePairAt | static boolean validSurrogatePairAt(final String str, final int index) {
return index >= 0 && index <= (str.length() - 2) && Character.isHighSurrogate(str.charAt(index)) && Character.isLowSurrogate(str.charAt(index + 1));
} | java | static boolean validSurrogatePairAt(final String str, final int index) {
return index >= 0 && index <= (str.length() - 2) && Character.isHighSurrogate(str.charAt(index)) && Character.isLowSurrogate(str.charAt(index + 1));
} | [
"static",
"boolean",
"validSurrogatePairAt",
"(",
"final",
"String",
"str",
",",
"final",
"int",
"index",
")",
"{",
"return",
"index",
">=",
"0",
"&&",
"index",
"<=",
"(",
"str",
".",
"length",
"(",
")",
"-",
"2",
")",
"&&",
"Character",
".",
"isHighSu... | Note: copy rights: Google Guava.
True when a valid surrogate pair starts at the given {@code index} in the
given {@code string}. Out-of-range indexes return false. | [
"Note",
":",
"copy",
"rights",
":",
"Google",
"Guava",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L4315-L4317 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseBitwiseComplementExpression | private Expr parseBitwiseComplementExpression(EnclosingScope scope, boolean terminated) {
int start = index;
match(Tilde);
Expr expression = parseExpression(scope, terminated);
return annotateSourceLocation(new Expr.BitwiseComplement(Type.Void, expression), start);
} | java | private Expr parseBitwiseComplementExpression(EnclosingScope scope, boolean terminated) {
int start = index;
match(Tilde);
Expr expression = parseExpression(scope, terminated);
return annotateSourceLocation(new Expr.BitwiseComplement(Type.Void, expression), start);
} | [
"private",
"Expr",
"parseBitwiseComplementExpression",
"(",
"EnclosingScope",
"scope",
",",
"boolean",
"terminated",
")",
"{",
"int",
"start",
"=",
"index",
";",
"match",
"(",
"Tilde",
")",
";",
"Expr",
"expression",
"=",
"parseExpression",
"(",
"scope",
",",
... | Parse a bitwise complement expression, which has the form:
<pre>
TermExpr::= ...
| '~' Expr// bitwise complement
</pre>
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@param terminated
This indicates that the expression is known to be terminated
(or not). An expression that's known to be terminated is one
which is guaranteed to be followed by something. This is
important because it means that we can ignore any newline
characters encountered in parsing this expression, and that
we'll never overrun the end of the expression (i.e. because
there's guaranteed to be something which terminates this
expression). A classic situation where terminated is true is
when parsing an expression surrounded in braces. In such case,
we know the right-brace will always terminate this expression.
@return | [
"Parse",
"a",
"bitwise",
"complement",
"expression",
"which",
"has",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L3272-L3277 |
NextFaze/power-adapters | power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/Data.java | Data.fromCursor | @NonNull
public static <T> Data<T> fromCursor(@NonNull Callable<Cursor> loader,
@NonNull RowMapper<T> rowMapper) {
return fromCursor(loader, rowMapper, DataExecutors.defaultExecutor());
} | java | @NonNull
public static <T> Data<T> fromCursor(@NonNull Callable<Cursor> loader,
@NonNull RowMapper<T> rowMapper) {
return fromCursor(loader, rowMapper, DataExecutors.defaultExecutor());
} | [
"@",
"NonNull",
"public",
"static",
"<",
"T",
">",
"Data",
"<",
"T",
">",
"fromCursor",
"(",
"@",
"NonNull",
"Callable",
"<",
"Cursor",
">",
"loader",
",",
"@",
"NonNull",
"RowMapper",
"<",
"T",
">",
"rowMapper",
")",
"{",
"return",
"fromCursor",
"(",
... | Creates a {@linkplain Data} that presents elements of a {@link Cursor} retrieved by invoking the specified loader
function in a worker thread. {@link T} instances are mapped using the specified row mapper function.
The cursor's position will be pre-configured - callers don't need to set it.
<p>
The {@linkplain Data} will respond to backend changes by invoking the loader function again, if the cursor
dispatches notifications to the registered {@link DataSetObserver}s.
<p>
Note that the returned {@linkplain Data} manages the {@linkplain Cursor} instances itself, and callers should
never close cursors returned by the loader function.
@param loader The function to be invoked to load the cursor.
@param rowMapper The function to be invoked to map rows from the {@linkplain Cursor} to instances of {@link T}.
@param <T> The type of element presented by the returned data.
@return A {@linkplain Data} instance that will present the cursor elements.
@see Cursor#registerDataSetObserver(DataSetObserver)
@see DataSetObserver | [
"Creates",
"a",
"{"
] | train | https://github.com/NextFaze/power-adapters/blob/cdf00b1b723ed9d6bcd549ae9741a19dd59651e1/power-adapters-data/src/main/java/com/nextfaze/poweradapters/data/Data.java#L558-L562 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_migrationToken_GET | public OvhIpMigrationToken ip_migrationToken_GET(String ip) throws IOException {
String qPath = "/ip/{ip}/migrationToken";
StringBuilder sb = path(qPath, ip);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhIpMigrationToken.class);
} | java | public OvhIpMigrationToken ip_migrationToken_GET(String ip) throws IOException {
String qPath = "/ip/{ip}/migrationToken";
StringBuilder sb = path(qPath, ip);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhIpMigrationToken.class);
} | [
"public",
"OvhIpMigrationToken",
"ip_migrationToken_GET",
"(",
"String",
"ip",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/migrationToken\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
")",
";",
"String",
"resp",
... | Get this object properties
REST: GET /ip/{ip}/migrationToken
@param ip [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L298-L303 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/AwardEmojiApi.java | AwardEmojiApi.deleteMergeRequestAwardEmoji | public void deleteMergeRequestAwardEmoji(Object projectIdOrPath, Integer mergeRequestIid, Integer awardId) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null,
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "award_emoji", awardId);
} | java | public void deleteMergeRequestAwardEmoji(Object projectIdOrPath, Integer mergeRequestIid, Integer awardId) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null,
"projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "award_emoji", awardId);
} | [
"public",
"void",
"deleteMergeRequestAwardEmoji",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"mergeRequestIid",
",",
"Integer",
"awardId",
")",
"throws",
"GitLabApiException",
"{",
"delete",
"(",
"Response",
".",
"Status",
".",
"NO_CONTENT",
",",
"null",
",",... | Delete an award emoji from the specified merge request.
<pre><code>GitLab Endpoint: DELETE /projects/:id/merge_requests/:merge_request_iid/award_emoji/:award_id</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param mergeRequestIid the merge request IID to delete the award emoji from
@param awardId the ID of the award emoji to delete
@throws GitLabApiException if any exception occurs | [
"Delete",
"an",
"award",
"emoji",
"from",
"the",
"specified",
"merge",
"request",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/AwardEmojiApi.java#L254-L257 |
dlemmermann/CalendarFX | CalendarFXRecurrence/src/main/java/com/google/ical/iter/Util.java | Util.nextWeekStart | static DateValue nextWeekStart(DateValue d, Weekday wkst) {
DTBuilder builder = new DTBuilder(d);
builder.day += (7 - ((7 + (Weekday.valueOf(d).javaDayNum
- wkst.javaDayNum)) % 7))
% 7;
return builder.toDate();
} | java | static DateValue nextWeekStart(DateValue d, Weekday wkst) {
DTBuilder builder = new DTBuilder(d);
builder.day += (7 - ((7 + (Weekday.valueOf(d).javaDayNum
- wkst.javaDayNum)) % 7))
% 7;
return builder.toDate();
} | [
"static",
"DateValue",
"nextWeekStart",
"(",
"DateValue",
"d",
",",
"Weekday",
"wkst",
")",
"{",
"DTBuilder",
"builder",
"=",
"new",
"DTBuilder",
"(",
"d",
")",
";",
"builder",
".",
"day",
"+=",
"(",
"7",
"-",
"(",
"(",
"7",
"+",
"(",
"Weekday",
".",... | the earliest day on or after d that falls on wkst.
@param wkst the day of the week that the week starts on | [
"the",
"earliest",
"day",
"on",
"or",
"after",
"d",
"that",
"falls",
"on",
"wkst",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/iter/Util.java#L53-L59 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java | Postconditions.checkPostconditionD | public static double checkPostconditionD(
final double value,
final boolean condition,
final DoubleFunction<String> describer)
{
return innerCheckD(value, condition, describer);
} | java | public static double checkPostconditionD(
final double value,
final boolean condition,
final DoubleFunction<String> describer)
{
return innerCheckD(value, condition, describer);
} | [
"public",
"static",
"double",
"checkPostconditionD",
"(",
"final",
"double",
"value",
",",
"final",
"boolean",
"condition",
",",
"final",
"DoubleFunction",
"<",
"String",
">",
"describer",
")",
"{",
"return",
"innerCheckD",
"(",
"value",
",",
"condition",
",",
... | A {@code double} specialized version of {@link #checkPostcondition(Object,
boolean, Function)}
@param value The value
@param condition The predicate
@param describer The describer of the predicate
@return value
@throws PostconditionViolationException If the predicate is false | [
"A",
"{",
"@code",
"double",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkPostcondition",
"(",
"Object",
"boolean",
"Function",
")",
"}"
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L549-L555 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java | AutomationAccountsInner.createOrUpdateAsync | public Observable<AutomationAccountInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, AutomationAccountCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, parameters).map(new Func1<ServiceResponse<AutomationAccountInner>, AutomationAccountInner>() {
@Override
public AutomationAccountInner call(ServiceResponse<AutomationAccountInner> response) {
return response.body();
}
});
} | java | public Observable<AutomationAccountInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, AutomationAccountCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, parameters).map(new Func1<ServiceResponse<AutomationAccountInner>, AutomationAccountInner>() {
@Override
public AutomationAccountInner call(ServiceResponse<AutomationAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AutomationAccountInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"AutomationAccountCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsy... | Create or update automation account.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param parameters Parameters supplied to the create or update automation account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AutomationAccountInner object | [
"Create",
"or",
"update",
"automation",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AutomationAccountsInner.java#L234-L241 |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java | StencilOperands.greaterThan | public boolean greaterThan(Object left, Object right) {
if ((left == right) || left == null || right == null) {
return false;
}
else {
return compare(left, right, ">") > 0;
}
} | java | public boolean greaterThan(Object left, Object right) {
if ((left == right) || left == null || right == null) {
return false;
}
else {
return compare(left, right, ">") > 0;
}
} | [
"public",
"boolean",
"greaterThan",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"{",
"if",
"(",
"(",
"left",
"==",
"right",
")",
"||",
"left",
"==",
"null",
"||",
"right",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"r... | Test if left > right.
@param left
first value
@param right
second value
@return test result. | [
"Test",
"if",
"left",
">",
"right",
"."
] | train | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java#L833-L840 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java | ServerAzureADAdministratorsInner.getAsync | public Observable<ServerAzureADAdministratorInner> getAsync(String resourceGroupName, String serverName) {
return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerAzureADAdministratorInner>, ServerAzureADAdministratorInner>() {
@Override
public ServerAzureADAdministratorInner call(ServiceResponse<ServerAzureADAdministratorInner> response) {
return response.body();
}
});
} | java | public Observable<ServerAzureADAdministratorInner> getAsync(String resourceGroupName, String serverName) {
return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerAzureADAdministratorInner>, ServerAzureADAdministratorInner>() {
@Override
public ServerAzureADAdministratorInner call(ServiceResponse<ServerAzureADAdministratorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerAzureADAdministratorInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
".",
"map",
"(",
"new... | Returns an server Administrator.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerAzureADAdministratorInner object | [
"Returns",
"an",
"server",
"Administrator",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java#L455-L462 |
paoding-code/paoding-rose | paoding-rose-jade/src/main/java/net/paoding/rose/jade/statement/expression/impl/ExqlCompiler.java | ExqlCompiler.match | private boolean match(String keyword, int fromIndex) {
int match = 0;
// 查找非空白字符。
for (int index = fromIndex; index < length; index++) {
char ch = pattern.charAt(index);
if (!Character.isWhitespace(ch)) {
match = index;
break;
}
}
// 匹配关键字内容。
for (int index = 0; index < keyword.length(); index++) {
char ch = pattern.charAt(match);
if (ch != keyword.charAt(index)) {
// 与关键字不匹配
return false;
}
match++;
}
// 修改当前位置
position = match;
return true;
} | java | private boolean match(String keyword, int fromIndex) {
int match = 0;
// 查找非空白字符。
for (int index = fromIndex; index < length; index++) {
char ch = pattern.charAt(index);
if (!Character.isWhitespace(ch)) {
match = index;
break;
}
}
// 匹配关键字内容。
for (int index = 0; index < keyword.length(); index++) {
char ch = pattern.charAt(match);
if (ch != keyword.charAt(index)) {
// 与关键字不匹配
return false;
}
match++;
}
// 修改当前位置
position = match;
return true;
} | [
"private",
"boolean",
"match",
"(",
"String",
"keyword",
",",
"int",
"fromIndex",
")",
"{",
"int",
"match",
"=",
"0",
";",
"// 查找非空白字符。",
"for",
"(",
"int",
"index",
"=",
"fromIndex",
";",
"index",
"<",
"length",
";",
"index",
"++",
")",
"{",
"char",
... | 匹配指定的关键字。
如果匹配成功, 当前位置是关键字最后一个字符之后。
@param keyword - 匹配的关键字
@param fromIndex - 查找的起始位置
@return true / false | [
"匹配指定的关键字。"
] | train | https://github.com/paoding-code/paoding-rose/blob/8b512704174dd6cba95e544c7d6ab66105cb8ec4/paoding-rose-jade/src/main/java/net/paoding/rose/jade/statement/expression/impl/ExqlCompiler.java#L410-L442 |
rythmengine/rythmengine | src/main/java/org/rythmengine/toString/ToStringStyle.java | ToStringStyle.appendSummary | protected void appendSummary(StringBuilder buffer, String fieldName, int[] array) {
appendSummarySize(buffer, fieldName, array.length);
} | java | protected void appendSummary(StringBuilder buffer, String fieldName, int[] array) {
appendSummarySize(buffer, fieldName, array.length);
} | [
"protected",
"void",
"appendSummary",
"(",
"StringBuilder",
"buffer",
",",
"String",
"fieldName",
",",
"int",
"[",
"]",
"array",
")",
"{",
"appendSummarySize",
"(",
"buffer",
",",
"fieldName",
",",
"array",
".",
"length",
")",
";",
"}"
] | <p>Append to the <code>toString</code> a summary of an
<code>int</code> array.</p>
@param buffer the <code>StringBuilder</code> to populate
@param fieldName the field name, typically not used as already appended
@param array the array to add to the <code>toString</code>,
not <code>null</code> | [
"<p",
">",
"Append",
"to",
"the",
"<code",
">",
"toString<",
"/",
"code",
">",
"a",
"summary",
"of",
"an",
"<code",
">",
"int<",
"/",
"code",
">",
"array",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/toString/ToStringStyle.java#L1070-L1072 |
geomajas/geomajas-project-server | plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java | PdfContext.strokeEllipse | public void strokeEllipse(Rectangle rect, Color color, float linewidth) {
template.saveState();
setStroke(color, linewidth, null);
template.ellipse(origX + rect.getLeft(), origY + rect.getBottom(), origX + rect.getRight(),
origY + rect.getTop());
template.stroke();
template.restoreState();
} | java | public void strokeEllipse(Rectangle rect, Color color, float linewidth) {
template.saveState();
setStroke(color, linewidth, null);
template.ellipse(origX + rect.getLeft(), origY + rect.getBottom(), origX + rect.getRight(),
origY + rect.getTop());
template.stroke();
template.restoreState();
} | [
"public",
"void",
"strokeEllipse",
"(",
"Rectangle",
"rect",
",",
"Color",
"color",
",",
"float",
"linewidth",
")",
"{",
"template",
".",
"saveState",
"(",
")",
";",
"setStroke",
"(",
"color",
",",
"linewidth",
",",
"null",
")",
";",
"template",
".",
"el... | Draw an elliptical exterior with this color.
@param rect rectangle in which ellipse should fit
@param color colour to use for stroking
@param linewidth line width | [
"Draw",
"an",
"elliptical",
"exterior",
"with",
"this",
"color",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java#L271-L278 |
graknlabs/grakn | server/src/server/kb/concept/ElementFactory.java | ElementFactory.buildVertexElement | public VertexElement buildVertexElement(Vertex vertex) {
if (!tx.isValidElement(vertex)) {
Objects.requireNonNull(vertex);
throw TransactionException.invalidElement(vertex);
}
return new VertexElement(tx, vertex);
} | java | public VertexElement buildVertexElement(Vertex vertex) {
if (!tx.isValidElement(vertex)) {
Objects.requireNonNull(vertex);
throw TransactionException.invalidElement(vertex);
}
return new VertexElement(tx, vertex);
} | [
"public",
"VertexElement",
"buildVertexElement",
"(",
"Vertex",
"vertex",
")",
"{",
"if",
"(",
"!",
"tx",
".",
"isValidElement",
"(",
"vertex",
")",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"vertex",
")",
";",
"throw",
"TransactionException",
".",
"i... | Builds a VertexElement from an already existing Vertex.
*
@throws TransactionException if vertex is not valid. A vertex is not valid if it is null or has been deleted
@param vertex A vertex which can possibly be turned into a VertexElement
@return A VertexElement of | [
"Builds",
"a",
"VertexElement",
"from",
"an",
"already",
"existing",
"Vertex",
".",
"*"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L295-L301 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | LegacyBehavior.isCompensationThrowing | public static boolean isCompensationThrowing(PvmExecutionImpl execution, Map<ScopeImpl, PvmExecutionImpl> activityExecutionMapping) {
if (CompensationBehavior.isCompensationThrowing(execution)) {
ScopeImpl compensationThrowingActivity = execution.getActivity();
if (compensationThrowingActivity.isScope()) {
return activityExecutionMapping.get(compensationThrowingActivity) ==
activityExecutionMapping.get(compensationThrowingActivity.getFlowScope());
}
else {
// for transaction sub processes with cancel end events, the compensation throwing execution waits in the boundary event, not in the end
// event; cancel boundary events are currently not scope
return compensationThrowingActivity.getActivityBehavior() instanceof CancelBoundaryEventActivityBehavior;
}
}
else {
return false;
}
} | java | public static boolean isCompensationThrowing(PvmExecutionImpl execution, Map<ScopeImpl, PvmExecutionImpl> activityExecutionMapping) {
if (CompensationBehavior.isCompensationThrowing(execution)) {
ScopeImpl compensationThrowingActivity = execution.getActivity();
if (compensationThrowingActivity.isScope()) {
return activityExecutionMapping.get(compensationThrowingActivity) ==
activityExecutionMapping.get(compensationThrowingActivity.getFlowScope());
}
else {
// for transaction sub processes with cancel end events, the compensation throwing execution waits in the boundary event, not in the end
// event; cancel boundary events are currently not scope
return compensationThrowingActivity.getActivityBehavior() instanceof CancelBoundaryEventActivityBehavior;
}
}
else {
return false;
}
} | [
"public",
"static",
"boolean",
"isCompensationThrowing",
"(",
"PvmExecutionImpl",
"execution",
",",
"Map",
"<",
"ScopeImpl",
",",
"PvmExecutionImpl",
">",
"activityExecutionMapping",
")",
"{",
"if",
"(",
"CompensationBehavior",
".",
"isCompensationThrowing",
"(",
"execu... | Returns true if the given execution is in a compensation-throwing activity but there is no dedicated scope execution
in the given mapping. | [
"Returns",
"true",
"if",
"the",
"given",
"execution",
"is",
"in",
"a",
"compensation",
"-",
"throwing",
"activity",
"but",
"there",
"is",
"no",
"dedicated",
"scope",
"execution",
"in",
"the",
"given",
"mapping",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java#L604-L621 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java | AbstractDoclet.generateClassFiles | protected void generateClassFiles(RootDoc root, ClassTree classtree) {
generateClassFiles(classtree);
PackageDoc[] packages = root.specifiedPackages();
for (PackageDoc pkg : packages) {
generateClassFiles(pkg.allClasses(), classtree);
}
} | java | protected void generateClassFiles(RootDoc root, ClassTree classtree) {
generateClassFiles(classtree);
PackageDoc[] packages = root.specifiedPackages();
for (PackageDoc pkg : packages) {
generateClassFiles(pkg.allClasses(), classtree);
}
} | [
"protected",
"void",
"generateClassFiles",
"(",
"RootDoc",
"root",
",",
"ClassTree",
"classtree",
")",
"{",
"generateClassFiles",
"(",
"classtree",
")",
";",
"PackageDoc",
"[",
"]",
"packages",
"=",
"root",
".",
"specifiedPackages",
"(",
")",
";",
"for",
"(",
... | Iterate through all classes and construct documentation for them.
@param root the RootDoc of source to document.
@param classtree the data structure representing the class tree. | [
"Iterate",
"through",
"all",
"classes",
"and",
"construct",
"documentation",
"for",
"them",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java#L190-L196 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java | DwgUtil.getBitShort | public static Vector getBitShort(int[] data, int offset) throws Exception {
Vector v = new Vector();
int type = ((Integer)getBits(data, 2, offset)).intValue();
int read = 2;
int val = 0;
if (type==0x00) {
byte[] bytes = (byte[])getBits(data, 16, (offset+2));
ByteBuffer bb = ByteBuffer.wrap(bytes);
bb.order(ByteOrder.LITTLE_ENDIAN);
val = bb.getShort();
read = 18;
} else if (type==0x01) {
val = ((Integer)getBits(data, 8, (offset+2))).intValue();
read = 10;
} else if (type==0x02) {
val = 0;
} else if (type==0x03) {
val = 256;
}
v.add(new Integer(offset+read));
v.add(new Integer(val));
return v;
} | java | public static Vector getBitShort(int[] data, int offset) throws Exception {
Vector v = new Vector();
int type = ((Integer)getBits(data, 2, offset)).intValue();
int read = 2;
int val = 0;
if (type==0x00) {
byte[] bytes = (byte[])getBits(data, 16, (offset+2));
ByteBuffer bb = ByteBuffer.wrap(bytes);
bb.order(ByteOrder.LITTLE_ENDIAN);
val = bb.getShort();
read = 18;
} else if (type==0x01) {
val = ((Integer)getBits(data, 8, (offset+2))).intValue();
read = 10;
} else if (type==0x02) {
val = 0;
} else if (type==0x03) {
val = 256;
}
v.add(new Integer(offset+read));
v.add(new Integer(val));
return v;
} | [
"public",
"static",
"Vector",
"getBitShort",
"(",
"int",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"throws",
"Exception",
"{",
"Vector",
"v",
"=",
"new",
"Vector",
"(",
")",
";",
"int",
"type",
"=",
"(",
"(",
"Integer",
")",
"getBits",
"(",
"data"... | Read a short value from a group of unsigned bytes
@param data Array of unsigned bytes obtained from the DWG binary file
@param offset The current bit offset where the value begins
@throws Exception If an unexpected bit value is found in the DWG file. Occurs
when we are looking for LwPolylines.
@return Vector This vector has two parts. First is an int value that represents
the new offset, and second is the short value | [
"Read",
"a",
"short",
"value",
"from",
"a",
"group",
"of",
"unsigned",
"bytes"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java#L302-L324 |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/RemoveFromListRepairer.java | RemoveFromListRepairer.repairCommand | public List<RemoveFromList> repairCommand(final RemoveFromList toRepair, final AddToList repairAgainst) {
return repairAddOrReplace(toRepair, repairAgainst.getPosition());
} | java | public List<RemoveFromList> repairCommand(final RemoveFromList toRepair, final AddToList repairAgainst) {
return repairAddOrReplace(toRepair, repairAgainst.getPosition());
} | [
"public",
"List",
"<",
"RemoveFromList",
">",
"repairCommand",
"(",
"final",
"RemoveFromList",
"toRepair",
",",
"final",
"AddToList",
"repairAgainst",
")",
"{",
"return",
"repairAddOrReplace",
"(",
"toRepair",
",",
"repairAgainst",
".",
"getPosition",
"(",
")",
")... | Repairs a {@link RemoveFromList} in relation to an {@link AddToList} command.
@param toRepair
The command to repair.
@param repairAgainst
The command to repair against.
@return The repaired command. | [
"Repairs",
"a",
"{",
"@link",
"RemoveFromList",
"}",
"in",
"relation",
"to",
"an",
"{",
"@link",
"AddToList",
"}",
"command",
"."
] | train | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/RemoveFromListRepairer.java#L56-L58 |
nicoulaj/checksum-maven-plugin | src/main/java/net/nicoulaj/maven/plugins/checksum/mojo/DependenciesCheckMojo.java | DependenciesCheckMojo.readSummaryFile | private Map<String, Map<String, String>> readSummaryFile(File outputFile) throws ExecutionException
{
List<String> algorithms = new ArrayList<String>();
Map<String, Map<String, String>> filesHashcodes = new HashMap<String, Map<String, String>>();
BufferedReader reader = null;
try
{
reader = new BufferedReader(new FileReader(outputFile));
String line;
while ((line = reader.readLine()) != null)
{
// Read the CVS file header
if (isFileHeader(line))
{
readFileHeader(line, algorithms);
}
else
{
// Read the dependencies checksums
readDependenciesChecksums(line, algorithms, filesHashcodes);
}
}
}
catch (IOException e)
{
throw new ExecutionException(e.getMessage());
}
finally
{
IOUtil.close(reader);
}
return filesHashcodes;
} | java | private Map<String, Map<String, String>> readSummaryFile(File outputFile) throws ExecutionException
{
List<String> algorithms = new ArrayList<String>();
Map<String, Map<String, String>> filesHashcodes = new HashMap<String, Map<String, String>>();
BufferedReader reader = null;
try
{
reader = new BufferedReader(new FileReader(outputFile));
String line;
while ((line = reader.readLine()) != null)
{
// Read the CVS file header
if (isFileHeader(line))
{
readFileHeader(line, algorithms);
}
else
{
// Read the dependencies checksums
readDependenciesChecksums(line, algorithms, filesHashcodes);
}
}
}
catch (IOException e)
{
throw new ExecutionException(e.getMessage());
}
finally
{
IOUtil.close(reader);
}
return filesHashcodes;
} | [
"private",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"readSummaryFile",
"(",
"File",
"outputFile",
")",
"throws",
"ExecutionException",
"{",
"List",
"<",
"String",
">",
"algorithms",
"=",
"new",
"ArrayList",
"<",
"String",
"... | Read the summary file
@param outputFile the summary file
@return the summary content (<filename, <algo, checksum>>)
@throws ExecutionException if an error happens while running the execution. | [
"Read",
"the",
"summary",
"file"
] | train | https://github.com/nicoulaj/checksum-maven-plugin/blob/8d8feab8a0a34e24ae41621e7372be6387e1fe55/src/main/java/net/nicoulaj/maven/plugins/checksum/mojo/DependenciesCheckMojo.java#L264-L297 |
BoltsFramework/Bolts-Android | bolts-tasks/src/main/java/bolts/Task.java | Task.onSuccessTask | public <TContinuationResult> Task<TContinuationResult> onSuccessTask(
final Continuation<TResult, Task<TContinuationResult>> continuation, Executor executor,
final CancellationToken ct) {
return continueWithTask(new Continuation<TResult, Task<TContinuationResult>>() {
@Override
public Task<TContinuationResult> then(Task<TResult> task) {
if (ct != null && ct.isCancellationRequested()) {
return Task.cancelled();
}
if (task.isFaulted()) {
return Task.forError(task.getError());
} else if (task.isCancelled()) {
return Task.cancelled();
} else {
return task.continueWithTask(continuation);
}
}
}, executor);
} | java | public <TContinuationResult> Task<TContinuationResult> onSuccessTask(
final Continuation<TResult, Task<TContinuationResult>> continuation, Executor executor,
final CancellationToken ct) {
return continueWithTask(new Continuation<TResult, Task<TContinuationResult>>() {
@Override
public Task<TContinuationResult> then(Task<TResult> task) {
if (ct != null && ct.isCancellationRequested()) {
return Task.cancelled();
}
if (task.isFaulted()) {
return Task.forError(task.getError());
} else if (task.isCancelled()) {
return Task.cancelled();
} else {
return task.continueWithTask(continuation);
}
}
}, executor);
} | [
"public",
"<",
"TContinuationResult",
">",
"Task",
"<",
"TContinuationResult",
">",
"onSuccessTask",
"(",
"final",
"Continuation",
"<",
"TResult",
",",
"Task",
"<",
"TContinuationResult",
">",
">",
"continuation",
",",
"Executor",
"executor",
",",
"final",
"Cancel... | Runs a continuation when a task completes successfully, forwarding along
{@link java.lang.Exception}s or cancellation. | [
"Runs",
"a",
"continuation",
"when",
"a",
"task",
"completes",
"successfully",
"forwarding",
"along",
"{"
] | train | https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-tasks/src/main/java/bolts/Task.java#L800-L819 |
netty/netty | buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | CompositeByteBuf.consolidateIfNeeded | private void consolidateIfNeeded() {
// Consolidate if the number of components will exceed the allowed maximum by the current
// operation.
int size = componentCount;
if (size > maxNumComponents) {
final int capacity = components[size - 1].endOffset;
ByteBuf consolidated = allocBuffer(capacity);
lastAccessed = null;
// We're not using foreach to avoid creating an iterator.
for (int i = 0; i < size; i ++) {
components[i].transferTo(consolidated);
}
components[0] = new Component(consolidated, 0, 0, capacity, consolidated);
removeCompRange(1, size);
}
} | java | private void consolidateIfNeeded() {
// Consolidate if the number of components will exceed the allowed maximum by the current
// operation.
int size = componentCount;
if (size > maxNumComponents) {
final int capacity = components[size - 1].endOffset;
ByteBuf consolidated = allocBuffer(capacity);
lastAccessed = null;
// We're not using foreach to avoid creating an iterator.
for (int i = 0; i < size; i ++) {
components[i].transferTo(consolidated);
}
components[0] = new Component(consolidated, 0, 0, capacity, consolidated);
removeCompRange(1, size);
}
} | [
"private",
"void",
"consolidateIfNeeded",
"(",
")",
"{",
"// Consolidate if the number of components will exceed the allowed maximum by the current",
"// operation.",
"int",
"size",
"=",
"componentCount",
";",
"if",
"(",
"size",
">",
"maxNumComponents",
")",
"{",
"final",
"... | This should only be called as last operation from a method as this may adjust the underlying
array of components and so affect the index etc. | [
"This",
"should",
"only",
"be",
"called",
"as",
"last",
"operation",
"from",
"a",
"method",
"as",
"this",
"may",
"adjust",
"the",
"underlying",
"array",
"of",
"components",
"and",
"so",
"affect",
"the",
"index",
"etc",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L520-L538 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxApiAuthentication.java | BoxApiAuthentication.createOAuth | BoxCreateAuthRequest createOAuth(String code, String clientId, String clientSecret) {
BoxCreateAuthRequest request = new BoxCreateAuthRequest(mSession, getTokenUrl(), code, clientId, clientSecret);
return request;
} | java | BoxCreateAuthRequest createOAuth(String code, String clientId, String clientSecret) {
BoxCreateAuthRequest request = new BoxCreateAuthRequest(mSession, getTokenUrl(), code, clientId, clientSecret);
return request;
} | [
"BoxCreateAuthRequest",
"createOAuth",
"(",
"String",
"code",
",",
"String",
"clientId",
",",
"String",
"clientSecret",
")",
"{",
"BoxCreateAuthRequest",
"request",
"=",
"new",
"BoxCreateAuthRequest",
"(",
"mSession",
",",
"getTokenUrl",
"(",
")",
",",
"code",
","... | Create OAuth, to be called the first time session tries to authenticate. | [
"Create",
"OAuth",
"to",
"be",
"called",
"the",
"first",
"time",
"session",
"tries",
"to",
"authenticate",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxApiAuthentication.java#L58-L61 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/utils/JVMUtils.java | JVMUtils.findField | public static Field findField(Class<?> type, String fieldName ) {
while( type != null ) {
Field[] fields = type.getDeclaredFields();
for( Field field: fields ) {
if( field.getName().equals(fieldName) )
return field;
}
type = type.getSuperclass();
}
return null;
} | java | public static Field findField(Class<?> type, String fieldName ) {
while( type != null ) {
Field[] fields = type.getDeclaredFields();
for( Field field: fields ) {
if( field.getName().equals(fieldName) )
return field;
}
type = type.getSuperclass();
}
return null;
} | [
"public",
"static",
"Field",
"findField",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"fieldName",
")",
"{",
"while",
"(",
"type",
"!=",
"null",
")",
"{",
"Field",
"[",
"]",
"fields",
"=",
"type",
".",
"getDeclaredFields",
"(",
")",
";",
"for... | Find the field with the given name in the class. Will inspect all fields, independent
of access level.
@param type Class in which to search for the given field.
@param fieldName Name of the field for which to search.
@return The field, or null if no such field exists. | [
"Find",
"the",
"field",
"with",
"the",
"given",
"name",
"in",
"the",
"class",
".",
"Will",
"inspect",
"all",
"fields",
"independent",
"of",
"access",
"level",
"."
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/utils/JVMUtils.java#L27-L37 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GpxParserWpt.java | GpxParserWpt.startElement | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
super.startElement(uri, localName, qName, attributes);
if (localName.equalsIgnoreCase(GPXTags.LINK)) {
getCurrentPoint().setLink(attributes);
}
} | java | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
super.startElement(uri, localName, qName, attributes);
if (localName.equalsIgnoreCase(GPXTags.LINK)) {
getCurrentPoint().setLink(attributes);
}
} | [
"@",
"Override",
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"attributes",
")",
"throws",
"SAXException",
"{",
"super",
".",
"startElement",
"(",
"uri",
",",
"localName",
",",
... | Fires whenever an XML start markup is encountered. It saves informations
about <link> in currentPoint.
@param uri URI of the local element
@param localName Name of the local element (without prefix)
@param qName qName of the local element (with prefix)
@param attributes Attributes of the local element (contained in the
markup)
@throws SAXException Any SAX exception, possibly wrapping another
exception | [
"Fires",
"whenever",
"an",
"XML",
"start",
"markup",
"is",
"encountered",
".",
"It",
"saves",
"informations",
"about",
"<link",
">",
"in",
"currentPoint",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GpxParserWpt.java#L58-L64 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.headerFragment | public T headerFragment(Object model, ObjectMapper objectMapper) {
try {
return header(objectMapper.writer().writeValueAsString(model));
} catch (JsonProcessingException e) {
throw new CitrusRuntimeException("Failed to map object graph for message header data", e);
}
} | java | public T headerFragment(Object model, ObjectMapper objectMapper) {
try {
return header(objectMapper.writer().writeValueAsString(model));
} catch (JsonProcessingException e) {
throw new CitrusRuntimeException("Failed to map object graph for message header data", e);
}
} | [
"public",
"T",
"headerFragment",
"(",
"Object",
"model",
",",
"ObjectMapper",
"objectMapper",
")",
"{",
"try",
"{",
"return",
"header",
"(",
"objectMapper",
".",
"writer",
"(",
")",
".",
"writeValueAsString",
"(",
"model",
")",
")",
";",
"}",
"catch",
"(",... | Expect this message header data as model object which is mapped to a character sequence
using the default object to json mapper before validation is performed.
@param model
@param objectMapper
@return | [
"Expect",
"this",
"message",
"header",
"data",
"as",
"model",
"object",
"which",
"is",
"mapped",
"to",
"a",
"character",
"sequence",
"using",
"the",
"default",
"object",
"to",
"json",
"mapper",
"before",
"validation",
"is",
"performed",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L406-L412 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/codec/Base64.java | Base64.decodeToFile | public static File decodeToFile(String base64, File destFile) {
return FileUtil.writeBytes(Base64Decoder.decode(base64), destFile);
} | java | public static File decodeToFile(String base64, File destFile) {
return FileUtil.writeBytes(Base64Decoder.decode(base64), destFile);
} | [
"public",
"static",
"File",
"decodeToFile",
"(",
"String",
"base64",
",",
"File",
"destFile",
")",
"{",
"return",
"FileUtil",
".",
"writeBytes",
"(",
"Base64Decoder",
".",
"decode",
"(",
"base64",
")",
",",
"destFile",
")",
";",
"}"
] | base64解码
@param base64 被解码的base64字符串
@param destFile 目标文件
@return 目标文件
@since 4.0.9 | [
"base64解码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Base64.java#L289-L291 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java | ServerBlobAuditingPoliciesInner.beginCreateOrUpdateAsync | public Observable<ServerBlobAuditingPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerBlobAuditingPolicyInner>, ServerBlobAuditingPolicyInner>() {
@Override
public ServerBlobAuditingPolicyInner call(ServiceResponse<ServerBlobAuditingPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<ServerBlobAuditingPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerBlobAuditingPolicyInner>, ServerBlobAuditingPolicyInner>() {
@Override
public ServerBlobAuditingPolicyInner call(ServiceResponse<ServerBlobAuditingPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerBlobAuditingPolicyInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerBlobAuditingPolicyInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
... | Creates or updates a server's blob auditing policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param parameters Properties of blob auditing policy
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerBlobAuditingPolicyInner object | [
"Creates",
"or",
"updates",
"a",
"server",
"s",
"blob",
"auditing",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java#L274-L281 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java | BeanO.buildTempEJBMethodMetaData | private EJBMethodMetaData buildTempEJBMethodMetaData(int dispatchEventCode, BeanMetaData bmd)
{
String methName = "";
String methSig = "";
switch (dispatchEventCode) {
case DispatchEventListener.BEFORE_EJBACTIVATE:
methName = "ejbActivate";
methSig = "ejbActivate:";
break;
case DispatchEventListener.BEFORE_EJBLOAD:
methName = "ejbLoad";
methSig = "ejbLoad:";
break;
case DispatchEventListener.BEFORE_EJBSTORE:
methName = "ejbStore";
methSig = "ejbStore:";
break;
case DispatchEventListener.BEFORE_EJBPASSIVATE:
methName = "ejbPassivate";
methSig = "ejbPassivate:";
break;
default:
Tr.error(tc, "Unsupported dispatchEventCode code passed to buildTempEJBMethodInfo - code = " + dispatchEventCode);
break;
}
EJBMethodInfoImpl methodInfo = bmd.createEJBMethodInfoImpl(bmd.container.getEJBRuntime().getMetaDataSlotSize(MethodMetaData.class));
methodInfo.initializeInstanceData(methSig, methName, bmd, MethodInterface.REMOTE, TransactionAttribute.TX_NOT_SUPPORTED, false);
methodInfo.setMethodDescriptor("");
return methodInfo;
} | java | private EJBMethodMetaData buildTempEJBMethodMetaData(int dispatchEventCode, BeanMetaData bmd)
{
String methName = "";
String methSig = "";
switch (dispatchEventCode) {
case DispatchEventListener.BEFORE_EJBACTIVATE:
methName = "ejbActivate";
methSig = "ejbActivate:";
break;
case DispatchEventListener.BEFORE_EJBLOAD:
methName = "ejbLoad";
methSig = "ejbLoad:";
break;
case DispatchEventListener.BEFORE_EJBSTORE:
methName = "ejbStore";
methSig = "ejbStore:";
break;
case DispatchEventListener.BEFORE_EJBPASSIVATE:
methName = "ejbPassivate";
methSig = "ejbPassivate:";
break;
default:
Tr.error(tc, "Unsupported dispatchEventCode code passed to buildTempEJBMethodInfo - code = " + dispatchEventCode);
break;
}
EJBMethodInfoImpl methodInfo = bmd.createEJBMethodInfoImpl(bmd.container.getEJBRuntime().getMetaDataSlotSize(MethodMetaData.class));
methodInfo.initializeInstanceData(methSig, methName, bmd, MethodInterface.REMOTE, TransactionAttribute.TX_NOT_SUPPORTED, false);
methodInfo.setMethodDescriptor("");
return methodInfo;
} | [
"private",
"EJBMethodMetaData",
"buildTempEJBMethodMetaData",
"(",
"int",
"dispatchEventCode",
",",
"BeanMetaData",
"bmd",
")",
"{",
"String",
"methName",
"=",
"\"\"",
";",
"String",
"methSig",
"=",
"\"\"",
";",
"switch",
"(",
"dispatchEventCode",
")",
"{",
"case"... | Create a temporary EJBMethodMetaData object. This method is used by the callDispatchEventListeners method to
create a 'fake' EJBMethodMetaData object to report framework methods (activate/load/store/passivate) to the
DispatchEventListeners. | [
"Create",
"a",
"temporary",
"EJBMethodMetaData",
"object",
".",
"This",
"method",
"is",
"used",
"by",
"the",
"callDispatchEventListeners",
"method",
"to",
"create",
"a",
"fake",
"EJBMethodMetaData",
"object",
"to",
"report",
"framework",
"methods",
"(",
"activate",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanO.java#L1966-L1996 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.init | public Ftp init(String host, int port, String user, String password) {
return this.init(host,port,user,password,null);
} | java | public Ftp init(String host, int port, String user, String password) {
return this.init(host,port,user,password,null);
} | [
"public",
"Ftp",
"init",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"user",
",",
"String",
"password",
")",
"{",
"return",
"this",
".",
"init",
"(",
"host",
",",
"port",
",",
"user",
",",
"password",
",",
"null",
")",
";",
"}"
] | 初始化连接
@param host 域名或IP
@param port 端口
@param user 用户名
@param password 密码
@return this | [
"初始化连接"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L118-L120 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java | PackageManagerUtils.getVersionName | public static String getVersionName(Context context) {
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
return info.versionName;
} catch (NameNotFoundException e) {
throw new IllegalStateException("no such package installed on the device: ", e);
}
} | java | public static String getVersionName(Context context) {
try {
PackageManager manager = context.getPackageManager();
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
return info.versionName;
} catch (NameNotFoundException e) {
throw new IllegalStateException("no such package installed on the device: ", e);
}
} | [
"public",
"static",
"String",
"getVersionName",
"(",
"Context",
"context",
")",
"{",
"try",
"{",
"PackageManager",
"manager",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"PackageInfo",
"info",
"=",
"manager",
".",
"getPackageInfo",
"(",
"context",
... | Read version name from the manifest of the context.
@param context the context.
@return the version name.
@throws java.lang.IllegalStateException if the target package is not installed. | [
"Read",
"version",
"name",
"from",
"the",
"manifest",
"of",
"the",
"context",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L71-L79 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.handleFailover | public HandleErrorResult handleFailover(SQLException qe, Method method, Object[] args,
Protocol protocol) throws Throwable {
if (isExplicitClosed()) {
throw new SQLException("Connection has been closed !");
}
if (setMasterHostFail()) {
logger.warn(
"SQL Primary node [{}, conn={}, local_port={}, timeout={}] connection fail. Reason : {}",
this.currentProtocol.getHostAddress().toString(),
this.currentProtocol.getServerThreadId(),
this.currentProtocol.getSocket().getLocalPort(),
this.currentProtocol.getTimeout(),
qe.getMessage());
addToBlacklist(currentProtocol.getHostAddress());
}
//check that failover is due to kill command
boolean killCmd = qe != null
&& qe.getSQLState() != null
&& qe.getSQLState().equals("70100")
&& 1927 == qe.getErrorCode();
return primaryFail(method, args, killCmd);
} | java | public HandleErrorResult handleFailover(SQLException qe, Method method, Object[] args,
Protocol protocol) throws Throwable {
if (isExplicitClosed()) {
throw new SQLException("Connection has been closed !");
}
if (setMasterHostFail()) {
logger.warn(
"SQL Primary node [{}, conn={}, local_port={}, timeout={}] connection fail. Reason : {}",
this.currentProtocol.getHostAddress().toString(),
this.currentProtocol.getServerThreadId(),
this.currentProtocol.getSocket().getLocalPort(),
this.currentProtocol.getTimeout(),
qe.getMessage());
addToBlacklist(currentProtocol.getHostAddress());
}
//check that failover is due to kill command
boolean killCmd = qe != null
&& qe.getSQLState() != null
&& qe.getSQLState().equals("70100")
&& 1927 == qe.getErrorCode();
return primaryFail(method, args, killCmd);
} | [
"public",
"HandleErrorResult",
"handleFailover",
"(",
"SQLException",
"qe",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
",",
"Protocol",
"protocol",
")",
"throws",
"Throwable",
"{",
"if",
"(",
"isExplicitClosed",
"(",
")",
")",
"{",
"throw",
"n... | Call when a failover is detected on master connection. Will : <ol>
<li> set fail variable</li>
<li> try to reconnect</li>
<li> relaunch query if possible</li>
</ol>
@param method called method
@param args methods parameters
@param protocol current protocol
@return a HandleErrorResult object to indicate if query has been relaunched, and the exception
if not
@throws Throwable when method and parameters does not exist. | [
"Call",
"when",
"a",
"failover",
"is",
"detected",
"on",
"master",
"connection",
".",
"Will",
":",
"<ol",
">",
"<li",
">",
"set",
"fail",
"variable<",
"/",
"li",
">",
"<li",
">",
"try",
"to",
"reconnect<",
"/",
"li",
">",
"<li",
">",
"relaunch",
"que... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L181-L204 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java | MithraManager.executeTransactionalCommandInSeparateThread | public <R> R executeTransactionalCommandInSeparateThread(final TransactionalCommand<R> command, final TransactionStyle txStyle)
throws MithraBusinessException
{
final Object[] result = new Object[1];
ExceptionHandlingTask runnable = new ExceptionHandlingTask()
{
@Override
public void execute()
{
result[0] = executeTransactionalCommand(command, txStyle);
}
};
ExceptionCatchingThread.executeTask(runnable);
return (R) result[0];
} | java | public <R> R executeTransactionalCommandInSeparateThread(final TransactionalCommand<R> command, final TransactionStyle txStyle)
throws MithraBusinessException
{
final Object[] result = new Object[1];
ExceptionHandlingTask runnable = new ExceptionHandlingTask()
{
@Override
public void execute()
{
result[0] = executeTransactionalCommand(command, txStyle);
}
};
ExceptionCatchingThread.executeTask(runnable);
return (R) result[0];
} | [
"public",
"<",
"R",
">",
"R",
"executeTransactionalCommandInSeparateThread",
"(",
"final",
"TransactionalCommand",
"<",
"R",
">",
"command",
",",
"final",
"TransactionStyle",
"txStyle",
")",
"throws",
"MithraBusinessException",
"{",
"final",
"Object",
"[",
"]",
"res... | Use this method very carefully. It can easily lead to a deadlock.
executes the transactional command in a separate thread with a custom number of retries. Using a separate thread
creates a brand new transactional context and therefore this transaction will not join
the context of any outer transactions. For example, if the outer transaction rolls back, this command will not.
Calling this method will lead to deadlock if the outer transaction has locked any object that will be accessed
in this transaction. It can also lead to deadlock if the same table is accessed in the outer transaction as
this command. It can also lead to a deadlock if the connection pool is tied up in the outer transaction
and has nothing left for this command.
@param command an implementation of TransactionalCommand
@param txStyle the options for this transaction (retries, timeout, etc).
@return whatever the transaction command's execute method returned.
@throws MithraBusinessException if something goes wrong. the transaction will be fully rolled back in this case. | [
"Use",
"this",
"method",
"very",
"carefully",
".",
"It",
"can",
"easily",
"lead",
"to",
"a",
"deadlock",
".",
"executes",
"the",
"transactional",
"command",
"in",
"a",
"separate",
"thread",
"with",
"a",
"custom",
"number",
"of",
"retries",
".",
"Using",
"a... | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java#L490-L504 |
knowm/XChange | xchange-core/src/main/java/org/knowm/xchange/currency/Currency.java | Currency.createCurrency | private static Currency createCurrency(
String commonCode, String name, String unicode, String... alternativeCodes) {
CurrencyAttributes attributes =
new CurrencyAttributes(commonCode, name, unicode, alternativeCodes);
Currency currency = new Currency(commonCode, attributes);
for (String code : attributes.codes) {
if (commonCode.equals(code)) {
// common code will always be part of the currencies map
currencies.put(code, currency);
} else if (!currencies.containsKey(code)) {
// alternative codes will never overwrite common codes
currencies.put(code, new Currency(code, attributes));
}
}
return currency;
} | java | private static Currency createCurrency(
String commonCode, String name, String unicode, String... alternativeCodes) {
CurrencyAttributes attributes =
new CurrencyAttributes(commonCode, name, unicode, alternativeCodes);
Currency currency = new Currency(commonCode, attributes);
for (String code : attributes.codes) {
if (commonCode.equals(code)) {
// common code will always be part of the currencies map
currencies.put(code, currency);
} else if (!currencies.containsKey(code)) {
// alternative codes will never overwrite common codes
currencies.put(code, new Currency(code, attributes));
}
}
return currency;
} | [
"private",
"static",
"Currency",
"createCurrency",
"(",
"String",
"commonCode",
",",
"String",
"name",
",",
"String",
"unicode",
",",
"String",
"...",
"alternativeCodes",
")",
"{",
"CurrencyAttributes",
"attributes",
"=",
"new",
"CurrencyAttributes",
"(",
"commonCod... | Factory
@param commonCode commonly used code for this currency: "BTC"
@param name Name of the currency: "Bitcoin"
@param unicode Unicode symbol for the currency: "\u20BF" or "฿"
@param alternativeCodes Alternative codes for the currency: "XBT" | [
"Factory"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/currency/Currency.java#L355-L377 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/Step.java | Step.checkTextSelectedInList | protected boolean checkTextSelectedInList(PageElement pageElement, String text) throws FailureException {
try {
final WebElement select = Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(pageElement)));
final Select dropDown = new Select(select);
return text.equalsIgnoreCase(dropDown.getFirstSelectedOption().getText());
} catch (final Exception e) {
new Result.Failure<>(text, Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, pageElement.getPage().getCallBack());
return false;
}
} | java | protected boolean checkTextSelectedInList(PageElement pageElement, String text) throws FailureException {
try {
final WebElement select = Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(pageElement)));
final Select dropDown = new Select(select);
return text.equalsIgnoreCase(dropDown.getFirstSelectedOption().getText());
} catch (final Exception e) {
new Result.Failure<>(text, Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, pageElement.getPage().getCallBack());
return false;
}
} | [
"protected",
"boolean",
"checkTextSelectedInList",
"(",
"PageElement",
"pageElement",
",",
"String",
"text",
")",
"throws",
"FailureException",
"{",
"try",
"{",
"final",
"WebElement",
"select",
"=",
"Context",
".",
"waitUntil",
"(",
"ExpectedConditions",
".",
"eleme... | Check text selected in list (html select option).
@param pageElement
Is target element
@param text
is text searched
@return true or false
@throws FailureException
if the scenario encounters a functional error | [
"Check",
"text",
"selected",
"in",
"list",
"(",
"html",
"select",
"option",
")",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L478-L487 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.sub | public static <T> List<T> sub(Collection<T> collection, int start, int end) {
return sub(collection, start, end, 1);
} | java | public static <T> List<T> sub(Collection<T> collection, int start, int end) {
return sub(collection, start, end, 1);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"sub",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"sub",
"(",
"collection",
",",
"start",
",",
"end",
",",
"1",
")",
";",
... | 截取集合的部分
@param <T> 集合元素类型
@param collection 被截取的数组
@param start 开始位置(包含)
@param end 结束位置(不包含)
@return 截取后的数组,当开始位置超过最大时,返回null | [
"截取集合的部分"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L876-L878 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java | StyleUtil.createSymbolizer | public static SymbolizerTypeInfo createSymbolizer(LayerType type, FeatureStyleInfo featureStyle) {
SymbolInfo symbol = featureStyle.getSymbol();
SymbolizerTypeInfo symbolizer = null;
StrokeInfo stroke = createStroke(featureStyle.getStrokeColor(), featureStyle.getStrokeWidth(),
featureStyle.getStrokeOpacity(), featureStyle.getDashArray());
FillInfo fill = createFill(featureStyle.getFillColor(), featureStyle.getFillOpacity());
switch (type) {
case GEOMETRY:
break;
case LINESTRING:
case MULTILINESTRING:
symbolizer = createLineSymbolizer(stroke);
break;
case MULTIPOINT:
case POINT:
GraphicInfo graphic;
if (symbol.getCircle() != null) {
MarkInfo circle = createMark(WKN_CIRCLE, fill, stroke);
graphic = createGraphic(circle, (int) (2 * symbol.getCircle().getR()));
} else if (symbol.getRect() != null) {
MarkInfo rect = createMark(WKN_RECT, fill, stroke);
graphic = createGraphic(rect, (int) symbol.getRect().getH());
} else {
ExternalGraphicInfo image = createExternalGraphic(symbol.getImage().getHref());
graphic = createGraphic(image, symbol.getImage().getHeight());
}
symbolizer = createPointSymbolizer(graphic);
break;
case POLYGON:
case MULTIPOLYGON:
symbolizer = createPolygonSymbolizer(fill, stroke);
break;
default:
throw new IllegalStateException("Unknown layer type " + type);
}
return symbolizer;
} | java | public static SymbolizerTypeInfo createSymbolizer(LayerType type, FeatureStyleInfo featureStyle) {
SymbolInfo symbol = featureStyle.getSymbol();
SymbolizerTypeInfo symbolizer = null;
StrokeInfo stroke = createStroke(featureStyle.getStrokeColor(), featureStyle.getStrokeWidth(),
featureStyle.getStrokeOpacity(), featureStyle.getDashArray());
FillInfo fill = createFill(featureStyle.getFillColor(), featureStyle.getFillOpacity());
switch (type) {
case GEOMETRY:
break;
case LINESTRING:
case MULTILINESTRING:
symbolizer = createLineSymbolizer(stroke);
break;
case MULTIPOINT:
case POINT:
GraphicInfo graphic;
if (symbol.getCircle() != null) {
MarkInfo circle = createMark(WKN_CIRCLE, fill, stroke);
graphic = createGraphic(circle, (int) (2 * symbol.getCircle().getR()));
} else if (symbol.getRect() != null) {
MarkInfo rect = createMark(WKN_RECT, fill, stroke);
graphic = createGraphic(rect, (int) symbol.getRect().getH());
} else {
ExternalGraphicInfo image = createExternalGraphic(symbol.getImage().getHref());
graphic = createGraphic(image, symbol.getImage().getHeight());
}
symbolizer = createPointSymbolizer(graphic);
break;
case POLYGON:
case MULTIPOLYGON:
symbolizer = createPolygonSymbolizer(fill, stroke);
break;
default:
throw new IllegalStateException("Unknown layer type " + type);
}
return symbolizer;
} | [
"public",
"static",
"SymbolizerTypeInfo",
"createSymbolizer",
"(",
"LayerType",
"type",
",",
"FeatureStyleInfo",
"featureStyle",
")",
"{",
"SymbolInfo",
"symbol",
"=",
"featureStyle",
".",
"getSymbol",
"(",
")",
";",
"SymbolizerTypeInfo",
"symbolizer",
"=",
"null",
... | Create a symbolizer from a feature style.
@param type the layer type
@param featureStyle the style
@return the symbolizer | [
"Create",
"a",
"symbolizer",
"from",
"a",
"feature",
"style",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L88-L124 |
Waikato/moa | moa/src/main/java/moa/streams/generators/multilabel/MetaMultilabelGenerator.java | MetaMultilabelGenerator.getTopCombinations | private HashSet[] getTopCombinations(int n) {
final HashMap<HashSet, Integer> count = new HashMap<HashSet, Integer>();
HashMap<HashSet, Integer> isets = new HashMap<HashSet, Integer>();
int N = 100000;
double lc = 0.0;
for (int i = 0; i < N; i++) {
HashSet Y = generateSet();
lc += Y.size();
count.put(Y, count.get(Y) != null ? count.get(Y) + 1 : 1);
}
lc = lc / N;
// @TODO could generate closed frequent itemsets from 'count'
List<HashSet> top_set = new ArrayList<HashSet>(count.keySet());
// Sort the sets by their count
Collections.sort(top_set, new Comparator<HashSet>() {
@Override
public int compare(HashSet Y1, HashSet Y2) {
return count.get(Y2).compareTo(count.get(Y1));
}
});
System.err.println("The most common labelsets (from which we will build the map) will likely be: ");
HashSet map_set[] = new HashSet[n];
double weights[] = new double[n];
int idx = 0;
for (HashSet Y : top_set) {
System.err.println(" " + Y + " : " + (count.get(Y) * 100.0 / N) + "%");
weights[idx++] = count.get(Y);
if (idx == weights.length) {
break;
}
}
double sum = Utils.sum(weights);
System.err.println("Estimated Label Cardinality: " + lc + "\n\n");
System.err.println("Estimated % Unique Labelsets: " + (count.size() * 100.0 / N) + "%\n\n");
// normalize weights[]
Utils.normalize(weights);
// add sets to the map set, according to their weights
for (int i = 0, k = 0; i < top_set.size() && k < map_set.length; i++) { // i'th combination (pre)
int num = (int) Math.round(Math.max(weights[i] * map_set.length, 1.0)); // i'th weight
for (int j = 0; j < num && k < map_set.length; j++) {
map_set[k++] = top_set.get(i);
}
}
// shuffle
Collections.shuffle(Arrays.asList(map_set));
// return
return map_set;
} | java | private HashSet[] getTopCombinations(int n) {
final HashMap<HashSet, Integer> count = new HashMap<HashSet, Integer>();
HashMap<HashSet, Integer> isets = new HashMap<HashSet, Integer>();
int N = 100000;
double lc = 0.0;
for (int i = 0; i < N; i++) {
HashSet Y = generateSet();
lc += Y.size();
count.put(Y, count.get(Y) != null ? count.get(Y) + 1 : 1);
}
lc = lc / N;
// @TODO could generate closed frequent itemsets from 'count'
List<HashSet> top_set = new ArrayList<HashSet>(count.keySet());
// Sort the sets by their count
Collections.sort(top_set, new Comparator<HashSet>() {
@Override
public int compare(HashSet Y1, HashSet Y2) {
return count.get(Y2).compareTo(count.get(Y1));
}
});
System.err.println("The most common labelsets (from which we will build the map) will likely be: ");
HashSet map_set[] = new HashSet[n];
double weights[] = new double[n];
int idx = 0;
for (HashSet Y : top_set) {
System.err.println(" " + Y + " : " + (count.get(Y) * 100.0 / N) + "%");
weights[idx++] = count.get(Y);
if (idx == weights.length) {
break;
}
}
double sum = Utils.sum(weights);
System.err.println("Estimated Label Cardinality: " + lc + "\n\n");
System.err.println("Estimated % Unique Labelsets: " + (count.size() * 100.0 / N) + "%\n\n");
// normalize weights[]
Utils.normalize(weights);
// add sets to the map set, according to their weights
for (int i = 0, k = 0; i < top_set.size() && k < map_set.length; i++) { // i'th combination (pre)
int num = (int) Math.round(Math.max(weights[i] * map_set.length, 1.0)); // i'th weight
for (int j = 0; j < num && k < map_set.length; j++) {
map_set[k++] = top_set.get(i);
}
}
// shuffle
Collections.shuffle(Arrays.asList(map_set));
// return
return map_set;
} | [
"private",
"HashSet",
"[",
"]",
"getTopCombinations",
"(",
"int",
"n",
")",
"{",
"final",
"HashMap",
"<",
"HashSet",
",",
"Integer",
">",
"count",
"=",
"new",
"HashMap",
"<",
"HashSet",
",",
"Integer",
">",
"(",
")",
";",
"HashMap",
"<",
"HashSet",
","... | GetTopCombinations. Calculating the full joint probability distribution
is too complex. - sample from the approximate joint many times - record
the the n most commonly ocurring Y and their frequencies - create a map
based on these frequencies
@param n the number of labelsets
@return n labelsts | [
"GetTopCombinations",
".",
"Calculating",
"the",
"full",
"joint",
"probability",
"distribution",
"is",
"too",
"complex",
".",
"-",
"sample",
"from",
"the",
"approximate",
"joint",
"many",
"times",
"-",
"record",
"the",
"the",
"n",
"most",
"commonly",
"ocurring",... | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/streams/generators/multilabel/MetaMultilabelGenerator.java#L420-L478 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.