Smalltalk/X WebserverDocumentation of class 'CompactHierarchicalItem': | |
Class: CompactHierarchicalItemInheritance:Object | +--AbstractHierarchicalItem | +--AbstractHierarchicalItemWithModel | +--CompactHierarchicalItem
Description:Compact Hierarchical Items are a new, tuned and optimized version of the original hierarchical item, which suffers various problems: 1) the old item did not store the model, which in many situations leads to very poor performance (it walks along the super-item hierarchy to find the model, which makes many algorithms O(n^2) instead of O(n) Has been refactored in the meantime, so my superclass holds the model now. 2) it keeps individual width/height information, where this could be shared if many items have the same extent. 3) it uses separate width/height instvars, where this information can be stored more compact in single integer (using bit-masks) 4) it uses a separate boolean for the isExpanded, which could be encoded more space efficient as a single bit Problems 2-4 only apply to huge trees with (say 100s of thousands of items). Such big trees are encountered for example in the expecco activity log. This class solves those issues: - it uses a compact width/height representation (bit masks in an integer), for items within a reasonable size (0 to 64k pixels wide, 0 to 16k pixels high). - falls back to a separate width/height holding object, if ever exceeded (which is unlikely) - it encodes the expanded state in a single bit - it uses the saved slot to allow for the model to be kept locally Notice, that in order to be backward compatible, the cached width and height fields can take integer values AND nil. Nil is typically used to mark an invalid cached value. Here, the nil case is encoded in the bitField as all-ones (max value). Before changing the superclass of your existing HierarchicalItem subclass, make sure that the subclass does not access the instvars isExpanded, width and heigh directly. Instead, use the getters isExpanded, width and height and the setters setExpanded:, width: and height: Class protocol:class initialization
Instance protocol:private
Private classes:Geometry |
|
ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 24 Nov 2024 17:10:29 GMT |