Index: ContrastOperation.java
===================================================================
--- ContrastOperation.java	(revision 43861)
+++ ContrastOperation.java	(revision 43862)
@@ -23,7 +23,6 @@
 package org.gvsig.raster.lib.legend.impl.operations.contrast;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
@@ -36,7 +35,6 @@
 import org.gvsig.raster.lib.buffer.api.exceptions.BufferOperationException;
 import org.gvsig.raster.lib.buffer.api.operations.OperationFactory;
 import org.gvsig.raster.lib.buffer.spi.exceptions.ProcessingOperationException;
-import org.gvsig.raster.lib.buffer.spi.operations.AbstractOperation;
 import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
 import org.gvsig.raster.lib.legend.api.RasterLegendManager;
 import org.gvsig.raster.lib.legend.api.colorinterpretation.ColorInterpretation;
@@ -60,7 +58,7 @@
      *
      */
     public ContrastOperation(OperationFactory factory) {
-        this.factory = factory;
+        super(factory);
     }
 
     @Override
@@ -69,46 +67,53 @@
         BufferManager manager = BufferLocator.getBufferManager();
         RasterLegendManager legendManager = RasterLegendLocator.getRasterLegendManager();
 
-        contrast = (Integer) this.parameters.getDynValue(CONTRAST_PARAM);
+        contrast = (Integer) this.getParameter(CONTRAST_PARAM,0);
 
-        int bands = this.buffer.getBandCount();
+        int bands = this.getInputBuffer().getBandCount();
         NoData[] noData;
-        if (copyUnprocessedBands) {
-            this.parameters.setDynValue(OUTPUT_COLOR_INTERPRETATION_PARAM, colorInterpretation);
-            noData = this.buffer.getBandNoData();
+        if (mustCopyUnprocessedBands()) {
+            this.setParameter(OUTPUT_COLOR_INTERPRETATION_PARAM, getInputColorInterpretation());
+            noData = this.getInputBuffer().getBandNoData();
             try {
-                this.outputBuffer =
-                    manager.createBuffer(this.buffer.getRows(), this.buffer.getColumns(), this.buffer.getBandTypes(),
-                        this.buffer.getBandNoData(), this.buffer.getProjection(), this.buffer.getEnvelope());
-            } catch (LocatorException | BufferException | CreateEnvelopeException e) {
+                this.setOutputBuffer( 
+                    manager.createBuffer(
+                            this.getInputBuffer().getRows(), 
+                            this.getInputBuffer().getColumns(), 
+                            this.getInputBuffer().getBandTypes(),
+                            this.getInputBuffer().getBandNoData(), 
+                            this.getInputBuffer().getProjection(), 
+                            this.getInputBuffer().getEnvelope()));
+            } catch (Exception e) {
                 throw new ProcessingOperationException(e);
             }
         } else {
-            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<>();
             for (int band = 0; band < bands; band++) {
                 if (isProcessableBand(band)) {
-                    colorInterpretations.add(colorInterpretation.get(band));
-                    noDatas.add(this.buffer.getBandNoData()[band]);
-                    types.add(this.buffer.getBandTypes()[band]);
+                    colorInterpretations.add(getInputColorInterpretation().get(band));
+                    noDatas.add(this.getInputBuffer().getBandNoData()[band]);
+                    types.add(this.getInputBuffer().getBandTypes()[band]);
                 }
             }
-            if (colorInterpretation.hasAlphaBand()) {
+            if (getInputColorInterpretation().hasAlphaBand()) {
                 colorInterpretations.add(ColorInterpretation.ALPHA_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 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());
             try {
-                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);
             }
@@ -119,13 +124,13 @@
     @Override
     public void process() throws ProcessingOperationException {
         super.process();
-        for (int band=0; band<this.buffer.getBandCount(); band++){
+        for (int band=0; band<this.getInputBuffer().getBandCount(); band++){
             rowProcessor = new ByteRowProcessor(band);
             if (isProcessableBand(band)) {
-                Band bufferBand = this.buffer.getBand(band);
-                Band outputBufferBand = this.outputBuffer.getBand(band);
+                Band bufferBand = this.getInputBuffer().getBand(band);
+                Band outputBufferBand = this.getOutputBuffer().getBand(band);
 
-                for (int row = 0; row < this.buffer.getRows(); row++) {
+                for (int row = 0; row < this.getInputBuffer().getRows(); row++) {
                     Object rowBuffer = bufferBand.createRowBuffer();
                     bufferBand.fetchRow(row, rowBuffer);
 
@@ -136,15 +141,15 @@
 
                     outputBufferBand.putRow(row, outputRowBuffer);
                 }
-            } else if (copyUnprocessedBands) {
+            } else if (mustCopyUnprocessedBands()) {
                 try {
-                    this.outputBuffer.getBand(band).copyFrom(this.buffer.getBand(band));
+                    this.getOutputBuffer().getBand(band).copyFrom(this.getInputBuffer().getBand(band));
                 } catch (BandException e) {
                     throw new ProcessingOperationException(e);
                 }
-            } else if (colorInterpretation.isAlphaInterpretation(band)) {
+            } else if (getInputColorInterpretation().isAlphaInterpretation(band)) {
                 try {
-                    this.outputBuffer.getBand(outputColorInterpretation.getAlphaBand()).copyFrom(this.buffer.getBand(band));
+                    this.getOutputBuffer().getBand(getOutputColorInterpretation().getAlphaBand()).copyFrom(this.getInputBuffer().getBand(band));
                 } catch (BandException e) {
                     throw new ProcessingOperationException(e);
             }
@@ -156,12 +161,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) ||
@@ -186,7 +192,7 @@
 
         public AbstractRowProcessor(int band) {
 //            this.band = band;
-            noData = buffer.getBand(band).getNoData();
+            noData = getInputBuffer().getBand(band).getNoData();
             if(noData.isDefined()) {
                 minResult = (byte)1;
             }
@@ -215,7 +221,7 @@
                 return (byte)value;
             }
 
-            int iValue = 0xFF & ((Byte) value).byteValue();
+            int iValue = 0xFF & ((Byte) value);
 
             //FIXME: Copiado del raster viejo. No entiendo los cálculos
 
