Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 4 package com.openedit.store; 5 6 import java.util.ArrayList ; 7 import java.util.Comparator ; 8 import java.util.List ; 9 10 14 public class SizeComparator implements Comparator { 15 protected List fieldSortedSizes; 16 17 20 public int compare(Object in01, Object in02) { 21 String first = (String )in01; 22 String second = (String )in02; 23 int firstIndex = getSortedSizes().indexOf(first); 24 int secondIndex = getSortedSizes().indexOf(second); 25 if ( firstIndex == secondIndex) 26 { 27 return 0; 28 } 29 if ( firstIndex > secondIndex) 30 { 31 return 1; 32 } 33 return -1; 34 } 35 36 public List getSortedSizes() { 37 if (fieldSortedSizes == null) { 38 fieldSortedSizes = new ArrayList (); 39 fieldSortedSizes.add("P"); 40 fieldSortedSizes.add("NB"); 41 fieldSortedSizes.add("0M"); 42 fieldSortedSizes.add("3M"); 43 fieldSortedSizes.add("6M"); 44 fieldSortedSizes.add("9M"); 45 fieldSortedSizes.add("12M"); 46 fieldSortedSizes.add("18M"); 47 fieldSortedSizes.add("24M"); 48 fieldSortedSizes.add("2T"); 49 fieldSortedSizes.add("3T"); 50 fieldSortedSizes.add("4T"); 51 fieldSortedSizes.add("4"); 52 fieldSortedSizes.add("5"); 53 fieldSortedSizes.add("6"); 54 fieldSortedSizes.add("6X"); 55 fieldSortedSizes.add("7"); 56 fieldSortedSizes.add("8"); 57 fieldSortedSizes.add("10"); 58 fieldSortedSizes.add("12"); 59 fieldSortedSizes.add("14"); 60 fieldSortedSizes.add("16"); 61 fieldSortedSizes.add("N/A"); 62 63 } 64 return fieldSortedSizes; 65 } 66 public void setSortedSizes(List inSortedSizes) { 67 fieldSortedSizes = inSortedSizes; 68 } 69 } 70
| Popular Tags
|