/******************************************************************************* * This file is part of Goko. * * Goko is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Goko 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Goko. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ package org.goko.core.gcode.element; public class GCodeWord { /** The letter for this word */ private String letter; /** The value */ private String value; public GCodeWord(String letter, String value) { super(); this.letter = letter; this.value = value; } public GCodeWord(GCodeWord word) { this(word.getLetter(), word.getValue()); } /** * @return the letter */ public String getLetter() { return letter; } /** * @param letter the letter to set */ public void setLetter(String letter) { this.letter = letter; } /** * @return the value */ public String getValue() { return value; } public String completeString(){ return letter+value; } /** * @param value the value to set */ public void setValue(String value) { this.value = value; } /** (inheritDoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((letter == null) ? 0 : letter.hashCode()); result = prime * result + ((value == null) ? 0 : value.hashCode()); return result; } /** (inheritDoc) * @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 (getClass() != obj.getClass()) return false; GCodeWord other = (GCodeWord) obj; if (letter == null) { if (other.letter != null) return false; } else if (!letter.equals(other.letter)) return false; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.value)) return false; return true; } }