/** * Obtains a {@link HeapSize} with the specified initial amount * (and a default maximum size) * * @param amount the initial {@link HeapSize} * @param units the units of the initial {@link HeapSize} * * @return the {@link HeapSize} */ public static HeapSize initial(int amount, Units units) { HeapSize heapSize = new HeapSize(); heapSize.initial = amount; heapSize.initialUnits = units; return heapSize; }
/** * Obtains a {@link HeapSize} with the specified maximum amount * (and a default initial size). * * @param amount the maximum {@link HeapSize} * @param units the units of the maximum {@link HeapSize} * * @return the {@link HeapSize} */ public static HeapSize maximum(int amount, Units units) { HeapSize heapSize = new HeapSize(); heapSize.maximum = amount; heapSize.maximumUnits = units; return heapSize; }
/** * Obtains a {@link HeapSize} with the specified initial amount * (and a default maximum size) * * @param amount the initial {@link HeapSize} * @param units the units of the initial {@link HeapSize} * * @return the {@link HeapSize} */ public static HeapSize initial(int amount, Units units) { HeapSize heapSize = new HeapSize(); heapSize.initial = amount; heapSize.initialUnits = units; return heapSize; }
/** * Obtains a {@link HeapSize} with the specified maximum amount * (and a default initial size). * * @param amount the maximum {@link HeapSize} * @param units the units of the maximum {@link HeapSize} * * @return the {@link HeapSize} */ public static HeapSize maximum(int amount, Units units) { HeapSize heapSize = new HeapSize(); heapSize.maximum = amount; heapSize.maximumUnits = units; return heapSize; }
/** * Obtains a {@link HeapSize} with the values. * * @param initial the initial {@link HeapSize} * @param initialUnits the units of the initial {@link HeapSize} * @param maximum the maximum {@link HeapSize} * @param maximumUnits the units of the maximum {@link HeapSize} * * @return the {@link HeapSize} */ public static HeapSize of(int initial, Units initialUnits, int maximum, Units maximumUnits) { HeapSize heapSize = new HeapSize(); heapSize.initial = initial; heapSize.initialUnits = initialUnits; heapSize.maximum = maximum; heapSize.maximumUnits = maximumUnits; return heapSize; }
/** * Obtains a {@link HeapSize} with the values. * * @param initial the initial {@link HeapSize} * @param initialUnits the units of the initial {@link HeapSize} * @param maximum the maximum {@link HeapSize} * @param maximumUnits the units of the maximum {@link HeapSize} * * @return the {@link HeapSize} */ public static HeapSize of(int initial, Units initialUnits, int maximum, Units maximumUnits) { HeapSize heapSize = new HeapSize(); heapSize.initial = initial; heapSize.initialUnits = initialUnits; heapSize.maximum = maximum; heapSize.maximumUnits = maximumUnits; return heapSize; }
/** * Obtains a {@link HeapSize} for the defaults. * * @return the default {@link HeapSize} */ @OptionsByType.Default public static HeapSize useDefaults() { return new HeapSize(); }
/** * Obtains a {@link HeapSize} for the defaults. * * @return the default {@link HeapSize} */ @OptionsByType.Default public static HeapSize useDefaults() { return new HeapSize(); }
@Override public HeapSize compose(HeapSize other) { HeapSize result = new HeapSize(); long initial = this.initial <= 0 ? 0 : this.getInitialSizeAs(Units.KB); long otherInitial = other.initial <= 0 ? 0 : other.getInitialSizeAs(Units.KB); if (initial > otherInitial) { result.initial = this.initial; result.initialUnits = this.initialUnits; } else { result.initial = other.initial; result.initialUnits = other.initialUnits; } long maximum = this.maximum <= 0 ? 0 : this.getMaximumSizeAs(Units.KB); long otherMaximum = other.maximum <= 0 ? 0 : other.getMaximumSizeAs(Units.KB); if (maximum > otherMaximum) { result.maximum = this.maximum; result.maximumUnits = this.maximumUnits; } else { result.maximum = other.maximum; result.maximumUnits = other.maximumUnits; } return result; }
@Override public HeapSize compose(HeapSize other) { HeapSize result = new HeapSize(); long initial = this.initial <= 0 ? 0 : this.getInitialSizeAs(Units.KB); long otherInitial = other.initial <= 0 ? 0 : other.getInitialSizeAs(Units.KB); if (initial > otherInitial) { result.initial = this.initial; result.initialUnits = this.initialUnits; } else { result.initial = other.initial; result.initialUnits = other.initialUnits; } long maximum = this.maximum <= 0 ? 0 : this.getMaximumSizeAs(Units.KB); long otherMaximum = other.maximum <= 0 ? 0 : other.getMaximumSizeAs(Units.KB); if (maximum > otherMaximum) { result.maximum = this.maximum; result.maximumUnits = this.maximumUnits; } else { result.maximum = other.maximum; result.maximumUnits = other.maximumUnits; } return result; }