<commit_before>/* DO NOT EDIT: File is autogenerated */
package <%= schema.java.package %>;
<% set_iris_mode %>

@javax.annotation.Generated( "Domgen" )
@SuppressWarnings( { "UnusedDeclaration" } )
public class <%= schema.name %>Codec
{
  /* Type Codes */
<% schema.object_types.select{|o|!o.abstract? && o.iris.generate? }.each_with_index do |object_type, index|
%>  static final byte <%= uppercase_constantize(object_type.name) %>_TYPE_CODE = (byte)<%= index + 1 %>;
<% end %>

  /* Attr Masks */
<% schema.object_types.select{|o|!o.abstract? && o.iris.generate? }.each_with_index do |object_type, index|
%>  public static final int <%= uppercase_constantize(object_type.name) %>_CLIENT_TO_SERVER_ATTR_MASK = <%= object_type.attributes.select{|a| a.iris.client_side? && a.persistent? && !a.iris.runtime_managed? }.collect{|a| "#{j_classname(a.object_type.java.classname)}.#{uppercase_constantize(a.java.field_name)}_ATTR_ID" }.join(" | ") %>;
  static final int <%= uppercase_constantize(object_type.name) %>_SERVER_TO_SERVER_ATTR_MASK = <%= object_type.attributes.select{|a| a.persistent? && !a.iris.runtime_managed? }.collect{|a| "#{j_classname(a.object_type.java.classname)}.#{uppercase_constantize(a.java.field_name)}_ATTR_ID" }.join(" | ") %>;
<% end %>

  private static final Class<?>[] CLASSES_FOR_TYPE_CODE = {
    null,
    <%= schema.object_types.select{|o|!o.abstract? && o.iris.generate?}.collect{|o|"#{j_classname(o.java.classname)}.class"}.join(",\n    ") %>
  };

  private static final int[] SERVER_TO_SERVER_ATTR_MASK_FOR_TYPE_CODE = {
    0,
    <%= schema.object_types.select{|o|!o.abstract? && o.iris.generate?}.collect{|o|"#{uppercase_constantize(o.name)}_SERVER_TO_SERVER_ATTR_MASK"}.join(",\n    ") %>
  };

  public static Class<?> getClassForTypeCode( final int typeCode )
  {
    return CLASSES_FOR_TYPE_CODE[typeCode - 1];
  }

  public static int getTypeCodeForClass( final Class<?> type )
  {
    for( int i = 0; i < CLASSES_FOR_TYPE_CODE.length; i++ )
    {
      if( CLASSES_FOR_TYPE_CODE[i] == type )
      {
        return i;
      }
    }
    return -1;
  }

  public static java.util.Map<String, Object> readBean( final byte[] input, final int metadataMask )
    throws java.io.IOException, ClassNotFoundException
  {
    return readBean( new java.io.ObjectInputStream( new java.io.ByteArrayInputStream( input ) ), metadataMask );
  }

  private static java.util.Map<String, Object> readBean( final java.io.ObjectInput input, final int metadataMask )
     throws java.io.IOException, ClassNotFoundException
  {
      final java.util.Map<String, Object> data = new java.util.HashMap<String, Object>();

      final int typeCode = input.readByte();
      data.put( iris.beans.AbstractBean.TYPECODE, typeCode );

      final Object primaryKey = input.readObject();
      data.put( iris.persist.DefaultPersistentPeer.ID, primaryKey );

      final int attributesMask;
      if ( 0 != ( metadataMask & iris.beans.io.BeanCodec.MD_ATTR_MASK ) )
      {
         attributesMask = input.readInt();
      }
      else
      {
        attributesMask = SERVER_TO_SERVER_ATTR_MASK_FOR_TYPE_CODE[typeCode - 1];
      }
      if ( 0 != ( metadataMask & iris.beans.io.BeanCodec.MD_TO_AND_FROM_DATES ) )
      {
         final long to = input.readLong();
         if ( 0 != to )
         {
            data.put( iris.busobj.BusObjEntry.TO_DATE, new java.sql.Timestamp( to ) );
         }
      }

    <% schema.object_types.select{|o|!o.abstract? && o.iris.generate? }.each_with_index do |object_type, index|
%>if( <%= uppercase_constantize(object_type.name) %>_TYPE_CODE == typeCode )<commit_msg>Reference ID through the class that defines it<commit_after>/* DO NOT EDIT: File is autogenerated */
package <%= schema.java.package %>;
<% set_iris_mode %>

@javax.annotation.Generated( "Domgen" )
@SuppressWarnings( { "UnusedDeclaration" } )
public class <%= schema.name %>Codec
{
  /* Type Codes */
<% schema.object_types.select{|o|!o.abstract? && o.iris.generate? }.each_with_index do |object_type, index|
%>  static final byte <%= uppercase_constantize(object_type.name) %>_TYPE_CODE = (byte)<%= index + 1 %>;
<% end %>

  /* Attr Masks */
<% schema.object_types.select{|o|!o.abstract? && o.iris.generate? }.each_with_index do |object_type, index|
%>  public static final int <%= uppercase_constantize(object_type.name) %>_CLIENT_TO_SERVER_ATTR_MASK = <%= object_type.attributes.select{|a| a.iris.client_side? && a.persistent? && !a.iris.runtime_managed? }.collect{|a| "#{j_classname(a.object_type.java.classname)}.#{uppercase_constantize(a.java.field_name)}_ATTR_ID" }.join(" | ") %>;
  static final int <%= uppercase_constantize(object_type.name) %>_SERVER_TO_SERVER_ATTR_MASK = <%= object_type.attributes.select{|a| a.persistent? && !a.iris.runtime_managed? }.collect{|a| "#{j_classname(a.object_type.java.classname)}.#{uppercase_constantize(a.java.field_name)}_ATTR_ID" }.join(" | ") %>;
<% end %>

  private static final Class<?>[] CLASSES_FOR_TYPE_CODE = {
    null,
    <%= schema.object_types.select{|o|!o.abstract? && o.iris.generate?}.collect{|o|"#{j_classname(o.java.classname)}.class"}.join(",\n    ") %>
  };

  private static final int[] SERVER_TO_SERVER_ATTR_MASK_FOR_TYPE_CODE = {
    0,
    <%= schema.object_types.select{|o|!o.abstract? && o.iris.generate?}.collect{|o|"#{uppercase_constantize(o.name)}_SERVER_TO_SERVER_ATTR_MASK"}.join(",\n    ") %>
  };

  public static Class<?> getClassForTypeCode( final int typeCode )
  {
    return CLASSES_FOR_TYPE_CODE[typeCode - 1];
  }

  public static int getTypeCodeForClass( final Class<?> type )
  {
    for( int i = 0; i < CLASSES_FOR_TYPE_CODE.length; i++ )
    {
      if( CLASSES_FOR_TYPE_CODE[i] == type )
      {
        return i;
      }
    }
    return -1;
  }

  public static java.util.Map<String, Object> readBean( final byte[] input, final int metadataMask )
    throws java.io.IOException, ClassNotFoundException
  {
    return readBean( new java.io.ObjectInputStream( new java.io.ByteArrayInputStream( input ) ), metadataMask );
  }

  private static java.util.Map<String, Object> readBean( final java.io.ObjectInput input, final int metadataMask )
     throws java.io.IOException, ClassNotFoundException
  {
      final java.util.Map<String, Object> data = new java.util.HashMap<String, Object>();

      final int typeCode = input.readByte();
      data.put( iris.beans.AbstractBean.TYPECODE, typeCode );

      final Object primaryKey = input.readObject();
      data.put( iris.persist.DatabasePeer.ID, primaryKey );

      final int attributesMask;
      if ( 0 != ( metadataMask & iris.beans.io.BeanCodec.MD_ATTR_MASK ) )
      {
         attributesMask = input.readInt();
      }
      else
      {
        attributesMask = SERVER_TO_SERVER_ATTR_MASK_FOR_TYPE_CODE[typeCode - 1];
      }
      if ( 0 != ( metadataMask & iris.beans.io.BeanCodec.MD_TO_AND_FROM_DATES ) )
      {
         final long to = input.readLong();
         if ( 0 != to )
         {
            data.put( iris.busobj.BusObjEntry.TO_DATE, new java.sql.Timestamp( to ) );
         }
      }

    <% schema.object_types.select{|o|!o.abstract? && o.iris.generate? }.each_with_index do |object_type, index|
%>if( <%= uppercase_constantize(object_type.name) %>_TYPE_CODE == typeCode )
{'fraction_non_alphanumeric': 0.15261707988980716, 'fraction_numerical': 0.0024793388429752068, 'mean_word_length': 3.8149867374005306, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 51, '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': '5435349', 'n_tokens_mistral': 2576, 'n_tokens_neox': 2451, 'n_words': 429}