id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
101,400 | CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/LicenseResolver.java | LicenseResolver.resolveSpdxLicenseId | public static LicenseChoice resolveSpdxLicenseId(String licenseId) throws InvalidSPDXAnalysisException {
final SpdxListedLicense spdxLicense = LicenseInfoFactory.getListedLicenseById(licenseId);
final LicenseChoice choice = new LicenseChoice();
choice.addLicense(createLicenseObject(spdxLicense))... | java | public static LicenseChoice resolveSpdxLicenseId(String licenseId) throws InvalidSPDXAnalysisException {
final SpdxListedLicense spdxLicense = LicenseInfoFactory.getListedLicenseById(licenseId);
final LicenseChoice choice = new LicenseChoice();
choice.addLicense(createLicenseObject(spdxLicense))... | [
"public",
"static",
"LicenseChoice",
"resolveSpdxLicenseId",
"(",
"String",
"licenseId",
")",
"throws",
"InvalidSPDXAnalysisException",
"{",
"final",
"SpdxListedLicense",
"spdxLicense",
"=",
"LicenseInfoFactory",
".",
"getListedLicenseById",
"(",
"licenseId",
")",
";",
"f... | Given a valid SPDX license ID, this method will return a LicenseChoice object.
@param licenseId a valid SPDX license ID
@return a LicenseChoice object
@throws InvalidSPDXAnalysisException an exception while parsing the license ID | [
"Given",
"a",
"valid",
"SPDX",
"license",
"ID",
"this",
"method",
"will",
"return",
"a",
"LicenseChoice",
"object",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/LicenseResolver.java#L139-L144 |
101,401 | CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/LicenseResolver.java | LicenseResolver.parseLicenseByUrl | public static License parseLicenseByUrl(String licenseUrl) throws InvalidLicenseStringException {
final String protocolExcludedUrl = licenseUrl.replace("http://", "").replace("https://", "");
final ListedLicenses ll = ListedLicenses.getListedLicenses();
// Check cache. If hit, return, otherwise ... | java | public static License parseLicenseByUrl(String licenseUrl) throws InvalidLicenseStringException {
final String protocolExcludedUrl = licenseUrl.replace("http://", "").replace("https://", "");
final ListedLicenses ll = ListedLicenses.getListedLicenses();
// Check cache. If hit, return, otherwise ... | [
"public",
"static",
"License",
"parseLicenseByUrl",
"(",
"String",
"licenseUrl",
")",
"throws",
"InvalidLicenseStringException",
"{",
"final",
"String",
"protocolExcludedUrl",
"=",
"licenseUrl",
".",
"replace",
"(",
"\"http://\"",
",",
"\"\"",
")",
".",
"replace",
"... | Given a URL, this method will attempt to resolve the SPDX license. This method will
not retrieve the URL, rather, it will interrogate it's internal list of SPDX licenses
and the URLs defined for each. This method may impact performance for URLs that are
not associated with an SPDX license or otherwise have not been que... | [
"Given",
"a",
"URL",
"this",
"method",
"will",
"attempt",
"to",
"resolve",
"the",
"SPDX",
"license",
".",
"This",
"method",
"will",
"not",
"retrieve",
"the",
"URL",
"rather",
"it",
"will",
"interrogate",
"it",
"s",
"internal",
"list",
"of",
"SPDX",
"licens... | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/LicenseResolver.java#L157-L183 |
101,402 | CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/LicenseResolver.java | LicenseResolver.createLicenseObject | private static License createLicenseObject(SpdxListedLicense spdxListedLicense) {
final License license = new License();
license.setId(spdxListedLicense.getLicenseId());
license.setName(spdxListedLicense.getName());
if (spdxListedLicense.getSeeAlso() != null && spdxListedLicense.getSeeAl... | java | private static License createLicenseObject(SpdxListedLicense spdxListedLicense) {
final License license = new License();
license.setId(spdxListedLicense.getLicenseId());
license.setName(spdxListedLicense.getName());
if (spdxListedLicense.getSeeAlso() != null && spdxListedLicense.getSeeAl... | [
"private",
"static",
"License",
"createLicenseObject",
"(",
"SpdxListedLicense",
"spdxListedLicense",
")",
"{",
"final",
"License",
"license",
"=",
"new",
"License",
"(",
")",
";",
"license",
".",
"setId",
"(",
"spdxListedLicense",
".",
"getLicenseId",
"(",
")",
... | Creates a License object from the specified SpdxListedLicense object.
@param spdxListedLicense the object to convert
@return a CycloneDX License object | [
"Creates",
"a",
"License",
"object",
"from",
"the",
"specified",
"SpdxListedLicense",
"object",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/LicenseResolver.java#L190-L205 |
101,403 | CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/LicenseResolver.java | LicenseResolver.resolveViaAlternativeMapping | private static LicenseChoice resolveViaAlternativeMapping(String licenseString) {
if (licenseString == null) {
return null;
}
try {
for (final Map.Entry<String, List<String>> mapping : mappings.entrySet()) {
final List<String> names = mapping.getValue();
... | java | private static LicenseChoice resolveViaAlternativeMapping(String licenseString) {
if (licenseString == null) {
return null;
}
try {
for (final Map.Entry<String, List<String>> mapping : mappings.entrySet()) {
final List<String> names = mapping.getValue();
... | [
"private",
"static",
"LicenseChoice",
"resolveViaAlternativeMapping",
"(",
"String",
"licenseString",
")",
"{",
"if",
"(",
"licenseString",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String... | Attempts to perform high-confidence license resolution with unstructured text as input.
@param licenseString the license string (not the actual license text)
@return a LicenseChoice object if resolved, otherwise null | [
"Attempts",
"to",
"perform",
"high",
"-",
"confidence",
"license",
"resolution",
"with",
"unstructured",
"text",
"as",
"input",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/LicenseResolver.java#L212-L231 |
101,404 | CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/AbstractBomGenerator.java | AbstractBomGenerator.toXmlString | public String toXmlString() throws TransformerException {
if (doc == null) {
return null;
}
final DOMSource domSource = new DOMSource(doc);
final StringWriter writer = new StringWriter();
final StreamResult result = new StreamResult(writer);
final TransformerF... | java | public String toXmlString() throws TransformerException {
if (doc == null) {
return null;
}
final DOMSource domSource = new DOMSource(doc);
final StringWriter writer = new StringWriter();
final StreamResult result = new StreamResult(writer);
final TransformerF... | [
"public",
"String",
"toXmlString",
"(",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"doc",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"DOMSource",
"domSource",
"=",
"new",
"DOMSource",
"(",
"doc",
")",
";",
"final",
"StringWrit... | Creates a text representation of a CycloneDX BoM Document.
@return a String of the BoM
@throws TransformerException an TransformerException
@since 1.1.0 | [
"Creates",
"a",
"text",
"representation",
"of",
"a",
"CycloneDX",
"BoM",
"Document",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/AbstractBomGenerator.java#L128-L145 |
101,405 | CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/BomParser.java | BomParser.parse | private Bom parse(StreamSource streamSource) throws ParseException {
try {
final Schema schema = getXmlSchema(CycloneDxSchema.Version.VERSION_11);
final XmlMapper mapper = new XmlMapper();
// Prevent XML External Entity Injection
final XMLInputFactory xif = XMLIn... | java | private Bom parse(StreamSource streamSource) throws ParseException {
try {
final Schema schema = getXmlSchema(CycloneDxSchema.Version.VERSION_11);
final XmlMapper mapper = new XmlMapper();
// Prevent XML External Entity Injection
final XMLInputFactory xif = XMLIn... | [
"private",
"Bom",
"parse",
"(",
"StreamSource",
"streamSource",
")",
"throws",
"ParseException",
"{",
"try",
"{",
"final",
"Schema",
"schema",
"=",
"getXmlSchema",
"(",
"CycloneDxSchema",
".",
"Version",
".",
"VERSION_11",
")",
";",
"final",
"XmlMapper",
"mapper... | Parses a CycloneDX BOM.
@param streamSource the BOM
@return an Bom object
@throws ParseException when errors are encountered
@since 1.1.0 | [
"Parses",
"a",
"CycloneDX",
"BOM",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/BomParser.java#L77-L94 |
101,406 | CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/BomParser.java | BomParser.validate | public List<SAXParseException> validate(File file) {
return validate(file, CycloneDxSchema.Version.VERSION_11);
} | java | public List<SAXParseException> validate(File file) {
return validate(file, CycloneDxSchema.Version.VERSION_11);
} | [
"public",
"List",
"<",
"SAXParseException",
">",
"validate",
"(",
"File",
"file",
")",
"{",
"return",
"validate",
"(",
"file",
",",
"CycloneDxSchema",
".",
"Version",
".",
"VERSION_11",
")",
";",
"}"
] | Verifies a CycloneDX BoM conforms to the latest version of the specification
through XML validation.
@param file the CycloneDX BoM file to validate
@return a List of SAXParseExceptions. If the size of the list is 0, validation was successful
@since 1.1.0 | [
"Verifies",
"a",
"CycloneDX",
"BoM",
"conforms",
"to",
"the",
"latest",
"version",
"of",
"the",
"specification",
"through",
"XML",
"validation",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/BomParser.java#L103-L105 |
101,407 | CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/BomUtils.java | BomUtils.calculateHashes | public static List<Hash> calculateHashes(File file) throws IOException {
if (file == null || !file.exists() || !file.canRead()) {
return null;
}
final List<Hash> hashes = new ArrayList<>();
try (InputStream fis = Files.newInputStream(file.toPath())) {
hashes.add(n... | java | public static List<Hash> calculateHashes(File file) throws IOException {
if (file == null || !file.exists() || !file.canRead()) {
return null;
}
final List<Hash> hashes = new ArrayList<>();
try (InputStream fis = Files.newInputStream(file.toPath())) {
hashes.add(n... | [
"public",
"static",
"List",
"<",
"Hash",
">",
"calculateHashes",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
"==",
"null",
"||",
"!",
"file",
".",
"exists",
"(",
")",
"||",
"!",
"file",
".",
"canRead",
"(",
")",
")",
... | Calculates the hashes of the specified file.
@param file the File to calculate hashes on
@return a List of Hash objets
@throws IOException an IOException
@since 1.0.0 | [
"Calculates",
"the",
"hashes",
"of",
"the",
"specified",
"file",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/BomUtils.java#L41-L62 |
101,408 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteSimpleContentProvider.java | OrmLiteSimpleContentProvider.getSortOrderStringForQuery | protected String getSortOrderStringForQuery(MatcherPattern target, QueryParameters parameter) {
String result = "";
if (parameter.getSortOrder() != null && parameter.getSortOrder().length() >= 1) {
result = parameter.getSortOrder();
} else {
result = target.getTableInfo()... | java | protected String getSortOrderStringForQuery(MatcherPattern target, QueryParameters parameter) {
String result = "";
if (parameter.getSortOrder() != null && parameter.getSortOrder().length() >= 1) {
result = parameter.getSortOrder();
} else {
result = target.getTableInfo()... | [
"protected",
"String",
"getSortOrderStringForQuery",
"(",
"MatcherPattern",
"target",
",",
"QueryParameters",
"parameter",
")",
"{",
"String",
"result",
"=",
"\"\"",
";",
"if",
"(",
"parameter",
".",
"getSortOrder",
"(",
")",
"!=",
"null",
"&&",
"parameter",
"."... | This method gets the appropriate sort order.
@param target
Arguments passed to the onQuery() method.
@param parameter
Arguments passed to the onQuery() method.
@return return an sort order string.
@since 1.0.4 | [
"This",
"method",
"gets",
"the",
"appropriate",
"sort",
"order",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteSimpleContentProvider.java#L180-L188 |
101,409 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.add | public MatcherController add(Class<?> tableClassType, SubType subType, String pattern, int patternCode) {
this.addTableClass(tableClassType);
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | java | public MatcherController add(Class<?> tableClassType, SubType subType, String pattern, int patternCode) {
this.addTableClass(tableClassType);
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | [
"public",
"MatcherController",
"add",
"(",
"Class",
"<",
"?",
">",
"tableClassType",
",",
"SubType",
"subType",
",",
"String",
"pattern",
",",
"int",
"patternCode",
")",
"{",
"this",
".",
"addTableClass",
"(",
"tableClassType",
")",
";",
"this",
".",
"addMat... | Register a class for table. And registers a pattern for UriMatcher.
@param tableClassType
Register a class for table.
@param subType
Contents to be registered in the pattern, specify single or multiple. This is used
in the MIME types. * ITEM : If the URI pattern is for a single row :
vnd.android.cursor.item/ * DIRECTOR... | [
"Register",
"a",
"class",
"for",
"table",
".",
"And",
"registers",
"a",
"pattern",
"for",
"UriMatcher",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L86-L90 |
101,410 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.add | public MatcherController add(SubType subType, String pattern, int patternCode) {
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | java | public MatcherController add(SubType subType, String pattern, int patternCode) {
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | [
"public",
"MatcherController",
"add",
"(",
"SubType",
"subType",
",",
"String",
"pattern",
",",
"int",
"patternCode",
")",
"{",
"this",
".",
"addMatcherPattern",
"(",
"subType",
",",
"pattern",
",",
"patternCode",
")",
";",
"return",
"this",
";",
"}"
] | Registers a pattern for UriMatcher. It refer to the class that was last registered from add
method.
@param subType
Contents to be registered in the pattern, specify single or multiple. This is used
in the MIME types. * ITEM : If the URI pattern is for a single row :
vnd.android.cursor.item/ * DIRECTORY : If the URI pat... | [
"Registers",
"a",
"pattern",
"for",
"UriMatcher",
".",
"It",
"refer",
"to",
"the",
"class",
"that",
"was",
"last",
"registered",
"from",
"add",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L109-L112 |
101,411 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.add | public MatcherController add(MatcherPattern matcherPattern) {
int patternCode = matcherPattern.getPatternCode();
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
if (findMatcherPattern(patternCode... | java | public MatcherController add(MatcherPattern matcherPattern) {
int patternCode = matcherPattern.getPatternCode();
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
if (findMatcherPattern(patternCode... | [
"public",
"MatcherController",
"add",
"(",
"MatcherPattern",
"matcherPattern",
")",
"{",
"int",
"patternCode",
"=",
"matcherPattern",
".",
"getPatternCode",
"(",
")",
";",
"if",
"(",
"this",
".",
"lastAddTableInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"Ill... | Registers a pattern for UriMatcher. To register you have to create an instance of
MatcherPattern.
@param matcherPattern
register MatcherPattern.
@return Instance of the MatcherController class. | [
"Registers",
"a",
"pattern",
"for",
"UriMatcher",
".",
"To",
"register",
"you",
"have",
"to",
"create",
"an",
"instance",
"of",
"MatcherPattern",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L121-L134 |
101,412 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.setDefaultContentUri | public MatcherController setDefaultContentUri(String authority, String path) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentUriInfo(new ContentUriInfo(authority, p... | java | public MatcherController setDefaultContentUri(String authority, String path) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentUriInfo(new ContentUriInfo(authority, p... | [
"public",
"MatcherController",
"setDefaultContentUri",
"(",
"String",
"authority",
",",
"String",
"path",
")",
"{",
"if",
"(",
"this",
".",
"lastAddTableInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There is a problem with the order o... | Set the DefaultContentUri. If you did not use the DefaultContentUri annotation, you must call
this method.
@see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentUri
@param authority
@param path
@return Instance of the MatcherController class. | [
"Set",
"the",
"DefaultContentUri",
".",
"If",
"you",
"did",
"not",
"use",
"the",
"DefaultContentUri",
"annotation",
"you",
"must",
"call",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L144-L150 |
101,413 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.setDefaultContentMimeTypeVnd | public MatcherController setDefaultContentMimeTypeVnd(String name, String type) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentMimeTypeVndInfo(new ContentMimeTypeV... | java | public MatcherController setDefaultContentMimeTypeVnd(String name, String type) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentMimeTypeVndInfo(new ContentMimeTypeV... | [
"public",
"MatcherController",
"setDefaultContentMimeTypeVnd",
"(",
"String",
"name",
",",
"String",
"type",
")",
"{",
"if",
"(",
"this",
".",
"lastAddTableInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There is a problem with the orde... | Set the DefaultContentMimeTypeVnd. If you did not use the DefaultContentMimeTypeVnd
annotation, you must call this method.
@see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentMimeTypeVnd
@param name
@param type
@return Instance of the MatcherController class. | [
"Set",
"the",
"DefaultContentMimeTypeVnd",
".",
"If",
"you",
"did",
"not",
"use",
"the",
"DefaultContentMimeTypeVnd",
"annotation",
"you",
"must",
"call",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L160-L166 |
101,414 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.initialize | public MatcherController initialize() {
this.lastAddTableInfo = null;
for (Map.Entry<Class<?>, TableInfo> entry : this.tables.entrySet()) {
entry.getValue().isValid(true);
}
for (MatcherPattern entry : matcherPatterns) {
entry.isValid(true);
this.mat... | java | public MatcherController initialize() {
this.lastAddTableInfo = null;
for (Map.Entry<Class<?>, TableInfo> entry : this.tables.entrySet()) {
entry.getValue().isValid(true);
}
for (MatcherPattern entry : matcherPatterns) {
entry.isValid(true);
this.mat... | [
"public",
"MatcherController",
"initialize",
"(",
")",
"{",
"this",
".",
"lastAddTableInfo",
"=",
"null",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Class",
"<",
"?",
">",
",",
"TableInfo",
">",
"entry",
":",
"this",
".",
"tables",
".",
"entrySet",
"(... | initialized with the contents that are registered by the add method. This method checks the
registration details.
@return Instance of the MatcherController class. | [
"initialized",
"with",
"the",
"contents",
"that",
"are",
"registered",
"by",
"the",
"add",
"method",
".",
"This",
"method",
"checks",
"the",
"registration",
"details",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L173-L188 |
101,415 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.findMatcherPattern | public MatcherPattern findMatcherPattern(int patternCode) {
MatcherPattern result = null;
for (MatcherPattern entry : this.matcherPatterns) {
if (entry.getPatternCode() == patternCode) {
result = entry;
break;
}
}
return result;
... | java | public MatcherPattern findMatcherPattern(int patternCode) {
MatcherPattern result = null;
for (MatcherPattern entry : this.matcherPatterns) {
if (entry.getPatternCode() == patternCode) {
result = entry;
break;
}
}
return result;
... | [
"public",
"MatcherPattern",
"findMatcherPattern",
"(",
"int",
"patternCode",
")",
"{",
"MatcherPattern",
"result",
"=",
"null",
";",
"for",
"(",
"MatcherPattern",
"entry",
":",
"this",
".",
"matcherPatterns",
")",
"{",
"if",
"(",
"entry",
".",
"getPatternCode",
... | This will search the MatcherPattern that are registered based on the return code UriMatcher.
@param patternCode
UriMatcher code is returned
@return Instance of the MatcherPattern class. if no match is found will return null. | [
"This",
"will",
"search",
"the",
"MatcherPattern",
"that",
"are",
"registered",
"based",
"on",
"the",
"return",
"code",
"UriMatcher",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L196-L205 |
101,416 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java | OrmLiteDefaultContentProvider.onQueryCompleted | protected void onQueryCompleted(Cursor result, Uri uri, MatcherPattern target, QueryParameters parameter) {
result.setNotificationUri(this.getContext().getContentResolver(), uri);
} | java | protected void onQueryCompleted(Cursor result, Uri uri, MatcherPattern target, QueryParameters parameter) {
result.setNotificationUri(this.getContext().getContentResolver(), uri);
} | [
"protected",
"void",
"onQueryCompleted",
"(",
"Cursor",
"result",
",",
"Uri",
"uri",
",",
"MatcherPattern",
"target",
",",
"QueryParameters",
"parameter",
")",
"{",
"result",
".",
"setNotificationUri",
"(",
"this",
".",
"getContext",
"(",
")",
".",
"getContentRe... | This method is called after the onQuery processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onQuery method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onQuery method.
It is MatcherPattern objects that match ... | [
"This",
"method",
"is",
"called",
"after",
"the",
"onQuery",
"processing",
"has",
"been",
"handled",
".",
"If",
"you",
"re",
"a",
"need",
"you",
"can",
"override",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L191-L193 |
101,417 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java | OrmLiteDefaultContentProvider.onInsertCompleted | protected void onInsertCompleted(Uri result, Uri uri, MatcherPattern target, InsertParameters parameter) {
this.getContext().getContentResolver().notifyChange(result, null);
} | java | protected void onInsertCompleted(Uri result, Uri uri, MatcherPattern target, InsertParameters parameter) {
this.getContext().getContentResolver().notifyChange(result, null);
} | [
"protected",
"void",
"onInsertCompleted",
"(",
"Uri",
"result",
",",
"Uri",
"uri",
",",
"MatcherPattern",
"target",
",",
"InsertParameters",
"parameter",
")",
"{",
"this",
".",
"getContext",
"(",
")",
".",
"getContentResolver",
"(",
")",
".",
"notifyChange",
"... | This method is called after the onInsert processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onInsert method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onInsert method.
It is MatcherPattern objects that mat... | [
"This",
"method",
"is",
"called",
"after",
"the",
"onInsert",
"processing",
"has",
"been",
"handled",
".",
"If",
"you",
"re",
"a",
"need",
"you",
"can",
"override",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L238-L240 |
101,418 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java | OrmLiteDefaultContentProvider.onDeleteCompleted | protected void onDeleteCompleted(int result, Uri uri, MatcherPattern target, DeleteParameters parameter) {
this.getContext().getContentResolver().notifyChange(uri, null);
} | java | protected void onDeleteCompleted(int result, Uri uri, MatcherPattern target, DeleteParameters parameter) {
this.getContext().getContentResolver().notifyChange(uri, null);
} | [
"protected",
"void",
"onDeleteCompleted",
"(",
"int",
"result",
",",
"Uri",
"uri",
",",
"MatcherPattern",
"target",
",",
"DeleteParameters",
"parameter",
")",
"{",
"this",
".",
"getContext",
"(",
")",
".",
"getContentResolver",
"(",
")",
".",
"notifyChange",
"... | This method is called after the onDelete processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onDelete method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onDelete method.
It is MatcherPattern objects that mat... | [
"This",
"method",
"is",
"called",
"after",
"the",
"onDelete",
"processing",
"has",
"been",
"handled",
".",
"If",
"you",
"re",
"a",
"need",
"you",
"can",
"override",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L286-L288 |
101,419 | jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java | OrmLiteDefaultContentProvider.onUpdateCompleted | protected void onUpdateCompleted(int result, Uri uri, MatcherPattern target, UpdateParameters parameter) {
this.getContext().getContentResolver().notifyChange(uri, null);
} | java | protected void onUpdateCompleted(int result, Uri uri, MatcherPattern target, UpdateParameters parameter) {
this.getContext().getContentResolver().notifyChange(uri, null);
} | [
"protected",
"void",
"onUpdateCompleted",
"(",
"int",
"result",
",",
"Uri",
"uri",
",",
"MatcherPattern",
"target",
",",
"UpdateParameters",
"parameter",
")",
"{",
"this",
".",
"getContext",
"(",
")",
".",
"getContentResolver",
"(",
")",
".",
"notifyChange",
"... | This method is called after the onUpdate processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onUpdate method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onUpdate method.
It is MatcherPattern objects that mat... | [
"This",
"method",
"is",
"called",
"after",
"the",
"onUpdate",
"processing",
"has",
"been",
"handled",
".",
"If",
"you",
"re",
"a",
"need",
"you",
"can",
"override",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L334-L336 |
101,420 | square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/LibGmp.java | LibGmp.__gmpz_import | public static void __gmpz_import(mpz_t rop, int count, int order, int size, int endian, int nails,
Pointer buffer) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_import(rop, count, order, size, endian, nails, buffer);
} else {
SizeT8.__gmpz_import(rop, count, order, size, endian, nails, b... | java | public static void __gmpz_import(mpz_t rop, int count, int order, int size, int endian, int nails,
Pointer buffer) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_import(rop, count, order, size, endian, nails, buffer);
} else {
SizeT8.__gmpz_import(rop, count, order, size, endian, nails, b... | [
"public",
"static",
"void",
"__gmpz_import",
"(",
"mpz_t",
"rop",
",",
"int",
"count",
",",
"int",
"order",
",",
"int",
"size",
",",
"int",
"endian",
",",
"int",
"nails",
",",
"Pointer",
"buffer",
")",
"{",
"if",
"(",
"SIZE_T_CLASS",
"==",
"SizeT4",
".... | Set rop from an array of word data at op.
The parameters specify the format of the data. count many words are read, each size bytes.
order can be 1 for most significant word first or -1 for least significant first. Within each
word endian can be 1 for most significant byte first, -1 for least significant first, or 0 f... | [
"Set",
"rop",
"from",
"an",
"array",
"of",
"word",
"data",
"at",
"op",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/LibGmp.java#L200-L207 |
101,421 | square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/LibGmp.java | LibGmp.__gmpz_export | public static void __gmpz_export(Pointer rop, Pointer countp, int order, int size, int endian,
int nails, mpz_t op) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_export(rop, countp, order, size, endian, nails, op);
} else {
SizeT8.__gmpz_export(rop, countp, order, size, endian, nails, op... | java | public static void __gmpz_export(Pointer rop, Pointer countp, int order, int size, int endian,
int nails, mpz_t op) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_export(rop, countp, order, size, endian, nails, op);
} else {
SizeT8.__gmpz_export(rop, countp, order, size, endian, nails, op... | [
"public",
"static",
"void",
"__gmpz_export",
"(",
"Pointer",
"rop",
",",
"Pointer",
"countp",
",",
"int",
"order",
",",
"int",
"size",
",",
"int",
"endian",
",",
"int",
"nails",
",",
"mpz_t",
"op",
")",
"{",
"if",
"(",
"SIZE_T_CLASS",
"==",
"SizeT4",
"... | Fill rop with word data from op.
The parameters specify the format of the data produced. Each word will be size bytes and order
can be 1 for most significant word first or -1 for least significant first. Within each word
endian can be 1 for most significant byte first, -1 for least significant first, or 0 for the
nati... | [
"Fill",
"rop",
"with",
"word",
"data",
"from",
"op",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/LibGmp.java#L243-L250 |
101,422 | square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java | Gmp.checkLoaded | public static void checkLoaded() {
if (LOAD_ERROR != null) {
throw LOAD_ERROR;
}
// Make a test call, sometimes the error won't occur until you try the native method.
// 2 ^ 3 = 8, 8 mod 5 = 3
BigInteger two = BigInteger.valueOf(2);
BigInteger three = BigInteger.valueOf(3);
BigInteger ... | java | public static void checkLoaded() {
if (LOAD_ERROR != null) {
throw LOAD_ERROR;
}
// Make a test call, sometimes the error won't occur until you try the native method.
// 2 ^ 3 = 8, 8 mod 5 = 3
BigInteger two = BigInteger.valueOf(2);
BigInteger three = BigInteger.valueOf(3);
BigInteger ... | [
"public",
"static",
"void",
"checkLoaded",
"(",
")",
"{",
"if",
"(",
"LOAD_ERROR",
"!=",
"null",
")",
"{",
"throw",
"LOAD_ERROR",
";",
"}",
"// Make a test call, sometimes the error won't occur until you try the native method.",
"// 2 ^ 3 = 8, 8 mod 5 = 3",
"BigInteger",
"t... | Verifies this library is loaded properly.
@throws UnsatisfiedLinkError if the library failed to load properly. | [
"Verifies",
"this",
"library",
"is",
"loaded",
"properly",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L61-L87 |
101,423 | square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java | Gmp.kronecker | public static int kronecker(BigInteger a, BigInteger p) {
return INSTANCE.get().kroneckerImpl(a, p);
} | java | public static int kronecker(BigInteger a, BigInteger p) {
return INSTANCE.get().kroneckerImpl(a, p);
} | [
"public",
"static",
"int",
"kronecker",
"(",
"BigInteger",
"a",
",",
"BigInteger",
"p",
")",
"{",
"return",
"INSTANCE",
".",
"get",
"(",
")",
".",
"kroneckerImpl",
"(",
"a",
",",
"p",
")",
";",
"}"
] | Calculate kronecker symbol a|p. Generalization of legendre and jacobi.
@param a an integer
@param p the modulus
@return a|p | [
"Calculate",
"kronecker",
"symbol",
"a|p",
".",
"Generalization",
"of",
"legendre",
"and",
"jacobi",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L96-L98 |
101,424 | square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java | Gmp.modInverse | public static BigInteger modInverse(BigInteger val, BigInteger modulus) {
if (modulus.signum() <= 0) {
throw new ArithmeticException("modulus must be positive");
}
return INSTANCE.get().modInverseImpl(val, modulus);
} | java | public static BigInteger modInverse(BigInteger val, BigInteger modulus) {
if (modulus.signum() <= 0) {
throw new ArithmeticException("modulus must be positive");
}
return INSTANCE.get().modInverseImpl(val, modulus);
} | [
"public",
"static",
"BigInteger",
"modInverse",
"(",
"BigInteger",
"val",
",",
"BigInteger",
"modulus",
")",
"{",
"if",
"(",
"modulus",
".",
"signum",
"(",
")",
"<=",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"modulus must be positive\"",
")... | Calculate val^-1 % modulus.
@param val must be positive
@param modulus the modulus
@return val^-1 % modulus
@throws ArithmeticException if modulus is non-positive or val is not invertible | [
"Calculate",
"val^",
"-",
"1",
"%",
"modulus",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L150-L155 |
101,425 | square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java | Gmp.exactDivide | public static BigInteger exactDivide(BigInteger dividend, BigInteger divisor) {
if (divisor.signum() == 0) {
throw new ArithmeticException("BigInteger divide by zero");
}
return INSTANCE.get().exactDivImpl(dividend, divisor);
} | java | public static BigInteger exactDivide(BigInteger dividend, BigInteger divisor) {
if (divisor.signum() == 0) {
throw new ArithmeticException("BigInteger divide by zero");
}
return INSTANCE.get().exactDivImpl(dividend, divisor);
} | [
"public",
"static",
"BigInteger",
"exactDivide",
"(",
"BigInteger",
"dividend",
",",
"BigInteger",
"divisor",
")",
"{",
"if",
"(",
"divisor",
".",
"signum",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"BigInteger divide by zero\"... | Divide dividend by divisor. This method only returns correct answers when the division produces
no remainder. Correct answers should not be expected when the divison would result in a
remainder.
@return dividend / divisor
@throws ArithmeticException if divisor is zero | [
"Divide",
"dividend",
"by",
"divisor",
".",
"This",
"method",
"only",
"returns",
"correct",
"answers",
"when",
"the",
"division",
"produces",
"no",
"remainder",
".",
"Correct",
"answers",
"should",
"not",
"be",
"expected",
"when",
"the",
"divison",
"would",
"r... | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L165-L170 |
101,426 | square/jna-gmp | bc-rsa/src/main/java/com/squareup/crypto/rsa/NativeRSAEngine.java | NativeRSAEngine.processBlock | public byte[] processBlock(
byte[] in,
int inOff,
int inLen)
{
if (core == null)
{
throw new IllegalStateException("RSA engine not initialised");
}
return core.convertOutput(core.processBlock(core.convertInput(in, inOff, inLen)));
} | java | public byte[] processBlock(
byte[] in,
int inOff,
int inLen)
{
if (core == null)
{
throw new IllegalStateException("RSA engine not initialised");
}
return core.convertOutput(core.processBlock(core.convertInput(in, inOff, inLen)));
} | [
"public",
"byte",
"[",
"]",
"processBlock",
"(",
"byte",
"[",
"]",
"in",
",",
"int",
"inOff",
",",
"int",
"inLen",
")",
"{",
"if",
"(",
"core",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"RSA engine not initialised\"",
")",
"... | Process a single block using the basic RSA algorithm.
@param in the input array.
@param inOff the offset into the input buffer where the data starts.
@param inLen the length of the data to be processed.
@return the result of the RSA process.
@exception DataLengthException the input block is too large. | [
"Process",
"a",
"single",
"block",
"using",
"the",
"basic",
"RSA",
"algorithm",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/bc-rsa/src/main/java/com/squareup/crypto/rsa/NativeRSAEngine.java#L70-L81 |
101,427 | dodie/scott | scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java | ScottClassTransformer.transform | public byte[] transform(byte[] classfileBuffer, Configuration configuration) {
InstrumentationActions instrumentationActions = calculateTransformationParameters(classfileBuffer, configuration);
if (!instrumentationActions.includeClass) {
return classfileBuffer;
}
return transform(classfileBuffer, instrumenta... | java | public byte[] transform(byte[] classfileBuffer, Configuration configuration) {
InstrumentationActions instrumentationActions = calculateTransformationParameters(classfileBuffer, configuration);
if (!instrumentationActions.includeClass) {
return classfileBuffer;
}
return transform(classfileBuffer, instrumenta... | [
"public",
"byte",
"[",
"]",
"transform",
"(",
"byte",
"[",
"]",
"classfileBuffer",
",",
"Configuration",
"configuration",
")",
"{",
"InstrumentationActions",
"instrumentationActions",
"=",
"calculateTransformationParameters",
"(",
"classfileBuffer",
",",
"configuration",
... | Instrument the given class based on the configuration.
@param classfileBuffer class to be instrumented
@param configuration configuration settings
@return instrumented class | [
"Instrument",
"the",
"given",
"class",
"based",
"on",
"the",
"configuration",
"."
] | fd6b492584d3ae7e072871ff2b094cce6041fc99 | https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java#L25-L31 |
101,428 | dodie/scott | scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java | ScottClassTransformer.calculateTransformationParameters | private InstrumentationActions calculateTransformationParameters(byte[] classfileBuffer, Configuration configuration) {
DiscoveryClassVisitor discoveryClassVisitor = new DiscoveryClassVisitor(configuration);
new ClassReader(classfileBuffer).accept(discoveryClassVisitor, 0);
return discoveryClassVisitor.getTransfo... | java | private InstrumentationActions calculateTransformationParameters(byte[] classfileBuffer, Configuration configuration) {
DiscoveryClassVisitor discoveryClassVisitor = new DiscoveryClassVisitor(configuration);
new ClassReader(classfileBuffer).accept(discoveryClassVisitor, 0);
return discoveryClassVisitor.getTransfo... | [
"private",
"InstrumentationActions",
"calculateTransformationParameters",
"(",
"byte",
"[",
"]",
"classfileBuffer",
",",
"Configuration",
"configuration",
")",
"{",
"DiscoveryClassVisitor",
"discoveryClassVisitor",
"=",
"new",
"DiscoveryClassVisitor",
"(",
"configuration",
")... | Based on the structure of the class and the supplied configuration, determine
the concrete instrumentation actions for the class.
@param classfileBuffer class to be analyzed
@param configuration configuration settings
@return instrumentation actions to be applied | [
"Based",
"on",
"the",
"structure",
"of",
"the",
"class",
"and",
"the",
"supplied",
"configuration",
"determine",
"the",
"concrete",
"instrumentation",
"actions",
"for",
"the",
"class",
"."
] | fd6b492584d3ae7e072871ff2b094cce6041fc99 | https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java#L40-L44 |
101,429 | dodie/scott | scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java | ScottClassTransformer.transform | private byte[] transform(byte[] classfileBuffer, InstrumentationActions instrumentationActions) {
ClassReader classReader = new ClassReader(classfileBuffer);
ClassWriter classWriter = new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES);
ClassVisitor localVariableStateEmitterTestClassVisitor = new StateTracki... | java | private byte[] transform(byte[] classfileBuffer, InstrumentationActions instrumentationActions) {
ClassReader classReader = new ClassReader(classfileBuffer);
ClassWriter classWriter = new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES);
ClassVisitor localVariableStateEmitterTestClassVisitor = new StateTracki... | [
"private",
"byte",
"[",
"]",
"transform",
"(",
"byte",
"[",
"]",
"classfileBuffer",
",",
"InstrumentationActions",
"instrumentationActions",
")",
"{",
"ClassReader",
"classReader",
"=",
"new",
"ClassReader",
"(",
"classfileBuffer",
")",
";",
"ClassWriter",
"classWri... | Perform the given instrumentation actions on a class.
@param classfileBuffer class to be transformed
@param instrumentationActions instrumentation actions to be applied
@return instrumented class | [
"Perform",
"the",
"given",
"instrumentation",
"actions",
"on",
"a",
"class",
"."
] | fd6b492584d3ae7e072871ff2b094cce6041fc99 | https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java#L52-L59 |
101,430 | dodie/scott | scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScopeExtractorMethodVisitor.java | ScopeExtractorMethodVisitor.calculateScope | private LocalVariableScope calculateScope(LocalVariableScopeData scope) {
final TryCatchBlockLabels enclosingTry = getEnclosingTry(scope);
final Label start = scope.labels.start;
final Label end = getTryFixedEndLabel(scope, enclosingTry);
int startIndex = getIndex(start);
int endIndex = getIndex(end);
... | java | private LocalVariableScope calculateScope(LocalVariableScopeData scope) {
final TryCatchBlockLabels enclosingTry = getEnclosingTry(scope);
final Label start = scope.labels.start;
final Label end = getTryFixedEndLabel(scope, enclosingTry);
int startIndex = getIndex(start);
int endIndex = getIndex(end);
... | [
"private",
"LocalVariableScope",
"calculateScope",
"(",
"LocalVariableScopeData",
"scope",
")",
"{",
"final",
"TryCatchBlockLabels",
"enclosingTry",
"=",
"getEnclosingTry",
"(",
"scope",
")",
";",
"final",
"Label",
"start",
"=",
"scope",
".",
"labels",
".",
"start",... | Calculate the start and end line numbers for variable scopes. If the
LocalVariableScope start line is 0, then it is an input parameter, as
it's scope start label appeared before the method body. | [
"Calculate",
"the",
"start",
"and",
"end",
"line",
"numbers",
"for",
"variable",
"scopes",
".",
"If",
"the",
"LocalVariableScope",
"start",
"line",
"is",
"0",
"then",
"it",
"is",
"an",
"input",
"parameter",
"as",
"it",
"s",
"scope",
"start",
"label",
"appe... | fd6b492584d3ae7e072871ff2b094cce6041fc99 | https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScopeExtractorMethodVisitor.java#L149-L160 |
101,431 | barend/java-iban | src/main/java/nl/garvelink/iban/IBAN.java | IBAN.parse | public static IBAN parse(String input) {
if (input == null || input.length() == 0) {
throw new IllegalArgumentException("Input is null or empty string.");
}
if (!isLetterOrDigit(input.charAt(0)) || !isLetterOrDigit(input.charAt(input.length() - 1))) {
throw new IllegalArg... | java | public static IBAN parse(String input) {
if (input == null || input.length() == 0) {
throw new IllegalArgumentException("Input is null or empty string.");
}
if (!isLetterOrDigit(input.charAt(0)) || !isLetterOrDigit(input.charAt(input.length() - 1))) {
throw new IllegalArg... | [
"public",
"static",
"IBAN",
"parse",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Input is null or empty string.\"",
")",
... | Parses the given string into an IBAN object and confirms the check digits.
@param input the input, which can be either plain ("CC11ABCD123...") or formatted with (ASCII 0x20) space characters ("CC11 ABCD 123. ..").
@return the parsed and validated IBAN object, never null.
@throws IllegalArgumentException if the input i... | [
"Parses",
"the",
"given",
"string",
"into",
"an",
"IBAN",
"object",
"and",
"confirms",
"the",
"check",
"digits",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/IBAN.java#L103-L111 |
101,432 | barend/java-iban | src/main/java/nl/garvelink/iban/IBAN.java | IBAN.toPlain | public static String toPlain(String input) {
Matcher matcher = SPACE_PATTERN.matcher(input);
if (matcher.find()) {
return matcher.replaceAll("");
} else {
return input;
}
} | java | public static String toPlain(String input) {
Matcher matcher = SPACE_PATTERN.matcher(input);
if (matcher.find()) {
return matcher.replaceAll("");
} else {
return input;
}
} | [
"public",
"static",
"String",
"toPlain",
"(",
"String",
"input",
")",
"{",
"Matcher",
"matcher",
"=",
"SPACE_PATTERN",
".",
"matcher",
"(",
"input",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"return",
"matcher",
".",
"replaceAll",
... | Removes any spaces contained in the String thereby converting the input into a plain IBAN
@param input
possibly pretty printed IBAN
@return plain IBAN | [
"Removes",
"any",
"spaces",
"contained",
"in",
"the",
"String",
"thereby",
"converting",
"the",
"input",
"into",
"a",
"plain",
"IBAN"
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/IBAN.java#L214-L221 |
101,433 | barend/java-iban | src/main/java/nl/garvelink/iban/IBAN.java | IBAN.addSpaces | private static String addSpaces(String value) {
final int length = value.length();
final int lastPossibleBlock = length - 4;
final StringBuilder sb = new StringBuilder(length + (length - 1) / 4);
int i;
for (i = 0; i < lastPossibleBlock; i += 4) {
sb.append(value, i, ... | java | private static String addSpaces(String value) {
final int length = value.length();
final int lastPossibleBlock = length - 4;
final StringBuilder sb = new StringBuilder(length + (length - 1) / 4);
int i;
for (i = 0; i < lastPossibleBlock; i += 4) {
sb.append(value, i, ... | [
"private",
"static",
"String",
"addSpaces",
"(",
"String",
"value",
")",
"{",
"final",
"int",
"length",
"=",
"value",
".",
"length",
"(",
")",
";",
"final",
"int",
"lastPossibleBlock",
"=",
"length",
"-",
"4",
";",
"final",
"StringBuilder",
"sb",
"=",
"n... | Converts a plain to a pretty printed IBAN
@param value
plain iban
@return pretty printed IBAN | [
"Converts",
"a",
"plain",
"to",
"a",
"pretty",
"printed",
"IBAN"
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/IBAN.java#L242-L253 |
101,434 | barend/java-iban | src/main/java/nl/garvelink/iban/Modulo97.java | Modulo97.calculateCheckDigits | public static int calculateCheckDigits(CharSequence input) {
if (input == null || input.length() < 5 || input.charAt(2) != '0' || input.charAt(3) != '0') {
throw new IllegalArgumentException("The input must be non-null, have a minimum length of five characters, and the characters at indices 2 and 3 ... | java | public static int calculateCheckDigits(CharSequence input) {
if (input == null || input.length() < 5 || input.charAt(2) != '0' || input.charAt(3) != '0') {
throw new IllegalArgumentException("The input must be non-null, have a minimum length of five characters, and the characters at indices 2 and 3 ... | [
"public",
"static",
"int",
"calculateCheckDigits",
"(",
"CharSequence",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
".",
"length",
"(",
")",
"<",
"5",
"||",
"input",
".",
"charAt",
"(",
"2",
")",
"!=",
"'",
"'",
"||",
"input",... | Calculates the check digits to be used in a MOD97 checked string.
@param input the input; the characters at indices 2 and 3 <strong>must</strong> be {@code '0'}. The input must
also satisfy the criteria defined in {@link #checksum(CharSequence)}.
@return the check digits to be used at indices 2 and 3 to make the input ... | [
"Calculates",
"the",
"check",
"digits",
"to",
"be",
"used",
"in",
"a",
"MOD97",
"checked",
"string",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/Modulo97.java#L70-L75 |
101,435 | barend/java-iban | src/main/java/nl/garvelink/iban/CountryCodes.java | CountryCodes.getLengthForCountryCode | public static int getLengthForCountryCode(String countryCode) {
int index = indexOf(countryCode);
if (index > -1) {
return CountryCodes.COUNTRY_IBAN_LENGTHS[index] & REMOVE_SEPA_MASK;
}
return -1;
} | java | public static int getLengthForCountryCode(String countryCode) {
int index = indexOf(countryCode);
if (index > -1) {
return CountryCodes.COUNTRY_IBAN_LENGTHS[index] & REMOVE_SEPA_MASK;
}
return -1;
} | [
"public",
"static",
"int",
"getLengthForCountryCode",
"(",
"String",
"countryCode",
")",
"{",
"int",
"index",
"=",
"indexOf",
"(",
"countryCode",
")",
";",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"return",
"CountryCodes",
".",
"COUNTRY_IBAN_LENGTHS",
"[... | Returns the IBAN length for a given country code.
@param countryCode a non-null, uppercase, two-character country code.
@return the IBAN length for the given country, or -1 if the input is not a known, two-character country code.
@throws NullPointerException if the input is null. | [
"Returns",
"the",
"IBAN",
"length",
"for",
"a",
"given",
"country",
"code",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/CountryCodes.java#L264-L270 |
101,436 | barend/java-iban | src/main/java/nl/garvelink/iban/CountryCodes.java | CountryCodes.isSEPACountry | public static boolean isSEPACountry(String countryCode) {
int index = indexOf(countryCode);
if (index > -1) {
return (CountryCodes.COUNTRY_IBAN_LENGTHS[index] & SEPA) == SEPA;
}
return false;
} | java | public static boolean isSEPACountry(String countryCode) {
int index = indexOf(countryCode);
if (index > -1) {
return (CountryCodes.COUNTRY_IBAN_LENGTHS[index] & SEPA) == SEPA;
}
return false;
} | [
"public",
"static",
"boolean",
"isSEPACountry",
"(",
"String",
"countryCode",
")",
"{",
"int",
"index",
"=",
"indexOf",
"(",
"countryCode",
")",
";",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"return",
"(",
"CountryCodes",
".",
"COUNTRY_IBAN_LENGTHS",
"... | Returns whether the given country code is in SEPA.
@param countryCode a non-null, uppercase, two-character country code.
@return true if SEPA, false if not.
@throws NullPointerException if the input is null. | [
"Returns",
"whether",
"the",
"given",
"country",
"code",
"is",
"in",
"SEPA",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/CountryCodes.java#L278-L284 |
101,437 | barend/java-iban | src/main/java/nl/garvelink/iban/CountryCodes.java | CountryCodes.isKnownCountryCode | public static boolean isKnownCountryCode(String aCountryCode) {
if (aCountryCode == null || aCountryCode.length() != 2) {
return false;
}
return indexOf(aCountryCode) >= 0;
} | java | public static boolean isKnownCountryCode(String aCountryCode) {
if (aCountryCode == null || aCountryCode.length() != 2) {
return false;
}
return indexOf(aCountryCode) >= 0;
} | [
"public",
"static",
"boolean",
"isKnownCountryCode",
"(",
"String",
"aCountryCode",
")",
"{",
"if",
"(",
"aCountryCode",
"==",
"null",
"||",
"aCountryCode",
".",
"length",
"(",
")",
"!=",
"2",
")",
"{",
"return",
"false",
";",
"}",
"return",
"indexOf",
"("... | Returns whether the given string is a known country code.
@param aCountryCode the string to evaluate.
@return {@code true} if {@code aCountryCode} is a two-letter, uppercase String present in {@link #getKnownCountryCodes()}. | [
"Returns",
"whether",
"the",
"given",
"string",
"is",
"a",
"known",
"country",
"code",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/CountryCodes.java#L299-L304 |
101,438 | taimos/GPSd4Java | src/main/java/de/taimos/gpsd4java/backend/GPSdEndpoint.java | GPSdEndpoint.stop | public void stop() {
try {
if (this.socket != null) {
this.socket.close();
}
} catch (final IOException e1) {
GPSdEndpoint.LOG.debug("Close forced: " + e1.getMessage());
}
this.listeners.clear();
if (this.listenThread != null) {
this.listenThread.halt();
}
this.listenThread = n... | java | public void stop() {
try {
if (this.socket != null) {
this.socket.close();
}
} catch (final IOException e1) {
GPSdEndpoint.LOG.debug("Close forced: " + e1.getMessage());
}
this.listeners.clear();
if (this.listenThread != null) {
this.listenThread.halt();
}
this.listenThread = n... | [
"public",
"void",
"stop",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"socket",
"!=",
"null",
")",
"{",
"this",
".",
"socket",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"IOException",
"e1",
")",
"{",
"GPSdEndpoint",
"."... | Stops the endpoint. | [
"Stops",
"the",
"endpoint",
"."
] | f3bdfcc5eed628417ea72bf20d108519f24d105b | https://github.com/taimos/GPSd4Java/blob/f3bdfcc5eed628417ea72bf20d108519f24d105b/src/main/java/de/taimos/gpsd4java/backend/GPSdEndpoint.java#L148-L165 |
101,439 | taimos/GPSd4Java | src/main/java/de/taimos/gpsd4java/backend/GPSdEndpoint.java | GPSdEndpoint.handleDisconnected | void handleDisconnected() throws IOException {
synchronized (this.asyncMutex) {
if (socket != null) {
socket.close();
}
this.socket = new Socket(server, port);
this.in = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
this.out = new BufferedWriter(new OutputStreamWriter(thi... | java | void handleDisconnected() throws IOException {
synchronized (this.asyncMutex) {
if (socket != null) {
socket.close();
}
this.socket = new Socket(server, port);
this.in = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
this.out = new BufferedWriter(new OutputStreamWriter(thi... | [
"void",
"handleDisconnected",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"this",
".",
"asyncMutex",
")",
"{",
"if",
"(",
"socket",
"!=",
"null",
")",
"{",
"socket",
".",
"close",
"(",
")",
";",
"}",
"this",
".",
"socket",
"=",
"new",
... | Our socket thread got disconnect and is exiting. | [
"Our",
"socket",
"thread",
"got",
"disconnect",
"and",
"is",
"exiting",
"."
] | f3bdfcc5eed628417ea72bf20d108519f24d105b | https://github.com/taimos/GPSd4Java/blob/f3bdfcc5eed628417ea72bf20d108519f24d105b/src/main/java/de/taimos/gpsd4java/backend/GPSdEndpoint.java#L347-L363 |
101,440 | taimos/GPSd4Java | src/main/java/de/taimos/gpsd4java/backend/AbstractResultParser.java | AbstractResultParser.parseObjectArray | @SuppressWarnings({"unchecked", "unused"})
protected <T extends IGPSObject> List<T> parseObjectArray(final JSONArray array, final Class<T> type) throws ParseException {
try {
if (array == null) {
return new ArrayList<T>(10);
}
final List<T> objects = new ArrayList<T>(10);
for (int i = 0; i < array.le... | java | @SuppressWarnings({"unchecked", "unused"})
protected <T extends IGPSObject> List<T> parseObjectArray(final JSONArray array, final Class<T> type) throws ParseException {
try {
if (array == null) {
return new ArrayList<T>(10);
}
final List<T> objects = new ArrayList<T>(10);
for (int i = 0; i < array.le... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"unused\"",
"}",
")",
"protected",
"<",
"T",
"extends",
"IGPSObject",
">",
"List",
"<",
"T",
">",
"parseObjectArray",
"(",
"final",
"JSONArray",
"array",
",",
"final",
"Class",
"<",
"T",
">",
"type... | parse a whole JSONArray into a list of IGPSObjects | [
"parse",
"a",
"whole",
"JSONArray",
"into",
"a",
"list",
"of",
"IGPSObjects"
] | f3bdfcc5eed628417ea72bf20d108519f24d105b | https://github.com/taimos/GPSd4Java/blob/f3bdfcc5eed628417ea72bf20d108519f24d105b/src/main/java/de/taimos/gpsd4java/backend/AbstractResultParser.java#L82-L96 |
101,441 | statefulj/statefulj | statefulj-fsm/src/main/java/org/statefulj/fsm/FSM.java | FSM.onEvent | public State<T> onEvent(T stateful, String event, Object ... args) throws TooBusyException {
int attempts = 0;
while(this.retryAttempts == -1 || attempts < this.retryAttempts) {
try {
State<T> current = this.getCurrentState(stateful);
// Fetch the transition for this event from the current state
/... | java | public State<T> onEvent(T stateful, String event, Object ... args) throws TooBusyException {
int attempts = 0;
while(this.retryAttempts == -1 || attempts < this.retryAttempts) {
try {
State<T> current = this.getCurrentState(stateful);
// Fetch the transition for this event from the current state
/... | [
"public",
"State",
"<",
"T",
">",
"onEvent",
"(",
"T",
"stateful",
",",
"String",
"event",
",",
"Object",
"...",
"args",
")",
"throws",
"TooBusyException",
"{",
"int",
"attempts",
"=",
"0",
";",
"while",
"(",
"this",
".",
"retryAttempts",
"==",
"-",
"1... | Process event. Will handle all retry attempts. If attempts exceed maximum retries,
it will throw a TooBusyException.
@param stateful The Stateful Entity
@param event The Event
@param args Optional parameters to pass into the Action
@return The current State
@throws TooBusyException Exception indicating that we've ex... | [
"Process",
"event",
".",
"Will",
"handle",
"all",
"retry",
"attempts",
".",
"If",
"attempts",
"exceed",
"maximum",
"retries",
"it",
"will",
"throw",
"a",
"TooBusyException",
"."
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-fsm/src/main/java/org/statefulj/fsm/FSM.java#L109-L165 |
101,442 | statefulj/statefulj | statefulj-common/src/main/java/org/statefulj/common/utils/ReflectionUtils.java | ReflectionUtils.getField | public static Field getField(final Class<?> clazz, final String fieldName) {
//Define return type
//
Field
field = null;
//For each class in the hierarchy starting with the current class, try to find the declared field
//
for (Class<?> current = clazz; curren... | java | public static Field getField(final Class<?> clazz, final String fieldName) {
//Define return type
//
Field
field = null;
//For each class in the hierarchy starting with the current class, try to find the declared field
//
for (Class<?> current = clazz; curren... | [
"public",
"static",
"Field",
"getField",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"String",
"fieldName",
")",
"{",
"//Define return type",
"//",
"Field",
"field",
"=",
"null",
";",
"//For each class in the hierarchy starting with the current class,... | Climb the class hierarchy starting with the clazz provided, looking for the field with fieldName
@param clazz starting class to search at
@param fieldName name of the field we are looking for
@return Field which was found, or null if nothing was found | [
"Climb",
"the",
"class",
"hierarchy",
"starting",
"with",
"the",
"clazz",
"provided",
"looking",
"for",
"the",
"field",
"with",
"fieldName"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-common/src/main/java/org/statefulj/common/utils/ReflectionUtils.java#L187-L215 |
101,443 | statefulj/statefulj | statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-springmvc/src/main/java/org/statefulj/framework/binders/springmvc/SpringMVCBinder.java | SpringMVCBinder.createParameterAnnotations | @Override
protected Annotation[] createParameterAnnotations(
String parmName,
MethodInfo methodInfo,
java.lang.annotation.Annotation[] annotations,
ConstPool parameterConstPool) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
List<Annotation> ctParmAnnotations = new L... | java | @Override
protected Annotation[] createParameterAnnotations(
String parmName,
MethodInfo methodInfo,
java.lang.annotation.Annotation[] annotations,
ConstPool parameterConstPool) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
List<Annotation> ctParmAnnotations = new L... | [
"@",
"Override",
"protected",
"Annotation",
"[",
"]",
"createParameterAnnotations",
"(",
"String",
"parmName",
",",
"MethodInfo",
"methodInfo",
",",
"java",
".",
"lang",
".",
"annotation",
".",
"Annotation",
"[",
"]",
"annotations",
",",
"ConstPool",
"parameterCon... | Clone all the parameter Annotations from the StatefulController to the Proxy
@param methodInfo
@param parmName
@param parameterConstPool
@param annotations
@throws IllegalArgumentException
@throws IllegalAccessException
@throws InvocationTargetException | [
"Clone",
"all",
"the",
"parameter",
"Annotations",
"from",
"the",
"StatefulController",
"to",
"the",
"Proxy"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-springmvc/src/main/java/org/statefulj/framework/binders/springmvc/SpringMVCBinder.java#L135-L160 |
101,444 | statefulj/statefulj | statefulj-persistence/statefulj-persistence-mongo/src/main/java/org/statefulj/persistence/mongo/MongoCascadeSupport.java | MongoCascadeSupport.onAfterSave | @Override
public void onAfterSave(Object source, DBObject dbo) {
this.persister.onAfterSave(source, dbo);
} | java | @Override
public void onAfterSave(Object source, DBObject dbo) {
this.persister.onAfterSave(source, dbo);
} | [
"@",
"Override",
"public",
"void",
"onAfterSave",
"(",
"Object",
"source",
",",
"DBObject",
"dbo",
")",
"{",
"this",
".",
"persister",
".",
"onAfterSave",
"(",
"source",
",",
"dbo",
")",
";",
"}"
] | Pass the Save event to the MongoPersister to cascade to the StateDocument
(non-Javadoc)
@see org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener#onBeforeConvert(java.lang.Object) | [
"Pass",
"the",
"Save",
"event",
"to",
"the",
"MongoPersister",
"to",
"cascade",
"to",
"the",
"StateDocument"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-persistence/statefulj-persistence-mongo/src/main/java/org/statefulj/persistence/mongo/MongoCascadeSupport.java#L40-L43 |
101,445 | statefulj/statefulj | statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/StatefulFactory.java | StatefulFactory.mapControllerAndEntityClasses | private void mapControllerAndEntityClasses(
BeanDefinitionRegistry reg,
Map<String, Class<?>> controllerToEntityMapping,
Map<Class<?>, String> entityToRepositoryMapping,
Map<Class<?>, Set<String>> entityToControllerMappings) throws ClassNotFoundException {
// Loop thru the bean registry
//
for(String... | java | private void mapControllerAndEntityClasses(
BeanDefinitionRegistry reg,
Map<String, Class<?>> controllerToEntityMapping,
Map<Class<?>, String> entityToRepositoryMapping,
Map<Class<?>, Set<String>> entityToControllerMappings) throws ClassNotFoundException {
// Loop thru the bean registry
//
for(String... | [
"private",
"void",
"mapControllerAndEntityClasses",
"(",
"BeanDefinitionRegistry",
"reg",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"controllerToEntityMapping",
",",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"String",
">",
"entityToRepositoryMa... | Iterate thru all beans and fetch the StatefulControllers
@param reg
@return
@throws ClassNotFoundException | [
"Iterate",
"thru",
"all",
"beans",
"and",
"fetch",
"the",
"StatefulControllers"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/StatefulFactory.java#L333-L370 |
101,446 | statefulj/statefulj | statefulj-common/src/main/java/org/statefulj/common/utils/FieldAccessor.java | FieldAccessor.getValue | public V getValue(T object) {
try {
if (this.getMethod != null) {
return (V)this.getMethod.invoke(object);
} else {
return (V)this.field.get(object);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
... | java | public V getValue(T object) {
try {
if (this.getMethod != null) {
return (V)this.getMethod.invoke(object);
} else {
return (V)this.field.get(object);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
... | [
"public",
"V",
"getValue",
"(",
"T",
"object",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"getMethod",
"!=",
"null",
")",
"{",
"return",
"(",
"V",
")",
"this",
".",
"getMethod",
".",
"invoke",
"(",
"object",
")",
";",
"}",
"else",
"{",
"return... | Return the value of the object
@param object
@return | [
"Return",
"the",
"value",
"of",
"the",
"object"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-common/src/main/java/org/statefulj/common/utils/FieldAccessor.java#L47-L59 |
101,447 | statefulj/statefulj | statefulj-common/src/main/java/org/statefulj/common/utils/FieldAccessor.java | FieldAccessor.setValue | public void setValue(T object, V value) {
try {
if (this.setMethod != null) {
this.setMethod.invoke(object, value);
} else {
this.field.set(object, value);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e)... | java | public void setValue(T object, V value) {
try {
if (this.setMethod != null) {
this.setMethod.invoke(object, value);
} else {
this.field.set(object, value);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e)... | [
"public",
"void",
"setValue",
"(",
"T",
"object",
",",
"V",
"value",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"setMethod",
"!=",
"null",
")",
"{",
"this",
".",
"setMethod",
".",
"invoke",
"(",
"object",
",",
"value",
")",
";",
"}",
"else",
"... | Set's the value of the object
@param object
@param value | [
"Set",
"s",
"the",
"value",
"of",
"the",
"object"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-common/src/main/java/org/statefulj/common/utils/FieldAccessor.java#L67-L79 |
101,448 | statefulj/statefulj | statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-common/src/main/java/org/statefulj/framework/binders/common/utils/JavassistUtils.java | JavassistUtils.cloneAnnotation | public static Annotation cloneAnnotation(ConstPool constPool, java.lang.annotation.Annotation annotation) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class<?> clazz = annotation.annotationType();
Annotation annot = new Annotation(clazz.getName(), constPool);
for(Method me... | java | public static Annotation cloneAnnotation(ConstPool constPool, java.lang.annotation.Annotation annotation) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class<?> clazz = annotation.annotationType();
Annotation annot = new Annotation(clazz.getName(), constPool);
for(Method me... | [
"public",
"static",
"Annotation",
"cloneAnnotation",
"(",
"ConstPool",
"constPool",
",",
"java",
".",
"lang",
".",
"annotation",
".",
"Annotation",
"annotation",
")",
"throws",
"IllegalArgumentException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
... | Clone an annotation and all of it's methods
@param constPool
@param annotation
@return
@throws IllegalArgumentException
@throws IllegalAccessException
@throws InvocationTargetException | [
"Clone",
"an",
"annotation",
"and",
"all",
"of",
"it",
"s",
"methods"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-common/src/main/java/org/statefulj/framework/binders/common/utils/JavassistUtils.java#L94-L114 |
101,449 | chemouna/Decor | decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java | AutofitDecorator.refitText | private void refitText() {
if (!mSizeToFit) {
return;
}
if (mMaxLines <= 0) {
// Don't auto-size since there's no limit on lines.
return;
}
String text = mTextView.getText().toString();
int targetWidth = mTextView.getWidth() - mTextVi... | java | private void refitText() {
if (!mSizeToFit) {
return;
}
if (mMaxLines <= 0) {
// Don't auto-size since there's no limit on lines.
return;
}
String text = mTextView.getText().toString();
int targetWidth = mTextView.getWidth() - mTextVi... | [
"private",
"void",
"refitText",
"(",
")",
"{",
"if",
"(",
"!",
"mSizeToFit",
")",
"{",
"return",
";",
"}",
"if",
"(",
"mMaxLines",
"<=",
"0",
")",
"{",
"// Don't auto-size since there's no limit on lines.",
"return",
";",
"}",
"String",
"text",
"=",
"mTextVi... | Re size the font so the specified text fits in the text box assuming the text box is the
specified width. | [
"Re",
"size",
"the",
"font",
"so",
"the",
"specified",
"text",
"fits",
"in",
"the",
"text",
"box",
"assuming",
"the",
"text",
"box",
"is",
"the",
"specified",
"width",
"."
] | 82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca | https://github.com/chemouna/Decor/blob/82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca/decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java#L133-L174 |
101,450 | chemouna/Decor | decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java | DecorLayoutInflater.onCreateView | @Override
protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
// This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base
// classes, if this fails its pretty certain the app will fail at this point.
View view = null;
... | java | @Override
protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
// This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base
// classes, if this fails its pretty certain the app will fail at this point.
View view = null;
... | [
"@",
"Override",
"protected",
"View",
"onCreateView",
"(",
"String",
"name",
",",
"AttributeSet",
"attrs",
")",
"throws",
"ClassNotFoundException",
"{",
"// This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base",
"// classes, if this fails its pretty cer... | The LayoutInflater onCreateView is the fourth port of call for LayoutInflation.
BUT only for none CustomViews.
Basically if this method doesn't inflate the View nothing probably will. | [
"The",
"LayoutInflater",
"onCreateView",
"is",
"the",
"fourth",
"port",
"of",
"call",
"for",
"LayoutInflation",
".",
"BUT",
"only",
"for",
"none",
"CustomViews",
".",
"Basically",
"if",
"this",
"method",
"doesn",
"t",
"inflate",
"the",
"View",
"nothing",
"prob... | 82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca | https://github.com/chemouna/Decor/blob/82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca/decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java#L130-L146 |
101,451 | nielsbasjes/logparser | parser-core/src/main/java/nl/basjes/parse/core/Parser.java | Parser.parse | public RECORD parse(final String value)
throws DissectionFailure, InvalidDissectorException, MissingDissectorsException {
assembleDissectors();
final Parsable<RECORD> parsable = createParsable();
if (parsable == null) {
return null;
}
parsable.setRootDissectio... | java | public RECORD parse(final String value)
throws DissectionFailure, InvalidDissectorException, MissingDissectorsException {
assembleDissectors();
final Parsable<RECORD> parsable = createParsable();
if (parsable == null) {
return null;
}
parsable.setRootDissectio... | [
"public",
"RECORD",
"parse",
"(",
"final",
"String",
"value",
")",
"throws",
"DissectionFailure",
",",
"InvalidDissectorException",
",",
"MissingDissectorsException",
"{",
"assembleDissectors",
"(",
")",
";",
"final",
"Parsable",
"<",
"RECORD",
">",
"parsable",
"=",... | Parse the value and return a new instance of RECORD.
For this method to work the RECORD class may NOT be an inner class. | [
"Parse",
"the",
"value",
"and",
"return",
"a",
"new",
"instance",
"of",
"RECORD",
".",
"For",
"this",
"method",
"to",
"work",
"the",
"RECORD",
"class",
"may",
"NOT",
"be",
"an",
"inner",
"class",
"."
] | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/parser-core/src/main/java/nl/basjes/parse/core/Parser.java#L700-L709 |
101,452 | nielsbasjes/logparser | parser-core/src/main/java/nl/basjes/parse/core/Parser.java | Parser.getPossiblePaths | public List<String> getPossiblePaths(int maxDepth) {
if (allDissectors.isEmpty()) {
return Collections.emptyList(); // nothing to do.
}
try {
assembleDissectors();
} catch (MissingDissectorsException | InvalidDissectorException e) {
// Simply swallow ... | java | public List<String> getPossiblePaths(int maxDepth) {
if (allDissectors.isEmpty()) {
return Collections.emptyList(); // nothing to do.
}
try {
assembleDissectors();
} catch (MissingDissectorsException | InvalidDissectorException e) {
// Simply swallow ... | [
"public",
"List",
"<",
"String",
">",
"getPossiblePaths",
"(",
"int",
"maxDepth",
")",
"{",
"if",
"(",
"allDissectors",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"// nothing to do.",
"}",
"try",
"{",
"a... | This method is for use by the developer to query the parser about
the possible paths that may be extracted.
@param maxDepth The maximum recursion depth
@return A list of all possible paths that could be determined automatically. | [
"This",
"method",
"is",
"for",
"use",
"by",
"the",
"developer",
"to",
"query",
"the",
"parser",
"about",
"the",
"possible",
"paths",
"that",
"may",
"be",
"extracted",
"."
] | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/parser-core/src/main/java/nl/basjes/parse/core/Parser.java#L914-L965 |
101,453 | nielsbasjes/logparser | httpdlog/httpdlog-parser/src/main/java/nl/basjes/parse/httpdlog/Utils.java | Utils.resilientUrlDecode | public static String resilientUrlDecode(String input) {
String cookedInput = input;
if (cookedInput.indexOf('%') > -1) {
// Transform all existing UTF-8 standard into UTF-16 standard.
cookedInput = VALID_STANDARD.matcher(cookedInput).replaceAll("%00%$1");
// Discard... | java | public static String resilientUrlDecode(String input) {
String cookedInput = input;
if (cookedInput.indexOf('%') > -1) {
// Transform all existing UTF-8 standard into UTF-16 standard.
cookedInput = VALID_STANDARD.matcher(cookedInput).replaceAll("%00%$1");
// Discard... | [
"public",
"static",
"String",
"resilientUrlDecode",
"(",
"String",
"input",
")",
"{",
"String",
"cookedInput",
"=",
"input",
";",
"if",
"(",
"cookedInput",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"-",
"1",
")",
"{",
"// Transform all existing UTF-8 standard i... | The main goal of the resilientUrlDecode is to have a UrlDecode that keeps working
even if the input is seriously flawed or even uses a rejected standard.
@param input the UrlEncoded input string
@return Url decoded result string | [
"The",
"main",
"goal",
"of",
"the",
"resilientUrlDecode",
"is",
"to",
"have",
"a",
"UrlDecode",
"that",
"keeps",
"working",
"even",
"if",
"the",
"input",
"is",
"seriously",
"flawed",
"or",
"even",
"uses",
"a",
"rejected",
"standard",
"."
] | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/httpdlog/httpdlog-parser/src/main/java/nl/basjes/parse/httpdlog/Utils.java#L38-L65 |
101,454 | nielsbasjes/logparser | parser-core/src/main/java/nl/basjes/parse/core/Dissector.java | Dissector.getNewInstance | public Dissector getNewInstance() {
try {
Constructor<? extends Dissector> co = this.getClass().getConstructor();
Dissector newInstance = co.newInstance();
initializeNewInstance(newInstance);
return newInstance;
} catch (Exception e) {
LOG.erro... | java | public Dissector getNewInstance() {
try {
Constructor<? extends Dissector> co = this.getClass().getConstructor();
Dissector newInstance = co.newInstance();
initializeNewInstance(newInstance);
return newInstance;
} catch (Exception e) {
LOG.erro... | [
"public",
"Dissector",
"getNewInstance",
"(",
")",
"{",
"try",
"{",
"Constructor",
"<",
"?",
"extends",
"Dissector",
">",
"co",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getConstructor",
"(",
")",
";",
"Dissector",
"newInstance",
"=",
"co",
".",
"new... | Create an additional instance of this dissector.
This is needed because in the parse tree we may need the same dissector multiple times.
In order to optimize per node we need separate instances.
@return New instance of this Dissector | [
"Create",
"an",
"additional",
"instance",
"of",
"this",
"dissector",
".",
"This",
"is",
"needed",
"because",
"in",
"the",
"parse",
"tree",
"we",
"may",
"need",
"the",
"same",
"dissector",
"multiple",
"times",
".",
"In",
"order",
"to",
"optimize",
"per",
"n... | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/parser-core/src/main/java/nl/basjes/parse/core/Dissector.java#L135-L145 |
101,455 | nielsbasjes/logparser | httpdlog/httpdlog-inputformat/src/main/java/nl/basjes/hadoop/input/ParsedRecord.java | ParsedRecord.declareRequestedFieldname | public void declareRequestedFieldname(String name) {
if (name.endsWith(".*")) {
stringSetValues.put(name, new HashMap<>());
stringSetPrefixes.put(name.substring(0, name.length() - 1), name);
}
} | java | public void declareRequestedFieldname(String name) {
if (name.endsWith(".*")) {
stringSetValues.put(name, new HashMap<>());
stringSetPrefixes.put(name.substring(0, name.length() - 1), name);
}
} | [
"public",
"void",
"declareRequestedFieldname",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
".",
"endsWith",
"(",
"\".*\"",
")",
")",
"{",
"stringSetValues",
".",
"put",
"(",
"name",
",",
"new",
"HashMap",
"<>",
"(",
")",
")",
";",
"stringSetPrefi... | For multivalue things we need to know what the name is we are expecting.
For those patterns we match the values we get against
@param name the name of the requested multivalue | [
"For",
"multivalue",
"things",
"we",
"need",
"to",
"know",
"what",
"the",
"name",
"is",
"we",
"are",
"expecting",
".",
"For",
"those",
"patterns",
"we",
"match",
"the",
"values",
"we",
"get",
"against"
] | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/httpdlog/httpdlog-inputformat/src/main/java/nl/basjes/hadoop/input/ParsedRecord.java#L178-L183 |
101,456 | Patreon/patreon-java | src/main/java/com/patreon/PatreonAPI.java | PatreonAPI.fetchUser | public JSONAPIDocument<User> fetchUser(Collection<User.UserField> optionalFields) throws IOException {
URIBuilder pathBuilder = new URIBuilder()
.setPath("current_user")
.addParameter("include", "pledges");
if (optionalFields != null) {
Set<User.UserField> optionalA... | java | public JSONAPIDocument<User> fetchUser(Collection<User.UserField> optionalFields) throws IOException {
URIBuilder pathBuilder = new URIBuilder()
.setPath("current_user")
.addParameter("include", "pledges");
if (optionalFields != null) {
Set<User.UserField> optionalA... | [
"public",
"JSONAPIDocument",
"<",
"User",
">",
"fetchUser",
"(",
"Collection",
"<",
"User",
".",
"UserField",
">",
"optionalFields",
")",
"throws",
"IOException",
"{",
"URIBuilder",
"pathBuilder",
"=",
"new",
"URIBuilder",
"(",
")",
".",
"setPath",
"(",
"\"cur... | Get the user object of the creator
@param optionalFields A list of optional fields to request, or null. See {@link User.UserField}
@return the current user
@throws IOException Thrown when the GET request failed | [
"Get",
"the",
"user",
"object",
"of",
"the",
"creator"
] | 669104b3389f19635ffab75c593db9c022334092 | https://github.com/Patreon/patreon-java/blob/669104b3389f19635ffab75c593db9c022334092/src/main/java/com/patreon/PatreonAPI.java#L84-L98 |
101,457 | beders/Resty | src/main/java/us/monoid/web/XPathQuery.java | XPathQuery.eval | public <T> T eval(XMLResource resource, Class<T>aReturnType) throws Exception {
T retVal = (T) xPathExpression.evaluate(resource.doc(), getConstant(aReturnType));
return retVal;
} | java | public <T> T eval(XMLResource resource, Class<T>aReturnType) throws Exception {
T retVal = (T) xPathExpression.evaluate(resource.doc(), getConstant(aReturnType));
return retVal;
} | [
"public",
"<",
"T",
">",
"T",
"eval",
"(",
"XMLResource",
"resource",
",",
"Class",
"<",
"T",
">",
"aReturnType",
")",
"throws",
"Exception",
"{",
"T",
"retVal",
"=",
"(",
"T",
")",
"xPathExpression",
".",
"evaluate",
"(",
"resource",
".",
"doc",
"(",
... | Evaluate the XPath on an XMLResource and convert the result into aReturnType.
@param <T> the expected type of the result
@param resource
@param aReturnType
@return
@throws Exception | [
"Evaluate",
"the",
"XPath",
"on",
"an",
"XMLResource",
"and",
"convert",
"the",
"result",
"into",
"aReturnType",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/XPathQuery.java#L60-L63 |
101,458 | beders/Resty | src/main/java/us/monoid/web/JSONResource.java | JSONResource.unmarshal | protected Object unmarshal() throws IOException, JSONException {
json = new JSONTokener(new InputStreamReader(inputStream, "UTF-8")).nextValue();
inputStream.close();
return json;
} | java | protected Object unmarshal() throws IOException, JSONException {
json = new JSONTokener(new InputStreamReader(inputStream, "UTF-8")).nextValue();
inputStream.close();
return json;
} | [
"protected",
"Object",
"unmarshal",
"(",
")",
"throws",
"IOException",
",",
"JSONException",
"{",
"json",
"=",
"new",
"JSONTokener",
"(",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"\"UTF-8\"",
")",
")",
".",
"nextValue",
"(",
")",
";",
"inputStream"... | Transforming the JSON on the fly | [
"Transforming",
"the",
"JSON",
"on",
"the",
"fly"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/JSONResource.java#L59-L63 |
101,459 | beders/Resty | src/main/java/us/monoid/web/JSONResource.java | JSONResource.json | public JSONResource json(JSONPathQuery path) throws Exception {
Object jsonValue = path.eval(this);
return json(jsonValue.toString());
} | java | public JSONResource json(JSONPathQuery path) throws Exception {
Object jsonValue = path.eval(this);
return json(jsonValue.toString());
} | [
"public",
"JSONResource",
"json",
"(",
"JSONPathQuery",
"path",
")",
"throws",
"Exception",
"{",
"Object",
"jsonValue",
"=",
"path",
".",
"eval",
"(",
"this",
")",
";",
"return",
"json",
"(",
"jsonValue",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Execute the given path query on the json GET the returned URI expecting JSON
@param path path to the URI to follow
@return a new resource, as a result of getting it from the server in JSON format
@throws Exception
@throws JSONException | [
"Execute",
"the",
"given",
"path",
"query",
"on",
"the",
"json",
"GET",
"the",
"returned",
"URI",
"expecting",
"JSON"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/JSONResource.java#L72-L75 |
101,460 | beders/Resty | src/main/java/us/monoid/web/Content.java | Content.addContent | @Override
protected void addContent(URLConnection con) throws IOException {
con.setDoOutput(true);
con.addRequestProperty("Content-Type", mime);
con.addRequestProperty("Content-Length", String.valueOf(content.length));
OutputStream os = con.getOutputStream();
writeContent(os);
os.close();
} | java | @Override
protected void addContent(URLConnection con) throws IOException {
con.setDoOutput(true);
con.addRequestProperty("Content-Type", mime);
con.addRequestProperty("Content-Length", String.valueOf(content.length));
OutputStream os = con.getOutputStream();
writeContent(os);
os.close();
} | [
"@",
"Override",
"protected",
"void",
"addContent",
"(",
"URLConnection",
"con",
")",
"throws",
"IOException",
"{",
"con",
".",
"setDoOutput",
"(",
"true",
")",
";",
"con",
".",
"addRequestProperty",
"(",
"\"Content-Type\"",
",",
"mime",
")",
";",
"con",
"."... | Add the content to the URLConnection used.
@param con the connection to use
@throws IOException if writing to stream fails | [
"Add",
"the",
"content",
"to",
"the",
"URLConnection",
"used",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Content.java#L38-L46 |
101,461 | beders/Resty | src/main/java/us/monoid/web/Content.java | Content.writeHeader | @Override
public void writeHeader(OutputStream os) throws IOException {
os.write(ascii("Content-Type: " + mime + "\r\n"));
os.write(ascii("Content-Length: " + String.valueOf(content.length) + "\r\n"));
} | java | @Override
public void writeHeader(OutputStream os) throws IOException {
os.write(ascii("Content-Type: " + mime + "\r\n"));
os.write(ascii("Content-Length: " + String.valueOf(content.length) + "\r\n"));
} | [
"@",
"Override",
"public",
"void",
"writeHeader",
"(",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"os",
".",
"write",
"(",
"ascii",
"(",
"\"Content-Type: \"",
"+",
"mime",
"+",
"\"\\r\\n\"",
")",
")",
";",
"os",
".",
"write",
"(",
"ascii",
... | Used as a mime part, writing content headers | [
"Used",
"as",
"a",
"mime",
"part",
"writing",
"content",
"headers"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Content.java#L54-L58 |
101,462 | beders/Resty | src/main/java/us/monoid/json/JSONObject.java | JSONObject.getNames | public static String[] getNames(Object object) {
if (object == null) {
return null;
}
Class<? extends Object> klass = object.getClass();
Field[] fields = klass.getFields();
int length = fields.length;
if (length == 0) {
return null;
}
String[] names = new String[length];
for (int i = 0; i < leng... | java | public static String[] getNames(Object object) {
if (object == null) {
return null;
}
Class<? extends Object> klass = object.getClass();
Field[] fields = klass.getFields();
int length = fields.length;
if (length == 0) {
return null;
}
String[] names = new String[length];
for (int i = 0; i < leng... | [
"public",
"static",
"String",
"[",
"]",
"getNames",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Class",
"<",
"?",
"extends",
"Object",
">",
"klass",
"=",
"object",
".",
"getClass",
"(",... | Get an array of field names from an Object.
@return An array of field names, or null if there are no names. | [
"Get",
"an",
"array",
"of",
"field",
"names",
"from",
"an",
"Object",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/json/JSONObject.java#L653-L668 |
101,463 | beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.encodeIfNecessary | public static String encodeIfNecessary(String text, Usage usage, int usedCharacters) {
if (hasToBeEncoded(text, usedCharacters))
return encodeEncodedWord(text, usage, usedCharacters);
else
return text;
} | java | public static String encodeIfNecessary(String text, Usage usage, int usedCharacters) {
if (hasToBeEncoded(text, usedCharacters))
return encodeEncodedWord(text, usage, usedCharacters);
else
return text;
} | [
"public",
"static",
"String",
"encodeIfNecessary",
"(",
"String",
"text",
",",
"Usage",
"usage",
",",
"int",
"usedCharacters",
")",
"{",
"if",
"(",
"hasToBeEncoded",
"(",
"text",
",",
"usedCharacters",
")",
")",
"return",
"encodeEncodedWord",
"(",
"text",
",",... | Shortcut method that encodes the specified text into an encoded-word if the
text has to be encoded.
@param text
text to encode.
@param usage
whether the encoded-word is to be used to replace a text token or
a word entity (see RFC 822).
@param usedCharacters
number of characters already used up (
<code>0 <= usedCharact... | [
"Shortcut",
"method",
"that",
"encodes",
"the",
"specified",
"text",
"into",
"an",
"encoded",
"-",
"word",
"if",
"the",
"text",
"has",
"to",
"be",
"encoded",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L190-L195 |
101,464 | beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.encodeEncodedWord | public static String encodeEncodedWord(String text, Usage usage, int usedCharacters,
Charset charset, Encoding encoding) {
if (text == null)
throw new IllegalArgumentException();
if (usedCharacters < 0 || usedCharacters > MAX_USED_CHARACTERS)
throw new IllegalArgumentException();
if (charset == null)
... | java | public static String encodeEncodedWord(String text, Usage usage, int usedCharacters,
Charset charset, Encoding encoding) {
if (text == null)
throw new IllegalArgumentException();
if (usedCharacters < 0 || usedCharacters > MAX_USED_CHARACTERS)
throw new IllegalArgumentException();
if (charset == null)
... | [
"public",
"static",
"String",
"encodeEncodedWord",
"(",
"String",
"text",
",",
"Usage",
"usage",
",",
"int",
"usedCharacters",
",",
"Charset",
"charset",
",",
"Encoding",
"encoding",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"throw",
"new",
"IllegalArg... | Encodes the specified text into an encoded word or a sequence of encoded
words separated by space. The text is separated into a sequence of encoded
words if it does not fit in a single one.
@param text
text to encode.
@param usage
whether the encoded-word is to be used to replace a text token or
a word entity (see RFC... | [
"Encodes",
"the",
"specified",
"text",
"into",
"an",
"encoded",
"word",
"or",
"a",
"sequence",
"of",
"encoded",
"words",
"separated",
"by",
"space",
".",
"The",
"text",
"is",
"separated",
"into",
"a",
"sequence",
"of",
"encoded",
"words",
"if",
"it",
"does... | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L317-L345 |
101,465 | beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.encodeB | public static String encodeB(byte[] bytes) {
StringBuilder sb = new StringBuilder();
int idx = 0;
final int end = bytes.length;
for (; idx < end - 2; idx += 3) {
int data = (bytes[idx] & 0xff) << 16 | (bytes[idx + 1] & 0xff) << 8 | bytes[idx + 2] & 0xff;
sb.append((char) BASE64_TABLE[data >> 18 & 0x3f]);... | java | public static String encodeB(byte[] bytes) {
StringBuilder sb = new StringBuilder();
int idx = 0;
final int end = bytes.length;
for (; idx < end - 2; idx += 3) {
int data = (bytes[idx] & 0xff) << 16 | (bytes[idx + 1] & 0xff) << 8 | bytes[idx + 2] & 0xff;
sb.append((char) BASE64_TABLE[data >> 18 & 0x3f]);... | [
"public",
"static",
"String",
"encodeB",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"idx",
"=",
"0",
";",
"final",
"int",
"end",
"=",
"bytes",
".",
"length",
";",
"for",
"(",
... | Encodes the specified byte array using the B encoding defined in RFC 2047.
@param bytes
byte array to encode.
@return encoded string. | [
"Encodes",
"the",
"specified",
"byte",
"array",
"using",
"the",
"B",
"encoding",
"defined",
"in",
"RFC",
"2047",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L354-L383 |
101,466 | beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.encodeQ | public static String encodeQ(byte[] bytes, Usage usage) {
BitSet qChars = usage == Usage.TEXT_TOKEN ? Q_REGULAR_CHARS : Q_RESTRICTED_CHARS;
StringBuilder sb = new StringBuilder();
final int end = bytes.length;
for (int idx = 0; idx < end; idx++) {
int v = bytes[idx] & 0xff;
if (v == 32) {
sb.append(... | java | public static String encodeQ(byte[] bytes, Usage usage) {
BitSet qChars = usage == Usage.TEXT_TOKEN ? Q_REGULAR_CHARS : Q_RESTRICTED_CHARS;
StringBuilder sb = new StringBuilder();
final int end = bytes.length;
for (int idx = 0; idx < end; idx++) {
int v = bytes[idx] & 0xff;
if (v == 32) {
sb.append(... | [
"public",
"static",
"String",
"encodeQ",
"(",
"byte",
"[",
"]",
"bytes",
",",
"Usage",
"usage",
")",
"{",
"BitSet",
"qChars",
"=",
"usage",
"==",
"Usage",
".",
"TEXT_TOKEN",
"?",
"Q_REGULAR_CHARS",
":",
"Q_RESTRICTED_CHARS",
";",
"StringBuilder",
"sb",
"=",
... | Encodes the specified byte array using the Q encoding defined in RFC 2047.
@param bytes
byte array to encode.
@param usage
whether the encoded-word is to be used to replace a text token or
a word entity (see RFC 822).
@return encoded string. | [
"Encodes",
"the",
"specified",
"byte",
"array",
"using",
"the",
"Q",
"encoding",
"defined",
"in",
"RFC",
"2047",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L395-L415 |
101,467 | beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.isToken | public static boolean isToken(String str) {
// token := 1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>
// tspecials := "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "\" /
// <"> / "/" / "[" / "]" / "?" / "="
// CTL := 0.- 31., 127.
final int length = str.length();
if (length == 0)
return fal... | java | public static boolean isToken(String str) {
// token := 1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>
// tspecials := "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "\" /
// <"> / "/" / "[" / "]" / "?" / "="
// CTL := 0.- 31., 127.
final int length = str.length();
if (length == 0)
return fal... | [
"public",
"static",
"boolean",
"isToken",
"(",
"String",
"str",
")",
"{",
"// token := 1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>",
"// tspecials := \"(\" / \")\" / \"<\" / \">\" / \"@\" / \",\" / \";\" / \":\" / \"\\\" /",
"// <\"> / \"/\" / \"[\" / \"]\" / \"?\" / \"=\"",
"//... | Tests whether the specified string is a token as defined in RFC 2045
section 5.1.
@param str
string to test.
@return <code>true</code> if the specified string is a RFC 2045 token,
<code>false</code> otherwise. | [
"Tests",
"whether",
"the",
"specified",
"string",
"is",
"a",
"token",
"as",
"defined",
"in",
"RFC",
"2045",
"section",
"5",
".",
"1",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L426-L443 |
101,468 | beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.isDotAtomText | private static boolean isDotAtomText(String str) {
// dot-atom-text = 1*atext *("." 1*atext)
// atext = ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&" / "'" / "*" /
// "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" / "~"
char prev = '.';
final int length = str.length();
if (length == 0)
r... | java | private static boolean isDotAtomText(String str) {
// dot-atom-text = 1*atext *("." 1*atext)
// atext = ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&" / "'" / "*" /
// "+" / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}" / "~"
char prev = '.';
final int length = str.length();
if (length == 0)
r... | [
"private",
"static",
"boolean",
"isDotAtomText",
"(",
"String",
"str",
")",
"{",
"// dot-atom-text = 1*atext *(\".\" 1*atext)",
"// atext = ALPHA / DIGIT / \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\" /",
"// \"+\" / \"-\" / \"/\" / \"=\" / \"?\" / \"^\" / \"_\" / \"`\" / \"{\" / \"|\... | RFC 5322 section 3.2.3 | [
"RFC",
"5322",
"section",
"3",
".",
"2",
".",
"3"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L464-L490 |
101,469 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.setOptions | public Resty setOptions(Option... someOptions) {
options = (someOptions == null) ? new Option[0] : someOptions;
for (Option o : options) {
o.init(this);
}
return this;
} | java | public Resty setOptions(Option... someOptions) {
options = (someOptions == null) ? new Option[0] : someOptions;
for (Option o : options) {
o.init(this);
}
return this;
} | [
"public",
"Resty",
"setOptions",
"(",
"Option",
"...",
"someOptions",
")",
"{",
"options",
"=",
"(",
"someOptions",
"==",
"null",
")",
"?",
"new",
"Option",
"[",
"0",
"]",
":",
"someOptions",
";",
"for",
"(",
"Option",
"o",
":",
"options",
")",
"{",
... | Set options if you missed your opportunity in the c'tor or if you want to change the options.
@param someOptions new set of options
@return | [
"Set",
"options",
"if",
"you",
"missed",
"your",
"opportunity",
"in",
"the",
"c",
"tor",
"or",
"if",
"you",
"want",
"to",
"change",
"the",
"options",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L116-L122 |
101,470 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.authenticate | public void authenticate(URI aSite, String aLogin, char[] aPwd) {
rath.addSite(aSite, aLogin, aPwd);
} | java | public void authenticate(URI aSite, String aLogin, char[] aPwd) {
rath.addSite(aSite, aLogin, aPwd);
} | [
"public",
"void",
"authenticate",
"(",
"URI",
"aSite",
",",
"String",
"aLogin",
",",
"char",
"[",
"]",
"aPwd",
")",
"{",
"rath",
".",
"addSite",
"(",
"aSite",
",",
"aLogin",
",",
"aPwd",
")",
";",
"}"
] | Register this root URI for authentication. Whenever a URL is requested that starts with this root, the credentials given are used for HTTP AUTH. Note that currently authentication information is
shared across all Resty instances. This is due to the shortcomings of the java.net authentication mechanism. This might chang... | [
"Register",
"this",
"root",
"URI",
"for",
"authentication",
".",
"Whenever",
"a",
"URL",
"is",
"requested",
"that",
"starts",
"with",
"this",
"root",
"the",
"credentials",
"given",
"are",
"used",
"for",
"HTTP",
"AUTH",
".",
"Note",
"that",
"currently",
"auth... | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L136-L138 |
101,471 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.authenticateForRealm | public void authenticateForRealm(String realm, String aLogin, char[] charArray) {
rath.addRealm(realm, aLogin, charArray);
} | java | public void authenticateForRealm(String realm, String aLogin, char[] charArray) {
rath.addRealm(realm, aLogin, charArray);
} | [
"public",
"void",
"authenticateForRealm",
"(",
"String",
"realm",
",",
"String",
"aLogin",
",",
"char",
"[",
"]",
"charArray",
")",
"{",
"rath",
".",
"addRealm",
"(",
"realm",
",",
"aLogin",
",",
"charArray",
")",
";",
"}"
] | Register a login password for the realm returned by the authorization challenge.
Use this method instead of authenticate in case the URL is not made available to the java.net.Authenticator class
@param realm the realm (see rfc2617, section 1.2)
@param aLogin
@param charArray | [
"Register",
"a",
"login",
"password",
"for",
"the",
"realm",
"returned",
"by",
"the",
"authorization",
"challenge",
".",
"Use",
"this",
"method",
"instead",
"of",
"authenticate",
"in",
"case",
"the",
"URL",
"is",
"not",
"made",
"available",
"to",
"the",
"jav... | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L160-L162 |
101,472 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.json | public JSONResource json(URI anUri, AbstractContent requestContent) throws IOException {
return doPOSTOrPUT(anUri, requestContent, createJSONResource());
} | java | public JSONResource json(URI anUri, AbstractContent requestContent) throws IOException {
return doPOSTOrPUT(anUri, requestContent, createJSONResource());
} | [
"public",
"JSONResource",
"json",
"(",
"URI",
"anUri",
",",
"AbstractContent",
"requestContent",
")",
"throws",
"IOException",
"{",
"return",
"doPOSTOrPUT",
"(",
"anUri",
",",
"requestContent",
",",
"createJSONResource",
"(",
")",
")",
";",
"}"
] | POST to a URI and parse the result as JSON
@param anUri
the URI to visit
@param requestContent
the content to POST to the URI
@return
@throws IOException
if uri is wrong or no connection could be made or for 10 zillion other reasons | [
"POST",
"to",
"a",
"URI",
"and",
"parse",
"the",
"result",
"as",
"JSON"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L219-L221 |
101,473 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.xml | public XMLResource xml(URI anUri, AbstractContent requestContent) throws IOException {
return doPOSTOrPUT(anUri, requestContent, createXMLResource());
} | java | public XMLResource xml(URI anUri, AbstractContent requestContent) throws IOException {
return doPOSTOrPUT(anUri, requestContent, createXMLResource());
} | [
"public",
"XMLResource",
"xml",
"(",
"URI",
"anUri",
",",
"AbstractContent",
"requestContent",
")",
"throws",
"IOException",
"{",
"return",
"doPOSTOrPUT",
"(",
"anUri",
",",
"requestContent",
",",
"createXMLResource",
"(",
")",
")",
";",
"}"
] | POST to a URI and parse the result as XML
@param anUri
the URI to visit
@param requestContent
the content to POST to the URI
@return
@throws IOException
if uri is wrong or no connection could be made or for 10 zillion other reasons | [
"POST",
"to",
"a",
"URI",
"and",
"parse",
"the",
"result",
"as",
"XML"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L322-L324 |
101,474 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.addAdditionalHeaders | protected void addAdditionalHeaders(URLConnection con) {
for (Map.Entry<String, String> header : getAdditionalHeaders().entrySet()) {
con.addRequestProperty(header.getKey(), header.getValue());
}
} | java | protected void addAdditionalHeaders(URLConnection con) {
for (Map.Entry<String, String> header : getAdditionalHeaders().entrySet()) {
con.addRequestProperty(header.getKey(), header.getValue());
}
} | [
"protected",
"void",
"addAdditionalHeaders",
"(",
"URLConnection",
"con",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"header",
":",
"getAdditionalHeaders",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"con",
".",
"add... | Add all headers that have been set with the alwaysSend call. | [
"Add",
"all",
"headers",
"that",
"have",
"been",
"set",
"with",
"the",
"alwaysSend",
"call",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L405-L409 |
101,475 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.fillResourceFromURL | protected <T extends AbstractResource> T fillResourceFromURL(URLConnection con, T resource) throws IOException {
resource.fill(con);
resource.getAdditionalHeaders().putAll(getAdditionalHeaders()); // carry over additional headers TODO don't do it if there are no additional headers
return resource;
} | java | protected <T extends AbstractResource> T fillResourceFromURL(URLConnection con, T resource) throws IOException {
resource.fill(con);
resource.getAdditionalHeaders().putAll(getAdditionalHeaders()); // carry over additional headers TODO don't do it if there are no additional headers
return resource;
} | [
"protected",
"<",
"T",
"extends",
"AbstractResource",
">",
"T",
"fillResourceFromURL",
"(",
"URLConnection",
"con",
",",
"T",
"resource",
")",
"throws",
"IOException",
"{",
"resource",
".",
"fill",
"(",
"con",
")",
";",
"resource",
".",
"getAdditionalHeaders",
... | Get the content from the URLConnection, create a Resource representing the content and carry over some metadata like HTTP Result and location header.
@param <T extends AbstractResource> the resource that will be created and filled
@param con
the URLConnection used to get the data
@param resourceClass
the resource clas... | [
"Get",
"the",
"content",
"from",
"the",
"URLConnection",
"create",
"a",
"Resource",
"representing",
"the",
"content",
"and",
"carry",
"over",
"some",
"metadata",
"like",
"HTTP",
"Result",
"and",
"location",
"header",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L428-L432 |
101,476 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.content | public static Content content(JSONObject someJson) {
Content c = null;
try {
c = new Content("application/json; charset=UTF-8", someJson.toString().getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */
}
return c;
} | java | public static Content content(JSONObject someJson) {
Content c = null;
try {
c = new Content("application/json; charset=UTF-8", someJson.toString().getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */
}
return c;
} | [
"public",
"static",
"Content",
"content",
"(",
"JSONObject",
"someJson",
")",
"{",
"Content",
"c",
"=",
"null",
";",
"try",
"{",
"c",
"=",
"new",
"Content",
"(",
"\"application/json; charset=UTF-8\"",
",",
"someJson",
".",
"toString",
"(",
")",
".",
"getByte... | Create a content object from a JSON object. Use this to POST the content to a URL.
@param someJson
the JSON object to use
@return the content to send | [
"Create",
"a",
"content",
"object",
"from",
"a",
"JSON",
"object",
".",
"Use",
"this",
"to",
"POST",
"the",
"content",
"to",
"a",
"URL",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L469-L476 |
101,477 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.content | public static Content content(String somePlainText) {
Content c = null;
try {
c = new Content("text/plain; charset=UTF-8", somePlainText.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */
}
return c;
} | java | public static Content content(String somePlainText) {
Content c = null;
try {
c = new Content("text/plain; charset=UTF-8", somePlainText.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) { /* UTF-8 is never unsupported */
}
return c;
} | [
"public",
"static",
"Content",
"content",
"(",
"String",
"somePlainText",
")",
"{",
"Content",
"c",
"=",
"null",
";",
"try",
"{",
"c",
"=",
"new",
"Content",
"(",
"\"text/plain; charset=UTF-8\"",
",",
"somePlainText",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
... | Create a content object from plain text. Use this to POST the content to a URL.
@param somePlainText
the plain text to send
@return the content to send | [
"Create",
"a",
"content",
"object",
"from",
"plain",
"text",
".",
"Use",
"this",
"to",
"POST",
"the",
"content",
"to",
"a",
"URL",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L501-L508 |
101,478 | beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.enc | public static String enc(String unencodedString) {
try {
return URLEncoder.encode(unencodedString, "UTF-8");
} catch (UnsupportedEncodingException e) {
} // UTF-8 is never unsupported
return null;
} | java | public static String enc(String unencodedString) {
try {
return URLEncoder.encode(unencodedString, "UTF-8");
} catch (UnsupportedEncodingException e) {
} // UTF-8 is never unsupported
return null;
} | [
"public",
"static",
"String",
"enc",
"(",
"String",
"unencodedString",
")",
"{",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"unencodedString",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"}",
"//... | Shortcut to URLEncoder.encode with UTF-8.
@param unencodedString
the string to encode
@return the URL encoded string, safe to be used in URLs | [
"Shortcut",
"to",
"URLEncoder",
".",
"encode",
"with",
"UTF",
"-",
"8",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L589-L595 |
101,479 | beders/Resty | src/main/java/us/monoid/web/XMLResource.java | XMLResource.doc | public Document doc() throws IOException {
// if the stream has already been read, use the text format
InputSource is;
if (document == null) {
if (text == null) {
is = new InputSource(inputStream);
is.setEncoding(getCharSet().name());
} else {
is = new InputSource(new StringReader(text));
}
... | java | public Document doc() throws IOException {
// if the stream has already been read, use the text format
InputSource is;
if (document == null) {
if (text == null) {
is = new InputSource(inputStream);
is.setEncoding(getCharSet().name());
} else {
is = new InputSource(new StringReader(text));
}
... | [
"public",
"Document",
"doc",
"(",
")",
"throws",
"IOException",
"{",
"// if the stream has already been read, use the text format",
"InputSource",
"is",
";",
"if",
"(",
"document",
"==",
"null",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"is",
"=",
"... | Return the DOM of the XML resource.
@return
@throws IOException | [
"Return",
"the",
"DOM",
"of",
"the",
"XML",
"resource",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/XMLResource.java#L39-L59 |
101,480 | beders/Resty | src/main/java/us/monoid/web/XMLResource.java | XMLResource.json | public JSONResource json(XPathQuery path) throws Exception {
String uri = path.eval(this, String.class);
return json(uri);
} | java | public JSONResource json(XPathQuery path) throws Exception {
String uri = path.eval(this, String.class);
return json(uri);
} | [
"public",
"JSONResource",
"json",
"(",
"XPathQuery",
"path",
")",
"throws",
"Exception",
"{",
"String",
"uri",
"=",
"path",
".",
"eval",
"(",
"this",
",",
"String",
".",
"class",
")",
";",
"return",
"json",
"(",
"uri",
")",
";",
"}"
] | Execute the given path query on the XML, GET the returned URI expecting JSON as content
@param path path to the URI to follow, must be a String QName result
@return a new resource, as a result of getting it from the server in JSON format
@throws Exception
@throws JSONException | [
"Execute",
"the",
"given",
"path",
"query",
"on",
"the",
"XML",
"GET",
"the",
"returned",
"URI",
"expecting",
"JSON",
"as",
"content"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/XMLResource.java#L68-L71 |
101,481 | beders/Resty | src/main/java/us/monoid/web/XMLResource.java | XMLResource.xml | public XMLResource xml(XPathQuery path, Content aContent) throws Exception {
String uri = path.eval(this, String.class);
return xml(uri, aContent);
} | java | public XMLResource xml(XPathQuery path, Content aContent) throws Exception {
String uri = path.eval(this, String.class);
return xml(uri, aContent);
} | [
"public",
"XMLResource",
"xml",
"(",
"XPathQuery",
"path",
",",
"Content",
"aContent",
")",
"throws",
"Exception",
"{",
"String",
"uri",
"=",
"path",
".",
"eval",
"(",
"this",
",",
"String",
".",
"class",
")",
";",
"return",
"xml",
"(",
"uri",
",",
"aC... | Execute the given path query on the XML, POST the returned URI expecting XML
@param path path to the URI to follow, must be a String QName result
@param aContent the content to POST
@return a new resource, as a result of getting it from the server in text format
@throws Exception | [
"Execute",
"the",
"given",
"path",
"query",
"on",
"the",
"XML",
"POST",
"the",
"returned",
"URI",
"expecting",
"XML"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/XMLResource.java#L127-L130 |
101,482 | beders/Resty | src/main/java/us/monoid/web/XMLResource.java | XMLResource.get | public NodeList get(String xPath) throws Exception {
XPathQuery xp = new XPathQuery(xPath);
return xp.eval(this);
} | java | public NodeList get(String xPath) throws Exception {
XPathQuery xp = new XPathQuery(xPath);
return xp.eval(this);
} | [
"public",
"NodeList",
"get",
"(",
"String",
"xPath",
")",
"throws",
"Exception",
"{",
"XPathQuery",
"xp",
"=",
"new",
"XPathQuery",
"(",
"xPath",
")",
";",
"return",
"xp",
".",
"eval",
"(",
"this",
")",
";",
"}"
] | Access the XML evaluating an XPath on it, returning the resulting NodeList.
@throws Exception | [
"Access",
"the",
"XML",
"evaluating",
"an",
"XPath",
"on",
"it",
"returning",
"the",
"resulting",
"NodeList",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/XMLResource.java#L135-L138 |
101,483 | beders/Resty | src/main/java/us/monoid/web/XMLResource.java | XMLResource.get | public <T> T get(String xPath, Class<T> returnType) throws Exception {
XPathQuery xp = new XPathQuery(xPath);
return xp.eval(this, returnType);
} | java | public <T> T get(String xPath, Class<T> returnType) throws Exception {
XPathQuery xp = new XPathQuery(xPath);
return xp.eval(this, returnType);
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"xPath",
",",
"Class",
"<",
"T",
">",
"returnType",
")",
"throws",
"Exception",
"{",
"XPathQuery",
"xp",
"=",
"new",
"XPathQuery",
"(",
"xPath",
")",
";",
"return",
"xp",
".",
"eval",
"(",
"this",
... | Access the XML evaluating an XPath on it, returning the resulting Object of the desired type
Supported types are NodeList, String, Boolean, Double, Node.
@throws Exception | [
"Access",
"the",
"XML",
"evaluating",
"an",
"XPath",
"on",
"it",
"returning",
"the",
"resulting",
"Object",
"of",
"the",
"desired",
"type",
"Supported",
"types",
"are",
"NodeList",
"String",
"Boolean",
"Double",
"Node",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/XMLResource.java#L143-L146 |
101,484 | beders/Resty | src/main/java/us/monoid/web/auth/RestyAuthenticator.java | RestyAuthenticator.addSite | public void addSite(URI aRootUrl, String login, char[] pwd) {
String rootUri = aRootUrl.normalize().toString();
boolean replaced = false;
// check if we already have a login/password for the root uri
for (Site site : sites) {
if (site.root.equals(rootUri)) { // TODO synchronisation
site.login = login;
... | java | public void addSite(URI aRootUrl, String login, char[] pwd) {
String rootUri = aRootUrl.normalize().toString();
boolean replaced = false;
// check if we already have a login/password for the root uri
for (Site site : sites) {
if (site.root.equals(rootUri)) { // TODO synchronisation
site.login = login;
... | [
"public",
"void",
"addSite",
"(",
"URI",
"aRootUrl",
",",
"String",
"login",
",",
"char",
"[",
"]",
"pwd",
")",
"{",
"String",
"rootUri",
"=",
"aRootUrl",
".",
"normalize",
"(",
")",
".",
"toString",
"(",
")",
";",
"boolean",
"replaced",
"=",
"false",
... | Add or replace an authentication for a root URL aka site.
@param aRootUrl
@param login
@param pwd | [
"Add",
"or",
"replace",
"an",
"authentication",
"for",
"a",
"root",
"URL",
"aka",
"site",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/auth/RestyAuthenticator.java#L60-L79 |
101,485 | beders/Resty | src/main/java/us/monoid/web/AbstractResource.java | AbstractResource.status | public boolean status(int responseCode) {
if (urlConnection instanceof HttpURLConnection) {
HttpURLConnection http = (HttpURLConnection) urlConnection;
try {
return http.getResponseCode() == responseCode;
} catch (IOException e) {
e.printStackTrace();
return false;
}
} else
return false;
... | java | public boolean status(int responseCode) {
if (urlConnection instanceof HttpURLConnection) {
HttpURLConnection http = (HttpURLConnection) urlConnection;
try {
return http.getResponseCode() == responseCode;
} catch (IOException e) {
e.printStackTrace();
return false;
}
} else
return false;
... | [
"public",
"boolean",
"status",
"(",
"int",
"responseCode",
")",
"{",
"if",
"(",
"urlConnection",
"instanceof",
"HttpURLConnection",
")",
"{",
"HttpURLConnection",
"http",
"=",
"(",
"HttpURLConnection",
")",
"urlConnection",
";",
"try",
"{",
"return",
"http",
"."... | Check if the URLConnection has returned the specified responseCode
@param responseCode
@return | [
"Check",
"if",
"the",
"URLConnection",
"has",
"returned",
"the",
"specified",
"responseCode"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/AbstractResource.java#L97-L108 |
101,486 | beders/Resty | src/main/java/us/monoid/web/AbstractResource.java | AbstractResource.location | public URI location() {
String loc = http().getHeaderField("Location");
if (loc != null) {
return URI.create(loc);
}
return null;
} | java | public URI location() {
String loc = http().getHeaderField("Location");
if (loc != null) {
return URI.create(loc);
}
return null;
} | [
"public",
"URI",
"location",
"(",
")",
"{",
"String",
"loc",
"=",
"http",
"(",
")",
".",
"getHeaderField",
"(",
"\"Location\"",
")",
";",
"if",
"(",
"loc",
"!=",
"null",
")",
"{",
"return",
"URI",
".",
"create",
"(",
"loc",
")",
";",
"}",
"return",... | Get the location header as URI. Returns null if there is no location header. | [
"Get",
"the",
"location",
"header",
"as",
"URI",
".",
"Returns",
"null",
"if",
"there",
"is",
"no",
"location",
"header",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/AbstractResource.java#L114-L120 |
101,487 | beders/Resty | src/main/java/us/monoid/web/AbstractResource.java | AbstractResource.printResponseHeaders | public String printResponseHeaders() {
StringBuilder sb = new StringBuilder();
HttpURLConnection http = http();
if (http != null) {
Map<String, List<String>> header = http.getHeaderFields();
for (String key : header.keySet()) {
for (String val : header.get(key)) {
sb.append(key).append(": ").append... | java | public String printResponseHeaders() {
StringBuilder sb = new StringBuilder();
HttpURLConnection http = http();
if (http != null) {
Map<String, List<String>> header = http.getHeaderFields();
for (String key : header.keySet()) {
for (String val : header.get(key)) {
sb.append(key).append(": ").append... | [
"public",
"String",
"printResponseHeaders",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"HttpURLConnection",
"http",
"=",
"http",
"(",
")",
";",
"if",
"(",
"http",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
... | Print out the response headers for this resource.
@return | [
"Print",
"out",
"the",
"response",
"headers",
"for",
"this",
"resource",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/AbstractResource.java#L126-L138 |
101,488 | beders/Resty | src/main/java/us/monoid/web/BinaryResource.java | BinaryResource.save | public File save(File aFileName) throws IOException {
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(aFileName), 1024);
byte[] buffer = new byte[1024];
int len = -1;
while ((len = inputStream.read(buffer)) != -1) {
bos.write(buffer, 0, len);
}
bos.close();
inputStream.close();... | java | public File save(File aFileName) throws IOException {
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(aFileName), 1024);
byte[] buffer = new byte[1024];
int len = -1;
while ((len = inputStream.read(buffer)) != -1) {
bos.write(buffer, 0, len);
}
bos.close();
inputStream.close();... | [
"public",
"File",
"save",
"(",
"File",
"aFileName",
")",
"throws",
"IOException",
"{",
"BufferedOutputStream",
"bos",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"aFileName",
")",
",",
"1024",
")",
";",
"byte",
"[",
"]",
"buffer",
... | Save the contents of the resource to a file.
This reads the data from the stream and stores it into the given file.
Depending on the resource the data might or might not be available afterwards.
@param aFileName file to save the data in
@return the file the content was stored at
@throws IOException | [
"Save",
"the",
"contents",
"of",
"the",
"resource",
"to",
"a",
"file",
".",
"This",
"reads",
"the",
"data",
"from",
"the",
"stream",
"and",
"stores",
"it",
"into",
"the",
"given",
"file",
".",
"Depending",
"on",
"the",
"resource",
"the",
"data",
"might",... | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/BinaryResource.java#L39-L49 |
101,489 | beders/Resty | src/main/java/us/monoid/web/TextResource.java | TextResource.getCharSet | protected Charset getCharSet() {
String contentType = urlConnection.getContentType();
Charset charset = Charset.forName("iso-8859-1"); // default charset
if (contentType != null) {
// find out about the charset from the URLConnection
Matcher m = charsetPattern.matcher(contentType);
if (m.find()) {
St... | java | protected Charset getCharSet() {
String contentType = urlConnection.getContentType();
Charset charset = Charset.forName("iso-8859-1"); // default charset
if (contentType != null) {
// find out about the charset from the URLConnection
Matcher m = charsetPattern.matcher(contentType);
if (m.find()) {
St... | [
"protected",
"Charset",
"getCharSet",
"(",
")",
"{",
"String",
"contentType",
"=",
"urlConnection",
".",
"getContentType",
"(",
")",
";",
"Charset",
"charset",
"=",
"Charset",
".",
"forName",
"(",
"\"iso-8859-1\"",
")",
";",
"// default charset",
"if",
"(",
"c... | Get charset for this content type. Parses charset= attribute of content
type or falls back to a default
@return the charset to use when parsing this content | [
"Get",
"charset",
"for",
"this",
"content",
"type",
".",
"Parses",
"charset",
"=",
"attribute",
"of",
"content",
"type",
"or",
"falls",
"back",
"to",
"a",
"default"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/TextResource.java#L70-L88 |
101,490 | Bernardo-MG/dice-notation-java | src/main/java/com/bernardomg/tabletop/dice/visitor/DiceRollAccumulator.java | DiceRollAccumulator.getOperationText | private final String getOperationText(final BinaryOperation exp) {
final String text;
if (exp instanceof AdditionOperation) {
text = " + ";
} else if (exp instanceof SubtractionOperation) {
text = " - ";
} else if (exp instanceof MultiplicationOperation) {
... | java | private final String getOperationText(final BinaryOperation exp) {
final String text;
if (exp instanceof AdditionOperation) {
text = " + ";
} else if (exp instanceof SubtractionOperation) {
text = " - ";
} else if (exp instanceof MultiplicationOperation) {
... | [
"private",
"final",
"String",
"getOperationText",
"(",
"final",
"BinaryOperation",
"exp",
")",
"{",
"final",
"String",
"text",
";",
"if",
"(",
"exp",
"instanceof",
"AdditionOperation",
")",
"{",
"text",
"=",
"\" + \"",
";",
"}",
"else",
"if",
"(",
"exp",
"... | Returns the text value of the received operation.
@param exp
expression containing the operation
@return text value of the operation | [
"Returns",
"the",
"text",
"value",
"of",
"the",
"received",
"operation",
"."
] | fdba6a6eb7ff35740399f2694a58514a383dad88 | https://github.com/Bernardo-MG/dice-notation-java/blob/fdba6a6eb7ff35740399f2694a58514a383dad88/src/main/java/com/bernardomg/tabletop/dice/visitor/DiceRollAccumulator.java#L220-L237 |
101,491 | Bernardo-MG/dice-notation-java | src/main/java/com/bernardomg/tabletop/dice/interpreter/ConfigurableInterpreter.java | ConfigurableInterpreter.process | private final V process(final Iterable<DiceNotationExpression> nodes) {
accumulator.reset();
for (final DiceNotationExpression current : nodes) {
if (current instanceof BinaryOperation) {
accumulator.binaryOperation((BinaryOperation) current);
} else if (current... | java | private final V process(final Iterable<DiceNotationExpression> nodes) {
accumulator.reset();
for (final DiceNotationExpression current : nodes) {
if (current instanceof BinaryOperation) {
accumulator.binaryOperation((BinaryOperation) current);
} else if (current... | [
"private",
"final",
"V",
"process",
"(",
"final",
"Iterable",
"<",
"DiceNotationExpression",
">",
"nodes",
")",
"{",
"accumulator",
".",
"reset",
"(",
")",
";",
"for",
"(",
"final",
"DiceNotationExpression",
"current",
":",
"nodes",
")",
"{",
"if",
"(",
"c... | Returns the result from applying the accumulator in all the nodes.
@param nodes
flattened tree
@return the result from applying the accumulator | [
"Returns",
"the",
"result",
"from",
"applying",
"the",
"accumulator",
"in",
"all",
"the",
"nodes",
"."
] | fdba6a6eb7ff35740399f2694a58514a383dad88 | https://github.com/Bernardo-MG/dice-notation-java/blob/fdba6a6eb7ff35740399f2694a58514a383dad88/src/main/java/com/bernardomg/tabletop/dice/interpreter/ConfigurableInterpreter.java#L101-L119 |
101,492 | Bernardo-MG/dice-notation-java | src/main/java/com/bernardomg/tabletop/dice/parser/listener/DefaultDiceExpressionBuilder.java | DefaultDiceExpressionBuilder.getIntegerOperand | private final IntegerOperand getIntegerOperand(final String expression) {
final Integer value;
// Parses the value
value = Integer.parseInt(expression);
return new IntegerOperand(value);
} | java | private final IntegerOperand getIntegerOperand(final String expression) {
final Integer value;
// Parses the value
value = Integer.parseInt(expression);
return new IntegerOperand(value);
} | [
"private",
"final",
"IntegerOperand",
"getIntegerOperand",
"(",
"final",
"String",
"expression",
")",
"{",
"final",
"Integer",
"value",
";",
"// Parses the value",
"value",
"=",
"Integer",
".",
"parseInt",
"(",
"expression",
")",
";",
"return",
"new",
"IntegerOper... | Creates an integer operand from the parsed expression.
@param expression
parsed expression
@return an integer operand | [
"Creates",
"an",
"integer",
"operand",
"from",
"the",
"parsed",
"expression",
"."
] | fdba6a6eb7ff35740399f2694a58514a383dad88 | https://github.com/Bernardo-MG/dice-notation-java/blob/fdba6a6eb7ff35740399f2694a58514a383dad88/src/main/java/com/bernardomg/tabletop/dice/parser/listener/DefaultDiceExpressionBuilder.java#L280-L287 |
101,493 | Bernardo-MG/dice-notation-java | src/main/java/com/bernardomg/tabletop/dice/interpreter/PostorderTraverser.java | PostorderTraverser.unwrap | private final DiceNotationExpression
unwrap(final DiceNotationExpression expression) {
final DiceNotationExpression result;
if (expression instanceof ExpressionWrapper) {
result = ((ExpressionWrapper) expression).getWrappedExpression();
} else {
result = expr... | java | private final DiceNotationExpression
unwrap(final DiceNotationExpression expression) {
final DiceNotationExpression result;
if (expression instanceof ExpressionWrapper) {
result = ((ExpressionWrapper) expression).getWrappedExpression();
} else {
result = expr... | [
"private",
"final",
"DiceNotationExpression",
"unwrap",
"(",
"final",
"DiceNotationExpression",
"expression",
")",
"{",
"final",
"DiceNotationExpression",
"result",
";",
"if",
"(",
"expression",
"instanceof",
"ExpressionWrapper",
")",
"{",
"result",
"=",
"(",
"(",
"... | Removes the expression wrappers used to temporally prune the nodes.
@param expression
node to unwrap
@return unwrapped node | [
"Removes",
"the",
"expression",
"wrappers",
"used",
"to",
"temporally",
"prune",
"the",
"nodes",
"."
] | fdba6a6eb7ff35740399f2694a58514a383dad88 | https://github.com/Bernardo-MG/dice-notation-java/blob/fdba6a6eb7ff35740399f2694a58514a383dad88/src/main/java/com/bernardomg/tabletop/dice/interpreter/PostorderTraverser.java#L96-L107 |
101,494 | samuelcampos/usbdrivedetector | src/main/java/net/samuelcampos/usbdrivedetector/USBDeviceDetectorManager.java | USBDeviceDetectorManager.setPollingInterval | public synchronized void setPollingInterval(final long pollingInterval) {
if (pollingInterval <= 0) {
throw new IllegalArgumentException("'pollingInterval' must be greater than 0");
}
currentPollingInterval = pollingInterval;
if (listeners.size() > 0) {
stop();
... | java | public synchronized void setPollingInterval(final long pollingInterval) {
if (pollingInterval <= 0) {
throw new IllegalArgumentException("'pollingInterval' must be greater than 0");
}
currentPollingInterval = pollingInterval;
if (listeners.size() > 0) {
stop();
... | [
"public",
"synchronized",
"void",
"setPollingInterval",
"(",
"final",
"long",
"pollingInterval",
")",
"{",
"if",
"(",
"pollingInterval",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"'pollingInterval' must be greater than 0\"",
")",
";",
"}"... | Sets the polling interval
@param pollingInterval the interval in milliseconds to poll for the USB
storage devices on the system. | [
"Sets",
"the",
"polling",
"interval"
] | 2f45c2a189b0ea5ba29cd4d408032f48a6b5a3bc | https://github.com/samuelcampos/usbdrivedetector/blob/2f45c2a189b0ea5ba29cd4d408032f48a6b5a3bc/src/main/java/net/samuelcampos/usbdrivedetector/USBDeviceDetectorManager.java#L82-L93 |
101,495 | samuelcampos/usbdrivedetector | src/main/java/net/samuelcampos/usbdrivedetector/USBDeviceDetectorManager.java | USBDeviceDetectorManager.updateConnectedDevices | private void updateConnectedDevices(final List<USBStorageDevice> currentConnectedDevices) {
final List<USBStorageDevice> removedDevices = new ArrayList<>();
synchronized (this) {
final Iterator<USBStorageDevice> itConnectedDevices = connectedDevices.iterator();
while (itConnect... | java | private void updateConnectedDevices(final List<USBStorageDevice> currentConnectedDevices) {
final List<USBStorageDevice> removedDevices = new ArrayList<>();
synchronized (this) {
final Iterator<USBStorageDevice> itConnectedDevices = connectedDevices.iterator();
while (itConnect... | [
"private",
"void",
"updateConnectedDevices",
"(",
"final",
"List",
"<",
"USBStorageDevice",
">",
"currentConnectedDevices",
")",
"{",
"final",
"List",
"<",
"USBStorageDevice",
">",
"removedDevices",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"synchronized",
"("... | Updates the internal state of this manager and sends
@param currentConnectedDevices a list with the currently connected USB storage devices | [
"Updates",
"the",
"internal",
"state",
"of",
"this",
"manager",
"and",
"sends"
] | 2f45c2a189b0ea5ba29cd4d408032f48a6b5a3bc | https://github.com/samuelcampos/usbdrivedetector/blob/2f45c2a189b0ea5ba29cd4d408032f48a6b5a3bc/src/main/java/net/samuelcampos/usbdrivedetector/USBDeviceDetectorManager.java#L177-L203 |
101,496 | morfologik/morfologik-stemming | morfologik-speller/src/main/java/morfologik/speller/Speller.java | Speller.isMisspelled | public boolean isMisspelled(final String word) {
// dictionaries usually do not contain punctuation
String wordToCheck = word;
if (!dictionaryMetadata.getInputConversionPairs().isEmpty()) {
wordToCheck = DictionaryLookup.applyReplacements(word, dictionaryMetadata.getInputConversionPairs());
}... | java | public boolean isMisspelled(final String word) {
// dictionaries usually do not contain punctuation
String wordToCheck = word;
if (!dictionaryMetadata.getInputConversionPairs().isEmpty()) {
wordToCheck = DictionaryLookup.applyReplacements(word, dictionaryMetadata.getInputConversionPairs());
}... | [
"public",
"boolean",
"isMisspelled",
"(",
"final",
"String",
"word",
")",
"{",
"// dictionaries usually do not contain punctuation\r",
"String",
"wordToCheck",
"=",
"word",
";",
"if",
"(",
"!",
"dictionaryMetadata",
".",
"getInputConversionPairs",
"(",
")",
".",
"isEm... | Checks whether the word is misspelled, by performing a series of checks
according to properties of the dictionary.
If the flag <code>fsa.dict.speller.ignore-punctuation</code> is set, then
all non-alphabetic characters are considered to be correctly spelled.
If the flag <code>fsa.dict.speller.ignore-numbers</code> is... | [
"Checks",
"whether",
"the",
"word",
"is",
"misspelled",
"by",
"performing",
"a",
"series",
"of",
"checks",
"according",
"to",
"properties",
"of",
"the",
"dictionary",
"."
] | 9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e | https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L221-L238 |
101,497 | morfologik/morfologik-stemming | morfologik-speller/src/main/java/morfologik/speller/Speller.java | Speller.isInDictionary | public boolean isInDictionary(final CharSequence word) {
try {
byteBuffer = charSequenceToBytes(word);
} catch (UnmappableInputException e) {
return false;
}
// Try to find a partial match in the dictionary.
final MatchResult match = matcher.match(matchResult, byteBuffer.array()... | java | public boolean isInDictionary(final CharSequence word) {
try {
byteBuffer = charSequenceToBytes(word);
} catch (UnmappableInputException e) {
return false;
}
// Try to find a partial match in the dictionary.
final MatchResult match = matcher.match(matchResult, byteBuffer.array()... | [
"public",
"boolean",
"isInDictionary",
"(",
"final",
"CharSequence",
"word",
")",
"{",
"try",
"{",
"byteBuffer",
"=",
"charSequenceToBytes",
"(",
"word",
")",
";",
"}",
"catch",
"(",
"UnmappableInputException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"//... | Test whether the word is found in the dictionary.
@param word
the word to be tested
@return True if it is found. | [
"Test",
"whether",
"the",
"word",
"is",
"found",
"in",
"the",
"dictionary",
"."
] | 9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e | https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L251-L278 |
101,498 | morfologik/morfologik-stemming | morfologik-speller/src/main/java/morfologik/speller/Speller.java | Speller.getFrequency | public int getFrequency(final CharSequence word) {
if (!dictionaryMetadata.isFrequencyIncluded()) {
return 0;
}
final byte separator = dictionaryMetadata.getSeparator();
try {
byteBuffer = charSequenceToBytes(word);
} catch (UnmappableInputException e) {
return 0;
}
... | java | public int getFrequency(final CharSequence word) {
if (!dictionaryMetadata.isFrequencyIncluded()) {
return 0;
}
final byte separator = dictionaryMetadata.getSeparator();
try {
byteBuffer = charSequenceToBytes(word);
} catch (UnmappableInputException e) {
return 0;
}
... | [
"public",
"int",
"getFrequency",
"(",
"final",
"CharSequence",
"word",
")",
"{",
"if",
"(",
"!",
"dictionaryMetadata",
".",
"isFrequencyIncluded",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"final",
"byte",
"separator",
"=",
"dictionaryMetadata",
".",
"get... | Get the frequency value for a word form. It is taken from the first entry
with this word form.
@param word
the word to be tested
@return frequency value in range: 0..FREQ_RANGE-1 (0: less frequent). | [
"Get",
"the",
"frequency",
"value",
"for",
"a",
"word",
"form",
".",
"It",
"is",
"taken",
"from",
"the",
"first",
"entry",
"with",
"this",
"word",
"form",
"."
] | 9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e | https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L289-L316 |
101,499 | morfologik/morfologik-stemming | morfologik-speller/src/main/java/morfologik/speller/Speller.java | Speller.replaceRunOnWords | public List<String> replaceRunOnWords(final String original) {
final List<String> candidates = new ArrayList<String>();
String wordToCheck = original;
if (!dictionaryMetadata.getInputConversionPairs().isEmpty()) {
wordToCheck = DictionaryLookup.applyReplacements(original, dictionaryMetadata.getInp... | java | public List<String> replaceRunOnWords(final String original) {
final List<String> candidates = new ArrayList<String>();
String wordToCheck = original;
if (!dictionaryMetadata.getInputConversionPairs().isEmpty()) {
wordToCheck = DictionaryLookup.applyReplacements(original, dictionaryMetadata.getInp... | [
"public",
"List",
"<",
"String",
">",
"replaceRunOnWords",
"(",
"final",
"String",
"original",
")",
"{",
"final",
"List",
"<",
"String",
">",
"candidates",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"String",
"wordToCheck",
"=",
"original"... | Propose suggestions for misspelled run-on words. This algorithm is inspired
by spell.cc in s_fsa package by Jan Daciuk.
@param original
The original misspelled word.
@return The list of suggested pairs, as space-concatenated strings. | [
"Propose",
"suggestions",
"for",
"misspelled",
"run",
"-",
"on",
"words",
".",
"This",
"algorithm",
"is",
"inspired",
"by",
"spell",
".",
"cc",
"in",
"s_fsa",
"package",
"by",
"Jan",
"Daciuk",
"."
] | 9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e | https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-speller/src/main/java/morfologik/speller/Speller.java#L326-L347 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.