annotate src/samer/maths/LineTrace.java @ 8:5e3cbbf173aa tip

Reorganise some more
author samer
date Fri, 05 Apr 2019 22:41:58 +0100
parents bf79fb79ee13
children
rev   line source
samer@0 1 /*
samer@0 2 * MatrixTrace.java
samer@0 3 *
samer@0 4 * Copyright (c) 2000, Samer Abdallah, King's College London.
samer@0 5 * All rights reserved.
samer@0 6 *
samer@0 7 * This software is provided AS iS and WITHOUT ANY WARRANTY;
samer@0 8 * without even the implied warranty of MERCHANTABILITY or
samer@0 9 * FITNESS FOR A PARTICULAR PURPOSE.
samer@0 10 */
samer@0 11
samer@0 12 package samer.maths;
samer@0 13 import samer.core.*;
samer@0 14 import samer.tools.*;
samer@0 15 import java.util.*;
samer@0 16
samer@0 17 /**
samer@0 18 This viewer outputs all the elements of a row or column
samer@0 19 to a trace (graph of value against time step). All elements
samer@0 20 of the row are column are consecutively output at each time
samer@0 21 step.
samer@0 22 */
samer@0 23
samer@0 24 public class LineTrace extends Trace implements Observer
samer@0 25 {
samer@0 26 Observable obs;
samer@0 27 Vec src;
samer@0 28
samer@0 29 public LineTrace( Observable o, Vec v) { obs=o; src=v; }
samer@0 30
samer@0 31 public void attach() { obs.addObserver(this); }
samer@0 32 public void detach() { obs.deleteObserver(this); super.detach(); }
samer@0 33
samer@0 34 public void update(Observable o, Object s)
samer@0 35 {
samer@0 36 if (s==Viewable.DISPOSING) {
samer@0 37 Shell.releaseViewer(this);
samer@0 38 } else if (obs==o) {
samer@0 39 Vec.Iterator i=src.iterator();
samer@0 40 while (i.more()) next(i.next());
samer@0 41 }
samer@0 42 }
samer@0 43 protected void next(double x) {} // !! fix this
samer@0 44 protected void realized() { super.realized(); attach(); }
samer@0 45 }