Skip to contentMethod: print()
      1: package model;
2: 
3: /**
4:  * 
5:  * @author Muri
6:  * 
7:  */
8: public class Comment {
9:         /**
10:          * The Comment itself.
11:          */
12:         private final String commentString;
13: 
14:         /**
15:          * The position of the comment.
16:          */
17:         private final Position position;
18: 
19:         /**
20:          * A Comment in a fli4l configuration File. A HashMap of these are stored in the package
21:          * Manager.
22:          * 
23:          * @param comment
24:          *            Comment
25:          * @param position
26:          *            Position
27:          */
28:         public Comment(final String comment, final Position position) {
29:                 this.commentString = comment;
30:                 this.position = position;
31:         }
32: 
33:         @Override
34:         public boolean equals(final Object obj) {
35:                 return obj instanceof Comment && ((Comment) obj).getComment().equals(this.getComment())
36:                                 && ((Comment) obj).getPosition().equals(this.getPosition());
37:         }
38: 
39:         @Override
40:         public int hashCode() {
41:                 return this.commentString.hashCode() + this.getPosition().hashCode();
42:         }
43: 
44:         /**
45:          * Returns the line to print.
46:          * 
47:          * @return Returns a string value, representing a line to print.
48:          */
49:         public String print() {
50:                 return scanner.ScannerConstants.COMMENTSYMBOL + this.commentString;
51:         }
52: 
53:         /**
54:          * @return the comment. no side effects.
55:          */
56:         public String getComment() {
57:                 return this.commentString;
58:         }
59: 
60:         /**
61:          * @return the position. No side effects.
62:          */
63:         public Position getPosition() {
64:                 return this.position;
65:         }
66: 
67: }