if(getWatchList().contains(fullPath))
{
fullPath = fullPath.replace(watchTree.getInstancePath() + ".", "");
StringTokenizer tokenizer = new StringTokenizer(fullPath, ".");
ACompositeNode node = watchTree;
while(tokenizer.hasMoreElements())
{
String current = tokenizer.nextToken();
boolean found = false;
for(ANode child : node.getChildren())
{
if(child.getId().equals(current))
{
if(child instanceof ACompositeNode)
{
node = (ACompositeNode) child;
}
found = true;
break;
}
}
if(found)
{
continue;
}
else
{
if(tokenizer.hasMoreElements())
{
// not a leaf, create a composite state node
ACompositeNode newNode = new CompositeNode(current);
node.addChild(newNode);
node = newNode;
}
else
{
// it's a leaf node
VariableNode newNode = new VariableNode(current);
int[] start = { _currentRecordingIndex };
int[] lenght = { 1 };
Array value;
try
{
value = hdfVariable.read(start, lenght);
Type type = Type.fromValue(hdfVariable.getDataType().toString());
PhysicalQuantity quantity = new PhysicalQuantity();
AValue readValue = null;
switch(type)
{
case DOUBLE:
readValue = ValuesFactory.getDoubleValue(value.getDouble(0));
break;
case FLOAT:
readValue = ValuesFactory.getFloatValue(value.getFloat(0));
break;
case INTEGER:
readValue = ValuesFactory.getIntValue(value.getInt(0));
break;
default:
break;
}
quantity.setValue(readValue);
newNode.addPhysicalQuantity(quantity);
node.addChild(newNode);
}
catch(IOException | InvalidRangeException e)
{
throw new GeppettoExecutionException(e);