/*******************************************************************************
* Copyright (c) 2010 Association for Decentralized Information Management in
* Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* VTT Technical Research Centre of Finland - initial API and implementation
*******************************************************************************/
package org.simantics.databoard.parser.repository;
import java.io.IOException;
import java.io.StringReader;
import java.util.Collection;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.simantics.databoard.Bindings;
import org.simantics.databoard.Datatypes;
import org.simantics.databoard.binding.ArrayBinding;
import org.simantics.databoard.binding.Binding;
import org.simantics.databoard.binding.BooleanBinding;
import org.simantics.databoard.binding.ByteBinding;
import org.simantics.databoard.binding.DoubleBinding;
import org.simantics.databoard.binding.FloatBinding;
import org.simantics.databoard.binding.IntegerBinding;
import org.simantics.databoard.binding.LongBinding;
import org.simantics.databoard.binding.MapBinding;
import org.simantics.databoard.binding.OptionalBinding;
import org.simantics.databoard.binding.RecordBinding;
import org.simantics.databoard.binding.StringBinding;
import org.simantics.databoard.binding.UnionBinding;
import org.simantics.databoard.binding.VariantBinding;
import org.simantics.databoard.binding.error.BindingConstructionException;
import org.simantics.databoard.binding.error.BindingException;
import org.simantics.databoard.binding.error.RuntimeBindingException;
import org.simantics.databoard.binding.factory.BindingScheme;
import org.simantics.databoard.binding.mutable.MutableVariant;
import org.simantics.databoard.file.RuntimeIOException;
import org.simantics.databoard.parser.DataParser;
import org.simantics.databoard.parser.DataValuePrinter;
import org.simantics.databoard.parser.ParseException;
import org.simantics.databoard.parser.PrintFormat;
import org.simantics.databoard.parser.TokenMgrError;
import org.simantics.databoard.parser.ast.value.AstArray;
import org.simantics.databoard.parser.ast.value.AstBoolean;
import org.simantics.databoard.parser.ast.value.AstComponentAssignment;
import org.simantics.databoard.parser.ast.value.AstFloat;
import org.simantics.databoard.parser.ast.value.AstInteger;
import org.simantics.databoard.parser.ast.value.AstMap;
import org.simantics.databoard.parser.ast.value.AstMapAssignment;
import org.simantics.databoard.parser.ast.value.AstNull;
import org.simantics.databoard.parser.ast.value.AstRecord;
import org.simantics.databoard.parser.ast.value.AstReference;
import org.simantics.databoard.parser.ast.value.AstString;
import org.simantics.databoard.parser.ast.value.AstTaggedValue;
import org.simantics.databoard.parser.ast.value.AstTuple;
import org.simantics.databoard.parser.ast.value.AstValue;
import org.simantics.databoard.parser.ast.value.AstValueDefinition;
import org.simantics.databoard.parser.ast.value.AstVariant;
import org.simantics.databoard.parser.ast.value.visitor.AstValueVisitor;
import org.simantics.databoard.parser.unparsing.DataTypePrinter;
import org.simantics.databoard.type.Component;
import org.simantics.databoard.type.Datatype;
import org.simantics.databoard.type.MapType;
import org.simantics.databoard.type.RecordType;
import org.simantics.databoard.type.UnionType;
/**
* Data value repository is a collection of name data values.
* Each value is associated with type.
*
*
* It can also translate data lines and value texts to objects and
* print values as
*
*
*
* @author Hannu Niemistö
*/
public class DataValueRepository {
// Type respository to convert
DataTypeRepository typeRepository = Datatypes.datatypeRepository;
// Scheme to convert values
BindingScheme bindingScheme = Bindings.mutableBindingFactory;
/** Stored values */
Map values = new HashMap();
Map