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
ow2-chameleon/fuchsia
importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveAlarmSensorCommandClass.java
ZWaveAlarmSensorCommandClass.initialize
public Collection<SerialMessage> initialize() { ArrayList<SerialMessage> result = new ArrayList<SerialMessage>(); if (this.getNode().getManufacturer() == 0x010F && this.getNode().getDeviceType() == 0x0501) { logger.warn("Detected Fibaro FGBS001 Universal Sensor - this device fails to respond to SENSOR_AL...
java
public Collection<SerialMessage> initialize() { ArrayList<SerialMessage> result = new ArrayList<SerialMessage>(); if (this.getNode().getManufacturer() == 0x010F && this.getNode().getDeviceType() == 0x0501) { logger.warn("Detected Fibaro FGBS001 Universal Sensor - this device fails to respond to SENSOR_AL...
[ "public", "Collection", "<", "SerialMessage", ">", "initialize", "(", ")", "{", "ArrayList", "<", "SerialMessage", ">", "result", "=", "new", "ArrayList", "<", "SerialMessage", ">", "(", ")", ";", "if", "(", "this", ".", "getNode", "(", ")", ".", "getMan...
Initializes the alarm sensor command class. Requests the supported alarm types.
[ "Initializes", "the", "alarm", "sensor", "command", "class", ".", "Requests", "the", "supported", "alarm", "types", "." ]
4e9318eadbdeb945e529789f573b45386e619bed
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveAlarmSensorCommandClass.java#L258-L268
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.newDateTime
public static java.util.Date newDateTime() { return new java.util.Date((System.currentTimeMillis() / SECOND_MILLIS) * SECOND_MILLIS); }
java
public static java.util.Date newDateTime() { return new java.util.Date((System.currentTimeMillis() / SECOND_MILLIS) * SECOND_MILLIS); }
[ "public", "static", "java", ".", "util", ".", "Date", "newDateTime", "(", ")", "{", "return", "new", "java", ".", "util", ".", "Date", "(", "(", "System", ".", "currentTimeMillis", "(", ")", "/", "SECOND_MILLIS", ")", "*", "SECOND_MILLIS", ")", ";", "}...
Create a new DateTime. To the last second. This will not create any extra-millis-seconds, which may cause bugs when writing to stores such as databases that round milli-seconds up and down.
[ "Create", "a", "new", "DateTime", ".", "To", "the", "last", "second", ".", "This", "will", "not", "create", "any", "extra", "-", "millis", "-", "seconds", "which", "may", "cause", "bugs", "when", "writing", "to", "stores", "such", "as", "databases", "tha...
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L65-L67
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.newDate
public static java.sql.Date newDate() { return new java.sql.Date((System.currentTimeMillis() / DAY_MILLIS) * DAY_MILLIS); }
java
public static java.sql.Date newDate() { return new java.sql.Date((System.currentTimeMillis() / DAY_MILLIS) * DAY_MILLIS); }
[ "public", "static", "java", ".", "sql", ".", "Date", "newDate", "(", ")", "{", "return", "new", "java", ".", "sql", ".", "Date", "(", "(", "System", ".", "currentTimeMillis", "(", ")", "/", "DAY_MILLIS", ")", "*", "DAY_MILLIS", ")", ";", "}" ]
Create a new Date. To the last day.
[ "Create", "a", "new", "Date", ".", "To", "the", "last", "day", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L72-L74
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.newTime
public static java.sql.Time newTime() { return new java.sql.Time(System.currentTimeMillis() % DAY_MILLIS); }
java
public static java.sql.Time newTime() { return new java.sql.Time(System.currentTimeMillis() % DAY_MILLIS); }
[ "public", "static", "java", ".", "sql", ".", "Time", "newTime", "(", ")", "{", "return", "new", "java", ".", "sql", ".", "Time", "(", "System", ".", "currentTimeMillis", "(", ")", "%", "DAY_MILLIS", ")", ";", "}" ]
Create a new Time, with no date component.
[ "Create", "a", "new", "Time", "with", "no", "date", "component", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L79-L81
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.secondsDiff
public static int secondsDiff(Date earlierDate, Date laterDate) { if (earlierDate == null || laterDate == null) { return 0; } return (int) ((laterDate.getTime() / SECOND_MILLIS) - (earlierDate.getTime() / SECOND_MILLIS)); }
java
public static int secondsDiff(Date earlierDate, Date laterDate) { if (earlierDate == null || laterDate == null) { return 0; } return (int) ((laterDate.getTime() / SECOND_MILLIS) - (earlierDate.getTime() / SECOND_MILLIS)); }
[ "public", "static", "int", "secondsDiff", "(", "Date", "earlierDate", ",", "Date", "laterDate", ")", "{", "if", "(", "earlierDate", "==", "null", "||", "laterDate", "==", "null", ")", "{", "return", "0", ";", "}", "return", "(", "int", ")", "(", "(", ...
Get the seconds difference
[ "Get", "the", "seconds", "difference" ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L93-L99
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.minutesDiff
public static int minutesDiff(Date earlierDate, Date laterDate) { if (earlierDate == null || laterDate == null) { return 0; } return (int) ((laterDate.getTime() / MINUTE_MILLIS) - (earlierDate.getTime() / MINUTE_MILLIS)); }
java
public static int minutesDiff(Date earlierDate, Date laterDate) { if (earlierDate == null || laterDate == null) { return 0; } return (int) ((laterDate.getTime() / MINUTE_MILLIS) - (earlierDate.getTime() / MINUTE_MILLIS)); }
[ "public", "static", "int", "minutesDiff", "(", "Date", "earlierDate", ",", "Date", "laterDate", ")", "{", "if", "(", "earlierDate", "==", "null", "||", "laterDate", "==", "null", ")", "{", "return", "0", ";", "}", "return", "(", "int", ")", "(", "(", ...
Get the minutes difference
[ "Get", "the", "minutes", "difference" ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L104-L110
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.hoursDiff
public static int hoursDiff(Date earlierDate, Date laterDate) { if (earlierDate == null || laterDate == null) { return 0; } return (int) ((laterDate.getTime() / HOUR_MILLIS) - (earlierDate.getTime() / HOUR_MILLIS)); }
java
public static int hoursDiff(Date earlierDate, Date laterDate) { if (earlierDate == null || laterDate == null) { return 0; } return (int) ((laterDate.getTime() / HOUR_MILLIS) - (earlierDate.getTime() / HOUR_MILLIS)); }
[ "public", "static", "int", "hoursDiff", "(", "Date", "earlierDate", ",", "Date", "laterDate", ")", "{", "if", "(", "earlierDate", "==", "null", "||", "laterDate", "==", "null", ")", "{", "return", "0", ";", "}", "return", "(", "int", ")", "(", "(", "...
Get the hours difference
[ "Get", "the", "hours", "difference" ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L115-L121
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.daysDiff
public static int daysDiff(Date earlierDate, Date laterDate) { if (earlierDate == null || laterDate == null) { return 0; } return (int) ((laterDate.getTime() / DAY_MILLIS) - (earlierDate.getTime() / DAY_MILLIS)); }
java
public static int daysDiff(Date earlierDate, Date laterDate) { if (earlierDate == null || laterDate == null) { return 0; } return (int) ((laterDate.getTime() / DAY_MILLIS) - (earlierDate.getTime() / DAY_MILLIS)); }
[ "public", "static", "int", "daysDiff", "(", "Date", "earlierDate", ",", "Date", "laterDate", ")", "{", "if", "(", "earlierDate", "==", "null", "||", "laterDate", "==", "null", ")", "{", "return", "0", ";", "}", "return", "(", "int", ")", "(", "(", "l...
Get the days difference
[ "Get", "the", "days", "difference" ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L126-L132
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.rollTime
public static java.sql.Time rollTime(java.util.Date startDate, int period, int amount) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(startDate); gc.add(period, amount); return new java.sql.Time(gc.getTime().getTime()); }
java
public static java.sql.Time rollTime(java.util.Date startDate, int period, int amount) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(startDate); gc.add(period, amount); return new java.sql.Time(gc.getTime().getTime()); }
[ "public", "static", "java", ".", "sql", ".", "Time", "rollTime", "(", "java", ".", "util", ".", "Date", "startDate", ",", "int", "period", ",", "int", "amount", ")", "{", "GregorianCalendar", "gc", "=", "new", "GregorianCalendar", "(", ")", ";", "gc", ...
Roll the java.util.Time forward or backward. @param startDate - The start date @param period Calendar.YEAR etc @param amount - Negative to rollbackwards.
[ "Roll", "the", "java", ".", "util", ".", "Time", "forward", "or", "backward", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L141-L146
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.rollDateTime
public static java.util.Date rollDateTime(java.util.Date startDate, int period, int amount) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(startDate); gc.add(period, amount); return new java.util.Date(gc.getTime().getTime()); }
java
public static java.util.Date rollDateTime(java.util.Date startDate, int period, int amount) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(startDate); gc.add(period, amount); return new java.util.Date(gc.getTime().getTime()); }
[ "public", "static", "java", ".", "util", ".", "Date", "rollDateTime", "(", "java", ".", "util", ".", "Date", "startDate", ",", "int", "period", ",", "int", "amount", ")", "{", "GregorianCalendar", "gc", "=", "new", "GregorianCalendar", "(", ")", ";", "gc...
Roll the java.util.Date forward or backward. @param startDate - The start date @param period Calendar.YEAR etc @param amount - Negative to rollbackwards.
[ "Roll", "the", "java", ".", "util", ".", "Date", "forward", "or", "backward", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L155-L160
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.rollYears
public static java.sql.Date rollYears(java.util.Date startDate, int years) { return rollDate(startDate, Calendar.YEAR, years); }
java
public static java.sql.Date rollYears(java.util.Date startDate, int years) { return rollDate(startDate, Calendar.YEAR, years); }
[ "public", "static", "java", ".", "sql", ".", "Date", "rollYears", "(", "java", ".", "util", ".", "Date", "startDate", ",", "int", "years", ")", "{", "return", "rollDate", "(", "startDate", ",", "Calendar", ".", "YEAR", ",", "years", ")", ";", "}" ]
Roll the years forward or backward. @param startDate - The start date @param years - Negative to rollbackwards.
[ "Roll", "the", "years", "forward", "or", "backward", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L182-L184
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.dateEquals
@SuppressWarnings("deprecation") public static boolean dateEquals(java.util.Date d1, java.util.Date d2) { if (d1 == null || d2 == null) { return false; } return d1.getDate() == d2.getDate() && d1.getMonth() == d2.getMonth() && d1.getYear() == d2.getY...
java
@SuppressWarnings("deprecation") public static boolean dateEquals(java.util.Date d1, java.util.Date d2) { if (d1 == null || d2 == null) { return false; } return d1.getDate() == d2.getDate() && d1.getMonth() == d2.getMonth() && d1.getYear() == d2.getY...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "boolean", "dateEquals", "(", "java", ".", "util", ".", "Date", "d1", ",", "java", ".", "util", ".", "Date", "d2", ")", "{", "if", "(", "d1", "==", "null", "||", "d2", "==", "n...
Checks the day, month and year are equal.
[ "Checks", "the", "day", "month", "and", "year", "are", "equal", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L209-L218
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.timeEquals
@SuppressWarnings("deprecation") public static boolean timeEquals(java.util.Date d1, java.util.Date d2) { if (d1 == null || d2 == null) { return false; } return d1.getHours() == d2.getHours() && d1.getMinutes() == d2.getMinutes() && d1.getSeconds() =...
java
@SuppressWarnings("deprecation") public static boolean timeEquals(java.util.Date d1, java.util.Date d2) { if (d1 == null || d2 == null) { return false; } return d1.getHours() == d2.getHours() && d1.getMinutes() == d2.getMinutes() && d1.getSeconds() =...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "boolean", "timeEquals", "(", "java", ".", "util", ".", "Date", "d1", ",", "java", ".", "util", ".", "Date", "d2", ")", "{", "if", "(", "d1", "==", "null", "||", "d2", "==", "n...
Checks the hour, minute and second are equal.
[ "Checks", "the", "hour", "minute", "and", "second", "are", "equal", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L223-L232
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.dateTimeEquals
@SuppressWarnings("deprecation") public static boolean dateTimeEquals(java.util.Date d1, java.util.Date d2) { if (d1 == null || d2 == null) { return false; } return d1.getDate() == d2.getDate() && d1.getMonth() == d2.getMonth() && d1.getYear() == d2....
java
@SuppressWarnings("deprecation") public static boolean dateTimeEquals(java.util.Date d1, java.util.Date d2) { if (d1 == null || d2 == null) { return false; } return d1.getDate() == d2.getDate() && d1.getMonth() == d2.getMonth() && d1.getYear() == d2....
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "boolean", "dateTimeEquals", "(", "java", ".", "util", ".", "Date", "d1", ",", "java", ".", "util", ".", "Date", "d2", ")", "{", "if", "(", "d1", "==", "null", "||", "d2", "==", ...
Checks the second, hour, month, day, month and year are equal.
[ "Checks", "the", "second", "hour", "month", "day", "month", "and", "year", "are", "equal", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L237-L249
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.toObject
public static Object toObject(Class<?> clazz, Object value) throws ParseException { if (value == null) { return null; } if (clazz == null) { return value; } if (java.sql.Date.class.isAssignableFrom(clazz)) { return toDate(value); } ...
java
public static Object toObject(Class<?> clazz, Object value) throws ParseException { if (value == null) { return null; } if (clazz == null) { return value; } if (java.sql.Date.class.isAssignableFrom(clazz)) { return toDate(value); } ...
[ "public", "static", "Object", "toObject", "(", "Class", "<", "?", ">", "clazz", ",", "Object", "value", ")", "throws", "ParseException", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "clazz", "==", "null", ")...
Convert an Object of type Class to an Object.
[ "Convert", "an", "Object", "of", "type", "Class", "to", "an", "Object", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L254-L276
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.getDateTime
public static java.util.Date getDateTime(Object value) { try { return toDateTime(value); } catch (ParseException pe) { pe.printStackTrace(); return null; } }
java
public static java.util.Date getDateTime(Object value) { try { return toDateTime(value); } catch (ParseException pe) { pe.printStackTrace(); return null; } }
[ "public", "static", "java", ".", "util", ".", "Date", "getDateTime", "(", "Object", "value", ")", "{", "try", "{", "return", "toDateTime", "(", "value", ")", ";", "}", "catch", "(", "ParseException", "pe", ")", "{", "pe", ".", "printStackTrace", "(", "...
Convert an Object to a DateTime, without an Exception
[ "Convert", "an", "Object", "to", "a", "DateTime", "without", "an", "Exception" ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L281-L288
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.toDateTime
public static java.util.Date toDateTime(Object value) throws ParseException { if (value == null) { return null; } if (value instanceof java.util.Date) { return (java.util.Date) value; } if (value instanceof String) { if ("".equals((String) valu...
java
public static java.util.Date toDateTime(Object value) throws ParseException { if (value == null) { return null; } if (value instanceof java.util.Date) { return (java.util.Date) value; } if (value instanceof String) { if ("".equals((String) valu...
[ "public", "static", "java", ".", "util", ".", "Date", "toDateTime", "(", "Object", "value", ")", "throws", "ParseException", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "value", "instanceof", "java", ".", "ut...
Convert an Object to a DateTime.
[ "Convert", "an", "Object", "to", "a", "DateTime", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L293-L308
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.getDate
public static java.sql.Date getDate(Object value) { try { return toDate(value); } catch (ParseException pe) { pe.printStackTrace(); return null; } }
java
public static java.sql.Date getDate(Object value) { try { return toDate(value); } catch (ParseException pe) { pe.printStackTrace(); return null; } }
[ "public", "static", "java", ".", "sql", ".", "Date", "getDate", "(", "Object", "value", ")", "{", "try", "{", "return", "toDate", "(", "value", ")", ";", "}", "catch", "(", "ParseException", "pe", ")", "{", "pe", ".", "printStackTrace", "(", ")", ";"...
Convert an Object to a Date, without an Exception
[ "Convert", "an", "Object", "to", "a", "Date", "without", "an", "Exception" ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L313-L320
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.toDate
public static java.sql.Date toDate(Object value) throws ParseException { if (value == null) { return null; } if (value instanceof java.sql.Date) { return (java.sql.Date) value; } if (value instanceof String) { if ("".equals((String) value)) { ...
java
public static java.sql.Date toDate(Object value) throws ParseException { if (value == null) { return null; } if (value instanceof java.sql.Date) { return (java.sql.Date) value; } if (value instanceof String) { if ("".equals((String) value)) { ...
[ "public", "static", "java", ".", "sql", ".", "Date", "toDate", "(", "Object", "value", ")", "throws", "ParseException", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "value", "instanceof", "java", ".", "sql", ...
Convert an Object to a Date.
[ "Convert", "an", "Object", "to", "a", "Date", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L325-L340
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.getTime
public static java.sql.Time getTime(Object value) { try { return toTime(value); } catch (ParseException pe) { pe.printStackTrace(); return null; } }
java
public static java.sql.Time getTime(Object value) { try { return toTime(value); } catch (ParseException pe) { pe.printStackTrace(); return null; } }
[ "public", "static", "java", ".", "sql", ".", "Time", "getTime", "(", "Object", "value", ")", "{", "try", "{", "return", "toTime", "(", "value", ")", ";", "}", "catch", "(", "ParseException", "pe", ")", "{", "pe", ".", "printStackTrace", "(", ")", ";"...
Convert an Object to a Time, without an Exception
[ "Convert", "an", "Object", "to", "a", "Time", "without", "an", "Exception" ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L345-L352
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.toTime
public static java.sql.Time toTime(Object value) throws ParseException { if (value == null) { return null; } if (value instanceof java.sql.Time) { return (java.sql.Time) value; } if (value instanceof String) { if ("".equals((String) value)) { ...
java
public static java.sql.Time toTime(Object value) throws ParseException { if (value == null) { return null; } if (value instanceof java.sql.Time) { return (java.sql.Time) value; } if (value instanceof String) { if ("".equals((String) value)) { ...
[ "public", "static", "java", ".", "sql", ".", "Time", "toTime", "(", "Object", "value", ")", "throws", "ParseException", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "value", "instanceof", "java", ".", "sql", ...
Convert an Object to a Time.
[ "Convert", "an", "Object", "to", "a", "Time", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L357-L372
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.getTimestamp
public static java.sql.Timestamp getTimestamp(Object value) { try { return toTimestamp(value); } catch (ParseException pe) { pe.printStackTrace(); return null; } }
java
public static java.sql.Timestamp getTimestamp(Object value) { try { return toTimestamp(value); } catch (ParseException pe) { pe.printStackTrace(); return null; } }
[ "public", "static", "java", ".", "sql", ".", "Timestamp", "getTimestamp", "(", "Object", "value", ")", "{", "try", "{", "return", "toTimestamp", "(", "value", ")", ";", "}", "catch", "(", "ParseException", "pe", ")", "{", "pe", ".", "printStackTrace", "(...
Convert an Object to a Timestamp, without an Exception
[ "Convert", "an", "Object", "to", "a", "Timestamp", "without", "an", "Exception" ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L377-L384
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.toTimestamp
public static java.sql.Timestamp toTimestamp(Object value) throws ParseException { if (value == null) { return null; } if (value instanceof java.sql.Timestamp) { return (java.sql.Timestamp) value; } if (value instanceof String) { if ("".equals...
java
public static java.sql.Timestamp toTimestamp(Object value) throws ParseException { if (value == null) { return null; } if (value instanceof java.sql.Timestamp) { return (java.sql.Timestamp) value; } if (value instanceof String) { if ("".equals...
[ "public", "static", "java", ".", "sql", ".", "Timestamp", "toTimestamp", "(", "Object", "value", ")", "throws", "ParseException", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "value", "instanceof", "java", ".", ...
Convert an Object to a Timestamp.
[ "Convert", "an", "Object", "to", "a", "Timestamp", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L389-L405
train
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.isTimeInRange
@SuppressWarnings("deprecation") public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d) { d = new java.sql.Time(d.getHours(), d.getMinutes(), d.getSeconds()); if (start == null || end == null) { return false; } if (start.before(end) &...
java
@SuppressWarnings("deprecation") public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d) { d = new java.sql.Time(d.getHours(), d.getMinutes(), d.getSeconds()); if (start == null || end == null) { return false; } if (start.before(end) &...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "boolean", "isTimeInRange", "(", "java", ".", "sql", ".", "Time", "start", ",", "java", ".", "sql", ".", "Time", "end", ",", "java", ".", "util", ".", "Date", "d", ")", "{", "d",...
Tells you if the date part of a datetime is in a certain time range.
[ "Tells", "you", "if", "the", "date", "part", "of", "a", "datetime", "is", "in", "a", "certain", "time", "range", "." ]
223c4443c2cee662576ce644e552588fa114aa94
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L410-L426
train
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java
TrajectoryUtil.combineTrajectory
public static Trajectory combineTrajectory(Trajectory a, Trajectory b){ if(a.getDimension()!=b.getDimension()){ throw new IllegalArgumentException("Combination not possible: The trajectorys does not have the same dimension"); } if(a.size()!=b.size()){ throw new IllegalArgumentException("Combination not poss...
java
public static Trajectory combineTrajectory(Trajectory a, Trajectory b){ if(a.getDimension()!=b.getDimension()){ throw new IllegalArgumentException("Combination not possible: The trajectorys does not have the same dimension"); } if(a.size()!=b.size()){ throw new IllegalArgumentException("Combination not poss...
[ "public", "static", "Trajectory", "combineTrajectory", "(", "Trajectory", "a", ",", "Trajectory", "b", ")", "{", "if", "(", "a", ".", "getDimension", "(", ")", "!=", "b", ".", "getDimension", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", ...
Combines two trajectories by adding the corresponding positions. The trajectories have to have the same length. @param a The first trajectory @param b The second trajectory @return The combined trajectory
[ "Combines", "two", "trajectories", "by", "adding", "the", "corresponding", "positions", ".", "The", "trajectories", "have", "to", "have", "the", "same", "length", "." ]
505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java#L45-L63
train
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java
TrajectoryUtil.concactTrajectorie
public static Trajectory concactTrajectorie(Trajectory a, Trajectory b){ if(a.getDimension()!=b.getDimension()){ throw new IllegalArgumentException("Combination not possible: The trajectorys does not have the same dimension"); } Trajectory c = new Trajectory(a.getDimension()); for(int i = 0 ; i < a.size()...
java
public static Trajectory concactTrajectorie(Trajectory a, Trajectory b){ if(a.getDimension()!=b.getDimension()){ throw new IllegalArgumentException("Combination not possible: The trajectorys does not have the same dimension"); } Trajectory c = new Trajectory(a.getDimension()); for(int i = 0 ; i < a.size()...
[ "public", "static", "Trajectory", "concactTrajectorie", "(", "Trajectory", "a", ",", "Trajectory", "b", ")", "{", "if", "(", "a", ".", "getDimension", "(", ")", "!=", "b", ".", "getDimension", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", ...
Concatenates the trajectory a and b @param a The end of this trajectory will be connected to the start of trajectory b @param b The start of this trajectory will be connected to the end of trajectory a @return Concatenated trajectory
[ "Concatenates", "the", "trajectory", "a", "and", "b" ]
505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java#L71-L97
train
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java
TrajectoryUtil.resample
public static Trajectory resample(Trajectory t, int n){ Trajectory t1 = new Trajectory(2); for(int i = 0; i < t.size(); i=i+n){ t1.add(t.get(i)); } return t1; }
java
public static Trajectory resample(Trajectory t, int n){ Trajectory t1 = new Trajectory(2); for(int i = 0; i < t.size(); i=i+n){ t1.add(t.get(i)); } return t1; }
[ "public", "static", "Trajectory", "resample", "(", "Trajectory", "t", ",", "int", "n", ")", "{", "Trajectory", "t1", "=", "new", "Trajectory", "(", "2", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "t", ".", "size", "(", ")", ";", ...
Resamples a trajectory @param t Trajectory to resample @param n Resample rate @return Returns a resampled trajectory which contains every n'th position of t
[ "Resamples", "a", "trajectory" ]
505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java#L105-L113
train
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java
TrajectoryUtil.getTrajectoryByID
public static Trajectory getTrajectoryByID(List<? extends Trajectory> t, int id){ Trajectory track = null; for(int i = 0; i < t.size() ; i++){ if(t.get(i).getID()==id){ track = t.get(i); break; } } return track; }
java
public static Trajectory getTrajectoryByID(List<? extends Trajectory> t, int id){ Trajectory track = null; for(int i = 0; i < t.size() ; i++){ if(t.get(i).getID()==id){ track = t.get(i); break; } } return track; }
[ "public", "static", "Trajectory", "getTrajectoryByID", "(", "List", "<", "?", "extends", "Trajectory", ">", "t", ",", "int", "id", ")", "{", "Trajectory", "track", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "t", ".", "size", ...
Finds trajectory by ID @param t List of Trajectories @param id ID of the trajectorie @return Trajectory with ID=id
[ "Finds", "trajectory", "by", "ID" ]
505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java#L164-L173
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/converters/beans/BeanPropertyTypeProvider.java
BeanPropertyTypeProvider.setPropertyDestinationType
public void setPropertyDestinationType(Class<?> clazz, String propertyName, TypeReference<?> destinationType) { propertiesDestinationTypes.put(new ClassProperty(clazz, propertyName), destinationType); }
java
public void setPropertyDestinationType(Class<?> clazz, String propertyName, TypeReference<?> destinationType) { propertiesDestinationTypes.put(new ClassProperty(clazz, propertyName), destinationType); }
[ "public", "void", "setPropertyDestinationType", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ",", "TypeReference", "<", "?", ">", "destinationType", ")", "{", "propertiesDestinationTypes", ".", "put", "(", "new", "ClassProperty", "(", "cl...
set the property destination type for given property @param propertyName @param destinationType
[ "set", "the", "property", "destination", "type", "for", "given", "property" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/converters/beans/BeanPropertyTypeProvider.java#L40-L43
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/converters/MultiConverter.java
MultiConverter.addConverter
public void addConverter(int index, IConverter converter) { converterList.add(index, converter); if (converter instanceof IContainerConverter) { IContainerConverter containerConverter = (IContainerConverter) converter; if (containerConverter.getElementConverter() == null) { containerConverter.setElem...
java
public void addConverter(int index, IConverter converter) { converterList.add(index, converter); if (converter instanceof IContainerConverter) { IContainerConverter containerConverter = (IContainerConverter) converter; if (containerConverter.getElementConverter() == null) { containerConverter.setElem...
[ "public", "void", "addConverter", "(", "int", "index", ",", "IConverter", "converter", ")", "{", "converterList", ".", "add", "(", "index", ",", "converter", ")", ";", "if", "(", "converter", "instanceof", "IContainerConverter", ")", "{", "IContainerConverter", ...
add converter at given index. The index can be changed during conversion if canReorder is true @param index @param converter
[ "add", "converter", "at", "given", "index", ".", "The", "index", "can", "be", "changed", "during", "conversion", "if", "canReorder", "is", "true" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/converters/MultiConverter.java#L60-L68
train
jbossws/jbossws-spi
src/main/java/org/jboss/wsf/spi/SPIProviderResolver.java
SPIProviderResolver.getInstance
public static SPIProviderResolver getInstance(ClassLoader cl) { SPIProviderResolver resolver = (SPIProviderResolver)ServiceLoader.loadService(SPIProviderResolver.class.getName(), DEFAULT_SPI_PROVIDER_RESOLVER, cl); return resolver; }
java
public static SPIProviderResolver getInstance(ClassLoader cl) { SPIProviderResolver resolver = (SPIProviderResolver)ServiceLoader.loadService(SPIProviderResolver.class.getName(), DEFAULT_SPI_PROVIDER_RESOLVER, cl); return resolver; }
[ "public", "static", "SPIProviderResolver", "getInstance", "(", "ClassLoader", "cl", ")", "{", "SPIProviderResolver", "resolver", "=", "(", "SPIProviderResolver", ")", "ServiceLoader", ".", "loadService", "(", "SPIProviderResolver", ".", "class", ".", "getName", "(", ...
Get the SPIProviderResolver instance using the provided classloader for lookup @param cl classloader to use for lookup @return instance of this class
[ "Get", "the", "SPIProviderResolver", "instance", "using", "the", "provided", "classloader", "for", "lookup" ]
845e66c18679ce3aaf76f849822110b4650a9d78
https://github.com/jbossws/jbossws-spi/blob/845e66c18679ce3aaf76f849822110b4650a9d78/src/main/java/org/jboss/wsf/spi/SPIProviderResolver.java#L52-L56
train
httpcache4j/httpcache4j
httpcache4j-api/src/main/java/org/codehaus/httpcache4j/util/DirectivesParser.java
DirectivesParser.createParameter
static Parameter createParameter(final String name, final String value) { if (value != null && isQuoted(value)) { return new QuotedParameter(name, value); } return new Parameter(name, value); }
java
static Parameter createParameter(final String name, final String value) { if (value != null && isQuoted(value)) { return new QuotedParameter(name, value); } return new Parameter(name, value); }
[ "static", "Parameter", "createParameter", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "if", "(", "value", "!=", "null", "&&", "isQuoted", "(", "value", ")", ")", "{", "return", "new", "QuotedParameter", "(", "name", ",", "v...
Creates a Parameter @param name the name @param value the value, or <code>null</code> @return a name-value pair representing the arguments
[ "Creates", "a", "Parameter" ]
9c07ebd63cd104a99eb9e771f760f14efa4fe0f6
https://github.com/httpcache4j/httpcache4j/blob/9c07ebd63cd104a99eb9e771f760f14efa4fe0f6/httpcache4j-api/src/main/java/org/codehaus/httpcache4j/util/DirectivesParser.java#L256-L261
train
Canadensys/canadensys-core
src/main/java/net/canadensys/utils/LangUtils.java
LangUtils.getClassAnnotationValue
public static <T, A extends Annotation> String getClassAnnotationValue(Class<T> classType, Class<A> annotationType, String attributeName) { String value = null; Annotation annotation = classType.getAnnotation(annotationType); if (annotation != null) { try { value = (String) annotation.annotationType().getM...
java
public static <T, A extends Annotation> String getClassAnnotationValue(Class<T> classType, Class<A> annotationType, String attributeName) { String value = null; Annotation annotation = classType.getAnnotation(annotationType); if (annotation != null) { try { value = (String) annotation.annotationType().getM...
[ "public", "static", "<", "T", ",", "A", "extends", "Annotation", ">", "String", "getClassAnnotationValue", "(", "Class", "<", "T", ">", "classType", ",", "Class", "<", "A", ">", "annotationType", ",", "String", "attributeName", ")", "{", "String", "value", ...
Get the value of a Annotation in a class declaration. @param classType @param annotationType @param attributeName @return the value of the annotation as String or null if something goes wrong
[ "Get", "the", "value", "of", "a", "Annotation", "in", "a", "class", "declaration", "." ]
5e13569f7c0f4cdc7080da72643ff61123ad76fd
https://github.com/Canadensys/canadensys-core/blob/5e13569f7c0f4cdc7080da72643ff61123ad76fd/src/main/java/net/canadensys/utils/LangUtils.java#L19-L28
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/impl/UTCDateBoxImplHtml5.java
UTCDateBoxImplHtml5.string2long
private Long string2long(String text, DateTimeFormat fmt) { // null or "" returns null if (text == null) return null; text = text.trim(); if (text.length() == 0) return null; Date date = fmt.parse(text); return date != null ? UTCDateBox.date2utc(date) : ...
java
private Long string2long(String text, DateTimeFormat fmt) { // null or "" returns null if (text == null) return null; text = text.trim(); if (text.length() == 0) return null; Date date = fmt.parse(text); return date != null ? UTCDateBox.date2utc(date) : ...
[ "private", "Long", "string2long", "(", "String", "text", ",", "DateTimeFormat", "fmt", ")", "{", "// null or \"\" returns null", "if", "(", "text", "==", "null", ")", "return", "null", ";", "text", "=", "text", ".", "trim", "(", ")", ";", "if", "(", "tex...
Parses the supplied text and converts it to a Long corresponding to that midnight in UTC on the specified date. @return null if it fails to parsing using the specified DateTimeFormat
[ "Parses", "the", "supplied", "text", "and", "converts", "it", "to", "a", "Long", "corresponding", "to", "that", "midnight", "in", "UTC", "on", "the", "specified", "date", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/impl/UTCDateBoxImplHtml5.java#L136-L145
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/impl/UTCDateBoxImplHtml5.java
UTCDateBoxImplHtml5.long2string
private String long2string(Long value, DateTimeFormat fmt) { // for html5 inputs, use "" for no value if (value == null) return ""; Date date = UTCDateBox.utc2date(value); return date != null ? fmt.format(date) : null; }
java
private String long2string(Long value, DateTimeFormat fmt) { // for html5 inputs, use "" for no value if (value == null) return ""; Date date = UTCDateBox.utc2date(value); return date != null ? fmt.format(date) : null; }
[ "private", "String", "long2string", "(", "Long", "value", ",", "DateTimeFormat", "fmt", ")", "{", "// for html5 inputs, use \"\" for no value", "if", "(", "value", "==", "null", ")", "return", "\"\"", ";", "Date", "date", "=", "UTCDateBox", ".", "utc2date", "(",...
Formats the supplied value using the specified DateTimeFormat. @return "" if the value is null
[ "Formats", "the", "supplied", "value", "using", "the", "specified", "DateTimeFormat", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/impl/UTCDateBoxImplHtml5.java#L152-L157
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.from
public static RgbaColor from(String color) { if (color.startsWith("#")) { return fromHex(color); } else if (color.startsWith("rgba")) { return fromRgba(color); } else if (color.startsWith("rgb")) { return fromRgb(color); } else ...
java
public static RgbaColor from(String color) { if (color.startsWith("#")) { return fromHex(color); } else if (color.startsWith("rgba")) { return fromRgba(color); } else if (color.startsWith("rgb")) { return fromRgb(color); } else ...
[ "public", "static", "RgbaColor", "from", "(", "String", "color", ")", "{", "if", "(", "color", ".", "startsWith", "(", "\"#\"", ")", ")", "{", "return", "fromHex", "(", "color", ")", ";", "}", "else", "if", "(", "color", ".", "startsWith", "(", "\"rg...
Parses an RgbaColor from a hexadecimal, rgb, rgba, hsl, or hsla value. @return returns the parsed color
[ "Parses", "an", "RgbaColor", "from", "a", "hexadecimal", "rgb", "rgba", "hsl", "or", "hsla", "value", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L81-L100
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.fromHex
public static RgbaColor fromHex(String hex) { if (hex.length() == 0 || hex.charAt(0) != '#') return getDefaultColor(); // #rgb if (hex.length() == 4) { return new RgbaColor(parseHex(hex, 1, 2), parseHex(hex, 2, 3), p...
java
public static RgbaColor fromHex(String hex) { if (hex.length() == 0 || hex.charAt(0) != '#') return getDefaultColor(); // #rgb if (hex.length() == 4) { return new RgbaColor(parseHex(hex, 1, 2), parseHex(hex, 2, 3), p...
[ "public", "static", "RgbaColor", "fromHex", "(", "String", "hex", ")", "{", "if", "(", "hex", ".", "length", "(", ")", "==", "0", "||", "hex", ".", "charAt", "(", "0", ")", "!=", "'", "'", ")", "return", "getDefaultColor", "(", ")", ";", "// #rgb",...
Parses an RgbaColor from a hexadecimal value. @return returns the parsed color
[ "Parses", "an", "RgbaColor", "from", "a", "hexadecimal", "value", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L107-L129
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.fromRgb
public static RgbaColor fromRgb(String rgb) { if (rgb.length() == 0) return getDefaultColor(); String[] parts = getRgbParts(rgb).split(","); if (parts.length == 3) { return new RgbaColor(parseInt(parts[0]), parseInt(parts[1]), ...
java
public static RgbaColor fromRgb(String rgb) { if (rgb.length() == 0) return getDefaultColor(); String[] parts = getRgbParts(rgb).split(","); if (parts.length == 3) { return new RgbaColor(parseInt(parts[0]), parseInt(parts[1]), ...
[ "public", "static", "RgbaColor", "fromRgb", "(", "String", "rgb", ")", "{", "if", "(", "rgb", ".", "length", "(", ")", "==", "0", ")", "return", "getDefaultColor", "(", ")", ";", "String", "[", "]", "parts", "=", "getRgbParts", "(", "rgb", ")", ".", ...
Parses an RgbaColor from an rgb value. @return the parsed color
[ "Parses", "an", "RgbaColor", "from", "an", "rgb", "value", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L136-L148
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.fromRgba
public static RgbaColor fromRgba(String rgba) { if (rgba.length() == 0) return getDefaultColor(); String[] parts = getRgbaParts(rgba).split(","); if (parts.length == 4) { return new RgbaColor(parseInt(parts[0]), parseInt(parts[1]), ...
java
public static RgbaColor fromRgba(String rgba) { if (rgba.length() == 0) return getDefaultColor(); String[] parts = getRgbaParts(rgba).split(","); if (parts.length == 4) { return new RgbaColor(parseInt(parts[0]), parseInt(parts[1]), ...
[ "public", "static", "RgbaColor", "fromRgba", "(", "String", "rgba", ")", "{", "if", "(", "rgba", ".", "length", "(", ")", "==", "0", ")", "return", "getDefaultColor", "(", ")", ";", "String", "[", "]", "parts", "=", "getRgbaParts", "(", "rgba", ")", ...
Parses an RgbaColor from an rgba value. @return the parsed color
[ "Parses", "an", "RgbaColor", "from", "an", "rgba", "value", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L155-L168
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.withHsl
private RgbaColor withHsl(int index, float value) { float[] HSL = convertToHsl(); HSL[index] = value; return RgbaColor.fromHsl(HSL); }
java
private RgbaColor withHsl(int index, float value) { float[] HSL = convertToHsl(); HSL[index] = value; return RgbaColor.fromHsl(HSL); }
[ "private", "RgbaColor", "withHsl", "(", "int", "index", ",", "float", "value", ")", "{", "float", "[", "]", "HSL", "=", "convertToHsl", "(", ")", ";", "HSL", "[", "index", "]", "=", "value", ";", "return", "RgbaColor", ".", "fromHsl", "(", "HSL", ")"...
Returns a new color with a new value of the specified HSL component.
[ "Returns", "a", "new", "color", "with", "a", "new", "value", "of", "the", "specified", "HSL", "component", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L389-L393
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.adjustHue
public RgbaColor adjustHue(float degrees) { float[] HSL = convertToHsl(); HSL[0] = hueCheck(HSL[0] + degrees); // ensure [0-360) return RgbaColor.fromHsl(HSL); }
java
public RgbaColor adjustHue(float degrees) { float[] HSL = convertToHsl(); HSL[0] = hueCheck(HSL[0] + degrees); // ensure [0-360) return RgbaColor.fromHsl(HSL); }
[ "public", "RgbaColor", "adjustHue", "(", "float", "degrees", ")", "{", "float", "[", "]", "HSL", "=", "convertToHsl", "(", ")", ";", "HSL", "[", "0", "]", "=", "hueCheck", "(", "HSL", "[", "0", "]", "+", "degrees", ")", ";", "// ensure [0-360)", "ret...
Returns a new color that has the hue adjusted by the specified amount.
[ "Returns", "a", "new", "color", "that", "has", "the", "hue", "adjusted", "by", "the", "specified", "amount", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L429-L433
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.opacify
public RgbaColor opacify(float amount) { return new RgbaColor(r, g, b, alphaCheck(a + amount)); }
java
public RgbaColor opacify(float amount) { return new RgbaColor(r, g, b, alphaCheck(a + amount)); }
[ "public", "RgbaColor", "opacify", "(", "float", "amount", ")", "{", "return", "new", "RgbaColor", "(", "r", ",", "g", ",", "b", ",", "alphaCheck", "(", "a", "+", "amount", ")", ")", ";", "}" ]
Returns a new color that has the alpha adjusted by the specified amount.
[ "Returns", "a", "new", "color", "that", "has", "the", "alpha", "adjusted", "by", "the", "specified", "amount", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L439-L441
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.getSpreadInRange
protected static final float[] getSpreadInRange(float member, int count, int max, int offset) { // to find the spread, we first find the min that is a // multiple of max/count away from the member int interval = max / count; float min = (member + offset) % interval; if (min == ...
java
protected static final float[] getSpreadInRange(float member, int count, int max, int offset) { // to find the spread, we first find the min that is a // multiple of max/count away from the member int interval = max / count; float min = (member + offset) % interval; if (min == ...
[ "protected", "static", "final", "float", "[", "]", "getSpreadInRange", "(", "float", "member", ",", "int", "count", ",", "int", "max", ",", "int", "offset", ")", "{", "// to find the spread, we first find the min that is a", "// multiple of max/count away from the member"...
Returns a spread of integers in a range [0,max) that includes count. The spread is sorted from largest to smallest.
[ "Returns", "a", "spread", "of", "integers", "in", "a", "range", "[", "0", "max", ")", "that", "includes", "count", ".", "The", "spread", "is", "sorted", "from", "largest", "to", "smallest", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L509-L526
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.fromHsl
public static RgbaColor fromHsl(float H, float S, float L) { // convert to [0-1] H /= 360f; S /= 100f; L /= 100f; float R, G, B; if (S == 0) { // grey R = G = B = L; } else { float m2 = L <= 0.5 ? L * (S + 1f) : L + S...
java
public static RgbaColor fromHsl(float H, float S, float L) { // convert to [0-1] H /= 360f; S /= 100f; L /= 100f; float R, G, B; if (S == 0) { // grey R = G = B = L; } else { float m2 = L <= 0.5 ? L * (S + 1f) : L + S...
[ "public", "static", "RgbaColor", "fromHsl", "(", "float", "H", ",", "float", "S", ",", "float", "L", ")", "{", "// convert to [0-1]", "H", "/=", "360f", ";", "S", "/=", "100f", ";", "L", "/=", "100f", ";", "float", "R", ",", "G", ",", "B", ";", "...
Creates a new RgbaColor from the specified HSL components. <p> <i>Implementation based on <a href="http://en.wikipedia.org/wiki/HSL_and_HSV">wikipedia</a> and <a href="http://www.w3.org/TR/css3-color/#hsl-color">w3c</a></i> @param H Hue [0,360) @param S Saturation [0,100] @param L Lightness [0,100]
[ "Creates", "a", "new", "RgbaColor", "from", "the", "specified", "HSL", "components", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L673-L700
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java
RgbaColor.max
private float max(float x, float y, float z) { if (x > y) { // not y if (x > z) { return x; } else { return z; } } else { // not x if (y > z) { return y; ...
java
private float max(float x, float y, float z) { if (x > y) { // not y if (x > z) { return x; } else { return z; } } else { // not x if (y > z) { return y; ...
[ "private", "float", "max", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "if", "(", "x", ">", "y", ")", "{", "// not y", "if", "(", "x", ">", "z", ")", "{", "return", "x", ";", "}", "else", "{", "return", "z", ";", "}",...
misc utility methods
[ "misc", "utility", "methods" ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L826-L845
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/converters/ObjectToObjectUsingConstructor.java
ObjectToObjectUsingConstructor.getCompatibleConstructor
public Constructor<?> getCompatibleConstructor(Class<?> type, Class<?> argumentType) { try { return type.getConstructor(new Class[] { argumentType }); } catch (Exception e) { // get public classes and interfaces Class<?>[] types = type.getClasses(); for (int i = 0; i < types.length; i++) { ...
java
public Constructor<?> getCompatibleConstructor(Class<?> type, Class<?> argumentType) { try { return type.getConstructor(new Class[] { argumentType }); } catch (Exception e) { // get public classes and interfaces Class<?>[] types = type.getClasses(); for (int i = 0; i < types.length; i++) { ...
[ "public", "Constructor", "<", "?", ">", "getCompatibleConstructor", "(", "Class", "<", "?", ">", "type", ",", "Class", "<", "?", ">", "argumentType", ")", "{", "try", "{", "return", "type", ".", "getConstructor", "(", "new", "Class", "[", "]", "{", "ar...
Get a compatible constructor @param type Class to look for constructor in @param argumentType Argument type for constructor @return the compatible constructor or null if none found
[ "Get", "a", "compatible", "constructor" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/converters/ObjectToObjectUsingConstructor.java#L94-L110
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/Transmorph.java
Transmorph.convert
public <T> T convert(Object source, TypeReference<T> typeReference) throws ConverterException { return (T) convert(new ConversionContext(), source, typeReference); }
java
public <T> T convert(Object source, TypeReference<T> typeReference) throws ConverterException { return (T) convert(new ConversionContext(), source, typeReference); }
[ "public", "<", "T", ">", "T", "convert", "(", "Object", "source", ",", "TypeReference", "<", "T", ">", "typeReference", ")", "throws", "ConverterException", "{", "return", "(", "T", ")", "convert", "(", "new", "ConversionContext", "(", ")", ",", "source", ...
Convert an object to another object with given type @param <T> @param source object to convert @param typeReference reference to {@link java.lang.reflect.Type} @return the converted object if conversion failed @throws ConverterException
[ "Convert", "an", "object", "to", "another", "object", "with", "given", "type" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/Transmorph.java#L77-L80
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/Transmorph.java
Transmorph.convert
public <T> T convert(ConversionContext context, Object source, TypeReference<T> destinationType) throws ConverterException { try { return (T) multiConverter.convert(context, source, destinationType); } catch (ConverterException e) { throw e; } catch (Exception e) { // There is a problem with on...
java
public <T> T convert(ConversionContext context, Object source, TypeReference<T> destinationType) throws ConverterException { try { return (T) multiConverter.convert(context, source, destinationType); } catch (ConverterException e) { throw e; } catch (Exception e) { // There is a problem with on...
[ "public", "<", "T", ">", "T", "convert", "(", "ConversionContext", "context", ",", "Object", "source", ",", "TypeReference", "<", "T", ">", "destinationType", ")", "throws", "ConverterException", "{", "try", "{", "return", "(", "T", ")", "multiConverter", "....
Convert an object to another object given a parameterized type signature @param context @param destinationType the destination type @param source the source object @return the converted object @throws ConverterException if conversion failed
[ "Convert", "an", "object", "to", "another", "object", "given", "a", "parameterized", "type", "signature" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/Transmorph.java#L145-L162
train
mgormley/optimize
src/main/java/edu/jhu/hlt/util/Utilities.java
Utilities.compare
public static int compare(double a, double b, double delta) { if (equals(a, b, delta)) { return 0; } return Double.compare(a, b); }
java
public static int compare(double a, double b, double delta) { if (equals(a, b, delta)) { return 0; } return Double.compare(a, b); }
[ "public", "static", "int", "compare", "(", "double", "a", ",", "double", "b", ",", "double", "delta", ")", "{", "if", "(", "equals", "(", "a", ",", "b", ",", "delta", ")", ")", "{", "return", "0", ";", "}", "return", "Double", ".", "compare", "("...
Compares two double values up to some delta. @param a @param b @param delta @return The value 0 if a equals b, a value greater than 0 if if a > b, and a value less than 0 if a < b.
[ "Compares", "two", "double", "values", "up", "to", "some", "delta", "." ]
3d1b93260b99febb8a5ecd9e8543c223e151a8d3
https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/util/Utilities.java#L483-L488
train
mgormley/optimize
src/main/java/edu/jhu/hlt/optimize/function/AbstractSumBatchFunction.java
AbstractSumBatchFunction.getValue
public double getValue(int[] batch) { double value = 0.0; for (int i=0; i<batch.length; i++) { value += getValue(i); } return value; }
java
public double getValue(int[] batch) { double value = 0.0; for (int i=0; i<batch.length; i++) { value += getValue(i); } return value; }
[ "public", "double", "getValue", "(", "int", "[", "]", "batch", ")", "{", "double", "value", "=", "0.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "batch", ".", "length", ";", "i", "++", ")", "{", "value", "+=", "getValue", "(", "i",...
Gets value of this function at the current point, computed on the given batch of examples. @param batch A set of indices indicating the examples over which the gradient should be computed. @return The value of the function at the point.
[ "Gets", "value", "of", "this", "function", "at", "the", "current", "point", "computed", "on", "the", "given", "batch", "of", "examples", "." ]
3d1b93260b99febb8a5ecd9e8543c223e151a8d3
https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/function/AbstractSumBatchFunction.java#L20-L26
train
mgormley/optimize
src/main/java/edu/jhu/hlt/optimize/function/AbstractSumBatchFunction.java
AbstractSumBatchFunction.getGradient
public void getGradient(int[] batch, double[] gradient) { for (int i=0; i<batch.length; i++) { addGradient(i, gradient); } }
java
public void getGradient(int[] batch, double[] gradient) { for (int i=0; i<batch.length; i++) { addGradient(i, gradient); } }
[ "public", "void", "getGradient", "(", "int", "[", "]", "batch", ",", "double", "[", "]", "gradient", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "batch", ".", "length", ";", "i", "++", ")", "{", "addGradient", "(", "i", ",", "gra...
Gets the gradient at the current point, computed on the given batch of examples. @param batch A set of indices indicating the examples over which the gradient should be computed. @param gradient The output gradient, a vector of partial derivatives.
[ "Gets", "the", "gradient", "at", "the", "current", "point", "computed", "on", "the", "given", "batch", "of", "examples", "." ]
3d1b93260b99febb8a5ecd9e8543c223e151a8d3
https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/function/AbstractSumBatchFunction.java#L33-L37
train
erickok/RxCupboard
sample/src/main/java/nl/nl2312/rxcupboard2/sample/CupboardDbHelper.java
CupboardDbHelper.getConnection
public synchronized static SQLiteDatabase getConnection(Context context) { if (database == null) { // Construct the single helper and open the unique(!) db connection for the app database = new CupboardDbHelper(context.getApplicationContext()).getWritableDatabase(); } return database; }
java
public synchronized static SQLiteDatabase getConnection(Context context) { if (database == null) { // Construct the single helper and open the unique(!) db connection for the app database = new CupboardDbHelper(context.getApplicationContext()).getWritableDatabase(); } return database; }
[ "public", "synchronized", "static", "SQLiteDatabase", "getConnection", "(", "Context", "context", ")", "{", "if", "(", "database", "==", "null", ")", "{", "// Construct the single helper and open the unique(!) db connection for the app", "database", "=", "new", "CupboardDbH...
Returns a raw handle to the SQLite database connection. Do not close! @param context A context, which is used to (when needed) set up a connection to the database @return The single, unique connection to the database, as is (also) used by our Cupboard instance
[ "Returns", "a", "raw", "handle", "to", "the", "SQLite", "database", "connection", ".", "Do", "not", "close!" ]
2c75d880d7aae6d7b86538345b9daa3e438697e8
https://github.com/erickok/RxCupboard/blob/2c75d880d7aae6d7b86538345b9daa3e438697e8/sample/src/main/java/nl/nl2312/rxcupboard2/sample/CupboardDbHelper.java#L28-L34
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/type/TypeReference.java
TypeReference.getSuperclassTypeParameter
@SuppressWarnings("unchecked") public static Type getSuperclassTypeParameter(Class<?> subclass) { Type superclass = subclass.getGenericSuperclass(); if (superclass instanceof Class) { throw new RuntimeException("Missing type parameter."); } return ((ParameterizedType) superclass).getActualTypeArguments()[0]...
java
@SuppressWarnings("unchecked") public static Type getSuperclassTypeParameter(Class<?> subclass) { Type superclass = subclass.getGenericSuperclass(); if (superclass instanceof Class) { throw new RuntimeException("Missing type parameter."); } return ((ParameterizedType) superclass).getActualTypeArguments()[0]...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Type", "getSuperclassTypeParameter", "(", "Class", "<", "?", ">", "subclass", ")", "{", "Type", "superclass", "=", "subclass", ".", "getGenericSuperclass", "(", ")", ";", "if", "(", "supe...
Gets type from super class's type parameter.
[ "Gets", "type", "from", "super", "class", "s", "type", "parameter", "." ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/type/TypeReference.java#L263-L270
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/AutoSizingBase.java
AutoSizingBase.onLoad
@Override protected void onLoad() { super.onLoad(); // these styles need to be the same for the box and shadow so // that we can measure properly matchStyles("display"); matchStyles("fontSize"); matchStyles("fontFamily"); matchStyles("fontWeight"); matchStyles("lineHeight"); matchStyles("paddingTop"); ma...
java
@Override protected void onLoad() { super.onLoad(); // these styles need to be the same for the box and shadow so // that we can measure properly matchStyles("display"); matchStyles("fontSize"); matchStyles("fontFamily"); matchStyles("fontWeight"); matchStyles("lineHeight"); matchStyles("paddingTop"); ma...
[ "@", "Override", "protected", "void", "onLoad", "(", ")", "{", "super", ".", "onLoad", "(", ")", ";", "// these styles need to be the same for the box and shadow so", "// that we can measure properly", "matchStyles", "(", "\"display\"", ")", ";", "matchStyles", "(", "\"...
Matches the styles and adjusts the size. This needs to be called after the input is added to the DOM, so we do it in onLoad.
[ "Matches", "the", "styles", "and", "adjusts", "the", "size", ".", "This", "needs", "to", "be", "called", "after", "the", "input", "is", "added", "to", "the", "DOM", "so", "we", "do", "it", "in", "onLoad", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/AutoSizingBase.java#L180-L197
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/AutoSizingBase.java
AutoSizingBase.onKeyDown
@Override public void onKeyDown(KeyDownEvent event) { char c = MiscUtils.getCharCode(event.getNativeEvent()); onKeyCodeEvent(event, box.getValue()+c); }
java
@Override public void onKeyDown(KeyDownEvent event) { char c = MiscUtils.getCharCode(event.getNativeEvent()); onKeyCodeEvent(event, box.getValue()+c); }
[ "@", "Override", "public", "void", "onKeyDown", "(", "KeyDownEvent", "event", ")", "{", "char", "c", "=", "MiscUtils", ".", "getCharCode", "(", "event", ".", "getNativeEvent", "(", ")", ")", ";", "onKeyCodeEvent", "(", "event", ",", "box", ".", "getValue",...
On key down we assume the key will go at the end. It's the most common case and not that distracting if that's not true.
[ "On", "key", "down", "we", "assume", "the", "key", "will", "go", "at", "the", "end", ".", "It", "s", "the", "most", "common", "case", "and", "not", "that", "distracting", "if", "that", "s", "not", "true", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/AutoSizingBase.java#L233-L237
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/util/DomUtils.java
DomUtils.setEnabled
public static void setEnabled(Element element, boolean enabled) { element.setPropertyBoolean("disabled", !enabled); setStyleName(element, "disabled", !enabled); }
java
public static void setEnabled(Element element, boolean enabled) { element.setPropertyBoolean("disabled", !enabled); setStyleName(element, "disabled", !enabled); }
[ "public", "static", "void", "setEnabled", "(", "Element", "element", ",", "boolean", "enabled", ")", "{", "element", ".", "setPropertyBoolean", "(", "\"disabled\"", ",", "!", "enabled", ")", ";", "setStyleName", "(", "element", ",", "\"disabled\"", ",", "!", ...
It's enough to just set the disabled attribute on the element, but we want to also add a "disabled" class so that we can style it. At some point we'll just be able to use .button:disabled, but that doesn't work in IE8-
[ "It", "s", "enough", "to", "just", "set", "the", "disabled", "attribute", "on", "the", "element", "but", "we", "want", "to", "also", "add", "a", "disabled", "class", "so", "that", "we", "can", "style", "it", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/DomUtils.java#L45-L48
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/converters/beans/BeanToBean.java
BeanToBean.getPropertySourceMethod
private Method getPropertySourceMethod(Object sourceObject, Object destinationObject, String destinationProperty) { BeanToBeanMapping beanToBeanMapping = beanToBeanMappings.get(ClassPair .get(sourceObject.getClass(), destinationObject .getClass())); String sourceProperty = null; if (beanToBeanM...
java
private Method getPropertySourceMethod(Object sourceObject, Object destinationObject, String destinationProperty) { BeanToBeanMapping beanToBeanMapping = beanToBeanMappings.get(ClassPair .get(sourceObject.getClass(), destinationObject .getClass())); String sourceProperty = null; if (beanToBeanM...
[ "private", "Method", "getPropertySourceMethod", "(", "Object", "sourceObject", ",", "Object", "destinationObject", ",", "String", "destinationProperty", ")", "{", "BeanToBeanMapping", "beanToBeanMapping", "=", "beanToBeanMappings", ".", "get", "(", "ClassPair", ".", "ge...
get the property source method corresponding to given destination property @param sourceObject @param destinationObject @param destinationProperty @return
[ "get", "the", "property", "source", "method", "corresponding", "to", "given", "destination", "property" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/converters/beans/BeanToBean.java#L161-L177
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/converters/beans/BeanToBean.java
BeanToBean.getBeanPropertyType
protected TypeReference<?> getBeanPropertyType(Class<?> clazz, String propertyName, TypeReference<?> originalType) { TypeReference<?> propertyDestinationType = null; if (beanDestinationPropertyTypeProvider != null) { propertyDestinationType = beanDestinationPropertyTypeProvider .getPropertyType(claz...
java
protected TypeReference<?> getBeanPropertyType(Class<?> clazz, String propertyName, TypeReference<?> originalType) { TypeReference<?> propertyDestinationType = null; if (beanDestinationPropertyTypeProvider != null) { propertyDestinationType = beanDestinationPropertyTypeProvider .getPropertyType(claz...
[ "protected", "TypeReference", "<", "?", ">", "getBeanPropertyType", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ",", "TypeReference", "<", "?", ">", "originalType", ")", "{", "TypeReference", "<", "?", ">", "propertyDestinationType", "...
get the bean property type @param clazz @param propertyName @param originalType @return
[ "get", "the", "bean", "property", "type" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/converters/beans/BeanToBean.java#L187-L198
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/converters/beans/BeanToBean.java
BeanToBean.addBeanToBeanMapping
public void addBeanToBeanMapping(BeanToBeanMapping beanToBeanMapping) { beanToBeanMappings.put(ClassPair.get(beanToBeanMapping .getSourceClass(), beanToBeanMapping.getDestinationClass()), beanToBeanMapping); }
java
public void addBeanToBeanMapping(BeanToBeanMapping beanToBeanMapping) { beanToBeanMappings.put(ClassPair.get(beanToBeanMapping .getSourceClass(), beanToBeanMapping.getDestinationClass()), beanToBeanMapping); }
[ "public", "void", "addBeanToBeanMapping", "(", "BeanToBeanMapping", "beanToBeanMapping", ")", "{", "beanToBeanMappings", ".", "put", "(", "ClassPair", ".", "get", "(", "beanToBeanMapping", ".", "getSourceClass", "(", ")", ",", "beanToBeanMapping", ".", "getDestination...
Add a mapping of properties between two beans @param beanToBeanMapping
[ "Add", "a", "mapping", "of", "properties", "between", "two", "beans" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/converters/beans/BeanToBean.java#L205-L209
train
jbossws/jbossws-spi
src/main/java/org/jboss/wsf/spi/SPIProvider.java
SPIProvider.getInstance
public static SPIProvider getInstance() { if (me == null) { final ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader(); me = SPIProviderResolver.getInstance(cl).getProvider(); } return me; }
java
public static SPIProvider getInstance() { if (me == null) { final ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader(); me = SPIProviderResolver.getInstance(cl).getProvider(); } return me; }
[ "public", "static", "SPIProvider", "getInstance", "(", ")", "{", "if", "(", "me", "==", "null", ")", "{", "final", "ClassLoader", "cl", "=", "ClassLoaderProvider", ".", "getDefaultProvider", "(", ")", ".", "getServerIntegrationClassLoader", "(", ")", ";", "me"...
Gets the a singleton reference to the SPIProvider returned by the SPIProviderResolver retrieved using the default server integration classloader. @return this class instance
[ "Gets", "the", "a", "singleton", "reference", "to", "the", "SPIProvider", "returned", "by", "the", "SPIProviderResolver", "retrieved", "using", "the", "default", "server", "integration", "classloader", "." ]
845e66c18679ce3aaf76f849822110b4650a9d78
https://github.com/jbossws/jbossws-spi/blob/845e66c18679ce3aaf76f849822110b4650a9d78/src/main/java/org/jboss/wsf/spi/SPIProvider.java#L42-L50
train
jbossws/jbossws-spi
src/main/java/org/jboss/wsf/spi/SPIProvider.java
SPIProvider.getSPI
public <T> T getSPI(Class<T> spiType) { return getSPI(spiType, SecurityActions.getContextClassLoader()); }
java
public <T> T getSPI(Class<T> spiType) { return getSPI(spiType, SecurityActions.getContextClassLoader()); }
[ "public", "<", "T", ">", "T", "getSPI", "(", "Class", "<", "T", ">", "spiType", ")", "{", "return", "getSPI", "(", "spiType", ",", "SecurityActions", ".", "getContextClassLoader", "(", ")", ")", ";", "}" ]
Gets the specified SPI, using the current thread context classloader @param <T> type of spi class @param spiType spi class to retrieve @return object
[ "Gets", "the", "specified", "SPI", "using", "the", "current", "thread", "context", "classloader" ]
845e66c18679ce3aaf76f849822110b4650a9d78
https://github.com/jbossws/jbossws-spi/blob/845e66c18679ce3aaf76f849822110b4650a9d78/src/main/java/org/jboss/wsf/spi/SPIProvider.java#L59-L62
train
matiwinnetou/spring-soy-view
spring-soy-view/src/main/java/pl/matisoft/soy/bundle/DefaultSoyMsgBundleResolver.java
DefaultSoyMsgBundleResolver.resolve
public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBu...
java
public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBu...
[ "public", "Optional", "<", "SoyMsgBundle", ">", "resolve", "(", "final", "Optional", "<", "Locale", ">", "locale", ")", "throws", "IOException", "{", "if", "(", "!", "locale", ".", "isPresent", "(", ")", ")", "{", "return", "Optional", ".", "absent", "("...
Based on a provided locale return a SoyMsgBundle file. If a passed in locale object is "Optional.absent()", the implementation will return Optional.absent() as well @param locale - maybe locale @return maybe soy msg bundle
[ "Based", "on", "a", "provided", "locale", "return", "a", "SoyMsgBundle", "file", "." ]
a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1
https://github.com/matiwinnetou/spring-soy-view/blob/a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1/spring-soy-view/src/main/java/pl/matisoft/soy/bundle/DefaultSoyMsgBundleResolver.java#L62-L93
train
matiwinnetou/spring-soy-view
spring-soy-view/src/main/java/pl/matisoft/soy/bundle/DefaultSoyMsgBundleResolver.java
DefaultSoyMsgBundleResolver.mergeMsgBundles
private Optional<? extends SoyMsgBundle> mergeMsgBundles(final Locale locale, final List<SoyMsgBundle> soyMsgBundles) { if (soyMsgBundles.isEmpty()) { return Optional.absent(); } final List<SoyMsg> msgs = Lists.newArrayList(); for (final SoyMsgBundle smb : soyMsgBundles) { ...
java
private Optional<? extends SoyMsgBundle> mergeMsgBundles(final Locale locale, final List<SoyMsgBundle> soyMsgBundles) { if (soyMsgBundles.isEmpty()) { return Optional.absent(); } final List<SoyMsg> msgs = Lists.newArrayList(); for (final SoyMsgBundle smb : soyMsgBundles) { ...
[ "private", "Optional", "<", "?", "extends", "SoyMsgBundle", ">", "mergeMsgBundles", "(", "final", "Locale", "locale", ",", "final", "List", "<", "SoyMsgBundle", ">", "soyMsgBundles", ")", "{", "if", "(", "soyMsgBundles", ".", "isEmpty", "(", ")", ")", "{", ...
Merge msg bundles together, creating new MsgBundle with merges msg bundles passed in as a method argument
[ "Merge", "msg", "bundles", "together", "creating", "new", "MsgBundle", "with", "merges", "msg", "bundles", "passed", "in", "as", "a", "method", "argument" ]
a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1
https://github.com/matiwinnetou/spring-soy-view/blob/a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1/spring-soy-view/src/main/java/pl/matisoft/soy/bundle/DefaultSoyMsgBundleResolver.java#L126-L139
train
matiwinnetou/spring-soy-view
spring-soy-view-ajax-compiler/src/main/java/pl/matisoft/soy/ajax/hash/MD5HashFileGenerator.java
MD5HashFileGenerator.hash
@Override public Optional<String> hash(final Optional<URL> url) throws IOException { if (!url.isPresent()) { return Optional.absent(); } logger.debug("Calculating md5 hash, url:{}", url); if (isHotReloadModeOff()) { final String md5 = cache.getIfPresent(url.ge...
java
@Override public Optional<String> hash(final Optional<URL> url) throws IOException { if (!url.isPresent()) { return Optional.absent(); } logger.debug("Calculating md5 hash, url:{}", url); if (isHotReloadModeOff()) { final String md5 = cache.getIfPresent(url.ge...
[ "@", "Override", "public", "Optional", "<", "String", ">", "hash", "(", "final", "Optional", "<", "URL", ">", "url", ")", "throws", "IOException", "{", "if", "(", "!", "url", ".", "isPresent", "(", ")", ")", "{", "return", "Optional", ".", "absent", ...
Calculates a md5 hash for an url If a passed in url is absent then this method will return absent as well @param url - an url to a soy template file @return - md5 checksum of a template file @throws IOException - in a case there is an IO error calculating md5 checksum
[ "Calculates", "a", "md5", "hash", "for", "an", "url" ]
a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1
https://github.com/matiwinnetou/spring-soy-view/blob/a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1/spring-soy-view-ajax-compiler/src/main/java/pl/matisoft/soy/ajax/hash/MD5HashFileGenerator.java#L80-L106
train
Canadensys/canadensys-core
src/main/java/net/canadensys/utils/StringUtils.java
StringUtils.allUpperCase
public static String[] allUpperCase(String... strings){ String[] tmp = new String[strings.length]; for(int idx=0;idx<strings.length;idx++){ if(strings[idx] != null){ tmp[idx] = strings[idx].toUpperCase(); } } return tmp; }
java
public static String[] allUpperCase(String... strings){ String[] tmp = new String[strings.length]; for(int idx=0;idx<strings.length;idx++){ if(strings[idx] != null){ tmp[idx] = strings[idx].toUpperCase(); } } return tmp; }
[ "public", "static", "String", "[", "]", "allUpperCase", "(", "String", "...", "strings", ")", "{", "String", "[", "]", "tmp", "=", "new", "String", "[", "strings", ".", "length", "]", ";", "for", "(", "int", "idx", "=", "0", ";", "idx", "<", "strin...
Make all elements of a String array upper case. @param strings string array, may contain null item but can't be null @return array containing all provided elements upper case
[ "Make", "all", "elements", "of", "a", "String", "array", "upper", "case", "." ]
5e13569f7c0f4cdc7080da72643ff61123ad76fd
https://github.com/Canadensys/canadensys-core/blob/5e13569f7c0f4cdc7080da72643ff61123ad76fd/src/main/java/net/canadensys/utils/StringUtils.java#L20-L28
train
Canadensys/canadensys-core
src/main/java/net/canadensys/utils/StringUtils.java
StringUtils.allLowerCase
public static String[] allLowerCase(String... strings){ String[] tmp = new String[strings.length]; for(int idx=0;idx<strings.length;idx++){ if(strings[idx] != null){ tmp[idx] = strings[idx].toLowerCase(); } } return tmp; }
java
public static String[] allLowerCase(String... strings){ String[] tmp = new String[strings.length]; for(int idx=0;idx<strings.length;idx++){ if(strings[idx] != null){ tmp[idx] = strings[idx].toLowerCase(); } } return tmp; }
[ "public", "static", "String", "[", "]", "allLowerCase", "(", "String", "...", "strings", ")", "{", "String", "[", "]", "tmp", "=", "new", "String", "[", "strings", ".", "length", "]", ";", "for", "(", "int", "idx", "=", "0", ";", "idx", "<", "strin...
Make all elements of a String array lower case. @param strings string array, may contain null item but can't be null @return array containing all provided elements lower case
[ "Make", "all", "elements", "of", "a", "String", "array", "lower", "case", "." ]
5e13569f7c0f4cdc7080da72643ff61123ad76fd
https://github.com/Canadensys/canadensys-core/blob/5e13569f7c0f4cdc7080da72643ff61123ad76fd/src/main/java/net/canadensys/utils/StringUtils.java#L35-L43
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/signature/ClassTypeSignature.java
ClassTypeSignature.getTypeErasureSignature
public FullTypeSignature getTypeErasureSignature() { if (typeErasureSignature == null) { typeErasureSignature = new ClassTypeSignature(binaryName, new TypeArgSignature[0], ownerTypeSignature == null ? null : (ClassTypeSignature) ownerTypeSignature .getTypeErasureSignature()); } retu...
java
public FullTypeSignature getTypeErasureSignature() { if (typeErasureSignature == null) { typeErasureSignature = new ClassTypeSignature(binaryName, new TypeArgSignature[0], ownerTypeSignature == null ? null : (ClassTypeSignature) ownerTypeSignature .getTypeErasureSignature()); } retu...
[ "public", "FullTypeSignature", "getTypeErasureSignature", "(", ")", "{", "if", "(", "typeErasureSignature", "==", "null", ")", "{", "typeErasureSignature", "=", "new", "ClassTypeSignature", "(", "binaryName", ",", "new", "TypeArgSignature", "[", "0", "]", ",", "ow...
get the type erasure signature
[ "get", "the", "type", "erasure", "signature" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/signature/ClassTypeSignature.java#L118-L126
train
httpcache4j/httpcache4j
httpcache4j-api/src/main/java/org/codehaus/httpcache4j/MIMEType.java
MIMEType.addParameter
public MIMEType addParameter(String name, String value) { Map<String, String> copy = new LinkedHashMap<>(this.parameters); copy.put(name, value); return new MIMEType(type, subType, copy); }
java
public MIMEType addParameter(String name, String value) { Map<String, String> copy = new LinkedHashMap<>(this.parameters); copy.put(name, value); return new MIMEType(type, subType, copy); }
[ "public", "MIMEType", "addParameter", "(", "String", "name", ",", "String", "value", ")", "{", "Map", "<", "String", ",", "String", ">", "copy", "=", "new", "LinkedHashMap", "<>", "(", "this", ".", "parameters", ")", ";", "copy", ".", "put", "(", "name...
Adds a parameter to the MIMEType. @param name name of parameter @param value value of parameter @return returns a new instance with the parameter set
[ "Adds", "a", "parameter", "to", "the", "MIMEType", "." ]
9c07ebd63cd104a99eb9e771f760f14efa4fe0f6
https://github.com/httpcache4j/httpcache4j/blob/9c07ebd63cd104a99eb9e771f760f14efa4fe0f6/httpcache4j-api/src/main/java/org/codehaus/httpcache4j/MIMEType.java#L54-L58
train
matiwinnetou/spring-soy-view
spring-soy-view/src/main/java/pl/matisoft/soy/DefaultContentNegotiator.java
DefaultContentNegotiator.contentTypes
@Override public List<String> contentTypes() { List<String> contentTypes = null; final HttpServletRequest request = getHttpRequest(); if (favorParameterOverAcceptHeader) { contentTypes = getFavoredParameterValueAsList(request); } else { contentTypes = getAcceptHeaderValues(request); } if (isEmpty(c...
java
@Override public List<String> contentTypes() { List<String> contentTypes = null; final HttpServletRequest request = getHttpRequest(); if (favorParameterOverAcceptHeader) { contentTypes = getFavoredParameterValueAsList(request); } else { contentTypes = getAcceptHeaderValues(request); } if (isEmpty(c...
[ "@", "Override", "public", "List", "<", "String", ">", "contentTypes", "(", ")", "{", "List", "<", "String", ">", "contentTypes", "=", "null", ";", "final", "HttpServletRequest", "request", "=", "getHttpRequest", "(", ")", ";", "if", "(", "favorParameterOver...
Returns requested content types or default content type if none found. @return Requested content types or default content type if none found.
[ "Returns", "requested", "content", "types", "or", "default", "content", "type", "if", "none", "found", "." ]
a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1
https://github.com/matiwinnetou/spring-soy-view/blob/a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1/spring-soy-view/src/main/java/pl/matisoft/soy/DefaultContentNegotiator.java#L96-L114
train
httpcache4j/httpcache4j
httpcache4j-api/src/main/java/org/codehaus/httpcache4j/HTTPRequest.java
HTTPRequest.getAllHeaders
public Headers getAllHeaders() { Headers requestHeaders = getHeaders(); requestHeaders = hasPayload() ? requestHeaders.withContentType(getPayload().get().getMimeType()) : requestHeaders; //We don't want to add headers more than once. return requestHeaders; }
java
public Headers getAllHeaders() { Headers requestHeaders = getHeaders(); requestHeaders = hasPayload() ? requestHeaders.withContentType(getPayload().get().getMimeType()) : requestHeaders; //We don't want to add headers more than once. return requestHeaders; }
[ "public", "Headers", "getAllHeaders", "(", ")", "{", "Headers", "requestHeaders", "=", "getHeaders", "(", ")", ";", "requestHeaders", "=", "hasPayload", "(", ")", "?", "requestHeaders", ".", "withContentType", "(", "getPayload", "(", ")", ".", "get", "(", ")...
Returns all headers with the headers from the Payload @return All the headers
[ "Returns", "all", "headers", "with", "the", "headers", "from", "the", "Payload" ]
9c07ebd63cd104a99eb9e771f760f14efa4fe0f6
https://github.com/httpcache4j/httpcache4j/blob/9c07ebd63cd104a99eb9e771f760f14efa4fe0f6/httpcache4j-api/src/main/java/org/codehaus/httpcache4j/HTTPRequest.java#L102-L107
train
mgormley/optimize
src/main/java/edu/jhu/hlt/optimize/function/DifferentiableFunctionOpts.java
DifferentiableFunctionOpts.getRegularizedOptimizer
public static Optimizer<DifferentiableFunction> getRegularizedOptimizer(final Optimizer<DifferentiableFunction> opt, final double l1Lambda, final double l2Lambda) { if (l1Lambda == 0 && l2Lambda == 0) { return opt; } return new Optimizer<DifferentiableFunction>() { ...
java
public static Optimizer<DifferentiableFunction> getRegularizedOptimizer(final Optimizer<DifferentiableFunction> opt, final double l1Lambda, final double l2Lambda) { if (l1Lambda == 0 && l2Lambda == 0) { return opt; } return new Optimizer<DifferentiableFunction>() { ...
[ "public", "static", "Optimizer", "<", "DifferentiableFunction", ">", "getRegularizedOptimizer", "(", "final", "Optimizer", "<", "DifferentiableFunction", ">", "opt", ",", "final", "double", "l1Lambda", ",", "final", "double", "l2Lambda", ")", "{", "if", "(", "l1La...
Converts a standard optimizer to one which the given amount of l1 or l2 regularization.
[ "Converts", "a", "standard", "optimizer", "to", "one", "which", "the", "given", "amount", "of", "l1", "or", "l2", "regularization", "." ]
3d1b93260b99febb8a5ecd9e8543c223e151a8d3
https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/function/DifferentiableFunctionOpts.java#L165-L179
train
Canadensys/canadensys-core
src/main/java/net/canadensys/lang/RomanNumeral.java
RomanNumeral.toRomanNumeral
public String toRomanNumeral() { if (this.romanString == null) { this.romanString = ""; int remainder = this.value; for (int i = 0; i < BASIC_VALUES.length; i++) { while (remainder >= BASIC_VALUES[i]) { this.romanString += BASIC_ROMAN_NUMERALS[i]; remainder -= BASIC_VALUES[i]; } } } ...
java
public String toRomanNumeral() { if (this.romanString == null) { this.romanString = ""; int remainder = this.value; for (int i = 0; i < BASIC_VALUES.length; i++) { while (remainder >= BASIC_VALUES[i]) { this.romanString += BASIC_ROMAN_NUMERALS[i]; remainder -= BASIC_VALUES[i]; } } } ...
[ "public", "String", "toRomanNumeral", "(", ")", "{", "if", "(", "this", ".", "romanString", "==", "null", ")", "{", "this", ".", "romanString", "=", "\"\"", ";", "int", "remainder", "=", "this", ".", "value", ";", "for", "(", "int", "i", "=", "0", ...
Get the Roman Numeral of the current value @return
[ "Get", "the", "Roman", "Numeral", "of", "the", "current", "value" ]
5e13569f7c0f4cdc7080da72643ff61123ad76fd
https://github.com/Canadensys/canadensys-core/blob/5e13569f7c0f4cdc7080da72643ff61123ad76fd/src/main/java/net/canadensys/lang/RomanNumeral.java#L82-L94
train
mgormley/optimize
src/main/java/edu/jhu/hlt/optimize/AdaGradSchedule.java
AdaGradSchedule.takeNoteOfGradient
public void takeNoteOfGradient(IntDoubleVector gradient) { gradient.iterate(new FnIntDoubleToVoid() { @Override public void call(int index, double value) { gradSumSquares[index] += value * value; assert !Double.isNaN(gradSumSquares[index]); ...
java
public void takeNoteOfGradient(IntDoubleVector gradient) { gradient.iterate(new FnIntDoubleToVoid() { @Override public void call(int index, double value) { gradSumSquares[index] += value * value; assert !Double.isNaN(gradSumSquares[index]); ...
[ "public", "void", "takeNoteOfGradient", "(", "IntDoubleVector", "gradient", ")", "{", "gradient", ".", "iterate", "(", "new", "FnIntDoubleToVoid", "(", ")", "{", "@", "Override", "public", "void", "call", "(", "int", "index", ",", "double", "value", ")", "{"...
A tie-in for subclasses such as AdaGrad.
[ "A", "tie", "-", "in", "for", "subclasses", "such", "as", "AdaGrad", "." ]
3d1b93260b99febb8a5ecd9e8543c223e151a8d3
https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/AdaGradSchedule.java#L58-L66
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/signature/JavaTypeToTypeSignature.java
JavaTypeToTypeSignature.getArrayTypeSignature
private ArrayTypeSignature getArrayTypeSignature( GenericArrayType genericArrayType) { FullTypeSignature componentTypeSignature = getFullTypeSignature(genericArrayType .getGenericComponentType()); ArrayTypeSignature arrayTypeSignature = new ArrayTypeSignature( componentTypeSignature); return arra...
java
private ArrayTypeSignature getArrayTypeSignature( GenericArrayType genericArrayType) { FullTypeSignature componentTypeSignature = getFullTypeSignature(genericArrayType .getGenericComponentType()); ArrayTypeSignature arrayTypeSignature = new ArrayTypeSignature( componentTypeSignature); return arra...
[ "private", "ArrayTypeSignature", "getArrayTypeSignature", "(", "GenericArrayType", "genericArrayType", ")", "{", "FullTypeSignature", "componentTypeSignature", "=", "getFullTypeSignature", "(", "genericArrayType", ".", "getGenericComponentType", "(", ")", ")", ";", "ArrayType...
get the ArrayTypeSignature corresponding to given generic array type @param genericArrayType @return
[ "get", "the", "ArrayTypeSignature", "corresponding", "to", "given", "generic", "array", "type" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/signature/JavaTypeToTypeSignature.java#L45-L52
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/signature/JavaTypeToTypeSignature.java
JavaTypeToTypeSignature.getClassTypeSignature
private ClassTypeSignature getClassTypeSignature( ParameterizedType parameterizedType) { Class<?> rawType = (Class<?>) parameterizedType.getRawType(); Type[] typeArguments = parameterizedType.getActualTypeArguments(); TypeArgSignature[] typeArgSignatures = new TypeArgSignature[typeArguments.length]; for...
java
private ClassTypeSignature getClassTypeSignature( ParameterizedType parameterizedType) { Class<?> rawType = (Class<?>) parameterizedType.getRawType(); Type[] typeArguments = parameterizedType.getActualTypeArguments(); TypeArgSignature[] typeArgSignatures = new TypeArgSignature[typeArguments.length]; for...
[ "private", "ClassTypeSignature", "getClassTypeSignature", "(", "ParameterizedType", "parameterizedType", ")", "{", "Class", "<", "?", ">", "rawType", "=", "(", "Class", "<", "?", ">", ")", "parameterizedType", ".", "getRawType", "(", ")", ";", "Type", "[", "]"...
get the ClassTypeSignature corresponding to given parameterized type @param parameterizedType @return
[ "get", "the", "ClassTypeSignature", "corresponding", "to", "given", "parameterized", "type" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/signature/JavaTypeToTypeSignature.java#L60-L78
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/signature/JavaTypeToTypeSignature.java
JavaTypeToTypeSignature.getTypeSignature
private FullTypeSignature getTypeSignature(Class<?> clazz) { StringBuilder sb = new StringBuilder(); if (clazz.isArray()) { sb.append(clazz.getName()); } else if (clazz.isPrimitive()) { sb.append(primitiveTypesMap.get(clazz).toString()); } else { sb.append('L').append(clazz.getName()).append(';'...
java
private FullTypeSignature getTypeSignature(Class<?> clazz) { StringBuilder sb = new StringBuilder(); if (clazz.isArray()) { sb.append(clazz.getName()); } else if (clazz.isPrimitive()) { sb.append(primitiveTypesMap.get(clazz).toString()); } else { sb.append('L').append(clazz.getName()).append(';'...
[ "private", "FullTypeSignature", "getTypeSignature", "(", "Class", "<", "?", ">", "clazz", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "clazz", ".", "isArray", "(", ")", ")", "{", "sb", ".", "append", "(", "cl...
get the type signature corresponding to given class @param clazz @return
[ "get", "the", "type", "signature", "corresponding", "to", "given", "class" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/signature/JavaTypeToTypeSignature.java#L126-L137
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/signature/JavaTypeToTypeSignature.java
JavaTypeToTypeSignature.getTypeArgSignature
private TypeArgSignature getTypeArgSignature(Type type) { if (type instanceof WildcardType) { WildcardType wildcardType = (WildcardType) type; Type lowerBound = wildcardType.getLowerBounds().length == 0 ? null : wildcardType.getLowerBounds()[0]; Type upperBound = wildcardType.getUpperBounds().lengt...
java
private TypeArgSignature getTypeArgSignature(Type type) { if (type instanceof WildcardType) { WildcardType wildcardType = (WildcardType) type; Type lowerBound = wildcardType.getLowerBounds().length == 0 ? null : wildcardType.getLowerBounds()[0]; Type upperBound = wildcardType.getUpperBounds().lengt...
[ "private", "TypeArgSignature", "getTypeArgSignature", "(", "Type", "type", ")", "{", "if", "(", "type", "instanceof", "WildcardType", ")", "{", "WildcardType", "wildcardType", "=", "(", "WildcardType", ")", "type", ";", "Type", "lowerBound", "=", "wildcardType", ...
get the TypeArgSignature corresponding to given type @param type @return
[ "get", "the", "TypeArgSignature", "corresponding", "to", "given", "type" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/signature/JavaTypeToTypeSignature.java#L145-L172
train
Canadensys/canadensys-core
src/main/java/net/canadensys/utils/ZipUtils.java
ZipUtils.zipFolder
public static boolean zipFolder(File folder, String fileName){ boolean success = false; if(!folder.isDirectory()){ return false; } if(fileName == null){ fileName = folder.getAbsolutePath()+ZIP_EXT; } ZipArchiveOutputStream zipOutput = null; try { zipOutput = new ZipArchiveOutputStream(new F...
java
public static boolean zipFolder(File folder, String fileName){ boolean success = false; if(!folder.isDirectory()){ return false; } if(fileName == null){ fileName = folder.getAbsolutePath()+ZIP_EXT; } ZipArchiveOutputStream zipOutput = null; try { zipOutput = new ZipArchiveOutputStream(new F...
[ "public", "static", "boolean", "zipFolder", "(", "File", "folder", ",", "String", "fileName", ")", "{", "boolean", "success", "=", "false", ";", "if", "(", "!", "folder", ".", "isDirectory", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", ...
Utility function to zip the content of an entire folder, but not the folder itself. @param folder @param fileName optional @return success or not
[ "Utility", "function", "to", "zip", "the", "content", "of", "an", "entire", "folder", "but", "not", "the", "folder", "itself", "." ]
5e13569f7c0f4cdc7080da72643ff61123ad76fd
https://github.com/Canadensys/canadensys-core/blob/5e13569f7c0f4cdc7080da72643ff61123ad76fd/src/main/java/net/canadensys/utils/ZipUtils.java#L34-L64
train
Canadensys/canadensys-core
src/main/java/net/canadensys/utils/ZipUtils.java
ZipUtils.unzipFileOrFolder
public static boolean unzipFileOrFolder(File zipFile, String unzippedFolder){ InputStream is; ArchiveInputStream in = null; OutputStream out = null; if(!zipFile.isFile()){ return false; } if(unzippedFolder == null){ unzippedFolder = FilenameUtils.removeExtension(zipFile.getAbsolutePath()); } ...
java
public static boolean unzipFileOrFolder(File zipFile, String unzippedFolder){ InputStream is; ArchiveInputStream in = null; OutputStream out = null; if(!zipFile.isFile()){ return false; } if(unzippedFolder == null){ unzippedFolder = FilenameUtils.removeExtension(zipFile.getAbsolutePath()); } ...
[ "public", "static", "boolean", "unzipFileOrFolder", "(", "File", "zipFile", ",", "String", "unzippedFolder", ")", "{", "InputStream", "is", ";", "ArchiveInputStream", "in", "=", "null", ";", "OutputStream", "out", "=", "null", ";", "if", "(", "!", "zipFile", ...
Unzip a file or a folder @param zipFile @param unzippedFolder optional, if null the file/folder will be extracted in the same folder as zipFile @return
[ "Unzip", "a", "file", "or", "a", "folder" ]
5e13569f7c0f4cdc7080da72643ff61123ad76fd
https://github.com/Canadensys/canadensys-core/blob/5e13569f7c0f4cdc7080da72643ff61123ad76fd/src/main/java/net/canadensys/utils/ZipUtils.java#L117-L171
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/impl/UTCTimeBoxImplShared.java
UTCTimeBoxImplShared.formatUsingFormat
protected static final String formatUsingFormat(Long value, DateTimeFormat fmt) { if (value == null) { return ""; } else { // midnight GMT Date date = new Date(0); // offset by timezone and value date.setTime(UTCDateBox.timezoneOffsetMi...
java
protected static final String formatUsingFormat(Long value, DateTimeFormat fmt) { if (value == null) { return ""; } else { // midnight GMT Date date = new Date(0); // offset by timezone and value date.setTime(UTCDateBox.timezoneOffsetMi...
[ "protected", "static", "final", "String", "formatUsingFormat", "(", "Long", "value", ",", "DateTimeFormat", "fmt", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "else", "{", "// midnight GMT", "Date", "date", "=", "new",...
Formats the value provided with the specified DateTimeFormat
[ "Formats", "the", "value", "provided", "with", "the", "specified", "DateTimeFormat" ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/impl/UTCTimeBoxImplShared.java#L111-L123
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/impl/UTCTimeBoxImplShared.java
UTCTimeBoxImplShared.parseUsingFallbacksWithColon
protected static final Long parseUsingFallbacksWithColon(String text, DateTimeFormat timeFormat) { if (text.indexOf(':') == -1) { text = text.replace(" ", ""); int numdigits = 0; int lastdigit = 0; for (int i = 0; i < text.length(); i++) { char c =...
java
protected static final Long parseUsingFallbacksWithColon(String text, DateTimeFormat timeFormat) { if (text.indexOf(':') == -1) { text = text.replace(" ", ""); int numdigits = 0; int lastdigit = 0; for (int i = 0; i < text.length(); i++) { char c =...
[ "protected", "static", "final", "Long", "parseUsingFallbacksWithColon", "(", "String", "text", ",", "DateTimeFormat", "timeFormat", ")", "{", "if", "(", "text", ".", "indexOf", "(", "'", "'", ")", "==", "-", "1", ")", "{", "text", "=", "text", ".", "repl...
Attempts to insert a colon so that a value without a colon can be parsed.
[ "Attempts", "to", "insert", "a", "colon", "so", "that", "a", "value", "without", "a", "colon", "can", "be", "parsed", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/impl/UTCTimeBoxImplShared.java#L129-L156
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/type/TypeUtils.java
TypeUtils.getRawType
public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { ParameterizedType actualType = (ParameterizedType) type; return getRawType(actualType.getRawType()); } else if (type instanceof GenericArrayType) { Generi...
java
public static Class<?> getRawType(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { ParameterizedType actualType = (ParameterizedType) type; return getRawType(actualType.getRawType()); } else if (type instanceof GenericArrayType) { Generi...
[ "public", "static", "Class", "<", "?", ">", "getRawType", "(", "Type", "type", ")", "{", "if", "(", "type", "instanceof", "Class", ")", "{", "return", "(", "Class", "<", "?", ">", ")", "type", ";", "}", "else", "if", "(", "type", "instanceof", "Par...
This method returns the actual raw class associated with the specified type.
[ "This", "method", "returns", "the", "actual", "raw", "class", "associated", "with", "the", "specified", "type", "." ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/type/TypeUtils.java#L39-L60
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/type/TypeUtils.java
TypeUtils.isAssignableFrom
public static boolean isAssignableFrom(TypeReference<?> from, TypeReference<?> to) { if (from == null) { return false; } if (to.equals(from)) { return true; } if (to.getType() instanceof Class) { return to.getRawType().isAssignableFrom(from.getRawType()); } else if (to.getType() instanceof Parame...
java
public static boolean isAssignableFrom(TypeReference<?> from, TypeReference<?> to) { if (from == null) { return false; } if (to.equals(from)) { return true; } if (to.getType() instanceof Class) { return to.getRawType().isAssignableFrom(from.getRawType()); } else if (to.getType() instanceof Parame...
[ "public", "static", "boolean", "isAssignableFrom", "(", "TypeReference", "<", "?", ">", "from", ",", "TypeReference", "<", "?", ">", "to", ")", "{", "if", "(", "from", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "to", ".", "equals...
Check if this type is assignable from the given Type.
[ "Check", "if", "this", "type", "is", "assignable", "from", "the", "given", "Type", "." ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/type/TypeUtils.java#L66-L87
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/type/TypeUtils.java
TypeUtils.isAssignableFrom
private static boolean isAssignableFrom(Type from, ParameterizedType to, Map<String, Type> typeVarMap) { if (from == null) { return false; } if (to.equals(from)) { return true; } // First figure out the class and any type information. Class<?> clazz = getRawType(from); ParameterizedType ptype ...
java
private static boolean isAssignableFrom(Type from, ParameterizedType to, Map<String, Type> typeVarMap) { if (from == null) { return false; } if (to.equals(from)) { return true; } // First figure out the class and any type information. Class<?> clazz = getRawType(from); ParameterizedType ptype ...
[ "private", "static", "boolean", "isAssignableFrom", "(", "Type", "from", ",", "ParameterizedType", "to", ",", "Map", "<", "String", ",", "Type", ">", "typeVarMap", ")", "{", "if", "(", "from", "==", "null", ")", "{", "return", "false", ";", "}", "if", ...
Private recursive helper function to actually do the type-safe checking of assignability.
[ "Private", "recursive", "helper", "function", "to", "actually", "do", "the", "type", "-", "safe", "checking", "of", "assignability", "." ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/type/TypeUtils.java#L93-L145
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/type/TypeUtils.java
TypeUtils.typeEquals
private static boolean typeEquals(ParameterizedType from, ParameterizedType to, Map<String, Type> typeVarMap) { if (from.getRawType().equals(to.getRawType())) { Type[] fromArgs = from.getActualTypeArguments(); Type[] toArgs = to.getActualTypeArguments(); for (int i = 0; i < fromArgs.length; i++) { if ...
java
private static boolean typeEquals(ParameterizedType from, ParameterizedType to, Map<String, Type> typeVarMap) { if (from.getRawType().equals(to.getRawType())) { Type[] fromArgs = from.getActualTypeArguments(); Type[] toArgs = to.getActualTypeArguments(); for (int i = 0; i < fromArgs.length; i++) { if ...
[ "private", "static", "boolean", "typeEquals", "(", "ParameterizedType", "from", ",", "ParameterizedType", "to", ",", "Map", "<", "String", ",", "Type", ">", "typeVarMap", ")", "{", "if", "(", "from", ".", "getRawType", "(", ")", ".", "equals", "(", "to", ...
Checks if two parameterized types are exactly equal, under the variable replacement described in the typeVarMap.
[ "Checks", "if", "two", "parameterized", "types", "are", "exactly", "equal", "under", "the", "variable", "replacement", "described", "in", "the", "typeVarMap", "." ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/type/TypeUtils.java#L151-L164
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/type/TypeUtils.java
TypeUtils.matches
private static boolean matches(Type from, Type to, Map<String, Type> typeMap) { if (to.equals(from)) return true; if (from instanceof TypeVariable) { return to.equals(typeMap.get(((TypeVariable<?>) from).getName())); } return false; }
java
private static boolean matches(Type from, Type to, Map<String, Type> typeMap) { if (to.equals(from)) return true; if (from instanceof TypeVariable) { return to.equals(typeMap.get(((TypeVariable<?>) from).getName())); } return false; }
[ "private", "static", "boolean", "matches", "(", "Type", "from", ",", "Type", "to", ",", "Map", "<", "String", ",", "Type", ">", "typeMap", ")", "{", "if", "(", "to", ".", "equals", "(", "from", ")", ")", "return", "true", ";", "if", "(", "from", ...
Checks if two types are the same or are equivalent under a variable mapping given in the type map that was provided.
[ "Checks", "if", "two", "types", "are", "the", "same", "or", "are", "equivalent", "under", "a", "variable", "mapping", "given", "in", "the", "type", "map", "that", "was", "provided", "." ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/type/TypeUtils.java#L170-L179
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/type/TypeUtils.java
TypeUtils.isAssignableFrom
private static boolean isAssignableFrom(Type from, GenericArrayType to) { Type toGenericComponentType = to.getGenericComponentType(); if (toGenericComponentType instanceof ParameterizedType) { Type t = from; if (from instanceof GenericArrayType) { t = ((GenericArrayType) from).getGenericComponentType(); ...
java
private static boolean isAssignableFrom(Type from, GenericArrayType to) { Type toGenericComponentType = to.getGenericComponentType(); if (toGenericComponentType instanceof ParameterizedType) { Type t = from; if (from instanceof GenericArrayType) { t = ((GenericArrayType) from).getGenericComponentType(); ...
[ "private", "static", "boolean", "isAssignableFrom", "(", "Type", "from", ",", "GenericArrayType", "to", ")", "{", "Type", "toGenericComponentType", "=", "to", ".", "getGenericComponentType", "(", ")", ";", "if", "(", "toGenericComponentType", "instanceof", "Paramete...
Private helper function that performs some assignability checks for the provided GenericArrayType.
[ "Private", "helper", "function", "that", "performs", "some", "assignability", "checks", "for", "the", "provided", "GenericArrayType", "." ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/type/TypeUtils.java#L185-L205
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java
SingleListBox.setValue
@Override public void setValue(String value, boolean fireEvents) { boolean added = setSelectedValue(this, value, addMissingValue); if (added && fireEvents) { ValueChangeEvent.fire(this, getValue()); } }
java
@Override public void setValue(String value, boolean fireEvents) { boolean added = setSelectedValue(this, value, addMissingValue); if (added && fireEvents) { ValueChangeEvent.fire(this, getValue()); } }
[ "@", "Override", "public", "void", "setValue", "(", "String", "value", ",", "boolean", "fireEvents", ")", "{", "boolean", "added", "=", "setSelectedValue", "(", "this", ",", "value", ",", "addMissingValue", ")", ";", "if", "(", "added", "&&", "fireEvents", ...
Selects the specified value in the list. @param value the new value @param fireEvents if true, a ValueChangeEvent event will be fired @see #setAddMissingValue
[ "Selects", "the", "specified", "value", "in", "the", "list", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java#L116-L122
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java
SingleListBox.getSelectedValue
public static final String getSelectedValue(ListBox list) { int index = list.getSelectedIndex(); return (index >= 0) ? list.getValue(index) : null; }
java
public static final String getSelectedValue(ListBox list) { int index = list.getSelectedIndex(); return (index >= 0) ? list.getValue(index) : null; }
[ "public", "static", "final", "String", "getSelectedValue", "(", "ListBox", "list", ")", "{", "int", "index", "=", "list", ".", "getSelectedIndex", "(", ")", ";", "return", "(", "index", ">=", "0", ")", "?", "list", ".", "getValue", "(", "index", ")", "...
Utility function to get the current value.
[ "Utility", "function", "to", "get", "the", "current", "value", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java#L146-L149
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java
SingleListBox.getSelectedText
public static final String getSelectedText(ListBox list) { int index = list.getSelectedIndex(); return (index >= 0) ? list.getItemText(index) : null; }
java
public static final String getSelectedText(ListBox list) { int index = list.getSelectedIndex(); return (index >= 0) ? list.getItemText(index) : null; }
[ "public", "static", "final", "String", "getSelectedText", "(", "ListBox", "list", ")", "{", "int", "index", "=", "list", ".", "getSelectedIndex", "(", ")", ";", "return", "(", "index", ">=", "0", ")", "?", "list", ".", "getItemText", "(", "index", ")", ...
Utility function to get the current text.
[ "Utility", "function", "to", "get", "the", "current", "text", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java#L154-L157
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java
SingleListBox.findValueInListBox
public static final int findValueInListBox(ListBox list, String value) { for (int i=0; i<list.getItemCount(); i++) { if (value.equals(list.getValue(i))) { return i; } } return -1; }
java
public static final int findValueInListBox(ListBox list, String value) { for (int i=0; i<list.getItemCount(); i++) { if (value.equals(list.getValue(i))) { return i; } } return -1; }
[ "public", "static", "final", "int", "findValueInListBox", "(", "ListBox", "list", ",", "String", "value", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "getItemCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "value"...
Utility function to find the first index of a value in a ListBox.
[ "Utility", "function", "to", "find", "the", "first", "index", "of", "a", "value", "in", "a", "ListBox", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java#L163-L170
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java
SingleListBox.setSelectedValue
public static final boolean setSelectedValue(ListBox list, String value, boolean addMissingValues) { if (value == null) { list.setSelectedIndex(0); return false; } else { int index = findValueInListBox(list, value); if (index >= 0) { list.setSelectedIndex(index); return true; } if ...
java
public static final boolean setSelectedValue(ListBox list, String value, boolean addMissingValues) { if (value == null) { list.setSelectedIndex(0); return false; } else { int index = findValueInListBox(list, value); if (index >= 0) { list.setSelectedIndex(index); return true; } if ...
[ "public", "static", "final", "boolean", "setSelectedValue", "(", "ListBox", "list", ",", "String", "value", ",", "boolean", "addMissingValues", ")", "{", "if", "(", "value", "==", "null", ")", "{", "list", ".", "setSelectedIndex", "(", "0", ")", ";", "retu...
Utility function to set the current value in a ListBox. @return returns true if the option corresponding to the value was successfully selected in the ListBox
[ "Utility", "function", "to", "set", "the", "current", "value", "in", "a", "ListBox", "." ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java#L178-L201
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/utils/BeanUtils.java
BeanUtils.capitalizePropertyName
public static String capitalizePropertyName(String s) { if (s.length() == 0) { return s; } char[] chars = s.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); return new String(chars); }
java
public static String capitalizePropertyName(String s) { if (s.length() == 0) { return s; } char[] chars = s.toCharArray(); chars[0] = Character.toUpperCase(chars[0]); return new String(chars); }
[ "public", "static", "String", "capitalizePropertyName", "(", "String", "s", ")", "{", "if", "(", "s", ".", "length", "(", ")", "==", "0", ")", "{", "return", "s", ";", "}", "char", "[", "]", "chars", "=", "s", ".", "toCharArray", "(", ")", ";", "...
Return a capitalized version of the specified property name. @param s The property name
[ "Return", "a", "capitalized", "version", "of", "the", "specified", "property", "name", "." ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/utils/BeanUtils.java#L36-L44
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/utils/BeanUtils.java
BeanUtils.getGetterPropertyMethod
public static Method getGetterPropertyMethod(Class<?> type, String propertyName) { String sourceMethodName = "get" + BeanUtils.capitalizePropertyName(propertyName); Method sourceMethod = BeanUtils.getMethod(type, sourceMethodName); if (sourceMethod == null) { sourceMethodName = "is" + Be...
java
public static Method getGetterPropertyMethod(Class<?> type, String propertyName) { String sourceMethodName = "get" + BeanUtils.capitalizePropertyName(propertyName); Method sourceMethod = BeanUtils.getMethod(type, sourceMethodName); if (sourceMethod == null) { sourceMethodName = "is" + Be...
[ "public", "static", "Method", "getGetterPropertyMethod", "(", "Class", "<", "?", ">", "type", ",", "String", "propertyName", ")", "{", "String", "sourceMethodName", "=", "\"get\"", "+", "BeanUtils", ".", "capitalizePropertyName", "(", "propertyName", ")", ";", "...
get the getter method corresponding to given property
[ "get", "the", "getter", "method", "corresponding", "to", "given", "property" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/utils/BeanUtils.java#L128-L145
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/utils/BeanUtils.java
BeanUtils.getSetterPropertyMethod
public static Method getSetterPropertyMethod(Class<?> type, String propertyName) { String sourceMethodName = "set" + BeanUtils.capitalizePropertyName(propertyName); Method sourceMethod = BeanUtils.getMethod(type, sourceMethodName); return sourceMethod; }
java
public static Method getSetterPropertyMethod(Class<?> type, String propertyName) { String sourceMethodName = "set" + BeanUtils.capitalizePropertyName(propertyName); Method sourceMethod = BeanUtils.getMethod(type, sourceMethodName); return sourceMethod; }
[ "public", "static", "Method", "getSetterPropertyMethod", "(", "Class", "<", "?", ">", "type", ",", "String", "propertyName", ")", "{", "String", "sourceMethodName", "=", "\"set\"", "+", "BeanUtils", ".", "capitalizePropertyName", "(", "propertyName", ")", ";", "...
get the setter method corresponding to given property
[ "get", "the", "setter", "method", "corresponding", "to", "given", "property" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/utils/BeanUtils.java#L151-L159
train
matiwinnetou/spring-soy-view
spring-soy-view/src/main/java/pl/matisoft/soy/data/NoConvertSoyDataConverter.java
NoConvertSoyDataConverter.toSoyMap
@Override public Optional<SoyMapData> toSoyMap(@Nullable final Object model) throws Exception { if (model instanceof SoyMapData) { return Optional.of((SoyMapData) model); } if (model instanceof Map) { return Optional.of(new SoyMapData(model)); } retur...
java
@Override public Optional<SoyMapData> toSoyMap(@Nullable final Object model) throws Exception { if (model instanceof SoyMapData) { return Optional.of((SoyMapData) model); } if (model instanceof Map) { return Optional.of(new SoyMapData(model)); } retur...
[ "@", "Override", "public", "Optional", "<", "SoyMapData", ">", "toSoyMap", "(", "@", "Nullable", "final", "Object", "model", ")", "throws", "Exception", "{", "if", "(", "model", "instanceof", "SoyMapData", ")", "{", "return", "Optional", ".", "of", "(", "(...
Pass a model object and return a SoyMapData if a model object happens to be a SoyMapData. An implementation will also check if a passed in object is a Map and return a SoyMapData wrapping that map
[ "Pass", "a", "model", "object", "and", "return", "a", "SoyMapData", "if", "a", "model", "object", "happens", "to", "be", "a", "SoyMapData", "." ]
a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1
https://github.com/matiwinnetou/spring-soy-view/blob/a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1/spring-soy-view/src/main/java/pl/matisoft/soy/data/NoConvertSoyDataConverter.java#L28-L38
train
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/AutoSizingTextArea.java
AutoSizingTextArea.getShadowSize
@Override public int getShadowSize() { Element shadowElement = shadow.getElement(); shadowElement.setScrollTop(10000); return shadowElement.getScrollTop(); }
java
@Override public int getShadowSize() { Element shadowElement = shadow.getElement(); shadowElement.setScrollTop(10000); return shadowElement.getScrollTop(); }
[ "@", "Override", "public", "int", "getShadowSize", "(", ")", "{", "Element", "shadowElement", "=", "shadow", ".", "getElement", "(", ")", ";", "shadowElement", ".", "setScrollTop", "(", "10000", ")", ";", "return", "shadowElement", ".", "getScrollTop", "(", ...
Returns the size of the shadow element
[ "Returns", "the", "size", "of", "the", "shadow", "element" ]
efc1423c619439763fb064b777b7235e9ce414a3
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/AutoSizingTextArea.java#L102-L107
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/context/ConvertedObjectPool.java
ConvertedObjectPool.get
public Object get(IConverter converter, Object sourceObject, TypeReference<?> destinationType) { return convertedObjects.get(new ConvertedObjectsKey(converter, sourceObject, destinationType)); }
java
public Object get(IConverter converter, Object sourceObject, TypeReference<?> destinationType) { return convertedObjects.get(new ConvertedObjectsKey(converter, sourceObject, destinationType)); }
[ "public", "Object", "get", "(", "IConverter", "converter", ",", "Object", "sourceObject", ",", "TypeReference", "<", "?", ">", "destinationType", ")", "{", "return", "convertedObjects", ".", "get", "(", "new", "ConvertedObjectsKey", "(", "converter", ",", "sourc...
get the converted object corresponding to sourceObject as converted to destination type by converter @param converter @param sourceObject @param destinationType @return
[ "get", "the", "converted", "object", "corresponding", "to", "sourceObject", "as", "converted", "to", "destination", "type", "by", "converter" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/context/ConvertedObjectPool.java#L43-L47
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/context/ConvertedObjectPool.java
ConvertedObjectPool.add
public void add(IConverter converter, Object sourceObject, TypeReference<?> destinationType, Object convertedObject) { convertedObjects.put(new ConvertedObjectsKey(converter, sourceObject, destinationType), convertedObject); }
java
public void add(IConverter converter, Object sourceObject, TypeReference<?> destinationType, Object convertedObject) { convertedObjects.put(new ConvertedObjectsKey(converter, sourceObject, destinationType), convertedObject); }
[ "public", "void", "add", "(", "IConverter", "converter", ",", "Object", "sourceObject", ",", "TypeReference", "<", "?", ">", "destinationType", ",", "Object", "convertedObject", ")", "{", "convertedObjects", ".", "put", "(", "new", "ConvertedObjectsKey", "(", "c...
add a converted object to the pool @param converter the converter that made the conversion @param sourceObject the source object that has been converted @param destinationType the destination type @param convertedObject the converted object
[ "add", "a", "converted", "object", "to", "the", "pool" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/context/ConvertedObjectPool.java#L61-L65
train
cchabanois/transmorph
src/main/java/net/entropysoft/transmorph/context/ConvertedObjectPool.java
ConvertedObjectPool.remove
public void remove(IConverter converter, Object sourceObject, TypeReference<?> destinationType) { convertedObjects.remove(new ConvertedObjectsKey(converter, sourceObject, destinationType)); }
java
public void remove(IConverter converter, Object sourceObject, TypeReference<?> destinationType) { convertedObjects.remove(new ConvertedObjectsKey(converter, sourceObject, destinationType)); }
[ "public", "void", "remove", "(", "IConverter", "converter", ",", "Object", "sourceObject", ",", "TypeReference", "<", "?", ">", "destinationType", ")", "{", "convertedObjects", ".", "remove", "(", "new", "ConvertedObjectsKey", "(", "converter", ",", "sourceObject"...
remove a converted object from the pool @param converter @param sourceObject @param destinationType
[ "remove", "a", "converted", "object", "from", "the", "pool" ]
118550f30b9680a84eab7496bd8b04118740dcec
https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/context/ConvertedObjectPool.java#L74-L78
train