vallec

Regex.class

Jan 10th, 2024
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. public class Regex {
  2.     private int id;
  3.     private String pattern;
  4.     private String description;
  5.     private int rating;
  6.  
  7.     private static int nextId = 0;
  8.  
  9.     public Regex(String pattern, String description){
  10.         this.pattern = pattern;
  11.         this.description = description;
  12.         this.rating = 0;
  13.         nextId += 1;
  14.         this.id = nextId;
  15.     }
  16.  
  17.     public String getPattern() {
  18.         return this.pattern;
  19.     }
  20.     public void setId(int id) {
  21.         this.id = id;
  22.     }
  23.     public void setRating(int rating) {
  24.         this.rating = rating;
  25.     }
  26.     public String getDescription() {
  27.         return this.description;
  28.     }
  29.  
  30.     public int getRating () {
  31.         return this.rating;
  32.     }
  33.  
  34.     public int getId () {
  35.         return this.id;
  36.     }
  37.  
  38.     @Override
  39.     public String toString()
  40.     {
  41.         return id + "," + pattern + "," + description + "," + rating;
  42.     }
  43. }
  44.  
Add Comment
Please, Sign In to add comment