Package ic211
Class Tweet
- java.lang.Object
-
- ic211.Tweet
-
public class Tweet extends Object
This class represents a single Tweet
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDate()Get the date of the post in YYYY-MM-DD format.StringgetText()Get the message text of the Tweet.StringgetUserName()Get the user name of the poster.static Tweetread(Scanner sc)Reads data from a Scanner and creates & returns a Tweet from it.StringtoString()Returns a String representation of a Tweet in message-tab-user-tab-date format.
-
-
-
Method Detail
-
read
public static Tweet read(Scanner sc)
Reads data from a Scanner and creates & returns a Tweet from it. The expected format is a single line wth three tab-delimited fields, the first of which is the Tweet text, the second the Twitter user name, the third the date in YYYY-MM-DD format. For example:IC211 was awesome today ... as usual. csitmid 2015-02-13
- Parameters:
sc- The scanner that input will be read from.- Returns:
- null if the necessary Tweet data cannot be read, a newly constructeed Tweet otherwise.
-
toString
public String toString()
Returns a String representation of a Tweet in message-tab-user-tab-date format. Note that the date is in YYYY-MM-DD format.
-
getText
public String getText()
Get the message text of the Tweet.- Returns:
- the message text of the Tweet.
-
getUserName
public String getUserName()
Get the user name of the poster.- Returns:
- the Twitter user name of the poster.
-
getDate
public String getDate()
Get the date of the post in YYYY-MM-DD format.- Returns:
- the date of the Twitter post in YYY-MM-DD format.
-
-