// Path: src/main/java/org/spongepowered/eventimplgen/signature/Descriptors.java
// public class Descriptors {
//     public static final String TYPE_UNKNOWN = "eventImplGen/UNKNOWN";
//     public static final String TYPE_ERROR = "eventImplGen/ERROR";
// 
//     private final Elements elements;
//     private final Types types;
//     private final TypeToDescriptorWriter descWriter;
// 
//     @Inject
//     Descriptors(final Elements elements, final Types types, final TypeToDescriptorWriter descWriter) {
//         this.elements = elements;
//         this.types = types;
//         this.descWriter = descWriter;
//     }
// 
//     public String getDescriptor(final ExecutableElement method) {
//         return this.getDescriptor((ExecutableType) method.asType(), true);
//     }
// 
//     public String getDescriptor(final ExecutableType method, final boolean includeReturnType) {
//         if (includeReturnType) {
//             return method.accept(this.descWriter, new StringBuilder()).toString();
//         } else {
//             final StringBuilder builder = new StringBuilder();
//             builder.append('(');
//             for (final TypeMirror type : method.getParameterTypes()) {
//                 type.accept(this.descWriter, builder);
//             }
//             builder.append(")V");
//             return builder.toString();
//         }
//     }
// 
//     public String getInternalName(TypeMirror name) {
//         name = this.types.erasure(name);
//         switch (name.getKind()) {
//             case DECLARED:
//                 return this.getInternalName(this.elements.getBinaryName((TypeElement) ((DeclaredType) name).asElement()).toString());
//             case ERROR:
//                 return Descriptors.TYPE_ERROR;
//             default:
//                 return Descriptors.TYPE_UNKNOWN;
//         }
//     }
// 
//     public String getInternalName(final String name) {
//         return name.replace('.', '/');
//     }
// 
// }


import dagger.assisted.Assisted;
import dagger.assisted.AssistedFactory;
import dagger.assisted.AssistedInject;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.eventimplgen.signature.Descriptors;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.processing.Messager;
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.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;
/*
 * This file is part of Event Implementation Generator, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.eventimplgen.eventgencore;




/**
 *
 * Finds properties by enumerating accessors and then later finding the
 * closest matching mutator.
 */
public class AccessorFirstStrategy implements PropertySearchStrategy {

    private static final Pattern ACCESSOR = Pattern.compile("^get([A-Z].*)");
    private static final Pattern ACCESSOR_BOOL = Pattern.compile("^is([A-Z].*)");
    private static final Pattern ACCESSOR_HAS = Pattern.compile("^has([A-Z].*)");
    private static final Pattern ACCESSOR_KEEPS = Pattern.compile("^(keeps[A-Z].*)");
    private static final Pattern MUTATOR = Pattern.compile("^set([A-Z].*)");

// Path: src/main/java/org/spongepowered/eventimplgen/signature/Descriptors.java
// public class Descriptors {
//     public static final String TYPE_UNKNOWN = "eventImplGen/UNKNOWN";
//     public static final String TYPE_ERROR = "eventImplGen/ERROR";
// 
//     private final Elements elements;
//     private final Types types;
//     private final TypeToDescriptorWriter descWriter;
// 
//     @Inject
//     Descriptors(final Elements elements, final Types types, final TypeToDescriptorWriter descWriter) {
//         this.elements = elements;
//         this.types = types;
//         this.descWriter = descWriter;
//     }
// 
//     public String getDescriptor(final ExecutableElement method) {
//         return this.getDescriptor((ExecutableType) method.asType(), true);
//     }
// 
//     public String getDescriptor(final ExecutableType method, final boolean includeReturnType) {
//         if (includeReturnType) {
//             return method.accept(this.descWriter, new StringBuilder()).toString();
//         } else {
//             final StringBuilder builder = new StringBuilder();
//             builder.append('(');
//             for (final TypeMirror type : method.getParameterTypes()) {
//                 type.accept(this.descWriter, builder);
//             }
//             builder.append(")V");
//             return builder.toString();
//         }
//     }
// 
//     public String getInternalName(TypeMirror name) {
//         name = this.types.erasure(name);
//         switch (name.getKind()) {
//             case DECLARED:
//                 return this.getInternalName(this.elements.getBinaryName((TypeElement) ((DeclaredType) name).asElement()).toString());
//             case ERROR:
//                 return Descriptors.TYPE_ERROR;
//             default:
//                 return Descriptors.TYPE_UNKNOWN;
//         }
//     }
// 
//     public String getInternalName(final String name) {
//         return name.replace('.', '/');
//     }
// 
// }


// Path: src/main/java/org/spongepowered/eventimplgen/eventgencore/AccessorFirstStrategy.java
import dagger.assisted.Assisted;
import dagger.assisted.AssistedFactory;
import dagger.assisted.AssistedInject;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.eventimplgen.signature.Descriptors;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.processing.Messager;
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.Elements;
import javax.lang.model.util.Types;
import javax.tools.Diagnostic;

/*
 * This file is part of Event Implementation Generator, licensed under the MIT License (MIT).
 *
 * Copyright (c) SpongePowered <https://www.spongepowered.org>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.spongepowered.eventimplgen.eventgencore;




/**
 *
 * Finds properties by enumerating accessors and then later finding the
 * closest matching mutator.
 */
public class AccessorFirstStrategy implements PropertySearchStrategy {

    private static final Pattern ACCESSOR = Pattern.compile("^get([A-Z].*)");
    private static final Pattern ACCESSOR_BOOL = Pattern.compile("^is([A-Z].*)");
    private static final Pattern ACCESSOR_HAS = Pattern.compile("^has([A-Z].*)");
    private static final Pattern ACCESSOR_KEEPS = Pattern.compile("^(keeps[A-Z].*)");
    private static final Pattern MUTATOR = Pattern.compile("^set([A-Z].*)");

    private final Descriptors descriptors;