//(c):Benja Fallenstein package gzz.view; import gzz.*; import gzz.media.*; /** An object representing a marked cell. * This is used in the fallback client to represent one marked cell * or marked part of a cell (= enfilade of spans). A mark set is * represented as a Set of Mark objects. */ public class Mark { public final Cell cell; /** The marked span(s). * This is null if no part of the cell's content has been * marked specifically. If any part of the content has been marked, * it is contained in this enfilade. */ public final Enfilade1D spans; public Mark(Cell cell, Enfilade1D spans) { this.cell = cell; this.spans = spans; } public Mark(Cell cell) { this.cell = cell; this.spans = null; } /** Get the enfilade represented by this mark. * If spans is not null, this is * simply spans. If spans is * null, this is the contents of the marked cell. */ public Enfilade1D getEnfilade() { if(spans != null) return spans; else { VStreamCellTexter texter = (VStreamCellTexter)cell.space.getCellTexter(); return texter.getEnfilade(cell, null); } } public int hashCode() { return cell.hashCode() ^ spans.hashCode(); } public boolean equals(Object o) { if(!(o instanceof Mark)) return false; Mark m = (Mark)o; return cell.equals(m.cell) && spans.equals(m.spans); } }