package com.forerunnergames.tools;

public abstract class AbstractAsset implements Asset, Comparable <Asset>
{
  private final String name;
  private final Id id;

  public AbstractAsset (final Id id)
  {
    this ("", id);
  }

  public AbstractAsset (final String name, final Id id)
  {
    Arguments.checkIsNotNull (name, "name");
    Arguments.checkIsNotNull (id, "id");

    this.name = name;
    this.id = id;
  }

  @Override
  public String getName()
  {
    return name;
  }

  @Override
  public Id getId()
  {
    return id;
  }

  @Override
  public boolean has (final String name)
  {
    Arguments.checkIsNotNull (name, "name");

    return getName().equals (name);
  }

  @Override
  public boolean has (final Id id)
  {
    Arguments.checkIsNotNull (id, "id");

    return id.equals (id);
  }

  @Override
  public boolean is (final Asset asset)
  {
    Arguments.checkIsNotNull (asset, "asset");

    return this.equals (asset);
  }

  @Override
  public boolean isNot (final Asset asset)
  {
    return ! is (asset);
  }

  @Override
  public int compareTo (final Asset asset)
  {
    Arguments.checkIsNotNull (asset, "asset");

    return getId().compareTo (asset.getId());
  }

  @Override
  public boolean equals (final Object o)
  {
    if (this == o) return true;

    if (o == null || getClass() != o.getClass()) return false;

    final AbstractAsset that = (AbstractAsset) o;

    return id.equals (that.id);
  }

  @Override
  public int hashCode()
  {
    return id.hashCode();
  }

  @Override
  public String toString()
  {
    return String.format ("Name: %1$s | Id: %2$s", name, id);
  }

  // Required for network serialization
  protected AbstractAsset()
  {
    name = null;
    id = null;
  }
}
@@ -1280,25 +1280,24 @@
 n true;%0A
-%0A
     if (
 o == nul
@@ -1292,46 +1292,37 @@
 if (
-o == null %7C%7C getClass() != o.getClass(
+! (o instanceof AbstractAsset
 )) r
@@ -1386,30 +1386,29 @@
 et) o;%0A%0A    
-return
+if (!
  id.equals (
@@ -1415,16 +1415,48 @@
 that.id)
+) return false;%0A%0A    return true
 ;%0A  %7D%0A%0A 

Modify equals method of AbstractAsset.