JsonArray.java 3.86 KB
package com.google.gson;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public final class JsonArray
  extends JsonElement
  implements Iterable<JsonElement>
{
  private final List<JsonElement> a = new ArrayList();
  
  public final void add(JsonElement paramJsonElement)
  {
    Object localObject = paramJsonElement;
    if (paramJsonElement == null) {
      localObject = JsonNull.INSTANCE;
    }
    this.a.add(localObject);
  }
  
  public final void addAll(JsonArray paramJsonArray)
  {
    this.a.addAll(paramJsonArray.a);
  }
  
  public final boolean contains(JsonElement paramJsonElement)
  {
    return this.a.contains(paramJsonElement);
  }
  
  public final boolean equals(Object paramObject)
  {
    return (paramObject == this) || (((paramObject instanceof JsonArray)) && (((JsonArray)paramObject).a.equals(this.a)));
  }
  
  public final JsonElement get(int paramInt)
  {
    return (JsonElement)this.a.get(paramInt);
  }
  
  public final BigDecimal getAsBigDecimal()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsBigDecimal();
    }
    throw new IllegalStateException();
  }
  
  public final BigInteger getAsBigInteger()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsBigInteger();
    }
    throw new IllegalStateException();
  }
  
  public final boolean getAsBoolean()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsBoolean();
    }
    throw new IllegalStateException();
  }
  
  public final byte getAsByte()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsByte();
    }
    throw new IllegalStateException();
  }
  
  public final char getAsCharacter()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsCharacter();
    }
    throw new IllegalStateException();
  }
  
  public final double getAsDouble()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsDouble();
    }
    throw new IllegalStateException();
  }
  
  public final float getAsFloat()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsFloat();
    }
    throw new IllegalStateException();
  }
  
  public final int getAsInt()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsInt();
    }
    throw new IllegalStateException();
  }
  
  public final long getAsLong()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsLong();
    }
    throw new IllegalStateException();
  }
  
  public final Number getAsNumber()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsNumber();
    }
    throw new IllegalStateException();
  }
  
  public final short getAsShort()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsShort();
    }
    throw new IllegalStateException();
  }
  
  public final String getAsString()
  {
    if (this.a.size() == 1) {
      return ((JsonElement)this.a.get(0)).getAsString();
    }
    throw new IllegalStateException();
  }
  
  public final int hashCode()
  {
    return this.a.hashCode();
  }
  
  public final Iterator<JsonElement> iterator()
  {
    return this.a.iterator();
  }
  
  public final JsonElement remove(int paramInt)
  {
    return (JsonElement)this.a.remove(paramInt);
  }
  
  public final boolean remove(JsonElement paramJsonElement)
  {
    return this.a.remove(paramJsonElement);
  }
  
  public final JsonElement set(int paramInt, JsonElement paramJsonElement)
  {
    return (JsonElement)this.a.set(paramInt, paramJsonElement);
  }
  
  public final int size()
  {
    return this.a.size();
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/google/gson/JsonArray.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */