From 9ec408a4c907d61ed0dd2b26987db72c96a029f9 Mon Sep 17 00:00:00 2001 From: liach <7806504+liach@users.noreply.github.com> Date: Tue, 2 Feb 2021 11:52:00 -0600 Subject: [PATCH] Document one interesting method (#2002) * Document one interesting method Signed-off-by: liach * get -> find And this appears to be the only change needed Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com> Co-authored-by: liach Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com> --- mappings/net/minecraft/class_5459.mapping | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mappings/net/minecraft/class_5459.mapping b/mappings/net/minecraft/class_5459.mapping index 97cd2357e6..2e0048db06 100644 --- a/mappings/net/minecraft/class_5459.mapping +++ b/mappings/net/minecraft/class_5459.mapping @@ -1,4 +1,24 @@ CLASS net/minecraft/class_5459 + METHOD method_30576 findLargestRectangle ([I)Lcom/mojang/datafixers/util/Pair; + COMMENT Finds the largest rectangle within a histogram, where the vertical bars each have + COMMENT width 1 and height specified in {@code heights}. + COMMENT + COMMENT @implNote This implementation is a {@linkplain IntArrayList stack} problem. The + COMMENT stack maintains a collection of height limits of rectangles that may grow as the + COMMENT array iteration continues. When a new height is encountered, each position {@code p} + COMMENT in the stack would be popped if the rectangle with height limit at position {@code + COMMENT p} can no longer extend right. The popped rectangle becomes the return value if it + COMMENT has a larger area than the current candidate. + COMMENT + COMMENT

When the rectangle area is calculated, the range is between {@code p0 + 1}, where + COMMENT {@code p0} is the current top of stack after popping rectangles that can no longer + COMMENT extend, and the current iterated position {@code i}. + COMMENT + COMMENT @return the base of the rectangle as an inclusive range and the height of the + COMMENT rectangle packed in a pair + COMMENT @see https://leetcode.com/problems/largest-rectangle-in-histogram + ARG 0 heights + COMMENT the heights of bars in the histogram CLASS class_5461 IntBounds FIELD field_25939 min I FIELD field_25940 max I