blockly > BasicCursor > getPreviousNode_
متد BasicCursor.getPreviousNode_().
پیمایش پیش سفارش را معکوس می کند تا گره قبلی را پیدا کند. این به کاربر این امکان را می دهد که به راحتی کل Blockly AST را بدون نیاز به ورود و خروج سطوح روی درخت حرکت کند.
امضا:
protected getPreviousNode_(node: ASTNode | null, isValid: (p1: ASTNode | null) => boolean): ASTNode | null;
پارامترها
پارامتر | تایپ کنید | توضیحات |
---|
گره | ASTNode | تهی | موقعیت فعلی در AST. |
معتبر است | (p1: ASTNode | null) => بولی | یک تابع true/false بسته به اینکه گره داده شده باید عبور کند یا خیر. |
برمیگرداند:
ASTNode | تهی
گره قبلی در پیمایش یا تهی اگر گره قبلی وجود نداشته باشد.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-01-04 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-01-04 بهوقت ساعت هماهنگ جهانی."],[[["`getPreviousNode_()` enables reverse pre-order traversal of the Blockly AST for efficient navigation."],["It utilizes a provided validation function (`isValid`) to determine traversable nodes."],["The method returns the previous node encountered or null if none exists."],["This functionality simplifies navigation by allowing users to move seamlessly through the AST without complex level management."]]],["The `getPreviousNode_` method of the `BasicCursor` class reverses a pre-order traversal to locate the preceding node within a Blockly AST (Abstract Syntax Tree). It accepts the current AST node and a validity function. It then returns the immediately previous node in the traversal or `null` if none exists. This enables simplified navigation through the AST without needing to move up and down tree levels.\n"]]