本文整理汇总了C#中Tree.Node.getName方法的典型用法代码示例。如果您正苦于以下问题:C# Node.getName方法的具体用法?C# Node.getName怎么用?C# Node.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree.Node
的用法示例。
在下文中一共展示了Node.getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: define
public void define(Node id, Node val)
{
if (id != null && val != null)
{
if(!frame.ContainsKey(id.getName()))
frame.Add(id.getName(), val);
else
{
frame[id.getName()] = val;
}
}
}
示例2: assign
public void assign(Node id, Node value)
{
Node node = Environment.find(id, this.frame);
if (node == null && this.env == null)
Console.Error.WriteLine("undefined variable " + id.getName());
else if (node == null)
this.env.assign(id, value);
else
node.setCar(value);
}
示例3: assign
public void assign(Node id, Node val)
{
if (this.lookup(id) != null)
{
find(id, this.frame).setCar(val);
}
else
{
Console.Error.WriteLine("Cannot find " + id.getName());
}
}
示例4: find
// This is not in an object-oriented style, it's more or less a
// translation of the Scheme assq function.
private static Node find(Node id, Node alist)
{
if (! alist.isPair())
return null; // in Scheme we'd return #f
else
{
Node bind = alist.getCar();
if (id.getName().Equals(bind.getCar().getName()))
// return a list containing the value as only element
return bind.getCdr();
else
return find(id, alist.getCdr());
}
}
示例5: lookup
//added stuff from here and down
//obtaining value of a node
public Node lookup(Node id)
{
Node val = find(id, frame);
if (val == null && env == null)
{
Console.Error.WriteLine("undefined variable " + id.getName());
return Nil.getInstance();
}
else if (val == null)
// look up the identifier in the enclosing scope
return env.lookup(id);
else
// get the value out of the list we got from find()
return val.getCar();
}
示例6: assign
public void assign(Node id, Node val)
{
Node node = find(id, frame);
if (node == null && env == null)
Console.Error.WriteLine("undefined variable " + id.getName());
else if (node == null)
env.assign(id, val);
else
node.setCar(val);
}
示例7: apply2
private Node apply2(Node arg1, Node arg2)
{
string name = this.symbol.getName();
bool flag = name.Equals("eq?");
Node result;
if (flag)
{
bool flag2 = arg1.isSymbol() && arg2.isSymbol();
if (flag2)
{
string name2 = arg1.getName();
string name3 = arg2.getName();
result = BoolLit.getInstance(name2.Equals(name3));
}
else
{
result = BoolLit.getInstance(arg1 == arg2);
}
}
else
{
bool flag3 = name.Equals("cons");
if (flag3)
{
result = new Cons(arg1, arg2);
}
else
{
bool flag4 = name.Equals("set-car!");
if (flag4)
{
arg1.setCar(arg2);
result = Unspecific.getInstance();
}
else
{
bool flag5 = name.Equals("set-cdr!");
if (flag5)
{
arg1.setCdr(arg2);
result = Unspecific.getInstance();
}
else
{
bool flag6 = name.Equals("eval");
if (flag6)
{
bool flag7 = arg2.isEnvironment();
if (flag7)
{
result = arg1.eval((Environment)arg2);
}
else
{
Console.Error.WriteLine("Error: wrong type of argument");
result = Nil.getInstance();
}
}
else
{
bool flag8 = name.Equals("apply");
if (flag8)
{
result = arg1.apply(arg2);
}
else
{
bool flag9 = name[0] == 'b' && name.Length == 2;
if (flag9)
{
bool flag10 = arg1.isNumber() && arg2.isNumber();
if (flag10)
{
result = this.apply2(arg1.getIntVal(), arg2.getIntVal());
}
else
{
Console.Error.WriteLine("Error: invalid arguments");
result = Nil.getInstance();
}
}
else
{
Console.Error.WriteLine("Error: wrong number of arguments");
result = Nil.getInstance();
}
}
}
}
}
}
}
return result;
}
示例8: lookup
public Node lookup(Node id)
{
if (!frame.ContainsKey(id.getName()) && env == null)
{
Console.Error.WriteLine("undefined variable " + id.getName());
return Void.getInstance();
}
if (!frame.ContainsKey(id.getName()))
{
return env.lookup(id);
}
return (Node)frame[id.getName()];
//Node val = find(id, ConstructList(frame));
//if (val == null && env == null)
//{
// Console.Error.WriteLine("undefined variable " + id.getName());
// return null;
//}
//else if (val == null)
// // look up the identifier in the enclosing scope
// return env.lookup(id);
//else
// // get the value out of the list we got from find()
// return val.getCar();
}