Code Search for Developers
 
 
  

FlowEntryComparator.java from PovClipse at Krugle


Show FlowEntryComparator.java syntax highlighted

/* PovClipse - Eclipse plugin for editing and rendering Povray sceene files.
 * Copyright (C) 2006-2007  Wolfgang Moestl  wmoestl@web.de
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program 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
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

package com.wm.povclipse.dialogs.flow;

import java.util.Comparator;

/**
 * Comparator used for the <code>FlowEntry</code> set of <code>FlowWidgets</code>.
 * @author Wolfgang M&ouml;stl
 */
public class FlowEntryComparator implements Comparator<IFlowEntry> {

	/**
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
	public int compare(IFlowEntry flowEntryOne, IFlowEntry flowEntryTwo) {
		if (null == flowEntryOne) throw new IllegalArgumentException("The first object is NULL!");
		if (null == flowEntryTwo) throw new IllegalArgumentException("The second object is NULL!");
		
		if (null == flowEntryOne && null == flowEntryTwo)
			return 0; // the're equal!
		
		if (null == flowEntryOne)
			return -1;
		
		if (null == flowEntryTwo)
			return 1;
		
		// The're both not null								
		Float val1 = flowEntryOne.getPosition();
		Float val2 = flowEntryTwo.getPosition();
		
		return val1.compareTo(val2);
	}

}




See more files for this project here

PovClipse

PovClipse is an eclipse editor plugin for Povray (Persistence of Vision Raytracer) sceene- and include files.\r\nIt features syntax highlighting, code folding, code assist, outline view as well as running Povray using render configurations.

Project homepage: http://sourceforge.net/projects/povclipse
Programming language(s): Java
License: other

  color/
    ColorFlowDialog.java
    ColorFlowEntry.java
    ColorFlowWidget.java
  AbstractFlowEntry.java
  AbstractFlowWidget.java
  FlowEntryComparator.java
  FlowEntryValueDialog.java
  IFlowEntry.java