Transform an object
in to another object

@param input the record to transform
@return the transformed writable
161653
@Override
    public Object map(Object input) {
        if (input instanceof Number) {
            Number number = (Number) input;
            return doOp(number.doubleValue());
        }
        throw new IllegalArgumentException("Input must be a number");
    }
1065520
@GwtIncompatible("incompatible method")
    public final String translate(final CharSequence input) {
        if (input == null) {
            return null;
        }
        try {
            final StringWriter writer = new StringWriter(input.length() * 2);
            translate(input, writer);
            return writer.toString();
        } catch (final IOException ioe) {
            // this should never ever happen while writing to a StringWriter
            throw new RuntimeException(ioe);
        }
    }
964165
@Override
    public Object map(Object input) {
        int currValue = ((Number) input).intValue();
        if (currValue < minValue || currValue > maxValue) {
            throw new IllegalStateException("Invalid value: integer value (" + currValue + ") is outside of "
                            + "valid range: must be between " + minValue + " and " + maxValue + " inclusive");
        }

        List<Integer> oneHot = new ArrayList<>();
        for (int j = minValue; j <= maxValue; j++) {
            if (j == currValue) {
                oneHot.add(1);
            } else {
                oneHot.add(0);
            }
        }
        return oneHot;
    }
951213
public Object expand(Object input) {
        if (input instanceof List) {
            expandList((List<Object>) input);
            return input;
        } else if (input instanceof Map) {
            expandMap((Map<String, Object>) input);
            return input;
        } else if (input instanceof String) {
            return getJson((String) input);
        } else {
            return input;
        }
    }
1208340
@Override
    public Object map(Object input) {
        String s = input.toString();
        if (s == null || s.isEmpty())
            return value;
        else if (s instanceof String)
            return s;
        else
            return s;
    }
1342682
@Override
    public Object map(Object input) {
        String value = input.toString().replaceAll("\\s", "");
        return value;
    }
1336295
@Override
    public Object map(Object input) {
        String value = input.toString();
        //Do conversion
        Integer classIdx = statesMap.get(value);
        if (classIdx == null) {
            throw new IllegalStateException("Cannot convert categorical value to integer value: input value (\"" + value
                    + "\") is not in the list of known categories (state names/categories: " + stateNames + ")");
        }
        return classIdx;
    }
27348
public MultiPolygonTo toTransferObject(MultiPolygon input) {
        MultiPolygonTo result = new MultiPolygonTo();
        double[][][][] coordinates = new double[input.getNumGeometries()][][][];
        for (int i = 0; i < input.getNumGeometries(); i++) {
            coordinates[i] = toTransferObject(input.getGeometryN(i)).getCoordinates();
        }
        result.setCoordinates(coordinates);
        result.setCrs(GeoJsonTo.createCrsTo("EPSG:" + input.getSRID()));
        return result;
    }
543064
private static Object getObjectFromWritable(Writable writable)
            throws IllegalAccessException, InstantiationException, InvocationTargetException {
        Object object = null;

        if (writable instanceof NullWritable) {
            object = NullWritable.get();
        } else if (writable instanceof BooleanWritable) {
            object = ((BooleanWritable) writable).get();
        } else if (writable instanceof Text) {
            object = writable.toString();
        } else if (writable instanceof ByteWritable) {
            object = ((ByteWritable) writable).get();
        } else if (writable instanceof IntWritable) {
            object = ((IntWritable) writable).get();
        } else if (writable instanceof LongWritable) {
            object = ((LongWritable) writable).get();
        } else if (writable instanceof BytesWritable) {
            object = ((BytesWritable) writable).getBytes();
        } else if (writable instanceof DoubleWritable) {
            object = ((DoubleWritable) writable).get();
        } else if (writable instanceof FloatWritable) {
            object = ((FloatWritable) writable).get();
        } else {
            // TODO : do nothing
        }

        return object;
    }
747909
@Override
    public Object transform( Object input ) {

        Map<String,Object> output = new HashMap<>();

        // Create a root LiteralPathElement so that # is useful at the root level
        MatchedElement rootLpe = new MatchedElement( ROOT_KEY );
        WalkedPath walkedPath = new WalkedPath();
        walkedPath.add( input, rootLpe );

        rootSpec.apply( ROOT_KEY, Optional.of( input ), walkedPath, output, null );

        return output.get( ROOT_KEY );
    }
1211734
public static <K, V1, V2> Iterable<Map.Entry<K, V2>> transformValues(
      Iterable<Map.Entry<K, V1>> input,
      final Function<? super V1, V2> valueTransformer) {
    return Iterables.transform(input, new Function<Entry<K, V1>, Entry<K, V2>>() {
      @Override
      public Entry<K, V2> apply(final Entry<K, V1> input) {
        return Maps.immutableEntry(input.getKey(), valueTransformer.apply(input.getValue()));
      }
    });
  }
676706
private Map<String, String> flatten(Map<String, ?> input) {
        Map<String, String> result = new HashMap<String, String>();

        for (Map.Entry<String, ?> entry : input.entrySet()) {
            for (Map.Entry<String, String> flattened : flatten(entry)) {
                if (flattened.getValue() != null) {
                    result.put(flattened.getKey(), flattened.getValue());
                }
            }
        }

        return result;
    }
872680
public static Number transformNumber( Number input ) {
      if( input instanceof Float ){
         return new Double( input.toString() );
      }else if( input instanceof Short ){
         return new Integer( input.intValue() );
      }else if( input instanceof Byte ){
         return new Integer( input.intValue() );
      }else if( input instanceof Long ){
         Long max = new Long( Integer.MAX_VALUE );
         if( input.longValue() <= max.longValue() && input.longValue() >= Integer.MIN_VALUE ){
            return new Integer( input.intValue() );
         }
      }

      return input;
   }
371024
public PolygonTo toTransferObject(Polygon input) {
        PolygonTo result = new PolygonTo();
        result.setCrs(GeoJsonTo.createCrsTo("EPSG:" + input.getSRID()));
        double[][][] rings = new double[input.getNumInteriorRing() + 1][][];
        // Exterior ring:
        rings[0] = getPoints(input.getExteriorRing());
        // Interior rings!
        for (int i = 0; i < input.getNumInteriorRing(); i++) {
            rings[i + 1] = getPoints(input.getInteriorRingN(i));
        }
        result.setCoordinates(rings);
        return result;
    }
833224
public MultiLineStringTo toTransferObject(MultiLineString input) {
        MultiLineStringTo result = new MultiLineStringTo();
        double[][][] resultCoordinates = new double[input.getNumGeometries()][][];
        for (int i = 0; i < input.getNumGeometries(); i++) {
            resultCoordinates[i] = getPoints(input.getGeometryN(i));
        }
        result.setCoordinates(resultCoordinates);
        result.setCrs(GeoJsonTo.createCrsTo("EPSG:" + input.getSRID()));
        return result;
    }
785439
public static GrayF32 transform(GrayF32 input , GrayF32 transformed ) {
		transformed = InputSanityCheck.checkDeclare(input,transformed);

		ImplIntegralImageOps.transform(input,transformed);

		return transformed;
	}
951438
@SuppressWarnings("unchecked")
    public static <T> Parcelable wrap(T input) {
        if(input == null){
            return null;
        }
        return wrap(input.getClass(), input);
    }