本文整理汇总了C#中Op类的典型用法代码示例。如果您正苦于以下问题:C# Op类的具体用法?C# Op怎么用?C# Op使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Op类属于命名空间,在下文中一共展示了Op类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:mrlamb,项目名称:5eCharGen,代码行数:28,代码来源:Notation.cs
示例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);
}
开发者ID:fenglinz,项目名称:Sparrow,代码行数:39,代码来源:PostgreSQLDynamicQueryProvider.cs
示例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);
}
开发者ID:Reticulatas,项目名称:MochaEngineFinal,代码行数:33,代码来源:operator_overload_runme.cs
示例4: BinaryTerm
private BinaryTerm(RiakFluentSearch search, string field, Op op, Term left)
: base(search, field)
{
_op = op;
_left = left;
left.Owner = this;
}
开发者ID:taliesins,项目名称:CorrugatedIron,代码行数:7,代码来源:BinaryTerm.cs
示例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;
}
开发者ID:fenglinz,项目名称:Sparrow,代码行数:13,代码来源:Condition.cs
示例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();
}
开发者ID:ricksladkey,项目名称:Dirichlet,代码行数:8,代码来源:BooleanOperatorMap.cs
示例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;
}
开发者ID:madams74,项目名称:tvrename,代码行数:8,代码来源:ActionCopyMoveRename.cs
示例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));
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:15,代码来源:ConstantBaseOp.cs
示例9: Emit
internal void Emit(Op op, Label label)
{
if (!label.IsEmpty())
{
fixups.Add(ops.Count);
Emit(op, label.GetIndex());
}
else
Emit(op, 0);
}
开发者ID:rizwan3d,项目名称:elalang,代码行数:10,代码来源:CodeWriter.cs
示例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);
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:57,代码来源:SearchPattern.cs
示例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;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:Operator.cs
示例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;
}
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:18,代码来源:Expression.cs
示例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;
}
}
开发者ID:zearen-wover,项目名称:Funct,代码行数:15,代码来源:Funct.cs
示例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;
}
开发者ID:ricksladkey,项目名称:Dirichlet,代码行数:20,代码来源:OperatorHelper.cs
示例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());
}
开发者ID:demyanenko-d,项目名称:z80asm,代码行数:41,代码来源:Z80Parser.cs
示例16: GetArity
public static int GetArity(Op op)
{
switch (op)
{
case Op.Not:
case Op.Negate:
case Op.OnesComplement:
case Op.Int32:
case Op.UInt32:
case Op.Int64:
case Op.UInt64:
case Op.BigInteger:
case Op.Double:
case Op.Complex:
case Op.Rational:
case Op.Random:
return 1;
case Op.New:
case Op.NullCoalescing:
return 0;
default:
return 2;
}
}
开发者ID:ricksladkey,项目名称:Dirichlet,代码行数:24,代码来源:OperatorHelper.cs
示例17: Inst
/// <summary>
/// Add a simple IL instruction
/// </summary>
/// <param name="inst">the IL instruction</param>
public void Inst(Op inst)
{
AddToBuffer(new Instr((int)inst));
}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:8,代码来源:Code.cs
示例18: ApplyOpJoinOp
// <summary>
// ApplyOp/JoinOp common processing
// </summary>
// <remarks>
// If one of the inputs to any JoinOp/ApplyOp is a NestOp, then the NestOp
// can be pulled above the join/apply if every input to the join/apply has
// a key(s). The keys of the NestOp are augmented with the keys of the
// other join inputs:
// JoinOp/ApplyOp(NestOp(X, ...), Y) => NestOp(JoinOp/ApplyOp(X, Y), ...)
// In addition, if the NestOp is on a 'nullable' side of a join (i.e. right side of
// LeftOuterJoin/OuterApply or either side of FullOuterJoin), the driving node
// of that NestOp (X) is capped with a project with a null sentinel and
// the dependant collection nodes (the rest of the NestOp children)
// are filtered based on that sentinel:
// LOJ/OA/FOJ (X, NestOp(Y, Z1, Z2, ..ZN)) => NestOp( LOJ/OA/FOJ (X, PROJECT (Y, v = 1)), FILTER(Z1, v!=null), FILTER(Z2, v!=null), ... FILTER(ZN, v!=null))
// FOJ (NestOp(Y, Z1, Z2, ..ZN), X) => NestOp( LOJ/OA/FOJ (PROJECT (Y, v = 1), X), FILTER(Z1, v!=null), FILTER(Z2, v!=null), ... FILTER(ZN, v!=null))
// Also, FILTER(Zi, v != null) may be transformed to push the filter below any NestOps.
// The definitions for collection vars corresponding to the filtered collection nodes (in m_definingNodeMap)
// are also updated to filter based on the sentinel.
// Requires: Every input to the join/apply must have a key.
// </remarks>
private Node ApplyOpJoinOp(Op op, Node n)
{
// First, visit my children
VisitChildren(n);
// Now determine if any of the input nodes are a nestOp.
var countOfNestInputs = 0;
foreach (var chi in n.Children)
{
var nestOp = chi.Op as NestBaseOp;
if (null != nestOp)
{
countOfNestInputs++;
if (OpType.SingleStreamNest
== chi.Op.OpType)
{
// There should not be a SingleStreamNest in the tree, because we made a decision
// that in essence means the only way to get a SingleStreamNest is to have a
// PhysicalProject over something with an underlying NestOp. Having
//
// Project(Collect(PhysicalProject(...)))
//
// isn’t good enough, because that will get converted to a MultiStreamNest, with
// the SingleStreamNest as the input to the MultiStreamNest.
throw new InvalidOperationException(
Strings.ADP_InternalProviderError((int)EntityUtil.InternalErrorCode.JoinOverSingleStreamNest));
}
}
}
// If none of the inputs are a nest, then we don't really need to do anything.
if (0 == countOfNestInputs)
{
return n;
}
// We can only pull the nest over a Join/Apply if it has keys, so
// we can order things; if it doesn't have keys, we throw a NotSupported
// exception.
foreach (var chi in n.Children)
{
if (op.OpType != OpType.MultiStreamNest
&& chi.Op.IsRelOp)
{
var keys = Command.PullupKeys(chi);
if (null == keys
|| keys.NoKeys)
{
throw new NotSupportedException(Strings.ADP_KeysRequiredForJoinOverNest(op.OpType.ToString()));
}
}
}
// Alright, we're OK to pull the nestOp over the joinOp/applyOp.
//
// That means:
//
// (1) build a new list of children for the nestOp and for the joinOp/applyOp
// (2) build the new list of collectionInfos for the new nestOp.
var newNestChildren = new List<Node>();
var newJoinApplyChildren = new List<Node>();
var newCollectionInfoList = new List<CollectionInfo>();
foreach (var chi in n.Children)
{
if (chi.Op.OpType
== OpType.MultiStreamNest)
{
newCollectionInfoList.AddRange(((MultiStreamNestOp)chi.Op).CollectionInfo);
// SQLBUDT #615513: If the nest op is on a 'nullable' side of join
// (i.e. right side of LeftOuterJoin/OuterApply or either side of FullOuterJoin)
// the driving node of that nest operation needs to be capped with a project with
// a null sentinel and the dependant collection nodes need to be filtered based on that sentinel.
//
// LOJ/OA/FOJ (X, MSN(Y, Z1, Z2, ..ZN)) => MSN( LOJ/OA/FOJ (X, PROJECT (Y, v = 1)), FILTER(Z1, v!=null), FILTER(Z2, v!=null), ... FILTER(ZN, v!=null))
//.........这里部分代码省略.........
开发者ID:jesusico83,项目名称:Telerik,代码行数:101,代码来源:NestPullup.cs
示例19: NestingNotSupported
// <summary>
// Not Supported common processing
// For all those cases where we don't intend to support
// a nest operation as a child, we have this routine to
// do the work.
// </summary>
private Node NestingNotSupported(Op op, Node n)
{
// First, visit my children
VisitChildren(n);
m_varRemapper.RemapNode(n);
// Make sure we don't have a child that is a nest op.
foreach (var chi in n.Children)
{
if (IsNestOpNode(chi))
{
throw new NotSupportedException(Strings.ADP_NestingNotSupported(op.OpType.ToString(), chi.Op.OpType.ToString()));
}
}
return n;
}
开发者ID:jesusico83,项目名称:Telerik,代码行数:22,代码来源:NestPullup.cs
示例20: VisitPropertyOp
private Node VisitPropertyOp(Op op, Node n, PropertyRef propertyRef, bool throwIfMissing)
{
PlanCompiler.Assert(
op.OpType == OpType.Property || op.OpType == OpType.RelProperty,
"Unexpected optype: " + op.OpType);
var inputType = n.Child0.Op.Type;
var outputType = op.Type;
// First visit all my children
VisitChildren(n);
Node newNode = null;
var inputTypeInfo = m_typeInfo.GetTypeInfo(inputType);
if (TypeUtils.IsStructuredType(outputType))
{
var outputTypeInfo = m_typeInfo.GetTypeInfo(outputType);
var fieldTypes = new List<md.EdmProperty>();
var fieldValues = new List<Node>();
var expectedProperties = m_nodePropertyMap[n];
foreach (var npr in outputTypeInfo.PropertyRefList)
{
// Is this a property that's desired by my consumers?
if (expectedProperties.Contains(npr))
{
var newPropRef = npr.CreateNestedPropertyRef(propertyRef);
md.EdmProperty newNestedProp;
if (inputTypeInfo.TryGetNewProperty(newPropRef, throwIfMissing, out newNestedProp))
{
var outputNestedProp = outputTypeInfo.GetNewProperty(npr);
var field = BuildAccessor(n.Child0, newNestedProp);
if (null != field)
{
fieldTypes.Add(outputNestedProp);
fieldValues.Add(field);
}
}
}
}
Op newRecordOp = m_command.CreateNewRecordOp(outputTypeInfo.FlattenedTypeUsage, fieldTypes);
newNode = m_command.CreateNode(newRecordOp, fieldValues);
}
else
{
var newProp = inputTypeInfo.GetNewProperty(propertyRef);
// Build an accessor over the new property
newNode = BuildAccessorWithNulls(n.Child0, newProp);
}
return newNode;
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:53,代码来源:NominalTypeEliminator.cs
注:本文中的Op类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论