public final class

Posts

extends Object
java.lang.Object
   ↳ chan.content.model.Posts

Class Overview

Model containing posts data.

This class holds array of posts. Use default constructors to store an array.

Case 1: read posts response

This model contains all posts or only new ones if request is partial.

In this case this model may contain unique posters count and original thread URI if your char is archive. You can use the following methods to store this data:

Case 2: part of read threads response

The first post model is original post. The rest post models are last replies to original one.

In this case this model may contain number of posts, files or posts with files. You can use the following method to store this data:

Some chans provides files count in thread. Another chans provides count of posts with files in thread. So, if your chan supports multiple files per post, you can use addFilesCount(int) in first case and addPostsWithFilesCount(int) in the second case. If your chan supports only one image per post, it's better to use addPostsWithFilesCount(int) because it's more usual.

Summary

Public Constructors
Posts()

Default constructor for Posts.

Posts(Post... posts)

Constructor for Posts with given posts.

Posts(Collection<? extends Post> posts)

Constructor for Posts with given posts that will be transformed to array.

Public Methods
Posts addFilesCount(int filesCount)

Stores files count in thread in this model.

Posts addPostsCount(int postsCount)

Stores posts count in thread in this model.

Posts addPostsWithFilesCount(int postsWithFilesCount)

Stores posts count with files in this model.

Uri getArchivedThreadUri()

Returns archived thread URI.

int getFilesCount()

Returns files count in thread.

Post[] getPosts()

Returns array of post models this model holds.

int getPostsCount()

Returns posts count in thread.

int getPostsWithFilesCount()

Returns posts count with files.

int getUniquePosters()

Returns unique posters count.

Posts setArchivedThreadUri(Uri uri)

Stores original URI of archived thread in this model.

Posts setPosts(Collection<? extends Post> posts)

Stores posts in this model.

Posts setPosts(Post... posts)

Stores posts in this model.

Posts setUniquePosters(int uniquePosters)

Stores unique posters count in this model.

[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Posts ()

Default constructor for Posts.

public Posts (Post... posts)

Constructor for Posts with given posts.

Parameters
posts Post: Array of Post.

public Posts (Collection<? extends Post> posts)

Constructor for Posts with given posts that will be transformed to array.

Parameters
posts Collection: Collection of Post.

Public Methods

public Posts addFilesCount (int filesCount)

Stores files count in thread in this model.

Parameters
filesCount int: Number of files in thread including original post and last replies.
Returns
Posts This model.

public Posts addPostsCount (int postsCount)

Stores posts count in thread in this model.

Parameters
postsCount int: Number of posts in thread including original post and last replies.
Returns
Posts This model.

public Posts addPostsWithFilesCount (int postsWithFilesCount)

Stores posts count with files in this model.

Parameters
postsWithFilesCount int: Number of posts with files in thread including original post and last replies.
Returns
Posts This model.

public Uri getArchivedThreadUri ()

Returns archived thread URI.

Returns
Uri

public int getFilesCount ()

Returns files count in thread.

Returns
int

public Post[] getPosts ()

Returns array of post models this model holds.

Returns
Post[]

public int getPostsCount ()

Returns posts count in thread.

Returns
int

public int getPostsWithFilesCount ()

Returns posts count with files.

Returns
int

public int getUniquePosters ()

Returns unique posters count.

Returns
int

public Posts setArchivedThreadUri (Uri uri)

Stores original URI of archived thread in this model.

Parameters
uri Uri: Original URI of archived thread.
Returns
Posts This model.

public Posts setPosts (Collection<? extends Post> posts)

Stores posts in this model.

Parameters
posts Collection: Collection of Post.
Returns
Posts This model.

public Posts setPosts (Post... posts)

Stores posts in this model.

Parameters
posts Post: Array of Post.
Returns
Posts This model.

public Posts setUniquePosters (int uniquePosters)

Stores unique posters count in this model.

Parameters
uniquePosters int: Number of unique posters in thread.
Returns
Posts This model.