_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q157700 | JsonHelper.toJsonObject | train | public static String toJsonObject(Object... namesAndValues) {
if (namesAndValues.length % 2 != 0) {
throw new IllegalArgumentException("number or arguments must be even");
}
StringBuilder sb = new StringBuilder("{");
int count = 0;
while (true) {
Object... | java | {
"resource": ""
} |
q157701 | JsonHelper.toList | train | public static List toList(String json) {
try {
return mapper.readValue(json, List.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | {
"resource": ""
} |
q157702 | JsonHelper.sanitize | train | public static String sanitize(String value, boolean clean, Character... toEscape) {
StringBuilder builder = new StringBuilder();
Map<Character, String> replacements = clean ? CLEAN_CHARS : REPLACEMENT_CHARS;
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
... | java | {
"resource": ""
} |
q157703 | Convert.toBoolean | train | public static Boolean toBoolean(Object value) {
if (value == null) {
return false;
} else if (value instanceof Boolean) {
return (Boolean) value;
} else if (value instanceof BigDecimal) {
return value.equals(BigDecimal.ONE);
} else if (value instanceof... | java | {
"resource": ""
} |
q157704 | Convert.toFloat | train | public static Float toFloat(Object value) {
if (value == null) {
return null;
} else if (value instanceof Float) {
return (Float) value;
} else if (value instanceof Number) {
return ((Number) value).floatValue();
} else {
return Float.value... | java | {
"resource": ""
} |
q157705 | Convert.toInteger | train | public static Integer toInteger(Object value) {
if (value == null) {
return null;
} else if (value instanceof Integer) {
return (Integer) value;
} else if (value instanceof Number) {
return ((Number) value).intValue();
} else {
try {
... | java | {
"resource": ""
} |
q157706 | Convert.toBigDecimal | train | public static BigDecimal toBigDecimal(Object value) {
if (value == null) {
return null;
} else if (value instanceof BigDecimal) {
return (BigDecimal) value;
} else {
try {
return new BigDecimal(value.toString().trim());
} catch (Num... | java | {
"resource": ""
} |
q157707 | XmlEntities.doUnescape | train | private void doUnescape(StringBuilder sb, String str, int firstAmp) {
sb.append(str, 0, firstAmp);
int len = str.length();
for (int i = firstAmp; i < len; i++) {
char c = str.charAt(i);
if (c == '&') {
int nextIdx = i + 1;
int semiColonIdx ... | java | {
"resource": ""
} |
q157708 | Util.readResourceBytes | train | public static byte[] readResourceBytes(String resourceName) {
InputStream is = Util.class.getResourceAsStream(resourceName);
try {
return bytes(is);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
closeQuietly(is);
}
} | java | {
"resource": ""
} |
q157709 | Util.readResource | train | public static String readResource(String resourceName, String charset) {
InputStream is = Util.class.getResourceAsStream(resourceName);
try {
return read(is, charset);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
closeQuietly(is... | java | {
"resource": ""
} |
q157710 | Util.readFile | train | public static String readFile(String fileName, String charset) {
FileInputStream in = null;
try {
in = new FileInputStream(fileName);
return read(in, charset);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
closeQuietl... | java | {
"resource": ""
} |
q157711 | Util.read | train | public static String read(InputStream in, String charset) throws IOException {
if (in == null) {
throw new IllegalArgumentException("input stream cannot be null");
}
InputStreamReader reader = null;
try {
reader = new InputStreamReader(in, charset);
ch... | java | {
"resource": ""
} |
q157712 | Util.read | train | public static byte[] read(File file) throws IOException {
FileInputStream is = new FileInputStream(file);
try {
return bytes(is);
} finally {
closeQuietly(is);
}
} | java | {
"resource": ""
} |
q157713 | Util.getResourceLines | train | public static List<String> getResourceLines(String resourceName) throws IOException {
InputStreamReader isreader = null;
BufferedReader reader = null;
try {
isreader = new InputStreamReader(Util.class.getResourceAsStream(resourceName));
reader = new BufferedReader(isreade... | java | {
"resource": ""
} |
q157714 | Util.join | train | public static String join(String[] array, String delimiter) {
if (empty(array)) { return ""; }
StringBuilder sb = new StringBuilder();
join(sb, array, delimiter);
return sb.toString();
} | java | {
"resource": ""
} |
q157715 | Util.join | train | public static void join(StringBuilder sb, Collection<?> collection, String delimiter) {
if (collection.isEmpty()) { return; }
Iterator<?> it = collection.iterator();
sb.append(it.next());
while (it.hasNext()) {
sb.append(delimiter);
sb.append(it.next());
}... | java | {
"resource": ""
} |
q157716 | Util.join | train | public static void join(StringBuilder sb, Object[] array, String delimiter) {
if (empty(array)) { return; }
sb.append(array[0]);
for (int i = 1; i < array.length; i++) {
sb.append(delimiter);
sb.append(array[i]);
}
} | java | {
"resource": ""
} |
q157717 | Util.repeat | train | public static void repeat(StringBuilder sb, String str, int count) {
for (int i = 0; i < count; i++) {
sb.append(str);
}
} | java | {
"resource": ""
} |
q157718 | Util.joinAndRepeat | train | public static void joinAndRepeat(StringBuilder sb, String str, String delimiter, int count) {
if (count > 0) {
sb.append(str);
for (int i = 1; i < count; i++) {
sb.append(delimiter);
sb.append(str);
}
}
} | java | {
"resource": ""
} |
q157719 | Util.getStackTraceString | train | public static String getStackTraceString(Throwable throwable) {
StringWriter sw = null;
PrintWriter pw = null;
try {
sw = new StringWriter();
pw = new PrintWriter(sw);
pw.println(throwable.toString());
throwable.printStackTrace(pw);
pw.... | java | {
"resource": ""
} |
q157720 | Util.saveTo | train | public static void saveTo(String path, byte[] content) {
InputStream is = null;
try {
is = new ByteArrayInputStream(content);
saveTo(path, is);
} finally {
closeQuietly(is);
}
} | java | {
"resource": ""
} |
q157721 | Util.recursiveDelete | train | public static void recursiveDelete(Path directory) throws IOException {
try {
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws java.io.IOException {
... | java | {
"resource": ""
} |
q157722 | MetaModels.getEdges | train | protected List<String> getEdges(String join) {
List<String> results = new ArrayList<>();
for (Many2ManyAssociation a : many2ManyAssociations) {
if (a.getJoin().equalsIgnoreCase(join)) {
results.add(getMetaModel(a.getSourceClass()).getTableName());
results.add(... | java | {
"resource": ""
} |
q157723 | MigrationManager.getPendingMigrations | train | public List<Migration> getPendingMigrations() {
List<String> appliedMigrations = getAppliedMigrationVersions();
List<Migration> allMigrations = migrationResolver.resolve();
List<Migration> pendingMigrations = new ArrayList<Migration>();
for (Migration migration : allMigrations) {
... | java | {
"resource": ""
} |
q157724 | MigrationManager.migrate | train | public void migrate(Log log, String encoding) {
createSchemaVersionTable();
final Collection<Migration> pendingMigrations = getPendingMigrations();
if (pendingMigrations.isEmpty()) {
log.info("No new migrations are found");
return;
}
log.info("Migrating... | java | {
"resource": ""
} |
q157725 | Escape.html | train | public static void html(StringBuilder sb, String html) {
for (int i = 0; i < html.length(); i++) {
char c = html.charAt(i);
switch (c) {
case '&':
sb.append("&");
break;
case '"':
sb.append(""");
... | java | {
"resource": ""
} |
q157726 | Escape.html | train | public static String html(String html) {
StringBuilder sb = createStringBuilder(html.length());
html(sb, html);
return sb.toString();
} | java | {
"resource": ""
} |
q157727 | Inflector.gsub | train | public static String gsub(String word, String rule, String replacement) {
Pattern pattern = Pattern.compile(rule, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(word);
return matcher.find() ? matcher.replaceFirst(replacement) : null;
} | java | {
"resource": ""
} |
q157728 | Paginator.setCurrentPageIndex | train | public void setCurrentPageIndex(int currentPageIndex, boolean skipCheck){
if( currentPageIndex < 1){
throw new IndexOutOfBoundsException("currentPageIndex cannot be < 1");
}
if(!skipCheck){
if(currentPageIndex > pageCount()){
throw new IndexOutOfBoundsEx... | java | {
"resource": ""
} |
q157729 | ActiveJdbcInstrumentationPlugin.addCP | train | private void addCP() throws DependencyResolutionRequiredException, MalformedURLException, InvocationTargetException, NoSuchMethodException, IllegalAccessException {
List runtimeClasspathElements = project.getRuntimeClasspathElements();
for (Object runtimeClasspathElement : runtimeClasspathElements) {
... | java | {
"resource": ""
} |
q157730 | MysqlImportService.assertValidParams | train | private boolean assertValidParams() {
return username != null && !this.username.isEmpty() &&
password != null && !this.password.isEmpty() &&
sqlString != null && !this.sqlString.isEmpty() &&
( (database != null && !this.database.isEmpty()) || (jdbcConnString != null &... | java | {
"resource": ""
} |
q157731 | MysqlBaseService.connectWithURL | train | static Connection connectWithURL(String username, String password, String jdbcURL, String driverName) throws ClassNotFoundException, SQLException {
String driver = (Objects.isNull(driverName) || driverName.isEmpty()) ? "com.mysql.cj.jdbc.Driver" : driverName;
return doConnect(driver, jdbcURL, username... | java | {
"resource": ""
} |
q157732 | MysqlBaseService.doConnect | train | private static Connection doConnect(String driver, String url, String username, String password) throws SQLException, ClassNotFoundException {
Class.forName(driver);
Connection connection = DriverManager.getConnection(url, username, password);
logger.debug("DB Connected Successfully");
... | java | {
"resource": ""
} |
q157733 | MysqlBaseService.getAllTables | train | static List<String> getAllTables(String database, Statement stmt) throws SQLException {
List<String> table = new ArrayList<>();
ResultSet rs;
rs = stmt.executeQuery("SHOW TABLE STATUS FROM `" + database + "`;");
while ( rs.next() ) {
table.add(rs.getString("Name"));
... | java | {
"resource": ""
} |
q157734 | MysqlBaseService.getEmptyTableSQL | train | static String getEmptyTableSQL(String database, String table) {
String safeDeleteSQL = "SELECT IF( \n" +
"(SELECT COUNT(1) as table_exists FROM information_schema.tables \n" +
"WHERE table_schema='" + database + "' AND table_name='" + table + "') > 1, \n" +
... | java | {
"resource": ""
} |
q157735 | MysqlExportService.isValidateProperties | train | private boolean isValidateProperties() {
return properties != null &&
properties.containsKey(DB_USERNAME) &&
properties.containsKey(DB_PASSWORD) &&
(properties.containsKey(DB_NAME) || properties.containsKey(JDBC_CONNECTION_STRING));
} | java | {
"resource": ""
} |
q157736 | MysqlExportService.isEmailPropertiesSet | train | private boolean isEmailPropertiesSet() {
return properties != null &&
properties.containsKey(EMAIL_HOST) &&
properties.containsKey(EMAIL_PORT) &&
properties.containsKey(EMAIL_USERNAME) &&
properties.containsKey(EMAIL_PASSWORD) &&
... | java | {
"resource": ""
} |
q157737 | MysqlExportService.getTableInsertStatement | train | private String getTableInsertStatement(String table) throws SQLException {
StringBuilder sql = new StringBuilder();
ResultSet rs;
boolean addIfNotExists = Boolean.parseBoolean(properties.containsKey(ADD_IF_NOT_EXISTS) ? properties.getProperty(ADD_IF_NOT_EXISTS, "true") : "true");
... | java | {
"resource": ""
} |
q157738 | MysqlExportService.clearTempFiles | train | public void clearTempFiles(boolean preserveZipFile) {
//delete the temp sql file
File sqlFile = new File(dirName + "/sql/" + sqlFileName);
if(sqlFile.exists()) {
boolean res = sqlFile.delete();
logger.debug(LOG_PREFIX + ": " + sqlFile.getAbsolutePath() + " deleted ... | java | {
"resource": ""
} |
q157739 | MysqlExportService.getSqlFilename | train | public String getSqlFilename(){
return isSqlFileNamePropertySet() ? properties.getProperty(SQL_FILE_NAME) + ".sql" :
new SimpleDateFormat("d_M_Y_H_mm_ss").format(new Date()) + "_" + database + "_database_dump.sql";
} | java | {
"resource": ""
} |
q157740 | EmailService.isPropertiesSet | train | private boolean isPropertiesSet() {
return !this.host.isEmpty() &&
this.port > 0 &&
!this.username.isEmpty() &&
!this.password.isEmpty() &&
!this.toAdd.isEmpty() &&
!this.fromAdd.isEmpty() &&
!this.subject.isE... | java | {
"resource": ""
} |
q157741 | EmailService.sendMail | train | boolean sendMail() {
if(!this.isPropertiesSet()) {
logger.debug(LOG_PREFIX + ": Required Mail Properties are not set. Attachments will not be sent");
return false;
}
Properties prop = new Properties();
prop.put("mail.smtp.auth", true);
prop.put(... | java | {
"resource": ""
} |
q157742 | DateProperty.setDate | train | public final void setDate(final Date date) {
this.date = date;
if (date instanceof DateTime) {
if (Value.DATE.equals(getParameter(Parameter.VALUE))) {
getParameters().replace(Value.DATE_TIME);
}
updateTimeZone(((DateTime) date).getTimeZone());
... | java | {
"resource": ""
} |
q157743 | VEvent.getConsumedTime | train | public final PeriodList getConsumedTime(final Date rangeStart,
final Date rangeEnd) {
return getConsumedTime(rangeStart, rangeEnd, true);
} | java | {
"resource": ""
} |
q157744 | VEvent.getConsumedTime | train | public final PeriodList getConsumedTime(final Date rangeStart,
final Date rangeEnd, final boolean normalise) {
PeriodList periods = new PeriodList();
// if component is transparent return empty list..
if (!Transp.TRANSPARENT.equals(getProperty(Property.TRANSP))) {
// try {
... | java | {
"resource": ""
} |
q157745 | VEvent.getOccurrence | train | public final VEvent getOccurrence(final Date date) throws IOException,
URISyntaxException, ParseException {
final PeriodList consumedTime = getConsumedTime(date, date);
for (final Period p : consumedTime) {
if (p.getStart().equals(date)) {
final VEvent occurr... | java | {
"resource": ""
} |
q157746 | VEvent.getEndDate | train | public final DtEnd getEndDate(final boolean deriveFromDuration) {
DtEnd dtEnd = getProperty(Property.DTEND);
// No DTEND? No problem, we'll use the DURATION.
if (dtEnd == null && deriveFromDuration && getStartDate() != null) {
final DtStart dtStart = getStartDate();
final... | java | {
"resource": ""
} |
q157747 | VEvent.copy | train | public Component copy() throws ParseException, IOException,
URISyntaxException {
final VEvent copy = (VEvent) super.copy();
copy.alarms = new ComponentList<VAlarm>(alarms);
return copy;
} | java | {
"resource": ""
} |
q157748 | Strings.unquote | train | public static String unquote(final String aValue) {
if (aValue != null && aValue.startsWith("\"") && aValue.endsWith("\"")) {
return aValue.substring(0, aValue.length() - 1).substring(1);
}
return aValue;
} | java | {
"resource": ""
} |
q157749 | DateRange.includes | train | public final boolean includes(final Date date, final int inclusiveMask) {
boolean includes;
if ((inclusiveMask & INCLUSIVE_START) > 0) {
includes = !rangeStart.after(date);
}
else {
includes = rangeStart.before(date);
}
if ((inclusiveMask & INCLUSI... | java | {
"resource": ""
} |
q157750 | DateRange.intersects | train | public final boolean intersects(final DateRange range) {
boolean intersects = false;
// Test for our start date in period
// (Exclude if it is the end date of test range)
if (range.includes(rangeStart) && !range.getRangeEnd().equals(rangeStart)) {
intersects = true;
}... | java | {
"resource": ""
} |
q157751 | DateRange.adjacent | train | public final boolean adjacent(final DateRange range) {
boolean adjacent = false;
if (rangeStart.equals(range.getRangeEnd())) {
adjacent = true;
} else if (rangeEnd.equals(range.getRangeStart())) {
adjacent = true;
}
return adjacent;
} | java | {
"resource": ""
} |
q157752 | AbstractContentFactory.registerExtendedFactory | train | @Deprecated
protected final void registerExtendedFactory(String key, T factory) {
extendedFactories.put(key, factory);
} | java | {
"resource": ""
} |
q157753 | PropertyList.getProperty | train | public final <R> R getProperty(final String aName) {
for (final T p : this) {
if (p.getName().equalsIgnoreCase(aName)) {
return (R) p;
}
}
return null;
} | java | {
"resource": ""
} |
q157754 | PropertyList.getProperties | train | @SuppressWarnings("unchecked")
public final <C extends T> PropertyList<C> getProperties(final String name) {
final PropertyList<C> list = new PropertyList<C>();
for (final T p : this) {
if (p.getName().equalsIgnoreCase(name)) {
list.add((C) p);
}
}
... | java | {
"resource": ""
} |
q157755 | Uris.encode | train | public static String encode(final String s) {
/*
* try { return URLEncoder.encode(s, ENCODING_CHARSET); } catch (UnsupportedEncodingException use) {
* log.error("Error ocurred encoding URI [" + s + "]", use); }
*/
/*
* Lotus Notes does not correctly strip angle brack... | java | {
"resource": ""
} |
q157756 | IndexedPropertyList.getProperties | train | public PropertyList<Property> getProperties(final String paramValue) {
PropertyList<Property> properties = index.get(paramValue);
if (properties == null) {
properties = EMPTY_LIST;
}
return properties;
} | java | {
"resource": ""
} |
q157757 | IndexedPropertyList.getProperty | train | public Property getProperty(final String paramValue) {
final PropertyList<Property> properties = getProperties(paramValue);
if (!properties.isEmpty()) {
return properties.iterator().next();
}
return null;
} | java | {
"resource": ""
} |
q157758 | CalendarComponent.validate | train | public final void validate(Method method) throws ValidationException {
final Validator<CalendarComponent> validator = getValidator(method);
if (validator != null) {
validator.validate(this);
}
else {
throw new ValidationException("Unsupported method: " + method);
... | java | {
"resource": ""
} |
q157759 | Period.getDuration | train | public final TemporalAmount getDuration() {
if (duration == null) {
return TemporalAmountAdapter.fromDateRange(getStart(), getEnd()).getDuration();
}
return duration.getDuration();
} | java | {
"resource": ""
} |
q157760 | Period.subtract | train | public final PeriodList subtract(final Period period) {
final PeriodList result = new PeriodList();
if (period.contains(this)) {
return result;
}
else if (!period.intersects(this)) {
result.add(this);
return result;
}
... | java | {
"resource": ""
} |
q157761 | Period.compareTo | train | public final int compareTo(final Period arg0) {
// Throws documented exception if type is wrong or parameter is null
if (arg0 == null) {
throw new ClassCastException("Cannot compare this object to null");
}
final int startCompare = getStart().compareTo(arg0.getStart());
... | java | {
"resource": ""
} |
q157762 | TimeZone.inDaylightTime | train | public final boolean inDaylightTime(final Date date) {
final Observance observance = vTimeZone.getApplicableObservance(new DateTime(date));
return (observance instanceof Daylight);
} | java | {
"resource": ""
} |
q157763 | ParameterList.getParameter | train | public final <T extends Parameter> T getParameter(final String aName) {
for (final Parameter p : parameters) {
if (aName.equalsIgnoreCase(p.getName())) {
return (T) p;
}
}
return null;
} | java | {
"resource": ""
} |
q157764 | ParameterList.getParameters | train | public final ParameterList getParameters(final String name) {
final ParameterList list = new ParameterList();
for (final Parameter p : parameters) {
if (p.getName().equalsIgnoreCase(name)) {
list.add(p);
}
}
return list;
} | java | {
"resource": ""
} |
q157765 | ParameterList.replace | train | public final boolean replace(final Parameter parameter) {
for (Parameter parameter1 : getParameters(parameter.getName())) {
remove(parameter1);
}
return add(parameter);
} | java | {
"resource": ""
} |
q157766 | ParameterList.removeAll | train | public final void removeAll(final String paramName) {
final ParameterList params = getParameters(paramName);
parameters.removeAll(params.parameters);
} | java | {
"resource": ""
} |
q157767 | ParameterFactoryImpl.createParameter | train | public Parameter createParameter(final String name, final String value)
throws URISyntaxException {
final ParameterFactory factory = getFactory(name);
Parameter parameter;
if (factory != null) {
parameter = factory.createParameter(value);
} else if (isExperimental... | java | {
"resource": ""
} |
q157768 | Calendars.load | train | public static Calendar load(final String filename) throws IOException, ParserException {
return new CalendarBuilder().build(Files.newInputStream(Paths.get(filename)));
} | java | {
"resource": ""
} |
q157769 | Calendars.load | train | public static Calendar load(final URL url) throws IOException, ParserException {
final CalendarBuilder builder = new CalendarBuilder();
return builder.build(url.openStream());
} | java | {
"resource": ""
} |
q157770 | Calendars.wrap | train | public static Calendar wrap(final CalendarComponent... component) {
final ComponentList<CalendarComponent> components = new ComponentList<>(Arrays.asList(component));
return new Calendar(components);
} | java | {
"resource": ""
} |
q157771 | Calendars.getUid | train | public static Uid getUid(final Calendar calendar) throws ConstraintViolationException {
Uid uid = null;
for (final Component c : calendar.getComponents()) {
for (final Property foundUid : c.getProperties(Property.UID)) {
if (uid != null && !uid.equals(foundUid)) {
... | java | {
"resource": ""
} |
q157772 | Calendars.getContentType | train | public static String getContentType(Calendar calendar, Charset charset) {
final StringBuilder b = new StringBuilder("text/calendar");
final Method method = calendar.getProperty(Property.METHOD);
if (method != null) {
b.append("; method=");
b.append(method.getValu... | java | {
"resource": ""
} |
q157773 | TimeZones.isUtc | train | public static boolean isUtc(final TimeZone timezone) {
// return timezone.hasSameRules(TimeZone.getTimeZone(UTC_ID));
// return timezone.getRawOffset() == 0;
return UTC_ID.equals(timezone.getID())
|| IBM_UTC_ID.equals(timezone.getID());
} | java | {
"resource": ""
} |
q157774 | VTimeZone.getApplicableObservance | train | public final Observance getApplicableObservance(final Date date) {
Observance latestObservance = null;
Date latestOnset = null;
for (final Observance observance : getObservances()) {
final Date onset = observance.getLatestOnset(date);
if (latestOnset == null
... | java | {
"resource": ""
} |
q157775 | VTimeZone.copy | train | public Component copy() throws ParseException, IOException, URISyntaxException {
final VTimeZone copy = (VTimeZone) super.copy();
copy.observances = new ComponentList<Observance>(observances);
return copy;
} | java | {
"resource": ""
} |
q157776 | Dates.getInstance | train | public static Date getInstance(final java.util.Date date, final Value type) {
if (Value.DATE.equals(type)) {
return new Date(date);
}
return new DateTime(date);
} | java | {
"resource": ""
} |
q157777 | Dates.getDateListInstance | train | public static DateList getDateListInstance(final DateList origList) {
final DateList list = new DateList(origList.getType());
if (origList.isUtc()) {
list.setUtc(true);
} else {
list.setTimeZone(origList.getTimeZone());
}
return list;
} | java | {
"resource": ""
} |
q157778 | Dates.round | train | public static long round(final long time, final int precision, final TimeZone tz) {
if ((precision == PRECISION_SECOND) && ((time % Dates.MILLIS_PER_SECOND) == 0)) {
return time;
}
final Calendar cal = Calendar.getInstance(tz);
cal.setTimeInMillis(time);
if (precision... | java | {
"resource": ""
} |
q157779 | DateTime.setTime | train | private void setTime(final String value, final DateFormat format,
final java.util.TimeZone tz) throws ParseException {
if (tz != null) {
format.setTimeZone(tz);
}
setTime(format.parse(value).getTime());
} | java | {
"resource": ""
} |
q157780 | DateTime.setUtc | train | public final void setUtc(final boolean utc) {
// reset the timezone associated with this instance..
this.timezone = null;
if (utc) {
getFormat().setTimeZone(TimeZones.getUtcTimeZone());
} else {
resetTimeZone();
}
time = new Time(time, getFormat().getTimeZone(), utc);
} | java | {
"resource": ""
} |
q157781 | Observance.getCachedOnset | train | private DateTime getCachedOnset(final Date date) {
int index = Arrays.binarySearch(onsetsMillisec, date.getTime());
if (index >= 0) {
return onsetsDates[index];
} else {
int insertionIndex = -index - 1;
return onsetsDates[insertionIndex - 1];
}
} | java | {
"resource": ""
} |
q157782 | Attach.setValue | train | public final void setValue(final String aValue) throws
URISyntaxException {
// determine if ATTACH is a URI or an embedded
// binary..
if (getParameter(Parameter.ENCODING) != null) {
// binary = Base64.decode(aValue);
try {
final BinaryDecoder... | java | {
"resource": ""
} |
q157783 | Parameter.copy | train | public <T extends Parameter> T copy() throws URISyntaxException {
if (factory == null) {
throw new UnsupportedOperationException("No factory specified");
}
return (T) factory.createParameter(getValue());
} | java | {
"resource": ""
} |
q157784 | PropertyValidator.assertOneOrLess | train | public void assertOneOrLess(final String propertyName,
final PropertyList properties) throws ValidationException {
if (properties.getProperties(propertyName).size() > 1) {
throw new ValidationException(ASSERT_ONE_OR_LESS_MESSAGE, new Object[] {propertyName});
}
} | java | {
"resource": ""
} |
q157785 | PropertyValidator.assertOneOrMore | train | public void assertOneOrMore(final String propertyName,
final PropertyList properties) throws ValidationException {
if (properties.getProperties(propertyName).size() < 1) {
throw new ValidationException(ASSERT_ONE_OR_MORE_MESSAGE, new Object[] {propertyName});
}
} | java | {
"resource": ""
} |
q157786 | PropertyValidator.assertOne | train | public void assertOne(final String propertyName,
final PropertyList properties) throws ValidationException {
if (properties.getProperties(propertyName).size() != 1) {
throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {propertyName});
}
} | java | {
"resource": ""
} |
q157787 | PropertyValidator.assertNone | train | public void assertNone(final String propertyName, final PropertyList properties) throws ValidationException {
if (properties.getProperty(propertyName) != null) {
throw new ValidationException(ASSERT_NONE_MESSAGE, new Object[] {propertyName});
}
} | java | {
"resource": ""
} |
q157788 | ComponentFactoryImpl.createComponent | train | @SuppressWarnings("unchecked")
public <T extends Component> T createComponent(final String name, final PropertyList properties,
final ComponentList<? extends Component> components) {
Component component;
ComponentFactory factory = getFactory(name);
... | java | {
"resource": ""
} |
q157789 | CalendarBuilder.build | train | public Calendar build(final InputStream in) throws IOException, ParserException {
return build(new InputStreamReader(in, DEFAULT_CHARSET));
} | java | {
"resource": ""
} |
q157790 | CalendarBuilder.build | train | public Calendar build(final UnfoldingReader uin) throws IOException, ParserException {
parser.parse(uin, contentHandler);
return calendar;
} | java | {
"resource": ""
} |
q157791 | DateList.add | train | public final boolean add(final Date date) {
if (!this.isUtc() && this.getTimeZone() == null) {
/* If list hasn't been initialized yet use defaults from the first added date element */
if (date instanceof DateTime) {
DateTime dateTime = (DateTime) date;
if ... | java | {
"resource": ""
} |
q157792 | TimeZoneLoader.loadVTimeZone | train | public VTimeZone loadVTimeZone(String id) throws IOException, ParserException, ParseException {
Validate.notBlank(id, "Invalid TimeZone ID: [%s]", id);
if (!cache.containsId(id)) {
final URL resource = ResourceLoader.getResource(resourcePrefix + id + ".ics");
if (resource != null... | java | {
"resource": ""
} |
q157793 | Calendar.getComponents | train | public final <C extends CalendarComponent> ComponentList<C> getComponents(final String name) {
return getComponents().getComponents(name);
} | java | {
"resource": ""
} |
q157794 | ParameterValidator.assertOneOrLess | train | public void assertOneOrLess(final String paramName,
final ParameterList parameters) throws ValidationException {
if (parameters.getParameters(paramName).size() > 1) {
throw new ValidationException(ASSERT_ONE_OR_LESS_MESSAGE, new Object[] {paramName});
}
} | java | {
"resource": ""
} |
q157795 | ParameterValidator.assertOne | train | public void assertOne(final String paramName,
final ParameterList parameters) throws ValidationException {
if (parameters.getParameters(paramName).size() != 1) {
throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {paramName});
}
} | java | {
"resource": ""
} |
q157796 | ParameterValidator.assertNone | train | public void assertNone(final String paramName, final ParameterList parameters) throws ValidationException {
if (parameters.getParameter(paramName) != null) {
throw new ValidationException(ASSERT_NONE_MESSAGE, new Object[] {paramName});
}
} | java | {
"resource": ""
} |
q157797 | ComponentGroup.calculateRecurrenceSet | train | public PeriodList calculateRecurrenceSet(final Period period) {
PeriodList periods = new PeriodList();
for (Component component : getRevisions()) {
periods = periods.add(component.calculateRecurrenceSet(period));
}
return periods;
} | java | {
"resource": ""
} |
q157798 | Recur.getDates | train | public final DateList getDates(final Date periodStart,
final Date periodEnd, final Value value) {
return getDates(periodStart, periodStart, periodEnd, value, -1);
} | java | {
"resource": ""
} |
q157799 | Recur.getDates | train | public final DateList getDates(final Date seed, final Period period,
final Value value) {
return getDates(seed, period.getStart(), period.getEnd(), value, -1);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.