those methods are copy-pasted from CheckoutController
 we cannot inherit from that class unless we want to skip_before_filter
 half of calls in SpreeBase module
337647
def state_callback(before_or_after = :before)
      method_name = :"#{before_or_after}_#{@order.state}"
      send(method_name) if respond_to?(method_name, true)
    end
27345
private static void getTreeFormat(StringBuffer sb, Event event, Boolean includeContextInfo,
			int noOfTabs, long currentNanoTime, int spacesRequiredForDuration) {
		//Defect 166820
		//Check for events that got added after we started dumping the tree.
		//We ignore these events.
		if(currentNanoTime < event.getStartTime()){
			return;
		}
		
		String executionTimeStr = getExecutionTimeStringFormat(currentNanoTime,
				event); // Convert the execution time into string with 3 decimal
						// places..
		try {
			/**
			 * If its root event add header to table and set the
			 * spacesRequiredForDuration field
			 */
			if (event.getParentEvent() == null) {
				if (spacesRequiredForDuration == 0)
					spacesRequiredForDuration = executionTimeStr.length() + 5;
				sb.append(appendHeader(event, executionTimeStr));
			}
			// Append the execution time
			if (event.getEndTime() == 0) {
				sb.append(String.format(
						"%n%" + spacesRequiredForDuration + "s",
						executionTimeStr + "ms + "));
			} else {
				sb.append(String.format(
						"%n%" + spacesRequiredForDuration + "s",
						executionTimeStr + "ms   "));
			}

			// Append tabs for Child Events
			if (event.getParentEvent() != null) {
				for (int i = 0; i < noOfTabs; i++) {
					sb.append("    ");
				}
			}

			// Append Type + Context information to string...
			if (includeContextInfo && event.getContextInfo() != null) {
				sb.append(event.getType()
						+ RequestProbeConstants.EVENT_CONTEXT_INFO_SEPARATOR
						+ event.getContextInfo());
			} else {
				sb.append(event.getType());
			}

			//Iterating using indices instead of the list iterator to avoid ConcurrentModificationException
			//It is safe to do it this way as we only add elements to the list
			List<Event> list = event.getChildEvents();
			for(int i = 0; i < list.size(); i++){
				//Defect 165134
				//for (Event eventChild : event.getChildEvents()) {
				// Call recursively for child events ..
				getTreeFormat(sb, list.get(i), includeContextInfo, noOfTabs + 1, currentNanoTime,
						spacesRequiredForDuration);
			}
		} catch (Exception e) {

			FFDCFilter.processException(e, EventStackFormatter.class.getName(),
					"94", event);
		}
	}
210429
def hide_methods(mod, except_defaults, *stuff)
      options = stuff.last.is_a?(Hash) ? stuff.pop : {}
      include_ancestors  = options.fetch(:ancestors){false}
      except             = Array(options.fetch(:except){except_defaults})
      protect            = Array(options[:protect])
      except_methods     = collect_methods(true, *except)
      protect_methods    = collect_methods(true, *protect)
      methods_to_hide    = collect_methods(include_ancestors, *stuff)
      (methods_to_hide - except_methods).each do |method_name|
        mod.module_eval do 
          next unless method_defined?(method_name)
          if protect_methods.include?(method_name)
            protected method_name
          else
            private method_name
          end
        end
      end
    end
969753
def inheritanceTree(self):
        
        inherits = self.inherits()
        while inherits:
            ischema = orb.system.schema(inherits)
            if not ischema:
                raise orb.errors.ModelNotFound(schema=inherits)

            yield ischema
            inherits = ischema.inherits()
153647
def method_missing method, *args, &block
      method, *args = special_handler(method, *args, &block) \
        if self.private_methods.include?(:special_handler)
      [method, args].flatten
    end
219761
def method_missing(mthd, *args, &block)
      new_recs = args.reduce([]) {|a, i| a.push(formatted_name(i)) if i.class.ancestors.include?(ActiveRecord::Base); a}
      result = @set.send(mthd,
        *(args.map do |arg|
            arg.class.ancestors.include?(ActiveRecord::Base) ? formatted_name(arg) : arg
          end
        ),
        &block
      )
      @set.to_a.select {|i| new_recs.include? i }.each {|f| @flagged << f}
      result
    end
1373166
def method_missing(meth, *args)
      if include?(meth.to_s) then
        if args.empty? then
          create_getter meth
        else
          raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
        end
      elsif meth.to_s =~ /^(.+)\?$/ and include?(root_meth = $1) then
        if args.empty? then
          !!create_getter(root_meth) #TODO duplication of logic
        else
          raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
        end
      else
        super
      end
    end
1049660
def method_missing(name, *args)
      copy = self.dup
      copy.instance_eval { @args << [name, *(args.collect { |a| a.to_s })] }
      copy
    end
1143209
def method_missing(name, *args, &block)
      if @type.has_attribute?(name.to_s)
        __attribute__(name, *args)
      else
        __tag__(name, *args, &block)
      end
    end
100384
def skip_tree_node(self, tree_node, tx_context=None):
        
        if not tx_context:
            # create transaction context if one was not provided
            # format: {process_name: {timeperiod: AbstractTreeNode} }
            tx_context = collections.defaultdict(dict)

        if tree_node.timeperiod in tx_context[tree_node.process_name]:
            # the node has already been marked for skipping
            return tx_context

        if tree_node.job_record.is_finished:
            # the node is finished and does not require skipping
            pass
        else:
            state_machine_name = context.process_context[tree_node.process_name].state_machine_name
            state_machine = self.state_machines[state_machine_name]
            state_machine.skip_job(tree_node.job_record)

        tx_context[tree_node.process_name][tree_node.timeperiod] = tree_node
        for timeperiod, node in tree_node.children.items():
            self.skip_tree_node(node, tx_context)

        dependant_nodes = self._find_dependant_tree_nodes(tree_node)
        for node in dependant_nodes:
            self.skip_tree_node(node, tx_context)

        return tx_context
1073818
private void traverseAndRemoveUnusedReferences(Node root) {
    // Create scope from parent of root node, which also has externs as a child, so we'll
    // have extern definitions in scope.
    Scope scope = scopeCreator.createScope(root.getParent(), null);
    if (!scope.hasSlot(NodeUtil.JSC_PROPERTY_NAME_FN)) {
      // TODO(b/70730762): Passes that add references to this should ensure it is declared.
      // NOTE: null input makes this an extern var.
      scope.declare(
          NodeUtil.JSC_PROPERTY_NAME_FN, /* no declaration node */ null, /* no input */ null);
    }
    worklist.add(new Continuation(root, scope));
    while (!worklist.isEmpty()) {
      Continuation continuation = worklist.remove();
      continuation.apply();
    }

    removeUnreferencedVarsAndPolyfills();
    removeIndependentlyRemovableProperties();
    for (Scope fparamScope : allFunctionParamScopes) {
      removeUnreferencedFunctionArgs(fparamScope);
    }
  }
807911
protected void updatePredecessorsWithCheckMode(TreePath tp, boolean check) {
        TreePath parentPath = tp.getParentPath();
        // If it is the root, stop the recursive calls and return
        if (parentPath == null) {
            return;
        }       
        CheckedNode parentCheckedNode = nodesCheckingState.get(parentPath);
        DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) parentPath.getLastPathComponent();     
        parentCheckedNode.allChildrenSelected = true;
        parentCheckedNode.isSelected = false;
        for (int i = 0 ; i < parentNode.getChildCount() ; i++) {                
            TreePath childPath = parentPath.pathByAddingChild(parentNode.getChildAt(i));
            CheckedNode childCheckedNode = nodesCheckingState.get(childPath);           
            // It is enough that even one subtree is not fully selected
            // to determine that the parent is not fully selected
            if (!allSelected(childCheckedNode)) {
                parentCheckedNode.allChildrenSelected = false;      
            }
            // If at least one child is selected, selecting also the parent
            if (childCheckedNode.isSelected) {
                parentCheckedNode.isSelected = true;
            }
        }
        if (parentCheckedNode.isSelected) {
            checkedPaths.add(parentPath);
        } else {
            checkedPaths.remove(parentPath);
        }
        // Go to upper predecessor
        updatePredecessorsWithCheckMode(parentPath, check);
    }
94400
function TreeWalker(root, whatToShow, filter) {
  if (!root || !root.nodeType) {
    utils.NotSupportedError();
  }

  // Read-only properties
  this._root = root;
  this._whatToShow = Number(whatToShow) || 0;
  this._filter = filter || null;
  this._active = false;
  // Read-write property
  this._currentNode = root;
}
905347
def filter(self, cls, recursive=False):
        
        source = self.walk_preorder if recursive else self._children
        return [
            codeobj
            for codeobj in source()
            if isinstance(codeobj, cls)
        ]
1313784
def method_missing(name, *args)
      groupname = (args[0] or raise "Database configuration group not specified for #{name}")
      dbname = (args[1] or raise "Database entry name not specified for #{name}")
      n = name.to_s
      begin
        unseparated_yaml(n => self[groupname, dbname])
      rescue Bcdatabase::Error => e
        if ENV['RAILS_ENV'] == n
          raise e
        else
          # Not using that configuration right now, so return a dummy instead
          # of throwing an exception
          unseparated_yaml(n => { 'error' => e.message })
        end
      end
    end
909243
function cleanTree ( node, preserveWS ) {
    var children = node.childNodes,
        nonInlineParent, i, l, child, nodeName, nodeType, rewriter, childLength,
        startsWithWS, endsWithWS, data, sibling;

    nonInlineParent = node;
    while ( isInline( nonInlineParent ) ) {
      nonInlineParent = nonInlineParent.parentNode;
    }
    walker.root = nonInlineParent;

    for ( i = 0, l = children.length; i < l; i += 1 ) {
      child = children[i];
      nodeName = child.nodeName;
      nodeType = child.nodeType;
      rewriter = stylesRewriters[ nodeName ];
      if ( nodeType === ELEMENT_NODE ) {
        childLength = child.childNodes.length;
        if ( rewriter ) {
          child = rewriter( child, node );
        } else if ( blacklist.test( nodeName ) ) {
          node.removeChild( child );
          i -= 1;
          l -= 1;
          continue;
        } else if ( !allowedBlock.test( nodeName ) && !isInline( child ) ) {
          i -= 1;
          l += childLength - 1;
          node.replaceChild( empty( child ), child );
          continue;
        }
        if ( childLength ) {
          cleanTree( child, preserveWS || ( nodeName === 'PRE' ) );
        }
      } else {
        if ( nodeType === TEXT_NODE ) {
          data = child.data;
          startsWithWS = !notWS.test( data.charAt( 0 ) );
          endsWithWS = !notWS.test( data.charAt( data.length - 1 ) );
          if ( preserveWS || ( !startsWithWS && !endsWithWS ) ) {
            continue;
          }
          // Iterate through the nodes; if we hit some other content
          // before the start of a new block we don't trim
          if ( startsWithWS ) {
            walker.currentNode = child;
            while ( sibling = walker.previousPONode() ) {
              nodeName = sibling.nodeName;
              if ( nodeName === 'IMG' ||
                   ( nodeName === '#text' &&
                     notWS.test( sibling.data ) ) ) {
                break;
              }
              if ( !isInline( sibling ) ) {
                sibling = null;
                break;
              }
            }
            data = data.replace( /^[ \t\r\n]+/g, sibling ? ' ' : '' );
          }
          if ( endsWithWS ) {
            walker.currentNode = child;
            while ( sibling = walker.nextNode() ) {
              if ( nodeName === 'IMG' ||
                   ( nodeName === '#text' &&
                     notWS.test( sibling.data ) ) ) {
                break;
              }
              if ( !isInline( sibling ) ) {
                sibling = null;
                break;
              }
            }
            data = data.replace( /[ \t\r\n]+$/g, sibling ? ' ' : '' );
          }
          if ( data ) {
            child.data = data;
            continue;
          }
        }
        node.removeChild( child );
        i -= 1;
        l -= 1;
      }
    }
    return node;
  }
465823
function proxyMethods(exec, query) {
    var methods = [].concat(END_POINT_METHODS).concat(CHAINABLE_METHODS);
    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
        var _loop = function _loop() {
            var name = _step.value;

            var oldMethod = query[name];
            query[name] = function () {
                var clonedQuery = query.clone();
                proxyMethods(exec, clonedQuery);

                for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
                    args[_key3] = arguments[_key3];
                }

                oldMethod.apply(clonedQuery, args);
                if (CHAINABLE_METHODS.indexOf(name) > -1) {
                    return clonedQuery;
                } else {
                    return exec(clonedQuery.toString());
                }
            };
        };

        for (var _iterator = (0, _getIterator3.default)(methods), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
            _loop();
        }
    } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
    } finally {
        try {
            if (!_iteratorNormalCompletion && _iterator.return) {
                _iterator.return();
            }
        } finally {
            if (_didIteratorError) {
                throw _iteratorError;
            }
        }
    }
}