本文整理汇总了C#中Op类的典型用法代码示例。如果您正苦于以下问题:C# Op类的具体用法?C# Op怎么用?C# Op使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Op类属于命名空间,在下文中一共展示了Op类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NotationValue
public NotationValue(string notation, int index, int end)
{
value = 1;
op = Op.Add;
type = NotationType.Value;
switch (notation[index])
{
case '+': { index++; break; }
case '-': { op = Op.Sub; index++; break; }
case '*': { op = Op.Mul; index++; break; }
case '/': { op = Op.Div; index++; break; }
case '^': { op = Op.Mod; index++; break; }
}
if (index <= end && char.IsDigit(notation[index]))
{
int i = index + 1;
while (i <= end && char.IsDigit(notation[i])) i++;
value = int.Parse(notation.Substring(index, i - index));
index = i;
}
if (index <= end && char.IsLetter(notation[index]))
{
Enum.TryParse<NotationType>(notation.Substring(index, end - index + 1), out type);
}
}
示例2: CreateFragment
/// <summary>
/// 创建查询条件片段。
/// </summary>
/// <param name="propertyName">属性名</param>
/// <param name="op">查询操作</param>
/// <returns>2元组:结果一、查询条件片段;结果二、查询参数</returns>
protected override Tuple<string, string> CreateFragment(string propertyName, Op op)
{
var criteria = string.Empty;
var parameterName = string.Empty;
switch (op)
{
case Op.Eq:
case Op.Gt:
case Op.Ge:
case Op.Lt:
case Op.Le:
parameterName = propertyName + (this._parameterIndex++);
criteria = string.Format(CriteriaFormat, propertyName, Operations[(int)op], parameterName);
break;
case Op.Like:
parameterName = propertyName + (this._parameterIndex++);
criteria = $"\"{propertyName}\" LIKE '%'||:{parameterName}||'%'";
break;
case Op.IsNull:
criteria = $"\"{propertyName}\" IS NULL";
break;
case Op.IsNotNull:
criteria = $"\"{propertyName}\" IS NOT NULL";
break;
}
return new Tuple<string, string>(criteria, parameterName);
}
示例3: Main
static void Main()
{
Op.sanity_check();
{
Op op = new Op(100);
Op opNew = op++;
if (op.i != 101) throw new Exception("operator++ postfix failed (op)");
if (opNew.i != 100) throw new Exception("operator++ postfix failed (opNew)");
}
{
Op op = new Op(100);
Op opNew = op--;
if (op.i != 99) throw new Exception("operator-- postfix failed (op)");
if (opNew.i != 100) throw new Exception("operator-- postfix failed (opNew)");
}
{
Op op = new Op(100);
Op opNew = ++op;
if (op.i != 101) throw new Exception("operator++ prefix failed (op)");
if (opNew.i != 101) throw new Exception("operator++ prefix failed (opNew)");
}
{
Op op = new Op(100);
Op opNew = --op;
if (op.i != 99) throw new Exception("operator-- prefix failed (op)");
if (opNew.i != 99) throw new Exception("operator-- prefix failed (opNew)");
}
// overloaded operator class
Op k = new OpDerived(3);
int check_k = k.IntCast();
Assert(check_k == 6);
}
示例4: BinaryTerm
private BinaryTerm(RiakFluentSearch search, string field, Op op, Term left)
: base(search, field)
{
_op = op;
_left = left;
left.Owner = this;
}
示例5: Condition
/// <summary>
/// 构造方法。
/// </summary>
/// <param name="column">属性</param>
/// <param name="op">操作</param>
/// <param name="value">值</param>
internal Condition(string column, Op op, object value)
{
this.Op = op;
this.Value = value;
this.JoinType = "AND";
this.PropertyName = column;
}
示例6: Operator
public object Operator(Op op, params object[] args)
{
if (binaryOps.ContainsKey(op))
return binaryOps[op]((bool)args[0], (bool)args[1]);
if (op == Op.Not)
return !(bool)args[0];
throw new NotImplementedException();
}
示例7: ActionCopyMoveRename
public ActionCopyMoveRename(Op operation, FileInfo from, FileInfo to, ProcessedEpisode ep)
{
this.PercentDone = 0;
this.Episode = ep;
this.Operation = operation;
this.From = from;
this.To = to;
}
示例8: IsEquivalent
/// <summary>
/// Two CostantBaseOps are equivalent if they are of the same
/// derived type and have the same type and value.
/// </summary>
/// <param name="other">the other Op</param>
/// <returns>true, if these are equivalent (not a strict equality test)</returns>
internal override bool IsEquivalent(Op other)
{
var otherConstant = other as ConstantBaseOp;
return
otherConstant != null &&
OpType == other.OpType &&
otherConstant.Type.EdmEquals(Type) &&
((otherConstant.Value == null && Value == null) || otherConstant.Value.Equals(Value));
}
示例9: Emit
internal void Emit(Op op, Label label)
{
if (!label.IsEmpty())
{
fixups.Add(ops.Count);
Emit(op, label.GetIndex());
}
else
Emit(op, 0);
}
示例10: Compile
private bool ignore; // ignore case
private void Compile (string pattern)
{
if (pattern == null || pattern.IndexOfAny (InvalidChars) >= 0)
throw new ArgumentException ("Invalid search pattern.");
if (pattern == "*") { // common case
ops = new Op (OpCode.True);
return;
}
ops = null;
int ptr = 0;
Op last_op = null;
while (ptr < pattern.Length) {
Op op;
switch (pattern [ptr]) {
case '?':
op = new Op (OpCode.AnyChar);
++ ptr;
break;
case '*':
op = new Op (OpCode.AnyString);
++ ptr;
break;
default:
op = new Op (OpCode.ExactString);
int end = pattern.IndexOfAny (WildcardChars, ptr);
if (end < 0)
end = pattern.Length;
op.Argument = pattern.Substring (ptr, end - ptr);
if (ignore)
op.Argument = op.Argument.ToLowerInvariant ();
ptr = end;
break;
}
if (last_op == null)
ops = op;
else
last_op.Next = op;
last_op = op;
}
if (last_op == null)
ops = new Op (OpCode.End);
else
last_op.Next = new Op (OpCode.End);
}
示例11: Operator
static Operator()
{
Op[] opArray = new Op[9];
opArray[3] = Op.EQ;
opArray[4] = Op.NE;
opArray[5] = Op.GT;
opArray[6] = Op.GE;
opArray[7] = Op.LT;
opArray[8] = Op.LE;
invertOp = opArray;
}
示例12: Expression
/// <summary>
/// </summary>
public Expression(string attrbuteName, Op op, string attrbuteValue)
{
if (op == Op.Exists || op == Op.NotExists)
throw new ArgumentException("op");
if (String.IsNullOrEmpty(attrbuteName))
throw new ArgumentException("attrbuteName");
_op = op;
_attributeName = attrbuteName;
_attributeValue = attrbuteValue;
}
示例13: Binary
public Binary(Op op, string symbol = "")
{
_op = op;
Left = new Lambda();
Right = new Lambda();
if (symbol == "") {
StringBuilder sb = new StringBuilder();
sb.Append('[').Append(_opCount.ToString()).Append(']');
_symbol = sb.ToString();
_opCount++;
}
else {
_symbol = symbol;
}
}
示例14: IsTypeTransitive
private static bool IsTypeTransitive(Op op)
{
switch (op)
{
case Op.Add:
case Op.Subtract:
case Op.Multiply:
case Op.Remainder:
case Op.Divide:
case Op.AndAnd:
case Op.OrOr:
case Op.And:
case Op.Or:
case Op.ExclusiveOr:
case Op.LeftShift:
case Op.RightShift:
return true;
}
return false;
}
示例15: AddArg
private void AddArg(Op op, ICollection<Node> argList)
{
if (TokType == TokenType.Identifer)
{
if (_reg16.ContainsKey(Keyword))
{
argList.Add(_reg16[Keyword]);
NextToken();
}
else if (_reg8.ContainsKey(Keyword))
{
argList.Add(_reg8[Keyword]);
NextToken();
}
else if (_specReg.ContainsKey(Keyword))
{
argList.Add(_specReg[Keyword]);
NextToken();
}
else if (argList.Count == 0)
{
if (op == Op.Jr && _jrCond.ContainsKey(Keyword))
{
argList.Add(_jrCond[Keyword]);
NextToken();
}
else if ((op == Op.Jp || op == Op.Ret || op == Op.Call) && _cond.ContainsKey(Keyword))
{
argList.Add(_cond[Keyword]);
NextToken();
}
else
argList.Add(Expression());
}
else
argList.Add(Expression());
}
else
argList.Add(Expression());
}