package tag;

import link.LinkUrl;

import java.util.Objects;

public abstract class TagMatcher {

	protected TagName tagName;

	public TagName getTagName() {
		return tagName;
	}

	protected abstract OptionalTag ifMatches(LinkUrl linkUrl);

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (!(o instanceof TagMatcher that)) return false;

		return Objects.equals(tagName, that.tagName);
	}

	@Override
	public int hashCode() {
		return tagName != null ? tagName.hashCode() : 0;
	}
}
