mjain

Stackoverflow OOPS design

Jul 24th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.70 KB | None | 0 0
  1. package stackOverflow;
  2.  
  3. import java.util.Date;
  4. import java.util.List;
  5.  
  6. public class StackOverFlow {
  7.  
  8.     public enum AccountStatus {
  9.         ACTIVE, BLOCKED, BANNED, COMPROMISED, BLACKLISTED, CLOSED, CANCELLED;
  10.     }
  11.  
  12.     public enum QuestionStatus {
  13.         OPEN, CLOSE, DELETED, ONHOLD;
  14.     }
  15.     public enum QuestionClsoingTag {
  16.         DUPLICATED, OFF_TOPIC, NOT_A_REAL_QUESTION, TOO_BROAD, INVALID;
  17.     }
  18.  
  19.     public class Address {
  20.         String street, city, state, country, pincode;
  21.  
  22.     }
  23.     public class Account {
  24.         String        userName;
  25.         String        password;
  26.         String        email;
  27.         String        mobile;
  28.         String        fullName;
  29.         AccountStatus accountStatus;
  30.         Address       address;
  31.         Date          creationDate;
  32.         int           reputation;
  33.  
  34.         // reset password
  35.  
  36.     }
  37.     public class Badge {
  38.         String name;
  39.         String description;
  40.  
  41.     }
  42.     public class Member {
  43.         Account     accontDetails;
  44.         List<Badge> badges;
  45.         // create Question
  46.         // setTag
  47.         // getReputation
  48.         // addAnswer
  49.         // addCOmment
  50.         // acceptAnswer
  51.         // delete answer
  52.         // undelete answer
  53.  
  54.     }
  55.     public class Admin extends Member {
  56.         // block memener
  57.         // unblock member
  58.     }
  59.     public class Moderator extends Member {
  60.         // delete question
  61.         // undelete Question
  62.     }
  63.  
  64.     public class Tag {
  65.         String name;
  66.         String description;
  67.         int    noOfTimesUsedInQuestion;
  68.         int    frequencyDaily;
  69.         int    weeklyFrequnecy;
  70.     }
  71.  
  72.     public class Bounty {
  73.         int  reputation;
  74.         Date expiryDate;
  75.  
  76.         // modifyExpiryDate
  77.     }
  78.  
  79.     public class Photo {
  80.         private int    photoId;
  81.         private String photoPath;
  82.         private Date   creationDate;
  83.  
  84.         private Member creatingMember;
  85.  
  86.         // public boolean delete();
  87.     }
  88.  
  89.     public interface Search {
  90.         List<Question> getQuestionListByQuery(String query);
  91.     }
  92.     public class Question implements Search {
  93.         private String             title;
  94.         private String             description;
  95.         private int                viewCount;
  96.         private int                voteCount;
  97.         private Date               creationTime;
  98.         private Date               updateTime;
  99.         private QuestionStatus     status;
  100.         private QuestionClsoingTag closingRemark;
  101.  
  102.         private Member             askingMember;
  103.         private Bounty             bounty;
  104.         List<Answer>               answers;
  105.         List<Comment>              comments;
  106.         List<Photo>                photos;
  107.  
  108.         // public boolean close();
  109.         // public boolean undelete();
  110.         // public boolean addComment(Comment comment);
  111.         // public boolean addBounty(Bounty bounty);
  112.         @Override
  113.         public List<Question> getQuestionListByQuery(String query) {
  114.             // TODO Auto-generated method stub
  115.             return null;
  116.         }
  117.     }
  118.  
  119.     public class Answer {
  120.         String          description;
  121.         int             flagCOunt;
  122.         int             voteCOunt;
  123.         private Date    creationTime;
  124.         private Date    updateTime;
  125.         private Member  writingMember;
  126.         private boolean accepted;
  127.         List<Photo>     photos;
  128.         // incrementVoteCOunt
  129.     }
  130.  
  131.     public class Comment {
  132.         String         text;
  133.         int            flagCOunt;
  134.         int            voteCOunt;
  135.         private Date   creationTime;
  136.         private Date   updateTime;
  137.         private Member writingMember;
  138.         List<Photo>    photos;
  139.     }
  140.  
  141. }
Add Comment
Please, Sign In to add comment