org.nustaq.reallive.server.MapSpore Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reallive Show documentation
Show all versions of reallive Show documentation
persistent inmemory datagrid based on kontraktor
package org.nustaq.reallive.server;
import org.nustaq.kontraktor.Spore;
import org.nustaq.reallive.api.RLFunction;
import org.nustaq.reallive.api.RLPredicate;
import org.nustaq.reallive.api.Record;
/**
* Created by ruedi on 06.03.17.
*
* should be option of filterspore, but cannot because of fixed types ..
*/
public class MapSpore extends Spore {
private final RLFunction mapFun;
private final RLPredicate filter; // may modify record (gets patchable private copy
public MapSpore(RLPredicate filter, RLFunction mapFun ) {
this.filter = filter;
this.mapFun = mapFun;
}
@Override
public void remote(Record input) {
if ( filter != null && ! filter.test(input) ) {
return;
}
stream( mapFun.apply(input) );
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy