@Override public boolean equals(final Object o) { return this == o || o instanceof BaseEntity && this.id.equals(((BaseEntity) o).id); }
@Override public int hashCode() { int result = entity.hashCode(); result = 31 * result + hitPoint; return result; } }
/** * Retrieve an Id from a value. * * @param value Id value to get, positive and negative values are allowed, -1 is WORLD. * @return The Id with the internal value correspond to the parameter. */ public static EntityId valueOf(final long value) { if (!EntityId.LIST.containsKey(value)) { EntityId.LIST.put(value, new EntityId(value)); } return EntityId.LIST.get(value); }
@Override public Optional<EntityId> getEntity(final float x, final float y) { final float screenX = x / this.resolutionX; final float screenY = y / this.resolutionY; EntityId id = EntityId.valueOf(this.jni.throwRay(this.pointer.getPointerAddress(), screenX, screenY, false)); if (id.equals(EntityId.WORLD)) { return Optional.empty(); } return Optional.of(id); }
public PhysicObjectBuilder withId(final long id) { return this.withId(EntityId.valueOf(id)); }
/** * Full constructor. * * @param contactX Contact X coordinate value. * @param contactY Contact Y coordinate value. * @param contactZ Contact Z coordinate value. * @param idValue Id of the object found by the ray. */ //@Ensures this.id.equals(EntityId.get(idValue)) == true //@Ensures this.contact.equals(Point3D.xyz(contactX, contactY, contactZ)) //@Ensures this.id != null //@Ensures this.contact != null public RaycastResult(final float contactX, final float contactY, final float contactZ, final long idValue) { this(Point3D.valueOf(contactX, contactY, contactZ), EntityId.valueOf(idValue)); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } EntityHitDto that = (EntityHitDto) o; if (hitPoint != that.hitPoint) { return false; } return entity.equals(that.entity); }
@Override public final int hashCode() { return this.id.hashCode(); }
@Override public EntityId from(String s) throws MappingException { ImplementationException.throwForNull(s); try { return EntityId.valueOf(Long.parseLong(s)); } catch (final NumberFormatException nfe) { throw new MappingException("Error retrieving id", nfe); } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } WaitingEntity that = (WaitingEntity) o; return entity.equals(that.entity) && representation.equals(that.representation) && builderId.equals(that.builderId); }
@Override public int hashCode() { int result = entity.hashCode(); result = 31 * result + newOwnerId.hashCode(); return result; } }
/** * Create a new BaseCity. * * @param id The entity representing this city in the world. * @param initialResource The resources available in the city when creating it. * @param positionOffset Building positions. * @param datas List of building types and their data available. */ protected BaseCity(final CityId id, final PlayerId owner, final Point3D position, final ResourceValue initialResource, final Point3D[] positionOffset, Map<BuildingType, D> datas) { super(); this.id = id; this.position = position; this.owner = owner; this.datas = datas; this.buildings = new ArrayList<>(); this.positionOffset = Arrays.copyOf(positionOffset, positionOffset.length); for (int i = 0; i < this.positionOffset.length; i++) { this.positionOffset[i] = this.positionOffset[i].add(position); } this.producer = new ResourcesProducer(EntityId.valueOf(id.value), System.currentTimeMillis(), initialResource); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ActionDto actionDto = (ActionDto) o; return id.equals(actionDto.id) && entity.equals(actionDto.entity); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + this.contact.hashCode(); result = prime * result + this.id.hashCode(); return result; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ResourceValueDto that = (ResourceValueDto) o; return time == that.time && cityId.equals(that.cityId) && resources.equals(that.resources); }
@Override public int hashCode() { int result = cityId.hashCode(); result = 31 * result + resources.hashCode(); result = 31 * result + (int) (time ^ (time >>> 32)); return result; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ChangeOwnerDto that = (ChangeOwnerDto) o; if (!entity.equals(that.entity)) { return false; } return newOwnerId.equals(that.newOwnerId); }
@Override public int hashCode() { int result = id.hashCode(); result = 31 * result + entity.hashCode(); return result; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } StaffAllocationDto that = (StaffAllocationDto) o; return cityId.equals(that.cityId) && position.equals(that.position) && staff.equals(that.staff); }
@Override public int hashCode() { int result = entity.hashCode(); result = 31 * result + representation.hashCode(); result = 31 * result + builderId.hashCode(); return result; } }