/******************************************************************************* * Copyright (c) 2012-2015 INRIA. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Generoso Pagano - initial API and implementation ******************************************************************************/ package fr.inria.soctrace.lib.model; import fr.inria.soctrace.lib.model.utils.SoCTraceException; /** * Class representing the FILE entity of the data model. * * @author "Generoso Pagano <generoso.pagano@inria.fr>" * */ public class File implements IModelElement { private final int id; private String path; private String description; /** * Constructor. * @param id the file unique id */ public File(int id) { this.id = id; } /** * @return the path */ public String getPath() { return path; } /** * @param path the path to set */ public void setPath(String path) { this.path = path; } /** * @return the description */ public String getDescription() { return description; } /** * @param description the description to set */ public void setDescription(String description) { this.description = description; } /** * @return the id */ public int getId() { return id; } @Override public String toString() { return "File[(id:" + id + "),(path:'" + path + "'),(description:'"+ description + "')]"; }; @Override public void accept(IModelVisitor visitor) throws SoCTraceException { visitor.visit(this); } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + id; result = prime * result + ((path == null) ? 0 : path.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof File)) return false; File other = (File) obj; if (description == null) { if (other.description != null) return false; } else if (!description.equals(other.description)) return false; if (id != other.id) return false; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; return true; } }