⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matchcollector.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
字号:
/** *  */package com.bbn.openmap.geo;import java.util.ArrayList;import java.util.Collection;import java.util.HashSet;import java.util.Iterator;public interface MatchCollector {    /**     * collect an indication that the query object a (or some part of     * it) matches object b in some way, presumably by intersection.     *      * @param a     * @param b     */    void collect(Object a, Object b);    /** @return an iterator over the previously collected elements * */    Iterator iterator();    /**     * A MatchCollector that collects a list of pairs of the matching     * objects     */    public static class PairArrayMatchCollector implements MatchCollector {        protected final ArrayList result = new ArrayList();        public void collect(Object a, Object b) {            result.add(new MatchCollector.Pair(a, b));        }        public Iterator iterator() {            return result.iterator();        }    }    public static class Pair {        private Object a;        private Object b;        public Pair(Object a, Object b) {            this.a = a;            this.b = b;        }        public Object getA() {            return a;        }        public Object getB() {            return b;        }    }    public static class SetMatchCollector implements MatchCollector {        protected final HashSet result = new HashSet();        public void collect(Object a, Object b) {            result.add(b);        }        public Iterator iterator() {            return result.iterator();        }    }    public static class CollectionMatchCollector implements MatchCollector {        protected final Collection c;        public CollectionMatchCollector(Collection c) {            this.c = c;        }        public void collect(Object a, Object b) {            c.add(b);        }        public Iterator iterator() {            return c.iterator();        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -