use of suite.primitive.Floats.FloatsBuilder in project suite by stupidsing.
the class FltOutlet method toListMap.
public <K> FltObjMap<FloatsBuilder> toListMap(Flt_Flt valueFun) {
FltObjMap<FloatsBuilder> map = new FltObjMap<>();
float c;
while ((c = next()) != FltFunUtil.EMPTYVALUE) map.computeIfAbsent(c, k_ -> new FloatsBuilder()).append(valueFun.apply(c));
return map;
}
use of suite.primitive.Floats.FloatsBuilder in project suite by stupidsing.
the class HongKongGovernment method queryWeather.
public Map<String, DataSource> queryWeather() {
long t0 = Time.of(2000, 1, 1).epochSec();
long tx = Time.today().epochSec();
LongsBuilder ts = new LongsBuilder();
FloatsBuilder fs0 = new FloatsBuilder();
FloatsBuilder fs1 = new FloatsBuilder();
for (long t = t0; t < tx; t += 86400l) {
Time time = Time.ofEpochSec(t);
String html = //
Singleton.me.storeCache.http(//
"http://www.hko.gov.hk/cgi-bin/hko/yes.pl" + "?year=" + //
time.year() + "&month=" + //
time.month() + "&day=" + //
time.dayOfMonth() + //
"&language=english&B1=Confirm#").collect(As::string);
String data = ParseUtil.fit(html, "<pre>", "</pre>")[1];
ts.append(t);
fs0.append(getFloatValue(data, "Maximum Air Temperature", "C"));
fs1.append(getFloatValue(data, "Rainfall", "mm"));
}
long[] ts_ = ts.toLongs().toArray();
return //
Map.ofEntries(//
entry("hko.TEMP", DataSource.of(ts_, fs0.toFloats().toArray())), entry("hko.RAIN", DataSource.of(ts_, fs1.toFloats().toArray())));
}
use of suite.primitive.Floats.FloatsBuilder in project suite by stupidsing.
the class FltOutlet method toList.
public FloatsBuilder toList() {
FloatsBuilder list = new FloatsBuilder();
float c;
while ((c = next()) != FltFunUtil.EMPTYVALUE) list.append(c);
return list;
}
Aggregations