// 
// Decompiled by Procyon v0.6.0
// 

package com.google.common.flogger.parameter;

import com.google.common.flogger.backend.FormatOptions;

public abstract class Parameter
{
    private final int index;
    private final FormatOptions options;
    
    protected Parameter(final FormatOptions options, final int index) {
        if (options == null) {
            throw new IllegalArgumentException("format options cannot be null");
        }
        if (index < 0) {
            throw new IllegalArgumentException("invalid index: " + index);
        }
        this.index = index;
        this.options = options;
    }
    
    public final int getIndex() {
        return this.index;
    }
    
    protected final FormatOptions getFormatOptions() {
        return this.options;
    }
    
    public final void accept(final ParameterVisitor visitor, final Object[] args) {
        if (this.getIndex() < args.length) {
            final Object value = args[this.getIndex()];
            if (value != null) {
                this.accept(visitor, value);
            }
            else {
                visitor.visitNull();
            }
        }
        else {
            visitor.visitMissing();
        }
    }
    
    protected abstract void accept(final ParameterVisitor p0, final Object p1);
    
    public abstract String getFormat();
}
