text:
package it.macisamuele.calendarprovider;

import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.CalendarContract.Calendars;
import android.provider.CalendarContract.Events;
import android.provider.CalendarContract.Instances;
import android.util.Log;
import android.util.Pair;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;

/**
 * Simple interface to communicate with the Google Calendar Provider (into Android).
 * The interface is valid for Android API 14+
 *
 * This interface allows to retrieve information about the events, to modify them,
 * to delete them or to insert a new one.
 *
 * REMARK: in this version is not able to perform any operation with recurrent events
 *
 * The interface is tested for almost any cases, in case of bugs please report into the issue section
 * of the GitHub project.
 *
 * I thank you for the usage of this interface, if you want to give me some suggestions (like useful
 * operations not included) please add it into the pull request section of the GitHub project.
 *
 * GitHub project link: https://github.com/macisamuele/CalendarProvider-Lib
 */
//TODO: manage recurrent events
public class EventInfo implements Comparable<EventInfo> {

    /**
     * Utility factor scale from minute to millisecond
     */
    private static final int MINUTE_IN_MILLISECOND = 60000;

    /**
     * Columns to extract for the correct filling of the EventInfo data structure
     */
    private static final String[] COLUMN = new String[]{
            Instances.EVENT_ID, Instances.CALENDAR_ID, Instances.TITLE, Instances.DESCRIPTION, Instances.START_DAY,
            Instances.START_MINUTE, Instances.END_DAY, Instances.END_MINUTE, Instances.ALL_DAY, Instances.CALENDAR_DISPLAY_NAME,
            Instances.EVENT_LOCATION, Instances.RRULE, Instances.RDATE, Instances.EXRULE, Instances.EXDATE
    };
    /**
     * Default order of the results
     */
    private static final String SELECT_ORDER = Instances.START_DAY + " ASC, " + Instances.START_MINUTE + " ASC, " +
            Instances.END_DAY + " DESC, " + Instances.END_MINUTE + " DESC, " + Instances.TITLE + " ASC";

    protected Long id;
    protected Integer calendarId;
    protected String calendarDisplayName;
    protected String title;
    protected String description;
    protected Date startDate;
    protected Date endDate;
    protected Boolean allDay;
    protected String location;
    protected RecurrenceRule recurrenceRule;

    /**
     * Instantiate an empty EventInfo object
     */
    public EventInfo() {
    }

    /**
     * Extract an EventInfo object from its representation as ContentValues (value extracted querying the Android Content Provider)
     *
     * @param contentValues information extracted from the content provider
     * @return the EventInfo representation of the {@code contentValues}
     * @throws IllegalArgumentException if the {@code contentValues} cannot be parsed to a EventInfo object
     */
    public static EventInfo fromContentValues(ContentValues contentValues) {
        try {
            EventInfo eventInfo = new EventInfo();
            eventInfo.id = contentValues.getAsLong(Instances.EVENT_ID);
            eventInfo.calendarId = contentValues.getAsInteger(Instances.CALENDAR_ID);
            eventInfo.calendarDisplayName = contentValues.getAsString(Instances.CALENDAR_DISPLAY_NAME);
            eventInfo.title = contentValues.getAsString(Instances.TITLE);
            eventInfo.description = contentValues.getAsString(Instances.DESCRIPTION);
            eventInfo.startDate = new Date(JulianDate.toDate(contentValues.getAsLong(Instances.START_DAY)).getTime() + contentValues.getAsInteger(Instances.START_MINUTE) * MINUTE_IN_MILLISECOND);
            eventInfo.endDate = new Date(JulianDate.toDate(contentValues.getAsLong(Instances.END_DAY)).getTime() + contentValues.getAsInteger(Instances.END_MINUTE) * MINUTE_IN_MILLISECOND);
            eventInfo.allDay = contentValues.getAsInteger(Instances.ALL_DAY) == 1;
            eventInfo.location = contentValues.getAsString(Instances.EVENT_LOCATION);
            if (contentValues.getAsString(Instances.RRULE) == null && contentValues.getAsString(Instances.RDATE) == null) {
                eventInfo.recurrenceRule = null;
            } else {
                eventInfo.recurrenceRule = new RecurrenceRule()
                        .setRrule(contentValues.getAsString(Instances.RRULE))
                        .setRdate(contentValues.getAsString(Instances.RDATE))
                        .setExrule(contentValues.getAsString(Instances.EXRULE))
                        .setExdate(contentValues.getAsString(Instances.EXDATE));
            }
            return eventInfo;
        } catch (NullPointerException e) {
            StringBuilder errorString = new StringBuilder();
            StringBuilder missingColumns = new StringBuilder();
            errorString.append("There is NOT all the required parameters in the contentValues\nThe required keys are: ");
            for (String col : COLUMN) {
                errorString.append(col).append(", ");
                if (!contentValues.containsKey(col)) {
                    missingColumns.append(col).append(", ");
                }
            }
            errorString.setLength(errorString.length() - 2);
            if (missingColumns.length() > 0) {
                missingColumns.setLength(missingColumns.length() - 2);
            }
            errorString.append("\n the following columns are missing: ").append(missingColumns);
            throw new IllegalArgumentException(errorString.toString());
        }
    }

    /**
     * Convert a list of {@code ContentValues} to a list of {@code EventInfo}
     *
     * @param contentValuesList collection of {@code ContentValues}
     * @return list of {@code EventInfo} or null if there is at least one {@code ContentValues} which not represent a {@code EventInfo} object
     */
    public static List<EventInfo> contentValuesToList(Collection<ContentValues> contentValuesList) {
        try {
            List<EventInfo> eventInfoList = new ArrayList<>(contentValuesList.size());
            for (ContentValues contentValues : contentValuesList) {
                eventInfoList.add(fromContentValues(contentValues));
            }
            return eventInfoList;
        } catch (IllegalArgumentException e) {
            return null;
        }
    }

    /**
     * Commodity method to generate the correct filter string and arguments list according to the owners and visibility defined
     *
     * @param idCalendars          calendar IDs to filter
     * @param calendarDisplayNames calendar display name to filter
     * @return a {@code Pair} containing as first field the selection string and as second field the selection arguments
     */
    private static Pair<String, String[]> filterOnCalendarIDAndCalendarDisplayName(Collection<Integer> idCalendars, Collection<String> calendarDisplayNames) {
        String selection = null;
        String selectionArgs[] = null;

        if (idCalendars != null && idCalendars.size() == 0) {
            idCalendars = null;
        }
        if (calendarDisplayNames != null && calendarDisplayNames.size() == 0) {
            calendarDisplayNames = null;
        }

        if (idCalendars != null || calendarDisplayNames != null) {
            // selection will look like
            // calendar_id=? OR calendar_id=? OR calendar_displayName=? OR calendar_displayName=?
            StringBuilder builder = new StringBuilder();
            List<String> arguments = new ArrayList<>();
            if (idCalendars != null) {
                for (Integer idCalendar : idCalendars) {
                    builder.append(Instances.CALENDAR_ID).append("=? OR ");
                    arguments.add(idCalendar + "");
                }
                builder.setLength(builder.length() - 4);
            }
            if (calendarDisplayNames != null) {
                for (String calendarDisplayName : calendarDisplayNames) {
                    builder.append(Instances.CALENDAR_DISPLAY_NAME).append("=? OR ");
                    arguments.add(calendarDisplayName);
                }
                builder.setLength(builder.length() - 4);
            }
            selection = builder.toString();
            selectionArgs = arguments.toArray(new String[arguments.size()]);
        }
        return Pair.create(selection, selectionArgs);
    }

    /**
     * Commodity method for the building of the ContentValues object starting from the EventInfo representation
     *
     * @return ContentValues representation of the EventInfo object
     */
    public ContentValues toContentValues() {
        final ContentValues contentValues = new ContentValues(COLUMN.length);
        if (id != null) {
            contentValues.put(Events._ID, id);
        }
        if (calendarId != null) {
            contentValues.put(Events.CALENDAR_ID, calendarId);
        }
        if (calendarDisplayName != null) {
            contentValues.put(Events.CALENDAR_DISPLAY_NAME, calendarDisplayName);
        }
        if (title != null) {
            contentValues.put(Events.TITLE, title);
        }
        if (description != null) {
            contentValues.put(Events.DESCRIPTION, description);
        }
        if (allDay != null && allDay) {
            contentValues.put(Events.ALL_DAY, 1);
            final Calendar calendar = Calendar.getInstance();
            if (startDate != null) {
                calendar.setTime(startDate);
                calendar.set(Calendar.MILLISECOND, 0);
                if (calendar.get(Calendar.HOUR_OF_DAY) != 0 || calendar.get(Calendar.MINUTE) != 0 || calendar.get(Calendar.SECOND) != 0) {
                    calendar.set(Calendar.HOUR_OF_DAY, 0);
                    calendar.set(Calendar.MINUTE, 0);
                    calendar.set(Calendar.SECOND, 0);
                }
                startDate = calendar.getTime();
            }
            if (endDate != null) {
                calendar.setTime(endDate);
                calendar.set(Calendar.MILLISECOND, 0);
                if (calendar.get(Calendar.HOUR_OF_DAY) != 0 || calendar.get(Calendar.MINUTE) != 0 || calendar.get(Calendar.SECOND) != 0) {
                    calendar.set(Calendar.HOUR_OF_DAY, 0);
                    calendar.set(Calendar.MINUTE, 0);
                    calendar.set(Calendar.SECOND, 0);
                    calendar.add(Calendar.DATE, 1);
                }
                endDate = calendar.getTime();
            }
        }
        if (startDate != null) {
            contentValues.put(Events.DTSTART, startDate.getTime());
        }
        if (endDate != null) {
            contentValues.put(Events.DTEND, endDate.getTime());
        }
        if (location != null) {
            contentValues.put(Events.EVENT_LOCATION, location);
        }
        if (recurrenceRule != null) {
            contentValues.putAll(recurrenceRule.toContentValues());
        }
        return contentValues;
    }

    /**
     * Commodity method for the building of the ContentValues object starting from the EventInfo representation.
     * The method will return a ContentValues that will be utilised for the insert of an event
     *
     * @param context application's context
     * @return ContentValues representation of the CalendarInfo object
     */
    private ContentValues toInsertContentValues(Context context) {
        final ContentValues contentValues = toContentValues();
        if (contentValues.containsKey(Events._ID) || contentValues.containsKey(Events.CALENDAR_DISPLAY_NAME)) {
            Log.w(EventInfo.class.getSimpleName(), "TThe EventInfo to insert shouldn't have id and calendarDisplayName defined, they are automatically removed");
            contentValues.remove(Events._ID);
            id = null;
            contentValues.remove(Events.CALENDAR_DISPLAY_NAME);
            calendarDisplayName = null;
        }
        if (isRecurrentEvent()) {
            contentValues.remove(Events.DTEND);
            if (endDate != null) {
                contentValues.put(Events.DURATION, "P" + ((endDate.getTime() - startDate.getTime()) / 1000) + "S");
            }
        }
        if (!contentValues.containsKey(Events.EVENT_TIMEZONE)) {
            String timezone = CalendarInfo.getCompleteInformation(context, calendarId).getAsString(Calendars.CALENDAR_TIME_ZONE);
            if (timezone == null) {
                timezone = TimeZone.getDefault().getDisplayName();
            }
            contentValues.put(Events.EVENT_TIMEZONE, timezone);
        }
        return contentValues;
    }

    /**
     * Select all the filtered events on the provider.
     * The events are filtered according to the time interval defined, to the calendar identifiers and the calendar's display name.
     * The filters will be avoided with a null value for it
     *
     * @param context              application context (needed for the ContentResolver)
     * @param fromDate             lower bound of the time interval
     * @param toDate               upper bound of the time interval
     * @param idCalendars          list of calendar IDs from which extracts events
     * @param calendarDisplayNames list of calendar display name from which extract events
     * @return the list of the events that respects the constraints
     */
    public static List<EventInfo> getEvents(Context context, Date fromDate, Date toDate, Collection<Integer> idCalendars, Collection<String> calendarDisplayNames) {
        final Pair<String, String[]> filter = filterOnCalendarIDAndCalendarDisplayName(idCalendars, calendarDisplayNames);
        Cursor cursor = context.getContentResolver().query(UriBuilder.getUri(fromDate, toDate), COLUMN, filter.first, filter.second, EventInfo.SELECT_ORDER);
        return contentValuesToList(CursorUtils.cursorToContentValuesList(cursor));
    }

    /**
     * Extract the number of the filtered events on the provider.
     * The events are filtered according to the time interval defined, to the calendar identifiers and the calendar's display name.
     * The filters will be avoided with a null value for it
     *
     * @param context              application context (needed for the ContentResolver)
     * @param fromDate             lower bound of the time interval, null to not apply the filter
     * @param toDate               upper bound of the time interval, null to not apply the filter
     * @param idCalendars          list of calendar IDs from which extracts events, null to not apply the filter
     * @param calendarDisplayNames list of calendar display name from which extract events, null to not apply the filter
     * @return the list of the events that respects the constraints
     */
    public static int getCountEvents(Context context, Date fromDate, Date toDate, Collection<Integer> idCalendars, Collection<String> calendarDisplayNames) {
        final Pair<String, String[]> filter = filterOnCalendarIDAndCalendarDisplayName(idCalendars, calendarDisplayNames);
        final Integer count = CursorUtils.getCount(context, UriBuilder.getUri(fromDate, toDate), filter.first, filter.second);
        return count == null ? 0 : count;
    }

    /**
     * Extract all the available events on the provider
     *
     * @param context application context (needed for the ContentResolver)
     * @return list of {@code EventInfo} reachable from the provider
     */
    public static List<EventInfo> getAllEvents(Context context) {
        return getEvents(context, null, null, null, null);
    }

    /**
     * Extract the number of available events on the provider
     *
     * @param context application's context
     * @return the number of events reachable from the context
     */
    public static int getCountAllEvents(Context context) {
        return getCountEvents(context, null, null, null, null);
    }

    /**
     * Extract the complete ContentValues related to the event with identifier set to {@code eventId} stored into the Android Calendar Provider
     *
     * @param context application's context
     * @param eventId identifier of the event
     * @return the complete information of the event, null if there is any event with the defined {@code eventId}
     */
    public static ContentValues getCompleteInformation(Context context, long eventId) {
        return getInformation(context, eventId, (String[]) null);
    }

    /**
     * Extract the columns stored into the Android Calendar Provider for the event identified from {@code eventId}
     *
     * @param context application's context
     * @param eventId identifier of the event
     * @param columns columns to extract, null to extract all columns
     * @return the columns of the event, null if there is any event with the defined {@code eventId}
     */
    public static ContentValues getInformation(Context context, long eventId, Collection<String> columns) {
        return getInformation(context, eventId, columns.toArray(new String[columns.size()]));
    }

    /**
     * Extract the columns stored into the Android Calendar Provider for the event identified from {@code eventId}
     *
     * @param context application's context
     * @param eventId identifier of the event
     * @param columns columns to extract, null to extract all columns
     * @return the columns of the event, null if there is any event with the defined {@code eventId}
     */
    public static ContentValues getInformation(Context context, long eventId, String[] columns) {
        Cursor cursor = context.getContentResolver().query(UriBuilder.getUri(eventId), columns, null, null, null);
        try {
            List<ContentValues> cv = CursorUtils.cursorToContentValuesList(cursor);
            return cv.get(0);
        } catch (NullPointerException | IndexOutOfBoundsException e) {
            return null;
        }
    }

    /**
     * Commodity method to check if the {@code contentValues} has all the required fields to complete successfully the insert
     *
     * @param contentValues ContentValues to insert
     * @return true if the {@code contentValues} has all the needed fields
     */
    private static boolean hasMandatoryInsertField(ContentValues contentValues) {
        return contentValues.containsKey(Events.DTSTART) &&
                contentValues.containsKey(Events.EVENT_TIMEZONE) &&
                contentValues.containsKey(Events.CALENDAR_ID) &&
                (contentValues.containsKey(Events.DTEND) || (contentValues.containsKey(Events.DURATION) &&
                        (contentValues.containsKey(Events.RRULE) || contentValues.containsKey(Events.RDATE))));
    }

    /**
     * Create a new event starting from the information set into the {@code eventInfo}.
     * If the event is correctly added to the Android Calendar Provider then the {@code eventInfo}
     * will be updated with the assigned identifier and displayed name of the event.
     *
     * @param context   application's context
     * @param eventInfo EventInfo representation of the event to create
     * @return true if the event is successfully insert into the Android Calendar Provider
     */
    public static boolean insert(Context context, EventInfo eventInfo) {
        if (eventInfo.isRecurrentEvent()) {  //TODO: manage insertion of recurrent event
            return false;
        }
        final ContentValues contentValues = eventInfo.toInsertContentValues(context);
        if (hasMandatoryInsertField(contentValues)) {
            final Uri uri = context.getContentResolver().insert(UriBuilder.EVENTS_URI, contentValues);
            eventInfo.id = Long.valueOf(uri.getLastPathSegment());
            eventInfo.calendarDisplayName = getInformation(context, eventInfo.id,
                    new String[]{Calendars.CALENDAR_DISPLAY_NAME}).getAsString(Calendars.CALENDAR_DISPLAY_NAME);
            return true;
        }
        return false;
    }

    /**
     * Update the event passed as parameter into the Android Calendar Provider
     *
     * @param context   application's context
     * @param eventInfo EventInfo representation of the information to update into the provider
     * @return true if the event is successfully updated into the Android Calendar Provider
     */
    public static boolean update(Context context, EventInfo eventInfo) {
        return eventInfo.id != null && update(context, eventInfo.id, eventInfo.toContentValues());
    }

    /**
     * Update the field defined in {@code fieldToUpdate} of the event
     *
     * @param context       application's context
     * @param eventInfo     EventInfo representation of the information to update into the provider
     * @param fieldToUpdate field of the event to be updated
     * @return true if the event is successfully updated into the Android Calendar Provider
     */
    public static boolean update(Context context, EventInfo eventInfo, Collection<String> fieldToUpdate) {
        return eventInfo.id != null && update(context, eventInfo.id, eventInfo.toContentValues(), fieldToUpdate);
    }

    /**
     * Update the event identified by the {@code eventId}
     * It is suggested to avoid to use this method only if strictly needed, prefer to use {@link #update(android.content.Context, EventInfo)}
     *
     * @param context       application's context
     * @param eventId       identifier of the event to update
     * @param contentValues contentValues representation of the event
     * @return true if the event is successfully updated into the Android Calendar Provider
     */
    public static boolean update(Context context, long eventId, ContentValues contentValues) {
        if (contentValues.containsKey(Events.RRULE) || contentValues.containsKey(Events.RDATE) || contentValues.containsKey(Events.EXRULE) || contentValues.containsKey(Events.EXDATE)) {
            return false;
        }
        return context.getContentResolver().update(UriBuilder.getUri(eventId), contentValues, null, null) != 0;
    }

    /**
     * Update the field defined in {@code fieldToUpdate} of the event identified by the {@code eventId}
     * It is suggested to avoid to use this method only if strictly needed, prefer to use {@link #update(android.content.Context, EventInfo)}
     *
     * @param context       application's context
     * @param eventId       identifier of the event to update
     * @param contentValues contentValues representation of the event
     * @param fieldToUpdate field of the event to be updated
     * @return true if the event is successfully updated into the Android Calendar Provider
     */
    public static boolean update(Context context, long eventId, ContentValues contentValues, Collection<String> fieldToUpdate) {
        for (String key : contentValues.keySet()) {
            if (!fieldToUpdate.contains(key)) {
                contentValues.remove(key);
            }
        }
        return update(context, eventId, contentValues);
    }

    /**
     * Delete the event identified from {@code eventId}
     *
     * @param context application's context
     * @param eventId identifier of the event
     * @return true if the event is successfully deleted from the Android Calendar Provider
     */
    public static boolean delete(Context context, long eventId) {
        return context.getContentResolver().delete(UriBuilder.getUri(eventId), null, null) != 0;
    }

    /**
     * Extract the identifier of the event
     *
     * @return identifier of the event
     */
    public Long getId() {
        return id;
    }

    /**
     * Set the identifier of the event
     *
     * @param id event identifier
     * @return this EventInfo
     */
    public EventInfo setId(Long id) {
        this.id = id;
        return this;
    }

    /**
     * Extract the identifier of the associated calendar with the event
     *
     * @return identifier of the associated calendar with the event
     */
    public Integer getCalendarId() {
        return calendarId;
    }

    /**
     * Set the identifier of the associated calendar with the event
     *
     * @param calendarId calendar identifier
     * @return this EventInfo
     */
    public EventInfo setCalendarId(Integer calendarId) {
        this.calendarId = calendarId;
        return this;
    }

    /**
     * Extract the displayed name of the calendar associated with the event
     *
     * @return displayed name of the calendar associated with the event
     */
    public String getCalendarDisplayName() {
        return calendarDisplayName;
    }

    /**
     * Set the displayed name of the calendar associated with the event
     *
     * @param calendarDisplayName calendar displayed name
     * @return this EventInfo
     */
    public EventInfo setCalendarDisplayName(String calendarDisplayName) {
        this.calendarDisplayName = calendarDisplayName;
        return this;
    }

    /**
     * Extract the title of the event
     *
     * @return title of the event
     */
    public String getTitle() {
        return title;
    }

    /**
     * Set the title of the event
     *
     * @param title event title
     * @return this EventInfo
     */
    public EventInfo setTitle(String title) {
        this.title = title;
        return this;
    }

    /**
     * Extract the description of the event
     *
     * @return description of the event
     */
    public String getDescription() {
        return description;
    }

    /**
     * Set the description of the event
     *
     * @param description event description
     * @return this EventInfo
     */
    public EventInfo setDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Extract the starting date of the event
     *
     * @return starting date of the event
     */
    public Date getStartDate() {
        return startDate;
    }

    /**
     * Set the starting date of the event
     *
     * @param startDate start instant
     * @return this EventInfo
     */
    public EventInfo setStartDate(Date startDate) {
        this.startDate = startDate;
        return this;
    }

    /**
     * Extract the ending date of the event
     *
     * @return ending date of the event
     */
    public Date getEndDate() {
        return endDate;
    }

    /**
     * Set the ending date of the event
     *
     * @param endDate end instant
     * @return this EventInfo
     */
    public EventInfo setEndDate(Date endDate) {
        this.endDate = endDate;
        return this;
    }

    /**
     * Extract the all day flag of the event
     *
     * @return all day flag of the event
     */
    public Boolean getAllDay() {
        return allDay;
    }

    /**
     * Do the event spans over all the day?
     *
     * @return true if the event is an all day event
     */
    public boolean isAllDayEvent() {
        return allDay != null && allDay;
    }

    /**
     * Set the all day flag to the event
     *
     * @param allDay all day flag
     * @return this EventInfo
     */
    public EventInfo setAllDay(Boolean allDay) {
        this.allDay = allDay;
        return this;
    }

    /**
     * Extract the location of the event
     *
     * @return location of the event
     */
    public String getLocation() {
        return location;
    }

    /**
     * Set the location of the event
     *
     * @param location event location
     * @return this EventInfo
     */
    public EventInfo setLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * Extract the recurrence rule of the event
     *
     * @return recurrence rule of the event
     */
    public RecurrenceRule getRecurrenceRule() {
        return recurrenceRule;
    }

    /**
     * Is the event a recurrent event?
     *
     * @return true if the event is a recurrent event
     */
    public boolean isRecurrentEvent() {
        return recurrenceRule != null && recurrenceRule.isWellDefined();
    }

    /**
     * Set the recurrence rule of the event
     *
     * @param recurrenceRule event recurrence rule
     * @return this EventInfo
     */
    public EventInfo setRecurrenceRule(RecurrenceRule recurrenceRule) {
        this.recurrenceRule = recurrenceRule;
        return this;
    }

    @Override
    public int compareTo(EventInfo another) {
        return id.compareTo(another.id);
    }

    @Override
    public boolean equals(Object o) {
        return o instanceof EventInfo && compareTo((EventInfo) o) == 0;
    }

    @Override
    public String toString() {
        return toContentValues().toString();
    }

    /**
     * Definition of the recurrence rules of an event
     */
    //TODO: this class is just an interface, actually it performs nothing => will be improved adding all the parsing required to manage really the recurrence of the events
    public static class RecurrenceRule {
        protected String rrule;
        protected String rdate;
        protected String exrule;
        protected String exdate;

        /**
         * @return rrule field
         */
        public String getRrule() {
            return rrule;
        }

        /**
         * Set the rrule field
         *
         * @param rrule rrule field
         * @return this RecurrenceRule
         */
        public RecurrenceRule setRrule(String rrule) {
            this.rrule = rrule;
            return this;
        }

        /**
         * @return rdate field
         */
        public String getRdate() {
            return rdate;
        }

        /**
         * Set the rdate field
         *
         * @param rdate rdate field
         * @return this RecurrenceRule
         */
        public RecurrenceRule setRdate(String rdate) {
            this.rdate = rdate;
            return this;
        }

        /**
         * @return exrule field
         */
        public String getExrule() {
            return exrule;
        }

        /**
         * Set the exrule field
         *
         * @param exrule exrule field
         * @return this RecurrenceRule
         */
        public RecurrenceRule setExrule(String exrule) {
            this.exrule = exrule;
            return this;
        }

        /**
         * @return exdate field
         */
        public String getExdate() {
            return exdate;
        }

        /**
         * Set the exdate field
         *
         * @param exdate exdate field
         * @return this RecurrenceRule
         */
        public RecurrenceRule setExdate(String exdate) {
            this.exdate = exdate;
            return this;
        }

        /**
         * Commodity method for the building of the ContentValues object starting from the RecurrenceRule representation
         *
         * @return ContentValues representation of the RecurrenceRule object
         */
        public ContentValues toContentValues() {
            ContentValues contentValues = new ContentValues(4);
            if (rrule != null) {
                contentValues.put(Events.RRULE, rrule);
            }
            if (rdate != null) {
                contentValues.put(Events.RDATE, rdate);
            }
            if (exrule != null) {
                contentValues.put(Events.EXRULE, exrule);
            }
            if (exdate != null) {
                contentValues.put(Events.EXDATE, exdate);
            }
            return contentValues;
        }

        @Override
        public String toString() {
            return toContentValues().toString();
        }

        /**
         * Is the recurrence rule well defined?
         *
         * @return true if the recurrence rule is well defined (the required fields are set)
         */
        public boolean isWellDefined() {
            return rrule != null || rdate != null;
        }
    }

    /**
     * Utility class for URI definition
     */
    private static class UriBuilder {
        static final Uri EVENTS_URI = Events.CONTENT_URI;
        static final Uri INSTANCES_URI = Instances.CONTENT_URI;

        static Uri getUri(long eventId) {
            return ContentUris.withAppendedId(EVENTS_URI, eventId);
        }

        /**
         * @param from_date - first date from which want results, will be considered that date with day granularity, NULL if you don't want any lower bound
         * @param to_date   - last date from which want results, will be considered that date with day granularity, NULL if you don't want any upper bound
         * @return the URI to execute the select to the standard android content provider (Instances table)
         */
        private static Uri getUri(Date from_date, Date to_date) {
            return getUri(from_date != null ? from_date.getTime() : 0, to_date != null ? to_date.getTime() : Long.MAX_VALUE);
        }

        /**
         * @param from_date_time - first date (timestamp) from which want results, will be considered that date with day granularity, NULL if you don't want any lower bound
         * @param to_date_time   - last date (timestamp) from which want results, will be considered that date with day granularity, NULL if you don't want any upper bound
         * @return the URI to execute the select to the standard android content provider (Instances table)
         */
        private static Uri getUri(long from_date_time, long to_date_time) {
            Uri.Builder builder = INSTANCES_URI.buildUpon();
            ContentUris.appendId(builder, from_date_time);
            ContentUris.appendId(builder, to_date_time);
            return builder.build();
        }
    }
}


text:
class PrefService;

namespace policy {
class AutoEnrollmentClient;
}  // namespace policy

namespace chromeos {

class FocusRingController;
class OobeUI;
class WebUILoginDisplay;
class WebUILoginView;

// An implementation class for OOBE/login WebUI screen host.
// It encapsulates controllers, background integration and flow.
class LoginDisplayHostImpl : public LoginDisplayHost,
                             public content::NotificationObserver,
                             public content::WebContentsObserver {
 public:
  explicit LoginDisplayHostImpl(const gfx::Rect& background_bounds);
  virtual ~LoginDisplayHostImpl();

  // Returns the default LoginDispalyHost instance if it has been created.
  static LoginDisplayHost* default_host() {
    return default_host_;
  }

  // LoginDisplayHost implementation:
  virtual LoginDisplay* CreateLoginDisplay(
      LoginDisplay::Delegate* delegate) OVERRIDE;
  virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE;
  virtual WebUILoginView* GetWebUILoginView() const OVERRIDE;
  virtual views::Widget* GetWidget() const OVERRIDE;
  virtual void BeforeSessionStart() OVERRIDE;
  virtual void Finalize() OVERRIDE;
  virtual void OnCompleteLogin() OVERRIDE;
  virtual void OpenProxySettings() OVERRIDE;
  virtual void SetOobeProgressBarVisible(bool visible) OVERRIDE;
  virtual void SetShutdownButtonEnabled(bool enable) OVERRIDE;
  virtual void SetStatusAreaVisible(bool visible) OVERRIDE;
  virtual void CheckForAutoEnrollment() OVERRIDE;
  virtual void StartWizard(
      const std::string& first_screen_name,
      scoped_ptr<DictionaryValue> screen_parameters) OVERRIDE;
  virtual WizardController* GetWizardController() OVERRIDE;
  virtual void StartUserAdding(
      const base::Closure& completion_callback) OVERRIDE;
  virtual void StartSignInScreen() OVERRIDE;
  virtual void ResumeSignInScreen() OVERRIDE;
  virtual void OnPreferencesChanged() OVERRIDE;
  virtual void PrewarmAuthentication() OVERRIDE;

  // Creates WizardController instance.
  WizardController* CreateWizardController();

  // Called when the first browser window is created, but before it's shown.
  void OnBrowserCreated();

  // Returns instance of the OOBE WebUI.
  OobeUI* GetOobeUI() const;

  const gfx::Rect& background_bounds() const { return background_bounds_; }

 protected:
  // content::NotificationObserver implementation:
  virtual void Observe(int type,
                       const content::NotificationSource& source,
                       const content::NotificationDetails& details) OVERRIDE;

  // Overridden from content::WebContentsObserver:
  virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;

 private:
  // Marks display host for deletion.
  // If |post_quit_task| is true also posts Quit task to the MessageLoop.
  void ShutdownDisplayHost(bool post_quit_task);

  // Start sign in transition animation.
  void StartAnimation();

  // Callback for the ownership status check.
  void OnOwnershipStatusCheckDone(DeviceSettingsService::OwnershipStatus status,
                                  bool current_user_is_owner);

  // Callback for completion of the |auto_enrollment_client_|.
  void OnAutoEnrollmentClientDone();

  // Forces auto-enrollment on the appropriate controller.
  void ForceAutoEnrollment();

  // Loads given URL. Creates WebUILoginView if needed.
  void LoadURL(const GURL& url);

  // Shows OOBE/sign in WebUI that was previously initialized in hidden state.
  void ShowWebUI();

  // Starts postponed WebUI (OOBE/sign in) if it was waiting for
  // wallpaper animation end.
  void StartPostponedWebUI();

  // Initializes |login_window_| and |login_view_| fields if needed.
  void InitLoginWindowAndView();

  // Closes |login_window_| and resets |login_window_| and |login_view_| fields.
  void ResetLoginWindowAndView();

  // Returns true if hosr running UI for adding users into session.
  bool IsRunningUserAdding();

  // Deletes |auth_prewarmer_|.
  void OnAuthPrewarmDone();

  // Used to calculate position of the screens and background.
  gfx::Rect background_bounds_;

  content::NotificationRegistrar registrar_;

  base::WeakPtrFactory<LoginDisplayHostImpl> pointer_factory_;

  // Default LoginDisplayHost.
  static LoginDisplayHost* default_host_;

  // Sign in screen controller.
  scoped_ptr<ExistingUserController> sign_in_controller_;

  // OOBE and some screens (camera, recovery) controller.
  scoped_ptr<WizardController> wizard_controller_;

  // Client for enterprise auto-enrollment check.
  scoped_ptr<policy::AutoEnrollmentClient> auto_enrollment_client_;

  // Has ShutdownDisplayHost() already been called?  Used to avoid posting our
  // own deletion to the message loop twice if the user logs out while we're
  // still in the process of cleaning up after login (http://crbug.com/134463).
  bool shutting_down_;

  // Whether progress bar is shown on the OOBE page.
  bool oobe_progress_bar_visible_;

  // True if session start is in progress.
  bool session_starting_;

  // Container of the screen we are displaying.
  views::Widget* login_window_;

  // Container of the view we are displaying.
  WebUILoginView* login_view_;

  // Login display we are using.
  WebUILoginDisplay* webui_login_display_;

  // True if the login display is the current screen.
  bool is_showing_login_;

  // True if NOTIFICATION_WALLPAPER_ANIMATION_FINISHED notification has been
  // received.
  bool is_wallpaper_loaded_;

  // Stores status area current visibility to be applied once login WebUI
  // is shown.
  bool status_area_saved_visibility_;

  // If true, WebUI is initialized in a hidden state and shown after the
  // wallpaper animation is finished (when it is enabled) or the user pods have
  // been loaded (otherwise).
  // By default is true. Could be used to tune performance if needed.
  bool initialize_webui_hidden_;

  // True if WebUI is initialized in hidden state and we're waiting for
  // wallpaper load animation to finish.
  bool waiting_for_wallpaper_load_;

  // True if WebUI is initialized in hidden state and we're waiting for user
  // pods to load.
  bool waiting_for_user_pods_;

  // How many times renderer has crashed.
  int crash_count_;

  // Way to restore if renderer have crashed.
  enum {
    RESTORE_UNKNOWN,
    RESTORE_WIZARD,
    RESTORE_SIGN_IN,
    RESTORE_ADD_USER_INTO_SESSION,
  } restore_path_;

  // Stored parameters for StartWizard, required to restore in case of crash.
  std::string wizard_first_screen_name_;
  scoped_ptr<DictionaryValue> wizard_screen_parameters_;

  // Old value of the ash::internal::kIgnoreSoloWindowFramePainterPolicy
  // property of the root window for |login_window_|.
  bool old_ignore_solo_window_frame_painter_policy_value_;

  // Called before host deletion.
  base::Closure completion_callback_;

  // Active instance of authentication prewarmer.
  scoped_ptr<AuthPrewarmer> auth_prewarmer_;

  // A focus ring controller to draw focus ring around view for keyboard
  // driven oobe.
  scoped_ptr<FocusRingController> focus_ring_controller_;

  DISALLOW_COPY_AND_ASSIGN(LoginDisplayHostImpl);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_DISPLAY_HOST_IMPL_H_

redpajama_set_name: RedPajamaGithub


text:
package com.hazelcast.quorum;

import java.util.EventListener;

/**
 * Listener to get notified when a quorum state is changed
 *
 * IMPORTANT: The term "quorum" simply refers to the count of members in the cluster required for an operation to succeed.
 * It does NOT refer to an implementation of Paxos or Raft protocols as used in many NoSQL and distributed systems.
 * The mechanism it provides in Hazelcast protects the user in case the number of nodes in a cluster drops below the
 * specified one.
 */
public interface QuorumListener extends EventListener {

    /**
     * Called when quorum presence state is changed.
     *
     * @param quorumEvent provides information about quorum presence and current member list.
     */
    void onChange(QuorumEvent quorumEvent);

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace gui_wpf.UI
{
    public class RoutedMovePlayedEventArgs : RoutedEventArgs
    {
        public GoBoardPoint Position { get; set; }
        public Stone StoneColor { get; set; }

        public RoutedMovePlayedEventArgs(RoutedEvent routedEvent, object source, GoBoardPoint pos, Stone stoneColor)
            : base(routedEvent, source)
        {
            Position = pos;
            StoneColor = stoneColor;
        }
    }
}


text:
test('.isPrime()', 2, function () {
	equal(MathLib.isPrime(4567), true);
	equal(MathLib.isPrime(112), false);
});


text:
<?php get_header(); ?>

					<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

					<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">

							<?php the_post_thumbnail( 'wpbs-featured' ); ?>

<?php the_title(); ?>

<?php _e("Posted", "bonestheme"); ?> <time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_date(); ?></time> <?php _e("by", "bonestheme"); ?> <?php the_author_posts_link(); ?> & <?php _e("filed under", "bonestheme"); ?> <?php the_category(', '); ?>.

							<?php the_content(); ?>

							<?php wp_link_pages(); ?>

							<?php the_tags('
' . __("Tags","bonestheme") . ': ', ' ', '
'); ?>

							<?php
							// only show edit button if user has permission to edit posts
							if( $user_level > 0 ) {
							?>
							<a href="<?php echo get_edit_post_link(); ?>" class="btn btn-success edit-post"> <?php _e("Edit post","bonestheme"); ?>
							<?php } ?>

					<?php comments_template('',true); ?>

					<?php endwhile; ?>

					<?php else : ?>

<?php _e("Not Found", "bonestheme"); ?>

<?php _e("Sorry, but the requested resource was not found on this site.", "bonestheme"); ?>

					<?php endif; ?>

				<?php get_sidebar(); // sidebar 1 ?>

			<?php get_footer(); ?>


text:
<?php
$scroll_offset = get_option ( 'eds_scroll_offset', '75' );
?>
<!doctype html>

<meta charset="utf-8">
<title><?php _e( 'Select your Animation Style', 'eds-animate' ); ?>:</title>
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet"
	href="<?php echo plugin_dir_url(__FILE__).'../css/animate-animo.css'; ?>" />
<link rel="stylesheet"
	href="<?php echo plugin_dir_url(__FILE__).'../css/style.css'; ?>" />

			<form name="edsanimate_form" id="edsanimate_form">

							<?php _e( 'Entry', 'eds-animate' ); ?>

							<?php _e( 'Exit', 'eds-animate' ); ?>

							<?php _e( 'Options', 'eds-animate' ); ?>

							<?php _e( 'Animation', 'eds-animate' ); ?>:

								<select id="entry-animation-type" name="entry-animation-type"
									class="full-size">
									<option value="none"><?php _e( 'None', 'eds-animate' ); ?></option>
									<optgroup label="Bouncing Entrances">
										<option value="bounceIn">bounceIn</option>
										<option value="bounceInDown">bounceInDown</option>
										<option value="bounceInLeft">bounceInLeft</option>
										<option value="bounceInRight">bounceInRight</option>
										<option value="bounceInUp">bounceInUp</option>
									</optgroup>
									<optgroup label="Fading Entrances">
										<option value="fadeIn" selected>fadeIn</option>
										<option value="fadeInDown">fadeInDown</option>
										<option value="fadeInDownBig">fadeInDownBig</option>
										<option value="fadeInLeft">fadeInLeft</option>
										<option value="fadeInLeftBig">fadeInLeftBig</option>
										<option value="fadeInRight">fadeInRight</option>
										<option value="fadeInRightBig">fadeInRightBig</option>
										<option value="fadeInUp">fadeInUp</option>
										<option value="fadeInUpBig">fadeInUpBig</option>
									</optgroup>
									<optgroup label="Rotating Entrances">
										<option value="rotateIn">rotateIn</option>
										<option value="rotateInDownLeft">rotateInDownLeft</option>
										<option value="rotateInDownRight">rotateInDownRight</option>
										<option value="rotateInUpLeft">rotateInUpLeft</option>
										<option value="rotateInUpRight">rotateInUpRight</option>
									</optgroup>
									<optgroup label="Sliding Entrances">
										<option value="slideInUp">slideInUp</option>
										<option value="slideInDown">slideInDown</option>
										<option value="slideInLeft">slideInLeft</option>
										<option value="slideInRight">slideInRight</option>
									</optgroup>
									<optgroup label="Zoom Entrances">
										<option value="zoomIn">zoomIn</option>
										<option value="zoomInDown">zoomInDown</option>
										<option value="zoomInLeft">zoomInLeft</option>
										<option value="zoomInRight">zoomInRight</option>
										<option value="zoomInUp">zoomInUp</option>
									</optgroup>
									<optgroup label="Attention Seekers">
										<option value="spinner">Spin</option>
										<option value="bounce">bounce</option>
										<option value="flash">flash</option>
										<option value="rubberBand">rubberBand</option>
										<option value="shake">shake</option>
										<option value="swing">swing</option>
										<option value="tada">tada</option>
										<option value="wobble">wobble</option>
										<option value="jello">jello</option>
										<option value="wiggle">wiggle</option>
										<option value="fade">fade</option>
										<option value="appear">appear</option>
										<option value="grow">grow</option>
										<option value="shrink">shrink</option>
										<option value="push">push</option>
										<option value="pop">pop</option>
										<option value="float">float</option>
										<option value="sink">sink</option>
										<option value="forward">forward</option>
										<option value="backward">backward</option>
									</optgroup>
									<optgroup label="Pulse">
										<option value="pulse">pulse</option>
										<option value="pulseGrow">pulseGrow</option>
										<option value="pulseShrink">pulseShrink</option>
									</optgroup>
									<optgroup label="Rotate">
										<option value="rotate">rotate</option>
										<option value="growRotate">growRotate</option>
									</optgroup>
									<optgroup label="Skew">
										<option value="skew">skew</option>
										<option value="skewForward">skewForward</option>
										<option value="skewBackward">skewBackward</option>
									</optgroup>
									<optgroup label="Wobble">
										<option value="wobbleHorizontal">wobbleHorizontal</option>
										<option value="wobbleVertical">wobbleVertical</option>
										<option value="wobbleToBottomRight">wobbleToBottomRight</option>
										<option value="wobbleToTopRight">wobbleToTopRight</option>
										<option value="wobbleTop">wobbleTop</option>
										<option value="wobbleBottom">wobbleBottom</option>
										<option value="wobbleSkew">wobbleSkew</option>
									</optgroup>
									<optgroup label="Buzz">
										<option value="buzz">buzz</option>
										<option value="buzzOut">buzzOut</option>
									</optgroup>
									<optgroup label="Flippers">
										<option value="flip">flip</option>
										<option value="flipInX">flipInX</option>
										<option value="flipInY">flipInY</option>
									</optgroup>
									<optgroup label="Lightspeed">
										<option value="lightSpeedIn">lightSpeedIn</option>
									</optgroup>
									<optgroup label="Twirl">
										<option value="twirlIn">twirlIn</option>
									</optgroup>
									<optgroup label="Specials">
										<option value="hinge">hinge</option>
										<option value="rollIn">rollIn</option>
									</optgroup>
								</select>

							<?php _e( 'Delay (in seconds)', 'eds-animate' ); ?>:

								<select id="entry-delay" name="entry-delay"
									class="half-size has-custom">
									<option value="0"><?php _e( 'None', 'eds-animate' ); ?></option>
									<option value="0.5">0.5</option>
									<option value="1">1.0</option>
									<option value="1.5">1.5</option>
									<option value="2">2.0</option>
									<option value="2.5">2.5</option>
									<option value="3">3.0</option>
									<option value="3.5">3.5</option>
									<option value="4">4.0</option>
									<option value="4.5">4.5</option>
									<option value="5">5.0</option>
									<option value="5.5">5.5</option>
									<option value="6">6.0</option>
									<option value="custom"><?php _e( 'Custom', 'eds-animate' ); ?></option>
								</select> <input id="entry-delay-custom"
									name="entry-delay-custom" class="half-size custom-field"
									placeholder="Custom Delay e.g. 2.7" />

							<?php _e( 'Duration (in seconds)', 'eds-animate' ); ?>:

								<select id="entry-duration" name="entry-duration"
									class="half-size has-custom">
									<option value="0.5">0.5</option>
									<option value="1">1.0</option>
									<option value="1.5">1.5</option>
									<option value="2">2.0</option>
									<option value="2.5">2.5</option>
									<option value="3">3.0</option>
									<option value="3.5">3.5</option>
									<option value="4">4.0</option>
									<option value="4.5">4.5</option>
									<option value="5">5.0</option>
									<option value="5.5">5.5</option>
									<option value="6">6.0</option>
									<option value="custom"><?php _e( 'Custom', 'eds-animate' ); ?></option>
								</select> <input id="entry-duration-custom"
									name="entry-duration-custom" class="half-size custom-field"
									placeholder="Custom Duration e.g. 3.2" />

							<?php _e( 'Timing', 'eds-animate' ); ?>:

								<select id="entry-timing" name="entry-timing"
									class="half-size">
									<option value="linear">linear</option>
									<option value="ease">ease</option>
									<option value="ease-in">easeIn</option>
									<option value="ease-out">easeOut</option>
									<option value="ease-in-out">easeInOut</option>
									<option value="cubic-bezier(0.47, 0, 0.745, 0.715)">easeInSine</option>
									<option value="cubic-bezier(0.39, 0.575, 0.565, 1)">easeOutSine</option>
									<option value="cubic-bezier(0.445, 0.05, 0.55, 0.95)">easeInOutSine</option>
									<option value="cubic-bezier(0.55, 0.085, 0.68, 0.53)">easeInQuad</option>
									<option value="cubic-bezier(0.25, 0.46, 0.45, 0.94)">easeOutQuad</option>
									<option value="cubic-bezier(0.455, 0.03, 0.515, 0.955)">easeInOutQuad</option>
									<option value="cubic-bezier(0.55, 0.055, 0.675, 0.19)">easeInCubic</option>
									<option value="cubic-bezier(0.215, 0.61, 0.355, 1)">easeOutCubic</option>
									<option value="cubic-bezier(0.645, 0.045, 0.355, 1)">easeInOutCubic</option>
									<option value="cubic-bezier(0.895, 0.03, 0.685, 0.22)">easeInQuart</option>
									<option value="cubic-bezier(0.165, 0.84, 0.44, 1)">easeOutQuart</option>
									<option value="cubic-bezier(0.77, 0, 0.175, 1)">easeInOutQuart</option>
									<option value="cubic-bezier(0.755, 0.05, 0.855, 0.06)">easeInQuint</option>
									<option value="cubic-bezier(0.23, 1, 0.32, 1)">easeOutQuint</option>
									<option value="cubic-bezier(0.86, 0, 0.07, 1)">easeInOutQuint</option>
									<option value="cubic-bezier(0.95, 0.05, 0.795, 0.035)">easeInExpo</option>
									<option value="cubic-bezier(0.19, 1, 0.22, 1)">easeOutExpo</option>
									<option value="cubic-bezier(1, 0, 0, 1)">easeInOutExpo</option>
									<option value="cubic-bezier(0.6, 0.04, 0.98, 0.335)">easeInCirc</option>
									<option value="cubic-bezier(0.075, 0.82, 0.165, 1)">easeOutCirc</option>
									<option value="cubic-bezier(0.785, 0.135, 0.15, 0.86)">easeInOutCirc</option>
									<option value="cubic-bezier(0.6, -0.28, 0.735, 0.045)">easeInBack</option>
									<option value="cubic-bezier(0.175, 0.885, 0.32, 1.275)">easeOutBack</option>
									<option value="cubic-bezier(0.68, -0.55, 0.265, 1.55)">easeInOutBack</option>
								</select>

							<?php _e( 'Animation', 'eds-animate' ); ?>:

								<select id="exit-animation-type" name="exit-animation-type"
									class="full-size">
									<option value="none"><?php _e( 'None', 'eds-animate' ); ?></option>
									<optgroup label="Bouncing Exits">
										<option value="bounceOut">bounceOut</option>
										<option value="bounceOutDown">bounceOutDown</option>
										<option value="bounceOutLeft">bounceOutLeft</option>
										<option value="bounceOutRight">bounceOutRight</option>
										<option value="bounceOutUp">bounceOutUp</option>
									</optgroup>
									<optgroup label="Fading Exits">
										<option value="fadeOut">fadeOut</option>
										<option value="fadeOutDown">fadeOutDown</option>
										<option value="fadeOutDownBig">fadeOutDownBig</option>
										<option value="fadeOutLeft">fadeOutLeft</option>
										<option value="fadeOutLeftBig">fadeOutLeftBig</option>
										<option value="fadeOutRight">fadeOutRight</option>
										<option value="fadeOutRightBig">fadeOutRightBig</option>
										<option value="fadeOutUp">fadeOutUp</option>
										<option value="fadeOutUpBig">fadeOutUpBig</option>
									</optgroup>
									<optgroup label="Rotating Exits">
										<option value="rotateOut">rotateOut</option>
										<option value="rotateOutDownLeft">rotateOutDownLeft</option>
										<option value="rotateOutDownRight">rotateOutDownRight</option>
										<option value="rotateOutUpLeft">rotateOutUpLeft</option>
										<option value="rotateOutUpRight">rotateOutUpRight</option>
									</optgroup>
									<optgroup label="Sliding Exits">
										<option value="slideOutUp">slideOutUp</option>
										<option value="slideOutDown">slideOutDown</option>
										<option value="slideOutLeft">slideOutLeft</option>
										<option value="slideOutRight">slideOutRight</option>
									</optgroup>
									<optgroup label="Zoom Exits">
										<option value="zoomOut">zoomOut</option>
										<option value="zoomOutDown">zoomOutDown</option>
										<option value="zoomOutLeft">zoomOutLeft</option>
										<option value="zoomOutRight">zoomOutRight</option>
										<option value="zoomOutUp">zoomOutUp</option>
									</optgroup>
									<optgroup label="Attention Seekers">
										<option value="spinner">Spin</option>
										<option value="bounce">bounce</option>
										<option value="flash">flash</option>
										<option value="rubberBand">rubberBand</option>
										<option value="shake">shake</option>
										<option value="swing">swing</option>
										<option value="tada">tada</option>
										<option value="wobble">wobble</option>
										<option value="jello">jello</option>
										<option value="wiggle">wiggle</option>
										<option value="fade">fade</option>
										<option value="appear">appear</option>
										<option value="grow">grow</option>
										<option value="shrink">shrink</option>
										<option value="push">push</option>
										<option value="pop">pop</option>
										<option value="float">float</option>
										<option value="sink">sink</option>
										<option value="forward">forward</option>
										<option value="backward">backward</option>
									</optgroup>
									<optgroup label="Pulse">
										<option value="pulse">pulse</option>
										<option value="pulseGrow">pulseGrow</option>
										<option value="pulseShrink">pulseShrink</option>
									</optgroup>
									<optgroup label="Rotate">
										<option value="rotate">rotate</option>
										<option value="growRotate">growRotate</option>
									</optgroup>
									<optgroup label="Skew">
										<option value="skew">skew</option>
										<option value="skewForward">skewForward</option>
										<option value="skewBackward">skewBackward</option>
									</optgroup>
									<optgroup label="Wobble">
										<option value="wobbleHorizontal">wobbleHorizontal</option>
										<option value="wobbleVertical">wobbleVertical</option>
										<option value="wobbleToBottomRight">wobbleToBottomRight</option>
										<option value="wobbleToTopRight">wobbleToTopRight</option>
										<option value="wobbleTop">wobbleTop</option>
										<option value="wobbleBottom">wobbleBottom</option>
										<option value="wobbleSkew">wobbleSkew</option>
									</optgroup>
									<optgroup label="Buzz">
										<option value="buzz">buzz</option>
										<option value="buzzOut">buzzOut</option>
									</optgroup>
									<optgroup label="Flippers">
										<option value="flip">flip</option>
										<option value="flipOutX">flipOutX</option>
										<option value="flipOutY">flipOutY</option>
									</optgroup>
									<optgroup label="Lightspeed">
										<option value="lightSpeedOut">lightSpeedOut</option>
									</optgroup>
									<optgroup label="Twirl">
										<option value="twirlOut">twirlOut</option>
									</optgroup>
									<optgroup label="Specials">
										<option value="hinge">hinge</option>
										<option value="rollOut">rollOut</option>
									</optgroup>
								</select>

							<?php _e( 'Delay (in seconds)', 'eds-animate' ); ?>:

								<select id="exit-delay" name="exit-delay"
									class="half-size has-custom">
									<option value="0"><?php _e( 'None', 'eds-animate' ); ?></option>
									<option value="0.5">0.5</option>
									<option value="1">1.0</option>
									<option value="1.5">1.5</option>
									<option value="2">2.0</option>
									<option value="2.5">2.5</option>
									<option value="3">3.0</option>
									<option value="3.5">3.5</option>
									<option value="4">4.0</option>
									<option value="4.5">4.5</option>
									<option value="5">5.0</option>
									<option value="5.5">5.5</option>
									<option value="6">6.0</option>
									<option value="custom"><?php _e( 'Custom', 'eds-animate' ); ?></option>
								</select> <input id="exit-delay-custom" name="exit-delay-custom"
									class="half-size custom-field"
									placeholder="Custom Delay e.g. 2.7" />

							<?php _e( 'Duration (in seconds)', 'eds-animate' ); ?>:

								<select id="exit-duration" name="exit-duration"
									class="half-size has-custom">
									<option value="0.5">0.5</option>
									<option value="1">1.0</option>
									<option value="1.5">1.5</option>
									<option value="2">2.0</option>
									<option value="2.5">2.5</option>
									<option value="3">3.0</option>
									<option value="3.5">3.5</option>
									<option value="4">4.0</option>
									<option value="4.5">4.5</option>
									<option value="5">5.0</option>
									<option value="5.5">5.5</option>
									<option value="6">6.0</option>
									<option value="custom"><?php _e( 'Custom', 'eds-animate' ); ?></option>
								</select> <input id="exit-duration-custom"
									name="exit-duration-custom" class="half-size custom-field"
									placeholder="Custom Duration e.g. 3.2" />

							<?php _e( 'Timing', 'eds-animate' ); ?>:

								<select id="exit-timing" name="exit-timing"
									class="half-size">
									<option value="linear">linear</option>
									<option value="ease">ease</option>
									<option value="ease-in">easeIn</option>
									<option value="ease-out">easeOut</option>
									<option value="ease-in-out">easeInOut</option>
									<option value="cubic-bezier(0.47, 0, 0.745, 0.715)">easeInSine</option>
									<option value="cubic-bezier(0.39, 0.575, 0.565, 1)">easeOutSine</option>
									<option value="cubic-bezier(0.445, 0.05, 0.55, 0.95)">easeInOutSine</option>
									<option value="cubic-bezier(0.55, 0.085, 0.68, 0.53)">easeInQuad</option>
									<option value="cubic-bezier(0.25, 0.46, 0.45, 0.94)">easeOutQuad</option>
									<option value="cubic-bezier(0.455, 0.03, 0.515, 0.955)">easeInOutQuad</option>
									<option value="cubic-bezier(0.55, 0.055, 0.675, 0.19)">easeInCubic</option>
									<option value="cubic-bezier(0.215, 0.61, 0.355, 1)">easeOutCubic</option>
									<option value="cubic-bezier(0.645, 0.045, 0.355, 1)">easeInOutCubic</option>
									<option value="cubic-bezier(0.895, 0.03, 0.685, 0.22)">easeInQuart</option>
									<option value="cubic-bezier(0.165, 0.84, 0.44, 1)">easeOutQuart</option>
									<option value="cubic-bezier(0.77, 0, 0.175, 1)">easeInOutQuart</option>
									<option value="cubic-bezier(0.755, 0.05, 0.855, 0.06)">easeInQuint</option>
									<option value="cubic-bezier(0.23, 1, 0.32, 1)">easeOutQuint</option>
									<option value="cubic-bezier(0.86, 0, 0.07, 1)">easeInOutQuint</option>
									<option value="cubic-bezier(0.95, 0.05, 0.795, 0.035)">easeInExpo</option>
									<option value="cubic-bezier(0.19, 1, 0.22, 1)">easeOutExpo</option>
									<option value="cubic-bezier(1, 0, 0, 1)">easeInOutExpo</option>
									<option value="cubic-bezier(0.6, 0.04, 0.98, 0.335)">easeInCirc</option>
									<option value="cubic-bezier(0.075, 0.82, 0.165, 1)">easeOutCirc</option>
									<option value="cubic-bezier(0.785, 0.135, 0.15, 0.86)">easeInOutCirc</option>
									<option value="cubic-bezier(0.6, -0.28, 0.735, 0.045)">easeInBack</option>
									<option value="cubic-bezier(0.175, 0.885, 0.32, 1.275)">easeOutBack</option>
									<option value="cubic-bezier(0.68, -0.55, 0.265, 1.55)">easeInOutBack</option>
								</select>

							<?php _e( 'Animation Repeat', 'eds-animate' ); ?>:

								<select id="options-animation-repeat"
									name="options-animation-repeat" class="half-size has-custom">
									<option value="1"><?php _e( 'Once', 'eds-animate' ); ?></option>
									<option value="2"><?php _e( 'Twice', 'eds-animate' ); ?></option>
									<option value="3"><?php _e( 'Thrice', 'eds-animate' ); ?></option>
									<option value="infinite"><?php _e( 'Infinite', 'eds-animate' ); ?></option>
									<option value="custom"><?php _e( 'Custom', 'eds-animate' ); ?></option>
								</select> <input id="options-animation-repeat-custom"
									name="options-animation-repeat-custom"
									class="half-size custom-field" placeholder="e.g. 4" />

							<?php _e( 'Keep Element Final State', 'eds-animate' ); ?>:

								<input id="keep-yes" type="radio" name="options-keep"
									value="yes" checked> <?php _e( 'Yes', 'eds-animate' ); ?> <input
									id="keep-no" type="radio" name="options-keep" value="no"> <?php _e( 'No', 'eds-animate' ); ?>

							<?php _e( 'Custom CSS Class', 'eds-animate' ); ?>:

								<input id="options-custom-css-class"
									name="options-custom-css-class" class="half-size"
									placeholder="" value="" />

							<?php _e( 'Animate On', 'eds-animate' ); ?>:

								<input type="radio" id="on-load" name="options-animate-on"
									value="load" checked> <?php _e( 'Load', 'eds-animate' ); ?> <input
									type="radio" id="on-click" name="options-animate-on"
									value="click"> <?php _e( 'Click', 'eds-animate' ); ?> <input
									type="radio" id="on-hover" name="options-animate-on"
									value="hover"> <?php _e( 'Hover', 'eds-animate' ); ?> <input
									type="radio" id="on-scroll" name="options-animate-on"
									value="scroll"> <?php _e( 'Scroll', 'eds-animate' ); ?>

							<?php _e( 'Scroll Offset (in %)', 'eds-animate' ); ?>:

								<input id="options-scroll-offset" name="options-scroll-offset"
									class="half-size" placeholder="Custom Offset % e.g. 20.7"
									value="<?php echo $scroll_offset; ?>" />

							<?php _e( 'Powered by', 'eds-animate' ); ?> eLEOPARD
							| <?php _e( 'Review Plugin', 'eds-animate' ); ?>
							| <?php _e( 'Documentation', 'eds-animate' ); ?>

							<button type="button" class="btn-stop-infinite-animation"
								style="display: none;"><?php _e( 'Stop Animation', 'eds-animate' ); ?></button>
							<button type="button" class="edsai-animate-it btn-animate-it"><?php _e( 'Animate It!', 'eds-animate' ); ?></button>
							<button type="button" class="edsai-insert btn-insert"><?php _e( 'Insert', 'eds-animate' ); ?></button>

			</form>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>FTCAndroidLibrary: com.lasarobotics.library.util.MathUtil Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

FTCAndroidLibrary

Main Page

Classes

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

com

lasarobotics

library

util

MathUtil

Static Public Member Functions |
List of all members

com.lasarobotics.library.util.MathUtil Class Reference

Static Public Member Functions

static double 	deadband (double deadband, double value)

static Boolean 	equal (double a, double b)

static Boolean 	equal (double a, double b, double distance)

static double 	filter (double value, double lastvalue, double fail)

static double 	coerce (double min, double max, double value)

static boolean 	inBounds (double min, double max, double value)

Detailed Description

Mathematical and Precision Utilities

Member Function Documentation

          static double com.lasarobotics.library.util.MathUtil.coerce
          (
          double
          min,

          double
          max,

          double
          value

          )

static

Forces a numerical value to be between a min and a max

Parameters

min	If less than min, returns min

max	If greater than max, returns max

value	Value to test

Returns

Coerced value

          static double com.lasarobotics.library.util.MathUtil.deadband
          (
          double
          deadband,

          double
          value

          )

static

Gives a "deadzone" where any value less than this would return zero.

Parameters

deadband	Maximum value that returns zero

value	Value to test

Returns

Deadbanded value

          static Boolean com.lasarobotics.library.util.MathUtil.equal
          (
          double
          a,

          double
          b

          )

static

Returns if two double values are equal to within epsilon.

Parameters

a	First value

b	Second value

Returns

True if the values are equal, false otherwise

          static Boolean com.lasarobotics.library.util.MathUtil.equal
          (
          double
          a,

          double
          b,

          double
          distance

          )

static

Returns if two double values are equal to within a distance.

Parameters

a	First value

b	Second value

distance	Maximum distance between a and b

Returns

True if the values are equal ot within distance, false otherwise

          static double com.lasarobotics.library.util.MathUtil.filter
          (
          double
          value,

          double
          lastvalue,

          double
          fail

          )

static

Ignores values equal to the fail value (normally zero).

Parameters

value	Current value

lastvalue	Previous value

fail	Filter this value, normally zero

Returns

Filtered value

          static boolean com.lasarobotics.library.util.MathUtil.inBounds
          (
          double
          min,

          double
          max,

          double
          value

          )

static

Tests if a number is between the bounds, inclusive.

Parameters

min	If less than min, returns false

max	If greater than max, returns false

value	Value to test

Returns

Returns true if value is between (inclusive) min and max, false otherwise.

The documentation for this class was generated from the following file:

ftc-library/src/main/java/com/lasarobotics/library/util/MathUtil.java

<address class="footer">
Generated by

 1.8.10
</address>


text:
<?php

/**
 * @category   Payment Gateway
 * @package    Adyen_Payment
 * @author     Adyen
 * @property   Adyen B.V
 * @copyright  Copyright (c) 2014 Adyen BV (http://www.adyen.com)
 */
class Adyen_Payment_Adminhtml_ExportAdyenSettingsController extends Mage_Adminhtml_Controller_Action {

    public function indexAction()
    {
        // get all adyen settings
        $path = "payment/adyen_";
        $collection = Mage::getModel('core/config_data')->getCollection()
            ->addFieldToFilter('path', array('like' => '%'.$path.'%' ));

        $xml_contents = "<root>";

        // to array
        $list = array();
        if ($collection->getSize() > 0) {
            foreach ($collection as $configItem) {

                $path = $configItem->getPath();
                $value = $configItem->getValue();
                $scope = $configItem->getScope();
                $scopeId = "ScopeId" . $configItem->getScopeId();

                // path to array
                $pathArray = explode("/",$path);
                $root = $pathArray[0];
                $paymentMethod = $pathArray[1];
                $node = $pathArray[2];

                // some settings are encoded decode this
                if($node == "notification_password" || $node == "ws_password_test" || $node == "ws_password_live") {
                    $value = Mage::helper('core')->decrypt($value);
                }
                $list[$scope][$scopeId][$root][$paymentMethod][$node] = $value;
            }
        }

        $xml = new SimpleXMLElement('<root/>');
        $xml->formatOutput = true;

        // function call to convert array to xml
        $this->_arrayToXml($list,$xml);

        // export to xml
        $contentType = "application/xml";
        $fileName = "AdyenSettings.xml";

        $content = $xml->asXML();
        $contentLength = "";

        $this->getResponse()
            ->setHttpResponseCode(200)
            ->setHeader('Pragma', 'public', true)
            ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
            ->setHeader('Content-type', $contentType, true)
//            ->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength, true)
            ->setHeader('Content-Disposition', 'attachment; filename="'.$fileName.'"', true)
            ->setHeader('Last-Modified', date('r'), true);

        $this->getResponse()->setBody($content);
        return $this;
    }

    // function defination to convert array to xml
    protected function _arrayToXml($array_o, &$xml) {
        foreach($array_o as $key => $value) {
            if(is_array($value)) {
                if(!is_numeric($key)){
                    $subnode = $xml->addChild("$key");
                    $this->_arrayToXml($value, $subnode);
                }
                else{
                    $subnode = $xml->addChild("item$key");
                    $this->_arrayToXml($value, $subnode);
                }
            }
            else {
                $xml->addChild("$key",htmlspecialchars("$value"));
            }
        }
    }

    /**
     * @return bool
     */
    protected function _isAllowed()
    {
        return Mage::getSingleton('admin/session')->isAllowed('system/config/payment');
    }

}


text:
package programmerguide.drawingimages.drawimagesusingcorefunctionality.java;

import com.aspose.imaging.RasterImage;

public class DrawImagesUsingCoreFunctionality
{
    public static void main(String[] args) throws Exception
    {
        // The path to the documents directory.
        String dataDir = "src/programmerguide/drawingimages/drawimagesusingcorefunctionality/data/";

        //Create an instance of BmpCreateOptions and set its various properties
        com.aspose.imaging.imageoptions.BmpOptions createOptions = new com.aspose.imaging.imageoptions.BmpOptions();
        createOptions.setBitsPerPixel(24);

        //Create an instance of FileCreateSource and assign it to Source property
        createOptions.setSource(new com.aspose.imaging.sources.FileCreateSource(dataDir + "sample.bmp",false));

        //Create an instance of RasterImage
        RasterImage rasterImage = (RasterImage) RasterImage.create(createOptions, 500, 500);

        //Get the pixels of the image by specifying the area as image boundary
        com.aspose.imaging.Color [] pixels = rasterImage.loadPixels(rasterImage.getBounds());

        for (int index = 0; index < pixels.length; index++)
        {
            //Set the indexed pixel color to yellow
            pixels[index] =  com.aspose.imaging.Color.getYellow();
        }
        rasterImage.savePixels(rasterImage.getBounds(), pixels);

        // Save processed image.
        rasterImage.save();

        // Display Status.
        System.out.println("Processing completed successfully!");
    }
}