text:
from __future__ import absolute_import
from . import GithubEvent

"""
Triggered when a pull request review is submitted into a
non-pending state, the body is edited, or the review is dismissed.
"""

class PullRequestReviewEvent(GithubEvent):
    def process(self, request, body):
        user_link = body.get('sender', {}).get('html_url', '').replace(
            'https://github.com/', '')
        pr_link = body.get('pull_request', {}).get('html_url', '').replace(
            'https://github.com/', '')

        params = {'username': body.get('sender', {}).get('login'),
                  'user_link': self.build_redirect_link('github', 'release', user_link),
                  'pull_request_number': str(body.get('pull_request', {}).get('number')),
                  'pull_request_link': self.build_redirect_link('github', 'pull_request', pr_link),
                  'pull_request_title': body.get('pull_request', {}).get('title', ''),
                  'repository_name': body.get('repository', {}).get('full_name', ''),
                  'repository_link': body.get('repository', {}).get('html_url', ''),
                  'state': 'approved',
                  'icon': "✅"
                  }

        if body.get('review').get('state') == "changes_requested":
            params['state'] = 'requested changes on'
            params['icon'] = "🔴"

        message = "[{icon}]({pull_request_link}) [{username}]({user_link}) {state} " \
                  "pull request " \
                  "[#{pull_request_number} {pull_request_title}]({pull_request_link})" \
                  " in [{repository_name}]({repository_link})"
        message = message.format(**params)

        return {"default": str(message)}

    def get_redirect(self, request, event, params):
        redirect = {
            'meta_title': '',
            'meta_summary': '',
            'poster_image': '',
            'redirect': 'https://github.com/' + params,
            'status_code': 404
        }
        return redirect


text:
package constants

// Available config.
const (
	// Optional config.
	ConfigHost     = "host"
	ConfigPort     = "port"
	ConfigProtocol = "protocol"
	ConfigLogLevel = "log_level"

	// Required config.
	ConfigAccessKeyID     = "access_key_id"
	ConfigSecretAccessKey = "secret_access_key"

	// Runtime config.
	ConfigZone = "zone"
)

// Default config values.
const (
	DefaultHost     = "qingstor.com"
	DefaultPort     = "443"
	DefaultProtocol = "https"
	DefaultLogLevel = "info"
)

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>gem5: Cache< TagStore >::CpuSidePort Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Modules

Namespaces

Classes

Files

Related Pages

      <form action="search.php" method="get">

             Search for
            <input type="text" name="query" value="" size="20" accesskey="s"/>

      </form>

Alphabetical List

Class List

Class Hierarchy

Class Members

Cache::CpuSidePort

Cache< TagStore >::CpuSidePort Class Reference
The CPU-side port extends the base cache slave port with access functions for functional, atomic and timing requests.
More...

#include <cache.hh>

List of all members.

Public Member Functions

 	CpuSidePort (const std::string &_name, Cache< TagStore > *_cache, const std::string &_label)

Protected Member Functions

virtual bool 	recvTimingSnoopResp (PacketPtr pkt)

virtual bool 	recvTimingReq (PacketPtr pkt)

virtual Tick 	recvAtomic (PacketPtr pkt)

virtual void 	recvFunctional (PacketPtr pkt)

virtual AddrRangeList 	getAddrRanges () const

Private Attributes

Cache< TagStore > * 	cache

Detailed Description

template<class TagStore>

 class Cache< TagStore >::CpuSidePort

The CPU-side port extends the base cache slave port with access functions for functional, atomic and timing requests.

Definition at line 85 of file cache.hh.

Constructor & Destructor Documentation

template<class TagStore>

          Cache< TagStore >::CpuSidePort::CpuSidePort
          (
          const std::string &
           _name,

          Cache< TagStore > *
           _cache,

          const std::string &
           _label

          )

Definition at line 2109 of file cache_impl.hh.

Member Function Documentation

template<class TagStore>

          AddrRangeList Cache< TagStore >::CpuSidePort::getAddrRanges
          (

           )
           const [protected, virtual]

Definition at line 2060 of file cache_impl.hh.

References Cache< TagStore >::CpuSidePort::cache.

template<class TagStore>

          Tick Cache< TagStore >::CpuSidePort::recvAtomic
          (
          PacketPtr
           pkt
           )
           [protected, virtual]

Definition at line 2094 of file cache_impl.hh.

References Cache< TagStore >::CpuSidePort::cache.

template<class TagStore>

          void Cache< TagStore >::CpuSidePort::recvFunctional
          (
          PacketPtr
           pkt
           )
           [protected, virtual]

Definition at line 2101 of file cache_impl.hh.

References Cache< TagStore >::CpuSidePort::cache.

template<class TagStore>

          bool Cache< TagStore >::CpuSidePort::recvTimingReq
          (
          PacketPtr
           pkt
           )
           [protected, virtual]

Definition at line 2067 of file cache_impl.hh.

References BaseCache::blocked, Cache< TagStore >::CpuSidePort::cache, and Packet::memInhibitAsserted().

template<class TagStore>

          bool Cache< TagStore >::CpuSidePort::recvTimingSnoopResp
          (
          PacketPtr
           pkt
           )
           [protected, virtual]

Definition at line 1803 of file cache_impl.hh.

References Cache< TagStore >::CpuSidePort::cache.

Member Data Documentation

template<class TagStore>

          Cache<TagStore>* Cache< TagStore >::CpuSidePort::cache [private]

Definition at line 90 of file cache.hh.

Referenced by Cache< TagStore >::CpuSidePort::getAddrRanges(), Cache< TagStore >::CpuSidePort::recvAtomic(), Cache< TagStore >::CpuSidePort::recvFunctional(), Cache< TagStore >::CpuSidePort::recvTimingReq(), and Cache< TagStore >::CpuSidePort::recvTimingSnoopResp().

The documentation for this class was generated from the following files:

mem/cache/cache.hh
mem/cache/cache_impl.hh

<address style="align: right;">
Generated on Fri Apr 17 12:39:31 2015 for gem5 by  doxygen 1.4.7</address>


text:
redirect_from: /docs/1.0.0-alpha.5/modules/ng2.html
---
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>ng2 | UI-Router</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">
	<link rel="stylesheet" href="../assets/css/typedoctheme.css">

						Search
						<input id="tsd-search-field" type="text" />

Preparing search index...

The search index is not available

					UI-Router

						Options

								All

Public

Public/Protected

All

							<input type="checkbox" id="tsd-filter-inherited" checked />
							Inherited
							<input type="checkbox" id="tsd-filter-externals" checked />
							Externals
							<input type="checkbox" id="tsd-filter-only-exported" />
							Only exported

					Menu

					Globals

					ng2

External module ng2

UI-Router for Angular 2

For the quick start repository, please see http://github.com/ui-router/quickstart-ng2

Getting started:

Use npm. Add a dependency on latest ui-router-ng2

Import UI-Router classes directly from "ui-router-ng2"

import {StateRegistry} from "ui-router-ng2";

When defining a component, add the UIROUTER_DIRECTIVES to directives: array.

Either bootstrap a UiView component, or add a <ui-view></ui-view> viewport to your root component.

Create application states (as defined by Ng2StateDeclaration) which will fill in the viewports.

Create a UIRouterConfig, and register your states in the UIRouterConfig.configure function.

import {UIRouter} from "ui-router-ng2";
import {INITIAL_STATES} from "./app.states";
@ Injectable()
export class MyUIRouterConfig {
  configure(uiRouter: UIRouter) {
    INITIAL_STATES.forEach(function(state) {
      uiRouter.stateRegistry.register(state));
    });
  }
}

When bootstrapping: include the UIROUTER_PROVIDERS and define a provider for your UIRouterConfig

import {provide} from "@angular/core";
import {bootstrap} from 'angular2/platform/browser';
import {UIRouterConfig, UiView, UIROUTER_PROVIDERS} from "ui-router-ng2";
import {MyUIRouterConfig} from "./router.config";

bootstrap(UiView, [
    ...UIROUTER_PROVIDERS,
    provide(UIRouterConfig, { useClass: MyUIRouterConfig })
]);

Index

Classes

Ng2<wbr>View<wbr>Config

UIRouter<wbr>Config

Interfaces

Ng2<wbr>Component

Ng2<wbr>State<wbr>Declaration

Ng2<wbr>View<wbr>Declaration

Variables

UIROUTER_<wbr>PROVIDERS

Functions

ng2<wbr>Views<wbr>Builder

ui<wbr>Router<wbr>Factory

Variables

UIROUTER_<wbr>PROVIDERS: Provider[]

 The UI-Router providers, for use in your application bootstrap

The UI-Router providers, for use in your application bootstrap

example

bootstrap(UiView, [
    ...UIROUTER_PROVIDERS,
    ...HTTP_PROVIDERS,
    provide(UIRouterConfig, { useClass: MyUIRouterConfig })
]);

Defined in ng2/providers.ts:98

Functions

ng2<wbr>Views<wbr>Builder(state: State): object

 This is a StateBuilder.builder function for angular2 views.

This is a StateBuilder.builder function for angular2 views.

When the StateBuilder builds a State object from a raw StateDeclaration, this builder
								handles the views property with logic specific to ui-router-ng2.

If no views: {} property exists on the StateDeclaration, then it creates the views object and
								applies the state-level configuration to a view named $default.

Parameters

state: State

Returns object

Defined in ng2/viewsBuilder.ts:19

ui<wbr>Router<wbr>Factory(routerConfig: UIRouterConfig, location: UIRouterLocation): UIRouter

Parameters

routerConfig: UIRouterConfig

location: UIRouterLocation

Returns UIRouter

Defined in ng2/providers.ts:65

						Globals

						"ng2/component<wbr>Util"

						"ng2/location"

						common

						common_<wbr>hof

						common_<wbr>predicates

						common_<wbr>strings

						core

						justjs

						ng1

						ng1_<wbr>directives

						ng1_<wbr>state_<wbr>events

						ng2

						ng2_<wbr>directives

						params

						path

						resolve

						state

						trace

						transition

						url

						view

						Ng2<wbr>View<wbr>Config

						UIRouter<wbr>Config

						Ng2<wbr>Component

						Ng2<wbr>State<wbr>Declaration

						Ng2<wbr>View<wbr>Declaration

						UIROUTER_<wbr>PROVIDERS

						ng2<wbr>Views<wbr>Builder

						ui<wbr>Router<wbr>Factory

Legend

Module

Object literal

Variable

Function

Function with type parameter

Index signature

Type alias

Enumeration

Enumeration member

Property

Method

Interface

Interface with type parameter

Constructor

Property

Method

Index signature

Class

Class with type parameter

Constructor

Property

Method

Accessor

Index signature

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Protected property

Protected method

Protected accessor

Private property

Private method

Private accessor

Static property

Static method

Generated using TypeDoc


text:
(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-selection'), require('d3-format'), require('d3-dispatch'), require('d3-scale'), require('d3-array')) :
	typeof define === 'function' && define.amd ? define(['exports', 'd3-selection', 'd3-format', 'd3-dispatch', 'd3-scale', 'd3-array'], factory) :
	(factory((global.indexRollup = global.indexRollup || {}),global.d3Selection,global.d3Format,global.d3Dispatch,global.d3Scale,global.d3Array));
}(this, (function (exports,d3Selection,d3Format,d3Dispatch,d3Scale,d3Array) { 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  return typeof obj;
} : function (obj) {
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};

var d3_identity = function d3_identity(d) {
  return d;
};

var d3_reverse = function d3_reverse(arr) {
  var mirror = [];
  for (var i = 0, l = arr.length; i < l; i++) {
    mirror[i] = arr[l - i - 1];
  }
  return mirror;
};

//Text wrapping code adapted from Mike Bostock
var d3_textWrapping = function d3_textWrapping(text, width) {
  text.each(function () {
    var text = d3Selection.select(this),
        words = text.text().split(/\s+/).reverse(),
        word,
        line = [],
        lineNumber = 0,
        lineHeight = 1.2,
        //ems
    y = text.attr("y"),
        dy = parseFloat(text.attr("dy")) || 0,
        tspan = text.text(null).append("tspan").attr("x", 0).attr("dy", dy + "em");

    while (word = words.pop()) {
      line.push(word);
      tspan.text(line.join(" "));
      if (tspan.node().getComputedTextLength() > width && line.length > 1) {
        line.pop();
        tspan.text(line.join(" "));
        line = [word];
        tspan = text.append("tspan").attr("x", 0).attr("dy", lineHeight + dy + "em").text(word);
      }
    }
  });
};

var d3_mergeLabels = function d3_mergeLabels() {
  var gen = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var labels = arguments[1];
  var domain = arguments[2];
  var range = arguments[3];
  var labelDelimiter = arguments[4];

  if ((typeof labels === "undefined" ? "undefined" : _typeof(labels)) === "object") {
    if (labels.length === 0) return gen;

    var i = labels.length;
    for (; i < gen.length; i++) {
      labels.push(gen[i]);
    }
    return labels;
  } else if (typeof labels === "function") {
    var customLabels = [];
    var genLength = gen.length;
    for (var _i = 0; _i < genLength; _i++) {
      customLabels.push(labels({
        i: _i,
        genLength: genLength,
        generatedLabels: gen,
        domain: domain,
        range: range,
        labelDelimiter: labelDelimiter
      }));
    }
    return customLabels;
  }

  return gen;
};

var d3_linearLegend = function d3_linearLegend(scale, cells, labelFormat) {
  var data = [];

  if (cells.length > 1) {
    data = cells;
  } else {
    var domain = scale.domain(),
        increment = (domain[domain.length - 1] - domain[0]) / (cells - 1);
    var i = 0;

    for (; i < cells; i++) {
      data.push(domain[0] + i * increment);
    }
  }

  var labels = data.map(labelFormat);
  return {
    data: data,
    labels: labels,
    feature: function feature(d) {
      return scale(d);
    }
  };
};

var d3_quantLegend = function d3_quantLegend(scale, labelFormat, labelDelimiter) {
  var labels = scale.range().map(function (d) {
    var invert = scale.invertExtent(d);
    return labelFormat(invert[0]) + " " + labelDelimiter + " " + labelFormat(invert[1]);
  });

  return {
    data: scale.range(),
    labels: labels,
    feature: d3_identity
  };
};

var d3_ordinalLegend = function d3_ordinalLegend(scale) {
  return {
    data: scale.domain(),
    labels: scale.domain(),
    feature: function feature(d) {
      return scale(d);
    }
  };
};

var d3_cellOver = function d3_cellOver(cellDispatcher, d, obj) {
  cellDispatcher.call("cellover", obj, d);
};

var d3_cellOut = function d3_cellOut(cellDispatcher, d, obj) {
  cellDispatcher.call("cellout", obj, d);
};

var d3_cellClick = function d3_cellClick(cellDispatcher, d, obj) {
  cellDispatcher.call("cellclick", obj, d);
};

var helper = {
  d3_drawShapes: function d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, path) {
    if (shape === "rect") {
      shapes.attr("height", shapeHeight).attr("width", shapeWidth);
    } else if (shape === "circle") {
      shapes.attr("r", shapeRadius);
    } else if (shape === "line") {
      shapes.attr("x1", 0).attr("x2", shapeWidth).attr("y1", 0).attr("y2", 0);
    } else if (shape === "path") {
      shapes.attr("d", path);
    }
  },

  d3_addText: function d3_addText(svg, enter, labels, classPrefix, labelWidth) {
    enter.append("text").attr("class", classPrefix + "label");
    var text = svg.selectAll("g." + classPrefix + "cell text." + classPrefix + "label").data(labels).text(d3_identity);

    if (labelWidth) {
      svg.selectAll("g." + classPrefix + "cell text." + classPrefix + "label").call(d3_textWrapping, labelWidth);
    }

    return text;
  },

  d3_calcType: function d3_calcType(scale, ascending, cells, labels, labelFormat, labelDelimiter) {
    var type = scale.invertExtent ? d3_quantLegend(scale, labelFormat, labelDelimiter) : scale.ticks ? d3_linearLegend(scale, cells, labelFormat) : d3_ordinalLegend(scale);

    //for d3.scaleSequential that doesn't have a range function
    var range = scale.range && scale.range() || scale.domain();
    type.labels = d3_mergeLabels(type.labels, labels, scale.domain(), range, labelDelimiter);

    if (ascending) {
      type.labels = d3_reverse(type.labels);
      type.data = d3_reverse(type.data);
    }

    return type;
  },

  d3_filterCells: function d3_filterCells(type, cellFilter) {
    var filterCells = type.data.map(function (d, i) {
      return { data: d, label: type.labels[i] };
    }).filter(cellFilter);
    var dataValues = filterCells.map(function (d) {
      return d.data;
    });
    var labelValues = filterCells.map(function (d) {
      return d.label;
    });
    type.data = type.data.filter(function (d) {
      return dataValues.indexOf(d) !== -1;
    });
    type.labels = type.labels.filter(function (d) {
      return labelValues.indexOf(d) !== -1;
    });
    return type;
  },

  d3_placement: function d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign) {
    cell.attr("transform", cellTrans);
    text.attr("transform", textTrans);
    if (orient === "horizontal") {
      text.style("text-anchor", labelAlign);
    }
  },

  d3_addEvents: function d3_addEvents(cells, dispatcher) {
    cells.on("mouseover.legend", function (d) {
      d3_cellOver(dispatcher, d, this);
    }).on("mouseout.legend", function (d) {
      d3_cellOut(dispatcher, d, this);
    }).on("click.legend", function (d) {
      d3_cellClick(dispatcher, d, this);
    });
  },

  d3_title: function d3_title(svg, title, classPrefix, titleWidth) {
    if (title !== "") {
      var titleText = svg.selectAll("text." + classPrefix + "legendTitle");

      titleText.data([title]).enter().append("text").attr("class", classPrefix + "legendTitle");

      svg.selectAll("text." + classPrefix + "legendTitle").text(title);

      if (titleWidth) {
        svg.selectAll("text." + classPrefix + "legendTitle").call(d3_textWrapping, titleWidth);
      }

      var cellsSvg = svg.select("." + classPrefix + "legendCells");
      var yOffset = svg.select("." + classPrefix + "legendTitle").nodes().map(function (d) {
        return d.getBBox().height;
      })[0],
          xOffset = -cellsSvg.nodes().map(function (d) {
        return d.getBBox().x;
      })[0];
      cellsSvg.attr("transform", "translate(" + xOffset + "," + yOffset + ")");
    }
  },

  d3_defaultLocale: {
    format: d3Format.format,
    formatPrefix: d3Format.formatPrefix
  },

  d3_defaultFormatSpecifier: ".01f",

  d3_defaultDelimiter: "to"
};

function color() {
  var scale = d3Scale.scaleLinear(),
      shape = "rect",
      shapeWidth = 15,
      shapeHeight = 15,
      shapeRadius = 10,
      shapePadding = 2,
      cells = [5],
      cellFilter = void 0,
      labels = [],
      classPrefix = "",
      useClass = false,
      title = "",
      locale = helper.d3_defaultLocale,
      specifier = helper.d3_defaultFormatSpecifier,
      labelOffset = 10,
      labelAlign = "middle",
      labelDelimiter = helper.d3_defaultDelimiter,
      labelWrap = void 0,
      orient = "vertical",
      ascending = false,
      path = void 0,
      titleWidth = void 0,
      legendDispatcher = d3Dispatch.dispatch("cellover", "cellout", "cellclick");

  function legend(svg) {
    var type = helper.d3_calcType(scale, ascending, cells, labels, locale.format(specifier), labelDelimiter),
        legendG = svg.selectAll("g").data([scale]);

    legendG.enter().append("g").attr("class", classPrefix + "legendCells");

    if (cellFilter) {
      helper.d3_filterCells(type, cellFilter);
    }

    var cell = svg.select("." + classPrefix + "legendCells").selectAll("." + classPrefix + "cell").data(type.data);

    var cellEnter = cell.enter().append("g").attr("class", classPrefix + "cell");
    cellEnter.append(shape).attr("class", classPrefix + "swatch");

    var shapes = svg.selectAll("g." + classPrefix + "cell " + shape + "." + classPrefix + "swatch").data(type.data);

    //add event handlers
    helper.d3_addEvents(cellEnter, legendDispatcher);

    cell.exit().transition().style("opacity", 0).remove();
    shapes.exit().transition().style("opacity", 0).remove();

    shapes = shapes.merge(shapes);

    helper.d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, path);
    var text = helper.d3_addText(svg, cellEnter, type.labels, classPrefix, labelWrap);

    // we need to merge the selection, otherwise changes in the legend (e.g. change of orientation) are applied only to the new cells and not the existing ones.
    cell = cellEnter.merge(cell);

    // sets placement
    var textSize = text.nodes().map(function (d) {
      return d.getBBox();
    }),
        shapeSize = shapes.nodes().map(function (d) {
      return d.getBBox();
    });
    //sets scale
    //everything is fill except for line which is stroke,
    if (!useClass) {
      if (shape == "line") {
        shapes.style("stroke", type.feature);
      } else {
        shapes.style("fill", type.feature);
      }
    } else {
      shapes.attr("class", function (d) {
        return classPrefix + "swatch " + type.feature(d);
      });
    }

    var cellTrans = void 0,
        textTrans = void 0,
        textAlign = labelAlign == "start" ? 0 : labelAlign == "middle" ? 0.5 : 1;

    //positions cells and text
    if (orient === "vertical") {
      (function () {
        var cellSize = textSize.map(function (d, i) {
          return Math.max(d.height, shapeSize[i].height);
        });

        cellTrans = function cellTrans(d, i) {
          var height = d3Array.sum(cellSize.slice(0, i));
          return "translate(0, " + (height + i * shapePadding) + ")";
        };

        textTrans = function textTrans(d, i) {
          return "translate( " + (shapeSize[i].width + shapeSize[i].x + labelOffset) + ", " + (shapeSize[i].y + shapeSize[i].height / 2 + 5) + ")";
        };
      })();
    } else if (orient === "horizontal") {
      cellTrans = function cellTrans(d, i) {
        return "translate(" + i * (shapeSize[i].width + shapePadding) + ",0)";
      };
      textTrans = function textTrans(d, i) {
        return "translate(" + (shapeSize[i].width * textAlign + shapeSize[i].x) + ",\n          " + (shapeSize[i].height + shapeSize[i].y + labelOffset + 8) + ")";
      };
    }

    helper.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
    helper.d3_title(svg, title, classPrefix, titleWidth);

    cell.transition().style("opacity", 1);
  }

  legend.scale = function (_) {
    if (!arguments.length) return scale;
    scale = _;
    return legend;
  };

  legend.cells = function (_) {
    if (!arguments.length) return cells;
    if (_.length > 1 || _ >= 2) {
      cells = _;
    }
    return legend;
  };

  legend.cellFilter = function (_) {
    if (!arguments.length) return cellFilter;
    cellFilter = _;
    return legend;
  };

  legend.shape = function (_, d) {
    if (!arguments.length) return shape;
    if (_ == "rect" || _ == "circle" || _ == "line" || _ == "path" && typeof d === "string") {
      shape = _;
      path = d;
    }
    return legend;
  };

  legend.shapeWidth = function (_) {
    if (!arguments.length) return shapeWidth;
    shapeWidth = +_;
    return legend;
  };

  legend.shapeHeight = function (_) {
    if (!arguments.length) return shapeHeight;
    shapeHeight = +_;
    return legend;
  };

  legend.shapeRadius = function (_) {
    if (!arguments.length) return shapeRadius;
    shapeRadius = +_;
    return legend;
  };

  legend.shapePadding = function (_) {
    if (!arguments.length) return shapePadding;
    shapePadding = +_;
    return legend;
  };

  legend.labels = function (_) {
    if (!arguments.length) return labels;
    labels = _;
    return legend;
  };

  legend.labelAlign = function (_) {
    if (!arguments.length) return labelAlign;
    if (_ == "start" || _ == "end" || _ == "middle") {
      labelAlign = _;
    }
    return legend;
  };

  legend.locale = function (_) {
    if (!arguments.length) return locale;
    locale = d3Format.formatLocale(_);
    return legend;
  };

  legend.labelFormat = function (_) {
    if (!arguments.length) return legend.locale().format(specifier);
    specifier = d3Format.formatSpecifier(_);
    return legend;
  };

  legend.labelOffset = function (_) {
    if (!arguments.length) return labelOffset;
    labelOffset = +_;
    return legend;
  };

  legend.labelDelimiter = function (_) {
    if (!arguments.length) return labelDelimiter;
    labelDelimiter = _;
    return legend;
  };

  legend.labelWrap = function (_) {
    if (!arguments.length) return labelWrap;
    labelWrap = _;
    return legend;
  };

  legend.useClass = function (_) {
    if (!arguments.length) return useClass;
    if (_ === true || _ === false) {
      useClass = _;
    }
    return legend;
  };

  legend.orient = function (_) {
    if (!arguments.length) return orient;
    _ = _.toLowerCase();
    if (_ == "horizontal" || _ == "vertical") {
      orient = _;
    }
    return legend;
  };

  legend.ascending = function (_) {
    if (!arguments.length) return ascending;
    ascending = !!_;
    return legend;
  };

  legend.classPrefix = function (_) {
    if (!arguments.length) return classPrefix;
    classPrefix = _;
    return legend;
  };

  legend.title = function (_) {
    if (!arguments.length) return title;
    title = _;
    return legend;
  };

  legend.titleWidth = function (_) {
    if (!arguments.length) return titleWidth;
    titleWidth = _;
    return legend;
  };

  legend.textWrap = function (_) {
    if (!arguments.length) return textWrap;
    textWrap = _;
    return legend;
  };

  legend.on = function () {
    var value = legendDispatcher.on.apply(legendDispatcher, arguments);
    return value === legendDispatcher ? legend : value;
  };

  return legend;
}

function size() {
  var scale = d3Scale.scaleLinear(),
      shape = "rect",
      shapeWidth = 15,
      shapePadding = 2,
      cells = [5],
      cellFilter = void 0,
      labels = [],
      classPrefix = "",
      title = "",
      locale = helper.d3_defaultLocale,
      specifier = helper.d3_defaultFormatSpecifier,
      labelOffset = 10,
      labelAlign = "middle",
      labelDelimiter = helper.d3_defaultDelimiter,
      labelWrap = void 0,
      orient = "vertical",
      ascending = false,
      path = void 0,
      titleWidth = void 0,
      legendDispatcher = d3Dispatch.dispatch("cellover", "cellout", "cellclick");

  function legend(svg) {
    var type = helper.d3_calcType(scale, ascending, cells, labels, locale.format(specifier), labelDelimiter),
        legendG = svg.selectAll("g").data([scale]);

    if (cellFilter) {
      helper.d3_filterCells(type, cellFilter);
    }

    legendG.enter().append("g").attr("class", classPrefix + "legendCells");

    var cell = svg.select("." + classPrefix + "legendCells").selectAll("." + classPrefix + "cell").data(type.data);
    var cellEnter = cell.enter().append("g").attr("class", classPrefix + "cell");
    cellEnter.append(shape).attr("class", classPrefix + "swatch");

    var shapes = svg.selectAll("g." + classPrefix + "cell " + shape + "." + classPrefix + "swatch");

    //add event handlers
    helper.d3_addEvents(cellEnter, legendDispatcher);

    cell.exit().transition().style("opacity", 0).remove();

    shapes.exit().transition().style("opacity", 0).remove();
    shapes = shapes.merge(shapes);

    //creates shape
    if (shape === "line") {
      helper.d3_drawShapes(shape, shapes, 0, shapeWidth);
      shapes.attr("stroke-width", type.feature);
    } else {
      helper.d3_drawShapes(shape, shapes, type.feature, type.feature, type.feature, path);
    }

    var text = helper.d3_addText(svg, cellEnter, type.labels, classPrefix, labelWrap);

    // we need to merge the selection, otherwise changes in the legend (e.g. change of orientation) are applied only to the new cells and not the existing ones.
    cell = cellEnter.merge(cell);

    //sets placement

    var textSize = text.nodes().map(function (d) {
      return d.getBBox();
    }),
        shapeSize = shapes.nodes().map(function (d, i) {
      var bbox = d.getBBox();
      var stroke = scale(type.data[i]);

      if (shape === "line" && orient === "horizontal") {
        bbox.height = bbox.height + stroke;
      } else if (shape === "line" && orient === "vertical") {
        bbox.width = bbox.width;
      }
      return bbox;
    });

    var maxH = d3Array.max(shapeSize, function (d) {
      return d.height + d.y;
    }),
        maxW = d3Array.max(shapeSize, function (d) {
      return d.width + d.x;
    });

    var cellTrans = void 0,
        textTrans = void 0,
        textAlign = labelAlign == "start" ? 0 : labelAlign == "middle" ? 0.5 : 1;

    //positions cells and text
    if (orient === "vertical") {
      (function () {
        var cellSize = textSize.map(function (d, i) {
          return Math.max(d.height, shapeSize[i].height);
        });
        var y = shape == "circle" || shape == "line" ? shapeSize[0].height / 2 : 0;
        cellTrans = function cellTrans(d, i) {
          var height = d3Array.sum(cellSize.slice(0, i));

          return "translate(0, " + (y + height + i * shapePadding) + ")";
        };

        textTrans = function textTrans(d, i) {
          return "translate( " + (maxW + labelOffset) + ",\n          " + (shapeSize[i].y + shapeSize[i].height / 2 + 5) + ")";
        };
      })();
    } else if (orient === "horizontal") {
      (function () {
        cellTrans = function cellTrans(d, i) {
          var width = d3Array.sum(shapeSize.slice(0, i), function (d) {
            return d.width;
          });
          var y = shape == "circle" || shape == "line" ? maxH / 2 : 0;
          return "translate(" + (width + i * shapePadding) + ", " + y + ")";
        };

        var offset = shape == "line" ? maxH / 2 : maxH;
        textTrans = function textTrans(d, i) {
          return "translate( " + (shapeSize[i].width * textAlign + shapeSize[i].x) + ",\n              " + (offset + labelOffset) + ")";
        };
      })();
    }

    helper.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
    helper.d3_title(svg, title, classPrefix, titleWidth);

    cell.transition().style("opacity", 1);
  }

  legend.scale = function (_) {
    if (!arguments.length) return scale;
    scale = _;
    return legend;
  };

  legend.cells = function (_) {
    if (!arguments.length) return cells;
    if (_.length > 1 || _ >= 2) {
      cells = _;
    }
    return legend;
  };

  legend.cellFilter = function (_) {
    if (!arguments.length) return cellFilter;
    cellFilter = _;
    return legend;
  };

  legend.shape = function (_, d) {
    if (!arguments.length) return shape;
    if (_ == "rect" || _ == "circle" || _ == "line") {
      shape = _;
      path = d;
    }
    return legend;
  };

  legend.shapeWidth = function (_) {
    if (!arguments.length) return shapeWidth;
    shapeWidth = +_;
    return legend;
  };

  legend.shapePadding = function (_) {
    if (!arguments.length) return shapePadding;
    shapePadding = +_;
    return legend;
  };

  legend.labels = function (_) {
    if (!arguments.length) return labels;
    labels = _;
    return legend;
  };

  legend.labelAlign = function (_) {
    if (!arguments.length) return labelAlign;
    if (_ == "start" || _ == "end" || _ == "middle") {
      labelAlign = _;
    }
    return legend;
  };

  legend.locale = function (_) {
    if (!arguments.length) return locale;
    locale = d3Format.formatLocale(_);
    return legend;
  };

  legend.labelFormat = function (_) {
    if (!arguments.length) return legend.locale().format(specifier);
    specifier = d3Format.formatSpecifier(_);
    return legend;
  };

  legend.labelOffset = function (_) {
    if (!arguments.length) return labelOffset;
    labelOffset = +_;
    return legend;
  };

  legend.labelDelimiter = function (_) {
    if (!arguments.length) return labelDelimiter;
    labelDelimiter = _;
    return legend;
  };

  legend.labelWrap = function (_) {
    if (!arguments.length) return labelWrap;
    labelWrap = _;
    return legend;
  };

  legend.orient = function (_) {
    if (!arguments.length) return orient;
    _ = _.toLowerCase();
    if (_ == "horizontal" || _ == "vertical") {
      orient = _;
    }
    return legend;
  };

  legend.ascending = function (_) {
    if (!arguments.length) return ascending;
    ascending = !!_;
    return legend;
  };

  legend.classPrefix = function (_) {
    if (!arguments.length) return classPrefix;
    classPrefix = _;
    return legend;
  };

  legend.title = function (_) {
    if (!arguments.length) return title;
    title = _;
    return legend;
  };

  legend.titleWidth = function (_) {
    if (!arguments.length) return titleWidth;
    titleWidth = _;
    return legend;
  };

  legend.on = function () {
    var value = legendDispatcher.on.apply(legendDispatcher, arguments);
    return value === legendDispatcher ? legend : value;
  };

  return legend;
}

function symbol() {
  var scale = d3Scale.scaleLinear(),
      shape = "path",
      shapeWidth = 15,
      shapeHeight = 15,
      shapeRadius = 10,
      shapePadding = 5,
      cells = [5],
      cellFilter = void 0,
      labels = [],
      classPrefix = "",
      title = "",
      locale = helper.d3_defaultLocale,
      specifier = helper.d3_defaultFormatSpecifier,
      labelAlign = "middle",
      labelOffset = 10,
      labelDelimiter = helper.d3_defaultDelimiter,
      labelWrap = void 0,
      orient = "vertical",
      ascending = false,
      titleWidth = void 0,
      legendDispatcher = d3Dispatch.dispatch("cellover", "cellout", "cellclick");

  function legend(svg) {
    var type = helper.d3_calcType(scale, ascending, cells, labels, locale.format(specifier), labelDelimiter),
        legendG = svg.selectAll("g").data([scale]);

    if (cellFilter) {
      helper.d3_filterCells(type, cellFilter);
    }

    legendG.enter().append("g").attr("class", classPrefix + "legendCells");

    var cell = svg.select("." + classPrefix + "legendCells").selectAll("." + classPrefix + "cell").data(type.data);
    var cellEnter = cell.enter().append("g").attr("class", classPrefix + "cell");
    cellEnter.append(shape).attr("class", classPrefix + "swatch");

    var shapes = svg.selectAll("g." + classPrefix + "cell " + shape + "." + classPrefix + "swatch");

    //add event handlers
    helper.d3_addEvents(cellEnter, legendDispatcher);

    //remove old shapes
    cell.exit().transition().style("opacity", 0).remove();
    shapes.exit().transition().style("opacity", 0).remove();
    shapes = shapes.merge(shapes);

    helper.d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, type.feature);
    var text = helper.d3_addText(svg, cellEnter, type.labels, classPrefix, labelWrap);

    // we need to merge the selection, otherwise changes in the legend (e.g. change of orientation) are applied only to the new cells and not the existing ones.
    cell = cellEnter.merge(cell);

    // sets placement
    var textSize = text.nodes().map(function (d) {
      return d.getBBox();
    }),
        shapeSize = shapes.nodes().map(function (d) {
      return d.getBBox();
    });

    var maxH = d3Array.max(shapeSize, function (d) {
      return d.height;
    }),
        maxW = d3Array.max(shapeSize, function (d) {
      return d.width;
    });

    var cellTrans = void 0,
        textTrans = void 0,
        textAlign = labelAlign == "start" ? 0 : labelAlign == "middle" ? 0.5 : 1;

    //positions cells and text
    if (orient === "vertical") {
      (function () {
        var cellSize = textSize.map(function (d, i) {
          return Math.max(maxH, d.height);
        });

        cellTrans = function cellTrans(d, i) {
          var height = d3Array.sum(cellSize.slice(0, i));
          return "translate(0, " + (height + i * shapePadding) + " )";
        };
        textTrans = function textTrans(d, i) {
          return "translate( " + (maxW + labelOffset) + ",\n              " + (shapeSize[i].y + shapeSize[i].height / 2 + 5) + ")";
        };
      })();
    } else if (orient === "horizontal") {
      cellTrans = function cellTrans(d, i) {
        return "translate( " + i * (maxW + shapePadding) + ",0)";
      };
      textTrans = function textTrans(d, i) {
        return "translate( " + (shapeSize[i].width * textAlign + shapeSize[i].x) + ",\n              " + (maxH + labelOffset) + ")";
      };
    }

    helper.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
    helper.d3_title(svg, title, classPrefix, titleWidth);
    cell.transition().style("opacity", 1);
  }

  legend.scale = function (_) {
    if (!arguments.length) return scale;
    scale = _;
    return legend;
  };

  legend.cells = function (_) {
    if (!arguments.length) return cells;
    if (_.length > 1 || _ >= 2) {
      cells = _;
    }
    return legend;
  };

  legend.cellFilter = function (_) {
    if (!arguments.length) return cellFilter;
    cellFilter = _;
    return legend;
  };

  legend.shapePadding = function (_) {
    if (!arguments.length) return shapePadding;
    shapePadding = +_;
    return legend;
  };

  legend.labels = function (_) {
    if (!arguments.length) return labels;
    labels = _;
    return legend;
  };

  legend.labelAlign = function (_) {
    if (!arguments.length) return labelAlign;
    if (_ == "start" || _ == "end" || _ == "middle") {
      labelAlign = _;
    }
    return legend;
  };

  legend.locale = function (_) {
    if (!arguments.length) return locale;
    locale = d3Format.formatLocale(_);
    return legend;
  };

  legend.labelFormat = function (_) {
    if (!arguments.length) return legend.locale().format(specifier);
    specifier = d3Format.formatSpecifier(_);
    return legend;
  };

  legend.labelOffset = function (_) {
    if (!arguments.length) return labelOffset;
    labelOffset = +_;
    return legend;
  };

  legend.labelDelimiter = function (_) {
    if (!arguments.length) return labelDelimiter;
    labelDelimiter = _;
    return legend;
  };

  legend.labelWrap = function (_) {
    if (!arguments.length) return labelWrap;
    labelWrap = _;
    return legend;
  };

  legend.orient = function (_) {
    if (!arguments.length) return orient;
    _ = _.toLowerCase();
    if (_ == "horizontal" || _ == "vertical") {
      orient = _;
    }
    return legend;
  };

  legend.ascending = function (_) {
    if (!arguments.length) return ascending;
    ascending = !!_;
    return legend;
  };

  legend.classPrefix = function (_) {
    if (!arguments.length) return classPrefix;
    classPrefix = _;
    return legend;
  };

  legend.title = function (_) {
    if (!arguments.length) return title;
    title = _;
    return legend;
  };

  legend.titleWidth = function (_) {
    if (!arguments.length) return titleWidth;
    titleWidth = _;
    return legend;
  };

  legend.on = function () {
    var value = legendDispatcher.on.apply(legendDispatcher, arguments);
    return value === legendDispatcher ? legend : value;
  };

  return legend;
}

var thresholdLabels = function thresholdLabels(_ref) {
  var i = _ref.i,
      genLength = _ref.genLength,
      generatedLabels = _ref.generatedLabels,
      labelDelimiter = _ref.labelDelimiter;

  if (i === 0) {
    var values = generatedLabels[i].split(" " + labelDelimiter + " ");
    return "Less than " + values[1];
  } else if (i === genLength - 1) {
    var _values = generatedLabels[i].split(" " + labelDelimiter + " ");
    return _values[0] + " or more";
  }
  return generatedLabels[i];
};

var legendHelpers = {
  thresholdLabels: thresholdLabels
};

var index = {
  legendColor: color,
  legendSize: size,
  legendSymbol: symbol,
  legendHelpers: legendHelpers
};

exports.legendColor = color;
exports.legendSize = size;
exports.legendSymbol = symbol;
exports.legendHelpers = legendHelpers;
exports['default'] = index;

Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=indexRollup.js.map


text:
import React, { Component } from 'react';
import * as PropTypes from 'prop-types';
import { withRouter, Link } from 'react-router-dom';
import withStyles from '@mui/styles/withStyles';
import { compose } from 'ramda';
import Button from '@mui/material/Button';
import { RowingOutlined, ArrowForwardIosOutlined } from '@mui/icons-material';
import inject18n from '../../../components/i18n';

const styles = (theme) => ({
  buttonHome: {
    marginRight: theme.spacing(2),
    padding: '0 5px 0 5px',
    minHeight: 20,
    textTransform: 'none',
  },
  button: {
    marginRight: theme.spacing(2),
    padding: '0 5px 0 5px',
    minHeight: 20,
    minWidth: 20,
    textTransform: 'none',
  },
  icon: {
    marginRight: theme.spacing(1),
  },
  arrow: {
    verticalAlign: 'middle',
    marginRight: 10,
  },
});

class TopMenuExercise extends Component {
  render() {
    const {
      t,
      classes,
      location,
      match: {
        params: { exerciseId },
      },
    } = this.props;
    return (
      <div>
        <Button
          component={Link}
          to="/exercises"
          variant="contained"
          size="small"
          color="primary"
          classes={{ root: classes.buttonHome }}
        >
          <RowingOutlined className={classes.icon} fontSize="small" />
          {t('Exercises')}
        </Button>
        <ArrowForwardIosOutlined
          color="primary"
          classes={{ root: classes.arrow }}
        />
        <Button
          component={Link}
          to={`/exercises/${exerciseId}`}
          variant={
            location.pathname === `/exercises/${exerciseId}`
              ? 'contained'
              : 'text'
          }
          size="small"
          color={
            location.pathname === `/exercises/${exerciseId}`
              ? 'secondary'
              : 'primary'
          }
          classes={{ root: classes.button }}
        >
          {t('Overview')}
        </Button>
        <Button
          component={Link}
          to={`/exercises/${exerciseId}/animation`}
          variant={
            location.pathname.includes(`/exercises/${exerciseId}/animation`)
              ? 'contained'
              : 'text'
          }
          size="small"
          color={
            location.pathname.includes(`/exercises/${exerciseId}/animation`)
              ? 'secondary'
              : 'primary'
          }
          classes={{ root: classes.button }}
        >
          {t('Animation')}
        </Button>
        <Button
          component={Link}
          to={`/exercises/${exerciseId}/audiences`}
          variant={
            location.pathname.includes(`/exercises/${exerciseId}/audiences`)
              ? 'contained'
              : 'text'
          }
          size="small"
          color={
            location.pathname.includes(`/exercises/${exerciseId}/audiences`)
              ? 'secondary'
              : 'primary'
          }
          classes={{ root: classes.button }}
        >
          {t('Audiences')}
        </Button>
        <Button
          component={Link}
          to={`/exercises/${exerciseId}/scenario`}
          variant={
            location.pathname === `/exercises/${exerciseId}/scenario`
              ? 'contained'
              : 'text'
          }
          size="small"
          color={
            location.pathname === `/exercises/${exerciseId}/scenario`
              ? 'secondary'
              : 'primary'
          }
          classes={{ root: classes.button }}
        >
          {t('Scenario')}
        </Button>
        <Button
          component={Link}
          to={`/exercises/${exerciseId}/controls`}
          variant={
            location.pathname.includes(`/exercises/${exerciseId}/controls`)
              ? 'contained'
              : 'text'
          }
          size="small"
          color={
            location.pathname.includes(`/exercises/${exerciseId}/controls`)
              ? 'secondary'
              : 'primary'
          }
          classes={{ root: classes.button }}
        >
          {t('Controls')}
        </Button>
        <Button
          component={Link}
          to={`/exercises/${exerciseId}/lessons`}
          variant={
            location.pathname === `/exercises/${exerciseId}/lessons`
              ? 'contained'
              : 'text'
          }
          size="small"
          color={
            location.pathname === `/exercises/${exerciseId}/lessons`
              ? 'secondary'
              : 'primary'
          }
          classes={{ root: classes.button }}
        >
          {t('Lessons learned')}
        </Button>
      </div>
    );
  }
}

TopMenuExercise.propTypes = {
  classes: PropTypes.object,
  location: PropTypes.object,
  match: PropTypes.object,
  t: PropTypes.func,
  history: PropTypes.object,
};

export default compose(
  inject18n,
  withRouter,
  withStyles(styles),
)(TopMenuExercise);


text:
typedef struct Error {
    int error_code_;
    std::string error_explain;
} Error;

#endif


text:
/* Generic context menu styles */
.contextMenu {
    position: absolute;
    width: 120px;
    z-index: 99999;
    border: solid 1px #CCC;
    background: #EEE;
    padding: 0px;
    margin: 0px;
    display: none;
}

.contextMenu LI {
    list-style: none;
    padding: 0px;
    margin: 0px;
}

.contextMenu A {
    color: #333;
    text-decoration: none;
    display: block;
    line-height: 20px;
    height: 20px;
    background-position: 6px center;
    background-repeat: no-repeat;
    outline: none;
    padding: 1px 5px;
    padding-left: 28px;
}

.contextMenu LI.hover A {
    color: #FFF;
    background-color: #3399FF;
}

.contextMenu LI.disabled A {
    color: #AAA;
    cursor: default;
}

.contextMenu LI.hover.disabled A {
    background-color: transparent;
}

.contextMenu LI.separator {
    border-top: solid 1px #CCC;
}

.contextMenu LI.copy A {
    background-image: image_url("jquery/ui/contextMenu/copy.png");
}

.contextMenu LI.cut A {
    background-image: image_url("jquery/ui/contextMenu/cut.png");
}

.contextMenu LI.delete A {
    background-image: image_url("jquery/ui/contextMenu/delete.png");
}

.contextMenu LI.edit A {
    background-image: image_url("jquery/ui/contextMenu/edit.png");
}

.contextMenu LI.new A {
    background-image: image_url("jquery/ui/contextMenu/new.png");
}

.contextMenu LI.paste A {
    background-image: image_url("jquery/ui/contextMenu/paste.png");
}

.contextMenu LI.quit A {
    background-image: image_url("jquery/ui/contextMenu/exit.png");
}

.contextMenu LI.rename A {
    background-image: image_url("jquery/ui/contextMenu/rename.png");
}

.contextMenu LI.show A {
    background-image: image_url("jquery/ui/contextMenu/show.png");
}

.contextMenu LI.trash A {
    background-image: image_url("jquery/ui/contextMenu/trash.png");
}


text:
var Server = require('./src/middleware/iopaCoAP.js');
module.exports = Server;


text:
package sg.ncl.service.team.domain;

/**
 * The {@link TeamStatus} enumerates the statuses of a {@link Team}.
 *
 * @author Christopher Zhong
 */
public enum TeamStatus {
    PENDING, APPROVED, RESTRICTED, REJECTED, CLOSED
}


text:
/*	$NetBSD: obiovar.h,v 1.4 2003/06/16 17:40:53 thorpej Exp $	*/

/*-
 * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
 * All rights reserved.
 *
 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed for the NetBSD Project by
 *	Wasabi Systems, Inc.
 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
 *    or promote products derived from this software without specific prior
 *    written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * $FreeBSD: releng/9.3/sys/mips/adm5120/obiovar.h 202175 2010-01-12 21:36:08Z imp $
 *
 */

#ifndef _ADM5120_OBIOVAR_H_
#define	_ADM5120_OBIOVAR_H_

#include <sys/rman.h>

/* Number of IRQs */
#define	NIRQS	32

#define	OBIO_MEM_START	0x10C00000L
#define	OBIO_MEM_SIZE	0x1e00000

struct obio_softc {
	struct rman		oba_mem_rman;
	struct rman		oba_irq_rman;
	struct intr_event	*sc_eventstab[NIRQS]; /* IRQ events structs */
	struct resource		*sc_irq;	/* IRQ resource */
	void			*sc_ih;		/* interrupt cookie */
	struct resource		*sc_fast_irq;	/* IRQ resource */
	void			*sc_fast_ih;	/* interrupt cookie */
};

struct obio_ivar {
	struct resource_list	resources;
};

#endif /* _ADM5120_OBIOVAR_H_ */


text:
<?php

namespace DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRAuditEvent;

use DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRAuditEventAgentNetworkType;
use DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement;
use DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString;
use DCarbone\PHPFHIRGenerated\R4\PHPFHIRConstants;
use DCarbone\PHPFHIRGenerated\R4\PHPFHIRTypeInterface;

/**
 * A record of an event made for purposes of maintaining a security log. Typical
 * uses include detection of intrusion attempts and monitoring for inappropriate
 * usage.
 *
 * Class FHIRAuditEventNetwork
 * @package \DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRAuditEvent
 */
class FHIRAuditEventNetwork extends FHIRBackboneElement
{
    // name of FHIR type this class describes
    const FHIR_TYPE_NAME = PHPFHIRConstants::TYPE_NAME_AUDIT_EVENT_DOT_NETWORK;
    const FIELD_ADDRESS = 'address';
    const FIELD_ADDRESS_EXT = '_address';
    const FIELD_TYPE = 'type';
    const FIELD_TYPE_EXT = '_type';

    /** @var string */
    private $_xmlns = 'http://hl7.org/fhir';

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An identifier for the network access point of the user device for the audit
     * event.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString
     */
    protected $address = null;

    /**
     * The type of network access point of this agent in the audit event.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An identifier for the type of network access point that originated the audit
     * event.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRAuditEventAgentNetworkType
     */
    protected $type = null;

    /**
     * Validation map for fields in type AuditEvent.Network
     * @var array
     */
    private static $_validationRules = [    ];

    /**
     * FHIRAuditEventNetwork Constructor
     * @param null|array $data
     */
    public function __construct($data = null)
    {
        if (null === $data || [] === $data) {
            return;
        }
        if (!is_array($data)) {
            throw new \InvalidArgumentException(sprintf(
                'FHIRAuditEventNetwork::_construct - $data expected to be null or array, %s seen',
                gettype($data)
            ));
        }
        parent::__construct($data);
        if (isset($data[self::FIELD_ADDRESS]) || isset($data[self::FIELD_ADDRESS_EXT])) {
            if (isset($data[self::FIELD_ADDRESS])) {
                $value = $data[self::FIELD_ADDRESS];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_ADDRESS_EXT]) && is_array($data[self::FIELD_ADDRESS_EXT])) {
                $ext = $data[self::FIELD_ADDRESS_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRString) {
                    $this->setAddress($value);
                } else if (is_array($value)) {
                    $this->setAddress(new FHIRString(array_merge($ext, $value)));
                } else {
                    $this->setAddress(new FHIRString([FHIRString::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setAddress(new FHIRString($ext));
            }
        }
        if (isset($data[self::FIELD_TYPE]) || isset($data[self::FIELD_TYPE_EXT])) {
            if (isset($data[self::FIELD_TYPE])) {
                $value = $data[self::FIELD_TYPE];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_TYPE_EXT]) && is_array($data[self::FIELD_TYPE_EXT])) {
                $ext = $data[self::FIELD_TYPE_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRAuditEventAgentNetworkType) {
                    $this->setType($value);
                } else if (is_array($value)) {
                    $this->setType(new FHIRAuditEventAgentNetworkType(array_merge($ext, $value)));
                } else {
                    $this->setType(new FHIRAuditEventAgentNetworkType([FHIRAuditEventAgentNetworkType::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setType(new FHIRAuditEventAgentNetworkType($ext));
            }
        }
    }

    /**
     * @return string
     */
    public function _getFHIRTypeName()
    {
        return self::FHIR_TYPE_NAME;
    }

    /**
     * @return string
     */
    public function _getFHIRXMLElementDefinition()
    {
        $xmlns = $this->_getFHIRXMLNamespace();
        if (null !== $xmlns) {
            $xmlns = " xmlns=\"{$xmlns}\"";
        }
        return "<AuditEventNetwork{$xmlns}></AuditEventNetwork>";
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An identifier for the network access point of the user device for the audit
     * event.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString
     */
    public function getAddress()
    {
        return $this->address;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings SHALL NOT exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An identifier for the network access point of the user device for the audit
     * event.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRString $address
     * @return static
     */
    public function setAddress($address = null)
    {
        if (null === $address) {
            $this->address = null;
            return $this;
        }
        if ($address instanceof FHIRString) {
            $this->address = $address;
            return $this;
        }
        $this->address = new FHIRString($address);
        return $this;
    }

    /**
     * The type of network access point of this agent in the audit event.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An identifier for the type of network access point that originated the audit
     * event.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRAuditEventAgentNetworkType
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * The type of network access point of this agent in the audit event.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An identifier for the type of network access point that originated the audit
     * event.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRAuditEventAgentNetworkType $type
     * @return static
     */
    public function setType(FHIRAuditEventAgentNetworkType $type = null)
    {
        $this->type = $type;
        return $this;
    }

    /**
     * Returns the validation rules that this type's fields must comply with to be considered "valid"
     * The returned array is in ["fieldname[.offset]" => ["rule" => {constraint}]]
     *
     * @return array
     */
    public function _getValidationRules()
    {
        return self::$_validationRules;
    }

    /**
     * Validates that this type conforms to the specifications set forth for it by FHIR.  An empty array must be seen as
     * passing.
     *
     * @return array
     */
    public function _getValidationErrors()
    {
        $errs = parent::_getValidationErrors();
        $validationRules = $this->_getValidationRules();
        if (null !== ($v = $this->getAddress())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_ADDRESS] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getType())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_TYPE] = $fieldErrs;
            }
        }
        if (isset($validationRules[self::FIELD_ADDRESS])) {
            $v = $this->getAddress();
            foreach($validationRules[self::FIELD_ADDRESS] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_AUDIT_EVENT_DOT_NETWORK, self::FIELD_ADDRESS, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_ADDRESS])) {
                        $errs[self::FIELD_ADDRESS] = [];
                    }
                    $errs[self::FIELD_ADDRESS][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_TYPE])) {
            $v = $this->getType();
            foreach($validationRules[self::FIELD_TYPE] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_AUDIT_EVENT_DOT_NETWORK, self::FIELD_TYPE, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_TYPE])) {
                        $errs[self::FIELD_TYPE] = [];
                    }
                    $errs[self::FIELD_TYPE][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_MODIFIER_EXTENSION])) {
            $v = $this->getModifierExtension();
            foreach($validationRules[self::FIELD_MODIFIER_EXTENSION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_BACKBONE_ELEMENT, self::FIELD_MODIFIER_EXTENSION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_MODIFIER_EXTENSION])) {
                        $errs[self::FIELD_MODIFIER_EXTENSION] = [];
                    }
                    $errs[self::FIELD_MODIFIER_EXTENSION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_EXTENSION])) {
            $v = $this->getExtension();
            foreach($validationRules[self::FIELD_EXTENSION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT, self::FIELD_EXTENSION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_EXTENSION])) {
                        $errs[self::FIELD_EXTENSION] = [];
                    }
                    $errs[self::FIELD_EXTENSION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_ID])) {
            $v = $this->getId();
            foreach($validationRules[self::FIELD_ID] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT, self::FIELD_ID, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_ID])) {
                        $errs[self::FIELD_ID] = [];
                    }
                    $errs[self::FIELD_ID][$rule] = $err;
                }
            }
        }
        return $errs;
    }

    /**
     * @param \SimpleXMLElement|string|null $sxe
     * @param null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRAuditEvent\FHIRAuditEventNetwork $type
     * @param null|int $libxmlOpts
     * @return null|\DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRAuditEvent\FHIRAuditEventNetwork
     */
    public static function xmlUnserialize($sxe = null, PHPFHIRTypeInterface $type = null, $libxmlOpts = 591872)
    {
        if (null === $sxe) {
            return null;
        }
        if (is_string($sxe)) {
            libxml_use_internal_errors(true);
            $sxe = new \SimpleXMLElement($sxe, $libxmlOpts, false);
            if ($sxe === false) {
                throw new \DomainException(sprintf('FHIRAuditEventNetwork::xmlUnserialize - String provided is not parseable as XML: %s', implode(', ', array_map(function(\libXMLError $err) { return $err->message; }, libxml_get_errors()))));
            }
            libxml_use_internal_errors(false);
        }
        if (!($sxe instanceof \SimpleXMLElement)) {
            throw new \InvalidArgumentException(sprintf('FHIRAuditEventNetwork::xmlUnserialize - $sxe value must be null, \\SimpleXMLElement, or valid XML string, %s seen', gettype($sxe)));
        }
        if (null === $type) {
            $type = new FHIRAuditEventNetwork;
        } elseif (!is_object($type) || !($type instanceof FHIRAuditEventNetwork)) {
            throw new \RuntimeException(sprintf(
                'FHIRAuditEventNetwork::xmlUnserialize - $type must be instance of \DCarbone\PHPFHIRGenerated\R4\FHIRElement\FHIRBackboneElement\FHIRAuditEvent\FHIRAuditEventNetwork or null, %s seen.',
                is_object($type) ? get_class($type) : gettype($type)
            ));
        }
        FHIRBackboneElement::xmlUnserialize($sxe, $type);
        $xmlNamespaces = $sxe->getDocNamespaces(false, false);
        if ([] !== $xmlNamespaces) {
            $ns = reset($xmlNamespaces);
            if (false !== $ns && '' !== $ns) {
                $type->_xmlns = $ns;
            }
        }
        $attributes = $sxe->attributes();
        $children = $sxe->children();
        if (isset($children->address)) {
            $type->setAddress(FHIRString::xmlUnserialize($children->address));
        }
        if (isset($attributes->address)) {
            $pt = $type->getAddress();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->address);
            } else {
                $type->setAddress((string)$attributes->address);
            }
        }
        if (isset($children->type)) {
            $type->setType(FHIRAuditEventAgentNetworkType::xmlUnserialize($children->type));
        }
        return $type;
    }

    /**
     * @param null|\SimpleXMLElement $sxe
     * @param null|int $libxmlOpts
     * @return \SimpleXMLElement
     */
    public function xmlSerialize(\SimpleXMLElement $sxe = null, $libxmlOpts = 591872)
    {
        if (null === $sxe) {
            $sxe = new \SimpleXMLElement($this->_getFHIRXMLElementDefinition(), $libxmlOpts, false);
        }
        parent::xmlSerialize($sxe);
        if (null !== ($v = $this->getAddress())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_ADDRESS, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getType())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_TYPE, null, $v->_getFHIRXMLNamespace()));
        }
        return $sxe;
    }

    /**
     * @return array
     */
    public function jsonSerialize()
    {
        $a = parent::jsonSerialize();
        if (null !== ($v = $this->getAddress())) {
            $a[self::FIELD_ADDRESS] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRString::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRString::FIELD_VALUE]);
                $a[self::FIELD_ADDRESS_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getType())) {
            $a[self::FIELD_TYPE] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRAuditEventAgentNetworkType::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRAuditEventAgentNetworkType::FIELD_VALUE]);
                $a[self::FIELD_TYPE_EXT] = $enc;
            }
        }
        if ([] !== ($vs = $this->_getFHIRComments())) {
            $a[PHPFHIRConstants::JSON_FIELD_FHIR_COMMENTS] = $vs;
        }
        return $a;
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return self::FHIR_TYPE_NAME;
    }
}


text:
module Main where

import Prelude hiding (length, concat)

import Control.Applicative ((<$>))
import Control.Exception (throwIO)
import Data.ByteString (ByteString, length, unpack, pack, concat)
import Data.Bits ((.|.))
import Data.Map (fromList, empty)
import Data.Char (ord)

import System.Linux.Netlink.Internal

main = do
    sock <- makeSocket

    let flags   = foldr (.|.) 0 [fNLM_F_REQUEST]
        header  = Header eRTM_GETLINK flags 42 0
        message = LinkMsg 0 2 0
        attrs   = empty
    iface <- queryOne sock (Packet header message attrs)
    print (packetMessage iface)
    let attrs = packetAttributes iface
    print $ getLinkAddress attrs
    print $ getLinkBroadcast attrs
    print $ getLinkName attrs
    print $ getLinkMTU attrs
    print $ getLinkQDisc attrs
    print $ getLinkTXQLen attrs

dumpNumeric :: ByteString -> IO ()
dumpNumeric b = print $ unpack b


text:
package org.apache.usergrid.mq.cassandra.io;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.usergrid.mq.Message;
import org.apache.usergrid.mq.QueueResults;
import org.apache.usergrid.mq.cassandra.io.NoTransactionSearch.SearchParam;
import org.apache.usergrid.persistence.exceptions.QueueException;
import org.apache.usergrid.utils.UUIDUtils;

import me.prettyprint.cassandra.serializers.ByteBufferSerializer;
import me.prettyprint.cassandra.serializers.UUIDSerializer;
import me.prettyprint.hector.api.Keyspace;
import me.prettyprint.hector.api.beans.ColumnSlice;
import me.prettyprint.hector.api.beans.HColumn;
import me.prettyprint.hector.api.beans.Row;
import me.prettyprint.hector.api.beans.Rows;
import me.prettyprint.hector.api.factory.HFactory;
import me.prettyprint.hector.api.mutation.Mutator;
import me.prettyprint.hector.api.query.SliceQuery;

import static me.prettyprint.hector.api.factory.HFactory.createColumn;
import static me.prettyprint.hector.api.factory.HFactory.createMultigetSliceQuery;
import static me.prettyprint.hector.api.factory.HFactory.createMutator;
import static me.prettyprint.hector.api.factory.HFactory.createSliceQuery;
import static org.apache.usergrid.mq.Queue.QUEUE_NEWEST;
import static org.apache.usergrid.mq.Queue.QUEUE_OLDEST;
import static org.apache.usergrid.mq.cassandra.CassandraMQUtils.deserializeMessage;
import static org.apache.usergrid.mq.cassandra.CassandraMQUtils.getQueueShardRowKey;
import static org.apache.usergrid.mq.cassandra.QueueManagerImpl.ALL_COUNT;
import static org.apache.usergrid.mq.cassandra.QueueManagerImpl.QUEUE_SHARD_INTERVAL;
import static org.apache.usergrid.mq.cassandra.QueueManagerImpl.se;
import static org.apache.usergrid.mq.cassandra.QueuesCF.CONSUMERS;
import static org.apache.usergrid.mq.cassandra.QueuesCF.MESSAGE_PROPERTIES;
import static org.apache.usergrid.mq.cassandra.QueuesCF.QUEUE_INBOX;
import static org.apache.usergrid.mq.cassandra.QueuesCF.QUEUE_PROPERTIES;
import static org.apache.usergrid.utils.NumberUtils.roundLong;
import static org.apache.usergrid.utils.UUIDUtils.MAX_TIME_UUID;
import static org.apache.usergrid.utils.UUIDUtils.MIN_TIME_UUID;
import static org.apache.usergrid.utils.UUIDUtils.getTimestampInMillis;

/** @author tnine */
public abstract class AbstractSearch implements QueueSearch
{

    private static final Logger logger = LoggerFactory.getLogger( AbstractSearch.class );

    protected static final UUIDSerializer ue = new UUIDSerializer();

    protected static final ByteBufferSerializer be = new ByteBufferSerializer();

    protected Keyspace ko;

    /**
     *
     */
    public AbstractSearch( Keyspace ko )
    {
        this.ko = ko;
    }

    /**
     * Get the position in the queue for the given appId, consumer and queu
     *
     * @param queueId The queueId
     * @param consumerId The consumerId
     */
    public UUID getConsumerQueuePosition( UUID queueId, UUID consumerId )
    {
        HColumn<UUID, UUID> result =
                HFactory.createColumnQuery( ko, ue, ue, ue ).setKey( consumerId ).setName( queueId )
                        .setColumnFamily( CONSUMERS.getColumnFamily() ).execute().get();
        if ( result != null )
        {
            return result.getValue();
        }

        return null;
    }

    /** Load the messages into an array list */
    protected List<Message> loadMessages( Collection<UUID> messageIds, boolean reversed )
    {

        Rows<UUID, String, ByteBuffer> messageResults =
                createMultigetSliceQuery( ko, ue, se, be ).setColumnFamily( MESSAGE_PROPERTIES.getColumnFamily() )
                        .setKeys( messageIds ).setRange( null, null, false, ALL_COUNT ).execute().get();

        List<Message> messages = new ArrayList<Message>( messageIds.size() );

        for ( Row<UUID, String, ByteBuffer> row : messageResults )
        {
            Message message = deserializeMessage( row.getColumnSlice().getColumns() );

            if ( message != null )
            {
                messages.add( message );
            }
        }

        Collections.sort( messages, new RequestedOrderComparator( messageIds ) );

        return messages;
    }

    /** Create the results to return from the given messages */
    protected QueueResults createResults( List<Message> messages, String queuePath, UUID queueId, UUID consumerId )
    {

        UUID lastId = null;

        if ( messages != null && messages.size() > 0 )
        {
            lastId = messages.get( messages.size() - 1 ).getUuid();
        }

        return new QueueResults( queuePath, queueId, messages, lastId, consumerId );
    }

    /**
     * Get a list of UUIDs that can be read for the client. This comes directly from the queue inbox, and DOES NOT take
     * into account client messages
     *
     * @param queueId The queue id to read
     * @param bounds The bounds to use when reading
     */
    protected List<UUID> getQueueRange( UUID queueId, QueueBounds bounds, SearchParam params )
    {

        if ( bounds == null )
        {
            logger.error( "Necessary queue bounds not found" );
            throw new QueueException( "Neccessary queue bounds not found" );
        }

        UUID finish_uuid = params.reversed ? bounds.getOldest() : bounds.getNewest();

        List<UUID> results = new ArrayList<UUID>( params.limit );

        UUID start = params.startId;

        if ( start == null )
        {
            start = params.reversed ? bounds.getNewest() : bounds.getOldest();
        }

        if ( start == null )
        {
            logger.error( "No first message in queue" );
            return results;
        }

        if ( finish_uuid == null )
        {
            logger.error( "No last message in queue" );
            return results;
        }

        long start_ts_shard = roundLong( getTimestampInMillis( start ), QUEUE_SHARD_INTERVAL );

        long finish_ts_shard = roundLong( getTimestampInMillis( finish_uuid ), QUEUE_SHARD_INTERVAL );

        long current_ts_shard = start_ts_shard;
        if ( params.reversed )
        {
            current_ts_shard = finish_ts_shard;
        }

        while ( ( current_ts_shard >= start_ts_shard ) && ( current_ts_shard <= finish_ts_shard ) )
        {

            UUID slice_start = MIN_TIME_UUID;
            UUID slice_end = MAX_TIME_UUID;

            if ( current_ts_shard == start_ts_shard )
            {
                slice_start = start;
            }

            if ( current_ts_shard == finish_ts_shard )
            {
                slice_end = finish_uuid;
            }

            SliceQuery<ByteBuffer, UUID, ByteBuffer> q = createSliceQuery( ko, be, ue, be );
            q.setColumnFamily( QUEUE_INBOX.getColumnFamily() );
            q.setKey( getQueueShardRowKey( queueId, current_ts_shard ) );
            q.setRange( slice_start, slice_end, params.reversed, params.limit + 1 );

            List<HColumn<UUID, ByteBuffer>> cassResults = q.execute().get().getColumns();

            for ( int i = 0; i < cassResults.size(); i++ )
            {
                HColumn<UUID, ByteBuffer> column = cassResults.get( i );

                // skip the first one, we've already read it
                if ( i == 0 && params.skipFirst && params.startId.equals( column.getName() ) )
                {
                    continue;
                }

                UUID id = column.getName();

                results.add( id );

                logger.debug( "Added id '{}' to result set for queue id '{}'", id, queueId );

                if ( results.size() >= params.limit )
                {
                    return results;
                }
            }

            if ( params.reversed )
            {
                current_ts_shard -= QUEUE_SHARD_INTERVAL;
            }
            else
            {
                current_ts_shard += QUEUE_SHARD_INTERVAL;
            }
        }

        return results;
    }

    /**
     * Get the bounds for the queue
     *
     * @return The bounds for the queue
     */
    public QueueBounds getQueueBounds( UUID queueId )
    {
        try
        {
            ColumnSlice<String, UUID> result = HFactory.createSliceQuery( ko, ue, se, ue ).setKey( queueId )
                                                       .setColumnNames( QUEUE_NEWEST, QUEUE_OLDEST )
                                                       .setColumnFamily( QUEUE_PROPERTIES.getColumnFamily() ).execute()
                                                       .get();
            if ( result != null && result.getColumnByName( QUEUE_OLDEST ) != null
                    && result.getColumnByName( QUEUE_NEWEST ) != null )
            {
                return new QueueBounds( result.getColumnByName( QUEUE_OLDEST ).getValue(),
                        result.getColumnByName( QUEUE_NEWEST ).getValue() );
            }
        }
        catch ( Exception e )
        {
            logger.error( "Error getting oldest queue message ID", e );
        }
        return null;
    }

    /**
     * Write the updated client pointer
     *
     * @param lastReturnedId This is a null safe parameter. If it's null, this won't be written since it means we didn't
     * read any messages
     */
    protected void writeClientPointer( UUID queueId, UUID consumerId, UUID lastReturnedId )
    {
        // nothing to do
        if ( lastReturnedId == null )
        {
            return;
        }

        // we want to set the timestamp to the value from the time uuid. If this is
        // not the max time uuid to ever be written
        // for this consumer, we want this to be discarded to avoid internode race
        // conditions with clock drift.
        long colTimestamp = UUIDUtils.getTimestampInMicros( lastReturnedId );

        Mutator<UUID> mutator = createMutator( ko, ue );

        if ( logger.isDebugEnabled() )
        {
            logger.debug( "Writing last client id pointer of '{}' for queue '{}' and consumer '{}' with timestamp '{}",
                    new Object[] {
                            lastReturnedId, queueId, consumerId, colTimestamp
                    } );
        }

        mutator.addInsertion( consumerId, CONSUMERS.getColumnFamily(),
                createColumn( queueId, lastReturnedId, colTimestamp, ue, ue ) );

        mutator.execute();
    }

    private class RequestedOrderComparator implements Comparator<Message>
    {

        private Map<UUID, Integer> indexCache = new HashMap<UUID, Integer>();

        private RequestedOrderComparator( Collection<UUID> ids )
        {
            int i = 0;

            for ( UUID id : ids )
            {
                indexCache.put( id, i );
                i++;
            }
        }

        /*
         * (non-Javadoc)
         *
         * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
         */
        @Override
        public int compare( Message o1, Message o2 )
        {
            int o1Idx = indexCache.get( o1.getUuid() );

            int o2Idx = indexCache.get( o2.getUuid() );

            return o1Idx - o2Idx;
        }
    }
}


text:
''' <summary>
''' Interface for use in GenericSave
''' </summary>
''' <remarks></remarks>
Public Interface Offsets
    ReadOnly Property TeamNameStart As Integer
    ReadOnly Property BackupSaveStart As Integer
    ReadOnly Property ChecksumEnd As Integer
    ReadOnly Property QuicksaveStart As Integer?
    ''' <summary>
    ''' Specifies the beginning offset of the data used to calculate the quicksave checksum
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    ReadOnly Property QuicksaveChecksumStart As Integer
    ''' <summary>
    ''' Specifies the ending offset of the data used to calculate the quicksave checksum
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    ReadOnly Property QuicksaveChecksumEnd As Integer
End Interface
Public Class SkyOffsets
    Implements Offsets

    Public ReadOnly Property TeamNameStart As Integer Implements Offsets.TeamNameStart
        Get
            Return &H994E
        End Get
    End Property

    Public ReadOnly Property BackupSaveStart As Integer Implements Offsets.BackupSaveStart
        Get
            Return &HC800
        End Get
    End Property

    Public ReadOnly Property ChecksumEnd As Integer Implements Offsets.ChecksumEnd
        Get
            Return &HB65A
        End Get
    End Property

    Public ReadOnly Property QuicksaveChecksumEnd As Integer Implements Offsets.QuicksaveChecksumEnd
        Get
            Return &H1E7FF
        End Get
    End Property

    Public ReadOnly Property QuicksaveChecksumStart As Integer Implements Offsets.QuicksaveChecksumStart
        Get
            Return &H19004
        End Get
    End Property

    Public ReadOnly Property QuicksaveStart As Integer? Implements Offsets.QuicksaveStart
        Get
            Return &H19000
        End Get
    End Property
End Class
Public Class TDOffsets
    Implements Offsets

    Public ReadOnly Property TeamNameStart As Integer Implements Offsets.TeamNameStart
        Get
            Return &H96F7
        End Get
    End Property

    Public ReadOnly Property BackupSaveStart As Integer Implements Offsets.BackupSaveStart
        Get
            Return &H10000
        End Get
    End Property

    Public ReadOnly Property ChecksumEnd As Integer Implements Offsets.ChecksumEnd
        Get
            Return &HDC7B
        End Get
    End Property

    Public ReadOnly Property QuicksaveChecksumEnd As Integer Implements Offsets.QuicksaveChecksumEnd
        Get
            Return &H2E0FF
        End Get
    End Property

    Public ReadOnly Property QuicksaveChecksumStart As Integer Implements Offsets.QuicksaveChecksumStart
        Get
            Return &H2E004
        End Get
    End Property

    Public ReadOnly Property QuicksaveStart As Integer? Implements Offsets.QuicksaveStart
        Get
            Return &H2E000
        End Get
    End Property
End Class
Public Class RBOffsets
    Implements Offsets

    Public ReadOnly Property BackupSaveStart As Integer Implements Offsets.BackupSaveStart
        Get
            Return &H6000
        End Get
    End Property

    Public ReadOnly Property ChecksumEnd As Integer Implements Offsets.ChecksumEnd
        Get
            Return &H57D0
        End Get
    End Property

    Public ReadOnly Property QuicksaveChecksumEnd As Integer Implements Offsets.QuicksaveChecksumEnd
        Get
            Return Nothing
        End Get
    End Property

    Public ReadOnly Property QuicksaveChecksumStart As Integer Implements Offsets.QuicksaveChecksumStart
        Get
            Return Nothing
        End Get
    End Property

    Public ReadOnly Property QuicksaveStart As Integer? Implements Offsets.QuicksaveStart
        Get
            Return Nothing
        End Get
    End Property

    Public ReadOnly Property TeamNameStart As Integer Implements Offsets.TeamNameStart
        Get
            Return &H4EC8
        End Get
    End Property
End Class
Public Class RBOffsetsEU
    Implements Offsets

    Public ReadOnly Property BackupSaveStart As Integer Implements Offsets.BackupSaveStart
        Get
            Return &H6000
        End Get
    End Property

    Public ReadOnly Property ChecksumEnd As Integer Implements Offsets.ChecksumEnd
        Get
            Return &H57D0
        End Get
    End Property

    Public ReadOnly Property QuicksaveChecksumEnd As Integer Implements Offsets.QuicksaveChecksumEnd
        Get
            Return Nothing
        End Get
    End Property

    Public ReadOnly Property QuicksaveChecksumStart As Integer Implements Offsets.QuicksaveChecksumStart
        Get
            Return Nothing
        End Get
    End Property

    Public ReadOnly Property QuicksaveStart As Integer? Implements Offsets.QuicksaveStart
        Get
            Return Nothing
        End Get
    End Property

    Public ReadOnly Property TeamNameStart As Integer Implements Offsets.TeamNameStart
        Get
            Return &H4EC8
        End Get
    End Property
End Class
Public Class OffsetManager
    ''' <summary>
    ''' Gets the offset definition using the save file, only for Pokemon Mystery Dungeon: Red/Blue Rescue Team and Explorers of Time/Darkness/Sky
    ''' </summary>
    ''' <param name="RawData"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    <Obsolete>
    Public Shared Function GetOffsets(RawData As Byte()) As Offsets
        Select Case RawData(&HD)
            Case &H54
                Return New TDOffsets
            Case &H53
                Return New SkyOffsets
            Case Else
                If Not (RawData(4) = &H50 AndAlso RawData(5) = &H4F AndAlso RawData(6) = &H4B AndAlso RawData(7) = &H45) Then
                    Return New RBOffsets
                Else
                    Return New SkyOffsets
                End If
        End Select
    End Function
    Public Shared Function GetOffsets(Save As MDSaveBase) As Offsets
        If TypeOf Save Is SkySave Then
            Return New SkyOffsets
        ElseIf TypeOf Save Is TDSave Then
            Return New TDOffsets
        ElseIf TypeOf Save Is RBSave Then
            Return New RBOffsets
        ElseIf TypeOf Save Is RBSaveEU Then
            Return New RBOffsetsEU
        Else
            Return New SkyOffsets
        End If
    End Function
End Class


text:
package com.meidusa.venus.validate.validator.annotation;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.HashMap;

import com.meidusa.venus.validate.exception.ValidationRuntimeException;
import com.meidusa.venus.validate.validator.DateRangeFieldValidator;
import com.meidusa.venus.validate.validator.DoubleRangeFieldValidator;
import com.meidusa.venus.validate.validator.EmailValidator;
import com.meidusa.venus.validate.validator.FieldExpressionValidator;
import com.meidusa.venus.validate.validator.IntRangeFieldValidator;
import com.meidusa.venus.validate.validator.LongRangeFieldValidator;
import com.meidusa.venus.validate.validator.RegexFieldValidator;
import com.meidusa.venus.validate.validator.RequiredFieldValidator;
import com.meidusa.venus.validate.validator.StringDateFormatValidator;
import com.meidusa.venus.validate.validator.StringInValidator;
import com.meidusa.venus.validate.validator.StringLengthFieldValidator;
import com.meidusa.venus.validate.validator.StringNotEmptyValidator;
import com.meidusa.venus.validate.validator.URLValidator;
import com.meidusa.venus.validate.validator.VisitorFieldValidator;

public class AnnotationValidatorFactoryGroup {

    public static class DateRangeFactory implements AnnotationValidatorFactory<DateRange, DateRangeFieldValidator> {
        private HashMap<String, DateFormat> patternMap = new HashMap<String, DateFormat>();

        @Override
        public DateRangeFieldValidator createValidator(DateRange anno, String fieldName) {
            DateRangeFieldValidator validator = new DateRangeFieldValidator();

            DateFormat format = patternMap.get(anno.format());
            if (format == null) {
                synchronized (patternMap) {
                    format = patternMap.get(anno.format());
                    if (format == null) {
                        format = new SimpleDateFormat(anno.format());
                        patternMap.put(anno.format(), format);
                    }
                }
            }

            try {
                validator.setMin(format.parse(anno.min()));
                validator.setMax(format.parse(anno.max()));
            } catch (ParseException e) {
                throw new ValidationRuntimeException("can't parse date, format should be set", e);
            }
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            return validator;
        }

    }

    public static class DoubleRangeFactory implements AnnotationValidatorFactory<DoubleRange, DoubleRangeFieldValidator> {

        @Override
        public DoubleRangeFieldValidator createValidator(DoubleRange anno, String fieldName) {
            DoubleRangeFieldValidator validator = new DoubleRangeFieldValidator();
            validator.setMaxExclusiveValue(anno.maxExclusive());
            validator.setMaxInclusiveValue(anno.maxInclusive());
            validator.setMinExclusiveValue(anno.minExclusive());
            validator.setMinInclusiveValue(anno.minInclusive());
            validator.setFromAnnotation(true);
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            return validator;
        }

    }

    public static class EmailFactory implements AnnotationValidatorFactory<Email, EmailValidator> {

        @Override
        public EmailValidator createValidator(Email anno, String fieldName) {
            EmailValidator validator = new EmailValidator();
            validator.setMessage(anno.message());
            validator.setTrim(anno.trim());
            validator.setCaseSensitive(anno.caseSensitive());
            validator.setFieldName(fieldName);
            return validator;
        }
    }

    public static class FieldExpressionFactory implements AnnotationValidatorFactory<Expression, FieldExpressionValidator> {

        @Override
        public FieldExpressionValidator createValidator(Expression anno, String fieldName) {
            FieldExpressionValidator validator = new FieldExpressionValidator();
            validator.setExpression(anno.value());
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            return validator;
        }

    }

    public static class IntRangeFactory implements AnnotationValidatorFactory<IntRange, IntRangeFieldValidator> {

        @Override
        public IntRangeFieldValidator createValidator(IntRange anno, String fieldName) {
            IntRangeFieldValidator validator = new IntRangeFieldValidator();
            validator.setMin(anno.min());
            validator.setMax(anno.max());
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            return validator;
        }
    }

    public static class LongRangeFactory implements AnnotationValidatorFactory<LongRange, LongRangeFieldValidator> {

        @Override
        public LongRangeFieldValidator createValidator(LongRange anno, String fieldName) {
            LongRangeFieldValidator validator = new LongRangeFieldValidator();
            validator.setMin(anno.min());
            validator.setMax(anno.max());
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            return validator;
        }
    }

    public static class RegexFactory implements AnnotationValidatorFactory<Regex, RegexFieldValidator> {

        @Override
        public RegexFieldValidator createValidator(Regex anno, String fieldName) {
            RegexFieldValidator validator = new RegexFieldValidator();
            validator.setExpression(anno.value());
            validator.setTrim(anno.trim());
            validator.setCaseSensitive(anno.caseSensitive());
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            return validator;
        }
    }

    public static class RequiredFactory implements AnnotationValidatorFactory<Required, RequiredFieldValidator> {

        @Override
        public RequiredFieldValidator createValidator(Required anno, String fieldName) {
            RequiredFieldValidator validator = new RequiredFieldValidator();
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            return validator;
        }
    }

    public static class StringNotEmptyFactory implements AnnotationValidatorFactory<StringNotEmpty, StringNotEmptyValidator> {

        @Override
        public StringNotEmptyValidator createValidator(StringNotEmpty anno, String fieldName) {
            StringNotEmptyValidator validator = new StringNotEmptyValidator();
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            validator.setTrim(anno.trim());
            return validator;
        }
    }

    public static class StringLengthFactory implements AnnotationValidatorFactory<StringLength, StringLengthFieldValidator> {

        @Override
        public StringLengthFieldValidator createValidator(StringLength anno, String fieldName) {
            StringLengthFieldValidator validator = new StringLengthFieldValidator();
            validator.setMinLength(anno.minLength());
            validator.setMaxLength(anno.maxLength());
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            validator.setTrim(anno.trim());
            return validator;
        }
    }

    public static class URLFactory implements AnnotationValidatorFactory<URL, URLValidator> {

        @Override
        public URLValidator createValidator(URL anno, String fieldName) {
            URLValidator validator = new URLValidator();
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            return validator;
        }
    }

    public static class VisitorFactory implements AnnotationValidatorFactory<Visitor, VisitorFieldValidator> {
        @Override
        public VisitorFieldValidator createValidator(Visitor annotation, String fieldName) {
            VisitorFieldValidator validator = new VisitorFieldValidator();
            Visitor anno = (Visitor) annotation;
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            validator.setPolicy(anno.policy());
            return validator;
        }
    }

    public static class StringInFactory implements AnnotationValidatorFactory<StringIn, StringInValidator> {

        @Override
        public StringInValidator createValidator(StringIn anno, String fieldName) {
            StringInValidator validator = new StringInValidator();
            validator.setMessage(anno.message());
            validator.setFieldName(fieldName);
            validator.setTrim(anno.trim());
            validator.setInString(Arrays.asList(anno.in()));
            return validator;
        }
    }

    public static class StringDateFormatFactory implements AnnotationValidatorFactory<StringDateFormat, StringDateFormatValidator> {

        @Override
        public StringDateFormatValidator createValidator(StringDateFormat annotation, String fieldName) {
            StringDateFormatValidator validator = new StringDateFormatValidator();
            validator.setFieldName(fieldName);
            validator.setMessage(annotation.message());
            validator.setDateFormat(annotation.value());
            return validator;
        }

    }

}


text:
package parser

import (
	"testing"
)

func TestAcceptLanguageParser(t *testing.T) {
	var tvi = []string{
		"Accept-Language: da    \n",
		"Accept-Language: 	\n",
		"Accept-Language: da,en-gb;q=0.8\n",
		"Accept-Language: *		\n"}
	var tvo = []string{
		"Accept-Language: da    \n",
		"Accept-Language: 	\n",
		"Accept-Language: da,en-gb;q=0.8\n",
		"Accept-Language: *		\n"}

	for i := 0; i < len(tvi); i++ {
		shp := NewAcceptLanguageParser(tvi[i])
		testHeaderParser(t, shp, tvo[i])
	}
}

/**
        public static void main(String args[]) throws ParseException {
		String acceptLanguage[] = {
        		"Accept-Language: da    \n",
        		"Accept-Language:\n",
        		"Accept-Language: da, en-gb;q=0.8\n",
        	        "Accept-Language: *\n" };

		for (int i =0 ; i < acceptLanguage.length; i++) {
			AcceptLanguageParser alp = new AcceptLanguageParser
				(acceptLanguage[i]);
			AcceptLanguageList all = (AcceptLanguageList)
				alp.parse();
			System.out.println(all.toString());
		}
	}
**/


text:
import os
import pickle
import numpy as np
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")

import django
django.setup()

from basicviz.models import *
from motifdb.models import *

if __name__ == '__main__':
    motifset_id = int(sys.argv[1])
    experiment_id = int(sys.argv[2])

    experiment = Experiment.objects.get(id = experiment_id)
    original_motifs = Mass2Motif.objects.filter(experiment = experiment)

    print(experiment)

    m_dict = {m.name:m for m in original_motifs}

    motif_set = MDBMotifSet.objects.get(id = motifset_id)
    mdb_motifs = MDBMotif.objects.filter(motif_set = motif_set)

    print(motif_set)

    for m in mdb_motifs:
        old_name = '_'.join(m.name.split('_')[1:]).split('.')[0]
        old_motif = m_dict[old_name]
        print(m,old_motif)
        m.linkmotif = old_motif
        m.save()


text:
title: "Flatten Binary Tree to Linked List"
description: "Some description ..."
authors: ["lek-tin"]
tags: ["leetcode", "binary-tree"]
categories: ["algorithm"]
date: 2020-03-24T03:28:41-07:00
lastmod: 2020-03-24T03:28:41-07:00
draft: false
archive: false
---
Given a binary tree, flatten it to a linked list **in-place**.

For example, given the following tree:

```

    1
   / \
  2   5
 / \   \
3   4   6
```

The flattened tree should look like:

```
1
 \
  2
   \
    3
     \
      4
       \
        5
         \
          6
```

### Solution

```python
# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution:
    def flatten(self, root: TreeNode) -> None:
        """
        Do not return anything, modify root in-place instead.
        """
        self.dfs(root)

    def dfs(self, root):
        if not root:
            return None

        # leaf node
        if not root.left and not root.right:
            return root

        leftTail = self.dfs(root.left)
        rightTail = self.dfs(root.right)

        if leftTail:
            leftTail.right = root.right
            root.right = root.left
            root.left = None

        return rightTail if rightTail else leftTail
```


text:
name             "wordpress-nginx"
maintainer       "Jimmy Hillis"
maintainer_email "jimmy@hillis.me"
license          "MIT"
description      "Installs and configures Wordpress running under nginx"
long_description IO.read(File.join(File.dirname(__FILE__), "README.md"))
version          "0.1.1"

depends "git"
depends "database"
depends "mysql"
depends "nginx"
depends "php-fpm"


text:
/*\
title: hasOwnProperty/program.js
type: application/javascript
module-type: library

OwnProperty test

\*/

var hasOwnProperty = require('hasOwnProperty');
var toString = require('toString');
var test = require('test');
test.print('DONE', 'info');


text:
<meta name="google-signin-client_id" content="561588943542-fq7065hk47qdf3lfsc50ebll4spi6u76.apps.googleusercontent.com">

Sign out

Your auth token:

Loading...