Transform an object
in to another object

@param input the record to transform
@return the transformed writable
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;
    }
1143790
function mapToObject(input, mapFunc) {
    const obj = {};
    for (const element of input) {
        obj[element] = mapFunc(element);
    }
    return obj;
}
134527
@SuppressWarnings("unchecked")
    @Override
    public O transform(I input) {
        Object rawOutput = input;

        for (Transformer transformer : transformers) {
            rawOutput = transformer.transform(rawOutput);
        }

        return lastTransformer.transform(rawOutput);
    }
112259
@Override
    public Object transform( Object input ) {

        rootSpec.apply( ROOT_KEY, Optional.of( input ), new WalkedPath(), null, null );

        return input;
    }
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;
    }
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;
    }
703751
public Try<R,Throwable> execute(T input){
		return Try.withCatch( ()->transactionTemplate.execute(status-> transaction.apply(input)));
		 
	}
377516
public static SequenceBatchCSVRecord fromWritables(List<List<List<Writable>>> input) {
        SequenceBatchCSVRecord ret = new SequenceBatchCSVRecord();
        for(int i = 0; i < input.size(); i++) {
            ret.add(Arrays.asList(BatchCSVRecord.fromWritables(input.get(i))));
        }

        return ret;
    }
715657
@Override
    public Object map(Object input) {
        return new Text(map.get(input.toString()));
    }
1095358
public String prepare(String input) {
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < input.length(); i++){
		    char c = input.charAt(i);        
		    if(map.get(c) != null) {
		    	replacements++;
		    	sb.append(map.get(c));
		    } else
		    	sb.append(c);
		}
		return sb.toString();
	}
356234
function transformRaw(input, options) {
  const transformStream = new TransformStream(options);
  pipe(input, transformStream.writable);
  return transformStream.readable;
}
705703
public PointTo toTransferObject(Point input) {
        PointTo result = new PointTo();
        result.setCrs(GeoJsonTo.createCrsTo("EPSG:" + input.getSRID()));
        result.setCoordinates(getPoints(input)[0]);
        return result;
    }
633689
@Override
    public Object map(Object input) {
        List<Float> row = (List<Float>) input;
        switch (mathOp) {
            case Add:
                float sum = 0f;
                for (Float w : row)
                    sum += w;
                return sum;
            case Subtract:
                return row.get(0) - row.get(1);
            case Multiply:
                float product = 1.0f;
                for (Float w : row)
                    product *= w;
                return product;
            case Divide:
                return row.get(0) / row.get(1);
            case Modulus:
                return row.get(0) % row.get(1);
            case ReverseSubtract:
            case ReverseDivide:
            case ScalarMin:
            case ScalarMax:
            default:
                throw new RuntimeException("Invalid mathOp: " + mathOp); //Should never happen
        }
    }
628665
protected void process(T input) {
        try {
            Optional.ofNullable(this.transformFunction.apply(input))
                    .ifPresent(this.outputPublisher::submit);
        } catch (Exception e) {
            JMExceptionManager.handleException(log, e, "process", input);
        }
    }
413141
private static Serializable jsonObjectToSerializableType(JSONObject input) {
		String type = input.optString(Apptentive.Version.KEY_TYPE, null);
		try {
			if (type != null) {
				if (type.equals(Apptentive.Version.TYPE)) {
					return new Apptentive.Version(input);
				} else if (type.equals(Apptentive.DateTime.TYPE)) {
					return new Apptentive.DateTime(input);
				}
			}
		} catch (JSONException e) {
			ApptentiveLog.e(CONVERSATION, e, "Error migrating JSONObject.");
			logException(e);
		}
		return null;
	}
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;
    }
1128832
private static Writable getWritableFromObject(Object object) {

        Writable writable = null;

        if (object instanceof String) {

            writable = new Text(object.toString());

        } else if (object instanceof Long) {

            writable = new LongWritable((Long) object);

        } else {

            writable = new IntWritable((Integer) object);

        }
        // writable = writable!=null?writable:new Text("");
        return writable;
    }