org.heigit.ohsome.oshdb.api.mapreducer.MapFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of oshdb-api Show documentation
Show all versions of oshdb-api Show documentation
API to query the OpenStreetMap History Database. Includes MapReduce functionality to filter, analyze and aggregate data.
The newest version!
package org.heigit.ohsome.oshdb.api.mapreducer;
import org.heigit.ohsome.oshdb.util.function.SerializableBiFunction;
/**
* A function that has a flag: isFlatMapper.
*
* Note that this class is using raw types on purpose because MapReducer's "map functions"
* are designed to input and output arbitrary data types. The necessary type checks are performed
* at at runtime in the respective setters.
*/
@SuppressWarnings({"rawtypes", "unchecked"}) // see javadoc above
class MapFunction implements SerializableBiFunction {
private final SerializableBiFunction mapper;
private final boolean isFlatMapper;
MapFunction(SerializableBiFunction mapper, boolean isFlatMapper) {
this.mapper = mapper;
this.isFlatMapper = isFlatMapper;
}
boolean isFlatMapper() {
return this.isFlatMapper;
}
@Override
public Object apply(Object o, Object root) {
return this.mapper.apply(o, root);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy