<commit_before>package com.mikesamuel.cil.ast.meta;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.GenericDeclaration;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.Arrays;
import java.util.Deque;
import java.util.Set;
import java.util.concurrent.ExecutionException;

import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

/**
 * Fetches meta-data for an ambiguous type name.
 */
public interface TypeInfoResolver {


  /**
   * Meta-data for an ambiguous type name.
   *
   * @param className a name whose type and ancestor types are either
   *    {@link com.mikesamuel.cil.ast.meta.Name.Type#PACKAGE} or
   *    {@link com.mikesamuel.cil.ast.meta.Name.Type#CLASS}
   */
  Optional<TypeInfo> resolve(Name className);

  /**
   * Looks up the given callable.
   */
  default Optional<CallableInfo> resolveCallable(Name anc) {
    Preconditions.checkArgument(anc.type == Name.Type.METHOD);
    Optional<TypeInfo> tiOpt = resolve(anc.getContainingClass());
    if (tiOpt.isPresent()) {
      return tiOpt.get().declaredCallableNamed(anc);
    }<commit_msg>exposed convenience to find fields<commit_after>package com.mikesamuel.cil.ast.meta;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.GenericDeclaration;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.Arrays;
import java.util.Deque;
import java.util.Set;
import java.util.concurrent.ExecutionException;

import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

/**
 * Fetches meta-data for an ambiguous type name.
 */
public interface TypeInfoResolver {


  /**
   * Meta-data for an ambiguous type name.
   *
   * @param className a name whose type and ancestor types are either
   *    {@link com.mikesamuel.cil.ast.meta.Name.Type#PACKAGE} or
   *    {@link com.mikesamuel.cil.ast.meta.Name.Type#CLASS}
   */
  Optional<TypeInfo> resolve(Name className);

  /**
   * Looks up the named callable.
   */
  default Optional<CallableInfo> resolveCallable(Name methodName) {
    Preconditions.checkArgument(methodName.type == Name.Type.METHOD);
    Optional<TypeInfo> tiOpt = resolve(methodName.getContainingClass());
    if (tiOpt.isPresent()) {
      return tiOpt.get().declaredCallableNamed(methodName);
    }
    return Optional.absent();
  }

  /**
   * Looks up the named field.
   */
  default Optional<FieldInfo> resolveField(Name fieldName) {
    Preconditions.checkArgument(fieldName.type == Name.Type.FIELD);
    Optional<TypeInfo> tiOpt = resolve(fieldName.getContainingClass());
    if (tiOpt.isPresent()) {
      return tiOpt.get().declaredFieldNamed(fieldName);
    }
{'fraction_non_alphanumeric': 0.11742328176515343, 'fraction_numerical': 0.0, 'mean_word_length': 4.610241820768136, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4043576', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1196, 'n_words': 234}