/* AwtLinkCache.java * * Copyright (c) 2000-2001 Ted Nelson and Tuomas Lukka * Copyright (c) 2000-2001 Kimmo Wideroos * * You may use and distribute under the terms of either the GNU Lesser * General Public License, either version 2 of the license or, * at your choice, any later version. Alternatively, you may use and * distribute under the terms of the XPL. * * See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of * the licenses. * * This software 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 README * file for more details. * */ /* * Written by Kimmo Wideroos (inspired by Benjamin Fallenstein's notemap module) */ /** collection which caches link info */ package org.gzigzag.module; import org.gzigzag.*; import java.util.*; public class AwtLinkCache extends AbstractCollection { public static boolean dbg = false; static final void p(String s) { if(dbg) System.out.println(s); } static final void pa(String s) { System.out.println(s); } public class LinkWodgeIterator implements Iterator { Enumeration stuff; LinkWodgeIterator(Enumeration e) { stuff = e; } public boolean hasNext() { return stuff.hasMoreElements(); } public Object next() throws NoSuchElementException { return stuff.nextElement(); } public void remove() throws UnsupportedOperationException { throw new UnsupportedOperationException(); } } public final class LinkWodge { public ZZCell cell; public double[] from, to; LinkWodge(ZZCell cell, double[] f, double[] t) { this.cell=cell; from = f; to = t; } } private Hashtable cache; public AwtLinkCache() { cache = new Hashtable(); } public AwtLinkCache(ZZCell layer) { cache = new Hashtable(); ZZCell[] ltrees, as; as = AwtLayer.getArtefacts(layer); Hashtable treeh = new Hashtable(); for(int i=0; i d_2/2) epvs[i][j] -= d_2; } } // recount mp = middle(epvs); add(tree, mp, mp); for(i=0; i