Append an element to the score, calculating its
position
435808
private void appendToScore(JScoreElementAbstract element) {
		if (!currentStaffLineInitialized) {
			currentStaffLine = initNewStaffLine();
			m_staffLines.addElement(currentStaffLine);
			currentStaffLineInitialized = true;
		}
		
		JScoreElement lastElement = currentStaffLine.getLastElement();
		if (lastElement != null) {
			if ((lastElement instanceof JPartLabel)
					&& !(element instanceof JBar)
					&& !(element instanceof JKeySignature)
					&& !(element instanceof JTempo)
					&& !(element instanceof JTimeSignature)) {
				cursor.setLocation(cursor.getX()+getMetrics().getNotesSpacing(), cursor.getY());
				//element.setBase(cursor);
			}
		}
		currentStaffLine.addElement(element);
		applyStemmingPolicy(element);
		element.setBase(cursor);
		double width = element.getWidth();
		int cursorNewLocationX = (int)(cursor.getX() + width);

		//a part label doesn't need space after it
		//if the next element is a bar line.
		if (!(element instanceof JPartLabel)
				&& !(element instanceof JTempo)) {
			//fixed space + variable space (engraver)
			if ((element instanceof JGraceNote)
					|| (element instanceof JGroupOfGraceNotes)
					|| (element instanceof JGraceNotePartOfGroup)) {
				cursorNewLocationX += getMetrics().getGraceNotesSpacing()
					+ getEngraver().getNoteSpacing(element);
			} else {
				cursorNewLocationX += getMetrics().getNotesSpacing()
					+ getEngraver().getNoteSpacing(element);
			}
		}
		//if a PartLabel is the first element on the line (no notes)
		//justify it to the right, not to override first note/chord
		if ((element instanceof JPartLabel)
				&& !currentStaffLine.hasNotes()) {
			if (((JPartLabel)element).getText().length() == 1)
				((JPartLabel)element).setTextJustification(TextJustification.RIGHT);
		}

		//Position the cursor for next element
		cursor.setLocation(cursorNewLocationX, cursor.getY());

		if (element instanceof JNote)
			m_scoreElements.put(element.getMusicElement().getReference(), element);
		else
		if (element instanceof JGroupOfNotes) {
			JGroupOfNotes g = (JGroupOfNotes)element;
			m_scoreNoteGroups.add(g);

			for (int j=0; j<g.getRenditionElements().length; j++) {
				if ((g.getRenditionElements()[j]) instanceof JNote)
					m_scoreElements.put(g.getMusicElements()[j].getReference(), g.getRenditionElements()[j]);
				else
				if (g.getRenditionElements()[j] instanceof JChord){
					JNote[] jnotes = ((JChord)g.getRenditionElements()[j]).getScoreElements();
					//Vector ...=... getNotesAsVector() <-- CLONES!!!
					//Note[] notes = ((MultiNote)((JChord)g.getRenditionElements()[j]).getMusicElement()).toArray();
					//adds all the notes of the chords into the hashtable
					//TODO the ordering of the get notes as vector and the jnotes should be the same...
					//System.out.println("Warning - abc4j - current limitation prevents you from using chords with different notes lengths.");
                    for (JNote jnote : jnotes) {
                        m_scoreElements.put(jnote.getMusicElement().getReference(), jnote);
                    }
					//adds also the chords itself
					m_scoreElements.put(g.getRenditionElements()[j].getMusicElement().getReference(), g.getRenditionElements()[j]);
				}
			}
		}
		else
		if (element instanceof JChord) {
			JNote[] jnotes = ((JChord)element).getScoreElements();
			//Vector notes = ((MultiNote)((JChord)element).getMusicElement()).getNotes();
			//adds all the notes of the chords into the hashtable
			//TODO the ordering of the get notes as vector and the jnotes should be the same...
			//System.out.println("Warning - abc4j - current limitation prevents you from using chords with different notes lengths.");
            for (JNote jnote : jnotes) {
                m_scoreElements.put(jnote.getMusicElement().getReference(), jnote);
            }
			//adds also the chords itself
			m_scoreElements.put(element.getMusicElement().getReference(), element);
		}
	}
730770
function( element ) {
            var result = new $.Point(),
                isFixed,
                offsetParent;

            element      = $.getElement( element );
            isFixed      = $.getElementStyle( element ).position == "fixed";
            offsetParent = getOffsetParent( element, isFixed );

            while ( offsetParent ) {

                result.x += element.offsetLeft;
                result.y += element.offsetTop;

                if ( isFixed ) {
                    result = result.plus( $.getPageScroll() );
                }

                element = offsetParent;
                isFixed = $.getElementStyle( element ).position == "fixed";
                offsetParent = getOffsetParent( element, isFixed );
            }

            return result;
        }
525216
def append(event, frame, arg)
      item = EventStruct.new(event, arg, frame)
      @pos = self.succ_pos
      @marks.shift if @marks[0] == @pos
      @buf[@pos] = item
      @size     += 1 unless @maxsize && @size == @maxsize
    end
1184767
def append(self, panel, position=Panel.Position.LEFT):
        
        assert panel is not None
        pos_to_string = {
            Panel.Position.BOTTOM: 'bottom',
            Panel.Position.LEFT: 'left',
            Panel.Position.RIGHT: 'right',
            Panel.Position.TOP: 'top'
        }
        _logger().log(5, 'adding panel %s at %r', panel.name,
                      pos_to_string[position])
        panel.order_in_zone = len(self._panels[position])
        self._panels[position][panel.name] = panel
        panel.position = position
        panel.on_install(self.editor)
        _logger().log(5, 'panel %s installed', panel.name)
        return panel
733026
private void compute() {
		getBase().setLocation(getTemplate().getAttributeSize(ScoreAttribute.MARGIN_LEFT),
				getTemplate().getAttributeSize(ScoreAttribute.MARGIN_TOP));
		cursor = (Point2D) getBase().clone();
		
		double componentWidth = 0, componentHeight = 0;
		
		//System.out.println("Passage #"+(++DEBUG));
		
		//if (m_isOutdated || (m_tuneBeforeTransposition == null))
		//	m_tuneBeforeTransposition = (Tune) m_tune.clone();
		m_isOutdated = false;
		m_music = null;
		m_tune = Tune.transpose(m_tuneBeforeTransposition,
				getTransposition());

		getEngraver().adaptToTune(m_tune, getMetrics());

		m_scoreElements.clear();
        m_scoreNoteGroups.clear();
        m_staffLines.removeAllElements();
		m_beginningNotesLinkElements.clear();
		
		currentKey = null;
		previousKey = null;
		currentClef = null;

		// clear headings, eg. titles, subtitles, composer, etc.
		m_headerAndFooterTexts.clear();
		
		byte[] headerFields = getTemplate().getHeaderFields();
        for (byte headerField : headerFields) {
            computeTextFieldToJText(headerField);
        }
		/*if (isShowTitles())*/ {
			//calculate Y position
			Iterator itHeaders = m_headerAndFooterTexts.iterator();
			double y = cursor.getY();
			double yLeft = y, yCenter = y, yRight = y;
			while (itHeaders.hasNext()) {
				JText oneText = (JText) itHeaders.next();
				//only headers
				if (oneText.getVerticalPosition()
						!= VerticalPosition.TOP)
					continue;
				byte align = oneText.getHorizontalPosition();
				//double textWidth = oneText.getWidth();
				if (align == HorizontalPosition.CENTER)
					y = Math.max(yLeft, Math.max(yCenter, yRight));
				else if (align == HorizontalPosition.RIGHT)
					y = Math.max(yRight, yCenter);
				else //LEFT || LEFT_TAB
					y = Math.max(yLeft, yCenter);
				y += oneText.getHeight();
				//now it's aligned on left, we'll recalculate
				//X later (see renderTitles)
				//for centered and right texts
				cursor.setLocation(getBase().getX(), y);
				if (align == HorizontalPosition.CENTER)
					yCenter = y;
				else if (align == HorizontalPosition.RIGHT)
					yRight = y;
				else //LEFT || LEFT_TAB
					yLeft = y;
				oneText.setBase(cursor);
			}
			//move the cursor at the max Y of the headers
			double headerHeight = Math.max(yLeft, Math.max(yCenter, yRight));
			cursor.setLocation(getBase().getX(), headerHeight);
		}

		//if tune has part, tune.getMusic() will return
		//duplicate parts when repeated
		//e.g. structure ABBA, P:A one line, P:B one line
		//getMusic() returns 4 lines
		//it's ok for audio rendition, but for graphical
		//we just need one occurence of each part.
		//m_tune.getVoice("1").setTablature(Tablature.BOUZOUKI_GREEK_TRICHORDO);
		m_music = m_tune.getMusicForGraphicalRendition();
		
		ArrayList lessThanQuarter = new ArrayList();
		//int durationInGroup = 0;
		//int maxDurationInGroup = Note.QUARTER;
		//int durationInCurrentMeasure = 0;
		Tuplet tupletContainer = null;
		// int staffLineNb = 0;
		//init attributes that are for iterating through the score of the tune.
		currentKey = m_tune.getKey();
		if (currentKey != null) {
			try {
				previousKey = (KeySignature) currentKey.clone();
			} catch (CloneNotSupportedException never) {
				never.printStackTrace();
			}
		}
		else
			previousKey = null;
        TimeSignature previousTime = null;
		currentTime = null;
		currentStaffLineInitialized = false;
		currentStaffLine = null;
		m_currentTablature = null;
        for (Object o : m_music.getVoices()) {
            Voice voice = (Voice) o;
            m_currentVoice = voice.getVoiceName();
            m_currentTablature = voice.getTablature();
            //m_currentTablature = Tablature.GUITAR;
            if (m_currentTablature != null) {
                m_currentTablature.computeFingerings(voice);
            }
            int size = 0;
            for (m_index = 0, size = voice.size(); m_index < size; m_index++) {
                MusicElement s = (MusicElement) voice.elementAt(m_index);
                //System.out.println(s.toString() + " " + s.getReference().toString());
                // ==== Notes>quarter, rests, notes without slur,tuplet ====
                if (
                        (
                                !(s instanceof Note || s instanceof MultiNote)
                                        || (s instanceof Note && ((Note) s).isRest())
                                        //if we were in a tuplet and the current note isn't part of tuplet anymore or part of another tuplet
                                        || (s instanceof NoteAbstract && tupletContainer != null && (!tupletContainer.equals(((NoteAbstract) s).getTuplet())))
                                        //if we weren't in a tuplet and the new note is part of a tuplet.
                                        || (s instanceof NoteAbstract && tupletContainer == null && ((NoteAbstract) s).isPartOfTuplet())
                                        || (s instanceof Note && ((Note) s).getStrictDuration() >= Note.QUARTER)
                                        || (s instanceof MultiNote && (!((MultiNote) s).hasUniqueStrictDuration() ||
                                        ((MultiNote) s).getLongestNote().getStrictDuration() >= Note.QUARTER)))

                                && lessThanQuarter.size() != 0) {
                    //this is is the end of the group, append the current group content to the score.
                    appendToScore(lessThanQuarter);
                    lessThanQuarter.clear();
                }
                // ==== Key signature ====
                if (s instanceof KeySignature) {
                    currentKey = (KeySignature) s;
                    currentClef = currentKey.getClef();
                    //TODO if end of staffline, add the key signture at right
                    //here or in initStaffLine?
                    if (currentStaffLineInitialized && !currentKey.equals(previousKey)) {
                        appendToScore(new JKeySignature(currentKey, previousKey, cursor, getMetrics()));
                        try {
                            previousKey = (KeySignature) currentKey.clone();
                        } catch (CloneNotSupportedException never) {
                            never.printStackTrace();
                        }
                    }
                } else
                    // ==== Time signature ====
                    if (s instanceof TimeSignature) {
                        if (currentTime != null) {
                            try {
                                previousTime = (TimeSignature) currentTime.clone();
                            } catch (CloneNotSupportedException never) {
                                never.printStackTrace();
                            }
                        }
                        currentTime = (TimeSignature) s;
                        //if (previousTime != null)
                        if (currentStaffLineInitialized && !currentTime.equals(previousTime))
                            appendToScore(new JTimeSignature(currentTime, cursor, getMetrics()));
                    } else
                        // ==== MultiNote ====
                        if (s instanceof MultiNote) {
                            NoteAbstract note = (NoteAbstract) s;
                            if (note.isBeginingSlur())
                                m_beginningNotesLinkElements.addElement(note);
                            tupletContainer = ((MultiNote) s).getTuplet();
                            Note[] tiesStart = ((MultiNote) s).getNotesBeginningTie();
                            if (tiesStart != null)
                                for (Note aTiesStart : tiesStart) {
                                    m_beginningNotesLinkElements.addElement(aTiesStart);
                                }
                            //checks if the shortest durations of the multi note is less than a quarter note.
                            // if yes, this multi note will be put into a group.
                            if (((MultiNote) s).getStrictDurations()[0] < Note.QUARTER)
                                lessThanQuarter.add(s);
                            else {
                                appendToScore(new JChord((MultiNote) s, currentClef, getMetrics(), cursor));
                            }

                            //durationInCurrentMeasure+=((MultiNote)s).getLongestNote().getDuration();
                        } //end MultiNote
                        else
                            // ==== Note ====
                            if (s instanceof Note) {
                                Note note = (Note) s;

                                if (note.isBeginingSlur() || note.isBeginningTie())
                                    m_beginningNotesLinkElements.addElement(note);
                                short strictDur = note.getStrictDuration();
                                tupletContainer = note.getTuplet();
                                // checks if this note should be part of a group.
                                if (strictDur < Note.QUARTER && !note.isRest()) {
                                    //durationInGroup+=(note).getDuration();
                                    //System.out.println("duration in group " + durationInGroup);
                                    lessThanQuarter.add(note);
                    /*if (durationInGroup>=maxDurationInGroup) {
						appendToScore(lessThanQuarter);
						lessThanQuarter.clear();
						durationInGroup = 0;
					}*/
                                } else {
                                    JNote noteR = new JNote(note, currentClef, cursor, getMetrics());
                                    //if (note.getHeight()>=Note.c)
                                    //	noteR.setStemUp(false);
                                    appendToScore(noteR);
                                }
                                //durationInCurrentMeasure+=note.getDuration();
                            } //end Note
                            else
                                // ==== RepeatBarLine ===
                                if (s instanceof RepeatBarLine) {
                                    appendToScore(new JRepeatBar((RepeatBarLine) s, cursor, getMetrics()));
                                    //durationInCurrentMeasure=0;
                                } else
                                    // ==== BarLine ====
                                    if (s instanceof BarLine) {
                                        appendToScore(new JBar((BarLine) s, cursor, getMetrics()));
                                        //durationInCurrentMeasure=0;
                                    } else
                                        // ==== EndOfStaffLine ====
                                        if (s instanceof EndOfStaffLine) {
                                            // staffLineNb++;
                                            currentStaffLineInitialized = false;
                                        } else
                                            // ==== NotesSeparator ====
                                            if (s instanceof NotesSeparator) {
                                                appendToScore(lessThanQuarter);
                                                lessThanQuarter.clear();
                                            } else
                                                // ==== Spacer ====
                                                if (s instanceof Spacer) {
                                                    appendToScore(lessThanQuarter);
                                                    lessThanQuarter.clear();
                                                    appendToScore(new JSpacer(getMetrics(), cursor, (Spacer) s));
                                                } else
                                                    // ==== Words ====
                                                    if (s instanceof Words) {
                                                        appendLyrics(new JWords(getMetrics(), (Words) s));
                                                    } else
                                                        // ==== Part label ====
                                                        if (s instanceof PartLabel) {
                                                            appendToScore(new JPartLabel(getMetrics(), cursor, (PartLabel) s));
                                                        } else
                                                            // ==== Tempo ====
                                                            if ((s instanceof Tempo)/* && (s != m_tune.getGeneralTempo())*/) {
                                                                appendToScore(new JTempo(getMetrics(), cursor, (Tempo) s));
                                                            } else
                                                                // ==== MeasureRepeat ====
                                                                if (s instanceof MeasureRepeat) {
                                                                    appendToScore(new JMeasureRepeat(getMetrics(), cursor, (MeasureRepeat) s));
                                                                }
            }//end each element in voice
        }//end each voice in music

		if (lessThanQuarter.size()!=0) {
			appendToScore(lessThanQuarter);
			lessThanQuarter.clear();
			//durationInGroup = 0;
		}

		if (isJustified())
			justify();

		cursor.setLocation(cursor.getX(),
			(currentStaffLine!=null
					?currentStaffLine.getBottomY()
					:cursor.getY())
				+getMetrics().getStaffCharBounds().getHeight());

		/*if (isShowFootNotes())*/ {
			byte[] footerFields = getTemplate().getFooterFields();
            for (byte footerField : footerFields) {
                computeTextFieldToJText(footerField);
            }
			Iterator it = m_headerAndFooterTexts.iterator();
			double height = 0;
			while (it.hasNext()) {
				JText jtext = (JText) it.next();
				if (jtext.getVerticalPosition() != VerticalPosition.BOTTOM)
					continue;
				height = jtext.getHeight();//*1.2;
				cursor.setLocation(cursor.getX(), cursor.getY()+height);
				jtext.setBase(cursor);
			}
			//a little more space for bottom baseline letters (like p, q...)
			cursor.setLocation(cursor.getX(), cursor.getY()+1);
		}

		if (m_staffLines != null) {
			double maxWidth = 0;
			for (int i=0; i<m_staffLines.size();i++) {
				JStaffLine currentStaffLine = (JStaffLine)m_staffLines.elementAt(i);
				maxWidth = Math.max(maxWidth, currentStaffLine.getWidth());
			}
			componentWidth = maxWidth + 1;
		} else {
			if (cursor.getX()>componentWidth)
				componentWidth = (int)cursor.getX() + 1;
		}
		
		//if header/footer texts are too long, extend component width
        for (Object m_headerAndFooterText : m_headerAndFooterTexts) {
            JText jt = (JText) m_headerAndFooterText;
            componentWidth = Math.max(componentWidth, jt.getWidth());
        }
		componentWidth += getTemplate().getAttributeSize(
				ScoreAttribute.MARGIN_RIGHT);
		componentHeight = (int)cursor.getY();
		componentHeight += getTemplate().getAttributeSize(
				ScoreAttribute.MARGIN_BOTTOM);

		m_width = componentWidth;
		m_height = componentHeight;
	}
1095375
def append(self, hcont, value, score = None):
        
        assert (score is None) != (self.field.sort_field is None)
        if score is None:
            score = getattr(value, self.field.sort_field.name)
        ContainerFieldWriter.append(self, hcont, value, score)
265637
def extend(self, iterable):
        '''
        '''
        i = self.insert
        for score_values in iterable:
            i(*score_values)
662568
def add_score(score)
      @total_score += score.value
      @scores[score.key] = score
      if @top_score_key.nil? || @scores[@top_score_key].value < score.value
        @top_score_key = score.key
      end
    end
276680
function append() {
  var i, l = this.length, el, args = this.slice.call(arguments);
  function it(node, index) {
    // content elements to insert
    el.each(function(ins) {
      ins = (index < (l - 1)) ? ins.cloneNode(true) : ins;
      node.appendChild(ins);
    });
  }
  for(i = 0;i < args.length;i++) {
    // wrap content
    el = this.air(args[i]);
    // matched parent elements (targets)
    this.each(it);
  }
  return this;
}
579855
function insertOrAppend(container, pos, el) {
    var childs = container.childNodes;
    if (pos < childs.length) {
      var refNode = childs[pos];
      container.insertBefore(el, refNode);
    } else {
      container.appendChild(el);
    }
  }
361437
function positionInNodeList(element, nodeList) {
  for (var i = 0; i < nodeList.length; i++) {
    if (element === nodeList[i]) {
      return i;
    }
  }
  return -1;
}
1070304
function(text, container, name, value, type, noBr) {
      var idNumber = idCounter;
      if (!noBr) {
        $('<br>').appendTo(container);
      }
      $('<label></label>').attr('for', animationId + '-' + name + '-' + idNumber).text(text).appendTo(container);
      if (type === 'text') {
        $('<input type="text"></input>').addClass(name).attr('id', animationId + '-' + name + '-' + idNumber).val(value).appendTo(container);
      } else if (type === 'checkbox') {
        $('<input></input>').addClass(name).attr('type', 'checkbox').attr('id', animationId + '-' + name + '-' + idNumber).prop('checked', value).appendTo(container);
      } else if (type === 'textarea') {
        $('<textarea></textarea>').addClass(name).attr('id', animationId + '-' + name + '-' + idNumber).val(value).appendTo(container);
      }
      idCounter += 1;
    }
85272
function (element, event) {
                var pageX = (event.changedTouches) ? event.changedTouches[0].pageX : event.pageX;

                var offsetx = pageX - $(element).offset().left;
                if (!ltr) { offsetx = range.width() - offsetx };
                if (offsetx > range.width()) { offsetx = range.width(); }
                if (offsetx < 0) { offsetx = 0; }

                return score = Math.ceil(offsetx / itemdata('starwidth') * (1 / itemdata('step')));
            }
1389
function pointAt(node){
      var parent = node.parentNode;
      var next = node.nextSibling;
      return function(newnode) {
        parent.insertBefore(newnode, next);
      };
    }
558255
def append(self, item):
        
        try:
            self._data[self._position] = item
        except IndexError:
            self._grow()
            self._data[self._position] = item
        self._position += 1
        return self
692869
def appendChild(self, param):
        ''' 
        '''
        Symbol.appendChild(self, param)
        if param.offset is None:
            param.offset = self.size
            self.size += param.size
949203
def place_notes_at(self, notes, at):
        """"""
        for x in self.bar:
            if x[0] == at:
                x[0][2] += notes