|
4 | 4 |
|
5 | 5 | import java.io.*;
|
6 | 6 | import java.util.*;
|
| 7 | +import java.util.function.*; |
7 | 8 |
|
8 | 9 | import org.basex.data.*;
|
9 | 10 | import org.basex.io.out.*;
|
|
14 | 15 | import org.basex.query.iter.*;
|
15 | 16 | import org.basex.query.util.*;
|
16 | 17 | import org.basex.query.value.item.*;
|
| 18 | +import org.basex.query.value.node.*; |
17 | 19 | import org.basex.query.value.type.*;
|
18 | 20 | import org.basex.query.var.*;
|
19 | 21 | import org.basex.util.*;
|
@@ -77,24 +79,25 @@ public Expr simplifyFor(final Simplify mode, final CompileContext cc) throws Que
|
77 | 79 | }
|
78 | 80 |
|
79 | 81 | /**
|
80 |
| - * Returns a materialized, context-independent version of this value. |
81 |
| - * @param qc query context (if {@code null}, process cannot be interrupted) |
82 |
| - * @param error query error |
83 |
| - * @param info input info |
84 |
| - * @return item copy, or {@code null}) if the value cannot be materialized |
| 82 | + * Returns a materialized version of this value without dependencies to persistent data. |
| 83 | + * @param qc query context |
| 84 | + * @param test test if node is materialized |
| 85 | + * @param ii input info |
| 86 | + * @return materialized value, or {@code null} if the value contains function items |
85 | 87 | * @throws QueryException query exception
|
86 | 88 | */
|
87 |
| - public Value materialize(final QueryContext qc, final QueryError error, final InputInfo info) |
88 |
| - throws QueryException { |
| 89 | + public abstract Value materialize(QueryContext qc, Predicate<ANode> test, InputInfo ii) |
| 90 | + throws QueryException; |
89 | 91 |
|
90 |
| - final ValueBuilder vb = new ValueBuilder(qc); |
91 |
| - for(final Item item : this) { |
92 |
| - final Item it = item.materialize(qc, item.persistent()); |
93 |
| - if(it == null) throw error.get(info, item); |
94 |
| - vb.add(it); |
95 |
| - } |
96 |
| - return vb.value(this); |
97 |
| - } |
| 92 | + /** |
| 93 | + * Checks if this value is materialized, i.e., contains no persistent database nodes or |
| 94 | + * function items. |
| 95 | + * @param test test for copying nodes |
| 96 | + * @param ii input info |
| 97 | + * @return result of check |
| 98 | + * @throws QueryException query exception |
| 99 | + */ |
| 100 | + public abstract boolean materialized(Predicate<ANode> test, InputInfo ii) throws QueryException; |
98 | 101 |
|
99 | 102 | /**
|
100 | 103 | * Tests if this is an empty sequence.
|
|
0 commit comments