adds a note to a measure. Assumes that it should be added to the first layer, and if there are no layers in
the measure one should be created. The note is enclosed in its own Chord object.

@param Note $note the note to add
483079
function addNote($note) {
        if (!count($this->layers)) {
            $layer = new Layer();
            $this->addLayer($layer);
        } else {
            $layer = $this->layers[0];
        }

        $layer->addNote($note);

    }
1297487
public function addLabel(Label $label)
    {
        if (!$this->labels->contains($label)) {
            $this->labels->add($label);
            $label->setInteractionMatching($this);
        }
    }
950388
public function update(NoteRequest $request, Note $note)
    {
        $note->update($request->all());

        return $this->makeRedirect(true, 'admin.notes.index', __('msg.update'));
    }
705010
public function addDocument($document) {
		if(is_array($document)) {
			$this->addDocumentArray($document);
		} elseif ($document instanceof Document) {
			$this->addDocumentObject($document);
		}
	}
549383
public function addNoteToIssue($id, $note, $privateNote = false)
    {
        return $this->update($id, [
            'notes' => $note,
            'private_notes' => $privateNote,
        ]);
    }
259120
public function destroy(Note $note)
    {
        if (! $note->is_completed) {
            return $this->makeRedirect(false, 'admin.notes.index', __('msg.error'));
        }

        $note->delete();

        return $this->makeRedirect(true, 'admin.notes.index', __('msg.destroy'));
    }
1002181
public function addHint($hint)
    {
        if (!$this->containsHints) {
            $this->message .= "\nHint: ".$hint;
            $this->containsHints = true;
        } else {
            $this->message .= ', '.$hint;
        }
    }
753982
def note(id, type, options = {})
      # Welguisz:  No idea why this is here, but keeping it here because it follows other blocks
      _notes
      # Create a new note and place it in the notes 2-D Hash
      @_notes[id][type] = Note.new(id, type, options)
    end
32626
function photos_notes_add($photo_id, $note_x, $note_y, $note_w, $note_h, $note_text)
    {
        /** http://www.flickr.com/services/api/flickr.photos.notes.add.html */
        $this->request("flickr.photos.notes.add", array("photo_id" => $photo_id, "note_x" => $note_x, "note_y" => $note_y, "note_w" => $note_w, "note_h" => $note_h, "note_text" => $note_text), TRUE);
        return $this->parsed_response ? $this->parsed_response['note'] : false;
    }
392625
protected function send(array $notes): void
    {
        foreach ($notes as $note) {
            $this->output->writeln($note);
        }
    }
675772
public function add($item)
    {
        if ($item instanceof Hashable) {
            $this->items[$item->hashCode()] = $item;

            return;
        }

        $this->items[(string)$item] = $item;
    }
167207
public static function checkNoteAccess(Note $note = null, $edit = false): void
    {
        if ($note === null) {
            throw new NoteNotFoundException();
        }

        if (!$note->canShow()) {
            throw new NoteAccessDeniedException();
        }

        if ($edit && !$note->canEdit()) {
            throw new NoteAccessDeniedException();
        }
    }
548587
public static function update_notes($notes = array()) {
        global $CFG, $DB;

        $params = self::validate_parameters(self::update_notes_parameters(), array('notes' => $notes));

        // Check if note system is enabled.
        if (!$CFG->enablenotes) {
            throw new moodle_exception('notesdisabled', 'notes');
        }

        $warnings = array();
        foreach ($params['notes'] as $note) {
            $notedetails = note_load($note['id']);
            if (isset($notedetails->id)) {
                // Ensure the current user is allowed to run this function.
                $context = context_course::instance($notedetails->courseid);
                self::validate_context($context);
                require_capability('moodle/notes:manage', $context);

                $dbnote = new stdClass;
                $dbnote->id = $note['id'];
                $dbnote->content = $note['text'];
                $dbnote->format = external_validate_format($note['format']);
                // Get the state ('personal', 'course', 'site').
                switch ($note['publishstate']) {
                    case 'personal':
                        $dbnote->publishstate = NOTES_STATE_DRAFT;
                        break;
                    case 'course':
                        $dbnote->publishstate = NOTES_STATE_PUBLIC;
                        break;
                    case 'site':
                        $dbnote->publishstate = NOTES_STATE_SITE;
                        $dbnote->courseid = SITEID;
                        break;
                    default:
                        $warnings[] = array('item' => 'note',
                                            'itemid' => $note["id"],
                                            'warningcode' => 'badparam',
                                            'message' => 'Provided publishstate incorrect');
                        break;
                }
                if (!note_save($dbnote)) {
                    $warnings[] = array('item' => 'note',
                                        'itemid' => $note["id"],
                                        'warningcode' => 'savedfailed',
                                        'message' => 'Note could not be modified');
                }
            } else {
                $warnings[] = array('item' => 'note',
                                    'itemid' => $note["id"],
                                    'warningcode' => 'badid',
                                    'message' => 'Note does not exist');
            }
        }
        return $warnings;
    }
956909
public function setNotes($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->notes !== $v) {
            $this->notes = $v;
            $this->modifiedColumns[] = RemoteAppPeer::NOTES;
        }


        return $this;
    }
717269
protected function updateNote(Note $note, $entry)
    {
        $success = true;

        $note->setValue($entry['value']);

        return $success;
    }
185282
public function addLog ( $keys, $received, $sent, $base_string, $notes, $user_id = null )
	{
		if (is_null($user_id) && isset($GLOBALS['any_auth']))
		{
			$user_id = $GLOBALS['any_auth']->getUserId();
		}
		parent::addLog($keys, $received, $sent, $base_string, $notes, $user_id);
	}
85694
public function updateAverageNote()
    {
        $commentTableName = $this->em->getClassMetadata($this->commentManager->getClass())->table['name'];
        $threadTableName = $this->em->getClassMetadata($this->getClass())->table['name'];

        $this->em->getConnection()->beginTransaction();
        $this->em->getConnection()->query(sprintf('UPDATE %s t SET t.average_note = 0', $threadTableName));

        $this->em->getConnection()->query(sprintf(
            'UPDATE %s t, (SELECT c.thread_id, avg(c.note) as avg_note FROM %s as c WHERE c.private <> 1 GROUP BY c.thread_id) as comments_note
            SET t.average_note = comments_note.avg_note
            WHERE t.id = comments_note.thread_id
            AND t.is_commentable <> 0', $threadTableName, $commentTableName));

        $this->em->getConnection()->commit();
    }