1 17 package org.eclipse.emf.edit.provider; 18 19 20 import java.util.ArrayList ; 21 import java.util.Collection ; 22 import java.util.Iterator ; 23 import java.util.List ; 24 25 26 29 public class ComposedImage 30 { 31 public static class Point 32 { 33 public int x; 34 public int y; 35 } 36 37 public static class Size 38 { 39 public int width; 40 public int height; 41 } 42 43 protected List images; 44 protected List imageSizes; 45 46 49 public ComposedImage(Collection images) 50 { 51 this.images = new ArrayList (images); 52 } 53 54 public boolean equals(Object that) 55 { 56 return that instanceof ComposedImage && ((ComposedImage)that).getImages().equals(images); 57 } 58 59 public int hashCode() 60 { 61 return images.hashCode(); 62 } 63 64 public List getImages() 65 { 66 return images; 67 } 68 69 public Size getSize(Collection imageSizes) 70 { 71 this.imageSizes = new ArrayList (imageSizes); 72 Size result = new Size(); 73 for (Iterator sizes = imageSizes.iterator(); sizes.hasNext(); ) 74 { 75 Size size = (Size)sizes.next(); 76 result.width = Math.max(result.width, size.width); 77 result.height = Math.max(result.height, size.height); 78 } 79 return result; 80 } 81 82 public List getDrawPoints(Size size) 83 { 84 List results = new ArrayList (); 85 for (int i = imageSizes.size(); i > 0; --i) 86 { 87 Point result = new Point(); 88 results.add(result); 89 } 90 return results; 91 } 92 } 93 | Popular Tags |