<commit_before>/*
 * file:       ExtendedData.java
 * author:     <NAME>
 * copyright:  (c) Tapster Rock Limited 2002-2003
 * date:       23/05/2003
 */
 
/*
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 */
 
package com.tapsterrock.mpp;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;

/**
 * This class represents the extended data structure which is used to 
 * hold additional non-core data items associated with tasks and resources.
 */
final class ExtendedData
{
   /**
    * Constructor. Given the var data block, and the offset of the extended
    * data block within the var data, the constructor extracts each data item
    * of extended data and inserts it into a Map using it's type as the key.
    * 
    * @param varData Var data block
    * @param offset Offset of extended data within the var data block
    */
   ExtendedData (FixDeferFix varData, int offset)
   {
      if (offset >= 0)
      {         
         m_data= varData;
         byte[] data = varData.getByteArray(offset);
         int index = 0;
         int size;
         int type;
         byte[] item;
            
         while (index < data.length)
         {
            size = MPPUtility.getInt(data, index);
            index += 4;
               
            type = MPPUtility.getInt(data, index);
            index += 4;
               
            m_map.put(new Integer (type), new ByteArray(data, index, size));
            index += size;
         }         
      }         
   }   
<commit_msg>Updated to avoid problems when no data is available.<commit_after>/*
 * file:       ExtendedData.java
 * author:     <NAME>
 * copyright:  (c) Tapster Rock Limited 2002-2003
 * date:       23/05/2003
 */
 
/*
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 */
 
package com.tapsterrock.mpp;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;

/**
 * This class represents the extended data structure which is used to 
 * hold additional non-core data items associated with tasks and resources.
 */
final class ExtendedData
{
   /**
    * Constructor. Given the var data block, and the offset of the extended
    * data block within the var data, the constructor extracts each data item
    * of extended data and inserts it into a Map using it's type as the key.
    * 
    * @param varData Var data block
    * @param offset Offset of extended data within the var data block
    */
   ExtendedData (FixDeferFix varData, int offset)
   {
      m_data= varData;
      byte[] data = varData.getByteArray(offset);
      
      if (data != null)
      {
         int index = 0;
         int size;
         int type;
         byte[] item;
            
         while (index < data.length)
         {
            size = MPPUtility.getInt(data, index);
            index += 4;
               
            type = MPPUtility.getInt(data, index);
            index += 4;
               
            m_map.put(new Integer (type), new ByteArray(data, index, size));
            index += size;
         }         
      }         
   }   

{'fraction_non_alphanumeric': 0.07650153441473038, 'fraction_numerical': 0.015563349408154318, 'mean_word_length': 2.3209606986899565, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6328574', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1195, 'n_words': 536}