/* * Created on Dec 14, 2004 */ package fr.lifl.stc.stan.samples.escape; import java.io.PrintStream; import fr.lifl.stc.stan.signature.PartialSignatureData; /** * @author yann */ public class EscapePartialSignatureData implements PartialSignatureData { static final long serialVersionUID = 0; private short[] s; /** * */ public EscapePartialSignatureData(short[] s) { setData(s); } public short[] getData() { return s; } public void setData(short[]s) { this.s = s; } public void setData(String txt) { String[] tokens = txt.split(" "); s = new short[tokens.length]; for(int i = 0; i < s.length; i++) { s[i] = new Short(tokens[i]).shortValue(); } } public void display(PrintStream out) { out.println(toString()); } public String toString() { String res = "[ "; for(int i = 0; i < s.length; i++) res += s[i] + " "; res += "]"; return res; } public boolean equals(Object o) { if(o == null || !(o instanceof EscapePartialSignatureData)) return false; short[] list = s; short[] list_o = ((EscapePartialSignatureData)o).s; if(list.length != list_o.length) return false; boolean res = true; for(int i = 0; i < list.length; i++) { if(list[i] != list_o[i]) { res = false; break; } } return res; } public Object clone() throws CloneNotSupportedException { EscapePartialSignatureData d = (EscapePartialSignatureData)super.clone(); d.s = new short[s.length]; System.arraycopy(s,0,d.s,0,s.length); return d; } }