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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/FieldUtil.java | FieldUtil.determineAccessorPrefix | public static AccessorPrefix determineAccessorPrefix(@Nonnull final String methodName) {
Check.notEmpty(methodName, "methodName");
final Matcher m = PATTERN.matcher(methodName);
Check.stateIsTrue(m.find(), "passed method name '%s' is not applicable", methodName);
return new AccessorPrefix(m.group(1));
} | java | public static AccessorPrefix determineAccessorPrefix(@Nonnull final String methodName) {
Check.notEmpty(methodName, "methodName");
final Matcher m = PATTERN.matcher(methodName);
Check.stateIsTrue(m.find(), "passed method name '%s' is not applicable", methodName);
return new AccessorPrefix(m.group(1));
} | [
"public",
"static",
"AccessorPrefix",
"determineAccessorPrefix",
"(",
"@",
"Nonnull",
"final",
"String",
"methodName",
")",
"{",
"Check",
".",
"notEmpty",
"(",
"methodName",
",",
"\"methodName\"",
")",
";",
"final",
"Matcher",
"m",
"=",
"PATTERN",
".",
"matcher"... | Determines the prefix of an accessor method based on an accessor method name.
@param methodName
an accessor method name
@return the resulting prefix | [
"Determines",
"the",
"prefix",
"of",
"an",
"accessor",
"method",
"based",
"on",
"an",
"accessor",
"method",
"name",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/FieldUtil.java#L37-L42 | train |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/FieldUtil.java | FieldUtil.determineFieldName | public static String determineFieldName(@Nonnull final String methodName) {
Check.notEmpty(methodName, "methodName");
final Matcher m = PATTERN.matcher(methodName);
Check.stateIsTrue(m.find(), "passed method name '%s' is not applicable", methodName);
return m.group(2).substring(0, 1).toLowerCase() + m.group(2).... | java | public static String determineFieldName(@Nonnull final String methodName) {
Check.notEmpty(methodName, "methodName");
final Matcher m = PATTERN.matcher(methodName);
Check.stateIsTrue(m.find(), "passed method name '%s' is not applicable", methodName);
return m.group(2).substring(0, 1).toLowerCase() + m.group(2).... | [
"public",
"static",
"String",
"determineFieldName",
"(",
"@",
"Nonnull",
"final",
"String",
"methodName",
")",
"{",
"Check",
".",
"notEmpty",
"(",
"methodName",
",",
"\"methodName\"",
")",
";",
"final",
"Matcher",
"m",
"=",
"PATTERN",
".",
"matcher",
"(",
"m... | Determines the field name based on an accessor method name.
@param methodName
an accessor method name
@return the resulting field name | [
"Determines",
"the",
"field",
"name",
"based",
"on",
"an",
"accessor",
"method",
"name",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/FieldUtil.java#L51-L56 | train |
usc/wechat-mp-sdk | wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/JsonRtnUtil.java | JsonRtnUtil.parseJsonRtn | public static <T extends JsonRtn> T parseJsonRtn(String jsonRtn, Class<T> jsonRtnClazz) {
T rtn = JSONObject.parseObject(jsonRtn, jsonRtnClazz);
appendErrorHumanMsg(rtn);
return rtn;
} | java | public static <T extends JsonRtn> T parseJsonRtn(String jsonRtn, Class<T> jsonRtnClazz) {
T rtn = JSONObject.parseObject(jsonRtn, jsonRtnClazz);
appendErrorHumanMsg(rtn);
return rtn;
} | [
"public",
"static",
"<",
"T",
"extends",
"JsonRtn",
">",
"T",
"parseJsonRtn",
"(",
"String",
"jsonRtn",
",",
"Class",
"<",
"T",
">",
"jsonRtnClazz",
")",
"{",
"T",
"rtn",
"=",
"JSONObject",
".",
"parseObject",
"(",
"jsonRtn",
",",
"jsonRtnClazz",
")",
";... | parse json text to specified class
@param jsonRtn
@param jsonRtnClazz
@return | [
"parse",
"json",
"text",
"to",
"specified",
"class"
] | 39d9574a8e3ffa3b61f88b4bef534d93645a825f | https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/JsonRtnUtil.java#L33-L37 | train |
usc/wechat-mp-sdk | wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/JsonRtnUtil.java | JsonRtnUtil.appendErrorHumanMsg | private static JsonRtn appendErrorHumanMsg(JsonRtn jsonRtn) {
if (bundle == null || jsonRtn == null || StringUtils.isEmpty(jsonRtn.getErrCode())) {
return null;
}
try {
jsonRtn.setErrHumanMsg(bundle.getString(jsonRtn.getErrCode()));
return jsonRtn;
} ... | java | private static JsonRtn appendErrorHumanMsg(JsonRtn jsonRtn) {
if (bundle == null || jsonRtn == null || StringUtils.isEmpty(jsonRtn.getErrCode())) {
return null;
}
try {
jsonRtn.setErrHumanMsg(bundle.getString(jsonRtn.getErrCode()));
return jsonRtn;
} ... | [
"private",
"static",
"JsonRtn",
"appendErrorHumanMsg",
"(",
"JsonRtn",
"jsonRtn",
")",
"{",
"if",
"(",
"bundle",
"==",
"null",
"||",
"jsonRtn",
"==",
"null",
"||",
"StringUtils",
".",
"isEmpty",
"(",
"jsonRtn",
".",
"getErrCode",
"(",
")",
")",
")",
"{",
... | append human message to JsonRtn class
@param jsonRtn
@return | [
"append",
"human",
"message",
"to",
"JsonRtn",
"class"
] | 39d9574a8e3ffa3b61f88b4bef534d93645a825f | https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/JsonRtnUtil.java#L45-L56 | train |
usc/wechat-mp-sdk | wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/JsonRtnUtil.java | JsonRtnUtil.isSuccess | public static boolean isSuccess(JsonRtn jsonRtn) {
if (jsonRtn == null) {
return false;
}
String errCode = jsonRtn.getErrCode();
if (StringUtils.isEmpty(errCode) || StringUtils.equals(WECHAT_JSON_RTN_SUCCESS_CODE, errCode)) {
return true;
}
retur... | java | public static boolean isSuccess(JsonRtn jsonRtn) {
if (jsonRtn == null) {
return false;
}
String errCode = jsonRtn.getErrCode();
if (StringUtils.isEmpty(errCode) || StringUtils.equals(WECHAT_JSON_RTN_SUCCESS_CODE, errCode)) {
return true;
}
retur... | [
"public",
"static",
"boolean",
"isSuccess",
"(",
"JsonRtn",
"jsonRtn",
")",
"{",
"if",
"(",
"jsonRtn",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"String",
"errCode",
"=",
"jsonRtn",
".",
"getErrCode",
"(",
")",
";",
"if",
"(",
"StringUtils",
... | return request is success by JsonRtn object
@param jsonRtn
@return | [
"return",
"request",
"is",
"success",
"by",
"JsonRtn",
"object"
] | 39d9574a8e3ffa3b61f88b4bef534d93645a825f | https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/JsonRtnUtil.java#L64-L75 | train |
usc/wechat-mp-sdk | wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/XmlUtil.java | XmlUtil.unmarshal | public static Object unmarshal(String message, Class<?> childClass) {
try {
Class<?>[] reverseAndToArray = Iterables.toArray(Lists.reverse(getAllSuperTypes(childClass)), Class.class);
JAXBContext jaxbCtx = JAXBContext.newInstance(reverseAndToArray);
Unmarshaller unmarshaller ... | java | public static Object unmarshal(String message, Class<?> childClass) {
try {
Class<?>[] reverseAndToArray = Iterables.toArray(Lists.reverse(getAllSuperTypes(childClass)), Class.class);
JAXBContext jaxbCtx = JAXBContext.newInstance(reverseAndToArray);
Unmarshaller unmarshaller ... | [
"public",
"static",
"Object",
"unmarshal",
"(",
"String",
"message",
",",
"Class",
"<",
"?",
">",
"childClass",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"reverseAndToArray",
"=",
"Iterables",
".",
"toArray",
"(",
"Lists",
".",
"reverse",
... | xml -> object
@param message
@param childClass
@return | [
"xml",
"-",
">",
"object"
] | 39d9574a8e3ffa3b61f88b4bef534d93645a825f | https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/XmlUtil.java#L37-L48 | train |
usc/wechat-mp-sdk | wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/XmlUtil.java | XmlUtil.marshal | public static String marshal(Object object) {
if (object == null) {
return null;
}
try {
JAXBContext jaxbCtx = JAXBContext.newInstance(object.getClass());
Marshaller marshaller = jaxbCtx.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_... | java | public static String marshal(Object object) {
if (object == null) {
return null;
}
try {
JAXBContext jaxbCtx = JAXBContext.newInstance(object.getClass());
Marshaller marshaller = jaxbCtx.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_... | [
"public",
"static",
"String",
"marshal",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"JAXBContext",
"jaxbCtx",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"object",
".",
"getCla... | object -> xml
@param object
@param childClass | [
"object",
"-",
">",
"xml"
] | 39d9574a8e3ffa3b61f88b4bef534d93645a825f | https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-sdk/src/main/java/org/usc/wechat/mp/sdk/util/XmlUtil.java#L56-L75 | train |
ow2-chameleon/fuchsia | discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java | AbstractFileBasedDiscovery.parseFile | private Properties parseFile(File file) throws InvalidDeclarationFileException {
Properties properties = new Properties();
InputStream is = null;
try {
is = new FileInputStream(file);
properties.load(is);
} catch (Exception e) {
throw new InvalidDeclar... | java | private Properties parseFile(File file) throws InvalidDeclarationFileException {
Properties properties = new Properties();
InputStream is = null;
try {
is = new FileInputStream(file);
properties.load(is);
} catch (Exception e) {
throw new InvalidDeclar... | [
"private",
"Properties",
"parseFile",
"(",
"File",
"file",
")",
"throws",
"InvalidDeclarationFileException",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"new",
"FileInp... | Parse the given file to obtains a Properties object.
@param file
@return a properties object containing all the properties present in the file.
@throws InvalidDeclarationFileException | [
"Parse",
"the",
"given",
"file",
"to",
"obtains",
"a",
"Properties",
"object",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java#L84-L106 | train |
ow2-chameleon/fuchsia | discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java | AbstractFileBasedDiscovery.createAndRegisterDeclaration | private D createAndRegisterDeclaration(Map<String, Object> metadata) {
D declaration;
if (klass.equals(ImportDeclaration.class)) {
declaration = (D) ImportDeclarationBuilder.fromMetadata(metadata).build();
} else if (klass.equals(ExportDeclaration.class)) {
declaration = ... | java | private D createAndRegisterDeclaration(Map<String, Object> metadata) {
D declaration;
if (klass.equals(ImportDeclaration.class)) {
declaration = (D) ImportDeclarationBuilder.fromMetadata(metadata).build();
} else if (klass.equals(ExportDeclaration.class)) {
declaration = ... | [
"private",
"D",
"createAndRegisterDeclaration",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"metadata",
")",
"{",
"D",
"declaration",
";",
"if",
"(",
"klass",
".",
"equals",
"(",
"ImportDeclaration",
".",
"class",
")",
")",
"{",
"declaration",
"=",
"(",... | Create and register the declaration of class D with the given metadata.
@param metadata the metadata to create the declaration
@return the created declaration of class D | [
"Create",
"and",
"register",
"the",
"declaration",
"of",
"class",
"D",
"with",
"the",
"given",
"metadata",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java#L188-L199 | train |
ow2-chameleon/fuchsia | discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java | AbstractFileBasedDiscovery.start | void start(String monitoredDirectory, Long pollingTime) {
this.monitoredDirectory = monitoredDirectory;
String deployerKlassName;
if (klass.equals(ImportDeclaration.class)) {
deployerKlassName = ImporterDeployer.class.getName();
} else if (klass.equals(ExportDeclaration.class... | java | void start(String monitoredDirectory, Long pollingTime) {
this.monitoredDirectory = monitoredDirectory;
String deployerKlassName;
if (klass.equals(ImportDeclaration.class)) {
deployerKlassName = ImporterDeployer.class.getName();
} else if (klass.equals(ExportDeclaration.class... | [
"void",
"start",
"(",
"String",
"monitoredDirectory",
",",
"Long",
"pollingTime",
")",
"{",
"this",
".",
"monitoredDirectory",
"=",
"monitoredDirectory",
";",
"String",
"deployerKlassName",
";",
"if",
"(",
"klass",
".",
"equals",
"(",
"ImportDeclaration",
".",
"... | This method must be called on the start of the component. Initialize and start the directory monitor.
@param monitoredDirectory
@param pollingTime | [
"This",
"method",
"must",
"be",
"called",
"on",
"the",
"start",
"of",
"the",
"component",
".",
"Initialize",
"and",
"start",
"the",
"directory",
"monitor",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java#L225-L242 | train |
ow2-chameleon/fuchsia | discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java | AbstractFileBasedDiscovery.stop | void stop() {
try {
dm.stop(getBundleContext());
} catch (DirectoryMonitoringException e) {
LOG.error("Failed to stop " + DirectoryMonitor.class.getName() + " for the directory " + monitoredDirectory, e);
}
declarationsFiles.clear();
declarationRegistratio... | java | void stop() {
try {
dm.stop(getBundleContext());
} catch (DirectoryMonitoringException e) {
LOG.error("Failed to stop " + DirectoryMonitor.class.getName() + " for the directory " + monitoredDirectory, e);
}
declarationsFiles.clear();
declarationRegistratio... | [
"void",
"stop",
"(",
")",
"{",
"try",
"{",
"dm",
".",
"stop",
"(",
"getBundleContext",
"(",
")",
")",
";",
"}",
"catch",
"(",
"DirectoryMonitoringException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to stop \"",
"+",
"DirectoryMonitor",
".",
"c... | This method must be called on the stop of the component. Stop the directory monitor and unregister all the
declarations. | [
"This",
"method",
"must",
"be",
"called",
"on",
"the",
"stop",
"of",
"the",
"component",
".",
"Stop",
"the",
"directory",
"monitor",
"and",
"unregister",
"all",
"the",
"declarations",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java#L248-L256 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/features/BoundednessFeature.java | BoundednessFeature.calculateBoundedness | public static double calculateBoundedness(double D, int N, double timelag, double confRadius){
double r = confRadius;
double cov_area = a(N)*D*timelag;
double res = cov_area/(4*r*r);
return res;
} | java | public static double calculateBoundedness(double D, int N, double timelag, double confRadius){
double r = confRadius;
double cov_area = a(N)*D*timelag;
double res = cov_area/(4*r*r);
return res;
} | [
"public",
"static",
"double",
"calculateBoundedness",
"(",
"double",
"D",
",",
"int",
"N",
",",
"double",
"timelag",
",",
"double",
"confRadius",
")",
"{",
"double",
"r",
"=",
"confRadius",
";",
"double",
"cov_area",
"=",
"a",
"(",
"N",
")",
"*",
"D",
... | Calculates the Boundedness value to given confinement radius, diffusion coefficient, timlag and number of steps.
@param D diffusion coefficient
@param N Number of steps
@param timelag Timelag
@param confRadius Confinement radius
@return Boundedness value | [
"Calculates",
"the",
"Boundedness",
"value",
"to",
"given",
"confinement",
"radius",
"diffusion",
"coefficient",
"timlag",
"and",
"number",
"of",
"steps",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/features/BoundednessFeature.java#L36-L41 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/features/BoundednessFeature.java | BoundednessFeature.getRadiusToBoundedness | public static double getRadiusToBoundedness(double D, int N, double timelag, double B){
double cov_area = a(N)*D*timelag;
double radius = Math.sqrt(cov_area/(4*B));
return radius;
} | java | public static double getRadiusToBoundedness(double D, int N, double timelag, double B){
double cov_area = a(N)*D*timelag;
double radius = Math.sqrt(cov_area/(4*B));
return radius;
} | [
"public",
"static",
"double",
"getRadiusToBoundedness",
"(",
"double",
"D",
",",
"int",
"N",
",",
"double",
"timelag",
",",
"double",
"B",
")",
"{",
"double",
"cov_area",
"=",
"a",
"(",
"N",
")",
"*",
"D",
"*",
"timelag",
";",
"double",
"radius",
"=",
... | Calculates the radius to a given boundedness value
@param D Diffusion coefficient
@param N Number of steps
@param timelag Timelag
@param B Boundedeness
@return Confinement radius | [
"Calculates",
"the",
"radius",
"to",
"a",
"given",
"boundedness",
"value"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/features/BoundednessFeature.java#L51-L55 | train |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java | NumberInRange.checkByte | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static byte checkByte(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInByteRange(number)) {
throw new IllegalNumberRangeException(number.toString(), BYTE_MIN, BYTE_MAX);
}
return number.byteValue();
} | java | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static byte checkByte(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInByteRange(number)) {
throw new IllegalNumberRangeException(number.toString(), BYTE_MIN, BYTE_MAX);
}
return number.byteValue();
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNullArgumentException",
".",
"class",
")",
"public",
"static",
"byte",
"checkByte",
"(",
"@",
"Nonnull",
"final",
"Number",
"number",
")",
"{",
"Check",
".",
"notNull",
"(",
"number",
",",
"\"number\"",
")",... | Checks if a given number is in the range of a byte.
@param number
a number which should be in the range of a byte (positive or negative)
@see java.lang.Byte#MIN_VALUE
@see java.lang.Byte#MAX_VALUE
@return number as a byte (rounding might occur) | [
"Checks",
"if",
"a",
"given",
"number",
"is",
"in",
"the",
"range",
"of",
"a",
"byte",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java#L62-L71 | train |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java | NumberInRange.checkDouble | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static double checkDouble(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInDoubleRange(number)) {
throw new IllegalNumberRangeException(number.toString(), DOUBLE_MIN, DOUBLE_MAX);
}
return number.doubleValue();
... | java | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static double checkDouble(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInDoubleRange(number)) {
throw new IllegalNumberRangeException(number.toString(), DOUBLE_MIN, DOUBLE_MAX);
}
return number.doubleValue();
... | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNullArgumentException",
".",
"class",
")",
"public",
"static",
"double",
"checkDouble",
"(",
"@",
"Nonnull",
"final",
"Number",
"number",
")",
"{",
"Check",
".",
"notNull",
"(",
"number",
",",
"\"number\"",
... | Checks if a given number is in the range of a double.
@param number
a number which should be in the range of a double (positive or negative)
@see java.lang.Double#MIN_VALUE
@see java.lang.Double#MAX_VALUE
@return number as a double | [
"Checks",
"if",
"a",
"given",
"number",
"is",
"in",
"the",
"range",
"of",
"a",
"double",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java#L84-L93 | train |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java | NumberInRange.checkFloat | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static float checkFloat(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInFloatRange(number)) {
throw new IllegalNumberRangeException(number.toString(), FLOAT_MIN, FLOAT_MAX);
}
return number.floatValue();
} | java | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static float checkFloat(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInFloatRange(number)) {
throw new IllegalNumberRangeException(number.toString(), FLOAT_MIN, FLOAT_MAX);
}
return number.floatValue();
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNullArgumentException",
".",
"class",
")",
"public",
"static",
"float",
"checkFloat",
"(",
"@",
"Nonnull",
"final",
"Number",
"number",
")",
"{",
"Check",
".",
"notNull",
"(",
"number",
",",
"\"number\"",
")... | Checks if a given number is in the range of a float.
@param number
a number which should be in the range of a float (positive or negative)
@see java.lang.Float#MIN_VALUE
@see java.lang.Float#MAX_VALUE
@return number as a float | [
"Checks",
"if",
"a",
"given",
"number",
"is",
"in",
"the",
"range",
"of",
"a",
"float",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java#L106-L115 | train |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java | NumberInRange.checkInteger | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static int checkInteger(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInIntegerRange(number)) {
throw new IllegalNumberRangeException(number.toString(), INTEGER_MIN, INTEGER_MAX);
}
return number.intValue();
} | java | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static int checkInteger(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInIntegerRange(number)) {
throw new IllegalNumberRangeException(number.toString(), INTEGER_MIN, INTEGER_MAX);
}
return number.intValue();
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNullArgumentException",
".",
"class",
")",
"public",
"static",
"int",
"checkInteger",
"(",
"@",
"Nonnull",
"final",
"Number",
"number",
")",
"{",
"Check",
".",
"notNull",
"(",
"number",
",",
"\"number\"",
")... | Checks if a given number is in the range of an integer.
@param number
a number which should be in the range of an integer (positive or negative)
@see java.lang.Integer#MIN_VALUE
@see java.lang.Integer#MAX_VALUE
@return number as an integer (rounding might occur) | [
"Checks",
"if",
"a",
"given",
"number",
"is",
"in",
"the",
"range",
"of",
"an",
"integer",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java#L128-L137 | train |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java | NumberInRange.checkLong | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static int checkLong(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInLongRange(number)) {
throw new IllegalNumberRangeException(number.toString(), LONG_MIN, LONG_MAX);
}
return number.intValue();
} | java | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static int checkLong(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInLongRange(number)) {
throw new IllegalNumberRangeException(number.toString(), LONG_MIN, LONG_MAX);
}
return number.intValue();
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNullArgumentException",
".",
"class",
")",
"public",
"static",
"int",
"checkLong",
"(",
"@",
"Nonnull",
"final",
"Number",
"number",
")",
"{",
"Check",
".",
"notNull",
"(",
"number",
",",
"\"number\"",
")",
... | Checks if a given number is in the range of a long.
@param number
a number which should be in the range of a long (positive or negative)
@see java.lang.Long#MIN_VALUE
@see java.lang.Long#MAX_VALUE
@return number as a long (rounding might occur) | [
"Checks",
"if",
"a",
"given",
"number",
"is",
"in",
"the",
"range",
"of",
"a",
"long",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java#L150-L159 | train |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java | NumberInRange.checkShort | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static short checkShort(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInShortRange(number)) {
throw new IllegalNumberRangeException(number.toString(), SHORT_MIN, SHORT_MAX);
}
return number.shortValue();
} | java | @ArgumentsChecked
@Throws(IllegalNullArgumentException.class)
public static short checkShort(@Nonnull final Number number) {
Check.notNull(number, "number");
if (!isInShortRange(number)) {
throw new IllegalNumberRangeException(number.toString(), SHORT_MIN, SHORT_MAX);
}
return number.shortValue();
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNullArgumentException",
".",
"class",
")",
"public",
"static",
"short",
"checkShort",
"(",
"@",
"Nonnull",
"final",
"Number",
"number",
")",
"{",
"Check",
".",
"notNull",
"(",
"number",
",",
"\"number\"",
")... | Checks if a given number is in the range of a short.
@param number
a number which should be in the range of a short (positive or negative)
@see java.lang.Short#MIN_VALUE
@see java.lang.Short#MAX_VALUE
@return number as a short (rounding might occur) | [
"Checks",
"if",
"a",
"given",
"number",
"is",
"in",
"the",
"range",
"of",
"a",
"short",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/NumberInRange.java#L172-L181 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/simulation/AnomalousDiffusionScene.java | AnomalousDiffusionScene.estimateExcludedVolumeFraction | public double estimateExcludedVolumeFraction(){
//Calculate volume/area of the of the scene without obstacles
if(recalculateVolumeFraction){
CentralRandomNumberGenerator r = CentralRandomNumberGenerator.getInstance();
boolean firstRandomDraw = false;
if(randomNumbers==null){
randomNumbers = new double[... | java | public double estimateExcludedVolumeFraction(){
//Calculate volume/area of the of the scene without obstacles
if(recalculateVolumeFraction){
CentralRandomNumberGenerator r = CentralRandomNumberGenerator.getInstance();
boolean firstRandomDraw = false;
if(randomNumbers==null){
randomNumbers = new double[... | [
"public",
"double",
"estimateExcludedVolumeFraction",
"(",
")",
"{",
"//Calculate volume/area of the of the scene without obstacles",
"if",
"(",
"recalculateVolumeFraction",
")",
"{",
"CentralRandomNumberGenerator",
"r",
"=",
"CentralRandomNumberGenerator",
".",
"getInstance",
"(... | Estimate excluded volume fraction by monte carlo method
@return excluded volume fraction | [
"Estimate",
"excluded",
"volume",
"fraction",
"by",
"monte",
"carlo",
"method"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/simulation/AnomalousDiffusionScene.java#L71-L97 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java | ZWaveMultiInstanceCommandClass.handleMultiInstanceReportResponse | private void handleMultiInstanceReportResponse(SerialMessage serialMessage,
int offset) {
logger.trace("Process Multi-instance Report");
int commandClassCode = serialMessage.getMessagePayloadByte(offset);
int instances = serialMessage.getMessagePayloadByte(offset + 1);
if (instances == 0) {
setIns... | java | private void handleMultiInstanceReportResponse(SerialMessage serialMessage,
int offset) {
logger.trace("Process Multi-instance Report");
int commandClassCode = serialMessage.getMessagePayloadByte(offset);
int instances = serialMessage.getMessagePayloadByte(offset + 1);
if (instances == 0) {
setIns... | [
"private",
"void",
"handleMultiInstanceReportResponse",
"(",
"SerialMessage",
"serialMessage",
",",
"int",
"offset",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Process Multi-instance Report\"",
")",
";",
"int",
"commandClassCode",
"=",
"serialMessage",
".",
"getMessagePa... | Handles Multi Instance Report message. Handles Report on
the number of instances for the command class.
@param serialMessage the serial message to process.
@param offset the offset at which to start procesing. | [
"Handles",
"Multi",
"Instance",
"Report",
"message",
".",
"Handles",
"Report",
"on",
"the",
"number",
"of",
"instances",
"for",
"the",
"command",
"class",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java#L190-L225 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java | ZWaveMultiInstanceCommandClass.handleMultiInstanceEncapResponse | private void handleMultiInstanceEncapResponse(
SerialMessage serialMessage, int offset) {
logger.trace("Process Multi-instance Encapsulation");
int instance = serialMessage.getMessagePayloadByte(offset);
int commandClassCode = serialMessage.getMessagePayloadByte(offset + 1);
CommandClass commandClass = ... | java | private void handleMultiInstanceEncapResponse(
SerialMessage serialMessage, int offset) {
logger.trace("Process Multi-instance Encapsulation");
int instance = serialMessage.getMessagePayloadByte(offset);
int commandClassCode = serialMessage.getMessagePayloadByte(offset + 1);
CommandClass commandClass = ... | [
"private",
"void",
"handleMultiInstanceEncapResponse",
"(",
"SerialMessage",
"serialMessage",
",",
"int",
"offset",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Process Multi-instance Encapsulation\"",
")",
";",
"int",
"instance",
"=",
"serialMessage",
".",
"getMessagePayl... | Handles Multi Instance Encapsulation message. Decapsulates
an Application Command message and handles it using the right
instance.
@param serialMessage the serial message to process.
@param offset the offset at which to start procesing. | [
"Handles",
"Multi",
"Instance",
"Encapsulation",
"message",
".",
"Decapsulates",
"an",
"Application",
"Command",
"message",
"and",
"handles",
"it",
"using",
"the",
"right",
"instance",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java#L234-L256 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java | ZWaveMultiInstanceCommandClass.handleMultiChannelEncapResponse | private void handleMultiChannelEncapResponse(
SerialMessage serialMessage, int offset) {
logger.trace("Process Multi-channel Encapsulation");
CommandClass commandClass;
ZWaveCommandClass zwaveCommandClass;
int endpointId = serialMessage.getMessagePayloadByte(offset);
int commandClassCode = serialMess... | java | private void handleMultiChannelEncapResponse(
SerialMessage serialMessage, int offset) {
logger.trace("Process Multi-channel Encapsulation");
CommandClass commandClass;
ZWaveCommandClass zwaveCommandClass;
int endpointId = serialMessage.getMessagePayloadByte(offset);
int commandClassCode = serialMess... | [
"private",
"void",
"handleMultiChannelEncapResponse",
"(",
"SerialMessage",
"serialMessage",
",",
"int",
"offset",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Process Multi-channel Encapsulation\"",
")",
";",
"CommandClass",
"commandClass",
";",
"ZWaveCommandClass",
"zwaveC... | Handles Multi Channel Encapsulation message. Decapsulates
an Application Command message and handles it using the right
endpoint.
@param serialMessage the serial message to process.
@param offset the offset at which to start procesing. | [
"Handles",
"Multi",
"Channel",
"Encapsulation",
"message",
".",
"Decapsulates",
"an",
"Application",
"Command",
"message",
"and",
"handles",
"it",
"using",
"the",
"right",
"endpoint",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java#L393-L429 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java | ZWaveMultiInstanceCommandClass.getMultiInstanceGetMessage | public SerialMessage getMultiInstanceGetMessage(CommandClass commandClass) {
logger.debug("Creating new message for application command MULTI_INSTANCE_GET for node {} and command class {}", this.getNode().getNodeId(), commandClass.getLabel());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), S... | java | public SerialMessage getMultiInstanceGetMessage(CommandClass commandClass) {
logger.debug("Creating new message for application command MULTI_INSTANCE_GET for node {} and command class {}", this.getNode().getNodeId(), commandClass.getLabel());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), S... | [
"public",
"SerialMessage",
"getMultiInstanceGetMessage",
"(",
"CommandClass",
"commandClass",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating new message for application command MULTI_INSTANCE_GET for node {} and command class {}\"",
",",
"this",
".",
"getNode",
"(",
")",
".... | Gets a SerialMessage with the MULTI INSTANCE GET command.
Returns the number of instances for this command class.
@param the command class to return the number of instances for.
@return the serial message. | [
"Gets",
"a",
"SerialMessage",
"with",
"the",
"MULTI",
"INSTANCE",
"GET",
"command",
".",
"Returns",
"the",
"number",
"of",
"instances",
"for",
"this",
"command",
"class",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java#L437-L448 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java | ZWaveMultiInstanceCommandClass.getMultiChannelCapabilityGetMessage | public SerialMessage getMultiChannelCapabilityGetMessage(ZWaveEndpoint endpoint) {
logger.debug("Creating new message for application command MULTI_CHANNEL_CAPABILITY_GET for node {} and endpoint {}", this.getNode().getNodeId(), endpoint.getEndpointId());
SerialMessage result = new SerialMessage(this.getNode().ge... | java | public SerialMessage getMultiChannelCapabilityGetMessage(ZWaveEndpoint endpoint) {
logger.debug("Creating new message for application command MULTI_CHANNEL_CAPABILITY_GET for node {} and endpoint {}", this.getNode().getNodeId(), endpoint.getEndpointId());
SerialMessage result = new SerialMessage(this.getNode().ge... | [
"public",
"SerialMessage",
"getMultiChannelCapabilityGetMessage",
"(",
"ZWaveEndpoint",
"endpoint",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating new message for application command MULTI_CHANNEL_CAPABILITY_GET for node {} and endpoint {}\"",
",",
"this",
".",
"getNode",
"(",
... | Gets a SerialMessage with the MULTI CHANNEL CAPABILITY GET command.
Gets the capabilities for a specific endpoint.
@param the number of the endpoint to get the
@return the serial message. | [
"Gets",
"a",
"SerialMessage",
"with",
"the",
"MULTI",
"CHANNEL",
"CAPABILITY",
"GET",
"command",
".",
"Gets",
"the",
"capabilities",
"for",
"a",
"specific",
"endpoint",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveMultiInstanceCommandClass.java#L495-L505 | train |
ow2-chameleon/fuchsia | discoveries/upnp/src/main/java/org/ow2/chameleon/fuchsia/discovery/upnp/UPnPDiscovery.java | UPnPDiscovery.createImportationDeclaration | public synchronized void createImportationDeclaration(String deviceId, String deviceType, String deviceSubType) {
Map<String, Object> metadata = new HashMap<String, Object>();
metadata.put(Constants.DEVICE_ID, deviceId);
metadata.put(Constants.DEVICE_TYPE, deviceType);
metadata.put(Const... | java | public synchronized void createImportationDeclaration(String deviceId, String deviceType, String deviceSubType) {
Map<String, Object> metadata = new HashMap<String, Object>();
metadata.put(Constants.DEVICE_ID, deviceId);
metadata.put(Constants.DEVICE_TYPE, deviceType);
metadata.put(Const... | [
"public",
"synchronized",
"void",
"createImportationDeclaration",
"(",
"String",
"deviceId",
",",
"String",
"deviceType",
",",
"String",
"deviceSubType",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"metadata",
"=",
"new",
"HashMap",
"<",
"String",
",",
... | Create an import declaration and delegates its registration for an upper class. | [
"Create",
"an",
"import",
"declaration",
"and",
"delegates",
"its",
"registration",
"for",
"an",
"upper",
"class",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/discoveries/upnp/src/main/java/org/ow2/chameleon/fuchsia/discovery/upnp/UPnPDiscovery.java#L97-L108 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyVideoUtils.java | MyVideoUtils.getDimension | public static Dimension getDimension(File videoFile) throws IOException {
try (FileInputStream fis = new FileInputStream(videoFile)) {
return getDimension(fis, new AtomicReference<ByteBuffer>());
}
} | java | public static Dimension getDimension(File videoFile) throws IOException {
try (FileInputStream fis = new FileInputStream(videoFile)) {
return getDimension(fis, new AtomicReference<ByteBuffer>());
}
} | [
"public",
"static",
"Dimension",
"getDimension",
"(",
"File",
"videoFile",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"videoFile",
")",
")",
"{",
"return",
"getDimension",
"(",
"fis",
",",
"new"... | Returns the dimensions for the video
@param videoFile Video file
@return the dimensions
@throws IOException | [
"Returns",
"the",
"dimensions",
"for",
"the",
"video"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyVideoUtils.java#L46-L50 | train |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/MethodUtil.java | MethodUtil.determineAccessorName | public static String determineAccessorName(@Nonnull final AccessorPrefix prefix, @Nonnull final String fieldName) {
Check.notNull(prefix, "prefix");
Check.notEmpty(fieldName, "fieldName");
final Matcher m = PATTERN.matcher(fieldName);
Check.stateIsTrue(m.find(), "passed field name '%s' is not applicable", field... | java | public static String determineAccessorName(@Nonnull final AccessorPrefix prefix, @Nonnull final String fieldName) {
Check.notNull(prefix, "prefix");
Check.notEmpty(fieldName, "fieldName");
final Matcher m = PATTERN.matcher(fieldName);
Check.stateIsTrue(m.find(), "passed field name '%s' is not applicable", field... | [
"public",
"static",
"String",
"determineAccessorName",
"(",
"@",
"Nonnull",
"final",
"AccessorPrefix",
"prefix",
",",
"@",
"Nonnull",
"final",
"String",
"fieldName",
")",
"{",
"Check",
".",
"notNull",
"(",
"prefix",
",",
"\"prefix\"",
")",
";",
"Check",
".",
... | Determines the accessor method name based on a field name.
@param fieldName
a field name
@return the resulting method name | [
"Determines",
"the",
"accessor",
"method",
"name",
"based",
"on",
"a",
"field",
"name",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/MethodUtil.java#L41-L48 | train |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/MethodUtil.java | MethodUtil.determineMutatorName | public static String determineMutatorName(@Nonnull final String fieldName) {
Check.notEmpty(fieldName, "fieldName");
final Matcher m = PATTERN.matcher(fieldName);
Check.stateIsTrue(m.find(), "passed field name '%s' is not applicable", fieldName);
final String name = m.group();
return METHOD_SET_PREFIX + name.... | java | public static String determineMutatorName(@Nonnull final String fieldName) {
Check.notEmpty(fieldName, "fieldName");
final Matcher m = PATTERN.matcher(fieldName);
Check.stateIsTrue(m.find(), "passed field name '%s' is not applicable", fieldName);
final String name = m.group();
return METHOD_SET_PREFIX + name.... | [
"public",
"static",
"String",
"determineMutatorName",
"(",
"@",
"Nonnull",
"final",
"String",
"fieldName",
")",
"{",
"Check",
".",
"notEmpty",
"(",
"fieldName",
",",
"\"fieldName\"",
")",
";",
"final",
"Matcher",
"m",
"=",
"PATTERN",
".",
"matcher",
"(",
"fi... | Determines the mutator method name based on a field name.
@param fieldName
a field name
@return the resulting method name | [
"Determines",
"the",
"mutator",
"method",
"name",
"based",
"on",
"a",
"field",
"name",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/MethodUtil.java#L57-L63 | train |
phax/ph-xmldsig | src/main/java/com/helger/xmldsig/XMLDSigValidationResult.java | XMLDSigValidationResult.createReferenceErrors | @Nonnull
public static XMLDSigValidationResult createReferenceErrors (@Nonnull @Nonempty final List <Integer> aInvalidReferences)
{
return new XMLDSigValidationResult (aInvalidReferences);
} | java | @Nonnull
public static XMLDSigValidationResult createReferenceErrors (@Nonnull @Nonempty final List <Integer> aInvalidReferences)
{
return new XMLDSigValidationResult (aInvalidReferences);
} | [
"@",
"Nonnull",
"public",
"static",
"XMLDSigValidationResult",
"createReferenceErrors",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"List",
"<",
"Integer",
">",
"aInvalidReferences",
")",
"{",
"return",
"new",
"XMLDSigValidationResult",
"(",
"aInvalidReferences",
"... | An invalid reference or references. The verification of the digest of a
reference failed. This can be caused by a change to the referenced data
since the signature was generated.
@param aInvalidReferences
The indices to the invalid references.
@return Result object | [
"An",
"invalid",
"reference",
"or",
"references",
".",
"The",
"verification",
"of",
"the",
"digest",
"of",
"a",
"reference",
"failed",
".",
"This",
"can",
"be",
"caused",
"by",
"a",
"change",
"to",
"the",
"referenced",
"data",
"since",
"the",
"signature",
... | c00677fe3dac5aef0f3039b08a03e90052473952 | https://github.com/phax/ph-xmldsig/blob/c00677fe3dac5aef0f3039b08a03e90052473952/src/main/java/com/helger/xmldsig/XMLDSigValidationResult.java#L133-L137 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java | VisualizationUtils.getTrajectoryChart | public static Chart getTrajectoryChart(String title, Trajectory t){
if(t.getDimension()==2){
double[] xData = new double[t.size()];
double[] yData = new double[t.size()];
for(int i = 0; i < t.size(); i++){
xData[i] = t.get(i).x;
yData[i] = t.get(i).y;
}
// Create Char... | java | public static Chart getTrajectoryChart(String title, Trajectory t){
if(t.getDimension()==2){
double[] xData = new double[t.size()];
double[] yData = new double[t.size()];
for(int i = 0; i < t.size(); i++){
xData[i] = t.get(i).x;
yData[i] = t.get(i).y;
}
// Create Char... | [
"public",
"static",
"Chart",
"getTrajectoryChart",
"(",
"String",
"title",
",",
"Trajectory",
"t",
")",
"{",
"if",
"(",
"t",
".",
"getDimension",
"(",
")",
"==",
"2",
")",
"{",
"double",
"[",
"]",
"xData",
"=",
"new",
"double",
"[",
"t",
".",
"size",... | Plots the trajectory
@param title Title of the plot
@param t Trajectory to be plotted | [
"Plots",
"the",
"trajectory"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L56-L74 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java | VisualizationUtils.getMSDLineChart | public static Chart getMSDLineChart(Trajectory t, int lagMin, int lagMax,
AbstractMeanSquaredDisplacmentEvaluator msdeval) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
msdeval.setTrajectory(t);
msdeval.setTimelag(lagMin);
for (int i = lagMin; i < la... | java | public static Chart getMSDLineChart(Trajectory t, int lagMin, int lagMax,
AbstractMeanSquaredDisplacmentEvaluator msdeval) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
msdeval.setTrajectory(t);
msdeval.setTimelag(lagMin);
for (int i = lagMin; i < la... | [
"public",
"static",
"Chart",
"getMSDLineChart",
"(",
"Trajectory",
"t",
",",
"int",
"lagMin",
",",
"int",
"lagMax",
",",
"AbstractMeanSquaredDisplacmentEvaluator",
"msdeval",
")",
"{",
"double",
"[",
"]",
"xData",
"=",
"new",
"double",
"[",
"lagMax",
"-",
"lag... | Plots the MSD curve for trajectory t
@param t Trajectory to calculate the msd curve
@param lagMin Minimum timelag (e.g. 1,2,3..) lagMin*timelag = elapsed time in seconds
@param lagMax Maximum timelag (e.g. 1,2,3..) lagMax*timelag = elapsed time in seconds
@param msdeval Evaluates the mean squared displacment | [
"Plots",
"the",
"MSD",
"curve",
"for",
"trajectory",
"t"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L91-L112 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java | VisualizationUtils.getMSDLineWithConfinedModelChart | public static Chart getMSDLineWithConfinedModelChart(Trajectory t, int lagMin,
int lagMax, double timelag, double a, double b, double c, double d) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
double[] modelData = new double[lagMax - lagMin + 1];
MeanS... | java | public static Chart getMSDLineWithConfinedModelChart(Trajectory t, int lagMin,
int lagMax, double timelag, double a, double b, double c, double d) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
double[] modelData = new double[lagMax - lagMin + 1];
MeanS... | [
"public",
"static",
"Chart",
"getMSDLineWithConfinedModelChart",
"(",
"Trajectory",
"t",
",",
"int",
"lagMin",
",",
"int",
"lagMax",
",",
"double",
"timelag",
",",
"double",
"a",
",",
"double",
"b",
",",
"double",
"c",
",",
"double",
"d",
")",
"{",
"double... | Plots the MSD curve with the trajectory t and adds the fitted model for confined diffusion above.
@param t Trajectory to calculate the msd curve
@param lagMin Minimum timelag (e.g. 1,2,3..) lagMin*timelag = elapsed time in seconds
@param lagMax Maximum timelag (e.g. 1,2,3..) lagMax*timelag = elapsed time in seconds
@pa... | [
"Plots",
"the",
"MSD",
"curve",
"with",
"the",
"trajectory",
"t",
"and",
"adds",
"the",
"fitted",
"model",
"for",
"confined",
"diffusion",
"above",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L125-L156 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java | VisualizationUtils.getMSDLineWithPowerModelChart | public static Chart getMSDLineWithPowerModelChart(Trajectory t, int lagMin,
int lagMax, double timelag, double a, double D) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
double[] modelData = new double[lagMax - lagMin + 1];
MeanSquaredDisplacmentFeatur... | java | public static Chart getMSDLineWithPowerModelChart(Trajectory t, int lagMin,
int lagMax, double timelag, double a, double D) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
double[] modelData = new double[lagMax - lagMin + 1];
MeanSquaredDisplacmentFeatur... | [
"public",
"static",
"Chart",
"getMSDLineWithPowerModelChart",
"(",
"Trajectory",
"t",
",",
"int",
"lagMin",
",",
"int",
"lagMax",
",",
"double",
"timelag",
",",
"double",
"a",
",",
"double",
"D",
")",
"{",
"double",
"[",
"]",
"xData",
"=",
"new",
"double",... | Plots the MSD curve with the trajectory t and adds the fitted model for anomalous diffusion above.
@param t
@param lagMin Minimum timelag (e.g. 1,2,3..) lagMin*timelag = elapsed time in seconds
@param lagMax lagMax Maximum timelag (e.g. 1,2,3..) lagMax*timelag = elapsed time in seconds
@param timelag Elapsed time betwe... | [
"Plots",
"the",
"MSD",
"curve",
"with",
"the",
"trajectory",
"t",
"and",
"adds",
"the",
"fitted",
"model",
"for",
"anomalous",
"diffusion",
"above",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L167-L193 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java | VisualizationUtils.getMSDLineWithFreeModelChart | public static Chart getMSDLineWithFreeModelChart(Trajectory t, int lagMin,
int lagMax, double timelag, double diffusionCoefficient, double intercept) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
double[] modelData = new double[lagMax - lagMin + 1];
Me... | java | public static Chart getMSDLineWithFreeModelChart(Trajectory t, int lagMin,
int lagMax, double timelag, double diffusionCoefficient, double intercept) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
double[] modelData = new double[lagMax - lagMin + 1];
Me... | [
"public",
"static",
"Chart",
"getMSDLineWithFreeModelChart",
"(",
"Trajectory",
"t",
",",
"int",
"lagMin",
",",
"int",
"lagMax",
",",
"double",
"timelag",
",",
"double",
"diffusionCoefficient",
",",
"double",
"intercept",
")",
"{",
"double",
"[",
"]",
"xData",
... | Plots the MSD curve with the trajectory t and adds the fitted model for free diffusion.
@param t
@param lagMin Minimum timelag (e.g. 1,2,3..) lagMin*timelag = elapsed time in seconds
@param lagMax lagMax Maximum timelag (e.g. 1,2,3..) lagMax*timelag = elapsed time in seconds
@param timelag Elapsed time between two fram... | [
"Plots",
"the",
"MSD",
"curve",
"with",
"the",
"trajectory",
"t",
"and",
"adds",
"the",
"fitted",
"model",
"for",
"free",
"diffusion",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L204-L230 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java | VisualizationUtils.getMSDLineWithActiveTransportModelChart | public static Chart getMSDLineWithActiveTransportModelChart(Trajectory t, int lagMin,
int lagMax, double timelag, double diffusionCoefficient, double velocity) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
double[] modelData = new double[lagMax - lagMin ... | java | public static Chart getMSDLineWithActiveTransportModelChart(Trajectory t, int lagMin,
int lagMax, double timelag, double diffusionCoefficient, double velocity) {
double[] xData = new double[lagMax - lagMin + 1];
double[] yData = new double[lagMax - lagMin + 1];
double[] modelData = new double[lagMax - lagMin ... | [
"public",
"static",
"Chart",
"getMSDLineWithActiveTransportModelChart",
"(",
"Trajectory",
"t",
",",
"int",
"lagMin",
",",
"int",
"lagMax",
",",
"double",
"timelag",
",",
"double",
"diffusionCoefficient",
",",
"double",
"velocity",
")",
"{",
"double",
"[",
"]",
... | Plots the MSD curve with the trajectory t and adds the fitted model for directed motion above.
@param t
@param lagMin Minimum timelag (e.g. 1,2,3..) lagMin*timelag = elapsed time in seconds
@param lagMax lagMax Maximum timelag (e.g. 1,2,3..) lagMax*timelag = elapsed time in seconds
@param timelag Elapsed time between t... | [
"Plots",
"the",
"MSD",
"curve",
"with",
"the",
"trajectory",
"t",
"and",
"adds",
"the",
"fitted",
"model",
"for",
"directed",
"motion",
"above",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L241-L267 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java | VisualizationUtils.getMSDLineChart | public static Chart getMSDLineChart(Trajectory t, int lagMin, int lagMax) {
return getMSDLineChart(t, lagMin, lagMax, new MeanSquaredDisplacmentFeature(t,
lagMin));
} | java | public static Chart getMSDLineChart(Trajectory t, int lagMin, int lagMax) {
return getMSDLineChart(t, lagMin, lagMax, new MeanSquaredDisplacmentFeature(t,
lagMin));
} | [
"public",
"static",
"Chart",
"getMSDLineChart",
"(",
"Trajectory",
"t",
",",
"int",
"lagMin",
",",
"int",
"lagMax",
")",
"{",
"return",
"getMSDLineChart",
"(",
"t",
",",
"lagMin",
",",
"lagMax",
",",
"new",
"MeanSquaredDisplacmentFeature",
"(",
"t",
",",
"la... | Plots the MSD curve for trajectory t.
@param t List of trajectories
@param lagMin Minimum timelag (e.g. 1,2,3..) lagMin*timelag = elapsed time in seconds
@param lagMax Maximum timelag (e.g. 1,2,3..) lagMax*timelag = elapsed time in seconds | [
"Plots",
"the",
"MSD",
"curve",
"for",
"trajectory",
"t",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L312-L315 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java | VisualizationUtils.plotCharts | public static void plotCharts(List<Chart> charts){
int numRows =1;
int numCols =1;
if(charts.size()>1){
numRows = (int) Math.ceil(charts.size()/2.0);
numCols = 2;
}
final JFrame frame = new JFrame("");
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
frame.getContentPane().setLay... | java | public static void plotCharts(List<Chart> charts){
int numRows =1;
int numCols =1;
if(charts.size()>1){
numRows = (int) Math.ceil(charts.size()/2.0);
numCols = 2;
}
final JFrame frame = new JFrame("");
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
frame.getContentPane().setLay... | [
"public",
"static",
"void",
"plotCharts",
"(",
"List",
"<",
"Chart",
">",
"charts",
")",
"{",
"int",
"numRows",
"=",
"1",
";",
"int",
"numCols",
"=",
"1",
";",
"if",
"(",
"charts",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"numRows",
"=",
"(",
... | Plots a list of charts in matrix with 2 columns.
@param charts | [
"Plots",
"a",
"list",
"of",
"charts",
"in",
"matrix",
"with",
"2",
"columns",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/VisualizationUtils.java#L341-L366 | train |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/domain/Imports.java | Imports.find | @Nullable
public Import find(@Nonnull final String typeName) {
Check.notEmpty(typeName, "typeName");
Import ret = null;
final Type type = new Type(typeName);
for (final Import imp : imports) {
if (imp.getType().getName().equals(type.getName())) {
ret = imp;
break;
}
}
if (ret == null) {
fi... | java | @Nullable
public Import find(@Nonnull final String typeName) {
Check.notEmpty(typeName, "typeName");
Import ret = null;
final Type type = new Type(typeName);
for (final Import imp : imports) {
if (imp.getType().getName().equals(type.getName())) {
ret = imp;
break;
}
}
if (ret == null) {
fi... | [
"@",
"Nullable",
"public",
"Import",
"find",
"(",
"@",
"Nonnull",
"final",
"String",
"typeName",
")",
"{",
"Check",
".",
"notEmpty",
"(",
"typeName",
",",
"\"typeName\"",
")",
";",
"Import",
"ret",
"=",
"null",
";",
"final",
"Type",
"type",
"=",
"new",
... | Searches the set of imports to find a matching import by type name.
@param typeName
name of type (qualified or simple name allowed)
@return found import or {@code null} | [
"Searches",
"the",
"set",
"of",
"imports",
"to",
"find",
"a",
"matching",
"import",
"by",
"type",
"name",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/domain/Imports.java#L224-L242 | train |
ow2-chameleon/fuchsia | examples/jax-ws/weatherForecast/weather-ws-impl/src/main/java/org/ow2/chameleon/fuchsia/examples/jaxws/weather/impl/ZipCodeConverter.java | ZipCodeConverter.query | private void query(String zipcode) {
/* Setup YQL query statement using dynamic zipcode. The statement searches geo.places
for the zipcode and returns XML which includes the WOEID. For more info about YQL go
to: http://developer.yahoo.com/yql/ */
... | java | private void query(String zipcode) {
/* Setup YQL query statement using dynamic zipcode. The statement searches geo.places
for the zipcode and returns XML which includes the WOEID. For more info about YQL go
to: http://developer.yahoo.com/yql/ */
... | [
"private",
"void",
"query",
"(",
"String",
"zipcode",
")",
"{",
"/* Setup YQL query statement using dynamic zipcode. The statement searches geo.places\n for the zipcode and returns XML which includes the WOEID. For more info about YQL go\n to: http://dev... | Query zipcode from Yahoo to find associated WOEID | [
"Query",
"zipcode",
"from",
"Yahoo",
"to",
"find",
"associated",
"WOEID"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/examples/jax-ws/weatherForecast/weather-ws-impl/src/main/java/org/ow2/chameleon/fuchsia/examples/jaxws/weather/impl/ZipCodeConverter.java#L51-L72 | train |
ow2-chameleon/fuchsia | examples/jax-ws/weatherForecast/weather-ws-impl/src/main/java/org/ow2/chameleon/fuchsia/examples/jaxws/weather/impl/ZipCodeConverter.java | ZipCodeConverter.parseResponse | private void parseResponse(InputStream inputStream) {
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(inputStream);
doc.getDocumentElement().no... | java | private void parseResponse(InputStream inputStream) {
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(inputStream);
doc.getDocumentElement().no... | [
"private",
"void",
"parseResponse",
"(",
"InputStream",
"inputStream",
")",
"{",
"try",
"{",
"DocumentBuilderFactory",
"dbFactory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"DocumentBuilder",
"dBuilder",
"=",
"dbFactory",
".",
"newDocumentBuil... | Extract WOEID after XML loads | [
"Extract",
"WOEID",
"after",
"XML",
"loads"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/examples/jax-ws/weatherForecast/weather-ws-impl/src/main/java/org/ow2/chameleon/fuchsia/examples/jaxws/weather/impl/ZipCodeConverter.java#L75-L96 | train |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/generator/InterfaceAnalyzer.java | InterfaceAnalyzer.analyze | @Nonnull
public static InterfaceAnalysis analyze(@Nonnull final String code) {
Check.notNull(code, "code");
final CompilationUnit unit = Check.notNull(SourceCodeReader.parse(code), "compilationUnit");
final List<TypeDeclaration> types = Check.notEmpty(unit.getTypes(), "typeDeclarations");
Check.stateIsTrue(ty... | java | @Nonnull
public static InterfaceAnalysis analyze(@Nonnull final String code) {
Check.notNull(code, "code");
final CompilationUnit unit = Check.notNull(SourceCodeReader.parse(code), "compilationUnit");
final List<TypeDeclaration> types = Check.notEmpty(unit.getTypes(), "typeDeclarations");
Check.stateIsTrue(ty... | [
"@",
"Nonnull",
"public",
"static",
"InterfaceAnalysis",
"analyze",
"(",
"@",
"Nonnull",
"final",
"String",
"code",
")",
"{",
"Check",
".",
"notNull",
"(",
"code",
",",
"\"code\"",
")",
";",
"final",
"CompilationUnit",
"unit",
"=",
"Check",
".",
"notNull",
... | Analyzes the source code of an interface. The specified interface must not contain methods, that changes the
state of the corresponding object itself.
@param code
source code of an interface which describes how to generate the <i>immutable</i>
@return analysis result | [
"Analyzes",
"the",
"source",
"code",
"of",
"an",
"interface",
".",
"The",
"specified",
"interface",
"must",
"not",
"contain",
"methods",
"that",
"changes",
"the",
"state",
"of",
"the",
"corresponding",
"object",
"itself",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/generator/InterfaceAnalyzer.java#L47-L65 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/TrajectoryValidIndexTimelagIterator.java | TrajectoryValidIndexTimelagIterator.next | public Integer next() {
for(int i = currentIndex; i < t.size(); i++){
if(i+timelag>=t.size()){
return null;
}
if((t.get(i) != null) && (t.get(i+timelag) != null)){
if(overlap){
currentIndex = i+1;
}
else{
currentIndex = i+timelag;
}
return i;
}
}
return null;
} | java | public Integer next() {
for(int i = currentIndex; i < t.size(); i++){
if(i+timelag>=t.size()){
return null;
}
if((t.get(i) != null) && (t.get(i+timelag) != null)){
if(overlap){
currentIndex = i+1;
}
else{
currentIndex = i+timelag;
}
return i;
}
}
return null;
} | [
"public",
"Integer",
"next",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"currentIndex",
";",
"i",
"<",
"t",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"+",
"timelag",
">=",
"t",
".",
"size",
"(",
")",
")",
"{",
"retur... | Give next index i where i and i+timelag is valid | [
"Give",
"next",
"index",
"i",
"where",
"i",
"and",
"i",
"+",
"timelag",
"is",
"valid"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/TrajectoryValidIndexTimelagIterator.java#L81-L98 | train |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.matches | private static boolean matches(@Nonnull final Pattern pattern, @Nonnull final CharSequence chars) {
return pattern.matcher(chars).matches();
} | java | private static boolean matches(@Nonnull final Pattern pattern, @Nonnull final CharSequence chars) {
return pattern.matcher(chars).matches();
} | [
"private",
"static",
"boolean",
"matches",
"(",
"@",
"Nonnull",
"final",
"Pattern",
"pattern",
",",
"@",
"Nonnull",
"final",
"CharSequence",
"chars",
")",
"{",
"return",
"pattern",
".",
"matcher",
"(",
"chars",
")",
".",
"matches",
"(",
")",
";",
"}"
] | Checks whether a character sequence matches against a specified pattern or not.
@param pattern
pattern, that the {@code chars} must correspond to
@param chars
a readable sequence of {@code char} values which should match the given pattern
@return {@code true} when {@code chars} matches against the passed {@code patter... | [
"Checks",
"whether",
"a",
"character",
"sequence",
"matches",
"against",
"a",
"specified",
"pattern",
"or",
"not",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1753-L1755 | train |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java | ConditionalCheck.isNumber | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })
public static void isNumber(final boolean condition, @Nonnull final String value) {
if (condition) {
Check.isNumber(value);
}
} | java | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })
public static void isNumber(final boolean condition, @Nonnull final String value) {
if (condition) {
Check.isNumber(value);
}
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"{",
"IllegalNullArgumentException",
".",
"class",
",",
"IllegalNumberArgumentException",
".",
"class",
"}",
")",
"public",
"static",
"void",
"isNumber",
"(",
"final",
"boolean",
"condition",
",",
"@",
"Nonnull",
"final... | Ensures that a String argument is a number.
@param condition
condition must be {@code true}^ so that the check will be performed
@param value
value which must be a number
@throws IllegalNumberArgumentException
if the given argument {@code value} is not a number | [
"Ensures",
"that",
"a",
"String",
"argument",
"is",
"a",
"number",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L812-L818 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/Trajectory.java | Trajectory.subList | @Override
public Trajectory subList(int fromIndex, int toIndex) {
Trajectory t = new Trajectory(dimension);
for(int i = fromIndex; i < toIndex; i++){
t.add(this.get(i));
}
return t;
} | java | @Override
public Trajectory subList(int fromIndex, int toIndex) {
Trajectory t = new Trajectory(dimension);
for(int i = fromIndex; i < toIndex; i++){
t.add(this.get(i));
}
return t;
} | [
"@",
"Override",
"public",
"Trajectory",
"subList",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"Trajectory",
"t",
"=",
"new",
"Trajectory",
"(",
"dimension",
")",
";",
"for",
"(",
"int",
"i",
"=",
"fromIndex",
";",
"i",
"<",
"toIndex",
"... | Generates a sub-trajectory | [
"Generates",
"a",
"sub",
"-",
"trajectory"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/Trajectory.java#L79-L87 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/Trajectory.java | Trajectory.getPositionsAsArray | public double[][] getPositionsAsArray(){
double[][] posAsArr = new double[size()][3];
for(int i = 0; i < size(); i++){
if(get(i)!=null){
posAsArr[i][0] = get(i).x;
posAsArr[i][1] = get(i).y;
posAsArr[i][2] = get(i).z;
}
else{
posAsArr[i] = null;
}
}
return posAsArr;
} | java | public double[][] getPositionsAsArray(){
double[][] posAsArr = new double[size()][3];
for(int i = 0; i < size(); i++){
if(get(i)!=null){
posAsArr[i][0] = get(i).x;
posAsArr[i][1] = get(i).y;
posAsArr[i][2] = get(i).z;
}
else{
posAsArr[i] = null;
}
}
return posAsArr;
} | [
"public",
"double",
"[",
"]",
"[",
"]",
"getPositionsAsArray",
"(",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"posAsArr",
"=",
"new",
"double",
"[",
"size",
"(",
")",
"]",
"[",
"3",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"si... | Converts the positions to a 2D double array
@return 2d double array [i][j], i=Time index, j=coordinate index | [
"Converts",
"the",
"positions",
"to",
"a",
"2D",
"double",
"array"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/Trajectory.java#L117-L130 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/Trajectory.java | Trajectory.scale | public void scale(double v){
for(int i = 0; i < this.size(); i++){
this.get(i).scale(v);;
}
} | java | public void scale(double v){
for(int i = 0; i < this.size(); i++){
this.get(i).scale(v);;
}
} | [
"public",
"void",
"scale",
"(",
"double",
"v",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"this",
".",
"get",
"(",
"i",
")",
".",
"scale",
"(",
"v",
")",
";",
";",
... | Multiplies all positions with a factor v
@param v Multiplication factor | [
"Multiplies",
"all",
"positions",
"with",
"a",
"factor",
"v"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/Trajectory.java#L160-L164 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyNumberUtils.java | MyNumberUtils.randomIntBetween | public static int randomIntBetween(int min, int max) {
Random rand = new Random();
return rand.nextInt((max - min) + 1) + min;
} | java | public static int randomIntBetween(int min, int max) {
Random rand = new Random();
return rand.nextInt((max - min) + 1) + min;
} | [
"public",
"static",
"int",
"randomIntBetween",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"Random",
"rand",
"=",
"new",
"Random",
"(",
")",
";",
"return",
"rand",
".",
"nextInt",
"(",
"(",
"max",
"-",
"min",
")",
"+",
"1",
")",
"+",
"min",
"... | Returns an integer between interval
@param min Minimum value
@param max Maximum value
@return int number | [
"Returns",
"an",
"integer",
"between",
"interval"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyNumberUtils.java#L34-L37 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyNumberUtils.java | MyNumberUtils.randomLongBetween | public static long randomLongBetween(long min, long max) {
Random rand = new Random();
return min + (long) (rand.nextDouble() * (max - min));
} | java | public static long randomLongBetween(long min, long max) {
Random rand = new Random();
return min + (long) (rand.nextDouble() * (max - min));
} | [
"public",
"static",
"long",
"randomLongBetween",
"(",
"long",
"min",
",",
"long",
"max",
")",
"{",
"Random",
"rand",
"=",
"new",
"Random",
"(",
")",
";",
"return",
"min",
"+",
"(",
"long",
")",
"(",
"rand",
".",
"nextDouble",
"(",
")",
"*",
"(",
"m... | Returns a long between interval
@param min Minimum value
@param max Maximum value
@return long number | [
"Returns",
"a",
"long",
"between",
"interval"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyNumberUtils.java#L46-L49 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java | MyImageUtils.getTrimmedXStart | private static int getTrimmedXStart(BufferedImage img) {
int height = img.getHeight();
int width = img.getWidth();
int xStart = width;
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
if (img.getRGB(j, i) != Color.WHITE.getRGB() && j < xStart) {
xStart = j;
... | java | private static int getTrimmedXStart(BufferedImage img) {
int height = img.getHeight();
int width = img.getWidth();
int xStart = width;
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
if (img.getRGB(j, i) != Color.WHITE.getRGB() && j < xStart) {
xStart = j;
... | [
"private",
"static",
"int",
"getTrimmedXStart",
"(",
"BufferedImage",
"img",
")",
"{",
"int",
"height",
"=",
"img",
".",
"getHeight",
"(",
")",
";",
"int",
"width",
"=",
"img",
".",
"getWidth",
"(",
")",
";",
"int",
"xStart",
"=",
"width",
";",
"for",
... | Get the first non-white X point
@param img Image n memory
@return the x start | [
"Get",
"the",
"first",
"non",
"-",
"white",
"X",
"point"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java#L73-L88 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java | MyImageUtils.getTrimmedWidth | private static int getTrimmedWidth(BufferedImage img) {
int height = img.getHeight();
int width = img.getWidth();
int trimmedWidth = 0;
for (int i = 0; i < height; i++) {
for (int j = width - 1; j >= 0; j--) {
if (img.getRGB(j, i) != Color.WHITE.getRGB() && j > trimmedWidth) {
t... | java | private static int getTrimmedWidth(BufferedImage img) {
int height = img.getHeight();
int width = img.getWidth();
int trimmedWidth = 0;
for (int i = 0; i < height; i++) {
for (int j = width - 1; j >= 0; j--) {
if (img.getRGB(j, i) != Color.WHITE.getRGB() && j > trimmedWidth) {
t... | [
"private",
"static",
"int",
"getTrimmedWidth",
"(",
"BufferedImage",
"img",
")",
"{",
"int",
"height",
"=",
"img",
".",
"getHeight",
"(",
")",
";",
"int",
"width",
"=",
"img",
".",
"getWidth",
"(",
")",
";",
"int",
"trimmedWidth",
"=",
"0",
";",
"for",... | Get the last non-white X point
@param img Image in memory
@return the trimmed width | [
"Get",
"the",
"last",
"non",
"-",
"white",
"X",
"point"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java#L96-L111 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java | MyImageUtils.getTrimmedYStart | private static int getTrimmedYStart(BufferedImage img) {
int width = img.getWidth();
int height = img.getHeight();
int yStart = height;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
if (img.getRGB(i, j) != Color.WHITE.getRGB() && j < yStart) {
yStart = j;
... | java | private static int getTrimmedYStart(BufferedImage img) {
int width = img.getWidth();
int height = img.getHeight();
int yStart = height;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
if (img.getRGB(i, j) != Color.WHITE.getRGB() && j < yStart) {
yStart = j;
... | [
"private",
"static",
"int",
"getTrimmedYStart",
"(",
"BufferedImage",
"img",
")",
"{",
"int",
"width",
"=",
"img",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"img",
".",
"getHeight",
"(",
")",
";",
"int",
"yStart",
"=",
"height",
";",
"for",... | Get the first non-white Y point
@param img Image in memory
@return the trimmed y start | [
"Get",
"the",
"first",
"non",
"-",
"white",
"Y",
"point"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java#L118-L133 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java | MyImageUtils.getTrimmedHeight | private static int getTrimmedHeight(BufferedImage img) {
int width = img.getWidth();
int height = img.getHeight();
int trimmedHeight = 0;
for (int i = 0; i < width; i++) {
for (int j = height - 1; j >= 0; j--) {
if (img.getRGB(i, j) != Color.WHITE.getRGB() && j > trimmedHeight) {
... | java | private static int getTrimmedHeight(BufferedImage img) {
int width = img.getWidth();
int height = img.getHeight();
int trimmedHeight = 0;
for (int i = 0; i < width; i++) {
for (int j = height - 1; j >= 0; j--) {
if (img.getRGB(i, j) != Color.WHITE.getRGB() && j > trimmedHeight) {
... | [
"private",
"static",
"int",
"getTrimmedHeight",
"(",
"BufferedImage",
"img",
")",
"{",
"int",
"width",
"=",
"img",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"img",
".",
"getHeight",
"(",
")",
";",
"int",
"trimmedHeight",
"=",
"0",
";",
"for... | Get the last non-white Y point
@param img Image in memory
@return The trimmed height | [
"Get",
"the",
"last",
"non",
"-",
"white",
"Y",
"point"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java#L141-L156 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java | MyImageUtils.resizeToHeight | public static BufferedImage resizeToHeight(BufferedImage originalImage, int heightOut) {
int width = originalImage.getWidth();
int height = originalImage.getHeight();
int heightPercent = (heightOut * 100) / height;
int newWidth = (width * heightPercent) / 100;
BufferedImage resizedImage =
... | java | public static BufferedImage resizeToHeight(BufferedImage originalImage, int heightOut) {
int width = originalImage.getWidth();
int height = originalImage.getHeight();
int heightPercent = (heightOut * 100) / height;
int newWidth = (width * heightPercent) / 100;
BufferedImage resizedImage =
... | [
"public",
"static",
"BufferedImage",
"resizeToHeight",
"(",
"BufferedImage",
"originalImage",
",",
"int",
"heightOut",
")",
"{",
"int",
"width",
"=",
"originalImage",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"originalImage",
".",
"getHeight",
"(",
... | Resizes an image to the specified height, changing width in the same proportion
@param originalImage Image in memory
@param heightOut The height to resize
@return New Image in memory | [
"Resizes",
"an",
"image",
"to",
"the",
"specified",
"height",
"changing",
"width",
"in",
"the",
"same",
"proportion"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java#L165-L182 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java | MyImageUtils.resizeToWidth | public static BufferedImage resizeToWidth(BufferedImage originalImage, int widthOut) {
int width = originalImage.getWidth();
int height = originalImage.getHeight();
int widthPercent = (widthOut * 100) / width;
int newHeight = (height * widthPercent) / 100;
BufferedImage resi... | java | public static BufferedImage resizeToWidth(BufferedImage originalImage, int widthOut) {
int width = originalImage.getWidth();
int height = originalImage.getHeight();
int widthPercent = (widthOut * 100) / width;
int newHeight = (height * widthPercent) / 100;
BufferedImage resi... | [
"public",
"static",
"BufferedImage",
"resizeToWidth",
"(",
"BufferedImage",
"originalImage",
",",
"int",
"widthOut",
")",
"{",
"int",
"width",
"=",
"originalImage",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"originalImage",
".",
"getHeight",
"(",
"... | Resizes an image to the specified width, changing width in the same proportion
@param originalImage Image in memory
@param widthOut The width to resize
@return New Image in memory | [
"Resizes",
"an",
"image",
"to",
"the",
"specified",
"width",
"changing",
"width",
"in",
"the",
"same",
"proportion"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java#L190-L207 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java | MyStringUtils.regexFindFirst | public static String regexFindFirst(String pattern, String str) {
return regexFindFirst(Pattern.compile(pattern), str, 1);
} | java | public static String regexFindFirst(String pattern, String str) {
return regexFindFirst(Pattern.compile(pattern), str, 1);
} | [
"public",
"static",
"String",
"regexFindFirst",
"(",
"String",
"pattern",
",",
"String",
"str",
")",
"{",
"return",
"regexFindFirst",
"(",
"Pattern",
".",
"compile",
"(",
"pattern",
")",
",",
"str",
",",
"1",
")",
";",
"}"
] | Gets the first group of a regex
@param pattern Pattern
@param str String to find
@return the matching group | [
"Gets",
"the",
"first",
"group",
"of",
"a",
"regex"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L490-L492 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java | MyStringUtils.asListLines | public static List<String> asListLines(String content) {
List<String> retorno = new ArrayList<String>();
content = content.replace(CARRIAGE_RETURN, RETURN);
content = content.replace(RETURN, CARRIAGE_RETURN);
for (String str : content.split(CARRIAGE_RETURN)) {
retorno.add(str);
}
return re... | java | public static List<String> asListLines(String content) {
List<String> retorno = new ArrayList<String>();
content = content.replace(CARRIAGE_RETURN, RETURN);
content = content.replace(RETURN, CARRIAGE_RETURN);
for (String str : content.split(CARRIAGE_RETURN)) {
retorno.add(str);
}
return re... | [
"public",
"static",
"List",
"<",
"String",
">",
"asListLines",
"(",
"String",
"content",
")",
"{",
"List",
"<",
"String",
">",
"retorno",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"content",
"=",
"content",
".",
"replace",
"(",
"CARRI... | Split string content into list
@param content String content
@return list | [
"Split",
"string",
"content",
"into",
"list"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L694-L702 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java | MyStringUtils.asListLinesIgnore | public static List<String> asListLinesIgnore(String content, Pattern ignorePattern) {
List<String> retorno = new ArrayList<String>();
content = content.replace(CARRIAGE_RETURN, RETURN);
content = content.replace(RETURN, CARRIAGE_RETURN);
for (String str : content.split(CARRIAGE_RETURN)) {
if (!ign... | java | public static List<String> asListLinesIgnore(String content, Pattern ignorePattern) {
List<String> retorno = new ArrayList<String>();
content = content.replace(CARRIAGE_RETURN, RETURN);
content = content.replace(RETURN, CARRIAGE_RETURN);
for (String str : content.split(CARRIAGE_RETURN)) {
if (!ign... | [
"public",
"static",
"List",
"<",
"String",
">",
"asListLinesIgnore",
"(",
"String",
"content",
",",
"Pattern",
"ignorePattern",
")",
"{",
"List",
"<",
"String",
">",
"retorno",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"content",
"=",
"... | Split string content into list, ignoring matches of the pattern
@param content String content
@param ignorePattern Pattern to ignore
@return list | [
"Split",
"string",
"content",
"into",
"list",
"ignoring",
"matches",
"of",
"the",
"pattern"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L710-L720 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java | MyStringUtils.getContentMap | public static Map<String, String> getContentMap(File file, String separator) throws IOException {
List<String> content = getContentLines(file);
Map<String, String> map = new LinkedHashMap<String, String>();
for (String line : content) {
String[] spl = line.split(separator);
if (line.trim(... | java | public static Map<String, String> getContentMap(File file, String separator) throws IOException {
List<String> content = getContentLines(file);
Map<String, String> map = new LinkedHashMap<String, String>();
for (String line : content) {
String[] spl = line.split(separator);
if (line.trim(... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getContentMap",
"(",
"File",
"file",
",",
"String",
"separator",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"content",
"=",
"getContentLines",
"(",
"file",
")",
";",
"Map",
... | Get content of a file as a Map<String, String>, using separator to split values
@param file File to get content
@param separator The separator
@return The map with the values
@throws IOException I/O Error | [
"Get",
"content",
"of",
"a",
"file",
"as",
"a",
"Map<",
";",
"String",
"String>",
";",
"using",
"separator",
"to",
"split",
"values"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L800-L812 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java | MyStringUtils.saveContentMap | public static void saveContentMap(Map<String, String> map, File file) throws IOException {
FileWriter out = new FileWriter(file);
for (String key : map.keySet()) {
if (map.get(key) != null) {
out.write(key.replace(":", "#escapedtwodots#") + ":"
+ map.get(key).replace(":", "#escapedtwo... | java | public static void saveContentMap(Map<String, String> map, File file) throws IOException {
FileWriter out = new FileWriter(file);
for (String key : map.keySet()) {
if (map.get(key) != null) {
out.write(key.replace(":", "#escapedtwodots#") + ":"
+ map.get(key).replace(":", "#escapedtwo... | [
"public",
"static",
"void",
"saveContentMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"FileWriter",
"out",
"=",
"new",
"FileWriter",
"(",
"file",
")",
";",
"for",
"(",
"String",
"key",... | Save map to file
@param map Map to save
@param file File to save
@throws IOException I/O error | [
"Save",
"map",
"to",
"file"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L820-L830 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java | MyStringUtils.getTabularData | public static String getTabularData(String[] labels, String[][] data, int padding) {
int[] size = new int[labels.length];
for (int i = 0; i < labels.length; i++) {
size[i] = labels[i].length() + padding;
}
for (String[] row : data) {
for (int i = 0; i < labels.length; i++) {
... | java | public static String getTabularData(String[] labels, String[][] data, int padding) {
int[] size = new int[labels.length];
for (int i = 0; i < labels.length; i++) {
size[i] = labels[i].length() + padding;
}
for (String[] row : data) {
for (int i = 0; i < labels.length; i++) {
... | [
"public",
"static",
"String",
"getTabularData",
"(",
"String",
"[",
"]",
"labels",
",",
"String",
"[",
"]",
"[",
"]",
"data",
",",
"int",
"padding",
")",
"{",
"int",
"[",
"]",
"size",
"=",
"new",
"int",
"[",
"labels",
".",
"length",
"]",
";",
"for"... | Return tabular data
@param labels Labels array
@param data Data bidimensional array
@param padding Total space between fields
@return String | [
"Return",
"tabular",
"data"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L2007-L2048 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java | MyStringUtils.replaceHtmlEntities | public static String replaceHtmlEntities(String content, Map<String, Character> map) {
for (Entry<String, Character> entry : escapeStrings.entrySet()) {
if (content.indexOf(entry.getKey()) != -1) {
content = content.replace(entry.getKey(), String.valueOf(entry.getValue()));
}
... | java | public static String replaceHtmlEntities(String content, Map<String, Character> map) {
for (Entry<String, Character> entry : escapeStrings.entrySet()) {
if (content.indexOf(entry.getKey()) != -1) {
content = content.replace(entry.getKey(), String.valueOf(entry.getValue()));
}
... | [
"public",
"static",
"String",
"replaceHtmlEntities",
"(",
"String",
"content",
",",
"Map",
"<",
"String",
",",
"Character",
">",
"map",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"Character",
">",
"entry",
":",
"escapeStrings",
".",
"entrySet",
"("... | Replace HTML entities
@param content Content
@param map Map
@return Replaced content | [
"Replace",
"HTML",
"entities"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L2096-L2107 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java | LinkerBinderManager.add | public void add(ServiceReference<S> declarationBinderRef) throws InvalidFilterException {
BinderDescriptor binderDescriptor = new BinderDescriptor(declarationBinderRef);
declarationBinders.put(declarationBinderRef, binderDescriptor);
} | java | public void add(ServiceReference<S> declarationBinderRef) throws InvalidFilterException {
BinderDescriptor binderDescriptor = new BinderDescriptor(declarationBinderRef);
declarationBinders.put(declarationBinderRef, binderDescriptor);
} | [
"public",
"void",
"add",
"(",
"ServiceReference",
"<",
"S",
">",
"declarationBinderRef",
")",
"throws",
"InvalidFilterException",
"{",
"BinderDescriptor",
"binderDescriptor",
"=",
"new",
"BinderDescriptor",
"(",
"declarationBinderRef",
")",
";",
"declarationBinders",
".... | Add the declarationBinderRef to the ImportersManager, create the corresponding.
BinderDescriptor.
@param declarationBinderRef the ServiceReference<DeclarationBinder> of the DeclarationBinder
@throws InvalidFilterException | [
"Add",
"the",
"declarationBinderRef",
"to",
"the",
"ImportersManager",
"create",
"the",
"corresponding",
".",
"BinderDescriptor",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java#L64-L67 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java | LinkerBinderManager.modified | public void modified(ServiceReference<S> declarationBinderRef) throws InvalidFilterException {
declarationBinders.get(declarationBinderRef).update(declarationBinderRef);
} | java | public void modified(ServiceReference<S> declarationBinderRef) throws InvalidFilterException {
declarationBinders.get(declarationBinderRef).update(declarationBinderRef);
} | [
"public",
"void",
"modified",
"(",
"ServiceReference",
"<",
"S",
">",
"declarationBinderRef",
")",
"throws",
"InvalidFilterException",
"{",
"declarationBinders",
".",
"get",
"(",
"declarationBinderRef",
")",
".",
"update",
"(",
"declarationBinderRef",
")",
";",
"}"
... | Update the BinderDescriptor of the declarationBinderRef.
@param declarationBinderRef the ServiceReference<DeclarationBinder> of the DeclarationBinder | [
"Update",
"the",
"BinderDescriptor",
"of",
"the",
"declarationBinderRef",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java#L83-L85 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java | LinkerBinderManager.createLinks | public void createLinks(ServiceReference<S> declarationBinderRef) {
for (D declaration : linkerManagement.getMatchedDeclaration()) {
if (linkerManagement.canBeLinked(declaration, declarationBinderRef)) {
linkerManagement.link(declaration, declarationBinderRef);
}
... | java | public void createLinks(ServiceReference<S> declarationBinderRef) {
for (D declaration : linkerManagement.getMatchedDeclaration()) {
if (linkerManagement.canBeLinked(declaration, declarationBinderRef)) {
linkerManagement.link(declaration, declarationBinderRef);
}
... | [
"public",
"void",
"createLinks",
"(",
"ServiceReference",
"<",
"S",
">",
"declarationBinderRef",
")",
"{",
"for",
"(",
"D",
"declaration",
":",
"linkerManagement",
".",
"getMatchedDeclaration",
"(",
")",
")",
"{",
"if",
"(",
"linkerManagement",
".",
"canBeLinked... | Create all the links possible between the DeclarationBinder and all the ImportDeclaration matching the.
ImportDeclarationFilter of the Linker.
@param declarationBinderRef the ServiceReference<DeclarationBinder> of the DeclarationBinder | [
"Create",
"all",
"the",
"links",
"possible",
"between",
"the",
"DeclarationBinder",
"and",
"all",
"the",
"ImportDeclaration",
"matching",
"the",
".",
"ImportDeclarationFilter",
"of",
"the",
"Linker",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java#L123-L129 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java | LinkerBinderManager.updateLinks | public void updateLinks(ServiceReference<S> serviceReference) {
for (D declaration : linkerManagement.getMatchedDeclaration()) {
boolean isAlreadyLinked = declaration.getStatus().getServiceReferencesBounded().contains(serviceReference);
boolean canBeLinked = linkerManagement.canBeLinked(... | java | public void updateLinks(ServiceReference<S> serviceReference) {
for (D declaration : linkerManagement.getMatchedDeclaration()) {
boolean isAlreadyLinked = declaration.getStatus().getServiceReferencesBounded().contains(serviceReference);
boolean canBeLinked = linkerManagement.canBeLinked(... | [
"public",
"void",
"updateLinks",
"(",
"ServiceReference",
"<",
"S",
">",
"serviceReference",
")",
"{",
"for",
"(",
"D",
"declaration",
":",
"linkerManagement",
".",
"getMatchedDeclaration",
"(",
")",
")",
"{",
"boolean",
"isAlreadyLinked",
"=",
"declaration",
".... | Update all the links of the DeclarationBinder.
@param declarationBinderRef the ServiceReference<DeclarationBinder> of the DeclarationBinder | [
"Update",
"all",
"the",
"links",
"of",
"the",
"DeclarationBinder",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java#L136-L146 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java | LinkerBinderManager.removeLinks | public void removeLinks(ServiceReference<S> declarationBinderRef) {
for (D declaration : linkerManagement.getMatchedDeclaration()) {
if (declaration.getStatus().getServiceReferencesBounded().contains(declarationBinderRef)) {
linkerManagement.unlink(declaration, declarationBinderRef);... | java | public void removeLinks(ServiceReference<S> declarationBinderRef) {
for (D declaration : linkerManagement.getMatchedDeclaration()) {
if (declaration.getStatus().getServiceReferencesBounded().contains(declarationBinderRef)) {
linkerManagement.unlink(declaration, declarationBinderRef);... | [
"public",
"void",
"removeLinks",
"(",
"ServiceReference",
"<",
"S",
">",
"declarationBinderRef",
")",
"{",
"for",
"(",
"D",
"declaration",
":",
"linkerManagement",
".",
"getMatchedDeclaration",
"(",
")",
")",
"{",
"if",
"(",
"declaration",
".",
"getStatus",
"(... | Remove all the existing links of the DeclarationBinder.
@param declarationBinderRef the ServiceReference<DeclarationBinder> of the DeclarationBinder | [
"Remove",
"all",
"the",
"existing",
"links",
"of",
"the",
"DeclarationBinder",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java#L153-L159 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java | LinkerBinderManager.getMatchedDeclarationBinder | public Set<S> getMatchedDeclarationBinder() {
Set<S> bindedSet = new HashSet<S>();
for (Map.Entry<ServiceReference<S>, BinderDescriptor> e : declarationBinders.entrySet()) {
if (e.getValue().match) {
bindedSet.add(getDeclarationBinder(e.getKey()));
}
}
... | java | public Set<S> getMatchedDeclarationBinder() {
Set<S> bindedSet = new HashSet<S>();
for (Map.Entry<ServiceReference<S>, BinderDescriptor> e : declarationBinders.entrySet()) {
if (e.getValue().match) {
bindedSet.add(getDeclarationBinder(e.getKey()));
}
}
... | [
"public",
"Set",
"<",
"S",
">",
"getMatchedDeclarationBinder",
"(",
")",
"{",
"Set",
"<",
"S",
">",
"bindedSet",
"=",
"new",
"HashSet",
"<",
"S",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"ServiceReference",
"<",
"S",
">",
",",
"Bin... | Return a set of all DeclarationBinder matching the DeclarationBinderFilter of the Linker.
@return a Set of all DeclarationBinder matching the DeclarationBinderFilter of the Linker. | [
"Return",
"a",
"set",
"of",
"all",
"DeclarationBinder",
"matching",
"the",
"DeclarationBinderFilter",
"of",
"the",
"Linker",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerBinderManager.java#L166-L174 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java | MyZipUtils.extract | public static List<File> extract(File zipFile, File outputFolder) throws IOException {
List<File> extracted = new ArrayList<File>();
byte[] buffer = new byte[2048];
if (!outputFolder.exists()) {
outputFolder.mkdir();
}
ZipInputStream zipInput = new ZipInputStream(new FileInputStream(zipFile... | java | public static List<File> extract(File zipFile, File outputFolder) throws IOException {
List<File> extracted = new ArrayList<File>();
byte[] buffer = new byte[2048];
if (!outputFolder.exists()) {
outputFolder.mkdir();
}
ZipInputStream zipInput = new ZipInputStream(new FileInputStream(zipFile... | [
"public",
"static",
"List",
"<",
"File",
">",
"extract",
"(",
"File",
"zipFile",
",",
"File",
"outputFolder",
")",
"throws",
"IOException",
"{",
"List",
"<",
"File",
">",
"extracted",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"byte",
"[... | Extracts the zip file to the output folder
@param zipFile ZIP File to extract
@param outputFolder Output Folder
@return A Collection with the extracted files
@throws IOException I/O Error | [
"Extracts",
"the",
"zip",
"file",
"to",
"the",
"output",
"folder"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java#L43-L83 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java | MyZipUtils.validateZip | public static void validateZip(File file) throws IOException {
ZipInputStream zipInput = new ZipInputStream(new FileInputStream(file));
ZipEntry zipEntry = zipInput.getNextEntry();
while (zipEntry != null) {
zipEntry = zipInput.getNextEntry();
}
try {
if (zipInput != null) {
zi... | java | public static void validateZip(File file) throws IOException {
ZipInputStream zipInput = new ZipInputStream(new FileInputStream(file));
ZipEntry zipEntry = zipInput.getNextEntry();
while (zipEntry != null) {
zipEntry = zipInput.getNextEntry();
}
try {
if (zipInput != null) {
zi... | [
"public",
"static",
"void",
"validateZip",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"ZipInputStream",
"zipInput",
"=",
"new",
"ZipInputStream",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
")",
";",
"ZipEntry",
"zipEntry",
"=",
"zipInput",
"... | Checks if a Zip is valid navigating through the entries
@param file File to validate
@throws IOException I/O Error | [
"Checks",
"if",
"a",
"Zip",
"is",
"valid",
"navigating",
"through",
"the",
"entries"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java#L93-L107 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java | MyZipUtils.compress | public static void compress(File dir, File zipFile) throws IOException {
FileOutputStream fos = new FileOutputStream(zipFile);
ZipOutputStream zos = new ZipOutputStream(fos);
recursiveAddZip(dir, zos, dir);
zos.finish();
zos.close();
} | java | public static void compress(File dir, File zipFile) throws IOException {
FileOutputStream fos = new FileOutputStream(zipFile);
ZipOutputStream zos = new ZipOutputStream(fos);
recursiveAddZip(dir, zos, dir);
zos.finish();
zos.close();
} | [
"public",
"static",
"void",
"compress",
"(",
"File",
"dir",
",",
"File",
"zipFile",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"zipFile",
")",
";",
"ZipOutputStream",
"zos",
"=",
"new",
"ZipOutputStream",
... | Compress a directory into a zip file
@param dir Directory
@param zipFile ZIP file to create
@throws IOException I/O Error | [
"Compress",
"a",
"directory",
"into",
"a",
"zip",
"file"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java#L116-L126 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java | MyZipUtils.recursiveAddZip | public static void recursiveAddZip(File parent, ZipOutputStream zout, File fileSource)
throws IOException {
File[] files = fileSource.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
recursiveAddZip(parent, zout, files[i]);
continue;
}
... | java | public static void recursiveAddZip(File parent, ZipOutputStream zout, File fileSource)
throws IOException {
File[] files = fileSource.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
recursiveAddZip(parent, zout, files[i]);
continue;
}
... | [
"public",
"static",
"void",
"recursiveAddZip",
"(",
"File",
"parent",
",",
"ZipOutputStream",
"zout",
",",
"File",
"fileSource",
")",
"throws",
"IOException",
"{",
"File",
"[",
"]",
"files",
"=",
"fileSource",
".",
"listFiles",
"(",
")",
";",
"for",
"(",
"... | Recursively add files to a ZipOutputStream
@param parent Parent file
@param zout ZipOutputStream to append
@param fileSource The file source
@throws IOException I/O Error | [
"Recursively",
"add",
"files",
"to",
"a",
"ZipOutputStream"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyZipUtils.java#L136-L167 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStreamUtils.java | MyStreamUtils.readContent | public static String readContent(InputStream is) {
String ret = "";
try {
String line;
BufferedReader in = new BufferedReader(new InputStreamReader(is));
StringBuffer out = new StringBuffer();
while ((line = in.readLine()) != null) {
out.append(line).append(CARRIAGE_RETURN);
... | java | public static String readContent(InputStream is) {
String ret = "";
try {
String line;
BufferedReader in = new BufferedReader(new InputStreamReader(is));
StringBuffer out = new StringBuffer();
while ((line = in.readLine()) != null) {
out.append(line).append(CARRIAGE_RETURN);
... | [
"public",
"static",
"String",
"readContent",
"(",
"InputStream",
"is",
")",
"{",
"String",
"ret",
"=",
"\"\"",
";",
"try",
"{",
"String",
"line",
";",
"BufferedReader",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"is",
")",
")... | Gets string content from InputStream
@param is InputStream to read
@return InputStream content | [
"Gets",
"string",
"content",
"from",
"InputStream"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStreamUtils.java#L42-L58 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStreamUtils.java | MyStreamUtils.streamHasText | public static boolean streamHasText(InputStream in, String text) {
final byte[] readBuffer = new byte[8192];
StringBuffer sb = new StringBuffer();
try {
if (in.available() > 0) {
int bytesRead = 0;
while ((bytesRead = in.read(readBuffer)) != -1) {
sb.append(new String(readBu... | java | public static boolean streamHasText(InputStream in, String text) {
final byte[] readBuffer = new byte[8192];
StringBuffer sb = new StringBuffer();
try {
if (in.available() > 0) {
int bytesRead = 0;
while ((bytesRead = in.read(readBuffer)) != -1) {
sb.append(new String(readBu... | [
"public",
"static",
"boolean",
"streamHasText",
"(",
"InputStream",
"in",
",",
"String",
"text",
")",
"{",
"final",
"byte",
"[",
"]",
"readBuffer",
"=",
"new",
"byte",
"[",
"8192",
"]",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";"... | Checks if the InputStream have the text
@param in InputStream to read
@param text Text to check
@return whether the inputstream has the text | [
"Checks",
"if",
"the",
"InputStream",
"have",
"the",
"text"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStreamUtils.java#L89-L116 | train |
ow2-chameleon/fuchsia | discoveries/philips-hue/src/main/java/org/ow2/chameleon/fuchsia/discovery/philipshue/PhilipsPreference.java | PhilipsPreference.tryWritePreferenceOnDisk | private static void tryWritePreferenceOnDisk(Preferences preference) throws BackingStoreException {
final String DUMMY_PROP="dummywrite";
instance.put(DUMMY_PROP,"test");
instance.flush();
instance.remove(DUMMY_PROP);
instance.flush();
} | java | private static void tryWritePreferenceOnDisk(Preferences preference) throws BackingStoreException {
final String DUMMY_PROP="dummywrite";
instance.put(DUMMY_PROP,"test");
instance.flush();
instance.remove(DUMMY_PROP);
instance.flush();
} | [
"private",
"static",
"void",
"tryWritePreferenceOnDisk",
"(",
"Preferences",
"preference",
")",
"throws",
"BackingStoreException",
"{",
"final",
"String",
"DUMMY_PROP",
"=",
"\"dummywrite\"",
";",
"instance",
".",
"put",
"(",
"DUMMY_PROP",
",",
"\"test\"",
")",
";",... | This ensures that we are able to use the default preference from JSDK, to check basically if we are in Android or Not
@param preference
@throws BackingStoreException | [
"This",
"ensures",
"that",
"we",
"are",
"able",
"to",
"use",
"the",
"default",
"preference",
"from",
"JSDK",
"to",
"check",
"basically",
"if",
"we",
"are",
"in",
"Android",
"or",
"Not"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/discoveries/philips-hue/src/main/java/org/ow2/chameleon/fuchsia/discovery/philipshue/PhilipsPreference.java#L69-L75 | train |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/link/KNXNetworkLinkFT12.java | KNXNetworkLinkFT12.doSend | private void doSend(byte[] msg, boolean wait, KNXAddress dst)
throws KNXAckTimeoutException, KNXLinkClosedException
{
if (closed)
throw new KNXLinkClosedException("link closed");
try {
logger.info("send message to " + dst + (wait ? ", wait for ack" : ""));
logger.trace("EMI " + DataUnitBuilder.to... | java | private void doSend(byte[] msg, boolean wait, KNXAddress dst)
throws KNXAckTimeoutException, KNXLinkClosedException
{
if (closed)
throw new KNXLinkClosedException("link closed");
try {
logger.info("send message to " + dst + (wait ? ", wait for ack" : ""));
logger.trace("EMI " + DataUnitBuilder.to... | [
"private",
"void",
"doSend",
"(",
"byte",
"[",
"]",
"msg",
",",
"boolean",
"wait",
",",
"KNXAddress",
"dst",
")",
"throws",
"KNXAckTimeoutException",
",",
"KNXLinkClosedException",
"{",
"if",
"(",
"closed",
")",
"throw",
"new",
"KNXLinkClosedException",
"(",
"... | dst is just for log information | [
"dst",
"is",
"just",
"for",
"log",
"information"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/link/KNXNetworkLinkFT12.java#L377-L393 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/SerialMessage.java | SerialMessage.bb2hex | static public String bb2hex(byte[] bb) {
String result = "";
for (int i=0; i<bb.length; i++) {
result = result + String.format("%02X ", bb[i]);
}
return result;
} | java | static public String bb2hex(byte[] bb) {
String result = "";
for (int i=0; i<bb.length; i++) {
result = result + String.format("%02X ", bb[i]);
}
return result;
} | [
"static",
"public",
"String",
"bb2hex",
"(",
"byte",
"[",
"]",
"bb",
")",
"{",
"String",
"result",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bb",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
"=",
"result",
"+",
... | Converts a byte array to a hexadecimal string representation
@param bb the byte array to convert
@return string the string representation | [
"Converts",
"a",
"byte",
"array",
"to",
"a",
"hexadecimal",
"string",
"representation"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/SerialMessage.java#L192-L198 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/SerialMessage.java | SerialMessage.calculateChecksum | private static byte calculateChecksum(byte[] buffer) {
byte checkSum = (byte)0xFF;
for (int i=1; i<buffer.length-1; i++) {
checkSum = (byte) (checkSum ^ buffer[i]);
}
logger.trace(String.format("Calculated checksum = 0x%02X", checkSum));
return checkSum;
} | java | private static byte calculateChecksum(byte[] buffer) {
byte checkSum = (byte)0xFF;
for (int i=1; i<buffer.length-1; i++) {
checkSum = (byte) (checkSum ^ buffer[i]);
}
logger.trace(String.format("Calculated checksum = 0x%02X", checkSum));
return checkSum;
} | [
"private",
"static",
"byte",
"calculateChecksum",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"byte",
"checkSum",
"=",
"(",
"byte",
")",
"0xFF",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"buffer",
".",
"length",
"-",
"1",
";",
"i",
"++... | Calculates a checksum for the specified buffer.
@param buffer the buffer to calculate.
@return the checksum value. | [
"Calculates",
"a",
"checksum",
"for",
"the",
"specified",
"buffer",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/SerialMessage.java#L205-L212 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/SerialMessage.java | SerialMessage.getMessageBuffer | public byte[] getMessageBuffer() {
ByteArrayOutputStream resultByteBuffer = new ByteArrayOutputStream();
byte[] result;
resultByteBuffer.write((byte)0x01);
int messageLength = messagePayload.length +
(this.messageClass == SerialMessageClass.SendData &&
this.messageType == SerialMessageType.Request ? 5... | java | public byte[] getMessageBuffer() {
ByteArrayOutputStream resultByteBuffer = new ByteArrayOutputStream();
byte[] result;
resultByteBuffer.write((byte)0x01);
int messageLength = messagePayload.length +
(this.messageClass == SerialMessageClass.SendData &&
this.messageType == SerialMessageType.Request ? 5... | [
"public",
"byte",
"[",
"]",
"getMessageBuffer",
"(",
")",
"{",
"ByteArrayOutputStream",
"resultByteBuffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"byte",
"[",
"]",
"result",
";",
"resultByteBuffer",
".",
"write",
"(",
"(",
"byte",
")",
"0x01",
... | Gets the SerialMessage as a byte array.
@return the message | [
"Gets",
"the",
"SerialMessage",
"as",
"a",
"byte",
"array",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/SerialMessage.java#L230-L260 | train |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/Settings.java | Settings.getBundle | private static String getBundle(String friendlyName, String className, int truncate)
{
try {
cl.loadClass(className);
int start = className.length();
for (int i = 0; i < truncate; ++i)
start = className.lastIndexOf('.', start - 1);
final String bundle = className.substring(0, start);
retur... | java | private static String getBundle(String friendlyName, String className, int truncate)
{
try {
cl.loadClass(className);
int start = className.length();
for (int i = 0; i < truncate; ++i)
start = className.lastIndexOf('.', start - 1);
final String bundle = className.substring(0, start);
retur... | [
"private",
"static",
"String",
"getBundle",
"(",
"String",
"friendlyName",
",",
"String",
"className",
",",
"int",
"truncate",
")",
"{",
"try",
"{",
"cl",
".",
"loadClass",
"(",
"className",
")",
";",
"int",
"start",
"=",
"className",
".",
"length",
"(",
... | to check availability, then class name is truncated to bundle id | [
"to",
"check",
"availability",
"then",
"class",
"name",
"is",
"truncated",
"to",
"bundle",
"id"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/Settings.java#L188-L201 | train |
ow2-chameleon/fuchsia | importers/jax-ws/src/main/java/org/ow2/chameleon/fuchsia/importer/jaxws/JAXWSImporter.java | JAXWSImporter.registerProxy | protected ServiceRegistration registerProxy(Object objectProxy, Class clazz) {
Dictionary<String, Object> props = new Hashtable<String, Object>();
ServiceRegistration registration;
registration = context.registerService(clazz, objectProxy, props);
return registration;
} | java | protected ServiceRegistration registerProxy(Object objectProxy, Class clazz) {
Dictionary<String, Object> props = new Hashtable<String, Object>();
ServiceRegistration registration;
registration = context.registerService(clazz, objectProxy, props);
return registration;
} | [
"protected",
"ServiceRegistration",
"registerProxy",
"(",
"Object",
"objectProxy",
",",
"Class",
"clazz",
")",
"{",
"Dictionary",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"ServiceR... | Utility method to register a proxy has a Service in OSGi. | [
"Utility",
"method",
"to",
"register",
"a",
"proxy",
"has",
"a",
"Service",
"in",
"OSGi",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/jax-ws/src/main/java/org/ow2/chameleon/fuchsia/importer/jaxws/JAXWSImporter.java#L172-L178 | train |
ow2-chameleon/fuchsia | importers/jax-ws/src/main/java/org/ow2/chameleon/fuchsia/importer/jaxws/JAXWSImporter.java | JAXWSImporter.denyImportDeclaration | @Override
protected void denyImportDeclaration(ImportDeclaration importDeclaration) {
LOG.debug("CXFImporter destroy a proxy for " + importDeclaration);
ServiceRegistration serviceRegistration = map.get(importDeclaration);
serviceRegistration.unregister();
// set the importDeclarati... | java | @Override
protected void denyImportDeclaration(ImportDeclaration importDeclaration) {
LOG.debug("CXFImporter destroy a proxy for " + importDeclaration);
ServiceRegistration serviceRegistration = map.get(importDeclaration);
serviceRegistration.unregister();
// set the importDeclarati... | [
"@",
"Override",
"protected",
"void",
"denyImportDeclaration",
"(",
"ImportDeclaration",
"importDeclaration",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"CXFImporter destroy a proxy for \"",
"+",
"importDeclaration",
")",
";",
"ServiceRegistration",
"serviceRegistration",
"=",
... | Destroy the proxy & update the map containing the registration ref.
@param importDeclaration | [
"Destroy",
"the",
"proxy",
"&",
"update",
"the",
"map",
"containing",
"the",
"registration",
"ref",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/jax-ws/src/main/java/org/ow2/chameleon/fuchsia/importer/jaxws/JAXWSImporter.java#L185-L195 | train |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/generator/ImmutableObjectGenerator.java | ImmutableObjectGenerator.generate | public static Result generate(@Nonnull final String code, @Nonnull final ImmutableSettings settings) {
Check.notNull(code, "code");
final ImmutableSettings.Builder settingsBuilder = new ImmutableSettings.Builder(Check.notNull(settings, "settings"));
final InterfaceAnalysis analysis = InterfaceAnalyzer.analyze(co... | java | public static Result generate(@Nonnull final String code, @Nonnull final ImmutableSettings settings) {
Check.notNull(code, "code");
final ImmutableSettings.Builder settingsBuilder = new ImmutableSettings.Builder(Check.notNull(settings, "settings"));
final InterfaceAnalysis analysis = InterfaceAnalyzer.analyze(co... | [
"public",
"static",
"Result",
"generate",
"(",
"@",
"Nonnull",
"final",
"String",
"code",
",",
"@",
"Nonnull",
"final",
"ImmutableSettings",
"settings",
")",
"{",
"Check",
".",
"notNull",
"(",
"code",
",",
"\"code\"",
")",
";",
"final",
"ImmutableSettings",
... | The specified interface must not contain methods, that changes the state of this object itself.
@param code
source code of an interface which describes how to generate the <i>immutable</i>
@param settings
settings to generate code
@return generated source code as string in a result wrapper | [
"The",
"specified",
"interface",
"must",
"not",
"contain",
"methods",
"that",
"changes",
"the",
"state",
"of",
"this",
"object",
"itself",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/generator/ImmutableObjectGenerator.java#L109-L128 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyClasspathUtils.java | MyClasspathUtils.addJarToClasspath | public static void addJarToClasspath(ClassLoader loader, URL url) throws IOException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException {
URLClassLoader sysloader = (URLClassLoader) loader;
Class<?> sysclass = URLClassLoader.class;
... | java | public static void addJarToClasspath(ClassLoader loader, URL url) throws IOException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException {
URLClassLoader sysloader = (URLClassLoader) loader;
Class<?> sysclass = URLClassLoader.class;
... | [
"public",
"static",
"void",
"addJarToClasspath",
"(",
"ClassLoader",
"loader",
",",
"URL",
"url",
")",
"throws",
"IOException",
",",
"IllegalAccessException",
",",
"IllegalArgumentException",
",",
"InvocationTargetException",
",",
"NoSuchMethodException",
",",
"SecurityEx... | Add an URL to the given classloader
@param loader ClassLoader
@param url URL to add
@throws IOException I/O Error
@throws InvocationTargetException Invocation Error
@throws IllegalArgumentException Illegal Argument
@throws IllegalAccessException Illegal Access
@throws SecurityException Security Constraint
@throws NoSu... | [
"Add",
"an",
"URL",
"to",
"the",
"given",
"classloader"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyClasspathUtils.java#L44-L55 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveNode.java | ZWaveNode.resetResendCount | public void resetResendCount() {
this.resendCount = 0;
if (this.initializationComplete)
this.nodeStage = NodeStage.NODEBUILDINFO_DONE;
this.lastUpdated = Calendar.getInstance().getTime();
} | java | public void resetResendCount() {
this.resendCount = 0;
if (this.initializationComplete)
this.nodeStage = NodeStage.NODEBUILDINFO_DONE;
this.lastUpdated = Calendar.getInstance().getTime();
} | [
"public",
"void",
"resetResendCount",
"(",
")",
"{",
"this",
".",
"resendCount",
"=",
"0",
";",
"if",
"(",
"this",
".",
"initializationComplete",
")",
"this",
".",
"nodeStage",
"=",
"NodeStage",
".",
"NODEBUILDINFO_DONE",
";",
"this",
".",
"lastUpdated",
"="... | Resets the resend counter and possibly resets the
node stage to DONE when previous initialization was
complete. | [
"Resets",
"the",
"resend",
"counter",
"and",
"possibly",
"resets",
"the",
"node",
"stage",
"to",
"DONE",
"when",
"previous",
"initialization",
"was",
"complete",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveNode.java#L339-L344 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveNode.java | ZWaveNode.addCommandClass | public void addCommandClass(ZWaveCommandClass commandClass)
{
ZWaveCommandClass.CommandClass key = commandClass.getCommandClass();
if (!supportedCommandClasses.containsKey(key)) {
supportedCommandClasses.put(key, commandClass);
if (commandClass instanceof ZWaveEventListener)
this.controller.addEve... | java | public void addCommandClass(ZWaveCommandClass commandClass)
{
ZWaveCommandClass.CommandClass key = commandClass.getCommandClass();
if (!supportedCommandClasses.containsKey(key)) {
supportedCommandClasses.put(key, commandClass);
if (commandClass instanceof ZWaveEventListener)
this.controller.addEve... | [
"public",
"void",
"addCommandClass",
"(",
"ZWaveCommandClass",
"commandClass",
")",
"{",
"ZWaveCommandClass",
".",
"CommandClass",
"key",
"=",
"commandClass",
".",
"getCommandClass",
"(",
")",
";",
"if",
"(",
"!",
"supportedCommandClasses",
".",
"containsKey",
"(",
... | Adds a command class to the list of supported command classes by this node.
Does nothing if command class is already added.
@param commandClass the command class instance to add. | [
"Adds",
"a",
"command",
"class",
"to",
"the",
"list",
"of",
"supported",
"command",
"classes",
"by",
"this",
"node",
".",
"Does",
"nothing",
"if",
"command",
"class",
"is",
"already",
"added",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveNode.java#L387-L399 | train |
usc/wechat-mp-sdk | wechat-mp-web/src/main/java/org/usc/wechat/mp/web/util/WebUtil.java | WebUtil.getPostString | public static String getPostString(InputStream is, String encoding) {
try {
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw, encoding);
return sw.toString();
} catch (IOException e) {
// no op
return null;
} finally {
... | java | public static String getPostString(InputStream is, String encoding) {
try {
StringWriter sw = new StringWriter();
IOUtils.copy(is, sw, encoding);
return sw.toString();
} catch (IOException e) {
// no op
return null;
} finally {
... | [
"public",
"static",
"String",
"getPostString",
"(",
"InputStream",
"is",
",",
"String",
"encoding",
")",
"{",
"try",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"IOUtils",
".",
"copy",
"(",
"is",
",",
"sw",
",",
"encoding",
")",... | get string from post stream
@param is
@param encoding
@return | [
"get",
"string",
"from",
"post",
"stream"
] | 39d9574a8e3ffa3b61f88b4bef534d93645a825f | https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-web/src/main/java/org/usc/wechat/mp/web/util/WebUtil.java#L35-L47 | train |
usc/wechat-mp-sdk | wechat-mp-web/src/main/java/org/usc/wechat/mp/web/util/WebUtil.java | WebUtil.outputString | public static void outputString(final HttpServletResponse response, final Object obj) {
try {
response.setContentType("text/javascript");
response.setCharacterEncoding("utf-8");
disableCache(response);
response.getWriter().write(obj.toString());
respon... | java | public static void outputString(final HttpServletResponse response, final Object obj) {
try {
response.setContentType("text/javascript");
response.setCharacterEncoding("utf-8");
disableCache(response);
response.getWriter().write(obj.toString());
respon... | [
"public",
"static",
"void",
"outputString",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"Object",
"obj",
")",
"{",
"try",
"{",
"response",
".",
"setContentType",
"(",
"\"text/javascript\"",
")",
";",
"response",
".",
"setCharacterEncoding",
"(",... | response simple String
@param response
@param obj | [
"response",
"simple",
"String"
] | 39d9574a8e3ffa3b61f88b4bef534d93645a825f | https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-web/src/main/java/org/usc/wechat/mp/web/util/WebUtil.java#L55-L65 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/StokesEinsteinConverter.java | StokesEinsteinConverter.convert | public double convert(double value, double temperatur, double viscosity){
return temperatur*kB / (Math.PI*viscosity*value);
} | java | public double convert(double value, double temperatur, double viscosity){
return temperatur*kB / (Math.PI*viscosity*value);
} | [
"public",
"double",
"convert",
"(",
"double",
"value",
",",
"double",
"temperatur",
",",
"double",
"viscosity",
")",
"{",
"return",
"temperatur",
"*",
"kB",
"/",
"(",
"Math",
".",
"PI",
"*",
"viscosity",
"*",
"value",
")",
";",
"}"
] | Converters the diffusion coefficient to hydrodynamic diameter and vice versa
@param value Diffusion coefficient in [m^2 s^-1] or hydrodynamic diameter in [m]
@param temperatur Temperatur in [Kelvin]
@param viscosity Viscosity in [kg m^-1 s^-1]
@return Hydrodynmaic diameter [m] / diffusion coefficient [m^2 s^-1] | [
"Converters",
"the",
"diffusion",
"coefficient",
"to",
"hydrodynamic",
"diameter",
"and",
"vice",
"versa"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/StokesEinsteinConverter.java#L44-L46 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/reflection/MyReflectionUtils.java | MyReflectionUtils.buildInstanceForMap | public static <T> T buildInstanceForMap(Class<T> clazz, Map<String, Object> values)
throws InstantiationException, IllegalAccessException, IntrospectionException,
IllegalArgumentException, InvocationTargetException {
return buildInstanceForMap(clazz, values, new MyDefaultReflectionDifferenceHandler());
... | java | public static <T> T buildInstanceForMap(Class<T> clazz, Map<String, Object> values)
throws InstantiationException, IllegalAccessException, IntrospectionException,
IllegalArgumentException, InvocationTargetException {
return buildInstanceForMap(clazz, values, new MyDefaultReflectionDifferenceHandler());
... | [
"public",
"static",
"<",
"T",
">",
"T",
"buildInstanceForMap",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
",",
"IntrospectionException",
... | Builds a instance of the class for a map containing the values, without specifying the handler for differences
@param clazz The class to build instance
@param values The values map
@return The instance
@throws InstantiationException Error instantiating
@throws IllegalAccessException Access error
@throws IntrospectionE... | [
"Builds",
"a",
"instance",
"of",
"the",
"class",
"for",
"a",
"map",
"containing",
"the",
"values",
"without",
"specifying",
"the",
"handler",
"for",
"differences"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/reflection/MyReflectionUtils.java#L48-L52 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/reflection/MyReflectionUtils.java | MyReflectionUtils.buildInstanceForMap | public static <T> T buildInstanceForMap(Class<T> clazz, Map<String, Object> values, MyReflectionDifferenceHandler differenceHandler)
throws InstantiationException, IllegalAccessException, IntrospectionException,
IllegalArgumentException, InvocationTargetException {
log.debug("Building new instance of C... | java | public static <T> T buildInstanceForMap(Class<T> clazz, Map<String, Object> values, MyReflectionDifferenceHandler differenceHandler)
throws InstantiationException, IllegalAccessException, IntrospectionException,
IllegalArgumentException, InvocationTargetException {
log.debug("Building new instance of C... | [
"public",
"static",
"<",
"T",
">",
"T",
"buildInstanceForMap",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
",",
"MyReflectionDifferenceHandler",
"differenceHandler",
")",
"throws",
"InstantiationException",
",",... | Builds a instance of the class for a map containing the values
@param clazz Class to build
@param values Values map
@param differenceHandler The difference handler
@return The created instance
@throws InstantiationException Error instantiating
@throws IllegalAccessException Access error
@throws IntrospectionException ... | [
"Builds",
"a",
"instance",
"of",
"the",
"class",
"for",
"a",
"map",
"containing",
"the",
"values"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/reflection/MyReflectionUtils.java#L68-L106 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/FuchsiaUtils.java | FuchsiaUtils.getExportedPackage | private static BundleCapability getExportedPackage(BundleContext context, String packageName) {
List<BundleCapability> packages = new ArrayList<BundleCapability>();
for (Bundle bundle : context.getBundles()) {
BundleRevision bundleRevision = bundle.adapt(BundleRevision.class);
fo... | java | private static BundleCapability getExportedPackage(BundleContext context, String packageName) {
List<BundleCapability> packages = new ArrayList<BundleCapability>();
for (Bundle bundle : context.getBundles()) {
BundleRevision bundleRevision = bundle.adapt(BundleRevision.class);
fo... | [
"private",
"static",
"BundleCapability",
"getExportedPackage",
"(",
"BundleContext",
"context",
",",
"String",
"packageName",
")",
"{",
"List",
"<",
"BundleCapability",
">",
"packages",
"=",
"new",
"ArrayList",
"<",
"BundleCapability",
">",
"(",
")",
";",
"for",
... | Return the BundleCapability of a bundle exporting the package packageName.
@param context The BundleContext
@param packageName The package name
@return the BundleCapability of a bundle exporting the package packageName | [
"Return",
"the",
"BundleCapability",
"of",
"a",
"bundle",
"exporting",
"the",
"package",
"packageName",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/FuchsiaUtils.java#L83-L106 | train |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/xml/def/DefaultEntityResolver.java | DefaultEntityResolver.readXMLDeclaration | private String[] readXMLDeclaration(Reader r) throws KNXMLException
{
final StringBuffer buf = new StringBuffer(100);
try {
for (int c = 0; (c = r.read()) != -1 && c != '?';)
buf.append((char) c);
}
catch (final IOException e) {
throw new KNXMLException("reading XML declaration, " + e.getMess... | java | private String[] readXMLDeclaration(Reader r) throws KNXMLException
{
final StringBuffer buf = new StringBuffer(100);
try {
for (int c = 0; (c = r.read()) != -1 && c != '?';)
buf.append((char) c);
}
catch (final IOException e) {
throw new KNXMLException("reading XML declaration, " + e.getMess... | [
"private",
"String",
"[",
"]",
"readXMLDeclaration",
"(",
"Reader",
"r",
")",
"throws",
"KNXMLException",
"{",
"final",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"100",
")",
";",
"try",
"{",
"for",
"(",
"int",
"c",
"=",
"0",
";",
"(",
"c"... | returns array with length 3 and optional entries version, encoding, standalone | [
"returns",
"array",
"with",
"length",
"3",
"and",
"optional",
"entries",
"version",
"encoding",
"standalone"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/xml/def/DefaultEntityResolver.java#L233-L271 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/declaration/DeclarationImpl.java | DeclarationImpl.fetchServiceId | private Long fetchServiceId(ServiceReference serviceReference) {
return (Long) serviceReference.getProperty(org.osgi.framework.Constants.SERVICE_ID);
} | java | private Long fetchServiceId(ServiceReference serviceReference) {
return (Long) serviceReference.getProperty(org.osgi.framework.Constants.SERVICE_ID);
} | [
"private",
"Long",
"fetchServiceId",
"(",
"ServiceReference",
"serviceReference",
")",
"{",
"return",
"(",
"Long",
")",
"serviceReference",
".",
"getProperty",
"(",
"org",
".",
"osgi",
".",
"framework",
".",
"Constants",
".",
"SERVICE_ID",
")",
";",
"}"
] | Returns the service id with the propertype.
@param serviceReference
@return long value for the service id | [
"Returns",
"the",
"service",
"id",
"with",
"the",
"propertype",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/declaration/DeclarationImpl.java#L141-L143 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveDeviceClass.java | ZWaveDeviceClass.setSpecificDeviceClass | public void setSpecificDeviceClass(Specific specificDeviceClass) throws IllegalArgumentException {
// The specific Device class does not match the generic device class.
if (specificDeviceClass.genericDeviceClass != Generic.NOT_KNOWN &&
specificDeviceClass.genericDeviceClass != this.genericDeviceClass)
... | java | public void setSpecificDeviceClass(Specific specificDeviceClass) throws IllegalArgumentException {
// The specific Device class does not match the generic device class.
if (specificDeviceClass.genericDeviceClass != Generic.NOT_KNOWN &&
specificDeviceClass.genericDeviceClass != this.genericDeviceClass)
... | [
"public",
"void",
"setSpecificDeviceClass",
"(",
"Specific",
"specificDeviceClass",
")",
"throws",
"IllegalArgumentException",
"{",
"// The specific Device class does not match the generic device class.\r",
"if",
"(",
"specificDeviceClass",
".",
"genericDeviceClass",
"!=",
"Generic... | Set the specific device class of the node.
@param specificDeviceClass the specificDeviceClass to set
@exception IllegalArgumentException thrown when the specific device class does not match
the generic device class. | [
"Set",
"the",
"specific",
"device",
"class",
"of",
"the",
"node",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveDeviceClass.java#L134-L142 | train |
ow2-chameleon/fuchsia | examples/jax-ws/weatherForecast/weather-ws-impl/src/main/java/org/ow2/chameleon/fuchsia/examples/jaxws/weather/impl/WeatherForeCastWSImpl.java | WeatherForeCastWSImpl.parseRssFeed | private String parseRssFeed(String feed) {
String[] result = feed.split("<br />");
String[] result2 = result[2].split("<BR />");
return result2[0];
} | java | private String parseRssFeed(String feed) {
String[] result = feed.split("<br />");
String[] result2 = result[2].split("<BR />");
return result2[0];
} | [
"private",
"String",
"parseRssFeed",
"(",
"String",
"feed",
")",
"{",
"String",
"[",
"]",
"result",
"=",
"feed",
".",
"split",
"(",
"\"<br />\"",
")",
";",
"String",
"[",
"]",
"result2",
"=",
"result",
"[",
"2",
"]",
".",
"split",
"(",
"\"<BR />\"",
... | Parser for actual conditions
@param feed
@return | [
"Parser",
"for",
"actual",
"conditions"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/examples/jax-ws/weatherForecast/weather-ws-impl/src/main/java/org/ow2/chameleon/fuchsia/examples/jaxws/weather/impl/WeatherForeCastWSImpl.java#L136-L141 | train |
ow2-chameleon/fuchsia | examples/jax-ws/weatherForecast/weather-ws-impl/src/main/java/org/ow2/chameleon/fuchsia/examples/jaxws/weather/impl/WeatherForeCastWSImpl.java | WeatherForeCastWSImpl.parseRssFeedForeCast | private List<String> parseRssFeedForeCast(String feed) {
String[] result = feed.split("<br />");
List<String> returnList = new ArrayList<String>();
String[] result2 = result[2].split("<BR />");
returnList.add(result2[3] + "\n");
returnList.add(result[3] + "\n");
returnLi... | java | private List<String> parseRssFeedForeCast(String feed) {
String[] result = feed.split("<br />");
List<String> returnList = new ArrayList<String>();
String[] result2 = result[2].split("<BR />");
returnList.add(result2[3] + "\n");
returnList.add(result[3] + "\n");
returnLi... | [
"private",
"List",
"<",
"String",
">",
"parseRssFeedForeCast",
"(",
"String",
"feed",
")",
"{",
"String",
"[",
"]",
"result",
"=",
"feed",
".",
"split",
"(",
"\"<br />\"",
")",
";",
"List",
"<",
"String",
">",
"returnList",
"=",
"new",
"ArrayList",
"<",
... | Parser for forecast
@param feed
@return | [
"Parser",
"for",
"forecast"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/examples/jax-ws/weatherForecast/weather-ws-impl/src/main/java/org/ow2/chameleon/fuchsia/examples/jaxws/weather/impl/WeatherForeCastWSImpl.java#L149-L161 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveAlarmSensorCommandClass.java | ZWaveAlarmSensorCommandClass.getMessage | public SerialMessage getMessage(AlarmType alarmType) {
logger.debug("Creating new message for application command SENSOR_ALARM_GET for node {}", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessage.SerialMessageClass.SendData, SerialMessage.SerialMessageT... | java | public SerialMessage getMessage(AlarmType alarmType) {
logger.debug("Creating new message for application command SENSOR_ALARM_GET for node {}", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessage.SerialMessageClass.SendData, SerialMessage.SerialMessageT... | [
"public",
"SerialMessage",
"getMessage",
"(",
"AlarmType",
"alarmType",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating new message for application command SENSOR_ALARM_GET for node {}\"",
",",
"this",
".",
"getNode",
"(",
")",
".",
"getNodeId",
"(",
")",
")",
";",... | Gets a SerialMessage with the SENSOR_ALARM_GET command
@return the serial message | [
"Gets",
"a",
"SerialMessage",
"with",
"the",
"SENSOR_ALARM_GET",
"command"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveAlarmSensorCommandClass.java#L221-L231 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveAlarmSensorCommandClass.java | ZWaveAlarmSensorCommandClass.getSupportedMessage | public SerialMessage getSupportedMessage() {
logger.debug("Creating new message for application command SENSOR_ALARM_SUPPORTED_GET for node {}", this.getNode().getNodeId());
if (this.getNode().getManufacturer() == 0x010F && this.getNode().getDeviceType() == 0x0501) {
logger.warn("Detected Fibaro FGBS001 U... | java | public SerialMessage getSupportedMessage() {
logger.debug("Creating new message for application command SENSOR_ALARM_SUPPORTED_GET for node {}", this.getNode().getNodeId());
if (this.getNode().getManufacturer() == 0x010F && this.getNode().getDeviceType() == 0x0501) {
logger.warn("Detected Fibaro FGBS001 U... | [
"public",
"SerialMessage",
"getSupportedMessage",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating new message for application command SENSOR_ALARM_SUPPORTED_GET for node {}\"",
",",
"this",
".",
"getNode",
"(",
")",
".",
"getNodeId",
"(",
")",
")",
";",
"if",
... | Gets a SerialMessage with the SENSOR_ALARM_SUPPORTED_GET command
@return the serial message, or null if the supported command is not supported. | [
"Gets",
"a",
"SerialMessage",
"with",
"the",
"SENSOR_ALARM_SUPPORTED_GET",
"command"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveAlarmSensorCommandClass.java#L237-L252 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.