repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
lightblueseas/net-extensions | src/main/java/de/alpharogroup/net/socket/SocketExtensions.java | SocketExtensions.writeObject | public static void writeObject(final Socket socket, final int port, final Object objectToSend)
throws IOException {
"""
Writes the given Object to the given Socket who listen to the given port.
@param socket
The Socket to the receiver.
@param port
The port who listen the receiver.
@param objectToSend
Th... | java | public static void writeObject(final Socket socket, final int port, final Object objectToSend)
throws IOException
{
writeObject(socket.getInetAddress(), port, objectToSend);
} | [
"public",
"static",
"void",
"writeObject",
"(",
"final",
"Socket",
"socket",
",",
"final",
"int",
"port",
",",
"final",
"Object",
"objectToSend",
")",
"throws",
"IOException",
"{",
"writeObject",
"(",
"socket",
".",
"getInetAddress",
"(",
")",
",",
"port",
"... | Writes the given Object to the given Socket who listen to the given port.
@param socket
The Socket to the receiver.
@param port
The port who listen the receiver.
@param objectToSend
The Object to send.
@throws IOException
Signals that an I/O exception has occurred. | [
"Writes",
"the",
"given",
"Object",
"to",
"the",
"given",
"Socket",
"who",
"listen",
"to",
"the",
"given",
"port",
"."
] | train | https://github.com/lightblueseas/net-extensions/blob/771757a93fa9ad13ce0fe061c158e5cba43344cb/src/main/java/de/alpharogroup/net/socket/SocketExtensions.java#L401-L405 |
iobeam/iobeam-client-java | src/main/java/com/iobeam/api/client/Iobeam.java | Iobeam.sendAsync | public void sendAsync(SendCallback callback) {
"""
Asynchronous version of send() that will not block the calling thread. Any provided callback
will be run on the background thread when the operation completes.
If `autoRetry` is set, failed requests will add the previous data to the new data store.
@param c... | java | public void sendAsync(SendCallback callback) {
List<ImportService.Submit> reqs;
try {
reqs = prepareDataRequests();
} catch (ApiException e) {
IobeamException ie = new IobeamException(e);
if (callback == null) {
throw ie;
} else {
... | [
"public",
"void",
"sendAsync",
"(",
"SendCallback",
"callback",
")",
"{",
"List",
"<",
"ImportService",
".",
"Submit",
">",
"reqs",
";",
"try",
"{",
"reqs",
"=",
"prepareDataRequests",
"(",
")",
";",
"}",
"catch",
"(",
"ApiException",
"e",
")",
"{",
"Iob... | Asynchronous version of send() that will not block the calling thread. Any provided callback
will be run on the background thread when the operation completes.
If `autoRetry` is set, failed requests will add the previous data to the new data store.
@param callback Callback for when the operation completes.
@throws Io... | [
"Asynchronous",
"version",
"of",
"send",
"()",
"that",
"will",
"not",
"block",
"the",
"calling",
"thread",
".",
"Any",
"provided",
"callback",
"will",
"be",
"run",
"on",
"the",
"background",
"thread",
"when",
"the",
"operation",
"completes",
"."
] | train | https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L1004-L1027 |
ansell/csvstream | src/main/java/com/github/ansell/csv/stream/CSVStream.java | CSVStream.newCSVWriter | public static SequenceWriter newCSVWriter(final Writer writer, CsvSchema schema) throws IOException {
"""
Returns a Jackson {@link SequenceWriter} which will write CSV lines to the
given {@link Writer} using the {@link CsvSchema}.
@param writer
The writer which will receive the CSV file.
@param schema
The {... | java | public static SequenceWriter newCSVWriter(final Writer writer, CsvSchema schema) throws IOException {
return defaultMapper().writerWithDefaultPrettyPrinter().with(schema).forType(List.class).writeValues(writer);
} | [
"public",
"static",
"SequenceWriter",
"newCSVWriter",
"(",
"final",
"Writer",
"writer",
",",
"CsvSchema",
"schema",
")",
"throws",
"IOException",
"{",
"return",
"defaultMapper",
"(",
")",
".",
"writerWithDefaultPrettyPrinter",
"(",
")",
".",
"with",
"(",
"schema",... | Returns a Jackson {@link SequenceWriter} which will write CSV lines to the
given {@link Writer} using the {@link CsvSchema}.
@param writer
The writer which will receive the CSV file.
@param schema
The {@link CsvSchema} that will be used by the returned Jackson
{@link SequenceWriter}.
@return A Jackson {@link SequenceW... | [
"Returns",
"a",
"Jackson",
"{",
"@link",
"SequenceWriter",
"}",
"which",
"will",
"write",
"CSV",
"lines",
"to",
"the",
"given",
"{",
"@link",
"Writer",
"}",
"using",
"the",
"{",
"@link",
"CsvSchema",
"}",
"."
] | train | https://github.com/ansell/csvstream/blob/9468bfbd6997fbc4237eafc990ba811cd5905dc1/src/main/java/com/github/ansell/csv/stream/CSVStream.java#L538-L540 |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.getReplacedMazeString | public String getReplacedMazeString(List<Map<Point, Character>> replacements) {
"""
Generates a string representation of this maze but replacing all the indicated
points with the characters provided.
@param replacements list with maps of point-character replacements.
@return String representation of the maze wi... | java | public String getReplacedMazeString(List<Map<Point, Character>> replacements) {
String[] stringMaze = toStringArray();
for (Map<Point, Character> replacement : replacements) {
for (Point p : replacement.keySet()) {
int row = p.y;
int column = p.x;
... | [
"public",
"String",
"getReplacedMazeString",
"(",
"List",
"<",
"Map",
"<",
"Point",
",",
"Character",
">",
">",
"replacements",
")",
"{",
"String",
"[",
"]",
"stringMaze",
"=",
"toStringArray",
"(",
")",
";",
"for",
"(",
"Map",
"<",
"Point",
",",
"Charac... | Generates a string representation of this maze but replacing all the indicated
points with the characters provided.
@param replacements list with maps of point-character replacements.
@return String representation of the maze with the replacements. | [
"Generates",
"a",
"string",
"representation",
"of",
"this",
"maze",
"but",
"replacing",
"all",
"the",
"indicated",
"points",
"with",
"the",
"characters",
"provided",
"."
] | train | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L315-L332 |
cdapio/tigon | tigon-sql/src/main/java/co/cask/tigon/sql/util/MetaInformationParser.java | MetaInformationParser.getSchemaMap | public static Map<String, StreamSchema> getSchemaMap(File fileLocation) throws IOException {
"""
This function generates the {@link co.cask.tigon.sql.flowlet.StreamSchema} for each query specified by the user
@param fileLocation Directory that contains the qtree.xml file & the output_spec.cfg
@return A map of qu... | java | public static Map<String, StreamSchema> getSchemaMap(File fileLocation) throws IOException {
FileInputStream fis = new FileInputStream(new File(fileLocation, Constants.OUTPUT_SPEC));
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
String line;
while ((line = reader.readLine()) !=... | [
"public",
"static",
"Map",
"<",
"String",
",",
"StreamSchema",
">",
"getSchemaMap",
"(",
"File",
"fileLocation",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"new",
"File",
"(",
"fileLocation",
",",
"Constants"... | This function generates the {@link co.cask.tigon.sql.flowlet.StreamSchema} for each query specified by the user
@param fileLocation Directory that contains the qtree.xml file & the output_spec.cfg
@return A map of query names and the associated {@link co.cask.tigon.sql.flowlet.StreamSchema}
@throws IOException | [
"This",
"function",
"generates",
"the",
"{"
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-sql/src/main/java/co/cask/tigon/sql/util/MetaInformationParser.java#L128-L143 |
alkacon/opencms-core | src/org/opencms/ui/apps/CmsWorkplaceAppManager.java | CmsWorkplaceAppManager.getAppSettings | public <T extends I_CmsAppSettings> T getAppSettings(CmsObject cms, Class<T> type)
throws InstantiationException, IllegalAccessException {
"""
Returns the user app setting of the given type.<p>
@param cms the cms context
@param type the app setting type
@return the app setting
@throws InstantiationEx... | java | public <T extends I_CmsAppSettings> T getAppSettings(CmsObject cms, Class<T> type)
throws InstantiationException, IllegalAccessException {
CmsUser user = cms.getRequestContext().getCurrentUser();
CmsUserSettings settings = new CmsUserSettings(user);
String settingsString = settings.getAddit... | [
"public",
"<",
"T",
"extends",
"I_CmsAppSettings",
">",
"T",
"getAppSettings",
"(",
"CmsObject",
"cms",
",",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"CmsUser",
"user",
"=",
"cms",
".",
"getRe... | Returns the user app setting of the given type.<p>
@param cms the cms context
@param type the app setting type
@return the app setting
@throws InstantiationException in case instantiating the settings type fails
@throws IllegalAccessException in case the settings default constructor is not accessible | [
"Returns",
"the",
"user",
"app",
"setting",
"of",
"the",
"given",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsWorkplaceAppManager.java#L369-L384 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ResultUtil.java | ResultUtil.getAggBuckets | public static <T> T getAggBuckets(Map<String,?> map ,String metrics,Class<T> typeReference) {
"""
{
"key": "demoproject",
"doc_count": 30,
"successsums": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0,
"doc_count": 30
}
]
}
},
@param map
@param metrics successs... | java | public static <T> T getAggBuckets(Map<String,?> map ,String metrics,Class<T> typeReference){
if(map != null) {
Map<String, Object> metrics_ = (Map<String, Object>) map.get(metrics);
if (metrics_ != null) {
return (T) metrics_.get("buckets");
}
}
return (T)null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getAggBuckets",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"map",
",",
"String",
"metrics",
",",
"Class",
"<",
"T",
">",
"typeReference",
")",
"{",
"if",
"(",
"map",
"!=",
"null",
")",
"{",
"Map",
"<",
"Str... | {
"key": "demoproject",
"doc_count": 30,
"successsums": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 0,
"doc_count": 30
}
]
}
},
@param map
@param metrics successsums->buckets
@param typeReference
@param <T>
@return | [
"{",
"key",
":",
"demoproject",
"doc_count",
":",
"30",
"successsums",
":",
"{",
"doc_count_error_upper_bound",
":",
"0",
"sum_other_doc_count",
":",
"0",
"buckets",
":",
"[",
"{",
"key",
":",
"0",
"doc_count",
":",
"30",
"}",
"]",
"}",
"}"
] | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ResultUtil.java#L694-L702 |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.createProcedureLambdaLabel | protected Content createProcedureLambdaLabel(LinkInfoImpl linkInfo) {
"""
Create the label for a procedure lambda.
@param linkInfo the type.
@return the label.
"""
final ParameterizedType type = linkInfo.type.asParameterizedType();
if (type != null) {
final Type[] arguments = type.typeArguments();
... | java | protected Content createProcedureLambdaLabel(LinkInfoImpl linkInfo) {
final ParameterizedType type = linkInfo.type.asParameterizedType();
if (type != null) {
final Type[] arguments = type.typeArguments();
if (arguments != null && arguments.length > 0) {
return createLambdaLabel(linkInfo, arguments, argume... | [
"protected",
"Content",
"createProcedureLambdaLabel",
"(",
"LinkInfoImpl",
"linkInfo",
")",
"{",
"final",
"ParameterizedType",
"type",
"=",
"linkInfo",
".",
"type",
".",
"asParameterizedType",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"final",
... | Create the label for a procedure lambda.
@param linkInfo the type.
@return the label. | [
"Create",
"the",
"label",
"for",
"a",
"procedure",
"lambda",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L268-L277 |
phax/ph-web | ph-servlet/src/main/java/com/helger/servlet/mock/MockHttpSession.java | MockHttpSession.serializeState | @Nonnull
public Serializable serializeState () {
"""
Serialize the attributes of this session into an object that can be turned
into a byte array with standard Java serialization.
@return a representation of this session's serialized state
"""
final ICommonsMap <String, Object> aState = new CommonsHa... | java | @Nonnull
public Serializable serializeState ()
{
final ICommonsMap <String, Object> aState = new CommonsHashMap <> ();
for (final Map.Entry <String, Object> entry : m_aAttributes.entrySet ())
{
final String sName = entry.getKey ();
final Object aValue = entry.getValue ();
if (aValue in... | [
"@",
"Nonnull",
"public",
"Serializable",
"serializeState",
"(",
")",
"{",
"final",
"ICommonsMap",
"<",
"String",
",",
"Object",
">",
"aState",
"=",
"new",
"CommonsHashMap",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",... | Serialize the attributes of this session into an object that can be turned
into a byte array with standard Java serialization.
@return a representation of this session's serialized state | [
"Serialize",
"the",
"attributes",
"of",
"this",
"session",
"into",
"an",
"object",
"that",
"can",
"be",
"turned",
"into",
"a",
"byte",
"array",
"with",
"standard",
"Java",
"serialization",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/mock/MockHttpSession.java#L264-L288 |
kiegroup/droolsjbpm-integration | kie-spring-boot/kie-spring-boot-autoconfiguration/kie-server-spring-boot-autoconfiguration-jbpm/src/main/java/org/kie/server/springboot/jbpm/ContainerAliasResolver.java | ContainerAliasResolver.forCaseInstance | public String forCaseInstance(String alias, String caseId) {
"""
Looks up container id for given alias that is associated with case instance
@param alias container alias
@param caseId unique case instance id
@return
@throws IllegalArgumentException in case there are no containers for given alias
"""
... | java | public String forCaseInstance(String alias, String caseId) {
return registry.getContainerId(alias, new ByCaseIdContainerLocator(caseId));
} | [
"public",
"String",
"forCaseInstance",
"(",
"String",
"alias",
",",
"String",
"caseId",
")",
"{",
"return",
"registry",
".",
"getContainerId",
"(",
"alias",
",",
"new",
"ByCaseIdContainerLocator",
"(",
"caseId",
")",
")",
";",
"}"
] | Looks up container id for given alias that is associated with case instance
@param alias container alias
@param caseId unique case instance id
@return
@throws IllegalArgumentException in case there are no containers for given alias | [
"Looks",
"up",
"container",
"id",
"for",
"given",
"alias",
"that",
"is",
"associated",
"with",
"case",
"instance"
] | train | https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-spring-boot/kie-spring-boot-autoconfiguration/kie-server-spring-boot-autoconfiguration-jbpm/src/main/java/org/kie/server/springboot/jbpm/ContainerAliasResolver.java#L54-L56 |
vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/logging/PerformanceUtil.java | PerformanceUtil.slowLog | public static void slowLog(Logger logger, String key, long duration, long threshold, String context) {
"""
当处理时间超过预定的阈值时发出警告信息
@param logger
@param key
@param threshold 阈值(单位:ms)
@param context 需要记录的context信息,如请求的json等
"""
if (duration > threshold) {
logger.warn("[Performance Warning] task {} use {}ms... | java | public static void slowLog(Logger logger, String key, long duration, long threshold, String context) {
if (duration > threshold) {
logger.warn("[Performance Warning] task {} use {}ms, slow than {}ms, contxt={}", key, duration, threshold,
context);
}
} | [
"public",
"static",
"void",
"slowLog",
"(",
"Logger",
"logger",
",",
"String",
"key",
",",
"long",
"duration",
",",
"long",
"threshold",
",",
"String",
"context",
")",
"{",
"if",
"(",
"duration",
">",
"threshold",
")",
"{",
"logger",
".",
"warn",
"(",
... | 当处理时间超过预定的阈值时发出警告信息
@param logger
@param key
@param threshold 阈值(单位:ms)
@param context 需要记录的context信息,如请求的json等 | [
"当处理时间超过预定的阈值时发出警告信息"
] | train | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/logging/PerformanceUtil.java#L130-L135 |
requery/requery | requery/src/main/java/io/requery/sql/SchemaModifier.java | SchemaModifier.dropColumn | public <T> void dropColumn(Attribute<T, ?> attribute) {
"""
Alters the attribute's table and removes the column representing the given {@link Attribute}.
@param attribute being added
@param <T> parent type of the attribute
@throws TableModificationException if the removal fails.
"""
Type<T> ... | java | public <T> void dropColumn(Attribute<T, ?> attribute) {
Type<T> type = attribute.getDeclaringType();
if (attribute.isForeignKey()) {
// TODO MySQL need to drop FK constraint first
}
QueryBuilder qb = createQueryBuilder();
qb.keyword(ALTER, TABLE)
.tableNam... | [
"public",
"<",
"T",
">",
"void",
"dropColumn",
"(",
"Attribute",
"<",
"T",
",",
"?",
">",
"attribute",
")",
"{",
"Type",
"<",
"T",
">",
"type",
"=",
"attribute",
".",
"getDeclaringType",
"(",
")",
";",
"if",
"(",
"attribute",
".",
"isForeignKey",
"("... | Alters the attribute's table and removes the column representing the given {@link Attribute}.
@param attribute being added
@param <T> parent type of the attribute
@throws TableModificationException if the removal fails. | [
"Alters",
"the",
"attribute",
"s",
"table",
"and",
"removes",
"the",
"column",
"representing",
"the",
"given",
"{",
"@link",
"Attribute",
"}",
"."
] | train | https://github.com/requery/requery/blob/3070590c2ef76bb7062570bf9df03cd482db024a/requery/src/main/java/io/requery/sql/SchemaModifier.java#L306-L321 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/block/component/DirectionalComponent.java | DirectionalComponent.getMetaFromState | @Override
public int getMetaFromState(Block block, IBlockState state) {
"""
Gets the metadata from the {@link IBlockState}.
@param block the block
@param state the state
@return the meta from state
"""
if (getProperty() == HORIZONTAL)
return getDirection(state).getHorizontalIndex();
else
return... | java | @Override
public int getMetaFromState(Block block, IBlockState state)
{
if (getProperty() == HORIZONTAL)
return getDirection(state).getHorizontalIndex();
else
return getDirection(state).getIndex();
} | [
"@",
"Override",
"public",
"int",
"getMetaFromState",
"(",
"Block",
"block",
",",
"IBlockState",
"state",
")",
"{",
"if",
"(",
"getProperty",
"(",
")",
"==",
"HORIZONTAL",
")",
"return",
"getDirection",
"(",
"state",
")",
".",
"getHorizontalIndex",
"(",
")",... | Gets the metadata from the {@link IBlockState}.
@param block the block
@param state the state
@return the meta from state | [
"Gets",
"the",
"metadata",
"from",
"the",
"{",
"@link",
"IBlockState",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/block/component/DirectionalComponent.java#L174-L181 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.forEntireMethod | public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, XMethod xmethod) {
"""
Create a SourceLineAnnotation covering an entire method.
@param javaClass
JavaClass containing the method
@param xmethod
the method
@return a SourceLineAnnotation for the entire method
"""
JavaClassAnd... | java | public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, XMethod xmethod) {
JavaClassAndMethod m = Hierarchy.findMethod(javaClass, xmethod.getName(), xmethod.getSignature());
if (m == null) {
return createUnknown(javaClass.getClassName(), javaClass.getSourceFileName());
... | [
"public",
"static",
"SourceLineAnnotation",
"forEntireMethod",
"(",
"JavaClass",
"javaClass",
",",
"XMethod",
"xmethod",
")",
"{",
"JavaClassAndMethod",
"m",
"=",
"Hierarchy",
".",
"findMethod",
"(",
"javaClass",
",",
"xmethod",
".",
"getName",
"(",
")",
",",
"x... | Create a SourceLineAnnotation covering an entire method.
@param javaClass
JavaClass containing the method
@param xmethod
the method
@return a SourceLineAnnotation for the entire method | [
"Create",
"a",
"SourceLineAnnotation",
"covering",
"an",
"entire",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L304-L311 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.applyVariant | static IBlockState applyVariant(IBlockState state, Variation variant) {
"""
Select the request variant of the Minecraft block, if applicable
@param state The block to be varied
@param colour The new variation
@return A new blockstate which is the requested variant of the original, if such a variant exists; othe... | java | static IBlockState applyVariant(IBlockState state, Variation variant)
{
// Try the variant property first - if that fails, look for other properties that match the supplied variant.
boolean relaxRequirements = false;
for (int i = 0; i < 2; i++)
{
for (IProperty prop : sta... | [
"static",
"IBlockState",
"applyVariant",
"(",
"IBlockState",
"state",
",",
"Variation",
"variant",
")",
"{",
"// Try the variant property first - if that fails, look for other properties that match the supplied variant.",
"boolean",
"relaxRequirements",
"=",
"false",
";",
"for",
... | Select the request variant of the Minecraft block, if applicable
@param state The block to be varied
@param colour The new variation
@return A new blockstate which is the requested variant of the original, if such a variant exists; otherwise it returns the original block. | [
"Select",
"the",
"request",
"variant",
"of",
"the",
"Minecraft",
"block",
"if",
"applicable"
] | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L530-L553 |
GoogleCloudPlatform/google-cloud-datastore | java/datastore/src/main/java/com/google/datastore/v1/client/QuerySplitterImpl.java | QuerySplitterImpl.createScatterQuery | private Query.Builder createScatterQuery(Query query, int numSplits) {
"""
Creates a scatter query from the given user query
@param query the user's query.
@param numSplits the number of splits to create.
"""
// TODO(pcostello): We can potentially support better splits with equality filters in our quer... | java | private Query.Builder createScatterQuery(Query query, int numSplits) {
// TODO(pcostello): We can potentially support better splits with equality filters in our query
// if there exists a composite index on property, __scatter__, __key__. Until an API for
// metadata exists, this isn't possible. Note that a... | [
"private",
"Query",
".",
"Builder",
"createScatterQuery",
"(",
"Query",
"query",
",",
"int",
"numSplits",
")",
"{",
"// TODO(pcostello): We can potentially support better splits with equality filters in our query",
"// if there exists a composite index on property, __scatter__, __key__. ... | Creates a scatter query from the given user query
@param query the user's query.
@param numSplits the number of splits to create. | [
"Creates",
"a",
"scatter",
"query",
"from",
"the",
"given",
"user",
"query"
] | train | https://github.com/GoogleCloudPlatform/google-cloud-datastore/blob/a23940d0634d7f537faf01ad9e60598046bcb40a/java/datastore/src/main/java/com/google/datastore/v1/client/QuerySplitterImpl.java#L210-L228 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Request.java | Request.executeConnectionAndWait | public static List<Response> executeConnectionAndWait(HttpURLConnection connection, RequestBatch requests) {
"""
Executes requests that have already been serialized into an HttpURLConnection. No validation is done that the
contents of the connection actually reflect the serialized requests, so it is the caller's ... | java | public static List<Response> executeConnectionAndWait(HttpURLConnection connection, RequestBatch requests) {
List<Response> responses = Response.fromHttpConnection(connection, requests);
Utility.disconnectQuietly(connection);
int numRequests = requests.size();
if (numRequests != respon... | [
"public",
"static",
"List",
"<",
"Response",
">",
"executeConnectionAndWait",
"(",
"HttpURLConnection",
"connection",
",",
"RequestBatch",
"requests",
")",
"{",
"List",
"<",
"Response",
">",
"responses",
"=",
"Response",
".",
"fromHttpConnection",
"(",
"connection",... | Executes requests that have already been serialized into an HttpURLConnection. No validation is done that the
contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to
ensure that it will correctly generate the desired responses.
<p/>
This should only be called if you ... | [
"Executes",
"requests",
"that",
"have",
"already",
"been",
"serialized",
"into",
"an",
"HttpURLConnection",
".",
"No",
"validation",
"is",
"done",
"that",
"the",
"contents",
"of",
"the",
"connection",
"actually",
"reflect",
"the",
"serialized",
"requests",
"so",
... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L1552-L1578 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/ScopeContext.java | ScopeContext.getServerScope | public static Server getServerScope(PageContext pc, boolean jsr223) {
"""
return the server Scope for this context
@param pc
@return server scope
"""
if (server == null) {
server = new ServerImpl(pc, jsr223);
}
return server;
} | java | public static Server getServerScope(PageContext pc, boolean jsr223) {
if (server == null) {
server = new ServerImpl(pc, jsr223);
}
return server;
} | [
"public",
"static",
"Server",
"getServerScope",
"(",
"PageContext",
"pc",
",",
"boolean",
"jsr223",
")",
"{",
"if",
"(",
"server",
"==",
"null",
")",
"{",
"server",
"=",
"new",
"ServerImpl",
"(",
"pc",
",",
"jsr223",
")",
";",
"}",
"return",
"server",
... | return the server Scope for this context
@param pc
@return server scope | [
"return",
"the",
"server",
"Scope",
"for",
"this",
"context"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/ScopeContext.java#L171-L176 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/UIUtils.java | UIUtils.getColorAttr | public static int getColorAttr(Context ctx, @AttrRes int colorAttrId) {
"""
Get the color value for give attribute
@param ctx
@param colorAttrId
@return
"""
int[] attrs = new int[] { colorAttrId /* index 0 */};
TypedArray ta = ctx.obtainStyledAttributes(attrs);
int colorFromTheme = t... | java | public static int getColorAttr(Context ctx, @AttrRes int colorAttrId){
int[] attrs = new int[] { colorAttrId /* index 0 */};
TypedArray ta = ctx.obtainStyledAttributes(attrs);
int colorFromTheme = ta.getColor(0, 0);
ta.recycle();
return colorFromTheme;
} | [
"public",
"static",
"int",
"getColorAttr",
"(",
"Context",
"ctx",
",",
"@",
"AttrRes",
"int",
"colorAttrId",
")",
"{",
"int",
"[",
"]",
"attrs",
"=",
"new",
"int",
"[",
"]",
"{",
"colorAttrId",
"/* index 0 */",
"}",
";",
"TypedArray",
"ta",
"=",
"ctx",
... | Get the color value for give attribute
@param ctx
@param colorAttrId
@return | [
"Get",
"the",
"color",
"value",
"for",
"give",
"attribute"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/UIUtils.java#L136-L142 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/platform/entitylists/ListViewUrl.java | ListViewUrl.getViewEntityContainerUrl | public static MozuUrl getViewEntityContainerUrl(String entityId, String entityListFullName, String responseFields, String viewName) {
"""
Get Resource Url for GetViewEntityContainer
@param entityId Unique identifier for an entity, which defines the schema, rules, and formats for JSON entities within the MZDB ( Mo... | java | public static MozuUrl getViewEntityContainerUrl(String entityId, String entityListFullName, String responseFields, String viewName)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/views/{viewName}/entityContainers/{entityId}?responseFields={responseFields}");
formatte... | [
"public",
"static",
"MozuUrl",
"getViewEntityContainerUrl",
"(",
"String",
"entityId",
",",
"String",
"entityListFullName",
",",
"String",
"responseFields",
",",
"String",
"viewName",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/plat... | Get Resource Url for GetViewEntityContainer
@param entityId Unique identifier for an entity, which defines the schema, rules, and formats for JSON entities within the MZDB ( Mongo DB).
@param entityListFullName The full name of the EntityList including namespace in name@nameSpace format
@param responseFields Filtering ... | [
"Get",
"Resource",
"Url",
"for",
"GetViewEntityContainer"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/entitylists/ListViewUrl.java#L64-L72 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.getParticipants | public Observable<ComapiResult<List<Participant>>> getParticipants(@NonNull final String conversationId) {
"""
Returns observable to add a participant to.
@param conversationId ID of a conversation to add a participant to.
@return Observable to get a list of conversation participants.
"""
final St... | java | public Observable<ComapiResult<List<Participant>>> getParticipants(@NonNull final String conversationId) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueGetParticipants(conversationId);
} else if (TextUtils.isEmpty(token)) ... | [
"public",
"Observable",
"<",
"ComapiResult",
"<",
"List",
"<",
"Participant",
">",
">",
">",
"getParticipants",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
")",
"{",
"final",
"String",
"token",
"=",
"getToken",
"(",
")",
";",
"if",
"(",
"sess... | Returns observable to add a participant to.
@param conversationId ID of a conversation to add a participant to.
@return Observable to get a list of conversation participants. | [
"Returns",
"observable",
"to",
"add",
"a",
"participant",
"to",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L636-L647 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ServicesApi.java | ServicesApi.updateJiraService | public JiraService updateJiraService(Object projectIdOrPath, JiraService jira) throws GitLabApiException {
"""
Updates the JIRA service settings for a project.
<pre><code>GitLab Endpoint: PUT /projects/:id/services/jira</code></pre>
The following properties on the JiraService instance are utilized in the upd... | java | public JiraService updateJiraService(Object projectIdOrPath, JiraService jira) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("merge_requests_events", jira.getMergeRequestsEvents())
.withParam("commit_events", jira.getCommitEvents())
... | [
"public",
"JiraService",
"updateJiraService",
"(",
"Object",
"projectIdOrPath",
",",
"JiraService",
"jira",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"merge_requests_events\"",
... | Updates the JIRA service settings for a project.
<pre><code>GitLab Endpoint: PUT /projects/:id/services/jira</code></pre>
The following properties on the JiraService instance are utilized in the update of the settings:
<p>
mergeRequestsEvents (optional) - Enable notifications for merge request events
commitEvents (op... | [
"Updates",
"the",
"JIRA",
"service",
"settings",
"for",
"a",
"project",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ServicesApi.java#L290-L302 |
rometools/rome | rome/src/main/java/com/rometools/rome/io/impl/DCModuleGenerator.java | DCModuleGenerator.generateSubjectElement | protected final Element generateSubjectElement(final DCSubject subject) {
"""
Utility method to generate an element for a subject.
<p>
@param subject the subject to generate an element for.
@return the element for the subject.
"""
final Element subjectElement = new Element("subject", getDCNamespa... | java | protected final Element generateSubjectElement(final DCSubject subject) {
final Element subjectElement = new Element("subject", getDCNamespace());
final String taxonomyUri = subject.getTaxonomyUri();
final String value = subject.getValue();
if (taxonomyUri != null) {
fina... | [
"protected",
"final",
"Element",
"generateSubjectElement",
"(",
"final",
"DCSubject",
"subject",
")",
"{",
"final",
"Element",
"subjectElement",
"=",
"new",
"Element",
"(",
"\"subject\"",
",",
"getDCNamespace",
"(",
")",
")",
";",
"final",
"String",
"taxonomyUri",... | Utility method to generate an element for a subject.
<p>
@param subject the subject to generate an element for.
@return the element for the subject. | [
"Utility",
"method",
"to",
"generate",
"an",
"element",
"for",
"a",
"subject",
".",
"<p",
">"
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/DCModuleGenerator.java#L189-L219 |
tvesalainen/util | util/src/main/java/org/vesalainen/navi/Area.java | Area.getSquare | public static Area getSquare(double latFrom, double latTo, double lonFrom, double lonTo) {
"""
Returns rectangular area. Area is limited by lat/lon coordinates
@param latFrom
@param latTo
@param lonFrom
@param lonTo
@return
"""
Location[] locs = new Location[4];
locs[0] = new Location(la... | java | public static Area getSquare(double latFrom, double latTo, double lonFrom, double lonTo)
{
Location[] locs = new Location[4];
locs[0] = new Location(latFrom, lonFrom);
locs[1] = new Location(latFrom, lonTo);
locs[2] = new Location(latTo, lonFrom);
locs[3] = new Location... | [
"public",
"static",
"Area",
"getSquare",
"(",
"double",
"latFrom",
",",
"double",
"latTo",
",",
"double",
"lonFrom",
",",
"double",
"lonTo",
")",
"{",
"Location",
"[",
"]",
"locs",
"=",
"new",
"Location",
"[",
"4",
"]",
";",
"locs",
"[",
"0",
"]",
"=... | Returns rectangular area. Area is limited by lat/lon coordinates
@param latFrom
@param latTo
@param lonFrom
@param lonTo
@return | [
"Returns",
"rectangular",
"area",
".",
"Area",
"is",
"limited",
"by",
"lat",
"/",
"lon",
"coordinates"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/Area.java#L103-L111 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInboundLink.java | HttpInboundLink.checkForH2MagicString | private boolean checkForH2MagicString(HttpInboundServiceContextImpl isc) {
"""
Check the beginning of the current read buffer for the http/2 preface string
@param isc the HttpInboundServiceContextImpl to use
@return true if the magic string was found
"""
boolean hasMagicString = false;
WsB... | java | private boolean checkForH2MagicString(HttpInboundServiceContextImpl isc) {
boolean hasMagicString = false;
WsByteBuffer buffer;
if (myTSC == null || myTSC.getReadInterface() == null ||
(buffer = myTSC.getReadInterface().getBuffer()) == null) {
return hasMagicString;
... | [
"private",
"boolean",
"checkForH2MagicString",
"(",
"HttpInboundServiceContextImpl",
"isc",
")",
"{",
"boolean",
"hasMagicString",
"=",
"false",
";",
"WsByteBuffer",
"buffer",
";",
"if",
"(",
"myTSC",
"==",
"null",
"||",
"myTSC",
".",
"getReadInterface",
"(",
")",... | Check the beginning of the current read buffer for the http/2 preface string
@param isc the HttpInboundServiceContextImpl to use
@return true if the magic string was found | [
"Check",
"the",
"beginning",
"of",
"the",
"current",
"read",
"buffer",
"for",
"the",
"http",
"/",
"2",
"preface",
"string"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInboundLink.java#L991-L1021 |
jpelzer/pelzer-util | src/main/java/com/pelzer/util/OverridableFields.java | OverridableFields.getObjectForString | private Object getObjectForString(Class<?> type, String values[]) throws Exception {
"""
This method is similar to {@link #getObjectForString(Class, String[])} except that it returns
an array of type objects. Expects the type variable to be an array.
"""
if(values == null || values.length == 0)
th... | java | private Object getObjectForString(Class<?> type, String values[]) throws Exception{
if(values == null || values.length == 0)
throw new Exception("getObjectForString: values was null or of zero length");
Object array = Array.newInstance(type.getComponentType(), values.length);
// Now fill in the va... | [
"private",
"Object",
"getObjectForString",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"values",
"[",
"]",
")",
"throws",
"Exception",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"length",
"==",
"0",
")",
"throw",
"new",
"Excep... | This method is similar to {@link #getObjectForString(Class, String[])} except that it returns
an array of type objects. Expects the type variable to be an array. | [
"This",
"method",
"is",
"similar",
"to",
"{"
] | train | https://github.com/jpelzer/pelzer-util/blob/ec14f2573fd977d1442dba5d1507a264f5ea9aa6/src/main/java/com/pelzer/util/OverridableFields.java#L131-L139 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/lifecycle/LifeCycleController.java | LifeCycleController.createLifecycleCallback | private Application.ActivityLifecycleCallbacks createLifecycleCallback() {
"""
Creates {@link Application.ActivityLifecycleCallbacks} listener that will respond to onResume and onPause of any Activity in the application
obtaining information if the Application is in the background or foreground.
@return Applic... | java | private Application.ActivityLifecycleCallbacks createLifecycleCallback() {
return new Application.ActivityLifecycleCallbacks() {
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
}
@Override
public void onActivi... | [
"private",
"Application",
".",
"ActivityLifecycleCallbacks",
"createLifecycleCallback",
"(",
")",
"{",
"return",
"new",
"Application",
".",
"ActivityLifecycleCallbacks",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onActivityCreated",
"(",
"Activity",
"activity",
... | Creates {@link Application.ActivityLifecycleCallbacks} listener that will respond to onResume and onPause of any Activity in the application
obtaining information if the Application is in the background or foreground.
@return Application lifecycle callbacks to be registered on the system by the SDK. | [
"Creates",
"{",
"@link",
"Application",
".",
"ActivityLifecycleCallbacks",
"}",
"listener",
"that",
"will",
"respond",
"to",
"onResume",
"and",
"onPause",
"of",
"any",
"Activity",
"in",
"the",
"application",
"obtaining",
"information",
"if",
"the",
"Application",
... | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/lifecycle/LifeCycleController.java#L96-L134 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseOffsetShortLocalizedGMT | public int parseOffsetShortLocalizedGMT(String text, ParsePosition pos) {
"""
Returns offset from GMT(UTC) in milliseconds for the given short localized GMT
offset format string. When the given string cannot be parsed, this method
sets the current position as the error index to <code>ParsePosition pos</code>
an... | java | public int parseOffsetShortLocalizedGMT(String text, ParsePosition pos) {
return parseOffsetLocalizedGMT(text, pos, true, null);
} | [
"public",
"int",
"parseOffsetShortLocalizedGMT",
"(",
"String",
"text",
",",
"ParsePosition",
"pos",
")",
"{",
"return",
"parseOffsetLocalizedGMT",
"(",
"text",
",",
"pos",
",",
"true",
",",
"null",
")",
";",
"}"
] | Returns offset from GMT(UTC) in milliseconds for the given short localized GMT
offset format string. When the given string cannot be parsed, this method
sets the current position as the error index to <code>ParsePosition pos</code>
and returns 0.
@param text the text contains a short localized GMT offset string at the... | [
"Returns",
"offset",
"from",
"GMT",
"(",
"UTC",
")",
"in",
"milliseconds",
"for",
"the",
"given",
"short",
"localized",
"GMT",
"offset",
"format",
"string",
".",
"When",
"the",
"given",
"string",
"cannot",
"be",
"parsed",
"this",
"method",
"sets",
"the",
"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L992-L994 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/execution/impl/common/DefaultFileCopierUtil.java | DefaultFileCopierUtil.appendRemoteFileExtension | @Override
public String appendRemoteFileExtension(final String filepath, final String fileext) {
"""
@return a string with a file extension appended if it is not already on the file path
provided.
@param filepath the file path string
@param fileext the file extension, if it does not start with a "." one... | java | @Override
public String appendRemoteFileExtension(final String filepath, final String fileext) {
if (null == fileext) {
return filepath;
}
String result = filepath;
String ext = fileext;
if (!ext.startsWith(".")) {
ext = "." + fileext;
}
... | [
"@",
"Override",
"public",
"String",
"appendRemoteFileExtension",
"(",
"final",
"String",
"filepath",
",",
"final",
"String",
"fileext",
")",
"{",
"if",
"(",
"null",
"==",
"fileext",
")",
"{",
"return",
"filepath",
";",
"}",
"String",
"result",
"=",
"filepat... | @return a string with a file extension appended if it is not already on the file path
provided.
@param filepath the file path string
@param fileext the file extension, if it does not start with a "." one will be prepended
first. If null, the unmodified filepath will be returned. | [
"@return",
"a",
"string",
"with",
"a",
"file",
"extension",
"appended",
"if",
"it",
"is",
"not",
"already",
"on",
"the",
"file",
"path",
"provided",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/impl/common/DefaultFileCopierUtil.java#L207-L219 |
nutzam/nutzwx | src/main/java/org/nutz/weixin/util/Wxs.java | Wxs.checkPayReturnMap | public static NutMap checkPayReturnMap(NutMap map, String key) {
"""
检查一下支付平台返回的 xml,是否签名合法,如果合法,转换成一个 map
@param map
描述支付平台返回的 xml 信息的 Map 对象
@param key
商户秘钥
@return 合法的 Map
@throws "e.wx.sign.invalid"
@see <a href=
"https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1">
支付平台文档</a>
"""
... | java | public static NutMap checkPayReturnMap(NutMap map, String key) {
if (!map.containsKey("sign")) {
throw Lang.makeThrow("e.wx.pay.re.error : %s", map);
}
String sign = map.remove("sign").toString();
String sign2 = Wxs.genPaySignMD5(map, key);
if (!sign.equals(sign2))
... | [
"public",
"static",
"NutMap",
"checkPayReturnMap",
"(",
"NutMap",
"map",
",",
"String",
"key",
")",
"{",
"if",
"(",
"!",
"map",
".",
"containsKey",
"(",
"\"sign\"",
")",
")",
"{",
"throw",
"Lang",
".",
"makeThrow",
"(",
"\"e.wx.pay.re.error : %s\"",
",",
"... | 检查一下支付平台返回的 xml,是否签名合法,如果合法,转换成一个 map
@param map
描述支付平台返回的 xml 信息的 Map 对象
@param key
商户秘钥
@return 合法的 Map
@throws "e.wx.sign.invalid"
@see <a href=
"https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1">
支付平台文档</a> | [
"检查一下支付平台返回的",
"xml,是否签名合法,如果合法,转换成一个",
"map"
] | train | https://github.com/nutzam/nutzwx/blob/e6c8831b75f8a96bcc060b0c5562b882eefcf5ee/src/main/java/org/nutz/weixin/util/Wxs.java#L180-L189 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java | OUTRES.initialRange | private DoubleDBIDList initialRange(DBIDRef obj, DBIDs cands, PrimitiveDistanceFunction<? super NumberVector> df, double eps, KernelDensityEstimator kernel, ModifiableDoubleDBIDList n) {
"""
Initial range query.
@param obj Object
@param cands Candidates
@param df Distance function
@param eps Epsilon radius
... | java | private DoubleDBIDList initialRange(DBIDRef obj, DBIDs cands, PrimitiveDistanceFunction<? super NumberVector> df, double eps, KernelDensityEstimator kernel, ModifiableDoubleDBIDList n) {
n.clear();
NumberVector o = kernel.relation.get(obj);
final double twoeps = eps * 2;
int matches = 0;
for(DBIDIte... | [
"private",
"DoubleDBIDList",
"initialRange",
"(",
"DBIDRef",
"obj",
",",
"DBIDs",
"cands",
",",
"PrimitiveDistanceFunction",
"<",
"?",
"super",
"NumberVector",
">",
"df",
",",
"double",
"eps",
",",
"KernelDensityEstimator",
"kernel",
",",
"ModifiableDoubleDBIDList",
... | Initial range query.
@param obj Object
@param cands Candidates
@param df Distance function
@param eps Epsilon radius
@param kernel Kernel
@param n Output buffer
@return Neighbors | [
"Initial",
"range",
"query",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java#L199-L215 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java | ExpressRouteCrossConnectionsInner.createOrUpdate | public ExpressRouteCrossConnectionInner createOrUpdate(String resourceGroupName, String crossConnectionName, ExpressRouteCrossConnectionInner parameters) {
"""
Update the specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the E... | java | public ExpressRouteCrossConnectionInner createOrUpdate(String resourceGroupName, String crossConnectionName, ExpressRouteCrossConnectionInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, parameters).toBlocking().last().body();
} | [
"public",
"ExpressRouteCrossConnectionInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
",",
"ExpressRouteCrossConnectionInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Update the specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@param parameters Parameters supplied to the update express route crossConnection operation.
@throws IllegalArgumentException thrown if para... | [
"Update",
"the",
"specified",
"ExpressRouteCrossConnection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L444-L446 |
cycorp/api-suite | core-api/src/main/java/com/cyc/query/exception/QueryConstructionException.java | QueryConstructionException.fromThrowable | public static QueryConstructionException fromThrowable(String message, Throwable cause) {
"""
Converts a Throwable to a QueryConstructionException with the specified detail message. If the
Throwable is a QueryConstructionException and if the Throwable's message is identical to the
one supplied, the Throwable wil... | java | public static QueryConstructionException fromThrowable(String message, Throwable cause) {
return (cause instanceof QueryConstructionException && Objects.equals(message, cause.getMessage()))
? (QueryConstructionException) cause
: new QueryConstructionException(message, cause);
... | [
"public",
"static",
"QueryConstructionException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"QueryConstructionException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
... | Converts a Throwable to a QueryConstructionException with the specified detail message. If the
Throwable is a QueryConstructionException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new QueryConstructionException wit... | [
"Converts",
"a",
"Throwable",
"to",
"a",
"QueryConstructionException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"QueryConstructionException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to"... | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/QueryConstructionException.java#L61-L65 |
wanglinsong/testharness | src/main/java/com/tascape/qa/th/libx/DefaultExecutor.java | DefaultExecutor.createThread | @Override
protected Thread createThread(final Runnable runnable, final String name) {
"""
Factory method to create a thread waiting for the result of an
asynchronous execution.
@param runnable the runnable passed to the thread
@param name the name of the thread
@return the thread
"""
re... | java | @Override
protected Thread createThread(final Runnable runnable, final String name) {
return new Thread(runnable, Thread.currentThread().getName() + "-exec");
} | [
"@",
"Override",
"protected",
"Thread",
"createThread",
"(",
"final",
"Runnable",
"runnable",
",",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Thread",
"(",
"runnable",
",",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getName",
"(",
")",
"+"... | Factory method to create a thread waiting for the result of an
asynchronous execution.
@param runnable the runnable passed to the thread
@param name the name of the thread
@return the thread | [
"Factory",
"method",
"to",
"create",
"a",
"thread",
"waiting",
"for",
"the",
"result",
"of",
"an",
"asynchronous",
"execution",
"."
] | train | https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/libx/DefaultExecutor.java#L33-L36 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitClustererParameters.java | SubunitClustererParameters.isHighConfidenceScores | public boolean isHighConfidenceScores(double sequenceIdentity, double sequenceCoverage) {
"""
Whether the subunits can be considered "identical" by sequence alignment.
For local sequence alignment (normalized by the number of aligned pairs)
this means 0.95 or higher identity and 0.75 or higher coverage.
For glo... | java | public boolean isHighConfidenceScores(double sequenceIdentity, double sequenceCoverage) {
if (useGlobalMetrics)
return sequenceIdentity>=hcSequenceIdentityGlobal;
else
return sequenceIdentity>=hcSequenceIdentityLocal && sequenceCoverage >= hcSequenceCoverageLocal;
} | [
"public",
"boolean",
"isHighConfidenceScores",
"(",
"double",
"sequenceIdentity",
",",
"double",
"sequenceCoverage",
")",
"{",
"if",
"(",
"useGlobalMetrics",
")",
"return",
"sequenceIdentity",
">=",
"hcSequenceIdentityGlobal",
";",
"else",
"return",
"sequenceIdentity",
... | Whether the subunits can be considered "identical" by sequence alignment.
For local sequence alignment (normalized by the number of aligned pairs)
this means 0.95 or higher identity and 0.75 or higher coverage.
For global sequence alignment (normalised by the alignment length)
this means 0.85 or higher sequence identit... | [
"Whether",
"the",
"subunits",
"can",
"be",
"considered",
"identical",
"by",
"sequence",
"alignment",
".",
"For",
"local",
"sequence",
"alignment",
"(",
"normalized",
"by",
"the",
"number",
"of",
"aligned",
"pairs",
")",
"this",
"means",
"0",
".",
"95",
"or",... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitClustererParameters.java#L502-L507 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java | GeometryTools.sortBy2DDistance | public static void sortBy2DDistance(IAtom[] atoms, Point2d point) {
"""
Sorts a Vector of atoms such that the 2D distances of the atom locations
from a given point are smallest for the first atoms in the vector.
See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for d... | java | public static void sortBy2DDistance(IAtom[] atoms, Point2d point) {
double distance1;
double distance2;
IAtom atom1;
IAtom atom2;
boolean doneSomething;
do {
doneSomething = false;
for (int f = 0; f < atoms.length - 1; f++) {
atom1 ... | [
"public",
"static",
"void",
"sortBy2DDistance",
"(",
"IAtom",
"[",
"]",
"atoms",
",",
"Point2d",
"point",
")",
"{",
"double",
"distance1",
";",
"double",
"distance2",
";",
"IAtom",
"atom1",
";",
"IAtom",
"atom2",
";",
"boolean",
"doneSomething",
";",
"do",
... | Sorts a Vector of atoms such that the 2D distances of the atom locations
from a given point are smallest for the first atoms in the vector.
See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets
@param point The point from which the distances to... | [
"Sorts",
"a",
"Vector",
"of",
"atoms",
"such",
"that",
"the",
"2D",
"distances",
"of",
"the",
"atom",
"locations",
"from",
"a",
"given",
"point",
"are",
"smallest",
"for",
"the",
"first",
"atoms",
"in",
"the",
"vector",
".",
"See",
"comment",
"for",
"cen... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L855-L875 |
liuyukuai/commons | commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java | ProcessUtils.processPage | public static <T, R> PageResponse<R> processPage(Class<R> clazz, PageResponse<T> pageResponse) {
"""
拷贝分页对象
@param clazz 目标类型
@param pageResponse 原对象
@param <T> 原数据类型
@param <R> 目标数据类型
@return 目标对象
"""
return processPage(clazz, pageResponse, (r1, src1) -> {
});
... | java | public static <T, R> PageResponse<R> processPage(Class<R> clazz, PageResponse<T> pageResponse) {
return processPage(clazz, pageResponse, (r1, src1) -> {
});
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"PageResponse",
"<",
"R",
">",
"processPage",
"(",
"Class",
"<",
"R",
">",
"clazz",
",",
"PageResponse",
"<",
"T",
">",
"pageResponse",
")",
"{",
"return",
"processPage",
"(",
"clazz",
",",
"pageResponse",
"... | 拷贝分页对象
@param clazz 目标类型
@param pageResponse 原对象
@param <T> 原数据类型
@param <R> 目标数据类型
@return 目标对象 | [
"拷贝分页对象"
] | train | https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java#L156-L159 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java | ChannelFrameworkImpl.addChannelInternal | private ChannelData addChannelInternal(String channelName, Class<?> factoryType, Map<Object, Object> inputPropertyBag, int weight) throws ChannelException {
"""
This method does the work of adding a channel data object to the
framework. It is called internally by both the addInbound and
addOutbound channel metho... | java | private ChannelData addChannelInternal(String channelName, Class<?> factoryType, Map<Object, Object> inputPropertyBag, int weight) throws ChannelException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "addChannelInternal: channelName=" + channelName + ", factoryTy... | [
"private",
"ChannelData",
"addChannelInternal",
"(",
"String",
"channelName",
",",
"Class",
"<",
"?",
">",
"factoryType",
",",
"Map",
"<",
"Object",
",",
"Object",
">",
"inputPropertyBag",
",",
"int",
"weight",
")",
"throws",
"ChannelException",
"{",
"if",
"("... | This method does the work of adding a channel data object to the
framework. It is called internally by both the addInbound and
addOutbound channel methods.
@param channelName
@param factoryType
@param inputPropertyBag
@param weight
@return channel data object resulting from the add.
@throws ChannelException | [
"This",
"method",
"does",
"the",
"work",
"of",
"adding",
"a",
"channel",
"data",
"object",
"to",
"the",
"framework",
".",
"It",
"is",
"called",
"internally",
"by",
"both",
"the",
"addInbound",
"and",
"addOutbound",
"channel",
"methods",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java#L901-L936 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/view/AutoResizeTextView.java | AutoResizeTextView.onTextChanged | @Override
protected void onTextChanged(final CharSequence text, final int start, final int before, final int after) {
"""
When text changes, set the force resize flag to true and reset the text size.
"""
mNeedsResize = true;
// Since this view may be reused, it is good to reset the text size
resetTextSi... | java | @Override
protected void onTextChanged(final CharSequence text, final int start, final int before, final int after) {
mNeedsResize = true;
// Since this view may be reused, it is good to reset the text size
resetTextSize();
} | [
"@",
"Override",
"protected",
"void",
"onTextChanged",
"(",
"final",
"CharSequence",
"text",
",",
"final",
"int",
"start",
",",
"final",
"int",
"before",
",",
"final",
"int",
"after",
")",
"{",
"mNeedsResize",
"=",
"true",
";",
"// Since this view may be reused,... | When text changes, set the force resize flag to true and reset the text size. | [
"When",
"text",
"changes",
"set",
"the",
"force",
"resize",
"flag",
"to",
"true",
"and",
"reset",
"the",
"text",
"size",
"."
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/view/AutoResizeTextView.java#L87-L92 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.intPredicate | public static IntPredicate intPredicate(CheckedIntPredicate function, Consumer<Throwable> handler) {
"""
Wrap a {@link CheckedPredicate} in a {@link IntPredicate} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
IntStream.of(1, 2, 3).filter(Unchecked.intPredicate(
i -> {
if (i < 0)
... | java | public static IntPredicate intPredicate(CheckedIntPredicate function, Consumer<Throwable> handler) {
return i -> {
try {
return function.test(i);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Excep... | [
"public",
"static",
"IntPredicate",
"intPredicate",
"(",
"CheckedIntPredicate",
"function",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"i",
"->",
"{",
"try",
"{",
"return",
"function",
".",
"test",
"(",
"i",
")",
";",
"}",
"catc... | Wrap a {@link CheckedPredicate} in a {@link IntPredicate} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
IntStream.of(1, 2, 3).filter(Unchecked.intPredicate(
i -> {
if (i < 0)
throw new Exception("Only positive numbers allowed");
return true;
},
e -> {
throw new IllegalStateException(e);
}
)... | [
"Wrap",
"a",
"{",
"@link",
"CheckedPredicate",
"}",
"in",
"a",
"{",
"@link",
"IntPredicate",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"IntStream",
".",
"of",
"(",
... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1551-L1562 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.locateClient | public ClientInfo locateClient (final Name key) {
"""
Locates the client with the specified name. Returns null if the client is not logged onto
any peer.
"""
return lookupNodeDatum(new Function<NodeObject,ClientInfo>() {
public ClientInfo apply (NodeObject nodeobj) {
return... | java | public ClientInfo locateClient (final Name key)
{
return lookupNodeDatum(new Function<NodeObject,ClientInfo>() {
public ClientInfo apply (NodeObject nodeobj) {
return nodeobj.clients.get(key);
}
});
} | [
"public",
"ClientInfo",
"locateClient",
"(",
"final",
"Name",
"key",
")",
"{",
"return",
"lookupNodeDatum",
"(",
"new",
"Function",
"<",
"NodeObject",
",",
"ClientInfo",
">",
"(",
")",
"{",
"public",
"ClientInfo",
"apply",
"(",
"NodeObject",
"nodeobj",
")",
... | Locates the client with the specified name. Returns null if the client is not logged onto
any peer. | [
"Locates",
"the",
"client",
"with",
"the",
"specified",
"name",
".",
"Returns",
"null",
"if",
"the",
"client",
"is",
"not",
"logged",
"onto",
"any",
"peer",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L416-L423 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java | IslamicCalendar.monthStart | private long monthStart(int year, int month) {
"""
Return the day # on which the given month starts. Days are counted
from the Hijri epoch, origin 0.
@param year The hijri year
@param month The hijri month, 0-based
"""
// Normalize year/month in case month is outside the normal bounds, which ma... | java | private long monthStart(int year, int month) {
// Normalize year/month in case month is outside the normal bounds, which may occur
// in the case of an add operation
int realYear = year + month / 12;
int realMonth = month % 12;
long ms = 0;
if (cType == CalculationType.IS... | [
"private",
"long",
"monthStart",
"(",
"int",
"year",
",",
"int",
"month",
")",
"{",
"// Normalize year/month in case month is outside the normal bounds, which may occur",
"// in the case of an add operation",
"int",
"realYear",
"=",
"year",
"+",
"month",
"/",
"12",
";",
"... | Return the day # on which the given month starts. Days are counted
from the Hijri epoch, origin 0.
@param year The hijri year
@param month The hijri month, 0-based | [
"Return",
"the",
"day",
"#",
"on",
"which",
"the",
"given",
"month",
"starts",
".",
"Days",
"are",
"counted",
"from",
"the",
"Hijri",
"epoch",
"origin",
"0",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IslamicCalendar.java#L585-L606 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VFS.java | VFS.mountAssembly | public static Closeable mountAssembly(VirtualFileAssembly assembly, VirtualFile mountPoint) throws IOException {
"""
Create and mount an assembly file system, returning a single handle which will unmount and
close the filesystem when closed.
@param assembly an {@link VirtualFileAssembly} to mount in the VFS
... | java | public static Closeable mountAssembly(VirtualFileAssembly assembly, VirtualFile mountPoint) throws IOException {
return doMount(new AssemblyFileSystem(assembly), mountPoint);
} | [
"public",
"static",
"Closeable",
"mountAssembly",
"(",
"VirtualFileAssembly",
"assembly",
",",
"VirtualFile",
"mountPoint",
")",
"throws",
"IOException",
"{",
"return",
"doMount",
"(",
"new",
"AssemblyFileSystem",
"(",
"assembly",
")",
",",
"mountPoint",
")",
";",
... | Create and mount an assembly file system, returning a single handle which will unmount and
close the filesystem when closed.
@param assembly an {@link VirtualFileAssembly} to mount in the VFS
@param mountPoint the point at which the filesystem should be mounted
@return a handle
@throws IOException if an error occurs | [
"Create",
"and",
"mount",
"an",
"assembly",
"file",
"system",
"returning",
"a",
"single",
"handle",
"which",
"will",
"unmount",
"and",
"close",
"the",
"filesystem",
"when",
"closed",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L503-L505 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java | ExpressRouteConnectionsInner.beginCreateOrUpdateAsync | public Observable<ExpressRouteConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
"""
Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
@param... | java | public Observable<ExpressRouteConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayNam... | [
"public",
"Observable",
"<",
"ExpressRouteConnectionInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"String",
"connectionName",
",",
"ExpressRouteConnectionInner",
"putExpressRouteConnectionParameters",
"... | Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@param putExpressRouteConnectionParameters Parame... | [
"Creates",
"a",
"connection",
"between",
"an",
"ExpressRoute",
"gateway",
"and",
"an",
"ExpressRoute",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L207-L214 |
samskivert/samskivert | src/main/java/com/samskivert/util/IntIntMap.java | IntIntMap.removeOrElse | public int removeOrElse (int key, int defval) {
"""
Removes the value mapped for the specified key.
@return the value to which the key was mapped or the supplied default value if there was no
mapping for that key.
"""
_modCount++;
int removed = removeImpl(key, defval);
checkShrink()... | java | public int removeOrElse (int key, int defval)
{
_modCount++;
int removed = removeImpl(key, defval);
checkShrink();
return removed;
} | [
"public",
"int",
"removeOrElse",
"(",
"int",
"key",
",",
"int",
"defval",
")",
"{",
"_modCount",
"++",
";",
"int",
"removed",
"=",
"removeImpl",
"(",
"key",
",",
"defval",
")",
";",
"checkShrink",
"(",
")",
";",
"return",
"removed",
";",
"}"
] | Removes the value mapped for the specified key.
@return the value to which the key was mapped or the supplied default value if there was no
mapping for that key. | [
"Removes",
"the",
"value",
"mapped",
"for",
"the",
"specified",
"key",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntIntMap.java#L179-L185 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/masterslave/MasterSlave.java | MasterSlave.getConnection | private static <T> T getConnection(CompletableFuture<T> connectionFuture, Object context) {
"""
Retrieve the connection from {@link ConnectionFuture}. Performs a blocking {@link ConnectionFuture#get()} to synchronize
the channel/connection initialization. Any exception is rethrown as {@link RedisConnectionExcepti... | java | private static <T> T getConnection(CompletableFuture<T> connectionFuture, Object context) {
try {
return connectionFuture.get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw RedisConnectionException.create(context.toString(), e);
... | [
"private",
"static",
"<",
"T",
">",
"T",
"getConnection",
"(",
"CompletableFuture",
"<",
"T",
">",
"connectionFuture",
",",
"Object",
"context",
")",
"{",
"try",
"{",
"return",
"connectionFuture",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedE... | Retrieve the connection from {@link ConnectionFuture}. Performs a blocking {@link ConnectionFuture#get()} to synchronize
the channel/connection initialization. Any exception is rethrown as {@link RedisConnectionException}.
@param connectionFuture must not be null.
@param context context information (single RedisURI, m... | [
"Retrieve",
"the",
"connection",
"from",
"{",
"@link",
"ConnectionFuture",
"}",
".",
"Performs",
"a",
"blocking",
"{",
"@link",
"ConnectionFuture#get",
"()",
"}",
"to",
"synchronize",
"the",
"channel",
"/",
"connection",
"initialization",
".",
"Any",
"exception",
... | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/masterslave/MasterSlave.java#L230-L252 |
soi-toolkit/soi-toolkit-mule | tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionSet.java | OptionSet.addOption | public OptionSet addOption(String key, Options.Multiplicity multiplicity) {
"""
Add a non-value option with the given key and multiplicity, and the default prefix
<p>
@param key The key for the option
@param multiplicity The multiplicity for the option
<p>
@return The set instance itself (to support ... | java | public OptionSet addOption(String key, Options.Multiplicity multiplicity) {
return addOption(key, false, Options.Separator.NONE, false, multiplicity);
} | [
"public",
"OptionSet",
"addOption",
"(",
"String",
"key",
",",
"Options",
".",
"Multiplicity",
"multiplicity",
")",
"{",
"return",
"addOption",
"(",
"key",
",",
"false",
",",
"Options",
".",
"Separator",
".",
"NONE",
",",
"false",
",",
"multiplicity",
")",
... | Add a non-value option with the given key and multiplicity, and the default prefix
<p>
@param key The key for the option
@param multiplicity The multiplicity for the option
<p>
@return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
<p>
@throws IllegalArgumentExcep... | [
"Add",
"a",
"non",
"-",
"value",
"option",
"with",
"the",
"given",
"key",
"and",
"multiplicity",
"and",
"the",
"default",
"prefix",
"<p",
">"
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionSet.java#L192-L194 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeFragment | public static String encodeFragment(String fragment, String encoding) throws UnsupportedEncodingException {
"""
Encodes the given URI fragment with the given encoding.
@param fragment the fragment to be encoded
@param encoding the character encoding to encode to
@return the encoded fragment
@throws Unsupported... | java | public static String encodeFragment(String fragment, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(fragment, encoding, HierarchicalUriComponents.Type.FRAGMENT);
} | [
"public",
"static",
"String",
"encodeFragment",
"(",
"String",
"fragment",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"fragment",
",",
"encoding",
",",
"Hierarchic... | Encodes the given URI fragment with the given encoding.
@param fragment the fragment to be encoded
@param encoding the character encoding to encode to
@return the encoded fragment
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"fragment",
"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#L318-L320 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpPacketFactory.java | RtcpPacketFactory.buildReport | public static RtcpPacket buildReport(RtpStatistics statistics) {
"""
Builds a packet containing an RTCP Report.
RTP receivers provide reception quality feedback using RTCP report
packets which may take one of two forms depending upon whether or not the
receiver is also a sender. The only difference between th... | java | public static RtcpPacket buildReport(RtpStatistics statistics) {
// TODO Validate padding
boolean padding = false;
// Build the initial report packet
RtcpReport report;
if(statistics.hasSent()) {
report = buildSenderReport(statistics, padding);
} else {
report = buildReceiverReport(statistics, pad... | [
"public",
"static",
"RtcpPacket",
"buildReport",
"(",
"RtpStatistics",
"statistics",
")",
"{",
"// TODO Validate padding",
"boolean",
"padding",
"=",
"false",
";",
"// Build the initial report packet",
"RtcpReport",
"report",
";",
"if",
"(",
"statistics",
".",
"hasSent"... | Builds a packet containing an RTCP Report.
RTP receivers provide reception quality feedback using RTCP report
packets which may take one of two forms depending upon whether or not the
receiver is also a sender. The only difference between the sender report
(SR) and receiver report (RR) forms, besides the packet type c... | [
"Builds",
"a",
"packet",
"containing",
"an",
"RTCP",
"Report",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpPacketFactory.java#L192-L209 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BooleanExtensions.java | BooleanExtensions.operator_and | @Pure
@Inline(value="($1 && $2)", constantExpression=true)
public static boolean operator_and(boolean a, boolean b) {
"""
The logical <code>and</code> (conjunction). This is the equivalent to the java <code>&&</code> operator.
@param a
a boolean value.
@param b
another boolean value.
@return <code>a && b<... | java | @Pure
@Inline(value="($1 && $2)", constantExpression=true)
public static boolean operator_and(boolean a, boolean b) {
return a && b;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"($1 && $2)\"",
",",
"constantExpression",
"=",
"true",
")",
"public",
"static",
"boolean",
"operator_and",
"(",
"boolean",
"a",
",",
"boolean",
"b",
")",
"{",
"return",
"a",
"&&",
"b",
";",
"}"
] | The logical <code>and</code> (conjunction). This is the equivalent to the java <code>&&</code> operator.
@param a
a boolean value.
@param b
another boolean value.
@return <code>a && b</code> | [
"The",
"logical",
"<code",
">",
"and<",
"/",
"code",
">",
"(",
"conjunction",
")",
".",
"This",
"is",
"the",
"equivalent",
"to",
"the",
"java",
"<code",
">",
"&&<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BooleanExtensions.java#L30-L34 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java | DataService.prepareCDCQuery | private <T extends IEntity> IntuitMessage prepareCDCQuery(List<? extends IEntity> entities, String changedSince) throws FMSException {
"""
Common method to prepare the request params for CDC query operation for both sync and async calls
@param entities
the list of entities
@param changedSince
the date where ... | java | private <T extends IEntity> IntuitMessage prepareCDCQuery(List<? extends IEntity> entities, String changedSince) throws FMSException {
IntuitMessage intuitMessage = new IntuitMessage();
RequestElements requestElements = intuitMessage.getRequestElements();
//set the request params
Map<St... | [
"private",
"<",
"T",
"extends",
"IEntity",
">",
"IntuitMessage",
"prepareCDCQuery",
"(",
"List",
"<",
"?",
"extends",
"IEntity",
">",
"entities",
",",
"String",
"changedSince",
")",
"throws",
"FMSException",
"{",
"IntuitMessage",
"intuitMessage",
"=",
"new",
"In... | Common method to prepare the request params for CDC query operation for both sync and async calls
@param entities
the list of entities
@param changedSince
the date where the entities should be listed from the last changed date
@return IntuitMessage the intuit message
@throws FMSException | [
"Common",
"method",
"to",
"prepare",
"the",
"request",
"params",
"for",
"CDC",
"query",
"operation",
"for",
"both",
"sync",
"and",
"async",
"calls"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L1475-L1504 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java | JacksonDBCollection.findOneById | public T findOneById(K id, DBObject fields) throws MongoException {
"""
Find an object by the given id
@param id The id
@return The object
@throws MongoException If an error occurred
"""
return findOne(createIdQuery(id), fields);
} | java | public T findOneById(K id, DBObject fields) throws MongoException {
return findOne(createIdQuery(id), fields);
} | [
"public",
"T",
"findOneById",
"(",
"K",
"id",
",",
"DBObject",
"fields",
")",
"throws",
"MongoException",
"{",
"return",
"findOne",
"(",
"createIdQuery",
"(",
"id",
")",
",",
"fields",
")",
";",
"}"
] | Find an object by the given id
@param id The id
@return The object
@throws MongoException If an error occurred | [
"Find",
"an",
"object",
"by",
"the",
"given",
"id"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L858-L860 |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java | VectorizedRleValuesReader.readIntegers | @Override
public void readIntegers(int total, WritableColumnVector c, int rowId) {
"""
Since this is only used to decode dictionary IDs, only decoding integers is supported.
"""
int left = total;
while (left > 0) {
if (this.currentCount == 0) this.readNextGroup();
int n = Math.min(left, t... | java | @Override
public void readIntegers(int total, WritableColumnVector c, int rowId) {
int left = total;
while (left > 0) {
if (this.currentCount == 0) this.readNextGroup();
int n = Math.min(left, this.currentCount);
switch (mode) {
case RLE:
c.putInts(rowId, n, currentValue);
... | [
"@",
"Override",
"public",
"void",
"readIntegers",
"(",
"int",
"total",
",",
"WritableColumnVector",
"c",
",",
"int",
"rowId",
")",
"{",
"int",
"left",
"=",
"total",
";",
"while",
"(",
"left",
">",
"0",
")",
"{",
"if",
"(",
"this",
".",
"currentCount",... | Since this is only used to decode dictionary IDs, only decoding integers is supported. | [
"Since",
"this",
"is",
"only",
"used",
"to",
"decode",
"dictionary",
"IDs",
"only",
"decoding",
"integers",
"is",
"supported",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java#L490-L509 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/ProxyUtil.java | ProxyUtil.createClientProxy | public static <T> T createClientProxy(ClassLoader classLoader, Class<T> proxyInterface, final IJsonRpcClient client) {
"""
Creates a {@link Proxy} of the given {@code proxyInterface} that uses the given {@link JsonRpcHttpClient}.
@param <T> the proxy type
@param classLoader the {@link ClassLoader... | java | public static <T> T createClientProxy(ClassLoader classLoader, Class<T> proxyInterface, final IJsonRpcClient client) {
return createClientProxy(classLoader, proxyInterface, client, new HashMap<String, String>());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createClientProxy",
"(",
"ClassLoader",
"classLoader",
",",
"Class",
"<",
"T",
">",
"proxyInterface",
",",
"final",
"IJsonRpcClient",
"client",
")",
"{",
"return",
"createClientProxy",
"(",
"classLoader",
",",
"proxyInter... | Creates a {@link Proxy} of the given {@code proxyInterface} that uses the given {@link JsonRpcHttpClient}.
@param <T> the proxy type
@param classLoader the {@link ClassLoader}
@param proxyInterface the interface to proxy
@param client the {@link JsonRpcHttpClient}
@return the proxied interface | [
"Creates",
"a",
"{",
"@link",
"Proxy",
"}",
"of",
"the",
"given",
"{",
"@code",
"proxyInterface",
"}",
"that",
"uses",
"the",
"given",
"{",
"@link",
"JsonRpcHttpClient",
"}",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/ProxyUtil.java#L188-L190 |
awslabs/jsii | packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java | JsiiObject.jsiiStaticSet | protected static void jsiiStaticSet(final Class<?> nativeClass, final String property, @Nullable final Object value) {
"""
Sets a value for a static property.
@param nativeClass The java class.
@param property The name of the property
@param value The value
"""
String fqn = engine.loadModuleForClass... | java | protected static void jsiiStaticSet(final Class<?> nativeClass, final String property, @Nullable final Object value) {
String fqn = engine.loadModuleForClass(nativeClass);
engine.getClient().setStaticPropertyValue(fqn, property, JsiiObjectMapper.valueToTree(value));
} | [
"protected",
"static",
"void",
"jsiiStaticSet",
"(",
"final",
"Class",
"<",
"?",
">",
"nativeClass",
",",
"final",
"String",
"property",
",",
"@",
"Nullable",
"final",
"Object",
"value",
")",
"{",
"String",
"fqn",
"=",
"engine",
".",
"loadModuleForClass",
"(... | Sets a value for a static property.
@param nativeClass The java class.
@param property The name of the property
@param value The value | [
"Sets",
"a",
"value",
"for",
"a",
"static",
"property",
"."
] | train | https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L139-L142 |
cdk/cdk | descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java | Tanimoto.method2 | public static double method2(ICountFingerprint fp1, ICountFingerprint fp2) {
"""
Calculates Tanimoto distance for two count fingerprints using method 2 {@cdk.cite Grant06}.
@param fp1 count fingerprint 1
@param fp2 count fingerprint 2
@return a Tanimoto distance
"""
long maxSum = 0, minSum = 0;
... | java | public static double method2(ICountFingerprint fp1, ICountFingerprint fp2) {
long maxSum = 0, minSum = 0;
int i = 0, j = 0;
while (i < fp1.numOfPopulatedbins() || j < fp2.numOfPopulatedbins()) {
Integer hash1 = i < fp1.numOfPopulatedbins() ? fp1.getHash(i) : null;
Intege... | [
"public",
"static",
"double",
"method2",
"(",
"ICountFingerprint",
"fp1",
",",
"ICountFingerprint",
"fp2",
")",
"{",
"long",
"maxSum",
"=",
"0",
",",
"minSum",
"=",
"0",
";",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"f... | Calculates Tanimoto distance for two count fingerprints using method 2 {@cdk.cite Grant06}.
@param fp1 count fingerprint 1
@param fp2 count fingerprint 2
@return a Tanimoto distance | [
"Calculates",
"Tanimoto",
"distance",
"for",
"two",
"count",
"fingerprints",
"using",
"method",
"2",
"{",
"@cdk",
".",
"cite",
"Grant06",
"}",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java#L219-L248 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/WritableSessionCache.java | WritableSessionCache.completeTransaction | private void completeTransaction(final String txId, String wsName) {
"""
Signal that the transaction that was active and in which this session participated has completed and that this session
should no longer use a transaction-specific workspace cache.
"""
getWorkspace().clear();
// reset the ... | java | private void completeTransaction(final String txId, String wsName) {
getWorkspace().clear();
// reset the ws cache to the shared (global one)
setWorkspaceCache(sharedWorkspaceCache());
// and clear some tx specific data
COMPLETE_FUNCTION_BY_TX_AND_WS.compute(txId, (transactionId,... | [
"private",
"void",
"completeTransaction",
"(",
"final",
"String",
"txId",
",",
"String",
"wsName",
")",
"{",
"getWorkspace",
"(",
")",
".",
"clear",
"(",
")",
";",
"// reset the ws cache to the shared (global one)",
"setWorkspaceCache",
"(",
"sharedWorkspaceCache",
"(... | Signal that the transaction that was active and in which this session participated has completed and that this session
should no longer use a transaction-specific workspace cache. | [
"Signal",
"that",
"the",
"transaction",
"that",
"was",
"active",
"and",
"in",
"which",
"this",
"session",
"participated",
"has",
"completed",
"and",
"that",
"this",
"session",
"should",
"no",
"longer",
"use",
"a",
"transaction",
"-",
"specific",
"workspace",
"... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/WritableSessionCache.java#L440-L456 |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.writeReturnComment | void writeReturnComment(TypeMirror returnType, Writer writer) throws IOException {
"""
write js documentation for return type
@param returnType
@param writer
@throws IOException
"""
String type = returnType.toString();
if (!"void".equals(type)) {
writer.append(TAB2).append(" * @return ").append(OP... | java | void writeReturnComment(TypeMirror returnType, Writer writer) throws IOException {
String type = returnType.toString();
if (!"void".equals(type)) {
writer.append(TAB2).append(" * @return ").append(OPENBRACE).append(type).append(CLOSEBRACE).append(CR);
}
} | [
"void",
"writeReturnComment",
"(",
"TypeMirror",
"returnType",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"String",
"type",
"=",
"returnType",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"\"void\"",
".",
"equals",
"(",
"type",
")",
")"... | write js documentation for return type
@param returnType
@param writer
@throws IOException | [
"write",
"js",
"documentation",
"for",
"return",
"type"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L126-L131 |
SeunMatt/mysql-backup4j | src/main/java/com/smattme/MysqlBaseService.java | MysqlBaseService.connectWithURL | static Connection connectWithURL(String username, String password, String jdbcURL, String driverName) throws ClassNotFoundException, SQLException {
"""
This is a utility function that allows connecting
to a database instance identified by the provided jdbcURL
The connector driver name can be empty
@param userna... | java | static Connection connectWithURL(String username, String password, String jdbcURL, String driverName) throws ClassNotFoundException, SQLException {
String driver = (Objects.isNull(driverName) || driverName.isEmpty()) ? "com.mysql.cj.jdbc.Driver" : driverName;
return doConnect(driver, jdbcURL, username... | [
"static",
"Connection",
"connectWithURL",
"(",
"String",
"username",
",",
"String",
"password",
",",
"String",
"jdbcURL",
",",
"String",
"driverName",
")",
"throws",
"ClassNotFoundException",
",",
"SQLException",
"{",
"String",
"driver",
"=",
"(",
"Objects",
".",
... | This is a utility function that allows connecting
to a database instance identified by the provided jdbcURL
The connector driver name can be empty
@param username database username
@param password database password
@param jdbcURL the user supplied JDBC URL. It's used as is. So ensure you supply the right parameters
@pa... | [
"This",
"is",
"a",
"utility",
"function",
"that",
"allows",
"connecting",
"to",
"a",
"database",
"instance",
"identified",
"by",
"the",
"provided",
"jdbcURL",
"The",
"connector",
"driver",
"name",
"can",
"be",
"empty"
] | train | https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlBaseService.java#L53-L56 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java | GeoInterface.getLocation | public GeoData getLocation(String photoId) throws FlickrException {
"""
Get the geo data (latitude and longitude and the accuracy level) for a photo.
This method does not require authentication.
@param photoId
reqired photo id, not null
@return Geo Data, if the photo has it.
@throws FlickrException
if ph... | java | public GeoData getLocation(String photoId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_GET_LOCATION);
parameters.put("photo_id", photoId);
Response response = transport.get(transport.getPath(), parameters,... | [
"public",
"GeoData",
"getLocation",
"(",
"String",
"photoId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
... | Get the geo data (latitude and longitude and the accuracy level) for a photo.
This method does not require authentication.
@param photoId
reqired photo id, not null
@return Geo Data, if the photo has it.
@throws FlickrException
if photo id is invalid, if photo has no geodata or if any other error has been reported in... | [
"Get",
"the",
"geo",
"data",
"(",
"latitude",
"and",
"longitude",
"and",
"the",
"accuracy",
"level",
")",
"for",
"a",
"photo",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L68-L92 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java | Segment3dfx.x2Property | @Pure
public DoubleProperty x2Property() {
"""
Replies the property that is the x coordinate of the second segment point.
@return the x2 property.
"""
if (this.p2.x == null) {
this.p2.x = new SimpleDoubleProperty(this, MathFXAttributeNames.X2);
}
return this.p2.x;
} | java | @Pure
public DoubleProperty x2Property() {
if (this.p2.x == null) {
this.p2.x = new SimpleDoubleProperty(this, MathFXAttributeNames.X2);
}
return this.p2.x;
} | [
"@",
"Pure",
"public",
"DoubleProperty",
"x2Property",
"(",
")",
"{",
"if",
"(",
"this",
".",
"p2",
".",
"x",
"==",
"null",
")",
"{",
"this",
".",
"p2",
".",
"x",
"=",
"new",
"SimpleDoubleProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"X2",
... | Replies the property that is the x coordinate of the second segment point.
@return the x2 property. | [
"Replies",
"the",
"property",
"that",
"is",
"the",
"x",
"coordinate",
"of",
"the",
"second",
"segment",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java#L259-L265 |
RestComm/jss7 | isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/util/BcdHelper.java | BcdHelper.bcdDecodeToHexString | public static String bcdDecodeToHexString(int encodingScheme, byte[] bcdBytes) throws UnsupportedEncodingException {
"""
Decoded BCD encoded string into Hex digits string.
@param encodingScheme BCD endcoding scheme to be used
@param bcdBytes bytes table to decode.
@return hex string representation of BCD enc... | java | public static String bcdDecodeToHexString(int encodingScheme, byte[] bcdBytes) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
for (byte b : bcdBytes) {
sb.append(bcdToHexString(encodingScheme, b));
}
if (GenericDigits._ENCODING_SCHEME_BCD_ODD =... | [
"public",
"static",
"String",
"bcdDecodeToHexString",
"(",
"int",
"encodingScheme",
",",
"byte",
"[",
"]",
"bcdBytes",
")",
"throws",
"UnsupportedEncodingException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"byte",
"b",... | Decoded BCD encoded string into Hex digits string.
@param encodingScheme BCD endcoding scheme to be used
@param bcdBytes bytes table to decode.
@return hex string representation of BCD encoded digits | [
"Decoded",
"BCD",
"encoded",
"string",
"into",
"Hex",
"digits",
"string",
"."
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/util/BcdHelper.java#L160-L171 |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java | ExpressionUtil.evalNotNull | public static Object evalNotNull(String tagName,
String attributeName,
String expression,
Class expectedType,
Tag tag,
PageContext page... | java | public static Object evalNotNull(String tagName,
String attributeName,
String expression,
Class expectedType,
Tag tag,
PageContext page... | [
"public",
"static",
"Object",
"evalNotNull",
"(",
"String",
"tagName",
",",
"String",
"attributeName",
",",
"String",
"expression",
",",
"Class",
"expectedType",
",",
"Tag",
"tag",
",",
"PageContext",
"pageContext",
")",
"throws",
"JspException",
"{",
"if",
"(",... | Evaluates an expression if present, but does not allow the expression
to evaluate to 'null', throwing a NullAttributeException if it
does. The function <b>can</b> return null, however, if the
expression itself is null. | [
"Evaluates",
"an",
"expression",
"if",
"present",
"but",
"does",
"not",
"allow",
"the",
"expression",
"to",
"evaluate",
"to",
"null",
"throwing",
"a",
"NullAttributeException",
"if",
"it",
"does",
".",
"The",
"function",
"<b",
">",
"can<",
"/",
"b",
">",
"... | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java#L42-L59 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/SeleniumSpec.java | SeleniumSpec.assertSeleniumIsDisplayed | @Then("^the element on index '(\\d+?)' (IS|IS NOT) displayed$")
public void assertSeleniumIsDisplayed(Integer index, Boolean isDisplayed) {
"""
Verifies that a webelement previously found {@code isDisplayed}
@param index
@param isDisplayed
"""
assertThat(this.commonspec, commonspec.getPreviousW... | java | @Then("^the element on index '(\\d+?)' (IS|IS NOT) displayed$")
public void assertSeleniumIsDisplayed(Integer index, Boolean isDisplayed) {
assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required")
.hasAtLeast(index);
assertTha... | [
"@",
"Then",
"(",
"\"^the element on index '(\\\\d+?)' (IS|IS NOT) displayed$\"",
")",
"public",
"void",
"assertSeleniumIsDisplayed",
"(",
"Integer",
"index",
",",
"Boolean",
"isDisplayed",
")",
"{",
"assertThat",
"(",
"this",
".",
"commonspec",
",",
"commonspec",
".",
... | Verifies that a webelement previously found {@code isDisplayed}
@param index
@param isDisplayed | [
"Verifies",
"that",
"a",
"webelement",
"previously",
"found",
"{",
"@code",
"isDisplayed",
"}"
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L484-L490 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/FeaturableConfig.java | FeaturableConfig.getClass | @SuppressWarnings("unchecked")
private static <T> Class<T> getClass(String className) {
"""
Get the class reference from its name using cache.
@param <T> The class type.
@param className The class name.
@return The typed class instance.
@throws LionEngineException If invalid class.
"""
if (CL... | java | @SuppressWarnings("unchecked")
private static <T> Class<T> getClass(String className)
{
if (CLASS_CACHE.containsKey(className))
{
return (Class<T>) CLASS_CACHE.get(className);
}
try
{
final Class<?> clazz = LOADER.loadClass(className);
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"getClass",
"(",
"String",
"className",
")",
"{",
"if",
"(",
"CLASS_CACHE",
".",
"containsKey",
"(",
"className",
")",
")",
"{",
"return",
"("... | Get the class reference from its name using cache.
@param <T> The class type.
@param className The class name.
@return The typed class instance.
@throws LionEngineException If invalid class. | [
"Get",
"the",
"class",
"reference",
"from",
"its",
"name",
"using",
"cache",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/FeaturableConfig.java#L192-L209 |
calrissian/mango | mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterables.java | CloseableIterables.groupBy | public static <T> CloseableIterable<List<T>> groupBy(final CloseableIterable<? extends T> iterable, final Function<? super T, ?> groupingFunction) {
"""
Divides an iterable into unmodifiable sublists of equivalent elements. The iterable groups elements
in consecutive order, forming a new partition when the value ... | java | public static <T> CloseableIterable<List<T>> groupBy(final CloseableIterable<? extends T> iterable, final Function<? super T, ?> groupingFunction) {
return wrap(Iterables2.groupBy(iterable, groupingFunction), iterable);
} | [
"public",
"static",
"<",
"T",
">",
"CloseableIterable",
"<",
"List",
"<",
"T",
">",
">",
"groupBy",
"(",
"final",
"CloseableIterable",
"<",
"?",
"extends",
"T",
">",
"iterable",
",",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
">",
"grouping... | Divides an iterable into unmodifiable sublists of equivalent elements. The iterable groups elements
in consecutive order, forming a new partition when the value from the provided function changes. For example,
grouping the iterable {@code [1, 3, 2, 4, 5]} with a function grouping even and odd numbers
yields {@code [[1,... | [
"Divides",
"an",
"iterable",
"into",
"unmodifiable",
"sublists",
"of",
"equivalent",
"elements",
".",
"The",
"iterable",
"groups",
"elements",
"in",
"consecutive",
"order",
"forming",
"a",
"new",
"partition",
"when",
"the",
"value",
"from",
"the",
"provided",
"f... | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/collect/CloseableIterables.java#L103-L105 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java | SimpleDocTreeVisitor.visitParam | @Override
public R visitParam(ParamTree node, P p) {
"""
{@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction}
"""
return defaultAction(node, p);
} | java | @Override
public R visitParam(ParamTree node, P p) {
return defaultAction(node, p);
} | [
"@",
"Override",
"public",
"R",
"visitParam",
"(",
"ParamTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"node",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"calls",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L285-L288 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java | PactDslJsonArray.eachLike | @Override
public PactDslJsonBody eachLike(int numberExamples) {
"""
Element that is an array where each item must match the following example
@param numberExamples Number of examples to generate
"""
matchers.addRule(rootPath + appendArrayIndex(1), matchMin(0));
PactDslJsonArray parent = new Pa... | java | @Override
public PactDslJsonBody eachLike(int numberExamples) {
matchers.addRule(rootPath + appendArrayIndex(1), matchMin(0));
PactDslJsonArray parent = new PactDslJsonArray(rootPath, "", this, true);
parent.setNumberExamples(numberExamples);
return new PactDslJsonBody(".", "", parent);
... | [
"@",
"Override",
"public",
"PactDslJsonBody",
"eachLike",
"(",
"int",
"numberExamples",
")",
"{",
"matchers",
".",
"addRule",
"(",
"rootPath",
"+",
"appendArrayIndex",
"(",
"1",
")",
",",
"matchMin",
"(",
"0",
")",
")",
";",
"PactDslJsonArray",
"parent",
"="... | Element that is an array where each item must match the following example
@param numberExamples Number of examples to generate | [
"Element",
"that",
"is",
"an",
"array",
"where",
"each",
"item",
"must",
"match",
"the",
"following",
"example"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L141-L147 |
apache/groovy | src/main/groovy/groovy/lang/MetaClassImpl.java | MetaClassImpl.invokeMethod | public Object invokeMethod(Object object, String methodName, Object[] originalArguments) {
"""
Invokes a method on the given receiver for the specified arguments.
The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.
@param object The object which the method w... | java | public Object invokeMethod(Object object, String methodName, Object[] originalArguments) {
return invokeMethod(theClass, object, methodName, originalArguments, false, false);
} | [
"public",
"Object",
"invokeMethod",
"(",
"Object",
"object",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"originalArguments",
")",
"{",
"return",
"invokeMethod",
"(",
"theClass",
",",
"object",
",",
"methodName",
",",
"originalArguments",
",",
"false",... | Invokes a method on the given receiver for the specified arguments.
The MetaClass will attempt to establish the method to invoke based on the name and arguments provided.
@param object The object which the method was invoked on
@param methodName The name of the method
@param originalArguments The arguments to the met... | [
"Invokes",
"a",
"method",
"on",
"the",
"given",
"receiver",
"for",
"the",
"specified",
"arguments",
".",
"The",
"MetaClass",
"will",
"attempt",
"to",
"establish",
"the",
"method",
"to",
"invoke",
"based",
"on",
"the",
"name",
"and",
"arguments",
"provided",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaClassImpl.java#L1043-L1045 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java | UserResource.signup | @POST
@PermitAll
public Response signup(DUser user, @Context UriInfo uriInfo) {
"""
Sign up a new user.
@param user user info
@param uriInfo injected
@return http 201 if successfully created
The URI of the created user will be stated in the Location header
"""
LOGGER.debug("Sign up user {}", ... | java | @POST
@PermitAll
public Response signup(DUser user, @Context UriInfo uriInfo) {
LOGGER.debug("Sign up user {}", user.getUsername());
if (!shouldUseEmailAsUsername) {
checkUsernameFormat(user.getUsername());
}
checkPasswordFormat(user.getPassword());
checkEmailFormat(user.getEmail());
... | [
"@",
"POST",
"@",
"PermitAll",
"public",
"Response",
"signup",
"(",
"DUser",
"user",
",",
"@",
"Context",
"UriInfo",
"uriInfo",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Sign up user {}\"",
",",
"user",
".",
"getUsername",
"(",
")",
")",
";",
"if",
"(",
... | Sign up a new user.
@param user user info
@param uriInfo injected
@return http 201 if successfully created
The URI of the created user will be stated in the Location header | [
"Sign",
"up",
"a",
"new",
"user",
"."
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L85-L106 |
Stratio/deep-spark | deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java | Cells.getValue | public <T> T getValue(int idx, Class<T> cellClass) {
"""
Returns the casted value of the {@link Cell} at position {@code idx} in the list of Cell object.
@param idx the index position of the Cell we want to retrieve
@param cellClass the class of the cell's value
@param <T> the type of the cell's v... | java | public <T> T getValue(int idx, Class<T> cellClass) {
Cell cell = getCellByIdx(idx);
return cell == null ? null : cell.getValue(cellClass);
} | [
"public",
"<",
"T",
">",
"T",
"getValue",
"(",
"int",
"idx",
",",
"Class",
"<",
"T",
">",
"cellClass",
")",
"{",
"Cell",
"cell",
"=",
"getCellByIdx",
"(",
"idx",
")",
";",
"return",
"cell",
"==",
"null",
"?",
"null",
":",
"cell",
".",
"getValue",
... | Returns the casted value of the {@link Cell} at position {@code idx} in the list of Cell object.
@param idx the index position of the Cell we want to retrieve
@param cellClass the class of the cell's value
@param <T> the type of the cell's value
@return the casted value of the {@link Cell} at position {@co... | [
"Returns",
"the",
"casted",
"value",
"of",
"the",
"{",
"@link",
"Cell",
"}",
"at",
"position",
"{",
"@code",
"idx",
"}",
"in",
"the",
"list",
"of",
"Cell",
"object",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L605-L608 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java | ClusterManagerClient.completeIPRotation | public final Operation completeIPRotation(String projectId, String zone, String clusterId) {
"""
Completes master IP rotation.
<p>Sample code:
<pre><code>
try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) {
String projectId = "";
String zone = "";
String clusterId = "";
Ope... | java | public final Operation completeIPRotation(String projectId, String zone, String clusterId) {
CompleteIPRotationRequest request =
CompleteIPRotationRequest.newBuilder()
.setProjectId(projectId)
.setZone(zone)
.setClusterId(clusterId)
.build();
return compl... | [
"public",
"final",
"Operation",
"completeIPRotation",
"(",
"String",
"projectId",
",",
"String",
"zone",
",",
"String",
"clusterId",
")",
"{",
"CompleteIPRotationRequest",
"request",
"=",
"CompleteIPRotationRequest",
".",
"newBuilder",
"(",
")",
".",
"setProjectId",
... | Completes master IP rotation.
<p>Sample code:
<pre><code>
try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) {
String projectId = "";
String zone = "";
String clusterId = "";
Operation response = clusterManagerClient.completeIPRotation(projectId, zone, clusterId);
}
</code></pre>
@param ... | [
"Completes",
"master",
"IP",
"rotation",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L2528-L2537 |
datacleaner/DataCleaner | desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java | ComboButton.addButton | public void addButton(final AbstractButton button) {
"""
Adds a button to this {@link ComboButton}. Beware that this method does
change the styling (colors, borders etc.) of the button to make it fit
the {@link ComboButton}.
@param button
"""
WidgetUtils.setDefaultButtonStyle(button);
fina... | java | public void addButton(final AbstractButton button) {
WidgetUtils.setDefaultButtonStyle(button);
final EmptyBorder baseBorder =
new EmptyBorder(WidgetUtils.BORDER_WIDE_WIDTH - 1, 9, WidgetUtils.BORDER_WIDE_WIDTH - 1, 9);
if (getComponentCount() == 0) {
button.setBorder... | [
"public",
"void",
"addButton",
"(",
"final",
"AbstractButton",
"button",
")",
"{",
"WidgetUtils",
".",
"setDefaultButtonStyle",
"(",
"button",
")",
";",
"final",
"EmptyBorder",
"baseBorder",
"=",
"new",
"EmptyBorder",
"(",
"WidgetUtils",
".",
"BORDER_WIDE_WIDTH",
... | Adds a button to this {@link ComboButton}. Beware that this method does
change the styling (colors, borders etc.) of the button to make it fit
the {@link ComboButton}.
@param button | [
"Adds",
"a",
"button",
"to",
"this",
"{",
"@link",
"ComboButton",
"}",
".",
"Beware",
"that",
"this",
"method",
"does",
"change",
"the",
"styling",
"(",
"colors",
"borders",
"etc",
".",
")",
"of",
"the",
"button",
"to",
"make",
"it",
"fit",
"the",
"{",... | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java#L125-L146 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java | CommerceAddressPersistenceImpl.findAll | @Override
public List<CommerceAddress> findAll() {
"""
Returns all the commerce addresses.
@return the commerce addresses
"""
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceAddress> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceAddress",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce addresses.
@return the commerce addresses | [
"Returns",
"all",
"the",
"commerce",
"addresses",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java#L4199-L4202 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java | MapApi.getUnsafe | public static <T> T getUnsafe(final Map map, final Class<T> clazz, final Object... path) {
"""
Walks by map's nodes and extracts optional value of type T.
@param <T> value type
@param clazz type of value
@param map subject
@param path nodes to walk in map
@return optional value of type T
"""
retur... | java | public static <T> T getUnsafe(final Map map, final Class<T> clazz, final Object... path) {
return get(map, clazz, path).orElseThrow(() -> new IllegalAccessError(
"Map "
+ map
+ " does not have value of type "
+ clazz.getName()
+ " by "
+ Ar... | [
"public",
"static",
"<",
"T",
">",
"T",
"getUnsafe",
"(",
"final",
"Map",
"map",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Object",
"...",
"path",
")",
"{",
"return",
"get",
"(",
"map",
",",
"clazz",
",",
"path",
")",
".",
"or... | Walks by map's nodes and extracts optional value of type T.
@param <T> value type
@param clazz type of value
@param map subject
@param path nodes to walk in map
@return optional value of type T | [
"Walks",
"by",
"map",
"s",
"nodes",
"and",
"extracts",
"optional",
"value",
"of",
"type",
"T",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java#L120-L129 |
grpc/grpc-java | api/src/main/java/io/grpc/ServerInterceptors.java | ServerInterceptors.useInputStreamMessages | @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1712")
public static ServerServiceDefinition useInputStreamMessages(
final ServerServiceDefinition serviceDef) {
"""
Create a new {@code ServerServiceDefinition} whose {@link MethodDescriptor} serializes to
and from InputStream for all methods. T... | java | @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1712")
public static ServerServiceDefinition useInputStreamMessages(
final ServerServiceDefinition serviceDef) {
final MethodDescriptor.Marshaller<InputStream> marshaller =
new MethodDescriptor.Marshaller<InputStream>() {
@Override
... | [
"@",
"ExperimentalApi",
"(",
"\"https://github.com/grpc/grpc-java/issues/1712\"",
")",
"public",
"static",
"ServerServiceDefinition",
"useInputStreamMessages",
"(",
"final",
"ServerServiceDefinition",
"serviceDef",
")",
"{",
"final",
"MethodDescriptor",
".",
"Marshaller",
"<",
... | Create a new {@code ServerServiceDefinition} whose {@link MethodDescriptor} serializes to
and from InputStream for all methods. The InputStream is guaranteed return true for
markSupported(). The {@code ServerCallHandler} created will automatically
convert back to the original types for request and response before cal... | [
"Create",
"a",
"new",
"{",
"@code",
"ServerServiceDefinition",
"}",
"whose",
"{",
"@link",
"MethodDescriptor",
"}",
"serializes",
"to",
"and",
"from",
"InputStream",
"for",
"all",
"methods",
".",
"The",
"InputStream",
"is",
"guaranteed",
"return",
"true",
"for",... | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/ServerInterceptors.java#L137-L158 |
molgenis/molgenis | molgenis-util/src/main/java/org/molgenis/util/file/ZipFileUtil.java | ZipFileUtil.unzipSkipHidden | public static List<File> unzipSkipHidden(File file) {
"""
Unzips a zipfile into the directory it resides in. Skips paths starting with '.' or '_'
(typically hidden paths).
@param file the file to unzip
@return List of Files that got extracted
@throws UnzipException if something went wrong
"""
return ... | java | public static List<File> unzipSkipHidden(File file) {
return unzip(file, name -> name.startsWith(".") || name.startsWith("_") ? null : name);
} | [
"public",
"static",
"List",
"<",
"File",
">",
"unzipSkipHidden",
"(",
"File",
"file",
")",
"{",
"return",
"unzip",
"(",
"file",
",",
"name",
"->",
"name",
".",
"startsWith",
"(",
"\".\"",
")",
"||",
"name",
".",
"startsWith",
"(",
"\"_\"",
")",
"?",
... | Unzips a zipfile into the directory it resides in. Skips paths starting with '.' or '_'
(typically hidden paths).
@param file the file to unzip
@return List of Files that got extracted
@throws UnzipException if something went wrong | [
"Unzips",
"a",
"zipfile",
"into",
"the",
"directory",
"it",
"resides",
"in",
".",
"Skips",
"paths",
"starting",
"with",
".",
"or",
"_",
"(",
"typically",
"hidden",
"paths",
")",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-util/src/main/java/org/molgenis/util/file/ZipFileUtil.java#L33-L35 |
apereo/cas | support/cas-server-support-electrofence/src/main/java/org/apereo/cas/impl/calcs/BaseAuthenticationRequestRiskCalculator.java | BaseAuthenticationRequestRiskCalculator.getFinalAveragedScore | protected BigDecimal getFinalAveragedScore(final long eventCount, final long total) {
"""
Gets final averaged score.
@param eventCount the event count
@param total the total
@return the final averaged score
"""
val score = BigDecimal.valueOf(eventCount)
.divide(BigDecimal.valueOf(... | java | protected BigDecimal getFinalAveragedScore(final long eventCount, final long total) {
val score = BigDecimal.valueOf(eventCount)
.divide(BigDecimal.valueOf(total), 2, RoundingMode.HALF_UP);
return HIGHEST_RISK_SCORE.subtract(score);
} | [
"protected",
"BigDecimal",
"getFinalAveragedScore",
"(",
"final",
"long",
"eventCount",
",",
"final",
"long",
"total",
")",
"{",
"val",
"score",
"=",
"BigDecimal",
".",
"valueOf",
"(",
"eventCount",
")",
".",
"divide",
"(",
"BigDecimal",
".",
"valueOf",
"(",
... | Gets final averaged score.
@param eventCount the event count
@param total the total
@return the final averaged score | [
"Gets",
"final",
"averaged",
"score",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-electrofence/src/main/java/org/apereo/cas/impl/calcs/BaseAuthenticationRequestRiskCalculator.java#L114-L118 |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java | ImageHolder.applyDecidedIconOrSetGone | public static void applyDecidedIconOrSetGone(ImageHolder imageHolder, ImageView imageView, int iconColor, boolean tint) {
"""
decides which icon to apply or hide this view
@param imageHolder
@param imageView
@param iconColor
@param tint
"""
if (imageHolder != null && imageView != null) {
... | java | public static void applyDecidedIconOrSetGone(ImageHolder imageHolder, ImageView imageView, int iconColor, boolean tint) {
if (imageHolder != null && imageView != null) {
Drawable drawable = ImageHolder.decideIcon(imageHolder, imageView.getContext(), iconColor, tint);
if (drawable != null... | [
"public",
"static",
"void",
"applyDecidedIconOrSetGone",
"(",
"ImageHolder",
"imageHolder",
",",
"ImageView",
"imageView",
",",
"int",
"iconColor",
",",
"boolean",
"tint",
")",
"{",
"if",
"(",
"imageHolder",
"!=",
"null",
"&&",
"imageView",
"!=",
"null",
")",
... | decides which icon to apply or hide this view
@param imageHolder
@param imageView
@param iconColor
@param tint | [
"decides",
"which",
"icon",
"to",
"apply",
"or",
"hide",
"this",
"view"
] | train | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java#L259-L274 |
alkacon/opencms-core | src/org/opencms/search/documents/CmsExtractionResultCache.java | CmsExtractionResultCache.getCacheName | public String getCacheName(CmsResource resource, Locale locale, String docTypeName) {
"""
Returns the RFS name used for caching an the text extraction result
based on the given VFS resource and locale.<p>
@param resource the VFS resource to generate the cache name for
@param locale the locale to generate the ... | java | public String getCacheName(CmsResource resource, Locale locale, String docTypeName) {
// create a StringBuffer for the result
StringBuffer buf = new StringBuffer(m_rfsRepository.length() + 36);
buf.append(m_rfsRepository);
buf.append('/');
buf.append(resource.getResourceId().toS... | [
"public",
"String",
"getCacheName",
"(",
"CmsResource",
"resource",
",",
"Locale",
"locale",
",",
"String",
"docTypeName",
")",
"{",
"// create a StringBuffer for the result",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"m_rfsRepository",
".",
"length",
"(... | Returns the RFS name used for caching an the text extraction result
based on the given VFS resource and locale.<p>
@param resource the VFS resource to generate the cache name for
@param locale the locale to generate the cache name for (may be <code>null</code>)
@param docTypeName the name of the search document type
... | [
"Returns",
"the",
"RFS",
"name",
"used",
"for",
"caching",
"an",
"the",
"text",
"extraction",
"result",
"based",
"on",
"the",
"given",
"VFS",
"resource",
"and",
"locale",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsExtractionResultCache.java#L133-L160 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java | CmsSitemapTreeItem.highlightTemporarily | public void highlightTemporarily(int duration, final Background background) {
"""
Temporarily highlights an item.<p>
@param duration the duration for which
@param background the background to color to set when finished
"""
int blinkInterval = 300;
final int blinkCount = duration / blinkInt... | java | public void highlightTemporarily(int duration, final Background background) {
int blinkInterval = 300;
final int blinkCount = duration / blinkInterval;
Scheduler.get().scheduleFixedPeriod(new RepeatingCommand() {
private int m_counter;
/**
* @see com.goog... | [
"public",
"void",
"highlightTemporarily",
"(",
"int",
"duration",
",",
"final",
"Background",
"background",
")",
"{",
"int",
"blinkInterval",
"=",
"300",
";",
"final",
"int",
"blinkCount",
"=",
"duration",
"/",
"blinkInterval",
";",
"Scheduler",
".",
"get",
"(... | Temporarily highlights an item.<p>
@param duration the duration for which
@param background the background to color to set when finished | [
"Temporarily",
"highlights",
"an",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java#L528-L551 |
andrehertwig/admintool | admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java | ReflectUtils.invokeGetter | @SuppressWarnings("unchecked")
public static <S extends Serializable> S invokeGetter(Object object, Field field) {
"""
invokes the getter on the filed
@param object
@param field
@return
"""
Method m = ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toGetter(field.getName()));
if (null == m... | java | @SuppressWarnings("unchecked")
public static <S extends Serializable> S invokeGetter(Object object, Field field)
{
Method m = ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toGetter(field.getName()));
if (null == m) {
for (String prefix : PREFIXES) {
m = ReflectionUtils.findMethod(object.getCl... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"S",
"extends",
"Serializable",
">",
"S",
"invokeGetter",
"(",
"Object",
"object",
",",
"Field",
"field",
")",
"{",
"Method",
"m",
"=",
"ReflectionUtils",
".",
"findMethod",
"(",
"o... | invokes the getter on the filed
@param object
@param field
@return | [
"invokes",
"the",
"getter",
"on",
"the",
"filed"
] | train | https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java#L130-L143 |
micronaut-projects/micronaut-core | cli/src/main/groovy/io/micronaut/cli/io/support/AntPathMatcher.java | AntPathMatcher.countOccurrencesOf | public static int countOccurrencesOf(String str, String sub) {
"""
Count the occurrences of the substring in string s.
@param str string to search in. Return 0 if this is null.
@param sub string to search for. Return 0 if this is null.
@return The number of occurrences
"""
if (str == null || sub =... | java | public static int countOccurrencesOf(String str, String sub) {
if (str == null || sub == null || str.length() == 0 || sub.length() == 0) {
return 0;
}
int count = 0;
int pos = 0;
int idx;
while ((idx = str.indexOf(sub, pos)) != -1) {
++count;
... | [
"public",
"static",
"int",
"countOccurrencesOf",
"(",
"String",
"str",
",",
"String",
"sub",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"sub",
"==",
"null",
"||",
"str",
".",
"length",
"(",
")",
"==",
"0",
"||",
"sub",
".",
"length",
"(",
")",... | Count the occurrences of the substring in string s.
@param str string to search in. Return 0 if this is null.
@param sub string to search for. Return 0 if this is null.
@return The number of occurrences | [
"Count",
"the",
"occurrences",
"of",
"the",
"substring",
"in",
"string",
"s",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/io/support/AntPathMatcher.java#L410-L422 |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java | ExtendedListeningPoint.createViaHeader | public ViaHeader createViaHeader(String branch, boolean usePublicAddress) {
"""
Create a Via Header based on the host, port and transport of this listening point
@param usePublicAddress if true, the host will be the global ip address found by STUN otherwise
it will be the local network interface ipaddress
@para... | java | public ViaHeader createViaHeader(String branch, boolean usePublicAddress) {
try {
String host = getIpAddress(usePublicAddress);
ViaHeader via = SipFactoryImpl.headerFactory.createViaHeader(host, port, transport, branch);
return via;
} catch (ParseException ex) {
... | [
"public",
"ViaHeader",
"createViaHeader",
"(",
"String",
"branch",
",",
"boolean",
"usePublicAddress",
")",
"{",
"try",
"{",
"String",
"host",
"=",
"getIpAddress",
"(",
"usePublicAddress",
")",
";",
"ViaHeader",
"via",
"=",
"SipFactoryImpl",
".",
"headerFactory",
... | Create a Via Header based on the host, port and transport of this listening point
@param usePublicAddress if true, the host will be the global ip address found by STUN otherwise
it will be the local network interface ipaddress
@param branch the branch id to use
@return the via header | [
"Create",
"a",
"Via",
"Header",
"based",
"on",
"the",
"host",
"port",
"and",
"transport",
"of",
"this",
"listening",
"point"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java#L183-L195 |
apache/groovy | subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java | AbstractHttpServlet.getResourceConnection | public URLConnection getResourceConnection (String name) throws ResourceException {
"""
Interface method for ResourceContainer. This is used by the GroovyScriptEngine.
"""
name = removeNamePrefix(name).replace('\\', '/');
//remove the leading / as we are trying with a leading / now
if ... | java | public URLConnection getResourceConnection (String name) throws ResourceException {
name = removeNamePrefix(name).replace('\\', '/');
//remove the leading / as we are trying with a leading / now
if (name.startsWith("WEB-INF/groovy/")) {
name = name.substring(15);//just for uniformit... | [
"public",
"URLConnection",
"getResourceConnection",
"(",
"String",
"name",
")",
"throws",
"ResourceException",
"{",
"name",
"=",
"removeNamePrefix",
"(",
"name",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"//remove the leading / as we are trying ... | Interface method for ResourceContainer. This is used by the GroovyScriptEngine. | [
"Interface",
"method",
"for",
"ResourceContainer",
".",
"This",
"is",
"used",
"by",
"the",
"GroovyScriptEngine",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/AbstractHttpServlet.java#L206-L231 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java | PAbstractObject.optDouble | @Override
public final Double optDouble(final String key, final Double defaultValue) {
"""
Get a property as a double or defaultValue.
@param key the property name
@param defaultValue the default value
"""
Double result = optDouble(key);
return result == null ? defaultValue : result;
... | java | @Override
public final Double optDouble(final String key, final Double defaultValue) {
Double result = optDouble(key);
return result == null ? defaultValue : result;
} | [
"@",
"Override",
"public",
"final",
"Double",
"optDouble",
"(",
"final",
"String",
"key",
",",
"final",
"Double",
"defaultValue",
")",
"{",
"Double",
"result",
"=",
"optDouble",
"(",
"key",
")",
";",
"return",
"result",
"==",
"null",
"?",
"defaultValue",
"... | Get a property as a double or defaultValue.
@param key the property name
@param defaultValue the default value | [
"Get",
"a",
"property",
"as",
"a",
"double",
"or",
"defaultValue",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L117-L121 |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java | DatatypeConverter.getUUID | public static final UUID getUUID(InputStream is) throws IOException {
"""
Retrieve a UUID from an input stream.
@param is input stream
@return UUID instance
"""
byte[] data = new byte[16];
is.read(data);
long long1 = 0;
long1 |= ((long) (data[3] & 0xFF)) << 56;
long1 |= ((lon... | java | public static final UUID getUUID(InputStream is) throws IOException
{
byte[] data = new byte[16];
is.read(data);
long long1 = 0;
long1 |= ((long) (data[3] & 0xFF)) << 56;
long1 |= ((long) (data[2] & 0xFF)) << 48;
long1 |= ((long) (data[1] & 0xFF)) << 40;
long1 |= ((long) (d... | [
"public",
"static",
"final",
"UUID",
"getUUID",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"16",
"]",
";",
"is",
".",
"read",
"(",
"data",
")",
";",
"long",
"long1",
"=",
"0",
";"... | Retrieve a UUID from an input stream.
@param is input stream
@return UUID instance | [
"Retrieve",
"a",
"UUID",
"from",
"an",
"input",
"stream",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L235-L261 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipAssert.java | SipAssert.assertBodyNotPresent | public static void assertBodyNotPresent(String msg, SipMessage sipMessage) {
"""
Asserts that the given SIP message contains no body. Assertion failure output includes the
given message text.
@param msg message text to output if the assertion fails.
@param sipMessage the SIP message.
"""
assertNotNul... | java | public static void assertBodyNotPresent(String msg, SipMessage sipMessage) {
assertNotNull("Null assert object passed in", sipMessage);
assertFalse(msg, sipMessage.getContentLength() > 0);
} | [
"public",
"static",
"void",
"assertBodyNotPresent",
"(",
"String",
"msg",
",",
"SipMessage",
"sipMessage",
")",
"{",
"assertNotNull",
"(",
"\"Null assert object passed in\"",
",",
"sipMessage",
")",
";",
"assertFalse",
"(",
"msg",
",",
"sipMessage",
".",
"getContent... | Asserts that the given SIP message contains no body. Assertion failure output includes the
given message text.
@param msg message text to output if the assertion fails.
@param sipMessage the SIP message. | [
"Asserts",
"that",
"the",
"given",
"SIP",
"message",
"contains",
"no",
"body",
".",
"Assertion",
"failure",
"output",
"includes",
"the",
"given",
"message",
"text",
"."
] | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L669-L672 |
xqbase/util | util-jdk17/src/main/java/com/xqbase/util/Time.java | Time.nextThursdayMidnightPlus | public static long nextThursdayMidnightPlus(long now, long plus) {
"""
Get next time (Unix time in milliseconds) in a week<p>
E.g. xqbase.com will restart website every Monday's 4:00am, so the next restart will happen at:<p>
<code>nextThursdayMidnightPlus(now, 4 * DAY + 4 * HOUR)</code> (Monday is the 4th day af... | java | public static long nextThursdayMidnightPlus(long now, long plus) {
long next = (now + timeZoneOffset) / WEEK * WEEK - timeZoneOffset;
next += plus;
if (next < now) {
next += WEEK;
}
return next;
} | [
"public",
"static",
"long",
"nextThursdayMidnightPlus",
"(",
"long",
"now",
",",
"long",
"plus",
")",
"{",
"long",
"next",
"=",
"(",
"now",
"+",
"timeZoneOffset",
")",
"/",
"WEEK",
"*",
"WEEK",
"-",
"timeZoneOffset",
";",
"next",
"+=",
"plus",
";",
"if",... | Get next time (Unix time in milliseconds) in a week<p>
E.g. xqbase.com will restart website every Monday's 4:00am, so the next restart will happen at:<p>
<code>nextThursdayMidnightPlus(now, 4 * DAY + 4 * HOUR)</code> (Monday is the 4th day after Thursday)
@param now current time (Unix time in milliseconds)
@param plus... | [
"Get",
"next",
"time",
"(",
"Unix",
"time",
"in",
"milliseconds",
")",
"in",
"a",
"week<p",
">",
"E",
".",
"g",
".",
"xqbase",
".",
"com",
"will",
"restart",
"website",
"every",
"Monday",
"s",
"4",
":",
"00am",
"so",
"the",
"next",
"restart",
"will",... | train | https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util-jdk17/src/main/java/com/xqbase/util/Time.java#L159-L166 |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java | Assertions.assertNull | @Nullable
public static <T> T assertNull(@Nullable final T object) {
"""
Assert that value is null
@param <T> type of the object to check
@param object the object to check
@return the same input parameter if all is ok
@throws AssertionError it will be thrown if the value is not null
@since 1.0
"""
... | java | @Nullable
public static <T> T assertNull(@Nullable final T object) {
return assertNull(null, object);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"T",
"assertNull",
"(",
"@",
"Nullable",
"final",
"T",
"object",
")",
"{",
"return",
"assertNull",
"(",
"null",
",",
"object",
")",
";",
"}"
] | Assert that value is null
@param <T> type of the object to check
@param object the object to check
@return the same input parameter if all is ok
@throws AssertionError it will be thrown if the value is not null
@since 1.0 | [
"Assert",
"that",
"value",
"is",
"null"
] | train | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/Assertions.java#L75-L78 |
andygibson/datafactory | src/main/java/org/fluttercode/datafactory/impl/DataFactory.java | DataFactory.getRandomText | public String getRandomText(final int minLength, final int maxLength) {
"""
Returns random text made up of english words
@param minLength minimum length of returned string
@param maxLength maximum length of returned string
@return string of length between min and max length
"""
validateMinMaxParams(m... | java | public String getRandomText(final int minLength, final int maxLength) {
validateMinMaxParams(minLength, maxLength);
StringBuilder sb = new StringBuilder(maxLength);
int length = minLength;
if (maxLength != minLength) {
length = length + random.nextInt(maxLength - minLength);
}
whi... | [
"public",
"String",
"getRandomText",
"(",
"final",
"int",
"minLength",
",",
"final",
"int",
"maxLength",
")",
"{",
"validateMinMaxParams",
"(",
"minLength",
",",
"maxLength",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"maxLength",
")",
... | Returns random text made up of english words
@param minLength minimum length of returned string
@param maxLength maximum length of returned string
@return string of length between min and max length | [
"Returns",
"random",
"text",
"made",
"up",
"of",
"english",
"words"
] | train | https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L401-L422 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataPng.java | CoverageDataPng.getPixelValue | public short getPixelValue(BufferedImage image, int x, int y) {
"""
Get the pixel value as an "unsigned short"
@param image
tile image
@param x
x coordinate
@param y
y coordinate
@return "unsigned short" pixel value
"""
validateImageType(image);
WritableRaster raster = image.getRaster();
short p... | java | public short getPixelValue(BufferedImage image, int x, int y) {
validateImageType(image);
WritableRaster raster = image.getRaster();
short pixelValue = getPixelValue(raster, x, y);
return pixelValue;
} | [
"public",
"short",
"getPixelValue",
"(",
"BufferedImage",
"image",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"validateImageType",
"(",
"image",
")",
";",
"WritableRaster",
"raster",
"=",
"image",
".",
"getRaster",
"(",
")",
";",
"short",
"pixelValue",
"=... | Get the pixel value as an "unsigned short"
@param image
tile image
@param x
x coordinate
@param y
y coordinate
@return "unsigned short" pixel value | [
"Get",
"the",
"pixel",
"value",
"as",
"an",
"unsigned",
"short"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataPng.java#L118-L123 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java | PatternsImpl.updatePattern | public PatternRuleInfo updatePattern(UUID appId, String versionId, UUID patternId, PatternRuleUpdateObject pattern) {
"""
Updates a pattern.
@param appId The application ID.
@param versionId The version ID.
@param patternId The pattern ID.
@param pattern An object representing a pattern.
@throws IllegalArgu... | java | public PatternRuleInfo updatePattern(UUID appId, String versionId, UUID patternId, PatternRuleUpdateObject pattern) {
return updatePatternWithServiceResponseAsync(appId, versionId, patternId, pattern).toBlocking().single().body();
} | [
"public",
"PatternRuleInfo",
"updatePattern",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"patternId",
",",
"PatternRuleUpdateObject",
"pattern",
")",
"{",
"return",
"updatePatternWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"patt... | Updates a pattern.
@param appId The application ID.
@param versionId The version ID.
@param patternId The pattern ID.
@param pattern An object representing a pattern.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@th... | [
"Updates",
"a",
"pattern",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java#L661-L663 |
dlemmermann/PreferencesFX | preferencesfx/src/main/java/com/dlsc/preferencesfx/util/Ascii.java | Ascii.containsIgnoreCase | public static boolean containsIgnoreCase(CharSequence sequence, CharSequence subSequence) {
"""
Indicates whether the character sequence {@code sequence} contains the {@code subSequence},
ignoring the case of any ASCII alphabetic characters between {@code 'a'} and {@code 'z'}
or {@code 'A'} and {@code 'Z'} inclu... | java | public static boolean containsIgnoreCase(CharSequence sequence, CharSequence subSequence) {
// Calling length() is the null pointer check (so do it before we can exit early).
int length = sequence.length();
if (sequence == subSequence) {
return true;
}
// if subSequence is longer than sequence... | [
"public",
"static",
"boolean",
"containsIgnoreCase",
"(",
"CharSequence",
"sequence",
",",
"CharSequence",
"subSequence",
")",
"{",
"// Calling length() is the null pointer check (so do it before we can exit early).",
"int",
"length",
"=",
"sequence",
".",
"length",
"(",
")",... | Indicates whether the character sequence {@code sequence} contains the {@code subSequence},
ignoring the case of any ASCII alphabetic characters between {@code 'a'} and {@code 'z'}
or {@code 'A'} and {@code 'Z'} inclusive.
@since NEXT | [
"Indicates",
"whether",
"the",
"character",
"sequence",
"{",
"@code",
"sequence",
"}",
"contains",
"the",
"{",
"@code",
"subSequence",
"}",
"ignoring",
"the",
"case",
"of",
"any",
"ASCII",
"alphabetic",
"characters",
"between",
"{",
"@code",
"a",
"}",
"and",
... | train | https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/util/Ascii.java#L134-L145 |
JCTools/JCTools | jctools-core/src/main/java/org/jctools/maps/NonBlockingHashMap.java | NonBlockingHashMap.replace | @Override
public boolean replace ( TypeK key, TypeV oldValue, TypeV newValue ) {
"""
Atomically do a <code>put(key,newValue)</code> if-and-only-if the key is
mapped a value which is <code>equals</code> to <code>oldValue</code>.
@throws NullPointerException if the specified key or value is null
"""
... | java | @Override
public boolean replace ( TypeK key, TypeV oldValue, TypeV newValue ) {
return Objects.equals(putIfMatch( key, newValue, oldValue ), oldValue);
} | [
"@",
"Override",
"public",
"boolean",
"replace",
"(",
"TypeK",
"key",
",",
"TypeV",
"oldValue",
",",
"TypeV",
"newValue",
")",
"{",
"return",
"Objects",
".",
"equals",
"(",
"putIfMatch",
"(",
"key",
",",
"newValue",
",",
"oldValue",
")",
",",
"oldValue",
... | Atomically do a <code>put(key,newValue)</code> if-and-only-if the key is
mapped a value which is <code>equals</code> to <code>oldValue</code>.
@throws NullPointerException if the specified key or value is null | [
"Atomically",
"do",
"a",
"<code",
">",
"put",
"(",
"key",
"newValue",
")",
"<",
"/",
"code",
">",
"if",
"-",
"and",
"-",
"only",
"-",
"if",
"the",
"key",
"is",
"mapped",
"a",
"value",
"which",
"is",
"<code",
">",
"equals<",
"/",
"code",
">",
"to"... | train | https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-core/src/main/java/org/jctools/maps/NonBlockingHashMap.java#L352-L355 |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/grammars/grammar/AbstractBuiltInGrammar.java | AbstractBuiltInGrammar.addProduction | public void addProduction(Event event, Grammar grammar) {
"""
/*
a leading rule for performance reason is added to the tail
"""
containers.add(new SchemaLessProduction(this, grammar, event,
getNumberOfEvents()));
// pre-calculate count for log2 (Note: always 2nd level productions
// available)
//... | java | public void addProduction(Event event, Grammar grammar) {
containers.add(new SchemaLessProduction(this, grammar, event,
getNumberOfEvents()));
// pre-calculate count for log2 (Note: always 2nd level productions
// available)
// Note: BuiltInDocContent and BuiltInFragmentContent do not use this
// variabl... | [
"public",
"void",
"addProduction",
"(",
"Event",
"event",
",",
"Grammar",
"grammar",
")",
"{",
"containers",
".",
"add",
"(",
"new",
"SchemaLessProduction",
"(",
"this",
",",
"grammar",
",",
"event",
",",
"getNumberOfEvents",
"(",
")",
")",
")",
";",
"// p... | /*
a leading rule for performance reason is added to the tail | [
"/",
"*",
"a",
"leading",
"rule",
"for",
"performance",
"reason",
"is",
"added",
"to",
"the",
"tail"
] | train | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/grammars/grammar/AbstractBuiltInGrammar.java#L86-L95 |
VoltDB/voltdb | src/frontend/org/voltdb/client/ClientStats.java | ClientStats.latencyHistoReport | public String latencyHistoReport() {
"""
Generate a human-readable report of latencies in the form of a histogram. Latency is
in milliseconds
@return String containing human-readable report.
"""
ByteArrayOutputStream baos= new ByteArrayOutputStream();
PrintStream pw = null;
try {
... | java | public String latencyHistoReport() {
ByteArrayOutputStream baos= new ByteArrayOutputStream();
PrintStream pw = null;
try {
pw = new PrintStream(baos, false, Charsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
Throwables.propagate(e);
}
... | [
"public",
"String",
"latencyHistoReport",
"(",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"PrintStream",
"pw",
"=",
"null",
";",
"try",
"{",
"pw",
"=",
"new",
"PrintStream",
"(",
"baos",
",",
"false",
",",
... | Generate a human-readable report of latencies in the form of a histogram. Latency is
in milliseconds
@return String containing human-readable report. | [
"Generate",
"a",
"human",
"-",
"readable",
"report",
"of",
"latencies",
"in",
"the",
"form",
"of",
"a",
"histogram",
".",
"Latency",
"is",
"in",
"milliseconds"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientStats.java#L499-L512 |
KyoriPowered/text | api/src/main/java/net/kyori/text/event/HoverEvent.java | HoverEvent.showText | public static @NonNull HoverEvent showText(final @NonNull Component text) {
"""
Creates a hover event that shows text on hover.
@param text the text to show on hover
@return a hover event
"""
return new HoverEvent(Action.SHOW_TEXT, text);
} | java | public static @NonNull HoverEvent showText(final @NonNull Component text) {
return new HoverEvent(Action.SHOW_TEXT, text);
} | [
"public",
"static",
"@",
"NonNull",
"HoverEvent",
"showText",
"(",
"final",
"@",
"NonNull",
"Component",
"text",
")",
"{",
"return",
"new",
"HoverEvent",
"(",
"Action",
".",
"SHOW_TEXT",
",",
"text",
")",
";",
"}"
] | Creates a hover event that shows text on hover.
@param text the text to show on hover
@return a hover event | [
"Creates",
"a",
"hover",
"event",
"that",
"shows",
"text",
"on",
"hover",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/event/HoverEvent.java#L56-L58 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/Controller.java | Controller.getFileInputStream | protected InputStream getFileInputStream(String fieldName, List<FormItem> formItems) throws IOException, WebException {
"""
Convenience method to get file content from <code>multipart/form-data</code> request.
@param fieldName name of form field from the <code>multipart/form-data</code> request corresponding t... | java | protected InputStream getFileInputStream(String fieldName, List<FormItem> formItems) throws IOException, WebException {
for (FormItem formItem : formItems) {
if(formItem.isFile() && formItem.getFieldName().equals(fieldName)){
return formItem.openStream();
}
}
... | [
"protected",
"InputStream",
"getFileInputStream",
"(",
"String",
"fieldName",
",",
"List",
"<",
"FormItem",
">",
"formItems",
")",
"throws",
"IOException",
",",
"WebException",
"{",
"for",
"(",
"FormItem",
"formItem",
":",
"formItems",
")",
"{",
"if",
"(",
"fo... | Convenience method to get file content from <code>multipart/form-data</code> request.
@param fieldName name of form field from the <code>multipart/form-data</code> request corresponding to the uploaded file.
@param formItems form items retrieved from <code>multipart/form-data</code> request.
@return <code>InputStream... | [
"Convenience",
"method",
"to",
"get",
"file",
"content",
"from",
"<code",
">",
"multipart",
"/",
"form",
"-",
"data<",
"/",
"code",
">",
"request",
"."
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/Controller.java#L898-L905 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/DataChecksum.java | DataChecksum.writeValue | public int writeValue( DataOutputStream out, boolean reset )
throws IOException {
"""
Writes the current checksum to the stream.
If <i>reset</i> is true, then resets the checksum.
@return number of bytes written. Will be equal to getChecksumSize();
"""
if ( size <= 0 ) {
... | java | public int writeValue( DataOutputStream out, boolean reset )
throws IOException {
if ( size <= 0 ) {
return 0;
}
if ( size == 4 ) {
out.writeInt( (int) summer.getValue() );
} else {
throw new IOException( "Unknown Checksum " + type );
}
... | [
"public",
"int",
"writeValue",
"(",
"DataOutputStream",
"out",
",",
"boolean",
"reset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"size",
"<=",
"0",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"size",
"==",
"4",
")",
"{",
"out",
".",
"writeInt"... | Writes the current checksum to the stream.
If <i>reset</i> is true, then resets the checksum.
@return number of bytes written. Will be equal to getChecksumSize(); | [
"Writes",
"the",
"current",
"checksum",
"to",
"the",
"stream",
".",
"If",
"<i",
">",
"reset<",
"/",
"i",
">",
"is",
"true",
"then",
"resets",
"the",
"checksum",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/DataChecksum.java#L177-L194 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.