01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.workflow.spi.ejb;
06:
07: import com.opensymphony.workflow.spi.Step;
08:
09: import java.util.Comparator;
10:
11: /**
12: * Utility class to order steps in a descending order.
13: *
14: * @author <a href="mailto:plightbo@hotmail.com">Pat Lightbody</a>
15: */
16: public class StepComparator implements Comparator {
17: //~ Methods ////////////////////////////////////////////////////////////////
18:
19: public int compare(Object o1, Object o2) {
20: Step step1 = (Step) o1;
21: Step step2 = (Step) o2;
22:
23: if (step1.getId() > step2.getId()) {
24: return -1;
25: } else if (step1.getId() < step2.getId()) {
26: return 1;
27: } else {
28: return 0;
29: }
30: }
31: }
|