/*
* This file is part of ReqTracker.
*
* Copyright (C) 2015 Taleh Didover, Florian Gerdes, Dmitry Gorelenkov,
* Rajab Hassan Kaoneka, Katsiaryna Krauchanka, Tobias Polzer,
* Gayathery Sathya, Lukas Tajak
*
* ReqTracker is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ReqTracker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with ReqTracker. If not, see <http://www.gnu.org/licenses/>.
*/
package de.fau.osr.gui.Model.DataElements;
import de.fau.osr.gui.Controller.Visitor;
import de.fau.osr.gui.View.Presenter.Presenter;
public class Requirement extends DataElement {
private String id;
private String title;
private String description;
public Requirement(de.fau.osr.core.Requirement requirement) {
this.id = requirement.getId();
this.title = requirement.getTitle();
this.description = requirement.getDescription();
}
public Requirement(String id) {
this.id = id;
}
public String getID() {
return id;
}
@Override
public Presenter visit(Visitor visitor) {
return visitor.toPresenter(this);
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Requirement)) return false;
Requirement that = (Requirement) o;
if (!id.equals(that.id)) return false;
if (title != null ? !title.equals(that.title) : that.title != null) return false;
return !(description != null ? !description.equals(that.description) : that.description != null);
}
@Override
public int hashCode() {
int result = id.hashCode();
result = 31 * result + (title != null ? title.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
return result;
}
}