text:
M.core_message = M.core_message || {};

M.core_message.init_focus = function(Y, eid) {
    document.getElementById(eid).focus();
};

M.core_message.init_refresh_page = function(Y, delay, url) {
    var delay_callback = function() {
        document.location.replace(url);
    };
    setTimeout(delay_callback, delay);
};

M.core_message.combinedsearchgotfocus = function(e) {
    if (e.target.get('value')==this.defaultsearchterm) {
        e.target.select();
    }
};

M.core_message.init_defaultoutputs = function(Y) {
    var defaultoutputs = {

        init : function() {
            Y.all('#defaultmessageoutputs select').each(function(node) {
                // attach event listener
                node.on('change', defaultoutputs.changeState);
                // set initial layout
                node.simulate("change");
            }, this);

            Y.all('#defaultmessageoutputs input.messagedisable').each(function(node) {
                // Attach event listener
                node.on('change', defaultoutputs.changeProviderState);
                node.simulate("change");
            }, this);
        },

        changeState : function(e) {
            var value = e.target._node.options[e.target.get('selectedIndex')].value;
            var parentnode = e.target.ancestor('td');
            switch (value) {
            case 'forced':
                defaultoutputs.updateCheckboxes(parentnode, 1, 1);
                break;
            case 'disallowed':
                defaultoutputs.updateCheckboxes(parentnode, 1, 0);
                break;
            case 'permitted':
                defaultoutputs.updateCheckboxes(parentnode, 0, 0);
                break;
            }
        },

        updateCheckboxes : function(blocknode, disabled, checked) {
            blocknode.all('input[type=checkbox]').each(function(node) {
                node.removeAttribute('disabled');
                if (disabled) {
                    node.setAttribute('disabled', 1)
                    node.removeAttribute('checked');
                }
                if (checked) {
                    node.setAttribute('checked', 1)
                }
            }, this);
        },

        changeProviderState : function(e) {
            var isenabled = e.target.get('checked') || undefined;
            var parentnode = e.target.ancestor('tr');
            if (!isenabled) {
                parentnode.all('select').each(function(node) {
                    node.set('value', 'disallowed');
                    node.setAttribute('disabled', 1);
                    defaultoutputs.updateCheckboxes(node.ancestor('td'), 1, 0);
                }, this);
                parentnode.addClass('dimmed_text');
            } else {
                parentnode.all('select[disabled]').each(function(node) {
                    node.removeAttribute('disabled');
                    node.set('value', 'permitted');
                    defaultoutputs.updateCheckboxes(node.ancestor('td'), 0, 0);
                }, this);
                parentnode.removeClass('dimmed_text');
            }
        }
    }

    defaultoutputs.init();
}

M.core_message.init_editsettings = function(Y) {
    var editsettings = {

        init : function() {
            var disableall = Y.one(".disableallcheckbox");
            disableall.on('change', editsettings.changeState);
            disableall.simulate("change");
        },

        changeState : function(e) {
            Y.all('.notificationpreference').each(function(node) {
                var disabled = e.target.get('checked');

                node.removeAttribute('disabled');
                if (disabled) {
                    node.setAttribute('disabled', 1)
                }
            }, this);
        }
    }

    editsettings.init();
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mycologia 32: 616 (1940)

#### Original name
Phialea sejournei Boud., 1881

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Xunit;

namespace System.Security.Permissions.Tests
{
    public class CodeGroupTests
    {
        [Fact]
        public static void FileCodeGroupCallMethods()
        {
            Policy.FileCodeGroup fcg = new Policy.FileCodeGroup(new Policy.GacMembershipCondition(), new FileIOPermissionAccess());
            Policy.CodeGroup cg = fcg.Copy();
            bool equals = fcg.Equals(new object());
            int hash = fcg.GetHashCode();
            Policy.PolicyStatement ps = fcg.Resolve(new Policy.Evidence());
            cg = fcg.ResolveMatchingCodeGroups(new Policy.Evidence());
        }
        [Fact]
        public static void FirstMatchCodeGroupCallMethods()
        {
            Policy.FirstMatchCodeGroup fmcg = new Policy.FirstMatchCodeGroup(new Policy.GacMembershipCondition(), new Policy.PolicyStatement(new PermissionSet(new PermissionState())));
            Policy.CodeGroup cg = fmcg.Copy();
            Policy.PolicyStatement ps = fmcg.Resolve(new Policy.Evidence());
            cg = fmcg.ResolveMatchingCodeGroups(new Policy.Evidence());
        }
        [Fact]
        public static void NetCodeGroupCallMethods()
        {
            Policy.NetCodeGroup ncg = new Policy.NetCodeGroup(new Policy.GacMembershipCondition());
            string teststring = Policy.NetCodeGroup.AbsentOriginScheme;
            teststring = Policy.NetCodeGroup.AnyOtherOriginScheme;
            ncg.AddConnectAccess("test", new Policy.CodeConnectAccess("test", 0));
            Policy.CodeGroup cg = ncg.Copy();
            bool equals = ncg.Equals(new object());
            System.Collections.DictionaryEntry[] de = ncg.GetConnectAccessRules();
            int hash = ncg.GetHashCode();
            ncg.ResetConnectAccess();
            Policy.PolicyStatement ps = ncg.Resolve(new Policy.Evidence());
            cg = ncg.ResolveMatchingCodeGroups(new Policy.Evidence());
        }
        [Fact]
        public static void UnionCodeGroupCallMethods()
        {
            Policy.UnionCodeGroup ucg = new Policy.UnionCodeGroup(new Policy.GacMembershipCondition(), new Policy.PolicyStatement(new PermissionSet(new PermissionState())));
            Policy.CodeGroup cg = ucg.Copy();
            Policy.PolicyStatement ps = ucg.Resolve(new Policy.Evidence());
            cg = ucg.ResolveMatchingCodeGroups(new Policy.Evidence());
        }
    }
}


text:
<?php
if (!class_exists("ResponsiveGallery")) {
	class ResponsiveGallery {
		public function __construct($galleryId, $db) {
			$this->id = $galleryId;
			$this->db = $db;
		}

		public function render() {
			$imageResults = $this->getImages();
			$gallerySetting = $this->getGallery();
			$galleryPanels = "";

			foreach($imageResults as $image)
			{
				$title = ($image->title == null) ? "" : $image->title;
				$description = ($image->description == null || $image->description == "") ? "" : "
".$image->description."
";
				$galleryPanels .= "
imagePath."\" alt=\"".$title."\" />".$description."
";
			}
			$options = get_option('reflex_gallery_options');
			$options = $options[1];
			$gallery = "
name."\" data-dShadow=\"".$options['thumbnail_dShadow']."\">
thumbwidth."\" data-height=\"".$gallerySetting->thumbheight."\">".$galleryPanels."

";

			return $gallery;
		}

		public function getImages() {
			$images = $this->db->getImagesByGalleryId($this->id);
			return $images;
		}

		public function getGallery() {
			$gallery = $this->db->getGalleryById($this->id);
			return $gallery;
		}
	}
}
?>


text:
var gradleSystem = require('./gradleSystem');
var mavenSystem = require('./mavenSystem');

var exports = {};

exports.getSystem = function (system) {
  switch (system) {
    case 'settings.gradle':
    case 'build.gradle':
      return gradleSystem;
    case 'pom.xml':
      return mavenSystem;
    default :
      return null;
  }
};

module.exports = exports;


text:
<?php

/**
 * Mageflow_Connect_Block_Adminhtml_Pullgrid_Grid_Column_Renderer
 *
 * @category   MFX
 * @package    Mageflow_Connect
 * @subpackage Block
 * @author     Prototypely Ltd, Estonia <info@prototypely.com>
 * @copyright  Copyright © 2017 Prototypely Ltd, Estonia (http://prototypely.com)
 * @license MIT Copyright (c) 2017 Prototypely Ltd
 * @link       http://mageflow.com/
 */
class Mageflow_Connect_Block_Adminhtml_Pull_Grid_Column_Renderer
    extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
    /**
     * render
     *
     * @param Varien_Object $row
     *
     * @return string
     */
    public function render(Varien_Object $row)
    {
        return $row->getContent();
    }

}


text: git clone https://github.com/buuug7/game4039.git


text:
package org.horizontaldb.shard;

import java.util.HashMap;
import java.util.Map;

/*
 * Configuration for the sharded data source access machinery. The client id will be propagated to the Hibernate
 * framework in case the method is decorated with the Transactional annotation. DataSourceType will be propagated to dao
 * resolvers and can be used for further type refinements. The clientId is immutable, dataSourceType is mutable.
 */
public class ShardContext {
    private String clientId;
    private DataSourceType dataSourceType;
    private Map<Class<?>, Object> beans = new HashMap<>( );

    public ShardContext( String clientId ) {
        this( clientId, null );
    }

    public ShardContext( String clientId, DataSourceType dataSourceType ) {
        this.clientId = clientId;
        this.dataSourceType = dataSourceType;
    }

    public String getClientId() {
        return clientId;
    }

    public DataSourceType getDataSourceType() {
        return dataSourceType;
    }

    @SuppressWarnings( "unchecked" )
    public <T> T getBean( Class<T> beanClass ) {
        T retval = ( T ) beans.get( beanClass );

        return retval;
    }

    public void setBean( Class<?> beanClass, Object bean ) {
        beans.put( beanClass, bean );
    }

    @Override
    public String toString() {
        return "ShardContext [clientId=" + clientId + ", dataSourceType=" + dataSourceType + "]";
    }

}


text:
package com.kale.kalewaterfall.mode;

public class PhotosList{

	public int favorite_count;
	public String msg;
	public Photo photo;
}


text:
==================================
OT-2 Python Protocol API Version 2
==================================

The OT-2 Python Protocol API is a simple Python framework designed to make writing automated biology lab protocols easy.

We've designed it in a way we hope is accessible to anyone with basic Python and wetlab skills. As a bench scientist, you should be able to code your automated protocols in a way that reads like a lab notebook.

Version 2 of the API is a new way to write Python protocols. It is more reliable, simpler, and better able to be supported. Unlike version 1, it has support for new modules like the Thermocycler. While version 1 will still recieve bug fixes, new features and improvements will land in version 2. For a guide on transitioning your protocols from version 1 to version 2 of the API, see `this article on migration <http://support.opentrons.com/en/articles/3425727-switching-your-protocols-from-api-version-1-to-version-2>`_. For a more in-depth discussion of why version 2 of the API was developed and what is different about it compared to version 1, see `this article on why we wrote API V2 <http://support.opentrons.com/en/articles/3418212-opentrons-protocol-api-version-2>`_.

**********************

Getting Started
---------------

New to Python? Check out our :ref:`writing` page first before continuing. To get a sense of the typical structure of our scripts, take a look at our :ref:`new-examples` page.

To simulate protocols on your laptop, check out :ref:`simulate-block`. When you're ready to run your script on a robot, download our latest `desktop app <https://www.opentrons.com/ot-app>`_.

Troubleshooting
---------------

If you encounter problems using our products please take a look at our `support docs <https://support.opentrons.com/en/>`_ or contact our team via intercom on our website at `opentrons.com <https://opentrons.com>`_.

*****************

.. _overview-section-v2:

Overview
--------

How it Looks
++++++++++++

The design goal of this API is to make code readable and easy to understand. For example, below is a short set of instructions to transfer from well ``'A1'`` to well ``'B1'`` that even a computer could understand:

.. pull-quote::

    This protocol is by me; it's called Opentrons Protocol Tutorial and is used for demonstrating the OT-2 Python Protocol API. It uses version 2.0 of this API.

    Begin the protocol

    Add a 96 well plate, and place it in slot '2' of the robot deck

    Add a 300 µL tip rack, and place it in slot '1' of the robot deck

    Add a single-channel 300 µL pipette to the left mount, and tell it to use that tip rack

    Transfer 100 µL from the plate's 'A1' well to its 'B2' well

If we were to rewrite this with the Python Protocol API, it would look like the following:

.. code-block:: python
    :substitutions:

    from opentrons import protocol_api

    # metadata
    metadata = {
        'protocolName': 'My Protocol',
        'author': 'Name <email@address.com>',
        'description': 'Simple protocol to get started using OT2',
        'apiLevel': '|apiLevel|'
    }

    # protocol run function. the part after the colon lets your editor know
    # where to look for autocomplete suggestions
    def run(protocol: protocol_api.ProtocolContext):

        # labware
        plate = protocol.load_labware('corning_96_wellplate_360ul_flat', '2')
        tiprack = protocol.load_labware('opentrons_96_tiprack_300ul', '1')

        # pipettes
        left_pipette = protocol.load_instrument(
             'p300_single', 'left', tip_racks=[tiprack])

        # commands
        left_pipette.pick_up_tip()
        left_pipette.aspirate(100, plate['A1'])
        left_pipette.dispense(100, plate['B2'])
        left_pipette.drop_tip()

How it's Organized
++++++++++++++++++

When writing protocols using the Python Protocol API, there are generally five sections:

1) Metadata and Version Selection
2) Run function
3) Labware
4) Pipettes
5) Commands

Metadata and Version Selection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Metadata is a dictionary of data that is read by the server and returned to client applications (such as the Opentrons App). Most metadata is not needed to run a protocol, but if present can help the Opentrons App display additional data about the protocol currently being executed. These optional (but recommended) fields are (``"protocolName"``, ``"author"``, and ``"description"``).

The required element of the metadata is ``"apiLevel"``. This must contain a string specifying the major and minor version of the Python Protocol API that your protocol is designed for. For instance, a protocol written for version 2.0 of the Python Protocol API (only launch version of the Protocol API should have in its metadata ``"apiLevel": "2.0"``.

For more information on Python Protocol API versioning, see :ref:`v2-versioning`.

The Run Function and the Protocol Context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Protocols are structured around a function called ``run(protocol)``, defined in code like this:

.. code-block:: python
    :substitutions:

   from opentrons import protocol_api

   metadata = {'apiLevel': '|apiLevel|'}

   def run(protocol: protocol_api.ProtocolContext):
       pass

This function must be named exactly ``run`` and must take exactly one mandatory argument (its name doesn't matter, but we recommend ``protocol`` since this argument represents the protocol that the robot will execute).

The function ``run`` is the container for the code that defines your protocol.

The object ``protocol`` is the *protocol context*, which represents the robot and its capabilities. It is always an instance of the :py:class:`opentrons.protocol_api.contexts.ProtocolContext` class (though you'll never have to instantiate one yourself - it is always passed in to ``run()``), and it is tagged as such in the example protocol to allow most editors to give you autocomplete.

The protocol context has two responsibilities:

1) Remember, track, and check the robot's state
2) Expose the functions that make the robot execute actions

The protocol context plays the same role as the ``robot``, ``labware``, ``instruments``, and ``modules`` objects in past versions of the API, with one important difference: it is only one object; and because it is passed in to your protocol rather than imported, it is possible for the API to be much more rigorous about separating simulation from reality.

The key point is that there is no longer any need to ``import opentrons`` at the top of every protocol, since the *robot* now *runs the protocol*, rather than the *protocol running the robot*. The example protocol imports the definition of the protocol context to provide editors with autocomplete sources.

Labware
^^^^^^^

The next step is defining the labware required for your protocol. You must tell the protocol context about what should be present on the deck, and where. You tell the protocol context about labware by calling the method ``protocol.load_labware(name, slot)`` and saving the result.

The name of a labware is a string that is different for each kind of labware. You can look up labware to add to your protocol on the Opentrons `Labware Library <https://labware.opentrons.com>`_.

The slot is the labelled location on the deck in which you've placed the labware. The available slots are numbered from 1-11.

Our example protocol above loads

* a `Corning 96 Well Plate <https://labware.opentrons.com/corning_96_wellplate_360ul_flat>`_ in slot 2:

.. code-block:: python

   plate = protocol.load_labware('corning_96_wellplate_360ul_flat', 2)

* an `Opentrons 300µL Tiprack <https://labware.opentrons.com/opentrons_96_tiprack_300ul>`_ in slot 1:

.. code-block:: python

   tiprack = protocol.load_labware('opentrons_96_tiprack_300ul', 1)

These labware can be referenced later in the protocol as ``plate`` and ``tiprack`` respectively. Check out `the Python docs <https://docs.python.org/3/index.html>`_ for further clarification on using variables effectively in your code.

You can find more information about handling labware in the :ref:`new-labware` section.

Pipettes
^^^^^^^^

After defining labware, you define the instruments required for your protocol. You tell the protocol context about which pipettes should be attached, and which slot they should be attached to, by calling the method ``protocol.load_instrument(model, mount, tip_racks)`` and saving the result.

The ``model`` of the pipette is the kind of pipette that should be attached; the ``mount`` is either ``"left"`` or ``"right"``; and ``tip_racks`` is a list of the objects representing tip racks that this instrument should use. Specifying ``tip_racks`` is optional, but if you don't then you'll have to manually specify where the instrument should pick up tips from every time you try and pick up a tip.

See :ref:`new-pipette` for more information on creating and working with pipettes.

Our example protocol above loads a P300 Single-channel pipette (``'p300_single'``) in the left mount (``'left'``), and uses the Opentrons 300 µL tiprack we loaded previously as a source of tips (``tip_racks=[tiprack]``).

Commands
^^^^^^^^

Once the instruments and labware required for the protocol are defined, the next step is to define the commands that make up the protocol. The most common commands are ``aspirate()``, ``dispense()``, ``pick_up_tip()``, and ``drop_tip()``. These and many others are described in the :ref:`v2-atomic-commands` and :ref:`v2-complex-commands` sections, which go into more detail about the commands and how they work. These commands typically specify which wells of which labware to interact with, using the labware you defined earlier, and are methods of the instruments you created in the pipette section. For instance, in our example protocol, you use the pipette you defined to:

1) Pick up a tip (implicitly from the tiprack you specified in slot 1 and assigned to the pipette): ``pipette.pick_up_tip()``
2) Aspirate 100 µL from well A1 of the 96 well plate you specified in slot 2: ``pipette.aspirate(100, plate['A1'])``
3) Dispense 100 µL into well A2 of the 96 well plate you specified in slot 2: ``pipette.dispense(100, plate['A2'])``
4) Drop the tip (implicitly into the trash at the back right of the robot's deck): ``pipette.drop_tip()``

****************

Feature Requests
----------------

Have an interesting idea or improvement for our software? Create a ticket on GitHub by following these `guidelines.`__

__ https://github.com/Opentrons/opentrons/blob/edge/CONTRIBUTING.md#opening-issues

Developer's guide
-----------------

Do you want to contribute to our open-source API? You can find more information on how to be involved `here.`__

__ https://github.com/Opentrons/opentrons/blob/edge/CONTRIBUTING.md

.. toctree::

    writing
    versioning
    new_labware
    new_modules
    new_pipette
    new_atomic_commands
    new_complex_commands
    new_protocol_api
    new_examples
    new_advanced_running


text:
(function (root) {

  if( !root.$ ) {
    return;
  }

  var jq = root.$,
      jDoc = jq(document),
      pluginCache = {},
      pluginsAre = {},
      pluginsFilterCache = {};

  function filter (list, iteratee) {
    var result = [], n = 0;

    for( var i = 0, len = list.length; i < len ; i++ ) {
      if( iteratee(list[i]) ) {
        result[n++] = list[i];
      }
    }

    return jq(result);
  }

  function pluginSelectorFilter (pluginSelector) {
    if( !pluginsFilterCache[pluginSelector] ) {
      pluginsFilterCache[pluginSelector] = function (el) {
        el.$$plugins = el.$$plugins || {};
        if( !el.$$plugins[pluginSelector] ) {
          el.$$plugins[pluginSelector] = true;
          return true;
        }
      };
    }
    return pluginsFilterCache[pluginSelector];
  }

  function runPlugin (target, pluginSelector) {
    var handler = pluginCache[pluginSelector],
        elements = filter( jq(pluginSelector), pluginSelectorFilter(pluginSelector) );

    if( handler && elements.length ) {
      if( handler._collection ) {
        handler( elements );
      } else {
        elements.each(handler);
      }
    }
  }

  function initPlugin () {
    pluginsAre.loading = true;
    jq(function () {
      for( var pluginSelector in pluginCache ) {
        runPlugin(document, pluginSelector);
      }

      jq(document.body).on('DOMSubtreeModified', function (event) {
        for( var pluginSelector in pluginCache ) {
          runPlugin(event.target, pluginSelector);
        }
      });

      delete pluginsAre.loading;
      pluginsAre.running = true;
    });
  }

  jq.plugin = function (selector, handler, collection) {
    if( typeof selector !== 'string' || !(handler instanceof Function) ) {
      throw new Error('required selector (string) and handler (function)');
      return;
    }

    pluginCache[selector] = handler;
    pluginCache[selector]._collection = !!collection;

    if( pluginsAre.loading ) {
      return;
    }

    if( pluginsAre.running ) {
      runPlugin(document, selector);
    } else {
      initPlugin();
    }
  };

  // widgets

  var widgets = {},
      widgetsAre = {};

  function missingWidget () {
    if( this.$$plugins && this.$$plugins['[data-widget]'] ) {
      delete this.$$plugins['[data-widget]'];
    }
  }

  function initWidget () {
    widgetsAre.loading = true;
    jq(function () {
      jq.plugin('[data-widget]', function () {
        ( widgets[this.getAttribute('data-widget')] || missingWidget ).call(this);
      });
      delete widgetsAre.loading;
      widgetsAre.running = true;
    });
  };

  jq.widget = function (widgetName, handler) {
    if( typeof widgetName === 'string' && handler instanceof Function ) {

      widgets[widgetName] = handler;

      if( widgetsAre.loading ) {
        return;
      }

      if( widgetsAre.running ) {
        jq('[data-widget="' + widgetName + '"]').each(handler);
      } else {
        initWidget();
      }
    }
  };

})(this);


text:
namespace ndnboost{
namespace intrusive{
   //Create namespace to avoid compilation errors
}}

namespace ndnboost{ namespace container{ namespace container_detail{

namespace bi = ndnboost::intrusive;

}}}

#include <utility>
#include <memory>
#include <functional>
#include <iosfwd>
#include <string>

/// @endcond

//////////////////////////////////////////////////////////////////////////////
//                             Containers
//////////////////////////////////////////////////////////////////////////////

namespace ndnboost {
namespace container {

//vector class
template <class T
         ,class Allocator = std::allocator<T> >
class vector;

//vector class
template <class T
         ,class Allocator = std::allocator<T> >
class stable_vector;

//vector class
template <class T
         ,class Allocator = std::allocator<T> >
class deque;

//list class
template <class T
         ,class Allocator = std::allocator<T> >
class list;

//slist class
template <class T
         ,class Allocator = std::allocator<T> >
class slist;

//set class
template <class Key
         ,class Compare  = std::less<Key>
         ,class Allocator = std::allocator<Key> >
class set;

//multiset class
template <class Key
         ,class Compare  = std::less<Key>
         ,class Allocator = std::allocator<Key> >
class multiset;

//map class
template <class Key
         ,class T
         ,class Compare  = std::less<Key>
         ,class Allocator = std::allocator<std::pair<const Key, T> > >
class map;

//multimap class
template <class Key
         ,class T
         ,class Compare  = std::less<Key>
         ,class Allocator = std::allocator<std::pair<const Key, T> > >
class multimap;

//flat_set class
template <class Key
         ,class Compare  = std::less<Key>
         ,class Allocator = std::allocator<Key> >
class flat_set;

//flat_multiset class
template <class Key
         ,class Compare  = std::less<Key>
         ,class Allocator = std::allocator<Key> >
class flat_multiset;

//flat_map class
template <class Key
         ,class T
         ,class Compare  = std::less<Key>
         ,class Allocator = std::allocator<std::pair<Key, T> > >
class flat_map;

//flat_multimap class
template <class Key
         ,class T
         ,class Compare  = std::less<Key>
         ,class Allocator = std::allocator<std::pair<Key, T> > >
class flat_multimap;

//basic_string class
template <class CharT
         ,class Traits = std::char_traits<CharT>
         ,class Allocator  = std::allocator<CharT> >
class basic_string;

//! Type used to tag that the input range is
//! guaranteed to be ordered
struct ordered_range_t
{};

//! Type used to tag that the input range is
//! guaranteed to be ordered and unique
struct ordered_unique_range_t
   : public ordered_range_t
{};

//! Value used to tag that the input range is
//! guaranteed to be ordered
static const ordered_range_t ordered_range = ordered_range_t();

//! Value used to tag that the input range is
//! guaranteed to be ordered and unique
static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t();

/// @cond

namespace detail_really_deep_namespace {

//Otherwise, gcc issues a warning of previously defined
//anonymous_instance and unique_instance
struct dummy
{
   dummy()
   {
      (void)ordered_range;
      (void)ordered_unique_range;
   }
};

}  //detail_really_deep_namespace {

/// @endcond

}}  //namespace ndnboost { namespace container {

#endif //#ifndef NDNBOOST_CONTAINER_CONTAINER_FWD_HPP


text:
<!doctype html>

  <link rel="stylesheet" href="stylesheets/reset.css">
  <link rel="stylesheet" href="stylesheets/site.css">
  <link href='http://fonts.googleapis.com/css?family=Bangers' rel='stylesheet' type='text/css'>
  <link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
  <link href="http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
  <title>Tommy Dugger</title>

          Home
          Blog
          About
          DBC
          Resources

July 3rd - 2014 : Asking Good Questions

            We've all then there.  Asking questions on some forum because we can't quite solve the problem we're stuck on.
            I've asked several questions on stackoverflow now and I can attest that getting answers to a poorly worded question
            or a question which is lacking information is near impossible.

            It can be frustrating reaching out to the community for help to only get snarky responses or worse no response at
            all.  It can also be a little embarrassing to ask a question to only find the answer in another post minutes later.

            It's important as developers to develop our question asking skills as they often make the difference between getting
            positive, quick responses to our questions that help us grow and gain knowledge.  In today's post we're going to
            dive into the topic of asking good and correct questions.

            Continue Reading

July 1st - 2014 : Dealing with Conflict

            Dealing with conflict can be a very difficult thing and something that can leave us broken,
            diminished, unhappy, or disengaged from our work.  But if handled well, can also help us
            better understand ourselves, help us grow, bring us closer together as a team, and to help
            us see other's view points more rapidly.

            Todays blog is all about dealing with conflict and how I myself have dealt with it in the
            past.

            Continue Reading

July 1st - 2014 : Active Record

What is Active Record?

            Active Record at it's simplest is an ORM or "Object Relational Mapping". It sits between
            your database and your code and maps your database to your code.
            Active Record also links directly to the "Model" in Model, View, Controller(MVC) of the Rails
            framework.

            With Active Record, we model our data with classes within Ruby.  These classes are then used
            by Active Record to create and update the database for us.  There is no need to open up SQL
            and create tables.  There are many built in methods that allow for easy schema maintenance.

            Continue Reading

June 30th - 2014 : Blog Redisgn

The Challenge

            I'm in the final stretch for my phase 0 prep work for DBC.  These last two weeks are all about
            review and we have some freedom to choose what we work on.  One of those options was to update the
            design of our personal github.io websites that we use to blog.

            I've been pretty satisfied with my layout but there have been some things bothering me about the
            design since I got it up and running back in week 2.  That seems forever ago now.  Here is the list
            of things that were bothering me and what I did to address them.

            Continue Reading

June 29th - 2014 : SQL vs NoSQL

SQL or Relational Database Management Systems

            Structured and Relational, SQL databases group their data together into logical tables.
            A person has a name, age, weight, height, hair color, etc. so in SQL we structure a
            person as a table in the database where there are columns for each characteristic of
            that person.  You can then have a new person for each row in the person table.

            SQL databases also rely heavily on having identity columns in a table so that each row
            in a table becomes unique.  This also has the added advantage of being able to relate
            data in one table to data in another.

            Continue Reading

June 29th - 2014 : Affirmation and Stereotype Threat

Exploring my values

            Having a family, Inner harmony, Meaningful work.  These are the three key values that
            jumped out at me as I read through the list.  Looking back at my 35 years on this earth
            I can see that times that I was the most happy was when these three values aligned.

            Of the three values that stand out, I've decided to write a few sentences on having a
            family.  I've been a husband for 10 years now and a father for 8.  My extended family is
            large and close.  I can't think of a single major milestone in my life where family was
            not involved in either getting me there are celebrating my success at the end.

            Continue Reading

June 22nd - 2014 : Ruby Classes & Modules

            For this weeks technical blog post I've decided to go over the difference between
            Ruby classes and modules.  There is much confusion between the difference and when
            to use one or the other.  I hope by the time you are done reading, you will have a
            better understanding of the two and when to use them.  If you haven't already, take
            a second to review the first image above this paragraph and then lets start with the
            Ruby class.

            Continue Reading

June 22nd - 2014 : Stereotype Threat

            I'm white, nerdy, and an introvert.  I'll let that sink in for a moment.  I'm
            white, nerdy, and an introvert.  Can you think of some characteristics for these
            things that I identify as?  I know I can and no I don't dress up like a character
            from Star Wars or Star Trek and attend conventions on the weekends.  I don't live
            in my mother's basement.  But I am working towards being a software engineer though so
            you got me there.

            Continue Reading

June 15th - 2014 : Ruby Classes

            Everything is an object in Ruby.  All the way down to numbers and strings.  And that is a
            great way to look at it too because everything inherits from object.  Object is the root
            Ruby class that everything is built on.

            For that is what an object is, a Ruby class.  A class describes what an object is, what it
            can do, how it works.  This fundamental construct is the basis of all object oriented programming
            languages.  It is this ability to define classes or objects that gives the ability to model
            real world objects and ideas.  It is also the power and grace behind object oriented programming.

            Continue Reading

June 15th - 2014 : Pair Programming & Feedback

            Coming into DBC, pair programming was my biggest fear.  Being a bit of an introvert, I had nightmares
            about how I would be able to take all the social interaction.  Especially over the Internet with people
            that I had never met before.

            I also feared looking like an idiot in front of my classmates.  I have a tendency to avoid situations
            where I can look stupid so pairing scared me.  I can handle the home work, the schedule, the dedication,
            and pretty much anything else you throw at me but pairing is Kryptonite.

            Continue Reading

June 8th - 2014 : Ruby Loops

            Ruby must take the crown for number of ways to loop.  The Ruby landscape it ripe with
            a million ways to iterate over stuff.  I imagine in my mind, a mom with a bag of froot
            loops, driving her minivan trying to hand the bag back to her two year old son in the
            back seat.  "I only want red!", he yells at her as froot loops fall over the floor, in
            his seat, and on mom's lap.  The blue and green loops will soon be crushed under foot
            by the family, the purples ones lost to the void that is the cracks of the car seats,
            the yellows ones rolled to the abyss under the car seats.

            Continue Reading

June 8th - 2014 : Women in tech

            The topic I've chosen for this weeks cultural blog scares me.  It's a topic I've seen in news in
            varying degrees over the past several years.  It usually goes something like this.  "Ms. Female
            programmer quit her job at x tech company today citing harassment, bullying, and general hate as
            her reason for leaving.  CEO of x tech company had little to say on the matter other than the
            employees at fault were told to be better but all is well because crazy Ms. Female programmer finally
            left the company like they wanted in the first place."

            The astounding number of news articles and blog posts that all follow this pattern is staggering.
            I can't even begin to fathom a culture that could get this bad.  Is there no repercussions for treating
            a person like the tech world seems to do to women on a daily basis?  How can this type of thing
            continue to be common place?

            Continue Reading

June 1st - 2014 : JavaScript Awesomness!

The Buzz...

            JavaScript seems to be the buzz word in web development now a days.  The language has become very popular over the past couple of years, that you can't really get away from it even if you wanted to. Most, if not all, major backend technologies have implemented some form or another of the language into their boilerplate front end code.

            There is literaly a sea of JavaScript libraries out there today.  From jQuery to coffee script there are to many to count or list.  I would suspect that a search on GitHub would show that JavaScript is one of, if not, the most used language out there today. 2013 Github Stats

            Continue Reading

June 1st - 2014 : My Mind Styles

          The Mind Style model created by Anthony Gregorc is a well known way of how to consider the way the mind works.

          Through a simple test, one can determine a thinking style for themselves based upon 4 qualities or abilities.  These "abilities" describe how a person perceives and organizes information.

          Continue Reading

        Tommy Dugger 2014


text:
/*  ConfigurableMapViewerCMV
 *  version 2.0.0-beta.1
 *  Project: http://cmv.io/
 */

define({root:{labels:{selectLayer:'Choose "All Visible Layers" or a single layer for identify:',allVisibleLayers:"*** All Visible Layers ***"},rightClickMenuItem:{label:"Identify here"},mapInfoWindow:{identifyingTitle:"Identifying..."}},es:!0,fr:!0,"pt-br":!0,"pt-pt":!0});
//# sourceMappingURL=resource.js.map


text:
package betterwithmods.client.baking;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;

import javax.annotation.Nullable;

public interface IStateParticleBakedModel {
	TextureAtlasSprite getParticleTexture(IBlockState state, @Nullable EnumFacing facing);
}


text:
/*global describe, it, beforeEach, afterEach, sinon, expect */

describe("The captcha plugin", function(){

	// Common.
	var $container;
	var clock;
	var server;
	var plugin;

	// Specific bits.
	var $form;

	beforeEach(function(){

		// Fake timers.
		clock = sinon.useFakeTimers();

		// Mock the server.
		server = sinon.fakeServer.create();
		server.respondWithSuccess = function () {
			server.respondWith('{ "hash" : "AAAAAAAAAA" }');
			server.respond();
		};

		// Create the form.
		var html = [];
		html.push('<form action="#">');
			html.push('<input type="text" name="eml_email_address" />');
		html.push('</form>');

		// Insert.
		$container = $('<div/>').append(html.join("")).appendTo('body');

		// Grab the form.
		$form = $container.find("form");

		// Trigger plugin.
		$form.captcha("/includes/js/ajax/captcha.php");

		// Grab the plugin.
		plugin = $form.data("captcha");
	});

	afterEach(function(){
		$container.remove();
		clock.restore();
		server.restore();
	});

	it("makes a request for a unique hash", function(){
		expect(server.requests.length).toBe(1);
		expect(server.requests[0].url).toBe(plugin.url);
	});

    it('does not allow submission until the hash is received', function(){

        // Try it immediately.
        expect(plugin.allowSubmission()).toBe(false);

        // Wait a while.
        clock.tick(2000);

        // Try again.
        expect(plugin.allowSubmission()).toBe(false);
    });

	describe("when a hash response is received", function(){

		beforeEach(function(){
			server.respondWithSuccess();
		});

		it("creates a hidden field to hold the unique hash", function(){

			// Find the field.
			var $field = $form.find("input[name='" + plugin.FIELD_NAME + "']");
			expect($field.length).toBe(1);

			// Ensure it's hidden.
			expect($field.is(":visible")).toBe(false);
		});

		it("does not allow submission until the minimum completion time is past", function(){

			// Check if we would be allowed.
			expect(plugin.allowSubmission()).toBe(false);

			// Now, meticulously complete the form.
			clock.tick(plugin.MINIMUM_DURATION);

			// Try again.
			expect(plugin.allowSubmission()).toBe(true);
		});
	});
});


text:
/*
    A system node list is a list of node objects, each containing a list of components that a system is interested in.
    The game will monitor the adding and removal of new entities and components on those entities and automatically add
    and remove nodes from registered lists. By managing node lists, systems will have prebuilt lists of component bundles to loop
    through at update time instead of having to build them anew with each update loop.

    The user passes in a contract on initialization which has the structure:
      [{Name:ComponentType},...]

    The Name key will be the key of the component in the resulting node.
    The ComponentType value of each entry should specify the class name of the component which is being added.

    Example:
      If the specified contract is : { position:PositionComponent, renderable:RenderableComponent }
      the resulting nodes will look like : { position:PositionComponentInstance, renderable:RenderableComponentInstance }
*/
(function(){
  this.SystemNodeList = function(contract)
  {
    this.initialize(contract);
  };
  SystemNodeList.prototype = {

    initialize:function(contract)
    {
      // assert(contract && contract instanceof Object, "Must specify contract data object");

      this.contract = [];
      this.nodes = [];
      this.entities = {};

      this.nodeAdded = new signals.Signal();
      this.nodeRemoved = new signals.Signal();

      _.each(contract, function(componentType, propertyName) {
        this.contract.push({componentType:componentType, propertyName:propertyName});
      }.bind(this));
    },

    forEachNode:function(callback)
    {
      _.each(this.nodes, callback);
    },

    updateMembership:function(entity)
    {
      // Add if matches
      if (this.entities[entity.id] == null)
      {
        this.addIfMatches(entity);
      }
      else
      {
        this.removeIfNotMatches(entity);
      }
    },

    addIfMatches:function(entity)
    {
      if (this.matches(entity))
      {
        var node = {};
        _.each(this.contract, function(contractData)
        {
          node[contractData.propertyName] = entity.getComponent(contractData.componentType);
        });
        this.entities[entity.id] = this.nodes.length;
        this.nodes.push(node);
        this.nodeAdded.dispatch(this, node);
      }
    },

    removeIfNotMatches:function(entity)
    {
      if (!this.matches(entity))
      {
        var idx = this.entities[entity.id];
        delete this.entities[entity.id];
        var node = this.nodes.splice(idx,1)[0];
        this.nodeRemoved.dispatch(this, node);
      }
    },

    matches:function(entity)
    {
      return _.every(this.contract, function(contractData)
      {
        return entity.hasComponent(contractData.componentType);
      });
    },

    destroy:function()
    {
      for (var node in nodes)
      {
        this.nodeRemoved.dispatch(this, node);
      }
    }
  };
})();


text:
<?php

/**
 * Class Dannevang_Transfeedisplay_Block_Sales_Order_Totals_Transfeedisplay
 */
class Dannevang_Transfeedisplay_Block_Sales_Order_Totals_Transfeedisplay extends Mage_Core_Block_Abstract
{
	/**
     * @return bool|float
     */
    private function _getTransactionFee()
    {
        $orderClass = get_class(Mage::getModel('sales/order'));
        $order = $this->getParentBlock()->getOrder();
        if ($orderClass == get_class($order))
        {
            if ($incrementId = $order->getIncrementId())
            {
                $read = Mage::getSingleton('core/resource')->getConnection('core_read');
                $query = "select * from epay_order_status where orderid = '" . $incrementId . "'";
                $row = $read->fetchRow($query);
                if (count($row))
                {
                    if ($amount = (float)$row['transfee'] / 100)
                    {
                        return $amount;
                    }
                }
            }
        }
        return false;
    }

	/**
     * @return $this
     */
    public function initTotals()
    {
        if ($amount = $this->_getTransactionFee())
        {
            $total = new Varien_Object(array(
                'code'  => 'transfee',
                'field' => 'transfee_amount',
                'value' => $amount,
                'label' => $this->getLabel()
            ));
            $this->getParentBlock()->addTotal($total, 'tax');
        }
        return $this;
    }

	/**
     * @return mixed
     */
    public function getLabel()
    {
        return $this->__('Card Fee');
    }

	/**
     * @return bool|float
     */
    public function getTransactionFee()
    {
        return ($transfee = $this->_getTransactionFee()) ? $transfee : false;
    }
}


text:
import logging
log = logging.getLogger(__name__)

from functools import wraps
import string

from spacq.interface.units import Quantity

"""
Tools for working with hardware devices.
"""

def str_to_bool(value):
	"""
	False and 'False' => False
	otherwise => True
	"""

	return bool(value) and value.lower() != 'false'

def quantity_wrapped(units, multiplier=1.0):
	"""
	A decorator for getters to wrap the plain device value into a quantity with a unit.
	"""

	def wrap(f):
		@wraps(f)
		def wrapped(self):
			return Quantity(f(self) * multiplier, units)

		return wrapped

	return wrap

def quantity_unwrapped(units, multiplier=1.0):
	"""
	A decorator for setters to extract the plain device value from the quantity.
	"""

	def wrap(f):
		@wraps(f)
		def wrapped(self, value):
			value.assert_dimensions(units)

			return f(self, value.value * multiplier)

		return wrapped

	return wrap

class BlockDataError(Exception):
	"""
	Problem reading block data.
	"""

	pass

class BlockData(object):
	"""
	Utility methods for conversion between binary and 488.2 block data.
	"""

	@staticmethod
	def to_block_data(data):
		"""
		Packs binary data into 488.2 block data.

		As per section 7.7.6 of IEEE Std 488.2-1992.

		Note: Does not produce indefinitely-formatted block data.
		"""

		log.debug('Converting to block data: {0!r}'.format(data))

		length = len(data)
		length_length = len(str(length))

		return '#{0}{1}{2}'.format(length_length, length, data)

	@staticmethod
	def from_block_data(block_data):
		"""
		Extracts binary data from 488.2 block data.

		As per section 7.7.6 of IEEE Std 488.2-1992.
		"""

		log.debug('Converting from block data: {0!r}'.format(block_data))

		# Must have at least "#0\n" or "#XX".
		if len(block_data) < 3:
			raise BlockDataError('Not enough data.')

		if block_data[0] != '#':
			raise BlockDataError('Leading character is "{0}", not "#".'.format(block_data[0]))

		if block_data[1] == '0':
			log.debug('Indefinite format.')

			if block_data[-1] != '\n':
				raise BlockDataError('Final character is "{0}", not NL.'.format(block_data[-1]))

			return block_data[2:-1]
		else:
			log.debug('Definite format.')

			try:
				length_length = int(block_data[1])
			except ValueError:
				raise BlockDataError('Length length incorrectly specified: {0}'.format(block_data[1]))

			data_start = 2 + length_length

			if data_start > len(block_data):
				raise BlockDataError('Not enough data.')

			try:
				length = int(block_data[2:data_start])
			except ValueError:
				raise BlockDataError('Length incorrectly specified: {0}'.format(block_data[2:data_start]))

			data_end = data_start + length

			if data_end > len(block_data):
				raise BlockDataError('Not enough data.')
			elif data_end < len(block_data):
				if block_data[data_end:] != '\n':
					log.warning('Extra data ignored: {0!r}'.format(block_data[data_end:]))

			return block_data[data_start:data_end]

class BinaryEncoder(object):
	"""
	Utility methods for dealing with encoding and decoding binary data.
	"""

	@staticmethod
	def encode(msg):
		"""
		Convert a string of hexadecimal digits to a byte string.
		"""

		log.debug('Encoding to byte string: {0}'.format(msg))

		# Discard non-hexadecimal characters.
		msg_filtered = [x for x in msg if x in string.hexdigits]
		# Grab pairs.
		idxs = xrange(0, len(msg_filtered), 2)
		msg_paired = [''.join(msg_filtered[i:i+2]) for i in idxs]
		# Convert to bytes.
		msg_encoded = ''.join([chr(int(x, 16)) for x in msg_paired])

		log.debug('Encoded to: {0!r}'.format(msg_encoded))

		return msg_encoded

	@staticmethod
	def decode(msg, pair_size=2, pair_up=True):
		"""
		Convert a byte string to a string of hexadecimal digits.
		"""

		log.debug('Decoding from byte string: {0!r}'.format(msg))

		# Get the hex string for each byte.
		msg_decoded = ['{0:02x}'.format(ord(x)) for x in msg]

		if pair_up:
			idxs = xrange(0, len(msg_decoded), pair_size)
			msg_formatted = [''.join(msg_decoded[i:i+pair_size]) for i in idxs]

			result = ' '.join(msg_formatted)
		else:
			result = ''.join(msg_decoded)

		log.debug('Decoded to: {0}'.format(result))

		return result

	@staticmethod
	def length(msg):
		"""
		Calculate the number of bytes an unencoded message takes up when encoded.
		"""

		log.debug('Finding encoded length: {0}'.format(msg))

		result = len(BinaryEncoder.encode(msg))

		log.debug('Found encoded length: {0}'.format(result))

		return result


text:
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd"
	login-required="true">

	<restrict>#{s:hasRole('permission_assignment/create') or s:hasRole('permission_assignment/update')}</restrict>
	<begin-conversation join="true" flush-mode="MANUAL" />

	<param name="permissionAssignmentFrom" />
	<param name="permissionAssignmentPermissionAssignmentId" value="#{permissionAssignmentHome.permissionAssignmentPermissionAssignmentId}" />

	<navigation from-action="#{permissionAssignmentHome.persist}">
		<rule if-outcome="persisted">
			<end-conversation />
			<redirect view-id="/std/core/page/admin/PermissionAssignmentList.xhtml" />
		</rule>
	</navigation>

	<navigation from-action="#{permissionAssignmentHome.update}">
		<rule if-outcome="updated">
			<end-conversation />
			<redirect view-id="/std/core/page/admin/PermissionAssignmentList.xhtml" />
		</rule>
	</navigation>

	<navigation from-action="#{permissionAssignmentHome.remove}">
		<rule if-outcome="removed">
			<end-conversation />
			<redirect view-id="/std/core/page/admin/PermissionAssignmentList.xhtml" />
		</rule>
		<rule if-outcome="failure">
			<end-conversation />
			<redirect view-id="/std/core/page/admin/PermissionAssignmentList.xhtml" />
		</rule>
	</navigation>

</page>


text:
package com.thoughtworks.go.domain;

import com.thoughtworks.go.config.CaseInsensitiveString;
import com.thoughtworks.go.util.ReflectionUtil;
import org.junit.Test;

import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.sameInstance;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

public class CaseInsensitiveStringTest {

    @Test
    public void shouldIgnoreCaseInEquals() {
        CaseInsensitiveString name = new CaseInsensitiveString("someName");
        assertThat(name, is(new CaseInsensitiveString("someName")));
        assertThat(name, is(new CaseInsensitiveString("SOMENAME")));
        assertThat(name, not(new CaseInsensitiveString("SOMECRAP")));
    }

    @Test
    public void shouldUnderstandBlankString() {
        assertThat(new CaseInsensitiveString("someName").isBlank(), is(false));
        assertThat(new CaseInsensitiveString(null).isBlank(), is(true));
        assertThat(new CaseInsensitiveString("").isBlank(), is(true));
        assertThat(new CaseInsensitiveString(" ").isBlank(), is(false));
    }

    @Test
    public void shouldClone() throws Exception {
        CaseInsensitiveString foo = new CaseInsensitiveString("foo");
        CaseInsensitiveString fooClone = (CaseInsensitiveString) ReflectionUtil.invoke(foo, "clone");
        assertThat(foo, is(fooClone));
        assertThat(foo, not(sameInstance(fooClone)));
    }

    @Test
    public void shouldCompare() {
        CaseInsensitiveString foo = new CaseInsensitiveString("foo");
        CaseInsensitiveString fOO = new CaseInsensitiveString("fOO");
        CaseInsensitiveString bar = new CaseInsensitiveString("bar");
        assertThat(foo.compareTo(fOO), is(0));
        assertThat(fOO.compareTo(foo), is(0));
        assertThat(bar.compareTo(foo), lessThan(0));
        assertThat(bar.compareTo(fOO), lessThan(0));
        assertThat(foo.compareTo(bar), greaterThan(0));
        assertThat(fOO.compareTo(bar), greaterThan(0));
    }

    @Test
    public void shouldUnderstandCase() {
        assertThat(new CaseInsensitiveString("foo").toUpper(), is("FOO"));
        assertThat(new CaseInsensitiveString("FOO").toLower(), is("foo"));
    }

    @Test
    public void shouldReturnNullSafeStringRepresentation() {
        assertThat(CaseInsensitiveString.str(new CaseInsensitiveString("foo")), is("foo"));
        assertThat(CaseInsensitiveString.str(new CaseInsensitiveString("")), is(""));
        assertThat(CaseInsensitiveString.str(new CaseInsensitiveString(null)), nullValue());
        assertThat(CaseInsensitiveString.str(null), nullValue());
    }
}


text:
//*****************************************************************************
//
// cs.c - Driver for the cs Module.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup cs_api cs
//! @{
//
//*****************************************************************************

#include "inc/hw_memmap.h"

#if defined(__MSP430_HAS_CS__) || defined(__MSP430_HAS_SFR__)
#include "cs.h"

#include <assert.h>

//*****************************************************************************
//
// The following value is used by CS_getACLK, CS_getSMCLK, CS_getMCLK to
// determine the operating frequency based on the available DCO frequencies.
//
//*****************************************************************************
#define CS_DCO_FREQ_1                                                   1000000
#define CS_DCO_FREQ_2                                                   2670000
#define CS_DCO_FREQ_3                                                   3330000
#define CS_DCO_FREQ_4                                                   4000000
#define CS_DCO_FREQ_5                                                   5330000
#define CS_DCO_FREQ_6                                                   6670000
#define CS_DCO_FREQ_7                                                   8000000
#define CS_DCO_FREQ_8                                                  16000000
#define CS_DCO_FREQ_9                                                  20000000
#define CS_DCO_FREQ_10                                                 24000000

//*****************************************************************************
//
// Internal very low power VLOCLK, low frequency oscillator with 10kHz typical
// frequency, internal low-power oscillator MODCLK with 5 MHz typical
// frequency and LFMODCLK is MODCLK divided by 128.
//
//*****************************************************************************
#define CS_VLOCLK_FREQUENCY                                               10000
#define CS_MODCLK_FREQUENCY                                             5000000
#define CS_LFMODCLK_FREQUENCY                                             39062

//*****************************************************************************
//
// The following value is used by CS_XT1Start, CS_bypassXT1,
// CS_XT1StartWithTimeout, CS_bypassXT1WithTimeout to properly set the XTS
// bit. This frequnecy threshold is specified in the User's Guide.
//
//*****************************************************************************
#define LFXT_FREQUENCY_THRESHOLD                                          50000

//*****************************************************************************
//
// LFXT crystal frequency. Should be set with
// CS_externalClockSourceInit if LFXT is used and user intends to invoke
// CS_getSMCLK, CS_getMCLK, CS_getACLK and
// CS_turnOnLFXT, CS_LFXTByPass, CS_turnOnLFXTWithTimeout,
// CS_LFXTByPassWithTimeout.
//
//*****************************************************************************
static uint32_t privateLFXTClockFrequency = 0;

//*****************************************************************************
//
// The HFXT crystal frequency. Should be set with
// CS_externalClockSourceInit if HFXT is used and user intends to invoke
// CS_getSMCLK, CS_getMCLK, CS_getACLK,
// CS_turnOnLFXT, CS_LFXTByPass, CS_turnOnLFXTWithTimeout,
// CS_LFXTByPassWithTimeout.
//
//*****************************************************************************
static uint32_t privateHFXTClockFrequency = 0;

static uint32_t privateCSASourceClockFromDCO(uint8_t clockdivider)
{
    uint32_t CLKFrequency = 0;

    if(HWREG16(CS_BASE + OFS_CSCTL1) & DCORSEL)
    {
        switch(HWREG16(CS_BASE + OFS_CSCTL1) & DCOFSEL_7)
        {
        case DCOFSEL_0:
            CLKFrequency = CS_DCO_FREQ_1 / clockdivider;
            break;
        case DCOFSEL_1:
            CLKFrequency = CS_DCO_FREQ_5 / clockdivider;
            break;
        case DCOFSEL_2:
            CLKFrequency = CS_DCO_FREQ_6 / clockdivider;
            break;
        case DCOFSEL_3:
            CLKFrequency = CS_DCO_FREQ_7 / clockdivider;
            break;
        case DCOFSEL_4:
            CLKFrequency = CS_DCO_FREQ_8 / clockdivider;
            break;
        case DCOFSEL_5:
            CLKFrequency = CS_DCO_FREQ_9 / clockdivider;
            break;
        case DCOFSEL_6:
        case DCOFSEL_7:
            CLKFrequency = CS_DCO_FREQ_10 / clockdivider;
            break;
        default:
            CLKFrequency = 0;
            break;
        }
    }
    else
    {
        switch(HWREG16(CS_BASE + OFS_CSCTL1) & DCOFSEL_7)
        {
        case DCOFSEL_0:
            CLKFrequency = CS_DCO_FREQ_1 / clockdivider;
            break;
        case DCOFSEL_1:
            CLKFrequency = CS_DCO_FREQ_2 / clockdivider;
            break;
        case DCOFSEL_2:
            CLKFrequency = CS_DCO_FREQ_3 / clockdivider;
            break;
        case DCOFSEL_3:
            CLKFrequency = CS_DCO_FREQ_4 / clockdivider;
            break;
        case DCOFSEL_4:
            CLKFrequency = CS_DCO_FREQ_5 / clockdivider;
            break;
        case DCOFSEL_5:
            CLKFrequency = CS_DCO_FREQ_6 / clockdivider;
            break;
        case DCOFSEL_6:
        case DCOFSEL_7:
            CLKFrequency = CS_DCO_FREQ_7 / clockdivider;
            break;
        default:
            CLKFrequency = 0;
            break;
        }
    }

    return (CLKFrequency);
}

static uint32_t privateCSAComputeCLKFrequency(uint16_t CLKSource,
                                              uint16_t CLKSourceDivider)
{
    uint32_t CLKFrequency = 0;
    uint8_t CLKSourceFrequencyDivider = 1;
    uint8_t i = 0;

    //Determine Frequency divider
    for(i = 0; i < CLKSourceDivider; i++)
    {
        CLKSourceFrequencyDivider *= 2;
    }

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Determine clock source based on CLKSource
    switch(CLKSource)
    {
    //If LFXT is selected as clock source
    case SELM__LFXTCLK:
        CLKFrequency = (privateLFXTClockFrequency /
                        CLKSourceFrequencyDivider);

        //Check if LFXTOFFG is not set. If fault flag is set
        //VLO is used as source clock
        if(HWREG8(CS_BASE + OFS_CSCTL5) & LFXTOFFG)
        {
            HWREG8(CS_BASE + OFS_CSCTL5) &= ~(LFXTOFFG);
            //Clear OFIFG fault flag
            HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;

            if(HWREG8(CS_BASE + OFS_CSCTL5) & LFXTOFFG)
            {
                CLKFrequency = CS_LFMODCLK_FREQUENCY;
            }
        }
        break;

    case SELM__VLOCLK:
        CLKFrequency =
            (CS_VLOCLK_FREQUENCY / CLKSourceFrequencyDivider);
        break;

    case SELM__LFMODOSC:
        CLKFrequency =
            (CS_LFMODCLK_FREQUENCY / CLKSourceFrequencyDivider);

        break;

    case SELM__DCOCLK:
        CLKFrequency =
            privateCSASourceClockFromDCO(CLKSourceFrequencyDivider);

        break;

    case SELM__MODOSC:
        CLKFrequency =
            (CS_MODCLK_FREQUENCY / CLKSourceFrequencyDivider);

        break;

    case SELM__HFXTCLK:
        CLKFrequency =
            (privateHFXTClockFrequency / CLKSourceFrequencyDivider);

        if(HWREG8(CS_BASE + OFS_CSCTL5) & HFXTOFFG)
        {
            HWREG8(CS_BASE + OFS_CSCTL5) &= ~HFXTOFFG;
            //Clear OFIFG fault flag
            HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;
        }

        if(HWREG8(CS_BASE + OFS_CSCTL5) & HFXTOFFG)
        {
            CLKFrequency = CS_MODCLK_FREQUENCY;
        }
        break;
    }

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;

    return (CLKFrequency);
}

void CS_setExternalClockSource(uint32_t LFXTCLK_frequency,
                               uint32_t HFXTCLK_frequency)
{
    privateLFXTClockFrequency = LFXTCLK_frequency;
    privateHFXTClockFrequency = HFXTCLK_frequency;
}

void CS_initClockSignal(uint8_t selectedClockSignal,
                        uint16_t clockSource,
                        uint16_t clockSourceDivider)
{
    //Verify User has selected a valid Frequency divider
    assert(
        (CS_CLOCK_DIVIDER_1 == clockSourceDivider) ||
        (CS_CLOCK_DIVIDER_2 == clockSourceDivider) ||
        (CS_CLOCK_DIVIDER_4 == clockSourceDivider) ||
        (CS_CLOCK_DIVIDER_8 == clockSourceDivider) ||
        (CS_CLOCK_DIVIDER_16 == clockSourceDivider) ||
        (CS_CLOCK_DIVIDER_32 == clockSourceDivider)
        );

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    uint16_t temp = HWREG16(CS_BASE + OFS_CSCTL3);
    switch(selectedClockSignal)
    {
    case CS_ACLK:
        assert(
            (CS_LFXTCLK_SELECT == clockSource)  ||
            (CS_VLOCLK_SELECT == clockSource)   ||
            (CS_LFMODOSC_SELECT == clockSource)
            );

        clockSourceDivider = clockSourceDivider << 8;
        clockSource = clockSource << 8;

        HWREG16(CS_BASE + OFS_CSCTL2) &= ~(SELA_7);
        HWREG16(CS_BASE + OFS_CSCTL2) |= (clockSource);
        HWREG16(CS_BASE + OFS_CSCTL3) = temp & ~(DIVA0 + DIVA1 + DIVA2) |
                                        clockSourceDivider;
        break;
    case CS_SMCLK:
        assert(
            (CS_LFXTCLK_SELECT == clockSource) ||
            (CS_VLOCLK_SELECT == clockSource) ||
            (CS_DCOCLK_SELECT == clockSource) ||
            (CS_HFXTCLK_SELECT == clockSource) ||
            (CS_LFMODOSC_SELECT == clockSource)||
            (CS_MODOSC_SELECT == clockSource)
            );

        clockSource = clockSource << 4;
        clockSourceDivider = clockSourceDivider << 4;

        HWREG16(CS_BASE + OFS_CSCTL2) &= ~(SELS_7);
        HWREG16(CS_BASE + OFS_CSCTL2) |= clockSource;
        HWREG16(CS_BASE + OFS_CSCTL3) = temp & ~(DIVS0 + DIVS1 + DIVS2) |
                                        clockSourceDivider;
        break;
    case CS_MCLK:
        assert(
            (CS_LFXTCLK_SELECT == clockSource) ||
            (CS_VLOCLK_SELECT == clockSource) ||
            (CS_DCOCLK_SELECT == clockSource) ||
            (CS_HFXTCLK_SELECT == clockSource) ||
            (CS_LFMODOSC_SELECT == clockSource)||
            (CS_MODOSC_SELECT == clockSource)
            );

        HWREG16(CS_BASE + OFS_CSCTL2) &= ~(SELM_7);
        HWREG16(CS_BASE + OFS_CSCTL2) |= clockSource;
        HWREG16(CS_BASE + OFS_CSCTL3) = temp & ~(DIVM0 + DIVM1 + DIVM2) |
                                        clockSourceDivider;
        break;
    }

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

void CS_turnOnLFXT(uint16_t lfxtdrive)
{
    assert(privateLFXTClockFrequency != 0);

    assert((lfxtdrive == CS_LFXT_DRIVE_0) ||
           (lfxtdrive == CS_LFXT_DRIVE_1) ||
           (lfxtdrive == CS_LFXT_DRIVE_2) ||
           (lfxtdrive == CS_LFXT_DRIVE_3));

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Switch ON LFXT oscillator
    HWREG16(CS_BASE + OFS_CSCTL4) &= ~LFXTOFF;

    //Highest drive setting for LFXTstartup
    HWREG16(CS_BASE + OFS_CSCTL4_L) |= LFXTDRIVE1_L + LFXTDRIVE0_L;

    HWREG16(CS_BASE + OFS_CSCTL4) &= ~LFXTBYPASS;

    //Wait for Crystal to stabilize
    while(HWREG8(CS_BASE + OFS_CSCTL5) & LFXTOFFG)
    {
        //Clear OSC flaut Flags fault flags
        HWREG8(CS_BASE + OFS_CSCTL5) &= ~(LFXTOFFG);

        //Clear OFIFG fault flag
        HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;
    }

    //Set requested Drive mode
    HWREG16(CS_BASE + OFS_CSCTL4) = (HWREG16(CS_BASE + OFS_CSCTL4) &
                                     ~(LFXTDRIVE_3)
                                     ) |
                                    (lfxtdrive);

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

void CS_turnOffSMCLK(void)
{
    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    HWREG16(CS_BASE + OFS_CSCTL4) |= SMCLKOFF;

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

void CS_turnOnSMCLK(void)
{
    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    HWREG16(CS_BASE + OFS_CSCTL4) &= ~SMCLKOFF;

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

void CS_bypassLFXT(void)
{
    //Verify user has set frequency of LFXT with SetExternalClockSource
    assert(privateLFXTClockFrequency != 0);

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    assert(privateLFXTClockFrequency < LFXT_FREQUENCY_THRESHOLD);

    //Set LFXT in LF mode Switch off LFXT oscillator and enable BYPASS mode
    HWREG16(CS_BASE + OFS_CSCTL4) |= (LFXTBYPASS + LFXTOFF);

    //Wait until LFXT stabilizes
    while(HWREG8(CS_BASE + OFS_CSCTL5) & LFXTOFFG)
    {
        //Clear OSC flaut Flags fault flags
        HWREG8(CS_BASE + OFS_CSCTL5) &= ~(LFXTOFFG);

        //Clear the global fault flag. In case the LFXT caused the global fault
        //flag to get set this will clear the global error condition. If any
        //error condition persists, global flag will get again.
        HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;
    }

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

bool CS_turnOnLFXTWithTimeout(uint16_t lfxtdrive,
                              uint32_t timeout)
{
    assert(privateLFXTClockFrequency != 0);

    assert((lfxtdrive == CS_LFXT_DRIVE_0) ||
           (lfxtdrive == CS_LFXT_DRIVE_1) ||
           (lfxtdrive == CS_LFXT_DRIVE_2) ||
           (lfxtdrive == CS_LFXT_DRIVE_3));

    assert(timeout > 0);

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Switch ON LFXT oscillator
    HWREG16(CS_BASE + OFS_CSCTL4) &= ~LFXTOFF;

    //Highest drive setting for LFXTstartup
    HWREG16(CS_BASE + OFS_CSCTL4_L) |= LFXTDRIVE1_L + LFXTDRIVE0_L;

    HWREG16(CS_BASE + OFS_CSCTL4) &= ~LFXTBYPASS;

    while((HWREG8(CS_BASE + OFS_CSCTL5) & LFXTOFFG) && --timeout)
    {
        //Clear OSC fault Flags fault flags
        HWREG8(CS_BASE + OFS_CSCTL5) &= ~(LFXTOFFG);

        //Clear the global fault flag. In case the LFXT caused the global fault
        //flag to get set this will clear the global error condition. If any
        //error condition persists, global flag will get again.
        HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;
    }

    if(timeout)
    {
        //Set requested Drive mode
        HWREG16(CS_BASE + OFS_CSCTL4) = (HWREG16(CS_BASE + OFS_CSCTL4) &
                                         ~(LFXTDRIVE_3)
                                         ) |
                                        (lfxtdrive);
        //Lock CS control register
        HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
        return (STATUS_SUCCESS);
    }
    else
    {
        //Lock CS control register
        HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
        return (STATUS_FAIL);
    }
}

bool CS_bypassLFXTWithTimeout(uint32_t timeout)
{
    assert(privateLFXTClockFrequency != 0);

    assert(privateLFXTClockFrequency < LFXT_FREQUENCY_THRESHOLD);

    assert(timeout > 0);

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Set LFXT in LF mode Switch off LFXT oscillator and enable BYPASS mode
    HWREG16(CS_BASE + OFS_CSCTL4) |= (LFXTBYPASS + LFXTOFF);

    while((HWREG8(CS_BASE + OFS_CSCTL5) & LFXTOFFG) && --timeout)
    {
        //Clear OSC fault Flags fault flags
        HWREG8(CS_BASE + OFS_CSCTL5) &= ~(LFXTOFFG);

        //Clear the global fault flag. In case the LFXT caused the global fault
        //flag to get set this will clear the global error condition. If any
        //error condition persists, global flag will get again.
        HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;
    }

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;

    if(timeout)
    {
        return (STATUS_SUCCESS);
    }
    else
    {
        return (STATUS_FAIL);
    }
}

void CS_turnOffLFXT(void)
{
    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Switch off LFXT oscillator
    HWREG16(CS_BASE + OFS_CSCTL4) |= LFXTOFF;

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

void CS_turnOnHFXT(uint16_t hfxtdrive)
{
    assert(privateHFXTClockFrequency != 0);

    assert((hfxtdrive == CS_HFXT_DRIVE_4MHZ_8MHZ) ||
           (hfxtdrive == CS_HFXT_DRIVE_8MHZ_16MHZ) ||
           (hfxtdrive == CS_HFXT_DRIVE_16MHZ_24MHZ)||
           (hfxtdrive == CS_HFXT_DRIVE_24MHZ_32MHZ));

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Switch ON HFXT oscillator
    HWREG16(CS_BASE + OFS_CSCTL4) &= ~HFXTOFF;

    //Disable HFXTBYPASS mode and Switch on HFXT oscillator
    HWREG16(CS_BASE + OFS_CSCTL4) &= ~HFXTBYPASS;

    //If HFFrequency is 16MHz or above
    if(privateHFXTClockFrequency > 16000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_3;
    }
    //If HFFrequency is between 8MHz and 16MHz
    else if(privateHFXTClockFrequency > 8000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_2;
    }
    //If HFFrequency is between 0MHz and 4MHz
    else if(privateHFXTClockFrequency < 4000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_0;
    }
    //If HFFrequency is between 4MHz and 8MHz
    else
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_1;
    }

    while(HWREG8(CS_BASE + OFS_CSCTL5) & HFXTOFFG)
    {
        //Clear OSC flaut Flags
        HWREG8(CS_BASE + OFS_CSCTL5) &= ~(HFXTOFFG);

        //Clear OFIFG fault flag
        HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;
    }

    HWREG16(CS_BASE + OFS_CSCTL4) = (HWREG16(CS_BASE + OFS_CSCTL4) &
                                     ~(CS_HFXT_DRIVE_24MHZ_32MHZ)
                                     ) |
                                    (hfxtdrive);

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

void CS_bypassHFXT(void)
{
    //Verify user has initialized value of HFXTClock
    assert(privateHFXTClockFrequency != 0);

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Switch off HFXT oscillator and set it to BYPASS mode
    HWREG16(CS_BASE + OFS_CSCTL4) |= (HFXTBYPASS + HFXTOFF);

    //Set correct HFFREQ bit for FR58xx/FR59xx devices

    //If HFFrequency is 16MHz or above
    if(privateHFXTClockFrequency > 16000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_3;
    }
    //If HFFrequency is between 8MHz and 16MHz
    else if(privateHFXTClockFrequency > 8000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_2;
    }
    //If HFFrequency is between 0MHz and 4MHz
    else if(privateHFXTClockFrequency < 4000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_0;
    }
    //If HFFrequency is between 4MHz and 8MHz
    else
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_1;
    }

    while(HWREG8(CS_BASE + OFS_CSCTL5) & HFXTOFFG)
    {
        //Clear OSC fault Flags
        HWREG8(CS_BASE + OFS_CSCTL5) &= ~(HFXTOFFG);

        //Clear OFIFG fault flag
        HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;
    }

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

bool CS_turnOnHFXTWithTimeout(uint16_t hfxtdrive,
                              uint32_t timeout)
{
    //Verify user has initialized value of HFXTClock
    assert(privateHFXTClockFrequency != 0);

    assert(timeout > 0);

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Switch on HFXT oscillator
    HWREG16(CS_BASE + OFS_CSCTL4) &= ~HFXTOFF;

    //Disable HFXTBYPASS mode
    HWREG16(CS_BASE + OFS_CSCTL4) &= ~HFXTBYPASS;

    //Set correct HFFREQ bit for FR58xx/FR59xx devices based
    //on HFXTClockFrequency

    //If HFFrequency is 16MHz or above
    if(privateHFXTClockFrequency > 16000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_3;
    }
    //If HFFrequency is between 8MHz and 16MHz
    else if(privateHFXTClockFrequency > 8000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_2;
    }
    //If HFFrequency is between 0MHz and 4MHz
    else if(privateHFXTClockFrequency < 4000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_0;
    }
    //If HFFrequency is between 4MHz and 8MHz
    else
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_1;
    }

    while((HWREG8(CS_BASE + OFS_CSCTL5) & HFXTOFFG) && --timeout)
    {
        //Clear OSC fault Flags fault flags
        HWREG8(CS_BASE + OFS_CSCTL5) &= ~(HFXTOFFG);

        // Clear the global fault flag. In case the LFXT caused the global fault
        // flag to get set this will clear the global error condition. If any
        // error condition persists, global flag will get again.
        HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;
    }

    if(timeout)
    {
        //Set drive strength for HFXT
        HWREG16(CS_BASE + OFS_CSCTL4) = (HWREG16(CS_BASE + OFS_CSCTL4) &
                                         ~(CS_HFXT_DRIVE_24MHZ_32MHZ)
                                         ) |
                                        (hfxtdrive);
        //Lock CS control register
        HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
        return (STATUS_SUCCESS);
    }
    else
    {
        //Lock CS control register
        HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
        return (STATUS_FAIL);
    }
}

bool CS_bypassHFXTWithTimeout(uint32_t timeout)
{
    //Verify user has initialized value of HFXTClock
    assert(privateHFXTClockFrequency != 0);

    assert(timeout > 0);

    // Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //If HFFrequency is 16MHz or above
    if(privateHFXTClockFrequency > 16000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_3;
    }
    //If HFFrequency is between 8MHz and 16MHz
    else if(privateHFXTClockFrequency > 8000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_2;
    }
    //If HFFrequency is between 0MHz and 4MHz
    else if(privateHFXTClockFrequency < 4000000)
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_0;
    }
    //If HFFrequency is between 4MHz and 8MHz
    else
    {
        HWREG16(CS_BASE + OFS_CSCTL4) = HFFREQ_1;
    }

    //Switch off HFXT oscillator and enable BYPASS mode
    HWREG16(CS_BASE + OFS_CSCTL4) |= (HFXTBYPASS + HFXTOFF);

    while((HWREG8(CS_BASE + OFS_CSCTL5) & HFXTOFFG) && --timeout)
    {
        //Clear OSC fault Flags fault flags
        HWREG8(CS_BASE + OFS_CSCTL5) &= ~(HFXTOFFG);

        // Clear the global fault flag. In case the LFXT caused the global fault
        // flag to get set this will clear the global error condition. If any
        // error condition persists, global flag will get again.
        HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;
    }

    // Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;

    if(timeout)
    {
        return (STATUS_SUCCESS);
    }
    else
    {
        return (STATUS_FAIL);
    }
}

void CS_turnOffHFXT(void)
{
    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Switch off HFXT oscillator
    HWREG16(CS_BASE + OFS_CSCTL4) |= HFXTOFF;

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

void CS_enableClockRequest(uint8_t selectClock)
{
    assert(
        (CS_ACLK == selectClock)||
        (CS_SMCLK == selectClock)||
        (CS_MCLK == selectClock)||
        (CS_MODOSC == selectClock));

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    HWREG8(CS_BASE + OFS_CSCTL6) |= selectClock;

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

void CS_disableClockRequest(uint8_t selectClock)
{
    assert(
        (CS_ACLK == selectClock)||
        (CS_SMCLK == selectClock)||
        (CS_MCLK == selectClock)||
        (CS_MODOSC == selectClock));

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    HWREG8(CS_BASE + OFS_CSCTL6) &= ~selectClock;

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

uint8_t CS_getFaultFlagStatus(uint8_t mask)
{
    assert(
        (CS_HFXTOFFG == mask)||
        (CS_LFXTOFFG == mask)
        );
    return (HWREG8(CS_BASE + OFS_CSCTL5) & mask);
}

void CS_clearFaultFlag(uint8_t mask)
{
    assert(
        (CS_HFXTOFFG == mask)||
        (CS_LFXTOFFG == mask)
        );

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    HWREG8(CS_BASE + OFS_CSCTL5) &= ~mask;

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

uint32_t CS_getACLK(void)
{
    //Find ACLK source
    uint16_t ACLKSource = (HWREG16(CS_BASE + OFS_CSCTL2) & SELA_7);
    ACLKSource = ACLKSource >> 8;

    //Find ACLK frequency divider
    uint16_t ACLKSourceDivider = HWREG16(CS_BASE + OFS_CSCTL3) & SELA_7;
    ACLKSourceDivider = ACLKSourceDivider >> 8;

    return (privateCSAComputeCLKFrequency(
                ACLKSource,
                ACLKSourceDivider));
}

uint32_t CS_getSMCLK(void)
{
    //Find SMCLK source
    uint16_t SMCLKSource = HWREG8(CS_BASE + OFS_CSCTL2) & SELS_7;

    SMCLKSource = SMCLKSource >> 4;

    //Find SMCLK frequency divider
    uint16_t SMCLKSourceDivider = HWREG16(CS_BASE + OFS_CSCTL3) & SELS_7;
    SMCLKSourceDivider = SMCLKSourceDivider >> 4;

    return (privateCSAComputeCLKFrequency(
                SMCLKSource,
                SMCLKSourceDivider)
            );
}

uint32_t CS_getMCLK(void)
{
    //Find MCLK source
    uint16_t MCLKSource = (HWREG16(CS_BASE + OFS_CSCTL2) & SELM_7);
    //Find MCLK frequency divider
    uint16_t MCLKSourceDivider = HWREG16(CS_BASE + OFS_CSCTL3) & SELM_7;

    return (privateCSAComputeCLKFrequency(
                MCLKSource,
                MCLKSourceDivider)
            );
}

void CS_turnOffVLO(void)
{
    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    HWREG16(CS_BASE + OFS_CSCTL4) |= VLOOFF;

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

uint16_t CS_clearAllOscFlagsWithTimeout(uint32_t timeout)
{
    assert(timeout > 0);

    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    do
    {
        //Clear all osc fault flags
        HWREG8(CS_BASE + OFS_CSCTL5) &= ~(LFXTOFFG + HFXTOFFG);

        //Clear the global osc fault flag.
        HWREG8(SFR_BASE + OFS_SFRIFG1) &= ~OFIFG;

        //Check LFXT fault flags
    }
    while((HWREG8(SFR_BASE + OFS_SFRIFG1) & OFIFG) && --timeout);

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;

    return (HWREG8(CS_BASE + OFS_CSCTL5) & (LFXTOFFG + HFXTOFFG));
}

void CS_setDCOFreq(uint16_t dcorsel,
                   uint16_t dcofsel)
{
    assert(
        (dcofsel == CS_DCOFSEL_0)||
        (dcofsel == CS_DCOFSEL_1)||
        (dcofsel == CS_DCOFSEL_2)||
        (dcofsel == CS_DCOFSEL_3)||
        (dcofsel == CS_DCOFSEL_4)||
        (dcofsel == CS_DCOFSEL_5)||
        (dcofsel == CS_DCOFSEL_6)
        );

    //Verify user has selected a valid DCO Frequency Range option
    assert(
        (dcorsel == CS_DCORSEL_0)||
        (dcorsel == CS_DCORSEL_1));

    uint16_t tempCSCTL3 = 0;
    //Unlock CS control register
    HWREG16(CS_BASE + OFS_CSCTL0) = CSKEY;

    //Assuming SMCLK and MCLK are sourced from DCO
    //Store CSCTL3 settings to recover later
    tempCSCTL3 = HWREG16(CS_BASE + OFS_CSCTL3);

    //Keep overshoot transient within specification by setting clk
    //sources to divide by 4
    //Clear the DIVS & DIVM masks (~0x77) and set both fields to 4 divider
    HWREG16(CS_BASE + OFS_CSCTL3) = HWREG16(CS_BASE + OFS_CSCTL3) &
                                    (~(0x77)) | DIVS1 | DIVM1;

    //Set user's frequency selection for DCO
    HWREG16(CS_BASE + OFS_CSCTL1) = (dcorsel + dcofsel);

    //Delay by ~10us to let DCO settle. cycles to wait = 20 cycles buffer +
    //(10us * (x MHz/4))
    switch(dcofsel)
    {
    case (CS_DCOFSEL_0):
        //1 MHz or 1 MHz
        (dcorsel == CS_DCORSEL_0) ? __delay_cycles(23) : __delay_cycles(23);
        break;
    case (CS_DCOFSEL_1):
        //2.67 MHz or 5.33 MHz
        (dcorsel == CS_DCORSEL_0) ? __delay_cycles(27) : __delay_cycles(34);
        break;
    case (CS_DCOFSEL_2):
        //3.33 MHz or 6.67 MHz
        (dcorsel == CS_DCORSEL_0) ? __delay_cycles(29) : __delay_cycles(37);
        break;
    case (CS_DCOFSEL_3):
        //4 MHz or 8 MHz
        (dcorsel == CS_DCORSEL_0) ? __delay_cycles(30) : __delay_cycles(40);
        break;
    case (CS_DCOFSEL_4):
        //5.33 MHz or 16 MHz
        (dcorsel == CS_DCORSEL_0) ? __delay_cycles(34) : __delay_cycles(60);
        break;
    case (CS_DCOFSEL_5):
        //6.67 MHz or 21 MHz
        (dcorsel == CS_DCORSEL_0) ? __delay_cycles(37) : __delay_cycles(73);
        break;
    case (CS_DCOFSEL_6):
        //8 MHz or 24 MHz
        (dcorsel == CS_DCORSEL_0) ? __delay_cycles(40) : __delay_cycles(80);
        break;
    default:
        //Should not be used, but default is 8 MHz or 24 MHz
        (dcorsel == CS_DCORSEL_0) ? __delay_cycles(40) : __delay_cycles(80);
        break;
    }

    //Set all dividers
    HWREG16(CS_BASE + OFS_CSCTL3) = tempCSCTL3;

    //Lock CS control register
    HWREG8(CS_BASE + OFS_CSCTL0_H) = 0x00;
}

#endif
//*****************************************************************************
//
//! Close the doxygen group for cs_api
//! @}
//
//*****************************************************************************


text:
using namespace std;

class Camera;

class FuzzyProject
{
public:
	FuzzyProject();
	virtual ~FuzzyProject();

	WorldController* worldController;
	bool	onCreate(int argc, char* argv[]);
	void	onUpdate(float deltaTime);
	void	onDraw();
	void	onDestroy();

    //Camera*			m_camera;

    bool GLFWMouseButton1Down;
	void FuzzyLogicExample();
};


text:
<!DOCTYPE html>

    <title>Common</title>

    <link href="../styles/kendo.common.min.css" rel="stylesheet" />
    <link href="../styles/kendo.silver.min.css" rel="stylesheet" />

        <input id="date-picker" />

None selected

        <button id="destroy">Destroy</button>


text:
<?php

namespace Cute\ORM;
use \Cute\ORM\Relation;

/**
 * 一对一或多对一关系
 */
class BelongsTo extends Relation
{
    protected $foreign_key = '';

    public function __construct($model = '\\Cute\\ORM\\Model', $table = '',
                                $foreign_key = '')
    {
        parent::__construct($model, $table);
        $this->foreign_key = $foreign_key;
    }

    public function getForeignKey($name = '')
    {
        if (empty($this->foreign_key)) {
            $this->foreign_key = $name . '_id';
        }
        return $this->foreign_key;
    }

    public function relative($name, array& $result)
    {
        if (empty($result)) {
            return array();
        }
        $pkeys = exec_method_array($this->model, 'getPKeys');
        if (empty($pkeys)) {
            return array();
        }
        $fkey = $this->getForeignKey($name);
        $values = $this->getAttrs($result, $fkey);
        $query = $this->newQuery();
        $query->combine(reset($pkeys), $values, true);
        $this->setAttrs($result, $values, $name, $fkey);
        return $values;
    }
}


text:
.. nntoolkit documentation master file, created by
   sphinx-quickstart on Wed Dec  3 08:19:40 2014.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to nntoolkit's documentation!
=====================================

Contents:

.. toctree::
   :maxdepth: 2

   installation
   development
   mlps
   model-format
   data-format
   create
   train
   evaluate
   test

Code:

.. toctree::
   :maxdepth: 2

   activation_functions
   utils

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`


text:
void GainNode::connect(AudioNode* destination) {
	if(_output == NULL) {
		_node_outputs.push_back(destination);
		destination->hook(this);
		_output = destination;
	}
}

void GainNode::disconnect(AudioNode* destination) {
	if(_output != NULL && _output == destination) {
		_node_outputs.erase(std::remove(_node_outputs.begin(), _node_outputs.end(), destination), _node_outputs.end());
		destination->unhook(this); // no lookup first??
		_output = NULL;
	}
}

void GainNode::hook(AudioNode* input) {
	if(_input == NULL) {
		_node_inputs.push_back(input);
		_input = input;
	}
}

void GainNode::unhook(AudioNode* destination) {
	if(_input != NULL && _input == destination) {
		_node_inputs.erase(std::remove(_node_inputs.begin(), _node_inputs.end(), destination), _node_inputs.end());
		_input = NULL;
	}
}

void GainNode::process(int64_t& sample) {
	if(_input != NULL) {
		static int64_t s = 0;
		static uint16_t g = 0;
		_input->process(s);
		g = uint16_t(gain.val() * 65535);
		sample = g * s;
		//sample = s;
	}
}


text:
#include "trigger.h"
#include "stdio.h"
#include <sstream>
#include <string>
#include "filefunctions.h"
#include "game.h"

void Trigger::activate(Aitools *aitools, Map &world){
  Scanresult res;
  int cid;
  Creature *c;
  switch (act){
  case TA_VICTORY:
    game->complete_game();
    break;
  case TA_NONE:
    printf ("Trigger was activated, but it does nothing! %d\n",
            game->get_time());
    break;
  case TA_INTERN_TELEPORT:
    aitools->box_scan(CREATURES, res, acto.intel.lfrom->pos);
    cid = res.takeout_creature();
    while(cid != -1){
      c = aitools->identify_creature(cid);
      if (acto.intel.ctm == -1 || c->team == acto.intel.ctm){
        /* also check if he's the right type */
        world.unregister_creature(c);
        c->move_x(acto.intel.lto->pos.x + acto.intel.lto->pos.w / 2 -
                  c->pos.w / 2 - c->pos.x);
        c->move_y(acto.intel.lto->pos.y + acto.intel.lto->pos.h / 2 -
                  c->pos.h / 2 - c->pos.y);
        c->aspeed_x = 0;
        c->aspeed_y = 0;
        c->rspeed_x = 0;
        c->rspeed_y = 0;
        c->teleported();
        world.register_creature(c);
      }
      cid = res.takeout_creature();
    }
    break;
  default:
    printf ("Trigger was activated, but the action is not handeled %d!\n",
            game->get_time());
  }
}

void Trigger::set_cond(TriggerCondition newcond){
  switch (newcond){
  case TC_ENTER_LOCATION:
    condo.entloc.ltag = 0;
    break;
  default: ;
  }
  cond = newcond;
}

void Trigger::set_act(TriggerAction newact){
  switch (newact){
  case TA_INTERN_TELEPORT:
    acto.intel.frltag = -1;
    acto.intel.toltag = -1;
    acto.intel.ctm = -1;
    acto.intel.lfrom = NULL;
    acto.intel.lto = NULL;
    acto.intel.csbb = false;
    acto.intel.cpom = false;
    acto.intel.cpla = false;
    acto.intel.cblu = false;
    acto.intel.czom = false;
    break;
  default: ;
  }
  act = newact;
}

void Trigger::think(){
  printf ("trigger thinks...\n");
}

Trigger::Trigger(TriggerCondition itc, TriggerAction ita){
  cond = itc;
  act = ita;
  tag = 0;
}

Trigger::Trigger(Map *world, std::string initline){
  std::string word;
  int temp;
  TriggerCondition tc;
  TriggerAction ta;
  word = first_word(initline);
  safe_strtol(word, tag);
  word = first_word(initline);
  safe_strtol(word, temp);
  tc = (TriggerCondition)temp;
  cond = tc;
  switch (cond){
  case TC_NONE:
    break;
  case TC_ENTER_LOCATION:
    word = first_word(initline);
    safe_strtol(word, condo.entloc.ltag);
    break;
  default:
    printf("Error loading trigger: Undefined Condition %d\n", tc);
  }

  word = first_word(initline);
  safe_strtol(word, temp);
  ta= (TriggerAction)temp;
  act = ta;
  switch (act){
  case TA_NONE:
    break;
  case TA_INTERN_TELEPORT:
    word = first_word(initline); safe_strtol(word, acto.intel.frltag);
    word = first_word(initline); safe_strtol(word, acto.intel.toltag);
    word = first_word(initline); safe_strtol(word, acto.intel.ctm);

    word = first_word(initline); safe_strtol(word, acto.intel.csbb);
    word = first_word(initline); safe_strtol(word, acto.intel.cpom);
    word = first_word(initline); safe_strtol(word, acto.intel.cpla);
    word = first_word(initline); safe_strtol(word, acto.intel.cblu);
    word = first_word(initline); safe_strtol(word, acto.intel.czom);

    for (int iloc = 0; iloc < LOCATION_MAX; iloc ++){
      if (world->location[iloc] &&
          world->location[iloc]->tag == acto.intel.frltag)
        acto.intel.lfrom = world->location[iloc];
      if (world->location[iloc] &&
          world->location[iloc]->tag == acto.intel.toltag)
        acto.intel.lto = world->location[iloc];
    }
    break;
  case TA_VICTORY:
    break;
  default:
    printf("Error loading trigger: Undefined Action %d\n", ta);
  }

  for (int iloc = 0; iloc < LOCATION_MAX; iloc ++){
    if (world->location[iloc] &&
        world->location[iloc]->act_trigger == tag)
      world->location[iloc]->act_trigptr = this;
  }
}

std::string Trigger::generate_save_string(){
  stringstream ss;
  string ret, temp;
  ss << "trigger " << tag << " " << cond;
  switch (cond){
  case TC_NONE:
    break;
  case TC_ENTER_LOCATION:
    ss << " " << condo.entloc.ltag;
    break;
  /*
  case TC_ALL_ENEMIES_DEAD:
    break;
  */
  default:
    ss << " Cond_not_implemented";
  }

  ss << " " << act;
  switch (act){
  case TA_NONE:
    break;
  case TA_INTERN_TELEPORT:
    ss << " " << acto.intel.frltag;
    ss << " " << acto.intel.toltag;
    ss << " " << acto.intel.ctm;
    ss << " " << acto.intel.csbb;
    ss << " " << acto.intel.cpom;
    ss << " " << acto.intel.cpla;
    ss << " " << acto.intel.cblu;
    ss << " " << acto.intel.czom;
    break;
  case TA_VICTORY:
    break;
  default:
    ss << " Act_not_implemented";
  }

  ret = ss.str();
  return ret;
}


text:
import os.path
import subprocess

from Shade.bluetooth.Device import Device

class DeviceList():
    __connected = None
    __configured = None
    __trusted = None
    __name_to_addr = {}
    __addr_to_name = {}

    def __init__(self, devices):
        self.__devices = devices

    def __iter__(self):
        return iter(self.__devices.values())

    def names(self):
        return list(filter(
            lambda n: len(n) > 0,
            map(Device.get_name, self.__devices.values()),
        ))

    def contains(self, device):
        return device.get_addr() in self.__devices

    def get_by_name(self, name):
        addr = DeviceList.__name_to_addr.get(name)
        return self.__devices.get(addr)

    @staticmethod
    def connected():
        if DeviceList.__connected is None:
            out = subprocess.check_output(['hcitool', 'con']).strip()
            lines = out.split(b'\n')[1:]
            devices = {}
            for line in lines:
                addr = line.split(b' ')[2].decode('utf-8')
                DeviceList.__add_device(devices, addr)
            DeviceList.__connected = DeviceList(devices)
        return DeviceList.__connected

    @staticmethod
    def configured():
        if DeviceList.__configured is None:
            path = os.path.expanduser('~/.bluetooth_devices')
            lines = []
            try:
                with open(path, 'r') as f:
                    lines = f.readlines()
            except:
                # No config file.
                pass
            devices = {}
            for line in lines:
                (addr, name, ) = line.strip().split(' ', 1)
                DeviceList.__name_to_addr[name] = addr
                DeviceList.__addr_to_name[addr] = name
                devices[addr] = Device(addr, name)
            DeviceList.__configured = DeviceList(devices)
        return DeviceList.__configured

    @staticmethod
    def trusted():
        if DeviceList.__trusted is None:
            out = subprocess.check_output(['bluez-test-device', 'list']).strip()
            lines = out.split(b'\n')
            devices = {}
            for line in lines:
                if line:
                    addr = line.split(b' ', 1)[0].decode('utf-8')
                    DeviceList.__add_device(devices, addr)
            DeviceList.__trusted = DeviceList(devices)
        return DeviceList.__trusted

    @staticmethod
    def __add_device(devices, addr):
        devices[addr] = Device(
            addr,
            DeviceList.__addr_to_name.get(addr),
        )

# Initialize configured names fields.
DeviceList.configured()


text:
[![Circle CI](https://circleci.com/gh/esminc/deka_eiwakun.svg?style=svg)](https://circleci.com/gh/esminc/deka_eiwakun)

DekaEiwakun is Ruby convention in esm.
Inspired by [onkcop](https://github.com/onk/onkcop)

## Usage

Add the following directive to your `.rubocop.yml`:

```yaml
inherit_gem:
  deka_eiwakun: "config/rubocop.yml"

AllCops:
  TargetRubyVersion: 2.3
```

```sh
bundle exec rubocop <options...>
```

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'deka_eiwakun'
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/esminc/deka_eiwakun. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).


text:
<?php
header('Location: '."http://localhost/app/index.php");
?>


text:
package org.apache.nifi.annotation.behavior;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * <p>
 * Marker interface that a Processor can use to indicate whether it accepts, requires, or forbids
 * input from other Processors. This information is used by the framework in order to ensure that
 * a Processor is marked as invalid if it is missing necessary input or has input that will be ignored.
 * This information also is used by the NiFi UI in order to prevent users from making connections
 * to Processors that don't make sense.
 * </p>
 */
@Documented
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface InputRequirement {
    Requirement value();

    enum Requirement {
        /**
         * This value is used to indicate that the Processor requires input from other Processors
         * in order to run. As a result, the Processor will not be valid if it does not have any
         * incoming connections.
         */
        INPUT_REQUIRED,

        /**
         * This value is used to indicate that the Processor will consume data from an incoming
         * connection but does not require an incoming connection in order to perform its task.
         * If the {@link InputRequirement} annotation is not present, this is the default value
         * that is used.
         */
        INPUT_ALLOWED,

        /**
         * This value is used to indicate that the Processor is a "Source Processor" and does
         * not accept incoming connections. Because the Processor does not pull FlowFiles from
         * an incoming connection, it can be very confusing for users who create incoming connections
         * to the Processor. As a result, this value can be used in order to clarify that incoming
         * connections will not be used. This prevents the user from even creating such a connection.
         */
        INPUT_FORBIDDEN;
    }
}


text:
var baseValues = require('../internal/baseValues'),
    keys = require('./keys');

/**
 * Creates an array of the own enumerable property values of `object`.
 *
 * **Note:** Non-object values are coerced to objects.
 *
 * @static
 * @memberOf _
 * @category Object
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property values.
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 *   this.b = 2;
 * }
 *
 * Foo.prototype.c = 3;
 *
 * _.values(new Foo);
 * // => [1, 2] (iteration order is not guaranteed)
 *
 * _.values('hi');
 * // => ['h', 'i']
 */
function values(object) {
    return baseValues(object, keys(object));
}

module.exports = values;


text:
#if !defined(BOOST_FUSION_COUNT_IF_09162005_0137)
#define BOOST_FUSION_COUNT_IF_09162005_0137

#include <boost/fusion/support/config.hpp>
#include <boost/fusion/algorithm/query/detail/count_if.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>

namespace boost { namespace fusion
{
    namespace result_of
    {
        template <typename Sequence, typename F>
        struct count_if
        {
            typedef int type;
        };
    }

    template <typename Sequence, typename F>
    BOOST_FUSION_GPU_ENABLED
    inline
    typename
        enable_if<
            traits::is_sequence<Sequence>
          , int
        >::type
    count_if(Sequence const& seq, F f)
    {
        return detail::count_if(
            seq, f, typename traits::category_of<Sequence>::type());
    }
}}

#endif