本文整理汇总了C#中UnaryOperator.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# UnaryOperator.ToString方法的具体用法?C# UnaryOperator.ToString怎么用?C# UnaryOperator.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnaryOperator
的用法示例。
在下文中一共展示了UnaryOperator.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReplaceNestedOperator
public void ReplaceNestedOperator()
{
var unaryOperator = new UnaryOperator(UnaryOperatorType.BitwiseNot, "pro");
CriteriaOperator criteriaOperator = new GroupOperator(new BinaryOperator(), unaryOperator);
var binaryOperatorExtractor = new CriteriaOperatorExtractor();
var notOperator = new NotOperator();
binaryOperatorExtractor.Replace(ref criteriaOperator, unaryOperator.ToString(), notOperator);
Assert.AreEqual(((GroupOperator) criteriaOperator).Operands[1], notOperator);
}
示例2: RemoveNestedOperator
public void RemoveNestedOperator()
{
var unaryOperator = new UnaryOperator(UnaryOperatorType.IsNull, "prop2");
CriteriaOperator groupOperator = new GroupOperator(new BinaryOperator("pro1", 1), unaryOperator);
var binaryOperatorExtractor = new CriteriaOperatorExtractor();
binaryOperatorExtractor.Remove(ref groupOperator, unaryOperator.ToString());
Assert.AreEqual(new BinaryOperator("pro1", 1).ToString(), groupOperator.ToString());
}
示例3: ReplaceRootOperator
public void ReplaceRootOperator()
{
CriteriaOperator unaryOperator = new UnaryOperator(UnaryOperatorType.IsNull, "prop2");
var binaryOperatorExtractor = new CriteriaOperatorExtractor();
var replaceOperator = new BinaryOperator("pr", 1);
binaryOperatorExtractor.Replace(ref unaryOperator, unaryOperator.ToString(), replaceOperator);
Assert.AreEqual(unaryOperator, replaceOperator);
}
示例4: RemoveRootOperator
public void RemoveRootOperator()
{
CriteriaOperator unaryOperator = new UnaryOperator(UnaryOperatorType.IsNull, "prop2");
var binaryOperatorExtractor = new CriteriaOperatorExtractor();
binaryOperatorExtractor.Remove(ref unaryOperator, unaryOperator.ToString());
Assert.IsNull(unaryOperator);
}
示例5: InsertUnaryOperationMethod
// The following methods are used to insert methods to the bottom of the AST and convert operator to these method calls
// to support replication on operators
private static void InsertUnaryOperationMethod(Core core, ProtoCore.AST.Node root, UnaryOperator op, PrimitiveType r, PrimitiveType operand)
{
ProtoCore.AST.AssociativeAST.FunctionDefinitionNode funcDefNode = new ProtoCore.AST.AssociativeAST.FunctionDefinitionNode();
funcDefNode.access = ProtoCore.DSASM.AccessSpecifier.kPublic;
funcDefNode.IsAssocOperator = true;
funcDefNode.IsBuiltIn = true;
funcDefNode.Name = ProtoCore.DSASM.Constants.kInternalNamePrefix + op.ToString();
funcDefNode.ReturnType = new ProtoCore.Type() { Name = core.TypeSystem.GetType((int)r), UID = (int)r };
ProtoCore.AST.AssociativeAST.ArgumentSignatureNode args = new ProtoCore.AST.AssociativeAST.ArgumentSignatureNode();
args.AddArgument(new ProtoCore.AST.AssociativeAST.VarDeclNode()
{
memregion = ProtoCore.DSASM.MemoryRegion.kMemStack,
access = ProtoCore.DSASM.AccessSpecifier.kPublic,
NameNode = BuildAssocIdentifier(core, "%param"),
ArgumentType = new ProtoCore.Type { Name = core.TypeSystem.GetType((int)operand), UID = (int)operand }
});
funcDefNode.Singnature = args;
ProtoCore.AST.AssociativeAST.CodeBlockNode body = new ProtoCore.AST.AssociativeAST.CodeBlockNode();
ProtoCore.AST.AssociativeAST.IdentifierNode _return = BuildAssocIdentifier(core, ProtoCore.DSDefinitions.Kw.kw_return, ProtoCore.PrimitiveType.kTypeReturn);
ProtoCore.AST.AssociativeAST.IdentifierNode param = BuildAssocIdentifier(core, "%param");
body.Body.Add(new ProtoCore.AST.AssociativeAST.BinaryExpressionNode() { LeftNode = _return, Optr = ProtoCore.DSASM.Operator.assign, RightNode = new ProtoCore.AST.AssociativeAST.UnaryExpressionNode() { Expression = param, Operator = op } });
funcDefNode.FunctionBody = body;
(root as ProtoCore.AST.AssociativeAST.CodeBlockNode).Body.Add(funcDefNode);
}
示例6: GenerateUnaryOperatorMethodCallNode
private ProtoCore.AST.AssociativeAST.AssociativeNode GenerateUnaryOperatorMethodCallNode(UnaryOperator op, ProtoCore.AST.AssociativeAST.AssociativeNode operand)
{
ProtoCore.AST.AssociativeAST.FunctionCallNode funCallNode = new ProtoCore.AST.AssociativeAST.FunctionCallNode();
ProtoCore.AST.AssociativeAST.IdentifierNode funcName = new ProtoCore.AST.AssociativeAST.IdentifierNode { Value = ProtoCore.DSASM.Constants.kInternalNamePrefix + op.ToString(), Name = ProtoCore.DSASM.Constants.kInternalNamePrefix + op.ToString() };
funCallNode.Function = funcName;
funCallNode.Name = ProtoCore.DSASM.Constants.kInternalNamePrefix + op.ToString();
funCallNode.FormalArguments.Add(operand);
NodeUtils.CopyNodeLocation(funCallNode, operand);
return funCallNode;
}
示例7: GetUnaryOpFunction
/// <summary>
/// Return the internal function name for unary operator
/// </summary>
/// <param name="op"></param>
/// <returns></returns>
public static string GetUnaryOpFunction(UnaryOperator op)
{
return Constants.kInternalNamePrefix + op.ToString();
}
示例8: ToString
static string ToString (UnaryOperator op)
{
switch (op) {
case UnaryOperator.BitwiseComplement: return "~";
case UnaryOperator.Not: return "!";
}
throw new ArgumentException (op.ToString (), "op");
}