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

📄 splitcell.java

📁 生物物种进化历程的演示
💻 JAVA
字号:
/*
 * Created on Jun 5, 2004
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package AccordionDrawer;

import java.util.TreeSet;

/**
 * @author hilde
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */


// container for splitline components
// - parent: parent for this cell, indices/keys for the parent
//  - needed for computePlaceThisFrame
// - kid[2]: kids for this cell, indices/keys for the kids
// - min, max: bounds for this cell, indices/keys for the bounds
// - splitValue: location of this split relative to min/max
// - computedFrame: cached frame reference for the absolute location of this splitCell
// - absoluteValue: location relative to screen, in range of [0,1]
//  - for caching locations 
public class SplitCell implements Comparable {
	
	public static boolean getSplitCell = false;
	public static SplitCell splitCellFound = null;
	
	public int parent;
	public int kid[]; // might be redundant, can be computed on the fly
	public int min, max; // indices into splitline array
	public int computedFrame;
	
	public Object cullingObject; // different for each rendering type
	// SequenceJuxtaposer: cache SiteNode colors in a treeset for each range
	
	public double splitValue;
	public double absoluteValue;
	
	public SplitCell(int min, int max)
	{
		this.min = min;
		this.max = max;
	}
	
	public SplitCell(int cellIndex)
	{
		this.min = cellIndex-1;
		this.max = cellIndex;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
	 * overlaps must be of at least a cell, so if min = o.max then o is not overlapping since it's only adjacent
	 */
	public int compareTo(Object o) {
		SplitCell other = (SplitCell)o;
		if (other.min >= max)
			return -1;
		if (other.max <= min)
			return 1;
		if (getSplitCell)
			splitCellFound = other;
		getSplitCell = false;
		return 0;
	}
	
	public String toString()
	{
		return "[" + min + ", " + max + "]";
	}
	
	// debugging only, this may be slow
	public double getSize(SplitLine sl)
	{
		int frameNum = sl.ad.getFrameNum();
		return sl.getAbsoluteValue(max, frameNum) - sl.getAbsoluteValue(min, frameNum);
	}
	
	public static SplitCell getOverlapSplitCell(TreeSet searchTree, SplitCell input)
	{
		SplitCell.getSplitCell = true;
		if (searchTree.contains(input))
			return SplitCell.splitCellFound;
//		System.out.println("Error: unable to find split cell: " + input);
		return null;
	}
}

⌨️ 快捷键说明

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