Add a reference to another users bare jid to a stanza.

@param stanza stanza.
@param begin start index of the mention in the messages body.
@param end end index of the mention in the messages body.
@param jid referenced jid.
330848
public static void addMention(Stanza stanza, int begin, int end, BareJid jid) {
        URI uri;
        try {
            uri = new URI("xmpp:" + jid.toString());
        } catch (URISyntaxException e) {
            throw new AssertionError("Cannot create URI from bareJid.");
        }
        ReferenceElement reference = new ReferenceElement(begin, end, ReferenceElement.Type.mention, null, uri);
        stanza.addExtension(reference);
    }
172548
protected void processStart(Endpoint endpoint, EventTypeEnum eventType) {
        if (!sendLifecycleEvent) {
            return;
        }

        Event event = createEvent(endpoint, eventType);
        queue.add(event);
    }
1081376
public void add(final int currentArticleID, final long startTime,
			final long endTime, final List<ArticleIndexData> infoList)
	{

		// index_articleID_rc_ts
		if (!infoList.isEmpty()) {

			StringBuilder fullRevBuffer = new StringBuilder();
			StringBuilder revCountBuffer = new StringBuilder();

			boolean first = true;
			ArticleIndexData info;
			while (!infoList.isEmpty()) {

				info = infoList.remove(0);

				if (!first) {
					fullRevBuffer.append(" ");
					revCountBuffer.append(" ");
				}

				fullRevBuffer.append(info.getFullRevisionPrimaryKey());

				revCountBuffer.append(info.getStartRevisionCount());
				revCountBuffer.append(" ");
				revCountBuffer.append(info.getEndRevisionCount());

				first = false;
			}

			boolean sql = !insertStatement.isEmpty();
			if (buffer.length() + fullRevBuffer.length()
					+ revCountBuffer.length() + 20 >= MAX_ALLOWED_PACKET) {
				storeBuffer();
			}


			if(sql) {
				if (buffer.length() > insertStatement.length()) {
					buffer.append(",");
				}
				buffer.append("(");
			}
			buffer.append(currentArticleID);
			buffer.append(",");
			buffer.append(sql?"\'":"\"");
			buffer.append(fullRevBuffer);
			buffer.append(sql?"\'":"\"");
			buffer.append(",");
			buffer.append(sql?"\'":"\"");
			buffer.append(revCountBuffer);
			buffer.append(sql?"\'":"\"");
			buffer.append(",");
			buffer.append(startTime);
			buffer.append(",");
			buffer.append(endTime);
			if(sql) {
				buffer.append(")");
			}else{
				buffer.append("\n");
			}
		}
	}
806963
public TranscriptSequence addTranscript(AccessionID accession, int begin, int end) throws Exception {
		if (transcriptSequenceHashMap.containsKey(accession.getID())) {
			throw new Exception("Duplicate accesion id " + accession.getID());
		}
		TranscriptSequence transcriptSequence = new TranscriptSequence(this, begin, end);
		transcriptSequence.setAccession(accession);
		transcriptSequenceHashMap.put(accession.getID(), transcriptSequence);
		return transcriptSequence;
	}
1096501
function AddrRange(begin, end) {
  begin = _toAddr(begin);
  end = _toAddr(end);

  if (begin.compare(end) > 0) {
    throw new Error('begin address must be <= end address');
  }

  this._begin = begin;
  this._end = end;
}
720830
@Reference(service = ServerStarted.class,
               policy = ReferencePolicy.DYNAMIC,
               cardinality = ReferenceCardinality.OPTIONAL,
               policyOption = ReferencePolicyOption.GREEDY)
    protected void setServerStarted(ServiceReference<ServerStarted> ref) {
        // set will be called when the ServerStarted service has been registered (by the FeatureManager as of 9/2015).  This is a signal that that
        // the server is fully started.  Therefore we can signal such things as the TCP Channel Accept logic to start accepting connections, if the
        // channel has been configured to do that.

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "Server Completely Started signal received");
        }

        synchronized (syncStarted) {
            serverCompletelyStarted = true;
            syncStarted.notifyAll();
        }
    }
33209
@Reference(service = Application.class,
               cardinality = ReferenceCardinality.MULTIPLE,
               policy = ReferencePolicy.DYNAMIC,
               target = "(application.state=STARTED)")
    protected void addStartedApplication(ServiceReference<Application> ref) {
        ExecutorService executor;
        String appName = (String) ref.getProperty(NAME);
        Set<Runnable> tasks;
        lock.writeLock().lock();
        try {
            executor = this.executor;
            appStates.put(appName, ApplicationState.STARTED);
            tasks = deferredTasks.remove(appName);
        } finally {
            lock.writeLock().unlock();
        }

        if (tasks != null)
            for (Runnable task : tasks)
                executor.submit(task);
    }
141364
@Override
	public void addEndpoint(T endpoint) {
		if (endpoints.length == 0) {
			endpoints = new Endpoint[1];
			endpoints[0] = endpoint;
		} else {
			for (int i = 0; i < endpoints.length; i++) {
				if (endpoints[i].equals(endpoints)) {

					// Already registered
					return;
				}
			}

			// Add to array
			Endpoint[] copy = new Endpoint[endpoints.length + 1];
			System.arraycopy(endpoints, 0, copy, 0, endpoints.length);
			copy[endpoints.length] = endpoint;
			endpoints = copy;
		}

		// Remove from cache
		endpointCache.remove(endpoint.getNodeID());
	}
924795
public void initiateCleanUp(String destinationUuid)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "initiateCleanUp", destinationUuid);

    DestinationHandler destinationHandler = null;

    try
    {
      destinationHandler = destinationManager.getDestination(new SIBUuid12(destinationUuid), true);
    }
    catch (SINotPossibleInCurrentConfigurationException e)
    {
      // No FFDC code needed
      //do nothing            
    } 
    catch (SITemporaryDestinationNotFoundException e)
    {
      // No FFDC code needed 
      //do nothing            
    }   
    
    if (destinationHandler != null)
    {
      destinationManager.markDestinationAsCleanUpPending(destinationHandler);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "initiateCleanUp");
      
    return;
  }
91521
@Override
	public void begin() throws TransactionManagementException {
		logger.entering(CLASSNAME, "begin");
		status = 0; // javax.transaction.Status.STATUS_ACTIVE
		logger.log(Level.FINE, "javax.transaction.Status.ACTIVE: {0}", status);
		logger.exiting(CLASSNAME, "begin");
	}
1142152
public void addJmsBrokers(Jms[] jmses) {
		for (Jms jms : jmses) {
			final JmsDefinition jmsDefinition = new JmsDefinition(jms.connectionFactoryName());
			jmsDefinition.addQueues(jms.queues());
			jmsDefinition.addTopics(jms.topics());
			this.jmsDefinitions.add(jmsDefinition);
		}
	}
176358
def add_subscription_from(jid)
      unless contact = contact(jid)
        contact = Contact.new(:jid => jid)
        @roster << contact
      end
      contact.subscribe_from
    end
862500
def subscribe(&blk)
      pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'subscribe')
      connection.send_stanza pres, &blk
    end
267346
static public void register (EndPoint endPoint) {
		Kryo kryo = endPoint.getKryo();
		kryo.register(RegisterName.class);
		kryo.register(String[].class);
		kryo.register(UpdateNames.class);
		kryo.register(ChatMessage.class);
	}
683574
public void send(TCQueryRequest event) throws TCAPSendException {

        if (this.previewMode)
            return;

        if (this.state != TRPseudoState.Idle) {
            throw new TCAPSendException("Can not send Begin in this state: " + this.state);
        }

        if (!this.isStructured()) {
            throw new TCAPSendException("Unstructured dialogs do not use Begin");
        }
        try {
            this.dialogLock.lock();
            this.idleTimerActionTaken = true;
            restartIdleTimer();
            TCQueryMessageImpl tcbm = (TCQueryMessageImpl) TcapFactory.createTCQueryMessage();

            // build DP
            tcbm.setDialogTermitationPermission(event.getDialogTermitationPermission());
            tcbm.setOriginatingTransactionId(Utils.encodeTransactionId(this.localTransactionId, this.isSwapTcapIdBytes));

            if (event.getApplicationContextName() != null || event.getConfidentiality() != null
                    || event.getSecurityContext() != null || event.getUserInformation() != null) {
                this.dpSentInBegin = true;
                this.lastACN = event.getApplicationContextName();
                if (event.getUserInformation() != null) {
                    this.lastUI = event.getUserInformation();
                }

                DialogPortion dp = TcapFactory.createDialogPortion();
                dp.setProtocolVersion(TcapFactory.createProtocolVersionFull());
                dp.setApplicationContext(event.getApplicationContextName());
                dp.setUserInformation(event.getUserInformation());
                dp.setSecurityContext(event.getSecurityContext());
                dp.setConfidentiality(event.getConfidentiality());

                tcbm.setDialogPortion(dp);

                if (this.provider.getStack().getStatisticsEnabled()) {
                    if (event.getApplicationContextName() != null) {
                        String acn = ((ApplicationContextImpl) event.getApplicationContextName()).getStringValue();
                        this.provider.getStack().getCounterProviderImpl().updateOutgoingDialogsPerApplicatioContextName(acn);
                    } else {
                        this.provider.getStack().getCounterProviderImpl().updateOutgoingDialogsPerApplicatioContextName("");
                    }
                }
            }

            // now comps
            if (this.scheduledComponentList.size() > 0) {
                Component[] componentsToSend = new Component[this.scheduledComponentList.size()];
                this.prepareComponents(componentsToSend);
                tcbm.setComponent(componentsToSend);
            }

            AsnOutputStream aos = new AsnOutputStream();
            try {
                tcbm.encode(aos);
                this.setState(TRPseudoState.InitialSent);
                if (this.provider.getStack().getStatisticsEnabled()) {
                    this.provider.getStack().getCounterProviderImpl().updateTcQuerySentCount(this);
                }
                this.provider.send(aos.toByteArray(), event.getReturnMessageOnError(), this.remoteAddress, this.localAddress,
                        this.seqControl, this.getNetworkId(), this.localSsn);
                this.scheduledComponentList.clear();
            } catch (Throwable e) {
                if (logger.isEnabledFor(Level.ERROR)) {
                    logger.error("Failed to send message: ", e);
                }
                throw new TCAPSendException("Failed to send TC-Query message: " + e.getMessage(), e);
            }

        } finally {
            this.dialogLock.unlock();
        }
    }
1374259
def begin(self, service_endpoint):
        """"""
        if self.store is None:
            assoc = None
        else:
            assoc = self._getAssociation(service_endpoint)

        request = AuthRequest(service_endpoint, assoc)
        request.return_to_args[self.openid1_nonce_query_arg_name] = mkNonce()

        if request.message.isOpenID1():
            request.return_to_args[self.openid1_return_to_identifier_name] = \
                request.endpoint.claimed_id

        return request
638714
public static String insert(final String str, final String given, final int begin, final int end) {
    if (begin < 1 || end > str.length() || end < begin) { return str; }
    return str.substring(0, begin - 1) + given + str.substring(end);
  }