1 /*******************************************************************************
\r
2 * Copyright (c) 2014, 2016 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.r.scl.variable;
\r
14 import org.rosuda.REngine.REXP;
\r
15 import org.rosuda.REngine.REXPMismatchException;
\r
16 import org.rosuda.REngine.RList;
\r
18 public class RNamedItemNode implements RVariableNode {
\r
20 public RNamedItemNode(RVariableNode parent, String name) {
\r
21 this.parent = parent;
\r
25 private RVariableNode parent;
\r
26 private String name;
\r
29 public REXP getValue() {
\r
30 REXP parentValue = parent.getValue();
\r
31 if (parentValue == null || ! parentValue.isList())
\r
36 list = parentValue.asList();
\r
37 } catch (REXPMismatchException e) {
\r
38 // Should never happen
\r
42 return list.at(name);
\r
46 public String getName() {
\r
47 return RNodeManager.NAMED_ITEM_NAME_PREFIX + name;
\r
51 public RVariableNode getParent() {
\r