Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Operator.cs
Go to the documentation of this file.
2
4
5internal sealed class Operator : AstNode
6{
7 public enum Op
8 {
10 OR,
11 AND,
12 EQ,
13 NE,
14 LT,
15 LE,
16 GT,
17 GE,
18 PLUS,
19 MINUS,
20 MUL,
21 DIV,
22 MOD,
23 UNION
24 }
25
26 private static readonly Op[] s_invertOp = new Op[9]
27 {
28 Op.INVALID,
29 Op.INVALID,
30 Op.INVALID,
31 Op.EQ,
32 Op.NE,
33 Op.GT,
34 Op.GE,
35 Op.LT,
36 Op.LE
37 };
38
39 private readonly Op _opType;
40
41 private readonly AstNode _opnd1;
42
43 private readonly AstNode _opnd2;
44
45 public override AstType Type => AstType.Operator;
46
48 {
49 get
50 {
51 if (_opType <= Op.GE)
52 {
53 return XPathResultType.Boolean;
54 }
55 if (_opType <= Op.MOD)
56 {
57 return XPathResultType.Number;
58 }
59 return XPathResultType.NodeSet;
60 }
61 }
62
64
66
68
69 public static Op InvertOperator(Op op)
70 {
71 return s_invertOp[(int)op];
72 }
73
74 public Operator(Op op, AstNode opnd1, AstNode opnd2)
75 {
76 _opType = op;
77 _opnd1 = opnd1;
78 _opnd2 = opnd2;
79 }
80}
static Op InvertOperator(Op op)
Definition Operator.cs:69
static readonly Op[] s_invertOp
Definition Operator.cs:26
Operator(Op op, AstNode opnd1, AstNode opnd2)
Definition Operator.cs:74
override XPathResultType ReturnType
Definition Operator.cs:48
readonly AstNode _opnd2
Definition Operator.cs:43
readonly AstNode _opnd1
Definition Operator.cs:41