All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.plasma.query.collector.SelectionProperty Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package org.plasma.query.collector;

import java.util.Comparator;

import commonj.sdo.Property;

public class SelectionProperty implements Comparable {
    private commonj.sdo.Property property;
    private int sequence;
    
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((property == null) ? 0 : property.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SelectionProperty other = (SelectionProperty) obj;
		if (property == null) {
			if (other.property != null)
				return false;
		} else if (!property.equals(other.property))
			return false;
		return true;
	}
	
	@Override
	public int compareTo(SelectionProperty o) {		 
		return Integer.valueOf(this.getSequence()).compareTo(Integer.valueOf(o.getSequence()));
	}

	public SelectionProperty(Property property, int sequence) {
		super();
		this.property = property;
		this.sequence = sequence;
	}
	public commonj.sdo.Property getProperty() {
		return property;
	}
	public int getSequence() {
		return sequence;
	}
	
	static Comparator comp;
	static Comparator getComparator() {
		if (comp == null) {
			comp = new Comparator() {
				@Override
				public int compare(SelectionProperty o1, SelectionProperty o2) {
					return Integer.valueOf(o1.getSequence()).compareTo(Integer.valueOf(o2.getSequence()));
				}			
		    };
		}
		return comp;
	}
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy