repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/NonCompliantResource.java | NonCompliantResource.withAdditionalInfo | public NonCompliantResource withAdditionalInfo(java.util.Map<String, String> additionalInfo) {
setAdditionalInfo(additionalInfo);
return this;
} | java | public NonCompliantResource withAdditionalInfo(java.util.Map<String, String> additionalInfo) {
setAdditionalInfo(additionalInfo);
return this;
} | [
"public",
"NonCompliantResource",
"withAdditionalInfo",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"additionalInfo",
")",
"{",
"setAdditionalInfo",
"(",
"additionalInfo",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Additional information about the non-compliant resource.
</p>
@param additionalInfo
Additional information about the non-compliant resource.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Additional",
"information",
"about",
"the",
"non",
"-",
"compliant",
"resource",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/NonCompliantResource.java#L181-L184 |
kiegroup/jbpm | jbpm-bpmn2-emfextmodel/src/main/java/org/omg/spec/bpmn/non/normative/color/util/ColorSwitch.java | ColorSwitch.doSwitch | protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case ColorPackage.DOCUMENT_ROOT: {
DocumentRoot documentRoot = (DocumentRoot)theEObject;
T result = caseDocumentRoot(documentRoot);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
} | java | protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case ColorPackage.DOCUMENT_ROOT: {
DocumentRoot documentRoot = (DocumentRoot)theEObject;
T result = caseDocumentRoot(documentRoot);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
} | [
"protected",
"T",
"doSwitch",
"(",
"int",
"classifierID",
",",
"EObject",
"theEObject",
")",
"{",
"switch",
"(",
"classifierID",
")",
"{",
"case",
"ColorPackage",
".",
"DOCUMENT_ROOT",
":",
"{",
"DocumentRoot",
"documentRoot",
"=",
"(",
"DocumentRoot",
")",
"t... | Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
<!-- begin-user-doc -->
<!-- end-user-doc -->
@return the first non-null result returned by a <code>caseXXX</code> call.
@generated | [
"Calls",
"<code",
">",
"caseXXX<",
"/",
"code",
">",
"for",
"each",
"class",
"of",
"the",
"model",
"until",
"one",
"returns",
"a",
"non",
"null",
"result",
";",
"it",
"yields",
"that",
"result",
".",
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--"... | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-bpmn2-emfextmodel/src/main/java/org/omg/spec/bpmn/non/normative/color/util/ColorSwitch.java#L100-L110 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateAround | public Matrix4f rotateAround(Quaternionfc quat, float ox, float oy, float oz) {
return rotateAround(quat, ox, oy, oz, thisOrNew());
} | java | public Matrix4f rotateAround(Quaternionfc quat, float ox, float oy, float oz) {
return rotateAround(quat, ox, oy, oz, thisOrNew());
} | [
"public",
"Matrix4f",
"rotateAround",
"(",
"Quaternionfc",
"quat",
",",
"float",
"ox",
",",
"float",
"oy",
",",
"float",
"oz",
")",
"{",
"return",
"rotateAround",
"(",
"quat",
",",
"ox",
",",
"oy",
",",
"oz",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"... | Apply the rotation transformation of the given {@link Quaternionfc} to this matrix while using <code>(ox, oy, oz)</code> as the rotation origin.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>Q</code> the rotation matrix obtained from the given quaternion,
then the new matrix will be <code>M * Q</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * Q * v</code>,
the quaternion rotation will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, oz).rotate(quat).translate(-ox, -oy, -oz)</code>
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion">http://en.wikipedia.org</a>
@param quat
the {@link Quaternionfc}
@param ox
the x coordinate of the rotation origin
@param oy
the y coordinate of the rotation origin
@param oz
the z coordinate of the rotation origin
@return a matrix holding the result | [
"Apply",
"the",
"rotation",
"transformation",
"of",
"the",
"given",
"{",
"@link",
"Quaternionfc",
"}",
"to",
"this",
"matrix",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
"oz",
")",
"<",
"/",
"code",
">",
"as",
"the",
"rotation",
"origin",
".",
"<... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L11223-L11225 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/optionalusertools/PickerUtilities.java | PickerUtilities.localDateTimeToString | public static String localDateTimeToString(LocalDateTime value, String emptyTimeString) {
return (value == null) ? emptyTimeString : value.toString();
} | java | public static String localDateTimeToString(LocalDateTime value, String emptyTimeString) {
return (value == null) ? emptyTimeString : value.toString();
} | [
"public",
"static",
"String",
"localDateTimeToString",
"(",
"LocalDateTime",
"value",
",",
"String",
"emptyTimeString",
")",
"{",
"return",
"(",
"value",
"==",
"null",
")",
"?",
"emptyTimeString",
":",
"value",
".",
"toString",
"(",
")",
";",
"}"
] | localDateTimeToString, This will return the supplied LocalDateTime as a string. If the value
is null, this will return the value of emptyTimeString. Time values will be output in the
same format as LocalDateTime.toString().
Javadocs from LocalDateTime.toString():
Outputs this date-time as a {@code String}, such as {@code 2007-12-03T10:15:30}.
<p>
The output will be one of the following ISO-8601 formats:
<ul>
<li>{@code uuuu-MM-dd'T'HH:mm}</li>
<li>{@code uuuu-MM-dd'T'HH:mm:ss}</li>
<li>{@code uuuu-MM-dd'T'HH:mm:ss.SSS}</li>
<li>{@code uuuu-MM-dd'T'HH:mm:ss.SSSSSS}</li>
<li>{@code uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSS}</li>
</ul>
The format used will be the shortest that outputs the full value of the time where the
omitted parts are implied to be zero. | [
"localDateTimeToString",
"This",
"will",
"return",
"the",
"supplied",
"LocalDateTime",
"as",
"a",
"string",
".",
"If",
"the",
"value",
"is",
"null",
"this",
"will",
"return",
"the",
"value",
"of",
"emptyTimeString",
".",
"Time",
"values",
"will",
"be",
"output... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/optionalusertools/PickerUtilities.java#L146-L148 |
bazaarvoice/emodb | sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/CqlDataReaderDAO.java | CqlDataReaderDAO.deltaQueryAsync | private Iterator<Iterable<Row>> deltaQueryAsync(DeltaPlacement placement, Statement statement, boolean singleRow,
String errorContext, Object... errorContextArgs) {
return doDeltaQuery(placement, statement, singleRow, true, errorContext, errorContextArgs);
} | java | private Iterator<Iterable<Row>> deltaQueryAsync(DeltaPlacement placement, Statement statement, boolean singleRow,
String errorContext, Object... errorContextArgs) {
return doDeltaQuery(placement, statement, singleRow, true, errorContext, errorContextArgs);
} | [
"private",
"Iterator",
"<",
"Iterable",
"<",
"Row",
">",
">",
"deltaQueryAsync",
"(",
"DeltaPlacement",
"placement",
",",
"Statement",
"statement",
",",
"boolean",
"singleRow",
",",
"String",
"errorContext",
",",
"Object",
"...",
"errorContextArgs",
")",
"{",
"r... | Asynchronously executes the provided statement. Although the iterator is returned immediately the actual results
may still be loading in the background. The statement must query the delta table as returned from
{@link com.bazaarvoice.emodb.sor.db.astyanax.DeltaPlacement#getDeltaTableDDL()} | [
"Asynchronously",
"executes",
"the",
"provided",
"statement",
".",
"Although",
"the",
"iterator",
"is",
"returned",
"immediately",
"the",
"actual",
"results",
"may",
"still",
"be",
"loading",
"in",
"the",
"background",
".",
"The",
"statement",
"must",
"query",
"... | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/CqlDataReaderDAO.java#L243-L246 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/user/UserClient.java | UserClient.getUserList | public UserListResult getUserList(int start, int count)
throws APIConnectionException, APIRequestException {
if (start < 0 || count <= 0 || count > 500) {
throw new IllegalArgumentException("negative index or count must more than 0 and less than 501");
}
ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "?start=" + start + "&count=" + count);
return UserListResult.fromResponse(response, UserListResult.class);
} | java | public UserListResult getUserList(int start, int count)
throws APIConnectionException, APIRequestException {
if (start < 0 || count <= 0 || count > 500) {
throw new IllegalArgumentException("negative index or count must more than 0 and less than 501");
}
ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "?start=" + start + "&count=" + count);
return UserListResult.fromResponse(response, UserListResult.class);
} | [
"public",
"UserListResult",
"getUserList",
"(",
"int",
"start",
",",
"int",
"count",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"if",
"(",
"start",
"<",
"0",
"||",
"count",
"<=",
"0",
"||",
"count",
">",
"500",
")",
"{",
"thr... | Get user list
@param start The start index of the list
@param count The number that how many you want to get from list
@return User info list
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"user",
"list"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L210-L219 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/parser/PdfContentStreamProcessor.java | PdfContentStreamProcessor.displayPdfString | public void displayPdfString(PdfString string, float tj) {
String unicode = decode(string);
// this is width in unscaled units - we have to normalize by the Tm scaling
float width = getStringWidth(unicode, tj);
Matrix nextTextMatrix = new Matrix(width, 0).multiply(textMatrix);
displayText(unicode, nextTextMatrix);
textMatrix = nextTextMatrix;
} | java | public void displayPdfString(PdfString string, float tj) {
String unicode = decode(string);
// this is width in unscaled units - we have to normalize by the Tm scaling
float width = getStringWidth(unicode, tj);
Matrix nextTextMatrix = new Matrix(width, 0).multiply(textMatrix);
displayText(unicode, nextTextMatrix);
textMatrix = nextTextMatrix;
} | [
"public",
"void",
"displayPdfString",
"(",
"PdfString",
"string",
",",
"float",
"tj",
")",
"{",
"String",
"unicode",
"=",
"decode",
"(",
"string",
")",
";",
"// this is width in unscaled units - we have to normalize by the Tm scaling\r",
"float",
"width",
"=",
"getStrin... | Displays text.
@param string the text to display
@param tj the text adjustment | [
"Displays",
"text",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/parser/PdfContentStreamProcessor.java#L244-L251 |
ltsopensource/light-task-scheduler | lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/GenericsUtils.java | GenericsUtils.getSuperClassGenericType | public static Class getSuperClassGenericType(Class clazz, int index) {
Type genType = clazz.getGenericSuperclass();//得到泛型父类
//如果没有实现ParameterizedType接口,即不支持泛型,直接返回Object.class
if (!(genType instanceof ParameterizedType)) {
return Object.class;
}
//返回表示此类型实际类型参数的Type对象的数组,数组里放的都是对应类型的Class, 如BuyerServiceBean extends DaoSupport<Buyer,Contact>就返回Buyer和Contact类型
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
if (index >= params.length || index < 0) {
throw new IllegalArgumentException("index "+ (index<0 ? " must > 0 " : " over total arguments"));
}
if (!(params[index] instanceof Class)) {
return Object.class;
}
return (Class) params[index];
} | java | public static Class getSuperClassGenericType(Class clazz, int index) {
Type genType = clazz.getGenericSuperclass();//得到泛型父类
//如果没有实现ParameterizedType接口,即不支持泛型,直接返回Object.class
if (!(genType instanceof ParameterizedType)) {
return Object.class;
}
//返回表示此类型实际类型参数的Type对象的数组,数组里放的都是对应类型的Class, 如BuyerServiceBean extends DaoSupport<Buyer,Contact>就返回Buyer和Contact类型
Type[] params = ((ParameterizedType) genType).getActualTypeArguments();
if (index >= params.length || index < 0) {
throw new IllegalArgumentException("index "+ (index<0 ? " must > 0 " : " over total arguments"));
}
if (!(params[index] instanceof Class)) {
return Object.class;
}
return (Class) params[index];
} | [
"public",
"static",
"Class",
"getSuperClassGenericType",
"(",
"Class",
"clazz",
",",
"int",
"index",
")",
"{",
"Type",
"genType",
"=",
"clazz",
".",
"getGenericSuperclass",
"(",
")",
";",
"//得到泛型父类 ",
"//如果没有实现ParameterizedType接口,即不支持泛型,直接返回Object.class",
"if",
"(",
... | 通过反射,获得指定类的父类的泛型参数的实际类型. 如BuyerServiceBean extends DaoSupport<Buyer>
@param clazz clazz 需要反射的类,该类必须继承范型父类
@param index 泛型参数所在索引,从0开始.
@return 范型参数的实际类型, 如果没有实现ParameterizedType接口,即不支持泛型,所以直接返回<code>Object.class</code> | [
"通过反射",
"获得指定类的父类的泛型参数的实际类型",
".",
"如BuyerServiceBean",
"extends",
"DaoSupport<Buyer",
">"
] | train | https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/GenericsUtils.java#L22-L38 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/GeneralSubtrees.java | GeneralSubtrees.createWidestSubtree | private GeneralSubtree createWidestSubtree(GeneralNameInterface name) {
try {
GeneralName newName;
switch (name.getType()) {
case GeneralNameInterface.NAME_ANY:
// Create new OtherName with same OID as baseName, but
// empty value
ObjectIdentifier otherOID = ((OtherName)name).getOID();
newName = new GeneralName(new OtherName(otherOID, null));
break;
case GeneralNameInterface.NAME_RFC822:
newName = new GeneralName(new RFC822Name(""));
break;
case GeneralNameInterface.NAME_DNS:
newName = new GeneralName(new DNSName(""));
break;
case GeneralNameInterface.NAME_X400:
newName = new GeneralName(new X400Address((byte[])null));
break;
case GeneralNameInterface.NAME_DIRECTORY:
newName = new GeneralName(new X500Name(""));
break;
case GeneralNameInterface.NAME_EDI:
newName = new GeneralName(new EDIPartyName(""));
break;
case GeneralNameInterface.NAME_URI:
newName = new GeneralName(new URIName(""));
break;
case GeneralNameInterface.NAME_IP:
newName = new GeneralName(new IPAddressName((byte[])null));
break;
case GeneralNameInterface.NAME_OID:
newName = new GeneralName
(new OIDName(new ObjectIdentifier((int[])null)));
break;
default:
throw new IOException
("Unsupported GeneralNameInterface type: " + name.getType());
}
return new GeneralSubtree(newName, 0, -1);
} catch (IOException e) {
throw new RuntimeException("Unexpected error: " + e, e);
}
} | java | private GeneralSubtree createWidestSubtree(GeneralNameInterface name) {
try {
GeneralName newName;
switch (name.getType()) {
case GeneralNameInterface.NAME_ANY:
// Create new OtherName with same OID as baseName, but
// empty value
ObjectIdentifier otherOID = ((OtherName)name).getOID();
newName = new GeneralName(new OtherName(otherOID, null));
break;
case GeneralNameInterface.NAME_RFC822:
newName = new GeneralName(new RFC822Name(""));
break;
case GeneralNameInterface.NAME_DNS:
newName = new GeneralName(new DNSName(""));
break;
case GeneralNameInterface.NAME_X400:
newName = new GeneralName(new X400Address((byte[])null));
break;
case GeneralNameInterface.NAME_DIRECTORY:
newName = new GeneralName(new X500Name(""));
break;
case GeneralNameInterface.NAME_EDI:
newName = new GeneralName(new EDIPartyName(""));
break;
case GeneralNameInterface.NAME_URI:
newName = new GeneralName(new URIName(""));
break;
case GeneralNameInterface.NAME_IP:
newName = new GeneralName(new IPAddressName((byte[])null));
break;
case GeneralNameInterface.NAME_OID:
newName = new GeneralName
(new OIDName(new ObjectIdentifier((int[])null)));
break;
default:
throw new IOException
("Unsupported GeneralNameInterface type: " + name.getType());
}
return new GeneralSubtree(newName, 0, -1);
} catch (IOException e) {
throw new RuntimeException("Unexpected error: " + e, e);
}
} | [
"private",
"GeneralSubtree",
"createWidestSubtree",
"(",
"GeneralNameInterface",
"name",
")",
"{",
"try",
"{",
"GeneralName",
"newName",
";",
"switch",
"(",
"name",
".",
"getType",
"(",
")",
")",
"{",
"case",
"GeneralNameInterface",
".",
"NAME_ANY",
":",
"// Cre... | create a subtree containing an instance of the input
name type that widens all other names of that type.
@params name GeneralNameInterface name
@returns GeneralSubtree containing widest name of that type
@throws RuntimeException on error (should not occur) | [
"create",
"a",
"subtree",
"containing",
"an",
"instance",
"of",
"the",
"input",
"name",
"type",
"that",
"widens",
"all",
"other",
"names",
"of",
"that",
"type",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/GeneralSubtrees.java#L243-L286 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.backgroundContourWidthDp | @NonNull
public IconicsDrawable backgroundContourWidthDp(@Dimension(unit = DP) int sizeDp) {
return backgroundContourWidthPx(Utils.convertDpToPx(mContext, sizeDp));
} | java | @NonNull
public IconicsDrawable backgroundContourWidthDp(@Dimension(unit = DP) int sizeDp) {
return backgroundContourWidthPx(Utils.convertDpToPx(mContext, sizeDp));
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"backgroundContourWidthDp",
"(",
"@",
"Dimension",
"(",
"unit",
"=",
"DP",
")",
"int",
"sizeDp",
")",
"{",
"return",
"backgroundContourWidthPx",
"(",
"Utils",
".",
"convertDpToPx",
"(",
"mContext",
",",
"sizeDp",
")",... | Set background contour width from dp for the icon
@return The current IconicsDrawable for chaining. | [
"Set",
"background",
"contour",
"width",
"from",
"dp",
"for",
"the",
"icon"
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L1143-L1146 |
FINRAOS/JTAF-ExtWebDriver | src/main/java/org/finra/jtaf/ewd/session/SessionManager.java | SessionManager.getNewSession | public ExtWebDriver getNewSession(String key, String value, boolean setAsCurrent)
throws Exception {
/**
* This is where the clientPropertiesFile is parsed and key-value pairs
* are added into the options map
*/
Map<String, String> options = sessionFactory.get().createDefaultOptions();
options.put(key, value);
return getNewSessionDo(options, setAsCurrent);
} | java | public ExtWebDriver getNewSession(String key, String value, boolean setAsCurrent)
throws Exception {
/**
* This is where the clientPropertiesFile is parsed and key-value pairs
* are added into the options map
*/
Map<String, String> options = sessionFactory.get().createDefaultOptions();
options.put(key, value);
return getNewSessionDo(options, setAsCurrent);
} | [
"public",
"ExtWebDriver",
"getNewSession",
"(",
"String",
"key",
",",
"String",
"value",
",",
"boolean",
"setAsCurrent",
")",
"throws",
"Exception",
"{",
"/**\n * This is where the clientPropertiesFile is parsed and key-value pairs\n * are added into the options map\n... | Create and return a new ExtWebDriver instance. The instance is
constructed with default options, with the provided key/value pair
overriding the corresponding key and value in the options. This is a
convenience method for use when only a single option needs to be
overridden. If overriding multiple options, you must use
getNewSession(string-string Map, boolean) instead.
@param key
The key whose default value will be overridden
@param value
The value to be associated with the provided key
@param setAsCurrent
set to true if the new session should become the current
session for this SessionManager
@return A new ExtWebDriver instance
@throws Exception | [
"Create",
"and",
"return",
"a",
"new",
"ExtWebDriver",
"instance",
".",
"The",
"instance",
"is",
"constructed",
"with",
"default",
"options",
"with",
"the",
"provided",
"key",
"/",
"value",
"pair",
"overriding",
"the",
"corresponding",
"key",
"and",
"value",
"... | train | https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/session/SessionManager.java#L293-L304 |
GerdHolz/TOVAL | src/de/invation/code/toval/os/SolarisUtils.java | SolarisUtils.registerFileExtension | @Override
public boolean registerFileExtension(String fileTypeName, String fileTypeExtension, String application) throws OSException {
throw new UnsupportedOperationException("Not supported yet.");
} | java | @Override
public boolean registerFileExtension(String fileTypeName, String fileTypeExtension, String application) throws OSException {
throw new UnsupportedOperationException("Not supported yet.");
} | [
"@",
"Override",
"public",
"boolean",
"registerFileExtension",
"(",
"String",
"fileTypeName",
",",
"String",
"fileTypeExtension",
",",
"String",
"application",
")",
"throws",
"OSException",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Not supported yet.\"... | Registers a new file extension in the operating system.
@param fileTypeName Name of the file extension. Must be atomic, e.g.
<code>foocorp.fooapp.v1</code>.
@param fileTypeExtension File extension with leading dot, e.g.
<code>.bar</code>.
@param application Path to the application, which should open the new
file extension.
@return <code>true</code> if registration was successful,
<code>false</code> otherwise.
@throws OSException | [
"Registers",
"a",
"new",
"file",
"extension",
"in",
"the",
"operating",
"system",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/SolarisUtils.java#L118-L121 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java | TraceNLS.getTraceNLS | @Deprecated
public static TraceNLS getTraceNLS(String bundleName) {
if (resolver == null)
resolver = TraceNLSResolver.getInstance();
if (finder == null)
finder = StackFinder.getInstance();
Class<?> caller = null;
if (finder != null)
caller = finder.getCaller();
return new TraceNLS(caller, bundleName);
} | java | @Deprecated
public static TraceNLS getTraceNLS(String bundleName) {
if (resolver == null)
resolver = TraceNLSResolver.getInstance();
if (finder == null)
finder = StackFinder.getInstance();
Class<?> caller = null;
if (finder != null)
caller = finder.getCaller();
return new TraceNLS(caller, bundleName);
} | [
"@",
"Deprecated",
"public",
"static",
"TraceNLS",
"getTraceNLS",
"(",
"String",
"bundleName",
")",
"{",
"if",
"(",
"resolver",
"==",
"null",
")",
"resolver",
"=",
"TraceNLSResolver",
".",
"getInstance",
"(",
")",
";",
"if",
"(",
"finder",
"==",
"null",
")... | Retrieve a TraceNLS instance for the specified ResourceBundle, after
first calculating the class of the caller via a stack walk (a direct call
passing in the class is preferred).
@param bundleName
the package-qualified name of the ResourceBundle. The caller
MUST guarantee that this is not null.
<p>
@return a TraceNLS object. Null is never returned.
@deprecated Use the signature that includes the class object instead
@see #getTraceNLS(Class, String) | [
"Retrieve",
"a",
"TraceNLS",
"instance",
"for",
"the",
"specified",
"ResourceBundle",
"after",
"first",
"calculating",
"the",
"class",
"of",
"the",
"caller",
"via",
"a",
"stack",
"walk",
"(",
"a",
"direct",
"call",
"passing",
"in",
"the",
"class",
"is",
"pre... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java#L69-L83 |
couchbase/CouchbaseMock | src/main/java/com/couchbase/mock/httpio/HandlerUtil.java | HandlerUtil.makeJsonResponse | public static void makeJsonResponse(HttpResponse response, String encoded) {
StringEntity ent = new StringEntity(encoded, ContentType.APPLICATION_JSON);
response.setEntity(ent);
} | java | public static void makeJsonResponse(HttpResponse response, String encoded) {
StringEntity ent = new StringEntity(encoded, ContentType.APPLICATION_JSON);
response.setEntity(ent);
} | [
"public",
"static",
"void",
"makeJsonResponse",
"(",
"HttpResponse",
"response",
",",
"String",
"encoded",
")",
"{",
"StringEntity",
"ent",
"=",
"new",
"StringEntity",
"(",
"encoded",
",",
"ContentType",
".",
"APPLICATION_JSON",
")",
";",
"response",
".",
"setEn... | Sets a JSON encoded response. The response's {@code Content-Type} header will be set to {@code application/json}
@param response The response object
@param encoded The JSON-encoded string | [
"Sets",
"a",
"JSON",
"encoded",
"response",
".",
"The",
"response",
"s",
"{"
] | train | https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/httpio/HandlerUtil.java#L179-L182 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java | WDataTableRenderer.paintColumnHeadings | private void paintColumnHeadings(final WDataTable table, final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
int[] columnOrder = table.getColumnOrder();
TableDataModel model = table.getDataModel();
final int columnCount = table.getColumnCount();
xml.appendTagOpen("ui:thead");
xml.appendOptionalAttribute("hidden", !table.isShowColumnHeaders(), "true");
xml.appendClose();
if (table.isShowRowHeaders()) {
paintColumnHeading(table.getRowHeaderColumn(), false, renderContext);
}
for (int i = 0; i < columnCount; i++) {
int colIndex = columnOrder == null ? i : columnOrder[i];
WTableColumn col = table.getColumn(colIndex);
if (col.isVisible()) {
boolean sortable = model.isSortable(colIndex);
paintColumnHeading(col, sortable, renderContext);
}
}
xml.appendEndTag("ui:thead");
} | java | private void paintColumnHeadings(final WDataTable table, final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
int[] columnOrder = table.getColumnOrder();
TableDataModel model = table.getDataModel();
final int columnCount = table.getColumnCount();
xml.appendTagOpen("ui:thead");
xml.appendOptionalAttribute("hidden", !table.isShowColumnHeaders(), "true");
xml.appendClose();
if (table.isShowRowHeaders()) {
paintColumnHeading(table.getRowHeaderColumn(), false, renderContext);
}
for (int i = 0; i < columnCount; i++) {
int colIndex = columnOrder == null ? i : columnOrder[i];
WTableColumn col = table.getColumn(colIndex);
if (col.isVisible()) {
boolean sortable = model.isSortable(colIndex);
paintColumnHeading(col, sortable, renderContext);
}
}
xml.appendEndTag("ui:thead");
} | [
"private",
"void",
"paintColumnHeadings",
"(",
"final",
"WDataTable",
"table",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"int",
"[",
"]",
"columnOrder",
"=",
... | Paints the column headings for the given table.
@param table the table to paint the headings for.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"column",
"headings",
"for",
"the",
"given",
"table",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java#L370-L395 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.copyOfRange | public static <T> T[] copyOfRange(final T[] original, final int from, final int to, final int step) {
return copyOfRange(original, from, to, step, (Class<T[]>) original.getClass());
} | java | public static <T> T[] copyOfRange(final T[] original, final int from, final int to, final int step) {
return copyOfRange(original, from, to, step, (Class<T[]>) original.getClass());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"copyOfRange",
"(",
"final",
"T",
"[",
"]",
"original",
",",
"final",
"int",
"from",
",",
"final",
"int",
"to",
",",
"final",
"int",
"step",
")",
"{",
"return",
"copyOfRange",
"(",
"original",
",",
... | Copy all the elements in <code>original</code>, through <code>to</code>-<code>from</code>, by <code>step</code>.
@param original
@param from
@param to
@param step
@return | [
"Copy",
"all",
"the",
"elements",
"in",
"<code",
">",
"original<",
"/",
"code",
">",
"through",
"<code",
">",
"to<",
"/",
"code",
">",
"-",
"<code",
">",
"from<",
"/",
"code",
">",
"by",
"<code",
">",
"step<",
"/",
"code",
">",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L10941-L10943 |
maxirosson/jdroid-android | jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java | StringEntityRepository.replaceStringChildren | public void replaceStringChildren(List<String> strings, String parentId) {
ArrayList<StringEntity> entities = new ArrayList<>();
for (String string : strings) {
if (string != null) {
StringEntity entity = new StringEntity();
entity.setParentId(parentId);
entity.setValue(string);
entities.add(entity);
}
}
replaceChildren(entities, parentId);
} | java | public void replaceStringChildren(List<String> strings, String parentId) {
ArrayList<StringEntity> entities = new ArrayList<>();
for (String string : strings) {
if (string != null) {
StringEntity entity = new StringEntity();
entity.setParentId(parentId);
entity.setValue(string);
entities.add(entity);
}
}
replaceChildren(entities, parentId);
} | [
"public",
"void",
"replaceStringChildren",
"(",
"List",
"<",
"String",
">",
"strings",
",",
"String",
"parentId",
")",
"{",
"ArrayList",
"<",
"StringEntity",
">",
"entities",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"string",
":"... | This method allows to replace all string children of a given parent, it will remove any children which are not in
the list, add the new ones and update which are in the list.
@param strings string children list to replace.
@param parentId id of parent entity. | [
"This",
"method",
"allows",
"to",
"replace",
"all",
"string",
"children",
"of",
"a",
"given",
"parent",
"it",
"will",
"remove",
"any",
"children",
"which",
"are",
"not",
"in",
"the",
"list",
"add",
"the",
"new",
"ones",
"and",
"update",
"which",
"are",
"... | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java#L68-L79 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/URLUtil.java | URLUtil.urlFromSystemId | public static URL urlFromSystemId(String sysId) throws IOException
{
try {
sysId = cleanSystemId(sysId);
/* Ok, does it look like a full URL? For one, you need a colon. Also,
* to reduce likelihood of collision with Windows paths, let's only
* accept it if there are 3 preceding other chars...
* Not sure if Mac might be a problem? (it uses ':' as file path
* separator, alas, at least prior to MacOS X)
*/
int ix = sysId.indexOf(':', 0);
/* Also, protocols are generally fairly short, usually 3 or 4
* chars (http, ftp, urn); so let's put upper limit of 8 chars too
*/
if (ix >= 3 && ix <= 8) {
return new URL(sysId);
}
// Ok, let's just assume it's local file reference...
/* 24-May-2006, TSa: Amazingly, this single call does show in
* profiling, for small docs. The problem is that deep down it
* tries to check physical file system, to check if the File
* pointed to is a directory: and that is (relatively speaking)
* a very expensive call. Since in this particular case it
* should never be a dir (and/or doesn't matter), let's just
* implement conversion locally
*/
String absPath = new java.io.File(sysId).getAbsolutePath();
// Need to convert colons/backslashes to regular slashes?
{
char sep = File.separatorChar;
if (sep != '/') {
absPath = absPath.replace(sep, '/');
}
}
if (absPath.length() > 0 && absPath.charAt(0) != '/') {
absPath = "/" + absPath;
}
return new URL("file", "", absPath);
} catch (MalformedURLException e) {
throwIOException(e, sysId);
return null; // never gets here
}
} | java | public static URL urlFromSystemId(String sysId) throws IOException
{
try {
sysId = cleanSystemId(sysId);
/* Ok, does it look like a full URL? For one, you need a colon. Also,
* to reduce likelihood of collision with Windows paths, let's only
* accept it if there are 3 preceding other chars...
* Not sure if Mac might be a problem? (it uses ':' as file path
* separator, alas, at least prior to MacOS X)
*/
int ix = sysId.indexOf(':', 0);
/* Also, protocols are generally fairly short, usually 3 or 4
* chars (http, ftp, urn); so let's put upper limit of 8 chars too
*/
if (ix >= 3 && ix <= 8) {
return new URL(sysId);
}
// Ok, let's just assume it's local file reference...
/* 24-May-2006, TSa: Amazingly, this single call does show in
* profiling, for small docs. The problem is that deep down it
* tries to check physical file system, to check if the File
* pointed to is a directory: and that is (relatively speaking)
* a very expensive call. Since in this particular case it
* should never be a dir (and/or doesn't matter), let's just
* implement conversion locally
*/
String absPath = new java.io.File(sysId).getAbsolutePath();
// Need to convert colons/backslashes to regular slashes?
{
char sep = File.separatorChar;
if (sep != '/') {
absPath = absPath.replace(sep, '/');
}
}
if (absPath.length() > 0 && absPath.charAt(0) != '/') {
absPath = "/" + absPath;
}
return new URL("file", "", absPath);
} catch (MalformedURLException e) {
throwIOException(e, sysId);
return null; // never gets here
}
} | [
"public",
"static",
"URL",
"urlFromSystemId",
"(",
"String",
"sysId",
")",
"throws",
"IOException",
"{",
"try",
"{",
"sysId",
"=",
"cleanSystemId",
"(",
"sysId",
")",
";",
"/* Ok, does it look like a full URL? For one, you need a colon. Also,\n * to reduce likelih... | Method that tries to figure out how to create valid URL from a system
id, without additional contextual information.
If we could use URIs this might be easier to do, but they are part
of JDK 1.4, and preferably code should only require 1.2 (or maybe 1.3) | [
"Method",
"that",
"tries",
"to",
"figure",
"out",
"how",
"to",
"create",
"valid",
"URL",
"from",
"a",
"system",
"id",
"without",
"additional",
"contextual",
"information",
".",
"If",
"we",
"could",
"use",
"URIs",
"this",
"might",
"be",
"easier",
"to",
"do"... | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/URLUtil.java#L23-L65 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java | Locale.decodeString | private static boolean decodeString(InputStream stream, List<String> lineArray, Charset charset) throws IOException {
try {
final BufferedReader breader = new BufferedReader(
new InputStreamReader(stream, charset.newDecoder()));
lineArray.clear();
String line;
while ((line = breader.readLine()) != null) {
lineArray.add(line);
}
return true;
} catch (CharacterCodingException exception) {
//
}
return false;
} | java | private static boolean decodeString(InputStream stream, List<String> lineArray, Charset charset) throws IOException {
try {
final BufferedReader breader = new BufferedReader(
new InputStreamReader(stream, charset.newDecoder()));
lineArray.clear();
String line;
while ((line = breader.readLine()) != null) {
lineArray.add(line);
}
return true;
} catch (CharacterCodingException exception) {
//
}
return false;
} | [
"private",
"static",
"boolean",
"decodeString",
"(",
"InputStream",
"stream",
",",
"List",
"<",
"String",
">",
"lineArray",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"try",
"{",
"final",
"BufferedReader",
"breader",
"=",
"new",
"BufferedReade... | Decode the bytes from the specified input stream
according to a charset selection. This function tries
to decode a string from the given byte array
with the following charsets (in preferred order).
<p>This function read the input stream line by line.
@param stream is the stream to decode.
@param lineArray is the array of lines to fill.
@param charset is the charset to use.
@return <code>true</code> is the decoding was successful,
otherwhise <code>false</code>
@throws IOException when the stream cannot be read. | [
"Decode",
"the",
"bytes",
"from",
"the",
"specified",
"input",
"stream",
"according",
"to",
"a",
"charset",
"selection",
".",
"This",
"function",
"tries",
"to",
"decode",
"a",
"string",
"from",
"the",
"given",
"byte",
"array",
"with",
"the",
"following",
"ch... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java#L621-L638 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/accounts/CmsUserTransferList.java | CmsUserTransferList.setUserData | protected void setUserData(CmsUser user, CmsListItem item) {
item.set(LIST_COLUMN_LOGIN, user.getName());
item.set(LIST_COLUMN_NAME, user.getFullName());
item.set(LIST_COLUMN_EMAIL, user.getEmail());
item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin()));
} | java | protected void setUserData(CmsUser user, CmsListItem item) {
item.set(LIST_COLUMN_LOGIN, user.getName());
item.set(LIST_COLUMN_NAME, user.getFullName());
item.set(LIST_COLUMN_EMAIL, user.getEmail());
item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin()));
} | [
"protected",
"void",
"setUserData",
"(",
"CmsUser",
"user",
",",
"CmsListItem",
"item",
")",
"{",
"item",
".",
"set",
"(",
"LIST_COLUMN_LOGIN",
",",
"user",
".",
"getName",
"(",
")",
")",
";",
"item",
".",
"set",
"(",
"LIST_COLUMN_NAME",
",",
"user",
"."... | Sets all needed data of the user into the list item object.<p>
@param user the user to set the data for
@param item the list item object to set the data into | [
"Sets",
"all",
"needed",
"data",
"of",
"the",
"user",
"into",
"the",
"list",
"item",
"object",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/accounts/CmsUserTransferList.java#L577-L583 |
wcm-io/wcm-io-wcm | ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageTreeProvider.java | AbstractPageTreeProvider.getPages | protected final JSONArray getPages(Iterator<Page> pages, int depth, PageFilter pageFilter) throws JSONException {
JSONArray pagesArray = new JSONArray();
while (pages.hasNext()) {
Page page = pages.next();
// map page attributes to JSON object
JSONObject pageObject = getPage(page);
if (pageObject != null) {
// write children
Iterator<Page> children = listChildren(page.adaptTo(Resource.class), pageFilter);
if (!children.hasNext()) {
pageObject.put("leaf", true);
}
else if (depth < getMaxDepth() - 1) {
pageObject.put("children", getPages(children, depth + 1, pageFilter));
}
pagesArray.put(pageObject);
}
}
return pagesArray;
} | java | protected final JSONArray getPages(Iterator<Page> pages, int depth, PageFilter pageFilter) throws JSONException {
JSONArray pagesArray = new JSONArray();
while (pages.hasNext()) {
Page page = pages.next();
// map page attributes to JSON object
JSONObject pageObject = getPage(page);
if (pageObject != null) {
// write children
Iterator<Page> children = listChildren(page.adaptTo(Resource.class), pageFilter);
if (!children.hasNext()) {
pageObject.put("leaf", true);
}
else if (depth < getMaxDepth() - 1) {
pageObject.put("children", getPages(children, depth + 1, pageFilter));
}
pagesArray.put(pageObject);
}
}
return pagesArray;
} | [
"protected",
"final",
"JSONArray",
"getPages",
"(",
"Iterator",
"<",
"Page",
">",
"pages",
",",
"int",
"depth",
",",
"PageFilter",
"pageFilter",
")",
"throws",
"JSONException",
"{",
"JSONArray",
"pagesArray",
"=",
"new",
"JSONArray",
"(",
")",
";",
"while",
... | Generate JSON objects for pages.
@param pages Child page iterator
@param depth Depth
@param pageFilter Page filter
@return Page array
@throws JSONException JSON exception | [
"Generate",
"JSON",
"objects",
"for",
"pages",
"."
] | train | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageTreeProvider.java#L59-L83 |
drewnoakes/metadata-extractor | Source/com/drew/imaging/riff/RiffReader.java | RiffReader.processRiff | public void processRiff(@NotNull final SequentialReader reader,
@NotNull final RiffHandler handler) throws RiffProcessingException, IOException
{
// RIFF files are always little-endian
reader.setMotorolaByteOrder(false);
// PROCESS FILE HEADER
final String fileFourCC = reader.getString(4);
if (!fileFourCC.equals("RIFF"))
throw new RiffProcessingException("Invalid RIFF header: " + fileFourCC);
// The total size of the chunks that follow plus 4 bytes for the FourCC
final int fileSize = reader.getInt32();
int sizeLeft = fileSize;
final String identifier = reader.getString(4);
sizeLeft -= 4;
if (!handler.shouldAcceptRiffIdentifier(identifier))
return;
// PROCESS CHUNKS
processChunks(reader, sizeLeft, handler);
} | java | public void processRiff(@NotNull final SequentialReader reader,
@NotNull final RiffHandler handler) throws RiffProcessingException, IOException
{
// RIFF files are always little-endian
reader.setMotorolaByteOrder(false);
// PROCESS FILE HEADER
final String fileFourCC = reader.getString(4);
if (!fileFourCC.equals("RIFF"))
throw new RiffProcessingException("Invalid RIFF header: " + fileFourCC);
// The total size of the chunks that follow plus 4 bytes for the FourCC
final int fileSize = reader.getInt32();
int sizeLeft = fileSize;
final String identifier = reader.getString(4);
sizeLeft -= 4;
if (!handler.shouldAcceptRiffIdentifier(identifier))
return;
// PROCESS CHUNKS
processChunks(reader, sizeLeft, handler);
} | [
"public",
"void",
"processRiff",
"(",
"@",
"NotNull",
"final",
"SequentialReader",
"reader",
",",
"@",
"NotNull",
"final",
"RiffHandler",
"handler",
")",
"throws",
"RiffProcessingException",
",",
"IOException",
"{",
"// RIFF files are always little-endian",
"reader",
".... | Processes a RIFF data sequence.
@param reader the {@link SequentialReader} from which the data should be read
@param handler the {@link RiffHandler} that will coordinate processing and accept read values
@throws RiffProcessingException if an error occurred during the processing of RIFF data that could not be
ignored or recovered from
@throws IOException an error occurred while accessing the required data | [
"Processes",
"a",
"RIFF",
"data",
"sequence",
"."
] | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/imaging/riff/RiffReader.java#L51-L76 |
stackify/stackify-api-java | src/main/java/com/stackify/api/common/log/direct/Logger.java | Logger.queueException | public static void queueException(final String level, final String message, final Throwable e) {
try {
LogAppender<LogEvent> appender = LogManager.getAppender();
if (appender != null) {
appender.append(LogEvent.newBuilder().level(level).message(message).exception(e).build());
}
} catch (Throwable t) {
LOGGER.info("Unable to queue exception to Stackify Log API service: {} {} {}", level, message, e, t);
}
} | java | public static void queueException(final String level, final String message, final Throwable e) {
try {
LogAppender<LogEvent> appender = LogManager.getAppender();
if (appender != null) {
appender.append(LogEvent.newBuilder().level(level).message(message).exception(e).build());
}
} catch (Throwable t) {
LOGGER.info("Unable to queue exception to Stackify Log API service: {} {} {}", level, message, e, t);
}
} | [
"public",
"static",
"void",
"queueException",
"(",
"final",
"String",
"level",
",",
"final",
"String",
"message",
",",
"final",
"Throwable",
"e",
")",
"{",
"try",
"{",
"LogAppender",
"<",
"LogEvent",
">",
"appender",
"=",
"LogManager",
".",
"getAppender",
"(... | Queues an exception to be sent to Stackify
@param level The log level
@param message The log message
@param e The exception | [
"Queues",
"an",
"exception",
"to",
"be",
"sent",
"to",
"Stackify"
] | train | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/log/direct/Logger.java#L89-L99 |
samskivert/samskivert | src/main/java/com/samskivert/servlet/util/ParameterUtil.java | ParameterUtil.getParameter | public static String getParameter (HttpServletRequest req, String name, String defval)
{
String value = req.getParameter(name);
return StringUtil.isBlank(value) ? defval : value.trim();
} | java | public static String getParameter (HttpServletRequest req, String name, String defval)
{
String value = req.getParameter(name);
return StringUtil.isBlank(value) ? defval : value.trim();
} | [
"public",
"static",
"String",
"getParameter",
"(",
"HttpServletRequest",
"req",
",",
"String",
"name",
",",
"String",
"defval",
")",
"{",
"String",
"value",
"=",
"req",
".",
"getParameter",
"(",
"name",
")",
";",
"return",
"StringUtil",
".",
"isBlank",
"(",
... | Fetches the supplied parameter from the request. If the parameter does not exist,
<code>defval</code> is returned. | [
"Fetches",
"the",
"supplied",
"parameter",
"from",
"the",
"request",
".",
"If",
"the",
"parameter",
"does",
"not",
"exist",
"<code",
">",
"defval<",
"/",
"code",
">",
"is",
"returned",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/ParameterUtil.java#L162-L166 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CProductUtil.java | CProductUtil.removeByUUID_G | public static CProduct removeByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.product.exception.NoSuchCProductException {
return getPersistence().removeByUUID_G(uuid, groupId);
} | java | public static CProduct removeByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.product.exception.NoSuchCProductException {
return getPersistence().removeByUUID_G(uuid, groupId);
} | [
"public",
"static",
"CProduct",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"com",
".",
"liferay",
".",
"commerce",
".",
"product",
".",
"exception",
".",
"NoSuchCProductException",
"{",
"return",
"getPersistence",
"(",
")",
... | Removes the c product where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the c product that was removed | [
"Removes",
"the",
"c",
"product",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CProductUtil.java#L310-L313 |
agmip/agmip-common-functions | src/main/java/org/agmip/functions/ExperimentHelper.java | ExperimentHelper.getFstPdate | public static String getFstPdate(Map data, String defValue) {
ArrayList<HashMap<String, String>> events = getBucket(data, "management").getDataList();
Event event = new Event(events, "planting");
return getValueOr(event.getCurrentEvent(), "date", defValue);
} | java | public static String getFstPdate(Map data, String defValue) {
ArrayList<HashMap<String, String>> events = getBucket(data, "management").getDataList();
Event event = new Event(events, "planting");
return getValueOr(event.getCurrentEvent(), "date", defValue);
} | [
"public",
"static",
"String",
"getFstPdate",
"(",
"Map",
"data",
",",
"String",
"defValue",
")",
"{",
"ArrayList",
"<",
"HashMap",
"<",
"String",
",",
"String",
">",
">",
"events",
"=",
"getBucket",
"(",
"data",
",",
"\"management\"",
")",
".",
"getDataLis... | Get the first planting date from given data set.
@param data The experiment data holder
@param defValue The value used for return when planting date is unavailable
@return The planting date | [
"Get",
"the",
"first",
"planting",
"date",
"from",
"given",
"data",
"set",
"."
] | train | https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/ExperimentHelper.java#L1199-L1203 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java | MastersFailoverListener.initializeConnection | @Override
public void initializeConnection() throws SQLException {
super.initializeConnection();
this.currentProtocol = null;
//launching initial loop
reconnectFailedConnection(new SearchFilter(true, false));
resetMasterFailoverData();
} | java | @Override
public void initializeConnection() throws SQLException {
super.initializeConnection();
this.currentProtocol = null;
//launching initial loop
reconnectFailedConnection(new SearchFilter(true, false));
resetMasterFailoverData();
} | [
"@",
"Override",
"public",
"void",
"initializeConnection",
"(",
")",
"throws",
"SQLException",
"{",
"super",
".",
"initializeConnection",
"(",
")",
";",
"this",
".",
"currentProtocol",
"=",
"null",
";",
"//launching initial loop",
"reconnectFailedConnection",
"(",
"... | Connect to database.
@throws SQLException if connection is on error. | [
"Connect",
"to",
"database",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/impl/MastersFailoverListener.java#L97-L104 |
coursera/courier | swift/generator/src/main/java/org/coursera/courier/swift/SwiftSyntax.java | SwiftSyntax.toType | public String toType(ClassTemplateSpec spec, boolean isOptional) {
String type = toTypeString(spec);
return type + (isOptional ? "?" : "");
} | java | public String toType(ClassTemplateSpec spec, boolean isOptional) {
String type = toTypeString(spec);
return type + (isOptional ? "?" : "");
} | [
"public",
"String",
"toType",
"(",
"ClassTemplateSpec",
"spec",
",",
"boolean",
"isOptional",
")",
"{",
"String",
"type",
"=",
"toTypeString",
"(",
"spec",
")",
";",
"return",
"type",
"+",
"(",
"isOptional",
"?",
"\"?\"",
":",
"\"\"",
")",
";",
"}"
] | Returns the Swift type of an optional field for the given {@link ClassTemplateSpec} as a
Swift source code string.
Even if the field is required, it still will be represented as optional when
Optionality is set to {@link SwiftProperties.Optionality#REQUIRED_FIELDS_MAY_BE_ABSENT}.
@param spec to get a Swift type name for.
@param isOptional indicates if the type is optional or not.
@return Swift source code string identifying the given type. | [
"Returns",
"the",
"Swift",
"type",
"of",
"an",
"optional",
"field",
"for",
"the",
"given",
"{",
"@link",
"ClassTemplateSpec",
"}",
"as",
"a",
"Swift",
"source",
"code",
"string",
"."
] | train | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/swift/generator/src/main/java/org/coursera/courier/swift/SwiftSyntax.java#L142-L145 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInboundServiceContextImpl.java | HttpInboundServiceContextImpl.getRawRequestBodyBuffer | @Override
public VirtualConnection getRawRequestBodyBuffer(InterChannelCallback cb, boolean bForce) throws BodyCompleteException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getRawRequestBodyBuffer(async)");
}
setRawBody(true);
VirtualConnection vc = getRequestBodyBuffer(cb, bForce);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getRawRequestBodyBuffer(async): " + vc);
}
return vc;
} | java | @Override
public VirtualConnection getRawRequestBodyBuffer(InterChannelCallback cb, boolean bForce) throws BodyCompleteException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getRawRequestBodyBuffer(async)");
}
setRawBody(true);
VirtualConnection vc = getRequestBodyBuffer(cb, bForce);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getRawRequestBodyBuffer(async): " + vc);
}
return vc;
} | [
"@",
"Override",
"public",
"VirtualConnection",
"getRawRequestBodyBuffer",
"(",
"InterChannelCallback",
"cb",
",",
"boolean",
"bForce",
")",
"throws",
"BodyCompleteException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"... | Retrieve the next buffer of the body asynchronously. This will avoid any
body modifications, such as decompression or removal of chunked-encoding
markers.
<p>
If the read can be performed immediately, then a VirtualConnection will be
returned and the provided callback will not be used. If the read is being
done asychronously, then null will be returned and the callback used when
complete. The force input flag allows the caller to force the asynchronous
read to always occur, and thus the callback to always be used.
<p>
The caller is responsible for releasing these buffers when finished with
them as the HTTP Channel keeps no reference to them.
@param cb
@param bForce
@return VirtualConnection
@throws BodyCompleteException
-- if the entire body has already been read | [
"Retrieve",
"the",
"next",
"buffer",
"of",
"the",
"body",
"asynchronously",
".",
"This",
"will",
"avoid",
"any",
"body",
"modifications",
"such",
"as",
"decompression",
"or",
"removal",
"of",
"chunked",
"-",
"encoding",
"markers",
".",
"<p",
">",
"If",
"the"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/inbound/HttpInboundServiceContextImpl.java#L1798-L1809 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/NameSpaceSliceStorage.java | NameSpaceSliceStorage.recoverTransitionRead | void recoverTransitionRead(DataNode datanode, NamespaceInfo nsInfo,
Collection<File> dataDirs, StartupOption startOpt) throws IOException {
assert FSConstants.LAYOUT_VERSION == nsInfo.getLayoutVersion()
: "Block-pool and name-node layout versions must be the same.";
// 1. For each Namespace data directory analyze the state and
// check whether all is consistent before transitioning.
this.storageDirs = new ArrayList<StorageDirectory>(dataDirs.size());
ArrayList<StorageState> dataDirStates = new ArrayList<StorageState>(
dataDirs.size());
for (Iterator<File> it = dataDirs.iterator(); it.hasNext();) {
File dataDir = it.next();
StorageDirectory sd = new StorageDirectory(dataDir, null, false);
StorageState curState;
try {
curState = sd.analyzeStorage(startOpt);
// sd is locked but not opened
switch (curState) {
case NORMAL:
break;
case NON_EXISTENT:
// ignore this storage
LOG.info("Storage directory " + dataDir + " does not exist.");
it.remove();
continue;
case NOT_FORMATTED: // format
LOG.info("Storage directory " + dataDir + " is not formatted.");
if (!sd.isEmpty()) {
LOG.error("Storage directory " + dataDir
+ " is not empty, and will not be formatted! Exiting.");
throw new IOException(
"Storage directory " + dataDir + " is not empty!");
}
LOG.info("Formatting ...");
format(sd, nsInfo);
break;
default: // recovery part is common
sd.doRecover(curState);
}
} catch (IOException ioe) {
sd.unlock();
throw ioe;
}
// add to the storage list. This is inherited from parent class, Storage.
addStorageDir(sd);
dataDirStates.add(curState);
}
if (dataDirs.size() == 0) // none of the data dirs exist
throw new IOException(
"All specified directories are not accessible or do not exist.");
// 2. Do transitions
// Each storage directory is treated individually.
// During startup some of them can upgrade or roll back
// while others could be up-to-date for the regular startup.
doTransition(datanode, nsInfo, startOpt);
// 3. Update all storages. Some of them might have just been formatted.
this.writeAll();
} | java | void recoverTransitionRead(DataNode datanode, NamespaceInfo nsInfo,
Collection<File> dataDirs, StartupOption startOpt) throws IOException {
assert FSConstants.LAYOUT_VERSION == nsInfo.getLayoutVersion()
: "Block-pool and name-node layout versions must be the same.";
// 1. For each Namespace data directory analyze the state and
// check whether all is consistent before transitioning.
this.storageDirs = new ArrayList<StorageDirectory>(dataDirs.size());
ArrayList<StorageState> dataDirStates = new ArrayList<StorageState>(
dataDirs.size());
for (Iterator<File> it = dataDirs.iterator(); it.hasNext();) {
File dataDir = it.next();
StorageDirectory sd = new StorageDirectory(dataDir, null, false);
StorageState curState;
try {
curState = sd.analyzeStorage(startOpt);
// sd is locked but not opened
switch (curState) {
case NORMAL:
break;
case NON_EXISTENT:
// ignore this storage
LOG.info("Storage directory " + dataDir + " does not exist.");
it.remove();
continue;
case NOT_FORMATTED: // format
LOG.info("Storage directory " + dataDir + " is not formatted.");
if (!sd.isEmpty()) {
LOG.error("Storage directory " + dataDir
+ " is not empty, and will not be formatted! Exiting.");
throw new IOException(
"Storage directory " + dataDir + " is not empty!");
}
LOG.info("Formatting ...");
format(sd, nsInfo);
break;
default: // recovery part is common
sd.doRecover(curState);
}
} catch (IOException ioe) {
sd.unlock();
throw ioe;
}
// add to the storage list. This is inherited from parent class, Storage.
addStorageDir(sd);
dataDirStates.add(curState);
}
if (dataDirs.size() == 0) // none of the data dirs exist
throw new IOException(
"All specified directories are not accessible or do not exist.");
// 2. Do transitions
// Each storage directory is treated individually.
// During startup some of them can upgrade or roll back
// while others could be up-to-date for the regular startup.
doTransition(datanode, nsInfo, startOpt);
// 3. Update all storages. Some of them might have just been formatted.
this.writeAll();
} | [
"void",
"recoverTransitionRead",
"(",
"DataNode",
"datanode",
",",
"NamespaceInfo",
"nsInfo",
",",
"Collection",
"<",
"File",
">",
"dataDirs",
",",
"StartupOption",
"startOpt",
")",
"throws",
"IOException",
"{",
"assert",
"FSConstants",
".",
"LAYOUT_VERSION",
"==",
... | Analyze storage directories. Recover from previous transitions if required.
@param datanode Datanode to which this storage belongs to
@param nsInfo namespace information
@param dataDirs storage directories of namespace
@param startOpt startup option
@throws IOException on error | [
"Analyze",
"storage",
"directories",
".",
"Recover",
"from",
"previous",
"transitions",
"if",
"required",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/NameSpaceSliceStorage.java#L89-L149 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Primitives.java | Primitives.unbox | public static long[] unbox(final Long[] a, final long valueForNull) {
if (a == null) {
return null;
}
return unbox(a, 0, a.length, valueForNull);
} | java | public static long[] unbox(final Long[] a, final long valueForNull) {
if (a == null) {
return null;
}
return unbox(a, 0, a.length, valueForNull);
} | [
"public",
"static",
"long",
"[",
"]",
"unbox",
"(",
"final",
"Long",
"[",
"]",
"a",
",",
"final",
"long",
"valueForNull",
")",
"{",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"unbox",
"(",
"a",
",",
"0",
",",
... | <p>
Converts an array of object Long to primitives handling {@code null}.
</p>
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param a
a {@code Long} array, may be {@code null}
@param valueForNull
the value to insert if {@code null} found
@return a {@code long} array, {@code null} if null array input | [
"<p",
">",
"Converts",
"an",
"array",
"of",
"object",
"Long",
"to",
"primitives",
"handling",
"{",
"@code",
"null",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Primitives.java#L1078-L1084 |
square/javapoet | src/main/java/com/squareup/javapoet/TypeVariableName.java | TypeVariableName.get | public static TypeVariableName get(String name, TypeName... bounds) {
return TypeVariableName.of(name, Arrays.asList(bounds));
} | java | public static TypeVariableName get(String name, TypeName... bounds) {
return TypeVariableName.of(name, Arrays.asList(bounds));
} | [
"public",
"static",
"TypeVariableName",
"get",
"(",
"String",
"name",
",",
"TypeName",
"...",
"bounds",
")",
"{",
"return",
"TypeVariableName",
".",
"of",
"(",
"name",
",",
"Arrays",
".",
"asList",
"(",
"bounds",
")",
")",
";",
"}"
] | Returns type variable named {@code name} with {@code bounds}. | [
"Returns",
"type",
"variable",
"named",
"{"
] | train | https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/TypeVariableName.java#L93-L95 |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/RegisterThingResult.java | RegisterThingResult.withResourceArns | public RegisterThingResult withResourceArns(java.util.Map<String, String> resourceArns) {
setResourceArns(resourceArns);
return this;
} | java | public RegisterThingResult withResourceArns(java.util.Map<String, String> resourceArns) {
setResourceArns(resourceArns);
return this;
} | [
"public",
"RegisterThingResult",
"withResourceArns",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"resourceArns",
")",
"{",
"setResourceArns",
"(",
"resourceArns",
")",
";",
"return",
"this",
";",
"}"
] | <p>
ARNs for the generated resources.
</p>
@param resourceArns
ARNs for the generated resources.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"ARNs",
"for",
"the",
"generated",
"resources",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/RegisterThingResult.java#L109-L112 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceValidator.java | PersistenceValidator.isValidEntityObject | public boolean isValidEntityObject(Object entity, EntityMetadata metadata)
{
if (entity == null)
{
log.error("Entity to be persisted must not be null, operation failed");
return false;
}
Object id = PropertyAccessorHelper.getId(entity, metadata);
if (id == null)
{
log.error("Entity to be persisted can't have Primary key set to null.");
throw new IllegalArgumentException("Entity to be persisted can't have Primary key set to null.");
// return false;
}
return true;
} | java | public boolean isValidEntityObject(Object entity, EntityMetadata metadata)
{
if (entity == null)
{
log.error("Entity to be persisted must not be null, operation failed");
return false;
}
Object id = PropertyAccessorHelper.getId(entity, metadata);
if (id == null)
{
log.error("Entity to be persisted can't have Primary key set to null.");
throw new IllegalArgumentException("Entity to be persisted can't have Primary key set to null.");
// return false;
}
return true;
} | [
"public",
"boolean",
"isValidEntityObject",
"(",
"Object",
"entity",
",",
"EntityMetadata",
"metadata",
")",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"log",
".",
"error",
"(",
"\"Entity to be persisted must not be null, operation failed\"",
")",
";",
"retur... | Validates an entity object for CRUD operations
@param entity
Instance of entity object
@return True if entity object is valid, false otherwise | [
"Validates",
"an",
"entity",
"object",
"for",
"CRUD",
"operations"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceValidator.java#L69-L85 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java | JBBPCompiler.registerNamedField | private static void registerNamedField(final String normalizedName, final int structureBorder, final int offset, final List<JBBPNamedFieldInfo> namedFields, final JBBPToken token) {
for (int i = namedFields.size() - 1; i >= structureBorder; i--) {
final JBBPNamedFieldInfo info = namedFields.get(i);
if (info.getFieldPath().equals(normalizedName)) {
throw new JBBPCompilationException("Duplicated named field detected [" + normalizedName + ']', token);
}
}
namedFields.add(new JBBPNamedFieldInfo(normalizedName, normalizedName, offset));
} | java | private static void registerNamedField(final String normalizedName, final int structureBorder, final int offset, final List<JBBPNamedFieldInfo> namedFields, final JBBPToken token) {
for (int i = namedFields.size() - 1; i >= structureBorder; i--) {
final JBBPNamedFieldInfo info = namedFields.get(i);
if (info.getFieldPath().equals(normalizedName)) {
throw new JBBPCompilationException("Duplicated named field detected [" + normalizedName + ']', token);
}
}
namedFields.add(new JBBPNamedFieldInfo(normalizedName, normalizedName, offset));
} | [
"private",
"static",
"void",
"registerNamedField",
"(",
"final",
"String",
"normalizedName",
",",
"final",
"int",
"structureBorder",
",",
"final",
"int",
"offset",
",",
"final",
"List",
"<",
"JBBPNamedFieldInfo",
">",
"namedFields",
",",
"final",
"JBBPToken",
"tok... | Register a name field info item in a named field list.
@param normalizedName normalized name of the named field
@param offset the named field offset
@param namedFields the named field info list for registration
@param token the token for the field
@throws JBBPCompilationException if there is already a registered field for
the path | [
"Register",
"a",
"name",
"field",
"info",
"item",
"in",
"a",
"named",
"field",
"list",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java#L511-L519 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/UpdateGatewayResponseResult.java | UpdateGatewayResponseResult.withResponseParameters | public UpdateGatewayResponseResult withResponseParameters(java.util.Map<String, String> responseParameters) {
setResponseParameters(responseParameters);
return this;
} | java | public UpdateGatewayResponseResult withResponseParameters(java.util.Map<String, String> responseParameters) {
setResponseParameters(responseParameters);
return this;
} | [
"public",
"UpdateGatewayResponseResult",
"withResponseParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseParameters",
")",
"{",
"setResponseParameters",
"(",
"responseParameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Response parameters (paths, query strings and headers) of the <a>GatewayResponse</a> as a string-to-string map of
key-value pairs.
</p>
@param responseParameters
Response parameters (paths, query strings and headers) of the <a>GatewayResponse</a> as a string-to-string
map of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Response",
"parameters",
"(",
"paths",
"query",
"strings",
"and",
"headers",
")",
"of",
"the",
"<a",
">",
"GatewayResponse<",
"/",
"a",
">",
"as",
"a",
"string",
"-",
"to",
"-",
"string",
"map",
"of",
"key",
"-",
"value",
"pairs",
".",
"<... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/UpdateGatewayResponseResult.java#L483-L486 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java | NumericShaper.getContextualShaper | public static NumericShaper getContextualShaper(int ranges, int defaultContext) {
int key = getKeyFromMask(defaultContext);
ranges |= CONTEXTUAL_MASK;
return new NumericShaper(key, ranges);
} | java | public static NumericShaper getContextualShaper(int ranges, int defaultContext) {
int key = getKeyFromMask(defaultContext);
ranges |= CONTEXTUAL_MASK;
return new NumericShaper(key, ranges);
} | [
"public",
"static",
"NumericShaper",
"getContextualShaper",
"(",
"int",
"ranges",
",",
"int",
"defaultContext",
")",
"{",
"int",
"key",
"=",
"getKeyFromMask",
"(",
"defaultContext",
")",
";",
"ranges",
"|=",
"CONTEXTUAL_MASK",
";",
"return",
"new",
"NumericShaper"... | Returns a contextual shaper for the provided unicode range(s).
Latin-1 (EUROPEAN) digits will be converted to the decimal digits
corresponding to the range of the preceding text, if the
range is one of the provided ranges. Multiple ranges are
represented by or-ing the values together, for example,
<code>NumericShaper.ARABIC | NumericShaper.THAI</code>. The
shaper uses defaultContext as the starting context.
@param ranges the specified Unicode ranges
@param defaultContext the starting context, such as
<code>NumericShaper.EUROPEAN</code>
@return a shaper for the specified Unicode ranges.
@throws IllegalArgumentException if the specified
<code>defaultContext</code> is not a single valid range. | [
"Returns",
"a",
"contextual",
"shaper",
"for",
"the",
"provided",
"unicode",
"range",
"(",
"s",
")",
".",
"Latin",
"-",
"1",
"(",
"EUROPEAN",
")",
"digits",
"will",
"be",
"converted",
"to",
"the",
"decimal",
"digits",
"corresponding",
"to",
"the",
"range",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java#L1019-L1023 |
ZuInnoTe/hadoopcryptoledger | inputformat/src/main/java/org/zuinnote/hadoop/ethereum/format/common/EthereumUtil.java | EthereumUtil.decodeRLPElement | private static RLPElement decodeRLPElement(ByteBuffer bb) {
RLPElement result=null;
byte firstByte = bb.get();
int firstByteUnsigned = firstByte & 0xFF;
if (firstByteUnsigned <= 0x7F) {
result=new RLPElement(new byte[] {firstByte},new byte[] {firstByte});
} else if ((firstByteUnsigned>=0x80) && (firstByteUnsigned<=0xb7)) {
// read indicator
byte[] indicator=new byte[]{firstByte};
int noOfBytes = firstByteUnsigned - 0x80;
// read raw data
byte[] rawData = new byte[noOfBytes];
if (noOfBytes > 0) {
bb.get(rawData);
}
result=new RLPElement(indicator,rawData);
} else if ((firstByteUnsigned>=0xb8) && (firstByteUnsigned<=0xbf)) {
// read size of indicator (size of the size)
int NoOfBytesSize = firstByteUnsigned-0xb7;
byte[] indicator = new byte[NoOfBytesSize+1];
indicator[0]=firstByte;
bb.get(indicator, 1, NoOfBytesSize);
long noOfBytes = convertIndicatorToRLPSize(indicator);
// read the data
byte[] rawData=new byte[(int) noOfBytes];
bb.get(rawData);
result= new RLPElement(indicator,rawData);
} else {
result=null;
}
return result;
} | java | private static RLPElement decodeRLPElement(ByteBuffer bb) {
RLPElement result=null;
byte firstByte = bb.get();
int firstByteUnsigned = firstByte & 0xFF;
if (firstByteUnsigned <= 0x7F) {
result=new RLPElement(new byte[] {firstByte},new byte[] {firstByte});
} else if ((firstByteUnsigned>=0x80) && (firstByteUnsigned<=0xb7)) {
// read indicator
byte[] indicator=new byte[]{firstByte};
int noOfBytes = firstByteUnsigned - 0x80;
// read raw data
byte[] rawData = new byte[noOfBytes];
if (noOfBytes > 0) {
bb.get(rawData);
}
result=new RLPElement(indicator,rawData);
} else if ((firstByteUnsigned>=0xb8) && (firstByteUnsigned<=0xbf)) {
// read size of indicator (size of the size)
int NoOfBytesSize = firstByteUnsigned-0xb7;
byte[] indicator = new byte[NoOfBytesSize+1];
indicator[0]=firstByte;
bb.get(indicator, 1, NoOfBytesSize);
long noOfBytes = convertIndicatorToRLPSize(indicator);
// read the data
byte[] rawData=new byte[(int) noOfBytes];
bb.get(rawData);
result= new RLPElement(indicator,rawData);
} else {
result=null;
}
return result;
} | [
"private",
"static",
"RLPElement",
"decodeRLPElement",
"(",
"ByteBuffer",
"bb",
")",
"{",
"RLPElement",
"result",
"=",
"null",
";",
"byte",
"firstByte",
"=",
"bb",
".",
"get",
"(",
")",
";",
"int",
"firstByteUnsigned",
"=",
"firstByte",
"&",
"0xFF",
";",
"... | /*
Decodes an RLPElement from the given ByteBuffer
@param bb Bytebuffer containing an RLPElement
@return RLPElement in case the byte stream represents a valid RLPElement, null if not | [
"/",
"*",
"Decodes",
"an",
"RLPElement",
"from",
"the",
"given",
"ByteBuffer"
] | train | https://github.com/ZuInnoTe/hadoopcryptoledger/blob/5c9bfb61dd1a82374cd0de8413a7c66391ee4414/inputformat/src/main/java/org/zuinnote/hadoop/ethereum/format/common/EthereumUtil.java#L146-L179 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/builder/EqualsBuilder.java | EqualsBuilder.reflectionEquals | public static boolean reflectionEquals(final Object lhs, final Object rhs, final Collection<String> excludeFields) {
return reflectionEquals(lhs, rhs, ArrayUtil.toArray(excludeFields, String.class));
} | java | public static boolean reflectionEquals(final Object lhs, final Object rhs, final Collection<String> excludeFields) {
return reflectionEquals(lhs, rhs, ArrayUtil.toArray(excludeFields, String.class));
} | [
"public",
"static",
"boolean",
"reflectionEquals",
"(",
"final",
"Object",
"lhs",
",",
"final",
"Object",
"rhs",
",",
"final",
"Collection",
"<",
"String",
">",
"excludeFields",
")",
"{",
"return",
"reflectionEquals",
"(",
"lhs",
",",
"rhs",
",",
"ArrayUtil",
... | <p>This method uses reflection to determine if the two <code>Object</code>s
are equal.</p>
<p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
fields. This means that it will throw a security exception if run under
a security manager, if the permissions are not set up correctly. It is also
not as efficient as testing explicitly. Non-primitive fields are compared using
<code>equals()</code>.</p>
<p>Transient members will be not be tested, as they are likely derived
fields, and not part of the value of the Object.</p>
<p>Static fields will not be tested. Superclass fields will be included.</p>
@param lhs <code>this</code> object
@param rhs the other object
@param excludeFields Collection of String field names to exclude from testing
@return <code>true</code> if the two Objects have tested equals. | [
"<p",
">",
"This",
"method",
"uses",
"reflection",
"to",
"determine",
"if",
"the",
"two",
"<code",
">",
"Object<",
"/",
"code",
">",
"s",
"are",
"equal",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/EqualsBuilder.java#L233-L235 |
b3dgs/lionengine | lionengine-network/src/main/java/com/b3dgs/lionengine/network/ServerImpl.java | ServerImpl.receiveDisconnected | private void receiveDisconnected(ClientSocket client, byte from, StateConnection expected) throws IOException
{
if (ServerImpl.checkValidity(client, from, expected))
{
// Notify other clients
client.setState(StateConnection.DISCONNECTED);
for (final ClientListener listener : listeners)
{
listener.notifyClientDisconnected(Byte.valueOf(client.getId()), client.getName());
}
for (final ClientSocket other : clients.values())
{
if (other.getId() == from || other.getState() != StateConnection.CONNECTED)
{
continue;
}
other.getOut().writeByte(NetworkMessageSystemId.OTHER_CLIENT_DISCONNECTED);
ServerImpl.writeIdAndName(other, client.getId(), client.getName());
// Send
other.getOut().flush();
}
removeClient(Byte.valueOf(from));
}
} | java | private void receiveDisconnected(ClientSocket client, byte from, StateConnection expected) throws IOException
{
if (ServerImpl.checkValidity(client, from, expected))
{
// Notify other clients
client.setState(StateConnection.DISCONNECTED);
for (final ClientListener listener : listeners)
{
listener.notifyClientDisconnected(Byte.valueOf(client.getId()), client.getName());
}
for (final ClientSocket other : clients.values())
{
if (other.getId() == from || other.getState() != StateConnection.CONNECTED)
{
continue;
}
other.getOut().writeByte(NetworkMessageSystemId.OTHER_CLIENT_DISCONNECTED);
ServerImpl.writeIdAndName(other, client.getId(), client.getName());
// Send
other.getOut().flush();
}
removeClient(Byte.valueOf(from));
}
} | [
"private",
"void",
"receiveDisconnected",
"(",
"ClientSocket",
"client",
",",
"byte",
"from",
",",
"StateConnection",
"expected",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ServerImpl",
".",
"checkValidity",
"(",
"client",
",",
"from",
",",
"expected",
")",
... | Update the receive disconnected state.
@param client The current client.
@param from The id from.
@param expected The expected client state.
@throws IOException If error. | [
"Update",
"the",
"receive",
"disconnected",
"state",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/ServerImpl.java#L287-L310 |
petergeneric/stdlib | guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/TransactionMethodInterceptor.java | TransactionMethodInterceptor.shouldRollback | private boolean shouldRollback(Transactional annotation, Exception e)
{
return isInstanceOf(e, annotation.rollbackOn()) && !isInstanceOf(e, annotation.exceptOn());
} | java | private boolean shouldRollback(Transactional annotation, Exception e)
{
return isInstanceOf(e, annotation.rollbackOn()) && !isInstanceOf(e, annotation.exceptOn());
} | [
"private",
"boolean",
"shouldRollback",
"(",
"Transactional",
"annotation",
",",
"Exception",
"e",
")",
"{",
"return",
"isInstanceOf",
"(",
"e",
",",
"annotation",
".",
"rollbackOn",
"(",
")",
")",
"&&",
"!",
"isInstanceOf",
"(",
"e",
",",
"annotation",
".",... | @param annotation
The metadata annotation of the method
@param e
The exception to test for rollback
@return returns true if the transaction should be rolled back, otherwise false | [
"@param",
"annotation",
"The",
"metadata",
"annotation",
"of",
"the",
"method",
"@param",
"e",
"The",
"exception",
"to",
"test",
"for",
"rollback"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/TransactionMethodInterceptor.java#L390-L393 |
m-m-m/util | value/src/main/java/net/sf/mmm/util/value/impl/AbstractValueConverterToContainer.java | AbstractValueConverterToContainer.convertFromCollection | protected <T extends CONTAINER> T convertFromCollection(Collection collectionValue, Object valueSource, GenericType<T> targetType) {
int size = collectionValue.size();
T container = createContainer(targetType, size);
int i = 0;
for (Object element : collectionValue) {
convertContainerEntry(element, i, container, valueSource, targetType, collectionValue);
i++;
}
return container;
} | java | protected <T extends CONTAINER> T convertFromCollection(Collection collectionValue, Object valueSource, GenericType<T> targetType) {
int size = collectionValue.size();
T container = createContainer(targetType, size);
int i = 0;
for (Object element : collectionValue) {
convertContainerEntry(element, i, container, valueSource, targetType, collectionValue);
i++;
}
return container;
} | [
"protected",
"<",
"T",
"extends",
"CONTAINER",
">",
"T",
"convertFromCollection",
"(",
"Collection",
"collectionValue",
",",
"Object",
"valueSource",
",",
"GenericType",
"<",
"T",
">",
"targetType",
")",
"{",
"int",
"size",
"=",
"collectionValue",
".",
"size",
... | This method performs the {@link #convert(Object, Object, GenericType) conversion} for {@link Collection}
values.
@param <T> is the generic type of {@code targetType}.
@param collectionValue is the {@link Collection} value to convert.
@param valueSource describes the source of the value or {@code null} if NOT available.
@param targetType is the {@link #getTargetType() target-type} to convert to.
@return the converted container. | [
"This",
"method",
"performs",
"the",
"{",
"@link",
"#convert",
"(",
"Object",
"Object",
"GenericType",
")",
"conversion",
"}",
"for",
"{",
"@link",
"Collection",
"}",
"values",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/value/src/main/java/net/sf/mmm/util/value/impl/AbstractValueConverterToContainer.java#L149-L159 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.deletePublishJob | public void deletePublishJob(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException {
getProjectDriver(dbc).deletePublishJob(dbc, publishHistoryId);
} | java | public void deletePublishJob(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException {
getProjectDriver(dbc).deletePublishJob(dbc, publishHistoryId);
} | [
"public",
"void",
"deletePublishJob",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"publishHistoryId",
")",
"throws",
"CmsException",
"{",
"getProjectDriver",
"(",
"dbc",
")",
".",
"deletePublishJob",
"(",
"dbc",
",",
"publishHistoryId",
")",
";",
"}"
] | Deletes a publish job identified by its history id.<p>
@param dbc the current database context
@param publishHistoryId the history id identifying the publish job
@throws CmsException if something goes wrong | [
"Deletes",
"a",
"publish",
"job",
"identified",
"by",
"its",
"history",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2775-L2778 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyTotalLeastSquares.java | HomographyTotalLeastSquares.process | public boolean process(List<AssociatedPair> points , DMatrixRMaj foundH ) {
if (points.size() < 4)
throw new IllegalArgumentException("Must be at least 4 points.");
// Have to normalize the points. Being zero mean is essential in its derivation
LowLevelMultiViewOps.computeNormalization(points, N1, N2);
LowLevelMultiViewOps.applyNormalization(points,N1,N2,X1,X2);
// Construct the linear system which is used to solve for H[6] to H[8]
constructA678();
// Solve for those elements using the null space
if( !solverNull.process(A,1,nullspace))
return false;
DMatrixRMaj H = foundH;
H.data[6] = nullspace.data[0];
H.data[7] = nullspace.data[1];
H.data[8] = nullspace.data[2];
// Determine H[0] to H[5]
H.data[2] = -(XP_bar[0]*H.data[6] + XP_bar[1]*H.data[7]);
H.data[5] = -(XP_bar[2]*H.data[6] + XP_bar[3]*H.data[7]);
backsubstitution0134(P_plus,X1,X2,H.data);
// Remove the normalization
HomographyDirectLinearTransform.undoNormalizationH(foundH,N1,N2);
CommonOps_DDRM.scale(1.0/foundH.get(2,2),foundH);
return true;
} | java | public boolean process(List<AssociatedPair> points , DMatrixRMaj foundH ) {
if (points.size() < 4)
throw new IllegalArgumentException("Must be at least 4 points.");
// Have to normalize the points. Being zero mean is essential in its derivation
LowLevelMultiViewOps.computeNormalization(points, N1, N2);
LowLevelMultiViewOps.applyNormalization(points,N1,N2,X1,X2);
// Construct the linear system which is used to solve for H[6] to H[8]
constructA678();
// Solve for those elements using the null space
if( !solverNull.process(A,1,nullspace))
return false;
DMatrixRMaj H = foundH;
H.data[6] = nullspace.data[0];
H.data[7] = nullspace.data[1];
H.data[8] = nullspace.data[2];
// Determine H[0] to H[5]
H.data[2] = -(XP_bar[0]*H.data[6] + XP_bar[1]*H.data[7]);
H.data[5] = -(XP_bar[2]*H.data[6] + XP_bar[3]*H.data[7]);
backsubstitution0134(P_plus,X1,X2,H.data);
// Remove the normalization
HomographyDirectLinearTransform.undoNormalizationH(foundH,N1,N2);
CommonOps_DDRM.scale(1.0/foundH.get(2,2),foundH);
return true;
} | [
"public",
"boolean",
"process",
"(",
"List",
"<",
"AssociatedPair",
">",
"points",
",",
"DMatrixRMaj",
"foundH",
")",
"{",
"if",
"(",
"points",
".",
"size",
"(",
")",
"<",
"4",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must be at least 4 points.... | <p>
Computes the homography matrix given a set of observed points in two images. A set of {@link AssociatedPair}
is passed in. The computed homography 'H' is found such that the attributes 'p1' and 'p2' in {@link AssociatedPair}
refers to x1 and x2, respectively, in the equation below:<br>
x<sub>2</sub> = H*x<sub>1</sub>
</p>
@param points A set of observed image points that are generated from a planar object. Minimum of 4 pairs required.
@param foundH Output: Storage for the found solution. 3x3 matrix.
@return true if the calculation was a success. | [
"<p",
">",
"Computes",
"the",
"homography",
"matrix",
"given",
"a",
"set",
"of",
"observed",
"points",
"in",
"two",
"images",
".",
"A",
"set",
"of",
"{",
"@link",
"AssociatedPair",
"}",
"is",
"passed",
"in",
".",
"The",
"computed",
"homography",
"H",
"is... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyTotalLeastSquares.java#L77-L109 |
JetBrains/xodus | environment/src/main/java/jetbrains/exodus/tree/patricia/MutableNode.java | MutableNode.setRightChild | void setRightChild(final byte b, @NotNull final MutableNode child) {
final ChildReference right = children.getRight();
if (right == null || (right.firstByte & 0xff) != (b & 0xff)) {
throw new IllegalArgumentException();
}
children.setAt(children.size() - 1, new ChildReferenceMutable(b, child));
} | java | void setRightChild(final byte b, @NotNull final MutableNode child) {
final ChildReference right = children.getRight();
if (right == null || (right.firstByte & 0xff) != (b & 0xff)) {
throw new IllegalArgumentException();
}
children.setAt(children.size() - 1, new ChildReferenceMutable(b, child));
} | [
"void",
"setRightChild",
"(",
"final",
"byte",
"b",
",",
"@",
"NotNull",
"final",
"MutableNode",
"child",
")",
"{",
"final",
"ChildReference",
"right",
"=",
"children",
".",
"getRight",
"(",
")",
";",
"if",
"(",
"right",
"==",
"null",
"||",
"(",
"right",... | Sets in-place the right child with the same first byte.
@param b next byte of child suffix.
@param child child node. | [
"Sets",
"in",
"-",
"place",
"the",
"right",
"child",
"with",
"the",
"same",
"first",
"byte",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/tree/patricia/MutableNode.java#L190-L196 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/fxml/FXMLUtils.java | FXMLUtils.loadFXML | public static <M extends Model> FXMLComponentBase loadFXML(final M model, final String fxmlPath) {
return loadFXML(model, fxmlPath, null);
} | java | public static <M extends Model> FXMLComponentBase loadFXML(final M model, final String fxmlPath) {
return loadFXML(model, fxmlPath, null);
} | [
"public",
"static",
"<",
"M",
"extends",
"Model",
">",
"FXMLComponentBase",
"loadFXML",
"(",
"final",
"M",
"model",
",",
"final",
"String",
"fxmlPath",
")",
"{",
"return",
"loadFXML",
"(",
"model",
",",
"fxmlPath",
",",
"null",
")",
";",
"}"
] | Load a FXML component without resource bundle.
The fxml path could be :
<ul>
<li>Relative : fxml file will be loaded with the classloader of the given model class</li>
<li>Absolute : fxml file will be loaded with default thread class loader, packages must be separated by / character</li>
</ul>
@param model the model that will manage the fxml node
@param fxmlPath the fxml string path
@return a FXMLComponent object that wrap a fxml node with its controller
@param <M> the model type that will manage this fxml node | [
"Load",
"a",
"FXML",
"component",
"without",
"resource",
"bundle",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/fxml/FXMLUtils.java#L72-L74 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/MountTable.java | MountTable.checkUnderWritableMountPoint | public void checkUnderWritableMountPoint(AlluxioURI alluxioUri)
throws InvalidPathException, AccessControlException {
try (LockResource r = new LockResource(mReadLock)) {
// This will re-acquire the read lock, but that is allowed.
String mountPoint = getMountPoint(alluxioUri);
MountInfo mountInfo = mState.getMountTable().get(mountPoint);
if (mountInfo.getOptions().getReadOnly()) {
throw new AccessControlException(ExceptionMessage.MOUNT_READONLY, alluxioUri, mountPoint);
}
}
} | java | public void checkUnderWritableMountPoint(AlluxioURI alluxioUri)
throws InvalidPathException, AccessControlException {
try (LockResource r = new LockResource(mReadLock)) {
// This will re-acquire the read lock, but that is allowed.
String mountPoint = getMountPoint(alluxioUri);
MountInfo mountInfo = mState.getMountTable().get(mountPoint);
if (mountInfo.getOptions().getReadOnly()) {
throw new AccessControlException(ExceptionMessage.MOUNT_READONLY, alluxioUri, mountPoint);
}
}
} | [
"public",
"void",
"checkUnderWritableMountPoint",
"(",
"AlluxioURI",
"alluxioUri",
")",
"throws",
"InvalidPathException",
",",
"AccessControlException",
"{",
"try",
"(",
"LockResource",
"r",
"=",
"new",
"LockResource",
"(",
"mReadLock",
")",
")",
"{",
"// This will re... | Checks to see if a write operation is allowed for the specified Alluxio path, by determining
if it is under a readonly mount point.
@param alluxioUri an Alluxio path URI
@throws InvalidPathException if the Alluxio path is invalid
@throws AccessControlException if the Alluxio path is under a readonly mount point | [
"Checks",
"to",
"see",
"if",
"a",
"write",
"operation",
"is",
"allowed",
"for",
"the",
"specified",
"Alluxio",
"path",
"by",
"determining",
"if",
"it",
"is",
"under",
"a",
"readonly",
"mount",
"point",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/MountTable.java#L352-L362 |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java | AbstractSubCodeBuilderFragment.nameMatches | protected static boolean nameMatches(EObject element, String pattern) {
if (element instanceof RuleCall) {
return nameMatches(((RuleCall) element).getRule(), pattern);
}
if (element instanceof AbstractRule) {
final String name = ((AbstractRule) element).getName();
final Pattern compilerPattern = Pattern.compile(pattern);
final Matcher matcher = compilerPattern.matcher(name);
if (matcher.find()) {
return true;
}
}
return false;
} | java | protected static boolean nameMatches(EObject element, String pattern) {
if (element instanceof RuleCall) {
return nameMatches(((RuleCall) element).getRule(), pattern);
}
if (element instanceof AbstractRule) {
final String name = ((AbstractRule) element).getName();
final Pattern compilerPattern = Pattern.compile(pattern);
final Matcher matcher = compilerPattern.matcher(name);
if (matcher.find()) {
return true;
}
}
return false;
} | [
"protected",
"static",
"boolean",
"nameMatches",
"(",
"EObject",
"element",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"element",
"instanceof",
"RuleCall",
")",
"{",
"return",
"nameMatches",
"(",
"(",
"(",
"RuleCall",
")",
"element",
")",
".",
"getRule",... | Replies if the name of the given element is matching the pattern.
@param element the element.
@param pattern the name pattern.
@return <code>true</code> if the element's name is matching. | [
"Replies",
"if",
"the",
"name",
"of",
"the",
"given",
"element",
"is",
"matching",
"the",
"pattern",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L662-L675 |
apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.setLibSchedulerLocation | public static boolean setLibSchedulerLocation(
Config runtime,
IScheduler scheduler,
boolean isService) {
// Dummy value since there is no scheduler running as service
final String endpoint = "scheduler_as_lib_no_endpoint";
return setSchedulerLocation(runtime, endpoint, scheduler);
} | java | public static boolean setLibSchedulerLocation(
Config runtime,
IScheduler scheduler,
boolean isService) {
// Dummy value since there is no scheduler running as service
final String endpoint = "scheduler_as_lib_no_endpoint";
return setSchedulerLocation(runtime, endpoint, scheduler);
} | [
"public",
"static",
"boolean",
"setLibSchedulerLocation",
"(",
"Config",
"runtime",
",",
"IScheduler",
"scheduler",
",",
"boolean",
"isService",
")",
"{",
"// Dummy value since there is no scheduler running as service",
"final",
"String",
"endpoint",
"=",
"\"scheduler_as_lib_... | Set the location of scheduler for other processes to discover,
when invoke IScheduler as a library on client side
@param runtime the runtime configuration
@param scheduler the IScheduler to provide more info
@param isService true if the scheduler is a service; false otherwise | [
"Set",
"the",
"location",
"of",
"scheduler",
"for",
"other",
"processes",
"to",
"discover",
"when",
"invoke",
"IScheduler",
"as",
"a",
"library",
"on",
"client",
"side"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L386-L393 |
JodaOrg/joda-money | src/main/java/org/joda/money/Money.java | Money.dividedBy | public Money dividedBy(BigDecimal valueToDivideBy, RoundingMode roundingMode) {
return with(money.dividedBy(valueToDivideBy, roundingMode));
} | java | public Money dividedBy(BigDecimal valueToDivideBy, RoundingMode roundingMode) {
return with(money.dividedBy(valueToDivideBy, roundingMode));
} | [
"public",
"Money",
"dividedBy",
"(",
"BigDecimal",
"valueToDivideBy",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"with",
"(",
"money",
".",
"dividedBy",
"(",
"valueToDivideBy",
",",
"roundingMode",
")",
")",
";",
"}"
] | Returns a copy of this monetary value divided by the specified value.
<p>
This takes this amount and divides it by the specified value, rounding
the result is rounded as specified.
<p>
This instance is immutable and unaffected by this method.
@param valueToDivideBy the scalar value to divide by, not null
@param roundingMode the rounding mode to use, not null
@return the new divided instance, never null
@throws ArithmeticException if dividing by zero
@throws ArithmeticException if the rounding fails | [
"Returns",
"a",
"copy",
"of",
"this",
"monetary",
"value",
"divided",
"by",
"the",
"specified",
"value",
".",
"<p",
">",
"This",
"takes",
"this",
"amount",
"and",
"divides",
"it",
"by",
"the",
"specified",
"value",
"rounding",
"the",
"result",
"is",
"round... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L1074-L1076 |
jhalterman/typetools | src/main/java/net/jodah/typetools/TypeResolver.java | TypeResolver.resolveRawClass | public static Class<?> resolveRawClass(Type genericType, Class<?> subType) {
return resolveRawClass(genericType, subType, null);
} | java | public static Class<?> resolveRawClass(Type genericType, Class<?> subType) {
return resolveRawClass(genericType, subType, null);
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"resolveRawClass",
"(",
"Type",
"genericType",
",",
"Class",
"<",
"?",
">",
"subType",
")",
"{",
"return",
"resolveRawClass",
"(",
"genericType",
",",
"subType",
",",
"null",
")",
";",
"}"
] | Resolves the raw class for the {@code genericType}, using the type variable information from the {@code subType}
else {@link Unknown} if the raw class cannot be resolved.
@param genericType to resolve raw class for
@param subType to extract type variable information from
@return raw class for the {@code genericType} else {@link Unknown} if it cannot be resolved | [
"Resolves",
"the",
"raw",
"class",
"for",
"the",
"{",
"@code",
"genericType",
"}",
"using",
"the",
"type",
"variable",
"information",
"from",
"the",
"{",
"@code",
"subType",
"}",
"else",
"{",
"@link",
"Unknown",
"}",
"if",
"the",
"raw",
"class",
"cannot",
... | train | https://github.com/jhalterman/typetools/blob/0bd6f1f6d146a69e1e497b688a8522fa09adae87/src/main/java/net/jodah/typetools/TypeResolver.java#L372-L374 |
alkacon/opencms-core | src/org/opencms/file/collectors/CmsSubscriptionCollector.java | CmsSubscriptionCollector.getVisitedByFilter | protected CmsVisitedByFilter getVisitedByFilter(CmsObject cms, String param) throws CmsException {
CmsVisitedByFilter filter = new CmsVisitedByFilter();
Map<String, String> params = getParameters(param);
// initialize the filter
initVisitedByFilter(filter, cms, params, true);
return filter;
} | java | protected CmsVisitedByFilter getVisitedByFilter(CmsObject cms, String param) throws CmsException {
CmsVisitedByFilter filter = new CmsVisitedByFilter();
Map<String, String> params = getParameters(param);
// initialize the filter
initVisitedByFilter(filter, cms, params, true);
return filter;
} | [
"protected",
"CmsVisitedByFilter",
"getVisitedByFilter",
"(",
"CmsObject",
"cms",
",",
"String",
"param",
")",
"throws",
"CmsException",
"{",
"CmsVisitedByFilter",
"filter",
"=",
"new",
"CmsVisitedByFilter",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",... | Returns the configured visited by filter to use.<p>
@param cms the current users context
@param param an optional collector parameter
@return the configured visited by filter to use
@throws CmsException if something goes wrong | [
"Returns",
"the",
"configured",
"visited",
"by",
"filter",
"to",
"use",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/collectors/CmsSubscriptionCollector.java#L337-L346 |
graknlabs/grakn | server/src/server/exception/TransactionException.java | TransactionException.regexFailure | public static TransactionException regexFailure(AttributeType attributeType, String value, String regex) {
return create(ErrorMessage.REGEX_INSTANCE_FAILURE.getMessage(regex, attributeType.label(), value));
} | java | public static TransactionException regexFailure(AttributeType attributeType, String value, String regex) {
return create(ErrorMessage.REGEX_INSTANCE_FAILURE.getMessage(regex, attributeType.label(), value));
} | [
"public",
"static",
"TransactionException",
"regexFailure",
"(",
"AttributeType",
"attributeType",
",",
"String",
"value",
",",
"String",
"regex",
")",
"{",
"return",
"create",
"(",
"ErrorMessage",
".",
"REGEX_INSTANCE_FAILURE",
".",
"getMessage",
"(",
"regex",
",",... | Thrown when trying to set a {@code value} on the {@code resource} which does not conform to it's regex | [
"Thrown",
"when",
"trying",
"to",
"set",
"a",
"{"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L180-L182 |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/UnionBugs.java | UnionBugs.copyFile | private static void copyFile(File in, File out) throws IOException {
try (FileInputStream inStream = new FileInputStream(in);
FileOutputStream outStream = new FileOutputStream(out);) {
FileChannel inChannel = inStream.getChannel();
inChannel.transferTo(0, inChannel.size(), outStream.getChannel());
}
} | java | private static void copyFile(File in, File out) throws IOException {
try (FileInputStream inStream = new FileInputStream(in);
FileOutputStream outStream = new FileOutputStream(out);) {
FileChannel inChannel = inStream.getChannel();
inChannel.transferTo(0, inChannel.size(), outStream.getChannel());
}
} | [
"private",
"static",
"void",
"copyFile",
"(",
"File",
"in",
",",
"File",
"out",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"inStream",
"=",
"new",
"FileInputStream",
"(",
"in",
")",
";",
"FileOutputStream",
"outStream",
"=",
"new",
"Fi... | Copy a File
@param in
to Copy From
@param out
to Copy To
@throws IOException | [
"Copy",
"a",
"File"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/UnionBugs.java#L149-L155 |
Jasig/spring-portlet-contrib | spring-webmvc-portlet-contrib/src/main/java/org/jasig/springframework/web/portlet/filter/PortletFilterUtils.java | PortletFilterUtils.doFilter | public static void doFilter(PortletRequest request, PortletResponse response, FilterChain chain)
throws IOException, PortletException {
final Object phase = request.getAttribute(PortletRequest.LIFECYCLE_PHASE);
if (PortletRequest.ACTION_PHASE.equals(phase)) {
chain.doFilter((ActionRequest) request, (ActionResponse) response);
}
else if (PortletRequest.EVENT_PHASE.equals(phase)) {
chain.doFilter((EventRequest) request, (EventResponse) response);
}
else if (PortletRequest.RENDER_PHASE.equals(phase)) {
chain.doFilter((RenderRequest) request, (RenderResponse) response);
}
else if (PortletRequest.RESOURCE_PHASE.equals(phase)) {
chain.doFilter((ResourceRequest) request, (ResourceResponse) response);
}
else {
throw new IllegalArgumentException("Unknown Portlet Lifecycle Phase: " + phase);
}
} | java | public static void doFilter(PortletRequest request, PortletResponse response, FilterChain chain)
throws IOException, PortletException {
final Object phase = request.getAttribute(PortletRequest.LIFECYCLE_PHASE);
if (PortletRequest.ACTION_PHASE.equals(phase)) {
chain.doFilter((ActionRequest) request, (ActionResponse) response);
}
else if (PortletRequest.EVENT_PHASE.equals(phase)) {
chain.doFilter((EventRequest) request, (EventResponse) response);
}
else if (PortletRequest.RENDER_PHASE.equals(phase)) {
chain.doFilter((RenderRequest) request, (RenderResponse) response);
}
else if (PortletRequest.RESOURCE_PHASE.equals(phase)) {
chain.doFilter((ResourceRequest) request, (ResourceResponse) response);
}
else {
throw new IllegalArgumentException("Unknown Portlet Lifecycle Phase: " + phase);
}
} | [
"public",
"static",
"void",
"doFilter",
"(",
"PortletRequest",
"request",
",",
"PortletResponse",
"response",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"PortletException",
"{",
"final",
"Object",
"phase",
"=",
"request",
".",
"getAttribute",
... | Call doFilter and use the {@link javax.portlet.PortletRequest#LIFECYCLE_PHASE} attribute to figure out what
type of request/response are in use and call the appropriate doFilter method on {@link javax.portlet.filter.FilterChain}
@param request a {@link javax.portlet.PortletRequest} object.
@param response a {@link javax.portlet.PortletResponse} object.
@param chain a {@link javax.portlet.filter.FilterChain} object.
@throws java.io.IOException if any.
@throws javax.portlet.PortletException if any. | [
"Call",
"doFilter",
"and",
"use",
"the",
"{",
"@link",
"javax",
".",
"portlet",
".",
"PortletRequest#LIFECYCLE_PHASE",
"}",
"attribute",
"to",
"figure",
"out",
"what",
"type",
"of",
"request",
"/",
"response",
"are",
"in",
"use",
"and",
"call",
"the",
"appro... | train | https://github.com/Jasig/spring-portlet-contrib/blob/719240fa268ddc69900ce9775d9cad3b9c543c6b/spring-webmvc-portlet-contrib/src/main/java/org/jasig/springframework/web/portlet/filter/PortletFilterUtils.java#L61-L81 |
mojohaus/build-helper-maven-plugin | src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.java | ReserveListenerPortMojo.findAvailablePortNumber | private int findAvailablePortNumber( Integer portNumberStartingPoint, List<Integer> reservedPorts )
{
assert portNumberStartingPoint != null;
int candidate = portNumberStartingPoint;
while ( reservedPorts.contains( candidate ) )
{
candidate++;
}
return candidate;
} | java | private int findAvailablePortNumber( Integer portNumberStartingPoint, List<Integer> reservedPorts )
{
assert portNumberStartingPoint != null;
int candidate = portNumberStartingPoint;
while ( reservedPorts.contains( candidate ) )
{
candidate++;
}
return candidate;
} | [
"private",
"int",
"findAvailablePortNumber",
"(",
"Integer",
"portNumberStartingPoint",
",",
"List",
"<",
"Integer",
">",
"reservedPorts",
")",
"{",
"assert",
"portNumberStartingPoint",
"!=",
"null",
";",
"int",
"candidate",
"=",
"portNumberStartingPoint",
";",
"while... | Returns the first number available, starting at portNumberStartingPoint that's not already in the reservedPorts
list.
@param portNumberStartingPoint first port number to start from.
@param reservedPorts the ports already reserved.
@return first number available not in the given list, starting at the given parameter. | [
"Returns",
"the",
"first",
"number",
"available",
"starting",
"at",
"portNumberStartingPoint",
"that",
"s",
"not",
"already",
"in",
"the",
"reservedPorts",
"list",
"."
] | train | https://github.com/mojohaus/build-helper-maven-plugin/blob/9b5f82fb04c9824917f8b29d8e12d804e3c36cf0/src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.java#L366-L375 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.releaseCall | public void releaseCall(
String connId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidanswerData releaseData = new VoicecallsidanswerData();
releaseData.setReasons(Util.toKVList(reasons));
releaseData.setExtensions(Util.toKVList(extensions));
ReleaseData data = new ReleaseData();
data.data(releaseData);
ApiSuccessResponse response = this.voiceApi.release(connId, data);
throwIfNotOk("releaseCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("releaseCall failed.", e);
}
} | java | public void releaseCall(
String connId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidanswerData releaseData = new VoicecallsidanswerData();
releaseData.setReasons(Util.toKVList(reasons));
releaseData.setExtensions(Util.toKVList(extensions));
ReleaseData data = new ReleaseData();
data.data(releaseData);
ApiSuccessResponse response = this.voiceApi.release(connId, data);
throwIfNotOk("releaseCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("releaseCall failed.", e);
}
} | [
"public",
"void",
"releaseCall",
"(",
"String",
"connId",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsidanswerData",
"releaseData",
"=",
"new",
"VoicecallsidanswerData",... | Release the specified call.
@param connId The connection ID of the call.
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Release",
"the",
"specified",
"call",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L635-L654 |
zxing/zxing | android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java | IntentIntegrator.initiateScan | public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) {
Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
// check which types of codes to scan for
if (desiredBarcodeFormats != null) {
// set the desired barcode types
StringBuilder joinedByComma = new StringBuilder();
for (String format : desiredBarcodeFormats) {
if (joinedByComma.length() > 0) {
joinedByComma.append(',');
}
joinedByComma.append(format);
}
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
}
// check requested camera ID
if (cameraId >= 0) {
intentScan.putExtra("SCAN_CAMERA_ID", cameraId);
}
String targetAppPackage = findTargetAppPackage(intentScan);
if (targetAppPackage == null) {
return showDownloadDialog();
}
intentScan.setPackage(targetAppPackage);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentScan.addFlags(FLAG_NEW_DOC);
attachMoreExtras(intentScan);
startActivityForResult(intentScan, REQUEST_CODE);
return null;
} | java | public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) {
Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
// check which types of codes to scan for
if (desiredBarcodeFormats != null) {
// set the desired barcode types
StringBuilder joinedByComma = new StringBuilder();
for (String format : desiredBarcodeFormats) {
if (joinedByComma.length() > 0) {
joinedByComma.append(',');
}
joinedByComma.append(format);
}
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
}
// check requested camera ID
if (cameraId >= 0) {
intentScan.putExtra("SCAN_CAMERA_ID", cameraId);
}
String targetAppPackage = findTargetAppPackage(intentScan);
if (targetAppPackage == null) {
return showDownloadDialog();
}
intentScan.setPackage(targetAppPackage);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentScan.addFlags(FLAG_NEW_DOC);
attachMoreExtras(intentScan);
startActivityForResult(intentScan, REQUEST_CODE);
return null;
} | [
"public",
"final",
"AlertDialog",
"initiateScan",
"(",
"Collection",
"<",
"String",
">",
"desiredBarcodeFormats",
",",
"int",
"cameraId",
")",
"{",
"Intent",
"intentScan",
"=",
"new",
"Intent",
"(",
"BS_PACKAGE",
"+",
"\".SCAN\"",
")",
";",
"intentScan",
".",
... | Initiates a scan, using the specified camera, only for a certain set of barcode types, given as strings corresponding
to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
like {@link #PRODUCT_CODE_TYPES} for example.
@param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
@param cameraId camera ID of the camera to use. A negative value means "no preference".
@return the {@link AlertDialog} that was shown to the user prompting them to download the app
if a prompt was needed, or null otherwise | [
"Initiates",
"a",
"scan",
"using",
"the",
"specified",
"camera",
"only",
"for",
"a",
"certain",
"set",
"of",
"barcode",
"types",
"given",
"as",
"strings",
"corresponding",
"to",
"their",
"names",
"in",
"ZXing",
"s",
"{",
"@code",
"BarcodeFormat",
"}",
"class... | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java#L299-L331 |
bladecoder/blade-ink | src/main/java/com/bladecoder/ink/runtime/ProfileNode.java | ProfileNode.getDescendingOrderedNodes | public Iterable<Entry<String, ProfileNode>> getDescendingOrderedNodes() {
if( nodes == null ) return null;
List<Entry<String, ProfileNode>> averageStepTimes = new LinkedList<Entry<String, ProfileNode>>(nodes.entrySet());
Collections.sort(averageStepTimes, new Comparator<Entry<String, ProfileNode>>() {
public int compare(Entry<String, ProfileNode> o1, Entry<String, ProfileNode> o2) {
return (int) (o1.getValue().totalMillisecs - o2.getValue().totalMillisecs);
}
});
return averageStepTimes;
} | java | public Iterable<Entry<String, ProfileNode>> getDescendingOrderedNodes() {
if( nodes == null ) return null;
List<Entry<String, ProfileNode>> averageStepTimes = new LinkedList<Entry<String, ProfileNode>>(nodes.entrySet());
Collections.sort(averageStepTimes, new Comparator<Entry<String, ProfileNode>>() {
public int compare(Entry<String, ProfileNode> o1, Entry<String, ProfileNode> o2) {
return (int) (o1.getValue().totalMillisecs - o2.getValue().totalMillisecs);
}
});
return averageStepTimes;
} | [
"public",
"Iterable",
"<",
"Entry",
"<",
"String",
",",
"ProfileNode",
">",
">",
"getDescendingOrderedNodes",
"(",
")",
"{",
"if",
"(",
"nodes",
"==",
"null",
")",
"return",
"null",
";",
"List",
"<",
"Entry",
"<",
"String",
",",
"ProfileNode",
">",
">",
... | Returns a sorted enumerable of the nodes in descending order of
how long they took to run. | [
"Returns",
"a",
"sorted",
"enumerable",
"of",
"the",
"nodes",
"in",
"descending",
"order",
"of",
"how",
"long",
"they",
"took",
"to",
"run",
"."
] | train | https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/ProfileNode.java#L98-L111 |
Coveros/selenified | src/main/java/com/coveros/selenified/application/Assert.java | Assert.cookieMatches | @Override
public void cookieMatches(String cookieName, String expectedCookiePattern) {
String cookie = checkCookieMatches(cookieName, expectedCookiePattern, 0, 0);
assertTrue("Cookie Value Mismatch: cookie value of '" + cookie + DOES_NOT_MATCH_PATTERN + expectedCookiePattern + "'", cookie.matches(expectedCookiePattern));
} | java | @Override
public void cookieMatches(String cookieName, String expectedCookiePattern) {
String cookie = checkCookieMatches(cookieName, expectedCookiePattern, 0, 0);
assertTrue("Cookie Value Mismatch: cookie value of '" + cookie + DOES_NOT_MATCH_PATTERN + expectedCookiePattern + "'", cookie.matches(expectedCookiePattern));
} | [
"@",
"Override",
"public",
"void",
"cookieMatches",
"(",
"String",
"cookieName",
",",
"String",
"expectedCookiePattern",
")",
"{",
"String",
"cookie",
"=",
"checkCookieMatches",
"(",
"cookieName",
",",
"expectedCookiePattern",
",",
"0",
",",
"0",
")",
";",
"asse... | Asserts that a cookies with the provided name has a value matching the
expected pattern. This information will be logged and recorded, with a
screenshot for traceability and added debugging support.
@param cookieName the name of the cookie
@param expectedCookiePattern the expected value of the cookie | [
"Asserts",
"that",
"a",
"cookies",
"with",
"the",
"provided",
"name",
"has",
"a",
"value",
"matching",
"the",
"expected",
"pattern",
".",
"This",
"information",
"will",
"be",
"logged",
"and",
"recorded",
"with",
"a",
"screenshot",
"for",
"traceability",
"and",... | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/Assert.java#L328-L332 |
dynjs/dynjs | src/main/java/org/dynjs/runtime/BoundFunction.java | BoundFunction.hasInstance | @Override
public boolean hasInstance(ExecutionContext context, Object v) {
// 15.3.4.5.3
return target.hasInstance(context, v);
} | java | @Override
public boolean hasInstance(ExecutionContext context, Object v) {
// 15.3.4.5.3
return target.hasInstance(context, v);
} | [
"@",
"Override",
"public",
"boolean",
"hasInstance",
"(",
"ExecutionContext",
"context",
",",
"Object",
"v",
")",
"{",
"// 15.3.4.5.3",
"return",
"target",
".",
"hasInstance",
"(",
"context",
",",
"v",
")",
";",
"}"
] | /*
@Override
public Object call(ExecutionContext context, Object self, Object... args) {
15.3.4.5.1
System.err.println( "called args: " + args.length + " // " + Arrays.asList( args ) );
Object[] allArgs = new Object[boundArgs.length + args.length];
for (int i = 0; i < boundArgs.length; ++i) {
allArgs[i] = boundArgs[i];
}
for (int i = boundArgs.length, j = 0; i < boundArgs.length + args.length; ++i, ++j) {
allArgs[i] = args[j];
}
if (self != Types.UNDEFINED) {
return context.call(this.target, self, allArgs);
} else {
return context.call(this.target, this.boundThis, allArgs);
}
} | [
"/",
"*",
"@Override",
"public",
"Object",
"call",
"(",
"ExecutionContext",
"context",
"Object",
"self",
"Object",
"...",
"args",
")",
"{",
"15",
".",
"3",
".",
"4",
".",
"5",
".",
"1",
"System",
".",
"err",
".",
"println",
"(",
"called",
"args",
":"... | train | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/runtime/BoundFunction.java#L79-L83 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java | UnsignedUtils.parseLong | public static long parseLong(String s, int radix) throws NumberFormatException {
if (s == null || s.length() == 0 || s.trim().length() == 0) {
throw new NumberFormatException("Null or empty string");
}
if (radix < Character.MIN_RADIX || radix > MAX_RADIX) {
throw new NumberFormatException("Illegal radix [" + radix + "]");
}
int max_safe_pos = maxSafeDigits[radix] - 1;
long value = 0;
for (int pos = 0; pos < s.length(); pos++) {
int digit = digit(s.charAt(pos), radix);
if (digit == -1) {
throw new NumberFormatException(s);
}
if (pos > max_safe_pos && overflowInParse(value, digit, radix)) {
throw new NumberFormatException("Too large for unsigned long: " + s);
}
value = (value * radix) + digit;
}
return value;
} | java | public static long parseLong(String s, int radix) throws NumberFormatException {
if (s == null || s.length() == 0 || s.trim().length() == 0) {
throw new NumberFormatException("Null or empty string");
}
if (radix < Character.MIN_RADIX || radix > MAX_RADIX) {
throw new NumberFormatException("Illegal radix [" + radix + "]");
}
int max_safe_pos = maxSafeDigits[radix] - 1;
long value = 0;
for (int pos = 0; pos < s.length(); pos++) {
int digit = digit(s.charAt(pos), radix);
if (digit == -1) {
throw new NumberFormatException(s);
}
if (pos > max_safe_pos && overflowInParse(value, digit, radix)) {
throw new NumberFormatException("Too large for unsigned long: " + s);
}
value = (value * radix) + digit;
}
return value;
} | [
"public",
"static",
"long",
"parseLong",
"(",
"String",
"s",
",",
"int",
"radix",
")",
"throws",
"NumberFormatException",
"{",
"if",
"(",
"s",
"==",
"null",
"||",
"s",
".",
"length",
"(",
")",
"==",
"0",
"||",
"s",
".",
"trim",
"(",
")",
".",
"leng... | Returns the unsigned {@code long} value represented by a string with the
given radix.
@param s
the string containing the unsigned {@code long} representation
to be parsed.
@param radix
the radix to use while parsing {@code s}
@throws NumberFormatException
if the string does not contain a valid unsigned {@code long}
with the given radix, or if {@code radix} is not between
{@link Character#MIN_RADIX} and {@link MAX_RADIX}. | [
"Returns",
"the",
"unsigned",
"{",
"@code",
"long",
"}",
"value",
"represented",
"by",
"a",
"string",
"with",
"the",
"given",
"radix",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java#L151-L174 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java | ExpressionUtils.createRootVariable | public static String createRootVariable(Path<?> path, int suffix) {
String variable = path.accept(ToStringVisitor.DEFAULT, TEMPLATES);
return variable + "_" + suffix;
} | java | public static String createRootVariable(Path<?> path, int suffix) {
String variable = path.accept(ToStringVisitor.DEFAULT, TEMPLATES);
return variable + "_" + suffix;
} | [
"public",
"static",
"String",
"createRootVariable",
"(",
"Path",
"<",
"?",
">",
"path",
",",
"int",
"suffix",
")",
"{",
"String",
"variable",
"=",
"path",
".",
"accept",
"(",
"ToStringVisitor",
".",
"DEFAULT",
",",
"TEMPLATES",
")",
";",
"return",
"variabl... | Create a new root variable based on the given path and suffix
@param path base path
@param suffix suffix for variable name
@return path expression | [
"Create",
"a",
"new",
"root",
"variable",
"based",
"on",
"the",
"given",
"path",
"and",
"suffix"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L861-L864 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.getField | public static Field getField(Class<?> beanClass, String name) throws SecurityException {
final Field[] fields = getFields(beanClass);
if (ArrayUtil.isNotEmpty(fields)) {
for (Field field : fields) {
if ((name.equals(field.getName()))) {
return field;
}
}
}
return null;
} | java | public static Field getField(Class<?> beanClass, String name) throws SecurityException {
final Field[] fields = getFields(beanClass);
if (ArrayUtil.isNotEmpty(fields)) {
for (Field field : fields) {
if ((name.equals(field.getName()))) {
return field;
}
}
}
return null;
} | [
"public",
"static",
"Field",
"getField",
"(",
"Class",
"<",
"?",
">",
"beanClass",
",",
"String",
"name",
")",
"throws",
"SecurityException",
"{",
"final",
"Field",
"[",
"]",
"fields",
"=",
"getFields",
"(",
"beanClass",
")",
";",
"if",
"(",
"ArrayUtil",
... | 查找指定类中的所有字段(包括非public字段),也包括父类和Object类的字段, 字段不存在则返回<code>null</code>
@param beanClass 被查找字段的类,不能为null
@param name 字段名
@return 字段
@throws SecurityException 安全异常 | [
"查找指定类中的所有字段(包括非public字段),也包括父类和Object类的字段,",
"字段不存在则返回<code",
">",
"null<",
"/",
"code",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L115-L125 |
rundeck/rundeck | core/src/main/java/com/dtolabs/launcher/Setup.java | Setup.getTemplateFile | private File getTemplateFile(String filename) throws IOException {
File templateFile=null;
final String resource = TEMPLATE_RESOURCES_PATH + "/" + filename;
InputStream is = Setup.class.getClassLoader().getResourceAsStream(resource);
if (null == is) {
throw new RuntimeException("Unable to load required template: " + resource);
}
templateFile = File.createTempFile("temp", filename);
templateFile.deleteOnExit();
try {
return copyToNativeLineEndings(is, templateFile);
} finally {
is.close();
}
} | java | private File getTemplateFile(String filename) throws IOException {
File templateFile=null;
final String resource = TEMPLATE_RESOURCES_PATH + "/" + filename;
InputStream is = Setup.class.getClassLoader().getResourceAsStream(resource);
if (null == is) {
throw new RuntimeException("Unable to load required template: " + resource);
}
templateFile = File.createTempFile("temp", filename);
templateFile.deleteOnExit();
try {
return copyToNativeLineEndings(is, templateFile);
} finally {
is.close();
}
} | [
"private",
"File",
"getTemplateFile",
"(",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"File",
"templateFile",
"=",
"null",
";",
"final",
"String",
"resource",
"=",
"TEMPLATE_RESOURCES_PATH",
"+",
"\"/\"",
"+",
"filename",
";",
"InputStream",
"is",
... | Look for template in the jar resources, otherwise look for it on filepath
@param filename template name
@return file
@throws java.io.IOException on io error | [
"Look",
"for",
"template",
"in",
"the",
"jar",
"resources",
"otherwise",
"look",
"for",
"it",
"on",
"filepath"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/launcher/Setup.java#L215-L229 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/ds/simple/SimpleDataSource.java | SimpleDataSource.init | public void init(String url, String user, String pass, String driver) {
this.driver = StrUtil.isNotBlank(driver) ? driver : DriverUtil.identifyDriver(url);
try {
Class.forName(this.driver);
} catch (ClassNotFoundException e) {
throw new DbRuntimeException(e, "Get jdbc driver [{}] error!", driver);
}
this.url = url;
this.user = user;
this.pass = pass;
} | java | public void init(String url, String user, String pass, String driver) {
this.driver = StrUtil.isNotBlank(driver) ? driver : DriverUtil.identifyDriver(url);
try {
Class.forName(this.driver);
} catch (ClassNotFoundException e) {
throw new DbRuntimeException(e, "Get jdbc driver [{}] error!", driver);
}
this.url = url;
this.user = user;
this.pass = pass;
} | [
"public",
"void",
"init",
"(",
"String",
"url",
",",
"String",
"user",
",",
"String",
"pass",
",",
"String",
"driver",
")",
"{",
"this",
".",
"driver",
"=",
"StrUtil",
".",
"isNotBlank",
"(",
"driver",
")",
"?",
"driver",
":",
"DriverUtil",
".",
"ident... | 初始化
@param url jdbc url
@param user 用户名
@param pass 密码
@param driver JDBC驱动类,传入空则自动识别驱动类
@since 3.1.2 | [
"初始化"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/ds/simple/SimpleDataSource.java#L137-L147 |
mojohaus/aspectj-maven-plugin | src/main/java/org/codehaus/mojo/aspectj/EclipseAjcMojo.java | EclipseAjcMojo.writeDocument | private void writeDocument( Document document, File file )
throws TransformerException, FileNotFoundException
{
document.normalize();
DOMSource source = new DOMSource( document );
StreamResult result = new StreamResult( new FileOutputStream( file ) );
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty( OutputKeys.INDENT, "yes" );
transformer.transform( source, result );
} | java | private void writeDocument( Document document, File file )
throws TransformerException, FileNotFoundException
{
document.normalize();
DOMSource source = new DOMSource( document );
StreamResult result = new StreamResult( new FileOutputStream( file ) );
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty( OutputKeys.INDENT, "yes" );
transformer.transform( source, result );
} | [
"private",
"void",
"writeDocument",
"(",
"Document",
"document",
",",
"File",
"file",
")",
"throws",
"TransformerException",
",",
"FileNotFoundException",
"{",
"document",
".",
"normalize",
"(",
")",
";",
"DOMSource",
"source",
"=",
"new",
"DOMSource",
"(",
"doc... | write document to the file
@param document
@param file
@throws TransformerException
@throws FileNotFoundException | [
"write",
"document",
"to",
"the",
"file"
] | train | https://github.com/mojohaus/aspectj-maven-plugin/blob/120ee1ce08b93873931035ed98cd70e3ccceeefb/src/main/java/org/codehaus/mojo/aspectj/EclipseAjcMojo.java#L319-L328 |
geomajas/geomajas-project-client-gwt2 | common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImplIE.java | DomImplIE.setTransform | public void setTransform(Element element, String transform) {
if (transform.contains("scale")) {
try {
String scaleValue = transform.substring(transform.indexOf("scale(") + 6);
scaleValue = scaleValue.substring(0, scaleValue.indexOf(")"));
Dom.setStyleAttribute(element, "zoom", scaleValue);
} catch (Exception e) {
}
}
} | java | public void setTransform(Element element, String transform) {
if (transform.contains("scale")) {
try {
String scaleValue = transform.substring(transform.indexOf("scale(") + 6);
scaleValue = scaleValue.substring(0, scaleValue.indexOf(")"));
Dom.setStyleAttribute(element, "zoom", scaleValue);
} catch (Exception e) {
}
}
} | [
"public",
"void",
"setTransform",
"(",
"Element",
"element",
",",
"String",
"transform",
")",
"{",
"if",
"(",
"transform",
".",
"contains",
"(",
"\"scale\"",
")",
")",
"{",
"try",
"{",
"String",
"scaleValue",
"=",
"transform",
".",
"substring",
"(",
"trans... | Only very limited support for transformations, so {@link #supportsTransformations()} still returns false.
@param element
@param transform | [
"Only",
"very",
"limited",
"support",
"for",
"transformations",
"so",
"{",
"@link",
"#supportsTransformations",
"()",
"}",
"still",
"returns",
"false",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImplIE.java#L97-L106 |
bazaarvoice/emodb | mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/FileSystemUtil.java | FileSystemUtil.getTableName | @Nullable
public static String getTableName(Path rootPath, Path path) {
path = qualified(rootPath, path);
if (rootPath.equals(path)) {
// Path is root, no table
return null;
}
Path tablePath;
Path parent = path.getParent();
if (Objects.equals(parent, rootPath)) {
// The path itself represents a table (e.g.; emodb://ci.us/mytable)
tablePath = path;
} else if (parent != null && Objects.equals(parent.getParent(), rootPath)) {
// The path is a split (e.g.; emodb://ci.us/mytable/split-id)
tablePath = parent;
} else {
throw new IllegalArgumentException(
format("Path does not represent a table, split, or root (path=%s, root=%s)", path, rootPath));
}
return decode(tablePath.getName());
} | java | @Nullable
public static String getTableName(Path rootPath, Path path) {
path = qualified(rootPath, path);
if (rootPath.equals(path)) {
// Path is root, no table
return null;
}
Path tablePath;
Path parent = path.getParent();
if (Objects.equals(parent, rootPath)) {
// The path itself represents a table (e.g.; emodb://ci.us/mytable)
tablePath = path;
} else if (parent != null && Objects.equals(parent.getParent(), rootPath)) {
// The path is a split (e.g.; emodb://ci.us/mytable/split-id)
tablePath = parent;
} else {
throw new IllegalArgumentException(
format("Path does not represent a table, split, or root (path=%s, root=%s)", path, rootPath));
}
return decode(tablePath.getName());
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getTableName",
"(",
"Path",
"rootPath",
",",
"Path",
"path",
")",
"{",
"path",
"=",
"qualified",
"(",
"rootPath",
",",
"path",
")",
";",
"if",
"(",
"rootPath",
".",
"equals",
"(",
"path",
")",
")",
"{",
... | Gets the table name from a path, or null if the path is the root path. | [
"Gets",
"the",
"table",
"name",
"from",
"a",
"path",
"or",
"null",
"if",
"the",
"path",
"is",
"the",
"root",
"path",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/FileSystemUtil.java#L63-L84 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/isomorphism/mcss/RGraph.java | RGraph.isContainedIn | private boolean isContainedIn(BitSet A, BitSet B) {
boolean result = false;
if (A.isEmpty()) {
return true;
}
BitSet setA = (BitSet) A.clone();
setA.and(B);
if (setA.equals(A)) {
result = true;
}
return result;
} | java | private boolean isContainedIn(BitSet A, BitSet B) {
boolean result = false;
if (A.isEmpty()) {
return true;
}
BitSet setA = (BitSet) A.clone();
setA.and(B);
if (setA.equals(A)) {
result = true;
}
return result;
} | [
"private",
"boolean",
"isContainedIn",
"(",
"BitSet",
"A",
",",
"BitSet",
"B",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"A",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"BitSet",
"setA",
"=",
"(",
"BitSet",
"... | Test if set A is contained in set B.
@param A a bitSet
@param B a bitSet
@return true if A is contained in B | [
"Test",
"if",
"set",
"A",
"is",
"contained",
"in",
"set",
"B",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/isomorphism/mcss/RGraph.java#L559-L574 |
timothyb89/EventBus | src/main/java/org/timothyb89/eventbus/EventBus.java | EventBus.scanInternal | private void scanInternal(Object o, Class clazz) {
for (Method m : clazz.getDeclaredMethods()) {
if (Modifier.isPublic(m.getModifiers())) {
// public fields have already been processed
continue;
}
// skip methods without annotation
if (!m.isAnnotationPresent(EventHandler.class)) {
continue;
}
// set the method accessible and register it
EventHandler h = m.getAnnotation(EventHandler.class);
int priority = h.priority();
boolean vetoable = h.vetoable();
m.setAccessible(true);
registerMethod(o, m, priority, vetoable);
}
} | java | private void scanInternal(Object o, Class clazz) {
for (Method m : clazz.getDeclaredMethods()) {
if (Modifier.isPublic(m.getModifiers())) {
// public fields have already been processed
continue;
}
// skip methods without annotation
if (!m.isAnnotationPresent(EventHandler.class)) {
continue;
}
// set the method accessible and register it
EventHandler h = m.getAnnotation(EventHandler.class);
int priority = h.priority();
boolean vetoable = h.vetoable();
m.setAccessible(true);
registerMethod(o, m, priority, vetoable);
}
} | [
"private",
"void",
"scanInternal",
"(",
"Object",
"o",
",",
"Class",
"clazz",
")",
"{",
"for",
"(",
"Method",
"m",
":",
"clazz",
".",
"getDeclaredMethods",
"(",
")",
")",
"{",
"if",
"(",
"Modifier",
".",
"isPublic",
"(",
"m",
".",
"getModifiers",
"(",
... | Scans non-public members of the given object at the level of the given
class. Due to how {@link Class#getDeclaredMethods()} works, this only
scans members directly defined in {@code clazz}.
@param o the object to scan
@param clazz the specific class to scan | [
"Scans",
"non",
"-",
"public",
"members",
"of",
"the",
"given",
"object",
"at",
"the",
"level",
"of",
"the",
"given",
"class",
".",
"Due",
"to",
"how",
"{"
] | train | https://github.com/timothyb89/EventBus/blob/9285406c16eda84e20da6c72fe2500c24c7848db/src/main/java/org/timothyb89/eventbus/EventBus.java#L188-L209 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java | Misc.checkNotNull | public static void checkNotNull(Object param, String errorMessagePrefix) throws
IllegalArgumentException {
checkArgument(param != null, (errorMessagePrefix != null ? errorMessagePrefix :
"Parameter") + " must not be null.");
} | java | public static void checkNotNull(Object param, String errorMessagePrefix) throws
IllegalArgumentException {
checkArgument(param != null, (errorMessagePrefix != null ? errorMessagePrefix :
"Parameter") + " must not be null.");
} | [
"public",
"static",
"void",
"checkNotNull",
"(",
"Object",
"param",
",",
"String",
"errorMessagePrefix",
")",
"throws",
"IllegalArgumentException",
"{",
"checkArgument",
"(",
"param",
"!=",
"null",
",",
"(",
"errorMessagePrefix",
"!=",
"null",
"?",
"errorMessagePref... | Check that a parameter is not null and throw IllegalArgumentException with a message of
errorMessagePrefix + " must not be null." if it is null, defaulting to "Parameter must not be
null.".
@param param the parameter to check
@param errorMessagePrefix the prefix of the error message to use for the
IllegalArgumentException if the parameter was null
@throws IllegalArgumentException if the parameter was {@code null} | [
"Check",
"that",
"a",
"parameter",
"is",
"not",
"null",
"and",
"throw",
"IllegalArgumentException",
"with",
"a",
"message",
"of",
"errorMessagePrefix",
"+",
"must",
"not",
"be",
"null",
".",
"if",
"it",
"is",
"null",
"defaulting",
"to",
"Parameter",
"must",
... | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java#L95-L99 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/util/AbstractLog.java | AbstractLog.note | public void note(JavaFileObject file, String key, Object ... args) {
report(diags.note(getSource(file), null, key, args));
} | java | public void note(JavaFileObject file, String key, Object ... args) {
report(diags.note(getSource(file), null, key, args));
} | [
"public",
"void",
"note",
"(",
"JavaFileObject",
"file",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"report",
"(",
"diags",
".",
"note",
"(",
"getSource",
"(",
"file",
")",
",",
"null",
",",
"key",
",",
"args",
")",
")",
";",
"}"... | Provide a non-fatal notification, unless suppressed by the -nowarn option.
@param key The key for the localized notification message.
@param args Fields of the notification message. | [
"Provide",
"a",
"non",
"-",
"fatal",
"notification",
"unless",
"suppressed",
"by",
"the",
"-",
"nowarn",
"option",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/util/AbstractLog.java#L230-L232 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java | Encoding.addUnitClause | private void addUnitClause(final MiniSatStyleSolver s, int a, int blocking) {
assert this.clause.size() == 0;
assert a != LIT_UNDEF;
assert var(a) < s.nVars();
this.clause.push(a);
if (blocking != LIT_UNDEF)
this.clause.push(blocking);
s.addClause(this.clause, null);
this.clause.clear();
} | java | private void addUnitClause(final MiniSatStyleSolver s, int a, int blocking) {
assert this.clause.size() == 0;
assert a != LIT_UNDEF;
assert var(a) < s.nVars();
this.clause.push(a);
if (blocking != LIT_UNDEF)
this.clause.push(blocking);
s.addClause(this.clause, null);
this.clause.clear();
} | [
"private",
"void",
"addUnitClause",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"int",
"a",
",",
"int",
"blocking",
")",
"{",
"assert",
"this",
".",
"clause",
".",
"size",
"(",
")",
"==",
"0",
";",
"assert",
"a",
"!=",
"LIT_UNDEF",
";",
"assert",
"va... | Adds a unit clause to the given SAT solver.
@param s the sat solver
@param a the unit literal
@param blocking the blocking literal | [
"Adds",
"a",
"unit",
"clause",
"to",
"the",
"given",
"SAT",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java#L90-L99 |
ginere/ginere-base | src/main/java/eu/ginere/base/util/file/FileUtils.java | FileUtils.append | public static void append(File source, File dest) throws IOException{
try {
FileInputStream in = new FileInputStream(source);
RandomAccessFile out = new RandomAccessFile(dest,"rwd");
try {
FileChannel canalFuente = in.getChannel();
FileChannel canalDestino = out.getChannel();
long count=canalDestino.transferFrom(canalFuente,canalDestino.size(), canalFuente.size());
canalDestino.force(true);
} catch (IOException e) {
throw new IOException("copiando ficheros orig:'" + source.getAbsolutePath()
+ "' destino:'" + dest.getAbsolutePath() + "'", e);
} finally {
IOUtils.closeQuietly(in);
out.close();
}
} catch (FileNotFoundException e) {
throw new IOException("copiando ficheros orig:'" + source.getAbsolutePath()
+ "' destino:'" + dest.getAbsolutePath() + "'", e);
}
} | java | public static void append(File source, File dest) throws IOException{
try {
FileInputStream in = new FileInputStream(source);
RandomAccessFile out = new RandomAccessFile(dest,"rwd");
try {
FileChannel canalFuente = in.getChannel();
FileChannel canalDestino = out.getChannel();
long count=canalDestino.transferFrom(canalFuente,canalDestino.size(), canalFuente.size());
canalDestino.force(true);
} catch (IOException e) {
throw new IOException("copiando ficheros orig:'" + source.getAbsolutePath()
+ "' destino:'" + dest.getAbsolutePath() + "'", e);
} finally {
IOUtils.closeQuietly(in);
out.close();
}
} catch (FileNotFoundException e) {
throw new IOException("copiando ficheros orig:'" + source.getAbsolutePath()
+ "' destino:'" + dest.getAbsolutePath() + "'", e);
}
} | [
"public",
"static",
"void",
"append",
"(",
"File",
"source",
",",
"File",
"dest",
")",
"throws",
"IOException",
"{",
"try",
"{",
"FileInputStream",
"in",
"=",
"new",
"FileInputStream",
"(",
"source",
")",
";",
"RandomAccessFile",
"out",
"=",
"new",
"RandomAc... | Copia el contenido de un fichero a otro en caso de error lanza una excepcion.
@param source
@param dest
@throws IOException | [
"Copia",
"el",
"contenido",
"de",
"un",
"fichero",
"a",
"otro",
"en",
"caso",
"de",
"error",
"lanza",
"una",
"excepcion",
"."
] | train | https://github.com/ginere/ginere-base/blob/b1cc1c5834bd8a31df475c6f3fc0ee51273c5a24/src/main/java/eu/ginere/base/util/file/FileUtils.java#L557-L578 |
appium/java-client | src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java | FeaturesMatchingResult.getRect1 | public Rectangle getRect1() {
verifyPropertyPresence(RECT1);
//noinspection unchecked
return mapToRect((Map<String, Object>) getCommandResult().get(RECT1));
} | java | public Rectangle getRect1() {
verifyPropertyPresence(RECT1);
//noinspection unchecked
return mapToRect((Map<String, Object>) getCommandResult().get(RECT1));
} | [
"public",
"Rectangle",
"getRect1",
"(",
")",
"{",
"verifyPropertyPresence",
"(",
"RECT1",
")",
";",
"//noinspection unchecked",
"return",
"mapToRect",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"getCommandResult",
"(",
")",
".",
"get",
"(",
"RE... | Returns a rect for the `points1` list.
@return The bounding rect for the `points1` list or a zero rect if not enough matching points were found. | [
"Returns",
"a",
"rect",
"for",
"the",
"points1",
"list",
"."
] | train | https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/imagecomparison/FeaturesMatchingResult.java#L80-L84 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/MetadataCache.java | MetadataCache.getTrackCount | private static long getTrackCount(CdjStatus.TrackSourceSlot slot, Client client, int playlistId) throws IOException {
Message response;
if (playlistId == 0) { // Form the proper request to render either all tracks or a playlist
response = client.menuRequest(Message.KnownType.TRACK_MENU_REQ, Message.MenuIdentifier.MAIN_MENU,
slot, NumberField.WORD_0);
}
else {
response = client.menuRequest(Message.KnownType.PLAYLIST_REQ, Message.MenuIdentifier.MAIN_MENU, slot,
NumberField.WORD_0, new NumberField(playlistId), NumberField.WORD_0);
}
return response.getMenuResultsCount();
} | java | private static long getTrackCount(CdjStatus.TrackSourceSlot slot, Client client, int playlistId) throws IOException {
Message response;
if (playlistId == 0) { // Form the proper request to render either all tracks or a playlist
response = client.menuRequest(Message.KnownType.TRACK_MENU_REQ, Message.MenuIdentifier.MAIN_MENU,
slot, NumberField.WORD_0);
}
else {
response = client.menuRequest(Message.KnownType.PLAYLIST_REQ, Message.MenuIdentifier.MAIN_MENU, slot,
NumberField.WORD_0, new NumberField(playlistId), NumberField.WORD_0);
}
return response.getMenuResultsCount();
} | [
"private",
"static",
"long",
"getTrackCount",
"(",
"CdjStatus",
".",
"TrackSourceSlot",
"slot",
",",
"Client",
"client",
",",
"int",
"playlistId",
")",
"throws",
"IOException",
"{",
"Message",
"response",
";",
"if",
"(",
"playlistId",
"==",
"0",
")",
"{",
"/... | Find out how many tracks are present in a playlist (or in all tracks, if {@code playlistId} is 0) without
actually retrieving all the entries. This is used in checking whether a metadata cache matches what is found
in a player slot, and to set up the context for sampling a random set of individual tracks for deeper
comparison.
@param slot the player slot in which the media is located that we would like to compare
@param client the player database connection we can use to perform queries
@param playlistId identifies the playlist we want to know about, or 0 of we are interested in all tracks
@return the number of tracks found in the player database, which is now ready to enumerate them if a positive
value is returned
@throws IOException if there is a problem communicating with the database server | [
"Find",
"out",
"how",
"many",
"tracks",
"are",
"present",
"in",
"a",
"playlist",
"(",
"or",
"in",
"all",
"tracks",
"if",
"{",
"@code",
"playlistId",
"}",
"is",
"0",
")",
"without",
"actually",
"retrieving",
"all",
"the",
"entries",
".",
"This",
"is",
"... | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataCache.java#L1012-L1024 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/MessageBuilder.java | MessageBuilder.stripMentions | public MessageBuilder stripMentions(JDA jda, Message.MentionType... types)
{
return this.stripMentions(jda, null, types);
} | java | public MessageBuilder stripMentions(JDA jda, Message.MentionType... types)
{
return this.stripMentions(jda, null, types);
} | [
"public",
"MessageBuilder",
"stripMentions",
"(",
"JDA",
"jda",
",",
"Message",
".",
"MentionType",
"...",
"types",
")",
"{",
"return",
"this",
".",
"stripMentions",
"(",
"jda",
",",
"null",
",",
"types",
")",
";",
"}"
] | Removes all mentions of the specified types and replaces them with the closest looking textual representation.
<p>Use this over {@link #stripMentions(Guild, Message.MentionType...)} if {@link net.dv8tion.jda.core.entities.User User}
mentions should be replaced with their {@link net.dv8tion.jda.core.entities.User#getName()}.
@param jda
The JDA instance used to resolve the mentions.
@param types
the {@link net.dv8tion.jda.core.entities.Message.MentionType MentionTypes} that should be stripped
@return The MessageBuilder instance. Useful for chaining. | [
"Removes",
"all",
"mentions",
"of",
"the",
"specified",
"types",
"and",
"replaces",
"them",
"with",
"the",
"closest",
"looking",
"textual",
"representation",
"."
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/MessageBuilder.java#L509-L512 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/partition/operation/MigrationRequestOperation.java | MigrationRequestOperation.invokeMigrationOperation | private void invokeMigrationOperation(ReplicaFragmentMigrationState migrationState, boolean firstFragment) {
boolean lastFragment = !fragmentedMigrationEnabled || !namespacesContext.hasNext();
Operation operation = new MigrationOperation(migrationInfo,
firstFragment ? completedMigrations : Collections.emptyList(),
partitionStateVersion, migrationState, firstFragment, lastFragment);
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
Set<ServiceNamespace> namespaces = migrationState != null
? migrationState.getNamespaceVersionMap().keySet() : Collections.emptySet();
logger.finest("Invoking MigrationOperation for namespaces " + namespaces + " and " + migrationInfo
+ ", lastFragment: " + lastFragment);
}
NodeEngine nodeEngine = getNodeEngine();
InternalPartitionServiceImpl partitionService = getService();
Address target = migrationInfo.getDestinationAddress();
nodeEngine.getOperationService()
.createInvocationBuilder(InternalPartitionService.SERVICE_NAME, operation, target)
.setExecutionCallback(new MigrationCallback())
.setResultDeserialized(true)
.setCallTimeout(partitionService.getPartitionMigrationTimeout())
.setTryCount(InternalPartitionService.MIGRATION_RETRY_COUNT)
.setTryPauseMillis(InternalPartitionService.MIGRATION_RETRY_PAUSE)
.invoke();
} | java | private void invokeMigrationOperation(ReplicaFragmentMigrationState migrationState, boolean firstFragment) {
boolean lastFragment = !fragmentedMigrationEnabled || !namespacesContext.hasNext();
Operation operation = new MigrationOperation(migrationInfo,
firstFragment ? completedMigrations : Collections.emptyList(),
partitionStateVersion, migrationState, firstFragment, lastFragment);
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
Set<ServiceNamespace> namespaces = migrationState != null
? migrationState.getNamespaceVersionMap().keySet() : Collections.emptySet();
logger.finest("Invoking MigrationOperation for namespaces " + namespaces + " and " + migrationInfo
+ ", lastFragment: " + lastFragment);
}
NodeEngine nodeEngine = getNodeEngine();
InternalPartitionServiceImpl partitionService = getService();
Address target = migrationInfo.getDestinationAddress();
nodeEngine.getOperationService()
.createInvocationBuilder(InternalPartitionService.SERVICE_NAME, operation, target)
.setExecutionCallback(new MigrationCallback())
.setResultDeserialized(true)
.setCallTimeout(partitionService.getPartitionMigrationTimeout())
.setTryCount(InternalPartitionService.MIGRATION_RETRY_COUNT)
.setTryPauseMillis(InternalPartitionService.MIGRATION_RETRY_PAUSE)
.invoke();
} | [
"private",
"void",
"invokeMigrationOperation",
"(",
"ReplicaFragmentMigrationState",
"migrationState",
",",
"boolean",
"firstFragment",
")",
"{",
"boolean",
"lastFragment",
"=",
"!",
"fragmentedMigrationEnabled",
"||",
"!",
"namespacesContext",
".",
"hasNext",
"(",
")",
... | Invokes the {@link MigrationOperation} on the migration destination. | [
"Invokes",
"the",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/MigrationRequestOperation.java#L139-L165 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java | XDSConsumerAuditor.auditRetrieveDocumentSetEvent | public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String userName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse);
importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
importEvent.addSourceActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
/*
* FIXME: Overriding endpoint URI with "anonymous", for now
*/
String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous";
importEvent.addDestinationActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true);
if (!EventUtils.isEmptyOrNull(userName)) {
importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles);
}
if (!EventUtils.isEmptyOrNull(patientId)) {
importEvent.addPatientParticipantObject(patientId);
}
if (!EventUtils.isEmptyOrNull(documentUniqueIds)) {
for (int i=0; i<documentUniqueIds.length; i++) {
importEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]);
}
}
audit(importEvent);
} | java | public void auditRetrieveDocumentSetEvent(RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String userName,
String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds,
String patientId,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ImportEvent importEvent = new ImportEvent(false, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse);
importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
importEvent.addSourceActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
/*
* FIXME: Overriding endpoint URI with "anonymous", for now
*/
String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous";
importEvent.addDestinationActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true);
if (!EventUtils.isEmptyOrNull(userName)) {
importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles);
}
if (!EventUtils.isEmptyOrNull(patientId)) {
importEvent.addPatientParticipantObject(patientId);
}
if (!EventUtils.isEmptyOrNull(documentUniqueIds)) {
for (int i=0; i<documentUniqueIds.length; i++) {
importEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]);
}
}
audit(importEvent);
} | [
"public",
"void",
"auditRetrieveDocumentSetEvent",
"(",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"repositoryEndpointUri",
",",
"String",
"userName",
",",
"String",
"[",
"]",
"documentUniqueIds",
",",
"String",
"[",
"]",
"repositoryUniqueIds",
",",
"Str... | Audits an ITI-43 Retrieve Document Set event for XDS.b Document Consumer actors.
Sends audit messages for situations when more than one repository and more than one community are specified in the transaction.
@param eventOutcome The event outcome indicator
@param repositoryEndpointUri The Web service endpoint URI for the document repository
@param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved
@param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array)
@param homeCommunityIds The list of XCA Home Community Ids involved in this transaction (aligned with Document Unique Ids array)
@param patientId The patient ID the document(s) relate to (if known)
@param purposesOfUse purpose of use codes (may be taken from XUA token)
@param userRoles roles of the human user (may be taken from XUA token) | [
"Audits",
"an",
"ITI",
"-",
"43",
"Retrieve",
"Document",
"Set",
"event",
"for",
"XDS",
".",
"b",
"Document",
"Consumer",
"actors",
".",
"Sends",
"audit",
"messages",
"for",
"situations",
"when",
"more",
"than",
"one",
"repository",
"and",
"more",
"than",
... | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSConsumerAuditor.java#L209-L240 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.beginUpdateAsync | public Observable<DataLakeAnalyticsAccountInner> beginUpdateAsync(String resourceGroupName, String name, DataLakeAnalyticsAccountInner parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<DataLakeAnalyticsAccountInner>, DataLakeAnalyticsAccountInner>() {
@Override
public DataLakeAnalyticsAccountInner call(ServiceResponse<DataLakeAnalyticsAccountInner> response) {
return response.body();
}
});
} | java | public Observable<DataLakeAnalyticsAccountInner> beginUpdateAsync(String resourceGroupName, String name, DataLakeAnalyticsAccountInner parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<DataLakeAnalyticsAccountInner>, DataLakeAnalyticsAccountInner>() {
@Override
public DataLakeAnalyticsAccountInner call(ServiceResponse<DataLakeAnalyticsAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataLakeAnalyticsAccountInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"DataLakeAnalyticsAccountInner",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroup... | Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param name The name of the Data Lake Analytics account to update.
@param parameters Parameters supplied to the update Data Lake Analytics account operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataLakeAnalyticsAccountInner object | [
"Updates",
"the",
"Data",
"Lake",
"Analytics",
"account",
"object",
"specified",
"by",
"the",
"accountName",
"with",
"the",
"contents",
"of",
"the",
"account",
"object",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L2874-L2881 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckMethodAdapter.java | CheckMethodAdapter.checkSignedShort | static void checkSignedShort(final int value, final String msg) {
if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {
throw new IllegalArgumentException(msg
+ " (must be a signed short): " + value);
}
} | java | static void checkSignedShort(final int value, final String msg) {
if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) {
throw new IllegalArgumentException(msg
+ " (must be a signed short): " + value);
}
} | [
"static",
"void",
"checkSignedShort",
"(",
"final",
"int",
"value",
",",
"final",
"String",
"msg",
")",
"{",
"if",
"(",
"value",
"<",
"Short",
".",
"MIN_VALUE",
"||",
"value",
">",
"Short",
".",
"MAX_VALUE",
")",
"{",
"throw",
"new",
"IllegalArgumentExcept... | Checks that the given value is a signed short.
@param value
the value to be checked.
@param msg
an message to be used in case of error. | [
"Checks",
"that",
"the",
"given",
"value",
"is",
"a",
"signed",
"short",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckMethodAdapter.java#L1125-L1130 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/QuadTree.java | QuadTree.getIntersectionCount | public int getIntersectionCount(Envelope2D query, double tolerance, int maxCount) {
return m_impl.getIntersectionCount(query, tolerance, maxCount);
} | java | public int getIntersectionCount(Envelope2D query, double tolerance, int maxCount) {
return m_impl.getIntersectionCount(query, tolerance, maxCount);
} | [
"public",
"int",
"getIntersectionCount",
"(",
"Envelope2D",
"query",
",",
"double",
"tolerance",
",",
"int",
"maxCount",
")",
"{",
"return",
"m_impl",
".",
"getIntersectionCount",
"(",
"query",
",",
"tolerance",
",",
"maxCount",
")",
";",
"}"
] | Returns the number of elements in the quad tree that intersect the qiven query. Some elements may be duplicated if the quad tree stores duplicates.
\param query The Envelope2D used for the query.
\param tolerance The tolerance used for the intersection tests.
\param max_count If the intersection count becomes greater than or equal to the max_count, then max_count is returned. | [
"Returns",
"the",
"number",
"of",
"elements",
"in",
"the",
"quad",
"tree",
"that",
"intersect",
"the",
"qiven",
"query",
".",
"Some",
"elements",
"may",
"be",
"duplicated",
"if",
"the",
"quad",
"tree",
"stores",
"duplicates",
".",
"\\",
"param",
"query",
"... | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/QuadTree.java#L202-L204 |
graphhopper/graphhopper | api/src/main/java/com/graphhopper/util/shapes/BBox.java | BBox.calculateIntersection | public BBox calculateIntersection(BBox bBox) {
if (!this.intersects(bBox))
return null;
double minLon = Math.max(this.minLon, bBox.minLon);
double maxLon = Math.min(this.maxLon, bBox.maxLon);
double minLat = Math.max(this.minLat, bBox.minLat);
double maxLat = Math.min(this.maxLat, bBox.maxLat);
return new BBox(minLon, maxLon, minLat, maxLat);
} | java | public BBox calculateIntersection(BBox bBox) {
if (!this.intersects(bBox))
return null;
double minLon = Math.max(this.minLon, bBox.minLon);
double maxLon = Math.min(this.maxLon, bBox.maxLon);
double minLat = Math.max(this.minLat, bBox.minLat);
double maxLat = Math.min(this.maxLat, bBox.maxLat);
return new BBox(minLon, maxLon, minLat, maxLat);
} | [
"public",
"BBox",
"calculateIntersection",
"(",
"BBox",
"bBox",
")",
"{",
"if",
"(",
"!",
"this",
".",
"intersects",
"(",
"bBox",
")",
")",
"return",
"null",
";",
"double",
"minLon",
"=",
"Math",
".",
"max",
"(",
"this",
".",
"minLon",
",",
"bBox",
"... | Calculates the intersecting BBox between this and the specified BBox
@return the intersecting BBox or null if not intersecting | [
"Calculates",
"the",
"intersecting",
"BBox",
"between",
"this",
"and",
"the",
"specified",
"BBox"
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/api/src/main/java/com/graphhopper/util/shapes/BBox.java#L125-L135 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaTransferManager.java | AsperaTransferManager.uploadDirectory | public Future<AsperaTransaction> uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory,
boolean includeSubdirectories, AsperaConfig sessionDetails, ProgressListener progressListener) {
log.trace("AsperaTransferManager.uploadDirectory >> Starting Upload " + System.nanoTime());
checkAscpThreshold();
// Destination bucket and source path must be specified
if (bucketName == null || bucketName.isEmpty())
throw new SdkClientException("Bucket name has not been specified for upload");
if (directory == null || !directory.exists())
throw new SdkClientException("localFileName has not been specified for upload");
if (virtualDirectoryKeyPrefix == null || virtualDirectoryKeyPrefix.isEmpty())
throw new SdkClientException("remoteFileName has not been specified for upload");
// Submit upload to thread pool
AsperaUploadDirectoryCallable uploadDirectoryCallable = new AsperaUploadDirectoryCallable(this, bucketName, directory, virtualDirectoryKeyPrefix, sessionDetails, includeSubdirectories, progressListener);
Future<AsperaTransaction> asperaTransaction = executorService.submit(uploadDirectoryCallable);
log.trace("AsperaTransferManager.uploadDirectory << Ending Upload " + System.nanoTime());
// Return AsperaTransaction
return asperaTransaction;
} | java | public Future<AsperaTransaction> uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory,
boolean includeSubdirectories, AsperaConfig sessionDetails, ProgressListener progressListener) {
log.trace("AsperaTransferManager.uploadDirectory >> Starting Upload " + System.nanoTime());
checkAscpThreshold();
// Destination bucket and source path must be specified
if (bucketName == null || bucketName.isEmpty())
throw new SdkClientException("Bucket name has not been specified for upload");
if (directory == null || !directory.exists())
throw new SdkClientException("localFileName has not been specified for upload");
if (virtualDirectoryKeyPrefix == null || virtualDirectoryKeyPrefix.isEmpty())
throw new SdkClientException("remoteFileName has not been specified for upload");
// Submit upload to thread pool
AsperaUploadDirectoryCallable uploadDirectoryCallable = new AsperaUploadDirectoryCallable(this, bucketName, directory, virtualDirectoryKeyPrefix, sessionDetails, includeSubdirectories, progressListener);
Future<AsperaTransaction> asperaTransaction = executorService.submit(uploadDirectoryCallable);
log.trace("AsperaTransferManager.uploadDirectory << Ending Upload " + System.nanoTime());
// Return AsperaTransaction
return asperaTransaction;
} | [
"public",
"Future",
"<",
"AsperaTransaction",
">",
"uploadDirectory",
"(",
"String",
"bucketName",
",",
"String",
"virtualDirectoryKeyPrefix",
",",
"File",
"directory",
",",
"boolean",
"includeSubdirectories",
",",
"AsperaConfig",
"sessionDetails",
",",
"ProgressListener"... | Subdirectories are included in the upload by default, to exclude ensure you pass through 'false' for
includeSubdirectories param
@param bucketName
@param virtualDirectoryKeyPrefix
@param directory
@param includeSubdirectories
@param sessionDetails
@return | [
"Subdirectories",
"are",
"included",
"in",
"the",
"upload",
"by",
"default",
"to",
"exclude",
"ensure",
"you",
"pass",
"through",
"false",
"for",
"includeSubdirectories",
"param"
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaTransferManager.java#L253-L275 |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-bnd/src/main/java/org/ops4j/pax/exam/bnd/BndtoolsOption.java | BndtoolsOption.fromBndrun | public Option fromBndrun(String runFileSpec) {
try {
File runFile = workspace.getFile(runFileSpec);
Run bndRunInstruction = new Run(workspace, runFile.getParentFile(), runFile);
return bndToExam(bndRunInstruction);
} catch (Exception e) {
throw new RuntimeException("Underlying Bnd Exception: ",e);
}
} | java | public Option fromBndrun(String runFileSpec) {
try {
File runFile = workspace.getFile(runFileSpec);
Run bndRunInstruction = new Run(workspace, runFile.getParentFile(), runFile);
return bndToExam(bndRunInstruction);
} catch (Exception e) {
throw new RuntimeException("Underlying Bnd Exception: ",e);
}
} | [
"public",
"Option",
"fromBndrun",
"(",
"String",
"runFileSpec",
")",
"{",
"try",
"{",
"File",
"runFile",
"=",
"workspace",
".",
"getFile",
"(",
"runFileSpec",
")",
";",
"Run",
"bndRunInstruction",
"=",
"new",
"Run",
"(",
"workspace",
",",
"runFile",
".",
"... | Add all bundles resolved by bndrun file to system-under-test.
@param runFileSpec bndrun file to be used.
@return this. | [
"Add",
"all",
"bundles",
"resolved",
"by",
"bndrun",
"file",
"to",
"system",
"-",
"under",
"-",
"test",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-bnd/src/main/java/org/ops4j/pax/exam/bnd/BndtoolsOption.java#L53-L61 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/filter/Filter.java | Filter.disjunctiveNormalFormSplit | public List<Filter<S>> disjunctiveNormalFormSplit() {
final List<Filter<S>> list = new ArrayList<Filter<S>>();
disjunctiveNormalForm().accept(new Visitor<S, Object, Object>() {
@Override
public Object visit(AndFilter<S> filter, Object param) {
list.add(filter);
return null;
}
@Override
public Object visit(PropertyFilter<S> filter, Object param) {
list.add(filter);
return null;
}
@Override
public Object visit(ExistsFilter<S> filter, Object param) {
list.add(filter);
return null;
}
}, null);
return Collections.unmodifiableList(list);
} | java | public List<Filter<S>> disjunctiveNormalFormSplit() {
final List<Filter<S>> list = new ArrayList<Filter<S>>();
disjunctiveNormalForm().accept(new Visitor<S, Object, Object>() {
@Override
public Object visit(AndFilter<S> filter, Object param) {
list.add(filter);
return null;
}
@Override
public Object visit(PropertyFilter<S> filter, Object param) {
list.add(filter);
return null;
}
@Override
public Object visit(ExistsFilter<S> filter, Object param) {
list.add(filter);
return null;
}
}, null);
return Collections.unmodifiableList(list);
} | [
"public",
"List",
"<",
"Filter",
"<",
"S",
">",
">",
"disjunctiveNormalFormSplit",
"(",
")",
"{",
"final",
"List",
"<",
"Filter",
"<",
"S",
">",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"Filter",
"<",
"S",
">",
">",
"(",
")",
";",
"disjunctiveNorma... | Splits the filter from its disjunctive normal form. Or'ng the filters
together produces the full disjunctive normal form.
@return unmodifiable list of sub filters which don't perform any 'or'
operations
@since 1.1.1 | [
"Splits",
"the",
"filter",
"from",
"its",
"disjunctive",
"normal",
"form",
".",
"Or",
"ng",
"the",
"filters",
"together",
"produces",
"the",
"full",
"disjunctive",
"normal",
"form",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L453-L477 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java | ServiceEndpointPolicyDefinitionsInner.listByResourceGroupAsync | public Observable<Page<ServiceEndpointPolicyDefinitionInner>> listByResourceGroupAsync(final String resourceGroupName, final String serviceEndpointPolicyName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName)
.map(new Func1<ServiceResponse<Page<ServiceEndpointPolicyDefinitionInner>>, Page<ServiceEndpointPolicyDefinitionInner>>() {
@Override
public Page<ServiceEndpointPolicyDefinitionInner> call(ServiceResponse<Page<ServiceEndpointPolicyDefinitionInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ServiceEndpointPolicyDefinitionInner>> listByResourceGroupAsync(final String resourceGroupName, final String serviceEndpointPolicyName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName)
.map(new Func1<ServiceResponse<Page<ServiceEndpointPolicyDefinitionInner>>, Page<ServiceEndpointPolicyDefinitionInner>>() {
@Override
public Page<ServiceEndpointPolicyDefinitionInner> call(ServiceResponse<Page<ServiceEndpointPolicyDefinitionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ServiceEndpointPolicyDefinitionInner",
">",
">",
"listByResourceGroupAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serviceEndpointPolicyName",
")",
"{",
"return",
"listByResourceGroupWithServiceRespons... | Gets all service endpoint policy definitions in a service end point policy.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ServiceEndpointPolicyDefinitionInner> object | [
"Gets",
"all",
"service",
"endpoint",
"policy",
"definitions",
"in",
"a",
"service",
"end",
"point",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java#L581-L589 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/FileListener.java | FileListener.readField | public BaseField readField(ObjectInputStream daIn, BaseField fldCurrent) throws IOException, ClassNotFoundException
{
String strFieldName = daIn.readUTF();
Object objData = daIn.readObject();
if (fldCurrent == null) if (strFieldName.length() > 0)
{
fldCurrent = (BaseField)ClassServiceUtility.getClassService().makeObjectFromClassName(strFieldName);
if (fldCurrent != null)
{
fldCurrent.init(null, null, DBConstants.DEFAULT_FIELD_LENGTH, null, null);
if (this.getOwner() != null) // Make sure it is cleaned up
this.getOwner().addListener(new RemoveConverterOnCloseHandler(fldCurrent));
}
}
if (fldCurrent != null)
fldCurrent.setData(objData);
return fldCurrent;
} | java | public BaseField readField(ObjectInputStream daIn, BaseField fldCurrent) throws IOException, ClassNotFoundException
{
String strFieldName = daIn.readUTF();
Object objData = daIn.readObject();
if (fldCurrent == null) if (strFieldName.length() > 0)
{
fldCurrent = (BaseField)ClassServiceUtility.getClassService().makeObjectFromClassName(strFieldName);
if (fldCurrent != null)
{
fldCurrent.init(null, null, DBConstants.DEFAULT_FIELD_LENGTH, null, null);
if (this.getOwner() != null) // Make sure it is cleaned up
this.getOwner().addListener(new RemoveConverterOnCloseHandler(fldCurrent));
}
}
if (fldCurrent != null)
fldCurrent.setData(objData);
return fldCurrent;
} | [
"public",
"BaseField",
"readField",
"(",
"ObjectInputStream",
"daIn",
",",
"BaseField",
"fldCurrent",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"String",
"strFieldName",
"=",
"daIn",
".",
"readUTF",
"(",
")",
";",
"Object",
"objData",
"=",
... | Decode and read this field from the stream.
Will create a new field, init it and set the data if the field is not passed in.
@param daIn The input stream to unmarshal the data from.
@param fldCurrent The field to unmarshall the data into (optional). | [
"Decode",
"and",
"read",
"this",
"field",
"from",
"the",
"stream",
".",
"Will",
"create",
"a",
"new",
"field",
"init",
"it",
"and",
"set",
"the",
"data",
"if",
"the",
"field",
"is",
"not",
"passed",
"in",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/FileListener.java#L422-L439 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java | ServerTableAuditingPoliciesInner.createOrUpdateAsync | public Observable<ServerTableAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, ServerTableAuditingPolicyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerTableAuditingPolicyInner>, ServerTableAuditingPolicyInner>() {
@Override
public ServerTableAuditingPolicyInner call(ServiceResponse<ServerTableAuditingPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<ServerTableAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, ServerTableAuditingPolicyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerTableAuditingPolicyInner>, ServerTableAuditingPolicyInner>() {
@Override
public ServerTableAuditingPolicyInner call(ServiceResponse<ServerTableAuditingPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerTableAuditingPolicyInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerTableAuditingPolicyInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
... | Creates or updates a servers's table auditing policy. Table auditing is deprecated, use blob auditing instead.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param parameters The server table auditing policy.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerTableAuditingPolicyInner object | [
"Creates",
"or",
"updates",
"a",
"servers",
"s",
"table",
"auditing",
"policy",
".",
"Table",
"auditing",
"is",
"deprecated",
"use",
"blob",
"auditing",
"instead",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java#L196-L203 |
apache/groovy | subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/BindPath.java | BindPath.addAllListeners | public void addAllListeners(PropertyChangeListener listener, Object newObject, Set updateSet) {
addListeners(listener, newObject, updateSet);
if ((children != null) && (children.length > 0)) {
try {
Object newValue = null;
if (newObject != null) {
updateSet.add(newObject);
newValue = extractNewValue(newObject);
}
for (BindPath child : children) {
child.addAllListeners(listener, newValue, updateSet);
}
} catch (Exception e) {
e.printStackTrace(System.out);
//LOGME
// do we ignore it, or fail?
}
}
} | java | public void addAllListeners(PropertyChangeListener listener, Object newObject, Set updateSet) {
addListeners(listener, newObject, updateSet);
if ((children != null) && (children.length > 0)) {
try {
Object newValue = null;
if (newObject != null) {
updateSet.add(newObject);
newValue = extractNewValue(newObject);
}
for (BindPath child : children) {
child.addAllListeners(listener, newValue, updateSet);
}
} catch (Exception e) {
e.printStackTrace(System.out);
//LOGME
// do we ignore it, or fail?
}
}
} | [
"public",
"void",
"addAllListeners",
"(",
"PropertyChangeListener",
"listener",
",",
"Object",
"newObject",
",",
"Set",
"updateSet",
")",
"{",
"addListeners",
"(",
"listener",
",",
"newObject",
",",
"updateSet",
")",
";",
"if",
"(",
"(",
"children",
"!=",
"nul... | Adds all the listeners to the objects in the bind path.
This assumes that we are not added as listeners to any of them, hence
it is not idempotent.
@param listener This listener to attach.
@param newObject The object we should read our property off of.
@param updateSet The list of objects we have added listeners to | [
"Adds",
"all",
"the",
"listeners",
"to",
"the",
"objects",
"in",
"the",
"bind",
"path",
".",
"This",
"assumes",
"that",
"we",
"are",
"not",
"added",
"as",
"listeners",
"to",
"any",
"of",
"them",
"hence",
"it",
"is",
"not",
"idempotent",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/binding/BindPath.java#L104-L122 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ContentHandler.java | ContentHandler.getContent | @SuppressWarnings("rawtypes")
public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
Object obj = getContent(urlc);
for (int i = 0; i < classes.length; i++) {
if (classes[i].isInstance(obj)) {
return obj;
}
}
return null;
} | java | @SuppressWarnings("rawtypes")
public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
Object obj = getContent(urlc);
for (int i = 0; i < classes.length; i++) {
if (classes[i].isInstance(obj)) {
return obj;
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"Object",
"getContent",
"(",
"URLConnection",
"urlc",
",",
"Class",
"[",
"]",
"classes",
")",
"throws",
"IOException",
"{",
"Object",
"obj",
"=",
"getContent",
"(",
"urlc",
")",
";",
"for",
"(",
... | Given a URL connect stream positioned at the beginning of the
representation of an object, this method reads that stream and
creates an object that matches one of the types specified.
The default implementation of this method should call getContent()
and screen the return type for a match of the suggested types.
@param urlc a URL connection.
@param classes an array of types requested
@return the object read by the {@code ContentHandler} that is
the first match of the suggested types.
null if none of the requested are supported.
@exception IOException if an I/O error occurs while reading the object.
@since 1.3 | [
"Given",
"a",
"URL",
"connect",
"stream",
"positioned",
"at",
"the",
"beginning",
"of",
"the",
"representation",
"of",
"an",
"object",
"this",
"method",
"reads",
"that",
"stream",
"and",
"creates",
"an",
"object",
"that",
"matches",
"one",
"of",
"the",
"type... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ContentHandler.java#L99-L109 |
joniles/mpxj | src/main/java/net/sf/mpxj/json/JsonStreamWriter.java | JsonStreamWriter.writeNameValuePair | public void writeNameValuePair(String name, int value) throws IOException
{
internalWriteNameValuePair(name, Integer.toString(value));
} | java | public void writeNameValuePair(String name, int value) throws IOException
{
internalWriteNameValuePair(name, Integer.toString(value));
} | [
"public",
"void",
"writeNameValuePair",
"(",
"String",
"name",
",",
"int",
"value",
")",
"throws",
"IOException",
"{",
"internalWriteNameValuePair",
"(",
"name",
",",
"Integer",
".",
"toString",
"(",
"value",
")",
")",
";",
"}"
] | Write an int attribute.
@param name attribute name
@param value attribute value | [
"Write",
"an",
"int",
"attribute",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L151-L154 |
alipay/sofa-rpc | extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java | SofaRegistry.doUnRegister | protected void doUnRegister(String appName, String serviceName, String group) {
SofaRegistryClient.getRegistryClient(appName, registryConfig).unregister(serviceName, group,
RegistryType.PUBLISHER);
} | java | protected void doUnRegister(String appName, String serviceName, String group) {
SofaRegistryClient.getRegistryClient(appName, registryConfig).unregister(serviceName, group,
RegistryType.PUBLISHER);
} | [
"protected",
"void",
"doUnRegister",
"(",
"String",
"appName",
",",
"String",
"serviceName",
",",
"String",
"group",
")",
"{",
"SofaRegistryClient",
".",
"getRegistryClient",
"(",
"appName",
",",
"registryConfig",
")",
".",
"unregister",
"(",
"serviceName",
",",
... | 反注册服务信息
@param appName 应用
@param serviceName 服务关键字
@param group 服务分组 | [
"反注册服务信息"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java#L184-L188 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getIntHeader | @Deprecated
public static int getIntHeader(HttpMessage message, String name, int defaultValue) {
return message.headers().getInt(name, defaultValue);
} | java | @Deprecated
public static int getIntHeader(HttpMessage message, String name, int defaultValue) {
return message.headers().getInt(name, defaultValue);
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"getIntHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"int",
"defaultValue",
")",
"{",
"return",
"message",
".",
"headers",
"(",
")",
".",
"getInt",
"(",
"name",
",",
"defaultValue",
")",
"... | @deprecated Use {@link #getInt(CharSequence, int)} instead.
@see #getIntHeader(HttpMessage, CharSequence, int) | [
"@deprecated",
"Use",
"{",
"@link",
"#getInt",
"(",
"CharSequence",
"int",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L739-L742 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/Step.java | Step.expectText | protected void expectText(PageElement pageElement, String textOrKey) throws FailureException, TechnicalException {
WebElement element = null;
String value = getTextOrKey(textOrKey);
try {
element = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(pageElement)));
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, pageElement.getPage().getCallBack());
}
try {
Context.waitUntil(ExpectSteps.textToBeEqualsToExpectedValue(Utilities.getLocator(pageElement), value));
} catch (final Exception e) {
logger.error("error in expectText. element is [{}]", element == null ? null : element.getText());
new Result.Failure<>(element == null ? null : element.getText(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_WRONG_EXPECTED_VALUE), pageElement,
textOrKey.startsWith(cryptoService.getPrefix()) ? SECURE_MASK : value, pageElement.getPage().getApplication()), true, pageElement.getPage().getCallBack());
}
} | java | protected void expectText(PageElement pageElement, String textOrKey) throws FailureException, TechnicalException {
WebElement element = null;
String value = getTextOrKey(textOrKey);
try {
element = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(pageElement)));
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, pageElement.getPage().getCallBack());
}
try {
Context.waitUntil(ExpectSteps.textToBeEqualsToExpectedValue(Utilities.getLocator(pageElement), value));
} catch (final Exception e) {
logger.error("error in expectText. element is [{}]", element == null ? null : element.getText());
new Result.Failure<>(element == null ? null : element.getText(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_WRONG_EXPECTED_VALUE), pageElement,
textOrKey.startsWith(cryptoService.getPrefix()) ? SECURE_MASK : value, pageElement.getPage().getApplication()), true, pageElement.getPage().getCallBack());
}
} | [
"protected",
"void",
"expectText",
"(",
"PageElement",
"pageElement",
",",
"String",
"textOrKey",
")",
"throws",
"FailureException",
",",
"TechnicalException",
"{",
"WebElement",
"element",
"=",
"null",
";",
"String",
"value",
"=",
"getTextOrKey",
"(",
"textOrKey",
... | Expects that an element contains expected value.
@param pageElement
Is target element
@param textOrKey
Is the expected data (text or text in context (after a save))
@throws FailureException
if the scenario encounters a functional error
@throws TechnicalException | [
"Expects",
"that",
"an",
"element",
"contains",
"expected",
"value",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L310-L326 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java | JPAIssues.sawOpcode | @Override
public void sawOpcode(int seen) {
JPAUserValue userValue = null;
try {
switch (seen) {
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE: {
userValue = processInvoke();
break;
}
case Const.POP: {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
if (itm.getUserValue() == JPAUserValue.MERGE) {
bugReporter.reportBug(new BugInstance(this, BugType.JPAI_IGNORED_MERGE_RESULT.name(), LOW_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this));
}
}
break;
}
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((userValue != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(userValue);
}
}
} | java | @Override
public void sawOpcode(int seen) {
JPAUserValue userValue = null;
try {
switch (seen) {
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE: {
userValue = processInvoke();
break;
}
case Const.POP: {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
if (itm.getUserValue() == JPAUserValue.MERGE) {
bugReporter.reportBug(new BugInstance(this, BugType.JPAI_IGNORED_MERGE_RESULT.name(), LOW_PRIORITY).addClass(this).addMethod(this)
.addSourceLine(this));
}
}
break;
}
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((userValue != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(userValue);
}
}
} | [
"@",
"Override",
"public",
"void",
"sawOpcode",
"(",
"int",
"seen",
")",
"{",
"JPAUserValue",
"userValue",
"=",
"null",
";",
"try",
"{",
"switch",
"(",
"seen",
")",
"{",
"case",
"Const",
".",
"INVOKEVIRTUAL",
":",
"case",
"Const",
".",
"INVOKEINTERFACE",
... | implements the visitor to look for calls to @Transactional methods that do not go through a spring proxy. These methods are easily seen as internal class
calls. There are other cases as well, from external/internal classes but these aren't reported.
@param seen
the currently parsed opcode | [
"implements",
"the",
"visitor",
"to",
"look",
"for",
"calls",
"to",
"@Transactional",
"methods",
"that",
"do",
"not",
"go",
"through",
"a",
"spring",
"proxy",
".",
"These",
"methods",
"are",
"easily",
"seen",
"as",
"internal",
"class",
"calls",
".",
"There",... | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java#L209-L242 |
ggrandes/kvstore | src/main/java/org/javastack/kvstore/structures/hash/FixedIntHashMap.java | FixedIntHashMap.put | public T put(final int key, final T value) {
int index = ((key & 0x7FFFFFFF) % elementKeys.length);
T oldvalue = null;
long entry = elementKeys[index];
if (entry == Integer.MIN_VALUE) {
++elementCount;
} else {
oldvalue = elementValues[index];
collisions++;
}
elementKeys[index] = key;
elementValues[index] = value;
return oldvalue;
} | java | public T put(final int key, final T value) {
int index = ((key & 0x7FFFFFFF) % elementKeys.length);
T oldvalue = null;
long entry = elementKeys[index];
if (entry == Integer.MIN_VALUE) {
++elementCount;
} else {
oldvalue = elementValues[index];
collisions++;
}
elementKeys[index] = key;
elementValues[index] = value;
return oldvalue;
} | [
"public",
"T",
"put",
"(",
"final",
"int",
"key",
",",
"final",
"T",
"value",
")",
"{",
"int",
"index",
"=",
"(",
"(",
"key",
"&",
"0x7FFFFFFF",
")",
"%",
"elementKeys",
".",
"length",
")",
";",
"T",
"oldvalue",
"=",
"null",
";",
"long",
"entry",
... | Maps the specified key to the specified value.
@param key the key.
@param value the value.
@return the value of any previous mapping with the specified key or {@code -1} if there was no such
mapping. | [
"Maps",
"the",
"specified",
"key",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/structures/hash/FixedIntHashMap.java#L169-L183 |
banq/jdonframework | JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/handler/HandlerMethodMetaArgsFactory.java | HandlerMethodMetaArgsFactory.createDeleteMethod | public MethodMetaArgs createDeleteMethod(HandlerMetaDef handlerMetaDef, EventModel em) {
String p_methodName = handlerMetaDef.getDeleteMethod();
if (p_methodName == null) {
Debug.logError("[JdonFramework] not configure the deleteMethod parameter: <deleteMethod name=XXXXX /> ", module);
}
return createCRUDMethodMetaArgs(p_methodName, em);
} | java | public MethodMetaArgs createDeleteMethod(HandlerMetaDef handlerMetaDef, EventModel em) {
String p_methodName = handlerMetaDef.getDeleteMethod();
if (p_methodName == null) {
Debug.logError("[JdonFramework] not configure the deleteMethod parameter: <deleteMethod name=XXXXX /> ", module);
}
return createCRUDMethodMetaArgs(p_methodName, em);
} | [
"public",
"MethodMetaArgs",
"createDeleteMethod",
"(",
"HandlerMetaDef",
"handlerMetaDef",
",",
"EventModel",
"em",
")",
"{",
"String",
"p_methodName",
"=",
"handlerMetaDef",
".",
"getDeleteMethod",
"(",
")",
";",
"if",
"(",
"p_methodName",
"==",
"null",
")",
"{",... | create update method the service/s method parameter type must be
EventModel type;
@param handlerMetaDef
@param em
EventModel
@return MethodMetaArgs instance | [
"create",
"update",
"method",
"the",
"service",
"/",
"s",
"method",
"parameter",
"type",
"must",
"be",
"EventModel",
"type",
";"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/handler/HandlerMethodMetaArgsFactory.java#L118-L126 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.findIdent | Symbol findIdent(Env<AttrContext> env, Name name, KindSelector kind) {
Symbol bestSoFar = typeNotFound;
Symbol sym;
if (kind.contains(KindSelector.VAL)) {
sym = findVar(env, name);
if (sym.exists()) return sym;
else bestSoFar = bestOf(bestSoFar, sym);
}
if (kind.contains(KindSelector.TYP)) {
sym = findType(env, name);
if (sym.exists()) return sym;
else bestSoFar = bestOf(bestSoFar, sym);
}
if (kind.contains(KindSelector.PCK))
return lookupPackage(env, name);
else return bestSoFar;
} | java | Symbol findIdent(Env<AttrContext> env, Name name, KindSelector kind) {
Symbol bestSoFar = typeNotFound;
Symbol sym;
if (kind.contains(KindSelector.VAL)) {
sym = findVar(env, name);
if (sym.exists()) return sym;
else bestSoFar = bestOf(bestSoFar, sym);
}
if (kind.contains(KindSelector.TYP)) {
sym = findType(env, name);
if (sym.exists()) return sym;
else bestSoFar = bestOf(bestSoFar, sym);
}
if (kind.contains(KindSelector.PCK))
return lookupPackage(env, name);
else return bestSoFar;
} | [
"Symbol",
"findIdent",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Name",
"name",
",",
"KindSelector",
"kind",
")",
"{",
"Symbol",
"bestSoFar",
"=",
"typeNotFound",
";",
"Symbol",
"sym",
";",
"if",
"(",
"kind",
".",
"contains",
"(",
"KindSelector",
... | Find an unqualified identifier which matches a specified kind set.
@param env The current environment.
@param name The identifier's name.
@param kind Indicates the possible symbol kinds
(a subset of VAL, TYP, PCK). | [
"Find",
"an",
"unqualified",
"identifier",
"which",
"matches",
"a",
"specified",
"kind",
"set",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2335-L2355 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.