repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java | TupleGenerator.makeSatisfied | private boolean makeSatisfied( TestCaseDef testCase, VarTupleSet tuples, Tuple satisfyingTuple)
{
return
// Compatible tuple found?
testCase.addCompatible( satisfyingTuple) != null
// Did this tuple create an infeasible combination?
&& !testCase.isInfeasible()
// Can also we satisfy any new conditions?
&& makeSatisfied( testCase, tuples);
} | java | private boolean makeSatisfied( TestCaseDef testCase, VarTupleSet tuples, Tuple satisfyingTuple)
{
return
// Compatible tuple found?
testCase.addCompatible( satisfyingTuple) != null
// Did this tuple create an infeasible combination?
&& !testCase.isInfeasible()
// Can also we satisfy any new conditions?
&& makeSatisfied( testCase, tuples);
} | [
"private",
"boolean",
"makeSatisfied",
"(",
"TestCaseDef",
"testCase",
",",
"VarTupleSet",
"tuples",
",",
"Tuple",
"satisfyingTuple",
")",
"{",
"return",
"// Compatible tuple found?",
"testCase",
".",
"addCompatible",
"(",
"satisfyingTuple",
")",
"!=",
"null",
"// Did... | Starting with the given tuple, completes bindings to satisfy all current test case conditions,
using additional selections from the given set of tuples if necessary.
Returns true if and only if all conditions satisfied. | [
"Starting",
"with",
"the",
"given",
"tuple",
"completes",
"bindings",
"to",
"satisfy",
"all",
"current",
"test",
"case",
"conditions",
"using",
"additional",
"selections",
"from",
"the",
"given",
"set",
"of",
"tuples",
"if",
"necessary",
".",
"Returns",
"true",
... | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java#L508-L519 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java | ObjectInputStream.readFully | public void readFully(byte[] dst, int offset, int byteCount) throws IOException {
primitiveTypes.readFully(dst, offset, byteCount);
} | java | public void readFully(byte[] dst, int offset, int byteCount) throws IOException {
primitiveTypes.readFully(dst, offset, byteCount);
} | [
"public",
"void",
"readFully",
"(",
"byte",
"[",
"]",
"dst",
",",
"int",
"offset",
",",
"int",
"byteCount",
")",
"throws",
"IOException",
"{",
"primitiveTypes",
".",
"readFully",
"(",
"dst",
",",
"offset",
",",
"byteCount",
")",
";",
"}"
] | Reads {@code byteCount} bytes from the source stream into the byte array {@code dst}.
@param dst
the byte array in which to store the bytes read.
@param offset
the initial position in {@code dst} to store the bytes
read from the source stream.
@param byteCount
the number of bytes to read.
@throws EOFException
if the end of the input is reached before the read
request can be satisfied.
@throws IOException
if an error occurs while reading from the source stream. | [
"Reads",
"{",
"@code",
"byteCount",
"}",
"bytes",
"from",
"the",
"source",
"stream",
"into",
"the",
"byte",
"array",
"{",
"@code",
"dst",
"}",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectInputStream.java#L1215-L1217 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java | TableProxy.getRemoteDatabase | public RemoteDatabase getRemoteDatabase(Map<String, Object> properties) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(GET_REMOTE_DATABASE);
transport.addParam(PROPERTIES, properties);
String strRemoteDatabaseID = (String)transport.sendMessageAndGetReply();
// See if I have this one already
DatabaseProxy dbProxy = ((TaskProxy)this.getParentProxy()).getDatabaseProxy(strRemoteDatabaseID);
if (dbProxy == null)
dbProxy = new DatabaseProxy((TaskProxy)this.getParentProxy(), strRemoteDatabaseID); // This will add it to my list
return dbProxy;
} | java | public RemoteDatabase getRemoteDatabase(Map<String, Object> properties) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(GET_REMOTE_DATABASE);
transport.addParam(PROPERTIES, properties);
String strRemoteDatabaseID = (String)transport.sendMessageAndGetReply();
// See if I have this one already
DatabaseProxy dbProxy = ((TaskProxy)this.getParentProxy()).getDatabaseProxy(strRemoteDatabaseID);
if (dbProxy == null)
dbProxy = new DatabaseProxy((TaskProxy)this.getParentProxy(), strRemoteDatabaseID); // This will add it to my list
return dbProxy;
} | [
"public",
"RemoteDatabase",
"getRemoteDatabase",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"RemoteException",
"{",
"BaseTransport",
"transport",
"=",
"this",
".",
"createProxyTransport",
"(",
"GET_REMOTE_DATABASE",
")",
";",
"transp... | Get/Make this remote database session for this table session.
@param properties The client database properties (Typically for transaction support). | [
"Get",
"/",
"Make",
"this",
"remote",
"database",
"session",
"for",
"this",
"table",
"session",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java#L278-L288 |
airbnb/lottie-android | lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java | LottieDrawable.setMaxProgress | public void setMaxProgress(@FloatRange(from = 0f, to = 1f) final float maxProgress) {
if (composition == null) {
lazyCompositionTasks.add(new LazyCompositionTask() {
@Override
public void run(LottieComposition composition) {
setMaxProgress(maxProgress);
}
});
return;
}
setMaxFrame((int) MiscUtils.lerp(composition.getStartFrame(), composition.getEndFrame(), maxProgress));
} | java | public void setMaxProgress(@FloatRange(from = 0f, to = 1f) final float maxProgress) {
if (composition == null) {
lazyCompositionTasks.add(new LazyCompositionTask() {
@Override
public void run(LottieComposition composition) {
setMaxProgress(maxProgress);
}
});
return;
}
setMaxFrame((int) MiscUtils.lerp(composition.getStartFrame(), composition.getEndFrame(), maxProgress));
} | [
"public",
"void",
"setMaxProgress",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"0f",
",",
"to",
"=",
"1f",
")",
"final",
"float",
"maxProgress",
")",
"{",
"if",
"(",
"composition",
"==",
"null",
")",
"{",
"lazyCompositionTasks",
".",
"add",
"(",
"new",
... | Sets the maximum progress that the animation will end at when playing or looping. | [
"Sets",
"the",
"maximum",
"progress",
"that",
"the",
"animation",
"will",
"end",
"at",
"when",
"playing",
"or",
"looping",
"."
] | train | https://github.com/airbnb/lottie-android/blob/126dabdc9f586c87822f85fe1128cdad439d30fa/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java#L477-L488 |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getRange | public IntegerRanges getRange(String name, String defaultValue) {
return new IntegerRanges(get(name, defaultValue));
} | java | public IntegerRanges getRange(String name, String defaultValue) {
return new IntegerRanges(get(name, defaultValue));
} | [
"public",
"IntegerRanges",
"getRange",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"return",
"new",
"IntegerRanges",
"(",
"get",
"(",
"name",
",",
"defaultValue",
")",
")",
";",
"}"
] | Parse the given attribute as a set of integer ranges
@param name the attribute name
@param defaultValue the default value if it is not set
@return a new set of ranges from the configured value | [
"Parse",
"the",
"given",
"attribute",
"as",
"a",
"set",
"of",
"integer",
"ranges"
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2033-L2035 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/domain/mapping/MappingUtil.java | MappingUtil.fromType | public static JcPrimitive fromType(Class<?> type, String name) {
// TODO what about dates and arrays
if (type.equals(String.class))
return new JcString(name);
else if (type.equals(Number.class))
return new JcNumber(name);
else if (type.equals(Boolean.class))
return new JcBoolean(name);
return null;
} | java | public static JcPrimitive fromType(Class<?> type, String name) {
// TODO what about dates and arrays
if (type.equals(String.class))
return new JcString(name);
else if (type.equals(Number.class))
return new JcNumber(name);
else if (type.equals(Boolean.class))
return new JcBoolean(name);
return null;
} | [
"public",
"static",
"JcPrimitive",
"fromType",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"name",
")",
"{",
"// TODO what about dates and arrays",
"if",
"(",
"type",
".",
"equals",
"(",
"String",
".",
"class",
")",
")",
"return",
"new",
"JcString",
... | Answer an appropriate instance of a JcPrimitive for the given simple-type and name.
E.g. given a type java.lang.String, a JcString instance will be returned.
@param type
@param name
@return | [
"Answer",
"an",
"appropriate",
"instance",
"of",
"a",
"JcPrimitive",
"for",
"the",
"given",
"simple",
"-",
"type",
"and",
"name",
".",
"E",
".",
"g",
".",
"given",
"a",
"type",
"java",
".",
"lang",
".",
"String",
"a",
"JcString",
"instance",
"will",
"b... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/domain/mapping/MappingUtil.java#L234-L243 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/content/CmsXmlContentRepairDialog.java | CmsXmlContentRepairDialog.getXmlContentResourceTypes | private List getXmlContentResourceTypes() {
// get all available resource types and filter XML content resource types
List resTypes = OpenCms.getResourceManager().getResourceTypes();
Iterator i = resTypes.iterator();
List resTypeNames = new ArrayList(resTypes.size());
while (i.hasNext()) {
I_CmsResourceType resType = (I_CmsResourceType)i.next();
if (!(resType instanceof CmsResourceTypeXmlContent)) {
// this is not XML content resource type, skip it
continue;
}
if (!resType.getTypeName().equals(TYPE_XMLCONTENT)) {
resTypeNames.add(resType.getTypeName());
}
}
// create the selector options
List result = new ArrayList(resTypeNames.size() + 2);
// add empty "please select" option to selector
result.add(new CmsSelectWidgetOption("", true, key(Messages.GUI_XMLCONTENTREPAIR_DIALOG_RESTYPE_SELECT_0)));
// sort the resource type names alphabetically
Collections.sort(resTypeNames);
i = resTypeNames.iterator();
while (i.hasNext()) {
// add all resource type names to the selector
String resTypeName = (String)i.next();
result.add(new CmsSelectWidgetOption(resTypeName));
}
// add option for generic XML content without "own" resource types at the end
result.add(
new CmsSelectWidgetOption(
TYPE_XMLCONTENT,
false,
key(Messages.GUI_XMLCONTENTREPAIR_DIALOG_RESTYPE_GENERIC_0)));
return result;
} | java | private List getXmlContentResourceTypes() {
// get all available resource types and filter XML content resource types
List resTypes = OpenCms.getResourceManager().getResourceTypes();
Iterator i = resTypes.iterator();
List resTypeNames = new ArrayList(resTypes.size());
while (i.hasNext()) {
I_CmsResourceType resType = (I_CmsResourceType)i.next();
if (!(resType instanceof CmsResourceTypeXmlContent)) {
// this is not XML content resource type, skip it
continue;
}
if (!resType.getTypeName().equals(TYPE_XMLCONTENT)) {
resTypeNames.add(resType.getTypeName());
}
}
// create the selector options
List result = new ArrayList(resTypeNames.size() + 2);
// add empty "please select" option to selector
result.add(new CmsSelectWidgetOption("", true, key(Messages.GUI_XMLCONTENTREPAIR_DIALOG_RESTYPE_SELECT_0)));
// sort the resource type names alphabetically
Collections.sort(resTypeNames);
i = resTypeNames.iterator();
while (i.hasNext()) {
// add all resource type names to the selector
String resTypeName = (String)i.next();
result.add(new CmsSelectWidgetOption(resTypeName));
}
// add option for generic XML content without "own" resource types at the end
result.add(
new CmsSelectWidgetOption(
TYPE_XMLCONTENT,
false,
key(Messages.GUI_XMLCONTENTREPAIR_DIALOG_RESTYPE_GENERIC_0)));
return result;
} | [
"private",
"List",
"getXmlContentResourceTypes",
"(",
")",
"{",
"// get all available resource types and filter XML content resource types",
"List",
"resTypes",
"=",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"getResourceTypes",
"(",
")",
";",
"Iterator",
"i",
"... | Returns the selector widget options to build a XML content resource type selector widget.<p>
@return the selector widget options to build a XML content resource type selector widget | [
"Returns",
"the",
"selector",
"widget",
"options",
"to",
"build",
"a",
"XML",
"content",
"resource",
"type",
"selector",
"widget",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/content/CmsXmlContentRepairDialog.java#L253-L292 |
Scout24/appmon4j | core/src/main/java/de/is24/util/monitoring/Math.java | Math.stdDeviation | public static double stdDeviation(final long n, final double sum, final double sumOfSquares) {
double stdDev = 0;
if (n > 1) { // std deviation for 1 entry is 0 by definition
final double numerator = sumOfSquares - ((sum * sum) / n);
stdDev = java.lang.Math.sqrt(numerator / (n - 1));
}
return stdDev;
} | java | public static double stdDeviation(final long n, final double sum, final double sumOfSquares) {
double stdDev = 0;
if (n > 1) { // std deviation for 1 entry is 0 by definition
final double numerator = sumOfSquares - ((sum * sum) / n);
stdDev = java.lang.Math.sqrt(numerator / (n - 1));
}
return stdDev;
} | [
"public",
"static",
"double",
"stdDeviation",
"(",
"final",
"long",
"n",
",",
"final",
"double",
"sum",
",",
"final",
"double",
"sumOfSquares",
")",
"{",
"double",
"stdDev",
"=",
"0",
";",
"if",
"(",
"n",
">",
"1",
")",
"{",
"// std deviation for 1 entry i... | Calculate the standard deviation from an amount of values n, a sum and a sum of squares.
@param n the number of values measured.
@param sum the total sum of values measured.
@param sumOfSquares the total sum of squares of the values measured.
@return the standard deviation of a number of values. | [
"Calculate",
"the",
"standard",
"deviation",
"from",
"an",
"amount",
"of",
"values",
"n",
"a",
"sum",
"and",
"a",
"sum",
"of",
"squares",
"."
] | train | https://github.com/Scout24/appmon4j/blob/a662e5123805ea455cfd01e1b9ae5d808f83529c/core/src/main/java/de/is24/util/monitoring/Math.java#L41-L49 |
pravega/pravega | common/src/main/java/io/pravega/common/util/BitConverter.java | BitConverter.readUUID | public static UUID readUUID(ArrayView source, int position) {
long msb = readLong(source, position);
long lsb = readLong(source, position + Long.BYTES);
return new UUID(msb, lsb);
} | java | public static UUID readUUID(ArrayView source, int position) {
long msb = readLong(source, position);
long lsb = readLong(source, position + Long.BYTES);
return new UUID(msb, lsb);
} | [
"public",
"static",
"UUID",
"readUUID",
"(",
"ArrayView",
"source",
",",
"int",
"position",
")",
"{",
"long",
"msb",
"=",
"readLong",
"(",
"source",
",",
"position",
")",
";",
"long",
"lsb",
"=",
"readLong",
"(",
"source",
",",
"position",
"+",
"Long",
... | Reads a 128-bit UUID from the given ArrayView starting at the given position.
@param source The ArrayView to read from.
@param position The position in the ArrayView to start reading at.
@return The read UUID. | [
"Reads",
"a",
"128",
"-",
"bit",
"UUID",
"from",
"the",
"given",
"ArrayView",
"starting",
"at",
"the",
"given",
"position",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L216-L220 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/cache/JsCacheAnnotationServices.java | JsCacheAnnotationServices.computeCacheKey | String computeCacheKey(Class cls, String methodName, String argpart) {
String cachekey = keyMaker.getMd5(cls.getName() + "." + methodName);
if (!argpart.isEmpty()) {
cachekey += "_" + keyMaker.getMd5(argpart);
}
logger.debug("CACHEID : {}.{}_{} = {}", cls.getName(), methodName, argpart, cachekey);
return cachekey;
} | java | String computeCacheKey(Class cls, String methodName, String argpart) {
String cachekey = keyMaker.getMd5(cls.getName() + "." + methodName);
if (!argpart.isEmpty()) {
cachekey += "_" + keyMaker.getMd5(argpart);
}
logger.debug("CACHEID : {}.{}_{} = {}", cls.getName(), methodName, argpart, cachekey);
return cachekey;
} | [
"String",
"computeCacheKey",
"(",
"Class",
"cls",
",",
"String",
"methodName",
",",
"String",
"argpart",
")",
"{",
"String",
"cachekey",
"=",
"keyMaker",
".",
"getMd5",
"(",
"cls",
".",
"getName",
"(",
")",
"+",
"\".\"",
"+",
"methodName",
")",
";",
"if"... | Compute the cache key from classname, methodname, and args
@param cls
@param methodName
@param argpart
@return | [
"Compute",
"the",
"cache",
"key",
"from",
"classname",
"methodname",
"and",
"args"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/cache/JsCacheAnnotationServices.java#L127-L134 |
gallandarakhneorg/afc | core/references/src/main/java/org/arakhne/afc/references/AbstractReferencedValueMap.java | AbstractReferencedValueMap.makeValue | protected final ReferencableValue<K, V> makeValue(K key, V value) {
return makeValue(key, value, this.queue);
} | java | protected final ReferencableValue<K, V> makeValue(K key, V value) {
return makeValue(key, value, this.queue);
} | [
"protected",
"final",
"ReferencableValue",
"<",
"K",
",",
"V",
">",
"makeValue",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"return",
"makeValue",
"(",
"key",
",",
"value",
",",
"this",
".",
"queue",
")",
";",
"}"
] | Create a storage object that permits to put the specified
elements inside this map.
@param key is the key associated to the value
@param value is the value
@return the new storage object | [
"Create",
"a",
"storage",
"object",
"that",
"permits",
"to",
"put",
"the",
"specified",
"elements",
"inside",
"this",
"map",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/references/src/main/java/org/arakhne/afc/references/AbstractReferencedValueMap.java#L242-L244 |
zandero/http | src/main/java/com/zandero/http/RequestUtils.java | RequestUtils.isIpAddressAllowed | public static boolean isIpAddressAllowed(String ipAddress, String... whitelist) {
if (StringUtils.isNullOrEmpty(ipAddress) || whitelist == null || whitelist.length == 0) {
return false;
}
for (String address : whitelist) {
if (ipAddress.equals(address)) {
return true;
}
if (address.contains("/")) { // is range definition
SubnetUtils utils = new SubnetUtils(address);
utils.setInclusiveHostCount(true);
if (utils.getInfo().isInRange(ipAddress)) {
return true;
}
}
}
return false;
} | java | public static boolean isIpAddressAllowed(String ipAddress, String... whitelist) {
if (StringUtils.isNullOrEmpty(ipAddress) || whitelist == null || whitelist.length == 0) {
return false;
}
for (String address : whitelist) {
if (ipAddress.equals(address)) {
return true;
}
if (address.contains("/")) { // is range definition
SubnetUtils utils = new SubnetUtils(address);
utils.setInclusiveHostCount(true);
if (utils.getInfo().isInRange(ipAddress)) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"isIpAddressAllowed",
"(",
"String",
"ipAddress",
",",
"String",
"...",
"whitelist",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"ipAddress",
")",
"||",
"whitelist",
"==",
"null",
"||",
"whitelist",
".",
"lengt... | Compares ipAddress with one of the ip addresses listed
@param ipAddress ip address to compare
@param whitelist list of ip addresses ... an be a range ip ... in format 123.123.123.123/28 where last part is a subnet range
@return true if allowed, false if not | [
"Compares",
"ipAddress",
"with",
"one",
"of",
"the",
"ip",
"addresses",
"listed"
] | train | https://github.com/zandero/http/blob/909eb879f1193adf24545360c3b76bd813865f65/src/main/java/com/zandero/http/RequestUtils.java#L128-L152 |
liaochong/spring-boot-starter-converter | src/main/java/com/github/liaochong/converter/core/BeansConvertStrategy.java | BeansConvertStrategy.convertBeans | public static <E, T> List<E> convertBeans(List<T> source, Class<E> targetClass, boolean nonNullFilter) {
return convertBeans(source, targetClass, null, false, nonNullFilter);
} | java | public static <E, T> List<E> convertBeans(List<T> source, Class<E> targetClass, boolean nonNullFilter) {
return convertBeans(source, targetClass, null, false, nonNullFilter);
} | [
"public",
"static",
"<",
"E",
",",
"T",
">",
"List",
"<",
"E",
">",
"convertBeans",
"(",
"List",
"<",
"T",
">",
"source",
",",
"Class",
"<",
"E",
">",
"targetClass",
",",
"boolean",
"nonNullFilter",
")",
"{",
"return",
"convertBeans",
"(",
"source",
... | 集合转换,无指定异常提供
@param source 需要转换的集合
@param targetClass 需要转换到的类型
@param nonNullFilter 是否非空过滤
@param <E> 转换后的类型
@param <T> 转换前的类型
@return 结果 | [
"集合转换,无指定异常提供"
] | train | https://github.com/liaochong/spring-boot-starter-converter/blob/a36bea44bd23330a6f43b0372906a804a09285c5/src/main/java/com/github/liaochong/converter/core/BeansConvertStrategy.java#L52-L54 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/wavelet/UtilWavelet.java | UtilWavelet.borderForwardUpper | public static int borderForwardUpper( WlCoef desc , int dataLength) {
int w = Math.max( desc.offsetScaling+desc.getScalingLength() , desc.offsetWavelet+desc.getWaveletLength());
int a = dataLength%2;
w -= a;
return Math.max((w + (w%2))-2,0)+a;
} | java | public static int borderForwardUpper( WlCoef desc , int dataLength) {
int w = Math.max( desc.offsetScaling+desc.getScalingLength() , desc.offsetWavelet+desc.getWaveletLength());
int a = dataLength%2;
w -= a;
return Math.max((w + (w%2))-2,0)+a;
} | [
"public",
"static",
"int",
"borderForwardUpper",
"(",
"WlCoef",
"desc",
",",
"int",
"dataLength",
")",
"{",
"int",
"w",
"=",
"Math",
".",
"max",
"(",
"desc",
".",
"offsetScaling",
"+",
"desc",
".",
"getScalingLength",
"(",
")",
",",
"desc",
".",
"offsetW... | Returns the upper border (offset from image edge) for a forward wavelet transform. | [
"Returns",
"the",
"upper",
"border",
"(",
"offset",
"from",
"image",
"edge",
")",
"for",
"a",
"forward",
"wavelet",
"transform",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/wavelet/UtilWavelet.java#L181-L188 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Table.java | Table.insertTable | public void insertTable(Table aTable, int row, int column) {
if (aTable == null) throw new NullPointerException("insertTable - table has null-value");
insertTable(aTable, new Point(row, column));
} | java | public void insertTable(Table aTable, int row, int column) {
if (aTable == null) throw new NullPointerException("insertTable - table has null-value");
insertTable(aTable, new Point(row, column));
} | [
"public",
"void",
"insertTable",
"(",
"Table",
"aTable",
",",
"int",
"row",
",",
"int",
"column",
")",
"{",
"if",
"(",
"aTable",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"insertTable - table has null-value\"",
")",
";",
"insertTable",
... | To put a table within the existing table at the given position
generateTable will of course re-arrange the widths of the columns.
@param aTable The <CODE>Table</CODE> to add
@param row The row where the <CODE>Cell</CODE> will be added
@param column The column where the <CODE>Cell</CODE> will be added | [
"To",
"put",
"a",
"table",
"within",
"the",
"existing",
"table",
"at",
"the",
"given",
"position",
"generateTable",
"will",
"of",
"course",
"re",
"-",
"arrange",
"the",
"widths",
"of",
"the",
"columns",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Table.java#L808-L811 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/FaxJobImpl.java | FaxJobImpl.getProperty | public String getProperty(String key,String defaultValue)
{
//get property value
return this.PROPERTIES.getProperty(key,defaultValue);
} | java | public String getProperty(String key,String defaultValue)
{
//get property value
return this.PROPERTIES.getProperty(key,defaultValue);
} | [
"public",
"String",
"getProperty",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"//get property value",
"return",
"this",
".",
"PROPERTIES",
".",
"getProperty",
"(",
"key",
",",
"defaultValue",
")",
";",
"}"
] | This function returns the fax job property for the
given key.
@param key
The property key
@param defaultValue
The default value
@return The property value | [
"This",
"function",
"returns",
"the",
"fax",
"job",
"property",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/FaxJobImpl.java#L259-L263 |
alipay/sofa-rpc | extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/codec/bolt/SimpleMapSerializer.java | SimpleMapSerializer.writeString | protected void writeString(OutputStream out, String str) throws IOException {
if (str == null) {
writeInt(out, -1);
} else if (str.isEmpty()) {
writeInt(out, 0);
} else {
byte[] bs = StringSerializer.encode(str);
writeInt(out, bs.length);
out.write(bs);
}
} | java | protected void writeString(OutputStream out, String str) throws IOException {
if (str == null) {
writeInt(out, -1);
} else if (str.isEmpty()) {
writeInt(out, 0);
} else {
byte[] bs = StringSerializer.encode(str);
writeInt(out, bs.length);
out.write(bs);
}
} | [
"protected",
"void",
"writeString",
"(",
"OutputStream",
"out",
",",
"String",
"str",
")",
"throws",
"IOException",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"writeInt",
"(",
"out",
",",
"-",
"1",
")",
";",
"}",
"else",
"if",
"(",
"str",
".",
... | 写一个String
@param out 输出流
@param str 字符串
@throws IOException 写入异常 | [
"写一个String"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/codec/bolt/SimpleMapSerializer.java#L98-L108 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/redis/Cache.java | Cache.getSet | @SuppressWarnings("unchecked")
public <T> T getSet(Object key, Object value) {
Jedis jedis = getJedis();
try {
return (T)valueFromBytes(jedis.getSet(keyToBytes(key), valueToBytes(value)));
}
finally {close(jedis);}
} | java | @SuppressWarnings("unchecked")
public <T> T getSet(Object key, Object value) {
Jedis jedis = getJedis();
try {
return (T)valueFromBytes(jedis.getSet(keyToBytes(key), valueToBytes(value)));
}
finally {close(jedis);}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getSet",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"Jedis",
"jedis",
"=",
"getJedis",
"(",
")",
";",
"try",
"{",
"return",
"(",
"T",
")",
"valueFromBytes",... | 将给定 key 的值设为 value ,并返回 key 的旧值(old value)。
当 key 存在但不是字符串类型时,返回一个错误。 | [
"将给定",
"key",
"的值设为",
"value",
",并返回",
"key",
"的旧值",
"(",
"old",
"value",
")",
"。",
"当",
"key",
"存在但不是字符串类型时,返回一个错误。"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L363-L370 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java | MercatorProjection.latitudeToTileYWithScaleFactor | public static int latitudeToTileYWithScaleFactor(double latitude, double scaleFactor) {
return pixelYToTileYWithScaleFactor(latitudeToPixelYWithScaleFactor(latitude, scaleFactor, DUMMY_TILE_SIZE), scaleFactor, DUMMY_TILE_SIZE);
} | java | public static int latitudeToTileYWithScaleFactor(double latitude, double scaleFactor) {
return pixelYToTileYWithScaleFactor(latitudeToPixelYWithScaleFactor(latitude, scaleFactor, DUMMY_TILE_SIZE), scaleFactor, DUMMY_TILE_SIZE);
} | [
"public",
"static",
"int",
"latitudeToTileYWithScaleFactor",
"(",
"double",
"latitude",
",",
"double",
"scaleFactor",
")",
"{",
"return",
"pixelYToTileYWithScaleFactor",
"(",
"latitudeToPixelYWithScaleFactor",
"(",
"latitude",
",",
"scaleFactor",
",",
"DUMMY_TILE_SIZE",
"... | Converts a latitude coordinate (in degrees) to a tile Y number at a certain scale.
@param latitude the latitude coordinate that should be converted.
@param scaleFactor the scale factor at which the coordinate should be converted.
@return the tile Y number of the latitude value. | [
"Converts",
"a",
"latitude",
"coordinate",
"(",
"in",
"degrees",
")",
"to",
"a",
"tile",
"Y",
"number",
"at",
"a",
"certain",
"scale",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L231-L233 |
selenide/selenide | src/main/java/com/codeborne/selenide/logevents/SelenideLogger.java | SelenideLogger.addListener | public static void addListener(String name, LogEventListener listener) {
Map<String, LogEventListener> threadListeners = listeners.get();
if (threadListeners == null) {
threadListeners = new HashMap<>();
}
threadListeners.put(name, listener);
listeners.set(threadListeners);
} | java | public static void addListener(String name, LogEventListener listener) {
Map<String, LogEventListener> threadListeners = listeners.get();
if (threadListeners == null) {
threadListeners = new HashMap<>();
}
threadListeners.put(name, listener);
listeners.set(threadListeners);
} | [
"public",
"static",
"void",
"addListener",
"(",
"String",
"name",
",",
"LogEventListener",
"listener",
")",
"{",
"Map",
"<",
"String",
",",
"LogEventListener",
">",
"threadListeners",
"=",
"listeners",
".",
"get",
"(",
")",
";",
"if",
"(",
"threadListeners",
... | Add a listener (to the current thread).
@param name unique name of this listener (per thread).
Can be used later to remove listener using method {@link #removeListener(String)}
@param listener event listener | [
"Add",
"a",
"listener",
"(",
"to",
"the",
"current",
"thread",
")",
"."
] | train | https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/logevents/SelenideLogger.java#L22-L30 |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/pod/PodsManagerAutoPodImpl.java | PodsManagerAutoPodImpl.isPrimaryServer | private boolean isPrimaryServer(ServerHeartbeat server, UpdatePod update)
{
int index = getServerIndex(server, update);
if (index < 0) {
return false;
}
for (int i = 0; i < update.getNodeCount(); i++) {
UpdateNode node = update.getNode(i);
int primary = node.getServers()[0];
if (index == primary) {
return true;
}
}
return false;
} | java | private boolean isPrimaryServer(ServerHeartbeat server, UpdatePod update)
{
int index = getServerIndex(server, update);
if (index < 0) {
return false;
}
for (int i = 0; i < update.getNodeCount(); i++) {
UpdateNode node = update.getNode(i);
int primary = node.getServers()[0];
if (index == primary) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"isPrimaryServer",
"(",
"ServerHeartbeat",
"server",
",",
"UpdatePod",
"update",
")",
"{",
"int",
"index",
"=",
"getServerIndex",
"(",
"server",
",",
"update",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"return",
"false",
";",
... | /*
private ArrayList<ServerHeartbeat>
allocateServersForPod(PodConfig pod,
Comparator<ServerPodsCost> cmp)
{
ArrayList<ServerPodsCost> serverCostList = new ArrayList<>();
for (ServerHeartbeat server : getCluster().getServers()) {
if (! isServerAlloc(server, pod)) {
continue;
}
ServerPodsCost serverCost = new ServerPodsCost(server, pod);
serverCost.setSeedIndex(calculateSeedIndex(server));
serverCost.setPrimaryCount(calculatePodPrimaryCount(server));
serverCostList.add(serverCost);
}
Collections.sort(serverCostList, cmp);
ArrayList<ServerHeartbeat> serverList = new ArrayList<>();
for (ServerPodsCost serverCost : serverCostList) {
serverList.add(serverCost.getServer());
}
return serverList;
}
private boolean isServerAlloc(ServerHeartbeat server, PodConfig pod)
{
if (server.getPodSet().contains(pod.getName())) {
return true;
}
else if (server.isPodAny()) {
return true;
}
else if (pod.getName().equals("cluster_hub")) {
return true;
}
else {
return false;
}
}
private int calculatePodPrimaryCount(ServerHeartbeat server)
{
int count = 0;
for (UpdatePod updatePod : getPodsConfig().getUpdates()) {
if (updatePod.getPodName().equals("cluster")
|| updatePod.getPodName().equals("cluster_hub")) {
continue;
}
if (isPrimaryServer(server, updatePod)) {
count++;
}
}
return count;
} | [
"/",
"*",
"private",
"ArrayList<ServerHeartbeat",
">",
"allocateServersForPod",
"(",
"PodConfig",
"pod",
"Comparator<ServerPodsCost",
">",
"cmp",
")",
"{",
"ArrayList<ServerPodsCost",
">",
"serverCostList",
"=",
"new",
"ArrayList<",
">",
"()",
";"
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/pod/PodsManagerAutoPodImpl.java#L394-L413 |
apache/incubator-gobblin | gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/zip/ZipFileConfigStore.java | ZipFileConfigStore.getOwnConfig | @Override
public Config getOwnConfig(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException {
Preconditions.checkNotNull(configKey, "configKey cannot be null!");
Preconditions.checkArgument(version.equals(getCurrentVersion()));
Path datasetDir = getDatasetDirForKey(configKey);
Path mainConfFile = this.fs.getPath(datasetDir.toString(), SimpleHadoopFilesystemConfigStore.MAIN_CONF_FILE_NAME);
try {
if (!Files.exists(mainConfFile)) {
return ConfigFactory.empty();
}
if (!Files.isDirectory(mainConfFile)) {
try (InputStream mainConfInputStream = Files.newInputStream(mainConfFile)) {
return ConfigFactory.parseReader(new InputStreamReader(mainConfInputStream, Charsets.UTF_8));
}
}
return ConfigFactory.empty();
} catch (IOException e) {
throw new RuntimeException(String.format("Error while getting config for configKey: \"%s\"", configKey), e);
}
} | java | @Override
public Config getOwnConfig(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException {
Preconditions.checkNotNull(configKey, "configKey cannot be null!");
Preconditions.checkArgument(version.equals(getCurrentVersion()));
Path datasetDir = getDatasetDirForKey(configKey);
Path mainConfFile = this.fs.getPath(datasetDir.toString(), SimpleHadoopFilesystemConfigStore.MAIN_CONF_FILE_NAME);
try {
if (!Files.exists(mainConfFile)) {
return ConfigFactory.empty();
}
if (!Files.isDirectory(mainConfFile)) {
try (InputStream mainConfInputStream = Files.newInputStream(mainConfFile)) {
return ConfigFactory.parseReader(new InputStreamReader(mainConfInputStream, Charsets.UTF_8));
}
}
return ConfigFactory.empty();
} catch (IOException e) {
throw new RuntimeException(String.format("Error while getting config for configKey: \"%s\"", configKey), e);
}
} | [
"@",
"Override",
"public",
"Config",
"getOwnConfig",
"(",
"ConfigKeyPath",
"configKey",
",",
"String",
"version",
")",
"throws",
"VersionDoesNotExistException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"configKey",
",",
"\"configKey cannot be null!\"",
")",
";",
... | Retrieves the {@link Config} for the given {@link ConfigKeyPath}. Similar to
{@link SimpleHadoopFilesystemConfigStore#getOwnConfig} | [
"Retrieves",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/zip/ZipFileConfigStore.java#L169-L191 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufProxy.java | ProtobufProxy.dynamicCodeGenerate | public static void dynamicCodeGenerate(OutputStream os, Class cls, Charset charset, ICodeGenerator codeGenerator)
throws IOException {
if (cls == null) {
throw new NullPointerException("Parameter 'cls' is null");
}
if (os == null) {
throw new NullPointerException("Parameter 'os' is null");
}
if (charset == null) {
charset = Charset.defaultCharset();
}
String code = codeGenerator.getCode();
os.write(code.getBytes(charset));
} | java | public static void dynamicCodeGenerate(OutputStream os, Class cls, Charset charset, ICodeGenerator codeGenerator)
throws IOException {
if (cls == null) {
throw new NullPointerException("Parameter 'cls' is null");
}
if (os == null) {
throw new NullPointerException("Parameter 'os' is null");
}
if (charset == null) {
charset = Charset.defaultCharset();
}
String code = codeGenerator.getCode();
os.write(code.getBytes(charset));
} | [
"public",
"static",
"void",
"dynamicCodeGenerate",
"(",
"OutputStream",
"os",
",",
"Class",
"cls",
",",
"Charset",
"charset",
",",
"ICodeGenerator",
"codeGenerator",
")",
"throws",
"IOException",
"{",
"if",
"(",
"cls",
"==",
"null",
")",
"{",
"throw",
"new",
... | To generate a protobuf proxy java source code for target class.
@param os to generate java source code
@param cls target class
@param charset charset type
@param codeGenerator the code generator
@throws IOException in case of any io relative exception. | [
"To",
"generate",
"a",
"protobuf",
"proxy",
"java",
"source",
"code",
"for",
"target",
"class",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufProxy.java#L144-L158 |
virgo47/javasimon | core/src/main/java/org/javasimon/callback/logging/LogTemplates.java | LogTemplates.toSLF4J | public static <C> SLF4JLogTemplate<C> toSLF4J(String loggerName, String levelName) {
return toSLF4J(loggerName, levelName, null);
} | java | public static <C> SLF4JLogTemplate<C> toSLF4J(String loggerName, String levelName) {
return toSLF4J(loggerName, levelName, null);
} | [
"public",
"static",
"<",
"C",
">",
"SLF4JLogTemplate",
"<",
"C",
">",
"toSLF4J",
"(",
"String",
"loggerName",
",",
"String",
"levelName",
")",
"{",
"return",
"toSLF4J",
"(",
"loggerName",
",",
"levelName",
",",
"null",
")",
";",
"}"
] | Produces a concrete log template which logs messages into a SLF4J Logger.
@param loggerName Logger name
@param levelName Level name (info, debug, warn, etc.)
@return Logger | [
"Produces",
"a",
"concrete",
"log",
"template",
"which",
"logs",
"messages",
"into",
"a",
"SLF4J",
"Logger",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/logging/LogTemplates.java#L92-L94 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java | ArmeriaHttpUtil.toArmeria | public static HttpHeaders toArmeria(io.netty.handler.codec.http.HttpHeaders inHeaders) {
if (inHeaders.isEmpty()) {
return HttpHeaders.EMPTY_HEADERS;
}
final HttpHeaders out = new DefaultHttpHeaders(true, inHeaders.size());
toArmeria(inHeaders, out);
return out;
} | java | public static HttpHeaders toArmeria(io.netty.handler.codec.http.HttpHeaders inHeaders) {
if (inHeaders.isEmpty()) {
return HttpHeaders.EMPTY_HEADERS;
}
final HttpHeaders out = new DefaultHttpHeaders(true, inHeaders.size());
toArmeria(inHeaders, out);
return out;
} | [
"public",
"static",
"HttpHeaders",
"toArmeria",
"(",
"io",
".",
"netty",
".",
"handler",
".",
"codec",
".",
"http",
".",
"HttpHeaders",
"inHeaders",
")",
"{",
"if",
"(",
"inHeaders",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"HttpHeaders",
".",
"EMPT... | Converts the specified Netty HTTP/1 headers into Armeria HTTP/2 headers. | [
"Converts",
"the",
"specified",
"Netty",
"HTTP",
"/",
"1",
"headers",
"into",
"Armeria",
"HTTP",
"/",
"2",
"headers",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java#L564-L572 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipCall.java | SipCall.sendIncomingCallResponse | public boolean sendIncomingCallResponse(int statusCode, String reasonPhrase, int expires) {
return sendIncomingCallResponse(statusCode, reasonPhrase, expires, null, null, null);
} | java | public boolean sendIncomingCallResponse(int statusCode, String reasonPhrase, int expires) {
return sendIncomingCallResponse(statusCode, reasonPhrase, expires, null, null, null);
} | [
"public",
"boolean",
"sendIncomingCallResponse",
"(",
"int",
"statusCode",
",",
"String",
"reasonPhrase",
",",
"int",
"expires",
")",
"{",
"return",
"sendIncomingCallResponse",
"(",
"statusCode",
",",
"reasonPhrase",
",",
"expires",
",",
"null",
",",
"null",
",",
... | This method sends a basic response to a previously received INVITE request. The response is
constructed based on the parameters passed in. Call this method after waitForIncomingCall()
returns true. Call this method multiple times to send multiple responses to the received
INVITE. The INVITE being responded to must be the last received request on this SipCall.
@param statusCode The status code of the response to send (may use SipResponse constants).
@param reasonPhrase If not null, the reason phrase to send.
@param expires If not -1, an expiration time is added to the response. This parameter indicates
the duration the message is valid, in seconds.
@return true if the response was successfully sent, false otherwise. | [
"This",
"method",
"sends",
"a",
"basic",
"response",
"to",
"a",
"previously",
"received",
"INVITE",
"request",
".",
"The",
"response",
"is",
"constructed",
"based",
"on",
"the",
"parameters",
"passed",
"in",
".",
"Call",
"this",
"method",
"after",
"waitForInco... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipCall.java#L985-L987 |
samskivert/samskivert | src/main/java/com/samskivert/jdbc/BaseLiaison.java | BaseLiaison.fetchLastInsertedId | protected int fetchLastInsertedId (Connection conn, String table, String column)
throws SQLException
{
throw new SQLException(
"Unable to obtain last inserted id [table=" + table + ", column=" + column + "]");
} | java | protected int fetchLastInsertedId (Connection conn, String table, String column)
throws SQLException
{
throw new SQLException(
"Unable to obtain last inserted id [table=" + table + ", column=" + column + "]");
} | [
"protected",
"int",
"fetchLastInsertedId",
"(",
"Connection",
"conn",
",",
"String",
"table",
",",
"String",
"column",
")",
"throws",
"SQLException",
"{",
"throw",
"new",
"SQLException",
"(",
"\"Unable to obtain last inserted id [table=\"",
"+",
"table",
"+",
"\", col... | Requests the last inserted id for the specified table and column. This is used if a JDBC
driver does not support {@code getGeneratedKeys} or an attempt to use that failed. | [
"Requests",
"the",
"last",
"inserted",
"id",
"for",
"the",
"specified",
"table",
"and",
"column",
".",
"This",
"is",
"used",
"if",
"a",
"JDBC",
"driver",
"does",
"not",
"support",
"{"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/BaseLiaison.java#L62-L67 |
aoindustries/aocode-public | src/main/java/com/aoindustries/io/FilesystemIterator.java | FilesystemIterator.getNextFiles | public int getNextFiles(final File[] files, final int batchSize) throws IOException {
int c=0;
while(c<batchSize) {
File file=getNextFile();
if(file==null) break;
files[c++]=file;
}
return c;
} | java | public int getNextFiles(final File[] files, final int batchSize) throws IOException {
int c=0;
while(c<batchSize) {
File file=getNextFile();
if(file==null) break;
files[c++]=file;
}
return c;
} | [
"public",
"int",
"getNextFiles",
"(",
"final",
"File",
"[",
"]",
"files",
",",
"final",
"int",
"batchSize",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"0",
";",
"while",
"(",
"c",
"<",
"batchSize",
")",
"{",
"File",
"file",
"=",
"getNextFile",... | Gets the next files, up to batchSize.
@return the number of files in the array, zero (0) indicates iteration has completed
@throws java.io.IOException | [
"Gets",
"the",
"next",
"files",
"up",
"to",
"batchSize",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/FilesystemIterator.java#L260-L268 |
Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java | DAGraph.merge | private void merge(Map<String, NodeT> source, Map<String, NodeT> target) {
for (Map.Entry<String, NodeT> entry : source.entrySet()) {
String key = entry.getKey();
if (!target.containsKey(key)) {
target.put(key, entry.getValue());
}
}
} | java | private void merge(Map<String, NodeT> source, Map<String, NodeT> target) {
for (Map.Entry<String, NodeT> entry : source.entrySet()) {
String key = entry.getKey();
if (!target.containsKey(key)) {
target.put(key, entry.getValue());
}
}
} | [
"private",
"void",
"merge",
"(",
"Map",
"<",
"String",
",",
"NodeT",
">",
"source",
",",
"Map",
"<",
"String",
",",
"NodeT",
">",
"target",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"NodeT",
">",
"entry",
":",
"source",
".",
... | Copies entries in the source map to target map.
@param source source map
@param target target map | [
"Copies",
"entries",
"in",
"the",
"source",
"map",
"to",
"target",
"map",
"."
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGraph.java#L252-L259 |
modelmapper/modelmapper | core/src/main/java/org/modelmapper/convention/InexactMatcher.java | InexactMatcher.matchSourcePropertyName | DestTokensMatcher matchSourcePropertyName(Tokens destTokens, int destStartIndex) {
int[] matchedTokens = new int[sourceTokens.size()];
for (int sourceIndex = 0; sourceIndex < sourceTokens.size(); sourceIndex++) {
Tokens srcTokens = sourceTokens.get(sourceIndex);
matchedTokens[sourceIndex] = matchTokens(srcTokens, destTokens, destStartIndex);
}
return new DestTokensMatcher(matchedTokens);
} | java | DestTokensMatcher matchSourcePropertyName(Tokens destTokens, int destStartIndex) {
int[] matchedTokens = new int[sourceTokens.size()];
for (int sourceIndex = 0; sourceIndex < sourceTokens.size(); sourceIndex++) {
Tokens srcTokens = sourceTokens.get(sourceIndex);
matchedTokens[sourceIndex] = matchTokens(srcTokens, destTokens, destStartIndex);
}
return new DestTokensMatcher(matchedTokens);
} | [
"DestTokensMatcher",
"matchSourcePropertyName",
"(",
"Tokens",
"destTokens",
",",
"int",
"destStartIndex",
")",
"{",
"int",
"[",
"]",
"matchedTokens",
"=",
"new",
"int",
"[",
"sourceTokens",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"sourceIndex",
... | Returns the numbers of match counts for each {@code sourceTokens} that were matched to{@code destTokens} starting at
{@code destStartIndex}. | [
"Returns",
"the",
"numbers",
"of",
"match",
"counts",
"for",
"each",
"{"
] | train | https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/convention/InexactMatcher.java#L106-L113 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java | CPDefinitionSpecificationOptionValuePersistenceImpl.findByGroupId | @Override
public List<CPDefinitionSpecificationOptionValue> findByGroupId(
long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPDefinitionSpecificationOptionValue> findByGroupId(
long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionSpecificationOptionValue",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")... | Returns all the cp definition specification option values where groupId = ?.
@param groupId the group ID
@return the matching cp definition specification option values | [
"Returns",
"all",
"the",
"cp",
"definition",
"specification",
"option",
"values",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java#L1551-L1555 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/values/JcNumber.java | JcNumber.plus | public JcNumber plus(Number val) {
JcNumber ret = new JcNumber(val, this, OPERATOR.Number.PLUS);
QueryRecorder.recordInvocationConditional(this, "plus", ret, QueryRecorder.literal(val));
return ret;
} | java | public JcNumber plus(Number val) {
JcNumber ret = new JcNumber(val, this, OPERATOR.Number.PLUS);
QueryRecorder.recordInvocationConditional(this, "plus", ret, QueryRecorder.literal(val));
return ret;
} | [
"public",
"JcNumber",
"plus",
"(",
"Number",
"val",
")",
"{",
"JcNumber",
"ret",
"=",
"new",
"JcNumber",
"(",
"val",
",",
"this",
",",
"OPERATOR",
".",
"Number",
".",
"PLUS",
")",
";",
"QueryRecorder",
".",
"recordInvocationConditional",
"(",
"this",
",",
... | <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>return the result of adding two numbers, return a <b>JcNumber</b></i></div>
<br/> | [
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"24px",
";",
"color",
":",
"red",
">",
"<b",
">",
"<i",
">",
"<u",
">",
"JCYPHER<",
"/",
"u",
">",
"<",
"/",
"i",
">",
"<",
"/",
"b",
">",
"<",
"/",
"div",
">",
"<div",
... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcNumber.java#L69-L73 |
belaban/JGroups | src/org/jgroups/blocks/MessageDispatcher.java | MessageDispatcher.installUpHandler | protected <X extends MessageDispatcher> X installUpHandler(UpHandler handler, boolean canReplace) {
UpHandler existing = channel.getUpHandler();
if (existing == null)
channel.setUpHandler(handler);
else if(canReplace) {
log.warn("Channel already has an up handler installed (%s) but now it is being overridden", existing);
channel.setUpHandler(handler);
}
return (X)this;
} | java | protected <X extends MessageDispatcher> X installUpHandler(UpHandler handler, boolean canReplace) {
UpHandler existing = channel.getUpHandler();
if (existing == null)
channel.setUpHandler(handler);
else if(canReplace) {
log.warn("Channel already has an up handler installed (%s) but now it is being overridden", existing);
channel.setUpHandler(handler);
}
return (X)this;
} | [
"protected",
"<",
"X",
"extends",
"MessageDispatcher",
">",
"X",
"installUpHandler",
"(",
"UpHandler",
"handler",
",",
"boolean",
"canReplace",
")",
"{",
"UpHandler",
"existing",
"=",
"channel",
".",
"getUpHandler",
"(",
")",
";",
"if",
"(",
"existing",
"==",
... | Sets the given UpHandler as the UpHandler for the channel. If the relevant handler is already installed,
the {@code canReplace} controls whether this method replaces it (after logging a WARN) or simply
leaves {@code handler} uninstalled.<p>
Passing {@code false} as the {@code canReplace} value allows callers to use this method to install defaults
without concern about inadvertently overriding
@param handler the UpHandler to install
@param canReplace {@code true} if an existing Channel upHandler can be replaced; {@code false}
if this method shouldn't install | [
"Sets",
"the",
"given",
"UpHandler",
"as",
"the",
"UpHandler",
"for",
"the",
"channel",
".",
"If",
"the",
"relevant",
"handler",
"is",
"already",
"installed",
"the",
"{",
"@code",
"canReplace",
"}",
"controls",
"whether",
"this",
"method",
"replaces",
"it",
... | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/MessageDispatcher.java#L212-L221 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Row.java | Row.addElement | int addElement(Object element, int column) {
if (element == null) throw new NullPointerException("addCell - null argument");
if ((column < 0) || (column > columns)) throw new IndexOutOfBoundsException("addCell - illegal column argument");
if ( !((getObjectID(element) == CELL) || (getObjectID(element) == TABLE)) ) throw new IllegalArgumentException("addCell - only Cells or Tables allowed");
int lColspan = ( (Cell.class.isInstance(element)) ? ((Cell) element).getColspan() : 1);
if (!reserve(column, lColspan)) {
return -1;
}
cells[column] = element;
currentColumn += lColspan - 1;
return column;
} | java | int addElement(Object element, int column) {
if (element == null) throw new NullPointerException("addCell - null argument");
if ((column < 0) || (column > columns)) throw new IndexOutOfBoundsException("addCell - illegal column argument");
if ( !((getObjectID(element) == CELL) || (getObjectID(element) == TABLE)) ) throw new IllegalArgumentException("addCell - only Cells or Tables allowed");
int lColspan = ( (Cell.class.isInstance(element)) ? ((Cell) element).getColspan() : 1);
if (!reserve(column, lColspan)) {
return -1;
}
cells[column] = element;
currentColumn += lColspan - 1;
return column;
} | [
"int",
"addElement",
"(",
"Object",
"element",
",",
"int",
"column",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"addCell - null argument\"",
")",
";",
"if",
"(",
"(",
"column",
"<",
"0",
")",
"||",
"... | Adds an element to the <CODE>Row</CODE> at the position given.
@param element the element to add. (currently only Cells and Tables supported
@param column the position where to add the cell.
@return the column position the <CODE>Cell</CODE> was added,
or <CODE>-1</CODE> if the <CODE>Cell</CODE> couldn't be added. | [
"Adds",
"an",
"element",
"to",
"the",
"<CODE",
">",
"Row<",
"/",
"CODE",
">",
"at",
"the",
"position",
"given",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Row.java#L221-L236 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java | AmazonS3Client.populateRequestWithMfaDetails | private void populateRequestWithMfaDetails(Request<?> request, MultiFactorAuthentication mfa) {
if (mfa == null) return;
String endpoint = request.getEndpoint().toString();
if (endpoint.startsWith("http://")) {
String httpsEndpoint = endpoint.replace("http://", "https://");
request.setEndpoint(URI.create(httpsEndpoint));
log.info("Overriding current endpoint to use HTTPS " +
"as required by S3 for requests containing an MFA header");
}
request.addHeader(Headers.S3_MFA,
mfa.getDeviceSerialNumber() + " " + mfa.getToken());
} | java | private void populateRequestWithMfaDetails(Request<?> request, MultiFactorAuthentication mfa) {
if (mfa == null) return;
String endpoint = request.getEndpoint().toString();
if (endpoint.startsWith("http://")) {
String httpsEndpoint = endpoint.replace("http://", "https://");
request.setEndpoint(URI.create(httpsEndpoint));
log.info("Overriding current endpoint to use HTTPS " +
"as required by S3 for requests containing an MFA header");
}
request.addHeader(Headers.S3_MFA,
mfa.getDeviceSerialNumber() + " " + mfa.getToken());
} | [
"private",
"void",
"populateRequestWithMfaDetails",
"(",
"Request",
"<",
"?",
">",
"request",
",",
"MultiFactorAuthentication",
"mfa",
")",
"{",
"if",
"(",
"mfa",
"==",
"null",
")",
"return",
";",
"String",
"endpoint",
"=",
"request",
".",
"getEndpoint",
"(",
... | <p>
Populates the specified request with the specified Multi-Factor
Authentication (MFA) details. This includes the MFA header with device serial
number and generated token. Since all requests which include the MFA
header must be sent over HTTPS, this operation also configures the request object to
use HTTPS instead of HTTP.
</p>
@param request
The request to populate.
@param mfa
The Multi-Factor Authentication information. | [
"<p",
">",
"Populates",
"the",
"specified",
"request",
"with",
"the",
"specified",
"Multi",
"-",
"Factor",
"Authentication",
"(",
"MFA",
")",
"details",
".",
"This",
"includes",
"the",
"MFA",
"header",
"with",
"device",
"serial",
"number",
"and",
"generated",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L4217-L4230 |
lightblueseas/net-extensions | src/main/java/de/alpharogroup/net/socket/SocketExtensions.java | SocketExtensions.writeObject | public static void writeObject(final InetAddress inetAddress, final int port,
final Object objectToSend) throws IOException
{
Socket socketToClient = null;
ObjectOutputStream oos = null;
try
{
socketToClient = new Socket(inetAddress, port);
oos = new ObjectOutputStream(
new BufferedOutputStream(socketToClient.getOutputStream()));
oos.writeObject(objectToSend);
oos.close();
socketToClient.close();
}
catch (final IOException e)
{
LOGGER.error("IOException occured by trying to write the object.", e);
throw e;
}
finally
{
try
{
if (oos != null)
{
oos.close();
}
close(socketToClient);
}
catch (final IOException e)
{
LOGGER.error("IOException occured by trying to close the socket.", e);
throw e;
}
}
} | java | public static void writeObject(final InetAddress inetAddress, final int port,
final Object objectToSend) throws IOException
{
Socket socketToClient = null;
ObjectOutputStream oos = null;
try
{
socketToClient = new Socket(inetAddress, port);
oos = new ObjectOutputStream(
new BufferedOutputStream(socketToClient.getOutputStream()));
oos.writeObject(objectToSend);
oos.close();
socketToClient.close();
}
catch (final IOException e)
{
LOGGER.error("IOException occured by trying to write the object.", e);
throw e;
}
finally
{
try
{
if (oos != null)
{
oos.close();
}
close(socketToClient);
}
catch (final IOException e)
{
LOGGER.error("IOException occured by trying to close the socket.", e);
throw e;
}
}
} | [
"public",
"static",
"void",
"writeObject",
"(",
"final",
"InetAddress",
"inetAddress",
",",
"final",
"int",
"port",
",",
"final",
"Object",
"objectToSend",
")",
"throws",
"IOException",
"{",
"Socket",
"socketToClient",
"=",
"null",
";",
"ObjectOutputStream",
"oos"... | Writes the given Object to the given InetAddress who listen to the given port.
@param inetAddress
the inet address
@param port
The port who listen the receiver.
@param objectToSend
The Object to send.
@throws IOException
Signals that an I/O exception has occurred. | [
"Writes",
"the",
"given",
"Object",
"to",
"the",
"given",
"InetAddress",
"who",
"listen",
"to",
"the",
"given",
"port",
"."
] | train | https://github.com/lightblueseas/net-extensions/blob/771757a93fa9ad13ce0fe061c158e5cba43344cb/src/main/java/de/alpharogroup/net/socket/SocketExtensions.java#L351-L387 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/widget/OverviewMap.java | OverviewMap.setDrawTargetMaxExtent | @Api
public void setDrawTargetMaxExtent(boolean drawTargetMaxExtent) {
this.drawTargetMaxExtent = drawTargetMaxExtent;
// Immediately draw or remove the max extent rectangle:
if (drawTargetMaxExtent) {
targetMaxExtentRectangle = new GfxGeometry("targetMaxExtentRectangle");
targetMaxExtentRectangle.setStyle(targetMaxExtentRectangleStyle);
Bbox targetMaxExtent = getOverviewMaxBounds();
Bbox box = getMapModel().getMapView().getWorldViewTransformer().worldToView(targetMaxExtent);
LinearRing shell = getMapModel().getGeometryFactory().createLinearRing(
new Coordinate[] { new Coordinate(-2, -2), new Coordinate(getWidth() + 2, -2),
new Coordinate(getWidth() + 2, getHeight() + 2), new Coordinate(-2, getHeight() + 2) });
LinearRing hole = getMapModel().getGeometryFactory().createLinearRing(
new Coordinate[] { new Coordinate(box.getX(), box.getY()),
new Coordinate(box.getMaxX(), box.getY()), new Coordinate(box.getMaxX(), box.getMaxY()),
new Coordinate(box.getX(), box.getMaxY()) });
Polygon polygon = getMapModel().getGeometryFactory().createPolygon(shell, new LinearRing[] { hole });
targetMaxExtentRectangle.setGeometry(polygon);
render(targetMaxExtentRectangle, RenderGroup.SCREEN, RenderStatus.ALL);
} else {
render(targetMaxExtentRectangle, RenderGroup.SCREEN, RenderStatus.DELETE);
targetMaxExtentRectangle = null;
}
} | java | @Api
public void setDrawTargetMaxExtent(boolean drawTargetMaxExtent) {
this.drawTargetMaxExtent = drawTargetMaxExtent;
// Immediately draw or remove the max extent rectangle:
if (drawTargetMaxExtent) {
targetMaxExtentRectangle = new GfxGeometry("targetMaxExtentRectangle");
targetMaxExtentRectangle.setStyle(targetMaxExtentRectangleStyle);
Bbox targetMaxExtent = getOverviewMaxBounds();
Bbox box = getMapModel().getMapView().getWorldViewTransformer().worldToView(targetMaxExtent);
LinearRing shell = getMapModel().getGeometryFactory().createLinearRing(
new Coordinate[] { new Coordinate(-2, -2), new Coordinate(getWidth() + 2, -2),
new Coordinate(getWidth() + 2, getHeight() + 2), new Coordinate(-2, getHeight() + 2) });
LinearRing hole = getMapModel().getGeometryFactory().createLinearRing(
new Coordinate[] { new Coordinate(box.getX(), box.getY()),
new Coordinate(box.getMaxX(), box.getY()), new Coordinate(box.getMaxX(), box.getMaxY()),
new Coordinate(box.getX(), box.getMaxY()) });
Polygon polygon = getMapModel().getGeometryFactory().createPolygon(shell, new LinearRing[] { hole });
targetMaxExtentRectangle.setGeometry(polygon);
render(targetMaxExtentRectangle, RenderGroup.SCREEN, RenderStatus.ALL);
} else {
render(targetMaxExtentRectangle, RenderGroup.SCREEN, RenderStatus.DELETE);
targetMaxExtentRectangle = null;
}
} | [
"@",
"Api",
"public",
"void",
"setDrawTargetMaxExtent",
"(",
"boolean",
"drawTargetMaxExtent",
")",
"{",
"this",
".",
"drawTargetMaxExtent",
"=",
"drawTargetMaxExtent",
";",
"// Immediately draw or remove the max extent rectangle:",
"if",
"(",
"drawTargetMaxExtent",
")",
"{... | Determine whether or not a rectangle that shows the target map's maximum extent should be shown.
@param drawTargetMaxExtent
should the max extent be marked on the map?
@since 1.8.0 | [
"Determine",
"whether",
"or",
"not",
"a",
"rectangle",
"that",
"shows",
"the",
"target",
"map",
"s",
"maximum",
"extent",
"should",
"be",
"shown",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/OverviewMap.java#L265-L291 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/restli/GobblinServiceFlowConfigResourceHandler.java | GobblinServiceFlowConfigResourceHandler.deleteFlowConfig | @Override
public UpdateResponse deleteFlowConfig(FlowId flowId, Properties header)
throws FlowConfigLoggedException {
String flowName = flowId.getFlowName();
String flowGroup = flowId.getFlowGroup();
checkHelixConnection(ServiceConfigKeys.HELIX_FLOWSPEC_REMOVE, flowName, flowGroup);
try {
if (!jobScheduler.isActive() && helixManager.isPresent()) {
if (this.flowCatalogLocalCommit) {
// We will handle FS I/O locally for load balance before forwarding to remote node.
this.localHandler.deleteFlowConfig(flowId, header, false);
}
forwardMessage(ServiceConfigKeys.HELIX_FLOWSPEC_REMOVE, FlowConfigUtils.serializeFlowId(flowId), flowName, flowGroup);
return new UpdateResponse(HttpStatus.S_200_OK);
} else {
return this.localHandler.deleteFlowConfig(flowId, header);
}
} catch (IOException e) {
throw new FlowConfigLoggedException(HttpStatus.S_500_INTERNAL_SERVER_ERROR,
"Cannot delete flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]", e);
}
} | java | @Override
public UpdateResponse deleteFlowConfig(FlowId flowId, Properties header)
throws FlowConfigLoggedException {
String flowName = flowId.getFlowName();
String flowGroup = flowId.getFlowGroup();
checkHelixConnection(ServiceConfigKeys.HELIX_FLOWSPEC_REMOVE, flowName, flowGroup);
try {
if (!jobScheduler.isActive() && helixManager.isPresent()) {
if (this.flowCatalogLocalCommit) {
// We will handle FS I/O locally for load balance before forwarding to remote node.
this.localHandler.deleteFlowConfig(flowId, header, false);
}
forwardMessage(ServiceConfigKeys.HELIX_FLOWSPEC_REMOVE, FlowConfigUtils.serializeFlowId(flowId), flowName, flowGroup);
return new UpdateResponse(HttpStatus.S_200_OK);
} else {
return this.localHandler.deleteFlowConfig(flowId, header);
}
} catch (IOException e) {
throw new FlowConfigLoggedException(HttpStatus.S_500_INTERNAL_SERVER_ERROR,
"Cannot delete flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]", e);
}
} | [
"@",
"Override",
"public",
"UpdateResponse",
"deleteFlowConfig",
"(",
"FlowId",
"flowId",
",",
"Properties",
"header",
")",
"throws",
"FlowConfigLoggedException",
"{",
"String",
"flowName",
"=",
"flowId",
".",
"getFlowName",
"(",
")",
";",
"String",
"flowGroup",
"... | Deleting {@link FlowConfig} should check if current node is active (master).
If current node is active, call {@link FlowConfigResourceLocalHandler#deleteFlowConfig(FlowId, Properties)} directly.
If current node is standby, forward {@link ServiceConfigKeys#HELIX_FLOWSPEC_REMOVE} to active. The remote active will
then call {@link FlowConfigResourceLocalHandler#deleteFlowConfig(FlowId, Properties)}.
Please refer to {@link org.apache.gobblin.service.modules.core.ControllerUserDefinedMessageHandlerFactory} for remote handling.
For better I/O load balance, user can enable {@link GobblinServiceFlowConfigResourceHandler#flowCatalogLocalCommit}.
The {@link FlowConfig} will be then persisted to {@link org.apache.gobblin.runtime.spec_catalog.FlowCatalog} first before it is
forwarded to active node (if current node is standby) for execution. | [
"Deleting",
"{",
"@link",
"FlowConfig",
"}",
"should",
"check",
"if",
"current",
"node",
"is",
"active",
"(",
"master",
")",
".",
"If",
"current",
"node",
"is",
"active",
"call",
"{",
"@link",
"FlowConfigResourceLocalHandler#deleteFlowConfig",
"(",
"FlowId",
"Pr... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/restli/GobblinServiceFlowConfigResourceHandler.java#L183-L209 |
apache/incubator-gobblin | gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/utils/PartitionUtils.java | PartitionUtils.getPartitionSpecString | public static String getPartitionSpecString(Map<String, String> spec) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : spec.entrySet()) {
if (!sb.toString().isEmpty()) {
sb.append(",");
}
sb.append(entry.getKey());
sb.append("=");
sb.append(getQuotedString(entry.getValue()));
}
return sb.toString();
} | java | public static String getPartitionSpecString(Map<String, String> spec) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : spec.entrySet()) {
if (!sb.toString().isEmpty()) {
sb.append(",");
}
sb.append(entry.getKey());
sb.append("=");
sb.append(getQuotedString(entry.getValue()));
}
return sb.toString();
} | [
"public",
"static",
"String",
"getPartitionSpecString",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"spec",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">"... | This method returns the partition spec string of the partition.
Example : datepartition='2016-01-01-00', size='12345' | [
"This",
"method",
"returns",
"the",
"partition",
"spec",
"string",
"of",
"the",
"partition",
".",
"Example",
":",
"datepartition",
"=",
"2016",
"-",
"01",
"-",
"01",
"-",
"00",
"size",
"=",
"12345"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/utils/PartitionUtils.java#L55-L66 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java | GeneratedDFactoryDaoImpl.queryByCreatedDate | public Iterable<DFactory> queryByCreatedDate(java.util.Date createdDate) {
return queryByField(null, DFactoryMapper.Field.CREATEDDATE.getFieldName(), createdDate);
} | java | public Iterable<DFactory> queryByCreatedDate(java.util.Date createdDate) {
return queryByField(null, DFactoryMapper.Field.CREATEDDATE.getFieldName(), createdDate);
} | [
"public",
"Iterable",
"<",
"DFactory",
">",
"queryByCreatedDate",
"(",
"java",
".",
"util",
".",
"Date",
"createdDate",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DFactoryMapper",
".",
"Field",
".",
"CREATEDDATE",
".",
"getFieldName",
"(",
")",
"... | query-by method for field createdDate
@param createdDate the specified attribute
@return an Iterable of DFactorys for the specified createdDate | [
"query",
"-",
"by",
"method",
"for",
"field",
"createdDate"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java#L106-L108 |
awin/rabbiteasy | rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java | ConsumerContainer.addConsumer | public void addConsumer(Consumer consumer, String queue, int instances) {
addConsumer(consumer, new ConsumerConfiguration(queue), instances);
} | java | public void addConsumer(Consumer consumer, String queue, int instances) {
addConsumer(consumer, new ConsumerConfiguration(queue), instances);
} | [
"public",
"void",
"addConsumer",
"(",
"Consumer",
"consumer",
",",
"String",
"queue",
",",
"int",
"instances",
")",
"{",
"addConsumer",
"(",
"consumer",
",",
"new",
"ConsumerConfiguration",
"(",
"queue",
")",
",",
"instances",
")",
";",
"}"
] | <p>Adds a consumer to the container, binds it to the given queue with auto acknowledge disabled.
Does NOT enable the consumer to consume from the message broker until the container is started.</p>
<p>Registers the same consumer N times at the queue according to the number of specified instances.
Use this for scaling your consumers locally. Be aware that the consumer implementation must
be stateless or thread safe.</p>
@param consumer The consumer
@param queue The queue to bind the consume to
@param instances the amount of consumer instances | [
"<p",
">",
"Adds",
"a",
"consumer",
"to",
"the",
"container",
"binds",
"it",
"to",
"the",
"given",
"queue",
"with",
"auto",
"acknowledge",
"disabled",
".",
"Does",
"NOT",
"enable",
"the",
"consumer",
"to",
"consume",
"from",
"the",
"message",
"broker",
"un... | train | https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java#L104-L106 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/Shape.java | Shape.setOffset | @Override
public T setOffset(final double x, final double y)
{
getAttributes().setOffset(x, y);
return cast();
} | java | @Override
public T setOffset(final double x, final double y)
{
getAttributes().setOffset(x, y);
return cast();
} | [
"@",
"Override",
"public",
"T",
"setOffset",
"(",
"final",
"double",
"x",
",",
"final",
"double",
"y",
")",
"{",
"getAttributes",
"(",
")",
".",
"setOffset",
"(",
"x",
",",
"y",
")",
";",
"return",
"cast",
"(",
")",
";",
"}"
] | Sets this shape's offset, at the given x and y coordinates.
@param x
@param y
@return T | [
"Sets",
"this",
"shape",
"s",
"offset",
"at",
"the",
"given",
"x",
"and",
"y",
"coordinates",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Shape.java#L1297-L1303 |
landawn/AbacusUtil | src/com/landawn/abacus/spring/SQLExecutor.java | SQLExecutor.beginTransaction | @Deprecated
@Override
public SQLTransaction beginTransaction(IsolationLevel isolationLevel, boolean forUpdateOnly) {
return super.beginTransaction(isolationLevel, forUpdateOnly);
} | java | @Deprecated
@Override
public SQLTransaction beginTransaction(IsolationLevel isolationLevel, boolean forUpdateOnly) {
return super.beginTransaction(isolationLevel, forUpdateOnly);
} | [
"@",
"Deprecated",
"@",
"Override",
"public",
"SQLTransaction",
"beginTransaction",
"(",
"IsolationLevel",
"isolationLevel",
",",
"boolean",
"forUpdateOnly",
")",
"{",
"return",
"super",
".",
"beginTransaction",
"(",
"isolationLevel",
",",
"forUpdateOnly",
")",
";",
... | The connection opened in the transaction will be automatically closed after the transaction is committed or rolled back.
DON'T close it again by calling the close method.
@param isolationLevel
@param forUpdateOnly
@return
@deprecated | [
"The",
"connection",
"opened",
"in",
"the",
"transaction",
"will",
"be",
"automatically",
"closed",
"after",
"the",
"transaction",
"is",
"committed",
"or",
"rolled",
"back",
".",
"DON",
"T",
"close",
"it",
"again",
"by",
"calling",
"the",
"close",
"method",
... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/spring/SQLExecutor.java#L118-L122 |
zaproxy/zaproxy | src/org/zaproxy/zap/spider/parser/SpiderParser.java | SpiderParser.notifyListenersResourceFound | protected void notifyListenersResourceFound(HttpMessage message, int depth, String uri) {
for (SpiderParserListener l : listeners) {
l.resourceURIFound(message, depth, uri);
}
} | java | protected void notifyListenersResourceFound(HttpMessage message, int depth, String uri) {
for (SpiderParserListener l : listeners) {
l.resourceURIFound(message, depth, uri);
}
} | [
"protected",
"void",
"notifyListenersResourceFound",
"(",
"HttpMessage",
"message",
",",
"int",
"depth",
",",
"String",
"uri",
")",
"{",
"for",
"(",
"SpiderParserListener",
"l",
":",
"listeners",
")",
"{",
"l",
".",
"resourceURIFound",
"(",
"message",
",",
"de... | Notify the listeners that a resource was found.
@param message the http message containing the response.
@param depth the depth of this resource in the crawling tree
@param uri the uri | [
"Notify",
"the",
"listeners",
"that",
"a",
"resource",
"was",
"found",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/parser/SpiderParser.java#L67-L71 |
RKumsher/utils | src/main/java/com/github/rkumsher/number/RandomNumberUtils.java | RandomNumberUtils.randomDouble | public static double randomDouble(double startInclusive, double endExclusive) {
checkArgument(startInclusive <= endExclusive, "End must be greater than or equal to start");
if (startInclusive == endExclusive) {
return startInclusive;
}
return RANDOM.doubles(1, startInclusive, endExclusive).sum();
} | java | public static double randomDouble(double startInclusive, double endExclusive) {
checkArgument(startInclusive <= endExclusive, "End must be greater than or equal to start");
if (startInclusive == endExclusive) {
return startInclusive;
}
return RANDOM.doubles(1, startInclusive, endExclusive).sum();
} | [
"public",
"static",
"double",
"randomDouble",
"(",
"double",
"startInclusive",
",",
"double",
"endExclusive",
")",
"{",
"checkArgument",
"(",
"startInclusive",
"<=",
"endExclusive",
",",
"\"End must be greater than or equal to start\"",
")",
";",
"if",
"(",
"startInclus... | Returns a random double within the specified range.
@param startInclusive the earliest double that can be returned
@param endExclusive the upper bound (not included)
@return the random double
@throws IllegalArgumentException if endExclusive is less than startInclusive | [
"Returns",
"a",
"random",
"double",
"within",
"the",
"specified",
"range",
"."
] | train | https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/number/RandomNumberUtils.java#L194-L200 |
undertow-io/undertow | core/src/main/java/io/undertow/server/protocol/http/HttpRequestParser.java | HttpRequestParser.handleHeaderValue | @SuppressWarnings("unused")
final void handleHeaderValue(ByteBuffer buffer, ParseState state, HttpServerExchange builder) throws BadRequestException {
HttpString headerName = state.nextHeader;
StringBuilder stringBuilder = state.stringBuilder;
CacheMap<HttpString, String> headerValuesCache = state.headerValuesCache;
if (headerName != null && stringBuilder.length() == 0 && headerValuesCache != null) {
String existing = headerValuesCache.get(headerName);
if (existing != null) {
if (handleCachedHeader(existing, buffer, state, builder)) {
return;
}
}
}
handleHeaderValueCacheMiss(buffer, state, builder, headerName, headerValuesCache, stringBuilder);
} | java | @SuppressWarnings("unused")
final void handleHeaderValue(ByteBuffer buffer, ParseState state, HttpServerExchange builder) throws BadRequestException {
HttpString headerName = state.nextHeader;
StringBuilder stringBuilder = state.stringBuilder;
CacheMap<HttpString, String> headerValuesCache = state.headerValuesCache;
if (headerName != null && stringBuilder.length() == 0 && headerValuesCache != null) {
String existing = headerValuesCache.get(headerName);
if (existing != null) {
if (handleCachedHeader(existing, buffer, state, builder)) {
return;
}
}
}
handleHeaderValueCacheMiss(buffer, state, builder, headerName, headerValuesCache, stringBuilder);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"final",
"void",
"handleHeaderValue",
"(",
"ByteBuffer",
"buffer",
",",
"ParseState",
"state",
",",
"HttpServerExchange",
"builder",
")",
"throws",
"BadRequestException",
"{",
"HttpString",
"headerName",
"=",
"state",
... | Parses a header value. This is called from the generated bytecode.
@param buffer The buffer
@param state The current state
@param builder The exchange builder
@return The number of bytes remaining | [
"Parses",
"a",
"header",
"value",
".",
"This",
"is",
"called",
"from",
"the",
"generated",
"bytecode",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/protocol/http/HttpRequestParser.java#L685-L700 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readHistoryProject | public CmsHistoryProject readHistoryProject(CmsDbContext dbc, CmsUUID projectId) throws CmsException {
return getHistoryDriver(dbc).readProject(dbc, projectId);
} | java | public CmsHistoryProject readHistoryProject(CmsDbContext dbc, CmsUUID projectId) throws CmsException {
return getHistoryDriver(dbc).readProject(dbc, projectId);
} | [
"public",
"CmsHistoryProject",
"readHistoryProject",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"projectId",
")",
"throws",
"CmsException",
"{",
"return",
"getHistoryDriver",
"(",
"dbc",
")",
".",
"readProject",
"(",
"dbc",
",",
"projectId",
")",
";",
"}"
] | Returns the latest historical project entry with the given id.<p>
@param dbc the current database context
@param projectId the project id
@return the requested historical project entry
@throws CmsException if something goes wrong | [
"Returns",
"the",
"latest",
"historical",
"project",
"entry",
"with",
"the",
"given",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L6968-L6971 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.rebootWorker | public void rebootWorker(String resourceGroupName, String name, String workerName) {
rebootWorkerWithServiceResponseAsync(resourceGroupName, name, workerName).toBlocking().single().body();
} | java | public void rebootWorker(String resourceGroupName, String name, String workerName) {
rebootWorkerWithServiceResponseAsync(resourceGroupName, name, workerName).toBlocking().single().body();
} | [
"public",
"void",
"rebootWorker",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"workerName",
")",
"{",
"rebootWorkerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"workerName",
")",
".",
"toBlocking",
"(",
")",
... | Reboot a worker machine in an App Service plan.
Reboot a worker machine in an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param workerName Name of worker machine, which typically starts with RD.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Reboot",
"a",
"worker",
"machine",
"in",
"an",
"App",
"Service",
"plan",
".",
"Reboot",
"a",
"worker",
"machine",
"in",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3922-L3924 |
alkacon/opencms-core | src/org/opencms/search/documents/CmsDocumentDependency.java | CmsDocumentDependency.readDependencies | public void readDependencies(CmsObject cms) {
try {
// read all resources in the parent folder of the published resource
List<CmsResource> folderContent = cms.getResourcesInFolder(
CmsResource.getParentFolder(cms.getRequestContext().removeSiteRoot(getResource().getRootPath())),
CmsResourceFilter.DEFAULT);
// now calculate the dependencies form the folder content that has been read
readDependencies(cms, folderContent);
} catch (CmsException e) {
LOG.warn("Unable to read dependencies for " + getResource().getRootPath(), e);
}
} | java | public void readDependencies(CmsObject cms) {
try {
// read all resources in the parent folder of the published resource
List<CmsResource> folderContent = cms.getResourcesInFolder(
CmsResource.getParentFolder(cms.getRequestContext().removeSiteRoot(getResource().getRootPath())),
CmsResourceFilter.DEFAULT);
// now calculate the dependencies form the folder content that has been read
readDependencies(cms, folderContent);
} catch (CmsException e) {
LOG.warn("Unable to read dependencies for " + getResource().getRootPath(), e);
}
} | [
"public",
"void",
"readDependencies",
"(",
"CmsObject",
"cms",
")",
"{",
"try",
"{",
"// read all resources in the parent folder of the published resource",
"List",
"<",
"CmsResource",
">",
"folderContent",
"=",
"cms",
".",
"getResourcesInFolder",
"(",
"CmsResource",
".",... | Reads all dependencies that exist for this main resource in the OpenCms VFS.<p>
To be used when incremental updating an index.<p>
@param cms the current users OpenCms context | [
"Reads",
"all",
"dependencies",
"that",
"exist",
"for",
"this",
"main",
"resource",
"in",
"the",
"OpenCms",
"VFS",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentDependency.java#L705-L717 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/util/IOUtils.java | IOUtils.uniquePath | public static String uniquePath(String name, String ext) throws IOException
{
File file = File.createTempFile(name, ext);
String path = file.getAbsolutePath();
file.delete();
return path;
} | java | public static String uniquePath(String name, String ext) throws IOException
{
File file = File.createTempFile(name, ext);
String path = file.getAbsolutePath();
file.delete();
return path;
} | [
"public",
"static",
"String",
"uniquePath",
"(",
"String",
"name",
",",
"String",
"ext",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"File",
".",
"createTempFile",
"(",
"name",
",",
"ext",
")",
";",
"String",
"path",
"=",
"file",
".",
"getAbs... | <p>uniquePath.</p>
@param name a {@link java.lang.String} object.
@param ext a {@link java.lang.String} object.
@return a {@link java.lang.String} object.
@throws java.io.IOException if any. | [
"<p",
">",
"uniquePath",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/util/IOUtils.java#L53-L60 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/BatchItemResponseDeserializer.java | BatchItemResponseDeserializer.getCDCQueryResponse | private CDCResponse getCDCQueryResponse(JsonNode jsonNode) throws IOException {
ObjectMapper mapper = new ObjectMapper();
SimpleModule simpleModule = new SimpleModule("CDCQueryResponseDeserializer", new Version(1, 0, 0, null));
simpleModule.addDeserializer(CDCResponse.class, new CDCQueryResponseDeserializer());
mapper.registerModule(simpleModule);
return mapper.treeToValue(jsonNode, CDCResponse.class);
} | java | private CDCResponse getCDCQueryResponse(JsonNode jsonNode) throws IOException {
ObjectMapper mapper = new ObjectMapper();
SimpleModule simpleModule = new SimpleModule("CDCQueryResponseDeserializer", new Version(1, 0, 0, null));
simpleModule.addDeserializer(CDCResponse.class, new CDCQueryResponseDeserializer());
mapper.registerModule(simpleModule);
return mapper.treeToValue(jsonNode, CDCResponse.class);
} | [
"private",
"CDCResponse",
"getCDCQueryResponse",
"(",
"JsonNode",
"jsonNode",
")",
"throws",
"IOException",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"SimpleModule",
"simpleModule",
"=",
"new",
"SimpleModule",
"(",
"\"CDCQueryResponseDe... | Method to deserialize the CDCQueryResponse object
@param jsonNode
@return CDCResponse | [
"Method",
"to",
"deserialize",
"the",
"CDCQueryResponse",
"object"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/BatchItemResponseDeserializer.java#L174-L183 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java | HttpFileUploadManager.uploadFile | public URL uploadFile(File file, UploadProgressListener listener) throws InterruptedException,
XMPPException.XMPPErrorException, SmackException, IOException {
if (!file.isFile()) {
throw new FileNotFoundException("The path " + file.getAbsolutePath() + " is not a file");
}
final Slot slot = requestSlot(file.getName(), file.length(), "application/octet-stream");
uploadFile(file, slot, listener);
return slot.getGetUrl();
} | java | public URL uploadFile(File file, UploadProgressListener listener) throws InterruptedException,
XMPPException.XMPPErrorException, SmackException, IOException {
if (!file.isFile()) {
throw new FileNotFoundException("The path " + file.getAbsolutePath() + " is not a file");
}
final Slot slot = requestSlot(file.getName(), file.length(), "application/octet-stream");
uploadFile(file, slot, listener);
return slot.getGetUrl();
} | [
"public",
"URL",
"uploadFile",
"(",
"File",
"file",
",",
"UploadProgressListener",
"listener",
")",
"throws",
"InterruptedException",
",",
"XMPPException",
".",
"XMPPErrorException",
",",
"SmackException",
",",
"IOException",
"{",
"if",
"(",
"!",
"file",
".",
"isF... | Request slot and uploaded file to HTTP file upload service with progress callback.
You don't need to request slot and upload file separately, this method will do both.
Note that this is a synchronous call -- Smack must wait for the server response.
@param file file to be uploaded
@param listener upload progress listener of null
@return public URL for sharing uploaded file
@throws InterruptedException
@throws XMPPException.XMPPErrorException
@throws SmackException
@throws IOException | [
"Request",
"slot",
"and",
"uploaded",
"file",
"to",
"HTTP",
"file",
"upload",
"service",
"with",
"progress",
"callback",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java#L256-L266 |
alkacon/opencms-core | src/org/opencms/security/CmsAccessControlList.java | CmsAccessControlList.getPermissionString | public String getPermissionString(CmsUser user, List<CmsGroup> groups, List<CmsRole> roles) {
return getPermissions(user, groups, roles).getPermissionString();
} | java | public String getPermissionString(CmsUser user, List<CmsGroup> groups, List<CmsRole> roles) {
return getPermissions(user, groups, roles).getPermissionString();
} | [
"public",
"String",
"getPermissionString",
"(",
"CmsUser",
"user",
",",
"List",
"<",
"CmsGroup",
">",
"groups",
",",
"List",
"<",
"CmsRole",
">",
"roles",
")",
"{",
"return",
"getPermissions",
"(",
"user",
",",
"groups",
",",
"roles",
")",
".",
"getPermiss... | Calculates the permissions of the given user and his groups from the access control list.<p>
The permissions are returned as permission string in the format {{+|-}{r|w|v|c|i}}*.
@param user the user
@param groups the groups of this user
@param roles the roles of this user
@return a string that displays the permissions | [
"Calculates",
"the",
"permissions",
"of",
"the",
"given",
"user",
"and",
"his",
"groups",
"from",
"the",
"access",
"control",
"list",
".",
"<p",
">",
"The",
"permissions",
"are",
"returned",
"as",
"permission",
"string",
"in",
"the",
"format",
"{{",
"+",
"... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsAccessControlList.java#L191-L194 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/SerializationUtil.java | SerializationUtil.pipe | public static Object pipe(final Object in) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bos);
os.writeObject(in);
os.close();
byte[] bytes = bos.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream is = new ObjectInputStream(bis);
Object out = is.readObject();
return out;
} catch (Exception ex) {
throw new SystemException("Failed to pipe " + in, ex);
}
} | java | public static Object pipe(final Object in) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(bos);
os.writeObject(in);
os.close();
byte[] bytes = bos.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream is = new ObjectInputStream(bis);
Object out = is.readObject();
return out;
} catch (Exception ex) {
throw new SystemException("Failed to pipe " + in, ex);
}
} | [
"public",
"static",
"Object",
"pipe",
"(",
"final",
"Object",
"in",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"os",
"=",
"new",
"ObjectOutputStream",
"(",
"bos",
")",
";",
... | Takes a copy of an input object via serialization.
@param in the object to copy
@return the copied object | [
"Takes",
"a",
"copy",
"of",
"an",
"input",
"object",
"via",
"serialization",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/SerializationUtil.java#L27-L42 |
threerings/narya | core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java | PresentsDObjectMgr.clearProxyObject | public void clearProxyObject (int origObjectId, DObject object)
{
if (_proxies.remove(object.getOid()) == null) {
log.warning("Missing proxy mapping for cleared proxy", "ooid", origObjectId);
}
_objects.remove(object.getOid());
} | java | public void clearProxyObject (int origObjectId, DObject object)
{
if (_proxies.remove(object.getOid()) == null) {
log.warning("Missing proxy mapping for cleared proxy", "ooid", origObjectId);
}
_objects.remove(object.getOid());
} | [
"public",
"void",
"clearProxyObject",
"(",
"int",
"origObjectId",
",",
"DObject",
"object",
")",
"{",
"if",
"(",
"_proxies",
".",
"remove",
"(",
"object",
".",
"getOid",
"(",
")",
")",
"==",
"null",
")",
"{",
"log",
".",
"warning",
"(",
"\"Missing proxy ... | Clears a proxy object reference from our local distributed object space. This merely removes
it from our internal tables, the caller is responsible for coordinating the deregistration
of the object with the proxying client. | [
"Clears",
"a",
"proxy",
"object",
"reference",
"from",
"our",
"local",
"distributed",
"object",
"space",
".",
"This",
"merely",
"removes",
"it",
"from",
"our",
"internal",
"tables",
"the",
"caller",
"is",
"responsible",
"for",
"coordinating",
"the",
"deregistrat... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java#L186-L192 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/AssetRendition.java | AssetRendition.getDimensionFromOriginal | private static @Nullable Dimension getDimensionFromOriginal(@NotNull Rendition rendition) {
Asset asset = rendition.getAsset();
// asset may have stored dimension in different property names
long width = getAssetMetadataValueAsLong(asset, TIFF_IMAGEWIDTH, EXIF_PIXELXDIMENSION);
long height = getAssetMetadataValueAsLong(asset, TIFF_IMAGELENGTH, EXIF_PIXELYDIMENSION);
return toDimension(width, height);
} | java | private static @Nullable Dimension getDimensionFromOriginal(@NotNull Rendition rendition) {
Asset asset = rendition.getAsset();
// asset may have stored dimension in different property names
long width = getAssetMetadataValueAsLong(asset, TIFF_IMAGEWIDTH, EXIF_PIXELXDIMENSION);
long height = getAssetMetadataValueAsLong(asset, TIFF_IMAGELENGTH, EXIF_PIXELYDIMENSION);
return toDimension(width, height);
} | [
"private",
"static",
"@",
"Nullable",
"Dimension",
"getDimensionFromOriginal",
"(",
"@",
"NotNull",
"Rendition",
"rendition",
")",
"{",
"Asset",
"asset",
"=",
"rendition",
".",
"getAsset",
"(",
")",
";",
"// asset may have stored dimension in different property names",
... | Read dimension for original rendition from asset metadata.
@param rendition Rendition
@return Dimension or null | [
"Read",
"dimension",
"for",
"original",
"rendition",
"from",
"asset",
"metadata",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/AssetRendition.java#L135-L141 |
weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java | Weld.getInstanceByType | protected <T> T getInstanceByType(BeanManager manager, Class<T> type, Annotation... bindings) {
final Bean<?> bean = manager.resolve(manager.getBeans(type, bindings));
if (bean == null) {
throw CommonLogger.LOG.unableToResolveBean(type, Arrays.asList(bindings));
}
CreationalContext<?> cc = manager.createCreationalContext(bean);
return type.cast(manager.getReference(bean, type, cc));
} | java | protected <T> T getInstanceByType(BeanManager manager, Class<T> type, Annotation... bindings) {
final Bean<?> bean = manager.resolve(manager.getBeans(type, bindings));
if (bean == null) {
throw CommonLogger.LOG.unableToResolveBean(type, Arrays.asList(bindings));
}
CreationalContext<?> cc = manager.createCreationalContext(bean);
return type.cast(manager.getReference(bean, type, cc));
} | [
"protected",
"<",
"T",
">",
"T",
"getInstanceByType",
"(",
"BeanManager",
"manager",
",",
"Class",
"<",
"T",
">",
"type",
",",
"Annotation",
"...",
"bindings",
")",
"{",
"final",
"Bean",
"<",
"?",
">",
"bean",
"=",
"manager",
".",
"resolve",
"(",
"mana... | Utility method allowing managed instances of beans to provide entry points for non-managed beans (such as {@link WeldContainer}). Should only called once
Weld has finished booting.
@param manager the BeanManager to use to access the managed instance
@param type the type of the Bean
@param bindings the bean's qualifiers
@return a managed instance of the bean
@throws IllegalArgumentException if the given type represents a type variable
@throws IllegalArgumentException if two instances of the same qualifier type are given
@throws IllegalArgumentException if an instance of an annotation that is not a qualifier type is given
@throws UnsatisfiedResolutionException if no beans can be resolved * @throws AmbiguousResolutionException if the ambiguous dependency resolution rules
fail
@throws IllegalArgumentException if the given type is not a bean type of the given bean | [
"Utility",
"method",
"allowing",
"managed",
"instances",
"of",
"beans",
"to",
"provide",
"entry",
"points",
"for",
"non",
"-",
"managed",
"beans",
"(",
"such",
"as",
"{",
"@link",
"WeldContainer",
"}",
")",
".",
"Should",
"only",
"called",
"once",
"Weld",
... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L1027-L1034 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java | TopicsInner.getByResourceGroupAsync | public Observable<TopicInner> getByResourceGroupAsync(String resourceGroupName, String topicName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, topicName).map(new Func1<ServiceResponse<TopicInner>, TopicInner>() {
@Override
public TopicInner call(ServiceResponse<TopicInner> response) {
return response.body();
}
});
} | java | public Observable<TopicInner> getByResourceGroupAsync(String resourceGroupName, String topicName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, topicName).map(new Func1<ServiceResponse<TopicInner>, TopicInner>() {
@Override
public TopicInner call(ServiceResponse<TopicInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"TopicInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"topicName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"topicName",
")",
".",
"map",
"(",... | Get a topic.
Get properties of a topic.
@param resourceGroupName The name of the resource group within the user's subscription.
@param topicName Name of the topic
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the TopicInner object | [
"Get",
"a",
"topic",
".",
"Get",
"properties",
"of",
"a",
"topic",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L157-L164 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java | SubstructureIdentifier.copyLigandsByProximity | protected static void copyLigandsByProximity(Structure full, Structure reduced) {
// Normal case where all models should be copied from full to reduced
assert full.nrModels() >= reduced.nrModels();
for(int model = 0; model< reduced.nrModels(); model++) {
copyLigandsByProximity(full, reduced, StructureTools.DEFAULT_LIGAND_PROXIMITY_CUTOFF, model, model);
}
} | java | protected static void copyLigandsByProximity(Structure full, Structure reduced) {
// Normal case where all models should be copied from full to reduced
assert full.nrModels() >= reduced.nrModels();
for(int model = 0; model< reduced.nrModels(); model++) {
copyLigandsByProximity(full, reduced, StructureTools.DEFAULT_LIGAND_PROXIMITY_CUTOFF, model, model);
}
} | [
"protected",
"static",
"void",
"copyLigandsByProximity",
"(",
"Structure",
"full",
",",
"Structure",
"reduced",
")",
"{",
"// Normal case where all models should be copied from full to reduced",
"assert",
"full",
".",
"nrModels",
"(",
")",
">=",
"reduced",
".",
"nrModels"... | Supplements the reduced structure with ligands from the full structure based on
a distance cutoff. Ligand groups are moved (destructively) from full to reduced
if they fall within the cutoff of any atom in the reduced structure.
The {@link StructureTools#DEFAULT_LIGAND_PROXIMITY_CUTOFF default cutoff}
is used.
@param full Structure containing all ligands
@param reduced Structure with a subset of the polymer groups from full
@see StructureTools#getLigandsByProximity(java.util.Collection, Atom[], double) | [
"Supplements",
"the",
"reduced",
"structure",
"with",
"ligands",
"from",
"the",
"full",
"structure",
"based",
"on",
"a",
"distance",
"cutoff",
".",
"Ligand",
"groups",
"are",
"moved",
"(",
"destructively",
")",
"from",
"full",
"to",
"reduced",
"if",
"they",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java#L309-L315 |
zaproxy/zaproxy | src/org/zaproxy/zap/view/TabbedPanel2.java | TabbedPanel2.removeTabAt | @Override
public void removeTabAt(int index) {
if (index < 0 || index >= getTabCount()) {
throw new IndexOutOfBoundsException("Index: " + index + ", Tab count: " + getTabCount());
}
Component component = getComponentAt(index);
super.removeTabAt(index);
if (!(component instanceof AbstractPanel)) {
return;
}
removeFromInternalState(component);
} | java | @Override
public void removeTabAt(int index) {
if (index < 0 || index >= getTabCount()) {
throw new IndexOutOfBoundsException("Index: " + index + ", Tab count: " + getTabCount());
}
Component component = getComponentAt(index);
super.removeTabAt(index);
if (!(component instanceof AbstractPanel)) {
return;
}
removeFromInternalState(component);
} | [
"@",
"Override",
"public",
"void",
"removeTabAt",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"getTabCount",
"(",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Index: \"",
"+",
"index",
"+",
"\"... | Removes the tab at the given index and the corresponding panel. | [
"Removes",
"the",
"tab",
"at",
"the",
"given",
"index",
"and",
"the",
"corresponding",
"panel",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/TabbedPanel2.java#L483-L497 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java | DateTimeUtils.addHours | public static Calendar addHours(Calendar origin, int value) {
Calendar cal = sync((Calendar) origin.clone());
cal.add(Calendar.HOUR_OF_DAY, value);
return sync(cal);
} | java | public static Calendar addHours(Calendar origin, int value) {
Calendar cal = sync((Calendar) origin.clone());
cal.add(Calendar.HOUR_OF_DAY, value);
return sync(cal);
} | [
"public",
"static",
"Calendar",
"addHours",
"(",
"Calendar",
"origin",
",",
"int",
"value",
")",
"{",
"Calendar",
"cal",
"=",
"sync",
"(",
"(",
"Calendar",
")",
"origin",
".",
"clone",
"(",
")",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"HOU... | Add/Subtract the specified amount of hours to the given {@link Calendar}.
<p>
The returned {@link Calendar} has its fields synced.
</p>
@param origin
@param value
@return
@since 0.9.2 | [
"Add",
"/",
"Subtract",
"the",
"specified",
"amount",
"of",
"hours",
"to",
"the",
"given",
"{",
"@link",
"Calendar",
"}",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java#L447-L451 |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/impl/SecurityActions.java | SecurityActions.loadAndInstantiateFromModule | static <T> T loadAndInstantiateFromModule(final String moduleId, final Class<T> iface, final String name) throws Exception {
if (!WildFlySecurityManager.isChecking()) {
return internalLoadAndInstantiateFromModule(moduleId, iface, name);
} else {
try {
return doPrivileged(new PrivilegedExceptionAction<T>() {
@Override
public T run() throws Exception {
return internalLoadAndInstantiateFromModule(moduleId, iface, name);
}
});
} catch (PrivilegedActionException e) {
Throwable t = e.getCause();
if (t instanceof RuntimeException){
throw (RuntimeException)t;
}
throw new Exception(t);
}
}
} | java | static <T> T loadAndInstantiateFromModule(final String moduleId, final Class<T> iface, final String name) throws Exception {
if (!WildFlySecurityManager.isChecking()) {
return internalLoadAndInstantiateFromModule(moduleId, iface, name);
} else {
try {
return doPrivileged(new PrivilegedExceptionAction<T>() {
@Override
public T run() throws Exception {
return internalLoadAndInstantiateFromModule(moduleId, iface, name);
}
});
} catch (PrivilegedActionException e) {
Throwable t = e.getCause();
if (t instanceof RuntimeException){
throw (RuntimeException)t;
}
throw new Exception(t);
}
}
} | [
"static",
"<",
"T",
">",
"T",
"loadAndInstantiateFromModule",
"(",
"final",
"String",
"moduleId",
",",
"final",
"Class",
"<",
"T",
">",
"iface",
",",
"final",
"String",
"name",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"WildFlySecurityManager",
".",
... | WARNING: Calling this method in non modular context has the side effect to load the Module class.
This is problematic, the system packages required to properly execute an embedded-server will not
be correct. | [
"WARNING",
":",
"Calling",
"this",
"method",
"in",
"non",
"modular",
"context",
"has",
"the",
"side",
"effect",
"to",
"load",
"the",
"Module",
"class",
".",
"This",
"is",
"problematic",
"the",
"system",
"packages",
"required",
"to",
"properly",
"execute",
"a... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/SecurityActions.java#L90-L109 |
auth0/Auth0.Android | auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.java | SecureCredentialsManager.getCredentials | public void getCredentials(@NonNull BaseCallback<Credentials, CredentialsManagerException> callback) {
if (!hasValidCredentials()) {
callback.onFailure(new CredentialsManagerException("No Credentials were previously set."));
return;
}
if (authenticateBeforeDecrypt) {
Log.d(TAG, "Authentication is required to read the Credentials. Showing the LockScreen.");
decryptCallback = callback;
activity.startActivityForResult(authIntent, authenticationRequestCode);
return;
}
continueGetCredentials(callback);
} | java | public void getCredentials(@NonNull BaseCallback<Credentials, CredentialsManagerException> callback) {
if (!hasValidCredentials()) {
callback.onFailure(new CredentialsManagerException("No Credentials were previously set."));
return;
}
if (authenticateBeforeDecrypt) {
Log.d(TAG, "Authentication is required to read the Credentials. Showing the LockScreen.");
decryptCallback = callback;
activity.startActivityForResult(authIntent, authenticationRequestCode);
return;
}
continueGetCredentials(callback);
} | [
"public",
"void",
"getCredentials",
"(",
"@",
"NonNull",
"BaseCallback",
"<",
"Credentials",
",",
"CredentialsManagerException",
">",
"callback",
")",
"{",
"if",
"(",
"!",
"hasValidCredentials",
"(",
")",
")",
"{",
"callback",
".",
"onFailure",
"(",
"new",
"Cr... | Tries to obtain the credentials from the Storage. The callback's {@link BaseCallback#onSuccess(Object)} method will be called with the result.
If something unexpected happens, the {@link BaseCallback#onFailure(Auth0Exception)} method will be called with the error. Some devices are not compatible
at all with the cryptographic implementation and will have {@link CredentialsManagerException#isDeviceIncompatible()} return true.
<p>
If a LockScreen is setup and {@link #requireAuthentication(Activity, int, String, String)} was called, the user will be asked to authenticate before accessing
the credentials. Your activity must override the {@link Activity#onActivityResult(int, int, Intent)} method and call
{@link #checkAuthenticationResult(int, int)} with the received values.
@param callback the callback to receive the result in. | [
"Tries",
"to",
"obtain",
"the",
"credentials",
"from",
"the",
"Storage",
".",
"The",
"callback",
"s",
"{",
"@link",
"BaseCallback#onSuccess",
"(",
"Object",
")",
"}",
"method",
"will",
"be",
"called",
"with",
"the",
"result",
".",
"If",
"something",
"unexpec... | train | https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.java#L177-L190 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/Metrics.java | Metrics.gaugeCollectionSize | @Nullable
public static <T extends Collection<?>> T gaugeCollectionSize(String name, Iterable<Tag> tags, T collection) {
return globalRegistry.gaugeCollectionSize(name, tags, collection);
} | java | @Nullable
public static <T extends Collection<?>> T gaugeCollectionSize(String name, Iterable<Tag> tags, T collection) {
return globalRegistry.gaugeCollectionSize(name, tags, collection);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"?",
">",
">",
"T",
"gaugeCollectionSize",
"(",
"String",
"name",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
",",
"T",
"collection",
")",
"{",
"return",
"globalRegistry",
".",
"g... | Register a gauge that reports the size of the {@link java.util.Collection}. The registration
will keep a weak reference to the collection so it will not prevent garbage collection.
The collection implementation used should be thread safe. Note that calling
{@link java.util.Collection#size()} can be expensive for some collection implementations
and should be considered before registering.
@param name Name of the gauge being registered.
@param tags Sequence of dimensions for breaking down the name.
@param collection Thread-safe implementation of {@link Collection} used to access the value.
@param <T> The type of the state object from which the gauge value is extracted.
@return The number that was passed in so the registration can be done as part of an assignment
statement. | [
"Register",
"a",
"gauge",
"that",
"reports",
"the",
"size",
"of",
"the",
"{",
"@link",
"java",
".",
"util",
".",
"Collection",
"}",
".",
"The",
"registration",
"will",
"keep",
"a",
"weak",
"reference",
"to",
"the",
"collection",
"so",
"it",
"will",
"not"... | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/Metrics.java#L214-L217 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java | GitlabHTTPRequestor.with | public GitlabHTTPRequestor with(String key, Object value) {
if (value != null && key != null) {
data.put(key, value);
}
return this;
} | java | public GitlabHTTPRequestor with(String key, Object value) {
if (value != null && key != null) {
data.put(key, value);
}
return this;
} | [
"public",
"GitlabHTTPRequestor",
"with",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"key",
"!=",
"null",
")",
"{",
"data",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"return",
"this",
"... | Sets the HTTP Form Post parameters for the request
Has a fluent api for method chaining
@param key Form parameter Key
@param value Form parameter Value
@return this | [
"Sets",
"the",
"HTTP",
"Form",
"Post",
"parameters",
"for",
"the",
"request",
"Has",
"a",
"fluent",
"api",
"for",
"method",
"chaining"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java#L93-L98 |
jspringbot/jspringbot | src/main/java/org/jspringbot/spring/SpringRobotLibrary.java | SpringRobotLibrary.runKeyword | @SuppressWarnings("unchecked")
public Object runKeyword(String keyword, final Object[] params) {
Map attributes = new HashMap();
attributes.put("args", params);
try {
ApplicationContextHolder.set(context);
startJSpringBotKeyword(keyword, attributes);
Object[] handledParams = argumentHandlers.handlerArguments(keyword, params);
Object returnedValue = ((Keyword) context.getBean(keywordToBeanMap.get(keyword))).execute(handledParams);
attributes.put("status", "PASS");
return returnedValue;
} catch(Exception e) {
attributes.put("exception", e);
attributes.put("status", "FAIL");
if(SoftAssertManager.INSTANCE.isEnable()) {
LOGGER.warn("[SOFT ASSERT]: (" + keyword + ") -> " + e.getMessage());
SoftAssertManager.INSTANCE.add(keyword, e);
return null;
} else {
throw new IllegalStateException(e.getMessage(), e);
}
} finally {
endJSpringBotKeyword(keyword, attributes);
ApplicationContextHolder.remove();
}
} | java | @SuppressWarnings("unchecked")
public Object runKeyword(String keyword, final Object[] params) {
Map attributes = new HashMap();
attributes.put("args", params);
try {
ApplicationContextHolder.set(context);
startJSpringBotKeyword(keyword, attributes);
Object[] handledParams = argumentHandlers.handlerArguments(keyword, params);
Object returnedValue = ((Keyword) context.getBean(keywordToBeanMap.get(keyword))).execute(handledParams);
attributes.put("status", "PASS");
return returnedValue;
} catch(Exception e) {
attributes.put("exception", e);
attributes.put("status", "FAIL");
if(SoftAssertManager.INSTANCE.isEnable()) {
LOGGER.warn("[SOFT ASSERT]: (" + keyword + ") -> " + e.getMessage());
SoftAssertManager.INSTANCE.add(keyword, e);
return null;
} else {
throw new IllegalStateException(e.getMessage(), e);
}
} finally {
endJSpringBotKeyword(keyword, attributes);
ApplicationContextHolder.remove();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Object",
"runKeyword",
"(",
"String",
"keyword",
",",
"final",
"Object",
"[",
"]",
"params",
")",
"{",
"Map",
"attributes",
"=",
"new",
"HashMap",
"(",
")",
";",
"attributes",
".",
"put",
"(",
... | Implements the Robot Framework interface method 'run_keyword' required for dynamic libraries.
@param keyword name of keyword to be executed
@param params parameters passed by Robot Framework
@return result of the keyword execution | [
"Implements",
"the",
"Robot",
"Framework",
"interface",
"method",
"run_keyword",
"required",
"for",
"dynamic",
"libraries",
"."
] | train | https://github.com/jspringbot/jspringbot/blob/03285a7013492fb793cb0c38a4625a5f5c5750e0/src/main/java/org/jspringbot/spring/SpringRobotLibrary.java#L108-L139 |
micronaut-projects/micronaut-core | function/src/main/java/io/micronaut/function/executor/FunctionApplication.java | FunctionApplication.exitWithError | static void exitWithError(Boolean isDebug, Exception e) {
System.err.println("Error executing function (Use -x for more information): " + e.getMessage());
if (isDebug) {
System.err.println();
System.err.println("Error Detail");
System.err.println("------------");
e.printStackTrace(System.err);
}
System.exit(1);
} | java | static void exitWithError(Boolean isDebug, Exception e) {
System.err.println("Error executing function (Use -x for more information): " + e.getMessage());
if (isDebug) {
System.err.println();
System.err.println("Error Detail");
System.err.println("------------");
e.printStackTrace(System.err);
}
System.exit(1);
} | [
"static",
"void",
"exitWithError",
"(",
"Boolean",
"isDebug",
",",
"Exception",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Error executing function (Use -x for more information): \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"if",
"(",
... | Exit and print an error message if debug flag set.
@param isDebug flag for print error
@param e exception passed in | [
"Exit",
"and",
"print",
"an",
"error",
"message",
"if",
"debug",
"flag",
"set",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/function/src/main/java/io/micronaut/function/executor/FunctionApplication.java#L75-L84 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java | CollectionLiteralsTypeComputer.doNormalizeElementType | protected LightweightTypeReference doNormalizeElementType(LightweightTypeReference actual, LightweightTypeReference expected) {
if (matchesExpectation(actual, expected)) {
return expected;
}
return normalizeFunctionTypeReference(actual);
} | java | protected LightweightTypeReference doNormalizeElementType(LightweightTypeReference actual, LightweightTypeReference expected) {
if (matchesExpectation(actual, expected)) {
return expected;
}
return normalizeFunctionTypeReference(actual);
} | [
"protected",
"LightweightTypeReference",
"doNormalizeElementType",
"(",
"LightweightTypeReference",
"actual",
",",
"LightweightTypeReference",
"expected",
")",
"{",
"if",
"(",
"matchesExpectation",
"(",
"actual",
",",
"expected",
")",
")",
"{",
"return",
"expected",
";"... | If the expected type is not a wildcard, it may supersede the actual element type. | [
"If",
"the",
"expected",
"type",
"is",
"not",
"a",
"wildcard",
"it",
"may",
"supersede",
"the",
"actual",
"element",
"type",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java#L386-L391 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/Arrow.java | Arrow.prepare | @Override
protected boolean prepare(final Context2D context, final Attributes attr, final double alpha)
{
final Point2DArray list = getPolygon();// is null for invalid arrow definition
if ((null != list) && (list.size() > 2))
{
Point2D point = list.get(0);
context.beginPath();
context.moveTo(point.getX(), point.getY());
final int leng = list.size();
for (int i = 1; i < leng; i++)
{
point = list.get(i);
context.lineTo(point.getX(), point.getY());
}
context.closePath();
return true;
}
return false;
} | java | @Override
protected boolean prepare(final Context2D context, final Attributes attr, final double alpha)
{
final Point2DArray list = getPolygon();// is null for invalid arrow definition
if ((null != list) && (list.size() > 2))
{
Point2D point = list.get(0);
context.beginPath();
context.moveTo(point.getX(), point.getY());
final int leng = list.size();
for (int i = 1; i < leng; i++)
{
point = list.get(i);
context.lineTo(point.getX(), point.getY());
}
context.closePath();
return true;
}
return false;
} | [
"@",
"Override",
"protected",
"boolean",
"prepare",
"(",
"final",
"Context2D",
"context",
",",
"final",
"Attributes",
"attr",
",",
"final",
"double",
"alpha",
")",
"{",
"final",
"Point2DArray",
"list",
"=",
"getPolygon",
"(",
")",
";",
"// is null for invalid ar... | Draws this arrow.
@param context the {@link Context2D} used to draw this arrow. | [
"Draws",
"this",
"arrow",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Arrow.java#L114-L140 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java | BackupShortTermRetentionPoliciesInner.createOrUpdate | public BackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body();
} | java | public BackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body();
} | [
"public",
"BackupShortTermRetentionPolicyInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
... | Updates a database's short term retention policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BackupShortTermRetentionPolicyInner object if successful. | [
"Updates",
"a",
"database",
"s",
"short",
"term",
"retention",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java#L198-L200 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/actions/RedirectToServiceAction.java | RedirectToServiceAction.finalizeResponseEvent | protected Event finalizeResponseEvent(final RequestContext requestContext, final WebApplicationService service, final Response response) {
WebUtils.putServiceResponseIntoRequestScope(requestContext, response);
WebUtils.putServiceOriginalUrlIntoRequestScope(requestContext, service);
val eventId = getFinalResponseEventId(service, response, requestContext);
return new EventFactorySupport().event(this, eventId);
} | java | protected Event finalizeResponseEvent(final RequestContext requestContext, final WebApplicationService service, final Response response) {
WebUtils.putServiceResponseIntoRequestScope(requestContext, response);
WebUtils.putServiceOriginalUrlIntoRequestScope(requestContext, service);
val eventId = getFinalResponseEventId(service, response, requestContext);
return new EventFactorySupport().event(this, eventId);
} | [
"protected",
"Event",
"finalizeResponseEvent",
"(",
"final",
"RequestContext",
"requestContext",
",",
"final",
"WebApplicationService",
"service",
",",
"final",
"Response",
"response",
")",
"{",
"WebUtils",
".",
"putServiceResponseIntoRequestScope",
"(",
"requestContext",
... | Finalize response event event.
@param requestContext the request context
@param service the service
@param response the response
@return the event | [
"Finalize",
"response",
"event",
"event",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/actions/RedirectToServiceAction.java#L55-L60 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java | SibTr.bytes | public static void bytes (TraceComponent tc, byte[] data) {
int length = 0;
if (data != null) length = data.length;
bytes(null, tc, data, 0, length, "");
} | java | public static void bytes (TraceComponent tc, byte[] data) {
int length = 0;
if (data != null) length = data.length;
bytes(null, tc, data, 0, length, "");
} | [
"public",
"static",
"void",
"bytes",
"(",
"TraceComponent",
"tc",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"length",
"=",
"0",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"length",
"=",
"data",
".",
"length",
";",
"bytes",
"(",
"null",
",",
... | If debug level tracing is enabled then trace a byte array using formatted
output with offsets. Duplicate output lines are suppressed to save space.
<p>
@param tc the non-null <code>TraceComponent</code> the event is associated
with.
@param data the byte array to be traced | [
"If",
"debug",
"level",
"tracing",
"is",
"enabled",
"then",
"trace",
"a",
"byte",
"array",
"using",
"formatted",
"output",
"with",
"offsets",
".",
"Duplicate",
"output",
"lines",
"are",
"suppressed",
"to",
"save",
"space",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java#L1157-L1161 |
mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java | OfflinePlugin.removeDownload | void removeDownload(OfflineDownloadOptions offlineDownload, boolean canceled) {
if (canceled) {
stateChangeDispatcher.onCancel(offlineDownload);
} else {
stateChangeDispatcher.onSuccess(offlineDownload);
}
offlineDownloads.remove(offlineDownload);
} | java | void removeDownload(OfflineDownloadOptions offlineDownload, boolean canceled) {
if (canceled) {
stateChangeDispatcher.onCancel(offlineDownload);
} else {
stateChangeDispatcher.onSuccess(offlineDownload);
}
offlineDownloads.remove(offlineDownload);
} | [
"void",
"removeDownload",
"(",
"OfflineDownloadOptions",
"offlineDownload",
",",
"boolean",
"canceled",
")",
"{",
"if",
"(",
"canceled",
")",
"{",
"stateChangeDispatcher",
".",
"onCancel",
"(",
"offlineDownload",
")",
";",
"}",
"else",
"{",
"stateChangeDispatcher",
... | Called when the OfflineDownloadService has finished downloading.
@param offlineDownload the offline download to stop tracking
@since 0.1.0 | [
"Called",
"when",
"the",
"OfflineDownloadService",
"has",
"finished",
"downloading",
"."
] | train | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L169-L176 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/ContaineredTaskManagerParameters.java | ContaineredTaskManagerParameters.calculateCutoffMB | public static long calculateCutoffMB(Configuration config, long containerMemoryMB) {
Preconditions.checkArgument(containerMemoryMB > 0);
// (1) check cutoff ratio
final float memoryCutoffRatio = config.getFloat(
ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO);
if (memoryCutoffRatio >= 1 || memoryCutoffRatio <= 0) {
throw new IllegalArgumentException("The configuration value '"
+ ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO.key() + "' must be between 0 and 1. Value given="
+ memoryCutoffRatio);
}
// (2) check min cutoff value
final int minCutoff = config.getInteger(
ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN);
if (minCutoff >= containerMemoryMB) {
throw new IllegalArgumentException("The configuration value '"
+ ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN.key() + "'='" + minCutoff
+ "' is larger than the total container memory " + containerMemoryMB);
}
// (3) check between heap and off-heap
long cutoff = (long) (containerMemoryMB * memoryCutoffRatio);
if (cutoff < minCutoff) {
cutoff = minCutoff;
}
return cutoff;
} | java | public static long calculateCutoffMB(Configuration config, long containerMemoryMB) {
Preconditions.checkArgument(containerMemoryMB > 0);
// (1) check cutoff ratio
final float memoryCutoffRatio = config.getFloat(
ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO);
if (memoryCutoffRatio >= 1 || memoryCutoffRatio <= 0) {
throw new IllegalArgumentException("The configuration value '"
+ ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO.key() + "' must be between 0 and 1. Value given="
+ memoryCutoffRatio);
}
// (2) check min cutoff value
final int minCutoff = config.getInteger(
ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN);
if (minCutoff >= containerMemoryMB) {
throw new IllegalArgumentException("The configuration value '"
+ ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN.key() + "'='" + minCutoff
+ "' is larger than the total container memory " + containerMemoryMB);
}
// (3) check between heap and off-heap
long cutoff = (long) (containerMemoryMB * memoryCutoffRatio);
if (cutoff < minCutoff) {
cutoff = minCutoff;
}
return cutoff;
} | [
"public",
"static",
"long",
"calculateCutoffMB",
"(",
"Configuration",
"config",
",",
"long",
"containerMemoryMB",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"containerMemoryMB",
">",
"0",
")",
";",
"// (1) check cutoff ratio",
"final",
"float",
"memoryCuto... | Calcuate cutoff memory size used by container, it will throw an {@link IllegalArgumentException}
if the config is invalid or return the cutoff value if valid.
@param config The Flink configuration.
@param containerMemoryMB The size of the complete container, in megabytes.
@return cutoff memory size used by container. | [
"Calcuate",
"cutoff",
"memory",
"size",
"used",
"by",
"container",
"it",
"will",
"throw",
"an",
"{",
"@link",
"IllegalArgumentException",
"}",
"if",
"the",
"config",
"is",
"invalid",
"or",
"return",
"the",
"cutoff",
"value",
"if",
"valid",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/ContaineredTaskManagerParameters.java#L114-L143 |
stevespringett/Alpine | alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java | LdapConnectionWrapper.searchForSingleUsername | public SearchResult searchForSingleUsername(final DirContext ctx, final String username) throws NamingException {
final List<SearchResult> results = searchForUsername(ctx, username);
if (results == null || results.size() == 0) {
LOGGER.debug("Search for (" + username + ") did not produce any results");
return null;
} else if (results.size() == 1) {
LOGGER.debug("Search for (" + username + ") produced a result");
return results.get(0);
} else {
throw new NamingException("Multiple entries in the directory contain the same username. This scenario is not supported");
}
} | java | public SearchResult searchForSingleUsername(final DirContext ctx, final String username) throws NamingException {
final List<SearchResult> results = searchForUsername(ctx, username);
if (results == null || results.size() == 0) {
LOGGER.debug("Search for (" + username + ") did not produce any results");
return null;
} else if (results.size() == 1) {
LOGGER.debug("Search for (" + username + ") produced a result");
return results.get(0);
} else {
throw new NamingException("Multiple entries in the directory contain the same username. This scenario is not supported");
}
} | [
"public",
"SearchResult",
"searchForSingleUsername",
"(",
"final",
"DirContext",
"ctx",
",",
"final",
"String",
"username",
")",
"throws",
"NamingException",
"{",
"final",
"List",
"<",
"SearchResult",
">",
"results",
"=",
"searchForUsername",
"(",
"ctx",
",",
"use... | Performs a search for the specified username. Internally, this method queries on
the attribute defined by {@link Config.AlpineKey#LDAP_ATTRIBUTE_NAME}.
@param ctx the DirContext to use
@param username the username to query on
@return a list of SearchResult objects. If the username is found, the list should typically only contain one result.
@throws NamingException if an exception is thrown
@since 1.4.0 | [
"Performs",
"a",
"search",
"for",
"the",
"specified",
"username",
".",
"Internally",
"this",
"method",
"queries",
"on",
"the",
"attribute",
"defined",
"by",
"{"
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L203-L214 |
qiujuer/Genius-Android | caprice/kit-reflect/src/main/java/net/qiujuer/genius/kit/reflect/Reflector.java | Reflector.replaceTypeActualArgument | private static Type replaceTypeActualArgument(Type inType, final Map<Type, Type> resolvedTypes) {
Type outType = inType;
if (inType instanceof ParameterizedType) {
final ParameterizedType finalType = ((ParameterizedType) inType);
final Type[] actualArgs = ((ParameterizedType) inType).getActualTypeArguments();
for (int i = 0; i < actualArgs.length; i++) {
Type argType = actualArgs[i];
while (resolvedTypes.containsKey(argType)) {
argType = resolvedTypes.get(argType);
}
// Do replace ActualArgument
argType = replaceTypeActualArgument(argType, resolvedTypes);
actualArgs[i] = argType;
}
outType = new ParameterizeTypeActualArgsDelegate(finalType, actualArgs);
}
return outType;
} | java | private static Type replaceTypeActualArgument(Type inType, final Map<Type, Type> resolvedTypes) {
Type outType = inType;
if (inType instanceof ParameterizedType) {
final ParameterizedType finalType = ((ParameterizedType) inType);
final Type[] actualArgs = ((ParameterizedType) inType).getActualTypeArguments();
for (int i = 0; i < actualArgs.length; i++) {
Type argType = actualArgs[i];
while (resolvedTypes.containsKey(argType)) {
argType = resolvedTypes.get(argType);
}
// Do replace ActualArgument
argType = replaceTypeActualArgument(argType, resolvedTypes);
actualArgs[i] = argType;
}
outType = new ParameterizeTypeActualArgsDelegate(finalType, actualArgs);
}
return outType;
} | [
"private",
"static",
"Type",
"replaceTypeActualArgument",
"(",
"Type",
"inType",
",",
"final",
"Map",
"<",
"Type",
",",
"Type",
">",
"resolvedTypes",
")",
"{",
"Type",
"outType",
"=",
"inType",
";",
"if",
"(",
"inType",
"instanceof",
"ParameterizedType",
")",
... | Replace {@link ParameterizedType#getActualTypeArguments()} method return value.
In this we use {@link ParameterizeTypeActualArgsDelegate} delegate {@link ParameterizedType};
Let {@link ParameterizedType#getActualTypeArguments()} return really class type.
@param inType Type
@param resolvedTypes a Map<Type, Type>, {@link #getActualTypeArguments(Class, Class)}
@return {@link ParameterizeTypeActualArgsDelegate} | [
"Replace",
"{",
"@link",
"ParameterizedType#getActualTypeArguments",
"()",
"}",
"method",
"return",
"value",
".",
"In",
"this",
"we",
"use",
"{",
"@link",
"ParameterizeTypeActualArgsDelegate",
"}",
"delegate",
"{",
"@link",
"ParameterizedType",
"}",
";",
"Let",
"{",... | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/kit-reflect/src/main/java/net/qiujuer/genius/kit/reflect/Reflector.java#L773-L795 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java | ParsedScheduleExpression.getNextDayOfWeekInMonth | private int getNextDayOfWeekInMonth(int day, int lastDay, int dayOfWeek)
{
int weekInMonth = day / 7;
for (;;)
{
if (contains(daysOfWeekInMonth, weekInMonth * 7 + dayOfWeek))
{
return day;
}
day++;
if (day > lastDay)
{
return ADVANCE_TO_NEXT_MONTH;
}
if ((day % 7) == 0)
{
weekInMonth++;
}
dayOfWeek = (dayOfWeek + 1) % 7;
}
} | java | private int getNextDayOfWeekInMonth(int day, int lastDay, int dayOfWeek)
{
int weekInMonth = day / 7;
for (;;)
{
if (contains(daysOfWeekInMonth, weekInMonth * 7 + dayOfWeek))
{
return day;
}
day++;
if (day > lastDay)
{
return ADVANCE_TO_NEXT_MONTH;
}
if ((day % 7) == 0)
{
weekInMonth++;
}
dayOfWeek = (dayOfWeek + 1) % 7;
}
} | [
"private",
"int",
"getNextDayOfWeekInMonth",
"(",
"int",
"day",
",",
"int",
"lastDay",
",",
"int",
"dayOfWeek",
")",
"{",
"int",
"weekInMonth",
"=",
"day",
"/",
"7",
";",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"contains",
"(",
"daysOfWeekInMonth",
... | Returns the next day of the month after <tt>day</tt> that satisfies
the lastDayOfWeek constraint.
@param day the current 0-based day of the month
@param lastDay the current 0-based last day of the month
@param dayOfWeek the current 0-based day of the week
@return a value greater than or equal to <tt>day</tt> | [
"Returns",
"the",
"next",
"day",
"of",
"the",
"month",
"after",
"<tt",
">",
"day<",
"/",
"tt",
">",
"that",
"satisfies",
"the",
"lastDayOfWeek",
"constraint",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java#L994-L1018 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.triggerStateTransition | void triggerStateTransition(BasicEvent.QueryState newState,
String identifier)
{
String msg = "{newState: " + newState.getDescription() + ", " +
"info: " + identifier + ", " +
"timestamp: " + getCurrentTimestamp() +
"}";
Event triggeredEvent =
new BasicEvent(Event.EventType.STATE_TRANSITION, msg);
pushEvent(triggeredEvent, false);
} | java | void triggerStateTransition(BasicEvent.QueryState newState,
String identifier)
{
String msg = "{newState: " + newState.getDescription() + ", " +
"info: " + identifier + ", " +
"timestamp: " + getCurrentTimestamp() +
"}";
Event triggeredEvent =
new BasicEvent(Event.EventType.STATE_TRANSITION, msg);
pushEvent(triggeredEvent, false);
} | [
"void",
"triggerStateTransition",
"(",
"BasicEvent",
".",
"QueryState",
"newState",
",",
"String",
"identifier",
")",
"{",
"String",
"msg",
"=",
"\"{newState: \"",
"+",
"newState",
".",
"getDescription",
"(",
")",
"+",
"\", \"",
"+",
"\"info: \"",
"+",
"identifi... | Triggers a state transition event to @newState with an identifier
(eg, requestId, jobUUID, etc)
@param newState new state
@param identifier event id | [
"Triggers",
"a",
"state",
"transition",
"event",
"to",
"@newState",
"with",
"an",
"identifier",
"(",
"eg",
"requestId",
"jobUUID",
"etc",
")"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L281-L293 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/core/contents/ContentsDao.java | ContentsDao.getBoundingBox | public BoundingBox getBoundingBox(Projection projection, String table) {
BoundingBox boundingBox = null;
try {
Contents contents = queryForId(table);
boundingBox = contents.getBoundingBox(projection);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to query for contents of table: " + table, e);
}
return boundingBox;
} | java | public BoundingBox getBoundingBox(Projection projection, String table) {
BoundingBox boundingBox = null;
try {
Contents contents = queryForId(table);
boundingBox = contents.getBoundingBox(projection);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to query for contents of table: " + table, e);
}
return boundingBox;
} | [
"public",
"BoundingBox",
"getBoundingBox",
"(",
"Projection",
"projection",
",",
"String",
"table",
")",
"{",
"BoundingBox",
"boundingBox",
"=",
"null",
";",
"try",
"{",
"Contents",
"contents",
"=",
"queryForId",
"(",
"table",
")",
";",
"boundingBox",
"=",
"co... | Get the bounding box for the table in the provided projection
@param projection
desired bounding box projection
@param table
table name
@return bounding box
@since 3.1.0 | [
"Get",
"the",
"bounding",
"box",
"for",
"the",
"table",
"in",
"the",
"provided",
"projection"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/core/contents/ContentsDao.java#L253-L266 |
ltearno/hexa.tools | hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java | hqlParser.innerSubQuery | public final hqlParser.innerSubQuery_return innerSubQuery() throws RecognitionException {
hqlParser.innerSubQuery_return retval = new hqlParser.innerSubQuery_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope queryRule300 =null;
RewriteRuleSubtreeStream stream_queryRule=new RewriteRuleSubtreeStream(adaptor,"rule queryRule");
try {
// hql.g:686:2: ( queryRule -> ^( QUERY[\"query\"] queryRule ) )
// hql.g:686:4: queryRule
{
pushFollow(FOLLOW_queryRule_in_innerSubQuery3521);
queryRule300=queryRule();
state._fsp--;
stream_queryRule.add(queryRule300.getTree());
// AST REWRITE
// elements: queryRule
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 687:2: -> ^( QUERY[\"query\"] queryRule )
{
// hql.g:687:5: ^( QUERY[\"query\"] queryRule )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(QUERY, "query"), root_1);
adaptor.addChild(root_1, stream_queryRule.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} | java | public final hqlParser.innerSubQuery_return innerSubQuery() throws RecognitionException {
hqlParser.innerSubQuery_return retval = new hqlParser.innerSubQuery_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope queryRule300 =null;
RewriteRuleSubtreeStream stream_queryRule=new RewriteRuleSubtreeStream(adaptor,"rule queryRule");
try {
// hql.g:686:2: ( queryRule -> ^( QUERY[\"query\"] queryRule ) )
// hql.g:686:4: queryRule
{
pushFollow(FOLLOW_queryRule_in_innerSubQuery3521);
queryRule300=queryRule();
state._fsp--;
stream_queryRule.add(queryRule300.getTree());
// AST REWRITE
// elements: queryRule
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 687:2: -> ^( QUERY[\"query\"] queryRule )
{
// hql.g:687:5: ^( QUERY[\"query\"] queryRule )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(QUERY, "query"), root_1);
adaptor.addChild(root_1, stream_queryRule.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} | [
"public",
"final",
"hqlParser",
".",
"innerSubQuery_return",
"innerSubQuery",
"(",
")",
"throws",
"RecognitionException",
"{",
"hqlParser",
".",
"innerSubQuery_return",
"retval",
"=",
"new",
"hqlParser",
".",
"innerSubQuery_return",
"(",
")",
";",
"retval",
".",
"st... | hql.g:685:1: innerSubQuery : queryRule -> ^( QUERY[\"query\"] queryRule ) ; | [
"hql",
".",
"g",
":",
"685",
":",
"1",
":",
"innerSubQuery",
":",
"queryRule",
"-",
">",
"^",
"(",
"QUERY",
"[",
"\\",
"query",
"\\",
"]",
"queryRule",
")",
";"
] | train | https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java#L9683-L9745 |
loadimpact/loadimpact-sdk-java | src/main/java/com/loadimpact/util/ObjectUtils.java | ObjectUtils.newInstance | public static <T> T newInstance(Constructor<T> constructor, Object... args) {
try {
return constructor.newInstance(args);
} catch (Exception e) {
throw new ClientException(e);
}
} | java | public static <T> T newInstance(Constructor<T> constructor, Object... args) {
try {
return constructor.newInstance(args);
} catch (Exception e) {
throw new ClientException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Constructor",
"<",
"T",
">",
"constructor",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"return",
"constructor",
".",
"newInstance",
"(",
"args",
")",
";",
"}",
"catch",
"(",
"Excepti... | Invokes a constructor and hides all checked exceptions.
@param constructor the constructor
@param args zero, one or more arguments
@param <T> target type
@return a new object | [
"Invokes",
"a",
"constructor",
"and",
"hides",
"all",
"checked",
"exceptions",
"."
] | train | https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/ObjectUtils.java#L67-L73 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/automata/random/RandomICAutomatonGenerator.java | RandomICAutomatonGenerator.generateICDeterministicAutomaton | public <I, A extends MutableDeterministic<?, I, ?, ? super SP, ? super TP>> A generateICDeterministicAutomaton(int numStates,
Alphabet<I> alphabet,
AutomatonCreator<? extends A, I> creator,
Random r) {
A result = creator.createAutomaton(alphabet, numStates);
return generateICDeterministicAutomaton(numStates, alphabet, result, r);
} | java | public <I, A extends MutableDeterministic<?, I, ?, ? super SP, ? super TP>> A generateICDeterministicAutomaton(int numStates,
Alphabet<I> alphabet,
AutomatonCreator<? extends A, I> creator,
Random r) {
A result = creator.createAutomaton(alphabet, numStates);
return generateICDeterministicAutomaton(numStates, alphabet, result, r);
} | [
"public",
"<",
"I",
",",
"A",
"extends",
"MutableDeterministic",
"<",
"?",
",",
"I",
",",
"?",
",",
"?",
"super",
"SP",
",",
"?",
"super",
"TP",
">",
">",
"A",
"generateICDeterministicAutomaton",
"(",
"int",
"numStates",
",",
"Alphabet",
"<",
"I",
">",... | Generates an initially-connected (IC) deterministic automaton with the given parameters. The resulting automaton
is instantiated using the given {@code creator}. Note that the resulting automaton will <b>not</b> be minimized.
@param numStates
the number of states of the resulting automaton
@param alphabet
the input alphabet of the resulting automaton
@param creator
an {@link AutomatonCreator} for instantiating the result automaton
@param r
the randomness source
@return a randomly-generated IC deterministic automaton | [
"Generates",
"an",
"initially",
"-",
"connected",
"(",
"IC",
")",
"deterministic",
"automaton",
"with",
"the",
"given",
"parameters",
".",
"The",
"resulting",
"automaton",
"is",
"instantiated",
"using",
"the",
"given",
"{",
"@code",
"creator",
"}",
".",
"Note"... | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/random/RandomICAutomatonGenerator.java#L235-L241 |
larsga/Duke | duke-core/src/main/java/no/priv/garshol/duke/ConfigLoader.java | ConfigLoader.loadFromString | public static Configuration loadFromString(String config)
throws IOException, SAXException {
ConfigurationImpl cfg = new ConfigurationImpl();
XMLReader parser = XMLReaderFactory.createXMLReader();
parser.setContentHandler(new ConfigHandler(cfg, null));
Reader reader = new StringReader(config);
parser.parse(new InputSource(reader));
return cfg;
} | java | public static Configuration loadFromString(String config)
throws IOException, SAXException {
ConfigurationImpl cfg = new ConfigurationImpl();
XMLReader parser = XMLReaderFactory.createXMLReader();
parser.setContentHandler(new ConfigHandler(cfg, null));
Reader reader = new StringReader(config);
parser.parse(new InputSource(reader));
return cfg;
} | [
"public",
"static",
"Configuration",
"loadFromString",
"(",
"String",
"config",
")",
"throws",
"IOException",
",",
"SAXException",
"{",
"ConfigurationImpl",
"cfg",
"=",
"new",
"ConfigurationImpl",
"(",
")",
";",
"XMLReader",
"parser",
"=",
"XMLReaderFactory",
".",
... | Loads the configuration XML from the given string.
@since 1.3 | [
"Loads",
"the",
"configuration",
"XML",
"from",
"the",
"given",
"string",
"."
] | train | https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-core/src/main/java/no/priv/garshol/duke/ConfigLoader.java#L58-L67 |
alkacon/opencms-core | src/org/opencms/ui/A_CmsUI.java | A_CmsUI.openPageOrWarn | public void openPageOrWarn(String link, String target, final String warning) {
m_windowExtension.open(link, target, new Runnable() {
public void run() {
Notification.show(warning, Type.ERROR_MESSAGE);
}
});
} | java | public void openPageOrWarn(String link, String target, final String warning) {
m_windowExtension.open(link, target, new Runnable() {
public void run() {
Notification.show(warning, Type.ERROR_MESSAGE);
}
});
} | [
"public",
"void",
"openPageOrWarn",
"(",
"String",
"link",
",",
"String",
"target",
",",
"final",
"String",
"warning",
")",
"{",
"m_windowExtension",
".",
"open",
"(",
"link",
",",
"target",
",",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
... | Tries to open a new browser window, and shows a warning if opening the window fails (usually because of popup blockers).<p>
@param link the URL to open in the new window
@param target the target window name
@param warning the warning to show if opening the window fails | [
"Tries",
"to",
"open",
"a",
"new",
"browser",
"window",
"and",
"shows",
"a",
"warning",
"if",
"opening",
"the",
"window",
"fails",
"(",
"usually",
"because",
"of",
"popup",
"blockers",
")",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/A_CmsUI.java#L242-L251 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/binary/FactoryThresholdBinary.java | FactoryThresholdBinary.blockMean | public static <T extends ImageGray<T>>
InputToBinary<T> blockMean(ConfigLength regionWidth, double scale , boolean down, boolean thresholdFromLocalBlocks,
Class<T> inputType) {
if( BOverrideFactoryThresholdBinary.blockMean != null )
return BOverrideFactoryThresholdBinary.blockMean.handle(regionWidth, scale, down,
thresholdFromLocalBlocks, inputType);
BlockProcessor processor;
if( inputType == GrayU8.class )
processor = new ThresholdBlockMean_U8(scale,down);
else
processor = new ThresholdBlockMean_F32((float)scale,down);
if( BoofConcurrency.USE_CONCURRENT ) {
return new ThresholdBlock_MT(processor, regionWidth, thresholdFromLocalBlocks, inputType);
} else {
return new ThresholdBlock(processor, regionWidth, thresholdFromLocalBlocks, inputType);
}
} | java | public static <T extends ImageGray<T>>
InputToBinary<T> blockMean(ConfigLength regionWidth, double scale , boolean down, boolean thresholdFromLocalBlocks,
Class<T> inputType) {
if( BOverrideFactoryThresholdBinary.blockMean != null )
return BOverrideFactoryThresholdBinary.blockMean.handle(regionWidth, scale, down,
thresholdFromLocalBlocks, inputType);
BlockProcessor processor;
if( inputType == GrayU8.class )
processor = new ThresholdBlockMean_U8(scale,down);
else
processor = new ThresholdBlockMean_F32((float)scale,down);
if( BoofConcurrency.USE_CONCURRENT ) {
return new ThresholdBlock_MT(processor, regionWidth, thresholdFromLocalBlocks, inputType);
} else {
return new ThresholdBlock(processor, regionWidth, thresholdFromLocalBlocks, inputType);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"InputToBinary",
"<",
"T",
">",
"blockMean",
"(",
"ConfigLength",
"regionWidth",
",",
"double",
"scale",
",",
"boolean",
"down",
",",
"boolean",
"thresholdFromLocalBlocks",
",",
"Class",... | Applies a non-overlapping block mean threshold
@see ThresholdBlockMean
@param scale Scale factor adjust for threshold. 1.0 means no change.
@param down Should it threshold up or down.
@param regionWidth Approximate size of block region
@param inputType Type of input image
@return Filter to binary | [
"Applies",
"a",
"non",
"-",
"overlapping",
"block",
"mean",
"threshold"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/binary/FactoryThresholdBinary.java#L186-L204 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.deleteKeyAsync | public Observable<DeletedKeyBundle> deleteKeyAsync(String vaultBaseUrl, String keyName) {
return deleteKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<DeletedKeyBundle>, DeletedKeyBundle>() {
@Override
public DeletedKeyBundle call(ServiceResponse<DeletedKeyBundle> response) {
return response.body();
}
});
} | java | public Observable<DeletedKeyBundle> deleteKeyAsync(String vaultBaseUrl, String keyName) {
return deleteKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<DeletedKeyBundle>, DeletedKeyBundle>() {
@Override
public DeletedKeyBundle call(ServiceResponse<DeletedKeyBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DeletedKeyBundle",
">",
"deleteKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
")",
"{",
"return",
"deleteKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
")",
".",
"map",
"(",
"new",
"Func1",
"<"... | Deletes a key of any type from storage in Azure Key Vault.
The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the keys/delete permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DeletedKeyBundle object | [
"Deletes",
"a",
"key",
"of",
"any",
"type",
"from",
"storage",
"in",
"Azure",
"Key",
"Vault",
".",
"The",
"delete",
"key",
"operation",
"cannot",
"be",
"used",
"to",
"remove",
"individual",
"versions",
"of",
"a",
"key",
".",
"This",
"operation",
"removes",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1114-L1121 |
carewebframework/carewebframework-core | org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSUtil.java | JMSUtil.getMessageSelector | public static String getMessageSelector(String eventName, IPublisherInfo publisherInfo) {
StringBuilder sb = new StringBuilder(
"(JMSType='" + eventName + "' OR JMSType LIKE '" + eventName + ".%') AND (Recipients IS NULL");
if (publisherInfo != null) {
for (String selector : publisherInfo.getAttributes().values()) {
addRecipientSelector(selector, sb);
}
}
sb.append(')');
return sb.toString();
} | java | public static String getMessageSelector(String eventName, IPublisherInfo publisherInfo) {
StringBuilder sb = new StringBuilder(
"(JMSType='" + eventName + "' OR JMSType LIKE '" + eventName + ".%') AND (Recipients IS NULL");
if (publisherInfo != null) {
for (String selector : publisherInfo.getAttributes().values()) {
addRecipientSelector(selector, sb);
}
}
sb.append(')');
return sb.toString();
} | [
"public",
"static",
"String",
"getMessageSelector",
"(",
"String",
"eventName",
",",
"IPublisherInfo",
"publisherInfo",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"(JMSType='\"",
"+",
"eventName",
"+",
"\"' OR JMSType LIKE '\"",
"+",
"eventNa... | Creates a message selector which considers JMSType and recipients properties.
@param eventName The event name (i.e. DESKTOP.LOCK).
@param publisherInfo Info on the publisher. If null, then no recipients properties are added.
@return The message selector. | [
"Creates",
"a",
"message",
"selector",
"which",
"considers",
"JMSType",
"and",
"recipients",
"properties",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSUtil.java#L97-L109 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java | RecommendationsInner.getRuleDetailsByWebAppAsync | public Observable<RecommendationRuleInner> getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name) {
return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name).map(new Func1<ServiceResponse<RecommendationRuleInner>, RecommendationRuleInner>() {
@Override
public RecommendationRuleInner call(ServiceResponse<RecommendationRuleInner> response) {
return response.body();
}
});
} | java | public Observable<RecommendationRuleInner> getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name) {
return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name).map(new Func1<ServiceResponse<RecommendationRuleInner>, RecommendationRuleInner>() {
@Override
public RecommendationRuleInner call(ServiceResponse<RecommendationRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RecommendationRuleInner",
">",
"getRuleDetailsByWebAppAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"siteName",
",",
"String",
"name",
")",
"{",
"return",
"getRuleDetailsByWebAppWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Get a recommendation rule for an app.
Get a recommendation rule for an app.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Name of the app.
@param name Name of the recommendation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RecommendationRuleInner object | [
"Get",
"a",
"recommendation",
"rule",
"for",
"an",
"app",
".",
"Get",
"a",
"recommendation",
"rule",
"for",
"an",
"app",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1239-L1246 |
SonarSource/sonarqube | server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java | LogbackHelper.apply | public LoggerContext apply(LogLevelConfig logLevelConfig, Props props) {
if (!ROOT_LOGGER_NAME.equals(logLevelConfig.getRootLoggerName())) {
throw new IllegalArgumentException("Value of LogLevelConfig#rootLoggerName must be \"" + ROOT_LOGGER_NAME + "\"");
}
LoggerContext rootContext = getRootContext();
logLevelConfig.getConfiguredByProperties().forEach((key, value) -> applyLevelByProperty(props, rootContext.getLogger(key), value));
logLevelConfig.getConfiguredByHardcodedLevel().forEach((key, value) -> applyHardcodedLevel(rootContext, key, value));
Level propertyValueAsLevel = getPropertyValueAsLevel(props, SONAR_LOG_LEVEL_PROPERTY);
boolean traceGloballyEnabled = propertyValueAsLevel == Level.TRACE;
logLevelConfig.getOffUnlessTrace().forEach(logger -> applyHardUnlessTrace(rootContext, logger, traceGloballyEnabled));
return rootContext;
} | java | public LoggerContext apply(LogLevelConfig logLevelConfig, Props props) {
if (!ROOT_LOGGER_NAME.equals(logLevelConfig.getRootLoggerName())) {
throw new IllegalArgumentException("Value of LogLevelConfig#rootLoggerName must be \"" + ROOT_LOGGER_NAME + "\"");
}
LoggerContext rootContext = getRootContext();
logLevelConfig.getConfiguredByProperties().forEach((key, value) -> applyLevelByProperty(props, rootContext.getLogger(key), value));
logLevelConfig.getConfiguredByHardcodedLevel().forEach((key, value) -> applyHardcodedLevel(rootContext, key, value));
Level propertyValueAsLevel = getPropertyValueAsLevel(props, SONAR_LOG_LEVEL_PROPERTY);
boolean traceGloballyEnabled = propertyValueAsLevel == Level.TRACE;
logLevelConfig.getOffUnlessTrace().forEach(logger -> applyHardUnlessTrace(rootContext, logger, traceGloballyEnabled));
return rootContext;
} | [
"public",
"LoggerContext",
"apply",
"(",
"LogLevelConfig",
"logLevelConfig",
",",
"Props",
"props",
")",
"{",
"if",
"(",
"!",
"ROOT_LOGGER_NAME",
".",
"equals",
"(",
"logLevelConfig",
".",
"getRootLoggerName",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IllegalA... | Applies the specified {@link LogLevelConfig} reading the specified {@link Props}.
@throws IllegalArgumentException if the any level specified in a property is not one of {@link #ALLOWED_ROOT_LOG_LEVELS} | [
"Applies",
"the",
"specified",
"{",
"@link",
"LogLevelConfig",
"}",
"reading",
"the",
"specified",
"{",
"@link",
"Props",
"}",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java#L111-L123 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java | FeatureInfoBuilder.buildResultsInfoMessageAndClose | public String buildResultsInfoMessageAndClose(FeatureIndexResults results, double tolerance, LatLng clickLocation) {
return buildResultsInfoMessageAndClose(results, tolerance, clickLocation, null);
} | java | public String buildResultsInfoMessageAndClose(FeatureIndexResults results, double tolerance, LatLng clickLocation) {
return buildResultsInfoMessageAndClose(results, tolerance, clickLocation, null);
} | [
"public",
"String",
"buildResultsInfoMessageAndClose",
"(",
"FeatureIndexResults",
"results",
",",
"double",
"tolerance",
",",
"LatLng",
"clickLocation",
")",
"{",
"return",
"buildResultsInfoMessageAndClose",
"(",
"results",
",",
"tolerance",
",",
"clickLocation",
",",
... | Build a feature results information message and close the results
@param results feature index results
@param tolerance distance tolerance
@param clickLocation map click location
@return results message or null if no results | [
"Build",
"a",
"feature",
"results",
"information",
"message",
"and",
"close",
"the",
"results"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java#L263-L265 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/csv/CsvUtil.java | CsvUtil.getWriter | public static CsvWriter getWriter(File file, Charset charset, boolean isAppend, CsvWriteConfig config) {
return new CsvWriter(file, charset, isAppend, config);
} | java | public static CsvWriter getWriter(File file, Charset charset, boolean isAppend, CsvWriteConfig config) {
return new CsvWriter(file, charset, isAppend, config);
} | [
"public",
"static",
"CsvWriter",
"getWriter",
"(",
"File",
"file",
",",
"Charset",
"charset",
",",
"boolean",
"isAppend",
",",
"CsvWriteConfig",
"config",
")",
"{",
"return",
"new",
"CsvWriter",
"(",
"file",
",",
"charset",
",",
"isAppend",
",",
"config",
")... | 获取CSV生成器(写出器)
@param file File CSV文件
@param charset 编码
@param isAppend 是否追加
@param config 写出配置,null则使用默认配置 | [
"获取CSV生成器(写出器)"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvUtil.java#L86-L88 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.checkBucketName | private void checkBucketName(String name) throws InvalidBucketNameException {
if (name == null) {
throw new InvalidBucketNameException(NULL_STRING, "null bucket name");
}
// Bucket names cannot be no less than 3 and no more than 63 characters long.
if (name.length() < 3 || name.length() > 63) {
String msg = "bucket name must be at least 3 and no more than 63 characters long";
throw new InvalidBucketNameException(name, msg);
}
// Successive periods in bucket names are not allowed.
if (name.matches("\\.\\.")) {
String msg = "bucket name cannot contain successive periods. For more information refer "
+ "http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html";
throw new InvalidBucketNameException(name, msg);
}
// Bucket names should be dns compatible.
if (!name.matches("^[a-z0-9][a-z0-9\\.\\-]+[a-z0-9]$")) {
String msg = "bucket name does not follow Amazon S3 standards. For more information refer "
+ "http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html";
throw new InvalidBucketNameException(name, msg);
}
} | java | private void checkBucketName(String name) throws InvalidBucketNameException {
if (name == null) {
throw new InvalidBucketNameException(NULL_STRING, "null bucket name");
}
// Bucket names cannot be no less than 3 and no more than 63 characters long.
if (name.length() < 3 || name.length() > 63) {
String msg = "bucket name must be at least 3 and no more than 63 characters long";
throw new InvalidBucketNameException(name, msg);
}
// Successive periods in bucket names are not allowed.
if (name.matches("\\.\\.")) {
String msg = "bucket name cannot contain successive periods. For more information refer "
+ "http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html";
throw new InvalidBucketNameException(name, msg);
}
// Bucket names should be dns compatible.
if (!name.matches("^[a-z0-9][a-z0-9\\.\\-]+[a-z0-9]$")) {
String msg = "bucket name does not follow Amazon S3 standards. For more information refer "
+ "http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html";
throw new InvalidBucketNameException(name, msg);
}
} | [
"private",
"void",
"checkBucketName",
"(",
"String",
"name",
")",
"throws",
"InvalidBucketNameException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidBucketNameException",
"(",
"NULL_STRING",
",",
"\"null bucket name\"",
")",
";",
"}",
... | Validates if given bucket name is DNS compatible.
@throws InvalidBucketNameException upon invalid bucket name is given | [
"Validates",
"if",
"given",
"bucket",
"name",
"is",
"DNS",
"compatible",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L759-L781 |
demidenko05/beigesoft-orm | src/main/java/org/beigesoft/orm/service/ASrvOrm.java | ASrvOrm.retrieveListForField | @Override
public final <T> List<T> retrieveListForField(
final Map<String, Object> pAddParam,
final T pEntity, final String pFieldFor) throws Exception {
String whereStr = evalWhereForField(pAddParam, pEntity, pFieldFor);
String query = evalSqlSelect(pAddParam, pEntity.getClass())
+ whereStr + ";";
@SuppressWarnings("unchecked")
Class<T> entityClass = (Class<T>) pEntity.getClass();
return retrieveListByQuery(pAddParam, entityClass, query);
} | java | @Override
public final <T> List<T> retrieveListForField(
final Map<String, Object> pAddParam,
final T pEntity, final String pFieldFor) throws Exception {
String whereStr = evalWhereForField(pAddParam, pEntity, pFieldFor);
String query = evalSqlSelect(pAddParam, pEntity.getClass())
+ whereStr + ";";
@SuppressWarnings("unchecked")
Class<T> entityClass = (Class<T>) pEntity.getClass();
return retrieveListByQuery(pAddParam, entityClass, query);
} | [
"@",
"Override",
"public",
"final",
"<",
"T",
">",
"List",
"<",
"T",
">",
"retrieveListForField",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"pAddParam",
",",
"final",
"T",
"pEntity",
",",
"final",
"String",
"pFieldFor",
")",
"throws",
"Exce... | <p>Entity's lists with filter "field" (e.g. invoice lines for invoice).</p>
@param <T> - type of entity
@param pAddParam additional param, e.g. already retrieved TableSql
@param pEntity - Entity e.g. an invoice line with filled invoice
@param pFieldFor - Field For name e.g. "invoice"
@return list of business objects or empty list, not null
@throws Exception - an exception | [
"<p",
">",
"Entity",
"s",
"lists",
"with",
"filter",
"field",
"(",
"e",
".",
"g",
".",
"invoice",
"lines",
"for",
"invoice",
")",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-orm/blob/f1b2c70701a111741a436911ca24ef9d38eba0b9/src/main/java/org/beigesoft/orm/service/ASrvOrm.java#L379-L389 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java | DynamicReportBuilder.addField | public DynamicReportBuilder addField(String name, String className) {
return addField(new ColumnProperty(name, className));
} | java | public DynamicReportBuilder addField(String name, String className) {
return addField(new ColumnProperty(name, className));
} | [
"public",
"DynamicReportBuilder",
"addField",
"(",
"String",
"name",
",",
"String",
"className",
")",
"{",
"return",
"addField",
"(",
"new",
"ColumnProperty",
"(",
"name",
",",
"className",
")",
")",
";",
"}"
] | Registers a field that is not necesary bound to a column, it can be used
in a custom expression
@param name
@param className
@return | [
"Registers",
"a",
"field",
"that",
"is",
"not",
"necesary",
"bound",
"to",
"a",
"column",
"it",
"can",
"be",
"used",
"in",
"a",
"custom",
"expression"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L909-L911 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.andLessThan | public ZealotKhala andLessThan(String field, Object value) {
return this.doNormal(ZealotConst.AND_PREFIX, field, value, ZealotConst.LT_SUFFIX, true);
} | java | public ZealotKhala andLessThan(String field, Object value) {
return this.doNormal(ZealotConst.AND_PREFIX, field, value, ZealotConst.LT_SUFFIX, true);
} | [
"public",
"ZealotKhala",
"andLessThan",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"return",
"this",
".",
"doNormal",
"(",
"ZealotConst",
".",
"AND_PREFIX",
",",
"field",
",",
"value",
",",
"ZealotConst",
".",
"LT_SUFFIX",
",",
"true",
")",
... | 生成带" AND "前缀小于查询的SQL片段.
@param field 数据库字段
@param value 值
@return ZealotKhala实例 | [
"生成带",
"AND",
"前缀小于查询的SQL片段",
"."
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L732-L734 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.paymentMean_deferredPaymentAccount_id_PUT | public void paymentMean_deferredPaymentAccount_id_PUT(Long id, OvhDeferredPaymentAccount body) throws IOException {
String qPath = "/me/paymentMean/deferredPaymentAccount/{id}";
StringBuilder sb = path(qPath, id);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void paymentMean_deferredPaymentAccount_id_PUT(Long id, OvhDeferredPaymentAccount body) throws IOException {
String qPath = "/me/paymentMean/deferredPaymentAccount/{id}";
StringBuilder sb = path(qPath, id);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"paymentMean_deferredPaymentAccount_id_PUT",
"(",
"Long",
"id",
",",
"OvhDeferredPaymentAccount",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/paymentMean/deferredPaymentAccount/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",... | Alter this object properties
REST: PUT /me/paymentMean/deferredPaymentAccount/{id}
@param body [required] New object properties
@param id [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L593-L597 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.evaluateAutoScaleAsync | public Observable<AutoScaleRun> evaluateAutoScaleAsync(String poolId, String autoScaleFormula) {
return evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula).map(new Func1<ServiceResponseWithHeaders<AutoScaleRun, PoolEvaluateAutoScaleHeaders>, AutoScaleRun>() {
@Override
public AutoScaleRun call(ServiceResponseWithHeaders<AutoScaleRun, PoolEvaluateAutoScaleHeaders> response) {
return response.body();
}
});
} | java | public Observable<AutoScaleRun> evaluateAutoScaleAsync(String poolId, String autoScaleFormula) {
return evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula).map(new Func1<ServiceResponseWithHeaders<AutoScaleRun, PoolEvaluateAutoScaleHeaders>, AutoScaleRun>() {
@Override
public AutoScaleRun call(ServiceResponseWithHeaders<AutoScaleRun, PoolEvaluateAutoScaleHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AutoScaleRun",
">",
"evaluateAutoScaleAsync",
"(",
"String",
"poolId",
",",
"String",
"autoScaleFormula",
")",
"{",
"return",
"evaluateAutoScaleWithServiceResponseAsync",
"(",
"poolId",
",",
"autoScaleFormula",
")",
".",
"map",
"(",
"new"... | Gets the result of evaluating an automatic scaling formula on the pool.
This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula.
@param poolId The ID of the pool on which to evaluate the automatic scaling formula.
@param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling).
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AutoScaleRun object | [
"Gets",
"the",
"result",
"of",
"evaluating",
"an",
"automatic",
"scaling",
"formula",
"on",
"the",
"pool",
".",
"This",
"API",
"is",
"primarily",
"for",
"validating",
"an",
"autoscale",
"formula",
"as",
"it",
"simply",
"returns",
"the",
"result",
"without",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L2536-L2543 |
RKumsher/utils | src/main/java/com/github/rkumsher/date/RandomDateUtils.java | RandomDateUtils.randomLocalDate | public static LocalDate randomLocalDate(LocalDate startInclusive, LocalDate endExclusive) {
checkArgument(startInclusive != null, "Start must be non-null");
checkArgument(endExclusive != null, "End must be non-null");
Instant startInstant = startInclusive.atStartOfDay().toInstant(UTC_OFFSET);
Instant endInstant = endExclusive.atStartOfDay().toInstant(UTC_OFFSET);
Instant instant = randomInstant(startInstant, endInstant);
return instant.atZone(UTC).toLocalDate();
} | java | public static LocalDate randomLocalDate(LocalDate startInclusive, LocalDate endExclusive) {
checkArgument(startInclusive != null, "Start must be non-null");
checkArgument(endExclusive != null, "End must be non-null");
Instant startInstant = startInclusive.atStartOfDay().toInstant(UTC_OFFSET);
Instant endInstant = endExclusive.atStartOfDay().toInstant(UTC_OFFSET);
Instant instant = randomInstant(startInstant, endInstant);
return instant.atZone(UTC).toLocalDate();
} | [
"public",
"static",
"LocalDate",
"randomLocalDate",
"(",
"LocalDate",
"startInclusive",
",",
"LocalDate",
"endExclusive",
")",
"{",
"checkArgument",
"(",
"startInclusive",
"!=",
"null",
",",
"\"Start must be non-null\"",
")",
";",
"checkArgument",
"(",
"endExclusive",
... | Returns a random {@link LocalDate} within the specified range.
@param startInclusive the earliest {@link LocalDate} that can be returned
@param endExclusive the upper bound (not included)
@return the random {@link LocalDate}
@throws IllegalArgumentException if startInclusive or endExclusive are null or if endExclusive
is earlier than startInclusive | [
"Returns",
"a",
"random",
"{",
"@link",
"LocalDate",
"}",
"within",
"the",
"specified",
"range",
"."
] | train | https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L306-L313 |
vorburger/MariaDB4j | mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java | DB.prepareDirectories | protected void prepareDirectories() throws ManagedProcessException {
baseDir = Util.getDirectory(configuration.getBaseDir());
libDir = Util.getDirectory(configuration.getLibDir());
try {
String dataDirPath = configuration.getDataDir();
if (Util.isTemporaryDirectory(dataDirPath)) {
FileUtils.deleteDirectory(new File(dataDirPath));
}
dataDir = Util.getDirectory(dataDirPath);
} catch (Exception e) {
throw new ManagedProcessException("An error occurred while preparing the data directory", e);
}
} | java | protected void prepareDirectories() throws ManagedProcessException {
baseDir = Util.getDirectory(configuration.getBaseDir());
libDir = Util.getDirectory(configuration.getLibDir());
try {
String dataDirPath = configuration.getDataDir();
if (Util.isTemporaryDirectory(dataDirPath)) {
FileUtils.deleteDirectory(new File(dataDirPath));
}
dataDir = Util.getDirectory(dataDirPath);
} catch (Exception e) {
throw new ManagedProcessException("An error occurred while preparing the data directory", e);
}
} | [
"protected",
"void",
"prepareDirectories",
"(",
")",
"throws",
"ManagedProcessException",
"{",
"baseDir",
"=",
"Util",
".",
"getDirectory",
"(",
"configuration",
".",
"getBaseDir",
"(",
")",
")",
";",
"libDir",
"=",
"Util",
".",
"getDirectory",
"(",
"configurati... | If the data directory specified in the configuration is a temporary directory, this deletes
any previous version. It also makes sure that the directory exists.
@throws ManagedProcessException if something fatal went wrong | [
"If",
"the",
"data",
"directory",
"specified",
"in",
"the",
"configuration",
"is",
"a",
"temporary",
"directory",
"this",
"deletes",
"any",
"previous",
"version",
".",
"It",
"also",
"makes",
"sure",
"that",
"the",
"directory",
"exists",
"."
] | train | https://github.com/vorburger/MariaDB4j/blob/ddc7aa2a3294c9c56b1127de11949fb33a81ad7b/mariaDB4j-core/src/main/java/ch/vorburger/mariadb4j/DB.java#L376-L388 |
ACRA/acra | annotationprocessor/src/main/java/org/acra/processor/util/Strings.java | Strings.writeClass | public static void writeClass(@NonNull Filer filer, @NonNull TypeSpec typeSpec) throws IOException {
JavaFile.builder(PACKAGE, typeSpec)
.skipJavaLangImports(true)
.indent(" ")
.addFileComment("Copyright (c) " + Calendar.getInstance().get(Calendar.YEAR) + "\n\n" +
"Licensed under the Apache License, Version 2.0 (the \"License\");\n" +
"you may not use this file except in compliance with the License.\n\n" +
"http://www.apache.org/licenses/LICENSE-2.0\n\n" +
"Unless required by applicable law or agreed to in writing, software\n" +
"distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
"See the License for the specific language governing permissions and\n" +
"limitations under the License.")
.build()
.writeTo(filer);
} | java | public static void writeClass(@NonNull Filer filer, @NonNull TypeSpec typeSpec) throws IOException {
JavaFile.builder(PACKAGE, typeSpec)
.skipJavaLangImports(true)
.indent(" ")
.addFileComment("Copyright (c) " + Calendar.getInstance().get(Calendar.YEAR) + "\n\n" +
"Licensed under the Apache License, Version 2.0 (the \"License\");\n" +
"you may not use this file except in compliance with the License.\n\n" +
"http://www.apache.org/licenses/LICENSE-2.0\n\n" +
"Unless required by applicable law or agreed to in writing, software\n" +
"distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
"See the License for the specific language governing permissions and\n" +
"limitations under the License.")
.build()
.writeTo(filer);
} | [
"public",
"static",
"void",
"writeClass",
"(",
"@",
"NonNull",
"Filer",
"filer",
",",
"@",
"NonNull",
"TypeSpec",
"typeSpec",
")",
"throws",
"IOException",
"{",
"JavaFile",
".",
"builder",
"(",
"PACKAGE",
",",
"typeSpec",
")",
".",
"skipJavaLangImports",
"(",
... | Writes the given class to a respective file in the configuration package
@param filer filer to write to
@param typeSpec the class
@throws IOException if writing fails | [
"Writes",
"the",
"given",
"class",
"to",
"a",
"respective",
"file",
"in",
"the",
"configuration",
"package"
] | train | https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/annotationprocessor/src/main/java/org/acra/processor/util/Strings.java#L61-L76 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.