Number of elements in the :class:`Structure`.
346337
def size(self):
        ''''''
        if self.cache.cache is None:
            return self.read_backend_structure().size()
        else:
            return len(self.cache.cache)
1263316
def number_of_statements(self, n):
        """"""
        stmt_type = n.type
        if stmt_type == syms.compound_stmt:
            return 1
        elif stmt_type == syms.stmt:
            return self.number_of_statements(n.children[0])
        elif stmt_type == syms.simple_stmt:
            # Divide to remove semi-colons.
            return len(n.children) // 2
        else:
            raise AssertionError("non-statement node")
10544
def each_element(e_node_type=nil, &block) 
		@children.each do |c| 
			if c.kind_of? MDElement
				if (not e_node_type) || (e_node_type == c.node_type)
					block.call c
				end
				c.each_element(e_node_type, &block)
			end
		end
	end
1035509
def n_members(self):
        
        return int(binom(self.n_meas + self.n_elements -1, self.n_elements - 1))
196813
function(fn) {
            	var n = this.elements.length;
            	for (var i = 0; i < n; i++) {
            	    fn(this.elements[i], i + 1);
            	}
                }
2674
def n_atom(self, node):
        
        length = len(node)
        if length == 1:
            self.preorder(node[0])
            node.value = node[0].value
            self.prune()
        elif length == 3:
            self.preorder(node[1])
            node.value = node[1].value
            self.prune()
        else:
            assert False, "Expecting atom to have length 1 or 3"
1055427
def p_members(self, p):
        """"""
        if len(p) == 1:
            p[0] = list()
        else:
            p[1].append(p[2])
            p[0] = p[1]
927985
def element_at(self, n):
        
        result = list(itertools.islice(self.to_list(), max(0, n), n + 1, 1))
        if len(result) == 0:
            raise NoElementsError(u"No element found at index {0}".format(n))
        return result[0]
799797
def get_current_structure(self):
        

        struct = self.__class__.get_structure()
        struct.update(self.__field_types__)
        return struct
140363
def _initialize_counters(model_class, name, bases, attrs):
    """"""
    model_class._counters = []
    for k, v in attrs.iteritems():
        if isinstance(v, Counter):
            model_class._counters.append(k)
879042
public static int getNumGroups(Structure structure) {
		int count = 0;
		for(int i=0; i<structure.nrModels(); i++) {
			for(Chain chain : structure.getChains(i)){
				count+= chain.getAtomGroups().size();
			}
		}
		return count;
	}
918966
def _check_structure(self):
        '''
        
        '''
        # Collect all variable names and operator names
        unused_variables = set()
        unused_operators = set()
        for variable in self.unordered_variable_iterator():
            unused_variables.add(variable.full_name)
        for operator in self.unordered_operator_iterator():
            unused_operators.add(operator.full_name)

        for operator in self.unordered_operator_iterator():
            for variable in operator.inputs:
                # A variable is used by an operator, so we remove the variable from the unused-variable list.
                unused_variables.discard(variable.full_name)
                # A operator has an input, so we remove the operator from the unused-operator list.
                unused_operators.discard(operator.full_name)
            for variable in operator.outputs:
                # A variable is used by an operator, so we remove the variable from the unused-variable list.
                unused_variables.discard(variable.full_name)
                # A operator has an output, so we remove the operator from the unused-operator list.
                unused_operators.discard(operator.full_name)

        if len(unused_variables) > 0:
            raise RuntimeError('Isolated variables exist: %s' % unused_variables)

        if len(unused_operators) > 0:
            raise RuntimeError('Isolated operators exist: %s' % unused_operators)
660016
def inspect
      edge_count = @nodes.values.each_with_object(Set.new) do |node, edges|
        edges.merge(node.edges(:out))
      end.length

      "#<#{self.class} (#{ @nodes.length } nodes, #{ edge_count } edges)>"
    end
940888
static private int countStructFields(ObjectInspector x, ArrayList<String> allColumnNames) {
    int res = 1;
    switch(x.getCategory()) {
      case STRUCT:
        StructObjectInspector structObjectInspector = (StructObjectInspector) x;
        List<StructField> allColumns = (List<StructField>) structObjectInspector.getAllStructFieldRefs(); // column info
        for (StructField oneField : allColumns) {
          allColumnNames.add(oneField.getFieldName());
          res += countStructFields(oneField.getFieldObjectInspector(),allColumnNames);
        }
        break;
      case LIST:
        ListObjectInspector listObjectInspector = (ListObjectInspector) x;
        allColumnNames.add("list");
        res += countStructFields(listObjectInspector.getListElementObjectInspector(),allColumnNames);
        break;
      case MAP:
        MapObjectInspector mapObjectInspector = (MapObjectInspector) x;
        allColumnNames.add("mapKey");
        res += countStructFields(mapObjectInspector.getMapKeyObjectInspector(),allColumnNames);
        allColumnNames.add("mapValue");
        res += countStructFields(mapObjectInspector.getMapValueObjectInspector(),allColumnNames);
        break;
      case UNION:
        UnionObjectInspector unionObjectInspector = (UnionObjectInspector)x;
        allColumnNames.add("union");
        for( ObjectInspector xx:unionObjectInspector.getObjectInspectors())
          res += countStructFields(xx,allColumnNames);
        break;
      case PRIMITIVE:break;
      default: throw H2O.unimpl();
    }
    return res;
  }
100788
def serialise(structure):
    
    return ctypes.cast(
        ctypes.pointer(structure),
        ctypes.POINTER(ctypes.c_char * ctypes.sizeof(structure)),
    ).contents
74130
def element( i )
      sources, table = @sources, @table
      if sources.any? { |source| source.dimension > 0 }
        sources = sources.
          collect { |source| source.dimension > 0 ? source.element( i ) : source }
        self.class.new *( sources + [ table ] )
      elsif table.dimension > sources.size
        n = sources.size
        self.class.new *( sources + [ table.unroll( n ).element( i ).roll( n ) ] )
      else
        super i
      end
    end
980507
def count_braces(self):
    
    n_left = len(re.findall("{{", self.template))
    n_right = len(re.findall("}}", self.template))
    return n_left, n_right