repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
headius/invokebinder | src/main/java/com/headius/invokebinder/Signature.java | Signature.argName | public Signature argName(int index, String name) {
String[] argNames = Arrays.copyOf(argNames(), argNames().length);
argNames[index] = name;
return new Signature(type(), argNames);
} | java | public Signature argName(int index, String name) {
String[] argNames = Arrays.copyOf(argNames(), argNames().length);
argNames[index] = name;
return new Signature(type(), argNames);
} | [
"public",
"Signature",
"argName",
"(",
"int",
"index",
",",
"String",
"name",
")",
"{",
"String",
"[",
"]",
"argNames",
"=",
"Arrays",
".",
"copyOf",
"(",
"argNames",
"(",
")",
",",
"argNames",
"(",
")",
".",
"length",
")",
";",
"argNames",
"[",
"ind... | Set the argument name at the given index.
@param index the index at which to set the argument name
@param name the name to set
@return a new signature with the given name at the given index | [
"Set",
"the",
"argument",
"name",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L612-L616 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java | ModelSerializer.restoreComputationGraph | public static ComputationGraph restoreComputationGraph(@NonNull InputStream is, boolean loadUpdater)
throws IOException {
checkInputStream(is);
File tmpFile = null;
try{
tmpFile = tempFileFromStream(is);
return restoreComputationGraph(tmpFile, loadUpdater);
} finally {
if(tmpFile != null){
tmpFile.delete();
}
}
} | java | public static ComputationGraph restoreComputationGraph(@NonNull InputStream is, boolean loadUpdater)
throws IOException {
checkInputStream(is);
File tmpFile = null;
try{
tmpFile = tempFileFromStream(is);
return restoreComputationGraph(tmpFile, loadUpdater);
} finally {
if(tmpFile != null){
tmpFile.delete();
}
}
} | [
"public",
"static",
"ComputationGraph",
"restoreComputationGraph",
"(",
"@",
"NonNull",
"InputStream",
"is",
",",
"boolean",
"loadUpdater",
")",
"throws",
"IOException",
"{",
"checkInputStream",
"(",
"is",
")",
";",
"File",
"tmpFile",
"=",
"null",
";",
"try",
"{... | Load a computation graph from a InputStream
@param is the inputstream to get the computation graph from
@return the loaded computation graph
@throws IOException | [
"Load",
"a",
"computation",
"graph",
"from",
"a",
"InputStream",
"@param",
"is",
"the",
"inputstream",
"to",
"get",
"the",
"computation",
"graph",
"from",
"@return",
"the",
"loaded",
"computation",
"graph"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L464-L477 |
Waikato/moa | moa/src/main/java/moa/classifiers/meta/AccuracyWeightedEnsemble.java | AccuracyWeightedEnsemble.computeCandidateWeight | protected double computeCandidateWeight(Classifier candidate, Instances chunk, int numFolds) {
double candidateWeight = 0.0;
Random random = new Random(1);
Instances randData = new Instances(chunk);
randData.randomize(random);
if (randData.classAttribute().isNominal()) {
randData.stratify(numFolds);
}
for (int n = 0; n < numFolds; n++) {
Instances train = randData.trainCV(numFolds, n, random);
Instances test = randData.testCV(numFolds, n);
Classifier learner = candidate.copy();
for (int num = 0; num < train.numInstances(); num++) {
learner.trainOnInstance(train.instance(num));
}
candidateWeight += computeWeight(learner, test);
}
double resultWeight = candidateWeight / numFolds;
if (Double.isInfinite(resultWeight)) {
return Double.MAX_VALUE;
} else {
return resultWeight;
}
} | java | protected double computeCandidateWeight(Classifier candidate, Instances chunk, int numFolds) {
double candidateWeight = 0.0;
Random random = new Random(1);
Instances randData = new Instances(chunk);
randData.randomize(random);
if (randData.classAttribute().isNominal()) {
randData.stratify(numFolds);
}
for (int n = 0; n < numFolds; n++) {
Instances train = randData.trainCV(numFolds, n, random);
Instances test = randData.testCV(numFolds, n);
Classifier learner = candidate.copy();
for (int num = 0; num < train.numInstances(); num++) {
learner.trainOnInstance(train.instance(num));
}
candidateWeight += computeWeight(learner, test);
}
double resultWeight = candidateWeight / numFolds;
if (Double.isInfinite(resultWeight)) {
return Double.MAX_VALUE;
} else {
return resultWeight;
}
} | [
"protected",
"double",
"computeCandidateWeight",
"(",
"Classifier",
"candidate",
",",
"Instances",
"chunk",
",",
"int",
"numFolds",
")",
"{",
"double",
"candidateWeight",
"=",
"0.0",
";",
"Random",
"random",
"=",
"new",
"Random",
"(",
"1",
")",
";",
"Instances... | Computes the weight of a candidate classifier.
@param candidate Candidate classifier.
@param chunk Data chunk of examples.
@param numFolds Number of folds in candidate classifier cross-validation.
@param useMseR Determines whether to use the MSEr threshold.
@return Candidate classifier weight. | [
"Computes",
"the",
"weight",
"of",
"a",
"candidate",
"classifier",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/AccuracyWeightedEnsemble.java#L247-L276 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/util/Geometry.java | Geometry.getQuadrant | public static final Direction getQuadrant(final double cx, final double cy, final double x0, final double y0)
{
if ((x0 > cx) && (y0 < cy))
{
return Direction.NORTH_EAST;
}
if ((x0 > cx) && (y0 >= cy))
{
return Direction.SOUTH_EAST;
}
if ((x0 <= cx) && (y0 >= cy))
{
return Direction.SOUTH_WEST;
}
// if( x0 <= c.getX() && y0 < c.getY() )
return Direction.NORTH_WEST;
} | java | public static final Direction getQuadrant(final double cx, final double cy, final double x0, final double y0)
{
if ((x0 > cx) && (y0 < cy))
{
return Direction.NORTH_EAST;
}
if ((x0 > cx) && (y0 >= cy))
{
return Direction.SOUTH_EAST;
}
if ((x0 <= cx) && (y0 >= cy))
{
return Direction.SOUTH_WEST;
}
// if( x0 <= c.getX() && y0 < c.getY() )
return Direction.NORTH_WEST;
} | [
"public",
"static",
"final",
"Direction",
"getQuadrant",
"(",
"final",
"double",
"cx",
",",
"final",
"double",
"cy",
",",
"final",
"double",
"x0",
",",
"final",
"double",
"y0",
")",
"{",
"if",
"(",
"(",
"x0",
">",
"cx",
")",
"&&",
"(",
"y0",
"<",
"... | Returns the NESW quadrant the point is in. The delta from the center
NE x > 0, y < 0
SE x > 0, y >= 0
SW x <= 0, y >= 0
NW x <= 0, y < 0
@param cx
@param cy*
@param x0
@param y0
@return | [
"Returns",
"the",
"NESW",
"quadrant",
"the",
"point",
"is",
"in",
".",
"The",
"delta",
"from",
"the",
"center",
"NE",
"x",
">",
"0",
"y",
"<",
"0",
"SE",
"x",
">",
"0",
"y",
">",
"=",
"0",
"SW",
"x",
"<",
"=",
"0",
"y",
">",
"=",
"0",
"NW",... | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/util/Geometry.java#L1572-L1588 |
cryptomator/webdav-nio-adapter | src/main/java/org/cryptomator/frontend/webdav/WebDavServer.java | WebDavServer.createWebDavServlet | public WebDavServletController createWebDavServlet(Path rootPath, String contextPath) {
WebDavServletComponent servletComp = servletFactory.create(rootPath, contextPath);
return servletComp.servlet();
} | java | public WebDavServletController createWebDavServlet(Path rootPath, String contextPath) {
WebDavServletComponent servletComp = servletFactory.create(rootPath, contextPath);
return servletComp.servlet();
} | [
"public",
"WebDavServletController",
"createWebDavServlet",
"(",
"Path",
"rootPath",
",",
"String",
"contextPath",
")",
"{",
"WebDavServletComponent",
"servletComp",
"=",
"servletFactory",
".",
"create",
"(",
"rootPath",
",",
"contextPath",
")",
";",
"return",
"servle... | Creates a new WebDAV servlet (without starting it yet).
@param rootPath The path to the directory which should be served as root resource.
@param contextPath The servlet context path, i.e. the path of the root resource.
@return The controller object for this new servlet | [
"Creates",
"a",
"new",
"WebDAV",
"servlet",
"(",
"without",
"starting",
"it",
"yet",
")",
"."
] | train | https://github.com/cryptomator/webdav-nio-adapter/blob/55b0d7dccea9a4ede0a30a95583d8f04c8a86d18/src/main/java/org/cryptomator/frontend/webdav/WebDavServer.java#L137-L140 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/kg/AipKnowledgeGraphic.java | AipKnowledgeGraphic.createTask | public JSONObject createTask(String name, String templateContent, String inputMappingFile, String outputFile, String urlPattern, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("name", name);
request.addBody("template_content", templateContent);
request.addBody("input_mapping_file", inputMappingFile);
request.addBody("output_file", outputFile);
request.addBody("url_pattern", urlPattern);
if (options != null) {
request.addBody(options);
}
request.setUri(KnowledgeGraphicConsts.CREATE_TASK);
postOperation(request);
return requestServer(request);
} | java | public JSONObject createTask(String name, String templateContent, String inputMappingFile, String outputFile, String urlPattern, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("name", name);
request.addBody("template_content", templateContent);
request.addBody("input_mapping_file", inputMappingFile);
request.addBody("output_file", outputFile);
request.addBody("url_pattern", urlPattern);
if (options != null) {
request.addBody(options);
}
request.setUri(KnowledgeGraphicConsts.CREATE_TASK);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"createTask",
"(",
"String",
"name",
",",
"String",
"templateContent",
",",
"String",
"inputMappingFile",
",",
"String",
"outputFile",
",",
"String",
"urlPattern",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
... | 创建任务接口
创建一个新的信息抽取任务
@param name - 任务名字
@param templateContent - json string 解析模板内容
@param inputMappingFile - 抓取结果映射文件的路径
@param outputFile - 输出文件名字
@param urlPattern - url pattern
@param options - 可选参数对象,key: value都为string类型
options - options列表:
limit_count 限制解析数量limit_count为0时进行全量任务,limit_count>0时只解析limit_count数量的页面
@return JSONObject | [
"创建任务接口",
"创建一个新的信息抽取任务"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/kg/AipKnowledgeGraphic.java#L42-L61 |
threerings/nenya | core/src/main/java/com/threerings/resource/ResourceManager.java | ResourceManager.createFileResourceBundle | protected FileResourceBundle createFileResourceBundle (
File source, boolean delay, boolean unpack)
{
return new FileResourceBundle(source, delay, unpack);
} | java | protected FileResourceBundle createFileResourceBundle (
File source, boolean delay, boolean unpack)
{
return new FileResourceBundle(source, delay, unpack);
} | [
"protected",
"FileResourceBundle",
"createFileResourceBundle",
"(",
"File",
"source",
",",
"boolean",
"delay",
",",
"boolean",
"unpack",
")",
"{",
"return",
"new",
"FileResourceBundle",
"(",
"source",
",",
"delay",
",",
"unpack",
")",
";",
"}"
] | Creates an appropriate bundle for fetching resources from files. | [
"Creates",
"an",
"appropriate",
"bundle",
"for",
"fetching",
"resources",
"from",
"files",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L841-L845 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/JsonPullParser.java | JsonPullParser.newParser | public static JsonPullParser newParser(InputStream is, Charset charset) {
if (is == null) {
throw new IllegalArgumentException("'is' must not be null.");
}
final Reader reader =
new InputStreamReader(is, (charset == null) ? DEFAULT_CHARSET : charset);
return newParser(reader);
} | java | public static JsonPullParser newParser(InputStream is, Charset charset) {
if (is == null) {
throw new IllegalArgumentException("'is' must not be null.");
}
final Reader reader =
new InputStreamReader(is, (charset == null) ? DEFAULT_CHARSET : charset);
return newParser(reader);
} | [
"public",
"static",
"JsonPullParser",
"newParser",
"(",
"InputStream",
"is",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"is",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"'is' must not be null.\"",
")",
";",
"}",
"final",
"R... | Creates a new parser, using the given InputStream as its {@code JSON} feed.
<p>
Please call one of the {@code setSource(...)}'s before calling other methods.
</p>
@param is
An InputStream serves as {@code JSON} feed. Cannot be null.
@param charset
The character set should be assumed in which in the stream are encoded. {@link #DEFAULT_CHARSET_NAME} is assumed if null is passed.
@return {@link JsonPullParser}
@throws IllegalArgumentException
{@code null} has been passed in where not applicable. | [
"Creates",
"a",
"new",
"parser",
"using",
"the",
"given",
"InputStream",
"as",
"its",
"{",
"@code",
"JSON",
"}",
"feed",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/JsonPullParser.java#L203-L211 |
calrissian/mango | mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonAttributeMappings.java | JsonAttributeMappings.toJsonString | public static String toJsonString(Collection<Attribute> attributeCollection, ObjectMapper objectMapper) throws JsonProcessingException {
return objectMapper.writeValueAsString(toObject(attributeCollection));
} | java | public static String toJsonString(Collection<Attribute> attributeCollection, ObjectMapper objectMapper) throws JsonProcessingException {
return objectMapper.writeValueAsString(toObject(attributeCollection));
} | [
"public",
"static",
"String",
"toJsonString",
"(",
"Collection",
"<",
"Attribute",
">",
"attributeCollection",
",",
"ObjectMapper",
"objectMapper",
")",
"throws",
"JsonProcessingException",
"{",
"return",
"objectMapper",
".",
"writeValueAsString",
"(",
"toObject",
"(",
... | Re-expands a flattened json representation from a collection of attributes back into a raw
nested json string. | [
"Re",
"-",
"expands",
"a",
"flattened",
"json",
"representation",
"from",
"a",
"collection",
"of",
"attributes",
"back",
"into",
"a",
"raw",
"nested",
"json",
"string",
"."
] | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonAttributeMappings.java#L100-L102 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/World.java | World.actorFor | public Protocols actorFor(final Class<?>[] protocols, final Class<? extends Actor> type, final Object...parameters) {
if (isTerminated()) {
throw new IllegalStateException("vlingo/actors: Stopped.");
}
return stage().actorFor(protocols, type, parameters);
} | java | public Protocols actorFor(final Class<?>[] protocols, final Class<? extends Actor> type, final Object...parameters) {
if (isTerminated()) {
throw new IllegalStateException("vlingo/actors: Stopped.");
}
return stage().actorFor(protocols, type, parameters);
} | [
"public",
"Protocols",
"actorFor",
"(",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"protocols",
",",
"final",
"Class",
"<",
"?",
"extends",
"Actor",
">",
"type",
",",
"final",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"isTerminated",
"(",
")"... | Answers a {@code Protocols} that provides one or more supported protocols for the
newly created {@code Actor} according to {@code definition}.
@param protocols the {@code Class<?>[]} array of protocols that the {@code Actor} supports
@param type the {@code Class<? extends Actor>} of the {@code Actor} to create
@param parameters the {@code Object[]} of constructor parameters
@return {@code Protocols} | [
"Answers",
"a",
"{"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/World.java#L136-L142 |
dnsjava/dnsjava | org/xbill/DNS/ZoneTransferIn.java | ZoneTransferIn.newIXFR | public static ZoneTransferIn
newIXFR(Name zone, long serial, boolean fallback, String host, TSIG key)
throws UnknownHostException
{
return newIXFR(zone, serial, fallback, host, 0, key);
} | java | public static ZoneTransferIn
newIXFR(Name zone, long serial, boolean fallback, String host, TSIG key)
throws UnknownHostException
{
return newIXFR(zone, serial, fallback, host, 0, key);
} | [
"public",
"static",
"ZoneTransferIn",
"newIXFR",
"(",
"Name",
"zone",
",",
"long",
"serial",
",",
"boolean",
"fallback",
",",
"String",
"host",
",",
"TSIG",
"key",
")",
"throws",
"UnknownHostException",
"{",
"return",
"newIXFR",
"(",
"zone",
",",
"serial",
"... | Instantiates a ZoneTransferIn object to do an IXFR (incremental zone
transfer).
@param zone The zone to transfer.
@param serial The existing serial number.
@param fallback If true, fall back to AXFR if IXFR is not supported.
@param host The host from which to transfer the zone.
@param key The TSIG key used to authenticate the transfer, or null.
@return The ZoneTransferIn object.
@throws UnknownHostException The host does not exist. | [
"Instantiates",
"a",
"ZoneTransferIn",
"object",
"to",
"do",
"an",
"IXFR",
"(",
"incremental",
"zone",
"transfer",
")",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ZoneTransferIn.java#L290-L295 |
paypal/SeLion | dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java | XmlDataProviderImpl.getDataByKeys | @Override
public Object[][] getDataByKeys(String[] keys) {
logger.entering(Arrays.toString(keys));
if (null == resource.getCls()) {
resource.setCls(KeyValueMap.class);
}
Object[][] objectArray;
try {
JAXBContext context = JAXBContext.newInstance(resource.getCls());
Unmarshaller unmarshaller = context.createUnmarshaller();
StreamSource xmlStreamSource = new StreamSource(resource.getInputStream());
Map<String, KeyValuePair> keyValueItems = unmarshaller
.unmarshal(xmlStreamSource, KeyValueMap.class).getValue().getMap();
objectArray = DataProviderHelper.getDataByKeys(keyValueItems, keys);
} catch (JAXBException excp) {
logger.exiting(excp.getMessage());
throw new DataProviderException("Error unmarshalling XML file.", excp);
}
// Passing no arguments to exiting() because implementation to print 2D array could be highly recursive.
logger.exiting();
return objectArray;
} | java | @Override
public Object[][] getDataByKeys(String[] keys) {
logger.entering(Arrays.toString(keys));
if (null == resource.getCls()) {
resource.setCls(KeyValueMap.class);
}
Object[][] objectArray;
try {
JAXBContext context = JAXBContext.newInstance(resource.getCls());
Unmarshaller unmarshaller = context.createUnmarshaller();
StreamSource xmlStreamSource = new StreamSource(resource.getInputStream());
Map<String, KeyValuePair> keyValueItems = unmarshaller
.unmarshal(xmlStreamSource, KeyValueMap.class).getValue().getMap();
objectArray = DataProviderHelper.getDataByKeys(keyValueItems, keys);
} catch (JAXBException excp) {
logger.exiting(excp.getMessage());
throw new DataProviderException("Error unmarshalling XML file.", excp);
}
// Passing no arguments to exiting() because implementation to print 2D array could be highly recursive.
logger.exiting();
return objectArray;
} | [
"@",
"Override",
"public",
"Object",
"[",
"]",
"[",
"]",
"getDataByKeys",
"(",
"String",
"[",
"]",
"keys",
")",
"{",
"logger",
".",
"entering",
"(",
"Arrays",
".",
"toString",
"(",
"keys",
")",
")",
";",
"if",
"(",
"null",
"==",
"resource",
".",
"g... | Generates a two dimensional array for TestNG DataProvider from the XML data representing a map of name value
collection filtered by keys.
A name value item should use the node name 'item' and a specific child structure since the implementation depends
on {@link KeyValuePair} class. The structure of an item in collection is shown below where 'key' and 'value' are
child nodes contained in a parent node named 'item':
<pre>
<items>
<item>
<key>k1</key>
<value>val1</value>
</item>
<item>
<key>k2</key>
<value>val2</value>
</item>
<item>
<key>k3</key>
<value>val3</value>
</item>
</items>
</pre>
@param keys
The string keys to filter the data.
@return A two dimensional object array. | [
"Generates",
"a",
"two",
"dimensional",
"array",
"for",
"TestNG",
"DataProvider",
"from",
"the",
"XML",
"data",
"representing",
"a",
"map",
"of",
"name",
"value",
"collection",
"filtered",
"by",
"keys",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java#L262-L285 |
JOML-CI/JOML | src/org/joml/Vector3f.java | Vector3f.set | public Vector3f set(int index, FloatBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector3f set(int index, FloatBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector3f",
"set",
"(",
"int",
"index",
",",
"FloatBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link FloatBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given FloatBuffer.
@param index
the absolute position into the FloatBuffer
@param buffer
values will be read in <code>x, y, z</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"FloatBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3f.java#L392-L395 |
zackpollard/JavaTelegramBot-API | core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java | TelegramBot.editMessageText | public Message editMessageText(String chatId, Long messageId, String text, ParseMode parseMode, boolean disableWebPagePreview, InlineReplyMarkup inlineReplyMarkup) {
if(chatId != null && messageId != null && text != null) {
JSONObject jsonResponse = this.editMessageText(chatId, messageId, null, text, parseMode, disableWebPagePreview, inlineReplyMarkup);
if (jsonResponse != null) {
return MessageImpl.createMessage(jsonResponse.getJSONObject("result"), this);
}
}
return null;
} | java | public Message editMessageText(String chatId, Long messageId, String text, ParseMode parseMode, boolean disableWebPagePreview, InlineReplyMarkup inlineReplyMarkup) {
if(chatId != null && messageId != null && text != null) {
JSONObject jsonResponse = this.editMessageText(chatId, messageId, null, text, parseMode, disableWebPagePreview, inlineReplyMarkup);
if (jsonResponse != null) {
return MessageImpl.createMessage(jsonResponse.getJSONObject("result"), this);
}
}
return null;
} | [
"public",
"Message",
"editMessageText",
"(",
"String",
"chatId",
",",
"Long",
"messageId",
",",
"String",
"text",
",",
"ParseMode",
"parseMode",
",",
"boolean",
"disableWebPagePreview",
",",
"InlineReplyMarkup",
"inlineReplyMarkup",
")",
"{",
"if",
"(",
"chatId",
... | This allows you to edit the text of a message you have already sent previously
@param chatId The chat ID of the chat containing the message you want to edit
@param messageId The message ID of the message you want to edit
@param text The new text you want to display
@param parseMode The ParseMode that should be used with this new text
@param disableWebPagePreview Whether any URLs should be displayed with a preview of their content
@param inlineReplyMarkup Any InlineReplyMarkup object you want to edit into the message
@return A new Message object representing the edited message | [
"This",
"allows",
"you",
"to",
"edit",
"the",
"text",
"of",
"a",
"message",
"you",
"have",
"already",
"sent",
"previously"
] | train | https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L685-L698 |
teatrove/teatrove | teaservlet/src/main/java/org/teatrove/teaservlet/util/cluster/ClusterManager.java | ClusterManager.launchAuto | public void launchAuto(boolean active) {
killAuto();
if (mSock != null) {
try {
mAuto = new AutomaticClusterManagementThread(this, mCluster
.getClusterName(),
active);
}
catch (Exception e) {
mAuto = new AutomaticClusterManagementThread(this, active);
}
if (mAuto != null) {
mAuto.start();
}
}
} | java | public void launchAuto(boolean active) {
killAuto();
if (mSock != null) {
try {
mAuto = new AutomaticClusterManagementThread(this, mCluster
.getClusterName(),
active);
}
catch (Exception e) {
mAuto = new AutomaticClusterManagementThread(this, active);
}
if (mAuto != null) {
mAuto.start();
}
}
} | [
"public",
"void",
"launchAuto",
"(",
"boolean",
"active",
")",
"{",
"killAuto",
"(",
")",
";",
"if",
"(",
"mSock",
"!=",
"null",
")",
"{",
"try",
"{",
"mAuto",
"=",
"new",
"AutomaticClusterManagementThread",
"(",
"this",
",",
"mCluster",
".",
"getClusterNa... | Allows the management thread to passively take part in the cluster
operations.
Other cluster members will not be made aware of this instance. | [
"Allows",
"the",
"management",
"thread",
"to",
"passively",
"take",
"part",
"in",
"the",
"cluster",
"operations",
".",
"Other",
"cluster",
"members",
"will",
"not",
"be",
"made",
"aware",
"of",
"this",
"instance",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/util/cluster/ClusterManager.java#L440-L455 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java | PreConditionException.validateEqualTo | public static void validateEqualTo( long value, long condition, String identifier )
throws PreConditionException
{
if( value == condition )
{
return;
}
throw new PreConditionException( identifier + " was not equal to " + condition + ". Was: " + value );
} | java | public static void validateEqualTo( long value, long condition, String identifier )
throws PreConditionException
{
if( value == condition )
{
return;
}
throw new PreConditionException( identifier + " was not equal to " + condition + ". Was: " + value );
} | [
"public",
"static",
"void",
"validateEqualTo",
"(",
"long",
"value",
",",
"long",
"condition",
",",
"String",
"identifier",
")",
"throws",
"PreConditionException",
"{",
"if",
"(",
"value",
"==",
"condition",
")",
"{",
"return",
";",
"}",
"throw",
"new",
"Pre... | Validates that the value under test is a particular value.
<p/>
This method ensures that <code>value == condition</code>.
@param identifier The name of the object.
@param condition The condition value.
@param value The value to be tested.
@throws PreConditionException if the condition is not met. | [
"Validates",
"that",
"the",
"value",
"under",
"test",
"is",
"a",
"particular",
"value",
".",
"<p",
"/",
">",
"This",
"method",
"ensures",
"that",
"<code",
">",
"value",
"==",
"condition<",
"/",
"code",
">",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java#L211-L219 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/utils/memory/MemoryUtil.java | MemoryUtil.getBytes | public static void getBytes(long address, byte[] buffer, int bufferOffset, int count)
{
if (buffer == null)
throw new NullPointerException();
else if (bufferOffset < 0 || count < 0 || count > buffer.length - bufferOffset)
throw new IndexOutOfBoundsException();
else if (count == 0)
return;
unsafe.copyMemory(null, address, buffer, BYTE_ARRAY_BASE_OFFSET + bufferOffset, count);
} | java | public static void getBytes(long address, byte[] buffer, int bufferOffset, int count)
{
if (buffer == null)
throw new NullPointerException();
else if (bufferOffset < 0 || count < 0 || count > buffer.length - bufferOffset)
throw new IndexOutOfBoundsException();
else if (count == 0)
return;
unsafe.copyMemory(null, address, buffer, BYTE_ARRAY_BASE_OFFSET + bufferOffset, count);
} | [
"public",
"static",
"void",
"getBytes",
"(",
"long",
"address",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"bufferOffset",
",",
"int",
"count",
")",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"... | Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffset
@param address start offset in the memory
@param buffer the data buffer
@param bufferOffset start offset of the buffer
@param count number of bytes to transfer | [
"Transfers",
"count",
"bytes",
"from",
"Memory",
"starting",
"at",
"memoryOffset",
"to",
"buffer",
"starting",
"at",
"bufferOffset"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/memory/MemoryUtil.java#L296-L306 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.hosting_web_new_GET | public ArrayList<String> hosting_web_new_GET(OvhDnsZoneEnum dnsZone, String domain, OvhOrderableNameEnum module, net.minidev.ovh.api.hosting.web.OvhOfferEnum offer, Boolean waiveRetractationPeriod) throws IOException {
String qPath = "/order/hosting/web/new";
StringBuilder sb = path(qPath);
query(sb, "dnsZone", dnsZone);
query(sb, "domain", domain);
query(sb, "module", module);
query(sb, "offer", offer);
query(sb, "waiveRetractationPeriod", waiveRetractationPeriod);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> hosting_web_new_GET(OvhDnsZoneEnum dnsZone, String domain, OvhOrderableNameEnum module, net.minidev.ovh.api.hosting.web.OvhOfferEnum offer, Boolean waiveRetractationPeriod) throws IOException {
String qPath = "/order/hosting/web/new";
StringBuilder sb = path(qPath);
query(sb, "dnsZone", dnsZone);
query(sb, "domain", domain);
query(sb, "module", module);
query(sb, "offer", offer);
query(sb, "waiveRetractationPeriod", waiveRetractationPeriod);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"hosting_web_new_GET",
"(",
"OvhDnsZoneEnum",
"dnsZone",
",",
"String",
"domain",
",",
"OvhOrderableNameEnum",
"module",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"hosting",
".",
"web",
".",
"OvhOfferEn... | Get allowed durations for 'new' option
REST: GET /order/hosting/web/new
@param domain [required] Domain name which will be linked to this hosting account
@param module [required] Module installation ready to use
@param dnsZone [required] Dns zone modification possibilities ( by default : RESET_ALL )
@param offer [required] Offer for your new hosting account
@param waiveRetractationPeriod [required] Indicates that order will be processed with waiving retractation period | [
"Get",
"allowed",
"durations",
"for",
"new",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4755-L4765 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.parametersUsageNotAllowed | public static void parametersUsageNotAllowed(String methodName, String className){
throw new DynamicConversionParameterException(MSG.INSTANCE.message(dynamicConversionParameterException,methodName,className));
} | java | public static void parametersUsageNotAllowed(String methodName, String className){
throw new DynamicConversionParameterException(MSG.INSTANCE.message(dynamicConversionParameterException,methodName,className));
} | [
"public",
"static",
"void",
"parametersUsageNotAllowed",
"(",
"String",
"methodName",
",",
"String",
"className",
")",
"{",
"throw",
"new",
"DynamicConversionParameterException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"dynamicConversionParameterException",
",... | Thrown when the parameters number is incorrect.
@param methodName method name
@param className class name | [
"Thrown",
"when",
"the",
"parameters",
"number",
"is",
"incorrect",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L214-L216 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/memoize/StampedCommonCache.java | StampedCommonCache.doWithReadLock | private <R> R doWithReadLock(Action<K, V, R> action) {
long stamp = sl.tryOptimisticRead();
R result = action.doWith(commonCache);
if (!sl.validate(stamp)) {
stamp = sl.readLock();
try {
result = action.doWith(commonCache);
} finally {
sl.unlockRead(stamp);
}
}
return result;
} | java | private <R> R doWithReadLock(Action<K, V, R> action) {
long stamp = sl.tryOptimisticRead();
R result = action.doWith(commonCache);
if (!sl.validate(stamp)) {
stamp = sl.readLock();
try {
result = action.doWith(commonCache);
} finally {
sl.unlockRead(stamp);
}
}
return result;
} | [
"private",
"<",
"R",
">",
"R",
"doWithReadLock",
"(",
"Action",
"<",
"K",
",",
"V",
",",
"R",
">",
"action",
")",
"{",
"long",
"stamp",
"=",
"sl",
".",
"tryOptimisticRead",
"(",
")",
";",
"R",
"result",
"=",
"action",
".",
"doWith",
"(",
"commonCac... | deal with the backed cache guarded by read lock
@param action the content to complete | [
"deal",
"with",
"the",
"backed",
"cache",
"guarded",
"by",
"read",
"lock"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/memoize/StampedCommonCache.java#L282-L296 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/format/MediaFormat.java | MediaFormat.getMinDimension | public Dimension getMinDimension() {
long effWithMin = getEffectiveMinWidth();
long effHeightMin = getEffectiveMinHeight();
double effRatio = getRatio();
if (effWithMin == 0 && effHeightMin > 0 && effRatio > 0) {
effWithMin = Math.round(effHeightMin * effRatio);
}
if (effWithMin > 0 && effHeightMin == 0 && effRatio > 0) {
effHeightMin = Math.round(effWithMin / effRatio);
}
if (effWithMin > 0 || effHeightMin > 0) {
return new Dimension(effWithMin, effHeightMin);
}
else {
return null;
}
} | java | public Dimension getMinDimension() {
long effWithMin = getEffectiveMinWidth();
long effHeightMin = getEffectiveMinHeight();
double effRatio = getRatio();
if (effWithMin == 0 && effHeightMin > 0 && effRatio > 0) {
effWithMin = Math.round(effHeightMin * effRatio);
}
if (effWithMin > 0 && effHeightMin == 0 && effRatio > 0) {
effHeightMin = Math.round(effWithMin / effRatio);
}
if (effWithMin > 0 || effHeightMin > 0) {
return new Dimension(effWithMin, effHeightMin);
}
else {
return null;
}
} | [
"public",
"Dimension",
"getMinDimension",
"(",
")",
"{",
"long",
"effWithMin",
"=",
"getEffectiveMinWidth",
"(",
")",
";",
"long",
"effHeightMin",
"=",
"getEffectiveMinHeight",
"(",
")",
";",
"double",
"effRatio",
"=",
"getRatio",
"(",
")",
";",
"if",
"(",
"... | Get minimum dimensions for media format. If only with or height is defined the missing dimensions
is calculated from the ratio. If no ratio defined either only width or height dimension is returned.
If neither width or height are defined null is returned.
@return Min. dimensions or null | [
"Get",
"minimum",
"dimensions",
"for",
"media",
"format",
".",
"If",
"only",
"with",
"or",
"height",
"is",
"defined",
"the",
"missing",
"dimensions",
"is",
"calculated",
"from",
"the",
"ratio",
".",
"If",
"no",
"ratio",
"defined",
"either",
"only",
"width",
... | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/format/MediaFormat.java#L432-L450 |
mbenson/therian | core/src/main/java/therian/util/Positions.java | Positions.readOnly | public static <T> Position.Readable<T> readOnly(final Typed<T> typed, final Supplier<T> supplier) {
return readOnly(Validate.notNull(typed, "type").getType(), supplier);
} | java | public static <T> Position.Readable<T> readOnly(final Typed<T> typed, final Supplier<T> supplier) {
return readOnly(Validate.notNull(typed, "type").getType(), supplier);
} | [
"public",
"static",
"<",
"T",
">",
"Position",
".",
"Readable",
"<",
"T",
">",
"readOnly",
"(",
"final",
"Typed",
"<",
"T",
">",
"typed",
",",
"final",
"Supplier",
"<",
"T",
">",
"supplier",
")",
"{",
"return",
"readOnly",
"(",
"Validate",
".",
"notN... | Get a read-only position of type {@code typed.type}, obtaining its value from {@code supplier}.
@param typed not {@code null}
@param supplier not {@code null}
@return Position.Readable | [
"Get",
"a",
"read",
"-",
"only",
"position",
"of",
"type",
"{",
"@code",
"typed",
".",
"type",
"}",
"obtaining",
"its",
"value",
"from",
"{",
"@code",
"supplier",
"}",
"."
] | train | https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/util/Positions.java#L223-L225 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java | ContentSpecParser.getTitle | protected String getTitle(final String input, final char startDelim) {
if (isStringNullOrEmpty(input)) {
return null;
} else {
return ProcessorUtilities.cleanXMLCharacterReferences(StringUtilities.split(input, startDelim)[0].trim());
}
} | java | protected String getTitle(final String input, final char startDelim) {
if (isStringNullOrEmpty(input)) {
return null;
} else {
return ProcessorUtilities.cleanXMLCharacterReferences(StringUtilities.split(input, startDelim)[0].trim());
}
} | [
"protected",
"String",
"getTitle",
"(",
"final",
"String",
"input",
",",
"final",
"char",
"startDelim",
")",
"{",
"if",
"(",
"isStringNullOrEmpty",
"(",
"input",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"ProcessorUtilities",
".",
"... | Gets the title of a chapter/section/appendix/topic by returning everything before the start delimiter.
@param input The input to be parsed to get the title.
@param startDelim The delimiter that specifies that start of options (ie '[')
@return The title as a String or null if the title is blank. | [
"Gets",
"the",
"title",
"of",
"a",
"chapter",
"/",
"section",
"/",
"appendix",
"/",
"topic",
"by",
"returning",
"everything",
"before",
"the",
"start",
"delimiter",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L1784-L1790 |
dita-ot/dita-ot | src/main/java/org/dita/dost/module/KeyrefModule.java | KeyrefModule.processFile | private void processFile(final ResolveTask r) {
final List<XMLFilter> filters = new ArrayList<>();
final ConkeyrefFilter conkeyrefFilter = new ConkeyrefFilter();
conkeyrefFilter.setLogger(logger);
conkeyrefFilter.setJob(job);
conkeyrefFilter.setKeyDefinitions(r.scope);
conkeyrefFilter.setCurrentFile(job.tempDirURI.resolve(r.in.uri));
conkeyrefFilter.setDelayConrefUtils(delayConrefUtils);
filters.add(conkeyrefFilter);
filters.add(topicFragmentFilter);
final KeyrefPaser parser = new KeyrefPaser();
parser.setLogger(logger);
parser.setJob(job);
parser.setKeyDefinition(r.scope);
parser.setCurrentFile(job.tempDirURI.resolve(r.in.uri));
filters.add(parser);
try {
logger.debug("Using " + (r.scope.name != null ? r.scope.name + " scope" : "root scope"));
if (r.out != null) {
logger.info("Processing " + job.tempDirURI.resolve(r.in.uri) +
" to " + job.tempDirURI.resolve(r.out.uri));
xmlUtils.transform(new File(job.tempDir, r.in.file.getPath()),
new File(job.tempDir, r.out.file.getPath()),
filters);
} else {
logger.info("Processing " + job.tempDirURI.resolve(r.in.uri));
xmlUtils.transform(new File(job.tempDir, r.in.file.getPath()), filters);
}
// validate resource-only list
normalProcessingRole.addAll(parser.getNormalProcessingRoleTargets());
} catch (final DITAOTException e) {
logger.error("Failed to process key references: " + e.getMessage(), e);
}
} | java | private void processFile(final ResolveTask r) {
final List<XMLFilter> filters = new ArrayList<>();
final ConkeyrefFilter conkeyrefFilter = new ConkeyrefFilter();
conkeyrefFilter.setLogger(logger);
conkeyrefFilter.setJob(job);
conkeyrefFilter.setKeyDefinitions(r.scope);
conkeyrefFilter.setCurrentFile(job.tempDirURI.resolve(r.in.uri));
conkeyrefFilter.setDelayConrefUtils(delayConrefUtils);
filters.add(conkeyrefFilter);
filters.add(topicFragmentFilter);
final KeyrefPaser parser = new KeyrefPaser();
parser.setLogger(logger);
parser.setJob(job);
parser.setKeyDefinition(r.scope);
parser.setCurrentFile(job.tempDirURI.resolve(r.in.uri));
filters.add(parser);
try {
logger.debug("Using " + (r.scope.name != null ? r.scope.name + " scope" : "root scope"));
if (r.out != null) {
logger.info("Processing " + job.tempDirURI.resolve(r.in.uri) +
" to " + job.tempDirURI.resolve(r.out.uri));
xmlUtils.transform(new File(job.tempDir, r.in.file.getPath()),
new File(job.tempDir, r.out.file.getPath()),
filters);
} else {
logger.info("Processing " + job.tempDirURI.resolve(r.in.uri));
xmlUtils.transform(new File(job.tempDir, r.in.file.getPath()), filters);
}
// validate resource-only list
normalProcessingRole.addAll(parser.getNormalProcessingRoleTargets());
} catch (final DITAOTException e) {
logger.error("Failed to process key references: " + e.getMessage(), e);
}
} | [
"private",
"void",
"processFile",
"(",
"final",
"ResolveTask",
"r",
")",
"{",
"final",
"List",
"<",
"XMLFilter",
">",
"filters",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"ConkeyrefFilter",
"conkeyrefFilter",
"=",
"new",
"ConkeyrefFilter",
"(",
... | Process key references in a topic. Topic is stored with a new name if it's
been processed before. | [
"Process",
"key",
"references",
"in",
"a",
"topic",
".",
"Topic",
"is",
"stored",
"with",
"a",
"new",
"name",
"if",
"it",
"s",
"been",
"processed",
"before",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/KeyrefModule.java#L340-L377 |
Jasig/uPortal | uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletAdministrationHelper.java | PortletAdministrationHelper.addPrincipalPermissionsToForm | private void addPrincipalPermissionsToForm(IPortletDefinition def, PortletDefinitionForm form) {
final String portletTargetId = PermissionHelper.permissionTargetIdForPortletDefinition(def);
final Set<JsonEntityBean> principalBeans = new HashSet<>();
Map<String, IPermissionManager> permManagers = new HashMap<>();
for (PortletPermissionsOnForm perm : PortletPermissionsOnForm.values()) {
if (!permManagers.containsKey(perm.getOwner())) {
permManagers.put(
perm.getOwner(),
authorizationService.newPermissionManager(perm.getOwner()));
}
final IPermissionManager pm = permManagers.get(perm.getOwner());
/* Obtain the principals that have permission for the activity on this portlet */
final IAuthorizationPrincipal[] principals =
pm.getAuthorizedPrincipals(perm.getActivity(), portletTargetId);
for (IAuthorizationPrincipal principal : principals) {
JsonEntityBean principalBean;
// first assume this is a group
final IEntityGroup group = GroupService.findGroup(principal.getKey());
if (group != null) {
// principal is a group
principalBean = new JsonEntityBean(group, EntityEnum.GROUP);
} else {
// not a group, so it must be a person
final IGroupMember member = authorizationService.getGroupMember(principal);
principalBean = new JsonEntityBean(member, EntityEnum.PERSON);
// set the name
final String name = groupListHelper.lookupEntityName(principalBean);
principalBean.setName(name);
}
principalBeans.add(principalBean);
form.addPermission(principalBean.getTypeAndIdHash() + "_" + perm.getActivity());
}
}
form.setPrincipals(principalBeans, false);
} | java | private void addPrincipalPermissionsToForm(IPortletDefinition def, PortletDefinitionForm form) {
final String portletTargetId = PermissionHelper.permissionTargetIdForPortletDefinition(def);
final Set<JsonEntityBean> principalBeans = new HashSet<>();
Map<String, IPermissionManager> permManagers = new HashMap<>();
for (PortletPermissionsOnForm perm : PortletPermissionsOnForm.values()) {
if (!permManagers.containsKey(perm.getOwner())) {
permManagers.put(
perm.getOwner(),
authorizationService.newPermissionManager(perm.getOwner()));
}
final IPermissionManager pm = permManagers.get(perm.getOwner());
/* Obtain the principals that have permission for the activity on this portlet */
final IAuthorizationPrincipal[] principals =
pm.getAuthorizedPrincipals(perm.getActivity(), portletTargetId);
for (IAuthorizationPrincipal principal : principals) {
JsonEntityBean principalBean;
// first assume this is a group
final IEntityGroup group = GroupService.findGroup(principal.getKey());
if (group != null) {
// principal is a group
principalBean = new JsonEntityBean(group, EntityEnum.GROUP);
} else {
// not a group, so it must be a person
final IGroupMember member = authorizationService.getGroupMember(principal);
principalBean = new JsonEntityBean(member, EntityEnum.PERSON);
// set the name
final String name = groupListHelper.lookupEntityName(principalBean);
principalBean.setName(name);
}
principalBeans.add(principalBean);
form.addPermission(principalBean.getTypeAndIdHash() + "_" + perm.getActivity());
}
}
form.setPrincipals(principalBeans, false);
} | [
"private",
"void",
"addPrincipalPermissionsToForm",
"(",
"IPortletDefinition",
"def",
",",
"PortletDefinitionForm",
"form",
")",
"{",
"final",
"String",
"portletTargetId",
"=",
"PermissionHelper",
".",
"permissionTargetIdForPortletDefinition",
"(",
"def",
")",
";",
"final... | /*
Add to the form SUBSCRIBE, BROWSE, and CONFIGURE activity permissions, along with their principals,
assigned to the portlet. | [
"/",
"*",
"Add",
"to",
"the",
"form",
"SUBSCRIBE",
"BROWSE",
"and",
"CONFIGURE",
"activity",
"permissions",
"along",
"with",
"their",
"principals",
"assigned",
"to",
"the",
"portlet",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletAdministrationHelper.java#L222-L261 |
tzaeschke/zoodb | src/org/zoodb/internal/server/index/AbstractPagedIndex.java | AbstractPagedIndex.writeToPreallocated | final int writeToPreallocated(StorageChannelOutput out, Map<AbstractIndexPage, Integer> map) {
return getRoot().writeToPreallocated(out, map);
} | java | final int writeToPreallocated(StorageChannelOutput out, Map<AbstractIndexPage, Integer> map) {
return getRoot().writeToPreallocated(out, map);
} | [
"final",
"int",
"writeToPreallocated",
"(",
"StorageChannelOutput",
"out",
",",
"Map",
"<",
"AbstractIndexPage",
",",
"Integer",
">",
"map",
")",
"{",
"return",
"getRoot",
"(",
")",
".",
"writeToPreallocated",
"(",
"out",
",",
"map",
")",
";",
"}"
] | Special write method that uses only pre-allocated pages.
@param map
@return the root page Id. | [
"Special",
"write",
"method",
"that",
"uses",
"only",
"pre",
"-",
"allocated",
"pages",
"."
] | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/AbstractPagedIndex.java#L154-L156 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java | WebMonitorUtils.validateAndNormalizeUri | public static Path validateAndNormalizeUri(URI archiveDirUri) {
final String scheme = archiveDirUri.getScheme();
final String path = archiveDirUri.getPath();
// some validity checks
if (scheme == null) {
throw new IllegalArgumentException("The scheme (hdfs://, file://, etc) is null. " +
"Please specify the file system scheme explicitly in the URI.");
}
if (path == null) {
throw new IllegalArgumentException("The path to store the job archive data in is null. " +
"Please specify a directory path for the archiving the job data.");
}
return new Path(archiveDirUri);
} | java | public static Path validateAndNormalizeUri(URI archiveDirUri) {
final String scheme = archiveDirUri.getScheme();
final String path = archiveDirUri.getPath();
// some validity checks
if (scheme == null) {
throw new IllegalArgumentException("The scheme (hdfs://, file://, etc) is null. " +
"Please specify the file system scheme explicitly in the URI.");
}
if (path == null) {
throw new IllegalArgumentException("The path to store the job archive data in is null. " +
"Please specify a directory path for the archiving the job data.");
}
return new Path(archiveDirUri);
} | [
"public",
"static",
"Path",
"validateAndNormalizeUri",
"(",
"URI",
"archiveDirUri",
")",
"{",
"final",
"String",
"scheme",
"=",
"archiveDirUri",
".",
"getScheme",
"(",
")",
";",
"final",
"String",
"path",
"=",
"archiveDirUri",
".",
"getPath",
"(",
")",
";",
... | Checks and normalizes the given URI. This method first checks the validity of the
URI (scheme and path are not null) and then normalizes the URI to a path.
@param archiveDirUri The URI to check and normalize.
@return A normalized URI as a Path.
@throws IllegalArgumentException Thrown, if the URI misses scheme or path. | [
"Checks",
"and",
"normalizes",
"the",
"given",
"URI",
".",
"This",
"method",
"first",
"checks",
"the",
"validity",
"of",
"the",
"URI",
"(",
"scheme",
"and",
"path",
"are",
"not",
"null",
")",
"and",
"then",
"normalizes",
"the",
"URI",
"to",
"a",
"path",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java#L263-L278 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/CompressionUtil.java | CompressionUtil.extractFileGzip | public static File extractFileGzip(String _compressedFile, String _outputFileName) {
return decompress(CompressionMethod.GZIP, _compressedFile, _outputFileName);
} | java | public static File extractFileGzip(String _compressedFile, String _outputFileName) {
return decompress(CompressionMethod.GZIP, _compressedFile, _outputFileName);
} | [
"public",
"static",
"File",
"extractFileGzip",
"(",
"String",
"_compressedFile",
",",
"String",
"_outputFileName",
")",
"{",
"return",
"decompress",
"(",
"CompressionMethod",
".",
"GZIP",
",",
"_compressedFile",
",",
"_outputFileName",
")",
";",
"}"
] | Extracts a GZIP compressed file to the given outputfile.
@param _compressedFile
@param _outputFileName
@return file-object with outputfile or null on any error. | [
"Extracts",
"a",
"GZIP",
"compressed",
"file",
"to",
"the",
"given",
"outputfile",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/CompressionUtil.java#L42-L44 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableVeneerSettingsFactory.java | BigtableVeneerSettingsFactory.buildMutateRowSettings | private static void buildMutateRowSettings(Builder builder, BigtableOptions options) {
RetrySettings retrySettings =
buildIdempotentRetrySettings(builder.mutateRowSettings().getRetrySettings(), options);
builder.mutateRowSettings()
.setRetrySettings(retrySettings)
.setRetryableCodes(buildRetryCodes(options.getRetryOptions()));
} | java | private static void buildMutateRowSettings(Builder builder, BigtableOptions options) {
RetrySettings retrySettings =
buildIdempotentRetrySettings(builder.mutateRowSettings().getRetrySettings(), options);
builder.mutateRowSettings()
.setRetrySettings(retrySettings)
.setRetryableCodes(buildRetryCodes(options.getRetryOptions()));
} | [
"private",
"static",
"void",
"buildMutateRowSettings",
"(",
"Builder",
"builder",
",",
"BigtableOptions",
"options",
")",
"{",
"RetrySettings",
"retrySettings",
"=",
"buildIdempotentRetrySettings",
"(",
"builder",
".",
"mutateRowSettings",
"(",
")",
".",
"getRetrySettin... | To build BigtableDataSettings#mutateRowSettings with default Retry settings. | [
"To",
"build",
"BigtableDataSettings#mutateRowSettings",
"with",
"default",
"Retry",
"settings",
"."
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableVeneerSettingsFactory.java#L214-L221 |
virgo47/javasimon | core/src/main/java/org/javasimon/utils/SimonUtils.java | SimonUtils.doWithStopwatch | public static void doWithStopwatch(String name, Runnable runnable) {
try (Split split = SimonManager.getStopwatch(name).start()) {
runnable.run();
}
} | java | public static void doWithStopwatch(String name, Runnable runnable) {
try (Split split = SimonManager.getStopwatch(name).start()) {
runnable.run();
}
} | [
"public",
"static",
"void",
"doWithStopwatch",
"(",
"String",
"name",
",",
"Runnable",
"runnable",
")",
"{",
"try",
"(",
"Split",
"split",
"=",
"SimonManager",
".",
"getStopwatch",
"(",
"name",
")",
".",
"start",
"(",
")",
")",
"{",
"runnable",
".",
"run... | Calls a block of code with stopwatch around, can not return any result or throw an exception
(use {@link #doWithStopwatch(String, java.util.concurrent.Callable)} instead).
@param name name of the Stopwatch
@param runnable wrapped block of code
@since 3.0 | [
"Calls",
"a",
"block",
"of",
"code",
"with",
"stopwatch",
"around",
"can",
"not",
"return",
"any",
"result",
"or",
"throw",
"an",
"exception",
"(",
"use",
"{",
"@link",
"#doWithStopwatch",
"(",
"String",
"java",
".",
"util",
".",
"concurrent",
".",
"Callab... | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SimonUtils.java#L358-L362 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java | Hierarchy.findMethod | public static @CheckForNull
JavaClassAndMethod findMethod(JavaClass javaClass, String methodName, String methodSig) {
return findMethod(javaClass, methodName, methodSig, ANY_METHOD);
} | java | public static @CheckForNull
JavaClassAndMethod findMethod(JavaClass javaClass, String methodName, String methodSig) {
return findMethod(javaClass, methodName, methodSig, ANY_METHOD);
} | [
"public",
"static",
"@",
"CheckForNull",
"JavaClassAndMethod",
"findMethod",
"(",
"JavaClass",
"javaClass",
",",
"String",
"methodName",
",",
"String",
"methodSig",
")",
"{",
"return",
"findMethod",
"(",
"javaClass",
",",
"methodName",
",",
"methodSig",
",",
"ANY_... | Find a method in given class.
@param javaClass
the class
@param methodName
the name of the method
@param methodSig
the signature of the method
@return the JavaClassAndMethod, or null if no such method exists in the
class | [
"Find",
"a",
"method",
"in",
"given",
"class",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L427-L430 |
apereo/cas | support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java | AbstractServiceValidateController.verifyRegisteredServiceProperties | private static void verifyRegisteredServiceProperties(final RegisteredService registeredService, final Service service) {
if (registeredService == null) {
val msg = String.format("Service [%s] is not found in service registry.", service.getId());
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
val msg = String.format("ServiceManagement: Unauthorized Service Access. " + "Service [%s] is not enabled in service registry.", service.getId());
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
} | java | private static void verifyRegisteredServiceProperties(final RegisteredService registeredService, final Service service) {
if (registeredService == null) {
val msg = String.format("Service [%s] is not found in service registry.", service.getId());
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
if (!registeredService.getAccessStrategy().isServiceAccessAllowed()) {
val msg = String.format("ServiceManagement: Unauthorized Service Access. " + "Service [%s] is not enabled in service registry.", service.getId());
LOGGER.warn(msg);
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, msg);
}
} | [
"private",
"static",
"void",
"verifyRegisteredServiceProperties",
"(",
"final",
"RegisteredService",
"registeredService",
",",
"final",
"Service",
"service",
")",
"{",
"if",
"(",
"registeredService",
"==",
"null",
")",
"{",
"val",
"msg",
"=",
"String",
".",
"forma... | Ensure that the service is found and enabled in the service registry.
@param registeredService the located entry in the registry
@param service authenticating service
@throws UnauthorizedServiceException if service is determined to be unauthorized | [
"Ensure",
"that",
"the",
"service",
"is",
"found",
"and",
"enabled",
"in",
"the",
"service",
"registry",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L67-L78 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java | Text.getName | public static String getName(String path, boolean ignoreTrailingSlash)
{
if (ignoreTrailingSlash && path.endsWith("/") && path.length() > 1)
{
path = path.substring(0, path.length() - 1);
}
return getName(path);
} | java | public static String getName(String path, boolean ignoreTrailingSlash)
{
if (ignoreTrailingSlash && path.endsWith("/") && path.length() > 1)
{
path = path.substring(0, path.length() - 1);
}
return getName(path);
} | [
"public",
"static",
"String",
"getName",
"(",
"String",
"path",
",",
"boolean",
"ignoreTrailingSlash",
")",
"{",
"if",
"(",
"ignoreTrailingSlash",
"&&",
"path",
".",
"endsWith",
"(",
"\"/\"",
")",
"&&",
"path",
".",
"length",
"(",
")",
">",
"1",
")",
"{"... | Same as {@link #getName(String)} but adding the possibility to pass paths that end with a
trailing '/'
@see #getName(String) | [
"Same",
"as",
"{",
"@link",
"#getName",
"(",
"String",
")",
"}",
"but",
"adding",
"the",
"possibility",
"to",
"pass",
"paths",
"that",
"end",
"with",
"a",
"trailing",
"/"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L646-L653 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/headerfooter/RtfHeaderFooterGroup.java | RtfHeaderFooterGroup.setHeaderFooter | public void setHeaderFooter(RtfHeaderFooter headerFooter, int displayAt) {
this.mode = MODE_MULTIPLE;
headerFooter.setRtfDocument(this.document);
headerFooter.setType(this.type);
headerFooter.setDisplayAt(displayAt);
switch(displayAt) {
case RtfHeaderFooter.DISPLAY_ALL_PAGES:
headerAll = headerFooter;
break;
case RtfHeaderFooter.DISPLAY_FIRST_PAGE:
headerFirst = headerFooter;
break;
case RtfHeaderFooter.DISPLAY_LEFT_PAGES:
headerLeft = headerFooter;
break;
case RtfHeaderFooter.DISPLAY_RIGHT_PAGES:
headerRight = headerFooter;
break;
}
} | java | public void setHeaderFooter(RtfHeaderFooter headerFooter, int displayAt) {
this.mode = MODE_MULTIPLE;
headerFooter.setRtfDocument(this.document);
headerFooter.setType(this.type);
headerFooter.setDisplayAt(displayAt);
switch(displayAt) {
case RtfHeaderFooter.DISPLAY_ALL_PAGES:
headerAll = headerFooter;
break;
case RtfHeaderFooter.DISPLAY_FIRST_PAGE:
headerFirst = headerFooter;
break;
case RtfHeaderFooter.DISPLAY_LEFT_PAGES:
headerLeft = headerFooter;
break;
case RtfHeaderFooter.DISPLAY_RIGHT_PAGES:
headerRight = headerFooter;
break;
}
} | [
"public",
"void",
"setHeaderFooter",
"(",
"RtfHeaderFooter",
"headerFooter",
",",
"int",
"displayAt",
")",
"{",
"this",
".",
"mode",
"=",
"MODE_MULTIPLE",
";",
"headerFooter",
".",
"setRtfDocument",
"(",
"this",
".",
"document",
")",
";",
"headerFooter",
".",
... | Set a RtfHeaderFooter to be displayed at a certain position
@param headerFooter The RtfHeaderFooter to display
@param displayAt The display location to use | [
"Set",
"a",
"RtfHeaderFooter",
"to",
"be",
"displayed",
"at",
"a",
"certain",
"position"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/headerfooter/RtfHeaderFooterGroup.java#L247-L266 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/utils/DockerfileParser.java | DockerfileParser.dockerfileToCommandList | public static List<DockerCommand> dockerfileToCommandList( File dockerfile ) throws IOException {
List<DockerCommand> result = new ArrayList<>();
FileInputStream in = new FileInputStream( dockerfile );
Logger logger = Logger.getLogger( DockerfileParser.class.getName());
BufferedReader br = null;
try {
br = new BufferedReader( new InputStreamReader( in, StandardCharsets.UTF_8 ));
String line;
while((line = br.readLine()) != null) {
DockerCommand cmd = DockerCommand.guess(line);
if( cmd != null )
result.add( cmd );
else
logger.fine("Ignoring unsupported Docker instruction: " + line );
}
} finally {
Utils.closeQuietly( br );
Utils.closeQuietly( in );
}
return result;
} | java | public static List<DockerCommand> dockerfileToCommandList( File dockerfile ) throws IOException {
List<DockerCommand> result = new ArrayList<>();
FileInputStream in = new FileInputStream( dockerfile );
Logger logger = Logger.getLogger( DockerfileParser.class.getName());
BufferedReader br = null;
try {
br = new BufferedReader( new InputStreamReader( in, StandardCharsets.UTF_8 ));
String line;
while((line = br.readLine()) != null) {
DockerCommand cmd = DockerCommand.guess(line);
if( cmd != null )
result.add( cmd );
else
logger.fine("Ignoring unsupported Docker instruction: " + line );
}
} finally {
Utils.closeQuietly( br );
Utils.closeQuietly( in );
}
return result;
} | [
"public",
"static",
"List",
"<",
"DockerCommand",
">",
"dockerfileToCommandList",
"(",
"File",
"dockerfile",
")",
"throws",
"IOException",
"{",
"List",
"<",
"DockerCommand",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"FileInputStream",
"in",
... | Parses a dockerfile to a list of commands.
@throws IOException
@param dockerfile a file
@return a list of Docker commands | [
"Parses",
"a",
"dockerfile",
"to",
"a",
"list",
"of",
"commands",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/DockerfileParser.java#L59-L84 |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java | PythonStreamExecutionEnvironment.generate_sequence | public PythonDataStream generate_sequence(long from, long to) {
return new PythonDataStream<>(env.generateSequence(from, to).map(new AdapterMap<>()));
} | java | public PythonDataStream generate_sequence(long from, long to) {
return new PythonDataStream<>(env.generateSequence(from, to).map(new AdapterMap<>()));
} | [
"public",
"PythonDataStream",
"generate_sequence",
"(",
"long",
"from",
",",
"long",
"to",
")",
"{",
"return",
"new",
"PythonDataStream",
"<>",
"(",
"env",
".",
"generateSequence",
"(",
"from",
",",
"to",
")",
".",
"map",
"(",
"new",
"AdapterMap",
"<>",
"(... | A thin wrapper layer over {@link StreamExecutionEnvironment#generateSequence(long, long)}.
@param from The number to start at (inclusive)
@param to The number to stop at (inclusive)
@return A python data stream, containing all number in the [from, to] interval | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"StreamExecutionEnvironment#generateSequence",
"(",
"long",
"long",
")",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java#L176-L178 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.order_orderId_paymentMeans_GET | public OvhPaymentMeans order_orderId_paymentMeans_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/paymentMeans";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPaymentMeans.class);
} | java | public OvhPaymentMeans order_orderId_paymentMeans_GET(Long orderId) throws IOException {
String qPath = "/me/order/{orderId}/paymentMeans";
StringBuilder sb = path(qPath, orderId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPaymentMeans.class);
} | [
"public",
"OvhPaymentMeans",
"order_orderId_paymentMeans_GET",
"(",
"Long",
"orderId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/order/{orderId}/paymentMeans\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"orderId",
")",
";",
... | Return main data about the object the processing of the order generated
REST: GET /me/order/{orderId}/paymentMeans
@param orderId [required] | [
"Return",
"main",
"data",
"about",
"the",
"object",
"the",
"processing",
"of",
"the",
"order",
"generated"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1897-L1902 |
pf4j/pf4j | pf4j/src/main/java/org/pf4j/util/DirectedGraph.java | DirectedGraph.addEdge | public void addEdge(V from, V to) {
addVertex(from);
addVertex(to);
neighbors.get(from).add(to);
} | java | public void addEdge(V from, V to) {
addVertex(from);
addVertex(to);
neighbors.get(from).add(to);
} | [
"public",
"void",
"addEdge",
"(",
"V",
"from",
",",
"V",
"to",
")",
"{",
"addVertex",
"(",
"from",
")",
";",
"addVertex",
"(",
"to",
")",
";",
"neighbors",
".",
"get",
"(",
"from",
")",
".",
"add",
"(",
"to",
")",
";",
"}"
] | Add an edge to the graph; if either vertex does not exist, it's added.
This implementation allows the creation of multi-edges and self-loops. | [
"Add",
"an",
"edge",
"to",
"the",
"graph",
";",
"if",
"either",
"vertex",
"does",
"not",
"exist",
"it",
"s",
"added",
".",
"This",
"implementation",
"allows",
"the",
"creation",
"of",
"multi",
"-",
"edges",
"and",
"self",
"-",
"loops",
"."
] | train | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java#L65-L69 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java | CacheSetUtil.values | public static <T> Single<Set<T>> values(CacheConfigBean cacheConfigBean, String key, Class<T> vClazz) {
return values(cacheConfigBean, key)
.map(values -> {
Set<T> _values = new TreeSet<>();
if (values != null && !values.isEmpty()) {
values.forEach(value -> {
_values.add(Reflection.toType(value, vClazz));
});
}
return _values;
});
} | java | public static <T> Single<Set<T>> values(CacheConfigBean cacheConfigBean, String key, Class<T> vClazz) {
return values(cacheConfigBean, key)
.map(values -> {
Set<T> _values = new TreeSet<>();
if (values != null && !values.isEmpty()) {
values.forEach(value -> {
_values.add(Reflection.toType(value, vClazz));
});
}
return _values;
});
} | [
"public",
"static",
"<",
"T",
">",
"Single",
"<",
"Set",
"<",
"T",
">",
">",
"values",
"(",
"CacheConfigBean",
"cacheConfigBean",
",",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"vClazz",
")",
"{",
"return",
"values",
"(",
"cacheConfigBean",
",",
"k... | retrial the cached set
@param cacheConfigBean the datasource configuration
@param key the key
@param vClazz the class for the element
@param <T> generic type of the set
@return the typed value set | [
"retrial",
"the",
"cached",
"set"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java#L157-L168 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByProviderUserId | public Iterable<DConnection> queryByProviderUserId(java.lang.String providerUserId) {
return queryByField(null, DConnectionMapper.Field.PROVIDERUSERID.getFieldName(), providerUserId);
} | java | public Iterable<DConnection> queryByProviderUserId(java.lang.String providerUserId) {
return queryByField(null, DConnectionMapper.Field.PROVIDERUSERID.getFieldName(), providerUserId);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByProviderUserId",
"(",
"java",
".",
"lang",
".",
"String",
"providerUserId",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"PROVIDERUSERID",
".",
"getFieldName",
... | query-by method for field providerUserId
@param providerUserId the specified attribute
@return an Iterable of DConnections for the specified providerUserId | [
"query",
"-",
"by",
"method",
"for",
"field",
"providerUserId"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L124-L126 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsHistoryDriver.java | CmsHistoryDriver.internalCleanup | protected void internalCleanup(CmsDbContext dbc, I_CmsHistoryResource resource) throws CmsDataAccessException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
Map<CmsUUID, Integer> tmpSubResources = new HashMap<CmsUUID, Integer>();
// if is folder and if no versions left
boolean isFolderAndNoVersionLeft = resource.getRootPath().endsWith("/")
&& (readLastVersion(dbc, resource.getStructureId()) == 0);
// if the resource is a folder
if (isFolderAndNoVersionLeft) {
try {
conn = m_sqlManager.getConnection(dbc);
// get all direct subresources
stmt = m_sqlManager.getPreparedStatement(conn, "C_STRUCTURE_HISTORY_READ_SUBRESOURCES");
stmt.setString(1, resource.getStructureId().toString());
res = stmt.executeQuery();
while (res.next()) {
CmsUUID structureId = new CmsUUID(res.getString(1));
int version = res.getInt(2);
tmpSubResources.put(structureId, Integer.valueOf(version));
}
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, res);
}
}
// delete all subresource versions
for (Map.Entry<CmsUUID, Integer> entry : tmpSubResources.entrySet()) {
I_CmsHistoryResource histResource = readResource(dbc, entry.getKey(), entry.getValue().intValue());
deleteEntries(dbc, histResource, 0, -1);
}
} | java | protected void internalCleanup(CmsDbContext dbc, I_CmsHistoryResource resource) throws CmsDataAccessException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
Map<CmsUUID, Integer> tmpSubResources = new HashMap<CmsUUID, Integer>();
// if is folder and if no versions left
boolean isFolderAndNoVersionLeft = resource.getRootPath().endsWith("/")
&& (readLastVersion(dbc, resource.getStructureId()) == 0);
// if the resource is a folder
if (isFolderAndNoVersionLeft) {
try {
conn = m_sqlManager.getConnection(dbc);
// get all direct subresources
stmt = m_sqlManager.getPreparedStatement(conn, "C_STRUCTURE_HISTORY_READ_SUBRESOURCES");
stmt.setString(1, resource.getStructureId().toString());
res = stmt.executeQuery();
while (res.next()) {
CmsUUID structureId = new CmsUUID(res.getString(1));
int version = res.getInt(2);
tmpSubResources.put(structureId, Integer.valueOf(version));
}
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, res);
}
}
// delete all subresource versions
for (Map.Entry<CmsUUID, Integer> entry : tmpSubResources.entrySet()) {
I_CmsHistoryResource histResource = readResource(dbc, entry.getKey(), entry.getValue().intValue());
deleteEntries(dbc, histResource, 0, -1);
}
} | [
"protected",
"void",
"internalCleanup",
"(",
"CmsDbContext",
"dbc",
",",
"I_CmsHistoryResource",
"resource",
")",
"throws",
"CmsDataAccessException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"ResultSet",
"res",
"=",... | Deletes all historical entries of subresources of a folder without any historical netry left.<p>
@param dbc the current database context
@param resource the resource to check
@throws CmsDataAccessException if something goes wrong | [
"Deletes",
"all",
"historical",
"entries",
"of",
"subresources",
"of",
"a",
"folder",
"without",
"any",
"historical",
"netry",
"left",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsHistoryDriver.java#L1606-L1643 |
Twitter4J/Twitter4J | twitter4j-core/src/internal-json/java/twitter4j/JSONImplFactory.java | JSONImplFactory.createUserMentionEntity | public static UserMentionEntity createUserMentionEntity(int start, int end, String name, String screenName,
long id) {
return new UserMentionEntityJSONImpl(start, end, name, screenName, id);
} | java | public static UserMentionEntity createUserMentionEntity(int start, int end, String name, String screenName,
long id) {
return new UserMentionEntityJSONImpl(start, end, name, screenName, id);
} | [
"public",
"static",
"UserMentionEntity",
"createUserMentionEntity",
"(",
"int",
"start",
",",
"int",
"end",
",",
"String",
"name",
",",
"String",
"screenName",
",",
"long",
"id",
")",
"{",
"return",
"new",
"UserMentionEntityJSONImpl",
"(",
"start",
",",
"end",
... | static factory method for twitter-text-java
@return user mention entity
@since Twitter4J 2.2.6 | [
"static",
"factory",
"method",
"for",
"twitter",
"-",
"text",
"-",
"java"
] | train | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/internal-json/java/twitter4j/JSONImplFactory.java#L284-L287 |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/MetaDataService.java | MetaDataService.retrieveMetricSeries | public List<Series> retrieveMetricSeries(String metricName) {
return retrieveMetricSeries(metricName, Collections.<String, String>emptyMap());
} | java | public List<Series> retrieveMetricSeries(String metricName) {
return retrieveMetricSeries(metricName, Collections.<String, String>emptyMap());
} | [
"public",
"List",
"<",
"Series",
">",
"retrieveMetricSeries",
"(",
"String",
"metricName",
")",
"{",
"return",
"retrieveMetricSeries",
"(",
"metricName",
",",
"Collections",
".",
"<",
"String",
",",
"String",
">",
"emptyMap",
"(",
")",
")",
";",
"}"
] | Retrieve series list of the specified metric
@param metricName metric name
@return list of series | [
"Retrieve",
"series",
"list",
"of",
"the",
"specified",
"metric"
] | train | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/MetaDataService.java#L585-L587 |
banq/jdonframework | src/main/java/com/jdon/util/UtilDateTime.java | UtilDateTime.toDate | public static java.util.Date toDate(String dateTime) {
// dateTime must have one space between the date and time...
String date = dateTime.substring(0, dateTime.indexOf(" "));
String time = dateTime.substring(dateTime.indexOf(" ") + 1);
return toDate(date, time);
} | java | public static java.util.Date toDate(String dateTime) {
// dateTime must have one space between the date and time...
String date = dateTime.substring(0, dateTime.indexOf(" "));
String time = dateTime.substring(dateTime.indexOf(" ") + 1);
return toDate(date, time);
} | [
"public",
"static",
"java",
".",
"util",
".",
"Date",
"toDate",
"(",
"String",
"dateTime",
")",
"{",
"// dateTime must have one space between the date and time...\r",
"String",
"date",
"=",
"dateTime",
".",
"substring",
"(",
"0",
",",
"dateTime",
".",
"indexOf",
"... | Converts a date and time String into a Date
@param dateTime
A combined data and time string in the format
"MM/DD/YYYY HH:MM:SS", the seconds are optional
@return The corresponding Date | [
"Converts",
"a",
"date",
"and",
"time",
"String",
"into",
"a",
"Date"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L303-L309 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyNodeImpl.java | PolicyNodeImpl.getPolicyNodesExpected | Set<PolicyNodeImpl> getPolicyNodesExpected(int depth,
String expectedOID, boolean matchAny) {
if (expectedOID.equals(ANY_POLICY)) {
return getPolicyNodes(depth);
} else {
return getPolicyNodesExpectedHelper(depth, expectedOID, matchAny);
}
} | java | Set<PolicyNodeImpl> getPolicyNodesExpected(int depth,
String expectedOID, boolean matchAny) {
if (expectedOID.equals(ANY_POLICY)) {
return getPolicyNodes(depth);
} else {
return getPolicyNodesExpectedHelper(depth, expectedOID, matchAny);
}
} | [
"Set",
"<",
"PolicyNodeImpl",
">",
"getPolicyNodesExpected",
"(",
"int",
"depth",
",",
"String",
"expectedOID",
",",
"boolean",
"matchAny",
")",
"{",
"if",
"(",
"expectedOID",
".",
"equals",
"(",
"ANY_POLICY",
")",
")",
"{",
"return",
"getPolicyNodes",
"(",
... | Finds all nodes at the specified depth whose expected_policy_set
contains the specified expected OID (if matchAny is false)
or the special OID "any value" (if matchAny is true).
@param depth an int representing the desired depth
@param expectedOID a String encoding the valid OID to match
@param matchAny a boolean indicating whether an expected_policy_set
containing ANY_POLICY should be considered a match
@return a Set of matched <code>PolicyNode</code>s | [
"Finds",
"all",
"nodes",
"at",
"the",
"specified",
"depth",
"whose",
"expected_policy_set",
"contains",
"the",
"specified",
"expected",
"OID",
"(",
"if",
"matchAny",
"is",
"false",
")",
"or",
"the",
"special",
"OID",
"any",
"value",
"(",
"if",
"matchAny",
"i... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyNodeImpl.java#L334-L342 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java | TextSimilarity.similar | public static String similar(String strA, String strB, int scale) {
return NumberUtil.formatPercent(similar(strA, strB), scale);
} | java | public static String similar(String strA, String strB, int scale) {
return NumberUtil.formatPercent(similar(strA, strB), scale);
} | [
"public",
"static",
"String",
"similar",
"(",
"String",
"strA",
",",
"String",
"strB",
",",
"int",
"scale",
")",
"{",
"return",
"NumberUtil",
".",
"formatPercent",
"(",
"similar",
"(",
"strA",
",",
"strB",
")",
",",
"scale",
")",
";",
"}"
] | 计算相似度百分比
@param strA 字符串1
@param strB 字符串2
@param scale 保留小数
@return 百分比 | [
"计算相似度百分比"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java#L45-L47 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/markup/AnnotatedTextBuilder.java | AnnotatedTextBuilder.addMarkup | public AnnotatedTextBuilder addMarkup(String markup, String interpretAs) {
parts.add(new TextPart(markup, TextPart.Type.MARKUP));
parts.add(new TextPart(interpretAs, TextPart.Type.FAKE_CONTENT));
return this;
} | java | public AnnotatedTextBuilder addMarkup(String markup, String interpretAs) {
parts.add(new TextPart(markup, TextPart.Type.MARKUP));
parts.add(new TextPart(interpretAs, TextPart.Type.FAKE_CONTENT));
return this;
} | [
"public",
"AnnotatedTextBuilder",
"addMarkup",
"(",
"String",
"markup",
",",
"String",
"interpretAs",
")",
"{",
"parts",
".",
"add",
"(",
"new",
"TextPart",
"(",
"markup",
",",
"TextPart",
".",
"Type",
".",
"MARKUP",
")",
")",
";",
"parts",
".",
"add",
"... | Add a markup text snippet like {@code <b attr='something'>} or {@code <div>}. These
parts will be ignored by LanguageTool when using {@link org.languagetool.JLanguageTool#check(AnnotatedText)}.
@param interpretAs A string that will be used by the checker instead of the markup. This is usually
whitespace, e.g. {@code \n\n} for {@code <p>} | [
"Add",
"a",
"markup",
"text",
"snippet",
"like",
"{"
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/markup/AnnotatedTextBuilder.java#L104-L108 |
lucasr/probe | library/src/main/java/org/lucasr/probe/ViewClassUtil.java | ViewClassUtil.findViewClass | static Class<?> findViewClass(Context context, String name)
throws ClassNotFoundException {
if (name.indexOf('.') >= 0) {
return loadViewClass(context, name);
}
for (String prefix : VIEW_CLASS_PREFIX_LIST) {
try {
return loadViewClass(context, prefix + name);
} catch (ClassNotFoundException e) {
continue;
}
}
throw new ClassNotFoundException("Couldn't load View class for " + name);
} | java | static Class<?> findViewClass(Context context, String name)
throws ClassNotFoundException {
if (name.indexOf('.') >= 0) {
return loadViewClass(context, name);
}
for (String prefix : VIEW_CLASS_PREFIX_LIST) {
try {
return loadViewClass(context, prefix + name);
} catch (ClassNotFoundException e) {
continue;
}
}
throw new ClassNotFoundException("Couldn't load View class for " + name);
} | [
"static",
"Class",
"<",
"?",
">",
"findViewClass",
"(",
"Context",
"context",
",",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")",
"{",
"return",
"loadViewClass",
"(",... | Tries to load class using a predefined list of class prefixes for
Android views. | [
"Tries",
"to",
"load",
"class",
"using",
"a",
"predefined",
"list",
"of",
"class",
"prefixes",
"for",
"Android",
"views",
"."
] | train | https://github.com/lucasr/probe/blob/cd15cc04383a1bf85de2f4c345d2018415b9ddc9/library/src/main/java/org/lucasr/probe/ViewClassUtil.java#L63-L78 |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java | StreamUtils.copyStreamToWriter | public static void copyStreamToWriter( InputStream in, Writer out, String encoding, boolean close )
throws IOException
{
InputStreamReader reader = new InputStreamReader( in, encoding );
copyReaderToWriter( reader, out, close );
} | java | public static void copyStreamToWriter( InputStream in, Writer out, String encoding, boolean close )
throws IOException
{
InputStreamReader reader = new InputStreamReader( in, encoding );
copyReaderToWriter( reader, out, close );
} | [
"public",
"static",
"void",
"copyStreamToWriter",
"(",
"InputStream",
"in",
",",
"Writer",
"out",
",",
"String",
"encoding",
",",
"boolean",
"close",
")",
"throws",
"IOException",
"{",
"InputStreamReader",
"reader",
"=",
"new",
"InputStreamReader",
"(",
"in",
",... | Copies an InputStream to a Writer.
@param in The input byte stream of data.
@param out The Writer to receive the streamed data as characters.
@param encoding The encoding used in the byte stream.
@param close true if the Reader and OutputStream should be closed after the completion.
@throws IOException If an underlying I/O Exception occurs. | [
"Copies",
"an",
"InputStream",
"to",
"a",
"Writer",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L282-L287 |
liferay/com-liferay-commerce | commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java | CommerceAccountPersistenceImpl.countByU_T | @Override
public int countByU_T(long userId, int type) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_U_T;
Object[] finderArgs = new Object[] { userId, type };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEACCOUNT_WHERE);
query.append(_FINDER_COLUMN_U_T_USERID_2);
query.append(_FINDER_COLUMN_U_T_TYPE_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(userId);
qPos.add(type);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByU_T(long userId, int type) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_U_T;
Object[] finderArgs = new Object[] { userId, type };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEACCOUNT_WHERE);
query.append(_FINDER_COLUMN_U_T_USERID_2);
query.append(_FINDER_COLUMN_U_T_TYPE_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(userId);
qPos.add(type);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByU_T",
"(",
"long",
"userId",
",",
"int",
"type",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_COUNT_BY_U_T",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object",
"[",
"]",
"{",
"userId",
",",
"ty... | Returns the number of commerce accounts where userId = ? and type = ?.
@param userId the user ID
@param type the type
@return the number of matching commerce accounts | [
"Returns",
"the",
"number",
"of",
"commerce",
"accounts",
"where",
"userId",
"=",
"?",
";",
"and",
"type",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java#L1786-L1833 |
bwkimmel/jdcp | jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java | JobStatus.withIndeterminantProgress | public JobStatus withIndeterminantProgress() {
return new JobStatus(jobId, description, state, Double.NaN, status, eventId);
} | java | public JobStatus withIndeterminantProgress() {
return new JobStatus(jobId, description, state, Double.NaN, status, eventId);
} | [
"public",
"JobStatus",
"withIndeterminantProgress",
"(",
")",
"{",
"return",
"new",
"JobStatus",
"(",
"jobId",
",",
"description",
",",
"state",
",",
"Double",
".",
"NaN",
",",
"status",
",",
"eventId",
")",
";",
"}"
] | Creates a copy of this <code>JobStatus</code> with the progress set to
an indeterminant value (<code>Double.NaN</code>).
@return A copy of this <code>JobStatus</code> with the progress set to
indeterminant. | [
"Creates",
"a",
"copy",
"of",
"this",
"<code",
">",
"JobStatus<",
"/",
"code",
">",
"with",
"the",
"progress",
"set",
"to",
"an",
"indeterminant",
"value",
"(",
"<code",
">",
"Double",
".",
"NaN<",
"/",
"code",
">",
")",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java#L163-L165 |
UrielCh/ovh-java-sdk | ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java | ApiOvhAuth.time_GET | public Long time_GET() throws IOException {
String qPath = "/auth/time";
StringBuilder sb = path(qPath);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, Long.class);
} | java | public Long time_GET() throws IOException {
String qPath = "/auth/time";
StringBuilder sb = path(qPath);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, Long.class);
} | [
"public",
"Long",
"time_GET",
"(",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/auth/time\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"String",
"resp",
"=",
"execN",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",... | Get the current time of the OVH servers, since UNIX epoch
REST: GET /auth/time | [
"Get",
"the",
"current",
"time",
"of",
"the",
"OVH",
"servers",
"since",
"UNIX",
"epoch"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java#L48-L53 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.getByResourceGroupAsync | public Observable<DataMigrationServiceInner> getByResourceGroupAsync(String groupName, String serviceName) {
return getByResourceGroupWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<DataMigrationServiceInner>, DataMigrationServiceInner>() {
@Override
public DataMigrationServiceInner call(ServiceResponse<DataMigrationServiceInner> response) {
return response.body();
}
});
} | java | public Observable<DataMigrationServiceInner> getByResourceGroupAsync(String groupName, String serviceName) {
return getByResourceGroupWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<DataMigrationServiceInner>, DataMigrationServiceInner>() {
@Override
public DataMigrationServiceInner call(ServiceResponse<DataMigrationServiceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataMigrationServiceInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
")",
".",
"map",
"... | Get DMS Service Instance.
The services resource is the top-level resource that represents the Data Migration Service. The GET method retrieves information about a service instance.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataMigrationServiceInner object | [
"Get",
"DMS",
"Service",
"Instance",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"The",
"GET",
"method",
"retrieves",
"information",
"about",
"a",
"service"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L371-L378 |
roboconf/roboconf-platform | core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerMachineConfigurator.java | DockerMachineConfigurator.createImage | void createImage( String imageId ) throws TargetException {
// If there is no Dockerfile, this method will do nothing
File targetDirectory = this.parameters.getTargetPropertiesDirectory();
String dockerFilePath = this.parameters.getTargetProperties().get( GENERATE_IMAGE_FROM );
if( ! Utils.isEmptyOrWhitespaces( dockerFilePath ) && targetDirectory != null ) {
this.logger.fine( "Trying to create image " + imageId + " from a Dockerfile." );
File dockerFile = new File( targetDirectory, dockerFilePath );
if( ! dockerFile.exists())
throw new TargetException( "No Dockerfile was found at " + dockerFile );
// Start the build.
// This will block the current thread until the creation is complete.
String builtImageId;
this.logger.fine( "Asking Docker to build the image from our Dockerfile." );
try {
builtImageId = this.dockerClient
.buildImageCmd( dockerFile )
.withTags( Sets.newHashSet( imageId ))
.withPull( true )
.exec( new RoboconfBuildImageResultCallback())
.awaitImageId();
} catch( Exception e ) {
Utils.logException( this.logger, e );
throw new TargetException( e );
}
// No need to store the real image ID... Docker has it.
// Besides, we search images by both IDs and tags.
// Anyway, we can log the information.
this.logger.fine( "Image '" + builtImageId + "' was succesfully generated by Roboconf." );
}
} | java | void createImage( String imageId ) throws TargetException {
// If there is no Dockerfile, this method will do nothing
File targetDirectory = this.parameters.getTargetPropertiesDirectory();
String dockerFilePath = this.parameters.getTargetProperties().get( GENERATE_IMAGE_FROM );
if( ! Utils.isEmptyOrWhitespaces( dockerFilePath ) && targetDirectory != null ) {
this.logger.fine( "Trying to create image " + imageId + " from a Dockerfile." );
File dockerFile = new File( targetDirectory, dockerFilePath );
if( ! dockerFile.exists())
throw new TargetException( "No Dockerfile was found at " + dockerFile );
// Start the build.
// This will block the current thread until the creation is complete.
String builtImageId;
this.logger.fine( "Asking Docker to build the image from our Dockerfile." );
try {
builtImageId = this.dockerClient
.buildImageCmd( dockerFile )
.withTags( Sets.newHashSet( imageId ))
.withPull( true )
.exec( new RoboconfBuildImageResultCallback())
.awaitImageId();
} catch( Exception e ) {
Utils.logException( this.logger, e );
throw new TargetException( e );
}
// No need to store the real image ID... Docker has it.
// Besides, we search images by both IDs and tags.
// Anyway, we can log the information.
this.logger.fine( "Image '" + builtImageId + "' was succesfully generated by Roboconf." );
}
} | [
"void",
"createImage",
"(",
"String",
"imageId",
")",
"throws",
"TargetException",
"{",
"// If there is no Dockerfile, this method will do nothing",
"File",
"targetDirectory",
"=",
"this",
".",
"parameters",
".",
"getTargetPropertiesDirectory",
"(",
")",
";",
"String",
"d... | Creates an image.
@param imageId the image ID
@throws TargetException if something went wrong | [
"Creates",
"an",
"image",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerMachineConfigurator.java#L260-L294 |
joniles/mpxj | src/main/java/net/sf/mpxj/common/InputStreamHelper.java | InputStreamHelper.processZipStream | private static void processZipStream(File dir, InputStream inputStream) throws IOException
{
ZipInputStream zip = new ZipInputStream(inputStream);
while (true)
{
ZipEntry entry = zip.getNextEntry();
if (entry == null)
{
break;
}
File file = new File(dir, entry.getName());
if (entry.isDirectory())
{
FileHelper.mkdirsQuietly(file);
continue;
}
File parent = file.getParentFile();
if (parent != null)
{
FileHelper.mkdirsQuietly(parent);
}
FileOutputStream fos = new FileOutputStream(file);
byte[] bytes = new byte[1024];
int length;
while ((length = zip.read(bytes)) >= 0)
{
fos.write(bytes, 0, length);
}
fos.close();
}
} | java | private static void processZipStream(File dir, InputStream inputStream) throws IOException
{
ZipInputStream zip = new ZipInputStream(inputStream);
while (true)
{
ZipEntry entry = zip.getNextEntry();
if (entry == null)
{
break;
}
File file = new File(dir, entry.getName());
if (entry.isDirectory())
{
FileHelper.mkdirsQuietly(file);
continue;
}
File parent = file.getParentFile();
if (parent != null)
{
FileHelper.mkdirsQuietly(parent);
}
FileOutputStream fos = new FileOutputStream(file);
byte[] bytes = new byte[1024];
int length;
while ((length = zip.read(bytes)) >= 0)
{
fos.write(bytes, 0, length);
}
fos.close();
}
} | [
"private",
"static",
"void",
"processZipStream",
"(",
"File",
"dir",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"ZipInputStream",
"zip",
"=",
"new",
"ZipInputStream",
"(",
"inputStream",
")",
";",
"while",
"(",
"true",
")",
"{",
"Zip... | Expands a zip file input stream into a temporary directory.
@param dir temporary directory
@param inputStream zip file input stream | [
"Expands",
"a",
"zip",
"file",
"input",
"stream",
"into",
"a",
"temporary",
"directory",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/InputStreamHelper.java#L115-L148 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/TextureAtlas.java | TextureAtlas.addTexture | public void addTexture(String name, InputStream input) throws TextureTooBigException, IOException {
addTexture(name, ImageIO.read(input));
input.close();
} | java | public void addTexture(String name, InputStream input) throws TextureTooBigException, IOException {
addTexture(name, ImageIO.read(input));
input.close();
} | [
"public",
"void",
"addTexture",
"(",
"String",
"name",
",",
"InputStream",
"input",
")",
"throws",
"TextureTooBigException",
",",
"IOException",
"{",
"addTexture",
"(",
"name",
",",
"ImageIO",
".",
"read",
"(",
"input",
")",
")",
";",
"input",
".",
"close",
... | Adds the provided texture from the {@link java.io.InputStream} into this {@link TextureAtlas}.
@param name The name of this {@link Texture}
@param input The {@link java.io.InputStream} of the texture
@throws com.flowpowered.caustic.api.util.TextureAtlas.TextureTooBigException
@throws java.io.IOException | [
"Adds",
"the",
"provided",
"texture",
"from",
"the",
"{",
"@link",
"java",
".",
"io",
".",
"InputStream",
"}",
"into",
"this",
"{",
"@link",
"TextureAtlas",
"}",
"."
] | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/TextureAtlas.java#L78-L81 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMOptional.java | JMOptional.ifNotNull | public static <T> void ifNotNull(T object, Consumer<T> consumer) {
Optional.ofNullable(object).ifPresent(consumer);
} | java | public static <T> void ifNotNull(T object, Consumer<T> consumer) {
Optional.ofNullable(object).ifPresent(consumer);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"ifNotNull",
"(",
"T",
"object",
",",
"Consumer",
"<",
"T",
">",
"consumer",
")",
"{",
"Optional",
".",
"ofNullable",
"(",
"object",
")",
".",
"ifPresent",
"(",
"consumer",
")",
";",
"}"
] | If not null.
@param <T> the type parameter
@param object the object
@param consumer the consumer | [
"If",
"not",
"null",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMOptional.java#L217-L219 |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java | DurationDatatype.computeDays | private static BigInteger computeDays(BigInteger months, int refYear, int refMonth) {
switch (months.signum()) {
case 0:
return BigInteger.valueOf(0);
case -1:
return computeDays(months.negate(), refYear, refMonth).negate();
}
// Complete cycle of Gregorian calendar is 400 years
BigInteger[] tem = months.divideAndRemainder(BigInteger.valueOf(400*12));
--refMonth; // use 0 base to match Java
int total = 0;
for (int rem = tem[1].intValue(); rem > 0; rem--) {
total += daysInMonth(refYear, refMonth);
if (++refMonth == 12) {
refMonth = 0;
refYear++;
}
}
// In the Gregorian calendar, there are 97 (= 100 + 4 - 1) leap years every 400 years.
return tem[0].multiply(BigInteger.valueOf(365*400 + 97)).add(BigInteger.valueOf(total));
} | java | private static BigInteger computeDays(BigInteger months, int refYear, int refMonth) {
switch (months.signum()) {
case 0:
return BigInteger.valueOf(0);
case -1:
return computeDays(months.negate(), refYear, refMonth).negate();
}
// Complete cycle of Gregorian calendar is 400 years
BigInteger[] tem = months.divideAndRemainder(BigInteger.valueOf(400*12));
--refMonth; // use 0 base to match Java
int total = 0;
for (int rem = tem[1].intValue(); rem > 0; rem--) {
total += daysInMonth(refYear, refMonth);
if (++refMonth == 12) {
refMonth = 0;
refYear++;
}
}
// In the Gregorian calendar, there are 97 (= 100 + 4 - 1) leap years every 400 years.
return tem[0].multiply(BigInteger.valueOf(365*400 + 97)).add(BigInteger.valueOf(total));
} | [
"private",
"static",
"BigInteger",
"computeDays",
"(",
"BigInteger",
"months",
",",
"int",
"refYear",
",",
"int",
"refMonth",
")",
"{",
"switch",
"(",
"months",
".",
"signum",
"(",
")",
")",
"{",
"case",
"0",
":",
"return",
"BigInteger",
".",
"valueOf",
... | Returns the number of days spanned by a period of months starting with a particular
reference year and month. | [
"Returns",
"the",
"number",
"of",
"days",
"spanned",
"by",
"a",
"period",
"of",
"months",
"starting",
"with",
"a",
"particular",
"reference",
"year",
"and",
"month",
"."
] | train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/datatype/xsd/DurationDatatype.java#L179-L199 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/parser/IOUtil.java | IOUtil.readMap | public static Map<String, String[]> readMap(String filename)
throws IOException {
return readMap(filename, DEFAULT_DELIMITER);
} | java | public static Map<String, String[]> readMap(String filename)
throws IOException {
return readMap(filename, DEFAULT_DELIMITER);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"readMap",
"(",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"return",
"readMap",
"(",
"filename",
",",
"DEFAULT_DELIMITER",
")",
";",
"}"
] | Reads the specified file into a map. The first value is used as key. The
rest is put into a list and used as map value. Each entry is one line of
the file.
<p>
Ensures that no null value is returned.
<p>
Uses the default {@link #DEFAULT_DELIMITER}
@param filename
the name of the specification file (not the path to it)
@return a map with the first column as keys and the other columns as
values.
@throws IOException
if unable to read the specification file | [
"Reads",
"the",
"specified",
"file",
"into",
"a",
"map",
".",
"The",
"first",
"value",
"is",
"used",
"as",
"key",
".",
"The",
"rest",
"is",
"put",
"into",
"a",
"list",
"and",
"used",
"as",
"map",
"value",
".",
"Each",
"entry",
"is",
"one",
"line",
... | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/IOUtil.java#L367-L370 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java | BigtableSession.createChannelPool | protected ManagedChannel createChannelPool(final ChannelPool.ChannelFactory channelFactory, int count)
throws IOException {
return new ChannelPool(channelFactory, count);
} | java | protected ManagedChannel createChannelPool(final ChannelPool.ChannelFactory channelFactory, int count)
throws IOException {
return new ChannelPool(channelFactory, count);
} | [
"protected",
"ManagedChannel",
"createChannelPool",
"(",
"final",
"ChannelPool",
".",
"ChannelFactory",
"channelFactory",
",",
"int",
"count",
")",
"throws",
"IOException",
"{",
"return",
"new",
"ChannelPool",
"(",
"channelFactory",
",",
"count",
")",
";",
"}"
] | Create a new {@link com.google.cloud.bigtable.grpc.io.ChannelPool}, with auth headers. This
method allows users to override the default implementation with their own.
@param channelFactory a {@link ChannelPool.ChannelFactory} object.
@param count The number of channels in the pool.
@return a {@link com.google.cloud.bigtable.grpc.io.ChannelPool} object.
@throws java.io.IOException if any. | [
"Create",
"a",
"new",
"{",
"@link",
"com",
".",
"google",
".",
"cloud",
".",
"bigtable",
".",
"grpc",
".",
"io",
".",
"ChannelPool",
"}",
"with",
"auth",
"headers",
".",
"This",
"method",
"allows",
"users",
"to",
"override",
"the",
"default",
"implementa... | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java#L520-L523 |
openengsb/openengsb | components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EngineeringObjectEnhancer.java | EngineeringObjectEnhancer.mergeEngineeringObjectWithReferencedModel | private void mergeEngineeringObjectWithReferencedModel(Field field, EngineeringObjectModelWrapper model) {
AdvancedModelWrapper result = performMerge(loadReferencedModel(model, field), model);
if (result != null) {
model = result.toEngineeringObject();
}
} | java | private void mergeEngineeringObjectWithReferencedModel(Field field, EngineeringObjectModelWrapper model) {
AdvancedModelWrapper result = performMerge(loadReferencedModel(model, field), model);
if (result != null) {
model = result.toEngineeringObject();
}
} | [
"private",
"void",
"mergeEngineeringObjectWithReferencedModel",
"(",
"Field",
"field",
",",
"EngineeringObjectModelWrapper",
"model",
")",
"{",
"AdvancedModelWrapper",
"result",
"=",
"performMerge",
"(",
"loadReferencedModel",
"(",
"model",
",",
"field",
")",
",",
"mode... | Merges the given EngineeringObject with the referenced model which is defined in the given field. | [
"Merges",
"the",
"given",
"EngineeringObject",
"with",
"the",
"referenced",
"model",
"which",
"is",
"defined",
"in",
"the",
"given",
"field",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EngineeringObjectEnhancer.java#L288-L293 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/ChaincodeCollectionConfiguration.java | ChaincodeCollectionConfiguration.fromFile | private static ChaincodeCollectionConfiguration fromFile(File configFile, boolean isJson) throws InvalidArgumentException, IOException, ChaincodeCollectionConfigurationException {
// Sanity check
if (configFile == null) {
throw new InvalidArgumentException("configFile must be specified");
}
if (logger.isTraceEnabled()) {
logger.trace(format("ChaincodeCollectionConfiguration.fromFile: %s isJson = %b", configFile.getAbsolutePath(), isJson));
}
// Json file
try (InputStream stream = new FileInputStream(configFile)) {
return isJson ? fromJsonStream(stream) : fromYamlStream(stream);
}
} | java | private static ChaincodeCollectionConfiguration fromFile(File configFile, boolean isJson) throws InvalidArgumentException, IOException, ChaincodeCollectionConfigurationException {
// Sanity check
if (configFile == null) {
throw new InvalidArgumentException("configFile must be specified");
}
if (logger.isTraceEnabled()) {
logger.trace(format("ChaincodeCollectionConfiguration.fromFile: %s isJson = %b", configFile.getAbsolutePath(), isJson));
}
// Json file
try (InputStream stream = new FileInputStream(configFile)) {
return isJson ? fromJsonStream(stream) : fromYamlStream(stream);
}
} | [
"private",
"static",
"ChaincodeCollectionConfiguration",
"fromFile",
"(",
"File",
"configFile",
",",
"boolean",
"isJson",
")",
"throws",
"InvalidArgumentException",
",",
"IOException",
",",
"ChaincodeCollectionConfigurationException",
"{",
"// Sanity check",
"if",
"(",
"con... | Loads a ChaincodeCollectionConfiguration object from a Json or Yaml file | [
"Loads",
"a",
"ChaincodeCollectionConfiguration",
"object",
"from",
"a",
"Json",
"or",
"Yaml",
"file"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/ChaincodeCollectionConfiguration.java#L193-L209 |
telegram-s/telegram-mt | src/main/java/org/telegram/mtproto/MTProto.java | MTProto.sendRpcMessage | public int sendRpcMessage(TLMethod request, long timeout, boolean highPriority) {
int id = scheduller.postMessage(request, true, timeout, highPriority);
Logger.d(TAG, "sendMessage #" + id + " " + request.toString() + " with timeout " + timeout + " ms");
return id;
} | java | public int sendRpcMessage(TLMethod request, long timeout, boolean highPriority) {
int id = scheduller.postMessage(request, true, timeout, highPriority);
Logger.d(TAG, "sendMessage #" + id + " " + request.toString() + " with timeout " + timeout + " ms");
return id;
} | [
"public",
"int",
"sendRpcMessage",
"(",
"TLMethod",
"request",
",",
"long",
"timeout",
",",
"boolean",
"highPriority",
")",
"{",
"int",
"id",
"=",
"scheduller",
".",
"postMessage",
"(",
"request",
",",
"true",
",",
"timeout",
",",
"highPriority",
")",
";",
... | Sending rpc request
@param request request
@param timeout timeout of request
@param highPriority is hight priority request
@return request id | [
"Sending",
"rpc",
"request"
] | train | https://github.com/telegram-s/telegram-mt/blob/57e3f635a6508705081eba9396ae24db050bc943/src/main/java/org/telegram/mtproto/MTProto.java#L264-L268 |
facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/DistCp.java | DistCp.getCopier | public static DistCopier getCopier(final Configuration conf,
final Arguments args) throws IOException {
DistCopier dc = new DistCopier(conf, args);
dc.setupJob();
if (dc.getJobConf() != null) {
return dc;
} else {
return null;
}
} | java | public static DistCopier getCopier(final Configuration conf,
final Arguments args) throws IOException {
DistCopier dc = new DistCopier(conf, args);
dc.setupJob();
if (dc.getJobConf() != null) {
return dc;
} else {
return null;
}
} | [
"public",
"static",
"DistCopier",
"getCopier",
"(",
"final",
"Configuration",
"conf",
",",
"final",
"Arguments",
"args",
")",
"throws",
"IOException",
"{",
"DistCopier",
"dc",
"=",
"new",
"DistCopier",
"(",
"conf",
",",
"args",
")",
";",
"dc",
".",
"setupJob... | Return a DistCopier object for copying the files.
If a MapReduce job is needed, a DistCopier instance will be
initialized and returned.
If no MapReduce job is needed (for empty directories), all the
other work will be done in this function, and NULL will be
returned. If caller sees NULL returned, the copying has
succeeded.
@param conf
@param args
@return
@throws IOException | [
"Return",
"a",
"DistCopier",
"object",
"for",
"copying",
"the",
"files",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/DistCp.java#L1525-L1534 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java | SDMath.zeroFraction | public SDVariable zeroFraction(String name, SDVariable input) {
validateNumerical("zeroFraction", input);
SDVariable res = f().zeroFraction(input);
return updateVariableNameAndReference(res, name);
} | java | public SDVariable zeroFraction(String name, SDVariable input) {
validateNumerical("zeroFraction", input);
SDVariable res = f().zeroFraction(input);
return updateVariableNameAndReference(res, name);
} | [
"public",
"SDVariable",
"zeroFraction",
"(",
"String",
"name",
",",
"SDVariable",
"input",
")",
"{",
"validateNumerical",
"(",
"\"zeroFraction\"",
",",
"input",
")",
";",
"SDVariable",
"res",
"=",
"f",
"(",
")",
".",
"zeroFraction",
"(",
"input",
")",
";",
... | Full array zero fraction array reduction operation, optionally along specified dimensions: out = (count(x == 0) / length(x))
@param name Name of the output variable
@param input Input variable
@return Reduced array of rank 0 (scalar) | [
"Full",
"array",
"zero",
"fraction",
"array",
"reduction",
"operation",
"optionally",
"along",
"specified",
"dimensions",
":",
"out",
"=",
"(",
"count",
"(",
"x",
"==",
"0",
")",
"/",
"length",
"(",
"x",
"))"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L2406-L2410 |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/ltc/impl/LTCUOWCallback.java | LTCUOWCallback.contextChange | @Override
public void contextChange(int typeOfChange, UOWScope scope) throws IllegalStateException {
if (tc.isEntryEnabled())
Tr.entry(tc, "contextChange", new Object[] { typeOfChange, scope, this });
try {
// Determine the Tx change type and process. Ensure we do what
// we need to do as close to the context switch as possible
switch (typeOfChange) {
case PRE_BEGIN:
uowPreBegin();
break;
case POST_BEGIN:
uowPostBegin(scope);
break;
case PRE_END:
uowPreEnd(scope);
break;
case POST_END:
uowPostEnd();
break;
default:
if (tc.isDebugEnabled())
Tr.debug(tc, "Unknown typeOfChange: " + typeOfChange);
}
} catch (IllegalStateException ise) {
if (tc.isEntryEnabled())
Tr.exit(tc, "contextChange", ise);
throw ise;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "contextChange");
} | java | @Override
public void contextChange(int typeOfChange, UOWScope scope) throws IllegalStateException {
if (tc.isEntryEnabled())
Tr.entry(tc, "contextChange", new Object[] { typeOfChange, scope, this });
try {
// Determine the Tx change type and process. Ensure we do what
// we need to do as close to the context switch as possible
switch (typeOfChange) {
case PRE_BEGIN:
uowPreBegin();
break;
case POST_BEGIN:
uowPostBegin(scope);
break;
case PRE_END:
uowPreEnd(scope);
break;
case POST_END:
uowPostEnd();
break;
default:
if (tc.isDebugEnabled())
Tr.debug(tc, "Unknown typeOfChange: " + typeOfChange);
}
} catch (IllegalStateException ise) {
if (tc.isEntryEnabled())
Tr.exit(tc, "contextChange", ise);
throw ise;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "contextChange");
} | [
"@",
"Override",
"public",
"void",
"contextChange",
"(",
"int",
"typeOfChange",
",",
"UOWScope",
"scope",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"contextChange... | /*
Notification from UserTransaction or UserActivitySession interface implementations
that the state of a bean-managed UOW has changed. As a result of this bean-managed
UOW change we may have to change the LTC that's on the thread. | [
"/",
"*",
"Notification",
"from",
"UserTransaction",
"or",
"UserActivitySession",
"interface",
"implementations",
"that",
"the",
"state",
"of",
"a",
"bean",
"-",
"managed",
"UOW",
"has",
"changed",
".",
"As",
"a",
"result",
"of",
"this",
"bean",
"-",
"managed"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/ltc/impl/LTCUOWCallback.java#L73-L106 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java | TransientNodeData.createNodeData | public static TransientNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName,
InternalQName[] mixinTypesName, String identifier, AccessControlList acl)
{
TransientNodeData nodeData = null;
QPath path = QPath.makeChildPath(parent.getQPath(), name);
nodeData =
new TransientNodeData(path, identifier, -1, primaryTypeName, mixinTypesName, 0, parent.getIdentifier(), acl);
return nodeData;
} | java | public static TransientNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName,
InternalQName[] mixinTypesName, String identifier, AccessControlList acl)
{
TransientNodeData nodeData = null;
QPath path = QPath.makeChildPath(parent.getQPath(), name);
nodeData =
new TransientNodeData(path, identifier, -1, primaryTypeName, mixinTypesName, 0, parent.getIdentifier(), acl);
return nodeData;
} | [
"public",
"static",
"TransientNodeData",
"createNodeData",
"(",
"NodeData",
"parent",
",",
"InternalQName",
"name",
",",
"InternalQName",
"primaryTypeName",
",",
"InternalQName",
"[",
"]",
"mixinTypesName",
",",
"String",
"identifier",
",",
"AccessControlList",
"acl",
... | Factory method
@param parent NodeData
@param name InternalQName
@param primaryTypeName InternalQName
@param mixinTypesName InternalQName[]
@param identifier String
@param acl AccessControlList
@return | [
"Factory",
"method"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java#L274-L282 |
mbenson/therian | core/src/main/java/therian/TherianContext.java | TherianContext.evalIfSupported | public final synchronized <RESULT, OPERATION extends Operation<RESULT>> RESULT evalIfSupported(OPERATION operation,
RESULT defaultValue, Hint... hints) {
return evalSuccess(operation, hints) ? operation.getResult() : defaultValue;
} | java | public final synchronized <RESULT, OPERATION extends Operation<RESULT>> RESULT evalIfSupported(OPERATION operation,
RESULT defaultValue, Hint... hints) {
return evalSuccess(operation, hints) ? operation.getResult() : defaultValue;
} | [
"public",
"final",
"synchronized",
"<",
"RESULT",
",",
"OPERATION",
"extends",
"Operation",
"<",
"RESULT",
">",
">",
"RESULT",
"evalIfSupported",
"(",
"OPERATION",
"operation",
",",
"RESULT",
"defaultValue",
",",
"Hint",
"...",
"hints",
")",
"{",
"return",
"ev... | Evaluates {@code operation} if supported; otherwise returns {@code defaultValue}.
@param operation
@param defaultValue
@param hints
@return RESULT or {@code defaultValue}
@throws NullPointerException on {@code null} input
@throws OperationException potentially, via {@link Operation#getResult()} | [
"Evaluates",
"{",
"@code",
"operation",
"}",
"if",
"supported",
";",
"otherwise",
"returns",
"{",
"@code",
"defaultValue",
"}",
"."
] | train | https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/TherianContext.java#L394-L397 |
kubernetes-client/java | util/src/main/java/io/kubernetes/client/informer/SharedInformerFactory.java | SharedInformerFactory.sharedIndexInformerFor | public synchronized <ApiType, ApiListType> SharedIndexInformer<ApiType> sharedIndexInformerFor(
Function<CallGeneratorParams, Call> callGenerator,
Class<ApiType> apiTypeClass,
Class<ApiListType> apiListTypeClass) {
return sharedIndexInformerFor(callGenerator, apiTypeClass, apiListTypeClass, 0);
} | java | public synchronized <ApiType, ApiListType> SharedIndexInformer<ApiType> sharedIndexInformerFor(
Function<CallGeneratorParams, Call> callGenerator,
Class<ApiType> apiTypeClass,
Class<ApiListType> apiListTypeClass) {
return sharedIndexInformerFor(callGenerator, apiTypeClass, apiListTypeClass, 0);
} | [
"public",
"synchronized",
"<",
"ApiType",
",",
"ApiListType",
">",
"SharedIndexInformer",
"<",
"ApiType",
">",
"sharedIndexInformerFor",
"(",
"Function",
"<",
"CallGeneratorParams",
",",
"Call",
">",
"callGenerator",
",",
"Class",
"<",
"ApiType",
">",
"apiTypeClass"... | Shared index informer for shared index informer.
@param <ApiType> the type parameter
@param <ApiListType> the type parameter
@param callGenerator the call generator
@param apiTypeClass the api type class
@param apiListTypeClass the api list type class
@return the shared index informer | [
"Shared",
"index",
"informer",
"for",
"shared",
"index",
"informer",
"."
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/informer/SharedInformerFactory.java#L53-L58 |
app55/app55-java | src/support/java/com/googlecode/openbeans/Encoder.java | Encoder.setPersistenceDelegate | public void setPersistenceDelegate(Class<?> type, PersistenceDelegate delegate)
{
if (type == null || delegate == null)
{
throw new NullPointerException();
}
delegates.put(type, delegate);
} | java | public void setPersistenceDelegate(Class<?> type, PersistenceDelegate delegate)
{
if (type == null || delegate == null)
{
throw new NullPointerException();
}
delegates.put(type, delegate);
} | [
"public",
"void",
"setPersistenceDelegate",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"PersistenceDelegate",
"delegate",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"delegate",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
... | Register the <code>PersistenceDelegate</code> of the specified type.
@param type
@param delegate | [
"Register",
"the",
"<code",
">",
"PersistenceDelegate<",
"/",
"code",
">",
"of",
"the",
"specified",
"type",
"."
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/Encoder.java#L296-L303 |
lestard/advanced-bindings | src/main/java/eu/lestard/advanced_bindings/api/NumberBindings.java | NumberBindings.divideSafe | public static NumberBinding divideSafe(ObservableValue<Number> dividend, ObservableValue<Number> divisor, ObservableValue<Number> defaultValue) {
return Bindings.createDoubleBinding(() -> {
if (divisor.getValue().doubleValue() == 0) {
return defaultValue.getValue().doubleValue();
} else {
return dividend.getValue().doubleValue() / divisor.getValue().doubleValue();
}
}, dividend, divisor);
} | java | public static NumberBinding divideSafe(ObservableValue<Number> dividend, ObservableValue<Number> divisor, ObservableValue<Number> defaultValue) {
return Bindings.createDoubleBinding(() -> {
if (divisor.getValue().doubleValue() == 0) {
return defaultValue.getValue().doubleValue();
} else {
return dividend.getValue().doubleValue() / divisor.getValue().doubleValue();
}
}, dividend, divisor);
} | [
"public",
"static",
"NumberBinding",
"divideSafe",
"(",
"ObservableValue",
"<",
"Number",
">",
"dividend",
",",
"ObservableValue",
"<",
"Number",
">",
"divisor",
",",
"ObservableValue",
"<",
"Number",
">",
"defaultValue",
")",
"{",
"return",
"Bindings",
".",
"cr... | An number binding of a division that won't throw an {@link java.lang.ArithmeticException}
when a division by zero happens. See {@link #divideSafe(javafx.beans.value.ObservableIntegerValue,
javafx.beans.value.ObservableIntegerValue)}
for more informations.
@param dividend the observable value used as dividend
@param divisor the observable value used as divisor
@param defaultValue the observable value that is used as default value. The binding will have this value when a
division by zero happens.
@return the resulting number binding | [
"An",
"number",
"binding",
"of",
"a",
"division",
"that",
"won",
"t",
"throw",
"an",
"{",
"@link",
"java",
".",
"lang",
".",
"ArithmeticException",
"}",
"when",
"a",
"division",
"by",
"zero",
"happens",
".",
"See",
"{",
"@link",
"#divideSafe",
"(",
"java... | train | https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/NumberBindings.java#L110-L120 |
landawn/AbacusUtil | src/com/landawn/abacus/util/CSVUtil.java | CSVUtil.loadCSV | @SuppressWarnings("rawtypes")
public static <E extends Exception> DataSet loadCSV(final File csvFile, final long offset, final long count, final Try.Predicate<String[], E> filter,
final Map<String, ? extends Type> columnTypeMap) throws UncheckedIOException, E {
InputStream csvInputStream = null;
try {
csvInputStream = new FileInputStream(csvFile);
return loadCSV(csvInputStream, offset, count, filter, columnTypeMap);
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
IOUtil.closeQuietly(csvInputStream);
}
} | java | @SuppressWarnings("rawtypes")
public static <E extends Exception> DataSet loadCSV(final File csvFile, final long offset, final long count, final Try.Predicate<String[], E> filter,
final Map<String, ? extends Type> columnTypeMap) throws UncheckedIOException, E {
InputStream csvInputStream = null;
try {
csvInputStream = new FileInputStream(csvFile);
return loadCSV(csvInputStream, offset, count, filter, columnTypeMap);
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
IOUtil.closeQuietly(csvInputStream);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"<",
"E",
"extends",
"Exception",
">",
"DataSet",
"loadCSV",
"(",
"final",
"File",
"csvFile",
",",
"final",
"long",
"offset",
",",
"final",
"long",
"count",
",",
"final",
"Try",
".",
"P... | Load the data from CSV.
@param csvFile
@param offset
@param count
@param filter
@param columnTypeMap
@return | [
"Load",
"the",
"data",
"from",
"CSV",
".",
"@param",
"csvFile",
"@param",
"offset",
"@param",
"count",
"@param",
"filter",
"@param",
"columnTypeMap"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CSVUtil.java#L404-L418 |
google/closure-compiler | src/com/google/javascript/jscomp/PeepholeMinimizeConditions.java | PeepholeMinimizeConditions.maybeReplaceChildWithNumber | private Node maybeReplaceChildWithNumber(Node n, Node parent, int num) {
Node newNode = IR.number(num);
if (!newNode.isEquivalentTo(n)) {
parent.replaceChild(n, newNode);
reportChangeToEnclosingScope(newNode);
markFunctionsDeleted(n);
return newNode;
}
return n;
} | java | private Node maybeReplaceChildWithNumber(Node n, Node parent, int num) {
Node newNode = IR.number(num);
if (!newNode.isEquivalentTo(n)) {
parent.replaceChild(n, newNode);
reportChangeToEnclosingScope(newNode);
markFunctionsDeleted(n);
return newNode;
}
return n;
} | [
"private",
"Node",
"maybeReplaceChildWithNumber",
"(",
"Node",
"n",
",",
"Node",
"parent",
",",
"int",
"num",
")",
"{",
"Node",
"newNode",
"=",
"IR",
".",
"number",
"(",
"num",
")",
";",
"if",
"(",
"!",
"newNode",
".",
"isEquivalentTo",
"(",
"n",
")",
... | Replaces a node with a number node if the new number node is not equivalent
to the current node.
Returns the replacement for n if it was replaced, otherwise returns n. | [
"Replaces",
"a",
"node",
"with",
"a",
"number",
"node",
"if",
"the",
"new",
"number",
"node",
"is",
"not",
"equivalent",
"to",
"the",
"current",
"node",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PeepholeMinimizeConditions.java#L1140-L1151 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java | LiveEventsInner.resetAsync | public Observable<Void> resetAsync(String resourceGroupName, String accountName, String liveEventName) {
return resetWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> resetAsync(String resourceGroupName, String accountName, String liveEventName) {
return resetWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"resetAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"liveEventName",
")",
"{",
"return",
"resetWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"liveEvent... | Reset Live Event.
Resets an existing Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Reset",
"Live",
"Event",
".",
"Resets",
"an",
"existing",
"Live",
"Event",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L1684-L1691 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/RegularFile.java | RegularFile.get | private static int get(byte[] block, int offset, ByteBuffer buf, int len) {
buf.put(block, offset, len);
return len;
} | java | private static int get(byte[] block, int offset, ByteBuffer buf, int len) {
buf.put(block, offset, len);
return len;
} | [
"private",
"static",
"int",
"get",
"(",
"byte",
"[",
"]",
"block",
",",
"int",
"offset",
",",
"ByteBuffer",
"buf",
",",
"int",
"len",
")",
"{",
"buf",
".",
"put",
"(",
"block",
",",
"offset",
",",
"len",
")",
";",
"return",
"len",
";",
"}"
] | Reads len bytes starting at the given offset in the given block into the given byte buffer. | [
"Reads",
"len",
"bytes",
"starting",
"at",
"the",
"given",
"offset",
"in",
"the",
"given",
"block",
"into",
"the",
"given",
"byte",
"buffer",
"."
] | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/RegularFile.java#L657-L660 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java | XNodeSet.notEquals | public boolean notEquals(XObject obj2) throws javax.xml.transform.TransformerException
{
return compare(obj2, S_NEQ);
} | java | public boolean notEquals(XObject obj2) throws javax.xml.transform.TransformerException
{
return compare(obj2, S_NEQ);
} | [
"public",
"boolean",
"notEquals",
"(",
"XObject",
"obj2",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"return",
"compare",
"(",
"obj2",
",",
"S_NEQ",
")",
";",
"}"
] | Tell if two objects are functionally not equal.
@param obj2 object to compare this nodeset to
@return see this.compare(...)
@throws javax.xml.transform.TransformerException | [
"Tell",
"if",
"two",
"objects",
"are",
"functionally",
"not",
"equal",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L722-L725 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.notNullAndEquals | public static <T> T notNullAndEquals (final T aValue, final String sName, @Nonnull final T aExpectedValue)
{
if (isEnabled ())
return notNullAndEquals (aValue, () -> sName, aExpectedValue);
return aValue;
} | java | public static <T> T notNullAndEquals (final T aValue, final String sName, @Nonnull final T aExpectedValue)
{
if (isEnabled ())
return notNullAndEquals (aValue, () -> sName, aExpectedValue);
return aValue;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"notNullAndEquals",
"(",
"final",
"T",
"aValue",
",",
"final",
"String",
"sName",
",",
"@",
"Nonnull",
"final",
"T",
"aExpectedValue",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"return",
"notNullAndEquals",
... | Check that the passed value is not <code>null</code> and equal to the
provided expected value.
@param <T>
Type to be checked and returned
@param aValue
The value to check.
@param sName
The name of the value (e.g. the parameter name)
@param aExpectedValue
The expected value. May not be <code>null</code>.
@return The passed value.
@throws IllegalArgumentException
if the passed value is not <code>null</code>. | [
"Check",
"that",
"the",
"passed",
"value",
"is",
"not",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"equal",
"to",
"the",
"provided",
"expected",
"value",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L1370-L1375 |
LAW-Unimi/BUbiNG | src/it/unimi/di/law/warc/io/gzarc/GZIPIndexer.java | GZIPIndexer.index | public static LongBigArrayBigList index(final InputStream in, final ProgressLogger pl) throws IOException {
final LongBigArrayBigList pointers = new LongBigArrayBigList();
long current = 0;
final GZIPArchiveReader gzar = new GZIPArchiveReader(in);
GZIPArchive.ReadEntry re;
for (;;) {
re = gzar.skipEntry();
if (re == null) break;
pointers.add(current);
current += re.compressedSkipLength;
if (pl != null) pl.lightUpdate();
}
in.close();
return pointers;
} | java | public static LongBigArrayBigList index(final InputStream in, final ProgressLogger pl) throws IOException {
final LongBigArrayBigList pointers = new LongBigArrayBigList();
long current = 0;
final GZIPArchiveReader gzar = new GZIPArchiveReader(in);
GZIPArchive.ReadEntry re;
for (;;) {
re = gzar.skipEntry();
if (re == null) break;
pointers.add(current);
current += re.compressedSkipLength;
if (pl != null) pl.lightUpdate();
}
in.close();
return pointers;
} | [
"public",
"static",
"LongBigArrayBigList",
"index",
"(",
"final",
"InputStream",
"in",
",",
"final",
"ProgressLogger",
"pl",
")",
"throws",
"IOException",
"{",
"final",
"LongBigArrayBigList",
"pointers",
"=",
"new",
"LongBigArrayBigList",
"(",
")",
";",
"long",
"c... | Returns a list of pointers to a GZIP archive entries positions (including the end of file).
@param in the stream from which to read the GZIP archive.
@param pl a progress logger.
@return a list of longs where the <em>i</em>-th long is the offset in the stream of the first byte of the <em>i</em>-th archive entry. | [
"Returns",
"a",
"list",
"of",
"pointers",
"to",
"a",
"GZIP",
"archive",
"entries",
"positions",
"(",
"including",
"the",
"end",
"of",
"file",
")",
"."
] | train | https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/io/gzarc/GZIPIndexer.java#L62-L76 |
aws/aws-sdk-java | aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/AffectedEntity.java | AffectedEntity.withTags | public AffectedEntity withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public AffectedEntity withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"AffectedEntity",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map of entity tags attached to the affected entity.
</p>
@param tags
A map of entity tags attached to the affected entity.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"of",
"entity",
"tags",
"attached",
"to",
"the",
"affected",
"entity",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/AffectedEntity.java#L456-L459 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Fraction.java | Fraction.of | public static Fraction of(String str) {
if (str == null) {
throw new IllegalArgumentException("The string must not be null");
}
// parse double format
int pos = str.indexOf('.');
if (pos >= 0) {
return of(Double.parseDouble(str));
}
// parse X Y/Z format
pos = str.indexOf(' ');
if (pos > 0) {
final int whole = Integer.parseInt(str.substring(0, pos));
str = str.substring(pos + 1);
pos = str.indexOf('/');
if (pos < 0) {
throw new NumberFormatException("The fraction could not be parsed as the format X Y/Z");
} else {
final int numer = Integer.parseInt(str.substring(0, pos));
final int denom = Integer.parseInt(str.substring(pos + 1));
return of(whole, numer, denom);
}
}
// parse Y/Z format
pos = str.indexOf('/');
if (pos < 0) {
// simple whole number
return of(Integer.parseInt(str), 1);
} else {
final int numer = Integer.parseInt(str.substring(0, pos));
final int denom = Integer.parseInt(str.substring(pos + 1));
return of(numer, denom);
}
} | java | public static Fraction of(String str) {
if (str == null) {
throw new IllegalArgumentException("The string must not be null");
}
// parse double format
int pos = str.indexOf('.');
if (pos >= 0) {
return of(Double.parseDouble(str));
}
// parse X Y/Z format
pos = str.indexOf(' ');
if (pos > 0) {
final int whole = Integer.parseInt(str.substring(0, pos));
str = str.substring(pos + 1);
pos = str.indexOf('/');
if (pos < 0) {
throw new NumberFormatException("The fraction could not be parsed as the format X Y/Z");
} else {
final int numer = Integer.parseInt(str.substring(0, pos));
final int denom = Integer.parseInt(str.substring(pos + 1));
return of(whole, numer, denom);
}
}
// parse Y/Z format
pos = str.indexOf('/');
if (pos < 0) {
// simple whole number
return of(Integer.parseInt(str), 1);
} else {
final int numer = Integer.parseInt(str.substring(0, pos));
final int denom = Integer.parseInt(str.substring(pos + 1));
return of(numer, denom);
}
} | [
"public",
"static",
"Fraction",
"of",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The string must not be null\"",
")",
";",
"}",
"// parse double format",
"int",
"pos",
"=",
"str... | <p>
Creates a Fraction from a <code>String</code>.
</p>
<p>
The formats accepted are:
</p>
<ol>
<li><code>double</code> String containing a dot</li>
<li>'X Y/Z'</li>
<li>'Y/Z'</li>
<li>'X' (a simple whole number)</li>
</ol>
<p>
and a .
</p>
@param str
the string to parse, must not be <code>null</code>
@return the new <code>Fraction</code> instance
@throws IllegalArgumentException
if the string is <code>null</code>
@throws NumberFormatException
if the number format is invalid | [
"<p",
">",
"Creates",
"a",
"Fraction",
"from",
"a",
"<code",
">",
"String<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Fraction.java#L366-L401 |
samskivert/samskivert | src/main/java/com/samskivert/util/QuickSort.java | QuickSort.rsort | public static <T> void rsort (List<T> a, Comparator<? super T> comp)
{
sort(a, Collections.reverseOrder(comp));
} | java | public static <T> void rsort (List<T> a, Comparator<? super T> comp)
{
sort(a, Collections.reverseOrder(comp));
} | [
"public",
"static",
"<",
"T",
">",
"void",
"rsort",
"(",
"List",
"<",
"T",
">",
"a",
",",
"Comparator",
"<",
"?",
"super",
"T",
">",
"comp",
")",
"{",
"sort",
"(",
"a",
",",
"Collections",
".",
"reverseOrder",
"(",
"comp",
")",
")",
";",
"}"
] | Sort the elements in the specified List according to the reverse ordering imposed by the
specified Comparator. | [
"Sort",
"the",
"elements",
"in",
"the",
"specified",
"List",
"according",
"to",
"the",
"reverse",
"ordering",
"imposed",
"by",
"the",
"specified",
"Comparator",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/QuickSort.java#L354-L357 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_arp_ipBlocked_unblock_POST | public void ip_arp_ipBlocked_unblock_POST(String ip, String ipBlocked) throws IOException {
String qPath = "/ip/{ip}/arp/{ipBlocked}/unblock";
StringBuilder sb = path(qPath, ip, ipBlocked);
exec(qPath, "POST", sb.toString(), null);
} | java | public void ip_arp_ipBlocked_unblock_POST(String ip, String ipBlocked) throws IOException {
String qPath = "/ip/{ip}/arp/{ipBlocked}/unblock";
StringBuilder sb = path(qPath, ip, ipBlocked);
exec(qPath, "POST", sb.toString(), null);
} | [
"public",
"void",
"ip_arp_ipBlocked_unblock_POST",
"(",
"String",
"ip",
",",
"String",
"ipBlocked",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/arp/{ipBlocked}/unblock\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
... | Unblock this IP
REST: POST /ip/{ip}/arp/{ipBlocked}/unblock
@param ip [required]
@param ipBlocked [required] your IP | [
"Unblock",
"this",
"IP"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L286-L290 |
apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.inferReturnTypeGenerics | protected ClassNode inferReturnTypeGenerics(ClassNode receiver, MethodNode method, Expression arguments) {
return inferReturnTypeGenerics(receiver, method, arguments, null);
} | java | protected ClassNode inferReturnTypeGenerics(ClassNode receiver, MethodNode method, Expression arguments) {
return inferReturnTypeGenerics(receiver, method, arguments, null);
} | [
"protected",
"ClassNode",
"inferReturnTypeGenerics",
"(",
"ClassNode",
"receiver",
",",
"MethodNode",
"method",
",",
"Expression",
"arguments",
")",
"{",
"return",
"inferReturnTypeGenerics",
"(",
"receiver",
",",
"method",
",",
"arguments",
",",
"null",
")",
";",
... | If a method call returns a parameterized type, then we can perform additional inference on the
return type, so that the type gets actual type parameters. For example, the method
Arrays.asList(T...) is generified with type T which can be deduced from actual type
arguments.
@param method the method node
@param arguments the method call arguments
@return parameterized, infered, class node | [
"If",
"a",
"method",
"call",
"returns",
"a",
"parameterized",
"type",
"then",
"we",
"can",
"perform",
"additional",
"inference",
"on",
"the",
"return",
"type",
"so",
"that",
"the",
"type",
"gets",
"actual",
"type",
"parameters",
".",
"For",
"example",
"the",... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L5204-L5206 |
OpenFeign/feign | core/src/main/java/feign/Request.java | Request.create | public static Request create(HttpMethod httpMethod,
String url,
Map<String, Collection<String>> headers,
Body body) {
return new Request(httpMethod, url, headers, body);
} | java | public static Request create(HttpMethod httpMethod,
String url,
Map<String, Collection<String>> headers,
Body body) {
return new Request(httpMethod, url, headers, body);
} | [
"public",
"static",
"Request",
"create",
"(",
"HttpMethod",
"httpMethod",
",",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"Collection",
"<",
"String",
">",
">",
"headers",
",",
"Body",
"body",
")",
"{",
"return",
"new",
"Request",
"(",
"httpMethod",
... | Builds a Request. All parameters must be effectively immutable, via safe copies.
@param httpMethod for the request.
@param url for the request.
@param headers to include.
@param body of the request, can be {@literal null}
@return a Request | [
"Builds",
"a",
"Request",
".",
"All",
"parameters",
"must",
"be",
"effectively",
"immutable",
"via",
"safe",
"copies",
"."
] | train | https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/Request.java#L134-L139 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneId.java | ZoneId.getDisplayName | public String getDisplayName(TextStyle style, Locale locale) {
return new DateTimeFormatterBuilder().appendZoneText(style).toFormatter(locale).format(toTemporal());
} | java | public String getDisplayName(TextStyle style, Locale locale) {
return new DateTimeFormatterBuilder().appendZoneText(style).toFormatter(locale).format(toTemporal());
} | [
"public",
"String",
"getDisplayName",
"(",
"TextStyle",
"style",
",",
"Locale",
"locale",
")",
"{",
"return",
"new",
"DateTimeFormatterBuilder",
"(",
")",
".",
"appendZoneText",
"(",
"style",
")",
".",
"toFormatter",
"(",
"locale",
")",
".",
"format",
"(",
"... | Gets the textual representation of the zone, such as 'British Time' or
'+02:00'.
<p>
This returns the textual name used to identify the time-zone ID,
suitable for presentation to the user.
The parameters control the style of the returned text and the locale.
<p>
If no textual mapping is found then the {@link #getId() full ID} is returned.
@param style the length of the text required, not null
@param locale the locale to use, not null
@return the text value of the zone, not null | [
"Gets",
"the",
"textual",
"representation",
"of",
"the",
"zone",
"such",
"as",
"British",
"Time",
"or",
"+",
"02",
":",
"00",
".",
"<p",
">",
"This",
"returns",
"the",
"textual",
"name",
"used",
"to",
"identify",
"the",
"time",
"-",
"zone",
"ID",
"suit... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneId.java#L515-L517 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/SparseMatrix.java | SparseMatrix.nonZeroRowMajorIterator | public RowMajorMatrixIterator nonZeroRowMajorIterator() {
return new RowMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private long i = -1;
@Override
public int rowIndex() {
return (int) (i / columns);
}
@Override
public int columnIndex() {
return (int) (i - ((i / columns) * columns));
}
@Override
public double get() {
return SparseMatrix.this.get(rowIndex(), columnIndex());
}
@Override
public void set(double value) {
SparseMatrix.this.set(rowIndex(), columnIndex(), value);
}
@Override
public boolean hasNext() {
while (i + 1 < limit) {
i++;
if (SparseMatrix.this.nonZeroAt(rowIndex(), columnIndex())) {
i--;
break;
}
}
return i + 1 < limit;
}
@Override
public Double next() {
if(!hasNext()) {
throw new NoSuchElementException();
}
i++;
return get();
}
};
} | java | public RowMajorMatrixIterator nonZeroRowMajorIterator() {
return new RowMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private long i = -1;
@Override
public int rowIndex() {
return (int) (i / columns);
}
@Override
public int columnIndex() {
return (int) (i - ((i / columns) * columns));
}
@Override
public double get() {
return SparseMatrix.this.get(rowIndex(), columnIndex());
}
@Override
public void set(double value) {
SparseMatrix.this.set(rowIndex(), columnIndex(), value);
}
@Override
public boolean hasNext() {
while (i + 1 < limit) {
i++;
if (SparseMatrix.this.nonZeroAt(rowIndex(), columnIndex())) {
i--;
break;
}
}
return i + 1 < limit;
}
@Override
public Double next() {
if(!hasNext()) {
throw new NoSuchElementException();
}
i++;
return get();
}
};
} | [
"public",
"RowMajorMatrixIterator",
"nonZeroRowMajorIterator",
"(",
")",
"{",
"return",
"new",
"RowMajorMatrixIterator",
"(",
"rows",
",",
"columns",
")",
"{",
"private",
"long",
"limit",
"=",
"(",
"long",
")",
"rows",
"*",
"columns",
";",
"private",
"long",
"... | Returns a non-zero row-major matrix iterator.
@return a non-zero row-major matrix iterator. | [
"Returns",
"a",
"non",
"-",
"zero",
"row",
"-",
"major",
"matrix",
"iterator",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/SparseMatrix.java#L419-L466 |
easymock/objenesis | main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java | ClassDefinitionUtils.writeClass | public static void writeClass(String fileName, byte[] bytes) throws IOException {
try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) {
out.write(bytes);
}
} | java | public static void writeClass(String fileName, byte[] bytes) throws IOException {
try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) {
out.write(bytes);
}
} | [
"public",
"static",
"void",
"writeClass",
"(",
"String",
"fileName",
",",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
"{",
"try",
"(",
"BufferedOutputStream",
"out",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"fileName"... | Write all class bytes to a file.
@param fileName file where the bytes will be written
@param bytes bytes representing the class
@throws IOException if we fail to write the class | [
"Write",
"all",
"class",
"bytes",
"to",
"a",
"file",
"."
] | train | https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java#L133-L137 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/chart/CcgBeamSearchChart.java | CcgBeamSearchChart.offerEntry | private final void offerEntry(ChartEntry entry, double probability, int spanStart, int spanEnd) {
HeapUtils.offer(chart[spanStart][spanEnd], probabilities[spanStart][spanEnd],
chartSizes[spanEnd + (numTerminals * spanStart)], entry, probability);
chartSizes[spanEnd + (numTerminals * spanStart)]++;
totalChartSize++;
if (chartSizes[spanEnd + (numTerminals * spanStart)] > beamSize) {
HeapUtils.removeMin(chart[spanStart][spanEnd], probabilities[spanStart][spanEnd],
chartSizes[spanEnd + (numTerminals * spanStart)]);
chartSizes[spanEnd + (numTerminals * spanStart)]--;
totalChartSize--;
}
} | java | private final void offerEntry(ChartEntry entry, double probability, int spanStart, int spanEnd) {
HeapUtils.offer(chart[spanStart][spanEnd], probabilities[spanStart][spanEnd],
chartSizes[spanEnd + (numTerminals * spanStart)], entry, probability);
chartSizes[spanEnd + (numTerminals * spanStart)]++;
totalChartSize++;
if (chartSizes[spanEnd + (numTerminals * spanStart)] > beamSize) {
HeapUtils.removeMin(chart[spanStart][spanEnd], probabilities[spanStart][spanEnd],
chartSizes[spanEnd + (numTerminals * spanStart)]);
chartSizes[spanEnd + (numTerminals * spanStart)]--;
totalChartSize--;
}
} | [
"private",
"final",
"void",
"offerEntry",
"(",
"ChartEntry",
"entry",
",",
"double",
"probability",
",",
"int",
"spanStart",
",",
"int",
"spanEnd",
")",
"{",
"HeapUtils",
".",
"offer",
"(",
"chart",
"[",
"spanStart",
"]",
"[",
"spanEnd",
"]",
",",
"probabi... | Adds a chart entry to the heap for {@code spanStart} to
{@code spanEnd}. This operation implements beam truncation by
discarding the minimum probability entry when a heap reaches the
beam size. | [
"Adds",
"a",
"chart",
"entry",
"to",
"the",
"heap",
"for",
"{"
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/chart/CcgBeamSearchChart.java#L214-L226 |
trellis-ldp/trellis | components/webdav/src/main/java/org/trellisldp/webdav/TrellisWebDAV.java | TrellisWebDAV.moveResource | @MOVE
@Timed
public void moveResource(@Suspended final AsyncResponse response, @Context final Request request,
@Context final UriInfo uriInfo, @Context final HttpHeaders headers,
@Context final SecurityContext security) {
final TrellisRequest req = new TrellisRequest(request, uriInfo, headers, security);
final String baseUrl = getBaseUrl(req);
final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath());
final IRI destination = getDestination(headers, baseUrl);
final Session session = getSession(req.getPrincipalName());
getParent(destination)
.thenCombine(services.getResourceService().get(destination), this::checkResources)
.thenCompose(parent -> services.getResourceService().touch(parent.getIdentifier()))
.thenCompose(future -> services.getResourceService().get(identifier))
.thenApply(this::checkResource)
// Note: all MOVE operations are recursive (Depth: infinity), hence recursiveCopy
.thenAccept(res -> recursiveCopy(services, session, res, destination, baseUrl))
.thenAccept(future -> recursiveDelete(services, session, identifier, baseUrl))
.thenCompose(future -> services.getResourceService().delete(Metadata.builder(identifier)
.interactionModel(LDP.Resource).build()))
.thenCompose(future -> {
final TrellisDataset immutable = TrellisDataset.createDataset();
services.getAuditService().creation(identifier, session).stream()
.map(skolemizeQuads(services.getResourceService(), baseUrl)).forEachOrdered(immutable::add);
return services.getResourceService().add(identifier, immutable.asDataset())
.whenComplete((a, b) -> immutable.close());
})
.thenAccept(future -> services.getEventService().emit(new SimpleEvent(externalUrl(identifier,
baseUrl), session.getAgent(), asList(PROV.Activity, AS.Delete), singletonList(LDP.Resource))))
.thenApply(future -> status(NO_CONTENT).build())
.exceptionally(this::handleException).thenApply(response::resume);
} | java | @MOVE
@Timed
public void moveResource(@Suspended final AsyncResponse response, @Context final Request request,
@Context final UriInfo uriInfo, @Context final HttpHeaders headers,
@Context final SecurityContext security) {
final TrellisRequest req = new TrellisRequest(request, uriInfo, headers, security);
final String baseUrl = getBaseUrl(req);
final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath());
final IRI destination = getDestination(headers, baseUrl);
final Session session = getSession(req.getPrincipalName());
getParent(destination)
.thenCombine(services.getResourceService().get(destination), this::checkResources)
.thenCompose(parent -> services.getResourceService().touch(parent.getIdentifier()))
.thenCompose(future -> services.getResourceService().get(identifier))
.thenApply(this::checkResource)
// Note: all MOVE operations are recursive (Depth: infinity), hence recursiveCopy
.thenAccept(res -> recursiveCopy(services, session, res, destination, baseUrl))
.thenAccept(future -> recursiveDelete(services, session, identifier, baseUrl))
.thenCompose(future -> services.getResourceService().delete(Metadata.builder(identifier)
.interactionModel(LDP.Resource).build()))
.thenCompose(future -> {
final TrellisDataset immutable = TrellisDataset.createDataset();
services.getAuditService().creation(identifier, session).stream()
.map(skolemizeQuads(services.getResourceService(), baseUrl)).forEachOrdered(immutable::add);
return services.getResourceService().add(identifier, immutable.asDataset())
.whenComplete((a, b) -> immutable.close());
})
.thenAccept(future -> services.getEventService().emit(new SimpleEvent(externalUrl(identifier,
baseUrl), session.getAgent(), asList(PROV.Activity, AS.Delete), singletonList(LDP.Resource))))
.thenApply(future -> status(NO_CONTENT).build())
.exceptionally(this::handleException).thenApply(response::resume);
} | [
"@",
"MOVE",
"@",
"Timed",
"public",
"void",
"moveResource",
"(",
"@",
"Suspended",
"final",
"AsyncResponse",
"response",
",",
"@",
"Context",
"final",
"Request",
"request",
",",
"@",
"Context",
"final",
"UriInfo",
"uriInfo",
",",
"@",
"Context",
"final",
"H... | Move a resource.
@param response the async response
@param request the request
@param uriInfo the URI info
@param headers the headers
@param security the security context | [
"Move",
"a",
"resource",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/components/webdav/src/main/java/org/trellisldp/webdav/TrellisWebDAV.java#L195-L227 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java | MDAG.getStrings | private void getStrings(HashSet<String> strHashSet, SearchCondition searchCondition, String searchConditionString, String prefixString, TreeMap<Character, MDAGNode> transitionTreeMap)
{
//Traverse all the valid _transition paths beginning from each _transition in transitionTreeMap, inserting the
//corresponding Strings in to strHashSet that have the relationship with conditionString denoted by searchCondition
for (Entry<Character, MDAGNode> transitionKeyValuePair : transitionTreeMap.entrySet())
{
String newPrefixString = prefixString + transitionKeyValuePair.getKey();
MDAGNode currentNode = transitionKeyValuePair.getValue();
if (currentNode.isAcceptNode() && searchCondition.satisfiesCondition(newPrefixString, searchConditionString))
strHashSet.add(newPrefixString);
//Recursively call this to traverse all the valid _transition paths from currentNode
getStrings(strHashSet, searchCondition, searchConditionString, newPrefixString, currentNode.getOutgoingTransitions());
}
/////
} | java | private void getStrings(HashSet<String> strHashSet, SearchCondition searchCondition, String searchConditionString, String prefixString, TreeMap<Character, MDAGNode> transitionTreeMap)
{
//Traverse all the valid _transition paths beginning from each _transition in transitionTreeMap, inserting the
//corresponding Strings in to strHashSet that have the relationship with conditionString denoted by searchCondition
for (Entry<Character, MDAGNode> transitionKeyValuePair : transitionTreeMap.entrySet())
{
String newPrefixString = prefixString + transitionKeyValuePair.getKey();
MDAGNode currentNode = transitionKeyValuePair.getValue();
if (currentNode.isAcceptNode() && searchCondition.satisfiesCondition(newPrefixString, searchConditionString))
strHashSet.add(newPrefixString);
//Recursively call this to traverse all the valid _transition paths from currentNode
getStrings(strHashSet, searchCondition, searchConditionString, newPrefixString, currentNode.getOutgoingTransitions());
}
/////
} | [
"private",
"void",
"getStrings",
"(",
"HashSet",
"<",
"String",
">",
"strHashSet",
",",
"SearchCondition",
"searchCondition",
",",
"String",
"searchConditionString",
",",
"String",
"prefixString",
",",
"TreeMap",
"<",
"Character",
",",
"MDAGNode",
">",
"transitionTr... | Retrieves Strings corresponding to all valid _transition paths from a given node that satisfy a given condition.
@param strHashSet a HashSet of Strings to contain all those in the MDAG satisfying
{@code searchCondition} with {@code conditionString}
@param searchCondition the SearchCondition enum field describing the type of relationship that Strings contained in the MDAG
must have with {@code conditionString} in order to be included in the result set
@param searchConditionString the String that all Strings in the MDAG must be related with in the fashion denoted
by {@code searchCondition} in order to be included in the result set
@param prefixString the String corresponding to the currently traversed _transition path
@param transitionTreeMap a TreeMap of Characters to MDAGNodes collectively representing an MDAGNode's _transition set | [
"Retrieves",
"Strings",
"corresponding",
"to",
"all",
"valid",
"_transition",
"paths",
"from",
"a",
"given",
"node",
"that",
"satisfy",
"a",
"given",
"condition",
"."
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L861-L877 |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java | HostControllerEnvironment.getFileFromProperty | private File getFileFromProperty(final String name) {
String value = hostSystemProperties.get(name);
File result = (value != null) ? new File(value) : null;
// AS7-1752 see if a non-existent relative path exists relative to the home dir
if (result != null && homeDir != null && !result.exists() && !result.isAbsolute()) {
File relative = new File(homeDir, value);
if (relative.exists()) {
result = relative;
}
}
return result;
} | java | private File getFileFromProperty(final String name) {
String value = hostSystemProperties.get(name);
File result = (value != null) ? new File(value) : null;
// AS7-1752 see if a non-existent relative path exists relative to the home dir
if (result != null && homeDir != null && !result.exists() && !result.isAbsolute()) {
File relative = new File(homeDir, value);
if (relative.exists()) {
result = relative;
}
}
return result;
} | [
"private",
"File",
"getFileFromProperty",
"(",
"final",
"String",
"name",
")",
"{",
"String",
"value",
"=",
"hostSystemProperties",
".",
"get",
"(",
"name",
")",
";",
"File",
"result",
"=",
"(",
"value",
"!=",
"null",
")",
"?",
"new",
"File",
"(",
"value... | Get a File from configuration.
@param name the name of the property
@return the CanonicalFile form for the given name. | [
"Get",
"a",
"File",
"from",
"configuration",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java#L839-L850 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/face/AipFace.java | AipFace.search | public JSONObject search(String image, String imageType, String groupIdList, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("image", image);
request.addBody("image_type", imageType);
request.addBody("group_id_list", groupIdList);
if (options != null) {
request.addBody(options);
}
request.setUri(FaceConsts.SEARCH);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} | java | public JSONObject search(String image, String imageType, String groupIdList, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("image", image);
request.addBody("image_type", imageType);
request.addBody("group_id_list", groupIdList);
if (options != null) {
request.addBody(options);
}
request.setUri(FaceConsts.SEARCH);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"search",
"(",
"String",
"image",
",",
"String",
"imageType",
",",
"String",
"groupIdList",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"p... | 人脸搜索接口
@param image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断
@param imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个
@param groupIdList - 从指定的group中进行查找 用逗号分隔,**上限20个**
@param options - 可选参数对象,key: value都为string类型
options - options列表:
quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE**
liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE**
user_id 当需要对特定用户进行比对时,指定user_id进行比对。即人脸认证功能。
max_user_num 查找后返回的用户数量。返回相似度最高的几个用户,默认为1,最多返回20个。
@return JSONObject | [
"人脸搜索接口"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/face/AipFace.java#L77-L93 |
Impetus/Kundera | src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java | HibernateClient.getFromClause | private String getFromClause(String schemaName, String tableName)
{
String clause = tableName;
if (schemaName != null && !schemaName.isEmpty())
{
clause = schemaName + "." + tableName;
}
return clause;
} | java | private String getFromClause(String schemaName, String tableName)
{
String clause = tableName;
if (schemaName != null && !schemaName.isEmpty())
{
clause = schemaName + "." + tableName;
}
return clause;
} | [
"private",
"String",
"getFromClause",
"(",
"String",
"schemaName",
",",
"String",
"tableName",
")",
"{",
"String",
"clause",
"=",
"tableName",
";",
"if",
"(",
"schemaName",
"!=",
"null",
"&&",
"!",
"schemaName",
".",
"isEmpty",
"(",
")",
")",
"{",
"clause"... | Gets the from clause.
@param schemaName
the schema name
@param tableName
the table name
@return the from clause | [
"Gets",
"the",
"from",
"clause",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java#L791-L799 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/overview/OverviewPlot.java | OverviewPlot.triggerSubplotSelectEvent | protected void triggerSubplotSelectEvent(PlotItem it) {
// forward event to all listeners.
for(ActionListener actionListener : actionListeners) {
actionListener.actionPerformed(new DetailViewSelectedEvent(this, ActionEvent.ACTION_PERFORMED, null, 0, it));
}
} | java | protected void triggerSubplotSelectEvent(PlotItem it) {
// forward event to all listeners.
for(ActionListener actionListener : actionListeners) {
actionListener.actionPerformed(new DetailViewSelectedEvent(this, ActionEvent.ACTION_PERFORMED, null, 0, it));
}
} | [
"protected",
"void",
"triggerSubplotSelectEvent",
"(",
"PlotItem",
"it",
")",
"{",
"// forward event to all listeners.",
"for",
"(",
"ActionListener",
"actionListener",
":",
"actionListeners",
")",
"{",
"actionListener",
".",
"actionPerformed",
"(",
"new",
"DetailViewSele... | When a subplot was selected, forward the event to listeners.
@param it PlotItem selected | [
"When",
"a",
"subplot",
"was",
"selected",
"forward",
"the",
"event",
"to",
"listeners",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/overview/OverviewPlot.java#L523-L528 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java | CitrusAnnotations.injectAll | public static final void injectAll(final Object target, final Citrus citrusFramework, final TestContext context) {
injectCitrusFramework(target, citrusFramework);
injectEndpoints(target, context);
} | java | public static final void injectAll(final Object target, final Citrus citrusFramework, final TestContext context) {
injectCitrusFramework(target, citrusFramework);
injectEndpoints(target, context);
} | [
"public",
"static",
"final",
"void",
"injectAll",
"(",
"final",
"Object",
"target",
",",
"final",
"Citrus",
"citrusFramework",
",",
"final",
"TestContext",
"context",
")",
"{",
"injectCitrusFramework",
"(",
"target",
",",
"citrusFramework",
")",
";",
"injectEndpoi... | Injects all supported components and endpoints to target object using annotations.
@param target | [
"Injects",
"all",
"supported",
"components",
"and",
"endpoints",
"to",
"target",
"object",
"using",
"annotations",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java#L68-L71 |
datastax/java-driver | core/src/main/java/com/datastax/oss/driver/internal/core/util/ArrayUtils.java | ArrayUtils.shuffleHead | public static <ElementT> void shuffleHead(@NonNull ElementT[] elements, int n) {
shuffleHead(elements, n, ThreadLocalRandom.current());
} | java | public static <ElementT> void shuffleHead(@NonNull ElementT[] elements, int n) {
shuffleHead(elements, n, ThreadLocalRandom.current());
} | [
"public",
"static",
"<",
"ElementT",
">",
"void",
"shuffleHead",
"(",
"@",
"NonNull",
"ElementT",
"[",
"]",
"elements",
",",
"int",
"n",
")",
"{",
"shuffleHead",
"(",
"elements",
",",
"n",
",",
"ThreadLocalRandom",
".",
"current",
"(",
")",
")",
";",
"... | Shuffles the first n elements of the array in-place.
@param elements the array to shuffle.
@param n the number of elements to shuffle; must be {@code <= elements.length}.
@see <a
href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm">Modern
Fisher-Yates shuffle</a> | [
"Shuffles",
"the",
"first",
"n",
"elements",
"of",
"the",
"array",
"in",
"-",
"place",
"."
] | train | https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/internal/core/util/ArrayUtils.java#L62-L64 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java | GroupHandlerImpl.preSave | private void preSave(Group group, boolean isNew) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.preSave(group, isNew);
}
} | java | private void preSave(Group group, boolean isNew) throws Exception
{
for (GroupEventListener listener : listeners)
{
listener.preSave(group, isNew);
}
} | [
"private",
"void",
"preSave",
"(",
"Group",
"group",
",",
"boolean",
"isNew",
")",
"throws",
"Exception",
"{",
"for",
"(",
"GroupEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"preSave",
"(",
"group",
",",
"isNew",
")",
";",
"}",
... | Notifying listeners before group creation.
@param group
the group which is used in create operation
@param isNew
true, if we have a deal with new group, otherwise it is false
which mean update operation is in progress
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"before",
"group",
"creation",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L553-L559 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java | XMLAssert.assertXMLEqual | public static void assertXMLEqual(String err, Document control,
Document test) {
Diff diff = new Diff(control, test);
assertXMLEqual(err, diff, true);
} | java | public static void assertXMLEqual(String err, Document control,
Document test) {
Diff diff = new Diff(control, test);
assertXMLEqual(err, diff, true);
} | [
"public",
"static",
"void",
"assertXMLEqual",
"(",
"String",
"err",
",",
"Document",
"control",
",",
"Document",
"test",
")",
"{",
"Diff",
"diff",
"=",
"new",
"Diff",
"(",
"control",
",",
"test",
")",
";",
"assertXMLEqual",
"(",
"err",
",",
"diff",
",",
... | Assert that two XML documents are similar
@param err Message to be displayed on assertion failure
@param control XML to be compared against
@param test XML to be tested | [
"Assert",
"that",
"two",
"XML",
"documents",
"are",
"similar"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L242-L246 |
openbase/jul | communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java | AbstractRemoteClient.waitForData | @Override
public void waitForData(long timeout, TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException {
try {
if (isDataAvailable()) {
return;
}
long startTime = System.currentTimeMillis();
getDataFuture().get(timeout, timeUnit);
long partialTimeout = timeUnit.toMillis(timeout) - (System.currentTimeMillis() - startTime);
if (partialTimeout <= 0) {
throw new java.util.concurrent.TimeoutException("Data timeout is reached!");
}
dataObservable.waitForValue(partialTimeout, TimeUnit.MILLISECONDS);
} catch (java.util.concurrent.TimeoutException | CouldNotPerformException | ExecutionException | CancellationException ex) {
if (shutdownInitiated) {
throw new InterruptedException("Interrupt request because system shutdown was initiated!");
}
throw new NotAvailableException("Data is not yet available!", ex);
}
} | java | @Override
public void waitForData(long timeout, TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException {
try {
if (isDataAvailable()) {
return;
}
long startTime = System.currentTimeMillis();
getDataFuture().get(timeout, timeUnit);
long partialTimeout = timeUnit.toMillis(timeout) - (System.currentTimeMillis() - startTime);
if (partialTimeout <= 0) {
throw new java.util.concurrent.TimeoutException("Data timeout is reached!");
}
dataObservable.waitForValue(partialTimeout, TimeUnit.MILLISECONDS);
} catch (java.util.concurrent.TimeoutException | CouldNotPerformException | ExecutionException | CancellationException ex) {
if (shutdownInitiated) {
throw new InterruptedException("Interrupt request because system shutdown was initiated!");
}
throw new NotAvailableException("Data is not yet available!", ex);
}
} | [
"@",
"Override",
"public",
"void",
"waitForData",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"throws",
"CouldNotPerformException",
",",
"InterruptedException",
"{",
"try",
"{",
"if",
"(",
"isDataAvailable",
"(",
")",
")",
"{",
"return",
";",
"}"... | {@inheritDoc}
@param timeout {@inheritDoc}
@param timeUnit {@inheritDoc}
@throws CouldNotPerformException {@inheritDoc}
@throws java.lang.InterruptedException {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L1201-L1220 |
aboutsip/pkts | pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipMessageStreamBuilder.java | SipMessageStreamBuilder.onInit | private final State onInit(final Buffer buffer) {
try {
while (buffer.hasReadableBytes()) {
final byte b = buffer.peekByte();
if (b == SipParser.SP || b == SipParser.HTAB || b == SipParser.CR || b == SipParser.LF) {
buffer.readByte();
} else {
start = buffer.getReaderIndex();
return State.GET_INITIAL_LINE;
}
}
} catch (final IOException e) {
throw new RuntimeException("Unable to read from stream due to IOException", e);
}
return State.INIT;
} | java | private final State onInit(final Buffer buffer) {
try {
while (buffer.hasReadableBytes()) {
final byte b = buffer.peekByte();
if (b == SipParser.SP || b == SipParser.HTAB || b == SipParser.CR || b == SipParser.LF) {
buffer.readByte();
} else {
start = buffer.getReaderIndex();
return State.GET_INITIAL_LINE;
}
}
} catch (final IOException e) {
throw new RuntimeException("Unable to read from stream due to IOException", e);
}
return State.INIT;
} | [
"private",
"final",
"State",
"onInit",
"(",
"final",
"Buffer",
"buffer",
")",
"{",
"try",
"{",
"while",
"(",
"buffer",
".",
"hasReadableBytes",
"(",
")",
")",
"{",
"final",
"byte",
"b",
"=",
"buffer",
".",
"peekByte",
"(",
")",
";",
"if",
"(",
"b",
... | While in the INIT state, we are just consuming any empty space
before heading off to start parsing the initial line
@param b
@return | [
"While",
"in",
"the",
"INIT",
"state",
"we",
"are",
"just",
"consuming",
"any",
"empty",
"space",
"before",
"heading",
"off",
"to",
"start",
"parsing",
"the",
"initial",
"line"
] | train | https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipMessageStreamBuilder.java#L241-L257 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.