use of suite.primitive.Longs.LongsBuilder in project suite by stupidsing.
the class LngOutlet method toList.
public LongsBuilder toList() {
LongsBuilder list = new LongsBuilder();
long c;
while ((c = next()) != LngFunUtil.EMPTYVALUE) list.append(c);
return list;
}
use of suite.primitive.Longs.LongsBuilder 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.Longs.LongsBuilder in project suite by stupidsing.
the class LngOutlet method toListMap.
public <K> LngObjMap<LongsBuilder> toListMap(Lng_Lng valueFun) {
LngObjMap<LongsBuilder> map = new LngObjMap<>();
long c;
while ((c = next()) != LngFunUtil.EMPTYVALUE) map.computeIfAbsent(c, k_ -> new LongsBuilder()).append(valueFun.apply(c));
return map;
}
Aggregations