GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Simple.Data/Simple.Data/MathReference.cs at master · ThatRendle/Simple.Data

Expand file tree

/

MathReference.cs

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
174 lines (152 loc) · 6.57 KB
/

MathReference.cs

Copy path

File metadata and controls

174 lines (152 loc) · 6.57 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Simple.Data
{
public class MathReference : SimpleReference, IEquatable<MathReference>
{
private readonly object _leftOperand;
private readonly object _rightOperand;
private readonly MathOperator _operator;
public MathReference(object leftOperand, object rightOperand, MathOperator @operator)
{
_leftOperand = leftOperand;
_rightOperand = rightOperand;
_operator = @operator;
}
private MathReference(object leftOperand, object rightOperand, MathOperator @operator, string alias) : base(alias)
{
_leftOperand = leftOperand;
_rightOperand = rightOperand;
_operator = @operator;
}
public MathOperator Operator
{
get { return _operator; }
}
public object RightOperand
{
get { return _rightOperand; }
}
public object LeftOperand
{
get { return _leftOperand; }
}
public MathReference As(string alias)
{
return new MathReference(_leftOperand, _rightOperand, _operator, alias);
}
/// <summary>
/// Implements the operator == to create a <see cref="SimpleExpression"/> with the type <see cref="SimpleExpressionType.Equal"/>.
/// </summary>
/// <param name="column">The column.</param>
/// <param name="value">The value.</param>
/// <returns>The expression.</returns>
public static SimpleExpression operator ==(MathReference column, object value)
{
return new SimpleExpression(column, value, SimpleExpressionType.Equal);
}
/// <summary>
/// Implements the operator != to create a <see cref="SimpleExpression"/> with the type <see cref="SimpleExpressionType.NotEqual"/>.
/// </summary>
/// <param name="column">The column.</param>
/// <param name="value">The value.</param>
/// <returns>The expression.</returns>
public static SimpleExpression operator !=(MathReference column, object value)
{
return new SimpleExpression(column, value, SimpleExpressionType.NotEqual);
}
/// <summary>
/// Implements the operator &lt; to create a <see cref="SimpleExpression"/> with the type <see cref="SimpleExpressionType.LessThan"/>.
/// </summary>
/// <param name="column">The column.</param>
/// <param name="value">The value.</param>
/// <returns>The expression.</returns>
public static SimpleExpression operator <(MathReference column, object value)
{
return new SimpleExpression(column, value, SimpleExpressionType.LessThan);
}
/// <summary>
/// Implements the operator &gt; to create a <see cref="SimpleExpression"/> with the type <see cref="SimpleExpressionType.GreaterThan"/>.
/// </summary>
/// <param name="column">The column.</param>
/// <param name="value">The value.</param>
/// <returns>The expression.</returns>
public static SimpleExpression operator >(MathReference column, object value)
{
return new SimpleExpression(column, value, SimpleExpressionType.GreaterThan);
}
/// <summary>
/// Implements the operator &lt;= to create a <see cref="SimpleExpression"/> with the type <see cref="SimpleExpressionType.LessThanOrEqual"/>.
/// </summary>
/// <param name="column">The column.</param>
/// <param name="value">The value.</param>
/// <returns>The expression.</returns>
public static SimpleExpression operator <=(MathReference column, object value)
{
return new SimpleExpression(column, value, SimpleExpressionType.LessThanOrEqual);
}
/// <summary>
/// Implements the operator &gt;= to create a <see cref="SimpleExpression"/> with the type <see cref="SimpleExpressionType.GreaterThanOrEqual"/>.
/// </summary>
/// <param name="column">The column.</param>
/// <param name="value">The value.</param>
/// <returns>The expression.</returns>
public static SimpleExpression operator >=(MathReference column, object value)
{
return new SimpleExpression(column, value, SimpleExpressionType.GreaterThanOrEqual);
}
public bool Equals(MathReference other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Equals(other._leftOperand, _leftOperand) && Equals(other._rightOperand, _rightOperand) && Equals(other._operator, _operator);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != typeof (MathReference)) return false;
return Equals((MathReference) obj);
}
public override int GetHashCode()
{
unchecked
{
int result = (_leftOperand != null ? _leftOperand.GetHashCode() : 0);
result = (result*397) ^ (_rightOperand != null ? _rightOperand.GetHashCode() : 0);
result = (result*397) ^ _operator.GetHashCode();
return result;
}
}
public static MathReference operator +(MathReference column, object value)
{
return new MathReference(column, value, MathOperator.Add);
}
public static MathReference operator -(MathReference column, object value)
{
return new MathReference(column, value, MathOperator.Subtract);
}
public static MathReference operator *(MathReference column, object value)
{
return new MathReference(column, value, MathOperator.Multiply);
}
public static MathReference operator /(MathReference column, object value)
{
return new MathReference(column, value, MathOperator.Divide);
}
public static MathReference operator %(MathReference column, object value)
{
return new MathReference(column, value, MathOperator.Modulo);
}
}
public enum MathOperator
{
Add,
Subtract,
Multiply,
Divide,
Modulo
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.