Java 类javax.annotation.Nonnegative 实例源码

项目:TakinRPC    文件:DefaultRaftLog.java   
public void updateCurrentTerm(@Nonnegative long term) {

        checkArgument(term >= 0);

        MDC.put("term", Long.toString(term));
        LOGGER.debug("New term {}", term);

        setCurrentTerm(term);

        try {
            LogProto.JournalEntry entry = LogProto.JournalEntry.newBuilder().setTerm(LogProto.Term.newBuilder().setTerm(term)).build();
            journal.write(entry.toByteArray(), WriteType.SYNC);
        } catch (IOException e) {
            Throwables.propagate(e);
        }
    }
项目:MyCalendar    文件:DBHelper.java   
/**
 * @param teacher_id   Integer
 * @param teacher_name String
 * @return Teacher
 * @throws NullObjectException if connect database fail or not found teacher
 */
public Teacher getTeacher(@Nonnegative Integer teacher_id, String teacher_name) throws NullObjectException {
    SQLiteDatabase db;
    try {
        db = this.getReadableDatabase();
    } catch (SQLiteException e) {
        Log.d(TAG, "getTeacher error: " + e.toString());
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.CONNECT_FAIL));
    }

    String query;
    if (teacher_id != null) {
        query = "SELECT * FROM " + TABLE_TEACHER + " WHERE " + Teacher_ID + " = " + teacher_id;
    } else if (teacher_name != null) {
        query = "SELECT * FROM " + TABLE_TEACHER + " WHERE " + Teacher_Name + " = " + "'" + teacher_name + "'";
    } else {
        Log.d(TAG, "getTeacher error: Not found teacher");
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.NOT_FOUND_TEACHER));
    }
    return getTeacherByQuery(query, db);
}
项目:MyCalendar    文件:DBHelper.java   
/**
 * Delete a teacher
 *
 * @param teacher_id id of teacher
 * @return DATABASE_CODE
 */
public DATABASE_CODE deleteTeacher(@Nonnegative int teacher_id) {
    SQLiteDatabase db;
    try {
        db = this.getWritableDatabase();
    } catch (SQLiteException e) {
        Log.d(TAG, "deleteTeacher error: " + e.toString());
        return DATABASE_CODE.CONNECT_FAIL;
    }

    String whereClause = Teacher_ID + " = " + teacher_id;

    if (db.delete(TABLE_TEACHER, whereClause, null) != 0) {
        Log.d(TAG, "deleteTeacher success");
        return DATABASE_CODE.DELETE_TEACHER_SUCCESS;
    }
    Log.d(TAG, "deleteTeacher error");
    return DATABASE_CODE.DELETE_TEACHER_FAIL;
}
项目:MyCalendar    文件:DBHelper.java   
/**
 * @param subject_id   Integer
 * @param subject_name String
 * @return Subject
 * @throws NullObjectException if connect to database fail or not found subject
 */
public Subject getSubject(@Nonnegative @Nullable Integer subject_id, @Nullable String subject_name) throws NullObjectException {
    SQLiteDatabase db;
    try {
        db = this.getReadableDatabase();
    } catch (SQLiteException e) {
        Log.d(TAG, "getSubject error:" + e.toString());
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.CONNECT_FAIL));
    }

    String query;
    if (subject_id != null) {
        query = "SELECT * FROM " + TABLE_SUBJECTS + " WHERE " + Subjects_ID + " = " + subject_id;
    } else if (subject_name != null) {
        query = "SELECT * FROM " + TABLE_SUBJECTS + " WHERE " + Subjects_Name + " = '" + subject_name + "'";
    } else {
        Log.d(TAG, "getSubject error: Not found subject");
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.NOT_FOUND_SUBJECT));
    }
    return getSubjectByQuery(query, db);
}
项目:MyCalendar    文件:DBHelper.java   
/**
 * Delete a subject
 *
 * @param subject_id subject id
 * @return DATABASE_CODE
 */
public DATABASE_CODE deleteSubject(@Nonnegative int subject_id) {
    SQLiteDatabase db;
    try {
        db = this.getWritableDatabase();
    } catch (SQLiteException e) {
        Log.d(TAG, "deleteSubject error: " + e.toString());
        return DATABASE_CODE.CONNECT_FAIL;
    }

    String whereClause = Subjects_ID + " = " + subject_id;

    if (db.delete(TABLE_SUBJECTS, whereClause, null) != 0) {
        Log.d(TAG, "deleteSubject success");
        return DATABASE_CODE.DELETE_SUBJECT_SUCCESS;
    }
    Log.d(TAG, "deleteSubject error");
    return DATABASE_CODE.DELETE_SUBJECT_FAIL;
}
项目:MyCalendar    文件:DBHelper.java   
/**
 * @param repeat_id   Integer
 * @param repeat_name String
 * @return Repeat
 * @throws NullObjectException if connect to database fail or not found repeat
 */
public Repeat getRepeat(@Nonnegative Integer repeat_id, String repeat_name) throws NullObjectException {
    SQLiteDatabase db;
    try {
        db = this.getReadableDatabase();
    } catch (SQLiteException e) {
        Log.d(TAG, "getRepeat error: " + e.toString());
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.CONNECT_FAIL));
    }
    String query;
    if (repeat_id != null) {
        query = "SELECT *  FROM " + TABLE_REPEAT + " WHERE " + Repeat_ID + " = " + repeat_id;
    } else if (repeat_name != null) {
        query = "SELECT *  FROM " + TABLE_REPEAT + " WHERE " + Repeat_Name + " = '" + repeat_name + "'";
    } else {
        Log.d(TAG, "getRepeat error: Not found repeat");
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.NOT_FOUND_REPEAT));
    }
    return getRepeatByQuery(query, db);
}
项目:MyCalendar    文件:DBHelper.java   
/**
 * @param location_id   Integer
 * @param location_name Integer
 * @return Location
 * @throws NullObjectException if connect to database fail or not found location
 */
public Location getLocation(@Nonnegative Integer location_id, String location_name) throws NullObjectException {
    SQLiteDatabase db;
    try {
        db = this.getReadableDatabase();
    } catch (SQLiteException e) {
        Log.d(TAG, "getLocation error: " + e.toString());
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.CONNECT_FAIL));
    }

    String selectQuery;
    if (location_id != null) {
        selectQuery = "SELECT *  FROM " + TABLE_LOCATION + " WHERE " + Location_ID + " = " + location_id;
    } else if (location_name != null) {
        selectQuery = "SELECT *  FROM " + TABLE_LOCATION + " WHERE " + Location_Name + " = '" + location_name + "'";
    } else {
        Log.d(TAG, "getLocation error: Not found location");
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.NOT_FOUND_LOCATION));
    }
    return getLocationByQuery(selectQuery, db);
}
项目:MyCalendar    文件:DBHelper.java   
/**
 * @param location_id location_id
 * @return {@link DATABASE_CODE#CONNECT_FAIL},{@link DATABASE_CODE#DELETE_LOCATION_SUCCESS},{@link DATABASE_CODE#DELETE_LOCATION_FAIL}
 */
public DATABASE_CODE deleteLocation(@Nonnegative int location_id) {
    SQLiteDatabase db;
    try {
        db = this.getWritableDatabase();
    } catch (SQLiteException e) {
        Log.d(TAG, "deleteLocation error: " + e.toString());
        return DATABASE_CODE.CONNECT_FAIL;
    }

    String whereClause = Location_ID + " = " + location_id;

    //Deleting a record
    if (db.delete(TABLE_LOCATION, whereClause, null) != 0) {
        Log.d(TAG, "deleteLocation success");
        return DATABASE_CODE.DELETE_LOCATION_SUCCESS;
    }
    Log.d(TAG, "deleteLocation error");
    return DATABASE_CODE.DELETE_LOCATION_FAIL;
}
项目:MyCalendar    文件:EventParent.java   
public EventParent(int event_parent_id, int repeat_id, @Nonnegative int event_parent_day_start, @Nonnegative int event_parent_day_end) {
    if (event_parent_id > 0) {
        this.event_parent_id = event_parent_id;
    } else {
        this.event_parent_id = Constant.INT_NONE_VALUE;
    }
    if (repeat_id > 0) {
        this.repeat_id = repeat_id;
    } else {
        this.repeat_id = Constant.INT_NONE_VALUE;
    }
    if (event_parent_day_start >= 0) {
        this.event_parent_day_start = event_parent_day_start;
    } else {
        this.event_parent_day_start = 0;
    }
    if (event_parent_day_end >= this.event_parent_day_start) {
        this.event_parent_day_end = event_parent_day_end;
    } else {
        this.event_parent_day_end = this.event_parent_day_start;
    }
}
项目:MyCalendar    文件:WeekLesson.java   
/**
 * Full params constructor
 */
public WeekLesson(int week_lesson_id, @Nonnull String subject_id, int repeat_id, @Nonnegative int week_lesson_day_start,
                  @Nonnegative int week_lesson_day_end, @Nonnegative int week_lesson_day_index) {
    if (week_lesson_id > 0) {
        this.week_lesson_id = week_lesson_id;
    } else {
        this.week_lesson_id = Constant.INT_NONE_VALUE;
    }
    this.subject_id = subject_id;
    if (repeat_id > 0) {
        this.repeat_id = repeat_id;
    } else {
        this.repeat_id = Constant.INT_NONE_VALUE;
    }
    if (week_lesson_day_start >= 0) {
        this.week_lesson_day_start = week_lesson_day_start;
    }else {
        this.week_lesson_day_start = 0;
    }
    if (!(week_lesson_day_end >= this.week_lesson_day_start)) {
        this.week_lesson_day_end = week_lesson_day_end;
    }else {
        this.week_lesson_day_end = this.week_lesson_day_start;
    }
    if (week_lesson_day_index >= Calendar.SUNDAY && week_lesson_day_index <= Calendar.SATURDAY) {
        this.week_lesson_day_index = week_lesson_day_index;
    }
}
项目:MyCalendar    文件:Event.java   
public Event(long event_id, @Nullable Integer location_id, int event_parent_id, @Nonnull String event_tittle, @Nonnull String event_content,
             int event_text_color, int event_background_color, @Nonnegative int event_ts_start, @Nonnegative int event_ts_end,
             @Nonnegative int event_ts_remind, @Nonnull EventType event_type, @Nonnull EventStatus event_status,
             @Nonnull String event_status_reason_change, @Nonnull String event_account_sync) {
    super(event_id, location_id, event_tittle, event_content, event_text_color, event_background_color, event_ts_start, event_ts_end, event_ts_remind,
            event_status, event_status_reason_change, event_type, String.valueOf(Constant.INT_NONE_VALUE));
    if (event_parent_id > 0) {
        String parent_id = String.valueOf(event_parent_id);
        setDraw_item_parent_id(parent_id);
    }
    if(!EventType.isEventNormal(event_type)){
        setDraw_item_type(EventType.EVENT,this);
    }
    this.event_account_sync = event_account_sync;
}
项目:MyCalendar    文件:Subject.java   
/**
 * Full params constructor to get item from database
 */
public Subject(@Nonnull String subject_id, @Nullable String teacher_id, @Nonnull String subject_name, int subject_text_color,
               int subject_background_color, @Nonnegative int subject_day_start, @Nonnegative int subject_day_end,
               @Nonnull String subject_content, @Nonnull String subject_background) {
    this.subject_id = subject_id;
    this.teacher_id = teacher_id;
    this.subject_name = subject_name;
    this.subject_text_color = subject_text_color;
    this.subject_background_color = subject_background_color;
    if (subject_day_start >= 0) {
        this.subject_day_start = subject_day_start;
    } else {
        this.subject_day_start = 0;
    }
    if (subject_day_end >= this.subject_day_start) {
        this.subject_day_end = subject_day_end;
    } else {
        this.subject_day_end = this.subject_day_start;
    }
    this.subject_content = subject_content;
    this.subject_background = subject_background;
}
项目:shamir    文件:Scheme.java   
/**
 * Creates a new {@link Scheme} instance.
 *
 * @param n the number of parts to produce (must be {@code >1})
 * @param k the threshold of joinable parts (must be {@code <= n})
 * @return an {@code N}/{@code K} {@link Scheme}
 */
@CheckReturnValue
public static Scheme of(@Nonnegative int n, @Nonnegative int k) {
  checkArgument(k > 1, "K must be > 1");
  checkArgument(n >= k, "N must be >= K");
  checkArgument(n <= 255, "N must be <= 255");
  return new AutoValue_Scheme(n, k);
}
项目:arez    文件:ActionCompletedEvent.java   
public ActionCompletedEvent( @Nonnull final String name,
                             final boolean tracked,
                             @Nonnull final Object[] parameters,
                             final boolean returnsResult,
                             @Nullable final Object result,
                             @Nullable final Throwable throwable,
                             @Nonnegative final long duration )
{
  assert duration >= 0;
  assert null == throwable || null == result;
  _name = Objects.requireNonNull( name );
  _tracked = tracked;
  _parameters = Objects.requireNonNull( parameters );
  _returnsResult = returnsResult;
  _result = result;
  _throwable = throwable;
  _duration = duration;
}
项目:GitHub    文件:Repositories.java   
protected final FluentFuture<List<T>> doFetch(
    final @Nullable Constraints.ConstraintHost criteria,
    final Constraints.Constraint ordering,
    final Constraints.Constraint exclusion,
    final @Nonnegative int skip,
    final @Nonnegative int limit) {
  return submit(new Callable<List<T>>() {
    @SuppressWarnings("resource")
    @Override
    public List<T> call() throws Exception {
      @Nullable Bson query = criteria != null ? convertToBson(criteria) : null;

      FindIterable<T> cursor = collection().find(query);

      if (!exclusion.isNil()) {
        cursor.projection(convertToBson(exclusion));
      }

      if (!ordering.isNil()) {
        cursor.sort(convertToBson(ordering));
      }

      cursor.skip(skip);

      if (limit != 0) {
        cursor.limit(limit);
        if (limit <= LARGE_BATCH_SIZE) {
          // if limit specified and is smaller than reasonable large batch size
          // then we force batch size to be the same as limit,
          // but negative, this force cursor to close right after result is sent
          cursor.batchSize(-limit);
        }
      }

      return ImmutableList.copyOf(cursor);
    }
  });
}
项目:GitHub    文件:Repositories.java   
/**
 * Configures finder to skip a number of document. Useful for results pagination in
 * conjunction with {@link #fetchWithLimit(int) limiting}
 * @param numberToSkip number of documents to skip.
 * @return {@code this} finder for chained invocation
 */
// safe unchecked: we expect F to be a self type
@SuppressWarnings("unchecked")
public F skip(@Nonnegative int numberToSkip) {
  checkArgument(numberToSkip >= 0, "number to skip cannot be negative");
  this.numberToSkip = numberToSkip;
  return (F) this;
}
项目:TakinRPC    文件:Leader.java   
@Inject
Leader(RaftLog log, @RaftScheduler ScheduledExecutorService scheduler, @ElectionTimeout @Nonnegative long timeout, ReplicaManagerFactory replicaManagerFactory) {

    this.log = checkNotNull(log);
    this.scheduler = checkNotNull(scheduler);
    checkArgument(timeout > 0);
    this.timeout = timeout;
    this.replicaManagerFactory = checkNotNull(replicaManagerFactory);
}
项目:TakinRPC    文件:Follower.java   
@Inject
Follower(RaftLog log, @RaftScheduler ScheduledExecutorService scheduler, @ElectionTimeout @Nonnegative long timeout) {

    this.log = checkNotNull(log);
    this.scheduler = checkNotNull(scheduler);
    checkArgument(timeout >= 0);
    this.timeout = timeout;

}
项目:TakinRPC    文件:DefaultRaftLog.java   
@Nonnull
public GetEntriesResult getEntriesFrom(@Nonnegative long beginningIndex, @Nonnegative int max) {
    checkArgument(beginningIndex >= 0);
    Set<Long> indices = entryIndex.tailMap(beginningIndex).keySet();
    Iterable<Entry> values = Iterables.transform(Iterables.limit(indices, max), entryCache);
    Entry previousEntry;
    if (beginningIndex - 1 <= 0) {
        previousEntry = SENTINEL_ENTRY;
    } else {
        previousEntry = entryCache.getUnchecked(beginningIndex - 1);
    }
    GetEntriesResult result = new GetEntriesResult(previousEntry.getTerm(), beginningIndex - 1, newArrayList(values));
    LOGGER.debug("{}", result);
    return result;
}
项目:arez    文件:TestSpyEventHandler.java   
/**
 * Assert Event at index is of specific type and return it.
 */
@Nonnull
<T> T assertEvent( @Nonnull final Class<T> type, @Nonnegative final int index )
{
  assertTrue( eventCount() > index );
  final Object event = _events.get( index );
  assertTrue( type.isInstance( event ),
              "Expected event at index " + index + " to be of type " + type + " but is " +
              " of type " + event.getClass() + " with value " + event );
  return type.cast( event );
}
项目:MyCalendar    文件:WeekViewFragment.java   
public static int getMinuteByY(@Nonnegative float y) {
    if (y < 0) return 0;

    float hour = getHourByY(y);
    int minutes = (int) (hour * Constant.MINUTE_IN_HOUR);

    if (minutes > MAX_MINUTE_DAY) {
        minutes = MAX_MINUTE_DAY;
    }
    return minutes;
}
项目:MyCalendar    文件:WeekViewFragment.java   
private void checkScrollLimits(@Nonnegative int y) {

        if (mMinScrollY != Constant.INT_NONE_VALUE && y < mMinScrollY) {
            mView_EventScrollView.setScrollY(mMinScrollY);
        } else if (mMaxScrollY != Constant.INT_NONE_VALUE && y > mMaxScrollY) {
            mView_EventScrollView.setScrollY(mMaxScrollY);
        } else {
            if (isFragmentVisible)
                if (mWeekScrollListener != null) {
                    mWeekScrollListener.scrollTo(y);
                }
        }
    }
项目:MyCalendar    文件:WeekViewFragment.java   
public static int[] roundMinutes(@Nonnegative int minutes_start, @Nonnegative int minutes_end) {
    int divisible = minutes_start / MINUTE_ROUND;
    int surplus = minutes_start % MINUTE_ROUND;
    if (surplus > MINUTE_ROUND / 2) {
        divisible++;
    }
    int new_start = divisible * MINUTE_ROUND;
    int diff = new_start - minutes_start;
    minutes_end += diff;

    return new int[]{new_start, minutes_end};
}
项目:MyCalendar    文件:DBHelper.java   
/**
 * @param subject_id   Integer
 * @param subject_name String
 * @param db           SQLiteDatabase
 * @return Subject
 * @throws NullObjectException if not found subject
 */
private Subject getSubjectWithDB(@Nonnegative @Nullable Integer subject_id, @Nullable String subject_name, @NonNull SQLiteDatabase db) throws NullObjectException {

    String query;
    if (subject_id != null) {
        query = "SELECT * FROM " + TABLE_SUBJECTS + " WHERE " + Subjects_ID + " = " + subject_id;
    } else if (subject_name != null) {
        query = "SELECT * FROM " + TABLE_SUBJECTS + " WHERE " + Subjects_Name + " = '" + subject_name + "'";
    } else {
        Log.d(TAG, "getSubjectWithDB error: Not found subject");
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.NOT_FOUND_SUBJECT));
    }
    return getSubjectByQuery(query, db);
}
项目:MyCalendar    文件:DBHelper.java   
/**
 * @param repeat_id   Integer
 * @param repeat_name String
 * @param db          SQLiteDatabase
 * @return Repeat
 * @throws NullObjectException if not found repeat
 */
private Repeat getRepeatWithDB(@Nonnegative Integer repeat_id, String repeat_name, SQLiteDatabase db) throws NullObjectException {

    String query;
    if (repeat_id != null) {
        query = "SELECT *  FROM " + TABLE_REPEAT + " WHERE " + Repeat_ID + " = " + repeat_id;
    } else if (repeat_name != null) {
        query = "SELECT *  FROM " + TABLE_REPEAT + " WHERE " + Repeat_Name + " = '" + repeat_name + "'";
    } else {
        Log.d(TAG, "getRepeat error: Not found repeat");
        throw new NullObjectException(mDBStringHelper.getDBString(DATABASE_CODE.NOT_FOUND_REPEAT));
    }
    return getRepeatByQuery(query, db);
}
项目:MyCalendar    文件:DrawItem.java   
/**
 * Full params constructor
 */
public DrawItem(long draw_item_id, @Nullable Integer location_id, @Nonnull String draw_item_title, @Nonnull String draw_item_content,
                int draw_item_text_color, int draw_item_background_color, @Nonnegative int draw_item_time_star, @Nonnegative int draw_item_time_end,
                @Nonnegative int draw_item_time_remind, @Nonnull EventStatus draw_item_status, @Nonnull String draw_item_status_reason_change,
                @Nonnull EventType draw_item_type, @Nonnull String draw_item_parent_id) {
    if (draw_item_id > 0) {
        this.draw_item_id = draw_item_id;
    } else {
        this.draw_item_id = Constant.INT_NONE_VALUE;
    }
    this.location_id = location_id;
    this.draw_item_title = draw_item_title;
    this.draw_item_content = draw_item_content;
    this.draw_item_text_color = draw_item_text_color;
    this.draw_item_background_color = draw_item_background_color;
    if (draw_item_time_star > 0) {
        this.draw_item_time_star = draw_item_time_star;
    } else {
        this.draw_item_time_star = 0;
    }
    if (!(draw_item_time_end >= this.draw_item_time_star + Setting.getMinEventLengthTS())) {
        this.draw_item_time_end = draw_item_time_end;
    } else {
        this.draw_item_time_end = this.draw_item_time_star + Setting.getMinEventLengthTS();
    }
    if (draw_item_time_remind >= 0) {
        this.draw_item_time_remind = draw_item_time_remind;
    } else {
        this.draw_item_time_remind = 0;
    }
    this.draw_item_status = draw_item_status;
    this.draw_item_status_reason_change = draw_item_status_reason_change;
    this.draw_item_is_all_day = DateTimeHelper.getTimeDiff(this.draw_item_time_star, this.draw_item_time_end, TimeUnit.SECONDS) >= Setting.getAllDayEventTS();
    this.draw_item_type = draw_item_type;
    this.draw_item_parent_id = draw_item_parent_id;
}
项目:MyCalendar    文件:EventParent.java   
public void setEvent_parent_day_start(@Nonnegative int event_parent_day_start) {
    if (event_parent_day_start >= 0) {
        this.event_parent_day_start = event_parent_day_start;
        if (!(this.event_parent_day_end >= this.event_parent_day_start)) {
            this.event_parent_day_end = this.event_parent_day_start;
        }
    }
}
项目:MyCalendar    文件:WeekLesson.java   
public void setWeek_lesson_day_start(@Nonnegative int week_lesson_day_start) {
    if (week_lesson_day_start >= 0) {
        this.week_lesson_day_start = week_lesson_day_start;
        if (!(this.week_lesson_day_end >= this.week_lesson_day_start)) {
            this.week_lesson_day_end = this.week_lesson_day_start;
        }
    }
}
项目:MyCalendar    文件:DayLesson.java   
/**
 * Full params constructor to get item from database
 */

public DayLesson(long day_lesson_id, int week_lesson_id, @Nullable Integer location_id, @Nonnegative int day_lesson_time_start,
                 @Nonnegative int day_lesson_time_end, @Nonnull EventStatus day_lesson_status, @Nonnull String day_lesson_status_reason_change,
                 @Nonnegative int day_lesson_remind, @Nonnull String day_lesson_title, @Nonnull String day_lesson_content, int day_lesson_text_color,
                 int day_lesson_background_color) {

    super(day_lesson_id, location_id, day_lesson_title, day_lesson_content, day_lesson_text_color, day_lesson_background_color, day_lesson_time_start,
            day_lesson_time_end, day_lesson_remind, day_lesson_status, day_lesson_status_reason_change, EventType.DAY_LESSON, String.valueOf(Constant.INT_NONE_VALUE));
    if (week_lesson_id > 0) {
        String parent_id = String.valueOf(week_lesson_id);
        setDraw_item_parent_id(parent_id);
    }
}
项目:MyCalendar    文件:DayLesson.java   
public DayLesson(long day_lesson_id, int week_lesson_id, @Nullable Integer location_id, @Nonnegative int day_lesson_time_start,
                 @Nonnegative int day_lesson_time_end, @Nonnull EventStatus day_lesson_status, @Nonnull String day_lesson_status_reason_change,
                 @Nonnegative int day_lesson_remind) {
    this(day_lesson_id, week_lesson_id, location_id, day_lesson_time_start, day_lesson_time_end, day_lesson_status, day_lesson_status_reason_change,
            day_lesson_remind, Constant.STRING_EMPTY, Constant.STRING_EMPTY, 0, 0);

}
项目:MyCalendar    文件:Repeat.java   
/**
 * Full params constructor to get item from database
 */
public Repeat(int repeat_id, @Nonnull String repeat_name, @Nonnegative int repeat_ts) {
    if (repeat_id > 0) {
        this.repeat_id = repeat_id;
    } else {
        this.repeat_id = Constant.INT_NONE_VALUE;
    }
    this.repeat_name = repeat_name;
    if (repeat_ts >= 0) {
        this.repeat_ts = repeat_ts;
    } else {
        this.repeat_ts = 0;
    }
}
项目:MyCalendar    文件:Work.java   
public Work(long work_id, @Nonnull String subject_id, @Nullable Integer location_id, @Nonnegative int work_date_of_maturity, @Nonnull String work_title,
            @Nonnull String work_content, @Nonnegative int work_time_start, @Nonnegative int work_time_end, @Nonnegative int work_time_remind,
            @Nonnull EventStatus work_status, @Nonnull String work_status_reason_change, @Nonnull EventType work_type, int work_text_color,
            int work_back_ground_color) {
    super(work_id, location_id, work_title, work_content, work_text_color, work_back_ground_color, work_time_start, work_time_end,
            work_time_remind, work_status, work_status_reason_change, work_type, subject_id);
    if (!EventType.isWork(work_type)) {
        setDraw_item_type(EventType.NOTE, this);
    }
    this.work_date_of_maturity = work_date_of_maturity;

}
项目:MyCalendar    文件:Subject.java   
public void setSubject_day_start(@Nonnegative int subject_day_start) {
    if (subject_day_start >= 0) {
        this.subject_day_start = subject_day_start;
        if (!(this.subject_day_end >= this.subject_day_start)) {
            this.subject_day_end = this.subject_day_start;
        }
    }
}
项目:arez    文件:ReactionScheduler.java   
/**
 * Set the maximum number of rounds before a runaway reaction is detected.
 *
 * @param maxReactionRounds the maximum number of rounds.
 */
void setMaxReactionRounds( @Nonnegative final int maxReactionRounds )
{
  invariant( () -> maxReactionRounds >= 0,
             () -> "Attempting to set maxReactionRounds to negative value " + maxReactionRounds + "." );
  _maxReactionRounds = maxReactionRounds;
}
项目:JWebAssembly    文件:WasmOutputStream.java   
/**
 * Write an unsigned integer.
 * 
 * @param value
 *            the value
 * @throws IOException
 *             if an I/O error occurs.
 */
void writeVaruint32( @Nonnegative int value ) throws IOException {
    if( value < 0 ) {
        throw new IOException( "Invalid negative value" );
    }
    do {
        int b = value & 0x7F; // low 7 bits
        value >>= 7;
        if( value != 0 ) { /* more bytes to come */
            b |= 0x80;
        }
        write( b );
    } while( value != 0 );
}
项目:libcwfincore    文件:MutablePriceLevel.java   
public MutablePriceLevel(@Nonnull Price price,
                         @Nonnull Quantity size,
                         @Nonnegative int numOrders) {
    this.price = price;
    this.size = size;
    this.numOrders = numOrders;
}
项目:arez    文件:Arez_ObservableWithAnnotatedCtorModel.java   
public Arez_ObservableWithAnnotatedCtorModel(@Nonnegative final long time, final long other,
    @Nonnull final String foo) {
  super(time,other,foo);
  this.$$arez$$_context = Arez.areZonesEnabled() ? Arez.context() : null;
  this.$$arez$$_id = $$arez$$_nextId++;
  this.$$arez$$_component = Arez.areNativeComponentsEnabled() ? $$arez$$_context().createComponent( "ObservableWithAnnotatedCtorModel", $$arez$$_id(), $$arez$$_name(), null, null ) : null;
  this.$$arez$$_disposedObservable = $$arez$$_context().createObservable( Arez.areNativeComponentsEnabled() ? this.$$arez$$_component : null, Arez.areNamesEnabled() ? $$arez$$_name() + ".isDisposed" : null, Arez.arePropertyIntrospectorsEnabled() ? () -> this.$$arez$$_disposed : null, null );
  this.$$arez$$_time = $$arez$$_context().createObservable( Arez.areNativeComponentsEnabled() ? this.$$arez$$_component : null, Arez.areNamesEnabled() ? $$arez$$_name() + ".time" : null, Arez.arePropertyIntrospectorsEnabled() ? () -> super.getTime() : null, Arez.arePropertyIntrospectorsEnabled() ? v -> super.setTime( v ) : null );
  if ( Arez.areNativeComponentsEnabled() ) {
    this.$$arez$$_component.complete();
  }
}
项目:arez    文件:TimedDisposer.java   
private TimedDisposer( @Nonnull final Disposable target,
                       @Nonnegative final long timeout )
{
  Guards.apiInvariant( () -> timeout >= 0,
                       () -> "TimedDisposer passed an invalid timeout. Expected postive number " +
                             "but actual value: " + timeout );
  _target = Objects.requireNonNull( target );
  _timeoutId = DomGlobal.setTimeout( e -> performDispose( false ), timeout );
}
项目:arez    文件:MemoizeCache.java   
/**
 * Create the Memoize method cache.
 *
 * @param context  the context in which to create ComputedValue instances.
 * @param name     a human consumable prefix for computed values.
 * @param function the memoized function.
 * @param argCount the number of arguments expected to be passed to memoized function.
 */
public MemoizeCache( @Nonnull final ArezContext context,
                     @Nullable final String name,
                     @Nonnull final Function<T> function,
                     @Nonnegative final int argCount )
{
  apiInvariant( () -> Arez.areNamesEnabled() || null == name,
                () -> "MemoizeCache passed a name '" + name + "' but Arez.areNamesEnabled() is false" );
  apiInvariant( () -> argCount > 0,
                () -> "MemoizeCache constructed with invalid argCount: " + argCount + ". Expected positive value." );
  _context = Objects.requireNonNull( context );
  _name = Arez.areNamesEnabled() ? Objects.requireNonNull( name ) : null;
  _function = Objects.requireNonNull( function );
  _argCount = argCount;
}
项目:arez    文件:TransactionCompletedEvent.java   
public TransactionCompletedEvent( @Nonnull final String name,
                                  final boolean mutation,
                                  @Nullable final ObserverInfo tracker,
                                  @Nonnegative final long duration )
{
  assert duration >= 0;
  _name = Objects.requireNonNull( name );
  _mutation = mutation;
  _tracker = tracker;
  _duration = duration;
}