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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
kiswanij/jk-util | src/main/java/com/jk/util/JKObjectUtil.java | JKObjectUtil.getGenericClassFromParent | public static Class getGenericClassFromParent(Object parent) {
return (Class) ((ParameterizedType) parent.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
} | java | public static Class getGenericClassFromParent(Object parent) {
return (Class) ((ParameterizedType) parent.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
} | [
"public",
"static",
"Class",
"getGenericClassFromParent",
"(",
"Object",
"parent",
")",
"{",
"return",
"(",
"Class",
")",
"(",
"(",
"ParameterizedType",
")",
"parent",
".",
"getClass",
"(",
")",
".",
"getGenericSuperclass",
"(",
")",
")",
".",
"getActualTypeAr... | Gets the generic class from parent.
@param parent the parent
@return the generic class from parent | [
"Gets",
"the",
"generic",
"class",
"from",
"parent",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L910-L912 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKFormatUtil.java | JKFormatUtil.formatDouble | public static String formatDouble(final Double amount, String pattern) {
if (pattern == null || pattern.equals("")) {
pattern = JKFormatUtil.DEFAULT_DOUBLE_FORMAT;
}
return JKFormatUtil.getNumberFormatter(pattern).format(amount);
} | java | public static String formatDouble(final Double amount, String pattern) {
if (pattern == null || pattern.equals("")) {
pattern = JKFormatUtil.DEFAULT_DOUBLE_FORMAT;
}
return JKFormatUtil.getNumberFormatter(pattern).format(amount);
} | [
"public",
"static",
"String",
"formatDouble",
"(",
"final",
"Double",
"amount",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
"||",
"pattern",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"pattern",
"=",
"JKFormatUtil",
".",
"DEFA... | Format double.
@param amount the amount
@param pattern the pattern
@return the string | [
"Format",
"double",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKFormatUtil.java#L110-L115 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKFormatUtil.java | JKFormatUtil.formatTime | public synchronized static String formatTime(final Time object, String pattern) {
if (pattern == null || pattern.equals("")) {
pattern = JKFormatUtil.DEFAULT_TIME_PATTERN;
}
return JKFormatUtil.getDateFormatter(pattern).format(object);
} | java | public synchronized static String formatTime(final Time object, String pattern) {
if (pattern == null || pattern.equals("")) {
pattern = JKFormatUtil.DEFAULT_TIME_PATTERN;
}
return JKFormatUtil.getDateFormatter(pattern).format(object);
} | [
"public",
"synchronized",
"static",
"String",
"formatTime",
"(",
"final",
"Time",
"object",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
"||",
"pattern",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"pattern",
"=",
"JKFormatUtil",
... | Format time.
@param object the object
@param pattern the pattern
@return the string | [
"Format",
"time",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKFormatUtil.java#L124-L129 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKFormatUtil.java | JKFormatUtil.formatTimeStamp | public synchronized static String formatTimeStamp(final Timestamp date, String pattern) {
if (pattern == null || pattern.equals("")) {
pattern = JKFormatUtil.DEFAULT_TIMESTAMP_PATTERN;
}
return JKFormatUtil.getDateFormatter(pattern).format(date);
} | java | public synchronized static String formatTimeStamp(final Timestamp date, String pattern) {
if (pattern == null || pattern.equals("")) {
pattern = JKFormatUtil.DEFAULT_TIMESTAMP_PATTERN;
}
return JKFormatUtil.getDateFormatter(pattern).format(date);
} | [
"public",
"synchronized",
"static",
"String",
"formatTimeStamp",
"(",
"final",
"Timestamp",
"date",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
"||",
"pattern",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"pattern",
"=",
"JKForma... | Format time stamp.
@param date the date
@param pattern the pattern
@return the string | [
"Format",
"time",
"stamp",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKFormatUtil.java#L138-L143 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKFormatUtil.java | JKFormatUtil.getDateFormatter | public static Format getDateFormatter(final String pattern) {
Format format = JKFormatUtil.formatMap.get(pattern);
if (format == null) {
format = new SimpleDateFormat(pattern);
JKFormatUtil.formatMap.put(pattern, format);
}
return format;
} | java | public static Format getDateFormatter(final String pattern) {
Format format = JKFormatUtil.formatMap.get(pattern);
if (format == null) {
format = new SimpleDateFormat(pattern);
JKFormatUtil.formatMap.put(pattern, format);
}
return format;
} | [
"public",
"static",
"Format",
"getDateFormatter",
"(",
"final",
"String",
"pattern",
")",
"{",
"Format",
"format",
"=",
"JKFormatUtil",
".",
"formatMap",
".",
"get",
"(",
"pattern",
")",
";",
"if",
"(",
"format",
"==",
"null",
")",
"{",
"format",
"=",
"n... | Gets the date formatter.
@param pattern the pattern
@return the date formatter | [
"Gets",
"the",
"date",
"formatter",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKFormatUtil.java#L151-L158 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKFormatUtil.java | JKFormatUtil.getNumberFormatter | public static Format getNumberFormatter(final String pattern) {
Format format = JKFormatUtil.formatMap.get(pattern);
if (format == null) {
format = new DecimalFormat(pattern);
JKFormatUtil.formatMap.put(pattern, format);
}
return format;
} | java | public static Format getNumberFormatter(final String pattern) {
Format format = JKFormatUtil.formatMap.get(pattern);
if (format == null) {
format = new DecimalFormat(pattern);
JKFormatUtil.formatMap.put(pattern, format);
}
return format;
} | [
"public",
"static",
"Format",
"getNumberFormatter",
"(",
"final",
"String",
"pattern",
")",
"{",
"Format",
"format",
"=",
"JKFormatUtil",
".",
"formatMap",
".",
"get",
"(",
"pattern",
")",
";",
"if",
"(",
"format",
"==",
"null",
")",
"{",
"format",
"=",
... | Gets the number formatter.
@param pattern the pattern
@return the number formatter | [
"Gets",
"the",
"number",
"formatter",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKFormatUtil.java#L166-L173 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKFormatUtil.java | JKFormatUtil.formatNumber | public static String formatNumber(Number count) {
Format numberFormatter = getNumberFormatter(DEFAULT_NUMBER_FORMAT);
return numberFormatter.format(count);
} | java | public static String formatNumber(Number count) {
Format numberFormatter = getNumberFormatter(DEFAULT_NUMBER_FORMAT);
return numberFormatter.format(count);
} | [
"public",
"static",
"String",
"formatNumber",
"(",
"Number",
"count",
")",
"{",
"Format",
"numberFormatter",
"=",
"getNumberFormatter",
"(",
"DEFAULT_NUMBER_FORMAT",
")",
";",
"return",
"numberFormatter",
".",
"format",
"(",
"count",
")",
";",
"}"
] | Format number.
@param count the count
@return the string | [
"Format",
"number",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKFormatUtil.java#L181-L184 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.parseDate | public static java.util.Date parseDate(String strDate, String pattern) {
try {
SimpleDateFormat parser = new SimpleDateFormat(pattern, Locale.US);
return parser.parse(strDate);
} catch (ParseException e) {
throw new JKException(e);
}
} | java | public static java.util.Date parseDate(String strDate, String pattern) {
try {
SimpleDateFormat parser = new SimpleDateFormat(pattern, Locale.US);
return parser.parse(strDate);
} catch (ParseException e) {
throw new JKException(e);
}
} | [
"public",
"static",
"java",
".",
"util",
".",
"Date",
"parseDate",
"(",
"String",
"strDate",
",",
"String",
"pattern",
")",
"{",
"try",
"{",
"SimpleDateFormat",
"parser",
"=",
"new",
"SimpleDateFormat",
"(",
"pattern",
",",
"Locale",
".",
"US",
")",
";",
... | Parses the date.
@param strDate the str date
@param pattern the pattern
@return the java.util. date | [
"Parses",
"the",
"date",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L61-L68 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getYearFromData | public static int getYearFromData(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.YEAR);
} | java | public static int getYearFromData(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.YEAR);
} | [
"public",
"static",
"int",
"getYearFromData",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"cal",
".",
"get",
"(",
"Calendar",
".",
"YEAR",... | Gets the year from data.
@param date Date
@return int | [
"Gets",
"the",
"year",
"from",
"data",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L129-L133 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.isTimesEqaualed | public static boolean isTimesEqaualed(Date time1, Date time2) {
return formatTime(time1).equals(formatTime(time2));
} | java | public static boolean isTimesEqaualed(Date time1, Date time2) {
return formatTime(time1).equals(formatTime(time2));
} | [
"public",
"static",
"boolean",
"isTimesEqaualed",
"(",
"Date",
"time1",
",",
"Date",
"time2",
")",
"{",
"return",
"formatTime",
"(",
"time1",
")",
".",
"equals",
"(",
"formatTime",
"(",
"time2",
")",
")",
";",
"}"
] | Checks if is times eqaualed.
@param time1 the time 1
@param time2 the time 2
@return true, if is times eqaualed | [
"Checks",
"if",
"is",
"times",
"eqaualed",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L164-L166 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getNumOfMonths | public static int getNumOfMonths(Date date1, Date date2) {
Calendar firstDate = Calendar.getInstance();
Date date = new Date(date1.getTime());
firstDate.setTime(date);
Calendar secondDate = Calendar.getInstance();
Date date3 = new Date(date2.getTime());
secondDate.setTime(date3);
int months = firstDate.get(Calendar.MONTH) - secondDate.get(Calendar.MONTH);
return months;
} | java | public static int getNumOfMonths(Date date1, Date date2) {
Calendar firstDate = Calendar.getInstance();
Date date = new Date(date1.getTime());
firstDate.setTime(date);
Calendar secondDate = Calendar.getInstance();
Date date3 = new Date(date2.getTime());
secondDate.setTime(date3);
int months = firstDate.get(Calendar.MONTH) - secondDate.get(Calendar.MONTH);
return months;
} | [
"public",
"static",
"int",
"getNumOfMonths",
"(",
"Date",
"date1",
",",
"Date",
"date2",
")",
"{",
"Calendar",
"firstDate",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"Date",
"date",
"=",
"new",
"Date",
"(",
"date1",
".",
"getTime",
"(",
")",
... | Gets the num of months.
@param date1 the date 1
@param date2 the date 2
@return the num of months | [
"Gets",
"the",
"num",
"of",
"months",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L175-L185 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.compareTwoDates | public static CompareDates compareTwoDates(Date date1, Date date2) {
Date d1 = new Date(date1.getTime());// to unify the format of the dates
// before the compare
Date d2 = new Date(date2.getTime());
if (d1.compareTo(d2) < 0)
return CompareDates.DATE1_LESS_THAN_DATE2;
else if (d1.compareTo(d2) > 0)
return CompareDates.DATE1_GREATER_THAN_DATE2;
else
return CompareDates.DATE1_EQUAL_DATE2;
} | java | public static CompareDates compareTwoDates(Date date1, Date date2) {
Date d1 = new Date(date1.getTime());// to unify the format of the dates
// before the compare
Date d2 = new Date(date2.getTime());
if (d1.compareTo(d2) < 0)
return CompareDates.DATE1_LESS_THAN_DATE2;
else if (d1.compareTo(d2) > 0)
return CompareDates.DATE1_GREATER_THAN_DATE2;
else
return CompareDates.DATE1_EQUAL_DATE2;
} | [
"public",
"static",
"CompareDates",
"compareTwoDates",
"(",
"Date",
"date1",
",",
"Date",
"date2",
")",
"{",
"Date",
"d1",
"=",
"new",
"Date",
"(",
"date1",
".",
"getTime",
"(",
")",
")",
";",
"// to unify the format of the dates\r",
"// before the compare\r",
"... | Compare two dates.
@param date1 the date 1
@param date2 the date 2
@return the compare dates | [
"Compare",
"two",
"dates",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L203-L213 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.adddDaysToCurrentDate | public static Date adddDaysToCurrentDate(int numberOfDays) {
Date date = new Date();
Calendar instance = Calendar.getInstance();
instance.setTime(date);
instance.add(Calendar.DATE, numberOfDays);
return instance.getTime();
} | java | public static Date adddDaysToCurrentDate(int numberOfDays) {
Date date = new Date();
Calendar instance = Calendar.getInstance();
instance.setTime(date);
instance.add(Calendar.DATE, numberOfDays);
return instance.getTime();
} | [
"public",
"static",
"Date",
"adddDaysToCurrentDate",
"(",
"int",
"numberOfDays",
")",
"{",
"Date",
"date",
"=",
"new",
"Date",
"(",
")",
";",
"Calendar",
"instance",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"instance",
".",
"setTime",
"(",
"date... | Addd days to current date.
@param numberOfDays the number of days
@return the date | [
"Addd",
"days",
"to",
"current",
"date",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L221-L227 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.isDate | public static boolean isDate(String strDate, String pattern) {
try {
parseDate(strDate, pattern);
return true;
} catch (Exception e) {
return false;
}
} | java | public static boolean isDate(String strDate, String pattern) {
try {
parseDate(strDate, pattern);
return true;
} catch (Exception e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isDate",
"(",
"String",
"strDate",
",",
"String",
"pattern",
")",
"{",
"try",
"{",
"parseDate",
"(",
"strDate",
",",
"pattern",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"f... | Checks if is date.
@param strDate the str date
@param pattern the pattern
@return true, if is date | [
"Checks",
"if",
"is",
"date",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L236-L243 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.addMonths | public static Date addMonths(Date date, int numOfMonths) {
Calendar instance = Calendar.getInstance();
instance.setTime(date);
instance.add(Calendar.MONTH, numOfMonths);
return instance.getTime();
} | java | public static Date addMonths(Date date, int numOfMonths) {
Calendar instance = Calendar.getInstance();
instance.setTime(date);
instance.add(Calendar.MONTH, numOfMonths);
return instance.getTime();
} | [
"public",
"static",
"Date",
"addMonths",
"(",
"Date",
"date",
",",
"int",
"numOfMonths",
")",
"{",
"Calendar",
"instance",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"instance",
".",
"setTime",
"(",
"date",
")",
";",
"instance",
".",
"add",
"(",... | Adds the months.
@param date the date
@param numOfMonths the num of months
@return the date | [
"Adds",
"the",
"months",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L262-L267 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getDifference | public static long getDifference(Time timeFrom, Time timeTo) {
try {
DateFormat format = new SimpleDateFormat("HH:mm:ss");
// the a means am/pm marker
Date date = format.parse(timeFrom.toString());
Date date2 = format.parse(timeTo.toString());
long difference = (date2.getTime() - date.getTime()) / 1000 / 60;
return difference;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static long getDifference(Time timeFrom, Time timeTo) {
try {
DateFormat format = new SimpleDateFormat("HH:mm:ss");
// the a means am/pm marker
Date date = format.parse(timeFrom.toString());
Date date2 = format.parse(timeTo.toString());
long difference = (date2.getTime() - date.getTime()) / 1000 / 60;
return difference;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"long",
"getDifference",
"(",
"Time",
"timeFrom",
",",
"Time",
"timeTo",
")",
"{",
"try",
"{",
"DateFormat",
"format",
"=",
"new",
"SimpleDateFormat",
"(",
"\"HH:mm:ss\"",
")",
";",
"// the a means am/pm marker\r",
"Date",
"date",
"=",
"forma... | Gets the difference.
@param timeFrom the time from
@param timeTo the time to
@return the difference | [
"Gets",
"the",
"difference",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L276-L287 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getDayOfMonth | private static int getDayOfMonth(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_MONTH);
} | java | private static int getDayOfMonth(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_MONTH);
} | [
"private",
"static",
"int",
"getDayOfMonth",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"cal",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_... | Gets the day of month.
@param date the date
@return the day of month | [
"Gets",
"the",
"day",
"of",
"month",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L305-L309 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getDayOfWeek | public static int getDayOfWeek(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_WEEK);
} | java | public static int getDayOfWeek(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_WEEK);
} | [
"public",
"static",
"int",
"getDayOfWeek",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"return",
"cal",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_WE... | Gets the day of week.
@param date the date
@return the day of week | [
"Gets",
"the",
"day",
"of",
"week",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L317-L321 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getHour | public static int getHour(Date timeFrom) {
Calendar instance = Calendar.getInstance();
instance.setTime(timeFrom);
int hour = instance.get(Calendar.HOUR);
return hour;
} | java | public static int getHour(Date timeFrom) {
Calendar instance = Calendar.getInstance();
instance.setTime(timeFrom);
int hour = instance.get(Calendar.HOUR);
return hour;
} | [
"public",
"static",
"int",
"getHour",
"(",
"Date",
"timeFrom",
")",
"{",
"Calendar",
"instance",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"instance",
".",
"setTime",
"(",
"timeFrom",
")",
";",
"int",
"hour",
"=",
"instance",
".",
"get",
"(",
... | Gets the hour.
@param timeFrom the time from
@return the hour | [
"Gets",
"the",
"hour",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L362-L368 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.isCurrentTimeBetweenTowTimes | public static boolean isCurrentTimeBetweenTowTimes(Date fromDate, Date fromTime, Date toDate, Date timeTo) {
JKTimeObject currntTime = getCurrntTime();
JKTimeObject fromTimeObject = new JKTimeObject();
JKTimeObject toTimeObject = new JKTimeObject();
if (currntTime.after(fromTimeObject.toTimeObject(fromDate, fromTime)) && currntTime.before(toTimeObject.toTimeObject(toDate, timeTo))) {
return true;
}
return false;
} | java | public static boolean isCurrentTimeBetweenTowTimes(Date fromDate, Date fromTime, Date toDate, Date timeTo) {
JKTimeObject currntTime = getCurrntTime();
JKTimeObject fromTimeObject = new JKTimeObject();
JKTimeObject toTimeObject = new JKTimeObject();
if (currntTime.after(fromTimeObject.toTimeObject(fromDate, fromTime)) && currntTime.before(toTimeObject.toTimeObject(toDate, timeTo))) {
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isCurrentTimeBetweenTowTimes",
"(",
"Date",
"fromDate",
",",
"Date",
"fromTime",
",",
"Date",
"toDate",
",",
"Date",
"timeTo",
")",
"{",
"JKTimeObject",
"currntTime",
"=",
"getCurrntTime",
"(",
")",
";",
"JKTimeObject",
"fromTimeObj... | Checks if is current time between tow times.
@param fromDate the from date
@param fromTime the from time
@param toDate the to date
@param timeTo the time to
@return true, if is current time between tow times | [
"Checks",
"if",
"is",
"current",
"time",
"between",
"tow",
"times",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L394-L402 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getDayDifference | public static long getDayDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffDays = TimeUnit.MILLISECONDS.toDays(diffTime);
return diffDays;
} | java | public static long getDayDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffDays = TimeUnit.MILLISECONDS.toDays(diffTime);
return diffDays;
} | [
"public",
"static",
"long",
"getDayDifference",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"startTime",
"=",
"startDate",
".",
"getTime",
"(",
")",
";",
"long",
"endTime",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
"d... | Gets the day difference.
@param startDate the start date
@param endDate the end date
@return the day difference | [
"Gets",
"the",
"day",
"difference",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L427-L433 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getSecondsDifference | public static long getSecondsDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInSeconds = TimeUnit.MILLISECONDS.toSeconds(diffTime);
return diffInSeconds;
} | java | public static long getSecondsDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInSeconds = TimeUnit.MILLISECONDS.toSeconds(diffTime);
return diffInSeconds;
} | [
"public",
"static",
"long",
"getSecondsDifference",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"startTime",
"=",
"startDate",
".",
"getTime",
"(",
")",
";",
"long",
"endTime",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
... | Gets the seconds difference.
@param startDate the start date
@param endDate the end date
@return the seconds difference | [
"Gets",
"the",
"seconds",
"difference",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L442-L448 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getHoursDifference | public static long getHoursDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInHours = TimeUnit.MILLISECONDS.toHours(diffTime);
return diffInHours;
} | java | public static long getHoursDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInHours = TimeUnit.MILLISECONDS.toHours(diffTime);
return diffInHours;
} | [
"public",
"static",
"long",
"getHoursDifference",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"startTime",
"=",
"startDate",
".",
"getTime",
"(",
")",
";",
"long",
"endTime",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
... | Gets the hours difference.
@param startDate the start date
@param endDate the end date
@return the hours difference | [
"Gets",
"the",
"hours",
"difference",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L457-L463 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getMillisDifference | public static long getMillisDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
return diffTime;
} | java | public static long getMillisDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
return diffTime;
} | [
"public",
"static",
"long",
"getMillisDifference",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"startTime",
"=",
"startDate",
".",
"getTime",
"(",
")",
";",
"long",
"endTime",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
... | Gets the millis difference.
@param startDate the start date
@param endDate the end date
@return the millis difference | [
"Gets",
"the",
"millis",
"difference",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L472-L477 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getMinutesDifference | public static long getMinutesDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(diffTime);
return diffInMinutes;
} | java | public static long getMinutesDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(diffTime);
return diffInMinutes;
} | [
"public",
"static",
"long",
"getMinutesDifference",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"startTime",
"=",
"startDate",
".",
"getTime",
"(",
")",
";",
"long",
"endTime",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
... | Gets the minutes difference.
@param startDate the start date
@param endDate the end date
@return the minutes difference | [
"Gets",
"the",
"minutes",
"difference",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L486-L492 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.isDateEqaualed | public static boolean isDateEqaualed(final java.util.Date date1, final java.util.Date date2) {
final String d1 = JKFormatUtil.formatDate(date1, JKFormatUtil.MYSQL_DATE_DB_PATTERN);
final String d2 = JKFormatUtil.formatDate(date2, JKFormatUtil.MYSQL_DATE_DB_PATTERN);
return d1.equalsIgnoreCase(d2);
} | java | public static boolean isDateEqaualed(final java.util.Date date1, final java.util.Date date2) {
final String d1 = JKFormatUtil.formatDate(date1, JKFormatUtil.MYSQL_DATE_DB_PATTERN);
final String d2 = JKFormatUtil.formatDate(date2, JKFormatUtil.MYSQL_DATE_DB_PATTERN);
return d1.equalsIgnoreCase(d2);
} | [
"public",
"static",
"boolean",
"isDateEqaualed",
"(",
"final",
"java",
".",
"util",
".",
"Date",
"date1",
",",
"final",
"java",
".",
"util",
".",
"Date",
"date2",
")",
"{",
"final",
"String",
"d1",
"=",
"JKFormatUtil",
".",
"formatDate",
"(",
"date1",
",... | Checks if is date eqaualed.
@param date1 the date 1
@param date2 the date 2
@return true, if is date eqaualed | [
"Checks",
"if",
"is",
"date",
"eqaualed",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L514-L518 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.isPeriodActive | public static boolean isPeriodActive(final Date startDate, final Date endDate) {
if (startDate == null && endDate == null) {
return true;
}
if (startDate == null) {
throw new JKException("START_DATE_CAN_NOT_BE_NULL");
}
if (endDate == null) {
throw new JKException("END_DATE_CAN_NOT_BE_NULL");
}
if (compareTwoDates(startDate, endDate).equals(CompareDates.DATE1_GREATER_THAN_DATE2)) {
throw new JKException("START_DATE_MUST_BE_BEFORE_END_DATE");
}
final boolean startLessThanCurrent = compareTwoDates(startDate, getSystemDate()).equals(CompareDates.DATE1_LESS_THAN_DATE2);
final boolean endGreaterThanCurrent = compareTwoDates(endDate, getSystemDate()).equals(CompareDates.DATE1_GREATER_THAN_DATE2);
return startLessThanCurrent && endGreaterThanCurrent;
} | java | public static boolean isPeriodActive(final Date startDate, final Date endDate) {
if (startDate == null && endDate == null) {
return true;
}
if (startDate == null) {
throw new JKException("START_DATE_CAN_NOT_BE_NULL");
}
if (endDate == null) {
throw new JKException("END_DATE_CAN_NOT_BE_NULL");
}
if (compareTwoDates(startDate, endDate).equals(CompareDates.DATE1_GREATER_THAN_DATE2)) {
throw new JKException("START_DATE_MUST_BE_BEFORE_END_DATE");
}
final boolean startLessThanCurrent = compareTwoDates(startDate, getSystemDate()).equals(CompareDates.DATE1_LESS_THAN_DATE2);
final boolean endGreaterThanCurrent = compareTwoDates(endDate, getSystemDate()).equals(CompareDates.DATE1_GREATER_THAN_DATE2);
return startLessThanCurrent && endGreaterThanCurrent;
} | [
"public",
"static",
"boolean",
"isPeriodActive",
"(",
"final",
"Date",
"startDate",
",",
"final",
"Date",
"endDate",
")",
"{",
"if",
"(",
"startDate",
"==",
"null",
"&&",
"endDate",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"startDat... | Checks if is period active.
@param startDate the start date
@param endDate the end date
@return true, if is period active | [
"Checks",
"if",
"is",
"period",
"active",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L527-L543 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java | MoleculePropertyCalculator.buildMolecule | private static List<AbstractMolecule> buildMolecule(HELM2Notation helm2notation) throws BuilderMoleculeException, ChemistryException {
return BuilderMolecule.buildMoleculefromPolymers(helm2notation.getListOfPolymers(), HELM2NotationUtils.getAllEdgeConnections(helm2notation.getListOfConnections()));
} | java | private static List<AbstractMolecule> buildMolecule(HELM2Notation helm2notation) throws BuilderMoleculeException, ChemistryException {
return BuilderMolecule.buildMoleculefromPolymers(helm2notation.getListOfPolymers(), HELM2NotationUtils.getAllEdgeConnections(helm2notation.getListOfConnections()));
} | [
"private",
"static",
"List",
"<",
"AbstractMolecule",
">",
"buildMolecule",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"BuilderMoleculeException",
",",
"ChemistryException",
"{",
"return",
"BuilderMolecule",
".",
"buildMoleculefromPolymers",
"(",
"helm2notation",... | method to build from one notation one molecule
@throws BuilderMoleculeException
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"method",
"to",
"build",
"from",
"one",
"notation",
"one",
"molecule"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java#L67-L69 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java | MoleculePropertyCalculator.getMolecularWeight | public static double getMolecularWeight(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, ChemistryException {
/* First build one big molecule; List of molecules? */
List<AbstractMolecule> molecules = buildMolecule(helm2notation);
return calculateMolecularWeight(molecules);
} | java | public static double getMolecularWeight(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, ChemistryException {
/* First build one big molecule; List of molecules? */
List<AbstractMolecule> molecules = buildMolecule(helm2notation);
return calculateMolecularWeight(molecules);
} | [
"public",
"static",
"double",
"getMolecularWeight",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ChemistryException",
"{",
"/* First build one big molecule; List of molecules? */",
"List",
"<",
"AbstractMolecule",
... | method to get the molecular weight for the whole HELM
@param helm2notation input HELM2Notation
@return MolecularWeight of the whole HELM
@throws BuilderMoleculeException if the whole molecule can not be built
@throws CTKException general ChemToolKit exception passed to HELMToolKit
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"method",
"to",
"get",
"the",
"molecular",
"weight",
"for",
"the",
"whole",
"HELM"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java#L80-L84 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java | MoleculePropertyCalculator.calculateMolecularWeight | private static double calculateMolecularWeight(List<AbstractMolecule> molecules) throws BuilderMoleculeException, CTKException, ChemistryException {
Double result = 0.0;
for (AbstractMolecule molecule : molecules) {
molecule = BuilderMolecule.mergeRgroups(molecule);
result += Chemistry.getInstance().getManipulator().getMoleculeInfo(molecule).getMolecularWeight();
}
return result;
} | java | private static double calculateMolecularWeight(List<AbstractMolecule> molecules) throws BuilderMoleculeException, CTKException, ChemistryException {
Double result = 0.0;
for (AbstractMolecule molecule : molecules) {
molecule = BuilderMolecule.mergeRgroups(molecule);
result += Chemistry.getInstance().getManipulator().getMoleculeInfo(molecule).getMolecularWeight();
}
return result;
} | [
"private",
"static",
"double",
"calculateMolecularWeight",
"(",
"List",
"<",
"AbstractMolecule",
">",
"molecules",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ChemistryException",
"{",
"Double",
"result",
"=",
"0.0",
";",
"for",
"(",
"Abstr... | intern method to calculate the molecular weight for a list of molecules
@param molecules
@return
@throws BuilderMoleculeException
@throws CTKException
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"intern",
"method",
"to",
"calculate",
"the",
"molecular",
"weight",
"for",
"a",
"list",
"of",
"molecules"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java#L95-L102 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java | MoleculePropertyCalculator.getExactMass | public static double getExactMass(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, ChemistryException {
/* First build one big molecule; List of molecules */
List<AbstractMolecule> molecules = buildMolecule(helm2notation);
return calculateExactMass(molecules);
} | java | public static double getExactMass(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, ChemistryException {
/* First build one big molecule; List of molecules */
List<AbstractMolecule> molecules = buildMolecule(helm2notation);
return calculateExactMass(molecules);
} | [
"public",
"static",
"double",
"getExactMass",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ChemistryException",
"{",
"/* First build one big molecule; List of molecules */",
"List",
"<",
"AbstractMolecule",
">",
... | method to get the ExactMass for the whole HELM
@param helm2notation input HELM2Notation
@return ExactMass of the whole HELM
@throws BuilderMoleculeException if the whole molecule can not be built
@throws CTKException general ChemToolKit exception passed to HELMToolKit
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"method",
"to",
"get",
"the",
"ExactMass",
"for",
"the",
"whole",
"HELM"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java#L113-L117 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java | MoleculePropertyCalculator.calculateExactMass | private static double calculateExactMass(List<AbstractMolecule> molecules) throws CTKException, ChemistryException, BuilderMoleculeException {
Double result = 0.0;
for (AbstractMolecule molecule : molecules) {
molecule = BuilderMolecule.mergeRgroups(molecule);
result += Chemistry.getInstance().getManipulator().getMoleculeInfo(molecule).getExactMass();
}
return result;
} | java | private static double calculateExactMass(List<AbstractMolecule> molecules) throws CTKException, ChemistryException, BuilderMoleculeException {
Double result = 0.0;
for (AbstractMolecule molecule : molecules) {
molecule = BuilderMolecule.mergeRgroups(molecule);
result += Chemistry.getInstance().getManipulator().getMoleculeInfo(molecule).getExactMass();
}
return result;
} | [
"private",
"static",
"double",
"calculateExactMass",
"(",
"List",
"<",
"AbstractMolecule",
">",
"molecules",
")",
"throws",
"CTKException",
",",
"ChemistryException",
",",
"BuilderMoleculeException",
"{",
"Double",
"result",
"=",
"0.0",
";",
"for",
"(",
"AbstractMol... | intern method to calculate the exact mass for a list of molecules
@param molecules
@return
@throws CTKException
@throws ChemistryException if the Chemistry Engine can not be initialized
@throws BuilderMoleculeException | [
"intern",
"method",
"to",
"calculate",
"the",
"exact",
"mass",
"for",
"a",
"list",
"of",
"molecules"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java#L128-L135 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java | MoleculePropertyCalculator.getMolecularFormular | public static String getMolecularFormular(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, ChemistryException {
/* First build HELM molecule */
List<AbstractMolecule> molecules = buildMolecule(helm2notation);
LOG.info("Build process is finished");
return calculateMolecularFormula(molecules);
} | java | public static String getMolecularFormular(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, ChemistryException {
/* First build HELM molecule */
List<AbstractMolecule> molecules = buildMolecule(helm2notation);
LOG.info("Build process is finished");
return calculateMolecularFormula(molecules);
} | [
"public",
"static",
"String",
"getMolecularFormular",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ChemistryException",
"{",
"/* First build HELM molecule */",
"List",
"<",
"AbstractMolecule",
">",
"molecules",
... | method to get the MolecularFormular for the whole HELM
@param helm2notation input HELM2Notation
@return MolecularFormular of the whole HELM
@throws BuilderMoleculeException if the whole molecule can not be built
@throws CTKException general ChemToolKit exception passed to HELMToolKit
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"method",
"to",
"get",
"the",
"MolecularFormular",
"for",
"the",
"whole",
"HELM"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java#L146-L151 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java | MoleculePropertyCalculator.calculateMolecularFormula | private static String calculateMolecularFormula(List<AbstractMolecule> molecules) throws BuilderMoleculeException, CTKException, ChemistryException {
Map<String, Integer> atomNumberMap = new TreeMap<String, Integer>();
for (AbstractMolecule molecule : molecules) {
LOG.info(molecule.getMolecule().toString());
atomNumberMap = generateAtomNumberMap(molecule, atomNumberMap);
}
LOG.info("GET map");
StringBuilder sb = new StringBuilder();
Set<String> atoms = atomNumberMap.keySet();
for (Iterator<String> i = atoms.iterator(); i.hasNext();) {
String atom = i.next();
String num = atomNumberMap.get(atom).toString();
if (num.equals("1")) {
num = "";
}
sb.append(atom);
sb.append(num.toString());
}
return sb.toString();
} | java | private static String calculateMolecularFormula(List<AbstractMolecule> molecules) throws BuilderMoleculeException, CTKException, ChemistryException {
Map<String, Integer> atomNumberMap = new TreeMap<String, Integer>();
for (AbstractMolecule molecule : molecules) {
LOG.info(molecule.getMolecule().toString());
atomNumberMap = generateAtomNumberMap(molecule, atomNumberMap);
}
LOG.info("GET map");
StringBuilder sb = new StringBuilder();
Set<String> atoms = atomNumberMap.keySet();
for (Iterator<String> i = atoms.iterator(); i.hasNext();) {
String atom = i.next();
String num = atomNumberMap.get(atom).toString();
if (num.equals("1")) {
num = "";
}
sb.append(atom);
sb.append(num.toString());
}
return sb.toString();
} | [
"private",
"static",
"String",
"calculateMolecularFormula",
"(",
"List",
"<",
"AbstractMolecule",
">",
"molecules",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ChemistryException",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"atomNumberMa... | intern method to calculate the molecular formular for a list of molecules
@param molecules
@return
@throws BuilderMoleculeException
@throws CTKException
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"intern",
"method",
"to",
"calculate",
"the",
"molecular",
"formular",
"for",
"a",
"list",
"of",
"molecules"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java#L162-L181 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java | MoleculePropertyCalculator.getMoleculeProperties | public static MoleculeProperty getMoleculeProperties(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, ExtinctionCoefficientException, ChemistryException {
MoleculeProperty result = new MoleculeProperty();
/* First build HELM molecule */
List<AbstractMolecule> molecules = buildMolecule(helm2notation);
/* calculate molecular formula */
result.setMolecularFormula(calculateMolecularFormula(molecules));
/* calculate molecular weight */
result.setMolecularWeight(calculateMolecularWeight(molecules));
/* calculate exact mass */
result.setExactMass(calculateExactMass(molecules));
/* add Extinction Coefficient calculation to it */
result.setExtinctionCoefficient(ExtinctionCoefficient.getInstance().calculate(helm2notation));
return result;
} | java | public static MoleculeProperty getMoleculeProperties(HELM2Notation helm2notation) throws BuilderMoleculeException, CTKException, ExtinctionCoefficientException, ChemistryException {
MoleculeProperty result = new MoleculeProperty();
/* First build HELM molecule */
List<AbstractMolecule> molecules = buildMolecule(helm2notation);
/* calculate molecular formula */
result.setMolecularFormula(calculateMolecularFormula(molecules));
/* calculate molecular weight */
result.setMolecularWeight(calculateMolecularWeight(molecules));
/* calculate exact mass */
result.setExactMass(calculateExactMass(molecules));
/* add Extinction Coefficient calculation to it */
result.setExtinctionCoefficient(ExtinctionCoefficient.getInstance().calculate(helm2notation));
return result;
} | [
"public",
"static",
"MoleculeProperty",
"getMoleculeProperties",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ExtinctionCoefficientException",
",",
"ChemistryException",
"{",
"MoleculeProperty",
"result",
"=",
"n... | method to get all molecule properties for one HELM2Notation
@param helm2notation given HELM2 object
@return List of molecule properties: molecular formula, molecular weight,
exact mass, extinction coefficient
@throws BuilderMoleculeException if helm molecule can not be built
@throws CTKException general ChemToolKit exception passed to HELMToolKit
@throws ExtinctionCoefficientException if the extinction coefficient can not be calculated
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"method",
"to",
"get",
"all",
"molecule",
"properties",
"for",
"one",
"HELM2Notation"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java#L194-L208 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java | MoleculePropertyCalculator.generateAtomNumberMap | private static Map<String, Integer> generateAtomNumberMap(AbstractMolecule molecule, Map<String, Integer> mapAtoms) throws BuilderMoleculeException, CTKException, ChemistryException {
molecule = BuilderMolecule.mergeRgroups(molecule);
LOG.info("Merge group is finished");
String formula = Chemistry.getInstance().getManipulator().getMoleculeInfo(molecule).getMolecularFormula();
String atom = "";
String number = "";
for (int i = 0; i < formula.length(); i++) {
String oneChar = String.valueOf(formula.charAt(i));
if (oneChar.matches("[A-Z]")) {
if (atom.length() == 0) {
atom = oneChar;
} else {
if (number == "") {
number = "1";
}
if (mapAtoms.get(atom) != null) {
mapAtoms.put(atom, mapAtoms.get(atom) + Integer.valueOf(number));
} else {
mapAtoms.put(atom, Integer.valueOf(number));
}
atom = oneChar;
number = "";
}
} else if (oneChar.matches("[a-z]")) {
if (atom.length() > 0) {
atom = atom + oneChar;
}
} else {
if (number.length() == 0) {
number = oneChar;
} else {
number = number + oneChar;
}
}
}
if (number == "") {
number = "1";
}
if (mapAtoms.get(atom) != null) {
mapAtoms.put(atom, mapAtoms.get(atom) + Integer.valueOf(number));
} else {
mapAtoms.put(atom, Integer.valueOf(number));
}
return mapAtoms;
} | java | private static Map<String, Integer> generateAtomNumberMap(AbstractMolecule molecule, Map<String, Integer> mapAtoms) throws BuilderMoleculeException, CTKException, ChemistryException {
molecule = BuilderMolecule.mergeRgroups(molecule);
LOG.info("Merge group is finished");
String formula = Chemistry.getInstance().getManipulator().getMoleculeInfo(molecule).getMolecularFormula();
String atom = "";
String number = "";
for (int i = 0; i < formula.length(); i++) {
String oneChar = String.valueOf(formula.charAt(i));
if (oneChar.matches("[A-Z]")) {
if (atom.length() == 0) {
atom = oneChar;
} else {
if (number == "") {
number = "1";
}
if (mapAtoms.get(atom) != null) {
mapAtoms.put(atom, mapAtoms.get(atom) + Integer.valueOf(number));
} else {
mapAtoms.put(atom, Integer.valueOf(number));
}
atom = oneChar;
number = "";
}
} else if (oneChar.matches("[a-z]")) {
if (atom.length() > 0) {
atom = atom + oneChar;
}
} else {
if (number.length() == 0) {
number = oneChar;
} else {
number = number + oneChar;
}
}
}
if (number == "") {
number = "1";
}
if (mapAtoms.get(atom) != null) {
mapAtoms.put(atom, mapAtoms.get(atom) + Integer.valueOf(number));
} else {
mapAtoms.put(atom, Integer.valueOf(number));
}
return mapAtoms;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"Integer",
">",
"generateAtomNumberMap",
"(",
"AbstractMolecule",
"molecule",
",",
"Map",
"<",
"String",
",",
"Integer",
">",
"mapAtoms",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"Chemistr... | method to get for every atom the number of occurences
@param molecule input Molecule
@param mapAtoms Map of atoms with the number its occurences
@return Map of atoms with the number of its occurences
@throws BuilderMoleculeException if the Rgroups of the molecule can not be
merged into it
@throws CTKException
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"method",
"to",
"get",
"for",
"every",
"atom",
"the",
"number",
"of",
"occurences"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/calculation/MoleculePropertyCalculator.java#L221-L270 | train |
entrusc/Pi-RC-Switch | src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java | RCSwitch.switchOff | public void switchOff(BitSet switchGroupAddress, int switchCode) {
if (switchGroupAddress.length() > 5) {
throw new IllegalArgumentException("switch group address has more than 5 bits!");
}
this.sendTriState(this.getCodeWordA(switchGroupAddress, switchCode, false));
} | java | public void switchOff(BitSet switchGroupAddress, int switchCode) {
if (switchGroupAddress.length() > 5) {
throw new IllegalArgumentException("switch group address has more than 5 bits!");
}
this.sendTriState(this.getCodeWordA(switchGroupAddress, switchCode, false));
} | [
"public",
"void",
"switchOff",
"(",
"BitSet",
"switchGroupAddress",
",",
"int",
"switchCode",
")",
"{",
"if",
"(",
"switchGroupAddress",
".",
"length",
"(",
")",
">",
"5",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"switch group address has more ... | Switch a remote switch off
@param switchGroupAddress Code of the switch group (refers to DIP
switches 1..5 where "1" = on and "0" = off, if all DIP switches are on
it's "11111")
@param switchCode Number of the switch itself (1..4 for A..D) | [
"Switch",
"a",
"remote",
"switch",
"off"
] | 3a7433074a3382154cfc31c086eee75e928aced7 | https://github.com/entrusc/Pi-RC-Switch/blob/3a7433074a3382154cfc31c086eee75e928aced7/src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java#L104-L109 | train |
entrusc/Pi-RC-Switch | src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java | RCSwitch.send | public void send(final String bitString) {
BitSet bitSet = new BitSet(bitString.length());
for (int i = 0; i < bitString.length(); i++) {
if (bitString.charAt(i) == '1') {
bitSet.set(i);
}
}
send(bitSet, bitString.length());
} | java | public void send(final String bitString) {
BitSet bitSet = new BitSet(bitString.length());
for (int i = 0; i < bitString.length(); i++) {
if (bitString.charAt(i) == '1') {
bitSet.set(i);
}
}
send(bitSet, bitString.length());
} | [
"public",
"void",
"send",
"(",
"final",
"String",
"bitString",
")",
"{",
"BitSet",
"bitSet",
"=",
"new",
"BitSet",
"(",
"bitString",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bitString",
".",
"length",
"("... | Send a string of bits
@param bitString Bits (e.g. 000000000001010100010001) | [
"Send",
"a",
"string",
"of",
"bits"
] | 3a7433074a3382154cfc31c086eee75e928aced7 | https://github.com/entrusc/Pi-RC-Switch/blob/3a7433074a3382154cfc31c086eee75e928aced7/src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java#L136-L144 | train |
entrusc/Pi-RC-Switch | src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java | RCSwitch.send | public void send(final BitSet bitSet, int length) {
if (transmitterPin != null) {
for (int nRepeat = 0; nRepeat < repeatTransmit; nRepeat++) {
for (int i = 0; i < length; i++) {
if (bitSet.get(i)) {
transmit(protocol.getOneBit());
} else {
transmit(protocol.getZeroBit());
}
}
sendSync();
}
transmitterPin.low();
}
} | java | public void send(final BitSet bitSet, int length) {
if (transmitterPin != null) {
for (int nRepeat = 0; nRepeat < repeatTransmit; nRepeat++) {
for (int i = 0; i < length; i++) {
if (bitSet.get(i)) {
transmit(protocol.getOneBit());
} else {
transmit(protocol.getZeroBit());
}
}
sendSync();
}
transmitterPin.low();
}
} | [
"public",
"void",
"send",
"(",
"final",
"BitSet",
"bitSet",
",",
"int",
"length",
")",
"{",
"if",
"(",
"transmitterPin",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"nRepeat",
"=",
"0",
";",
"nRepeat",
"<",
"repeatTransmit",
";",
"nRepeat",
"++",
")",
... | Send a set of bits
@param bitSet Bits (000000000001010100010001)
@param length Length of the bit string (24) | [
"Send",
"a",
"set",
"of",
"bits"
] | 3a7433074a3382154cfc31c086eee75e928aced7 | https://github.com/entrusc/Pi-RC-Switch/blob/3a7433074a3382154cfc31c086eee75e928aced7/src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java#L152-L166 | train |
entrusc/Pi-RC-Switch | src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java | RCSwitch.sendTriState | public void sendTriState(String codeWord) {
if (transmitterPin != null) {
for (int nRepeat = 0; nRepeat < repeatTransmit; nRepeat++) {
for (int i = 0; i < codeWord.length(); ++i) {
switch (codeWord.charAt(i)) {
case '0':
this.sendT0();
break;
case 'F':
this.sendTF();
break;
case '1':
this.sendT1();
break;
}
}
this.sendSync();
}
transmitterPin.low();
}
} | java | public void sendTriState(String codeWord) {
if (transmitterPin != null) {
for (int nRepeat = 0; nRepeat < repeatTransmit; nRepeat++) {
for (int i = 0; i < codeWord.length(); ++i) {
switch (codeWord.charAt(i)) {
case '0':
this.sendT0();
break;
case 'F':
this.sendTF();
break;
case '1':
this.sendT1();
break;
}
}
this.sendSync();
}
transmitterPin.low();
}
} | [
"public",
"void",
"sendTriState",
"(",
"String",
"codeWord",
")",
"{",
"if",
"(",
"transmitterPin",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"nRepeat",
"=",
"0",
";",
"nRepeat",
"<",
"repeatTransmit",
";",
"nRepeat",
"++",
")",
"{",
"for",
"(",
"int"... | Sends a Code Word
@param codeWord /^[10FS]*$/ -> see getCodeWord | [
"Sends",
"a",
"Code",
"Word"
] | 3a7433074a3382154cfc31c086eee75e928aced7 | https://github.com/entrusc/Pi-RC-Switch/blob/3a7433074a3382154cfc31c086eee75e928aced7/src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java#L254-L274 | train |
entrusc/Pi-RC-Switch | src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java | RCSwitch.getSwitchGroupAddress | public static BitSet getSwitchGroupAddress(String address) {
if (address.length() != 5) {
throw new IllegalArgumentException("the switchGroupAddress must consist of exactly 5 bits!");
}
BitSet bitSet = new BitSet(5);
for (int i = 0; i < 5; i++) {
bitSet.set(i, address.charAt(i) == '1');
}
return bitSet;
} | java | public static BitSet getSwitchGroupAddress(String address) {
if (address.length() != 5) {
throw new IllegalArgumentException("the switchGroupAddress must consist of exactly 5 bits!");
}
BitSet bitSet = new BitSet(5);
for (int i = 0; i < 5; i++) {
bitSet.set(i, address.charAt(i) == '1');
}
return bitSet;
} | [
"public",
"static",
"BitSet",
"getSwitchGroupAddress",
"(",
"String",
"address",
")",
"{",
"if",
"(",
"address",
".",
"length",
"(",
")",
"!=",
"5",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"the switchGroupAddress must consist of exactly 5 bits!\""... | convenient method to convert a string like "11011" to a BitSet.
@param address the string representation of the rc address
@return a bitset containing the address that can be used for
switchOn()/switchOff() | [
"convenient",
"method",
"to",
"convert",
"a",
"string",
"like",
"11011",
"to",
"a",
"BitSet",
"."
] | 3a7433074a3382154cfc31c086eee75e928aced7 | https://github.com/entrusc/Pi-RC-Switch/blob/3a7433074a3382154cfc31c086eee75e928aced7/src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java#L334-L343 | train |
demidenko05/beige-uml | beige-uml-swing/src/main/java/org/beigesoft/uml/service/swing/CreatorDoclet.java | CreatorDoclet.start | public static boolean start(RootDoc root) throws Exception {
umlProject = null;
mainGui = null;
Standard.start(root);
setOptions(root);
openOrCreateUmlProject(root);
generateUml(root);
return true;
} | java | public static boolean start(RootDoc root) throws Exception {
umlProject = null;
mainGui = null;
Standard.start(root);
setOptions(root);
openOrCreateUmlProject(root);
generateUml(root);
return true;
} | [
"public",
"static",
"boolean",
"start",
"(",
"RootDoc",
"root",
")",
"throws",
"Exception",
"{",
"umlProject",
"=",
"null",
";",
"mainGui",
"=",
"null",
";",
"Standard",
".",
"start",
"(",
"root",
")",
";",
"setOptions",
"(",
"root",
")",
";",
"openOrCre... | Standard doclet start method
@param root
@return
@throws Exception | [
"Standard",
"doclet",
"start",
"method"
] | 65f6024fa944e10875d9a3be3e4a586bede39683 | https://github.com/demidenko05/beige-uml/blob/65f6024fa944e10875d9a3be3e4a586bede39683/beige-uml-swing/src/main/java/org/beigesoft/uml/service/swing/CreatorDoclet.java#L80-L88 | train |
demidenko05/beige-uml | beige-uml-swing/src/main/java/org/beigesoft/uml/service/swing/CreatorDoclet.java | CreatorDoclet.optionLength | public static int optionLength(String option) {
int result = Standard.optionLength(option);
if(result == 0) {
if(option.equals(OPTION_PATH_UML_PROJECT)) {
result = 2;
}
}
return result;
} | java | public static int optionLength(String option) {
int result = Standard.optionLength(option);
if(result == 0) {
if(option.equals(OPTION_PATH_UML_PROJECT)) {
result = 2;
}
}
return result;
} | [
"public",
"static",
"int",
"optionLength",
"(",
"String",
"option",
")",
"{",
"int",
"result",
"=",
"Standard",
".",
"optionLength",
"(",
"option",
")",
";",
"if",
"(",
"result",
"==",
"0",
")",
"{",
"if",
"(",
"option",
".",
"equals",
"(",
"OPTION_PAT... | Standard doclet method
must be present!
@param option
@return | [
"Standard",
"doclet",
"method",
"must",
"be",
"present!"
] | 65f6024fa944e10875d9a3be3e4a586bede39683 | https://github.com/demidenko05/beige-uml/blob/65f6024fa944e10875d9a3be3e4a586bede39683/beige-uml-swing/src/main/java/org/beigesoft/uml/service/swing/CreatorDoclet.java#L96-L104 | train |
kiswanij/jk-util | src/main/java/com/jk/util/validation/Problems.java | Problems.add | public final void add(final String problem, final Severity severity) {
this.problems.add(new Problem(problem, severity));
this.hasFatal |= severity == Severity.FATAL;
} | java | public final void add(final String problem, final Severity severity) {
this.problems.add(new Problem(problem, severity));
this.hasFatal |= severity == Severity.FATAL;
} | [
"public",
"final",
"void",
"add",
"(",
"final",
"String",
"problem",
",",
"final",
"Severity",
"severity",
")",
"{",
"this",
".",
"problems",
".",
"add",
"(",
"new",
"Problem",
"(",
"problem",
",",
"severity",
")",
")",
";",
"this",
".",
"hasFatal",
"|... | Add a problem with the specified severity.
@param problem the message
@param severity the severity | [
"Add",
"a",
"problem",
"with",
"the",
"specified",
"severity",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/validation/Problems.java#L62-L65 | train |
kiswanij/jk-util | src/main/java/com/jk/util/validation/Problems.java | Problems.getLeadProblem | public final Problem getLeadProblem() {
Collections.sort(this.problems);
return this.problems.isEmpty() ? null : this.problems.get(this.problems.size() - 1);
} | java | public final Problem getLeadProblem() {
Collections.sort(this.problems);
return this.problems.isEmpty() ? null : this.problems.get(this.problems.size() - 1);
} | [
"public",
"final",
"Problem",
"getLeadProblem",
"(",
")",
"{",
"Collections",
".",
"sort",
"(",
"this",
".",
"problems",
")",
";",
"return",
"this",
".",
"problems",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"this",
".",
"problems",
".",
"get",
"(",
... | Get the first problem of the highest severity.
@return The most severe problem in this set | [
"Get",
"the",
"first",
"problem",
"of",
"the",
"highest",
"severity",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/validation/Problems.java#L72-L75 | train |
kiswanij/jk-util | src/main/java/com/jk/util/validation/Problems.java | Problems.toMutilLineString | public String toMutilLineString() {
final String newLine = System.getProperty("line.separator");
final StringBuffer problemStr = new StringBuffer();
for (final Problem problem : this.problems) {
problemStr.append(problem.getMessage() + newLine);
}
return problemStr.toString();
} | java | public String toMutilLineString() {
final String newLine = System.getProperty("line.separator");
final StringBuffer problemStr = new StringBuffer();
for (final Problem problem : this.problems) {
problemStr.append(problem.getMessage() + newLine);
}
return problemStr.toString();
} | [
"public",
"String",
"toMutilLineString",
"(",
")",
"{",
"final",
"String",
"newLine",
"=",
"System",
".",
"getProperty",
"(",
"\"line.separator\"",
")",
";",
"final",
"StringBuffer",
"problemStr",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"final",... | To mutil line string.
@return the string | [
"To",
"mutil",
"line",
"string",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/validation/Problems.java#L121-L128 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/PolymerUtils.java | PolymerUtils.getTotalMonomerCount | public static int getTotalMonomerCount(PolymerNotation polymer) {
int count = 0;
for (MonomerNotation element : polymer.getPolymerElements().getListOfElements()) {
count += getMonomerCountFromMonomerNotation(element);
}
return count;
} | java | public static int getTotalMonomerCount(PolymerNotation polymer) {
int count = 0;
for (MonomerNotation element : polymer.getPolymerElements().getListOfElements()) {
count += getMonomerCountFromMonomerNotation(element);
}
return count;
} | [
"public",
"static",
"int",
"getTotalMonomerCount",
"(",
"PolymerNotation",
"polymer",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"MonomerNotation",
"element",
":",
"polymer",
".",
"getPolymerElements",
"(",
")",
".",
"getListOfElements",
"(",
")",
")... | method to get the total monomer count of one PolymerNotation
@param polymer PolymerNotation
@return monomer count | [
"method",
"to",
"get",
"the",
"total",
"monomer",
"count",
"of",
"one",
"PolymerNotation"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/PolymerUtils.java#L46-L52 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/PolymerUtils.java | PolymerUtils.getMonomerCountFromMonomerNotation | private static int getMonomerCountFromMonomerNotation(MonomerNotation monomerNotation) {
int multiply;
try {
multiply = Integer.parseInt(monomerNotation.getCount());
if (multiply < 1) {
multiply = 1;
}
} catch (NumberFormatException e) {
multiply = 1;
}
if (monomerNotation instanceof MonomerNotationGroup) {
return 1 * multiply;
}
if (monomerNotation instanceof MonomerNotationList) {
int count = 0;
for (MonomerNotation unit : ((MonomerNotationList) monomerNotation).getListofMonomerUnits()) {
count += getMonomerCountFromMonomerNotation(unit);
}
return count * multiply;
}
if (monomerNotation instanceof MonomerNotationUnitRNA) {
int count = 0;
for (MonomerNotationUnit unit : ((MonomerNotationUnitRNA) monomerNotation).getContents()) {
count += getMonomerCountFromMonomerNotation(unit);
}
return count * multiply;
}
return 1 * multiply;
} | java | private static int getMonomerCountFromMonomerNotation(MonomerNotation monomerNotation) {
int multiply;
try {
multiply = Integer.parseInt(monomerNotation.getCount());
if (multiply < 1) {
multiply = 1;
}
} catch (NumberFormatException e) {
multiply = 1;
}
if (monomerNotation instanceof MonomerNotationGroup) {
return 1 * multiply;
}
if (monomerNotation instanceof MonomerNotationList) {
int count = 0;
for (MonomerNotation unit : ((MonomerNotationList) monomerNotation).getListofMonomerUnits()) {
count += getMonomerCountFromMonomerNotation(unit);
}
return count * multiply;
}
if (monomerNotation instanceof MonomerNotationUnitRNA) {
int count = 0;
for (MonomerNotationUnit unit : ((MonomerNotationUnitRNA) monomerNotation).getContents()) {
count += getMonomerCountFromMonomerNotation(unit);
}
return count * multiply;
}
return 1 * multiply;
} | [
"private",
"static",
"int",
"getMonomerCountFromMonomerNotation",
"(",
"MonomerNotation",
"monomerNotation",
")",
"{",
"int",
"multiply",
";",
"try",
"{",
"multiply",
"=",
"Integer",
".",
"parseInt",
"(",
"monomerNotation",
".",
"getCount",
"(",
")",
")",
";",
"... | method to get the number of all existing monomers from one MonomerNotation
@param monomerNotation MonomerNotation
@return number of monomers in the given MonomerNotation | [
"method",
"to",
"get",
"the",
"number",
"of",
"all",
"existing",
"monomers",
"from",
"one",
"MonomerNotation"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/PolymerUtils.java#L60-L90 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/SimpleNotationGroupIterator.java | SimpleNotationGroupIterator.nextGroup | public String nextGroup() {
int currentPosition = this.position;
do {
char currentCharacter = this.characters[currentPosition];
if (currentCharacter == '[') {
currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '[', ']');
} else if (currentCharacter == '(') {
currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '(', ')');
} else if (currentCharacter != '.') {
currentPosition++;
}
if (currentPosition < 0) {
currentPosition = this.characters.length;
}
} while ((currentPosition < this.characters.length)
&& (this.characters[currentPosition] != '.'));
String token = this.notationString.substring(this.position, currentPosition);
this.position = currentPosition + 1;
return token;
} | java | public String nextGroup() {
int currentPosition = this.position;
do {
char currentCharacter = this.characters[currentPosition];
if (currentCharacter == '[') {
currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '[', ']');
} else if (currentCharacter == '(') {
currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '(', ')');
} else if (currentCharacter != '.') {
currentPosition++;
}
if (currentPosition < 0) {
currentPosition = this.characters.length;
}
} while ((currentPosition < this.characters.length)
&& (this.characters[currentPosition] != '.'));
String token = this.notationString.substring(this.position, currentPosition);
this.position = currentPosition + 1;
return token;
} | [
"public",
"String",
"nextGroup",
"(",
")",
"{",
"int",
"currentPosition",
"=",
"this",
".",
"position",
";",
"do",
"{",
"char",
"currentCharacter",
"=",
"this",
".",
"characters",
"[",
"currentPosition",
"]",
";",
"if",
"(",
"currentCharacter",
"==",
"'",
... | Returns the next group
@return notation group | [
"Returns",
"the",
"next",
"group"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/SimpleNotationGroupIterator.java#L44-L69 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.toJSON | public final static String toJSON(HELM2Notation helm2notation) throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
String jsonINString = mapper.writeValueAsString(helm2notation);
jsonINString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(helm2notation);
return jsonINString;
} | java | public final static String toJSON(HELM2Notation helm2notation) throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
String jsonINString = mapper.writeValueAsString(helm2notation);
jsonINString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(helm2notation);
return jsonINString;
} | [
"public",
"final",
"static",
"String",
"toJSON",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"JsonProcessingException",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"String",
"jsonINString",
"=",
"mapper",
".",
"writeValueAsStr... | method to generate a JSON-Object from the given HELM2Notation
@param helm2notation HELM2Notation object
@return NotationContainer in JSON-Format
@throws JsonProcessingException json could not produced | [
"method",
"to",
"generate",
"a",
"JSON",
"-",
"Object",
"from",
"the",
"given",
"HELM2Notation"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L87-L92 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getAllEdgeConnections | public final static List<ConnectionNotation> getAllEdgeConnections(List<ConnectionNotation> connections) {
List<ConnectionNotation> listEdgeConnection = new ArrayList<ConnectionNotation>();
for (ConnectionNotation connection : connections) {
if (!(connection.getrGroupSource().equals("pair"))) {
listEdgeConnection.add(connection);
}
}
return listEdgeConnection;
} | java | public final static List<ConnectionNotation> getAllEdgeConnections(List<ConnectionNotation> connections) {
List<ConnectionNotation> listEdgeConnection = new ArrayList<ConnectionNotation>();
for (ConnectionNotation connection : connections) {
if (!(connection.getrGroupSource().equals("pair"))) {
listEdgeConnection.add(connection);
}
}
return listEdgeConnection;
} | [
"public",
"final",
"static",
"List",
"<",
"ConnectionNotation",
">",
"getAllEdgeConnections",
"(",
"List",
"<",
"ConnectionNotation",
">",
"connections",
")",
"{",
"List",
"<",
"ConnectionNotation",
">",
"listEdgeConnection",
"=",
"new",
"ArrayList",
"<",
"Connectio... | method to get all edge connections of a given List of ConnectionNotation
@param connections List of ConnectionNotation objects
@return all edge connections | [
"method",
"to",
"get",
"all",
"edge",
"connections",
"of",
"a",
"given",
"List",
"of",
"ConnectionNotation"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L100-L108 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getRNAPolymers | public final static List<PolymerNotation> getRNAPolymers(List<PolymerNotation> polymers) {
List<PolymerNotation> rnaPolymers = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof RNAEntity) {
rnaPolymers.add(polymer);
}
}
return rnaPolymers;
} | java | public final static List<PolymerNotation> getRNAPolymers(List<PolymerNotation> polymers) {
List<PolymerNotation> rnaPolymers = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof RNAEntity) {
rnaPolymers.add(polymer);
}
}
return rnaPolymers;
} | [
"public",
"final",
"static",
"List",
"<",
"PolymerNotation",
">",
"getRNAPolymers",
"(",
"List",
"<",
"PolymerNotation",
">",
"polymers",
")",
"{",
"List",
"<",
"PolymerNotation",
">",
"rnaPolymers",
"=",
"new",
"ArrayList",
"<",
"PolymerNotation",
">",
"(",
"... | method to get all rna polymers given a List of PolymerNotation objects
@param polymers List of PolymerNotation
@return list of rna polymers | [
"method",
"to",
"get",
"all",
"rna",
"polymers",
"given",
"a",
"List",
"of",
"PolymerNotation",
"objects"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L133-L141 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getPeptidePolymers | public final static List<PolymerNotation> getPeptidePolymers(List<PolymerNotation> polymers) {
List<PolymerNotation> peptidePolymers = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof PeptideEntity) {
peptidePolymers.add(polymer);
}
}
return peptidePolymers;
} | java | public final static List<PolymerNotation> getPeptidePolymers(List<PolymerNotation> polymers) {
List<PolymerNotation> peptidePolymers = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof PeptideEntity) {
peptidePolymers.add(polymer);
}
}
return peptidePolymers;
} | [
"public",
"final",
"static",
"List",
"<",
"PolymerNotation",
">",
"getPeptidePolymers",
"(",
"List",
"<",
"PolymerNotation",
">",
"polymers",
")",
"{",
"List",
"<",
"PolymerNotation",
">",
"peptidePolymers",
"=",
"new",
"ArrayList",
"<",
"PolymerNotation",
">",
... | method to get all peptide polymers given a list of PolymerNotation objects
@param polymers List of PolymerNotation objects
@return list of peptide polymers | [
"method",
"to",
"get",
"all",
"peptide",
"polymers",
"given",
"a",
"list",
"of",
"PolymerNotation",
"objects"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L149-L157 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getCHEMPolymers | public final static List<PolymerNotation> getCHEMPolymers(List<PolymerNotation> polymers) {
List<PolymerNotation> chemPolymers = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof ChemEntity) {
chemPolymers.add(polymer);
}
}
return chemPolymers;
} | java | public final static List<PolymerNotation> getCHEMPolymers(List<PolymerNotation> polymers) {
List<PolymerNotation> chemPolymers = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof ChemEntity) {
chemPolymers.add(polymer);
}
}
return chemPolymers;
} | [
"public",
"final",
"static",
"List",
"<",
"PolymerNotation",
">",
"getCHEMPolymers",
"(",
"List",
"<",
"PolymerNotation",
">",
"polymers",
")",
"{",
"List",
"<",
"PolymerNotation",
">",
"chemPolymers",
"=",
"new",
"ArrayList",
"<",
"PolymerNotation",
">",
"(",
... | method to get all chem polymers given a list of PolymerNotation objects
@param polymers List of PolymerNotation objects
@return list of chem polymers | [
"method",
"to",
"get",
"all",
"chem",
"polymers",
"given",
"a",
"list",
"of",
"PolymerNotation",
"objects"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L165-L173 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getBLOBPolymers | public final static List<PolymerNotation> getBLOBPolymers(List<PolymerNotation> polymers) {
List<PolymerNotation> blobPolymers = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof BlobEntity) {
blobPolymers.add(polymer);
}
}
return blobPolymers;
} | java | public final static List<PolymerNotation> getBLOBPolymers(List<PolymerNotation> polymers) {
List<PolymerNotation> blobPolymers = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID() instanceof BlobEntity) {
blobPolymers.add(polymer);
}
}
return blobPolymers;
} | [
"public",
"final",
"static",
"List",
"<",
"PolymerNotation",
">",
"getBLOBPolymers",
"(",
"List",
"<",
"PolymerNotation",
">",
"polymers",
")",
"{",
"List",
"<",
"PolymerNotation",
">",
"blobPolymers",
"=",
"new",
"ArrayList",
"<",
"PolymerNotation",
">",
"(",
... | method to get all blob polymers given a list of PolymerNotation objects
@param polymers List of PolymerNotation objects
@return list of blob polymers | [
"method",
"to",
"get",
"all",
"blob",
"polymers",
"given",
"a",
"list",
"of",
"PolymerNotation",
"objects"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L181-L189 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.combineHELM2notation | public final static void combineHELM2notation(HELM2Notation helm2notation, HELM2Notation newHELM2Notation) throws NotationException {
HELM2NotationUtils.helm2notation = helm2notation;
Map<String, String> mapIds = generateMapChangeIds(newHELM2Notation.getPolymerAndGroupingIDs());
/* method to merge the new HELM2Notation into the existing one */
/* section 1 */
/* id's have to changed */
section1(newHELM2Notation.getListOfPolymers(), mapIds);
/* section 2 */
section2(newHELM2Notation.getListOfConnections(), mapIds);
/* section 3 */
section3(newHELM2Notation.getListOfGroupings(), mapIds);
/* section 4 */
section4(newHELM2Notation.getListOfAnnotations(), mapIds);
} | java | public final static void combineHELM2notation(HELM2Notation helm2notation, HELM2Notation newHELM2Notation) throws NotationException {
HELM2NotationUtils.helm2notation = helm2notation;
Map<String, String> mapIds = generateMapChangeIds(newHELM2Notation.getPolymerAndGroupingIDs());
/* method to merge the new HELM2Notation into the existing one */
/* section 1 */
/* id's have to changed */
section1(newHELM2Notation.getListOfPolymers(), mapIds);
/* section 2 */
section2(newHELM2Notation.getListOfConnections(), mapIds);
/* section 3 */
section3(newHELM2Notation.getListOfGroupings(), mapIds);
/* section 4 */
section4(newHELM2Notation.getListOfAnnotations(), mapIds);
} | [
"public",
"final",
"static",
"void",
"combineHELM2notation",
"(",
"HELM2Notation",
"helm2notation",
",",
"HELM2Notation",
"newHELM2Notation",
")",
"throws",
"NotationException",
"{",
"HELM2NotationUtils",
".",
"helm2notation",
"=",
"helm2notation",
";",
"Map",
"<",
"Str... | method to add a new HELMNotation to another HELM2Notation, the new
HELM2Notation will be merged to the first HELM2Notation
@param helm2notation HELM2Notation
@param newHELM2Notation new HELMNotation
@throws NotationException if the HELMNotation is not valid | [
"method",
"to",
"add",
"a",
"new",
"HELMNotation",
"to",
"another",
"HELM2Notation",
"the",
"new",
"HELM2Notation",
"will",
"be",
"merged",
"to",
"the",
"first",
"HELM2Notation"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L199-L212 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.generateMapChangeIds | private static Map<String, String> generateMapChangeIds(List<String> newIDs) {
Map<String, String> mapIds = new HashMap<String, String>();
List<String> oldIds = HELM2NotationUtils.helm2notation.getPolymerAndGroupingIDs();
Map<String, String> mapOldIds = new HashMap<String, String>();
for (String oldID : oldIds) {
mapOldIds.put(oldID, "");
}
for (String newId : newIDs) {
if (mapOldIds.containsKey(newId)) {
int i = 1;
String type = newId.split("\\d")[0];
while (mapOldIds.containsKey(type + i)) {
i++;
}
mapIds.put(newId, type + i);
}
}
return mapIds;
} | java | private static Map<String, String> generateMapChangeIds(List<String> newIDs) {
Map<String, String> mapIds = new HashMap<String, String>();
List<String> oldIds = HELM2NotationUtils.helm2notation.getPolymerAndGroupingIDs();
Map<String, String> mapOldIds = new HashMap<String, String>();
for (String oldID : oldIds) {
mapOldIds.put(oldID, "");
}
for (String newId : newIDs) {
if (mapOldIds.containsKey(newId)) {
int i = 1;
String type = newId.split("\\d")[0];
while (mapOldIds.containsKey(type + i)) {
i++;
}
mapIds.put(newId, type + i);
}
}
return mapIds;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"generateMapChangeIds",
"(",
"List",
"<",
"String",
">",
"newIDs",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"mapIds",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(... | method to generate a Map of old ids with the new ids
@param newIDs
@return {@code Map<String, String>} containing the old ids with the new ids | [
"method",
"to",
"generate",
"a",
"Map",
"of",
"old",
"ids",
"with",
"the",
"new",
"ids"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L220-L242 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.section1 | private static void section1(List<PolymerNotation> polymers, Map<String, String> mapIds) throws NotationException {
for (PolymerNotation polymer : polymers) {
if (mapIds.containsKey(polymer.getPolymerID().getId())) {
/* change id */
PolymerNotation newpolymer = new PolymerNotation(mapIds.get(polymer.getPolymerID().getId()));
newpolymer = new PolymerNotation(newpolymer.getPolymerID(), polymer.getPolymerElements());
helm2notation.addPolymer(newpolymer);
} else {
helm2notation.addPolymer(polymer);
}
}
} | java | private static void section1(List<PolymerNotation> polymers, Map<String, String> mapIds) throws NotationException {
for (PolymerNotation polymer : polymers) {
if (mapIds.containsKey(polymer.getPolymerID().getId())) {
/* change id */
PolymerNotation newpolymer = new PolymerNotation(mapIds.get(polymer.getPolymerID().getId()));
newpolymer = new PolymerNotation(newpolymer.getPolymerID(), polymer.getPolymerElements());
helm2notation.addPolymer(newpolymer);
} else {
helm2notation.addPolymer(polymer);
}
}
} | [
"private",
"static",
"void",
"section1",
"(",
"List",
"<",
"PolymerNotation",
">",
"polymers",
",",
"Map",
"<",
"String",
",",
"String",
">",
"mapIds",
")",
"throws",
"NotationException",
"{",
"for",
"(",
"PolymerNotation",
"polymer",
":",
"polymers",
")",
"... | method to add PolymerNotations to the existent
@param polymers PolymerNotation
@param mapIds Map of old and new Ids
@throws NotationException if notation is not valid | [
"method",
"to",
"add",
"PolymerNotations",
"to",
"the",
"existent"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L251-L264 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.section2 | private static void section2(List<ConnectionNotation> connections, Map<String, String> mapIds) throws NotationException {
for (ConnectionNotation connection : connections) {
HELMEntity first = connection.getSourceId();
String idFirst = first.getId();
HELMEntity second = connection.getTargetId();
String idSecond = second.getId();
if (mapIds.containsKey(idFirst)) {
first = new ConnectionNotation(mapIds.get(idFirst)).getSourceId();
}
if (mapIds.containsKey(idSecond)) {
second = new ConnectionNotation(mapIds.get(idSecond)).getSourceId();
}
ConnectionNotation newConnection = new ConnectionNotation(first, second, connection.getSourceUnit(), connection.getrGroupSource(), connection.getTargetUnit(), connection.getrGroupTarget(),
connection.getAnnotation());
helm2notation.addConnection(newConnection);
}
} | java | private static void section2(List<ConnectionNotation> connections, Map<String, String> mapIds) throws NotationException {
for (ConnectionNotation connection : connections) {
HELMEntity first = connection.getSourceId();
String idFirst = first.getId();
HELMEntity second = connection.getTargetId();
String idSecond = second.getId();
if (mapIds.containsKey(idFirst)) {
first = new ConnectionNotation(mapIds.get(idFirst)).getSourceId();
}
if (mapIds.containsKey(idSecond)) {
second = new ConnectionNotation(mapIds.get(idSecond)).getSourceId();
}
ConnectionNotation newConnection = new ConnectionNotation(first, second, connection.getSourceUnit(), connection.getrGroupSource(), connection.getTargetUnit(), connection.getrGroupTarget(),
connection.getAnnotation());
helm2notation.addConnection(newConnection);
}
} | [
"private",
"static",
"void",
"section2",
"(",
"List",
"<",
"ConnectionNotation",
">",
"connections",
",",
"Map",
"<",
"String",
",",
"String",
">",
"mapIds",
")",
"throws",
"NotationException",
"{",
"for",
"(",
"ConnectionNotation",
"connection",
":",
"connectio... | method to add ConnectionNotation to the existent
@param connections ConnectionNotatoin
@param mapIds Map of old and new Ids
@throws NotationException if notation is not valid | [
"method",
"to",
"add",
"ConnectionNotation",
"to",
"the",
"existent"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L273-L296 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.section3 | private static void section3(List<GroupingNotation> groupings, Map<String, String> mapIds) throws NotationException {
for (GroupingNotation grouping : groupings) {
GroupEntity groupID = grouping.getGroupID();
if (mapIds.containsKey(groupID.getId())) {
groupID = new GroupingNotation(mapIds.get(groupID.getId())).getGroupID();
}
String details = grouping.toHELM2().split("\\(")[1].split("\\)")[0];
details = changeIDs(details, mapIds);
helm2notation.addGrouping(new GroupingNotation(groupID, details));
}
} | java | private static void section3(List<GroupingNotation> groupings, Map<String, String> mapIds) throws NotationException {
for (GroupingNotation grouping : groupings) {
GroupEntity groupID = grouping.getGroupID();
if (mapIds.containsKey(groupID.getId())) {
groupID = new GroupingNotation(mapIds.get(groupID.getId())).getGroupID();
}
String details = grouping.toHELM2().split("\\(")[1].split("\\)")[0];
details = changeIDs(details, mapIds);
helm2notation.addGrouping(new GroupingNotation(groupID, details));
}
} | [
"private",
"static",
"void",
"section3",
"(",
"List",
"<",
"GroupingNotation",
">",
"groupings",
",",
"Map",
"<",
"String",
",",
"String",
">",
"mapIds",
")",
"throws",
"NotationException",
"{",
"for",
"(",
"GroupingNotation",
"grouping",
":",
"groupings",
")"... | method to add groupings to the existent grouping section
@param groupings new GroupingNotations
@param mapIds map of old and new Ids
@throws NotationException if notation is not valid | [
"method",
"to",
"add",
"groupings",
"to",
"the",
"existent",
"grouping",
"section"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L305-L318 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.section4 | private static void section4(List<AnnotationNotation> annotations, Map<String, String> mapIds) {
for (AnnotationNotation annotation : annotations) {
String notation = annotation.getAnnotation();
notation = changeIDs(notation, mapIds);
helm2notation.addAnnotation(new AnnotationNotation(notation));
}
} | java | private static void section4(List<AnnotationNotation> annotations, Map<String, String> mapIds) {
for (AnnotationNotation annotation : annotations) {
String notation = annotation.getAnnotation();
notation = changeIDs(notation, mapIds);
helm2notation.addAnnotation(new AnnotationNotation(notation));
}
} | [
"private",
"static",
"void",
"section4",
"(",
"List",
"<",
"AnnotationNotation",
">",
"annotations",
",",
"Map",
"<",
"String",
",",
"String",
">",
"mapIds",
")",
"{",
"for",
"(",
"AnnotationNotation",
"annotation",
":",
"annotations",
")",
"{",
"String",
"n... | method to add annotations to the existent annotation section
@param annotations new AnnotationNotations
@param mapIds Map of old and new Ids | [
"method",
"to",
"add",
"annotations",
"to",
"the",
"existent",
"annotation",
"section"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L326-L332 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.changeIDs | private static String changeIDs(String text, Map<String, String> mapIds) {
String result = text;
for (String key : mapIds.keySet()) {
result = result.replace(key, mapIds.get(key));
}
return result;
} | java | private static String changeIDs(String text, Map<String, String> mapIds) {
String result = text;
for (String key : mapIds.keySet()) {
result = result.replace(key, mapIds.get(key));
}
return result;
} | [
"private",
"static",
"String",
"changeIDs",
"(",
"String",
"text",
",",
"Map",
"<",
"String",
",",
"String",
">",
"mapIds",
")",
"{",
"String",
"result",
"=",
"text",
";",
"for",
"(",
"String",
"key",
":",
"mapIds",
".",
"keySet",
"(",
")",
")",
"{",... | method to change the ids in a text according to map
@param text input text
@param mapIds Map of old Id's value and new Id's
@return text with changed ids | [
"method",
"to",
"change",
"the",
"ids",
"in",
"a",
"text",
"according",
"to",
"map"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L341-L347 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getTotalMonomerCount | public static final int getTotalMonomerCount(HELM2Notation helm2notation) {
int result = 0;
for (PolymerNotation polymer : helm2notation.getListOfPolymers()) {
result += PolymerUtils.getTotalMonomerCount(polymer);
}
return result;
} | java | public static final int getTotalMonomerCount(HELM2Notation helm2notation) {
int result = 0;
for (PolymerNotation polymer : helm2notation.getListOfPolymers()) {
result += PolymerUtils.getTotalMonomerCount(polymer);
}
return result;
} | [
"public",
"static",
"final",
"int",
"getTotalMonomerCount",
"(",
"HELM2Notation",
"helm2notation",
")",
"{",
"int",
"result",
"=",
"0",
";",
"for",
"(",
"PolymerNotation",
"polymer",
":",
"helm2notation",
".",
"getListOfPolymers",
"(",
")",
")",
"{",
"result",
... | method to get the total number of MonomerNotationUnits in a HELMNotation
object
@param helm2notation given HELM2Notation
@return number of MonomerNotationUnits | [
"method",
"to",
"get",
"the",
"total",
"number",
"of",
"MonomerNotationUnits",
"in",
"a",
"HELMNotation",
"object"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L355-L361 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.hasNucleotideModification | public static boolean hasNucleotideModification(List<PolymerNotation> polymers) throws NotationException {
for (PolymerNotation polymer : getRNAPolymers(polymers)) {
if (RNAUtils.hasNucleotideModification(polymer)) {
return true;
}
}
return false;
} | java | public static boolean hasNucleotideModification(List<PolymerNotation> polymers) throws NotationException {
for (PolymerNotation polymer : getRNAPolymers(polymers)) {
if (RNAUtils.hasNucleotideModification(polymer)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"hasNucleotideModification",
"(",
"List",
"<",
"PolymerNotation",
">",
"polymers",
")",
"throws",
"NotationException",
"{",
"for",
"(",
"PolymerNotation",
"polymer",
":",
"getRNAPolymers",
"(",
"polymers",
")",
")",
"{",
"if",
"(",
... | method to check if any of the rna polymers have a modified nucleotide
@param polymers list of {@link PolymerNotation}
@return true if at least one rna polymer has a modified nucleotide
@throws NotationException if notation is not valid | [
"method",
"to",
"check",
"if",
"any",
"of",
"the",
"rna",
"polymers",
"have",
"a",
"modified",
"nucleotide"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L369-L376 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getFormatedSirnaSequences | public static String[] getFormatedSirnaSequences(HELM2Notation helm2notation) throws NotationException, RNAUtilsException, HELM2HandledException, org.helm.notation2.exception.NotationException,
ChemistryException {
return getFormatedSirnaSequences(helm2notation, DEFAULT_PADDING_CHAR, DEFAULT_BASE_PAIR_CHAR);
} | java | public static String[] getFormatedSirnaSequences(HELM2Notation helm2notation) throws NotationException, RNAUtilsException, HELM2HandledException, org.helm.notation2.exception.NotationException,
ChemistryException {
return getFormatedSirnaSequences(helm2notation, DEFAULT_PADDING_CHAR, DEFAULT_BASE_PAIR_CHAR);
} | [
"public",
"static",
"String",
"[",
"]",
"getFormatedSirnaSequences",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"NotationException",
",",
"RNAUtilsException",
",",
"HELM2HandledException",
",",
"org",
".",
"helm",
".",
"notation2",
".",
"exception",
".",
... | generate formated siRNA sequence with default padding char " " and
base-pair char "|"
@param helm2notation HELM2Notation
@return string array of formated nucloeotide sequence
@throws NotationException if notation is not valid
@throws RNAUtilsException if the polymer is not a RNA/DNA
@throws HELM2HandledException if it contains HELM2 specific features, so that it can not be casted to HELM1 Format
@throws org.helm.notation2.exception.NotationException if notation is not valid
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"generate",
"formated",
"siRNA",
"sequence",
"with",
"default",
"padding",
"char",
"and",
"base",
"-",
"pair",
"char",
"|"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L390-L393 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.reverseString | private static String reverseString(String source) {
int i;
int len = source.length();
StringBuffer dest = new StringBuffer();
for (i = (len - 1); i >= 0; i--) {
dest.append(source.charAt(i));
}
return dest.toString();
} | java | private static String reverseString(String source) {
int i;
int len = source.length();
StringBuffer dest = new StringBuffer();
for (i = (len - 1); i >= 0; i--) {
dest.append(source.charAt(i));
}
return dest.toString();
} | [
"private",
"static",
"String",
"reverseString",
"(",
"String",
"source",
")",
"{",
"int",
"i",
";",
"int",
"len",
"=",
"source",
".",
"length",
"(",
")",
";",
"StringBuffer",
"dest",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"i",
"=",
"(... | method to reverse a String
@param source given string to reverse
@return reversed String | [
"method",
"to",
"reverse",
"a",
"String"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L594-L603 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.decompose | public List<HELM2Notation> decompose(HELM2Notation helm2notation) {
List<HELM2Notation> list = new ArrayList<HELM2Notation>();
List<ConnectionNotation> allselfConnections = getAllSelfCycleConnections(helm2notation.getListOfConnections());
for (PolymerNotation polymer : helm2notation.getListOfPolymers()) {
HELM2Notation single = new HELM2Notation();
single.addPolymer(polymer);
List<ConnectionNotation> selfConnections = getSelfCycleConnections(polymer.getPolymerID().getId(), allselfConnections);
for (ConnectionNotation selfConnection : selfConnections) {
single.addConnection(selfConnection);
}
list.add(single);
}
return list;
} | java | public List<HELM2Notation> decompose(HELM2Notation helm2notation) {
List<HELM2Notation> list = new ArrayList<HELM2Notation>();
List<ConnectionNotation> allselfConnections = getAllSelfCycleConnections(helm2notation.getListOfConnections());
for (PolymerNotation polymer : helm2notation.getListOfPolymers()) {
HELM2Notation single = new HELM2Notation();
single.addPolymer(polymer);
List<ConnectionNotation> selfConnections = getSelfCycleConnections(polymer.getPolymerID().getId(), allselfConnections);
for (ConnectionNotation selfConnection : selfConnections) {
single.addConnection(selfConnection);
}
list.add(single);
}
return list;
} | [
"public",
"List",
"<",
"HELM2Notation",
">",
"decompose",
"(",
"HELM2Notation",
"helm2notation",
")",
"{",
"List",
"<",
"HELM2Notation",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"HELM2Notation",
">",
"(",
")",
";",
"List",
"<",
"ConnectionNotation",
">",
"... | decompose the HELM2 into smaller HELM2 objects
@param helm2notation HELM2 object
@return list of ContainerHELM2 objects | [
"decompose",
"the",
"HELM2",
"into",
"smaller",
"HELM2",
"objects"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L611-L626 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getAllSelfCycleConnections | private static List<ConnectionNotation> getAllSelfCycleConnections(List<ConnectionNotation> connections) {
List<ConnectionNotation> listSelfCycle = new ArrayList<ConnectionNotation>();
for (ConnectionNotation connection : connections) {
if ((connection.getTargetId().getId().equals(connection.getSourceId().getId()))) {
listSelfCycle.add(connection);
}
}
return listSelfCycle;
} | java | private static List<ConnectionNotation> getAllSelfCycleConnections(List<ConnectionNotation> connections) {
List<ConnectionNotation> listSelfCycle = new ArrayList<ConnectionNotation>();
for (ConnectionNotation connection : connections) {
if ((connection.getTargetId().getId().equals(connection.getSourceId().getId()))) {
listSelfCycle.add(connection);
}
}
return listSelfCycle;
} | [
"private",
"static",
"List",
"<",
"ConnectionNotation",
">",
"getAllSelfCycleConnections",
"(",
"List",
"<",
"ConnectionNotation",
">",
"connections",
")",
"{",
"List",
"<",
"ConnectionNotation",
">",
"listSelfCycle",
"=",
"new",
"ArrayList",
"<",
"ConnectionNotation"... | method to get all self-cycle Connections
@param connections list of ConnectionNotation
@return list of all self-cycle Connections | [
"method",
"to",
"get",
"all",
"self",
"-",
"cycle",
"Connections"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L634-L642 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getSelfCycleConnections | private static List<ConnectionNotation> getSelfCycleConnections(String id, List<ConnectionNotation> connections) {
List<ConnectionNotation> list = new ArrayList<ConnectionNotation>();
for (ConnectionNotation connection : connections) {
if (connection.getSourceId().getId().equals(id)) {
list.add(connection);
}
}
return list;
} | java | private static List<ConnectionNotation> getSelfCycleConnections(String id, List<ConnectionNotation> connections) {
List<ConnectionNotation> list = new ArrayList<ConnectionNotation>();
for (ConnectionNotation connection : connections) {
if (connection.getSourceId().getId().equals(id)) {
list.add(connection);
}
}
return list;
} | [
"private",
"static",
"List",
"<",
"ConnectionNotation",
">",
"getSelfCycleConnections",
"(",
"String",
"id",
",",
"List",
"<",
"ConnectionNotation",
">",
"connections",
")",
"{",
"List",
"<",
"ConnectionNotation",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"Conn... | method to get for one polymer all self-cycle ConnectionNotations
@param id polymer id
@param connections list of ConnectionNotation
@return list of all self-cycle connections | [
"method",
"to",
"get",
"for",
"one",
"polymer",
"all",
"self",
"-",
"cycle",
"ConnectionNotations"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L651-L659 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.getListOfPolymersSpecificType | public static List<PolymerNotation> getListOfPolymersSpecificType(String str, List<PolymerNotation> polymers) {
List<PolymerNotation> list = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID().getType().equals(str)) {
list.add(polymer);
}
}
return list;
} | java | public static List<PolymerNotation> getListOfPolymersSpecificType(String str, List<PolymerNotation> polymers) {
List<PolymerNotation> list = new ArrayList<PolymerNotation>();
for (PolymerNotation polymer : polymers) {
if (polymer.getPolymerID().getType().equals(str)) {
list.add(polymer);
}
}
return list;
} | [
"public",
"static",
"List",
"<",
"PolymerNotation",
">",
"getListOfPolymersSpecificType",
"(",
"String",
"str",
",",
"List",
"<",
"PolymerNotation",
">",
"polymers",
")",
"{",
"List",
"<",
"PolymerNotation",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"PolymerNot... | method to get all polymers for one specific polymer type
@param str specific polymer type
@param polymers List of PolymerNotation
@return List of PolymerNotation with the specific type | [
"method",
"to",
"get",
"all",
"polymers",
"for",
"one",
"specific",
"polymer",
"type"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L693-L701 | train |
kiswanij/jk-util | src/main/java/com/jk/util/cache/simple/JKCacheUtil.java | JKCacheUtil.buildDynamicKey | public static String buildDynamicKey(final Object[] paramNames, final Object[] paramValues) {
return Arrays.toString(paramNames).concat(Arrays.toString(paramValues));
} | java | public static String buildDynamicKey(final Object[] paramNames, final Object[] paramValues) {
return Arrays.toString(paramNames).concat(Arrays.toString(paramValues));
} | [
"public",
"static",
"String",
"buildDynamicKey",
"(",
"final",
"Object",
"[",
"]",
"paramNames",
",",
"final",
"Object",
"[",
"]",
"paramValues",
")",
"{",
"return",
"Arrays",
".",
"toString",
"(",
"paramNames",
")",
".",
"concat",
"(",
"Arrays",
".",
"toS... | Builds the dynamic key.
@param paramNames the param names
@param paramValues the param values
@return the string | [
"Builds",
"the",
"dynamic",
"key",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/cache/simple/JKCacheUtil.java#L36-L38 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/wsadapter/NucleotideWSLoader.java | NucleotideWSLoader.deserializeNucleotideStore | private Map<String, String> deserializeNucleotideStore(JsonParser parser)
throws JsonParseException, IOException {
Map<String, String> nucleotides = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
String currentNucleotideSymbol = "";
String currentNucleotideNotation = "";
boolean foundSymbol = false;
boolean foundNotation = false;
parser.nextToken();
while (parser.hasCurrentToken()) {
String fieldName = parser.getCurrentName();
if (fieldName != null) {
switch (fieldName) {
case "symbol":
parser.nextToken();
currentNucleotideSymbol = parser.getText();
foundSymbol = true;
break;
case "notation":
parser.nextToken();
currentNucleotideNotation = parser.getText();
foundNotation = true;
break;
default:
break;
}
if (foundSymbol && foundNotation) {
nucleotides.put(currentNucleotideSymbol,
currentNucleotideNotation);
foundNotation = false;
foundSymbol = false;
}
}
parser.nextToken();
}
return nucleotides;
} | java | private Map<String, String> deserializeNucleotideStore(JsonParser parser)
throws JsonParseException, IOException {
Map<String, String> nucleotides = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
String currentNucleotideSymbol = "";
String currentNucleotideNotation = "";
boolean foundSymbol = false;
boolean foundNotation = false;
parser.nextToken();
while (parser.hasCurrentToken()) {
String fieldName = parser.getCurrentName();
if (fieldName != null) {
switch (fieldName) {
case "symbol":
parser.nextToken();
currentNucleotideSymbol = parser.getText();
foundSymbol = true;
break;
case "notation":
parser.nextToken();
currentNucleotideNotation = parser.getText();
foundNotation = true;
break;
default:
break;
}
if (foundSymbol && foundNotation) {
nucleotides.put(currentNucleotideSymbol,
currentNucleotideNotation);
foundNotation = false;
foundSymbol = false;
}
}
parser.nextToken();
}
return nucleotides;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"deserializeNucleotideStore",
"(",
"JsonParser",
"parser",
")",
"throws",
"JsonParseException",
",",
"IOException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"nucleotides",
"=",
"new",
"TreeMap",
"<",
"... | Private routine to deserialize nucleotide Store JSON. This is done manually to give more freedom regarding data
returned by the webservice.
@param parser the JSONParser containing JSONData.
@return Map containing nucleotides
@throws JsonParseException could not deserialize nucleotides
@throws IOException IO error | [
"Private",
"routine",
"to",
"deserialize",
"nucleotide",
"Store",
"JSON",
".",
"This",
"is",
"done",
"manually",
"to",
"give",
"more",
"freedom",
"regarding",
"data",
"returned",
"by",
"the",
"webservice",
"."
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/wsadapter/NucleotideWSLoader.java#L119-L158 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKCollectionUtil.java | JKCollectionUtil.fixPropertiesKeys | public static void fixPropertiesKeys(final Properties prop) {
final Enumeration<Object> keys = prop.keys();
while (keys.hasMoreElements()) {
String currentKey = (String) keys.nextElement();
String fixedKey = fixPropertyKey(currentKey);
String value = prop.getProperty(currentKey);
value = fixPropertyValue(value);
prop.remove(currentKey);
prop.setProperty(fixedKey, value);
}
} | java | public static void fixPropertiesKeys(final Properties prop) {
final Enumeration<Object> keys = prop.keys();
while (keys.hasMoreElements()) {
String currentKey = (String) keys.nextElement();
String fixedKey = fixPropertyKey(currentKey);
String value = prop.getProperty(currentKey);
value = fixPropertyValue(value);
prop.remove(currentKey);
prop.setProperty(fixedKey, value);
}
} | [
"public",
"static",
"void",
"fixPropertiesKeys",
"(",
"final",
"Properties",
"prop",
")",
"{",
"final",
"Enumeration",
"<",
"Object",
">",
"keys",
"=",
"prop",
".",
"keys",
"(",
")",
";",
"while",
"(",
"keys",
".",
"hasMoreElements",
"(",
")",
")",
"{",
... | Fix properties keys.
@param prop the prop | [
"Fix",
"properties",
"keys",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKCollectionUtil.java#L45-L55 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKCollectionUtil.java | JKCollectionUtil.fixPropertyValue | public static String fixPropertyValue(String value) {
// replace with predefined varialebls
value = value.replaceAll("\\{jk.appname\\}", JK.getAppName());
return value;
} | java | public static String fixPropertyValue(String value) {
// replace with predefined varialebls
value = value.replaceAll("\\{jk.appname\\}", JK.getAppName());
return value;
} | [
"public",
"static",
"String",
"fixPropertyValue",
"(",
"String",
"value",
")",
"{",
"// replace with predefined varialebls\r",
"value",
"=",
"value",
".",
"replaceAll",
"(",
"\"\\\\{jk.appname\\\\}\"",
",",
"JK",
".",
"getAppName",
"(",
")",
")",
";",
"return",
"v... | Fix property value.
@param value the value
@return the string | [
"Fix",
"property",
"value",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKCollectionUtil.java#L63-L67 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKCollectionUtil.java | JKCollectionUtil.unifyReferences | public static Object unifyReferences(final Hashtable hash, Object object) {
final Object itemAtHash = hash.get(object.hashCode());
if (itemAtHash == null) {
hash.put(object.hashCode(), object);
} else {
object = itemAtHash;
}
return object;
} | java | public static Object unifyReferences(final Hashtable hash, Object object) {
final Object itemAtHash = hash.get(object.hashCode());
if (itemAtHash == null) {
hash.put(object.hashCode(), object);
} else {
object = itemAtHash;
}
return object;
} | [
"public",
"static",
"Object",
"unifyReferences",
"(",
"final",
"Hashtable",
"hash",
",",
"Object",
"object",
")",
"{",
"final",
"Object",
"itemAtHash",
"=",
"hash",
".",
"get",
"(",
"object",
".",
"hashCode",
"(",
")",
")",
";",
"if",
"(",
"itemAtHash",
... | return unified reference.
@param hash the hash
@param object the object
@return the object | [
"return",
"unified",
"reference",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKCollectionUtil.java#L120-L128 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKCollectionUtil.java | JKCollectionUtil.sortHashTable | public static List<Entry> sortHashTable(final Hashtable<?, ?> hash, final boolean asc) {
// Put keys and values in to an arraylist using entryset
final ArrayList<Entry> myArrayList = new ArrayList(hash.entrySet());
// Sort the values based on values first and then keys.
Collections.sort(myArrayList, new HashComparator(asc));
return myArrayList;
} | java | public static List<Entry> sortHashTable(final Hashtable<?, ?> hash, final boolean asc) {
// Put keys and values in to an arraylist using entryset
final ArrayList<Entry> myArrayList = new ArrayList(hash.entrySet());
// Sort the values based on values first and then keys.
Collections.sort(myArrayList, new HashComparator(asc));
return myArrayList;
} | [
"public",
"static",
"List",
"<",
"Entry",
">",
"sortHashTable",
"(",
"final",
"Hashtable",
"<",
"?",
",",
"?",
">",
"hash",
",",
"final",
"boolean",
"asc",
")",
"{",
"// Put keys and values in to an arraylist using entryset\r",
"final",
"ArrayList",
"<",
"Entry",
... | Sort hash table.
@param hash the hash
@param asc the asc
@return the array list | [
"Sort",
"hash",
"table",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKCollectionUtil.java#L175-L181 | train |
kiswanij/jk-util | src/main/java/com/jk/util/JKCollectionUtil.java | JKCollectionUtil.formatProperties | public static String formatProperties(Properties properties) {
StringBuffer buf = new StringBuffer();
Set<Object> keySet = properties.keySet();
for (Object key : keySet) {
buf.append(key.toString().trim().toUpperCase().replaceAll(" ", "_"));
buf.append("=");
buf.append(properties.get(key));
buf.append(System.getProperty("line.separator"));
}
return buf.toString();
} | java | public static String formatProperties(Properties properties) {
StringBuffer buf = new StringBuffer();
Set<Object> keySet = properties.keySet();
for (Object key : keySet) {
buf.append(key.toString().trim().toUpperCase().replaceAll(" ", "_"));
buf.append("=");
buf.append(properties.get(key));
buf.append(System.getProperty("line.separator"));
}
return buf.toString();
} | [
"public",
"static",
"String",
"formatProperties",
"(",
"Properties",
"properties",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Set",
"<",
"Object",
">",
"keySet",
"=",
"properties",
".",
"keySet",
"(",
")",
";",
"for",
"(",... | Format properties.
@param properties the properties
@return the string | [
"Format",
"properties",
"."
] | 8e0c85818423406f769444c76194a748e0a0fc0a | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKCollectionUtil.java#L234-L245 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM1Utils.java | HELM1Utils.getStandard | public static String getStandard(HELM2Notation helm2notation) throws HELM1FormatException, MonomerLoadingException, CTKException, ValidationException, ChemistryException {
try {
String firstSection = setStandardHELMFirstSection(helm2notation);
List<String> ListOfSecondAndThirdSection = setStandardHELMSecondSectionAndThirdSection(helm2notation.getListOfConnections());
String fourthSection = setStandardHELMFourthSection(helm2notation.getListOfAnnotations());
return firstSection + "$" + ListOfSecondAndThirdSection.get(0) + "$" + ListOfSecondAndThirdSection.get(1) + "$" + fourthSection + "$V2.0";
} catch (HELM1ConverterException | NotationException | org.helm.notation2.parser.exceptionparser.NotationException e) {
e.printStackTrace();
throw new HELM1FormatException(e.getMessage());
}
} | java | public static String getStandard(HELM2Notation helm2notation) throws HELM1FormatException, MonomerLoadingException, CTKException, ValidationException, ChemistryException {
try {
String firstSection = setStandardHELMFirstSection(helm2notation);
List<String> ListOfSecondAndThirdSection = setStandardHELMSecondSectionAndThirdSection(helm2notation.getListOfConnections());
String fourthSection = setStandardHELMFourthSection(helm2notation.getListOfAnnotations());
return firstSection + "$" + ListOfSecondAndThirdSection.get(0) + "$" + ListOfSecondAndThirdSection.get(1) + "$" + fourthSection + "$V2.0";
} catch (HELM1ConverterException | NotationException | org.helm.notation2.parser.exceptionparser.NotationException e) {
e.printStackTrace();
throw new HELM1FormatException(e.getMessage());
}
} | [
"public",
"static",
"String",
"getStandard",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"HELM1FormatException",
",",
"MonomerLoadingException",
",",
"CTKException",
",",
"ValidationException",
",",
"ChemistryException",
"{",
"try",
"{",
"String",
"firstSection"... | method to reproduce a standard HELM in HELM1 - Format
@param helm2notation HELM2Notation
@return standard HELM1
@throws HELM1FormatException if HELM2 features are there
@throws CTKException general ChemToolKit exception passed to HELMToolKit
@throws MonomerLoadingException monomers could not be loaded
@throws ValidationException if a smiles in the HELMNotation is not valid
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"method",
"to",
"reproduce",
"a",
"standard",
"HELM",
"in",
"HELM1",
"-",
"Format"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM1Utils.java#L82-L92 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM1Utils.java | HELM1Utils.setStandardHELMFourthSection | private static String setStandardHELMFourthSection(List<AnnotationNotation> annotations) {
StringBuilder sb = new StringBuilder();
for (AnnotationNotation annotation : annotations) {
sb.append(annotation.toHELM2() + "|");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
return sb.toString();
} | java | private static String setStandardHELMFourthSection(List<AnnotationNotation> annotations) {
StringBuilder sb = new StringBuilder();
for (AnnotationNotation annotation : annotations) {
sb.append(annotation.toHELM2() + "|");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
return sb.toString();
} | [
"private",
"static",
"String",
"setStandardHELMFourthSection",
"(",
"List",
"<",
"AnnotationNotation",
">",
"annotations",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"AnnotationNotation",
"annotation",
":",
"annotations"... | method to transform the fourth section into HELM1-Format
@param annotations List of AnnotationNotation
@return the fourth section of an Standard HELM | [
"method",
"to",
"transform",
"the",
"fourth",
"section",
"into",
"HELM1",
"-",
"Format"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM1Utils.java#L166-L176 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM1Utils.java | HELM1Utils.getCanonical | public static String getCanonical(HELM2Notation helm2notation) throws HELM1FormatException, ChemistryException {
Map<String, String> convertsortedIdstoIds;
try {
Object[] temp = setCanonicalHELMFirstSection(helm2notation);
LOG.info("First Section of canonical HELM was generated");
convertsortedIdstoIds = (Map<String, String>) temp[0];
String firstSection = (String) temp[1];
String secondSection = setCanonicalHELMSecondSection(convertsortedIdstoIds, helm2notation.getListOfConnections());
LOG.info("Second Section of canonical HELM was generated");
return firstSection + "$" + secondSection + "$" + "" + "$" + "" + "$V2.0";
} catch (ClassNotFoundException | IOException | HELM1ConverterException | ValidationException | org.helm.notation2.parser.exceptionparser.NotationException e) {
e.printStackTrace();
LOG.error("Canonical HELM 1 can not be generated due to HELM2 features");
throw new HELM1FormatException("Canonical HELM 1 can not be generated due to HELM2 features " + e.getMessage() + e.getCause());
}
} | java | public static String getCanonical(HELM2Notation helm2notation) throws HELM1FormatException, ChemistryException {
Map<String, String> convertsortedIdstoIds;
try {
Object[] temp = setCanonicalHELMFirstSection(helm2notation);
LOG.info("First Section of canonical HELM was generated");
convertsortedIdstoIds = (Map<String, String>) temp[0];
String firstSection = (String) temp[1];
String secondSection = setCanonicalHELMSecondSection(convertsortedIdstoIds, helm2notation.getListOfConnections());
LOG.info("Second Section of canonical HELM was generated");
return firstSection + "$" + secondSection + "$" + "" + "$" + "" + "$V2.0";
} catch (ClassNotFoundException | IOException | HELM1ConverterException | ValidationException | org.helm.notation2.parser.exceptionparser.NotationException e) {
e.printStackTrace();
LOG.error("Canonical HELM 1 can not be generated due to HELM2 features");
throw new HELM1FormatException("Canonical HELM 1 can not be generated due to HELM2 features " + e.getMessage() + e.getCause());
}
} | [
"public",
"static",
"String",
"getCanonical",
"(",
"HELM2Notation",
"helm2notation",
")",
"throws",
"HELM1FormatException",
",",
"ChemistryException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"convertsortedIdstoIds",
";",
"try",
"{",
"Object",
"[",
"]",
"tem... | method to generate from a helm2notation a valid canonical HELM1
@param helm2notation input HELM2Notation
@return canonical HELM
@throws HELM1FormatException if HELM2 features are there
@throws ChemistryException if the Chemistry Engine can not be initialized | [
"method",
"to",
"generate",
"from",
"a",
"helm2notation",
"a",
"valid",
"canonical",
"HELM1"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM1Utils.java#L186-L201 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM1Utils.java | HELM1Utils.setCanonicalHELMSecondSection | private static String setCanonicalHELMSecondSection(Map<String, String> convertsortedIdstoIds, List<ConnectionNotation> connectionNotations) throws HELM1ConverterException {
StringBuilder notation = new StringBuilder();
for (ConnectionNotation connectionNotation : connectionNotations) {
/* canonicalize connection */
/* change the id's of the polymers to the sorted ids */
List<String> connections = new ArrayList<String>();
String source = connectionNotation.getSourceId().getId();
String target = connectionNotation.getTargetId().getId();
/* pairs will be not shown */
if (!(connectionNotation.toHELM().equals(""))) {
connections.add(convertConnection(connectionNotation.toHELM(), source, target, convertsortedIdstoIds));
connections.add(convertConnection(connectionNotation.toReverseHELM(), source, target, convertsortedIdstoIds));
Collections.sort(connections);
notation.append(connections.get(0) + "|");
}
}
if (notation.length() > 1) {
notation.setLength(notation.length() - 1);
}
return notation.toString();
} | java | private static String setCanonicalHELMSecondSection(Map<String, String> convertsortedIdstoIds, List<ConnectionNotation> connectionNotations) throws HELM1ConverterException {
StringBuilder notation = new StringBuilder();
for (ConnectionNotation connectionNotation : connectionNotations) {
/* canonicalize connection */
/* change the id's of the polymers to the sorted ids */
List<String> connections = new ArrayList<String>();
String source = connectionNotation.getSourceId().getId();
String target = connectionNotation.getTargetId().getId();
/* pairs will be not shown */
if (!(connectionNotation.toHELM().equals(""))) {
connections.add(convertConnection(connectionNotation.toHELM(), source, target, convertsortedIdstoIds));
connections.add(convertConnection(connectionNotation.toReverseHELM(), source, target, convertsortedIdstoIds));
Collections.sort(connections);
notation.append(connections.get(0) + "|");
}
}
if (notation.length() > 1) {
notation.setLength(notation.length() - 1);
}
return notation.toString();
} | [
"private",
"static",
"String",
"setCanonicalHELMSecondSection",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"convertsortedIdstoIds",
",",
"List",
"<",
"ConnectionNotation",
">",
"connectionNotations",
")",
"throws",
"HELM1ConverterException",
"{",
"StringBuilder",
"n... | method to generate a canonical HELM 1 connection section
@param convertsortedIdstoIds Map of old ids with the equivalent new ids
@return second section of HELM
@throws HELM1ConverterException | [
"method",
"to",
"generate",
"a",
"canonical",
"HELM",
"1",
"connection",
"section"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM1Utils.java#L299-L320 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM1Utils.java | HELM1Utils.convertConnection | private static String convertConnection(String notation, String source, String target, Map<String, String> convertIds) throws HELM1ConverterException {
try {
String test = notation.replace(source, "one");
test = test.replace(target, "two");
test = test.replace("one", convertIds.get(source));
test = test.replace("two", convertIds.get(target));
return test;
} catch (NullPointerException ex) {
ex.printStackTrace();
LOG.error("Connection can't be downgraded to HELM1-Format");
throw new HELM1ConverterException("Connection can't be downgraded to HELM1-Format");
}
} | java | private static String convertConnection(String notation, String source, String target, Map<String, String> convertIds) throws HELM1ConverterException {
try {
String test = notation.replace(source, "one");
test = test.replace(target, "two");
test = test.replace("one", convertIds.get(source));
test = test.replace("two", convertIds.get(target));
return test;
} catch (NullPointerException ex) {
ex.printStackTrace();
LOG.error("Connection can't be downgraded to HELM1-Format");
throw new HELM1ConverterException("Connection can't be downgraded to HELM1-Format");
}
} | [
"private",
"static",
"String",
"convertConnection",
"(",
"String",
"notation",
",",
"String",
"source",
",",
"String",
"target",
",",
"Map",
"<",
"String",
",",
"String",
">",
"convertIds",
")",
"throws",
"HELM1ConverterException",
"{",
"try",
"{",
"String",
"... | method to convert the polymers ids of the connection
@param notation connection description in HELM
@param source polymer id of source
@param target polymer id of target
@param convertIds Map of old polymer ids with the new polymer ids
@return connection description in HELM with the changed polymer ids
according to the map
@throws HELM1ConverterException | [
"method",
"to",
"convert",
"the",
"polymers",
"ids",
"of",
"the",
"connection"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM1Utils.java#L333-L345 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.getXHELMRootElement | private Element getXHELMRootElement(String resource) throws JDOMException, IOException {
ByteArrayInputStream stream = new ByteArrayInputStream(resource.getBytes());
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(stream);
return doc.getRootElement();
} | java | private Element getXHELMRootElement(String resource) throws JDOMException, IOException {
ByteArrayInputStream stream = new ByteArrayInputStream(resource.getBytes());
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(stream);
return doc.getRootElement();
} | [
"private",
"Element",
"getXHELMRootElement",
"(",
"String",
"resource",
")",
"throws",
"JDOMException",
",",
"IOException",
"{",
"ByteArrayInputStream",
"stream",
"=",
"new",
"ByteArrayInputStream",
"(",
"resource",
".",
"getBytes",
"(",
")",
")",
";",
"SAXBuilder",... | method to get the XHELMRootElement of a document as a string
@param resource
xhelm input
@return XHELMRootElement
@throws JDOMException
if the xml can not be read
@throws IOException
if the input can not be read | [
"method",
"to",
"get",
"the",
"XHELMRootElement",
"of",
"a",
"document",
"as",
"a",
"string"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L87-L94 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.updateMonomerStore | private void updateMonomerStore(MonomerStore monomerStore)
throws MonomerLoadingException, IOException, MonomerException, ChemistryException {
for (Monomer monomer : monomerStore.getAllMonomersList()) {
MonomerFactory.getInstance().getMonomerStore().addNewMonomer(monomer);
// save monomer db to local file after successful update //
MonomerFactory.getInstance().saveMonomerCache();
}
} | java | private void updateMonomerStore(MonomerStore monomerStore)
throws MonomerLoadingException, IOException, MonomerException, ChemistryException {
for (Monomer monomer : monomerStore.getAllMonomersList()) {
MonomerFactory.getInstance().getMonomerStore().addNewMonomer(monomer);
// save monomer db to local file after successful update //
MonomerFactory.getInstance().saveMonomerCache();
}
} | [
"private",
"void",
"updateMonomerStore",
"(",
"MonomerStore",
"monomerStore",
")",
"throws",
"MonomerLoadingException",
",",
"IOException",
",",
"MonomerException",
",",
"ChemistryException",
"{",
"for",
"(",
"Monomer",
"monomer",
":",
"monomerStore",
".",
"getAllMonome... | method to combine the new MonomerStore to the existing one, in case of
xHELM as input
@param monomerStore
MonomerStore
@throws MonomerLoadingException
if the monomer store can not be read
@throws IOException
if the monomer store can not be read
@throws MonomerException
if the monomer is not valid
@throws ChemistryException
if the chemistry can not be initialized | [
"method",
"to",
"combine",
"the",
"new",
"MonomerStore",
"to",
"the",
"existing",
"one",
"in",
"case",
"of",
"xHELM",
"as",
"input"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L111-L118 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.readNotation | private HELM2Notation readNotation(String notation)
throws ParserException, JDOMException, IOException, MonomerException, ChemistryException {
/* xhelm notation */
if (notation.contains("<Xhelm>")) {
LOG.info("xhelm is used as input");
String xhelm = notation;
Element xHELMRootElement = getXHELMRootElement(xhelm);
notation = xHelmNotationParser.getHELMNotationString(xHELMRootElement);
MonomerStore store = xHelmNotationParser.getMonomerStore(xHELMRootElement);
updateMonomerStore(store);
}
return HELM2NotationUtils.readNotation(notation);
} | java | private HELM2Notation readNotation(String notation)
throws ParserException, JDOMException, IOException, MonomerException, ChemistryException {
/* xhelm notation */
if (notation.contains("<Xhelm>")) {
LOG.info("xhelm is used as input");
String xhelm = notation;
Element xHELMRootElement = getXHELMRootElement(xhelm);
notation = xHelmNotationParser.getHELMNotationString(xHELMRootElement);
MonomerStore store = xHelmNotationParser.getMonomerStore(xHELMRootElement);
updateMonomerStore(store);
}
return HELM2NotationUtils.readNotation(notation);
} | [
"private",
"HELM2Notation",
"readNotation",
"(",
"String",
"notation",
")",
"throws",
"ParserException",
",",
"JDOMException",
",",
"IOException",
",",
"MonomerException",
",",
"ChemistryException",
"{",
"/* xhelm notation */",
"if",
"(",
"notation",
".",
"contains",
... | method to read the HELM string, the HELM can be in version 1 or 2, or in
Xhelm format
@param notation
HELM input
@return ContainerHELM2
@throws ParserException
@throws IOException
@throws JDOMException
@throws MonomerException
@throws ChemistryException | [
"method",
"to",
"read",
"the",
"HELM",
"string",
"the",
"HELM",
"can",
"be",
"in",
"version",
"1",
"or",
"2",
"or",
"in",
"Xhelm",
"format"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L133-L147 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.validate | private HELM2Notation validate(String helm) throws ValidationException, ChemistryException {
try {
/* Read */
HELM2Notation helm2notation = readNotation(helm);
/* Validate */
LOG.info("Validation of HELM is starting");
Validation.validateNotationObjects(helm2notation);
LOG.info("Validation was successful");
return helm2notation;
} catch (MonomerException | GroupingNotationException | ConnectionNotationException | PolymerIDsException
| ParserException | JDOMException | IOException | NotationException
| org.helm.notation2.parser.exceptionparser.NotationException e) {
e.printStackTrace();
LOG.info("Validation was not successful");
LOG.error(e.getMessage());
throw new ValidationException(e.getMessage());
}
} | java | private HELM2Notation validate(String helm) throws ValidationException, ChemistryException {
try {
/* Read */
HELM2Notation helm2notation = readNotation(helm);
/* Validate */
LOG.info("Validation of HELM is starting");
Validation.validateNotationObjects(helm2notation);
LOG.info("Validation was successful");
return helm2notation;
} catch (MonomerException | GroupingNotationException | ConnectionNotationException | PolymerIDsException
| ParserException | JDOMException | IOException | NotationException
| org.helm.notation2.parser.exceptionparser.NotationException e) {
e.printStackTrace();
LOG.info("Validation was not successful");
LOG.error(e.getMessage());
throw new ValidationException(e.getMessage());
}
} | [
"private",
"HELM2Notation",
"validate",
"(",
"String",
"helm",
")",
"throws",
"ValidationException",
",",
"ChemistryException",
"{",
"try",
"{",
"/* Read */",
"HELM2Notation",
"helm2notation",
"=",
"readNotation",
"(",
"helm",
")",
";",
"/* Validate */",
"LOG",
".",... | method to validate the HELM-String input
@param helm
input HELM string
@return ContainerHELM2
@throws ValidationException
if the HELM input is not valid
@throws ChemistryException
if the Chemistry Engine can not be initialized
@throws NotationException | [
"method",
"to",
"validate",
"the",
"HELM",
"-",
"String",
"input"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L161-L182 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.validateHELM | public void validateHELM(String helm) throws ValidationException, MonomerLoadingException, ChemistryException {
validate(helm);
setMonomerFactoryToDefault(helm);
} | java | public void validateHELM(String helm) throws ValidationException, MonomerLoadingException, ChemistryException {
validate(helm);
setMonomerFactoryToDefault(helm);
} | [
"public",
"void",
"validateHELM",
"(",
"String",
"helm",
")",
"throws",
"ValidationException",
",",
"MonomerLoadingException",
",",
"ChemistryException",
"{",
"validate",
"(",
"helm",
")",
";",
"setMonomerFactoryToDefault",
"(",
"helm",
")",
";",
"}"
] | method to validate the input HELM-String
@param helm
input HELM-string
@throws ValidationException
if the input HELM is not valid
@throws MonomerLoadingException
if the MonomerFactory can not be refreshed
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"validate",
"the",
"input",
"HELM",
"-",
"String"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L196-L199 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.convertStandardHELMToCanonicalHELM | public String convertStandardHELMToCanonicalHELM(String notation)
throws HELM1FormatException, ValidationException, MonomerLoadingException, ChemistryException {
String result = HELM1Utils.getCanonical(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | java | public String convertStandardHELMToCanonicalHELM(String notation)
throws HELM1FormatException, ValidationException, MonomerLoadingException, ChemistryException {
String result = HELM1Utils.getCanonical(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | [
"public",
"String",
"convertStandardHELMToCanonicalHELM",
"(",
"String",
"notation",
")",
"throws",
"HELM1FormatException",
",",
"ValidationException",
",",
"MonomerLoadingException",
",",
"ChemistryException",
"{",
"String",
"result",
"=",
"HELM1Utils",
".",
"getCanonical"... | method to convert the input HELM into canonical HELM
@param notation
HELM input
@return canonical HELM
@throws HELM1FormatException
if HELM input contains HELM2 features
@throws ValidationException
if the HELM input is not valid
@throws MonomerLoadingException
if the MonomerFactory can not be loaded
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"convert",
"the",
"input",
"HELM",
"into",
"canonical",
"HELM"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L224-L229 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.convertIntoStandardHELM | public String convertIntoStandardHELM(String notation) throws HELM1FormatException, ValidationException,
MonomerLoadingException, CTKException, ChemistryException {
String result = HELM1Utils.getStandard(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | java | public String convertIntoStandardHELM(String notation) throws HELM1FormatException, ValidationException,
MonomerLoadingException, CTKException, ChemistryException {
String result = HELM1Utils.getStandard(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | [
"public",
"String",
"convertIntoStandardHELM",
"(",
"String",
"notation",
")",
"throws",
"HELM1FormatException",
",",
"ValidationException",
",",
"MonomerLoadingException",
",",
"CTKException",
",",
"ChemistryException",
"{",
"String",
"result",
"=",
"HELM1Utils",
".",
... | method to convert the input HELM into a standard HELM
@param notation
HELM input
@return standard HELM
@throws HELM1FormatException
if the HELM input contains HELM2 features
@throws ValidationException
if the HELM input is not valid
@throws MonomerLoadingException
if the MonomerFactory can not be loaded
@throws CTKException
general ChemToolKit exception passed to HELMToolKit
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"convert",
"the",
"input",
"HELM",
"into",
"a",
"standard",
"HELM"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L248-L253 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.calculateExtinctionCoefficient | public Float calculateExtinctionCoefficient(String notation)
throws ExtinctionCoefficientException, ValidationException, MonomerLoadingException, ChemistryException {
Float result = ExtinctionCoefficient.getInstance().calculate(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | java | public Float calculateExtinctionCoefficient(String notation)
throws ExtinctionCoefficientException, ValidationException, MonomerLoadingException, ChemistryException {
Float result = ExtinctionCoefficient.getInstance().calculate(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | [
"public",
"Float",
"calculateExtinctionCoefficient",
"(",
"String",
"notation",
")",
"throws",
"ExtinctionCoefficientException",
",",
"ValidationException",
",",
"MonomerLoadingException",
",",
"ChemistryException",
"{",
"Float",
"result",
"=",
"ExtinctionCoefficient",
".",
... | method to calculate from a non-ambiguous HELM string the extinction
coefficient
@param notation
HELM input
@return extinction coefficient from the HELM input
@throws ExtinctionCoefficientException
if the extinction coefficient can not be calculated
@throws ValidationException
if the HELM input is not valid
@throws MonomerLoadingException
if the MonomerFactory can not be refreshed
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"calculate",
"from",
"a",
"non",
"-",
"ambiguous",
"HELM",
"string",
"the",
"extinction",
"coefficient"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L271-L276 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.generateFasta | public String generateFasta(String notation)
throws FastaFormatException, ValidationException, MonomerLoadingException, ChemistryException {
String result = FastaFormat.generateFasta(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | java | public String generateFasta(String notation)
throws FastaFormatException, ValidationException, MonomerLoadingException, ChemistryException {
String result = FastaFormat.generateFasta(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | [
"public",
"String",
"generateFasta",
"(",
"String",
"notation",
")",
"throws",
"FastaFormatException",
",",
"ValidationException",
",",
"MonomerLoadingException",
",",
"ChemistryException",
"{",
"String",
"result",
"=",
"FastaFormat",
".",
"generateFasta",
"(",
"validat... | method to generate FASTA-Formats for all rna and peptide sequences from
an HELM input
@param notation
HELM input
@return FASTA containing all rna and peptide sequences
@throws ValidationException
if the HELM input is not valid
@throws FastaFormatException
if the FASTA-sequences can not be built
@throws MonomerLoadingException
if the MonomerFactory can not be loaded
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"generate",
"FASTA",
"-",
"Formats",
"for",
"all",
"rna",
"and",
"peptide",
"sequences",
"from",
"an",
"HELM",
"input"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L294-L299 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.calculateMolecularWeight | public Double calculateMolecularWeight(String notation) throws MonomerLoadingException, BuilderMoleculeException,
CTKException, ValidationException, ChemistryException {
Double result = MoleculePropertyCalculator.getMolecularWeight(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | java | public Double calculateMolecularWeight(String notation) throws MonomerLoadingException, BuilderMoleculeException,
CTKException, ValidationException, ChemistryException {
Double result = MoleculePropertyCalculator.getMolecularWeight(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | [
"public",
"Double",
"calculateMolecularWeight",
"(",
"String",
"notation",
")",
"throws",
"MonomerLoadingException",
",",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ValidationException",
",",
"ChemistryException",
"{",
"Double",
"result",
"=",
"MoleculePropertyC... | method to calculate from a non-ambiguous HELM input the molecular weight
@param notation
HELM input
@return moleuclar weight from the HELM input
@throws MonomerLoadingException
if the MonomerFactory can not be refreshed
@throws ValidationException
if the HELM input is not valid
@throws BuilderMoleculeException
if the molecule for the calculation can not be built
@throws CTKException
general ChemToolKit exception passed to HELMToolKit
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"calculate",
"from",
"a",
"non",
"-",
"ambiguous",
"HELM",
"input",
"the",
"molecular",
"weight"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L363-L368 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.getMolecularFormula | public String getMolecularFormula(String notation) throws BuilderMoleculeException, CTKException,
ValidationException, MonomerLoadingException, ChemistryException {
String result = MoleculePropertyCalculator.getMolecularFormular(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | java | public String getMolecularFormula(String notation) throws BuilderMoleculeException, CTKException,
ValidationException, MonomerLoadingException, ChemistryException {
String result = MoleculePropertyCalculator.getMolecularFormular(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | [
"public",
"String",
"getMolecularFormula",
"(",
"String",
"notation",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ValidationException",
",",
"MonomerLoadingException",
",",
"ChemistryException",
"{",
"String",
"result",
"=",
"MoleculePropertyCalcul... | method to calculate from a non-ambiguous HELM input the molecular formula
@param notation
HELM input
@return molecular formula from the HELM input
@throws ValidationException
if the HELM input is not valid
@throws BuilderMoleculeException
if the molecule for the calculation can not be built
@throws CTKException
general ChemToolKit exception passed to HELMToolKit
@throws MonomerLoadingException
if the MonomerFactory can not be refreshed
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"calculate",
"from",
"a",
"non",
"-",
"ambiguous",
"HELM",
"input",
"the",
"molecular",
"formula"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L387-L392 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.readPeptide | public String readPeptide(String peptide) throws FastaFormatException,
org.helm.notation2.parser.exceptionparser.NotationException, ChemistryException {
return SequenceConverter.readPeptide(peptide).toHELM2();
} | java | public String readPeptide(String peptide) throws FastaFormatException,
org.helm.notation2.parser.exceptionparser.NotationException, ChemistryException {
return SequenceConverter.readPeptide(peptide).toHELM2();
} | [
"public",
"String",
"readPeptide",
"(",
"String",
"peptide",
")",
"throws",
"FastaFormatException",
",",
"org",
".",
"helm",
".",
"notation2",
".",
"parser",
".",
"exceptionparser",
".",
"NotationException",
",",
"ChemistryException",
"{",
"return",
"SequenceConvert... | method to read a single peptide sequence and generates HELM
@param peptide
peptide sequence
@return HELM
@throws org.helm.notation2.parser.exceptionparser.NotationException
if the notation object can not be built
@throws FastaFormatException
if the peptide sequence is not in the right format
@throws ChemistryException
if chemistry engine can not be initialized | [
"method",
"to",
"read",
"a",
"single",
"peptide",
"sequence",
"and",
"generates",
"HELM"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L439-L442 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.readRNA | public String readRNA(String rna) throws org.helm.notation2.parser.exceptionparser.NotationException,
FastaFormatException, ChemistryException, org.helm.notation2.exception.NucleotideLoadingException {
return SequenceConverter.readRNA(rna).toHELM2();
} | java | public String readRNA(String rna) throws org.helm.notation2.parser.exceptionparser.NotationException,
FastaFormatException, ChemistryException, org.helm.notation2.exception.NucleotideLoadingException {
return SequenceConverter.readRNA(rna).toHELM2();
} | [
"public",
"String",
"readRNA",
"(",
"String",
"rna",
")",
"throws",
"org",
".",
"helm",
".",
"notation2",
".",
"parser",
".",
"exceptionparser",
".",
"NotationException",
",",
"FastaFormatException",
",",
"ChemistryException",
",",
"org",
".",
"helm",
".",
"no... | method to read a single rna sequence and generates HELM
@param rna
rna sequence
@return HELM
@throws org.helm.notation2.parser.exceptionparser.NotationException
if the notation object can not be built
@throws FastaFormatException
if the rna-sequence is not in the right format HELM
@throws ChemistryException
if chemistry engine can not be initialized
@throws org.helm.notation2.exception.NucleotideLoadingException
if nucleotides can not be loaded | [
"method",
"to",
"read",
"a",
"single",
"rna",
"sequence",
"and",
"generates",
"HELM"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L459-L462 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.generateImageForHELMMolecule | public byte[] generateImageForHELMMolecule(String notation)
throws BuilderMoleculeException, CTKException, IOException, ValidationException, ChemistryException {
byte[] result = Images.generateImageHELMMolecule(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | java | public byte[] generateImageForHELMMolecule(String notation)
throws BuilderMoleculeException, CTKException, IOException, ValidationException, ChemistryException {
byte[] result = Images.generateImageHELMMolecule(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | [
"public",
"byte",
"[",
"]",
"generateImageForHELMMolecule",
"(",
"String",
"notation",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"IOException",
",",
"ValidationException",
",",
"ChemistryException",
"{",
"byte",
"[",
"]",
"result",
"=",
"I... | method to generate a HELM molecule
@param notation
HELM string
@return generated molecule image in byte[]
@throws ValidationException
if the HELM string is not valid
@throws BuilderMoleculeException
if the molecule can't be built
@throws CTKException
general ChemToolKit exception passed to HELMToolKit
@throws IOException
if the image can not be produced
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"generate",
"a",
"HELM",
"molecule"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L481-L486 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.generateImageForMonomer | public byte[] generateImageForMonomer(Monomer monomer, boolean showRgroups)
throws BuilderMoleculeException, CTKException, ChemistryException {
return Images.generateImageofMonomer(monomer, showRgroups);
} | java | public byte[] generateImageForMonomer(Monomer monomer, boolean showRgroups)
throws BuilderMoleculeException, CTKException, ChemistryException {
return Images.generateImageofMonomer(monomer, showRgroups);
} | [
"public",
"byte",
"[",
"]",
"generateImageForMonomer",
"(",
"Monomer",
"monomer",
",",
"boolean",
"showRgroups",
")",
"throws",
"BuilderMoleculeException",
",",
"CTKException",
",",
"ChemistryException",
"{",
"return",
"Images",
".",
"generateImageofMonomer",
"(",
"mo... | method to generate an image for a monomer
@param monomer
Monomer Input
@param showRgroups
wheter to show the r groups in the image
@return generated molecule image in byte[]
@throws BuilderMoleculeException
if the molecule can not be built
@throws CTKException
general ChemToolKit exception passed to HELMToolKit
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"generate",
"an",
"image",
"for",
"a",
"monomer"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L503-L506 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.generateJSON | public String generateJSON(String helm)
throws ValidationException, MonomerLoadingException, ChemistryException, JsonProcessingException {
String result = HELM2NotationUtils.toJSON(validate(helm));
setMonomerFactoryToDefault(helm);
return result;
} | java | public String generateJSON(String helm)
throws ValidationException, MonomerLoadingException, ChemistryException, JsonProcessingException {
String result = HELM2NotationUtils.toJSON(validate(helm));
setMonomerFactoryToDefault(helm);
return result;
} | [
"public",
"String",
"generateJSON",
"(",
"String",
"helm",
")",
"throws",
"ValidationException",
",",
"MonomerLoadingException",
",",
"ChemistryException",
",",
"JsonProcessingException",
"{",
"String",
"result",
"=",
"HELM2NotationUtils",
".",
"toJSON",
"(",
"validate"... | method to generate JSON-Output for the HELM
@param helm
HELM input
@return HELM as JSON-objects
@throws ValidationException
if the HELM input is not valid
@throws MonomerLoadingException
if the MonomerFactory can not be refreshed
@throws ChemistryException
if the Chemistry Engine can not be initialized
@throws JsonProcessingException
if json can not be produced | [
"method",
"to",
"generate",
"JSON",
"-",
"Output",
"for",
"the",
"HELM"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L523-L528 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.setMonomerFactoryToDefault | private void setMonomerFactoryToDefault(String helm) throws MonomerLoadingException, ChemistryException {
if (helm.contains("<Xhelm>")) {
LOG.info("Refresh local Monomer Store in case of Xhelm");
MonomerFactory.refreshMonomerCache();
}
} | java | private void setMonomerFactoryToDefault(String helm) throws MonomerLoadingException, ChemistryException {
if (helm.contains("<Xhelm>")) {
LOG.info("Refresh local Monomer Store in case of Xhelm");
MonomerFactory.refreshMonomerCache();
}
} | [
"private",
"void",
"setMonomerFactoryToDefault",
"(",
"String",
"helm",
")",
"throws",
"MonomerLoadingException",
",",
"ChemistryException",
"{",
"if",
"(",
"helm",
".",
"contains",
"(",
"\"<Xhelm>\"",
")",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Refresh local Monom... | method to set the MonomerFactory to the default one, this is only done in
case of xHELM input
@param helm
input HELM
@throws MonomerLoadingException
if the MonomerFactory can not be loaded
@throws ChemistryException
if chemistry engine can not be initialized | [
"method",
"to",
"set",
"the",
"MonomerFactory",
"to",
"the",
"default",
"one",
"this",
"is",
"only",
"done",
"in",
"case",
"of",
"xHELM",
"input"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L554-L559 | train |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/WebService.java | WebService.generateNaturalAnalogSequencePeptide | public String generateNaturalAnalogSequencePeptide(String notation)
throws HELM2HandledException, ValidationException, MonomerLoadingException, PeptideUtilsException,
org.helm.notation2.parser.exceptionparser.NotationException, ChemistryException {
String result = SequenceConverter.getPeptideNaturalAnalogSequenceFromNotation(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | java | public String generateNaturalAnalogSequencePeptide(String notation)
throws HELM2HandledException, ValidationException, MonomerLoadingException, PeptideUtilsException,
org.helm.notation2.parser.exceptionparser.NotationException, ChemistryException {
String result = SequenceConverter.getPeptideNaturalAnalogSequenceFromNotation(validate(notation));
setMonomerFactoryToDefault(notation);
return result;
} | [
"public",
"String",
"generateNaturalAnalogSequencePeptide",
"(",
"String",
"notation",
")",
"throws",
"HELM2HandledException",
",",
"ValidationException",
",",
"MonomerLoadingException",
",",
"PeptideUtilsException",
",",
"org",
".",
"helm",
".",
"notation2",
".",
"parser... | method to generate the natural analogue sequence for all
peptide-sequences from an HELM input
@param notation
input HELM
@return natural analogue peptide sequences, divided by white spaces
@throws org.helm.notation2.parser.exceptionparser.NotationException
if the input complex notation contains non-peptide polymer(s)
@throws HELM2HandledException
if the HELM input contains HELM2 features
@throws ValidationException
if the input HELM is not valid
@throws MonomerLoadingException
if the MonomerFactory can not be refreshed
@throws PeptideUtilsException
if the polymer is not a peptide
@throws org.helm.notation2.parser.exceptionparser.NotationException
if notation is not valid
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"method",
"to",
"generate",
"the",
"natural",
"analogue",
"sequence",
"for",
"all",
"peptide",
"-",
"sequences",
"from",
"an",
"HELM",
"input"
] | ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38 | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/WebService.java#L583-L589 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.