MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / map

Method map

src/main/java/wyil/check/FlowTypeUtils.java:1009–1031  ·  view source on GitHub ↗
(Function<Row,Row> fn)

Source from the content-addressed store, hash-verified

1007 }
1008
1009 public Typing map(Function<Row,Row> fn) {
1010 Row[] nRows = matrix;
1011 // Sanity check existing rows
1012 for (int i = 0; i != nRows.length; ++i) {
1013 Row ith = nRows[i];
1014 Row nith = fn.apply(ith);
1015 // Sanity check current type
1016 if(ith != nith && matrix == nRows) {
1017 nRows = Arrays.copyOf(nRows,nRows.length);
1018 }
1019 nRows[i] = nith;
1020 }
1021 if(matrix == nRows) {
1022 return Typing.this;
1023 } else {
1024 // Remove any invalid rows
1025 nRows = ArrayUtils.removeAll(nRows, null);
1026 // Recalculate number of variables
1027 int nVariables = nRows.length > 0 ? nRows[0].size() : 0;
1028 // Create new typing
1029 return new Typing(subtyping, frames, nVariables, nRows);
1030 }
1031 }
1032
1033 public Typing fold(Comparator<Row> comparator) {
1034 if (matrix.length <= 1) {

Callers 14

pushArrayAccessMethod · 0.95
pushDereferenceMethod · 0.95
pushFieldDereferenceMethod · 0.95
pushIndirectInvokeMethod · 0.95
pushLambdaAccessMethod · 0.95
pushRecordAccessMethod · 0.95
pullArrayUpdateMethod · 0.95
pullCastMethod · 0.95
pullEqualityOperatorMethod · 0.95
pullIndirectInvokeMethod · 0.95
pullRecordAccessMethod · 0.95
pullRecordUpdateMethod · 0.95

Calls 3

removeAllMethod · 0.95
applyMethod · 0.65
sizeMethod · 0.65

Tested by

no test coverage detected