public Attribute replace(Attribute first, Attribute second) { AttributeRole role = getRole(first); if (role != null) { role.setAttribute(second); } else { throw new java.util.NoSuchElementException( "Attribute " + first + " cannot be replaced by attribute " + second + ": " + first + " is not part of the example set!"); } return second; }