All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xjs.comments.Comment Maven / Gradle / Ivy

There is a newer version: 0.36
Show newest version
package xjs.comments;

import xjs.serialization.token.CommentToken;

public class Comment {
    public final CommentStyle style;
    public final String text;

    public Comment(final CommentToken token) {
        this(token.commentStyle(), token.parsed());
    }

    public Comment(final CommentStyle style, final String text) {
        this.style = style;
        this.text = text;
    }

    @Override
    public int hashCode() {
        return this.style.hashCode() + 31 * text.hashCode();
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        } else if (o instanceof Comment) {
            final Comment c = (Comment) o;
            return this.style == c.style
                && this.text.equals(c.text);
        }
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy