<commit_before>package jltools.types;

import jltools.util.*;

import java.io.*;


/**
 * A type represents a type in some Java-based typesystem.  Each type
 * is tied to a particular TypeSystem; types with different TypeSystems
 * are incomparable.
 * <p>
 * <b>All types are immutable.</b>
 */
public abstract class Type extends AnnotatedObject implements Serializable
{
  static final long serialVersionUID = -7347257353426805117L;

  /**
   * The system to be used for comparison of types. This must be set in one
   * of two ways: either through the constructor taking one argument, or
   * through deserialization.
   * <p>
   * Note that this field itself is not serialized. Instead a 
   * <code>TypeInputStream</code> should be used to deserialize the this
   * object (or any subclass) so that the <code>TypeSystem</code> is properly
   * set.
   */
  protected transient TypeSystem ts;

  /**
   * Used for deserializing types.
   */
  protected Type()
  {
    this( null);
  }
  
  /** Creates a new type in the given a TypeSystem. */
  public Type(TypeSystem ts) { this.ts = ts; }

  public abstract String getTypeString();

    public String translate() {
	return getTypeString();
    }

  /*
   * To be filled in by subtypes.
   */
  public abstract boolean isPrimitive();
  /*
   * To be filled in by subtypes.
   */
  public abstract boolean isCanonical();

  public abstract boolean isClassType();
  public abstract boolean isArrayType();

    /* Returns a non-null classtype iff isClassType() returns true  null otherwise */
    public ClassType toClassType() {
	return null;
    }

    /* Returns a non-null classtype iff isPrimitiveType() returns true  null otherwise */
    public PrimitiveType toPrimitiveType() {
	return null;
    }

    /* Returns a non-null classtype iff isArrayType() returns true  null otherwise */
    public ArrayType toArrayType() {
	return null;
    }


  public final Type extendArrayDims(int dims) throws SemanticException
  { 
    return ts.extendArrayDims(this,dims); 
  }  
  
  public final boolean isSameType(Type t) throws SemanticException
  { 
    return ts.isSameType(this,t); 
  }
  
  public final boolean descendsFrom(Type ancestorType)throws SemanticException
  { 
    return ts.descendsFrom(this,ancestorType); 
  }
  <commit_msg>New extension classes.  Broken constructor initialization stuff.<commit_after>package jltools.types;

import jltools.util.*;

import java.io.*;


/**
 * A type represents a type in some Java-based typesystem.  Each type
 * is tied to a particular TypeSystem; types with different TypeSystems
 * are incomparable.
 * <p>
 * <b>All types are immutable.</b>
 */
public abstract class Type extends AnnotatedObject implements Serializable
{
  static final long serialVersionUID = -7347257353426805117L;

  /**
   * The system to be used for comparison of types. This must be set in one
   * of two ways: either through the constructor taking one argument, or
   * through deserialization.
   * <p>
   * Note that this field itself is not serialized. Instead a 
   * <code>TypeInputStream</code> should be used to deserialize the this
   * object (or any subclass) so that the <code>TypeSystem</code> is properly
   * set.
   */
  protected transient TypeSystem ts;

  /**
   * Used for deserializing types.
   */
  protected Type()
  {
    this( null);
  }
  
  /** Creates a new type in the given a TypeSystem. */
  public Type(TypeSystem ts) { this.ts = ts; }

  public abstract String getTypeString();

    public String translate() {
	return getTypeString();
    }

  /*
   * To be filled in by subtypes.
   */
  public abstract boolean isPrimitive();
  /*
   * To be filled in by subtypes.
   */
  public abstract boolean isCanonical();

  public abstract boolean isClassType();
  public abstract boolean isArrayType();

    /* Returns a non-null classtype iff isClassType() returns true  null otherwise */
    public ClassType toClassType() {
	return null;
    }

    /* Returns a non-null classtype iff isPrimitiveType() returns true  null otherwise */
    public PrimitiveType toPrimitiveType() {
	return null;
    }

    /* Returns a non-null classtype iff isArrayType() returns true  null otherwise */
    public ArrayType toArrayType() {
	return null;
    }


  public Type extendArrayDims(int dims) throws SemanticException
  { 
    return ts.extendArrayDims(this,dims); 
  }  
  
  public final boolean isSameType(Type t) throws SemanticException
  { 
    return ts.isSameType(this,t); 
  }
  
  public final boolean descendsFrom(Type ancestorType)throws SemanticException
  { 
    return ts.descendsFrom(this,ancestorType); 
  }
  
{'fraction_non_alphanumeric': 0.0854368932038835, 'fraction_numerical': 0.00819848975188781, 'mean_word_length': 3.2260711030082043, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '4413089', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1328, 'n_words': 483}