channelsorter.java
来自「一个用java写的地震分析软件(无源码)-used to write a sei」· Java 代码 · 共 36 行
JAVA
36 行
package org.trinet.jasi;
import java.util.*;
/**
* Provides comparitor() method to sort a list of Channelable objects by distance
* and component name. The distance from the sort point must already be set
* for the compared objects with channelable.setDistance(double). <p>
*/
public class ChannelSorter implements Comparator {
/** Comparitor for component sort. */
ComponentSorter componentSorter = new ComponentSorter();
/** */
public int compare (Object o1, Object o2) {
Channelable ch1 = (Channelable) o1;
Channelable ch2 = (Channelable) o2;
double diff = ch1.getDistance() - ch2.getDistance();
if (diff < 0.0) {
return -1;
} else if (diff > 0.0) {
return 1;
} else { // same dist sort by component type
return componentSorter.compare(
ch1.getChannelObj().getSeedchan(),
ch2.getChannelObj().getSeedchan());
}
}
} // end of ChannelSorter inner class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?