repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
xebialabs/overcast | src/main/java/com/xebialabs/overcast/support/libvirt/Metadata.java | Metadata.fromXml | public static Metadata fromXml(Document domainXml) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(XML_DATE_FORMAT);
Element metadata = getMetadataElement(domainXml);
if (metadata == null) {
return null;
}
Namespace ns = Namespace.getNamespace(METADATA_NS_V1);
Element ocMetadata = metadata.getChild(OVERCAST_METADATA, ns);
if (ocMetadata == null) {
return null;
}
String parentDomain = getElementText(ocMetadata, PARENT_DOMAIN, ns);
String creationTime = getElementText(ocMetadata, CREATION_TIME, ns);
Date date = sdf.parse(creationTime);
if(ocMetadata.getChild(PROVISIONED_WITH, ns) != null) {
String provisionedWith = getElementText(ocMetadata, PROVISIONED_WITH, ns);
String checkSum = getElementText(ocMetadata, PROVISIONED_CHECKSUM, ns);
return new Metadata(parentDomain, provisionedWith, checkSum, date);
}
return new Metadata(parentDomain, date);
} catch (ParseException e) {
throw new IllegalArgumentException("Invalid date in metadata on domain", e);
}
} | java | public static Metadata fromXml(Document domainXml) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(XML_DATE_FORMAT);
Element metadata = getMetadataElement(domainXml);
if (metadata == null) {
return null;
}
Namespace ns = Namespace.getNamespace(METADATA_NS_V1);
Element ocMetadata = metadata.getChild(OVERCAST_METADATA, ns);
if (ocMetadata == null) {
return null;
}
String parentDomain = getElementText(ocMetadata, PARENT_DOMAIN, ns);
String creationTime = getElementText(ocMetadata, CREATION_TIME, ns);
Date date = sdf.parse(creationTime);
if(ocMetadata.getChild(PROVISIONED_WITH, ns) != null) {
String provisionedWith = getElementText(ocMetadata, PROVISIONED_WITH, ns);
String checkSum = getElementText(ocMetadata, PROVISIONED_CHECKSUM, ns);
return new Metadata(parentDomain, provisionedWith, checkSum, date);
}
return new Metadata(parentDomain, date);
} catch (ParseException e) {
throw new IllegalArgumentException("Invalid date in metadata on domain", e);
}
} | [
"public",
"static",
"Metadata",
"fromXml",
"(",
"Document",
"domainXml",
")",
"{",
"try",
"{",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"XML_DATE_FORMAT",
")",
";",
"Element",
"metadata",
"=",
"getMetadataElement",
"(",
"domainXml",
")",
"... | Extract {@link Metadata} from the domain XML. Throws {@link IllegalArgumentException} if the metadata is
malformed.
@return the metadata or <code>null</code> if there's no metadata | [
"Extract",
"{",
"@link",
"Metadata",
"}",
"from",
"the",
"domain",
"XML",
".",
"Throws",
"{",
"@link",
"IllegalArgumentException",
"}",
"if",
"the",
"metadata",
"is",
"malformed",
"."
] | train | https://github.com/xebialabs/overcast/blob/716e57b66870c9afe51edc3b6045863a34fb0061/src/main/java/com/xebialabs/overcast/support/libvirt/Metadata.java#L116-L142 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsync | public static <T1, T2, T3, T4, T5, T6, T7> Func7<T1, T2, T3, T4, T5, T6, T7, Observable<Void>> toAsync(Action7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7> action) {
return toAsync(action, Schedulers.computation());
} | java | public static <T1, T2, T3, T4, T5, T6, T7> Func7<T1, T2, T3, T4, T5, T6, T7, Observable<Void>> toAsync(Action7<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7> action) {
return toAsync(action, Schedulers.computation());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
">",
"Func7",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"Observable",
"<",
"Void",
">",
">",
"toAsync",... | Convert a synchronous action call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.an.png" alt="">
@param <T1> the first parameter type
@param <T2> the second parameter type
@param <T3> the third parameter type
@param <T4> the fourth parameter type
@param <T5> the fifth parameter type
@param <T6> the sixth parameter type
@param <T7> the seventh parameter type
@param action the action to convert
@return a function that returns an Observable that executes the {@code action} and emits {@code null}
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh211812.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"action",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L524-L526 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsUserDriver.java | CmsUserDriver.createRoleQuery | protected String createRoleQuery(String mainQuery, boolean includeSubOus, boolean readRoles) {
String sqlQuery = m_sqlManager.readQuery(mainQuery);
sqlQuery += " ";
if (includeSubOus) {
sqlQuery += m_sqlManager.readQuery("C_GROUPS_GROUP_OU_LIKE_1");
} else {
sqlQuery += m_sqlManager.readQuery("C_GROUPS_GROUP_OU_EQUALS_1");
}
sqlQuery += AND_CONDITION;
if (readRoles) {
sqlQuery += m_sqlManager.readQuery("C_GROUPS_SELECT_ROLES_1");
} else {
sqlQuery += m_sqlManager.readQuery("C_GROUPS_SELECT_GROUPS_1");
}
sqlQuery += " ";
sqlQuery += m_sqlManager.readQuery("C_GROUPS_ORDER_0");
return sqlQuery;
} | java | protected String createRoleQuery(String mainQuery, boolean includeSubOus, boolean readRoles) {
String sqlQuery = m_sqlManager.readQuery(mainQuery);
sqlQuery += " ";
if (includeSubOus) {
sqlQuery += m_sqlManager.readQuery("C_GROUPS_GROUP_OU_LIKE_1");
} else {
sqlQuery += m_sqlManager.readQuery("C_GROUPS_GROUP_OU_EQUALS_1");
}
sqlQuery += AND_CONDITION;
if (readRoles) {
sqlQuery += m_sqlManager.readQuery("C_GROUPS_SELECT_ROLES_1");
} else {
sqlQuery += m_sqlManager.readQuery("C_GROUPS_SELECT_GROUPS_1");
}
sqlQuery += " ";
sqlQuery += m_sqlManager.readQuery("C_GROUPS_ORDER_0");
return sqlQuery;
} | [
"protected",
"String",
"createRoleQuery",
"(",
"String",
"mainQuery",
",",
"boolean",
"includeSubOus",
",",
"boolean",
"readRoles",
")",
"{",
"String",
"sqlQuery",
"=",
"m_sqlManager",
".",
"readQuery",
"(",
"mainQuery",
")",
";",
"sqlQuery",
"+=",
"\" \"",
";",... | Returns a sql query to select groups.<p>
@param mainQuery the main select sql query
@param includeSubOus if groups in sub-ous should be included in the selection
@param readRoles if groups or roles whould be selected
@return a sql query to select groups | [
"Returns",
"a",
"sql",
"query",
"to",
"select",
"groups",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserDriver.java#L2111-L2129 |
jbundle/jbundle | thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java | CachedRemoteTable.doMove | public Object doMove(int iRelPosition, int iRecordCount) throws DBException, RemoteException
{
boolean bShouldBeCached = (((m_iOpenMode & Constants.OPEN_CACHE_RECORDS) == Constants.OPEN_CACHE_RECORDS)
|| ((m_iOpenMode & Constants.OPEN_READ_ONLY) == Constants.OPEN_READ_ONLY));
if (!bShouldBeCached)
{ // If it is not read-only or explicit request, don't cache (it is way too hard to reposition the records for an update/remove).
m_objCurrentPhysicalRecord = NONE;
m_objCurrentLockedRecord = NONE;
m_objCurrentCacheRecord = NONE;
return m_tableRemote.doMove(iRelPosition, iRecordCount);
}
else
{ // If it is read-only, use the hash table cache to do a multiple read.
int iCurrentLogicalPosition = m_iCurrentLogicalPosition + iRelPosition;
if (iRelPosition == Constants.FIRST_RECORD)
iCurrentLogicalPosition = 0;
if (iRelPosition == Constants.LAST_RECORD)
{
if (m_iPhysicalLastRecordPlusOne == -1)
iCurrentLogicalPosition = -1;
else
iCurrentLogicalPosition = m_iPhysicalLastRecordPlusOne - 1;
}
return this.cacheGetMove(iRelPosition, iRecordCount, iCurrentLogicalPosition, false);
}
} | java | public Object doMove(int iRelPosition, int iRecordCount) throws DBException, RemoteException
{
boolean bShouldBeCached = (((m_iOpenMode & Constants.OPEN_CACHE_RECORDS) == Constants.OPEN_CACHE_RECORDS)
|| ((m_iOpenMode & Constants.OPEN_READ_ONLY) == Constants.OPEN_READ_ONLY));
if (!bShouldBeCached)
{ // If it is not read-only or explicit request, don't cache (it is way too hard to reposition the records for an update/remove).
m_objCurrentPhysicalRecord = NONE;
m_objCurrentLockedRecord = NONE;
m_objCurrentCacheRecord = NONE;
return m_tableRemote.doMove(iRelPosition, iRecordCount);
}
else
{ // If it is read-only, use the hash table cache to do a multiple read.
int iCurrentLogicalPosition = m_iCurrentLogicalPosition + iRelPosition;
if (iRelPosition == Constants.FIRST_RECORD)
iCurrentLogicalPosition = 0;
if (iRelPosition == Constants.LAST_RECORD)
{
if (m_iPhysicalLastRecordPlusOne == -1)
iCurrentLogicalPosition = -1;
else
iCurrentLogicalPosition = m_iPhysicalLastRecordPlusOne - 1;
}
return this.cacheGetMove(iRelPosition, iRecordCount, iCurrentLogicalPosition, false);
}
} | [
"public",
"Object",
"doMove",
"(",
"int",
"iRelPosition",
",",
"int",
"iRecordCount",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"boolean",
"bShouldBeCached",
"=",
"(",
"(",
"(",
"m_iOpenMode",
"&",
"Constants",
".",
"OPEN_CACHE_RECORDS",
")",
"=... | Move the current position and read the record (optionally read several records).
Note: The cache only kicks in for move(+1).
@param iRelPosition relative Position to read the next record.
@param iRecordCount Records to read.
@return If I read 1 record, this is the record's data.
@return If I read several records, this is a vector of the returned records.
@return If at EOF, or error, returns the error code as a Integer.
@exception Exception File exception. | [
"Move",
"the",
"current",
"position",
"and",
"read",
"the",
"record",
"(",
"optionally",
"read",
"several",
"records",
")",
".",
"Note",
":",
"The",
"cache",
"only",
"kicks",
"in",
"for",
"move",
"(",
"+",
"1",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java#L290-L315 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java | ProxiedFileSystemUtils.createProxiedFileSystemUsingToken | static FileSystem createProxiedFileSystemUsingToken(@NonNull String userNameToProxyAs,
@NonNull Token<?> userNameToken, URI fsURI, Configuration conf) throws IOException, InterruptedException {
UserGroupInformation ugi =
UserGroupInformation.createProxyUser(userNameToProxyAs, UserGroupInformation.getLoginUser());
ugi.addToken(userNameToken);
return ugi.doAs(new ProxiedFileSystem(fsURI, conf));
} | java | static FileSystem createProxiedFileSystemUsingToken(@NonNull String userNameToProxyAs,
@NonNull Token<?> userNameToken, URI fsURI, Configuration conf) throws IOException, InterruptedException {
UserGroupInformation ugi =
UserGroupInformation.createProxyUser(userNameToProxyAs, UserGroupInformation.getLoginUser());
ugi.addToken(userNameToken);
return ugi.doAs(new ProxiedFileSystem(fsURI, conf));
} | [
"static",
"FileSystem",
"createProxiedFileSystemUsingToken",
"(",
"@",
"NonNull",
"String",
"userNameToProxyAs",
",",
"@",
"NonNull",
"Token",
"<",
"?",
">",
"userNameToken",
",",
"URI",
"fsURI",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
",",
"In... | Create a {@link FileSystem} that can perform any operations allowed the by the specified userNameToProxyAs. The
method first proxies as userNameToProxyAs, and then adds the specified {@link Token} to the given
{@link UserGroupInformation} object. It then uses the {@link UserGroupInformation#doAs(PrivilegedExceptionAction)}
method to create a {@link FileSystem}.
@param userNameToProxyAs The name of the user the super user should proxy as
@param userNameToken The {@link Token} to add to the proxied user's {@link UserGroupInformation}.
@param fsURI The {@link URI} for the {@link FileSystem} that should be created
@param conf The {@link Configuration} for the {@link FileSystem} that should be created
@return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs | [
"Create",
"a",
"{",
"@link",
"FileSystem",
"}",
"that",
"can",
"perform",
"any",
"operations",
"allowed",
"the",
"by",
"the",
"specified",
"userNameToProxyAs",
".",
"The",
"method",
"first",
"proxies",
"as",
"userNameToProxyAs",
"and",
"then",
"adds",
"the",
"... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java#L177-L183 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferUtil.java | BufferUtil.unsignedBinarySearch | public static int unsignedBinarySearch(final ByteBuffer array, int position,
final int begin, final int end, final short k) {
return branchyUnsignedBinarySearch(array, position, begin, end, k);
} | java | public static int unsignedBinarySearch(final ByteBuffer array, int position,
final int begin, final int end, final short k) {
return branchyUnsignedBinarySearch(array, position, begin, end, k);
} | [
"public",
"static",
"int",
"unsignedBinarySearch",
"(",
"final",
"ByteBuffer",
"array",
",",
"int",
"position",
",",
"final",
"int",
"begin",
",",
"final",
"int",
"end",
",",
"final",
"short",
"k",
")",
"{",
"return",
"branchyUnsignedBinarySearch",
"(",
"array... | Look for value k in buffer in the range [begin,end). If the value is found, return its index.
If not, return -(i+1) where i is the index where the value would be inserted. The buffer is
assumed to contain sorted values where shorts are interpreted as unsigned integers.
@param array buffer where we search
@param position starting position of the container in the ByteBuffer
@param begin first index (inclusive)
@param end last index (exclusive)
@param k value we search for
@return count | [
"Look",
"for",
"value",
"k",
"in",
"buffer",
"in",
"the",
"range",
"[",
"begin",
"end",
")",
".",
"If",
"the",
"value",
"is",
"found",
"return",
"its",
"index",
".",
"If",
"not",
"return",
"-",
"(",
"i",
"+",
"1",
")",
"where",
"i",
"is",
"the",
... | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferUtil.java#L635-L638 |
febit/wit | wit-core/src/main/java/org/febit/wit/Engine.java | Engine.getTemplate | public Template getTemplate(final String parentName, final String name) throws ResourceNotFoundException {
return getTemplate(this.loader.concat(parentName, name));
} | java | public Template getTemplate(final String parentName, final String name) throws ResourceNotFoundException {
return getTemplate(this.loader.concat(parentName, name));
} | [
"public",
"Template",
"getTemplate",
"(",
"final",
"String",
"parentName",
",",
"final",
"String",
"name",
")",
"throws",
"ResourceNotFoundException",
"{",
"return",
"getTemplate",
"(",
"this",
".",
"loader",
".",
"concat",
"(",
"parentName",
",",
"name",
")",
... | get template by parent template's name and it's relative name.
@param parentName parent template's name
@param name template's relative name
@return Template
@throws ResourceNotFoundException if resource not found | [
"get",
"template",
"by",
"parent",
"template",
"s",
"name",
"and",
"it",
"s",
"relative",
"name",
"."
] | train | https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit/Engine.java#L66-L68 |
infinispan/infinispan | core/src/main/java/org/infinispan/metadata/Metadatas.java | Metadatas.applyVersion | public static Metadata applyVersion(Metadata source, Metadata target) {
if (target.version() == null && source.version() != null)
return target.builder().version(source.version()).build();
return target;
} | java | public static Metadata applyVersion(Metadata source, Metadata target) {
if (target.version() == null && source.version() != null)
return target.builder().version(source.version()).build();
return target;
} | [
"public",
"static",
"Metadata",
"applyVersion",
"(",
"Metadata",
"source",
",",
"Metadata",
"target",
")",
"{",
"if",
"(",
"target",
".",
"version",
"(",
")",
"==",
"null",
"&&",
"source",
".",
"version",
"(",
")",
"!=",
"null",
")",
"return",
"target",
... | Applies version in source metadata to target metadata, if no version
in target metadata. This method can be useful in scenarios where source
version information must be kept around, i.e. write skew, or when
reading metadata from cache store.
@param source Metadata object which is source, whose version might be
is of interest for the target metadata
@param target Metadata object on which version might be applied
@return either, the target Metadata instance as it was when it was
called, or a brand new target Metadata instance with version from source
metadata applied. | [
"Applies",
"version",
"in",
"source",
"metadata",
"to",
"target",
"metadata",
"if",
"no",
"version",
"in",
"target",
"metadata",
".",
"This",
"method",
"can",
"be",
"useful",
"in",
"scenarios",
"where",
"source",
"version",
"information",
"must",
"be",
"kept",... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/metadata/Metadatas.java#L29-L34 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/DJJRDesignHelper.java | DJJRDesignHelper.populateReportOptionsFromDesign | protected static void populateReportOptionsFromDesign(DynamicJasperDesign jd, DynamicReport dr) {
DynamicReportOptions options = dr.getOptions();
options.setBottomMargin(jd.getBottomMargin());
options.setTopMargin(jd.getTopMargin());
options.setLeftMargin(jd.getLeftMargin());
options.setRightMargin(jd.getRightMargin());
options.setColumnSpace(jd.getColumnSpacing());
options.setColumnsPerPage(jd.getColumnCount());
boolean isPortrait = true;
if (jd.getOrientationValue() == OrientationEnum.LANDSCAPE) {
isPortrait = false;
}
options.setPage(new Page(jd.getPageHeight(), jd.getPageWidth(), isPortrait));
if (dr.getQuery() != null) {
JRDesignQuery query = DJJRDesignHelper.getJRDesignQuery(dr);
jd.setQuery(query);
}
if (dr.getReportName() != null) {
jd.setName(dr.getReportName());
}
} | java | protected static void populateReportOptionsFromDesign(DynamicJasperDesign jd, DynamicReport dr) {
DynamicReportOptions options = dr.getOptions();
options.setBottomMargin(jd.getBottomMargin());
options.setTopMargin(jd.getTopMargin());
options.setLeftMargin(jd.getLeftMargin());
options.setRightMargin(jd.getRightMargin());
options.setColumnSpace(jd.getColumnSpacing());
options.setColumnsPerPage(jd.getColumnCount());
boolean isPortrait = true;
if (jd.getOrientationValue() == OrientationEnum.LANDSCAPE) {
isPortrait = false;
}
options.setPage(new Page(jd.getPageHeight(), jd.getPageWidth(), isPortrait));
if (dr.getQuery() != null) {
JRDesignQuery query = DJJRDesignHelper.getJRDesignQuery(dr);
jd.setQuery(query);
}
if (dr.getReportName() != null) {
jd.setName(dr.getReportName());
}
} | [
"protected",
"static",
"void",
"populateReportOptionsFromDesign",
"(",
"DynamicJasperDesign",
"jd",
",",
"DynamicReport",
"dr",
")",
"{",
"DynamicReportOptions",
"options",
"=",
"dr",
".",
"getOptions",
"(",
")",
";",
"options",
".",
"setBottomMargin",
"(",
"jd",
... | Because all the layout calculations are made from the Domain Model of DynamicJasper, when loading
a template file, we have to populate the "ReportOptions" with the settings from the template file (ie: margins, etc)
@param jd
@param dr | [
"Because",
"all",
"the",
"layout",
"calculations",
"are",
"made",
"from",
"the",
"Domain",
"Model",
"of",
"DynamicJasper",
"when",
"loading",
"a",
"template",
"file",
"we",
"have",
"to",
"populate",
"the",
"ReportOptions",
"with",
"the",
"settings",
"from",
"t... | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/DJJRDesignHelper.java#L257-L283 |
jdillon/gshell | gshell-util/src/main/java/org/apache/tools/ant/taskdefs/PumpStreamHandler.java | PumpStreamHandler.createPump | protected Thread createPump(InputStream is, OutputStream os,
boolean closeWhenExhausted, boolean nonBlockingIO) {
StreamPumper pumper = new StreamPumper(is, os, closeWhenExhausted, nonBlockingIO);
pumper.setAutoflush(true);
final Thread result = new ThreadWithPumper(pumper);
result.setDaemon(true);
return result;
} | java | protected Thread createPump(InputStream is, OutputStream os,
boolean closeWhenExhausted, boolean nonBlockingIO) {
StreamPumper pumper = new StreamPumper(is, os, closeWhenExhausted, nonBlockingIO);
pumper.setAutoflush(true);
final Thread result = new ThreadWithPumper(pumper);
result.setDaemon(true);
return result;
} | [
"protected",
"Thread",
"createPump",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
",",
"boolean",
"closeWhenExhausted",
",",
"boolean",
"nonBlockingIO",
")",
"{",
"StreamPumper",
"pumper",
"=",
"new",
"StreamPumper",
"(",
"is",
",",
"os",
",",
"closeWhen... | Creates a stream pumper to copy the given input stream to the
given output stream.
@param is the input stream to copy from.
@param os the output stream to copy to.
@param closeWhenExhausted if true close the inputstream.
@param nonBlockingIO set it to <code>true</code> to use simulated non
blocking IO.
@return a thread object that does the pumping, subclasses
should return an instance of {@link ThreadWithPumper
ThreadWithPumper}.
@since Ant 1.8.2 | [
"Creates",
"a",
"stream",
"pumper",
"to",
"copy",
"the",
"given",
"input",
"stream",
"to",
"the",
"given",
"output",
"stream",
"."
] | train | https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-util/src/main/java/org/apache/tools/ant/taskdefs/PumpStreamHandler.java#L274-L281 |
xiancloud/xian | xian-cache/xian-redis/src/main/java/info/xiancloud/cache/redis/operate/ListCacheOperate.java | ListCacheOperate.remove | public static long remove(Jedis jedis, String key, Object valueObj) {
final int count = 1; // > 0
String value = FormatUtil.formatValue(valueObj);
return jedis.lrem(key, count, value);
} | java | public static long remove(Jedis jedis, String key, Object valueObj) {
final int count = 1; // > 0
String value = FormatUtil.formatValue(valueObj);
return jedis.lrem(key, count, value);
} | [
"public",
"static",
"long",
"remove",
"(",
"Jedis",
"jedis",
",",
"String",
"key",
",",
"Object",
"valueObj",
")",
"{",
"final",
"int",
"count",
"=",
"1",
";",
"// > 0",
"String",
"value",
"=",
"FormatUtil",
".",
"formatValue",
"(",
"valueObj",
")",
";",... | List 移除元素
@param jedis jedis object
@param key the cache key
@param valueObj the value object
@return 注意:
if count is greater than 0 : 从表头开始向表尾搜索, 移除与 VALUE 相等的元素, 数量为 COUNT
if count is lower than 0 : 从表尾开始向表头搜索, 移除与 VALUE 相等的元素, 数量为 COUNT 的绝对值
if count equals 0 : 移除列表中所有与 VALUE 相等的值 | [
"List",
"移除元素"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-cache/xian-redis/src/main/java/info/xiancloud/cache/redis/operate/ListCacheOperate.java#L31-L37 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java | JsonUtil.put | public static void put(Writer writer, Date value) throws IOException {
if (value == null) {
writer.write("null");
} else {
writer.write(String.valueOf(value.getTime()));
}
} | java | public static void put(Writer writer, Date value) throws IOException {
if (value == null) {
writer.write("null");
} else {
writer.write(String.valueOf(value.getTime()));
}
} | [
"public",
"static",
"void",
"put",
"(",
"Writer",
"writer",
",",
"Date",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"\"null\"",
")",
";",
"}",
"else",
"{",
"writer",
".",
"writ... | Writes the given value with the given writer.
@param writer
@param value
@throws IOException
@author vvakame | [
"Writes",
"the",
"given",
"value",
"with",
"the",
"given",
"writer",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L570-L576 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeUserInfo | public static String encodeUserInfo(String userInfo, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(userInfo, encoding, HierarchicalUriComponents.Type.USER_INFO);
} | java | public static String encodeUserInfo(String userInfo, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(userInfo, encoding, HierarchicalUriComponents.Type.USER_INFO);
} | [
"public",
"static",
"String",
"encodeUserInfo",
"(",
"String",
"userInfo",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"userInfo",
",",
"encoding",
",",
"Hierarchic... | Encodes the given URI user info with the given encoding.
@param userInfo the user info to be encoded
@param encoding the character encoding to encode to
@return the encoded user info
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"user",
"info",
"with",
"the",
"given",
"encoding",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L241-L243 |
google/closure-compiler | src/com/google/javascript/jscomp/JsIterables.java | JsIterables.maybeBoxIterableOrAsyncIterable | static final MaybeBoxedIterableOrAsyncIterable maybeBoxIterableOrAsyncIterable(
JSType type, JSTypeRegistry typeRegistry) {
List<JSType> templatedTypes = new ArrayList<>();
// Note: we don't just use JSType.autobox() here because that removes null and undefined.
// We want to keep null and undefined around because they should cause a mismatch.
if (type.isUnionType()) {
for (JSType alt : type.toMaybeUnionType().getAlternates()) {
alt = alt.isBoxableScalar() ? alt.autoboxesTo() : alt;
boolean isIterable = alt.isSubtypeOf(typeRegistry.getNativeType(ITERABLE_TYPE));
boolean isAsyncIterable = alt.isSubtypeOf(typeRegistry.getNativeType(ASYNC_ITERABLE_TYPE));
if (!isIterable && !isAsyncIterable) {
return new MaybeBoxedIterableOrAsyncIterable(null, alt);
}
JSTypeNative iterableType = isAsyncIterable ? ASYNC_ITERABLE_TYPE : ITERABLE_TYPE;
templatedTypes.add(
alt.getInstantiatedTypeArgument(typeRegistry.getNativeType(iterableType)));
}
} else {
JSType autoboxedType = type.isBoxableScalar() ? type.autoboxesTo() : type;
boolean isIterable = autoboxedType.isSubtypeOf(typeRegistry.getNativeType(ITERABLE_TYPE));
boolean isAsyncIterable =
autoboxedType.isSubtypeOf(typeRegistry.getNativeType(ASYNC_ITERABLE_TYPE));
if (!isIterable && !isAsyncIterable) {
return new MaybeBoxedIterableOrAsyncIterable(null, autoboxedType);
}
JSTypeNative iterableType = isAsyncIterable ? ASYNC_ITERABLE_TYPE : ITERABLE_TYPE;
templatedTypes.add(
autoboxedType.getInstantiatedTypeArgument(typeRegistry.getNativeType(iterableType)));
}
return new MaybeBoxedIterableOrAsyncIterable(
typeRegistry.createUnionType(templatedTypes), null);
} | java | static final MaybeBoxedIterableOrAsyncIterable maybeBoxIterableOrAsyncIterable(
JSType type, JSTypeRegistry typeRegistry) {
List<JSType> templatedTypes = new ArrayList<>();
// Note: we don't just use JSType.autobox() here because that removes null and undefined.
// We want to keep null and undefined around because they should cause a mismatch.
if (type.isUnionType()) {
for (JSType alt : type.toMaybeUnionType().getAlternates()) {
alt = alt.isBoxableScalar() ? alt.autoboxesTo() : alt;
boolean isIterable = alt.isSubtypeOf(typeRegistry.getNativeType(ITERABLE_TYPE));
boolean isAsyncIterable = alt.isSubtypeOf(typeRegistry.getNativeType(ASYNC_ITERABLE_TYPE));
if (!isIterable && !isAsyncIterable) {
return new MaybeBoxedIterableOrAsyncIterable(null, alt);
}
JSTypeNative iterableType = isAsyncIterable ? ASYNC_ITERABLE_TYPE : ITERABLE_TYPE;
templatedTypes.add(
alt.getInstantiatedTypeArgument(typeRegistry.getNativeType(iterableType)));
}
} else {
JSType autoboxedType = type.isBoxableScalar() ? type.autoboxesTo() : type;
boolean isIterable = autoboxedType.isSubtypeOf(typeRegistry.getNativeType(ITERABLE_TYPE));
boolean isAsyncIterable =
autoboxedType.isSubtypeOf(typeRegistry.getNativeType(ASYNC_ITERABLE_TYPE));
if (!isIterable && !isAsyncIterable) {
return new MaybeBoxedIterableOrAsyncIterable(null, autoboxedType);
}
JSTypeNative iterableType = isAsyncIterable ? ASYNC_ITERABLE_TYPE : ITERABLE_TYPE;
templatedTypes.add(
autoboxedType.getInstantiatedTypeArgument(typeRegistry.getNativeType(iterableType)));
}
return new MaybeBoxedIterableOrAsyncIterable(
typeRegistry.createUnionType(templatedTypes), null);
} | [
"static",
"final",
"MaybeBoxedIterableOrAsyncIterable",
"maybeBoxIterableOrAsyncIterable",
"(",
"JSType",
"type",
",",
"JSTypeRegistry",
"typeRegistry",
")",
"{",
"List",
"<",
"JSType",
">",
"templatedTypes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// Note: we ... | Given a type, if it is an iterable or async iterable, will return its template. If not a
subtype of Iterable|AsyncIterable, returns an object that has no match, and will indicate the
mismatch. e.g. both {@code number} and {@code number|Iterable} are not subtypes of
Iterable|AsyncIterable. | [
"Given",
"a",
"type",
"if",
"it",
"is",
"an",
"iterable",
"or",
"async",
"iterable",
"will",
"return",
"its",
"template",
".",
"If",
"not",
"a",
"subtype",
"of",
"Iterable|AsyncIterable",
"returns",
"an",
"object",
"that",
"has",
"no",
"match",
"and",
"wil... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsIterables.java#L131-L163 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java | ArrayBlockingQueue.offer | public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {
Objects.requireNonNull(e);
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
while (count == items.length) {
if (nanos <= 0L)
return false;
nanos = notFull.awaitNanos(nanos);
}
enqueue(e);
return true;
} finally {
lock.unlock();
}
} | java | public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {
Objects.requireNonNull(e);
long nanos = unit.toNanos(timeout);
final ReentrantLock lock = this.lock;
lock.lockInterruptibly();
try {
while (count == items.length) {
if (nanos <= 0L)
return false;
nanos = notFull.awaitNanos(nanos);
}
enqueue(e);
return true;
} finally {
lock.unlock();
}
} | [
"public",
"boolean",
"offer",
"(",
"E",
"e",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"e",
")",
";",
"long",
"nanos",
"=",
"unit",
".",
"toNanos",
"(",
"timeout",
... | Inserts the specified element at the tail of this queue, waiting
up to the specified wait time for space to become available if
the queue is full.
@throws InterruptedException {@inheritDoc}
@throws NullPointerException {@inheritDoc} | [
"Inserts",
"the",
"specified",
"element",
"at",
"the",
"tail",
"of",
"this",
"queue",
"waiting",
"up",
"to",
"the",
"specified",
"wait",
"time",
"for",
"space",
"to",
"become",
"available",
"if",
"the",
"queue",
"is",
"full",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ArrayBlockingQueue.java#L355-L373 |
VoltDB/voltdb | src/frontend/org/voltdb/utils/HTTPAdminListener.java | HTTPAdminListener.getHTMLForAdminPage | String getHTMLForAdminPage(Map<String,String> params) {
try {
String template = m_htmlTemplates.get("admintemplate.html");
for (Entry<String, String> e : params.entrySet()) {
String key = e.getKey().toUpperCase();
String value = e.getValue();
if (key == null) continue;
if (value == null) value = "NULL";
template = template.replace("#" + key + "#", value);
}
return template;
}
catch (Exception e) {
e.printStackTrace();
}
return "<html><body>An unrecoverable error was encountered while generating this page.</body></html>";
} | java | String getHTMLForAdminPage(Map<String,String> params) {
try {
String template = m_htmlTemplates.get("admintemplate.html");
for (Entry<String, String> e : params.entrySet()) {
String key = e.getKey().toUpperCase();
String value = e.getValue();
if (key == null) continue;
if (value == null) value = "NULL";
template = template.replace("#" + key + "#", value);
}
return template;
}
catch (Exception e) {
e.printStackTrace();
}
return "<html><body>An unrecoverable error was encountered while generating this page.</body></html>";
} | [
"String",
"getHTMLForAdminPage",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"try",
"{",
"String",
"template",
"=",
"m_htmlTemplates",
".",
"get",
"(",
"\"admintemplate.html\"",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"Str... | Load a template for the admin page, fill it out and return the value.
@param params The key-value set of variables to replace in the template.
@return The completed template. | [
"Load",
"a",
"template",
"for",
"the",
"admin",
"page",
"fill",
"it",
"out",
"and",
"return",
"the",
"value",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/HTTPAdminListener.java#L139-L155 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java | TypeAnnotations.organizeTypeAnnotationsSignatures | public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
annotate.afterTypes(() -> {
JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
try {
new TypeAnnotationPositions(true).scan(tree);
} finally {
log.useSource(oldSource);
}
});
} | java | public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
annotate.afterTypes(() -> {
JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
try {
new TypeAnnotationPositions(true).scan(tree);
} finally {
log.useSource(oldSource);
}
});
} | [
"public",
"void",
"organizeTypeAnnotationsSignatures",
"(",
"final",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"final",
"JCClassDecl",
"tree",
")",
"{",
"annotate",
".",
"afterTypes",
"(",
"(",
")",
"->",
"{",
"JavaFileObject",
"oldSource",
"=",
"log",
".",
... | Separate type annotations from declaration annotations and
determine the correct positions for type annotations.
This version only visits types in signatures and should be
called from MemberEnter. | [
"Separate",
"type",
"annotations",
"from",
"declaration",
"annotations",
"and",
"determine",
"the",
"correct",
"positions",
"for",
"type",
"annotations",
".",
"This",
"version",
"only",
"visits",
"types",
"in",
"signatures",
"and",
"should",
"be",
"called",
"from"... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java#L118-L127 |
apache/groovy | subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java | StructuredSyntaxDocumentFilter.parseDocument | protected void parseDocument(int offset, int length) throws BadLocationException {
// initialize the segment with the complete document so the segment doesn't
// have an underlying gap in the buffer
styledDocument.getText(0, styledDocument.getLength(), segment);
buffer = CharBuffer.wrap(segment.array).asReadOnlyBuffer();
// initialize the lexer if necessary
if (!lexer.isInitialized()) {
// prime the parser and reparse whole document
lexer.initialize();
offset = 0;
length = styledDocument.getLength();
}
else {
int end = offset + length;
offset = calcBeginParse(offset);
length = calcEndParse(end) - offset;
// clean the tree by ensuring multi line styles are reset in area
// of parsing
SortedSet set = mlTextRunSet.subSet(offset,
offset + length);
if (set != null) {
set.clear();
}
}
// parse the document
lexer.parse(buffer, offset, length);
} | java | protected void parseDocument(int offset, int length) throws BadLocationException {
// initialize the segment with the complete document so the segment doesn't
// have an underlying gap in the buffer
styledDocument.getText(0, styledDocument.getLength(), segment);
buffer = CharBuffer.wrap(segment.array).asReadOnlyBuffer();
// initialize the lexer if necessary
if (!lexer.isInitialized()) {
// prime the parser and reparse whole document
lexer.initialize();
offset = 0;
length = styledDocument.getLength();
}
else {
int end = offset + length;
offset = calcBeginParse(offset);
length = calcEndParse(end) - offset;
// clean the tree by ensuring multi line styles are reset in area
// of parsing
SortedSet set = mlTextRunSet.subSet(offset,
offset + length);
if (set != null) {
set.clear();
}
}
// parse the document
lexer.parse(buffer, offset, length);
} | [
"protected",
"void",
"parseDocument",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"BadLocationException",
"{",
"// initialize the segment with the complete document so the segment doesn't",
"// have an underlying gap in the buffer",
"styledDocument",
".",
"getText",
... | Parse the Document to update the character styles given an initial start
position. Called by the filter after it has updated the text.
@param offset
@param length
@throws BadLocationException | [
"Parse",
"the",
"Document",
"to",
"update",
"the",
"character",
"styles",
"given",
"an",
"initial",
"start",
"position",
".",
"Called",
"by",
"the",
"filter",
"after",
"it",
"has",
"updated",
"the",
"text",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-console/src/main/groovy/groovy/ui/text/StructuredSyntaxDocumentFilter.java#L186-L216 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java | ClassDocImpl.findConstructor | public ConstructorDoc findConstructor(String constrName,
String[] paramTypes) {
Names names = tsym.name.table.names;
for (Symbol sym : tsym.members().getSymbolsByName(names.fromString("<init>"))) {
if (sym.kind == MTH) {
if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
return env.getConstructorDoc((MethodSymbol)sym);
}
}
}
//###(gj) As a temporary measure until type variables are better
//### handled, try again without the parameter types.
//### This will often find the right constructor, and occassionally
//### find the wrong one.
//if (paramTypes != null) {
// return findConstructor(constrName, null);
//}
return null;
} | java | public ConstructorDoc findConstructor(String constrName,
String[] paramTypes) {
Names names = tsym.name.table.names;
for (Symbol sym : tsym.members().getSymbolsByName(names.fromString("<init>"))) {
if (sym.kind == MTH) {
if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
return env.getConstructorDoc((MethodSymbol)sym);
}
}
}
//###(gj) As a temporary measure until type variables are better
//### handled, try again without the parameter types.
//### This will often find the right constructor, and occassionally
//### find the wrong one.
//if (paramTypes != null) {
// return findConstructor(constrName, null);
//}
return null;
} | [
"public",
"ConstructorDoc",
"findConstructor",
"(",
"String",
"constrName",
",",
"String",
"[",
"]",
"paramTypes",
")",
"{",
"Names",
"names",
"=",
"tsym",
".",
"name",
".",
"table",
".",
"names",
";",
"for",
"(",
"Symbol",
"sym",
":",
"tsym",
".",
"memb... | Find constructor in this class.
@param constrName the unqualified name to search for.
@param paramTypes the array of Strings for constructor parameters.
@return the first ConstructorDocImpl which matches, null if not found. | [
"Find",
"constructor",
"in",
"this",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L999-L1019 |
google/closure-compiler | src/com/google/javascript/jscomp/type/SemanticReverseAbstractInterpreter.java | SemanticReverseAbstractInterpreter.caseIn | @CheckReturnValue
private FlowScope caseIn(Node object, String propertyName, FlowScope blindScope) {
JSType jsType = object.getJSType();
jsType = this.getRestrictedWithoutNull(jsType);
jsType = this.getRestrictedWithoutUndefined(jsType);
boolean hasProperty = false;
ObjectType objectType = ObjectType.cast(jsType);
if (objectType != null) {
hasProperty = objectType.hasProperty(propertyName);
}
if (!hasProperty) {
String qualifiedName = object.getQualifiedName();
if (qualifiedName != null) {
String propertyQualifiedName = qualifiedName + "." + propertyName;
if (blindScope.getSlot(propertyQualifiedName) == null) {
JSType unknownType = typeRegistry.getNativeType(JSTypeNative.UNKNOWN_TYPE);
return blindScope.inferQualifiedSlot(
object, propertyQualifiedName, unknownType, unknownType, false);
}
}
}
return blindScope;
} | java | @CheckReturnValue
private FlowScope caseIn(Node object, String propertyName, FlowScope blindScope) {
JSType jsType = object.getJSType();
jsType = this.getRestrictedWithoutNull(jsType);
jsType = this.getRestrictedWithoutUndefined(jsType);
boolean hasProperty = false;
ObjectType objectType = ObjectType.cast(jsType);
if (objectType != null) {
hasProperty = objectType.hasProperty(propertyName);
}
if (!hasProperty) {
String qualifiedName = object.getQualifiedName();
if (qualifiedName != null) {
String propertyQualifiedName = qualifiedName + "." + propertyName;
if (blindScope.getSlot(propertyQualifiedName) == null) {
JSType unknownType = typeRegistry.getNativeType(JSTypeNative.UNKNOWN_TYPE);
return blindScope.inferQualifiedSlot(
object, propertyQualifiedName, unknownType, unknownType, false);
}
}
}
return blindScope;
} | [
"@",
"CheckReturnValue",
"private",
"FlowScope",
"caseIn",
"(",
"Node",
"object",
",",
"String",
"propertyName",
",",
"FlowScope",
"blindScope",
")",
"{",
"JSType",
"jsType",
"=",
"object",
".",
"getJSType",
"(",
")",
";",
"jsType",
"=",
"this",
".",
"getRes... | Given 'property in object', ensures that the object has the property in the informed scope by
defining it as a qualified name if the object type lacks the property and it's not in the blind
scope.
@param object The node of the right-side of the in.
@param propertyName The string of the left-side of the in. | [
"Given",
"property",
"in",
"object",
"ensures",
"that",
"the",
"object",
"has",
"the",
"property",
"in",
"the",
"informed",
"scope",
"by",
"defining",
"it",
"as",
"a",
"qualified",
"name",
"if",
"the",
"object",
"type",
"lacks",
"the",
"property",
"and",
"... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/type/SemanticReverseAbstractInterpreter.java#L486-L509 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ObjectFactory.java | ObjectFactory.createObject | static Object createObject(String factoryId, String fallbackClassName)
throws ConfigurationError {
return createObject(factoryId, null, fallbackClassName);
} | java | static Object createObject(String factoryId, String fallbackClassName)
throws ConfigurationError {
return createObject(factoryId, null, fallbackClassName);
} | [
"static",
"Object",
"createObject",
"(",
"String",
"factoryId",
",",
"String",
"fallbackClassName",
")",
"throws",
"ConfigurationError",
"{",
"return",
"createObject",
"(",
"factoryId",
",",
"null",
",",
"fallbackClassName",
")",
";",
"}"
] | Finds the implementation Class object in the specified order. The
specified order is the following:
<ol>
<li>query the system property using <code>System.getProperty</code>
<li>read <code>META-INF/services/<i>factoryId</i></code> file
<li>use fallback classname
</ol>
@return instance of factory, never null
@param factoryId Name of the factory to find, same as
a property name
@param fallbackClassName Implementation class name, if nothing else
is found. Use null to mean no fallback.
@exception ObjectFactory.ConfigurationError | [
"Finds",
"the",
"implementation",
"Class",
"object",
"in",
"the",
"specified",
"order",
".",
"The",
"specified",
"order",
"is",
"the",
"following",
":",
"<ol",
">",
"<li",
">",
"query",
"the",
"system",
"property",
"using",
"<code",
">",
"System",
".",
"ge... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ObjectFactory.java#L100-L103 |
spockframework/spock | spock-core/src/main/java/spock/mock/DetachedMockFactory.java | DetachedMockFactory.Stub | @Override
public <T> T Stub(Map<String, Object> options, Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.STUB, options);
} | java | @Override
public <T> T Stub(Map<String, Object> options, Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.STUB, options);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"Stub",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"createMock",
"(",
"inferNameFromType",
"(",
"type",
")",
",",
"type",
",",
"M... | Creates a stub with the specified options and type. The mock name will be the types simple name.
Example:
<pre>
def person = Stub(Person, name: "myPerson") // type is Person.class, name is "myPerson"
</pre>
@param options optional options for creating the stub
@param type the interface or class type of the stub
@param <T> the interface or class type of the stub
@return a stub with the specified options and type | [
"Creates",
"a",
"stub",
"with",
"the",
"specified",
"options",
"and",
"type",
".",
"The",
"mock",
"name",
"will",
"be",
"the",
"types",
"simple",
"name",
"."
] | train | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/DetachedMockFactory.java#L104-L107 |
spring-projects/spring-mobile | spring-mobile-device/src/main/java/org/springframework/mobile/device/switcher/SiteSwitcherHandlerInterceptor.java | SiteSwitcherHandlerInterceptor.urlPath | public static SiteSwitcherHandlerInterceptor urlPath(String mobilePath, String rootPath) {
return new SiteSwitcherHandlerInterceptor(StandardSiteSwitcherHandlerFactory.urlPath(mobilePath, rootPath));
} | java | public static SiteSwitcherHandlerInterceptor urlPath(String mobilePath, String rootPath) {
return new SiteSwitcherHandlerInterceptor(StandardSiteSwitcherHandlerFactory.urlPath(mobilePath, rootPath));
} | [
"public",
"static",
"SiteSwitcherHandlerInterceptor",
"urlPath",
"(",
"String",
"mobilePath",
",",
"String",
"rootPath",
")",
"{",
"return",
"new",
"SiteSwitcherHandlerInterceptor",
"(",
"StandardSiteSwitcherHandlerFactory",
".",
"urlPath",
"(",
"mobilePath",
",",
"rootPa... | Creates a site switcher that redirects to a path on the current domain for normal site requests that either
originate from a mobile device or indicate a mobile site preference.
Allows you to configure a root path for an application. For example, if your app is running at <code>https://www.domain.com/myapp</code>,
then the root path is <code>/myapp</code>.
Uses a {@link CookieSitePreferenceRepository} that saves a cookie that is stored on the root path. | [
"Creates",
"a",
"site",
"switcher",
"that",
"redirects",
"to",
"a",
"path",
"on",
"the",
"current",
"domain",
"for",
"normal",
"site",
"requests",
"that",
"either",
"originate",
"from",
"a",
"mobile",
"device",
"or",
"indicate",
"a",
"mobile",
"site",
"prefe... | train | https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/switcher/SiteSwitcherHandlerInterceptor.java#L219-L221 |
k3po/k3po | driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/tcp/TcpBootstrapFactorySpi.java | TcpBootstrapFactorySpi.newClientBootstrap | @Override
public synchronized ClientBootstrap newClientBootstrap() throws Exception {
ClientSocketChannelFactory clientChannelFactory = this.clientChannelFactory;
if (clientChannelFactory == null) {
Executor bossExecutor = executorServiceFactory.newExecutorService("boss.client");
NioClientBossPool bossPool = new NioClientBossPool(bossExecutor, 1);
Executor workerExecutor = executorServiceFactory.newExecutorService("worker.client");
NioWorkerPool workerPool = new NioWorkerPool(workerExecutor, 1);
clientChannelFactory = new NioClientSocketChannelFactory(bossPool, workerPool);
// unshared
channelFactories.add(clientChannelFactory);
}
return new ClientBootstrap(clientChannelFactory) {
@Override
public ChannelFuture connect(final SocketAddress localAddress, final SocketAddress remoteAddress) {
final InetSocketAddress localChannelAddress = toInetSocketAddress((ChannelAddress) localAddress);
final InetSocketAddress remoteChannelAddress = toInetSocketAddress((ChannelAddress) remoteAddress);
return super.connect(localChannelAddress, remoteChannelAddress);
}
};
} | java | @Override
public synchronized ClientBootstrap newClientBootstrap() throws Exception {
ClientSocketChannelFactory clientChannelFactory = this.clientChannelFactory;
if (clientChannelFactory == null) {
Executor bossExecutor = executorServiceFactory.newExecutorService("boss.client");
NioClientBossPool bossPool = new NioClientBossPool(bossExecutor, 1);
Executor workerExecutor = executorServiceFactory.newExecutorService("worker.client");
NioWorkerPool workerPool = new NioWorkerPool(workerExecutor, 1);
clientChannelFactory = new NioClientSocketChannelFactory(bossPool, workerPool);
// unshared
channelFactories.add(clientChannelFactory);
}
return new ClientBootstrap(clientChannelFactory) {
@Override
public ChannelFuture connect(final SocketAddress localAddress, final SocketAddress remoteAddress) {
final InetSocketAddress localChannelAddress = toInetSocketAddress((ChannelAddress) localAddress);
final InetSocketAddress remoteChannelAddress = toInetSocketAddress((ChannelAddress) remoteAddress);
return super.connect(localChannelAddress, remoteChannelAddress);
}
};
} | [
"@",
"Override",
"public",
"synchronized",
"ClientBootstrap",
"newClientBootstrap",
"(",
")",
"throws",
"Exception",
"{",
"ClientSocketChannelFactory",
"clientChannelFactory",
"=",
"this",
".",
"clientChannelFactory",
";",
"if",
"(",
"clientChannelFactory",
"==",
"null",
... | Returns a {@link ClientBootstrap} instance for the named transport. | [
"Returns",
"a",
"{"
] | train | https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/tcp/TcpBootstrapFactorySpi.java#L95-L119 |
sundrio/sundrio | codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java | TypeUtils.hasMethod | public static boolean hasMethod(TypeDef typeDef, String method) {
return unrollHierarchy(typeDef)
.stream()
.flatMap(h -> h.getMethods().stream())
.filter(m -> method.equals(m.getName()))
.findAny()
.isPresent();
} | java | public static boolean hasMethod(TypeDef typeDef, String method) {
return unrollHierarchy(typeDef)
.stream()
.flatMap(h -> h.getMethods().stream())
.filter(m -> method.equals(m.getName()))
.findAny()
.isPresent();
} | [
"public",
"static",
"boolean",
"hasMethod",
"(",
"TypeDef",
"typeDef",
",",
"String",
"method",
")",
"{",
"return",
"unrollHierarchy",
"(",
"typeDef",
")",
".",
"stream",
"(",
")",
".",
"flatMap",
"(",
"h",
"->",
"h",
".",
"getMethods",
"(",
")",
".",
... | Check if method exists on the specified type.
@param typeDef The type.
@param method The method name.
@return True if method is found, false otherwise. | [
"Check",
"if",
"method",
"exists",
"on",
"the",
"specified",
"type",
"."
] | train | https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java#L398-L405 |
albfernandez/itext2 | src/main/java/com/lowagie/text/xml/xmp/XmpReader.java | XmpReader.setNodeText | public boolean setNodeText(Document domDocument, Node n, String value) {
if (n == null)
return false;
Node nc = null;
while ((nc = n.getFirstChild()) != null) {
n.removeChild(nc);
}
n.appendChild(domDocument.createTextNode(value));
return true;
} | java | public boolean setNodeText(Document domDocument, Node n, String value) {
if (n == null)
return false;
Node nc = null;
while ((nc = n.getFirstChild()) != null) {
n.removeChild(nc);
}
n.appendChild(domDocument.createTextNode(value));
return true;
} | [
"public",
"boolean",
"setNodeText",
"(",
"Document",
"domDocument",
",",
"Node",
"n",
",",
"String",
"value",
")",
"{",
"if",
"(",
"n",
"==",
"null",
")",
"return",
"false",
";",
"Node",
"nc",
"=",
"null",
";",
"while",
"(",
"(",
"nc",
"=",
"n",
".... | Sets the text of this node. All the child's node are deleted and a new
child text node is created.
@param domDocument the <CODE>Document</CODE> that contains the node
@param n the <CODE>Node</CODE> to add the text to
@param value the text to add | [
"Sets",
"the",
"text",
"of",
"this",
"node",
".",
"All",
"the",
"child",
"s",
"node",
"are",
"deleted",
"and",
"a",
"new",
"child",
"text",
"node",
"is",
"created",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/xml/xmp/XmpReader.java#L162-L171 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetricsRegistry.java | GobblinMetricsRegistry.getMetricContext | public MetricContext getMetricContext(State state, Class<?> klazz, List<Tag<?>> tags) {
int randomId = new Random().nextInt(Integer.MAX_VALUE);
List<Tag<?>> generatedTags = Lists.newArrayList();
if (!klazz.isAnonymousClass()) {
generatedTags.add(new Tag<>("class", klazz.getCanonicalName()));
}
Optional<GobblinMetrics> gobblinMetrics = state.contains(ConfigurationKeys.METRIC_CONTEXT_NAME_KEY)
? GobblinMetricsRegistry.getInstance().get(state.getProp(ConfigurationKeys.METRIC_CONTEXT_NAME_KEY))
: Optional.<GobblinMetrics> absent();
MetricContext.Builder builder = gobblinMetrics.isPresent()
? gobblinMetrics.get().getMetricContext().childBuilder(klazz.getCanonicalName() + "." + randomId)
: MetricContext.builder(klazz.getCanonicalName() + "." + randomId);
return builder.addTags(generatedTags).addTags(tags).build();
} | java | public MetricContext getMetricContext(State state, Class<?> klazz, List<Tag<?>> tags) {
int randomId = new Random().nextInt(Integer.MAX_VALUE);
List<Tag<?>> generatedTags = Lists.newArrayList();
if (!klazz.isAnonymousClass()) {
generatedTags.add(new Tag<>("class", klazz.getCanonicalName()));
}
Optional<GobblinMetrics> gobblinMetrics = state.contains(ConfigurationKeys.METRIC_CONTEXT_NAME_KEY)
? GobblinMetricsRegistry.getInstance().get(state.getProp(ConfigurationKeys.METRIC_CONTEXT_NAME_KEY))
: Optional.<GobblinMetrics> absent();
MetricContext.Builder builder = gobblinMetrics.isPresent()
? gobblinMetrics.get().getMetricContext().childBuilder(klazz.getCanonicalName() + "." + randomId)
: MetricContext.builder(klazz.getCanonicalName() + "." + randomId);
return builder.addTags(generatedTags).addTags(tags).build();
} | [
"public",
"MetricContext",
"getMetricContext",
"(",
"State",
"state",
",",
"Class",
"<",
"?",
">",
"klazz",
",",
"List",
"<",
"Tag",
"<",
"?",
">",
">",
"tags",
")",
"{",
"int",
"randomId",
"=",
"new",
"Random",
"(",
")",
".",
"nextInt",
"(",
"Intege... | <p>
Creates {@link org.apache.gobblin.metrics.MetricContext}. Tries to read the name of the parent context
from key "metrics.context.name" at state, and tries to get the parent context by name from
the {@link org.apache.gobblin.metrics.MetricContext} registry (the parent context must be registered).
</p>
<p>
Automatically adds two tags to the inner context:
<ul>
<li> component: attempts to determine which component type within gobblin-api generated this instance. </li>
<li> class: the specific class of the object that generated this instance of Instrumented </li>
</ul>
</p> | [
"<p",
">",
"Creates",
"{",
"@link",
"org",
".",
"apache",
".",
"gobblin",
".",
"metrics",
".",
"MetricContext",
"}",
".",
"Tries",
"to",
"read",
"the",
"name",
"of",
"the",
"parent",
"context",
"from",
"key",
"metrics",
".",
"context",
".",
"name",
"at... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetricsRegistry.java#L134-L151 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java | Serializer.registerAbstract | public Serializer registerAbstract(Class<?> abstractType, TypeSerializerFactory factory) {
registry.registerAbstract(abstractType, factory);
return this;
} | java | public Serializer registerAbstract(Class<?> abstractType, TypeSerializerFactory factory) {
registry.registerAbstract(abstractType, factory);
return this;
} | [
"public",
"Serializer",
"registerAbstract",
"(",
"Class",
"<",
"?",
">",
"abstractType",
",",
"TypeSerializerFactory",
"factory",
")",
"{",
"registry",
".",
"registerAbstract",
"(",
"abstractType",
",",
"factory",
")",
";",
"return",
"this",
";",
"}"
] | Registers an abstract type serializer for the given abstract type.
<p>
Abstract serializers allow abstract types to be serialized without explicitly registering a concrete type.
The concept of abstract serializers differs from {@link #registerDefault(Class, TypeSerializerFactory) default serializers}
in that abstract serializers can be registered with a serializable type ID, and types {@link #register(Class) registered}
without a specific {@link TypeSerializer} do not inheret from abstract serializers.
<pre>
{@code
serializer.registerAbstract(List.class, AbstractListSerializer.class);
}
</pre>
@param abstractType The abstract type for which to register the abstract serializer. Types that extend
the abstract type will be serialized using the given abstract serializer unless a
serializer has been registered for the specific concrete type.
@param factory The abstract type serializer factory with which to serialize instances of the abstract type.
@return The serializer.
@throws NullPointerException if the {@code abstractType} or {@code serializer} is {@code null} | [
"Registers",
"an",
"abstract",
"type",
"serializer",
"for",
"the",
"given",
"abstract",
"type",
".",
"<p",
">",
"Abstract",
"serializers",
"allow",
"abstract",
"types",
"to",
"be",
"serialized",
"without",
"explicitly",
"registering",
"a",
"concrete",
"type",
".... | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L529-L532 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/tabView/TabViewRenderer.java | TabViewRenderer.drawClearDiv | private static void drawClearDiv(ResponseWriter writer, UIComponent tabView) throws IOException {
writer.startElement("div", tabView);
writer.writeAttribute("style", "clear:both;", "style");
writer.endElement("div");
} | java | private static void drawClearDiv(ResponseWriter writer, UIComponent tabView) throws IOException {
writer.startElement("div", tabView);
writer.writeAttribute("style", "clear:both;", "style");
writer.endElement("div");
} | [
"private",
"static",
"void",
"drawClearDiv",
"(",
"ResponseWriter",
"writer",
",",
"UIComponent",
"tabView",
")",
"throws",
"IOException",
"{",
"writer",
".",
"startElement",
"(",
"\"div\"",
",",
"tabView",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"styl... | Draw a clear div
@param writer
@param tabView
@throws IOException | [
"Draw",
"a",
"clear",
"div"
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/tabView/TabViewRenderer.java#L276-L280 |
googleapis/google-cloud-java | google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java | ComputeExample.insertNewAddressUsingRequest | private static void insertNewAddressUsingRequest(AddressClient client, String newAddressName)
throws InterruptedException, ExecutionException {
// Begin samplegen code for insertAddress().
ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION);
Address address = Address.newBuilder().build();
InsertAddressHttpRequest request =
InsertAddressHttpRequest.newBuilder()
.setRegion(region.toString())
.setAddressResource(address)
.build();
// Do something
Operation response = client.insertAddress(request);
// End samplegen code for insertAddress().
System.out.format("Result of insert: %s\n", response.toString());
} | java | private static void insertNewAddressUsingRequest(AddressClient client, String newAddressName)
throws InterruptedException, ExecutionException {
// Begin samplegen code for insertAddress().
ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION);
Address address = Address.newBuilder().build();
InsertAddressHttpRequest request =
InsertAddressHttpRequest.newBuilder()
.setRegion(region.toString())
.setAddressResource(address)
.build();
// Do something
Operation response = client.insertAddress(request);
// End samplegen code for insertAddress().
System.out.format("Result of insert: %s\n", response.toString());
} | [
"private",
"static",
"void",
"insertNewAddressUsingRequest",
"(",
"AddressClient",
"client",
",",
"String",
"newAddressName",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"// Begin samplegen code for insertAddress().",
"ProjectRegionName",
"region",
"=... | Use an InsertAddressHttpRequest object to make an addresses.insert method call. | [
"Use",
"an",
"InsertAddressHttpRequest",
"object",
"to",
"make",
"an",
"addresses",
".",
"insert",
"method",
"call",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java#L85-L100 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.allSatisfy | @Deprecated
public static boolean allSatisfy(String string, CodePointPredicate predicate)
{
return StringIterate.allSatisfyCodePoint(string, predicate);
} | java | @Deprecated
public static boolean allSatisfy(String string, CodePointPredicate predicate)
{
return StringIterate.allSatisfyCodePoint(string, predicate);
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"allSatisfy",
"(",
"String",
"string",
",",
"CodePointPredicate",
"predicate",
")",
"{",
"return",
"StringIterate",
".",
"allSatisfyCodePoint",
"(",
"string",
",",
"predicate",
")",
";",
"}"
] | @return true if all of the code points in the {@code string} answer true for the specified {@code predicate}.
@deprecated since 7.0. Use {@link #allSatisfyCodePoint(String, CodePointPredicate)} instead. | [
"@return",
"true",
"if",
"all",
"of",
"the",
"code",
"points",
"in",
"the",
"{",
"@code",
"string",
"}",
"answer",
"true",
"for",
"the",
"specified",
"{",
"@code",
"predicate",
"}",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L879-L883 |
RestExpress/PluginExpress | metrics/src/main/java/com/strategicgains/restexpress/plugin/metrics/MetricsPlugin.java | MetricsPlugin.process | @Override
public void process(Request request, Response response)
{
Long duration = computeDurationMillis(START_TIMES_BY_CORRELATION_ID.get(request.getCorrelationId()));
if (duration != null && duration.longValue() > 0)
{
response.addHeader("X-Response-Time", String.valueOf(duration));
}
} | java | @Override
public void process(Request request, Response response)
{
Long duration = computeDurationMillis(START_TIMES_BY_CORRELATION_ID.get(request.getCorrelationId()));
if (duration != null && duration.longValue() > 0)
{
response.addHeader("X-Response-Time", String.valueOf(duration));
}
} | [
"@",
"Override",
"public",
"void",
"process",
"(",
"Request",
"request",
",",
"Response",
"response",
")",
"{",
"Long",
"duration",
"=",
"computeDurationMillis",
"(",
"START_TIMES_BY_CORRELATION_ID",
".",
"get",
"(",
"request",
".",
"getCorrelationId",
"(",
")",
... | Set the 'X-Response-Time' header to the response time in milliseconds. | [
"Set",
"the",
"X",
"-",
"Response",
"-",
"Time",
"header",
"to",
"the",
"response",
"time",
"in",
"milliseconds",
"."
] | train | https://github.com/RestExpress/PluginExpress/blob/aeb13907c23bf31ef2b2b17ae4c0ca4a6f5bee69/metrics/src/main/java/com/strategicgains/restexpress/plugin/metrics/MetricsPlugin.java#L235-L244 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsLinkWarningPanel.java | CmsLinkWarningPanel.createTreeItem | protected CmsTreeItem createTreeItem(CmsBrokenLinkBean brokenLinkBean) {
CmsListItemWidget itemWidget = createListItemWidget(brokenLinkBean);
CmsTreeItem item = new CmsTreeItem(false, itemWidget);
for (CmsBrokenLinkBean child : brokenLinkBean.getChildren()) {
CmsListItemWidget childItemWidget = createListItemWidget(child);
Widget warningImage = FontOpenCms.WARNING.getWidget(20, I_CmsConstantsBundle.INSTANCE.css().colorWarning());
warningImage.addStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().permaVisible());
childItemWidget.addButton(warningImage);
childItemWidget.addTitleStyleName(I_CmsLayoutBundle.INSTANCE.linkWarningCss().deletedEntryLabel());
CmsTreeItem childItem = new CmsTreeItem(false, childItemWidget);
item.addChild(childItem);
}
return item;
} | java | protected CmsTreeItem createTreeItem(CmsBrokenLinkBean brokenLinkBean) {
CmsListItemWidget itemWidget = createListItemWidget(brokenLinkBean);
CmsTreeItem item = new CmsTreeItem(false, itemWidget);
for (CmsBrokenLinkBean child : brokenLinkBean.getChildren()) {
CmsListItemWidget childItemWidget = createListItemWidget(child);
Widget warningImage = FontOpenCms.WARNING.getWidget(20, I_CmsConstantsBundle.INSTANCE.css().colorWarning());
warningImage.addStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().permaVisible());
childItemWidget.addButton(warningImage);
childItemWidget.addTitleStyleName(I_CmsLayoutBundle.INSTANCE.linkWarningCss().deletedEntryLabel());
CmsTreeItem childItem = new CmsTreeItem(false, childItemWidget);
item.addChild(childItem);
}
return item;
} | [
"protected",
"CmsTreeItem",
"createTreeItem",
"(",
"CmsBrokenLinkBean",
"brokenLinkBean",
")",
"{",
"CmsListItemWidget",
"itemWidget",
"=",
"createListItemWidget",
"(",
"brokenLinkBean",
")",
";",
"CmsTreeItem",
"item",
"=",
"new",
"CmsTreeItem",
"(",
"false",
",",
"i... | Helper method for creating a tree item from a bean.<p>
@param brokenLinkBean the bean containing the data for the tree item
@return a tree item | [
"Helper",
"method",
"for",
"creating",
"a",
"tree",
"item",
"from",
"a",
"bean",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsLinkWarningPanel.java#L137-L151 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyInducedStereoLinePt.java | HomographyInducedStereoLinePt.process | public void process(PairLineNorm line, AssociatedPair point) {
// t0 = (F*x) cross l'
GeometryMath_F64.mult(F,point.p1,Fx);
GeometryMath_F64.cross(Fx,line.getL2(),t0);
// t1 = x' cross ((f*x) cross l')
GeometryMath_F64.cross(point.p2, t0, t1);
// t0 = x' cross e'
GeometryMath_F64.cross(point.p2,e2,t0);
double top = GeometryMath_F64.dot(t0,t1);
double bottom = t0.normSq()*(line.l1.x*point.p1.x + line.l1.y*point.p1.y + line.l1.z);
// e' * l^T
GeometryMath_F64.outerProd(e2, line.l1, el);
// cross(l')*F
GeometryMath_F64.multCrossA(line.l2, F, lf);
CommonOps_DDRM.add(lf,top/bottom,el,H);
// pick a good scale and sign for H
adjust.adjust(H, point);
} | java | public void process(PairLineNorm line, AssociatedPair point) {
// t0 = (F*x) cross l'
GeometryMath_F64.mult(F,point.p1,Fx);
GeometryMath_F64.cross(Fx,line.getL2(),t0);
// t1 = x' cross ((f*x) cross l')
GeometryMath_F64.cross(point.p2, t0, t1);
// t0 = x' cross e'
GeometryMath_F64.cross(point.p2,e2,t0);
double top = GeometryMath_F64.dot(t0,t1);
double bottom = t0.normSq()*(line.l1.x*point.p1.x + line.l1.y*point.p1.y + line.l1.z);
// e' * l^T
GeometryMath_F64.outerProd(e2, line.l1, el);
// cross(l')*F
GeometryMath_F64.multCrossA(line.l2, F, lf);
CommonOps_DDRM.add(lf,top/bottom,el,H);
// pick a good scale and sign for H
adjust.adjust(H, point);
} | [
"public",
"void",
"process",
"(",
"PairLineNorm",
"line",
",",
"AssociatedPair",
"point",
")",
"{",
"// t0 = (F*x) cross l'",
"GeometryMath_F64",
".",
"mult",
"(",
"F",
",",
"point",
".",
"p1",
",",
"Fx",
")",
";",
"GeometryMath_F64",
".",
"cross",
"(",
"Fx"... | Computes the homography based on a line and point on the plane
@param line Line on the plane
@param point Point on the plane | [
"Computes",
"the",
"homography",
"based",
"on",
"a",
"line",
"and",
"point",
"on",
"the",
"plane"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyInducedStereoLinePt.java#L93-L115 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.unzip | @SuppressWarnings("unchecked")
public static File unzip(File zipFile, File outFile, Charset charset) throws UtilException {
charset = (null == charset) ? DEFAULT_CHARSET : charset;
ZipFile zipFileObj = null;
try {
zipFileObj = new ZipFile(zipFile, charset);
final Enumeration<ZipEntry> em = (Enumeration<ZipEntry>) zipFileObj.entries();
ZipEntry zipEntry = null;
File outItemFile = null;
while (em.hasMoreElements()) {
zipEntry = em.nextElement();
//FileUtil.file会检查slip漏洞,漏洞说明见http://blog.nsfocus.net/zip-slip-2/
outItemFile = FileUtil.file(outFile, zipEntry.getName());
if (zipEntry.isDirectory()) {
outItemFile.mkdirs();
} else {
FileUtil.touch(outItemFile);
copy(zipFileObj, zipEntry, outItemFile);
}
}
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(zipFileObj);
}
return outFile;
} | java | @SuppressWarnings("unchecked")
public static File unzip(File zipFile, File outFile, Charset charset) throws UtilException {
charset = (null == charset) ? DEFAULT_CHARSET : charset;
ZipFile zipFileObj = null;
try {
zipFileObj = new ZipFile(zipFile, charset);
final Enumeration<ZipEntry> em = (Enumeration<ZipEntry>) zipFileObj.entries();
ZipEntry zipEntry = null;
File outItemFile = null;
while (em.hasMoreElements()) {
zipEntry = em.nextElement();
//FileUtil.file会检查slip漏洞,漏洞说明见http://blog.nsfocus.net/zip-slip-2/
outItemFile = FileUtil.file(outFile, zipEntry.getName());
if (zipEntry.isDirectory()) {
outItemFile.mkdirs();
} else {
FileUtil.touch(outItemFile);
copy(zipFileObj, zipEntry, outItemFile);
}
}
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(zipFileObj);
}
return outFile;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"File",
"unzip",
"(",
"File",
"zipFile",
",",
"File",
"outFile",
",",
"Charset",
"charset",
")",
"throws",
"UtilException",
"{",
"charset",
"=",
"(",
"null",
"==",
"charset",
")",
"?",
... | 解压
@param zipFile zip文件
@param outFile 解压到的目录
@param charset 编码
@return 解压的目录
@throws UtilException IO异常
@since 3.2.2 | [
"解压"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L384-L411 |
ogaclejapan/SmartTabLayout | utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java | Bundler.putStringArrayList | public Bundler putStringArrayList(String key, ArrayList<String> value) {
bundle.putStringArrayList(key, value);
return this;
} | java | public Bundler putStringArrayList(String key, ArrayList<String> value) {
bundle.putStringArrayList(key, value);
return this;
} | [
"public",
"Bundler",
"putStringArrayList",
"(",
"String",
"key",
",",
"ArrayList",
"<",
"String",
">",
"value",
")",
"{",
"bundle",
".",
"putStringArrayList",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts an ArrayList<String> value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value an ArrayList<String> object, or null
@return this | [
"Inserts",
"an",
"ArrayList<String",
">",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L238-L241 |
spring-projects/spring-security-oauth | spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/DefaultOAuth2AccessToken.java | DefaultOAuth2AccessToken.setAdditionalInformation | public void setAdditionalInformation(Map<String, Object> additionalInformation) {
this.additionalInformation = new LinkedHashMap<String, Object>(additionalInformation);
} | java | public void setAdditionalInformation(Map<String, Object> additionalInformation) {
this.additionalInformation = new LinkedHashMap<String, Object>(additionalInformation);
} | [
"public",
"void",
"setAdditionalInformation",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"additionalInformation",
")",
"{",
"this",
".",
"additionalInformation",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Object",
">",
"(",
"additionalInformation",
")",... | Additional information that token granters would like to add to the token, e.g. to support new token types. If
the values in the map are primitive then remote communication is going to always work. It should also be safe to
use maps (nested if desired), or something that is explicitly serializable by Jackson.
@param additionalInformation the additional information to set | [
"Additional",
"information",
"that",
"token",
"granters",
"would",
"like",
"to",
"add",
"to",
"the",
"token",
"e",
".",
"g",
".",
"to",
"support",
"new",
"token",
"types",
".",
"If",
"the",
"values",
"in",
"the",
"map",
"are",
"primitive",
"then",
"remot... | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/DefaultOAuth2AccessToken.java#L235-L237 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java | PathOverrideService.setGroupsForPath | public void setGroupsForPath(Integer[] groups, int pathId) {
String newGroups = Arrays.toString(groups);
newGroups = newGroups.substring(1, newGroups.length() - 1).replaceAll("\\s", "");
logger.info("adding groups={}, to pathId={}", newGroups, pathId);
EditService.updatePathTable(Constants.PATH_PROFILE_GROUP_IDS, newGroups, pathId);
} | java | public void setGroupsForPath(Integer[] groups, int pathId) {
String newGroups = Arrays.toString(groups);
newGroups = newGroups.substring(1, newGroups.length() - 1).replaceAll("\\s", "");
logger.info("adding groups={}, to pathId={}", newGroups, pathId);
EditService.updatePathTable(Constants.PATH_PROFILE_GROUP_IDS, newGroups, pathId);
} | [
"public",
"void",
"setGroupsForPath",
"(",
"Integer",
"[",
"]",
"groups",
",",
"int",
"pathId",
")",
"{",
"String",
"newGroups",
"=",
"Arrays",
".",
"toString",
"(",
"groups",
")",
";",
"newGroups",
"=",
"newGroups",
".",
"substring",
"(",
"1",
",",
"new... | Set the groups assigned to a path
@param groups group IDs to set
@param pathId ID of path | [
"Set",
"the",
"groups",
"assigned",
"to",
"a",
"path"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L295-L301 |
rampatra/jbot | jbot/src/main/java/me/ramswaroop/jbot/core/slack/SlackService.java | SlackService.getImChannels | private void getImChannels(String slackToken, int limit, String nextCursor) {
try {
Event event = restTemplate.getForEntity(slackApiEndpoints.getImListApi(), Event.class,
slackToken, limit, nextCursor).getBody();
imChannelIds.addAll(Arrays.stream(event.getIms()).map(Channel::getId).collect(Collectors.toList()));
if (event.getResponseMetadata() != null &&
!StringUtils.isEmpty(event.getResponseMetadata().getNextCursor())) {
Thread.sleep(5000L); // sleep because its a tier 2 api which allows only 20 calls per minute
getImChannels(slackToken, limit, event.getResponseMetadata().getNextCursor());
}
} catch (Exception e) {
logger.error("Error fetching im channels for the bot: ", e);
}
} | java | private void getImChannels(String slackToken, int limit, String nextCursor) {
try {
Event event = restTemplate.getForEntity(slackApiEndpoints.getImListApi(), Event.class,
slackToken, limit, nextCursor).getBody();
imChannelIds.addAll(Arrays.stream(event.getIms()).map(Channel::getId).collect(Collectors.toList()));
if (event.getResponseMetadata() != null &&
!StringUtils.isEmpty(event.getResponseMetadata().getNextCursor())) {
Thread.sleep(5000L); // sleep because its a tier 2 api which allows only 20 calls per minute
getImChannels(slackToken, limit, event.getResponseMetadata().getNextCursor());
}
} catch (Exception e) {
logger.error("Error fetching im channels for the bot: ", e);
}
} | [
"private",
"void",
"getImChannels",
"(",
"String",
"slackToken",
",",
"int",
"limit",
",",
"String",
"nextCursor",
")",
"{",
"try",
"{",
"Event",
"event",
"=",
"restTemplate",
".",
"getForEntity",
"(",
"slackApiEndpoints",
".",
"getImListApi",
"(",
")",
",",
... | Fetch all im channels to determine direct message to the bot.
@param slackToken slack token which you get from slack for the integration you create
@param limit number of channels to fetch in one call
@param nextCursor cursor for the next call | [
"Fetch",
"all",
"im",
"channels",
"to",
"determine",
"direct",
"message",
"to",
"the",
"bot",
"."
] | train | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/slack/SlackService.java#L62-L75 |
protostuff/protostuff | protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java | XmlIOUtil.parseListFrom | public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema)
throws IOException
{
return parseListFrom(in, schema, DEFAULT_INPUT_FACTORY);
} | java | public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema)
throws IOException
{
return parseListFrom(in, schema, DEFAULT_INPUT_FACTORY);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"parseListFrom",
"(",
"InputStream",
"in",
",",
"Schema",
"<",
"T",
">",
"schema",
")",
"throws",
"IOException",
"{",
"return",
"parseListFrom",
"(",
"in",
",",
"schema",
",",
"DEFAULT_INPUT_FACTORY... | Parses the {@code messages} from the {@link InputStream} using the given {@code schema}. | [
"Parses",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L530-L534 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java | XHTMLManager.isServiceEnabled | public static boolean isServiceEnabled(XMPPConnection connection, Jid userID)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, XHTMLExtension.NAMESPACE);
} | java | public static boolean isServiceEnabled(XMPPConnection connection, Jid userID)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return ServiceDiscoveryManager.getInstanceFor(connection).supportsFeature(userID, XHTMLExtension.NAMESPACE);
} | [
"public",
"static",
"boolean",
"isServiceEnabled",
"(",
"XMPPConnection",
"connection",
",",
"Jid",
"userID",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"return",
"ServiceDiscoveryManager"... | Returns true if the specified user handles XHTML messages.
@param connection the connection to use to perform the service discovery
@param userID the user to check. A fully qualified xmpp ID, e.g. jdoe@example.com
@return a boolean indicating whether the specified user handles XHTML messages
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Returns",
"true",
"if",
"the",
"specified",
"user",
"handles",
"XHTML",
"messages",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java#L137-L140 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java | OrganizationResource.addCorporateGroupIdPrefix | @POST
@Path("/{name}" + ServerAPI.GET_CORPORATE_GROUPIDS)
public Response addCorporateGroupIdPrefix(@Auth final DbCredential credential, @PathParam("name") final String organizationId, final String corporateGroupId){
LOG.info("Got an add a corporate groupId prefix request for organization " + organizationId +".");
if(!credential.getRoles().contains(DbCredential.AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
if(corporateGroupId == null || corporateGroupId.isEmpty()){
LOG.error("No corporate GroupId to add!");
throw new WebApplicationException(Response.serverError().status(HttpStatus.BAD_REQUEST_400)
.entity("CorporateGroupId to add should be in the query content.").build());
}
getOrganizationHandler().addCorporateGroupId(organizationId, corporateGroupId);
return Response.ok().status(HttpStatus.CREATED_201).build();
} | java | @POST
@Path("/{name}" + ServerAPI.GET_CORPORATE_GROUPIDS)
public Response addCorporateGroupIdPrefix(@Auth final DbCredential credential, @PathParam("name") final String organizationId, final String corporateGroupId){
LOG.info("Got an add a corporate groupId prefix request for organization " + organizationId +".");
if(!credential.getRoles().contains(DbCredential.AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
if(corporateGroupId == null || corporateGroupId.isEmpty()){
LOG.error("No corporate GroupId to add!");
throw new WebApplicationException(Response.serverError().status(HttpStatus.BAD_REQUEST_400)
.entity("CorporateGroupId to add should be in the query content.").build());
}
getOrganizationHandler().addCorporateGroupId(organizationId, corporateGroupId);
return Response.ok().status(HttpStatus.CREATED_201).build();
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"/{name}\"",
"+",
"ServerAPI",
".",
"GET_CORPORATE_GROUPIDS",
")",
"public",
"Response",
"addCorporateGroupIdPrefix",
"(",
"@",
"Auth",
"final",
"DbCredential",
"credential",
",",
"@",
"PathParam",
"(",
"\"name\"",
")",
"final",
... | Add a new Corporate GroupId to an organization.
@param credential DbCredential
@param organizationId String Organization name
@param corporateGroupId String
@return Response | [
"Add",
"a",
"new",
"Corporate",
"GroupId",
"to",
"an",
"organization",
"."
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java#L149-L165 |
sniggle/simple-pgp | simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java | BasePGPCommon.readPublicKeyRing | protected PGPPublicKeyRing readPublicKeyRing(InputStream publicKey) {
LOGGER.trace("readPublicKeyRing(InputStream)");
PGPPublicKeyRing result = null;
LOGGER.debug("Wrapping public key stream in decoder stream");
try( InputStream decoderStream = PGPUtil.getDecoderStream(publicKey) ) {
LOGGER.debug("Creating PGP Object Factory");
PGPObjectFactory pgpObjectFactory = new PGPObjectFactory(decoderStream, new BcKeyFingerprintCalculator());
Object o = null;
LOGGER.debug("Looking up PGP Public KeyRing");
while( (o = pgpObjectFactory.nextObject()) != null && result == null ) {
if( o instanceof PGPPublicKeyRing ) {
LOGGER.info("PGP Public KeyRing retrieved");
result = (PGPPublicKeyRing)o;
}
}
} catch (IOException e) {
LOGGER.error("{}", e.getMessage());
}
return result;
} | java | protected PGPPublicKeyRing readPublicKeyRing(InputStream publicKey) {
LOGGER.trace("readPublicKeyRing(InputStream)");
PGPPublicKeyRing result = null;
LOGGER.debug("Wrapping public key stream in decoder stream");
try( InputStream decoderStream = PGPUtil.getDecoderStream(publicKey) ) {
LOGGER.debug("Creating PGP Object Factory");
PGPObjectFactory pgpObjectFactory = new PGPObjectFactory(decoderStream, new BcKeyFingerprintCalculator());
Object o = null;
LOGGER.debug("Looking up PGP Public KeyRing");
while( (o = pgpObjectFactory.nextObject()) != null && result == null ) {
if( o instanceof PGPPublicKeyRing ) {
LOGGER.info("PGP Public KeyRing retrieved");
result = (PGPPublicKeyRing)o;
}
}
} catch (IOException e) {
LOGGER.error("{}", e.getMessage());
}
return result;
} | [
"protected",
"PGPPublicKeyRing",
"readPublicKeyRing",
"(",
"InputStream",
"publicKey",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"readPublicKeyRing(InputStream)\"",
")",
";",
"PGPPublicKeyRing",
"result",
"=",
"null",
";",
"LOGGER",
".",
"debug",
"(",
"\"Wrapping publi... | reads the public key ring from the input stream
@param publicKey
the public key stream
@return the public key ring | [
"reads",
"the",
"public",
"key",
"ring",
"from",
"the",
"input",
"stream"
] | train | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L322-L341 |
timtiemens/secretshare | src/main/java/com/tiemens/secretshare/engine/SecretShare.java | SecretShare.combineParanoid | public ParanoidOutput combineParanoid(List<ShareInfo> shares,
ParanoidInput paranoidInput)
{
ParanoidOutput ret = performParanoidCombines(shares, paranoidInput);
if (paranoidInput != null)
{
if (ret.getReconstructedMap().size() != 1)
{
throw new SecretShareException("Paranoid combine failed, on combination at count=" + ret.getCount());
}
}
return ret;
} | java | public ParanoidOutput combineParanoid(List<ShareInfo> shares,
ParanoidInput paranoidInput)
{
ParanoidOutput ret = performParanoidCombines(shares, paranoidInput);
if (paranoidInput != null)
{
if (ret.getReconstructedMap().size() != 1)
{
throw new SecretShareException("Paranoid combine failed, on combination at count=" + ret.getCount());
}
}
return ret;
} | [
"public",
"ParanoidOutput",
"combineParanoid",
"(",
"List",
"<",
"ShareInfo",
">",
"shares",
",",
"ParanoidInput",
"paranoidInput",
")",
"{",
"ParanoidOutput",
"ret",
"=",
"performParanoidCombines",
"(",
"shares",
",",
"paranoidInput",
")",
";",
"if",
"(",
"parano... | This version does the combines, and throws an exception if there is not 100% agreement.
@param shares - all shares available to make unique subsets from
@param paranoidInput control over the process
@return ParanoidOutput
@throws SecretShareException if there is not 100% agreement on the reconstructed secret | [
"This",
"version",
"does",
"the",
"combines",
"and",
"throws",
"an",
"exception",
"if",
"there",
"is",
"not",
"100%",
"agreement",
"."
] | train | https://github.com/timtiemens/secretshare/blob/f5f88929af99ae0ed0df02dc802e40cdb25fceac/src/main/java/com/tiemens/secretshare/engine/SecretShare.java#L1142-L1156 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java | AbstractHibernateDao.getAllBySql | public List< T> getAllBySql(String fullSql, Integer offset, Integer limit) {
return getAllBySql(fullSql, null, null, offset, limit);
} | java | public List< T> getAllBySql(String fullSql, Integer offset, Integer limit) {
return getAllBySql(fullSql, null, null, offset, limit);
} | [
"public",
"List",
"<",
"T",
">",
"getAllBySql",
"(",
"String",
"fullSql",
",",
"Integer",
"offset",
",",
"Integer",
"limit",
")",
"{",
"return",
"getAllBySql",
"(",
"fullSql",
",",
"null",
",",
"null",
",",
"offset",
",",
"limit",
")",
";",
"}"
] | Get all by SQL with specific offset and limit
@param fullSql
@param offset the number of first record in the whole query result to be returned, records numbers start from 0
@param limit the maximum number of records to return
@return the query result | [
"Get",
"all",
"by",
"SQL",
"with",
"specific",
"offset",
"and",
"limit"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L232-L234 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/embeddings/KerasEmbedding.java | KerasEmbedding.getInputDimFromConfig | private int getInputDimFromConfig(Map<String, Object> layerConfig) throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
if (!innerConfig.containsKey(conf.getLAYER_FIELD_INPUT_DIM()))
throw new InvalidKerasConfigurationException(
"Keras Embedding layer config missing " + conf.getLAYER_FIELD_INPUT_DIM() + " field");
return (int) innerConfig.get(conf.getLAYER_FIELD_INPUT_DIM());
} | java | private int getInputDimFromConfig(Map<String, Object> layerConfig) throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
if (!innerConfig.containsKey(conf.getLAYER_FIELD_INPUT_DIM()))
throw new InvalidKerasConfigurationException(
"Keras Embedding layer config missing " + conf.getLAYER_FIELD_INPUT_DIM() + " field");
return (int) innerConfig.get(conf.getLAYER_FIELD_INPUT_DIM());
} | [
"private",
"int",
"getInputDimFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"innerConfig",
"=",
"KerasLayerUtils",
".",
"getInnerLayerCon... | Get Keras input dimension from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return input dim as int | [
"Get",
"Keras",
"input",
"dimension",
"from",
"Keras",
"layer",
"configuration",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/embeddings/KerasEmbedding.java#L229-L235 |
zandero/rest.vertx | src/main/java/com/zandero/rest/AnnotationProcessor.java | AnnotationProcessor.getDefinitions | private static Map<RouteDefinition, Method> getDefinitions(Class clazz) {
Assert.notNull(clazz, "Missing class with JAX-RS annotations!");
// base
RouteDefinition root = new RouteDefinition(clazz);
// go over methods ...
Map<RouteDefinition, Method> output = new LinkedHashMap<>();
for (Method method : clazz.getMethods()) {
if (isRestCompatible(method)) { // Path must be present
try {
RouteDefinition definition = new RouteDefinition(root, method);
output.put(definition, method);
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException(getClassMethod(clazz, method) + " - " + e.getMessage());
}
}
}
return output;
} | java | private static Map<RouteDefinition, Method> getDefinitions(Class clazz) {
Assert.notNull(clazz, "Missing class with JAX-RS annotations!");
// base
RouteDefinition root = new RouteDefinition(clazz);
// go over methods ...
Map<RouteDefinition, Method> output = new LinkedHashMap<>();
for (Method method : clazz.getMethods()) {
if (isRestCompatible(method)) { // Path must be present
try {
RouteDefinition definition = new RouteDefinition(root, method);
output.put(definition, method);
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException(getClassMethod(clazz, method) + " - " + e.getMessage());
}
}
}
return output;
} | [
"private",
"static",
"Map",
"<",
"RouteDefinition",
",",
"Method",
">",
"getDefinitions",
"(",
"Class",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Missing class with JAX-RS annotations!\"",
")",
";",
"// base",
"RouteDefinition",
"root",
"=... | Checks class for JAX-RS annotations and returns a list of route definitions to build routes upon
@param clazz to be checked
@return list of definitions or empty list if none present | [
"Checks",
"class",
"for",
"JAX",
"-",
"RS",
"annotations",
"and",
"returns",
"a",
"list",
"of",
"route",
"definitions",
"to",
"build",
"routes",
"upon"
] | train | https://github.com/zandero/rest.vertx/blob/ba458720cf59e076953eab9dac7227eeaf9e58ce/src/main/java/com/zandero/rest/AnnotationProcessor.java#L186-L211 |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java | DeploymentResourceSupport.hasDeploymentSubModel | public boolean hasDeploymentSubModel(final String subsystemName, final PathElement address) {
final Resource root = deploymentUnit.getAttachment(DEPLOYMENT_RESOURCE);
final PathElement subsystem = PathElement.pathElement(SUBSYSTEM, subsystemName);
return root.hasChild(subsystem) && (address == null || root.getChild(subsystem).hasChild(address));
} | java | public boolean hasDeploymentSubModel(final String subsystemName, final PathElement address) {
final Resource root = deploymentUnit.getAttachment(DEPLOYMENT_RESOURCE);
final PathElement subsystem = PathElement.pathElement(SUBSYSTEM, subsystemName);
return root.hasChild(subsystem) && (address == null || root.getChild(subsystem).hasChild(address));
} | [
"public",
"boolean",
"hasDeploymentSubModel",
"(",
"final",
"String",
"subsystemName",
",",
"final",
"PathElement",
"address",
")",
"{",
"final",
"Resource",
"root",
"=",
"deploymentUnit",
".",
"getAttachment",
"(",
"DEPLOYMENT_RESOURCE",
")",
";",
"final",
"PathEle... | Checks to see if a resource has already been registered for the specified address on the subsystem.
@param subsystemName the name of the subsystem
@param address the address to check
@return {@code true} if the address exists on the subsystem otherwise {@code false} | [
"Checks",
"to",
"see",
"if",
"a",
"resource",
"has",
"already",
"been",
"registered",
"for",
"the",
"specified",
"address",
"on",
"the",
"subsystem",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java#L105-L109 |
joniles/mpxj | src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java | FastTrackData.readColumnBlock | private void readColumnBlock(int startIndex, int blockLength) throws Exception
{
int endIndex = startIndex + blockLength;
List<Integer> blocks = new ArrayList<Integer>();
for (int index = startIndex; index < endIndex - 11; index++)
{
if (matchChildBlock(index))
{
int childBlockStart = index - 2;
blocks.add(Integer.valueOf(childBlockStart));
}
}
blocks.add(Integer.valueOf(endIndex));
int childBlockStart = -1;
for (int childBlockEnd : blocks)
{
if (childBlockStart != -1)
{
int childblockLength = childBlockEnd - childBlockStart;
try
{
readColumn(childBlockStart, childblockLength);
}
catch (UnexpectedStructureException ex)
{
logUnexpectedStructure();
}
}
childBlockStart = childBlockEnd;
}
} | java | private void readColumnBlock(int startIndex, int blockLength) throws Exception
{
int endIndex = startIndex + blockLength;
List<Integer> blocks = new ArrayList<Integer>();
for (int index = startIndex; index < endIndex - 11; index++)
{
if (matchChildBlock(index))
{
int childBlockStart = index - 2;
blocks.add(Integer.valueOf(childBlockStart));
}
}
blocks.add(Integer.valueOf(endIndex));
int childBlockStart = -1;
for (int childBlockEnd : blocks)
{
if (childBlockStart != -1)
{
int childblockLength = childBlockEnd - childBlockStart;
try
{
readColumn(childBlockStart, childblockLength);
}
catch (UnexpectedStructureException ex)
{
logUnexpectedStructure();
}
}
childBlockStart = childBlockEnd;
}
} | [
"private",
"void",
"readColumnBlock",
"(",
"int",
"startIndex",
",",
"int",
"blockLength",
")",
"throws",
"Exception",
"{",
"int",
"endIndex",
"=",
"startIndex",
"+",
"blockLength",
";",
"List",
"<",
"Integer",
">",
"blocks",
"=",
"new",
"ArrayList",
"<",
"I... | Read multiple columns from a block.
@param startIndex start of the block
@param blockLength length of the block | [
"Read",
"multiple",
"columns",
"from",
"a",
"block",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L193-L224 |
galenframework/galen | galen-core/src/main/java/com/galenframework/generator/SpecGenerator.java | SpecGenerator.restructurePageItems | private List<PageItemNode> restructurePageItems(List<PageItem> items) {
List<PageItemNode> pins = items.stream().map(PageItemNode::new).collect(toList());
for (PageItemNode pinA : pins) {
for (PageItemNode pinB: pins) {
if (pinA != pinB) {
if (isInside(pinA.getPageItem().getArea(), pinB.getPageItem().getArea())) {
if (pinB.getParent() == pinA) {
throw new RuntimeException(format("The following objects have identical areas: %s, %s. Please remove one of the objects", pinA.getPageItem().getName(), pinB.getPageItem().getName()));
}
pinA.moveToParent(pinB);
break;
}
}
}
}
return pins.stream().filter(pin -> pin.getParent() == null && pin.getChildren().size() > 0).collect(toList());
} | java | private List<PageItemNode> restructurePageItems(List<PageItem> items) {
List<PageItemNode> pins = items.stream().map(PageItemNode::new).collect(toList());
for (PageItemNode pinA : pins) {
for (PageItemNode pinB: pins) {
if (pinA != pinB) {
if (isInside(pinA.getPageItem().getArea(), pinB.getPageItem().getArea())) {
if (pinB.getParent() == pinA) {
throw new RuntimeException(format("The following objects have identical areas: %s, %s. Please remove one of the objects", pinA.getPageItem().getName(), pinB.getPageItem().getName()));
}
pinA.moveToParent(pinB);
break;
}
}
}
}
return pins.stream().filter(pin -> pin.getParent() == null && pin.getChildren().size() > 0).collect(toList());
} | [
"private",
"List",
"<",
"PageItemNode",
">",
"restructurePageItems",
"(",
"List",
"<",
"PageItem",
">",
"items",
")",
"{",
"List",
"<",
"PageItemNode",
">",
"pins",
"=",
"items",
".",
"stream",
"(",
")",
".",
"map",
"(",
"PageItemNode",
"::",
"new",
")",... | Orders page items into a tree by their area. Tries to fit one item inside another
@param items
@return A list of pins which are root elements (don't have a parent) | [
"Orders",
"page",
"items",
"into",
"a",
"tree",
"by",
"their",
"area",
".",
"Tries",
"to",
"fit",
"one",
"item",
"inside",
"another"
] | train | https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/generator/SpecGenerator.java#L145-L161 |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/IOUtils.java | IOUtils.pollFile | public static Object pollFile(File file, int timeout, int interval)
throws InterruptedException {
// Convert time from s to ms for Thread
int fullTimeout = Math.round(timeout * 1000);
// Split up the timeout to poll every x amount of time
int timeoutShard = Math.round(fullTimeout / interval);
// Poll until file exists, return if it exists
for (int i = 0; i < interval; i++) {
Thread.sleep(timeoutShard);
if (file.exists()) {
return readObjectFromFile(file);
}
}
// Return null if time is up and still no file
return null;
} | java | public static Object pollFile(File file, int timeout, int interval)
throws InterruptedException {
// Convert time from s to ms for Thread
int fullTimeout = Math.round(timeout * 1000);
// Split up the timeout to poll every x amount of time
int timeoutShard = Math.round(fullTimeout / interval);
// Poll until file exists, return if it exists
for (int i = 0; i < interval; i++) {
Thread.sleep(timeoutShard);
if (file.exists()) {
return readObjectFromFile(file);
}
}
// Return null if time is up and still no file
return null;
} | [
"public",
"static",
"Object",
"pollFile",
"(",
"File",
"file",
",",
"int",
"timeout",
",",
"int",
"interval",
")",
"throws",
"InterruptedException",
"{",
"// Convert time from s to ms for Thread\r",
"int",
"fullTimeout",
"=",
"Math",
".",
"round",
"(",
"timeout",
... | Polls a file periodically until it 1) exists or 2) the timeout is
exceeded (returns null) Reads the file as a java Object | [
"Polls",
"a",
"file",
"periodically",
"until",
"it",
"1",
")",
"exists",
"or",
"2",
")",
"the",
"timeout",
"is",
"exceeded",
"(",
"returns",
"null",
")",
"Reads",
"the",
"file",
"as",
"a",
"java",
"Object"
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/IOUtils.java#L208-L226 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF6.java | CommonOps_DDF6.fill | public static void fill( DMatrix6 a , double v ) {
a.a1 = v;
a.a2 = v;
a.a3 = v;
a.a4 = v;
a.a5 = v;
a.a6 = v;
} | java | public static void fill( DMatrix6 a , double v ) {
a.a1 = v;
a.a2 = v;
a.a3 = v;
a.a4 = v;
a.a5 = v;
a.a6 = v;
} | [
"public",
"static",
"void",
"fill",
"(",
"DMatrix6",
"a",
",",
"double",
"v",
")",
"{",
"a",
".",
"a1",
"=",
"v",
";",
"a",
".",
"a2",
"=",
"v",
";",
"a",
".",
"a3",
"=",
"v",
";",
"a",
".",
"a4",
"=",
"v",
";",
"a",
".",
"a5",
"=",
"v"... | <p>
Sets every element in the vector to the specified value.<br>
<br>
a<sub>i</sub> = value
<p>
@param a A vector whose elements are about to be set. Modified.
@param v The value each element will have. | [
"<p",
">",
"Sets",
"every",
"element",
"in",
"the",
"vector",
"to",
"the",
"specified",
"value",
".",
"<br",
">",
"<br",
">",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"value",
"<p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF6.java#L2133-L2140 |
xebia/Xebium | src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java | SeleniumDriverFixture.addAliasForLocator | public void addAliasForLocator(String alias, String locator) {
LOG.info("Add alias: '" + alias + "' for '" + locator + "'");
aliases.put(alias, locator);
} | java | public void addAliasForLocator(String alias, String locator) {
LOG.info("Add alias: '" + alias + "' for '" + locator + "'");
aliases.put(alias, locator);
} | [
"public",
"void",
"addAliasForLocator",
"(",
"String",
"alias",
",",
"String",
"locator",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Add alias: '\"",
"+",
"alias",
"+",
"\"' for '\"",
"+",
"locator",
"+",
"\"'\"",
")",
";",
"aliases",
".",
"put",
"(",
"alias",
... | Add a new locator alias to the fixture.
@param alias
@param locator | [
"Add",
"a",
"new",
"locator",
"alias",
"to",
"the",
"fixture",
"."
] | train | https://github.com/xebia/Xebium/blob/594f6d9e65622acdbd03dba0700b17645981da1f/src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java#L446-L449 |
apache/reef | lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java | HelloDriver.onNextJVM | void onNextJVM(final AllocatedEvaluator allocatedEvaluator) {
try {
final Configuration contextConfiguration = ContextConfiguration.CONF
.set(ContextConfiguration.IDENTIFIER, "HelloREEFContext")
.build();
final Configuration taskConfiguration = TaskConfiguration.CONF
.set(TaskConfiguration.IDENTIFIER, "HelloREEFTask")
.set(TaskConfiguration.TASK, HelloTask.class)
.build();
allocatedEvaluator.submitContextAndTask(contextConfiguration, taskConfiguration);
} catch (final BindException ex) {
final String message = "Unable to setup Task or Context configuration.";
LOG.log(Level.SEVERE, message, ex);
throw new RuntimeException(message, ex);
}
} | java | void onNextJVM(final AllocatedEvaluator allocatedEvaluator) {
try {
final Configuration contextConfiguration = ContextConfiguration.CONF
.set(ContextConfiguration.IDENTIFIER, "HelloREEFContext")
.build();
final Configuration taskConfiguration = TaskConfiguration.CONF
.set(TaskConfiguration.IDENTIFIER, "HelloREEFTask")
.set(TaskConfiguration.TASK, HelloTask.class)
.build();
allocatedEvaluator.submitContextAndTask(contextConfiguration, taskConfiguration);
} catch (final BindException ex) {
final String message = "Unable to setup Task or Context configuration.";
LOG.log(Level.SEVERE, message, ex);
throw new RuntimeException(message, ex);
}
} | [
"void",
"onNextJVM",
"(",
"final",
"AllocatedEvaluator",
"allocatedEvaluator",
")",
"{",
"try",
"{",
"final",
"Configuration",
"contextConfiguration",
"=",
"ContextConfiguration",
".",
"CONF",
".",
"set",
"(",
"ContextConfiguration",
".",
"IDENTIFIER",
",",
"\"HelloRE... | Uses the AllocatedEvaluator to launch a JVM task.
@param allocatedEvaluator | [
"Uses",
"the",
"AllocatedEvaluator",
"to",
"launch",
"a",
"JVM",
"task",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java#L138-L155 |
infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java | PrepareCoordinator.onePhaseCommitRemoteTransaction | public int onePhaseCommitRemoteTransaction(GlobalTransaction gtx, List<WriteCommand> modifications) {
RpcManager rpcManager = cache.getRpcManager();
CommandsFactory factory = cache.getComponentRegistry().getCommandsFactory();
try {
//only pessimistic tx are committed in 1PC and it doesn't use versions.
PrepareCommand command = factory.buildPrepareCommand(gtx, modifications, true);
CompletionStage<Void> cs = rpcManager.invokeCommandOnAll(command, validOnly(), rpcManager.getSyncRpcOptions());
factory.initializeReplicableCommand(command, false);
command.invokeAsync().join();
cs.toCompletableFuture().join();
forgetTransaction(gtx, rpcManager, factory);
return loggingCompleted(true) == Status.OK ?
XAResource.XA_OK :
XAException.XAER_RMERR;
} catch (Throwable throwable) {
//transaction should commit but we still can have exceptions (timeouts or similar)
return XAException.XAER_RMERR;
}
} | java | public int onePhaseCommitRemoteTransaction(GlobalTransaction gtx, List<WriteCommand> modifications) {
RpcManager rpcManager = cache.getRpcManager();
CommandsFactory factory = cache.getComponentRegistry().getCommandsFactory();
try {
//only pessimistic tx are committed in 1PC and it doesn't use versions.
PrepareCommand command = factory.buildPrepareCommand(gtx, modifications, true);
CompletionStage<Void> cs = rpcManager.invokeCommandOnAll(command, validOnly(), rpcManager.getSyncRpcOptions());
factory.initializeReplicableCommand(command, false);
command.invokeAsync().join();
cs.toCompletableFuture().join();
forgetTransaction(gtx, rpcManager, factory);
return loggingCompleted(true) == Status.OK ?
XAResource.XA_OK :
XAException.XAER_RMERR;
} catch (Throwable throwable) {
//transaction should commit but we still can have exceptions (timeouts or similar)
return XAException.XAER_RMERR;
}
} | [
"public",
"int",
"onePhaseCommitRemoteTransaction",
"(",
"GlobalTransaction",
"gtx",
",",
"List",
"<",
"WriteCommand",
">",
"modifications",
")",
"{",
"RpcManager",
"rpcManager",
"=",
"cache",
".",
"getRpcManager",
"(",
")",
";",
"CommandsFactory",
"factory",
"=",
... | Commits a remote 1PC transaction that is already in MARK_COMMIT state | [
"Commits",
"a",
"remote",
"1PC",
"transaction",
"that",
"is",
"already",
"in",
"MARK_COMMIT",
"state"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java#L217-L235 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.minByLong | public OptionalInt minByLong(IntToLongFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, i) -> {
long key = keyExtractor.applyAsLong(i);
if (!box.b || box.l > key) {
box.b = true;
box.l = key;
box.i = i;
}
}, PrimitiveBox.MIN_LONG).asInt();
} | java | public OptionalInt minByLong(IntToLongFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, i) -> {
long key = keyExtractor.applyAsLong(i);
if (!box.b || box.l > key) {
box.b = true;
box.l = key;
box.i = i;
}
}, PrimitiveBox.MIN_LONG).asInt();
} | [
"public",
"OptionalInt",
"minByLong",
"(",
"IntToLongFunction",
"keyExtractor",
")",
"{",
"return",
"collect",
"(",
"PrimitiveBox",
"::",
"new",
",",
"(",
"box",
",",
"i",
")",
"->",
"{",
"long",
"key",
"=",
"keyExtractor",
".",
"applyAsLong",
"(",
"i",
")... | Returns the minimum element of this stream according to the provided key
extractor function.
<p>
This is a terminal operation.
@param keyExtractor a non-interfering, stateless function
@return an {@code OptionalInt} describing some element of this stream for
which the lowest value was returned by key extractor, or an empty
{@code OptionalInt} if the stream is empty
@since 0.1.2 | [
"Returns",
"the",
"minimum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"provided",
"key",
"extractor",
"function",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L1037-L1046 |
canoo/dolphin-platform | platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/mbean/DolphinContextMBeanRegistry.java | DolphinContextMBeanRegistry.registerDolphinContext | public Subscription registerDolphinContext(ClientSession session, GarbageCollector garbageCollector) {
Assert.requireNonNull(session, "session");
Assert.requireNonNull(garbageCollector, "garbageCollector");
DolphinSessionInfoMBean mBean = new DolphinSessionInfo(session, garbageCollector);
return MBeanRegistry.getInstance().register(mBean, new MBeanDescription("com.canoo.dolphin", "DolphinSession", "session"));
} | java | public Subscription registerDolphinContext(ClientSession session, GarbageCollector garbageCollector) {
Assert.requireNonNull(session, "session");
Assert.requireNonNull(garbageCollector, "garbageCollector");
DolphinSessionInfoMBean mBean = new DolphinSessionInfo(session, garbageCollector);
return MBeanRegistry.getInstance().register(mBean, new MBeanDescription("com.canoo.dolphin", "DolphinSession", "session"));
} | [
"public",
"Subscription",
"registerDolphinContext",
"(",
"ClientSession",
"session",
",",
"GarbageCollector",
"garbageCollector",
")",
"{",
"Assert",
".",
"requireNonNull",
"(",
"session",
",",
"\"session\"",
")",
";",
"Assert",
".",
"requireNonNull",
"(",
"garbageCol... | Register a new dolphin session as a MBean
@param session the session
@return the subscription for deregistration | [
"Register",
"a",
"new",
"dolphin",
"session",
"as",
"a",
"MBean"
] | train | https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/mbean/DolphinContextMBeanRegistry.java#L48-L53 |
OpenVidu/openvidu | openvidu-server/src/main/java/io/openvidu/server/core/SessionManager.java | SessionManager.getParticipants | public Set<Participant> getParticipants(String sessionId) throws OpenViduException {
Session session = sessions.get(sessionId);
if (session == null) {
throw new OpenViduException(Code.ROOM_NOT_FOUND_ERROR_CODE, "Session '" + sessionId + "' not found");
}
Set<Participant> participants = session.getParticipants();
participants.removeIf(p -> p.isClosed());
return participants;
} | java | public Set<Participant> getParticipants(String sessionId) throws OpenViduException {
Session session = sessions.get(sessionId);
if (session == null) {
throw new OpenViduException(Code.ROOM_NOT_FOUND_ERROR_CODE, "Session '" + sessionId + "' not found");
}
Set<Participant> participants = session.getParticipants();
participants.removeIf(p -> p.isClosed());
return participants;
} | [
"public",
"Set",
"<",
"Participant",
">",
"getParticipants",
"(",
"String",
"sessionId",
")",
"throws",
"OpenViduException",
"{",
"Session",
"session",
"=",
"sessions",
".",
"get",
"(",
"sessionId",
")",
";",
"if",
"(",
"session",
"==",
"null",
")",
"{",
"... | Returns all the participants inside a session.
@param sessionId identifier of the session
@return set of {@link Participant}
@throws OpenViduException in case the session doesn't exist | [
"Returns",
"all",
"the",
"participants",
"inside",
"a",
"session",
"."
] | train | https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-server/src/main/java/io/openvidu/server/core/SessionManager.java#L169-L177 |
Impetus/Kundera | src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java | CouchDBSchemaManager.createDesignDocForAggregations | private void createDesignDocForAggregations() throws URISyntaxException, UnsupportedEncodingException, IOException,
ClientProtocolException
{
HttpResponse response = null;
URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase() + CouchDBConstants.URL_SEPARATOR
+ "_design/" + CouchDBConstants.AGGREGATIONS, null, null);
HttpPut put = new HttpPut(uri);
CouchDBDesignDocument designDocument = new CouchDBDesignDocument();
Map<String, MapReduce> views = new HashMap<String, CouchDBDesignDocument.MapReduce>();
designDocument.setLanguage(CouchDBConstants.LANGUAGE);
createViewForCount(views);
createViewForSum(views);
createViewForMax(views);
createViewForMin(views);
createViewForAvg(views);
designDocument.setViews(views);
String jsonObject = gson.toJson(designDocument);
StringEntity entity = new StringEntity(jsonObject);
put.setEntity(entity);
try
{
response = httpClient.execute(httpHost, put, CouchDBUtils.getContext(httpHost));
}
finally
{
CouchDBUtils.closeContent(response);
}
} | java | private void createDesignDocForAggregations() throws URISyntaxException, UnsupportedEncodingException, IOException,
ClientProtocolException
{
HttpResponse response = null;
URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase() + CouchDBConstants.URL_SEPARATOR
+ "_design/" + CouchDBConstants.AGGREGATIONS, null, null);
HttpPut put = new HttpPut(uri);
CouchDBDesignDocument designDocument = new CouchDBDesignDocument();
Map<String, MapReduce> views = new HashMap<String, CouchDBDesignDocument.MapReduce>();
designDocument.setLanguage(CouchDBConstants.LANGUAGE);
createViewForCount(views);
createViewForSum(views);
createViewForMax(views);
createViewForMin(views);
createViewForAvg(views);
designDocument.setViews(views);
String jsonObject = gson.toJson(designDocument);
StringEntity entity = new StringEntity(jsonObject);
put.setEntity(entity);
try
{
response = httpClient.execute(httpHost, put, CouchDBUtils.getContext(httpHost));
}
finally
{
CouchDBUtils.closeContent(response);
}
} | [
"private",
"void",
"createDesignDocForAggregations",
"(",
")",
"throws",
"URISyntaxException",
",",
"UnsupportedEncodingException",
",",
"IOException",
",",
"ClientProtocolException",
"{",
"HttpResponse",
"response",
"=",
"null",
";",
"URI",
"uri",
"=",
"new",
"URI",
... | Creates the design doc for aggregations.
@throws URISyntaxException
the URI syntax exception
@throws UnsupportedEncodingException
the unsupported encoding exception
@throws IOException
Signals that an I/O exception has occurred.
@throws ClientProtocolException
the client protocol exception | [
"Creates",
"the",
"design",
"doc",
"for",
"aggregations",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java#L453-L482 |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.expandSelectItem | private boolean expandSelectItem(
final SqlNode selectItem,
SqlSelect select,
RelDataType targetType,
List<SqlNode> selectItems,
Set<String> aliases,
List<Map.Entry<String, RelDataType>> fields,
final boolean includeSystemVars) {
final SelectScope scope = (SelectScope) getWhereScope(select);
if (expandStar(selectItems, aliases, fields, includeSystemVars, scope,
selectItem)) {
return true;
}
// Expand the select item: fully-qualify columns, and convert
// parentheses-free functions such as LOCALTIME into explicit function
// calls.
SqlNode expanded = expand(selectItem, scope);
final String alias =
deriveAlias(
selectItem,
aliases.size());
// If expansion has altered the natural alias, supply an explicit 'AS'.
final SqlValidatorScope selectScope = getSelectScope(select);
if (expanded != selectItem) {
String newAlias =
deriveAlias(
expanded,
aliases.size());
if (!newAlias.equals(alias)) {
expanded =
SqlStdOperatorTable.AS.createCall(
selectItem.getParserPosition(),
expanded,
new SqlIdentifier(alias, SqlParserPos.ZERO));
deriveTypeImpl(selectScope, expanded);
}
}
selectItems.add(expanded);
aliases.add(alias);
if (expanded != null) {
inferUnknownTypes(targetType, scope, expanded);
}
final RelDataType type = deriveType(selectScope, expanded);
setValidatedNodeType(expanded, type);
fields.add(Pair.of(alias, type));
return false;
} | java | private boolean expandSelectItem(
final SqlNode selectItem,
SqlSelect select,
RelDataType targetType,
List<SqlNode> selectItems,
Set<String> aliases,
List<Map.Entry<String, RelDataType>> fields,
final boolean includeSystemVars) {
final SelectScope scope = (SelectScope) getWhereScope(select);
if (expandStar(selectItems, aliases, fields, includeSystemVars, scope,
selectItem)) {
return true;
}
// Expand the select item: fully-qualify columns, and convert
// parentheses-free functions such as LOCALTIME into explicit function
// calls.
SqlNode expanded = expand(selectItem, scope);
final String alias =
deriveAlias(
selectItem,
aliases.size());
// If expansion has altered the natural alias, supply an explicit 'AS'.
final SqlValidatorScope selectScope = getSelectScope(select);
if (expanded != selectItem) {
String newAlias =
deriveAlias(
expanded,
aliases.size());
if (!newAlias.equals(alias)) {
expanded =
SqlStdOperatorTable.AS.createCall(
selectItem.getParserPosition(),
expanded,
new SqlIdentifier(alias, SqlParserPos.ZERO));
deriveTypeImpl(selectScope, expanded);
}
}
selectItems.add(expanded);
aliases.add(alias);
if (expanded != null) {
inferUnknownTypes(targetType, scope, expanded);
}
final RelDataType type = deriveType(selectScope, expanded);
setValidatedNodeType(expanded, type);
fields.add(Pair.of(alias, type));
return false;
} | [
"private",
"boolean",
"expandSelectItem",
"(",
"final",
"SqlNode",
"selectItem",
",",
"SqlSelect",
"select",
",",
"RelDataType",
"targetType",
",",
"List",
"<",
"SqlNode",
">",
"selectItems",
",",
"Set",
"<",
"String",
">",
"aliases",
",",
"List",
"<",
"Map",
... | If <code>selectItem</code> is "*" or "TABLE.*", expands it and returns
true; otherwise writes the unexpanded item.
@param selectItem Select-list item
@param select Containing select clause
@param selectItems List that expanded items are written to
@param aliases Set of aliases
@param fields List of field names and types, in alias order
@param includeSystemVars If true include system vars in lists
@return Whether the node was expanded | [
"If",
"<code",
">",
"selectItem<",
"/",
"code",
">",
"is",
"*",
"or",
"TABLE",
".",
"*",
"expands",
"it",
"and",
"returns",
"true",
";",
"otherwise",
"writes",
"the",
"unexpanded",
"item",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L420-L470 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java | AppServiceCertificateOrdersInner.getByResourceGroupAsync | public Observable<AppServiceCertificateOrderInner> getByResourceGroupAsync(String resourceGroupName, String certificateOrderName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, certificateOrderName).map(new Func1<ServiceResponse<AppServiceCertificateOrderInner>, AppServiceCertificateOrderInner>() {
@Override
public AppServiceCertificateOrderInner call(ServiceResponse<AppServiceCertificateOrderInner> response) {
return response.body();
}
});
} | java | public Observable<AppServiceCertificateOrderInner> getByResourceGroupAsync(String resourceGroupName, String certificateOrderName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, certificateOrderName).map(new Func1<ServiceResponse<AppServiceCertificateOrderInner>, AppServiceCertificateOrderInner>() {
@Override
public AppServiceCertificateOrderInner call(ServiceResponse<AppServiceCertificateOrderInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AppServiceCertificateOrderInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"certificateOrderName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"certifica... | Get a certificate order.
Get a certificate order.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param certificateOrderName Name of the certificate order..
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AppServiceCertificateOrderInner object | [
"Get",
"a",
"certificate",
"order",
".",
"Get",
"a",
"certificate",
"order",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L530-L537 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java | ST_GeometryShadow.shadowPolygon | private static Geometry shadowPolygon(Polygon polygon, double[] shadowOffset, GeometryFactory factory, boolean doUnion) {
Coordinate[] shellCoords = polygon.getExteriorRing().getCoordinates();
Collection<Polygon> shadows = new ArrayList<Polygon>();
createShadowPolygons(shadows, shellCoords, shadowOffset, factory);
final int nbOfHoles = polygon.getNumInteriorRing();
for (int i = 0; i < nbOfHoles; i++) {
createShadowPolygons(shadows, polygon.getInteriorRingN(i).getCoordinates(), shadowOffset, factory);
}
if (!doUnion) {
return factory.buildGeometry(shadows);
} else {
if (!shadows.isEmpty()) {
Collection<Geometry> shadowParts = new ArrayList<Geometry>();
for (Polygon shadowPolygon : shadows) {
shadowParts.add(shadowPolygon.difference(polygon));
}
Geometry allShadowParts = factory.buildGeometry(shadowParts);
Geometry union = allShadowParts.buffer(0);
union.apply(new UpdateZCoordinateSequenceFilter(0, 1));
return union;
}
return null;
}
} | java | private static Geometry shadowPolygon(Polygon polygon, double[] shadowOffset, GeometryFactory factory, boolean doUnion) {
Coordinate[] shellCoords = polygon.getExteriorRing().getCoordinates();
Collection<Polygon> shadows = new ArrayList<Polygon>();
createShadowPolygons(shadows, shellCoords, shadowOffset, factory);
final int nbOfHoles = polygon.getNumInteriorRing();
for (int i = 0; i < nbOfHoles; i++) {
createShadowPolygons(shadows, polygon.getInteriorRingN(i).getCoordinates(), shadowOffset, factory);
}
if (!doUnion) {
return factory.buildGeometry(shadows);
} else {
if (!shadows.isEmpty()) {
Collection<Geometry> shadowParts = new ArrayList<Geometry>();
for (Polygon shadowPolygon : shadows) {
shadowParts.add(shadowPolygon.difference(polygon));
}
Geometry allShadowParts = factory.buildGeometry(shadowParts);
Geometry union = allShadowParts.buffer(0);
union.apply(new UpdateZCoordinateSequenceFilter(0, 1));
return union;
}
return null;
}
} | [
"private",
"static",
"Geometry",
"shadowPolygon",
"(",
"Polygon",
"polygon",
",",
"double",
"[",
"]",
"shadowOffset",
",",
"GeometryFactory",
"factory",
",",
"boolean",
"doUnion",
")",
"{",
"Coordinate",
"[",
"]",
"shellCoords",
"=",
"polygon",
".",
"getExterior... | Compute the shadow for a polygon
@param polygon the input polygon
@param shadowOffset computed according the sun position and the height of
the geometry
@return | [
"Compute",
"the",
"shadow",
"for",
"a",
"polygon"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L158-L182 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/CORBA_Utils.java | CORBA_Utils.isRemoteable | public static boolean isRemoteable(Class<?> valueClass, int rmicCompatible) {
// NOTE: This logic must be kept in sync with write_value.
return valueClass.isInterface() &&
valueClass != Serializable.class &&
valueClass != Externalizable.class &&
(isCORBAObject(valueClass, rmicCompatible) ||
Remote.class.isAssignableFrom(valueClass) ||
isAbstractInterface(valueClass, rmicCompatible));
} | java | public static boolean isRemoteable(Class<?> valueClass, int rmicCompatible) {
// NOTE: This logic must be kept in sync with write_value.
return valueClass.isInterface() &&
valueClass != Serializable.class &&
valueClass != Externalizable.class &&
(isCORBAObject(valueClass, rmicCompatible) ||
Remote.class.isAssignableFrom(valueClass) ||
isAbstractInterface(valueClass, rmicCompatible));
} | [
"public",
"static",
"boolean",
"isRemoteable",
"(",
"Class",
"<",
"?",
">",
"valueClass",
",",
"int",
"rmicCompatible",
")",
"{",
"// NOTE: This logic must be kept in sync with write_value.",
"return",
"valueClass",
".",
"isInterface",
"(",
")",
"&&",
"valueClass",
"!... | Determines whether a value of the specified type could be a remote
object reference. This should return true if read_Object or
read_abstract_interface is used for this type.
@param clazz class for a method parameter or return type
that needs to be read from an input stream
@param rmicCompatible rmic compatibility flags
@return true if a stub is needed | [
"Determines",
"whether",
"a",
"value",
"of",
"the",
"specified",
"type",
"could",
"be",
"a",
"remote",
"object",
"reference",
".",
"This",
"should",
"return",
"true",
"if",
"read_Object",
"or",
"read_abstract_interface",
"is",
"used",
"for",
"this",
"type",
".... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/jitdeploy/CORBA_Utils.java#L268-L277 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setMapMerkleTreeConfigs | public Config setMapMerkleTreeConfigs(Map<String, MerkleTreeConfig> merkleTreeConfigs) {
this.mapMerkleTreeConfigs.clear();
this.mapMerkleTreeConfigs.putAll(merkleTreeConfigs);
for (Entry<String, MerkleTreeConfig> entry : merkleTreeConfigs.entrySet()) {
entry.getValue().setMapName(entry.getKey());
}
return this;
} | java | public Config setMapMerkleTreeConfigs(Map<String, MerkleTreeConfig> merkleTreeConfigs) {
this.mapMerkleTreeConfigs.clear();
this.mapMerkleTreeConfigs.putAll(merkleTreeConfigs);
for (Entry<String, MerkleTreeConfig> entry : merkleTreeConfigs.entrySet()) {
entry.getValue().setMapName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setMapMerkleTreeConfigs",
"(",
"Map",
"<",
"String",
",",
"MerkleTreeConfig",
">",
"merkleTreeConfigs",
")",
"{",
"this",
".",
"mapMerkleTreeConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"mapMerkleTreeConfigs",
".",
"putAll",
"(",
"mer... | Sets the map of map merkle configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param merkleTreeConfigs the map merkle tree configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"map",
"merkle",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3167-L3174 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/RowDiscussionResourcesImpl.java | RowDiscussionResourcesImpl.createDiscussion | public Discussion createDiscussion(long sheetId, long rowId, Discussion discussion) throws SmartsheetException{
return this.createResource("sheets/" + sheetId + "/rows/" + rowId + "/discussions", Discussion.class, discussion);
} | java | public Discussion createDiscussion(long sheetId, long rowId, Discussion discussion) throws SmartsheetException{
return this.createResource("sheets/" + sheetId + "/rows/" + rowId + "/discussions", Discussion.class, discussion);
} | [
"public",
"Discussion",
"createDiscussion",
"(",
"long",
"sheetId",
",",
"long",
"rowId",
",",
"Discussion",
"discussion",
")",
"throws",
"SmartsheetException",
"{",
"return",
"this",
".",
"createResource",
"(",
"\"sheets/\"",
"+",
"sheetId",
"+",
"\"/rows/\"",
"+... | Create discussion on a row.
It mirrors to the following Smartsheet REST API method: /sheets/{sheetId}/rows/{rowId}/discussions
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param sheetId the sheet ID
@param rowId the row ID
@param discussion the comment to add, limited to the following required attributes: text
@return the created comment
@throws SmartsheetException the smartsheet exception | [
"Create",
"discussion",
"on",
"a",
"row",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/RowDiscussionResourcesImpl.java#L63-L65 |
ReactiveX/RxJavaJoins | src/main/java/rx/joins/PatternN.java | PatternN.and | public PatternN and(Observable<? extends Object> other) {
if (other == null) {
throw new NullPointerException();
}
return new PatternN(observables, other);
} | java | public PatternN and(Observable<? extends Object> other) {
if (other == null) {
throw new NullPointerException();
}
return new PatternN(observables, other);
} | [
"public",
"PatternN",
"and",
"(",
"Observable",
"<",
"?",
"extends",
"Object",
">",
"other",
")",
"{",
"if",
"(",
"other",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"return",
"new",
"PatternN",
"(",
"observables"... | Creates a pattern that matches when all previous observable sequences have an available element.
@param other
Observable sequence to match with the previous sequences.
@return Pattern object that matches when all observable sequences have an available element. | [
"Creates",
"a",
"pattern",
"that",
"matches",
"when",
"all",
"previous",
"observable",
"sequences",
"have",
"an",
"available",
"element",
"."
] | train | https://github.com/ReactiveX/RxJavaJoins/blob/65b5c7fa03bd375c9e1f7906d7143068fde9b714/src/main/java/rx/joins/PatternN.java#L61-L66 |
Azure/azure-sdk-for-java | mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/MySQLManager.java | MySQLManager.authenticate | public static MySQLManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
return new MySQLManager(new RestClient.Builder()
.withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
.withCredentials(credentials)
.withSerializerAdapter(new AzureJacksonAdapter())
.withResponseBuilderFactory(new AzureResponseBuilder.Factory())
.build(), subscriptionId);
} | java | public static MySQLManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
return new MySQLManager(new RestClient.Builder()
.withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER)
.withCredentials(credentials)
.withSerializerAdapter(new AzureJacksonAdapter())
.withResponseBuilderFactory(new AzureResponseBuilder.Factory())
.build(), subscriptionId);
} | [
"public",
"static",
"MySQLManager",
"authenticate",
"(",
"AzureTokenCredentials",
"credentials",
",",
"String",
"subscriptionId",
")",
"{",
"return",
"new",
"MySQLManager",
"(",
"new",
"RestClient",
".",
"Builder",
"(",
")",
".",
"withBaseUrl",
"(",
"credentials",
... | Creates an instance of MySQLManager that exposes DBforMySQL resource management API entry points.
@param credentials the credentials to use
@param subscriptionId the subscription UUID
@return the MySQLManager | [
"Creates",
"an",
"instance",
"of",
"MySQLManager",
"that",
"exposes",
"DBforMySQL",
"resource",
"management",
"API",
"entry",
"points",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/MySQLManager.java#L59-L66 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.terminateAsync | public Observable<Void> terminateAsync(String jobId) {
return terminateWithServiceResponseAsync(jobId).map(new Func1<ServiceResponseWithHeaders<Void, JobTerminateHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobTerminateHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> terminateAsync(String jobId) {
return terminateWithServiceResponseAsync(jobId).map(new Func1<ServiceResponseWithHeaders<Void, JobTerminateHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobTerminateHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"terminateAsync",
"(",
"String",
"jobId",
")",
"{",
"return",
"terminateWithServiceResponseAsync",
"(",
"jobId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHeaders",
"<",
"Void",
",",
"JobTerminateHeade... | Terminates the specified job, marking it as completed.
When a Terminate Job request is received, the Batch service sets the job to the terminating state. The Batch service then terminates any running tasks associated with the job and runs any required job release tasks. Then the job moves into the completed state. If there are any tasks in the job in the active state, they will remain in the active state. Once a job is terminated, new tasks cannot be added and any remaining active tasks will not be scheduled.
@param jobId The ID of the job to terminate.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Terminates",
"the",
"specified",
"job",
"marking",
"it",
"as",
"completed",
".",
"When",
"a",
"Terminate",
"Job",
"request",
"is",
"received",
"the",
"Batch",
"service",
"sets",
"the",
"job",
"to",
"the",
"terminating",
"state",
".",
"The",
"Batch",
"servic... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L1816-L1823 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.getButton | public Button getButton(String text, boolean onlyVisible)
{
if(config.commandLogging){
Log.d(config.commandLoggingTag, "getButton(\""+text+"\", "+onlyVisible+")");
}
return getter.getView(Button.class, text, onlyVisible);
} | java | public Button getButton(String text, boolean onlyVisible)
{
if(config.commandLogging){
Log.d(config.commandLoggingTag, "getButton(\""+text+"\", "+onlyVisible+")");
}
return getter.getView(Button.class, text, onlyVisible);
} | [
"public",
"Button",
"getButton",
"(",
"String",
"text",
",",
"boolean",
"onlyVisible",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"getButton(\\\"\"",
"+",
"text",
"+",
"\... | Returns a Button displaying the specified text.
@param text the text that is displayed, specified as a regular expression
@param onlyVisible {@code true} if only visible buttons on the screen should be returned
@return the {@link Button} displaying the specified text | [
"Returns",
"a",
"Button",
"displaying",
"the",
"specified",
"text",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2976-L2983 |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcSessionSecurityUtil.java | CmsUgcSessionSecurityUtil.checkCreateContent | public static void checkCreateContent(CmsObject cms, CmsUgcConfiguration config) throws CmsUgcException {
if (config.getMaxContentNumber().isPresent()) {
int maxContents = config.getMaxContentNumber().get().intValue();
String sitePath = cms.getSitePath(config.getContentParentFolder());
try {
if (cms.getFilesInFolder(sitePath).size() >= maxContents) {
String message = Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
Messages.ERR_TOO_MANY_CONTENTS_1,
config.getContentParentFolder());
throw new CmsUgcException(CmsUgcConstants.ErrorCode.errMaxContentsExceeded, message);
}
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new CmsUgcException(e);
}
}
} | java | public static void checkCreateContent(CmsObject cms, CmsUgcConfiguration config) throws CmsUgcException {
if (config.getMaxContentNumber().isPresent()) {
int maxContents = config.getMaxContentNumber().get().intValue();
String sitePath = cms.getSitePath(config.getContentParentFolder());
try {
if (cms.getFilesInFolder(sitePath).size() >= maxContents) {
String message = Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
Messages.ERR_TOO_MANY_CONTENTS_1,
config.getContentParentFolder());
throw new CmsUgcException(CmsUgcConstants.ErrorCode.errMaxContentsExceeded, message);
}
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new CmsUgcException(e);
}
}
} | [
"public",
"static",
"void",
"checkCreateContent",
"(",
"CmsObject",
"cms",
",",
"CmsUgcConfiguration",
"config",
")",
"throws",
"CmsUgcException",
"{",
"if",
"(",
"config",
".",
"getMaxContentNumber",
"(",
")",
".",
"isPresent",
"(",
")",
")",
"{",
"int",
"max... | Checks whether a new XML content may be created and throws an exception if this is not the case.<p>
@param cms the current CMS context
@param config the form configuration
@throws CmsUgcException if something goes wrong | [
"Checks",
"whether",
"a",
"new",
"XML",
"content",
"may",
"be",
"created",
"and",
"throws",
"an",
"exception",
"if",
"this",
"is",
"not",
"the",
"case",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSessionSecurityUtil.java#L64-L82 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendText | public static <T> void sendText(final String message, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis) {
final ByteBuffer data = ByteBuffer.wrap(message.getBytes(StandardCharsets.UTF_8));
sendInternal(data, WebSocketFrameType.TEXT, wsChannel, callback, context, timeoutmillis);
} | java | public static <T> void sendText(final String message, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis) {
final ByteBuffer data = ByteBuffer.wrap(message.getBytes(StandardCharsets.UTF_8));
sendInternal(data, WebSocketFrameType.TEXT, wsChannel, callback, context, timeoutmillis);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"sendText",
"(",
"final",
"String",
"message",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"T",
">",
"callback",
",",
"T",
"context",
",",
"long",
"timeoutmillis",
")",
"{"... | 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
@param timeoutmillis the timeout in milliseconds | [
"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#L87-L90 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_phonebook_bookKey_GET | public OvhPhonebookMaster billingAccount_phonebook_bookKey_GET(String billingAccount, String bookKey) throws IOException {
String qPath = "/telephony/{billingAccount}/phonebook/{bookKey}";
StringBuilder sb = path(qPath, billingAccount, bookKey);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPhonebookMaster.class);
} | java | public OvhPhonebookMaster billingAccount_phonebook_bookKey_GET(String billingAccount, String bookKey) throws IOException {
String qPath = "/telephony/{billingAccount}/phonebook/{bookKey}";
StringBuilder sb = path(qPath, billingAccount, bookKey);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPhonebookMaster.class);
} | [
"public",
"OvhPhonebookMaster",
"billingAccount_phonebook_bookKey_GET",
"(",
"String",
"billingAccount",
",",
"String",
"bookKey",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/phonebook/{bookKey}\"",
";",
"StringBuilder",
"sb",
"="... | Get this object properties
REST: GET /telephony/{billingAccount}/phonebook/{bookKey}
@param billingAccount [required] The name of your billingAccount
@param bookKey [required] Identifier of the phonebook | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5568-L5573 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/xml/writer/XMLErrorResponseWriter.java | XMLErrorResponseWriter.writeError | public void writeError(ODataException exception) throws ODataRenderException {
checkNotNull(exception);
try {
xmlWriter.writeStartElement(ODATA_METADATA_NS, ERROR);
xmlWriter.writeNamespace(METADATA, ODATA_METADATA_NS);
xmlWriter.writeStartElement(METADATA, ErrorRendererConstants.CODE, ODATA_METADATA_NS);
xmlWriter.writeCharacters(String.valueOf(exception.getCode().getCode()));
xmlWriter.writeEndElement();
xmlWriter.writeStartElement(METADATA, ErrorRendererConstants.MESSAGE, ODATA_METADATA_NS);
xmlWriter.writeCharacters(String.valueOf(exception.getMessage()));
xmlWriter.writeEndElement();
if (exception.getTarget() != null) {
xmlWriter.writeStartElement(METADATA, TARGET, ODATA_METADATA_NS);
xmlWriter.writeCharacters(String.valueOf(exception.getTarget()));
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
} catch (XMLStreamException e) {
LOG.error("Not possible to marshall error stream XML");
throw new ODataRenderException("Not possible to marshall error stream XML: ", e);
}
} | java | public void writeError(ODataException exception) throws ODataRenderException {
checkNotNull(exception);
try {
xmlWriter.writeStartElement(ODATA_METADATA_NS, ERROR);
xmlWriter.writeNamespace(METADATA, ODATA_METADATA_NS);
xmlWriter.writeStartElement(METADATA, ErrorRendererConstants.CODE, ODATA_METADATA_NS);
xmlWriter.writeCharacters(String.valueOf(exception.getCode().getCode()));
xmlWriter.writeEndElement();
xmlWriter.writeStartElement(METADATA, ErrorRendererConstants.MESSAGE, ODATA_METADATA_NS);
xmlWriter.writeCharacters(String.valueOf(exception.getMessage()));
xmlWriter.writeEndElement();
if (exception.getTarget() != null) {
xmlWriter.writeStartElement(METADATA, TARGET, ODATA_METADATA_NS);
xmlWriter.writeCharacters(String.valueOf(exception.getTarget()));
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
} catch (XMLStreamException e) {
LOG.error("Not possible to marshall error stream XML");
throw new ODataRenderException("Not possible to marshall error stream XML: ", e);
}
} | [
"public",
"void",
"writeError",
"(",
"ODataException",
"exception",
")",
"throws",
"ODataRenderException",
"{",
"checkNotNull",
"(",
"exception",
")",
";",
"try",
"{",
"xmlWriter",
".",
"writeStartElement",
"(",
"ODATA_METADATA_NS",
",",
"ERROR",
")",
";",
"xmlWri... | <p>
Write an error for a given exception.
</p>
<p>
<b>Note:</b> Make sure {@link XMLErrorResponseWriter#startDocument()}
has been previously invoked to start the XML
stream document, and {@link XMLErrorResponseWriter#endDocument()} is invoked after to end it.
</p>
@param exception The exception to write an error for. It can not be {@code null}.
@throws ODataRenderException In case it is not possible to write to the XML stream. | [
"<p",
">",
"Write",
"an",
"error",
"for",
"a",
"given",
"exception",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"Make",
"sure",
"{",
"@link",
"XMLErrorResponseWriter#startDocument",
"()",
"}",
"has",
"been",
"prev... | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/xml/writer/XMLErrorResponseWriter.java#L102-L125 |
dashorst/wicket-stuff-markup-validator | isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java | VerifierFactory.compileSchema | public Schema compileSchema( InputStream stream )
throws VerifierConfigurationException, SAXException, IOException {
return compileSchema(stream,null);
} | java | public Schema compileSchema( InputStream stream )
throws VerifierConfigurationException, SAXException, IOException {
return compileSchema(stream,null);
} | [
"public",
"Schema",
"compileSchema",
"(",
"InputStream",
"stream",
")",
"throws",
"VerifierConfigurationException",
",",
"SAXException",
",",
"IOException",
"{",
"return",
"compileSchema",
"(",
"stream",
",",
"null",
")",
";",
"}"
] | processes a schema into a Schema object, which is a compiled representation
of a schema.
The obtained schema object can then be used concurrently across multiple
threads.
@param stream
A stream object that holds a schema. | [
"processes",
"a",
"schema",
"into",
"a",
"Schema",
"object",
"which",
"is",
"a",
"compiled",
"representation",
"of",
"a",
"schema",
"."
] | train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java#L136-L140 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/InetAddressPredicates.java | InetAddressPredicates.ofExact | public static Predicate<InetAddress> ofExact(InetAddress address) {
requireNonNull(address, "address");
if (address instanceof Inet4Address) {
return ofCidr(address, 32);
}
if (address instanceof Inet6Address) {
return ofCidr(address, 128);
}
throw new IllegalArgumentException("Invalid InetAddress type: " + address.getClass().getName());
} | java | public static Predicate<InetAddress> ofExact(InetAddress address) {
requireNonNull(address, "address");
if (address instanceof Inet4Address) {
return ofCidr(address, 32);
}
if (address instanceof Inet6Address) {
return ofCidr(address, 128);
}
throw new IllegalArgumentException("Invalid InetAddress type: " + address.getClass().getName());
} | [
"public",
"static",
"Predicate",
"<",
"InetAddress",
">",
"ofExact",
"(",
"InetAddress",
"address",
")",
"{",
"requireNonNull",
"(",
"address",
",",
"\"address\"",
")",
";",
"if",
"(",
"address",
"instanceof",
"Inet4Address",
")",
"{",
"return",
"ofCidr",
"(",... | Returns a {@link Predicate} which returns {@code true} if the given {@link InetAddress} equals to
the specified {@code address}.
@param address the expected {@link InetAddress} | [
"Returns",
"a",
"{",
"@link",
"Predicate",
"}",
"which",
"returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"given",
"{",
"@link",
"InetAddress",
"}",
"equals",
"to",
"the",
"specified",
"{",
"@code",
"address",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/InetAddressPredicates.java#L67-L76 |
aws/aws-sdk-java | aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddShapes.java | AddShapes.findRequestUri | private String findRequestUri(Shape parentShape, Map<String, Shape> allC2jShapes) {
return builder.getService().getOperations().values().stream()
.filter(o -> o.getInput() != null)
.filter(o -> allC2jShapes.get(o.getInput().getShape()).equals(parentShape))
.map(o -> o.getHttp().getRequestUri())
.findFirst().orElseThrow(() -> new RuntimeException("Could not find request URI for input shape"));
} | java | private String findRequestUri(Shape parentShape, Map<String, Shape> allC2jShapes) {
return builder.getService().getOperations().values().stream()
.filter(o -> o.getInput() != null)
.filter(o -> allC2jShapes.get(o.getInput().getShape()).equals(parentShape))
.map(o -> o.getHttp().getRequestUri())
.findFirst().orElseThrow(() -> new RuntimeException("Could not find request URI for input shape"));
} | [
"private",
"String",
"findRequestUri",
"(",
"Shape",
"parentShape",
",",
"Map",
"<",
"String",
",",
"Shape",
">",
"allC2jShapes",
")",
"{",
"return",
"builder",
".",
"getService",
"(",
")",
".",
"getOperations",
"(",
")",
".",
"values",
"(",
")",
".",
"s... | Given an input shape, finds the Request URI for the operation that input is referenced from.
@param parentShape Input shape to find operation's request URI for.
@param allC2jShapes All shapes in the service model.
@return Request URI for operation.
@throws RuntimeException If operation can't be found. | [
"Given",
"an",
"input",
"shape",
"finds",
"the",
"Request",
"URI",
"for",
"the",
"operation",
"that",
"input",
"is",
"referenced",
"from",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddShapes.java#L352-L358 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java | ControlBeanContextServicesSupport.releaseService | public void releaseService(BeanContextChild child, Object requestor, Object service) {
if (!contains(child)) {
throw new IllegalArgumentException(child + "is not a child of this context!");
}
// todo: for multithreaded usage this block needs to be synchronized
Class serviceClass = findServiceClass(service);
ServiceProvider sp = _serviceProviders.get(serviceClass);
sp.removeChildReference(requestor);
// if this is a delegated service, delegate the release request
// delegated services are removed from the _serviceProviders table
// as soon as their reference count drops to zero
if (sp.isDelegated()) {
BeanContextServices bcs = (BeanContextServices) getBeanContext();
bcs.releaseService(this, requestor, service);
if (!sp.hasRequestors()) {
_serviceProviders.remove(serviceClass);
}
}
else {
sp.getBCServiceProvider().releaseService((BeanContextServices)getPeer(), requestor, service);
}
// end synchronized
} | java | public void releaseService(BeanContextChild child, Object requestor, Object service) {
if (!contains(child)) {
throw new IllegalArgumentException(child + "is not a child of this context!");
}
// todo: for multithreaded usage this block needs to be synchronized
Class serviceClass = findServiceClass(service);
ServiceProvider sp = _serviceProviders.get(serviceClass);
sp.removeChildReference(requestor);
// if this is a delegated service, delegate the release request
// delegated services are removed from the _serviceProviders table
// as soon as their reference count drops to zero
if (sp.isDelegated()) {
BeanContextServices bcs = (BeanContextServices) getBeanContext();
bcs.releaseService(this, requestor, service);
if (!sp.hasRequestors()) {
_serviceProviders.remove(serviceClass);
}
}
else {
sp.getBCServiceProvider().releaseService((BeanContextServices)getPeer(), requestor, service);
}
// end synchronized
} | [
"public",
"void",
"releaseService",
"(",
"BeanContextChild",
"child",
",",
"Object",
"requestor",
",",
"Object",
"service",
")",
"{",
"if",
"(",
"!",
"contains",
"(",
"child",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"child",
"+",
"\"i... | Releases a <code>BeanContextChild</code>'s
(or any arbitrary object associated with a BeanContextChild)
reference to the specified service by calling releaseService()
on the underlying <code>BeanContextServiceProvider</code>.
@param child the <code>BeanContextChild</code>
@param requestor the requestor
@param service the service | [
"Releases",
"a",
"<code",
">",
"BeanContextChild<",
"/",
"code",
">",
"s",
"(",
"or",
"any",
"arbitrary",
"object",
"associated",
"with",
"a",
"BeanContextChild",
")",
"reference",
"to",
"the",
"specified",
"service",
"by",
"calling",
"releaseService",
"()",
"... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java#L250-L275 |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DDataSource.java | DDataSource.adjustPoolSettings | public static void adjustPoolSettings(int maxConnsInPool, int maxBrokerConns, int maxCoordConns, int maxOverlordConns) {
MAX_CONNS_IN_POOL = maxConnsInPool;
MAX_BROKER_CONNS = maxBrokerConns;
MAX_COORD_CONNS = maxCoordConns;
MAX_OVERLORD_CONNS = maxOverlordConns;
DruidNodeAccessor.setMaxConnections(MAX_CONNS_IN_POOL);
} | java | public static void adjustPoolSettings(int maxConnsInPool, int maxBrokerConns, int maxCoordConns, int maxOverlordConns) {
MAX_CONNS_IN_POOL = maxConnsInPool;
MAX_BROKER_CONNS = maxBrokerConns;
MAX_COORD_CONNS = maxCoordConns;
MAX_OVERLORD_CONNS = maxOverlordConns;
DruidNodeAccessor.setMaxConnections(MAX_CONNS_IN_POOL);
} | [
"public",
"static",
"void",
"adjustPoolSettings",
"(",
"int",
"maxConnsInPool",
",",
"int",
"maxBrokerConns",
",",
"int",
"maxCoordConns",
",",
"int",
"maxOverlordConns",
")",
"{",
"MAX_CONNS_IN_POOL",
"=",
"maxConnsInPool",
";",
"MAX_BROKER_CONNS",
"=",
"maxBrokerCon... | Call if a custom pool size, and fine grained control on connections per route.
NOTE: This must be called prior to instantiating DDataSource for the settings
to be effective.
@param maxConnsInPool
@param maxBrokerConns
@param maxCoordConns
@param maxOverlordConns | [
"Call",
"if",
"a",
"custom",
"pool",
"size",
"and",
"fine",
"grained",
"control",
"on",
"connections",
"per",
"route",
".",
"NOTE",
":",
"This",
"must",
"be",
"called",
"prior",
"to",
"instantiating",
"DDataSource",
"for",
"the",
"settings",
"to",
"be",
"e... | train | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DDataSource.java#L108-L114 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.getItems | public <T extends Item> List<T> getItems(List<ExtensionElement> additionalExtensions,
List<ExtensionElement> returnedExtensions) throws NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId()));
request.addExtensions(additionalExtensions);
return getItems(request, returnedExtensions);
} | java | public <T extends Item> List<T> getItems(List<ExtensionElement> additionalExtensions,
List<ExtensionElement> returnedExtensions) throws NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException {
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId()));
request.addExtensions(additionalExtensions);
return getItems(request, returnedExtensions);
} | [
"public",
"<",
"T",
"extends",
"Item",
">",
"List",
"<",
"T",
">",
"getItems",
"(",
"List",
"<",
"ExtensionElement",
">",
"additionalExtensions",
",",
"List",
"<",
"ExtensionElement",
">",
"returnedExtensions",
")",
"throws",
"NoResponseException",
",",
"XMPPErr... | Get items persisted on the node.
<p>
{@code additionalExtensions} can be used e.g. to add a "Result Set Management" extension.
{@code returnedExtensions} will be filled with the stanza extensions found in the answer.
</p>
@param additionalExtensions additional {@code PacketExtensions} to be added to the request.
This is an optional argument, if provided as null no extensions will be added.
@param returnedExtensions a collection that will be filled with the returned packet
extensions. This is an optional argument, if provided as null it won't be populated.
@param <T> type of the items.
@return List of {@link Item}
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException | [
"Get",
"items",
"persisted",
"on",
"the",
"node",
".",
"<p",
">",
"{",
"@code",
"additionalExtensions",
"}",
"can",
"be",
"used",
"e",
".",
"g",
".",
"to",
"add",
"a",
"Result",
"Set",
"Management",
"extension",
".",
"{",
"@code",
"returnedExtensions",
"... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L179-L185 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.intersectRayLine | public static float intersectRayLine(float originX, float originY, float dirX, float dirY, float pointX, float pointY, float normalX, float normalY, float epsilon) {
float denom = normalX * dirX + normalY * dirY;
if (denom < epsilon) {
float t = ((pointX - originX) * normalX + (pointY - originY) * normalY) / denom;
if (t >= 0.0f)
return t;
}
return -1.0f;
} | java | public static float intersectRayLine(float originX, float originY, float dirX, float dirY, float pointX, float pointY, float normalX, float normalY, float epsilon) {
float denom = normalX * dirX + normalY * dirY;
if (denom < epsilon) {
float t = ((pointX - originX) * normalX + (pointY - originY) * normalY) / denom;
if (t >= 0.0f)
return t;
}
return -1.0f;
} | [
"public",
"static",
"float",
"intersectRayLine",
"(",
"float",
"originX",
",",
"float",
"originY",
",",
"float",
"dirX",
",",
"float",
"dirY",
",",
"float",
"pointX",
",",
"float",
"pointY",
",",
"float",
"normalX",
",",
"float",
"normalY",
",",
"float",
"... | Test whether the ray with given origin <code>(originX, originY)</code> and direction <code>(dirX, dirY)</code> intersects the line
containing the given point <code>(pointX, pointY)</code> and having the normal <code>(normalX, normalY)</code>, and return the
value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point.
<p>
This method returns <code>-1.0</code> if the ray does not intersect the line, because it is either parallel to the line or its direction points
away from the line or the ray's origin is on the <i>negative</i> side of the line (i.e. the line's normal points away from the ray's origin).
@param originX
the x coordinate of the ray's origin
@param originY
the y coordinate of the ray's origin
@param dirX
the x coordinate of the ray's direction
@param dirY
the y coordinate of the ray's direction
@param pointX
the x coordinate of a point on the line
@param pointY
the y coordinate of a point on the line
@param normalX
the x coordinate of the line's normal
@param normalY
the y coordinate of the line's normal
@param epsilon
some small epsilon for when the ray is parallel to the line
@return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if the ray
intersects the line; <code>-1.0</code> otherwise | [
"Test",
"whether",
"the",
"ray",
"with",
"given",
"origin",
"<code",
">",
"(",
"originX",
"originY",
")",
"<",
"/",
"code",
">",
"and",
"direction",
"<code",
">",
"(",
"dirX",
"dirY",
")",
"<",
"/",
"code",
">",
"intersects",
"the",
"line",
"containing... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L3919-L3927 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingUtils.java | VLDockingUtils.fixVLDockingBug | public static DockableState fixVLDockingBug(DockingDesktop dockingDesktop, Dockable dockable) {
Assert.notNull(dockingDesktop, "dockingDesktop");
Assert.notNull(dockable, "dockable");
final DockingContext dockingContext = dockingDesktop.getContext();
final DockKey dockKey = dockable.getDockKey();
DockableState dockableState = dockingDesktop.getDockableState(dockable);
final Boolean thisFixApplies = (dockingContext.getDockableByKey(dockKey.getKey()) != null);
if ((thisFixApplies) && (dockableState == null)) {
dockingDesktop.registerDockable(dockable);
dockableState = dockingDesktop.getDockableState(dockable);
// dockKey.setLocation(dockableState.getLocation());
Assert.notNull(dockableState, "dockableState");
}
return dockableState;
} | java | public static DockableState fixVLDockingBug(DockingDesktop dockingDesktop, Dockable dockable) {
Assert.notNull(dockingDesktop, "dockingDesktop");
Assert.notNull(dockable, "dockable");
final DockingContext dockingContext = dockingDesktop.getContext();
final DockKey dockKey = dockable.getDockKey();
DockableState dockableState = dockingDesktop.getDockableState(dockable);
final Boolean thisFixApplies = (dockingContext.getDockableByKey(dockKey.getKey()) != null);
if ((thisFixApplies) && (dockableState == null)) {
dockingDesktop.registerDockable(dockable);
dockableState = dockingDesktop.getDockableState(dockable);
// dockKey.setLocation(dockableState.getLocation());
Assert.notNull(dockableState, "dockableState");
}
return dockableState;
} | [
"public",
"static",
"DockableState",
"fixVLDockingBug",
"(",
"DockingDesktop",
"dockingDesktop",
",",
"Dockable",
"dockable",
")",
"{",
"Assert",
".",
"notNull",
"(",
"dockingDesktop",
",",
"\"dockingDesktop\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"dockable",
... | Fixes an VLDocking bug consisting on dockables that belong to a docking desktop have no state on it.
@param dockable
the dockable candidate.
@return its dockable state. If none then registers the dockable again and ensures dockable state is not null. | [
"Fixes",
"an",
"VLDocking",
"bug",
"consisting",
"on",
"dockables",
"that",
"belong",
"to",
"a",
"docking",
"desktop",
"have",
"no",
"state",
"on",
"it",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingUtils.java#L62-L82 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/basic/TextParams.java | TextParams.setFromJSON | public void setFromJSON(Context context, JSONObject properties) {
String backgroundResStr = optString(properties, Properties.background);
if (backgroundResStr != null && !backgroundResStr.isEmpty()) {
final int backgroundResId = getId(context, backgroundResStr, "drawable");
setBackGround(context.getResources().getDrawable(backgroundResId, null));
}
setBackgroundColor(getJSONColor(properties, Properties.background_color, getBackgroundColor()));
setGravity(optInt(properties, TextContainer.Properties.gravity, getGravity()));
setRefreshFrequency(optEnum(properties, Properties.refresh_freq, getRefreshFrequency()));
setTextColor(getJSONColor(properties, Properties.text_color, getTextColor()));
setText(optString(properties, Properties.text, (String) getText()));
setTextSize(optFloat(properties, Properties.text_size, getTextSize()));
final JSONObject typefaceJson = optJSONObject(properties, Properties.typeface);
if (typefaceJson != null) {
try {
Typeface typeface = WidgetLib.getTypefaceManager().getTypeface(typefaceJson);
setTypeface(typeface);
} catch (Throwable e) {
Log.e(TAG, e, "Couldn't set typeface from properties: %s", typefaceJson);
}
}
} | java | public void setFromJSON(Context context, JSONObject properties) {
String backgroundResStr = optString(properties, Properties.background);
if (backgroundResStr != null && !backgroundResStr.isEmpty()) {
final int backgroundResId = getId(context, backgroundResStr, "drawable");
setBackGround(context.getResources().getDrawable(backgroundResId, null));
}
setBackgroundColor(getJSONColor(properties, Properties.background_color, getBackgroundColor()));
setGravity(optInt(properties, TextContainer.Properties.gravity, getGravity()));
setRefreshFrequency(optEnum(properties, Properties.refresh_freq, getRefreshFrequency()));
setTextColor(getJSONColor(properties, Properties.text_color, getTextColor()));
setText(optString(properties, Properties.text, (String) getText()));
setTextSize(optFloat(properties, Properties.text_size, getTextSize()));
final JSONObject typefaceJson = optJSONObject(properties, Properties.typeface);
if (typefaceJson != null) {
try {
Typeface typeface = WidgetLib.getTypefaceManager().getTypeface(typefaceJson);
setTypeface(typeface);
} catch (Throwable e) {
Log.e(TAG, e, "Couldn't set typeface from properties: %s", typefaceJson);
}
}
} | [
"public",
"void",
"setFromJSON",
"(",
"Context",
"context",
",",
"JSONObject",
"properties",
")",
"{",
"String",
"backgroundResStr",
"=",
"optString",
"(",
"properties",
",",
"Properties",
".",
"background",
")",
";",
"if",
"(",
"backgroundResStr",
"!=",
"null",... | Set text parameters from properties
@param context Valid Android {@link Context}
@param properties JSON text properties | [
"Set",
"text",
"parameters",
"from",
"properties"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/basic/TextParams.java#L57-L81 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/AESUtil.java | AESUtil.decypt | public static String decypt(byte[] b, byte[] key) {
String _str = null;
try {
SecretKey secretKey = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, secretKey);
_str = new String(cipher.doFinal(b));
} catch (Exception e) {
throw new RuntimeException(e);
}
return _str;
} | java | public static String decypt(byte[] b, byte[] key) {
String _str = null;
try {
SecretKey secretKey = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, secretKey);
_str = new String(cipher.doFinal(b));
} catch (Exception e) {
throw new RuntimeException(e);
}
return _str;
} | [
"public",
"static",
"String",
"decypt",
"(",
"byte",
"[",
"]",
"b",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"String",
"_str",
"=",
"null",
";",
"try",
"{",
"SecretKey",
"secretKey",
"=",
"new",
"SecretKeySpec",
"(",
"key",
",",
"\"AES\"",
")",
";",
... | 将一个字符串按指定key进行AES解密并返回
@param b 需要解密的字符串
@param key 指定key
@return 返回解密后的字符串,失败返回null | [
"将一个字符串按指定key进行AES解密并返回"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/AESUtil.java#L67-L78 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java | EJSHome.createBeanO | public BeanO createBeanO() throws RemoteException
{
EJSDeployedSupport s = EJSContainer.getMethodContext();
return createBeanO(s.ivThreadData, s.currentTx, false, null); // d630940
} | java | public BeanO createBeanO() throws RemoteException
{
EJSDeployedSupport s = EJSContainer.getMethodContext();
return createBeanO(s.ivThreadData, s.currentTx, false, null); // d630940
} | [
"public",
"BeanO",
"createBeanO",
"(",
")",
"throws",
"RemoteException",
"{",
"EJSDeployedSupport",
"s",
"=",
"EJSContainer",
".",
"getMethodContext",
"(",
")",
";",
"return",
"createBeanO",
"(",
"s",
".",
"ivThreadData",
",",
"s",
".",
"currentTx",
",",
"fals... | Creates a bean instance for this home. <p>
This method is intended to be called by the create methods of entity and
SFSB home classes generated by EJBDeploy and JITDeploy. The methods will
have been called through home wrappers, so preInvoke will have been
called immediately prior to this method being invoked. <p>
Need to distinguish between invocations of this method from the
create path and the activate path.
On the create path a new instance of a CMP bean needs to be
created so that the fields in the CMP bean are set to their Java
defaults. On the activate path, we can reuse an already created
instance of the bean. <p>
If this method returns successfully, the caller (the generated entity or
stateful home bean) must call {@link #preEjbCreate}, then ejbCreate, then {@link #postCreate}, then ejbPostCreate (if necessary), then {@link #afterPostCreate}. If the
entire sequence is successful, then {@link #afterPostCreateCompletion} must be called. If an exception
occurs at any point, then {@link #createFailure} must be called. | [
"Creates",
"a",
"bean",
"instance",
"for",
"this",
"home",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java#L1102-L1106 |
google/allocation-instrumenter | src/main/java/com/google/monitoring/runtime/instrumentation/AllocationMethodAdapter.java | AllocationMethodAdapter.visitMultiANewArrayInsn | @Override
public void visitMultiANewArrayInsn(String typeName, int dimCount) {
// stack: ... dim1 dim2 dim3 ... dimN
super.visitMultiANewArrayInsn(typeName, dimCount);
// -> stack: ... aref
calculateArrayLengthAndDispatch(typeName, dimCount);
} | java | @Override
public void visitMultiANewArrayInsn(String typeName, int dimCount) {
// stack: ... dim1 dim2 dim3 ... dimN
super.visitMultiANewArrayInsn(typeName, dimCount);
// -> stack: ... aref
calculateArrayLengthAndDispatch(typeName, dimCount);
} | [
"@",
"Override",
"public",
"void",
"visitMultiANewArrayInsn",
"(",
"String",
"typeName",
",",
"int",
"dimCount",
")",
"{",
"// stack: ... dim1 dim2 dim3 ... dimN",
"super",
".",
"visitMultiANewArrayInsn",
"(",
"typeName",
",",
"dimCount",
")",
";",
"// -> stack: ... are... | multianewarray gets its very own visit method in the ASM framework, so we hook it here. This
bytecode is different from most in that it consumes a variable number of stack elements during
execution. The number of stack elements consumed is specified by the dimCount operand. | [
"multianewarray",
"gets",
"its",
"very",
"own",
"visit",
"method",
"in",
"the",
"ASM",
"framework",
"so",
"we",
"hook",
"it",
"here",
".",
"This",
"bytecode",
"is",
"different",
"from",
"most",
"in",
"that",
"it",
"consumes",
"a",
"variable",
"number",
"of... | train | https://github.com/google/allocation-instrumenter/blob/58d8473e8832e51f39ae7aa38328f61c4b747bff/src/main/java/com/google/monitoring/runtime/instrumentation/AllocationMethodAdapter.java#L523-L529 |
michel-kraemer/citeproc-java | citeproc-java/src/main/java/de/undercouch/citeproc/bibtex/DateParser.java | DateParser.toDateRange | public static CSLDate toDateRange(String year, String month) {
//check if there's a date range, parse elements
//individually and merge them afterwards
String[] ms = null;
if (month != null) {
ms = month.split("-+|\u2013+");
}
String[] ys = null;
if (year != null) {
ys = year.split("-+|\u2013+");
}
if (ys != null && ys.length > 1) {
//even if there is a month parse year only to avoid ambiguities
CSLDate d1 = toDateSingle(ys[0], null);
CSLDate d2 = toDateSingle(ys[ys.length - 1], null);
return merge(d1, d2);
} else if (ms != null && ms.length > 1) {
CSLDate d1 = toDateSingle(year, ms[0]);
CSLDate d2 = toDateSingle(year, ms[1]);
return merge(d1, d2);
}
return toDateSingle(year, month);
} | java | public static CSLDate toDateRange(String year, String month) {
//check if there's a date range, parse elements
//individually and merge them afterwards
String[] ms = null;
if (month != null) {
ms = month.split("-+|\u2013+");
}
String[] ys = null;
if (year != null) {
ys = year.split("-+|\u2013+");
}
if (ys != null && ys.length > 1) {
//even if there is a month parse year only to avoid ambiguities
CSLDate d1 = toDateSingle(ys[0], null);
CSLDate d2 = toDateSingle(ys[ys.length - 1], null);
return merge(d1, d2);
} else if (ms != null && ms.length > 1) {
CSLDate d1 = toDateSingle(year, ms[0]);
CSLDate d2 = toDateSingle(year, ms[1]);
return merge(d1, d2);
}
return toDateSingle(year, month);
} | [
"public",
"static",
"CSLDate",
"toDateRange",
"(",
"String",
"year",
",",
"String",
"month",
")",
"{",
"//check if there's a date range, parse elements",
"//individually and merge them afterwards",
"String",
"[",
"]",
"ms",
"=",
"null",
";",
"if",
"(",
"month",
"!=",
... | Parses the given year and month to a {@link CSLDate} object. Handles
date ranges such as <code>xx-xx</code>.
@param year the year to parse. Should be a four-digit number or a String
whose last four characters are digits.
@param month the month to parse. May be a number (<code>1-12</code>),
a short month name (<code>Jan</code> to <code>Dec</code>), or a
long month name (<code>January</code> to <code>December</code>). This
method is also able to recognize month names in several locales.
@return the {@link CSLDate} object or null if both, the year and the
month, could not be parsed | [
"Parses",
"the",
"given",
"year",
"and",
"month",
"to",
"a",
"{"
] | train | https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/bibtex/DateParser.java#L115-L139 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMultiFileWidget.java | WMultiFileWidget.doHandleFileAjaxActionRequest | protected void doHandleFileAjaxActionRequest(final Request request) {
// Protect against client-side tampering of disabled components
if (isDisabled()) {
throw new SystemException("File widget is disabled.");
}
// Check for file id
String fileId = request.getParameter(FILE_UPLOAD_ID_KEY);
if (fileId == null) {
throw new SystemException("No file id provided for ajax action.");
}
// Check valid file id
FileWidgetUpload file = getFile(fileId);
if (file == null) {
throw new SystemException("Invalid file id [" + fileId + "].");
}
// Run the action
final Action action = getFileAjaxAction();
if (action == null) {
throw new SystemException("No action set for file ajax action request.");
}
// Set the selected file id as the action object
final ActionEvent event = new ActionEvent(this, "fileajax", fileId);
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
} | java | protected void doHandleFileAjaxActionRequest(final Request request) {
// Protect against client-side tampering of disabled components
if (isDisabled()) {
throw new SystemException("File widget is disabled.");
}
// Check for file id
String fileId = request.getParameter(FILE_UPLOAD_ID_KEY);
if (fileId == null) {
throw new SystemException("No file id provided for ajax action.");
}
// Check valid file id
FileWidgetUpload file = getFile(fileId);
if (file == null) {
throw new SystemException("Invalid file id [" + fileId + "].");
}
// Run the action
final Action action = getFileAjaxAction();
if (action == null) {
throw new SystemException("No action set for file ajax action request.");
}
// Set the selected file id as the action object
final ActionEvent event = new ActionEvent(this, "fileajax", fileId);
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
} | [
"protected",
"void",
"doHandleFileAjaxActionRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"// Protect against client-side tampering of disabled components",
"if",
"(",
"isDisabled",
"(",
")",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"\"File widget is disa... | Handle a file action AJAX request.
@param request the request being processed | [
"Handle",
"a",
"file",
"action",
"AJAX",
"request",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMultiFileWidget.java#L647-L681 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesInner.java | DataMaskingRulesInner.createOrUpdateAsync | public Observable<DataMaskingRuleInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).map(new Func1<ServiceResponse<DataMaskingRuleInner>, DataMaskingRuleInner>() {
@Override
public DataMaskingRuleInner call(ServiceResponse<DataMaskingRuleInner> response) {
return response.body();
}
});
} | java | public Observable<DataMaskingRuleInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).map(new Func1<ServiceResponse<DataMaskingRuleInner>, DataMaskingRuleInner>() {
@Override
public DataMaskingRuleInner call(ServiceResponse<DataMaskingRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataMaskingRuleInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"dataMaskingRuleName",
",",
"DataMaskingRuleInner",
"parameters",
")",
"{",
"r... | Creates or updates a database data masking rule.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param dataMaskingRuleName The name of the data masking rule.
@param parameters The required parameters for creating or updating a data masking rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataMaskingRuleInner object | [
"Creates",
"or",
"updates",
"a",
"database",
"data",
"masking",
"rule",
"."
] | 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/DataMaskingRulesInner.java#L112-L119 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/DiscussionCommentResourcesImpl.java | DiscussionCommentResourcesImpl.updateComment | public Comment updateComment(long sheetId, Comment comment) throws SmartsheetException {
return this.updateResource("sheets/" + sheetId + "/comments/" + comment.getId(), Comment.class, comment);
} | java | public Comment updateComment(long sheetId, Comment comment) throws SmartsheetException {
return this.updateResource("sheets/" + sheetId + "/comments/" + comment.getId(), Comment.class, comment);
} | [
"public",
"Comment",
"updateComment",
"(",
"long",
"sheetId",
",",
"Comment",
"comment",
")",
"throws",
"SmartsheetException",
"{",
"return",
"this",
".",
"updateResource",
"(",
"\"sheets/\"",
"+",
"sheetId",
"+",
"\"/comments/\"",
"+",
"comment",
".",
"getId",
... | Update the specified comment
It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/comments/{commentId}
@param sheetId the sheet id
@param comment the new comment object
@return the updated comment
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation | [
"Update",
"the",
"specified",
"comment"
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/DiscussionCommentResourcesImpl.java#L112-L114 |
sdl/Testy | src/main/java/com/sdl/selenium/extjs3/grid/EditorGridPanel.java | EditorGridPanel.getActiveEditor | public TextField getActiveEditor() {
TextField editor;
WebLocator container = new WebLocator("x-editor", this);
WebLocator editableEl = new WebLocator(container).setElPath("//*[contains(@class, '-focus')]");
String stringClass = editableEl.getAttributeClass();
LOGGER.debug("active editor stringClass: " + stringClass);
if (stringClass == null) {
LOGGER.warn("active editor stringClass is null: " + editableEl); // TODO investigate this problem
stringClass = "";
}
if (stringClass.contains("x-form-field-trigger-wrap")) {
// TODO when is DateField
LOGGER.debug("active editor is ComboBox");
editor = new ComboBox();
editor.setInfoMessage("active combo editor");
} else if (stringClass.contains("x-form-textarea")) {
LOGGER.debug("active editor is TextArea");
editor = new TextArea();
} else {
LOGGER.debug("active editor is TextField");
editor = new TextField();
}
editor.setContainer(this).setClasses("x-form-focus").setRenderMillis(1000).setInfoMessage("active editor");
return editor;
} | java | public TextField getActiveEditor() {
TextField editor;
WebLocator container = new WebLocator("x-editor", this);
WebLocator editableEl = new WebLocator(container).setElPath("//*[contains(@class, '-focus')]");
String stringClass = editableEl.getAttributeClass();
LOGGER.debug("active editor stringClass: " + stringClass);
if (stringClass == null) {
LOGGER.warn("active editor stringClass is null: " + editableEl); // TODO investigate this problem
stringClass = "";
}
if (stringClass.contains("x-form-field-trigger-wrap")) {
// TODO when is DateField
LOGGER.debug("active editor is ComboBox");
editor = new ComboBox();
editor.setInfoMessage("active combo editor");
} else if (stringClass.contains("x-form-textarea")) {
LOGGER.debug("active editor is TextArea");
editor = new TextArea();
} else {
LOGGER.debug("active editor is TextField");
editor = new TextField();
}
editor.setContainer(this).setClasses("x-form-focus").setRenderMillis(1000).setInfoMessage("active editor");
return editor;
} | [
"public",
"TextField",
"getActiveEditor",
"(",
")",
"{",
"TextField",
"editor",
";",
"WebLocator",
"container",
"=",
"new",
"WebLocator",
"(",
"\"x-editor\"",
",",
"this",
")",
";",
"WebLocator",
"editableEl",
"=",
"new",
"WebLocator",
"(",
"container",
")",
"... | Use only after click/doubleClicked in that row or the editor is already opened
@return active editor | [
"Use",
"only",
"after",
"click",
"/",
"doubleClicked",
"in",
"that",
"row",
"or",
"the",
"editor",
"is",
"already",
"opened"
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/extjs3/grid/EditorGridPanel.java#L65-L89 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java | AbstractController.getSource | protected <T> Optional<T> getSource(Event event, Class<T> type) {
return getValue(event, event::getSource, type);
} | java | protected <T> Optional<T> getSource(Event event, Class<T> type) {
return getValue(event, event::getSource, type);
} | [
"protected",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"getSource",
"(",
"Event",
"event",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"getValue",
"(",
"event",
",",
"event",
"::",
"getSource",
",",
"type",
")",
";",
"}"
] | Gets the source.
@param event the event
@param type the cls
@param <T> the generic type
@return the source | [
"Gets",
"the",
"source",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java#L333-L335 |
wuman/orientdb-android | commons/src/main/java/com/orientechnologies/common/parser/OBaseParser.java | OBaseParser.parseOptionalWord | protected String parseOptionalWord(final boolean iUpperCase, final String... iWords) {
parserNextWord(iUpperCase);
if (iWords.length > 0) {
if (parserLastWord.length() == 0)
return null;
boolean found = false;
for (String w : iWords) {
if (parserLastWord.toString().equals(w)) {
found = true;
break;
}
}
if (!found)
throwSyntaxErrorException("Found unexpected keyword '" + parserLastWord + "' while it was expected '"
+ Arrays.toString(iWords) + "'");
}
return parserLastWord.toString();
} | java | protected String parseOptionalWord(final boolean iUpperCase, final String... iWords) {
parserNextWord(iUpperCase);
if (iWords.length > 0) {
if (parserLastWord.length() == 0)
return null;
boolean found = false;
for (String w : iWords) {
if (parserLastWord.toString().equals(w)) {
found = true;
break;
}
}
if (!found)
throwSyntaxErrorException("Found unexpected keyword '" + parserLastWord + "' while it was expected '"
+ Arrays.toString(iWords) + "'");
}
return parserLastWord.toString();
} | [
"protected",
"String",
"parseOptionalWord",
"(",
"final",
"boolean",
"iUpperCase",
",",
"final",
"String",
"...",
"iWords",
")",
"{",
"parserNextWord",
"(",
"iUpperCase",
")",
";",
"if",
"(",
"iWords",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"parserL... | Parses the next word. If any word is parsed it's checked against the word array received as parameter. If the parsed word is
not enlisted in it a SyntaxError exception is thrown. It returns the word parsed if any.
@param iUpperCase
True if must return UPPERCASE, otherwise false
@return The word parsed if any, otherwise null | [
"Parses",
"the",
"next",
"word",
".",
"If",
"any",
"word",
"is",
"parsed",
"it",
"s",
"checked",
"against",
"the",
"word",
"array",
"received",
"as",
"parameter",
".",
"If",
"the",
"parsed",
"word",
"is",
"not",
"enlisted",
"in",
"it",
"a",
"SyntaxError"... | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/parser/OBaseParser.java#L71-L91 |
notnoop/java-apns | src/main/java/com/notnoop/apns/PayloadBuilder.java | PayloadBuilder.resizeAlertBody | public PayloadBuilder resizeAlertBody(final int payloadLength, final String postfix) {
int currLength = length();
if (currLength <= payloadLength) {
return this;
}
// now we are sure that truncation is required
String body = (String)customAlert.get("body");
final int acceptableSize = Utilities.toUTF8Bytes(body).length
- (currLength - payloadLength
+ Utilities.toUTF8Bytes(postfix).length);
body = Utilities.truncateWhenUTF8(body, acceptableSize) + postfix;
// set it back
customAlert.put("body", body);
// calculate the length again
currLength = length();
if(currLength > payloadLength) {
// string is still too long, just remove the body as the body is
// anyway not the cause OR the postfix might be too long
customAlert.remove("body");
}
return this;
} | java | public PayloadBuilder resizeAlertBody(final int payloadLength, final String postfix) {
int currLength = length();
if (currLength <= payloadLength) {
return this;
}
// now we are sure that truncation is required
String body = (String)customAlert.get("body");
final int acceptableSize = Utilities.toUTF8Bytes(body).length
- (currLength - payloadLength
+ Utilities.toUTF8Bytes(postfix).length);
body = Utilities.truncateWhenUTF8(body, acceptableSize) + postfix;
// set it back
customAlert.put("body", body);
// calculate the length again
currLength = length();
if(currLength > payloadLength) {
// string is still too long, just remove the body as the body is
// anyway not the cause OR the postfix might be too long
customAlert.remove("body");
}
return this;
} | [
"public",
"PayloadBuilder",
"resizeAlertBody",
"(",
"final",
"int",
"payloadLength",
",",
"final",
"String",
"postfix",
")",
"{",
"int",
"currLength",
"=",
"length",
"(",
")",
";",
"if",
"(",
"currLength",
"<=",
"payloadLength",
")",
"{",
"return",
"this",
"... | Shrinks the alert message body so that the resulting payload
message fits within the passed expected payload length.
This method performs best-effort approach, and its behavior
is unspecified when handling alerts where the payload
without body is already longer than the permitted size, or
if the break occurs within word.
@param payloadLength the expected max size of the payload
@param postfix for the truncated body, e.g. "..."
@return this | [
"Shrinks",
"the",
"alert",
"message",
"body",
"so",
"that",
"the",
"resulting",
"payload",
"message",
"fits",
"within",
"the",
"passed",
"expected",
"payload",
"length",
"."
] | train | https://github.com/notnoop/java-apns/blob/180a190d4cb49458441596ca7c69d50ec7f1dba5/src/main/java/com/notnoop/apns/PayloadBuilder.java#L401-L428 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java | XMLConfigWebFactory.toBoolean | private static boolean toBoolean(String value, boolean defaultValue) {
if (value == null || value.trim().length() == 0) return defaultValue;
try {
return Caster.toBooleanValue(value.trim());
}
catch (PageException e) {
return defaultValue;
}
} | java | private static boolean toBoolean(String value, boolean defaultValue) {
if (value == null || value.trim().length() == 0) return defaultValue;
try {
return Caster.toBooleanValue(value.trim());
}
catch (PageException e) {
return defaultValue;
}
} | [
"private",
"static",
"boolean",
"toBoolean",
"(",
"String",
"value",
",",
"boolean",
"defaultValue",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"defaultValue",
";... | cast a string value to a boolean
@param value String value represent a booolean ("yes", "no","true" aso.)
@param defaultValue if can't cast to a boolean is value will be returned
@return boolean value | [
"cast",
"a",
"string",
"value",
"to",
"a",
"boolean"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java#L4891-L4901 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java | VirtualMachineScaleSetVMsInner.beginUpdateAsync | public Observable<VirtualMachineScaleSetVMInner> beginUpdateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInner>, VirtualMachineScaleSetVMInner>() {
@Override
public VirtualMachineScaleSetVMInner call(ServiceResponse<VirtualMachineScaleSetVMInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualMachineScaleSetVMInner> beginUpdateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInner>, VirtualMachineScaleSetVMInner>() {
@Override
public VirtualMachineScaleSetVMInner call(ServiceResponse<VirtualMachineScaleSetVMInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualMachineScaleSetVMInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"String",
"instanceId",
",",
"VirtualMachineScaleSetVMInner",
"parameters",
")",
"{",
"return",
"beginUpdateWithS... | Updates a virtual machine of a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
@param instanceId The instance ID of the virtual machine.
@param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualMachineScaleSetVMInner object | [
"Updates",
"a",
"virtual",
"machine",
"of",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java#L798-L805 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/JSMinPostProcessor.java | JSMinPostProcessor.formatAndThrowJSLintError | private void formatAndThrowJSLintError(BundleProcessingStatus status, byte[] bundleBytes, JSMinException e) {
StringBuilder errorMsg = new StringBuilder(
"JSMin failed to minify the bundle with id: '" + status.getCurrentBundle().getId() + "'.\n");
errorMsg.append("The exception thrown is of type:").append(e.getClass().getName()).append("'.\n");
int currentByte = e.getByteIndex();
int startPoint;
if (currentByte < 100)
startPoint = 0;
else
startPoint = currentByte - 100;
int totalSize = currentByte - startPoint;
byte[] lastData = new byte[totalSize];
for (int x = 0; x < totalSize; x++) {
lastData[x] = bundleBytes[startPoint];
startPoint++;
}
errorMsg.append("The error happened at this point in your javascript (line ").append(e.getLine())
.append("; col. ").append(e.getColumn()).append(") : \n");
errorMsg.append("_______________________________________________\n...");
try {
String data = byteArrayToString(status.getJawrConfig().getResourceCharset(), lastData).toString();
errorMsg.append(data).append("\n\n");
} catch (IOException e1) {
// Ignored, we have enaugh problems by this point.
}
errorMsg.append("_______________________________________________");
errorMsg.append(
"\nIf you can't find the error, try to check the scripts using JSLint (http://www.jslint.com/) to find the conflicting part of the code. ");
throw new BundlingProcessException(errorMsg.toString(), e);
} | java | private void formatAndThrowJSLintError(BundleProcessingStatus status, byte[] bundleBytes, JSMinException e) {
StringBuilder errorMsg = new StringBuilder(
"JSMin failed to minify the bundle with id: '" + status.getCurrentBundle().getId() + "'.\n");
errorMsg.append("The exception thrown is of type:").append(e.getClass().getName()).append("'.\n");
int currentByte = e.getByteIndex();
int startPoint;
if (currentByte < 100)
startPoint = 0;
else
startPoint = currentByte - 100;
int totalSize = currentByte - startPoint;
byte[] lastData = new byte[totalSize];
for (int x = 0; x < totalSize; x++) {
lastData[x] = bundleBytes[startPoint];
startPoint++;
}
errorMsg.append("The error happened at this point in your javascript (line ").append(e.getLine())
.append("; col. ").append(e.getColumn()).append(") : \n");
errorMsg.append("_______________________________________________\n...");
try {
String data = byteArrayToString(status.getJawrConfig().getResourceCharset(), lastData).toString();
errorMsg.append(data).append("\n\n");
} catch (IOException e1) {
// Ignored, we have enaugh problems by this point.
}
errorMsg.append("_______________________________________________");
errorMsg.append(
"\nIf you can't find the error, try to check the scripts using JSLint (http://www.jslint.com/) to find the conflicting part of the code. ");
throw new BundlingProcessException(errorMsg.toString(), e);
} | [
"private",
"void",
"formatAndThrowJSLintError",
"(",
"BundleProcessingStatus",
"status",
",",
"byte",
"[",
"]",
"bundleBytes",
",",
"JSMinException",
"e",
")",
"{",
"StringBuilder",
"errorMsg",
"=",
"new",
"StringBuilder",
"(",
"\"JSMin failed to minify the bundle with id... | Upon an exception thrown during minification, this method will throw an
error with detailed information.
@param status
the bundle processing status
@param bundleBytes
the byte array of the bundle content
@param e
the JSMinException | [
"Upon",
"an",
"exception",
"thrown",
"during",
"minification",
"this",
"method",
"will",
"throw",
"an",
"error",
"with",
"detailed",
"information",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/JSMinPostProcessor.java#L143-L175 |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getBoolean | @PublicEvolving
public boolean getBoolean(ConfigOption<Boolean> configOption, boolean overrideDefault) {
Object o = getRawValueFromOption(configOption);
if (o == null) {
return overrideDefault;
}
return convertToBoolean(o);
} | java | @PublicEvolving
public boolean getBoolean(ConfigOption<Boolean> configOption, boolean overrideDefault) {
Object o = getRawValueFromOption(configOption);
if (o == null) {
return overrideDefault;
}
return convertToBoolean(o);
} | [
"@",
"PublicEvolving",
"public",
"boolean",
"getBoolean",
"(",
"ConfigOption",
"<",
"Boolean",
">",
"configOption",
",",
"boolean",
"overrideDefault",
")",
"{",
"Object",
"o",
"=",
"getRawValueFromOption",
"(",
"configOption",
")",
";",
"if",
"(",
"o",
"==",
"... | Returns the value associated with the given config option as a boolean.
If no value is mapped under any key of the option, it returns the specified
default instead of the option's default value.
@param configOption The configuration option
@param overrideDefault The value to return if no value was mapper for any key of the option
@return the configured value associated with the given config option, or the overrideDefault | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"config",
"option",
"as",
"a",
"boolean",
".",
"If",
"no",
"value",
"is",
"mapped",
"under",
"any",
"key",
"of",
"the",
"option",
"it",
"returns",
"the",
"specified",
"default",
"instead",
"o... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L382-L389 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.browseFrom | public IndexBrowser browseFrom(Query params, String cursor, RequestOptions requestOptions) throws AlgoliaException {
return new IndexBrowser(client, encodedIndexName, params, cursor, requestOptions);
} | java | public IndexBrowser browseFrom(Query params, String cursor, RequestOptions requestOptions) throws AlgoliaException {
return new IndexBrowser(client, encodedIndexName, params, cursor, requestOptions);
} | [
"public",
"IndexBrowser",
"browseFrom",
"(",
"Query",
"params",
",",
"String",
"cursor",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"return",
"new",
"IndexBrowser",
"(",
"client",
",",
"encodedIndexName",
",",
"params",
",",
"... | Browse all index content starting from a cursor
@param requestOptions Options to pass to this request | [
"Browse",
"all",
"index",
"content",
"starting",
"from",
"a",
"cursor"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L802-L804 |
Jasig/uPortal | uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletDefinitionForm.java | PortletDefinitionForm.setPrincipals | public void setPrincipals(Set<JsonEntityBean> newPrincipals, boolean initPermissionsForNew) {
final Set<JsonEntityBean> previousPrincipals = new HashSet<>(principals);
principals.clear();
principals.addAll(newPrincipals);
if (initPermissionsForNew) {
principals.stream()
.forEach(
bean -> {
if (!previousPrincipals.contains(bean)) {
/*
* Previously unknown principals receive BROWSE & SUBSCRIBE by
* default (but not CONFIGURE!); known principals do not receive
* this treatment b/c we don't want to reset previous selections.
*/
initPermissionsForPrincipal(bean);
}
});
}
} | java | public void setPrincipals(Set<JsonEntityBean> newPrincipals, boolean initPermissionsForNew) {
final Set<JsonEntityBean> previousPrincipals = new HashSet<>(principals);
principals.clear();
principals.addAll(newPrincipals);
if (initPermissionsForNew) {
principals.stream()
.forEach(
bean -> {
if (!previousPrincipals.contains(bean)) {
/*
* Previously unknown principals receive BROWSE & SUBSCRIBE by
* default (but not CONFIGURE!); known principals do not receive
* this treatment b/c we don't want to reset previous selections.
*/
initPermissionsForPrincipal(bean);
}
});
}
} | [
"public",
"void",
"setPrincipals",
"(",
"Set",
"<",
"JsonEntityBean",
">",
"newPrincipals",
",",
"boolean",
"initPermissionsForNew",
")",
"{",
"final",
"Set",
"<",
"JsonEntityBean",
">",
"previousPrincipals",
"=",
"new",
"HashSet",
"<>",
"(",
"principals",
")",
... | Replaces this form's collection of principals and <em>optionally</em> sets default
permissions (SUBSCRIBE+BROWSE) for new principals
@param newPrincipals
@param initPermissionsForNew Give new principals <code>BROWSE</code> and <code>SUBSCRIBE
</code> permission when true | [
"Replaces",
"this",
"form",
"s",
"collection",
"of",
"principals",
"and",
"<em",
">",
"optionally<",
"/",
"em",
">",
"sets",
"default",
"permissions",
"(",
"SUBSCRIBE",
"+",
"BROWSE",
")",
"for",
"new",
"principals"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletDefinitionForm.java#L478-L498 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.setBaselineBudgetWork | public void setBaselineBudgetWork(int baselineNumber, Duration value)
{
set(selectField(AssignmentFieldLists.BASELINE_BUDGET_WORKS, baselineNumber), value);
} | java | public void setBaselineBudgetWork(int baselineNumber, Duration value)
{
set(selectField(AssignmentFieldLists.BASELINE_BUDGET_WORKS, baselineNumber), value);
} | [
"public",
"void",
"setBaselineBudgetWork",
"(",
"int",
"baselineNumber",
",",
"Duration",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"BASELINE_BUDGET_WORKS",
",",
"baselineNumber",
")",
",",
"value",
")",
";",
"}"
] | Set a baseline value.
@param baselineNumber baseline index (1-10)
@param value baseline value | [
"Set",
"a",
"baseline",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1485-L1488 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.