• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

evolvedbinary / elemental / 982

29 Apr 2025 08:34PM UTC coverage: 56.409% (+0.007%) from 56.402%
982

push

circleci

adamretter
[feature] Improve README.md badges

28451 of 55847 branches covered (50.94%)

Branch coverage included in aggregate %.

77468 of 131924 relevant lines covered (58.72%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/exist-core/src/main/java/org/exist/xquery/DynamicVariable.java
1
/*
2
 * Elemental
3
 * Copyright (C) 2024, Evolved Binary Ltd
4
 *
5
 * admin@evolvedbinary.com
6
 * https://www.evolvedbinary.com | https://www.elemental.xyz
7
 *
8
 * Use of this software is governed by the Business Source License 1.1
9
 * included in the LICENSE file and at www.mariadb.com/bsl11.
10
 *
11
 * Change Date: 2028-04-27
12
 *
13
 * On the date above, in accordance with the Business Source License, use
14
 * of this software will be governed by the Apache License, Version 2.0.
15
 *
16
 * Additional Use Grant: Production use of the Licensed Work for a permitted
17
 * purpose. A Permitted Purpose is any purpose other than a Competing Use.
18
 * A Competing Use means making the Software available to others in a commercial
19
 * product or service that: substitutes for the Software; substitutes for any
20
 * other product or service we offer using the Software that exists as of the
21
 * date we make the Software available; or offers the same or substantially
22
 * similar functionality as the Software.
23
 */
24
package org.exist.xquery;
25

26
import net.jcip.annotations.Immutable;
27
import org.exist.dom.QName;
28
import org.exist.dom.persistent.DocumentSet;
29
import org.exist.xquery.value.Sequence;
30
import org.exist.xquery.value.SequenceType;
31

32
import java.util.function.Supplier;
33

34
@Immutable
35
public class DynamicVariable implements Variable {
36

37
    private final QName name;
38
    private final Supplier<Sequence> valueSupplier;
39

40
    public DynamicVariable(final QName name, final Supplier<Sequence> valueSupplier) {
×
41
        this.name = name;
×
42
        this.valueSupplier = valueSupplier;
×
43
    }
×
44

45
    @Override
46
    public void setValue(final Sequence val) {
47
        throwImmutable();
×
48
    }
×
49

50
    @Override
51
    public Sequence getValue() {
52
        return valueSupplier.get();
×
53
    }
54

55
    @Override
56
    public QName getQName() {
57
        return name;
×
58
    }
59

60
    @Override
61
    public int getType() {
62
        return valueSupplier.get().getItemType();
×
63
    }
64

65
    @Override
66
    public void setSequenceType(final SequenceType type) {
67
        throwImmutable();
×
68
    }
×
69

70
    @Override
71
    public SequenceType getSequenceType() {
72
        final Sequence value = getValue();
×
73
        return new SequenceType(value.getItemType(), value.getCardinality());
×
74
    }
75

76
    @Override
77
    public void setStaticType(final int type) {
78
        throwImmutable();
×
79
    }
×
80

81
    @Override
82
    public int getStaticType() {
83
        return getType();
×
84
    }
85

86
    @Override
87
    public boolean isInitialized() {
88
        return true;
×
89
    }
90

91
    @Override
92
    public void setIsInitialized(final boolean initialized) {
93
    }
×
94

95
    @Override
96
    public int getDependencies(final XQueryContext context) {
97
        return 0;
×
98
    }
99

100
    @Override
101
    public Cardinality getCardinality() {
102
        return getValue().getCardinality();
×
103
    }
104

105
    @Override
106
    public void setStackPosition(final int position) {
107
    }
×
108

109
    @Override
110
    public DocumentSet getContextDocs() {
111
        return DocumentSet.EMPTY_DOCUMENT_SET;
×
112
    }
113

114
    @Override
115
    public void setContextDocs(final DocumentSet docs) {
116
        throwImmutable();
×
117
    }
×
118

119
    @Override
120
    public void checkType() {
121

122
    }
×
123

124
    private static void throwImmutable() {
125
        throw new UnsupportedOperationException("Changing a dynamic variable is not permitted");
×
126
    }
127
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc