text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="NavigationAdapterBase.cs" company="Catel development team">
//   Copyright (c) 2008 - 2015 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Catel.MVVM.Navigation
{
    using System;
    using Logging;
    using Views;

    /// <summary>
    /// Navigation adapter class because everyone seems to be implementing their own :-(
    /// </summary>
    public partial class NavigationAdapter : NavigationAdapterBase
    {
        /// <summary>
        /// The log.
        /// </summary>
        private static readonly ILog Log = LogManager.GetCurrentClassLogger();

        private bool _navigationServiceInitialized;

        /// <summary>
        /// Initializes a new instance of the <see cref="NavigationAdapter" /> class.
        /// </summary>
        /// <param name="navigationTarget">The navigation target.</param>
        public NavigationAdapter(IView navigationTarget)
        {
            Argument.IsNotNull("navigationTarget", navigationTarget);

            NavigationTarget = navigationTarget;
            NavigationTargetType = navigationTarget.GetType();
            NavigationContext = new NavigationContext();

            // Listen to loaded because not every framework already has the application at this stage
            NavigationTarget.Loaded += OnNavigationTargetLoaded;
        }

        #region Properties
        /// <summary>
        /// Gets the navigation target.
        /// </summary>
        /// <value>The navigation target.</value>
        public IView NavigationTarget { get; private set; }

        /// <summary>
        /// Gets the type of the navigation target.
        /// </summary>
        /// <value>The type of the navigation target.</value>
        public Type NavigationTargetType { get; private set; }

        /// <summary>
        /// Gets the navigation context.
        /// </summary>
        /// <value>The navigation context.</value>
        public NavigationContext NavigationContext { get; private set; }
        #endregion

        #region Events
        /// <summary>
        /// Occurs when the app has navigated to this view.
        /// </summary>
        public event EventHandler<NavigatedEventArgs> NavigatedTo;

        /// <summary>
        /// Occurs when the app is about to navigate away from this view.
        /// </summary>
        public event EventHandler<NavigatingEventArgs> NavigatingAway;

        /// <summary>
        /// Occurs when the app has navigated away from this view.
        /// </summary>
        public event EventHandler<NavigatedEventArgs> NavigatedAway;
        #endregion

        #region Methods
        partial void DetermineNavigationContext();
        partial void Initialize();
        partial void Uninitialize();

        private void OnNavigationTargetLoaded(object sender, EventArgs e)
        {
            InitializeNavigationService(true);

            NavigationTarget.Loaded -= OnNavigationTargetLoaded;
        }

        private void InitializeNavigationService(bool isComingFromLoadedEvent)
        {
            if (_navigationServiceInitialized)
            {
                return;
            }

            Initialize();

            _navigationServiceInitialized = true;

            if (isComingFromLoadedEvent)
            {
                var eventArgs = new NavigatedEventArgs(string.Empty, NavigationMode.New);
                RaiseNavigatedTo(eventArgs);
            }
        }

        /// <summary>
        /// Uninitializes the navigation service.
        /// </summary>
        public void UninitializeNavigationService()
        {
            if (!_navigationServiceInitialized)
            {
                return;
            }

            Uninitialize();

            _navigationServiceInitialized = false;
        }

        /// <summary>
        /// Gets the navigation URI for the target page.
        /// </summary>
        /// <returns>System.String.</returns>
        public string GetNavigationUriForTargetPage()
        {
            return GetNavigationUri(NavigationTarget);
        }

        /// <summary>
        /// Gets the navigation target as a type.
        /// </summary>
        /// <typeparam name="T">The type of the navigation target.</typeparam>
        /// <returns>The type.</returns>
        private T GetNavigationTarget<T>()
        {
            return (T) NavigationTarget;
        }

        private void HandleNavigatedEvent(NavigatedEventArgs e)
        {
            var eventArgs = new NavigatedEventArgs(e.Uri, NavigationMode.Unknown);

            // If this navigation event is not meant for this page, exit
            if (!eventArgs.Uri.IsNavigationForView(NavigationTargetType))
            {
                // We are not navigating *to* this view, but maybe we are navigating away
                RaiseNavigatedAway(eventArgs);
                return;
            }

            if (e.Uri != null && e.Uri.IsNavigationToExternal())
            {
                Log.Debug("Navigating away from the application, ignoring navigation");
                return;
            }

            RaiseNavigatedTo(eventArgs);
        }

        /// <summary>
        /// Gets the URI without parameters, thus <c>/Pages/MyView.xaml?id=1</c> will be returned as
        /// <c>/Pages/MyView.xaml</c>/
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <returns>The URI without parameters.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="uri"/> is <c>null</c>.</exception>
        private static string GetUriWithoutParameters(Uri uri)
        {
            Argument.IsNotNull("uri", uri);

            return GetUriWithoutParameters(uri.ToString());
        }

        /// <summary>
        /// Gets the URI without parameters, thus <c>/Pages/MyView.xaml?id=1</c> will be returned as
        /// <c>/Pages/MyView.xaml</c>/
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <returns>The URI without parameters.</returns>
        /// <exception cref="ArgumentException">The <paramref name="uri"/> is <c>null</c> or whitespace.</exception>
        private static string GetUriWithoutParameters(string uri)
        {
            Argument.IsNotNullOrWhitespace("uri", uri);

            int index = uri.IndexOf("?");
            if (index != -1)
            {
                uri = uri.Substring(0, index);
            }

            // Protect for double //
            uri = uri.Replace("//", "/");

            return uri;
        }

        /// <summary>
        /// Raises the <see cref="NavigatedTo"/> event.
        /// </summary>
        /// <param name="e">The <see cref="NavigatedEventArgs"/> instance containing the event data.</param>
        protected void RaiseNavigatedTo(NavigatedEventArgs e)
        {
            if (!CanHandleNavigation())
            {
                return;
            }

            Log.Debug("Navigated to '{0}'", NavigationTargetType);

            DetermineNavigationContext();

            NavigatedTo.SafeInvoke(this, e);
        }

        /// <summary>
        /// Raises the <see cref="NavigatingAway"/> event.
        /// </summary>
        /// <param name="e">The <see cref="NavigatingEventArgs"/> instance containing the event data.</param>
        protected void RaiseNavigatingAway(NavigatingEventArgs e)
        {
            if (!CanHandleNavigation())
            {
                return;
            }

            Log.Debug("Navigating away from '{0}'", NavigationTargetType);

            NavigatingAway.SafeInvoke(this, e);

            if (!e.Cancel && e.NavigationMode == NavigationMode.Back)
            {
                Uninitialize();
            }

            if (e.Cancel)
            {
                Log.Debug("Navigating away from '{0}' was canceled", NavigationTargetType);
            }
        }

        /// <summary>
        /// Raises the <see cref="NavigatedAway"/> event.
        /// </summary>
        /// <param name="e">The <see cref="NavigatedEventArgs"/> instance containing the event data.</param>
        protected void RaiseNavigatedAway(NavigatedEventArgs e)
        {
            if (!CanHandleNavigation())
            {
                return;
            }

            Log.Debug("Navigated away from '{0}'", NavigationTargetType);

            NavigatedAway.SafeInvoke(this, e);
        }
        #endregion
    }
}


text:
#ifndef APP_USBD_CORE_H__
#define APP_USBD_CORE_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

#include "sdk_common.h"
#include "nrf_drv_usbd.h"
#include "app_usbd_types.h"
#include "app_usbd_class_base.h"

/**
 * @defgroup app_usbd_core USB Device high level library core module
 * @ingroup app_usbd
 *
 * @brief @tagAPI52840 Core module that manages current USB state and process device requests.
 * @{
 */

/**
 * @brief Core interface configuration
 *
 * Core instance would have 2 endpoints (IN0 and OUT0).
 * The interface number does not matter because it is not used.
 */
#define APP_USBD_CORE_CLASS_CONFIGURATION ((0, NRF_DRV_USBD_EPOUT0, NRF_DRV_USBD_EPIN0))

/**
 * @brief Suspend state mask
 *
 * Mask used to mark suspended state, suspended state remembers also the target state after wake up
 */
#define APP_USBD_STATE_SUSPENDED_MASK 0x80

/**
 * @brief Remove @ref APP_USBD_STATE_SUSPENDED_MASK bit from core state
 */
#define APP_USB_STATE_BASE(state) ((app_usbd_state_t)((uint32_t)(state) & (~APP_USBD_STATE_SUSPENDED_MASK)))

/**
 * @brief USB Device state
 *
 * Possible USB Device states according to specification.
 */
typedef enum
{
    APP_USBD_STATE_Disabled   = 0x00, /**< The whole USBD library is disabled */
    APP_USBD_STATE_Unattached = 0x01, /**< Device is currently not connected to the host */
    APP_USBD_STATE_Powered    = 0x02, /**< Device is connected to the host but has not been enumerated */
    APP_USBD_STATE_Default    = 0x03, /**< USB Reset condition detected, waiting for the address */
    APP_USBD_STATE_Addressed  = 0x04, /**< Device has been addressed but have not been configured */
    APP_USBD_STATE_Configured = 0x05, /**< Device is addressed and configured */

    APP_USBD_STATE_SuspendedPowered    = APP_USBD_STATE_SUSPENDED_MASK | APP_USBD_STATE_Powered,    /**< Device is Suspended and on wakeup it will return to Powered state */
    APP_USBD_STATE_SuspendedDefault    = APP_USBD_STATE_SUSPENDED_MASK | APP_USBD_STATE_Default,    /**< Device is Suspended and on wakeup it will return to Default state */
    APP_USBD_STATE_SuspendedAddressed  = APP_USBD_STATE_SUSPENDED_MASK | APP_USBD_STATE_Addressed,  /**< Device is Suspended and on wakeup it will return to Addressed state */
    APP_USBD_STATE_SuspendedConfigured = APP_USBD_STATE_SUSPENDED_MASK | APP_USBD_STATE_Configured  /**< Device is Suspended and on wakeup it will return to Configured state */
}app_usbd_state_t;

/**
 * @brief EP0 handler function pointer
 *
 * Type of the variable that would hold the pointer to the handler for
 * endpoint 0 messages processing.
 *
 * @param p_contex Context variable configured with the transmission request.
 */
typedef ret_code_t (*app_usbd_core_setup_data_handler_t)(nrf_drv_usbd_ep_status_t status,
                                                         void * p_context);

/**
 * @brief Variable type used to register EP0 transfer handler
 *
 * EP0 messages are processed by core instance.
 * Another class can register itself to receive messages from EP0 when requesting
 * for Setup data transfer.
 */
typedef struct
{
    app_usbd_core_setup_data_handler_t   handler;   //!< Event handler to be called when transmission is ready
    void                               * p_context; //!< Context pointer to be send to every called event.
} app_usbd_core_setup_data_handler_desc_t;

/*lint -save -e10 -e26 -e93 -e123 -e505 */
/**
 * @brief Declare Core instance type
 *
 * USBD core instance type definition.
 */
APP_USBD_CLASS_TYPEDEF(app_usbd_core,
        APP_USBD_CORE_CLASS_CONFIGURATION,
        APP_USBD_CLASS_INSTANCE_SPECIFIC_DEC_NONE,
        APP_USBD_CLASS_DATA_SPECIFIC_DEC_NONE);
/*lint -restore*/

/**
 * @brief Access to core instance
 *
 * Function that returns pointer to the USBD core instance.
 *
 * @return pointer to the core instance
 */
static inline app_usbd_class_inst_t const * app_usbd_core_instance_access(void)
{
    extern const APP_USBD_CLASS_INSTANCE_TYPE(app_usbd_core) app_usbd_core_inst;
    return (app_usbd_class_inst_t const *)&app_usbd_core_inst;
}

/**
 * @brief Default simple response to setup command
 *
 * This function generates default simple response.
 * It sends ZLP when required and on takes care on allowing status stage when
 * transfer is finished.
 *
 * @param p_setup Pointer to original setup message
 * @param p_data  Pointer to the response. This has to be globaly aviable data.
 * @param size    Total size of the answer - The function takes care about
 *                limiting the size of transfered data to the size required
 *                by setup command.
 */
ret_code_t app_usbd_core_setup_rsp(app_usbd_setup_t const * p_setup,
                                   void const *             p_data,
                                   size_t                   size);

/**
 * @brief Configure the handler for the nearest setup data endpoint transfer
 *
 * This function would be called on incomming setup data.
 * The correct place to set the handler for a data is when SETUP command
 * was received.
 *
 * @param ep             Endpoint number (only IN0 and OUT0) are supported.
 * @param p_handler_desc Descriptor of the handler to be called.
 *
 * @retval NRF_SUCCESS            Successfully configured
 * @retval NRF_ERROR_INVALID_ADDR Last received setup direction does not match
 *                                configured endpoint.
 */
ret_code_t app_usbd_core_setup_data_handler_set(
    nrf_drv_usbd_ep_t ep,
    app_usbd_core_setup_data_handler_desc_t const * const p_handler_desc);

/**
 * @brief Endpoint transfer
 *
 * @param ep         Endpoint number
 * @param p_transfer Description of the transfer to be performed.
 *                   The direction of the transfer is determined by the
 *                   endpoint number.
 *
 * @retval NRF_ERROR_INVALID_STATE The state of the USB device does not allow
 *                                 data transfer on the endpoint.
 *
 * @return Values returned by @ref nrf_drv_usbd_ep_transfer
 *
 * @note This function can work only if the USB is in Configured state.
 *       See @ref app_usbd_core_setup_data_transfer for transfers before
 *       device configuration is done.
 * @sa app_usbd_core_setup_data_transfer
 */
ret_code_t app_usbd_core_ep_transfer(
    nrf_drv_usbd_ep_t                                  ep,
    nrf_drv_usbd_transfer_t              const * const p_transfer);

/**
 * @brief Setup data transfer
 *
 * Function similar to @ref app_usbd_core_ep_transfer.
 * The only technical diference is that it should be used with setup transfers
 * that are going to be performed before device is configured.
 *
 * @param ep         See @ref app_usbd_core_ep_transfer.
 * @param p_transfer See @ref app_usbd_core_ep_transfer.
 *
 * @return The same values like @ref app_usbd_core_ep_transfer
 */
ret_code_t app_usbd_core_setup_data_transfer(
    nrf_drv_usbd_ep_t                                  ep,
    nrf_drv_usbd_transfer_t              const * const p_transfer);

/**
 * @brief Set up an endpoint-handled transfer.
 *
 * Configures a transfer handled by the feedback function.
 *
 * @param ep        Endpoint number.
 * @param p_handler Function called when the next chunk of data is requested.
 *
 * @retval NRF_ERROR_INVALID_STATE The state of the USB device does not allow
 *                                 data transfer on the endpoint.
 *
 * @return Values returned by @ref nrf_drv_usbd_ep_handled_transfer.
 */
ret_code_t app_usbd_ep_handled_transfer(
    nrf_drv_usbd_ep_t                         ep,
    nrf_drv_usbd_handler_desc_t const * const p_handler);

/**
 * @brief Set up a data-handled transfer.
 *
 * Function similar to @ref app_usbd_ep_handled_transfer.
 * The only technical diference is that it should be used with setup transfers
 * that are performed before the device is configured.
 *
 * @param ep        Endpoint number
 * @param p_handler Function called when the next chunk of data is requested.
 *
 * @retval NRF_ERROR_INVALID_STATE The state of the USB device does not allow
 *                                 data transfer on the endpoint.
 *
 * @return Values returned by @ref nrf_drv_usbd_ep_handled_transfer.
 */
ret_code_t app_usbd_setup_data_handled_transfer(
    nrf_drv_usbd_ep_t                         ep,
    nrf_drv_usbd_handler_desc_t const * const p_handler);

/**
 * @brief Set up a data transfer buffer.
 *
 * Returns special internal buffer that can be used in setup transfer.
 * @return Internal buffer pointer
 */
void * app_usbd_core_setup_transfer_buff_get(size_t * p_size);

/**@brief Return internal USBD core state
 *
 * @return Check @ref app_usbd_state_t to find possible USBD core states
 */
app_usbd_state_t app_usbd_core_state_get(void);

/**
 * @brief Check current feature state
 *
 * Function checks the state of the selected feature that was configured by the host.
 *
 * @param feature Feature to check.
 *                Only features related to the device should be checked by this function.
 *
 * @retval true  Selected feature is set
 * @retval false Selected feature is cleared
 */
bool app_usbd_core_feature_state_get(app_usbd_setup_stdfeature_t feature);

/** @} */

#ifdef __cplusplus
}
#endif

#endif /* APP_USBD_CORE_H__ */

redpajama_set_name: RedPajamaGithub


text:
<stix:STIX_Package
	xmlns:cyboxCommon="http://cybox.mitre.org/common-2"
	xmlns:cybox="http://cybox.mitre.org/cybox-2"
	xmlns:cyboxVocabs="http://cybox.mitre.org/default_vocabularies-2"
	xmlns:example="http://example.com"
	xmlns:incident="http://stix.mitre.org/Incident-1"
	xmlns:ttp="http://stix.mitre.org/TTP-1"
	xmlns:ta="http://stix.mitre.org/ThreatActor-1"
	xmlns:stixCommon="http://stix.mitre.org/common-1"
	xmlns:stixVocabs="http://stix.mitre.org/default_vocabularies-1"
	xmlns:stix-ciqidentity="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1"
	xmlns:stix="http://stix.mitre.org/stix-1"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xal="urn:oasis:names:tc:ciq:xal:3"
	xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3"
	xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3"
	xsi:schemaLocation="
	http://cybox.mitre.org/common-2 http://cybox.mitre.org/XMLSchema/common/2.1/cybox_common.xsd
	http://cybox.mitre.org/cybox-2 http://cybox.mitre.org/XMLSchema/core/2.1/cybox_core.xsd
	http://cybox.mitre.org/default_vocabularies-2 http://cybox.mitre.org/XMLSchema/default_vocabularies/2.1/cybox_default_vocabularies.xsd
	http://stix.mitre.org/Incident-1 http://stix.mitre.org/XMLSchema/incident/1.1.1/incident.xsd
	http://stix.mitre.org/TTP-1 http://stix.mitre.org/XMLSchema/ttp/1.1.1/ttp.xsd
	http://stix.mitre.org/ThreatActor-1 http://stix.mitre.org/XMLSchema/threat_actor/1.1.1/threat_actor.xsd
	http://stix.mitre.org/common-1 http://stix.mitre.org/XMLSchema/common/1.1.1/stix_common.xsd
	http://stix.mitre.org/default_vocabularies-1 http://stix.mitre.org/XMLSchema/default_vocabularies/1.1.1/stix_default_vocabularies.xsd
	http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1 http://stix.mitre.org/XMLSchema/extensions/identity/ciq_3.0/1.1.1/ciq_3.0_identity.xsd
	http://stix.mitre.org/stix-1 http://stix.mitre.org/XMLSchema/core/1.1.1/stix_core.xsd
	urn:oasis:names:tc:ciq:xal:3 http://stix.mitre.org/XMLSchema/external/oasis_ciq_3.0/xAL.xsd
	urn:oasis:names:tc:ciq:xnl:3 http://stix.mitre.org/XMLSchema/external/oasis_ciq_3.0/xNL.xsd
	urn:oasis:names:tc:ciq:xpil:3 http://stix.mitre.org/XMLSchema/external/oasis_ciq_3.0/xPIL.xsd" id="example:Package-37db28a7-10c8-4515-afd3-df4287f2cf49" version="1.1.1" timestamp="2014-07-11T19:40:00+00:00">
    <stix:TTPs>
        <stix:TTP id="example:ttp-ae086638-f3a4-4895-b692-3ce7f1a08b2c" timestamp="2014-12-22T16:35:37.677000+00:00" xsi:type='ttp:TTPType'>
            <ttp:Behavior>
                <ttp:Attack_Patterns>
                    <ttp:Attack_Pattern>
                        <ttp:Title>Unknown</ttp:Title>
                    </ttp:Attack_Pattern>
                </ttp:Attack_Patterns>
            </ttp:Behavior>
        </stix:TTP>
        <stix:TTP id="example:ttp-89b46125-726a-47f0-9c73-136435abaf48" timestamp="2014-12-22T16:35:37.677000+00:00" xsi:type='ttp:TTPType'>
            <ttp:Description>Notes: According to the complaint filed by ICICI Prudential, certain people have been attempting to cheat its customers by impersonating as its representatives after stealing their details, including their policy details, from the database. </ttp:Description>
        </stix:TTP>
    </stix:TTPs>
    <stix:Incidents>
        <stix:Incident id="example:incident-eaaffbb3-c532-43f6-ab84-8f8dc36bde18" timestamp="2014-07-11T19:40:00+00:00" xsi:type='incident:IncidentType'>
            <incident:Title>The customer database was stolen (method unknown). The fraudsters then made hundreds of calls to policy holders after managing to get hold of the customer database, inducing them to put money in certain accounts to avail bonus and providing wrong information about their policies among other acts.</incident:Title>
            <incident:External_ID source="VERIS">E678CD41-6D98-49AF-AFFF-288115D4C5DF</incident:External_ID>
            <incident:Time>
                <incident:Initial_Compromise precision="year">2013-01-01T00:00:00</incident:Initial_Compromise>
            </incident:Time>
            <incident:Reporter>
                <stixCommon:Identity xsi:type='stix-ciqidentity:CIQIdentity3.0InstanceType'>
                    <ExtSch:Specification xmlns:ExtSch="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1">
  <xpil:PartyName xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
    <xnl:NameLine xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3">whbaker</xnl:NameLine>
  </xpil:PartyName>
</ExtSch:Specification>
                </stixCommon:Identity>
            </incident:Reporter>
            <incident:Victim xsi:type='stix-ciqidentity:CIQIdentity3.0InstanceType'>
                <ExtSch:Specification xmlns:ExtSch="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1">
  <xpil:PartyName xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
    <xnl:NameLine xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3">ICICI PRUDENTIAL ASSET MANAGEMENT COMPANY LIMITED</xnl:NameLine>
  </xpil:PartyName>
  <xpil:Addresses xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
    <xpil:Address>
      <xal:Country xmlns:xal="urn:oasis:names:tc:ciq:xal:3">
        <xal:NameElement>IN</xal:NameElement>
      </xal:Country>
    </xpil:Address>
  </xpil:Addresses>
</ExtSch:Specification>
                <stix-ciqidentity:Role>Customer</stix-ciqidentity:Role>
            </incident:Victim>
            <incident:Affected_Assets>
                <incident:Affected_Asset>
                    <incident:Type>Unknown</incident:Type>
                    <incident:Nature_Of_Security_Effect>
                        <incident:Property_Affected>
                            <incident:Property xsi:type="stixVocabs:LossPropertyVocab-1.0">Confidentiality</incident:Property>
                            <incident:Description_Of_Effect>Personal</incident:Description_Of_Effect>
                        </incident:Property_Affected>
                        <incident:Property_Affected>
                            <incident:Property xsi:type="stixVocabs:LossPropertyVocab-1.0">Integrity</incident:Property>
                            <incident:Description_Of_Effect>Alter behavior</incident:Description_Of_Effect>
                        </incident:Property_Affected>
                    </incident:Nature_Of_Security_Effect>
                </incident:Affected_Asset>
                <incident:Affected_Asset>
                    <incident:Type>Customer</incident:Type>
                    <incident:Nature_Of_Security_Effect>
                        <incident:Property_Affected>
                            <incident:Property xsi:type="stixVocabs:LossPropertyVocab-1.0">Confidentiality</incident:Property>
                            <incident:Description_Of_Effect>Personal</incident:Description_Of_Effect>
                        </incident:Property_Affected>
                        <incident:Property_Affected>
                            <incident:Property xsi:type="stixVocabs:LossPropertyVocab-1.0">Integrity</incident:Property>
                            <incident:Description_Of_Effect>Alter behavior</incident:Description_Of_Effect>
                        </incident:Property_Affected>
                    </incident:Nature_Of_Security_Effect>
                </incident:Affected_Asset>
                <incident:Affected_Asset>
                    <incident:Type>Database</incident:Type>
                    <incident:Nature_Of_Security_Effect>
                        <incident:Property_Affected>
                            <incident:Property xsi:type="stixVocabs:LossPropertyVocab-1.0">Confidentiality</incident:Property>
                            <incident:Description_Of_Effect>Personal</incident:Description_Of_Effect>
                        </incident:Property_Affected>
                        <incident:Property_Affected>
                            <incident:Property xsi:type="stixVocabs:LossPropertyVocab-1.0">Integrity</incident:Property>
                            <incident:Description_Of_Effect>Alter behavior</incident:Description_Of_Effect>
                        </incident:Property_Affected>
                    </incident:Nature_Of_Security_Effect>
                </incident:Affected_Asset>
            </incident:Affected_Assets>
            <incident:Impact_Assessment>
                <incident:Impact_Qualification xsi:type="stixVocabs:ImpactQualificationVocab-1.0">Unknown</incident:Impact_Qualification>
            </incident:Impact_Assessment>
            <incident:Leveraged_TTPs>
                <incident:Leveraged_TTP>
                    <stixCommon:TTP idref="example:ttp-ae086638-f3a4-4895-b692-3ce7f1a08b2c" xsi:type='ttp:TTPType'/>
                </incident:Leveraged_TTP>
                <incident:Leveraged_TTP>
                    <stixCommon:TTP idref="example:ttp-89b46125-726a-47f0-9c73-136435abaf48" xsi:type='ttp:TTPType'/>
                </incident:Leveraged_TTP>
            </incident:Leveraged_TTPs>
            <incident:Attributed_Threat_Actors>
                <incident:Threat_Actor>
                    <stixCommon:Threat_Actor idref="example:threatactor-1e92d7f4-d2bc-413b-869f-77c656a45b73" xsi:type='ta:ThreatActorType'/>
                </incident:Threat_Actor>
            </incident:Attributed_Threat_Actors>
            <incident:Security_Compromise xsi:type="stixVocabs:SecurityCompromiseVocab-1.0">Yes</incident:Security_Compromise>
            <incident:Discovery_Method xsi:type="stixVocabs:DiscoveryMethodVocab-1.0">Customer</incident:Discovery_Method>
            <incident:Information_Source>
                <stixCommon:Identity>
                    <stixCommon:Name>vcdb</stixCommon:Name>
                </stixCommon:Identity>
                <stixCommon:Tools>
                    <cyboxCommon:Tool>
                        <cyboxCommon:Name>veris2stix</cyboxCommon:Name>
                        <cyboxCommon:Vendor>MITRE</cyboxCommon:Vendor>
                        <cyboxCommon:Version>0.1</cyboxCommon:Version>
                    </cyboxCommon:Tool>
                    <cyboxCommon:Tool>
                        <cyboxCommon:Name>VERIS schema</cyboxCommon:Name>
                        <cyboxCommon:Vendor>Verizon</cyboxCommon:Vendor>
                        <cyboxCommon:Version>1.3</cyboxCommon:Version>
                    </cyboxCommon:Tool>
                </stixCommon:Tools>
                <stixCommon:References>
                    <stixCommon:Reference>http://www.thehindubusinessline.com/industry-and-economy/banking/rs-90-lakh-worth-icici-prudential-customer-database-stolen-police-probe-on/article4566931.ece</stixCommon:Reference>
                </stixCommon:References>
            </incident:Information_Source>
        </stix:Incident>
    </stix:Incidents>
    <stix:Threat_Actors>
        <stix:Threat_Actor id="example:threatactor-1e92d7f4-d2bc-413b-869f-77c656a45b73" timestamp="2014-12-22T16:35:37.677000+00:00" xsi:type='ta:ThreatActorType'>
            <ta:Identity xsi:type='stix-ciqidentity:CIQIdentity3.0InstanceType'>
                <ExtSch:Specification xmlns:ExtSch="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1">
  <xpil:Addresses xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
    <xpil:Address>
      <xal:Country xmlns:xal="urn:oasis:names:tc:ciq:xal:3">
        <xal:NameElement>Unknown</xal:NameElement>
      </xal:Country>
    </xpil:Address>
  </xpil:Addresses>
</ExtSch:Specification>
            </ta:Identity>
            <ta:Type timestamp="2014-12-22T16:35:37.677000+00:00">
                <stixCommon:Value>Unknown</stixCommon:Value>
            </ta:Type>
            <ta:Motivation timestamp="2014-12-22T16:35:37.677000+00:00">
                <stixCommon:Value xsi:type="stixVocabs:MotivationVocab-1.1">Financial or Economic</stixCommon:Value>
            </ta:Motivation>
            <ta:Observed_TTPs>
                <ta:Observed_TTP>
                    <stixCommon:TTP idref="example:ttp-ae086638-f3a4-4895-b692-3ce7f1a08b2c" xsi:type='ttp:TTPType'/>
                </ta:Observed_TTP>
                <ta:Observed_TTP>
                    <stixCommon:TTP idref="example:ttp-89b46125-726a-47f0-9c73-136435abaf48" xsi:type='ttp:TTPType'/>
                </ta:Observed_TTP>
            </ta:Observed_TTPs>
        </stix:Threat_Actor>
    </stix:Threat_Actors>
</stix:STIX_Package>


text:
var fs = require('fs');
var http = require('http');

fs.readFile('builtInModules.js', 'utf8',
    function(error, fileText) {
        if (error) {
            console.log('File cannot be read: ' + error);
            return;
        }

        console.log(fileText);
    });

http.createServer(function (request, response) {
    response.writeHead(200);
    response.write('Zdrasti!');
    response.end();
}).listen(1234);

console.log('Server running on port 1234...')


text:
import re
from decorator import decorator
from ..utils import is_app
from ..shells import shell

@decorator
def git_support(fn, command):
    """Resolves git aliases and supports testing for both git and hub."""
    # supports GitHub's `hub` command
    # which is recommended to be used with `alias git=hub`
    # but at this point, shell aliases have already been resolved
    if not is_app(command, 'git', 'hub'):
        return False

    # perform git aliases expansion
    if 'trace: alias expansion:' in command.output:
        search = re.search("trace: alias expansion: ([^ ]*) => ([^\n]*)",
                           command.output)
        alias = search.group(1)

        # by default git quotes everything, for example:
        #     'commit' '--amend'
        # which is surprising and does not allow to easily test for
        # eg. 'git commit'
        expansion = ' '.join(shell.quote(part)
                             for part in shell.split_command(search.group(2)))
        new_script = command.script.replace(alias, expansion)

        command = command.update(script=new_script)

    return fn(command)


text:
<Type Name="MultilineAttribute" FullName="MonoTouch.Dialog.MultilineAttribute">
  <TypeSignature Language="C#" Value="public class MultilineAttribute : Attribute" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MultilineAttribute extends System.Attribute" />
  <AssemblyInfo>
    <AssemblyName>MonoTouch.Dialog-1</AssemblyName>
    <AssemblyVersion>0.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Attribute</BaseTypeName>
  </Base>
  <Interfaces />
  <Attributes>
    <Attribute>
      <AttributeName>System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.All, Inherited=false)</AttributeName>
    </Attribute>
  </Attributes>
  <Docs>
    To be added.
    <remarks>To be added.</remarks>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public MultilineAttribute ();" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
      <MemberType>Constructor</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Parameters />
      <Docs>
        To be added.
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
  </Members>
</Type>


text:
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>Hello World!</title>
    <meta charset="utf-8"/>
    <script src="storage.js"></script>
    <script>
        $ = jQuery = require('./vendor/jquery/jquery-2.1.4.js');
    </script>
    <script src="vendor/editor.md/editormd.js"></script>
    <!--editor.md-->
    <link rel="stylesheet" href="vendor/editor.md/css/editormd.min.css"/>
</head>
<body>
<!-- Load the editor -->
<div id="editormd" style="height: 600px">
        <textarea style="display:none;">Hello Editor.md ![mie~](images/until-u.png)
        </textarea>
</div>
<script>
    $(function () {
        var editor = editormd("editormd", {
            path: "./vendor/editor.md/lib/", // Autoload modules mode, codemirror, marked... dependents libs path
            width: "90%",
            height: 640,
            imageUpload: true,
            imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
            imageUploadURL: "./php/upload.php"
        });
    });
</script>
</body>
</html>


text:
module CFPropertyList
  # XML parser
  class XML < ParserInterface
    # read a XML file
    # opts::
    # * :file - The filename of the file to load
    # * :data - The data to parse
    def load(opts)
      if(opts.has_key?(:file)) then
        doc = LibXML::XML::Document.file(opts[:file],:options => LibXML::XML::Parser::Options::NOBLANKS|LibXML::XML::Parser::Options::NOENT)
      else
        doc = LibXML::XML::Document.string(opts[:data],:options => LibXML::XML::Parser::Options::NOBLANKS|LibXML::XML::Parser::Options::NOENT)
      end

      root = doc.root.first
      return import_xml(root)
    end

    # serialize CFPropertyList object to XML
    # opts = {}:: Specify options: :formatted - Use indention and line breaks
    def to_str(opts={})
      doc = LibXML::XML::Document.new

      doc.root = LibXML::XML::Node.new('plist')
      doc.encoding = LibXML::XML::Encoding::UTF_8

      doc.root['version'] = '1.0'
      doc.root << opts[:root].to_xml()

      # ugly hack, but there's no other possibility I know
      str = doc.to_s(:indent => opts[:formatted])
      str1 = String.new
      first = false
      str.each_line do
        |line|
        str1 << line
        unless(first) then
          str1 << "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" if line =~ /^\s*<\?xml/
        end

        first = true
      end

      return str1
    end

    protected

    # get the value of a DOM node
    def get_value(n)
      return n.first.content if n.children?
      return n.content
    end

    # import the XML values
    def import_xml(node)
      ret = nil

      case node.name
      when 'dict'
        hsh = Hash.new
        key = nil

        if node.children? then
          node.children.each do
            |n|
            next if n.text? # avoid a bug of libxml

            if n.name == "key" then
              key = get_value(n)
            else
              raise CFFormatError.new("Format error!") if key.nil?
              hsh[key] = import_xml(n)
              key = nil
            end
          end
        end

        ret = CFDictionary.new(hsh)

      when 'array'
        ary = Array.new

        if node.children? then
          node.children.each do
            |n|
            ary.push import_xml(n)
          end
        end

        ret = CFArray.new(ary)

      when 'true'
        ret = CFBoolean.new(true)
      when 'false'
        ret = CFBoolean.new(false)
      when 'real'
        ret = CFReal.new(get_value(node).to_f)
      when 'integer'
        ret = CFInteger.new(get_value(node).to_i)
      when 'string'
        ret = CFString.new(get_value(node))
      when 'data'
        ret = CFData.new(get_value(node))
      when 'date'
        ret = CFDate.new(CFDate.parse_date(get_value(node)))
      end

      return ret
    end
  end
end

# eof


text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <memory>

namespace vespalib {

/**
 * abstract interface for an iterable sequence.
 **/
template <typename T>
struct Sequence
{
    typedef std::unique_ptr<Sequence> UP;

    virtual bool valid() const = 0;
    virtual T get() const = 0;
    virtual void next() = 0;
    virtual ~Sequence() {}
};

} // namespace vespalib


text:
<?php

/**
 * @category   Spark
 * @package    Spark_Controller
 * @copyright  Copyright (c) 2010 Christoph Hochstrasser
 * @license    MIT License
 */
abstract class Spark_Controller_ActionController implements Spark_Controller_Controller
{
  protected $_request;
  protected $_response;

  /**
   * Gets called by the Front Controller on dispatch
   *
   * @param  Spark_Controller_RequestInterface $request
   * @param  Zend_Controller_Response_Abstract $response
   * @return void
   */
  public function execute(
    Zend_Controller_Request_Abstract  $request,
    Zend_Controller_Response_Abstract $response
  )
  {
    $this->beforeFilter($request, $response);

    $action = $request->getActionName();

    if($action == null) {
      $action = "index";
    }

    $this->_request = $request;
    $this->_response = $response;

    $method = str_replace(" ", "", ucwords(str_replace("_", " ", str_replace("-", " ", strtolower($action)))));
    $method[0] = strtolower($method[0]);

    $method = $action . "Action";

    if(!method_exists($this, $method)) {
      $controller = get_class($this);
      throw new Spark_Controller_Exception("The action {$action} was not found in
        the controller {$controller}. Please make sure the method {$method} exists.", 404);
    }

    $this->$method($request, $response);

    $this->afterFilter($request, $response);
  }

  public function beforeFilter($request, $response)
  {}

  public function afterFilter($request, $response)
  {}

  protected function _forward(Spark_Controller_RequestInterface $request)
  {
    $request->setDispatched(false);
  }

}


text:
<!DOCTYPE html >

          <title>SecurityConfiguration - Computation Engine Core API, version 1.3-SNAPSHOT - com.cyrusinnovation.computation.SecurityConfiguration</title>
          <meta name="description" content="SecurityConfiguration - Computation Engine Core API version 1.3 - SNAPSHOT - com.cyrusinnovation.computation.SecurityConfiguration" />
          <meta name="keywords" content="SecurityConfiguration Computation Engine Core API version 1.3 SNAPSHOT com.cyrusinnovation.computation.SecurityConfiguration" />
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

      <link href="../../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
      <link href="../../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />

com.cyrusinnovation.computation

SecurityConfiguration

        trait

        SecurityConfiguration extends AnyRef

Establishes the location of the Java SecurityManager policy file, as well as the packages
to be allowed in computations. Individual classes within those classes may be blacklisted.

          Linear Supertypes

AnyRef, Any

            Known Subclasses

DefaultSecurityConfiguration

<input id="mbrsel-input" type="text" accesskey="/" />

              Ordering

Alphabetic

By inheritance

                Inherited

SecurityConfiguration

AnyRef

Any

Hide All

Show all

            Learn more about member selection

            Visibility

Public

All

Value Members

        final
        def

        !=(arg0: Any): Boolean

Definition Classes

AnyRef → Any

        final
        def

        ##(): Int

Definition Classes

AnyRef → Any

        final
        def

        ==(arg0: Any): Boolean

Definition Classes

AnyRef → Any

        def

        allowedPackageNames: Set[String]

Specifies a set of package names that will be allowed in computations.

Specifies a set of package names that will be allowed in computations. Provides a default
set with a focus on allowing only classes that have no side effects.

        final
        def

        asInstanceOf[T0]: T0

Definition Classes

Any

        def

        blacklistedFullyQualifiedClassNames: Set[String]

Specifies a set of fully-qualified class names that will not be allowed in computations.

Specifies a set of fully-qualified class names that will not be allowed in computations. It is
only necessary to blacklist a class if the containing package is whitelisted. Provides a default
set with a focus on allowing only classes that have no side effects.

        def

        clone(): AnyRef

Attributes

protected[java.lang]

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        final
        def

        eq(arg0: AnyRef): Boolean

Definition Classes

AnyRef

        def

        equals(arg0: Any): Boolean

Definition Classes

AnyRef → Any

        def

        finalize(): Unit

Attributes

protected[java.lang]

Definition Classes

AnyRef

Annotations

                @throws(

      classOf[java.lang.Throwable]
    )

        final
        def

        getClass(): Class[_]

Definition Classes

AnyRef → Any

        def

        hashCode(): Int

Definition Classes

AnyRef → Any

        final
        def

        isInstanceOf[T0]: Boolean

Definition Classes

Any

        final
        def

        ne(arg0: AnyRef): Boolean

Definition Classes

AnyRef

        final
        def

        notify(): Unit

Definition Classes

AnyRef

        final
        def

        notifyAll(): Unit

Definition Classes

AnyRef

        def

        securityPolicyURI: String

Specifies the value to be assigned to the "java.security.policy" System property that
indicates the name and location of the policy file for the Java SecurityManager.

        final
        def

        synchronized[T0](arg0: ⇒ T0): T0

Definition Classes

AnyRef

        def

        toString(): String

Definition Classes

AnyRef → Any

        final
        def

        wait(): Unit

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        final
        def

        wait(arg0: Long, arg1: Int): Unit

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        final
        def

        wait(arg0: Long): Unit

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

Inherited from AnyRef

Inherited from Any

Ungrouped


text:
using namespace std;

typedef double Elem_T;

//*****START FRAMEWORK*****

//*****VERTEX OBJECT*****
struct vertexSubset {
  long n, m;
  uintE* s;
  bool* d;
  bool isDense;

  // make a singleton vertex in range of n
vertexSubset(long _n, intE v)
: n(_n), m(1), d(NULL), isDense(0) {
  s = newA(uintE,1);
  s[0] = v;
}

  //empty vertex set
vertexSubset(long _n) : n(_n), m(0), d(NULL), s(NULL), isDense(0) {}
  // make vertexSubset from array of vertex indices
  // n is range, and m is size of array
vertexSubset(long _n, long _m, uintE* indices)
: n(_n), m(_m), s(indices), d(NULL), isDense(0) {}
  // make vertexSubset from boolean array, where n is range
vertexSubset(long _n, bool* bits)
: n(_n), d(bits), s(NULL), isDense(1)  {
  m = sequence::sum(bits,_n); }
  // make vertexSubset from boolean array giving number of true values
vertexSubset(long _n, long _m, bool* bits)
: n(_n), m(_m), s(NULL), d(bits), isDense(1)  {}

  // delete the contents
  void del(){
    if (d != NULL) free(d);
    if (s != NULL) free(s);
  }
  long numRows() { return n; }
  long numNonzeros() { return m; }
  bool isEmpty() { return m==0; }

  // converts to dense but keeps sparse representation if there
  void toDense() {
    if (d == NULL) {
      d = newA(bool,n);
      {parallel_for(long i=0;i<n;i++) d[i] = 0;}
      {parallel_for(long i=0;i<m;i++) d[s[i]] = 1;}
    }
    isDense = true;
  }

  // converts to sparse but keeps dense representation if there
  void toSparse() {
    if (s == NULL) {
      _seq<uintE> R = sequence::packIndex<uintE>(d,n);
      if (m != R.n) {
	cout << "bad stored value of m" << endl;
	cout << "m: " << m <<  endl;
	abort();
      }
      s = R.A;
    }
    isDense = false;
  }
  // check for equality
  bool eq (vertexSubset& b) {
    toDense();
    b.toDense();
    bool* c = newA(bool,n);
    {parallel_for (long i=0; i<b.n; i++)
	c[i] = (d[i] != b.d[i]);}
    bool equal = (sequence::sum(c,n) == 0);
    free(c);
    return equal;
  }

  void print() {
    if (isDense) {
      cout << "D:";
      for (long i=0;i<n;i++) if (d[i]) cout << i << " ";
      cout << endl;
    } else {
      cout << "S:";
      for (long i=0; i<m; i++)	cout << s[i] << " ";
      cout << endl;
    }
  }
};

struct nonMaxF{bool operator() (uintE &a) {return (a != UINT_E_MAX);}};

//options to edgeMap for different versions of dense edgeMap (default is DENSE)
enum options { DENSE, DENSE_FORWARD};

//remove duplicate integers in [0,...,n-1]
void remDuplicates(uintE* indices, uintE* flags, long m, long n) {
  //make flags for first time
  if(flags == NULL) {flags = newA(uintE,n);
    {parallel_for(long i=0;i<n;i++) flags[i]=UINT_E_MAX;}}
  {parallel_for(uintE i=0;i<m;i++)
      if(indices[i] != UINT_E_MAX && flags[indices[i]] == UINT_E_MAX)
	CAS(&flags[indices[i]],(uintE)UINT_E_MAX,i);
  }
  //reset flags
  {parallel_for(long i=0;i<m;i++){
      if(indices[i] != UINT_E_MAX){
	if(flags[indices[i]] == i){ //win
	  flags[indices[i]] = UINT_E_MAX; //reset
	}
	else indices[i] = UINT_E_MAX; //lost
      }
    }
  }
}

//*****EDGE FUNCTIONS*****
template <class F, class vertex>
  bool* recursiveEdgeMapDense(graph<vertex> GA, bool* vertexSubset, F f, bool parallel = 0) {
#ifdef DEBUG
  cout << "inside recrusiveEdgeMapDense" << endl;
#endif
  long numVertices = GA.n;
  vertex *G = GA.V;
  bool* next = newA(bool,numVertices);

#ifdef BITVECTOR
  int bit_vector_length = numVertices / 32;
  if(numVertices % 32 != 0)
    bit_vector_length++;
  unsigned int* vertexSubsetBit = (unsigned int*) _mm_malloc(sizeof(unsigned int) * bit_vector_length, 64);

  // reset all bits of the bit vector
  for(int i = 0; i < bit_vector_length; i++)
    vertexSubsetBit[i] = 0;

  parallel_for(int i = 0; i < numVertices; i+=32){
    int start = i;
    int end = (((i + 32) < numVertices)? (i+32):numVertices);
    for(int j = start; j < end; j++){
      if (vertexSubset[j])
	Set_Bit_Only(vertexSubsetBit, j);
    }
  }
#endif

#ifdef BITVECTOR
  cilk_spawn recursiveEdgeMapDenseHelper(GA, 0, numVertices-1, vertexSubsetBit, f, next);
#else
  cilk_spawn recursiveEdgeMapDenseHelper(GA, 0, numVertices-1, vertexSubset, f, next);
#endif

  //process the last node
  next[numVertices-1] = 0;
  if (f.cond(numVertices-1)){
    for(int j = 0; j < GA.V[numVertices-1].getInDegree(); j++){
      uintE ngh = GA.V[numVertices-1].getInNeighbor(j);
#ifdef DEBUG1
      cout << "node: " << (numVertices-1) << " ngh: " << ngh << endl;
#endif
#ifndef WEIGHTED

#ifdef BITVECTOR
      if (Check_Bit(vertexSubsetBit, ngh) && f.update(ngh,(numVertices-1)))
#else
	if (vertexSubset[ngh] && f.update(ngh,(numVertices-1)))
#endif

#else

#ifdef BITVECTOR
	if (Check_Bit(vertexSubsetBit, ngh) && f.update(ngh,(numVertices-1),GA.V[(numVertices-1)].getInWeight(j)))
#else
	  if (vertexSubset[ngh] && f.update(ngh,(numVertices-1),GA.V[(numVertices-1)].getInWeight(j)))
#endif
#endif
      next[(numVertices-1)] = 1;
      if(!f.cond((numVertices-1))) break;
    }
  }
  cilk_sync;
  return next;
}

template <class F, class vertex>

#ifdef BITVECTOR
  void recursiveEdgeMapDenseHelper(graph<vertex> GA, int start, int end, unsigned int * vertexSubsetBit, F f, bool *next, int edgeGrainSize = 4096){
#else
void recursiveEdgeMapDenseHelper(graph<vertex> GA, int start, int end, bool * vertexSubset, F f, bool *next, int edgeGrainSize = 4096){
#endif

#ifdef DEBUG1
  cout << "start: " << start << " end: " << end << endl;
#endif

  long diff = reinterpret_cast<long>((GA.V[end].getInNeighbors() - GA.V[start].getInNeighbors()));
#ifdef DEBUG1
  cout << "diff: " << diff << endl;
#endif
  if ((start == end -1) || (diff < edgeGrainSize)){
    for (int i = start; i < end; i++){
      next[i] = 0;
      if (f.cond(i)){
	for(int j = 0; j < GA.V[i].getInDegree(); j++){
	  uintE ngh = GA.V[i].getInNeighbor(j);
#ifdef DEBUG1
	  cout << "node: " << i << " ngh: " << ngh << endl;
#endif

#ifndef WEIGHTED
	  // if (vertexSubset[ngh] && f.update(ngh,i))

#ifdef BITVECTOR
	  if (Check_Bit(vertexSubsetBit, ngh) && f.update(ngh, i))
#else
	    if (vertexSubset[ngh] && f.update(ngh, i))
#endif

#else
	    //if (vertexSubset[ngh] && f.update(ngh,i,GA.V[i].getInWeight(j)))
#ifdef BITVECTOR
	    if (Check_Bit(vertexSubsetBit, ngh) && f.update(ngh,i,GA.V[i].getInWeight(j)))
#else
	      if (vertexSubset[ngh] && f.update(ngh,i,GA.V[i].getInWeight(j)))
#endif

#endif
	      next[i] = 1;
	  if(!f.cond(i)) break;
	}
      }
    }
  } else {
#ifdef BITVECTOR
	cilk_spawn recursiveEdgeMapDenseHelper(GA, start, start + ((end-start)>>1), vertexSubsetBit, f, next, edgeGrainSize);
	recursiveEdgeMapDenseHelper(GA, start + ((end-start)>>1), end, vertexSubsetBit, f, next, edgeGrainSize);
#else
cilk_spawn recursiveEdgeMapDenseHelper(GA, start, start + ((end-start)>>1), vertexSubset, f, next, edgeGrainSize);
	recursiveEdgeMapDenseHelper(GA, start + ((end-start)>>1), end, vertexSubset, f, next, edgeGrainSize);
#endif
  }
}

template <class F, class vertex>
  bool* edgeMapDense(graph<vertex> GA, bool* vertexSubset, F f, bool parallel = 0) {
#ifdef DEBUG
  cout << "inside EdgeMapDense" << endl;
  int vertexSubsetCalls = 0;
  int vertexSubsetSuc = 0;
  int vertexUpdateSuc = 0;
#endif

  long numVertices = GA.n;
  vertex *G = GA.V;
  bool* next = newA(bool,numVertices);

#ifdef BITVECTOR
int bit_vector_length = numVertices / 32;
  if(numVertices % 32 != 0)
    bit_vector_length++;
  unsigned int* vertexSubsetBit = (unsigned int*) _mm_malloc(sizeof(unsigned int) * bit_vector_length, 64);

  // reset all bits of the bit vector
  for(int i = 0; i < bit_vector_length; i++)
    vertexSubsetBit[i] = 0;

  parallel_for(int i = 0; i < numVertices; i+=32){
    int start = i;
    int end = (((i + 32) < numVertices)? (i+32):numVertices);
    for(int j = start; j < end; j++){
      if (vertexSubset[j])
	Set_Bit_Only(vertexSubsetBit, j);
    }
  }
#endif

  {parallel_for (long i=0; i<numVertices; i++){
    next[i] = 0;
    if (f.cond(i)) {
      uintE d = G[i].getInDegree();
      if(!parallel || d < 1000) {
	for(uintE j=0; j<d; j++){
	  uintE ngh = G[i].getInNeighbor(j);
#ifdef DEBUG1
	  cout << "node: " << i <<  " ngh: " << ngh << endl;
#endif

#ifdef DEBUG
      vertexSubsetCalls++;
#endif

#ifndef WEIGHTED

#ifndef BITVECTOR
      if (vertexSubset[ngh]){
#else
	if (Check_Bit(vertexSubsetBit, ngh)){
#endif

#ifdef DEBUG
	  vertexSubsetSuc++;
#endif
	  if(f.update(ngh,i)) {

#ifdef DEBUG
	  vertexUpdateSuc++;
#endif

#else
	  if (vertexSubset[ngh] & f.update(ngh,i,G[i].getInWeight(j))){
#endif
	    next[i] = 1;
	    if(!f.cond(i)) break;
#ifndef WEIGHTED
	  }
#endif
	  }
	  }//end if parallel
      } else {
	{parallel_for(uintE j=0; j<d; j++){
	  uintE ngh = G[i].getInNeighbor(j);
#ifndef WEIGHTED
	  if (vertexSubset[ngh] && f.update(ngh,i))
#else
	  if (vertexSubset[ngh] && f.update(ngh,i,G[i].getInWeight(j)))
#endif
	    next[i] = 1;
	  }}
      }
    }
    }}

#ifdef DEBUG
cout << "calls to vertexSubset: " << vertexSubsetCalls << endl;
cout << "calls to subset sucess: " << vertexSubsetSuc << endl;
cout << "calls to update: " << vertexUpdateSuc << endl;

 cout << "calls to subset sucess ratio: " << vertexSubsetSuc/(double)vertexSubsetCalls << endl;
 cout << "calls to update: " << vertexUpdateSuc/(double)vertexSubsetSuc << endl;
#endif

#ifdef DEBUG1
  cout << "next " << endl;
  for (int i = 0; i < numVertices; i++) {
    cout << next[i] << " " ;
  }
  cout << endl;
#endif
  return next;
}

template <class F, class vertex>
bool* edgeMapDenseForward(graph<vertex> GA, bool* vertexSubset, F f) {
#ifdef DEBUG1
  cout << "inside EdgeMapDenseForward" << endl;
#endif
  long numVertices = GA.n;
  vertex *G = GA.V;
  bool* next = newA(bool,numVertices);
  {parallel_for(long i=0;i<numVertices;i++) next[i] = 0;}
  {parallel_for (long i=0; i<numVertices; i++){
    if (vertexSubset[i]) {
      uintE d = G[i].getOutDegree();
      if(d < 1000) {
	for(uintE j=0; j<d; j++){
	  uintE ngh = G[i].getOutNeighbor(j);
#ifndef WEIGHTED
	  if (f.cond(ngh) && f.updateAtomic(i,ngh))
#else
	  if (f.cond(ngh) && f.updateAtomic(i,ngh,G[i].getOutWeight(j)))
#endif
	    next[ngh] = 1;
	}
      }
      else {
	{parallel_for(uintE j=0; j<d; j++){
	  uintE ngh = G[i].getOutNeighbor(j);
#ifndef WEIGHTED
	  if (f.cond(ngh) && f.updateAtomic(i,ngh))
#else
	    if (f.cond(ngh) && f.updateAtomic(i,ngh,G[i].getOutWeight(j)))
#endif
	  next[ngh] = 1;
	  }}
      }
    }
    }}
  return next;
}

template <class F, class vertex>
pair<long,uintE*> edgeMapSparse(vertex* frontierVertices, uintE* indices,
				uintT* degrees, uintT m, F f,
				long remDups=0, uintE* flags=NULL) {
#ifdef DEBUG
  cout << "inside EdgeMapSparse" << endl;
#endif
  uintT* offsets = degrees;
  long outEdgeCount = sequence::plusScan(offsets, degrees, m);
  uintE* outEdges = newA(uintE,outEdgeCount);
  {parallel_for (long i = 0; i < m; i++) {
      uintT v = indices[i], o = offsets[i];
    vertex vert = frontierVertices[i];
    uintE d = vert.getOutDegree();
    if(d < 1000) {
      for (uintE j=0; j < d; j++) {
	uintE ngh = vert.getOutNeighbor(j);
#ifndef WEIGHTED
	if(f.cond(ngh) && f.updateAtomic(v,ngh))
#else
	if(f.cond(ngh) && f.updateAtomic(v,ngh,vert.getOutWeight(j)))
#endif
	  outEdges[o+j] = ngh;
	else outEdges[o+j] = UINT_E_MAX;
      }
    } else {
      {parallel_for (uintE j=0; j < d; j++) {
	uintE ngh = vert.getOutNeighbor(j);
#ifndef WEIGHTED
	if(f.cond(ngh) && f.updateAtomic(v,ngh))
#else
	if(f.cond(ngh) && f.updateAtomic(v,ngh,vert.getOutWeight(j)))
#endif
	  outEdges[o+j] = ngh;
	else outEdges[o+j] = UINT_E_MAX;
	}}
    }
    }}
  uintE* nextIndices = newA(uintE, outEdgeCount);
  if(remDups) remDuplicates(outEdges,flags,outEdgeCount,remDups);
  // Filter out the empty slots (marked with -1)
  long nextM = sequence::filter(outEdges,nextIndices,outEdgeCount,nonMaxF());
  free(outEdges);
  return pair<long,uintE*>(nextM, nextIndices);
}

static int edgesTraversed = 0;

// decides on sparse or dense base on number of nonzeros in the active vertices
template <class F, class vertex>
vertexSubset edgeMap(graph<vertex> GA, vertexSubset &V, F f, intT threshold = -1,
      char option=DENSE, bool remDups=false) {
  long numVertices = GA.n, numEdges = GA.m;
  if(threshold == -1) threshold = numEdges/20; //default threshold
  vertex *G = GA.V;
  long m = V.numNonzeros();
  if (numVertices != V.numRows()) {
    cout << "edgeMap: Sizes Don't match" << endl;
    abort();
  }

  #ifdef DEBUG1
  cout << "Inside edgeMap" << endl;
  #endif

  // used to generate nonzero indices to get degrees
  uintT* degrees = newA(uintT, m);
  vertex* frontierVertices;
  V.toSparse();
  frontierVertices = newA(vertex,m);
  {parallel_for (long i=0; i < m; i++){
    vertex v = G[V.s[i]];
    degrees[i] = v.getOutDegree();
    frontierVertices[i] = v;
    }}
  uintT outDegrees = sequence::plusReduce(degrees, m);
  edgesTraversed += outDegrees;
  if (outDegrees == 0) return vertexSubset(numVertices);
  if (m + outDegrees > threshold) {
    V.toDense();
    free(degrees);
    free(frontierVertices);
    bool* R;
    if (option == DENSE_FORWARD) {
	R = edgeMapDenseForward(GA,V.d,f);
	} else {
      //checking the overhead in switching between push and pull
      //nextTime("before edgemapdense");
      //startTime();

#ifndef RECURSIVE
	R = edgeMapDense(GA, V.d, f, option);
#else
	R = recursiveEdgeMapDense(GA, V.d, f, option);
#endif
	//nextTime("after edgemapdense");

      }
    vertexSubset v1 = vertexSubset(numVertices, R);
    //cout << "size (D) = " << v1.m << endl;
    return  v1;
  } else {
    pair<long,uintE*> R =
      remDups ?
      edgeMapSparse(frontierVertices, V.s, degrees, V.numNonzeros(), f,
		    numVertices, GA.flags) :
      edgeMapSparse(frontierVertices, V.s, degrees, V.numNonzeros(), f);
    //cout << "size (S) = " << R.first << endl;
    free(degrees);
    free(frontierVertices);
    return vertexSubset(numVertices, R.first, R.second);
  }
}

//*****VERTEX FUNCTIONS*****

//Note: this is the optimized version of vertexMap which does not
//perform a filter
template <class F>
void vertexMap(vertexSubset V, F add) {
  long n = V.numRows(), m = V.numNonzeros();
  if(V.isDense) {
    {parallel_for(long i=0;i<n;i++)
	if(V.d[i]) add(i);}
  } else {
    {parallel_for(long i=0;i<m;i++)
	add(V.s[i]);}
  }
}

//Note: this is the version of vertexMap in which only a subset of the
//input vertexSubset is returned
template <class F>
vertexSubset vertexFilter(vertexSubset V, F filter) {
  long n = V.numRows(), m = V.numNonzeros();
  V.toDense();
  bool* d_out = newA(bool,n);
  {parallel_for(long i=0;i<n;i++) d_out[i] = 0;}
  {parallel_for(long i=0;i<n;i++)
      if(V.d[i]) d_out[i] = filter(i);}
  return vertexSubset(n,d_out);
}

//cond function that always returns true
inline bool cond_true (intT d) { return 1; }

template<class vertex>
void Compute(graph<vertex>&, commandLine);

int parallel_main(int argc, char* argv[]) {
  commandLine P(argc,argv," [-s] <inFile>");
  char* iFile = P.getArgument(0);
  bool symmetric = P.getOptionValue("-s");
  bool binary = P.getOptionValue("-b");
  long rounds = P.getOptionLongValue("-rounds",3);
  if(symmetric) {
    graph<symmetricVertex> G =
      readGraph<symmetricVertex>(iFile,symmetric,binary); //symmetric graph
    Compute(G,P);
#ifdef PROFILE
    ofstream outputFile;
    outputFile.open("./.ready");
    outputFile.close();
    cout << "continue?" << "\n";
    int c = getchar();
#endif
    for(int r=0;r<rounds;r++) {
      startTime();
      Compute(G,P);
      nextTime("Running time");
    }
    G.del();
  } else {
    graph<asymmetricVertex> G =
      readGraph<asymmetricVertex>(iFile,symmetric,binary); //asymmetric graph
    Compute(G,P);
    if(G.transposed) G.transpose();
#ifdef PROFILE
    ofstream outputFile;
    outputFile.open("./.ready");
    outputFile.close();
    cout << "continue?" << "\n";
    int c = getchar();
#endif
    for(int r=0;r<rounds;r++) {
      #ifndef BENCHMARK
      startTime();
      #endif
      Compute(G,P);
      #ifndef BENCHMARK
      nextTime("Running time");
      #endif
      if(G.transposed) G.transpose();
    }
    G.del();
  }
}
#endif


text: export { default } from './TimeTable';


text:
package com.amazonaws.services.elasticmapreduce.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.elasticmapreduce.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * InstanceGroupModifyConfig JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class InstanceGroupModifyConfigJsonUnmarshaller implements Unmarshaller<InstanceGroupModifyConfig, JsonUnmarshallerContext> {

    public InstanceGroupModifyConfig unmarshall(JsonUnmarshallerContext context) throws Exception {
        InstanceGroupModifyConfig instanceGroupModifyConfig = new InstanceGroupModifyConfig();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL) {
            return null;
        }

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("InstanceGroupId", targetDepth)) {
                    context.nextToken();
                    instanceGroupModifyConfig.setInstanceGroupId(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("InstanceCount", targetDepth)) {
                    context.nextToken();
                    instanceGroupModifyConfig.setInstanceCount(context.getUnmarshaller(Integer.class).unmarshall(context));
                }
                if (context.testExpression("EC2InstanceIdsToTerminate", targetDepth)) {
                    context.nextToken();
                    instanceGroupModifyConfig.setEC2InstanceIdsToTerminate(new ListUnmarshaller<String>(context.getUnmarshaller(String.class))

                    .unmarshall(context));
                }
                if (context.testExpression("ShrinkPolicy", targetDepth)) {
                    context.nextToken();
                    instanceGroupModifyConfig.setShrinkPolicy(ShrinkPolicyJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("ReconfigurationType", targetDepth)) {
                    context.nextToken();
                    instanceGroupModifyConfig.setReconfigurationType(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("Configurations", targetDepth)) {
                    context.nextToken();
                    instanceGroupModifyConfig.setConfigurations(new ListUnmarshaller<Configuration>(ConfigurationJsonUnmarshaller.getInstance())

                    .unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return instanceGroupModifyConfig;
    }

    private static InstanceGroupModifyConfigJsonUnmarshaller instance;

    public static InstanceGroupModifyConfigJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new InstanceGroupModifyConfigJsonUnmarshaller();
        return instance;
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Ramalina bigeniculata B. de Lesd.

### Remarks
null