All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javarepl.completion.ResolvedPackage Maven / Gradle / Ivy

package javarepl.completion;

import com.googlecode.totallylazy.Sequence;
import com.googlecode.totallylazy.functions.Function0;

import java.io.File;

import static javarepl.completion.TypeResolver.functions.classResolver;

public class ResolvedPackage {
    private final String packageName;
    private final File file;
    private final Function0> classResolver;

    public ResolvedPackage(File file, String packageName) {
        this.packageName = packageName;
        this.file = file;
        this.classResolver = classResolver(this);
    }

    public String packageName() {
        return packageName;
    }

    public File file() {
        return file;
    }

    public Sequence classes() {
        return classResolver.apply();
    }

    @Override
    public String toString() {
        return packageName + " in " + file;
    }

    @Override
    public int hashCode() {
        return toString().hashCode();
    }

    @Override
    public boolean equals(Object other) {
        return other instanceof CompletionResult &&
                other.getClass().equals(getClass()) &&
                other.toString().equals(toString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy