@Test public void testGetColorModelType() { Category[] categories = new Category[0]; ColorModel cm1 = ColorModelFactory.getColorModel(categories, DataBuffer.TYPE_BYTE, 0, 1); assertEquals(DataBuffer.TYPE_BYTE, cm1.getTransferType()); ColorModel cm2 = ColorModelFactory.getColorModel(categories, DataBuffer.TYPE_USHORT, 0, 1); assertEquals(DataBuffer.TYPE_USHORT, cm2.getTransferType()); ColorModel cm3 = ColorModelFactory.getColorModel(categories, DataBuffer.TYPE_FLOAT, 0, 1); assertEquals(DataBuffer.TYPE_FLOAT, cm3.getTransferType()); ColorModel cm4 = ColorModelFactory.getColorModel(categories, DataBuffer.TYPE_DOUBLE, 0, 1); assertEquals(DataBuffer.TYPE_DOUBLE, cm4.getTransferType()); }
public static ColorModel getColorModel( final Category[] categories, final int type, final int visibleBand, final int numBands) { synchronized (colors) { ColorModelFactory key = new ColorModelFactory(categories, type, visibleBand, numBands); ColorModel model = colors.get(key); if (model == null) { model = key.getColorModel(); colors.put(key, model); } return model; } }
ColorModelFactory { public static ColorModel getColorModel( final Category[] categories, final int type, final int visibleBand, final int numBands) { synchronized (colors) { ColorModelFactory key = new ColorModelFactory(categories, type, visibleBand, numBands); ColorModel model = colors.get(key); if (model == null) { model = key.getColorModel(); colors.put(key, model); } return model; } } }
ColorModelFactory { public static ColorModel getColorModel( final Category[] categories, final int type, final int visibleBand, final int numBands) { synchronized (colors) { ColorModelFactory key = new ColorModelFactory(categories, type, visibleBand, numBands); ColorModel model = colors.get(key); if (model == null) { model = key.getColorModel(); colors.put(key, model); } return model; } } private  ColorModelFactory(
            final Category[] categories,
            final int type,
            final int visibleBand,
            final int numBands); }
ColorModelFactory { public static ColorModel getColorModel( final Category[] categories, final int type, final int visibleBand, final int numBands) { synchronized (colors) { ColorModelFactory key = new ColorModelFactory(categories, type, visibleBand, numBands); ColorModel model = colors.get(key); if (model == null) { model = key.getColorModel(); colors.put(key, model); } return model; } } private  ColorModelFactory(
            final Category[] categories,
            final int type,
            final int visibleBand,
            final int numBands); static ColorModel getColorModel(
            final Category[] categories,
            final int type,
            final int visibleBand,
            final int numBands); @Override int hashCode(); @Override boolean equals(final Object other); }
ColorModelFactory { public static ColorModel getColorModel( final Category[] categories, final int type, final int visibleBand, final int numBands) { synchronized (colors) { ColorModelFactory key = new ColorModelFactory(categories, type, visibleBand, numBands); ColorModel model = colors.get(key); if (model == null) { model = key.getColorModel(); colors.put(key, model); } return model; } } private  ColorModelFactory(
            final Category[] categories,
            final int type,
            final int visibleBand,
            final int numBands); static ColorModel getColorModel(
            final Category[] categories,
            final int type,
            final int visibleBand,
            final int numBands); @Override int hashCode(); @Override boolean equals(final Object other);  }