This configures a stack or flow not the objects inside
761372
def _configure s
      s[:row] ||= 0
      s[:col] ||= 0
      s[:row] += (s[:margin_top] || 0)
      s[:col] += (s[:margin_left] || 0)
      s[:width] = FFI::NCurses.COLS-s[:col] if s[:width] == :expand
      s[:height] = FFI::NCurses.LINES-s[:row] if s[:height] == :expand # 2011-11-30 
      last = @_ws_active.last
      if last
        if s[:width_pc]
          if last.is_a? WsStack
            s[:width] =           (last[:width] * (s[:width_pc].to_i * 0.01)).floor
          else
            # i think this width is picked up by next stack in this flow
            last[:item_width] =   (last[:width] * (s[:width_pc].to_i* 0.01)).floor
          end
        end
        if s[:height_pc]
          if last.is_a? WsFlow
            s[:height] =       ( (last[:height] * s[:height_pc].to_i)/100).floor
          else
            # this works only for flows within stacks not for an object unless
            # you put a single object in a flow
            s[:item_height] =  ( (last[:height] * s[:height_pc].to_i)/100).floor
          end
            #alert "item height set as #{s[:height]} for #{s} "
        end
        if last.is_a? WsStack
          s[:row] += (last[:row] || 0)
          s[:col] += (last[:col] || 0)  
        else
          s[:row] += (last[:row] || 0)
          s[:col] += (last[:col] || 0)  # we are updating with item_width as each st finishes
          s[:width] ||= last[:item_width] # 
        end
      else
        # this should be outer most flow or stack, if nothing mentioned
        # trying this out
        s[:width] ||= :expand
        s[:height] ||= :expand
        s[:width] = FFI::NCurses.COLS-s[:col] if s[:width] == :expand
        s[:height] = FFI::NCurses.LINES-s[:row] if s[:height] == :expand # 2011-11-30 
      end
      s[:components] = []
    end
514698
def set_flow(self, flow):
        """"""
        if not hasattr(self, "_flow"):
            self._flow = flow
        else:
            if self._flow != flow:
                raise ValueError("self._flow != flow")
574806
function canonicalize(obj, stack) {
   stack = stack || [];

   if (utils.indexOf(stack, obj) !== -1) return obj;

   var canonicalizedObj;

   if ('[object Array]' == {}.toString.call(obj)) {
     stack.push(obj);
     canonicalizedObj = utils.map(obj, function(item) {
       return canonicalize(item, stack);
     });
     stack.pop();
   } else if (typeof obj === 'object' && obj !== null) {
     stack.push(obj);
     canonicalizedObj = {};
     utils.forEach(utils.keys(obj).sort(), function(key) {
       canonicalizedObj[key] = canonicalize(obj[key], stack);
     });
     stack.pop();
   } else {
     canonicalizedObj = obj;
   }

   return canonicalizedObj;
 }
423522
function pop(stack, metaStack) {
  var obj = stack.pop();

  if (metaStack.length) {
    var lastMetaElement = metaStack[metaStack.length - 1];
    if (obj === lastMetaElement.element) {
      // popping a meta-element, e.g. an object whose value is another object
      metaStack.pop();
      lastMetaElement = metaStack[metaStack.length - 1];
    }
    var element = lastMetaElement.element;
    var lastElementIndex = lastMetaElement.index;
    if (Array.isArray(element)) {
      element.push(obj);
    } else if (lastElementIndex === stack.length - 2) { // obj with key+value
      var key = stack.pop();
      element[key] = obj;
    } else {
      stack.push(obj); // obj with key only
    }
  }
}
749819
private void organizeContent()
    {
        cells = new Vector<TableCellBox>();
        TableCellBox anoncell = null;
        
        int size = nested.size();
        List<Box> toremove = new ArrayList<Box>();
        for (int i = 0; i < size; i++)
        {
            Box box = nested.get(i);
            
            if (box instanceof TableCellBox)
            {
                addCell((TableCellBox) box);
                //finish and add possible previous anonymous cell
                if (anoncell != null)
                {
                    anoncell.endChild = anoncell.nested.size();
                    addSubBox(anoncell);
                }
                anoncell = null;
            }
            else
            {
                if (anoncell == null)
                {
                    Element anonelem = viewport.getFactory().createAnonymousElement(getParent().getParent().getParent().getElement().getOwnerDocument(), "td", "table-cell");
                    anoncell = new TableCellBox(anonelem, g, ctx);
                    anoncell.adoptParent(this);
                    anoncell.setStyle(viewport.getFactory().createAnonymousStyle("table-cell"));
                    addCell(anoncell);
                }
                anoncell.addSubBox(box);
                anoncell.isempty = false;
                if (box.isBlock()) anoncell.contblock = true;
                box.setContainingBlockBox(anoncell);
                box.setParent(anoncell);
                toremove.add(box);
                endChild--;
            }
        }
        nested.removeAll(toremove);
        
        if (anoncell != null)
        {
            anoncell.endChild = anoncell.nested.size();
            addSubBox(anoncell);
        }
    }
453160
def configure_scope(self, callback=None):  # noqa
        """"""

        client, scope = self._stack[-1]
        if callback is not None:
            if client is not None:
                callback(scope)

            return None

        @contextmanager
        def inner():
            if client is not None:
                yield scope
            else:
                yield Scope()

        return inner()
1014135
private void condenseTree(IndexTreePath<E> subtree, Stack<N> stack) {
    N node = getNode(subtree.getEntry());
    // node is not root
    if(!isRoot(node)) {
      N parent = getNode(subtree.getParentPath().getEntry());
      int index = subtree.getIndex();
      if(hasUnderflow(node)) {
        if(parent.deleteEntry(index)) {
          stack.push(node);
        }
        else {
          node.adjustEntry(parent.getEntry(index));
        }
      }
      else {
        node.adjustEntry(parent.getEntry(index));
      }
      writeNode(parent);
      // get subtree to parent
      condenseTree(subtree.getParentPath(), stack);
    }

    // node is root
    else {
      if(hasUnderflow(node) && node.getNumEntries() == 1 && !node.isLeaf()) {
        N child = getNode(node.getEntry(0));
        final N newRoot;
        if(child.isLeaf()) {
          newRoot = createNewLeafNode();
          newRoot.setPageID(getRootID());
          for(int i = 0; i < child.getNumEntries(); i++) {
            newRoot.addLeafEntry(child.getEntry(i));
          }
        }
        else {
          newRoot = createNewDirectoryNode();
          newRoot.setPageID(getRootID());
          for(int i = 0; i < child.getNumEntries(); i++) {
            newRoot.addDirectoryEntry(child.getEntry(i));
          }
        }
        writeNode(newRoot);
        height--;
      }
    }
  }
1036164
def stack_push(self, value: Union[int, bytes]) -> None:
        
        return self._stack.push(value)
62110
function destroy(stack) {
  if (stack.length > 0) {
    for (const chunk of stack) {
      if (isTemplateResult(chunk)) {
        chunk.destroy(true);
      }
    }
  }
  stack.length = 0;
}
645926
function settings(blocks, opt) {
	var self = {
		blocks : blocks || new type.Factory(function(s) {
			self.blocks = new type.Component([]);
			// read until end of stream
			while(s.availableLength() > 0) {
				self.blocks.obj.push(block().read(s));
			}
		}),
	};
	
	return new type.Component(self, opt);
}
1078474
function (passObj) {
            for (var item in passObj) {
                if (Object.prototype.hasOwnProperty.call(passObj, item)) {
                    configure[item] = passObj[item];
                }
            }
        }
998723
function( config, parent ) {
		var typeErrorMsg, contentItem;

		if( typeof config.type !== 'string' ) {
			throw new lm.errors.ConfigurationError( 'Missing parameter \'type\'', config );
		}

		if( !this._typeToItem[ config.type ] ) {
			typeErrorMsg = 'Unknown type \'' + config.type + '\'. ' +
				'Valid types are ' + lm.utils.objectKeys( this._typeToItem ).join( ',' );

			throw new lm.errors.ConfigurationError( typeErrorMsg );
		}


		/**
		 * We add an additional stack around every component that's not within a stack anyways
		 */
		if( config.type === 'component' && !( parent instanceof lm.items.Stack ) && !!parent ) {
			config = {
				type: 'stack',
				isClosable: config.isClosable,
				width: config.width,
				height: config.height,
				content: [ config ]
			};
		}

		contentItem = new this._typeToItem[ config.type ]( this, config, parent );

		return contentItem;
	}
661261
function(self, obj)
{
   self.stack = '';
   for(var key in obj)
   {
      self[key] = obj[key];
   }
}
92732
function pushState(stack, type, instance) {
  stack.type = type;
  stack.children = [];
  stack.instance = instance || stack;
}
867369
def flow config={}, &block
      s = WsFlow.new config
      _configure s
      @_ws_active << s
      yield_or_eval &block if block_given?
      @_ws_active.pop 
      last = @_ws_active.last
      if last 
        case last
        when WsStack
          if s[:height]
            last[:row] += s[:height] 
          else
            #last[:row] += last[:highest_row]  
            last[:row] += 1
          end
        when WsFlow
          last[:col] += last[:item_width] || 0 
        end
      end
    end
1321767
private static Stack<UIContext> getStack() {
		Stack<UIContext> stack = CONTEXT_STACK.get();

		if (stack == null) {
			stack = new Stack<>();
			CONTEXT_STACK.set(stack);
		}

		return stack;
	}
449344
private void init(int ignoreFrames, boolean partial)
    {
        // Extract stack components, after we look for the Frame constructor
 	    // itself and pull that off the stack!
        int check=_stack.length;
        if (check>3) check=3;
        for (int i=0;i<check;i++)
        {
            if (__className.equals(_stack[i].getClassName()) &&
                "<init>".equalsIgnoreCase(_stack[i].getMethodName()))
            {
                _top=i+1;
                break;
            }
        }
        _top+=ignoreFrames;
        _where=_stack[_top].toString();
        if (!partial) complete();
    }