// Path: src/main/java/org/gwtproject/place/shared/PlaceHistoryMapper.java
// public interface PlaceHistoryMapper {
// 
//   /**
//    * Returns the {@link Place} associated with the given token.
//    *
//    * @param token a String token
//    * @return a {@link Place} instance
//    */
//   Place getPlace(String token);
// 
//   /**
//    * Returns the String token associated with the given {@link Place}.
//    *
//    * @param place a {@link Place} instance
//    * @return a String token
//    */
//   String getToken(Place place);
// }
// 
// Path: src/main/java/org/gwtproject/place/shared/PlaceTokenizer.java
// public interface PlaceTokenizer<P extends Place> {
// 
//   /**
//    * Returns the {@link Place} associated with the given token.
//    *
//    * @param token a String token
//    * @return a {@link Place} of type P
//    */
//   P getPlace(String token);
// 
//   /**
//    * Returns the token associated with the given {@link Place}.
//    *
//    * @param place a {@link Place} of type P
//    * @return a String token
//    */
//   String getToken(P place);
// }


import com.google.auto.common.AnnotationMirrors;
import com.google.auto.common.MoreElements;
import com.google.auto.common.MoreTypes;
import com.squareup.javapoet.ClassName;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
import javax.annotation.processing.Messager;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.ExecutableType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;
import org.gwtproject.place.shared.PlaceHistoryMapper;
import org.gwtproject.place.shared.PlaceTokenizer;
import org.gwtproject.place.shared.Prefix;
import org.gwtproject.place.shared.WithFactory;
import org.gwtproject.place.shared.WithTokenizers;
/*
 * Copyright 2017 The GWT Project Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gwtproject.place.processor;


class PlaceHistoryGeneratorContext {
  final TypeElement stringType;
  final TypeElement placeTokenizerType;
  final Messager messager;
  final Types types;
  final Elements elements;
  final TypeElement interfaceType;
  final DeclaredType factoryType;
  final String implName;
  final String packageName;

  private HashMap<String, Element> tokenizers;
  private TreeMap<TypeElement, String> placeTypes =
      new TreeMap<>(new MostToLeastDerivedPlaceTypeComparator());

  static PlaceHistoryGeneratorContext create(
      Messager messager, Types types, Elements elements, Element element) {
    TypeElement stringType = requireType(elements, String.class);
// Path: src/main/java/org/gwtproject/place/shared/PlaceHistoryMapper.java
// public interface PlaceHistoryMapper {
// 
//   /**
//    * Returns the {@link Place} associated with the given token.
//    *
//    * @param token a String token
//    * @return a {@link Place} instance
//    */
//   Place getPlace(String token);
// 
//   /**
//    * Returns the String token associated with the given {@link Place}.
//    *
//    * @param place a {@link Place} instance
//    * @return a String token
//    */
//   String getToken(Place place);
// }
// 
// Path: src/main/java/org/gwtproject/place/shared/PlaceTokenizer.java
// public interface PlaceTokenizer<P extends Place> {
// 
//   /**
//    * Returns the {@link Place} associated with the given token.
//    *
//    * @param token a String token
//    * @return a {@link Place} of type P
//    */
//   P getPlace(String token);
// 
//   /**
//    * Returns the token associated with the given {@link Place}.
//    *
//    * @param place a {@link Place} of type P
//    * @return a String token
//    */
//   String getToken(P place);
// }


// Path: processor/src/main/java/org/gwtproject/place/processor/PlaceHistoryGeneratorContext.java
import com.google.auto.common.AnnotationMirrors;
import com.google.auto.common.MoreElements;
import com.google.auto.common.MoreTypes;
import com.squareup.javapoet.ClassName;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
import javax.annotation.processing.Messager;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.ExecutableType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;
import org.gwtproject.place.shared.PlaceHistoryMapper;
import org.gwtproject.place.shared.PlaceTokenizer;
import org.gwtproject.place.shared.Prefix;
import org.gwtproject.place.shared.WithFactory;
import org.gwtproject.place.shared.WithTokenizers;

/*
 * Copyright 2017 The GWT Project Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gwtproject.place.processor;


class PlaceHistoryGeneratorContext {
  final TypeElement stringType;
  final TypeElement placeTokenizerType;
  final Messager messager;
  final Types types;
  final Elements elements;
  final TypeElement interfaceType;
  final DeclaredType factoryType;
  final String implName;
  final String packageName;

  private HashMap<String, Element> tokenizers;
  private TreeMap<TypeElement, String> placeTypes =
      new TreeMap<>(new MostToLeastDerivedPlaceTypeComparator());

  static PlaceHistoryGeneratorContext create(
      Messager messager, Types types, Elements elements, Element element) {
    TypeElement stringType = requireType(elements, String.class);
    TypeElement placeTokenizerType = requireType(elements, PlaceTokenizer.class);