package net.minecraft.network.chat;

import java.util.Objects;
import java.util.Collection;
import com.google.common.collect.Lists;
import java.util.List;

public abstract class BaseComponent implements MutableComponent {
    protected final List<Component> siblings;
    private Style style;
    
    public BaseComponent() {
        this.siblings = Lists.newArrayList();
        this.style = Style.EMPTY;
    }
    
    @Override
    public MutableComponent append(final Component mr) {
        this.siblings.add(mr);
        return this;
    }
    
    @Override
    public String getContents() {
        return "";
    }
    
    @Override
    public List<Component> getSiblings() {
        return this.siblings;
    }
    
    @Override
    public MutableComponent setStyle(final Style nb) {
        this.style = nb;
        return this;
    }
    
    @Override
    public Style getStyle() {
        return this.style;
    }
    
    @Override
    public abstract BaseComponent plainCopy();
    
    @Override
    public final MutableComponent copy() {
        final BaseComponent mn2 = this.plainCopy();
        mn2.siblings.addAll(this.siblings);
        mn2.setStyle(this.style);
        return mn2;
    }
    
    @Override
    public boolean equals(final Object object) {
        if (this == object) {
            return true;
        }
        if (object instanceof BaseComponent) {
            final BaseComponent mn3 = (BaseComponent)object;
            return this.siblings.equals(mn3.siblings) && Objects.equals(this.getStyle(), mn3.getStyle());
        }
        return false;
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(this.getStyle(), this.siblings);
    }
    
    @Override
    public String toString() {
        return "BaseComponent{style=" + this.style + ", siblings=" + this.siblings + '}';
    }
}
