/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package lc.mecha.lang;

/**
 * This class references another object by name. It is used by the
 * <code>Instancer</code>.
 *
 * @author Alex Leigh
 */
final class Pointer {
    private final String name;


    public Pointer(final String name) {
        this.name = name;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        final Pointer pointer = (Pointer) o;

        return !(name != null ? !name.equals(pointer.name) : pointer.name != null);
    }

    public String getName() {
        return name;
    }

    @Override
    public int hashCode() {
        return name != null ? name.hashCode() : 0;
    }

    @Override
    public String toString() {
        return "Pointer{" +
                "name='" + name + '\'' +
                '}';
    }
}
