Index: RGBToCMYKOperation.java
===================================================================
--- RGBToCMYKOperation.java	(revision 43861)
+++ RGBToCMYKOperation.java	(revision 43862)
@@ -23,7 +23,6 @@
 package org.gvsig.raster.lib.legend.impl.operations.rgbtocmyk;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.slf4j.Logger;
@@ -60,7 +59,7 @@
      *
      */
     public RGBToCMYKOperation(OperationFactory factory) {
-        this.factory = factory;
+        super(factory);
     }
 
     @Override
@@ -70,20 +69,20 @@
         RasterLegendManager legendManager = RasterLegendLocator.getRasterLegendManager();
 
         try {
-            if (!(colorInterpretation.isGray() || colorInterpretation.isRGB())) {
+            if (!(getInputColorInterpretation().isGray() || getInputColorInterpretation().isRGB())) {
                 throw new UnsupportedOperationException(
                     "The color interpretation of input buffer isn't RGB nor GRAYSCALE");
             }
 
-            int[] inputBandTypes = buffer.getBandTypes();
-            if (colorInterpretation.isGray()) {
-                if (inputBandTypes[colorInterpretation.getBand(ColorInterpretation.GRAY_BAND)] != BufferManager.TYPE_BYTE) {
+            int[] inputBandTypes = getInputBuffer().getBandTypes();
+            if (getInputColorInterpretation().isGray()) {
+                if (inputBandTypes[getInputColorInterpretation().getBand(ColorInterpretation.GRAY_BAND)] != BufferManager.TYPE_BYTE) {
                     throw new UnsupportedOperationException("The type of GRAY band isn't BYTE");
                 }
-            } else if (colorInterpretation.isRGB()) {
-                if (inputBandTypes[colorInterpretation.getBand(ColorInterpretation.RED_BAND)] != BufferManager.TYPE_BYTE
-                    || inputBandTypes[colorInterpretation.getBand(ColorInterpretation.GREEN_BAND)] != BufferManager.TYPE_BYTE
-                    || inputBandTypes[colorInterpretation.getBand(ColorInterpretation.BLUE_BAND)] != BufferManager.TYPE_BYTE) {
+            } else if (getInputColorInterpretation().isRGB()) {
+                if (inputBandTypes[getInputColorInterpretation().getBand(ColorInterpretation.RED_BAND)] != BufferManager.TYPE_BYTE
+                    || inputBandTypes[getInputColorInterpretation().getBand(ColorInterpretation.GREEN_BAND)] != BufferManager.TYPE_BYTE
+                    || inputBandTypes[getInputColorInterpretation().getBand(ColorInterpretation.BLUE_BAND)] != BufferManager.TYPE_BYTE) {
                     throw new UnsupportedOperationException("The type of RGB bands isn't BYTE");
                 }
             } else {
@@ -91,13 +90,13 @@
                     "The color interpretation of input buffer isn't RGB nor GRAYSCALE");
             }
 
-            int sourceBands = this.buffer.getBandCount();
-            NoData[] sourceNoDatas = this.buffer.getBandNoData();
-            int[] sourceTypes = this.buffer.getBandTypes();
+            int sourceBands = this.getInputBuffer().getBandCount();
+            NoData[] sourceNoDatas = this.getInputBuffer().getBandNoData();
+            int[] sourceTypes = this.getInputBuffer().getBandTypes();
 
-            List<String> colorInterpretations = new ArrayList<String>();
-            List<NoData> noDatas = new ArrayList<NoData>();
-            List<Integer> types = new ArrayList<Integer>();
+            List<String> colorInterpretations = new ArrayList<>();
+            List<NoData> noDatas = new ArrayList<>();
+            List<Integer> types = new ArrayList<>();
 
             colorInterpretations.add(ColorInterpretation.CYAN_BAND);
             colorInterpretations.add(ColorInterpretation.MAGENTA_BAND);
@@ -114,8 +113,8 @@
             noDatas.add(null);
             noDatas.add(null);
 
-            if (colorInterpretation.hasAlphaBand()) {
-                int alphaBand = colorInterpretation.getAlphaBand();
+            if (getInputColorInterpretation().hasAlphaBand()) {
+                int alphaBand = getInputColorInterpretation().getAlphaBand();
                 if(sourceTypes[alphaBand]!=BufferManager.TYPE_BYTE){
                     throw new UnsupportedOperationException("The type of ALPHA band isn't BYTE");
                 }
@@ -124,29 +123,28 @@
                 noDatas.add(sourceNoDatas[alphaBand]);
             }
 
-            if (copyUnprocessedBands) {
+            if (mustCopyUnprocessedBands()) {
                 for (int band = 0; band < sourceBands; band++) {
-                    if (!isProcessableBand(band) && !colorInterpretation.isAlphaInterpretation(band)) {
+                    if (!isProcessableBand(band) && !getInputColorInterpretation().isAlphaInterpretation(band)) {
                         colorInterpretations.add(ColorInterpretation.UNDEFINED_BAND);
                         noDatas.add(sourceNoDatas[band]);
-                        types.add(this.buffer.getBandTypes()[band]);
+                        types.add(this.getInputBuffer().getBandTypes()[band]);
                     }
                 }
             }
 
-            outputColorInterpretation =
-                legendManager.createColorInterpretation(colorInterpretations.toArray(new String[0]));
-            this.parameters.setDynValue(OUTPUT_COLOR_INTERPRETATION_PARAM, outputColorInterpretation);
-            int[] typesInt = new int[types.size()];
-            for (Iterator<Integer> iterator = types.iterator(); iterator.hasNext();) {
-                int i = 0;
-                Integer type = (Integer) iterator.next();
-                typesInt[i] = type.intValue();
-            }
+            setOutputColorInterpretation(
+                legendManager.createColorInterpretation(colorInterpretations));
+            this.setParameter(OUTPUT_COLOR_INTERPRETATION_PARAM, getOutputColorInterpretation());
 
-            this.outputBuffer =
-                manager.createBuffer(this.buffer.getRows(), this.buffer.getColumns(), typesInt,
-                    noDatas.toArray(new NoData[0]), this.buffer.getProjection(), this.buffer.getEnvelope());
+            this.setOutputBuffer(
+                manager.createBuffer(
+                        this.getInputBuffer().getRows(), 
+                        this.getInputBuffer().getColumns(), 
+                        this.getTypesAsArray(types),
+                        this.getNoDatasAsArray(noDatas), 
+                        this.getInputBuffer().getProjection(), 
+                        this.getInputBuffer().getEnvelope()));
         } catch (LocatorException | BufferException | CreateEnvelopeException e) {
             throw new ProcessingOperationException(e);
         }
@@ -159,15 +157,15 @@
 
             // List<Integer> bandsToProcess = new ArrayList<Integer>();
 
-            if (copyUnprocessedBands) {
-                int bands = this.buffer.getBandCount();
-                int outBand = colorInterpretation.hasAlphaBand() ? 5 : 4;
+            if (mustCopyUnprocessedBands()) {
+                int bands = this.getInputBuffer().getBandCount();
+                int outBand = getInputColorInterpretation().hasAlphaBand() ? 5 : 4;
                 for (int band = 0; band < bands; band++) {
-                    if (colorInterpretation.isAlphaInterpretation(band)) {
-                        outputBuffer.getBand(outputColorInterpretation.getAlphaBand()).copyFrom(
-                            this.buffer.getBand(band));
+                    if (getInputColorInterpretation().isAlphaInterpretation(band)) {
+                        getOutputBuffer().getBand(getOutputColorInterpretation().getAlphaBand()).copyFrom(
+                            this.getInputBuffer().getBand(band));
                     } else if (!isProcessableBand(band)) {
-                        outputBuffer.getBand(outBand).copyFrom(this.buffer.getBand(band));
+                        getOutputBuffer().getBand(outBand).copyFrom(this.getInputBuffer().getBand(band));
                         outBand++;
                     }
                 }
@@ -175,9 +173,9 @@
 
             Object[] rowBandsBuffer = new Object[3];
 
-            for (int row = 0; row < this.buffer.getRows(); row++) {
-                if (colorInterpretation.isGray()) {
-                    Band bufferBandGray = buffer.getBand(colorInterpretation.getBand(ColorInterpretation.GRAY_BAND));
+            for (int row = 0; row < this.getInputBuffer().getRows(); row++) {
+                if (getInputColorInterpretation().isGray()) {
+                    Band bufferBandGray = getInputBuffer().getBand(getInputColorInterpretation().getBand(ColorInterpretation.GRAY_BAND));
                     rowBandsBuffer[0] = bufferBandGray.createRowBuffer();
                     bufferBandGray.fetchRow(row, rowBandsBuffer[0]);
                     rowBandsBuffer[1] = bufferBandGray.createRowBuffer();
@@ -185,20 +183,20 @@
                     rowBandsBuffer[2] = bufferBandGray.createRowBuffer();
                     bufferBandGray.fetchRow(row, rowBandsBuffer[2]);
                 } else {
-                    Band bufferBandRed = buffer.getBand(colorInterpretation.getBand(ColorInterpretation.RED_BAND));
+                    Band bufferBandRed = getInputBuffer().getBand(getInputColorInterpretation().getBand(ColorInterpretation.RED_BAND));
                     rowBandsBuffer[0] = bufferBandRed.createRowBuffer();
                     bufferBandRed.fetchRow(row, rowBandsBuffer[0]);
-                    Band bufferBandGreen = buffer.getBand(colorInterpretation.getBand(ColorInterpretation.GREEN_BAND));
+                    Band bufferBandGreen = getInputBuffer().getBand(getInputColorInterpretation().getBand(ColorInterpretation.GREEN_BAND));
                     rowBandsBuffer[1] = bufferBandGreen.createRowBuffer();
                     bufferBandGreen.fetchRow(row, rowBandsBuffer[1]);
-                    Band bufferBandBlue = buffer.getBand(colorInterpretation.getBand(ColorInterpretation.BLUE_BAND));
+                    Band bufferBandBlue = getInputBuffer().getBand(getInputColorInterpretation().getBand(ColorInterpretation.BLUE_BAND));
                     rowBandsBuffer[2] = bufferBandBlue.createRowBuffer();
                     bufferBandBlue.fetchRow(row, rowBandsBuffer[2]);
                 }
 
                 List<Object> outputRowBuffers = new ArrayList<Object>();
                 for (int band = 0; band < 4; band++) {
-                    Band outputBufferBand = outputBuffer.getBand(band);
+                    Band outputBufferBand = getOutputBuffer().getBand(band);
                     Object outputRowBuffer = outputBufferBand.createRowBuffer();
                     outputRowBuffers.add(outputRowBuffer);
                 }
@@ -206,7 +204,7 @@
                 processRow(rowBandsBuffer, outputRowBuffers);
 
                 for (int band = 0; band < 4; band++) {
-                    Band outputBufferBand = outputBuffer.getBand(band);
+                    Band outputBufferBand = getOutputBuffer().getBand(band);
                     outputBufferBand.putRow(row, outputRowBuffers.get(band));
                 }
 
@@ -243,12 +241,13 @@
      * @param band
      * @return
      */
-    private boolean isProcessableBand(int band) {
-        return isRGBorGrayBand(band) && this.buffer.getBandTypes()[band] == BufferManager.TYPE_BYTE;
+    @Override
+    protected boolean isProcessableBand(int band) {
+        return isRGBorGrayBand(band) && this.getInputBuffer().getBandTypes()[band] == BufferManager.TYPE_BYTE;
     }
 
     private boolean isRGBorGrayBand(int band) {
-        String bandColorInterpretation = colorInterpretation.get(band);
+        String bandColorInterpretation = getInputColorInterpretation().get(band);
         return (bandColorInterpretation.equals(ColorInterpretation.RED_BAND)
             || bandColorInterpretation.equals(ColorInterpretation.GREEN_BAND)
             || bandColorInterpretation.equals(ColorInterpretation.BLUE_BAND) || bandColorInterpretation
