add element to lattice element list

            :param ele: magnetic element defined in element module
            return total element number
324866
def addElement(self, *ele):
        
        for el in list(Models.flatten(ele)):
            e = copy.deepcopy(el)
            self._lattice_eleobjlist.append(e)
            self._lattice_elenamelist.append(e.name)
            self._lattice_elecnt += 1
        # update lattice, i.e. beamline element

        # self._lattice.setConf(Models.makeLatticeString(self._lattice_elenamelist))
        self._lattice.setConf(Models.makeLatticeDict(self._lattice_elenamelist))

        # positioning elements
        self.initPos()

        return self._lattice_elecnt
341166
public boolean add(BtrpElement el) {
        switch (el.type()) {
            case VM:
                if (!this.vms.add((VM) el.getElement())) {
                    return false;
                }
                break;
            case NODE:
                if (!this.nodes.add((Node) el.getElement())) {
                    return false;
                }
                break;
            default:
                return false;
        }
        return true;

    }
699896
def elem_add(self, idx=None, name=None, **kwargs):
        

        idx = self.system.devman.register_element(dev_name=self._name, idx=idx)
        self.system.__dict__[self._group].register_element(self._name, idx)

        self.uid[idx] = self.n
        self.idx.append(idx)

        self.mdl_to.append(list())
        self.mdl_from.append(list())

        # self.n += 1

        if name is None:
            self.name.append(self._name + ' ' + str(self.n))
        else:
            self.name.append(name)

        # check mandatory parameters
        for key in self._mandatory:
            if key not in kwargs.keys():
                self.log(
                    'Mandatory parameter <{:s}.{:s}> missing'.format(
                        self.name[-1], key), ERROR)
                sys.exit(1)

        # set default values
        for key, value in self._data.items():
            self.__dict__[key].append(value)

        # overwrite custom values
        for key, value in kwargs.items():
            if key not in self._data:
                self.log(
                    'Parameter <{:s}.{:s}> is not used.'.format(
                        self.name[-1], key), WARNING)
                continue
            self.__dict__[key][-1] = value

            # check data consistency
            if not value and key in self._zeros:
                if key == 'Sn':
                    default = self.system.mva
                elif key == 'fn':
                    default = self.system.config.freq
                else:
                    default = self._data[key]
                self.__dict__[key][-1] = default
                self.log(
                    'Using default value for <{:s}.{:s}>'.format(
                        self.name[-1], key), WARNING)

        return idx
106729
def element_count(self):
        
        result = conf.lib.clang_getNumElements(self)
        if result < 0:
            raise Exception('Type does not have elements.')

        return result
1096473
def _convertToElementList(elements_list):
    
    elements = []
    current_element = []
    for node_index in elements_list:
        if node_index == -1:
            elements.append(current_element)
            current_element = []
        else:
            current_element.append(node_index)

    return elements
1118101
public boolean add(E e) {
		hashCodeUpToDate = false;
		ensureCapacityInternal(size + 1); // Increments modCount!!
		elementData[size++] = e;
		return true;
	}
1014482
def set_element_attributes(elem_to_parse, **attrib_kwargs):
    

    element = get_element(elem_to_parse)

    if element is None:
        return element

    if len(attrib_kwargs):
        element.attrib.update(attrib_kwargs)

    return element.attrib
994960
def append(self, el):
        
        if self.value is None:
            self.value = [el]
        else:
            self.value.append(el)
54495
function (ele) {
            var node = this[0];
            //(ele string ??)
            if (node.parentNode) {
                node.parentNode.insertBefore(ele, node.nextSibling);
            }
            return this;
        }
1232316
def _setElegant(self, **infiles):
        
        ltefile, elefile = infiles['ltefile'], infiles['elefile']
        self.lattice_file = ltefile
        self.elegant_file = elefile
265746
@Override
    public void add(int index, T elem) {
        /* Confirm the validity of the index. */
        if (index < 0 || index >= size())
            throw new IndexOutOfBoundsException("Index " + index + ", size " + size());

        /* Add a dummy element to ensure that everything resizes correctly.
         * There's no reason to repeat the logic.
         */
        add(null);

        /* Next, we need to shuffle down every element that appears after
         * the inserted element.  We'll do this using our own public interface.
         */
        for (int i = size(); i > index; ++i)
            set(i, get(i - 1));

        /* Finally, write the element. */
        set(index, elem);
    }
471855
def literal_array(cls, elems):
        
        tys = [el.type for el in elems]
        if len(tys) == 0:
            raise ValueError("need at least one element")
        ty = tys[0]
        for other in tys:
            if ty != other:
                raise TypeError("all elements must have the same type")
        return cls(types.ArrayType(ty, len(elems)), elems)
655949
def json2elem(json_data, factory=ET.Element):

    

    return internal_to_elem(json.loads(json_data), factory)
428253
def get_el_amount(self, element):
        
        return sum([self._all_comp[i][element] * abs(self._coeffs[i])
                    for i in range(len(self._all_comp))]) / 2
647637
def copy_of_xml_element(elem):
    

    copyElem = ElementTree.Element(elem.tag, elem.attrib)
    for child in elem:
        copyElem.append(child)
    return copyElem
1102115
def add_lib_element(type, value, front = false)
      elem = [type, value.instance_of?(String) ? value : value.name]
      if front
        lib_elements.unshift(elem)
      else
        lib_elements << elem
      end
    end
907844
def elem_add(self, idx=None, name=None, **kwargs):
        """"""
        self.jit_load()
        if self.loaded:
            return self.system.__dict__[self.name].elem_add(
                idx, name, **kwargs)