text:
import React, { Component } from "react";
import { Slider, Rail, Handles, Tracks, Ticks } from "react-compound-slider";
import ValueViewer from "../ValueViewer";
import { SliderRail, Handle, Track, Tick } from "./components";

const sliderStyle = {
  position: "relative" as "relative",
  width: "100%",
};

const domain = [100, 500];
const defaultValues = [150, 300, 400, 450];

export class Example2 extends Component {
  state = {
    values: defaultValues.slice(),
    update: defaultValues.slice(),
  };

  onUpdate = (update: ReadonlyArray<number>) => {
    this.setState({ update });
  };

  onChange = (values: ReadonlyArray<number>) => {
    this.setState({ values });
  };

  render() {
    const {
      state: { values, update },
    } = this;

    return (

        <ValueViewer values={values} update={update} />
        <Slider
          mode={2}
          step={5}
          domain={domain}
          rootStyle={sliderStyle}
          onUpdate={this.onUpdate}
          onChange={this.onChange}
          values={values}
        >
          <Rail>
            {({ getRailProps }) => <SliderRail getRailProps={getRailProps} />}
          </Rail>
          <Handles>
            {({ handles, getHandleProps }) => (

                {handles.map(handle => (
                  <Handle
                    key={handle.id}
                    handle={handle}
                    domain={domain}
                    getHandleProps={getHandleProps}
                  />
                ))}

            )}
          </Handles>
          <Tracks left={false} right={false}>
            {({ tracks, getTrackProps }) => (

                {tracks.map(({ id, source, target }) => (
                  <Track
                    key={id}
                    source={source}
                    target={target}
                    getTrackProps={getTrackProps}
                  />
                ))}

            )}
          </Tracks>
          <Ticks count={5}>
            {({ ticks }) => (

                {ticks.map(tick => (
                  <Tick key={tick.id} tick={tick} count={ticks.length} />
                ))}

            )}
          </Ticks>
        </Slider>

    );
  }
}


text:
from twext.python.filepath import CachingFilePath as FilePath
from txweb2 import responsecode
from txweb2.dav.util import davXMLFromStream, joinURL
from txweb2.http_headers import Headers, MimeType
from txweb2.iweb import IResponse
from txweb2.stream import MemoryStream

from twisted.internet.defer import inlineCallbacks, returnValue

from twistedcaldav import caldavxml
from twistedcaldav import ical
from twistedcaldav.config import config
from twistedcaldav.test.util import todo, StoreTestCase, SimpleStoreRequest

from txdav.xml import element as davxml

import os

class CalendarMultiget (StoreTestCase):
    """
    calendar-multiget REPORT
    """
    data_dir = os.path.join(os.path.dirname(__file__), "data")
    holidays_dir = os.path.join(data_dir, "Holidays")

    @inlineCallbacks
    def setUp(self):
        yield StoreTestCase.setUp(self)
        self.authPrincipal = yield self.actualRoot.findPrincipalForAuthID("wsanchez")

    def test_multiget_some_events(self):
        """
        All events.
        (CalDAV-access-09, section 7.6.8)
        """
        okuids = [r[0] for r in (os.path.splitext(f) for f in os.listdir(self.holidays_dir)) if r[1] == ".ics"]
        okuids[:] = okuids[1:10]

        baduids = ["12345%40example.com", "67890%40example.com"]

        return self.simple_event_multiget("/calendar_multiget_events/", okuids, baduids)

    def test_multiget_all_events(self):
        """
        All events.
        (CalDAV-access-09, section 7.6.8)
        """
        okuids = [r[0] for r in (os.path.splitext(f) for f in os.listdir(self.holidays_dir)) if r[1] == ".ics"]

        baduids = ["12345%40example.com", "67890%40example.com"]

        return self.simple_event_multiget("/calendar_multiget_events/", okuids, baduids)

    def test_multiget_limited_with_data(self):
        """
        All events.
        (CalDAV-access-09, section 7.6.8)
        """
        oldValue = config.MaxMultigetWithDataHrefs
        config.MaxMultigetWithDataHrefs = 1

        def _restoreValueOK(f):
            config.MaxMultigetWithDataHrefs = oldValue
            self.fail("REPORT must fail with 403")

        def _restoreValueError(f):
            config.MaxMultigetWithDataHrefs = oldValue
            return None

        okuids = [r[0] for r in (os.path.splitext(f) for f in os.listdir(self.holidays_dir)) if r[1] == ".ics"]

        baduids = ["12345%40example.com", "67890%40example.com"]

        d = self.simple_event_multiget("/calendar_multiget_events/", okuids, baduids)
        d.addCallbacks(_restoreValueOK, _restoreValueError)
        return d

    def test_multiget_limited_no_data(self):
        """
        All events.
        (CalDAV-access-09, section 7.6.8)
        """
        oldValue = config.MaxMultigetWithDataHrefs
        config.MaxMultigetWithDataHrefs = 1

        def _restoreValueOK(f):
            config.MaxMultigetWithDataHrefs = oldValue
            return None

        def _restoreValueError(f):
            config.MaxMultigetWithDataHrefs = oldValue
            self.fail("REPORT must not fail with 403")

        okuids = [r[0] for r in (os.path.splitext(f) for f in os.listdir(self.holidays_dir)) if r[1] == ".ics"]

        baduids = ["12345%40example.com", "67890%40example.com"]

        return self.simple_event_multiget("/calendar_multiget_events/", okuids, baduids, withData=False)

    @todo("Remove: Does not work with new store")
    @inlineCallbacks
    def test_multiget_one_broken_event(self):
        """
        All events.
        (CalDAV-access-09, section 7.6.8)
        """
        okuids = ["good", "bad", ]
        baduids = []
        data = {
            "good": """BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//Apple Computer\, Inc//iCal 2.0//EN
VERSION:2.0
BEGIN:VEVENT
UID:good
DTSTART;VALUE=DATE:20020101
DTEND;VALUE=DATE:20020102
DTSTAMP:20020101T121212Z
RRULE:FREQ=YEARLY;INTERVAL=1;UNTIL=20031231;BYMONTH=1
SUMMARY:New Year's Day
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n"),
            "bad": """BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//Apple Computer\, Inc//iCal 2.0//EN
VERSION:2.0
BEGIN:VEVENT
UID:bad
DTSTART;VALUE=DATE:20020214
DTEND;VALUE=DATE:20020215
DTSTAMP:20020101T121212Z
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=2
SUMMARY:Valentine's Day
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
        }

        yield self.simple_event_multiget("/calendar_multiget_events/", okuids, baduids, data)

        # Now forcibly corrupt one piece of calendar data
        calendar_path = os.path.join(self.docroot, "calendar_multiget_events/", "bad.ics")
        with open(calendar_path, "w") as f:
            f.write("""BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//Apple Computer\, Inc//iCal 2.0//EN
VERSION:2.0
BEGIN:VEVENT
UID:bad
DTSTART;VALUE=DATE:20020214
DTEND;VALUE=DATE:20020
DTSTAMP:20020101T121212Z
END:VCALENDAR
""".replace("\n", "\r\n"))

        okuids = ["good", ]
        baduids = ["bad", ]
        yield self.simple_event_multiget("/calendar_multiget_events/", okuids, baduids, data, no_init=True)

    def simple_event_multiget(self, cal_uri, okuids, baduids, data=None, no_init=False, withData=True):

        cal_uri = joinURL("/calendars/users/wsanchez", cal_uri)
        props = (
            davxml.GETETag(),
        )
        if withData:
            props += (
                caldavxml.CalendarData(),
            )
        children = []
        children.append(davxml.PropertyContainer(*props))

        okhrefs = [joinURL(cal_uri, x + ".ics") for x in okuids]
        badhrefs = [joinURL(cal_uri, x + ".ics") for x in baduids]
        for href in okhrefs + badhrefs:
            children.append(davxml.HRef.fromString(href))

        query = caldavxml.CalendarMultiGet(*children)

        def got_xml(doc):
            if not isinstance(doc.root_element, davxml.MultiStatus):
                self.fail("REPORT response XML root element is not multistatus: %r" % (doc.root_element,))

            for response in doc.root_element.childrenOfType(davxml.PropertyStatusResponse):
                href = str(response.childOfType(davxml.HRef))
                for propstat in response.childrenOfType(davxml.PropertyStatus):
                    status = propstat.childOfType(davxml.Status)

                    if status.code != responsecode.OK:
                        self.fail(
                            "REPORT failed (status %s) to locate properties: %r"
                            % (status.code, href))

                    properties = propstat.childOfType(davxml.PropertyContainer).children

                    for property in properties:
                        qname = property.qname()
                        if qname == (davxml.dav_namespace, "getetag"):
                            continue
                        if qname != (caldavxml.caldav_namespace, "calendar-data"):
                            self.fail("Response included unexpected property %r" % (property,))

                        result_calendar = property.calendar()

                        if result_calendar is None:
                            self.fail("Invalid response CalDAV:calendar-data: %r" % (property,))

                        uid = result_calendar.resourceUID()

                        if uid in okuids:
                            okuids.remove(uid)
                        else:
                            self.fail("Got calendar for unexpected UID %r" % (uid,))

                        if data:
                            original_calendar = ical.Component.fromString(data[uid])
                        else:
                            original_filename = file(os.path.join(self.holidays_dir, uid + ".ics"))
                            original_calendar = ical.Component.fromStream(original_filename)

                        self.assertEqual(result_calendar, original_calendar)

            for response in doc.root_element.childrenOfType(davxml.StatusResponse):
                href = str(response.childOfType(davxml.HRef))
                propstatus = response.childOfType(davxml.PropertyStatus)
                if propstatus is not None:
                    status = propstatus.childOfType(davxml.Status)
                else:
                    status = response.childOfType(davxml.Status)
                if status.code != responsecode.OK:
                    if href in okhrefs:
                        self.fail(
                            "REPORT failed (status %s) to locate properties: %r"
                            % (status.code, href))
                    else:
                        if href in badhrefs:
                            badhrefs.remove(href)
                            continue
                        else:
                            self.fail("Got unexpected href %r" % (href,))

            if withData and (len(okuids) + len(badhrefs)):
                self.fail("Some components were not returned: %r, %r" % (okuids, badhrefs))

        return self.calendar_query(cal_uri, query, got_xml, data, no_init)

    @inlineCallbacks
    def calendar_query(self, calendar_uri, query, got_xml, data, no_init):

        if not no_init:
            response = yield self.send(SimpleStoreRequest(self, "MKCALENDAR", calendar_uri, authPrincipal=self.authPrincipal))
            response = IResponse(response)
            if response.code != responsecode.CREATED:
                self.fail("MKCALENDAR failed: %s" % (response.code,))

            if data:
                for filename, icaldata in data.iteritems():
                    request = SimpleStoreRequest(
                        self,
                        "PUT",
                        joinURL(calendar_uri, filename + ".ics"),
                        headers=Headers({"content-type": MimeType.fromString("text/calendar")}),
                        authPrincipal=self.authPrincipal
                    )
                    request.stream = MemoryStream(icaldata)
                    yield self.send(request)
            else:
                # Add holiday events to calendar
                for child in FilePath(self.holidays_dir).children():
                    if os.path.splitext(child.basename())[1] != ".ics":
                        continue
                    request = SimpleStoreRequest(
                        self,
                        "PUT",
                        joinURL(calendar_uri, child.basename()),
                        headers=Headers({"content-type": MimeType.fromString("text/calendar")}),
                        authPrincipal=self.authPrincipal
                    )
                    request.stream = MemoryStream(child.getContent())
                    yield self.send(request)

        request = SimpleStoreRequest(self, "REPORT", calendar_uri, authPrincipal=self.authPrincipal)
        request.stream = MemoryStream(query.toxml())
        response = yield self.send(request)

        response = IResponse(response)

        if response.code != responsecode.MULTI_STATUS:
            self.fail("REPORT failed: %s" % (response.code,))

        returnValue(
            (yield davXMLFromStream(response.stream).addCallback(got_xml))
        )

redpajama_set_name: RedPajamaGithub


text:
require 'dm-core'

module DataMapper
  module Is
    module Tree
      def self.included(base)
        base.extend(ClassMethods)
      end

      # An extension to DataMapper to easily allow the creation of tree
      # structures from your DataMapper models.
      # This requires a foreign key property for your model, which by default
      # would be called :parent_id.
      #
      #   Example:
      #
      #   class Category
      #     include DataMapper::Resource
      #
      #     property :id, Serial
      #     property :parent_id, Integer
      #     property :name, String
      #
      #     is :tree, :order => :name
      #   end
      #
      #    root
      #      +- child
      #          +- grandchild1
      #          +- grandchild2
      #
      #   root = Category.create(:name => "root")
      #   child = root.children.create(:name => "child")
      #   grandchild1 = child1.children.create(:name => "grandchild1")
      #   grandchild2 = child2.children.create(:name => "grandchild2")
      #
      #   root.parent  # => nil
      #   child.parent  # => root
      #   root.children  # => [child]
      #   root.children.first.children.first  # => grandchild1
      #   Category.first_root  # => root
      #   Category.roots  # => [root]
      #
      # The following instance methods are added:
      # * <tt>children</tt> - Returns all nodes with the current node as their parent, in the order specified by
      #   <tt>:order</tt> (<tt>[grandchild1, grandchild2]</tt> when called on <tt>child</tt>)
      # * <tt>parent</tt> - Returns the node referenced by the foreign key (<tt>:parent_id</tt> by
      #   default) (<tt>root</tt> when called on <tt>child</tt>)
      # * <tt>siblings</tt> - Returns all the children of the parent, excluding the current node
      #   (<tt>[grandchild2]</tt> when called on <tt>grandchild1</tt>)
      # * <tt>generation</tt> - Returns all the children of the parent, including the current node (<tt>
      #   [grandchild1, grandchild2]</tt> when called on <tt>grandchild1</tt>)
      # * <tt>ancestors</tt> - Returns all the ancestors of the current node (<tt>[root, child1]</tt>
      #   when called on <tt>grandchild2</tt>)
      # * <tt>root</tt> - Returns the root of the current node (<tt>root</tt> when called on <tt>grandchild2</tt>)
      #
      # Original Author:: Timothy Bennett (http://lanaer.com)
      # Current Maintainer:: Garrett Heaver (http://www.linkedin.com/pub/dir/garrett/heaver)

      # Configuration options are:
      #
      # * <tt>child_key</tt> - specifies the column name to use for tracking of the tree (default: +parent_id+)
      # * <tt>constraint</tt> - allows a constraint option to be set on the `has n` association. Only valid when dm-constraints is used.
      def is_tree(options = {})

        if options[:class_name]
          warn '+options[:class_name]+ is deprecated, use :model instead'
          options[:model] = options.delete(:class_name)
        end

        options = { :model => name, :child_key => :parent_id }.merge(options) if Hash === options
        @tree_options = options

        include DataMapper::Is::Tree::InstanceMethods
        extend  DataMapper::Is::Tree::ClassMethods

        assc_options = { :model => options[:model], :child_key => Array(options[:child_key]) }
        has_n_options = options[:order] ? { :order => Array(options[:order]) }.merge(assc_options) : assc_options
        has_n_options.merge!(:constraint => options[:constraint]) if options[:constraint]

        belongs_to :parent, assc_options.merge(:required => false)
        has n, :children, has_n_options

        class << self
          alias_method :root, :first_root # for people used to the ActiveRecord acts_as_tree
        end
      end

      def is_a_tree(options = {})
        warn('#is_a_tree is depreciated. use #is :tree instead.')
        is :tree, options
      end
      alias_method :can_has_tree, :is_tree # just for fun ;)

      module ClassMethods
        attr_reader :tree_options

        def roots
          options = { tree_options[:child_key] => nil }
          options = { :order => Array(tree_options[:order]) }.merge(options) if tree_options[:order]
          all(options)
        end

        def first_root
          options = { tree_options[:child_key] => nil }
          options = { :order => Array(tree_options[:order]) }.merge(options) if tree_options[:order]
          first(options)
        end
      end

      module InstanceMethods

        # Returns list of ancestors, starting with the root.
        #
        #   grandchild1.ancestors # => [root, child]
        def ancestors
          node, nodes = self, []
          nodes << node = node.parent while node.parent
          nodes.reverse
        end

        # Returns a list of anchestors and self, starting with the root
        #
        #  grandchild1.ancestors_with_self # => [root, child, grandchild]
        #
        def ancestors_with_self
          ancestors << self
        end

        # Returns the root node of the current node's tree.
        #
        #   grandchild1.root # => root
        def root
          node = self
          node = node.parent while node.parent
          node
        end
        alias_method :first_root, :root

        # Returns all children recursively
        def all_children
          all_children = []
          children.each do |child|
            all_children << child
            all_children.concat child.all_children
          end
          all_children
        end

        # Returns all siblings of the current node.
        #
        #   grandchild1.siblings # => [grandchild2]
        def siblings
          generation.reject{|r| r.key == self.key }
        end

        # Returns all children of the current node's parent.
        #
        #   grandchild1.generation # => [grandchild1, grandchild2]
        def generation
          parent ? parent.children : self.class.roots
        end
        alias_method :self_and_siblings, :generation # for those used to the ActiveRecord acts_as_tree

      end

      Model.send(:include, self)
    end # Tree
  end # Is
end # DataMapper


text:
<?php

namespace Oro\Bundle\SearchBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;

use Oro\Bundle\SearchBundle\Engine\Indexer;
use Oro\Bundle\SearchBundle\Query\Query as SearchQuery;

/**
 * Search index items that correspond to specific entity record
 *
 * @ORM\Table(
 *  name="oro_search_item",
 *  uniqueConstraints={@ORM\UniqueConstraint(name="IDX_ENTITY", columns={"entity", "record_id"})},
 *  indexes={@ORM\Index(name="IDX_ALIAS", columns={"alias"}), @ORM\Index(name="IDX_ENTITIES", columns={"entity"})}
 * )
 * @ORM\Entity(repositoryClass="Oro\Bundle\SearchBundle\Entity\Repository\SearchIndexRepository")
 * @ORM\HasLifecycleCallbacks
 * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
 */
class Item
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string $entity
     *
     * @ORM\Column(name="entity", type="string", length=255)
     */
    protected $entity;

    /**
     * @var string $alias
     *
     * @ORM\Column(name="alias", type="string", length=255)
     */
    protected $alias;

    /**
     * @var integer $record_id
     *
     * @ORM\Column(name="record_id", type="integer", nullable=true)
     */
    protected $recordId;

    /**
     * @var string $title
     * @ORM\Column(name="title", type="string", length=255, nullable=true)
     */
    protected $title;

    /**
     * @var bool $changed
     *
     * @ORM\Column(name="changed", type="boolean")
     */
    protected $changed = false;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="created_at", type="datetime")
     */
    protected $createdAt;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="updated_at", type="datetime")
     */
    protected $updatedAt;

    /**
     * @ORM\OneToMany(targetEntity="IndexText", mappedBy="item", cascade={"all"}, orphanRemoval=true)
     */
    private $textFields;

    /**
     * @ORM\OneToMany(targetEntity="IndexInteger", mappedBy="item", cascade={"all"}, orphanRemoval=true)
     */
    private $integerFields;

    /**
     * @ORM\OneToMany(targetEntity="IndexDecimal", mappedBy="item", cascade={"all"}, orphanRemoval=true)
     */
    private $decimalFields;

    /**
     * @ORM\OneToMany(targetEntity="IndexDatetime", mappedBy="item", cascade={"all"}, orphanRemoval=true)
     */
    private $datetimeFields;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->textFields = new ArrayCollection();
        $this->integerFields = new ArrayCollection();
        $this->decimalFields = new ArrayCollection();
        $this->datetimeFields = new ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set entity
     *
     * @param  string $entity
     *
     * @return Item
     */
    public function setEntity($entity)
    {
        $this->entity = $entity;

        return $this;
    }

    /**
     * Get entity
     *
     * @return string
     */
    public function getEntity()
    {
        return $this->entity;
    }

    /**
     * Set recordId
     *
     * @param  integer $recordId
     *
     * @return Item
     */
    public function setRecordId($recordId)
    {
        $this->recordId = $recordId;

        return $this;
    }

    /**
     * Get recordId
     *
     * @return integer
     */
    public function getRecordId()
    {
        return $this->recordId;
    }

    /**
     * Set changed
     *
     * @param  boolean $changed
     *
     * @return Item
     */
    public function setChanged($changed)
    {
        $this->changed = (bool)$changed;

        return $this;
    }

    /**
     * Get changed
     *
     * @return boolean
     */
    public function getChanged()
    {
        return $this->changed;
    }

    /**
     * Add integerFields
     *
     * @param  IndexInteger $integerFields
     *
     * @return Item
     */
    public function addIntegerField(IndexInteger $integerFields)
    {
        $this->integerFields[] = $integerFields;

        return $this;
    }

    /**
     * Remove integerFields
     *
     * @param IndexInteger $integerFields
     */
    public function removeIntegerField(IndexInteger $integerFields)
    {
        $this->integerFields->removeElement($integerFields);
    }

    /**
     * Get integerFields
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getIntegerFields()
    {
        return $this->integerFields;
    }

    /**
     * Add decimalFields
     *
     * @param  IndexDecimal $decimalFields
     *
     * @return Item
     */
    public function addDecimalField(IndexDecimal $decimalFields)
    {
        $this->decimalFields[] = $decimalFields;

        return $this;
    }

    /**
     * Remove decimalFields
     *
     * @param IndexDecimal $decimalFields
     */
    public function removeDecimalField(IndexDecimal $decimalFields)
    {
        $this->decimalFields->removeElement($decimalFields);
    }

    /**
     * Get decimalFields
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getDecimalFields()
    {
        return $this->decimalFields;
    }

    /**
     * Add datetimeFields
     *
     * @param  IndexDatetime $datetimeFields
     *
     * @return Item
     */
    public function addDatetimeField(IndexDatetime $datetimeFields)
    {
        $this->datetimeFields[] = $datetimeFields;

        return $this;
    }

    /**
     * Remove datetimeFields
     *
     * @param  IndexDatetime $datetimeFields
     *
     * @return Item
     */
    public function removeDatetimeField(IndexDatetime $datetimeFields)
    {
        $this->datetimeFields->removeElement($datetimeFields);

        return $this;
    }

    /**
     * Get datetimeFields
     *
     * @return \Doctrine\Common\Collections\ArrayCollection
     */
    public function getDatetimeFields()
    {
        return $this->datetimeFields;
    }

    /**
     * Add text fields
     *
     * @param  IndexText $textFields
     *
     * @return Item
     */
    public function addTextField(IndexText $textFields)
    {
        $this->textFields[] = $textFields;

        return $this;
    }

    /**
     * Remove text fields
     *
     * @param  IndexText $textFields
     *
     * @return Item
     */
    public function removeTextField(IndexText $textFields)
    {
        $this->textFields->removeElement($textFields);

        return $this;
    }

    /**
     * Get text fields
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getTextFields()
    {
        return $this->textFields;
    }

    /**
     * Pre persist event listener
     * @ORM\PrePersist
     */
    public function beforeSave()
    {
        $this->createdAt = new \DateTime('now', new \DateTimeZone('UTC'));
        $this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC'));
    }

    /**
     * Pre update event listener
     * @ORM\PreUpdate
     */
    public function beforeUpdate()
    {
        $this->updatedAt = new \DateTime('now', new \DateTimeZone('UTC'));
    }

    /**
     * Set createdAt
     *
     * @param  \DateTime $createdAt
     *
     * @return Item
     */
    public function setCreatedAt(\DateTime $createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

    /**
     * Get createdAt
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set updatedAt
     *
     * @param \DateTime $updatedAt
     *
     * @return Item
     */
    public function setUpdatedAt(\DateTime $updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    /**
     * Get updatedAt
     *
     * @return \DateTime
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    /**
     * Save index item data
     *
     * @param array $objectData
     *
     * @return Item
     */
    public function saveItemData($objectData)
    {
        $this->saveData($objectData, $this->textFields, new IndexText(), SearchQuery::TYPE_TEXT);
        $this->saveData($objectData, $this->integerFields, new IndexInteger(), SearchQuery::TYPE_INTEGER);
        $this->saveData($objectData, $this->datetimeFields, new IndexDatetime(), SearchQuery::TYPE_DATETIME);
        $this->saveData($objectData, $this->decimalFields, new IndexDecimal(), SearchQuery::TYPE_DECIMAL);

        return $this;
    }

    /**
     * Set alias
     *
     * @param  string $alias
     *
     * @return Item
     */
    public function setAlias($alias)
    {
        $this->alias = $alias;

        return $this;
    }

    /**
     * Get alias
     *
     * @return string
     */
    public function getAlias()
    {
        return $this->alias;
    }

    /**
     * Set title
     *
     * @param  string $title
     *
     * @return Item
     */
    public function setTitle($title)
    {
        $this->title = $title;

        return $this;
    }

    /**
     * Get title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * @return string
     */
    public function getRecordText()
    {
        $recordText = '';
        /** @var IndexText $textField */
        foreach ($this->textFields as $textField) {
            if ($textField->getField() == Indexer::TEXT_ALL_DATA_FIELD) {
                $recordText = $textField->getValue();
            }
        }

        return $recordText;
    }

    /**
     * @param array  $objectData
     * @param Collection $fields
     * @param object $newRecord
     * @param string $type
     */
    protected function saveData($objectData, Collection $fields, $newRecord, $type)
    {
        if (isset($objectData[$type]) && count($objectData[$type])) {
            $itemData = $objectData[$type];
            $updatedTextFields = array();
            foreach ($itemData as $fieldName => $fieldData) {
                if (!is_array($fieldData)) {
                    foreach ($fields as $index => $collectionElement) {
                        //update fields
                        if ($fieldName == $collectionElement->getField()) {
                            $collectionElement->setValue($fieldData);
                            $updatedTextFields[$index] = $index;
                            unset($itemData[$fieldName]);
                        }
                    }
                } else {
                    $this->deleteArrayFields($fields, $fieldName);
                }
            }
            //delete fields
            if (count($updatedTextFields) < count($this->textFields)) {
                foreach ($this->textFields as $index => $collectionElement) {
                    if (!array_key_exists($index, $updatedTextFields)) {
                        $fields->removeElement($collectionElement);
                    }
                }
            }
            //add new fields
            if (isset($itemData) && count($itemData)) {
                foreach ($itemData as $fieldName => $fieldData) {
                    $this->addFieldData($fieldName, $fieldData, $fields, $newRecord);
                }
            }
        }
    }

    /**
     * @param string $fieldName
     * @param mixed $fieldData
     * @param Collection $fields
     * @param object $newRecord
     */
    protected function addFieldData($fieldName, $fieldData, Collection $fields, $newRecord)
    {
        if (!is_array($fieldData)) {
            $fieldData = [$fieldData];
        }
        foreach ($fieldData as $data) {
            $record = clone $newRecord;
            $this->setFieldData($record, $fieldName, $data);
            $fields->add($record);
        }
    }

    /**
     * @param Collection $fields
     * @param string $fieldName
     */
    protected function deleteArrayFields(Collection $fields, $fieldName)
    {
        $fieldsToDelete = $fields->filter(
            function ($valueEntity) use ($fieldName) {
                /** @var IndexInteger|IndexText|IndexDatetime|IndexDecimal $valueEntity */
                return $valueEntity->getField() === $fieldName;
            }
        );
        if (!empty($fieldsToDelete)) {
            foreach ($fieldsToDelete as $fieldElement) {
                $fields->removeElement($fieldElement);
            }
        }
    }

    /**
     * Set record parameters
     *
     * @param object $record
     * @param string $fieldName
     * @param mixed  $fieldData
     */
    private function setFieldData($record, $fieldName, $fieldData)
    {
        $record->setField($fieldName)
            ->setValue($fieldData)
            ->setItem($this);
    }
}


text:
#include "test_intrusive_set_hp.h"

#include <cds/intrusive/lazy_list_dhp.h>
#include <cds/intrusive/michael_set.h>

#include <mutex>

namespace {
    namespace ci = cds::intrusive;
    typedef cds::gc::DHP gc_type;

    class IntrusiveMichaelLazySet_DHP : public cds_test::intrusive_set_hp
    {
    protected:
        typedef cds_test::intrusive_set_hp base_class;

    protected:
        typedef typename base_class::base_int_item< ci::lazy_list::node<gc_type>>   base_item_type;
        typedef typename base_class::base_int_item< ci::lazy_list::node<gc_type, std::mutex>>   base_mutex_item_type;
        typedef typename base_class::member_int_item< ci::lazy_list::node<gc_type>> member_item_type;
        typedef typename base_class::member_int_item< ci::lazy_list::node<gc_type, std::mutex>> member_mutex_item_type;

        void SetUp()
        {
            struct list_traits : public ci::lazy_list::traits
            {
                typedef ci::lazy_list::base_hook< ci::opt::gc<gc_type>> hook;
            };
            typedef ci::LazyList< gc_type, base_item_type, list_traits > list_type;
            typedef ci::MichaelHashSet< gc_type, list_type >   set_type;

            cds::gc::dhp::GarbageCollector::Construct( 16, set_type::c_nHazardPtrCount );
            cds::threading::Manager::attachThread();
        }

        void TearDown()
        {
            cds::threading::Manager::detachThread();
            cds::gc::dhp::GarbageCollector::Destruct();
        }
    };

    TEST_F( IntrusiveMichaelLazySet_DHP, base_cmp )
    {
        typedef ci::LazyList< gc_type
            , base_item_type
            ,ci::lazy_list::make_traits<
                ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type > > >
                ,ci::opt::compare< cmp<base_item_type> >
                ,ci::opt::disposer< mock_disposer >
                ,ci::opt::back_off< cds::backoff::pause >
            >::type
        > bucket_type;

        typedef ci::MichaelHashSet< gc_type, bucket_type,
            ci::michael_set::make_traits<
                ci::opt::hash< hash_int >
            >::type
        > set_type;

        set_type s( kSize, 2 );
        test( s );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, base_less )
    {
        typedef ci::LazyList< gc_type
            , base_item_type
            ,ci::lazy_list::make_traits<
                ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type >>>
                ,ci::opt::less< less<base_item_type> >
                ,ci::opt::disposer< mock_disposer >
            >::type
        > bucket_type;

        typedef ci::MichaelHashSet< gc_type, bucket_type,
            ci::michael_set::make_traits<
                ci::opt::hash< hash_int >
            >::type
        > set_type;

        set_type s( kSize, 2 );
        test( s );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, base_cmpmix )
    {
        struct list_traits : public ci::lazy_list::traits
        {
            typedef ci::lazy_list::base_hook< ci::opt::gc<gc_type>> hook;
            typedef base_class::less<base_item_type> less;
            typedef cmp<base_item_type> compare;
            typedef mock_disposer disposer;
        };
        typedef ci::LazyList< gc_type, base_item_type, list_traits > bucket_type;

        struct set_traits : public ci::michael_set::traits
        {
            typedef hash_int hash;
            typedef simple_item_counter item_counter;
        };
        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;

        set_type s( kSize, 2 );
        test( s );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, base_mutex )
    {
        struct list_traits : public ci::lazy_list::traits
        {
            typedef ci::lazy_list::base_hook< ci::opt::gc<gc_type>, ci::opt::lock_type<std::mutex>> hook;
            typedef base_class::less<base_mutex_item_type> less;
            typedef cmp<base_mutex_item_type> compare;
            typedef mock_disposer disposer;
        };
        typedef ci::LazyList< gc_type, base_mutex_item_type, list_traits > bucket_type;

        struct set_traits : public ci::michael_set::traits
        {
            typedef hash_int hash;
            typedef simple_item_counter item_counter;
        };
        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;

        set_type s( kSize, 2 );
        test( s );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, base_stat )
    {
        struct list_traits: public ci::lazy_list::traits
        {
            typedef ci::lazy_list::base_hook< ci::opt::gc<gc_type>> hook;
            typedef base_class::less<base_item_type> less;
            typedef mock_disposer disposer;
            typedef ci::lazy_list::stat<> stat;
        };
        typedef ci::LazyList< gc_type, base_item_type, list_traits > bucket_type;

        struct set_traits: public ci::michael_set::traits
        {
            typedef hash_int hash;
            typedef simple_item_counter item_counter;
        };
        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;

        set_type s( kSize, 2 );
        test( s );
        EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, base_wrapped_stat )
    {
        struct list_traits: public ci::lazy_list::traits
        {
            typedef ci::lazy_list::base_hook< ci::opt::gc<gc_type>> hook;
            typedef base_class::less<base_item_type> less;
            typedef mock_disposer disposer;
            typedef ci::lazy_list::wrapped_stat<> stat;
        };
        typedef ci::LazyList< gc_type, base_item_type, list_traits > bucket_type;

        struct set_traits: public ci::michael_set::traits
        {
            typedef hash_int hash;
            typedef simple_item_counter item_counter;
        };
        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;

        set_type s( kSize, 2 );
        test( s );
        EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, member_cmp )
    {
        typedef ci::LazyList< gc_type
            ,member_item_type
            ,ci::lazy_list::make_traits<
                ci::opt::hook< ci::lazy_list::member_hook<
                    offsetof( member_item_type, hMember ),
                    ci::opt::gc<gc_type>
                > >
                ,ci::opt::compare< cmp<member_item_type> >
                ,ci::opt::disposer< mock_disposer >
            >::type
        >    bucket_type;

        typedef ci::MichaelHashSet< gc_type, bucket_type,
            ci::michael_set::make_traits<
                ci::opt::hash< hash_int >
            >::type
        > set_type;

        set_type s( kSize, 2 );
        test( s );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, member_less )
    {
        typedef ci::LazyList< gc_type
            , member_item_type
            ,ci::lazy_list::make_traits<
                ci::opt::hook< ci::lazy_list::member_hook<
                    offsetof( member_item_type, hMember ),
                    ci::opt::gc<gc_type>
                > >
                ,ci::opt::less< less<member_item_type> >
                ,ci::opt::disposer< mock_disposer >
            >::type
        > bucket_type;

        typedef ci::MichaelHashSet< gc_type, bucket_type,
            ci::michael_set::make_traits<
                ci::opt::hash< hash_int >
            >::type
        > set_type;

        set_type s( kSize, 2 );
        test( s );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, member_cmpmix )
    {
        struct list_traits : public ci::lazy_list::traits
        {
            typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
            typedef base_class::less<member_item_type> less;
            typedef cmp<member_item_type> compare;
            typedef mock_disposer disposer;
        };
        typedef ci::LazyList< gc_type, member_item_type, list_traits > bucket_type;

        struct set_traits : public ci::michael_set::traits
        {
            typedef hash_int hash;
            typedef simple_item_counter item_counter;
        };
        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;

        set_type s( kSize, 2 );
        test( s );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, member_mutex )
    {
        struct list_traits : public ci::lazy_list::traits
        {
            typedef ci::lazy_list::member_hook< offsetof( member_mutex_item_type, hMember ), ci::opt::gc<gc_type>, ci::opt::lock_type<std::mutex>> hook;
            typedef base_class::less<member_mutex_item_type> less;
            typedef cmp<member_mutex_item_type> compare;
            typedef mock_disposer disposer;
        };
        typedef ci::LazyList< gc_type, member_mutex_item_type, list_traits > bucket_type;

        struct set_traits : public ci::michael_set::traits
        {
            typedef hash_int hash;
            typedef simple_item_counter item_counter;
        };
        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;

        set_type s( kSize, 2 );
        test( s );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, member_stat )
    {
        struct list_traits: public ci::lazy_list::traits
        {
            typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
            typedef cmp<member_item_type> compare;
            typedef mock_disposer disposer;
            typedef ci::lazy_list::stat<> stat;
        };
        typedef ci::LazyList< gc_type, member_item_type, list_traits > bucket_type;

        struct set_traits: public ci::michael_set::traits
        {
            typedef hash_int hash;
            typedef simple_item_counter item_counter;
        };
        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;

        set_type s( kSize, 2 );
        test( s );
        EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
    }

    TEST_F( IntrusiveMichaelLazySet_DHP, member_wrapped_stat )
    {
        struct list_traits: public ci::lazy_list::traits
        {
            typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
            typedef cmp<member_item_type> compare;
            typedef mock_disposer disposer;
            typedef ci::lazy_list::wrapped_stat<> stat;
        };
        typedef ci::LazyList< gc_type, member_item_type, list_traits > bucket_type;

        struct set_traits: public ci::michael_set::traits
        {
            typedef hash_int hash;
            typedef simple_item_counter item_counter;
        };
        typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;

        set_type s( kSize, 2 );
        test( s );
        EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
    }

} // namespace


text:
#ifdef DOT11_VHT_AC

#ifndef __DOT11AC_VHT_H
#define __DOT11AC_VHT_H

#include "rtmp_type.h"

#define IE_VHT_CAP		191
#define IE_VHT_OP		192

/*
	IEEE 802.11AC D2.0, sec 8.4.2.160.2
	VHT Capabilities Info field

	max_mpdu_len: MAximun MPDU Length
		->Indicate the max MPDU length.
				0: 3895 octets(Max A-MSDU length in HT Cap set to 3839)
				1: 7991 octets(Max A-MSDU length in HT Cap set to 7935)
				2: 11454 octets(Max A-MSDU length in HT Cap set to 7935)
				3: reserved
	ch_width: Supported Channel Width Set
		->Indicates the channel widths supported by the STA.
				0: the STA does not support either 160 or 80+80 MHz
				1: the STA support 160 MHz
				2: the STA support 160 MHz and 80 + 80 MHz
				3: reserved
	rx_ldpc: Rx LDPC
		-> Indicates support of receiving LDPC coded packets
				0: not support
				1: support
	sgi_80M: Short GI for 80 MHz
		-> Indicates short GI support for the reception of VHT+CBW80 packet
				0: not support
				1: support
	sgi_160M: Short GI for 160 and 80 + 80 MHz
		->Indicates rx short GI for VHT+(CBW160 and CBW80+80) packet
				0: not support
				1: support
	tx_stbc: Tx STBC
		-> Indicates support for tx of at least 2x1 STBC
				0: not support
				1: support
	rx_stbc: Rx STBC
		-> Indicates support for rx of PPDUs using STBC
				0: not support
				1: support 1SS
				2: support 1SS and 2SS
				3: support 1SS, 2SS and 3SS
				4: support 1SS, 2SS, 3SS and 4SS
				5,6,7: reserved
	bfer_cap_su: SU Beamformer Capable
		->Indicates support for operation as a single user beamformer
				0: not support
				1: support
	bfee_cap_su: SU Beamformee Capable
		-> Indicates support for operation as a single user beamformee
				0: not support
				1: support
	cmp_st_num_bfer: Compressed Steering Number of Beamformer Antenna Supported
		-> Beamformee's capability indicateing the max number of beamformer
			antennas the beamformee can support when sending compressed
			beamforming feedback
				If SU beamformee capable, set to the max value minus 1.
				otehrwise, reserved.
	num_snd_dimension: Number of Sounding Dimensions
		-> Beamformer's capability indicating the number of antennas used for
			beamformed transmissions.
				If SU beamformer capable, set to value minus 1.
				otehrwise, reserved.
	bfer_cap_mu: MU Beamformer Capable
		-> Indicates support for operation as an MU beamformer
				0: if not supported or if sent by a non-AP STA
				1: supported
	bfee_cap_mu: MU Beamformee Capable
		-> Indicates support for operation as an MU beamformer
				0: if not supported or if snet by an AP
				1: supported
	vht_txop_ps: VHT TXOP PS
		-> Indicates whether or not the AP supports VHT TXOP Power Save Mode or
			whether or not the STA is in VHT TXOP Power Save Mode
		->When tx by a VHT AP in the VHT Capabilities element included in Beacon,
			ProbeResp, AssocResp, and ReassocResp, frames:
				0: if the VHT AP does not support VHT TXOP PS in the BSS.
				1: if the VHT AP support TXOP PS in the BSS.
		->When tx by a VHT non-AP STA in the VHT Capabilities element included
			in AssocReq, ReassocReq and ProbReq frames:
				0: if the VHT STA is not in TXOP Power Save Mode.
				1: if the VHT STA is in TXOP Power Save Mode.
	htc_vht_cap: +HTC-VHT Capable
		-> Indicates whether or not the STA supports receiving an HT Control
			field in the VHT format
				0: if not support
				1: if support
	max_ampdu_exp: Maximum A-MPDU Length Exponent
		-> Indicates the maximum length of A-MPDU pre-EOF padding that the STA
			can receive.
		->The length defined by this field is equal to 2^(13 + max_ampdu_exp) -1
				0~7 : integer in the range of 0 to 7.
	vht_link_adapt: VHT Link Adaptation Capable
		-> Indicates whether or not the STA support link adaptation using VHT
			variant HT Control field.
		-> This field is ignored if the _HTC-VHT Capble field is set to 0.
				0: (No Feedback), if the STA does not provide VHT MFB
				2: (Unsolicited), if the STA provides only unsolicited VHT MFB
				3: (Both), if the STA can provide VHT MFB in response to VHT MRQ
					and if the STA provides unsolicited VHT MFB.
				1: reserved
	rx_ant_consistency: Rx Antenna Pattern Consistency
		->Indicates the possibility of Rx antenna pattern change
				0: if Rx antenna pattern might change during association
				1: if Rx antenna pattern does not change during association
	tx_ant_consistency: Tx Antenna Pattern Consistency
		->Indicates the possibility of Tx antenna pattern change
				0: if Tx antenna pattern might change during association
				1: if Tx antenna pattern does not change during association
*/
typedef struct GNU_PACKED _VHT_CAP_INFO{
#ifdef RT_BIG_ENDIAN
	UINT32 rsv:2;
	UINT32 tx_ant_consistency:1;
	UINT32 rx_ant_consistency:1;
	UINT32 vht_link_adapt:2;
	UINT32 max_ampdu_exp:3;
	UINT32 htc_vht_cap:1;
	UINT32 vht_txop_ps:1;
	UINT32 bfee_cap_mu:1;
	UINT32 bfer_cap_mu:1;
	UINT32 num_snd_dimension:3;

	UINT32 cmp_st_num_bfer:3;
	UINT32 bfee_cap_su:1;
	UINT32 bfer_cap_su:1;
	UINT32 rx_stbc:3;

	UINT32 tx_stbc:1;
	UINT32 sgi_160M:1;
	UINT32 sgi_80M:1;
	UINT32 rx_ldpc:1;
	UINT32 ch_width:2;
	UINT32 max_mpdu_len:2;
#else
	UINT32 max_mpdu_len:2;	/* 0: 3895, 1: 7991, 2: 11454, 3: rsv */
	UINT32 ch_width:2;	/* */
	UINT32 rx_ldpc:1;
	UINT32 sgi_80M:1;
	UINT32 sgi_160M:1;
	UINT32 tx_stbc:1;

	UINT32 rx_stbc:3;
	UINT32 bfer_cap_su:1;
	UINT32 bfee_cap_su:1;
	UINT32 cmp_st_num_bfer:3;

	UINT32 num_snd_dimension:3;
	UINT32 bfer_cap_mu:1;
	UINT32 bfee_cap_mu:1;
	UINT32 vht_txop_ps:1;
	UINT32 htc_vht_cap:1;
	UINT32 max_ampdu_exp:3;
	UINT32 vht_link_adapt:2;
	UINT32 rx_ant_consistency:1;
	UINT32 tx_ant_consistency:1;
	UINT32 rsv:2;
#endif /* RT_BIG_ENDIAN */
}VHT_CAP_INFO;

/*
	IEEE 802.11AC D2.0, sec 8.4.2.160.3
	Rx MCS Map and Tx MCS map, figure 8-401bt

	mcs_ss1: Max MCS for 1SS
	mcs_ss2: Max MCS for 2SS
	mcs_ss3: Max MCS for 3SS
	mcs_ss4: Max MCS for 4SS
	mcs_ss5: Max MCS for 5SS
	mcs_ss6: Max MCS for 6SS
	mcs_ss7: Max MCS for 7SS
	mcs_ss8: Max MCS for 8SS

	The 2-bit MAx MCS for n SS field for each number of spatial streams n = 1~8
	is encoded as following:
		0: indicates support for MCS 0~7
		1: indicates support for MCS 0~8
		2: indicates support for MCS 0~9
		3: indicates that n spatial streams is not supported.
	Note: some MCSs are not be valid for particular bandwidth and number of
		spatial stream combinations.
*/
#define VHT_MCS_CAP_7	0
#define VHT_MCS_CAP_8	1
#define VHT_MCS_CAP_9	2
#define VHT_MCS_CAP_NA	3

typedef struct GNU_PACKED _VHT_MCS_MAP{
#ifdef RT_BIG_ENDIAN
	UINT16 mcs_ss8:2;
	UINT16 mcs_ss7:2;
	UINT16 mcs_ss6:2;
	UINT16 mcs_ss5:2;
	UINT16 mcs_ss4:2;
	UINT16 mcs_ss3:2;
	UINT16 mcs_ss2:2;
	UINT16 mcs_ss1:2;
#else
	UINT16 mcs_ss1:2;
	UINT16 mcs_ss2:2;
	UINT16 mcs_ss3:2;
	UINT16 mcs_ss4:2;
	UINT16 mcs_ss5:2;
	UINT16 mcs_ss6:2;
	UINT16 mcs_ss7:2;
	UINT16 mcs_ss8:2;
#endif /* RT_BIG_ENDIAN */
}VHT_MCS_MAP;

/*
	IEEE 802.11AC D2.0, sec 8.4.2.160.3
	VHT Supported MCS Set field, figure 8-401bs

	rx_mcs_map: Rx MCS Map
		-> Indicates the maximum MCS that can be received for each number of
			spatial streams
				See "VHT_MCS_MAP"
	rx_high_rate: Rx Highest Supported Data Rate
		-> Indicates the maximum data rate that the STA can receive
		-> In unit of 1Mb/s where 1 represents 1Mb/s, and incrementing in steps
			of 1 Mb/s.
		-> If the maximum data rate expressed in Mb/s is not an integer, then
			the value is rounded up to the next integer.
	tx_mcs_map: Tx MCS Map
	tx_high_rate: Tx Highest Supported Data Rate
		-> Indicates the maximum data rate that the STA will transmit
		-> In unit of 1Mb/s where 1 represents 1Mb/s, and incrementing in steps
			of 1 Mb/s.
		-> If the maximum data rate expressed in Mb/s is not an integer, then
			the value is rounded up to the next integer.
*/

// TODO: shiang-6590, check the layout of this data structure!!!!
typedef struct GNU_PACKED _VHT_MCS_SET{
#ifdef RT_BIG_ENDIAN
	UINT16 rsv2:3;
	UINT16 tx_high_rate:13;
	struct _VHT_MCS_MAP tx_mcs_map;
	UINT16 rsv:3;
	UINT16 rx_high_rate:13;
	struct _VHT_MCS_MAP rx_mcs_map;
#else
	struct _VHT_MCS_MAP rx_mcs_map;
	UINT16 rx_high_rate:13;
	UINT16 rsv:3;
	struct _VHT_MCS_MAP tx_mcs_map;
	UINT16 tx_high_rate:13;
	UINT16 rsv2:3;
#endif /* RT_BIG_ENDIAN */
}VHT_MCS_SET;

/*
	IEEE 802.11AC D2.0, sec 8.4.2.160.1
	VHT Capabilities Element structure

	eid: Element ID
			191   (IE_VHT_CAP)
	len: Length
			12
	vht_cap: VHT Capabilities Info
		->contains a numner of fields that are used to advertise VHT capabilities
			of a VHT STA
	mcs_set: VHT supported MCS Set
		->Used to convey the combinations of MCSs and spatial streams a STA
			supports for both reception and transmission.
*/
typedef struct GNU_PACKED _VHT_CAP_IE{
	VHT_CAP_INFO vht_cap;
	VHT_MCS_SET mcs_set;
}VHT_CAP_IE;

/*
	IEEE 802.11AC D2.0, sec 8.4.2.161
	VHT Operation Information field, figure 8-401bv

	The operation of VHT STAs in the BSS is controlled by the HT Operation
	element and the VHT Operation element.

	ch_width: Channel Width
		-> This field, together with the HT Operation element STA Channel Width
			field, defines the BSS operating channel width.
				0: for 20MHz or 40MHz operating channel width
				1: for 80MHz operating channel width
				2: for 160MHz operating channel width
				3: for 80+80MHz operating channel width
				4~255: reserved
	center_freq_1: Channel Center Frequency Segment 1
		-> Defines the channel center frequency for an 80 and 160MHz VHT BSS
			and the segment 1 channel center frequency for an 80+90MHz VHT BSS.
		-> For 80MHZ or 160MHz operating channel width, indicates the channel
			center frequency index for the 80MHz or 160MHz channel on which the
			VHT BSS operates.
		->For 80+80MHz operating channel width, indicates the channel center
			frequency index for the 80MHz channel of frequency segment 1 on
			which the VHT BSS operates.
		->Set 0 for 20MHz or 40MHz operating channel width.

	center_freq_2: Channel Center Frequency Segment 2
		-> Defines the seg 2 channel center frequency for an 80+80MHz VHT BSS
		->For a 80+80MHz operating channel width, indicates the channel center
			frequency index of the 80MHz channel of frequency segment 2 on
			which the VHT BSS operates. Reserved otherwise.
*/
typedef struct GNU_PACKED _VHT_OP_INFO{
	UINT8 ch_width;
	UINT8 center_freq_1;
	UINT8 center_freq_2;
}VHT_OP_INFO;

/*
	IEEE 802.11AC D2.0, sec 8.4.2.161
	VHT Operation element, figure 8-401bu

	The operation of VHT STAs in the BSS is controlled by the HT Operation
	element and the VHT Operation element.

	eid: Element ID
			192 (IE_VHT_OP)
	len: Length
			5
	vht_op_info: VHT Operation Information
	basic_mcs_set: VHT Basic MCS Set
*/
typedef struct GNU_PACKED _VHT_OP_IE{
	VHT_OP_INFO vht_op_info;
	VHT_MCS_MAP basic_mcs_set;
}VHT_OP_IE;

/*
	IEEE 802.11AC D2.0, sec 8.4.2.163
	Wide Bandwidth Channel Switch element, figure 8-401bx

	included in the Channel Switch Announcement frames.

	new_ch_width: New STA Channel Width
	center_freq_1: New Channel Center Frequency Segment 1
	center_freq_2: New Channel Center Frequency Segment 2

	The definition of upper subfields is the same as "VHT_OP_INFO"
*/
typedef struct GNU_PACKED _WIDE_BW_CH_SWITCH_IE{
	UINT8 e_id;
	UINT len;
	UINT8 new_ch_width;
	UINT8 center_freq_1;
	UINT8 center_freq_2;
}WIDE_BW_CH_SWITCH_IE;

/*
	IEEE 802.11AC D2.0, sec 8.4.2.164
	VHT Transmit Power Envelope element

*/
typedef struct GNU_PACKED _CH_SEG_PAIR{
	UINT8 ch_center_freq;
	UINT8 seg_ch_width;
}CH_SEG_PAIR;

/*
	IEEE 802.11AC D2.0, sec 8.4.2.164
	VHT Transmit Power Envelope element

	max_txpwr: Maximum Transmit Power
		-> Define the maximum transmit power limit of the tx bandwidth defined
			by the VHT Transmit Power Envelop element. The Maximum Transmit
			Power field is a 8 bit 2's complement signed integer in the range of
			-64 dBm to 63.5 dBm with a 0.5 dB step.

	NOTE: The following two subfields may repeated as needed.
		center_freq_1: Channel Center Frequency Segment
		ch_seg_width: Segment Channel Width
*/
typedef struct GNU_PACKED _VHT_TXPWR_ENV_IE{
	UINT8 e_id;
	UINT8 len;
	UINT8 max_txpwr;
	CH_SEG_PAIR ch_seg_pair[0];
}VHT_TXPWR_ENV_IE;

typedef struct  GNU_PACKED _VHT_CONTROL{
#ifdef RT_BIG_ENDIAN
	UINT32 RDG:1;
	UINT32 ACConstraint:1;
	UINT32 unso_mfb:1;
	UINT32 fb_tx_type:1;
	UINT32 coding:1;
	UINT32 gid_h:3;
	UINT32 mfb_snr:6;
	UINT32 mfb_bw:2;
	UINT32 mfb_mcs:4;
	UINT32 mfb_n_sts:3;
	UINT32 mfsi_gidl:3;
	UINT32 stbc_ind:1;
	UINT32 comp_msi:2;
	UINT32 mrq:1;
	UINT32 rsv:1;
	UINT32 vht:1;
#else
	UINT32 vht:1;
	UINT32 rsv:1;
	UINT32 mrq:1;
	UINT32 comp_msi:2;
	UINT32 stbc_ind:1;
	UINT32 mfsi_gidl:3;
	UINT32 mfb_n_sts:3;
	UINT32 mfb_mcs:4;
	UINT32 mfb_bw:2;
	UINT32 mfb_snr:6;
	UINT32 gid_h:3;
	UINT32 coding:1;
	UINT32 fb_tx_type:1;
	UINT32 unso_mfb:1;
	UINT32 ACConstraint:1;
	UINT32 RDG:1;
#endif
}VHT_CONTROL;

typedef struct GNU_PACKED _NDPA_PKT{
	USHORT frm_ctrl;
	USHORT duration;
	UINT8 ra[MAC_ADDR_LEN];
	UINT8 ta[MAC_ADDR_LEN];
	UINT8 snd_seq;
}DNPA_PKT;

#endif /* __DOT11AC_VHT_H */

#endif /* DOT11_VHT_AC */


text:
@implementation Media

// Insert code here to add functionality to your managed object subclass

@end


text:
package com.github.zutherb.buildlight.cleware.driver.trafficlight;

import com.codeminders.hidapi.ClassPathLibraryLoader;
import com.codeminders.hidapi.HIDDevice;
import com.codeminders.hidapi.HIDManager;
import com.github.zutherb.buildlight.common.driver.core.AbstractTrafficLight;
import com.github.zutherb.buildlight.common.driver.core.Color;
import com.github.zutherb.buildlight.common.driver.core.TrafficLight;
import com.github.zutherb.buildlight.common.driver.core.TrafficLightException;
import com.google.common.collect.ImmutableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Map;

import static java.lang.String.format;
import static org.apache.commons.lang.Validate.isTrue;

/**
 * @author zutherb
 */
public final class ClewareLightFactory {

    private ClewareLightFactory() { /* NOOP */ }

    private static final Logger LOGGER = LoggerFactory.getLogger(ClewareLightFactory.class);

    private static final int VENDOR_ID = 0xD50;     //Cleware Vendor Id
    private static final int PRODUCT_ID = 0x8;      //Traffic Light Product Id

    static {
        ClassPathLibraryLoader.loadNativeHIDLibrary();
    }

    public static TrafficLight createNewInstance() {
        try {
            HIDManager hidManager = HIDManager.getInstance();
            HIDDevice hidDevice = hidManager.openById(VENDOR_ID, PRODUCT_ID, null);
            dumpDebugInformation(hidDevice);
            return new ClewareTrafficLightImpl(hidManager, hidDevice);
        } catch (IOException e) {
            throw new TrafficLightException("Traffic Light USB device could not be found.", e);
        }
    }

    private static void dumpDebugInformation(HIDDevice hidDevice) throws IOException {
        LOGGER.debug("Manufacturer:\t{}", hidDevice.getManufacturerString());
        LOGGER.debug("Product:\t\t{}", hidDevice.getProductString());
        LOGGER.debug("SerialNumber:\t{}", hidDevice.getSerialNumberString());
    }

    /**
     * @author zutherb
     */
    public static class ClewareTrafficLightImpl extends AbstractTrafficLight<Byte> {

        private static final Logger LOGGER = LoggerFactory.getLogger(ClewareTrafficLightImpl.class);

        private static final byte ZERO = (byte) 0x0;
        private static final byte ONE = (byte) 0x1;

        private static Map<Color, Byte> LED_MAPPING = ImmutableMap.<Color, Byte>builder()
                .put(Color.RED, (byte) 0x10)
                .put(Color.YELLOW, (byte) 0x11)
                .put(Color.GREEN, (byte) 0x12)
                .build();

        private final HIDManager hidManager;
        private final HIDDevice hidDevice;

        ClewareTrafficLightImpl(HIDManager hidManager, HIDDevice hidDevice) {
            this.hidManager = hidManager;
            this.hidDevice = hidDevice;
        }

        @Override
        public void switchOn(Color color) {
            try {
                byte[] writeBuffer = createSwitchOnSequenceBuffer(color);
                int writtenBytes = hidDevice.write(writeBuffer);
                isTrue(writtenBytes == writeBuffer.length, MESSAGE_NOT_ALL_BYTES_FROM_THE_WAS_WRITTEN_TO_USB);
                LOGGER.debug(format(MESSAGE_SWITCH_ON_LED, color.name()));
            } catch (Exception e) {
                LOGGER.error(MESSAGE_SWITCH_ON_ERROR, color.name());
                throw new TrafficLightException(e);
            }
        }

        @Override
        public void switchOff(Color color) {
            try {
                byte[] writeBuffer = createSwitchOffSequenceBuffer(color);
                int writtenBytes = hidDevice.write(writeBuffer);
                isTrue(writtenBytes == writeBuffer.length, MESSAGE_NOT_ALL_BYTES_FROM_THE_WAS_WRITTEN_TO_USB);
                LOGGER.debug(format(MESSAGE_SWITCH_OFF_LED, color.name()));
            } catch (Exception e) {
                LOGGER.error(MESSAGE_SWITCH_OFF_ERROR, color.name());
                throw new TrafficLightException(e);
            }
        }

        private byte[] createSwitchOnSequenceBuffer(Color color) {
            return new byte[]{ZERO, ZERO, map(color), ONE};
        }

        private byte[] createSwitchOffSequenceBuffer(Color color) {
            return new byte[]{ZERO, ZERO, map(color), ZERO};
        }

        @Override
        public void close() {
            try {
                hidDevice.close();
                hidManager.release();
            } catch (Exception e) {
                LOGGER.error(MESSAGE_USB_DEVICE_COULD_NOT_BE_CLOSED);
                throw new TrafficLightException(e);
            }
        }

        @Override
        protected Byte map(Color color) {
            return LED_MAPPING.get(color);
        }
    }
}


text:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.8">
  <compounddef id="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response" kind="class" prot="public">
    <compoundname>ThecallrApi::Objects::RealTime::RealTimeResponse</compoundname>
      <sectiondef kind="property">
      <memberdef kind="property" id="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1a3ae9aaf8c52ce3ab15fdb9e7f3f7175e" prot="public" static="no" readable="no" writable="no" gettable="yes" privategettable="no" protectedgettable="no" settable="yes" privatesettable="no" protectedsettable="no">
        <type>int</type>
        <definition>int ThecallrApi.Objects.RealTime.RealTimeResponse.CommandId</definition>
        <argsstring></argsstring>
        <name>CommandId</name>
        <briefdescription>
<para>Command ID. Use the value you want. We will send this ID back when we have the result ready. Useful to keep track of your scenario. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" line="14" column="1" bodyfile="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" bodystart="14" bodyend="-1"/>
      </memberdef>
      <memberdef kind="property" id="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1adae0ff55f74c467e335e2487d07dbe86" prot="public" static="no" readable="no" writable="no" gettable="yes" privategettable="no" protectedgettable="no" settable="no" privatesettable="yes" protectedsettable="no">
        <type>string</type>
        <definition>string ThecallrApi.Objects.RealTime.RealTimeResponse.Command</definition>
        <argsstring></argsstring>
        <name>Command</name>
        <briefdescription>
<para>The command we have to execute (see the commands list in Real-Time). </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" line="19" column="1" bodyfile="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" bodystart="19" bodyend="-1"/>
      </memberdef>
      <memberdef kind="property" id="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1ab2b41d0a7a68ec46295b7f1f86ce59fe" prot="public" static="no" readable="no" writable="no" gettable="yes" privategettable="no" protectedgettable="no" settable="no" privatesettable="yes" protectedsettable="no">
        <type>Dictionary< string, object ></type>
        <definition>Dictionary<string, object> ThecallrApi.Objects.RealTime.RealTimeResponse.Params</definition>
        <argsstring></argsstring>
        <name>Params</name>
        <briefdescription>
<para>Command parameters. See the Real-Time commands. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" line="24" column="1" bodyfile="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" bodystart="24" bodyend="-1"/>
      </memberdef>
      <memberdef kind="property" id="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1ae5b9bace436c3c3e61e9a4cc1bef8ead" prot="public" static="no" readable="no" writable="no" gettable="yes" privategettable="no" protectedgettable="no" settable="yes" privatesettable="no" protectedsettable="no">
        <type>Dictionary< string, object ></type>
        <definition>Dictionary<string, object> ThecallrApi.Objects.RealTime.RealTimeResponse.Variables</definition>
        <argsstring></argsstring>
        <name>Variables</name>
        <briefdescription>
<para>Key/Value object. You can fill this object with anything, we will send it back without touching it in our next request. You can use this as a session object. </para>        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" line="29" column="1" bodyfile="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" bodystart="29" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="public-func">
      <memberdef kind="function" id="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1a566fcea5067602c09530218cfa6b5dbd" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type></type>
        <definition>ThecallrApi.Objects.RealTime.RealTimeResponse.RealTimeResponse</definition>
        <argsstring>(string command)</argsstring>
        <name>RealTimeResponse</name>
        <param>
          <type>string</type>
          <declname>command</declname>
        </param>
        <briefdescription>
<para>Constructor. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>command</parametername>
</parameternamelist>
<parameterdescription>
<para>Commnd name.</para></parameterdescription>
</parameteritem>
</parameterlist>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" line="37" column="1" bodyfile="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" bodystart="37" bodyend="42"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
<para>This class represents a Real-Time Response (Your response to our requests). </para>    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <location file="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" line="9" column="1" bodyfile="C:/Users/Michael/Desktop/v1.0/framework 4.0/sources/ThecallrApi/ThecallrApi/Objects/RealTime/RealTimeResponse.cs" bodystart="8" bodyend="44"/>
    <listofallmembers>
      <member refid="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1adae0ff55f74c467e335e2487d07dbe86" prot="public" virt="non-virtual"><scope>ThecallrApi::Objects::RealTime::RealTimeResponse</scope><name>Command</name></member>
      <member refid="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1a3ae9aaf8c52ce3ab15fdb9e7f3f7175e" prot="public" virt="non-virtual"><scope>ThecallrApi::Objects::RealTime::RealTimeResponse</scope><name>CommandId</name></member>
      <member refid="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1ab2b41d0a7a68ec46295b7f1f86ce59fe" prot="public" virt="non-virtual"><scope>ThecallrApi::Objects::RealTime::RealTimeResponse</scope><name>Params</name></member>
      <member refid="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1a566fcea5067602c09530218cfa6b5dbd" prot="public" virt="non-virtual"><scope>ThecallrApi::Objects::RealTime::RealTimeResponse</scope><name>RealTimeResponse</name></member>
      <member refid="class_thecallr_api_1_1_objects_1_1_real_time_1_1_real_time_response_1ae5b9bace436c3c3e61e9a4cc1bef8ead" prot="public" virt="non-virtual"><scope>ThecallrApi::Objects::RealTime::RealTimeResponse</scope><name>Variables</name></member>
    </listofallmembers>
  </compounddef>
</doxygen>


text:
import * as THREE from 'three';

import { UIDiv, UIRow, UIText, UIInteger, UINumber } from './libs/ui.js';

import { SetGeometryCommand } from './commands/SetGeometryCommand.js';

function GeometryParametersPanel( editor, object ) {

	const strings = editor.strings;

	const container = new UIDiv();

	const geometry = object.geometry;
	const parameters = geometry.parameters;

	// radius

	const radiusRow = new UIRow();
	const radius = new UINumber( parameters.radius ).onChange( update );

	radiusRow.add( new UIText( strings.getKey( 'sidebar/geometry/circle_geometry/radius' ) ).setWidth( '90px' ) );
	radiusRow.add( radius );

	container.add( radiusRow );

	// segments

	const segmentsRow = new UIRow();
	const segments = new UIInteger( parameters.segments ).setRange( 3, Infinity ).onChange( update );

	segmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/circle_geometry/segments' ) ).setWidth( '90px' ) );
	segmentsRow.add( segments );

	container.add( segmentsRow );

	// thetaStart

	const thetaStartRow = new UIRow();
	const thetaStart = new UINumber( parameters.thetaStart * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );

	thetaStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/circle_geometry/thetastart' ) ).setWidth( '90px' ) );
	thetaStartRow.add( thetaStart );

	container.add( thetaStartRow );

	// thetaLength

	const thetaLengthRow = new UIRow();
	const thetaLength = new UINumber( parameters.thetaLength * THREE.MathUtils.RAD2DEG ).setStep( 10 ).onChange( update );

	thetaLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/circle_geometry/thetalength' ) ).setWidth( '90px' ) );
	thetaLengthRow.add( thetaLength );

	container.add( thetaLengthRow );

	//

	function update() {

		editor.execute( new SetGeometryCommand( editor, object, new THREE.CircleGeometry(
			radius.getValue(),
			segments.getValue(),
			thetaStart.getValue() * THREE.MathUtils.DEG2RAD,
			thetaLength.getValue() * THREE.MathUtils.DEG2RAD
		) ) );

	}

	return container;

}

export { GeometryParametersPanel };


text:
<?xml version="1.0" encoding="utf-8"?>
<com.zhy.autolayout.AutoFrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/fl_item"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <com.lqr.biliblili.mvp.ui.widget.AutoCardView
        android:layout_width="match_parent"
        android:layout_height="370px"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="12px"
        android:layout_marginLeft="14px"
        android:layout_marginRight="14px"
        android:layout_marginTop="14px"
        app:cardCornerRadius="@dimen/card_view_radius_live"
        app:cardElevation="@dimen/card_view_elevation_live">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="200px">

                <ImageView
                    android:id="@+id/iv_item_cover_src"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="centerCrop"
                    android:src="@mipmap/img_communicate_no_login"/>

                <TextView
                    android:id="@+id/tv_item_owner_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentLeft="true"
                    android:layout_margin="@dimen/item_text_margin_live"
                    android:textColor="@color/item_owner_name_text_live"
                    android:textSize="28px"/>
            </RelativeLayout>

            <TextView
                android:id="@+id/tv_item_title"
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_marginLeft="@dimen/item_text_margin_live"
                android:layout_marginRight="@dimen/item_text_margin_live"
                android:layout_marginTop="@dimen/item_text_margin_live"
                android:layout_weight="1"
                android:textColor="@color/item_title_text_live"
                android:textSize="26px"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/tv_item_sub_title"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/item_text_margin_live"
                    android:layout_marginLeft="@dimen/item_text_margin_live"
                    android:layout_weight="1"
                    android:maxLines="1"
                    android:textColor="@color/item_item_online_text_live"
                    android:textSize="23px"/>

                <TextView
                    android:id="@+id/tv_item_online"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/item_text_margin_live"
                    android:layout_marginRight="@dimen/item_text_margin_live"
                    android:drawableLeft="@mipmap/ic_viewer"
                    android:gravity="center_vertical"
                    android:textColor="@color/item_item_online_text_live"
                    android:textSize="22px"/>
            </LinearLayout>
        </LinearLayout>
    </com.lqr.biliblili.mvp.ui.widget.AutoCardView>
</com.zhy.autolayout.AutoFrameLayout>


text:
package com.huayu.metis.storm.bolt.monitor;

import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.base.BaseRichBolt;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Tuple;
import backtype.storm.tuple.Values;
import com.huayu.metis.storm.ConstansValues;
import com.huayu.metis.storm.spout.ApiCallDocument;
import com.rits.cloning.Cloner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Bolt接收基于时间间隔的Spout传递过来的数据数组, 根据特定业务规则进行分组, 并将分组后的数据发送出去
 * Created by Administrator on 14-4-29.
 */
public class ApiMonitorGroupingBolt extends BaseRichBolt {
    public Logger logger = LoggerFactory.getLogger(ApiMonitorGroupingBolt.class);
    private Map<Object, List<Map<String, Object>>> groupingMap = new ConcurrentHashMap<Object, List<Map<String, Object>>>();
    private OutputCollector collector;
    private Cloner cloner;
    /**
     * Bolt接收基于时间间隔的Spout传递过来的数据数组, 根据特定业务规则进行分组
     */
    public ApiMonitorGroupingBolt() {
    }

    @Override
    public void prepare(Map map, TopologyContext topologyContext, OutputCollector outputCollector) {
        this.collector = outputCollector;
        this.cloner = new Cloner();
    }

    @Override
    public void execute(Tuple tuple) {
        //获取tuple传递过来的消息, 这是一个按照固定时间间隔分组的对象, 外围还包裹Object
        //获取分组时间键
        long groupTimestamp = tuple.getLongByField(ConstansValues.API_MONITOR_TIME_BASE_GROUP_KEY);
        //获取分组数据
        Object orignalObj = tuple.getValueByField(ConstansValues.API_MONITOR_TIME_BASE_OUTPUT_KEY);
        List<ApiCallDocument> realDocList = null;
        if(orignalObj != null){
            realDocList = (List<ApiCallDocument>)orignalObj;
        }
        logger.debug("[hy]deal with " + realDocList.size() + " records");

        if(realDocList == null) {
            collector.fail(tuple);
            return;
        }

        //循环Tuple中的数据
        //for(ApiCallDocument document : realDocList) {
        for(int i=0; i<realDocList.size(); i++) {
            ApiCallDocument document = realDocList.get(i);
            Object key = document.getKey();
            if(!groupingMap.containsKey(key)){
                List<Map<String, Object>> values = new ArrayList<Map<String, Object>>();
                values.add(document.getValue());
                groupingMap.put(key, values);
            } else {
                groupingMap.get(key).add(document.getValue());
            }
        }

        logger.debug("[hy]grouping " + groupingMap.size() + " groups");
        Map<Object, List<Map<String, Object>>> sendGrouping = cloner.deepClone(groupingMap);
        //将分组后的数据发出
        for(Map.Entry<Object,  List<Map<String, Object>>> entry : sendGrouping.entrySet()) {
            collector.emit(new Values(groupTimestamp, entry.getKey(), entry.getValue()));
        }
        //清空分组
        groupingMap.clear();
        //确认应答
        collector.ack(tuple);
    }

    @Override
    public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
        outputFieldsDeclarer.declare(new Fields(
                ConstansValues.API_MONITOR_GROUPING_TIMESTAMP_FILED,
                ConstansValues.API_MONITOR_GROUPING_KEY_FILED,
                ConstansValues.API_MONITOR_GROUPING_VALUE_FILED));
    }
}


text:
angular.module('brew-everywhere').factory('equipmentDataService',function(messaging, events, constants, mongolab, modelTransformer, Equipment) {
  var equipment = [];

  var getEquipment = function () {
    return mongolab.query(constants.mongodb.database, constants.mongodb.equipmentCollection, [])
        .then(getEquipmentSuccessHandler, getEquipmentErrorHandler);
  };

  var getEquipmentSuccessHandler = function (response) {
    if (response.data.length > 0) {
      var result = [];
      angular.forEach(response.data, function (equipment) {
        result.push(modelTransformer.transform(equipment, Equipment));
      });
      messaging.publish(events.message._GET_EQUIPMENT_COMPLETE_, [result]);
    } else {
      getEquipmentErrorHandler();
    }
  };

  var getEquipmentErrorHandler = function () {
    messaging.publish(events.message._GET_EQUIPMENT_FAILED_);
    messaging.publish(events.message._ADD_ERROR_MESSAGE_,
        ['Unable to get equipment from server', 'alert.warning']);
  };

  messaging.subscribe(events.message._GET_EQUIPMENT_, getEquipment);

  var getEquipmentById = function (id) {
    return mongolab.queryById(constants.mongodb.database, constants.mongodb.equipmentCollection, id, [])
        .then(getEquipmentByIdSuccessHandler, getEquipmentByIdErrorHandler);
  };

  var getEquipmentByIdSuccessHandler = function (response) {
    if (response.data) {
      messaging.publish(events.message._GET_EQUIPMENT_BY_ID_COMPLETE_,
          [modelTransformer.transform(response.data, Equipment)]);
    }
    else {
      getEquipmentByIdErrorHandler();
    }
  };

  var getEquipmentByIdErrorHandler = function () {
    messaging.publish(events.message._GET_EQUIPMENT_BY_ID_FAILED_);
    messaging.publish(events.message._ADD_ERROR_MESSAGE_,
        ['Unable to get equipment by id from server', 'alert.warning']);
  };

  messaging.subscribe(events.message._GET_EQUIPMENT_BY_ID_, getEquipmentById);

  var createEquipment = function (equipment) {
    return mongolab.create(constants.mongodb.database, constants.mongodb.equipmentCollection, equipment)
        .then(createEquipmentSuccessHandler, createEquipmentErrorHandler);
  };

  var createEquipmentSuccessHandler = function (response) {
    if (response.data) {
      messaging.publish(events.message._CREATE_EQUIPMENT_COMPLETE_,
          [modelTransformer.transform(response.data, Equipment)]);
    }
    else {
      createEquipmentErrorHandler();
    }
  };

  var createEquipmentErrorHandler = function () {
    messaging.publish(events.message._CREATE_EQUIPMENT_FAILED_);
    messaging.publish(events.message._ADD_ERROR_MESSAGE_,
        ['Unable to create equipment', 'alert.warning']);
  };

  messaging.subscribe(events.message._CREATE_EQUIPMENT_, createEquipment);

  var updateEquipment = function (equipment) {
    return mongolab.update(constants.mongodb.database, constants.mongodb.equipmentCollection, equipment)
        .then(updateEquipmentSuccessHandler, updateEquipmentErrorHandler);
  };

  var updateEquipmentSuccessHandler = function (response) {
    if (response.data) {
      messaging.publish(events.message._UPDATE_EQUIPMENT_COMPLETE_,
          [modelTransformer.transform(response.data, Equipment)]);
    }
    else {
      updateEquipmentErrorHandler();
    }
  };

  var updateEquipmentErrorHandler = function () {
    messaging.publish(events.message._UPDATE_EQUIPMENT_FAILED_);
    messaging.publish(events.message._ADD_ERROR_MESSAGE_,
        ['Unable to update equipment', 'alert.warning']);
  };

  messaging.subscribe(events.message._UPDATE_EQUIPMENT_, updateEquipment);

  var deleteEquipment = function (equipment) {
    return mongolab.delete(constants.mongodb.database, constants.mongodb.equipmentCollection, equipment)
        .then(deleteEquipmentSuccessHandler, deleteEquipmentErrorHandler);
  };

  var deleteEquipmentSuccessHandler = function (response) {
    if (response.status === 200) {
      messaging.publish(events.message._DELETE_EQUIPMENT_COMPLETE_);
    }
    else {
      deleteEquipmentErrorHandler();
    }
  };

  var deleteEquipmentErrorHandler = function () {
    messaging.publish(events.message._DELETE_EQUIPMENT_FAILED_);
    messaging.publish(events.message._ADD_ERROR_MESSAGE_,
        ['Unable to delete equipment', 'alert.warning']);
  };

  messaging.subscribe(events.message._DELETE_EQUIPMENT_, deleteEquipment);

  var init = function () {
    equipment = [];
  };

  var equipmentDataService = {
    init: init,
    getEquipment: getEquipment,
    getEquipmentSuccessHandler: getEquipmentSuccessHandler,
    getEquipmentErrorHandler: getEquipmentErrorHandler,
    getEquipmentById: getEquipmentById,
    getEquipmentByIdSuccessHandler: getEquipmentByIdSuccessHandler,
    getEquipmentByIdErrorHandler: getEquipmentByIdErrorHandler,
    createEquipment: createEquipment,
    createEquipmentSuccessHandler: createEquipmentSuccessHandler,
    createEquipmentErrorHandler: createEquipmentErrorHandler,
    updateEquipment: updateEquipment,
    updateEquipmentSuccessHandler: updateEquipmentSuccessHandler,
    updateEquipmentErrorHandler: updateEquipmentErrorHandler,
    deleteEquipment: deleteEquipment,
    deleteEquipmentSuccessHandler: deleteEquipmentSuccessHandler,
    deleteEquipmentErrorHandler: deleteEquipmentErrorHandler
  };

  return equipmentDataService;
});


text:
'use strict';

var jsonBody = require('body/json');
var parseArgs = require('minimist');
var process = require('process');
var console = require('console');

var toMarkdown = require('../index.js');

module.exports = main;

if (require.main === module) {
    main(parseArgs(process.argv.slice(2)));
}

function main() {
    jsonBody(process.stdin, onBody);

    function onBody(err, schemaTable) {
        if (err) {
            throw err;
        }

        var markdown = toMarkdown(schemaTable);
        process.stdout.write(markdown);
    }
}