gt:                             = new StringBuilder("The attribute \"");
context: /**
   * Copyright (c) 2016, All partners of the iTesla project (http://www.itesla-project.eu/consortium)
   * This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/.
   */
  package cim1.model;
  
  import cim1.exc.InterpretationException;
  import cim1.exc.LinkageException;
  import java.util.BitSet;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Map;
  import java.util.EnumMap;
  import javax.xml.stream.XMLStreamException;
  import cim1.CIMURI;
  import javax.xml.stream.XMLStreamWriter;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  /**
   *
   * This file has been automatically generated by CIMGateway
   *
   * Description :
   *
   * This class "ControlArea.java" represents the
   * class ControlArea extends IdentifiedObject
   *    + netInterchange   1..1   float 
   *    + pTolerance   1..1   float 
   *    + TopologicalNode   0..-1   TopologicalNode   (inverseAssociation) 
   *    + TieFlow   0..-1   TieFlow   (inverseAssociation) 
   *    + ControlAreaGeneratingUnit   0..-1   ControlAreaGeneratingUnit   (inverseAssociation) 
  
   */
  public class ControlArea extends IdentifiedObject {
  
      private static Logger LOGGER = LoggerFactory.getLogger(ControlArea.class);
  
      /**
       * Attribute "netInterchange"
       *
       * Comment from profile:
       * The specified positive net interchange into the control area.
       */
      public float netInterchange;
  
      /**
       * Attribute "pTolerance"
       *
       * Comment from profile:
       * Active power net interchange tolerance
       */
      public float pTolerance;
  
      /**
       * Attribute "topologicalNode"
       *
       * Comment from profile:
       * The topological nodes included in the control area.
       */
      public List<TopologicalNode> topologicalNode;
  
      /**
       * Attribute "tieFlow"
       *
       * Comment from profile:
       * The tie flows associated with the control area.
       */
      public List<TieFlow> tieFlow;
  
      /**
       * Attribute "controlAreaGeneratingUnit"
       *
       * Comment from profile:
       * The generating unit specificaitons for the control area.
       */
      public List<ControlAreaGeneratingUnit> controlAreaGeneratingUnit;
  
      /**
       * The current bitset describing the state of each CIM attribute of this
       * class
       */
      private BitSet currentBitset = new BitSet();
  
     /**
      * The bitset describing which CIM attributes of this class have to set to
      * be consistent within a "merged" context
      */
      private final BitSet minBitset = new BitSet();
  
     /**
      * The Map of subset<=>bitset describing which CIM attributes of this class
      * have to set to be consistent within a specific subset context
      */
      private final Map<Subset, BitSet> minBitsets
              = new EnumMap<Subset, BitSet>(Subset.class);
  
      
      /**
       * Utility to return the "netInterchange" value
       *
       * @return the value of the attribute "netInterchange"
       */
      public float getNetInterchange() {
          return this.netInterchange;
      }
  
      /**
       * Utility to set the "netInterchange" value
       *
       * @param netInterchangeValue 
       *            value to set
       */
      public void setNetInterchange(float netInterchangeValue) {
          this.netInterchange = netInterchangeValue;
          this.currentBitset.set(0);
      }
  
      /**
       * Utility to test if the value of "netInterchange" has been set
       *
       * @return boolean
       *            if true the attribute "netInterchange" is already set
       *            if false isn't yet
       */
      public boolean netInterchangeIsSet() {
          return this.currentBitset.get(0);
       }
      
      /**
       * Utility to return the "pTolerance" value
       *
       * @return the value of the attribute "pTolerance"
       */
      public float getPTolerance() {
          return this.pTolerance;
      }
  
      /**
       * Utility to set the "pTolerance" value
       *
       * @param pToleranceValue 
       *            value to set
       */
      public void setPTolerance(float pToleranceValue) {
          this.pTolerance = pToleranceValue;
          this.currentBitset.set(1);
      }
  
      /**
       * Utility to test if the value of "pTolerance" has been set
       *
       * @return boolean
       *            if true the attribute "pTolerance" is already set
       *            if false isn't yet
       */
      public boolean pToleranceIsSet() {
          return this.currentBitset.get(1);
       }
    /**
     * Utility to return the "topologicalNode" List of 
     * "TopologicalNode" enum
     *
     * @return the list of the attributes "topologicalNode"
     */
      public List<TopologicalNode > getTopologicalNode() {
          return this.topologicalNode;
      }
  
      /**
       * Utility to add a value within the "topologicalNode" ArrayList of 
       * "TopologicalNode"
       *
       * @param topologicalNodeValue 
       *            value to add within the ArrayList
       * @param setInverse
       *            boolean to specify whether to set the inverse association or not
       * @throws LinkageException
       */
      public void addTopologicalNode(
              TopologicalNode topologicalNodeValue, 
              boolean setInverse) throws LinkageException {
          
          if (topologicalNode == null) {
              topologicalNode = new ArrayList<TopologicalNode>();
          }
          
          this.topologicalNode.add(topologicalNodeValue);
          this.currentBitset.set(2);
         
          if (setInverse) {
              
              if (topologicalNodeValue != null) {
                  topologicalNodeValue.setControlArea(this, false);
              }
          }
      }
  
      /**
       * Utility to test if the value of "topologicalNode" has been set
       *
       * @return boolean
       *            if true the attribute "topologicalNode" is already set
       *            if false it isn't yet
       */
      public boolean topologicalNodeIsSet() {
          return this.currentBitset.get(2);
      }
    /**
     * Utility to return the "tieFlow" List of 
     * "TieFlow" enum
     *
     * @return the list of the attributes "tieFlow"
     */
      public List<TieFlow > getTieFlow() {
          return this.tieFlow;
      }
  
      /**
       * Utility to add a value within the "tieFlow" ArrayList of 
       * "TieFlow"
       *
       * @param tieFlowValue 
       *            value to add within the ArrayList
       * @param setInverse
       *            boolean to specify whether to set the inverse association or not
       * @throws LinkageException
       */
      public void addTieFlow(
              TieFlow tieFlowValue, 
              boolean setInverse) throws LinkageException {
          
          if (tieFlow == null) {
              tieFlow = new ArrayList<TieFlow>();
          }
          
          this.tieFlow.add(tieFlowValue);
          this.currentBitset.set(3);
         
          if (setInverse) {
              
              if (tieFlowValue != null) {
                  tieFlowValue.setControlArea(this, false);
              }
          }
      }
  
      /**
       * Utility to test if the value of "tieFlow" has been set
       *
       * @return boolean
       *            if true the attribute "tieFlow" is already set
       *            if false it isn't yet
       */
      public boolean tieFlowIsSet() {
          return this.currentBitset.get(3);
      }
    /**
     * Utility to return the "controlAreaGeneratingUnit" List of 
     * "ControlAreaGeneratingUnit" enum
     *
     * @return the list of the attributes "controlAreaGeneratingUnit"
     */
      public List<ControlAreaGeneratingUnit > getControlAreaGeneratingUnit() {
          return this.controlAreaGeneratingUnit;
      }
  
      /**
       * Utility to add a value within the "controlAreaGeneratingUnit" ArrayList of 
       * "ControlAreaGeneratingUnit"
       *
       * @param controlAreaGeneratingUnitValue 
       *            value to add within the ArrayList
       * @param setInverse
       *            boolean to specify whether to set the inverse association or not
       * @throws LinkageException
       */
      public void addControlAreaGeneratingUnit(
              ControlAreaGeneratingUnit controlAreaGeneratingUnitValue, 
              boolean setInverse) throws LinkageException {
          
          if (controlAreaGeneratingUnit == null) {
              controlAreaGeneratingUnit = new ArrayList<ControlAreaGeneratingUnit>();
          }
          
          this.controlAreaGeneratingUnit.add(controlAreaGeneratingUnitValue);
          this.currentBitset.set(4);
         
          if (setInverse) {
              
              if (controlAreaGeneratingUnitValue != null) {
                  controlAreaGeneratingUnitValue.setControlArea(this, false);
              }
          }
      }
  
      /**
       * Utility to test if the value of "controlAreaGeneratingUnit" has been set
       *
       * @return boolean
       *            if true the attribute "controlAreaGeneratingUnit" is already set
       *            if false it isn't yet
       */
      public boolean controlAreaGeneratingUnitIsSet() {
          return this.currentBitset.get(4);
      }
  
  
      /**
       * Factory of the class
       *
       * @param id
       *            id of the class ControlArea to create
       * @return the class created
       */
      public static ControlArea create(final String id) {
          ControlArea newControlArea = new ControlArea();
          newControlArea.setId(id);
          return newControlArea;
      }
  
      /**
       * Utility to "clear" the content of a class when a subset is invalidated
       *
       * @param subset subset to clean
       */
      @Override
      public void clearContent(Subset subset) {
  
          // First of all, we clear the associations:
          this.clearAssociations(subset);
  
          switch (subset) {
              default: // nothing to clear
          }
      }
  
      /**
       * Utility to read an attribute
       * This function is called by the CIMModel
       *
       * @param class_name
       *            the read name of class
       * @param attr_name
       *            the read name of attribute
       * @param value
       *            the read value of the attribute
       * @param model
       *            the interface to the model this class belongs to
       * @throws InterpretationException
       */
      @Override
      public void readAttribute(final String class_name, final String attr_name,
                                final String value, CIMModel model) throws InterpretationException {
  
          if (class_name.equals("ControlArea")) {
              if (attr_name.equals("netInterchange")) {
  
                  if (!(model.isCurrentSubsetSet())
                          || (model.getCurrentSubset() == Subset.Equipment)) {
                      float typedValue;
                      if (!value.isEmpty()) {
  
                          try {
                              if (value.equalsIgnoreCase("NaN")) {
                                  throw new NumberFormatException();
                              }
                              typedValue = Float
                                      .parseFloat(value);
                          } catch(NumberFormatException e) {
                              throw new InterpretationException("The attribute netInterchange in class "
                                  + "ControlArea is supposed to be a Float"
                                  + " but has not the expected NumberFormat");
                          }
  
                      } else {
                          throw new InterpretationException("The field of float"
                              + " in ControlArea was found empty");
                      }
  
                      this.setNetInterchange(typedValue);
                      return;
                  } else {
                      StringBuilder errorMessage
  