Adjust the configuration of the cumulated double bonds to be
either Cis or Trans.

@param elem the stereo element to adjust
773840
private void adjust(ExtendedCisTrans elem) {

        IBond   middle = elem.getFocus();
        IAtom[] ends   = ExtendedCisTrans.findTerminalAtoms(container, middle);
        IBond[] bonds  = elem.getCarriers().toArray(new IBond[2]);

        IAtom left  = ends[0];
        IAtom right = ends[1];

        int p = parity(elem);
        int q = parity(getAtoms(left, bonds[0].getOther(left), right))
                * parity(getAtoms(right, bonds[1].getOther(right), left));

        // configuration is unspecified? then we add an unspecified bond.
        // note: IDoubleBondStereochemistry doesn't indicate this yet
        if (p == 0) {
            for (IBond bond : container.getConnectedBondsList(left))
                bond.setStereo(IBond.Stereo.NONE);
            for (IBond bond : container.getConnectedBondsList(right))
                bond.setStereo(IBond.Stereo.NONE);
            bonds[0].setStereo(IBond.Stereo.UP_OR_DOWN);
            return;
        }

        // configuration is already correct
        if (p == q) return;

        Arrays.fill(visited, false);
        visited[atomToIndex.get(left)] = true;

        if (ringSearch.cyclic(atomToIndex.get(middle.getBegin()),
                              atomToIndex.get(middle.getEnd()))) {
            return;
        }

        for (int w : graph[atomToIndex.get(right)]) {
            if (!visited[w]) reflect(w, middle);
        }
    }
130997
private void addExtensionPoint(final Element elem) {
        final String id = elem.getAttribute(EXTENSION_POINT_ID_ATTR);
        if (id == null) {
            throw new IllegalArgumentException(EXTENSION_POINT_ID_ATTR + " attribute not set on extension-point");
        }
        final String name = elem.getAttribute(EXTENSION_POINT_NAME_ATTR);
        features.addExtensionPoint(new ExtensionPoint(id, name, currentPlugin));
    }
13370
function mergeTitle( elem ) {
		merge( elem, function( old ) {
			var text = elem.children[ 0 ];

			utils.replaceElement( old.children[ 0 ], text );
			old.children[ 0 ] = text;
		} );
	}
550055
public static MarkedElement markupBond(IRenderingElement elem, IBond bond) {
        assert elem != null;
        MarkedElement tagElem = markupChemObj(elem, bond);
        tagElem.aggClass("bond");
        return tagElem;
    }
1112558
public void setBoolean(Element el, String key, boolean value) {
	el.setAttribute(key, String.valueOf(value));
    }
591687
private function addElement($elem, $to_add)
    {
        //debug_var_dump("to_add->$elem", $to_add->$elem);
        if (isset($to_add->$elem) && !empty($to_add->$elem) && $to_add->$elem != ' ') {//&& !empty(str_replace(' ', '', $to_add->$elem)) ){
            $elem_to_add = str_replace('&', '-and-', $to_add->$elem); //replace amperstamps for -and-
            if (!in_array($elem_to_add, $this->$elem)) {
                array_push($this->$elem, $elem_to_add);
                //debug_var_dump("this->$elem", $this->$elem);
            }
        }
    }
341825
public void add(double element) {
	// overridden for performance only.  
	if (size == elements.length) ensureCapacity(size + 1); 
	elements[size++] = element;
}
140869
public void remove(int ele) {
        int idx;

        idx = ele >> SHIFT;
        if (idx < data.length) {
            data[idx] &= ~(1 << ele);
        }
    }
1025034
public static void setTransparency(Element elem, int alpha) {

        float ieVersion = getIEVersion();
        // only IE 8 requires special treatment, older IE versions are no longer supported
        if (ieVersion < 9.0) {
            elem.getStyle().setProperty(
                "-ms-filter",
                "\"progid:DXImageTransform.Microsoft.Alpha(opacity=" + alpha + ")\"");
        } else {
            // Everyone else
            elem.getStyle().setOpacity((1.0 * alpha) / 100);
        }
    }
1041256
public void setAlignment(int alignment) {
        super.setAlignment(alignment);
        for(int i = 0; i < this.content.length; i++) {
            if(this.content[i] instanceof Paragraph) {
                ((Paragraph) this.content[i]).setAlignment(alignment);
            } else if(this.content[i] instanceof Table) {
                ((Table) this.content[i]).setAlignment(alignment);
            } else if(this.content[i] instanceof Image) {
                ((Image) this.content[i]).setAlignment(alignment);
            }     
        }
    }
1123317
private void label(final ExtendedTetrahedral element) {

        final IAtom focus = element.focus();
        final IAtom[] atoms = element.peripherals();
        final IBond[] bonds = new IBond[4];

        int p = parity(element.winding());

        List<IBond> focusBonds = container.getConnectedBondsList(focus);

        if (focusBonds.size() != 2) {
            LoggingToolFactory.createLoggingTool(getClass()).warn(
                    "Non-cumulated carbon presented as the focus of extended tetrahedral stereo configuration");
            return;
        }

        IAtom[] terminals = element.findTerminalAtoms(container);

        IAtom left  = terminals[0];
        IAtom right = terminals[1];

        // some bonds may be null if, this happens when an implicit atom
        // is present and one or more 'atoms' is a terminal atom
        for (int i = 0; i < 4; i++)
            bonds[i] = findBond(left, right, atoms[i]);


        // find the clockwise ordering (in the plane of the page) by sorting by
        // polar coordinates
        int[] rank = new int[4];
        for (int i = 0; i < 4; i++)
            rank[i] = i;
        p *= sortClockwise(rank, focus, atoms, 4);

        // assign all up/down labels to an auxiliary array
        IBond.Stereo[] labels = new IBond.Stereo[4];
        for (int i = 0; i < 4; i++) {
            int v = rank[i];
            p *= -1;
            labels[v] = p > 0 ? UP : DOWN;
        }

        int[] priority = new int[]{5, 5, 5, 5};

        // set the label for the highest priority and available bonds on one side
        // of the cumulated system, setting both sides doesn't make sense
        int i = 0;
        for (int v : priority(atomToIndex.get(focus), atoms, 4)) {
            IBond bond = bonds[v];
            if (bond == null) continue;
            if (bond.getStereo() == NONE && bond.getOrder() == SINGLE) priority[v] = i++;
        }

        // we now check which side was more favourable and assign two labels
        // to that side only
        if (priority[0] + priority[1] < priority[2] + priority[3]) {
            if (priority[0] < 5)
                setWedge(bonds[0], atoms[0], labels[0]);
            if (priority[1] < 5)
                setWedge(bonds[1], atoms[1], labels[1]);
        } else {
            if (priority[2] < 5)
                setWedge(bonds[2], atoms[2], labels[2]);
            if (priority[3] < 5)
                setWedge(bonds[3], atoms[3], labels[3]);
        }

    }
697914
private void label(final Atropisomeric element) {

        final IBond   focus = element.getFocus();
        final IAtom   beg   = focus.getBegin();
        final IAtom   end   = focus.getEnd();
        final IAtom[] atoms = element.getCarriers().toArray(new IAtom[0]);
        final IBond[] bonds = new IBond[4];

        int p = 0;
        switch (element.getConfigOrder()) {
            case IStereoElement.LEFT:
                p = +1;
                break;
            case IStereoElement.RIGHT:
                p = -1;
                break;
        }

        // some bonds may be null if, this happens when an implicit atom
        // is present and one or more 'atoms' is a terminal atom
        bonds[0] = container.getBond(beg, atoms[0]);
        bonds[1] = container.getBond(beg, atoms[1]);
        bonds[2] = container.getBond(end, atoms[2]);
        bonds[3] = container.getBond(end, atoms[3]);

        // may be back to front?
        if (bonds[0] == null || bonds[1] == null ||
            bonds[2] == null || bonds[3] == null)
            throw new IllegalStateException("Unexpected configuration ordering, beg/end bonds should be in that order.");

        // find the clockwise ordering (in the plane of the page) by sorting by
        // polar corodinates
        int[] rank = new int[4];
        for (int i = 0; i < 4; i++)
            rank[i] = i;

        IAtom phantom = beg.getBuilder().newAtom();
        phantom.setPoint2d(new Point2d((beg.getPoint2d().x + end.getPoint2d().x) / 2,
                                   (beg.getPoint2d().y + end.getPoint2d().y) / 2));
        p *= sortClockwise(rank, phantom, atoms, 4);

        // assign all up/down labels to an auxiliary array
        IBond.Stereo[] labels = new IBond.Stereo[4];
        for (int i = 0; i < 4; i++) {
            int v = rank[i];
            p *= -1;
            labels[v] = p > 0 ? UP : DOWN;
        }

        int[] priority = new int[]{5, 5, 5, 5};

        // set the label for the highest priority and available bonds on one side
        // of the cumulated system, setting both sides doesn't make sense
        int i = 0;
        for (int v : new int[]{0,1,2,3}) {
            IBond bond = bonds[v];
            if (bond == null) continue;
            if (bond.getStereo() == NONE && bond.getOrder() == SINGLE) priority[v] = i++;
        }

        // we now check which side was more favourable and assign two labels
        // to that side only
        if (priority[0] + priority[1] < priority[2] + priority[3]) {
            if (priority[0] < 5) {
                bonds[0].setAtoms(new IAtom[]{beg, atoms[0]});
                bonds[0].setStereo(labels[0]);
            }
            if (priority[1] < 5) {
                bonds[1].setAtoms(new IAtom[]{beg, atoms[1]});
                bonds[1].setStereo(labels[1]);
            }
        } else {
            if (priority[2] < 5) {
                bonds[2].setAtoms(new IAtom[]{end, atoms[2]});
                bonds[2].setStereo(labels[2]);
            }
            if (priority[3] < 5) {
                bonds[3].setAtoms(new IAtom[]{end, atoms[3]});
                bonds[3].setStereo(labels[3]);
            }
        }

    }
545609
def add(self, elem):
        
        if not isinstance(elem, JWK):
            raise TypeError('Only JWK objects are valid elements')
        set.add(self, elem)
307007
def _set_align(self, orientation, value):
        '''
        '''
        orientation_letter = orientation[0]
        possible_alignments = getattr(
            self, '_possible_{}aligns'.format(orientation_letter))
        all_alignments = getattr(
            self, '_all_{}aligns'.format(orientation_letter))
        if value not in possible_alignments:
            if value in all_alignments:
                msg = 'non-permitted'
            else:
                msg = 'non-existant'
            raise ValueError(
                "Can't set {} {} alignment {!r} on element {!r}".format(
                    msg, orientation, value, self))
        setattr(self, '_{}align'.format(orientation_letter), value)
242131
public static void removeFromParent(Element elem) {
    if(elem != null && elem.getParentNode() != null) {
      elem.getParentNode().removeChild(elem);
    }
  }
322344
private void overlayValue(HeaderElement elem) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Overlaying existing header: " + elem.getName());
        }
        int next_index = this.lastCRLFBufferIndex;
        int next_pos = this.lastCRLFPosition;
        if (null != elem.nextSequence && !elem.nextSequence.wasAdded()) {
            next_index = elem.nextSequence.getLastCRLFBufferIndex();
            next_pos = elem.nextSequence.getLastCRLFPosition();
        }
        WsByteBuffer buffer = this.parseBuffers[elem.getLastCRLFBufferIndex()];
        buffer.position(elem.getLastCRLFPosition() + (elem.isLastCRLFaCR() ? 2 : 1));
        if (next_index == elem.getLastCRLFBufferIndex()) {
            // all in one buffer
            buffer.put(elem.getKey().getMarshalledByteArray(foundCompactHeader()));
            buffer.put(elem.asRawBytes(), elem.getOffset(), elem.getValueLength());
        } else {
            // header straddles buffers
            int index = elem.getLastCRLFBufferIndex();
            index = overlayBytes(elem.getKey().getMarshalledByteArray(foundCompactHeader()), 0, -1, index);
            index = overlayBytes(elem.asRawBytes(), elem.getOffset(), elem.getValueLength(), index);
            buffer = this.parseBuffers[index];
        }
        // pad trailing whitespace if we need it
        int start = buffer.position();
        if (start < next_pos) {
            scribbleWhiteSpace(buffer, start, next_pos);
        }
    }
73340
public static TypeElement enclosingClass(final Element elem) {
        Element result = elem;
        while (result != null && !result.getKind().isClass()
                && !result.getKind().isInterface()) {
            Element encl = result.getEnclosingElement();
            result = encl;
        }
        return (TypeElement) result;
    }