LayerSpec.java 2.44 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.jetbrains.annotations.NotNull
 *  org.jetbrains.annotations.Nullable
 */
package com.scene7.is.ps.provider.defs;

import com.scene7.is.ps.provider.Request;
import java.io.Serializable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class LayerSpec
implements Serializable {
    @NotNull
    private final Object layerId;
    @Nullable
    private final String layerName;
    public static final LayerSpec LAYER_COMP = new LayerSpec("COMP", null);
    public static final LayerSpec LAYER_0 = new LayerSpec(Request.ID_LAYER_0, null);

    public LayerSpec(Object layerId, @Nullable String layerName) {
        assert (layerId instanceof String || layerId instanceof Integer);
        if (layerId instanceof Integer && !$assertionsDisabled && (Integer)layerId < 0) {
            throw new AssertionError();
        }
        if (layerName != null && !$assertionsDisabled && layerName.length() <= 0) {
            throw new AssertionError();
        }
        this.layerId = layerId;
        this.layerName = layerName;
    }

    @NotNull
    public String toString() {
        StringBuilder builder = new StringBuilder();
        if (this.layerId instanceof String) {
            builder.append(((String)this.layerId).toUpperCase());
        } else {
            assert (this.layerId instanceof Integer);
            builder.append(this.layerId);
        }
        if (this.layerName != null) {
            builder.append(',');
            builder.append(this.layerName);
        }
        return builder.toString();
    }

    @NotNull
    public Object getLayerId() {
        return this.layerId;
    }

    @Nullable
    public String getLayerName() {
        return this.layerName;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || this.getClass() != obj.getClass()) {
            return false;
        }
        LayerSpec that = (LayerSpec)obj;
        if (!this.layerId.equals(that.layerId)) {
            return false;
        }
        if (this.layerName == null) {
            return that.layerName == null;
        }
        return this.layerName.equals(that.layerName);
    }

    public int hashCode() {
        int result = this.layerId.hashCode();
        result = 31 * result + (this.layerName != null ? this.layerName.hashCode() : 0);
        return result;
    }
}