// Path: src/twitter4j/Status.java
// public interface Status extends Comparable<Status>, TwitterResponse,
//         EntitySupport, java.io.Serializable {
//     /**
//      * Return the created_at
//      *
//      * @return created_at
//      * @since Twitter4J 1.1.0
//      */
// 
//     Date getCreatedAt();
// 
//     /**
//      * Returns the id of the status
//      *
//      * @return the id
//      */
//     long getId();
// 
//     /**
//      * Returns the text of the status
//      *
//      * @return the text
//      */
//     String getText();
// 
//     /**
//      * Returns the source
//      *
//      * @return the source
//      * @since Twitter4J 1.0.4
//      */
//     String getSource();
// 
// 
//     /**
//      * Test if the status is truncated
//      *
//      * @return true if truncated
//      * @since Twitter4J 1.0.4
//      */
//     boolean isTruncated();
// 
//     /**
//      * Returns the in_reply_tostatus_id
//      *
//      * @return the in_reply_tostatus_id
//      * @since Twitter4J 1.0.4
//      */
//     long getInReplyToStatusId();
// 
//     /**
//      * Returns the in_reply_user_id
//      *
//      * @return the in_reply_tostatus_id
//      * @since Twitter4J 1.0.4
//      */
//     long getInReplyToUserId();
// 
//     /**
//      * Returns the in_reply_to_screen_name
//      *
//      * @return the in_in_reply_to_screen_name
//      * @since Twitter4J 2.0.4
//      */
//     String getInReplyToScreenName();
// 
//     /**
//      * Returns The location that this tweet refers to if available.
//      *
//      * @return returns The location that this tweet refers to if available (can be null)
//      * @since Twitter4J 2.1.0
//      */
//     GeoLocation getGeoLocation();
// 
//     /**
//      * Returns the place attached to this status
//      *
//      * @return The place attached to this status
//      * @since Twitter4J 2.1.1
//      */
//     Place getPlace();
// 
//     /**
//      * Test if the status is favorited
//      *
//      * @return true if favorited
//      * @since Twitter4J 1.0.4
//      */
//     boolean isFavorited();
// 
//     /**
//      * Return the user associated with the status.<br>
//      * This can be null if the instance if from User.getStatus().
//      *
//      * @return the user
//      */
//     User getUser();
// 
//     /**
//      * @since Twitter4J 2.0.10
//      */
//     boolean isRetweet();
// 
//     /**
//      * @since Twitter4J 2.1.0
//      */
//     Status getRetweetedStatus();
// 
//     /**
//      * Returns an array of contributors, or null if no contributor is associated with this status.
//      *
//      * @since Twitter4J 2.2.3
//      */
//     long[] getContributors();
// 
//     /**
//      * Returns the number of times this tweet has been retweeted, or -1 when the tweet was
//      * created before this feature was enabled.
//      *
//      * @return the retweet count.
//      */
//     long getRetweetCount();
// 
//     /**
//      * Returns true if the authenticating user has retweeted this tweet, or false when the tweet was
//      * created before this feature was enabled.
//      *
//      * @return whether the authenticating user has retweeted this tweet.
//      * @since Twitter4J 2.1.4
//      */
//     boolean isRetweetedByMe();
// 
//     /**
//      * Returns the annotations, or null if no annotations are associated with this status.
//      *
//      * @since Twitter4J 2.1.4
//      * @deprecated Annotations is not available for now. <a href="http://groups.google.com/group/twitter-development-talk/browse_thread/thread/4d5ff2ec4d2ce4a7">Annotations - Twitter Development Talk | Google Groups</a>
//      */
//     Annotations getAnnotations();
// }


import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import twitter4j.IDs;
import twitter4j.Paging;
import twitter4j.ResponseList;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.User;
import twitter4j.auth.AccessToken;

	 
	
	public HashSet<User> getFriends(User u, int max) throws Exception {
    	HashSet<User> ret = new HashSet<User>();
    	long cursor = -1;
    	IDs ids;
    	int count = 0;
    	do {
    		
            ids = twitter.getFriendsIDs(u.getScreenName(), cursor);
    		
            
            for (int i = 0; i < ids.getIDs().length && i < max; i++) {
				long id = ids.getIDs()[i];
                ret.add(twitter.showUser(id));
            }
            
            count++;
            
    		
            
        } while ((cursor = ids.getNextCursor()) != 0 && count < max);
    	
    	return ret;
	}
	
	
	public void crawl() throws TwitterException, IOException{
		ArrayList<User> ret = new ArrayList<User>();
		HashMap<User,HashSet<Link>> links = new HashMap<User,HashSet<Link>>();

// Path: src/twitter4j/Status.java
// public interface Status extends Comparable<Status>, TwitterResponse,
//         EntitySupport, java.io.Serializable {
//     /**
//      * Return the created_at
//      *
//      * @return created_at
//      * @since Twitter4J 1.1.0
//      */
// 
//     Date getCreatedAt();
// 
//     /**
//      * Returns the id of the status
//      *
//      * @return the id
//      */
//     long getId();
// 
//     /**
//      * Returns the text of the status
//      *
//      * @return the text
//      */
//     String getText();
// 
//     /**
//      * Returns the source
//      *
//      * @return the source
//      * @since Twitter4J 1.0.4
//      */
//     String getSource();
// 
// 
//     /**
//      * Test if the status is truncated
//      *
//      * @return true if truncated
//      * @since Twitter4J 1.0.4
//      */
//     boolean isTruncated();
// 
//     /**
//      * Returns the in_reply_tostatus_id
//      *
//      * @return the in_reply_tostatus_id
//      * @since Twitter4J 1.0.4
//      */
//     long getInReplyToStatusId();
// 
//     /**
//      * Returns the in_reply_user_id
//      *
//      * @return the in_reply_tostatus_id
//      * @since Twitter4J 1.0.4
//      */
//     long getInReplyToUserId();
// 
//     /**
//      * Returns the in_reply_to_screen_name
//      *
//      * @return the in_in_reply_to_screen_name
//      * @since Twitter4J 2.0.4
//      */
//     String getInReplyToScreenName();
// 
//     /**
//      * Returns The location that this tweet refers to if available.
//      *
//      * @return returns The location that this tweet refers to if available (can be null)
//      * @since Twitter4J 2.1.0
//      */
//     GeoLocation getGeoLocation();
// 
//     /**
//      * Returns the place attached to this status
//      *
//      * @return The place attached to this status
//      * @since Twitter4J 2.1.1
//      */
//     Place getPlace();
// 
//     /**
//      * Test if the status is favorited
//      *
//      * @return true if favorited
//      * @since Twitter4J 1.0.4
//      */
//     boolean isFavorited();
// 
//     /**
//      * Return the user associated with the status.<br>
//      * This can be null if the instance if from User.getStatus().
//      *
//      * @return the user
//      */
//     User getUser();
// 
//     /**
//      * @since Twitter4J 2.0.10
//      */
//     boolean isRetweet();
// 
//     /**
//      * @since Twitter4J 2.1.0
//      */
//     Status getRetweetedStatus();
// 
//     /**
//      * Returns an array of contributors, or null if no contributor is associated with this status.
//      *
//      * @since Twitter4J 2.2.3
//      */
//     long[] getContributors();
// 
//     /**
//      * Returns the number of times this tweet has been retweeted, or -1 when the tweet was
//      * created before this feature was enabled.
//      *
//      * @return the retweet count.
//      */
//     long getRetweetCount();
// 
//     /**
//      * Returns true if the authenticating user has retweeted this tweet, or false when the tweet was
//      * created before this feature was enabled.
//      *
//      * @return whether the authenticating user has retweeted this tweet.
//      * @since Twitter4J 2.1.4
//      */
//     boolean isRetweetedByMe();
// 
//     /**
//      * Returns the annotations, or null if no annotations are associated with this status.
//      *
//      * @since Twitter4J 2.1.4
//      * @deprecated Annotations is not available for now. <a href="http://groups.google.com/group/twitter-development-talk/browse_thread/thread/4d5ff2ec4d2ce4a7">Annotations - Twitter Development Talk | Google Groups</a>
//      */
//     Annotations getAnnotations();
// }


// Path: src/crawler/CrawlerNetwork.java
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import twitter4j.IDs;
import twitter4j.Paging;
import twitter4j.ResponseList;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.User;
import twitter4j.auth.AccessToken;

	 
	
	public HashSet<User> getFriends(User u, int max) throws Exception {
    	HashSet<User> ret = new HashSet<User>();
    	long cursor = -1;
    	IDs ids;
    	int count = 0;
    	do {
    		
            ids = twitter.getFriendsIDs(u.getScreenName(), cursor);
    		
            
            for (int i = 0; i < ids.getIDs().length && i < max; i++) {
				long id = ids.getIDs()[i];
                ret.add(twitter.showUser(id));
            }
            
            count++;
            
    		
            
        } while ((cursor = ids.getNextCursor()) != 0 && count < max);
    	
    	return ret;
	}
	
	
	public void crawl() throws TwitterException, IOException{
		ArrayList<User> ret = new ArrayList<User>();
		HashMap<User,HashSet<Link>> links = new HashMap<User,HashSet<Link>>();

		HashMap<User,ResponseList<Status>> statuses = new HashMap<User,ResponseList<Status>>();
