本文整理汇总了C#中Operator类的典型用法代码示例。如果您正苦于以下问题:C# Operator类的具体用法?C# Operator怎么用?C# Operator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Operator类属于命名空间,在下文中一共展示了Operator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
public static Boolean Evaluate(Object state, ref Boolean error, Operator @operator, String text)
{
Combat.Character character = state as Combat.Character;
if (character == null)
{
error = true;
return false;
}
String authorname = character.BasePlayer.Profile.Author;
if (authorname == null)
{
error = true;
return false;
}
Boolean result = String.Equals(authorname, text, StringComparison.OrdinalIgnoreCase);
switch (@operator)
{
case Operator.Equals:
return result;
case Operator.NotEquals:
return !result;
default:
error = true;
return false;
}
}
示例2: Binary
public Binary(SourceSpan span, Operator op, Expression left, Expression right)
: base(span)
{
_op = op;
_left = left;
_right = right;
}
示例3: UnsafeAccessExpression
internal UnsafeAccessExpression(CsTokenList tokens, Operator operatorType, Expression value)
: base(ExpressionType.UnsafeAccess, tokens)
{
this.operatorType = operatorType;
this.value = value;
base.AddExpression(value);
}
示例4: SimpleSelectNode
public SimpleSelectNode(IQueryPlanNode child, ObjectName leftVar, Operator op, Expression rightExpression)
: base(child)
{
this.leftVar = leftVar;
this.op = op;
this.rightExpression = rightExpression;
}
示例5: GetName
public static string GetName(Operator type)
{
string result = String.Empty;
switch (type)
{
case Operator.Equal:
result = "==";
break;
case Operator.GreaterThan:
result = ">";
break;
case Operator.GreaterThanEqual:
result = ">=";
break;
case Operator.LessThan:
result = "<";
break;
case Operator.LessThanEqual:
result = "<=";
break;
case Operator.NotEqual:
result = "!=";
break;
}
return result;
}
示例6: Calculation
private Calculation(Column column, Guid id, double operand, Operator @operator)
{
_column = column;
Id = id;
Operand = operand;
Operator = @operator;
}
示例7: cmpQueryQueryE
/*cmpXslt:*/
static bool cmpQueryQueryE(Operator.Op op, object val1, object val2) {
Debug.Assert(op == Operator.Op.EQ || op == Operator.Op.NE);
bool isEQ = (op == Operator.Op.EQ);
NodeSet n1 = new NodeSet(val1);
NodeSet n2 = new NodeSet(val2);
while (true) {
if (! n1.MoveNext()) {
return false;
}
if (! n2.MoveNext()) {
return false;
}
string str1 = n1.Value;
do {
if ((str1 == n2.Value) == isEQ) {
return true;
}
}while (n2.MoveNext());
n2.Reset();
}
}
示例8: InsertBinaryOperationMethod
private static void InsertBinaryOperationMethod(Core core, CodeBlockNode root, Operator op, PrimitiveType r, PrimitiveType op1, PrimitiveType op2, int retRank = 0, int op1rank = 0, int op2rank = 0)
{
FunctionDefinitionNode funcDefNode = new FunctionDefinitionNode();
funcDefNode.access = CompilerDefinitions.AccessModifier.kPublic;
funcDefNode.IsAssocOperator = true;
funcDefNode.IsBuiltIn = true;
funcDefNode.Name = Op.GetOpFunction(op);
funcDefNode.ReturnType = new Type() { Name = core.TypeSystem.GetType((int)r), UID = (int)r, rank = retRank };
ArgumentSignatureNode args = new ArgumentSignatureNode();
args.AddArgument(new VarDeclNode()
{
Access = CompilerDefinitions.AccessModifier.kPublic,
NameNode = AstFactory.BuildIdentifier(DSASM.Constants.kLHS),
ArgumentType = new Type { Name = core.TypeSystem.GetType((int)op1), UID = (int)op1, rank = op1rank }
});
args.AddArgument(new VarDeclNode()
{
Access = CompilerDefinitions.AccessModifier.kPublic,
NameNode = AstFactory.BuildIdentifier(DSASM.Constants.kRHS),
ArgumentType = new Type { Name = core.TypeSystem.GetType((int)op2), UID = (int)op2, rank = op2rank }
});
funcDefNode.Signature = args;
CodeBlockNode body = new CodeBlockNode();
var lhs = AstFactory.BuildIdentifier(DSASM.Constants.kLHS);
var rhs = AstFactory.BuildIdentifier(DSASM.Constants.kRHS);
var binaryExpr = AstFactory.BuildBinaryExpression(lhs, rhs, op);
body.Body.Add(AstFactory.BuildReturnStatement(binaryExpr));
funcDefNode.FunctionBody = body;
root.Body.Add(funcDefNode);
}
示例9: ProcessOperator
public void ProcessOperator(Operator op)
{
if (ProcessOperatorObject != null)
ProcessOperatorObject(op);
foreach (var obj in op.Children)
obj.AcceptVisitor(this);
}
示例10: BuildSelectSqlFor
public string BuildSelectSqlFor(string tableName, string[] fields,
string[] filterFields, Operator[] filterOperators, string[] filterValues,
string[] orders, int limitResultSet)
{
string sql = "select ";
if (limitResultSet > 0)
sql += "top " + limitResultSet + " ";
if (ArrayHelper.IsNull(fields))
sql += "*";
else
sql += string.Join(", ", fields);
sql += " from " + tableName + " ";
if (!ArrayHelper.IsNull(filterFields))
{
sql += "where ";
for (int i = 0; i < filterFields.Length; i++)
{
if (i > 0) sql += " and ";
sql += filterFields[i] + " " + OperatorString(filterOperators[i], filterValues[i]);
}
}
if (!ArrayHelper.IsNull(orders))
{
sql += " order by ";
sql += string.Join(", ", orders);
}
return sql;
}
示例11: QueryExpression
internal QueryExpression(string FieldName, Operator Operator, Guid Value)
{
this.Type = ExpressionType.String;
this.FieldName = FieldName;
this.Operator = Operator;
this.Value = Value.ToString();
}
示例12: Delete
public Delete(string table, Operator where, bool allowMultiple)
{
Table.Name = table;
AllowMultiple = allowMultiple;
Where = where;
Filter = FilterType.Where;
}
示例13: ExpressionQuery
public static IMongoQuery ExpressionQuery(string name, Operator optor, BsonValue value)
{
switch (optor)
{
case Operator.EQ:
return M.Query.EQ(name, value);
case Operator.GT:
return M.Query.GT(name, value);
case Operator.GTE:
return M.Query.GTE(name, value);
case Operator.ISNULL:
return M.Query.EQ(name, null);
case Operator.LT:
return M.Query.LT(name, value);
case Operator.LTE:
return M.Query.LTE(name, value);
case Operator.NOTNULL:
return M.Query.NE(name, null);
default:
throw new ArgumentException(String.Format("Invalid operator {0} on token parameter {1}", optor.ToString(), name));
}
}
示例14: ExecuteLastOperator
private void ExecuteLastOperator(Operator newOperator)
{
decimal currentValue = Convert.ToDecimal(textBoxDisplay.Text);
decimal newValue = currentValue;
if (numberHitSinceLastOperator)
{
switch (lastOperator)
{
case Operator.Plus:
newValue = valueSoFar + currentValue;
break;
case Operator.Minus:
newValue = valueSoFar - currentValue;
break;
case Operator.Times:
newValue = valueSoFar * currentValue;
break;
case Operator.Divide:
if (currentValue == 0)
newValue = 0;
else
newValue = valueSoFar / currentValue;
break;
case Operator.Equals:
newValue = currentValue;
break;
}
}
valueSoFar = newValue;
lastOperator = newOperator;
numberHitSinceLastOperator = false;
textBoxDisplay.Text = valueSoFar.ToString();
}
示例15: Connect
public void Connect(Operator outOp, IOOutlet output, Operator inOp, IOOutlet input, bool serialize = true)
{
Connections.Add(new IOConnection() { From=outOp, Output=output, To=inOp, Input=input });
if (serialize) {
TemplateSerializer.Serialize(this);
}
}