예제 #1
0
 @Override
 public int hashCode() {
   int result = createdAt != null ? createdAt.hashCode() : 0;
   result = 31 * result + (int) (id ^ (id >>> 32));
   result = 31 * result + (text != null ? text.hashCode() : 0);
   result = 31 * result + (source != null ? source.hashCode() : 0);
   result = 31 * result + (truncated ? 1 : 0);
   result = 31 * result + (entities != null ? entities.hashCode() : 0);
   result = 31 * result + (extendedEntities != null ? extendedEntities.hashCode() : 0);
   result = 31 * result + (int) (inReplyToStatusId ^ (inReplyToStatusId >>> 32));
   result = 31 * result + (int) (inReplyToUserId ^ (inReplyToUserId >>> 32));
   result = 31 * result + (inReplyToScreenName != null ? inReplyToScreenName.hashCode() : 0);
   result = 31 * result + (user != null ? user.hashCode() : 0);
   result = 31 * result + (geo != null ? geo.hashCode() : 0);
   result = 31 * result + (place != null ? place.hashCode() : 0);
   result = 31 * result + (currentUserRetweet != null ? currentUserRetweet.hashCode() : 0);
   result = 31 * result + (contributors != null ? Arrays.hashCode(contributors) : 0);
   result = 31 * result + (int) (retweetCount ^ (retweetCount >>> 32));
   result = 31 * result + (int) (favoriteCount ^ (favoriteCount >>> 32));
   result = 31 * result + (int) (replyCount ^ (replyCount >>> 32));
   result = 31 * result + (favorited ? 1 : 0);
   result = 31 * result + (retweeted ? 1 : 0);
   result = 31 * result + (lang != null ? lang.hashCode() : 0);
   result = 31 * result + (int) (descendentReplyCount ^ (descendentReplyCount >>> 32));
   result = 31 * result + (retweetedStatus != null ? retweetedStatus.hashCode() : 0);
   result = 31 * result + (quotedStatus != null ? quotedStatus.hashCode() : 0);
   result = 31 * result + (card != null ? card.hashCode() : 0);
   result = 31 * result + (possiblySensitive ? 1 : 0);
   return result;
 }
예제 #2
0
 @NonNull
 public static User showUserAlternative(
     final Twitter twitter, final long id, final String screenName) throws TwitterException {
   final String searchScreenName;
   if (screenName != null) {
     searchScreenName = screenName;
   } else if (id != -1) {
     searchScreenName = twitter.showFriendship(id).getTargetUserScreenName();
   } else throw new IllegalArgumentException();
   final Paging paging = new Paging();
   paging.count(1);
   for (final User user : twitter.searchUsers(searchScreenName, paging)) {
     if (user.getId() == id || searchScreenName.equalsIgnoreCase(user.getScreenName()))
       return user;
   }
   if (id != -1) {
     final ResponseList<Status> timeline = twitter.getUserTimeline(id, paging);
     for (final Status status : timeline) {
       final User user = status.getUser();
       if (user.getId() == id) return user;
     }
   } else {
     final ResponseList<Status> timeline = twitter.getUserTimeline(screenName, paging);
     for (final Status status : timeline) {
       final User user = status.getUser();
       if (searchScreenName.equalsIgnoreCase(user.getScreenName())) return user;
     }
   }
   throw new TwitterException("can't find user");
 }
예제 #3
0
 @Override
 public int compareTo(@NonNull final Status that) {
   final long delta = id - that.getId();
   if (delta < Integer.MIN_VALUE) return Integer.MIN_VALUE;
   else if (delta > Integer.MAX_VALUE) return Integer.MAX_VALUE;
   return (int) delta;
 }
예제 #4
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    StatusImpl status = (StatusImpl) o;

    if (id != status.id) return false;
    if (truncated != status.truncated) return false;
    if (inReplyToStatusId != status.inReplyToStatusId) return false;
    if (inReplyToUserId != status.inReplyToUserId) return false;
    if (retweetCount != status.retweetCount) return false;
    if (favoriteCount != status.favoriteCount) return false;
    if (replyCount != status.replyCount) return false;
    if (favorited != status.favorited) return false;
    if (retweeted != status.retweeted) return false;
    if (descendentReplyCount != status.descendentReplyCount) return false;
    if (possiblySensitive != status.possiblySensitive) return false;
    if (createdAt != null ? !createdAt.equals(status.createdAt) : status.createdAt != null)
      return false;
    if (text != null ? !text.equals(status.text) : status.text != null) return false;
    if (source != null ? !source.equals(status.source) : status.source != null) return false;
    if (entities != null ? !entities.equals(status.entities) : status.entities != null)
      return false;
    if (extendedEntities != null
        ? !extendedEntities.equals(status.extendedEntities)
        : status.extendedEntities != null) return false;
    if (inReplyToScreenName != null
        ? !inReplyToScreenName.equals(status.inReplyToScreenName)
        : status.inReplyToScreenName != null) return false;
    if (user != null ? !user.equals(status.user) : status.user != null) return false;
    if (geo != null ? !geo.equals(status.geo) : status.geo != null) return false;
    if (place != null ? !place.equals(status.place) : status.place != null) return false;
    if (currentUserRetweet != null
        ? !currentUserRetweet.equals(status.currentUserRetweet)
        : status.currentUserRetweet != null) return false;
    if (!Arrays.equals(contributors, status.contributors)) return false;
    if (lang != null ? !lang.equals(status.lang) : status.lang != null) return false;
    if (retweetedStatus != null
        ? !retweetedStatus.equals(status.retweetedStatus)
        : status.retweetedStatus != null) return false;
    if (quotedStatus != null
        ? !quotedStatus.equals(status.quotedStatus)
        : status.quotedStatus != null) return false;
    return !(card != null ? !card.equals(status.card) : status.card != null);
  }