/** * Generates a string representation of this {@code JCameraRotationCoefficientsType}. * If uninitialized, some attribute values may appear as question marks. * @return A string representation */ @Override public String toString() { return "JCameraRotationCoefficientsMutable{" + "horizontal=" + horizontal() + ", vertical=" + vertical() + "}"; } }
/** * Construct a modifiable instance of {@code JCameraRotationCoefficientsType}. * @param horizontal The value for the {@link JCameraRotationCoefficientsType#horizontal() horizontal} attribute * @param vertical The value for the {@link JCameraRotationCoefficientsType#vertical() vertical} attribute * @return A new modifiable instance */ public static JCameraRotationCoefficientsMutable create(double horizontal, double vertical) { return new JCameraRotationCoefficientsMutable() .setHorizontal(horizontal) .setVertical(vertical); }
/** * This instance is equal to all instances of {@code JCameraRotationCoefficientsMutable} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(Object another) { if (this == another) return true; if (!(another instanceof JCameraRotationCoefficientsMutable)) return false; JCameraRotationCoefficientsMutable other = (JCameraRotationCoefficientsMutable) another; return equalTo(other); }
@Override public void mouseMoved( final @Nullable MouseEvent e) { assert e != null; /* * If the camera is enabled, get the rotation coefficients for the mouse * movement. */ if (this.sim.cameraIsEnabled()) { this.rotations.from( this.mouse_region.get().coefficients( (double) e.getX(), (double) e.getY())); this.input.addRotationAroundHorizontal(this.rotations.horizontal()); this.input.addRotationAroundVertical(this.rotations.vertical()); } } }
/** * Fill this modifiable instance with attribute values from the provided {@link JCameraRotationCoefficientsType} instance. * Regular attribute values will be overridden, i.e. replaced with ones of an instance. * Any of the instance's absent optional values will not be copied (will not override current values). * @param instance The instance from which to copy values * @return {@code this} for use in a chained invocation */ public JCameraRotationCoefficientsMutable from(JCameraRotationCoefficientsType instance) { Objects.requireNonNull(instance, "instance"); setHorizontal(instance.horizontal()); setVertical(instance.vertical()); return this; }
JCameraRotationCoefficientsMutable.create(); final AtomicReference<JCameraFPSStyleMouseRegion> mouse_region = new AtomicReference<>(
/** * Construct a modifiable instance of {@code JCameraRotationCoefficientsType}. * @return A new modifiable instance */ public static JCameraRotationCoefficientsMutable create() { return new JCameraRotationCoefficientsMutable(); }
/** * @return The horizontal coefficient */ @Override public final double horizontal() { return horizontalIsSet() ? horizontal : JCameraRotationCoefficientsType.super.horizontal(); }
/** * @return The vertical coefficient */ @Override public final double vertical() { return verticalIsSet() ? vertical : JCameraRotationCoefficientsType.super.vertical(); }
JCameraRotationCoefficientsMutable.create();
private boolean equalTo(JCameraRotationCoefficientsMutable another) { double horizontal = horizontal(); double vertical = vertical(); return Double.doubleToLongBits(horizontal) == Double.doubleToLongBits(another.horizontal()) && Double.doubleToLongBits(vertical) == Double.doubleToLongBits(another.vertical()); }
/** * Computes a hash code from attributes: {@code horizontal}, {@code vertical}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; double horizontal = horizontal(); h += (h << 5) + java.lang.Double.hashCode(horizontal); double vertical = vertical(); h += (h << 5) + java.lang.Double.hashCode(vertical); return h; }