package simulator;

import java.util.*;
import java.awt.*;

public class NodeImage {
  public Color core = Color.gray;
  public Color rim = Color.black;
  public Color ring = null;
  private Vector rays = null;
  public boolean hasRays() { return rays!=null; }
  public Iterator getRays() { 
    if(rays!=null) return rays.iterator(); 
    else return (new Vector()).iterator();
  }
  public void addRay(Color c, double phase) {
    if(rays == null) rays = new Vector();
    rays.add(new NodeImageRay(c,phase));
  }
  public boolean equals(Object o) {
    if(o==null || !(o instanceof NodeImage)) return false;
    NodeImage n = (NodeImage)o;
    if((core==null&&n.core!=null)||(core!=null&&!core.equals(n.core)))
      return false;
    if((rim==null&&n.rim!=null)||(rim!=null&&!rim.equals(n.rim)))
      return false;
    if((ring==null&&n.ring!=null)||(ring!=null&&!ring.equals(n.ring)))
      return false;
    // for now, don't bother checking rays
    if(hasRays() || n.hasRays()) return false;
    return true;
  }
}

