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

net.anotheria.moskito.webui.journey.api.TracedCallDuplicateStepsAO Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
package net.anotheria.moskito.webui.journey.api;

import net.anotheria.util.BasicComparable;
import net.anotheria.util.sorter.IComparable;

import java.io.Serializable;
import java.util.List;

/**
 * This bean represents a duplicate step during a journey call. 
 * @author lrosenberg
 *
 */
public class TracedCallDuplicateStepsAO implements IComparable, Serializable{
	/**
	 * SerialVersionUID.
	 */
	private static final long serialVersionUID = 6005382235767306653L;

	/**
	 * Call description aka method name and parameters.
	 */
	private String call;
	/**
	 * Positions in journey call it occures at.
	 */
	private List positions;
	
	/**
	 * Total duration of the calls in this duplicate.
	 */
	private long duration;
	
	/**
	 * Total time spent int the calls in this duplicate.
	 */
	private long timespent;

	public String getCall() {
		return call;
	}
	public void setCall(String call) {
		this.call = call;
	}
	public List getPositions() {
		return positions;
	}
	public void setPositions(List positions) {
		this.positions = positions;
	}
	
	public int getNumberOfCalls(){
		return positions.size();
	}
	public long getDuration() {
		return duration;
	}
	public void setDuration(long duration) {
		this.duration = duration;
	}
	public long getTimespent() {
		return timespent;
	}
	public void setTimespent(long timespent) {
		this.timespent = timespent;
	}
	@Override
	public int compareTo(
			IComparable anotherObject,
			int method) {
		switch(method){
		case TracedCallDuplicateStepsAOSortType.SORT_BY_CALL:
			return BasicComparable.compareString(call, ((TracedCallDuplicateStepsAO)anotherObject).call);
		case TracedCallDuplicateStepsAOSortType.SORT_BY_POSITIONS:
			return BasicComparable.compareList(positions, ((TracedCallDuplicateStepsAO)anotherObject).positions);
		case TracedCallDuplicateStepsAOSortType.SORT_BY_TIMESPENT:
			return BasicComparable.compareLong(timespent, ((TracedCallDuplicateStepsAO)anotherObject).timespent);
		case TracedCallDuplicateStepsAOSortType.SORT_BY_DURATION:
			return BasicComparable.compareLong(duration, ((TracedCallDuplicateStepsAO)anotherObject).duration);
		default:
			throw new IllegalArgumentException("Unsupported method: "+method);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy